Type alias OrchestrationTransitionConfig<TEventTransformer>

OrchestrationTransitionConfig<TEventTransformer>: {
    actions?: string | string[];
    description?: string;
    eventSchema?: EventSchema<string | undefined>;
    guard?: string | {
        params: Record<string, any>;
        type: string;
    };
    target: string;
    transformer?: TEventTransformer;
}

Configuration for transitioning between states in an orchestration machine.

Type Parameters

  • TEventTransformer extends string | boolean = string

Type declaration

  • Optional actions?: string | string[]

    Name(s) of the functions to execute when the event happens. Provide in the 'actions' key in the options of createOrchestrationMachine. These functions represent the behavior or side-effects to perform upon the event triggering the transition.

  • Optional description?: string

    Description of the transition, providing additional context or information about its purpose. This can be helpful for documentation and understanding the intended behavior of the transition.

  • Optional eventSchema?: EventSchema<string | undefined>

    The schema of the event that is expected to trigger the next state

  • Optional guard?: string | {
        params: Record<string, any>;
        type: string;
    }

    Guard statement to allow the transition only if true. This statement acts as a condition that, when true, permits the execution of the transition's actions. Refer to Stately.ai Guards for more information on guards. It is defined in the gruads key of the options.

  • target: string

    The target state to transition to.

  • Optional transformer?: TEventTransformer

    Transformer function name or the function itself to execute before the event gets executed. This function, if defined, allows for the transformation of data or preparation before the actual execution of the transition's actions. It can be used to modify or adapt the event data before it is processed. It is defined in the transformers key of the options.

Example

// Example transition configuration:
const transitionConfig: OrchestrationTransitionConfig = {
target: 'nextState',
actions: ['notifyUser', 'updateStateData'],
guard: 'isUserAuthorized',
description: 'Transition triggered when a user is authorized to perform an action.',
transformer: 'transformEventData',
};

Generated using TypeDoc