xstate 5.0.0-alpha.5 → 5.0.0-alpha.6

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.
@@ -2073,8 +2073,7 @@ function getOutput(configuration, context, _event) {
2073
2073
  var finalChildStateNode = configuration.find(function (stateNode) {
2074
2074
  return stateNode.type === 'final' && stateNode.parent === machine.root;
2075
2075
  });
2076
- var doneData = finalChildStateNode && finalChildStateNode.doneData ? mapContext(finalChildStateNode.doneData, context, _event) : undefined;
2077
- return doneData;
2076
+ return finalChildStateNode && finalChildStateNode.output ? mapContext(finalChildStateNode.output, context, _event) : undefined;
2078
2077
  }
2079
2078
  var isAtomicStateNode = function isAtomicStateNode(stateNode) {
2080
2079
  return stateNode.type === 'atomic' || stateNode.type === 'final';
@@ -2461,6 +2460,9 @@ function resolveTarget(stateNode, targets) {
2461
2460
  if (!isString(target)) {
2462
2461
  return target;
2463
2462
  }
2463
+ if (isStateId(target)) {
2464
+ return stateNode.machine.getStateNodeById(target);
2465
+ }
2464
2466
  var isInternalTarget = target[0] === stateNode.machine.delimiter;
2465
2467
  // If internal target is defined on machine,
2466
2468
  // do not include machine key on target
@@ -2476,7 +2478,7 @@ function resolveTarget(stateNode, targets) {
2476
2478
  throw new Error("Invalid transition definition for state node '".concat(stateNode.id, "':\n").concat(err.message));
2477
2479
  }
2478
2480
  } else {
2479
- return getStateNodeByPath(stateNode, resolvedTarget);
2481
+ throw new Error("Invalid target: \"".concat(target, "\" is not a valid target from the root node. Did you mean \".").concat(target, "\"?"));
2480
2482
  }
2481
2483
  });
2482
2484
  }
@@ -3076,7 +3078,7 @@ function enterStates(filteredTransitions, mutConfiguration, actions, internalQue
3076
3078
  if (!parent.parent) {
3077
3079
  continue;
3078
3080
  }
3079
- internalQueue.push(toSCXMLEvent(done(parent.id, stateNodeToEnter.doneData ? mapContext(stateNodeToEnter.doneData, currentState.context, currentState._event) : undefined)));
3081
+ internalQueue.push(toSCXMLEvent(done(parent.id, stateNodeToEnter.output ? mapContext(stateNodeToEnter.output, currentState.context, currentState._event) : undefined)));
3080
3082
  if (parent.parent) {
3081
3083
  var grandparent = parent.parent;
3082
3084
  if (grandparent.type === 'parallel') {
@@ -4230,13 +4232,13 @@ function after$1(delayRef, id) {
4230
4232
  * has been reached in the parent state node.
4231
4233
  *
4232
4234
  * @param id The final state node's parent state node `id`
4233
- * @param data The data to pass into the event
4235
+ * @param output The data to pass into the event
4234
4236
  */
4235
- function done(id, data) {
4237
+ function done(id, output) {
4236
4238
  var type = "".concat(ActionTypes.DoneState, ".").concat(id);
4237
4239
  var eventObject = {
4238
4240
  type: type,
4239
- data: data
4241
+ output: output
4240
4242
  };
4241
4243
  eventObject.toString = function () {
4242
4244
  return type;
@@ -4251,13 +4253,13 @@ function done(id, data) {
4251
4253
  * but not when it is canceled.
4252
4254
  *
4253
4255
  * @param invokeId The invoked service ID
4254
- * @param data The data to pass into the event
4256
+ * @param output The data to pass into the event
4255
4257
  */
4256
- function doneInvoke(invokeId, data) {
4258
+ function doneInvoke(invokeId, output) {
4257
4259
  var type = "".concat(ActionTypes.DoneInvoke, ".").concat(invokeId);
4258
4260
  var eventObject = {
4259
4261
  type: type,
4260
- data: data
4262
+ output: output
4261
4263
  };
4262
4264
  eventObject.toString = function () {
4263
4265
  return type;
@@ -4282,4 +4284,4 @@ function createInitEvent(input) {
4282
4284
  });
4283
4285
  }
4284
4286
 
4285
- export { log$1 as $, getConfiguration as A, getStateNodes as B, resolveStateValue as C, isInFinalState as D, toSCXMLEvent as E, isSCXMLErrorEvent as F, macrostep as G, transitionNode as H, _slicedToArray as I, getInitialConfiguration as J, resolveActionsAndContext as K, microstep as L, error$1 as M, NULL_EVENT as N, isStateId as O, getPersistedState as P, resolveReferencedActor as Q, interpret as R, State as S, STATE_DELIMITER as T, initEvent as U, matchesState as V, raise$1 as W, send$1 as X, sendParent as Y, sendTo as Z, _createClass as _, toActionObjects as a, cancel$1 as a0, stop$1 as a1, assign$1 as a2, after$1 as a3, done as a4, respond as a5, forwardTo as a6, escalate as a7, choose$1 as a8, Interpreter as a9, ActorStatus as aa, doneInvoke as ab, pathToStateValue as ac, toObserver as ad, ActionTypes as ae, SpecialTargets as af, startSignalType as ag, stopSignalType as ah, startSignal as ai, stopSignal as aj, isSignal as ak, isActorRef as al, toActorRef as am, fromTransition as an, fromPromise as ao, fromObservable as ap, fromEventObservable as aq, fromCallback as ar, stateIn as as, not as at, and as au, or as av, toGuardDefinition as aw, actionTypes as ax, resolveActionObject as ay, toActionObject as az, toTransitionConfigArray as b, createDynamicAction as c, formatTransition as d, memo as e, formatTransitions as f, _createForOfIteratorHelper as g, evaluateGuard as h, _toConsumableArray as i, flatten as j, _classCallCheck as k, _defineProperty as l, mapValues as m, createInvokeId as n, toInvokeConfig as o, pure as p, _objectSpread2 as q, invoke as r, _objectWithoutProperties as s, toArray as t, getDelayedTransitions as u, formatInitialTransition as v, getCandidates as w, isString as x, createSpawner as y, createInitEvent as z };
4287
+ export { sendTo as $, getConfiguration as A, getStateNodes as B, resolveStateValue as C, isInFinalState as D, toSCXMLEvent as E, isSCXMLErrorEvent as F, macrostep as G, transitionNode as H, _slicedToArray as I, getInitialConfiguration as J, resolveActionsAndContext as K, microstep as L, error$1 as M, NULL_EVENT as N, isStateId as O, getStateNodeByPath as P, getPersistedState as Q, resolveReferencedActor as R, State as S, interpret as T, STATE_DELIMITER as U, initEvent as V, matchesState as W, raise$1 as X, send$1 as Y, sendParent as Z, _createClass as _, toActionObjects as a, log$1 as a0, cancel$1 as a1, stop$1 as a2, assign$1 as a3, after$1 as a4, done as a5, respond as a6, forwardTo as a7, escalate as a8, choose$1 as a9, toActionObject as aA, Interpreter as aa, ActorStatus as ab, doneInvoke as ac, pathToStateValue as ad, toObserver as ae, ActionTypes as af, SpecialTargets as ag, startSignalType as ah, stopSignalType as ai, startSignal as aj, stopSignal as ak, isSignal as al, isActorRef as am, toActorRef as an, fromTransition as ao, fromPromise as ap, fromObservable as aq, fromEventObservable as ar, fromCallback as as, stateIn as at, not as au, and as av, or as aw, toGuardDefinition as ax, actionTypes as ay, resolveActionObject as az, toTransitionConfigArray as b, createDynamicAction as c, formatTransition as d, memo as e, formatTransitions as f, _createForOfIteratorHelper as g, evaluateGuard as h, _toConsumableArray as i, flatten as j, _classCallCheck as k, _defineProperty as l, mapValues as m, createInvokeId as n, toInvokeConfig as o, pure as p, _objectSpread2 as q, invoke as r, _objectWithoutProperties as s, toArray as t, getDelayedTransitions as u, formatInitialTransition as v, getCandidates as w, isString as x, createSpawner as y, createInitEvent as z };
@@ -2041,8 +2041,7 @@ function getOutput(configuration, context, _event) {
2041
2041
  var finalChildStateNode = configuration.find(function (stateNode) {
2042
2042
  return stateNode.type === 'final' && stateNode.parent === machine.root;
2043
2043
  });
2044
- var doneData = finalChildStateNode && finalChildStateNode.doneData ? mapContext(finalChildStateNode.doneData, context, _event) : undefined;
2045
- return doneData;
2044
+ return finalChildStateNode && finalChildStateNode.output ? mapContext(finalChildStateNode.output, context, _event) : undefined;
2046
2045
  }
2047
2046
  var isAtomicStateNode = function isAtomicStateNode(stateNode) {
2048
2047
  return stateNode.type === 'atomic' || stateNode.type === 'final';
@@ -2429,6 +2428,9 @@ function resolveTarget(stateNode, targets) {
2429
2428
  if (!isString(target)) {
2430
2429
  return target;
2431
2430
  }
2431
+ if (isStateId(target)) {
2432
+ return stateNode.machine.getStateNodeById(target);
2433
+ }
2432
2434
  var isInternalTarget = target[0] === stateNode.machine.delimiter;
2433
2435
  // If internal target is defined on machine,
2434
2436
  // do not include machine key on target
@@ -2444,7 +2446,7 @@ function resolveTarget(stateNode, targets) {
2444
2446
  throw new Error("Invalid transition definition for state node '".concat(stateNode.id, "':\n").concat(err.message));
2445
2447
  }
2446
2448
  } else {
2447
- return getStateNodeByPath(stateNode, resolvedTarget);
2449
+ throw new Error("Invalid target: \"".concat(target, "\" is not a valid target from the root node. Did you mean \".").concat(target, "\"?"));
2448
2450
  }
2449
2451
  });
2450
2452
  }
@@ -3044,7 +3046,7 @@ function enterStates(filteredTransitions, mutConfiguration, actions, internalQue
3044
3046
  if (!parent.parent) {
3045
3047
  continue;
3046
3048
  }
3047
- internalQueue.push(toSCXMLEvent(done(parent.id, stateNodeToEnter.doneData ? mapContext(stateNodeToEnter.doneData, currentState.context, currentState._event) : undefined)));
3049
+ internalQueue.push(toSCXMLEvent(done(parent.id, stateNodeToEnter.output ? mapContext(stateNodeToEnter.output, currentState.context, currentState._event) : undefined)));
3048
3050
  if (parent.parent) {
3049
3051
  var grandparent = parent.parent;
3050
3052
  if (grandparent.type === 'parallel') {
@@ -4198,13 +4200,13 @@ function after$1(delayRef, id) {
4198
4200
  * has been reached in the parent state node.
4199
4201
  *
4200
4202
  * @param id The final state node's parent state node `id`
4201
- * @param data The data to pass into the event
4203
+ * @param output The data to pass into the event
4202
4204
  */
4203
- function done(id, data) {
4205
+ function done(id, output) {
4204
4206
  var type = "".concat(exports.ActionTypes.DoneState, ".").concat(id);
4205
4207
  var eventObject = {
4206
4208
  type: type,
4207
- data: data
4209
+ output: output
4208
4210
  };
4209
4211
  eventObject.toString = function () {
4210
4212
  return type;
@@ -4219,13 +4221,13 @@ function done(id, data) {
4219
4221
  * but not when it is canceled.
4220
4222
  *
4221
4223
  * @param invokeId The invoked service ID
4222
- * @param data The data to pass into the event
4224
+ * @param output The data to pass into the event
4223
4225
  */
4224
- function doneInvoke(invokeId, data) {
4226
+ function doneInvoke(invokeId, output) {
4225
4227
  var type = "".concat(exports.ActionTypes.DoneInvoke, ".").concat(invokeId);
4226
4228
  var eventObject = {
4227
4229
  type: type,
4228
- data: data
4230
+ output: output
4229
4231
  };
4230
4232
  eventObject.toString = function () {
4231
4233
  return type;
@@ -4292,6 +4294,7 @@ exports.getConfiguration = getConfiguration;
4292
4294
  exports.getDelayedTransitions = getDelayedTransitions;
4293
4295
  exports.getInitialConfiguration = getInitialConfiguration;
4294
4296
  exports.getPersistedState = getPersistedState;
4297
+ exports.getStateNodeByPath = getStateNodeByPath;
4295
4298
  exports.getStateNodes = getStateNodes;
4296
4299
  exports.initEvent = initEvent;
4297
4300
  exports.interpret = interpret;
@@ -2020,8 +2020,7 @@ function getOutput(configuration, context, _event) {
2020
2020
  var finalChildStateNode = configuration.find(function (stateNode) {
2021
2021
  return stateNode.type === 'final' && stateNode.parent === machine.root;
2022
2022
  });
2023
- var doneData = finalChildStateNode && finalChildStateNode.doneData ? mapContext(finalChildStateNode.doneData, context, _event) : undefined;
2024
- return doneData;
2023
+ return finalChildStateNode && finalChildStateNode.output ? mapContext(finalChildStateNode.output, context, _event) : undefined;
2025
2024
  }
2026
2025
  var isAtomicStateNode = function isAtomicStateNode(stateNode) {
2027
2026
  return stateNode.type === 'atomic' || stateNode.type === 'final';
@@ -2397,6 +2396,9 @@ function resolveTarget(stateNode, targets) {
2397
2396
  if (!isString(target)) {
2398
2397
  return target;
2399
2398
  }
2399
+ if (isStateId(target)) {
2400
+ return stateNode.machine.getStateNodeById(target);
2401
+ }
2400
2402
  var isInternalTarget = target[0] === stateNode.machine.delimiter;
2401
2403
  // If internal target is defined on machine,
2402
2404
  // do not include machine key on target
@@ -2412,7 +2414,7 @@ function resolveTarget(stateNode, targets) {
2412
2414
  throw new Error("Invalid transition definition for state node '".concat(stateNode.id, "':\n").concat(err.message));
2413
2415
  }
2414
2416
  } else {
2415
- return getStateNodeByPath(stateNode, resolvedTarget);
2417
+ throw new Error("Invalid target: \"".concat(target, "\" is not a valid target from the root node. Did you mean \".").concat(target, "\"?"));
2416
2418
  }
2417
2419
  });
2418
2420
  }
@@ -3012,7 +3014,7 @@ function enterStates(filteredTransitions, mutConfiguration, actions, internalQue
3012
3014
  if (!parent.parent) {
3013
3015
  continue;
3014
3016
  }
3015
- internalQueue.push(toSCXMLEvent(done(parent.id, stateNodeToEnter.doneData ? mapContext(stateNodeToEnter.doneData, currentState.context, currentState._event) : undefined)));
3017
+ internalQueue.push(toSCXMLEvent(done(parent.id, stateNodeToEnter.output ? mapContext(stateNodeToEnter.output, currentState.context, currentState._event) : undefined)));
3016
3018
  if (parent.parent) {
3017
3019
  var grandparent = parent.parent;
3018
3020
  if (grandparent.type === 'parallel') {
@@ -4160,13 +4162,13 @@ function after$1(delayRef, id) {
4160
4162
  * has been reached in the parent state node.
4161
4163
  *
4162
4164
  * @param id The final state node's parent state node `id`
4163
- * @param data The data to pass into the event
4165
+ * @param output The data to pass into the event
4164
4166
  */
4165
- function done(id, data) {
4167
+ function done(id, output) {
4166
4168
  var type = "".concat(exports.ActionTypes.DoneState, ".").concat(id);
4167
4169
  var eventObject = {
4168
4170
  type: type,
4169
- data: data
4171
+ output: output
4170
4172
  };
4171
4173
  eventObject.toString = function () {
4172
4174
  return type;
@@ -4181,13 +4183,13 @@ function done(id, data) {
4181
4183
  * but not when it is canceled.
4182
4184
  *
4183
4185
  * @param invokeId The invoked service ID
4184
- * @param data The data to pass into the event
4186
+ * @param output The data to pass into the event
4185
4187
  */
4186
- function doneInvoke(invokeId, data) {
4188
+ function doneInvoke(invokeId, output) {
4187
4189
  var type = "".concat(exports.ActionTypes.DoneInvoke, ".").concat(invokeId);
4188
4190
  var eventObject = {
4189
4191
  type: type,
4190
- data: data
4192
+ output: output
4191
4193
  };
4192
4194
  eventObject.toString = function () {
4193
4195
  return type;
@@ -4254,6 +4256,7 @@ exports.getConfiguration = getConfiguration;
4254
4256
  exports.getDelayedTransitions = getDelayedTransitions;
4255
4257
  exports.getInitialConfiguration = getInitialConfiguration;
4256
4258
  exports.getPersistedState = getPersistedState;
4259
+ exports.getStateNodeByPath = getStateNodeByPath;
4257
4260
  exports.getStateNodes = getStateNodes;
4258
4261
  exports.initEvent = initEvent;
4259
4262
  exports.interpret = interpret;
@@ -65,9 +65,9 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
65
65
  */
66
66
  meta?: any;
67
67
  /**
68
- * The data sent with the "done.state._id_" event if this is a final state node.
68
+ * The output data sent with the "done.state._id_" event if this is a final state node.
69
69
  */
70
- doneData?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
70
+ output?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
71
71
  /**
72
72
  * The order this state node appears. Corresponds to the implicit SCXML document order.
73
73
  */
@@ -27,9 +27,9 @@ export declare function after(delayRef: number | string, id?: string): string;
27
27
  * has been reached in the parent state node.
28
28
  *
29
29
  * @param id The final state node's parent state node `id`
30
- * @param data The data to pass into the event
30
+ * @param output The data to pass into the event
31
31
  */
32
- export declare function done(id: string, data?: any): DoneEventObject;
32
+ export declare function done(id: string, output?: any): DoneEventObject;
33
33
  /**
34
34
  * Returns an event that represents that an invoked service has terminated.
35
35
  *
@@ -37,9 +37,9 @@ export declare function done(id: string, data?: any): DoneEventObject;
37
37
  * but not when it is canceled.
38
38
  *
39
39
  * @param invokeId The invoked service ID
40
- * @param data The data to pass into the event
40
+ * @param output The data to pass into the event
41
41
  */
42
- export declare function doneInvoke(invokeId: string, data?: any): DoneEvent;
42
+ export declare function doneInvoke(invokeId: string, output?: any): DoneEvent;
43
43
  export declare function error(id: string, data?: any): ErrorPlatformEvent & string;
44
44
  export declare function createInitEvent(input: any): SCXML.Event<{
45
45
  type: ActionTypes.Init;
@@ -32,6 +32,12 @@ export declare function getInitialStateNodes(stateNode: AnyStateNode): Array<Any
32
32
  * Returns the child state node from its relative `stateKey`, or throws.
33
33
  */
34
34
  export declare function getStateNode(stateNode: AnyStateNode, stateKey: string): AnyStateNode;
35
+ /**
36
+ * Returns the relative state node from the given `statePath`, or throws.
37
+ *
38
+ * @param statePath The string or string array relative path to the state node.
39
+ */
40
+ export declare function getStateNodeByPath(stateNode: AnyStateNode, statePath: string | string[]): AnyStateNode;
35
41
  /**
36
42
  * Returns the state nodes represented by the current state value.
37
43
  *
@@ -121,11 +121,11 @@ export interface ResolveTypegenMeta<TTypesMeta extends TypegenConstraint, TEvent
121
121
  disabled: TypegenDisabled & AllImplementationsProvided & AllowAllEvents & {
122
122
  indexedActions: IndexByType<TAction>;
123
123
  indexedEvents: Record<string, TEvent> & {
124
- __XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__: {
125
- data: any;
124
+ __XSTATE_ALLOW_ANY_INVOKE_OUTPUT_HACK__: {
125
+ output: any;
126
126
  };
127
127
  };
128
- invokeSrcNameMap: Record<string, '__XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__'>;
128
+ invokeSrcNameMap: Record<string, '__XSTATE_ALLOW_ANY_INVOKE_OUTPUT_HACK__'>;
129
129
  };
130
130
  }[IsNever<TTypesMeta> extends true ? 'disabled' : TTypesMeta extends TypegenEnabled ? 'enabled' : 'disabled'];
131
131
  }
@@ -269,7 +269,7 @@ export interface InvokeConfig<TContext extends MachineContext, TEvent extends Ev
269
269
  /**
270
270
  * The transition to take upon the invoked child machine sending an error event.
271
271
  */
272
- onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, DoneInvokeEvent<any>, TEvent>>;
272
+ onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorEvent<any>, TEvent>>;
273
273
  onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent<any>, TEvent>>;
274
274
  /**
275
275
  * Meta data related to this invocation
@@ -341,12 +341,12 @@ export interface StateNodeConfig<TContext extends MachineContext, TEvent extends
341
341
  */
342
342
  meta?: any;
343
343
  /**
344
- * The data sent with the "done.state._id_" event if this is a final state node.
344
+ * The output data sent with the "done.state._id_" event if this is a final state node.
345
345
  *
346
- * The data will be evaluated with the current `context` and placed on the `.data` property
346
+ * The output data will be evaluated with the current `context` and placed on the `.data` property
347
347
  * of the event.
348
348
  */
349
- data?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
349
+ output?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
350
350
  /**
351
351
  * The unique ID of the state node, which can be referenced as a transition target via the
352
352
  * `#id` syntax.
@@ -387,7 +387,7 @@ export interface StateNodeDefinition<TContext extends MachineContext, TEvent ext
387
387
  exit: BaseActionObject[];
388
388
  meta: any;
389
389
  order: number;
390
- data?: FinalStateNodeConfig<TContext, TEvent>['data'];
390
+ output?: FinalStateNodeConfig<TContext, TEvent>['output'];
391
391
  invoke: Array<InvokeDefinition<TContext, TEvent>>;
392
392
  description?: string;
393
393
  tags: string[];
@@ -416,7 +416,7 @@ export interface FinalStateNodeConfig<TContext extends MachineContext, TEvent ex
416
416
  * The data to be sent with the "done.state.<id>" event. The data can be
417
417
  * static or dynamic (based on assigners).
418
418
  */
419
- data?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
419
+ output?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
420
420
  }
421
421
  export type SimpleOrStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> = AtomicStateNodeConfig<TContext, TEvent> | StateNodeConfig<TContext, TEvent>;
422
422
  export type ActionFunctionMap<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject> = {
@@ -494,7 +494,7 @@ export interface MachineConfig<TContext extends MachineContext, TEvent extends E
494
494
  tsTypes?: TTypesMeta;
495
495
  }
496
496
  export type ActorMap = Record<string, {
497
- data: any;
497
+ output: any;
498
498
  }>;
499
499
  export interface MachineSchema<TContext extends MachineContext, TEvent extends EventObject, TActorMap extends ActorMap = ActorMap> {
500
500
  context?: TContext;
@@ -547,7 +547,7 @@ export interface RaiseActionObject<TContext extends MachineContext, TExpressionE
547
547
  }
548
548
  export interface DoneInvokeEvent<TData> extends EventObject {
549
549
  type: `done.invoke.${string}`;
550
- data: TData;
550
+ output: TData;
551
551
  }
552
552
  export interface ErrorEvent<TErrorData> {
553
553
  type: `error.${string}`;
@@ -570,7 +570,7 @@ export interface SCXMLErrorEvent extends SCXML.Event<any> {
570
570
  data: any;
571
571
  }
572
572
  export interface DoneEventObject extends EventObject {
573
- data?: any;
573
+ output?: any;
574
574
  toString(): string;
575
575
  }
576
576
  export type DoneEvent = DoneEventObject & string;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var actors_dist_xstateActors = require('./actions-96f799fc.cjs.dev.js');
5
+ var actors_dist_xstateActors = require('./actions-bf7bb1c5.cjs.dev.js');
6
6
  require('./index-ebaab3c9.cjs.dev.js');
7
7
 
8
8
  function pure(getActions) {
@@ -83,7 +83,7 @@ var StateNode = /*#__PURE__*/function () {
83
83
  */
84
84
 
85
85
  /**
86
- * The data sent with the "done.state._id_" event if this is a final state node.
86
+ * The output data sent with the "done.state._id_" event if this is a final state node.
87
87
  */
88
88
 
89
89
  /**
@@ -109,7 +109,7 @@ var StateNode = /*#__PURE__*/function () {
109
109
  actors_dist_xstateActors._defineProperty(this, "parent", void 0);
110
110
  actors_dist_xstateActors._defineProperty(this, "machine", void 0);
111
111
  actors_dist_xstateActors._defineProperty(this, "meta", void 0);
112
- actors_dist_xstateActors._defineProperty(this, "doneData", void 0);
112
+ actors_dist_xstateActors._defineProperty(this, "output", void 0);
113
113
  actors_dist_xstateActors._defineProperty(this, "order", -1);
114
114
  actors_dist_xstateActors._defineProperty(this, "description", void 0);
115
115
  actors_dist_xstateActors._defineProperty(this, "tags", []);
@@ -141,7 +141,7 @@ var StateNode = /*#__PURE__*/function () {
141
141
  this.entry = actors_dist_xstateActors.toActionObjects(this.config.entry);
142
142
  this.exit = actors_dist_xstateActors.toActionObjects(this.config.exit);
143
143
  this.meta = this.config.meta;
144
- this.doneData = this.type === 'final' ? this.config.data : undefined;
144
+ this.output = this.type === 'final' ? this.config.output : undefined;
145
145
  this.tags = actors_dist_xstateActors.toArray(config.tags);
146
146
  }
147
147
  actors_dist_xstateActors._createClass(StateNode, [{
@@ -198,7 +198,7 @@ var StateNode = /*#__PURE__*/function () {
198
198
  exit: this.exit,
199
199
  meta: this.meta,
200
200
  order: this.order || -1,
201
- data: this.doneData,
201
+ output: this.output,
202
202
  invoke: this.invoke,
203
203
  description: this.description,
204
204
  tags: this.tags
@@ -666,12 +666,14 @@ var StateMachine = /*#__PURE__*/function () {
666
666
  }, {
667
667
  key: "getStateNodeById",
668
668
  value: function getStateNodeById(stateId) {
669
- var resolvedStateId = actors_dist_xstateActors.isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;
669
+ var fullPath = stateId.split(this.delimiter);
670
+ var relativePath = fullPath.slice(1);
671
+ var resolvedStateId = actors_dist_xstateActors.isStateId(fullPath[0]) ? fullPath[0].slice(STATE_IDENTIFIER.length) : fullPath[0];
670
672
  var stateNode = this.idMap.get(resolvedStateId);
671
673
  if (!stateNode) {
672
674
  throw new Error("Child state node '#".concat(resolvedStateId, "' does not exist on machine '").concat(this.id, "'"));
673
675
  }
674
- return stateNode;
676
+ return actors_dist_xstateActors.getStateNodeByPath(stateNode, relativePath);
675
677
  }
676
678
  }, {
677
679
  key: "definition",
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var actors_dist_xstateActors = require('./actions-2479953d.cjs.prod.js');
5
+ var actors_dist_xstateActors = require('./actions-c46e4911.cjs.prod.js');
6
6
  require('../dev/dist/xstate-dev.cjs.prod.js');
7
7
 
8
8
  function pure(getActions) {
@@ -83,7 +83,7 @@ var StateNode = /*#__PURE__*/function () {
83
83
  */
84
84
 
85
85
  /**
86
- * The data sent with the "done.state._id_" event if this is a final state node.
86
+ * The output data sent with the "done.state._id_" event if this is a final state node.
87
87
  */
88
88
 
89
89
  /**
@@ -109,7 +109,7 @@ var StateNode = /*#__PURE__*/function () {
109
109
  actors_dist_xstateActors._defineProperty(this, "parent", void 0);
110
110
  actors_dist_xstateActors._defineProperty(this, "machine", void 0);
111
111
  actors_dist_xstateActors._defineProperty(this, "meta", void 0);
112
- actors_dist_xstateActors._defineProperty(this, "doneData", void 0);
112
+ actors_dist_xstateActors._defineProperty(this, "output", void 0);
113
113
  actors_dist_xstateActors._defineProperty(this, "order", -1);
114
114
  actors_dist_xstateActors._defineProperty(this, "description", void 0);
115
115
  actors_dist_xstateActors._defineProperty(this, "tags", []);
@@ -141,7 +141,7 @@ var StateNode = /*#__PURE__*/function () {
141
141
  this.entry = actors_dist_xstateActors.toActionObjects(this.config.entry);
142
142
  this.exit = actors_dist_xstateActors.toActionObjects(this.config.exit);
143
143
  this.meta = this.config.meta;
144
- this.doneData = this.type === 'final' ? this.config.data : undefined;
144
+ this.output = this.type === 'final' ? this.config.output : undefined;
145
145
  this.tags = actors_dist_xstateActors.toArray(config.tags);
146
146
  }
147
147
  actors_dist_xstateActors._createClass(StateNode, [{
@@ -198,7 +198,7 @@ var StateNode = /*#__PURE__*/function () {
198
198
  exit: this.exit,
199
199
  meta: this.meta,
200
200
  order: this.order || -1,
201
- data: this.doneData,
201
+ output: this.output,
202
202
  invoke: this.invoke,
203
203
  description: this.description,
204
204
  tags: this.tags
@@ -666,12 +666,14 @@ var StateMachine = /*#__PURE__*/function () {
666
666
  }, {
667
667
  key: "getStateNodeById",
668
668
  value: function getStateNodeById(stateId) {
669
- var resolvedStateId = actors_dist_xstateActors.isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;
669
+ var fullPath = stateId.split(this.delimiter);
670
+ var relativePath = fullPath.slice(1);
671
+ var resolvedStateId = actors_dist_xstateActors.isStateId(fullPath[0]) ? fullPath[0].slice(STATE_IDENTIFIER.length) : fullPath[0];
670
672
  var stateNode = this.idMap.get(resolvedStateId);
671
673
  if (!stateNode) {
672
674
  throw new Error("Child state node '#".concat(resolvedStateId, "' does not exist on machine '").concat(this.id, "'"));
673
675
  }
674
- return stateNode;
676
+ return actors_dist_xstateActors.getStateNodeByPath(stateNode, relativePath);
675
677
  }
676
678
  }, {
677
679
  key: "definition",
@@ -1,5 +1,5 @@
1
- import { c as createDynamicAction, p as pure$1, t as toArray, a as toActionObjects, _ as _createClass, f as formatTransitions, b as toTransitionConfigArray, N as NULL_EVENT, d as formatTransition, m as mapValues, e as memo, g as _createForOfIteratorHelper, h as evaluateGuard, i as _toConsumableArray, j as flatten, k as _classCallCheck, l as _defineProperty, n as createInvokeId, o as toInvokeConfig, q as _objectSpread2, r as invoke, s as _objectWithoutProperties, u as getDelayedTransitions, v as formatInitialTransition, w as getCandidates, x as isString, y as createSpawner, z as createInitEvent, A as getConfiguration, B as getStateNodes, C as resolveStateValue, D as isInFinalState, S as State, E as toSCXMLEvent, F as isSCXMLErrorEvent, G as macrostep, H as transitionNode, I as _slicedToArray, J as getInitialConfiguration, K as resolveActionsAndContext, L as microstep, M as error, O as isStateId, P as getPersistedState, Q as resolveReferencedActor, R as interpret, T as STATE_DELIMITER, U as initEvent, V as matchesState, W as raise, X as send, Y as sendParent, Z as sendTo, $ as log, a0 as cancel, a1 as stop, a2 as assign, a3 as after, a4 as done, a5 as respond, a6 as forwardTo, a7 as escalate, a8 as choose } from './actions-7678b87b.esm.js';
2
- export { ae as ActionTypes, a9 as Interpreter, aa as InterpreterStatus, af as SpecialTargets, S as State, a2 as assign, ab as doneInvoke, a6 as forwardTo, B as getStateNodes, R as interpret, V as matchesState, ac as pathToStateValue, X as send, Y as sendParent, Z as sendTo, ad as toObserver, E as toSCXMLEvent } from './actions-7678b87b.esm.js';
1
+ import { c as createDynamicAction, p as pure$1, t as toArray, a as toActionObjects, _ as _createClass, f as formatTransitions, b as toTransitionConfigArray, N as NULL_EVENT, d as formatTransition, m as mapValues, e as memo, g as _createForOfIteratorHelper, h as evaluateGuard, i as _toConsumableArray, j as flatten, k as _classCallCheck, l as _defineProperty, n as createInvokeId, o as toInvokeConfig, q as _objectSpread2, r as invoke, s as _objectWithoutProperties, u as getDelayedTransitions, v as formatInitialTransition, w as getCandidates, x as isString, y as createSpawner, z as createInitEvent, A as getConfiguration, B as getStateNodes, C as resolveStateValue, D as isInFinalState, S as State, E as toSCXMLEvent, F as isSCXMLErrorEvent, G as macrostep, H as transitionNode, I as _slicedToArray, J as getInitialConfiguration, K as resolveActionsAndContext, L as microstep, M as error, O as isStateId, P as getStateNodeByPath, Q as getPersistedState, R as resolveReferencedActor, T as interpret, U as STATE_DELIMITER, V as initEvent, W as matchesState, X as raise, Y as send, Z as sendParent, $ as sendTo, a0 as log, a1 as cancel, a2 as stop, a3 as assign, a4 as after, a5 as done, a6 as respond, a7 as forwardTo, a8 as escalate, a9 as choose } from './actions-41b74cdc.esm.js';
2
+ export { af as ActionTypes, aa as Interpreter, ab as InterpreterStatus, ag as SpecialTargets, S as State, a3 as assign, ac as doneInvoke, a7 as forwardTo, B as getStateNodes, T as interpret, W as matchesState, ad as pathToStateValue, Y as send, Z as sendParent, $ as sendTo, ae as toObserver, E as toSCXMLEvent } from './actions-41b74cdc.esm.js';
3
3
  import './index-50bd0aff.esm.js';
4
4
 
5
5
  function pure(getActions) {
@@ -80,7 +80,7 @@ var StateNode = /*#__PURE__*/function () {
80
80
  */
81
81
 
82
82
  /**
83
- * The data sent with the "done.state._id_" event if this is a final state node.
83
+ * The output data sent with the "done.state._id_" event if this is a final state node.
84
84
  */
85
85
 
86
86
  /**
@@ -106,7 +106,7 @@ var StateNode = /*#__PURE__*/function () {
106
106
  _defineProperty(this, "parent", void 0);
107
107
  _defineProperty(this, "machine", void 0);
108
108
  _defineProperty(this, "meta", void 0);
109
- _defineProperty(this, "doneData", void 0);
109
+ _defineProperty(this, "output", void 0);
110
110
  _defineProperty(this, "order", -1);
111
111
  _defineProperty(this, "description", void 0);
112
112
  _defineProperty(this, "tags", []);
@@ -138,7 +138,7 @@ var StateNode = /*#__PURE__*/function () {
138
138
  this.entry = toActionObjects(this.config.entry);
139
139
  this.exit = toActionObjects(this.config.exit);
140
140
  this.meta = this.config.meta;
141
- this.doneData = this.type === 'final' ? this.config.data : undefined;
141
+ this.output = this.type === 'final' ? this.config.output : undefined;
142
142
  this.tags = toArray(config.tags);
143
143
  }
144
144
  _createClass(StateNode, [{
@@ -195,7 +195,7 @@ var StateNode = /*#__PURE__*/function () {
195
195
  exit: this.exit,
196
196
  meta: this.meta,
197
197
  order: this.order || -1,
198
- data: this.doneData,
198
+ output: this.output,
199
199
  invoke: this.invoke,
200
200
  description: this.description,
201
201
  tags: this.tags
@@ -663,12 +663,14 @@ var StateMachine = /*#__PURE__*/function () {
663
663
  }, {
664
664
  key: "getStateNodeById",
665
665
  value: function getStateNodeById(stateId) {
666
- var resolvedStateId = isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;
666
+ var fullPath = stateId.split(this.delimiter);
667
+ var relativePath = fullPath.slice(1);
668
+ var resolvedStateId = isStateId(fullPath[0]) ? fullPath[0].slice(STATE_IDENTIFIER.length) : fullPath[0];
667
669
  var stateNode = this.idMap.get(resolvedStateId);
668
670
  if (!stateNode) {
669
671
  throw new Error("Child state node '#".concat(resolvedStateId, "' does not exist on machine '").concat(this.id, "'"));
670
672
  }
671
- return stateNode;
673
+ return getStateNodeByPath(stateNode, relativePath);
672
674
  }
673
675
  }, {
674
676
  key: "definition",