@superhero/eventflow-db 4.2.2 → 4.2.4
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 +38 -3
- package/package.json +2 -2
- package/sql/event/read-by-pid-domain-betweeen-timestamps.sql +6 -0
- package/sql/event/read-by-pid-domain-names.sql +2 -1
- package/sql/event/read-by-pid-domain.sql +1 -0
- package/sql/event_cpid/read-by-cpid-domain.sql +2 -1
- package/sql/event_eid/read-by-eid-domain.sql +2 -1
- package/sql/event_eid/read-by-eid.sql +2 -1
- package/sql/event_scheduled/read.sql +2 -1
- package/sql/hub/read-online-hubs.sql +2 -1
- package/sql/hub/read-quit-hub.sql +4 -0
- package/sql/hub/update-to-quit.sql +2 -1
package/index.js
CHANGED
|
@@ -261,7 +261,7 @@ export default class DB
|
|
|
261
261
|
}
|
|
262
262
|
catch(reason)
|
|
263
263
|
{
|
|
264
|
-
const error = new Error(`could not read
|
|
264
|
+
const error = new Error(`could not read events by pid: ${pid} and domain: ${domain}`)
|
|
265
265
|
error.code = 'E_EVENTFLOW_DB_EVENT_READ_BY_PID'
|
|
266
266
|
error.cause = reason
|
|
267
267
|
throw error
|
|
@@ -270,6 +270,25 @@ export default class DB
|
|
|
270
270
|
return result
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
async readEventsByDomainAndPidBetweenTimestamps(domain, pid, timestampMin, timestampMax)
|
|
274
|
+
{
|
|
275
|
+
let result
|
|
276
|
+
|
|
277
|
+
try
|
|
278
|
+
{
|
|
279
|
+
result = await this.gateway.query('event/read-by-pid-domain-betweeen-timestamps', [ pid, domain, timestampMin, timestampMax ])
|
|
280
|
+
}
|
|
281
|
+
catch(reason)
|
|
282
|
+
{
|
|
283
|
+
const error = new Error(`could not read events by pid: ${pid} and domain: ${domain}`)
|
|
284
|
+
error.code = 'E_EVENTFLOW_DB_EVENT_READ_BY_PID_BETWEEN_TIMESTAMPS'
|
|
285
|
+
error.cause = reason
|
|
286
|
+
throw error
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return result
|
|
290
|
+
}
|
|
291
|
+
|
|
273
292
|
async readEventsByDomainAndPidAndNames(domain, pid, names)
|
|
274
293
|
{
|
|
275
294
|
let result
|
|
@@ -280,7 +299,7 @@ export default class DB
|
|
|
280
299
|
}
|
|
281
300
|
catch(reason)
|
|
282
301
|
{
|
|
283
|
-
const error = new Error(`could not read
|
|
302
|
+
const error = new Error(`could not read events by pid: ${pid} and domain: ${domain}`)
|
|
284
303
|
error.code = 'E_EVENTFLOW_DB_EVENT_READ_BY_PID'
|
|
285
304
|
error.cause = reason
|
|
286
305
|
throw error
|
|
@@ -414,7 +433,7 @@ export default class DB
|
|
|
414
433
|
}
|
|
415
434
|
catch(reason)
|
|
416
435
|
{
|
|
417
|
-
const error = new Error(`could not read
|
|
436
|
+
const error = new Error(`could not read events by eid: ${eid}`)
|
|
418
437
|
error.code = 'E_EVENTFLOW_DB_EVENTS_READ_BY_EID'
|
|
419
438
|
error.cause = reason
|
|
420
439
|
throw error
|
|
@@ -661,6 +680,22 @@ export default class DB
|
|
|
661
680
|
}
|
|
662
681
|
}
|
|
663
682
|
|
|
683
|
+
async hasHubQuit(hub)
|
|
684
|
+
{
|
|
685
|
+
try
|
|
686
|
+
{
|
|
687
|
+
const result = await this.gateway.query('hub/read-quit-hub', [ hub ])
|
|
688
|
+
return result.length > 0
|
|
689
|
+
}
|
|
690
|
+
catch(reason)
|
|
691
|
+
{
|
|
692
|
+
const error = new Error(`could not check if hub: ${hub} has quit`)
|
|
693
|
+
error.code = 'E_EVENTFLOW_DB_HUB_HAS_QUIT'
|
|
694
|
+
error.cause = reason
|
|
695
|
+
throw error
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
664
699
|
async persistLog(log)
|
|
665
700
|
{
|
|
666
701
|
try
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/eventflow-db",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Eventflow db is a set of common database logic in the eventflow ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eventflow"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@superhero/db": "^0.5.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@superhero/locator": "4.2.
|
|
18
|
+
"@superhero/locator": "4.2.5"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
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",
|