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
  *
@@ -228,7 +228,6 @@ function resolve$7(_, state, actionArgs, {
228
228
  function execute$4(actorContext, resolvedSendId) {
229
229
  actorContext.self.cancel(resolvedSendId);
230
230
  }
231
-
232
231
  /**
233
232
  * Cancels an in-flight `send(...)` action. A canceled sent action will not
234
233
  * be executed, nor will its event be sent, unless it has already been sent
@@ -316,32 +315,53 @@ class Mailbox {
316
315
  }
317
316
  }
318
317
 
319
- const symbolObservable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();
320
-
321
318
  /**
322
- * Returns actor logic from a transition function and its initial state.
323
- *
324
- * A transition function is a function that takes the current state and an event and returns the next state.
319
+ * This function makes sure that unhandled errors are thrown in a separate macrotask.
320
+ * It allows those errors to be detected by global error handlers and reported to bug tracking services
321
+ * without interrupting our own stack of execution.
325
322
  *
326
- * @param transition The transition function that returns the next state given the current state and event.
327
- * @param initialState The initial state of the transition function.
328
- * @returns Actor logic
323
+ * @param err error to be thrown
329
324
  */
330
- function fromTransition(transition, initialState) {
331
- return {
332
- config: transition,
333
- transition: (state, event, actorContext) => {
334
- return transition(state, event, actorContext);
325
+ function reportUnhandledError(err) {
326
+ setTimeout(() => {
327
+ throw err;
328
+ });
329
+ }
330
+
331
+ const symbolObservable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();
332
+
333
+ function createSystem() {
334
+ let sessionIdCounter = 0;
335
+ const children = new Map();
336
+ const keyedActors = new Map();
337
+ const reverseKeyedActors = new WeakMap();
338
+ const system = {
339
+ _bookId: () => `x:${sessionIdCounter++}`,
340
+ _register: (sessionId, actorRef) => {
341
+ children.set(sessionId, actorRef);
342
+ return sessionId;
343
+ },
344
+ _unregister: actorRef => {
345
+ children.delete(actorRef.sessionId);
346
+ const systemId = reverseKeyedActors.get(actorRef);
347
+ if (systemId !== undefined) {
348
+ keyedActors.delete(systemId);
349
+ reverseKeyedActors.delete(actorRef);
350
+ }
335
351
  },
336
- getInitialState: (_, input) => {
337
- return typeof initialState === 'function' ? initialState({
338
- input
339
- }) : initialState;
352
+ get: systemId => {
353
+ return keyedActors.get(systemId);
340
354
  },
341
- getSnapshot: state => state,
342
- getPersistedState: state => state,
343
- restoreState: state => state
355
+ _set: (systemId, actorRef) => {
356
+ const existing = keyedActors.get(systemId);
357
+ if (existing && existing !== actorRef) {
358
+ throw new Error(`Actor with system ID '${systemId}' already exists.`);
359
+ }
360
+ keyedActors.set(systemId, actorRef);
361
+ reverseKeyedActors.set(actorRef, systemId);
362
+ }
344
363
  };
364
+ return system;
345
365
  }
346
366
 
347
367
  function matchesState(parentStateId, childStateId) {
@@ -477,23 +497,6 @@ function normalizeTarget(target) {
477
497
  }
478
498
  return toArray(target);
479
499
  }
480
- function toInvokeConfig(invocable, id) {
481
- if (typeof invocable === 'object') {
482
- if ('src' in invocable) {
483
- return invocable;
484
- }
485
- if ('transition' in invocable) {
486
- return {
487
- id,
488
- src: invocable
489
- };
490
- }
491
- }
492
- return {
493
- id,
494
- src: invocable
495
- };
496
- }
497
500
  function toObserver(nextHandler, errorHandler, completionHandler) {
498
501
  const isObserver = typeof nextHandler === 'object';
499
502
  const self = isObserver ? nextHandler : undefined;
@@ -513,482 +516,6 @@ function resolveReferencedActor(referenced) {
513
516
  } : referenced : undefined;
514
517
  }
515
518
 
516
- function fromCallback(invokeCallback) {
517
- return {
518
- config: invokeCallback,
519
- start: (_state, {
520
- self
521
- }) => {
522
- self.send({
523
- type: startSignalType
524
- });
525
- },
526
- transition: (state, event, {
527
- self,
528
- id,
529
- system
530
- }) => {
531
- if (event.type === startSignalType) {
532
- const sendBack = eventForParent => {
533
- if (state.canceled) {
534
- return;
535
- }
536
- self._parent?.send(eventForParent);
537
- };
538
- const receive = newListener => {
539
- state.receivers.add(newListener);
540
- };
541
- state.dispose = invokeCallback({
542
- input: state.input,
543
- system,
544
- self: self,
545
- sendBack,
546
- receive
547
- });
548
- if (isPromiseLike(state.dispose)) {
549
- state.dispose.then(resolved => {
550
- self._parent?.send(doneInvoke(id, resolved));
551
- state.canceled = true;
552
- }, errorData => {
553
- state.canceled = true;
554
- self._parent?.send(error(id, errorData));
555
- });
556
- }
557
- return state;
558
- }
559
- if (event.type === stopSignalType) {
560
- state.canceled = true;
561
- if (typeof state.dispose === 'function') {
562
- state.dispose();
563
- }
564
- return state;
565
- }
566
- if (isSignal(event)) {
567
- // TODO: unrecognized signal
568
- return state;
569
- }
570
- state.receivers.forEach(receiver => receiver(event));
571
- return state;
572
- },
573
- getInitialState: (_, input) => {
574
- return {
575
- canceled: false,
576
- receivers: new Set(),
577
- dispose: undefined,
578
- input
579
- };
580
- },
581
- getSnapshot: () => undefined,
582
- getPersistedState: ({
583
- input,
584
- canceled
585
- }) => ({
586
- input,
587
- canceled
588
- })
589
- };
590
- }
591
-
592
- function fromObservable(observableCreator) {
593
- const nextEventType = '$$xstate.next';
594
- const errorEventType = '$$xstate.error';
595
- const completeEventType = '$$xstate.complete';
596
- return {
597
- config: observableCreator,
598
- transition: (state, event, {
599
- self,
600
- id,
601
- defer
602
- }) => {
603
- if (state.status !== 'active') {
604
- return state;
605
- }
606
- switch (event.type) {
607
- case nextEventType:
608
- // match the exact timing of events sent by machines
609
- // send actions are not executed immediately
610
- defer(() => {
611
- self._parent?.send({
612
- type: `xstate.snapshot.${id}`,
613
- data: event.data
614
- });
615
- });
616
- return {
617
- ...state,
618
- data: event.data
619
- };
620
- case errorEventType:
621
- return {
622
- ...state,
623
- status: 'error',
624
- input: undefined,
625
- data: event.data,
626
- // TODO: if we keep this as `data` we should reflect this in the type
627
- subscription: undefined
628
- };
629
- case completeEventType:
630
- return {
631
- ...state,
632
- status: 'done',
633
- input: undefined,
634
- subscription: undefined
635
- };
636
- case stopSignalType:
637
- state.subscription.unsubscribe();
638
- return {
639
- ...state,
640
- status: 'canceled',
641
- input: undefined,
642
- subscription: undefined
643
- };
644
- default:
645
- return state;
646
- }
647
- },
648
- getInitialState: (_, input) => {
649
- return {
650
- subscription: undefined,
651
- status: 'active',
652
- data: undefined,
653
- input
654
- };
655
- },
656
- start: (state, {
657
- self,
658
- system
659
- }) => {
660
- if (state.status === 'done') {
661
- // Do not restart a completed observable
662
- return;
663
- }
664
- state.subscription = observableCreator({
665
- input: state.input,
666
- system,
667
- self
668
- }).subscribe({
669
- next: value => {
670
- self.send({
671
- type: nextEventType,
672
- data: value
673
- });
674
- },
675
- error: err => {
676
- self.send({
677
- type: errorEventType,
678
- data: err
679
- });
680
- },
681
- complete: () => {
682
- self.send({
683
- type: completeEventType
684
- });
685
- }
686
- });
687
- },
688
- getSnapshot: state => state.data,
689
- getPersistedState: ({
690
- status,
691
- data,
692
- input
693
- }) => ({
694
- status,
695
- data,
696
- input
697
- }),
698
- getStatus: state => state,
699
- restoreState: state => ({
700
- ...state,
701
- subscription: undefined
702
- })
703
- };
704
- }
705
-
706
- /**
707
- * Creates event observable logic that listens to an observable
708
- * that delivers event objects.
709
- *
710
- *
711
- * @param lazyObservable A function that creates an observable
712
- * @returns Event observable logic
713
- */
714
-
715
- function fromEventObservable(lazyObservable) {
716
- const errorEventType = '$$xstate.error';
717
- const completeEventType = '$$xstate.complete';
718
-
719
- // TODO: event types
720
- return {
721
- config: lazyObservable,
722
- transition: (state, event) => {
723
- if (state.status !== 'active') {
724
- return state;
725
- }
726
- switch (event.type) {
727
- case errorEventType:
728
- return {
729
- ...state,
730
- status: 'error',
731
- input: undefined,
732
- data: event.data,
733
- // TODO: if we keep this as `data` we should reflect this in the type
734
- subscription: undefined
735
- };
736
- case completeEventType:
737
- return {
738
- ...state,
739
- status: 'done',
740
- input: undefined,
741
- subscription: undefined
742
- };
743
- case stopSignalType:
744
- state.subscription.unsubscribe();
745
- return {
746
- ...state,
747
- status: 'canceled',
748
- input: undefined,
749
- subscription: undefined
750
- };
751
- default:
752
- return state;
753
- }
754
- },
755
- getInitialState: (_, input) => {
756
- return {
757
- subscription: undefined,
758
- status: 'active',
759
- data: undefined,
760
- input
761
- };
762
- },
763
- start: (state, {
764
- self,
765
- system
766
- }) => {
767
- if (state.status === 'done') {
768
- // Do not restart a completed observable
769
- return;
770
- }
771
- state.subscription = lazyObservable({
772
- input: state.input,
773
- system,
774
- self
775
- }).subscribe({
776
- next: value => {
777
- self._parent?.send(value);
778
- },
779
- error: err => {
780
- self.send({
781
- type: errorEventType,
782
- data: err
783
- });
784
- },
785
- complete: () => {
786
- self.send({
787
- type: completeEventType
788
- });
789
- }
790
- });
791
- },
792
- getSnapshot: _ => undefined,
793
- getPersistedState: ({
794
- status,
795
- data,
796
- input
797
- }) => ({
798
- status,
799
- data,
800
- input
801
- }),
802
- getStatus: state => state,
803
- restoreState: state => ({
804
- ...state,
805
- subscription: undefined
806
- })
807
- };
808
- }
809
-
810
- const resolveEventType = '$$xstate.resolve';
811
- const rejectEventType = '$$xstate.reject';
812
- function fromPromise(
813
- // TODO: add types
814
- promiseCreator) {
815
- // TODO: add event types
816
- const logic = {
817
- config: promiseCreator,
818
- transition: (state, event) => {
819
- if (state.status !== 'active') {
820
- return state;
821
- }
822
- switch (event.type) {
823
- case resolveEventType:
824
- return {
825
- ...state,
826
- status: 'done',
827
- data: event.data,
828
- input: undefined
829
- };
830
- case rejectEventType:
831
- return {
832
- ...state,
833
- status: 'error',
834
- data: event.data,
835
- // TODO: if we keep this as `data` we should reflect this in the type
836
- input: undefined
837
- };
838
- case stopSignalType:
839
- return {
840
- ...state,
841
- status: 'canceled',
842
- input: undefined
843
- };
844
- default:
845
- return state;
846
- }
847
- },
848
- start: (state, {
849
- self,
850
- system
851
- }) => {
852
- // TODO: determine how to allow customizing this so that promises
853
- // can be restarted if necessary
854
- if (state.status !== 'active') {
855
- return;
856
- }
857
- const resolvedPromise = Promise.resolve(promiseCreator({
858
- input: state.input,
859
- system,
860
- self
861
- }));
862
- resolvedPromise.then(response => {
863
- // TODO: remove this condition once dead letter queue lands
864
- if (self._state.status !== 'active') {
865
- return;
866
- }
867
- self.send({
868
- type: resolveEventType,
869
- data: response
870
- });
871
- }, errorData => {
872
- // TODO: remove this condition once dead letter queue lands
873
- if (self._state.status !== 'active') {
874
- return;
875
- }
876
- self.send({
877
- type: rejectEventType,
878
- data: errorData
879
- });
880
- });
881
- },
882
- getInitialState: (_, input) => {
883
- return {
884
- status: 'active',
885
- data: undefined,
886
- input
887
- };
888
- },
889
- getSnapshot: state => state.data,
890
- getStatus: state => state,
891
- getPersistedState: state => state,
892
- restoreState: state => state
893
- };
894
- return logic;
895
- }
896
-
897
- const startSignalType = 'xstate.init';
898
- const stopSignalType = 'xstate.stop';
899
- const startSignal = {
900
- type: 'xstate.init'
901
- };
902
- const stopSignal = {
903
- type: 'xstate.stop'
904
- };
905
- /**
906
- * An object that expresses the actor logic in reaction to received events,
907
- * as well as an optionally emitted stream of values.
908
- *
909
- * @template TReceived The received event
910
- * @template TSnapshot The emitted value
911
- */
912
-
913
- function isSignal(event) {
914
- return event.type === startSignalType || event.type === stopSignalType;
915
- }
916
- function isActorRef(item) {
917
- return !!item && typeof item === 'object' && typeof item.send === 'function';
918
- }
919
-
920
- // TODO: refactor the return type, this could be written in a better way
921
- // but it's best to avoid unneccessary breaking changes now
922
- // @deprecated use `interpret(actorLogic)` instead
923
- function toActorRef(actorRefLike) {
924
- return {
925
- subscribe: () => ({
926
- unsubscribe: () => void 0
927
- }),
928
- id: 'anonymous',
929
- sessionId: '',
930
- getSnapshot: () => undefined,
931
- // TODO: this isn't safe
932
- [symbolObservable]: function () {
933
- return this;
934
- },
935
- status: ActorStatus.Running,
936
- stop: () => void 0,
937
- ...actorRefLike
938
- };
939
- }
940
- const emptyLogic = fromTransition(_ => undefined, undefined);
941
- function createEmptyActor() {
942
- return createActor(emptyLogic);
943
- }
944
-
945
- /**
946
- * This function makes sure that unhandled errors are thrown in a separate macrotask.
947
- * It allows those errors to be detected by global error handlers and reported to bug tracking services
948
- * without interrupting our own stack of execution.
949
- *
950
- * @param err error to be thrown
951
- */
952
- function reportUnhandledError(err) {
953
- setTimeout(() => {
954
- throw err;
955
- });
956
- }
957
-
958
- function createSystem() {
959
- let sessionIdCounter = 0;
960
- const children = new Map();
961
- const keyedActors = new Map();
962
- const reverseKeyedActors = new WeakMap();
963
- const system = {
964
- _bookId: () => `x:${sessionIdCounter++}`,
965
- _register: (sessionId, actorRef) => {
966
- children.set(sessionId, actorRef);
967
- return sessionId;
968
- },
969
- _unregister: actorRef => {
970
- children.delete(actorRef.sessionId);
971
- const systemId = reverseKeyedActors.get(actorRef);
972
- if (systemId !== undefined) {
973
- keyedActors.delete(systemId);
974
- reverseKeyedActors.delete(actorRef);
975
- }
976
- },
977
- get: systemId => {
978
- return keyedActors.get(systemId);
979
- },
980
- _set: (systemId, actorRef) => {
981
- const existing = keyedActors.get(systemId);
982
- if (existing && existing !== actorRef) {
983
- throw new Error(`Actor with system ID '${systemId}' already exists.`);
984
- }
985
- keyedActors.set(systemId, actorRef);
986
- reverseKeyedActors.set(actorRef, systemId);
987
- }
988
- };
989
- return system;
990
- }
991
-
992
519
  let ActorStatus = /*#__PURE__*/function (ActorStatus) {
993
520
  ActorStatus[ActorStatus["NotStarted"] = 0] = "NotStarted";
994
521
  ActorStatus[ActorStatus["Running"] = 1] = "Running";
@@ -1235,7 +762,7 @@ class Actor {
1235
762
  return;
1236
763
  }
1237
764
  this.update(nextState);
1238
- if (event.type === stopSignalType) {
765
+ if (event.type === XSTATE_STOP) {
1239
766
  this._stopProcedure();
1240
767
  this._complete();
1241
768
  }
@@ -1250,7 +777,7 @@ class Actor {
1250
777
  return this;
1251
778
  }
1252
779
  this.mailbox.enqueue({
1253
- type: stopSignalType
780
+ type: XSTATE_STOP
1254
781
  });
1255
782
  return this;
1256
783
  }
@@ -1473,6 +1000,9 @@ function execute$3(actorContext, {
1473
1000
  }
1474
1001
  });
1475
1002
  }
1003
+
1004
+ // we don't export this since it's an internal action that is not meant to be used in the user's code
1005
+
1476
1006
  function invoke({
1477
1007
  id,
1478
1008
  systemId,
@@ -1585,6 +1115,12 @@ function evaluateGuard(guard, context, event, state) {
1585
1115
  event,
1586
1116
  guard: isInline ? undefined : typeof guard === 'string' ? {
1587
1117
  type: guard
1118
+ } : typeof guard.params === 'function' ? {
1119
+ type: guard.type,
1120
+ params: guard.params({
1121
+ context,
1122
+ event
1123
+ })
1588
1124
  } : guard
1589
1125
  };
1590
1126
  if (!('check' in resolved)) {
@@ -1923,7 +1459,7 @@ function resolveTarget(stateNode, targets) {
1923
1459
  });
1924
1460
  }
1925
1461
  function resolveHistoryTarget(stateNode) {
1926
- const normalizedTarget = normalizeTarget(stateNode.target);
1462
+ const normalizedTarget = normalizeTarget(stateNode.config.target);
1927
1463
  if (!normalizedTarget) {
1928
1464
  return stateNode.parent.initial.target;
1929
1465
  }
@@ -2412,7 +1948,15 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
2412
1948
  system: actorCtx?.system,
2413
1949
  action: isInline ? undefined : typeof action === 'string' ? {
2414
1950
  type: action
2415
- } : action
1951
+ } : typeof action.params === 'function' ? {
1952
+ type: action.type,
1953
+ params: action.params({
1954
+ context: intermediateState.context,
1955
+ event
1956
+ })
1957
+ } :
1958
+ // TS isn't able to narrow it down here
1959
+ action
2416
1960
  };
2417
1961
  if (!('resolve' in resolved)) {
2418
1962
  if (actorCtx?.self.status === ActorStatus.Running) {
@@ -2448,7 +1992,7 @@ function macrostep(state, event, actorCtx) {
2448
1992
  const states = [];
2449
1993
 
2450
1994
  // Handle stop event
2451
- if (event.type === stopSignalType) {
1995
+ if (event.type === XSTATE_STOP) {
2452
1996
  nextState = stopStep(event, nextState, actorCtx);
2453
1997
  states.push(nextState);
2454
1998
  return {
@@ -2460,7 +2004,7 @@ function macrostep(state, event, actorCtx) {
2460
2004
 
2461
2005
  // Assume the state is at rest (no raised events)
2462
2006
  // Determine the next state based on the next microstep
2463
- if (nextEvent.type !== INIT_TYPE) {
2007
+ if (nextEvent.type !== XSTATE_INIT) {
2464
2008
  const transitions = selectTransitions(nextEvent, nextState);
2465
2009
  nextState = microstep(transitions, state, actorCtx, nextEvent, false);
2466
2010
  states.push(nextState);
@@ -2754,13 +2298,11 @@ function execute$2(actorContext, actorRef) {
2754
2298
  actorContext.stopChild(actorRef);
2755
2299
  });
2756
2300
  }
2757
-
2758
2301
  /**
2759
2302
  * Stops an actor.
2760
2303
  *
2761
2304
  * @param actorRef The actor to stop.
2762
2305
  */
2763
-
2764
2306
  function stop(actorRef) {
2765
2307
  function stop(_) {
2766
2308
  {
@@ -2795,7 +2337,6 @@ function execute$1({
2795
2337
  logger(value);
2796
2338
  }
2797
2339
  }
2798
-
2799
2340
  /**
2800
2341
  *
2801
2342
  * @param expr The expression function to evaluate which will be logged.
@@ -2913,7 +2454,6 @@ function resolve$3(actorContext, state, actionArgs, {
2913
2454
  } : state.children
2914
2455
  })];
2915
2456
  }
2916
-
2917
2457
  /**
2918
2458
  * Updates the current context of the machine.
2919
2459
  *
@@ -2962,14 +2502,12 @@ function execute(actorContext, params) {
2962
2502
  return;
2963
2503
  }
2964
2504
  }
2965
-
2966
2505
  /**
2967
2506
  * Raises an event. This places the event in the internal event queue, so that
2968
2507
  * the event is immediately consumed by the machine in the current step.
2969
2508
  *
2970
2509
  * @param eventType The event to raise.
2971
2510
  */
2972
-
2973
2511
  function raise(eventOrExpr, options) {
2974
2512
  function raise(_) {
2975
2513
  {
@@ -3053,6 +2591,9 @@ function done(id, output) {
3053
2591
  eventObject.toString = () => type;
3054
2592
  return eventObject;
3055
2593
  }
2594
+ function doneInvokeEventType(invokeId) {
2595
+ return `${ConstantPrefix.DoneInvoke}.${invokeId}`;
2596
+ }
3056
2597
 
3057
2598
  /**
3058
2599
  * Returns an event that represents that an invoked service has terminated.
@@ -3064,7 +2605,7 @@ function done(id, output) {
3064
2605
  * @param output The data to pass into the event
3065
2606
  */
3066
2607
  function doneInvoke(invokeId, output) {
3067
- const type = `${ConstantPrefix.DoneInvoke}.${invokeId}`;
2608
+ const type = doneInvokeEventType(invokeId);
3068
2609
  const eventObject = {
3069
2610
  type,
3070
2611
  output
@@ -3072,8 +2613,11 @@ function doneInvoke(invokeId, output) {
3072
2613
  eventObject.toString = () => type;
3073
2614
  return eventObject;
3074
2615
  }
2616
+ function errorEventType(id) {
2617
+ return `${ConstantPrefix.ErrorPlatform}.${id}`;
2618
+ }
3075
2619
  function error(id, data) {
3076
- const type = `${ConstantPrefix.ErrorPlatform}.${id}`;
2620
+ const type = errorEventType(id);
3077
2621
  const eventObject = {
3078
2622
  type,
3079
2623
  data
@@ -3083,9 +2627,9 @@ function error(id, data) {
3083
2627
  }
3084
2628
  function createInitEvent(input) {
3085
2629
  return {
3086
- type: INIT_TYPE,
2630
+ type: XSTATE_INIT,
3087
2631
  input
3088
2632
  };
3089
2633
  }
3090
2634
 
3091
- 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 };
2635
+ 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 };