Class ArvoMachine<TId, TVersion, TSelfContract, TServiceContract, TLogic>

Represents an ArvoMachine object that can be consumed by an Arvo orchestrator. ArvoMachine encapsulates the logic and metadata required for an Arvo-compatible state machine. It combines XState's actor logic with Arvo-specific contracts and versioning information.

It is strongly recommended to use setupArvoMachine(...).createMachine(...) instead of creating this object directly. The setup function provides additional type safety and validation that helps prevent runtime errors.

Type Parameters

  • TId extends string
  • TVersion extends ArvoSemanticVersion
  • TSelfContract extends VersionedArvoContract<ArvoOrchestratorContract, TVersion>
  • TServiceContract extends Record<string, VersionedArvoContract<ArvoContract, ArvoSemanticVersion>>
  • TLogic extends AnyActorLogic

Constructors

Properties

contracts: {
    self: TSelfContract;
    services: TServiceContract;
}
id: TId
logic: TLogic
requiresResourceLocking: boolean = true
version: TVersion

Accessors

Methods

  • Validates an event against the machine's contracts and data schemas. Performs validation for both self-contract events and service contract events.

    Parameters

    • event: ArvoEvent<Record<string, any>, Record<string,
          | null
          | string
          | number
          | boolean>, string>

      The event to validate

      See validateInputEvent for more infromation

    • Optionalspan: Span

    Returns EventValidationResult