xstate 6.0.0-alpha.44 → 6.0.0-alpha.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{StateMachine-fcc48e11.cjs.js → StateMachine-756e1335.cjs.js} +3 -3
- package/dist/{StateMachine-b13b4b09.esm.js → StateMachine-9509c0bd.esm.js} +3 -3
- package/dist/{StateMachine-1ea29688.development.esm.js → StateMachine-a5ede014.development.esm.js} +3 -3
- package/dist/{StateMachine-16d7ee93.development.cjs.js → StateMachine-fa133051.development.cjs.js} +3 -3
- package/dist/{createActor-9538c7f8.cjs.js → createActor-0816a84b.cjs.js} +110 -23
- package/dist/{createActor-973c72ad.esm.js → createActor-9523f716.esm.js} +108 -24
- package/dist/{createActor-f9cc6590.development.esm.js → createActor-f5277b31.development.esm.js} +105 -24
- package/dist/{createActor-1a3a1d14.development.cjs.js → createActor-f6e6146f.development.cjs.js} +107 -23
- package/dist/declarations/src/createActor.d.ts +0 -1
- package/dist/declarations/src/createMachine.d.ts +3 -3
- package/dist/declarations/src/durable/index.d.ts +51 -16
- package/dist/declarations/src/inspectionAmbient.d.ts +1 -0
- package/dist/declarations/src/setup.d.ts +17 -3
- package/dist/declarations/src/system.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +23 -13
- package/dist/declarations/src/types.v6.d.ts +14 -0
- package/dist/{effectDescriptor-7d6f945a.development.cjs.js → effectDescriptor-3a016bbe.cjs.js} +19 -1
- package/dist/{effectDescriptor-416ca00a.esm.js → effectDescriptor-87826c41.esm.js} +19 -1
- package/dist/{effectDescriptor-f8c9337f.cjs.js → effectDescriptor-8a5d62e0.development.cjs.js} +19 -1
- package/dist/{effectDescriptor-e6730c9a.development.esm.js → effectDescriptor-9a14147f.development.esm.js} +19 -1
- package/dist/{index-e0ba4813.development.cjs.js → index-1e1e1cba.development.cjs.js} +1 -1
- package/dist/{index-f284cc7b.development.esm.js → index-3907b7aa.development.esm.js} +1 -1
- package/dist/{index-ba7170ba.cjs.js → index-7b9c4f77.cjs.js} +1 -1
- package/dist/{index-b478f443.esm.js → index-c7431a16.esm.js} +1 -1
- package/dist/xstate-actors.cjs.js +2 -2
- package/dist/xstate-actors.development.cjs.js +2 -2
- package/dist/xstate-actors.development.esm.js +2 -2
- package/dist/xstate-actors.esm.js +2 -2
- package/dist/xstate-actors.umd.min.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-durable.cjs.js +80 -20
- package/dist/xstate-durable.development.cjs.js +80 -20
- package/dist/xstate-durable.development.esm.js +80 -20
- package/dist/xstate-durable.esm.js +80 -20
- package/dist/xstate-durable.umd.min.js +1 -1
- package/dist/xstate-durable.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +3 -3
- package/dist/xstate-graph.development.cjs.js +3 -3
- package/dist/xstate-graph.development.esm.js +3 -3
- package/dist/xstate-graph.esm.js +3 -3
- package/dist/xstate-graph.umd.min.js +1 -1
- package/dist/xstate-graph.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 +16 -4
- package/dist/xstate.development.cjs.js +16 -4
- package/dist/xstate.development.esm.js +18 -6
- package/dist/xstate.esm.js +18 -6
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/{createActor-f9cc6590.development.esm.js → createActor-f5277b31.development.esm.js}
RENAMED
|
@@ -218,6 +218,27 @@ const builtInActions = {
|
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
|
|
221
|
+
const sourceKeyCaches = new WeakMap();
|
|
222
|
+
|
|
223
|
+
/** @internal */
|
|
224
|
+
function resolveRegisteredActorSource(actors, logic) {
|
|
225
|
+
let cache = sourceKeyCaches.get(actors);
|
|
226
|
+
if (!cache) {
|
|
227
|
+
cache = new Map();
|
|
228
|
+
for (const key of Object.keys(actors)) {
|
|
229
|
+
const registeredLogic = actors[key];
|
|
230
|
+
// Several source keys may intentionally share one implementation. The
|
|
231
|
+
// first key is its canonical persistence identity when spawning by the
|
|
232
|
+
// raw logic value, which cannot retain which alias was used to access it.
|
|
233
|
+
if (!cache.has(registeredLogic)) {
|
|
234
|
+
cache.set(registeredLogic, key);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
sourceKeyCaches.set(actors, cache);
|
|
238
|
+
}
|
|
239
|
+
return cache.get(logic);
|
|
240
|
+
}
|
|
241
|
+
|
|
221
242
|
const subscriptions = /* #__PURE__ */new WeakMap();
|
|
222
243
|
|
|
223
244
|
/**
|
|
@@ -665,21 +686,31 @@ function beginSpawnAllocation(actorScope) {
|
|
|
665
686
|
function getWorkingSnapshotOf(actorScope) {
|
|
666
687
|
return actorScope.self._snapshot;
|
|
667
688
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
for (const key of Object.keys(registeredActors)) {
|
|
678
|
-
cache.set(registeredActors[key], key);
|
|
689
|
+
function getRegisteredActors(actorScope) {
|
|
690
|
+
return actorScope.self.logic?.sources?.actors;
|
|
691
|
+
}
|
|
692
|
+
function resolveTransitionSpawnSource(actorScope, source) {
|
|
693
|
+
const registeredActors = getRegisteredActors(actorScope);
|
|
694
|
+
if (typeof source === 'string') {
|
|
695
|
+
const logic = registeredActors?.[source];
|
|
696
|
+
if (!logic) {
|
|
697
|
+
throw new Error(`Actor source '${source}' is not provided`);
|
|
679
698
|
}
|
|
680
|
-
|
|
699
|
+
return {
|
|
700
|
+
logic,
|
|
701
|
+
src: source
|
|
702
|
+
};
|
|
681
703
|
}
|
|
682
|
-
|
|
704
|
+
if (!registeredActors) {
|
|
705
|
+
return {
|
|
706
|
+
logic: source,
|
|
707
|
+
src: undefined
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
return {
|
|
711
|
+
logic: source,
|
|
712
|
+
src: resolveRegisteredActorSource(registeredActors, source)
|
|
713
|
+
};
|
|
683
714
|
}
|
|
684
715
|
|
|
685
716
|
/**
|
|
@@ -827,17 +858,17 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
|
|
|
827
858
|
internalEvents.push(raisedEvent);
|
|
828
859
|
}
|
|
829
860
|
},
|
|
830
|
-
spawn: (
|
|
861
|
+
spawn: (source, options) => {
|
|
862
|
+
const {
|
|
863
|
+
logic,
|
|
864
|
+
src
|
|
865
|
+
} = resolveTransitionSpawnSource(actorScope, source);
|
|
831
866
|
if (!createActors) {
|
|
832
867
|
// TODO: replace this speculative placeholder with a typed inert actor ref.
|
|
833
868
|
return {
|
|
834
|
-
id: options?.id ?? options?.registryKey ?? logic.id
|
|
869
|
+
id: options?.id ?? options?.registryKey ?? src ?? logic.id
|
|
835
870
|
};
|
|
836
871
|
}
|
|
837
|
-
// Recover the registered source key for setup-provided logic so the
|
|
838
|
-
// spawned child persists (and gets a deterministic id prefix) by key
|
|
839
|
-
// instead of by inline logic reference.
|
|
840
|
-
const src = getRegisteredSrcKey(actorScope, logic);
|
|
841
872
|
// Generated ids allocate from the parent snapshot's own counters
|
|
842
873
|
// through the transition's allocation transaction; explicit
|
|
843
874
|
// generated-shaped ids reserve their numbering the same way.
|
|
@@ -1272,6 +1303,45 @@ function parseDelayToMilliseconds(delay) {
|
|
|
1272
1303
|
return parseDurationToMilliseconds(delay);
|
|
1273
1304
|
}
|
|
1274
1305
|
|
|
1306
|
+
/**
|
|
1307
|
+
* The ambiently installed system inspector. Set for the duration of a durable
|
|
1308
|
+
* execution's transitions (`createDurable(..., { inspect })`), it makes the
|
|
1309
|
+
* pure-transition machinery observable: freshly constructed runtime systems
|
|
1310
|
+
* attach it, and snapshot systems created while it is set forward inspection
|
|
1311
|
+
* to their base system instead of stubbing it out.
|
|
1312
|
+
*/
|
|
1313
|
+
let ambientInspector;
|
|
1314
|
+
|
|
1315
|
+
/** @internal */
|
|
1316
|
+
function hasAmbientInspector() {
|
|
1317
|
+
return ambientInspector !== undefined;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/** @internal */
|
|
1321
|
+
function getAmbientInspector() {
|
|
1322
|
+
return ambientInspector;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* Runs `fn` with systems it creates wired to `inspect` from construction, so
|
|
1327
|
+
* creation-time inspection events (the root actor's own registration, actors
|
|
1328
|
+
* spawned during the first transition) are observed too.
|
|
1329
|
+
*
|
|
1330
|
+
* @internal
|
|
1331
|
+
*/
|
|
1332
|
+
function withSystemInspector(inspect, fn) {
|
|
1333
|
+
if (!inspect) {
|
|
1334
|
+
return fn();
|
|
1335
|
+
}
|
|
1336
|
+
const previous = ambientInspector;
|
|
1337
|
+
ambientInspector = inspect;
|
|
1338
|
+
try {
|
|
1339
|
+
return fn();
|
|
1340
|
+
} finally {
|
|
1341
|
+
ambientInspector = previous;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1275
1345
|
/** Snapshot-scoped actor identity and system view. @internal */
|
|
1276
1346
|
|
|
1277
1347
|
const snapshotActorRefs = new WeakMap();
|
|
@@ -1334,6 +1404,7 @@ function getSnapshotChildren(snapshot) {
|
|
|
1334
1404
|
* @internal
|
|
1335
1405
|
*/
|
|
1336
1406
|
function createSnapshotSystem(baseSystem, children, baseState) {
|
|
1407
|
+
const forwardInspection = hasAmbientInspector();
|
|
1337
1408
|
const registeredActors = copyRegisteredActors(baseSystem, baseState);
|
|
1338
1409
|
const keyedActors = new Map(baseState?.keyedActors ?? getKeyedActors(baseSystem));
|
|
1339
1410
|
const reverseKeyedActors = new WeakMap();
|
|
@@ -1372,10 +1443,13 @@ function createSnapshotSystem(baseSystem, children, baseState) {
|
|
|
1372
1443
|
},
|
|
1373
1444
|
get: registryKey => keyedActors.get(registryKey),
|
|
1374
1445
|
getAll: () => Object.fromEntries(keyedActors),
|
|
1375
|
-
// Pure transition resolution must not leak topology inspection events
|
|
1376
|
-
// a live runtime system.
|
|
1377
|
-
|
|
1378
|
-
|
|
1446
|
+
// Pure transition resolution must not leak topology inspection events
|
|
1447
|
+
// into a live runtime system — planning branches stay silent. The one
|
|
1448
|
+
// exception is a durable execution's own transitions (marked by the
|
|
1449
|
+
// ambient inspector at creation time): there the pure path IS the
|
|
1450
|
+
// execution, so inspection forwards to the base system's observers.
|
|
1451
|
+
_hasInspectionObservers: forwardInspection ? () => baseSystem._hasInspectionObservers?.() ?? false : () => false,
|
|
1452
|
+
_sendInspectionEvent: forwardInspection ? event => baseSystem._sendInspectionEvent(event) : () => {}
|
|
1379
1453
|
});
|
|
1380
1454
|
for (const [registryKey, actor] of keyedActors) {
|
|
1381
1455
|
if (!actor) {
|
|
@@ -4403,6 +4477,10 @@ class RuntimeSystem {
|
|
|
4403
4477
|
this._clock = options.clock;
|
|
4404
4478
|
this._logger = options.logger;
|
|
4405
4479
|
this.createActorRef = options.createActorRef;
|
|
4480
|
+
const ambientInspector = getAmbientInspector();
|
|
4481
|
+
if (ambientInspector) {
|
|
4482
|
+
this.inspect(ambientInspector);
|
|
4483
|
+
}
|
|
4406
4484
|
this._snapshot = {
|
|
4407
4485
|
_scheduledTimers: restoredSnapshot?.scheduler ?? emptyScheduledTimers,
|
|
4408
4486
|
// System-level counters are process-local backstops; per-actor
|
|
@@ -5106,6 +5184,9 @@ class Actor {
|
|
|
5106
5184
|
}
|
|
5107
5185
|
this._inspectTransition(this._snapshot, event);
|
|
5108
5186
|
}
|
|
5187
|
+
|
|
5188
|
+
/** @internal Emits the transition inspection event; used by the pure
|
|
5189
|
+
* `transition()` path for snapshots driven outside a live actor. */
|
|
5109
5190
|
_inspectTransition(snapshot, event) {
|
|
5110
5191
|
if (this.system._hasInspectionObservers?.() ?? true) {
|
|
5111
5192
|
this.system._sendInspectionEvent({
|
|
@@ -5654,4 +5735,4 @@ function createActor(logic, options) {
|
|
|
5654
5735
|
return new Actor(logic, options);
|
|
5655
5736
|
}
|
|
5656
5737
|
|
|
5657
|
-
export {
|
|
5738
|
+
export { evaluateCandidate as $, Actor as A, checkStateIn as B, pathToStateValue as C, toObserver as D, executeEffects as E, isBuiltInExecutableAction as F, deliverEvent as G, runStep as H, stopActor as I, terminateActor as J, createInitEvent as K, createCustomEffect as L, XSTATE_LOGIC_EFFECT_START as M, XSTATE_LOGIC_EFFECT_RESOLVE as N, XSTATE_LOGIC_EFFECT_REJECT as O, createEmitEffect as P, resolveRegisteredActorSource as Q, allocateChildId as R, assertChildIdFree as S, reserveChildId as T, STATE_DELIMITER as U, mapValues as V, createInvokeId as W, XSTATE_INIT as X, getDelayedTransitions as Y, getEventDescriptorKey as Z, getCandidates as _, beginSpawnAllocation as a, formatTransition as a0, NULL_EVENT as a1, toTransitionConfigArray as a2, createInvokeTimeoutEventId as a3, matchesActorSession as a4, formatRouteTransitions as a5, resolveStateValue as a6, getAllStateNodes as a7, createMachineSnapshot as a8, isInFinalState as a9, getProperAncestors as aA, isRemoteActorRef as aB, getActorIdPrefix as aC, getAllOwnEvents as aD, matchesEvent as aE, encodeAddressSegment as aF, getRootActorId as aG, RUNTIME_OPERATIONS as aH, withSystemInspector as aI, getSnapshotActorRef as aJ, withExecutionIdentity as aK, createInertActorScope as aa, setInertActorScopeSnapshot as ab, attachSnapshotActorRef as ac, macrostep as ad, isInertActorScope as ae, setSnapshotActorRef as af, cloneMachineSnapshot as ag, transitionNode as ah, getTransitionResult as ai, hasEffect as aj, createErrorPlatformEvent as ak, withActorSelf as al, takeSpawnAllocationCounters as am, mergeActorIdCounters as an, createSpawnEffect as ao, initialMicrostep as ap, toStatePath as aq, isStateId as ar, getStateNodeByPath as as, getPersistedSnapshot as at, createRemoteActorRef as au, resolveReferencedActor as av, createInvokeTimeoutEvent as aw, parseGeneratedActorId as ax, ACTOR_REF_TYPE as ay, hasAmbientInspector as az, builtInActions as b, createTransitionEnqueue as c, deriveDeferredStarts as d, XSTATE_STOP as e, finalizeTransitionResult as f, XSTATE_TIMER as g, createSendToEffect as h, isLazyActorScope as i, isAtomicStateNode as j, createActor as k, createListenerLogic as l, matchesEventDescriptor as m, createSubscriptionLogic as n, listenerLogic as o, parseDelayToMilliseconds as p, getInitialSnapshot as q, resolveActionsWithContext as r, subscriptionLogic as s, toArray as t, getNextSnapshot as u, isMachineSnapshot as v, withActorScope as w, getStateNodes as x, getAllOwnEventDescriptors as y, matchesState as z };
|
package/dist/{createActor-1a3a1d14.development.cjs.js → createActor-f6e6146f.development.cjs.js}
RENAMED
|
@@ -220,6 +220,27 @@ const builtInActions = {
|
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
|
|
223
|
+
const sourceKeyCaches = new WeakMap();
|
|
224
|
+
|
|
225
|
+
/** @internal */
|
|
226
|
+
function resolveRegisteredActorSource(actors, logic) {
|
|
227
|
+
let cache = sourceKeyCaches.get(actors);
|
|
228
|
+
if (!cache) {
|
|
229
|
+
cache = new Map();
|
|
230
|
+
for (const key of Object.keys(actors)) {
|
|
231
|
+
const registeredLogic = actors[key];
|
|
232
|
+
// Several source keys may intentionally share one implementation. The
|
|
233
|
+
// first key is its canonical persistence identity when spawning by the
|
|
234
|
+
// raw logic value, which cannot retain which alias was used to access it.
|
|
235
|
+
if (!cache.has(registeredLogic)) {
|
|
236
|
+
cache.set(registeredLogic, key);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
sourceKeyCaches.set(actors, cache);
|
|
240
|
+
}
|
|
241
|
+
return cache.get(logic);
|
|
242
|
+
}
|
|
243
|
+
|
|
223
244
|
const subscriptions = /* #__PURE__ */new WeakMap();
|
|
224
245
|
|
|
225
246
|
/**
|
|
@@ -667,21 +688,31 @@ function beginSpawnAllocation(actorScope) {
|
|
|
667
688
|
function getWorkingSnapshotOf(actorScope) {
|
|
668
689
|
return actorScope.self._snapshot;
|
|
669
690
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
for (const key of Object.keys(registeredActors)) {
|
|
680
|
-
cache.set(registeredActors[key], key);
|
|
691
|
+
function getRegisteredActors(actorScope) {
|
|
692
|
+
return actorScope.self.logic?.sources?.actors;
|
|
693
|
+
}
|
|
694
|
+
function resolveTransitionSpawnSource(actorScope, source) {
|
|
695
|
+
const registeredActors = getRegisteredActors(actorScope);
|
|
696
|
+
if (typeof source === 'string') {
|
|
697
|
+
const logic = registeredActors?.[source];
|
|
698
|
+
if (!logic) {
|
|
699
|
+
throw new Error(`Actor source '${source}' is not provided`);
|
|
681
700
|
}
|
|
682
|
-
|
|
701
|
+
return {
|
|
702
|
+
logic,
|
|
703
|
+
src: source
|
|
704
|
+
};
|
|
683
705
|
}
|
|
684
|
-
|
|
706
|
+
if (!registeredActors) {
|
|
707
|
+
return {
|
|
708
|
+
logic: source,
|
|
709
|
+
src: undefined
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
return {
|
|
713
|
+
logic: source,
|
|
714
|
+
src: resolveRegisteredActorSource(registeredActors, source)
|
|
715
|
+
};
|
|
685
716
|
}
|
|
686
717
|
|
|
687
718
|
/**
|
|
@@ -829,17 +860,17 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
|
|
|
829
860
|
internalEvents.push(raisedEvent);
|
|
830
861
|
}
|
|
831
862
|
},
|
|
832
|
-
spawn: (
|
|
863
|
+
spawn: (source, options) => {
|
|
864
|
+
const {
|
|
865
|
+
logic,
|
|
866
|
+
src
|
|
867
|
+
} = resolveTransitionSpawnSource(actorScope, source);
|
|
833
868
|
if (!createActors) {
|
|
834
869
|
// TODO: replace this speculative placeholder with a typed inert actor ref.
|
|
835
870
|
return {
|
|
836
|
-
id: options?.id ?? options?.registryKey ?? logic.id
|
|
871
|
+
id: options?.id ?? options?.registryKey ?? src ?? logic.id
|
|
837
872
|
};
|
|
838
873
|
}
|
|
839
|
-
// Recover the registered source key for setup-provided logic so the
|
|
840
|
-
// spawned child persists (and gets a deterministic id prefix) by key
|
|
841
|
-
// instead of by inline logic reference.
|
|
842
|
-
const src = getRegisteredSrcKey(actorScope, logic);
|
|
843
874
|
// Generated ids allocate from the parent snapshot's own counters
|
|
844
875
|
// through the transition's allocation transaction; explicit
|
|
845
876
|
// generated-shaped ids reserve their numbering the same way.
|
|
@@ -1274,6 +1305,45 @@ function parseDelayToMilliseconds(delay) {
|
|
|
1274
1305
|
return parseDurationToMilliseconds(delay);
|
|
1275
1306
|
}
|
|
1276
1307
|
|
|
1308
|
+
/**
|
|
1309
|
+
* The ambiently installed system inspector. Set for the duration of a durable
|
|
1310
|
+
* execution's transitions (`createDurable(..., { inspect })`), it makes the
|
|
1311
|
+
* pure-transition machinery observable: freshly constructed runtime systems
|
|
1312
|
+
* attach it, and snapshot systems created while it is set forward inspection
|
|
1313
|
+
* to their base system instead of stubbing it out.
|
|
1314
|
+
*/
|
|
1315
|
+
let ambientInspector;
|
|
1316
|
+
|
|
1317
|
+
/** @internal */
|
|
1318
|
+
function hasAmbientInspector() {
|
|
1319
|
+
return ambientInspector !== undefined;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/** @internal */
|
|
1323
|
+
function getAmbientInspector() {
|
|
1324
|
+
return ambientInspector;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Runs `fn` with systems it creates wired to `inspect` from construction, so
|
|
1329
|
+
* creation-time inspection events (the root actor's own registration, actors
|
|
1330
|
+
* spawned during the first transition) are observed too.
|
|
1331
|
+
*
|
|
1332
|
+
* @internal
|
|
1333
|
+
*/
|
|
1334
|
+
function withSystemInspector(inspect, fn) {
|
|
1335
|
+
if (!inspect) {
|
|
1336
|
+
return fn();
|
|
1337
|
+
}
|
|
1338
|
+
const previous = ambientInspector;
|
|
1339
|
+
ambientInspector = inspect;
|
|
1340
|
+
try {
|
|
1341
|
+
return fn();
|
|
1342
|
+
} finally {
|
|
1343
|
+
ambientInspector = previous;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1277
1347
|
/** Snapshot-scoped actor identity and system view. @internal */
|
|
1278
1348
|
|
|
1279
1349
|
const snapshotActorRefs = new WeakMap();
|
|
@@ -1336,6 +1406,7 @@ function getSnapshotChildren(snapshot) {
|
|
|
1336
1406
|
* @internal
|
|
1337
1407
|
*/
|
|
1338
1408
|
function createSnapshotSystem(baseSystem, children, baseState) {
|
|
1409
|
+
const forwardInspection = hasAmbientInspector();
|
|
1339
1410
|
const registeredActors = copyRegisteredActors(baseSystem, baseState);
|
|
1340
1411
|
const keyedActors = new Map(baseState?.keyedActors ?? getKeyedActors(baseSystem));
|
|
1341
1412
|
const reverseKeyedActors = new WeakMap();
|
|
@@ -1374,10 +1445,13 @@ function createSnapshotSystem(baseSystem, children, baseState) {
|
|
|
1374
1445
|
},
|
|
1375
1446
|
get: registryKey => keyedActors.get(registryKey),
|
|
1376
1447
|
getAll: () => Object.fromEntries(keyedActors),
|
|
1377
|
-
// Pure transition resolution must not leak topology inspection events
|
|
1378
|
-
// a live runtime system.
|
|
1379
|
-
|
|
1380
|
-
|
|
1448
|
+
// Pure transition resolution must not leak topology inspection events
|
|
1449
|
+
// into a live runtime system — planning branches stay silent. The one
|
|
1450
|
+
// exception is a durable execution's own transitions (marked by the
|
|
1451
|
+
// ambient inspector at creation time): there the pure path IS the
|
|
1452
|
+
// execution, so inspection forwards to the base system's observers.
|
|
1453
|
+
_hasInspectionObservers: forwardInspection ? () => baseSystem._hasInspectionObservers?.() ?? false : () => false,
|
|
1454
|
+
_sendInspectionEvent: forwardInspection ? event => baseSystem._sendInspectionEvent(event) : () => {}
|
|
1381
1455
|
});
|
|
1382
1456
|
for (const [registryKey, actor] of keyedActors) {
|
|
1383
1457
|
if (!actor) {
|
|
@@ -4405,6 +4479,10 @@ class RuntimeSystem {
|
|
|
4405
4479
|
this._clock = options.clock;
|
|
4406
4480
|
this._logger = options.logger;
|
|
4407
4481
|
this.createActorRef = options.createActorRef;
|
|
4482
|
+
const ambientInspector = getAmbientInspector();
|
|
4483
|
+
if (ambientInspector) {
|
|
4484
|
+
this.inspect(ambientInspector);
|
|
4485
|
+
}
|
|
4408
4486
|
this._snapshot = {
|
|
4409
4487
|
_scheduledTimers: restoredSnapshot?.scheduler ?? emptyScheduledTimers,
|
|
4410
4488
|
// System-level counters are process-local backstops; per-actor
|
|
@@ -5108,6 +5186,9 @@ class Actor {
|
|
|
5108
5186
|
}
|
|
5109
5187
|
this._inspectTransition(this._snapshot, event);
|
|
5110
5188
|
}
|
|
5189
|
+
|
|
5190
|
+
/** @internal Emits the transition inspection event; used by the pure
|
|
5191
|
+
* `transition()` path for snapshots driven outside a live actor. */
|
|
5111
5192
|
_inspectTransition(snapshot, event) {
|
|
5112
5193
|
if (this.system._hasInspectionObservers?.() ?? true) {
|
|
5113
5194
|
this.system._sendInspectionEvent({
|
|
@@ -5714,6 +5795,7 @@ exports.getSnapshotActorRef = getSnapshotActorRef;
|
|
|
5714
5795
|
exports.getStateNodeByPath = getStateNodeByPath;
|
|
5715
5796
|
exports.getStateNodes = getStateNodes;
|
|
5716
5797
|
exports.getTransitionResult = getTransitionResult;
|
|
5798
|
+
exports.hasAmbientInspector = hasAmbientInspector;
|
|
5717
5799
|
exports.hasEffect = hasEffect;
|
|
5718
5800
|
exports.initialMicrostep = initialMicrostep;
|
|
5719
5801
|
exports.isAtomicStateNode = isAtomicStateNode;
|
|
@@ -5738,6 +5820,7 @@ exports.pathToStateValue = pathToStateValue;
|
|
|
5738
5820
|
exports.reserveChildId = reserveChildId;
|
|
5739
5821
|
exports.resolveActionsWithContext = resolveActionsWithContext;
|
|
5740
5822
|
exports.resolveReferencedActor = resolveReferencedActor;
|
|
5823
|
+
exports.resolveRegisteredActorSource = resolveRegisteredActorSource;
|
|
5741
5824
|
exports.resolveStateValue = resolveStateValue;
|
|
5742
5825
|
exports.runStep = runStep;
|
|
5743
5826
|
exports.setInertActorScopeSnapshot = setInertActorScopeSnapshot;
|
|
@@ -5754,3 +5837,4 @@ exports.transitionNode = transitionNode;
|
|
|
5754
5837
|
exports.withActorScope = withActorScope;
|
|
5755
5838
|
exports.withActorSelf = withActorSelf;
|
|
5756
5839
|
exports.withExecutionIdentity = withExecutionIdentity;
|
|
5840
|
+
exports.withSystemInspector = withSystemInspector;
|
|
@@ -89,7 +89,6 @@ export declare class Actor<TLogic extends AnyActorLogic> implements ActorInstanc
|
|
|
89
89
|
private _tryHandleExecutionError;
|
|
90
90
|
private _next;
|
|
91
91
|
private update;
|
|
92
|
-
private _inspectTransition;
|
|
93
92
|
private _flushInitialEffects;
|
|
94
93
|
/**
|
|
95
94
|
* Subscribe an observer to an actor’s snapshot values.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "./schema.types.js";
|
|
2
2
|
import { StateMachine } from "./StateMachine.js";
|
|
3
3
|
import { AnyActorRef, EventObject, AnyEventObject, Cast, MachineContext, ProvidedActor, StateValueFromStateSchema, ToChildren, MetaObject, StateSchema, DoNotInfer, RoutableStateId, Compute } from "./types.js";
|
|
4
|
-
import { Sources, DelayMapFromNames, InferChildren, InferOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_StateNodeConfig, ValidateDelayReferences, ValidateHistoryDefaults, ValidateStateTargets, ValidateTopLevelFinalOutputs, WidenLiterals, WithDefault } from "./types.v6.js";
|
|
4
|
+
import { Sources, DelayMapFromNames, InferChildren, InferOutput, SchemaOrConfigOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_StateNodeConfig, ValidateDelayReferences, ValidateHistoryDefaults, ValidateStateTargets, ValidateTopLevelFinalOutputs, WidenLiterals, WithDefault } from "./types.v6.js";
|
|
5
5
|
type MergeChildren<TChildren extends Record<string, AnyActorRef | undefined>, TActor extends ProvidedActor> = [keyof TChildren] extends [never] ? Compute<ToChildren<TActor>> : Compute<TChildren>;
|
|
6
6
|
type MachineIdentity<TConfig> = {
|
|
7
7
|
readonly id: TConfig extends {
|
|
@@ -61,7 +61,7 @@ export declare function createMachine<TContextSchema extends StandardSchemaV1, c
|
|
|
61
61
|
} & ValidateTopLevelFinalOutputs<TSS, InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>>): StateMachine<InferOutput<TContextSchema, MachineContext>, (InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>) | ([RoutableStateId<TSS>] extends [never] ? never : {
|
|
62
62
|
type: 'xstate.route';
|
|
63
63
|
to: RoutableStateId<TSS>;
|
|
64
|
-
}), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput,
|
|
64
|
+
}), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput, SchemaOrConfigOutput<TOutputSchema, TSS>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
|
|
65
65
|
TSS, // TStateSchema
|
|
66
66
|
TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>, InferInternalEvents<TInternalEventSchemaMap>> & {
|
|
67
67
|
states: TSS;
|
|
@@ -79,7 +79,7 @@ export declare function createMachine<TContext extends MachineContext = never, c
|
|
|
79
79
|
} & ValidateTopLevelFinalOutputs<TSS, WidenLiterals<TContext>, InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>>): StateMachine<WidenLiterals<TContext>, (InferEvents<TEventSchemaMap> | InferInternalEvents<TInternalEventSchemaMap>) | ([RoutableStateId<TSS>] extends [never] ? never : {
|
|
80
80
|
type: 'xstate.route';
|
|
81
81
|
to: RoutableStateId<TSS>;
|
|
82
|
-
}), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput,
|
|
82
|
+
}), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput, SchemaOrConfigOutput<TOutputSchema, TSS>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
|
|
83
83
|
TSS, // TStateSchema
|
|
84
84
|
TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>, InferInternalEvents<TInternalEventSchemaMap>> & {
|
|
85
85
|
states: TSS;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type EffectDescriptor } from "../effectDescriptor.js";
|
|
2
2
|
import { type ActorSystemRuntime } from "../system.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { InspectionEvent } from "../inspection.js";
|
|
4
|
+
import type { AnyActor, AnyActorLogic, AnyEventObject, CustomExecutableActionObject, EventFromLogic, ExecutableActionObjectFromLogic, InputFrom, OutputFrom, Snapshot, SnapshotFrom } from "../types.js";
|
|
4
5
|
export interface DurableEffectMetadata {
|
|
5
6
|
/** Stable within one durable execution. */
|
|
6
7
|
id: string;
|
|
@@ -42,10 +43,11 @@ export interface DurableEffect<TEffect> extends DurableEffectMetadata {
|
|
|
42
43
|
* operations keep their default local behavior.
|
|
43
44
|
*
|
|
44
45
|
* Events addressed to this execution's root actor do not reach `sendEvent`
|
|
45
|
-
* during `executeEffects`: the execution captures them and
|
|
46
|
-
*
|
|
47
|
-
* the loop is parked, a root-addressed event reaches
|
|
48
|
-
* other target, so the host enqueues it in its own
|
|
46
|
+
* during `executeEffects`: the execution captures and retains them, and the
|
|
47
|
+
* execution's `waitForEvent()` hands them out before deferring to this
|
|
48
|
+
* adapter. While the loop is parked, a root-addressed event reaches
|
|
49
|
+
* `sendEvent` like any other target, so the host enqueues it in its own
|
|
50
|
+
* mailbox.
|
|
49
51
|
*/
|
|
50
52
|
export interface DurableExecutionAdapter<TLogic extends AnyActorLogic> extends Partial<ActorSystemRuntime> {
|
|
51
53
|
/**
|
|
@@ -62,8 +64,14 @@ export interface DurableExecutionAdapter<TLogic extends AnyActorLogic> extends P
|
|
|
62
64
|
* source, input, event or target data beyond the runtime method arguments.
|
|
63
65
|
*/
|
|
64
66
|
runtime?(metadata: DurableEffectMetadata, effect: ExecutableActionObjectFromLogic<TLogic>): Partial<ActorSystemRuntime>;
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Waits durably for the next event addressed to this execution. Typed to
|
|
69
|
+
* also accept plain event objects: an adapter written against
|
|
70
|
+
* `AnyActorLogic` (a generic host library) cannot produce
|
|
71
|
+
* `EventFromLogic<TLogic>`, and the events a host relays are runtime data
|
|
72
|
+
* anyway — the execution narrows at its own boundary.
|
|
73
|
+
*/
|
|
74
|
+
waitForEvent(metadata: DurableWaitMetadata): EventFromLogic<TLogic> | AnyEventObject | PromiseLike<EventFromLogic<TLogic> | AnyEventObject>;
|
|
67
75
|
/** Index assigned to the first transition. Defaults to `0`. */
|
|
68
76
|
transitionIndex?: number;
|
|
69
77
|
/**
|
|
@@ -83,6 +91,13 @@ export declare class DurableExecutionCancelledError extends Error {
|
|
|
83
91
|
export declare class DurableExecutionResumeError extends Error {
|
|
84
92
|
constructor();
|
|
85
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The snapshot type a durable execution hands back: the logic's own snapshot,
|
|
96
|
+
* intersected with the base `Snapshot` union so the `status`/`output`/`error`
|
|
97
|
+
* discriminant stays visible even when `TLogic` is an unresolved type
|
|
98
|
+
* parameter (a generic host library), where `SnapshotFrom` alone is opaque.
|
|
99
|
+
*/
|
|
100
|
+
export type DurableSnapshot<TLogic extends AnyActorLogic> = SnapshotFrom<TLogic> & Snapshot<OutputFrom<TLogic>>;
|
|
86
101
|
export interface DurableExecution<TLogic extends AnyActorLogic> {
|
|
87
102
|
/**
|
|
88
103
|
* The logical address of this execution's root actor: the logic's own name,
|
|
@@ -101,11 +116,11 @@ export interface DurableExecution<TLogic extends AnyActorLogic> {
|
|
|
101
116
|
/** Index assigned to the next transition. Persist this with checkpoints. */
|
|
102
117
|
readonly nextTransitionIndex: number;
|
|
103
118
|
initialTransition(...[input]: undefined extends InputFrom<TLogic> ? [input?: InputFrom<TLogic>] : [input: InputFrom<TLogic>]): [
|
|
104
|
-
snapshot:
|
|
119
|
+
snapshot: DurableSnapshot<TLogic>,
|
|
105
120
|
effects: DurableEffect<ExecutableActionObjectFromLogic<TLogic>>[]
|
|
106
121
|
];
|
|
107
122
|
transition(snapshot: SnapshotFrom<TLogic>, event: EventFromLogic<TLogic>): [
|
|
108
|
-
snapshot:
|
|
123
|
+
snapshot: DurableSnapshot<TLogic>,
|
|
109
124
|
effects: DurableEffect<ExecutableActionObjectFromLogic<TLogic>>[]
|
|
110
125
|
];
|
|
111
126
|
/**
|
|
@@ -113,8 +128,13 @@ export interface DurableExecution<TLogic extends AnyActorLogic> {
|
|
|
113
128
|
* for addressing and inspection. `undefined` for snapshots this execution
|
|
114
129
|
* has not seen (for example a freshly deserialized checkpoint that has not
|
|
115
130
|
* been passed through `transition()` yet).
|
|
131
|
+
*
|
|
132
|
+
* With an `address`, returns the live actor at that logical address in the
|
|
133
|
+
* snapshot's actor tree instead — the root itself, one of its transitive
|
|
134
|
+
* children, or `undefined` when no live actor has that address (for
|
|
135
|
+
* example a timer firing for an actor that already completed).
|
|
116
136
|
*/
|
|
117
|
-
getActorRef(snapshot: SnapshotFrom<TLogic
|
|
137
|
+
getActorRef(snapshot: SnapshotFrom<TLogic>, address?: string): AnyActor | undefined;
|
|
118
138
|
/**
|
|
119
139
|
* Executes effects and resolves only when every runtime operation they
|
|
120
140
|
* transitively initiated — including operations from live child actors
|
|
@@ -122,12 +142,18 @@ export interface DurableExecution<TLogic extends AnyActorLogic> {
|
|
|
122
142
|
* failed operation rejects it. Operations are handed to the runtime one at
|
|
123
143
|
* a time, in initiation order.
|
|
124
144
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
145
|
+
* Events addressed to this execution's root actor that were produced along
|
|
146
|
+
* the way are retained, in order, and handed out by `waitForEvent()`
|
|
147
|
+
* before it defers to the adapter — so the drive loop is just
|
|
148
|
+
* `transition(snapshot, await waitForEvent())` + `executeEffects`.
|
|
149
|
+
*/
|
|
150
|
+
executeEffects(effects: readonly DurableEffect<ExecutableActionObjectFromLogic<TLogic>>[]): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Resolves with the next event addressed to this execution's root actor:
|
|
153
|
+
* an event a prior `executeEffects` batch captured (an invoked actor
|
|
154
|
+
* completing, a child reporting up), or — once none are queued — whatever
|
|
155
|
+
* the adapter's durable wait produces.
|
|
129
156
|
*/
|
|
130
|
-
executeEffects(effects: readonly DurableEffect<ExecutableActionObjectFromLogic<TLogic>>[]): Promise<DurableRootEvent<EventFromLogic<TLogic>>[]>;
|
|
131
157
|
waitForEvent(): Promise<EventFromLogic<TLogic>>;
|
|
132
158
|
run(...[input]: undefined extends InputFrom<TLogic> ? [input?: InputFrom<TLogic>] : [input: InputFrom<TLogic>]): Promise<OutputFrom<TLogic>>;
|
|
133
159
|
}
|
|
@@ -140,4 +166,13 @@ export interface DurableExecution<TLogic extends AnyActorLogic> {
|
|
|
140
166
|
*
|
|
141
167
|
* @experimental
|
|
142
168
|
*/
|
|
143
|
-
export
|
|
169
|
+
export interface DurableExecutionOptions {
|
|
170
|
+
/**
|
|
171
|
+
* Observes the execution's inspection events — actor lifecycle, event
|
|
172
|
+
* routing, transitions — across the whole live actor tree. The host-side
|
|
173
|
+
* home for operation logs and instrumentation, so adapters stay pure
|
|
174
|
+
* physics.
|
|
175
|
+
*/
|
|
176
|
+
inspect?: (inspectionEvent: InspectionEvent) => void;
|
|
177
|
+
}
|
|
178
|
+
export declare function createDurable<TLogic extends AnyActorLogic>(logic: TLogic, adapter: DurableExecutionAdapter<TLogic>, options?: DurableExecutionOptions): DurableExecution<TLogic>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { type Actor, type RequiredActorOptionsKeys } from "./createActor.js";
|
|
|
5
5
|
import { AnyActorRef, AnyActorLogic, ActorRefFromLogic, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, StateValueFromStateSchema, ToChildren, MetaObject, Cast, Compute, EnqueueObject, DoneActorEvent, DoneStateEvent, ErrorActorEvent, SystemRegistry, RegistryKeyForLogic, ActorOptions, Observer, Subscription, OutputArg, SnapshotEvent, SingleOrArray, AfterEvent, TimeoutEvent, ErrorEvent } from "./types.js";
|
|
6
6
|
import { AnyActorSystem } from "./system.js";
|
|
7
7
|
import { InspectionEvent } from "./inspection.js";
|
|
8
|
-
import { ActionSchemas, DelayMapFromNames, GuardSchemas, InferChildren, InferActions, InferGuards, Sources, InferOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_InvokeConfig, Next_StateNodeConfig, Next_TransitionConfigOrTarget, ValidateHistoryDefaults, ValidateStateTargets, WithDefault } from "./types.v6.js";
|
|
8
|
+
import { ActionSchemas, DelayMapFromNames, GuardSchemas, InferChildren, InferActions, InferGuards, Sources, InferOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_InvokeConfig, Next_StateNodeConfig, Next_TransitionConfigOrTarget, OutputFromConfig, ValidateHistoryDefaults, ValidateStateTargets, WithDefault } from "./types.v6.js";
|
|
9
9
|
export type SetupConfig<TSchemas extends SetupSchemas, TStates extends Record<string, SetupStateSchema>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TValidator extends ActorLogicValidator | undefined = ActorLogicValidator | undefined> = {
|
|
10
10
|
validator?: TValidator;
|
|
11
11
|
schemas?: TSchemas & SetupSchemas;
|
|
@@ -199,6 +199,20 @@ type SetupInput<TSchemas, TInputSchema extends StandardSchemaV1> = [
|
|
|
199
199
|
type SetupOutput<TSchemas, TOutputSchema extends StandardSchemaV1> = [
|
|
200
200
|
SetupSchema<TSchemas, 'output'>
|
|
201
201
|
] extends [never] ? InferOutput<TOutputSchema, unknown> : InferOutput<SetupSchema<TSchemas, 'output'>, unknown>;
|
|
202
|
+
/**
|
|
203
|
+
* Whether an output schema was declared, either in `setup({ schemas })` or in
|
|
204
|
+
* the machine config's own `schemas.output`. A declared schema is always
|
|
205
|
+
* authoritative for the machine's output type.
|
|
206
|
+
*/
|
|
207
|
+
type HasOutputSchema<TSchemas, TOutputSchema extends StandardSchemaV1> = [
|
|
208
|
+
SetupSchema<TSchemas, 'output'>
|
|
209
|
+
] extends [never] ? StandardSchemaV1 extends TOutputSchema ? false : true : true;
|
|
210
|
+
/**
|
|
211
|
+
* The machine's output type. A declared output schema wins; otherwise the type
|
|
212
|
+
* is inferred from the config's `output` property (a mapper's return type, or
|
|
213
|
+
* the static value's type).
|
|
214
|
+
*/
|
|
215
|
+
type SetupOrConfigOutput<TSchemas, TOutputSchema extends StandardSchemaV1, TConfig> = HasOutputSchema<TSchemas, TOutputSchema> extends true ? SetupOutput<TSchemas, TOutputSchema> : OutputFromConfig<TConfig, SetupOutput<TSchemas, TOutputSchema>>;
|
|
202
216
|
type SetupEmitted<TSchemas, TEmittedSchemaMap extends Record<string, StandardSchemaV1>> = [SetupSchemaMap<TSchemas, 'emitted'>] extends [never] ? WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject> : WithDefault<InferEvents<SetupSchemaMap<TSchemas, 'emitted'>>, AnyEventObject>;
|
|
203
217
|
type SetupMeta<TSchemas, TMetaSchema extends StandardSchemaV1> = [
|
|
204
218
|
SetupSchema<TSchemas, 'meta'>
|
|
@@ -410,7 +424,7 @@ type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSche
|
|
|
410
424
|
guards: TGuardMap;
|
|
411
425
|
delays: TDelayMap;
|
|
412
426
|
input: TInput;
|
|
413
|
-
} & OutputArg<TExpressionEvent>, enq: EnqueueObject<TEvent, TEmitted, TSystemRegistry>) => StateTransitionResult<TStateSchemas, TContext, TContextShape, TMeta, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, false> | void;
|
|
427
|
+
} & OutputArg<TExpressionEvent>, enq: EnqueueObject<TEvent, TEmitted, TSystemRegistry, TActorMap>) => StateTransitionResult<TStateSchemas, TContext, TContextShape, TMeta, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, false> | void;
|
|
414
428
|
type StateTransitionResult<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TMeta extends MetaObject, TExpressionEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TAllowContextMapper extends boolean> = {
|
|
415
429
|
target?: never;
|
|
416
430
|
context?: StateTransitionContext<TAllowContextMapper, TContext, TContextShape, TContextShape, TContext, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
@@ -485,7 +499,7 @@ export interface SetupReturn<TStates extends Record<string, SetupStateSchema> =
|
|
|
485
499
|
to: RoutableStateId<Cast<TConfig, StateSchema>>;
|
|
486
500
|
}), Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<MergeStateSchema<Cast<TConfig, StateSchema>, SetupStatesToStateSchema<TStates>>>, TTag & string, [
|
|
487
501
|
SetupSchema<TSchemas, 'input'>
|
|
488
|
-
] extends [never] ? TInput : SetupInput<TSchemas, TInputSchema>,
|
|
502
|
+
] extends [never] ? TInput : SetupInput<TSchemas, TInputSchema>, SetupOrConfigOutput<TSchemas, TOutputSchema, TConfig>, SetupEmitted<TSchemas, TEmittedSchemaMap>, SetupMeta<TSchemas, TMetaSchema>, MergeStateSchema<Cast<TConfig, StateSchema>, SetupStatesToStateSchema<TStates>>, MergeSourceMaps<SetupActions<TSchemas, TSetupActionMap>, MergeSourceMaps<InferActions<TActionSchemaMap>, TActionMap>>, MergeSourceMaps<TSetupActorMap, TActorMap>, MergeSourceMaps<SetupGuards<TSchemas, TSetupGuardMap>, MergeSourceMaps<InferGuards<TGuardSchemaMap>, TGuardMap>>, DelayMapFromNames<TSetupDelays | TDelays, MergeSourceMaps<TSetupDelayMap, TDelayMap>>, SetupInternalEvents<TSchemas, TInternalEventSchemaMap>> & MachineIdentity<TConfig>;
|
|
489
503
|
/**
|
|
490
504
|
* Creates a state node config bound to a specific setup-declared state,
|
|
491
505
|
* addressed by a dotted path (e.g. `'loading'` or `'parent.child'`). The
|
|
@@ -31,6 +31,7 @@ export interface ExecutionIdentity {
|
|
|
31
31
|
systemId: string;
|
|
32
32
|
nextSessionId: number;
|
|
33
33
|
}
|
|
34
|
+
export { hasAmbientInspector, withSystemInspector } from "./inspectionAmbient.js";
|
|
34
35
|
/**
|
|
35
36
|
* Runtime operations used to execute effects.
|
|
36
37
|
*
|
|
@@ -124,4 +125,3 @@ export declare function createRuntimeSystem<T extends ActorSystemInfo>(rootActor
|
|
|
124
125
|
snapshot?: unknown;
|
|
125
126
|
createActorRef: ActorSystem<T>['createActorRef'];
|
|
126
127
|
}): ActorSystem<T>;
|
|
127
|
-
export {};
|