1 | import type { StateMachine } from "./StateMachine.js";
|
2 | import type { DelayedTransitionDefinition, EventObject, InitialTransitionDefinition, InvokeDefinition, MachineContext, Mapper, StateNodeConfig, StateNodeDefinition, StateNodesConfig, TransitionDefinition, TransitionDefinitionMap, TODO, UnknownAction, ParameterizedObject, AnyStateMachine, ProvidedActor, NonReducibleUnknown, EventDescriptor } from "./types.js";
|
3 | interface StateNodeOptions<TContext extends MachineContext, TEvent extends EventObject> {
|
4 | _key: string;
|
5 | _parent?: StateNode<TContext, TEvent>;
|
6 | _machine: AnyStateMachine;
|
7 | }
|
8 | export declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject> {
|
9 | |
10 |
|
11 |
|
12 | config: StateNodeConfig<TContext, TEvent, TODO,
|
13 | TODO,
|
14 | TODO,
|
15 | TODO,
|
16 | TODO,
|
17 | TODO,
|
18 | TODO>;
|
19 | |
20 |
|
21 |
|
22 | key: string;
|
23 | |
24 |
|
25 |
|
26 | id: string;
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | type: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
|
37 | |
38 |
|
39 |
|
40 | path: string[];
|
41 | |
42 |
|
43 |
|
44 | states: StateNodesConfig<TContext, TEvent>;
|
45 | |
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | history: false | 'shallow' | 'deep';
|
52 | |
53 |
|
54 |
|
55 | entry: UnknownAction[];
|
56 | |
57 |
|
58 |
|
59 | exit: UnknownAction[];
|
60 | |
61 |
|
62 |
|
63 | parent?: StateNode<TContext, TEvent>;
|
64 | |
65 |
|
66 |
|
67 | machine: StateMachine<TContext, TEvent, any,
|
68 | any,
|
69 | any,
|
70 | any,
|
71 | any,
|
72 | any,
|
73 | any,
|
74 | any,
|
75 | any,
|
76 | any>;
|
77 | |
78 |
|
79 |
|
80 | meta?: any;
|
81 | |
82 |
|
83 |
|
84 | output?: Mapper<MachineContext, EventObject, unknown, EventObject> | NonReducibleUnknown;
|
85 | |
86 |
|
87 |
|
88 | order: number;
|
89 | description?: string;
|
90 | tags: string[];
|
91 | transitions: Map<string, TransitionDefinition<TContext, TEvent>[]>;
|
92 | always?: Array<TransitionDefinition<TContext, TEvent>>;
|
93 | constructor(
|
94 | |
95 |
|
96 |
|
97 | config: StateNodeConfig<TContext, TEvent, TODO,
|
98 | TODO,
|
99 | TODO,
|
100 | TODO,
|
101 | TODO,
|
102 | TODO,
|
103 | TODO>, options: StateNodeOptions<TContext, TEvent>);
|
104 | /**
|
105 | * The well-structured state node definition.
|
106 | */
|
107 | get definition(): StateNodeDefinition<TContext, TEvent>;
|
108 | /**
|
109 | * The logic invoked as actors by this state node.
|
110 | */
|
111 | get invoke(): Array<InvokeDefinition<TContext, TEvent, ProvidedActor, ParameterizedObject, ParameterizedObject, string>>;
|
112 | /**
|
113 | * The mapping of events to transitions.
|
114 | */
|
115 | get on(): TransitionDefinitionMap<TContext, TEvent>;
|
116 | get after(): Array<DelayedTransitionDefinition<TContext, TEvent>>;
|
117 | get initial(): InitialTransitionDefinition<TContext, TEvent>;
|
118 | /**
|
119 | * All the event types accepted by this state node and its descendants.
|
120 | */
|
121 | get events(): Array<EventDescriptor<TEvent>>;
|
122 | /**
|
123 | * All the events that have transitions directly from this state node.
|
124 | *
|
125 | * Excludes any inert events.
|
126 | */
|
127 | get ownEvents(): Array<EventDescriptor<TEvent>>;
|
128 | }
|
129 | export {};
|