@google-cloud/spanner 7.20.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 (54) hide show
  1. package/README.md +1 -0
  2. package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
  3. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1 -1
  6. package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
  7. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
  8. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
  9. package/build/protos/google/spanner/v1/commit_response.proto +1 -1
  10. package/build/protos/google/spanner/v1/keys.proto +1 -1
  11. package/build/protos/google/spanner/v1/mutation.proto +1 -1
  12. package/build/protos/google/spanner/v1/query_plan.proto +1 -1
  13. package/build/protos/google/spanner/v1/result_set.proto +55 -49
  14. package/build/protos/google/spanner/v1/spanner.proto +1 -1
  15. package/build/protos/google/spanner/v1/transaction.proto +1 -1
  16. package/build/protos/google/spanner/v1/type.proto +1 -1
  17. package/build/protos/protos.d.ts +56 -50
  18. package/build/protos/protos.js +1016 -331
  19. package/build/protos/protos.json +47 -20
  20. package/build/src/backup.js +7 -0
  21. package/build/src/batch-transaction.d.ts +48 -29
  22. package/build/src/batch-transaction.js +13 -98
  23. package/build/src/codec.js +43 -26
  24. package/build/src/common-grpc/service-object.js +1 -0
  25. package/build/src/common-grpc/service.js +25 -8
  26. package/build/src/database.js +77 -49
  27. package/build/src/helper.d.ts +9 -0
  28. package/build/src/helper.js +24 -0
  29. package/build/src/index.js +24 -13
  30. package/build/src/instance-config.d.ts +1 -1
  31. package/build/src/instance-config.js +4 -0
  32. package/build/src/instance.js +12 -6
  33. package/build/src/instrument.d.ts +2 -0
  34. package/build/src/instrument.js +12 -9
  35. package/build/src/multiplexed-session.js +7 -1
  36. package/build/src/partial-result-stream.js +9 -5
  37. package/build/src/request_id_header.js +1 -0
  38. package/build/src/session-factory.js +5 -2
  39. package/build/src/session-pool.js +23 -6
  40. package/build/src/session.d.ts +2 -1
  41. package/build/src/session.js +8 -2
  42. package/build/src/table.js +6 -1
  43. package/build/src/transaction-runner.js +12 -2
  44. package/build/src/transaction.d.ts +2 -1
  45. package/build/src/transaction.js +95 -81
  46. package/build/src/v1/database_admin_client.d.ts +3 -2
  47. package/build/src/v1/database_admin_client.js +551 -167
  48. package/build/src/v1/instance_admin_client.d.ts +2 -1
  49. package/build/src/v1/instance_admin_client.js +453 -133
  50. package/build/src/v1/spanner_client.d.ts +2 -1
  51. package/build/src/v1/spanner_client.js +283 -85
  52. package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
  53. package/build/src/v1/spanner_executor_proxy_client.js +41 -19
  54. package/package.json +57 -58
@@ -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,7 +165,11 @@ 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);
169
+ this._traceConfig = {
170
+ opts: this._observabilityOptions,
171
+ dbName: this._dbName,
172
+ };
153
173
  }
154
174
  begin(gaxOptionsOrCallback, cb) {
155
175
  const gaxOpts = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {};
@@ -173,11 +193,10 @@ class Snapshot extends events_1.EventEmitter {
173
193
  this._options.partitionedDml !== undefined)) {
174
194
  (0, common_1.addLeaderAwareRoutingHeader)(headers);
175
195
  }
176
- const traceConfig = {
177
- opts: this._observabilityOptions,
178
- dbName: this._dbName,
179
- };
180
- return (0, instrument_2.startTrace)('Snapshot.begin', traceConfig, span => {
196
+ return (0, instrument_2.startTrace)('Snapshot.begin', {
197
+ transactionTag: this.requestOptions?.transactionTag,
198
+ ...this._traceConfig,
199
+ }, span => {
181
200
  span.addEvent('Begin Transaction');
182
201
  this.request({
183
202
  client: 'SpannerClient',
@@ -368,7 +387,6 @@ class Snapshot extends events_1.EventEmitter {
368
387
  * ```
369
388
  */
370
389
  createReadStream(table, request = {}) {
371
- var _a, _b;
372
390
  const { gaxOptions, json, jsonOptions, maxResumeRetries, requestOptions, columnsMetadata, } = request;
373
391
  const keySet = Snapshot.encodeKeySet(request);
374
392
  const transaction = {};
@@ -394,7 +412,7 @@ class Snapshot extends events_1.EventEmitter {
394
412
  delete request.columnsMetadata;
395
413
  const reqOpts = Object.assign(request, {
396
414
  session: this.session.formattedName_,
397
- 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),
398
416
  directedReadOptions: directedReadOptions,
399
417
  transaction,
400
418
  table,
@@ -407,12 +425,12 @@ class Snapshot extends events_1.EventEmitter {
407
425
  (0, common_1.addLeaderAwareRoutingHeader)(headers);
408
426
  }
409
427
  const traceConfig = {
428
+ ...this._traceConfig,
410
429
  tableName: table,
411
- opts: this._observabilityOptions,
412
- dbName: this._dbName,
430
+ transactionTag: this.requestOptions?.transactionTag,
431
+ requestTag: requestOptions?.requestTag,
413
432
  };
414
433
  return (0, instrument_2.startTrace)('Snapshot.createReadStream', traceConfig, span => {
415
- var _a;
416
434
  let attempt = 0;
417
435
  const database = this.session.parent;
418
436
  const nthRequest = (0, request_id_header_1.nextNthRequest)(database);
@@ -444,33 +462,35 @@ class Snapshot extends events_1.EventEmitter {
444
462
  headers: (0, request_id_header_1.injectRequestIDIntoHeaders)(headers, this.session, nthRequest, attempt),
445
463
  });
446
464
  };
447
- const resultStream = (_a = (0, partial_result_stream_1.partialResultStream)(this._wrapWithIdWaiter(makeRequest), {
465
+ const resultStream = (0, partial_result_stream_1.partialResultStream)(this._wrapWithIdWaiter(makeRequest), {
448
466
  json,
449
467
  jsonOptions,
450
468
  maxResumeRetries,
451
469
  columnsMetadata,
452
470
  gaxOptions,
453
- })) === null || _a === void 0 ? void 0 : _a.on('response', response => {
471
+ })
472
+ ?.on('response', response => {
454
473
  if (response.metadata && response.metadata.transaction && !this.id) {
455
474
  this._update(response.metadata.transaction);
456
475
  }
457
- }).on('error', err => {
458
- var _a;
476
+ })
477
+ .on('error', err => {
459
478
  (0, instrument_2.setSpanError)(span, err);
460
479
  const wasAborted = isErrorAborted(err);
461
480
  if (!this.id && this._useInRunner && !wasAborted) {
462
481
  // TODO: resolve https://github.com/googleapis/nodejs-spanner/issues/2170
463
- this.begin();
482
+ void this.begin();
464
483
  }
465
484
  else {
466
485
  if (wasAborted) {
467
486
  span.addEvent('Stream broken. Not safe to retry', {
468
- 'transaction.id': (_a = this.id) === null || _a === void 0 ? void 0 : _a.toString(),
487
+ 'transaction.id': this.id?.toString(),
469
488
  });
470
489
  }
471
490
  }
472
491
  span.end();
473
- }).on('end', err => {
492
+ })
493
+ .on('end', err => {
474
494
  if (err) {
475
495
  (0, instrument_2.setSpanError)(span, err);
476
496
  }
@@ -551,12 +571,10 @@ class Snapshot extends events_1.EventEmitter {
551
571
  request = requestOrCallback;
552
572
  callback = cb;
553
573
  }
554
- const traceConfig = {
574
+ return (0, instrument_2.startTrace)('Snapshot.read', {
555
575
  tableName: table,
556
- opts: this._observabilityOptions,
557
- dbName: this._dbName,
558
- };
559
- return (0, instrument_2.startTrace)('Snapshot.read', traceConfig, span => {
576
+ ...this._traceConfig,
577
+ }, span => {
560
578
  this.createReadStream(table, request)
561
579
  .on('error', err => {
562
580
  const e = err;
@@ -575,12 +593,10 @@ class Snapshot extends events_1.EventEmitter {
575
593
  const rows = [];
576
594
  let stats;
577
595
  let metadata;
578
- const traceConfig = {
579
- sql: query,
580
- opts: this._observabilityOptions,
581
- dbName: this._dbName,
582
- };
583
- (0, instrument_2.startTrace)('Snapshot.run', traceConfig, span => {
596
+ (0, instrument_2.startTrace)('Snapshot.run', {
597
+ ...query,
598
+ ...this._traceConfig,
599
+ }, span => {
584
600
  return this.runStream(query)
585
601
  .on('error', (err, rows, stats, metadata) => {
586
602
  (0, instrument_2.setSpanError)(span, err);
@@ -712,7 +728,6 @@ class Snapshot extends events_1.EventEmitter {
712
728
  let reqOpts;
713
729
  const directedReadOptions = this._getDirectedReadOptions(query.directedReadOptions);
714
730
  const sanitizeRequest = () => {
715
- var _a, _b;
716
731
  query = query;
717
732
  const { params, paramTypes } = Snapshot.encodeParams(query);
718
733
  const transaction = {};
@@ -736,7 +751,7 @@ class Snapshot extends events_1.EventEmitter {
736
751
  reqOpts = Object.assign(query, {
737
752
  session: this.session.formattedName_,
738
753
  seqno: this._seqno++,
739
- 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),
740
755
  directedReadOptions: directedReadOptions,
741
756
  transaction,
742
757
  params,
@@ -750,9 +765,10 @@ class Snapshot extends events_1.EventEmitter {
750
765
  (0, common_1.addLeaderAwareRoutingHeader)(headers);
751
766
  }
752
767
  const traceConfig = {
753
- opts: this._observabilityOptions,
754
- dbName: this._dbName,
768
+ transactionTag: this.requestOptions?.transactionTag,
769
+ requestTag: requestOptions?.requestTag,
755
770
  ...query,
771
+ ...this._traceConfig,
756
772
  };
757
773
  return (0, instrument_2.startTrace)('Snapshot.runStream', traceConfig, span => {
758
774
  let attempt = 0;
@@ -807,18 +823,17 @@ class Snapshot extends events_1.EventEmitter {
807
823
  }
808
824
  })
809
825
  .on('error', err => {
810
- var _a;
811
826
  (0, instrument_2.setSpanError)(span, err);
812
827
  const wasAborted = isErrorAborted(err);
813
828
  if (!this.id && this._useInRunner && !wasAborted) {
814
829
  span.addEvent('Stream broken. Safe to retry');
815
830
  // TODO: resolve https://github.com/googleapis/nodejs-spanner/issues/2170
816
- this.begin();
831
+ void this.begin();
817
832
  }
818
833
  else {
819
834
  if (wasAborted) {
820
835
  span.addEvent('Stream broken. Not safe to retry', {
821
- 'transaction.id': (_a = this.id) === null || _a === void 0 ? void 0 : _a.toString(),
836
+ 'transaction.id': this.id?.toString(),
822
837
  });
823
838
  }
824
839
  }
@@ -863,10 +878,10 @@ class Snapshot extends events_1.EventEmitter {
863
878
  static encodeKeySet(request) {
864
879
  const keySet = request.keySet || {};
865
880
  if (request.keys) {
866
- keySet.keys = arrify(request.keys).map(codec_1.codec.convertToListValue);
881
+ keySet.keys = (0, helper_1.toArray)(request.keys).map(codec_1.codec.convertToListValue);
867
882
  }
868
883
  if (request.ranges) {
869
- keySet.ranges = arrify(request.ranges).map(range => {
884
+ keySet.ranges = (0, helper_1.toArray)(request.ranges).map(range => {
870
885
  const encodedRange = {};
871
886
  Object.keys(range).forEach(bound => {
872
887
  encodedRange[bound] = codec_1.codec.convertToListValue(range[bound]);
@@ -921,9 +936,8 @@ class Snapshot extends events_1.EventEmitter {
921
936
  * @returns {object}
922
937
  */
923
938
  static encodeParams(request) {
924
- var _a;
925
939
  const typeMap = request.types || {};
926
- const params = { fields: ((_a = request.params) === null || _a === void 0 ? void 0 : _a.fields) || {} };
940
+ const params = { fields: request.params?.fields || {} };
927
941
  const paramTypes = request.paramTypes || {};
928
942
  if (request.params && !request.params.fields) {
929
943
  const fields = {};
@@ -1008,7 +1022,7 @@ class Snapshot extends events_1.EventEmitter {
1008
1022
  _releaseWaitingRequests() {
1009
1023
  while (this._waitingRequests.length > 0) {
1010
1024
  const request = this._waitingRequests.shift();
1011
- request === null || request === void 0 ? void 0 : request();
1025
+ request?.();
1012
1026
  }
1013
1027
  }
1014
1028
  /**
@@ -1043,12 +1057,12 @@ class Dml extends Snapshot {
1043
1057
  if (typeof query === 'string') {
1044
1058
  query = { sql: query };
1045
1059
  }
1046
- const traceConfig = {
1047
- opts: this._observabilityOptions,
1048
- dbName: this._dbName,
1060
+ return (0, instrument_2.startTrace)('Dml.runUpdate', {
1049
1061
  ...query,
1050
- };
1051
- return (0, instrument_2.startTrace)('Dml.runUpdate', traceConfig, span => {
1062
+ ...this._traceConfig,
1063
+ transactionTag: this.requestOptions?.transactionTag,
1064
+ requestTag: query.requestOptions?.requestTag,
1065
+ }, span => {
1052
1066
  this.run(query, (err, rows, stats) => {
1053
1067
  let rowCount = 0;
1054
1068
  if (stats && stats.rowCount) {
@@ -1116,6 +1130,9 @@ exports.Dml = Dml;
1116
1130
  * ```
1117
1131
  */
1118
1132
  class Transaction extends Dml {
1133
+ commitTimestamp;
1134
+ commitTimestampProto;
1135
+ _queuedMutations;
1119
1136
  /**
1120
1137
  * Timestamp at which the transaction was committed. Will be populated once
1121
1138
  * {@link Transaction#commit} is called.
@@ -1164,7 +1181,6 @@ class Transaction extends Dml {
1164
1181
  this.requestOptions = requestOptions;
1165
1182
  }
1166
1183
  batchUpdate(queries, optionsOrCallback, cb) {
1167
- var _a, _b;
1168
1184
  const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
1169
1185
  const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
1170
1186
  const gaxOpts = 'gaxOptions' in options
@@ -1195,9 +1211,10 @@ class Transaction extends Dml {
1195
1211
  else {
1196
1212
  transaction.begin = this._options;
1197
1213
  }
1214
+ const requestOptionsWithTag = this.configureTagOptions(false, this.requestOptions?.transactionTag ?? undefined, options.requestOptions);
1198
1215
  const reqOpts = {
1199
1216
  session: this.session.formattedName_,
1200
- requestOptions: this.configureTagOptions(false, (_b = (_a = this.requestOptions) === null || _a === void 0 ? void 0 : _a.transactionTag) !== null && _b !== void 0 ? _b : undefined, options.requestOptions),
1217
+ requestOptions: requestOptionsWithTag,
1201
1218
  transaction,
1202
1219
  seqno: this._seqno++,
1203
1220
  statements,
@@ -1208,8 +1225,9 @@ class Transaction extends Dml {
1208
1225
  (0, common_1.addLeaderAwareRoutingHeader)(headers);
1209
1226
  }
1210
1227
  const traceConfig = {
1211
- opts: this._observabilityOptions,
1212
- dbName: this._dbName,
1228
+ ...this._traceConfig,
1229
+ transactionTag: requestOptionsWithTag?.transactionTag,
1230
+ requestTag: options?.requestOptions?.requestTag,
1213
1231
  };
1214
1232
  return (0, instrument_2.startTrace)('Transaction.batchUpdate', traceConfig, span => {
1215
1233
  this.request({
@@ -1219,7 +1237,6 @@ class Transaction extends Dml {
1219
1237
  gaxOpts,
1220
1238
  headers: headers,
1221
1239
  }, (err, resp) => {
1222
- var _a;
1223
1240
  let batchUpdateError;
1224
1241
  if (err) {
1225
1242
  const rowCounts = [];
@@ -1231,7 +1248,7 @@ class Transaction extends Dml {
1231
1248
  }
1232
1249
  const { resultSets, status } = resp;
1233
1250
  for (const resultSet of resultSets) {
1234
- if (!this.id && ((_a = resultSet.metadata) === null || _a === void 0 ? void 0 : _a.transaction)) {
1251
+ if (!this.id && resultSet.metadata?.transaction) {
1235
1252
  this._update(resultSet.metadata.transaction);
1236
1253
  }
1237
1254
  }
@@ -1284,11 +1301,10 @@ class Transaction extends Dml {
1284
1301
  const session = this.session.formattedName_;
1285
1302
  const requestOptions = options.requestOptions;
1286
1303
  const reqOpts = { mutations, session, requestOptions };
1287
- const traceConfig = {
1288
- opts: this._observabilityOptions,
1289
- dbName: this._dbName,
1290
- };
1291
- return (0, instrument_2.startTrace)('Transaction.commit', traceConfig, span => {
1304
+ return (0, instrument_2.startTrace)('Transaction.commit', {
1305
+ transactionTag: this.requestOptions?.transactionTag,
1306
+ ...this._traceConfig,
1307
+ }, span => {
1292
1308
  if (this.id) {
1293
1309
  reqOpts.transactionId = this.id;
1294
1310
  }
@@ -1382,7 +1398,6 @@ class Transaction extends Dml {
1382
1398
  * @private
1383
1399
  */
1384
1400
  static decoratePossibleJsonMismatchError(err, mutations) {
1385
- var _a, _b;
1386
1401
  const errorMessage = /Invalid value for column (?<column>.+) in table (?<table>.+): Expected JSON./;
1387
1402
  const found = err.message && err.message.match(errorMessage);
1388
1403
  if (found && found.groups) {
@@ -1394,10 +1409,10 @@ class Transaction extends Dml {
1394
1409
  mutation.insertOrUpdate ||
1395
1410
  mutation.replace;
1396
1411
  if (write && write.table === table) {
1397
- const index = (_a = write.columns) === null || _a === void 0 ? void 0 : _a.indexOf(column);
1412
+ const index = write.columns?.indexOf(column);
1398
1413
  if (index && index > -1 && write.values) {
1399
1414
  for (const row of write.values) {
1400
- if (((_b = row.values) === null || _b === void 0 ? void 0 : _b.length) &&
1415
+ if (row.values?.length &&
1401
1416
  row.values.length > index &&
1402
1417
  row.values[index].listValue) {
1403
1418
  // If the value is an array, the client library also encoded it as
@@ -1576,11 +1591,7 @@ class Transaction extends Dml {
1576
1591
  rollback(gaxOptionsOrCallback, cb) {
1577
1592
  const gaxOpts = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {};
1578
1593
  const callback = typeof gaxOptionsOrCallback === 'function' ? gaxOptionsOrCallback : cb;
1579
- const traceConfig = {
1580
- opts: this._observabilityOptions,
1581
- dbName: this._dbName,
1582
- };
1583
- return (0, instrument_2.startTrace)('Transaction.rollback', traceConfig, span => {
1594
+ return (0, instrument_2.startTrace)('Transaction.rollback', this._traceConfig, span => {
1584
1595
  if (!this.id) {
1585
1596
  span.addEvent('Transaction ID is unknown, nothing to rollback.');
1586
1597
  span.end();
@@ -1749,21 +1760,21 @@ class Transaction extends Dml {
1749
1760
  /**
1750
1761
  * Set optimistic concurrency control for the transaction.
1751
1762
  */
1752
- if (options === null || options === void 0 ? void 0 : options.optimisticLock) {
1763
+ if (options?.optimisticLock) {
1753
1764
  this._options.readWrite.readLockMode = ReadLockMode.OPTIMISTIC;
1754
1765
  }
1755
1766
  /**
1756
1767
  * Set option excludeTxnFromChangeStreams=true to exclude read/write transactions
1757
1768
  * from being tracked in change streams.
1758
1769
  */
1759
- if (options === null || options === void 0 ? void 0 : options.excludeTxnFromChangeStreams) {
1770
+ if (options?.excludeTxnFromChangeStreams) {
1760
1771
  this._options.excludeTxnFromChangeStreams = true;
1761
1772
  }
1762
1773
  /**
1763
1774
  * Set isolation level .
1764
1775
  */
1765
- this._options.isolationLevel = (options === null || options === void 0 ? void 0 : options.isolationLevel)
1766
- ? options === null || options === void 0 ? void 0 : options.isolationLevel
1776
+ this._options.isolationLevel = options?.isolationLevel
1777
+ ? options?.isolationLevel
1767
1778
  : this._getSpanner().defaultTransactionOptions.isolationLevel;
1768
1779
  }
1769
1780
  }
@@ -1786,7 +1797,7 @@ exports.Transaction = Transaction;
1786
1797
  * @throws {GoogleError} - If a row does not contain the correct number of columns.
1787
1798
  */
1788
1799
  function buildMutation(method, table, keyVals) {
1789
- const rows = arrify(keyVals);
1800
+ const rows = (0, helper_1.toArray)(keyVals);
1790
1801
  const columns = Transaction.getUniqueKeys(rows);
1791
1802
  const values = rows.map((row, index) => {
1792
1803
  const keys = Object.keys(row);
@@ -1814,7 +1825,7 @@ function buildMutation(method, table, keyVals) {
1814
1825
  */
1815
1826
  function buildDeleteMutation(table, keys) {
1816
1827
  const keySet = {
1817
- keys: arrify(keys).map(codec_1.codec.convertToListValue),
1828
+ keys: (0, helper_1.toArray)(keys).map(codec_1.codec.convertToListValue),
1818
1829
  };
1819
1830
  const mutation = {
1820
1831
  delete: { table, keySet },
@@ -1855,6 +1866,10 @@ function buildDeleteMutation(table, keys) {
1855
1866
  * ```
1856
1867
  */
1857
1868
  class MutationSet {
1869
+ /**
1870
+ * An array to store the mutations.
1871
+ */
1872
+ _queuedMutations;
1858
1873
  /**
1859
1874
  * Creates a new Mutation object.
1860
1875
  */
@@ -1946,6 +1961,7 @@ exports.MutationSet = MutationSet;
1946
1961
  * ```
1947
1962
  */
1948
1963
  class MutationGroup {
1964
+ _proto;
1949
1965
  constructor() {
1950
1966
  this._proto =
1951
1967
  new protos_1.google.spanner.v1.BatchWriteRequest.MutationGroup();
@@ -2001,12 +2017,10 @@ class PartitionedDml extends Dml {
2001
2017
  this._options.excludeTxnFromChangeStreams = true;
2002
2018
  }
2003
2019
  runUpdate(query, callback) {
2004
- const traceConfig = {
2005
- sql: query,
2006
- opts: this._observabilityOptions,
2007
- dbName: this._dbName,
2008
- };
2009
- return (0, instrument_2.startTrace)('PartitionedDml.runUpdate', traceConfig, span => {
2020
+ return (0, instrument_2.startTrace)('PartitionedDml.runUpdate', {
2021
+ ...query,
2022
+ ...this._traceConfig,
2023
+ }, span => {
2010
2024
  super.runUpdate(query, (err, count) => {
2011
2025
  if (err) {
2012
2026
  (0, instrument_2.setSpanError)(span, err);
@@ -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