@tdxvolt/volt-client-grpc 0.1.0 → 0.1.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/lib/index.cjs CHANGED
@@ -94,8 +94,8 @@ const constants = {
94
94
  */
95
95
  serviceType: {
96
96
  fileAPI: "tdx.volt_api.volt.v1.FileAPI",
97
- protocolBridgeDataStream: "tdx.volt_api.protocol_bridge.v1.ProtocolBridgeStreamAPI",
98
97
  sqliteServerAPI: "tdx.volt_api.data.v1.SqliteServerAPI",
98
+ sqliteDatabaseAPI: "tdx.volt_api.data.v1.SqliteDatabaseAPI",
99
99
  ssiAPI: "tdx.volt_api.ssi.v1.SsiAPI",
100
100
  tunnelAPI: "tdx.volt_api.tunnel.v1.TunnelAPI",
101
101
  voltAPI: "tdx.volt_api.volt.v1.VoltAPI",
@@ -587,7 +587,7 @@ class VoltCrypto {
587
587
  * @param {*} ttl
588
588
  * @returns
589
589
  */
590
- getIdentityMetadata(grpc, audience, tunnelling = false, ttl = 10) {
590
+ getIdentityMetadata(grpc, audience, tunnelling = false, ttl = 60) {
591
591
  const identityToken = this.getIdentityToken(audience || this._voltConfig.id, tunnelling, ttl);
592
592
  const metadata = new grpc.Metadata();
593
593
  metadata.add(constants.authTokenName, identityToken.token);
@@ -890,6 +890,10 @@ class GRPCCall extends EventEmitter__default["default"] {
890
890
 
891
891
  this._initialRequest = _prepareInvokeRequest.call(this, request, this._methodName, this._methodType);
892
892
 
893
+ if (!this._grpcClient[this._initialRequest.method]) {
894
+ return reject(new Error(`method not found: '${this._initialRequest.method}'`));
895
+ }
896
+
893
897
  this._call = this._grpcClient[this._initialRequest.method](this._initialRequest.meta.metadata, callbackIntercept);
894
898
 
895
899
  this._call.on("data", (streamResponse) => {
@@ -1128,6 +1132,7 @@ const log$1 = debug__default["default"]("volt-client-grpc:volt-client-internal")
1128
1132
  const voltServices = [
1129
1133
  constants.serviceType.voltAPI,
1130
1134
  constants.serviceType.fileAPI,
1135
+ constants.serviceType.sqliteDatabaseAPI,
1131
1136
  constants.serviceType.sqliteServerAPI,
1132
1137
  constants.serviceType.ssiAPI,
1133
1138
  constants.serviceType.tunnelAPI,
@@ -1853,6 +1858,16 @@ class VoltClient extends EventEmitter__default["default"] {
1853
1858
  });
1854
1859
  }
1855
1860
 
1861
+ /**
1862
+ * SqliteDatabaseAPI
1863
+ */
1864
+ SqlExecute(request, callback) {
1865
+ const grpcClient = this.getVoltAPIClient();
1866
+
1867
+ const subscribeCall = new GRPCCall(this, "Execute", "METHOD_TYPE_BIDI");
1868
+ return subscribeCall.start(grpcClient, request, callback);
1869
+ }
1870
+
1856
1871
  /**
1857
1872
  * WireAPI
1858
1873
  */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.0",
6
+ "version": "0.1.1",
7
7
  "description": "tdx Volt library for nodejs clients",
8
8
  "type": "module",
9
9
  "exports": {
package/src/constants.js CHANGED
@@ -60,8 +60,8 @@ export const constants = {
60
60
  */
61
61
  serviceType: {
62
62
  fileAPI: "tdx.volt_api.volt.v1.FileAPI",
63
- protocolBridgeDataStream: "tdx.volt_api.protocol_bridge.v1.ProtocolBridgeStreamAPI",
64
63
  sqliteServerAPI: "tdx.volt_api.data.v1.SqliteServerAPI",
64
+ sqliteDatabaseAPI: "tdx.volt_api.data.v1.SqliteDatabaseAPI",
65
65
  ssiAPI: "tdx.volt_api.ssi.v1.SsiAPI",
66
66
  tunnelAPI: "tdx.volt_api.tunnel.v1.TunnelAPI",
67
67
  voltAPI: "tdx.volt_api.volt.v1.VoltAPI",
package/src/grpc-call.js CHANGED
@@ -178,6 +178,10 @@ export default class GRPCCall extends EventEmitter {
178
178
 
179
179
  this._initialRequest = _prepareInvokeRequest.call(this, request, this._methodName, this._methodType);
180
180
 
181
+ if (!this._grpcClient[this._initialRequest.method]) {
182
+ return reject(new Error(`method not found: '${this._initialRequest.method}'`));
183
+ }
184
+
181
185
  this._call = this._grpcClient[this._initialRequest.method](this._initialRequest.meta.metadata, callbackIntercept);
182
186
 
183
187
  this._call.on("data", (streamResponse) => {
@@ -18,6 +18,7 @@ const log = debug("volt-client-grpc:volt-client-internal");
18
18
  const voltServices = [
19
19
  constants.serviceType.voltAPI,
20
20
  constants.serviceType.fileAPI,
21
+ constants.serviceType.sqliteDatabaseAPI,
21
22
  constants.serviceType.sqliteServerAPI,
22
23
  constants.serviceType.ssiAPI,
23
24
  constants.serviceType.tunnelAPI,
@@ -472,6 +472,16 @@ export class VoltClient extends EventEmitter {
472
472
  });
473
473
  }
474
474
 
475
+ /**
476
+ * SqliteDatabaseAPI
477
+ */
478
+ SqlExecute(request, callback) {
479
+ const grpcClient = this.getVoltAPIClient();
480
+
481
+ const subscribeCall = new GRPCCall(this, "Execute", "METHOD_TYPE_BIDI");
482
+ return subscribeCall.start(grpcClient, request, callback);
483
+ }
484
+
475
485
  /**
476
486
  * WireAPI
477
487
  */
@@ -169,7 +169,7 @@ export class VoltCrypto {
169
169
  * @param {*} ttl
170
170
  * @returns
171
171
  */
172
- getIdentityMetadata(grpc, audience, tunnelling = false, ttl = 10) {
172
+ getIdentityMetadata(grpc, audience, tunnelling = false, ttl = 60) {
173
173
  const identityToken = this.getIdentityToken(audience || this._voltConfig.id, tunnelling, ttl);
174
174
  const metadata = new grpc.Metadata();
175
175
  metadata.add(constants.authTokenName, identityToken.token);