xstate 5.0.0-beta.14 → 5.0.0-beta.16
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 -3
- package/actions/dist/xstate-actions.cjs.mjs +0 -2
- package/actions/dist/xstate-actions.development.cjs.js +1 -3
- 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 +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-444a17c3.esm.js → actions-0386b622.esm.js} +934 -997
- package/dist/{actions-73b8d456.development.cjs.js → actions-0f903c0d.development.cjs.js} +863 -928
- package/dist/{actions-17c3bcfa.cjs.js → actions-6b9073db.cjs.js} +934 -999
- package/dist/{actions-60622c0c.development.esm.js → actions-6f7fbc84.development.esm.js} +863 -926
- package/dist/declarations/src/State.d.ts +1 -11
- package/dist/declarations/src/StateMachine.d.ts +4 -11
- package/dist/declarations/src/actionTypes.d.ts +1 -1
- package/dist/declarations/src/actions/assign.d.ts +2 -2
- package/dist/declarations/src/actions/cancel.d.ts +2 -2
- package/dist/declarations/src/actions/send.d.ts +12 -22
- package/dist/declarations/src/actions/stop.d.ts +2 -2
- package/dist/declarations/src/actions.d.ts +1 -4
- package/dist/declarations/src/actors/callback.d.ts +3 -3
- package/dist/declarations/src/actors/index.d.ts +1 -1
- package/dist/declarations/src/actors/promise.d.ts +13 -3
- package/dist/declarations/src/guards.d.ts +1 -1
- package/dist/declarations/src/interpreter.d.ts +2 -2
- package/dist/declarations/src/stateUtils.d.ts +3 -2
- package/dist/declarations/src/types.d.ts +44 -71
- package/dist/declarations/src/utils.d.ts +3 -3
- package/dist/xstate.cjs.js +44 -59
- package/dist/xstate.development.cjs.js +44 -59
- package/dist/xstate.development.esm.js +45 -60
- package/dist/xstate.esm.js +45 -60
- 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 +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +2 -1
|
@@ -21,16 +21,6 @@ export declare class State<TContext extends MachineContext, TEvent extends Event
|
|
|
21
21
|
context: TContext;
|
|
22
22
|
historyValue: Readonly<HistoryValue<TContext, TEvent>>;
|
|
23
23
|
_internalQueue: Array<TEvent>;
|
|
24
|
-
_initial: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Indicates whether the state has changed from the previous state. A state is considered "changed" if:
|
|
27
|
-
*
|
|
28
|
-
* - Its value is not equal to its previous value, or:
|
|
29
|
-
* - It has any new actions (side-effects) to execute.
|
|
30
|
-
*
|
|
31
|
-
* An initial state (with no history) will return `undefined`.
|
|
32
|
-
*/
|
|
33
|
-
changed: boolean | undefined;
|
|
34
24
|
/**
|
|
35
25
|
* The enabled state nodes representative of the state value.
|
|
36
26
|
*/
|
|
@@ -56,7 +46,7 @@ export declare class State<TContext extends MachineContext, TEvent extends Event
|
|
|
56
46
|
* @param stateValue
|
|
57
47
|
* @param delimiter The character(s) that separate each subpath in the string state node path.
|
|
58
48
|
*/
|
|
59
|
-
toStrings(stateValue?: StateValue
|
|
49
|
+
toStrings(stateValue?: StateValue): string[];
|
|
60
50
|
toJSON(): Omit<this, "meta" | "toJSON" | "configuration" | "tags" | "machine" | "toStrings" | "matches" | "hasTag" | "can" | "nextEvents"> & {
|
|
61
51
|
tags: string[];
|
|
62
52
|
meta: Record<string, any>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { State } from "./State.js";
|
|
2
2
|
import { StateNode } from "./StateNode.js";
|
|
3
3
|
import type { AreAllImplementationsAssumedToBeProvided, MarkAllImplementationsAsProvided, ResolveTypegenMeta, TypegenDisabled } from "./typegenTypes.js";
|
|
4
|
-
import type { ActorContext, ActorLogic, ActorMap, EventObject, InternalMachineImplementations, MachineConfig, MachineContext, MachineImplementationsSimplified, MachineTypes, NoInfer, StateConfig, StateMachineDefinition, StateValue, TransitionDefinition, PersistedMachineState, ParameterizedObject, AnyActorContext } from "./types.js";
|
|
5
|
-
export declare const NULL_EVENT = "";
|
|
4
|
+
import type { ActorContext, ActorLogic, ActorMap, EventObject, InternalMachineImplementations, MachineConfig, MachineContext, MachineImplementationsSimplified, MachineTypes, NoInfer, StateConfig, StateMachineDefinition, StateValue, TransitionDefinition, PersistedMachineState, ParameterizedObject, AnyActorContext, Equals } from "./types.js";
|
|
6
5
|
export declare const STATE_IDENTIFIER = "#";
|
|
7
6
|
export declare const WILDCARD = "*";
|
|
8
7
|
export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject = EventObject, TAction extends ParameterizedObject = ParameterizedObject, TActorMap extends ActorMap = ActorMap, TResolvedTypesMeta = ResolveTypegenMeta<TypegenDisabled, NoInfer<TEvent>, TAction, TActorMap>> implements ActorLogic<TEvent, State<TContext, TEvent, TResolvedTypesMeta>, State<TContext, TEvent, TResolvedTypesMeta>, PersistedMachineState<State<TContext, TEvent, TResolvedTypesMeta>>> {
|
|
@@ -10,17 +9,11 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
10
9
|
* The raw config used to create the machine.
|
|
11
10
|
*/
|
|
12
11
|
config: MachineConfig<TContext, TEvent, any, any, any>;
|
|
13
|
-
getContext(input?: any): TContext;
|
|
14
|
-
private getContextAndActions;
|
|
15
12
|
/**
|
|
16
13
|
* The machine's own version.
|
|
17
14
|
*/
|
|
18
15
|
version?: string;
|
|
19
|
-
|
|
20
|
-
* The string delimiter for serializing the path to a string. The default is "."
|
|
21
|
-
*/
|
|
22
|
-
delimiter: string;
|
|
23
|
-
options: MachineImplementationsSimplified<TContext, TEvent>;
|
|
16
|
+
implementations: MachineImplementationsSimplified<TContext, TEvent>;
|
|
24
17
|
types: MachineTypes<TContext, TEvent>;
|
|
25
18
|
__xstatenode: true;
|
|
26
19
|
idMap: Map<string, StateNode<TContext, TEvent>>;
|
|
@@ -32,7 +25,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
32
25
|
/**
|
|
33
26
|
* The raw config used to create the machine.
|
|
34
27
|
*/
|
|
35
|
-
config: MachineConfig<TContext, TEvent, any, any, any>,
|
|
28
|
+
config: MachineConfig<TContext, TEvent, any, any, any>, implementations?: MachineImplementationsSimplified<TContext, TEvent>);
|
|
36
29
|
/**
|
|
37
30
|
* Clones this state machine with the provided implementations
|
|
38
31
|
* and merges the `context` (if provided).
|
|
@@ -51,7 +44,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
51
44
|
* @param state The state to resolve
|
|
52
45
|
*/
|
|
53
46
|
resolveState(state: State<TContext, TEvent, TResolvedTypesMeta>): typeof state;
|
|
54
|
-
resolveStateValue(stateValue: StateValue): State<TContext, TEvent, TResolvedTypesMeta>;
|
|
47
|
+
resolveStateValue(stateValue: StateValue, ...[context]: Equals<TContext, MachineContext> extends true ? [] : [TContext]): State<TContext, TEvent, TResolvedTypesMeta>;
|
|
55
48
|
/**
|
|
56
49
|
* Determines the next state given the current `state` and received `event`.
|
|
57
50
|
* Calculates a full macrostep from all microsteps.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionTypes } from "./types.js";
|
|
2
2
|
export declare const stop = ActionTypes.Stop;
|
|
3
3
|
export declare const raise = ActionTypes.Raise;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const sendTo = ActionTypes.SendTo;
|
|
5
5
|
export declare const cancel = ActionTypes.Cancel;
|
|
6
6
|
export declare const assign = ActionTypes.Assign;
|
|
7
7
|
export declare const after = ActionTypes.After;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Assigner, DynamicAssignAction, EventObject, LowInfer, MachineContext, PropertyAssigner } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Updates the current context of the machine.
|
|
4
4
|
*
|
|
5
5
|
* @param assignment An object that represents the partial context to update.
|
|
6
6
|
*/
|
|
7
|
-
export declare function assign<TContext extends MachineContext, TExpressionEvent extends EventObject = EventObject, TEvent extends EventObject = TExpressionEvent>(assignment: Assigner<LowInfer<TContext>, TExpressionEvent
|
|
7
|
+
export declare function assign<TContext extends MachineContext, TExpressionEvent extends EventObject = EventObject, TEvent extends EventObject = TExpressionEvent>(assignment: Assigner<LowInfer<TContext>, TExpressionEvent> | PropertyAssigner<LowInfer<TContext>, TExpressionEvent>): DynamicAssignAction<TContext, TExpressionEvent, TEvent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventObject,
|
|
1
|
+
import { EventObject, MachineContext, UnifiedArg } from "../types.js";
|
|
2
2
|
import { BaseDynamicActionObject, CancelActionObject, DynamicCancelActionObject } from "../index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cancels an in-flight `send(...)` action. A canceled sent action will not
|
|
@@ -7,4 +7,4 @@ import { BaseDynamicActionObject, CancelActionObject, DynamicCancelActionObject
|
|
|
7
7
|
*
|
|
8
8
|
* @param sendId The `id` of the `send(...)` action to cancel.
|
|
9
9
|
*/
|
|
10
|
-
export declare function cancel<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject>(sendId: string |
|
|
10
|
+
export declare function cancel<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject>(sendId: string | ((args: UnifiedArg<TContext, TExpressionEvent>) => string)): BaseDynamicActionObject<TContext, TExpressionEvent, TEvent, CancelActionObject, DynamicCancelActionObject<TContext, TExpressionEvent>['params']>;
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import { EventObject,
|
|
2
|
-
import { AnyActorRef, BaseDynamicActionObject, Cast, EventFrom,
|
|
1
|
+
import { EventObject, SendToActionParams, SendExpr, AnyEventObject, MachineContext } from "../types.js";
|
|
2
|
+
import { ActorRef, AnyActorRef, BaseDynamicActionObject, Cast, EventFrom, InferEvent, SendToActionObject, SendToActionOptions, UnifiedArg } from "../index.js";
|
|
3
3
|
/**
|
|
4
|
-
* Sends an event
|
|
5
|
-
* send the event in the next step, after the current step is finished executing.
|
|
6
|
-
*
|
|
7
|
-
* @deprecated Use the `sendTo(...)` action creator instead.
|
|
4
|
+
* Sends an event to an actor.
|
|
8
5
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
6
|
+
* @param actor The `ActorRef` to send the event to.
|
|
7
|
+
* @param event The event to send, or an expression that evaluates to the event to send
|
|
8
|
+
* @param options Send action options
|
|
11
9
|
* - `id` - The unique send event identifier (used with `cancel()`).
|
|
12
10
|
* - `delay` - The number of milliseconds to delay the sending of the event.
|
|
13
|
-
* - `to` - The target of this event (by default, the machine the event was sent from).
|
|
14
11
|
*/
|
|
15
|
-
export declare function
|
|
12
|
+
export declare function sendTo<TContext extends MachineContext, TEvent extends EventObject, TActor extends AnyActorRef>(actor: TActor | string | ((args: UnifiedArg<TContext, TEvent>) => TActor | string), eventOrExpr: EventFrom<TActor> | SendExpr<TContext, TEvent, InferEvent<Cast<EventFrom<TActor>, EventObject>>>, options?: SendToActionOptions<TContext, TEvent>): BaseDynamicActionObject<TContext, TEvent, TEvent, SendToActionObject<AnyEventObject>, SendToActionParams<TContext, TEvent>>;
|
|
16
13
|
/**
|
|
17
14
|
* Sends an event to this machine's parent.
|
|
18
15
|
*
|
|
19
16
|
* @param event The event to send to the parent machine.
|
|
20
17
|
* @param options Options to pass into the send event.
|
|
21
18
|
*/
|
|
22
|
-
export declare function sendParent<TContext extends MachineContext, TEvent extends EventObject, TSentEvent extends EventObject = AnyEventObject>(event: TSentEvent | SendExpr<TContext, TEvent, TSentEvent>, options?:
|
|
19
|
+
export declare function sendParent<TContext extends MachineContext, TEvent extends EventObject, TSentEvent extends EventObject = AnyEventObject>(event: TSentEvent | SendExpr<TContext, TEvent, TSentEvent>, options?: SendToActionOptions<TContext, TEvent>): BaseDynamicActionObject<TContext, TEvent, TEvent, SendToActionObject<AnyEventObject>, SendToActionParams<TContext, TEvent, EventObject>>;
|
|
20
|
+
type Target<TContext extends MachineContext, TEvent extends EventObject> = string | ActorRef<any, any> | ((args: UnifiedArg<TContext, TEvent>) => string | ActorRef<any, any>);
|
|
23
21
|
/**
|
|
24
22
|
* Forwards (sends) an event to a specified service.
|
|
25
23
|
*
|
|
26
24
|
* @param target The target service to forward the event to.
|
|
27
25
|
* @param options Options to pass into the send action creator.
|
|
28
26
|
*/
|
|
29
|
-
export declare function forwardTo<TContext extends MachineContext, TEvent extends EventObject>(target:
|
|
27
|
+
export declare function forwardTo<TContext extends MachineContext, TEvent extends EventObject>(target: Target<TContext, TEvent>, options?: SendToActionOptions<TContext, TEvent>): BaseDynamicActionObject<TContext, TEvent, TEvent, SendToActionObject<AnyEventObject>, SendToActionParams<TContext, TEvent, EventObject>>;
|
|
30
28
|
/**
|
|
31
29
|
* Escalates an error by sending it as an event to this machine's parent.
|
|
32
30
|
*
|
|
@@ -34,13 +32,5 @@ export declare function forwardTo<TContext extends MachineContext, TEvent extend
|
|
|
34
32
|
* takes in the `context`, `event`, and `meta`, and returns the error data to send.
|
|
35
33
|
* @param options Options to pass into the send action creator.
|
|
36
34
|
*/
|
|
37
|
-
export declare function escalate<TContext extends MachineContext, TEvent extends EventObject, TErrorData = any>(errorData: TErrorData |
|
|
38
|
-
|
|
39
|
-
* Sends an event to an actor.
|
|
40
|
-
*
|
|
41
|
-
* @param actor The `ActorRef` to send the event to.
|
|
42
|
-
* @param event The event to send, or an expression that evaluates to the event to send
|
|
43
|
-
* @param options Send action options
|
|
44
|
-
* @returns An XState send action object
|
|
45
|
-
*/
|
|
46
|
-
export declare function sendTo<TContext extends MachineContext, TEvent extends EventObject, TActor extends AnyActorRef>(actor: TActor | string | ExprWithMeta<TContext, TEvent, TActor | string>, event: EventFrom<TActor> | SendExpr<TContext, TEvent, InferEvent<Cast<EventFrom<TActor>, EventObject>>>, options?: SendActionOptions<TContext, TEvent>): BaseDynamicActionObject<TContext, TEvent, TEvent, SendActionObject<AnyEventObject>, SendActionParams<TContext, TEvent, EventObject>>;
|
|
35
|
+
export declare function escalate<TContext extends MachineContext, TEvent extends EventObject, TErrorData = any>(errorData: TErrorData | ((args: UnifiedArg<TContext, TEvent>) => TErrorData), options?: SendToActionParams<TContext, TEvent>): BaseDynamicActionObject<TContext, TEvent, TEvent, SendToActionObject<AnyEventObject>, SendToActionParams<TContext, TEvent, EventObject>>;
|
|
36
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ActorRef, BaseDynamicActionObject, DynamicStopActionObject, EventObject,
|
|
1
|
+
import { ActorRef, BaseDynamicActionObject, DynamicStopActionObject, EventObject, MachineContext, StopActionObject, UnifiedArg } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stops an actor.
|
|
4
4
|
*
|
|
5
5
|
* @param actorRef The actor to stop.
|
|
6
6
|
*/
|
|
7
|
-
export declare function stop<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject>(actorRef: string | ActorRef<any> |
|
|
7
|
+
export declare function stop<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject>(actorRef: string | ActorRef<any> | ((args: UnifiedArg<TContext, TExpressionEvent>) => ActorRef<any> | string)): BaseDynamicActionObject<TContext, TExpressionEvent, TEvent, StopActionObject, DynamicStopActionObject<TContext, TExpressionEvent>['params']>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Action, EventObject, SingleOrArray, ActionFunction, ActionFunctionMap, ActionTypes, DoneEvent, ErrorPlatformEvent, DoneEventObject, MachineContext, BaseActionObject } from "./types.js";
|
|
2
2
|
import * as actionTypes from "./actionTypes.js";
|
|
3
|
-
export {
|
|
3
|
+
export { sendTo, sendParent, forwardTo, escalate } from "./actions/send.js";
|
|
4
4
|
export { stop } from "./actions/stop.js";
|
|
5
5
|
export { log } from "./actions/log.js";
|
|
6
6
|
export { cancel } from "./actions/cancel.js";
|
|
@@ -9,9 +9,6 @@ export { raise } from "./actions/raise.js";
|
|
|
9
9
|
export { choose } from "./actions/choose.js";
|
|
10
10
|
export { pure } from "./actions/pure.js";
|
|
11
11
|
export { actionTypes };
|
|
12
|
-
export declare const initEvent: {
|
|
13
|
-
type: ActionTypes;
|
|
14
|
-
};
|
|
15
12
|
export declare function resolveActionObject(actionObject: BaseActionObject, actionFunctionMap: ActionFunctionMap<any, any>): BaseActionObject;
|
|
16
13
|
export declare function toActionObject<TContext extends MachineContext, TEvent extends EventObject>(action: BaseActionObject | ActionFunction<TContext, TEvent> | string): BaseActionObject;
|
|
17
14
|
export declare const toActionObjects: <TContext extends MachineContext, TEvent extends EventObject>(action?: SingleOrArray<Action<TContext, TEvent>> | undefined) => BaseActionObject[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InvokeCallback, ActorLogic, EventObject } from "../types.js";
|
|
2
|
-
export interface CallbackInternalState {
|
|
2
|
+
export interface CallbackInternalState<TEvent extends EventObject> {
|
|
3
3
|
canceled: boolean;
|
|
4
|
-
receivers: Set<(e:
|
|
4
|
+
receivers: Set<(e: TEvent) => void>;
|
|
5
5
|
dispose: void | (() => void) | Promise<any>;
|
|
6
6
|
input?: any;
|
|
7
7
|
}
|
|
8
|
-
export declare function fromCallback<TEvent extends EventObject>(invokeCallback: InvokeCallback): ActorLogic<TEvent, undefined, CallbackInternalState
|
|
8
|
+
export declare function fromCallback<TEvent extends EventObject>(invokeCallback: InvokeCallback): ActorLogic<TEvent, undefined, CallbackInternalState<TEvent>>;
|
|
@@ -22,7 +22,7 @@ export type LifecycleSignalType = typeof startSignalType | typeof stopSignalType
|
|
|
22
22
|
* @template TReceived The received event
|
|
23
23
|
* @template TSnapshot The emitted value
|
|
24
24
|
*/
|
|
25
|
-
export declare function isSignal(
|
|
25
|
+
export declare function isSignal(event: EventObject): event is LifecycleSignal;
|
|
26
26
|
export declare function isActorRef(item: any): item is ActorRef<any>;
|
|
27
27
|
export declare function toActorRef<TEvent extends EventObject, TSnapshot = any, TActorRefLike extends BaseActorRef<TEvent> = BaseActorRef<TEvent>>(actorRefLike: TActorRefLike): ActorRef<TEvent, TSnapshot> & Omit<TActorRefLike, keyof ActorRef<any, any>>;
|
|
28
28
|
export declare function createEmptyActor(): ActorRef<AnyEventObject, undefined>;
|
|
@@ -4,9 +4,19 @@ export interface PromiseInternalState<T> {
|
|
|
4
4
|
data: T | undefined;
|
|
5
5
|
input?: any;
|
|
6
6
|
}
|
|
7
|
+
declare const resolveEventType = "$$xstate.resolve";
|
|
8
|
+
declare const rejectEventType = "$$xstate.reject";
|
|
9
|
+
export type PromiseEvent<T> = {
|
|
10
|
+
type: typeof resolveEventType;
|
|
11
|
+
data: T;
|
|
12
|
+
} | {
|
|
13
|
+
type: typeof rejectEventType;
|
|
14
|
+
data: any;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'xstate.stop';
|
|
17
|
+
};
|
|
7
18
|
export declare function fromPromise<T>(promiseCreator: ({ input, system }: {
|
|
8
19
|
input: any;
|
|
9
20
|
system: AnyActorSystem;
|
|
10
|
-
}) => PromiseLike<T>): ActorLogic<
|
|
11
|
-
|
|
12
|
-
}, T | undefined, PromiseInternalState<T>>;
|
|
21
|
+
}) => PromiseLike<T>): ActorLogic<PromiseEvent<T>, T | undefined, PromiseInternalState<T>>;
|
|
22
|
+
export {};
|
|
@@ -5,4 +5,4 @@ export declare function not<TContext extends MachineContext, TEvent extends Even
|
|
|
5
5
|
export declare function and<TContext extends MachineContext, TEvent extends EventObject>(guards: Array<GuardConfig<TContext, TEvent>>): BooleanGuardDefinition<TContext, TEvent>;
|
|
6
6
|
export declare function or<TContext extends MachineContext, TEvent extends EventObject>(guards: Array<GuardConfig<TContext, TEvent>>): BooleanGuardDefinition<TContext, TEvent>;
|
|
7
7
|
export declare function evaluateGuard<TContext extends MachineContext, TEvent extends EventObject>(guard: GuardDefinition<TContext, TEvent>, context: TContext, event: TEvent, state: State<TContext, TEvent>): boolean;
|
|
8
|
-
export declare function toGuardDefinition<TContext extends MachineContext, TEvent extends EventObject>(guardConfig: GuardConfig<TContext, TEvent>, getPredicate?: (guardType: string) => GuardPredicate<TContext, TEvent>): GuardDefinition<TContext, TEvent>;
|
|
8
|
+
export declare function toGuardDefinition<TContext extends MachineContext, TEvent extends EventObject>(guardConfig: GuardConfig<TContext, TEvent>, getPredicate?: (guardType: string) => GuardPredicate<TContext, TEvent> | GuardDefinition<TContext, TEvent>): GuardDefinition<TContext, TEvent>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { symbolObservable } from "./symbolObservable.js";
|
|
2
2
|
import { AreAllImplementationsAssumedToBeProvided, MissingImplementationsError } from "./typegenTypes.js";
|
|
3
3
|
import type { ActorSystem, AnyActorLogic, AnyStateMachine, EventFromLogic, InterpreterFrom, PersistedStateFrom, RaiseActionObject, SnapshotFrom } from "./types.js";
|
|
4
|
-
import { ActorRef, EventObject, InteropSubscribable, InterpreterOptions, Observer,
|
|
4
|
+
import { ActorRef, EventObject, InteropSubscribable, InterpreterOptions, Observer, SendToActionObject, Subscription } from "./types.js";
|
|
5
5
|
export type SnapshotListener<TLogic extends AnyActorLogic> = (state: SnapshotFrom<TLogic>) => void;
|
|
6
6
|
export type EventListener<TEvent extends EventObject = EventObject> = (event: TEvent) => void;
|
|
7
7
|
export type Listener = () => void;
|
|
@@ -80,7 +80,7 @@ export declare class Interpreter<TLogic extends AnyActorLogic, TEvent extends Ev
|
|
|
80
80
|
* @param event The event to send
|
|
81
81
|
*/
|
|
82
82
|
send(event: TEvent): void;
|
|
83
|
-
delaySend(sendAction:
|
|
83
|
+
delaySend(sendAction: SendToActionObject | RaiseActionObject<any, any, any>): void;
|
|
84
84
|
cancel(sendId: string | number): void;
|
|
85
85
|
private attachDevTools;
|
|
86
86
|
toJSON(): {
|
|
@@ -6,6 +6,7 @@ import { AnyActorContext, AnyHistoryValue, AnyState, AnyStateNode, AnyTransition
|
|
|
6
6
|
type Configuration<TContext extends MachineContext, TE extends EventObject> = Iterable<StateNode<TContext, TE>>;
|
|
7
7
|
type AnyConfiguration = Configuration<any, any>;
|
|
8
8
|
type AdjList = Map<AnyStateNode, Array<AnyStateNode>>;
|
|
9
|
+
export declare const isAtomicStateNode: (stateNode: StateNode<any, any>) => boolean;
|
|
9
10
|
export declare function getConfiguration(stateNodes: Iterable<AnyStateNode>): Set<AnyStateNode>;
|
|
10
11
|
export declare function getAdjList<TContext extends MachineContext, TE extends EventObject>(configuration: Configuration<TContext, TE>): AdjList;
|
|
11
12
|
export declare function getStateValue(rootNode: AnyStateNode, configuration: AnyConfiguration): StateValue;
|
|
@@ -52,8 +53,8 @@ export declare function removeConflictingTransitions(enabledTransitions: Array<A
|
|
|
52
53
|
* @param currentState
|
|
53
54
|
* @param mutConfiguration
|
|
54
55
|
*/
|
|
55
|
-
export declare function microstep<TContext extends MachineContext, TEvent extends EventObject>(transitions: Array<TransitionDefinition<TContext, TEvent>>, currentState: State<TContext, TEvent, any>, actorCtx: AnyActorContext, event: TEvent): State<TContext, TEvent, any>;
|
|
56
|
-
export declare function resolveActionsAndContext<TContext extends MachineContext, TEvent extends EventObject>(actions: BaseActionObject[], event: TEvent, currentState: State<TContext, TEvent, any>, actorCtx: AnyActorContext
|
|
56
|
+
export declare function microstep<TContext extends MachineContext, TEvent extends EventObject>(transitions: Array<TransitionDefinition<TContext, TEvent>>, currentState: State<TContext, TEvent, any>, actorCtx: AnyActorContext, event: TEvent, isInitial: boolean): State<TContext, TEvent, any>;
|
|
57
|
+
export declare function resolveActionsAndContext<TContext extends MachineContext, TEvent extends EventObject>(actions: BaseActionObject[], event: TEvent, currentState: State<TContext, TEvent, any>, actorCtx: AnyActorContext): AnyState;
|
|
57
58
|
export declare function macrostep(state: AnyState, event: EventObject, actorCtx: AnyActorContext): {
|
|
58
59
|
state: typeof state;
|
|
59
60
|
microstates: Array<typeof state>;
|