xstate 5.0.0-beta.29 → 5.0.0-beta.30
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/actions/dist/xstate-actions.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.esm.js +3 -3
- package/actions/dist/xstate-actions.esm.js +3 -3
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +104 -104
- package/actors/dist/xstate-actors.development.cjs.js +104 -104
- package/actors/dist/xstate-actors.development.esm.js +104 -104
- package/actors/dist/xstate-actors.esm.js +104 -104
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/declarations/src/State.d.ts +4 -6
- package/dist/declarations/src/StateMachine.d.ts +28 -21
- package/dist/declarations/src/StateNode.d.ts +1 -1
- package/dist/declarations/src/actions/stop.d.ts +1 -1
- package/dist/declarations/src/actors/callback.d.ts +7 -7
- package/dist/declarations/src/actors/index.d.ts +3 -3
- package/dist/declarations/src/actors/observable.d.ts +12 -13
- package/dist/declarations/src/actors/promise.d.ts +11 -14
- package/dist/declarations/src/actors/transition.d.ts +10 -7
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/interpreter.d.ts +4 -4
- package/dist/declarations/src/stateUtils.d.ts +5 -6
- package/dist/declarations/src/types.d.ts +69 -39
- package/dist/{interpreter-e2c6a579.development.cjs.js → interpreter-7f1dc557.development.cjs.js} +9 -11
- package/dist/{interpreter-6e7909c8.development.esm.js → interpreter-945c4b96.development.esm.js} +9 -11
- package/dist/{interpreter-c357bc50.cjs.js → interpreter-a2c1e529.cjs.js} +9 -11
- package/dist/{interpreter-498891b2.esm.js → interpreter-b8f53c4b.esm.js} +9 -11
- package/dist/{raise-59f2c242.esm.js → raise-0b7dde8b.esm.js} +13 -11
- package/dist/{raise-e778a828.development.esm.js → raise-6e4f5cf7.development.esm.js} +13 -11
- package/dist/{raise-f751dfac.development.cjs.js → raise-7cae872b.development.cjs.js} +13 -11
- package/dist/{raise-03e57569.cjs.js → raise-e79b1f86.cjs.js} +13 -11
- package/dist/{send-f53778f6.development.cjs.js → send-19a256f0.development.cjs.js} +2 -2
- package/dist/{send-42c83fb2.development.esm.js → send-a1d772da.development.esm.js} +2 -2
- package/dist/{send-51717e53.cjs.js → send-e7063201.cjs.js} +2 -2
- package/dist/{send-fff224db.esm.js → send-f4fb3ba5.esm.js} +2 -2
- package/dist/xstate.cjs.js +14 -23
- package/dist/xstate.development.cjs.js +14 -23
- package/dist/xstate.development.esm.js +17 -26
- package/dist/xstate.esm.js +17 -26
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.esm.js +2 -2
- package/guards/dist/xstate-guards.esm.js +2 -2
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { ActorLogic, ActorContext, ActorSystem, EventObject, ActorRefFrom, AnyActorSystem } from "../types.js";
|
|
2
|
-
export type
|
|
3
|
-
|
|
1
|
+
import { ActorLogic, ActorContext, ActorSystem, EventObject, ActorRefFrom, AnyActorSystem, Snapshot } from "../types.js";
|
|
2
|
+
export type TransitionSnapshot<TContext> = Snapshot<undefined> & {
|
|
3
|
+
context: TContext;
|
|
4
|
+
};
|
|
5
|
+
export type TransitionActorLogic<TContext, TEvent extends EventObject, TInput> = ActorLogic<TransitionSnapshot<TContext>, TEvent, TInput, TransitionSnapshot<TContext>, AnyActorSystem>;
|
|
6
|
+
export type TransitionActorRef<TContext, TEvent extends EventObject> = ActorRefFrom<TransitionActorLogic<TransitionSnapshot<TContext>, TEvent, unknown>>;
|
|
4
7
|
/**
|
|
5
8
|
* Returns actor logic from a transition function and its initial state.
|
|
6
9
|
*
|
|
7
10
|
* A transition function is a function that takes the current state and an event and returns the next state.
|
|
8
11
|
*
|
|
9
12
|
* @param transition The transition function that returns the next state given the current state and event.
|
|
10
|
-
* @param
|
|
13
|
+
* @param initialContext The initial state of the transition function.
|
|
11
14
|
* @returns Actor logic
|
|
12
15
|
*/
|
|
13
|
-
export declare function fromTransition<
|
|
16
|
+
export declare function fromTransition<TContext, TEvent extends EventObject, TSystem extends ActorSystem<any>, TInput>(transition: (state: TContext, event: TEvent, actorContext: ActorContext<TransitionSnapshot<TContext>, TEvent, TSystem>) => TContext, initialContext: TContext | (({ input, self }: {
|
|
14
17
|
input: TInput;
|
|
15
|
-
self: TransitionActorRef<
|
|
16
|
-
}) =>
|
|
18
|
+
self: TransitionActorRef<TContext, TEvent>;
|
|
19
|
+
}) => TContext)): TransitionActorLogic<TContext, TEvent, TInput>;
|
|
@@ -2,7 +2,7 @@ export * from "./actions.js";
|
|
|
2
2
|
export * from "./actors/index.js";
|
|
3
3
|
export { SimulatedClock } from "./SimulatedClock.js";
|
|
4
4
|
export { type Spawner } from "./spawn.js";
|
|
5
|
-
export { StateMachine } from "./StateMachine.js";
|
|
5
|
+
export { StateMachine, type MachineSnapshot } from "./StateMachine.js";
|
|
6
6
|
export { getStateNodes } from "./stateUtils.js";
|
|
7
7
|
export * from "./typegenTypes.js";
|
|
8
8
|
export * from "./types.js";
|
|
@@ -19,7 +19,7 @@ export declare enum ActorStatus {
|
|
|
19
19
|
* @deprecated Use `ActorStatus` instead.
|
|
20
20
|
*/
|
|
21
21
|
export declare const InterpreterStatus: typeof ActorStatus;
|
|
22
|
-
export declare class Actor<TLogic extends AnyActorLogic
|
|
22
|
+
export declare class Actor<TLogic extends AnyActorLogic> implements ActorRef<EventFromLogic<TLogic>, SnapshotFrom<TLogic>> {
|
|
23
23
|
logic: TLogic;
|
|
24
24
|
/**
|
|
25
25
|
* The current internal state of the actor.
|
|
@@ -42,8 +42,8 @@ export declare class Actor<TLogic extends AnyActorLogic, TEvent extends EventObj
|
|
|
42
42
|
* Whether the service is started.
|
|
43
43
|
*/
|
|
44
44
|
status: ActorStatus;
|
|
45
|
-
_parent?: ActorRef<any>;
|
|
46
|
-
ref: ActorRef<
|
|
45
|
+
_parent?: ActorRef<any, any>;
|
|
46
|
+
ref: ActorRef<EventFromLogic<TLogic>, SnapshotFrom<TLogic>>;
|
|
47
47
|
private _actorContext;
|
|
48
48
|
private _systemId;
|
|
49
49
|
/**
|
|
@@ -83,7 +83,7 @@ export declare class Actor<TLogic extends AnyActorLogic, TEvent extends EventObj
|
|
|
83
83
|
*
|
|
84
84
|
* @param event The event to send
|
|
85
85
|
*/
|
|
86
|
-
send(event:
|
|
86
|
+
send(event: EventFromLogic<TLogic>): void;
|
|
87
87
|
delaySend({ event, id, delay, to }: {
|
|
88
88
|
event: EventObject;
|
|
89
89
|
id: string | undefined;
|
|
@@ -35,12 +35,11 @@ export declare function getStateNodeByPath(stateNode: AnyStateNode, statePath: s
|
|
|
35
35
|
*
|
|
36
36
|
* @param state The state value or State instance
|
|
37
37
|
*/
|
|
38
|
-
export declare function getStateNodes<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, state: StateValue | State<TContext, TEvent, TODO, TODO, TODO
|
|
39
|
-
export declare function transitionAtomicNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: string, state: State<TContext, TEvent, TODO, TODO, TODO
|
|
40
|
-
export declare function transitionCompoundNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValueMap, state: State<TContext, TEvent, TODO, TODO, TODO
|
|
41
|
-
export declare function transitionParallelNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValueMap, state: State<TContext, TEvent, TODO, TODO, TODO
|
|
42
|
-
export declare function transitionNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValue, state: State<TContext, TEvent, TODO, TODO, TODO,
|
|
43
|
-
TODO>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>> | undefined;
|
|
38
|
+
export declare function getStateNodes<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, state: StateValue | State<TContext, TEvent, TODO, TODO, TODO>): Array<AnyStateNode>;
|
|
39
|
+
export declare function transitionAtomicNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: string, state: State<TContext, TEvent, TODO, TODO, TODO>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>> | undefined;
|
|
40
|
+
export declare function transitionCompoundNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValueMap, state: State<TContext, TEvent, TODO, TODO, TODO>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>> | undefined;
|
|
41
|
+
export declare function transitionParallelNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValueMap, state: State<TContext, TEvent, TODO, TODO, TODO>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>> | undefined;
|
|
42
|
+
export declare function transitionNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValue, state: State<TContext, TEvent, TODO, TODO, TODO>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>> | undefined;
|
|
44
43
|
export declare function removeConflictingTransitions(enabledTransitions: Array<AnyTransitionDefinition>, configuration: Set<AnyStateNode>, historyValue: AnyHistoryValue): Array<AnyTransitionDefinition>;
|
|
45
44
|
/**
|
|
46
45
|
* https://www.w3.org/TR/scxml/#microstepProcedure
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { StateNode } from "./StateNode.js";
|
|
2
2
|
import type { State } from "./State.js";
|
|
3
3
|
import type { ActorStatus, Clock, Actor } from "./interpreter.js";
|
|
4
|
-
import type { StateMachine } from "./StateMachine.js";
|
|
4
|
+
import type { MachineSnapshot, StateMachine } from "./StateMachine.js";
|
|
5
5
|
import { TypegenDisabled, ResolveTypegenMeta, TypegenConstraint, MarkAllImplementationsAsProvided, AreAllImplementationsAssumedToBeProvided } from "./typegenTypes.js";
|
|
6
6
|
import { PromiseActorLogic } from "./actors/promise.js";
|
|
7
7
|
import { Guard, GuardPredicate, UnknownGuard } from "./guards.js";
|
|
8
8
|
import { Spawner } from "./spawn.js";
|
|
9
9
|
import { AssignArgs } from "./actions/assign.js";
|
|
10
|
+
export type HomomorphicPick<T, K extends keyof any> = {
|
|
11
|
+
[P in keyof T as P & K]: T[P];
|
|
12
|
+
};
|
|
13
|
+
export type HomomorphicOmit<T, K extends keyof any> = {
|
|
14
|
+
[P in keyof T as Exclude<P, K>]: T[P];
|
|
15
|
+
};
|
|
10
16
|
/**
|
|
11
17
|
* `T | unknown` reduces to `unknown` and that can be problematic when it comes to contextual typing.
|
|
12
18
|
* It especially is a problem when the union has a function member, like here:
|
|
@@ -61,15 +67,17 @@ export interface ParameterizedObject {
|
|
|
61
67
|
export interface UnifiedArg<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject> {
|
|
62
68
|
context: TContext;
|
|
63
69
|
event: TExpressionEvent;
|
|
64
|
-
self: ActorRef<TEvent, TContext
|
|
70
|
+
self: ActorRef<TEvent, MachineSnapshot<TContext, TEvent, ProvidedActor, string, unknown>>;
|
|
65
71
|
system: ActorSystem<any>;
|
|
66
72
|
}
|
|
67
73
|
export type MachineContext = Record<string, any>;
|
|
68
74
|
export interface ActionArgs<TContext extends MachineContext, TExpressionEvent extends EventObject, TExpressionAction extends ParameterizedObject | undefined, TEvent extends EventObject> extends UnifiedArg<TContext, TExpressionEvent, TEvent> {
|
|
69
75
|
action: TExpressionAction;
|
|
70
76
|
}
|
|
71
|
-
export type InputFrom<T extends AnyActorLogic> = T extends StateMachine<infer _TContext, infer _TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer TInput, infer _TOutput, infer _TResolvedTypesMeta> ? TInput : T extends ActorLogic<infer
|
|
72
|
-
export type OutputFrom<T extends AnyActorLogic> = T extends ActorLogic<infer
|
|
77
|
+
export type InputFrom<T extends AnyActorLogic> = T extends StateMachine<infer _TContext, infer _TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer TInput, infer _TOutput, infer _TResolvedTypesMeta> ? TInput : T extends ActorLogic<infer _TSnapshot, infer _TEvent, infer TInput, infer _TPersisted, infer _TSystem> ? TInput : never;
|
|
78
|
+
export type OutputFrom<T extends AnyActorLogic> = T extends ActorLogic<infer TSnapshot, infer _TEvent, infer _TInput, infer _TPersisted, infer _TSystem> ? (TSnapshot & {
|
|
79
|
+
status: 'done';
|
|
80
|
+
})['output'] : never;
|
|
73
81
|
export type ActionFunction<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TExpressionAction extends ParameterizedObject | undefined, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string> = {
|
|
74
82
|
(args: ActionArgs<TContext, TExpressionEvent, TExpressionAction, TEvent>): void;
|
|
75
83
|
_out_TEvent?: TEvent;
|
|
@@ -338,7 +346,10 @@ export interface StateMachineDefinition<TContext extends MachineContext, TEvent
|
|
|
338
346
|
}
|
|
339
347
|
export type AnyStateNode = StateNode<any, any>;
|
|
340
348
|
export type AnyStateNodeDefinition = StateNodeDefinition<any, any>;
|
|
341
|
-
export type AnyState = State<any,
|
|
349
|
+
export type AnyState = State<any, // context
|
|
350
|
+
any, // event
|
|
351
|
+
any, // actor
|
|
352
|
+
any, // tags
|
|
342
353
|
any>;
|
|
343
354
|
export type AnyStateMachine = StateMachine<any, any, any, any, any, any, any, any, any, // delays
|
|
344
355
|
any>;
|
|
@@ -509,7 +520,7 @@ export type PropertyAssigner<TContext extends MachineContext, TExpressionEvent e
|
|
|
509
520
|
export type Mapper<TContext extends MachineContext, TEvent extends EventObject, TResult> = (args: {
|
|
510
521
|
context: TContext;
|
|
511
522
|
event: TEvent;
|
|
512
|
-
self: ActorRef<TEvent>;
|
|
523
|
+
self: ActorRef<TEvent, any>;
|
|
513
524
|
}) => TResult;
|
|
514
525
|
export type PropertyMapper<TContext extends MachineContext, TEvent extends EventObject, TParams extends {}> = {
|
|
515
526
|
[K in keyof TParams]?: Mapper<TContext, TEvent, TParams[K]> | TParams[K];
|
|
@@ -552,8 +563,8 @@ export interface StateConfig<TContext extends MachineContext, TEvent extends Eve
|
|
|
552
563
|
historyValue?: HistoryValue<TContext, TEvent>;
|
|
553
564
|
meta?: any;
|
|
554
565
|
configuration?: Array<StateNode<TContext, TEvent>>;
|
|
555
|
-
children: Record<string, ActorRef<any>>;
|
|
556
|
-
done
|
|
566
|
+
children: Record<string, ActorRef<any, any>>;
|
|
567
|
+
status: 'active' | 'done' | 'error' | 'stopped';
|
|
557
568
|
output?: any;
|
|
558
569
|
error?: unknown;
|
|
559
570
|
tags?: Set<string>;
|
|
@@ -567,7 +578,7 @@ export interface ActorOptions<TLogic extends AnyActorLogic> {
|
|
|
567
578
|
execute?: boolean;
|
|
568
579
|
clock?: Clock;
|
|
569
580
|
logger?: (...args: any[]) => void;
|
|
570
|
-
parent?: ActorRef<any>;
|
|
581
|
+
parent?: ActorRef<any, any>;
|
|
571
582
|
/**
|
|
572
583
|
* The custom `id` for referencing this service.
|
|
573
584
|
*/
|
|
@@ -593,14 +604,14 @@ export interface ActorOptions<TLogic extends AnyActorLogic> {
|
|
|
593
604
|
*/
|
|
594
605
|
src?: string;
|
|
595
606
|
}
|
|
596
|
-
export type AnyActor = Actor<any
|
|
607
|
+
export type AnyActor = Actor<any>;
|
|
597
608
|
/**
|
|
598
609
|
* @deprecated Use `AnyActor` instead.
|
|
599
610
|
*/
|
|
600
611
|
export type AnyInterpreter = AnyActor;
|
|
601
612
|
export type Observer<T> = {
|
|
602
613
|
next?: (value: T) => void;
|
|
603
|
-
error?: (err:
|
|
614
|
+
error?: (err: unknown) => void;
|
|
604
615
|
complete?: () => void;
|
|
605
616
|
};
|
|
606
617
|
export interface Subscription {
|
|
@@ -623,7 +634,7 @@ export interface BaseActorRef<TEvent extends EventObject> {
|
|
|
623
634
|
export interface ActorLike<TCurrent, TEvent extends EventObject> extends Subscribable<TCurrent> {
|
|
624
635
|
send: (event: TEvent) => void;
|
|
625
636
|
}
|
|
626
|
-
export interface ActorRef<TEvent extends EventObject, TSnapshot
|
|
637
|
+
export interface ActorRef<TEvent extends EventObject, TSnapshot extends Snapshot<unknown>> extends Subscribable<TSnapshot>, InteropObservable<TSnapshot> {
|
|
627
638
|
/**
|
|
628
639
|
* The unique identifier for this actor relative to its parent.
|
|
629
640
|
*/
|
|
@@ -642,12 +653,12 @@ export interface ActorRef<TEvent extends EventObject, TSnapshot = any> extends S
|
|
|
642
653
|
}
|
|
643
654
|
export type AnyActorRef = ActorRef<any, any>;
|
|
644
655
|
export type ActorLogicFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<any, any, any, any, any, any, any, any, any> ? R : R extends Promise<infer U> ? PromiseActorLogic<U> : never : never;
|
|
645
|
-
export type ActorRefFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer TEvent, infer TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TTag, infer _TInput, infer TOutput, infer TResolvedTypesMeta> ? ActorRef<TEvent,
|
|
656
|
+
export type ActorRefFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer TEvent, infer TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TTag, infer _TInput, infer TOutput, infer TResolvedTypesMeta> ? ActorRef<TEvent, MachineSnapshot<TContext, TEvent, TActor, TTag, TOutput, AreAllImplementationsAssumedToBeProvided<TResolvedTypesMeta> extends false ? MarkAllImplementationsAsProvided<TResolvedTypesMeta> : TResolvedTypesMeta>> : R extends Promise<infer U> ? ActorRefFrom<PromiseActorLogic<U>> : R extends ActorLogic<infer TSnapshot, infer TEvent, infer _TInput, infer _TPersisted, infer _TSystem> ? ActorRef<TEvent, TSnapshot> : never : never;
|
|
646
657
|
export type DevToolsAdapter = (service: AnyActor) => void;
|
|
647
658
|
/**
|
|
648
659
|
* @deprecated Use `Actor<T>` instead.
|
|
649
660
|
*/
|
|
650
|
-
export type InterpreterFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent, infer TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TTag, infer TInput, infer TOutput, infer TResolvedTypesMeta> ? Actor<ActorLogic<
|
|
661
|
+
export type InterpreterFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent, infer TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TTag, infer TInput, infer TOutput, infer TResolvedTypesMeta> ? Actor<ActorLogic<MachineSnapshot<TContext, TEvent, TActor, TTag, TOutput, TResolvedTypesMeta>, TEvent, TInput, PersistedMachineState<TContext, TEvent, TActor, TTag, TOutput, TResolvedTypesMeta>, ActorSystem<any>>> : never;
|
|
651
662
|
export type MachineImplementationsFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine), TRequireMissingImplementations extends boolean = false> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent, infer TActor, infer TAction, infer _TGuard, infer TDelay, infer _TTag, infer _TInput, infer _TOutput, infer TResolvedTypesMeta> ? InternalMachineImplementations<TContext, TEvent, TActor, TAction, TDelay, TResolvedTypesMeta, TRequireMissingImplementations> : never;
|
|
652
663
|
export type __ResolvedTypesMetaFrom<T> = T extends StateMachine<any, // context
|
|
653
664
|
any, // event
|
|
@@ -659,7 +670,7 @@ any, // tag
|
|
|
659
670
|
any, // input
|
|
660
671
|
any, // output
|
|
661
672
|
infer TResolvedTypesMeta> ? TResolvedTypesMeta : never;
|
|
662
|
-
export interface ActorContext<TEvent extends EventObject,
|
|
673
|
+
export interface ActorContext<TSnapshot extends Snapshot<unknown>, TEvent extends EventObject, TSystem extends ActorSystem<any> = ActorSystem<any>> {
|
|
663
674
|
self: ActorRef<TEvent, TSnapshot>;
|
|
664
675
|
id: string;
|
|
665
676
|
sessionId: string;
|
|
@@ -669,38 +680,57 @@ export interface ActorContext<TEvent extends EventObject, TSnapshot, TSystem ext
|
|
|
669
680
|
stopChild: (child: AnyActorRef) => void;
|
|
670
681
|
}
|
|
671
682
|
export type AnyActorContext = ActorContext<any, any, any>;
|
|
672
|
-
export
|
|
683
|
+
export type ActorStatusObject<TOutput> = {
|
|
684
|
+
status: 'done';
|
|
685
|
+
output: TOutput;
|
|
686
|
+
} | {
|
|
687
|
+
status: 'error';
|
|
688
|
+
error: unknown;
|
|
689
|
+
} | {
|
|
690
|
+
status: 'stopped';
|
|
691
|
+
} | {
|
|
692
|
+
status: 'active';
|
|
693
|
+
};
|
|
694
|
+
export type Snapshot<TOutput> = {
|
|
695
|
+
status: 'active';
|
|
696
|
+
output: undefined;
|
|
697
|
+
error: undefined;
|
|
698
|
+
} | {
|
|
699
|
+
status: 'done';
|
|
700
|
+
output: TOutput;
|
|
701
|
+
error: undefined;
|
|
702
|
+
} | {
|
|
703
|
+
status: 'error';
|
|
704
|
+
output: undefined;
|
|
705
|
+
error: unknown;
|
|
706
|
+
} | {
|
|
707
|
+
status: 'stopped';
|
|
708
|
+
output: undefined;
|
|
709
|
+
error: undefined;
|
|
710
|
+
};
|
|
711
|
+
export interface ActorLogic<TSnapshot extends Snapshot<unknown>, TEvent extends EventObject, TInput = unknown,
|
|
673
712
|
/**
|
|
674
713
|
* Serialized internal state used for persistence & restoration
|
|
675
714
|
*/
|
|
676
|
-
TPersisted =
|
|
715
|
+
TPersisted = TSnapshot, TSystem extends ActorSystem<any> = ActorSystem<any>> {
|
|
677
716
|
config?: unknown;
|
|
678
|
-
transition: (state:
|
|
679
|
-
getInitialState: (actorCtx: ActorContext<
|
|
680
|
-
restoreState?: (persistedState: TPersisted, actorCtx: ActorContext<
|
|
681
|
-
|
|
682
|
-
getStatus?: (state: TInternalState) => {
|
|
683
|
-
status: string;
|
|
684
|
-
data?: any;
|
|
685
|
-
};
|
|
686
|
-
start?: (state: TInternalState, actorCtx: ActorContext<TEvent, TSnapshot>) => void;
|
|
717
|
+
transition: (state: TSnapshot, message: TEvent, ctx: ActorContext<TSnapshot, TEvent, TSystem>) => TSnapshot;
|
|
718
|
+
getInitialState: (actorCtx: ActorContext<TSnapshot, TEvent, TSystem>, input: TInput) => TSnapshot;
|
|
719
|
+
restoreState?: (persistedState: TPersisted, actorCtx: ActorContext<TSnapshot, TEvent>) => TSnapshot;
|
|
720
|
+
start?: (state: TSnapshot, actorCtx: ActorContext<TSnapshot, TEvent>) => void;
|
|
687
721
|
/**
|
|
688
722
|
* @returns Persisted state
|
|
689
723
|
*/
|
|
690
|
-
getPersistedState?: (state:
|
|
691
|
-
_out_TOutput?: TOutput;
|
|
724
|
+
getPersistedState?: (state: TSnapshot) => TPersisted;
|
|
692
725
|
}
|
|
693
|
-
export type AnyActorLogic = ActorLogic<any, //
|
|
694
|
-
any, //
|
|
695
|
-
any, // internal state
|
|
696
|
-
any, // persisted state
|
|
697
|
-
any, // system
|
|
726
|
+
export type AnyActorLogic = ActorLogic<any, // snapshot
|
|
727
|
+
any, // event
|
|
698
728
|
any, // input
|
|
729
|
+
any, // persisted state
|
|
699
730
|
any>;
|
|
700
|
-
export type SnapshotFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends ActorRef<infer _, infer TSnapshot> ? TSnapshot : R extends Actor<infer TLogic> ? SnapshotFrom<TLogic> : R extends StateMachine<infer _TContext, infer _TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer _TInput, infer _TOutput, infer _TResolvedTypesMeta> ? StateFrom<R> : R extends ActorLogic<
|
|
701
|
-
export type EventFromLogic<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer
|
|
702
|
-
export type PersistedStateFrom<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer _TEvent, infer
|
|
703
|
-
export type InternalStateFrom<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer _TEvent, infer _TSnapshot, infer TInternalState, infer _TPersisted> ? TInternalState : never;
|
|
731
|
+
export type SnapshotFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends ActorRef<infer _, infer TSnapshot> ? TSnapshot : R extends Actor<infer TLogic> ? SnapshotFrom<TLogic> : R extends StateMachine<infer _TContext, infer _TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer _TInput, infer _TOutput, infer _TResolvedTypesMeta> ? StateFrom<R> : R extends ActorLogic<any, any, any, any, any> ? ReturnType<R['transition']> : R extends ActorContext<infer TSnapshot, infer _, infer __> ? TSnapshot : never : never;
|
|
732
|
+
export type EventFromLogic<TLogic extends ActorLogic<any, any, any, any, any>> = TLogic extends ActorLogic<infer _, infer TEvent, infer __, infer _____, infer ______> ? TEvent : never;
|
|
733
|
+
export type PersistedStateFrom<TLogic extends ActorLogic<any, any, any, any, any>> = TLogic extends ActorLogic<infer _TSnapshot, infer _TEvent, infer _TInput, infer TPersisted, infer _TSystem> ? TPersisted : never;
|
|
704
734
|
type ResolveEventType<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer _TContext, infer TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer _TInput, infer _TOutput, infer _TResolvedTypesMeta> ? TEvent : R extends State<infer _TContext, infer TEvent, infer _TActor, infer _TOutput, infer _TResolvedTypesMeta> ? TEvent : R extends ActorRef<infer TEvent, infer _> ? TEvent : never : never;
|
|
705
735
|
export type EventFrom<T, K extends Prop<TEvent, 'type'> = never, TEvent extends EventObject = ResolveEventType<T>> = IsNever<K> extends true ? TEvent : ExtractEvent<TEvent, K>;
|
|
706
736
|
export type ContextFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer _TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer _TInput, infer _TOutput, infer _TTypesMeta> ? TContext : R extends State<infer TContext, infer _TEvent, infer _TActor, infer _TOutput, infer _TResolvedTypesMeta> ? TContext : R extends Actor<infer TActorLogic> ? TActorLogic extends StateMachine<infer TContext, infer _TEvent, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer _TTag, infer _TInput, infer _TOutput, infer _TTypesMeta> ? TContext : never : never : never;
|
|
@@ -725,9 +755,9 @@ export interface ActorSystem<T extends ActorSystemInfo> {
|
|
|
725
755
|
get: <K extends keyof T['actors']>(key: K) => T['actors'][K] | undefined;
|
|
726
756
|
}
|
|
727
757
|
export type AnyActorSystem = ActorSystem<any>;
|
|
728
|
-
export type PersistedMachineState<
|
|
758
|
+
export type PersistedMachineState<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TTag extends string, TOutput, TResolvedTypesMeta = TypegenDisabled> = HomomorphicPick<MachineSnapshot<TContext, TEvent, TActor, TTag, TOutput, TResolvedTypesMeta>, 'value' | 'output' | 'error' | 'context' | 'status' | 'historyValue'> & {
|
|
729
759
|
children: {
|
|
730
|
-
[K in keyof
|
|
760
|
+
[K in keyof MachineSnapshot<TContext, TEvent, TActor, TTag, TOutput, TResolvedTypesMeta>['children']]: {
|
|
731
761
|
state: any;
|
|
732
762
|
src?: string;
|
|
733
763
|
};
|
package/dist/{interpreter-e2c6a579.development.cjs.js → interpreter-7f1dc557.development.cjs.js}
RENAMED
|
@@ -452,10 +452,9 @@ class Actor {
|
|
|
452
452
|
|
|
453
453
|
// array of functions to defer
|
|
454
454
|
|
|
455
|
-
update(
|
|
455
|
+
update(snapshot) {
|
|
456
456
|
// Update state
|
|
457
|
-
this._state =
|
|
458
|
-
const snapshot = this.getSnapshot();
|
|
457
|
+
this._state = snapshot;
|
|
459
458
|
|
|
460
459
|
// Execute deferred effects
|
|
461
460
|
let deferredFn;
|
|
@@ -470,18 +469,17 @@ class Actor {
|
|
|
470
469
|
reportUnhandledError(err);
|
|
471
470
|
}
|
|
472
471
|
}
|
|
473
|
-
|
|
474
|
-
switch (status?.status) {
|
|
472
|
+
switch (this._state.status) {
|
|
475
473
|
case 'done':
|
|
476
474
|
this._stopProcedure();
|
|
477
475
|
this._complete();
|
|
478
|
-
this._doneEvent = createDoneActorEvent(this.id,
|
|
476
|
+
this._doneEvent = createDoneActorEvent(this.id, this._state.output);
|
|
479
477
|
this._parent?.send(this._doneEvent);
|
|
480
478
|
break;
|
|
481
479
|
case 'error':
|
|
482
480
|
this._stopProcedure();
|
|
483
|
-
this._error(
|
|
484
|
-
this._parent?.send(createErrorActorEvent(this.id,
|
|
481
|
+
this._error(this._state.error);
|
|
482
|
+
this._parent?.send(createErrorActorEvent(this.id, this._state.error));
|
|
485
483
|
break;
|
|
486
484
|
}
|
|
487
485
|
}
|
|
@@ -516,8 +514,8 @@ class Actor {
|
|
|
516
514
|
this.system._set(this._systemId, this);
|
|
517
515
|
}
|
|
518
516
|
this.status = ActorStatus.Running;
|
|
519
|
-
const status = this.
|
|
520
|
-
switch (status
|
|
517
|
+
const status = this._state.status;
|
|
518
|
+
switch (status) {
|
|
521
519
|
case 'done':
|
|
522
520
|
// a state machine can be "done" upon intialization (it could reach a final state using initial microsteps)
|
|
523
521
|
// we still need to complete observers, flush deferreds etc
|
|
@@ -721,7 +719,7 @@ class Actor {
|
|
|
721
719
|
return this;
|
|
722
720
|
}
|
|
723
721
|
getSnapshot() {
|
|
724
|
-
return this.
|
|
722
|
+
return this._state;
|
|
725
723
|
}
|
|
726
724
|
}
|
|
727
725
|
|
package/dist/{interpreter-6e7909c8.development.esm.js → interpreter-945c4b96.development.esm.js}
RENAMED
|
@@ -450,10 +450,9 @@ class Actor {
|
|
|
450
450
|
|
|
451
451
|
// array of functions to defer
|
|
452
452
|
|
|
453
|
-
update(
|
|
453
|
+
update(snapshot) {
|
|
454
454
|
// Update state
|
|
455
|
-
this._state =
|
|
456
|
-
const snapshot = this.getSnapshot();
|
|
455
|
+
this._state = snapshot;
|
|
457
456
|
|
|
458
457
|
// Execute deferred effects
|
|
459
458
|
let deferredFn;
|
|
@@ -468,18 +467,17 @@ class Actor {
|
|
|
468
467
|
reportUnhandledError(err);
|
|
469
468
|
}
|
|
470
469
|
}
|
|
471
|
-
|
|
472
|
-
switch (status?.status) {
|
|
470
|
+
switch (this._state.status) {
|
|
473
471
|
case 'done':
|
|
474
472
|
this._stopProcedure();
|
|
475
473
|
this._complete();
|
|
476
|
-
this._doneEvent = createDoneActorEvent(this.id,
|
|
474
|
+
this._doneEvent = createDoneActorEvent(this.id, this._state.output);
|
|
477
475
|
this._parent?.send(this._doneEvent);
|
|
478
476
|
break;
|
|
479
477
|
case 'error':
|
|
480
478
|
this._stopProcedure();
|
|
481
|
-
this._error(
|
|
482
|
-
this._parent?.send(createErrorActorEvent(this.id,
|
|
479
|
+
this._error(this._state.error);
|
|
480
|
+
this._parent?.send(createErrorActorEvent(this.id, this._state.error));
|
|
483
481
|
break;
|
|
484
482
|
}
|
|
485
483
|
}
|
|
@@ -514,8 +512,8 @@ class Actor {
|
|
|
514
512
|
this.system._set(this._systemId, this);
|
|
515
513
|
}
|
|
516
514
|
this.status = ActorStatus.Running;
|
|
517
|
-
const status = this.
|
|
518
|
-
switch (status
|
|
515
|
+
const status = this._state.status;
|
|
516
|
+
switch (status) {
|
|
519
517
|
case 'done':
|
|
520
518
|
// a state machine can be "done" upon intialization (it could reach a final state using initial microsteps)
|
|
521
519
|
// we still need to complete observers, flush deferreds etc
|
|
@@ -719,7 +717,7 @@ class Actor {
|
|
|
719
717
|
return this;
|
|
720
718
|
}
|
|
721
719
|
getSnapshot() {
|
|
722
|
-
return this.
|
|
720
|
+
return this._state;
|
|
723
721
|
}
|
|
724
722
|
}
|
|
725
723
|
|
|
@@ -449,10 +449,9 @@ class Actor {
|
|
|
449
449
|
|
|
450
450
|
// array of functions to defer
|
|
451
451
|
|
|
452
|
-
update(
|
|
452
|
+
update(snapshot) {
|
|
453
453
|
// Update state
|
|
454
|
-
this._state =
|
|
455
|
-
const snapshot = this.getSnapshot();
|
|
454
|
+
this._state = snapshot;
|
|
456
455
|
|
|
457
456
|
// Execute deferred effects
|
|
458
457
|
let deferredFn;
|
|
@@ -467,18 +466,17 @@ class Actor {
|
|
|
467
466
|
reportUnhandledError(err);
|
|
468
467
|
}
|
|
469
468
|
}
|
|
470
|
-
|
|
471
|
-
switch (status?.status) {
|
|
469
|
+
switch (this._state.status) {
|
|
472
470
|
case 'done':
|
|
473
471
|
this._stopProcedure();
|
|
474
472
|
this._complete();
|
|
475
|
-
this._doneEvent = createDoneActorEvent(this.id,
|
|
473
|
+
this._doneEvent = createDoneActorEvent(this.id, this._state.output);
|
|
476
474
|
this._parent?.send(this._doneEvent);
|
|
477
475
|
break;
|
|
478
476
|
case 'error':
|
|
479
477
|
this._stopProcedure();
|
|
480
|
-
this._error(
|
|
481
|
-
this._parent?.send(createErrorActorEvent(this.id,
|
|
478
|
+
this._error(this._state.error);
|
|
479
|
+
this._parent?.send(createErrorActorEvent(this.id, this._state.error));
|
|
482
480
|
break;
|
|
483
481
|
}
|
|
484
482
|
}
|
|
@@ -513,8 +511,8 @@ class Actor {
|
|
|
513
511
|
this.system._set(this._systemId, this);
|
|
514
512
|
}
|
|
515
513
|
this.status = ActorStatus.Running;
|
|
516
|
-
const status = this.
|
|
517
|
-
switch (status
|
|
514
|
+
const status = this._state.status;
|
|
515
|
+
switch (status) {
|
|
518
516
|
case 'done':
|
|
519
517
|
// a state machine can be "done" upon intialization (it could reach a final state using initial microsteps)
|
|
520
518
|
// we still need to complete observers, flush deferreds etc
|
|
@@ -713,7 +711,7 @@ class Actor {
|
|
|
713
711
|
return this;
|
|
714
712
|
}
|
|
715
713
|
getSnapshot() {
|
|
716
|
-
return this.
|
|
714
|
+
return this._state;
|
|
717
715
|
}
|
|
718
716
|
}
|
|
719
717
|
|
|
@@ -447,10 +447,9 @@ class Actor {
|
|
|
447
447
|
|
|
448
448
|
// array of functions to defer
|
|
449
449
|
|
|
450
|
-
update(
|
|
450
|
+
update(snapshot) {
|
|
451
451
|
// Update state
|
|
452
|
-
this._state =
|
|
453
|
-
const snapshot = this.getSnapshot();
|
|
452
|
+
this._state = snapshot;
|
|
454
453
|
|
|
455
454
|
// Execute deferred effects
|
|
456
455
|
let deferredFn;
|
|
@@ -465,18 +464,17 @@ class Actor {
|
|
|
465
464
|
reportUnhandledError(err);
|
|
466
465
|
}
|
|
467
466
|
}
|
|
468
|
-
|
|
469
|
-
switch (status?.status) {
|
|
467
|
+
switch (this._state.status) {
|
|
470
468
|
case 'done':
|
|
471
469
|
this._stopProcedure();
|
|
472
470
|
this._complete();
|
|
473
|
-
this._doneEvent = createDoneActorEvent(this.id,
|
|
471
|
+
this._doneEvent = createDoneActorEvent(this.id, this._state.output);
|
|
474
472
|
this._parent?.send(this._doneEvent);
|
|
475
473
|
break;
|
|
476
474
|
case 'error':
|
|
477
475
|
this._stopProcedure();
|
|
478
|
-
this._error(
|
|
479
|
-
this._parent?.send(createErrorActorEvent(this.id,
|
|
476
|
+
this._error(this._state.error);
|
|
477
|
+
this._parent?.send(createErrorActorEvent(this.id, this._state.error));
|
|
480
478
|
break;
|
|
481
479
|
}
|
|
482
480
|
}
|
|
@@ -511,8 +509,8 @@ class Actor {
|
|
|
511
509
|
this.system._set(this._systemId, this);
|
|
512
510
|
}
|
|
513
511
|
this.status = ActorStatus.Running;
|
|
514
|
-
const status = this.
|
|
515
|
-
switch (status
|
|
512
|
+
const status = this._state.status;
|
|
513
|
+
switch (status) {
|
|
516
514
|
case 'done':
|
|
517
515
|
// a state machine can be "done" upon intialization (it could reach a final state using initial microsteps)
|
|
518
516
|
// we still need to complete observers, flush deferreds etc
|
|
@@ -711,7 +709,7 @@ class Actor {
|
|
|
711
709
|
return this;
|
|
712
710
|
}
|
|
713
711
|
getSnapshot() {
|
|
714
|
-
return this.
|
|
712
|
+
return this._state;
|
|
715
713
|
}
|
|
716
714
|
}
|
|
717
715
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveReferencedActor, d as createActor, f as ActorStatus, k as createErrorActorEvent, l as toStateValue, n as STATE_IDENTIFIER, o as normalizeTarget, t as toArray, N as NULL_EVENT, a as toTransitionConfigArray, S as STATE_DELIMITER, q as toStatePath, s as createDoneStateEvent, u as mapContext, j as XSTATE_STOP, X as XSTATE_INIT, W as WILDCARD, v as isArray, w as createAfterEvent, x as flatten, e as matchesState } from './interpreter-
|
|
1
|
+
import { r as resolveReferencedActor, d as createActor, f as ActorStatus, k as createErrorActorEvent, l as toStateValue, n as STATE_IDENTIFIER, o as normalizeTarget, t as toArray, N as NULL_EVENT, a as toTransitionConfigArray, S as STATE_DELIMITER, q as toStatePath, s as createDoneStateEvent, u as mapContext, j as XSTATE_STOP, X as XSTATE_INIT, W as WILDCARD, v as isArray, w as createAfterEvent, x as flatten, e as matchesState } from './interpreter-b8f53c4b.esm.js';
|
|
2
2
|
|
|
3
3
|
const cache = new WeakMap();
|
|
4
4
|
function memo(object, key, fn) {
|
|
@@ -890,7 +890,7 @@ function microstepProcedure(transitions, currentState, mutConfiguration, event,
|
|
|
890
890
|
historyValue,
|
|
891
891
|
_internalQueue: internalQueue,
|
|
892
892
|
context: nextState.context,
|
|
893
|
-
done,
|
|
893
|
+
status: done ? 'done' : currentState.status,
|
|
894
894
|
output,
|
|
895
895
|
children: nextState.children
|
|
896
896
|
});
|
|
@@ -1119,7 +1119,7 @@ function macrostep(state, event, actorCtx) {
|
|
|
1119
1119
|
nextState = microstep(transitions, state, actorCtx, nextEvent, false);
|
|
1120
1120
|
states.push(nextState);
|
|
1121
1121
|
}
|
|
1122
|
-
while (
|
|
1122
|
+
while (nextState.status === 'active') {
|
|
1123
1123
|
let enabledTransitions = selectEventlessTransitions(nextState, nextEvent);
|
|
1124
1124
|
if (!enabledTransitions.length) {
|
|
1125
1125
|
if (!nextState._internalQueue.length) {
|
|
@@ -1136,7 +1136,7 @@ function macrostep(state, event, actorCtx) {
|
|
|
1136
1136
|
states.push(nextState);
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
if (nextState.
|
|
1139
|
+
if (nextState.status !== 'active') {
|
|
1140
1140
|
// Perform the stop step to ensure that child actors are stopped
|
|
1141
1141
|
stopStep(nextEvent, nextState, actorCtx);
|
|
1142
1142
|
}
|
|
@@ -1229,7 +1229,8 @@ class State {
|
|
|
1229
1229
|
meta: {},
|
|
1230
1230
|
configuration: [],
|
|
1231
1231
|
// TODO: fix,
|
|
1232
|
-
children: {}
|
|
1232
|
+
children: {},
|
|
1233
|
+
status: 'active'
|
|
1233
1234
|
}, machine);
|
|
1234
1235
|
}
|
|
1235
1236
|
return stateValue;
|
|
@@ -1240,7 +1241,8 @@ class State {
|
|
|
1240
1241
|
context,
|
|
1241
1242
|
meta: undefined,
|
|
1242
1243
|
configuration: Array.from(configuration),
|
|
1243
|
-
children: {}
|
|
1244
|
+
children: {},
|
|
1245
|
+
status: 'active'
|
|
1244
1246
|
}, machine);
|
|
1245
1247
|
}
|
|
1246
1248
|
|
|
@@ -1253,8 +1255,7 @@ class State {
|
|
|
1253
1255
|
this.machine = machine;
|
|
1254
1256
|
this.tags = void 0;
|
|
1255
1257
|
this.value = void 0;
|
|
1256
|
-
this.
|
|
1257
|
-
this.output = void 0;
|
|
1258
|
+
this.status = void 0;
|
|
1258
1259
|
this.error = void 0;
|
|
1259
1260
|
this.context = void 0;
|
|
1260
1261
|
this.historyValue = {};
|
|
@@ -1270,7 +1271,7 @@ class State {
|
|
|
1270
1271
|
this.children = config.children;
|
|
1271
1272
|
this.value = getStateValue(machine.root, this.configuration);
|
|
1272
1273
|
this.tags = new Set(flatten(this.configuration.map(sn => sn.tags)));
|
|
1273
|
-
this.
|
|
1274
|
+
this.status = config.status;
|
|
1274
1275
|
this.output = config.output;
|
|
1275
1276
|
this.error = config.error;
|
|
1276
1277
|
}
|
|
@@ -1365,9 +1366,10 @@ function getPersistedState(state) {
|
|
|
1365
1366
|
} = state;
|
|
1366
1367
|
const childrenJson = {};
|
|
1367
1368
|
for (const id in children) {
|
|
1369
|
+
const child = children[id];
|
|
1368
1370
|
childrenJson[id] = {
|
|
1369
|
-
state:
|
|
1370
|
-
src:
|
|
1371
|
+
state: child.getPersistedState?.(),
|
|
1372
|
+
src: child.src
|
|
1371
1373
|
};
|
|
1372
1374
|
}
|
|
1373
1375
|
return {
|