@sphereon/ssi-sdk.xstate-machine-persistence 0.33.1-next.3 → 0.33.1-next.73
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 +1014 -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 +982 -21
- package/dist/index.js.map +1 -1
- package/package.json +25 -14
- package/plugin.schema.json +80 -320
- 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 -197
- 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 -20
- 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 -303
- 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 -21
- 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 -83
- 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 -3
- 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 -19
- 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 -13
- package/dist/types/types.js.map +0 -1
package/plugin.schema.json
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
"components": {
|
|
4
4
|
"schemas": {
|
|
5
5
|
"MachineStateDeleteArgs": {
|
|
6
|
+
"$ref": "#/components/schemas/Pick<StoreMachineStateInfo,(\"instanceId\"|\"tenantId\")>"
|
|
7
|
+
},
|
|
8
|
+
"Pick<StoreMachineStateInfo,(\"instanceId\"|\"tenantId\")>": {
|
|
6
9
|
"type": "object",
|
|
7
10
|
"properties": {
|
|
8
11
|
"instanceId": {
|
|
@@ -13,27 +16,15 @@
|
|
|
13
16
|
"type": "string"
|
|
14
17
|
}
|
|
15
18
|
},
|
|
16
|
-
"required": [
|
|
17
|
-
|
|
18
|
-
]
|
|
19
|
+
"required": ["instanceId"],
|
|
20
|
+
"additionalProperties": false
|
|
19
21
|
},
|
|
20
22
|
"MachineStateGetArgs": {
|
|
21
|
-
"
|
|
22
|
-
"properties": {
|
|
23
|
-
"instanceId": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"description": "Unique instance ID of the machine"
|
|
26
|
-
},
|
|
27
|
-
"tenantId": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"required": [
|
|
32
|
-
"instanceId"
|
|
33
|
-
]
|
|
23
|
+
"$ref": "#/components/schemas/Pick<StoreMachineStateInfo,(\"instanceId\"|\"tenantId\")>"
|
|
34
24
|
},
|
|
35
25
|
"MachineStateInfo": {
|
|
36
26
|
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
37
28
|
"properties": {
|
|
38
29
|
"state": {
|
|
39
30
|
"$ref": "#/components/schemas/SerializableState"
|
|
@@ -82,15 +73,7 @@
|
|
|
82
73
|
"type": "string"
|
|
83
74
|
}
|
|
84
75
|
},
|
|
85
|
-
"required": [
|
|
86
|
-
"createdAt",
|
|
87
|
-
"instanceId",
|
|
88
|
-
"latestEventType",
|
|
89
|
-
"machineName",
|
|
90
|
-
"state",
|
|
91
|
-
"updatedAt",
|
|
92
|
-
"updatedCount"
|
|
93
|
-
]
|
|
76
|
+
"required": ["createdAt", "instanceId", "latestEventType", "machineName", "state", "updatedAt", "updatedCount"]
|
|
94
77
|
},
|
|
95
78
|
"SerializableState": {
|
|
96
79
|
"$ref": "#/components/schemas/XStateConfig<any,AnyEventObject>"
|
|
@@ -106,10 +89,7 @@
|
|
|
106
89
|
"$ref": "#/components/schemas/SCXML.Event<AnyEventObject>"
|
|
107
90
|
},
|
|
108
91
|
"_sessionid": {
|
|
109
|
-
"type": [
|
|
110
|
-
"string",
|
|
111
|
-
"null"
|
|
112
|
-
]
|
|
92
|
+
"type": ["string", "null"]
|
|
113
93
|
},
|
|
114
94
|
"historyValue": {
|
|
115
95
|
"$ref": "#/components/schemas/HistoryValue"
|
|
@@ -136,33 +116,18 @@
|
|
|
136
116
|
"items": {}
|
|
137
117
|
},
|
|
138
118
|
"children": {
|
|
139
|
-
"
|
|
119
|
+
"$ref": "#/components/schemas/Record<string,any>"
|
|
140
120
|
},
|
|
141
121
|
"done": {
|
|
142
122
|
"type": "boolean"
|
|
143
123
|
},
|
|
144
124
|
"tags": {
|
|
145
|
-
"
|
|
146
|
-
"properties": {
|
|
147
|
-
"size": {
|
|
148
|
-
"type": "number"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"required": [
|
|
152
|
-
"size"
|
|
153
|
-
]
|
|
125
|
+
"$ref": "#/components/schemas/Set<string>"
|
|
154
126
|
},
|
|
155
127
|
"machine": {}
|
|
156
128
|
},
|
|
157
|
-
"required": [
|
|
158
|
-
|
|
159
|
-
"context",
|
|
160
|
-
"_event",
|
|
161
|
-
"_sessionid",
|
|
162
|
-
"configuration",
|
|
163
|
-
"transitions",
|
|
164
|
-
"children"
|
|
165
|
-
],
|
|
129
|
+
"required": ["value", "context", "_event", "_sessionid", "configuration", "transitions", "children"],
|
|
130
|
+
"additionalProperties": false,
|
|
166
131
|
"description": "The configuration for the XState machine state. Simplified StateConfig object from XState so we have a minimal typed structure"
|
|
167
132
|
},
|
|
168
133
|
"StateValue": {
|
|
@@ -191,11 +156,7 @@
|
|
|
191
156
|
},
|
|
192
157
|
"type": {
|
|
193
158
|
"type": "string",
|
|
194
|
-
"enum": [
|
|
195
|
-
"platform",
|
|
196
|
-
"internal",
|
|
197
|
-
"external"
|
|
198
|
-
],
|
|
159
|
+
"enum": ["platform", "internal", "external"],
|
|
199
160
|
"description": "This field describes the event type. The SCXML Processor must set it to: \"platform\" (for events raised by the platform itself, such as error events), \"internal\" (for events raised by <raise> and <send> with target '_internal') or \"external\" (for all other events)."
|
|
200
161
|
},
|
|
201
162
|
"sendid": {
|
|
@@ -223,12 +184,8 @@
|
|
|
223
184
|
"const": "scxml"
|
|
224
185
|
}
|
|
225
186
|
},
|
|
226
|
-
"required": [
|
|
227
|
-
|
|
228
|
-
"type",
|
|
229
|
-
"data",
|
|
230
|
-
"$$type"
|
|
231
|
-
]
|
|
187
|
+
"required": ["name", "type", "data", "$$type"],
|
|
188
|
+
"additionalProperties": false
|
|
232
189
|
},
|
|
233
190
|
"AnyEventObject": {
|
|
234
191
|
"type": "object",
|
|
@@ -238,36 +195,50 @@
|
|
|
238
195
|
"description": "The type of event that is sent."
|
|
239
196
|
}
|
|
240
197
|
},
|
|
241
|
-
"required": [
|
|
242
|
-
"type"
|
|
243
|
-
]
|
|
198
|
+
"required": ["type"]
|
|
244
199
|
},
|
|
245
200
|
"HistoryValue": {
|
|
246
201
|
"type": "object",
|
|
247
202
|
"properties": {
|
|
248
203
|
"states": {
|
|
249
|
-
"
|
|
250
|
-
"additionalProperties": {
|
|
251
|
-
"anyOf": [
|
|
252
|
-
{
|
|
253
|
-
"$ref": "#/components/schemas/HistoryValue"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"not": {}
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
}
|
|
204
|
+
"$ref": "#/components/schemas/Record<string,(interface-434048446-6094-6223-434048446-0-57488|undefined)>"
|
|
260
205
|
},
|
|
261
206
|
"current": {
|
|
262
207
|
"$ref": "#/components/schemas/StateValue"
|
|
263
208
|
}
|
|
264
209
|
},
|
|
265
|
-
"required": [
|
|
266
|
-
|
|
267
|
-
|
|
210
|
+
"required": ["states"],
|
|
211
|
+
"additionalProperties": false
|
|
212
|
+
},
|
|
213
|
+
"Record<string,(interface-434048446-6094-6223-434048446-0-57488|undefined)>": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"additionalProperties": {
|
|
216
|
+
"anyOf": [
|
|
217
|
+
{
|
|
218
|
+
"$ref": "#/components/schemas/HistoryValue"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"not": {}
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"Record<string,any>": {
|
|
227
|
+
"type": "object"
|
|
228
|
+
},
|
|
229
|
+
"Set<string>": {
|
|
230
|
+
"type": "object",
|
|
231
|
+
"properties": {
|
|
232
|
+
"size": {
|
|
233
|
+
"type": "number"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"required": ["size"],
|
|
237
|
+
"additionalProperties": false
|
|
268
238
|
},
|
|
269
239
|
"InitMachineStateArgs": {
|
|
270
240
|
"type": "object",
|
|
241
|
+
"additionalProperties": false,
|
|
271
242
|
"properties": {
|
|
272
243
|
"cleanupAllOtherInstances": {
|
|
273
244
|
"type": "boolean"
|
|
@@ -279,16 +250,14 @@
|
|
|
279
250
|
"type": "string"
|
|
280
251
|
},
|
|
281
252
|
"machineName": {
|
|
282
|
-
"type": "
|
|
283
|
-
"properties": {},
|
|
253
|
+
"type": "string",
|
|
284
254
|
"description": "Machine name"
|
|
285
255
|
},
|
|
286
256
|
"tenantId": {
|
|
287
257
|
"type": "string"
|
|
288
258
|
},
|
|
289
259
|
"createdAt": {
|
|
290
|
-
"type": "
|
|
291
|
-
"properties": {},
|
|
260
|
+
"type": "string",
|
|
292
261
|
"description": "Represents the creation date"
|
|
293
262
|
},
|
|
294
263
|
"expiresAt": {
|
|
@@ -296,84 +265,21 @@
|
|
|
296
265
|
"description": "Represents the expiration date"
|
|
297
266
|
},
|
|
298
267
|
"stateType": {
|
|
299
|
-
"
|
|
300
|
-
{
|
|
301
|
-
"type": "object",
|
|
302
|
-
"properties": {}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"type": "object",
|
|
306
|
-
"properties": {}
|
|
307
|
-
}
|
|
308
|
-
]
|
|
268
|
+
"$ref": "#/components/schemas/MachineStateInitType"
|
|
309
269
|
},
|
|
310
270
|
"machineState": {
|
|
311
|
-
"
|
|
312
|
-
"properties": {
|
|
313
|
-
"state": {
|
|
314
|
-
"$ref": "#/components/schemas/SerializableState"
|
|
315
|
-
},
|
|
316
|
-
"instanceId": {
|
|
317
|
-
"type": "string",
|
|
318
|
-
"description": "Unique instance ID of the machine"
|
|
319
|
-
},
|
|
320
|
-
"sessionId": {
|
|
321
|
-
"type": "string",
|
|
322
|
-
"description": "Session Id of the machine. Not necessarily unique"
|
|
323
|
-
},
|
|
324
|
-
"machineName": {
|
|
325
|
-
"type": "string",
|
|
326
|
-
"description": "Machine name"
|
|
327
|
-
},
|
|
328
|
-
"latestStateName": {
|
|
329
|
-
"type": "string",
|
|
330
|
-
"description": "The latest state name. Can be empty for a newly initialize machine"
|
|
331
|
-
},
|
|
332
|
-
"latestEventType": {
|
|
333
|
-
"type": "string",
|
|
334
|
-
"description": "event types like SET_TOC, SET_FIRSTNAME, .... Will be xstate.init on a newly initialized machine"
|
|
335
|
-
},
|
|
336
|
-
"createdAt": {
|
|
337
|
-
"type": "string",
|
|
338
|
-
"description": "Represents the creation date"
|
|
339
|
-
},
|
|
340
|
-
"expiresAt": {
|
|
341
|
-
"type": "string",
|
|
342
|
-
"description": "Represents the expiration date"
|
|
343
|
-
},
|
|
344
|
-
"updatedAt": {
|
|
345
|
-
"type": "string",
|
|
346
|
-
"description": "Represents the update date"
|
|
347
|
-
},
|
|
348
|
-
"updatedCount": {
|
|
349
|
-
"type": "number",
|
|
350
|
-
"description": "Represents a counter for tracking updates."
|
|
351
|
-
},
|
|
352
|
-
"completedAt": {
|
|
353
|
-
"type": "string",
|
|
354
|
-
"format": "date-time"
|
|
355
|
-
},
|
|
356
|
-
"tenantId": {
|
|
357
|
-
"type": "string"
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
"required": [
|
|
361
|
-
"createdAt",
|
|
362
|
-
"instanceId",
|
|
363
|
-
"latestEventType",
|
|
364
|
-
"machineName",
|
|
365
|
-
"state",
|
|
366
|
-
"updatedAt",
|
|
367
|
-
"updatedCount"
|
|
368
|
-
]
|
|
271
|
+
"$ref": "#/components/schemas/MachineStateInfo"
|
|
369
272
|
}
|
|
370
273
|
},
|
|
371
|
-
"required": [
|
|
372
|
-
|
|
373
|
-
|
|
274
|
+
"required": ["machineName"]
|
|
275
|
+
},
|
|
276
|
+
"MachineStateInitType": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"enum": ["new", "existing"]
|
|
374
279
|
},
|
|
375
280
|
"MachineStateInit": {
|
|
376
281
|
"type": "object",
|
|
282
|
+
"additionalProperties": false,
|
|
377
283
|
"properties": {
|
|
378
284
|
"stateType": {
|
|
379
285
|
"$ref": "#/components/schemas/MachineStateInitType"
|
|
@@ -382,21 +288,18 @@
|
|
|
382
288
|
"$ref": "#/components/schemas/MachineStateInfo"
|
|
383
289
|
},
|
|
384
290
|
"instanceId": {
|
|
385
|
-
"type": "
|
|
386
|
-
"properties": {},
|
|
291
|
+
"type": "string",
|
|
387
292
|
"description": "Unique instance ID of the machine"
|
|
388
293
|
},
|
|
389
294
|
"machineName": {
|
|
390
|
-
"type": "
|
|
391
|
-
"properties": {},
|
|
295
|
+
"type": "string",
|
|
392
296
|
"description": "Machine name"
|
|
393
297
|
},
|
|
394
298
|
"tenantId": {
|
|
395
299
|
"type": "string"
|
|
396
300
|
},
|
|
397
301
|
"createdAt": {
|
|
398
|
-
"type": "
|
|
399
|
-
"properties": {},
|
|
302
|
+
"type": "string",
|
|
400
303
|
"description": "Represents the creation date"
|
|
401
304
|
},
|
|
402
305
|
"expiresAt": {
|
|
@@ -404,108 +307,28 @@
|
|
|
404
307
|
"description": "Represents the expiration date"
|
|
405
308
|
}
|
|
406
309
|
},
|
|
407
|
-
"required": [
|
|
408
|
-
"createdAt",
|
|
409
|
-
"instanceId",
|
|
410
|
-
"machineName",
|
|
411
|
-
"stateType"
|
|
412
|
-
]
|
|
413
|
-
},
|
|
414
|
-
"MachineStateInitType": {
|
|
415
|
-
"type": "string",
|
|
416
|
-
"enum": [
|
|
417
|
-
"new",
|
|
418
|
-
"existing"
|
|
419
|
-
]
|
|
310
|
+
"required": ["createdAt", "instanceId", "machineName", "stateType"]
|
|
420
311
|
},
|
|
421
312
|
"MachineStatePersistArgs": {
|
|
422
313
|
"type": "object",
|
|
314
|
+
"additionalProperties": false,
|
|
423
315
|
"properties": {
|
|
424
316
|
"cleanupOnFinalState": {
|
|
425
317
|
"type": "boolean"
|
|
426
318
|
},
|
|
427
319
|
"updatedCount": {
|
|
428
|
-
"type": "
|
|
429
|
-
"properties": {},
|
|
320
|
+
"type": "number",
|
|
430
321
|
"description": "Represents a counter for tracking updates."
|
|
431
322
|
},
|
|
432
323
|
"state": {
|
|
433
|
-
"
|
|
434
|
-
"properties": {
|
|
435
|
-
"value": {
|
|
436
|
-
"$ref": "#/components/schemas/StateValue"
|
|
437
|
-
},
|
|
438
|
-
"context": {},
|
|
439
|
-
"_event": {
|
|
440
|
-
"$ref": "#/components/schemas/SCXML.Event<AnyEventObject>"
|
|
441
|
-
},
|
|
442
|
-
"_sessionid": {
|
|
443
|
-
"type": [
|
|
444
|
-
"string",
|
|
445
|
-
"null"
|
|
446
|
-
]
|
|
447
|
-
},
|
|
448
|
-
"historyValue": {
|
|
449
|
-
"$ref": "#/components/schemas/HistoryValue"
|
|
450
|
-
},
|
|
451
|
-
"history": {},
|
|
452
|
-
"actions": {
|
|
453
|
-
"type": "array",
|
|
454
|
-
"items": {}
|
|
455
|
-
},
|
|
456
|
-
"activities": {},
|
|
457
|
-
"meta": {},
|
|
458
|
-
"events": {
|
|
459
|
-
"type": "array",
|
|
460
|
-
"items": {
|
|
461
|
-
"$ref": "#/components/schemas/AnyEventObject"
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
"configuration": {
|
|
465
|
-
"type": "array",
|
|
466
|
-
"items": {}
|
|
467
|
-
},
|
|
468
|
-
"transitions": {
|
|
469
|
-
"type": "array",
|
|
470
|
-
"items": {}
|
|
471
|
-
},
|
|
472
|
-
"children": {
|
|
473
|
-
"type": "object"
|
|
474
|
-
},
|
|
475
|
-
"done": {
|
|
476
|
-
"type": "boolean"
|
|
477
|
-
},
|
|
478
|
-
"tags": {
|
|
479
|
-
"type": "object",
|
|
480
|
-
"properties": {
|
|
481
|
-
"size": {
|
|
482
|
-
"type": "number"
|
|
483
|
-
}
|
|
484
|
-
},
|
|
485
|
-
"required": [
|
|
486
|
-
"size"
|
|
487
|
-
]
|
|
488
|
-
},
|
|
489
|
-
"machine": {}
|
|
490
|
-
},
|
|
491
|
-
"required": [
|
|
492
|
-
"_event",
|
|
493
|
-
"_sessionid",
|
|
494
|
-
"children",
|
|
495
|
-
"configuration",
|
|
496
|
-
"context",
|
|
497
|
-
"transitions",
|
|
498
|
-
"value"
|
|
499
|
-
]
|
|
324
|
+
"$ref": "#/components/schemas/SerializableState"
|
|
500
325
|
},
|
|
501
326
|
"instanceId": {
|
|
502
|
-
"type": "
|
|
503
|
-
"properties": {},
|
|
327
|
+
"type": "string",
|
|
504
328
|
"description": "Unique instance ID of the machine"
|
|
505
329
|
},
|
|
506
330
|
"machineName": {
|
|
507
|
-
"type": "
|
|
508
|
-
"properties": {},
|
|
331
|
+
"type": "string",
|
|
509
332
|
"description": "Machine name"
|
|
510
333
|
},
|
|
511
334
|
"tenantId": {
|
|
@@ -516,87 +339,20 @@
|
|
|
516
339
|
"description": "Represents the expiration date"
|
|
517
340
|
},
|
|
518
341
|
"stateType": {
|
|
519
|
-
"
|
|
520
|
-
{
|
|
521
|
-
"type": "object",
|
|
522
|
-
"properties": {}
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
"type": "object",
|
|
526
|
-
"properties": {}
|
|
527
|
-
}
|
|
528
|
-
]
|
|
342
|
+
"$ref": "#/components/schemas/MachineStateInitType"
|
|
529
343
|
},
|
|
530
344
|
"machineState": {
|
|
531
|
-
"
|
|
532
|
-
"properties": {
|
|
533
|
-
"state": {
|
|
534
|
-
"$ref": "#/components/schemas/SerializableState"
|
|
535
|
-
},
|
|
536
|
-
"instanceId": {
|
|
537
|
-
"type": "string",
|
|
538
|
-
"description": "Unique instance ID of the machine"
|
|
539
|
-
},
|
|
540
|
-
"sessionId": {
|
|
541
|
-
"type": "string",
|
|
542
|
-
"description": "Session Id of the machine. Not necessarily unique"
|
|
543
|
-
},
|
|
544
|
-
"machineName": {
|
|
545
|
-
"type": "string",
|
|
546
|
-
"description": "Machine name"
|
|
547
|
-
},
|
|
548
|
-
"latestStateName": {
|
|
549
|
-
"type": "string",
|
|
550
|
-
"description": "The latest state name. Can be empty for a newly initialize machine"
|
|
551
|
-
},
|
|
552
|
-
"latestEventType": {
|
|
553
|
-
"type": "string",
|
|
554
|
-
"description": "event types like SET_TOC, SET_FIRSTNAME, .... Will be xstate.init on a newly initialized machine"
|
|
555
|
-
},
|
|
556
|
-
"createdAt": {
|
|
557
|
-
"type": "string",
|
|
558
|
-
"description": "Represents the creation date"
|
|
559
|
-
},
|
|
560
|
-
"expiresAt": {
|
|
561
|
-
"type": "string",
|
|
562
|
-
"description": "Represents the expiration date"
|
|
563
|
-
},
|
|
564
|
-
"updatedAt": {
|
|
565
|
-
"type": "string",
|
|
566
|
-
"description": "Represents the update date"
|
|
567
|
-
},
|
|
568
|
-
"updatedCount": {
|
|
569
|
-
"type": "number",
|
|
570
|
-
"description": "Represents a counter for tracking updates."
|
|
571
|
-
},
|
|
572
|
-
"completedAt": {
|
|
573
|
-
"type": "string",
|
|
574
|
-
"format": "date-time"
|
|
575
|
-
},
|
|
576
|
-
"tenantId": {
|
|
577
|
-
"type": "string"
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
"required": [
|
|
581
|
-
"createdAt",
|
|
582
|
-
"instanceId",
|
|
583
|
-
"latestEventType",
|
|
584
|
-
"machineName",
|
|
585
|
-
"state",
|
|
586
|
-
"updatedAt",
|
|
587
|
-
"updatedCount"
|
|
588
|
-
]
|
|
345
|
+
"$ref": "#/components/schemas/MachineStateInfo"
|
|
589
346
|
}
|
|
590
347
|
},
|
|
591
|
-
"required": [
|
|
592
|
-
"instanceId",
|
|
593
|
-
"machineName",
|
|
594
|
-
"state",
|
|
595
|
-
"stateType"
|
|
596
|
-
],
|
|
348
|
+
"required": ["instanceId", "machineName", "state", "stateType"],
|
|
597
349
|
"description": "Represents the arguments required to persist the machine state."
|
|
598
350
|
},
|
|
599
351
|
"DeleteExpiredStatesArgs": {
|
|
352
|
+
"$ref": "#/components/schemas/Pick<StoreMachineStateDeleteExpiredArgs,(\"deleteDoneStates\"|\"machineName\"|\"tenantId\")>",
|
|
353
|
+
"description": "Represents the arguments for deleting expired states from a machine."
|
|
354
|
+
},
|
|
355
|
+
"Pick<StoreMachineStateDeleteExpiredArgs,(\"deleteDoneStates\"|\"machineName\"|\"tenantId\")>": {
|
|
600
356
|
"type": "object",
|
|
601
357
|
"properties": {
|
|
602
358
|
"deleteDoneStates": {
|
|
@@ -609,7 +365,7 @@
|
|
|
609
365
|
"type": "string"
|
|
610
366
|
}
|
|
611
367
|
},
|
|
612
|
-
"
|
|
368
|
+
"additionalProperties": false
|
|
613
369
|
},
|
|
614
370
|
"DeleteStateResult": {
|
|
615
371
|
"type": "number"
|
|
@@ -619,6 +375,9 @@
|
|
|
619
375
|
"description": "Represents the arguments for finding active states of a store machine."
|
|
620
376
|
},
|
|
621
377
|
"StoreMachineStatesFindActiveArgs": {
|
|
378
|
+
"$ref": "#/components/schemas/Partial<Pick<StoreMachineStateInfo,(\"machineName\"|\"tenantId\"|\"instanceId\")>>"
|
|
379
|
+
},
|
|
380
|
+
"Partial<Pick<StoreMachineStateInfo,(\"machineName\"|\"tenantId\"|\"instanceId\")>>": {
|
|
622
381
|
"type": "object",
|
|
623
382
|
"properties": {
|
|
624
383
|
"machineName": {
|
|
@@ -632,7 +391,8 @@
|
|
|
632
391
|
"type": "string",
|
|
633
392
|
"description": "Unique instance ID of the machine"
|
|
634
393
|
}
|
|
635
|
-
}
|
|
394
|
+
},
|
|
395
|
+
"additionalProperties": false
|
|
636
396
|
}
|
|
637
397
|
},
|
|
638
398
|
"methods": {
|
|
@@ -696,4 +456,4 @@
|
|
|
696
456
|
}
|
|
697
457
|
}
|
|
698
458
|
}
|
|
699
|
-
}
|
|
459
|
+
}
|
|
@@ -2,6 +2,7 @@ import { DataSource } from 'typeorm'
|
|
|
2
2
|
import { createObjects, getConfig } from '@sphereon/ssi-sdk.agent-config'
|
|
3
3
|
|
|
4
4
|
import machineStatePersistenceAgentLogic from './shared/MachineStatePersistenceAgentLogic'
|
|
5
|
+
import { describe } from 'vitest'
|
|
5
6
|
|
|
6
7
|
let dbConnection: Promise<DataSource>
|
|
7
8
|
let agent: any
|
|
@@ -9,6 +9,7 @@ import { DataSource } from 'typeorm'
|
|
|
9
9
|
import { createObjects, getConfig } from '@sphereon/ssi-sdk.agent-config'
|
|
10
10
|
import { IMachineStatePersistence, MachineStatePersistence, MachineStatePersistEventType } from '../index'
|
|
11
11
|
import xStatePersistenceAgentLogic from './shared/MachineStatePersistenceAgentLogic'
|
|
12
|
+
import { describe } from 'vitest'
|
|
12
13
|
|
|
13
14
|
const port = 6403
|
|
14
15
|
const basePath = '/agent'
|
|
@@ -58,7 +59,9 @@ const setup = async (): Promise<boolean> => {
|
|
|
58
59
|
|
|
59
60
|
const tearDown = async (): Promise<boolean> => {
|
|
60
61
|
restServer?.close()
|
|
61
|
-
|
|
62
|
+
if (dbConnection) {
|
|
63
|
+
await (await dbConnection)?.destroy()
|
|
64
|
+
}
|
|
62
65
|
return true
|
|
63
66
|
}
|
|
64
67
|
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
TypegenDisabled,
|
|
13
13
|
} from 'xstate'
|
|
14
14
|
import { IMachineStatePersistence, interpreterStartOrResume, MachineStatePersistArgs, machineStatePersistRegistration } from '../../index'
|
|
15
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'
|
|
15
16
|
|
|
16
17
|
type ConfiguredAgent = TAgent<IMachineStatePersistence>
|
|
17
18
|
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IAbstractMachineStateStore } from '@sphereon/ssi-sdk.data-store';
|
|
2
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import { IMachineStatePersistence, MachineStatePersistEvent, MachineStatePersistOpts, RequiredContext } from '../index';
|
|
4
|
-
/**
|
|
5
|
-
* This class implements the IMachineStatePersistence interface using a datastore.
|
|
6
|
-
*
|
|
7
|
-
* This allows you to store and retrieve the State of a state machine/application by their types.
|
|
8
|
-
*
|
|
9
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
10
|
-
*/
|
|
11
|
-
export declare class MachineStatePersistence implements IAgentPlugin {
|
|
12
|
-
readonly schema: any;
|
|
13
|
-
readonly methods: IMachineStatePersistence | {};
|
|
14
|
-
readonly eventTypes: Array<string>;
|
|
15
|
-
private readonly _store?;
|
|
16
|
-
get store(): IAbstractMachineStateStore;
|
|
17
|
-
constructor(opts: MachineStatePersistOpts);
|
|
18
|
-
onEvent(event: MachineStatePersistEvent, context: RequiredContext): Promise<void>;
|
|
19
|
-
private machineStateInit;
|
|
20
|
-
private machineStatePersist;
|
|
21
|
-
private machineStatesFindActive;
|
|
22
|
-
private machineStatesDeleteExpired;
|
|
23
|
-
private machineStateGet;
|
|
24
|
-
private machineStateDelete;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=MachineStatePersistence.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MachineStatePersistence.d.ts","sourceRoot":"","sources":["../../src/agent/MachineStatePersistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAyB,MAAM,8BAA8B,CAAA;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAK3C,OAAO,EAIL,wBAAwB,EAOxB,wBAAwB,EAExB,uBAAuB,EACvB,eAAe,EAEhB,MAAM,UAAU,CAAA;AAIjB;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,YAAY;IAC1D,QAAQ,CAAC,MAAM,MAAkC;IACjD,QAAQ,CAAC,OAAO,EAAE,wBAAwB,GAAG,EAAE,CAAA;IAC/C,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAA4B;IAEpD,IAAI,KAAK,IAAI,0BAA0B,CAKtC;gBAEW,IAAI,EAAE,uBAAuB;IAqB5B,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;YAyBhF,gBAAgB;YA2DhB,mBAAmB;YAiCnB,uBAAuB;YAWvB,0BAA0B;YAQ1B,eAAe;YASf,kBAAkB;CAOjC"}
|