xstate 5.0.0-beta.30 → 5.0.0-beta.31
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 +8 -12
- package/actors/dist/xstate-actors.development.cjs.js +8 -12
- package/actors/dist/xstate-actors.development.esm.js +8 -12
- package/actors/dist/xstate-actors.esm.js +8 -12
- 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/Machine.d.ts +2 -2
- package/dist/declarations/src/StateNode.d.ts +2 -2
- package/dist/declarations/src/actors/callback.d.ts +1 -1
- package/dist/declarations/src/spawn.d.ts +3 -0
- package/dist/declarations/src/types.d.ts +17 -42
- package/dist/declarations/src/utils.d.ts +4 -4
- package/dist/{interpreter-a2c1e529.cjs.js → interpreter-05e11c15.cjs.js} +2 -2
- package/dist/{interpreter-7f1dc557.development.cjs.js → interpreter-a2236840.development.cjs.js} +3 -3
- package/dist/{interpreter-b8f53c4b.esm.js → interpreter-d5fa7ce0.esm.js} +2 -2
- package/dist/{interpreter-945c4b96.development.esm.js → interpreter-e4d2487f.development.esm.js} +3 -3
- package/dist/{raise-0b7dde8b.esm.js → raise-6a68d0cc.esm.js} +49 -22
- package/dist/{raise-6e4f5cf7.development.esm.js → raise-6fbd4513.development.esm.js} +49 -22
- package/dist/{raise-e79b1f86.cjs.js → raise-90808d65.cjs.js} +49 -22
- package/dist/{raise-7cae872b.development.cjs.js → raise-b4bfe138.development.cjs.js} +49 -22
- package/dist/{send-19a256f0.development.cjs.js → send-4163d2af.development.cjs.js} +52 -20
- package/dist/{send-e7063201.cjs.js → send-72e85cc6.cjs.js} +52 -20
- package/dist/{send-a1d772da.development.esm.js → send-7baeedcb.development.esm.js} +52 -20
- package/dist/{send-f4fb3ba5.esm.js → send-e5f0f3f6.esm.js} +52 -20
- package/dist/xstate.cjs.js +4 -4
- package/dist/xstate.development.cjs.js +7 -4
- package/dist/xstate.development.esm.js +10 -7
- package/dist/xstate.esm.js +7 -7
- 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
|
@@ -135,7 +135,7 @@ export interface InvokeDefinition<TContext extends MachineContext, TEvent extend
|
|
|
135
135
|
* The source of the actor logic to be invoked
|
|
136
136
|
*/
|
|
137
137
|
src: string;
|
|
138
|
-
input?: Mapper<TContext, TEvent, NonReducibleUnknown> | NonReducibleUnknown;
|
|
138
|
+
input?: Mapper<TContext, TEvent, NonReducibleUnknown, TEvent> | NonReducibleUnknown;
|
|
139
139
|
/**
|
|
140
140
|
* The transition to take upon the invoked child machine reaching its final top-level state.
|
|
141
141
|
*/
|
|
@@ -144,7 +144,7 @@ export interface InvokeDefinition<TContext extends MachineContext, TEvent extend
|
|
|
144
144
|
* The transition to take upon the invoked child machine sending an error event.
|
|
145
145
|
*/
|
|
146
146
|
onError?: string | SingleOrArray<TransitionConfig<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay>>;
|
|
147
|
-
onSnapshot?: string | SingleOrArray<TransitionConfig<TContext, SnapshotEvent
|
|
147
|
+
onSnapshot?: string | SingleOrArray<TransitionConfig<TContext, SnapshotEvent, TEvent, TActor, TAction, TGuard, TDelay>>;
|
|
148
148
|
toJSON: () => Omit<InvokeDefinition<TContext, TEvent, TActor, TAction, TGuard, TDelay>, 'onDone' | 'onError' | 'toJSON'>;
|
|
149
149
|
}
|
|
150
150
|
type Delay<TDelay extends string> = TDelay | number;
|
|
@@ -181,7 +181,7 @@ type DistributeActors<TContext extends MachineContext, TEvent extends EventObjec
|
|
|
181
181
|
* The source of the machine to be invoked, or the machine itself.
|
|
182
182
|
*/
|
|
183
183
|
src: TSrc;
|
|
184
|
-
input?: Mapper<TContext, TEvent, InputFrom<TSpecificActor['logic']
|
|
184
|
+
input?: Mapper<TContext, TEvent, InputFrom<TSpecificActor['logic']>, TEvent> | InputFrom<TSpecificActor['logic']>;
|
|
185
185
|
/**
|
|
186
186
|
* The transition to take upon the invoked child machine reaching its final top-level state.
|
|
187
187
|
*/
|
|
@@ -215,7 +215,7 @@ export type InvokeConfig<TContext extends MachineContext, TEvent extends EventOb
|
|
|
215
215
|
* The source of the machine to be invoked, or the machine itself.
|
|
216
216
|
*/
|
|
217
217
|
src: AnyActorLogic | string;
|
|
218
|
-
input?: Mapper<TContext, TEvent, NonReducibleUnknown> | NonReducibleUnknown;
|
|
218
|
+
input?: Mapper<TContext, TEvent, NonReducibleUnknown, TEvent> | NonReducibleUnknown;
|
|
219
219
|
/**
|
|
220
220
|
* The transition to take upon the invoked child machine reaching its final top-level state.
|
|
221
221
|
*/
|
|
@@ -225,8 +225,7 @@ export type InvokeConfig<TContext extends MachineContext, TEvent extends EventOb
|
|
|
225
225
|
* The transition to take upon the invoked child machine sending an error event.
|
|
226
226
|
*/
|
|
227
227
|
onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay>>;
|
|
228
|
-
onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent
|
|
229
|
-
TEvent, TActor, TAction, TGuard, TDelay>>;
|
|
228
|
+
onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent, TEvent, TActor, TAction, TGuard, TDelay>>;
|
|
230
229
|
};
|
|
231
230
|
export type AnyInvokeConfig = InvokeConfig<any, any, any, any, any, any>;
|
|
232
231
|
export interface StateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TOutput> {
|
|
@@ -299,7 +298,7 @@ export interface StateNodeConfig<TContext extends MachineContext, TEvent extends
|
|
|
299
298
|
* The output data will be evaluated with the current `context` and placed on the `.data` property
|
|
300
299
|
* of the event.
|
|
301
300
|
*/
|
|
302
|
-
output?: Mapper<TContext, TEvent,
|
|
301
|
+
output?: Mapper<TContext, TEvent, unknown, TEvent> | NonReducibleUnknown;
|
|
303
302
|
/**
|
|
304
303
|
* The unique ID of the state node, which can be referenced as a transition target via the
|
|
305
304
|
* `#id` syntax.
|
|
@@ -337,7 +336,7 @@ export interface StateNodeDefinition<TContext extends MachineContext, TEvent ext
|
|
|
337
336
|
exit: UnknownAction[];
|
|
338
337
|
meta: any;
|
|
339
338
|
order: number;
|
|
340
|
-
output?:
|
|
339
|
+
output?: StateNodeConfig<TContext, TEvent, ProvidedActor, ParameterizedObject, ParameterizedObject, string, string, unknown>['output'];
|
|
341
340
|
invoke: Array<InvokeDefinition<TContext, TEvent, TODO, TODO, TODO, TODO>>;
|
|
342
341
|
description?: string;
|
|
343
342
|
tags: string[];
|
|
@@ -364,14 +363,6 @@ export interface HistoryStateNodeConfig<TContext extends MachineContext, TEvent
|
|
|
364
363
|
history: 'shallow' | 'deep' | true;
|
|
365
364
|
target: string | undefined;
|
|
366
365
|
}
|
|
367
|
-
export interface FinalStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> extends AtomicStateNodeConfig<TContext, TEvent> {
|
|
368
|
-
type: 'final';
|
|
369
|
-
/**
|
|
370
|
-
* The data to be sent with the "xstate.done.state.<id>" event. The data can be
|
|
371
|
-
* static or dynamic (based on assigners).
|
|
372
|
-
*/
|
|
373
|
-
output?: Mapper<TContext, TEvent, any>;
|
|
374
|
-
}
|
|
375
366
|
export type SimpleOrStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> = AtomicStateNodeConfig<TContext, TEvent> | StateNodeConfig<TContext, TEvent, TODO, TODO, TODO, TODO, TODO, TODO>;
|
|
376
367
|
export type ActionFunctionMap<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string> = {
|
|
377
368
|
[K in TAction['type']]?: ActionFunction<TContext, TEvent, TEvent, TAction extends {
|
|
@@ -390,7 +381,7 @@ export interface MachineImplementationsSimplified<TContext extends MachineContex
|
|
|
390
381
|
actions: ActionFunctionMap<TContext, TEvent, TActor, TAction>;
|
|
391
382
|
actors: Record<string, AnyActorLogic | {
|
|
392
383
|
src: AnyActorLogic;
|
|
393
|
-
input: Mapper<TContext, TEvent,
|
|
384
|
+
input: Mapper<TContext, TEvent, unknown, TEvent> | NonReducibleUnknown;
|
|
394
385
|
}>;
|
|
395
386
|
delays: DelayFunctionMap<TContext, TEvent, TAction>;
|
|
396
387
|
}
|
|
@@ -401,7 +392,7 @@ type MachineImplementationsActions<TContext extends MachineContext, TResolvedTyp
|
|
|
401
392
|
type MachineImplementationsActors<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingActors = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingActors'>, TIndexedActors = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedActors'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>, _TInvokeSrcNameMap = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'invokeSrcNameMap'>> = {
|
|
402
393
|
[K in keyof TIndexedActors]?: Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic> | {
|
|
403
394
|
src: Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic>;
|
|
404
|
-
input: Mapper<TContext, MaybeNarrowedEvent<TIndexedEvents, TEventsCausingActors, K>, InputFrom<Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic
|
|
395
|
+
input: Mapper<TContext, MaybeNarrowedEvent<TIndexedEvents, TEventsCausingActors, K>, InputFrom<Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic>>, Cast<Prop<TIndexedEvents, keyof TIndexedEvents>, EventObject>> | InputFrom<Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic>>;
|
|
405
396
|
};
|
|
406
397
|
};
|
|
407
398
|
type MachineImplementationsDelays<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingDelays = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingDelays'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>, TIndexedActions = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedActions'>, TIndexedDelays = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedDelays'>> = {
|
|
@@ -435,10 +426,7 @@ export type ContextFactory<TContext extends MachineContext, TActor extends Provi
|
|
|
435
426
|
spawn: Spawner<TActor>;
|
|
436
427
|
input: TInput;
|
|
437
428
|
}) => TContext;
|
|
438
|
-
type
|
|
439
|
-
states?: StatesConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TOutput> | undefined;
|
|
440
|
-
};
|
|
441
|
-
export type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor = ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string, TTag extends string = string, TInput = any, TOutput = unknown, TTypesMeta = TypegenDisabled> = (RootStateNodeConfig<NoInfer<TContext>, NoInfer<TEvent>, NoInfer<TActor>, NoInfer<TAction>, NoInfer<TGuard>, NoInfer<TDelay>, NoInfer<TTag>, NoInfer<TOutput>> & {
|
|
429
|
+
export type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor = ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string, TTag extends string = string, TInput = any, TOutput = unknown, TTypesMeta = TypegenDisabled> = (Omit<StateNodeConfig<NoInfer<TContext>, NoInfer<TEvent>, NoInfer<TActor>, NoInfer<TAction>, NoInfer<TGuard>, NoInfer<TDelay>, NoInfer<TTag>, NoInfer<TOutput>>, 'output'> & {
|
|
442
430
|
/**
|
|
443
431
|
* The initial context (extended state)
|
|
444
432
|
*/
|
|
@@ -447,7 +435,8 @@ export type MachineConfig<TContext extends MachineContext, TEvent extends EventO
|
|
|
447
435
|
*/
|
|
448
436
|
version?: string;
|
|
449
437
|
types?: MachineTypes<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TInput, TOutput, TTypesMeta>;
|
|
450
|
-
|
|
438
|
+
output?: Mapper<TContext, DoneStateEvent, TOutput, TEvent> | TOutput;
|
|
439
|
+
}) & (MachineContext extends TContext ? {
|
|
451
440
|
context?: InitialContext<LowInfer<TContext>, TActor, TInput>;
|
|
452
441
|
} : {
|
|
453
442
|
context: InitialContext<LowInfer<TContext>, TActor, TInput>;
|
|
@@ -485,9 +474,9 @@ export interface ErrorActorEvent<TErrorData = unknown> extends EventObject {
|
|
|
485
474
|
type: `xstate.error.actor.${string}`;
|
|
486
475
|
data: TErrorData;
|
|
487
476
|
}
|
|
488
|
-
export interface SnapshotEvent<
|
|
477
|
+
export interface SnapshotEvent<TSnapshot extends Snapshot<unknown> = Snapshot<unknown>> extends EventObject {
|
|
489
478
|
type: `xstate.snapshot.${string}`;
|
|
490
|
-
|
|
479
|
+
snapshot: TSnapshot;
|
|
491
480
|
}
|
|
492
481
|
export interface DoneStateEvent<TOutput = unknown> extends EventObject {
|
|
493
482
|
type: `xstate.done.state.${string}`;
|
|
@@ -517,14 +506,11 @@ export type PartialAssigner<TContext extends MachineContext, TExpressionEvent ex
|
|
|
517
506
|
export type PropertyAssigner<TContext extends MachineContext, TExpressionEvent extends EventObject, TExpressionAction extends ParameterizedObject | undefined, TEvent extends EventObject, TActor extends ProvidedActor> = {
|
|
518
507
|
[K in keyof TContext]?: PartialAssigner<TContext, TExpressionEvent, TExpressionAction, TEvent, TActor, K> | TContext[K];
|
|
519
508
|
};
|
|
520
|
-
export type Mapper<TContext extends MachineContext,
|
|
509
|
+
export type Mapper<TContext extends MachineContext, TExpressionEvent extends EventObject, TResult, TEvent extends EventObject> = (args: {
|
|
521
510
|
context: TContext;
|
|
522
|
-
event:
|
|
523
|
-
self: ActorRef<TEvent,
|
|
511
|
+
event: TExpressionEvent;
|
|
512
|
+
self: ActorRef<TEvent, MachineSnapshot<TContext, TEvent, ProvidedActor, string, unknown>>;
|
|
524
513
|
}) => TResult;
|
|
525
|
-
export type PropertyMapper<TContext extends MachineContext, TEvent extends EventObject, TParams extends {}> = {
|
|
526
|
-
[K in keyof TParams]?: Mapper<TContext, TEvent, TParams[K]> | TParams[K];
|
|
527
|
-
};
|
|
528
514
|
export interface TransitionDefinition<TContext extends MachineContext, TEvent extends EventObject> extends Omit<TransitionConfig<TContext, TEvent, TEvent, TODO, TODO, TODO, TODO>, 'target' | 'guard'> {
|
|
529
515
|
target: ReadonlyArray<StateNode<TContext, TEvent>> | undefined;
|
|
530
516
|
source: StateNode<TContext, TEvent>;
|
|
@@ -680,17 +666,6 @@ export interface ActorContext<TSnapshot extends Snapshot<unknown>, TEvent extend
|
|
|
680
666
|
stopChild: (child: AnyActorRef) => void;
|
|
681
667
|
}
|
|
682
668
|
export type AnyActorContext = ActorContext<any, any, any>;
|
|
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
669
|
export type Snapshot<TOutput> = {
|
|
695
670
|
status: 'active';
|
|
696
671
|
output: undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyActorLogic, AnyState } from "./index.js";
|
|
2
2
|
import type { StateNode } from "./StateNode.js";
|
|
3
|
-
import type { ActorLogic, AnyEventObject, EventObject, MachineContext, Mapper, Observer, ErrorActorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfigTarget, AnyActorRef, AnyTransitionConfig } from "./types.js";
|
|
3
|
+
import type { ActorLogic, AnyEventObject, EventObject, MachineContext, Mapper, Observer, ErrorActorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfigTarget, AnyActorRef, AnyTransitionConfig, NonReducibleUnknown } from "./types.js";
|
|
4
4
|
export declare function keys<T extends object>(value: T): Array<keyof T & string>;
|
|
5
5
|
export declare function matchesState(parentStateId: StateValue, childStateId: StateValue): boolean;
|
|
6
6
|
export declare function toStatePath(stateId: string | string[]): string[];
|
|
@@ -26,7 +26,7 @@ export declare function toStatePaths(stateValue: StateValue | undefined): string
|
|
|
26
26
|
export declare function flatten<T>(array: Array<T | T[]>): T[];
|
|
27
27
|
export declare function toArrayStrict<T>(value: readonly T[] | T): readonly T[];
|
|
28
28
|
export declare function toArray<T>(value: readonly T[] | T | undefined): readonly T[];
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function resolveOutput<TContext extends MachineContext, TExpressionEvent extends EventObject>(mapper: Mapper<TContext, TExpressionEvent, unknown, EventObject> | NonReducibleUnknown, context: TContext, event: TExpressionEvent, self: AnyActorRef): unknown;
|
|
30
30
|
export declare function isBuiltInEvent(eventType: string): boolean;
|
|
31
31
|
export declare function isPromiseLike(value: any): value is PromiseLike<any>;
|
|
32
32
|
export declare function isActorLogic(value: any): value is ActorLogic<any, any>;
|
|
@@ -42,8 +42,8 @@ export declare function toObserver<T>(nextHandler?: Observer<T> | ((value: T) =>
|
|
|
42
42
|
export declare function createInvokeId(stateNodeId: string, index: number): string;
|
|
43
43
|
export declare function resolveReferencedActor(referenced: AnyActorLogic | {
|
|
44
44
|
src: AnyActorLogic;
|
|
45
|
-
input: Mapper<
|
|
45
|
+
input: Mapper<MachineContext, EventObject, unknown, EventObject> | NonReducibleUnknown;
|
|
46
46
|
} | undefined): {
|
|
47
47
|
src: AnyActorLogic;
|
|
48
|
-
input: Mapper<
|
|
48
|
+
input: Mapper<MachineContext, EventObject, unknown, EventObject> | NonReducibleUnknown;
|
|
49
49
|
} | undefined;
|
|
@@ -271,7 +271,7 @@ function toArray(value) {
|
|
|
271
271
|
}
|
|
272
272
|
return toArrayStrict(value);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function resolveOutput(mapper, context, event, self) {
|
|
275
275
|
if (typeof mapper === 'function') {
|
|
276
276
|
return mapper({
|
|
277
277
|
context,
|
|
@@ -758,11 +758,11 @@ exports.flatten = flatten;
|
|
|
758
758
|
exports.interpret = interpret;
|
|
759
759
|
exports.isArray = isArray;
|
|
760
760
|
exports.isErrorActorEvent = isErrorActorEvent;
|
|
761
|
-
exports.mapContext = mapContext;
|
|
762
761
|
exports.mapValues = mapValues;
|
|
763
762
|
exports.matchesState = matchesState;
|
|
764
763
|
exports.normalizeTarget = normalizeTarget;
|
|
765
764
|
exports.pathToStateValue = pathToStateValue;
|
|
765
|
+
exports.resolveOutput = resolveOutput;
|
|
766
766
|
exports.resolveReferencedActor = resolveReferencedActor;
|
|
767
767
|
exports.toArray = toArray;
|
|
768
768
|
exports.toObserver = toObserver;
|
package/dist/{interpreter-7f1dc557.development.cjs.js → interpreter-a2236840.development.cjs.js}
RENAMED
|
@@ -271,7 +271,7 @@ function toArray(value) {
|
|
|
271
271
|
}
|
|
272
272
|
return toArrayStrict(value);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function resolveOutput(mapper, context, event, self) {
|
|
275
275
|
if (typeof mapper === 'function') {
|
|
276
276
|
return mapper({
|
|
277
277
|
context,
|
|
@@ -279,7 +279,7 @@ function mapContext(mapper, context, event, self) {
|
|
|
279
279
|
self
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
if (typeof mapper === 'object' && Object.values(mapper).some(val => typeof val === 'function')) {
|
|
282
|
+
if (!!mapper && typeof mapper === 'object' && Object.values(mapper).some(val => typeof val === 'function')) {
|
|
283
283
|
console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.\nFound object containing properties whose values are possibly mapping functions: ${Object.entries(mapper).filter(([key, value]) => typeof value === 'function').map(([key, value]) => `\n - ${key}: ${value.toString().replace(/\n\s*/g, '')}`).join('')}`);
|
|
284
284
|
}
|
|
285
285
|
return mapper;
|
|
@@ -766,11 +766,11 @@ exports.flatten = flatten;
|
|
|
766
766
|
exports.interpret = interpret;
|
|
767
767
|
exports.isArray = isArray;
|
|
768
768
|
exports.isErrorActorEvent = isErrorActorEvent;
|
|
769
|
-
exports.mapContext = mapContext;
|
|
770
769
|
exports.mapValues = mapValues;
|
|
771
770
|
exports.matchesState = matchesState;
|
|
772
771
|
exports.normalizeTarget = normalizeTarget;
|
|
773
772
|
exports.pathToStateValue = pathToStateValue;
|
|
773
|
+
exports.resolveOutput = resolveOutput;
|
|
774
774
|
exports.resolveReferencedActor = resolveReferencedActor;
|
|
775
775
|
exports.toArray = toArray;
|
|
776
776
|
exports.toObserver = toObserver;
|
|
@@ -269,7 +269,7 @@ function toArray(value) {
|
|
|
269
269
|
}
|
|
270
270
|
return toArrayStrict(value);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function resolveOutput(mapper, context, event, self) {
|
|
273
273
|
if (typeof mapper === 'function') {
|
|
274
274
|
return mapper({
|
|
275
275
|
context,
|
|
@@ -736,4 +736,4 @@ const interpret = createActor;
|
|
|
736
736
|
* @deprecated Use `Actor` instead.
|
|
737
737
|
*/
|
|
738
738
|
|
|
739
|
-
export { Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_INIT as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, XSTATE_STOP as j, createErrorActorEvent as k, toStateValue as l, mapValues as m, STATE_IDENTIFIER as n, normalizeTarget as o, pathToStateValue as p, toStatePath as q, resolveReferencedActor as r, createDoneStateEvent as s, toArray as t,
|
|
739
|
+
export { Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_INIT as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, XSTATE_STOP as j, createErrorActorEvent as k, toStateValue as l, mapValues as m, STATE_IDENTIFIER as n, normalizeTarget as o, pathToStateValue as p, toStatePath as q, resolveReferencedActor as r, createDoneStateEvent as s, toArray as t, resolveOutput as u, isArray as v, createAfterEvent as w, flatten as x, XSTATE_ERROR as y };
|
package/dist/{interpreter-945c4b96.development.esm.js → interpreter-e4d2487f.development.esm.js}
RENAMED
|
@@ -269,7 +269,7 @@ function toArray(value) {
|
|
|
269
269
|
}
|
|
270
270
|
return toArrayStrict(value);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function resolveOutput(mapper, context, event, self) {
|
|
273
273
|
if (typeof mapper === 'function') {
|
|
274
274
|
return mapper({
|
|
275
275
|
context,
|
|
@@ -277,7 +277,7 @@ function mapContext(mapper, context, event, self) {
|
|
|
277
277
|
self
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
-
if (typeof mapper === 'object' && Object.values(mapper).some(val => typeof val === 'function')) {
|
|
280
|
+
if (!!mapper && typeof mapper === 'object' && Object.values(mapper).some(val => typeof val === 'function')) {
|
|
281
281
|
console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.\nFound object containing properties whose values are possibly mapping functions: ${Object.entries(mapper).filter(([key, value]) => typeof value === 'function').map(([key, value]) => `\n - ${key}: ${value.toString().replace(/\n\s*/g, '')}`).join('')}`);
|
|
282
282
|
}
|
|
283
283
|
return mapper;
|
|
@@ -744,4 +744,4 @@ const interpret = createActor;
|
|
|
744
744
|
* @deprecated Use `Actor` instead.
|
|
745
745
|
*/
|
|
746
746
|
|
|
747
|
-
export { Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_INIT as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, XSTATE_STOP as j, createErrorActorEvent as k, toStateValue as l, mapValues as m, STATE_IDENTIFIER as n, normalizeTarget as o, pathToStateValue as p, toStatePath as q, resolveReferencedActor as r, createDoneStateEvent as s, toArray as t,
|
|
747
|
+
export { Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_INIT as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, XSTATE_STOP as j, createErrorActorEvent as k, toStateValue as l, mapValues as m, STATE_IDENTIFIER as n, normalizeTarget as o, pathToStateValue as p, toStatePath as q, resolveReferencedActor as r, createDoneStateEvent as s, toArray as t, resolveOutput as u, isArray as v, createAfterEvent as w, flatten as x, XSTATE_ERROR as y };
|
|
@@ -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
|
|
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 resolveOutput, 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-d5fa7ce0.esm.js';
|
|
2
2
|
|
|
3
3
|
const cache = new WeakMap();
|
|
4
4
|
function memo(object, key, fn) {
|
|
@@ -14,13 +14,13 @@ function memo(object, key, fn) {
|
|
|
14
14
|
return memoizedData[key];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function resolveCancel(_, state, actionArgs, {
|
|
18
18
|
sendId
|
|
19
19
|
}) {
|
|
20
20
|
const resolvedSendId = typeof sendId === 'function' ? sendId(actionArgs) : sendId;
|
|
21
21
|
return [state, resolvedSendId];
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function executeCancel(actorContext, resolvedSendId) {
|
|
24
24
|
actorContext.self.cancel(resolvedSendId);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -35,16 +35,17 @@ function cancel(sendId) {
|
|
|
35
35
|
}
|
|
36
36
|
cancel.type = 'xstate.cancel';
|
|
37
37
|
cancel.sendId = sendId;
|
|
38
|
-
cancel.resolve =
|
|
39
|
-
cancel.execute =
|
|
38
|
+
cancel.resolve = resolveCancel;
|
|
39
|
+
cancel.execute = executeCancel;
|
|
40
40
|
return cancel;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function
|
|
43
|
+
function resolveInvoke(actorContext, state, actionArgs, {
|
|
44
44
|
id,
|
|
45
45
|
systemId,
|
|
46
46
|
src,
|
|
47
|
-
input
|
|
47
|
+
input,
|
|
48
|
+
syncSnapshot
|
|
48
49
|
}) {
|
|
49
50
|
const referenced = resolveReferencedActor(state.machine.implementations.actors[src]);
|
|
50
51
|
let actorRef;
|
|
@@ -62,6 +63,21 @@ function resolve$2(actorContext, state, actionArgs, {
|
|
|
62
63
|
self: actorContext?.self
|
|
63
64
|
}) : configuredInput
|
|
64
65
|
});
|
|
66
|
+
if (syncSnapshot) {
|
|
67
|
+
actorRef.subscribe({
|
|
68
|
+
next: snapshot => {
|
|
69
|
+
if (snapshot.status === 'active') {
|
|
70
|
+
actorContext.self.send({
|
|
71
|
+
type: `xstate.snapshot.${id}`,
|
|
72
|
+
snapshot
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
error: () => {
|
|
77
|
+
/* TODO */
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
65
81
|
}
|
|
66
82
|
return [cloneState(state, {
|
|
67
83
|
children: {
|
|
@@ -73,7 +89,7 @@ function resolve$2(actorContext, state, actionArgs, {
|
|
|
73
89
|
actorRef
|
|
74
90
|
}];
|
|
75
91
|
}
|
|
76
|
-
function
|
|
92
|
+
function executeInvoke(actorContext, {
|
|
77
93
|
id,
|
|
78
94
|
actorRef
|
|
79
95
|
}) {
|
|
@@ -99,7 +115,8 @@ function invoke({
|
|
|
99
115
|
id,
|
|
100
116
|
systemId,
|
|
101
117
|
src,
|
|
102
|
-
input
|
|
118
|
+
input,
|
|
119
|
+
onSnapshot
|
|
103
120
|
}) {
|
|
104
121
|
function invoke(_) {
|
|
105
122
|
}
|
|
@@ -108,12 +125,13 @@ function invoke({
|
|
|
108
125
|
invoke.systemId = systemId;
|
|
109
126
|
invoke.src = src;
|
|
110
127
|
invoke.input = input;
|
|
111
|
-
invoke.
|
|
112
|
-
invoke.
|
|
128
|
+
invoke.syncSnapshot = !!onSnapshot;
|
|
129
|
+
invoke.resolve = resolveInvoke;
|
|
130
|
+
invoke.execute = executeInvoke;
|
|
113
131
|
return invoke;
|
|
114
132
|
}
|
|
115
133
|
|
|
116
|
-
function
|
|
134
|
+
function resolveStop(_, state, args, {
|
|
117
135
|
actorRef
|
|
118
136
|
}) {
|
|
119
137
|
const actorRefOrString = typeof actorRef === 'function' ? actorRef(args) : actorRef;
|
|
@@ -129,7 +147,7 @@ function resolve$1(_, state, args, {
|
|
|
129
147
|
children
|
|
130
148
|
}), resolvedActorRef];
|
|
131
149
|
}
|
|
132
|
-
function
|
|
150
|
+
function executeStop(actorContext, actorRef) {
|
|
133
151
|
if (!actorRef) {
|
|
134
152
|
return;
|
|
135
153
|
}
|
|
@@ -152,8 +170,8 @@ function stop(actorRef) {
|
|
|
152
170
|
}
|
|
153
171
|
stop.type = 'xstate.stop';
|
|
154
172
|
stop.actorRef = actorRef;
|
|
155
|
-
stop.resolve =
|
|
156
|
-
stop.execute =
|
|
173
|
+
stop.resolve = resolveStop;
|
|
174
|
+
stop.execute = executeStop;
|
|
157
175
|
return stop;
|
|
158
176
|
}
|
|
159
177
|
|
|
@@ -260,9 +278,18 @@ function evaluateGuard(guard, context, event, state) {
|
|
|
260
278
|
}
|
|
261
279
|
|
|
262
280
|
function getOutput(configuration, context, event, self) {
|
|
263
|
-
const
|
|
281
|
+
const {
|
|
282
|
+
machine
|
|
283
|
+
} = configuration[0];
|
|
284
|
+
const {
|
|
285
|
+
root
|
|
286
|
+
} = machine;
|
|
287
|
+
if (!root.output) {
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
264
290
|
const finalChildStateNode = configuration.find(stateNode => stateNode.type === 'final' && stateNode.parent === machine.root);
|
|
265
|
-
|
|
291
|
+
const doneStateEvent = createDoneStateEvent(finalChildStateNode.id, finalChildStateNode.output ? resolveOutput(finalChildStateNode.output, context, event, self) : undefined);
|
|
292
|
+
return resolveOutput(root.output, context, doneStateEvent, self);
|
|
266
293
|
}
|
|
267
294
|
const isAtomicStateNode = stateNode => stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
268
295
|
function getChildren(stateNode) {
|
|
@@ -928,7 +955,7 @@ function enterStates(event, filteredTransitions, mutConfiguration, actions, inte
|
|
|
928
955
|
if (!parent.parent) {
|
|
929
956
|
continue;
|
|
930
957
|
}
|
|
931
|
-
internalQueue.push(createDoneStateEvent(parent.id, stateNodeToEnter.output ?
|
|
958
|
+
internalQueue.push(createDoneStateEvent(parent.id, stateNodeToEnter.output ? resolveOutput(stateNodeToEnter.output, currentState.context, event, actorContext.self) : undefined));
|
|
932
959
|
if (parent.parent) {
|
|
933
960
|
const grandparent = parent.parent;
|
|
934
961
|
if (grandparent.type === 'parallel') {
|
|
@@ -1378,7 +1405,7 @@ function getPersistedState(state) {
|
|
|
1378
1405
|
};
|
|
1379
1406
|
}
|
|
1380
1407
|
|
|
1381
|
-
function
|
|
1408
|
+
function resolveRaise(_, state, args, {
|
|
1382
1409
|
event: eventOrExpr,
|
|
1383
1410
|
id,
|
|
1384
1411
|
delay
|
|
@@ -1403,7 +1430,7 @@ function resolve(_, state, args, {
|
|
|
1403
1430
|
delay: resolvedDelay
|
|
1404
1431
|
}];
|
|
1405
1432
|
}
|
|
1406
|
-
function
|
|
1433
|
+
function executeRaise(actorContext, params) {
|
|
1407
1434
|
if (typeof params.delay === 'number') {
|
|
1408
1435
|
actorContext.self.delaySend(params);
|
|
1409
1436
|
return;
|
|
@@ -1422,8 +1449,8 @@ function raise(eventOrExpr, options) {
|
|
|
1422
1449
|
raise.event = eventOrExpr;
|
|
1423
1450
|
raise.id = options?.id;
|
|
1424
1451
|
raise.delay = options?.delay;
|
|
1425
|
-
raise.resolve =
|
|
1426
|
-
raise.execute =
|
|
1452
|
+
raise.resolve = resolveRaise;
|
|
1453
|
+
raise.execute = executeRaise;
|
|
1427
1454
|
return raise;
|
|
1428
1455
|
}
|
|
1429
1456
|
|
|
@@ -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
|
|
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 resolveOutput, W as WILDCARD, j as XSTATE_STOP, X as XSTATE_INIT, v as isArray, w as createAfterEvent, x as flatten, e as matchesState } from './interpreter-e4d2487f.development.esm.js';
|
|
2
2
|
|
|
3
3
|
const cache = new WeakMap();
|
|
4
4
|
function memo(object, key, fn) {
|
|
@@ -14,13 +14,13 @@ function memo(object, key, fn) {
|
|
|
14
14
|
return memoizedData[key];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function resolveCancel(_, state, actionArgs, {
|
|
18
18
|
sendId
|
|
19
19
|
}) {
|
|
20
20
|
const resolvedSendId = typeof sendId === 'function' ? sendId(actionArgs) : sendId;
|
|
21
21
|
return [state, resolvedSendId];
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function executeCancel(actorContext, resolvedSendId) {
|
|
24
24
|
actorContext.self.cancel(resolvedSendId);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -38,16 +38,17 @@ function cancel(sendId) {
|
|
|
38
38
|
}
|
|
39
39
|
cancel.type = 'xstate.cancel';
|
|
40
40
|
cancel.sendId = sendId;
|
|
41
|
-
cancel.resolve =
|
|
42
|
-
cancel.execute =
|
|
41
|
+
cancel.resolve = resolveCancel;
|
|
42
|
+
cancel.execute = executeCancel;
|
|
43
43
|
return cancel;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function
|
|
46
|
+
function resolveInvoke(actorContext, state, actionArgs, {
|
|
47
47
|
id,
|
|
48
48
|
systemId,
|
|
49
49
|
src,
|
|
50
|
-
input
|
|
50
|
+
input,
|
|
51
|
+
syncSnapshot
|
|
51
52
|
}) {
|
|
52
53
|
const referenced = resolveReferencedActor(state.machine.implementations.actors[src]);
|
|
53
54
|
let actorRef;
|
|
@@ -65,6 +66,21 @@ function resolve$2(actorContext, state, actionArgs, {
|
|
|
65
66
|
self: actorContext?.self
|
|
66
67
|
}) : configuredInput
|
|
67
68
|
});
|
|
69
|
+
if (syncSnapshot) {
|
|
70
|
+
actorRef.subscribe({
|
|
71
|
+
next: snapshot => {
|
|
72
|
+
if (snapshot.status === 'active') {
|
|
73
|
+
actorContext.self.send({
|
|
74
|
+
type: `xstate.snapshot.${id}`,
|
|
75
|
+
snapshot
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
error: () => {
|
|
80
|
+
/* TODO */
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
68
84
|
}
|
|
69
85
|
if (!actorRef) {
|
|
70
86
|
console.warn(`Actor type '${src}' not found in machine '${actorContext.id}'.`);
|
|
@@ -79,7 +95,7 @@ function resolve$2(actorContext, state, actionArgs, {
|
|
|
79
95
|
actorRef
|
|
80
96
|
}];
|
|
81
97
|
}
|
|
82
|
-
function
|
|
98
|
+
function executeInvoke(actorContext, {
|
|
83
99
|
id,
|
|
84
100
|
actorRef
|
|
85
101
|
}) {
|
|
@@ -105,7 +121,8 @@ function invoke({
|
|
|
105
121
|
id,
|
|
106
122
|
systemId,
|
|
107
123
|
src,
|
|
108
|
-
input
|
|
124
|
+
input,
|
|
125
|
+
onSnapshot
|
|
109
126
|
}) {
|
|
110
127
|
function invoke(_) {
|
|
111
128
|
{
|
|
@@ -117,12 +134,13 @@ function invoke({
|
|
|
117
134
|
invoke.systemId = systemId;
|
|
118
135
|
invoke.src = src;
|
|
119
136
|
invoke.input = input;
|
|
120
|
-
invoke.
|
|
121
|
-
invoke.
|
|
137
|
+
invoke.syncSnapshot = !!onSnapshot;
|
|
138
|
+
invoke.resolve = resolveInvoke;
|
|
139
|
+
invoke.execute = executeInvoke;
|
|
122
140
|
return invoke;
|
|
123
141
|
}
|
|
124
142
|
|
|
125
|
-
function
|
|
143
|
+
function resolveStop(_, state, args, {
|
|
126
144
|
actorRef
|
|
127
145
|
}) {
|
|
128
146
|
const actorRefOrString = typeof actorRef === 'function' ? actorRef(args) : actorRef;
|
|
@@ -138,7 +156,7 @@ function resolve$1(_, state, args, {
|
|
|
138
156
|
children
|
|
139
157
|
}), resolvedActorRef];
|
|
140
158
|
}
|
|
141
|
-
function
|
|
159
|
+
function executeStop(actorContext, actorRef) {
|
|
142
160
|
if (!actorRef) {
|
|
143
161
|
return;
|
|
144
162
|
}
|
|
@@ -164,8 +182,8 @@ function stop(actorRef) {
|
|
|
164
182
|
}
|
|
165
183
|
stop.type = 'xstate.stop';
|
|
166
184
|
stop.actorRef = actorRef;
|
|
167
|
-
stop.resolve =
|
|
168
|
-
stop.execute =
|
|
185
|
+
stop.resolve = resolveStop;
|
|
186
|
+
stop.execute = executeStop;
|
|
169
187
|
return stop;
|
|
170
188
|
}
|
|
171
189
|
|
|
@@ -280,9 +298,18 @@ function evaluateGuard(guard, context, event, state) {
|
|
|
280
298
|
}
|
|
281
299
|
|
|
282
300
|
function getOutput(configuration, context, event, self) {
|
|
283
|
-
const
|
|
301
|
+
const {
|
|
302
|
+
machine
|
|
303
|
+
} = configuration[0];
|
|
304
|
+
const {
|
|
305
|
+
root
|
|
306
|
+
} = machine;
|
|
307
|
+
if (!root.output) {
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
284
310
|
const finalChildStateNode = configuration.find(stateNode => stateNode.type === 'final' && stateNode.parent === machine.root);
|
|
285
|
-
|
|
311
|
+
const doneStateEvent = createDoneStateEvent(finalChildStateNode.id, finalChildStateNode.output ? resolveOutput(finalChildStateNode.output, context, event, self) : undefined);
|
|
312
|
+
return resolveOutput(root.output, context, doneStateEvent, self);
|
|
286
313
|
}
|
|
287
314
|
const isAtomicStateNode = stateNode => stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
288
315
|
function getChildren(stateNode) {
|
|
@@ -959,7 +986,7 @@ function enterStates(event, filteredTransitions, mutConfiguration, actions, inte
|
|
|
959
986
|
if (!parent.parent) {
|
|
960
987
|
continue;
|
|
961
988
|
}
|
|
962
|
-
internalQueue.push(createDoneStateEvent(parent.id, stateNodeToEnter.output ?
|
|
989
|
+
internalQueue.push(createDoneStateEvent(parent.id, stateNodeToEnter.output ? resolveOutput(stateNodeToEnter.output, currentState.context, event, actorContext.self) : undefined));
|
|
963
990
|
if (parent.parent) {
|
|
964
991
|
const grandparent = parent.parent;
|
|
965
992
|
if (grandparent.type === 'parallel') {
|
|
@@ -1415,7 +1442,7 @@ function getPersistedState(state) {
|
|
|
1415
1442
|
};
|
|
1416
1443
|
}
|
|
1417
1444
|
|
|
1418
|
-
function
|
|
1445
|
+
function resolveRaise(_, state, args, {
|
|
1419
1446
|
event: eventOrExpr,
|
|
1420
1447
|
id,
|
|
1421
1448
|
delay
|
|
@@ -1440,7 +1467,7 @@ function resolve(_, state, args, {
|
|
|
1440
1467
|
delay: resolvedDelay
|
|
1441
1468
|
}];
|
|
1442
1469
|
}
|
|
1443
|
-
function
|
|
1470
|
+
function executeRaise(actorContext, params) {
|
|
1444
1471
|
if (typeof params.delay === 'number') {
|
|
1445
1472
|
actorContext.self.delaySend(params);
|
|
1446
1473
|
return;
|
|
@@ -1462,8 +1489,8 @@ function raise(eventOrExpr, options) {
|
|
|
1462
1489
|
raise.event = eventOrExpr;
|
|
1463
1490
|
raise.id = options?.id;
|
|
1464
1491
|
raise.delay = options?.delay;
|
|
1465
|
-
raise.resolve =
|
|
1466
|
-
raise.execute =
|
|
1492
|
+
raise.resolve = resolveRaise;
|
|
1493
|
+
raise.execute = executeRaise;
|
|
1467
1494
|
return raise;
|
|
1468
1495
|
}
|
|
1469
1496
|
|