xstate 5.0.0-beta.34 → 5.0.0-beta.36
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/README.md +1 -1
- package/actions/dist/xstate-actions.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.esm.js +3 -3
- package/actions/dist/xstate-actions.esm.js +3 -3
- 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/declarations/src/State.d.ts +0 -1
- package/dist/declarations/src/interpreter.d.ts +2 -0
- package/dist/declarations/src/stateUtils.d.ts +8 -7
- package/dist/declarations/src/types.d.ts +3 -6
- package/dist/{interpreter-dee56dc8.development.esm.js → interpreter-5c4e6634.development.esm.js} +59 -57
- package/dist/{interpreter-1301970f.cjs.js → interpreter-69605bf0.cjs.js} +59 -57
- package/dist/{interpreter-70ed62f2.development.cjs.js → interpreter-d3567419.development.cjs.js} +59 -57
- package/dist/{interpreter-83f7f2d4.esm.js → interpreter-de5217bc.esm.js} +59 -57
- package/dist/{raise-38b707c0.development.cjs.js → raise-106ea558.development.cjs.js} +160 -160
- package/dist/{raise-05f8b2a6.development.esm.js → raise-5b7ad3b7.development.esm.js} +160 -160
- package/dist/{raise-1dd65455.cjs.js → raise-c51b81a3.cjs.js} +157 -160
- package/dist/{raise-b5cfe1bb.esm.js → raise-ffe1014a.esm.js} +157 -160
- package/dist/{send-0b5eda0c.esm.js → send-0a7aa74e.esm.js} +5 -3
- package/dist/{send-3764c866.development.cjs.js → send-25e70bd4.development.cjs.js} +5 -3
- package/dist/{send-fe94de2b.cjs.js → send-778692de.cjs.js} +5 -3
- package/dist/{send-9526366e.development.esm.js → send-e93554d6.development.esm.js} +5 -3
- package/dist/xstate.cjs.js +32 -13
- package/dist/xstate.development.cjs.js +32 -13
- package/dist/xstate.development.esm.js +35 -16
- package/dist/xstate.esm.js +35 -16
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.esm.js +2 -2
- package/guards/dist/xstate-guards.esm.js +2 -2
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/{interpreter-dee56dc8.development.esm.js → interpreter-5c4e6634.development.esm.js}
RENAMED
|
@@ -9,62 +9,6 @@ const XSTATE_INIT = 'xstate.init';
|
|
|
9
9
|
const XSTATE_ERROR = 'xstate.error';
|
|
10
10
|
const XSTATE_STOP = 'xstate.stop';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Returns an event that represents an implicit event that
|
|
14
|
-
* is sent after the specified `delay`.
|
|
15
|
-
*
|
|
16
|
-
* @param delayRef The delay in milliseconds
|
|
17
|
-
* @param id The state node ID where this event is handled
|
|
18
|
-
*/
|
|
19
|
-
function createAfterEvent(delayRef, id) {
|
|
20
|
-
const idSuffix = id ? `#${id}` : '';
|
|
21
|
-
return {
|
|
22
|
-
type: `xstate.after(${delayRef})${idSuffix}`
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns an event that represents that a final state node
|
|
28
|
-
* has been reached in the parent state node.
|
|
29
|
-
*
|
|
30
|
-
* @param id The final state node's parent state node `id`
|
|
31
|
-
* @param output The data to pass into the event
|
|
32
|
-
*/
|
|
33
|
-
function createDoneStateEvent(id, output) {
|
|
34
|
-
return {
|
|
35
|
-
type: `xstate.done.state.${id}`,
|
|
36
|
-
output
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns an event that represents that an invoked service has terminated.
|
|
42
|
-
*
|
|
43
|
-
* An invoked service is terminated when it has reached a top-level final state node,
|
|
44
|
-
* but not when it is canceled.
|
|
45
|
-
*
|
|
46
|
-
* @param invokeId The invoked service ID
|
|
47
|
-
* @param output The data to pass into the event
|
|
48
|
-
*/
|
|
49
|
-
function createDoneActorEvent(invokeId, output) {
|
|
50
|
-
return {
|
|
51
|
-
type: `xstate.done.actor.${invokeId}`,
|
|
52
|
-
output
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function createErrorActorEvent(id, data) {
|
|
56
|
-
return {
|
|
57
|
-
type: `xstate.error.actor.${id}`,
|
|
58
|
-
data
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function createInitEvent(input) {
|
|
62
|
-
return {
|
|
63
|
-
type: XSTATE_INIT,
|
|
64
|
-
input
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
12
|
class Mailbox {
|
|
69
13
|
constructor(_process) {
|
|
70
14
|
this._process = _process;
|
|
@@ -132,6 +76,62 @@ class Mailbox {
|
|
|
132
76
|
}
|
|
133
77
|
}
|
|
134
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Returns an event that represents an implicit event that
|
|
81
|
+
* is sent after the specified `delay`.
|
|
82
|
+
*
|
|
83
|
+
* @param delayRef The delay in milliseconds
|
|
84
|
+
* @param id The state node ID where this event is handled
|
|
85
|
+
*/
|
|
86
|
+
function createAfterEvent(delayRef, id) {
|
|
87
|
+
const idSuffix = id ? `#${id}` : '';
|
|
88
|
+
return {
|
|
89
|
+
type: `xstate.after(${delayRef})${idSuffix}`
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Returns an event that represents that a final state node
|
|
95
|
+
* has been reached in the parent state node.
|
|
96
|
+
*
|
|
97
|
+
* @param id The final state node's parent state node `id`
|
|
98
|
+
* @param output The data to pass into the event
|
|
99
|
+
*/
|
|
100
|
+
function createDoneStateEvent(id, output) {
|
|
101
|
+
return {
|
|
102
|
+
type: `xstate.done.state.${id}`,
|
|
103
|
+
output
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Returns an event that represents that an invoked service has terminated.
|
|
109
|
+
*
|
|
110
|
+
* An invoked service is terminated when it has reached a top-level final state node,
|
|
111
|
+
* but not when it is canceled.
|
|
112
|
+
*
|
|
113
|
+
* @param invokeId The invoked service ID
|
|
114
|
+
* @param output The data to pass into the event
|
|
115
|
+
*/
|
|
116
|
+
function createDoneActorEvent(invokeId, output) {
|
|
117
|
+
return {
|
|
118
|
+
type: `xstate.done.actor.${invokeId}`,
|
|
119
|
+
output
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function createErrorActorEvent(id, data) {
|
|
123
|
+
return {
|
|
124
|
+
type: `xstate.error.actor.${id}`,
|
|
125
|
+
data
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function createInitEvent(input) {
|
|
129
|
+
return {
|
|
130
|
+
type: XSTATE_INIT,
|
|
131
|
+
input
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
135
|
/**
|
|
136
136
|
* This function makes sure that unhandled errors are thrown in a separate macrotask.
|
|
137
137
|
* It allows those errors to be detected by global error handlers and reported to bug tracking services
|
|
@@ -343,6 +343,7 @@ function resolveReferencedActor(referenced) {
|
|
|
343
343
|
} : referenced : undefined;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
const $$ACTOR_TYPE = 1;
|
|
346
347
|
let ActorStatus = /*#__PURE__*/function (ActorStatus) {
|
|
347
348
|
ActorStatus[ActorStatus["NotStarted"] = 0] = "NotStarted";
|
|
348
349
|
ActorStatus[ActorStatus["Running"] = 1] = "Running";
|
|
@@ -755,6 +756,7 @@ class Actor {
|
|
|
755
756
|
}
|
|
756
757
|
toJSON() {
|
|
757
758
|
return {
|
|
759
|
+
xstate$$type: $$ACTOR_TYPE,
|
|
758
760
|
id: this.id
|
|
759
761
|
};
|
|
760
762
|
}
|
|
@@ -792,4 +794,4 @@ const interpret = createActor;
|
|
|
792
794
|
* @deprecated Use `Actor` instead.
|
|
793
795
|
*/
|
|
794
796
|
|
|
795
|
-
export { Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_STOP as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, createErrorActorEvent as j, toStateValue as k, STATE_IDENTIFIER as l, mapValues as m, normalizeTarget as n, toStatePath as o, pathToStateValue as p, createDoneStateEvent as q, resolveReferencedActor as r, resolveOutput as s, toArray as t, XSTATE_INIT as u,
|
|
797
|
+
export { $$ACTOR_TYPE as $, Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_STOP as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, createErrorActorEvent as j, toStateValue as k, STATE_IDENTIFIER as l, mapValues as m, normalizeTarget as n, toStatePath as o, pathToStateValue as p, createDoneStateEvent as q, resolveReferencedActor as r, resolveOutput as s, toArray as t, XSTATE_INIT as u, createAfterEvent as v, flatten as w, XSTATE_ERROR as x };
|
|
@@ -11,62 +11,6 @@ const XSTATE_INIT = 'xstate.init';
|
|
|
11
11
|
const XSTATE_ERROR = 'xstate.error';
|
|
12
12
|
const XSTATE_STOP = 'xstate.stop';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Returns an event that represents an implicit event that
|
|
16
|
-
* is sent after the specified `delay`.
|
|
17
|
-
*
|
|
18
|
-
* @param delayRef The delay in milliseconds
|
|
19
|
-
* @param id The state node ID where this event is handled
|
|
20
|
-
*/
|
|
21
|
-
function createAfterEvent(delayRef, id) {
|
|
22
|
-
const idSuffix = id ? `#${id}` : '';
|
|
23
|
-
return {
|
|
24
|
-
type: `xstate.after(${delayRef})${idSuffix}`
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns an event that represents that a final state node
|
|
30
|
-
* has been reached in the parent state node.
|
|
31
|
-
*
|
|
32
|
-
* @param id The final state node's parent state node `id`
|
|
33
|
-
* @param output The data to pass into the event
|
|
34
|
-
*/
|
|
35
|
-
function createDoneStateEvent(id, output) {
|
|
36
|
-
return {
|
|
37
|
-
type: `xstate.done.state.${id}`,
|
|
38
|
-
output
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Returns an event that represents that an invoked service has terminated.
|
|
44
|
-
*
|
|
45
|
-
* An invoked service is terminated when it has reached a top-level final state node,
|
|
46
|
-
* but not when it is canceled.
|
|
47
|
-
*
|
|
48
|
-
* @param invokeId The invoked service ID
|
|
49
|
-
* @param output The data to pass into the event
|
|
50
|
-
*/
|
|
51
|
-
function createDoneActorEvent(invokeId, output) {
|
|
52
|
-
return {
|
|
53
|
-
type: `xstate.done.actor.${invokeId}`,
|
|
54
|
-
output
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function createErrorActorEvent(id, data) {
|
|
58
|
-
return {
|
|
59
|
-
type: `xstate.error.actor.${id}`,
|
|
60
|
-
data
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function createInitEvent(input) {
|
|
64
|
-
return {
|
|
65
|
-
type: XSTATE_INIT,
|
|
66
|
-
input
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
14
|
class Mailbox {
|
|
71
15
|
constructor(_process) {
|
|
72
16
|
this._process = _process;
|
|
@@ -134,6 +78,62 @@ class Mailbox {
|
|
|
134
78
|
}
|
|
135
79
|
}
|
|
136
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Returns an event that represents an implicit event that
|
|
83
|
+
* is sent after the specified `delay`.
|
|
84
|
+
*
|
|
85
|
+
* @param delayRef The delay in milliseconds
|
|
86
|
+
* @param id The state node ID where this event is handled
|
|
87
|
+
*/
|
|
88
|
+
function createAfterEvent(delayRef, id) {
|
|
89
|
+
const idSuffix = id ? `#${id}` : '';
|
|
90
|
+
return {
|
|
91
|
+
type: `xstate.after(${delayRef})${idSuffix}`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns an event that represents that a final state node
|
|
97
|
+
* has been reached in the parent state node.
|
|
98
|
+
*
|
|
99
|
+
* @param id The final state node's parent state node `id`
|
|
100
|
+
* @param output The data to pass into the event
|
|
101
|
+
*/
|
|
102
|
+
function createDoneStateEvent(id, output) {
|
|
103
|
+
return {
|
|
104
|
+
type: `xstate.done.state.${id}`,
|
|
105
|
+
output
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns an event that represents that an invoked service has terminated.
|
|
111
|
+
*
|
|
112
|
+
* An invoked service is terminated when it has reached a top-level final state node,
|
|
113
|
+
* but not when it is canceled.
|
|
114
|
+
*
|
|
115
|
+
* @param invokeId The invoked service ID
|
|
116
|
+
* @param output The data to pass into the event
|
|
117
|
+
*/
|
|
118
|
+
function createDoneActorEvent(invokeId, output) {
|
|
119
|
+
return {
|
|
120
|
+
type: `xstate.done.actor.${invokeId}`,
|
|
121
|
+
output
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function createErrorActorEvent(id, data) {
|
|
125
|
+
return {
|
|
126
|
+
type: `xstate.error.actor.${id}`,
|
|
127
|
+
data
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function createInitEvent(input) {
|
|
131
|
+
return {
|
|
132
|
+
type: XSTATE_INIT,
|
|
133
|
+
input
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
137
|
/**
|
|
138
138
|
* This function makes sure that unhandled errors are thrown in a separate macrotask.
|
|
139
139
|
* It allows those errors to be detected by global error handlers and reported to bug tracking services
|
|
@@ -342,6 +342,7 @@ function resolveReferencedActor(referenced) {
|
|
|
342
342
|
} : referenced : undefined;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
const $$ACTOR_TYPE = 1;
|
|
345
346
|
let ActorStatus = /*#__PURE__*/function (ActorStatus) {
|
|
346
347
|
ActorStatus[ActorStatus["NotStarted"] = 0] = "NotStarted";
|
|
347
348
|
ActorStatus[ActorStatus["Running"] = 1] = "Running";
|
|
@@ -746,6 +747,7 @@ class Actor {
|
|
|
746
747
|
}
|
|
747
748
|
toJSON() {
|
|
748
749
|
return {
|
|
750
|
+
xstate$$type: $$ACTOR_TYPE,
|
|
749
751
|
id: this.id
|
|
750
752
|
};
|
|
751
753
|
}
|
|
@@ -783,6 +785,7 @@ const interpret = createActor;
|
|
|
783
785
|
* @deprecated Use `Actor` instead.
|
|
784
786
|
*/
|
|
785
787
|
|
|
788
|
+
exports.$$ACTOR_TYPE = $$ACTOR_TYPE;
|
|
786
789
|
exports.Actor = Actor;
|
|
787
790
|
exports.ActorStatus = ActorStatus;
|
|
788
791
|
exports.InterpreterStatus = InterpreterStatus;
|
|
@@ -801,7 +804,6 @@ exports.createInitEvent = createInitEvent;
|
|
|
801
804
|
exports.createInvokeId = createInvokeId;
|
|
802
805
|
exports.flatten = flatten;
|
|
803
806
|
exports.interpret = interpret;
|
|
804
|
-
exports.isArray = isArray;
|
|
805
807
|
exports.isErrorActorEvent = isErrorActorEvent;
|
|
806
808
|
exports.mapValues = mapValues;
|
|
807
809
|
exports.matchesState = matchesState;
|
package/dist/{interpreter-70ed62f2.development.cjs.js → interpreter-d3567419.development.cjs.js}
RENAMED
|
@@ -11,62 +11,6 @@ const XSTATE_INIT = 'xstate.init';
|
|
|
11
11
|
const XSTATE_ERROR = 'xstate.error';
|
|
12
12
|
const XSTATE_STOP = 'xstate.stop';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Returns an event that represents an implicit event that
|
|
16
|
-
* is sent after the specified `delay`.
|
|
17
|
-
*
|
|
18
|
-
* @param delayRef The delay in milliseconds
|
|
19
|
-
* @param id The state node ID where this event is handled
|
|
20
|
-
*/
|
|
21
|
-
function createAfterEvent(delayRef, id) {
|
|
22
|
-
const idSuffix = id ? `#${id}` : '';
|
|
23
|
-
return {
|
|
24
|
-
type: `xstate.after(${delayRef})${idSuffix}`
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns an event that represents that a final state node
|
|
30
|
-
* has been reached in the parent state node.
|
|
31
|
-
*
|
|
32
|
-
* @param id The final state node's parent state node `id`
|
|
33
|
-
* @param output The data to pass into the event
|
|
34
|
-
*/
|
|
35
|
-
function createDoneStateEvent(id, output) {
|
|
36
|
-
return {
|
|
37
|
-
type: `xstate.done.state.${id}`,
|
|
38
|
-
output
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Returns an event that represents that an invoked service has terminated.
|
|
44
|
-
*
|
|
45
|
-
* An invoked service is terminated when it has reached a top-level final state node,
|
|
46
|
-
* but not when it is canceled.
|
|
47
|
-
*
|
|
48
|
-
* @param invokeId The invoked service ID
|
|
49
|
-
* @param output The data to pass into the event
|
|
50
|
-
*/
|
|
51
|
-
function createDoneActorEvent(invokeId, output) {
|
|
52
|
-
return {
|
|
53
|
-
type: `xstate.done.actor.${invokeId}`,
|
|
54
|
-
output
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function createErrorActorEvent(id, data) {
|
|
58
|
-
return {
|
|
59
|
-
type: `xstate.error.actor.${id}`,
|
|
60
|
-
data
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function createInitEvent(input) {
|
|
64
|
-
return {
|
|
65
|
-
type: XSTATE_INIT,
|
|
66
|
-
input
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
14
|
class Mailbox {
|
|
71
15
|
constructor(_process) {
|
|
72
16
|
this._process = _process;
|
|
@@ -134,6 +78,62 @@ class Mailbox {
|
|
|
134
78
|
}
|
|
135
79
|
}
|
|
136
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Returns an event that represents an implicit event that
|
|
83
|
+
* is sent after the specified `delay`.
|
|
84
|
+
*
|
|
85
|
+
* @param delayRef The delay in milliseconds
|
|
86
|
+
* @param id The state node ID where this event is handled
|
|
87
|
+
*/
|
|
88
|
+
function createAfterEvent(delayRef, id) {
|
|
89
|
+
const idSuffix = id ? `#${id}` : '';
|
|
90
|
+
return {
|
|
91
|
+
type: `xstate.after(${delayRef})${idSuffix}`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns an event that represents that a final state node
|
|
97
|
+
* has been reached in the parent state node.
|
|
98
|
+
*
|
|
99
|
+
* @param id The final state node's parent state node `id`
|
|
100
|
+
* @param output The data to pass into the event
|
|
101
|
+
*/
|
|
102
|
+
function createDoneStateEvent(id, output) {
|
|
103
|
+
return {
|
|
104
|
+
type: `xstate.done.state.${id}`,
|
|
105
|
+
output
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns an event that represents that an invoked service has terminated.
|
|
111
|
+
*
|
|
112
|
+
* An invoked service is terminated when it has reached a top-level final state node,
|
|
113
|
+
* but not when it is canceled.
|
|
114
|
+
*
|
|
115
|
+
* @param invokeId The invoked service ID
|
|
116
|
+
* @param output The data to pass into the event
|
|
117
|
+
*/
|
|
118
|
+
function createDoneActorEvent(invokeId, output) {
|
|
119
|
+
return {
|
|
120
|
+
type: `xstate.done.actor.${invokeId}`,
|
|
121
|
+
output
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function createErrorActorEvent(id, data) {
|
|
125
|
+
return {
|
|
126
|
+
type: `xstate.error.actor.${id}`,
|
|
127
|
+
data
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function createInitEvent(input) {
|
|
131
|
+
return {
|
|
132
|
+
type: XSTATE_INIT,
|
|
133
|
+
input
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
137
|
/**
|
|
138
138
|
* This function makes sure that unhandled errors are thrown in a separate macrotask.
|
|
139
139
|
* It allows those errors to be detected by global error handlers and reported to bug tracking services
|
|
@@ -345,6 +345,7 @@ function resolveReferencedActor(referenced) {
|
|
|
345
345
|
} : referenced : undefined;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
const $$ACTOR_TYPE = 1;
|
|
348
349
|
let ActorStatus = /*#__PURE__*/function (ActorStatus) {
|
|
349
350
|
ActorStatus[ActorStatus["NotStarted"] = 0] = "NotStarted";
|
|
350
351
|
ActorStatus[ActorStatus["Running"] = 1] = "Running";
|
|
@@ -757,6 +758,7 @@ class Actor {
|
|
|
757
758
|
}
|
|
758
759
|
toJSON() {
|
|
759
760
|
return {
|
|
761
|
+
xstate$$type: $$ACTOR_TYPE,
|
|
760
762
|
id: this.id
|
|
761
763
|
};
|
|
762
764
|
}
|
|
@@ -794,6 +796,7 @@ const interpret = createActor;
|
|
|
794
796
|
* @deprecated Use `Actor` instead.
|
|
795
797
|
*/
|
|
796
798
|
|
|
799
|
+
exports.$$ACTOR_TYPE = $$ACTOR_TYPE;
|
|
797
800
|
exports.Actor = Actor;
|
|
798
801
|
exports.ActorStatus = ActorStatus;
|
|
799
802
|
exports.InterpreterStatus = InterpreterStatus;
|
|
@@ -812,7 +815,6 @@ exports.createInitEvent = createInitEvent;
|
|
|
812
815
|
exports.createInvokeId = createInvokeId;
|
|
813
816
|
exports.flatten = flatten;
|
|
814
817
|
exports.interpret = interpret;
|
|
815
|
-
exports.isArray = isArray;
|
|
816
818
|
exports.isErrorActorEvent = isErrorActorEvent;
|
|
817
819
|
exports.mapValues = mapValues;
|
|
818
820
|
exports.matchesState = matchesState;
|
|
@@ -9,62 +9,6 @@ const XSTATE_INIT = 'xstate.init';
|
|
|
9
9
|
const XSTATE_ERROR = 'xstate.error';
|
|
10
10
|
const XSTATE_STOP = 'xstate.stop';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Returns an event that represents an implicit event that
|
|
14
|
-
* is sent after the specified `delay`.
|
|
15
|
-
*
|
|
16
|
-
* @param delayRef The delay in milliseconds
|
|
17
|
-
* @param id The state node ID where this event is handled
|
|
18
|
-
*/
|
|
19
|
-
function createAfterEvent(delayRef, id) {
|
|
20
|
-
const idSuffix = id ? `#${id}` : '';
|
|
21
|
-
return {
|
|
22
|
-
type: `xstate.after(${delayRef})${idSuffix}`
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns an event that represents that a final state node
|
|
28
|
-
* has been reached in the parent state node.
|
|
29
|
-
*
|
|
30
|
-
* @param id The final state node's parent state node `id`
|
|
31
|
-
* @param output The data to pass into the event
|
|
32
|
-
*/
|
|
33
|
-
function createDoneStateEvent(id, output) {
|
|
34
|
-
return {
|
|
35
|
-
type: `xstate.done.state.${id}`,
|
|
36
|
-
output
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns an event that represents that an invoked service has terminated.
|
|
42
|
-
*
|
|
43
|
-
* An invoked service is terminated when it has reached a top-level final state node,
|
|
44
|
-
* but not when it is canceled.
|
|
45
|
-
*
|
|
46
|
-
* @param invokeId The invoked service ID
|
|
47
|
-
* @param output The data to pass into the event
|
|
48
|
-
*/
|
|
49
|
-
function createDoneActorEvent(invokeId, output) {
|
|
50
|
-
return {
|
|
51
|
-
type: `xstate.done.actor.${invokeId}`,
|
|
52
|
-
output
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function createErrorActorEvent(id, data) {
|
|
56
|
-
return {
|
|
57
|
-
type: `xstate.error.actor.${id}`,
|
|
58
|
-
data
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function createInitEvent(input) {
|
|
62
|
-
return {
|
|
63
|
-
type: XSTATE_INIT,
|
|
64
|
-
input
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
12
|
class Mailbox {
|
|
69
13
|
constructor(_process) {
|
|
70
14
|
this._process = _process;
|
|
@@ -132,6 +76,62 @@ class Mailbox {
|
|
|
132
76
|
}
|
|
133
77
|
}
|
|
134
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Returns an event that represents an implicit event that
|
|
81
|
+
* is sent after the specified `delay`.
|
|
82
|
+
*
|
|
83
|
+
* @param delayRef The delay in milliseconds
|
|
84
|
+
* @param id The state node ID where this event is handled
|
|
85
|
+
*/
|
|
86
|
+
function createAfterEvent(delayRef, id) {
|
|
87
|
+
const idSuffix = id ? `#${id}` : '';
|
|
88
|
+
return {
|
|
89
|
+
type: `xstate.after(${delayRef})${idSuffix}`
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Returns an event that represents that a final state node
|
|
95
|
+
* has been reached in the parent state node.
|
|
96
|
+
*
|
|
97
|
+
* @param id The final state node's parent state node `id`
|
|
98
|
+
* @param output The data to pass into the event
|
|
99
|
+
*/
|
|
100
|
+
function createDoneStateEvent(id, output) {
|
|
101
|
+
return {
|
|
102
|
+
type: `xstate.done.state.${id}`,
|
|
103
|
+
output
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Returns an event that represents that an invoked service has terminated.
|
|
109
|
+
*
|
|
110
|
+
* An invoked service is terminated when it has reached a top-level final state node,
|
|
111
|
+
* but not when it is canceled.
|
|
112
|
+
*
|
|
113
|
+
* @param invokeId The invoked service ID
|
|
114
|
+
* @param output The data to pass into the event
|
|
115
|
+
*/
|
|
116
|
+
function createDoneActorEvent(invokeId, output) {
|
|
117
|
+
return {
|
|
118
|
+
type: `xstate.done.actor.${invokeId}`,
|
|
119
|
+
output
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function createErrorActorEvent(id, data) {
|
|
123
|
+
return {
|
|
124
|
+
type: `xstate.error.actor.${id}`,
|
|
125
|
+
data
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function createInitEvent(input) {
|
|
129
|
+
return {
|
|
130
|
+
type: XSTATE_INIT,
|
|
131
|
+
input
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
135
|
/**
|
|
136
136
|
* This function makes sure that unhandled errors are thrown in a separate macrotask.
|
|
137
137
|
* It allows those errors to be detected by global error handlers and reported to bug tracking services
|
|
@@ -340,6 +340,7 @@ function resolveReferencedActor(referenced) {
|
|
|
340
340
|
} : referenced : undefined;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
const $$ACTOR_TYPE = 1;
|
|
343
344
|
let ActorStatus = /*#__PURE__*/function (ActorStatus) {
|
|
344
345
|
ActorStatus[ActorStatus["NotStarted"] = 0] = "NotStarted";
|
|
345
346
|
ActorStatus[ActorStatus["Running"] = 1] = "Running";
|
|
@@ -744,6 +745,7 @@ class Actor {
|
|
|
744
745
|
}
|
|
745
746
|
toJSON() {
|
|
746
747
|
return {
|
|
748
|
+
xstate$$type: $$ACTOR_TYPE,
|
|
747
749
|
id: this.id
|
|
748
750
|
};
|
|
749
751
|
}
|
|
@@ -781,4 +783,4 @@ const interpret = createActor;
|
|
|
781
783
|
* @deprecated Use `Actor` instead.
|
|
782
784
|
*/
|
|
783
785
|
|
|
784
|
-
export { Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_STOP as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, createErrorActorEvent as j, toStateValue as k, STATE_IDENTIFIER as l, mapValues as m, normalizeTarget as n, toStatePath as o, pathToStateValue as p, createDoneStateEvent as q, resolveReferencedActor as r, resolveOutput as s, toArray as t, XSTATE_INIT as u,
|
|
786
|
+
export { $$ACTOR_TYPE as $, Actor as A, InterpreterStatus as I, NULL_EVENT as N, STATE_DELIMITER as S, WILDCARD as W, XSTATE_STOP as X, toTransitionConfigArray as a, createInitEvent as b, createInvokeId as c, createActor as d, matchesState as e, ActorStatus as f, interpret as g, toObserver as h, isErrorActorEvent as i, createErrorActorEvent as j, toStateValue as k, STATE_IDENTIFIER as l, mapValues as m, normalizeTarget as n, toStatePath as o, pathToStateValue as p, createDoneStateEvent as q, resolveReferencedActor as r, resolveOutput as s, toArray as t, XSTATE_INIT as u, createAfterEvent as v, flatten as w, XSTATE_ERROR as x };
|