@google-cloud/spanner 5.16.2 → 5.18.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/CHANGELOG.md +43 -0
- package/README.md +25 -12
- package/build/protos/google/spanner/admin/database/v1/backup.proto +177 -9
- package/build/protos/google/spanner/admin/database/v1/common.proto +14 -2
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +40 -5
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +8 -5
- package/build/protos/google/spanner/v1/commit_response.proto +2 -4
- package/build/protos/google/spanner/v1/keys.proto +0 -1
- package/build/protos/google/spanner/v1/mutation.proto +5 -5
- package/build/protos/google/spanner/v1/query_plan.proto +18 -19
- package/build/protos/google/spanner/v1/result_set.proto +1 -1
- package/build/protos/google/spanner/v1/spanner.proto +21 -19
- package/build/protos/google/spanner/v1/transaction.proto +19 -32
- package/build/protos/google/spanner/v1/type.proto +33 -7
- package/build/protos/protos.d.ts +463 -64
- package/build/protos/protos.js +1267 -182
- package/build/protos/protos.json +221 -21
- package/build/src/backup.d.ts +22 -4
- package/build/src/backup.js +60 -29
- package/build/src/codec.d.ts +11 -0
- package/build/src/codec.js +41 -3
- package/build/src/database.d.ts +1 -1
- package/build/src/database.js +2 -2
- package/build/src/index.d.ts +20 -5
- package/build/src/index.js +26 -7
- package/build/src/instance.d.ts +44 -5
- package/build/src/instance.js +61 -6
- package/build/src/partial-result-stream.js +3 -0
- package/build/src/session-pool.d.ts +4 -4
- package/build/src/session-pool.js +6 -6
- package/build/src/transaction.js +1 -1
- package/build/src/v1/database_admin_client.d.ts +175 -10
- package/build/src/v1/database_admin_client.js +113 -11
- package/build/src/v1/database_admin_client_config.json +5 -0
- package/build/src/v1/instance_admin_client.js +2 -3
- package/build/src/v1/spanner_client.d.ts +1 -31
- package/build/src/v1/spanner_client.js +11 -9
- package/package.json +4 -4
|
@@ -130,7 +130,7 @@ export declare class SpannerClient {
|
|
|
130
130
|
* @param {string} request.database
|
|
131
131
|
* Required. The database in which the new session is created.
|
|
132
132
|
* @param {google.spanner.v1.Session} request.session
|
|
133
|
-
* The session to create.
|
|
133
|
+
* Required. The session to create.
|
|
134
134
|
* @param {object} [options]
|
|
135
135
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
136
136
|
* @returns {Promise} - The promise which resolves to an array.
|
|
@@ -138,8 +138,6 @@ export declare class SpannerClient {
|
|
|
138
138
|
* Please see the
|
|
139
139
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
140
140
|
* for more details and examples.
|
|
141
|
-
* @example <caption>include:samples/generated/v1/spanner.create_session.js</caption>
|
|
142
|
-
* region_tag:spanner_v1_generated_Spanner_CreateSession_async
|
|
143
141
|
*/
|
|
144
142
|
createSession(request?: protos.google.spanner.v1.ICreateSessionRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ISession, protos.google.spanner.v1.ICreateSessionRequest | undefined, {} | undefined]>;
|
|
145
143
|
createSession(request: protos.google.spanner.v1.ICreateSessionRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.ISession, protos.google.spanner.v1.ICreateSessionRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -169,8 +167,6 @@ export declare class SpannerClient {
|
|
|
169
167
|
* Please see the
|
|
170
168
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
171
169
|
* for more details and examples.
|
|
172
|
-
* @example <caption>include:samples/generated/v1/spanner.batch_create_sessions.js</caption>
|
|
173
|
-
* region_tag:spanner_v1_generated_Spanner_BatchCreateSessions_async
|
|
174
170
|
*/
|
|
175
171
|
batchCreateSessions(request?: protos.google.spanner.v1.IBatchCreateSessionsRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IBatchCreateSessionsResponse, protos.google.spanner.v1.IBatchCreateSessionsRequest | undefined, {} | undefined]>;
|
|
176
172
|
batchCreateSessions(request: protos.google.spanner.v1.IBatchCreateSessionsRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.IBatchCreateSessionsResponse, protos.google.spanner.v1.IBatchCreateSessionsRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -191,8 +187,6 @@ export declare class SpannerClient {
|
|
|
191
187
|
* Please see the
|
|
192
188
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
193
189
|
* for more details and examples.
|
|
194
|
-
* @example <caption>include:samples/generated/v1/spanner.get_session.js</caption>
|
|
195
|
-
* region_tag:spanner_v1_generated_Spanner_GetSession_async
|
|
196
190
|
*/
|
|
197
191
|
getSession(request?: protos.google.spanner.v1.IGetSessionRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ISession, protos.google.spanner.v1.IGetSessionRequest | undefined, {} | undefined]>;
|
|
198
192
|
getSession(request: protos.google.spanner.v1.IGetSessionRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.ISession, protos.google.spanner.v1.IGetSessionRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -213,8 +207,6 @@ export declare class SpannerClient {
|
|
|
213
207
|
* Please see the
|
|
214
208
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
215
209
|
* for more details and examples.
|
|
216
|
-
* @example <caption>include:samples/generated/v1/spanner.delete_session.js</caption>
|
|
217
|
-
* region_tag:spanner_v1_generated_Spanner_DeleteSession_async
|
|
218
210
|
*/
|
|
219
211
|
deleteSession(request?: protos.google.spanner.v1.IDeleteSessionRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.spanner.v1.IDeleteSessionRequest | undefined, {} | undefined]>;
|
|
220
212
|
deleteSession(request: protos.google.spanner.v1.IDeleteSessionRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.spanner.v1.IDeleteSessionRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -310,8 +302,6 @@ export declare class SpannerClient {
|
|
|
310
302
|
* Please see the
|
|
311
303
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
312
304
|
* for more details and examples.
|
|
313
|
-
* @example <caption>include:samples/generated/v1/spanner.execute_sql.js</caption>
|
|
314
|
-
* region_tag:spanner_v1_generated_Spanner_ExecuteSql_async
|
|
315
305
|
*/
|
|
316
306
|
executeSql(request?: protos.google.spanner.v1.IExecuteSqlRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IExecuteSqlRequest | undefined, {} | undefined]>;
|
|
317
307
|
executeSql(request: protos.google.spanner.v1.IExecuteSqlRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IExecuteSqlRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -364,8 +354,6 @@ export declare class SpannerClient {
|
|
|
364
354
|
* Please see the
|
|
365
355
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
366
356
|
* for more details and examples.
|
|
367
|
-
* @example <caption>include:samples/generated/v1/spanner.execute_batch_dml.js</caption>
|
|
368
|
-
* region_tag:spanner_v1_generated_Spanner_ExecuteBatchDml_async
|
|
369
357
|
*/
|
|
370
358
|
executeBatchDml(request?: protos.google.spanner.v1.IExecuteBatchDmlRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IExecuteBatchDmlResponse, protos.google.spanner.v1.IExecuteBatchDmlRequest | undefined, {} | undefined]>;
|
|
371
359
|
executeBatchDml(request: protos.google.spanner.v1.IExecuteBatchDmlRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.IExecuteBatchDmlResponse, protos.google.spanner.v1.IExecuteBatchDmlRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -439,8 +427,6 @@ export declare class SpannerClient {
|
|
|
439
427
|
* Please see the
|
|
440
428
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
441
429
|
* for more details and examples.
|
|
442
|
-
* @example <caption>include:samples/generated/v1/spanner.read.js</caption>
|
|
443
|
-
* region_tag:spanner_v1_generated_Spanner_Read_async
|
|
444
430
|
*/
|
|
445
431
|
read(request?: protos.google.spanner.v1.IReadRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IReadRequest | undefined, {} | undefined]>;
|
|
446
432
|
read(request: protos.google.spanner.v1.IReadRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IReadRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -470,8 +456,6 @@ export declare class SpannerClient {
|
|
|
470
456
|
* Please see the
|
|
471
457
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
472
458
|
* for more details and examples.
|
|
473
|
-
* @example <caption>include:samples/generated/v1/spanner.begin_transaction.js</caption>
|
|
474
|
-
* region_tag:spanner_v1_generated_Spanner_BeginTransaction_async
|
|
475
459
|
*/
|
|
476
460
|
beginTransaction(request?: protos.google.spanner.v1.IBeginTransactionRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ITransaction, protos.google.spanner.v1.IBeginTransactionRequest | undefined, {} | undefined]>;
|
|
477
461
|
beginTransaction(request: protos.google.spanner.v1.IBeginTransactionRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.ITransaction, protos.google.spanner.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -525,8 +509,6 @@ export declare class SpannerClient {
|
|
|
525
509
|
* Please see the
|
|
526
510
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
527
511
|
* for more details and examples.
|
|
528
|
-
* @example <caption>include:samples/generated/v1/spanner.commit.js</caption>
|
|
529
|
-
* region_tag:spanner_v1_generated_Spanner_Commit_async
|
|
530
512
|
*/
|
|
531
513
|
commit(request?: protos.google.spanner.v1.ICommitRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ICommitResponse, protos.google.spanner.v1.ICommitRequest | undefined, {} | undefined]>;
|
|
532
514
|
commit(request: protos.google.spanner.v1.ICommitRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.ICommitResponse, protos.google.spanner.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -554,8 +536,6 @@ export declare class SpannerClient {
|
|
|
554
536
|
* Please see the
|
|
555
537
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
556
538
|
* for more details and examples.
|
|
557
|
-
* @example <caption>include:samples/generated/v1/spanner.rollback.js</caption>
|
|
558
|
-
* region_tag:spanner_v1_generated_Spanner_Rollback_async
|
|
559
539
|
*/
|
|
560
540
|
rollback(request?: protos.google.spanner.v1.IRollbackRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.spanner.v1.IRollbackRequest | undefined, {} | undefined]>;
|
|
561
541
|
rollback(request: protos.google.spanner.v1.IRollbackRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.spanner.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -622,8 +602,6 @@ export declare class SpannerClient {
|
|
|
622
602
|
* Please see the
|
|
623
603
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
624
604
|
* for more details and examples.
|
|
625
|
-
* @example <caption>include:samples/generated/v1/spanner.partition_query.js</caption>
|
|
626
|
-
* region_tag:spanner_v1_generated_Spanner_PartitionQuery_async
|
|
627
605
|
*/
|
|
628
606
|
partitionQuery(request?: protos.google.spanner.v1.IPartitionQueryRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionQueryRequest | undefined, {} | undefined]>;
|
|
629
607
|
partitionQuery(request: protos.google.spanner.v1.IPartitionQueryRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionQueryRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -676,8 +654,6 @@ export declare class SpannerClient {
|
|
|
676
654
|
* Please see the
|
|
677
655
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
|
|
678
656
|
* for more details and examples.
|
|
679
|
-
* @example <caption>include:samples/generated/v1/spanner.partition_read.js</caption>
|
|
680
|
-
* region_tag:spanner_v1_generated_Spanner_PartitionRead_async
|
|
681
657
|
*/
|
|
682
658
|
partitionRead(request?: protos.google.spanner.v1.IPartitionReadRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionReadRequest | undefined, {} | undefined]>;
|
|
683
659
|
partitionRead(request: protos.google.spanner.v1.IPartitionReadRequest, options: CallOptions, callback: Callback<protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionReadRequest | null | undefined, {} | null | undefined>): void;
|
|
@@ -767,8 +743,6 @@ export declare class SpannerClient {
|
|
|
767
743
|
* Please see the
|
|
768
744
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
|
|
769
745
|
* for more details and examples.
|
|
770
|
-
* @example <caption>include:samples/generated/v1/spanner.execute_streaming_sql.js</caption>
|
|
771
|
-
* region_tag:spanner_v1_generated_Spanner_ExecuteStreamingSql_async
|
|
772
746
|
*/
|
|
773
747
|
executeStreamingSql(request?: protos.google.spanner.v1.IExecuteSqlRequest, options?: CallOptions): gax.CancellableStream;
|
|
774
748
|
/**
|
|
@@ -832,8 +806,6 @@ export declare class SpannerClient {
|
|
|
832
806
|
* Please see the
|
|
833
807
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
|
|
834
808
|
* for more details and examples.
|
|
835
|
-
* @example <caption>include:samples/generated/v1/spanner.streaming_read.js</caption>
|
|
836
|
-
* region_tag:spanner_v1_generated_Spanner_StreamingRead_async
|
|
837
809
|
*/
|
|
838
810
|
streamingRead(request?: protos.google.spanner.v1.IReadRequest, options?: CallOptions): gax.CancellableStream;
|
|
839
811
|
/**
|
|
@@ -950,8 +922,6 @@ export declare class SpannerClient {
|
|
|
950
922
|
* Please see the
|
|
951
923
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
|
|
952
924
|
* for more details and examples.
|
|
953
|
-
* @example <caption>include:samples/generated/v1/spanner.list_sessions.js</caption>
|
|
954
|
-
* region_tag:spanner_v1_generated_Spanner_ListSessions_async
|
|
955
925
|
*/
|
|
956
926
|
listSessionsAsync(request?: protos.google.spanner.v1.IListSessionsRequest, options?: CallOptions): AsyncIterable<protos.google.spanner.v1.ISession>;
|
|
957
927
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2022 Google LLC
|
|
3
3
|
//
|
|
4
4
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
// you may not use this file except in compliance with the License.
|
|
@@ -20,6 +20,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.SpannerClient = void 0;
|
|
21
21
|
/* global window */
|
|
22
22
|
const gax = require("google-gax");
|
|
23
|
+
const google_gax_1 = require("google-gax");
|
|
24
|
+
const stream_1 = require("stream");
|
|
23
25
|
const jsonProtos = require("../../protos/protos.json");
|
|
24
26
|
/**
|
|
25
27
|
* Client JSON configuration object, loaded from
|
|
@@ -199,6 +201,13 @@ class SpannerClient {
|
|
|
199
201
|
for (const methodName of spannerStubMethods) {
|
|
200
202
|
const callPromise = this.spannerStub.then(stub => (...args) => {
|
|
201
203
|
if (this._terminated) {
|
|
204
|
+
if (methodName in this.descriptors.stream) {
|
|
205
|
+
const stream = new stream_1.PassThrough();
|
|
206
|
+
setImmediate(() => {
|
|
207
|
+
stream.emit('error', new google_gax_1.GoogleError('The client has already been closed.'));
|
|
208
|
+
});
|
|
209
|
+
return stream;
|
|
210
|
+
}
|
|
202
211
|
return Promise.reject('The client has already been closed.');
|
|
203
212
|
}
|
|
204
213
|
const func = stub[methodName];
|
|
@@ -583,8 +592,6 @@ class SpannerClient {
|
|
|
583
592
|
* Please see the
|
|
584
593
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
|
|
585
594
|
* for more details and examples.
|
|
586
|
-
* @example <caption>include:samples/generated/v1/spanner.execute_streaming_sql.js</caption>
|
|
587
|
-
* region_tag:spanner_v1_generated_Spanner_ExecuteStreamingSql_async
|
|
588
595
|
*/
|
|
589
596
|
executeStreamingSql(request, options) {
|
|
590
597
|
request = request || {};
|
|
@@ -659,8 +666,6 @@ class SpannerClient {
|
|
|
659
666
|
* Please see the
|
|
660
667
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
|
|
661
668
|
* for more details and examples.
|
|
662
|
-
* @example <caption>include:samples/generated/v1/spanner.streaming_read.js</caption>
|
|
663
|
-
* region_tag:spanner_v1_generated_Spanner_StreamingRead_async
|
|
664
669
|
*/
|
|
665
670
|
streamingRead(request, options) {
|
|
666
671
|
request = request || {};
|
|
@@ -780,8 +785,6 @@ class SpannerClient {
|
|
|
780
785
|
* Please see the
|
|
781
786
|
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
|
|
782
787
|
* for more details and examples.
|
|
783
|
-
* @example <caption>include:samples/generated/v1/spanner.list_sessions.js</caption>
|
|
784
|
-
* region_tag:spanner_v1_generated_Spanner_ListSessions_async
|
|
785
788
|
*/
|
|
786
789
|
listSessionsAsync(request, options) {
|
|
787
790
|
request = request || {};
|
|
@@ -909,8 +912,7 @@ class SpannerClient {
|
|
|
909
912
|
* @returns {Promise} A promise that resolves when the client is closed.
|
|
910
913
|
*/
|
|
911
914
|
close() {
|
|
912
|
-
this.
|
|
913
|
-
if (!this._terminated) {
|
|
915
|
+
if (this.spannerStub && !this._terminated) {
|
|
914
916
|
return this.spannerStub.then(stub => {
|
|
915
917
|
this._terminated = true;
|
|
916
918
|
stub.close();
|
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": "5.
|
|
4
|
+
"version": "5.18.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Google Inc.",
|
|
7
7
|
"engines": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"events-intercept": "^2.0.0",
|
|
63
63
|
"extend": "^3.0.2",
|
|
64
64
|
"google-auth-library": "^7.0.0",
|
|
65
|
-
"google-gax": "^2.
|
|
65
|
+
"google-gax": "^2.29.3",
|
|
66
66
|
"grpc-gcp": "^0.3.2",
|
|
67
67
|
"is": "^3.2.1",
|
|
68
68
|
"lodash.snakecase": "^4.1.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@grpc/proto-loader": "^0.6.0",
|
|
79
|
-
"@types/concat-stream": "^
|
|
79
|
+
"@types/concat-stream": "^2.0.0",
|
|
80
80
|
"@types/extend": "^3.0.0",
|
|
81
81
|
"@types/is": "0.0.21",
|
|
82
82
|
"@types/lodash.snakecase": "^4.1.4",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"p-limit": "^3.0.1",
|
|
109
109
|
"proxyquire": "^2.0.1",
|
|
110
110
|
"retry-request": "^4.1.1",
|
|
111
|
-
"sinon": "^
|
|
111
|
+
"sinon": "^13.0.0",
|
|
112
112
|
"stats-lite": "^2.1.1",
|
|
113
113
|
"teeny-request": "^7.0.0",
|
|
114
114
|
"time-span": "^4.0.0",
|