xstate 6.0.0-alpha.56 → 6.0.0-alpha.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/actors/index.d.ts +1 -1
- package/dist/declarations/src/base.types.d.ts +87 -0
- package/dist/declarations/src/fsm.d.ts +1 -3
- package/dist/declarations/src/index.d.ts +2 -7
- package/dist/declarations/src/setup.d.ts +58 -63
- package/dist/declarations/src/types.d.ts +2 -8
- package/dist/declarations/src/types.v6.d.ts +33 -38
- package/dist/{types-69f39448.esm.js → types-1378f0fa.esm.js} +0 -2
- package/dist/{types-802dc45c.cjs.js → types-91238aab.cjs.js} +0 -2
- package/dist/{types-ec6c763a.development.cjs.js → types-939a97c6.development.cjs.js} +0 -2
- package/dist/{types-33de9b3d.development.esm.js → types-94ac7819.development.esm.js} +0 -2
- package/dist/xstate-fsm.umd.min.js.map +1 -1
- package/dist/xstate-scxml.cjs.js +1 -1
- package/dist/xstate-scxml.development.cjs.js +1 -1
- package/dist/xstate-scxml.development.esm.js +1 -1
- package/dist/xstate-scxml.esm.js +1 -1
- package/dist/xstate-scxml.umd.min.js.map +1 -1
- package/dist/xstate.cjs.js +40 -10
- package/dist/xstate.development.cjs.js +40 -10
- package/dist/xstate.development.esm.js +41 -11
- package/dist/xstate.esm.js +41 -11
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,5 +5,5 @@ export { createLogic, type LogicActorLogic, type LogicActorRef, type LogicArgs,
|
|
|
5
5
|
export { createAsyncLogic, type AsyncActorLogic, type AsyncActorRef, type AsyncSnapshot, type LogicArgs as AsyncLogicArgs, type LogicConfig as AsyncLogicConfig, type LogicEnqueue as AsyncLogicEnqueue, type LogicFunction as AsyncLogicFunction, TimeoutError } from "./promise.js";
|
|
6
6
|
export { createListenerLogic, listenerLogic, type ListenerActorLogic, type ListenerActorRef, type ListenerSnapshot, type ListenerInput } from "./listener.js";
|
|
7
7
|
export { createSubscriptionLogic, subscriptionLogic, type SubscriptionActorLogic, type SubscriptionActorRef, type SubscriptionSnapshot, type SubscriptionInput, type SubscriptionMappers } from "./subscription.js";
|
|
8
|
-
declare const emptyLogic: import("./logic.js").LogicActorLogic<undefined, undefined, import("../types.js").EventObject, import("../types.js").NonReducibleUnknown, import("../types.js").EventObject>;
|
|
8
|
+
declare const emptyLogic: import("./logic.js").LogicActorLogic<undefined, undefined, import("../base.types.js").EventObject, import("../types.js").NonReducibleUnknown, import("../base.types.js").EventObject>;
|
|
9
9
|
export declare function createEmptyActor(): ActorFromLogic<typeof emptyLogic>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lean type primitives shared by the main `xstate` entry and the compact
|
|
3
|
+
* `xstate/fsm` entry. This module (plus `schema.types.ts`) must stay free of
|
|
4
|
+
* imports from the rest of the package so that `xstate/fsm` consumers do not
|
|
5
|
+
* pull the full type surface into their program.
|
|
6
|
+
*/
|
|
7
|
+
import type { SetupStateSchemas, StandardSchemaV1, TypeSchema } from "./schema.types.js";
|
|
8
|
+
declare global {
|
|
9
|
+
interface SymbolConstructor {
|
|
10
|
+
readonly observable: symbol;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** The full definition of an event, with a string `type`. */
|
|
14
|
+
export type EventObject = {
|
|
15
|
+
/** The type of event that is sent. */
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
export type MachineContext = Record<string, any>;
|
|
19
|
+
export type Values<T> = T[keyof T];
|
|
20
|
+
export type ActionSchemas = Record<string, {
|
|
21
|
+
params: StandardSchemaV1;
|
|
22
|
+
}>;
|
|
23
|
+
export type GuardSchemas = Record<string, {
|
|
24
|
+
params: StandardSchemaV1;
|
|
25
|
+
}>;
|
|
26
|
+
/** State node types that can be declared in a setup state contract. */
|
|
27
|
+
export type SetupStateType = 'atomic' | 'compound' | 'parallel' | 'final' | 'history' | 'choice';
|
|
28
|
+
export type SetupSchemas = {
|
|
29
|
+
context?: StandardSchemaV1;
|
|
30
|
+
events?: Record<string, StandardSchemaV1>;
|
|
31
|
+
internalEvents?: Record<string, StandardSchemaV1>;
|
|
32
|
+
actions?: ActionSchemas;
|
|
33
|
+
guards?: GuardSchemas;
|
|
34
|
+
emitted?: Record<string, StandardSchemaV1>;
|
|
35
|
+
input?: StandardSchemaV1;
|
|
36
|
+
output?: StandardSchemaV1;
|
|
37
|
+
meta?: StandardSchemaV1;
|
|
38
|
+
transitionMeta?: StandardSchemaV1;
|
|
39
|
+
tags?: StandardSchemaV1;
|
|
40
|
+
children?: Record<string, StandardSchemaV1>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* State schema with optional input/output schemas, structural metadata, and
|
|
44
|
+
* nested states.
|
|
45
|
+
*
|
|
46
|
+
* Structural fields are contracts/defaults for `createMachine(...)`; machine
|
|
47
|
+
* behavior remains authored in the machine config.
|
|
48
|
+
*/
|
|
49
|
+
export interface SetupStateSchema {
|
|
50
|
+
type?: SetupStateType;
|
|
51
|
+
id?: string;
|
|
52
|
+
initial?: string;
|
|
53
|
+
history?: 'shallow' | 'deep' | true;
|
|
54
|
+
target?: string | readonly [string, ...string[]];
|
|
55
|
+
route?: true;
|
|
56
|
+
schemas?: SetupStateSchemas;
|
|
57
|
+
states?: Record<string, SetupStateSchema>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Event payloads from schemas (e.g. Zod) are often inferred as optional in
|
|
61
|
+
* output types. Wrapping in Required<> ensures properties defined in the schema
|
|
62
|
+
* are required on the event. Type-only schemas created with the `types()`
|
|
63
|
+
* helper are exempt: their declared type is authoritative, so optional
|
|
64
|
+
* properties stay optional.
|
|
65
|
+
*/
|
|
66
|
+
export type InferEvents<TEventSchemaMap extends Record<string, StandardSchemaV1>> = Values<{
|
|
67
|
+
[K in keyof TEventSchemaMap & string]: StandardSchemaV1.InferOutput<TEventSchemaMap[K]> extends infer O ? [O] extends [never] ? never : unknown extends O ? O & {
|
|
68
|
+
type: K;
|
|
69
|
+
} : [O] extends [void] ? {
|
|
70
|
+
type: K;
|
|
71
|
+
} : string extends keyof O ? [O[string]] extends [never] ? {
|
|
72
|
+
type: EventTypeFromSchemaKey<K>;
|
|
73
|
+
} : NormalizeEventPayload<TEventSchemaMap[K], O> & {
|
|
74
|
+
type: EventTypeFromSchemaKey<K>;
|
|
75
|
+
} : NormalizeEventPayload<TEventSchemaMap[K], O> & {
|
|
76
|
+
type: EventTypeFromSchemaKey<K>;
|
|
77
|
+
} : never;
|
|
78
|
+
}>;
|
|
79
|
+
/** Infers internal events only from explicitly declared schema keys. */
|
|
80
|
+
export type InferInternalEvents<TEventSchemaMap extends Record<string, StandardSchemaV1>> = string extends keyof TEventSchemaMap ? never : InferEvents<TEventSchemaMap>;
|
|
81
|
+
type EventTypeFromSchemaKey<TKey extends string> = TKey extends '*' ? string : TKey extends `${infer TLeading}.*` ? `${TLeading}.${string}` : TKey;
|
|
82
|
+
/**
|
|
83
|
+
* Keeps a type-only schema's payload verbatim; applies Required<> to payloads
|
|
84
|
+
* from validator libraries (see {@link InferEvents}).
|
|
85
|
+
*/
|
|
86
|
+
type NormalizeEventPayload<TSchema extends StandardSchemaV1, O> = TSchema extends TypeSchema<any> ? O : Required<O>;
|
|
87
|
+
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { EventObject, MachineContext } from "./types.js";
|
|
1
|
+
import type { EventObject, InferEvents, MachineContext, SetupSchemas, SetupStateSchema } from "./base.types.js";
|
|
2
2
|
import type { StandardSchemaV1 } from "./schema.types.js";
|
|
3
|
-
import type { SetupSchemas, SetupStateSchema } from "./setup.js";
|
|
4
|
-
import type { InferEvents } from "./types.v6.js";
|
|
5
3
|
export type FSMArgs<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
6
4
|
context: TContext;
|
|
7
5
|
event: TEvent;
|
|
@@ -11,7 +11,7 @@ export { machineVersions, type AdaptEventsOptions, type EventAdapterHandlers, ty
|
|
|
11
11
|
export { types, isTypeSchema, type StandardSchemaV1, type TypeSchema } from "./schema.types.js";
|
|
12
12
|
export type { ActorValidationBoundary, ActorValidationEventOrigin, ActorValidationRequest, ActorLogicValidator } from "./validation.types.js";
|
|
13
13
|
export { createSystem, setup } from "./setup.js";
|
|
14
|
-
export type { AnySetupConfig, SetupConfig, SetupReturn, SetupReturnFromConfig, SetupSchemas, SystemActorMap, SystemConfig, SystemRuntime, SetupStateSchema, SetupStateSchemas, SetupStateType } from "./setup.js";
|
|
14
|
+
export type { ActiveStateContext, AnySetupConfig, RootContextMarker, StrictSetupStateSchemas, StrictSetupStateTargetsFlag, StrictSetupStateTargetsMarker, RelativeSetupStateSchemasMarker, CurrentSetupStateSchemaMarker, SetupStateParentTypeMarker, SetupStateSchemasWithParentType, RootSetupStateSchemasMarker, WithRootSetupStateSchemas, SetupConfig, SetupReturn, SetupReturnFromConfig, SetupSchemas, SystemActorMap, SystemConfig, SystemRuntime, SetupStateSchema, SetupStateSchemas, SetupStateType } from "./setup.js";
|
|
15
15
|
export { getInitialSnapshot, getNextSnapshot } from "./getNextSnapshot.js";
|
|
16
16
|
export type { InspectionEvent, ActorInspectionEvent, DeadLetterInspectionEvent, TransitionInspectionEvent, ActionRecord, SentRecord } from "./inspection.js";
|
|
17
17
|
export { SimulatedClock } from "./SimulatedClock.js";
|
|
@@ -24,15 +24,10 @@ export type { ActorSystem, ActorSystemRuntime, AnyActorSystem, DeadLetterDetail,
|
|
|
24
24
|
export { toPromise } from "./toPromise.js";
|
|
25
25
|
export type * from "./types.js";
|
|
26
26
|
export { SpecialTargets } from "./types.js";
|
|
27
|
-
export type { Next_MachineConfig as MachineConfig, Next_StateNodeConfig as StateNodeConfig, Next_InvokeConfig as InvokeConfig, Next_TransitionConfigOrTarget as TransitionConfigOrTarget, Sources, InferEvents, WidenLiterals } from "./types.v6.js";
|
|
27
|
+
export type { Next_MachineConfig as MachineConfig, Next_StateNodeConfig as StateNodeConfig, Next_ChoiceStateNodeConfig as ChoiceStateNodeConfig, Next_RegularStateNodeConfig as RegularStateNodeConfig, Next_InvokeConfig as InvokeConfig, Next_TransitionConfigOrTarget as TransitionConfigOrTarget, Sources, InferEvents, WidenLiterals } from "./types.v6.js";
|
|
28
28
|
export { getAllOwnEventDescriptors as __unsafe_getAllOwnEventDescriptors, matchesState, checkStateIn, pathToStateValue, toObserver } from "./utils.js";
|
|
29
29
|
export { transition, initialTransition, getMicrosteps, getInitialMicrosteps, getNextTransitions } from "./transition.js";
|
|
30
30
|
export { executeEffects, isBuiltInExecutableAction } from "./transitionActions.js";
|
|
31
31
|
export { getEffectDescriptor, type EffectDescriptor } from "./effectDescriptor.js";
|
|
32
32
|
export { deliverEvent, runStep, stopActor, terminateActor } from "./runtimeHelpers.js";
|
|
33
33
|
export { waitFor } from "./waitFor.js";
|
|
34
|
-
declare global {
|
|
35
|
-
interface SymbolConstructor {
|
|
36
|
-
readonly observable: symbol;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { SetupStateSchemas, StandardSchemaV1 } from "./schema.types.js";
|
|
2
|
+
import type { SetupSchemas, SetupStateSchema, SetupStateType } from "./base.types.js";
|
|
2
3
|
import type { ActorLogicValidator } from "./validation.types.js";
|
|
3
4
|
import { StateMachine } from "./StateMachine.js";
|
|
4
5
|
import { type Actor, type RequiredActorOptionsKeys } from "./createActor.js";
|
|
5
6
|
import { AnyActorRef, AnyActorLogic, ActorRefFromLogic, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, StateValueFromStateSchema, ToChildren, MetaObject, Cast, Compute, EnqueueObject, DoneActorEvent, DoneStateEvent, ErrorFrom, ErrorActorEvent, SystemRegistry, RegistryKeyForLogic, ActorOptions, Observer, Subscription, OutputArg, SnapshotEvent, SingleOrArray, AfterEvent, TimeoutEvent, ErrorEvent } from "./types.js";
|
|
6
7
|
import { AnyActorSystem } from "./system.js";
|
|
7
8
|
import { InspectionEvent } from "./inspection.js";
|
|
8
|
-
import { ActionSchemas, DelayMapFromNames, DelaySourceMap, GuardSourceMap, GuardSchemas, InferChildren, InferActions, InferGuards, Sources, InferOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_InvokeConfig, Next_StateNodeConfig, Next_TransitionConfigOrTarget, OutputFromConfig, ValidateHistoryDefaults, ValidateStateTargets, WithDefault } from "./types.v6.js";
|
|
9
|
+
import { ActionSchemas, DelayMapFromNames, DelaySourceMap, GuardSourceMap, GuardSchemas, InferChildren, InferActions, InferGuards, Sources, InferOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_InvokeConfig, Next_StateNodeConfig, Next_TransitionConfigOrTarget, FinalStateConfigOutput, OutputFromConfig, ValidateHistoryDefaults, ValidateStateTargets, WithDefault } from "./types.v6.js";
|
|
9
10
|
export type SetupConfig<TSchemas extends SetupSchemas, TStates extends Record<string, SetupStateSchema>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TValidator extends ActorLogicValidator | undefined = ActorLogicValidator | undefined> = {
|
|
10
11
|
validator?: TValidator;
|
|
11
12
|
schemas?: TSchemas;
|
|
@@ -157,39 +158,7 @@ type ValidateRegistryKeys<TConfig, TSystemRegistry extends SystemRegistry, TActo
|
|
|
157
158
|
};
|
|
158
159
|
} : unknown);
|
|
159
160
|
export type { SetupStateSchemas };
|
|
160
|
-
|
|
161
|
-
export type SetupStateType = 'atomic' | 'compound' | 'parallel' | 'final' | 'history' | 'choice';
|
|
162
|
-
export type SetupSchemas = {
|
|
163
|
-
context?: StandardSchemaV1;
|
|
164
|
-
events?: Record<string, StandardSchemaV1>;
|
|
165
|
-
internalEvents?: Record<string, StandardSchemaV1>;
|
|
166
|
-
actions?: ActionSchemas;
|
|
167
|
-
guards?: GuardSchemas;
|
|
168
|
-
emitted?: Record<string, StandardSchemaV1>;
|
|
169
|
-
input?: StandardSchemaV1;
|
|
170
|
-
output?: StandardSchemaV1;
|
|
171
|
-
meta?: StandardSchemaV1;
|
|
172
|
-
transitionMeta?: StandardSchemaV1;
|
|
173
|
-
tags?: StandardSchemaV1;
|
|
174
|
-
children?: Record<string, StandardSchemaV1>;
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* State schema with optional input/output schemas, structural metadata, and
|
|
178
|
-
* nested states.
|
|
179
|
-
*
|
|
180
|
-
* Structural fields are contracts/defaults for `createMachine(...)`; machine
|
|
181
|
-
* behavior remains authored in the machine config.
|
|
182
|
-
*/
|
|
183
|
-
export interface SetupStateSchema {
|
|
184
|
-
type?: SetupStateType;
|
|
185
|
-
id?: string;
|
|
186
|
-
initial?: string;
|
|
187
|
-
history?: 'shallow' | 'deep' | true;
|
|
188
|
-
target?: string | readonly [string, ...string[]];
|
|
189
|
-
route?: true;
|
|
190
|
-
schemas?: SetupStateSchemas;
|
|
191
|
-
states?: Record<string, SetupStateSchema>;
|
|
192
|
-
}
|
|
161
|
+
export type { SetupSchemas, SetupStateSchema, SetupStateType } from "./base.types.js";
|
|
193
162
|
type SetupSchema<TSchemas, TKey extends keyof SetupSchemas> = TKey extends keyof TSchemas ? TSchemas[TKey] extends StandardSchemaV1 ? TSchemas[TKey] : never : never;
|
|
194
163
|
type SetupSchemaMap<TSchemas, TKey extends 'events' | 'internalEvents' | 'emitted' | 'children'> = TKey extends keyof TSchemas ? TSchemas[TKey] extends Record<string, StandardSchemaV1> ? TSchemas[TKey] : never : never;
|
|
195
164
|
type SetupActionSchemaMap<TSchemas> = 'actions' extends keyof TSchemas ? TSchemas['actions'] extends ActionSchemas ? TSchemas['actions'] : never : never;
|
|
@@ -206,48 +175,54 @@ type UncheckedSetupStateSchemas = Record<string, UncheckedSetupStateSchema>;
|
|
|
206
175
|
type SetupStateKey<TStateSchemas extends Record<string, SetupStateSchema>> = string extends SetupStateKeys<TStateSchemas> ? string : [SetupStateKeys<TStateSchemas>] extends [never] ? string : SetupStateKeys<TStateSchemas>;
|
|
207
176
|
type StrictSetupStatePaths<TStateSchemas extends Record<string, SetupStateSchema>> = [SetupStateKeys<TStateSchemas>] extends [never] ? never : StatePaths<TStateSchemas>;
|
|
208
177
|
type SetupRelativeStateTarget<TStateSchemas extends Record<string, SetupStateSchema>> = string extends SetupStateKeys<TStateSchemas> ? `.${string}` : [SetupStateKeys<TStateSchemas>] extends [never] ? '.' : '.' | `.${StatePaths<TStateSchemas> & string}`;
|
|
209
|
-
type SetupStateTarget<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends {
|
|
210
|
-
readonly [strictSetupStateTargets]: true;
|
|
211
|
-
} ? StrictSetupStatePaths<TStateSchemas> | SetupRelativeStateTarget<RelativeSetupStateSchemas<TStateSchemas>> | `#${string}` : string extends SetupStateKeys<TStateSchemas> ? string : [SetupStateKeys<TStateSchemas>] extends [never] ? string : StatePaths<TStateSchemas> | `.${string}` | `#${string}`;
|
|
178
|
+
type SetupStateTarget<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends StrictSetupStateTargetsFlag ? StrictSetupStatePaths<TStateSchemas> | SetupRelativeStateTarget<RelativeSetupStateSchemas<TStateSchemas>> | `#${string}` : string extends SetupStateKeys<TStateSchemas> ? string : [SetupStateKeys<TStateSchemas>] extends [never] ? string : StatePaths<TStateSchemas> | `.${string}` | `#${string}`;
|
|
212
179
|
type KnownSetupStateTarget<TStateSchemas extends Record<string, SetupStateSchema>> = string extends StatePaths<TStateSchemas> ? string extends StatePaths<RelativeSetupStateSchemas<TStateSchemas>> ? never : SetupRelativeStateTarget<RelativeSetupStateSchemas<TStateSchemas>> | RootSetupStateIdTarget<RootSetupStateSchemas<TStateSchemas>> : (StrictSetupStatePaths<TStateSchemas> & string) | SetupRelativeStateTarget<RelativeSetupStateSchemas<TStateSchemas>> | RootSetupStateIdTarget<RootSetupStateSchemas<TStateSchemas>>;
|
|
213
180
|
declare const strictSetupStateTargets: unique symbol;
|
|
214
181
|
declare const relativeSetupStateSchemas: unique symbol;
|
|
215
182
|
declare const rootSetupStateSchemas: unique symbol;
|
|
216
183
|
declare const currentSetupStateSchema: unique symbol;
|
|
217
184
|
declare const parentSetupStateType: unique symbol;
|
|
218
|
-
|
|
185
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
186
|
+
export type StrictSetupStateTargetsFlag = {
|
|
219
187
|
readonly [strictSetupStateTargets]: true;
|
|
188
|
+
};
|
|
189
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
190
|
+
export type RelativeSetupStateSchemasMarker<TRelativeStateSchemas extends Record<string, SetupStateSchema>> = {
|
|
220
191
|
readonly [relativeSetupStateSchemas]: TRelativeStateSchemas;
|
|
221
|
-
|
|
192
|
+
};
|
|
193
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
194
|
+
export type CurrentSetupStateSchemaMarker<TCurrentStateSchema extends SetupStateSchema> = {
|
|
222
195
|
readonly [currentSetupStateSchema]: TCurrentStateSchema;
|
|
223
196
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
type
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
type CurrentSetupStateSchema<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends
|
|
231
|
-
readonly [currentSetupStateSchema]: infer TCurrentStateSchema extends SetupStateSchema;
|
|
232
|
-
} ? TCurrentStateSchema : never;
|
|
197
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
198
|
+
export type StrictSetupStateTargetsMarker<TRelativeStateSchemas extends Record<string, SetupStateSchema>, TRootStateSchemas extends Record<string, SetupStateSchema>, TCurrentStateSchema extends SetupStateSchema> = StrictSetupStateTargetsFlag & RelativeSetupStateSchemasMarker<TRelativeStateSchemas> & RootSetupStateSchemasMarker<TRootStateSchemas> & CurrentSetupStateSchemaMarker<TCurrentStateSchema>;
|
|
199
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
200
|
+
export type StrictSetupStateSchemas<TStateSchemas extends Record<string, SetupStateSchema>, TRelativeStateSchemas extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>, TRootStateSchemas extends Record<string, SetupStateSchema> = RootSetupStateSchemas<TStateSchemas>, TCurrentStateSchema extends SetupStateSchema = never> = TStateSchemas & StrictSetupStateTargetsMarker<TRelativeStateSchemas, TRootStateSchemas, TCurrentStateSchema>;
|
|
201
|
+
type RelativeSetupStateSchemas<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends RelativeSetupStateSchemasMarker<infer TRelativeStateSchemas> ? TRelativeStateSchemas : TStateSchemas;
|
|
202
|
+
type RootSetupStateSchemas<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends RootSetupStateSchemasMarker<infer TRootStateSchemas> ? TRootStateSchemas : TStateSchemas;
|
|
203
|
+
type CurrentSetupStateSchema<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends CurrentSetupStateSchemaMarker<infer TCurrentStateSchema> ? TCurrentStateSchema : never;
|
|
233
204
|
type SetupStateSelfSchema<TStateSchema extends SetupStateSchema> = TStateSchema extends {
|
|
234
205
|
schemas: infer TSchemas extends SetupStateSchemas;
|
|
235
206
|
} ? {
|
|
236
207
|
schemas: TSchemas;
|
|
237
208
|
} : {};
|
|
238
|
-
|
|
209
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
210
|
+
export type SetupStateParentTypeMarker<TParentStateType extends SetupStateType | never> = {
|
|
239
211
|
readonly [parentSetupStateType]: TParentStateType;
|
|
240
212
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
213
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
214
|
+
export type SetupStateSchemasWithParentType<TStateSchemas extends Record<string, SetupStateSchema>, TParentStateType extends SetupStateType | never> = TStateSchemas & SetupStateParentTypeMarker<TParentStateType>;
|
|
215
|
+
type SetupStateParentType<TStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas extends SetupStateParentTypeMarker<infer TParentStateType> ? TParentStateType : never;
|
|
244
216
|
type IsParallelSetupStateParent<TStateSchemas extends Record<string, SetupStateSchema>> = [SetupStateParentType<TStateSchemas>] extends [never] ? false : SetupStateParentType<TStateSchemas> extends 'parallel' ? true : false;
|
|
245
217
|
type ResolveStateSiblingsForPath<TStates extends Record<string, SetupStateSchema>, TPath extends string> = SetupStateParentAtPath<TStates, TPath> extends infer TParent ? [TParent] extends [SetupStateSchema] ? SetupStateSchemasWithParentType<ResolveStateSiblings<TStates, TPath>, TParent extends {
|
|
246
218
|
type: infer TType extends SetupStateType;
|
|
247
219
|
} ? TType : never> : ResolveStateSiblings<TStates, TPath> : never;
|
|
248
|
-
|
|
220
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
221
|
+
export type RootSetupStateSchemasMarker<TRootStateSchemas extends Record<string, SetupStateSchema>> = {
|
|
249
222
|
readonly [rootSetupStateSchemas]: TRootStateSchemas;
|
|
250
223
|
};
|
|
224
|
+
/** @public Referenced by emitted declarations of strict transition targets. */
|
|
225
|
+
export type WithRootSetupStateSchemas<TStateSchemas extends Record<string, SetupStateSchema>, TRootStateSchemas extends Record<string, SetupStateSchema>> = TStateSchemas & RootSetupStateSchemasMarker<TRootStateSchemas>;
|
|
251
226
|
type RootSetupStateTransitionSchemas<TStateSchemas extends Record<string, SetupStateSchema>> = StrictSetupStateSchemas<{}, TStateSchemas, TStateSchemas>;
|
|
252
227
|
type RootSetupStateTarget<TStateSchemas extends Record<string, SetupStateSchema>> = SetupRelativeStateTarget<TStateSchemas> | RootSetupStateIdTarget<TStateSchemas>;
|
|
253
228
|
type SetupStateTransitionChildSchemas<TStateSchema extends SetupStateSchema> = TStateSchema extends {
|
|
@@ -445,12 +420,35 @@ type SetupOutput<TSchemas, TOutputSchema extends StandardSchemaV1> = [
|
|
|
445
420
|
type HasOutputSchema<TSchemas, TOutputSchema extends StandardSchemaV1> = [
|
|
446
421
|
SetupSchema<TSchemas, 'output'>
|
|
447
422
|
] extends [never] ? StandardSchemaV1 extends TOutputSchema ? false : true : true;
|
|
423
|
+
/**
|
|
424
|
+
* Whether a state is final, per the authored config or the setup-declared
|
|
425
|
+
* state contract.
|
|
426
|
+
*/
|
|
427
|
+
type IsFinalState<TStateConfig, TStateSchema> = TStateConfig extends {
|
|
428
|
+
type: 'final';
|
|
429
|
+
} ? true : TStateSchema extends {
|
|
430
|
+
type: 'final';
|
|
431
|
+
} ? true : false;
|
|
432
|
+
/**
|
|
433
|
+
* The union of output types across the config's top-level final states, or
|
|
434
|
+
* `never` when it has none. A setup-declared per-state `schemas.output` wins
|
|
435
|
+
* over the state's inline `schemas.output`, which wins over the state's
|
|
436
|
+
* `output` mapper; a final state with none of these contributes `undefined`.
|
|
437
|
+
*/
|
|
438
|
+
type SetupTopLevelFinalOutput<TConfig, TStates extends Record<string, SetupStateSchema>> = TConfig extends {
|
|
439
|
+
states: infer TConfigStates;
|
|
440
|
+
} ? {
|
|
441
|
+
[K in keyof TConfigStates]: IsFinalState<TConfigStates[K], K extends keyof TStates ? TStates[K] : never> extends true ? K extends keyof TStates ? StateOutput<TStates[K], FinalStateConfigOutput<TConfigStates[K]>> : FinalStateConfigOutput<TConfigStates[K]> : never;
|
|
442
|
+
}[keyof TConfigStates] : never;
|
|
448
443
|
/**
|
|
449
444
|
* The machine's output type. A declared output schema wins; otherwise the type
|
|
450
445
|
* is inferred from the config's `output` property (a mapper's return type, or
|
|
451
|
-
* the static value's type)
|
|
446
|
+
* the static value's type), falling back to the union of top-level
|
|
447
|
+
* final-state output types.
|
|
452
448
|
*/
|
|
453
|
-
type SetupOrConfigOutput<TSchemas, TOutputSchema extends StandardSchemaV1, TConfig
|
|
449
|
+
type SetupOrConfigOutput<TSchemas, TOutputSchema extends StandardSchemaV1, TConfig, TStates extends Record<string, SetupStateSchema>> = HasOutputSchema<TSchemas, TOutputSchema> extends true ? SetupOutput<TSchemas, TOutputSchema> : OutputFromConfig<TConfig, [
|
|
450
|
+
SetupTopLevelFinalOutput<TConfig, TStates>
|
|
451
|
+
] extends [never] ? SetupOutput<TSchemas, TOutputSchema> : SetupTopLevelFinalOutput<TConfig, TStates>>;
|
|
454
452
|
type SetupEmitted<TSchemas, TEmittedSchemaMap extends Record<string, StandardSchemaV1>> = [SetupSchemaMap<TSchemas, 'emitted'>] extends [never] ? WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject> : WithDefault<InferEvents<SetupSchemaMap<TSchemas, 'emitted'>>, AnyEventObject>;
|
|
455
453
|
type SetupMeta<TSchemas, TMetaSchema extends StandardSchemaV1> = [
|
|
456
454
|
SetupSchema<TSchemas, 'meta'>
|
|
@@ -515,7 +513,8 @@ type RootContext<TContext> = typeof rootContext extends keyof TContext ? TContex
|
|
|
515
513
|
type StateContextShape<TStateSchema extends SetupStateSchema, TFallbackContext> = TStateSchema['schemas'] extends {
|
|
516
514
|
context: infer TContextSchema;
|
|
517
515
|
} ? TContextSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TContextSchema> & RootContext<TFallbackContext> & RootContextMarker<TFallbackContext> : RootContext<TFallbackContext> : RootContext<TFallbackContext>;
|
|
518
|
-
|
|
516
|
+
/** @public Referenced by emitted declarations of narrowed state contexts. */
|
|
517
|
+
export type ActiveStateContext<TStateSchema extends SetupStateSchema, TRootContext extends MachineContext, TAncestorContext> = StateContext<TStateSchema, TRootContext> & TAncestorContext & MachineContext;
|
|
519
518
|
type ActiveStateContextShape<TStateSchema extends SetupStateSchema, TAncestorContext> = StateContextShape<TStateSchema, TAncestorContext> & TAncestorContext;
|
|
520
519
|
type WithNestedStates<TConfig, TNestedStates> = TConfig extends {
|
|
521
520
|
type: 'choice';
|
|
@@ -547,9 +546,7 @@ type SetupChoiceTargetConfig<TStateSchemas extends Record<string, SetupStateSche
|
|
|
547
546
|
[K in KnownSetupStateTarget<TStateSchemas>]: {
|
|
548
547
|
target: K;
|
|
549
548
|
} & SetupStateInputConfig<SetupStateSchemaAtTarget<TStateSchemas, K>, TContext, TEvent>;
|
|
550
|
-
}[KnownSetupStateTarget<TStateSchemas>] | (TStateSchemas extends {
|
|
551
|
-
readonly [strictSetupStateTargets]: true;
|
|
552
|
-
} ? {
|
|
549
|
+
}[KnownSetupStateTarget<TStateSchemas>] | (TStateSchemas extends StrictSetupStateTargetsFlag ? {
|
|
553
550
|
target: KnownSetupStateTarget<TStateSchemas>[];
|
|
554
551
|
input?: Record<string, unknown>;
|
|
555
552
|
} : {
|
|
@@ -980,9 +977,7 @@ type StateTransitionResult<TStateSchemas extends Record<string, SetupStateSchema
|
|
|
980
977
|
context: StateTransitionContext<TAllowContextMapper, TContext, TContextShape, StateContextShape<SetupStateSchemaAtTarget<TStateSchemas, K>, TContextShape>, StateContext<SetupStateSchemaAtTarget<TStateSchemas, K>, TContext>, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
981
978
|
});
|
|
982
979
|
}[TKnownTarget] | {
|
|
983
|
-
target: TStateSchemas extends
|
|
984
|
-
readonly [strictSetupStateTargets]: true;
|
|
985
|
-
} ? never : Exclude<TTarget, TKnownTarget>;
|
|
980
|
+
target: TStateSchemas extends StrictSetupStateTargetsFlag ? never : Exclude<TTarget, TKnownTarget>;
|
|
986
981
|
context?: StateTransitionContext<TAllowContextMapper, TContext, TContextShape, TContextShape, TContext, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
987
982
|
reenter?: boolean;
|
|
988
983
|
meta?: TMeta;
|
|
@@ -1047,7 +1042,7 @@ export interface SetupReturn<TStates extends Record<string, SetupStateSchema> =
|
|
|
1047
1042
|
to: RoutableStateId<SetupMachineStateSchema<TConfig, TStates>>;
|
|
1048
1043
|
}), Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<SetupMachineStateSchema<TConfig, TStates>>, TTag & string, [
|
|
1049
1044
|
SetupSchema<TSchemas, 'input'>
|
|
1050
|
-
] extends [never] ? TInput : SetupInput<TSchemas, TInputSchema>, SetupOrConfigOutput<TSchemas, TOutputSchema, TConfig>, SetupEmitted<TSchemas, TEmittedSchemaMap>, SetupMeta<TSchemas, TMetaSchema>, SetupMachineStateSchema<TConfig, TStates>, MergeSourceMaps<SetupActions<TSchemas, TSetupActionMap>, MergeSourceMaps<InferActions<TActionSchemaMap>, TActionMap>>, MergeSourceMaps<TSetupActorMap, TActorMap>, MergeSourceMaps<SetupGuards<TSchemas, TSetupGuardMap>, MergeSourceMaps<InferGuards<TGuardSchemaMap>, TGuardMap>>, DelayMapFromNames<TSetupDelays | TDelays, MergeSourceMaps<TSetupDelayMap, TDelayMap>>, SetupInternalEvents<TSchemas, TInternalEventSchemaMap>, SetupTransitionMeta<TSchemas, TMetaSchema, TTransitionMetaSchema>> & MachineIdentity<TConfig>;
|
|
1045
|
+
] extends [never] ? TInput : SetupInput<TSchemas, TInputSchema>, SetupOrConfigOutput<TSchemas, TOutputSchema, TConfig, TStates>, SetupEmitted<TSchemas, TEmittedSchemaMap>, SetupMeta<TSchemas, TMetaSchema>, SetupMachineStateSchema<TConfig, TStates>, MergeSourceMaps<SetupActions<TSchemas, TSetupActionMap>, MergeSourceMaps<InferActions<TActionSchemaMap>, TActionMap>>, MergeSourceMaps<TSetupActorMap, TActorMap>, MergeSourceMaps<SetupGuards<TSchemas, TSetupGuardMap>, MergeSourceMaps<InferGuards<TGuardSchemaMap>, TGuardMap>>, DelayMapFromNames<TSetupDelays | TDelays, MergeSourceMaps<TSetupDelayMap, TDelayMap>>, SetupInternalEvents<TSchemas, TInternalEventSchemaMap>, SetupTransitionMeta<TSchemas, TMetaSchema, TTransitionMetaSchema>> & MachineIdentity<TConfig>;
|
|
1051
1046
|
/**
|
|
1052
1047
|
* Creates a state node config bound to a specific setup-declared state,
|
|
1053
1048
|
* addressed by a dotted path (e.g. `'loading'` or `'parent.child'`). The
|
|
@@ -9,6 +9,8 @@ import type { ActorSystemRuntime, AnyActorSystem, Clock, DeadLetterDetail, Event
|
|
|
9
9
|
import { Sources, Next_StateNodeConfig } from "./types.v6.js";
|
|
10
10
|
import { StandardSchemaV1 } from "./schema.types.js";
|
|
11
11
|
import { builtInActions } from "./actions.js";
|
|
12
|
+
import type { EventObject, MachineContext, Values } from "./base.types.js";
|
|
13
|
+
export type { EventObject, MachineContext, Values };
|
|
12
14
|
export type Identity<T> = {
|
|
13
15
|
[K in keyof T]: T[K];
|
|
14
16
|
};
|
|
@@ -47,7 +49,6 @@ export type Compute<A> = {
|
|
|
47
49
|
[K in keyof A]: A[K];
|
|
48
50
|
} & unknown;
|
|
49
51
|
export type Prop<T, K> = K extends keyof T ? T[K] : never;
|
|
50
|
-
export type Values<T> = T[keyof T];
|
|
51
52
|
export type Elements<T> = T[keyof T & `${number}`];
|
|
52
53
|
export type Merge<M, N> = Omit<M, keyof N> & N;
|
|
53
54
|
export type IndexByProp<T extends Record<P, string>, P extends keyof T> = {
|
|
@@ -67,11 +68,6 @@ export type LowInfer<T> = T & NonNullable<unknown>;
|
|
|
67
68
|
export type MetaObject = Record<string, any>;
|
|
68
69
|
export type Lazy<T> = () => T;
|
|
69
70
|
export type MaybeLazy<T> = T | Lazy<T>;
|
|
70
|
-
/** The full definition of an event, with a string `type`. */
|
|
71
|
-
export type EventObject = {
|
|
72
|
-
/** The type of event that is sent. */
|
|
73
|
-
type: string;
|
|
74
|
-
};
|
|
75
71
|
export type EventPayloadPattern<TEvent extends EventObject> = TEvent extends any ? Partial<Omit<TEvent, 'type'>> : never;
|
|
76
72
|
export interface AnyEventObject extends EventObject {
|
|
77
73
|
[key: string]: any;
|
|
@@ -88,7 +84,6 @@ export type UnifiedArg<TContext extends MachineContext, TExpressionEvent extends
|
|
|
88
84
|
TODO>, TEvent, AnyEventObject>;
|
|
89
85
|
system: AnyActorSystem;
|
|
90
86
|
} & OutputArg<TExpressionEvent>;
|
|
91
|
-
export type MachineContext = Record<string, any>;
|
|
92
87
|
type DoneEventType = 'xstate.done.actor' | 'xstate.done.state';
|
|
93
88
|
export type OutputArg<TEvent extends EventObject> = TEvent extends {
|
|
94
89
|
type: DoneEventType;
|
|
@@ -1384,4 +1379,3 @@ export type AnyAction = Action<MachineContext, EventObject, EventObject, Sources
|
|
|
1384
1379
|
action: (...args: any[]) => any;
|
|
1385
1380
|
args: any[];
|
|
1386
1381
|
} | AnyEventObject;
|
|
1387
|
-
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { SetupStateSchemas, StandardSchemaV1
|
|
1
|
+
import { SetupStateSchemas, StandardSchemaV1 } from "./schema.types.js";
|
|
2
|
+
import type { ActionSchemas, GuardSchemas, InferEvents, InferInternalEvents } from "./base.types.js";
|
|
3
|
+
export type { ActionSchemas, GuardSchemas, InferEvents, InferInternalEvents };
|
|
2
4
|
import { MachineSnapshot } from "./State.js";
|
|
3
5
|
import { Action, ActorTimeoutEvent, AfterEvent, ActorLogic, ActorRef, ActorRefFromLogic, ActorSelf, AnyActorLogic, AnyActorRef, Compute, DoneActorEvent, DoNotInfer, ErrorFrom, ErrorActorEvent, EnqueueObject, EventDescriptor, ErrorEvent, EventObject, EventPayloadPattern, ExtractEvent, InitialContext, InputFrom, IsNever, MetaObject, NonReducibleUnknown, OutputFrom, SingleOrArray, SnapshotEvent, StateValue, TODO, TransitionContextMapper, TransitionContextPatch, TransitionConfigFunction, Values, AnyStateNode, SystemRegistry, TimeoutEvent } from "./types.js";
|
|
4
6
|
import { MachineContext, Mapper } from "./types.js";
|
|
@@ -14,48 +16,40 @@ export type OutputFromConfig<TConfig, TFallback> = TConfig extends {
|
|
|
14
16
|
output: infer TOutput;
|
|
15
17
|
} ? TOutput extends (...args: never[]) => infer TResult ? TResult : TOutput : TFallback;
|
|
16
18
|
/**
|
|
17
|
-
* The
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* The output type contributed by a single top-level final state: its
|
|
20
|
+
* `schemas.output` if declared, otherwise its `output` mapper's return type
|
|
21
|
+
* (or static value), otherwise `undefined` (a final state with no `output`
|
|
22
|
+
* completes the machine with `undefined` output).
|
|
20
23
|
*/
|
|
21
|
-
export type
|
|
24
|
+
export type FinalStateConfigOutput<TStateConfig> = TStateConfig extends {
|
|
25
|
+
schemas: {
|
|
26
|
+
output: infer TOutputSchema extends StandardSchemaV1;
|
|
27
|
+
};
|
|
28
|
+
} ? StandardSchemaV1.InferOutput<TOutputSchema> : OutputFromConfig<TStateConfig, undefined>;
|
|
22
29
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* helper are exempt: their declared type is authoritative, so optional
|
|
27
|
-
* properties stay optional.
|
|
30
|
+
* The union of output types across the config's top-level final states, or
|
|
31
|
+
* `never` when it has none. Reaching a top-level final state completes the
|
|
32
|
+
* machine with that state's output when no root `output` mapper is declared.
|
|
28
33
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
type:
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
} : NormalizeEventPayload<TEventSchemaMap[K], O> & {
|
|
37
|
-
type: EventTypeFromSchemaKey<K>;
|
|
38
|
-
} : NormalizeEventPayload<TEventSchemaMap[K], O> & {
|
|
39
|
-
type: EventTypeFromSchemaKey<K>;
|
|
40
|
-
} : never;
|
|
41
|
-
}>;
|
|
42
|
-
/** Infers internal events only from explicitly declared schema keys. */
|
|
43
|
-
export type InferInternalEvents<TEventSchemaMap extends Record<string, StandardSchemaV1>> = string extends keyof TEventSchemaMap ? never : InferEvents<TEventSchemaMap>;
|
|
44
|
-
type EventTypeFromSchemaKey<TKey extends string> = TKey extends '*' ? string : TKey extends `${infer TLeading}.*` ? `${TLeading}.${string}` : TKey;
|
|
34
|
+
type TopLevelFinalOutput<TConfig> = TConfig extends {
|
|
35
|
+
states: infer TStates;
|
|
36
|
+
} ? {
|
|
37
|
+
[K in keyof TStates]: TStates[K] extends {
|
|
38
|
+
type: 'final';
|
|
39
|
+
} ? FinalStateConfigOutput<TStates[K]> : never;
|
|
40
|
+
}[keyof TStates] : never;
|
|
45
41
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
42
|
+
* The machine's output type when no output schema is declared in `setup()`: a
|
|
43
|
+
* declared `schemas.output` is authoritative, otherwise the output type is
|
|
44
|
+
* inferred from the config's `output` property, falling back to the union of
|
|
45
|
+
* top-level final-state output types.
|
|
48
46
|
*/
|
|
49
|
-
type
|
|
47
|
+
export type SchemaOrConfigOutput<TOutputSchema extends StandardSchemaV1, TConfig> = StandardSchemaV1 extends TOutputSchema ? OutputFromConfig<TConfig, [
|
|
48
|
+
TopLevelFinalOutput<TConfig>
|
|
49
|
+
] extends [never] ? InferOutput<TOutputSchema, unknown> : TopLevelFinalOutput<TConfig>> : InferOutput<TOutputSchema, unknown>;
|
|
50
50
|
export type InferChildren<TChildrenSchemaMap extends Record<string, StandardSchemaV1>> = string extends keyof TChildrenSchemaMap ? {} : {
|
|
51
51
|
[K in keyof TChildrenSchemaMap & string]?: StandardSchemaV1.InferOutput<TChildrenSchemaMap[K]> extends AnyActorRef ? NormalizeActorRef<StandardSchemaV1.InferOutput<TChildrenSchemaMap[K]>> : never;
|
|
52
52
|
};
|
|
53
|
-
export type ActionSchemas = Record<string, {
|
|
54
|
-
params: StandardSchemaV1;
|
|
55
|
-
}>;
|
|
56
|
-
export type GuardSchemas = Record<string, {
|
|
57
|
-
params: StandardSchemaV1;
|
|
58
|
-
}>;
|
|
59
53
|
export type InferActions<TActionSchemaMap extends ActionSchemas> = string extends keyof TActionSchemaMap ? {} : {
|
|
60
54
|
[K in keyof TActionSchemaMap & string]: (params: StandardSchemaV1.InferOutput<TActionSchemaMap[K]['params']>) => void | {
|
|
61
55
|
context?: any;
|
|
@@ -319,7 +313,8 @@ type Next_RouteConfig<TContext extends MachineContext, TEvent extends EventObjec
|
|
|
319
313
|
});
|
|
320
314
|
type Next_ChoiceConfigFunction<TContext extends MachineContext, TCurrentEvent extends EventObject, TEvent extends EventObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TMeta extends MetaObject, _TCtx extends MachineContext = [TContext] extends [never] ? any : TContext> = (args: Next_ChoiceArgs<TContext, TCurrentEvent, TEvent, TActionMap, TActorMap, TGuardMap, TDelayMap, _TCtx>) => Next_ChoiceTarget<TMeta>;
|
|
321
315
|
export type Next_StateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TDelays extends string, TTag extends string, _TOutput, TEmitted extends EventObject, TStateMeta extends MetaObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TInput = Record<string, unknown> | undefined, TInputMap extends Record<string, unknown> = Record<string, unknown>, TSystemRegistry extends SystemRegistry = SystemRegistry, TChildOutput = unknown, TTransitionMeta extends MetaObject = TStateMeta> = Next_RegularStateNodeConfig<TContext, TEvent, TDelays, TTag, _TOutput, TEmitted, TStateMeta, TTransitionMeta, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TInput, TInputMap, TSystemRegistry, TChildOutput> | Next_ChoiceStateNodeConfig<TContext, TEvent, TTag, TStateMeta, TTransitionMeta, TActionMap, TActorMap, TGuardMap, TDelayMap>;
|
|
322
|
-
|
|
316
|
+
/** @public Referenced by emitted declarations of `Next_StateNodeConfig`. */
|
|
317
|
+
export interface Next_ChoiceStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TTag extends string, TStateMeta extends MetaObject, TTransitionMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays']> {
|
|
323
318
|
contextSchema?: StandardSchemaV1;
|
|
324
319
|
schemas?: SetupStateSchemas;
|
|
325
320
|
type: 'choice';
|
|
@@ -347,7 +342,8 @@ interface Next_ChoiceStateNodeConfig<TContext extends MachineContext, TEvent ext
|
|
|
347
342
|
output?: never;
|
|
348
343
|
target?: never;
|
|
349
344
|
}
|
|
350
|
-
|
|
345
|
+
/** @public Referenced by emitted declarations of `Next_StateNodeConfig`. */
|
|
346
|
+
export interface Next_RegularStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TDelays extends string, TTag extends string, TOutput, TEmitted extends EventObject, TStateMeta extends MetaObject, TTransitionMeta extends MetaObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TInput = Record<string, unknown> | undefined, TInputMap extends Record<string, unknown> = Record<string, unknown>, TSystemRegistry extends SystemRegistry = SystemRegistry, TChildOutput = unknown> {
|
|
351
347
|
contextSchema?: StandardSchemaV1;
|
|
352
348
|
schemas?: SetupStateSchemas;
|
|
353
349
|
/** The initial state transition. */
|
|
@@ -707,4 +703,3 @@ export type ValidateStateTargets<TConfig> = 0 extends 1 & TConfig ? unknown : TC
|
|
|
707
703
|
} ? (TInitial extends {
|
|
708
704
|
target: infer TInitialTarget;
|
|
709
705
|
} ? TInitialTarget : TInitial) extends infer TInitialTarget ? InvalidInitialTarget<TConfig, TStates, TInitialTarget> : never : never) | InvalidNodeTargets<TConfig, TConfig, []> | InvalidTargetsInStates<TConfig, TStates> extends never ? unknown : never : unknown;
|
|
710
|
-
export {};
|
|
@@ -1327,8 +1327,6 @@ function createStateConfig(config) {
|
|
|
1327
1327
|
|
|
1328
1328
|
/** @deprecated Use the built-in `NoInfer` type instead */
|
|
1329
1329
|
|
|
1330
|
-
/** The full definition of an event, with a string `type`. */
|
|
1331
|
-
|
|
1332
1330
|
/**
|
|
1333
1331
|
* The string or object representing the state value relative to the parent
|
|
1334
1332
|
* state node.
|
|
@@ -1329,8 +1329,6 @@ function createStateConfig(config) {
|
|
|
1329
1329
|
|
|
1330
1330
|
/** @deprecated Use the built-in `NoInfer` type instead */
|
|
1331
1331
|
|
|
1332
|
-
/** The full definition of an event, with a string `type`. */
|
|
1333
|
-
|
|
1334
1332
|
/**
|
|
1335
1333
|
* The string or object representing the state value relative to the parent
|
|
1336
1334
|
* state node.
|
|
@@ -1361,8 +1361,6 @@ function createStateConfig(config) {
|
|
|
1361
1361
|
|
|
1362
1362
|
/** @deprecated Use the built-in `NoInfer` type instead */
|
|
1363
1363
|
|
|
1364
|
-
/** The full definition of an event, with a string `type`. */
|
|
1365
|
-
|
|
1366
1364
|
/**
|
|
1367
1365
|
* The string or object representing the state value relative to the parent
|
|
1368
1366
|
* state node.
|
|
@@ -1359,8 +1359,6 @@ function createStateConfig(config) {
|
|
|
1359
1359
|
|
|
1360
1360
|
/** @deprecated Use the built-in `NoInfer` type instead */
|
|
1361
1361
|
|
|
1362
|
-
/** The full definition of an event, with a string `type`. */
|
|
1363
|
-
|
|
1364
1362
|
/**
|
|
1365
1363
|
* The string or object representing the state value relative to the parent
|
|
1366
1364
|
* state node.
|