xstate 5.24.0 → 5.25.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.
Files changed (50) hide show
  1. package/actions/dist/xstate-actions.cjs.js +3 -3
  2. package/actions/dist/xstate-actions.development.cjs.js +3 -3
  3. package/actions/dist/xstate-actions.development.esm.js +3 -3
  4. package/actions/dist/xstate-actions.esm.js +3 -3
  5. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  6. package/actors/dist/xstate-actors.cjs.js +1 -1
  7. package/actors/dist/xstate-actors.development.cjs.js +1 -1
  8. package/actors/dist/xstate-actors.development.esm.js +1 -1
  9. package/actors/dist/xstate-actors.esm.js +1 -1
  10. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  11. package/dist/{StateMachine-d6caf9f3.development.esm.js → StateMachine-53479528.development.esm.js} +4 -3
  12. package/dist/{StateMachine-37bc3882.esm.js → StateMachine-a6d25621.esm.js} +4 -3
  13. package/dist/{StateMachine-4f3286fa.development.cjs.js → StateMachine-e3bf357b.development.cjs.js} +4 -3
  14. package/dist/{StateMachine-30081029.cjs.js → StateMachine-f73271f9.cjs.js} +4 -3
  15. package/dist/{assign-9e730107.development.cjs.js → assign-97062f30.development.cjs.js} +1 -1
  16. package/dist/{assign-dea9f7c8.cjs.js → assign-ae103a72.cjs.js} +1 -1
  17. package/dist/{assign-445527dc.development.esm.js → assign-ef1b62f6.development.esm.js} +1 -1
  18. package/dist/{assign-ab9cc19e.esm.js → assign-fd69c737.esm.js} +1 -1
  19. package/dist/declarations/src/State.d.ts +5 -5
  20. package/dist/declarations/src/StateMachine.d.ts +10 -10
  21. package/dist/declarations/src/assert.d.ts +2 -4
  22. package/dist/declarations/src/setup.d.ts +13 -8
  23. package/dist/declarations/src/types.d.ts +1 -1
  24. package/dist/declarations/src/utils.d.ts +13 -0
  25. package/dist/{log-2aa3642a.development.esm.js → log-3eec9346.development.esm.js} +2 -2
  26. package/dist/{log-cbac1abc.development.cjs.js → log-bf2198dc.development.cjs.js} +2 -2
  27. package/dist/{log-ec8d4df4.cjs.js → log-ec818628.cjs.js} +2 -2
  28. package/dist/{log-7cbae384.esm.js → log-fbb00743.esm.js} +2 -2
  29. package/dist/{raise-c096f887.development.esm.js → raise-235fa0c7.development.esm.js} +46 -31
  30. package/dist/{raise-f777a9e8.development.cjs.js → raise-723edf2d.development.cjs.js} +46 -30
  31. package/dist/{raise-da5b247f.cjs.js → raise-ad4f12ad.cjs.js} +40 -24
  32. package/dist/{raise-9ad1c5c6.esm.js → raise-da2ff7ca.esm.js} +40 -25
  33. package/dist/xstate.cjs.js +10 -6
  34. package/dist/xstate.development.cjs.js +10 -6
  35. package/dist/xstate.development.esm.js +14 -10
  36. package/dist/xstate.esm.js +14 -10
  37. package/dist/xstate.umd.min.js +1 -1
  38. package/dist/xstate.umd.min.js.map +1 -1
  39. package/graph/dist/xstate-graph.cjs.js +3 -3
  40. package/graph/dist/xstate-graph.development.cjs.js +3 -3
  41. package/graph/dist/xstate-graph.development.esm.js +3 -3
  42. package/graph/dist/xstate-graph.esm.js +3 -3
  43. package/graph/dist/xstate-graph.umd.min.js +1 -1
  44. package/graph/dist/xstate-graph.umd.min.js.map +1 -1
  45. package/guards/dist/xstate-guards.cjs.js +1 -1
  46. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  47. package/guards/dist/xstate-guards.development.esm.js +1 -1
  48. package/guards/dist/xstate-guards.esm.js +1 -1
  49. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  50. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-da5b247f.cjs.js');
4
- var assign = require('./assign-dea9f7c8.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-ad4f12ad.cjs.js');
4
+ var assign = require('./assign-ae103a72.cjs.js');
5
5
 
6
6
  const cache = new WeakMap();
7
7
  function memo(object, key, fn) {
@@ -284,7 +284,8 @@ class StateNode {
284
284
  * Excludes any inert events.
285
285
  */
286
286
  get ownEvents() {
287
- const events = new Set([...this.transitions.keys()].filter(descriptor => {
287
+ const keys = Object.keys(Object.fromEntries(this.transitions));
288
+ const events = new Set(keys.filter(descriptor => {
288
289
  return this.transitions.get(descriptor).some(transition => !(!transition.target && !transition.actions.length && !transition.reenter));
289
290
  }));
290
291
  return Array.from(events);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-f777a9e8.development.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-723edf2d.development.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-da5b247f.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-ad4f12ad.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -1,4 +1,4 @@
1
- import { W as ProcessingStatus, R as resolveReferencedActor, c as createActor, Y as cloneMachineSnapshot, T as executingCustomAction } from './raise-c096f887.development.esm.js';
1
+ import { Y as ProcessingStatus, T as resolveReferencedActor, c as createActor, Z as cloneMachineSnapshot, U as executingCustomAction } from './raise-235fa0c7.development.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -1,4 +1,4 @@
1
- import { V as ProcessingStatus, R as resolveReferencedActor, c as createActor, W as cloneMachineSnapshot } from './raise-9ad1c5c6.esm.js';
1
+ import { W as ProcessingStatus, T as resolveReferencedActor, c as createActor, Y as cloneMachineSnapshot } from './raise-da2ff7ca.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -68,27 +68,27 @@ interface MachineSnapshotBase<TContext extends MachineContext, TEvent extends Ev
68
68
  getMeta: () => Record<StateId<TStateSchema> & string, TMeta | undefined>;
69
69
  toJSON: () => unknown;
70
70
  }
71
- interface ActiveMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
71
+ interface ActiveMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> {
72
72
  status: 'active';
73
73
  output: undefined;
74
74
  error: undefined;
75
75
  }
76
- interface DoneMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
76
+ interface DoneMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> {
77
77
  status: 'done';
78
78
  output: TOutput;
79
79
  error: undefined;
80
80
  }
81
- interface ErrorMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
81
+ interface ErrorMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> {
82
82
  status: 'error';
83
83
  output: undefined;
84
84
  error: unknown;
85
85
  }
86
- interface StoppedMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> {
86
+ interface StoppedMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> {
87
87
  status: 'stopped';
88
88
  output: undefined;
89
89
  error: undefined;
90
90
  }
91
- export type MachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TConfig extends StateSchema> = ActiveMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> | DoneMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> | ErrorMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig> | StoppedMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
91
+ export type MachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> = ActiveMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> | DoneMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> | ErrorMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema> | StoppedMachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>;
92
92
  export declare function createMachineSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TMeta extends MetaObject, TStateSchema extends StateSchema>(config: StateConfig<TContext, TEvent>, machine: AnyStateMachine): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, undefined, TMeta, TStateSchema>;
93
93
  export declare function cloneMachineSnapshot<TState extends AnyMachineSnapshot>(snapshot: TState, config?: Partial<StateConfig<any, any>>): TState;
94
94
  export declare function getPersistedSnapshot<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject>(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, any>, options?: unknown): Snapshot<unknown>;
@@ -2,7 +2,7 @@ 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, 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, TMeta extends MetaObject, TConfig extends StateSchema> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, TInput, AnyActorSystem, TEmitted> {
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, TMeta extends MetaObject, TStateSchema extends StateSchema> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, 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
8
  any> & {
@@ -29,7 +29,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
29
29
  * recursively merge with the existing options.
30
30
  * @returns A new `StateMachine` instance with the provided implementations.
31
31
  */
32
- 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, TMeta, TConfig>;
32
+ 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, TMeta, TStateSchema>;
33
33
  resolveState(config: {
34
34
  value: StateValue;
35
35
  context?: TContext;
@@ -39,7 +39,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
39
39
  error?: unknown;
40
40
  } & (Equals<TContext, MachineContext> extends false ? {
41
41
  context: unknown;
42
- } : {})): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
42
+ } : {})): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>;
43
43
  /**
44
44
  * Determines the next snapshot given the current `snapshot` and received
45
45
  * `event`. Calculates a full macrostep from all microsteps.
@@ -47,7 +47,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
47
47
  * @param snapshot The current snapshot
48
48
  * @param event The received event
49
49
  */
50
- transition(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, actorScope: ActorScope<typeof snapshot, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
50
+ transition(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, event: TEvent, actorScope: ActorScope<typeof snapshot, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>;
51
51
  /**
52
52
  * Determines the next state given the current `state` and `event`. Calculates
53
53
  * a microstep.
@@ -55,8 +55,8 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
55
55
  * @param state The current state
56
56
  * @param event The received event
57
57
  */
58
- microstep(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, actorScope: AnyActorScope): Array<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>>;
59
- getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>>;
58
+ microstep(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, event: TEvent, actorScope: AnyActorScope): Array<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>>;
59
+ getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, event: TEvent): Array<TransitionDefinition<TContext, TEvent>>;
60
60
  /**
61
61
  * The initial state _before_ evaluating any microsteps. This "pre-initial"
62
62
  * state is provided to initial actions executed in the initial state.
@@ -66,11 +66,11 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
66
66
  * Returns the initial `State` instance, with reference to `self` as an
67
67
  * `ActorRef`.
68
68
  */
69
- getInitialSnapshot(actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>, input?: TInput): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
70
- start(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>): void;
69
+ getInitialSnapshot(actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, TEvent, AnyActorSystem, TEmitted>, input?: TInput): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>;
70
+ start(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>): void;
71
71
  getStateNodeById(stateId: string): StateNode<TContext, TEvent>;
72
72
  get definition(): StateMachineDefinition<TContext, TEvent>;
73
73
  toJSON(): StateMachineDefinition<TContext, TEvent>;
74
- getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, options?: unknown): Snapshot<unknown>;
75
- restoreSnapshot(snapshot: Snapshot<unknown>, _actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
74
+ getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, options?: unknown): Snapshot<unknown>;
75
+ restoreSnapshot(snapshot: Snapshot<unknown>, _actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>;
76
76
  }
@@ -1,4 +1,4 @@
1
- import { EventObject } from "./types.js";
1
+ import { EventDescriptor, EventObject, ExtractEvent } from "./types.js";
2
2
  /**
3
3
  * Asserts that the given event object is of the specified type or types. Throws
4
4
  * an error if the event object is not of the specified types.
@@ -22,6 +22,4 @@ import { EventObject } from "./types.js";
22
22
  * },
23
23
  * ```
24
24
  */
25
- export declare function assertEvent<TEvent extends EventObject, TAssertedType extends TEvent['type']>(event: TEvent, type: TAssertedType | TAssertedType[]): asserts event is TEvent & {
26
- type: TAssertedType;
27
- };
25
+ export declare function assertEvent<TEvent extends EventObject, TAssertedDescriptor extends EventDescriptor<TEvent>>(event: TEvent, type: TAssertedDescriptor | readonly TAssertedDescriptor[]): asserts event is ExtractEvent<TEvent, TAssertedDescriptor>;
@@ -9,20 +9,25 @@ import { sendTo } from "./actions/send.js";
9
9
  import { spawnChild } from "./actions/spawnChild.js";
10
10
  import { stopChild } from "./actions/stopChild.js";
11
11
  import { GuardPredicate } from "./guards.js";
12
- import { ActionFunction, AnyActorRef, AnyEventObject, Cast, DelayConfig, EventObject, Invert, IsNever, MachineConfig, MachineContext, MetaObject, NonReducibleUnknown, ParameterizedObject, SetupTypes, StateNodeConfig, ToChildren, ToStateValue, UnknownActorLogic, Values } from "./types.js";
13
- type ToParameterizedObject<TParameterizedMap extends Record<string, ParameterizedObject['params'] | undefined>> = IsNever<TParameterizedMap> extends true ? never : Values<{
14
- [K in keyof TParameterizedMap & string]: {
15
- type: K;
12
+ import { ActionFunction, AnyActorRef, AnyEventObject, Cast, DelayConfig, EventObject, Invert, IsNever, MachineConfig, MachineContext, MetaObject, NonReducibleUnknown, ParameterizedObject, SetupTypes, StateNodeConfig, StateSchema, ToChildren, ToStateValue, UnknownActorLogic, Values } from "./types.js";
13
+ type ToParameterizedObject<TParameterizedMap extends Record<string, ParameterizedObject['params'] | undefined>> = Values<{
14
+ [K in keyof TParameterizedMap as K & string]: {
15
+ type: K & string;
16
16
  params: TParameterizedMap[K];
17
17
  };
18
18
  }>;
19
- type ToProvidedActor<TChildrenMap extends Record<string, string>, TActors extends Record<string, UnknownActorLogic>> = IsNever<TActors> extends true ? never : Values<{
20
- [K in keyof TActors & string]: {
21
- src: K;
19
+ type ToProvidedActor<TChildrenMap extends Record<string, string>, TActors extends Record<string, UnknownActorLogic>> = Values<{
20
+ [K in keyof TActors as K & string]: {
21
+ src: K & string;
22
22
  logic: TActors[K];
23
23
  id: IsNever<TChildrenMap> extends true ? string | undefined : K extends keyof Invert<TChildrenMap> ? Invert<TChildrenMap>[K] & string : string | undefined;
24
24
  };
25
25
  }>;
26
+ type ToStateSchema<TSchema extends StateSchema> = {
27
+ -readonly [K in keyof TSchema as K & ('id' | 'states')]: K extends 'states' ? {
28
+ [SK in keyof TSchema['states']]: ToStateSchema<NonNullable<TSchema['states'][SK]>>;
29
+ } : TSchema[K];
30
+ };
26
31
  type RequiredSetupKeys<TChildrenMap> = IsNever<keyof TChildrenMap> extends true ? never : 'actors';
27
32
  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, TMeta extends MetaObject> = {
28
33
  extend: <TExtendActions extends Record<string, ParameterizedObject['params'] | undefined> = {}, TExtendGuards extends Record<string, ParameterizedObject['params'] | undefined> = {}, TExtendDelays extends string = never>({ actions, guards, delays }: {
@@ -91,7 +96,7 @@ type SetupReturn<TContext extends MachineContext, TEvent extends AnyEventObject,
91
96
  * ```
92
97
  */
93
98
  createAction: (action: ActionFunction<TContext, TEvent, TEvent, unknown, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TEmitted>) => typeof action;
94
- createMachine: <const TConfig extends MachineConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, TInput, TOutput, TEmitted, TMeta>>(config: TConfig) => StateMachine<TContext, TEvent, Cast<ToChildren<ToProvidedActor<TChildrenMap, TActors>>, Record<string, AnyActorRef | undefined>>, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, ToStateValue<TConfig>, TTag, TInput, TOutput, TEmitted, TMeta, TConfig>;
99
+ createMachine: <const TConfig extends MachineConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, TInput, TOutput, TEmitted, TMeta>>(config: TConfig) => StateMachine<TContext, TEvent, Cast<ToChildren<ToProvidedActor<TChildrenMap, TActors>>, Record<string, AnyActorRef | undefined>>, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, ToStateValue<TConfig>, TTag, TInput, TOutput, TEmitted, TMeta, ToStateSchema<TConfig>>;
95
100
  assign: typeof assign<TContext, TEvent, undefined, TEvent, ToProvidedActor<TChildrenMap, TActors>>;
96
101
  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>>;
97
102
  raise: typeof raise<TContext, TEvent, TEvent, undefined, TDelay, TDelay>;
@@ -989,7 +989,7 @@ export interface ExecutableSpawnAction extends ExecutableActionObject {
989
989
  };
990
990
  }
991
991
  export type SpecialExecutableAction = ExecutableSpawnAction | ExecutableRaiseAction | ExecutableSendToAction;
992
- export type ExecutableActionsFrom<T extends AnyActorLogic> = T extends StateMachine<infer _TContext, infer _TEvent, infer _TChildren, infer _TActor, infer TAction, infer _TGuard, infer _TDelay, infer _TStateValue, infer _TTag, infer _TInput, infer _TOutput, infer _TEmitted, infer _TMeta, infer _TConfig> ? SpecialExecutableAction | (string extends TAction['type'] ? never : ToExecutableAction<TAction>) : never;
992
+ export type ExecutableActionsFrom<T extends AnyActorLogic> = T extends StateMachine<infer _TContext, infer _TEvent, infer _TChildren, infer _TActor, infer TAction, infer _TGuard, infer _TDelay, infer _TStateValue, infer _TTag, infer _TInput, infer _TOutput, infer _TEmitted, infer _TMeta, infer _TStateSchema> ? SpecialExecutableAction | (string extends TAction['type'] ? never : ToExecutableAction<TAction>) : never;
993
993
  export type ActionExecutor = (actionToExecute: ExecutableActionObject) => void;
994
994
  export type BuiltinActionResolution = [
995
995
  AnyMachineSnapshot,
@@ -15,3 +15,16 @@ export declare function toObserver<T>(nextHandler?: Observer<T> | ((value: T) =>
15
15
  export declare function createInvokeId(stateNodeId: string, index: number): string;
16
16
  export declare function resolveReferencedActor(machine: AnyStateMachine, src: string): any;
17
17
  export declare function getAllOwnEventDescriptors(snapshot: AnyMachineSnapshot): any[];
18
+ /**
19
+ * Checks if an event type matches an event descriptor, supporting wildcards.
20
+ * Event descriptors can be:
21
+ *
22
+ * - Exact matches: "event.type"
23
+ * - Wildcard: "*"
24
+ * - Partial matches: "event.*"
25
+ *
26
+ * @param eventType - The actual event type string
27
+ * @param descriptor - The event descriptor to match against
28
+ * @returns True if the event type matches the descriptor
29
+ */
30
+ export declare function matchesEventDescriptor(eventType: string, descriptor: string): boolean;
@@ -1,5 +1,5 @@
1
- import { T as executingCustomAction, U as XSTATE_ERROR, V as createErrorActorEvent, w as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-c096f887.development.esm.js';
2
- import { a as assign } from './assign-445527dc.development.esm.js';
1
+ import { U as executingCustomAction, V as XSTATE_ERROR, W as createErrorActorEvent, x as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-235fa0c7.development.esm.js';
2
+ import { a as assign } from './assign-ef1b62f6.development.esm.js';
3
3
 
4
4
  function resolveEmit(_, snapshot, args, actionParams, {
5
5
  event: eventOrExpr
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-f777a9e8.development.cjs.js');
4
- var assign = require('./assign-9e730107.development.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-723edf2d.development.cjs.js');
4
+ var assign = require('./assign-97062f30.development.cjs.js');
5
5
 
6
6
  function resolveEmit(_, snapshot, args, actionParams, {
7
7
  event: eventOrExpr
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-da5b247f.cjs.js');
4
- var assign = require('./assign-dea9f7c8.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-ad4f12ad.cjs.js');
4
+ var assign = require('./assign-ae103a72.cjs.js');
5
5
 
6
6
  function resolveEmit(_, snapshot, args, actionParams, {
7
7
  event: eventOrExpr
@@ -1,5 +1,5 @@
1
- import { T as XSTATE_ERROR, U as createErrorActorEvent, w as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-9ad1c5c6.esm.js';
2
- import { a as assign } from './assign-ab9cc19e.esm.js';
1
+ import { U as XSTATE_ERROR, V as createErrorActorEvent, x as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-da2ff7ca.esm.js';
2
+ import { a as assign } from './assign-fd69c737.esm.js';
3
3
 
4
4
  function resolveEmit(_, snapshot, args, actionParams, {
5
5
  event: eventOrExpr
@@ -286,6 +286,50 @@ function getAllOwnEventDescriptors(snapshot) {
286
286
  return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
287
287
  }
288
288
 
289
+ /**
290
+ * Checks if an event type matches an event descriptor, supporting wildcards.
291
+ * Event descriptors can be:
292
+ *
293
+ * - Exact matches: "event.type"
294
+ * - Wildcard: "*"
295
+ * - Partial matches: "event.*"
296
+ *
297
+ * @param eventType - The actual event type string
298
+ * @param descriptor - The event descriptor to match against
299
+ * @returns True if the event type matches the descriptor
300
+ */
301
+ function matchesEventDescriptor(eventType, descriptor) {
302
+ if (descriptor === eventType) {
303
+ return true;
304
+ }
305
+ if (descriptor === WILDCARD) {
306
+ return true;
307
+ }
308
+ if (!descriptor.endsWith('.*')) {
309
+ return false;
310
+ }
311
+ if (/.*\*.+/.test(descriptor)) {
312
+ console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${descriptor}" event.`);
313
+ }
314
+ const partialEventTokens = descriptor.split('.');
315
+ const eventTokens = eventType.split('.');
316
+ for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
317
+ const partialEventToken = partialEventTokens[tokenIndex];
318
+ const eventToken = eventTokens[tokenIndex];
319
+ if (partialEventToken === '*') {
320
+ const isLastToken = tokenIndex === partialEventTokens.length - 1;
321
+ if (!isLastToken) {
322
+ console.warn(`Infix wildcards in transition events are not allowed. Check the "${descriptor}" transition.`);
323
+ }
324
+ return isLastToken;
325
+ }
326
+ if (partialEventToken !== eventToken) {
327
+ return false;
328
+ }
329
+ }
330
+ return true;
331
+ }
332
+
289
333
  function createScheduledEventId(actorRef, id) {
290
334
  return `${actorRef.sessionId}.${id}`;
291
335
  }
@@ -1622,36 +1666,7 @@ function isInFinalState(stateNodeSet, stateNode) {
1622
1666
  }
1623
1667
  const isStateId = str => str[0] === STATE_IDENTIFIER;
1624
1668
  function getCandidates(stateNode, receivedEventType) {
1625
- const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(eventDescriptor => {
1626
- // check if transition is a wildcard transition,
1627
- // which matches any non-transient events
1628
- if (eventDescriptor === WILDCARD) {
1629
- return true;
1630
- }
1631
- if (!eventDescriptor.endsWith('.*')) {
1632
- return false;
1633
- }
1634
- if (/.*\*.+/.test(eventDescriptor)) {
1635
- console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${eventDescriptor}" event.`);
1636
- }
1637
- const partialEventTokens = eventDescriptor.split('.');
1638
- const eventTokens = receivedEventType.split('.');
1639
- for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
1640
- const partialEventToken = partialEventTokens[tokenIndex];
1641
- const eventToken = eventTokens[tokenIndex];
1642
- if (partialEventToken === '*') {
1643
- const isLastToken = tokenIndex === partialEventTokens.length - 1;
1644
- if (!isLastToken) {
1645
- console.warn(`Infix wildcards in transition events are not allowed. Check the "${eventDescriptor}" transition.`);
1646
- }
1647
- return isLastToken;
1648
- }
1649
- if (partialEventToken !== eventToken) {
1650
- return false;
1651
- }
1652
- }
1653
- return true;
1654
- }).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
1669
+ const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(eventDescriptor => matchesEventDescriptor(receivedEventType, eventDescriptor)).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
1655
1670
  return candidates;
1656
1671
  }
1657
1672
 
@@ -2712,4 +2727,4 @@ function raise(eventOrExpr, options) {
2712
2727
  return raise;
2713
2728
  }
2714
2729
 
2715
- export { $$ACTOR_TYPE as $, Actor as A, getCandidates as B, resolveStateValue as C, getAllStateNodes as D, createMachineSnapshot as E, isInFinalState as F, macrostep as G, transitionNode as H, resolveActionsAndContext as I, createInitEvent as J, microstep as K, getInitialStateNodes as L, toStatePath as M, NULL_EVENT as N, isStateId as O, getStateNodeByPath as P, getPersistedSnapshot as Q, resolveReferencedActor as R, STATE_DELIMITER as S, executingCustomAction as T, XSTATE_ERROR as U, createErrorActorEvent as V, ProcessingStatus as W, XSTATE_STOP as X, cloneMachineSnapshot as Y, cancel as a, spawnChild as b, createActor as c, and as d, stateIn as e, isMachineSnapshot as f, getStateNodes as g, getAllOwnEventDescriptors as h, interpret as i, toObserver as j, stop as k, mapValues as l, matchesState as m, not as n, or as o, pathToStateValue as p, formatTransitions as q, raise as r, stopChild as s, toArray as t, toTransitionConfigArray as u, formatTransition as v, evaluateGuard as w, createInvokeId as x, getDelayedTransitions as y, formatInitialTransition as z };
2730
+ export { $$ACTOR_TYPE as $, Actor as A, formatInitialTransition as B, getCandidates as C, resolveStateValue as D, getAllStateNodes as E, createMachineSnapshot as F, isInFinalState as G, macrostep as H, transitionNode as I, resolveActionsAndContext as J, createInitEvent as K, microstep as L, getInitialStateNodes as M, NULL_EVENT as N, toStatePath as O, isStateId as P, getStateNodeByPath as Q, getPersistedSnapshot as R, STATE_DELIMITER as S, resolveReferencedActor as T, executingCustomAction as U, XSTATE_ERROR as V, createErrorActorEvent as W, XSTATE_STOP as X, ProcessingStatus as Y, cloneMachineSnapshot as Z, cancel as a, spawnChild as b, createActor as c, and as d, stateIn as e, isMachineSnapshot as f, getStateNodes as g, getAllOwnEventDescriptors as h, interpret as i, matchesState as j, toObserver as k, stop as l, matchesEventDescriptor as m, not as n, or as o, pathToStateValue as p, mapValues as q, raise as r, stopChild as s, toArray as t, formatTransitions as u, toTransitionConfigArray as v, formatTransition as w, evaluateGuard as x, createInvokeId as y, getDelayedTransitions as z };
@@ -288,6 +288,50 @@ function getAllOwnEventDescriptors(snapshot) {
288
288
  return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
289
289
  }
290
290
 
291
+ /**
292
+ * Checks if an event type matches an event descriptor, supporting wildcards.
293
+ * Event descriptors can be:
294
+ *
295
+ * - Exact matches: "event.type"
296
+ * - Wildcard: "*"
297
+ * - Partial matches: "event.*"
298
+ *
299
+ * @param eventType - The actual event type string
300
+ * @param descriptor - The event descriptor to match against
301
+ * @returns True if the event type matches the descriptor
302
+ */
303
+ function matchesEventDescriptor(eventType, descriptor) {
304
+ if (descriptor === eventType) {
305
+ return true;
306
+ }
307
+ if (descriptor === WILDCARD) {
308
+ return true;
309
+ }
310
+ if (!descriptor.endsWith('.*')) {
311
+ return false;
312
+ }
313
+ if (/.*\*.+/.test(descriptor)) {
314
+ console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${descriptor}" event.`);
315
+ }
316
+ const partialEventTokens = descriptor.split('.');
317
+ const eventTokens = eventType.split('.');
318
+ for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
319
+ const partialEventToken = partialEventTokens[tokenIndex];
320
+ const eventToken = eventTokens[tokenIndex];
321
+ if (partialEventToken === '*') {
322
+ const isLastToken = tokenIndex === partialEventTokens.length - 1;
323
+ if (!isLastToken) {
324
+ console.warn(`Infix wildcards in transition events are not allowed. Check the "${descriptor}" transition.`);
325
+ }
326
+ return isLastToken;
327
+ }
328
+ if (partialEventToken !== eventToken) {
329
+ return false;
330
+ }
331
+ }
332
+ return true;
333
+ }
334
+
291
335
  function createScheduledEventId(actorRef, id) {
292
336
  return `${actorRef.sessionId}.${id}`;
293
337
  }
@@ -1624,36 +1668,7 @@ function isInFinalState(stateNodeSet, stateNode) {
1624
1668
  }
1625
1669
  const isStateId = str => str[0] === STATE_IDENTIFIER;
1626
1670
  function getCandidates(stateNode, receivedEventType) {
1627
- const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(eventDescriptor => {
1628
- // check if transition is a wildcard transition,
1629
- // which matches any non-transient events
1630
- if (eventDescriptor === WILDCARD) {
1631
- return true;
1632
- }
1633
- if (!eventDescriptor.endsWith('.*')) {
1634
- return false;
1635
- }
1636
- if (/.*\*.+/.test(eventDescriptor)) {
1637
- console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${eventDescriptor}" event.`);
1638
- }
1639
- const partialEventTokens = eventDescriptor.split('.');
1640
- const eventTokens = receivedEventType.split('.');
1641
- for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
1642
- const partialEventToken = partialEventTokens[tokenIndex];
1643
- const eventToken = eventTokens[tokenIndex];
1644
- if (partialEventToken === '*') {
1645
- const isLastToken = tokenIndex === partialEventTokens.length - 1;
1646
- if (!isLastToken) {
1647
- console.warn(`Infix wildcards in transition events are not allowed. Check the "${eventDescriptor}" transition.`);
1648
- }
1649
- return isLastToken;
1650
- }
1651
- if (partialEventToken !== eventToken) {
1652
- return false;
1653
- }
1654
- }
1655
- return true;
1656
- }).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
1671
+ const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(eventDescriptor => matchesEventDescriptor(receivedEventType, eventDescriptor)).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
1657
1672
  return candidates;
1658
1673
  }
1659
1674
 
@@ -2747,6 +2762,7 @@ exports.isMachineSnapshot = isMachineSnapshot;
2747
2762
  exports.isStateId = isStateId;
2748
2763
  exports.macrostep = macrostep;
2749
2764
  exports.mapValues = mapValues;
2765
+ exports.matchesEventDescriptor = matchesEventDescriptor;
2750
2766
  exports.matchesState = matchesState;
2751
2767
  exports.microstep = microstep;
2752
2768
  exports.not = not;
@@ -285,6 +285,44 @@ function getAllOwnEventDescriptors(snapshot) {
285
285
  return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
286
286
  }
287
287
 
288
+ /**
289
+ * Checks if an event type matches an event descriptor, supporting wildcards.
290
+ * Event descriptors can be:
291
+ *
292
+ * - Exact matches: "event.type"
293
+ * - Wildcard: "*"
294
+ * - Partial matches: "event.*"
295
+ *
296
+ * @param eventType - The actual event type string
297
+ * @param descriptor - The event descriptor to match against
298
+ * @returns True if the event type matches the descriptor
299
+ */
300
+ function matchesEventDescriptor(eventType, descriptor) {
301
+ if (descriptor === eventType) {
302
+ return true;
303
+ }
304
+ if (descriptor === WILDCARD) {
305
+ return true;
306
+ }
307
+ if (!descriptor.endsWith('.*')) {
308
+ return false;
309
+ }
310
+ const partialEventTokens = descriptor.split('.');
311
+ const eventTokens = eventType.split('.');
312
+ for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
313
+ const partialEventToken = partialEventTokens[tokenIndex];
314
+ const eventToken = eventTokens[tokenIndex];
315
+ if (partialEventToken === '*') {
316
+ const isLastToken = tokenIndex === partialEventTokens.length - 1;
317
+ return isLastToken;
318
+ }
319
+ if (partialEventToken !== eventToken) {
320
+ return false;
321
+ }
322
+ }
323
+ return true;
324
+ }
325
+
288
326
  function createScheduledEventId(actorRef, id) {
289
327
  return `${actorRef.sessionId}.${id}`;
290
328
  }
@@ -1588,30 +1626,7 @@ function isInFinalState(stateNodeSet, stateNode) {
1588
1626
  }
1589
1627
  const isStateId = str => str[0] === STATE_IDENTIFIER;
1590
1628
  function getCandidates(stateNode, receivedEventType) {
1591
- const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(eventDescriptor => {
1592
- // check if transition is a wildcard transition,
1593
- // which matches any non-transient events
1594
- if (eventDescriptor === WILDCARD) {
1595
- return true;
1596
- }
1597
- if (!eventDescriptor.endsWith('.*')) {
1598
- return false;
1599
- }
1600
- const partialEventTokens = eventDescriptor.split('.');
1601
- const eventTokens = receivedEventType.split('.');
1602
- for (let tokenIndex = 0; tokenIndex < partialEventTokens.length; tokenIndex++) {
1603
- const partialEventToken = partialEventTokens[tokenIndex];
1604
- const eventToken = eventTokens[tokenIndex];
1605
- if (partialEventToken === '*') {
1606
- const isLastToken = tokenIndex === partialEventTokens.length - 1;
1607
- return isLastToken;
1608
- }
1609
- if (partialEventToken !== eventToken) {
1610
- return false;
1611
- }
1612
- }
1613
- return true;
1614
- }).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
1629
+ const candidates = stateNode.transitions.get(receivedEventType) || [...stateNode.transitions.keys()].filter(eventDescriptor => matchesEventDescriptor(receivedEventType, eventDescriptor)).sort((a, b) => b.length - a.length).flatMap(key => stateNode.transitions.get(key));
1615
1630
  return candidates;
1616
1631
  }
1617
1632
 
@@ -2685,6 +2700,7 @@ exports.isMachineSnapshot = isMachineSnapshot;
2685
2700
  exports.isStateId = isStateId;
2686
2701
  exports.macrostep = macrostep;
2687
2702
  exports.mapValues = mapValues;
2703
+ exports.matchesEventDescriptor = matchesEventDescriptor;
2688
2704
  exports.matchesState = matchesState;
2689
2705
  exports.microstep = microstep;
2690
2706
  exports.not = not;