@superhero/eventflow-spoke 4.8.2 → 4.8.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/index.js +18 -8
  3. package/package.json +10 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ #### v4.8.3
3
+ ---
4
+
5
+ ...
6
+
1
7
  ---
2
8
  #### v4.8.2
3
9
  ---\n\nVersion alignment...
package/index.js CHANGED
@@ -119,12 +119,10 @@ export default class Spoke
119
119
  this.log.info`connecting to hub ${hubID} › ${hubIP}:${hubPort}`
120
120
 
121
121
  const
122
- rootCA = await this.certificates.root,
123
- spokeICA = await this.certificates.intermediate,
124
- spokeLeaf = await this.certificates.leaf,
125
- ca = rootCA.cert,
126
- certChain = spokeLeaf.cert + spokeICA.cert,
127
- dynamicConfig = { servername:hubID, host:hubIP, port:hubPort, ca, cert:certChain, key:spokeLeaf.key, passphrase:spokeLeaf.pass },
122
+ chain = await this.certificates.getChain(),
123
+ ca = chain.root.cert,
124
+ cert = chain.leaf.cert + chain.intermediate.cert,
125
+ dynamicConfig = { servername:hubID, host:hubIP, port:hubPort, ca, cert, key:chain.leaf.key, passphrase:chain.leaf.pass },
128
126
  peerHubConfig = deepmerge(dynamicConfig, this.config.TCP_SOCKET_CLIENT_OPTIONS),
129
127
  hub = await this.channel.createTlsClient(peerHubConfig)
130
128
 
@@ -157,8 +155,20 @@ export default class Spoke
157
155
  }
158
156
  default:
159
157
  {
160
- const message = `failed to connect to hub ${hubID} › ${hubIP}:${hubPort} [${error.code}] ${error.message}`
161
- this.log.fail`failed to connect to hub ${hubID} ${hubIP}:${hubPort} [${error.code}] ${error.message}`
158
+ let chain = ''
159
+ for(let cause = error; cause; cause = cause.cause)
160
+ {
161
+ if(cause instanceof Error)
162
+ {
163
+ chain += ` › [${cause.code}] ${cause.message}`
164
+ }
165
+ else if('string' === typeof cause)
166
+ {
167
+ chain += ` › ${cause}`
168
+ }
169
+ }
170
+ this.log.fail`failed to connect to hub ${hubID} › ${hubIP}:${hubPort}${chain}`
171
+ const message = `failed to connect to hub ${hubID} › ${hubIP}:${hubPort}`
162
172
  await this.db.persistLog({ agent:this.#spokeID, message, error })
163
173
  }
164
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/eventflow-spoke",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "description": "Eventflow spoke is the client component in the eventflow ecosystem.",
5
5
  "keywords": [
6
6
  "eventflow",
@@ -22,18 +22,18 @@
22
22
  "test": "syntax-check; node --test --test-reporter=@superhero/audit/reporter --experimental-test-coverage"
23
23
  },
24
24
  "dependencies": {
25
- "@superhero/deep": "4.8.2",
26
- "@superhero/eventflow-certificates": "4.8.2",
27
- "@superhero/eventflow-db": "4.8.2",
28
- "@superhero/id-name-generator": "4.8.2",
29
- "@superhero/log": "4.8.2",
30
- "@superhero/tcp-record-channel": "4.8.2"
25
+ "@superhero/deep": "4.8.3",
26
+ "@superhero/eventflow-certificates": "4.8.3",
27
+ "@superhero/eventflow-db": "4.8.3",
28
+ "@superhero/id-name-generator": "4.8.3",
29
+ "@superhero/log": "4.8.3",
30
+ "@superhero/tcp-record-channel": "4.8.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@superhero/audit": "4.8.2",
33
+ "@superhero/audit": "4.8.3",
34
34
  "@superhero/syntax-check": "0.0.2",
35
- "@superhero/core": "4.8.2",
36
- "@superhero/eventflow-hub": "4.8.2"
35
+ "@superhero/core": "4.8.3",
36
+ "@superhero/eventflow-hub": "4.8.3"
37
37
  },
38
38
  "author": {
39
39
  "name": "Erik Landvall",