@lite-fsm/core 2.0.4 → 2.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MachineManager.d.cts +1 -3
- package/dist/MachineManager.d.ts +1 -3
- package/dist/actor.d.cts +1 -7
- package/dist/actor.d.ts +1 -7
- package/dist/actorEffects.d.cts +2 -0
- package/dist/actorEffects.d.ts +2 -0
- package/dist/createMachine.d.cts +3 -34
- package/dist/createMachine.d.ts +3 -34
- package/dist/createMachine.types.d.cts +166 -0
- package/dist/createMachine.types.d.ts +166 -0
- package/dist/hydration.d.cts +2 -1
- package/dist/hydration.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1 -1
- package/dist/interfaces.d.cts +40 -19
- package/dist/interfaces.d.ts +40 -19
- package/dist/internal.d.cts +0 -1
- package/dist/internal.d.ts +0 -1
- package/dist/managerNormalize.d.cts +9 -2
- package/dist/managerNormalize.d.ts +9 -2
- package/dist/plugin.d.cts +81 -0
- package/dist/plugin.d.ts +81 -0
- package/dist/pluginHelpers.d.cts +68 -0
- package/dist/pluginHelpers.d.ts +68 -0
- package/dist/pluginNormalize.d.cts +16 -0
- package/dist/pluginNormalize.d.ts +16 -0
- package/dist/pluginStorage.d.cts +20 -0
- package/dist/pluginStorage.d.ts +20 -0
- package/dist/pluginStorageNormalize.d.cts +3 -0
- package/dist/pluginStorageNormalize.d.ts +3 -0
- package/dist/pluginStorageTypes.d.cts +326 -0
- package/dist/pluginStorageTypes.d.ts +326 -0
- package/dist/pluginTypes.d.cts +102 -0
- package/dist/pluginTypes.d.ts +102 -0
- package/dist/runtime/defaultPreset.d.cts +2 -0
- package/dist/runtime/defaultPreset.d.ts +2 -0
- package/dist/runtime/instance/manager.d.cts +37 -0
- package/dist/runtime/instance/manager.d.ts +37 -0
- package/dist/runtime/instance/plugin.d.cts +3 -0
- package/dist/runtime/instance/plugin.d.ts +3 -0
- package/dist/runtime/instance/storage.d.cts +3 -0
- package/dist/runtime/instance/storage.d.ts +3 -0
- package/dist/runtime/kernel/actionView.d.cts +2 -0
- package/dist/runtime/kernel/actionView.d.ts +2 -0
- package/dist/runtime/kernel/bucketRuntime.d.cts +34 -0
- package/dist/runtime/kernel/bucketRuntime.d.ts +34 -0
- package/dist/runtime/kernel/callbackValidation.d.cts +11 -0
- package/dist/runtime/kernel/callbackValidation.d.ts +11 -0
- package/dist/runtime/kernel/createMachineManagerFactory.d.cts +13 -0
- package/dist/runtime/kernel/createMachineManagerFactory.d.ts +13 -0
- package/dist/runtime/kernel/registry.d.cts +23 -0
- package/dist/runtime/kernel/registry.d.ts +23 -0
- package/dist/runtime/kernel/routing.d.cts +33 -0
- package/dist/runtime/kernel/routing.d.ts +33 -0
- package/dist/runtime/kernel/snapshot.d.cts +26 -0
- package/dist/runtime/kernel/snapshot.d.ts +26 -0
- package/dist/runtime/kernel/storage.d.cts +226 -0
- package/dist/runtime/kernel/storage.d.ts +226 -0
- package/dist/runtime/kernel/transitionGuard.d.cts +4 -0
- package/dist/runtime/kernel/transitionGuard.d.ts +4 -0
- package/dist/runtime/kernel/transitionTrace.d.cts +40 -0
- package/dist/runtime/kernel/transitionTrace.d.ts +40 -0
- package/dist/sidecar.d.cts +2 -2
- package/dist/sidecar.d.ts +2 -2
- package/dist/types.d.cts +35 -10
- package/dist/types.d.ts +35 -10
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/types.d.cts
CHANGED
|
@@ -15,9 +15,14 @@ export type FSMEventMeta = {
|
|
|
15
15
|
senderGroupId?: string;
|
|
16
16
|
senderGroupTag?: string;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export type CoreActionMeta = FSMEventMeta;
|
|
19
|
+
export type ManagerAction<P extends AnyEvent, Meta extends object = CoreActionMeta> = P & {
|
|
20
|
+
meta?: Meta;
|
|
21
|
+
};
|
|
22
|
+
type DeepReadonly<Value> = Value extends (...args: any[]) => unknown ? Value : Value extends object ? {
|
|
23
|
+
readonly [Key in keyof Value]: DeepReadonly<Value[Key]>;
|
|
24
|
+
} : Value;
|
|
25
|
+
export type ReadonlyManagerAction<Events extends AnyEvent, Meta extends object = CoreActionMeta> = DeepReadonly<ManagerAction<Events, Meta>>;
|
|
21
26
|
export type ActorMeta = {
|
|
22
27
|
actorId: string;
|
|
23
28
|
groupId: string;
|
|
@@ -99,14 +104,14 @@ export type HydrateAction<S extends MachineStore> = {
|
|
|
99
104
|
};
|
|
100
105
|
};
|
|
101
106
|
export type ManagerCommitAction<S extends MachineStore, P extends AnyEvent = AnyEvent> = P | HydrateAction<S>;
|
|
102
|
-
export type MiddlewareApi<S, P extends AnyEvent = AnyEvent> = {
|
|
107
|
+
export type MiddlewareApi<S, P extends AnyEvent = AnyEvent, Meta extends object = CoreActionMeta> = {
|
|
103
108
|
getState: () => S;
|
|
104
|
-
transition: (action: ManagerAction<P>) => ManagerAction<P>;
|
|
105
|
-
replaceReducer: (cb: (reducer: Reducer<S, ManagerAction<P>>) => Reducer<S, ManagerAction<P>>) => void;
|
|
109
|
+
transition: (action: ManagerAction<P, Meta>) => ManagerAction<P, Meta>;
|
|
110
|
+
replaceReducer: (cb: (reducer: Reducer<S, ManagerAction<P, Meta>>) => Reducer<S, ManagerAction<P, Meta>>) => void;
|
|
106
111
|
onTransition: (cb: (prevState: S, currentState: S, action: ManagerCommitAction<MachineStore, AnyEvent>) => void) => () => void;
|
|
107
|
-
condition: (predicate: (a: ManagerAction<P>) => boolean) => Promise<boolean>;
|
|
112
|
+
condition: (predicate: (a: ManagerAction<P, Meta>) => boolean) => Promise<boolean>;
|
|
108
113
|
};
|
|
109
|
-
export type Middleware<S = unknown, P extends AnyEvent = AnyEvent> = (api: MiddlewareApi<S, P>) => (next: (action: ManagerAction<P>) => ManagerAction<P>) => (action: ManagerAction<P>) => ManagerAction<P>;
|
|
114
|
+
export type Middleware<S = unknown, P extends AnyEvent = AnyEvent, Meta extends object = CoreActionMeta> = (api: MiddlewareApi<S, P, Meta>) => (next: (action: ManagerAction<P, Meta>) => ManagerAction<P, Meta>) => (action: ManagerAction<P, Meta>) => ManagerAction<P, Meta>;
|
|
110
115
|
export type GenericMiddleware = <S, P extends AnyEvent>(api: MiddlewareApi<S, P>) => (next: (action: P) => P) => (action: P) => P;
|
|
111
116
|
export type VoidReducerMiddleware = GenericMiddleware & {
|
|
112
117
|
__liteFsmAllowVoidReducer: true;
|
|
@@ -148,7 +153,9 @@ export type ActorDefaultDeps<N extends SType, C extends object, P extends AnyEve
|
|
|
148
153
|
};
|
|
149
154
|
export type MachineEffect<N extends SType = WILDCARD, C extends object = Record<string, never>, P extends AnyEvent = AnyEvent, D extends AnyRecord = {}> = (deps: D & (HasLiteralInit<C> extends true ? ActorDefaultDeps<N, C, P> : DefaultDeps<N, C, P>)) => Promise<void> | void;
|
|
150
155
|
export type EffectStateName<C extends object> = HasLiteralInit<C> extends true ? ActorPublicState<C> | WILDCARD : StateName<C> | WILDCARD;
|
|
156
|
+
type CoreStorageKind = "instance";
|
|
151
157
|
type BaseMachineConfig<C extends object, T extends AnyRecord, P extends AnyEvent, D extends AnyRecord> = {
|
|
158
|
+
storage?: CoreStorageKind;
|
|
152
159
|
config: C;
|
|
153
160
|
initialState: StateName<C>;
|
|
154
161
|
initialContext: T;
|
|
@@ -177,6 +184,7 @@ type ActorPersistenceConfig<C extends object, T extends AnyRecord, Snapshot> = {
|
|
|
177
184
|
});
|
|
178
185
|
export type MachineConfig<C extends object, T extends AnyRecord, P extends AnyEvent, D extends AnyRecord = {}, Snapshot = HasLiteralInit<C> extends true ? DefaultActorSnapshot<C, T> : StateType<C, T>> = BaseMachineConfig<C, T, P, D> & (HasLiteralInit<C> extends true ? ActorPersistenceConfig<C, T, Snapshot> : DomainPersistenceConfig<C, T, Snapshot>);
|
|
179
186
|
type AnyMachineConfig = {
|
|
187
|
+
storage?: unknown;
|
|
180
188
|
config: object;
|
|
181
189
|
initialState: string;
|
|
182
190
|
initialContext: AnyRecord;
|
|
@@ -192,13 +200,25 @@ export type IsActorTemplate<M> = M extends {
|
|
|
192
200
|
config: infer C extends object;
|
|
193
201
|
} ? HasLiteralInit<C> : false;
|
|
194
202
|
type ActorRuntimeRecord<C extends object, T extends AnyRecord> = Record<string, PublicActorSlice<C, T>>;
|
|
195
|
-
export type
|
|
203
|
+
export type MachineRuntimeMetadata<M> = M extends {
|
|
204
|
+
readonly __liteFsmRuntime?: infer Metadata;
|
|
205
|
+
} ? NonNullable<Metadata> : {};
|
|
206
|
+
export type MachineResultMetadata<M> = MachineRuntimeMetadata<M> extends {
|
|
207
|
+
readonly resultMetadata: infer Metadata;
|
|
208
|
+
} ? Metadata : {};
|
|
209
|
+
type MachinePublicStateOverride<M> = MachineRuntimeMetadata<M> extends {
|
|
210
|
+
readonly publicState: infer PublicState;
|
|
211
|
+
} ? PublicState : never;
|
|
212
|
+
type DefaultMachineSliceState<M> = M extends {
|
|
196
213
|
config: infer C extends object;
|
|
197
214
|
initialContext: infer T extends AnyRecord;
|
|
198
215
|
} ? IsActorTemplate<M> extends true ? ActorRuntimeRecord<C, T> : {
|
|
199
216
|
state: StateName<C>;
|
|
200
217
|
context: T;
|
|
201
218
|
} : never;
|
|
219
|
+
export type MachineSliceState<M> = [
|
|
220
|
+
MachinePublicStateOverride<M>
|
|
221
|
+
] extends [never] ? DefaultMachineSliceState<M> : MachinePublicStateOverride<M>;
|
|
202
222
|
export type MachinesState<S extends MachineStore> = {
|
|
203
223
|
[key in keyof S]: MachineSliceState<S[key]>;
|
|
204
224
|
};
|
|
@@ -254,12 +274,14 @@ export type MachineManagerSnapshot<S extends MachineStore> = {
|
|
|
254
274
|
machines: Partial<{
|
|
255
275
|
[key in SnapshotMachineKey<S>]: SnapshotForMachine<S[key]>;
|
|
256
276
|
}>;
|
|
277
|
+
storage?: Record<string, unknown>;
|
|
257
278
|
};
|
|
258
279
|
export type MachineManagerDehydratedSnapshot<S extends MachineStore, K extends SnapshotMachineKey<S> = SnapshotMachineKey<S>> = {
|
|
259
280
|
schemaVersion?: number;
|
|
260
281
|
machines: {
|
|
261
282
|
[key in K]: SnapshotForMachine<S[key]>;
|
|
262
283
|
};
|
|
284
|
+
storage?: Record<string, unknown>;
|
|
263
285
|
};
|
|
264
286
|
export type MachineManagerDehydrateResult<S extends MachineStore, Keys extends ReadonlyArray<SnapshotMachineKey<S>>> = number extends Keys["length"] ? MachineManagerSnapshot<S> : MachineManagerDehydratedSnapshot<S, Keys[number]>;
|
|
265
287
|
export type MachineManagerRuntimeSnapshot<S extends MachineStore> = {
|
|
@@ -270,17 +292,20 @@ export type MachineManagerRuntimeSnapshot<S extends MachineStore> = {
|
|
|
270
292
|
};
|
|
271
293
|
export type DehydrateOptions<S extends MachineStore, K extends SnapshotMachineKey<S> = SnapshotMachineKey<S>> = {
|
|
272
294
|
machines?: ReadonlyArray<K>;
|
|
295
|
+
storage?: readonly string[];
|
|
273
296
|
};
|
|
274
297
|
export type MachineManagerDehydrateFn<S extends MachineStore> = {
|
|
275
298
|
(opts?: {
|
|
276
299
|
machines?: undefined;
|
|
300
|
+
storage?: readonly string[];
|
|
277
301
|
}): MachineManagerDehydratedSnapshot<S>;
|
|
278
302
|
<const Keys extends ReadonlyArray<SnapshotMachineKey<S>>>(opts: {
|
|
279
303
|
machines: Keys;
|
|
304
|
+
storage?: readonly string[];
|
|
280
305
|
}): MachineManagerDehydrateResult<S, Keys>;
|
|
281
306
|
(opts: DehydrateOptions<S>): MachineManagerSnapshot<S>;
|
|
282
307
|
};
|
|
283
|
-
export type TransitionSubscriber<S extends MachineStore, P extends AnyEvent = AnyEvent> = (prevState: MachinesState<S>, currentState: MachinesState<S>, action: ManagerCommitAction<S, ManagerAction<P>>) => void;
|
|
308
|
+
export type TransitionSubscriber<S extends MachineStore, P extends AnyEvent = AnyEvent, Meta extends object = CoreActionMeta> = (prevState: MachinesState<S>, currentState: MachinesState<S>, action: ManagerCommitAction<S, ManagerAction<P, Meta>>) => void;
|
|
284
309
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
285
310
|
type NoPayload = {
|
|
286
311
|
readonly __liteFsmNoPayload: never;
|
package/dist/types.d.ts
CHANGED
|
@@ -15,9 +15,14 @@ export type FSMEventMeta = {
|
|
|
15
15
|
senderGroupId?: string;
|
|
16
16
|
senderGroupTag?: string;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
export type CoreActionMeta = FSMEventMeta;
|
|
19
|
+
export type ManagerAction<P extends AnyEvent, Meta extends object = CoreActionMeta> = P & {
|
|
20
|
+
meta?: Meta;
|
|
21
|
+
};
|
|
22
|
+
type DeepReadonly<Value> = Value extends (...args: any[]) => unknown ? Value : Value extends object ? {
|
|
23
|
+
readonly [Key in keyof Value]: DeepReadonly<Value[Key]>;
|
|
24
|
+
} : Value;
|
|
25
|
+
export type ReadonlyManagerAction<Events extends AnyEvent, Meta extends object = CoreActionMeta> = DeepReadonly<ManagerAction<Events, Meta>>;
|
|
21
26
|
export type ActorMeta = {
|
|
22
27
|
actorId: string;
|
|
23
28
|
groupId: string;
|
|
@@ -99,14 +104,14 @@ export type HydrateAction<S extends MachineStore> = {
|
|
|
99
104
|
};
|
|
100
105
|
};
|
|
101
106
|
export type ManagerCommitAction<S extends MachineStore, P extends AnyEvent = AnyEvent> = P | HydrateAction<S>;
|
|
102
|
-
export type MiddlewareApi<S, P extends AnyEvent = AnyEvent> = {
|
|
107
|
+
export type MiddlewareApi<S, P extends AnyEvent = AnyEvent, Meta extends object = CoreActionMeta> = {
|
|
103
108
|
getState: () => S;
|
|
104
|
-
transition: (action: ManagerAction<P>) => ManagerAction<P>;
|
|
105
|
-
replaceReducer: (cb: (reducer: Reducer<S, ManagerAction<P>>) => Reducer<S, ManagerAction<P>>) => void;
|
|
109
|
+
transition: (action: ManagerAction<P, Meta>) => ManagerAction<P, Meta>;
|
|
110
|
+
replaceReducer: (cb: (reducer: Reducer<S, ManagerAction<P, Meta>>) => Reducer<S, ManagerAction<P, Meta>>) => void;
|
|
106
111
|
onTransition: (cb: (prevState: S, currentState: S, action: ManagerCommitAction<MachineStore, AnyEvent>) => void) => () => void;
|
|
107
|
-
condition: (predicate: (a: ManagerAction<P>) => boolean) => Promise<boolean>;
|
|
112
|
+
condition: (predicate: (a: ManagerAction<P, Meta>) => boolean) => Promise<boolean>;
|
|
108
113
|
};
|
|
109
|
-
export type Middleware<S = unknown, P extends AnyEvent = AnyEvent> = (api: MiddlewareApi<S, P>) => (next: (action: ManagerAction<P>) => ManagerAction<P>) => (action: ManagerAction<P>) => ManagerAction<P>;
|
|
114
|
+
export type Middleware<S = unknown, P extends AnyEvent = AnyEvent, Meta extends object = CoreActionMeta> = (api: MiddlewareApi<S, P, Meta>) => (next: (action: ManagerAction<P, Meta>) => ManagerAction<P, Meta>) => (action: ManagerAction<P, Meta>) => ManagerAction<P, Meta>;
|
|
110
115
|
export type GenericMiddleware = <S, P extends AnyEvent>(api: MiddlewareApi<S, P>) => (next: (action: P) => P) => (action: P) => P;
|
|
111
116
|
export type VoidReducerMiddleware = GenericMiddleware & {
|
|
112
117
|
__liteFsmAllowVoidReducer: true;
|
|
@@ -148,7 +153,9 @@ export type ActorDefaultDeps<N extends SType, C extends object, P extends AnyEve
|
|
|
148
153
|
};
|
|
149
154
|
export type MachineEffect<N extends SType = WILDCARD, C extends object = Record<string, never>, P extends AnyEvent = AnyEvent, D extends AnyRecord = {}> = (deps: D & (HasLiteralInit<C> extends true ? ActorDefaultDeps<N, C, P> : DefaultDeps<N, C, P>)) => Promise<void> | void;
|
|
150
155
|
export type EffectStateName<C extends object> = HasLiteralInit<C> extends true ? ActorPublicState<C> | WILDCARD : StateName<C> | WILDCARD;
|
|
156
|
+
type CoreStorageKind = "instance";
|
|
151
157
|
type BaseMachineConfig<C extends object, T extends AnyRecord, P extends AnyEvent, D extends AnyRecord> = {
|
|
158
|
+
storage?: CoreStorageKind;
|
|
152
159
|
config: C;
|
|
153
160
|
initialState: StateName<C>;
|
|
154
161
|
initialContext: T;
|
|
@@ -177,6 +184,7 @@ type ActorPersistenceConfig<C extends object, T extends AnyRecord, Snapshot> = {
|
|
|
177
184
|
});
|
|
178
185
|
export type MachineConfig<C extends object, T extends AnyRecord, P extends AnyEvent, D extends AnyRecord = {}, Snapshot = HasLiteralInit<C> extends true ? DefaultActorSnapshot<C, T> : StateType<C, T>> = BaseMachineConfig<C, T, P, D> & (HasLiteralInit<C> extends true ? ActorPersistenceConfig<C, T, Snapshot> : DomainPersistenceConfig<C, T, Snapshot>);
|
|
179
186
|
type AnyMachineConfig = {
|
|
187
|
+
storage?: unknown;
|
|
180
188
|
config: object;
|
|
181
189
|
initialState: string;
|
|
182
190
|
initialContext: AnyRecord;
|
|
@@ -192,13 +200,25 @@ export type IsActorTemplate<M> = M extends {
|
|
|
192
200
|
config: infer C extends object;
|
|
193
201
|
} ? HasLiteralInit<C> : false;
|
|
194
202
|
type ActorRuntimeRecord<C extends object, T extends AnyRecord> = Record<string, PublicActorSlice<C, T>>;
|
|
195
|
-
export type
|
|
203
|
+
export type MachineRuntimeMetadata<M> = M extends {
|
|
204
|
+
readonly __liteFsmRuntime?: infer Metadata;
|
|
205
|
+
} ? NonNullable<Metadata> : {};
|
|
206
|
+
export type MachineResultMetadata<M> = MachineRuntimeMetadata<M> extends {
|
|
207
|
+
readonly resultMetadata: infer Metadata;
|
|
208
|
+
} ? Metadata : {};
|
|
209
|
+
type MachinePublicStateOverride<M> = MachineRuntimeMetadata<M> extends {
|
|
210
|
+
readonly publicState: infer PublicState;
|
|
211
|
+
} ? PublicState : never;
|
|
212
|
+
type DefaultMachineSliceState<M> = M extends {
|
|
196
213
|
config: infer C extends object;
|
|
197
214
|
initialContext: infer T extends AnyRecord;
|
|
198
215
|
} ? IsActorTemplate<M> extends true ? ActorRuntimeRecord<C, T> : {
|
|
199
216
|
state: StateName<C>;
|
|
200
217
|
context: T;
|
|
201
218
|
} : never;
|
|
219
|
+
export type MachineSliceState<M> = [
|
|
220
|
+
MachinePublicStateOverride<M>
|
|
221
|
+
] extends [never] ? DefaultMachineSliceState<M> : MachinePublicStateOverride<M>;
|
|
202
222
|
export type MachinesState<S extends MachineStore> = {
|
|
203
223
|
[key in keyof S]: MachineSliceState<S[key]>;
|
|
204
224
|
};
|
|
@@ -254,12 +274,14 @@ export type MachineManagerSnapshot<S extends MachineStore> = {
|
|
|
254
274
|
machines: Partial<{
|
|
255
275
|
[key in SnapshotMachineKey<S>]: SnapshotForMachine<S[key]>;
|
|
256
276
|
}>;
|
|
277
|
+
storage?: Record<string, unknown>;
|
|
257
278
|
};
|
|
258
279
|
export type MachineManagerDehydratedSnapshot<S extends MachineStore, K extends SnapshotMachineKey<S> = SnapshotMachineKey<S>> = {
|
|
259
280
|
schemaVersion?: number;
|
|
260
281
|
machines: {
|
|
261
282
|
[key in K]: SnapshotForMachine<S[key]>;
|
|
262
283
|
};
|
|
284
|
+
storage?: Record<string, unknown>;
|
|
263
285
|
};
|
|
264
286
|
export type MachineManagerDehydrateResult<S extends MachineStore, Keys extends ReadonlyArray<SnapshotMachineKey<S>>> = number extends Keys["length"] ? MachineManagerSnapshot<S> : MachineManagerDehydratedSnapshot<S, Keys[number]>;
|
|
265
287
|
export type MachineManagerRuntimeSnapshot<S extends MachineStore> = {
|
|
@@ -270,17 +292,20 @@ export type MachineManagerRuntimeSnapshot<S extends MachineStore> = {
|
|
|
270
292
|
};
|
|
271
293
|
export type DehydrateOptions<S extends MachineStore, K extends SnapshotMachineKey<S> = SnapshotMachineKey<S>> = {
|
|
272
294
|
machines?: ReadonlyArray<K>;
|
|
295
|
+
storage?: readonly string[];
|
|
273
296
|
};
|
|
274
297
|
export type MachineManagerDehydrateFn<S extends MachineStore> = {
|
|
275
298
|
(opts?: {
|
|
276
299
|
machines?: undefined;
|
|
300
|
+
storage?: readonly string[];
|
|
277
301
|
}): MachineManagerDehydratedSnapshot<S>;
|
|
278
302
|
<const Keys extends ReadonlyArray<SnapshotMachineKey<S>>>(opts: {
|
|
279
303
|
machines: Keys;
|
|
304
|
+
storage?: readonly string[];
|
|
280
305
|
}): MachineManagerDehydrateResult<S, Keys>;
|
|
281
306
|
(opts: DehydrateOptions<S>): MachineManagerSnapshot<S>;
|
|
282
307
|
};
|
|
283
|
-
export type TransitionSubscriber<S extends MachineStore, P extends AnyEvent = AnyEvent> = (prevState: MachinesState<S>, currentState: MachinesState<S>, action: ManagerCommitAction<S, ManagerAction<P>>) => void;
|
|
308
|
+
export type TransitionSubscriber<S extends MachineStore, P extends AnyEvent = AnyEvent, Meta extends object = CoreActionMeta> = (prevState: MachinesState<S>, currentState: MachinesState<S>, action: ManagerCommitAction<S, ManagerAction<P, Meta>>) => void;
|
|
284
309
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
285
310
|
type NoPayload = {
|
|
286
311
|
readonly __liteFsmNoPayload: never;
|
package/dist/utils.d.cts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const HYDRATE_ACTION_TYPE = "@@lite-fsm/HYDRATE";
|
|
|
11
11
|
export declare const VOID_REDUCER_MIDDLEWARE_MARKER = "__liteFsmAllowVoidReducer";
|
|
12
12
|
export declare const VOID_REDUCER_ERROR = "Reducer returned undefined. Return the next state, or use immerMiddleware to mutate draft state without return.";
|
|
13
13
|
export declare const supportsVoidReducer: (middleware: unknown) => boolean;
|
|
14
|
-
export type LiteFsmErrorCode = "LITE_FSM_ACTOR_DISPOSED" | "LITE_FSM_INVALID_ACTOR_CONFIG" | "LITE_FSM_INVALID_ACTOR_SLICE" | "LITE_FSM_INVALID_GENERATED_ID" | "LITE_FSM_INVALID_HYDRATION_ENVELOPE" | "LITE_FSM_INVALID_OPTIONS" | "LITE_FSM_STANDALONE_ACTOR_TEMPLATE";
|
|
14
|
+
export type LiteFsmErrorCode = "LITE_FSM_ACTOR_DISPOSED" | "LITE_FSM_AMBIGUOUS_ROUTE_META" | "LITE_FSM_DUPLICATE_MANAGER_EXTENSION_KEY" | "LITE_FSM_DUPLICATE_PLUGIN" | "LITE_FSM_DUPLICATE_ROUTE_META_KEY" | "LITE_FSM_DUPLICATE_SCOPED_EXTENSION_KEY" | "LITE_FSM_DUPLICATE_STORAGE_KIND" | "LITE_FSM_INVALID_ACTOR_CONFIG" | "LITE_FSM_INVALID_ACTOR_SLICE" | "LITE_FSM_INVALID_GENERATED_ID" | "LITE_FSM_INVALID_HYDRATION_ENVELOPE" | "LITE_FSM_INVALID_OPTIONS" | "LITE_FSM_INVALID_PLUGIN_CALLBACK_RESULT" | "LITE_FSM_INVALID_PLUGIN_DEFINITION" | "LITE_FSM_INVALID_REPLACEMENT_ACTION" | "LITE_FSM_INVALID_ROUTE_RESOLVER_RESULT" | "LITE_FSM_INVALID_SCOPED_EXTENSION" | "LITE_FSM_INVALID_STORAGE_CONFIG" | "LITE_FSM_INVALID_STORAGE_CALLBACK_RESULT" | "LITE_FSM_INVALID_STORAGE_RUNTIME" | "LITE_FSM_INVALID_STORAGE_SNAPSHOT" | "LITE_FSM_MANAGER_EXTENSION_CORE_KEY" | "LITE_FSM_MISSING_DEFAULT_STORAGE_KIND" | "LITE_FSM_MISSING_ROUTE_META_RESOLVER" | "LITE_FSM_NO_ACTIVE_DISPATCH" | "LITE_FSM_PLUGIN_REGISTRY_CLOSED" | "LITE_FSM_REENTRANT_TRANSITION_FORBIDDEN" | "LITE_FSM_SCOPED_EXTENSION_CORE_KEY" | "LITE_FSM_SCOPED_EXTENSION_OVERRIDE" | "LITE_FSM_SCOPED_EXTENSION_UNOWNED_KEY" | "LITE_FSM_UNROUTABLE_PLUGIN_ROUTE" | "LITE_FSM_UNSUPPORTED_STORAGE_SNAPSHOT" | "LITE_FSM_UNKNOWN_STORAGE_KIND" | "LITE_FSM_STANDALONE_ACTOR_TEMPLATE";
|
|
15
15
|
export declare class LiteFsmError extends Error {
|
|
16
16
|
readonly code: LiteFsmErrorCode;
|
|
17
17
|
constructor(code: LiteFsmErrorCode, message: string);
|
package/dist/utils.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const HYDRATE_ACTION_TYPE = "@@lite-fsm/HYDRATE";
|
|
|
11
11
|
export declare const VOID_REDUCER_MIDDLEWARE_MARKER = "__liteFsmAllowVoidReducer";
|
|
12
12
|
export declare const VOID_REDUCER_ERROR = "Reducer returned undefined. Return the next state, or use immerMiddleware to mutate draft state without return.";
|
|
13
13
|
export declare const supportsVoidReducer: (middleware: unknown) => boolean;
|
|
14
|
-
export type LiteFsmErrorCode = "LITE_FSM_ACTOR_DISPOSED" | "LITE_FSM_INVALID_ACTOR_CONFIG" | "LITE_FSM_INVALID_ACTOR_SLICE" | "LITE_FSM_INVALID_GENERATED_ID" | "LITE_FSM_INVALID_HYDRATION_ENVELOPE" | "LITE_FSM_INVALID_OPTIONS" | "LITE_FSM_STANDALONE_ACTOR_TEMPLATE";
|
|
14
|
+
export type LiteFsmErrorCode = "LITE_FSM_ACTOR_DISPOSED" | "LITE_FSM_AMBIGUOUS_ROUTE_META" | "LITE_FSM_DUPLICATE_MANAGER_EXTENSION_KEY" | "LITE_FSM_DUPLICATE_PLUGIN" | "LITE_FSM_DUPLICATE_ROUTE_META_KEY" | "LITE_FSM_DUPLICATE_SCOPED_EXTENSION_KEY" | "LITE_FSM_DUPLICATE_STORAGE_KIND" | "LITE_FSM_INVALID_ACTOR_CONFIG" | "LITE_FSM_INVALID_ACTOR_SLICE" | "LITE_FSM_INVALID_GENERATED_ID" | "LITE_FSM_INVALID_HYDRATION_ENVELOPE" | "LITE_FSM_INVALID_OPTIONS" | "LITE_FSM_INVALID_PLUGIN_CALLBACK_RESULT" | "LITE_FSM_INVALID_PLUGIN_DEFINITION" | "LITE_FSM_INVALID_REPLACEMENT_ACTION" | "LITE_FSM_INVALID_ROUTE_RESOLVER_RESULT" | "LITE_FSM_INVALID_SCOPED_EXTENSION" | "LITE_FSM_INVALID_STORAGE_CONFIG" | "LITE_FSM_INVALID_STORAGE_CALLBACK_RESULT" | "LITE_FSM_INVALID_STORAGE_RUNTIME" | "LITE_FSM_INVALID_STORAGE_SNAPSHOT" | "LITE_FSM_MANAGER_EXTENSION_CORE_KEY" | "LITE_FSM_MISSING_DEFAULT_STORAGE_KIND" | "LITE_FSM_MISSING_ROUTE_META_RESOLVER" | "LITE_FSM_NO_ACTIVE_DISPATCH" | "LITE_FSM_PLUGIN_REGISTRY_CLOSED" | "LITE_FSM_REENTRANT_TRANSITION_FORBIDDEN" | "LITE_FSM_SCOPED_EXTENSION_CORE_KEY" | "LITE_FSM_SCOPED_EXTENSION_OVERRIDE" | "LITE_FSM_SCOPED_EXTENSION_UNOWNED_KEY" | "LITE_FSM_UNROUTABLE_PLUGIN_ROUTE" | "LITE_FSM_UNSUPPORTED_STORAGE_SNAPSHOT" | "LITE_FSM_UNKNOWN_STORAGE_KIND" | "LITE_FSM_STANDALONE_ACTOR_TEMPLATE";
|
|
15
15
|
export declare class LiteFsmError extends Error {
|
|
16
16
|
readonly code: LiteFsmErrorCode;
|
|
17
17
|
constructor(code: LiteFsmErrorCode, message: string);
|