Type alias CreateOrchestrationMachineOptions<TContext>

CreateOrchestrationMachineOptions<TContext>: {
    actions?: InternalMachineImplementations<TContext, any>["actions"];
    emits?: Record<OrchestrationMachineAllowedStringKeys, OnOrchestrationStateEmit<TContext, string, {
        data: Record<OrchestrationMachineAllowedStringKeys, any>;
        type?: string;
    }>>;
    guards?: InternalMachineImplementations<TContext, any>["guards"];
    transformers?: Record<OrchestrationMachineAllowedStringKeys, OnOrchestrationEventTransformer>;
}

Options configuration for creating an orchestration machine.

Type Parameters

Type declaration

  • Optional actions?: InternalMachineImplementations<TContext, any>["actions"]

    See more information on Actions: XState Actions

  • Optional emits?: Record<OrchestrationMachineAllowedStringKeys, OnOrchestrationStateEmit<TContext, string, {
        data: Record<OrchestrationMachineAllowedStringKeys, any>;
        type?: string;
    }>>

    Dictionary containing functions to emit CloudEvent data for each state. Defines the functions responsible for creating CloudEvents when transitioning to specific states. The keys in this dictionary correspond to state names, and the values are functions of type OnOrchestrationStateEmit.

  • Optional guards?: InternalMachineImplementations<TContext, any>["guards"]

    See more information on Guards: XState Guards

  • Optional transformers?: Record<OrchestrationMachineAllowedStringKeys, OnOrchestrationEventTransformer>

    Dictionary containing transformers for CloudEvent data when events are received. Defines functions responsible for transforming CloudEvent data upon receiving events. The keys in this dictionary correspond to the value of the transformer field in the event of the on clause of the state machine.

Example

// Example machine options configuration:
const machineOptions: CreateOrchestrationMachineOptions<MyContext> = {
emits: {
initialState: (id, state, snapshot) => ({ type: 'evt.state.entered', data: { id, state, snapshot } }),
finalState: (id, state, snapshot) => ({ type: 'evt.orchestration.completed', data: { id, state, snapshot } }),
},
transformers: {
'evt.user.action': (event) => ({ transformedData: event.data.userAction }),
},
actions: {}, // See more information on Actions: [XState Actions](https://stately.ai/docs/actions)
gruads: {}, // See more information on Guards: [XState Guards](https://stately.ai/docs/guards)
};

Generated using TypeDoc