@tdxvolt/volt-client-grpc 0.11.4 → 0.11.6

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/lib/index.cjs CHANGED
@@ -241,7 +241,7 @@ function createClient(
241
241
  ) {
242
242
  let grpcCredentials;
243
243
  if (credentials) {
244
- const ca = credentials.config?.relay?.ca_pem || credentials.cache.ca;
244
+ const ca = credentials.config?.volt?.relay?.ca_pem || credentials.cache.ca;
245
245
  const cert = credentials.cache.cloud_cert || credentials.cache.cert;
246
246
  const { key } = credentials.cache;
247
247
 
@@ -1376,9 +1376,9 @@ async function bindInternal() {
1376
1376
  }
1377
1377
 
1378
1378
  // For remote connections, add our cloud-issued certificate as an additional credential.
1379
- if (this._config?.relay?.ca_pem && this._credential.cache.cloud_cert) {
1379
+ if (this._voltConfig?.relay?.ca_pem && this._credential.cache.cloud_cert) {
1380
1380
  bindRequest.x509_credential = bindRequest.x509_credential.concat(
1381
- this._credential.cache.cloud_cert + this._config.relay.ca_pem,
1381
+ this._credential.cache.cloud_cert + this._voltConfig.relay.ca_pem,
1382
1382
  );
1383
1383
  }
1384
1384
 
@@ -1469,7 +1469,7 @@ function connectInternal() {
1469
1469
  function getVoltAPIClientInternal() {
1470
1470
  if (!this._cachedClient) {
1471
1471
  const serviceAddress = this.isRemote
1472
- ? this._config.relay.address
1472
+ ? this._voltConfig.relay.address
1473
1473
  : this._voltConfig.address;
1474
1474
  log$1("creating cached VoltAPI service client on %s", serviceAddress);
1475
1475
  let serviceDescriptors = {};
@@ -1484,8 +1484,8 @@ function getVoltAPIClientInternal() {
1484
1484
  serviceAddress,
1485
1485
  this._credential,
1486
1486
  this.isRemote && !this.isVoltRelay,
1487
- this._config?.relay?.cloud ? this._voltConfig.id : "",
1488
- this._config?.relay?.cloud ? this._voltConfig.id : "",
1487
+ this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
1488
+ this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
1489
1489
  );
1490
1490
  }
1491
1491
 
@@ -1800,7 +1800,7 @@ class VoltClient extends EventEmitter__default["default"] {
1800
1800
  }
1801
1801
 
1802
1802
  if (this.isRemote) {
1803
- if (!this._config?.relay?.address) {
1803
+ if (!this._voltConfig?.relay?.address) {
1804
1804
  throw new Error(
1805
1805
  "Remote connection enabled but no Relay address - have you called start()?",
1806
1806
  );
@@ -1810,7 +1810,7 @@ class VoltClient extends EventEmitter__default["default"] {
1810
1810
  return createClient(
1811
1811
  this._grpc,
1812
1812
  serviceDescriptors,
1813
- this._config.relay.address,
1813
+ this._voltConfig.relay.address,
1814
1814
  this._credential,
1815
1815
  false,
1816
1816
  service.volt_id,
@@ -1827,11 +1827,11 @@ class VoltClient extends EventEmitter__default["default"] {
1827
1827
  }
1828
1828
 
1829
1829
  get isRemote() {
1830
- return !!(this._config?.relay && this._voltConfig.id);
1830
+ return !!(this._voltConfig?.relay && this._voltConfig.id);
1831
1831
  }
1832
1832
 
1833
1833
  get isVoltRelay() {
1834
- return this.isRemote && !this._config?.relay.cloud;
1834
+ return this.isRemote && !this._voltConfig?.relay.cloud;
1835
1835
  }
1836
1836
 
1837
1837
  connect() {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.11.4",
6
+ "version": "0.11.6",
7
7
  "description": "tdx Volt library for nodejs clients",
8
8
  "type": "module",
9
9
  "exports": {
@@ -39,6 +39,7 @@
39
39
  "@grpc/proto-loader": "^0.6.4",
40
40
  "bent": "^7.3.12",
41
41
  "bs58": "^4.0.1",
42
+ "builtin-modules": "^3.3.0",
42
43
  "debug": "^4.1.1",
43
44
  "ip": "^1.1.5",
44
45
  "jsonwebtoken": "^8.5.1",
package/src/grpc-utils.js CHANGED
@@ -20,7 +20,7 @@ export function createClient(
20
20
  ) {
21
21
  let grpcCredentials;
22
22
  if (credentials) {
23
- const ca = credentials.config?.relay?.ca_pem || credentials.cache.ca;
23
+ const ca = credentials.config?.volt?.relay?.ca_pem || credentials.cache.ca;
24
24
  const cert = credentials.cache.cloud_cert || credentials.cache.cert;
25
25
  const { key } = credentials.cache;
26
26
 
@@ -150,9 +150,9 @@ export async function bindInternal() {
150
150
  }
151
151
 
152
152
  // For remote connections, add our cloud-issued certificate as an additional credential.
153
- if (this._config?.relay?.ca_pem && this._credential.cache.cloud_cert) {
153
+ if (this._voltConfig?.relay?.ca_pem && this._credential.cache.cloud_cert) {
154
154
  bindRequest.x509_credential = bindRequest.x509_credential.concat(
155
- this._credential.cache.cloud_cert + this._config.relay.ca_pem,
155
+ this._credential.cache.cloud_cert + this._voltConfig.relay.ca_pem,
156
156
  );
157
157
  }
158
158
 
@@ -243,7 +243,7 @@ export function connectInternal() {
243
243
  export function getVoltAPIClientInternal() {
244
244
  if (!this._cachedClient) {
245
245
  const serviceAddress = this.isRemote
246
- ? this._config.relay.address
246
+ ? this._voltConfig.relay.address
247
247
  : this._voltConfig.address;
248
248
  log("creating cached VoltAPI service client on %s", serviceAddress);
249
249
  let serviceDescriptors = {};
@@ -258,8 +258,8 @@ export function getVoltAPIClientInternal() {
258
258
  serviceAddress,
259
259
  this._credential,
260
260
  this.isRemote && !this.isVoltRelay,
261
- this._config?.relay?.cloud ? this._voltConfig.id : "",
262
- this._config?.relay?.cloud ? this._voltConfig.id : "",
261
+ this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
262
+ this._voltConfig?.relay?.cloud ? this._voltConfig.id : "",
263
263
  );
264
264
  }
265
265
 
@@ -231,7 +231,7 @@ export class VoltClient extends EventEmitter {
231
231
  }
232
232
 
233
233
  if (this.isRemote) {
234
- if (!this._config?.relay?.address) {
234
+ if (!this._voltConfig?.relay?.address) {
235
235
  throw new Error(
236
236
  "Remote connection enabled but no Relay address - have you called start()?",
237
237
  );
@@ -241,7 +241,7 @@ export class VoltClient extends EventEmitter {
241
241
  return createGrpcClient(
242
242
  this._grpc,
243
243
  serviceDescriptors,
244
- this._config.relay.address,
244
+ this._voltConfig.relay.address,
245
245
  this._credential,
246
246
  false,
247
247
  service.volt_id,
@@ -258,11 +258,11 @@ export class VoltClient extends EventEmitter {
258
258
  }
259
259
 
260
260
  get isRemote() {
261
- return !!(this._config?.relay && this._voltConfig.id);
261
+ return !!(this._voltConfig?.relay && this._voltConfig.id);
262
262
  }
263
263
 
264
264
  get isVoltRelay() {
265
- return this.isRemote && !this._config?.relay.cloud;
265
+ return this.isRemote && !this._voltConfig?.relay.cloud;
266
266
  }
267
267
 
268
268
  connect() {