@google-cloud/spanner 5.16.1 → 5.17.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 (35) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +16 -18
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +4 -1
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +14 -1
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +14 -4
  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 +3 -3
  8. package/build/protos/google/spanner/v1/keys.proto +1 -1
  9. package/build/protos/google/spanner/v1/mutation.proto +6 -5
  10. package/build/protos/google/spanner/v1/query_plan.proto +19 -19
  11. package/build/protos/google/spanner/v1/result_set.proto +2 -1
  12. package/build/protos/google/spanner/v1/spanner.proto +21 -19
  13. package/build/protos/google/spanner/v1/transaction.proto +20 -32
  14. package/build/protos/google/spanner/v1/type.proto +34 -7
  15. package/build/protos/protos.d.ts +382 -345
  16. package/build/protos/protos.js +1022 -837
  17. package/build/protos/protos.json +168 -108
  18. package/build/src/codec.js +2 -1
  19. package/build/src/database.d.ts +1 -1
  20. package/build/src/database.js +2 -2
  21. package/build/src/index.d.ts +3 -3
  22. package/build/src/index.js +7 -7
  23. package/build/src/instance.d.ts +4 -4
  24. package/build/src/instance.js +6 -5
  25. package/build/src/partial-result-stream.d.ts +1 -1
  26. package/build/src/partial-result-stream.js +5 -1
  27. package/build/src/session-pool.d.ts +4 -4
  28. package/build/src/session-pool.js +6 -6
  29. package/build/src/transaction.js +1 -1
  30. package/build/src/v1/database_admin_client.d.ts +9 -4
  31. package/build/src/v1/database_admin_client.js +7 -7
  32. package/build/src/v1/instance_admin_client.js +2 -3
  33. package/build/src/v1/spanner_client.d.ts +1 -31
  34. package/build/src/v1/spanner_client.js +11 -9
  35. package/package.json +4 -4
@@ -20,7 +20,7 @@ import { Database } from './database';
20
20
  import { Session, types } from './session';
21
21
  import { Transaction } from './transaction';
22
22
  import { NormalCallback } from './common';
23
- import { grpc } from 'google-gax';
23
+ import { GoogleError, grpc } from 'google-gax';
24
24
  import trace = require('stack-trace');
25
25
  /**
26
26
  * @callback SessionPoolCloseCallback
@@ -142,7 +142,7 @@ export interface SessionPoolOptions {
142
142
  *
143
143
  * @private
144
144
  */
145
- export declare class ReleaseError extends Error {
145
+ export declare class ReleaseError extends GoogleError {
146
146
  resource: unknown;
147
147
  constructor(resource: unknown);
148
148
  }
@@ -151,14 +151,14 @@ export declare class ReleaseError extends Error {
151
151
  *
152
152
  * @private
153
153
  */
154
- export declare class SessionLeakError extends Error {
154
+ export declare class SessionLeakError extends GoogleError {
155
155
  messages: string[];
156
156
  constructor(leaks: string[]);
157
157
  }
158
158
  /**
159
159
  * Error to be thrown when the session pool is exhausted.
160
160
  */
161
- export declare class SessionPoolExhaustedError extends Error {
161
+ export declare class SessionPoolExhaustedError extends GoogleError {
162
162
  messages: string[];
163
163
  constructor(leaks: string[]);
164
164
  }
@@ -39,7 +39,7 @@ const DEFAULTS = {
39
39
  *
40
40
  * @private
41
41
  */
42
- class ReleaseError extends Error {
42
+ class ReleaseError extends google_gax_1.GoogleError {
43
43
  constructor(resource) {
44
44
  super('Unable to release unknown resource.');
45
45
  this.resource = resource;
@@ -51,7 +51,7 @@ exports.ReleaseError = ReleaseError;
51
51
  *
52
52
  * @private
53
53
  */
54
- class SessionLeakError extends Error {
54
+ class SessionLeakError extends google_gax_1.GoogleError {
55
55
  constructor(leaks) {
56
56
  super(`${leaks.length} session leak(s) detected.`);
57
57
  // Restore error name that was overwritten by the super constructor call.
@@ -63,7 +63,7 @@ exports.SessionLeakError = SessionLeakError;
63
63
  /**
64
64
  * Error to be thrown when the session pool is exhausted.
65
65
  */
66
- class SessionPoolExhaustedError extends Error {
66
+ class SessionPoolExhaustedError extends google_gax_1.GoogleError {
67
67
  constructor(leaks) {
68
68
  super("No resources available." /* Exhausted */);
69
69
  // Restore error name that was overwritten by the super constructor call.
@@ -435,7 +435,7 @@ class SessionPool extends events_1.EventEmitter {
435
435
  */
436
436
  async _acquire(type) {
437
437
  if (!this.isOpen) {
438
- throw new Error("Database is closed." /* Closed */);
438
+ throw new google_gax_1.GoogleError("Database is closed." /* Closed */);
439
439
  }
440
440
  // Get the stacktrace of the caller before we call any async methods, as calling an async method will break the stacktrace.
441
441
  const frames = trace.get();
@@ -446,7 +446,7 @@ class SessionPool extends events_1.EventEmitter {
446
446
  const getSession = async () => {
447
447
  const elapsed = Date.now() - startTime;
448
448
  if (elapsed >= timeout) {
449
- throw new Error("Timeout occurred while acquiring session." /* Timeout */);
449
+ throw new google_gax_1.GoogleError("Timeout occurred while acquiring session." /* Timeout */);
450
450
  }
451
451
  const session = await this._getSession(type, startTime);
452
452
  if (this._isValidSession(session)) {
@@ -706,7 +706,7 @@ class SessionPool extends events_1.EventEmitter {
706
706
  const availableEvent = type + '-available';
707
707
  const promises = [
708
708
  this._onClose.then(() => {
709
- throw new Error("Database is closed." /* Closed */);
709
+ throw new google_gax_1.GoogleError("Database is closed." /* Closed */);
710
710
  }),
711
711
  new Promise(resolve => {
712
712
  this.once(availableEvent, resolve);
@@ -1312,7 +1312,7 @@ class Transaction extends Dml {
1312
1312
  const keys = Object.keys(row);
1313
1313
  const missingColumns = columns.filter(column => !keys.includes(column));
1314
1314
  if (missingColumns.length > 0) {
1315
- throw new Error([
1315
+ throw new google_gax_1.GoogleError([
1316
1316
  `Row at index ${index} does not contain the correct number of columns.`,
1317
1317
  `Missing columns: ${JSON.stringify(missingColumns)}`,
1318
1318
  ].join('\n\n'));
@@ -6,10 +6,11 @@ import * as protos from '../../protos/protos';
6
6
  /**
7
7
  * Cloud Spanner Database Admin API
8
8
  *
9
- * The Cloud Spanner Database Admin API can be used to create, drop, and
10
- * list databases. It also enables updating the schema of pre-existing
11
- * databases. It can be also used to create, delete and list backups for a
12
- * database and to restore from an existing backup.
9
+ * The Cloud Spanner Database Admin API can be used to:
10
+ * * create, drop, and list databases
11
+ * * update the schema of pre-existing databases
12
+ * * create, delete and list backups for a database
13
+ * * restore a database from an existing backup
13
14
  * @class
14
15
  * @memberof v1
15
16
  */
@@ -132,6 +133,8 @@ export declare class DatabaseAdminClient {
132
133
  * Drops (aka deletes) a Cloud Spanner database.
133
134
  * Completed backups for the database will be retained according to their
134
135
  * `expire_time`.
136
+ * Note: Cloud Spanner might continue to accept requests for a few seconds
137
+ * after the database has been deleted.
135
138
  *
136
139
  * @param {Object} request
137
140
  * The request object that will be sent.
@@ -375,6 +378,8 @@ export declare class DatabaseAdminClient {
375
378
  * Optional. The encryption configuration for the database. If this field is not
376
379
  * specified, Cloud Spanner will encrypt/decrypt all data at rest using
377
380
  * Google default encryption.
381
+ * @param {google.spanner.admin.database.v1.DatabaseDialect} [request.databaseDialect]
382
+ * Optional. The dialect of the Cloud Spanner Database.
378
383
  * @param {object} [options]
379
384
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
380
385
  * @returns {Promise} - The promise which resolves to an array.
@@ -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.
@@ -32,10 +32,11 @@ const version = require('../../../package.json').version;
32
32
  /**
33
33
  * Cloud Spanner Database Admin API
34
34
  *
35
- * The Cloud Spanner Database Admin API can be used to create, drop, and
36
- * list databases. It also enables updating the schema of pre-existing
37
- * databases. It can be also used to create, delete and list backups for a
38
- * database and to restore from an existing backup.
35
+ * The Cloud Spanner Database Admin API can be used to:
36
+ * * create, drop, and list databases
37
+ * * update the schema of pre-existing databases
38
+ * * create, delete and list backups for a database
39
+ * * restore a database from an existing backup
39
40
  * @class
40
41
  * @memberof v1
41
42
  */
@@ -1462,8 +1463,7 @@ class DatabaseAdminClient {
1462
1463
  * @returns {Promise} A promise that resolves when the client is closed.
1463
1464
  */
1464
1465
  close() {
1465
- this.initialize();
1466
- if (!this._terminated) {
1466
+ if (this.databaseAdminStub && !this._terminated) {
1467
1467
  return this.databaseAdminStub.then(stub => {
1468
1468
  this._terminated = true;
1469
1469
  stub.close();
@@ -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.
@@ -826,8 +826,7 @@ class InstanceAdminClient {
826
826
  * @returns {Promise} A promise that resolves when the client is closed.
827
827
  */
828
828
  close() {
829
- this.initialize();
830
- if (!this._terminated) {
829
+ if (this.instanceAdminStub && !this._terminated) {
831
830
  return this.instanceAdminStub.then(stub => {
832
831
  this._terminated = true;
833
832
  stub.close();
@@ -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 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
@@ -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,7 +1,7 @@
1
1
  {
2
2
  "name": "@google-cloud/spanner",
3
3
  "description": "Cloud Spanner Client Library for Node.js",
4
- "version": "5.16.1",
4
+ "version": "5.17.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.17.1",
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": "^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",
@@ -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": "^12.0.0",
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",