Constructs a Transition instance with basic transition parameters.
Event name triggering the transition.
Configuration object for the transition:
target
: The state machine's target state for this transition.schema
: Optional Zod schema to validate the event data.actions
: Optional array of actions to perform during the transition. Default is all the actions provided by withBasicActions()description
: Optional description of the transition's purpose and functionality.Optional
actions?: Action<TContext, Record<string, any>>[]Optional
description?: stringOptional
guards?: GuardedTransitionV3<TContext, Record<string, any>>[]Optional
schema?: ZodObject<Record<string, any>, UnknownKeysParam, ZodTypeAny, {}, {}>Private
Optional
guardsPrivate
paramsConsolidates and returns a map of all action functions across both guarded and unguarded transitions.
A map where keys are action references and values are the corresponding action handler functions.
Consolidates and returns a map of all guard functions for this transition.
A map where keys are guard references and values are the corresponding guard condition functions.
Compiles and retrieves all the transition configurations for this instance, including both guarded and unguarded transitions.
An array of OrchestrationTransitionConfig objects representing each configured transition.
Retrieves the reference key for this transition, typically the event name that triggers it.
The event name as a string.
Adds a guard condition to this transition, allowing further control over whether the transition should occur based on dynamic context or event conditions.
A GuardedTransition configuration, specifying the condition, associated actions, and any additional metadata.
The instance of this Transition class to allow method chaining.
While using this, explicitly mention the Machine context type on the new Transition definition
Generated using TypeDoc
Manages state transitions within a state machine, allowing configuration of transition conditions, actions, and targets. This class enables defining multiple guarded and unguarded transitions for a single event, providing robust control over state changes based on complex conditions.
Typeparam
TContext Defines the context type for the state machine, describing the state's structure.