@google-cloud/spanner 5.16.3 → 6.0.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +28 -12
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +177 -9
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +14 -2
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +40 -5
  6. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +8 -5
  7. package/build/protos/google/spanner/v1/commit_response.proto +2 -4
  8. package/build/protos/google/spanner/v1/keys.proto +0 -1
  9. package/build/protos/google/spanner/v1/mutation.proto +5 -5
  10. package/build/protos/google/spanner/v1/query_plan.proto +18 -19
  11. package/build/protos/google/spanner/v1/result_set.proto +1 -1
  12. package/build/protos/google/spanner/v1/spanner.proto +21 -19
  13. package/build/protos/google/spanner/v1/transaction.proto +19 -32
  14. package/build/protos/google/spanner/v1/type.proto +33 -7
  15. package/build/protos/protos.d.ts +684 -64
  16. package/build/protos/protos.js +1760 -84
  17. package/build/protos/protos.json +273 -21
  18. package/build/src/backup.d.ts +27 -5
  19. package/build/src/backup.js +62 -31
  20. package/build/src/batch-transaction.js +1 -1
  21. package/build/src/codec.d.ts +11 -0
  22. package/build/src/codec.js +39 -2
  23. package/build/src/common-grpc/service-object.js +1 -1
  24. package/build/src/common-grpc/service.js +2 -2
  25. package/build/src/database.d.ts +26 -6
  26. package/build/src/database.js +8 -8
  27. package/build/src/index.d.ts +18 -3
  28. package/build/src/index.js +26 -7
  29. package/build/src/instance.d.ts +42 -2
  30. package/build/src/instance.js +56 -2
  31. package/build/src/session-pool.d.ts +1 -0
  32. package/build/src/session-pool.js +46 -46
  33. package/build/src/session.js +1 -1
  34. package/build/src/table.d.ts +5 -1
  35. package/build/src/table.js +1 -1
  36. package/build/src/transaction-runner.js +3 -3
  37. package/build/src/transaction.d.ts +10 -2
  38. package/build/src/transaction.js +12 -12
  39. package/build/src/v1/database_admin_client.d.ts +271 -28
  40. package/build/src/v1/database_admin_client.js +113 -11
  41. package/build/src/v1/database_admin_client_config.json +5 -0
  42. package/build/src/v1/index.js +1 -0
  43. package/build/src/v1/instance_admin_client.d.ts +57 -11
  44. package/build/src/v1/instance_admin_client.js +2 -3
  45. package/build/src/v1/spanner_client.d.ts +66 -44
  46. package/build/src/v1/spanner_client.js +13 -11
  47. package/package.json +11 -11
@@ -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,10 +138,12 @@ 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
- createSession(request?: protos.google.spanner.v1.ICreateSessionRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ISession, protos.google.spanner.v1.ICreateSessionRequest | undefined, {} | undefined]>;
142
+ createSession(request?: protos.google.spanner.v1.ICreateSessionRequest, options?: CallOptions): Promise<[
143
+ protos.google.spanner.v1.ISession,
144
+ protos.google.spanner.v1.ICreateSessionRequest | undefined,
145
+ {} | undefined
146
+ ]>;
145
147
  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;
146
148
  createSession(request: protos.google.spanner.v1.ICreateSessionRequest, callback: Callback<protos.google.spanner.v1.ISession, protos.google.spanner.v1.ICreateSessionRequest | null | undefined, {} | null | undefined>): void;
147
149
  /**
@@ -169,10 +171,12 @@ export declare class SpannerClient {
169
171
  * Please see the
170
172
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
171
173
  * 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
174
  */
175
- batchCreateSessions(request?: protos.google.spanner.v1.IBatchCreateSessionsRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IBatchCreateSessionsResponse, protos.google.spanner.v1.IBatchCreateSessionsRequest | undefined, {} | undefined]>;
175
+ batchCreateSessions(request?: protos.google.spanner.v1.IBatchCreateSessionsRequest, options?: CallOptions): Promise<[
176
+ protos.google.spanner.v1.IBatchCreateSessionsResponse,
177
+ protos.google.spanner.v1.IBatchCreateSessionsRequest | undefined,
178
+ {} | undefined
179
+ ]>;
176
180
  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;
177
181
  batchCreateSessions(request: protos.google.spanner.v1.IBatchCreateSessionsRequest, callback: Callback<protos.google.spanner.v1.IBatchCreateSessionsResponse, protos.google.spanner.v1.IBatchCreateSessionsRequest | null | undefined, {} | null | undefined>): void;
178
182
  /**
@@ -191,10 +195,12 @@ export declare class SpannerClient {
191
195
  * Please see the
192
196
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
193
197
  * 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
198
  */
197
- getSession(request?: protos.google.spanner.v1.IGetSessionRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ISession, protos.google.spanner.v1.IGetSessionRequest | undefined, {} | undefined]>;
199
+ getSession(request?: protos.google.spanner.v1.IGetSessionRequest, options?: CallOptions): Promise<[
200
+ protos.google.spanner.v1.ISession,
201
+ protos.google.spanner.v1.IGetSessionRequest | undefined,
202
+ {} | undefined
203
+ ]>;
198
204
  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;
199
205
  getSession(request: protos.google.spanner.v1.IGetSessionRequest, callback: Callback<protos.google.spanner.v1.ISession, protos.google.spanner.v1.IGetSessionRequest | null | undefined, {} | null | undefined>): void;
200
206
  /**
@@ -213,10 +219,12 @@ export declare class SpannerClient {
213
219
  * Please see the
214
220
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
215
221
  * 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
222
  */
219
- deleteSession(request?: protos.google.spanner.v1.IDeleteSessionRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.spanner.v1.IDeleteSessionRequest | undefined, {} | undefined]>;
223
+ deleteSession(request?: protos.google.spanner.v1.IDeleteSessionRequest, options?: CallOptions): Promise<[
224
+ protos.google.protobuf.IEmpty,
225
+ protos.google.spanner.v1.IDeleteSessionRequest | undefined,
226
+ {} | undefined
227
+ ]>;
220
228
  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;
221
229
  deleteSession(request: protos.google.spanner.v1.IDeleteSessionRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.spanner.v1.IDeleteSessionRequest | null | undefined, {} | null | undefined>): void;
222
230
  /**
@@ -310,10 +318,12 @@ export declare class SpannerClient {
310
318
  * Please see the
311
319
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
312
320
  * 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
321
  */
316
- executeSql(request?: protos.google.spanner.v1.IExecuteSqlRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IExecuteSqlRequest | undefined, {} | undefined]>;
322
+ executeSql(request?: protos.google.spanner.v1.IExecuteSqlRequest, options?: CallOptions): Promise<[
323
+ protos.google.spanner.v1.IResultSet,
324
+ protos.google.spanner.v1.IExecuteSqlRequest | undefined,
325
+ {} | undefined
326
+ ]>;
317
327
  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;
318
328
  executeSql(request: protos.google.spanner.v1.IExecuteSqlRequest, callback: Callback<protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IExecuteSqlRequest | null | undefined, {} | null | undefined>): void;
319
329
  /**
@@ -364,10 +374,12 @@ export declare class SpannerClient {
364
374
  * Please see the
365
375
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
366
376
  * 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
377
  */
370
- executeBatchDml(request?: protos.google.spanner.v1.IExecuteBatchDmlRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IExecuteBatchDmlResponse, protos.google.spanner.v1.IExecuteBatchDmlRequest | undefined, {} | undefined]>;
378
+ executeBatchDml(request?: protos.google.spanner.v1.IExecuteBatchDmlRequest, options?: CallOptions): Promise<[
379
+ protos.google.spanner.v1.IExecuteBatchDmlResponse,
380
+ protos.google.spanner.v1.IExecuteBatchDmlRequest | undefined,
381
+ {} | undefined
382
+ ]>;
371
383
  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;
372
384
  executeBatchDml(request: protos.google.spanner.v1.IExecuteBatchDmlRequest, callback: Callback<protos.google.spanner.v1.IExecuteBatchDmlResponse, protos.google.spanner.v1.IExecuteBatchDmlRequest | null | undefined, {} | null | undefined>): void;
373
385
  /**
@@ -439,10 +451,12 @@ export declare class SpannerClient {
439
451
  * Please see the
440
452
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
441
453
  * 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
454
  */
445
- read(request?: protos.google.spanner.v1.IReadRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IReadRequest | undefined, {} | undefined]>;
455
+ read(request?: protos.google.spanner.v1.IReadRequest, options?: CallOptions): Promise<[
456
+ protos.google.spanner.v1.IResultSet,
457
+ protos.google.spanner.v1.IReadRequest | undefined,
458
+ {} | undefined
459
+ ]>;
446
460
  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;
447
461
  read(request: protos.google.spanner.v1.IReadRequest, callback: Callback<protos.google.spanner.v1.IResultSet, protos.google.spanner.v1.IReadRequest | null | undefined, {} | null | undefined>): void;
448
462
  /**
@@ -470,10 +484,12 @@ export declare class SpannerClient {
470
484
  * Please see the
471
485
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
472
486
  * 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
487
  */
476
- beginTransaction(request?: protos.google.spanner.v1.IBeginTransactionRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ITransaction, protos.google.spanner.v1.IBeginTransactionRequest | undefined, {} | undefined]>;
488
+ beginTransaction(request?: protos.google.spanner.v1.IBeginTransactionRequest, options?: CallOptions): Promise<[
489
+ protos.google.spanner.v1.ITransaction,
490
+ protos.google.spanner.v1.IBeginTransactionRequest | undefined,
491
+ {} | undefined
492
+ ]>;
477
493
  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;
478
494
  beginTransaction(request: protos.google.spanner.v1.IBeginTransactionRequest, callback: Callback<protos.google.spanner.v1.ITransaction, protos.google.spanner.v1.IBeginTransactionRequest | null | undefined, {} | null | undefined>): void;
479
495
  /**
@@ -525,10 +541,12 @@ export declare class SpannerClient {
525
541
  * Please see the
526
542
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
527
543
  * 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
544
  */
531
- commit(request?: protos.google.spanner.v1.ICommitRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ICommitResponse, protos.google.spanner.v1.ICommitRequest | undefined, {} | undefined]>;
545
+ commit(request?: protos.google.spanner.v1.ICommitRequest, options?: CallOptions): Promise<[
546
+ protos.google.spanner.v1.ICommitResponse,
547
+ protos.google.spanner.v1.ICommitRequest | undefined,
548
+ {} | undefined
549
+ ]>;
532
550
  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;
533
551
  commit(request: protos.google.spanner.v1.ICommitRequest, callback: Callback<protos.google.spanner.v1.ICommitResponse, protos.google.spanner.v1.ICommitRequest | null | undefined, {} | null | undefined>): void;
534
552
  /**
@@ -554,10 +572,12 @@ export declare class SpannerClient {
554
572
  * Please see the
555
573
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
556
574
  * 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
575
  */
560
- rollback(request?: protos.google.spanner.v1.IRollbackRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.spanner.v1.IRollbackRequest | undefined, {} | undefined]>;
576
+ rollback(request?: protos.google.spanner.v1.IRollbackRequest, options?: CallOptions): Promise<[
577
+ protos.google.protobuf.IEmpty,
578
+ protos.google.spanner.v1.IRollbackRequest | undefined,
579
+ {} | undefined
580
+ ]>;
561
581
  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;
562
582
  rollback(request: protos.google.spanner.v1.IRollbackRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.spanner.v1.IRollbackRequest | null | undefined, {} | null | undefined>): void;
563
583
  /**
@@ -622,10 +642,12 @@ export declare class SpannerClient {
622
642
  * Please see the
623
643
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
624
644
  * 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
645
  */
628
- partitionQuery(request?: protos.google.spanner.v1.IPartitionQueryRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionQueryRequest | undefined, {} | undefined]>;
646
+ partitionQuery(request?: protos.google.spanner.v1.IPartitionQueryRequest, options?: CallOptions): Promise<[
647
+ protos.google.spanner.v1.IPartitionResponse,
648
+ protos.google.spanner.v1.IPartitionQueryRequest | undefined,
649
+ {} | undefined
650
+ ]>;
629
651
  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;
630
652
  partitionQuery(request: protos.google.spanner.v1.IPartitionQueryRequest, callback: Callback<protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionQueryRequest | null | undefined, {} | null | undefined>): void;
631
653
  /**
@@ -676,10 +698,12 @@ export declare class SpannerClient {
676
698
  * Please see the
677
699
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
678
700
  * 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
701
  */
682
- partitionRead(request?: protos.google.spanner.v1.IPartitionReadRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionReadRequest | undefined, {} | undefined]>;
702
+ partitionRead(request?: protos.google.spanner.v1.IPartitionReadRequest, options?: CallOptions): Promise<[
703
+ protos.google.spanner.v1.IPartitionResponse,
704
+ protos.google.spanner.v1.IPartitionReadRequest | undefined,
705
+ {} | undefined
706
+ ]>;
683
707
  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;
684
708
  partitionRead(request: protos.google.spanner.v1.IPartitionReadRequest, callback: Callback<protos.google.spanner.v1.IPartitionResponse, protos.google.spanner.v1.IPartitionReadRequest | null | undefined, {} | null | undefined>): void;
685
709
  /**
@@ -767,8 +791,6 @@ export declare class SpannerClient {
767
791
  * Please see the
768
792
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
769
793
  * 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
794
  */
773
795
  executeStreamingSql(request?: protos.google.spanner.v1.IExecuteSqlRequest, options?: CallOptions): gax.CancellableStream;
774
796
  /**
@@ -832,8 +854,6 @@ export declare class SpannerClient {
832
854
  * Please see the
833
855
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
834
856
  * 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
857
  */
838
858
  streamingRead(request?: protos.google.spanner.v1.IReadRequest, options?: CallOptions): gax.CancellableStream;
839
859
  /**
@@ -874,7 +894,11 @@ export declare class SpannerClient {
874
894
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
875
895
  * for more details and examples.
876
896
  */
877
- listSessions(request?: protos.google.spanner.v1.IListSessionsRequest, options?: CallOptions): Promise<[protos.google.spanner.v1.ISession[], protos.google.spanner.v1.IListSessionsRequest | null, protos.google.spanner.v1.IListSessionsResponse]>;
897
+ listSessions(request?: protos.google.spanner.v1.IListSessionsRequest, options?: CallOptions): Promise<[
898
+ protos.google.spanner.v1.ISession[],
899
+ protos.google.spanner.v1.IListSessionsRequest | null,
900
+ protos.google.spanner.v1.IListSessionsResponse
901
+ ]>;
878
902
  listSessions(request: protos.google.spanner.v1.IListSessionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.spanner.v1.IListSessionsRequest, protos.google.spanner.v1.IListSessionsResponse | null | undefined, protos.google.spanner.v1.ISession>): void;
879
903
  listSessions(request: protos.google.spanner.v1.IListSessionsRequest, callback: PaginationCallback<protos.google.spanner.v1.IListSessionsRequest, protos.google.spanner.v1.IListSessionsResponse | null | undefined, protos.google.spanner.v1.ISession>): void;
880
904
  /**
@@ -950,8 +974,6 @@ export declare class SpannerClient {
950
974
  * Please see the
951
975
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
952
976
  * 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
977
  */
956
978
  listSessionsAsync(request?: protos.google.spanner.v1.IListSessionsRequest, options?: CallOptions): AsyncIterable<protos.google.spanner.v1.ISession>;
957
979
  /**
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021 Google LLC
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
@@ -143,8 +145,8 @@ class SpannerClient {
143
145
  // Some of the methods on this service provide streaming responses.
144
146
  // Provide descriptors for these.
145
147
  this.descriptors.stream = {
146
- executeStreamingSql: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING),
147
- streamingRead: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING),
148
+ executeStreamingSql: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
149
+ streamingRead: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
148
150
  };
149
151
  // Put together the default options sent with requests.
150
152
  this._defaults = this._gaxGrpc.constructSettings('google.spanner.v1.Spanner', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -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.initialize();
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,11 +1,11 @@
1
1
  {
2
2
  "name": "@google-cloud/spanner",
3
3
  "description": "Cloud Spanner Client Library for Node.js",
4
- "version": "5.16.3",
4
+ "version": "6.0.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Google Inc.",
7
7
  "engines": {
8
- "node": ">=10"
8
+ "node": ">=12.0.0"
9
9
  },
10
10
  "repository": "googleapis/nodejs-spanner",
11
11
  "main": "./build/src/index.js",
@@ -61,9 +61,9 @@
61
61
  "checkpoint-stream": "^0.1.1",
62
62
  "events-intercept": "^2.0.0",
63
63
  "extend": "^3.0.2",
64
- "google-auth-library": "^7.0.0",
65
- "google-gax": "^2.29.3",
66
- "grpc-gcp": "^0.3.2",
64
+ "google-auth-library": "^8.0.2",
65
+ "google-gax": "^3.0.1",
66
+ "grpc-gcp": "^0.4.0",
67
67
  "is": "^3.2.1",
68
68
  "lodash.snakecase": "^4.1.1",
69
69
  "merge-stream": "^2.0.0",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@grpc/proto-loader": "^0.6.0",
79
- "@types/concat-stream": "^1.6.0",
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",
@@ -96,24 +96,24 @@
96
96
  "dedent": "^0.7.0",
97
97
  "duplexify": "^4.1.1",
98
98
  "execa": "^5.0.0",
99
- "gts": "^2.0.0",
99
+ "gts": "^3.1.0",
100
100
  "jsdoc": "^3.6.2",
101
101
  "jsdoc-fresh": "^1.0.1",
102
102
  "jsdoc-region-tag": "^1.0.2",
103
103
  "linkinator": "^2.0.0",
104
104
  "lodash.random": "^3.2.0",
105
- "mocha": "^8.0.0",
105
+ "mocha": "^9.2.2",
106
106
  "mv": "^2.1.1",
107
107
  "ncp": "^2.0.0",
108
108
  "p-limit": "^3.0.1",
109
109
  "proxyquire": "^2.0.1",
110
- "retry-request": "^4.1.1",
111
- "sinon": "^12.0.0",
110
+ "retry-request": "^5.0.0",
111
+ "sinon": "^14.0.0",
112
112
  "stats-lite": "^2.1.1",
113
113
  "teeny-request": "^7.0.0",
114
114
  "time-span": "^4.0.0",
115
115
  "tmp": "^0.2.0",
116
- "typescript": "^3.8.3",
116
+ "typescript": "^4.6.4",
117
117
  "uuid": "^8.0.0",
118
118
  "yargs": "^16.0.0"
119
119
  }