import { MachineSnapshot } from "./State.js"; import { StateNode } from "./StateNode.js"; import { AnyActorSystem } from "./system.js"; import type { ActorLogic, ActorScope, AnyActorRef, AnyActorScope, DoNotInfer, Equals, EventDescriptor, EventObject, HistoryValue, InternalMachineImplementations, MachineConfig, MachineContext, MachineImplementationsSimplified, MetaObject, ParameterizedObject, ProvidedActor, Snapshot, StateMachineDefinition, StateValue, TransitionDefinition, ResolvedStateMachineTypes, StateSchema, SnapshotStatus } from "./types.js"; export declare class StateMachine, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TMeta extends MetaObject, TConfig extends StateSchema> implements ActorLogic, TEvent, TInput, AnyActorSystem, TEmitted> { /** The raw config used to create the machine. */ config: MachineConfig & { schemas?: unknown; }; /** The machine's own version. */ version?: string; schemas: unknown; implementations: MachineImplementationsSimplified; root: StateNode; id: string; states: StateNode['states']; events: Array>; constructor( /** The raw config used to create the machine. */ config: MachineConfig & { schemas?: unknown; }, implementations?: MachineImplementationsSimplified); /** * Clones this state machine with the provided implementations and merges the * `context` (if provided). * * @param implementations Options (`actions`, `guards`, `actors`, `delays`, * `context`) to recursively merge with the existing options. * @returns A new `StateMachine` instance with the provided implementations. */ provide(implementations: InternalMachineImplementations, TActor, TAction, TGuard, TDelay, TTag, TEmitted>>): StateMachine; resolveState(config: { value: StateValue; context?: TContext; historyValue?: HistoryValue; status?: SnapshotStatus; output?: TOutput; error?: unknown; } & (Equals extends false ? { context: unknown; } : {})): MachineSnapshot; /** * Determines the next snapshot given the current `snapshot` and received * `event`. Calculates a full macrostep from all microsteps. * * @param snapshot The current snapshot * @param event The received event */ transition(snapshot: MachineSnapshot, event: TEvent, actorScope: ActorScope): MachineSnapshot; /** * Determines the next state given the current `state` and `event`. Calculates * a microstep. * * @param state The current state * @param event The received event */ microstep(snapshot: MachineSnapshot, event: TEvent, actorScope: AnyActorScope): Array>; getTransitionData(snapshot: MachineSnapshot, event: TEvent): Array>; /** * The initial state _before_ evaluating any microsteps. This "pre-initial" * state is provided to initial actions executed in the initial state. */ private getPreInitialState; /** * Returns the initial `State` instance, with reference to `self` as an * `ActorRef`. */ getInitialSnapshot(actorScope: ActorScope, TEvent, AnyActorSystem, TEmitted>, input?: TInput): MachineSnapshot; start(snapshot: MachineSnapshot): void; getStateNodeById(stateId: string): StateNode; get definition(): StateMachineDefinition; toJSON(): StateMachineDefinition; getPersistedSnapshot(snapshot: MachineSnapshot, options?: unknown): Snapshot; restoreSnapshot(snapshot: Snapshot, _actorScope: ActorScope, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot; }