Type alias OrchestrationMachineConfig<TContext, TEmit, TEventTransformer>

OrchestrationMachineConfig<TContext, TEmit, TEventTransformer>: {
    context?: ((params) => TContext);
    description?: string;
    executionUnits?: number;
    id: string;
    initial?: string;
    states: Record<OrchestrationMachineAllowedStringKeys, OrchestrationStateConfig<TContext, TEmit, TEventTransformer>>;
    type?: Exclude<OrchestrationStateType, "final">;
}

Configuration for an orchestration machine. This defines the machine. It is a subset of xstate machines XState Documentation.

Type Parameters

Type declaration

  • Optional context?: ((params) => TContext)

    Initial context or a function to generate context based on input. Represents the initial data or state of the orchestration machine. It can be a static object or a function that dynamically generates the initial context based on the input parameters.

      • (params): TContext
      • Initial context or a function to generate context based on input. Represents the initial data or state of the orchestration machine. It can be a static object or a function that dynamically generates the initial context based on the input parameters.

        Parameters

        • params: {
              input: any;
          }
          • input: any

        Returns TContext

  • Optional description?: string

    The description of the machine

  • Optional executionUnits?: number

    The execution units which are assigned to this machine. This is the execution cost of the logic executed by the orchestration machine

  • id: string

    The unique identifier for the orchestration machine. Used to distinguish between different machines.

  • Optional initial?: string

    Initial state if the state type is not 'parallel'. Specifies the initial state that the orchestration machine enters when it is first instantiated. Required if the machine is not of type 'parallel'.

  • states: Record<OrchestrationMachineAllowedStringKeys, OrchestrationStateConfig<TContext, TEmit, TEventTransformer>>

    The states of the orchestration machine, defining its behavior and structure. A dictionary where keys are state names and values are configurations for each state. Each state configuration is of type OrchestrationStateConfig.

  • Optional type?: Exclude<OrchestrationStateType, "final">

    Type of the state machine, can be 'parallel'. If not specified it will be synchronous For 'parallel' type, multiple states run together simultaneously.

Example

// Example orchestration machine configuration:
const machineConfig: OrchestrationMachineConfig<MyContext> = {
id: 'myOrchestrationMachine',
context: { initialData: 'default' },
initial: 'initialState',
states: {
initialState: { emit: 'startOrchestration' },
subState1: { type: 'final', emit: 'finalizeState1' },
subState2: { initial: 'nestedInitialState', entry: 'initializeNestedState', states: { nestedInitialState: { ... } } },
},
};

Generated using TypeDoc