xcraft-core-busclient 5.4.1 → 5.5.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/index.js +5 -1
- package/lib/command.js +2 -1
- package/lib/resp.js +9 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -447,7 +447,11 @@ class BusClient extends EventEmitter {
|
|
|
447
447
|
noForwarding: busConfig.noForwarding,
|
|
448
448
|
};
|
|
449
449
|
if (busConfig.caPath) {
|
|
450
|
-
|
|
450
|
+
if (!path.isAbsolute(busConfig.caPath)) {
|
|
451
|
+
options.caPath = path.join(resourcesPath, busConfig.caPath);
|
|
452
|
+
} else {
|
|
453
|
+
options.caPath = busConfig.caPath;
|
|
454
|
+
}
|
|
451
455
|
}
|
|
452
456
|
|
|
453
457
|
this._subSocket.connect(backend, {
|
package/lib/command.js
CHANGED
|
@@ -19,7 +19,8 @@ class Command {
|
|
|
19
19
|
|
|
20
20
|
this._push
|
|
21
21
|
.on('close', (err) => this.#onNetworkError(err))
|
|
22
|
-
.on('error', (err) => this.#onNetworkError(err))
|
|
22
|
+
.on('error', (err) => this.#onNetworkError(err))
|
|
23
|
+
.on('reconnect attempt', (err) => this.#onNetworkError(err));
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
#onNetworkError(err) {
|
package/lib/resp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const {promisify} = require('node:util');
|
|
3
4
|
const watt = require('gigawatts');
|
|
4
5
|
|
|
5
6
|
class Events {
|
|
@@ -101,6 +102,7 @@ class Command {
|
|
|
101
102
|
this._busClient = busClient;
|
|
102
103
|
this._orcName = orcName;
|
|
103
104
|
this._msgContext = msgContext;
|
|
105
|
+
this._sendAsync = promisify(this._send).bind(this);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
set msgContext(value) {
|
|
@@ -133,13 +135,20 @@ class Command {
|
|
|
133
135
|
);
|
|
134
136
|
}
|
|
135
137
|
|
|
138
|
+
/** @deprecated */
|
|
136
139
|
send(cmd, data, finishHandler) {
|
|
137
140
|
this._send(cmd, data, null, finishHandler);
|
|
138
141
|
}
|
|
139
142
|
|
|
143
|
+
/** @deprecated */
|
|
140
144
|
nestedSend(cmd, data, finishHandler) {
|
|
141
145
|
this._send(cmd, data, {forceNested: true}, finishHandler);
|
|
142
146
|
}
|
|
147
|
+
|
|
148
|
+
async sendAsync(cmd, data) {
|
|
149
|
+
const msg = await this._sendAsync(cmd, data, {forceNested: true});
|
|
150
|
+
return msg.data;
|
|
151
|
+
}
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
class Resp {
|