@superhero/eventflow-db 4.8.2 → 4.8.3-rc.1.1
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/index.js +34 -11
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -43,6 +43,14 @@ export default class DB
|
|
|
43
43
|
await this.gateway.close()
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Perform a locked operation by reference.
|
|
48
|
+
*/
|
|
49
|
+
async lock(reference, operation, timeout = 5)
|
|
50
|
+
{
|
|
51
|
+
return await this.gateway.lock(reference, operation, timeout)
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
async createTableCertificate()
|
|
47
55
|
{
|
|
48
56
|
try
|
|
@@ -264,10 +272,12 @@ export default class DB
|
|
|
264
272
|
throw error
|
|
265
273
|
}
|
|
266
274
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
275
|
+
if(deserialize)
|
|
276
|
+
{
|
|
277
|
+
this.deserializeEvents(result)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return result[0]
|
|
271
281
|
}
|
|
272
282
|
|
|
273
283
|
async readEventsByDomainAndPid(domain, pid, deserialize = false)
|
|
@@ -284,10 +294,10 @@ export default class DB
|
|
|
284
294
|
error.code = 'E_EVENTFLOW_DB_EVENT_READ_BY_PID'
|
|
285
295
|
error.cause = reason
|
|
286
296
|
throw error
|
|
287
|
-
}
|
|
297
|
+
}
|
|
288
298
|
|
|
289
299
|
return deserialize
|
|
290
|
-
?
|
|
300
|
+
? this.deserializeEvents(result)
|
|
291
301
|
: result
|
|
292
302
|
}
|
|
293
303
|
|
|
@@ -308,7 +318,7 @@ export default class DB
|
|
|
308
318
|
}
|
|
309
319
|
|
|
310
320
|
return deserialize
|
|
311
|
-
?
|
|
321
|
+
? this.deserializeEvents(result)
|
|
312
322
|
: result
|
|
313
323
|
}
|
|
314
324
|
|
|
@@ -330,7 +340,7 @@ export default class DB
|
|
|
330
340
|
}
|
|
331
341
|
|
|
332
342
|
return deserialize
|
|
333
|
-
?
|
|
343
|
+
? this.deserializeEvents(result)
|
|
334
344
|
: result
|
|
335
345
|
}
|
|
336
346
|
|
|
@@ -421,7 +431,7 @@ export default class DB
|
|
|
421
431
|
}
|
|
422
432
|
|
|
423
433
|
return deserialize
|
|
424
|
-
?
|
|
434
|
+
? this.deserializeEvents(result)
|
|
425
435
|
: result
|
|
426
436
|
}
|
|
427
437
|
|
|
@@ -493,7 +503,7 @@ export default class DB
|
|
|
493
503
|
}
|
|
494
504
|
|
|
495
505
|
return deserialize
|
|
496
|
-
?
|
|
506
|
+
? this.deserializeEvents(result)
|
|
497
507
|
: result
|
|
498
508
|
}
|
|
499
509
|
|
|
@@ -514,7 +524,7 @@ export default class DB
|
|
|
514
524
|
}
|
|
515
525
|
|
|
516
526
|
return deserialize
|
|
517
|
-
?
|
|
527
|
+
? this.deserializeEvents(result)
|
|
518
528
|
: result
|
|
519
529
|
}
|
|
520
530
|
|
|
@@ -874,4 +884,17 @@ export default class DB
|
|
|
874
884
|
throw error
|
|
875
885
|
}
|
|
876
886
|
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* @protected
|
|
890
|
+
*/
|
|
891
|
+
deserializeEvents(events)
|
|
892
|
+
{
|
|
893
|
+
for(const event of events)
|
|
894
|
+
{
|
|
895
|
+
event.data = this.serde.deserialize(event.data)
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
return events
|
|
899
|
+
}
|
|
877
900
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/eventflow-db",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.3-rc.1.1",
|
|
4
4
|
"description": "Eventflow db is a set of common database logic in the eventflow ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eventflow"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"mysql2": "^3.16.1",
|
|
21
|
-
"@superhero/db": "1.0.0"
|
|
21
|
+
"@superhero/db": "1.0.1-rc.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@superhero/audit": "4.8.2",
|