arvo-event-handler
    Preparing search index...

    Class ArvoEventHandler<TContract>

    The foundational component for building stateless, contract-bound services in the Arvo system.

    Type Parameters

    • TContract extends ArvoContract

    Implements

    Index

    Constructors

    • Type Parameters

      • TContract extends ArvoContract<
            string,
            string,
            Record<
                `${number}.${number}.${number}`,
                { accepts: ZodTypeAny; emits: Record<string, z.ZodTypeAny> },
            >,
            Record<string, any>,
        >

      Parameters

      Returns ArvoEventHandler<TContract>

    Properties

    contract: TContract

    Contract instance that defines the event schema and validation rules

    defaultEventEmissionDomains: Required<
        NonNullable<
            ArvoEventHandlerParam<TContract>["defaultEventEmissionDomains"],
        >,
    >

    Domains for routing events

    executionunits: number

    Computational cost metric associated with event handling operations

    Version-specific event handler implementation map

    OpenTelemetry configuration for event handling spans

    Accessors

    • get systemErrorSchema(): ArvoContractRecord<
          `sys.${string}.error`,
          ZodObject<
              {
                  errorMessage: ZodString;
                  errorName: ZodString;
                  errorStack: ZodNullable<ZodString>;
              },
              "strip",
              ZodTypeAny,
              { errorMessage: string; errorName: string; errorStack: string
              | null },
              { errorMessage: string; errorName: string; errorStack: string | null },
          >,
      >

      Provides access to the system error event schema configuration.

      Returns ArvoContractRecord<
          `sys.${string}.error`,
          ZodObject<
              {
                  errorMessage: ZodString;
                  errorName: ZodString;
                  errorStack: ZodNullable<ZodString>;
              },
              "strip",
              ZodTypeAny,
              { errorMessage: string; errorName: string; errorStack: string
              | null },
              { errorMessage: string; errorName: string; errorStack: string | null },
          >,
      >

    Methods

    • Processes an incoming event according to the handler's contract specifications. This method handles the complete lifecycle of event processing including validation, execution, error handling, and multi-domain event broadcasting, while maintaining detailed telemetry through OpenTelemetry.

      Parameters

      Returns Promise<
          {
              events: ArvoEvent<
                  Record<string, any>,
                  Record<string, string | number | boolean | null>,
                  string,
              >[];
          },
      >

      when input or output event data violates the contract schema, or when event emission fails due to invalid data

      when event type doesn't match contract type, when the contract version expected by the event does not exist in handler configuration, or when contract URI mismatch occurs

      for explicitly handled runtime errors that should bubble up