@sphereon/ssi-sdk.xstate-machine-persistence 0.33.1-feature.vcdm2.4 → 0.33.1-feature.vcdm2.tsup.18
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/index.cjs +1272 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{ssi-sdk.xstate-machine-persistence.d.ts → index.d.cts} +426 -467
- package/dist/index.d.ts +425 -5
- package/dist/index.js +1223 -5
- package/dist/index.js.map +1 -1
- package/package.json +24 -14
- package/src/__tests__/localAgent.test.ts +1 -0
- package/src/__tests__/restAgent.test.ts +4 -1
- package/src/__tests__/shared/MachineStatePersistenceAgentLogic.ts +1 -0
- package/dist/agent/MachineStatePersistence.d.ts +0 -26
- package/dist/agent/MachineStatePersistence.d.ts.map +0 -1
- package/dist/agent/MachineStatePersistence.js +0 -176
- package/dist/agent/MachineStatePersistence.js.map +0 -1
- package/dist/functions/index.d.ts +0 -4
- package/dist/functions/index.d.ts.map +0 -1
- package/dist/functions/index.js +0 -4
- package/dist/functions/index.js.map +0 -1
- package/dist/functions/machineRegistration.d.ts +0 -130
- package/dist/functions/machineRegistration.d.ts.map +0 -1
- package/dist/functions/machineRegistration.js +0 -286
- package/dist/functions/machineRegistration.js.map +0 -1
- package/dist/functions/stateEventEmitter.d.ts +0 -10
- package/dist/functions/stateEventEmitter.d.ts.map +0 -1
- package/dist/functions/stateEventEmitter.js +0 -14
- package/dist/functions/stateEventEmitter.js.map +0 -1
- package/dist/functions/stateMapper.d.ts +0 -34
- package/dist/functions/stateMapper.d.ts.map +0 -1
- package/dist/functions/stateMapper.js +0 -78
- package/dist/functions/stateMapper.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/IMachineStatePersistence.d.ts +0 -62
- package/dist/types/IMachineStatePersistence.d.ts.map +0 -1
- package/dist/types/IMachineStatePersistence.js +0 -2
- package/dist/types/IMachineStatePersistence.js.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/types.d.ts +0 -173
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -10
- package/dist/types/types.js.map +0 -1
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { IAgentContext } from '@veramo/core';
|
|
2
|
-
import { DefaultContext, EventObject, Interpreter, StateSchema, TypegenDisabled, Typestate } from 'xstate';
|
|
3
|
-
import { IMachineStatePersistence, InitMachineStateArgs, MachineStateInfo, MachineStateInit, MachineStateInitType, MachineStatePersistenceOpts, StartedInterpreterInfo } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Initialize the machine state persistence. Returns a unique instanceId and the machine name amongst others
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} opts - The options for initializing the machine state persistence.
|
|
8
|
-
* @param {InitMachineStateArgs} opts - The arguments for initializing the machine state.
|
|
9
|
-
* @param {IAgentContext<any>} opts.context - The agent context.
|
|
10
|
-
* @returns {Promise<MachineStateInit | undefined>} - A promise that resolves to the initialized machine state, or undefined if the agent isn't using the Xstate plugin.
|
|
11
|
-
*/
|
|
12
|
-
export declare const machineStatePersistInit: (opts: InitMachineStateArgs & Pick<MachineStatePersistenceOpts, "existingInstanceId" | "customInstanceId"> & {
|
|
13
|
-
context: IAgentContext<any>;
|
|
14
|
-
}) => Promise<MachineStateInit | undefined>;
|
|
15
|
-
/**
|
|
16
|
-
* This function allows for the persistence of machine state on every xstate transition. It emits an event with the new state
|
|
17
|
-
* and other relevant data to be handled by the persistence plugin when enabled.
|
|
18
|
-
*
|
|
19
|
-
* @param {Object} opts - The options object.
|
|
20
|
-
* @param {Interpreter} opts.instance - The XState machine interpreter instance.
|
|
21
|
-
* @param {IAgentContext<any>} opts.context - The agent context.
|
|
22
|
-
* @param {MachineStateInit} opts.init - The initial persistence options, containing the unique instanceId.
|
|
23
|
-
* @returns {Promise<void>} - A promise that resolves when the persistence event is emitted.
|
|
24
|
-
*/
|
|
25
|
-
export declare const machineStatePersistOnTransition: <TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
26
|
-
value: any;
|
|
27
|
-
context: TContext;
|
|
28
|
-
}, TResolvedTypesMeta = TypegenDisabled>(opts: {
|
|
29
|
-
interpreter: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>;
|
|
30
|
-
context: IAgentContext<any>;
|
|
31
|
-
init: MachineStateInit;
|
|
32
|
-
cleanupOnFinalState?: boolean;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Persist the initial state of a machine and register it with the given machine instance.
|
|
36
|
-
*
|
|
37
|
-
* @param {InitMachineStateArgs & {instance: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>, context: IAgentContext<any>}} args - The options for initializing
|
|
38
|
-
* machine state and registering it.
|
|
39
|
-
* @returns {Promise<MachineStateInit | undefined>} - A promise that resolves to the initial state of the machine, or undefined if the agent isn't using the Xstate plugin.
|
|
40
|
-
*/
|
|
41
|
-
export declare const machineStatePersistRegistration: <TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
42
|
-
value: any;
|
|
43
|
-
context: TContext;
|
|
44
|
-
}, TResolvedTypesMeta = TypegenDisabled>(args: Omit<InitMachineStateArgs, "machineName"> & Partial<Pick<InitMachineStateArgs, "machineName">> & MachineStatePersistenceOpts & {
|
|
45
|
-
cleanupOnFinalState?: boolean;
|
|
46
|
-
cleanupAllOtherInstances?: boolean;
|
|
47
|
-
interpreter: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>;
|
|
48
|
-
context: IAgentContext<any>;
|
|
49
|
-
}) => Promise<MachineStateInit | undefined>;
|
|
50
|
-
/**
|
|
51
|
-
* Resumes the interpreter from a given state.
|
|
52
|
-
*
|
|
53
|
-
* @param {Object} args - The arguments for resuming the interpreter.
|
|
54
|
-
* @param {MachineStateInfo} args.machineState - The machine state information.
|
|
55
|
-
* @param {boolean} [args.noRegistration] - If true, no registration will be performed.
|
|
56
|
-
* @param {Interpreter} args.interpreter - The interpreter instance.
|
|
57
|
-
* @param {IAgentContext<IMachineStatePersistence>} args.context - The context for machine state persistence.
|
|
58
|
-
*
|
|
59
|
-
* @returns {Promise<Interpreter>} - A promise that resolves to the resumed interpreter.
|
|
60
|
-
*/
|
|
61
|
-
export declare const interpreterResumeFromState: <TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
62
|
-
value: any;
|
|
63
|
-
context: TContext;
|
|
64
|
-
}, TResolvedTypesMeta = TypegenDisabled>(args: {
|
|
65
|
-
machineState: MachineStateInfo;
|
|
66
|
-
noRegistration?: boolean;
|
|
67
|
-
cleanupAllOtherInstances?: boolean;
|
|
68
|
-
cleanupOnFinalState?: boolean;
|
|
69
|
-
interpreter: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>;
|
|
70
|
-
context: IAgentContext<IMachineStatePersistence>;
|
|
71
|
-
}) => Promise<StartedInterpreterInfo<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>>;
|
|
72
|
-
/**
|
|
73
|
-
* Resumes or starts the interpreter from the initial machine state.
|
|
74
|
-
*
|
|
75
|
-
* @async
|
|
76
|
-
* @param {Object} args - The arguments for the function.
|
|
77
|
-
* @param {MachineStateInit & {stateType?: MachineStateInitType}} args.init - The initialization state of the machine.
|
|
78
|
-
* @param {boolean} args.noRegistration - Whether registration is required, defaults to false.
|
|
79
|
-
* @param {Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>} args.interpreter - The interpreter object.
|
|
80
|
-
* @param {IAgentContext<IMachineStatePersistence>} args.context - The context object.
|
|
81
|
-
* @returns {Promise} - A promise that resolves to the interpreter instance.
|
|
82
|
-
* @throws {Error} - If the machine name from init does not match the interpreter id.
|
|
83
|
-
*/
|
|
84
|
-
export declare const interpreterStartOrResumeFromInit: <TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
85
|
-
value: any;
|
|
86
|
-
context: TContext;
|
|
87
|
-
}, TResolvedTypesMeta = TypegenDisabled>(args: {
|
|
88
|
-
init: MachineStateInit & {
|
|
89
|
-
stateType?: MachineStateInitType;
|
|
90
|
-
};
|
|
91
|
-
cleanupAllOtherInstances?: boolean;
|
|
92
|
-
cleanupOnFinalState?: boolean;
|
|
93
|
-
noRegistration?: boolean;
|
|
94
|
-
interpreter: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>;
|
|
95
|
-
context: IAgentContext<IMachineStatePersistence>;
|
|
96
|
-
}) => Promise<StartedInterpreterInfo<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>>;
|
|
97
|
-
/**
|
|
98
|
-
* Starts or resumes the given state machine interpreter.
|
|
99
|
-
*
|
|
100
|
-
* @async
|
|
101
|
-
* @param {Object} args - The arguments for starting or resuming the interpreter.
|
|
102
|
-
* @param {MachineStateInitType | 'auto'} [args.stateType] - The state type. Defaults to 'auto'.
|
|
103
|
-
* @param {string} [args.instanceId] - The instance ID.
|
|
104
|
-
* @param {string} [args.machineName] - The machine name.
|
|
105
|
-
* @param {string} [args.tenantId] - The tenant ID.
|
|
106
|
-
* @param {boolean} args.singletonCheck - Whether to perform a singleton check or not. If more than one machine instance is found an error will be thrown
|
|
107
|
-
* @param {boolean} [args.noRegistration] - Whether to skip state change event registration or not.
|
|
108
|
-
* @param {Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>} args.interpreter - The interpreter to start or resume.
|
|
109
|
-
* @param {IAgentContext<IMachineStatePersistence>} args.context - The agent context.
|
|
110
|
-
* @returns {Promise} A promise that resolves when the interpreter is started or resumed.
|
|
111
|
-
* @throws {Error} If there are multiple active instances of the machine and singletonCheck is true.
|
|
112
|
-
* @throws {Error} If a new instance was requested with the same ID as an existing active instance.
|
|
113
|
-
* @throws {Error} If the existing state machine with the given machine name and instance ID cannot be found.
|
|
114
|
-
*/
|
|
115
|
-
export declare const interpreterStartOrResume: <TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
116
|
-
value: any;
|
|
117
|
-
context: TContext;
|
|
118
|
-
}, TResolvedTypesMeta = TypegenDisabled>(args: {
|
|
119
|
-
stateType?: MachineStateInitType | "auto";
|
|
120
|
-
instanceId?: string;
|
|
121
|
-
machineName?: string;
|
|
122
|
-
tenantId?: string;
|
|
123
|
-
singletonCheck: boolean;
|
|
124
|
-
noRegistration?: boolean;
|
|
125
|
-
cleanupAllOtherInstances?: boolean;
|
|
126
|
-
cleanupOnFinalState?: boolean;
|
|
127
|
-
interpreter: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>;
|
|
128
|
-
context: IAgentContext<IMachineStatePersistence>;
|
|
129
|
-
}) => Promise<StartedInterpreterInfo<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>>;
|
|
130
|
-
//# sourceMappingURL=machineRegistration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machineRegistration.d.ts","sourceRoot":"","sources":["../../src/functions/machineRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAS,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEjH,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAE3B,sBAAsB,EACvB,MAAM,UAAU,CAAA;AAIjB;;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;CACjD,KAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAmCjG,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,mBACR,YAAY,SAAS,WAAW,QAChC,MAAM,SAAS,WAAW,gBAC1B,UAAU,SAAS,SAAS,CAAC,QAAQ,CAAC;WAC7B,GAAG;aACD,QAAQ;GAEnB,kBAAkB,0BACZ;IACN,SAAS,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAA;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,WAAW,EAAE,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAA;IACxF,OAAO,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAA;CACjD,KAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAyFjG,CAAA"}
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import { State } from 'xstate';
|
|
2
|
-
import { waitFor } from 'xstate/lib/waitFor';
|
|
3
|
-
import { MachineStatePersistEventType, } from '../types';
|
|
4
|
-
import { emitMachineStatePersistEvent } from './stateEventEmitter';
|
|
5
|
-
import { machineStateToMachineInit, machineStateToStoreInfo } from './stateMapper';
|
|
6
|
-
/**
|
|
7
|
-
* Initialize the machine state persistence. Returns a unique instanceId and the machine name amongst others
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} opts - The options for initializing the machine state persistence.
|
|
10
|
-
* @param {InitMachineStateArgs} opts - The arguments for initializing the machine state.
|
|
11
|
-
* @param {IAgentContext<any>} opts.context - The agent context.
|
|
12
|
-
* @returns {Promise<MachineStateInit | undefined>} - A promise that resolves to the initialized machine state, or undefined if the agent isn't using the Xstate plugin.
|
|
13
|
-
*/
|
|
14
|
-
export const machineStatePersistInit = async (opts) => {
|
|
15
|
-
// make sure the machine context does not end up in the machine state init args
|
|
16
|
-
const { context, ...args } = opts;
|
|
17
|
-
if (!(context.agent.availableMethods().includes('machineStateInit') && 'machineStateInit' in context.agent)) {
|
|
18
|
-
console.log(`IMachineStatePersistence was not exposed in the current agent. Not initializing new persistence object`);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
return await context.agent.machineStateInit(args);
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* This function allows for the persistence of machine state on every xstate transition. It emits an event with the new state
|
|
25
|
-
* and other relevant data to be handled by the persistence plugin when enabled.
|
|
26
|
-
*
|
|
27
|
-
* @param {Object} opts - The options object.
|
|
28
|
-
* @param {Interpreter} opts.instance - The XState machine interpreter instance.
|
|
29
|
-
* @param {IAgentContext<any>} opts.context - The agent context.
|
|
30
|
-
* @param {MachineStateInit} opts.init - The initial persistence options, containing the unique instanceId.
|
|
31
|
-
* @returns {Promise<void>} - A promise that resolves when the persistence event is emitted.
|
|
32
|
-
*/
|
|
33
|
-
export const machineStatePersistOnTransition = async (opts) => {
|
|
34
|
-
const { cleanupOnFinalState, context, init, interpreter } = opts;
|
|
35
|
-
const { machineState, ...initEventData } = init;
|
|
36
|
-
if (!(context.agent.availableMethods().includes('machineStatePersist') && 'machineStatePersist' in context.agent)) {
|
|
37
|
-
console.log(`IMachineStatePersistence was not exposed in the current agent. Disabling machine state persistence events`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// We are using the event counter and evenDate to ensure we do not overwrite newer states. Events could come in out of order
|
|
41
|
-
let _eventCounter = init.machineState?.updatedCount ?? 0;
|
|
42
|
-
// XState persistence plugin is available. So let's emit events on every transition, so it can persist the state
|
|
43
|
-
interpreter.onChange(async (_machineContext) => {
|
|
44
|
-
/*await (context.agent as TAgent<IMachineStatePersistence>).machineStatePersist({
|
|
45
|
-
...initEventData, // init value with machineState removed, as we are getting the latest state here
|
|
46
|
-
state: interpreter.getSnapshot(),
|
|
47
|
-
updatedCount: ++_eventCounter,
|
|
48
|
-
cleanupOnFinalState: cleanupOnFinalState !== false,
|
|
49
|
-
})*/
|
|
50
|
-
emitMachineStatePersistEvent({
|
|
51
|
-
type: MachineStatePersistEventType.EVERY,
|
|
52
|
-
data: {
|
|
53
|
-
...initEventData, // init value with machineState removed, as we are getting the latest state here
|
|
54
|
-
state: interpreter.getSnapshot(),
|
|
55
|
-
_eventCounter: ++_eventCounter,
|
|
56
|
-
_eventDate: new Date(),
|
|
57
|
-
_cleanupOnFinalState: cleanupOnFinalState !== false,
|
|
58
|
-
},
|
|
59
|
-
}, context);
|
|
60
|
-
});
|
|
61
|
-
if (cleanupOnFinalState && context.agent.availableMethods().includes('machineStateDelete')) {
|
|
62
|
-
interpreter.onDone((doneEvent) => {
|
|
63
|
-
;
|
|
64
|
-
context.agent.machineStateDelete({
|
|
65
|
-
tenantId: initEventData.tenantId,
|
|
66
|
-
instanceId: initEventData.instanceId,
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Persist the initial state of a machine and register it with the given machine instance.
|
|
73
|
-
*
|
|
74
|
-
* @param {InitMachineStateArgs & {instance: Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>, context: IAgentContext<any>}} args - The options for initializing
|
|
75
|
-
* machine state and registering it.
|
|
76
|
-
* @returns {Promise<MachineStateInit | undefined>} - A promise that resolves to the initial state of the machine, or undefined if the agent isn't using the Xstate plugin.
|
|
77
|
-
*/
|
|
78
|
-
export const machineStatePersistRegistration = async (args) => {
|
|
79
|
-
const { disablePersistence } = args;
|
|
80
|
-
if (disablePersistence === true) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
// We use expires in MS first. If not provided, look at expires at. If not provided, the persistence will not expire
|
|
84
|
-
const expiresAt = args.expireInMS ? new Date(Date.now() + args.expireInMS) : args.expiresAt;
|
|
85
|
-
const machineName = args.machineName ?? args.interpreter.machine.id ?? args.interpreter.id;
|
|
86
|
-
const init = await machineStatePersistInit({ ...args, machineName, expiresAt });
|
|
87
|
-
if (init) {
|
|
88
|
-
await machineStatePersistOnTransition({ ...args, init });
|
|
89
|
-
}
|
|
90
|
-
return init;
|
|
91
|
-
};
|
|
92
|
-
const assertNonExpired = (args) => {
|
|
93
|
-
const { expiresAt, machineName } = args;
|
|
94
|
-
if (expiresAt && expiresAt.getTime() < Date.now()) {
|
|
95
|
-
throw new Error(`Cannot resume ${machineName}. It expired at ${expiresAt.toLocaleString()}`);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Resumes the interpreter from a given state.
|
|
100
|
-
*
|
|
101
|
-
* @param {Object} args - The arguments for resuming the interpreter.
|
|
102
|
-
* @param {MachineStateInfo} args.machineState - The machine state information.
|
|
103
|
-
* @param {boolean} [args.noRegistration] - If true, no registration will be performed.
|
|
104
|
-
* @param {Interpreter} args.interpreter - The interpreter instance.
|
|
105
|
-
* @param {IAgentContext<IMachineStatePersistence>} args.context - The context for machine state persistence.
|
|
106
|
-
*
|
|
107
|
-
* @returns {Promise<Interpreter>} - A promise that resolves to the resumed interpreter.
|
|
108
|
-
*/
|
|
109
|
-
export const interpreterResumeFromState = async (args) => {
|
|
110
|
-
const { interpreter, machineState, context, noRegistration, cleanupAllOtherInstances, cleanupOnFinalState } = args;
|
|
111
|
-
const { machineName, instanceId, tenantId } = machineState;
|
|
112
|
-
assertNonExpired(machineState);
|
|
113
|
-
if (noRegistration !== true) {
|
|
114
|
-
await machineStatePersistRegistration({
|
|
115
|
-
stateType: 'existing',
|
|
116
|
-
machineName,
|
|
117
|
-
tenantId,
|
|
118
|
-
existingInstanceId: instanceId,
|
|
119
|
-
cleanupAllOtherInstances,
|
|
120
|
-
cleanupOnFinalState,
|
|
121
|
-
context,
|
|
122
|
-
interpreter,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
const state = State.from(machineState.state.value, machineState.state.context);
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
interpreter.start(state);
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
await waitFor(interpreter, (awaitState) => awaitState.matches(state.value));
|
|
130
|
-
return {
|
|
131
|
-
machineState,
|
|
132
|
-
init: machineStateToMachineInit({
|
|
133
|
-
...machineState,
|
|
134
|
-
stateType: 'existing',
|
|
135
|
-
}, machineStateToStoreInfo({ ...machineState, stateType: 'existing' })),
|
|
136
|
-
interpreter,
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Resumes or starts the interpreter from the initial machine state.
|
|
141
|
-
*
|
|
142
|
-
* @async
|
|
143
|
-
* @param {Object} args - The arguments for the function.
|
|
144
|
-
* @param {MachineStateInit & {stateType?: MachineStateInitType}} args.init - The initialization state of the machine.
|
|
145
|
-
* @param {boolean} args.noRegistration - Whether registration is required, defaults to false.
|
|
146
|
-
* @param {Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>} args.interpreter - The interpreter object.
|
|
147
|
-
* @param {IAgentContext<IMachineStatePersistence>} args.context - The context object.
|
|
148
|
-
* @returns {Promise} - A promise that resolves to the interpreter instance.
|
|
149
|
-
* @throws {Error} - If the machine name from init does not match the interpreter id.
|
|
150
|
-
*/
|
|
151
|
-
export const interpreterStartOrResumeFromInit = async (args) => {
|
|
152
|
-
const { init, noRegistration, interpreter, cleanupOnFinalState, cleanupAllOtherInstances, context } = args;
|
|
153
|
-
const { stateType, instanceId, machineName, tenantId, expiresAt } = init;
|
|
154
|
-
if (init.machineName !== interpreter.id) {
|
|
155
|
-
throw new Error(`Machine state init machine name ${init.machineName} does not match name from state machine interpreter ${interpreter.id}`);
|
|
156
|
-
}
|
|
157
|
-
assertNonExpired({ machineName, expiresAt });
|
|
158
|
-
if (noRegistration !== true) {
|
|
159
|
-
await machineStatePersistRegistration({
|
|
160
|
-
stateType: stateType ?? 'existing',
|
|
161
|
-
machineName,
|
|
162
|
-
tenantId,
|
|
163
|
-
...(stateType === 'existing' && { existingInstanceId: instanceId }),
|
|
164
|
-
...(stateType === 'new' && { customInstanceId: instanceId }),
|
|
165
|
-
cleanupAllOtherInstances,
|
|
166
|
-
cleanupOnFinalState,
|
|
167
|
-
context,
|
|
168
|
-
interpreter,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
let machineState;
|
|
172
|
-
if (stateType === 'new') {
|
|
173
|
-
interpreter.start();
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
machineState = await context.agent.machineStateGet({ tenantId, instanceId });
|
|
177
|
-
// @ts-ignore
|
|
178
|
-
interpreter.start(machineState.state);
|
|
179
|
-
}
|
|
180
|
-
// We are waiting a bit
|
|
181
|
-
await new Promise((res) => setTimeout(res, 50));
|
|
182
|
-
return {
|
|
183
|
-
interpreter,
|
|
184
|
-
machineState,
|
|
185
|
-
init,
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Starts or resumes the given state machine interpreter.
|
|
190
|
-
*
|
|
191
|
-
* @async
|
|
192
|
-
* @param {Object} args - The arguments for starting or resuming the interpreter.
|
|
193
|
-
* @param {MachineStateInitType | 'auto'} [args.stateType] - The state type. Defaults to 'auto'.
|
|
194
|
-
* @param {string} [args.instanceId] - The instance ID.
|
|
195
|
-
* @param {string} [args.machineName] - The machine name.
|
|
196
|
-
* @param {string} [args.tenantId] - The tenant ID.
|
|
197
|
-
* @param {boolean} args.singletonCheck - Whether to perform a singleton check or not. If more than one machine instance is found an error will be thrown
|
|
198
|
-
* @param {boolean} [args.noRegistration] - Whether to skip state change event registration or not.
|
|
199
|
-
* @param {Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>} args.interpreter - The interpreter to start or resume.
|
|
200
|
-
* @param {IAgentContext<IMachineStatePersistence>} args.context - The agent context.
|
|
201
|
-
* @returns {Promise} A promise that resolves when the interpreter is started or resumed.
|
|
202
|
-
* @throws {Error} If there are multiple active instances of the machine and singletonCheck is true.
|
|
203
|
-
* @throws {Error} If a new instance was requested with the same ID as an existing active instance.
|
|
204
|
-
* @throws {Error} If the existing state machine with the given machine name and instance ID cannot be found.
|
|
205
|
-
*/
|
|
206
|
-
export const interpreterStartOrResume = async (args) => {
|
|
207
|
-
const { stateType, singletonCheck, instanceId, tenantId, noRegistration, context, interpreter, cleanupAllOtherInstances, cleanupOnFinalState } = args;
|
|
208
|
-
const machineName = args.machineName ?? interpreter.id;
|
|
209
|
-
let activeStates = await context.agent.machineStatesFindActive({
|
|
210
|
-
machineName,
|
|
211
|
-
tenantId,
|
|
212
|
-
instanceId,
|
|
213
|
-
});
|
|
214
|
-
if (stateType === 'new' && activeStates.length > 0 && cleanupAllOtherInstances) {
|
|
215
|
-
// We cleanup here to not influence the logic below. Normally the agent machineStateInit method does the cleanup
|
|
216
|
-
await Promise.all(activeStates.map((state) => context.agent.machineStateDelete({
|
|
217
|
-
tenantId: args.tenantId,
|
|
218
|
-
instanceId: state.instanceId,
|
|
219
|
-
})));
|
|
220
|
-
// We search again, given the delete is using the passed in tenantId, instead of relying on the persisted tenantId. Should not matter, but just making sure
|
|
221
|
-
activeStates = await context.agent.machineStatesFindActive({
|
|
222
|
-
machineName,
|
|
223
|
-
tenantId,
|
|
224
|
-
instanceId,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
if (singletonCheck && activeStates.length > 0) {
|
|
228
|
-
if (stateType === 'new' ||
|
|
229
|
-
(stateType === 'existing' &&
|
|
230
|
-
((!instanceId && activeStates.length > 1) || (instanceId && activeStates.every((state) => state.instanceId !== instanceId))))) {
|
|
231
|
-
return Promise.reject(new Error(`Found ${activeStates.length} active '${machineName}' instances, but only one is allows at the same time`));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
if (stateType === 'new') {
|
|
235
|
-
if (instanceId && activeStates.length > 0) {
|
|
236
|
-
// Since an instanceId was provided it means the activeStates includes a machine with this instance. But stateType is 'new'
|
|
237
|
-
return Promise.reject(new Error(`Found an active '${machineName}' instance with id ${instanceId}, but a new instance was requested with the same id`));
|
|
238
|
-
}
|
|
239
|
-
const init = await context.agent.machineStateInit({
|
|
240
|
-
stateType: 'new',
|
|
241
|
-
customInstanceId: instanceId,
|
|
242
|
-
machineName: machineName ?? interpreter.id,
|
|
243
|
-
tenantId,
|
|
244
|
-
cleanupAllOtherInstances,
|
|
245
|
-
});
|
|
246
|
-
return await interpreterStartOrResumeFromInit({
|
|
247
|
-
init,
|
|
248
|
-
noRegistration,
|
|
249
|
-
interpreter,
|
|
250
|
-
context,
|
|
251
|
-
cleanupOnFinalState,
|
|
252
|
-
cleanupAllOtherInstances,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
if (activeStates.length === 0) {
|
|
256
|
-
if (stateType === 'existing') {
|
|
257
|
-
return Promise.reject(new Error(`Could not find existing state machine ${machineName}, instanceId ${instanceId}`));
|
|
258
|
-
}
|
|
259
|
-
const init = await context.agent.machineStateInit({
|
|
260
|
-
stateType: 'new',
|
|
261
|
-
customInstanceId: instanceId,
|
|
262
|
-
machineName: machineName ?? interpreter.id,
|
|
263
|
-
tenantId,
|
|
264
|
-
cleanupAllOtherInstances,
|
|
265
|
-
});
|
|
266
|
-
return await interpreterStartOrResumeFromInit({
|
|
267
|
-
init,
|
|
268
|
-
noRegistration,
|
|
269
|
-
interpreter,
|
|
270
|
-
context,
|
|
271
|
-
cleanupOnFinalState,
|
|
272
|
-
cleanupAllOtherInstances,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
// activeStates length >= 1
|
|
276
|
-
const activeState = activeStates[0];
|
|
277
|
-
return interpreterResumeFromState({
|
|
278
|
-
machineState: activeState,
|
|
279
|
-
noRegistration,
|
|
280
|
-
interpreter,
|
|
281
|
-
context,
|
|
282
|
-
cleanupOnFinalState,
|
|
283
|
-
cleanupAllOtherInstances,
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
//# sourceMappingURL=machineRegistration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machineRegistration.js","sourceRoot":"","sources":["../../src/functions/machineRegistration.ts"],"names":[],"mappings":"AACA,OAAO,EAA4C,KAAK,EAA2C,MAAM,QAAQ,CAAA;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAOL,4BAA4B,GAE7B,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAElF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC1C,IAGG,EACoC,EAAE;IACzC,+EAA+E;IAC/E,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IACjC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,kBAAkB,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5G,OAAO,CAAC,GAAG,CAAC,wGAAwG,CAAC,CAAA;QACrH,OAAM;IACR,CAAC;IACD,OAAO,MAAO,OAAmD,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;AAChG,CAAC,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,EASlD,IAKD,EAAiB,EAAE;IAClB,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAA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AAC,CAAA;IACJ,CAAC;IAED,2BAA2B;IAC3B,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;IACnC,OAAO,0BAA0B,CAAC;QAChC,YAAY,EAAE,WAAW;QACzB,cAAc;QACd,WAAW;QACX,OAAO;QACP,mBAAmB;QACnB,wBAAwB;KACzB,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MachineStatePersistEvent, RequiredContext } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Emits a machine state persistence event.
|
|
4
|
-
*
|
|
5
|
-
* @param {MachineStatePersistEvent} event - The event to be emitted.
|
|
6
|
-
* @param {RequiredContext} context - The required agent context for the event emission.
|
|
7
|
-
* @returns {void}
|
|
8
|
-
*/
|
|
9
|
-
export declare const emitMachineStatePersistEvent: (event: MachineStatePersistEvent, context: RequiredContext) => void;
|
|
10
|
-
//# sourceMappingURL=stateEventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stateEventEmitter.d.ts","sourceRoot":"","sources":["../../src/functions/stateEventEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAIpE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAW,wBAAwB,WAAW,eAAe,SAOrG,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Debug from 'debug';
|
|
2
|
-
const debug = Debug('sphereon:ssi-sdk:machine-state:xstate-persistence');
|
|
3
|
-
/**
|
|
4
|
-
* Emits a machine state persistence event.
|
|
5
|
-
*
|
|
6
|
-
* @param {MachineStatePersistEvent} event - The event to be emitted.
|
|
7
|
-
* @param {RequiredContext} context - The required agent context for the event emission.
|
|
8
|
-
* @returns {void}
|
|
9
|
-
*/
|
|
10
|
-
export const emitMachineStatePersistEvent = (event, context) => {
|
|
11
|
-
debug(`Emitting machine state persistence event '${event.type}' with counter: ${event.data._eventCounter} and state ${JSON.stringify(event.data.state.value)}`);
|
|
12
|
-
void context.agent.emit(event.type, event.data);
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=stateEventEmitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stateEventEmitter.js","sourceRoot":"","sources":["../../src/functions/stateEventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,KAAK,GAAG,KAAK,CAAC,mDAAmD,CAAC,CAAA;AAExE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAA+B,EAAE,OAAwB,EAAE,EAAE;IACxG,KAAK,CACH,6CAA6C,KAAK,CAAC,IAAI,mBAAmB,KAAK,CAAC,IAAI,CAAC,aAAa,cAAc,IAAI,CAAC,SAAS,CAC5H,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CACvB,EAAE,CACJ,CAAA;IACD,KAAK,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;AACjD,CAAC,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { StoreMachineStateInfo } from '@sphereon/ssi-sdk.data-store';
|
|
2
|
-
import { State } from 'xstate';
|
|
3
|
-
import { EventObject } from 'xstate/lib/types';
|
|
4
|
-
import { MachineStateInfo, MachineStateInit, MachineStateInitType, MachineStatePersistArgs, SerializableState } from '../types';
|
|
5
|
-
/**
|
|
6
|
-
* Create a machine state info object useful for the store, based on the provided machine info and existing state.
|
|
7
|
-
*
|
|
8
|
-
* @param {MachineStatePersistArgs} machineInfo - The machine info object.
|
|
9
|
-
* @param {Partial<StoreMachineStateInfo>} [existingState] - The optional existing state object.
|
|
10
|
-
* @returns {StoreMachineStateInfo} - The store machine state info object.
|
|
11
|
-
*/
|
|
12
|
-
export declare const machineStateToStoreInfo: (machineInfo: MachineStatePersistArgs, existingState?: Partial<StoreMachineStateInfo>) => StoreMachineStateInfo;
|
|
13
|
-
export declare const storeInfoToMachineInit: (args: StoreMachineStateInfo & {
|
|
14
|
-
stateType: MachineStateInitType;
|
|
15
|
-
machineState?: MachineStateInfo;
|
|
16
|
-
}) => MachineStateInit;
|
|
17
|
-
export declare const machineStateToMachineInit: (machineInfo: MachineStatePersistArgs, existingState: Partial<StoreMachineStateInfo>) => MachineStateInit;
|
|
18
|
-
/**
|
|
19
|
-
* Serializes a machine state to a string representation.
|
|
20
|
-
*
|
|
21
|
-
* @param {State<T, TEvent> | SerializableState | string} state - The machine state to serialize.
|
|
22
|
-
* @returns {string} - The serialized machine state.
|
|
23
|
-
*/
|
|
24
|
-
export declare const serializeMachineState: <T, TEvent extends EventObject>(state: State<T, TEvent> | SerializableState | string) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Deserializes a serialized machine state.
|
|
27
|
-
*
|
|
28
|
-
* @template T - The type of the machine's context.
|
|
29
|
-
* @template TEvent - The type of the events that the machine handles.
|
|
30
|
-
* @param {string} state - The serialized machine state.
|
|
31
|
-
* @returns {State<T, TEvent>} - The deserialized machine state.
|
|
32
|
-
*/
|
|
33
|
-
export declare const deserializeMachineState: <T, TEvent extends EventObject>(state: string) => State<T, TEvent>;
|
|
34
|
-
//# sourceMappingURL=stateMapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stateMapper.d.ts","sourceRoot":"","sources":["../../src/functions/stateMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE/H;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,gBACrB,uBAAuB,kBACpB,OAAO,CAAC,qBAAqB,CAAC,KAC7C,qBA0BF,CAAA;AACD,eAAO,MAAM,sBAAsB,SAC3B,qBAAqB,GAAG;IAAE,SAAS,EAAE,oBAAoB,CAAC;IAAC,YAAY,CAAC,EAAE,gBAAgB,CAAA;CAAE,KACjG,gBAWF,CAAA;AAED,eAAO,MAAM,yBAAyB,gBAAiB,uBAAuB,iBAAiB,OAAO,CAAC,qBAAqB,CAAC,KAAG,gBAM/H,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,MAAM,SAAS,WAAW,SAAS,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,iBAAiB,GAAG,MAAM,KAAG,MAM3H,CAAA;AACD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,EAAE,MAAM,SAAS,WAAW,SAAS,MAAM,KAAG,KAAK,CAAC,CAAC,EAAE,MAAM,CAErG,CAAA"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { State } from 'xstate';
|
|
2
|
-
/**
|
|
3
|
-
* Create a machine state info object useful for the store, based on the provided machine info and existing state.
|
|
4
|
-
*
|
|
5
|
-
* @param {MachineStatePersistArgs} machineInfo - The machine info object.
|
|
6
|
-
* @param {Partial<StoreMachineStateInfo>} [existingState] - The optional existing state object.
|
|
7
|
-
* @returns {StoreMachineStateInfo} - The store machine state info object.
|
|
8
|
-
*/
|
|
9
|
-
export const machineStateToStoreInfo = (machineInfo, existingState) => {
|
|
10
|
-
const { state, machineName, tenantId, expiresAt, instanceId, updatedCount } = machineInfo;
|
|
11
|
-
const existing = existingState ?? { machineName, createdAt: new Date(), expiresAt };
|
|
12
|
-
const stateInstance = State.create(machineInfo.state);
|
|
13
|
-
let latestStateName = undefined;
|
|
14
|
-
if (stateInstance.value) {
|
|
15
|
-
latestStateName = typeof stateInstance.value === 'string' ? stateInstance.value : JSON.stringify(stateInstance.value);
|
|
16
|
-
}
|
|
17
|
-
if (latestStateName === '{}') {
|
|
18
|
-
latestStateName = undefined;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
instanceId,
|
|
22
|
-
updatedCount: updatedCount ?? (existing?.updatedCount ? existing.updatedCount++ : 0),
|
|
23
|
-
sessionId: stateInstance._sessionid ?? undefined,
|
|
24
|
-
machineName,
|
|
25
|
-
state: serializeMachineState(state),
|
|
26
|
-
tenantId,
|
|
27
|
-
latestStateName,
|
|
28
|
-
latestEventType: stateInstance.event.type,
|
|
29
|
-
updatedAt: new Date(),
|
|
30
|
-
expiresAt,
|
|
31
|
-
createdAt: existing.createdAt ?? new Date(),
|
|
32
|
-
completedAt: existing.completedAt ?? (stateInstance.done ? new Date() : undefined),
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export const storeInfoToMachineInit = (args) => {
|
|
36
|
-
const { instanceId, machineName, tenantId, expiresAt, createdAt, stateType, machineState } = args;
|
|
37
|
-
return {
|
|
38
|
-
stateType,
|
|
39
|
-
machineName,
|
|
40
|
-
tenantId,
|
|
41
|
-
expiresAt,
|
|
42
|
-
instanceId,
|
|
43
|
-
createdAt,
|
|
44
|
-
machineState,
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export const machineStateToMachineInit = (machineInfo, existingState) => {
|
|
48
|
-
return storeInfoToMachineInit({
|
|
49
|
-
...machineStateToStoreInfo(machineInfo, existingState),
|
|
50
|
-
stateType: 'existing',
|
|
51
|
-
machineState: machineInfo.machineState,
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Serializes a machine state to a string representation.
|
|
56
|
-
*
|
|
57
|
-
* @param {State<T, TEvent> | SerializableState | string} state - The machine state to serialize.
|
|
58
|
-
* @returns {string} - The serialized machine state.
|
|
59
|
-
*/
|
|
60
|
-
export const serializeMachineState = (state) => {
|
|
61
|
-
if (typeof state === 'string') {
|
|
62
|
-
return state;
|
|
63
|
-
}
|
|
64
|
-
const jsonState = 'toJSON' in state ? state.toJSON() : state;
|
|
65
|
-
return JSON.stringify(jsonState);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Deserializes a serialized machine state.
|
|
69
|
-
*
|
|
70
|
-
* @template T - The type of the machine's context.
|
|
71
|
-
* @template TEvent - The type of the events that the machine handles.
|
|
72
|
-
* @param {string} state - The serialized machine state.
|
|
73
|
-
* @returns {State<T, TEvent>} - The deserialized machine state.
|
|
74
|
-
*/
|
|
75
|
-
export const deserializeMachineState = (state) => {
|
|
76
|
-
return State.create(JSON.parse(state));
|
|
77
|
-
};
|
|
78
|
-
//# sourceMappingURL=stateMapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stateMapper.js","sourceRoot":"","sources":["../../src/functions/stateMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAI9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,WAAoC,EACpC,aAA8C,EACvB,EAAE;IACzB,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,CAAA;IAEzF,MAAM,QAAQ,GAAmC,aAAa,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,SAAS,EAAE,CAAA;IACnH,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IACrD,IAAI,eAAe,GAAG,SAAS,CAAA;IAC/B,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;QACxB,eAAe,GAAG,OAAO,aAAa,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,K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,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAgC,KAAoD,EAAU,EAAE;IACnI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,SAAS,GAAG,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IAC5D,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;AAClC,CAAC,CAAA;AACD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAgC,KAAa,EAAoB,EAAE;IACxG,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AACxC,CAAC,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,cAAc,iCAAiC,CAAA;AAC/C,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.52.1"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|