xstate 5.0.0-beta.19 → 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-2d912781.cjs.js → actions-069d9805.cjs.js} +307 -311
- package/dist/{actions-3b74fb92.esm.js → actions-a8a9433c.esm.js} +307 -311
- package/dist/{actions-72105f77.development.esm.js → actions-b299d008.development.esm.js} +307 -311
- package/dist/{actions-bce11b97.development.cjs.js → actions-d1c41ed3.development.cjs.js} +307 -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 +13 -3
- package/dist/declarations/src/actors/index.d.ts +4 -4
- package/dist/declarations/src/actors/observable.d.ts +8 -8
- package/dist/declarations/src/actors/promise.d.ts +12 -6
- package/dist/declarations/src/actors/transition.d.ts +6 -6
- 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 +99 -59
- 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,8 +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 {
|
|
7
|
-
import { CallbackActorRef } from "./actors/callback.js";
|
|
6
|
+
import { PromiseActorLogic } from "./actors/promise.js";
|
|
8
7
|
export type AnyFunction = (...args: any[]) => any;
|
|
9
8
|
type ReturnTypeOrValue<T> = T extends AnyFunction ? ReturnType<T> : T;
|
|
10
9
|
export type IsNever<T> = [T] extends [never] ? true : false;
|
|
@@ -14,11 +13,12 @@ export type Compute<A extends any> = {
|
|
|
14
13
|
export type Prop<T, K> = K extends keyof T ? T[K] : never;
|
|
15
14
|
export type Values<T> = T[keyof T];
|
|
16
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
|
+
};
|
|
17
19
|
export type IndexByType<T extends {
|
|
18
20
|
type: string;
|
|
19
|
-
}> =
|
|
20
|
-
[K in T['type']]: T extends any ? (K extends T['type'] ? T : never) : never;
|
|
21
|
-
};
|
|
21
|
+
}> = IndexByProp<T, 'type'>;
|
|
22
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;
|
|
23
23
|
export type IsAny<T> = Equals<T, any>;
|
|
24
24
|
export type Cast<A, B> = A extends B ? A : B;
|
|
@@ -55,12 +55,14 @@ export type MachineContext = Record<string, any>;
|
|
|
55
55
|
export interface ActionArgs<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject> extends UnifiedArg<TContext, TEvent> {
|
|
56
56
|
action: TAction;
|
|
57
57
|
}
|
|
58
|
-
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
|
|
59
61
|
logic: T, options?: Partial<{
|
|
60
62
|
id: string;
|
|
61
63
|
systemId?: string;
|
|
62
|
-
input: any;
|
|
63
|
-
}>) => T
|
|
64
|
+
input: T extends AnyActorLogic ? InputFrom<T> : any;
|
|
65
|
+
}>) => ActorRefFrom<T>;
|
|
64
66
|
export interface AssignArgs<TContext extends MachineContext, TExpressionEvent extends EventObject> extends ActionArgs<TContext, TExpressionEvent> {
|
|
65
67
|
spawn: Spawner;
|
|
66
68
|
}
|
|
@@ -96,9 +98,9 @@ export interface DefaultGuardObject<TContext extends MachineContext, TEvent exte
|
|
|
96
98
|
children?: Array<GuardObject<TContext, TEvent>>;
|
|
97
99
|
predicate?: GuardPredicate<TContext, TEvent>;
|
|
98
100
|
}
|
|
99
|
-
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;
|
|
100
102
|
export interface GuardArgs<TContext extends MachineContext, TEvent extends EventObject> {
|
|
101
|
-
state: State<TContext, TEvent,
|
|
103
|
+
state: State<TContext, TEvent, TODO>;
|
|
102
104
|
guard: GuardDefinition<TContext, TEvent>;
|
|
103
105
|
evaluate: GuardEvaluator<TContext, TEvent>;
|
|
104
106
|
}
|
|
@@ -144,14 +146,6 @@ export interface InitialTransitionConfig<TContext extends MachineContext, TEvent
|
|
|
144
146
|
target: TransitionTarget;
|
|
145
147
|
}
|
|
146
148
|
export type Transition<TContext extends MachineContext, TEvent extends EventObject = EventObject> = string | TransitionConfig<TContext, TEvent> | ConditionalTransitionConfig<TContext, TEvent>;
|
|
147
|
-
export type Receiver<TEvent extends EventObject> = (listener: {
|
|
148
|
-
bivarianceHack(event: TEvent): void;
|
|
149
|
-
}['bivarianceHack']) => void;
|
|
150
|
-
export type InvokeCallback<TEvent extends EventObject = AnyEventObject, TSentEvent extends EventObject = AnyEventObject> = (sendBack: (event: TSentEvent) => void, onReceive: Receiver<TEvent>, { input, system, self }: {
|
|
151
|
-
input: any;
|
|
152
|
-
system: AnyActorSystem;
|
|
153
|
-
self: CallbackActorRef<TEvent>;
|
|
154
|
-
}) => (() => void) | Promise<any> | void;
|
|
155
149
|
export interface InvokeMeta {
|
|
156
150
|
src: string;
|
|
157
151
|
meta: MetaObject | undefined;
|
|
@@ -191,8 +185,8 @@ export type SingleOrArray<T> = T[] | T;
|
|
|
191
185
|
export type StateNodesConfig<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
192
186
|
[K in string]: StateNode<TContext, TEvent>;
|
|
193
187
|
};
|
|
194
|
-
export type StatesConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject
|
|
195
|
-
[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>;
|
|
196
190
|
};
|
|
197
191
|
export type StatesDefinition<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
198
192
|
[K in string]: StateNodeDefinition<TContext, TEvent>;
|
|
@@ -202,7 +196,43 @@ export type TransitionConfigOrTarget<TContext extends MachineContext, TExpressio
|
|
|
202
196
|
export type TransitionsConfig<TContext extends MachineContext, TEvent extends EventObject> = {
|
|
203
197
|
[K in TEvent['type'] | '*']?: K extends '*' ? TransitionConfigOrTarget<TContext, TEvent> : TransitionConfigOrTarget<TContext, ExtractEvent<TEvent, K>, TEvent>;
|
|
204
198
|
};
|
|
205
|
-
|
|
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> : {
|
|
206
236
|
/**
|
|
207
237
|
* The unique identifier for the invoked machine. If not specified, this
|
|
208
238
|
* will be the machine's own `id`, or the URL (from `src`).
|
|
@@ -212,7 +242,7 @@ export interface InvokeConfig<TContext extends MachineContext, TEvent extends Ev
|
|
|
212
242
|
/**
|
|
213
243
|
* The source of the machine to be invoked, or the machine itself.
|
|
214
244
|
*/
|
|
215
|
-
src:
|
|
245
|
+
src: AnyActorLogic | string;
|
|
216
246
|
input?: Mapper<TContext, TEvent, any> | any;
|
|
217
247
|
/**
|
|
218
248
|
* The transition to take upon the invoked child machine reaching its final top-level state.
|
|
@@ -227,8 +257,8 @@ export interface InvokeConfig<TContext extends MachineContext, TEvent extends Ev
|
|
|
227
257
|
* Meta data related to this invocation
|
|
228
258
|
*/
|
|
229
259
|
meta?: MetaObject;
|
|
230
|
-
}
|
|
231
|
-
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> {
|
|
232
262
|
/**
|
|
233
263
|
* The initial state transition.
|
|
234
264
|
*/
|
|
@@ -252,11 +282,11 @@ export interface StateNodeConfig<TContext extends MachineContext, TEvent extends
|
|
|
252
282
|
/**
|
|
253
283
|
* The mapping of state node keys to their state node configurations (recursive).
|
|
254
284
|
*/
|
|
255
|
-
states?: StatesConfig<TContext, TEvent, TAction> | undefined;
|
|
285
|
+
states?: StatesConfig<TContext, TEvent, TAction, TActor> | undefined;
|
|
256
286
|
/**
|
|
257
287
|
* The services to invoke upon entering this state node. These services will be stopped upon exiting this state node.
|
|
258
288
|
*/
|
|
259
|
-
invoke?: SingleOrArray<
|
|
289
|
+
invoke?: SingleOrArray<TActor['src'] | InvokeConfig<TContext, TEvent, TActor>>;
|
|
260
290
|
/**
|
|
261
291
|
* The mapping of event types to their potential transition(s).
|
|
262
292
|
*/
|
|
@@ -344,10 +374,10 @@ export interface StateMachineDefinition<TContext extends MachineContext, TEvent
|
|
|
344
374
|
}
|
|
345
375
|
export type AnyStateNode = StateNode<any, any>;
|
|
346
376
|
export type AnyStateNodeDefinition = StateNodeDefinition<any, any>;
|
|
347
|
-
export type AnyState = State<any, any, any>;
|
|
377
|
+
export type AnyState = State<any, any, any, any>;
|
|
348
378
|
export type AnyStateMachine = StateMachine<any, any, any, any, any>;
|
|
349
379
|
export type AnyStateConfig = StateConfig<any, AnyEventObject>;
|
|
350
|
-
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> {
|
|
351
381
|
initial?: undefined;
|
|
352
382
|
parallel?: false | undefined;
|
|
353
383
|
states?: undefined;
|
|
@@ -365,7 +395,7 @@ export interface FinalStateNodeConfig<TContext extends MachineContext, TEvent ex
|
|
|
365
395
|
*/
|
|
366
396
|
output?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
|
|
367
397
|
}
|
|
368
|
-
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>;
|
|
369
399
|
export type ActionFunctionMap<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject> = {
|
|
370
400
|
[K in TAction['type']]?: ActionFunction<TContext, TEvent, TEvent, TAction extends {
|
|
371
401
|
type: K;
|
|
@@ -385,18 +415,18 @@ export interface MachineImplementationsSimplified<TContext extends MachineContex
|
|
|
385
415
|
type MachineImplementationsActions<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingActions = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingActions'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>> = {
|
|
386
416
|
[K in keyof TEventsCausingActions]?: ActionFunction<TContext, Cast<Prop<TIndexedEvents, TEventsCausingActions[K]>, EventObject>, Cast<Prop<TIndexedEvents, keyof TIndexedEvents>, EventObject>, ParameterizedObject>;
|
|
387
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
|
+
};
|
|
388
424
|
type MachineImplementationsDelays<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingDelays = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingDelays'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>> = {
|
|
389
425
|
[K in keyof TEventsCausingDelays]?: DelayConfig<TContext, Cast<Prop<TIndexedEvents, TEventsCausingDelays[K]>, EventObject>>;
|
|
390
426
|
};
|
|
391
427
|
type MachineImplementationsGuards<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingGuards = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingGuards'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>> = {
|
|
392
428
|
[K in keyof TEventsCausingGuards]?: GuardPredicate<TContext, Cast<Prop<TIndexedEvents, TEventsCausingGuards[K]>, EventObject>> | GuardConfig<TContext, Cast<Prop<TIndexedEvents, TEventsCausingGuards[K]>, EventObject>>;
|
|
393
429
|
};
|
|
394
|
-
type MachineImplementationsActors<TContext extends MachineContext, TResolvedTypesMeta, TEventsCausingActors = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'eventsCausingActors'>, TIndexedEvents = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'indexedEvents'>, _TInvokeSrcNameMap = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'invokeSrcNameMap'>> = {
|
|
395
|
-
[K in keyof TEventsCausingActors]?: AnyActorLogic | {
|
|
396
|
-
src: AnyActorLogic;
|
|
397
|
-
input: Mapper<TContext, Cast<Prop<TIndexedEvents, TEventsCausingActors[K]>, EventObject>, any> | any;
|
|
398
|
-
};
|
|
399
|
-
};
|
|
400
430
|
type MakeKeysRequired<T extends string> = {
|
|
401
431
|
[K in T]: unknown;
|
|
402
432
|
};
|
|
@@ -415,14 +445,14 @@ type GenerateDelaysImplementationsPart<TContext extends MachineContext, TResolve
|
|
|
415
445
|
type GenerateGuardsImplementationsPart<TContext extends MachineContext, TResolvedTypesMeta, TRequireMissingImplementations, TMissingImplementations> = Compute<MaybeMakeMissingImplementationsRequired<'guards', Prop<TMissingImplementations, 'guards'>, TRequireMissingImplementations> & {
|
|
416
446
|
guards?: MachineImplementationsGuards<TContext, TResolvedTypesMeta>;
|
|
417
447
|
}>;
|
|
418
|
-
export type InternalMachineImplementations<TContext extends MachineContext,
|
|
419
|
-
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>>;
|
|
420
450
|
type InitialContext<TContext extends MachineContext> = TContext | ContextFactory<TContext>;
|
|
421
451
|
export type ContextFactory<TContext extends MachineContext> = ({ spawn, input }: {
|
|
422
452
|
spawn: Spawner;
|
|
423
453
|
input: any;
|
|
424
454
|
}) => TContext;
|
|
425
|
-
export type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject,
|
|
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>> & {
|
|
426
456
|
/**
|
|
427
457
|
* The initial context (extended state)
|
|
428
458
|
*/
|
|
@@ -430,22 +460,24 @@ export type MachineConfig<TContext extends MachineContext, TEvent extends EventO
|
|
|
430
460
|
* The machine's own version.
|
|
431
461
|
*/
|
|
432
462
|
version?: string;
|
|
433
|
-
types?: MachineTypes<TContext, TEvent,
|
|
463
|
+
types?: MachineTypes<TContext, TEvent, TActor, TTypesMeta>;
|
|
434
464
|
}) & (Equals<TContext, MachineContext> extends true ? {
|
|
435
465
|
context?: InitialContext<LowInfer<TContext>>;
|
|
436
466
|
} : {
|
|
437
467
|
context: InitialContext<LowInfer<TContext>>;
|
|
438
468
|
});
|
|
439
|
-
export
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
469
|
+
export interface ProvidedActor {
|
|
470
|
+
src: string;
|
|
471
|
+
logic: AnyActorLogic;
|
|
472
|
+
id?: string;
|
|
473
|
+
}
|
|
474
|
+
export interface MachineTypes<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TTypesMeta = TypegenDisabled> {
|
|
443
475
|
context?: TContext;
|
|
444
476
|
actions?: {
|
|
445
477
|
type: string;
|
|
446
478
|
[key: string]: any;
|
|
447
479
|
};
|
|
448
|
-
actors?:
|
|
480
|
+
actors?: TActor;
|
|
449
481
|
events?: TEvent;
|
|
450
482
|
guards?: {
|
|
451
483
|
type: string;
|
|
@@ -470,9 +502,9 @@ export declare enum ConstantPrefix {
|
|
|
470
502
|
ErrorPlatform = "error.platform",
|
|
471
503
|
ErrorCustom = "xstate.error"
|
|
472
504
|
}
|
|
473
|
-
export interface DoneInvokeEvent<
|
|
505
|
+
export interface DoneInvokeEvent<TOutput> {
|
|
474
506
|
type: `done.invoke.${string}`;
|
|
475
|
-
output:
|
|
507
|
+
output: TOutput;
|
|
476
508
|
}
|
|
477
509
|
export interface ErrorEvent<TErrorData> {
|
|
478
510
|
type: `error.${string}`;
|
|
@@ -577,7 +609,7 @@ export interface Segment<TContext extends MachineContext, TEvent extends EventOb
|
|
|
577
609
|
/**
|
|
578
610
|
* From state.
|
|
579
611
|
*/
|
|
580
|
-
state: State<TContext, TEvent>;
|
|
612
|
+
state: State<TContext, TEvent, TODO>;
|
|
581
613
|
/**
|
|
582
614
|
* Event from state.
|
|
583
615
|
*/
|
|
@@ -601,7 +633,7 @@ export interface StateConfig<TContext extends MachineContext, TEvent extends Eve
|
|
|
601
633
|
machine?: StateMachine<TContext, TEvent, any, any, any>;
|
|
602
634
|
_internalQueue?: Array<TEvent>;
|
|
603
635
|
}
|
|
604
|
-
export interface InterpreterOptions<
|
|
636
|
+
export interface InterpreterOptions<TLogic extends AnyActorLogic> {
|
|
605
637
|
/**
|
|
606
638
|
* Whether state actions should be executed immediately upon transition. Defaults to `true`.
|
|
607
639
|
*/
|
|
@@ -635,7 +667,7 @@ export interface InterpreterOptions<_TActorLogic extends AnyActorLogic> {
|
|
|
635
667
|
/**
|
|
636
668
|
* The input data to pass to the actor.
|
|
637
669
|
*/
|
|
638
|
-
input?:
|
|
670
|
+
input?: InputFrom<TLogic>;
|
|
639
671
|
state?: any;
|
|
640
672
|
/**
|
|
641
673
|
* The source definition.
|
|
@@ -676,7 +708,7 @@ export interface ActorRef<TEvent extends EventObject, TSnapshot = any> extends S
|
|
|
676
708
|
sessionId: string;
|
|
677
709
|
send: (event: TEvent) => void;
|
|
678
710
|
start?: () => void;
|
|
679
|
-
getSnapshot: () => TSnapshot
|
|
711
|
+
getSnapshot: () => TSnapshot;
|
|
680
712
|
getPersistedState?: () => any;
|
|
681
713
|
stop: () => void;
|
|
682
714
|
toJSON?: () => any;
|
|
@@ -686,10 +718,11 @@ export interface ActorRef<TEvent extends EventObject, TSnapshot = any> extends S
|
|
|
686
718
|
src?: string;
|
|
687
719
|
}
|
|
688
720
|
export type AnyActorRef = ActorRef<any, any>;
|
|
689
|
-
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;
|
|
690
723
|
export type DevToolsAdapter = (service: AnyInterpreter) => void;
|
|
691
|
-
export type InterpreterFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent,
|
|
692
|
-
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;
|
|
693
726
|
export type __ResolvedTypesMetaFrom<T> = T extends StateMachine<any, any, any, infer TResolvedTypesMeta> ? TResolvedTypesMeta : never;
|
|
694
727
|
export type EventOfMachine<TMachine extends AnyStateMachine> = TMachine extends StateMachine<any, infer E, any, any, any> ? E : never;
|
|
695
728
|
export interface ActorContext<TEvent extends EventObject, TSnapshot, TSystem extends ActorSystem<any> = ActorSystem<any>> {
|
|
@@ -706,10 +739,10 @@ export interface ActorLogic<TEvent extends EventObject, TSnapshot = any, TIntern
|
|
|
706
739
|
/**
|
|
707
740
|
* Serialized internal state used for persistence & restoration
|
|
708
741
|
*/
|
|
709
|
-
TPersisted = TInternalState, TSystem extends ActorSystem<any> = ActorSystem<any
|
|
742
|
+
TPersisted = TInternalState, TSystem extends ActorSystem<any> = ActorSystem<any>, TInput = any, TOutput = unknown> {
|
|
710
743
|
config?: unknown;
|
|
711
744
|
transition: (state: TInternalState, message: TEvent, ctx: ActorContext<TEvent, TSnapshot, TSystem>) => TInternalState;
|
|
712
|
-
getInitialState: (actorCtx: ActorContext<TEvent, TSnapshot,
|
|
745
|
+
getInitialState: (actorCtx: ActorContext<TEvent, TSnapshot, TSystem>, input: TInput) => TInternalState;
|
|
713
746
|
restoreState?: (persistedState: TPersisted, actorCtx: ActorContext<TEvent, TSnapshot>) => TInternalState;
|
|
714
747
|
getSnapshot?: (state: TInternalState) => TSnapshot;
|
|
715
748
|
getStatus?: (state: TInternalState) => {
|
|
@@ -721,15 +754,22 @@ TPersisted = TInternalState, TSystem extends ActorSystem<any> = ActorSystem<any>
|
|
|
721
754
|
* @returns Persisted state
|
|
722
755
|
*/
|
|
723
756
|
getPersistedState?: (state: TInternalState) => TPersisted;
|
|
724
|
-
|
|
725
|
-
|
|
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>;
|
|
726
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;
|
|
727
767
|
export type EventFromLogic<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer TEvent, infer _, infer __, infer ___, infer ____> ? TEvent : never;
|
|
728
768
|
export type PersistedStateFrom<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer _TEvent, infer _TSnapshot, infer _TInternalState, infer TPersisted> ? TPersisted : never;
|
|
729
769
|
export type InternalStateFrom<TLogic extends ActorLogic<any, any>> = TLogic extends ActorLogic<infer _TEvent, infer _TSnapshot, infer TInternalState, infer _TPersisted> ? TInternalState : never;
|
|
730
|
-
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;
|
|
731
771
|
export type EventFrom<T, K extends Prop<TEvent, 'type'> = never, TEvent extends EventObject = ResolveEventType<T>> = IsNever<K> extends true ? TEvent : ExtractEvent<TEvent, K>;
|
|
732
|
-
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;
|
|
733
773
|
export type InferEvent<E extends EventObject> = {
|
|
734
774
|
[T in E['type']]: {
|
|
735
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 = {
|