xstate 5.0.0-beta.26 → 5.0.0-beta.27

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 (57) hide show
  1. package/actions/dist/xstate-actions.cjs.js +20 -18
  2. package/actions/dist/xstate-actions.cjs.mjs +2 -0
  3. package/actions/dist/xstate-actions.development.cjs.js +20 -18
  4. package/actions/dist/xstate-actions.development.cjs.mjs +2 -0
  5. package/actions/dist/xstate-actions.development.esm.js +1 -1
  6. package/actions/dist/xstate-actions.esm.js +1 -1
  7. package/actions/dist/xstate-actions.umd.min.js +1 -1
  8. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  9. package/actors/dist/xstate-actors.cjs.js +37 -14
  10. package/actors/dist/xstate-actors.cjs.mjs +0 -5
  11. package/actors/dist/xstate-actors.development.cjs.js +37 -14
  12. package/actors/dist/xstate-actors.development.cjs.mjs +0 -5
  13. package/actors/dist/xstate-actors.development.esm.js +34 -1
  14. package/actors/dist/xstate-actors.esm.js +34 -1
  15. package/actors/dist/xstate-actors.umd.min.js +1 -1
  16. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  17. package/dist/{actions-5943a9db.esm.js → actions-020463e9.esm.js} +76 -532
  18. package/dist/{actions-cf69419d.development.esm.js → actions-9754d2ca.development.esm.js} +76 -532
  19. package/dist/{actions-0971b43d.development.cjs.js → actions-ca622922.development.cjs.js} +81 -546
  20. package/dist/{actions-319cefe7.cjs.js → actions-d1dba4ac.cjs.js} +81 -546
  21. package/dist/declarations/src/Machine.d.ts +4 -3
  22. package/dist/declarations/src/State.d.ts +1 -1
  23. package/dist/declarations/src/StateNode.d.ts +0 -9
  24. package/dist/declarations/src/actions/assign.d.ts +6 -11
  25. package/dist/declarations/src/actions/cancel.d.ts +5 -12
  26. package/dist/declarations/src/actions/choose.d.ts +7 -6
  27. package/dist/declarations/src/actions/log.d.ts +5 -20
  28. package/dist/declarations/src/actions/pure.d.ts +9 -8
  29. package/dist/declarations/src/actions/raise.d.ts +6 -5
  30. package/dist/declarations/src/actions/send.d.ts +7 -12
  31. package/dist/declarations/src/actions/stop.d.ts +5 -12
  32. package/dist/declarations/src/actions.d.ts +2 -0
  33. package/dist/declarations/src/actors/index.d.ts +0 -20
  34. package/dist/declarations/src/actors/promise.d.ts +2 -1
  35. package/dist/declarations/src/constants.d.ts +7 -0
  36. package/dist/declarations/src/guards.d.ts +2 -2
  37. package/dist/declarations/src/index.d.ts +14 -14
  38. package/dist/declarations/src/typegenTypes.d.ts +1 -1
  39. package/dist/declarations/src/types.d.ts +10 -15
  40. package/dist/declarations/src/utils.d.ts +1 -2
  41. package/dist/promise-2ad94e3b.development.esm.js +406 -0
  42. package/dist/promise-3b7e3357.development.cjs.js +412 -0
  43. package/dist/promise-5b07c38e.esm.js +406 -0
  44. package/dist/promise-7a8c1768.cjs.js +412 -0
  45. package/dist/xstate.cjs.js +78 -102
  46. package/dist/xstate.development.cjs.js +78 -102
  47. package/dist/xstate.development.esm.js +6 -30
  48. package/dist/xstate.esm.js +6 -30
  49. package/dist/xstate.umd.min.js +1 -1
  50. package/dist/xstate.umd.min.js.map +1 -1
  51. package/guards/dist/xstate-guards.cjs.js +6 -6
  52. package/guards/dist/xstate-guards.development.cjs.js +6 -6
  53. package/guards/dist/xstate-guards.development.esm.js +1 -1
  54. package/guards/dist/xstate-guards.esm.js +1 -1
  55. package/guards/dist/xstate-guards.umd.min.js +1 -1
  56. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  57. package/package.json +1 -1
@@ -69,7 +69,8 @@ const TARGETLESS_KEY = '';
69
69
  const NULL_EVENT = '';
70
70
  const STATE_IDENTIFIER = '#';
71
71
  const WILDCARD = '*';
72
- const INIT_TYPE = 'xstate.init';
72
+ const XSTATE_INIT = 'xstate.init';
73
+ const XSTATE_STOP = 'xstate.stop';
73
74
 
74
75
  function resolve$8(actorContext, state, args, {
75
76
  to,
@@ -132,7 +133,6 @@ function execute$5(actorContext, params) {
132
133
  } : event);
133
134
  });
134
135
  }
135
-
136
136
  /**
137
137
  * Sends an event to an actor.
138
138
  *
@@ -215,7 +215,6 @@ function resolve$7(_, state, actionArgs, {
215
215
  function execute$4(actorContext, resolvedSendId) {
216
216
  actorContext.self.cancel(resolvedSendId);
217
217
  }
218
-
219
218
  /**
220
219
  * Cancels an in-flight `send(...)` action. A canceled sent action will not
221
220
  * be executed, nor will its event be sent, unless it has already been sent
@@ -300,32 +299,53 @@ class Mailbox {
300
299
  }
301
300
  }
302
301
 
303
- const symbolObservable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();
304
-
305
302
  /**
306
- * Returns actor logic from a transition function and its initial state.
307
- *
308
- * A transition function is a function that takes the current state and an event and returns the next state.
303
+ * This function makes sure that unhandled errors are thrown in a separate macrotask.
304
+ * It allows those errors to be detected by global error handlers and reported to bug tracking services
305
+ * without interrupting our own stack of execution.
309
306
  *
310
- * @param transition The transition function that returns the next state given the current state and event.
311
- * @param initialState The initial state of the transition function.
312
- * @returns Actor logic
307
+ * @param err error to be thrown
313
308
  */
314
- function fromTransition(transition, initialState) {
315
- return {
316
- config: transition,
317
- transition: (state, event, actorContext) => {
318
- return transition(state, event, actorContext);
309
+ function reportUnhandledError(err) {
310
+ setTimeout(() => {
311
+ throw err;
312
+ });
313
+ }
314
+
315
+ const symbolObservable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();
316
+
317
+ function createSystem() {
318
+ let sessionIdCounter = 0;
319
+ const children = new Map();
320
+ const keyedActors = new Map();
321
+ const reverseKeyedActors = new WeakMap();
322
+ const system = {
323
+ _bookId: () => `x:${sessionIdCounter++}`,
324
+ _register: (sessionId, actorRef) => {
325
+ children.set(sessionId, actorRef);
326
+ return sessionId;
327
+ },
328
+ _unregister: actorRef => {
329
+ children.delete(actorRef.sessionId);
330
+ const systemId = reverseKeyedActors.get(actorRef);
331
+ if (systemId !== undefined) {
332
+ keyedActors.delete(systemId);
333
+ reverseKeyedActors.delete(actorRef);
334
+ }
319
335
  },
320
- getInitialState: (_, input) => {
321
- return typeof initialState === 'function' ? initialState({
322
- input
323
- }) : initialState;
336
+ get: systemId => {
337
+ return keyedActors.get(systemId);
324
338
  },
325
- getSnapshot: state => state,
326
- getPersistedState: state => state,
327
- restoreState: state => state
339
+ _set: (systemId, actorRef) => {
340
+ const existing = keyedActors.get(systemId);
341
+ if (existing && existing !== actorRef) {
342
+ throw new Error(`Actor with system ID '${systemId}' already exists.`);
343
+ }
344
+ keyedActors.set(systemId, actorRef);
345
+ reverseKeyedActors.set(actorRef, systemId);
346
+ }
328
347
  };
348
+ return system;
329
349
  }
330
350
 
331
351
  function matchesState(parentStateId, childStateId) {
@@ -458,23 +478,6 @@ function normalizeTarget(target) {
458
478
  }
459
479
  return toArray(target);
460
480
  }
461
- function toInvokeConfig(invocable, id) {
462
- if (typeof invocable === 'object') {
463
- if ('src' in invocable) {
464
- return invocable;
465
- }
466
- if ('transition' in invocable) {
467
- return {
468
- id,
469
- src: invocable
470
- };
471
- }
472
- }
473
- return {
474
- id,
475
- src: invocable
476
- };
477
- }
478
481
  function toObserver(nextHandler, errorHandler, completionHandler) {
479
482
  const isObserver = typeof nextHandler === 'object';
480
483
  const self = isObserver ? nextHandler : undefined;
@@ -494,482 +497,6 @@ function resolveReferencedActor(referenced) {
494
497
  } : referenced : undefined;
495
498
  }
496
499
 
497
- function fromCallback(invokeCallback) {
498
- return {
499
- config: invokeCallback,
500
- start: (_state, {
501
- self
502
- }) => {
503
- self.send({
504
- type: startSignalType
505
- });
506
- },
507
- transition: (state, event, {
508
- self,
509
- id,
510
- system
511
- }) => {
512
- if (event.type === startSignalType) {
513
- const sendBack = eventForParent => {
514
- if (state.canceled) {
515
- return;
516
- }
517
- self._parent?.send(eventForParent);
518
- };
519
- const receive = newListener => {
520
- state.receivers.add(newListener);
521
- };
522
- state.dispose = invokeCallback({
523
- input: state.input,
524
- system,
525
- self: self,
526
- sendBack,
527
- receive
528
- });
529
- if (isPromiseLike(state.dispose)) {
530
- state.dispose.then(resolved => {
531
- self._parent?.send(doneInvoke(id, resolved));
532
- state.canceled = true;
533
- }, errorData => {
534
- state.canceled = true;
535
- self._parent?.send(error(id, errorData));
536
- });
537
- }
538
- return state;
539
- }
540
- if (event.type === stopSignalType) {
541
- state.canceled = true;
542
- if (typeof state.dispose === 'function') {
543
- state.dispose();
544
- }
545
- return state;
546
- }
547
- if (isSignal(event)) {
548
- // TODO: unrecognized signal
549
- return state;
550
- }
551
- state.receivers.forEach(receiver => receiver(event));
552
- return state;
553
- },
554
- getInitialState: (_, input) => {
555
- return {
556
- canceled: false,
557
- receivers: new Set(),
558
- dispose: undefined,
559
- input
560
- };
561
- },
562
- getSnapshot: () => undefined,
563
- getPersistedState: ({
564
- input,
565
- canceled
566
- }) => ({
567
- input,
568
- canceled
569
- })
570
- };
571
- }
572
-
573
- function fromObservable(observableCreator) {
574
- const nextEventType = '$$xstate.next';
575
- const errorEventType = '$$xstate.error';
576
- const completeEventType = '$$xstate.complete';
577
- return {
578
- config: observableCreator,
579
- transition: (state, event, {
580
- self,
581
- id,
582
- defer
583
- }) => {
584
- if (state.status !== 'active') {
585
- return state;
586
- }
587
- switch (event.type) {
588
- case nextEventType:
589
- // match the exact timing of events sent by machines
590
- // send actions are not executed immediately
591
- defer(() => {
592
- self._parent?.send({
593
- type: `xstate.snapshot.${id}`,
594
- data: event.data
595
- });
596
- });
597
- return {
598
- ...state,
599
- data: event.data
600
- };
601
- case errorEventType:
602
- return {
603
- ...state,
604
- status: 'error',
605
- input: undefined,
606
- data: event.data,
607
- // TODO: if we keep this as `data` we should reflect this in the type
608
- subscription: undefined
609
- };
610
- case completeEventType:
611
- return {
612
- ...state,
613
- status: 'done',
614
- input: undefined,
615
- subscription: undefined
616
- };
617
- case stopSignalType:
618
- state.subscription.unsubscribe();
619
- return {
620
- ...state,
621
- status: 'canceled',
622
- input: undefined,
623
- subscription: undefined
624
- };
625
- default:
626
- return state;
627
- }
628
- },
629
- getInitialState: (_, input) => {
630
- return {
631
- subscription: undefined,
632
- status: 'active',
633
- data: undefined,
634
- input
635
- };
636
- },
637
- start: (state, {
638
- self,
639
- system
640
- }) => {
641
- if (state.status === 'done') {
642
- // Do not restart a completed observable
643
- return;
644
- }
645
- state.subscription = observableCreator({
646
- input: state.input,
647
- system,
648
- self
649
- }).subscribe({
650
- next: value => {
651
- self.send({
652
- type: nextEventType,
653
- data: value
654
- });
655
- },
656
- error: err => {
657
- self.send({
658
- type: errorEventType,
659
- data: err
660
- });
661
- },
662
- complete: () => {
663
- self.send({
664
- type: completeEventType
665
- });
666
- }
667
- });
668
- },
669
- getSnapshot: state => state.data,
670
- getPersistedState: ({
671
- status,
672
- data,
673
- input
674
- }) => ({
675
- status,
676
- data,
677
- input
678
- }),
679
- getStatus: state => state,
680
- restoreState: state => ({
681
- ...state,
682
- subscription: undefined
683
- })
684
- };
685
- }
686
-
687
- /**
688
- * Creates event observable logic that listens to an observable
689
- * that delivers event objects.
690
- *
691
- *
692
- * @param lazyObservable A function that creates an observable
693
- * @returns Event observable logic
694
- */
695
-
696
- function fromEventObservable(lazyObservable) {
697
- const errorEventType = '$$xstate.error';
698
- const completeEventType = '$$xstate.complete';
699
-
700
- // TODO: event types
701
- return {
702
- config: lazyObservable,
703
- transition: (state, event) => {
704
- if (state.status !== 'active') {
705
- return state;
706
- }
707
- switch (event.type) {
708
- case errorEventType:
709
- return {
710
- ...state,
711
- status: 'error',
712
- input: undefined,
713
- data: event.data,
714
- // TODO: if we keep this as `data` we should reflect this in the type
715
- subscription: undefined
716
- };
717
- case completeEventType:
718
- return {
719
- ...state,
720
- status: 'done',
721
- input: undefined,
722
- subscription: undefined
723
- };
724
- case stopSignalType:
725
- state.subscription.unsubscribe();
726
- return {
727
- ...state,
728
- status: 'canceled',
729
- input: undefined,
730
- subscription: undefined
731
- };
732
- default:
733
- return state;
734
- }
735
- },
736
- getInitialState: (_, input) => {
737
- return {
738
- subscription: undefined,
739
- status: 'active',
740
- data: undefined,
741
- input
742
- };
743
- },
744
- start: (state, {
745
- self,
746
- system
747
- }) => {
748
- if (state.status === 'done') {
749
- // Do not restart a completed observable
750
- return;
751
- }
752
- state.subscription = lazyObservable({
753
- input: state.input,
754
- system,
755
- self
756
- }).subscribe({
757
- next: value => {
758
- self._parent?.send(value);
759
- },
760
- error: err => {
761
- self.send({
762
- type: errorEventType,
763
- data: err
764
- });
765
- },
766
- complete: () => {
767
- self.send({
768
- type: completeEventType
769
- });
770
- }
771
- });
772
- },
773
- getSnapshot: _ => undefined,
774
- getPersistedState: ({
775
- status,
776
- data,
777
- input
778
- }) => ({
779
- status,
780
- data,
781
- input
782
- }),
783
- getStatus: state => state,
784
- restoreState: state => ({
785
- ...state,
786
- subscription: undefined
787
- })
788
- };
789
- }
790
-
791
- const resolveEventType = '$$xstate.resolve';
792
- const rejectEventType = '$$xstate.reject';
793
- function fromPromise(
794
- // TODO: add types
795
- promiseCreator) {
796
- // TODO: add event types
797
- const logic = {
798
- config: promiseCreator,
799
- transition: (state, event) => {
800
- if (state.status !== 'active') {
801
- return state;
802
- }
803
- switch (event.type) {
804
- case resolveEventType:
805
- return {
806
- ...state,
807
- status: 'done',
808
- data: event.data,
809
- input: undefined
810
- };
811
- case rejectEventType:
812
- return {
813
- ...state,
814
- status: 'error',
815
- data: event.data,
816
- // TODO: if we keep this as `data` we should reflect this in the type
817
- input: undefined
818
- };
819
- case stopSignalType:
820
- return {
821
- ...state,
822
- status: 'canceled',
823
- input: undefined
824
- };
825
- default:
826
- return state;
827
- }
828
- },
829
- start: (state, {
830
- self,
831
- system
832
- }) => {
833
- // TODO: determine how to allow customizing this so that promises
834
- // can be restarted if necessary
835
- if (state.status !== 'active') {
836
- return;
837
- }
838
- const resolvedPromise = Promise.resolve(promiseCreator({
839
- input: state.input,
840
- system,
841
- self
842
- }));
843
- resolvedPromise.then(response => {
844
- // TODO: remove this condition once dead letter queue lands
845
- if (self._state.status !== 'active') {
846
- return;
847
- }
848
- self.send({
849
- type: resolveEventType,
850
- data: response
851
- });
852
- }, errorData => {
853
- // TODO: remove this condition once dead letter queue lands
854
- if (self._state.status !== 'active') {
855
- return;
856
- }
857
- self.send({
858
- type: rejectEventType,
859
- data: errorData
860
- });
861
- });
862
- },
863
- getInitialState: (_, input) => {
864
- return {
865
- status: 'active',
866
- data: undefined,
867
- input
868
- };
869
- },
870
- getSnapshot: state => state.data,
871
- getStatus: state => state,
872
- getPersistedState: state => state,
873
- restoreState: state => state
874
- };
875
- return logic;
876
- }
877
-
878
- const startSignalType = 'xstate.init';
879
- const stopSignalType = 'xstate.stop';
880
- const startSignal = {
881
- type: 'xstate.init'
882
- };
883
- const stopSignal = {
884
- type: 'xstate.stop'
885
- };
886
- /**
887
- * An object that expresses the actor logic in reaction to received events,
888
- * as well as an optionally emitted stream of values.
889
- *
890
- * @template TReceived The received event
891
- * @template TSnapshot The emitted value
892
- */
893
-
894
- function isSignal(event) {
895
- return event.type === startSignalType || event.type === stopSignalType;
896
- }
897
- function isActorRef(item) {
898
- return !!item && typeof item === 'object' && typeof item.send === 'function';
899
- }
900
-
901
- // TODO: refactor the return type, this could be written in a better way
902
- // but it's best to avoid unneccessary breaking changes now
903
- // @deprecated use `interpret(actorLogic)` instead
904
- function toActorRef(actorRefLike) {
905
- return {
906
- subscribe: () => ({
907
- unsubscribe: () => void 0
908
- }),
909
- id: 'anonymous',
910
- sessionId: '',
911
- getSnapshot: () => undefined,
912
- // TODO: this isn't safe
913
- [symbolObservable]: function () {
914
- return this;
915
- },
916
- status: ActorStatus.Running,
917
- stop: () => void 0,
918
- ...actorRefLike
919
- };
920
- }
921
- const emptyLogic = fromTransition(_ => undefined, undefined);
922
- function createEmptyActor() {
923
- return createActor(emptyLogic);
924
- }
925
-
926
- /**
927
- * This function makes sure that unhandled errors are thrown in a separate macrotask.
928
- * It allows those errors to be detected by global error handlers and reported to bug tracking services
929
- * without interrupting our own stack of execution.
930
- *
931
- * @param err error to be thrown
932
- */
933
- function reportUnhandledError(err) {
934
- setTimeout(() => {
935
- throw err;
936
- });
937
- }
938
-
939
- function createSystem() {
940
- let sessionIdCounter = 0;
941
- const children = new Map();
942
- const keyedActors = new Map();
943
- const reverseKeyedActors = new WeakMap();
944
- const system = {
945
- _bookId: () => `x:${sessionIdCounter++}`,
946
- _register: (sessionId, actorRef) => {
947
- children.set(sessionId, actorRef);
948
- return sessionId;
949
- },
950
- _unregister: actorRef => {
951
- children.delete(actorRef.sessionId);
952
- const systemId = reverseKeyedActors.get(actorRef);
953
- if (systemId !== undefined) {
954
- keyedActors.delete(systemId);
955
- reverseKeyedActors.delete(actorRef);
956
- }
957
- },
958
- get: systemId => {
959
- return keyedActors.get(systemId);
960
- },
961
- _set: (systemId, actorRef) => {
962
- const existing = keyedActors.get(systemId);
963
- if (existing && existing !== actorRef) {
964
- throw new Error(`Actor with system ID '${systemId}' already exists.`);
965
- }
966
- keyedActors.set(systemId, actorRef);
967
- reverseKeyedActors.set(actorRef, systemId);
968
- }
969
- };
970
- return system;
971
- }
972
-
973
500
  let ActorStatus = /*#__PURE__*/function (ActorStatus) {
974
501
  ActorStatus[ActorStatus["NotStarted"] = 0] = "NotStarted";
975
502
  ActorStatus[ActorStatus["Running"] = 1] = "Running";
@@ -1216,7 +743,7 @@ class Actor {
1216
743
  return;
1217
744
  }
1218
745
  this.update(nextState);
1219
- if (event.type === stopSignalType) {
746
+ if (event.type === XSTATE_STOP) {
1220
747
  this._stopProcedure();
1221
748
  this._complete();
1222
749
  }
@@ -1231,7 +758,7 @@ class Actor {
1231
758
  return this;
1232
759
  }
1233
760
  this.mailbox.enqueue({
1234
- type: stopSignalType
761
+ type: XSTATE_STOP
1235
762
  });
1236
763
  return this;
1237
764
  }
@@ -1446,6 +973,9 @@ function execute$3(actorContext, {
1446
973
  }
1447
974
  });
1448
975
  }
976
+
977
+ // we don't export this since it's an internal action that is not meant to be used in the user's code
978
+
1449
979
  function invoke({
1450
980
  id,
1451
981
  systemId,
@@ -1547,6 +1077,12 @@ function evaluateGuard(guard, context, event, state) {
1547
1077
  event,
1548
1078
  guard: isInline ? undefined : typeof guard === 'string' ? {
1549
1079
  type: guard
1080
+ } : typeof guard.params === 'function' ? {
1081
+ type: guard.type,
1082
+ params: guard.params({
1083
+ context,
1084
+ event
1085
+ })
1550
1086
  } : guard
1551
1087
  };
1552
1088
  if (!('check' in resolved)) {
@@ -1874,7 +1410,7 @@ function resolveTarget(stateNode, targets) {
1874
1410
  });
1875
1411
  }
1876
1412
  function resolveHistoryTarget(stateNode) {
1877
- const normalizedTarget = normalizeTarget(stateNode.target);
1413
+ const normalizedTarget = normalizeTarget(stateNode.config.target);
1878
1414
  if (!normalizedTarget) {
1879
1415
  return stateNode.parent.initial.target;
1880
1416
  }
@@ -2363,7 +1899,15 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
2363
1899
  system: actorCtx?.system,
2364
1900
  action: isInline ? undefined : typeof action === 'string' ? {
2365
1901
  type: action
2366
- } : action
1902
+ } : typeof action.params === 'function' ? {
1903
+ type: action.type,
1904
+ params: action.params({
1905
+ context: intermediateState.context,
1906
+ event
1907
+ })
1908
+ } :
1909
+ // TS isn't able to narrow it down here
1910
+ action
2367
1911
  };
2368
1912
  if (!('resolve' in resolved)) {
2369
1913
  if (actorCtx?.self.status === ActorStatus.Running) {
@@ -2396,7 +1940,7 @@ function macrostep(state, event, actorCtx) {
2396
1940
  const states = [];
2397
1941
 
2398
1942
  // Handle stop event
2399
- if (event.type === stopSignalType) {
1943
+ if (event.type === XSTATE_STOP) {
2400
1944
  nextState = stopStep(event, nextState, actorCtx);
2401
1945
  states.push(nextState);
2402
1946
  return {
@@ -2408,7 +1952,7 @@ function macrostep(state, event, actorCtx) {
2408
1952
 
2409
1953
  // Assume the state is at rest (no raised events)
2410
1954
  // Determine the next state based on the next microstep
2411
- if (nextEvent.type !== INIT_TYPE) {
1955
+ if (nextEvent.type !== XSTATE_INIT) {
2412
1956
  const transitions = selectTransitions(nextEvent, nextState);
2413
1957
  nextState = microstep(transitions, state, actorCtx, nextEvent, false);
2414
1958
  states.push(nextState);
@@ -2699,13 +2243,11 @@ function execute$2(actorContext, actorRef) {
2699
2243
  actorContext.stopChild(actorRef);
2700
2244
  });
2701
2245
  }
2702
-
2703
2246
  /**
2704
2247
  * Stops an actor.
2705
2248
  *
2706
2249
  * @param actorRef The actor to stop.
2707
2250
  */
2708
-
2709
2251
  function stop(actorRef) {
2710
2252
  function stop(_) {
2711
2253
  }
@@ -2737,7 +2279,6 @@ function execute$1({
2737
2279
  logger(value);
2738
2280
  }
2739
2281
  }
2740
-
2741
2282
  /**
2742
2283
  *
2743
2284
  * @param expr The expression function to evaluate which will be logged.
@@ -2852,7 +2393,6 @@ function resolve$3(actorContext, state, actionArgs, {
2852
2393
  } : state.children
2853
2394
  })];
2854
2395
  }
2855
-
2856
2396
  /**
2857
2397
  * Updates the current context of the machine.
2858
2398
  *
@@ -2898,14 +2438,12 @@ function execute(actorContext, params) {
2898
2438
  return;
2899
2439
  }
2900
2440
  }
2901
-
2902
2441
  /**
2903
2442
  * Raises an event. This places the event in the internal event queue, so that
2904
2443
  * the event is immediately consumed by the machine in the current step.
2905
2444
  *
2906
2445
  * @param eventType The event to raise.
2907
2446
  */
2908
-
2909
2447
  function raise(eventOrExpr, options) {
2910
2448
  function raise(_) {
2911
2449
  }
@@ -2980,6 +2518,9 @@ function done(id, output) {
2980
2518
  eventObject.toString = () => type;
2981
2519
  return eventObject;
2982
2520
  }
2521
+ function doneInvokeEventType(invokeId) {
2522
+ return `${ConstantPrefix.DoneInvoke}.${invokeId}`;
2523
+ }
2983
2524
 
2984
2525
  /**
2985
2526
  * Returns an event that represents that an invoked service has terminated.
@@ -2991,7 +2532,7 @@ function done(id, output) {
2991
2532
  * @param output The data to pass into the event
2992
2533
  */
2993
2534
  function doneInvoke(invokeId, output) {
2994
- const type = `${ConstantPrefix.DoneInvoke}.${invokeId}`;
2535
+ const type = doneInvokeEventType(invokeId);
2995
2536
  const eventObject = {
2996
2537
  type,
2997
2538
  output
@@ -2999,8 +2540,11 @@ function doneInvoke(invokeId, output) {
2999
2540
  eventObject.toString = () => type;
3000
2541
  return eventObject;
3001
2542
  }
2543
+ function errorEventType(id) {
2544
+ return `${ConstantPrefix.ErrorPlatform}.${id}`;
2545
+ }
3002
2546
  function error(id, data) {
3003
- const type = `${ConstantPrefix.ErrorPlatform}.${id}`;
2547
+ const type = errorEventType(id);
3004
2548
  const eventObject = {
3005
2549
  type,
3006
2550
  data
@@ -3010,9 +2554,9 @@ function error(id, data) {
3010
2554
  }
3011
2555
  function createInitEvent(input) {
3012
2556
  return {
3013
- type: INIT_TYPE,
2557
+ type: XSTATE_INIT,
3014
2558
  input
3015
2559
  };
3016
2560
  }
3017
2561
 
3018
- export { fromObservable as $, microstep as A, isAtomicStateNode as B, isStateId as C, getStateNodeByPath as D, getPersistedState as E, resolveReferencedActor as F, createActor as G, matchesState as H, sendTo as I, sendParent as J, forwardTo as K, interpret as L, Actor as M, NULL_EVENT as N, ActorStatus as O, InterpreterStatus as P, doneInvoke as Q, cancel as R, STATE_DELIMITER as S, choose as T, log as U, pure as V, raise as W, stop as X, pathToStateValue as Y, toObserver as Z, fromPromise as _, toTransitionConfigArray as a, fromCallback as a0, fromEventObservable as a1, fromTransition as a2, stateIn as a3, not as a4, and as a5, or as a6, ConstantPrefix as a7, SpecialTargets as a8, startSignalType as a9, stopSignalType as aa, startSignal as ab, stopSignal as ac, isSignal as ad, isActorRef as ae, toActorRef as af, createEmptyActor as ag, constantPrefixes as ah, after as ai, done as aj, error as ak, escalate as al, formatTransition as b, memo as c, flatten as d, evaluateGuard as e, formatTransitions as f, createInvokeId as g, getDelayedTransitions as h, formatInitialTransition as i, getCandidates as j, toInvokeConfig as k, getConfiguration as l, mapValues as m, getStateNodes as n, isInFinalState as o, State as p, isErrorEvent as q, resolveStateValue as r, cloneState as s, toArray as t, macrostep as u, transitionNode as v, getInitialConfiguration as w, resolveActionsAndContext as x, assign as y, createInitEvent as z };
2562
+ export { stateIn as $, isStateId as A, getStateNodeByPath as B, getPersistedState as C, resolveReferencedActor as D, createActor as E, matchesState as F, Actor as G, ActorStatus as H, doneInvoke as I, interpret as J, InterpreterStatus as K, cancel as L, choose as M, NULL_EVENT as N, log as O, pure as P, raise as Q, forwardTo as R, STATE_DELIMITER as S, sendParent as T, sendTo as U, stop as V, pathToStateValue as W, toObserver as X, and as Y, not as Z, or as _, toTransitionConfigArray as a, ConstantPrefix as a0, SpecialTargets as a1, XSTATE_INIT as a2, isPromiseLike as a3, error as a4, XSTATE_STOP as a5, symbolObservable as a6, constantPrefixes as a7, after as a8, done as a9, doneInvokeEventType as aa, errorEventType as ab, escalate as ac, formatTransition as b, memo as c, createInvokeId as d, evaluateGuard as e, formatTransitions as f, getDelayedTransitions as g, formatInitialTransition as h, getCandidates as i, getConfiguration as j, getStateNodes as k, isInFinalState as l, mapValues as m, State as n, isErrorEvent as o, cloneState as p, macrostep as q, resolveStateValue as r, transitionNode as s, toArray as t, getInitialConfiguration as u, resolveActionsAndContext as v, assign as w, createInitEvent as x, microstep as y, isAtomicStateNode as z };