@superhero/eventflow-spoke 4.4.6 → 4.4.7
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/config.js +1 -1
- package/index.js +11 -1
- package/manager/listeners.js +10 -0
- package/package.json +2 -2
package/config.js
CHANGED
package/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { setTimeout as wait } from 'node:timers/promises'
|
|
|
2
2
|
import Channel from '@superhero/tcp-record-channel'
|
|
3
3
|
import IdNameGenerator from '@superhero/id-name-generator'
|
|
4
4
|
import Log from '@superhero/log'
|
|
5
|
-
import deepmerge from '@superhero/deep/merge'
|
|
6
5
|
import deepassign from '@superhero/deep/assign'
|
|
6
|
+
import deepmerge from '@superhero/deep/merge'
|
|
7
7
|
import CertificatesManager from '@superhero/eventflow-certificates'
|
|
8
8
|
import HubsManager from '@superhero/eventflow-spoke/manager/hubs'
|
|
9
9
|
import ListenersManager from '@superhero/eventflow-spoke/manager/listeners'
|
|
@@ -144,6 +144,16 @@ export default class Spoke
|
|
|
144
144
|
hub.on('close', this.#onHubDisconnected .bind(this, hub))
|
|
145
145
|
hub.on('error', this.#onHubError .bind(this, hub))
|
|
146
146
|
this.log.info`connected to hub ${hubID} › ${hubIP}:${hubPort}`
|
|
147
|
+
|
|
148
|
+
// subscribe to all events that are already expected to be subscribed to
|
|
149
|
+
const subscriptions = deepmerge(this.consumers.listeners, this.subscriptions.listeners)
|
|
150
|
+
for(const domain in subscriptions)
|
|
151
|
+
{
|
|
152
|
+
for(const name of subscriptions[domain])
|
|
153
|
+
{
|
|
154
|
+
this.channel.transmit(hub, [ 'subscribe', domain, name ])
|
|
155
|
+
}
|
|
156
|
+
}
|
|
147
157
|
}
|
|
148
158
|
}
|
|
149
159
|
catch(error)
|
package/manager/listeners.js
CHANGED
|
@@ -28,6 +28,16 @@ export default class ListenersManager
|
|
|
28
28
|
|
|
29
29
|
#map = new Map
|
|
30
30
|
|
|
31
|
+
get listeners()
|
|
32
|
+
{
|
|
33
|
+
const
|
|
34
|
+
entries = [...this.#map.entries()],
|
|
35
|
+
entriesMap = entries.map(([domain, listener]) => [domain, listener.eventNames()]),
|
|
36
|
+
listeners = Object.fromEntries(entriesMap)
|
|
37
|
+
|
|
38
|
+
return listeners
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
constructor()
|
|
32
42
|
{
|
|
33
43
|
return new Proxy(this,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/eventflow-spoke",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.7",
|
|
4
4
|
"description": "Eventflow spoke is the client component in the eventflow ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eventflow",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./manager/*": "./manager/*.js"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@superhero/deep": "^4.
|
|
18
|
+
"@superhero/deep": "^4.3.0",
|
|
19
19
|
"@superhero/eventflow-certificates": "^4.4.6",
|
|
20
20
|
"@superhero/eventflow-db": "^4.4.0",
|
|
21
21
|
"@superhero/id-name-generator": "^4.0.0",
|