xstate 6.0.0-alpha.63 → 6.0.0-alpha.64
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/README.md +18 -1
- package/dist/{createActor-eba8226e.cjs.js → createActor-29adb8a4.cjs.js} +33 -5
- package/dist/{createActor-f71670cf.development.cjs.js → createActor-521c8805.development.cjs.js} +33 -5
- package/dist/{createActor-523a98c7.esm.js → createActor-8493caa9.esm.js} +29 -6
- package/dist/{createActor-48f753a9.development.esm.js → createActor-bd2527dc.development.esm.js} +29 -6
- package/dist/declarations/src/SimulatedClock.d.ts +1 -1
- package/dist/declarations/src/createMachine.d.ts +3 -3
- package/dist/declarations/src/durable/index.d.ts +13 -0
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/declarations/src/setup.d.ts +152 -15
- package/dist/declarations/src/systemTransition.d.ts +103 -0
- package/dist/declarations/src/types.d.ts +3 -3
- package/dist/declarations/src/types.v6.d.ts +12 -4
- package/dist/{effectDescriptor-8c87a3e7.development.cjs.js → effectDescriptor-62b53c6d.development.cjs.js} +1 -1
- package/dist/{effectDescriptor-bc9e3e81.cjs.js → effectDescriptor-6dbc400a.cjs.js} +1 -1
- package/dist/{effectDescriptor-ad75e430.esm.js → effectDescriptor-85ea06c9.esm.js} +1 -1
- package/dist/{effectDescriptor-eadf1b25.development.esm.js → effectDescriptor-f76948fc.development.esm.js} +1 -1
- package/dist/{index-83f11f07.cjs.js → index-2afc57c3.development.cjs.js} +9 -2
- package/dist/{index-3cb56f46.development.cjs.js → index-5587e13b.cjs.js} +9 -2
- package/dist/{index-2a4be1f2.development.esm.js → index-90ebf5ae.development.esm.js} +9 -2
- package/dist/{index-211a5dce.esm.js → index-b0dc2b39.esm.js} +9 -2
- package/dist/xstate-actors.cjs.js +2 -2
- package/dist/xstate-actors.development.cjs.js +2 -2
- package/dist/xstate-actors.development.esm.js +2 -2
- package/dist/xstate-actors.esm.js +2 -2
- package/dist/xstate-actors.umd.min.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-durable.cjs.js +36 -4
- package/dist/xstate-durable.development.cjs.js +36 -4
- package/dist/xstate-durable.development.esm.js +36 -4
- package/dist/xstate-durable.esm.js +36 -4
- package/dist/xstate-durable.umd.min.js +1 -1
- package/dist/xstate-durable.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +2 -2
- package/dist/xstate-graph.development.cjs.js +2 -2
- package/dist/xstate-graph.development.esm.js +2 -2
- package/dist/xstate-graph.esm.js +2 -2
- package/dist/xstate-validation.cjs.js +1 -1
- package/dist/xstate-validation.development.cjs.js +1 -1
- package/dist/xstate-validation.development.esm.js +1 -1
- package/dist/xstate-validation.esm.js +1 -1
- package/dist/xstate.cjs.js +842 -35
- package/dist/xstate.cjs.mjs +3 -0
- package/dist/xstate.development.cjs.js +842 -35
- package/dist/xstate.development.cjs.mjs +3 -0
- package/dist/xstate.development.esm.js +842 -38
- package/dist/xstate.esm.js +842 -38
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,10 +3,11 @@ import type { SetupSchemas, SetupStateSchema, SetupStateType } from "./base.type
|
|
|
3
3
|
import type { ActorLogicValidator } from "./validation.types.js";
|
|
4
4
|
import { StateMachine } from "./StateMachine.js";
|
|
5
5
|
import { type Actor, type RequiredActorOptionsFor, type RequiredActorOptionsKeys } from "./createActor.js";
|
|
6
|
-
import { AnyActorRef, AnyActorLogic, ActorRefFromLogic, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, StateValueFromStateSchema, ToChildren, MetaObject, Cast, Compute, EnqueueObject, DoneActorEvent, DoneStateEvent, ErrorFrom, ErrorActorEvent, SystemRegistry, RegistryKeyForLogic, ActorOptions, Observer, Subscription, OutputArg, SnapshotEvent, SingleOrArray, AfterEvent, TimeoutEvent, ErrorEvent, CallbackActors } from "./types.js";
|
|
6
|
+
import { AnyActorRef, AnyStateMachine, AnyActorLogic, ActorRefFromLogic, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, StateValueFromStateSchema, ToChildren, MetaObject, Cast, Compute, EnqueueObject, DoneActorEvent, DoneStateEvent, ErrorFrom, ErrorActorEvent, SystemRegistry, RegistryKeyForLogic, ActorOptions, Observer, Subscription, OutputArg, SnapshotEvent, SingleOrArray, AfterEvent, TimeoutEvent, ErrorEvent, CallbackActors, InputFrom, OutputFrom, SnapshotFrom, ActorTimeoutEvent, NonReducibleUnknown } from "./types.js";
|
|
7
7
|
import { AnyActorSystem } from "./system.js";
|
|
8
8
|
import { InspectionEvent } from "./inspection.js";
|
|
9
|
-
import {
|
|
9
|
+
import { type AsyncActorLogic, type AsyncSnapshot, type LogicFunction } from "./actors/promise.js";
|
|
10
|
+
import { ActionSchemas, DelayMapFromNames, DelaySourceMap, GuardSourceMap, GuardSchemas, InferChildren, InferActions, InferGuards, Sources, InferMachineInput, InferOutput, InferEvents, InferInternalEvents, Next_MachineConfig, Next_InvokeConfig, Next_InvokeConfigBase, InvokeInputArgs, Next_StateNodeConfig, Next_TransitionConfigOrTarget, type createdInvokeConfig, FinalStateConfigOutput, OutputFromConfig, ChildCompletionEvents, DelayDurationKey, ValidateDelayNames, ValidateEventDescriptors, ValidateHistoryDefaults, ValidateStateTargets, WithDefault } from "./types.v6.js";
|
|
10
11
|
/** @public */
|
|
11
12
|
export type SetupConfig<TSchemas extends SetupSchemas, TStates extends Record<string, SetupStateSchema>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TValidator extends ActorLogicValidator | undefined = ActorLogicValidator | undefined> = {
|
|
12
13
|
validator?: TValidator;
|
|
@@ -340,7 +341,11 @@ type SetupTargetSetLegality<TTransition, TRootStateSchemas extends Record<string
|
|
|
340
341
|
type SetupTargetSetMapLegality<TMap, TRootStateSchemas extends Record<string, SetupStateSchema>, TSourcePath extends string> = TMap extends Record<string, unknown> ? {
|
|
341
342
|
[K in keyof TMap]?: TMap[K] & SetupTargetSetLegality<TMap[K], TRootStateSchemas, TSourcePath>;
|
|
342
343
|
} : unknown;
|
|
343
|
-
type SetupInvokeTargetSetLegality<TInvoke, TRootStateSchemas extends Record<string, SetupStateSchema>, TSourcePath extends string> = TInvoke extends
|
|
344
|
+
type SetupInvokeTargetSetLegality<TInvoke, TRootStateSchemas extends Record<string, SetupStateSchema>, TSourcePath extends string> = TInvoke extends {
|
|
345
|
+
readonly [createdInvokeConfig]: infer TConfig;
|
|
346
|
+
} ? {
|
|
347
|
+
readonly [createdInvokeConfig]: TConfig & SetupInvokeTargetSetLegality<TConfig, TRootStateSchemas, TSourcePath>;
|
|
348
|
+
} : TInvoke extends readonly unknown[] ? {
|
|
344
349
|
[K in keyof TInvoke]: TInvoke[K] & SetupInvokeTargetSetLegality<TInvoke[K], TRootStateSchemas, TSourcePath>;
|
|
345
350
|
} : TInvoke extends Record<string, unknown> ? (TInvoke extends {
|
|
346
351
|
onDone: infer TOnDone;
|
|
@@ -587,7 +592,11 @@ type SetupTransitionMapTargetArrayInputConstraint<TValue, TStateSchemas extends
|
|
|
587
592
|
type SetupTransitionPropertyTargetArrayInputConstraint<TConfig, TKey extends PropertyKey, TStateSchemas extends Record<string, SetupStateSchema>, TIsMap extends boolean = false> = TKey extends keyof TConfig ? {
|
|
588
593
|
[K in TKey]?: TConfig[K] & (TIsMap extends true ? SetupTransitionMapTargetArrayInputConstraint<TConfig[K], TStateSchemas> : SetupTransitionValueTargetArrayInputConstraint<TConfig[K], TStateSchemas>);
|
|
589
594
|
} : unknown;
|
|
590
|
-
type SetupInvokeTargetArrayInputConstraint<TInvoke, TStateSchemas extends Record<string, SetupStateSchema>> =
|
|
595
|
+
type SetupInvokeTargetArrayInputConstraint<TInvoke, TStateSchemas extends Record<string, SetupStateSchema>> = TInvoke extends {
|
|
596
|
+
readonly [createdInvokeConfig]: infer TConfig;
|
|
597
|
+
} ? {
|
|
598
|
+
readonly [createdInvokeConfig]: TConfig & SetupInvokeTargetArrayInputConstraint<TConfig, TStateSchemas>;
|
|
599
|
+
} : [TInvoke] extends [readonly unknown[]] ? {
|
|
591
600
|
[K in keyof TInvoke]: TInvoke[K] & SetupInvokeTargetArrayInputConstraint<TInvoke[K], TStateSchemas>;
|
|
592
601
|
} : [TInvoke] extends [Record<string, unknown>] ? SetupTransitionPropertyTargetArrayInputConstraint<TInvoke, 'onDone', TStateSchemas> & SetupTransitionPropertyTargetArrayInputConstraint<TInvoke, 'onError', TStateSchemas> & SetupTransitionPropertyTargetArrayInputConstraint<TInvoke, 'onSnapshot', TStateSchemas> & SetupTransitionPropertyTargetArrayInputConstraint<TInvoke, 'onTimeout', TStateSchemas> : unknown;
|
|
593
602
|
type SetupStateNodeTargetArrayInputConstraint<TConfig, TSiblingStateSchemas extends Record<string, SetupStateSchema>, TStateSchema extends SetupStateSchema, TChildStateSchemas extends Record<string, SetupStateSchema>> = SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'on', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>, true> & SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'always', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>> & SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'after', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>, true> & SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'onDone', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>> & SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'onError', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>> & SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'onTimeout', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>> & SetupTransitionPropertyTargetArrayInputConstraint<TConfig, 'choice', SetupStateTransitionSchemas<TSiblingStateSchemas, TStateSchema>> & (TConfig extends {
|
|
@@ -908,16 +917,20 @@ type StateNodeConfigWithNestedInputBase<TSiblingStateSchemas extends Record<stri
|
|
|
908
917
|
}, TStateSchema['states'] extends Record<string, SetupStateSchema> ? StatesWithInput<SetupStateSchemasWithParentType<WithRootSetupStateSchemas<TStateSchema['states'], RootSetupStateSchemas<TSiblingStateSchemas>>, TStateSchema extends {
|
|
909
918
|
type: infer TType extends SetupStateType;
|
|
910
919
|
} ? TType : never>, TStateSchema['states'], TContext, ActiveStateContextShape<TStateSchema, TContextShape>, TEvent, TChildren, TDelays, TTag, TOutput, TEmitted, TStateMeta, TTransitionMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry> : {
|
|
911
|
-
[K in string]?:
|
|
920
|
+
[K in string]?: StateNodeConfigWithNestedInput<UncheckedSetupStateSchemas, SetupStateSchema, TContext, ActiveStateContextShape<TStateSchema, TContextShape>, TEvent, TChildren, TDelays, TTag, TOutput, TEmitted, TStateMeta, TTransitionMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
912
921
|
}>;
|
|
913
922
|
type StateNodeConfigWithNestedInput<TSiblingStateSchemas extends Record<string, SetupStateSchema>, TStateSchema extends SetupStateSchema, TContext extends MachineContext, TContextShape, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TDelays extends string, TTag extends string, TOutput, TEmitted extends EventObject, TStateMeta extends MetaObject, TTransitionMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry> = SetupStateNodeContract<TStateSchema, StateNodeConfigWithNestedInputBase<TSiblingStateSchemas, TStateSchema, TContext, TContextShape, TEvent, TChildren, TDelays, TTag, TOutput, TEmitted, TStateMeta, TTransitionMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>, TContext, TEvent, TSiblingStateSchemas>;
|
|
914
923
|
type StateTransitions<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TInput = undefined, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas>> = {
|
|
915
924
|
[K in EventDescriptor<TEvent>]?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, ExtractEvent<TEvent, K>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, TInput, TTarget, TKnownTarget>;
|
|
916
|
-
}
|
|
925
|
+
} & (string extends TEvent['type'] ? unknown : {
|
|
926
|
+
[K in `xstate.${string}`]?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, {
|
|
927
|
+
type: K;
|
|
928
|
+
}, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, TInput, TTarget, TKnownTarget>;
|
|
929
|
+
});
|
|
917
930
|
type InvokeDoneEvent<TInvoke> = TInvoke extends {
|
|
918
931
|
onDone?: Next_TransitionConfigOrTarget<infer _TContext, infer TDoneEvent, infer _TEvent, infer _TEmitted, infer _TActionMap, infer _TActorMap, infer _TGuardMap, infer _TDelayMap, infer _TMeta>;
|
|
919
932
|
} ? Cast<TDoneEvent, EventObject> : DoneActorEvent;
|
|
920
|
-
type
|
|
933
|
+
type PlainSetupInvokeConfig<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TStateInput = undefined> = Next_InvokeConfig<TContext, TEvent, TEmitted, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta, TSystemRegistry, TStateInput> extends infer TInvoke ? TInvoke extends any ? DistributiveOmit<TInvoke, 'onDone' | 'onError' | 'onSnapshot' | 'onTimeout'> & {
|
|
921
934
|
onDone?: TInvoke extends {
|
|
922
935
|
onDone?: infer TOnDone;
|
|
923
936
|
} ? [
|
|
@@ -927,10 +940,113 @@ type SetupInvokeConfig<TStateSchemas extends Record<string, SetupStateSchema>, T
|
|
|
927
940
|
onSnapshot?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, SnapshotEvent<any>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
928
941
|
onTimeout?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, TEvent, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
929
942
|
} : never : never;
|
|
943
|
+
declare const createdInvoke: unique symbol;
|
|
944
|
+
/** @public Type-only scope carried by setup-created invoke configs. */
|
|
945
|
+
export interface CreatedInvoke<TLogic extends AnyActorLogic, TContext extends MachineContext, TContextShape, TStateSchemas extends Record<string, SetupStateSchema>, TStateInput, TConfig = unknown> {
|
|
946
|
+
src: NoInfer<TLogic>;
|
|
947
|
+
readonly [createdInvoke]: {
|
|
948
|
+
context: TContext;
|
|
949
|
+
contextShape: TContextShape;
|
|
950
|
+
states: TStateSchemas;
|
|
951
|
+
input: TStateInput;
|
|
952
|
+
child: NoInfer<{
|
|
953
|
+
id: TConfig extends {
|
|
954
|
+
id: infer TId;
|
|
955
|
+
} ? TId : undefined;
|
|
956
|
+
ref: ActorRefFromLogic<TLogic>;
|
|
957
|
+
}>;
|
|
958
|
+
};
|
|
959
|
+
readonly [createdInvokeConfig]: NoInfer<TConfig>;
|
|
960
|
+
}
|
|
961
|
+
type CreatedInvokeTransitionData<TTransition> = TTransition extends (...args: any[]) => infer TResult ? CreatedInvokeTransitionData<TResult> : TTransition extends {
|
|
962
|
+
target: infer TTarget;
|
|
963
|
+
} ? {
|
|
964
|
+
target: TTarget;
|
|
965
|
+
} & (TTransition extends {
|
|
966
|
+
input: infer TInput;
|
|
967
|
+
} ? {
|
|
968
|
+
input: TInput extends (...args: any[]) => infer TResult ? TResult : TInput;
|
|
969
|
+
} : unknown) : {};
|
|
970
|
+
type CreatedInvokeValidationConfig<TConfig> = TConfig extends unknown ? {
|
|
971
|
+
[K in keyof TConfig as K extends 'id' | 'onDone' | 'onError' | 'onSnapshot' | 'onTimeout' ? K : never]: K extends 'id' ? TConfig[K] : CreatedInvokeTransitionData<TConfig[K]>;
|
|
972
|
+
} : never;
|
|
973
|
+
type CreatedInvokeId<TLogic extends AnyActorLogic, TChildren> = string extends keyof TChildren ? {
|
|
974
|
+
id?: string;
|
|
975
|
+
} : [keyof TChildren] extends [never] ? {
|
|
976
|
+
id?: string;
|
|
977
|
+
} : {
|
|
978
|
+
id: {
|
|
979
|
+
[K in keyof TChildren & string]: ActorRefFromLogic<TLogic> extends NonNullable<TChildren[K]> ? K : never;
|
|
980
|
+
}[keyof TChildren & string];
|
|
981
|
+
};
|
|
982
|
+
type CreatedInvokeChildContract<TChildren> = string extends keyof TChildren ? unknown : [keyof TChildren] extends [never] ? unknown : {
|
|
983
|
+
[K in keyof TChildren & string]: {
|
|
984
|
+
id: K;
|
|
985
|
+
ref: NonNullable<TChildren[K]>;
|
|
986
|
+
};
|
|
987
|
+
}[keyof TChildren & string];
|
|
988
|
+
type ValidateCreatedInvokeChild<TInvoke, TChildren> = TInvoke extends {
|
|
989
|
+
readonly [createdInvoke]: unknown;
|
|
990
|
+
} ? {
|
|
991
|
+
readonly [createdInvoke]: {
|
|
992
|
+
child: CreatedInvokeChildContract<TChildren>;
|
|
993
|
+
};
|
|
994
|
+
} : TInvoke extends readonly unknown[] ? {
|
|
995
|
+
[K in keyof TInvoke]: ValidateCreatedInvokeChild<TInvoke[K], TChildren>;
|
|
996
|
+
} : unknown;
|
|
997
|
+
type ValidateCreatedInvokeChildren<TConfig, TChildren> = (TConfig extends {
|
|
998
|
+
invoke: infer TInvoke;
|
|
999
|
+
} ? {
|
|
1000
|
+
invoke?: ValidateCreatedInvokeChild<TInvoke, TChildren>;
|
|
1001
|
+
} : unknown) & (TConfig extends {
|
|
1002
|
+
states: infer TStates;
|
|
1003
|
+
} ? {
|
|
1004
|
+
states?: {
|
|
1005
|
+
[K in keyof TStates]: ValidateCreatedInvokeChildren<TStates[K], TChildren>;
|
|
1006
|
+
};
|
|
1007
|
+
} : unknown);
|
|
1008
|
+
type CreatedInvokeInput<TLogic extends AnyActorLogic, TArgs, TInput = InputFrom<NoInfer<TLogic>>, TValue = TInput | ((args: TArgs) => TInput)> = undefined extends TInput ? {
|
|
1009
|
+
input?: TValue;
|
|
1010
|
+
} : {
|
|
1011
|
+
input: TValue;
|
|
1012
|
+
};
|
|
1013
|
+
/** @public An invoke config whose callbacks are checked against its source logic. */
|
|
1014
|
+
export type CreateInvokeConfig<TLogic extends AnyActorLogic, TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TStateInput = undefined> = CreatedInvokeId<NoInfer<TLogic>, TChildren> & CreatedInvokeInput<TLogic, InvokeInputArgs<TContext, TEvent, TEmitted, TChildren, TStateInput>> & Omit<Next_InvokeConfigBase<TContext, TEvent, TEmitted, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta, TSystemRegistry, DoneActorEvent<OutputFrom<NoInfer<TLogic>>>, ErrorActorEvent<ErrorFrom<NoInfer<TLogic>>>>, 'id' | 'onDone' | 'onError' | 'onSnapshot' | 'onTimeout'> & {
|
|
1015
|
+
src: TLogic;
|
|
1016
|
+
schemas?: never;
|
|
1017
|
+
onDone?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, DoneActorEvent<OutputFrom<NoInfer<TLogic>>>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
1018
|
+
onError?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, ErrorActorEvent<ErrorFrom<NoInfer<TLogic>>>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
1019
|
+
onSnapshot?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, SnapshotEvent<SnapshotFrom<NoInfer<TLogic>>>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
1020
|
+
onTimeout?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, ActorTimeoutEvent, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
1021
|
+
};
|
|
1022
|
+
type AsyncInvokeSchemaOutput<TSchema extends StandardSchemaV1, TFallback> = StandardSchemaV1 extends TSchema ? TFallback : StandardSchemaV1.InferOutput<TSchema>;
|
|
1023
|
+
/** @public An inline async invoke whose schemas and function determine its actor types. */
|
|
1024
|
+
export type CreateAsyncInvokeConfig<TOutput, TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TErrorSchema extends StandardSchemaV1, TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TStateInput = undefined> = CreatedInvokeId<AsyncActorLogic<NoInfer<TOutput>, AsyncInvokeSchemaOutput<NoInfer<TInputSchema>, NonReducibleUnknown>, EventObject, AsyncInvokeSchemaOutput<NoInfer<TErrorSchema>, unknown>>, TChildren> & CreatedInvokeInput<AsyncActorLogic<unknown, AsyncInvokeSchemaOutput<NoInfer<TInputSchema>, NonReducibleUnknown>>, InvokeInputArgs<TContext, TEvent, TEmitted, TChildren, TStateInput>> & Omit<Next_InvokeConfigBase<TContext, TEvent, TEmitted, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta, TSystemRegistry>, 'id' | 'onDone' | 'onError' | 'onSnapshot' | 'onTimeout'> & {
|
|
1025
|
+
schemas?: {
|
|
1026
|
+
input?: TInputSchema;
|
|
1027
|
+
output?: StandardSchemaV1 extends TOutputSchema ? never : TOutputSchema;
|
|
1028
|
+
error?: TErrorSchema;
|
|
1029
|
+
};
|
|
1030
|
+
src: (...args: Parameters<LogicFunction<AsyncInvokeSchemaOutput<NoInfer<TOutputSchema>, unknown>, AsyncInvokeSchemaOutput<NoInfer<TInputSchema>, NonReducibleUnknown>>>) => PromiseLike<TOutput>;
|
|
1031
|
+
onDone?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, DoneActorEvent<NoInfer<TOutput>>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, undefined, SetupStateTarget<TStateSchemas>, KnownSetupStateTarget<TStateSchemas>, NoInfer<TOutput>>;
|
|
1032
|
+
onError?: NoInfer<StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, ErrorActorEvent<NoInfer<AsyncInvokeSchemaOutput<TErrorSchema, unknown>>>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>>;
|
|
1033
|
+
onSnapshot?: NoInfer<StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, SnapshotEvent<AsyncSnapshot<TOutput, NoInfer<AsyncInvokeSchemaOutput<TInputSchema, NonReducibleUnknown>>, NoInfer<AsyncInvokeSchemaOutput<TErrorSchema, unknown>>>>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>>;
|
|
1034
|
+
onTimeout?: StateTransitionConfigOrTarget<TStateSchemas, TContext, TContextShape, ActorTimeoutEvent, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
1035
|
+
};
|
|
1036
|
+
type SetupInvokeConfig<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TStateInput = undefined> = (PlainSetupInvokeConfig<TStateSchemas, TContext, TContextShape, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, TStateInput> & {
|
|
1037
|
+
readonly [createdInvoke]?: never;
|
|
1038
|
+
}) | {
|
|
1039
|
+
readonly [createdInvoke]: {
|
|
1040
|
+
context: TContext;
|
|
1041
|
+
contextShape: TContextShape;
|
|
1042
|
+
states: TStateSchemas extends UncheckedSetupStateSchemas ? Record<string, SetupStateSchema> : TStateSchemas;
|
|
1043
|
+
input: TStateInput;
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
930
1046
|
type InvokeErrorEvent<TInvoke, TActorMap extends Sources['actors']> = TInvoke extends {
|
|
931
1047
|
src: infer TSrc;
|
|
932
1048
|
} ? TSrc extends keyof TActorMap & string ? ErrorActorEvent<ErrorFrom<TActorMap[TSrc]>> : TSrc extends AnyActorLogic ? ErrorActorEvent<ErrorFrom<TSrc>> : ErrorActorEvent : ErrorActorEvent;
|
|
933
|
-
type StateTransitionConfigOrTarget<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TInput = undefined, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas
|
|
1049
|
+
type StateTransitionConfigOrTarget<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TInput = undefined, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas>, TOutput = OutputArg<TExpressionEvent>['output']> = undefined | StateTransitionObjectConfig<TStateSchemas, TContext, TContextShape, TExpressionEvent, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, true, TTarget, TKnownTarget> | StateTransitionFunction<TStateSchemas, TContext, TContextShape, TExpressionEvent, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, TInput, TTarget, TKnownTarget, TOutput>;
|
|
934
1050
|
type StateTransitionObjectConfig<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TExpressionEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TAllowContextMapper extends boolean = true, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas>> = (StateTransitionResult<TStateSchemas, TContext, TContextShape, TMeta, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, TAllowContextMapper, TTarget, TKnownTarget> & {
|
|
935
1051
|
description?: string;
|
|
936
1052
|
}) | {
|
|
@@ -959,9 +1075,10 @@ type StateTransitionContextMapper<TContext extends MachineContext, TContextShape
|
|
|
959
1075
|
} & OutputArg<TExpressionEvent>) => ContextPatch<TContextShape, TTargetContextShape, TResolvedTargetContext>;
|
|
960
1076
|
type StateTransitionContextOrMapper<TContext extends MachineContext, TContextShape, TTargetContextShape, TResolvedTargetContext extends MachineContext, TExpressionEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry> = ContextPatch<TContextShape, TTargetContextShape, TResolvedTargetContext> | StateTransitionContextMapper<TContext, TContextShape, TTargetContextShape, TResolvedTargetContext, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
961
1077
|
type StateTransitionContext<TAllowMapper extends boolean, TContext extends MachineContext, TContextShape, TTargetContextShape, TResolvedTargetContext extends MachineContext, TExpressionEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry> = TAllowMapper extends true ? StateTransitionContextOrMapper<TContext, TContextShape, TTargetContextShape, TResolvedTargetContext, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry> : ContextPatch<TContextShape, TTargetContextShape, TResolvedTargetContext>;
|
|
962
|
-
type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TInput = undefined, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas
|
|
1078
|
+
type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TInput = undefined, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas>, TOutput = OutputArg<TExpressionEvent>['output']> = (args: {
|
|
963
1079
|
context: TContext;
|
|
964
1080
|
event: TExpressionEvent;
|
|
1081
|
+
output: TOutput;
|
|
965
1082
|
self: AnyActorRef;
|
|
966
1083
|
parent: AnyActorRef | undefined;
|
|
967
1084
|
value: StateValue;
|
|
@@ -972,7 +1089,7 @@ type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSche
|
|
|
972
1089
|
guards: TGuardMap;
|
|
973
1090
|
delays: TDelayMap;
|
|
974
1091
|
input: TInput;
|
|
975
|
-
}
|
|
1092
|
+
}, enq: EnqueueObject<TEvent, TEmitted, TSystemRegistry, Compute<CallbackActors<TActorMap>>, TChildren>) => StateTransitionResult<TStateSchemas, TContext, TContextShape, TMeta, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry, false, TTarget, TKnownTarget> | void;
|
|
976
1093
|
type StateTransitionResult<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TContextShape, TMeta extends MetaObject, TExpressionEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TSystemRegistry extends SystemRegistry, TAllowContextMapper extends boolean, TTarget extends string = SetupStateTarget<TStateSchemas>, TKnownTarget extends string = KnownSetupStateTarget<TStateSchemas>> = {
|
|
977
1094
|
target?: never;
|
|
978
1095
|
context?: StateTransitionContext<TAllowContextMapper, TContext, TContextShape, TContextShape, TContext, TExpressionEvent, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TSystemRegistry>;
|
|
@@ -1035,6 +1152,26 @@ type RootInitialTransitionWithInput<TStateSchemas extends Record<string, SetupSt
|
|
|
1035
1152
|
export interface SetupReturn<TStates extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>, TSchemas extends SetupSchemas = {}, TSetupActionMap extends Sources['actions'] = {}, TSetupActorMap extends Sources['actors'] = {}, TSetupGuardMap extends Sources['guards'] = {}, TSetupDelayMap extends Sources['delays'] = {}, TSetupDelays extends string = Extract<keyof TSetupDelayMap, string>, TSystemRegistry extends SystemRegistry = SystemRegistry, TValidator extends ActorLogicValidator | undefined = undefined> {
|
|
1036
1153
|
/** Extends the setup configuration */
|
|
1037
1154
|
extend<const TExtendSchemas extends SetupSchemas = {}, const TExtendStates extends Record<string, SetupStateSchema> = {}, TExtendActionMap extends Sources['actions'] = {}, TExtendActorMap extends Sources['actors'] = {}, TExtendGuardMap extends Sources['guards'] = {}, TExtendDelayMap extends Sources['delays'] = {}, const TExtendValidator extends ActorLogicValidator | undefined | InheritedValidator = InheritedValidator>(config: SetupExtensionConfig<TSchemas, TStates, TValidator, TExtendSchemas, TExtendStates, TExtendActionMap, TExtendActorMap, TExtendGuardMap, TExtendDelayMap, TExtendValidator>): SetupReturn<MergeSetupStateSchemas<TStates, TExtendStates>, MergeSourceMaps<TSchemas, TExtendSchemas>, MergeSourceMaps<TSetupActionMap, TExtendActionMap>, MergeSourceMaps<TSetupActorMap, TExtendActorMap>, MergeSourceMaps<TSetupGuardMap, TExtendGuardMap>, MergeSourceMaps<TSetupDelayMap, TExtendDelayMap>, TSetupDelays | Extract<keyof TExtendDelayMap, string>, TSystemRegistry, ResolveExtendedValidator<TValidator, TExtendValidator>>;
|
|
1155
|
+
/** Infers async output from src when no output schema is declared. */
|
|
1156
|
+
createInvoke<TOutput, TContext extends SetupContext<TSchemas, StandardSchemaV1>, const TInputSchema extends StandardSchemaV1 = StandardSchemaV1, const TErrorSchema extends StandardSchemaV1 = StandardSchemaV1, TContextShape = SetupContextShape<TSchemas, StandardSchemaV1, TContext>, TStateSchemas extends Record<string, SetupStateSchema> = TStates, TStateInput = undefined, const TConfig = unknown>(config: TConfig & CreateAsyncInvokeConfig<TOutput, TInputSchema, StandardSchemaV1, TErrorSchema, TStateSchemas, TContext, TContextShape, SetupEvents<TSchemas, Record<string, StandardSchemaV1>>, SetupEmitted<TSchemas, Record<string, StandardSchemaV1>>, SetupChildren<TSchemas, Record<string, StandardSchemaV1>>, SetupTransitionMeta<TSchemas, StandardSchemaV1, StandardSchemaV1>, SetupActions<TSchemas, TSetupActionMap>, TSetupActorMap, SetupGuards<TSchemas, TSetupGuardMap>, TSetupDelayMap, TSystemRegistry, TStateInput>, ...check: unknown extends TConfig ? [] : [TConfig] extends [
|
|
1157
|
+
NoInfer<CreateAsyncInvokeConfig<TOutput, TInputSchema, StandardSchemaV1, TErrorSchema, TStateSchemas, TContext, TContextShape, SetupEvents<TSchemas, Record<string, StandardSchemaV1>>, SetupEmitted<TSchemas, Record<string, StandardSchemaV1>>, SetupChildren<TSchemas, Record<string, StandardSchemaV1>>, SetupTransitionMeta<TSchemas, StandardSchemaV1, StandardSchemaV1>, SetupActions<TSchemas, TSetupActionMap>, TSetupActorMap, SetupGuards<TSchemas, TSetupGuardMap>, TSetupDelayMap, TSystemRegistry, TStateInput>> & ValidateSystemInvoke<Omit<TConfig, 'src'> & {
|
|
1158
|
+
src: AsyncActorLogic<AsyncInvokeSchemaOutput<StandardSchemaV1, TOutput>, AsyncInvokeSchemaOutput<TInputSchema, NonReducibleUnknown>, EventObject, AsyncInvokeSchemaOutput<TErrorSchema, unknown>>;
|
|
1159
|
+
}, TSystemRegistry, TSetupActorMap>
|
|
1160
|
+
] ? [] : [invalidConfig: never]): CreatedInvoke<AsyncActorLogic<AsyncInvokeSchemaOutput<StandardSchemaV1, TOutput>, AsyncInvokeSchemaOutput<TInputSchema, NonReducibleUnknown>, EventObject, AsyncInvokeSchemaOutput<TErrorSchema, unknown>>, TContext, TContextShape, TStateSchemas, TStateInput, CreatedInvokeValidationConfig<TConfig>>;
|
|
1161
|
+
/** Creates a typed inline invoke. Keep the call inline to infer its state scope. */
|
|
1162
|
+
createInvoke<TContext extends SetupContext<TSchemas, StandardSchemaV1>, const TInputSchema extends StandardSchemaV1 = StandardSchemaV1, const TOutputSchema extends StandardSchemaV1 = StandardSchemaV1, const TErrorSchema extends StandardSchemaV1 = StandardSchemaV1, TContextShape = SetupContextShape<TSchemas, StandardSchemaV1, TContext>, TStateSchemas extends Record<string, SetupStateSchema> = TStates, TStateInput = undefined, const TConfig = unknown>(config: TConfig & CreateAsyncInvokeConfig<StandardSchemaV1.InferOutput<TOutputSchema>, TInputSchema, TOutputSchema, TErrorSchema, TStateSchemas, TContext, TContextShape, SetupEvents<TSchemas, Record<string, StandardSchemaV1>>, SetupEmitted<TSchemas, Record<string, StandardSchemaV1>>, SetupChildren<TSchemas, Record<string, StandardSchemaV1>>, SetupTransitionMeta<TSchemas, StandardSchemaV1, StandardSchemaV1>, SetupActions<TSchemas, TSetupActionMap>, TSetupActorMap, SetupGuards<TSchemas, TSetupGuardMap>, TSetupDelayMap, TSystemRegistry, TStateInput> & {
|
|
1163
|
+
schemas: {
|
|
1164
|
+
output: TOutputSchema;
|
|
1165
|
+
};
|
|
1166
|
+
}, ...check: unknown extends TConfig ? [] : [TConfig] extends [
|
|
1167
|
+
NoInfer<CreateAsyncInvokeConfig<StandardSchemaV1.InferOutput<TOutputSchema>, TInputSchema, TOutputSchema, TErrorSchema, TStateSchemas, TContext, TContextShape, SetupEvents<TSchemas, Record<string, StandardSchemaV1>>, SetupEmitted<TSchemas, Record<string, StandardSchemaV1>>, SetupChildren<TSchemas, Record<string, StandardSchemaV1>>, SetupTransitionMeta<TSchemas, StandardSchemaV1, StandardSchemaV1>, SetupActions<TSchemas, TSetupActionMap>, TSetupActorMap, SetupGuards<TSchemas, TSetupGuardMap>, TSetupDelayMap, TSystemRegistry, TStateInput>> & ValidateSystemInvoke<Omit<TConfig, 'src'> & {
|
|
1168
|
+
src: AsyncActorLogic<StandardSchemaV1.InferOutput<TOutputSchema>, AsyncInvokeSchemaOutput<TInputSchema, NonReducibleUnknown>, EventObject, AsyncInvokeSchemaOutput<TErrorSchema, unknown>>;
|
|
1169
|
+
}, TSystemRegistry, TSetupActorMap>
|
|
1170
|
+
] ? [] : [invalidConfig: never]): CreatedInvoke<AsyncActorLogic<StandardSchemaV1.InferOutput<TOutputSchema>, AsyncInvokeSchemaOutput<TInputSchema, NonReducibleUnknown>, EventObject, AsyncInvokeSchemaOutput<TErrorSchema, unknown>>, TContext, TContextShape, TStateSchemas, TStateInput, CreatedInvokeValidationConfig<TConfig>>;
|
|
1171
|
+
/** Creates an invoke from actor logic with its existing source types. */
|
|
1172
|
+
createInvoke<TLogic extends AnyActorLogic, TContext extends SetupContext<TSchemas, StandardSchemaV1>, TContextShape = SetupContextShape<TSchemas, StandardSchemaV1, TContext>, TStateSchemas extends Record<string, SetupStateSchema> = TStates, TStateInput = undefined, const TConfig = unknown>(config: TConfig & CreateInvokeConfig<TLogic, TStateSchemas, TContext, TContextShape, SetupEvents<TSchemas, Record<string, StandardSchemaV1>>, SetupEmitted<TSchemas, Record<string, StandardSchemaV1>>, SetupChildren<TSchemas, Record<string, StandardSchemaV1>>, SetupTransitionMeta<TSchemas, StandardSchemaV1, StandardSchemaV1>, SetupActions<TSchemas, TSetupActionMap>, TSetupActorMap, SetupGuards<TSchemas, TSetupGuardMap>, TSetupDelayMap, TSystemRegistry, TStateInput>, ...check: unknown extends TConfig ? [] : [TConfig] extends [
|
|
1173
|
+
NoInfer<CreateInvokeConfig<TLogic, TStateSchemas, TContext, TContextShape, SetupEvents<TSchemas, Record<string, StandardSchemaV1>>, SetupEmitted<TSchemas, Record<string, StandardSchemaV1>>, SetupChildren<TSchemas, Record<string, StandardSchemaV1>>, SetupTransitionMeta<TSchemas, StandardSchemaV1, StandardSchemaV1>, SetupActions<TSchemas, TSetupActionMap>, TSetupActorMap, SetupGuards<TSchemas, TSetupGuardMap>, TSetupDelayMap, TSystemRegistry, TStateInput>> & ValidateSystemInvoke<TConfig, TSystemRegistry, TSetupActorMap>
|
|
1174
|
+
] ? [] : [invalidConfig: never]): CreatedInvoke<TLogic, TContext, TContextShape, TStateSchemas, TStateInput, CreatedInvokeValidationConfig<TConfig>>;
|
|
1038
1175
|
/** Creates a state machine with the setup configuration */
|
|
1039
1176
|
createMachine<TContextSchema extends StandardSchemaV1 = StandardSchemaV1, const TEventSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, const TInternalEventSchemaMap extends Record<string, StandardSchemaV1> = {}, TEmittedSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1 = StandardSchemaV1, TOutputSchema extends StandardSchemaV1 = StandardSchemaV1, TMetaSchema extends StandardSchemaV1 = StandardSchemaV1, TTransitionMetaSchema extends StandardSchemaV1 = TMetaSchema, TTagSchema extends StandardSchemaV1 = StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, const TActionSchemaMap extends ActionSchemas = {}, const TGuardSchemaMap extends GuardSchemas = {}, _TEvent extends EventObject = EventObject, TActor extends ProvidedActor = ProvidedActor, TActionMap extends Sources['actions'] = {}, TActorMap extends Sources['actors'] = {}, TGuardMap extends Sources['guards'] = {}, TDelayMap extends Sources['delays'] = {}, TDelays extends string = Extract<keyof TDelayMap, string>, TTag extends SetupTags<TSchemas, TTagSchema> = SetupTags<TSchemas, TTagSchema>, _TInput = unknown, const TStateKeys extends string = SetupStateKey<TStates>, const TConfig extends SetupMachineConfig<TStates, TStateKeys, TSchemas, TContextSchema, TEventSchemaMap, TInternalEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTransitionMetaSchema, TTagSchema, TChildrenSchemaMap, SetupContext<TSchemas, TContextSchema>, SetupEvents<TSchemas, TEventSchemaMap, TInternalEventSchemaMap> | ChildCompletionEvents<Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>>, Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TSetupDelays | TDelays, TTag, SetupEmitted<TSchemas, TEmittedSchemaMap>, SetupMeta<TSchemas, TMetaSchema>, SetupTransitionMeta<TSchemas, TMetaSchema, TTransitionMetaSchema>, MergeSourceMaps<SetupActions<TSchemas, TSetupActionMap>, MergeSourceMaps<InferActions<TActionSchemaMap>, TActionMap>>, MergeSourceMaps<TSetupActorMap, TActorMap>, MergeSourceMaps<SetupGuards<TSchemas, TSetupGuardMap>, MergeSourceMaps<InferGuards<TGuardSchemaMap>, TGuardMap>>, MergeSourceMaps<TSetupDelayMap, TDelayMap>, TSystemRegistry, SetupContextRequired<TSchemas, TContextSchema>, TDelays, TActionMap, TActorMap, TGuardMap> = SetupMachineConfig<TStates, TStateKeys, TSchemas, TContextSchema, TEventSchemaMap, TInternalEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTransitionMetaSchema, TTagSchema, TChildrenSchemaMap, SetupContext<TSchemas, TContextSchema>, SetupEvents<TSchemas, TEventSchemaMap, TInternalEventSchemaMap> | ChildCompletionEvents<Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>>, Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TSetupDelays | TDelays, TTag, SetupEmitted<TSchemas, TEmittedSchemaMap>, SetupMeta<TSchemas, TMetaSchema>, SetupTransitionMeta<TSchemas, TMetaSchema, TTransitionMetaSchema>, MergeSourceMaps<SetupActions<TSchemas, TSetupActionMap>, MergeSourceMaps<InferActions<TActionSchemaMap>, TActionMap>>, MergeSourceMaps<TSetupActorMap, TActorMap>, MergeSourceMaps<SetupGuards<TSchemas, TSetupGuardMap>, MergeSourceMaps<InferGuards<TGuardSchemaMap>, TGuardMap>>, MergeSourceMaps<TSetupDelayMap, TDelayMap>, TSystemRegistry, SetupContextRequired<TSchemas, TContextSchema>, TDelays, TActionMap, TActorMap, TGuardMap>>(config: {
|
|
1040
1177
|
schemas?: {
|
|
@@ -1056,9 +1193,9 @@ export interface SetupReturn<TStates extends Record<string, SetupStateSchema> =
|
|
|
1056
1193
|
guards?: TGuardMap;
|
|
1057
1194
|
delays?: TDelayMap;
|
|
1058
1195
|
states?: Record<TStateKeys, unknown>;
|
|
1059
|
-
} & TConfig & RuntimeValidationConstraint<NoInfer<MachineConfigSchemas<TConfig>>, NoInfer<MachineConfigStates<TConfig>>, TValidator> & ValidateSetupDelayReferences<TConfig, TSetupDelays> & ValidateSetupStateContracts<TConfig, TStates> & ValidateEventDescriptors<TConfig, NoInfer<SetupEvents<TSchemas, TEventSchemaMap, TInternalEventSchemaMap>>> & ValidateRegistryKeys<TConfig, TSystemRegistry, MergeSourceMaps<TSetupActorMap, TActorMap>>): StateMachine<SetupContext<TSchemas, TContextSchema>, SetupEvents<TSchemas, TEventSchemaMap, TInternalEventSchemaMap> | ([
|
|
1060
|
-
|
|
1061
|
-
] ? never : {
|
|
1196
|
+
} & TConfig & RuntimeValidationConstraint<NoInfer<MachineConfigSchemas<TConfig>>, NoInfer<MachineConfigStates<TConfig>>, TValidator> & ValidateSetupDelayReferences<TConfig, TSetupDelays> & ValidateSetupStateContracts<TConfig, TStates> & NoInfer<ValidateCreatedInvokeChildren<TConfig, MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>>> & ValidateEventDescriptors<TConfig, NoInfer<SetupEvents<TSchemas, TEventSchemaMap, TInternalEventSchemaMap>>> & ValidateRegistryKeys<TConfig, TSystemRegistry, MergeSourceMaps<TSetupActorMap, TActorMap>>): [TConfig] extends [never] ? AnyStateMachine : StateMachine<SetupContext<TSchemas, TContextSchema>, SetupEvents<TSchemas, TEventSchemaMap, TInternalEventSchemaMap> | ([
|
|
1197
|
+
RoutableStateId<SetupMachineStateSchema<TConfig, TStates>>
|
|
1198
|
+
] extends [never] ? never : {
|
|
1062
1199
|
type: 'xstate.route';
|
|
1063
1200
|
to: RoutableStateId<SetupMachineStateSchema<TConfig, TStates>>;
|
|
1064
1201
|
}), Cast<MergeChildren<SetupChildren<TSchemas, TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, StateValueFromStateSchema<SetupMachineStateSchema<TConfig, TStates>>, TTag & string, SetupInput<TSchemas, TInputSchema>, SetupOrConfigOutput<TSchemas, TOutputSchema, TConfig, TStates>, SetupEmitted<TSchemas, TEmittedSchemaMap>, SetupMeta<TSchemas, TMetaSchema>, PublicStateSchema<SetupMachineStateSchema<TConfig, TStates>>, MergeSourceMaps<SetupActions<TSchemas, TSetupActionMap>, MergeSourceMaps<InferActions<TActionSchemaMap>, TActionMap>>, MergeSourceMaps<TSetupActorMap, TActorMap>, MergeSourceMaps<SetupGuards<TSchemas, TSetupGuardMap>, MergeSourceMaps<InferGuards<TGuardSchemaMap>, TGuardMap>>, DelayMapFromNames<TSetupDelays | TDelays, MergeSourceMaps<TSetupDelayMap, TDelayMap>>, SetupInternalEvents<TSchemas, TInternalEventSchemaMap>, SetupTransitionMeta<TSchemas, TMetaSchema, TTransitionMetaSchema>> & MachineIdentity<TConfig>;
|
|
@@ -1067,9 +1204,9 @@ export interface SetupReturn<TStates extends Record<string, SetupStateSchema> =
|
|
|
1067
1204
|
* addressed by a dotted path (e.g. `'loading'` or `'parent.child'`). The
|
|
1068
1205
|
* addressed state's own `input` schema is typed inside `entry`/`exit` args.
|
|
1069
1206
|
*/
|
|
1070
|
-
createStateConfig<const TPath extends StatePaths<TStates>, const TConfig extends SetupStateNodeConfig<StrictSetupStateSchemas<ResolveStateSiblingsForPath<TStates, TPath>, SetupStateTransitionChildSchemas<ResolveStatePath<TStates, TPath>>, TStates, SetupStateSelfSchema<ResolveStatePath<TStates, TPath>>>, ResolveStatePath<TStates, TPath>, TSchemas, TSetupActionMap, TSetupActorMap, TSetupGuardMap, TSetupDelayMap, TSystemRegistry>>(path: TPath, config: TConfig & NoInfer<SetupStateNodeTargetArrayInputConstraint<TConfig, StrictSetupStateSchemas<ResolveStateSiblingsForPath<TStates, TPath>, SetupStateTransitionChildSchemas<ResolveStatePath<TStates, TPath>>, TStates, SetupStateSelfSchema<ResolveStatePath<TStates, TPath>>>, ResolveStatePath<TStates, TPath>, SetupStateChildSchemas<ResolveStatePath<TStates, TPath>>>> & NoInfer<SetupStateTargetSetLegality<TConfig, TStates, TPath>> & ValidateSetupHistoryStateInput<TConfig, ResolveStatePath<TStates, TPath>, WithRootSetupStateSchemas<ResolveStateSiblingsForPath<TStates, TPath>, TStates>>): TConfig;
|
|
1207
|
+
createStateConfig<const TPath extends StatePaths<TStates>, const TConfig extends SetupStateNodeConfig<StrictSetupStateSchemas<ResolveStateSiblingsForPath<TStates, TPath>, SetupStateTransitionChildSchemas<ResolveStatePath<TStates, TPath>>, TStates, SetupStateSelfSchema<ResolveStatePath<TStates, TPath>>>, ResolveStatePath<TStates, TPath>, TSchemas, TSetupActionMap, TSetupActorMap, TSetupGuardMap, TSetupDelayMap, TSystemRegistry>>(path: TPath, config: TConfig & ValidateEventDescriptors<TConfig, NoInfer<SetupEvents<TSchemas, Record<string, StandardSchemaV1>>>> & NoInfer<SetupStateNodeTargetArrayInputConstraint<TConfig, StrictSetupStateSchemas<ResolveStateSiblingsForPath<TStates, TPath>, SetupStateTransitionChildSchemas<ResolveStatePath<TStates, TPath>>, TStates, SetupStateSelfSchema<ResolveStatePath<TStates, TPath>>>, ResolveStatePath<TStates, TPath>, SetupStateChildSchemas<ResolveStatePath<TStates, TPath>>>> & NoInfer<SetupStateTargetSetLegality<TConfig, TStates, TPath>> & ValidateSetupHistoryStateInput<TConfig, ResolveStatePath<TStates, TPath>, WithRootSetupStateSchemas<ResolveStateSiblingsForPath<TStates, TPath>, TStates>>): TConfig;
|
|
1071
1208
|
/** Creates a state node config with the setup configuration */
|
|
1072
|
-
createStateConfig<const TConfig extends SetupStateNodeConfig<TStates, SetupStateSchema, TSchemas, TSetupActionMap, TSetupActorMap, TSetupGuardMap, TSetupDelayMap, TSystemRegistry>>(config: TConfig): TConfig;
|
|
1209
|
+
createStateConfig<const TConfig extends SetupStateNodeConfig<TStates, SetupStateSchema, TSchemas, TSetupActionMap, TSetupActorMap, TSetupGuardMap, TSetupDelayMap, TSystemRegistry>>(config: TConfig & ValidateEventDescriptors<TConfig, NoInfer<SetupEvents<TSchemas, Record<string, StandardSchemaV1>>>>): TConfig;
|
|
1073
1210
|
/** State input schemas from setup config */
|
|
1074
1211
|
states: TStates;
|
|
1075
1212
|
/** Schemas from setup config */
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AnyActorLogic, AnyEventObject, InputFrom } from "./types.js";
|
|
2
|
+
/** Immutable definitions for a pure actor system. @experimental */
|
|
3
|
+
export interface SystemLogic<TLogic extends AnyActorLogic = AnyActorLogic> {
|
|
4
|
+
readonly root: TLogic;
|
|
5
|
+
/** Additional definitions used by dynamically spawned actors. */
|
|
6
|
+
readonly actors?: Readonly<Record<string, AnyActorLogic>>;
|
|
7
|
+
/** Stable names for callable external effects; implementations are never run here. */
|
|
8
|
+
readonly effects?: Readonly<Record<string, (...args: any[]) => unknown>>;
|
|
9
|
+
/** Pure, named event/snapshot mappers used by listen and subscribeTo. */
|
|
10
|
+
readonly mappers?: Readonly<Record<string, (...args: any[]) => AnyEventObject>>;
|
|
11
|
+
}
|
|
12
|
+
/** An actor identity, without a live actor or runtime. @experimental */
|
|
13
|
+
export interface SystemActorReference {
|
|
14
|
+
readonly $actor: string;
|
|
15
|
+
readonly incarnation: number;
|
|
16
|
+
}
|
|
17
|
+
/** Actor state and topology in a system snapshot. @experimental */
|
|
18
|
+
export interface SystemActorState {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly address: string;
|
|
21
|
+
readonly incarnation: number;
|
|
22
|
+
readonly logic: string;
|
|
23
|
+
readonly logicVersion?: string;
|
|
24
|
+
readonly parent?: SystemActorReference;
|
|
25
|
+
readonly registryKey?: string;
|
|
26
|
+
readonly syncSnapshot?: boolean;
|
|
27
|
+
readonly started: boolean;
|
|
28
|
+
readonly input: unknown;
|
|
29
|
+
readonly snapshot: Readonly<Record<string, any>>;
|
|
30
|
+
}
|
|
31
|
+
/** An accepted message waiting for a completed actor macrostep. @experimental */
|
|
32
|
+
export interface SystemMessage {
|
|
33
|
+
readonly source?: SystemActorReference;
|
|
34
|
+
readonly target: SystemActorReference;
|
|
35
|
+
readonly event: AnyEventObject;
|
|
36
|
+
readonly sequence: number;
|
|
37
|
+
/** Set only by the system scheduler, never by an ordinary send. */
|
|
38
|
+
readonly timerOccurrence?: number;
|
|
39
|
+
}
|
|
40
|
+
/** Absolute deadlines in the system's virtual time domain. @experimental */
|
|
41
|
+
export interface SystemTimer {
|
|
42
|
+
readonly source: SystemActorReference;
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly occurrence: number;
|
|
45
|
+
readonly scheduledAt: number;
|
|
46
|
+
readonly dueAt: number;
|
|
47
|
+
readonly sequence: number;
|
|
48
|
+
readonly event?: AnyEventObject;
|
|
49
|
+
}
|
|
50
|
+
/** External work as data. Interpret it outside the pure reducer. @experimental */
|
|
51
|
+
export interface SystemExternalEffect {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly source: SystemActorReference;
|
|
54
|
+
readonly type: string;
|
|
55
|
+
readonly kind: 'action' | 'emit' | 'deadLetter';
|
|
56
|
+
readonly params?: unknown;
|
|
57
|
+
readonly args?: readonly unknown[];
|
|
58
|
+
readonly event?: AnyEventObject;
|
|
59
|
+
readonly reason?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Acknowledges external work, optionally delivering its result to its owner. @experimental */
|
|
62
|
+
export interface SystemEffectResult {
|
|
63
|
+
type: 'xstate.system.effect.result';
|
|
64
|
+
effectId: string;
|
|
65
|
+
event?: AnyEventObject;
|
|
66
|
+
}
|
|
67
|
+
/** Complete immutable system state; no running actors are retained. @experimental */
|
|
68
|
+
export interface SystemSnapshot {
|
|
69
|
+
readonly executionId: string;
|
|
70
|
+
readonly root: string;
|
|
71
|
+
readonly now: number;
|
|
72
|
+
readonly actors: Readonly<Record<string, SystemActorState>>;
|
|
73
|
+
readonly registry: Readonly<Record<string, SystemActorReference>>;
|
|
74
|
+
readonly messages: readonly SystemMessage[];
|
|
75
|
+
readonly timers: Readonly<Record<string, SystemTimer>>;
|
|
76
|
+
readonly externalEffects: Readonly<Record<string, SystemExternalEffect>>;
|
|
77
|
+
readonly counters: Readonly<{
|
|
78
|
+
actor: number;
|
|
79
|
+
timer: number;
|
|
80
|
+
sequence: number;
|
|
81
|
+
effect: number;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
/** Options for initializing an immutable system snapshot. @experimental */
|
|
85
|
+
export interface InitialSystemTransitionOptions<TLogic extends AnyActorLogic = AnyActorLogic> {
|
|
86
|
+
input?: InputFrom<TLogic>;
|
|
87
|
+
id?: string;
|
|
88
|
+
registryKey?: string;
|
|
89
|
+
/** Namespace external effect IDs when several executions share one host. */
|
|
90
|
+
executionId?: string;
|
|
91
|
+
time?: number;
|
|
92
|
+
/** Bound immediate message chains. Exhaustion throws; the input is unchanged. */
|
|
93
|
+
maxSteps?: number;
|
|
94
|
+
}
|
|
95
|
+
/** Initialize all actors and return external work without executing it. @experimental */
|
|
96
|
+
export declare function initialSystemTransition<TLogic extends AnyActorLogic>(systemLogic: SystemLogic<TLogic>, options?: InitialSystemTransitionOptions<TLogic>): [SystemSnapshot, SystemExternalEffect[]];
|
|
97
|
+
/** Complete actor macrosteps and immediate communication in an immutable snapshot. @experimental */
|
|
98
|
+
export declare function systemTransition(systemLogic: SystemLogic, snapshot: SystemSnapshot, actorPath: string, event: AnyEventObject): [SystemSnapshot, SystemExternalEffect[]];
|
|
99
|
+
/** Process every due timer chronologically across the entire system snapshot. @experimental */
|
|
100
|
+
export declare function advanceSystemTime(systemLogic: SystemLogic, snapshot: SystemSnapshot, options: {
|
|
101
|
+
time: number;
|
|
102
|
+
maxSteps?: number;
|
|
103
|
+
}): [SystemSnapshot, SystemExternalEffect[]];
|
|
@@ -623,9 +623,9 @@ export interface LogicalTimer {
|
|
|
623
623
|
/** `self` or the logical actor that will receive `event`. */
|
|
624
624
|
target: 'self' | AnyActor;
|
|
625
625
|
/**
|
|
626
|
-
* The timer's
|
|
627
|
-
* wall-clock actor
|
|
628
|
-
* original deadline.
|
|
626
|
+
* The timer's absolute start in milliseconds, persisted from a running
|
|
627
|
+
* wall-clock actor or a successfully scheduled durable timer. Carried
|
|
628
|
+
* through restore so re-persisting keeps the original deadline.
|
|
629
629
|
*/
|
|
630
630
|
startedAt?: number;
|
|
631
631
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Type-only metadata for validating setup-created invoke transitions. */
|
|
2
|
+
export declare const createdInvokeConfig: unique symbol;
|
|
1
3
|
import { SetupStateSchemas, StandardSchemaV1 } from "./schema.types.js";
|
|
2
4
|
import type { ActionSchemas, GuardSchemas, InferEvents, InferInternalEvents } from "./base.types.js";
|
|
3
5
|
export type { ActionSchemas, GuardSchemas, InferEvents, InferInternalEvents };
|
|
@@ -182,7 +184,7 @@ type InvokeSrcArgs<TContext extends MachineContext, TEvent extends EventObject,
|
|
|
182
184
|
event: TEvent;
|
|
183
185
|
self: AnyActorRef;
|
|
184
186
|
};
|
|
185
|
-
type InvokeInputArgs<TContext extends MachineContext, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TInput = undefined> = {
|
|
187
|
+
export type InvokeInputArgs<TContext extends MachineContext, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TInput = undefined> = {
|
|
186
188
|
context: TContext;
|
|
187
189
|
event: TEvent;
|
|
188
190
|
input: TInput;
|
|
@@ -268,7 +270,7 @@ export type Next_InvokeConfig<TContext extends MachineContext, TEvent extends Ev
|
|
|
268
270
|
src: (args: InvokeSrcArgs<TContext, TEvent, TActorMap>) => K | TActorMap[K];
|
|
269
271
|
});
|
|
270
272
|
}[keyof TActorMap & string] | InlineInvokeConfig<TContext, TEvent, TEmitted, TChildren, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta, TSystemRegistry, TInput>;
|
|
271
|
-
interface Next_InvokeConfigBase<TContext extends MachineContext, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TMeta extends MetaObject, TSystemRegistry extends SystemRegistry, TDoneEvent extends EventObject = [keyof TActorMap & string] extends [never] ? DoneActorEvent<any> : DoneActorEvent<OutputFrom<TActorMap[keyof TActorMap & string]>>, TErrorEvent extends EventObject = [keyof TActorMap & string] extends [never] ? ErrorActorEvent<any> : ErrorActorEvent<ErrorFrom<TActorMap[keyof TActorMap & string]>>> {
|
|
273
|
+
export interface Next_InvokeConfigBase<TContext extends MachineContext, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TActionMap extends Sources['actions'], TActorMap extends Sources['actors'], TGuardMap extends Sources['guards'], TDelayMap extends Sources['delays'], TMeta extends MetaObject, TSystemRegistry extends SystemRegistry, TDoneEvent extends EventObject = [keyof TActorMap & string] extends [never] ? DoneActorEvent<any> : DoneActorEvent<OutputFrom<TActorMap[keyof TActorMap & string]>>, TErrorEvent extends EventObject = [keyof TActorMap & string] extends [never] ? ErrorActorEvent<any> : ErrorActorEvent<ErrorFrom<TActorMap[keyof TActorMap & string]>>> {
|
|
272
274
|
id?: string;
|
|
273
275
|
registryKey?: keyof TSystemRegistry & string;
|
|
274
276
|
onDone?: Next_TransitionConfigOrTarget<TContext, TDoneEvent, TEvent, TEmitted, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta, undefined, TChildren>;
|
|
@@ -413,7 +415,11 @@ export interface Next_RegularStateNodeConfig<TContext extends MachineContext, TE
|
|
|
413
415
|
/** The mapping of event types to their potential transition(s). */
|
|
414
416
|
on?: {
|
|
415
417
|
[K in EventDescriptor<TEvent>]?: Next_TransitionConfigOrTarget<TContext, ExtractEvent<TEvent, K>, TEvent, TEmitted, TActionMap, TActorMap, TGuardMap, TDelayMap, TTransitionMeta, TInput, TChildren>;
|
|
416
|
-
}
|
|
418
|
+
} & (string extends TEvent['type'] ? unknown : {
|
|
419
|
+
[K in `xstate.${string}`]?: Next_TransitionConfigOrTarget<TContext, {
|
|
420
|
+
type: K;
|
|
421
|
+
}, TEvent, TEmitted, TActionMap, TActorMap, TGuardMap, TDelayMap, TTransitionMeta, TInput, TChildren>;
|
|
422
|
+
});
|
|
417
423
|
/**
|
|
418
424
|
* Enables routing to this state via `{ type: 'xstate.route', to: '#id' }`.
|
|
419
425
|
* Requires this state node to have an explicit `id`.
|
|
@@ -744,7 +750,9 @@ type InvalidTransitionMapTargets<TRootConfig, TSourcePath extends StatePath, TTr
|
|
|
744
750
|
[K in keyof TTransitionMap]: InvalidTransitionTarget<TRootConfig, TSourcePath, TTransitionMap[K]>;
|
|
745
751
|
}[keyof TTransitionMap] : never;
|
|
746
752
|
type InvalidInitialTarget<TRootConfig, TChildStates, TInitialTarget> = TInitialTarget extends string ? string extends TInitialTarget ? never : TInitialTarget extends keyof TChildStates ? never : TInitialTarget extends `#${string}` ? TInitialTarget extends AuthoredIdTargets<TRootConfig> ? never : TInitialTarget : TInitialTarget : never;
|
|
747
|
-
type InvalidInvokeTargets<TRootConfig, TSourcePath extends StatePath, TInvoke> = 0 extends 1 & TInvoke ? never : TInvoke extends
|
|
753
|
+
type InvalidInvokeTargets<TRootConfig, TSourcePath extends StatePath, TInvoke> = 0 extends 1 & TInvoke ? never : TInvoke extends {
|
|
754
|
+
readonly [createdInvokeConfig]: infer TConfig;
|
|
755
|
+
} ? InvalidInvokeTargets<TRootConfig, TSourcePath, TConfig> : TInvoke extends readonly unknown[] ? InvalidInvokeTargets<TRootConfig, TSourcePath, TInvoke[number]> : TInvoke extends Record<string, unknown> ? (TInvoke extends {
|
|
748
756
|
onDone: infer TOnDone;
|
|
749
757
|
} ? InvalidTransitionTarget<TRootConfig, TSourcePath, TOnDone> : never) | (TInvoke extends {
|
|
750
758
|
onError: infer TOnError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createActor = require('./createActor-
|
|
3
|
+
var createActor = require('./createActor-521c8805.development.cjs.js');
|
|
4
4
|
|
|
5
5
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
6
6
|
const result = microsteps.map(([snapshot, actions, transitions]) => [snapshot, actions, transitions ?? []]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createActor = require('./createActor-
|
|
3
|
+
var createActor = require('./createActor-29adb8a4.cjs.js');
|
|
4
4
|
|
|
5
5
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
6
6
|
const result = microsteps.map(([snapshot, actions, transitions]) => [snapshot, actions, transitions ?? []]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as createInertActorScope, x as setInertActorScopeSnapshot,
|
|
1
|
+
import { w as createInertActorScope, x as setInertActorScopeSnapshot, a9 as finalizeTransitionResult, A as attachSnapshotActorRef, O as createInitEvent, aC as hasAmbientInspector, z as beginSpawnAllocation, B as macrostep, P as createSpawnEffect, Q as initialMicrostep, a3 as isAtomicStateNode, aD as getProperAncestors, aE as isRemoteActorRef, a8 as getActorIdPrefix } from './createActor-8493caa9.esm.js';
|
|
2
2
|
|
|
3
3
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
4
4
|
const result = microsteps.map(([snapshot, actions, transitions]) => [snapshot, actions, transitions ?? []]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as createInertActorScope, x as setInertActorScopeSnapshot,
|
|
1
|
+
import { w as createInertActorScope, x as setInertActorScopeSnapshot, a9 as finalizeTransitionResult, A as attachSnapshotActorRef, O as createInitEvent, aC as hasAmbientInspector, z as beginSpawnAllocation, B as macrostep, P as createSpawnEffect, Q as initialMicrostep, a3 as isAtomicStateNode, aD as getProperAncestors, aE as isRemoteActorRef, a8 as getActorIdPrefix } from './createActor-bd2527dc.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
4
4
|
const result = microsteps.map(([snapshot, actions, transitions]) => [snapshot, actions, transitions ?? []]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createActor = require('./createActor-
|
|
3
|
+
var createActor = require('./createActor-521c8805.development.cjs.js');
|
|
4
4
|
|
|
5
5
|
function assertValid(validator, request) {
|
|
6
6
|
const error = validator.check(request);
|
|
@@ -900,7 +900,7 @@ class TimeoutError extends Error {
|
|
|
900
900
|
|
|
901
901
|
function createAsyncLogic(asyncLogic) {
|
|
902
902
|
const config = asyncLogic;
|
|
903
|
-
|
|
903
|
+
const logic = createLogic({
|
|
904
904
|
id: config.id,
|
|
905
905
|
validator: config.validator,
|
|
906
906
|
schemas: config.schemas,
|
|
@@ -1018,6 +1018,13 @@ function createAsyncLogic(asyncLogic) {
|
|
|
1018
1018
|
};
|
|
1019
1019
|
}
|
|
1020
1020
|
});
|
|
1021
|
+
Object.defineProperty(logic, createActor.systemLogicMetadata, {
|
|
1022
|
+
value: {
|
|
1023
|
+
kind: 'async',
|
|
1024
|
+
timeout: config.timeout
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
return logic;
|
|
1021
1028
|
}
|
|
1022
1029
|
|
|
1023
1030
|
const emptyLogic = /* #__PURE__ */createLogic({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createActor = require('./createActor-
|
|
3
|
+
var createActor = require('./createActor-29adb8a4.cjs.js');
|
|
4
4
|
|
|
5
5
|
function assertValid(validator, request) {
|
|
6
6
|
const error = validator.check(request);
|
|
@@ -900,7 +900,7 @@ class TimeoutError extends Error {
|
|
|
900
900
|
|
|
901
901
|
function createAsyncLogic(asyncLogic) {
|
|
902
902
|
const config = asyncLogic;
|
|
903
|
-
|
|
903
|
+
const logic = createLogic({
|
|
904
904
|
id: config.id,
|
|
905
905
|
validator: config.validator,
|
|
906
906
|
schemas: config.schemas,
|
|
@@ -1018,6 +1018,13 @@ function createAsyncLogic(asyncLogic) {
|
|
|
1018
1018
|
};
|
|
1019
1019
|
}
|
|
1020
1020
|
});
|
|
1021
|
+
Object.defineProperty(logic, createActor.systemLogicMetadata, {
|
|
1022
|
+
value: {
|
|
1023
|
+
kind: 'async',
|
|
1024
|
+
timeout: config.timeout
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
return logic;
|
|
1021
1028
|
}
|
|
1022
1029
|
|
|
1023
1030
|
const emptyLogic = /* #__PURE__ */createLogic({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as createInitEvent, y as createDeadLetterEffect,
|
|
1
|
+
import { O as createInitEvent, y as createDeadLetterEffect, au as XSTATE_STOP, av as createCustomEffect, aw as XSTATE_LOGIC_EFFECT_START, ax as XSTATE_LOGIC_EFFECT_RESOLVE, ay as XSTATE_LOGIC_EFFECT_REJECT, a9 as finalizeTransitionResult, az as createEmitEffect, aA as createSendToEffect, aB as XSTATE_INIT, a2 as parseDelayToMilliseconds, a7 as systemLogicMetadata, ar as runStep, a1 as createActor } from './createActor-bd2527dc.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function assertValid(validator, request) {
|
|
4
4
|
const error = validator.check(request);
|
|
@@ -898,7 +898,7 @@ class TimeoutError extends Error {
|
|
|
898
898
|
|
|
899
899
|
function createAsyncLogic(asyncLogic) {
|
|
900
900
|
const config = asyncLogic;
|
|
901
|
-
|
|
901
|
+
const logic = createLogic({
|
|
902
902
|
id: config.id,
|
|
903
903
|
validator: config.validator,
|
|
904
904
|
schemas: config.schemas,
|
|
@@ -1016,6 +1016,13 @@ function createAsyncLogic(asyncLogic) {
|
|
|
1016
1016
|
};
|
|
1017
1017
|
}
|
|
1018
1018
|
});
|
|
1019
|
+
Object.defineProperty(logic, systemLogicMetadata, {
|
|
1020
|
+
value: {
|
|
1021
|
+
kind: 'async',
|
|
1022
|
+
timeout: config.timeout
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
return logic;
|
|
1019
1026
|
}
|
|
1020
1027
|
|
|
1021
1028
|
const emptyLogic = /* #__PURE__ */createLogic({
|