xstate 6.0.0-alpha.53 → 6.0.0-alpha.55
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/{createActor-4d94dd53.development.cjs.js → createActor-2213c48b.development.cjs.js} +67 -15
- package/dist/{createActor-41e3bbc3.development.esm.js → createActor-3dc6cdb7.development.esm.js} +67 -15
- package/dist/{createActor-20277025.cjs.js → createActor-c4723a2b.cjs.js} +67 -15
- package/dist/{createActor-6fa87eea.esm.js → createActor-c7c704c2.esm.js} +67 -15
- package/dist/declarations/src/StateMachine.d.ts +14 -6
- package/dist/declarations/src/StateNode.d.ts +14 -14
- package/dist/declarations/src/createActor.d.ts +11 -2
- package/dist/declarations/src/createMachine.d.ts +7 -6
- package/dist/declarations/src/graph/types.d.ts +1 -3
- package/dist/declarations/src/machineVersions.d.ts +2 -10
- package/dist/declarations/src/setup.d.ts +54 -38
- package/dist/declarations/src/transitionActions.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +68 -14
- package/dist/declarations/src/types.v6.d.ts +49 -41
- package/dist/{effectDescriptor-fa21710c.cjs.js → effectDescriptor-3121155c.cjs.js} +1 -1
- package/dist/{effectDescriptor-e64efd18.development.esm.js → effectDescriptor-95202c94.development.esm.js} +1 -1
- package/dist/{effectDescriptor-c56bd9d5.esm.js → effectDescriptor-9cb5c006.esm.js} +1 -1
- package/dist/{effectDescriptor-6991ab90.development.cjs.js → effectDescriptor-c0976206.development.cjs.js} +1 -1
- package/dist/{types-63cc2400.development.esm.js → types-33de9b3d.development.esm.js} +47 -3
- package/dist/{types-ab7eb7a3.esm.js → types-69f39448.esm.js} +47 -3
- package/dist/{types-5d934c5c.cjs.js → types-802dc45c.cjs.js} +47 -3
- package/dist/{types-84a9c6a1.development.cjs.js → types-ec6c763a.development.cjs.js} +47 -3
- package/dist/xstate-actors.cjs.js +1 -1
- package/dist/xstate-actors.development.cjs.js +1 -1
- package/dist/xstate-actors.development.esm.js +2 -2
- package/dist/xstate-actors.esm.js +2 -2
- package/dist/xstate-actors.umd.min.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-durable.cjs.js +2 -2
- package/dist/xstate-durable.development.cjs.js +2 -2
- package/dist/xstate-durable.development.esm.js +2 -2
- package/dist/xstate-durable.esm.js +2 -2
- package/dist/xstate-durable.umd.min.js +1 -1
- package/dist/xstate-durable.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +1 -1
- package/dist/xstate-graph.development.cjs.js +1 -1
- package/dist/xstate-graph.development.esm.js +1 -1
- package/dist/xstate-graph.esm.js +1 -1
- package/dist/xstate-graph.umd.min.js +1 -1
- package/dist/xstate-graph.umd.min.js.map +1 -1
- package/dist/xstate-scxml.cjs.js +2 -2
- package/dist/xstate-scxml.development.cjs.js +2 -2
- package/dist/xstate-scxml.development.esm.js +2 -2
- package/dist/xstate-scxml.esm.js +2 -2
- package/dist/xstate-scxml.umd.min.js +1 -1
- package/dist/xstate-scxml.umd.min.js.map +1 -1
- package/dist/xstate-validation.cjs.js +1 -1
- package/dist/xstate-validation.development.cjs.js +1 -1
- package/dist/xstate-validation.development.esm.js +1 -1
- package/dist/xstate-validation.esm.js +1 -1
- package/dist/xstate-validation.umd.min.js.map +1 -1
- package/dist/xstate.cjs.js +7 -3
- package/dist/xstate.development.cjs.js +7 -3
- package/dist/xstate.development.esm.js +9 -5
- package/dist/xstate.esm.js +9 -5
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1169,7 +1169,7 @@ async function executeEffects(effects, runtime) {
|
|
|
1169
1169
|
await effect.exec(runtime);
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
|
-
function resolveActionsWithContext(currentSnapshot, event, actorScope, actions) {
|
|
1172
|
+
function resolveActionsWithContext(currentSnapshot, event, actorScope, actions, internalEvents) {
|
|
1173
1173
|
let intermediateSnapshot = currentSnapshot;
|
|
1174
1174
|
const executableActions = [];
|
|
1175
1175
|
for (const action of actions) {
|
|
@@ -1193,7 +1193,20 @@ function resolveActionsWithContext(currentSnapshot, event, actorScope, actions)
|
|
|
1193
1193
|
};
|
|
1194
1194
|
const isInline = typeof action === 'function';
|
|
1195
1195
|
const actionRecord = getTransitionActionRecord(action);
|
|
1196
|
-
|
|
1196
|
+
let resolvedActionArgs = actionRecord?.args;
|
|
1197
|
+
if (actionRecord?.action === builtInActions['@xstate.sendTo'] && typeof actionRecord.args[1] === 'string') {
|
|
1198
|
+
const childId = actionRecord.args[1];
|
|
1199
|
+
const target = Object.hasOwn(intermediateSnapshot.children, childId) ? intermediateSnapshot.children[childId] : undefined;
|
|
1200
|
+
if (!target) {
|
|
1201
|
+
internalEvents?.push(createErrorPlatformEvent('communication', {
|
|
1202
|
+
message: `Unable to send event to unknown child '${childId}'`,
|
|
1203
|
+
event: actionRecord.args[2]
|
|
1204
|
+
}));
|
|
1205
|
+
continue;
|
|
1206
|
+
}
|
|
1207
|
+
resolvedActionArgs = [actionRecord.args[0], target, ...actionRecord.args.slice(2)];
|
|
1208
|
+
}
|
|
1209
|
+
const resolvedAction = isInline ? action : actionRecord ? actionRecord.action.bind(null, ...resolvedActionArgs) : false;
|
|
1197
1210
|
let actionParams = undefined;
|
|
1198
1211
|
if (typeof action === 'object' && action !== null) {
|
|
1199
1212
|
const {
|
|
@@ -1234,13 +1247,13 @@ function resolveActionsWithContext(currentSnapshot, event, actorScope, actions)
|
|
|
1234
1247
|
continue;
|
|
1235
1248
|
}
|
|
1236
1249
|
if (!resolvedAction || !('resolve' in resolvedAction)) {
|
|
1237
|
-
const builtInFields = typeof action === 'object' && action !== null && 'action' in action && typeof action.action === 'function' ? getBuiltInActionFields(action.action,
|
|
1250
|
+
const builtInFields = typeof action === 'object' && action !== null && 'action' in action && typeof action.action === 'function' ? getBuiltInActionFields(action.action, resolvedActionArgs) : undefined;
|
|
1238
1251
|
const isEmittedEvent = typeof action === 'object' && action !== null && !actionRecord;
|
|
1239
1252
|
const executableAction = {
|
|
1240
1253
|
kind: builtInFields ? 'builtin' : isEmittedEvent ? 'emit' : 'action',
|
|
1241
1254
|
type: typeof action === 'object' ? 'action' in action && typeof action.action === 'function' ? action.action.name ?? '(anonymous)' : action.type : action.name || '(anonymous)',
|
|
1242
1255
|
params: builtInFields ? undefined : actionParams,
|
|
1243
|
-
args: typeof action === 'object' && 'action' in action ?
|
|
1256
|
+
args: typeof action === 'object' && 'action' in action ? resolvedActionArgs : [],
|
|
1244
1257
|
...(builtInFields ? {} : isEmittedEvent ? {
|
|
1245
1258
|
source: actorScope.self,
|
|
1246
1259
|
event: action
|
|
@@ -2778,12 +2791,12 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
|
|
|
2778
2791
|
context: nextContext
|
|
2779
2792
|
});
|
|
2780
2793
|
}
|
|
2781
|
-
const [resolvedState, resolvedActions] = resolveActionsWithContext(nextState, event, actorScope, exitActions);
|
|
2794
|
+
const [resolvedState, resolvedActions] = resolveActionsWithContext(nextState, event, actorScope, exitActions, internalQueue);
|
|
2782
2795
|
nextState = resolvedState;
|
|
2783
2796
|
executableActions.push(...resolvedActions);
|
|
2784
2797
|
const invokeStopActions = getInvokeStopActions(exitStateNode, nextState.children);
|
|
2785
2798
|
if (invokeStopActions.length) {
|
|
2786
|
-
const [stoppedState, stopEffects] = resolveActionsWithContext(nextState, event, actorScope, invokeStopActions);
|
|
2799
|
+
const [stoppedState, stopEffects] = resolveActionsWithContext(nextState, event, actorScope, invokeStopActions, internalQueue);
|
|
2787
2800
|
nextState = stoppedState;
|
|
2788
2801
|
executableActions.push(...stopEffects);
|
|
2789
2802
|
}
|
|
@@ -2914,14 +2927,18 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
|
|
|
2914
2927
|
}
|
|
2915
2928
|
}
|
|
2916
2929
|
};
|
|
2930
|
+
const enteredTargetsByTransition = new Map();
|
|
2917
2931
|
for (const transition of filteredTransitions) {
|
|
2918
2932
|
const domain = getTransitionDomain(transition, currentSnapshot, getCurrentTransitionResult);
|
|
2919
2933
|
const {
|
|
2920
2934
|
targets,
|
|
2921
2935
|
reenter
|
|
2922
2936
|
} = getCurrentTransitionResult(transition);
|
|
2937
|
+
const enteredTargets = new Set();
|
|
2938
|
+
enteredTargetsByTransition.set(transition, enteredTargets);
|
|
2923
2939
|
for (const targetNode of targets ?? []) {
|
|
2924
2940
|
if (!isHistoryNode(targetNode) && (transition.source !== targetNode || transition.source !== domain || reenter)) {
|
|
2941
|
+
enteredTargets.add(targetNode);
|
|
2925
2942
|
statesToEnter.add(targetNode);
|
|
2926
2943
|
statesForDefaultEntry.add(targetNode);
|
|
2927
2944
|
}
|
|
@@ -2957,7 +2974,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
|
|
|
2957
2974
|
input
|
|
2958
2975
|
} = getCurrentTransitionResult(transition);
|
|
2959
2976
|
if (input && targets) {
|
|
2960
|
-
for (const targetNode of targets) {
|
|
2977
|
+
for (const targetNode of targets.filter(targetNode => enteredTargetsByTransition.get(transition)?.has(targetNode))) {
|
|
2961
2978
|
stateInputMap[targetNode.id] = input;
|
|
2962
2979
|
stateInputsChanged = true;
|
|
2963
2980
|
}
|
|
@@ -3056,7 +3073,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
|
|
|
3056
3073
|
}
|
|
3057
3074
|
}
|
|
3058
3075
|
}
|
|
3059
|
-
const [resolvedState, resolvedActions] = resolveActionsWithContext(nextState, event, actorScope, actions);
|
|
3076
|
+
const [resolvedState, resolvedActions] = resolveActionsWithContext(nextState, event, actorScope, actions, internalQueue);
|
|
3060
3077
|
nextState = resolvedState;
|
|
3061
3078
|
actions.length = 0;
|
|
3062
3079
|
executableActions.push(...resolvedActions);
|
|
@@ -3105,7 +3122,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
|
|
|
3105
3122
|
};
|
|
3106
3123
|
|
|
3107
3124
|
// Execute transition content
|
|
3108
|
-
const [resolvedTransitionState, transitionExecutableActions] = resolveActionsWithContext(nextState, event, actorScope, transitionActions);
|
|
3125
|
+
const [resolvedTransitionState, transitionExecutableActions] = resolveActionsWithContext(nextState, event, actorScope, transitionActions, internalQueue);
|
|
3109
3126
|
nextState = resolvedTransitionState;
|
|
3110
3127
|
executableActions.push(...transitionExecutableActions);
|
|
3111
3128
|
if (context && context !== currentSnapshot.context) {
|
|
@@ -3132,7 +3149,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
|
|
|
3132
3149
|
}
|
|
3133
3150
|
}
|
|
3134
3151
|
});
|
|
3135
|
-
const [resolvedState, resolvedActions] = resolveActionsWithContext(nextState, event, actorScope, allExitActions);
|
|
3152
|
+
const [resolvedState, resolvedActions] = resolveActionsWithContext(nextState, event, actorScope, allExitActions, internalQueue);
|
|
3136
3153
|
nextState = resolvedState;
|
|
3137
3154
|
executableActions.push(...resolvedActions);
|
|
3138
3155
|
const [stoppedState, stopEffects] = stopChildren(nextState, event, actorScope);
|
|
@@ -4101,7 +4118,10 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
4101
4118
|
return {
|
|
4102
4119
|
next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
|
|
4103
4120
|
error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
|
|
4104
|
-
complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
|
|
4121
|
+
complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self),
|
|
4122
|
+
...(isObserver && nextHandler.passive ? {
|
|
4123
|
+
passive: true
|
|
4124
|
+
} : {})
|
|
4105
4125
|
};
|
|
4106
4126
|
}
|
|
4107
4127
|
function createInvokeId(stateNodeId, index) {
|
|
@@ -4999,6 +5019,8 @@ class Actor {
|
|
|
4999
5019
|
this.mailbox = void 0;
|
|
5000
5020
|
this._mailboxStarted = false;
|
|
5001
5021
|
this.observers = void 0;
|
|
5022
|
+
/** Whether a consumer subscribed to this actor's error after it errored. */
|
|
5023
|
+
this._errorObserved = false;
|
|
5002
5024
|
this.eventListeners = void 0;
|
|
5003
5025
|
this.logger = void 0;
|
|
5004
5026
|
/** @internal */
|
|
@@ -5193,7 +5215,15 @@ class Actor {
|
|
|
5193
5215
|
const saveExecutingCustomAction = executingCustomAction;
|
|
5194
5216
|
try {
|
|
5195
5217
|
executingCustomAction = true;
|
|
5196
|
-
|
|
5218
|
+
const result = action.exec();
|
|
5219
|
+
if (result && typeof result.then === 'function') {
|
|
5220
|
+
void Promise.resolve(result).catch(err => {
|
|
5221
|
+
if (this._processingStatus === ProcessingStatus.Stopped) {
|
|
5222
|
+
return;
|
|
5223
|
+
}
|
|
5224
|
+
this._recoverOrError(err);
|
|
5225
|
+
});
|
|
5226
|
+
}
|
|
5197
5227
|
} finally {
|
|
5198
5228
|
executingCustomAction = saveExecutingCustomAction;
|
|
5199
5229
|
}
|
|
@@ -5403,6 +5433,9 @@ class Actor {
|
|
|
5403
5433
|
if (!observer.error) {
|
|
5404
5434
|
reportUnhandledError(err);
|
|
5405
5435
|
} else {
|
|
5436
|
+
if (!observer.passive) {
|
|
5437
|
+
this._errorObserved = true;
|
|
5438
|
+
}
|
|
5406
5439
|
safeCall(observer.error, err);
|
|
5407
5440
|
}
|
|
5408
5441
|
break;
|
|
@@ -5657,22 +5690,41 @@ class Actor {
|
|
|
5657
5690
|
this.observers?.clear();
|
|
5658
5691
|
this.eventListeners?.clear();
|
|
5659
5692
|
}
|
|
5693
|
+
|
|
5694
|
+
/**
|
|
5695
|
+
* Reports an unhandled error unless a consumer observes it before the
|
|
5696
|
+
* report runs. An actor can error before its creator has a chance to
|
|
5697
|
+
* subscribe, so the check waits one macrotask for a subscriber with an
|
|
5698
|
+
* `error` callback.
|
|
5699
|
+
*/
|
|
5700
|
+
_reportUnlessObserved(err) {
|
|
5701
|
+
setTimeout(() => {
|
|
5702
|
+
if (!this._errorObserved) {
|
|
5703
|
+
reportUnhandledError(err);
|
|
5704
|
+
}
|
|
5705
|
+
});
|
|
5706
|
+
}
|
|
5660
5707
|
_error(err) {
|
|
5661
5708
|
this._stopProcedure();
|
|
5662
5709
|
if (!this.observers?.size) {
|
|
5663
5710
|
if (!this._parent) {
|
|
5664
|
-
|
|
5711
|
+
this._reportUnlessObserved(err);
|
|
5665
5712
|
}
|
|
5666
5713
|
} else {
|
|
5667
5714
|
let reportError = false;
|
|
5715
|
+
let handled = false;
|
|
5668
5716
|
for (const observer of this.observers) {
|
|
5669
5717
|
const errorListener = observer.error;
|
|
5670
|
-
|
|
5718
|
+
if (!observer.passive) {
|
|
5719
|
+
reportError ||= !errorListener;
|
|
5720
|
+
handled ||= !!errorListener;
|
|
5721
|
+
}
|
|
5671
5722
|
safeCall(errorListener, err);
|
|
5672
5723
|
}
|
|
5724
|
+
reportError ||= !handled;
|
|
5673
5725
|
this.observers.clear();
|
|
5674
5726
|
if (reportError) {
|
|
5675
|
-
|
|
5727
|
+
this._reportUnlessObserved(err);
|
|
5676
5728
|
}
|
|
5677
5729
|
}
|
|
5678
5730
|
this.eventListeners?.clear();
|
|
@@ -13,13 +13,21 @@ type CompatibleProvidedActorSource<TExpected extends AnyActorLogic, TActual exte
|
|
|
13
13
|
type ProvidedActors<TExpectedActorMap extends Sources['actors'], TProvidedActorMap extends Partial<Record<keyof TExpectedActorMap & string, AnyActorLogic>>> = {
|
|
14
14
|
[K in keyof TProvidedActorMap]: K extends keyof TExpectedActorMap ? TProvidedActorMap[K] extends AnyActorLogic ? CompatibleProvidedActorSource<TExpectedActorMap[K], TProvidedActorMap[K]> : never : never;
|
|
15
15
|
};
|
|
16
|
-
export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TMeta extends MetaObject, TConfig extends StateSchema, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TInternalEvent extends EventObject = never> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, TInput, AnyActorSystem, TEmitted> {
|
|
16
|
+
export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TMeta extends MetaObject, TConfig extends StateSchema, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TInternalEvent extends EventObject = never, TTransitionMeta extends MetaObject = TMeta> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, TInput, AnyActorSystem, TEmitted> {
|
|
17
17
|
/** The raw config used to create the machine. */
|
|
18
|
-
config: Next_MachineConfig<any, any, any, any, any, any, any, any, any, any, any, any> & {
|
|
18
|
+
config: Next_MachineConfig<any, any, any, any, any, any, any, any, any, any, any, any, any> & {
|
|
19
19
|
schemas?: AnyMachineSchemas;
|
|
20
20
|
internalEvents?: readonly string[];
|
|
21
21
|
};
|
|
22
22
|
validator?: ActorLogicValidator | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Type-level carriers for the machine's source maps and state schema. Type
|
|
25
|
+
* helpers in integration packages read these to walk a machine's declared
|
|
26
|
+
* actions, actors and invoked sources. They are never assigned at runtime.
|
|
27
|
+
*/
|
|
28
|
+
readonly _actionMap: TActionMap;
|
|
29
|
+
readonly _actorMap: TActorMap;
|
|
30
|
+
readonly _stateSchema: TConfig;
|
|
23
31
|
/** The machine's own version. */
|
|
24
32
|
version?: string;
|
|
25
33
|
schemas: AnyMachineSchemas | undefined;
|
|
@@ -32,14 +40,14 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
32
40
|
sources: Sources;
|
|
33
41
|
/** Runtime options for machine execution. */
|
|
34
42
|
options: MachineOptions;
|
|
35
|
-
root: StateNode<TContext, TEvent>;
|
|
43
|
+
root: StateNode<TContext, TEvent, TMeta, TTransitionMeta>;
|
|
36
44
|
id: string;
|
|
37
|
-
states: StateNode<TContext, TEvent>['states'];
|
|
45
|
+
states: StateNode<TContext, TEvent, TMeta, TTransitionMeta>['states'];
|
|
38
46
|
events: Array<EventDescriptor<TEvent>>;
|
|
39
47
|
internalEventDescriptors: ReadonlyArray<string>;
|
|
40
48
|
constructor(
|
|
41
49
|
/** The raw config used to create the machine. */
|
|
42
|
-
config: Next_MachineConfig<any, any, any, any, any, any, any, any, any, any, any, any> & {
|
|
50
|
+
config: Next_MachineConfig<any, any, any, any, any, any, any, any, any, any, any, any, any> & {
|
|
43
51
|
schemas?: AnyMachineSchemas;
|
|
44
52
|
internalEvents?: readonly string[];
|
|
45
53
|
}, sources?: Sources, validator?: ActorLogicValidator | undefined);
|
|
@@ -98,7 +106,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
98
106
|
getInitialSnapshot(actorScope?: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>, input?: TInput): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
99
107
|
initialTransition(input: TInput | undefined, actorScope?: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>): ActorLogicTransitionResult<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, ExecutableActionObjectFromLogic<this>>;
|
|
100
108
|
start(snapshot?: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>): void;
|
|
101
|
-
getStateNodeById(stateId: string): StateNode<TContext, TEvent>;
|
|
109
|
+
getStateNodeById(stateId: string): StateNode<TContext, TEvent, TMeta, TTransitionMeta>;
|
|
102
110
|
getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, options?: unknown): Snapshot<unknown>;
|
|
103
111
|
restoreSnapshot(snapshot: Snapshot<unknown>, actorScope?: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
|
|
104
112
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SetupStateSchemas } from "./schema.types.js";
|
|
2
|
-
import type { DelayedTransitionDefinition, EventObject, InitialTransitionDefinition, MachineContext, Mapper,
|
|
3
|
-
interface StateNodeOptions<
|
|
2
|
+
import type { DelayedTransitionDefinition, EventObject, InitialTransitionDefinition, MachineContext, Mapper, TransitionDefinition, TransitionDefinitionMap, AnyStateMachine, AnyStateNodeConfig, NonReducibleUnknown, EventDescriptor, AnyAction, InvokeDefinition, MetaObject } from "./types.js";
|
|
3
|
+
interface StateNodeOptions<TStateMeta extends MetaObject, TTransitionMeta extends MetaObject> {
|
|
4
4
|
_key: string;
|
|
5
|
-
_parent?: StateNode<
|
|
5
|
+
_parent?: StateNode<any, any, TStateMeta, TTransitionMeta>;
|
|
6
6
|
_machine: AnyStateMachine;
|
|
7
7
|
}
|
|
8
|
-
export declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject> {
|
|
8
|
+
export declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject, TStateMeta extends MetaObject = any, TTransitionMeta extends MetaObject = TStateMeta> {
|
|
9
9
|
/** The raw config used to create the machine. */
|
|
10
10
|
config: AnyStateNodeConfig;
|
|
11
11
|
/**
|
|
@@ -29,7 +29,7 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
29
29
|
/** The string path from the root machine node to this node. */
|
|
30
30
|
path: string[];
|
|
31
31
|
/** The child state nodes. */
|
|
32
|
-
states:
|
|
32
|
+
states: Record<string, StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>>;
|
|
33
33
|
/**
|
|
34
34
|
* The type of history on this state node. Can be:
|
|
35
35
|
*
|
|
@@ -42,14 +42,14 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
42
42
|
/** The action(s) to be executed upon exiting the state node. */
|
|
43
43
|
exit: AnyAction | undefined;
|
|
44
44
|
/** The parent state node. */
|
|
45
|
-
parent?: StateNode<
|
|
45
|
+
parent?: StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
46
46
|
/** The root machine node. */
|
|
47
47
|
machine: AnyStateMachine;
|
|
48
48
|
/**
|
|
49
49
|
* The meta data associated with this state node, which will be returned in
|
|
50
50
|
* State instances.
|
|
51
51
|
*/
|
|
52
|
-
meta?:
|
|
52
|
+
meta?: TStateMeta;
|
|
53
53
|
/**
|
|
54
54
|
* The output data sent with the `xstate.done.state` event if this is a final
|
|
55
55
|
* state node.
|
|
@@ -63,17 +63,17 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
63
63
|
description?: string;
|
|
64
64
|
schemas: SetupStateSchemas | undefined;
|
|
65
65
|
tags: string[];
|
|
66
|
-
transitions: Map<string,
|
|
67
|
-
always?: Array<
|
|
68
|
-
invoke: Array<
|
|
69
|
-
on: TransitionDefinitionMap<any, any>;
|
|
70
|
-
after: Array<DelayedTransitionDefinition<any, any>>;
|
|
66
|
+
transitions: Map<string, TransitionDefinition<any, any, TTransitionMeta>[]>;
|
|
67
|
+
always?: Array<TransitionDefinition<any, any, TTransitionMeta>>;
|
|
68
|
+
invoke: Array<InvokeDefinition<any, any, any, TTransitionMeta, any, any, any, any>>;
|
|
69
|
+
on: TransitionDefinitionMap<any, any, TTransitionMeta>;
|
|
70
|
+
after: Array<DelayedTransitionDefinition<any, any, TTransitionMeta>>;
|
|
71
71
|
events: Array<EventDescriptor<any>>;
|
|
72
72
|
ownEvents: Array<EventDescriptor<any>>;
|
|
73
73
|
private _candidateCache?;
|
|
74
74
|
constructor(
|
|
75
75
|
/** The raw config used to create the machine. */
|
|
76
|
-
config: AnyStateNodeConfig, options: StateNodeOptions<
|
|
77
|
-
get initial(): InitialTransitionDefinition
|
|
76
|
+
config: AnyStateNodeConfig, options: StateNodeOptions<TStateMeta, TTransitionMeta>);
|
|
77
|
+
get initial(): InitialTransitionDefinition<TTransitionMeta>;
|
|
78
78
|
}
|
|
79
79
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { symbolObservable } from "./symbolObservable.js";
|
|
2
2
|
import { AnyActorSystem, Clock } from "./system.js";
|
|
3
|
-
import type { ActorTrigger, AnyActor, AnyActorLogic, EmittedFrom, EventFromLogic, SendableEventFromLogic, InputFrom,
|
|
3
|
+
import type { ActorTrigger, AnyActor, AnyActorLogic, EmittedFrom, EventFromLogic, SendableEventFromLogic, InputFrom, PersistedSnapshotOf, SnapshotFrom, Readable } from "./types.js";
|
|
4
4
|
import { ActorOptions, ActorInstance, ActorRef, InteropSubscribable, Observer, Subscription } from "./types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Marks a serialized object as an actor reference (`xstate$type` in JSON
|
|
@@ -38,6 +38,8 @@ export declare class Actor<TLogic extends AnyActorLogic> implements ActorInstanc
|
|
|
38
38
|
private mailbox?;
|
|
39
39
|
private _mailboxStarted;
|
|
40
40
|
private observers?;
|
|
41
|
+
/** Whether a consumer subscribed to this actor's error after it errored. */
|
|
42
|
+
private _errorObserved;
|
|
41
43
|
private eventListeners;
|
|
42
44
|
private logger;
|
|
43
45
|
private _forceDeferredActions;
|
|
@@ -161,6 +163,13 @@ export declare class Actor<TLogic extends AnyActorLogic> implements ActorInstanc
|
|
|
161
163
|
/** Stops the Actor and unsubscribe all listeners. */
|
|
162
164
|
stop(): this;
|
|
163
165
|
private _complete;
|
|
166
|
+
/**
|
|
167
|
+
* Reports an unhandled error unless a consumer observes it before the
|
|
168
|
+
* report runs. An actor can error before its creator has a chance to
|
|
169
|
+
* subscribe, so the check waits one macrotask for a subscriber with an
|
|
170
|
+
* `error` callback.
|
|
171
|
+
*/
|
|
172
|
+
private _reportUnlessObserved;
|
|
164
173
|
private _error;
|
|
165
174
|
private _stopProcedure;
|
|
166
175
|
/**
|
|
@@ -200,7 +209,7 @@ export declare class Actor<TLogic extends AnyActorLogic> implements ActorInstanc
|
|
|
200
209
|
* owns it. Defaults to `true`.
|
|
201
210
|
*/
|
|
202
211
|
embedChildren?: boolean;
|
|
203
|
-
}):
|
|
212
|
+
}): PersistedSnapshotOf<TLogic>;
|
|
204
213
|
[symbolObservable](): InteropSubscribable<SnapshotFrom<TLogic>>;
|
|
205
214
|
/**
|
|
206
215
|
* Read an actor’s snapshot synchronously.
|
|
@@ -11,6 +11,7 @@ type MachineIdentity<TConfig> = {
|
|
|
11
11
|
version: infer TVersion extends string;
|
|
12
12
|
} ? TVersion : undefined;
|
|
13
13
|
};
|
|
14
|
+
type TransitionMetaFromSchemas<TMetaSchema extends StandardSchemaV1, TTransitionMetaSchema extends StandardSchemaV1> = StandardSchemaV1 extends TTransitionMetaSchema ? InferOutput<TMetaSchema, MetaObject> : InferOutput<TTransitionMetaSchema, MetaObject>;
|
|
14
15
|
/**
|
|
15
16
|
* Creates a state machine (statechart) with the given configuration.
|
|
16
17
|
*
|
|
@@ -53,7 +54,7 @@ type MachineIdentity<TConfig> = {
|
|
|
53
54
|
* @param options DEPRECATED: use `setup({ ... })` or `machine.provide({ ... })`
|
|
54
55
|
* to provide machine sources instead.
|
|
55
56
|
*/
|
|
56
|
-
export declare function createMachine<TContextSchema extends StandardSchemaV1, const TEventSchemaMap extends Record<string, StandardSchemaV1>, const TInternalEventSchemaMap extends Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1>, _TEvent extends EventObject, TActor extends ProvidedActor, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TDelays extends string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, TInput, const TSS extends StateSchema>(config: TSS & ValidateDelayReferences<TSS> & ValidateHistoryDefaults<TSS> & ValidateStateTargets<TSS> & Next_MachineConfig<TContextSchema, TEventSchemaMap, TInternalEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap, InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap> & {
|
|
57
|
+
export declare function createMachine<TContextSchema extends StandardSchemaV1, const TEventSchemaMap extends Record<string, StandardSchemaV1>, const TInternalEventSchemaMap extends Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTransitionMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1>, _TEvent extends EventObject, TActor extends ProvidedActor, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TDelays extends string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, TInput, const TSS extends StateSchema>(config: TSS & ValidateDelayReferences<TSS> & ValidateHistoryDefaults<TSS> & ValidateStateTargets<TSS> & Next_MachineConfig<TContextSchema, TEventSchemaMap, TInternalEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTransitionMetaSchema, TTagSchema, TChildrenSchemaMap, InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap> & {
|
|
57
58
|
schemas: {
|
|
58
59
|
context: TContextSchema;
|
|
59
60
|
children?: TChildrenSchemaMap;
|
|
@@ -63,10 +64,10 @@ export declare function createMachine<TContextSchema extends StandardSchemaV1, c
|
|
|
63
64
|
to: RoutableStateId<TSS>;
|
|
64
65
|
}), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput, SchemaOrConfigOutput<TOutputSchema, TSS>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
|
|
65
66
|
TSS, // TStateSchema
|
|
66
|
-
TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>, InferInternalEvents<TInternalEventSchemaMap>> & {
|
|
67
|
+
TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>, InferInternalEvents<TInternalEventSchemaMap>, TransitionMetaFromSchemas<TMetaSchema, TTransitionMetaSchema>> & {
|
|
67
68
|
states: TSS;
|
|
68
69
|
} & MachineIdentity<TSS>;
|
|
69
|
-
export declare function createMachine<TContext extends MachineContext = never, const TEventSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1 = StandardSchemaV1, const TOutputSchema extends StandardSchemaV1 = StandardSchemaV1, TMetaSchema extends StandardSchemaV1 = StandardSchemaV1, TTagSchema extends StandardSchemaV1 = StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, const TInternalEventSchemaMap extends Record<string, StandardSchemaV1> = {}, _TEvent extends EventObject = EventObject, TActor extends ProvidedActor = ProvidedActor, TActionMap extends Sources['actions'] = Sources['actions'], TActorMap extends Sources['actors'] = Sources['actors'], TGuardMap extends Sources['guards'] = Sources['guards'], TDelayMap extends Sources['delays'] = Sources['delays'], TDelays extends string = string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string = StandardSchemaV1.InferOutput<TTagSchema> & string, TInput = unknown, const TSS extends StateSchema = StateSchema>(config: TSS & ValidateDelayReferences<TSS> & ValidateHistoryDefaults<TSS> & ValidateStateTargets<TSS> & Next_MachineConfig<StandardSchemaV1, TEventSchemaMap, TInternalEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap, WidenLiterals<TContext>, InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap, false> & {
|
|
70
|
+
export declare function createMachine<TContext extends MachineContext = never, const TEventSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1 = StandardSchemaV1, const TOutputSchema extends StandardSchemaV1 = StandardSchemaV1, TMetaSchema extends StandardSchemaV1 = StandardSchemaV1, TTransitionMetaSchema extends StandardSchemaV1 = TMetaSchema, TTagSchema extends StandardSchemaV1 = StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, const TInternalEventSchemaMap extends Record<string, StandardSchemaV1> = {}, _TEvent extends EventObject = EventObject, TActor extends ProvidedActor = ProvidedActor, TActionMap extends Sources['actions'] = Sources['actions'], TActorMap extends Sources['actors'] = Sources['actors'], TGuardMap extends Sources['guards'] = Sources['guards'], TDelayMap extends Sources['delays'] = Sources['delays'], TDelays extends string = string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string = StandardSchemaV1.InferOutput<TTagSchema> & string, TInput = unknown, const TSS extends StateSchema = StateSchema>(config: TSS & ValidateDelayReferences<TSS> & ValidateHistoryDefaults<TSS> & ValidateStateTargets<TSS> & Next_MachineConfig<StandardSchemaV1, TEventSchemaMap, TInternalEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTransitionMetaSchema, TTagSchema, TChildrenSchemaMap, WidenLiterals<TContext>, InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap, false> & {
|
|
70
71
|
schemas?: {
|
|
71
72
|
context?: never;
|
|
72
73
|
};
|
|
@@ -81,9 +82,9 @@ export declare function createMachine<TContext extends MachineContext = never, c
|
|
|
81
82
|
to: RoutableStateId<TSS>;
|
|
82
83
|
}), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput, SchemaOrConfigOutput<TOutputSchema, TSS>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
|
|
83
84
|
TSS, // TStateSchema
|
|
84
|
-
TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>, InferInternalEvents<TInternalEventSchemaMap>> & {
|
|
85
|
+
TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>, InferInternalEvents<TInternalEventSchemaMap>, TransitionMetaFromSchemas<TMetaSchema, TTransitionMetaSchema>> & {
|
|
85
86
|
states: TSS;
|
|
86
87
|
} & MachineIdentity<TSS>;
|
|
87
|
-
export declare function createStateConfig<TContextSchema extends StandardSchemaV1, TEventSchema extends StandardSchemaV1, TEmittedSchema extends StandardSchemaV1, _TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, _TEvent extends StandardSchemaV1.InferOutput<TEventSchema> & EventObject, // TODO: consider using a stricter `EventObject` here
|
|
88
|
-
_TActor extends ProvidedActor, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TDelays extends string, _TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, _TInput, const TSS extends StateSchema>(config: TSS & Next_StateNodeConfig<InferOutput<TContextSchema, MachineContext>, DoNotInfer<StandardSchemaV1.InferOutput<TEventSchema> & EventObject>, DoNotInfer<TDelays>, DoNotInfer<StandardSchemaV1.InferOutput<TTagSchema> & string>, DoNotInfer<StandardSchemaV1.InferOutput<TOutputSchema>>, DoNotInfer<StandardSchemaV1.InferOutput<TEmittedSchema> & EventObject>, DoNotInfer<InferOutput<TMetaSchema, MetaObject>>, DoNotInfer<Record<string, AnyActorRef | undefined>>, DoNotInfer<TActionMap>, DoNotInfer<TActorMap>, DoNotInfer<TGuardMap>, DoNotInfer<TDelayMap
|
|
88
|
+
export declare function createStateConfig<TContextSchema extends StandardSchemaV1, TEventSchema extends StandardSchemaV1, TEmittedSchema extends StandardSchemaV1, _TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTransitionMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, _TEvent extends StandardSchemaV1.InferOutput<TEventSchema> & EventObject, // TODO: consider using a stricter `EventObject` here
|
|
89
|
+
_TActor extends ProvidedActor, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TDelays extends string, _TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, _TInput, const TSS extends StateSchema>(config: TSS & Next_StateNodeConfig<InferOutput<TContextSchema, MachineContext>, DoNotInfer<StandardSchemaV1.InferOutput<TEventSchema> & EventObject>, DoNotInfer<TDelays>, DoNotInfer<StandardSchemaV1.InferOutput<TTagSchema> & string>, DoNotInfer<StandardSchemaV1.InferOutput<TOutputSchema>>, DoNotInfer<StandardSchemaV1.InferOutput<TEmittedSchema> & EventObject>, DoNotInfer<InferOutput<TMetaSchema, MetaObject>>, DoNotInfer<Record<string, AnyActorRef | undefined>>, DoNotInfer<TActionMap>, DoNotInfer<TActorMap>, DoNotInfer<TGuardMap>, DoNotInfer<TDelayMap>, any, any, any, any, DoNotInfer<TransitionMetaFromSchemas<TMetaSchema, TTransitionMetaSchema>>>): typeof config;
|
|
89
90
|
export {};
|
|
@@ -114,9 +114,7 @@ export interface TestParam<TSnapshot extends Snapshot<unknown>, TEvent extends E
|
|
|
114
114
|
[key: string]: (state: TSnapshot) => void | Promise<void>;
|
|
115
115
|
};
|
|
116
116
|
events?: {
|
|
117
|
-
[TEventType in TEvent['type']]?: EventExecutor<TSnapshot,
|
|
118
|
-
type: ExtractEvent<TEvent, TEventType>['type'];
|
|
119
|
-
}>;
|
|
117
|
+
[TEventType in TEvent['type']]?: EventExecutor<TSnapshot, ExtractEvent<TEvent, TEventType>>;
|
|
120
118
|
};
|
|
121
119
|
}
|
|
122
120
|
export interface TestPath<TSnapshot extends Snapshot<unknown>, TEvent extends EventObject> extends StatePath<TSnapshot, TEvent> {
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from "./schema.types.js";
|
|
2
2
|
import type { MachineEventSchema, MachineSnapshotSchema, MachineVersionDescriptor } from "./machineVersion.types.js";
|
|
3
3
|
export type { MachineEventSchema, MachineSnapshotSchema, MachineVersionDescriptor, PersistedMachineSnapshot } from "./machineVersion.types.js";
|
|
4
|
-
import type { AnyStateMachine, ContextFrom, EventFrom,
|
|
5
|
-
export type PersistedMachineIdentity
|
|
6
|
-
id: TMachine['id'];
|
|
7
|
-
version: NonNullable<TMachine['version']>;
|
|
8
|
-
};
|
|
4
|
+
import type { AnyStateMachine, ContextFrom, EventFrom, PersistedSnapshotFrom, Snapshot } from "./types.js";
|
|
5
|
+
export type { PersistedMachineIdentity, PersistedSnapshotFrom } from "./types.js";
|
|
9
6
|
type VersionedStateMachine = AnyStateMachine & {
|
|
10
7
|
version: string;
|
|
11
8
|
snapshotSchema: MachineSnapshotSchema;
|
|
12
9
|
eventSchema: MachineEventSchema;
|
|
13
10
|
};
|
|
14
11
|
type VersionEntry = MachineVersionDescriptor;
|
|
15
|
-
export type PersistedSnapshotFrom<TMachine extends AnyStateMachine> = Snapshot<unknown> & PersistedSnapshotFor<TMachine> & {
|
|
16
|
-
context: ContextFrom<TMachine>;
|
|
17
|
-
machine: PersistedMachineIdentity<TMachine>;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
};
|
|
20
12
|
export type PersistedSnapshotDataFrom<TMachine extends AnyStateMachine> = Snapshot<unknown> & {
|
|
21
13
|
context: ContextFrom<TMachine>;
|
|
22
14
|
[key: string]: unknown;
|