@google-cloud/spanner 8.0.0 → 8.1.0
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/README.md +2 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +35 -0
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +9 -4
- package/build/protos/google/spanner/v1/transaction.proto +40 -356
- package/build/protos/protos.d.ts +1521 -0
- package/build/protos/protos.js +3906 -0
- package/build/protos/protos.json +317 -1
- package/build/src/batch-transaction.js +2 -2
- package/build/src/codec.js +20 -21
- package/build/src/common-grpc/service.js +10 -10
- package/build/src/common.d.ts +1 -0
- package/build/src/common.js +9 -1
- package/build/src/database.d.ts +1 -0
- package/build/src/database.js +2 -0
- package/build/src/helper.d.ts +90 -0
- package/build/src/helper.js +154 -0
- package/build/src/index.d.ts +33 -0
- package/build/src/index.js +178 -8
- package/build/src/instrument.js +3 -2
- package/build/src/metrics/constants.d.ts +36 -0
- package/build/src/metrics/constants.js +106 -0
- package/build/src/metrics/external-types.d.ts +20 -0
- package/build/src/metrics/external-types.js +32 -0
- package/build/src/metrics/interceptor.d.ts +13 -0
- package/build/src/metrics/interceptor.js +87 -0
- package/build/src/metrics/metrics-tracer-factory.d.ts +165 -0
- package/build/src/metrics/metrics-tracer-factory.js +389 -0
- package/build/src/metrics/metrics-tracer.d.ts +204 -0
- package/build/src/metrics/metrics-tracer.js +371 -0
- package/build/src/metrics/spanner-metrics-exporter.d.ts +35 -0
- package/build/src/metrics/spanner-metrics-exporter.js +119 -0
- package/build/src/metrics/transform.d.ts +144 -0
- package/build/src/metrics/transform.js +272 -0
- package/build/src/partial-result-stream.js +9 -5
- package/build/src/session-factory.d.ts +34 -0
- package/build/src/session-factory.js +30 -0
- package/build/src/session-pool.js +1 -2
- package/build/src/transaction-runner.d.ts +1 -0
- package/build/src/transaction-runner.js +6 -0
- package/build/src/transaction.d.ts +42 -1
- package/build/src/transaction.js +192 -42
- package/build/src/v1/database_admin_client.d.ts +34 -0
- package/build/src/v1/database_admin_client.js +167 -1
- package/build/src/v1/database_admin_client_config.json +4 -0
- package/build/src/v1/instance_admin_client.d.ts +120 -0
- package/build/src/v1/instance_admin_client.js +312 -13
- package/build/src/v1/spanner_client.js +108 -0
- package/build/src/v1/spanner_proto_list.json +1 -0
- package/package.json +12 -5
|
@@ -202,7 +202,7 @@ class InstanceAdminClient {
|
|
|
202
202
|
listInstancePartitions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instancePartitions'),
|
|
203
203
|
listInstancePartitionOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
|
|
204
204
|
};
|
|
205
|
-
const protoFilesRoot = this._gaxModule.
|
|
205
|
+
const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
|
|
206
206
|
// This API contains "long-running operations", which return a
|
|
207
207
|
// an Operation object that allows for tracking of the operation,
|
|
208
208
|
// rather than holding a request open.
|
|
@@ -214,31 +214,69 @@ class InstanceAdminClient {
|
|
|
214
214
|
lroOptions.protoJson = protoFilesRoot;
|
|
215
215
|
lroOptions.httpRules = [
|
|
216
216
|
{
|
|
217
|
-
selector: 'google.longrunning.Operations.
|
|
218
|
-
|
|
217
|
+
selector: 'google.longrunning.Operations.CancelOperation',
|
|
218
|
+
post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel',
|
|
219
219
|
additional_bindings: [
|
|
220
|
-
{
|
|
220
|
+
{ post: '/v1/{name=projects/*/instances/*/operations/*}:cancel' },
|
|
221
|
+
{
|
|
222
|
+
post: '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
post: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations/*}:cancel',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
post: '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
post: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations/*}:cancel',
|
|
232
|
+
},
|
|
221
233
|
],
|
|
222
234
|
},
|
|
223
235
|
{
|
|
224
|
-
selector: 'google.longrunning.Operations.
|
|
225
|
-
|
|
236
|
+
selector: 'google.longrunning.Operations.DeleteOperation',
|
|
237
|
+
delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}',
|
|
226
238
|
additional_bindings: [
|
|
227
|
-
{
|
|
239
|
+
{ delete: '/v1/{name=projects/*/instances/*/operations/*}' },
|
|
240
|
+
{
|
|
241
|
+
delete: '/v1/{name=projects/*/instances/*/backups/*/operations/*}',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
delete: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations/*}',
|
|
245
|
+
},
|
|
246
|
+
{ delete: '/v1/{name=projects/*/instanceConfigs/*/operations/*}' },
|
|
247
|
+
{
|
|
248
|
+
delete: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations/*}',
|
|
249
|
+
},
|
|
228
250
|
],
|
|
229
251
|
},
|
|
230
252
|
{
|
|
231
|
-
selector: 'google.longrunning.Operations.
|
|
232
|
-
|
|
253
|
+
selector: 'google.longrunning.Operations.GetOperation',
|
|
254
|
+
get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}',
|
|
233
255
|
additional_bindings: [
|
|
234
|
-
{
|
|
256
|
+
{ get: '/v1/{name=projects/*/instances/*/operations/*}' },
|
|
257
|
+
{ get: '/v1/{name=projects/*/instances/*/backups/*/operations/*}' },
|
|
258
|
+
{
|
|
259
|
+
get: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations/*}',
|
|
260
|
+
},
|
|
261
|
+
{ get: '/v1/{name=projects/*/instanceConfigs/*/operations/*}' },
|
|
262
|
+
{
|
|
263
|
+
get: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations/*}',
|
|
264
|
+
},
|
|
235
265
|
],
|
|
236
266
|
},
|
|
237
267
|
{
|
|
238
|
-
selector: 'google.longrunning.Operations.
|
|
239
|
-
|
|
268
|
+
selector: 'google.longrunning.Operations.ListOperations',
|
|
269
|
+
get: '/v1/{name=projects/*/instances/*/databases/*/operations}',
|
|
240
270
|
additional_bindings: [
|
|
241
|
-
{
|
|
271
|
+
{ get: '/v1/{name=projects/*/instances/*/operations}' },
|
|
272
|
+
{ get: '/v1/{name=projects/*/instances/*/backups/*/operations}' },
|
|
273
|
+
{
|
|
274
|
+
get: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations}',
|
|
275
|
+
},
|
|
276
|
+
{ get: '/v1/{name=projects/*/instanceConfigs/*/operations}' },
|
|
277
|
+
{
|
|
278
|
+
get: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations}',
|
|
279
|
+
},
|
|
242
280
|
],
|
|
243
281
|
},
|
|
244
282
|
];
|
|
@@ -438,6 +476,15 @@ class InstanceAdminClient {
|
|
|
438
476
|
?.then(([response, options, rawResponse]) => {
|
|
439
477
|
this._log.info('getInstanceConfig response %j', response);
|
|
440
478
|
return [response, options, rawResponse];
|
|
479
|
+
})
|
|
480
|
+
.catch((error) => {
|
|
481
|
+
if (error &&
|
|
482
|
+
'statusDetails' in error &&
|
|
483
|
+
error.statusDetails instanceof Array) {
|
|
484
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
485
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
486
|
+
}
|
|
487
|
+
throw error;
|
|
441
488
|
});
|
|
442
489
|
}
|
|
443
490
|
deleteInstanceConfig(request, optionsOrCallback, callback) {
|
|
@@ -472,6 +519,15 @@ class InstanceAdminClient {
|
|
|
472
519
|
?.then(([response, options, rawResponse]) => {
|
|
473
520
|
this._log.info('deleteInstanceConfig response %j', response);
|
|
474
521
|
return [response, options, rawResponse];
|
|
522
|
+
})
|
|
523
|
+
.catch((error) => {
|
|
524
|
+
if (error &&
|
|
525
|
+
'statusDetails' in error &&
|
|
526
|
+
error.statusDetails instanceof Array) {
|
|
527
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
528
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
529
|
+
}
|
|
530
|
+
throw error;
|
|
475
531
|
});
|
|
476
532
|
}
|
|
477
533
|
getInstance(request, optionsOrCallback, callback) {
|
|
@@ -506,6 +562,15 @@ class InstanceAdminClient {
|
|
|
506
562
|
?.then(([response, options, rawResponse]) => {
|
|
507
563
|
this._log.info('getInstance response %j', response);
|
|
508
564
|
return [response, options, rawResponse];
|
|
565
|
+
})
|
|
566
|
+
.catch((error) => {
|
|
567
|
+
if (error &&
|
|
568
|
+
'statusDetails' in error &&
|
|
569
|
+
error.statusDetails instanceof Array) {
|
|
570
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
571
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
572
|
+
}
|
|
573
|
+
throw error;
|
|
509
574
|
});
|
|
510
575
|
}
|
|
511
576
|
deleteInstance(request, optionsOrCallback, callback) {
|
|
@@ -540,6 +605,15 @@ class InstanceAdminClient {
|
|
|
540
605
|
?.then(([response, options, rawResponse]) => {
|
|
541
606
|
this._log.info('deleteInstance response %j', response);
|
|
542
607
|
return [response, options, rawResponse];
|
|
608
|
+
})
|
|
609
|
+
.catch((error) => {
|
|
610
|
+
if (error &&
|
|
611
|
+
'statusDetails' in error &&
|
|
612
|
+
error.statusDetails instanceof Array) {
|
|
613
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
614
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
615
|
+
}
|
|
616
|
+
throw error;
|
|
543
617
|
});
|
|
544
618
|
}
|
|
545
619
|
setIamPolicy(request, optionsOrCallback, callback) {
|
|
@@ -574,6 +648,15 @@ class InstanceAdminClient {
|
|
|
574
648
|
?.then(([response, options, rawResponse]) => {
|
|
575
649
|
this._log.info('setIamPolicy response %j', response);
|
|
576
650
|
return [response, options, rawResponse];
|
|
651
|
+
})
|
|
652
|
+
.catch((error) => {
|
|
653
|
+
if (error &&
|
|
654
|
+
'statusDetails' in error &&
|
|
655
|
+
error.statusDetails instanceof Array) {
|
|
656
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
657
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
658
|
+
}
|
|
659
|
+
throw error;
|
|
577
660
|
});
|
|
578
661
|
}
|
|
579
662
|
getIamPolicy(request, optionsOrCallback, callback) {
|
|
@@ -608,6 +691,15 @@ class InstanceAdminClient {
|
|
|
608
691
|
?.then(([response, options, rawResponse]) => {
|
|
609
692
|
this._log.info('getIamPolicy response %j', response);
|
|
610
693
|
return [response, options, rawResponse];
|
|
694
|
+
})
|
|
695
|
+
.catch((error) => {
|
|
696
|
+
if (error &&
|
|
697
|
+
'statusDetails' in error &&
|
|
698
|
+
error.statusDetails instanceof Array) {
|
|
699
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
700
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
701
|
+
}
|
|
702
|
+
throw error;
|
|
611
703
|
});
|
|
612
704
|
}
|
|
613
705
|
testIamPermissions(request, optionsOrCallback, callback) {
|
|
@@ -642,6 +734,15 @@ class InstanceAdminClient {
|
|
|
642
734
|
?.then(([response, options, rawResponse]) => {
|
|
643
735
|
this._log.info('testIamPermissions response %j', response);
|
|
644
736
|
return [response, options, rawResponse];
|
|
737
|
+
})
|
|
738
|
+
.catch((error) => {
|
|
739
|
+
if (error &&
|
|
740
|
+
'statusDetails' in error &&
|
|
741
|
+
error.statusDetails instanceof Array) {
|
|
742
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
743
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
744
|
+
}
|
|
745
|
+
throw error;
|
|
645
746
|
});
|
|
646
747
|
}
|
|
647
748
|
getInstancePartition(request, optionsOrCallback, callback) {
|
|
@@ -676,6 +777,15 @@ class InstanceAdminClient {
|
|
|
676
777
|
?.then(([response, options, rawResponse]) => {
|
|
677
778
|
this._log.info('getInstancePartition response %j', response);
|
|
678
779
|
return [response, options, rawResponse];
|
|
780
|
+
})
|
|
781
|
+
.catch((error) => {
|
|
782
|
+
if (error &&
|
|
783
|
+
'statusDetails' in error &&
|
|
784
|
+
error.statusDetails instanceof Array) {
|
|
785
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
786
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
787
|
+
}
|
|
788
|
+
throw error;
|
|
679
789
|
});
|
|
680
790
|
}
|
|
681
791
|
deleteInstancePartition(request, optionsOrCallback, callback) {
|
|
@@ -710,6 +820,15 @@ class InstanceAdminClient {
|
|
|
710
820
|
?.then(([response, options, rawResponse]) => {
|
|
711
821
|
this._log.info('deleteInstancePartition response %j', response);
|
|
712
822
|
return [response, options, rawResponse];
|
|
823
|
+
})
|
|
824
|
+
.catch((error) => {
|
|
825
|
+
if (error &&
|
|
826
|
+
'statusDetails' in error &&
|
|
827
|
+
error.statusDetails instanceof Array) {
|
|
828
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
829
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
830
|
+
}
|
|
831
|
+
throw error;
|
|
713
832
|
});
|
|
714
833
|
}
|
|
715
834
|
createInstanceConfig(request, optionsOrCallback, callback) {
|
|
@@ -1931,6 +2050,186 @@ class InstanceAdminClient {
|
|
|
1931
2050
|
this._log.info('listInstancePartitionOperations iterate %j', request);
|
|
1932
2051
|
return this.descriptors.page.listInstancePartitionOperations.asyncIterate(this.innerApiCalls['listInstancePartitionOperations'], request, callSettings);
|
|
1933
2052
|
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Gets the latest state of a long-running operation. Clients can use this
|
|
2055
|
+
* method to poll the operation result at intervals as recommended by the API
|
|
2056
|
+
* service.
|
|
2057
|
+
*
|
|
2058
|
+
* @param {Object} request - The request object that will be sent.
|
|
2059
|
+
* @param {string} request.name - The name of the operation resource.
|
|
2060
|
+
* @param {Object=} options
|
|
2061
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2062
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2063
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
|
|
2064
|
+
* for the details.
|
|
2065
|
+
* @param {function(?Error, ?Object)=} callback
|
|
2066
|
+
* The function which will be called with the result of the API call.
|
|
2067
|
+
*
|
|
2068
|
+
* The second parameter to the callback is an object representing
|
|
2069
|
+
* {@link google.longrunning.Operation | google.longrunning.Operation}.
|
|
2070
|
+
* @return {Promise} - The promise which resolves to an array.
|
|
2071
|
+
* The first element of the array is an object representing
|
|
2072
|
+
* {@link google.longrunning.Operation | google.longrunning.Operation}.
|
|
2073
|
+
* The promise has a method named "cancel" which cancels the ongoing API call.
|
|
2074
|
+
*
|
|
2075
|
+
* @example
|
|
2076
|
+
* ```
|
|
2077
|
+
* const client = longrunning.operationsClient();
|
|
2078
|
+
* const name = '';
|
|
2079
|
+
* const [response] = await client.getOperation({name});
|
|
2080
|
+
* // doThingsWith(response)
|
|
2081
|
+
* ```
|
|
2082
|
+
*/
|
|
2083
|
+
getOperation(request, optionsOrCallback, callback) {
|
|
2084
|
+
let options;
|
|
2085
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2086
|
+
callback = optionsOrCallback;
|
|
2087
|
+
options = {};
|
|
2088
|
+
}
|
|
2089
|
+
else {
|
|
2090
|
+
options = optionsOrCallback;
|
|
2091
|
+
}
|
|
2092
|
+
options = options || {};
|
|
2093
|
+
options.otherArgs = options.otherArgs || {};
|
|
2094
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2095
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2096
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2097
|
+
name: request.name ?? '',
|
|
2098
|
+
});
|
|
2099
|
+
return this.operationsClient.getOperation(request, options, callback);
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Lists operations that match the specified filter in the request. If the
|
|
2103
|
+
* server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
|
|
2104
|
+
*
|
|
2105
|
+
* For-await-of syntax is used with the iterable to recursively get response element on-demand.
|
|
2106
|
+
*
|
|
2107
|
+
* @param {Object} request - The request object that will be sent.
|
|
2108
|
+
* @param {string} request.name - The name of the operation collection.
|
|
2109
|
+
* @param {string} request.filter - The standard list filter.
|
|
2110
|
+
* @param {number=} request.pageSize -
|
|
2111
|
+
* The maximum number of resources contained in the underlying API
|
|
2112
|
+
* response. If page streaming is performed per-resource, this
|
|
2113
|
+
* parameter does not affect the return value. If page streaming is
|
|
2114
|
+
* performed per-page, this determines the maximum number of
|
|
2115
|
+
* resources in a page.
|
|
2116
|
+
* @param {Object=} options
|
|
2117
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2118
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2119
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
|
|
2120
|
+
* details.
|
|
2121
|
+
* @returns {Object}
|
|
2122
|
+
* An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
|
|
2123
|
+
*
|
|
2124
|
+
* @example
|
|
2125
|
+
* ```
|
|
2126
|
+
* const client = longrunning.operationsClient();
|
|
2127
|
+
* for await (const response of client.listOperationsAsync(request));
|
|
2128
|
+
* // doThingsWith(response)
|
|
2129
|
+
* ```
|
|
2130
|
+
*/
|
|
2131
|
+
listOperationsAsync(request, options) {
|
|
2132
|
+
options = options || {};
|
|
2133
|
+
options.otherArgs = options.otherArgs || {};
|
|
2134
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2135
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2136
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2137
|
+
name: request.name ?? '',
|
|
2138
|
+
});
|
|
2139
|
+
return this.operationsClient.listOperationsAsync(request, options);
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Starts asynchronous cancellation on a long-running operation. The server
|
|
2143
|
+
* makes a best effort to cancel the operation, but success is not
|
|
2144
|
+
* guaranteed. If the server doesn't support this method, it returns
|
|
2145
|
+
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
|
2146
|
+
* {@link Operations.GetOperation} or
|
|
2147
|
+
* other methods to check whether the cancellation succeeded or whether the
|
|
2148
|
+
* operation completed despite cancellation. On successful cancellation,
|
|
2149
|
+
* the operation is not deleted; instead, it becomes an operation with
|
|
2150
|
+
* an {@link Operation.error} value with a {@link google.rpc.Status.code} of
|
|
2151
|
+
* 1, corresponding to `Code.CANCELLED`.
|
|
2152
|
+
*
|
|
2153
|
+
* @param {Object} request - The request object that will be sent.
|
|
2154
|
+
* @param {string} request.name - The name of the operation resource to be cancelled.
|
|
2155
|
+
* @param {Object=} options
|
|
2156
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2157
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2158
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
|
|
2159
|
+
* details.
|
|
2160
|
+
* @param {function(?Error)=} callback
|
|
2161
|
+
* The function which will be called with the result of the API call.
|
|
2162
|
+
* @return {Promise} - The promise which resolves when API call finishes.
|
|
2163
|
+
* The promise has a method named "cancel" which cancels the ongoing API
|
|
2164
|
+
* call.
|
|
2165
|
+
*
|
|
2166
|
+
* @example
|
|
2167
|
+
* ```
|
|
2168
|
+
* const client = longrunning.operationsClient();
|
|
2169
|
+
* await client.cancelOperation({name: ''});
|
|
2170
|
+
* ```
|
|
2171
|
+
*/
|
|
2172
|
+
cancelOperation(request, optionsOrCallback, callback) {
|
|
2173
|
+
let options;
|
|
2174
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2175
|
+
callback = optionsOrCallback;
|
|
2176
|
+
options = {};
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
options = optionsOrCallback;
|
|
2180
|
+
}
|
|
2181
|
+
options = options || {};
|
|
2182
|
+
options.otherArgs = options.otherArgs || {};
|
|
2183
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2184
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2185
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2186
|
+
name: request.name ?? '',
|
|
2187
|
+
});
|
|
2188
|
+
return this.operationsClient.cancelOperation(request, options, callback);
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Deletes a long-running operation. This method indicates that the client is
|
|
2192
|
+
* no longer interested in the operation result. It does not cancel the
|
|
2193
|
+
* operation. If the server doesn't support this method, it returns
|
|
2194
|
+
* `google.rpc.Code.UNIMPLEMENTED`.
|
|
2195
|
+
*
|
|
2196
|
+
* @param {Object} request - The request object that will be sent.
|
|
2197
|
+
* @param {string} request.name - The name of the operation resource to be deleted.
|
|
2198
|
+
* @param {Object=} options
|
|
2199
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2200
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2201
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
|
|
2202
|
+
* for the details.
|
|
2203
|
+
* @param {function(?Error)=} callback
|
|
2204
|
+
* The function which will be called with the result of the API call.
|
|
2205
|
+
* @return {Promise} - The promise which resolves when API call finishes.
|
|
2206
|
+
* The promise has a method named "cancel" which cancels the ongoing API
|
|
2207
|
+
* call.
|
|
2208
|
+
*
|
|
2209
|
+
* @example
|
|
2210
|
+
* ```
|
|
2211
|
+
* const client = longrunning.operationsClient();
|
|
2212
|
+
* await client.deleteOperation({name: ''});
|
|
2213
|
+
* ```
|
|
2214
|
+
*/
|
|
2215
|
+
deleteOperation(request, optionsOrCallback, callback) {
|
|
2216
|
+
let options;
|
|
2217
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2218
|
+
callback = optionsOrCallback;
|
|
2219
|
+
options = {};
|
|
2220
|
+
}
|
|
2221
|
+
else {
|
|
2222
|
+
options = optionsOrCallback;
|
|
2223
|
+
}
|
|
2224
|
+
options = options || {};
|
|
2225
|
+
options.otherArgs = options.otherArgs || {};
|
|
2226
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2227
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2228
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2229
|
+
name: request.name ?? '',
|
|
2230
|
+
});
|
|
2231
|
+
return this.operationsClient.deleteOperation(request, options, callback);
|
|
2232
|
+
}
|
|
1934
2233
|
// --------------------
|
|
1935
2234
|
// -- Path templates --
|
|
1936
2235
|
// --------------------
|
|
@@ -357,6 +357,15 @@ class SpannerClient {
|
|
|
357
357
|
?.then(([response, options, rawResponse]) => {
|
|
358
358
|
this._log.info('createSession response %j', response);
|
|
359
359
|
return [response, options, rawResponse];
|
|
360
|
+
})
|
|
361
|
+
.catch((error) => {
|
|
362
|
+
if (error &&
|
|
363
|
+
'statusDetails' in error &&
|
|
364
|
+
error.statusDetails instanceof Array) {
|
|
365
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
366
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
367
|
+
}
|
|
368
|
+
throw error;
|
|
360
369
|
});
|
|
361
370
|
}
|
|
362
371
|
batchCreateSessions(request, optionsOrCallback, callback) {
|
|
@@ -391,6 +400,15 @@ class SpannerClient {
|
|
|
391
400
|
?.then(([response, options, rawResponse]) => {
|
|
392
401
|
this._log.info('batchCreateSessions response %j', response);
|
|
393
402
|
return [response, options, rawResponse];
|
|
403
|
+
})
|
|
404
|
+
.catch((error) => {
|
|
405
|
+
if (error &&
|
|
406
|
+
'statusDetails' in error &&
|
|
407
|
+
error.statusDetails instanceof Array) {
|
|
408
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
409
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
410
|
+
}
|
|
411
|
+
throw error;
|
|
394
412
|
});
|
|
395
413
|
}
|
|
396
414
|
getSession(request, optionsOrCallback, callback) {
|
|
@@ -425,6 +443,15 @@ class SpannerClient {
|
|
|
425
443
|
?.then(([response, options, rawResponse]) => {
|
|
426
444
|
this._log.info('getSession response %j', response);
|
|
427
445
|
return [response, options, rawResponse];
|
|
446
|
+
})
|
|
447
|
+
.catch((error) => {
|
|
448
|
+
if (error &&
|
|
449
|
+
'statusDetails' in error &&
|
|
450
|
+
error.statusDetails instanceof Array) {
|
|
451
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
452
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
453
|
+
}
|
|
454
|
+
throw error;
|
|
428
455
|
});
|
|
429
456
|
}
|
|
430
457
|
deleteSession(request, optionsOrCallback, callback) {
|
|
@@ -459,6 +486,15 @@ class SpannerClient {
|
|
|
459
486
|
?.then(([response, options, rawResponse]) => {
|
|
460
487
|
this._log.info('deleteSession response %j', response);
|
|
461
488
|
return [response, options, rawResponse];
|
|
489
|
+
})
|
|
490
|
+
.catch((error) => {
|
|
491
|
+
if (error &&
|
|
492
|
+
'statusDetails' in error &&
|
|
493
|
+
error.statusDetails instanceof Array) {
|
|
494
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
495
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
496
|
+
}
|
|
497
|
+
throw error;
|
|
462
498
|
});
|
|
463
499
|
}
|
|
464
500
|
executeSql(request, optionsOrCallback, callback) {
|
|
@@ -493,6 +529,15 @@ class SpannerClient {
|
|
|
493
529
|
?.then(([response, options, rawResponse]) => {
|
|
494
530
|
this._log.info('executeSql response %j', response);
|
|
495
531
|
return [response, options, rawResponse];
|
|
532
|
+
})
|
|
533
|
+
.catch((error) => {
|
|
534
|
+
if (error &&
|
|
535
|
+
'statusDetails' in error &&
|
|
536
|
+
error.statusDetails instanceof Array) {
|
|
537
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
538
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
539
|
+
}
|
|
540
|
+
throw error;
|
|
496
541
|
});
|
|
497
542
|
}
|
|
498
543
|
executeBatchDml(request, optionsOrCallback, callback) {
|
|
@@ -527,6 +572,15 @@ class SpannerClient {
|
|
|
527
572
|
?.then(([response, options, rawResponse]) => {
|
|
528
573
|
this._log.info('executeBatchDml response %j', response);
|
|
529
574
|
return [response, options, rawResponse];
|
|
575
|
+
})
|
|
576
|
+
.catch((error) => {
|
|
577
|
+
if (error &&
|
|
578
|
+
'statusDetails' in error &&
|
|
579
|
+
error.statusDetails instanceof Array) {
|
|
580
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
581
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
582
|
+
}
|
|
583
|
+
throw error;
|
|
530
584
|
});
|
|
531
585
|
}
|
|
532
586
|
read(request, optionsOrCallback, callback) {
|
|
@@ -561,6 +615,15 @@ class SpannerClient {
|
|
|
561
615
|
?.then(([response, options, rawResponse]) => {
|
|
562
616
|
this._log.info('read response %j', response);
|
|
563
617
|
return [response, options, rawResponse];
|
|
618
|
+
})
|
|
619
|
+
.catch((error) => {
|
|
620
|
+
if (error &&
|
|
621
|
+
'statusDetails' in error &&
|
|
622
|
+
error.statusDetails instanceof Array) {
|
|
623
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
624
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
625
|
+
}
|
|
626
|
+
throw error;
|
|
564
627
|
});
|
|
565
628
|
}
|
|
566
629
|
beginTransaction(request, optionsOrCallback, callback) {
|
|
@@ -595,6 +658,15 @@ class SpannerClient {
|
|
|
595
658
|
?.then(([response, options, rawResponse]) => {
|
|
596
659
|
this._log.info('beginTransaction response %j', response);
|
|
597
660
|
return [response, options, rawResponse];
|
|
661
|
+
})
|
|
662
|
+
.catch((error) => {
|
|
663
|
+
if (error &&
|
|
664
|
+
'statusDetails' in error &&
|
|
665
|
+
error.statusDetails instanceof Array) {
|
|
666
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
667
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
668
|
+
}
|
|
669
|
+
throw error;
|
|
598
670
|
});
|
|
599
671
|
}
|
|
600
672
|
commit(request, optionsOrCallback, callback) {
|
|
@@ -629,6 +701,15 @@ class SpannerClient {
|
|
|
629
701
|
?.then(([response, options, rawResponse]) => {
|
|
630
702
|
this._log.info('commit response %j', response);
|
|
631
703
|
return [response, options, rawResponse];
|
|
704
|
+
})
|
|
705
|
+
.catch((error) => {
|
|
706
|
+
if (error &&
|
|
707
|
+
'statusDetails' in error &&
|
|
708
|
+
error.statusDetails instanceof Array) {
|
|
709
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
710
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
711
|
+
}
|
|
712
|
+
throw error;
|
|
632
713
|
});
|
|
633
714
|
}
|
|
634
715
|
rollback(request, optionsOrCallback, callback) {
|
|
@@ -663,6 +744,15 @@ class SpannerClient {
|
|
|
663
744
|
?.then(([response, options, rawResponse]) => {
|
|
664
745
|
this._log.info('rollback response %j', response);
|
|
665
746
|
return [response, options, rawResponse];
|
|
747
|
+
})
|
|
748
|
+
.catch((error) => {
|
|
749
|
+
if (error &&
|
|
750
|
+
'statusDetails' in error &&
|
|
751
|
+
error.statusDetails instanceof Array) {
|
|
752
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
753
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
754
|
+
}
|
|
755
|
+
throw error;
|
|
666
756
|
});
|
|
667
757
|
}
|
|
668
758
|
partitionQuery(request, optionsOrCallback, callback) {
|
|
@@ -697,6 +787,15 @@ class SpannerClient {
|
|
|
697
787
|
?.then(([response, options, rawResponse]) => {
|
|
698
788
|
this._log.info('partitionQuery response %j', response);
|
|
699
789
|
return [response, options, rawResponse];
|
|
790
|
+
})
|
|
791
|
+
.catch((error) => {
|
|
792
|
+
if (error &&
|
|
793
|
+
'statusDetails' in error &&
|
|
794
|
+
error.statusDetails instanceof Array) {
|
|
795
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
796
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
797
|
+
}
|
|
798
|
+
throw error;
|
|
700
799
|
});
|
|
701
800
|
}
|
|
702
801
|
partitionRead(request, optionsOrCallback, callback) {
|
|
@@ -731,6 +830,15 @@ class SpannerClient {
|
|
|
731
830
|
?.then(([response, options, rawResponse]) => {
|
|
732
831
|
this._log.info('partitionRead response %j', response);
|
|
733
832
|
return [response, options, rawResponse];
|
|
833
|
+
})
|
|
834
|
+
.catch((error) => {
|
|
835
|
+
if (error &&
|
|
836
|
+
'statusDetails' in error &&
|
|
837
|
+
error.statusDetails instanceof Array) {
|
|
838
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
839
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
840
|
+
}
|
|
841
|
+
throw error;
|
|
734
842
|
});
|
|
735
843
|
}
|
|
736
844
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-cloud/spanner",
|
|
3
3
|
"description": "Cloud Spanner Client Library for Node.js",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.1.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Google Inc.",
|
|
7
7
|
"engines": {
|
|
@@ -55,13 +55,18 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@google-cloud/common": "^6.0.0",
|
|
58
|
+
"@google-cloud/monitoring": "^5.0.0",
|
|
59
|
+
"@google-cloud/opentelemetry-resource-util": "^2.4.0",
|
|
58
60
|
"@google-cloud/precise-date": "^5.0.0",
|
|
59
61
|
"@google-cloud/projectify": "^5.0.0",
|
|
60
62
|
"@google-cloud/promisify": "^5.0.0",
|
|
63
|
+
"@grpc/grpc-js": "^1.13.2",
|
|
61
64
|
"@grpc/proto-loader": "^0.7.13",
|
|
62
65
|
"@opentelemetry/api": "^1.9.0",
|
|
63
66
|
"@opentelemetry/context-async-hooks": "^2.0.0",
|
|
64
67
|
"@opentelemetry/core": "^2.0.0",
|
|
68
|
+
"@opentelemetry/resources": "^1.8.0",
|
|
69
|
+
"@opentelemetry/sdk-metrics": "^1.30.1",
|
|
65
70
|
"@opentelemetry/semantic-conventions": "^1.30.0",
|
|
66
71
|
"@types/big.js": "^6.2.2",
|
|
67
72
|
"@types/stack-trace": "^0.0.33",
|
|
@@ -71,9 +76,8 @@
|
|
|
71
76
|
"events-intercept": "^2.0.0",
|
|
72
77
|
"extend": "^3.0.2",
|
|
73
78
|
"google-auth-library": "^10.0.0-rc.1",
|
|
74
|
-
"google-gax": "
|
|
79
|
+
"google-gax": "5.0.0",
|
|
75
80
|
"grpc-gcp": "^1.0.1",
|
|
76
|
-
"is": "^3.3.0",
|
|
77
81
|
"lodash.snakecase": "^4.1.1",
|
|
78
82
|
"merge-stream": "^2.0.0",
|
|
79
83
|
"p-queue": "^6.0.2",
|
|
@@ -83,7 +87,10 @@
|
|
|
83
87
|
"stack-trace": "0.0.10",
|
|
84
88
|
"stream-events": "^1.0.5",
|
|
85
89
|
"teeny-request": "^10.0.0",
|
|
86
|
-
"through2": "^4.0.2"
|
|
90
|
+
"through2": "^4.0.2",
|
|
91
|
+
"@babel/traverse": "7.27.7",
|
|
92
|
+
"@babel/core": "7.27.7",
|
|
93
|
+
"@babel/helpers": "7.27.6"
|
|
87
94
|
},
|
|
88
95
|
"devDependencies": {
|
|
89
96
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
@@ -121,7 +128,7 @@
|
|
|
121
128
|
"p-limit": "^3.0.1",
|
|
122
129
|
"path-to-regexp": "^8.2.0",
|
|
123
130
|
"proxyquire": "^2.1.3",
|
|
124
|
-
"sinon": "^
|
|
131
|
+
"sinon": "^21.0.0",
|
|
125
132
|
"stats-lite": "^2.2.0",
|
|
126
133
|
"time-span": "4.0.0",
|
|
127
134
|
"tmp": "^0.2.3",
|