xstate 5.0.0-beta.18 → 5.0.0-beta.20
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/actions/dist/xstate-actions.cjs.js +1 -1
- package/actions/dist/xstate-actions.development.cjs.js +1 -1
- package/actions/dist/xstate-actions.development.esm.js +1 -1
- package/actions/dist/xstate-actions.esm.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.esm.js +1 -1
- package/actors/dist/xstate-actors.esm.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/{actions-5fb9f10d.cjs.js → actions-069d9805.cjs.js} +311 -311
- package/dist/{actions-4d6514d2.esm.js → actions-a8a9433c.esm.js} +311 -311
- package/dist/{actions-13190b25.development.esm.js → actions-b299d008.development.esm.js} +311 -311
- package/dist/{actions-40bd643f.development.cjs.js → actions-d1c41ed3.development.cjs.js} +311 -311
- package/dist/declarations/src/Machine.d.ts +2 -2
- package/dist/declarations/src/State.d.ts +15 -4
- package/dist/declarations/src/StateMachine.d.ts +16 -16
- package/dist/declarations/src/StateNode.d.ts +4 -4
- package/dist/declarations/src/actions/send.d.ts +1 -1
- package/dist/declarations/src/actions/stop.d.ts +1 -1
- package/dist/declarations/src/actors/callback.d.ts +14 -2
- package/dist/declarations/src/actors/index.d.ts +4 -4
- package/dist/declarations/src/actors/observable.d.ts +11 -7
- package/dist/declarations/src/actors/promise.d.ts +14 -5
- package/dist/declarations/src/actors/transition.d.ts +7 -4
- package/dist/declarations/src/guards.d.ts +2 -2
- package/dist/declarations/src/stateUtils.d.ts +8 -8
- package/dist/declarations/src/typegenTypes.d.ts +15 -17
- package/dist/declarations/src/types.d.ts +103 -58
- package/dist/declarations/src/utils.d.ts +2 -2
- package/dist/xstate.cjs.js +2 -3
- package/dist/xstate.development.cjs.js +2 -3
- package/dist/xstate.development.esm.js +3 -4
- package/dist/xstate.esm.js +3 -4
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.esm.js +1 -1
- package/guards/dist/xstate-guards.esm.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import type { State } from "./State.js";
|
|
|
3
3
|
import type { ActorStatus, Clock, Interpreter } from "./interpreter.js";
|
|
4
4
|
import type { StateMachine } from "./StateMachine.js";
|
|
5
5
|
import { TypegenDisabled, ResolveTypegenMeta, TypegenConstraint, MarkAllImplementationsAsProvided, AreAllImplementationsAssumedToBeProvided } from "./typegenTypes.js";
|
|
6
|
-
import {
|
|
6
|
+
import { PromiseActorLogic } from "./actors/promise.js";
|
|
7
7
|
export type AnyFunction = (...args: any[]) => any;
|
|
8
8
|
type ReturnTypeOrValue<T> = T extends AnyFunction ? ReturnType<T> : T;
|
|
9
9
|
export type IsNever<T> = [T] extends [never] ? true : false;
|
|
@@ -13,11 +13,12 @@ export type Compute<A extends any> = {
|
|
|
13
13
|
export type Prop<T, K> = K extends keyof T ? T[K] : never;
|
|
14
14
|
export type Values<T> = T[keyof T];
|
|
15
15
|
export type Merge<M, N> = Omit<M, keyof N> & N;
|
|
16
|
+
export type IndexByProp<T extends Record<P, string>, P extends keyof T> = {
|
|
17
|
+
[E in T as E[P]]: E;
|
|
18
|
+
};
|
|
16
19
|
export type IndexByType<T extends {
|
|
17
20
|
type: string;
|
|
18
|
-
}> =
|
|
19
|
-
[K in T['type']]: T extends any ? (K extends T['type'] ? T : never) : never;
|
|
20
|
-
};
|
|
21
|
+
}> = IndexByProp<T, 'type'>;
|
|
21
22
|
export type Equals<A1 extends any, A2 extends any> = (<A>() => A extends A2 ? true : false) extends <A>() => A extends A1 ? true : false ? true : false;
|
|
22
23
|
export type IsAny<T> = Equals<T, any>;
|
|
23
24
|
export type Cast<A, B> = A extends B ? A : B;
|
|
@@ -54,12 +55,14 @@ export type MachineContext = Record<string, any>;
|
|
|
54
55
|
export interface ActionArgs<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject> extends UnifiedArg<TContext, TEvent> {
|
|
55
56
|
action: TAction;
|
|
56
57
|
}
|
|
57
|
-
export type
|
|
58
|
+
export type InputFrom<T extends AnyActorLogic> = T extends ActorLogic<infer _TEvent, infer _TSnapshot, infer _TInternalState, infer _TPersisted, infer _TSystem, infer TInput> ? TInput : never;
|
|
59
|
+
export type OutputFrom<T extends AnyActorLogic> = T extends ActorLogic<infer _TEvent, infer _TSnapshot, infer _TInternalState, infer _TPersisted, infer _TSystem, infer _TInput, infer TOutput> ? TOutput : never;
|
|
60
|
+
export type Spawner = <T extends AnyActorLogic | string>(// TODO: read string from machine logic keys
|
|
58
61
|
logic: T, options?: Partial<{
|
|
59
62
|
id: string;
|
|
60
63
|
systemId?: string;
|
|
61
|
-
input: any;
|
|
62
|
-
}>) => T
|
|
64
|
+
input: T extends AnyActorLogic ? InputFrom<T> : any;
|
|
65
|
+
}>) => ActorRefFrom<T>;
|
|
63
66
|
export interface AssignArgs<TContext extends MachineContext, TExpressionEvent extends EventObject> extends ActionArgs<TContext, TExpressionEvent> {
|
|
64
67
|
spawn: Spawner;
|
|
65
68
|
}
|
|
@@ -95,9 +98,9 @@ export interface DefaultGuardObject<TContext extends MachineContext, TEvent exte
|
|
|
95
98
|
children?: Array<GuardObject<TContext, TEvent>>;
|
|
96
99
|
predicate?: GuardPredicate<TContext, TEvent>;
|
|
97
100
|
}
|
|
98
|
-
export type GuardEvaluator<TContext extends MachineContext, TEvent extends EventObject> = (guard: GuardDefinition<TContext, TEvent>, context: TContext, event: TEvent, state: State<TContext, TEvent>) => boolean;
|
|
101
|
+
export type GuardEvaluator<TContext extends MachineContext, TEvent extends EventObject> = (guard: GuardDefinition<TContext, TEvent>, context: TContext, event: TEvent, state: State<TContext, TEvent, TODO>) => boolean;
|
|
99
102
|
export interface GuardArgs<TContext extends MachineContext, TEvent extends EventObject> {
|
|
100
|
-
state: State<TContext, TEvent,
|
|
103
|
+
state: State<TContext, TEvent, TODO>;
|
|
101
104
|
guard: GuardDefinition<TContext, TEvent>;
|
|
102
105
|
evaluate: GuardEvaluator<TContext, TEvent>;
|
|
103
106
|
}
|
|
@@ -143,13 +146,6 @@ export interface InitialTransitionConfig<TContext extends MachineContext, TEvent
|
|
|
143
146
|
target: TransitionTarget;
|
|
144
147
|
}
|
|
145
148
|
export type Transition<TContext extends MachineContext, TEvent extends EventObject = EventObject> = string | TransitionConfig<TContext, TEvent> | ConditionalTransitionConfig<TContext, TEvent>;
|
|
146
|
-
export type Receiver<TEvent extends EventObject> = (listener: {
|
|
147
|
-
bivarianceHack(event: TEvent): void;
|
|
148
|
-
}['bivarianceHack']) => void;
|
|
149
|
-
export type InvokeCallback<TEvent extends EventObject = AnyEventObject, TSentEvent extends EventObject = AnyEventObject> = (sendBack: (event: TSentEvent) => void, onReceive: Receiver<TEvent>, { input, system }: {
|
|
150
|
-
input: any;
|
|
151
|
-
system: AnyActorSystem;
|
|
152
|
-
}) => (() => void) | Promise<any> | void;
|
|
153
149
|
export interface InvokeMeta {
|
|
154
150
|
src: string;
|
|
155
151
|
meta: MetaObject | undefined;
|
|
@@ -189,8 +185,8 @@ export type SingleOrArray<T> = T[] | T;
|
|
|
189
185
|
export type StateNodesConfig<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
190
186
|
[K in string]: StateNode<TContext, TEvent>;
|
|
191
187
|
};
|
|
192
|
-
export type StatesConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject
|
|
193
|
-
[K in string]: StateNodeConfig<TContext, TEvent, TAction>;
|
|
188
|
+
export type StatesConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject, TActor extends ProvidedActor> = {
|
|
189
|
+
[K in string]: StateNodeConfig<TContext, TEvent, TAction, TActor>;
|
|
194
190
|
};
|
|
195
191
|
export type StatesDefinition<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
196
192
|
[K in string]: StateNodeDefinition<TContext, TEvent>;
|
|
@@ -200,7 +196,43 @@ export type TransitionConfigOrTarget<TContext extends MachineContext, TExpressio
|
|
|
200
196
|
export type TransitionsConfig<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
201
197
|
[K in TEvent['type'] | '*']?: K extends '*' ? TransitionConfigOrTarget<TContext, TEvent> : TransitionConfigOrTarget<TContext, ExtractEvent<TEvent, K>, TEvent>;
|
|
202
198
|
};
|
|
203
|
-
|
|
199
|
+
type IsLiteralString<T extends string> = string extends T ? false : true;
|
|
200
|
+
type DistributeActors<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor> = TActor extends {
|
|
201
|
+
src: infer TSrc;
|
|
202
|
+
} ? Compute<{
|
|
203
|
+
systemId?: string;
|
|
204
|
+
/**
|
|
205
|
+
* The source of the machine to be invoked, or the machine itself.
|
|
206
|
+
*/
|
|
207
|
+
src: TSrc;
|
|
208
|
+
input?: Mapper<TContext, TEvent, InputFrom<TActor['logic']>> | InputFrom<TActor['logic']>;
|
|
209
|
+
/**
|
|
210
|
+
* The transition to take upon the invoked child machine reaching its final top-level state.
|
|
211
|
+
*/
|
|
212
|
+
onDone?: string | SingleOrArray<TransitionConfigOrTarget<TContext, DoneInvokeEvent<OutputFrom<TActor['logic']>>, TEvent>>;
|
|
213
|
+
/**
|
|
214
|
+
* The transition to take upon the invoked child machine sending an error event.
|
|
215
|
+
*/
|
|
216
|
+
onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorEvent<any>, TEvent>>;
|
|
217
|
+
onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent<any>, TEvent>>;
|
|
218
|
+
/**
|
|
219
|
+
* Meta data related to this invocation
|
|
220
|
+
*/
|
|
221
|
+
meta?: MetaObject;
|
|
222
|
+
} & (TActor['id'] extends string ? {
|
|
223
|
+
/**
|
|
224
|
+
* The unique identifier for the invoked machine. If not specified, this
|
|
225
|
+
* will be the machine's own `id`, or the URL (from `src`).
|
|
226
|
+
*/
|
|
227
|
+
id: TActor['id'];
|
|
228
|
+
} : {
|
|
229
|
+
/**
|
|
230
|
+
* The unique identifier for the invoked machine. If not specified, this
|
|
231
|
+
* will be the machine's own `id`, or the URL (from `src`).
|
|
232
|
+
*/
|
|
233
|
+
id?: string;
|
|
234
|
+
})> : never;
|
|
235
|
+
export type InvokeConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor> = IsLiteralString<TActor['src']> extends true ? DistributeActors<TContext, TEvent, TActor> : {
|
|
204
236
|
/**
|
|
205
237
|
* The unique identifier for the invoked machine. If not specified, this
|
|
206
238
|
* will be the machine's own `id`, or the URL (from `src`).
|
|
@@ -210,7 +242,7 @@ export interface InvokeConfig<TContext extends MachineContext, TEvent extends Ev
|
|
|
210
242
|
/**
|
|
211
243
|
* The source of the machine to be invoked, or the machine itself.
|
|
212
244
|
*/
|
|
213
|
-
src:
|
|
245
|
+
src: AnyActorLogic | string;
|
|
214
246
|
input?: Mapper<TContext, TEvent, any> | any;
|
|
215
247
|
/**
|
|
216
248
|
* The transition to take upon the invoked child machine reaching its final top-level state.
|
|
@@ -225,8 +257,8 @@ export interface InvokeConfig<TContext extends MachineContext, TEvent extends Ev
|
|
|
225
257
|
* Meta data related to this invocation
|
|
226
258
|
*/
|
|
227
259
|
meta?: MetaObject;
|
|
228
|
-
}
|
|
229
|
-
export interface StateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject
|
|
260
|
+
};
|
|
261
|
+
export interface StateNodeConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject, TActor extends ProvidedActor> {
|
|
230
262
|
/**
|
|
231
263
|
* The initial state transition.
|
|
232
264
|
*/
|
|
@@ -250,11 +282,11 @@ export interface StateNodeConfig<TContext extends MachineContext, TEvent extends
|
|
|
250
282
|
/**
|
|
251
283
|
* The mapping of state node keys to their state node configurations (recursive).
|
|
252
284
|
*/
|
|
253
|
-
states?: StatesConfig<TContext, TEvent, TAction> | undefined;
|
|
285
|
+
states?: StatesConfig<TContext, TEvent, TAction, TActor> | undefined;
|
|
254
286
|
/**
|
|
255
287
|
* The services to invoke upon entering this state node. These services will be stopped upon exiting this state node.
|
|
256
288
|
*/
|
|
257
|
-
invoke?: SingleOrArray<
|
|
289
|
+
invoke?: SingleOrArray<TActor['src'] | InvokeConfig<TContext, TEvent, TActor>>;
|
|
258
290
|
/**
|
|
259
291
|
* The mapping of event types to their potential transition(s).
|
|
260
292
|
*/
|
|
@@ -342,10 +374,10 @@ export interface StateMachineDefinition<TContext extends MachineContext, TEvent
|
|
|
342
374
|
}
|
|
343
375
|
export type AnyStateNode = StateNode<any, any>;
|
|
344
376
|
export type AnyStateNodeDefinition = StateNodeDefinition<any, any>;
|
|
345
|
-
export type AnyState = State<any, any, any>;
|
|
377
|
+
export type AnyState = State<any, any, any, any>;
|
|
346
378
|
export type AnyStateMachine = StateMachine<any, any, any, any, any>;
|
|
347
379
|
export type AnyStateConfig = StateConfig<any, AnyEventObject>;
|
|
348
|
-
export interface AtomicStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> extends StateNodeConfig<TContext, TEvent> {
|
|
380
|
+
export interface AtomicStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> extends StateNodeConfig<TContext, TEvent, TODO, TODO> {
|
|
349
381
|
initial?: undefined;
|
|
350
382
|
parallel?: false | undefined;
|
|
351
383
|
states?: undefined;
|
|
@@ -363,7 +395,7 @@ export interface FinalStateNodeConfig<TContext extends MachineContext, TEvent ex
|
|
|
363
395
|
*/
|
|
364
396
|
output?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
|
|
365
397
|
}
|
|
366
|
-
export type SimpleOrStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> = AtomicStateNodeConfig<TContext, TEvent> | StateNodeConfig<TContext, TEvent>;
|
|
398
|
+
export type SimpleOrStateNodeConfig<TContext extends MachineContext, TEvent extends EventObject> = AtomicStateNodeConfig<TContext, TEvent> | StateNodeConfig<TContext, TEvent, TODO, TODO>;
|
|
367
399
|
export type ActionFunctionMap<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject> = {
|
|
368
400
|
[K in TAction['type']]?: ActionFunction<TContext, TEvent, TEvent, TAction extends {
|
|
369
401
|
type: K;
|
|
@@ -383,18 +415,18 @@ export interface MachineImplementationsSimplified<TContext extends MachineContex
|
|
|
383
415
|
type MachineImplementationsActions<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingActions = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingActions'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>> = {
|
|
384
416
|
[K in keyof TEventsCausingActions]?: ActionFunction<TContext, Cast<Prop<TIndexedEvents, TEventsCausingActions[K]>, EventObject>, Cast<Prop<TIndexedEvents, keyof TIndexedEvents>, EventObject>, ParameterizedObject>;
|
|
385
417
|
};
|
|
418
|
+
type MachineImplementationsActors<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingActors = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingActors'>, TIndexedActors = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedActors'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>, _TInvokeSrcNameMap = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'invokeSrcNameMap'>> = {
|
|
419
|
+
[K in keyof TIndexedActors]?: Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic> | {
|
|
420
|
+
src: Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic>;
|
|
421
|
+
input: Mapper<TContext, Cast<Prop<TIndexedEvents, K extends keyof TEventsCausingActors ? TEventsCausingActors[K] : TIndexedEvents[keyof TIndexedEvents]>, EventObject>, InputFrom<Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic>>> | InputFrom<Cast<Prop<TIndexedActors[K], 'logic'>, AnyActorLogic>>;
|
|
422
|
+
};
|
|
423
|
+
};
|
|
386
424
|
type MachineImplementationsDelays<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingDelays = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingDelays'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>> = {
|
|
387
425
|
[K in keyof TEventsCausingDelays]?: DelayConfig<TContext, Cast<Prop<TIndexedEvents, TEventsCausingDelays[K]>, EventObject>>;
|
|
388
426
|
};
|
|
389
427
|
type MachineImplementationsGuards<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingGuards = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingGuards'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>> = {
|
|
390
428
|
[K in keyof TEventsCausingGuards]?: GuardPredicate<TContext, Cast<Prop<TIndexedEvents, TEventsCausingGuards[K]>, EventObject>> | GuardConfig<TContext, Cast<Prop<TIndexedEvents, TEventsCausingGuards[K]>, EventObject>>;
|
|
391
429
|
};
|
|
392
|
-
type MachineImplementationsActors<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingActors = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingActors'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>, _TInvokeSrcNameMap = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'invokeSrcNameMap'>> = {
|
|
393
|
-
[K in keyof TEventsCausingActors]?: AnyActorLogic | {
|
|
394
|
-
src: AnyActorLogic;
|
|
395
|
-
input: Mapper<TContext, Cast<Prop<TIndexedEvents, TEventsCausingActors[K]>, EventObject>, any> | any;
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
430
|
type MakeKeysRequired<T extends string> = {
|
|
399
431
|
[K in T]: unknown;
|
|
400
432
|
};
|
|
@@ -413,34 +445,39 @@ type GenerateDelaysImplementationsPart<TContext extends MachineContext, TResolve
|
|
|
413
445
|
type GenerateGuardsImplementationsPart<TContext extends MachineContext, TResolvedTypesMeta, TRequireMissingImplementations, TMissingImplementations> = Compute<MaybeMakeMissingImplementationsRequired<'guards', Prop<TMissingImplementations, 'guards'>, TRequireMissingImplementations> & {
|
|
414
446
|
guards?: MachineImplementationsGuards<TContext, TResolvedTypesMeta>;
|
|
415
447
|
}>;
|
|
416
|
-
export type InternalMachineImplementations<TContext extends MachineContext,
|
|
417
|
-
export type MachineImplementations<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject,
|
|
448
|
+
export type InternalMachineImplementations<TContext extends MachineContext, TEvent extends EventObject, _TAction extends ParameterizedObject, TActor extends ProvidedActor, TResolvedTypesMeta, TRequireMissingImplementations extends boolean = false, TMissingImplementations = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'missingImplementations'>> = Compute<GenerateActionsImplementationsPart<TContext, TResolvedTypesMeta, TRequireMissingImplementations, TMissingImplementations> & GenerateActorsImplementationsPart<TContext, TResolvedTypesMeta, TRequireMissingImplementations, TMissingImplementations> & GenerateDelaysImplementationsPart<TContext, TResolvedTypesMeta, TRequireMissingImplementations, TMissingImplementations> & GenerateGuardsImplementationsPart<TContext, TResolvedTypesMeta, TRequireMissingImplementations, TMissingImplementations>>;
|
|
449
|
+
export type MachineImplementations<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject, TActor extends ProvidedActor = ProvidedActor, TTypesMeta extends TypegenConstraint = TypegenDisabled> = InternalMachineImplementations<TContext, TEvent, TAction, TActor, ResolveTypegenMeta<TTypesMeta, TEvent, TAction, TActor>>;
|
|
418
450
|
type InitialContext<TContext extends MachineContext> = TContext | ContextFactory<TContext>;
|
|
419
451
|
export type ContextFactory<TContext extends MachineContext> = ({ spawn, input }: {
|
|
420
452
|
spawn: Spawner;
|
|
421
453
|
input: any;
|
|
422
454
|
}) => TContext;
|
|
423
|
-
export
|
|
455
|
+
export type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject, TActor extends ProvidedActor = ProvidedActor, TTypesMeta = TypegenDisabled> = (StateNodeConfig<NoInfer<TContext>, NoInfer<TEvent>, NoInfer<TAction>, NoInfer<TActor>> & {
|
|
424
456
|
/**
|
|
425
457
|
* The initial context (extended state)
|
|
426
458
|
*/
|
|
427
|
-
context?: InitialContext<LowInfer<TContext>>;
|
|
428
459
|
/**
|
|
429
460
|
* The machine's own version.
|
|
430
461
|
*/
|
|
431
462
|
version?: string;
|
|
432
|
-
types?: MachineTypes<TContext, TEvent,
|
|
463
|
+
types?: MachineTypes<TContext, TEvent, TActor, TTypesMeta>;
|
|
464
|
+
}) & (Equals<TContext, MachineContext> extends true ? {
|
|
465
|
+
context?: InitialContext<LowInfer<TContext>>;
|
|
466
|
+
} : {
|
|
467
|
+
context: InitialContext<LowInfer<TContext>>;
|
|
468
|
+
});
|
|
469
|
+
export interface ProvidedActor {
|
|
470
|
+
src: string;
|
|
471
|
+
logic: AnyActorLogic;
|
|
472
|
+
id?: string;
|
|
433
473
|
}
|
|
434
|
-
export
|
|
435
|
-
output: any;
|
|
436
|
-
}>;
|
|
437
|
-
export interface MachineTypes<TContext extends MachineContext, TEvent extends EventObject, TActorMap extends ActorMap = ActorMap, TTypesMeta = TypegenDisabled> {
|
|
474
|
+
export interface MachineTypes<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TTypesMeta = TypegenDisabled> {
|
|
438
475
|
context?: TContext;
|
|
439
476
|
actions?: {
|
|
440
477
|
type: string;
|
|
441
478
|
[key: string]: any;
|
|
442
479
|
};
|
|
443
|
-
actors?:
|
|
480
|
+
actors?: TActor;
|
|
444
481
|
events?: TEvent;
|
|
445
482
|
guards?: {
|
|
446
483
|
type: string;
|
|
@@ -465,9 +502,9 @@ export declare enum ConstantPrefix {
|
|
|
465
502
|
ErrorPlatform = "error.platform",
|
|
466
503
|
ErrorCustom = "xstate.error"
|
|
467
504
|
}
|
|
468
|
-
export interface DoneInvokeEvent<
|
|
505
|
+
export interface DoneInvokeEvent<TOutput> {
|
|
469
506
|
type: `done.invoke.${string}`;
|
|
470
|
-
output:
|
|
507
|
+
output: TOutput;
|
|
471
508
|
}
|
|
472
509
|
export interface ErrorEvent<TErrorData> {
|
|
473
510
|
type: `error.${string}`;
|
|
@@ -572,7 +609,7 @@ export interface Segment<TContext extends MachineContext, TEvent extends EventOb
|
|
|
572
609
|
/**
|
|
573
610
|
* From state.
|
|
574
611
|
*/
|
|
575
|
-
state: State<TContext, TEvent>;
|
|
612
|
+
state: State<TContext, TEvent, TODO>;
|
|
576
613
|
/**
|
|
577
614
|
* Event from state.
|
|
578
615
|
*/
|
|
@@ -596,7 +633,7 @@ export interface StateConfig<TContext extends MachineContext, TEvent extends Eve
|
|
|
596
633
|
machine?: StateMachine<TContext, TEvent, any, any, any>;
|
|
597
634
|
_internalQueue?: Array<TEvent>;
|
|
598
635
|
}
|
|
599
|
-
export interface InterpreterOptions<
|
|
636
|
+
export interface InterpreterOptions<TLogic extends AnyActorLogic> {
|
|
600
637
|
/**
|
|
601
638
|
* Whether state actions should be executed immediately upon transition. Defaults to `true`.
|
|
602
639
|
*/
|
|
@@ -630,7 +667,7 @@ export interface InterpreterOptions<_TActorLogic extends AnyActorLogic> {
|
|
|
630
667
|
/**
|
|
631
668
|
* The input data to pass to the actor.
|
|
632
669
|
*/
|
|
633
|
-
input?:
|
|
670
|
+
input?: InputFrom<TLogic>;
|
|
634
671
|
state?: any;
|
|
635
672
|
/**
|
|
636
673
|
* The source definition.
|
|
@@ -671,7 +708,7 @@ export interface ActorRef<TEvent extends EventObject, TSnapshot = any> extends S
|
|
|
671
708
|
sessionId: string;
|
|
672
709
|
send: (event: TEvent) => void;
|
|
673
710
|
start?: () => void;
|
|
674
|
-
getSnapshot: () => TSnapshot
|
|
711
|
+
getSnapshot: () => TSnapshot;
|
|
675
712
|
getPersistedState?: () => any;
|
|
676
713
|
stop: () => void;
|
|
677
714
|
toJSON?: () => any;
|
|
@@ -681,10 +718,11 @@ export interface ActorRef<TEvent extends EventObject, TSnapshot = any> extends S
|
|
|
681
718
|
src?: string;
|
|
682
719
|
}
|
|
683
720
|
export type AnyActorRef = ActorRef<any, any>;
|
|
684
|
-
export type
|
|
721
|
+
export type ActorLogicFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<any, any, any, any, any> ? R : R extends Promise<infer U> ? PromiseActorLogic<U> : never : never;
|
|
722
|
+
export type ActorRefFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer TEvent, any, any, infer TResolvedTypesMeta> ? ActorRef<TEvent, State<TContext, TEvent, TODO, AreAllImplementationsAssumedToBeProvided<TResolvedTypesMeta> extends false ? MarkAllImplementationsAsProvided<TResolvedTypesMeta> : TResolvedTypesMeta>> : R extends Promise<infer U> ? ActorRefFrom<PromiseActorLogic<U>> : R extends ActorLogic<infer TEvent, infer TSnapshot, infer _, infer __, infer ___, infer ____, infer _____> ? ActorRef<TEvent, TSnapshot> : never : never;
|
|
685
723
|
export type DevToolsAdapter = (service: AnyInterpreter) => void;
|
|
686
|
-
export type InterpreterFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent,
|
|
687
|
-
export type MachineImplementationsFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine), TRequireMissingImplementations extends boolean = false> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent,
|
|
724
|
+
export type InterpreterFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent, infer TAction, infer TActor, infer TResolvedTypesMeta> ? Interpreter<ActorLogic<TEvent, State<TContext, TEvent, TActor, TResolvedTypesMeta>, State<TContext, TEvent, TActor, TResolvedTypesMeta>, PersistedMachineState<State<TContext, TEvent, TActor, TResolvedTypesMeta>>>> : never;
|
|
725
|
+
export type MachineImplementationsFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine), TRequireMissingImplementations extends boolean = false> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent, infer TAction, infer TActor, infer TResolvedTypesMeta> ? InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, TRequireMissingImplementations> : never;
|
|
688
726
|
export type __ResolvedTypesMetaFrom<T> = T extends StateMachine<any, any, any, infer TResolvedTypesMeta> ? TResolvedTypesMeta : never;
|
|
689
727
|
export type EventOfMachine<TMachine extends AnyStateMachine> = TMachine extends StateMachine<any, infer E, any, any, any> ? E : never;
|
|
690
728
|
export interface ActorContext<TEvent extends EventObject, TSnapshot, TSystem extends ActorSystem<any> = ActorSystem<any>> {
|
|
@@ -701,10 +739,10 @@ export interface ActorLogic<TEvent extends EventObject, TSnapshot = any, TIntern
|
|
|
701
739
|
/**
|
|
702
740
|
* Serialized internal state used for persistence & restoration
|
|
703
741
|
*/
|
|
704
|
-
TPersisted = TInternalState, TSystem extends ActorSystem<any> = ActorSystem<any
|
|
742
|
+
TPersisted = TInternalState, TSystem extends ActorSystem<any> = ActorSystem<any>, TInput = any, TOutput = unknown> {
|
|
705
743
|
config?: unknown;
|
|
706
744
|
transition: (state: TInternalState, message: TEvent, ctx: ActorContext<TEvent, TSnapshot, TSystem>) => TInternalState;
|
|
707
|
-
getInitialState: (actorCtx: ActorContext<TEvent, TSnapshot,
|
|
745
|
+
getInitialState: (actorCtx: ActorContext<TEvent, TSnapshot, TSystem>, input: TInput) => TInternalState;
|
|
708
746
|
restoreState?: (persistedState: TPersisted, actorCtx: ActorContext<TEvent, TSnapshot>) => TInternalState;
|
|
709
747
|
getSnapshot?: (state: TInternalState) => TSnapshot;
|
|
710
748
|
getStatus?: (state: TInternalState) => {
|
|
@@ -716,15 +754,22 @@ TPersisted = TInternalState, TSystem extends ActorSystem<any> = ActorSystem<any>
|
|
|
716
754
|
* @returns Persisted state
|
|
717
755
|
*/
|
|
718
756
|
getPersistedState?: (state: TInternalState) => TPersisted;
|
|
719
|
-
|
|
720
|
-
|
|
757
|
+
_out_TOutput?: TOutput;
|
|
758
|
+
}
|
|
759
|
+
export type AnyActorLogic = ActorLogic<any, // event
|
|
760
|
+
any, // snapshot
|
|
761
|
+
any, // internal state
|
|
762
|
+
any, // persisted state
|
|
763
|
+
any, // system
|
|
764
|
+
any, // input
|
|
765
|
+
any>;
|
|
721
766
|
export type SnapshotFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends ActorRef<infer _, infer TSnapshot> ? TSnapshot : R extends Interpreter<infer TLogic> ? SnapshotFrom<TLogic> : R extends StateMachine<infer _, infer __, infer ___, infer ____, infer _____> ? StateFrom<R> : R extends ActorLogic<infer _, infer TSnapshot, infer __, infer ___, infer ____> ? TSnapshot : R extends ActorContext<infer _, infer TSnapshot, infer __> ? TSnapshot : never : never;
|
|
722
767
|
export type EventFromLogic<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer TEvent, infer _, infer __, infer ___, infer ____> ? TEvent : never;
|
|
723
768
|
export type PersistedStateFrom<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer _TEvent, infer _TSnapshot, infer _TInternalState, infer TPersisted> ? TPersisted : never;
|
|
724
769
|
export type InternalStateFrom<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer _TEvent, infer _TSnapshot, infer TInternalState, infer _TPersisted> ? TInternalState : never;
|
|
725
|
-
type ResolveEventType<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer _, infer TEvent, infer __, infer ___, infer ____> ? TEvent : R extends State<infer
|
|
770
|
+
type ResolveEventType<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer _, infer TEvent, infer __, infer ___, infer ____> ? TEvent : R extends State<infer _TContext, infer TEvent, infer _TAction, infer _TActor> ? TEvent : R extends ActorRef<infer TEvent, infer _> ? TEvent : never : never;
|
|
726
771
|
export type EventFrom<T, K extends Prop<TEvent, 'type'> = never, TEvent extends EventObject = ResolveEventType<T>> = IsNever<K> extends true ? TEvent : ExtractEvent<TEvent, K>;
|
|
727
|
-
export type ContextFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer _, infer __, infer ___, infer ____> ? TContext : R extends State<infer TContext, infer
|
|
772
|
+
export type ContextFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer _, infer __, infer ___, infer ____> ? TContext : R extends State<infer TContext, infer _TEvent, infer _TAction, infer _TActor> ? TContext : R extends Interpreter<infer TActorLogic> ? TActorLogic extends StateMachine<infer TContext, infer _> ? TContext : never : never : never;
|
|
728
773
|
export type InferEvent<E extends EventObject> = {
|
|
729
774
|
[T in E['type']]: {
|
|
730
775
|
type: T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyActorLogic, AnyState } from "./index.js";
|
|
2
2
|
import type { StateNode } from "./StateNode.js";
|
|
3
|
-
import type { ActorLogic, AnyEventObject, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, ErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget } from "./types.js";
|
|
3
|
+
import type { ActorLogic, AnyEventObject, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, ErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget, TODO } from "./types.js";
|
|
4
4
|
export declare function keys<T extends object>(value: T): Array<keyof T & string>;
|
|
5
5
|
export declare function matchesState(parentStateId: StateValue, childStateId: StateValue): boolean;
|
|
6
6
|
export declare function toStatePath(stateId: string | string[]): string[];
|
|
@@ -38,7 +38,7 @@ export declare function isErrorEvent(event: AnyEventObject): event is ErrorEvent
|
|
|
38
38
|
export declare function toTransitionConfigArray<TContext extends MachineContext, TEvent extends EventObject>(configLike: SingleOrArray<TransitionConfig<TContext, TEvent> | TransitionConfigTarget>): Array<TransitionConfig<TContext, TEvent>>;
|
|
39
39
|
export declare function normalizeTarget<TContext extends MachineContext, TEvent extends EventObject>(target: SingleOrArray<string | StateNode<TContext, TEvent>> | undefined): Array<string | StateNode<TContext, TEvent>> | undefined;
|
|
40
40
|
export declare function reportUnhandledExceptionOnInvocation(originalError: any, currentError: any, id: string): void;
|
|
41
|
-
export declare function toInvokeConfig<TContext extends MachineContext, TEvent extends EventObject>(invocable: InvokeConfig<TContext, TEvent> | string |
|
|
41
|
+
export declare function toInvokeConfig<TContext extends MachineContext, TEvent extends EventObject>(invocable: InvokeConfig<TContext, TEvent, TODO> | string | AnyActorLogic, id: string): InvokeConfig<TContext, TEvent, TODO>;
|
|
42
42
|
export declare function toObserver<T>(nextHandler?: Observer<T> | ((value: T) => void), errorHandler?: (error: any) => void, completionHandler?: () => void): Observer<T>;
|
|
43
43
|
export declare function createInvokeId(stateNodeId: string, index: number): string;
|
|
44
44
|
export declare function resolveReferencedActor(referenced: AnyActorLogic | {
|
package/dist/xstate.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var actors_dist_xstateActors = require('./actions-
|
|
5
|
+
var actors_dist_xstateActors = require('./actions-069d9805.cjs.js');
|
|
6
6
|
require('../dev/dist/xstate-dev.cjs.js');
|
|
7
7
|
|
|
8
8
|
const EMPTY_OBJECT = {};
|
|
@@ -216,7 +216,6 @@ class StateNode {
|
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
return {
|
|
219
|
-
type: 'xstate.invoke',
|
|
220
219
|
...invokeConfig,
|
|
221
220
|
src: resolvedSrc,
|
|
222
221
|
id: resolvedId,
|
|
@@ -364,7 +363,7 @@ class StateMachine {
|
|
|
364
363
|
this.__TContext = void 0;
|
|
365
364
|
this.__TEvent = void 0;
|
|
366
365
|
this.__TAction = void 0;
|
|
367
|
-
this.
|
|
366
|
+
this.__TActor = void 0;
|
|
368
367
|
this.__TResolvedTypesMeta = void 0;
|
|
369
368
|
this.id = config.id || '(machine)';
|
|
370
369
|
this.implementations = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var actors_dist_xstateActors = require('./actions-
|
|
5
|
+
var actors_dist_xstateActors = require('./actions-d1c41ed3.development.cjs.js');
|
|
6
6
|
require('../dev/dist/xstate-dev.development.cjs.js');
|
|
7
7
|
|
|
8
8
|
const EMPTY_OBJECT = {};
|
|
@@ -216,7 +216,6 @@ class StateNode {
|
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
return {
|
|
219
|
-
type: 'xstate.invoke',
|
|
220
219
|
...invokeConfig,
|
|
221
220
|
src: resolvedSrc,
|
|
222
221
|
id: resolvedId,
|
|
@@ -364,7 +363,7 @@ class StateMachine {
|
|
|
364
363
|
this.__TContext = void 0;
|
|
365
364
|
this.__TEvent = void 0;
|
|
366
365
|
this.__TAction = void 0;
|
|
367
|
-
this.
|
|
366
|
+
this.__TActor = void 0;
|
|
368
367
|
this.__TResolvedTypesMeta = void 0;
|
|
369
368
|
this.id = config.id || '(machine)';
|
|
370
369
|
this.implementations = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as flatten, g as createInvokeId, h as getDelayedTransitions, i as formatInitialTransition, j as getCandidates, k as toInvokeConfig, l as getConfiguration, n as getStateNodes, r as resolveStateValue, o as isInFinalState, p as State, q as isErrorEvent, s as macrostep, u as transitionNode, v as getInitialConfiguration, w as resolveActionsAndContext, x as assign, y as createInitEvent, z as microstep, A as isAtomicStateNode, B as error, C as isStateId, D as getStateNodeByPath, E as getPersistedState, F as resolveReferencedActor, G as interpret, H as matchesState } from './actions-
|
|
2
|
-
export { a5 as ConstantPrefix, L as Interpreter, M as InterpreterStatus, a6 as SpecialTargets, p as State, a3 as and, x as assign, P as cancel, Q as choose, O as doneInvoke, K as forwardTo, _ as fromCallback, $ as fromEventObservable, Z as fromObservable, Y as fromPromise, a0 as fromTransition, n as getStateNodes, G as interpret, R as log, H as matchesState, a2 as not, a4 as or, W as pathToStateValue, T as pure, U as raise, J as sendParent, I as sendTo, a1 as stateIn, V as stop, X as toObserver } from './actions-
|
|
1
|
+
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as flatten, g as createInvokeId, h as getDelayedTransitions, i as formatInitialTransition, j as getCandidates, k as toInvokeConfig, l as getConfiguration, n as getStateNodes, r as resolveStateValue, o as isInFinalState, p as State, q as isErrorEvent, s as macrostep, u as transitionNode, v as getInitialConfiguration, w as resolveActionsAndContext, x as assign, y as createInitEvent, z as microstep, A as isAtomicStateNode, B as error, C as isStateId, D as getStateNodeByPath, E as getPersistedState, F as resolveReferencedActor, G as interpret, H as matchesState } from './actions-b299d008.development.esm.js';
|
|
2
|
+
export { a5 as ConstantPrefix, L as Interpreter, M as InterpreterStatus, a6 as SpecialTargets, p as State, a3 as and, x as assign, P as cancel, Q as choose, O as doneInvoke, K as forwardTo, _ as fromCallback, $ as fromEventObservable, Z as fromObservable, Y as fromPromise, a0 as fromTransition, n as getStateNodes, G as interpret, R as log, H as matchesState, a2 as not, a4 as or, W as pathToStateValue, T as pure, U as raise, J as sendParent, I as sendTo, a1 as stateIn, V as stop, X as toObserver } from './actions-b299d008.development.esm.js';
|
|
3
3
|
import '../dev/dist/xstate-dev.development.esm.js';
|
|
4
4
|
|
|
5
5
|
const EMPTY_OBJECT = {};
|
|
@@ -213,7 +213,6 @@ class StateNode {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
return {
|
|
216
|
-
type: 'xstate.invoke',
|
|
217
216
|
...invokeConfig,
|
|
218
217
|
src: resolvedSrc,
|
|
219
218
|
id: resolvedId,
|
|
@@ -361,7 +360,7 @@ class StateMachine {
|
|
|
361
360
|
this.__TContext = void 0;
|
|
362
361
|
this.__TEvent = void 0;
|
|
363
362
|
this.__TAction = void 0;
|
|
364
|
-
this.
|
|
363
|
+
this.__TActor = void 0;
|
|
365
364
|
this.__TResolvedTypesMeta = void 0;
|
|
366
365
|
this.id = config.id || '(machine)';
|
|
367
366
|
this.implementations = {
|
package/dist/xstate.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as flatten, g as createInvokeId, h as getDelayedTransitions, i as formatInitialTransition, j as getCandidates, k as toInvokeConfig, l as getConfiguration, n as getStateNodes, r as resolveStateValue, o as isInFinalState, p as State, q as isErrorEvent, s as macrostep, u as transitionNode, v as getInitialConfiguration, w as resolveActionsAndContext, x as assign, y as createInitEvent, z as microstep, A as isAtomicStateNode, B as error, C as isStateId, D as getStateNodeByPath, E as getPersistedState, F as resolveReferencedActor, G as interpret, H as matchesState } from './actions-
|
|
2
|
-
export { a5 as ConstantPrefix, L as Interpreter, M as InterpreterStatus, a6 as SpecialTargets, p as State, a3 as and, x as assign, P as cancel, Q as choose, O as doneInvoke, K as forwardTo, _ as fromCallback, $ as fromEventObservable, Z as fromObservable, Y as fromPromise, a0 as fromTransition, n as getStateNodes, G as interpret, R as log, H as matchesState, a2 as not, a4 as or, W as pathToStateValue, T as pure, U as raise, J as sendParent, I as sendTo, a1 as stateIn, V as stop, X as toObserver } from './actions-
|
|
1
|
+
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as flatten, g as createInvokeId, h as getDelayedTransitions, i as formatInitialTransition, j as getCandidates, k as toInvokeConfig, l as getConfiguration, n as getStateNodes, r as resolveStateValue, o as isInFinalState, p as State, q as isErrorEvent, s as macrostep, u as transitionNode, v as getInitialConfiguration, w as resolveActionsAndContext, x as assign, y as createInitEvent, z as microstep, A as isAtomicStateNode, B as error, C as isStateId, D as getStateNodeByPath, E as getPersistedState, F as resolveReferencedActor, G as interpret, H as matchesState } from './actions-a8a9433c.esm.js';
|
|
2
|
+
export { a5 as ConstantPrefix, L as Interpreter, M as InterpreterStatus, a6 as SpecialTargets, p as State, a3 as and, x as assign, P as cancel, Q as choose, O as doneInvoke, K as forwardTo, _ as fromCallback, $ as fromEventObservable, Z as fromObservable, Y as fromPromise, a0 as fromTransition, n as getStateNodes, G as interpret, R as log, H as matchesState, a2 as not, a4 as or, W as pathToStateValue, T as pure, U as raise, J as sendParent, I as sendTo, a1 as stateIn, V as stop, X as toObserver } from './actions-a8a9433c.esm.js';
|
|
3
3
|
import '../dev/dist/xstate-dev.esm.js';
|
|
4
4
|
|
|
5
5
|
const EMPTY_OBJECT = {};
|
|
@@ -213,7 +213,6 @@ class StateNode {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
return {
|
|
216
|
-
type: 'xstate.invoke',
|
|
217
216
|
...invokeConfig,
|
|
218
217
|
src: resolvedSrc,
|
|
219
218
|
id: resolvedId,
|
|
@@ -361,7 +360,7 @@ class StateMachine {
|
|
|
361
360
|
this.__TContext = void 0;
|
|
362
361
|
this.__TEvent = void 0;
|
|
363
362
|
this.__TAction = void 0;
|
|
364
|
-
this.
|
|
363
|
+
this.__TActor = void 0;
|
|
365
364
|
this.__TResolvedTypesMeta = void 0;
|
|
366
365
|
this.id = config.id || '(machine)';
|
|
367
366
|
this.implementations = {
|