xstate 5.0.0-alpha.0 → 5.0.0-alpha.2

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 (97) hide show
  1. package/README.md +26 -15
  2. package/actions/dist/xstate-actions.cjs.dev.js +24 -25
  3. package/actions/dist/xstate-actions.cjs.prod.js +23 -24
  4. package/actions/dist/xstate-actions.esm.js +2 -2
  5. package/actions/dist/xstate-actions.umd.min.js +2 -0
  6. package/actions/dist/xstate-actions.umd.min.js.map +1 -0
  7. package/actions/dynamicAction.ts +15 -7
  8. package/actions/package.json +5 -1
  9. package/actors/dist/xstate-actors.cjs.d.ts +1 -1
  10. package/actors/dist/xstate-actors.cjs.dev.js +14 -14
  11. package/actors/dist/xstate-actors.cjs.prod.js +13 -13
  12. package/actors/dist/xstate-actors.esm.js +2 -2
  13. package/actors/dist/xstate-actors.umd.min.js +2 -0
  14. package/actors/dist/xstate-actors.umd.min.js.map +1 -0
  15. package/actors/package.json +5 -1
  16. package/dev/dist/xstate-dev.cjs.dev.js +1 -1
  17. package/dev/dist/xstate-dev.cjs.prod.js +0 -11
  18. package/dev/dist/xstate-dev.esm.js +1 -1
  19. package/dev/dist/xstate-dev.umd.min.js +2 -0
  20. package/dev/dist/xstate-dev.umd.min.js.map +1 -0
  21. package/dev/package.json +5 -1
  22. package/dist/{actions-6b86876d.cjs.dev.js → actions-1e9778c2.cjs.dev.js} +2819 -3334
  23. package/dist/actions-9778f6fb.esm.js +4246 -0
  24. package/dist/actions-acb29ffe.cjs.prod.js +4262 -0
  25. package/dist/declarations/actions/dynamicAction.d.ts +5 -3
  26. package/dist/declarations/src/Machine.d.ts +4 -4
  27. package/dist/declarations/src/Mailbox.d.ts +12 -12
  28. package/dist/declarations/src/SimulatedClock.d.ts +16 -16
  29. package/dist/declarations/src/State.d.ts +97 -104
  30. package/dist/declarations/src/StateMachine.d.ts +110 -112
  31. package/dist/declarations/src/StateNode.d.ts +127 -127
  32. package/dist/declarations/src/actionTypes.d.ts +16 -17
  33. package/dist/declarations/src/actions/assign.d.ts +7 -7
  34. package/dist/declarations/src/actions/cancel.d.ts +10 -10
  35. package/dist/declarations/src/actions/choose.d.ts +3 -3
  36. package/dist/declarations/src/actions/invoke.d.ts +3 -3
  37. package/dist/declarations/src/actions/log.d.ts +11 -11
  38. package/dist/declarations/src/actions/pure.d.ts +3 -3
  39. package/dist/declarations/src/actions/raise.d.ts +8 -9
  40. package/dist/declarations/src/actions/send.d.ts +53 -55
  41. package/dist/declarations/src/actions/stop.d.ts +7 -8
  42. package/dist/declarations/src/actions.d.ts +47 -44
  43. package/dist/declarations/src/actors/callback.d.ts +8 -0
  44. package/dist/declarations/src/actors/index.d.ts +27 -0
  45. package/dist/declarations/src/actors/observable.d.ts +23 -0
  46. package/dist/declarations/src/actors/promise.d.ts +12 -0
  47. package/dist/declarations/src/actors/transition.d.ts +13 -0
  48. package/dist/declarations/src/constants.d.ts +5 -5
  49. package/dist/declarations/src/dev/index.d.ts +14 -14
  50. package/dist/declarations/src/environment.d.ts +1 -1
  51. package/dist/declarations/src/guards.d.ts +8 -9
  52. package/dist/declarations/src/index.d.ts +44 -47
  53. package/dist/declarations/src/interpreter.d.ts +104 -147
  54. package/dist/declarations/src/mapState.d.ts +3 -3
  55. package/dist/declarations/src/memo.d.ts +2 -1
  56. package/dist/declarations/src/schema.d.ts +2 -2
  57. package/dist/declarations/src/spawn.d.ts +2 -2
  58. package/dist/declarations/src/stateUtils.d.ts +70 -85
  59. package/dist/declarations/src/symbolObservable.d.ts +1 -0
  60. package/dist/declarations/src/system.d.ts +2 -0
  61. package/dist/declarations/src/typegenTypes.d.ts +132 -132
  62. package/dist/declarations/src/types.d.ts +1008 -1026
  63. package/dist/declarations/src/utils.d.ts +58 -56
  64. package/dist/{index-20b364c4.esm.js → index-50bd0aff.esm.js} +0 -12
  65. package/dist/{index-2a564d03.cjs.dev.js → index-ebaab3c9.cjs.dev.js} +0 -12
  66. package/dist/xstate.cjs.dev.js +798 -100
  67. package/dist/xstate.cjs.prod.js +797 -99
  68. package/dist/xstate.esm.js +756 -55
  69. package/dist/xstate.umd.min.js +2 -0
  70. package/dist/xstate.umd.min.js.map +1 -0
  71. package/guards/dist/xstate-guards.cjs.dev.js +8 -8
  72. package/guards/dist/xstate-guards.cjs.prod.js +7 -7
  73. package/guards/dist/xstate-guards.esm.js +2 -2
  74. package/guards/dist/xstate-guards.umd.min.js +2 -0
  75. package/guards/dist/xstate-guards.umd.min.js.map +1 -0
  76. package/guards/package.json +5 -1
  77. package/package.json +28 -6
  78. package/CHANGELOG.md +0 -1986
  79. package/actions/ExecutableAction.ts +0 -58
  80. package/dist/Machine-9ce74c11.cjs.dev.js +0 -755
  81. package/dist/Machine-dca041dc.cjs.prod.js +0 -749
  82. package/dist/Machine-fb2f47f5.esm.js +0 -751
  83. package/dist/actions-70094c93.cjs.prod.js +0 -4765
  84. package/dist/actions-ff512f16.esm.js +0 -4757
  85. package/dist/declarations/actions/ExecutableAction.d.ts +0 -23
  86. package/dist/declarations/src/ObservableActorRef.d.ts +0 -25
  87. package/dist/declarations/src/actors.d.ts +0 -38
  88. package/dist/declarations/src/match.d.ts +0 -5
  89. package/dist/declarations/src/model.d.ts +0 -5
  90. package/dist/declarations/src/model.types.d.ts +0 -53
  91. package/dist/declarations/src/registry.d.ts +0 -8
  92. package/model/dist/xstate-model.cjs.d.ts +0 -1
  93. package/model/dist/xstate-model.cjs.dev.js +0 -41
  94. package/model/dist/xstate-model.cjs.js +0 -7
  95. package/model/dist/xstate-model.cjs.prod.js +0 -41
  96. package/model/dist/xstate-model.esm.js +0 -37
  97. package/model/package.json +0 -4
@@ -2,63 +2,776 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var guards_dist_xstateGuards = require('./actions-6b86876d.cjs.dev.js');
6
- require('./index-2a564d03.cjs.dev.js');
7
- var Machine = require('./Machine-9ce74c11.cjs.dev.js');
5
+ var actors_dist_xstateActors = require('./actions-1e9778c2.cjs.dev.js');
6
+ require('./index-ebaab3c9.cjs.dev.js');
8
7
 
9
8
  function pure(getActions) {
10
- return guards_dist_xstateGuards.createDynamicAction(guards_dist_xstateGuards.pure, {
11
- get: getActions
12
- }, function (_ref, ctx, _event) {
9
+ return actors_dist_xstateActors.createDynamicAction({
10
+ type: actors_dist_xstateActors.pure,
11
+ params: {
12
+ get: getActions
13
+ }
14
+ }, function (_event, _ref) {
13
15
  var _toArray;
14
-
15
- var params = _ref.params;
16
- return {
17
- type: guards_dist_xstateGuards.pure,
16
+ var state = _ref.state;
17
+ return [state, {
18
+ type: actors_dist_xstateActors.pure,
18
19
  params: {
19
- actions: (_toArray = guards_dist_xstateGuards.toArray(params.get(ctx, _event.data))) !== null && _toArray !== void 0 ? _toArray : []
20
+ actions: (_toArray = actors_dist_xstateActors.toArray(actors_dist_xstateActors.toActionObjects(getActions(state.context, _event.data)))) !== null && _toArray !== void 0 ? _toArray : []
20
21
  }
21
- };
22
+ }];
22
23
  });
23
24
  }
24
25
 
25
- function mapState(stateMap, stateId) {
26
- var foundStateId;
26
+ var _excluded = ["onDone", "onError"];
27
+ var EMPTY_OBJECT = {};
28
+ var StateNode = /*#__PURE__*/function () {
29
+ /**
30
+ * The relative key of the state node, which represents its location in the overall state value.
31
+ */
27
32
 
28
- for (var _i = 0, _Object$keys = Object.keys(stateMap); _i < _Object$keys.length; _i++) {
29
- var mappedStateId = _Object$keys[_i];
33
+ /**
34
+ * The unique ID of the state node.
35
+ */
30
36
 
31
- if (guards_dist_xstateGuards.matchesState(mappedStateId, stateId) && (!foundStateId || stateId.length > foundStateId.length)) {
32
- foundStateId = mappedStateId;
37
+ /**
38
+ * The type of this state node:
39
+ *
40
+ * - `'atomic'` - no child state nodes
41
+ * - `'compound'` - nested child state nodes (XOR)
42
+ * - `'parallel'` - orthogonal nested child state nodes (AND)
43
+ * - `'history'` - history state node
44
+ * - `'final'` - final state node
45
+ */
46
+
47
+ /**
48
+ * The string path from the root machine node to this node.
49
+ */
50
+
51
+ /**
52
+ * The child state nodes.
53
+ */
54
+
55
+ /**
56
+ * The type of history on this state node. Can be:
57
+ *
58
+ * - `'shallow'` - recalls only top-level historical state value
59
+ * - `'deep'` - recalls historical state value at all levels
60
+ */
61
+
62
+ /**
63
+ * The action(s) to be executed upon entering the state node.
64
+ */
65
+
66
+ /**
67
+ * The action(s) to be executed upon exiting the state node.
68
+ */
69
+
70
+ /**
71
+ * The parent state node.
72
+ */
73
+
74
+ /**
75
+ * The root machine node.
76
+ */
77
+
78
+ /**
79
+ * The meta data associated with this state node, which will be returned in State instances.
80
+ */
81
+
82
+ /**
83
+ * The data sent with the "done.state._id_" event if this is a final state node.
84
+ */
85
+
86
+ /**
87
+ * The order this state node appears. Corresponds to the implicit SCXML document order.
88
+ */
89
+
90
+ function StateNode(
91
+ /**
92
+ * The raw config used to create the machine.
93
+ */
94
+ config, options) {
95
+ var _this = this;
96
+ actors_dist_xstateActors._classCallCheck(this, StateNode);
97
+ this.config = config;
98
+ actors_dist_xstateActors._defineProperty(this, "key", void 0);
99
+ actors_dist_xstateActors._defineProperty(this, "id", void 0);
100
+ actors_dist_xstateActors._defineProperty(this, "type", void 0);
101
+ actors_dist_xstateActors._defineProperty(this, "path", void 0);
102
+ actors_dist_xstateActors._defineProperty(this, "states", void 0);
103
+ actors_dist_xstateActors._defineProperty(this, "history", void 0);
104
+ actors_dist_xstateActors._defineProperty(this, "entry", void 0);
105
+ actors_dist_xstateActors._defineProperty(this, "exit", void 0);
106
+ actors_dist_xstateActors._defineProperty(this, "parent", void 0);
107
+ actors_dist_xstateActors._defineProperty(this, "machine", void 0);
108
+ actors_dist_xstateActors._defineProperty(this, "meta", void 0);
109
+ actors_dist_xstateActors._defineProperty(this, "doneData", void 0);
110
+ actors_dist_xstateActors._defineProperty(this, "order", -1);
111
+ actors_dist_xstateActors._defineProperty(this, "description", void 0);
112
+ actors_dist_xstateActors._defineProperty(this, "tags", []);
113
+ actors_dist_xstateActors._defineProperty(this, "transitions", void 0);
114
+ actors_dist_xstateActors._defineProperty(this, "always", void 0);
115
+ this.parent = options._parent;
116
+ this.key = options._key;
117
+ this.machine = options._machine;
118
+ this.path = this.parent ? this.parent.path.concat(this.key) : [];
119
+ this.id = this.config.id || [this.machine.id].concat(actors_dist_xstateActors._toConsumableArray(this.path)).join(this.machine.delimiter);
120
+ this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? 'compound' : this.config.history ? 'history' : 'atomic');
121
+ this.description = this.config.description;
122
+ this.order = this.machine.idMap.size;
123
+ this.machine.idMap.set(this.id, this);
124
+ this.states = this.config.states ? actors_dist_xstateActors.mapValues(this.config.states, function (stateConfig, key) {
125
+ var stateNode = new StateNode(stateConfig, {
126
+ _parent: _this,
127
+ _key: key,
128
+ _machine: _this.machine
129
+ });
130
+ return stateNode;
131
+ }) : EMPTY_OBJECT;
132
+ if (this.type === 'compound' && !this.config.initial) {
133
+ throw new Error("No initial state specified for compound state node \"#".concat(this.id, "\". Try adding { initial: \"").concat(Object.keys(this.states)[0], "\" } to the state config."));
33
134
  }
135
+
136
+ // History config
137
+ this.history = this.config.history === true ? 'shallow' : this.config.history || false;
138
+ this.entry = actors_dist_xstateActors.toActionObjects(this.config.entry);
139
+ this.exit = actors_dist_xstateActors.toActionObjects(this.config.exit);
140
+ this.meta = this.config.meta;
141
+ this.doneData = this.type === 'final' ? this.config.data : undefined;
142
+ this.tags = actors_dist_xstateActors.toArray(config.tags);
34
143
  }
144
+ actors_dist_xstateActors._createClass(StateNode, [{
145
+ key: "_initialize",
146
+ value: function _initialize() {
147
+ var _this2 = this;
148
+ this.transitions = actors_dist_xstateActors.formatTransitions(this);
149
+ if (this.config.always) {
150
+ this.always = actors_dist_xstateActors.toTransitionConfigArray(actors_dist_xstateActors.NULL_EVENT, this.config.always).map(function (t) {
151
+ return actors_dist_xstateActors.formatTransition(_this2, t);
152
+ });
153
+ }
154
+ Object.keys(this.states).forEach(function (key) {
155
+ _this2.states[key]._initialize();
156
+ });
157
+ }
35
158
 
36
- return stateMap[foundStateId];
37
- }
159
+ /**
160
+ * The well-structured state node definition.
161
+ */
162
+ }, {
163
+ key: "definition",
164
+ get: function get() {
165
+ var _this3 = this;
166
+ return {
167
+ id: this.id,
168
+ key: this.key,
169
+ version: this.machine.version,
170
+ type: this.type,
171
+ initial: this.initial ? {
172
+ target: this.initial.target,
173
+ source: this,
174
+ actions: this.initial.actions,
175
+ eventType: null,
176
+ external: false,
177
+ toJSON: function toJSON() {
178
+ return {
179
+ target: _this3.initial.target.map(function (t) {
180
+ return "#".concat(t.id);
181
+ }),
182
+ source: "#".concat(_this3.id),
183
+ actions: _this3.initial.actions,
184
+ eventType: null
185
+ };
186
+ }
187
+ } : undefined,
188
+ history: this.history,
189
+ states: actors_dist_xstateActors.mapValues(this.states, function (state) {
190
+ return state.definition;
191
+ }),
192
+ on: this.on,
193
+ transitions: this.transitions,
194
+ entry: this.entry,
195
+ exit: this.exit,
196
+ meta: this.meta,
197
+ order: this.order || -1,
198
+ data: this.doneData,
199
+ invoke: this.invoke,
200
+ description: this.description,
201
+ tags: this.tags
202
+ };
203
+ }
204
+ }, {
205
+ key: "toJSON",
206
+ value: function toJSON() {
207
+ return this.definition;
208
+ }
38
209
 
39
- function matchState(state, patterns, defaultValue) {
40
- var resolvedState = guards_dist_xstateGuards.State.from(state, state instanceof guards_dist_xstateGuards.State ? state.context : undefined);
210
+ /**
211
+ * The behaviors invoked as actors by this state node.
212
+ */
213
+ }, {
214
+ key: "invoke",
215
+ get: function get() {
216
+ var _this4 = this;
217
+ return actors_dist_xstateActors.memo(this, 'invoke', function () {
218
+ return actors_dist_xstateActors.toArray(_this4.config.invoke).map(function (invocable, i) {
219
+ var generatedId = actors_dist_xstateActors.createInvokeId(_this4.id, i);
220
+ var invokeConfig = actors_dist_xstateActors.toInvokeConfig(invocable, generatedId);
221
+ var resolvedId = invokeConfig.id || generatedId;
222
+ var src = invokeConfig.src,
223
+ systemId = invokeConfig.systemId;
224
+ var resolvedSrc = actors_dist_xstateActors.isString(src) ? src : !('type' in src) ? resolvedId : src;
225
+ if (!_this4.machine.options.actors[resolvedId] && typeof src !== 'string' && !('type' in src)) {
226
+ _this4.machine.options.actors = actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, _this4.machine.options.actors), {}, actors_dist_xstateActors._defineProperty({}, resolvedId, src));
227
+ }
228
+ return actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({
229
+ type: actors_dist_xstateActors.invoke
230
+ }, invokeConfig), {}, {
231
+ src: resolvedSrc,
232
+ id: resolvedId,
233
+ systemId: systemId,
234
+ toJSON: function toJSON() {
235
+ var onDone = invokeConfig.onDone,
236
+ onError = invokeConfig.onError,
237
+ invokeDefValues = actors_dist_xstateActors._objectWithoutProperties(invokeConfig, _excluded);
238
+ return actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, invokeDefValues), {}, {
239
+ type: actors_dist_xstateActors.invoke,
240
+ src: resolvedSrc,
241
+ id: resolvedId
242
+ });
243
+ }
244
+ });
245
+ });
246
+ });
247
+ }
41
248
 
42
- var _iterator = guards_dist_xstateGuards._createForOfIteratorHelper(patterns),
43
- _step;
249
+ /**
250
+ * The mapping of events to transitions.
251
+ */
252
+ }, {
253
+ key: "on",
254
+ get: function get() {
255
+ var _this5 = this;
256
+ return actors_dist_xstateActors.memo(this, 'on', function () {
257
+ var transitions = _this5.transitions;
258
+ return transitions.reduce(function (map, transition) {
259
+ map[transition.eventType] = map[transition.eventType] || [];
260
+ map[transition.eventType].push(transition);
261
+ return map;
262
+ }, {});
263
+ });
264
+ }
265
+ }, {
266
+ key: "after",
267
+ get: function get() {
268
+ var _this6 = this;
269
+ return actors_dist_xstateActors.memo(this, 'delayedTransitions', function () {
270
+ return actors_dist_xstateActors.getDelayedTransitions(_this6);
271
+ });
272
+ }
273
+ }, {
274
+ key: "initial",
275
+ get: function get() {
276
+ var _this7 = this;
277
+ return actors_dist_xstateActors.memo(this, 'initial', function () {
278
+ return actors_dist_xstateActors.formatInitialTransition(_this7, _this7.config.initial || []);
279
+ });
280
+ }
44
281
 
45
- try {
46
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
47
- var _step$value = guards_dist_xstateGuards._slicedToArray(_step.value, 2),
48
- stateValue = _step$value[0],
49
- getValue = _step$value[1];
282
+ /**
283
+ * Returns `true` if this state node explicitly handles the given event.
284
+ *
285
+ * @param event The event in question
286
+ */
287
+ }, {
288
+ key: "handles",
289
+ value: function handles(event) {
290
+ return this.events.includes(event.type);
291
+ }
292
+ }, {
293
+ key: "next",
294
+ value: function next(state, _event) {
295
+ var _this8 = this;
296
+ var eventName = _event.name;
297
+ var actions = [];
298
+ var selectedTransition;
299
+ var candidates = actors_dist_xstateActors.memo(this, "candidates-".concat(eventName.toString()), function () {
300
+ return actors_dist_xstateActors.getCandidates(_this8, eventName, _this8.machine.config.scxml // Whether token matching should be used
301
+ );
302
+ });
303
+ var _iterator = actors_dist_xstateActors._createForOfIteratorHelper(candidates),
304
+ _step;
305
+ try {
306
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
307
+ var candidate = _step.value;
308
+ var guard = candidate.guard;
309
+ var resolvedContext = state.context;
310
+ var guardPassed = false;
311
+ try {
312
+ guardPassed = !guard || actors_dist_xstateActors.evaluateGuard(guard, resolvedContext, _event, state);
313
+ } catch (err) {
314
+ throw new Error("Unable to evaluate guard '".concat(guard.type, "' in transition for event '").concat(eventName, "' in state node '").concat(this.id, "':\n").concat(err.message));
315
+ }
316
+ if (guardPassed) {
317
+ actions.push.apply(actions, actors_dist_xstateActors._toConsumableArray(candidate.actions));
318
+ selectedTransition = candidate;
319
+ break;
320
+ }
321
+ }
322
+ } catch (err) {
323
+ _iterator.e(err);
324
+ } finally {
325
+ _iterator.f();
326
+ }
327
+ return selectedTransition ? [selectedTransition] : undefined;
328
+ }
50
329
 
51
- if (resolvedState.matches(stateValue)) {
52
- return getValue(resolvedState);
330
+ /**
331
+ * The target state value of the history state node, if it exists. This represents the
332
+ * default state value to transition to if no history value exists yet.
333
+ */
334
+ }, {
335
+ key: "target",
336
+ get: function get() {
337
+ if (this.type === 'history') {
338
+ var historyConfig = this.config;
339
+ return historyConfig.target;
53
340
  }
341
+ return undefined;
342
+ }
343
+
344
+ /**
345
+ * All the state node IDs of this state node and its descendant state nodes.
346
+ */
347
+ }, {
348
+ key: "stateIds",
349
+ get: function get() {
350
+ var _this9 = this;
351
+ var childStateIds = actors_dist_xstateActors.flatten(Object.keys(this.states).map(function (stateKey) {
352
+ return _this9.states[stateKey].stateIds;
353
+ }));
354
+ return [this.id].concat(childStateIds);
355
+ }
356
+
357
+ /**
358
+ * All the event types accepted by this state node and its descendants.
359
+ */
360
+ }, {
361
+ key: "events",
362
+ get: function get() {
363
+ var _this10 = this;
364
+ return actors_dist_xstateActors.memo(this, 'events', function () {
365
+ var states = _this10.states;
366
+ var events = new Set(_this10.ownEvents);
367
+ if (states) {
368
+ for (var _i = 0, _Object$keys = Object.keys(states); _i < _Object$keys.length; _i++) {
369
+ var stateId = _Object$keys[_i];
370
+ var state = states[stateId];
371
+ if (state.states) {
372
+ var _iterator2 = actors_dist_xstateActors._createForOfIteratorHelper(state.events),
373
+ _step2;
374
+ try {
375
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
376
+ var event = _step2.value;
377
+ events.add("".concat(event));
378
+ }
379
+ } catch (err) {
380
+ _iterator2.e(err);
381
+ } finally {
382
+ _iterator2.f();
383
+ }
384
+ }
385
+ }
386
+ }
387
+ return Array.from(events);
388
+ });
389
+ }
390
+
391
+ /**
392
+ * All the events that have transitions directly from this state node.
393
+ *
394
+ * Excludes any inert events.
395
+ */
396
+ }, {
397
+ key: "ownEvents",
398
+ get: function get() {
399
+ var events = new Set(this.transitions.filter(function (transition) {
400
+ return !(!transition.target && !transition.actions.length && !transition.external);
401
+ }).map(function (transition) {
402
+ return transition.eventType;
403
+ }));
404
+ return Array.from(events);
54
405
  }
55
- } catch (err) {
56
- _iterator.e(err);
57
- } finally {
58
- _iterator.f();
406
+ }]);
407
+ return StateNode;
408
+ }();
409
+
410
+ var STATE_IDENTIFIER = '#';
411
+ function createDefaultOptions() {
412
+ return {
413
+ actions: {},
414
+ actors: {},
415
+ delays: {},
416
+ guards: {},
417
+ context: {}
418
+ };
419
+ }
420
+ var StateMachine = /*#__PURE__*/function () {
421
+ function StateMachine(
422
+ /**
423
+ * The raw config used to create the machine.
424
+ */
425
+ config, options) {
426
+ var _this$config$schema;
427
+ actors_dist_xstateActors._classCallCheck(this, StateMachine);
428
+ this.config = config;
429
+ actors_dist_xstateActors._defineProperty(this, "version", void 0);
430
+ actors_dist_xstateActors._defineProperty(this, "delimiter", void 0);
431
+ actors_dist_xstateActors._defineProperty(this, "options", void 0);
432
+ actors_dist_xstateActors._defineProperty(this, "schema", void 0);
433
+ actors_dist_xstateActors._defineProperty(this, "__xstatenode", true);
434
+ actors_dist_xstateActors._defineProperty(this, "idMap", new Map());
435
+ actors_dist_xstateActors._defineProperty(this, "root", void 0);
436
+ actors_dist_xstateActors._defineProperty(this, "id", void 0);
437
+ actors_dist_xstateActors._defineProperty(this, "states", void 0);
438
+ actors_dist_xstateActors._defineProperty(this, "events", void 0);
439
+ actors_dist_xstateActors._defineProperty(this, "__TContext", void 0);
440
+ actors_dist_xstateActors._defineProperty(this, "__TEvent", void 0);
441
+ actors_dist_xstateActors._defineProperty(this, "__TAction", void 0);
442
+ actors_dist_xstateActors._defineProperty(this, "__TActorMap", void 0);
443
+ actors_dist_xstateActors._defineProperty(this, "__TResolvedTypesMeta", void 0);
444
+ this.id = config.id || '(machine)';
445
+ this.options = Object.assign(createDefaultOptions(), options);
446
+ this.delimiter = this.config.delimiter || actors_dist_xstateActors.STATE_DELIMITER;
447
+ this.version = this.config.version;
448
+ this.schema = (_this$config$schema = this.config.schema) !== null && _this$config$schema !== void 0 ? _this$config$schema : {};
449
+ this.transition = this.transition.bind(this);
450
+ this.root = new StateNode(config, {
451
+ _key: this.id,
452
+ _machine: this
453
+ });
454
+ this.root._initialize();
455
+ this.states = this.root.states; // TODO: remove!
456
+ this.events = this.root.events;
59
457
  }
60
458
 
61
- return defaultValue(resolvedState);
459
+ /**
460
+ * Clones this state machine with the provided implementations
461
+ * and merges the `context` (if provided).
462
+ *
463
+ * @param implementations Options (`actions`, `guards`, `actors`, `delays`, `context`)
464
+ * to recursively merge with the existing options.
465
+ *
466
+ * @returns A new `StateMachine` instance with the provided implementations.
467
+ */
468
+ actors_dist_xstateActors._createClass(StateMachine, [{
469
+ key: "getContext",
470
+ value:
471
+ // TODO: this getter should be removed
472
+ function getContext(input) {
473
+ return this.getContextAndActions(undefined, input)[0];
474
+ }
475
+ }, {
476
+ key: "getContextAndActions",
477
+ value: function getContextAndActions(actorCtx, input) {
478
+ var actions = [];
479
+ var context = this.config.context;
480
+ var resolvedContext = typeof context === 'function' ? context({
481
+ spawn: actors_dist_xstateActors.createSpawner(actorCtx === null || actorCtx === void 0 ? void 0 : actorCtx.self, this, undefined,
482
+ // TODO: this requires `| undefined` for all referenced dynamic inputs that are spawnable in the context factory,
483
+ actors_dist_xstateActors.createInitEvent(input), actions),
484
+ input: input
485
+ }) : context;
486
+ return [resolvedContext || {}, actions];
487
+ }
488
+ /**
489
+ * The machine's own version.
490
+ */
491
+ }, {
492
+ key: "provide",
493
+ value: function provide(implementations) {
494
+ var _this$options = this.options,
495
+ actions = _this$options.actions,
496
+ guards = _this$options.guards,
497
+ actors = _this$options.actors,
498
+ delays = _this$options.delays;
499
+ return new StateMachine(this.config, {
500
+ actions: actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, actions), implementations.actions),
501
+ guards: actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, guards), implementations.guards),
502
+ actors: actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, actors), implementations.actors),
503
+ delays: actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, delays), implementations.delays)
504
+ });
505
+ }
506
+
507
+ /**
508
+ * Resolves the given `state` to a new `State` instance relative to this machine.
509
+ *
510
+ * This ensures that `.nextEvents` represent the correct values.
511
+ *
512
+ * @param state The state to resolve
513
+ */
514
+ }, {
515
+ key: "resolveState",
516
+ value: function resolveState(state) {
517
+ var configurationSet = actors_dist_xstateActors.getConfiguration(actors_dist_xstateActors.getStateNodes(this.root, state.value));
518
+ var configuration = Array.from(configurationSet);
519
+ return this.createState(actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, state), {}, {
520
+ value: actors_dist_xstateActors.resolveStateValue(this.root, state.value),
521
+ configuration: configuration,
522
+ done: actors_dist_xstateActors.isInFinalState(configuration)
523
+ }));
524
+ }
525
+ }, {
526
+ key: "resolveStateValue",
527
+ value: function resolveStateValue(stateValue) {
528
+ var resolvedStateValue = actors_dist_xstateActors.resolveStateValue(this.root, stateValue);
529
+ var resolvedContext = this.getContext();
530
+ return this.resolveState(actors_dist_xstateActors.State.from(resolvedStateValue, resolvedContext, this));
531
+ }
532
+
533
+ /**
534
+ * Determines the next state given the current `state` and received `event`.
535
+ * Calculates a full macrostep from all microsteps.
536
+ *
537
+ * @param state The current State instance or state value
538
+ * @param event The received event
539
+ */
540
+ }, {
541
+ key: "transition",
542
+ value: function transition() {
543
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.initialState;
544
+ var event = arguments.length > 1 ? arguments[1] : undefined;
545
+ var actorCtx = arguments.length > 2 ? arguments[2] : undefined;
546
+ var currentState = state instanceof actors_dist_xstateActors.State ? state : this.resolveStateValue(state);
547
+ // TODO: handle error events in a better way
548
+ var scxmlEvent = actors_dist_xstateActors.toSCXMLEvent(event);
549
+ if (actors_dist_xstateActors.isSCXMLErrorEvent(scxmlEvent) && !currentState.nextEvents.some(function (nextEvent) {
550
+ return nextEvent === scxmlEvent.name;
551
+ })) {
552
+ throw scxmlEvent.data.data;
553
+ }
554
+ var _macrostep = actors_dist_xstateActors.macrostep(currentState, scxmlEvent, actorCtx),
555
+ nextState = _macrostep.state;
556
+ return nextState;
557
+ }
558
+
559
+ /**
560
+ * Determines the next state given the current `state` and `event`.
561
+ * Calculates a microstep.
562
+ *
563
+ * @param state The current state
564
+ * @param event The received event
565
+ */
566
+ }, {
567
+ key: "microstep",
568
+ value: function microstep() {
569
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.initialState;
570
+ var event = arguments.length > 1 ? arguments[1] : undefined;
571
+ var actorCtx = arguments.length > 2 ? arguments[2] : undefined;
572
+ var scxmlEvent = actors_dist_xstateActors.toSCXMLEvent(event);
573
+ var _macrostep2 = actors_dist_xstateActors.macrostep(state, scxmlEvent, actorCtx),
574
+ microstates = _macrostep2.microstates;
575
+ return microstates;
576
+ }
577
+ }, {
578
+ key: "getTransitionData",
579
+ value: function getTransitionData(state, _event) {
580
+ return actors_dist_xstateActors.transitionNode(this.root, state.value, state, _event) || [];
581
+ }
582
+
583
+ /**
584
+ * The initial state _before_ evaluating any microsteps.
585
+ * This "pre-initial" state is provided to initial actions executed in the initial state.
586
+ */
587
+ }, {
588
+ key: "getPreInitialState",
589
+ value: function getPreInitialState(actorCtx, input) {
590
+ var _preInitial$actions;
591
+ var _this$getContextAndAc = this.getContextAndActions(actorCtx, input),
592
+ _this$getContextAndAc2 = actors_dist_xstateActors._slicedToArray(_this$getContextAndAc, 2),
593
+ context = _this$getContextAndAc2[0],
594
+ actions = _this$getContextAndAc2[1];
595
+ var config = actors_dist_xstateActors.getInitialConfiguration(this.root);
596
+ var preInitial = this.resolveState(this.createState({
597
+ value: {},
598
+ // TODO: this is computed in state constructor
599
+ context: context,
600
+ _event: actors_dist_xstateActors.createInitEvent({}),
601
+ actions: [],
602
+ meta: undefined,
603
+ configuration: config,
604
+ transitions: [],
605
+ children: {}
606
+ }));
607
+ preInitial._initial = true;
608
+ (_preInitial$actions = preInitial.actions).unshift.apply(_preInitial$actions, actors_dist_xstateActors._toConsumableArray(actions));
609
+ if (actorCtx) {
610
+ var _resolveActionsAndCon = actors_dist_xstateActors.resolveActionsAndContext(actions, actors_dist_xstateActors.initEvent, preInitial, actorCtx),
611
+ nextState = _resolveActionsAndCon.nextState;
612
+ preInitial.children = nextState.children;
613
+ preInitial.actions = nextState.actions;
614
+ }
615
+ return preInitial;
616
+ }
617
+
618
+ /**
619
+ * The initial State instance, which includes all actions to be executed from
620
+ * entering the initial state.
621
+ */
622
+ }, {
623
+ key: "initialState",
624
+ get: function get() {
625
+ return this.getInitialState();
626
+ }
627
+
628
+ /**
629
+ * Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
630
+ */
631
+ }, {
632
+ key: "getInitialState",
633
+ value: function getInitialState(actorCtx, input) {
634
+ var _nextState$actions;
635
+ var initEvent = actors_dist_xstateActors.createInitEvent(input); // TODO: fix;
636
+
637
+ var preInitialState = this.getPreInitialState(actorCtx, input);
638
+ var nextState = actors_dist_xstateActors.microstep([], preInitialState, actorCtx, initEvent);
639
+ (_nextState$actions = nextState.actions).unshift.apply(_nextState$actions, actors_dist_xstateActors._toConsumableArray(preInitialState.actions));
640
+ var _macrostep3 = actors_dist_xstateActors.macrostep(nextState, initEvent, actorCtx),
641
+ macroState = _macrostep3.state;
642
+ return macroState;
643
+ }
644
+ }, {
645
+ key: "start",
646
+ value: function start(state, actorCtx) {
647
+ state.actions.forEach(function (action) {
648
+ var _action$execute;
649
+ (_action$execute = action.execute) === null || _action$execute === void 0 ? void 0 : _action$execute.call(action, actorCtx);
650
+ });
651
+ Object.values(state.children).forEach(function (child) {
652
+ if (child.status === 0) {
653
+ try {
654
+ var _child$start;
655
+ (_child$start = child.start) === null || _child$start === void 0 ? void 0 : _child$start.call(child);
656
+ } catch (err) {
657
+ // TODO: unify error handling when child starts
658
+ actorCtx.self.send(actors_dist_xstateActors.error(child.id, err));
659
+ }
660
+ }
661
+ });
662
+ }
663
+ }, {
664
+ key: "getStateNodeById",
665
+ value: function getStateNodeById(stateId) {
666
+ var resolvedStateId = actors_dist_xstateActors.isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;
667
+ var stateNode = this.idMap.get(resolvedStateId);
668
+ if (!stateNode) {
669
+ throw new Error("Child state node '#".concat(resolvedStateId, "' does not exist on machine '").concat(this.id, "'"));
670
+ }
671
+ return stateNode;
672
+ }
673
+ }, {
674
+ key: "definition",
675
+ get: function get() {
676
+ return actors_dist_xstateActors._objectSpread2({
677
+ context: this.getContext()
678
+ }, this.root.definition);
679
+ }
680
+ }, {
681
+ key: "toJSON",
682
+ value: function toJSON() {
683
+ return this.definition;
684
+ }
685
+ }, {
686
+ key: "getPersistedState",
687
+ value: function getPersistedState(state) {
688
+ return actors_dist_xstateActors.getPersistedState(state);
689
+ }
690
+ }, {
691
+ key: "createState",
692
+ value: function createState(stateConfig) {
693
+ var state = stateConfig instanceof actors_dist_xstateActors.State ? stateConfig : new actors_dist_xstateActors.State(stateConfig, this);
694
+ var _resolveActionsAndCon2 = actors_dist_xstateActors.resolveActionsAndContext(state.actions, state._event, state, undefined),
695
+ resolvedState = _resolveActionsAndCon2.nextState;
696
+ return resolvedState;
697
+ }
698
+ }, {
699
+ key: "getStatus",
700
+ value: function getStatus(state) {
701
+ return state.done ? {
702
+ status: 'done',
703
+ data: state.output
704
+ } : {
705
+ status: 'active'
706
+ };
707
+ }
708
+ }, {
709
+ key: "restoreState",
710
+ value: function restoreState(state, _actorCtx) {
711
+ var _this = this;
712
+ var children = {};
713
+ Object.keys(state.children).forEach(function (actorId) {
714
+ var _resolveReferencedAct, _behavior$restoreStat;
715
+ var actorData = state.children[actorId];
716
+ var childState = actorData.state;
717
+ var src = actorData.src;
718
+ var behavior = src ? (_resolveReferencedAct = actors_dist_xstateActors.resolveReferencedActor(_this.options.actors[src])) === null || _resolveReferencedAct === void 0 ? void 0 : _resolveReferencedAct.src : undefined;
719
+ if (!behavior) {
720
+ return;
721
+ }
722
+ var actorState = (_behavior$restoreStat = behavior.restoreState) === null || _behavior$restoreStat === void 0 ? void 0 : _behavior$restoreStat.call(behavior, childState, _actorCtx);
723
+ var actorRef = actors_dist_xstateActors.interpret(behavior, {
724
+ id: actorId,
725
+ state: actorState
726
+ });
727
+ children[actorId] = actorRef;
728
+ });
729
+ var restoredState = this.createState(new actors_dist_xstateActors.State(actors_dist_xstateActors._objectSpread2(actors_dist_xstateActors._objectSpread2({}, state), {}, {
730
+ children: children
731
+ }), this));
732
+
733
+ // TODO: DRY this up
734
+ restoredState.configuration.forEach(function (stateNode) {
735
+ if (stateNode.invoke) {
736
+ stateNode.invoke.forEach(function (invokeConfig) {
737
+ var id = invokeConfig.id,
738
+ src = invokeConfig.src;
739
+ if (children[id]) {
740
+ return;
741
+ }
742
+ var referenced = actors_dist_xstateActors.resolveReferencedActor(_this.options.actors[src]);
743
+ if (referenced) {
744
+ var actorRef = actors_dist_xstateActors.interpret(referenced.src, {
745
+ id: id,
746
+ parent: _actorCtx === null || _actorCtx === void 0 ? void 0 : _actorCtx.self,
747
+ input: 'input' in invokeConfig ? invokeConfig.input : referenced.input
748
+ });
749
+ children[id] = actorRef;
750
+ }
751
+ });
752
+ }
753
+ });
754
+ return restoredState;
755
+ }
756
+
757
+ /**@deprecated an internal property acting as a "phantom" type, not meant to be used at runtime */
758
+ }]);
759
+ return StateMachine;
760
+ }();
761
+
762
+ function createMachine(config, implementations) {
763
+ return new StateMachine(config, implementations);
764
+ }
765
+
766
+ function mapState(stateMap, stateId) {
767
+ var foundStateId;
768
+ for (var _i = 0, _Object$keys = Object.keys(stateMap); _i < _Object$keys.length; _i++) {
769
+ var mappedStateId = _Object$keys[_i];
770
+ if (actors_dist_xstateActors.matchesState(mappedStateId, stateId) && (!foundStateId || stateId.length > foundStateId.length)) {
771
+ foundStateId = mappedStateId;
772
+ }
773
+ }
774
+ return stateMap[foundStateId];
62
775
  }
63
776
 
64
777
  function createSchema(schema) {
@@ -68,16 +781,12 @@ var t = createSchema;
68
781
 
69
782
  var SimulatedClock = /*#__PURE__*/function () {
70
783
  function SimulatedClock() {
71
- guards_dist_xstateGuards._classCallCheck(this, SimulatedClock);
72
-
73
- guards_dist_xstateGuards._defineProperty(this, "timeouts", new Map());
74
-
75
- guards_dist_xstateGuards._defineProperty(this, "_now", 0);
76
-
77
- guards_dist_xstateGuards._defineProperty(this, "_id", 0);
784
+ actors_dist_xstateActors._classCallCheck(this, SimulatedClock);
785
+ actors_dist_xstateActors._defineProperty(this, "timeouts", new Map());
786
+ actors_dist_xstateActors._defineProperty(this, "_now", 0);
787
+ actors_dist_xstateActors._defineProperty(this, "_id", 0);
78
788
  }
79
-
80
- guards_dist_xstateGuards._createClass(SimulatedClock, [{
789
+ actors_dist_xstateActors._createClass(SimulatedClock, [{
81
790
  key: "now",
82
791
  value: function now() {
83
792
  return this._now;
@@ -109,7 +818,6 @@ var SimulatedClock = /*#__PURE__*/function () {
109
818
  if (this._now > time) {
110
819
  throw new Error('Unable to travel back in time');
111
820
  }
112
-
113
821
  this._now = time;
114
822
  this.flushTimeouts();
115
823
  }
@@ -117,27 +825,22 @@ var SimulatedClock = /*#__PURE__*/function () {
117
825
  key: "flushTimeouts",
118
826
  value: function flushTimeouts() {
119
827
  var _this = this;
120
-
121
- guards_dist_xstateGuards._toConsumableArray(this.timeouts).sort(function (_ref, _ref2) {
122
- var _ref3 = guards_dist_xstateGuards._slicedToArray(_ref, 2),
123
- _idA = _ref3[0],
124
- timeoutA = _ref3[1];
125
-
126
- var _ref4 = guards_dist_xstateGuards._slicedToArray(_ref2, 2),
127
- _idB = _ref4[0],
128
- timeoutB = _ref4[1];
129
-
828
+ actors_dist_xstateActors._toConsumableArray(this.timeouts).sort(function (_ref, _ref2) {
829
+ var _ref3 = actors_dist_xstateActors._slicedToArray(_ref, 2),
830
+ _idA = _ref3[0],
831
+ timeoutA = _ref3[1];
832
+ var _ref4 = actors_dist_xstateActors._slicedToArray(_ref2, 2),
833
+ _idB = _ref4[0],
834
+ timeoutB = _ref4[1];
130
835
  var endA = timeoutA.start + timeoutA.timeout;
131
836
  var endB = timeoutB.start + timeoutB.timeout;
132
837
  return endB > endA ? -1 : 1;
133
838
  }).forEach(function (_ref5) {
134
- var _ref6 = guards_dist_xstateGuards._slicedToArray(_ref5, 2),
135
- id = _ref6[0],
136
- timeout = _ref6[1];
137
-
839
+ var _ref6 = actors_dist_xstateActors._slicedToArray(_ref5, 2),
840
+ id = _ref6[0],
841
+ timeout = _ref6[1];
138
842
  if (_this.now() - timeout.start >= timeout.timeout) {
139
843
  _this.timeouts["delete"](id);
140
-
141
844
  timeout.fn.call(null);
142
845
  }
143
846
  });
@@ -149,69 +852,64 @@ var SimulatedClock = /*#__PURE__*/function () {
149
852
  this.flushTimeouts();
150
853
  }
151
854
  }]);
152
-
153
855
  return SimulatedClock;
154
856
  }();
155
857
 
156
858
  var actions = {
157
- raise: guards_dist_xstateGuards.raise,
158
- send: guards_dist_xstateGuards.send,
159
- sendParent: guards_dist_xstateGuards.sendParent,
160
- sendTo: guards_dist_xstateGuards.sendTo,
161
- sendUpdate: guards_dist_xstateGuards.sendUpdate,
162
- log: guards_dist_xstateGuards.log,
163
- cancel: guards_dist_xstateGuards.cancel,
164
- stop: guards_dist_xstateGuards.stop,
165
- assign: guards_dist_xstateGuards.assign,
166
- after: guards_dist_xstateGuards.after,
167
- done: guards_dist_xstateGuards.done,
168
- respond: guards_dist_xstateGuards.respond,
169
- forwardTo: guards_dist_xstateGuards.forwardTo,
170
- escalate: guards_dist_xstateGuards.escalate,
171
- choose: guards_dist_xstateGuards.choose,
859
+ raise: actors_dist_xstateActors.raise,
860
+ send: actors_dist_xstateActors.send,
861
+ sendParent: actors_dist_xstateActors.sendParent,
862
+ sendTo: actors_dist_xstateActors.sendTo,
863
+ log: actors_dist_xstateActors.log,
864
+ cancel: actors_dist_xstateActors.cancel,
865
+ stop: actors_dist_xstateActors.stop,
866
+ assign: actors_dist_xstateActors.assign,
867
+ after: actors_dist_xstateActors.after,
868
+ done: actors_dist_xstateActors.done,
869
+ respond: actors_dist_xstateActors.respond,
870
+ forwardTo: actors_dist_xstateActors.forwardTo,
871
+ escalate: actors_dist_xstateActors.escalate,
872
+ choose: actors_dist_xstateActors.choose,
172
873
  pure: pure
173
874
  };
174
875
 
175
876
  Object.defineProperty(exports, 'ActionTypes', {
176
877
  enumerable: true,
177
878
  get: function () {
178
- return guards_dist_xstateGuards.ActionTypes;
879
+ return actors_dist_xstateActors.ActionTypes;
179
880
  }
180
881
  });
181
- exports.Interpreter = guards_dist_xstateGuards.Interpreter;
882
+ exports.Interpreter = actors_dist_xstateActors.Interpreter;
182
883
  Object.defineProperty(exports, 'InterpreterStatus', {
183
884
  enumerable: true,
184
885
  get: function () {
185
- return guards_dist_xstateGuards.InterpreterStatus;
886
+ return actors_dist_xstateActors.ActorStatus;
186
887
  }
187
888
  });
188
- exports.ObservableActorRef = guards_dist_xstateGuards.ObservableActorRef;
189
889
  Object.defineProperty(exports, 'SpecialTargets', {
190
890
  enumerable: true,
191
891
  get: function () {
192
- return guards_dist_xstateGuards.SpecialTargets;
892
+ return actors_dist_xstateActors.SpecialTargets;
193
893
  }
194
894
  });
195
- exports.State = guards_dist_xstateGuards.State;
196
- exports.assign = guards_dist_xstateGuards.assign;
197
- exports.doneInvoke = guards_dist_xstateGuards.doneInvoke;
198
- exports.forwardTo = guards_dist_xstateGuards.forwardTo;
199
- exports.getStateNodes = guards_dist_xstateGuards.getStateNodes;
200
- exports.interpret = guards_dist_xstateGuards.interpret;
201
- exports.matchesState = guards_dist_xstateGuards.matchesState;
202
- exports.pathToStateValue = guards_dist_xstateGuards.pathToStateValue;
203
- exports.send = guards_dist_xstateGuards.send;
204
- exports.sendParent = guards_dist_xstateGuards.sendParent;
205
- exports.sendUpdate = guards_dist_xstateGuards.sendUpdate;
206
- exports.toEventObject = guards_dist_xstateGuards.toEventObject;
207
- exports.toObserver = guards_dist_xstateGuards.toObserver;
208
- exports.toSCXMLEvent = guards_dist_xstateGuards.toSCXMLEvent;
209
- exports.StateMachine = Machine.StateMachine;
210
- exports.StateNode = Machine.StateNode;
211
- exports.createMachine = Machine.createMachine;
895
+ exports.State = actors_dist_xstateActors.State;
896
+ exports.assign = actors_dist_xstateActors.assign;
897
+ exports.doneInvoke = actors_dist_xstateActors.doneInvoke;
898
+ exports.forwardTo = actors_dist_xstateActors.forwardTo;
899
+ exports.getStateNodes = actors_dist_xstateActors.getStateNodes;
900
+ exports.interpret = actors_dist_xstateActors.interpret;
901
+ exports.matchesState = actors_dist_xstateActors.matchesState;
902
+ exports.pathToStateValue = actors_dist_xstateActors.pathToStateValue;
903
+ exports.send = actors_dist_xstateActors.send;
904
+ exports.sendParent = actors_dist_xstateActors.sendParent;
905
+ exports.sendTo = actors_dist_xstateActors.sendTo;
906
+ exports.toObserver = actors_dist_xstateActors.toObserver;
907
+ exports.toSCXMLEvent = actors_dist_xstateActors.toSCXMLEvent;
212
908
  exports.SimulatedClock = SimulatedClock;
909
+ exports.StateMachine = StateMachine;
910
+ exports.StateNode = StateNode;
213
911
  exports.actions = actions;
912
+ exports.createMachine = createMachine;
214
913
  exports.createSchema = createSchema;
215
914
  exports.mapState = mapState;
216
- exports.matchState = matchState;
217
915
  exports.t = t;