xstate 5.0.0-beta.16 → 5.0.0-beta.17
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.
- package/actions/dist/xstate-actions.cjs.js +2 -5
- package/actions/dist/xstate-actions.cjs.mjs +2 -5
- package/actions/dist/xstate-actions.development.cjs.js +2 -5
- package/actions/dist/xstate-actions.development.esm.js +1 -1
- package/actions/dist/xstate-actions.esm.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.esm.js +1 -1
- package/actors/dist/xstate-actors.esm.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/{actions-6f7fbc84.development.esm.js → actions-13190b25.development.esm.js} +677 -844
- package/dist/{actions-0f903c0d.development.cjs.js → actions-40bd643f.development.cjs.js} +678 -850
- package/dist/{actions-0386b622.esm.js → actions-4d6514d2.esm.js} +653 -847
- package/dist/{actions-6b9073db.cjs.js → actions-5fb9f10d.cjs.js} +654 -853
- package/dist/declarations/src/State.d.ts +1 -1
- package/dist/declarations/src/StateNode.d.ts +4 -4
- package/dist/declarations/src/actions/assign.d.ts +11 -2
- package/dist/declarations/src/actions/cancel.d.ts +14 -3
- package/dist/declarations/src/actions/choose.d.ts +11 -3
- package/dist/declarations/src/actions/log.d.ts +22 -3
- package/dist/declarations/src/actions/pure.d.ts +17 -3
- package/dist/declarations/src/actions/raise.d.ts +5 -2
- package/dist/declarations/src/actions/send.d.ts +58 -6
- package/dist/declarations/src/actions/stop.d.ts +14 -2
- package/dist/declarations/src/actions.d.ts +4 -7
- package/dist/declarations/src/constantPrefixes.d.ts +6 -0
- package/dist/declarations/src/interpreter.d.ts +8 -3
- package/dist/declarations/src/stateUtils.d.ts +4 -8
- package/dist/declarations/src/types.d.ts +22 -187
- package/dist/declarations/src/utils.d.ts +1 -6
- package/dist/xstate.cjs.js +42 -19
- package/dist/xstate.cjs.mjs +1 -1
- package/dist/xstate.development.cjs.js +42 -19
- package/dist/xstate.development.esm.js +42 -19
- package/dist/xstate.esm.js +42 -19
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.esm.js +1 -1
- package/guards/dist/xstate-guards.esm.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/actions/dynamicAction.ts +0 -42
- package/dist/declarations/src/actionTypes.d.ts +0 -16
- package/dist/declarations/src/constants.d.ts +0 -5
|
@@ -17,12 +17,6 @@ var dev_dist_xstateDev = require('../dev/dist/xstate-dev.development.cjs.js');
|
|
|
17
17
|
|
|
18
18
|
// TODO: narrow this to logic from machine
|
|
19
19
|
|
|
20
|
-
// TODO: fix last param
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Extracts action objects that have no extra properties.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
20
|
/**
|
|
27
21
|
* The string or object representing the state value relative to the parent state node.
|
|
28
22
|
*
|
|
@@ -34,25 +28,15 @@ var dev_dist_xstateDev = require('../dev/dist/xstate-dev.development.cjs.js');
|
|
|
34
28
|
|
|
35
29
|
// TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
|
|
36
30
|
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ActionTypes["Log"] = "xstate.log";
|
|
47
|
-
ActionTypes["Init"] = "xstate.init";
|
|
48
|
-
ActionTypes["Invoke"] = "xstate.invoke";
|
|
49
|
-
ActionTypes["ErrorExecution"] = "error.execution";
|
|
50
|
-
ActionTypes["ErrorCommunication"] = "error.communication";
|
|
51
|
-
ActionTypes["ErrorPlatform"] = "error.platform";
|
|
52
|
-
ActionTypes["ErrorCustom"] = "xstate.error";
|
|
53
|
-
ActionTypes["Pure"] = "xstate.pure";
|
|
54
|
-
ActionTypes["Choose"] = "xstate.choose";
|
|
55
|
-
return ActionTypes;
|
|
31
|
+
let ConstantPrefix = /*#__PURE__*/function (ConstantPrefix) {
|
|
32
|
+
ConstantPrefix["After"] = "xstate.after";
|
|
33
|
+
ConstantPrefix["DoneState"] = "done.state";
|
|
34
|
+
ConstantPrefix["DoneInvoke"] = "done.invoke";
|
|
35
|
+
ConstantPrefix["ErrorExecution"] = "error.execution";
|
|
36
|
+
ConstantPrefix["ErrorCommunication"] = "error.communication";
|
|
37
|
+
ConstantPrefix["ErrorPlatform"] = "error.platform";
|
|
38
|
+
ConstantPrefix["ErrorCustom"] = "xstate.error";
|
|
39
|
+
return ConstantPrefix;
|
|
56
40
|
}({});
|
|
57
41
|
let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
58
42
|
SpecialTargets["Parent"] = "#_parent";
|
|
@@ -60,40 +44,19 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
|
60
44
|
return SpecialTargets;
|
|
61
45
|
}({});
|
|
62
46
|
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const doneState = ActionTypes.DoneState;
|
|
71
|
-
const log$1 = ActionTypes.Log;
|
|
72
|
-
const init = ActionTypes.Init;
|
|
73
|
-
const invoke$1 = ActionTypes.Invoke;
|
|
74
|
-
const errorExecution = ActionTypes.ErrorExecution;
|
|
75
|
-
const errorPlatform = ActionTypes.ErrorPlatform;
|
|
76
|
-
const error$1 = ActionTypes.ErrorCustom;
|
|
77
|
-
const choose$1 = ActionTypes.Choose;
|
|
78
|
-
const pure$1 = ActionTypes.Pure;
|
|
79
|
-
|
|
80
|
-
var actionTypes = /*#__PURE__*/Object.freeze({
|
|
47
|
+
const after$1 = ConstantPrefix.After;
|
|
48
|
+
const doneState = ConstantPrefix.DoneState;
|
|
49
|
+
const errorExecution = ConstantPrefix.ErrorExecution;
|
|
50
|
+
const errorPlatform = ConstantPrefix.ErrorPlatform;
|
|
51
|
+
const error$1 = ConstantPrefix.ErrorCustom;
|
|
52
|
+
|
|
53
|
+
var constantPrefixes = /*#__PURE__*/Object.freeze({
|
|
81
54
|
__proto__: null,
|
|
82
|
-
stop: stop$1,
|
|
83
|
-
raise: raise$1,
|
|
84
|
-
sendTo: sendTo$1,
|
|
85
|
-
cancel: cancel$1,
|
|
86
|
-
assign: assign$1,
|
|
87
55
|
after: after$1,
|
|
88
56
|
doneState: doneState,
|
|
89
|
-
log: log$1,
|
|
90
|
-
init: init,
|
|
91
|
-
invoke: invoke$1,
|
|
92
57
|
errorExecution: errorExecution,
|
|
93
58
|
errorPlatform: errorPlatform,
|
|
94
|
-
error: error$1
|
|
95
|
-
choose: choose$1,
|
|
96
|
-
pure: pure$1
|
|
59
|
+
error: error$1
|
|
97
60
|
});
|
|
98
61
|
|
|
99
62
|
const STATE_DELIMITER = '.';
|
|
@@ -101,208 +64,68 @@ const TARGETLESS_KEY = '';
|
|
|
101
64
|
const NULL_EVENT = '';
|
|
102
65
|
const STATE_IDENTIFIER = '#';
|
|
103
66
|
const WILDCARD = '*';
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
function isStateLike(state) {
|
|
137
|
-
return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state;
|
|
138
|
-
}
|
|
139
|
-
function toStateValue(stateValue) {
|
|
140
|
-
if (isStateLike(stateValue)) {
|
|
141
|
-
return stateValue.value;
|
|
142
|
-
}
|
|
143
|
-
if (isArray(stateValue)) {
|
|
144
|
-
return pathToStateValue(stateValue);
|
|
145
|
-
}
|
|
146
|
-
if (typeof stateValue !== 'string') {
|
|
147
|
-
return stateValue;
|
|
148
|
-
}
|
|
149
|
-
const statePath = toStatePath(stateValue);
|
|
150
|
-
return pathToStateValue(statePath);
|
|
151
|
-
}
|
|
152
|
-
function pathToStateValue(statePath) {
|
|
153
|
-
if (statePath.length === 1) {
|
|
154
|
-
return statePath[0];
|
|
155
|
-
}
|
|
156
|
-
const value = {};
|
|
157
|
-
let marker = value;
|
|
158
|
-
for (let i = 0; i < statePath.length - 1; i++) {
|
|
159
|
-
if (i === statePath.length - 2) {
|
|
160
|
-
marker[statePath[i]] = statePath[i + 1];
|
|
67
|
+
const INIT_TYPE = 'xstate.init';
|
|
68
|
+
|
|
69
|
+
function resolve$8(actorContext, state, args, {
|
|
70
|
+
to,
|
|
71
|
+
event: eventOrExpr,
|
|
72
|
+
id,
|
|
73
|
+
delay
|
|
74
|
+
}) {
|
|
75
|
+
const delaysMap = state.machine.implementations.delays;
|
|
76
|
+
if (typeof eventOrExpr === 'string') {
|
|
77
|
+
throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead`);
|
|
78
|
+
}
|
|
79
|
+
const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args) : eventOrExpr;
|
|
80
|
+
let resolvedDelay;
|
|
81
|
+
if (typeof delay === 'string') {
|
|
82
|
+
const configDelay = delaysMap && delaysMap[delay];
|
|
83
|
+
resolvedDelay = typeof configDelay === 'function' ? configDelay(args) : configDelay;
|
|
84
|
+
} else {
|
|
85
|
+
resolvedDelay = typeof delay === 'function' ? delay(args) : delay;
|
|
86
|
+
}
|
|
87
|
+
const resolvedTarget = typeof to === 'function' ? to(args) : to;
|
|
88
|
+
let targetActorRef;
|
|
89
|
+
if (typeof resolvedTarget === 'string') {
|
|
90
|
+
if (resolvedTarget === SpecialTargets.Parent) {
|
|
91
|
+
targetActorRef = actorContext?.self._parent;
|
|
92
|
+
} else if (resolvedTarget === SpecialTargets.Internal) {
|
|
93
|
+
targetActorRef = actorContext?.self;
|
|
94
|
+
} else if (resolvedTarget.startsWith('#_')) {
|
|
95
|
+
// SCXML compatibility: https://www.w3.org/TR/scxml/#SCXMLEventProcessor
|
|
96
|
+
// #_invokeid. If the target is the special term '#_invokeid', where invokeid is the invokeid of an SCXML session that the sending session has created by <invoke>, the Processor must add the event to the external queue of that session.
|
|
97
|
+
targetActorRef = state.children[resolvedTarget.slice(2)];
|
|
161
98
|
} else {
|
|
162
|
-
|
|
163
|
-
marker = {};
|
|
164
|
-
previous[statePath[i]] = marker;
|
|
99
|
+
targetActorRef = state.children[resolvedTarget];
|
|
165
100
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
function mapValues(collection, iteratee) {
|
|
170
|
-
const result = {};
|
|
171
|
-
const collectionKeys = Object.keys(collection);
|
|
172
|
-
for (let i = 0; i < collectionKeys.length; i++) {
|
|
173
|
-
const key = collectionKeys[i];
|
|
174
|
-
result[key] = iteratee(collection[key], key, collection, i);
|
|
175
|
-
}
|
|
176
|
-
return result;
|
|
177
|
-
}
|
|
178
|
-
function flatten(array) {
|
|
179
|
-
return [].concat(...array);
|
|
180
|
-
}
|
|
181
|
-
function toArrayStrict(value) {
|
|
182
|
-
if (isArray(value)) {
|
|
183
|
-
return value;
|
|
184
|
-
}
|
|
185
|
-
return [value];
|
|
186
|
-
}
|
|
187
|
-
function toArray(value) {
|
|
188
|
-
if (value === undefined) {
|
|
189
|
-
return [];
|
|
190
|
-
}
|
|
191
|
-
return toArrayStrict(value);
|
|
192
|
-
}
|
|
193
|
-
function mapContext(mapper, context, event) {
|
|
194
|
-
if (isFunction(mapper)) {
|
|
195
|
-
return mapper({
|
|
196
|
-
context,
|
|
197
|
-
event
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
const result = {};
|
|
201
|
-
const args = {
|
|
202
|
-
context,
|
|
203
|
-
event
|
|
204
|
-
};
|
|
205
|
-
for (const key of Object.keys(mapper)) {
|
|
206
|
-
const subMapper = mapper[key];
|
|
207
|
-
if (isFunction(subMapper)) {
|
|
208
|
-
result[key] = subMapper(args);
|
|
209
|
-
} else {
|
|
210
|
-
result[key] = subMapper;
|
|
101
|
+
if (!targetActorRef) {
|
|
102
|
+
throw new Error(`Unable to send event to actor '${resolvedTarget}' from machine '${state.machine.id}'.`);
|
|
211
103
|
}
|
|
104
|
+
} else {
|
|
105
|
+
targetActorRef = resolvedTarget || actorContext?.self;
|
|
212
106
|
}
|
|
213
|
-
return
|
|
107
|
+
return [state, {
|
|
108
|
+
to: targetActorRef,
|
|
109
|
+
event: resolvedEvent,
|
|
110
|
+
id,
|
|
111
|
+
delay: resolvedDelay
|
|
112
|
+
}];
|
|
214
113
|
}
|
|
215
|
-
function
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// Check if shape matches the Promise/A+ specification for a "thenable".
|
|
220
|
-
if (value !== null && (isFunction(value) || typeof value === 'object') && isFunction(value.then)) {
|
|
221
|
-
return true;
|
|
114
|
+
function execute$5(actorContext, params) {
|
|
115
|
+
if (typeof params.delay === 'number') {
|
|
116
|
+
actorContext.self.delaySend(params);
|
|
117
|
+
return;
|
|
222
118
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
function isString(value) {
|
|
234
|
-
return typeof value === 'string';
|
|
235
|
-
}
|
|
236
|
-
function isErrorEvent(event) {
|
|
237
|
-
return typeof event.type === 'string' && (event.type === errorExecution || event.type.startsWith(errorPlatform));
|
|
238
|
-
}
|
|
239
|
-
function toTransitionConfigArray(event, configLike) {
|
|
240
|
-
const transitions = toArrayStrict(configLike).map(transitionLike => {
|
|
241
|
-
if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string') {
|
|
242
|
-
return {
|
|
243
|
-
target: transitionLike,
|
|
244
|
-
event
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
...transitionLike,
|
|
249
|
-
event
|
|
250
|
-
};
|
|
119
|
+
const {
|
|
120
|
+
to,
|
|
121
|
+
event
|
|
122
|
+
} = params;
|
|
123
|
+
actorContext.defer(() => {
|
|
124
|
+
to.send(event.type === error$1 ? {
|
|
125
|
+
type: `${error(actorContext.self.id)}`,
|
|
126
|
+
data: event.data
|
|
127
|
+
} : event);
|
|
251
128
|
});
|
|
252
|
-
return transitions;
|
|
253
|
-
}
|
|
254
|
-
function normalizeTarget(target) {
|
|
255
|
-
if (target === undefined || target === TARGETLESS_KEY) {
|
|
256
|
-
return undefined;
|
|
257
|
-
}
|
|
258
|
-
return toArray(target);
|
|
259
|
-
}
|
|
260
|
-
function toInvokeConfig(invocable, id) {
|
|
261
|
-
if (typeof invocable === 'object') {
|
|
262
|
-
if ('src' in invocable) {
|
|
263
|
-
return invocable;
|
|
264
|
-
}
|
|
265
|
-
if ('transition' in invocable) {
|
|
266
|
-
return {
|
|
267
|
-
id,
|
|
268
|
-
src: invocable
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return {
|
|
273
|
-
id,
|
|
274
|
-
src: invocable
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
278
|
-
const noop = () => {};
|
|
279
|
-
const isObserver = typeof nextHandler === 'object';
|
|
280
|
-
const self = isObserver ? nextHandler : null;
|
|
281
|
-
return {
|
|
282
|
-
next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),
|
|
283
|
-
error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),
|
|
284
|
-
complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function createInvokeId(stateNodeId, index) {
|
|
288
|
-
return `${stateNodeId}:invocation[${index}]`;
|
|
289
|
-
}
|
|
290
|
-
function resolveReferencedActor(referenced) {
|
|
291
|
-
return referenced ? 'transition' in referenced ? {
|
|
292
|
-
src: referenced,
|
|
293
|
-
input: undefined
|
|
294
|
-
} : referenced : undefined;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function createDynamicAction(action, resolve) {
|
|
298
|
-
return {
|
|
299
|
-
type: action.type,
|
|
300
|
-
params: action.params,
|
|
301
|
-
resolve
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function isDynamicAction(action) {
|
|
305
|
-
return typeof action === 'object' && action !== null && 'resolve' in action;
|
|
306
129
|
}
|
|
307
130
|
|
|
308
131
|
/**
|
|
@@ -314,94 +137,20 @@ function isDynamicAction(action) {
|
|
|
314
137
|
* - `id` - The unique send event identifier (used with `cancel()`).
|
|
315
138
|
* - `delay` - The number of milliseconds to delay the sending of the event.
|
|
316
139
|
*/
|
|
317
|
-
function sendTo(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
to: actor,
|
|
322
|
-
delay: options ? options.delay : undefined,
|
|
323
|
-
event: eventOrExpr,
|
|
324
|
-
id: options && options.id !== undefined ? options.id : isFunction(eventOrExpr) ? eventOrExpr.name : eventOrExpr.type
|
|
325
|
-
}
|
|
326
|
-
}, (event, {
|
|
327
|
-
actorContext,
|
|
328
|
-
state
|
|
329
|
-
}) => {
|
|
330
|
-
const params = {
|
|
331
|
-
to: actor,
|
|
332
|
-
delay: options ? options.delay : undefined,
|
|
333
|
-
event: eventOrExpr,
|
|
334
|
-
// TODO: don't auto-generate IDs here like that
|
|
335
|
-
// there is too big chance of the ID collision
|
|
336
|
-
id: options && options.id !== undefined ? options.id : isFunction(eventOrExpr) ? eventOrExpr.name : eventOrExpr.type
|
|
337
|
-
};
|
|
338
|
-
const args = {
|
|
339
|
-
context: state.context,
|
|
340
|
-
event,
|
|
341
|
-
self: actorContext?.self ?? null,
|
|
342
|
-
system: actorContext?.system
|
|
343
|
-
};
|
|
344
|
-
const delaysMap = state.machine.implementations.delays;
|
|
345
|
-
|
|
346
|
-
// TODO: helper function for resolving Expr
|
|
347
|
-
if (typeof eventOrExpr === 'string') {
|
|
348
|
-
throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${eventOrExpr}" }) instead`);
|
|
349
|
-
}
|
|
350
|
-
const resolvedEvent = isFunction(eventOrExpr) ? eventOrExpr(args) : eventOrExpr;
|
|
351
|
-
let resolvedDelay;
|
|
352
|
-
if (isString(params.delay)) {
|
|
353
|
-
const configDelay = delaysMap && delaysMap[params.delay];
|
|
354
|
-
resolvedDelay = isFunction(configDelay) ? configDelay(args) : configDelay;
|
|
355
|
-
} else {
|
|
356
|
-
resolvedDelay = isFunction(params.delay) ? params.delay(args) : params.delay;
|
|
357
|
-
}
|
|
358
|
-
const resolvedTarget = isFunction(params.to) ? params.to(args) : params.to;
|
|
359
|
-
let targetActorRef;
|
|
360
|
-
if (typeof resolvedTarget === 'string') {
|
|
361
|
-
if (resolvedTarget === SpecialTargets.Parent) {
|
|
362
|
-
targetActorRef = actorContext?.self._parent;
|
|
363
|
-
} else if (resolvedTarget === SpecialTargets.Internal) {
|
|
364
|
-
targetActorRef = actorContext?.self;
|
|
365
|
-
} else if (resolvedTarget.startsWith('#_')) {
|
|
366
|
-
// SCXML compatibility: https://www.w3.org/TR/scxml/#SCXMLEventProcessor
|
|
367
|
-
// #_invokeid. If the target is the special term '#_invokeid', where invokeid is the invokeid of an SCXML session that the sending session has created by <invoke>, the Processor must add the event to the external queue of that session.
|
|
368
|
-
targetActorRef = state.children[resolvedTarget.slice(2)];
|
|
369
|
-
} else {
|
|
370
|
-
targetActorRef = state.children[resolvedTarget];
|
|
371
|
-
}
|
|
372
|
-
if (!targetActorRef) {
|
|
373
|
-
throw new Error(`Unable to send event to actor '${resolvedTarget}' from machine '${state.machine.id}'.`);
|
|
374
|
-
}
|
|
375
|
-
} else {
|
|
376
|
-
targetActorRef = resolvedTarget || actorContext?.self;
|
|
140
|
+
function sendTo(to, eventOrExpr, options) {
|
|
141
|
+
function sendTo(_) {
|
|
142
|
+
{
|
|
143
|
+
throw new Error(`This isn't supposed to be called`);
|
|
377
144
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const sendAction = resolvedAction;
|
|
388
|
-
if (typeof sendAction.params.delay === 'number') {
|
|
389
|
-
actorCtx.self.delaySend(sendAction);
|
|
390
|
-
return;
|
|
391
|
-
} else {
|
|
392
|
-
const target = sendAction.params.to;
|
|
393
|
-
const sentEvent = sendAction.params.event;
|
|
394
|
-
actorCtx.defer(() => {
|
|
395
|
-
target.send(sentEvent.type === error$1 ? {
|
|
396
|
-
type: `${error(actorCtx.self.id)}`,
|
|
397
|
-
data: sentEvent.data
|
|
398
|
-
} : sendAction.params.event);
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
return [state, resolvedAction];
|
|
404
|
-
});
|
|
145
|
+
}
|
|
146
|
+
sendTo.type = 'xstate.sendTo';
|
|
147
|
+
sendTo.to = to;
|
|
148
|
+
sendTo.event = eventOrExpr;
|
|
149
|
+
sendTo.id = options?.id;
|
|
150
|
+
sendTo.delay = options?.delay;
|
|
151
|
+
sendTo.resolve = resolve$8;
|
|
152
|
+
sendTo.execute = execute$5;
|
|
153
|
+
return sendTo;
|
|
405
154
|
}
|
|
406
155
|
|
|
407
156
|
/**
|
|
@@ -446,7 +195,7 @@ function escalate(errorData, options) {
|
|
|
446
195
|
return sendParent(arg => {
|
|
447
196
|
return {
|
|
448
197
|
type: error$1,
|
|
449
|
-
data:
|
|
198
|
+
data: typeof errorData === 'function' ? errorData(arg) : errorData
|
|
450
199
|
};
|
|
451
200
|
}, options);
|
|
452
201
|
}
|
|
@@ -465,6 +214,16 @@ function memo(object, key, fn) {
|
|
|
465
214
|
return memoizedData[key];
|
|
466
215
|
}
|
|
467
216
|
|
|
217
|
+
function resolve$7(_, state, actionArgs, {
|
|
218
|
+
sendId
|
|
219
|
+
}) {
|
|
220
|
+
const resolvedSendId = typeof sendId === 'function' ? sendId(actionArgs) : sendId;
|
|
221
|
+
return [state, resolvedSendId];
|
|
222
|
+
}
|
|
223
|
+
function execute$4(actorContext, resolvedSendId) {
|
|
224
|
+
actorContext.self.cancel(resolvedSendId);
|
|
225
|
+
}
|
|
226
|
+
|
|
468
227
|
/**
|
|
469
228
|
* Cancels an in-flight `send(...)` action. A canceled sent action will not
|
|
470
229
|
* be executed, nor will its event be sent, unless it has already been sent
|
|
@@ -472,34 +231,17 @@ function memo(object, key, fn) {
|
|
|
472
231
|
*
|
|
473
232
|
* @param sendId The `id` of the `send(...)` action to cancel.
|
|
474
233
|
*/
|
|
475
|
-
|
|
476
234
|
function cancel(sendId) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
sendId
|
|
235
|
+
function cancel(_) {
|
|
236
|
+
{
|
|
237
|
+
throw new Error(`This isn't supposed to be called`);
|
|
481
238
|
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
event,
|
|
489
|
-
self: actorContext?.self ?? {},
|
|
490
|
-
system: actorContext?.system
|
|
491
|
-
}) : sendId;
|
|
492
|
-
return [state, {
|
|
493
|
-
type: 'xstate.cancel',
|
|
494
|
-
params: {
|
|
495
|
-
sendId: resolvedSendId
|
|
496
|
-
},
|
|
497
|
-
execute: actorCtx => {
|
|
498
|
-
const interpreter = actorCtx.self;
|
|
499
|
-
interpreter.cancel(resolvedSendId);
|
|
500
|
-
}
|
|
501
|
-
}];
|
|
502
|
-
});
|
|
239
|
+
}
|
|
240
|
+
cancel.type = 'xstate.cancel';
|
|
241
|
+
cancel.sendId = sendId;
|
|
242
|
+
cancel.resolve = resolve$7;
|
|
243
|
+
cancel.execute = execute$4;
|
|
244
|
+
return cancel;
|
|
503
245
|
}
|
|
504
246
|
|
|
505
247
|
class Mailbox {
|
|
@@ -899,7 +641,186 @@ function fromEventObservable(lazyObservable) {
|
|
|
899
641
|
subscription: undefined
|
|
900
642
|
})
|
|
901
643
|
};
|
|
902
|
-
return logic;
|
|
644
|
+
return logic;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function matchesState(parentStateId, childStateId) {
|
|
648
|
+
const parentStateValue = toStateValue(parentStateId);
|
|
649
|
+
const childStateValue = toStateValue(childStateId);
|
|
650
|
+
if (typeof childStateValue === 'string') {
|
|
651
|
+
if (typeof parentStateValue === 'string') {
|
|
652
|
+
return childStateValue === parentStateValue;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// Parent more specific than child
|
|
656
|
+
return false;
|
|
657
|
+
}
|
|
658
|
+
if (typeof parentStateValue === 'string') {
|
|
659
|
+
return parentStateValue in childStateValue;
|
|
660
|
+
}
|
|
661
|
+
return Object.keys(parentStateValue).every(key => {
|
|
662
|
+
if (!(key in childStateValue)) {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
return matchesState(parentStateValue[key], childStateValue[key]);
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function toStatePath(stateId) {
|
|
669
|
+
try {
|
|
670
|
+
if (isArray(stateId)) {
|
|
671
|
+
return stateId;
|
|
672
|
+
}
|
|
673
|
+
return stateId.toString().split(STATE_DELIMITER);
|
|
674
|
+
} catch (e) {
|
|
675
|
+
throw new Error(`'${stateId}' is not a valid state path.`);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
function isStateLike(state) {
|
|
679
|
+
return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state;
|
|
680
|
+
}
|
|
681
|
+
function toStateValue(stateValue) {
|
|
682
|
+
if (isStateLike(stateValue)) {
|
|
683
|
+
return stateValue.value;
|
|
684
|
+
}
|
|
685
|
+
if (isArray(stateValue)) {
|
|
686
|
+
return pathToStateValue(stateValue);
|
|
687
|
+
}
|
|
688
|
+
if (typeof stateValue !== 'string') {
|
|
689
|
+
return stateValue;
|
|
690
|
+
}
|
|
691
|
+
const statePath = toStatePath(stateValue);
|
|
692
|
+
return pathToStateValue(statePath);
|
|
693
|
+
}
|
|
694
|
+
function pathToStateValue(statePath) {
|
|
695
|
+
if (statePath.length === 1) {
|
|
696
|
+
return statePath[0];
|
|
697
|
+
}
|
|
698
|
+
const value = {};
|
|
699
|
+
let marker = value;
|
|
700
|
+
for (let i = 0; i < statePath.length - 1; i++) {
|
|
701
|
+
if (i === statePath.length - 2) {
|
|
702
|
+
marker[statePath[i]] = statePath[i + 1];
|
|
703
|
+
} else {
|
|
704
|
+
const previous = marker;
|
|
705
|
+
marker = {};
|
|
706
|
+
previous[statePath[i]] = marker;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return value;
|
|
710
|
+
}
|
|
711
|
+
function mapValues(collection, iteratee) {
|
|
712
|
+
const result = {};
|
|
713
|
+
const collectionKeys = Object.keys(collection);
|
|
714
|
+
for (let i = 0; i < collectionKeys.length; i++) {
|
|
715
|
+
const key = collectionKeys[i];
|
|
716
|
+
result[key] = iteratee(collection[key], key, collection, i);
|
|
717
|
+
}
|
|
718
|
+
return result;
|
|
719
|
+
}
|
|
720
|
+
function flatten(array) {
|
|
721
|
+
return [].concat(...array);
|
|
722
|
+
}
|
|
723
|
+
function toArrayStrict(value) {
|
|
724
|
+
if (isArray(value)) {
|
|
725
|
+
return value;
|
|
726
|
+
}
|
|
727
|
+
return [value];
|
|
728
|
+
}
|
|
729
|
+
function toArray(value) {
|
|
730
|
+
if (value === undefined) {
|
|
731
|
+
return [];
|
|
732
|
+
}
|
|
733
|
+
return toArrayStrict(value);
|
|
734
|
+
}
|
|
735
|
+
function mapContext(mapper, context, event) {
|
|
736
|
+
if (typeof mapper === 'function') {
|
|
737
|
+
return mapper({
|
|
738
|
+
context,
|
|
739
|
+
event
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
const result = {};
|
|
743
|
+
const args = {
|
|
744
|
+
context,
|
|
745
|
+
event
|
|
746
|
+
};
|
|
747
|
+
for (const key of Object.keys(mapper)) {
|
|
748
|
+
const subMapper = mapper[key];
|
|
749
|
+
if (typeof subMapper === 'function') {
|
|
750
|
+
result[key] = subMapper(args);
|
|
751
|
+
} else {
|
|
752
|
+
result[key] = subMapper;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return result;
|
|
756
|
+
}
|
|
757
|
+
function isPromiseLike(value) {
|
|
758
|
+
if (value instanceof Promise) {
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
// Check if shape matches the Promise/A+ specification for a "thenable".
|
|
762
|
+
if (value !== null && (typeof value === 'function' || typeof value === 'object') && typeof value.then === 'function') {
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
function isArray(value) {
|
|
768
|
+
return Array.isArray(value);
|
|
769
|
+
}
|
|
770
|
+
function isErrorEvent(event) {
|
|
771
|
+
return typeof event.type === 'string' && (event.type === errorExecution || event.type.startsWith(errorPlatform));
|
|
772
|
+
}
|
|
773
|
+
function toTransitionConfigArray(configLike) {
|
|
774
|
+
return toArrayStrict(configLike).map(transitionLike => {
|
|
775
|
+
if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string') {
|
|
776
|
+
return {
|
|
777
|
+
target: transitionLike
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
return transitionLike;
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
function normalizeTarget(target) {
|
|
784
|
+
if (target === undefined || target === TARGETLESS_KEY) {
|
|
785
|
+
return undefined;
|
|
786
|
+
}
|
|
787
|
+
return toArray(target);
|
|
788
|
+
}
|
|
789
|
+
function toInvokeConfig(invocable, id) {
|
|
790
|
+
if (typeof invocable === 'object') {
|
|
791
|
+
if ('src' in invocable) {
|
|
792
|
+
return invocable;
|
|
793
|
+
}
|
|
794
|
+
if ('transition' in invocable) {
|
|
795
|
+
return {
|
|
796
|
+
id,
|
|
797
|
+
src: invocable
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return {
|
|
802
|
+
id,
|
|
803
|
+
src: invocable
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
807
|
+
const noop = () => {};
|
|
808
|
+
const isObserver = typeof nextHandler === 'object';
|
|
809
|
+
const self = isObserver ? nextHandler : null;
|
|
810
|
+
return {
|
|
811
|
+
next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),
|
|
812
|
+
error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),
|
|
813
|
+
complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
function createInvokeId(stateNodeId, index) {
|
|
817
|
+
return `${stateNodeId}:invocation[${index}]`;
|
|
818
|
+
}
|
|
819
|
+
function resolveReferencedActor(referenced) {
|
|
820
|
+
return referenced ? 'transition' in referenced ? {
|
|
821
|
+
src: referenced,
|
|
822
|
+
input: undefined
|
|
823
|
+
} : referenced : undefined;
|
|
903
824
|
}
|
|
904
825
|
|
|
905
826
|
function fromCallback(invokeCallback) {
|
|
@@ -944,7 +865,7 @@ function fromCallback(invokeCallback) {
|
|
|
944
865
|
}
|
|
945
866
|
if (event.type === stopSignalType) {
|
|
946
867
|
state.canceled = true;
|
|
947
|
-
if (
|
|
868
|
+
if (typeof state.dispose === 'function') {
|
|
948
869
|
state.dispose();
|
|
949
870
|
}
|
|
950
871
|
return state;
|
|
@@ -1350,14 +1271,24 @@ class Interpreter {
|
|
|
1350
1271
|
}
|
|
1351
1272
|
|
|
1352
1273
|
// TODO: make private (and figure out a way to do this within the machine)
|
|
1353
|
-
delaySend(
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1274
|
+
delaySend({
|
|
1275
|
+
event,
|
|
1276
|
+
id,
|
|
1277
|
+
delay,
|
|
1278
|
+
to
|
|
1279
|
+
}) {
|
|
1280
|
+
const timerId = this.clock.setTimeout(() => {
|
|
1281
|
+
if (to) {
|
|
1282
|
+
to.send(event);
|
|
1357
1283
|
} else {
|
|
1358
|
-
this.send(
|
|
1284
|
+
this.send(event);
|
|
1359
1285
|
}
|
|
1360
|
-
},
|
|
1286
|
+
}, delay);
|
|
1287
|
+
|
|
1288
|
+
// TODO: consider the rehydration story here
|
|
1289
|
+
if (id) {
|
|
1290
|
+
this.delayedEventsMap[id] = timerId;
|
|
1291
|
+
}
|
|
1361
1292
|
}
|
|
1362
1293
|
|
|
1363
1294
|
// TODO: make private (and figure out a way to do this within the machine)
|
|
@@ -1402,81 +1333,81 @@ function interpret(logic, options) {
|
|
|
1402
1333
|
return interpreter;
|
|
1403
1334
|
}
|
|
1404
1335
|
|
|
1405
|
-
function
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1336
|
+
function resolve$6(actorContext, state, actionArgs, {
|
|
1337
|
+
id,
|
|
1338
|
+
systemId,
|
|
1339
|
+
src,
|
|
1340
|
+
input
|
|
1341
|
+
}) {
|
|
1342
|
+
const referenced = resolveReferencedActor(state.machine.implementations.actors[src]);
|
|
1343
|
+
let actorRef;
|
|
1344
|
+
if (referenced) {
|
|
1345
|
+
// TODO: inline `input: undefined` should win over the referenced one
|
|
1346
|
+
const configuredInput = input || referenced.input;
|
|
1347
|
+
actorRef = interpret(referenced.src, {
|
|
1415
1348
|
id,
|
|
1416
|
-
src
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
};
|
|
1425
|
-
} else {
|
|
1426
|
-
const input = 'input' in invokeDef ? invokeDef.input : referenced.input;
|
|
1427
|
-
const ref = interpret(referenced.src, {
|
|
1428
|
-
id,
|
|
1429
|
-
src,
|
|
1430
|
-
parent: actorContext?.self,
|
|
1431
|
-
systemId: invokeDef.systemId,
|
|
1432
|
-
input: typeof input === 'function' ? input({
|
|
1433
|
-
context: state.context,
|
|
1434
|
-
event,
|
|
1435
|
-
self: actorContext?.self
|
|
1436
|
-
}) : input
|
|
1437
|
-
});
|
|
1438
|
-
resolvedInvokeAction = {
|
|
1439
|
-
type,
|
|
1440
|
-
params: {
|
|
1441
|
-
...invokeDef,
|
|
1442
|
-
ref
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
const actorRef = resolvedInvokeAction.params.ref;
|
|
1447
|
-
const invokedState = cloneState(state, {
|
|
1448
|
-
children: {
|
|
1449
|
-
...state.children,
|
|
1450
|
-
[id]: actorRef
|
|
1451
|
-
}
|
|
1349
|
+
src,
|
|
1350
|
+
parent: actorContext?.self,
|
|
1351
|
+
systemId,
|
|
1352
|
+
input: typeof configuredInput === 'function' ? configuredInput({
|
|
1353
|
+
context: state.context,
|
|
1354
|
+
event: actionArgs.event,
|
|
1355
|
+
self: actorContext?.self
|
|
1356
|
+
}) : configuredInput
|
|
1452
1357
|
});
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1358
|
+
}
|
|
1359
|
+
if (!actorRef) {
|
|
1360
|
+
console.warn(`Actor type '${src}' not found in machine '${actorContext.id}'.`);
|
|
1361
|
+
}
|
|
1362
|
+
return [cloneState(state, {
|
|
1363
|
+
children: {
|
|
1364
|
+
...state.children,
|
|
1365
|
+
[id]: actorRef
|
|
1366
|
+
}
|
|
1367
|
+
}), {
|
|
1368
|
+
id,
|
|
1369
|
+
actorRef
|
|
1370
|
+
}];
|
|
1371
|
+
}
|
|
1372
|
+
function execute$3(actorContext, {
|
|
1373
|
+
id,
|
|
1374
|
+
actorRef
|
|
1375
|
+
}) {
|
|
1376
|
+
if (!actorRef) {
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
actorContext.defer(() => {
|
|
1380
|
+
if (actorRef.status === ActorStatus.Stopped) {
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
try {
|
|
1384
|
+
actorRef.start?.();
|
|
1385
|
+
} catch (err) {
|
|
1386
|
+
actorContext.self.send(error(id, err));
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1478
1389
|
});
|
|
1479
1390
|
}
|
|
1391
|
+
function invoke({
|
|
1392
|
+
id,
|
|
1393
|
+
systemId,
|
|
1394
|
+
src,
|
|
1395
|
+
input
|
|
1396
|
+
}) {
|
|
1397
|
+
function invoke(_) {
|
|
1398
|
+
{
|
|
1399
|
+
throw new Error(`This isn't supposed to be called`);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
invoke.type = 'xstate.invoke';
|
|
1403
|
+
invoke.id = id;
|
|
1404
|
+
invoke.systemId = systemId;
|
|
1405
|
+
invoke.src = src;
|
|
1406
|
+
invoke.input = input;
|
|
1407
|
+
invoke.resolve = resolve$6;
|
|
1408
|
+
invoke.execute = execute$3;
|
|
1409
|
+
return invoke;
|
|
1410
|
+
}
|
|
1480
1411
|
|
|
1481
1412
|
function stateIn(stateValue) {
|
|
1482
1413
|
return {
|
|
@@ -1487,7 +1418,7 @@ function stateIn(stateValue) {
|
|
|
1487
1418
|
predicate: ({
|
|
1488
1419
|
state
|
|
1489
1420
|
}) => {
|
|
1490
|
-
if (
|
|
1421
|
+
if (typeof stateValue === 'string' && isStateId(stateValue)) {
|
|
1491
1422
|
return state.configuration.some(sn => sn.id === stateValue.slice(1));
|
|
1492
1423
|
}
|
|
1493
1424
|
return state.matches(stateValue);
|
|
@@ -1571,9 +1502,9 @@ function evaluateGuard(guard, context, event, state) {
|
|
|
1571
1502
|
function toGuardDefinition(guardConfig, getPredicate) {
|
|
1572
1503
|
// TODO: check for cycles and consider a refactor to more lazily evaluated guards
|
|
1573
1504
|
// TODO: resolve this more recursively: https://github.com/statelyai/xstate/pull/4064#discussion_r1229915724
|
|
1574
|
-
if (
|
|
1505
|
+
if (typeof guardConfig === 'string') {
|
|
1575
1506
|
const predicateOrDef = getPredicate?.(guardConfig);
|
|
1576
|
-
if (
|
|
1507
|
+
if (typeof predicateOrDef === 'function') {
|
|
1577
1508
|
return {
|
|
1578
1509
|
type: guardConfig,
|
|
1579
1510
|
predicate: predicateOrDef,
|
|
@@ -1592,7 +1523,7 @@ function toGuardDefinition(guardConfig, getPredicate) {
|
|
|
1592
1523
|
};
|
|
1593
1524
|
}
|
|
1594
1525
|
}
|
|
1595
|
-
if (
|
|
1526
|
+
if (typeof guardConfig === 'function') {
|
|
1596
1527
|
return {
|
|
1597
1528
|
type: guardConfig.name,
|
|
1598
1529
|
predicate: guardConfig,
|
|
@@ -1603,7 +1534,7 @@ function toGuardDefinition(guardConfig, getPredicate) {
|
|
|
1603
1534
|
};
|
|
1604
1535
|
}
|
|
1605
1536
|
const predicateOrDef = getPredicate?.(guardConfig.type);
|
|
1606
|
-
if (
|
|
1537
|
+
if (typeof predicateOrDef === 'function') {
|
|
1607
1538
|
return {
|
|
1608
1539
|
type: guardConfig.type,
|
|
1609
1540
|
params: guardConfig.params || guardConfig,
|
|
@@ -1730,27 +1661,19 @@ function isInFinalState(configuration, stateNode = configuration[0].machine.root
|
|
|
1730
1661
|
}
|
|
1731
1662
|
const isStateId = str => str[0] === STATE_IDENTIFIER;
|
|
1732
1663
|
function getCandidates(stateNode, receivedEventType) {
|
|
1733
|
-
const candidates = stateNode.transitions.filter(
|
|
1734
|
-
|
|
1735
|
-
eventType
|
|
1736
|
-
} = transition;
|
|
1737
|
-
// First, check the trivial case: event names are exactly equal
|
|
1738
|
-
if (eventType === receivedEventType) {
|
|
1739
|
-
return true;
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
// Then, check if transition is a wildcard transition,
|
|
1664
|
+
const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(descriptor => {
|
|
1665
|
+
// check if transition is a wildcard transition,
|
|
1743
1666
|
// which matches any non-transient events
|
|
1744
|
-
if (
|
|
1667
|
+
if (descriptor === WILDCARD) {
|
|
1745
1668
|
return true;
|
|
1746
1669
|
}
|
|
1747
|
-
if (!
|
|
1670
|
+
if (!descriptor.endsWith('.*')) {
|
|
1748
1671
|
return false;
|
|
1749
1672
|
}
|
|
1750
|
-
if (/.*\*.+/.test(
|
|
1751
|
-
console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${
|
|
1673
|
+
if (/.*\*.+/.test(descriptor)) {
|
|
1674
|
+
console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${descriptor}" event.`);
|
|
1752
1675
|
}
|
|
1753
|
-
const partialEventTokens =
|
|
1676
|
+
const partialEventTokens = descriptor.split('.');
|
|
1754
1677
|
const eventTokens = receivedEventType.split('.');
|
|
1755
1678
|
for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
|
|
1756
1679
|
const partialEventToken = partialEventTokens[tokenIndex];
|
|
@@ -1758,7 +1681,7 @@ function getCandidates(stateNode, receivedEventType) {
|
|
|
1758
1681
|
if (partialEventToken === '*') {
|
|
1759
1682
|
const isLastToken = tokenIndex === partialEventTokens.length - 1;
|
|
1760
1683
|
if (!isLastToken) {
|
|
1761
|
-
console.warn(`Infix wildcards in transition events are not allowed. Check the "${
|
|
1684
|
+
console.warn(`Infix wildcards in transition events are not allowed. Check the "${descriptor}" transition.`);
|
|
1762
1685
|
}
|
|
1763
1686
|
return isLastToken;
|
|
1764
1687
|
}
|
|
@@ -1767,7 +1690,7 @@ function getCandidates(stateNode, receivedEventType) {
|
|
|
1767
1690
|
}
|
|
1768
1691
|
}
|
|
1769
1692
|
return true;
|
|
1770
|
-
});
|
|
1693
|
+
}).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
|
|
1771
1694
|
return candidates;
|
|
1772
1695
|
}
|
|
1773
1696
|
|
|
@@ -1780,11 +1703,12 @@ function getDelayedTransitions(stateNode) {
|
|
|
1780
1703
|
return [];
|
|
1781
1704
|
}
|
|
1782
1705
|
const mutateEntryExit = (delay, i) => {
|
|
1783
|
-
const delayRef =
|
|
1706
|
+
const delayRef = typeof delay === 'function' ? `${stateNode.id}:delay[${i}]` : delay;
|
|
1784
1707
|
const eventType = after(delayRef, stateNode.id);
|
|
1785
1708
|
stateNode.entry.push(raise({
|
|
1786
1709
|
type: eventType
|
|
1787
1710
|
}, {
|
|
1711
|
+
id: eventType,
|
|
1788
1712
|
delay
|
|
1789
1713
|
}));
|
|
1790
1714
|
stateNode.exit.push(cancel(eventType));
|
|
@@ -1798,7 +1722,7 @@ function getDelayedTransitions(stateNode) {
|
|
|
1798
1722
|
};
|
|
1799
1723
|
}) : Object.keys(afterConfig).flatMap((delay, i) => {
|
|
1800
1724
|
const configTransition = afterConfig[delay];
|
|
1801
|
-
const resolvedTransition =
|
|
1725
|
+
const resolvedTransition = typeof configTransition === 'string' ? {
|
|
1802
1726
|
target: configTransition
|
|
1803
1727
|
} : configTransition;
|
|
1804
1728
|
const resolvedDelay = !isNaN(+delay) ? +delay : delay;
|
|
@@ -1814,12 +1738,12 @@ function getDelayedTransitions(stateNode) {
|
|
|
1814
1738
|
delay
|
|
1815
1739
|
} = delayedTransition;
|
|
1816
1740
|
return {
|
|
1817
|
-
...formatTransition(stateNode, delayedTransition),
|
|
1741
|
+
...formatTransition(stateNode, delayedTransition.event, delayedTransition),
|
|
1818
1742
|
delay
|
|
1819
1743
|
};
|
|
1820
1744
|
});
|
|
1821
1745
|
}
|
|
1822
|
-
function formatTransition(stateNode, transitionConfig) {
|
|
1746
|
+
function formatTransition(stateNode, descriptor, transitionConfig) {
|
|
1823
1747
|
const normalizedTarget = normalizeTarget(transitionConfig.target);
|
|
1824
1748
|
const reenter = transitionConfig.reenter ?? false;
|
|
1825
1749
|
const {
|
|
@@ -1833,12 +1757,12 @@ function formatTransition(stateNode, transitionConfig) {
|
|
|
1833
1757
|
}
|
|
1834
1758
|
const transition = {
|
|
1835
1759
|
...transitionConfig,
|
|
1836
|
-
actions:
|
|
1760
|
+
actions: toArray(transitionConfig.actions),
|
|
1837
1761
|
guard: transitionConfig.guard ? toGuardDefinition(transitionConfig.guard, guardType => guards[guardType]) : undefined,
|
|
1838
1762
|
target,
|
|
1839
1763
|
source: stateNode,
|
|
1840
1764
|
reenter,
|
|
1841
|
-
eventType:
|
|
1765
|
+
eventType: descriptor,
|
|
1842
1766
|
toJSON: () => ({
|
|
1843
1767
|
...transition,
|
|
1844
1768
|
source: `#${stateNode.id}`,
|
|
@@ -1848,52 +1772,50 @@ function formatTransition(stateNode, transitionConfig) {
|
|
|
1848
1772
|
return transition;
|
|
1849
1773
|
}
|
|
1850
1774
|
function formatTransitions(stateNode) {
|
|
1851
|
-
const
|
|
1852
|
-
if (
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
const {
|
|
1856
|
-
[WILDCARD]: wildcardConfigs = [],
|
|
1857
|
-
...namedTransitionConfigs
|
|
1858
|
-
} = stateNode.config.on;
|
|
1859
|
-
for (const eventType of Object.keys(namedTransitionConfigs)) {
|
|
1860
|
-
if (eventType === NULL_EVENT) {
|
|
1775
|
+
const transitions = new Map();
|
|
1776
|
+
if (stateNode.config.on) {
|
|
1777
|
+
for (const descriptor of Object.keys(stateNode.config.on)) {
|
|
1778
|
+
if (descriptor === NULL_EVENT) {
|
|
1861
1779
|
throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
|
|
1862
1780
|
}
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
// TODO: add dev-mode validation for unreachable transitions
|
|
1781
|
+
const transitionsConfig = stateNode.config.on[descriptor];
|
|
1782
|
+
transitions.set(descriptor, toTransitionConfigArray(transitionsConfig).map(t => formatTransition(stateNode, descriptor, t)));
|
|
1866
1783
|
}
|
|
1867
|
-
|
|
1868
|
-
transitionConfigs.push(...toTransitionConfigArray(WILDCARD, wildcardConfigs));
|
|
1869
1784
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1785
|
+
if (stateNode.config.onDone) {
|
|
1786
|
+
const descriptor = String(done(stateNode.id));
|
|
1787
|
+
transitions.set(descriptor, toTransitionConfigArray(stateNode.config.onDone).map(t => formatTransition(stateNode, descriptor, t)));
|
|
1788
|
+
}
|
|
1789
|
+
for (const invokeDef of stateNode.invoke) {
|
|
1873
1790
|
if (invokeDef.onDone) {
|
|
1874
|
-
|
|
1791
|
+
const descriptor = `done.invoke.${invokeDef.id}`;
|
|
1792
|
+
transitions.set(descriptor, toTransitionConfigArray(invokeDef.onDone).map(t => formatTransition(stateNode, descriptor, t)));
|
|
1875
1793
|
}
|
|
1876
1794
|
if (invokeDef.onError) {
|
|
1877
|
-
|
|
1795
|
+
const descriptor = `error.platform.${invokeDef.id}`;
|
|
1796
|
+
transitions.set(descriptor, toTransitionConfigArray(invokeDef.onError).map(t => formatTransition(stateNode, descriptor, t)));
|
|
1878
1797
|
}
|
|
1879
1798
|
if (invokeDef.onSnapshot) {
|
|
1880
|
-
|
|
1799
|
+
const descriptor = `xstate.snapshot.${invokeDef.id}`;
|
|
1800
|
+
transitions.set(descriptor, toTransitionConfigArray(invokeDef.onSnapshot).map(t => formatTransition(stateNode, descriptor, t)));
|
|
1881
1801
|
}
|
|
1882
|
-
return settleTransitions;
|
|
1883
|
-
});
|
|
1884
|
-
const delayedTransitions = stateNode.after;
|
|
1885
|
-
const formattedTransitions = [...doneConfig, ...invokeConfig, ...transitionConfigs].flatMap(transitionConfig => toArray(transitionConfig).map(transition => formatTransition(stateNode, transition)));
|
|
1886
|
-
for (const delayedTransition of delayedTransitions) {
|
|
1887
|
-
formattedTransitions.push(delayedTransition);
|
|
1888
1802
|
}
|
|
1889
|
-
|
|
1803
|
+
for (const delayedTransition of stateNode.after) {
|
|
1804
|
+
let existing = transitions.get(delayedTransition.eventType);
|
|
1805
|
+
if (!existing) {
|
|
1806
|
+
existing = [];
|
|
1807
|
+
transitions.set(delayedTransition.eventType, existing);
|
|
1808
|
+
}
|
|
1809
|
+
existing.push(delayedTransition);
|
|
1810
|
+
}
|
|
1811
|
+
return transitions;
|
|
1890
1812
|
}
|
|
1891
1813
|
function formatInitialTransition(stateNode, _target) {
|
|
1892
|
-
if (
|
|
1814
|
+
if (typeof _target === 'string' || isArray(_target)) {
|
|
1893
1815
|
const targets = toArray(_target).map(t => {
|
|
1894
1816
|
// Resolve state string keys (which represent children)
|
|
1895
1817
|
// to their state node
|
|
1896
|
-
const descStateNode =
|
|
1818
|
+
const descStateNode = typeof t === 'string' ? isStateId(t) ? stateNode.machine.getStateNodeById(t) : stateNode.states[t] : t;
|
|
1897
1819
|
if (!descStateNode) {
|
|
1898
1820
|
throw new Error(`Initial state node "${t}" not found on parent state node #${stateNode.id}`);
|
|
1899
1821
|
}
|
|
@@ -1917,15 +1839,14 @@ function formatInitialTransition(stateNode, _target) {
|
|
|
1917
1839
|
};
|
|
1918
1840
|
return transition;
|
|
1919
1841
|
}
|
|
1920
|
-
return formatTransition(stateNode, {
|
|
1842
|
+
return formatTransition(stateNode, '__INITIAL__', {
|
|
1921
1843
|
target: toArray(_target.target).map(t => {
|
|
1922
|
-
if (
|
|
1844
|
+
if (typeof t === 'string') {
|
|
1923
1845
|
return isStateId(t) ? t : `${STATE_DELIMITER}${t}`;
|
|
1924
1846
|
}
|
|
1925
1847
|
return t;
|
|
1926
1848
|
}),
|
|
1927
|
-
actions: _target.actions
|
|
1928
|
-
event: null
|
|
1849
|
+
actions: _target.actions
|
|
1929
1850
|
});
|
|
1930
1851
|
}
|
|
1931
1852
|
function resolveTarget(stateNode, targets) {
|
|
@@ -1934,7 +1855,7 @@ function resolveTarget(stateNode, targets) {
|
|
|
1934
1855
|
return undefined;
|
|
1935
1856
|
}
|
|
1936
1857
|
return targets.map(target => {
|
|
1937
|
-
if (
|
|
1858
|
+
if (typeof target !== 'string') {
|
|
1938
1859
|
return target;
|
|
1939
1860
|
}
|
|
1940
1861
|
if (isStateId(target)) {
|
|
@@ -2042,7 +1963,7 @@ function getStateNodeByPath(stateNode, statePath) {
|
|
|
2042
1963
|
*/
|
|
2043
1964
|
function getStateNodes(stateNode, state) {
|
|
2044
1965
|
const stateValue = state instanceof State ? state.value : toStateValue(state);
|
|
2045
|
-
if (
|
|
1966
|
+
if (typeof stateValue === 'string') {
|
|
2046
1967
|
return [stateNode, stateNode.states[stateValue]];
|
|
2047
1968
|
}
|
|
2048
1969
|
const childStateKeys = Object.keys(stateValue);
|
|
@@ -2093,7 +2014,7 @@ function transitionParallelNode(stateNode, stateValue, state, event) {
|
|
|
2093
2014
|
}
|
|
2094
2015
|
function transitionNode(stateNode, stateValue, state, event) {
|
|
2095
2016
|
// leaf node
|
|
2096
|
-
if (
|
|
2017
|
+
if (typeof stateValue === 'string') {
|
|
2097
2018
|
return transitionAtomicNode(stateNode, stateValue, state, event);
|
|
2098
2019
|
}
|
|
2099
2020
|
|
|
@@ -2427,44 +2348,55 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
|
|
|
2427
2348
|
const {
|
|
2428
2349
|
machine
|
|
2429
2350
|
} = currentState;
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2351
|
+
// TODO: this `cloneState` is really just a hack to prevent infinite loops
|
|
2352
|
+
// we need to take another look at how internal queue is managed
|
|
2353
|
+
let intermediateState = cloneState(currentState, {
|
|
2354
|
+
_internalQueue: []
|
|
2355
|
+
});
|
|
2356
|
+
for (const action of actions) {
|
|
2357
|
+
const resolved = typeof action === 'function' ? action : machine.implementations.actions[typeof action === 'string' ? action : action.type];
|
|
2358
|
+
if (!resolved) {
|
|
2359
|
+
continue;
|
|
2437
2360
|
}
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
})
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2361
|
+
const args = {
|
|
2362
|
+
context: intermediateState.context,
|
|
2363
|
+
event,
|
|
2364
|
+
self: actorCtx?.self,
|
|
2365
|
+
system: actorCtx?.system,
|
|
2366
|
+
// TODO: figure out story for `action` and inline actions
|
|
2367
|
+
// what those ones should receive?
|
|
2368
|
+
//
|
|
2369
|
+
// entry: ({ action }) => {}
|
|
2370
|
+
// exit: assign(({ action }) => {})
|
|
2371
|
+
action: typeof action === 'string' ? {
|
|
2372
|
+
type: action
|
|
2373
|
+
} : action
|
|
2374
|
+
};
|
|
2375
|
+
if (!('resolve' in resolved)) {
|
|
2376
|
+
if (actorCtx?.self.status === ActorStatus.Running) {
|
|
2377
|
+
resolved(args);
|
|
2378
|
+
} else {
|
|
2379
|
+
actorCtx?.defer(() => resolved(args));
|
|
2451
2380
|
}
|
|
2381
|
+
continue;
|
|
2382
|
+
}
|
|
2383
|
+
const builtinAction = resolved;
|
|
2384
|
+
const [nextState, params, actions] = builtinAction.resolve(actorCtx, intermediateState, args, resolved // this holds all params
|
|
2385
|
+
);
|
|
2452
2386
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2387
|
+
intermediateState = nextState;
|
|
2388
|
+
if ('execute' in resolved) {
|
|
2389
|
+
if (actorCtx?.self.status === ActorStatus.Running) {
|
|
2390
|
+
builtinAction.execute(actorCtx, params);
|
|
2391
|
+
} else {
|
|
2392
|
+
actorCtx?.defer(builtinAction.execute.bind(null, actorCtx, params));
|
|
2456
2393
|
}
|
|
2457
|
-
toActionObjects(matchedActions).forEach(resolveAction);
|
|
2458
|
-
return;
|
|
2459
2394
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
resolveAction(actionObject);
|
|
2395
|
+
if (actions) {
|
|
2396
|
+
intermediateState = resolveActionsAndContext(actions, event, intermediateState, actorCtx);
|
|
2397
|
+
}
|
|
2464
2398
|
}
|
|
2465
|
-
return
|
|
2466
|
-
_internalQueue: raiseActions.map(a => a.params.event)
|
|
2467
|
-
});
|
|
2399
|
+
return intermediateState;
|
|
2468
2400
|
}
|
|
2469
2401
|
function macrostep(state, event, actorCtx) {
|
|
2470
2402
|
if (event.type === WILDCARD) {
|
|
@@ -2486,7 +2418,7 @@ function macrostep(state, event, actorCtx) {
|
|
|
2486
2418
|
|
|
2487
2419
|
// Assume the state is at rest (no raised events)
|
|
2488
2420
|
// Determine the next state based on the next microstep
|
|
2489
|
-
if (nextEvent.type !==
|
|
2421
|
+
if (nextEvent.type !== INIT_TYPE) {
|
|
2490
2422
|
const transitions = selectTransitions(nextEvent, nextState);
|
|
2491
2423
|
nextState = microstep(transitions, state, actorCtx, nextEvent, false);
|
|
2492
2424
|
states.push(nextState);
|
|
@@ -2652,7 +2584,7 @@ class State {
|
|
|
2652
2584
|
* @param delimiter The character(s) that separate each subpath in the string state node path.
|
|
2653
2585
|
*/
|
|
2654
2586
|
toStrings(stateValue = this.value) {
|
|
2655
|
-
if (
|
|
2587
|
+
if (typeof stateValue === 'string') {
|
|
2656
2588
|
return [stateValue];
|
|
2657
2589
|
}
|
|
2658
2590
|
const valueKeys = Object.keys(stateValue);
|
|
@@ -2750,6 +2682,36 @@ function getPersistedState(state) {
|
|
|
2750
2682
|
};
|
|
2751
2683
|
}
|
|
2752
2684
|
|
|
2685
|
+
function resolve$5(_, state, args, {
|
|
2686
|
+
actorRef
|
|
2687
|
+
}) {
|
|
2688
|
+
const actorRefOrString = typeof actorRef === 'function' ? actorRef(args) : actorRef;
|
|
2689
|
+
const resolvedActorRef = typeof actorRefOrString === 'string' ? state.children[actorRefOrString] : actorRefOrString;
|
|
2690
|
+
let children = state.children;
|
|
2691
|
+
if (resolvedActorRef) {
|
|
2692
|
+
children = {
|
|
2693
|
+
...children
|
|
2694
|
+
};
|
|
2695
|
+
delete children[resolvedActorRef.id];
|
|
2696
|
+
}
|
|
2697
|
+
return [cloneState(state, {
|
|
2698
|
+
children
|
|
2699
|
+
}), resolvedActorRef];
|
|
2700
|
+
}
|
|
2701
|
+
function execute$2(actorContext, actorRef) {
|
|
2702
|
+
if (!actorRef) {
|
|
2703
|
+
return;
|
|
2704
|
+
}
|
|
2705
|
+
if (actorRef.status !== ActorStatus.Running) {
|
|
2706
|
+
actorContext.stopChild(actorRef);
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
// TODO: recheck why this one has to be deferred
|
|
2710
|
+
actorContext.defer(() => {
|
|
2711
|
+
actorContext.stopChild(actorRef);
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2753
2715
|
/**
|
|
2754
2716
|
* Stops an actor.
|
|
2755
2717
|
*
|
|
@@ -2757,61 +2719,40 @@ function getPersistedState(state) {
|
|
|
2757
2719
|
*/
|
|
2758
2720
|
|
|
2759
2721
|
function stop(actorRef) {
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
if (!actorRef) {
|
|
2793
|
-
return;
|
|
2794
|
-
}
|
|
2795
|
-
if (actorRef.status !== ActorStatus.Running) {
|
|
2796
|
-
actorCtx.stopChild(actorRef);
|
|
2797
|
-
return;
|
|
2798
|
-
}
|
|
2799
|
-
actorCtx.defer(() => {
|
|
2800
|
-
actorCtx.stopChild(actorRef);
|
|
2801
|
-
});
|
|
2802
|
-
}
|
|
2803
|
-
}];
|
|
2804
|
-
});
|
|
2722
|
+
function stop(_) {
|
|
2723
|
+
{
|
|
2724
|
+
throw new Error(`This isn't supposed to be called`);
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
stop.type = 'xstate.stop';
|
|
2728
|
+
stop.actorRef = actorRef;
|
|
2729
|
+
stop.resolve = resolve$5;
|
|
2730
|
+
stop.execute = execute$2;
|
|
2731
|
+
return stop;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
function resolve$4(_, state, actionArgs, {
|
|
2735
|
+
value,
|
|
2736
|
+
label
|
|
2737
|
+
}) {
|
|
2738
|
+
return [state, {
|
|
2739
|
+
value: typeof value === 'function' ? value(actionArgs) : value,
|
|
2740
|
+
label
|
|
2741
|
+
}];
|
|
2742
|
+
}
|
|
2743
|
+
function execute$1({
|
|
2744
|
+
logger
|
|
2745
|
+
}, {
|
|
2746
|
+
value,
|
|
2747
|
+
label
|
|
2748
|
+
}) {
|
|
2749
|
+
if (label) {
|
|
2750
|
+
logger(label, value);
|
|
2751
|
+
} else {
|
|
2752
|
+
logger(value);
|
|
2753
|
+
}
|
|
2805
2754
|
}
|
|
2806
2755
|
|
|
2807
|
-
const defaultLogExpr = ({
|
|
2808
|
-
context,
|
|
2809
|
-
event
|
|
2810
|
-
}) => ({
|
|
2811
|
-
context,
|
|
2812
|
-
event
|
|
2813
|
-
});
|
|
2814
|
-
|
|
2815
2756
|
/**
|
|
2816
2757
|
*
|
|
2817
2758
|
* @param expr The expression function to evaluate which will be logged.
|
|
@@ -2820,39 +2761,24 @@ const defaultLogExpr = ({
|
|
|
2820
2761
|
* - `event` - the event that caused this action to be executed.
|
|
2821
2762
|
* @param label The label to give to the logged expression.
|
|
2822
2763
|
*/
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2764
|
+
function log(value = ({
|
|
2765
|
+
context,
|
|
2766
|
+
event
|
|
2767
|
+
}) => ({
|
|
2768
|
+
context,
|
|
2769
|
+
event
|
|
2770
|
+
}), label) {
|
|
2771
|
+
function log(_) {
|
|
2772
|
+
{
|
|
2773
|
+
throw new Error(`This isn't supposed to be called`);
|
|
2830
2774
|
}
|
|
2831
|
-
}
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
self: actorContext?.self ?? {},
|
|
2839
|
-
system: actorContext?.system
|
|
2840
|
-
}) : expr;
|
|
2841
|
-
return [state, {
|
|
2842
|
-
type: 'xstate.log',
|
|
2843
|
-
params: {
|
|
2844
|
-
label,
|
|
2845
|
-
value: resolvedValue
|
|
2846
|
-
},
|
|
2847
|
-
execute: actorCtx => {
|
|
2848
|
-
if (label) {
|
|
2849
|
-
actorCtx.logger?.(label, resolvedValue);
|
|
2850
|
-
} else {
|
|
2851
|
-
actorCtx.logger?.(resolvedValue);
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
}];
|
|
2855
|
-
});
|
|
2775
|
+
}
|
|
2776
|
+
log.type = 'xstate.log';
|
|
2777
|
+
log.value = value;
|
|
2778
|
+
log.label = label;
|
|
2779
|
+
log.resolve = resolve$4;
|
|
2780
|
+
log.execute = execute$1;
|
|
2781
|
+
return log;
|
|
2856
2782
|
}
|
|
2857
2783
|
|
|
2858
2784
|
function createSpawner(actorContext, {
|
|
@@ -2911,57 +2837,87 @@ function createSpawner(actorContext, {
|
|
|
2911
2837
|
};
|
|
2912
2838
|
}
|
|
2913
2839
|
|
|
2840
|
+
function resolve$3(actorContext, state, actionArgs, {
|
|
2841
|
+
assignment
|
|
2842
|
+
}) {
|
|
2843
|
+
if (!state.context) {
|
|
2844
|
+
throw new Error('Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.');
|
|
2845
|
+
}
|
|
2846
|
+
const spawnedChildren = {};
|
|
2847
|
+
const assignArgs = {
|
|
2848
|
+
context: state.context,
|
|
2849
|
+
event: actionArgs.event,
|
|
2850
|
+
action: actionArgs.action,
|
|
2851
|
+
spawn: createSpawner(actorContext, state, actionArgs.event, spawnedChildren),
|
|
2852
|
+
self: actorContext?.self,
|
|
2853
|
+
system: actorContext?.system
|
|
2854
|
+
};
|
|
2855
|
+
let partialUpdate = {};
|
|
2856
|
+
if (typeof assignment === 'function') {
|
|
2857
|
+
partialUpdate = assignment(assignArgs);
|
|
2858
|
+
} else {
|
|
2859
|
+
for (const key of Object.keys(assignment)) {
|
|
2860
|
+
const propAssignment = assignment[key];
|
|
2861
|
+
partialUpdate[key] = typeof propAssignment === 'function' ? propAssignment(assignArgs) : propAssignment;
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
const updatedContext = Object.assign({}, state.context, partialUpdate);
|
|
2865
|
+
return [cloneState(state, {
|
|
2866
|
+
context: updatedContext,
|
|
2867
|
+
children: Object.keys(spawnedChildren).length ? {
|
|
2868
|
+
...state.children,
|
|
2869
|
+
...spawnedChildren
|
|
2870
|
+
} : state.children
|
|
2871
|
+
})];
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2914
2874
|
/**
|
|
2915
2875
|
* Updates the current context of the machine.
|
|
2916
2876
|
*
|
|
2917
2877
|
* @param assignment An object that represents the partial context to update.
|
|
2918
2878
|
*/
|
|
2919
2879
|
function assign(assignment) {
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
context: updatedContext
|
|
2962
|
-
}
|
|
2963
|
-
}];
|
|
2964
|
-
});
|
|
2880
|
+
function assign(_) {
|
|
2881
|
+
{
|
|
2882
|
+
throw new Error(`This isn't supposed to be called`);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
assign.type = 'xstate.assign';
|
|
2886
|
+
assign.assignment = assignment;
|
|
2887
|
+
assign.resolve = resolve$3;
|
|
2888
|
+
return assign;
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
function resolve$2(_, state, args, {
|
|
2892
|
+
event: eventOrExpr,
|
|
2893
|
+
id,
|
|
2894
|
+
delay
|
|
2895
|
+
}) {
|
|
2896
|
+
const delaysMap = state.machine.implementations.delays;
|
|
2897
|
+
if (typeof eventOrExpr === 'string') {
|
|
2898
|
+
throw new Error(`Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead`);
|
|
2899
|
+
}
|
|
2900
|
+
const resolvedEvent = typeof eventOrExpr === 'function' ? eventOrExpr(args) : eventOrExpr;
|
|
2901
|
+
let resolvedDelay;
|
|
2902
|
+
if (typeof delay === 'string') {
|
|
2903
|
+
const configDelay = delaysMap && delaysMap[delay];
|
|
2904
|
+
resolvedDelay = typeof configDelay === 'function' ? configDelay(args) : configDelay;
|
|
2905
|
+
} else {
|
|
2906
|
+
resolvedDelay = typeof delay === 'function' ? delay(args) : delay;
|
|
2907
|
+
}
|
|
2908
|
+
return [typeof resolvedDelay !== 'number' ? cloneState(state, {
|
|
2909
|
+
_internalQueue: state._internalQueue.concat(resolvedEvent)
|
|
2910
|
+
}) : state, {
|
|
2911
|
+
event: resolvedEvent,
|
|
2912
|
+
id,
|
|
2913
|
+
delay: resolvedDelay
|
|
2914
|
+
}];
|
|
2915
|
+
}
|
|
2916
|
+
function execute(actorContext, params) {
|
|
2917
|
+
if (typeof params.delay === 'number') {
|
|
2918
|
+
actorContext.self.delaySend(params);
|
|
2919
|
+
return;
|
|
2920
|
+
}
|
|
2965
2921
|
}
|
|
2966
2922
|
|
|
2967
2923
|
/**
|
|
@@ -2972,183 +2928,60 @@ function assign(assignment) {
|
|
|
2972
2928
|
*/
|
|
2973
2929
|
|
|
2974
2930
|
function raise(eventOrExpr, options) {
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
delay: options ? options.delay : undefined,
|
|
2979
|
-
event: eventOrExpr,
|
|
2980
|
-
id: options && options.id !== undefined ? options.id : typeof eventOrExpr === 'function' ? eventOrExpr.name : eventOrExpr.type
|
|
2981
|
-
}
|
|
2982
|
-
}, (event, {
|
|
2983
|
-
state,
|
|
2984
|
-
actorContext
|
|
2985
|
-
}) => {
|
|
2986
|
-
const params = {
|
|
2987
|
-
delay: options ? options.delay : undefined,
|
|
2988
|
-
event: eventOrExpr,
|
|
2989
|
-
id: options && options.id !== undefined ? options.id : typeof eventOrExpr === 'function' ? eventOrExpr.name : eventOrExpr.type
|
|
2990
|
-
};
|
|
2991
|
-
const args = {
|
|
2992
|
-
context: state.context,
|
|
2993
|
-
event,
|
|
2994
|
-
self: actorContext?.self ?? {},
|
|
2995
|
-
system: actorContext?.system
|
|
2996
|
-
};
|
|
2997
|
-
const delaysMap = state.machine.implementations.delays;
|
|
2998
|
-
|
|
2999
|
-
// TODO: helper function for resolving Expr
|
|
3000
|
-
if (typeof eventOrExpr === 'string') {
|
|
3001
|
-
throw new Error(`Only event objects may be used with raise; use raise({ type: "${eventOrExpr}" }) instead`);
|
|
2931
|
+
function raise(_) {
|
|
2932
|
+
{
|
|
2933
|
+
throw new Error(`This isn't supposed to be called`);
|
|
3002
2934
|
}
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
const resolvedAction = {
|
|
3012
|
-
type: raise$1,
|
|
3013
|
-
params: {
|
|
3014
|
-
...params,
|
|
3015
|
-
event: resolvedEvent,
|
|
3016
|
-
delay: resolvedDelay
|
|
3017
|
-
},
|
|
3018
|
-
execute: actorCtx => {
|
|
3019
|
-
if (typeof resolvedAction.params.delay === 'number') {
|
|
3020
|
-
actorCtx.self.delaySend(resolvedAction);
|
|
3021
|
-
return;
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
};
|
|
3025
|
-
return [state, resolvedAction];
|
|
3026
|
-
});
|
|
2935
|
+
}
|
|
2936
|
+
raise.type = 'xstate.raise';
|
|
2937
|
+
raise.event = eventOrExpr;
|
|
2938
|
+
raise.id = options?.id;
|
|
2939
|
+
raise.delay = options?.delay;
|
|
2940
|
+
raise.resolve = resolve$2;
|
|
2941
|
+
raise.execute = execute;
|
|
2942
|
+
return raise;
|
|
3027
2943
|
}
|
|
3028
2944
|
|
|
3029
|
-
function
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
}
|
|
3036
|
-
|
|
3037
|
-
}) => {
|
|
3038
|
-
const matchedActions = guards.find(condition => {
|
|
3039
|
-
const guard = condition.guard && toGuardDefinition(condition.guard, guardType => state.machine.implementations.guards[guardType]);
|
|
3040
|
-
return !guard || evaluateGuard(guard, state.context, event, state);
|
|
3041
|
-
})?.actions;
|
|
3042
|
-
return [state, {
|
|
3043
|
-
type: choose$1,
|
|
3044
|
-
params: {
|
|
3045
|
-
actions: toActionObjects(matchedActions)
|
|
3046
|
-
}
|
|
3047
|
-
}];
|
|
3048
|
-
});
|
|
2945
|
+
function resolve$1(_, state, actionArgs, {
|
|
2946
|
+
branches
|
|
2947
|
+
}) {
|
|
2948
|
+
const matchedActions = branches.find(condition => {
|
|
2949
|
+
const guard = condition.guard && toGuardDefinition(condition.guard, guardType => state.machine.implementations.guards[guardType]);
|
|
2950
|
+
return !guard || evaluateGuard(guard, state.context, actionArgs.event, state);
|
|
2951
|
+
})?.actions;
|
|
2952
|
+
return [state, undefined, toArray(matchedActions)];
|
|
3049
2953
|
}
|
|
3050
|
-
|
|
3051
|
-
function
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
params: {
|
|
3055
|
-
get: getActions
|
|
2954
|
+
function choose(branches) {
|
|
2955
|
+
function choose(_) {
|
|
2956
|
+
{
|
|
2957
|
+
throw new Error(`This isn't supposed to be called`);
|
|
3056
2958
|
}
|
|
3057
|
-
}, (event, {
|
|
3058
|
-
state
|
|
3059
|
-
}) => {
|
|
3060
|
-
return [state, {
|
|
3061
|
-
type: pure$1,
|
|
3062
|
-
params: {
|
|
3063
|
-
actions: toArray(toActionObjects(getActions({
|
|
3064
|
-
context: state.context,
|
|
3065
|
-
event
|
|
3066
|
-
}))) ?? []
|
|
3067
|
-
}
|
|
3068
|
-
}];
|
|
3069
|
-
});
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
function resolveActionObject(actionObject, actionFunctionMap) {
|
|
3073
|
-
if (isDynamicAction(actionObject)) {
|
|
3074
|
-
return actionObject;
|
|
3075
|
-
}
|
|
3076
|
-
const dereferencedAction = actionFunctionMap[actionObject.type];
|
|
3077
|
-
if (typeof dereferencedAction === 'function') {
|
|
3078
|
-
return createDynamicAction({
|
|
3079
|
-
type: 'xstate.function',
|
|
3080
|
-
params: actionObject.params ?? {}
|
|
3081
|
-
}, (event, {
|
|
3082
|
-
state
|
|
3083
|
-
}) => {
|
|
3084
|
-
const a = {
|
|
3085
|
-
type: actionObject.type,
|
|
3086
|
-
params: actionObject.params,
|
|
3087
|
-
execute: actorCtx => {
|
|
3088
|
-
return dereferencedAction({
|
|
3089
|
-
context: state.context,
|
|
3090
|
-
event,
|
|
3091
|
-
action: a,
|
|
3092
|
-
system: actorCtx.system,
|
|
3093
|
-
self: actorCtx.self
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
};
|
|
3097
|
-
return [state, a];
|
|
3098
|
-
});
|
|
3099
|
-
} else if (dereferencedAction) {
|
|
3100
|
-
return dereferencedAction;
|
|
3101
|
-
} else {
|
|
3102
|
-
return actionObject;
|
|
3103
2959
|
}
|
|
2960
|
+
choose.type = 'xstate.choose';
|
|
2961
|
+
choose.branches = branches;
|
|
2962
|
+
choose.resolve = resolve$1;
|
|
2963
|
+
return choose;
|
|
3104
2964
|
}
|
|
3105
|
-
function toActionObject(action) {
|
|
3106
|
-
if (isDynamicAction(action)) {
|
|
3107
|
-
return action;
|
|
3108
|
-
}
|
|
3109
|
-
if (typeof action === 'string') {
|
|
3110
|
-
return {
|
|
3111
|
-
type: action,
|
|
3112
|
-
params: {}
|
|
3113
|
-
};
|
|
3114
|
-
}
|
|
3115
|
-
if (typeof action === 'function') {
|
|
3116
|
-
const type = 'xstate.function';
|
|
3117
|
-
return createDynamicAction({
|
|
3118
|
-
type,
|
|
3119
|
-
params: {}
|
|
3120
|
-
}, (event, {
|
|
3121
|
-
state
|
|
3122
|
-
}) => {
|
|
3123
|
-
const actionObject = {
|
|
3124
|
-
type,
|
|
3125
|
-
params: {
|
|
3126
|
-
function: action
|
|
3127
|
-
},
|
|
3128
|
-
execute: actorCtx => {
|
|
3129
|
-
return action({
|
|
3130
|
-
context: state.context,
|
|
3131
|
-
event: event,
|
|
3132
|
-
action: actionObject,
|
|
3133
|
-
self: actorCtx.self,
|
|
3134
|
-
system: actorCtx.system
|
|
3135
|
-
});
|
|
3136
|
-
}
|
|
3137
|
-
};
|
|
3138
|
-
return [state, actionObject];
|
|
3139
|
-
});
|
|
3140
|
-
}
|
|
3141
2965
|
|
|
3142
|
-
|
|
3143
|
-
|
|
2966
|
+
function resolve(_, state, args, {
|
|
2967
|
+
get
|
|
2968
|
+
}) {
|
|
2969
|
+
return [state, undefined, toArray(get({
|
|
2970
|
+
context: state.context,
|
|
2971
|
+
event: args.event
|
|
2972
|
+
}))];
|
|
3144
2973
|
}
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
2974
|
+
function pure(getActions) {
|
|
2975
|
+
function pure(_) {
|
|
2976
|
+
{
|
|
2977
|
+
throw new Error(`This isn't supposed to be called`);
|
|
2978
|
+
}
|
|
3148
2979
|
}
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
2980
|
+
pure.type = 'xstate.pure';
|
|
2981
|
+
pure.get = getActions;
|
|
2982
|
+
pure.resolve = resolve;
|
|
2983
|
+
return pure;
|
|
2984
|
+
}
|
|
3152
2985
|
|
|
3153
2986
|
/**
|
|
3154
2987
|
* Returns an event type that represents an implicit event that
|
|
@@ -3159,7 +2992,7 @@ const toActionObjects = action => {
|
|
|
3159
2992
|
*/
|
|
3160
2993
|
function after(delayRef, id) {
|
|
3161
2994
|
const idSuffix = id ? `#${id}` : '';
|
|
3162
|
-
return `${
|
|
2995
|
+
return `${ConstantPrefix.After}(${delayRef})${idSuffix}`;
|
|
3163
2996
|
}
|
|
3164
2997
|
|
|
3165
2998
|
/**
|
|
@@ -3170,7 +3003,7 @@ function after(delayRef, id) {
|
|
|
3170
3003
|
* @param output The data to pass into the event
|
|
3171
3004
|
*/
|
|
3172
3005
|
function done(id, output) {
|
|
3173
|
-
const type = `${
|
|
3006
|
+
const type = `${ConstantPrefix.DoneState}.${id}`;
|
|
3174
3007
|
const eventObject = {
|
|
3175
3008
|
type,
|
|
3176
3009
|
output
|
|
@@ -3189,7 +3022,7 @@ function done(id, output) {
|
|
|
3189
3022
|
* @param output The data to pass into the event
|
|
3190
3023
|
*/
|
|
3191
3024
|
function doneInvoke(invokeId, output) {
|
|
3192
|
-
const type = `${
|
|
3025
|
+
const type = `${ConstantPrefix.DoneInvoke}.${invokeId}`;
|
|
3193
3026
|
const eventObject = {
|
|
3194
3027
|
type,
|
|
3195
3028
|
output
|
|
@@ -3198,7 +3031,7 @@ function doneInvoke(invokeId, output) {
|
|
|
3198
3031
|
return eventObject;
|
|
3199
3032
|
}
|
|
3200
3033
|
function error(id, data) {
|
|
3201
|
-
const type = `${
|
|
3034
|
+
const type = `${ConstantPrefix.ErrorPlatform}.${id}`;
|
|
3202
3035
|
const eventObject = {
|
|
3203
3036
|
type,
|
|
3204
3037
|
data
|
|
@@ -3208,24 +3041,24 @@ function error(id, data) {
|
|
|
3208
3041
|
}
|
|
3209
3042
|
function createInitEvent(input) {
|
|
3210
3043
|
return {
|
|
3211
|
-
type:
|
|
3044
|
+
type: INIT_TYPE,
|
|
3212
3045
|
input
|
|
3213
3046
|
};
|
|
3214
3047
|
}
|
|
3215
3048
|
|
|
3216
|
-
exports.ActionTypes = ActionTypes;
|
|
3217
3049
|
exports.ActorStatus = ActorStatus;
|
|
3050
|
+
exports.ConstantPrefix = ConstantPrefix;
|
|
3218
3051
|
exports.Interpreter = Interpreter;
|
|
3219
3052
|
exports.NULL_EVENT = NULL_EVENT;
|
|
3220
3053
|
exports.STATE_DELIMITER = STATE_DELIMITER;
|
|
3221
3054
|
exports.SpecialTargets = SpecialTargets;
|
|
3222
3055
|
exports.State = State;
|
|
3223
|
-
exports.actionTypes = actionTypes;
|
|
3224
3056
|
exports.after = after;
|
|
3225
3057
|
exports.and = and;
|
|
3226
3058
|
exports.assign = assign;
|
|
3227
3059
|
exports.cancel = cancel;
|
|
3228
3060
|
exports.choose = choose;
|
|
3061
|
+
exports.constantPrefixes = constantPrefixes;
|
|
3229
3062
|
exports.createEmptyActor = createEmptyActor;
|
|
3230
3063
|
exports.createInitEvent = createInitEvent;
|
|
3231
3064
|
exports.createInvokeId = createInvokeId;
|
|
@@ -3252,14 +3085,12 @@ exports.getPersistedState = getPersistedState;
|
|
|
3252
3085
|
exports.getStateNodeByPath = getStateNodeByPath;
|
|
3253
3086
|
exports.getStateNodes = getStateNodes;
|
|
3254
3087
|
exports.interpret = interpret;
|
|
3255
|
-
exports.invoke = invoke$1;
|
|
3256
3088
|
exports.isActorRef = isActorRef;
|
|
3257
3089
|
exports.isAtomicStateNode = isAtomicStateNode;
|
|
3258
3090
|
exports.isErrorEvent = isErrorEvent;
|
|
3259
3091
|
exports.isInFinalState = isInFinalState;
|
|
3260
3092
|
exports.isSignal = isSignal;
|
|
3261
3093
|
exports.isStateId = isStateId;
|
|
3262
|
-
exports.isString = isString;
|
|
3263
3094
|
exports.log = log;
|
|
3264
3095
|
exports.macrostep = macrostep;
|
|
3265
3096
|
exports.mapValues = mapValues;
|
|
@@ -3271,7 +3102,6 @@ exports.or = or;
|
|
|
3271
3102
|
exports.pathToStateValue = pathToStateValue;
|
|
3272
3103
|
exports.pure = pure;
|
|
3273
3104
|
exports.raise = raise;
|
|
3274
|
-
exports.resolveActionObject = resolveActionObject;
|
|
3275
3105
|
exports.resolveActionsAndContext = resolveActionsAndContext;
|
|
3276
3106
|
exports.resolveReferencedActor = resolveReferencedActor;
|
|
3277
3107
|
exports.resolveStateValue = resolveStateValue;
|
|
@@ -3283,8 +3113,6 @@ exports.stateIn = stateIn;
|
|
|
3283
3113
|
exports.stop = stop;
|
|
3284
3114
|
exports.stopSignal = stopSignal;
|
|
3285
3115
|
exports.stopSignalType = stopSignalType;
|
|
3286
|
-
exports.toActionObject = toActionObject;
|
|
3287
|
-
exports.toActionObjects = toActionObjects;
|
|
3288
3116
|
exports.toActorRef = toActorRef;
|
|
3289
3117
|
exports.toArray = toArray;
|
|
3290
3118
|
exports.toGuardDefinition = toGuardDefinition;
|