xstate 6.0.0-alpha.50 → 6.0.0-alpha.51

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.
Files changed (72) hide show
  1. package/README.md +13 -8
  2. package/dist/{StateMachine-70df737c.development.cjs.js → StateMachine-559e0140.development.cjs.js} +1 -1
  3. package/dist/{StateMachine-1e6ee14a.cjs.js → StateMachine-c3c54551.cjs.js} +1 -1
  4. package/dist/{StateMachine-8cea8974.esm.js → StateMachine-c6e2cb9e.esm.js} +1 -1
  5. package/dist/{StateMachine-bc28e207.development.esm.js → StateMachine-df7199a8.development.esm.js} +1 -1
  6. package/dist/{createActor-ad3a1abe.esm.js → createActor-5d4780c4.esm.js} +2 -1
  7. package/dist/{createActor-74e185ee.development.esm.js → createActor-67a1cda3.development.esm.js} +2 -1
  8. package/dist/{createActor-27fd819f.cjs.js → createActor-a0610101.cjs.js} +1 -2
  9. package/dist/{createActor-ea9a560c.development.cjs.js → createActor-ae612b26.development.cjs.js} +1 -2
  10. package/dist/declarations/src/fsm/index.d.ts +2 -2
  11. package/dist/declarations/src/fsm.d.ts +120 -64
  12. package/dist/declarations/src/index.d.ts +2 -2
  13. package/dist/declarations/src/schema.types.d.ts +1 -0
  14. package/dist/declarations/src/setup.d.ts +565 -62
  15. package/dist/declarations/src/types.d.ts +3 -1
  16. package/dist/declarations/src/types.v6.d.ts +14 -12
  17. package/dist/{effectDescriptor-38598bd3.development.esm.js → effectDescriptor-0399a5cc.development.esm.js} +1 -1
  18. package/dist/{effectDescriptor-40ca302f.development.cjs.js → effectDescriptor-143d3c39.development.cjs.js} +1 -1
  19. package/dist/{effectDescriptor-7dac431a.esm.js → effectDescriptor-727e5012.esm.js} +1 -1
  20. package/dist/{effectDescriptor-16b6f3b4.cjs.js → effectDescriptor-f5237352.cjs.js} +1 -1
  21. package/dist/schema.types-6c3a61af.development.esm.js +106 -0
  22. package/dist/schema.types-7a48b14e.cjs.js +111 -0
  23. package/dist/schema.types-9a23aaa8.esm.js +106 -0
  24. package/dist/schema.types-e396f88c.development.cjs.js +111 -0
  25. package/dist/{types-a14db10c.development.cjs.js → types-47bec2b3.development.cjs.js} +1 -1
  26. package/dist/{types-bc22b358.cjs.js → types-846ceef0.cjs.js} +1 -1
  27. package/dist/{types-a313e7e2.esm.js → types-c59c4824.esm.js} +1 -1
  28. package/dist/{types-c37714eb.development.esm.js → types-cfdb878a.development.esm.js} +1 -1
  29. package/dist/xstate-actors.cjs.js +1 -1
  30. package/dist/xstate-actors.development.cjs.js +1 -1
  31. package/dist/xstate-actors.development.esm.js +2 -2
  32. package/dist/xstate-actors.esm.js +2 -2
  33. package/dist/xstate-durable.cjs.js +2 -2
  34. package/dist/xstate-durable.development.cjs.js +2 -2
  35. package/dist/xstate-durable.development.esm.js +2 -2
  36. package/dist/xstate-durable.esm.js +2 -2
  37. package/dist/xstate-fsm.cjs.js +4 -402
  38. package/dist/xstate-fsm.cjs.mjs +2 -2
  39. package/dist/xstate-fsm.development.cjs.js +4 -402
  40. package/dist/xstate-fsm.development.cjs.mjs +2 -2
  41. package/dist/xstate-fsm.development.esm.js +1 -403
  42. package/dist/xstate-fsm.esm.js +1 -403
  43. package/dist/xstate-fsm.umd.min.js +1 -1
  44. package/dist/xstate-fsm.umd.min.js.map +1 -1
  45. package/dist/xstate-graph.cjs.js +2 -2
  46. package/dist/xstate-graph.development.cjs.js +2 -2
  47. package/dist/xstate-graph.development.esm.js +2 -2
  48. package/dist/xstate-graph.esm.js +2 -2
  49. package/dist/xstate-graph.umd.min.js +1 -1
  50. package/dist/xstate-graph.umd.min.js.map +1 -1
  51. package/dist/xstate-scxml.cjs.js +3 -3
  52. package/dist/xstate-scxml.development.cjs.js +3 -3
  53. package/dist/xstate-scxml.development.esm.js +3 -3
  54. package/dist/xstate-scxml.esm.js +3 -3
  55. package/dist/xstate-scxml.umd.min.js +1 -1
  56. package/dist/xstate-scxml.umd.min.js.map +1 -1
  57. package/dist/xstate-validation.cjs.js +1 -1
  58. package/dist/xstate-validation.development.cjs.js +1 -1
  59. package/dist/xstate-validation.development.esm.js +1 -1
  60. package/dist/xstate-validation.esm.js +1 -1
  61. package/dist/xstate.cjs.js +69 -72
  62. package/dist/xstate.development.cjs.js +69 -72
  63. package/dist/xstate.development.esm.js +66 -69
  64. package/dist/xstate.esm.js +66 -69
  65. package/dist/xstate.umd.min.js +1 -1
  66. package/dist/xstate.umd.min.js.map +1 -1
  67. package/package.json +1 -1
  68. package/dist/declarations/src/fsm/createFSMActor.d.ts +0 -67
  69. package/dist/fsm-25f10f50.development.esm.js +0 -775
  70. package/dist/fsm-697ffd89.development.cjs.js +0 -777
  71. package/dist/fsm-7adaf0ea.cjs.js +0 -777
  72. package/dist/fsm-dc1bb88b.esm.js +0 -775
package/README.md CHANGED
@@ -17,28 +17,33 @@ XState is a state management and orchestration solution for JavaScript and TypeS
17
17
 
18
18
  It uses event-driven programming, state machines, statecharts, and the actor model to handle complex logic in predictable, robust, and visual ways. XState provides a powerful and flexible way to manage application and workflow state by allowing developers to model logic as actors and state machines.
19
19
 
20
- For flat finite state machines, `xstate/fsm` provides a self-contained compact
21
- runtime and a specialized actor:
20
+ For flat finite state machines, `xstate/fsm` provides a tiny pure transition
21
+ table with context and TypeScript support:
22
22
 
23
23
  <!-- public exports from packages/core/src/fsm/index.ts; exact capabilities documented in docs/fsm.md -->
24
24
 
25
25
  ```ts
26
- import { createFSM, createFSMActor } from 'xstate/fsm';
26
+ import { createFSM } from 'xstate/fsm';
27
27
 
28
- const logic = createFSM({
28
+ const machine = createFSM({
29
29
  initial: 'inactive',
30
30
  states: {
31
- inactive: { on: { toggle: { target: 'active' } } },
32
- active: { on: { toggle: { target: 'inactive' } } }
31
+ inactive: { on: { toggle: 'active' } },
32
+ active: { on: { toggle: 'inactive' } }
33
33
  }
34
34
  });
35
35
 
36
- const actor = createFSMActor(logic).start();
36
+ let state = machine.initialState;
37
+ state = machine.transition(state, { type: 'toggle' });
37
38
  ```
38
39
 
40
+ For typed context, event payloads, or state-specific context snapshots, use
41
+ `setup` and `types` from `xstate/fsm`. These schemas are type-only in this
42
+ subpath; use root `xstate` for runtime schema validation.
43
+
39
44
  See the [exact supported surface](https://stately.ai/docs/fsm). Use the root `xstate`
40
45
  entry point for compound or parallel statecharts, invocation, named sources,
41
- schemas, serialization and inspection.
46
+ runtime schemas, serialization and inspection.
42
47
 
43
48
  ### ✨ Create state machines visually in Stately Studio → [state.new](https://state.new)
44
49
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-ea9a560c.development.cjs.js');
3
+ var createActor = require('./createActor-ae612b26.development.cjs.js');
4
4
  var validation = require('./validation-f2714a35.development.cjs.js');
5
5
 
6
6
  function createSpawner(actorScope, actors, spawnedChildren) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-27fd819f.cjs.js');
3
+ var createActor = require('./createActor-a0610101.cjs.js');
4
4
  var validation = require('./validation-4561b43c.cjs.js');
5
5
 
6
6
  function createSpawner(actorScope, actors, spawnedChildren) {
@@ -1,4 +1,4 @@
1
- import { M as resolveRegisteredActorSource, N as allocateChildId, O as assertChildIdFree, P as reserveChildId, S as STATE_DELIMITER, Q as mapValues, t as toArray, R as createInvokeId, T as getDelayedTransitions, U as getEventDescriptorKey, V as getCandidates, W as evaluateCandidate, Y as formatTransition, Z as NULL_EVENT, _ as toTransitionConfigArray, $ as createInvokeTimeoutEventId, a0 as matchesActorSession, a1 as formatRouteTransitions, a2 as resolveStateValue, a3 as getAllStateNodes, f as getStateNodes, a4 as createMachineSnapshot, a5 as isInFinalState, a6 as createInertActorScope, a7 as setInertActorScopeSnapshot, z as createDeadLetterEffect, a8 as beginSpawnAllocation, a9 as attachSnapshotActorRef, aa as macrostep, ab as isInertActorScope, ac as setSnapshotActorRef, ad as cloneMachineSnapshot, ae as transitionNode, K as XSTATE_TIMER, m as matchesEventDescriptor, af as getTransitionResult, ag as hasEffect, ah as createErrorPlatformEvent, ai as withActorSelf, aj as resolveActionsWithContext, ak as takeSpawnAllocationCounters, al as mergeActorIdCounters, y as createInitEvent, am as createSpawnEffect, an as initialMicrostep, ao as toStatePath, ap as isStateId, aq as getStateNodeByPath, ar as getPersistedSnapshot, as as createRemoteActorRef, at as resolveReferencedActor, au as createInvokeTimeoutEvent, av as parseGeneratedActorId, aw as ACTOR_REF_TYPE, c as createActor } from './createActor-ad3a1abe.esm.js';
1
+ import { J as resolveRegisteredActorSource, K as allocateChildId, L as assertChildIdFree, M as reserveChildId, S as STATE_DELIMITER, N as mapValues, t as toArray, O as createInvokeId, P as getDelayedTransitions, Q as getEventDescriptorKey, R as getCandidates, T as evaluateCandidate, U as formatTransition, V as NULL_EVENT, W as toTransitionConfigArray, Y as createInvokeTimeoutEventId, Z as matchesActorSession, _ as formatRouteTransitions, $ as resolveStateValue, a0 as getAllStateNodes, f as getStateNodes, a1 as createMachineSnapshot, a2 as isInFinalState, a3 as createInertActorScope, a4 as setInertActorScopeSnapshot, z as createDeadLetterEffect, a5 as beginSpawnAllocation, a6 as attachSnapshotActorRef, a7 as macrostep, a8 as isInertActorScope, a9 as setSnapshotActorRef, aa as cloneMachineSnapshot, ab as transitionNode, ac as XSTATE_TIMER, m as matchesEventDescriptor, ad as getTransitionResult, ae as hasEffect, af as createErrorPlatformEvent, ag as withActorSelf, ah as resolveActionsWithContext, ai as takeSpawnAllocationCounters, aj as mergeActorIdCounters, y as createInitEvent, ak as createSpawnEffect, al as initialMicrostep, am as toStatePath, an as isStateId, ao as getStateNodeByPath, ap as getPersistedSnapshot, aq as createRemoteActorRef, ar as resolveReferencedActor, as as createInvokeTimeoutEvent, at as parseGeneratedActorId, au as ACTOR_REF_TYPE, c as createActor } from './createActor-5d4780c4.esm.js';
2
2
  import { a as assertValid } from './validation-05f1d517.esm.js';
3
3
 
4
4
  function createSpawner(actorScope, actors, spawnedChildren) {
@@ -1,4 +1,4 @@
1
- import { M as resolveRegisteredActorSource, N as allocateChildId, O as assertChildIdFree, P as reserveChildId, S as STATE_DELIMITER, Q as mapValues, t as toArray, R as createInvokeId, T as getDelayedTransitions, U as getEventDescriptorKey, V as getCandidates, W as evaluateCandidate, Y as formatTransition, Z as NULL_EVENT, _ as toTransitionConfigArray, $ as createInvokeTimeoutEventId, a0 as matchesActorSession, a1 as formatRouteTransitions, a2 as resolveStateValue, a3 as getAllStateNodes, f as getStateNodes, a4 as createMachineSnapshot, a5 as isInFinalState, a6 as createInertActorScope, a7 as setInertActorScopeSnapshot, z as createDeadLetterEffect, a8 as beginSpawnAllocation, a9 as attachSnapshotActorRef, aa as macrostep, ab as isInertActorScope, ac as setSnapshotActorRef, ad as cloneMachineSnapshot, ae as transitionNode, K as XSTATE_TIMER, m as matchesEventDescriptor, af as getTransitionResult, ag as hasEffect, ah as createErrorPlatformEvent, ai as withActorSelf, aj as resolveActionsWithContext, ak as takeSpawnAllocationCounters, al as mergeActorIdCounters, y as createInitEvent, am as createSpawnEffect, an as initialMicrostep, ao as toStatePath, ap as isStateId, aq as getStateNodeByPath, ar as getPersistedSnapshot, as as createRemoteActorRef, at as resolveReferencedActor, au as createInvokeTimeoutEvent, av as parseGeneratedActorId, aw as ACTOR_REF_TYPE, c as createActor } from './createActor-74e185ee.development.esm.js';
1
+ import { J as resolveRegisteredActorSource, K as allocateChildId, L as assertChildIdFree, M as reserveChildId, S as STATE_DELIMITER, N as mapValues, t as toArray, O as createInvokeId, P as getDelayedTransitions, Q as getEventDescriptorKey, R as getCandidates, T as evaluateCandidate, U as formatTransition, V as NULL_EVENT, W as toTransitionConfigArray, Y as createInvokeTimeoutEventId, Z as matchesActorSession, _ as formatRouteTransitions, $ as resolveStateValue, a0 as getAllStateNodes, f as getStateNodes, a1 as createMachineSnapshot, a2 as isInFinalState, a3 as createInertActorScope, a4 as setInertActorScopeSnapshot, z as createDeadLetterEffect, a5 as beginSpawnAllocation, a6 as attachSnapshotActorRef, a7 as macrostep, a8 as isInertActorScope, a9 as setSnapshotActorRef, aa as cloneMachineSnapshot, ab as transitionNode, ac as XSTATE_TIMER, m as matchesEventDescriptor, ad as getTransitionResult, ae as hasEffect, af as createErrorPlatformEvent, ag as withActorSelf, ah as resolveActionsWithContext, ai as takeSpawnAllocationCounters, aj as mergeActorIdCounters, y as createInitEvent, ak as createSpawnEffect, al as initialMicrostep, am as toStatePath, an as isStateId, ao as getStateNodeByPath, ap as getPersistedSnapshot, aq as createRemoteActorRef, ar as resolveReferencedActor, as as createInvokeTimeoutEvent, at as parseGeneratedActorId, au as ACTOR_REF_TYPE, c as createActor } from './createActor-67a1cda3.development.esm.js';
2
2
  import { a as assertValid } from './validation-e69470ad.development.esm.js';
3
3
 
4
4
  function createSpawner(actorScope, actors, spawnedChildren) {
@@ -2985,6 +2985,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
2985
2985
  self: actorScope.self,
2986
2986
  context: nextState.context,
2987
2987
  event,
2988
+ input: stateInputMap[stateNodeToEnter.id],
2988
2989
  output: getEventOutput(event)
2989
2990
  }) : invokeDef.input;
2990
2991
  assertChildIdFree(actorScope, invokeDef.id);
@@ -5824,4 +5825,4 @@ function createActor(logic, options) {
5824
5825
  return new Actor(logic, options);
5825
5826
  }
5826
5827
 
5827
- export { createInvokeTimeoutEventId as $, Actor as A, createCustomEffect as B, XSTATE_LOGIC_EFFECT_START as C, XSTATE_LOGIC_EFFECT_RESOLVE as D, XSTATE_LOGIC_EFFECT_REJECT as E, finalizeTransitionResult as F, createEmitEffect as G, createSendToEffect as H, XSTATE_INIT as I, withActorScope as J, XSTATE_TIMER as K, isLazyActorScope as L, resolveRegisteredActorSource as M, allocateChildId as N, assertChildIdFree as O, reserveChildId as P, mapValues as Q, createInvokeId as R, STATE_DELIMITER as S, getDelayedTransitions as T, getEventDescriptorKey as U, getCandidates as V, evaluateCandidate as W, XSTATE_STOP as X, formatTransition as Y, NULL_EVENT as Z, toTransitionConfigArray as _, createListenerLogic as a, matchesActorSession as a0, formatRouteTransitions as a1, resolveStateValue as a2, getAllStateNodes as a3, createMachineSnapshot as a4, isInFinalState as a5, createInertActorScope as a6, setInertActorScopeSnapshot as a7, beginSpawnAllocation as a8, attachSnapshotActorRef as a9, getActorIdPrefix as aA, getAllOwnEvents as aB, matchesEvent as aC, encodeAddressSegment as aD, getRootActorId as aE, RUNTIME_OPERATIONS as aF, withSystemInspector as aG, getSnapshotActorRef as aH, withExecutionIdentity as aI, macrostep as aa, isInertActorScope as ab, setSnapshotActorRef as ac, cloneMachineSnapshot as ad, transitionNode as ae, getTransitionResult as af, hasEffect as ag, createErrorPlatformEvent as ah, withActorSelf as ai, resolveActionsWithContext as aj, takeSpawnAllocationCounters as ak, mergeActorIdCounters as al, createSpawnEffect as am, initialMicrostep as an, toStatePath as ao, isStateId as ap, getStateNodeByPath as aq, getPersistedSnapshot as ar, createRemoteActorRef as as, resolveReferencedActor as at, createInvokeTimeoutEvent as au, parseGeneratedActorId as av, ACTOR_REF_TYPE as aw, hasAmbientInspector as ax, getProperAncestors as ay, isRemoteActorRef as az, createSubscriptionLogic as b, createActor as c, getNextSnapshot as d, isMachineSnapshot as e, getStateNodes as f, getInitialSnapshot as g, getAllOwnEventDescriptors as h, isAtomicStateNode as i, matchesState as j, checkStateIn as k, listenerLogic as l, matchesEventDescriptor as m, pathToStateValue as n, toObserver as o, parseDelayToMilliseconds as p, executeEffects as q, isBuiltInExecutableAction as r, subscriptionLogic as s, toArray as t, deliverEvent as u, runStep as v, stopActor as w, terminateActor as x, createInitEvent as y, createDeadLetterEffect as z };
5828
+ export { resolveStateValue as $, Actor as A, createCustomEffect as B, XSTATE_LOGIC_EFFECT_START as C, XSTATE_LOGIC_EFFECT_RESOLVE as D, XSTATE_LOGIC_EFFECT_REJECT as E, finalizeTransitionResult as F, createEmitEffect as G, createSendToEffect as H, XSTATE_INIT as I, resolveRegisteredActorSource as J, allocateChildId as K, assertChildIdFree as L, reserveChildId as M, mapValues as N, createInvokeId as O, getDelayedTransitions as P, getEventDescriptorKey as Q, getCandidates as R, STATE_DELIMITER as S, evaluateCandidate as T, formatTransition as U, NULL_EVENT as V, toTransitionConfigArray as W, XSTATE_STOP as X, createInvokeTimeoutEventId as Y, matchesActorSession as Z, formatRouteTransitions as _, createListenerLogic as a, getAllStateNodes as a0, createMachineSnapshot as a1, isInFinalState as a2, createInertActorScope as a3, setInertActorScopeSnapshot as a4, beginSpawnAllocation as a5, attachSnapshotActorRef as a6, macrostep as a7, isInertActorScope as a8, setSnapshotActorRef as a9, matchesEvent as aA, encodeAddressSegment as aB, getRootActorId as aC, RUNTIME_OPERATIONS as aD, withSystemInspector as aE, getSnapshotActorRef as aF, withExecutionIdentity as aG, cloneMachineSnapshot as aa, transitionNode as ab, XSTATE_TIMER as ac, getTransitionResult as ad, hasEffect as ae, createErrorPlatformEvent as af, withActorSelf as ag, resolveActionsWithContext as ah, takeSpawnAllocationCounters as ai, mergeActorIdCounters as aj, createSpawnEffect as ak, initialMicrostep as al, toStatePath as am, isStateId as an, getStateNodeByPath as ao, getPersistedSnapshot as ap, createRemoteActorRef as aq, resolveReferencedActor as ar, createInvokeTimeoutEvent as as, parseGeneratedActorId as at, ACTOR_REF_TYPE as au, hasAmbientInspector as av, getProperAncestors as aw, isRemoteActorRef as ax, getActorIdPrefix as ay, getAllOwnEvents as az, createSubscriptionLogic as b, createActor as c, getNextSnapshot as d, isMachineSnapshot as e, getStateNodes as f, getInitialSnapshot as g, getAllOwnEventDescriptors as h, isAtomicStateNode as i, matchesState as j, checkStateIn as k, listenerLogic as l, matchesEventDescriptor as m, pathToStateValue as n, toObserver as o, parseDelayToMilliseconds as p, executeEffects as q, isBuiltInExecutableAction as r, subscriptionLogic as s, toArray as t, deliverEvent as u, runStep as v, stopActor as w, terminateActor as x, createInitEvent as y, createDeadLetterEffect as z };
@@ -3003,6 +3003,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
3003
3003
  self: actorScope.self,
3004
3004
  context: nextState.context,
3005
3005
  event,
3006
+ input: stateInputMap[stateNodeToEnter.id],
3006
3007
  output: getEventOutput(event)
3007
3008
  }) : invokeDef.input;
3008
3009
  assertChildIdFree(actorScope, invokeDef.id);
@@ -5863,4 +5864,4 @@ function createActor(logic, options) {
5863
5864
  return new Actor(logic, options);
5864
5865
  }
5865
5866
 
5866
- export { createInvokeTimeoutEventId as $, Actor as A, createCustomEffect as B, XSTATE_LOGIC_EFFECT_START as C, XSTATE_LOGIC_EFFECT_RESOLVE as D, XSTATE_LOGIC_EFFECT_REJECT as E, finalizeTransitionResult as F, createEmitEffect as G, createSendToEffect as H, XSTATE_INIT as I, withActorScope as J, XSTATE_TIMER as K, isLazyActorScope as L, resolveRegisteredActorSource as M, allocateChildId as N, assertChildIdFree as O, reserveChildId as P, mapValues as Q, createInvokeId as R, STATE_DELIMITER as S, getDelayedTransitions as T, getEventDescriptorKey as U, getCandidates as V, evaluateCandidate as W, XSTATE_STOP as X, formatTransition as Y, NULL_EVENT as Z, toTransitionConfigArray as _, createListenerLogic as a, matchesActorSession as a0, formatRouteTransitions as a1, resolveStateValue as a2, getAllStateNodes as a3, createMachineSnapshot as a4, isInFinalState as a5, createInertActorScope as a6, setInertActorScopeSnapshot as a7, beginSpawnAllocation as a8, attachSnapshotActorRef as a9, getActorIdPrefix as aA, getAllOwnEvents as aB, matchesEvent as aC, encodeAddressSegment as aD, getRootActorId as aE, RUNTIME_OPERATIONS as aF, withSystemInspector as aG, getSnapshotActorRef as aH, withExecutionIdentity as aI, macrostep as aa, isInertActorScope as ab, setSnapshotActorRef as ac, cloneMachineSnapshot as ad, transitionNode as ae, getTransitionResult as af, hasEffect as ag, createErrorPlatformEvent as ah, withActorSelf as ai, resolveActionsWithContext as aj, takeSpawnAllocationCounters as ak, mergeActorIdCounters as al, createSpawnEffect as am, initialMicrostep as an, toStatePath as ao, isStateId as ap, getStateNodeByPath as aq, getPersistedSnapshot as ar, createRemoteActorRef as as, resolveReferencedActor as at, createInvokeTimeoutEvent as au, parseGeneratedActorId as av, ACTOR_REF_TYPE as aw, hasAmbientInspector as ax, getProperAncestors as ay, isRemoteActorRef as az, createSubscriptionLogic as b, createActor as c, getNextSnapshot as d, isMachineSnapshot as e, getStateNodes as f, getInitialSnapshot as g, getAllOwnEventDescriptors as h, isAtomicStateNode as i, matchesState as j, checkStateIn as k, listenerLogic as l, matchesEventDescriptor as m, pathToStateValue as n, toObserver as o, parseDelayToMilliseconds as p, executeEffects as q, isBuiltInExecutableAction as r, subscriptionLogic as s, toArray as t, deliverEvent as u, runStep as v, stopActor as w, terminateActor as x, createInitEvent as y, createDeadLetterEffect as z };
5867
+ export { resolveStateValue as $, Actor as A, createCustomEffect as B, XSTATE_LOGIC_EFFECT_START as C, XSTATE_LOGIC_EFFECT_RESOLVE as D, XSTATE_LOGIC_EFFECT_REJECT as E, finalizeTransitionResult as F, createEmitEffect as G, createSendToEffect as H, XSTATE_INIT as I, resolveRegisteredActorSource as J, allocateChildId as K, assertChildIdFree as L, reserveChildId as M, mapValues as N, createInvokeId as O, getDelayedTransitions as P, getEventDescriptorKey as Q, getCandidates as R, STATE_DELIMITER as S, evaluateCandidate as T, formatTransition as U, NULL_EVENT as V, toTransitionConfigArray as W, XSTATE_STOP as X, createInvokeTimeoutEventId as Y, matchesActorSession as Z, formatRouteTransitions as _, createListenerLogic as a, getAllStateNodes as a0, createMachineSnapshot as a1, isInFinalState as a2, createInertActorScope as a3, setInertActorScopeSnapshot as a4, beginSpawnAllocation as a5, attachSnapshotActorRef as a6, macrostep as a7, isInertActorScope as a8, setSnapshotActorRef as a9, matchesEvent as aA, encodeAddressSegment as aB, getRootActorId as aC, RUNTIME_OPERATIONS as aD, withSystemInspector as aE, getSnapshotActorRef as aF, withExecutionIdentity as aG, cloneMachineSnapshot as aa, transitionNode as ab, XSTATE_TIMER as ac, getTransitionResult as ad, hasEffect as ae, createErrorPlatformEvent as af, withActorSelf as ag, resolveActionsWithContext as ah, takeSpawnAllocationCounters as ai, mergeActorIdCounters as aj, createSpawnEffect as ak, initialMicrostep as al, toStatePath as am, isStateId as an, getStateNodeByPath as ao, getPersistedSnapshot as ap, createRemoteActorRef as aq, resolveReferencedActor as ar, createInvokeTimeoutEvent as as, parseGeneratedActorId as at, ACTOR_REF_TYPE as au, hasAmbientInspector as av, getProperAncestors as aw, isRemoteActorRef as ax, getActorIdPrefix as ay, getAllOwnEvents as az, createSubscriptionLogic as b, createActor as c, getNextSnapshot as d, isMachineSnapshot as e, getStateNodes as f, getInitialSnapshot as g, getAllOwnEventDescriptors as h, isAtomicStateNode as i, matchesState as j, checkStateIn as k, listenerLogic as l, matchesEventDescriptor as m, pathToStateValue as n, toObserver as o, parseDelayToMilliseconds as p, executeEffects as q, isBuiltInExecutableAction as r, subscriptionLogic as s, toArray as t, deliverEvent as u, runStep as v, stopActor as w, terminateActor as x, createInitEvent as y, createDeadLetterEffect as z };
@@ -2987,6 +2987,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
2987
2987
  self: actorScope.self,
2988
2988
  context: nextState.context,
2989
2989
  event,
2990
+ input: stateInputMap[stateNodeToEnter.id],
2990
2991
  output: getEventOutput(event)
2991
2992
  }) : invokeDef.input;
2992
2993
  assertChildIdFree(actorScope, invokeDef.id);
@@ -5889,7 +5890,6 @@ exports.isAtomicStateNode = isAtomicStateNode;
5889
5890
  exports.isBuiltInExecutableAction = isBuiltInExecutableAction;
5890
5891
  exports.isInFinalState = isInFinalState;
5891
5892
  exports.isInertActorScope = isInertActorScope;
5892
- exports.isLazyActorScope = isLazyActorScope;
5893
5893
  exports.isMachineSnapshot = isMachineSnapshot;
5894
5894
  exports.isRemoteActorRef = isRemoteActorRef;
5895
5895
  exports.isStateId = isStateId;
@@ -5921,7 +5921,6 @@ exports.toObserver = toObserver;
5921
5921
  exports.toStatePath = toStatePath;
5922
5922
  exports.toTransitionConfigArray = toTransitionConfigArray;
5923
5923
  exports.transitionNode = transitionNode;
5924
- exports.withActorScope = withActorScope;
5925
5924
  exports.withActorSelf = withActorSelf;
5926
5925
  exports.withExecutionIdentity = withExecutionIdentity;
5927
5926
  exports.withSystemInspector = withSystemInspector;
@@ -3005,6 +3005,7 @@ function microstep(transitions, currentSnapshot, actorScope, event, isInitial, i
3005
3005
  self: actorScope.self,
3006
3006
  context: nextState.context,
3007
3007
  event,
3008
+ input: stateInputMap[stateNodeToEnter.id],
3008
3009
  output: getEventOutput(event)
3009
3010
  }) : invokeDef.input;
3010
3011
  assertChildIdFree(actorScope, invokeDef.id);
@@ -5928,7 +5929,6 @@ exports.isAtomicStateNode = isAtomicStateNode;
5928
5929
  exports.isBuiltInExecutableAction = isBuiltInExecutableAction;
5929
5930
  exports.isInFinalState = isInFinalState;
5930
5931
  exports.isInertActorScope = isInertActorScope;
5931
- exports.isLazyActorScope = isLazyActorScope;
5932
5932
  exports.isMachineSnapshot = isMachineSnapshot;
5933
5933
  exports.isRemoteActorRef = isRemoteActorRef;
5934
5934
  exports.isStateId = isStateId;
@@ -5960,7 +5960,6 @@ exports.toObserver = toObserver;
5960
5960
  exports.toStatePath = toStatePath;
5961
5961
  exports.toTransitionConfigArray = toTransitionConfigArray;
5962
5962
  exports.transitionNode = transitionNode;
5963
- exports.withActorScope = withActorScope;
5964
5963
  exports.withActorSelf = withActorSelf;
5965
5964
  exports.withExecutionIdentity = withExecutionIdentity;
5966
5965
  exports.withSystemInspector = withSystemInspector;
@@ -1,2 +1,2 @@
1
- export { createFSMActor, FSMActor } from "./createFSMActor.js";
2
- export { createFSM, type FSMActorLogic, type FSMConfig, type FSMSnapshot } from "../fsm.js";
1
+ export { types } from "../schema.types.js";
2
+ export { createFSM, setup, type FSM, type FSMArgs, type FSMConfig, type FSMContextPatch, type FSMStateConfig, type FSMTransition, type FSMTransitionConfig, type FSMTransitionFunction, type FSMSnapshot, type FSMSetupConfig, type FSMSetupReturn } from "../fsm.js";
@@ -1,78 +1,134 @@
1
- import type { ActorLogic, EnqueueObject, EventObject, MachineContext, LogicalTimer, NonReducibleUnknown, Snapshot } from "./types.js";
2
- export type FSMSnapshot<TContext extends MachineContext, TState extends string, TInput = unknown> = Snapshot<undefined> & {
3
- value: TState;
4
- context: TContext;
5
- input: TInput | undefined;
6
- children: {};
7
- timers: Record<string, LogicalTimer>;
8
- _nextTimerId: number;
9
- _nextActorIds?: Record<string, number>;
10
- _stateInput: Record<string, unknown> | undefined;
11
- machine: {
12
- id: string;
13
- sources: {
14
- actions: {};
15
- actors: {};
16
- guards: {};
17
- delays: {};
18
- };
19
- };
20
- };
21
- type FSMArgs<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = {
1
+ import type { EventObject, MachineContext } from "./types.js";
2
+ import type { StandardSchemaV1 } from "./schema.types.js";
3
+ import type { SetupSchemas, SetupStateSchema } from "./setup.js";
4
+ import type { InferEvents } from "./types.v6.js";
5
+ export type FSMArgs<TContext extends MachineContext, TEvent extends EventObject> = {
22
6
  context: TContext;
23
7
  event: TEvent;
24
- input: TInput | undefined;
25
- value: TState;
26
- self: any;
27
- system: any;
28
- parent: any;
29
- children: {};
30
8
  };
31
- type FSMAction<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput> & {
32
- input: Record<string, unknown> | undefined;
33
- }, enq: EnqueueObject<TEvent, EventObject>) => void | {
9
+ export type FSMContextPatch<TContext extends MachineContext> = Partial<TContext>;
10
+ export type FSMTransitionConfig<TContext extends MachineContext, TState extends string> = {
11
+ target?: TState;
34
12
  context?: FSMContextPatch<TContext>;
35
13
  };
36
- type FSMGuard<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput>) => boolean;
37
- type FSMContextPatch<TContext extends MachineContext> = Partial<TContext> & {
38
- call?: never;
39
- apply?: never;
40
- bind?: never;
14
+ export type FSMTransitionFunction<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TTransitionContext extends MachineContext = TContext> = (args: FSMArgs<TContext, TEvent>) => FSMTransitionConfig<TTransitionContext, TState> | undefined;
15
+ type EventForType<TEvent extends EventObject, TType extends string> = [
16
+ Extract<TEvent, {
17
+ type: TType;
18
+ }>
19
+ ] extends [never] ? TEvent : Extract<TEvent, {
20
+ type: TType;
21
+ }>;
22
+ export type FSMTransition<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TTransitionContext extends MachineContext = TContext> = TState | FSMTransitionConfig<TTransitionContext, TState> | FSMTransitionFunction<TContext, TEvent, TState, TTransitionContext>;
23
+ type FSMOn<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TTransitionContext extends MachineContext = TContext> = {
24
+ [TType in TEvent['type'] & string]?: FSMTransition<TContext, EventForType<TEvent, TType>, TState, TTransitionContext>;
41
25
  };
42
- type FSMContextMapper<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput>) => FSMContextPatch<TContext>;
43
- type FSMTarget<TContext extends MachineContext> = {
44
- target?: string;
45
- context?: FSMContextPatch<TContext>;
46
- input?: Record<string, unknown> | ((args: {
47
- context: TContext;
48
- event: EventObject;
49
- }) => Record<string, unknown>);
26
+ export type FSMStateConfig<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TTransitionContext extends MachineContext = TContext> = {
27
+ on?: FSMOn<TContext, TEvent, TState, TTransitionContext>;
50
28
  };
51
- type FSMObjectTarget<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = Omit<FSMTarget<TContext>, 'context'> & {
52
- context?: FSMContextPatch<TContext> | FSMContextMapper<TContext, TEvent, TState, TInput>;
53
- };
54
- type FSMTransitionFunction<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput>, enq: EnqueueObject<TEvent, EventObject>) => void | false | FSMTarget<TContext>;
55
- type FSMTransition<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = FSMObjectTarget<TContext, TEvent, TState, TInput> | (FSMObjectTarget<TContext, TEvent, TState, TInput> & {
56
- guard?: FSMGuard<TContext, TEvent, TState, TInput>;
57
- actions?: FSMAction<TContext, TEvent, TState, TInput> | Array<FSMAction<TContext, TEvent, TState, TInput>>;
58
- }) | FSMTransitionFunction<TContext, TEvent, TState, TInput>;
59
- type FSMStateConfig<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = {
60
- type?: 'final';
61
- entry?: FSMAction<TContext, TEvent, TState, TInput> | Array<FSMAction<TContext, TEvent, TState, TInput>>;
62
- exit?: FSMAction<TContext, TEvent, TState, TInput> | Array<FSMAction<TContext, TEvent, TState, TInput>>;
63
- always?: FSMTransition<TContext, TEvent, TState, TInput> | Array<FSMTransition<TContext, TEvent, TState, TInput>>;
64
- on?: Record<string, FSMTransition<TContext, TEvent, TState, TInput> | Array<FSMTransition<TContext, TEvent, TState, TInput>>>;
29
+ type FSMContextConfig<TContext extends MachineContext> = string extends keyof TContext ? {
30
+ context?: TContext;
31
+ } : keyof TContext extends never ? {
32
+ context?: TContext;
33
+ } : {
34
+ context: TContext;
65
35
  };
66
- export type FSMConfig<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput = NonReducibleUnknown> = {
36
+ export type FSMConfig<TContext extends MachineContext = {}, TEvent extends EventObject = EventObject, TState extends string = string> = {
67
37
  id?: string;
68
38
  initial: TState;
69
- context?: TContext | ((args: {
70
- input: TInput;
71
- }) => TContext);
72
- states: Record<TState, FSMStateConfig<TContext, TEvent, TState, TInput>>;
39
+ states: {
40
+ [K in TState]: FSMStateConfig<TContext, TEvent, TState>;
41
+ };
42
+ } & FSMContextConfig<TContext>;
43
+ type FSMConfigForStates<TContext extends MachineContext, TEvent extends EventObject, TStates extends Record<string, unknown>> = Omit<FSMConfig<TContext, TEvent, keyof TStates & string>, 'initial' | 'states'> & {
44
+ initial: keyof TStates & string;
45
+ states: {
46
+ [K in keyof TStates]: FSMStateConfig<TContext, TEvent, keyof TStates & string>;
47
+ };
73
48
  };
74
- export type FSMActorLogic<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = ActorLogic<FSMSnapshot<TContext, TState, TInput>, TEvent, TInput, any, EventObject> & {
49
+ export type FSMSnapshot<TContext extends MachineContext, TState extends string> = {
50
+ value: TState;
51
+ context: TContext;
52
+ };
53
+ export type FSM<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TSnapshot extends {
54
+ value: TState;
55
+ context: MachineContext;
56
+ } = FSMSnapshot<TContext, TState>, TConfig = FSMConfig<TContext, TEvent, TState>> = {
57
+ readonly id: string | undefined;
58
+ readonly config: TConfig;
59
+ readonly initialState: TSnapshot;
60
+ transition(snapshot: TSnapshot, event: TEvent): TSnapshot;
61
+ };
62
+ type FSMSetupSchemas = Pick<SetupSchemas, 'context' | 'events'>;
63
+ type FSMSetupStates = Record<string, SetupStateSchema>;
64
+ type FSMSchemaContext<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema> extends MachineContext ? StandardSchemaV1.InferOutput<TSchema> : MachineContext;
65
+ type FSMSetupContext<TSchemas extends FSMSetupSchemas> = TSchemas extends {
66
+ context: infer TSchema extends StandardSchemaV1;
67
+ } ? FSMSchemaContext<TSchema> : MachineContext;
68
+ type FSMSetupEvents<TSchemas extends FSMSetupSchemas> = TSchemas extends {
69
+ events: infer TEventSchemas extends Record<string, StandardSchemaV1>;
70
+ } ? InferEvents<TEventSchemas> : EventObject;
71
+ type FSMStateContext<TStateSchema, TGlobalContext extends MachineContext> = TStateSchema extends {
72
+ schemas?: infer TSchemas;
73
+ } ? TSchemas extends {
74
+ context?: infer TSchema extends StandardSchemaV1;
75
+ } ? FSMSchemaContext<TSchema> & ([MachineContext] extends [TGlobalContext] ? unknown : TGlobalContext) : TGlobalContext : TGlobalContext;
76
+ type FSMContextFromDeclaredStates<TStates extends FSMSetupStates, TGlobalContext extends MachineContext> = {
77
+ [K in keyof TStates & string]: FSMStateContext<TStates[K], TGlobalContext>;
78
+ }[keyof TStates & string];
79
+ type FSMContextFromStates<TStates extends FSMSetupStates, TGlobalContext extends MachineContext> = [keyof TStates] extends [never] ? TGlobalContext : [MachineContext] extends [TGlobalContext] ? FSMContextFromDeclaredStates<TStates, TGlobalContext> : TGlobalContext | FSMContextFromDeclaredStates<TStates, TGlobalContext>;
80
+ type FSMSetupStateContext<TState extends string, TStates extends FSMSetupStates, TGlobalContext extends MachineContext> = TState extends keyof TStates ? FSMStateContext<TStates[TState], TGlobalContext> : TGlobalContext;
81
+ type FSMSetupSnapshot<TStates extends FSMSetupStates, TGlobalContext extends MachineContext, TMachineStates extends Record<string, unknown>> = [keyof TStates] extends [never] ? FSMSnapshot<TGlobalContext, keyof TMachineStates & string> : {
82
+ [K in keyof TMachineStates & string]: {
83
+ value: K;
84
+ context: FSMSetupStateContext<K, TStates, TGlobalContext>;
85
+ };
86
+ }[keyof TMachineStates & string];
87
+ type FSMSetupTargetTransitionConfig<TSourceContext extends MachineContext, TTarget extends string, TTargetContext extends MachineContext> = [FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>] extends [
88
+ never
89
+ ] ? {
90
+ target: TTarget;
91
+ context?: FSMTargetContextPatch<TSourceContext, TTargetContext>;
92
+ } : {
93
+ target: TTarget;
94
+ context: FSMTargetContextPatch<TSourceContext, TTargetContext>;
95
+ };
96
+ type FSMRequiredTargetContextKeys<TSourceContext, TTargetContext> = {
97
+ [K in keyof TTargetContext]-?: K extends keyof TSourceContext ? [TSourceContext[K]] extends [TTargetContext[K]] ? never : K : K;
98
+ }[keyof TTargetContext];
99
+ type FSMTargetContextPatch<TSourceContext, TTargetContext> = Partial<TTargetContext> & Pick<TTargetContext, Extract<FSMRequiredTargetContextKeys<TSourceContext, TTargetContext>, string>>;
100
+ type FSMSetupTransitionConfig<TSourceContext extends MachineContext, TStates extends FSMSetupStates, TGlobalContext extends MachineContext> = {
101
+ target?: undefined;
102
+ context?: FSMContextPatch<TSourceContext>;
103
+ } | {
104
+ [TTarget in keyof TStates & string]: FSMSetupTargetTransitionConfig<TSourceContext, TTarget, FSMSetupStateContext<TTarget, TStates, TGlobalContext>>;
105
+ }[keyof TStates & string];
106
+ type FSMSetupStringTransition<TSourceContext extends MachineContext, TStates extends FSMSetupStates, TGlobalContext extends MachineContext> = {
107
+ [TTarget in keyof TStates & string]: [TSourceContext] extends [
108
+ FSMSetupStateContext<TTarget, TStates, TGlobalContext>
109
+ ] ? TTarget : never;
110
+ }[keyof TStates & string];
111
+ type FSMSetupTransitionFunction<TSourceContext extends MachineContext, TEvent extends EventObject, TStates extends FSMSetupStates, TGlobalContext extends MachineContext> = (args: FSMArgs<TSourceContext, TEvent>) => FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext> | undefined;
112
+ type FSMSetupTransition<TSourceContext extends MachineContext, TEvent extends EventObject, TStates extends FSMSetupStates, TGlobalContext extends MachineContext, TMachineStates extends Record<string, unknown>> = [keyof TStates] extends [never] ? FSMTransition<TSourceContext, TEvent, keyof TMachineStates & string> : FSMSetupStringTransition<TSourceContext, TStates, TGlobalContext> | FSMSetupTransitionConfig<TSourceContext, TStates, TGlobalContext> | FSMSetupTransitionFunction<TSourceContext, TEvent, TStates, TGlobalContext>;
113
+ type FSMSetupStateConfig<TSourceContext extends MachineContext, TEvent extends EventObject, TStates extends FSMSetupStates, TGlobalContext extends MachineContext, TMachineStates extends Record<string, unknown>> = {
114
+ on?: {
115
+ [TType in TEvent['type'] & string]?: FSMSetupTransition<TSourceContext, EventForType<TEvent, TType>, TStates, TGlobalContext, TMachineStates>;
116
+ };
117
+ };
118
+ type FSMSetupMachineConfig<TSchemas extends FSMSetupSchemas, TStates extends FSMSetupStates, TMachineStates extends Record<string, unknown>> = {
75
119
  id?: string;
120
+ initial: keyof TMachineStates & string;
121
+ states: {
122
+ [K in keyof TMachineStates]: FSMSetupStateConfig<FSMStateContext<K extends keyof TStates ? TStates[K] : {}, FSMSetupContext<TSchemas>>, FSMSetupEvents<TSchemas>, TStates, FSMSetupContext<TSchemas>, TMachineStates>;
123
+ };
124
+ } & FSMContextConfig<FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>>;
125
+ export type FSMSetupConfig<TSchemas extends FSMSetupSchemas = {}, TStates extends FSMSetupStates = {}> = {
126
+ schemas?: TSchemas;
127
+ states?: TStates;
128
+ };
129
+ export type FSMSetupReturn<TSchemas extends FSMSetupSchemas, TStates extends FSMSetupStates> = {
130
+ createFSM<const TMachineStates extends Record<string, unknown>>(config: FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>): FSM<FSMContextFromStates<TStates, FSMSetupContext<TSchemas>>, FSMSetupEvents<TSchemas>, keyof TMachineStates & string, FSMSetupSnapshot<TStates, FSMSetupContext<TSchemas>, TMachineStates>, FSMSetupMachineConfig<TSchemas, TStates, TMachineStates>>;
76
131
  };
77
- export declare function createFSM<TContext extends MachineContext, TEvent extends EventObject, TInput = NonReducibleUnknown>(config: FSMConfig<TContext, TEvent, string, TInput>): FSMActorLogic<TContext, TEvent, string, TInput>;
132
+ export declare function setup<const TSchemas extends FSMSetupSchemas = {}, const TStates extends FSMSetupStates = {}>(_config?: FSMSetupConfig<TSchemas, TStates>): FSMSetupReturn<TSchemas, TStates>;
133
+ export declare function createFSM<TContext extends MachineContext = {}, TEvent extends EventObject = EventObject, const TStates extends Record<string, unknown> = Record<string, unknown>>(config: FSMConfigForStates<TContext, TEvent, TStates>): FSM<TContext, TEvent, keyof TStates & string, FSMSnapshot<TContext, keyof TStates & string>, FSMConfigForStates<TContext, TEvent, TStates>>;
78
134
  export {};
@@ -2,7 +2,7 @@ export { createAsyncLogic, createCallbackLogic, createEmptyActor, createEventObs
2
2
  export { assertEvent } from "./assert.js";
3
3
  export { Actor, createActor, type RequiredActorOptionsKeys as RequiredActorOptionsKeys } from "./createActor.js";
4
4
  export { createMachine, createStateConfig } from "./createMachine.js";
5
- export { createFSM, type FSMActorLogic, type FSMConfig, type FSMSnapshot } from "./fsm.js";
5
+ export { createFSM, type FSM, type FSMArgs, type FSMConfig, type FSMContextPatch, type FSMStateConfig, type FSMTransition, type FSMTransitionConfig, type FSMTransitionFunction, type FSMSnapshot } from "./fsm.js";
6
6
  export { createMachineFromConfig } from "./createMachineFromConfig.js";
7
7
  export type { ActionJSON, GuardJSON, InvokeJSON, MachineJSON, StateNodeJSON, TransitionJSON } from "./createMachineFromConfig.js";
8
8
  export { machineConfigToJSON, serializeMachine, type CodeExpression } from "./serialize.js";
@@ -11,7 +11,7 @@ export { machineVersions, type AdaptEventsOptions, type EventAdapterHandlers, ty
11
11
  export { types, isTypeSchema, type StandardSchemaV1, type TypeSchema } from "./schema.types.js";
12
12
  export type { ActorValidationBoundary, ActorValidationEventOrigin, ActorValidationRequest, ActorLogicValidator } from "./validation.types.js";
13
13
  export { createSystem, setup } from "./setup.js";
14
- export type { AnySetupConfig, SetupConfig, SetupReturn, SetupReturnFromConfig, SetupSchemas, SystemActorMap, SystemConfig, SystemRuntime, SetupStateSchema, SetupStateSchemas } from "./setup.js";
14
+ export type { AnySetupConfig, SetupConfig, SetupReturn, SetupReturnFromConfig, SetupSchemas, SystemActorMap, SystemConfig, SystemRuntime, SetupStateSchema, SetupStateSchemas, SetupStateType } from "./setup.js";
15
15
  export { getInitialSnapshot, getNextSnapshot } from "./getNextSnapshot.js";
16
16
  export type { InspectionEvent, ActorInspectionEvent, DeadLetterInspectionEvent, TransitionInspectionEvent, ActionRecord, SentRecord } from "./inspection.js";
17
17
  export { SimulatedClock } from "./SimulatedClock.js";
@@ -5,6 +5,7 @@ export interface StandardSchemaV1<Input = unknown, Output = Input> {
5
5
  }
6
6
  /** Schemas that can be declared for an individual state node. */
7
7
  export type SetupStateSchemas = {
8
+ /** Refines the machine's root context schema while this state is active. */
8
9
  context?: StandardSchemaV1;
9
10
  input?: StandardSchemaV1;
10
11
  /** The output emitted when this state node completes. */