@google-cloud/spanner 7.21.0 → 8.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 (51) hide show
  1. package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
  2. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
  3. package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
  4. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1 -1
  5. package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
  6. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
  7. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
  8. package/build/protos/google/spanner/v1/commit_response.proto +1 -1
  9. package/build/protos/google/spanner/v1/keys.proto +1 -1
  10. package/build/protos/google/spanner/v1/mutation.proto +1 -1
  11. package/build/protos/google/spanner/v1/query_plan.proto +1 -1
  12. package/build/protos/google/spanner/v1/result_set.proto +55 -49
  13. package/build/protos/google/spanner/v1/spanner.proto +1 -1
  14. package/build/protos/google/spanner/v1/transaction.proto +1 -1
  15. package/build/protos/google/spanner/v1/type.proto +1 -1
  16. package/build/protos/protos.d.ts +56 -194
  17. package/build/protos/protos.js +71 -288
  18. package/build/protos/protos.json +8 -2
  19. package/build/src/backup.js +7 -0
  20. package/build/src/batch-transaction.d.ts +48 -29
  21. package/build/src/batch-transaction.js +13 -98
  22. package/build/src/codec.js +43 -26
  23. package/build/src/common-grpc/service-object.js +1 -0
  24. package/build/src/common-grpc/service.js +25 -8
  25. package/build/src/database.js +52 -42
  26. package/build/src/helper.d.ts +9 -0
  27. package/build/src/helper.js +24 -0
  28. package/build/src/index.js +24 -13
  29. package/build/src/instance-config.d.ts +1 -1
  30. package/build/src/instance-config.js +4 -0
  31. package/build/src/instance.js +12 -6
  32. package/build/src/instrument.js +2 -4
  33. package/build/src/multiplexed-session.js +7 -1
  34. package/build/src/partial-result-stream.js +9 -5
  35. package/build/src/request_id_header.js +1 -0
  36. package/build/src/session-factory.js +5 -2
  37. package/build/src/session-pool.js +23 -6
  38. package/build/src/session.d.ts +0 -1
  39. package/build/src/session.js +7 -2
  40. package/build/src/table.js +6 -3
  41. package/build/src/transaction-runner.js +12 -2
  42. package/build/src/transaction.js +66 -52
  43. package/build/src/v1/database_admin_client.d.ts +3 -2
  44. package/build/src/v1/database_admin_client.js +551 -167
  45. package/build/src/v1/instance_admin_client.d.ts +2 -1
  46. package/build/src/v1/instance_admin_client.js +453 -133
  47. package/build/src/v1/spanner_client.d.ts +2 -1
  48. package/build/src/v1/spanner_client.js +283 -85
  49. package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
  50. package/build/src/v1/spanner_executor_proxy_client.js +41 -19
  51. package/package.json +57 -58
@@ -43,6 +43,7 @@ const DEFAULTS = {
43
43
  * @private
44
44
  */
45
45
  class ReleaseError extends google_gax_1.GoogleError {
46
+ resource;
46
47
  constructor(resource) {
47
48
  super('Unable to release unknown resource.');
48
49
  this.resource = resource;
@@ -55,6 +56,7 @@ exports.ReleaseError = ReleaseError;
55
56
  * @private
56
57
  */
57
58
  class SessionLeakError extends google_gax_1.GoogleError {
59
+ messages;
58
60
  constructor(leaks) {
59
61
  super(`${leaks.length} session leak(s) detected.`);
60
62
  // Restore error name that was overwritten by the super constructor call.
@@ -67,6 +69,7 @@ exports.SessionLeakError = SessionLeakError;
67
69
  * Error to be thrown when the session pool is exhausted.
68
70
  */
69
71
  class SessionPoolExhaustedError extends google_gax_1.GoogleError {
72
+ messages;
70
73
  constructor(leaks) {
71
74
  super("No resources available." /* errors.Exhausted */);
72
75
  // Restore error name that was overwritten by the super constructor call.
@@ -95,6 +98,19 @@ function isSessionNotFoundError(error) {
95
98
  * @extends {EventEmitter}
96
99
  */
97
100
  class SessionPool extends events_1.EventEmitter {
101
+ database;
102
+ isOpen;
103
+ options;
104
+ _acquires;
105
+ _evictHandle;
106
+ _inventory;
107
+ _onClose;
108
+ _pending = 0;
109
+ _waiters = 0;
110
+ _pingHandle;
111
+ _requests;
112
+ _traces;
113
+ _observabilityOptions;
98
114
  /**
99
115
  * Formats stack trace objects into Node-like stack trace.
100
116
  *
@@ -186,8 +202,6 @@ class SessionPool extends events_1.EventEmitter {
186
202
  */
187
203
  constructor(database, options) {
188
204
  super();
189
- this._pending = 0;
190
- this._waiters = 0;
191
205
  if (options && options.min && options.max && options.min > options.max) {
192
206
  throw new TypeError('Min sessions may not be greater than max sessions.');
193
207
  }
@@ -227,7 +241,9 @@ class SessionPool extends events_1.EventEmitter {
227
241
  this._stopHouseKeeping();
228
242
  this.emit('close');
229
243
  sessions.forEach(session => this._destroy(session));
230
- this._requests.onIdle().then(() => {
244
+ this._requests
245
+ .onIdle()
246
+ .then(() => {
231
247
  const leaks = this._getLeaks();
232
248
  let error;
233
249
  this._inventory.sessions = [];
@@ -236,7 +252,8 @@ class SessionPool extends events_1.EventEmitter {
236
252
  error = new SessionLeakError(leaks);
237
253
  }
238
254
  callback(error);
239
- });
255
+ })
256
+ .catch(err => callback(err));
240
257
  }
241
258
  /**
242
259
  * Retrieve a read session.
@@ -508,7 +525,7 @@ class SessionPool extends events_1.EventEmitter {
508
525
  }
509
526
  const index = this._inventory.sessions.indexOf(session);
510
527
  this._inventory.sessions.splice(index, 1);
511
- this._destroy(session);
528
+ void this._destroy(session);
512
529
  }
513
530
  }
514
531
  /**
@@ -672,7 +689,7 @@ class SessionPool extends events_1.EventEmitter {
672
689
  }
673
690
  catch (e) {
674
691
  this._inventory.borrowed.delete(session);
675
- this._destroy(session);
692
+ await this._destroy(session);
676
693
  }
677
694
  }
678
695
  /**
@@ -88,7 +88,6 @@ export type DeleteSessionCallback = NormalCallback<google.protobuf.IEmpty>;
88
88
  * ```
89
89
  */
90
90
  export declare class Session extends common.GrpcServiceObject {
91
- id: string;
92
91
  formattedName_?: string;
93
92
  txn?: Transaction;
94
93
  lastUsed?: number;
@@ -67,8 +67,13 @@ const request_id_header_1 = require("./request_id_header");
67
67
  * ```
68
68
  */
69
69
  class Session extends common.GrpcServiceObject {
70
+ formattedName_;
71
+ txn;
72
+ lastUsed;
73
+ lastError;
74
+ commonHeaders_;
75
+ _observabilityOptions;
70
76
  constructor(database, name) {
71
- var _a;
72
77
  const methods = {
73
78
  /**
74
79
  * Create a session.
@@ -201,7 +206,7 @@ class Session extends common.GrpcServiceObject {
201
206
  },
202
207
  });
203
208
  this._observabilityOptions = database._observabilityOptions;
204
- this.commonHeaders_ = (0, common_1.getCommonHeaders)(this.parent.formattedName_, (_a = this._observabilityOptions) === null || _a === void 0 ? void 0 : _a.enableEndToEndTracing);
209
+ this.commonHeaders_ = (0, common_1.getCommonHeaders)(this.parent.formattedName_, this._observabilityOptions?.enableEndToEndTracing);
205
210
  this.request = database.request;
206
211
  this.requestStream = database.requestStream;
207
212
  if (name) {
@@ -43,6 +43,9 @@ const POSTGRESQL = 'POSTGRESQL';
43
43
  * ```
44
44
  */
45
45
  class Table {
46
+ database;
47
+ name;
48
+ _observabilityOptions;
46
49
  constructor(database, name) {
47
50
  /**
48
51
  * The {@link Database} instance of this {@link Table} instance.
@@ -177,7 +180,7 @@ class Table {
177
180
  return performDelete();
178
181
  }
179
182
  else {
180
- performDelete();
183
+ void performDelete();
181
184
  }
182
185
  }
183
186
  deleteRows(keys, optionsOrCallback, cb) {
@@ -235,12 +238,12 @@ class Table {
235
238
  * @param {function} callback The callback function.
236
239
  */
237
240
  _mutate(method, rows, options = {}, callback) {
238
- var _a;
239
241
  const traceConfig = {
240
242
  opts: this._observabilityOptions,
241
243
  tableName: this.name,
242
244
  dbName: this.getDBName(),
243
- transactionTag: (_a = options === null || options === void 0 ? void 0 : options.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag,
245
+ transactionTag: options?.requestOptions
246
+ ?.transactionTag,
244
247
  };
245
248
  (0, instrument_1.startTrace)('Table.' + method, traceConfig, span => {
246
249
  const requestOptions = 'requestOptions' in options ? options.requestOptions : {};
@@ -39,11 +39,15 @@ const RetryInfo = protobufjs_1.Root.fromJSON(jsonProtos).lookup('google.rpc.Retr
39
39
  * @param {Error} [err] The last known retryable Error.
40
40
  */
41
41
  class DeadlineError extends Error {
42
+ code;
43
+ details;
44
+ metadata;
45
+ errors;
42
46
  constructor(error) {
43
47
  super('Deadline for Transaction exceeded.');
44
48
  this.code = google_gax_1.grpc.status.DEADLINE_EXCEEDED;
45
- this.details = (error === null || error === void 0 ? void 0 : error.details) || '';
46
- this.metadata = (error === null || error === void 0 ? void 0 : error.metadata) || new google_gax_1.grpc.Metadata();
49
+ this.details = error?.details || '';
50
+ this.metadata = error?.metadata || new google_gax_1.grpc.Metadata();
47
51
  this.errors = [];
48
52
  if (error) {
49
53
  this.errors.push(error);
@@ -62,6 +66,10 @@ exports.DeadlineError = DeadlineError;
62
66
  * @param {RunTransactionOptions} [options] The runner options.
63
67
  */
64
68
  class Runner {
69
+ attempts;
70
+ session;
71
+ transaction;
72
+ options;
65
73
  constructor(session, transaction, options) {
66
74
  this.attempts = 0;
67
75
  this.session = session;
@@ -179,6 +187,7 @@ exports.Runner = Runner;
179
187
  * @param {RunTransactionOptions} [options] Runner options.
180
188
  */
181
189
  class TransactionRunner extends Runner {
190
+ runFn;
182
191
  constructor(session, transaction, runFn, options) {
183
192
  super(session, transaction, options);
184
193
  this.runFn = runFn;
@@ -250,6 +259,7 @@ exports.TransactionRunner = TransactionRunner;
250
259
  * @param {RunTransactionOptions} [options] Runner options.
251
260
  */
252
261
  class AsyncTransactionRunner extends Runner {
262
+ runFn;
253
263
  constructor(session, transaction, runFn, options) {
254
264
  super(session, transaction, options);
255
265
  this.runFn = runFn;
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PartitionedDml = exports.MutationGroup = exports.MutationSet = exports.Transaction = exports.Dml = exports.Snapshot = void 0;
19
19
  const precise_date_1 = require("@google-cloud/precise-date");
20
20
  const promisify_1 = require("@google-cloud/promisify");
21
- const arrify = require("arrify");
21
+ const helper_1 = require("./helper");
22
22
  const events_1 = require("events");
23
23
  const google_gax_1 = require("google-gax");
24
24
  const is = require("is");
@@ -90,6 +90,25 @@ const RETRY_INFO_BIN = 'google.rpc.retryinfo-bin';
90
90
  * ```
91
91
  */
92
92
  class Snapshot extends events_1.EventEmitter {
93
+ _options;
94
+ _seqno = 1;
95
+ _waitingRequests;
96
+ _inlineBeginStarted;
97
+ _useInRunner = false;
98
+ id;
99
+ ended;
100
+ metadata;
101
+ readTimestamp;
102
+ readTimestampProto;
103
+ request;
104
+ requestStream;
105
+ session;
106
+ queryOptions;
107
+ commonHeaders_;
108
+ requestOptions;
109
+ _observabilityOptions;
110
+ _traceConfig;
111
+ _dbName;
93
112
  /**
94
113
  * The transaction ID.
95
114
  *
@@ -134,10 +153,7 @@ class Snapshot extends events_1.EventEmitter {
134
153
  * are specified for a query.
135
154
  */
136
155
  constructor(session, options, queryOptions) {
137
- var _a;
138
156
  super();
139
- this._seqno = 1;
140
- this._useInRunner = false;
141
157
  this.ended = false;
142
158
  this.session = session;
143
159
  this.queryOptions = Object.assign({}, queryOptions);
@@ -149,14 +165,13 @@ class Snapshot extends events_1.EventEmitter {
149
165
  this._waitingRequests = [];
150
166
  this._inlineBeginStarted = false;
151
167
  this._observabilityOptions = session._observabilityOptions;
152
- this.commonHeaders_ = (0, common_1.getCommonHeaders)(this._dbName, (_a = this._observabilityOptions) === null || _a === void 0 ? void 0 : _a.enableEndToEndTracing);
168
+ this.commonHeaders_ = (0, common_1.getCommonHeaders)(this._dbName, this._observabilityOptions?.enableEndToEndTracing);
153
169
  this._traceConfig = {
154
170
  opts: this._observabilityOptions,
155
171
  dbName: this._dbName,
156
172
  };
157
173
  }
158
174
  begin(gaxOptionsOrCallback, cb) {
159
- var _a;
160
175
  const gaxOpts = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {};
161
176
  const callback = typeof gaxOptionsOrCallback === 'function' ? gaxOptionsOrCallback : cb;
162
177
  const session = this.session.formattedName_;
@@ -179,7 +194,7 @@ class Snapshot extends events_1.EventEmitter {
179
194
  (0, common_1.addLeaderAwareRoutingHeader)(headers);
180
195
  }
181
196
  return (0, instrument_2.startTrace)('Snapshot.begin', {
182
- transactionTag: (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag,
197
+ transactionTag: this.requestOptions?.transactionTag,
183
198
  ...this._traceConfig,
184
199
  }, span => {
185
200
  span.addEvent('Begin Transaction');
@@ -372,7 +387,6 @@ class Snapshot extends events_1.EventEmitter {
372
387
  * ```
373
388
  */
374
389
  createReadStream(table, request = {}) {
375
- var _a, _b, _c;
376
390
  const { gaxOptions, json, jsonOptions, maxResumeRetries, requestOptions, columnsMetadata, } = request;
377
391
  const keySet = Snapshot.encodeKeySet(request);
378
392
  const transaction = {};
@@ -398,7 +412,7 @@ class Snapshot extends events_1.EventEmitter {
398
412
  delete request.columnsMetadata;
399
413
  const reqOpts = Object.assign(request, {
400
414
  session: this.session.formattedName_,
401
- requestOptions: this.configureTagOptions(typeof transaction.singleUse !== 'undefined', (_b = (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag) !== null && _b !== void 0 ? _b : undefined, requestOptions),
415
+ requestOptions: this.configureTagOptions(typeof transaction.singleUse !== 'undefined', this.requestOptions?.transactionTag ?? undefined, requestOptions),
402
416
  directedReadOptions: directedReadOptions,
403
417
  transaction,
404
418
  table,
@@ -413,11 +427,10 @@ class Snapshot extends events_1.EventEmitter {
413
427
  const traceConfig = {
414
428
  ...this._traceConfig,
415
429
  tableName: table,
416
- transactionTag: (_c = this.requestOptions) === null || _c === void 0 ? void 0 : _c.transactionTag,
417
- requestTag: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.requestTag,
430
+ transactionTag: this.requestOptions?.transactionTag,
431
+ requestTag: requestOptions?.requestTag,
418
432
  };
419
433
  return (0, instrument_2.startTrace)('Snapshot.createReadStream', traceConfig, span => {
420
- var _a;
421
434
  let attempt = 0;
422
435
  const database = this.session.parent;
423
436
  const nthRequest = (0, request_id_header_1.nextNthRequest)(database);
@@ -449,33 +462,35 @@ class Snapshot extends events_1.EventEmitter {
449
462
  headers: (0, request_id_header_1.injectRequestIDIntoHeaders)(headers, this.session, nthRequest, attempt),
450
463
  });
451
464
  };
452
- const resultStream = (_a = (0, partial_result_stream_1.partialResultStream)(this._wrapWithIdWaiter(makeRequest), {
465
+ const resultStream = (0, partial_result_stream_1.partialResultStream)(this._wrapWithIdWaiter(makeRequest), {
453
466
  json,
454
467
  jsonOptions,
455
468
  maxResumeRetries,
456
469
  columnsMetadata,
457
470
  gaxOptions,
458
- })) === null || _a === void 0 ? void 0 : _a.on('response', response => {
471
+ })
472
+ ?.on('response', response => {
459
473
  if (response.metadata && response.metadata.transaction && !this.id) {
460
474
  this._update(response.metadata.transaction);
461
475
  }
462
- }).on('error', err => {
463
- var _a;
476
+ })
477
+ .on('error', err => {
464
478
  (0, instrument_2.setSpanError)(span, err);
465
479
  const wasAborted = isErrorAborted(err);
466
480
  if (!this.id && this._useInRunner && !wasAborted) {
467
481
  // TODO: resolve https://github.com/googleapis/nodejs-spanner/issues/2170
468
- this.begin();
482
+ void this.begin();
469
483
  }
470
484
  else {
471
485
  if (wasAborted) {
472
486
  span.addEvent('Stream broken. Not safe to retry', {
473
- 'transaction.id': (_a = this.id) === null || _a === void 0 ? void 0 : _a.toString(),
487
+ 'transaction.id': this.id?.toString(),
474
488
  });
475
489
  }
476
490
  }
477
491
  span.end();
478
- }).on('end', err => {
492
+ })
493
+ .on('end', err => {
479
494
  if (err) {
480
495
  (0, instrument_2.setSpanError)(span, err);
481
496
  }
@@ -704,7 +719,6 @@ class Snapshot extends events_1.EventEmitter {
704
719
  * ```
705
720
  */
706
721
  runStream(query) {
707
- var _a;
708
722
  if (typeof query === 'string') {
709
723
  query = { sql: query };
710
724
  }
@@ -714,7 +728,6 @@ class Snapshot extends events_1.EventEmitter {
714
728
  let reqOpts;
715
729
  const directedReadOptions = this._getDirectedReadOptions(query.directedReadOptions);
716
730
  const sanitizeRequest = () => {
717
- var _a, _b;
718
731
  query = query;
719
732
  const { params, paramTypes } = Snapshot.encodeParams(query);
720
733
  const transaction = {};
@@ -738,7 +751,7 @@ class Snapshot extends events_1.EventEmitter {
738
751
  reqOpts = Object.assign(query, {
739
752
  session: this.session.formattedName_,
740
753
  seqno: this._seqno++,
741
- requestOptions: this.configureTagOptions(typeof transaction.singleUse !== 'undefined', (_b = (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag) !== null && _b !== void 0 ? _b : undefined, requestOptions),
754
+ requestOptions: this.configureTagOptions(typeof transaction.singleUse !== 'undefined', this.requestOptions?.transactionTag ?? undefined, requestOptions),
742
755
  directedReadOptions: directedReadOptions,
743
756
  transaction,
744
757
  params,
@@ -752,8 +765,8 @@ class Snapshot extends events_1.EventEmitter {
752
765
  (0, common_1.addLeaderAwareRoutingHeader)(headers);
753
766
  }
754
767
  const traceConfig = {
755
- transactionTag: (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag,
756
- requestTag: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.requestTag,
768
+ transactionTag: this.requestOptions?.transactionTag,
769
+ requestTag: requestOptions?.requestTag,
757
770
  ...query,
758
771
  ...this._traceConfig,
759
772
  };
@@ -810,18 +823,17 @@ class Snapshot extends events_1.EventEmitter {
810
823
  }
811
824
  })
812
825
  .on('error', err => {
813
- var _a;
814
826
  (0, instrument_2.setSpanError)(span, err);
815
827
  const wasAborted = isErrorAborted(err);
816
828
  if (!this.id && this._useInRunner && !wasAborted) {
817
829
  span.addEvent('Stream broken. Safe to retry');
818
830
  // TODO: resolve https://github.com/googleapis/nodejs-spanner/issues/2170
819
- this.begin();
831
+ void this.begin();
820
832
  }
821
833
  else {
822
834
  if (wasAborted) {
823
835
  span.addEvent('Stream broken. Not safe to retry', {
824
- 'transaction.id': (_a = this.id) === null || _a === void 0 ? void 0 : _a.toString(),
836
+ 'transaction.id': this.id?.toString(),
825
837
  });
826
838
  }
827
839
  }
@@ -866,10 +878,10 @@ class Snapshot extends events_1.EventEmitter {
866
878
  static encodeKeySet(request) {
867
879
  const keySet = request.keySet || {};
868
880
  if (request.keys) {
869
- keySet.keys = arrify(request.keys).map(codec_1.codec.convertToListValue);
881
+ keySet.keys = (0, helper_1.toArray)(request.keys).map(codec_1.codec.convertToListValue);
870
882
  }
871
883
  if (request.ranges) {
872
- keySet.ranges = arrify(request.ranges).map(range => {
884
+ keySet.ranges = (0, helper_1.toArray)(request.ranges).map(range => {
873
885
  const encodedRange = {};
874
886
  Object.keys(range).forEach(bound => {
875
887
  encodedRange[bound] = codec_1.codec.convertToListValue(range[bound]);
@@ -924,9 +936,8 @@ class Snapshot extends events_1.EventEmitter {
924
936
  * @returns {object}
925
937
  */
926
938
  static encodeParams(request) {
927
- var _a;
928
939
  const typeMap = request.types || {};
929
- const params = { fields: ((_a = request.params) === null || _a === void 0 ? void 0 : _a.fields) || {} };
940
+ const params = { fields: request.params?.fields || {} };
930
941
  const paramTypes = request.paramTypes || {};
931
942
  if (request.params && !request.params.fields) {
932
943
  const fields = {};
@@ -1011,7 +1022,7 @@ class Snapshot extends events_1.EventEmitter {
1011
1022
  _releaseWaitingRequests() {
1012
1023
  while (this._waitingRequests.length > 0) {
1013
1024
  const request = this._waitingRequests.shift();
1014
- request === null || request === void 0 ? void 0 : request();
1025
+ request?.();
1015
1026
  }
1016
1027
  }
1017
1028
  /**
@@ -1043,15 +1054,14 @@ exports.Snapshot = Snapshot;
1043
1054
  */
1044
1055
  class Dml extends Snapshot {
1045
1056
  runUpdate(query, callback) {
1046
- var _a, _b;
1047
1057
  if (typeof query === 'string') {
1048
1058
  query = { sql: query };
1049
1059
  }
1050
1060
  return (0, instrument_2.startTrace)('Dml.runUpdate', {
1051
1061
  ...query,
1052
1062
  ...this._traceConfig,
1053
- transactionTag: (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag,
1054
- requestTag: (_b = query.requestOptions) === null || _b === void 0 ? void 0 : _b.requestTag,
1063
+ transactionTag: this.requestOptions?.transactionTag,
1064
+ requestTag: query.requestOptions?.requestTag,
1055
1065
  }, span => {
1056
1066
  this.run(query, (err, rows, stats) => {
1057
1067
  let rowCount = 0;
@@ -1120,6 +1130,9 @@ exports.Dml = Dml;
1120
1130
  * ```
1121
1131
  */
1122
1132
  class Transaction extends Dml {
1133
+ commitTimestamp;
1134
+ commitTimestampProto;
1135
+ _queuedMutations;
1123
1136
  /**
1124
1137
  * Timestamp at which the transaction was committed. Will be populated once
1125
1138
  * {@link Transaction#commit} is called.
@@ -1168,7 +1181,6 @@ class Transaction extends Dml {
1168
1181
  this.requestOptions = requestOptions;
1169
1182
  }
1170
1183
  batchUpdate(queries, optionsOrCallback, cb) {
1171
- var _a, _b, _c;
1172
1184
  const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
1173
1185
  const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
1174
1186
  const gaxOpts = 'gaxOptions' in options
@@ -1199,7 +1211,7 @@ class Transaction extends Dml {
1199
1211
  else {
1200
1212
  transaction.begin = this._options;
1201
1213
  }
1202
- const requestOptionsWithTag = this.configureTagOptions(false, (_b = (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag) !== null && _b !== void 0 ? _b : undefined, options.requestOptions);
1214
+ const requestOptionsWithTag = this.configureTagOptions(false, this.requestOptions?.transactionTag ?? undefined, options.requestOptions);
1203
1215
  const reqOpts = {
1204
1216
  session: this.session.formattedName_,
1205
1217
  requestOptions: requestOptionsWithTag,
@@ -1214,8 +1226,8 @@ class Transaction extends Dml {
1214
1226
  }
1215
1227
  const traceConfig = {
1216
1228
  ...this._traceConfig,
1217
- transactionTag: requestOptionsWithTag === null || requestOptionsWithTag === void 0 ? void 0 : requestOptionsWithTag.transactionTag,
1218
- requestTag: (_c = options === null || options === void 0 ? void 0 : options.requestOptions) === null || _c === void 0 ? void 0 : _c.requestTag,
1229
+ transactionTag: requestOptionsWithTag?.transactionTag,
1230
+ requestTag: options?.requestOptions?.requestTag,
1219
1231
  };
1220
1232
  return (0, instrument_2.startTrace)('Transaction.batchUpdate', traceConfig, span => {
1221
1233
  this.request({
@@ -1225,7 +1237,6 @@ class Transaction extends Dml {
1225
1237
  gaxOpts,
1226
1238
  headers: headers,
1227
1239
  }, (err, resp) => {
1228
- var _a;
1229
1240
  let batchUpdateError;
1230
1241
  if (err) {
1231
1242
  const rowCounts = [];
@@ -1237,7 +1248,7 @@ class Transaction extends Dml {
1237
1248
  }
1238
1249
  const { resultSets, status } = resp;
1239
1250
  for (const resultSet of resultSets) {
1240
- if (!this.id && ((_a = resultSet.metadata) === null || _a === void 0 ? void 0 : _a.transaction)) {
1251
+ if (!this.id && resultSet.metadata?.transaction) {
1241
1252
  this._update(resultSet.metadata.transaction);
1242
1253
  }
1243
1254
  }
@@ -1283,7 +1294,6 @@ class Transaction extends Dml {
1283
1294
  this._queuedMutations = mutation;
1284
1295
  }
1285
1296
  commit(optionsOrCallback, cb) {
1286
- var _a;
1287
1297
  const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
1288
1298
  const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
1289
1299
  const gaxOpts = 'gaxOptions' in options ? options.gaxOptions : options;
@@ -1292,7 +1302,7 @@ class Transaction extends Dml {
1292
1302
  const requestOptions = options.requestOptions;
1293
1303
  const reqOpts = { mutations, session, requestOptions };
1294
1304
  return (0, instrument_2.startTrace)('Transaction.commit', {
1295
- transactionTag: (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag,
1305
+ transactionTag: this.requestOptions?.transactionTag,
1296
1306
  ...this._traceConfig,
1297
1307
  }, span => {
1298
1308
  if (this.id) {
@@ -1388,7 +1398,6 @@ class Transaction extends Dml {
1388
1398
  * @private
1389
1399
  */
1390
1400
  static decoratePossibleJsonMismatchError(err, mutations) {
1391
- var _a, _b;
1392
1401
  const errorMessage = /Invalid value for column (?<column>.+) in table (?<table>.+): Expected JSON./;
1393
1402
  const found = err.message && err.message.match(errorMessage);
1394
1403
  if (found && found.groups) {
@@ -1400,10 +1409,10 @@ class Transaction extends Dml {
1400
1409
  mutation.insertOrUpdate ||
1401
1410
  mutation.replace;
1402
1411
  if (write && write.table === table) {
1403
- const index = (_a = write.columns) === null || _a === void 0 ? void 0 : _a.indexOf(column);
1412
+ const index = write.columns?.indexOf(column);
1404
1413
  if (index && index > -1 && write.values) {
1405
1414
  for (const row of write.values) {
1406
- if (((_b = row.values) === null || _b === void 0 ? void 0 : _b.length) &&
1415
+ if (row.values?.length &&
1407
1416
  row.values.length > index &&
1408
1417
  row.values[index].listValue) {
1409
1418
  // If the value is an array, the client library also encoded it as
@@ -1751,21 +1760,21 @@ class Transaction extends Dml {
1751
1760
  /**
1752
1761
  * Set optimistic concurrency control for the transaction.
1753
1762
  */
1754
- if (options === null || options === void 0 ? void 0 : options.optimisticLock) {
1763
+ if (options?.optimisticLock) {
1755
1764
  this._options.readWrite.readLockMode = ReadLockMode.OPTIMISTIC;
1756
1765
  }
1757
1766
  /**
1758
1767
  * Set option excludeTxnFromChangeStreams=true to exclude read/write transactions
1759
1768
  * from being tracked in change streams.
1760
1769
  */
1761
- if (options === null || options === void 0 ? void 0 : options.excludeTxnFromChangeStreams) {
1770
+ if (options?.excludeTxnFromChangeStreams) {
1762
1771
  this._options.excludeTxnFromChangeStreams = true;
1763
1772
  }
1764
1773
  /**
1765
1774
  * Set isolation level .
1766
1775
  */
1767
- this._options.isolationLevel = (options === null || options === void 0 ? void 0 : options.isolationLevel)
1768
- ? options === null || options === void 0 ? void 0 : options.isolationLevel
1776
+ this._options.isolationLevel = options?.isolationLevel
1777
+ ? options?.isolationLevel
1769
1778
  : this._getSpanner().defaultTransactionOptions.isolationLevel;
1770
1779
  }
1771
1780
  }
@@ -1788,7 +1797,7 @@ exports.Transaction = Transaction;
1788
1797
  * @throws {GoogleError} - If a row does not contain the correct number of columns.
1789
1798
  */
1790
1799
  function buildMutation(method, table, keyVals) {
1791
- const rows = arrify(keyVals);
1800
+ const rows = (0, helper_1.toArray)(keyVals);
1792
1801
  const columns = Transaction.getUniqueKeys(rows);
1793
1802
  const values = rows.map((row, index) => {
1794
1803
  const keys = Object.keys(row);
@@ -1816,7 +1825,7 @@ function buildMutation(method, table, keyVals) {
1816
1825
  */
1817
1826
  function buildDeleteMutation(table, keys) {
1818
1827
  const keySet = {
1819
- keys: arrify(keys).map(codec_1.codec.convertToListValue),
1828
+ keys: (0, helper_1.toArray)(keys).map(codec_1.codec.convertToListValue),
1820
1829
  };
1821
1830
  const mutation = {
1822
1831
  delete: { table, keySet },
@@ -1857,6 +1866,10 @@ function buildDeleteMutation(table, keys) {
1857
1866
  * ```
1858
1867
  */
1859
1868
  class MutationSet {
1869
+ /**
1870
+ * An array to store the mutations.
1871
+ */
1872
+ _queuedMutations;
1860
1873
  /**
1861
1874
  * Creates a new Mutation object.
1862
1875
  */
@@ -1948,6 +1961,7 @@ exports.MutationSet = MutationSet;
1948
1961
  * ```
1949
1962
  */
1950
1963
  class MutationGroup {
1964
+ _proto;
1951
1965
  constructor() {
1952
1966
  this._proto =
1953
1967
  new protos_1.google.spanner.v1.BatchWriteRequest.MutationGroup();
@@ -23,6 +23,7 @@ export declare class DatabaseAdminClient {
23
23
  private _defaults;
24
24
  private _universeDomain;
25
25
  private _servicePath;
26
+ private _log;
26
27
  auth: gax.GoogleAuth;
27
28
  descriptors: Descriptors;
28
29
  warn: (code: string, message: string, warnType?: string) => void;
@@ -58,7 +59,7 @@ export declare class DatabaseAdminClient {
58
59
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
59
60
  * the environment variable GCLOUD_PROJECT for your project ID. If your
60
61
  * app is running in an environment which supports
61
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
62
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
62
63
  * your project ID will be detected automatically.
63
64
  * @param {string} [options.apiEndpoint] - The domain name of the
64
65
  * API remote host.
@@ -2047,7 +2048,7 @@ export declare class DatabaseAdminClient {
2047
2048
  * // doThingsWith(response)
2048
2049
  * ```
2049
2050
  */
2050
- listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
2051
+ listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.IOperation>;
2051
2052
  /**
2052
2053
  * Starts asynchronous cancellation on a long-running operation. The server
2053
2054
  * makes a best effort to cancel the operation, but success is not