@superhero/eventflow-spoke 4.0.0 → 4.0.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/README.md +7 -9
- package/index.js +13 -7
- package/index.test.js +6 -9
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -26,14 +26,12 @@ npm install @superhero/eventflow-spoke
|
|
|
26
26
|
To initialize a Spoke instance:
|
|
27
27
|
|
|
28
28
|
```javascript
|
|
29
|
-
import
|
|
30
|
-
|
|
29
|
+
import Locator from '@superhero/locator'
|
|
31
30
|
const locator = new Locator()
|
|
32
|
-
locator.
|
|
33
|
-
locator.
|
|
34
|
-
locator.eagerload(config.find('locator'))
|
|
35
|
-
|
|
36
|
-
const spoke = locate(locator)
|
|
31
|
+
await locator.config.add('@superhero/eventflow-db')
|
|
32
|
+
await locator.config.add('@superhero/eventflow-spoke')
|
|
33
|
+
await locator.eagerload(locator.config.find('locator'))
|
|
34
|
+
const spoke = locator('@superhero/eventflow-spoke')
|
|
37
35
|
await spoke.bootstrap()
|
|
38
36
|
```
|
|
39
37
|
|
|
@@ -210,7 +208,7 @@ file | line % | branch % | funcs % | uncovered lines
|
|
|
210
208
|
-------------------------------------------------------------------------------------------------------------------------
|
|
211
209
|
config.js | 100.00 | 100.00 | 100.00 |
|
|
212
210
|
consume.js | 42.24 | 100.00 | 42.86 | 43-55 58-91 94-103 106-115
|
|
213
|
-
index.js | 86.26 | 80.43 | 88.89 |
|
|
211
|
+
index.js | 86.26 | 80.43 | 88.89 | 35-37 45-48 101-105 112-113 119-122 145-160 180-184 206-211 220-232…
|
|
214
212
|
index.test.js | 100.00 | 100.00 | 100.00 |
|
|
215
213
|
manager | | | |
|
|
216
214
|
hubs.js | 100.00 | 100.00 | 100.00 |
|
|
@@ -218,7 +216,7 @@ manager | | | |
|
|
|
218
216
|
listeners.js | 100.00 | 100.00 | 88.89 |
|
|
219
217
|
listeners.test.js | 100.00 | 100.00 | 100.00 |
|
|
220
218
|
-------------------------------------------------------------------------------------------------------------------------
|
|
221
|
-
all files |
|
|
219
|
+
all files | 86.35 | 91.45 | 90.10 |
|
|
222
220
|
-------------------------------------------------------------------------------------------------------------------------
|
|
223
221
|
```
|
|
224
222
|
|
package/index.js
CHANGED
|
@@ -11,8 +11,8 @@ import ListenersManager from '@superhero/eventflow-spoke/manager/listeners
|
|
|
11
11
|
export function locate(locator)
|
|
12
12
|
{
|
|
13
13
|
const
|
|
14
|
-
config = locator
|
|
15
|
-
db = locator('@superhero/eventflow-db')
|
|
14
|
+
config = locator.config.find('eventflow/spoke'),
|
|
15
|
+
db = locator.locate('@superhero/eventflow-db')
|
|
16
16
|
|
|
17
17
|
return new Spoke(config, db)
|
|
18
18
|
}
|
|
@@ -24,11 +24,12 @@ export default class Spoke
|
|
|
24
24
|
{
|
|
25
25
|
#spokeID
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
idNameGenerator = new IdNameGenerator()
|
|
28
|
+
abortion = new AbortController()
|
|
29
|
+
channel = new Channel()
|
|
30
|
+
hubs = new HubsManager()
|
|
31
|
+
subscriptions = new ListenersManager()
|
|
32
|
+
consumers = new ListenersManager()
|
|
32
33
|
|
|
33
34
|
get spokeID()
|
|
34
35
|
{
|
|
@@ -307,6 +308,11 @@ export default class Spoke
|
|
|
307
308
|
})
|
|
308
309
|
}
|
|
309
310
|
|
|
311
|
+
generatePid()
|
|
312
|
+
{
|
|
313
|
+
return this.idNameGenerator.generateId()
|
|
314
|
+
}
|
|
315
|
+
|
|
310
316
|
async publish(event)
|
|
311
317
|
{
|
|
312
318
|
const eventID = await this.persist(event)
|
package/index.test.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import assert from 'node:assert/strict'
|
|
2
2
|
import util from 'node:util'
|
|
3
|
-
import Config from '@superhero/config'
|
|
4
3
|
import Locator from '@superhero/locator'
|
|
5
4
|
import { suite, test, before, after } from 'node:test'
|
|
6
5
|
|
|
@@ -14,16 +13,14 @@ suite('@superhero/eventflow-spoke', () =>
|
|
|
14
13
|
{
|
|
15
14
|
locator = new Locator()
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
await config.add('@superhero/eventflow-
|
|
19
|
-
await config.add('
|
|
20
|
-
|
|
21
|
-
config.assign({ eventflow: {
|
|
22
|
-
config.assign({ eventflow: { hub: { certificates: { CERT_PASS_ENCRYPTION_KEY: 'encryptionKey123' }}}})
|
|
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' }}}})
|
|
23
21
|
|
|
24
|
-
locator.set('@superhero/config', config)
|
|
25
22
|
await locator.eagerload('@superhero/eventflow-db')
|
|
26
|
-
await locator.eagerload(config.find('locator'))
|
|
23
|
+
await locator.eagerload(locator.config.find('locator'))
|
|
27
24
|
|
|
28
25
|
spoke = locator('@superhero/eventflow-spoke')
|
|
29
26
|
hub = locator('@superhero/eventflow-hub')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/eventflow-spoke",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Eventflow spoke is the client component in the eventflow ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eventflow",
|
|
@@ -16,16 +16,14 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@superhero/deep": "^4.2.0",
|
|
19
|
-
"@superhero/eventflow-certificates": "^4.0.
|
|
20
|
-
"@superhero/eventflow-db": "^4.1.0",
|
|
19
|
+
"@superhero/eventflow-certificates": "^4.0.4",
|
|
21
20
|
"@superhero/id-name-generator": "^4.0.0",
|
|
22
21
|
"@superhero/log": "^4.0.0",
|
|
23
22
|
"@superhero/tcp-record-channel": "^4.2.1"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@superhero/
|
|
27
|
-
"@superhero/
|
|
28
|
-
"@superhero/eventflow-hub": "^4.0.4"
|
|
25
|
+
"@superhero/locator": "^4.2.2",
|
|
26
|
+
"@superhero/eventflow-hub": "^4.0.5"
|
|
29
27
|
},
|
|
30
28
|
"scripts": {
|
|
31
29
|
"test-build": "npm explore @superhero/eventflow-db -- npm run test-build",
|