xstate 6.0.0-beta.2 → 6.0.0-beta.3
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/README.md +4 -2
- package/dist/{createActor-20a97166.esm.js → createActor-49ea55ba.esm.js} +17 -8
- package/dist/{createActor-c91c9ffe.cjs.js → createActor-73aa92ba.cjs.js} +17 -7
- package/dist/{createActor-0250284a.development.esm.js → createActor-a085b20b.development.esm.js} +17 -8
- package/dist/{createActor-c029d29f.development.cjs.js → createActor-dfb6b790.development.cjs.js} +17 -7
- package/dist/declarations/src/fsm.d.ts +7 -7
- package/dist/{effectDescriptor-47f73e7e.cjs.js → effectDescriptor-3402f63e.cjs.js} +1 -1
- package/dist/{effectDescriptor-e93df910.esm.js → effectDescriptor-65821048.development.esm.js} +1 -1
- package/dist/{effectDescriptor-5ac7dccb.development.esm.js → effectDescriptor-72c62058.esm.js} +1 -1
- package/dist/{effectDescriptor-3fff5c51.development.cjs.js → effectDescriptor-d0ea44ad.development.cjs.js} +1 -1
- package/dist/{legacySnapshot-ae6594a7.development.esm.js → legacySnapshot-11aba2d2.development.esm.js} +1 -1
- package/dist/{legacySnapshot-ebf0b2b8.development.cjs.js → legacySnapshot-2e2c1d3b.development.cjs.js} +1 -1
- package/dist/{legacySnapshot-8d595687.cjs.js → legacySnapshot-a85dfbe2.cjs.js} +1 -1
- package/dist/{legacySnapshot-9e06feb4.esm.js → legacySnapshot-fffe81a0.esm.js} +1 -1
- package/dist/xstate-actors.cjs.js +30 -5
- package/dist/xstate-actors.development.cjs.js +30 -5
- package/dist/xstate-actors.development.esm.js +31 -6
- package/dist/xstate-actors.esm.js +31 -6
- 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 +3 -3
- package/dist/xstate-durable.development.cjs.js +3 -3
- package/dist/xstate-durable.development.esm.js +3 -3
- package/dist/xstate-durable.esm.js +3 -3
- package/dist/xstate-durable.umd.min.js +1 -1
- package/dist/xstate-durable.umd.min.js.map +1 -1
- package/dist/xstate-fsm.cjs.js +61 -31
- package/dist/xstate-fsm.development.cjs.js +61 -31
- package/dist/xstate-fsm.development.esm.js +61 -31
- package/dist/xstate-fsm.esm.js +61 -31
- package/dist/xstate-fsm.umd.min.js +1 -1
- package/dist/xstate-fsm.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 +2 -2
- package/dist/xstate-graph.esm.js +2 -2
- package/dist/xstate-persist.cjs.js +2 -2
- package/dist/xstate-persist.development.cjs.js +2 -2
- package/dist/xstate-persist.development.esm.js +3 -3
- package/dist/xstate-persist.esm.js +3 -3
- package/dist/xstate-persist.umd.min.js +1 -1
- package/dist/xstate-persist.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.cjs.js +26 -8
- package/dist/xstate.development.cjs.js +26 -8
- package/dist/xstate.development.esm.js +28 -10
- package/dist/xstate.esm.js +28 -10
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/docs/actor-logic.md +1 -1
- package/docs/api-stability.json +93 -81
- package/docs/faq.md +1 -1
- package/docs/fsm.md +53 -10
- package/docs/index.md +2 -1
- package/docs/inspect-actor-systems.md +20 -3
- package/docs/inspection.md +5 -1
- package/docs/invoke.md +2 -2
- package/docs/migrate-inspector.md +141 -0
- package/docs/system-transitions.md +2 -0
- package/docs/transitions.md +5 -1
- package/docs/xstate-v5-to-v6.md +6 -4
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createActor = require('./createActor-
|
|
5
|
+
var createActor = require('./createActor-73aa92ba.cjs.js');
|
|
6
6
|
|
|
7
7
|
const actorValidationErrorSymbol = Symbol.for('xstate.actorValidationError');
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createActor = require('./createActor-
|
|
5
|
+
var createActor = require('./createActor-dfb6b790.development.cjs.js');
|
|
6
6
|
|
|
7
7
|
const actorValidationErrorSymbol = Symbol.for('xstate.actorValidationError');
|
|
8
8
|
|
package/dist/xstate.cjs.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var dist_xstateActors = require('./xstate-actors.cjs.js');
|
|
6
|
-
var createActor = require('./createActor-
|
|
7
|
-
var legacySnapshot = require('./legacySnapshot-
|
|
6
|
+
var createActor = require('./createActor-73aa92ba.cjs.js');
|
|
7
|
+
var legacySnapshot = require('./legacySnapshot-a85dfbe2.cjs.js');
|
|
8
8
|
var schema_types = require('./schema.types-15a68ddc.cjs.js');
|
|
9
|
-
var effectDescriptor = require('./effectDescriptor-
|
|
9
|
+
var effectDescriptor = require('./effectDescriptor-3402f63e.cjs.js');
|
|
10
10
|
require('./validation-4561b43c.cjs.js');
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -2294,7 +2294,25 @@ class SystemReduction {
|
|
|
2294
2294
|
attachedKind(actor) {
|
|
2295
2295
|
return this.logic.get(actor.src)?.[createActor.systemLogicMetadata]?.kind;
|
|
2296
2296
|
}
|
|
2297
|
-
|
|
2297
|
+
forwardAttachment(ref, event, immediate = false) {
|
|
2298
|
+
if (!immediate) {
|
|
2299
|
+
this.enqueue(ref, ref, {
|
|
2300
|
+
type: createActor.XSTATE_ATTACHED_FORWARD,
|
|
2301
|
+
event
|
|
2302
|
+
});
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
this.process({
|
|
2306
|
+
source: ref,
|
|
2307
|
+
target: ref,
|
|
2308
|
+
event: this.encode({
|
|
2309
|
+
type: createActor.XSTATE_ATTACHED_FORWARD,
|
|
2310
|
+
event
|
|
2311
|
+
}),
|
|
2312
|
+
sequence: this.snapshot.counters.sequence++
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
relayAttachments(source, emitted, immediate = false) {
|
|
2298
2316
|
for (const actor of Object.values(this.snapshot.actors)) {
|
|
2299
2317
|
const kind = this.attachedKind(actor);
|
|
2300
2318
|
if (!actor.started || actor.snapshot.status !== 'active' || kind !== '@xstate.listener' && kind !== '@xstate.subscription') continue;
|
|
@@ -2309,10 +2327,10 @@ class SystemReduction {
|
|
|
2309
2327
|
const mapper = input.mappers[snapshot.status === 'active' ? 'snapshot' : snapshot.status === 'done' ? 'done' : snapshot.status === 'error' ? 'error' : ''];
|
|
2310
2328
|
if (mapper) event = mapper(snapshot.status === 'done' ? snapshot.output : snapshot.status === 'error' ? snapshot.error : snapshot);
|
|
2311
2329
|
}
|
|
2312
|
-
if (event) this.
|
|
2330
|
+
if (event) this.forwardAttachment({
|
|
2313
2331
|
'@actor': actor.address,
|
|
2314
2332
|
incarnation: actor.incarnation
|
|
2315
|
-
},
|
|
2333
|
+
}, event, immediate);
|
|
2316
2334
|
}
|
|
2317
2335
|
}
|
|
2318
2336
|
stopAttachments(parent) {
|
|
@@ -2648,7 +2666,7 @@ class SystemReduction {
|
|
|
2648
2666
|
// Live subscriptions immediately report already-published errors;
|
|
2649
2667
|
// active/done snapshots are observed when their actor publishes them.
|
|
2650
2668
|
if (observed?.started && observed.snapshot.status === 'error' && input.mappers.error && actor.parent) {
|
|
2651
|
-
this.
|
|
2669
|
+
this.forwardAttachment(ref, input.mappers.error(this.hydrate(target).error));
|
|
2652
2670
|
}
|
|
2653
2671
|
}
|
|
2654
2672
|
if (this.current(ref)?.snapshot.status === 'active') this.relayAttachments(ref);
|
|
@@ -2700,7 +2718,7 @@ class SystemReduction {
|
|
|
2700
2718
|
const actor = this.current(ref);
|
|
2701
2719
|
if (!actor) return;
|
|
2702
2720
|
// Publish terminal observations before cleanup and the native parent event.
|
|
2703
|
-
this.relayAttachments(ref);
|
|
2721
|
+
this.relayAttachments(ref, undefined, true);
|
|
2704
2722
|
this.cancel(ref);
|
|
2705
2723
|
this.cancelExternal(ref);
|
|
2706
2724
|
this.stopAttachments(ref);
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var dist_xstateActors = require('./xstate-actors.development.cjs.js');
|
|
6
|
-
var createActor = require('./createActor-
|
|
7
|
-
var legacySnapshot = require('./legacySnapshot-
|
|
6
|
+
var createActor = require('./createActor-dfb6b790.development.cjs.js');
|
|
7
|
+
var legacySnapshot = require('./legacySnapshot-2e2c1d3b.development.cjs.js');
|
|
8
8
|
var schema_types = require('./schema.types-1c16f035.development.cjs.js');
|
|
9
|
-
var effectDescriptor = require('./effectDescriptor-
|
|
9
|
+
var effectDescriptor = require('./effectDescriptor-d0ea44ad.development.cjs.js');
|
|
10
10
|
require('./validation-f2714a35.development.cjs.js');
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -2294,7 +2294,25 @@ class SystemReduction {
|
|
|
2294
2294
|
attachedKind(actor) {
|
|
2295
2295
|
return this.logic.get(actor.src)?.[createActor.systemLogicMetadata]?.kind;
|
|
2296
2296
|
}
|
|
2297
|
-
|
|
2297
|
+
forwardAttachment(ref, event, immediate = false) {
|
|
2298
|
+
if (!immediate) {
|
|
2299
|
+
this.enqueue(ref, ref, {
|
|
2300
|
+
type: createActor.XSTATE_ATTACHED_FORWARD,
|
|
2301
|
+
event
|
|
2302
|
+
});
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
this.process({
|
|
2306
|
+
source: ref,
|
|
2307
|
+
target: ref,
|
|
2308
|
+
event: this.encode({
|
|
2309
|
+
type: createActor.XSTATE_ATTACHED_FORWARD,
|
|
2310
|
+
event
|
|
2311
|
+
}),
|
|
2312
|
+
sequence: this.snapshot.counters.sequence++
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
relayAttachments(source, emitted, immediate = false) {
|
|
2298
2316
|
for (const actor of Object.values(this.snapshot.actors)) {
|
|
2299
2317
|
const kind = this.attachedKind(actor);
|
|
2300
2318
|
if (!actor.started || actor.snapshot.status !== 'active' || kind !== '@xstate.listener' && kind !== '@xstate.subscription') continue;
|
|
@@ -2309,10 +2327,10 @@ class SystemReduction {
|
|
|
2309
2327
|
const mapper = input.mappers[snapshot.status === 'active' ? 'snapshot' : snapshot.status === 'done' ? 'done' : snapshot.status === 'error' ? 'error' : ''];
|
|
2310
2328
|
if (mapper) event = mapper(snapshot.status === 'done' ? snapshot.output : snapshot.status === 'error' ? snapshot.error : snapshot);
|
|
2311
2329
|
}
|
|
2312
|
-
if (event) this.
|
|
2330
|
+
if (event) this.forwardAttachment({
|
|
2313
2331
|
'@actor': actor.address,
|
|
2314
2332
|
incarnation: actor.incarnation
|
|
2315
|
-
},
|
|
2333
|
+
}, event, immediate);
|
|
2316
2334
|
}
|
|
2317
2335
|
}
|
|
2318
2336
|
stopAttachments(parent) {
|
|
@@ -2648,7 +2666,7 @@ class SystemReduction {
|
|
|
2648
2666
|
// Live subscriptions immediately report already-published errors;
|
|
2649
2667
|
// active/done snapshots are observed when their actor publishes them.
|
|
2650
2668
|
if (observed?.started && observed.snapshot.status === 'error' && input.mappers.error && actor.parent) {
|
|
2651
|
-
this.
|
|
2669
|
+
this.forwardAttachment(ref, input.mappers.error(this.hydrate(target).error));
|
|
2652
2670
|
}
|
|
2653
2671
|
}
|
|
2654
2672
|
if (this.current(ref)?.snapshot.status === 'active') this.relayAttachments(ref);
|
|
@@ -2700,7 +2718,7 @@ class SystemReduction {
|
|
|
2700
2718
|
const actor = this.current(ref);
|
|
2701
2719
|
if (!actor) return;
|
|
2702
2720
|
// Publish terminal observations before cleanup and the native parent event.
|
|
2703
|
-
this.relayAttachments(ref);
|
|
2721
|
+
this.relayAttachments(ref, undefined, true);
|
|
2704
2722
|
this.cancel(ref);
|
|
2705
2723
|
this.cancelExternal(ref);
|
|
2706
2724
|
this.stopAttachments(ref);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createAsyncLogic, TimeoutError } from './xstate-actors.development.esm.js';
|
|
2
2
|
export { TimeoutError, createAsyncLogic, createCallbackLogic, createEmptyActor, createEventObservableLogic, createObservableLogic, createStepLogic } from './xstate-actors.development.esm.js';
|
|
3
|
-
import { m as matchesEventDescriptor, t as toArray, d as diagnoseAuthorConfig, p as parseDelayToMilliseconds, a as assertUnreservedSourceName, i as isAtomicStateNode, P as ProcessingStatus, g as getAllStateNodes, b as getStateNodes, r as resolveInvokedActorLogic, c as isActorRefLike, e as createMachineSnapshot, f as diagnoseSetupConfig, h as createActor, j as encodeAddressSegment, s as systemLogicMetadata, k as getActorIdPrefix, l as finalizeTransitionResult, n as getTimerKey, o as isSerializedActorRef, q as readTimerKey,
|
|
4
|
-
export {
|
|
5
|
-
import { S as StateMachine, h as historicalEventSchema, s as snapshotSchema, u as upgradeLegacySystemSnapshot } from './legacySnapshot-
|
|
6
|
-
export { I as InvalidSnapshotError, S as StateMachine, a as StateNode, e as eventSchema } from './legacySnapshot-
|
|
3
|
+
import { m as matchesEventDescriptor, t as toArray, d as diagnoseAuthorConfig, p as parseDelayToMilliseconds, a as assertUnreservedSourceName, i as isAtomicStateNode, P as ProcessingStatus, g as getAllStateNodes, b as getStateNodes, r as resolveInvokedActorLogic, c as isActorRefLike, e as createMachineSnapshot, f as diagnoseSetupConfig, h as createActor, j as encodeAddressSegment, s as systemLogicMetadata, X as XSTATE_ATTACHED_FORWARD, k as getActorIdPrefix, l as finalizeTransitionResult, n as getTimerKey, o as isSerializedActorRef, q as readTimerKey, u as XSTATE_STOP_EFFECT, v as XSTATE_STOP, w as createDoneActorEvent, x as createErrorActorEvent, y as serializeTimerKey, z as matchesTimerKey, A as isMachineSnapshot, B as listenerLogic, C as subscriptionLogic } from './createActor-a085b20b.development.esm.js';
|
|
4
|
+
export { F as Actor, I as InfiniteTransitionError, p as _parseDelayToMilliseconds, H as _toObserver, h as createActor, D as createListenerLogic, E as createSubscriptionLogic, L as deliverEvent, J as executeEffects, b as getStateNodes, K as isBuiltInExecutableEffect, A as isMachineSnapshot, G as matchesState, M as runStep, N as stopActor, O as terminateActor } from './createActor-a085b20b.development.esm.js';
|
|
5
|
+
import { S as StateMachine, h as historicalEventSchema, s as snapshotSchema, u as upgradeLegacySystemSnapshot } from './legacySnapshot-11aba2d2.development.esm.js';
|
|
6
|
+
export { I as InvalidSnapshotError, S as StateMachine, a as StateNode, e as eventSchema } from './legacySnapshot-11aba2d2.development.esm.js';
|
|
7
7
|
export { i as isTypeSchema, t as types } from './schema.types-1cd4652e.development.esm.js';
|
|
8
|
-
export { d as describeExecutableEffect, b as getInitialMicrosteps, g as getMicrosteps, c as getNextTransitions, a as initialTransition, i as isUnhandled, t as transition } from './effectDescriptor-
|
|
8
|
+
export { d as describeExecutableEffect, b as getInitialMicrosteps, g as getMicrosteps, c as getNextTransitions, a as initialTransition, i as isUnhandled, t as transition } from './effectDescriptor-65821048.development.esm.js';
|
|
9
9
|
import './validation-e69470ad.development.esm.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -2293,7 +2293,25 @@ class SystemReduction {
|
|
|
2293
2293
|
attachedKind(actor) {
|
|
2294
2294
|
return this.logic.get(actor.src)?.[systemLogicMetadata]?.kind;
|
|
2295
2295
|
}
|
|
2296
|
-
|
|
2296
|
+
forwardAttachment(ref, event, immediate = false) {
|
|
2297
|
+
if (!immediate) {
|
|
2298
|
+
this.enqueue(ref, ref, {
|
|
2299
|
+
type: XSTATE_ATTACHED_FORWARD,
|
|
2300
|
+
event
|
|
2301
|
+
});
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
this.process({
|
|
2305
|
+
source: ref,
|
|
2306
|
+
target: ref,
|
|
2307
|
+
event: this.encode({
|
|
2308
|
+
type: XSTATE_ATTACHED_FORWARD,
|
|
2309
|
+
event
|
|
2310
|
+
}),
|
|
2311
|
+
sequence: this.snapshot.counters.sequence++
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
relayAttachments(source, emitted, immediate = false) {
|
|
2297
2315
|
for (const actor of Object.values(this.snapshot.actors)) {
|
|
2298
2316
|
const kind = this.attachedKind(actor);
|
|
2299
2317
|
if (!actor.started || actor.snapshot.status !== 'active' || kind !== '@xstate.listener' && kind !== '@xstate.subscription') continue;
|
|
@@ -2308,10 +2326,10 @@ class SystemReduction {
|
|
|
2308
2326
|
const mapper = input.mappers[snapshot.status === 'active' ? 'snapshot' : snapshot.status === 'done' ? 'done' : snapshot.status === 'error' ? 'error' : ''];
|
|
2309
2327
|
if (mapper) event = mapper(snapshot.status === 'done' ? snapshot.output : snapshot.status === 'error' ? snapshot.error : snapshot);
|
|
2310
2328
|
}
|
|
2311
|
-
if (event) this.
|
|
2329
|
+
if (event) this.forwardAttachment({
|
|
2312
2330
|
'@actor': actor.address,
|
|
2313
2331
|
incarnation: actor.incarnation
|
|
2314
|
-
},
|
|
2332
|
+
}, event, immediate);
|
|
2315
2333
|
}
|
|
2316
2334
|
}
|
|
2317
2335
|
stopAttachments(parent) {
|
|
@@ -2647,7 +2665,7 @@ class SystemReduction {
|
|
|
2647
2665
|
// Live subscriptions immediately report already-published errors;
|
|
2648
2666
|
// active/done snapshots are observed when their actor publishes them.
|
|
2649
2667
|
if (observed?.started && observed.snapshot.status === 'error' && input.mappers.error && actor.parent) {
|
|
2650
|
-
this.
|
|
2668
|
+
this.forwardAttachment(ref, input.mappers.error(this.hydrate(target).error));
|
|
2651
2669
|
}
|
|
2652
2670
|
}
|
|
2653
2671
|
if (this.current(ref)?.snapshot.status === 'active') this.relayAttachments(ref);
|
|
@@ -2699,7 +2717,7 @@ class SystemReduction {
|
|
|
2699
2717
|
const actor = this.current(ref);
|
|
2700
2718
|
if (!actor) return;
|
|
2701
2719
|
// Publish terminal observations before cleanup and the native parent event.
|
|
2702
|
-
this.relayAttachments(ref);
|
|
2720
|
+
this.relayAttachments(ref, undefined, true);
|
|
2703
2721
|
this.cancel(ref);
|
|
2704
2722
|
this.cancelExternal(ref);
|
|
2705
2723
|
this.stopAttachments(ref);
|
package/dist/xstate.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createAsyncLogic, TimeoutError } from './xstate-actors.esm.js';
|
|
2
2
|
export { TimeoutError, createAsyncLogic, createCallbackLogic, createEmptyActor, createEventObservableLogic, createObservableLogic, createStepLogic } from './xstate-actors.esm.js';
|
|
3
|
-
import { m as matchesEventDescriptor, x as xstateError, t as toArray, d as diagnoseAuthorConfig, p as parseDelayToMilliseconds, a as assertUnreservedSourceName, i as isAtomicStateNode, P as ProcessingStatus, g as getAllStateNodes, b as getStateNodes, r as resolveInvokedActorLogic, c as isActorRefLike, e as createMachineSnapshot, f as diagnoseSetupConfig, h as createActor, j as encodeAddressSegment, s as systemLogicMetadata, k as getActorIdPrefix, l as finalizeTransitionResult, n as getTimerKey, o as isSerializedActorRef, q as readTimerKey,
|
|
4
|
-
export {
|
|
5
|
-
import { S as StateMachine, h as historicalEventSchema, s as snapshotSchema, u as upgradeLegacySystemSnapshot } from './legacySnapshot-
|
|
6
|
-
export { I as InvalidSnapshotError, S as StateMachine, a as StateNode, e as eventSchema } from './legacySnapshot-
|
|
3
|
+
import { m as matchesEventDescriptor, x as xstateError, t as toArray, d as diagnoseAuthorConfig, p as parseDelayToMilliseconds, a as assertUnreservedSourceName, i as isAtomicStateNode, P as ProcessingStatus, g as getAllStateNodes, b as getStateNodes, r as resolveInvokedActorLogic, c as isActorRefLike, e as createMachineSnapshot, f as diagnoseSetupConfig, h as createActor, j as encodeAddressSegment, s as systemLogicMetadata, X as XSTATE_ATTACHED_FORWARD, k as getActorIdPrefix, l as finalizeTransitionResult, n as getTimerKey, o as isSerializedActorRef, q as readTimerKey, u as XSTATE_STOP_EFFECT, v as XSTATE_STOP, w as createDoneActorEvent, y as createErrorActorEvent, z as serializeTimerKey, A as matchesTimerKey, B as isMachineSnapshot, C as listenerLogic, D as subscriptionLogic } from './createActor-49ea55ba.esm.js';
|
|
4
|
+
export { G as Actor, I as InfiniteTransitionError, p as _parseDelayToMilliseconds, J as _toObserver, h as createActor, E as createListenerLogic, F as createSubscriptionLogic, M as deliverEvent, K as executeEffects, b as getStateNodes, L as isBuiltInExecutableEffect, B as isMachineSnapshot, H as matchesState, N as runStep, O as stopActor, Q as terminateActor } from './createActor-49ea55ba.esm.js';
|
|
5
|
+
import { S as StateMachine, h as historicalEventSchema, s as snapshotSchema, u as upgradeLegacySystemSnapshot } from './legacySnapshot-fffe81a0.esm.js';
|
|
6
|
+
export { I as InvalidSnapshotError, S as StateMachine, a as StateNode, e as eventSchema } from './legacySnapshot-fffe81a0.esm.js';
|
|
7
7
|
export { i as isTypeSchema, t as types } from './schema.types-0ecd17b8.esm.js';
|
|
8
|
-
export { d as describeExecutableEffect, b as getInitialMicrosteps, g as getMicrosteps, c as getNextTransitions, a as initialTransition, i as isUnhandled, t as transition } from './effectDescriptor-
|
|
8
|
+
export { d as describeExecutableEffect, b as getInitialMicrosteps, g as getMicrosteps, c as getNextTransitions, a as initialTransition, i as isUnhandled, t as transition } from './effectDescriptor-72c62058.esm.js';
|
|
9
9
|
import './validation-05f1d517.esm.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -2293,7 +2293,25 @@ class SystemReduction {
|
|
|
2293
2293
|
attachedKind(actor) {
|
|
2294
2294
|
return this.logic.get(actor.src)?.[systemLogicMetadata]?.kind;
|
|
2295
2295
|
}
|
|
2296
|
-
|
|
2296
|
+
forwardAttachment(ref, event, immediate = false) {
|
|
2297
|
+
if (!immediate) {
|
|
2298
|
+
this.enqueue(ref, ref, {
|
|
2299
|
+
type: XSTATE_ATTACHED_FORWARD,
|
|
2300
|
+
event
|
|
2301
|
+
});
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
this.process({
|
|
2305
|
+
source: ref,
|
|
2306
|
+
target: ref,
|
|
2307
|
+
event: this.encode({
|
|
2308
|
+
type: XSTATE_ATTACHED_FORWARD,
|
|
2309
|
+
event
|
|
2310
|
+
}),
|
|
2311
|
+
sequence: this.snapshot.counters.sequence++
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
relayAttachments(source, emitted, immediate = false) {
|
|
2297
2315
|
for (const actor of Object.values(this.snapshot.actors)) {
|
|
2298
2316
|
const kind = this.attachedKind(actor);
|
|
2299
2317
|
if (!actor.started || actor.snapshot.status !== 'active' || kind !== '@xstate.listener' && kind !== '@xstate.subscription') continue;
|
|
@@ -2308,10 +2326,10 @@ class SystemReduction {
|
|
|
2308
2326
|
const mapper = input.mappers[snapshot.status === 'active' ? 'snapshot' : snapshot.status === 'done' ? 'done' : snapshot.status === 'error' ? 'error' : ''];
|
|
2309
2327
|
if (mapper) event = mapper(snapshot.status === 'done' ? snapshot.output : snapshot.status === 'error' ? snapshot.error : snapshot);
|
|
2310
2328
|
}
|
|
2311
|
-
if (event) this.
|
|
2329
|
+
if (event) this.forwardAttachment({
|
|
2312
2330
|
'@actor': actor.address,
|
|
2313
2331
|
incarnation: actor.incarnation
|
|
2314
|
-
},
|
|
2332
|
+
}, event, immediate);
|
|
2315
2333
|
}
|
|
2316
2334
|
}
|
|
2317
2335
|
stopAttachments(parent) {
|
|
@@ -2647,7 +2665,7 @@ class SystemReduction {
|
|
|
2647
2665
|
// Live subscriptions immediately report already-published errors;
|
|
2648
2666
|
// active/done snapshots are observed when their actor publishes them.
|
|
2649
2667
|
if (observed?.started && observed.snapshot.status === 'error' && input.mappers.error && actor.parent) {
|
|
2650
|
-
this.
|
|
2668
|
+
this.forwardAttachment(ref, input.mappers.error(this.hydrate(target).error));
|
|
2651
2669
|
}
|
|
2652
2670
|
}
|
|
2653
2671
|
if (this.current(ref)?.snapshot.status === 'active') this.relayAttachments(ref);
|
|
@@ -2699,7 +2717,7 @@ class SystemReduction {
|
|
|
2699
2717
|
const actor = this.current(ref);
|
|
2700
2718
|
if (!actor) return;
|
|
2701
2719
|
// Publish terminal observations before cleanup and the native parent event.
|
|
2702
|
-
this.relayAttachments(ref);
|
|
2720
|
+
this.relayAttachments(ref, undefined, true);
|
|
2703
2721
|
this.cancel(ref);
|
|
2704
2722
|
this.cancelExternal(ref);
|
|
2705
2723
|
this.stopAttachments(ref);
|