xstate 6.0.0-alpha.57 → 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 +0 -5
- package/dist/declarations/src/setup.d.ts +29 -37
- package/dist/declarations/src/types.d.ts +2 -8
- package/dist/declarations/src/types.v6.d.ts +29 -36
- 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 +15 -12
- package/dist/xstate.development.cjs.js +15 -12
- package/dist/xstate.development.esm.js +16 -13
- package/dist/xstate.esm.js +16 -13
- 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;
|
|
@@ -31,8 +31,3 @@ export { executeEffects, isBuiltInExecutableAction } from "./transitionActions.j
|
|
|
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;
|
|
@@ -451,12 +420,35 @@ type SetupOutput<TSchemas, TOutputSchema extends StandardSchemaV1> = [
|
|
|
451
420
|
type HasOutputSchema<TSchemas, TOutputSchema extends StandardSchemaV1> = [
|
|
452
421
|
SetupSchema<TSchemas, 'output'>
|
|
453
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;
|
|
454
443
|
/**
|
|
455
444
|
* The machine's output type. A declared output schema wins; otherwise the type
|
|
456
445
|
* is inferred from the config's `output` property (a mapper's return type, or
|
|
457
|
-
* the static value's type)
|
|
446
|
+
* the static value's type), falling back to the union of top-level
|
|
447
|
+
* final-state output types.
|
|
458
448
|
*/
|
|
459
|
-
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>>;
|
|
460
452
|
type SetupEmitted<TSchemas, TEmittedSchemaMap extends Record<string, StandardSchemaV1>> = [SetupSchemaMap<TSchemas, 'emitted'>] extends [never] ? WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject> : WithDefault<InferEvents<SetupSchemaMap<TSchemas, 'emitted'>>, AnyEventObject>;
|
|
461
453
|
type SetupMeta<TSchemas, TMetaSchema extends StandardSchemaV1> = [
|
|
462
454
|
SetupSchema<TSchemas, 'meta'>
|
|
@@ -1050,7 +1042,7 @@ export interface SetupReturn<TStates extends Record<string, SetupStateSchema> =
|
|
|
1050
1042
|
to: RoutableStateId<SetupMachineStateSchema<TConfig, TStates>>;
|
|
1051
1043
|
}), Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<SetupMachineStateSchema<TConfig, TStates>>, TTag & string, [
|
|
1052
1044
|
SetupSchema<TSchemas, 'input'>
|
|
1053
|
-
] 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>;
|
|
1054
1046
|
/**
|
|
1055
1047
|
* Creates a state node config bound to a specific setup-declared state,
|
|
1056
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;
|
|
@@ -709,4 +703,3 @@ export type ValidateStateTargets<TConfig> = 0 extends 1 & TConfig ? unknown : TC
|
|
|
709
703
|
} ? (TInitial extends {
|
|
710
704
|
target: infer TInitialTarget;
|
|
711
705
|
} ? TInitialTarget : TInitial) extends infer TInitialTarget ? InvalidInitialTarget<TConfig, TStates, TInitialTarget> : never : never) | InvalidNodeTargets<TConfig, TConfig, []> | InvalidTargetsInStates<TConfig, TStates> extends never ? unknown : never : unknown;
|
|
712
|
-
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xstate-fsm.umd.min.js","sources":["../src/fsm.ts","../src/schema.types.ts"],"sourcesContent":["import type { EventObject, MachineContext } from './types.ts';\nimport type { StandardSchemaV1 } from './schema.types.ts';\nimport type { SetupSchemas, SetupStateSchema } from './setup.ts';\nimport type { InferEvents } from './types.v6.ts';\n\nexport type FSMArgs<\n TContext extends MachineContext,\n TEvent extends EventObject\n> = {\n context: TContext;\n event: TEvent;\n};\n\nexport type FSMContextPatch<TContext extends MachineContext> =\n Partial<TContext>;\n\nexport type FSMTransitionConfig<\n TContext extends MachineContext,\n TState extends string\n> = {\n target?: TState;\n context?: FSMContextPatch<TContext>;\n};\n\nexport type FSMTransitionFunction<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = (\n args: FSMArgs<TContext, TEvent>\n) => FSMTransitionConfig<TTransitionContext, TState> | undefined;\n\ntype EventForType<TEvent extends EventObject, TType extends string> = [\n Extract<TEvent, { type: TType }>\n] extends [never]\n ? TEvent\n : Extract<TEvent, { type: TType }>;\n\nexport type FSMTransition<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> =\n | TState\n | FSMTransitionConfig<TTransitionContext, TState>\n | FSMTransitionFunction<TContext, TEvent, TState, TTransitionContext>;\n\ntype FSMOn<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n [TType in TEvent['type'] & string]?: FSMTransition<\n TContext,\n EventForType<TEvent, TType>,\n TState,\n TTransitionContext\n >;\n};\n\nexport type FSMStateConfig<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n on?: FSMOn<TContext, TEvent, TState, TTransitionContext>;\n};\n\ntype FSMContextConfig<TContext extends MachineContext> =\n string extends keyof TContext\n ? { context?: TContext }\n : keyof TContext extends never\n ? { context?: TContext }\n : { context: TContext };\n\nexport type FSMConfig<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n TState extends string = string\n> = {\n id?: string;\n initial: TState;\n states: { [K in TState]: FSMStateConfig<TContext, TEvent, TState> };\n} & FSMContextConfig<TContext>;\n\ntype FSMConfigForStates<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends Record<string, unknown>\n> = Omit<\n FSMConfig<TContext, TEvent, keyof TStates & string>,\n 'initial' | 'states'\n> & {\n initial: keyof TStates & string;\n states: {\n [K in keyof TStates]: FSMStateConfig<\n TContext,\n TEvent,\n keyof TStates & string\n >;\n };\n};\n\nexport type FSMSnapshot<\n TContext extends MachineContext,\n TState extends string\n> = {\n value: TState;\n context: TContext;\n};\n\nexport type FSM<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TSnapshot extends { value: TState; context: MachineContext } = FSMSnapshot<\n TContext,\n TState\n >,\n TConfig = FSMConfig<TContext, TEvent, TState>\n> = {\n readonly id: string | undefined;\n readonly config: TConfig;\n readonly initialState: TSnapshot;\n transition(snapshot: TSnapshot, event: TEvent): TSnapshot;\n};\n\ntype FSMSetupSchemas = Pick<SetupSchemas, 'context' | 'events'>;\ntype FSMSetupStates = Record<string, SetupStateSchema>;\n\ntype FSMSchemaContext<TSchema extends StandardSchemaV1> =\n StandardSchemaV1.InferOutput<TSchema> extends MachineContext\n ? StandardSchemaV1.InferOutput<TSchema>\n : MachineContext;\n\ntype FSMSetupContext<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n context: infer TSchema extends StandardSchemaV1;\n}\n ? FSMSchemaContext<TSchema>\n : MachineContext;\n\ntype FSMSetupEvents<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n events: infer TEventSchemas extends Record<string, StandardSchemaV1>;\n}\n ? InferEvents<TEventSchemas>\n : EventObject;\n\ntype FSMStateContext<\n TStateSchema,\n TGlobalContext extends MachineContext\n> = TStateSchema extends { schemas?: infer TSchemas }\n ? TSchemas extends {\n context?: infer TSchema extends StandardSchemaV1;\n }\n ? FSMSchemaContext<TSchema> &\n ([MachineContext] extends [TGlobalContext] ? unknown : TGlobalContext)\n : TGlobalContext\n : TGlobalContext;\n\ntype FSMContextFromDeclaredStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [K in keyof TStates & string]: FSMStateContext<TStates[K], TGlobalContext>;\n}[keyof TStates & string];\n\ntype FSMContextFromStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = [keyof TStates] extends [never]\n ? TGlobalContext\n : [MachineContext] extends [TGlobalContext]\n ? FSMContextFromDeclaredStates<TStates, TGlobalContext>\n : TGlobalContext | FSMContextFromDeclaredStates<TStates, TGlobalContext>;\n\ntype FSMSetupStateContext<\n TState extends string,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = TState extends keyof TStates\n ? FSMStateContext<TStates[TState], TGlobalContext>\n : TGlobalContext;\n\ntype FSMSetupSnapshot<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMSnapshot<TGlobalContext, keyof TMachineStates & string>\n : {\n [K in keyof TMachineStates & string]: {\n value: K;\n context: FSMSetupStateContext<K, TStates, TGlobalContext>;\n };\n }[keyof TMachineStates & string];\n\ntype FSMSetupTargetTransitionConfig<\n TSourceContext extends MachineContext,\n TTarget extends string,\n TTargetContext extends MachineContext\n> = [FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>] extends [\n never\n]\n ? {\n target: TTarget;\n context?: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n }\n : {\n target: TTarget;\n context: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n };\n\ntype FSMRequiredTargetContextKeys<TSourceContext, TTargetContext> = {\n [K in keyof TTargetContext]-?: K extends keyof TSourceContext\n ? [TSourceContext[K]] extends [TTargetContext[K]]\n ? never\n : K\n : K;\n}[keyof TTargetContext];\n\ntype FSMTargetContextPatch<TSourceContext, TTargetContext> =\n Partial<TTargetContext> &\n Pick<\n TTargetContext,\n Extract<\n FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>,\n string\n >\n >;\n\ntype FSMSetupTransitionConfig<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> =\n | { target?: undefined; context?: FSMContextPatch<TSourceContext> }\n | {\n [TTarget in keyof TStates & string]: FSMSetupTargetTransitionConfig<\n TSourceContext,\n TTarget,\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n >;\n }[keyof TStates & string];\n\ntype FSMSetupStringTransition<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [TTarget in keyof TStates & string]: [TSourceContext] extends [\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n ]\n ? TTarget\n : never;\n}[keyof TStates & string];\n\ntype FSMSetupTransitionFunction<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = (\n args: FSMArgs<TSourceContext, TEvent>\n) =>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | undefined;\n\ntype FSMSetupTransition<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMTransition<TSourceContext, TEvent, keyof TMachineStates & string>\n :\n | FSMSetupStringTransition<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionFunction<\n TSourceContext,\n TEvent,\n TStates,\n TGlobalContext\n >;\n\ntype FSMSetupStateConfig<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = {\n on?: {\n [TType in TEvent['type'] & string]?: FSMSetupTransition<\n TSourceContext,\n EventForType<TEvent, TType>,\n TStates,\n TGlobalContext,\n TMachineStates\n >;\n };\n};\n\ntype FSMSetupMachineConfig<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates,\n TMachineStates extends Record<string, unknown>\n> = {\n id?: string;\n initial: keyof TMachineStates & string;\n states: {\n [K in keyof TMachineStates]: FSMSetupStateConfig<\n FSMStateContext<\n K extends keyof TStates ? TStates[K] : {},\n FSMSetupContext<TSchemas>\n >,\n FSMSetupEvents<TSchemas>,\n TStates,\n FSMSetupContext<TSchemas>,\n TMachineStates\n >;\n };\n} & FSMContextConfig<FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>>;\n\nexport type FSMSetupConfig<\n TSchemas extends FSMSetupSchemas = {},\n TStates extends FSMSetupStates = {}\n> = {\n schemas?: TSchemas;\n states?: TStates;\n};\n\nexport type FSMSetupReturn<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates\n> = {\n createFSM<const TMachineStates extends Record<string, unknown>>(\n config: FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n ): FSM<\n FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>,\n FSMSetupEvents<TSchemas>,\n keyof TMachineStates & string,\n FSMSetupSnapshot<TStates, FSMSetupContext<TSchemas>, TMachineStates>,\n FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n >;\n};\n\nexport function setup<\n const TSchemas extends FSMSetupSchemas = {},\n const TStates extends FSMSetupStates = {}\n>(\n _config: FSMSetupConfig<TSchemas, TStates> = {}\n): FSMSetupReturn<TSchemas, TStates> {\n return {\n createFSM: (config: FSMConfig) => createFSM(config)\n } as unknown as FSMSetupReturn<TSchemas, TStates>;\n}\n\nexport function createFSM<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n const TStates extends Record<string, unknown> = Record<string, unknown>\n>(\n config: FSMConfigForStates<TContext, TEvent, TStates>\n): FSM<\n TContext,\n TEvent,\n keyof TStates & string,\n FSMSnapshot<TContext, keyof TStates & string>,\n FSMConfigForStates<TContext, TEvent, TStates>\n> {\n type TState = keyof TStates & string;\n const initialState: FSMSnapshot<TContext, TState> = {\n value: config.initial,\n context: config.context ?? ({} as TContext)\n };\n\n return {\n id: config.id,\n config,\n initialState,\n transition(snapshot, event) {\n const stateConfig = config.states[snapshot.value];\n const transitions = stateConfig?.on as\n | Record<string, FSMTransition<TContext, TEvent, TState> | undefined>\n | undefined;\n const transition =\n transitions && Object.hasOwn(transitions, event.type)\n ? transitions[event.type]\n : undefined;\n\n if (transition === undefined) {\n return snapshot;\n }\n\n const args = { context: snapshot.context, event };\n const result =\n typeof transition === 'function'\n ? transition(args)\n : typeof transition === 'string'\n ? { target: transition }\n : transition;\n\n if (!result) {\n return snapshot;\n }\n\n const contextPatch = result.context;\n let context = snapshot.context;\n if (contextPatch !== undefined) {\n const nextContext = { ...snapshot.context, ...contextPatch };\n if (\n Object.keys(contextPatch).some(\n (key) => nextContext[key] !== snapshot.context[key]\n )\n ) {\n context = nextContext;\n }\n }\n const value = result.target ?? snapshot.value;\n\n if (value === snapshot.value && context === snapshot.context) {\n return snapshot;\n }\n\n return { value, context };\n }\n };\n}\n","/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\n/** Schemas that can be declared for an individual state node. */\nexport type SetupStateSchemas = {\n /** Refines the machine's root context schema while this state is active. */\n context?: StandardSchemaV1;\n input?: StandardSchemaV1;\n /** The output emitted when this state node completes. */\n output?: StandardSchemaV1;\n};\n\n/** A type-only Standard Schema produced by {@link types}. */\nexport interface TypeSchema<T> extends StandardSchemaV1<T, T> {\n readonly '~standard': StandardSchemaV1.Props<T, T> & {\n readonly vendor: 'xstate.types';\n };\n}\n\n/**\n * Declares schema types for inference only — no runtime validation.\n *\n * Use in a machine's `schemas` when you want TypeScript types without pulling\n * in a schema library like Zod. The returned value is a valid Standard Schema\n * whose validation is the identity function, so it carries types but never\n * rejects input.\n *\n * @example\n *\n * ```ts\n * import { createMachine, types } from 'xstate';\n *\n * const machine = createMachine({\n * schemas: {\n * context: types<{ count: number }>(),\n * events: {\n * inc: types<{ by: number }>(),\n * reset: types<void>()\n * }\n * },\n * context: { count: 0 }\n * // ...\n * });\n * ```\n *\n * Use `types<void>()` for events without a payload.\n */\nexport function types<T>(): TypeSchema<T> {\n return {\n '~standard': {\n version: 1,\n vendor: 'xstate.types',\n validate: (value) => ({ value: value as T })\n }\n };\n}\n\n/** Returns true if the value is a type-only schema created by {@link types}. */\nexport function isTypeSchema(value: unknown): value is TypeSchema<unknown> {\n return (\n !!value &&\n typeof value === 'object' &&\n '~standard' in value &&\n (value as StandardSchemaV1)['~standard'].vendor === 'xstate.types'\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n export interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (\n value: unknown\n ) => Result<Output> | Promise<Result<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n\n /** The result interface of the validate function. */\n export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n /** The result interface if validation succeeds. */\n export interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The non-existent issues. */\n readonly issues?: undefined;\n }\n\n /** The result interface if validation fails. */\n export interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n\n /** The issue interface of the failure output. */\n export interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n\n /** The path segment interface of the issue. */\n export interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n\n /** The Standard Schema types interface. */\n export interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n\n /** Infers the input type of a Standard Schema. */\n export type InferInput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['input'];\n\n /** Infers the output type of a Standard Schema. */\n export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['output'];\n}\n"],"names":["createFSM","config","initialState","value","initial","context","id","transition","snapshot","event","stateConfig","states","transitions","on","Object","hasOwn","type","undefined","args","result","target","contextPatch","nextContext","keys","some","key","_config","version","vendor","validate"],"mappings":"gPA0WO,SAASA,EAKdC,GASA,MAAMC,EAA8C,CAClDC,MAAOF,EAAOG,QACdC,QAASJ,EAAOI,SAAY,CAAC,GAG/B,MAAO,CACLC,GAAIL,EAAOK,GACXL,SACAC,eACAK,UAAAA,CAAWC,EAAUC,GACnB,MAAMC,EAAcT,EAAOU,OAAOH,EAASL,OACrCS,EAAcF,GAAaG,GAG3BN,EACJK,GAAeE,OAAOC,OAAOH,EAAaH,EAAMO,MAC5CJ,EAAYH,EAAMO,WAClBC,EAEN,QAAmBA,IAAfV,EACF,OAAOC,EAGT,MAAMU,EAAO,CAAEb,QAASG,EAASH,QAASI,SACpCU,EACkB,mBAAfZ,EACHA,EAAWW,GACW,iBAAfX,EACL,CAAEa,OAAQb,GACVA,EAER,IAAKY,EACH,OAAOX,EAGT,MAAMa,EAAeF,EAAOd,QAC5B,IAAIA,EAAUG,EAASH,QACvB,QAAqBY,IAAjBI,EAA4B,CAC9B,MAAMC,EAAc,IAAKd,EAASH,WAAYgB,GAE5CP,OAAOS,KAAKF,GAAcG,KACvBC,GAAQH,EAAYG,KAASjB,EAASH,QAAQoB,MAGjDpB,EAAUiB,EAEd,CACA,MAAMnB,EAAQgB,EAAOC,QAAUZ,EAASL,MAExC,OAAIA,IAAUK,EAASL,OAASE,IAAYG,EAASH,QAC5CG,EAGF,CAAEL,QAAOE,UAClB,EAEJ,uBAjFO,SAILqB,EAA6C,IAE7C,MAAO,CACL1B,UAAYC,GAAsBD,EAAUC,GAEhD,UCtTO,WACL,MAAO,CACL,YAAa,CACX0B,QAAS,EACTC,OAAQ,eACRC,SAAW1B,IAAW,CAAEA,MAAOA,KAGrC"}
|
|
1
|
+
{"version":3,"file":"xstate-fsm.umd.min.js","sources":["../src/fsm.ts","../src/schema.types.ts"],"sourcesContent":["import type {\n EventObject,\n InferEvents,\n MachineContext,\n SetupSchemas,\n SetupStateSchema\n} from './base.types.ts';\nimport type { StandardSchemaV1 } from './schema.types.ts';\n\nexport type FSMArgs<\n TContext extends MachineContext,\n TEvent extends EventObject\n> = {\n context: TContext;\n event: TEvent;\n};\n\nexport type FSMContextPatch<TContext extends MachineContext> =\n Partial<TContext>;\n\nexport type FSMTransitionConfig<\n TContext extends MachineContext,\n TState extends string\n> = {\n target?: TState;\n context?: FSMContextPatch<TContext>;\n};\n\nexport type FSMTransitionFunction<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = (\n args: FSMArgs<TContext, TEvent>\n) => FSMTransitionConfig<TTransitionContext, TState> | undefined;\n\ntype EventForType<TEvent extends EventObject, TType extends string> = [\n Extract<TEvent, { type: TType }>\n] extends [never]\n ? TEvent\n : Extract<TEvent, { type: TType }>;\n\nexport type FSMTransition<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> =\n | TState\n | FSMTransitionConfig<TTransitionContext, TState>\n | FSMTransitionFunction<TContext, TEvent, TState, TTransitionContext>;\n\ntype FSMOn<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n [TType in TEvent['type'] & string]?: FSMTransition<\n TContext,\n EventForType<TEvent, TType>,\n TState,\n TTransitionContext\n >;\n};\n\nexport type FSMStateConfig<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TTransitionContext extends MachineContext = TContext\n> = {\n on?: FSMOn<TContext, TEvent, TState, TTransitionContext>;\n};\n\ntype FSMContextConfig<TContext extends MachineContext> =\n string extends keyof TContext\n ? { context?: TContext }\n : keyof TContext extends never\n ? { context?: TContext }\n : { context: TContext };\n\nexport type FSMConfig<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n TState extends string = string\n> = {\n id?: string;\n initial: TState;\n states: { [K in TState]: FSMStateConfig<TContext, TEvent, TState> };\n} & FSMContextConfig<TContext>;\n\ntype FSMConfigForStates<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends Record<string, unknown>\n> = Omit<\n FSMConfig<TContext, TEvent, keyof TStates & string>,\n 'initial' | 'states'\n> & {\n initial: keyof TStates & string;\n states: {\n [K in keyof TStates]: FSMStateConfig<\n TContext,\n TEvent,\n keyof TStates & string\n >;\n };\n};\n\nexport type FSMSnapshot<\n TContext extends MachineContext,\n TState extends string\n> = {\n value: TState;\n context: TContext;\n};\n\nexport type FSM<\n TContext extends MachineContext,\n TEvent extends EventObject,\n TState extends string,\n TSnapshot extends { value: TState; context: MachineContext } = FSMSnapshot<\n TContext,\n TState\n >,\n TConfig = FSMConfig<TContext, TEvent, TState>\n> = {\n readonly id: string | undefined;\n readonly config: TConfig;\n readonly initialState: TSnapshot;\n transition(snapshot: TSnapshot, event: TEvent): TSnapshot;\n};\n\ntype FSMSetupSchemas = Pick<SetupSchemas, 'context' | 'events'>;\ntype FSMSetupStates = Record<string, SetupStateSchema>;\n\ntype FSMSchemaContext<TSchema extends StandardSchemaV1> =\n StandardSchemaV1.InferOutput<TSchema> extends MachineContext\n ? StandardSchemaV1.InferOutput<TSchema>\n : MachineContext;\n\ntype FSMSetupContext<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n context: infer TSchema extends StandardSchemaV1;\n}\n ? FSMSchemaContext<TSchema>\n : MachineContext;\n\ntype FSMSetupEvents<TSchemas extends FSMSetupSchemas> = TSchemas extends {\n events: infer TEventSchemas extends Record<string, StandardSchemaV1>;\n}\n ? InferEvents<TEventSchemas>\n : EventObject;\n\ntype FSMStateContext<\n TStateSchema,\n TGlobalContext extends MachineContext\n> = TStateSchema extends { schemas?: infer TSchemas }\n ? TSchemas extends {\n context?: infer TSchema extends StandardSchemaV1;\n }\n ? FSMSchemaContext<TSchema> &\n ([MachineContext] extends [TGlobalContext] ? unknown : TGlobalContext)\n : TGlobalContext\n : TGlobalContext;\n\ntype FSMContextFromDeclaredStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [K in keyof TStates & string]: FSMStateContext<TStates[K], TGlobalContext>;\n}[keyof TStates & string];\n\ntype FSMContextFromStates<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = [keyof TStates] extends [never]\n ? TGlobalContext\n : [MachineContext] extends [TGlobalContext]\n ? FSMContextFromDeclaredStates<TStates, TGlobalContext>\n : TGlobalContext | FSMContextFromDeclaredStates<TStates, TGlobalContext>;\n\ntype FSMSetupStateContext<\n TState extends string,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = TState extends keyof TStates\n ? FSMStateContext<TStates[TState], TGlobalContext>\n : TGlobalContext;\n\ntype FSMSetupSnapshot<\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMSnapshot<TGlobalContext, keyof TMachineStates & string>\n : {\n [K in keyof TMachineStates & string]: {\n value: K;\n context: FSMSetupStateContext<K, TStates, TGlobalContext>;\n };\n }[keyof TMachineStates & string];\n\ntype FSMSetupTargetTransitionConfig<\n TSourceContext extends MachineContext,\n TTarget extends string,\n TTargetContext extends MachineContext\n> = [FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>] extends [\n never\n]\n ? {\n target: TTarget;\n context?: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n }\n : {\n target: TTarget;\n context: FSMTargetContextPatch<TSourceContext, TTargetContext>;\n };\n\ntype FSMRequiredTargetContextKeys<TSourceContext, TTargetContext> = {\n [K in keyof TTargetContext]-?: K extends keyof TSourceContext\n ? [TSourceContext[K]] extends [TTargetContext[K]]\n ? never\n : K\n : K;\n}[keyof TTargetContext];\n\ntype FSMTargetContextPatch<TSourceContext, TTargetContext> =\n Partial<TTargetContext> &\n Pick<\n TTargetContext,\n Extract<\n FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>,\n string\n >\n >;\n\ntype FSMSetupTransitionConfig<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> =\n | { target?: undefined; context?: FSMContextPatch<TSourceContext> }\n | {\n [TTarget in keyof TStates & string]: FSMSetupTargetTransitionConfig<\n TSourceContext,\n TTarget,\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n >;\n }[keyof TStates & string];\n\ntype FSMSetupStringTransition<\n TSourceContext extends MachineContext,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = {\n [TTarget in keyof TStates & string]: [TSourceContext] extends [\n FSMSetupStateContext<TTarget, TStates, TGlobalContext>\n ]\n ? TTarget\n : never;\n}[keyof TStates & string];\n\ntype FSMSetupTransitionFunction<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext\n> = (\n args: FSMArgs<TSourceContext, TEvent>\n) =>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | undefined;\n\ntype FSMSetupTransition<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = [keyof TStates] extends [never]\n ? FSMTransition<TSourceContext, TEvent, keyof TMachineStates & string>\n :\n | FSMSetupStringTransition<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext>\n | FSMSetupTransitionFunction<\n TSourceContext,\n TEvent,\n TStates,\n TGlobalContext\n >;\n\ntype FSMSetupStateConfig<\n TSourceContext extends MachineContext,\n TEvent extends EventObject,\n TStates extends FSMSetupStates,\n TGlobalContext extends MachineContext,\n TMachineStates extends Record<string, unknown>\n> = {\n on?: {\n [TType in TEvent['type'] & string]?: FSMSetupTransition<\n TSourceContext,\n EventForType<TEvent, TType>,\n TStates,\n TGlobalContext,\n TMachineStates\n >;\n };\n};\n\ntype FSMSetupMachineConfig<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates,\n TMachineStates extends Record<string, unknown>\n> = {\n id?: string;\n initial: keyof TMachineStates & string;\n states: {\n [K in keyof TMachineStates]: FSMSetupStateConfig<\n FSMStateContext<\n K extends keyof TStates ? TStates[K] : {},\n FSMSetupContext<TSchemas>\n >,\n FSMSetupEvents<TSchemas>,\n TStates,\n FSMSetupContext<TSchemas>,\n TMachineStates\n >;\n };\n} & FSMContextConfig<FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>>;\n\nexport type FSMSetupConfig<\n TSchemas extends FSMSetupSchemas = {},\n TStates extends FSMSetupStates = {}\n> = {\n schemas?: TSchemas;\n states?: TStates;\n};\n\nexport type FSMSetupReturn<\n TSchemas extends FSMSetupSchemas,\n TStates extends FSMSetupStates\n> = {\n createFSM<const TMachineStates extends Record<string, unknown>>(\n config: FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n ): FSM<\n FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>,\n FSMSetupEvents<TSchemas>,\n keyof TMachineStates & string,\n FSMSetupSnapshot<TStates, FSMSetupContext<TSchemas>, TMachineStates>,\n FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>\n >;\n};\n\nexport function setup<\n const TSchemas extends FSMSetupSchemas = {},\n const TStates extends FSMSetupStates = {}\n>(\n _config: FSMSetupConfig<TSchemas, TStates> = {}\n): FSMSetupReturn<TSchemas, TStates> {\n return {\n createFSM: (config: FSMConfig) => createFSM(config)\n } as unknown as FSMSetupReturn<TSchemas, TStates>;\n}\n\nexport function createFSM<\n TContext extends MachineContext = {},\n TEvent extends EventObject = EventObject,\n const TStates extends Record<string, unknown> = Record<string, unknown>\n>(\n config: FSMConfigForStates<TContext, TEvent, TStates>\n): FSM<\n TContext,\n TEvent,\n keyof TStates & string,\n FSMSnapshot<TContext, keyof TStates & string>,\n FSMConfigForStates<TContext, TEvent, TStates>\n> {\n type TState = keyof TStates & string;\n const initialState: FSMSnapshot<TContext, TState> = {\n value: config.initial,\n context: config.context ?? ({} as TContext)\n };\n\n return {\n id: config.id,\n config,\n initialState,\n transition(snapshot, event) {\n const stateConfig = config.states[snapshot.value];\n const transitions = stateConfig?.on as\n | Record<string, FSMTransition<TContext, TEvent, TState> | undefined>\n | undefined;\n const transition =\n transitions && Object.hasOwn(transitions, event.type)\n ? transitions[event.type]\n : undefined;\n\n if (transition === undefined) {\n return snapshot;\n }\n\n const args = { context: snapshot.context, event };\n const result =\n typeof transition === 'function'\n ? transition(args)\n : typeof transition === 'string'\n ? { target: transition }\n : transition;\n\n if (!result) {\n return snapshot;\n }\n\n const contextPatch = result.context;\n let context = snapshot.context;\n if (contextPatch !== undefined) {\n const nextContext = { ...snapshot.context, ...contextPatch };\n if (\n Object.keys(contextPatch).some(\n (key) => nextContext[key] !== snapshot.context[key]\n )\n ) {\n context = nextContext;\n }\n }\n const value = result.target ?? snapshot.value;\n\n if (value === snapshot.value && context === snapshot.context) {\n return snapshot;\n }\n\n return { value, context };\n }\n };\n}\n","/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\n/** Schemas that can be declared for an individual state node. */\nexport type SetupStateSchemas = {\n /** Refines the machine's root context schema while this state is active. */\n context?: StandardSchemaV1;\n input?: StandardSchemaV1;\n /** The output emitted when this state node completes. */\n output?: StandardSchemaV1;\n};\n\n/** A type-only Standard Schema produced by {@link types}. */\nexport interface TypeSchema<T> extends StandardSchemaV1<T, T> {\n readonly '~standard': StandardSchemaV1.Props<T, T> & {\n readonly vendor: 'xstate.types';\n };\n}\n\n/**\n * Declares schema types for inference only — no runtime validation.\n *\n * Use in a machine's `schemas` when you want TypeScript types without pulling\n * in a schema library like Zod. The returned value is a valid Standard Schema\n * whose validation is the identity function, so it carries types but never\n * rejects input.\n *\n * @example\n *\n * ```ts\n * import { createMachine, types } from 'xstate';\n *\n * const machine = createMachine({\n * schemas: {\n * context: types<{ count: number }>(),\n * events: {\n * inc: types<{ by: number }>(),\n * reset: types<void>()\n * }\n * },\n * context: { count: 0 }\n * // ...\n * });\n * ```\n *\n * Use `types<void>()` for events without a payload.\n */\nexport function types<T>(): TypeSchema<T> {\n return {\n '~standard': {\n version: 1,\n vendor: 'xstate.types',\n validate: (value) => ({ value: value as T })\n }\n };\n}\n\n/** Returns true if the value is a type-only schema created by {@link types}. */\nexport function isTypeSchema(value: unknown): value is TypeSchema<unknown> {\n return (\n !!value &&\n typeof value === 'object' &&\n '~standard' in value &&\n (value as StandardSchemaV1)['~standard'].vendor === 'xstate.types'\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n export interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (\n value: unknown\n ) => Result<Output> | Promise<Result<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n\n /** The result interface of the validate function. */\n export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n /** The result interface if validation succeeds. */\n export interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The non-existent issues. */\n readonly issues?: undefined;\n }\n\n /** The result interface if validation fails. */\n export interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n\n /** The issue interface of the failure output. */\n export interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n\n /** The path segment interface of the issue. */\n export interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n\n /** The Standard Schema types interface. */\n export interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n\n /** Infers the input type of a Standard Schema. */\n export type InferInput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['input'];\n\n /** Infers the output type of a Standard Schema. */\n export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<\n Schema['~standard']['types']\n >['output'];\n}\n"],"names":["createFSM","config","initialState","value","initial","context","id","transition","snapshot","event","stateConfig","states","transitions","on","Object","hasOwn","type","undefined","args","result","target","contextPatch","nextContext","keys","some","key","_config","version","vendor","validate"],"mappings":"gPA8WO,SAASA,EAKdC,GASA,MAAMC,EAA8C,CAClDC,MAAOF,EAAOG,QACdC,QAASJ,EAAOI,SAAY,CAAC,GAG/B,MAAO,CACLC,GAAIL,EAAOK,GACXL,SACAC,eACAK,UAAAA,CAAWC,EAAUC,GACnB,MAAMC,EAAcT,EAAOU,OAAOH,EAASL,OACrCS,EAAcF,GAAaG,GAG3BN,EACJK,GAAeE,OAAOC,OAAOH,EAAaH,EAAMO,MAC5CJ,EAAYH,EAAMO,WAClBC,EAEN,QAAmBA,IAAfV,EACF,OAAOC,EAGT,MAAMU,EAAO,CAAEb,QAASG,EAASH,QAASI,SACpCU,EACkB,mBAAfZ,EACHA,EAAWW,GACW,iBAAfX,EACL,CAAEa,OAAQb,GACVA,EAER,IAAKY,EACH,OAAOX,EAGT,MAAMa,EAAeF,EAAOd,QAC5B,IAAIA,EAAUG,EAASH,QACvB,QAAqBY,IAAjBI,EAA4B,CAC9B,MAAMC,EAAc,IAAKd,EAASH,WAAYgB,GAE5CP,OAAOS,KAAKF,GAAcG,KACvBC,GAAQH,EAAYG,KAASjB,EAASH,QAAQoB,MAGjDpB,EAAUiB,EAEd,CACA,MAAMnB,EAAQgB,EAAOC,QAAUZ,EAASL,MAExC,OAAIA,IAAUK,EAASL,OAASE,IAAYG,EAASH,QAC5CG,EAGF,CAAEL,QAAOE,UAClB,EAEJ,uBAjFO,SAILqB,EAA6C,IAE7C,MAAO,CACL1B,UAAYC,GAAsBD,EAAUC,GAEhD,UC1TO,WACL,MAAO,CACL,YAAa,CACX0B,QAAS,EACTC,OAAQ,eACRC,SAAW1B,IAAW,CAAEA,MAAOA,KAGrC"}
|
package/dist/xstate-scxml.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var saxes = require('saxes');
|
|
6
|
-
var types = require('./types-
|
|
6
|
+
var types = require('./types-91238aab.cjs.js');
|
|
7
7
|
var createActor = require('./createActor-c4723a2b.cjs.js');
|
|
8
8
|
require('./validation-4561b43c.cjs.js');
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var saxes = require('saxes');
|
|
6
|
-
var types = require('./types-
|
|
6
|
+
var types = require('./types-939a97c6.development.cjs.js');
|
|
7
7
|
var createActor = require('./createActor-2213c48b.development.cjs.js');
|
|
8
8
|
require('./validation-f2714a35.development.cjs.js');
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SaxesParser } from 'saxes';
|
|
2
|
-
import { c as createMachine, d as SpecialTargets } from './types-
|
|
2
|
+
import { c as createMachine, d as SpecialTargets } from './types-94ac7819.development.esm.js';
|
|
3
3
|
import { p as parseDelayToMilliseconds } from './createActor-3dc6cdb7.development.esm.js';
|
|
4
4
|
import './validation-e69470ad.development.esm.js';
|
|
5
5
|
|
package/dist/xstate-scxml.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SaxesParser } from 'saxes';
|
|
2
|
-
import { c as createMachine, d as SpecialTargets } from './types-
|
|
2
|
+
import { c as createMachine, d as SpecialTargets } from './types-1378f0fa.esm.js';
|
|
3
3
|
import { p as parseDelayToMilliseconds } from './createActor-c7c704c2.esm.js';
|
|
4
4
|
import './validation-05f1d517.esm.js';
|
|
5
5
|
|