@superhero/eventflow-spoke 4.7.16 → 4.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ---
2
+ #### v4.7.18
3
+ ---
4
+
5
+ exporting the default config and bugfixed the test suite
6
+
7
+ ---
8
+ #### v4.7.17
9
+ ---
10
+
11
+ expose readDistinctPidByDomain function to read a list of all domain pids
12
+
1
13
  ---
2
14
  #### v4.7.16
3
15
  ---
package/config.js CHANGED
@@ -34,9 +34,7 @@ export default
34
34
  {
35
35
  spoke:
36
36
  {
37
- NAME : process.env.EVENTFLOW_SPOKE_NAME ?? 'EVENTFLOW-SPOKE',
38
- CONNECT_TO_HUB_TIMEOUT : process.env.EVENTFLOW_SPOKE_CONNECT_TO_HUB_TIMEOUT ?? 5e3,
39
- KEEP_ALIVE_INTERVAL : process.env.EVENTFLOW_SPOKE_KEEP_ALIVE_INTERVAL ?? 60e3,
37
+ NAME : process.env.EVENTFLOW_SPOKE_NAME ?? 'EVENTFLOW-SPOKE',
40
38
  TCP_SOCKET_CLIENT_OPTIONS : process.env.EVENTFLOW_SPOKE_TCP_SOCKET_CLIENT_OPTIONS,
41
39
 
42
40
  consume:
package/index.js CHANGED
@@ -470,6 +470,11 @@ export default class Spoke
470
470
  return state
471
471
  }
472
472
 
473
+ async readDistinctPidByDomain(domain)
474
+ {
475
+ return await this.db.readDistinctPidByDomain(domain)
476
+ }
477
+
473
478
  composeEventlogState(eventlog, size=10)
474
479
  {
475
480
  const
package/index.test.js CHANGED
@@ -1,29 +1,36 @@
1
1
  import assert from 'node:assert/strict'
2
2
  import util from 'node:util'
3
- import Locator from '@superhero/locator'
3
+ import Core from '@superhero/core'
4
4
  import { suite, test, before, after } from 'node:test'
5
5
 
6
6
  util.inspect.defaultOptions.depth = 5
7
7
 
8
8
  suite('@superhero/eventflow-spoke', () =>
9
9
  {
10
- let locator, spoke, hub
10
+ let core, spoke, hub
11
11
 
12
12
  before(async () =>
13
13
  {
14
- locator = new Locator()
14
+ if(core)
15
+ {
16
+ await core.destroy()
17
+ }
18
+
19
+ core = new Core()
20
+
21
+ await core.add('@superhero/eventflow-db')
22
+ await core.add('@superhero/eventflow-hub')
23
+ await core.add('./config.js')
15
24
 
16
- await locator.config.add('@superhero/eventflow-db')
17
- await locator.config.add('@superhero/eventflow-hub')
18
- await locator.config.add('./config.js')
19
- locator.config.assign({ eventflow: { spoke: { certificates: { CERT_PASS_ENCRYPTION_KEY: 'encryptionKey123' }}}})
20
- locator.config.assign({ eventflow: { hub: { certificates: { CERT_PASS_ENCRYPTION_KEY: 'encryptionKey123' }}}})
25
+ core.config.assign({ eventflow: { spoke: { certificates: { CERT_PASS_ENCRYPTION_KEY: 'encryptionKey123' }}}})
26
+ core.config.assign({ eventflow: { hub: { certificates: { CERT_PASS_ENCRYPTION_KEY: 'encryptionKey123' }}}})
27
+
28
+ // await core.bootstrap()
21
29
 
22
- await locator.eagerload('@superhero/eventflow-db')
23
- await locator.eagerload(locator.config.find('locator'))
30
+ await core.locate.eagerload(core.config.find('locator'))
24
31
 
25
- spoke = locator('@superhero/eventflow-spoke')
26
- hub = locator('@superhero/eventflow-hub')
32
+ spoke = core.locate('@superhero/eventflow-spoke')
33
+ hub = core.locate('@superhero/eventflow-hub')
27
34
 
28
35
  await hub.bootstrap()
29
36
  await spoke.bootstrap()
@@ -31,8 +38,7 @@ suite('@superhero/eventflow-spoke', () =>
31
38
 
32
39
  after(async () =>
33
40
  {
34
- await locator.destroy()
35
- locator.clear()
41
+ await core.destroy()
36
42
  })
37
43
 
38
44
  suite('Lifecycle', () =>
@@ -72,7 +78,7 @@ suite('@superhero/eventflow-spoke', () =>
72
78
  await spoke.publish(event)
73
79
  const waitPromise = await spoke.wait('domain1', 'pid1', 'success', 1e3)
74
80
  const result = await waitPromise
75
- assert.strictEqual(result.name, 'success')
81
+ assert.strictEqual(result, 'success')
76
82
  })
77
83
 
78
84
  test('Schedule events', async () =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/eventflow-spoke",
3
- "version": "4.7.16",
3
+ "version": "4.7.18",
4
4
  "description": "Eventflow spoke is the client component in the eventflow ecosystem.",
5
5
  "keywords": [
6
6
  "eventflow",
@@ -11,6 +11,7 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": "./index.js",
14
+ "./config": "./config.js",
14
15
  "./consume": "./consume.js",
15
16
  "./manager/*": "./manager/*.js"
16
17
  },
@@ -21,18 +22,18 @@
21
22
  "test": "syntax-check; node --test --test-reporter=@superhero/audit/reporter --experimental-test-coverage"
22
23
  },
23
24
  "dependencies": {
24
- "@superhero/deep": "4.7.16",
25
- "@superhero/eventflow-certificates": "4.7.16",
26
- "@superhero/eventflow-db": "4.7.16",
27
- "@superhero/id-name-generator": "4.7.16",
28
- "@superhero/log": "4.7.16",
29
- "@superhero/tcp-record-channel": "4.7.16"
25
+ "@superhero/deep": "4.7.18",
26
+ "@superhero/eventflow-certificates": "4.7.18",
27
+ "@superhero/eventflow-db": "4.7.18",
28
+ "@superhero/id-name-generator": "4.7.18",
29
+ "@superhero/log": "4.7.18",
30
+ "@superhero/tcp-record-channel": "4.7.18"
30
31
  },
31
32
  "devDependencies": {
32
- "@superhero/audit": "4.7.16",
33
+ "@superhero/audit": "4.7.18",
33
34
  "@superhero/syntax-check": "0.0.2",
34
- "@superhero/locator": "4.7.16",
35
- "@superhero/eventflow-hub": "4.7.16"
35
+ "@superhero/core": "4.7.18",
36
+ "@superhero/eventflow-hub": "4.7.18"
36
37
  },
37
38
  "author": {
38
39
  "name": "Erik Landvall",