@superhero/eventflow-db 4.1.1 → 4.1.3
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/README.md +51 -51
- package/config.js +1 -1
- package/index.js +2 -2
- package/index.test.js +2 -4
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -423,87 +423,87 @@ npm test
|
|
|
423
423
|
▶ @superhero/eventflow-db
|
|
424
424
|
▶ Setup table schemas
|
|
425
425
|
▶ Persist a hub
|
|
426
|
-
✔ Read online hubs (
|
|
426
|
+
✔ Read online hubs (6.657231ms)
|
|
427
427
|
|
|
428
428
|
▶ Persisting an event should generate an ID if not provided
|
|
429
|
-
✔ Read an event by id should return the same data as when persisted the event (
|
|
429
|
+
✔ Read an event by id should return the same data as when persisted the event (6.927063ms)
|
|
430
430
|
|
|
431
431
|
▶ Schedule a persisted event
|
|
432
|
-
✔ Read all scheduled events (
|
|
433
|
-
✔ Update scheduled event as executed (
|
|
434
|
-
✔ Update scheduled event as success (
|
|
435
|
-
✔ Update scheduled event as failed (
|
|
436
|
-
✔ Schedule a persisted event (
|
|
432
|
+
✔ Read all scheduled events (3.495457ms)
|
|
433
|
+
✔ Update scheduled event as executed (8.137136ms)
|
|
434
|
+
✔ Update scheduled event as success (4.61686ms)
|
|
435
|
+
✔ Update scheduled event as failed (6.822805ms)
|
|
436
|
+
✔ Schedule a persisted event (32.658117ms)
|
|
437
437
|
|
|
438
438
|
▶ Publish a persisted event
|
|
439
|
-
✔ Update published event to consumed by hub (
|
|
440
|
-
✔ Update published event to consumed by spoke (
|
|
441
|
-
✔ Update published event to success (
|
|
442
|
-
✔ Update published event to failed (
|
|
443
|
-
✔ Update published event to orphan (
|
|
444
|
-
✔ Publish a persisted event (
|
|
439
|
+
✔ Update published event to consumed by hub (5.682705ms)
|
|
440
|
+
✔ Update published event to consumed by spoke (6.462036ms)
|
|
441
|
+
✔ Update published event to success (6.573691ms)
|
|
442
|
+
✔ Update published event to failed (8.581383ms)
|
|
443
|
+
✔ Update published event to orphan (6.094177ms)
|
|
444
|
+
✔ Publish a persisted event (43.017241ms)
|
|
445
445
|
|
|
446
446
|
▶ Persist event cpid association
|
|
447
|
-
✔ Read events by domain and cpid (
|
|
448
|
-
✔ Read associated cpid by event id (
|
|
449
|
-
✔ Delete associated cpid by event id (
|
|
450
|
-
✔ Read deleted associated cpid by event id returns empty (
|
|
451
|
-
✔ Persist event cpid association (
|
|
447
|
+
✔ Read events by domain and cpid (3.71914ms)
|
|
448
|
+
✔ Read associated cpid by event id (7.035953ms)
|
|
449
|
+
✔ Delete associated cpid by event id (6.621011ms)
|
|
450
|
+
✔ Read deleted associated cpid by event id returns empty (4.727825ms)
|
|
451
|
+
✔ Persist event cpid association (34.125991ms)
|
|
452
452
|
|
|
453
453
|
▶ Persist event eid association
|
|
454
|
-
✔ Read events by eid (3.
|
|
455
|
-
✔ Read events by domain and eid (
|
|
456
|
-
✔ Read associated eid by event id (5.
|
|
457
|
-
✔ Delete associated eid by event id (
|
|
458
|
-
✔ Read deleted associated eid by event id returns empty (
|
|
459
|
-
✔ Persist event eid association (
|
|
454
|
+
✔ Read events by eid (3.884999ms)
|
|
455
|
+
✔ Read events by domain and eid (5.055002ms)
|
|
456
|
+
✔ Read associated eid by event id (5.857354ms)
|
|
457
|
+
✔ Delete associated eid by event id (6.000871ms)
|
|
458
|
+
✔ Read deleted associated eid by event id returns empty (3.435941ms)
|
|
459
|
+
✔ Persist event eid association (35.837834ms)
|
|
460
460
|
|
|
461
461
|
▶ Delete event
|
|
462
|
-
✔ Reading a deleted event rejects (
|
|
463
|
-
✔ Delete event (12.
|
|
462
|
+
✔ Reading a deleted event rejects (3.54941ms)
|
|
463
|
+
✔ Delete event (12.321329ms)
|
|
464
464
|
|
|
465
465
|
▶ By domain and pid
|
|
466
|
-
✔ Read event by domain and pid (4.
|
|
467
|
-
✔ Delete event by domain and pid (6.
|
|
468
|
-
✔ Read empty eventlog by domain and pid (
|
|
469
|
-
✔ By domain and pid (
|
|
470
|
-
✔ Persisting an event should generate an ID if not provided (
|
|
471
|
-
|
|
472
|
-
✔ Persist log (
|
|
473
|
-
✔ Update hub to quit (
|
|
466
|
+
✔ Read event by domain and pid (4.147919ms)
|
|
467
|
+
✔ Delete event by domain and pid (6.651147ms)
|
|
468
|
+
✔ Read empty eventlog by domain and pid (5.039975ms)
|
|
469
|
+
✔ By domain and pid (24.294124ms)
|
|
470
|
+
✔ Persisting an event should generate an ID if not provided (196.618539ms)
|
|
471
|
+
|
|
472
|
+
✔ Persist log (9.773113ms)
|
|
473
|
+
✔ Update hub to quit (6.745869ms)
|
|
474
474
|
|
|
475
475
|
▶ Certificate management
|
|
476
|
-
✔ Persist a certificate (
|
|
477
|
-
✔ Persisting a duplicate certificate should return false (3.
|
|
478
|
-
✔ Read a persisted certificate by id (9.
|
|
479
|
-
✔ Reading a non-existing certificate should reject with an error (3.
|
|
476
|
+
✔ Persist a certificate (11.285064ms)
|
|
477
|
+
✔ Persisting a duplicate certificate should return false (3.597549ms)
|
|
478
|
+
✔ Read a persisted certificate by id (9.74682ms)
|
|
479
|
+
✔ Reading a non-existing certificate should reject with an error (3.670532ms)
|
|
480
480
|
|
|
481
481
|
▶ Revoke a persisted certificate
|
|
482
|
-
✔ Reading a revoked certificate should reject with an error (
|
|
483
|
-
✔ Revoke a persisted certificate (
|
|
482
|
+
✔ Reading a revoked certificate should reject with an error (2.507398ms)
|
|
483
|
+
✔ Revoke a persisted certificate (10.427673ms)
|
|
484
484
|
|
|
485
485
|
▶ Revoke certificates that past there validity period
|
|
486
|
-
✔ Reading a revoked certificate should reject with an error (2.
|
|
487
|
-
✔ Revoke certificates that past there validity period (
|
|
488
|
-
✔ Certificate management (
|
|
489
|
-
✔ Persist a hub (
|
|
486
|
+
✔ Reading a revoked certificate should reject with an error (2.622701ms)
|
|
487
|
+
✔ Revoke certificates that past there validity period (15.182145ms)
|
|
488
|
+
✔ Certificate management (58.006904ms)
|
|
489
|
+
✔ Persist a hub (302.207468ms)
|
|
490
490
|
|
|
491
|
-
✔ Reading a non existing event should reject with an error (
|
|
492
|
-
✔ Setup table schemas (
|
|
493
|
-
✔ @superhero/eventflow-db (
|
|
491
|
+
✔ Reading a non existing event should reject with an error (3.189934ms)
|
|
492
|
+
✔ Setup table schemas (516.946853ms)
|
|
493
|
+
✔ @superhero/eventflow-db (519.11646ms)
|
|
494
494
|
|
|
495
|
-
tests
|
|
495
|
+
tests 45
|
|
496
496
|
suites 1
|
|
497
|
-
pass
|
|
497
|
+
pass 45
|
|
498
498
|
|
|
499
499
|
-------------------------------------------------------------------------------------------------------------------------
|
|
500
500
|
file | line % | branch % | funcs % | uncovered lines
|
|
501
501
|
-------------------------------------------------------------------------------------------------------------------------
|
|
502
502
|
config.js | 100.00 | 100.00 | 100.00 |
|
|
503
|
-
index.js | 69.
|
|
503
|
+
index.js | 69.26 | 56.57 | 97.96 | 43-48 58-62 73-77 88-92 103-107 118-122 133-137 148-153 186-191 203-207…
|
|
504
504
|
index.test.js | 100.00 | 100.00 | 100.00 |
|
|
505
505
|
-------------------------------------------------------------------------------------------------------------------------
|
|
506
|
-
all files | 79.
|
|
506
|
+
all files | 79.36 | 71.14 | 98.96 |
|
|
507
507
|
-------------------------------------------------------------------------------------------------------------------------
|
|
508
508
|
```
|
|
509
509
|
|
package/config.js
CHANGED
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import Gateway from '@superhero/db'
|
|
3
|
-
import mysql2 from 'mysql2'
|
|
4
3
|
import AdapterFactory from '@superhero/db/adapter/mysql/factory.js'
|
|
4
|
+
import mysql2 from 'mysql2'
|
|
5
5
|
import path from 'node:path'
|
|
6
6
|
import { fileURLToPath } from 'node:url'
|
|
7
7
|
|
|
8
8
|
export function locate(locator)
|
|
9
9
|
{
|
|
10
10
|
const
|
|
11
|
-
config = locator
|
|
11
|
+
config = locator.config.find('eventflow/db', {}),
|
|
12
12
|
adapterFactory = new AdapterFactory(),
|
|
13
13
|
adapter = adapterFactory.create(mysql2, config),
|
|
14
14
|
filePath = fileURLToPath(path.join(path.dirname(import.meta.url), 'sql')),
|
package/index.test.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Config from '@superhero/config'
|
|
2
1
|
import Locator from '@superhero/locator'
|
|
3
2
|
import { locate } from '@superhero/eventflow-db'
|
|
4
3
|
import assert from 'node:assert/strict'
|
|
@@ -7,10 +6,9 @@ import { after, suite, test } from 'node:test'
|
|
|
7
6
|
suite('@superhero/eventflow-db', async () =>
|
|
8
7
|
{
|
|
9
8
|
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
locator = new Locator(),
|
|
10
|
+
config = locator.config
|
|
12
11
|
|
|
13
|
-
locator.set('@superhero/config', config)
|
|
14
12
|
await config.add('./config.js')
|
|
15
13
|
const db = locate(locator)
|
|
16
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/eventflow-db",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Eventflow db is a set of common database logic in the eventflow ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eventflow"
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"@superhero/db": "^0.5.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@superhero/
|
|
19
|
-
"@superhero/locator": "4.2.0"
|
|
18
|
+
"@superhero/locator": "4.2.2"
|
|
20
19
|
},
|
|
21
20
|
"scripts": {
|
|
22
21
|
"test-build": "docker ps -q -f name=eventflow-mysql | grep -q . && docker stop eventflow-mysql; docker run --rm --name eventflow-mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=eventflow -p 3306:3306 --health-cmd=\"mysqladmin ping -h 127.0.0.1 -uroot -proot --silent || exit 1\" --health-interval=10s --health-timeout=5s --health-retries=5 -d mysql:latest; until [ \"$(docker inspect --format='{{.State.Health.Status}}' eventflow-mysql)\" == \"healthy\" ]; do sleep 1; done",
|