xstate 5.32.5 → 5.33.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/dist/{StateMachine-6005ae8c.development.cjs.js → StateMachine-385ea6e2.cjs.js} +27 -18
- package/dist/{StateMachine-e8cf6f23.development.esm.js → StateMachine-521e1f66.esm.js} +27 -18
- package/dist/{StateMachine-1fa46288.cjs.js → StateMachine-d4a4d688.development.cjs.js} +33 -12
- package/dist/{StateMachine-5f345bba.esm.js → StateMachine-e5453556.development.esm.js} +33 -12
- package/dist/{assign-393c348f.development.esm.js → assign-08205f93.development.esm.js} +1 -1
- package/dist/{assign-7cba842c.development.cjs.js → assign-22c2f2aa.development.cjs.js} +1 -1
- package/dist/{assign-29f23f4d.esm.js → assign-b4b1f28f.esm.js} +1 -1
- package/dist/{assign-20143fe8.cjs.js → assign-b8c7b733.cjs.js} +1 -1
- package/dist/declarations/src/StateMachine.d.ts +17 -15
- package/dist/declarations/src/StateNode.d.ts +18 -18
- package/dist/declarations/src/createMachine.d.ts +4 -4
- package/dist/declarations/src/setup.d.ts +8 -8
- package/dist/declarations/src/stateUtils.d.ts +2 -2
- package/dist/declarations/src/types.d.ts +85 -75
- package/dist/{log-79409d72.esm.js → log-64b4a2b9.esm.js} +6 -5
- package/dist/{log-92e88543.cjs.js → log-aca8da4c.cjs.js} +6 -5
- package/dist/{log-e4ef3ed1.development.esm.js → log-ccf9f9e1.development.esm.js} +6 -5
- package/dist/{log-63926232.development.cjs.js → log-dc444aec.development.cjs.js} +6 -5
- package/dist/{raise-0d6481d1.development.esm.js → raise-4d6182c1.development.esm.js} +11 -5
- package/dist/{raise-dd1ee3d1.development.cjs.js → raise-6dbf7d60.development.cjs.js} +10 -4
- package/dist/{raise-5fb0c8ca.esm.js → raise-97446fd4.esm.js} +10 -4
- package/dist/{raise-16ff4f94.cjs.js → raise-ad56cf14.cjs.js} +9 -3
- package/dist/xstate-actions.cjs.js +3 -3
- package/dist/xstate-actions.development.cjs.js +3 -3
- package/dist/xstate-actions.development.esm.js +3 -3
- package/dist/xstate-actions.esm.js +3 -3
- package/dist/xstate-actions.umd.min.js.map +1 -1
- package/dist/xstate-actors.cjs.js +1 -1
- package/dist/xstate-actors.development.cjs.js +1 -1
- package/dist/xstate-actors.development.esm.js +1 -1
- package/dist/xstate-actors.esm.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +4 -4
- package/dist/xstate-graph.development.cjs.js +4 -4
- package/dist/xstate-graph.development.esm.js +4 -4
- package/dist/xstate-graph.esm.js +4 -4
- package/dist/xstate-graph.umd.min.js +1 -1
- package/dist/xstate-graph.umd.min.js.map +1 -1
- package/dist/xstate-guards.cjs.js +1 -1
- package/dist/xstate-guards.development.cjs.js +1 -1
- package/dist/xstate-guards.development.esm.js +1 -1
- package/dist/xstate-guards.esm.js +1 -1
- package/dist/xstate-guards.umd.min.js.map +1 -1
- package/dist/xstate.cjs.js +9 -10
- package/dist/xstate.development.cjs.js +9 -10
- package/dist/xstate.development.esm.js +13 -14
- package/dist/xstate.esm.js +13 -14
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dist_xstateGuards = require('./raise-
|
|
4
|
-
var assign = require('./assign-
|
|
3
|
+
var dist_xstateGuards = require('./raise-ad56cf14.cjs.js');
|
|
4
|
+
var assign = require('./assign-b8c7b733.cjs.js');
|
|
5
5
|
|
|
6
6
|
const cache = new WeakMap();
|
|
7
7
|
function memo(object, key, fn) {
|
|
@@ -149,17 +149,19 @@ class StateNode {
|
|
|
149
149
|
actions: this.initial.actions.map(toSerializableAction),
|
|
150
150
|
eventType: null,
|
|
151
151
|
reenter: false,
|
|
152
|
+
meta: this.initial.meta,
|
|
153
|
+
description: this.initial.description,
|
|
152
154
|
toJSON: () => ({
|
|
153
155
|
target: this.initial.target.map(t => `#${t.id}`),
|
|
154
156
|
source: `#${this.id}`,
|
|
155
157
|
actions: this.initial.actions.map(toSerializableAction),
|
|
156
|
-
eventType: null
|
|
158
|
+
eventType: null,
|
|
159
|
+
meta: this.initial.meta,
|
|
160
|
+
description: this.initial.description
|
|
157
161
|
})
|
|
158
162
|
} : undefined,
|
|
159
163
|
history: this.history,
|
|
160
|
-
states: dist_xstateGuards.mapValues(this.states, state =>
|
|
161
|
-
return state.definition;
|
|
162
|
-
}),
|
|
164
|
+
states: dist_xstateGuards.mapValues(this.states, state => state.definition),
|
|
163
165
|
on: this.on,
|
|
164
166
|
transitions: [...this.transitions.values()].flat().map(t => ({
|
|
165
167
|
...t,
|
|
@@ -337,9 +339,6 @@ class StateMachine {
|
|
|
337
339
|
dist_xstateGuards.formatRouteTransitions(this.root);
|
|
338
340
|
this.states = this.root.states; // TODO: remove!
|
|
339
341
|
this.events = this.root.events;
|
|
340
|
-
if (!('output' in this.root) && Object.values(this.states).some(state => state.type === 'final' && 'output' in state)) {
|
|
341
|
-
console.warn('Missing `machine.output` declaration (top-level final state with output detected)');
|
|
342
|
-
}
|
|
343
342
|
}
|
|
344
343
|
|
|
345
344
|
/**
|
|
@@ -452,12 +451,25 @@ class StateMachine {
|
|
|
452
451
|
getInitialSnapshot(actorScope, input) {
|
|
453
452
|
const initEvent = dist_xstateGuards.createInitEvent(input); // TODO: fix;
|
|
454
453
|
const internalQueue = [];
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
454
|
+
let snapshot = dist_xstateGuards.createMachineSnapshot({
|
|
455
|
+
context: typeof this.config.context !== 'function' && this.config.context ? this.config.context : {},
|
|
456
|
+
_nodes: [this.root],
|
|
457
|
+
children: {},
|
|
458
|
+
status: 'active'
|
|
459
|
+
}, this);
|
|
460
|
+
try {
|
|
461
|
+
snapshot = this._getPreInitialState(actorScope, initEvent, internalQueue);
|
|
462
|
+
const [nextState] = dist_xstateGuards.initialMicrostep(this.root, snapshot, actorScope, initEvent, internalQueue);
|
|
463
|
+
const {
|
|
464
|
+
snapshot: macroState
|
|
465
|
+
} = dist_xstateGuards.macrostep(nextState, initEvent, actorScope, internalQueue);
|
|
466
|
+
return macroState;
|
|
467
|
+
} catch (error) {
|
|
468
|
+
return dist_xstateGuards.cloneMachineSnapshot(snapshot, {
|
|
469
|
+
status: 'error',
|
|
470
|
+
error
|
|
471
|
+
});
|
|
472
|
+
}
|
|
461
473
|
}
|
|
462
474
|
start(snapshot) {
|
|
463
475
|
Object.values(snapshot.children).forEach(child => {
|
|
@@ -513,9 +525,6 @@ class StateMachine {
|
|
|
513
525
|
try {
|
|
514
526
|
return root.machine.getStateNodeById(referenced.id);
|
|
515
527
|
} catch {
|
|
516
|
-
{
|
|
517
|
-
console.warn(`Could not resolve StateNode for id: ${referenced.id}`);
|
|
518
|
-
}
|
|
519
528
|
}
|
|
520
529
|
}
|
|
521
530
|
function reviveHistoryValue(root, historyValue) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER, z as mapValues, t as toArray, B as formatTransitions, C as toTransitionConfigArray, D as formatTransition, N as NULL_EVENT, E as evaluateGuard, F as createInvokeId, G as getDelayedTransitions, H as formatInitialTransition, I as getCandidates, J as formatRouteTransitions, K as resolveStateValue, L as getAllStateNodes, q as getStateNodes, M as createMachineSnapshot, O as isInFinalState, e as macrostep, P as transitionNode, Q as resolveActionsAndContext, f as createInitEvent, g as initialMicrostep, R as
|
|
2
|
-
import { a as assign } from './assign-
|
|
1
|
+
import { S as STATE_DELIMITER, z as mapValues, t as toArray, B as formatTransitions, C as toTransitionConfigArray, D as formatTransition, N as NULL_EVENT, E as evaluateGuard, F as createInvokeId, G as getDelayedTransitions, H as formatInitialTransition, I as getCandidates, J as formatRouteTransitions, K as resolveStateValue, L as getAllStateNodes, q as getStateNodes, M as createMachineSnapshot, O as isInFinalState, e as macrostep, P as transitionNode, Q as resolveActionsAndContext, f as createInitEvent, g as initialMicrostep, R as cloneMachineSnapshot, T as toStatePath, U as isStateId, V as getStateNodeByPath, W as getPersistedSnapshot, Y as resolveReferencedActor, c as createActor, $ as $$ACTOR_TYPE } from './raise-97446fd4.esm.js';
|
|
2
|
+
import { a as assign } from './assign-b4b1f28f.esm.js';
|
|
3
3
|
|
|
4
4
|
const cache = new WeakMap();
|
|
5
5
|
function memo(object, key, fn) {
|
|
@@ -147,17 +147,19 @@ class StateNode {
|
|
|
147
147
|
actions: this.initial.actions.map(toSerializableAction),
|
|
148
148
|
eventType: null,
|
|
149
149
|
reenter: false,
|
|
150
|
+
meta: this.initial.meta,
|
|
151
|
+
description: this.initial.description,
|
|
150
152
|
toJSON: () => ({
|
|
151
153
|
target: this.initial.target.map(t => `#${t.id}`),
|
|
152
154
|
source: `#${this.id}`,
|
|
153
155
|
actions: this.initial.actions.map(toSerializableAction),
|
|
154
|
-
eventType: null
|
|
156
|
+
eventType: null,
|
|
157
|
+
meta: this.initial.meta,
|
|
158
|
+
description: this.initial.description
|
|
155
159
|
})
|
|
156
160
|
} : undefined,
|
|
157
161
|
history: this.history,
|
|
158
|
-
states: mapValues(this.states, state =>
|
|
159
|
-
return state.definition;
|
|
160
|
-
}),
|
|
162
|
+
states: mapValues(this.states, state => state.definition),
|
|
161
163
|
on: this.on,
|
|
162
164
|
transitions: [...this.transitions.values()].flat().map(t => ({
|
|
163
165
|
...t,
|
|
@@ -335,9 +337,6 @@ class StateMachine {
|
|
|
335
337
|
formatRouteTransitions(this.root);
|
|
336
338
|
this.states = this.root.states; // TODO: remove!
|
|
337
339
|
this.events = this.root.events;
|
|
338
|
-
if (!('output' in this.root) && Object.values(this.states).some(state => state.type === 'final' && 'output' in state)) {
|
|
339
|
-
console.warn('Missing `machine.output` declaration (top-level final state with output detected)');
|
|
340
|
-
}
|
|
341
340
|
}
|
|
342
341
|
|
|
343
342
|
/**
|
|
@@ -450,12 +449,25 @@ class StateMachine {
|
|
|
450
449
|
getInitialSnapshot(actorScope, input) {
|
|
451
450
|
const initEvent = createInitEvent(input); // TODO: fix;
|
|
452
451
|
const internalQueue = [];
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
452
|
+
let snapshot = createMachineSnapshot({
|
|
453
|
+
context: typeof this.config.context !== 'function' && this.config.context ? this.config.context : {},
|
|
454
|
+
_nodes: [this.root],
|
|
455
|
+
children: {},
|
|
456
|
+
status: 'active'
|
|
457
|
+
}, this);
|
|
458
|
+
try {
|
|
459
|
+
snapshot = this._getPreInitialState(actorScope, initEvent, internalQueue);
|
|
460
|
+
const [nextState] = initialMicrostep(this.root, snapshot, actorScope, initEvent, internalQueue);
|
|
461
|
+
const {
|
|
462
|
+
snapshot: macroState
|
|
463
|
+
} = macrostep(nextState, initEvent, actorScope, internalQueue);
|
|
464
|
+
return macroState;
|
|
465
|
+
} catch (error) {
|
|
466
|
+
return cloneMachineSnapshot(snapshot, {
|
|
467
|
+
status: 'error',
|
|
468
|
+
error
|
|
469
|
+
});
|
|
470
|
+
}
|
|
459
471
|
}
|
|
460
472
|
start(snapshot) {
|
|
461
473
|
Object.values(snapshot.children).forEach(child => {
|
|
@@ -511,9 +523,6 @@ class StateMachine {
|
|
|
511
523
|
try {
|
|
512
524
|
return root.machine.getStateNodeById(referenced.id);
|
|
513
525
|
} catch {
|
|
514
|
-
{
|
|
515
|
-
console.warn(`Could not resolve StateNode for id: ${referenced.id}`);
|
|
516
|
-
}
|
|
517
526
|
}
|
|
518
527
|
}
|
|
519
528
|
function reviveHistoryValue(root, historyValue) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dist_xstateGuards = require('./raise-
|
|
4
|
-
var assign = require('./assign-
|
|
3
|
+
var dist_xstateGuards = require('./raise-6dbf7d60.development.cjs.js');
|
|
4
|
+
var assign = require('./assign-22c2f2aa.development.cjs.js');
|
|
5
5
|
|
|
6
6
|
const cache = new WeakMap();
|
|
7
7
|
function memo(object, key, fn) {
|
|
@@ -149,17 +149,19 @@ class StateNode {
|
|
|
149
149
|
actions: this.initial.actions.map(toSerializableAction),
|
|
150
150
|
eventType: null,
|
|
151
151
|
reenter: false,
|
|
152
|
+
meta: this.initial.meta,
|
|
153
|
+
description: this.initial.description,
|
|
152
154
|
toJSON: () => ({
|
|
153
155
|
target: this.initial.target.map(t => `#${t.id}`),
|
|
154
156
|
source: `#${this.id}`,
|
|
155
157
|
actions: this.initial.actions.map(toSerializableAction),
|
|
156
|
-
eventType: null
|
|
158
|
+
eventType: null,
|
|
159
|
+
meta: this.initial.meta,
|
|
160
|
+
description: this.initial.description
|
|
157
161
|
})
|
|
158
162
|
} : undefined,
|
|
159
163
|
history: this.history,
|
|
160
|
-
states: dist_xstateGuards.mapValues(this.states, state =>
|
|
161
|
-
return state.definition;
|
|
162
|
-
}),
|
|
164
|
+
states: dist_xstateGuards.mapValues(this.states, state => state.definition),
|
|
163
165
|
on: this.on,
|
|
164
166
|
transitions: [...this.transitions.values()].flat().map(t => ({
|
|
165
167
|
...t,
|
|
@@ -337,6 +339,9 @@ class StateMachine {
|
|
|
337
339
|
dist_xstateGuards.formatRouteTransitions(this.root);
|
|
338
340
|
this.states = this.root.states; // TODO: remove!
|
|
339
341
|
this.events = this.root.events;
|
|
342
|
+
if (!('output' in this.root) && Object.values(this.states).some(state => state.type === 'final' && 'output' in state)) {
|
|
343
|
+
console.warn('Missing `machine.output` declaration (top-level final state with output detected)');
|
|
344
|
+
}
|
|
340
345
|
}
|
|
341
346
|
|
|
342
347
|
/**
|
|
@@ -449,12 +454,25 @@ class StateMachine {
|
|
|
449
454
|
getInitialSnapshot(actorScope, input) {
|
|
450
455
|
const initEvent = dist_xstateGuards.createInitEvent(input); // TODO: fix;
|
|
451
456
|
const internalQueue = [];
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
457
|
+
let snapshot = dist_xstateGuards.createMachineSnapshot({
|
|
458
|
+
context: typeof this.config.context !== 'function' && this.config.context ? this.config.context : {},
|
|
459
|
+
_nodes: [this.root],
|
|
460
|
+
children: {},
|
|
461
|
+
status: 'active'
|
|
462
|
+
}, this);
|
|
463
|
+
try {
|
|
464
|
+
snapshot = this._getPreInitialState(actorScope, initEvent, internalQueue);
|
|
465
|
+
const [nextState] = dist_xstateGuards.initialMicrostep(this.root, snapshot, actorScope, initEvent, internalQueue);
|
|
466
|
+
const {
|
|
467
|
+
snapshot: macroState
|
|
468
|
+
} = dist_xstateGuards.macrostep(nextState, initEvent, actorScope, internalQueue);
|
|
469
|
+
return macroState;
|
|
470
|
+
} catch (error) {
|
|
471
|
+
return dist_xstateGuards.cloneMachineSnapshot(snapshot, {
|
|
472
|
+
status: 'error',
|
|
473
|
+
error
|
|
474
|
+
});
|
|
475
|
+
}
|
|
458
476
|
}
|
|
459
477
|
start(snapshot) {
|
|
460
478
|
Object.values(snapshot.children).forEach(child => {
|
|
@@ -510,6 +528,9 @@ class StateMachine {
|
|
|
510
528
|
try {
|
|
511
529
|
return root.machine.getStateNodeById(referenced.id);
|
|
512
530
|
} catch {
|
|
531
|
+
{
|
|
532
|
+
console.warn(`Could not resolve StateNode for id: ${referenced.id}`);
|
|
533
|
+
}
|
|
513
534
|
}
|
|
514
535
|
}
|
|
515
536
|
function reviveHistoryValue(root, historyValue) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER, z as mapValues, t as toArray, B as formatTransitions, C as toTransitionConfigArray, D as formatTransition, N as NULL_EVENT, E as evaluateGuard, F as createInvokeId, G as getDelayedTransitions, H as formatInitialTransition, I as getCandidates, J as formatRouteTransitions, K as resolveStateValue, L as getAllStateNodes, q as getStateNodes, M as createMachineSnapshot, O as isInFinalState, e as macrostep, P as transitionNode, Q as resolveActionsAndContext, f as createInitEvent, g as initialMicrostep, R as
|
|
2
|
-
import { a as assign } from './assign-
|
|
1
|
+
import { S as STATE_DELIMITER, z as mapValues, t as toArray, B as formatTransitions, C as toTransitionConfigArray, D as formatTransition, N as NULL_EVENT, E as evaluateGuard, F as createInvokeId, G as getDelayedTransitions, H as formatInitialTransition, I as getCandidates, J as formatRouteTransitions, K as resolveStateValue, L as getAllStateNodes, q as getStateNodes, M as createMachineSnapshot, O as isInFinalState, e as macrostep, P as transitionNode, Q as resolveActionsAndContext, f as createInitEvent, g as initialMicrostep, R as cloneMachineSnapshot, T as toStatePath, U as isStateId, V as getStateNodeByPath, W as getPersistedSnapshot, Y as resolveReferencedActor, c as createActor, $ as $$ACTOR_TYPE } from './raise-4d6182c1.development.esm.js';
|
|
2
|
+
import { a as assign } from './assign-08205f93.development.esm.js';
|
|
3
3
|
|
|
4
4
|
const cache = new WeakMap();
|
|
5
5
|
function memo(object, key, fn) {
|
|
@@ -147,17 +147,19 @@ class StateNode {
|
|
|
147
147
|
actions: this.initial.actions.map(toSerializableAction),
|
|
148
148
|
eventType: null,
|
|
149
149
|
reenter: false,
|
|
150
|
+
meta: this.initial.meta,
|
|
151
|
+
description: this.initial.description,
|
|
150
152
|
toJSON: () => ({
|
|
151
153
|
target: this.initial.target.map(t => `#${t.id}`),
|
|
152
154
|
source: `#${this.id}`,
|
|
153
155
|
actions: this.initial.actions.map(toSerializableAction),
|
|
154
|
-
eventType: null
|
|
156
|
+
eventType: null,
|
|
157
|
+
meta: this.initial.meta,
|
|
158
|
+
description: this.initial.description
|
|
155
159
|
})
|
|
156
160
|
} : undefined,
|
|
157
161
|
history: this.history,
|
|
158
|
-
states: mapValues(this.states, state =>
|
|
159
|
-
return state.definition;
|
|
160
|
-
}),
|
|
162
|
+
states: mapValues(this.states, state => state.definition),
|
|
161
163
|
on: this.on,
|
|
162
164
|
transitions: [...this.transitions.values()].flat().map(t => ({
|
|
163
165
|
...t,
|
|
@@ -335,6 +337,9 @@ class StateMachine {
|
|
|
335
337
|
formatRouteTransitions(this.root);
|
|
336
338
|
this.states = this.root.states; // TODO: remove!
|
|
337
339
|
this.events = this.root.events;
|
|
340
|
+
if (!('output' in this.root) && Object.values(this.states).some(state => state.type === 'final' && 'output' in state)) {
|
|
341
|
+
console.warn('Missing `machine.output` declaration (top-level final state with output detected)');
|
|
342
|
+
}
|
|
338
343
|
}
|
|
339
344
|
|
|
340
345
|
/**
|
|
@@ -447,12 +452,25 @@ class StateMachine {
|
|
|
447
452
|
getInitialSnapshot(actorScope, input) {
|
|
448
453
|
const initEvent = createInitEvent(input); // TODO: fix;
|
|
449
454
|
const internalQueue = [];
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
455
|
+
let snapshot = createMachineSnapshot({
|
|
456
|
+
context: typeof this.config.context !== 'function' && this.config.context ? this.config.context : {},
|
|
457
|
+
_nodes: [this.root],
|
|
458
|
+
children: {},
|
|
459
|
+
status: 'active'
|
|
460
|
+
}, this);
|
|
461
|
+
try {
|
|
462
|
+
snapshot = this._getPreInitialState(actorScope, initEvent, internalQueue);
|
|
463
|
+
const [nextState] = initialMicrostep(this.root, snapshot, actorScope, initEvent, internalQueue);
|
|
464
|
+
const {
|
|
465
|
+
snapshot: macroState
|
|
466
|
+
} = macrostep(nextState, initEvent, actorScope, internalQueue);
|
|
467
|
+
return macroState;
|
|
468
|
+
} catch (error) {
|
|
469
|
+
return cloneMachineSnapshot(snapshot, {
|
|
470
|
+
status: 'error',
|
|
471
|
+
error
|
|
472
|
+
});
|
|
473
|
+
}
|
|
456
474
|
}
|
|
457
475
|
start(snapshot) {
|
|
458
476
|
Object.values(snapshot.children).forEach(child => {
|
|
@@ -508,6 +526,9 @@ class StateMachine {
|
|
|
508
526
|
try {
|
|
509
527
|
return root.machine.getStateNodeById(referenced.id);
|
|
510
528
|
} catch {
|
|
529
|
+
{
|
|
530
|
+
console.warn(`Could not resolve StateNode for id: ${referenced.id}`);
|
|
531
|
+
}
|
|
511
532
|
}
|
|
512
533
|
}
|
|
513
534
|
function reviveHistoryValue(root, historyValue) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a1 as ProcessingStatus, Y as resolveReferencedActor, c as createActor, R as cloneMachineSnapshot, Z as executingCustomAction } from './raise-4d6182c1.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a0 as ProcessingStatus, Y as resolveReferencedActor, c as createActor, R as cloneMachineSnapshot } from './raise-97446fd4.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -2,9 +2,10 @@ import { MachineSnapshot } from "./State.js";
|
|
|
2
2
|
import { StateNode } from "./StateNode.js";
|
|
3
3
|
import { AnyActorSystem } from "./system.js";
|
|
4
4
|
import type { ActorLogic, ActorScope, AnyActorRef, AnyActorScope, DoNotInfer, Equals, EventDescriptor, EventObject, HistoryValue, InternalMachineImplementations, MachineConfig, MachineContext, MachineImplementationsSimplified, MachineOptions, MetaObject, ParameterizedObject, ProvidedActor, Snapshot, StateMachineDefinition, StateValue, TransitionDefinition, ResolvedStateMachineTypes, StateSchema, SnapshotStatus } from "./types.js";
|
|
5
|
-
export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject,
|
|
5
|
+
export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TStateMeta extends MetaObject, TStateSchema extends StateSchema, TTransitionMeta extends MetaObject = TStateMeta> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, TEvent, TInput, AnyActorSystem, TEmitted> {
|
|
6
6
|
/** The raw config used to create the machine. */
|
|
7
7
|
config: MachineConfig<TContext, TEvent, any, any, any, any, any, any, TOutput, any, // TEmitted
|
|
8
|
+
any, // TStateMeta
|
|
8
9
|
any> & {
|
|
9
10
|
schemas?: unknown;
|
|
10
11
|
};
|
|
@@ -14,13 +15,14 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
14
15
|
implementations: MachineImplementationsSimplified<TContext, TEvent>;
|
|
15
16
|
/** Runtime options for machine execution. */
|
|
16
17
|
options: MachineOptions;
|
|
17
|
-
root: StateNode<TContext, TEvent>;
|
|
18
|
+
root: StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
18
19
|
id: string;
|
|
19
|
-
states: StateNode<TContext, TEvent>['states'];
|
|
20
|
+
states: StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>['states'];
|
|
20
21
|
events: Array<EventDescriptor<TEvent>>;
|
|
21
22
|
constructor(
|
|
22
23
|
/** The raw config used to create the machine. */
|
|
23
24
|
config: MachineConfig<TContext, TEvent, any, any, any, any, any, any, TOutput, any, // TEmitted
|
|
25
|
+
any, // TStateMeta
|
|
24
26
|
any> & {
|
|
25
27
|
schemas?: unknown;
|
|
26
28
|
}, implementations?: MachineImplementationsSimplified<TContext, TEvent>);
|
|
@@ -31,7 +33,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
31
33
|
* recursively merge with the existing options.
|
|
32
34
|
* @returns A new `StateMachine` instance with the provided implementations.
|
|
33
35
|
*/
|
|
34
|
-
provide(implementations: InternalMachineImplementations<ResolvedStateMachineTypes<TContext, DoNotInfer<TEvent>, TActor, TAction, TGuard, TDelay, TTag, TEmitted>>): StateMachine<TContext, TEvent, TChildren, TActor, TAction, TGuard, TDelay, TStateValue, TTag, TInput, TOutput, TEmitted,
|
|
36
|
+
provide(implementations: InternalMachineImplementations<ResolvedStateMachineTypes<TContext, DoNotInfer<TEvent>, TActor, TAction, TGuard, TDelay, TTag, TEmitted>>): StateMachine<TContext, TEvent, TChildren, TActor, TAction, TGuard, TDelay, TStateValue, TTag, TInput, TOutput, TEmitted, TStateMeta, TStateSchema, TTransitionMeta>;
|
|
35
37
|
resolveState(config: {
|
|
36
38
|
value: StateValue;
|
|
37
39
|
context?: TContext;
|
|
@@ -41,7 +43,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
41
43
|
error?: unknown;
|
|
42
44
|
} & (Equals<TContext, MachineContext> extends false ? {
|
|
43
45
|
context: unknown;
|
|
44
|
-
} : {})): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
46
|
+
} : {})): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>;
|
|
45
47
|
/**
|
|
46
48
|
* Determines the next snapshot given the current `snapshot` and received
|
|
47
49
|
* `event`. Calculates a full macrostep from all microsteps.
|
|
@@ -49,7 +51,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
49
51
|
* @param snapshot The current snapshot
|
|
50
52
|
* @param event The received event
|
|
51
53
|
*/
|
|
52
|
-
transition(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
54
|
+
transition(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, event: TEvent, actorScope: ActorScope<typeof snapshot, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>;
|
|
53
55
|
/**
|
|
54
56
|
* Determines the next state given the current `state` and `event`. Calculates
|
|
55
57
|
* a microstep.
|
|
@@ -57,17 +59,17 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
57
59
|
* @param state The current state
|
|
58
60
|
* @param event The received event
|
|
59
61
|
*/
|
|
60
|
-
microstep(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
61
|
-
getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
62
|
+
microstep(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, event: TEvent, actorScope: AnyActorScope): Array<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>>;
|
|
63
|
+
getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, event: TEvent): Array<TransitionDefinition<TContext, TEvent, TTransitionMeta>>;
|
|
62
64
|
/**
|
|
63
65
|
* Returns the initial `State` instance, with reference to `self` as an
|
|
64
66
|
* `ActorRef`.
|
|
65
67
|
*/
|
|
66
|
-
getInitialSnapshot(actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
67
|
-
start(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
68
|
-
getStateNodeById(stateId: string): StateNode<TContext, TEvent>;
|
|
69
|
-
get definition(): StateMachineDefinition<TContext, TEvent>;
|
|
70
|
-
toJSON(): StateMachineDefinition<TContext, TEvent>;
|
|
71
|
-
getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
72
|
-
restoreSnapshot(snapshot: Snapshot<unknown>, _actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput,
|
|
68
|
+
getInitialSnapshot(actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, TEvent, AnyActorSystem, TEmitted>, input?: TInput): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>;
|
|
69
|
+
start(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>): void;
|
|
70
|
+
getStateNodeById(stateId: string): StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
71
|
+
get definition(): StateMachineDefinition<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
72
|
+
toJSON(): StateMachineDefinition<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
73
|
+
getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, options?: unknown): Snapshot<unknown>;
|
|
74
|
+
restoreSnapshot(snapshot: Snapshot<unknown>, _actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TStateMeta, TStateSchema>;
|
|
73
75
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { StateMachine } from "./StateMachine.js";
|
|
2
|
-
import type { DelayedTransitionDefinition, EventObject, InitialTransitionDefinition, InvokeDefinition, MachineContext, Mapper, StateNodeConfig, StateNodeDefinition, StateNodesConfig, TransitionDefinition, TransitionDefinitionMap, TODO, UnknownAction, ParameterizedObject, AnyStateMachine, ProvidedActor, NonReducibleUnknown, EventDescriptor } from "./types.js";
|
|
3
|
-
interface StateNodeOptions<TContext extends MachineContext, TEvent extends EventObject> {
|
|
2
|
+
import type { DelayedTransitionDefinition, EventObject, InitialTransitionDefinition, InvokeDefinition, MachineContext, Mapper, StateNodeConfig, StateNodeDefinition, StateNodesConfig, TransitionDefinition, TransitionDefinitionMap, TODO, UnknownAction, ParameterizedObject, AnyStateMachine, ProvidedActor, NonReducibleUnknown, EventDescriptor, MetaObject } from "./types.js";
|
|
3
|
+
interface StateNodeOptions<TContext extends MachineContext, TEvent extends EventObject, TStateMeta extends MetaObject, TTransitionMeta extends MetaObject> {
|
|
4
4
|
_key: string;
|
|
5
|
-
_parent?: StateNode<TContext, TEvent>;
|
|
5
|
+
_parent?: StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
6
6
|
_machine: AnyStateMachine;
|
|
7
7
|
}
|
|
8
|
-
export declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject> {
|
|
8
|
+
export declare class StateNode<TContext extends MachineContext = MachineContext, TEvent extends EventObject = EventObject, TStateMeta extends MetaObject = MetaObject, TTransitionMeta extends MetaObject = TStateMeta> {
|
|
9
9
|
/** The raw config used to create the machine. */
|
|
10
10
|
config: StateNodeConfig<TContext, TEvent, TODO, // actors
|
|
11
11
|
TODO, // actions
|
|
@@ -14,7 +14,7 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
14
14
|
TODO, // tags
|
|
15
15
|
TODO, // output
|
|
16
16
|
TODO, // emitted
|
|
17
|
-
|
|
17
|
+
TStateMeta, TTransitionMeta>;
|
|
18
18
|
/**
|
|
19
19
|
* The relative key of the state node, which represents its location in the
|
|
20
20
|
* overall state value.
|
|
@@ -35,7 +35,7 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
35
35
|
/** The string path from the root machine node to this node. */
|
|
36
36
|
path: string[];
|
|
37
37
|
/** The child state nodes. */
|
|
38
|
-
states: StateNodesConfig<TContext, TEvent>;
|
|
38
|
+
states: StateNodesConfig<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
39
39
|
/**
|
|
40
40
|
* The type of history on this state node. Can be:
|
|
41
41
|
*
|
|
@@ -48,7 +48,7 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
48
48
|
/** The action(s) to be executed upon exiting the state node. */
|
|
49
49
|
exit: UnknownAction[];
|
|
50
50
|
/** The parent state node. */
|
|
51
|
-
parent?: StateNode<TContext, TEvent>;
|
|
51
|
+
parent?: StateNode<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
52
52
|
/** The root machine node. */
|
|
53
53
|
machine: StateMachine<TContext, TEvent, any, // children
|
|
54
54
|
any, // actor
|
|
@@ -60,13 +60,13 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
60
60
|
any, // input
|
|
61
61
|
any, // output
|
|
62
62
|
any, // emitted
|
|
63
|
-
any, //
|
|
64
|
-
|
|
63
|
+
TStateMeta, any, // state schema
|
|
64
|
+
TTransitionMeta>;
|
|
65
65
|
/**
|
|
66
66
|
* The meta data associated with this state node, which will be returned in
|
|
67
67
|
* State instances.
|
|
68
68
|
*/
|
|
69
|
-
meta?:
|
|
69
|
+
meta?: TStateMeta;
|
|
70
70
|
/**
|
|
71
71
|
* The output data sent with the "xstate.done.state._id_" event if this is a
|
|
72
72
|
* final state node.
|
|
@@ -79,8 +79,8 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
79
79
|
order: number;
|
|
80
80
|
description?: string;
|
|
81
81
|
tags: string[];
|
|
82
|
-
transitions: Map<string, TransitionDefinition<TContext, TEvent>[]>;
|
|
83
|
-
always?: Array<TransitionDefinition<TContext, TEvent>>;
|
|
82
|
+
transitions: Map<string, TransitionDefinition<TContext, TEvent, TTransitionMeta>[]>;
|
|
83
|
+
always?: Array<TransitionDefinition<TContext, TEvent, TTransitionMeta>>;
|
|
84
84
|
constructor(
|
|
85
85
|
/** The raw config used to create the machine. */
|
|
86
86
|
config: StateNodeConfig<TContext, TEvent, TODO, // actors
|
|
@@ -90,16 +90,16 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
90
90
|
TODO, // tags
|
|
91
91
|
TODO, // output
|
|
92
92
|
TODO, // emitted
|
|
93
|
-
|
|
93
|
+
TStateMeta, TTransitionMeta>, options: StateNodeOptions<TContext, TEvent, TStateMeta, TTransitionMeta>);
|
|
94
94
|
/** The well-structured state node definition. */
|
|
95
|
-
get definition(): StateNodeDefinition<TContext, TEvent>;
|
|
95
|
+
get definition(): StateNodeDefinition<TContext, TEvent, TStateMeta, TTransitionMeta>;
|
|
96
96
|
/** The logic invoked as actors by this state node. */
|
|
97
97
|
get invoke(): Array<InvokeDefinition<TContext, TEvent, ProvidedActor, ParameterizedObject, ParameterizedObject, string, TODO, // TEmitted
|
|
98
|
-
|
|
98
|
+
TTransitionMeta>>;
|
|
99
99
|
/** The mapping of events to transitions. */
|
|
100
|
-
get on(): TransitionDefinitionMap<TContext, TEvent>;
|
|
101
|
-
get after(): Array<DelayedTransitionDefinition<TContext, TEvent>>;
|
|
102
|
-
get initial(): InitialTransitionDefinition<TContext, TEvent>;
|
|
100
|
+
get on(): TransitionDefinitionMap<TContext, TEvent, TTransitionMeta>;
|
|
101
|
+
get after(): Array<DelayedTransitionDefinition<TContext, TEvent, TTransitionMeta>>;
|
|
102
|
+
get initial(): InitialTransitionDefinition<TContext, TEvent, TTransitionMeta>;
|
|
103
103
|
/** All the event types accepted by this state node and its descendants. */
|
|
104
104
|
get events(): Array<EventDescriptor<TEvent>>;
|
|
105
105
|
/**
|
|
@@ -43,8 +43,8 @@ import { ResolvedStateMachineTypes, TODO, AnyActorRef, EventObject, AnyEventObje
|
|
|
43
43
|
* to provide machine implementations instead.
|
|
44
44
|
*/
|
|
45
45
|
export declare function createMachine<TContext extends MachineContext, TEvent extends AnyEventObject, // TODO: consider using a stricter `EventObject` here
|
|
46
|
-
TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TInput, TOutput extends NonReducibleUnknown, TEmitted extends EventObject,
|
|
47
|
-
types?: MachineTypes<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TInput, TOutput, TEmitted,
|
|
46
|
+
TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TTag extends string, TInput, TOutput extends NonReducibleUnknown, TEmitted extends EventObject, TStateMeta extends MetaObject = any, TTransitionMeta extends MetaObject = TStateMeta, _ = any>(config: {
|
|
47
|
+
types?: MachineTypes<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TInput, TOutput, TEmitted, TStateMeta, TTransitionMeta>;
|
|
48
48
|
schemas?: unknown;
|
|
49
|
-
} & MachineConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TInput, TOutput, TEmitted,
|
|
50
|
-
|
|
49
|
+
} & MachineConfig<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TInput, TOutput, TEmitted, TStateMeta, TTransitionMeta>, implementations?: InternalMachineImplementations<ResolvedStateMachineTypes<TContext, TEvent, TActor, TAction, TGuard, TDelay, TTag, TEmitted>>): StateMachine<TContext, TEvent, Cast<ToChildren<TActor>, Record<string, AnyActorRef | undefined>>, TActor, TAction, TGuard, TDelay, StateValue, TTag & string, TInput, TOutput, TEmitted, TStateMeta, TODO, // TStateSchema
|
|
50
|
+
TTransitionMeta>;
|
|
@@ -41,7 +41,7 @@ type ExtractConfigChildren<TConfig> = TConfig extends {
|
|
|
41
41
|
invoke: infer TInvoke;
|
|
42
42
|
} ? ExtractInvokeChildren<TInvoke> : {};
|
|
43
43
|
type MergeChildrenMap<TExplicit extends Record<string, string>, TInferred extends Record<string, string>> = IsNever<keyof TExplicit> extends true ? TInferred : TExplicit;
|
|
44
|
-
export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEventObject, TActors extends Record<string, UnknownActorLogic>, TChildrenMap extends Record<string, string>, TActions extends Record<string, ParameterizedObject['params'] | undefined>, TGuards extends Record<string, ParameterizedObject['params'] | undefined>, TDelay extends string, TTag extends string, TInput, TOutput extends NonReducibleUnknown, TEmitted extends EventObject,
|
|
44
|
+
export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEventObject, TActors extends Record<string, UnknownActorLogic>, TChildrenMap extends Record<string, string>, TActions extends Record<string, ParameterizedObject['params'] | undefined>, TGuards extends Record<string, ParameterizedObject['params'] | undefined>, TDelay extends string, TTag extends string, TInput, TOutput extends NonReducibleUnknown, TEmitted extends EventObject, TStateMeta extends MetaObject, TTransitionMeta extends MetaObject = TStateMeta> = {
|
|
45
45
|
extend: <TExtendActions extends Record<string, ParameterizedObject['params'] | undefined> = {}, TExtendGuards extends Record<string, ParameterizedObject['params'] | undefined> = {}, TExtendDelays extends string = never>({ actions, guards, delays }: {
|
|
46
46
|
actions?: {
|
|
47
47
|
[K in keyof TExtendActions]: ActionFunction<TContext, TEvent, TEvent, TExtendActions[K], ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions & TExtendActions>, ToParameterizedObject<TGuards & TExtendGuards>, TDelay | TExtendDelays, TEmitted>;
|
|
@@ -52,7 +52,7 @@ export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEvent
|
|
|
52
52
|
delays?: {
|
|
53
53
|
[K in TExtendDelays]: DelayConfig<TContext, TEvent, ToParameterizedObject<TActions & TExtendActions>['params'], TEvent>;
|
|
54
54
|
};
|
|
55
|
-
}) => SetupReturn<TContext, TEvent, TActors, TChildrenMap, TActions & TExtendActions, TGuards & TExtendGuards, TDelay | TExtendDelays, TTag, TInput, TOutput, TEmitted,
|
|
55
|
+
}) => SetupReturn<TContext, TEvent, TActors, TChildrenMap, TActions & TExtendActions, TGuards & TExtendGuards, TDelay | TExtendDelays, TTag, TInput, TOutput, TEmitted, TStateMeta, TTransitionMeta>;
|
|
56
56
|
/**
|
|
57
57
|
* Creates a state config that is strongly typed. This state config can be
|
|
58
58
|
* used to create a machine.
|
|
@@ -82,7 +82,7 @@ export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEvent
|
|
|
82
82
|
* });
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
|
-
createStateConfig: <TStateConfig extends StateNodeConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, unknown, TEmitted,
|
|
85
|
+
createStateConfig: <TStateConfig extends StateNodeConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, unknown, TEmitted, TStateMeta, TTransitionMeta>>(config: TStateConfig) => TStateConfig;
|
|
86
86
|
/**
|
|
87
87
|
* Creates a type-safe action.
|
|
88
88
|
*
|
|
@@ -108,10 +108,10 @@ export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEvent
|
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
110
|
createAction: (action: ActionFunction<TContext, TEvent, TEvent, unknown, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TEmitted>) => typeof action;
|
|
111
|
-
createMachine: <const TConfig extends MachineConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, TInput, TOutput, TEmitted,
|
|
111
|
+
createMachine: <const TConfig extends MachineConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, TInput, TOutput, TEmitted, TStateMeta, TTransitionMeta>, TResolvedChildren extends Record<string, string> = MergeChildrenMap<TChildrenMap, Cast<ExtractConfigChildren<TConfig>, Record<string, string>>>>(config: TConfig) => StateMachine<TContext, TEvent | ([RoutableStateId<TConfig>] extends [never] ? never : {
|
|
112
112
|
type: 'xstate.route';
|
|
113
113
|
to: RoutableStateId<TConfig>;
|
|
114
|
-
}), Cast<ToChildren<ToProvidedActor<TResolvedChildren, TActors>>, Record<string, AnyActorRef | undefined>>, ToProvidedActor<TResolvedChildren, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, ToStateValue<TConfig>, TTag, TInput, TOutput, TEmitted,
|
|
114
|
+
}), Cast<ToChildren<ToProvidedActor<TResolvedChildren, TActors>>, Record<string, AnyActorRef | undefined>>, ToProvidedActor<TResolvedChildren, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, ToStateValue<TConfig>, TTag, TInput, TOutput, TEmitted, TStateMeta, ToStateSchema<TConfig>, TTransitionMeta>;
|
|
115
115
|
assign: typeof assign<TContext, TEvent, undefined, TEvent, ToProvidedActor<TChildrenMap, TActors>>;
|
|
116
116
|
sendTo: <TTargetActor extends AnyActorRef>(...args: Parameters<typeof sendTo<TContext, TEvent, undefined, TTargetActor, TEvent, TDelay, TDelay>>) => ReturnType<typeof sendTo<TContext, TEvent, undefined, TTargetActor, TEvent, TDelay, TDelay>>;
|
|
117
117
|
raise: typeof raise<TContext, TEvent, TEvent, undefined, TDelay, TDelay>;
|
|
@@ -123,9 +123,9 @@ export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEvent
|
|
|
123
123
|
spawnChild: typeof spawnChild<TContext, TEvent, undefined, TEvent, ToProvidedActor<TChildrenMap, TActors>>;
|
|
124
124
|
};
|
|
125
125
|
export declare function setup<TContext extends MachineContext, TEvent extends AnyEventObject, // TODO: consider using a stricter `EventObject` here
|
|
126
|
-
TActors extends Record<string, UnknownActorLogic> = {}, TChildrenMap extends Record<string, string> = {}, TActions extends Record<string, ParameterizedObject['params'] | undefined> = {}, TGuards extends Record<string, ParameterizedObject['params'] | undefined> = {}, TDelay extends string = never, TTag extends string = string, TInput = NonReducibleUnknown, TOutput extends NonReducibleUnknown = NonReducibleUnknown, TEmitted extends EventObject = EventObject,
|
|
126
|
+
TActors extends Record<string, UnknownActorLogic> = {}, TChildrenMap extends Record<string, string> = {}, TActions extends Record<string, ParameterizedObject['params'] | undefined> = {}, TGuards extends Record<string, ParameterizedObject['params'] | undefined> = {}, TDelay extends string = never, TTag extends string = string, TInput = NonReducibleUnknown, TOutput extends NonReducibleUnknown = NonReducibleUnknown, TEmitted extends EventObject = EventObject, TStateMeta extends MetaObject = MetaObject, TTransitionMeta extends MetaObject = TStateMeta>({ schemas, actors, actions, guards, delays }: {
|
|
127
127
|
schemas?: unknown;
|
|
128
|
-
types?: SetupTypes<TContext, TEvent, TChildrenMap, TTag, TInput, TOutput, TEmitted,
|
|
128
|
+
types?: SetupTypes<TContext, TEvent, TChildrenMap, TTag, TInput, TOutput, TEmitted, TStateMeta, TTransitionMeta>;
|
|
129
129
|
actors?: {
|
|
130
130
|
[K in keyof TActors | Values<TChildrenMap>]: K extends keyof TActors ? TActors[K] : never;
|
|
131
131
|
};
|
|
@@ -140,5 +140,5 @@ TActors extends Record<string, UnknownActorLogic> = {}, TChildrenMap extends Rec
|
|
|
140
140
|
};
|
|
141
141
|
} & {
|
|
142
142
|
[K in RequiredSetupKeys<TChildrenMap>]: unknown;
|
|
143
|
-
}): SetupReturn<TContext, TEvent, TActors, TChildrenMap, TActions, TGuards, TDelay, TTag, TInput, TOutput, TEmitted,
|
|
143
|
+
}): SetupReturn<TContext, TEvent, TActors, TChildrenMap, TActions, TGuards, TDelay, TTag, TInput, TOutput, TEmitted, TStateMeta, TTransitionMeta>;
|
|
144
144
|
export {};
|