xstate 6.0.0-alpha.38 → 6.0.0-alpha.39

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 (44) hide show
  1. package/dist/{StateMachine-f4ddc94b.development.cjs.js → StateMachine-144215d2.development.cjs.js} +2 -2
  2. package/dist/{StateMachine-812087bb.esm.js → StateMachine-2f47d890.esm.js} +2 -2
  3. package/dist/{StateMachine-18e71e29.cjs.js → StateMachine-94084ac7.cjs.js} +2 -2
  4. package/dist/{StateMachine-d344b16c.development.esm.js → StateMachine-da29dd2e.development.esm.js} +2 -2
  5. package/dist/{createActor-164c86f5.development.esm.js → createActor-2a03d4b2.development.esm.js} +15 -3
  6. package/dist/{createActor-19e83fb9.esm.js → createActor-a211c276.esm.js} +15 -3
  7. package/dist/{createActor-8462b9cc.development.cjs.js → createActor-c0f78b8a.development.cjs.js} +14 -2
  8. package/dist/{createActor-fd53ec92.cjs.js → createActor-d5305cc9.cjs.js} +14 -2
  9. package/dist/declarations/src/createMachine.d.ts +3 -3
  10. package/dist/declarations/src/index.d.ts +3 -2
  11. package/dist/declarations/src/setup.d.ts +16 -12
  12. package/dist/declarations/src/types.d.ts +1 -1
  13. package/dist/declarations/src/types.v6.d.ts +11 -4
  14. package/dist/{index-acf2bd02.development.esm.js → index-17f889df.development.esm.js} +2 -2
  15. package/dist/{index-13e54113.cjs.js → index-21d08fff.cjs.js} +1 -1
  16. package/dist/{index-14478488.development.cjs.js → index-3d1368f7.development.cjs.js} +1 -1
  17. package/dist/{index-abf9ab72.esm.js → index-7020402e.esm.js} +2 -2
  18. package/dist/{transition-169651ca.cjs.js → transition-2dcabac8.cjs.js} +1 -1
  19. package/dist/{transition-a306226e.development.cjs.js → transition-4ba58b71.development.cjs.js} +1 -1
  20. package/dist/{transition-760b0fc6.esm.js → transition-e8a13c00.esm.js} +1 -1
  21. package/dist/{transition-61a126e0.development.esm.js → transition-f581ffa6.development.esm.js} +1 -1
  22. package/dist/xstate-actors.cjs.js +2 -2
  23. package/dist/xstate-actors.development.cjs.js +2 -2
  24. package/dist/xstate-actors.development.esm.js +2 -2
  25. package/dist/xstate-actors.esm.js +2 -2
  26. package/dist/xstate-actors.umd.min.js.map +1 -1
  27. package/dist/xstate-durable.cjs.js +2 -2
  28. package/dist/xstate-durable.development.cjs.js +2 -2
  29. package/dist/xstate-durable.development.esm.js +2 -2
  30. package/dist/xstate-durable.esm.js +2 -2
  31. package/dist/xstate-durable.umd.min.js.map +1 -1
  32. package/dist/xstate-graph.cjs.js +3 -3
  33. package/dist/xstate-graph.development.cjs.js +3 -3
  34. package/dist/xstate-graph.development.esm.js +3 -3
  35. package/dist/xstate-graph.esm.js +3 -3
  36. package/dist/xstate-graph.umd.min.js +1 -1
  37. package/dist/xstate-graph.umd.min.js.map +1 -1
  38. package/dist/xstate.cjs.js +7 -10
  39. package/dist/xstate.development.cjs.js +7 -10
  40. package/dist/xstate.development.esm.js +9 -12
  41. package/dist/xstate.esm.js +9 -12
  42. package/dist/xstate.umd.min.js +1 -1
  43. package/dist/xstate.umd.min.js.map +1 -1
  44. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-8462b9cc.development.cjs.js');
4
- var dist_xstateActors = require('./index-14478488.development.cjs.js');
3
+ var createActor = require('./createActor-c0f78b8a.development.cjs.js');
4
+ var dist_xstateActors = require('./index-3d1368f7.development.cjs.js');
5
5
 
6
6
  function createSpawner(actorScope, actors, spawnedChildren) {
7
7
  return (src, options) => {
@@ -1,5 +1,5 @@
1
- import { S as STATE_DELIMITER, I as mapValues, t as toArray, J as createInvokeId, K as getDelayedTransitions, L as getEventDescriptorKey, M as getCandidates, N as evaluateCandidate, O as formatTransition, P as NULL_EVENT, Q as toTransitionConfigArray, R as createInvokeTimeoutEventId, T as matchesActorSession, U as formatRouteTransitions, V as resolveStateValue, W as getAllStateNodes, o as getStateNodes, Y as createMachineSnapshot, Z as isInFinalState, _ as createInertActorScope, $ as setInertActorScopeSnapshot, a0 as attachSnapshotActorRef, a1 as macrostep, a2 as isInertActorScope, a3 as setSnapshotActorRef, a4 as cloneMachineSnapshot, a5 as transitionNode, e as XSTATE_TIMER, m as matchesEventDescriptor, a6 as getTransitionResult, a7 as hasEffect, a8 as createErrorPlatformEvent, a9 as withActorSelf, r as resolveActionsWithContext, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, ac as toStatePath, ad as isStateId, ae as getStateNodeByPath, af as getPersistedSnapshot, ag as resolveReferencedActor, ah as createInvokeTimeoutEvent, ai as $$ACTOR_TYPE, j as createActor } from './createActor-19e83fb9.esm.js';
2
- import { g as assertValid } from './index-abf9ab72.esm.js';
1
+ import { S as STATE_DELIMITER, I as mapValues, t as toArray, J as createInvokeId, K as getDelayedTransitions, L as getEventDescriptorKey, M as getCandidates, N as evaluateCandidate, O as formatTransition, P as NULL_EVENT, Q as toTransitionConfigArray, R as createInvokeTimeoutEventId, T as matchesActorSession, U as formatRouteTransitions, V as resolveStateValue, W as getAllStateNodes, v as getStateNodes, Y as createMachineSnapshot, Z as isInFinalState, _ as createInertActorScope, $ as setInertActorScopeSnapshot, a0 as attachSnapshotActorRef, a1 as macrostep, a2 as isInertActorScope, a3 as setSnapshotActorRef, a4 as cloneMachineSnapshot, a5 as transitionNode, e as XSTATE_TIMER, m as matchesEventDescriptor, a6 as getTransitionResult, a7 as hasEffect, a8 as createErrorPlatformEvent, a9 as withActorSelf, r as resolveActionsWithContext, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, ac as toStatePath, ad as isStateId, ae as getStateNodeByPath, af as getPersistedSnapshot, ag as resolveReferencedActor, ah as createInvokeTimeoutEvent, ai as $$ACTOR_TYPE, j as createActor } from './createActor-a211c276.esm.js';
2
+ import { g as assertValid } from './index-7020402e.esm.js';
3
3
 
4
4
  function createSpawner(actorScope, actors, spawnedChildren) {
5
5
  return (src, options) => {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-fd53ec92.cjs.js');
4
- var dist_xstateActors = require('./index-13e54113.cjs.js');
3
+ var createActor = require('./createActor-d5305cc9.cjs.js');
4
+ var dist_xstateActors = require('./index-21d08fff.cjs.js');
5
5
 
6
6
  function createSpawner(actorScope, actors, spawnedChildren) {
7
7
  return (src, options) => {
@@ -1,5 +1,5 @@
1
- import { S as STATE_DELIMITER, I as mapValues, t as toArray, J as createInvokeId, K as getDelayedTransitions, L as getEventDescriptorKey, M as getCandidates, N as evaluateCandidate, O as formatTransition, P as NULL_EVENT, Q as toTransitionConfigArray, R as createInvokeTimeoutEventId, T as matchesActorSession, U as formatRouteTransitions, V as resolveStateValue, W as getAllStateNodes, o as getStateNodes, Y as createMachineSnapshot, Z as isInFinalState, _ as createInertActorScope, $ as setInertActorScopeSnapshot, a0 as attachSnapshotActorRef, a1 as macrostep, a2 as isInertActorScope, a3 as setSnapshotActorRef, a4 as cloneMachineSnapshot, a5 as transitionNode, e as XSTATE_TIMER, m as matchesEventDescriptor, a6 as getTransitionResult, a7 as hasEffect, a8 as createErrorPlatformEvent, a9 as withActorSelf, r as resolveActionsWithContext, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, ac as toStatePath, ad as isStateId, ae as getStateNodeByPath, af as getPersistedSnapshot, ag as resolveReferencedActor, ah as createInvokeTimeoutEvent, ai as $$ACTOR_TYPE, j as createActor } from './createActor-164c86f5.development.esm.js';
2
- import { g as assertValid } from './index-acf2bd02.development.esm.js';
1
+ import { S as STATE_DELIMITER, I as mapValues, t as toArray, J as createInvokeId, K as getDelayedTransitions, L as getEventDescriptorKey, M as getCandidates, N as evaluateCandidate, O as formatTransition, P as NULL_EVENT, Q as toTransitionConfigArray, R as createInvokeTimeoutEventId, T as matchesActorSession, U as formatRouteTransitions, V as resolveStateValue, W as getAllStateNodes, v as getStateNodes, Y as createMachineSnapshot, Z as isInFinalState, _ as createInertActorScope, $ as setInertActorScopeSnapshot, a0 as attachSnapshotActorRef, a1 as macrostep, a2 as isInertActorScope, a3 as setSnapshotActorRef, a4 as cloneMachineSnapshot, a5 as transitionNode, e as XSTATE_TIMER, m as matchesEventDescriptor, a6 as getTransitionResult, a7 as hasEffect, a8 as createErrorPlatformEvent, a9 as withActorSelf, r as resolveActionsWithContext, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, ac as toStatePath, ad as isStateId, ae as getStateNodeByPath, af as getPersistedSnapshot, ag as resolveReferencedActor, ah as createInvokeTimeoutEvent, ai as $$ACTOR_TYPE, j as createActor } from './createActor-2a03d4b2.development.esm.js';
2
+ import { g as assertValid } from './index-17f889df.development.esm.js';
3
3
 
4
4
  function createSpawner(actorScope, actors, spawnedChildren) {
5
5
  return (src, options) => {
@@ -669,6 +669,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
669
669
  if (actorSubscriptions) {
670
670
  Object.assign(props, {
671
671
  listen: (actor, eventType, mapper) => {
672
+ if (!createActors) {
673
+ return {
674
+ id: undefined
675
+ };
676
+ }
672
677
  const input = {
673
678
  actor,
674
679
  eventType,
@@ -682,6 +687,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
682
687
  return listenerActor;
683
688
  },
684
689
  subscribeTo: (actor, mappers) => {
690
+ if (!createActors) {
691
+ return {
692
+ id: undefined
693
+ };
694
+ }
685
695
  const normalizedMappers = typeof mappers === 'function' ? {
686
696
  snapshot: mappers
687
697
  } : mappers;
@@ -2804,7 +2814,7 @@ function getTransitionResult(transition, snapshot, event, actorScope, options) {
2804
2814
  if (transition.to) {
2805
2815
  const actions = [];
2806
2816
  const internalEvents = [];
2807
- const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, false, options?.resolveActions ?? true));
2817
+ const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, true, options?.resolveActions ?? true));
2808
2818
  const targets = res?.target ? resolveTarget(transition.source, toArray(res.target)) : undefined;
2809
2819
  const resolvedInput = res?.input ?? (typeof transition.input === 'function' ? transition.input({
2810
2820
  context: snapshot.context,
@@ -3027,7 +3037,9 @@ function getTransitionEffectEnqueue() {
3027
3037
  raise: triggerTransitionEffect,
3028
3038
  spawn: triggerTransitionEffect,
3029
3039
  sendTo: triggerTransitionEffect,
3030
- stop: triggerTransitionEffect
3040
+ stop: triggerTransitionEffect,
3041
+ listen: triggerTransitionEffect,
3042
+ subscribeTo: triggerTransitionEffect
3031
3043
  }, triggerTransitionEffect);
3032
3044
  }
3033
3045
  function evaluateTransitionFunction(transitionTo, context, event, snapshot, actorScope, sources, sourceId) {
@@ -4900,4 +4912,4 @@ function createActor(logic, options) {
4900
4912
  return new Actor(logic, options);
4901
4913
  }
4902
4914
 
4903
- export { setInertActorScopeSnapshot as $, Actor as A, createListenerLogic as B, listenerLogic as C, createSubscriptionLogic as D, subscriptionLogic as E, createInitEvent as F, createCustomEffect as G, createEmitEffect as H, mapValues as I, createInvokeId as J, getDelayedTransitions as K, getEventDescriptorKey as L, getCandidates as M, evaluateCandidate as N, formatTransition as O, NULL_EVENT as P, toTransitionConfigArray as Q, createInvokeTimeoutEventId as R, STATE_DELIMITER as S, matchesActorSession as T, formatRouteTransitions as U, resolveStateValue as V, getAllStateNodes as W, XSTATE_INIT as X, createMachineSnapshot as Y, isInFinalState as Z, createInertActorScope as _, XSTATE_STOP as a, attachSnapshotActorRef as a0, macrostep as a1, isInertActorScope as a2, setSnapshotActorRef as a3, cloneMachineSnapshot as a4, transitionNode as a5, getTransitionResult as a6, hasEffect as a7, createErrorPlatformEvent as a8, withActorSelf as a9, createSpawnEffect as aa, initialMicrostep as ab, toStatePath as ac, isStateId as ad, getStateNodeByPath as ae, getPersistedSnapshot as af, resolveReferencedActor as ag, createInvokeTimeoutEvent as ah, $$ACTOR_TYPE as ai, getProperAncestors as aj, getAllOwnEvents as ak, matchesEvent as al, builtInActions as b, createTransitionEnqueue as c, deriveDeferredStarts as d, XSTATE_TIMER as e, finalizeTransitionResult as f, createSendToEffect as g, isAtomicStateNode as h, isLazyActorScope as i, createActor as j, getInitialSnapshot as k, getNextSnapshot as l, matchesEventDescriptor as m, isMachineSnapshot as n, getStateNodes as o, parseDelayToMilliseconds as p, getAllOwnEventDescriptors as q, resolveActionsWithContext as r, matchesState as s, toArray as t, checkStateIn as u, pathToStateValue as v, withActorScope as w, toObserver as x, executeEffects as y, isBuiltInExecutableAction as z };
4915
+ export { setInertActorScopeSnapshot as $, Actor as A, pathToStateValue as B, toObserver as C, executeEffects as D, isBuiltInExecutableAction as E, createInitEvent as F, createCustomEffect as G, createEmitEffect as H, mapValues as I, createInvokeId as J, getDelayedTransitions as K, getEventDescriptorKey as L, getCandidates as M, evaluateCandidate as N, formatTransition as O, NULL_EVENT as P, toTransitionConfigArray as Q, createInvokeTimeoutEventId as R, STATE_DELIMITER as S, matchesActorSession as T, formatRouteTransitions as U, resolveStateValue as V, getAllStateNodes as W, XSTATE_INIT as X, createMachineSnapshot as Y, isInFinalState as Z, createInertActorScope as _, XSTATE_STOP as a, attachSnapshotActorRef as a0, macrostep as a1, isInertActorScope as a2, setSnapshotActorRef as a3, cloneMachineSnapshot as a4, transitionNode as a5, getTransitionResult as a6, hasEffect as a7, createErrorPlatformEvent as a8, withActorSelf as a9, createSpawnEffect as aa, initialMicrostep as ab, toStatePath as ac, isStateId as ad, getStateNodeByPath as ae, getPersistedSnapshot as af, resolveReferencedActor as ag, createInvokeTimeoutEvent as ah, $$ACTOR_TYPE as ai, getProperAncestors as aj, getAllOwnEvents as ak, matchesEvent as al, builtInActions as b, createTransitionEnqueue as c, deriveDeferredStarts as d, XSTATE_TIMER as e, finalizeTransitionResult as f, createSendToEffect as g, isAtomicStateNode as h, isLazyActorScope as i, createActor as j, createListenerLogic as k, createSubscriptionLogic as l, matchesEventDescriptor as m, listenerLogic as n, getInitialSnapshot as o, parseDelayToMilliseconds as p, getNextSnapshot as q, resolveActionsWithContext as r, subscriptionLogic as s, toArray as t, isMachineSnapshot as u, getStateNodes as v, withActorScope as w, getAllOwnEventDescriptors as x, matchesState as y, checkStateIn as z };
@@ -668,6 +668,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
668
668
  if (actorSubscriptions) {
669
669
  Object.assign(props, {
670
670
  listen: (actor, eventType, mapper) => {
671
+ if (!createActors) {
672
+ return {
673
+ id: undefined
674
+ };
675
+ }
671
676
  const input = {
672
677
  actor,
673
678
  eventType,
@@ -681,6 +686,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
681
686
  return listenerActor;
682
687
  },
683
688
  subscribeTo: (actor, mappers) => {
689
+ if (!createActors) {
690
+ return {
691
+ id: undefined
692
+ };
693
+ }
684
694
  const normalizedMappers = typeof mappers === 'function' ? {
685
695
  snapshot: mappers
686
696
  } : mappers;
@@ -2793,7 +2803,7 @@ function getTransitionResult(transition, snapshot, event, actorScope, options) {
2793
2803
  if (transition.to) {
2794
2804
  const actions = [];
2795
2805
  const internalEvents = [];
2796
- const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, false, options?.resolveActions ?? true));
2806
+ const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, true, options?.resolveActions ?? true));
2797
2807
  const targets = res?.target ? resolveTarget(transition.source, toArray(res.target)) : undefined;
2798
2808
  const resolvedInput = res?.input ?? (typeof transition.input === 'function' ? transition.input({
2799
2809
  context: snapshot.context,
@@ -3016,7 +3026,9 @@ function getTransitionEffectEnqueue() {
3016
3026
  raise: triggerTransitionEffect,
3017
3027
  spawn: triggerTransitionEffect,
3018
3028
  sendTo: triggerTransitionEffect,
3019
- stop: triggerTransitionEffect
3029
+ stop: triggerTransitionEffect,
3030
+ listen: triggerTransitionEffect,
3031
+ subscribeTo: triggerTransitionEffect
3020
3032
  }, triggerTransitionEffect);
3021
3033
  }
3022
3034
  function evaluateTransitionFunction(transitionTo, context, event, snapshot, actorScope, sources, sourceId) {
@@ -4861,4 +4873,4 @@ function createActor(logic, options) {
4861
4873
  return new Actor(logic, options);
4862
4874
  }
4863
4875
 
4864
- export { setInertActorScopeSnapshot as $, Actor as A, createListenerLogic as B, listenerLogic as C, createSubscriptionLogic as D, subscriptionLogic as E, createInitEvent as F, createCustomEffect as G, createEmitEffect as H, mapValues as I, createInvokeId as J, getDelayedTransitions as K, getEventDescriptorKey as L, getCandidates as M, evaluateCandidate as N, formatTransition as O, NULL_EVENT as P, toTransitionConfigArray as Q, createInvokeTimeoutEventId as R, STATE_DELIMITER as S, matchesActorSession as T, formatRouteTransitions as U, resolveStateValue as V, getAllStateNodes as W, XSTATE_INIT as X, createMachineSnapshot as Y, isInFinalState as Z, createInertActorScope as _, XSTATE_STOP as a, attachSnapshotActorRef as a0, macrostep as a1, isInertActorScope as a2, setSnapshotActorRef as a3, cloneMachineSnapshot as a4, transitionNode as a5, getTransitionResult as a6, hasEffect as a7, createErrorPlatformEvent as a8, withActorSelf as a9, createSpawnEffect as aa, initialMicrostep as ab, toStatePath as ac, isStateId as ad, getStateNodeByPath as ae, getPersistedSnapshot as af, resolveReferencedActor as ag, createInvokeTimeoutEvent as ah, $$ACTOR_TYPE as ai, getProperAncestors as aj, getAllOwnEvents as ak, matchesEvent as al, builtInActions as b, createTransitionEnqueue as c, deriveDeferredStarts as d, XSTATE_TIMER as e, finalizeTransitionResult as f, createSendToEffect as g, isAtomicStateNode as h, isLazyActorScope as i, createActor as j, getInitialSnapshot as k, getNextSnapshot as l, matchesEventDescriptor as m, isMachineSnapshot as n, getStateNodes as o, parseDelayToMilliseconds as p, getAllOwnEventDescriptors as q, resolveActionsWithContext as r, matchesState as s, toArray as t, checkStateIn as u, pathToStateValue as v, withActorScope as w, toObserver as x, executeEffects as y, isBuiltInExecutableAction as z };
4876
+ export { setInertActorScopeSnapshot as $, Actor as A, pathToStateValue as B, toObserver as C, executeEffects as D, isBuiltInExecutableAction as E, createInitEvent as F, createCustomEffect as G, createEmitEffect as H, mapValues as I, createInvokeId as J, getDelayedTransitions as K, getEventDescriptorKey as L, getCandidates as M, evaluateCandidate as N, formatTransition as O, NULL_EVENT as P, toTransitionConfigArray as Q, createInvokeTimeoutEventId as R, STATE_DELIMITER as S, matchesActorSession as T, formatRouteTransitions as U, resolveStateValue as V, getAllStateNodes as W, XSTATE_INIT as X, createMachineSnapshot as Y, isInFinalState as Z, createInertActorScope as _, XSTATE_STOP as a, attachSnapshotActorRef as a0, macrostep as a1, isInertActorScope as a2, setSnapshotActorRef as a3, cloneMachineSnapshot as a4, transitionNode as a5, getTransitionResult as a6, hasEffect as a7, createErrorPlatformEvent as a8, withActorSelf as a9, createSpawnEffect as aa, initialMicrostep as ab, toStatePath as ac, isStateId as ad, getStateNodeByPath as ae, getPersistedSnapshot as af, resolveReferencedActor as ag, createInvokeTimeoutEvent as ah, $$ACTOR_TYPE as ai, getProperAncestors as aj, getAllOwnEvents as ak, matchesEvent as al, builtInActions as b, createTransitionEnqueue as c, deriveDeferredStarts as d, XSTATE_TIMER as e, finalizeTransitionResult as f, createSendToEffect as g, isAtomicStateNode as h, isLazyActorScope as i, createActor as j, createListenerLogic as k, createSubscriptionLogic as l, matchesEventDescriptor as m, listenerLogic as n, getInitialSnapshot as o, parseDelayToMilliseconds as p, getNextSnapshot as q, resolveActionsWithContext as r, subscriptionLogic as s, toArray as t, isMachineSnapshot as u, getStateNodes as v, withActorScope as w, getAllOwnEventDescriptors as x, matchesState as y, checkStateIn as z };
@@ -671,6 +671,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
671
671
  if (actorSubscriptions) {
672
672
  Object.assign(props, {
673
673
  listen: (actor, eventType, mapper) => {
674
+ if (!createActors) {
675
+ return {
676
+ id: undefined
677
+ };
678
+ }
674
679
  const input = {
675
680
  actor,
676
681
  eventType,
@@ -684,6 +689,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
684
689
  return listenerActor;
685
690
  },
686
691
  subscribeTo: (actor, mappers) => {
692
+ if (!createActors) {
693
+ return {
694
+ id: undefined
695
+ };
696
+ }
687
697
  const normalizedMappers = typeof mappers === 'function' ? {
688
698
  snapshot: mappers
689
699
  } : mappers;
@@ -2806,7 +2816,7 @@ function getTransitionResult(transition, snapshot, event, actorScope, options) {
2806
2816
  if (transition.to) {
2807
2817
  const actions = [];
2808
2818
  const internalEvents = [];
2809
- const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, false, options?.resolveActions ?? true));
2819
+ const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, true, options?.resolveActions ?? true));
2810
2820
  const targets = res?.target ? resolveTarget(transition.source, toArray(res.target)) : undefined;
2811
2821
  const resolvedInput = res?.input ?? (typeof transition.input === 'function' ? transition.input({
2812
2822
  context: snapshot.context,
@@ -3029,7 +3039,9 @@ function getTransitionEffectEnqueue() {
3029
3039
  raise: triggerTransitionEffect,
3030
3040
  spawn: triggerTransitionEffect,
3031
3041
  sendTo: triggerTransitionEffect,
3032
- stop: triggerTransitionEffect
3042
+ stop: triggerTransitionEffect,
3043
+ listen: triggerTransitionEffect,
3044
+ subscribeTo: triggerTransitionEffect
3033
3045
  }, triggerTransitionEffect);
3034
3046
  }
3035
3047
  function evaluateTransitionFunction(transitionTo, context, event, snapshot, actorScope, sources, sourceId) {
@@ -670,6 +670,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
670
670
  if (actorSubscriptions) {
671
671
  Object.assign(props, {
672
672
  listen: (actor, eventType, mapper) => {
673
+ if (!createActors) {
674
+ return {
675
+ id: undefined
676
+ };
677
+ }
673
678
  const input = {
674
679
  actor,
675
680
  eventType,
@@ -683,6 +688,11 @@ function createTransitionEnqueue(actorScope, actions, internalEvents, actorSubsc
683
688
  return listenerActor;
684
689
  },
685
690
  subscribeTo: (actor, mappers) => {
691
+ if (!createActors) {
692
+ return {
693
+ id: undefined
694
+ };
695
+ }
686
696
  const normalizedMappers = typeof mappers === 'function' ? {
687
697
  snapshot: mappers
688
698
  } : mappers;
@@ -2795,7 +2805,7 @@ function getTransitionResult(transition, snapshot, event, actorScope, options) {
2795
2805
  if (transition.to) {
2796
2806
  const actions = [];
2797
2807
  const internalEvents = [];
2798
- const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, false, options?.resolveActions ?? true));
2808
+ const res = options?.selectionResult?.reusable ? options.selectionResult.result : transition.to(getTransitionArgs(), createTransitionEnqueue(actorScope, actions, internalEvents, true, options?.resolveActions ?? true));
2799
2809
  const targets = res?.target ? resolveTarget(transition.source, toArray(res.target)) : undefined;
2800
2810
  const resolvedInput = res?.input ?? (typeof transition.input === 'function' ? transition.input({
2801
2811
  context: snapshot.context,
@@ -3018,7 +3028,9 @@ function getTransitionEffectEnqueue() {
3018
3028
  raise: triggerTransitionEffect,
3019
3029
  spawn: triggerTransitionEffect,
3020
3030
  sendTo: triggerTransitionEffect,
3021
- stop: triggerTransitionEffect
3031
+ stop: triggerTransitionEffect,
3032
+ listen: triggerTransitionEffect,
3033
+ subscribeTo: triggerTransitionEffect
3022
3034
  }, triggerTransitionEffect);
3023
3035
  }
3024
3036
  function evaluateTransitionFunction(transitionTo, context, event, snapshot, actorScope, sources, sourceId) {
@@ -1,6 +1,6 @@
1
1
  import { StandardSchemaV1 } from "./schema.types.js";
2
2
  import { StateMachine } from "./StateMachine.js";
3
- import { AnyActorRef, EventObject, AnyEventObject, Cast, MachineContext, ProvidedActor, StateValue, ToChildren, MetaObject, StateSchema, DoNotInfer, RoutableStateId, Compute } from "./types.js";
3
+ import { AnyActorRef, EventObject, AnyEventObject, Cast, MachineContext, ProvidedActor, StateValueFromStateSchema, ToChildren, MetaObject, StateSchema, DoNotInfer, RoutableStateId, Compute } from "./types.js";
4
4
  import { Sources, DelayMapFromNames, InferChildren, InferOutput, InferEvents, 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> = {
@@ -61,7 +61,7 @@ export declare function createMachine<TContextSchema extends StandardSchemaV1, c
61
61
  } & ValidateTopLevelFinalOutputs<TSS, InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap>>): StateMachine<InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap> | ([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>>, StateValue, TTag & string, TInput, InferOutput<TOutputSchema, unknown>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
64
+ }), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput, InferOutput<TOutputSchema, unknown>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
65
65
  TSS, // TStateSchema
66
66
  TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>> & {
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>>): StateMachine<WidenLiterals<TContext>, InferEvents<TEventSchemaMap> | ([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>>, StateValue, TTag & string, TInput, InferOutput<TOutputSchema, unknown>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
82
+ }), Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<TSS>, TTag & string, TInput, InferOutput<TOutputSchema, unknown>, WithDefault<InferEvents<TEmittedSchemaMap>, AnyEventObject>, InferOutput<TMetaSchema, MetaObject>, // TMeta
83
83
  TSS, // TStateSchema
84
84
  TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>> & {
85
85
  states: TSS;
@@ -1,4 +1,4 @@
1
- export * from "./actors/index.js";
1
+ export { createAsyncLogic, createCallbackLogic, createEmptyActor, createEventObservableLogic, createListenerLogic, createLogic, createObservableLogic, createSubscriptionLogic, listenerLogic, subscriptionLogic, TimeoutError, type AsyncActorLogic, type AsyncActorRef, type AsyncLogicArgs, type AsyncLogicConfig, type AsyncLogicEnqueue, type AsyncLogicFunction, type AsyncSnapshot, type CallbackActorLogic, type CallbackActorRef, type CallbackLogicConfig, type CallbackLogicFunction, type CallbackSnapshot, type EventObservableLogicConfig, type EventObservableLogicFunction, type ListenerActorLogic, type ListenerActorRef, type ListenerInput, type ListenerSnapshot, type LogicActorLogic, type LogicActorRef, type LogicArgs, type LogicConfig, type LogicEffect, type LogicEffectState, type LogicEnqueue, type LogicFunction, type LogicPatch, type LogicSnapshot, type ObservableActorLogic, type ObservableActorRef, type ObservableLogicConfig, type ObservableLogicFunction, type ObservableSnapshot, type SubscriptionActorLogic, type SubscriptionActorRef, type SubscriptionInput, type SubscriptionMappers, type SubscriptionSnapshot } from "./actors/index.js";
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";
@@ -22,7 +22,8 @@ export { StateNode } from "./StateNode.js";
22
22
  export { getStateNodes } from "./stateUtils.js";
23
23
  export type { ActorSystem, ActorSystemRuntime, AnyActorSystem } from "./system.js";
24
24
  export { toPromise } from "./toPromise.js";
25
- export * from "./types.js";
25
+ export type * from "./types.js";
26
+ export { SpecialTargets } from "./types.js";
26
27
  export type { Next_MachineConfig as MachineConfig, Next_StateNodeConfig as StateNodeConfig, Next_InvokeConfig as InvokeConfig, Next_TransitionConfigOrTarget as TransitionConfigOrTarget, Sources, InferEvents, WidenLiterals } from "./types.v6.js";
27
28
  export { getAllOwnEventDescriptors as __unsafe_getAllOwnEventDescriptors, matchesState, checkStateIn, pathToStateValue, toObserver } from "./utils.js";
28
29
  export { transition, initialTransition, getMicrosteps, getInitialMicrosteps, getNextTransitions } from "./transition.js";
@@ -2,7 +2,7 @@ import { SetupStateSchemas, StandardSchemaV1 } from "./schema.types.js";
2
2
  import type { ActorLogicValidator } from "./validation.types.js";
3
3
  import { StateMachine } from "./StateMachine.js";
4
4
  import { type Actor, type RequiredActorOptionsKeys } from "./createActor.js";
5
- import { AnyActorRef, AnyActorLogic, ActorRefFromLogic, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, ToChildren, MetaObject, Cast, Compute, EnqueueObject, DoneActorEvent, DoneStateEvent, ErrorActorEvent, SystemRegistry, RegistryKeyForLogic, ActorOptions, Observer, Subscription, OutputArg, SnapshotEvent, SingleOrArray, AfterEvent, TimeoutEvent, ErrorEvent } from "./types.js";
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
8
  import { ActionSchemas, DelayMapFromNames, GuardSchemas, InferChildren, InferActions, InferGuards, Sources, InferOutput, InferEvents, Next_MachineConfig, Next_InvokeConfig, Next_StateNodeConfig, Next_TransitionConfigOrTarget, ValidateHistoryDefaults, ValidateStateTargets, WithDefault } from "./types.v6.js";
@@ -47,6 +47,9 @@ type RuntimeValidationConstraint<TSchemas, TStates, TValidator> = [
47
47
  schemas?: ValidateSetupSchemas<TSchemas>;
48
48
  states?: ValidateSetupStates<TStates>;
49
49
  } : unknown;
50
+ type RuntimeValidationCompatibility<TSchemas, TStates, TValidator> = [
51
+ TValidator
52
+ ] extends [ActorLogicValidator] ? [TSchemas] extends [ValidateSetupSchemas<TSchemas>] ? [TStates] extends [ValidateSetupStates<TStates>] ? unknown : RuntimeValidationDoesNotSupportTransformingSchemas : RuntimeValidationDoesNotSupportTransformingSchemas : unknown;
50
53
  declare const inheritedValidator: unique symbol;
51
54
  type InheritedValidator = typeof inheritedValidator;
52
55
  type ResolveExtendedValidator<TBase, TExtension> = [TExtension] extends [
@@ -59,9 +62,7 @@ type ExtendValidatorConfig<TExtension> = [TExtension] extends [
59
62
  } : {
60
63
  validator: TExtension;
61
64
  };
62
- type SetupExtensionConfig<TBaseSchemas, TBaseStates, TBaseValidator, TExtendSchemas extends SetupSchemas, TExtendStates extends Record<string, SetupStateSchema>, TExtendActionMap extends Sources['actions'], TExtendActorMap extends Sources['actors'], TExtendGuardMap extends Sources['guards'], TExtendDelayMap extends Sources['delays'], TExtendValidator extends ActorLogicValidator | undefined | InheritedValidator> = Omit<SetupConfig<TExtendSchemas, TExtendStates, TExtendActionMap, TExtendActorMap, TExtendGuardMap, TExtendDelayMap>, 'validator'> & ExtendValidatorConfig<TExtendValidator> & (TBaseValidator extends ActorLogicValidator ? unknown : {
63
- validator?: never;
64
- }) & RuntimeValidationConstraint<NoInfer<TBaseSchemas>, NoInfer<TBaseStates>, ResolveExtendedValidator<TBaseValidator, TExtendValidator>> & RuntimeValidationConstraint<NoInfer<TExtendSchemas>, NoInfer<TExtendStates>, ResolveExtendedValidator<TBaseValidator, TExtendValidator>>;
65
+ type SetupExtensionConfig<TBaseSchemas, TBaseStates, TBaseValidator, TExtendSchemas extends SetupSchemas, TExtendStates extends Record<string, SetupStateSchema>, TExtendActionMap extends Sources['actions'], TExtendActorMap extends Sources['actors'], TExtendGuardMap extends Sources['guards'], TExtendDelayMap extends Sources['delays'], TExtendValidator extends ActorLogicValidator | undefined | InheritedValidator> = Omit<SetupConfig<TExtendSchemas, TExtendStates, TExtendActionMap, TExtendActorMap, TExtendGuardMap, TExtendDelayMap>, 'validator'> & ExtendValidatorConfig<TExtendValidator> & RuntimeValidationCompatibility<NoInfer<TBaseSchemas>, NoInfer<TBaseStates>, ResolveExtendedValidator<TBaseValidator, TExtendValidator>> & RuntimeValidationConstraint<NoInfer<TExtendSchemas>, NoInfer<TExtendStates>, ResolveExtendedValidator<TBaseValidator, TExtendValidator>>;
65
66
  type InlineMachineSchemas<TContextSchema, TEventSchemaMap, TEmittedSchemaMap, TActionSchemaMap, TGuardSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap> = {
66
67
  context?: TContextSchema;
67
68
  events?: TEventSchemaMap;
@@ -463,7 +464,7 @@ export interface SetupReturn<TStates extends Record<string, SetupStateSchema> =
463
464
  } & TConfig & RuntimeValidationConstraint<NoInfer<MachineConfigSchemas<TConfig>>, NoInfer<MachineConfigStates<TConfig>>, TValidator> & ValidateSetupDelayReferences<TConfig, TSetupDelays> & ValidateHistoryDefaults<TConfig> & ValidateStateTargets<TConfig> & ValidateRegistryKeys<TConfig, TSystemRegistry, MergeSourceMaps<TSetupActorMap, TActorMap>>): StateMachine<SetupContext<TSchemas, TContextSchema>, SetupEvents<TSchemas, TEventSchemaMap> | ([RoutableStateId<Cast<TConfig, StateSchema>>] extends [never] ? never : {
464
465
  type: 'xstate.route';
465
466
  to: RoutableStateId<Cast<TConfig, StateSchema>>;
466
- }), Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValue, TTag & string, [
467
+ }), Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<MergeStateSchema<Cast<TConfig, StateSchema>, SetupStatesToStateSchema<TStates>>>, TTag & string, [
467
468
  SetupSchema<TSchemas, 'input'>
468
469
  ] extends [never] ? TInput : SetupInput<TSchemas, TInputSchema>, SetupOutput<TSchemas, TOutputSchema>, 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>>> & MachineIdentity<TConfig>;
469
470
  /**
@@ -497,9 +498,16 @@ type SetupConfigGuards<TConfig> = TConfig extends {
497
498
  type SetupConfigDelays<TConfig> = TConfig extends {
498
499
  delays?: infer TDelays;
499
500
  } ? TDelays extends Sources['delays'] ? TDelays : {} : {};
500
- export type SetupReturnFromConfig<TConfig extends AnySetupConfig> = SetupReturn<SetupConfigStates<TConfig>, SetupConfigSchemas<TConfig>, SetupConfigActions<TConfig>, SetupConfigActors<TConfig>, SetupConfigGuards<TConfig>, SetupConfigDelays<TConfig>, Extract<keyof SetupConfigDelays<TConfig>, string>, SystemRegistry, TConfig extends {
501
+ export type SetupReturnFromConfig<TConfig extends AnySetupConfig, TSystemRegistry extends SystemRegistry = SystemRegistry> = SetupReturn<SetupConfigStates<TConfig>, SetupConfigSchemas<TConfig>, SetupConfigActions<TConfig>, SetupConfigActors<TConfig>, SetupConfigGuards<TConfig>, SetupConfigDelays<TConfig>, Extract<keyof SetupConfigDelays<TConfig>, string>, TSystemRegistry, TConfig extends {
501
502
  validator: infer TValidator extends ActorLogicValidator;
502
503
  } ? TValidator : undefined>;
504
+ type SetupFunction<TSystemRegistry extends SystemRegistry = SystemRegistry> = {
505
+ (): SetupReturn<Record<string, SetupStateSchema>, {}, {}, {}, {}, {}, never, TSystemRegistry>;
506
+ <const TSchemas extends SetupSchemas = {}, const TStates extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>, TActionMap extends Sources['actions'] = {}, TActorMap extends Sources['actors'] = {}, TGuardMap extends Sources['guards'] = {}, TDelayMap extends Sources['delays'] = {}, const TValidator extends ActorLogicValidator | undefined = undefined>(config: SetupConfig<TSchemas, TStates, TActionMap, TActorMap, TGuardMap, TDelayMap, TValidator> & RuntimeValidationConstraint<NoInfer<TSchemas>, NoInfer<TStates>, TValidator>): SetupReturn<TStates, TSchemas, TActionMap, TActorMap, TGuardMap, TDelayMap, Extract<keyof TDelayMap, string>, TSystemRegistry, TValidator>;
507
+ <const TConfig extends AnySetupConfig>(config: TConfig & RuntimeValidationConstraint<NoInfer<SetupConfigSchemas<TConfig>>, NoInfer<SetupConfigStates<TConfig>>, TConfig extends {
508
+ validator: infer TValidator;
509
+ } ? TValidator : undefined>): SetupReturnFromConfig<TConfig, TSystemRegistry>;
510
+ };
503
511
  /**
504
512
  * Sets up a state machine with state input schemas and other configuration.
505
513
  *
@@ -536,11 +544,7 @@ export type SetupReturnFromConfig<TConfig extends AnySetupConfig> = SetupReturn<
536
544
  * });
537
545
  * ```
538
546
  */
539
- export declare function setup(): SetupReturn;
540
- export declare function setup<const TSchemas extends SetupSchemas = {}, const TStates extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>, TActionMap extends Sources['actions'] = {}, TActorMap extends Sources['actors'] = {}, TGuardMap extends Sources['guards'] = {}, TDelayMap extends Sources['delays'] = {}, const TValidator extends ActorLogicValidator | undefined = undefined>(config: SetupConfig<TSchemas, TStates, TActionMap, TActorMap, TGuardMap, TDelayMap, TValidator> & RuntimeValidationConstraint<NoInfer<TSchemas>, NoInfer<TStates>, TValidator>): SetupReturn<TStates, TSchemas, TActionMap, TActorMap, TGuardMap, TDelayMap, Extract<keyof TDelayMap, string>, SystemRegistry, TValidator>;
541
- export declare function setup<const TConfig extends AnySetupConfig>(config: TConfig & RuntimeValidationConstraint<NoInfer<SetupConfigSchemas<TConfig>>, NoInfer<SetupConfigStates<TConfig>>, TConfig extends {
542
- validator: infer TValidator;
543
- } ? TValidator : undefined>): SetupReturnFromConfig<TConfig>;
547
+ export declare const setup: SetupFunction;
544
548
  type SystemBuilder<TSystemRegistry extends SystemRegistry> = {
545
549
  createActor<TLogic extends AnyActorLogic>(logic: TLogic, options?: Omit<ActorOptions<TLogic>, 'registryKey'> & {
546
550
  registryKey?: RegistryKeyForLogic<TLogic, TSystemRegistry>;
@@ -550,6 +554,6 @@ type SystemBuilder<TSystemRegistry extends SystemRegistry> = {
550
554
  get: SystemRuntime<TSystemRegistry>['get'];
551
555
  getAll: SystemRuntime<TSystemRegistry>['getAll'];
552
556
  inspect(observer: Observer<InspectionEvent> | ((inspectionEvent: InspectionEvent) => void)): Subscription;
553
- setup<const TSchemas extends SetupSchemas = {}, const TStates extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>, TActionMap extends Sources['actions'] = {}, TActorMap extends Sources['actors'] = {}, TGuardMap extends Sources['guards'] = {}, TDelayMap extends Sources['delays'] = {}>(config?: SetupConfig<TSchemas, TStates, TActionMap, TActorMap, TGuardMap, TDelayMap>): SetupReturn<TStates, TSchemas, TActionMap, TActorMap, TGuardMap, TDelayMap, Extract<keyof TDelayMap, string>, TSystemRegistry>;
557
+ setup: SetupFunction<TSystemRegistry>;
554
558
  };
555
559
  export declare function createSystem<const TSystemRegistry extends SystemRegistry = {}>(_config?: SystemConfig<TSystemRegistry>): SystemBuilder<TSystemRegistry>;
@@ -400,7 +400,7 @@ export type PersistedHistoryValue = Record<string, Array<{
400
400
  }>>;
401
401
  export type AnyHistoryValue = HistoryValue;
402
402
  export type StateFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = T extends AnyStateMachine ? StateSnapshotFromMachine<T> : T extends (...args: any[]) => AnyStateMachine ? StateSnapshotFromMachine<ReturnType<T>> : never;
403
- type StateValueFromStateSchema<T extends StateSchema> = StateSchema extends T ? StateValue : ToStateValue<T> extends infer TStateValue ? TStateValue extends StateValue ? TStateValue : StateValue : StateValue;
403
+ export type StateValueFromStateSchema<T extends StateSchema> = StateSchema extends T ? StateValue : ToStateValue<T> extends infer TStateValue ? TStateValue extends StateValue ? TStateValue : StateValue : StateValue;
404
404
  type MatchingStateValueForStateFrom<TStateValue extends StateValue, TTestStateValue extends StateValue> = TStateValue extends unknown ? TTestStateValue extends string ? TStateValue extends string ? TTestStateValue extends TStateValue ? TTestStateValue : Extract<TStateValue, TTestStateValue> : TStateValue extends StateValueMap ? TStateValue & Record<TTestStateValue, StateValue | undefined> : never : TTestStateValue extends StateValueMap ? TStateValue extends StateValueMap ? MatchingStateValueMapForStateFrom<TStateValue, TTestStateValue> : never : never : never;
405
405
  type MatchingStateValueMapForStateFrom<TStateValue extends StateValueMap, TTestStateValue extends StateValueMap> = false extends {
406
406
  [K in keyof TTestStateValue & string]: K extends keyof TStateValue ? IsNever<MatchingStateValueForStateFrom<NonNullable<TStateValue[K]>, NonNullable<TTestStateValue[K]>>> extends true ? false : true : false;
@@ -1,4 +1,4 @@
1
- import { SetupStateSchemas, StandardSchemaV1 } from "./schema.types.js";
1
+ import { SetupStateSchemas, StandardSchemaV1, TypeSchema } from "./schema.types.js";
2
2
  import { MachineSnapshot } from "./State.js";
3
3
  import { Action, ActorTimeoutEvent, AfterEvent, ActorLogic, ActorRef, ActorRefFromLogic, ActorSelf, AnyActorLogic, AnyActorRef, Compute, DoneActorEvent, DoNotInfer, ErrorActorEvent, EventDescriptor, ErrorEvent, EventObject, EventPayloadPattern, ExtractEvent, InitialContext, InputFrom, IsNever, MetaObject, NonReducibleUnknown, OutputFrom, SingleOrArray, SnapshotEvent, StateValue, TODO, TransitionContextMapper, TransitionContextPatch, TransitionConfigFunction, Values, AnyStateNode, SystemRegistry, TimeoutEvent } from "./types.js";
4
4
  import { MachineContext, Mapper } from "./types.js";
@@ -8,7 +8,9 @@ export type InferOutput<T extends StandardSchemaV1, U> = Compute<StandardSchemaV
8
8
  /**
9
9
  * Event payloads from schemas (e.g. Zod) are often inferred as optional in
10
10
  * output types. Wrapping in Required<> ensures properties defined in the schema
11
- * are required on the event.
11
+ * are required on the event. Type-only schemas created with the `types()`
12
+ * helper are exempt: their declared type is authoritative, so optional
13
+ * properties stay optional.
12
14
  */
13
15
  export type InferEvents<TEventSchemaMap extends Record<string, StandardSchemaV1>> = Values<{
14
16
  [K in keyof TEventSchemaMap & string]: StandardSchemaV1.InferOutput<TEventSchemaMap[K]> extends infer O ? [O] extends [never] ? never : unknown extends O ? O & {
@@ -17,12 +19,17 @@ export type InferEvents<TEventSchemaMap extends Record<string, StandardSchemaV1>
17
19
  type: K;
18
20
  } : string extends keyof O ? [O[string]] extends [never] ? {
19
21
  type: K;
20
- } : Required<O> & {
22
+ } : NormalizeEventPayload<TEventSchemaMap[K], O> & {
21
23
  type: K;
22
- } : Required<O> & {
24
+ } : NormalizeEventPayload<TEventSchemaMap[K], O> & {
23
25
  type: K;
24
26
  } : never;
25
27
  }>;
28
+ /**
29
+ * Keeps a type-only schema's payload verbatim; applies Required<> to payloads
30
+ * from validator libraries (see {@link InferEvents}).
31
+ */
32
+ type NormalizeEventPayload<TSchema extends StandardSchemaV1, O> = TSchema extends TypeSchema<any> ? O : Required<O>;
26
33
  export type InferChildren<TChildrenSchemaMap extends Record<string, StandardSchemaV1>> = string extends keyof TChildrenSchemaMap ? {} : {
27
34
  [K in keyof TChildrenSchemaMap & string]?: StandardSchemaV1.InferOutput<TChildrenSchemaMap[K]> extends AnyActorRef ? NormalizeActorRef<StandardSchemaV1.InferOutput<TChildrenSchemaMap[K]>> : never;
28
35
  };
@@ -1,4 +1,4 @@
1
- import { F as createInitEvent, a as XSTATE_STOP, G as createCustomEffect, f as finalizeTransitionResult, H as createEmitEffect, g as createSendToEffect, X as XSTATE_INIT, p as parseDelayToMilliseconds, j as createActor } from './createActor-164c86f5.development.esm.js';
1
+ import { F as createInitEvent, a as XSTATE_STOP, G as createCustomEffect, f as finalizeTransitionResult, H as createEmitEffect, g as createSendToEffect, X as XSTATE_INIT, p as parseDelayToMilliseconds, j as createActor } from './createActor-2a03d4b2.development.esm.js';
2
2
 
3
3
  function assertValid(validator, request) {
4
4
  const error = validator.check(request);
@@ -973,4 +973,4 @@ function createEmptyActor() {
973
973
  return createActor(emptyLogic);
974
974
  }
975
975
 
976
- export { TimeoutError as T, createCallbackLogic as a, createObservableLogic as b, createEmptyActor as c, createEventObservableLogic as d, createLogic as e, createAsyncLogic as f, assertValid as g };
976
+ export { TimeoutError as T, createCallbackLogic as a, createEmptyActor as b, createAsyncLogic as c, createEventObservableLogic as d, createLogic as e, createObservableLogic as f, assertValid as g };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-fd53ec92.cjs.js');
3
+ var createActor = require('./createActor-d5305cc9.cjs.js');
4
4
 
5
5
  function assertValid(validator, request) {
6
6
  const error = validator.check(request);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-8462b9cc.development.cjs.js');
3
+ var createActor = require('./createActor-c0f78b8a.development.cjs.js');
4
4
 
5
5
  function assertValid(validator, request) {
6
6
  const error = validator.check(request);
@@ -1,4 +1,4 @@
1
- import { F as createInitEvent, a as XSTATE_STOP, G as createCustomEffect, f as finalizeTransitionResult, H as createEmitEffect, g as createSendToEffect, X as XSTATE_INIT, p as parseDelayToMilliseconds, j as createActor } from './createActor-19e83fb9.esm.js';
1
+ import { F as createInitEvent, a as XSTATE_STOP, G as createCustomEffect, f as finalizeTransitionResult, H as createEmitEffect, g as createSendToEffect, X as XSTATE_INIT, p as parseDelayToMilliseconds, j as createActor } from './createActor-a211c276.esm.js';
2
2
 
3
3
  function assertValid(validator, request) {
4
4
  const error = validator.check(request);
@@ -973,4 +973,4 @@ function createEmptyActor() {
973
973
  return createActor(emptyLogic);
974
974
  }
975
975
 
976
- export { TimeoutError as T, createCallbackLogic as a, createObservableLogic as b, createEmptyActor as c, createEventObservableLogic as d, createLogic as e, createAsyncLogic as f, assertValid as g };
976
+ export { TimeoutError as T, createCallbackLogic as a, createEmptyActor as b, createAsyncLogic as c, createEventObservableLogic as d, createLogic as e, createObservableLogic as f, assertValid as g };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-fd53ec92.cjs.js');
3
+ var createActor = require('./createActor-d5305cc9.cjs.js');
4
4
 
5
5
  function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
6
6
  if (!microsteps.length) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createActor = require('./createActor-8462b9cc.development.cjs.js');
3
+ var createActor = require('./createActor-c0f78b8a.development.cjs.js');
4
4
 
5
5
  function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
6
6
  if (!microsteps.length) {
@@ -1,4 +1,4 @@
1
- import { _ as createInertActorScope, $ as setInertActorScopeSnapshot, f as finalizeTransitionResult, a0 as attachSnapshotActorRef, a1 as macrostep, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, h as isAtomicStateNode, aj as getProperAncestors } from './createActor-19e83fb9.esm.js';
1
+ import { _ as createInertActorScope, $ as setInertActorScopeSnapshot, f as finalizeTransitionResult, a0 as attachSnapshotActorRef, a1 as macrostep, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, h as isAtomicStateNode, aj as getProperAncestors } from './createActor-a211c276.esm.js';
2
2
 
3
3
  function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
4
4
  if (!microsteps.length) {
@@ -1,4 +1,4 @@
1
- import { _ as createInertActorScope, $ as setInertActorScopeSnapshot, f as finalizeTransitionResult, a0 as attachSnapshotActorRef, a1 as macrostep, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, h as isAtomicStateNode, aj as getProperAncestors } from './createActor-164c86f5.development.esm.js';
1
+ import { _ as createInertActorScope, $ as setInertActorScopeSnapshot, f as finalizeTransitionResult, a0 as attachSnapshotActorRef, a1 as macrostep, F as createInitEvent, aa as createSpawnEffect, ab as initialMicrostep, h as isAtomicStateNode, aj as getProperAncestors } from './createActor-2a03d4b2.development.esm.js';
2
2
 
3
3
  function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
4
4
  if (!microsteps.length) {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createActor = require('./createActor-fd53ec92.cjs.js');
6
- var dist_xstateActors = require('./index-13e54113.cjs.js');
5
+ var createActor = require('./createActor-d5305cc9.cjs.js');
6
+ var dist_xstateActors = require('./index-21d08fff.cjs.js');
7
7
 
8
8
 
9
9
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createActor = require('./createActor-8462b9cc.development.cjs.js');
6
- var dist_xstateActors = require('./index-14478488.development.cjs.js');
5
+ var createActor = require('./createActor-c0f78b8a.development.cjs.js');
6
+ var dist_xstateActors = require('./index-3d1368f7.development.cjs.js');
7
7
 
8
8
 
9
9
 
@@ -1,2 +1,2 @@
1
- export { B as createListenerLogic, D as createSubscriptionLogic, C as listenerLogic, E as subscriptionLogic } from './createActor-164c86f5.development.esm.js';
2
- export { T as TimeoutError, f as createAsyncLogic, a as createCallbackLogic, c as createEmptyActor, d as createEventObservableLogic, e as createLogic, b as createObservableLogic } from './index-acf2bd02.development.esm.js';
1
+ export { k as createListenerLogic, l as createSubscriptionLogic, n as listenerLogic, s as subscriptionLogic } from './createActor-2a03d4b2.development.esm.js';
2
+ export { T as TimeoutError, c as createAsyncLogic, a as createCallbackLogic, b as createEmptyActor, d as createEventObservableLogic, e as createLogic, f as createObservableLogic } from './index-17f889df.development.esm.js';
@@ -1,2 +1,2 @@
1
- export { B as createListenerLogic, D as createSubscriptionLogic, C as listenerLogic, E as subscriptionLogic } from './createActor-19e83fb9.esm.js';
2
- export { T as TimeoutError, f as createAsyncLogic, a as createCallbackLogic, c as createEmptyActor, d as createEventObservableLogic, e as createLogic, b as createObservableLogic } from './index-abf9ab72.esm.js';
1
+ export { k as createListenerLogic, l as createSubscriptionLogic, n as listenerLogic, s as subscriptionLogic } from './createActor-a211c276.esm.js';
2
+ export { T as TimeoutError, c as createAsyncLogic, a as createCallbackLogic, b as createEmptyActor, d as createEventObservableLogic, e as createLogic, f as createObservableLogic } from './index-7020402e.esm.js';