xstate 4.32.1 → 5.0.0-alpha.0
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/CHANGELOG.md +483 -0
- package/actions/ExecutableAction.ts +58 -0
- package/actions/dist/xstate-actions.cjs.d.ts +1 -0
- package/actions/dist/xstate-actions.cjs.dev.js +32 -0
- package/actions/dist/xstate-actions.cjs.js +7 -0
- package/actions/dist/xstate-actions.cjs.prod.js +32 -0
- package/actions/dist/xstate-actions.esm.js +2 -0
- package/actions/dynamicAction.ts +34 -0
- package/actions/package.json +4 -0
- package/actors/dist/xstate-actors.cjs.d.ts +1 -0
- package/actors/dist/xstate-actors.cjs.dev.js +21 -0
- package/actors/dist/xstate-actors.cjs.js +7 -0
- package/actors/dist/xstate-actors.cjs.prod.js +21 -0
- package/actors/dist/xstate-actors.esm.js +2 -0
- package/actors/package.json +4 -0
- package/dev/dist/xstate-dev.cjs.d.ts +1 -0
- package/dev/dist/xstate-dev.cjs.dev.js +11 -0
- package/dev/dist/xstate-dev.cjs.js +7 -0
- package/{lib/devTools.js → dev/dist/xstate-dev.cjs.prod.js} +17 -10
- package/dev/dist/xstate-dev.esm.js +1 -0
- package/dev/package.json +4 -0
- package/dist/Machine-9ce74c11.cjs.dev.js +755 -0
- package/dist/Machine-dca041dc.cjs.prod.js +749 -0
- package/dist/Machine-fb2f47f5.esm.js +751 -0
- package/dist/actions-6b86876d.cjs.dev.js +4815 -0
- package/dist/actions-70094c93.cjs.prod.js +4765 -0
- package/dist/actions-ff512f16.esm.js +4757 -0
- package/dist/declarations/actions/ExecutableAction.d.ts +23 -0
- package/dist/declarations/actions/dynamicAction.d.ts +3 -0
- package/dist/declarations/src/Machine.d.ts +4 -0
- package/dist/declarations/src/Mailbox.d.ts +12 -0
- package/dist/declarations/src/ObservableActorRef.d.ts +25 -0
- package/{lib → dist/declarations/src}/SimulatedClock.d.ts +0 -1
- package/dist/declarations/src/State.d.ts +104 -0
- package/dist/declarations/src/StateMachine.d.ts +112 -0
- package/dist/declarations/src/StateNode.d.ts +127 -0
- package/{es → dist/declarations/src}/actionTypes.d.ts +0 -3
- package/dist/declarations/src/actions/assign.d.ts +7 -0
- package/dist/declarations/src/actions/cancel.d.ts +10 -0
- package/dist/declarations/src/actions/choose.d.ts +3 -0
- package/dist/declarations/src/actions/invoke.d.ts +3 -0
- package/dist/declarations/src/actions/log.d.ts +11 -0
- package/dist/declarations/src/actions/pure.d.ts +3 -0
- package/dist/declarations/src/actions/raise.d.ts +9 -0
- package/dist/declarations/src/actions/send.d.ts +55 -0
- package/dist/declarations/src/actions/stop.d.ts +8 -0
- package/dist/declarations/src/actions.d.ts +44 -0
- package/dist/declarations/src/actors.d.ts +38 -0
- package/dist/declarations/src/constants.d.ts +5 -0
- package/{lib/devTools.d.ts → dist/declarations/src/dev/index.d.ts} +2 -2
- package/{es → dist/declarations/src}/environment.d.ts +0 -1
- package/dist/declarations/src/guards.d.ts +9 -0
- package/dist/declarations/src/index.d.ts +47 -0
- package/dist/declarations/src/interpreter.d.ts +147 -0
- package/{es → dist/declarations/src}/mapState.d.ts +0 -1
- package/dist/declarations/src/match.d.ts +5 -0
- package/dist/declarations/src/memo.d.ts +1 -0
- package/dist/declarations/src/model.d.ts +5 -0
- package/{lib → dist/declarations/src}/model.types.d.ts +6 -9
- package/dist/declarations/src/registry.d.ts +8 -0
- package/{es → dist/declarations/src}/schema.d.ts +0 -1
- package/dist/declarations/src/spawn.d.ts +2 -0
- package/dist/declarations/src/stateUtils.d.ts +85 -0
- package/{lib → dist/declarations/src}/typegenTypes.d.ts +16 -17
- package/dist/declarations/src/types.d.ts +1026 -0
- package/dist/declarations/src/utils.d.ts +56 -0
- package/{es/devTools.js → dist/index-20b364c4.esm.js} +18 -6
- package/dist/index-2a564d03.cjs.dev.js +64 -0
- package/dist/xstate.cjs.d.ts +1 -0
- package/dist/xstate.cjs.dev.js +217 -0
- package/dist/xstate.cjs.js +7 -0
- package/dist/xstate.cjs.prod.js +217 -0
- package/dist/xstate.esm.js +172 -0
- package/guards/dist/xstate-guards.cjs.d.ts +1 -0
- package/guards/dist/xstate-guards.cjs.dev.js +15 -0
- package/guards/dist/xstate-guards.cjs.js +7 -0
- package/guards/dist/xstate-guards.cjs.prod.js +15 -0
- package/guards/dist/xstate-guards.esm.js +2 -0
- package/guards/package.json +4 -0
- package/invoke/package.json +4 -0
- package/model/dist/xstate-model.cjs.d.ts +1 -0
- package/model/dist/xstate-model.cjs.dev.js +41 -0
- package/model/dist/xstate-model.cjs.js +7 -0
- package/model/dist/xstate-model.cjs.prod.js +41 -0
- package/model/dist/xstate-model.esm.js +37 -0
- package/model/package.json +4 -0
- package/package.json +21 -30
- package/dist/xstate.interpreter.js +0 -15
- package/dist/xstate.js +0 -15
- package/dist/xstate.web.js +0 -15
- package/es/Actor.d.ts +0 -25
- package/es/Actor.js +0 -99
- package/es/Machine.d.ts +0 -12
- package/es/Machine.js +0 -14
- package/es/SimulatedClock.d.ts +0 -17
- package/es/SimulatedClock.js +0 -81
- package/es/State.d.ts +0 -123
- package/es/State.js +0 -274
- package/es/StateNode.d.ts +0 -287
- package/es/StateNode.js +0 -1566
- package/es/_virtual/_tslib.js +0 -78
- package/es/actionTypes.js +0 -22
- package/es/actions.d.ts +0 -154
- package/es/actions.js +0 -520
- package/es/behaviors.d.ts +0 -37
- package/es/behaviors.js +0 -131
- package/es/constants.d.ts +0 -6
- package/es/constants.js +0 -6
- package/es/devTools.d.ts +0 -14
- package/es/each.d.ts +0 -4
- package/es/each.js +0 -13
- package/es/environment.js +0 -3
- package/es/index.d.ts +0 -22
- package/es/index.js +0 -23
- package/es/interpreter.d.ts +0 -209
- package/es/interpreter.js +0 -1402
- package/es/invoke.d.ts +0 -11
- package/es/invokeUtils.d.ts +0 -7
- package/es/invokeUtils.js +0 -40
- package/es/json.d.ts +0 -31
- package/es/json.js +0 -86
- package/es/mapState.js +0 -32
- package/es/match.d.ts +0 -9
- package/es/match.js +0 -34
- package/es/model.d.ts +0 -5
- package/es/model.js +0 -50
- package/es/model.types.d.ts +0 -56
- package/es/patterns.d.ts +0 -14
- package/es/patterns.js +0 -48
- package/es/registry.d.ts +0 -9
- package/es/registry.js +0 -19
- package/es/scheduler.d.ts +0 -17
- package/es/scheduler.js +0 -79
- package/es/schema.js +0 -6
- package/es/scxml.d.ts +0 -6
- package/es/serviceScope.d.ts +0 -4
- package/es/serviceScope.js +0 -16
- package/es/stateUtils.d.ts +0 -17
- package/es/stateUtils.js +0 -259
- package/es/typegenTypes.d.ts +0 -133
- package/es/types.d.ts +0 -1031
- package/es/types.js +0 -33
- package/es/utils.d.ts +0 -72
- package/es/utils.js +0 -626
- package/es/waitFor.d.ts +0 -32
- package/es/waitFor.js +0 -71
- package/lib/Actor.d.ts +0 -25
- package/lib/Actor.js +0 -108
- package/lib/Machine.d.ts +0 -12
- package/lib/Machine.js +0 -19
- package/lib/SimulatedClock.js +0 -85
- package/lib/State.d.ts +0 -123
- package/lib/State.js +0 -282
- package/lib/StateNode.d.ts +0 -287
- package/lib/StateNode.js +0 -1570
- package/lib/_virtual/_tslib.js +0 -85
- package/lib/actionTypes.d.ts +0 -20
- package/lib/actionTypes.js +0 -43
- package/lib/actions.d.ts +0 -154
- package/lib/actions.js +0 -552
- package/lib/behaviors.d.ts +0 -37
- package/lib/behaviors.js +0 -137
- package/lib/constants.d.ts +0 -6
- package/lib/constants.js +0 -13
- package/lib/each.d.ts +0 -4
- package/lib/each.js +0 -17
- package/lib/environment.d.ts +0 -2
- package/lib/environment.js +0 -7
- package/lib/index.d.ts +0 -22
- package/lib/index.js +0 -60
- package/lib/interpreter.d.ts +0 -209
- package/lib/interpreter.js +0 -1408
- package/lib/invoke.d.ts +0 -11
- package/lib/invoke.js +0 -20
- package/lib/invokeUtils.d.ts +0 -7
- package/lib/invokeUtils.js +0 -45
- package/lib/json.d.ts +0 -31
- package/lib/json.js +0 -94
- package/lib/mapState.d.ts +0 -4
- package/lib/mapState.js +0 -36
- package/lib/match.d.ts +0 -9
- package/lib/match.js +0 -38
- package/lib/model.d.ts +0 -5
- package/lib/model.js +0 -54
- package/lib/model.types.js +0 -2
- package/lib/patterns.d.ts +0 -14
- package/lib/patterns.js +0 -53
- package/lib/registry.d.ts +0 -9
- package/lib/registry.js +0 -23
- package/lib/scheduler.d.ts +0 -17
- package/lib/scheduler.js +0 -83
- package/lib/schema.d.ts +0 -3
- package/lib/schema.js +0 -11
- package/lib/scxml.d.ts +0 -6
- package/lib/scxml.js +0 -350
- package/lib/serviceScope.d.ts +0 -4
- package/lib/serviceScope.js +0 -21
- package/lib/stateUtils.d.ts +0 -17
- package/lib/stateUtils.js +0 -273
- package/lib/typegenTypes.js +0 -2
- package/lib/types.d.ts +0 -1031
- package/lib/types.js +0 -35
- package/lib/utils.d.ts +0 -72
- package/lib/utils.js +0 -673
- package/lib/waitFor.d.ts +0 -32
- package/lib/waitFor.js +0 -75
package/es/stateUtils.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { __values, __spreadArray, __read } from './_virtual/_tslib.js';
|
|
2
|
-
import { flatten } from './utils.js';
|
|
3
|
-
|
|
4
|
-
var isLeafNode = function (stateNode) {
|
|
5
|
-
return stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
6
|
-
};
|
|
7
|
-
function getChildren(stateNode) {
|
|
8
|
-
return Object.keys(stateNode.states).map(function (key) {
|
|
9
|
-
return stateNode.states[key];
|
|
10
|
-
}).filter(function (sn) {
|
|
11
|
-
return sn.type !== 'history';
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function getAllStateNodes(stateNode) {
|
|
15
|
-
var stateNodes = [stateNode];
|
|
16
|
-
|
|
17
|
-
if (isLeafNode(stateNode)) {
|
|
18
|
-
return stateNodes;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return stateNodes.concat(flatten(getChildren(stateNode).map(getAllStateNodes)));
|
|
22
|
-
}
|
|
23
|
-
function getConfiguration(prevStateNodes, stateNodes) {
|
|
24
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
25
|
-
|
|
26
|
-
var prevConfiguration = new Set(prevStateNodes);
|
|
27
|
-
var prevAdjList = getAdjList(prevConfiguration);
|
|
28
|
-
var configuration = new Set(stateNodes);
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
// add all ancestors
|
|
32
|
-
for (var configuration_1 = __values(configuration), configuration_1_1 = configuration_1.next(); !configuration_1_1.done; configuration_1_1 = configuration_1.next()) {
|
|
33
|
-
var s = configuration_1_1.value;
|
|
34
|
-
var m = s.parent;
|
|
35
|
-
|
|
36
|
-
while (m && !configuration.has(m)) {
|
|
37
|
-
configuration.add(m);
|
|
38
|
-
m = m.parent;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
} catch (e_1_1) {
|
|
42
|
-
e_1 = {
|
|
43
|
-
error: e_1_1
|
|
44
|
-
};
|
|
45
|
-
} finally {
|
|
46
|
-
try {
|
|
47
|
-
if (configuration_1_1 && !configuration_1_1.done && (_a = configuration_1.return)) _a.call(configuration_1);
|
|
48
|
-
} finally {
|
|
49
|
-
if (e_1) throw e_1.error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var adjList = getAdjList(configuration);
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
// add descendants
|
|
57
|
-
for (var configuration_2 = __values(configuration), configuration_2_1 = configuration_2.next(); !configuration_2_1.done; configuration_2_1 = configuration_2.next()) {
|
|
58
|
-
var s = configuration_2_1.value; // if previously active, add existing child nodes
|
|
59
|
-
|
|
60
|
-
if (s.type === 'compound' && (!adjList.get(s) || !adjList.get(s).length)) {
|
|
61
|
-
if (prevAdjList.get(s)) {
|
|
62
|
-
prevAdjList.get(s).forEach(function (sn) {
|
|
63
|
-
return configuration.add(sn);
|
|
64
|
-
});
|
|
65
|
-
} else {
|
|
66
|
-
s.initialStateNodes.forEach(function (sn) {
|
|
67
|
-
return configuration.add(sn);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
if (s.type === 'parallel') {
|
|
72
|
-
try {
|
|
73
|
-
for (var _e = (e_3 = void 0, __values(getChildren(s))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
74
|
-
var child = _f.value;
|
|
75
|
-
|
|
76
|
-
if (!configuration.has(child)) {
|
|
77
|
-
configuration.add(child);
|
|
78
|
-
|
|
79
|
-
if (prevAdjList.get(child)) {
|
|
80
|
-
prevAdjList.get(child).forEach(function (sn) {
|
|
81
|
-
return configuration.add(sn);
|
|
82
|
-
});
|
|
83
|
-
} else {
|
|
84
|
-
child.initialStateNodes.forEach(function (sn) {
|
|
85
|
-
return configuration.add(sn);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} catch (e_3_1) {
|
|
91
|
-
e_3 = {
|
|
92
|
-
error: e_3_1
|
|
93
|
-
};
|
|
94
|
-
} finally {
|
|
95
|
-
try {
|
|
96
|
-
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
97
|
-
} finally {
|
|
98
|
-
if (e_3) throw e_3.error;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
} catch (e_2_1) {
|
|
105
|
-
e_2 = {
|
|
106
|
-
error: e_2_1
|
|
107
|
-
};
|
|
108
|
-
} finally {
|
|
109
|
-
try {
|
|
110
|
-
if (configuration_2_1 && !configuration_2_1.done && (_b = configuration_2.return)) _b.call(configuration_2);
|
|
111
|
-
} finally {
|
|
112
|
-
if (e_2) throw e_2.error;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
// add all ancestors
|
|
118
|
-
for (var configuration_3 = __values(configuration), configuration_3_1 = configuration_3.next(); !configuration_3_1.done; configuration_3_1 = configuration_3.next()) {
|
|
119
|
-
var s = configuration_3_1.value;
|
|
120
|
-
var m = s.parent;
|
|
121
|
-
|
|
122
|
-
while (m && !configuration.has(m)) {
|
|
123
|
-
configuration.add(m);
|
|
124
|
-
m = m.parent;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} catch (e_4_1) {
|
|
128
|
-
e_4 = {
|
|
129
|
-
error: e_4_1
|
|
130
|
-
};
|
|
131
|
-
} finally {
|
|
132
|
-
try {
|
|
133
|
-
if (configuration_3_1 && !configuration_3_1.done && (_d = configuration_3.return)) _d.call(configuration_3);
|
|
134
|
-
} finally {
|
|
135
|
-
if (e_4) throw e_4.error;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return configuration;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function getValueFromAdj(baseNode, adjList) {
|
|
143
|
-
var childStateNodes = adjList.get(baseNode);
|
|
144
|
-
|
|
145
|
-
if (!childStateNodes) {
|
|
146
|
-
return {}; // todo: fix?
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (baseNode.type === 'compound') {
|
|
150
|
-
var childStateNode = childStateNodes[0];
|
|
151
|
-
|
|
152
|
-
if (childStateNode) {
|
|
153
|
-
if (isLeafNode(childStateNode)) {
|
|
154
|
-
return childStateNode.key;
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
return {};
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var stateValue = {};
|
|
162
|
-
childStateNodes.forEach(function (csn) {
|
|
163
|
-
stateValue[csn.key] = getValueFromAdj(csn, adjList);
|
|
164
|
-
});
|
|
165
|
-
return stateValue;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function getAdjList(configuration) {
|
|
169
|
-
var e_5, _a;
|
|
170
|
-
|
|
171
|
-
var adjList = new Map();
|
|
172
|
-
|
|
173
|
-
try {
|
|
174
|
-
for (var configuration_4 = __values(configuration), configuration_4_1 = configuration_4.next(); !configuration_4_1.done; configuration_4_1 = configuration_4.next()) {
|
|
175
|
-
var s = configuration_4_1.value;
|
|
176
|
-
|
|
177
|
-
if (!adjList.has(s)) {
|
|
178
|
-
adjList.set(s, []);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (s.parent) {
|
|
182
|
-
if (!adjList.has(s.parent)) {
|
|
183
|
-
adjList.set(s.parent, []);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
adjList.get(s.parent).push(s);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
} catch (e_5_1) {
|
|
190
|
-
e_5 = {
|
|
191
|
-
error: e_5_1
|
|
192
|
-
};
|
|
193
|
-
} finally {
|
|
194
|
-
try {
|
|
195
|
-
if (configuration_4_1 && !configuration_4_1.done && (_a = configuration_4.return)) _a.call(configuration_4);
|
|
196
|
-
} finally {
|
|
197
|
-
if (e_5) throw e_5.error;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return adjList;
|
|
202
|
-
}
|
|
203
|
-
function getValue(rootNode, configuration) {
|
|
204
|
-
var config = getConfiguration([rootNode], configuration);
|
|
205
|
-
return getValueFromAdj(rootNode, getAdjList(config));
|
|
206
|
-
}
|
|
207
|
-
function has(iterable, item) {
|
|
208
|
-
if (Array.isArray(iterable)) {
|
|
209
|
-
return iterable.some(function (member) {
|
|
210
|
-
return member === item;
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (iterable instanceof Set) {
|
|
215
|
-
return iterable.has(item);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return false; // TODO: fix
|
|
219
|
-
}
|
|
220
|
-
function nextEvents(configuration) {
|
|
221
|
-
return __spreadArray([], __read(new Set(flatten(__spreadArray([], __read(configuration.map(function (sn) {
|
|
222
|
-
return sn.ownEvents;
|
|
223
|
-
})), false)))), false);
|
|
224
|
-
}
|
|
225
|
-
function isInFinalState(configuration, stateNode) {
|
|
226
|
-
if (stateNode.type === 'compound') {
|
|
227
|
-
return getChildren(stateNode).some(function (s) {
|
|
228
|
-
return s.type === 'final' && has(configuration, s);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (stateNode.type === 'parallel') {
|
|
233
|
-
return getChildren(stateNode).every(function (sn) {
|
|
234
|
-
return isInFinalState(configuration, sn);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
function getMeta(configuration) {
|
|
241
|
-
if (configuration === void 0) {
|
|
242
|
-
configuration = [];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return configuration.reduce(function (acc, stateNode) {
|
|
246
|
-
if (stateNode.meta !== undefined) {
|
|
247
|
-
acc[stateNode.id] = stateNode.meta;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
return acc;
|
|
251
|
-
}, {});
|
|
252
|
-
}
|
|
253
|
-
function getTagsFromConfiguration(configuration) {
|
|
254
|
-
return new Set(flatten(configuration.map(function (sn) {
|
|
255
|
-
return sn.tags;
|
|
256
|
-
})));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export { getAdjList, getAllStateNodes, getChildren, getConfiguration, getMeta, getTagsFromConfiguration, getValue, has, isInFinalState, isLeafNode, nextEvents };
|
package/es/typegenTypes.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { BaseActionObject, EventObject, IndexByType, IsNever, Prop, Values, IsAny, ServiceMap, Cast } from './types';
|
|
2
|
-
export interface TypegenDisabled {
|
|
3
|
-
'@@xstate/typegen': false;
|
|
4
|
-
}
|
|
5
|
-
export interface TypegenEnabled {
|
|
6
|
-
'@@xstate/typegen': true;
|
|
7
|
-
}
|
|
8
|
-
export interface TypegenMeta extends TypegenEnabled {
|
|
9
|
-
/**
|
|
10
|
-
* Allows you to specify all the results of state.matches
|
|
11
|
-
*/
|
|
12
|
-
matchesStates: string | {};
|
|
13
|
-
/**
|
|
14
|
-
* Allows you to specify all tags used by the machine
|
|
15
|
-
*/
|
|
16
|
-
tags: string;
|
|
17
|
-
/**
|
|
18
|
-
* Allows you to specify all the missing implementations
|
|
19
|
-
* of the machine
|
|
20
|
-
*/
|
|
21
|
-
missingImplementations: {
|
|
22
|
-
actions: string;
|
|
23
|
-
delays: string;
|
|
24
|
-
guards: string;
|
|
25
|
-
services: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* A map for the internal events of the machine.
|
|
29
|
-
*
|
|
30
|
-
* key: 'done.invoke.myService'
|
|
31
|
-
* value: {
|
|
32
|
-
* type: 'done.invoke.myService';
|
|
33
|
-
* data: unknown;
|
|
34
|
-
* __tip: 'Declare the type in event types!';
|
|
35
|
-
* }
|
|
36
|
-
*/
|
|
37
|
-
internalEvents: {};
|
|
38
|
-
/**
|
|
39
|
-
* Maps the name of the service to the event type
|
|
40
|
-
* of the done.invoke action
|
|
41
|
-
*
|
|
42
|
-
* key: 'invokeSrc'
|
|
43
|
-
* value: 'done.invoke.invokeName'
|
|
44
|
-
*/
|
|
45
|
-
invokeSrcNameMap: Record<string, string>;
|
|
46
|
-
/**
|
|
47
|
-
* Keeps track of which events lead to which
|
|
48
|
-
* actions.
|
|
49
|
-
*
|
|
50
|
-
* Key: 'EVENT_NAME'
|
|
51
|
-
* Value: 'actionName' | 'otherActionName'
|
|
52
|
-
*/
|
|
53
|
-
eventsCausingActions: Record<string, string>;
|
|
54
|
-
/**
|
|
55
|
-
* Keeps track of which events lead to which
|
|
56
|
-
* delays.
|
|
57
|
-
*
|
|
58
|
-
* Key: 'EVENT_NAME'
|
|
59
|
-
* Value: 'delayName' | 'otherDelayName'
|
|
60
|
-
*/
|
|
61
|
-
eventsCausingDelays: Record<string, string>;
|
|
62
|
-
/**
|
|
63
|
-
* Keeps track of which events lead to which
|
|
64
|
-
* guards.
|
|
65
|
-
*
|
|
66
|
-
* Key: 'EVENT_NAME'
|
|
67
|
-
* Value: 'guardName' | 'otherGuardName'
|
|
68
|
-
*/
|
|
69
|
-
eventsCausingGuards: Record<string, string>;
|
|
70
|
-
/**
|
|
71
|
-
* Keeps track of which events lead to which
|
|
72
|
-
* services.
|
|
73
|
-
*
|
|
74
|
-
* Key: 'EVENT_NAME'
|
|
75
|
-
* Value: 'serviceName' | 'otherServiceName'
|
|
76
|
-
*/
|
|
77
|
-
eventsCausingServices: Record<string, string>;
|
|
78
|
-
}
|
|
79
|
-
export interface ResolvedTypegenMeta extends TypegenMeta {
|
|
80
|
-
resolved: TypegenMeta & {
|
|
81
|
-
indexedActions: Record<string, BaseActionObject>;
|
|
82
|
-
indexedEvents: Record<string, EventObject>;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
export declare type TypegenConstraint = TypegenEnabled | TypegenDisabled;
|
|
86
|
-
export declare type AreAllImplementationsAssumedToBeProvided<TResolvedTypesMeta, TMissingImplementations = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'missingImplementations'>> = IsAny<TResolvedTypesMeta> extends true ? true : TResolvedTypesMeta extends TypegenEnabled ? IsNever<Values<{
|
|
87
|
-
[K in keyof TMissingImplementations]: TMissingImplementations[K];
|
|
88
|
-
}>> extends true ? true : false : true;
|
|
89
|
-
interface AllImplementationsProvided {
|
|
90
|
-
missingImplementations: {
|
|
91
|
-
actions: never;
|
|
92
|
-
delays: never;
|
|
93
|
-
guards: never;
|
|
94
|
-
services: never;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
export interface MarkAllImplementationsAsProvided<TResolvedTypesMeta> {
|
|
98
|
-
'@@xstate/typegen': Prop<TResolvedTypesMeta, '@@xstate/typegen'>;
|
|
99
|
-
resolved: Prop<TResolvedTypesMeta, 'resolved'> & AllImplementationsProvided;
|
|
100
|
-
}
|
|
101
|
-
declare type GenerateServiceEvent<TServiceName, TEventType, TServiceMap extends ServiceMap> = TEventType extends any ? {
|
|
102
|
-
type: TEventType;
|
|
103
|
-
} & Prop<TServiceMap, TServiceName> : never;
|
|
104
|
-
declare type GenerateServiceEvents<TServiceMap extends ServiceMap, TInvokeSrcNameMap> = string extends keyof TServiceMap ? never : Cast<{
|
|
105
|
-
[K in keyof TInvokeSrcNameMap]: GenerateServiceEvent<K, TInvokeSrcNameMap[K], TServiceMap>;
|
|
106
|
-
}[keyof TInvokeSrcNameMap], EventObject>;
|
|
107
|
-
declare type MergeWithInternalEvents<TIndexedEvents, TInternalEvents> = TIndexedEvents & Pick<TInternalEvents, Exclude<keyof TInternalEvents, keyof TIndexedEvents>>;
|
|
108
|
-
declare type AllowAllEvents = {
|
|
109
|
-
eventsCausingActions: Record<string, string>;
|
|
110
|
-
eventsCausingDelays: Record<string, string>;
|
|
111
|
-
eventsCausingGuards: Record<string, string>;
|
|
112
|
-
eventsCausingServices: Record<string, string>;
|
|
113
|
-
};
|
|
114
|
-
export interface ResolveTypegenMeta<TTypesMeta extends TypegenConstraint, TEvent extends EventObject, TAction extends BaseActionObject, TServiceMap extends ServiceMap> {
|
|
115
|
-
'@@xstate/typegen': TTypesMeta['@@xstate/typegen'];
|
|
116
|
-
resolved: {
|
|
117
|
-
enabled: TTypesMeta & {
|
|
118
|
-
indexedActions: IndexByType<TAction>;
|
|
119
|
-
indexedEvents: MergeWithInternalEvents<IndexByType<(string extends TEvent['type'] ? never : TEvent) | GenerateServiceEvents<TServiceMap, Prop<TTypesMeta, 'invokeSrcNameMap'>>>, Prop<TTypesMeta, 'internalEvents'>>;
|
|
120
|
-
};
|
|
121
|
-
disabled: TypegenDisabled & AllImplementationsProvided & AllowAllEvents & {
|
|
122
|
-
indexedActions: IndexByType<TAction>;
|
|
123
|
-
indexedEvents: Record<string, TEvent> & {
|
|
124
|
-
__XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__: {
|
|
125
|
-
data: any;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
invokeSrcNameMap: Record<string, '__XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__'>;
|
|
129
|
-
};
|
|
130
|
-
}[IsNever<TTypesMeta> extends true ? 'disabled' : TTypesMeta extends TypegenEnabled ? 'enabled' : 'disabled'];
|
|
131
|
-
}
|
|
132
|
-
export {};
|
|
133
|
-
//# sourceMappingURL=typegenTypes.d.ts.map
|