@google-cloud/spanner 8.0.0 → 8.1.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 (50) hide show
  1. package/README.md +2 -0
  2. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +35 -0
  3. package/build/protos/google/spanner/v1/change_stream.proto +451 -0
  4. package/build/protos/google/spanner/v1/commit_response.proto +9 -4
  5. package/build/protos/google/spanner/v1/transaction.proto +40 -356
  6. package/build/protos/protos.d.ts +1521 -0
  7. package/build/protos/protos.js +3906 -0
  8. package/build/protos/protos.json +317 -1
  9. package/build/src/batch-transaction.js +2 -2
  10. package/build/src/codec.js +20 -21
  11. package/build/src/common-grpc/service.js +10 -10
  12. package/build/src/common.d.ts +1 -0
  13. package/build/src/common.js +9 -1
  14. package/build/src/database.d.ts +1 -0
  15. package/build/src/database.js +2 -0
  16. package/build/src/helper.d.ts +90 -0
  17. package/build/src/helper.js +154 -0
  18. package/build/src/index.d.ts +33 -0
  19. package/build/src/index.js +178 -8
  20. package/build/src/instrument.js +3 -2
  21. package/build/src/metrics/constants.d.ts +36 -0
  22. package/build/src/metrics/constants.js +106 -0
  23. package/build/src/metrics/external-types.d.ts +20 -0
  24. package/build/src/metrics/external-types.js +32 -0
  25. package/build/src/metrics/interceptor.d.ts +13 -0
  26. package/build/src/metrics/interceptor.js +87 -0
  27. package/build/src/metrics/metrics-tracer-factory.d.ts +165 -0
  28. package/build/src/metrics/metrics-tracer-factory.js +389 -0
  29. package/build/src/metrics/metrics-tracer.d.ts +204 -0
  30. package/build/src/metrics/metrics-tracer.js +371 -0
  31. package/build/src/metrics/spanner-metrics-exporter.d.ts +35 -0
  32. package/build/src/metrics/spanner-metrics-exporter.js +119 -0
  33. package/build/src/metrics/transform.d.ts +144 -0
  34. package/build/src/metrics/transform.js +272 -0
  35. package/build/src/partial-result-stream.js +9 -5
  36. package/build/src/session-factory.d.ts +34 -0
  37. package/build/src/session-factory.js +30 -0
  38. package/build/src/session-pool.js +1 -2
  39. package/build/src/transaction-runner.d.ts +1 -0
  40. package/build/src/transaction-runner.js +6 -0
  41. package/build/src/transaction.d.ts +42 -1
  42. package/build/src/transaction.js +192 -42
  43. package/build/src/v1/database_admin_client.d.ts +34 -0
  44. package/build/src/v1/database_admin_client.js +167 -1
  45. package/build/src/v1/database_admin_client_config.json +4 -0
  46. package/build/src/v1/instance_admin_client.d.ts +120 -0
  47. package/build/src/v1/instance_admin_client.js +312 -13
  48. package/build/src/v1/spanner_client.js +108 -0
  49. package/build/src/v1/spanner_proto_list.json +1 -0
  50. package/package.json +12 -5
@@ -3034,6 +3034,18 @@
3034
3034
  "(google.api.method_signature)": "parent"
3035
3035
  }
3036
3036
  ]
3037
+ },
3038
+ "InternalUpdateGraphOperation": {
3039
+ "requestType": "InternalUpdateGraphOperationRequest",
3040
+ "responseType": "InternalUpdateGraphOperationResponse",
3041
+ "options": {
3042
+ "(google.api.method_signature)": "database,operation_id"
3043
+ },
3044
+ "parsedOptions": [
3045
+ {
3046
+ "(google.api.method_signature)": "database,operation_id"
3047
+ }
3048
+ ]
3037
3049
  }
3038
3050
  }
3039
3051
  },
@@ -3322,6 +3334,13 @@
3322
3334
  "options": {
3323
3335
  "(google.api.field_behavior)": "OPTIONAL"
3324
3336
  }
3337
+ },
3338
+ "throughputMode": {
3339
+ "type": "bool",
3340
+ "id": 5,
3341
+ "options": {
3342
+ "(google.api.field_behavior)": "OPTIONAL"
3343
+ }
3325
3344
  }
3326
3345
  }
3327
3346
  },
@@ -3708,6 +3727,49 @@
3708
3727
  }
3709
3728
  }
3710
3729
  }
3730
+ },
3731
+ "InternalUpdateGraphOperationRequest": {
3732
+ "fields": {
3733
+ "database": {
3734
+ "type": "string",
3735
+ "id": 1,
3736
+ "options": {
3737
+ "(google.api.field_behavior)": "REQUIRED",
3738
+ "(google.api.resource_reference).type": "spanner.googleapis.com/Database"
3739
+ }
3740
+ },
3741
+ "operationId": {
3742
+ "type": "string",
3743
+ "id": 2,
3744
+ "options": {
3745
+ "(google.api.field_behavior)": "REQUIRED"
3746
+ }
3747
+ },
3748
+ "vmIdentityToken": {
3749
+ "type": "string",
3750
+ "id": 5,
3751
+ "options": {
3752
+ "(google.api.field_behavior)": "REQUIRED"
3753
+ }
3754
+ },
3755
+ "progress": {
3756
+ "type": "double",
3757
+ "id": 3,
3758
+ "options": {
3759
+ "(google.api.field_behavior)": "OPTIONAL"
3760
+ }
3761
+ },
3762
+ "status": {
3763
+ "type": "google.rpc.Status",
3764
+ "id": 6,
3765
+ "options": {
3766
+ "(google.api.field_behavior)": "OPTIONAL"
3767
+ }
3768
+ }
3769
+ }
3770
+ },
3771
+ "InternalUpdateGraphOperationResponse": {
3772
+ "fields": {}
3711
3773
  }
3712
3774
  }
3713
3775
  }
@@ -7668,7 +7730,7 @@
7668
7730
  "csharp_namespace": "Google.Cloud.Spanner.V1",
7669
7731
  "go_package": "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb",
7670
7732
  "java_multiple_files": true,
7671
- "java_outer_classname": "TypeProto",
7733
+ "java_outer_classname": "ChangeStreamProto",
7672
7734
  "java_package": "com.google.spanner.v1",
7673
7735
  "php_namespace": "Google\\Cloud\\Spanner\\V1",
7674
7736
  "ruby_package": "Google::Cloud::Spanner::V1",
@@ -8799,6 +8861,10 @@
8799
8861
  "precommitToken": {
8800
8862
  "type": "MultiplexedSessionPrecommitToken",
8801
8863
  "id": 4
8864
+ },
8865
+ "snapshotTimestamp": {
8866
+ "type": "google.protobuf.Timestamp",
8867
+ "id": 5
8802
8868
  }
8803
8869
  },
8804
8870
  "nested": {
@@ -9366,6 +9432,256 @@
9366
9432
  "PG_JSONB": 3,
9367
9433
  "PG_OID": 4
9368
9434
  }
9435
+ },
9436
+ "ChangeStreamRecord": {
9437
+ "oneofs": {
9438
+ "record": {
9439
+ "oneof": [
9440
+ "dataChangeRecord",
9441
+ "heartbeatRecord",
9442
+ "partitionStartRecord",
9443
+ "partitionEndRecord",
9444
+ "partitionEventRecord"
9445
+ ]
9446
+ }
9447
+ },
9448
+ "fields": {
9449
+ "dataChangeRecord": {
9450
+ "type": "DataChangeRecord",
9451
+ "id": 1
9452
+ },
9453
+ "heartbeatRecord": {
9454
+ "type": "HeartbeatRecord",
9455
+ "id": 2
9456
+ },
9457
+ "partitionStartRecord": {
9458
+ "type": "PartitionStartRecord",
9459
+ "id": 3
9460
+ },
9461
+ "partitionEndRecord": {
9462
+ "type": "PartitionEndRecord",
9463
+ "id": 4
9464
+ },
9465
+ "partitionEventRecord": {
9466
+ "type": "PartitionEventRecord",
9467
+ "id": 5
9468
+ }
9469
+ },
9470
+ "nested": {
9471
+ "DataChangeRecord": {
9472
+ "fields": {
9473
+ "commitTimestamp": {
9474
+ "type": "google.protobuf.Timestamp",
9475
+ "id": 1
9476
+ },
9477
+ "recordSequence": {
9478
+ "type": "string",
9479
+ "id": 2
9480
+ },
9481
+ "serverTransactionId": {
9482
+ "type": "string",
9483
+ "id": 3
9484
+ },
9485
+ "isLastRecordInTransactionInPartition": {
9486
+ "type": "bool",
9487
+ "id": 4
9488
+ },
9489
+ "table": {
9490
+ "type": "string",
9491
+ "id": 5
9492
+ },
9493
+ "columnMetadata": {
9494
+ "rule": "repeated",
9495
+ "type": "ColumnMetadata",
9496
+ "id": 6
9497
+ },
9498
+ "mods": {
9499
+ "rule": "repeated",
9500
+ "type": "Mod",
9501
+ "id": 7
9502
+ },
9503
+ "modType": {
9504
+ "type": "ModType",
9505
+ "id": 8
9506
+ },
9507
+ "valueCaptureType": {
9508
+ "type": "ValueCaptureType",
9509
+ "id": 9
9510
+ },
9511
+ "numberOfRecordsInTransaction": {
9512
+ "type": "int32",
9513
+ "id": 10
9514
+ },
9515
+ "numberOfPartitionsInTransaction": {
9516
+ "type": "int32",
9517
+ "id": 11
9518
+ },
9519
+ "transactionTag": {
9520
+ "type": "string",
9521
+ "id": 12
9522
+ },
9523
+ "isSystemTransaction": {
9524
+ "type": "bool",
9525
+ "id": 13
9526
+ }
9527
+ },
9528
+ "nested": {
9529
+ "ColumnMetadata": {
9530
+ "fields": {
9531
+ "name": {
9532
+ "type": "string",
9533
+ "id": 1
9534
+ },
9535
+ "type": {
9536
+ "type": "Type",
9537
+ "id": 2
9538
+ },
9539
+ "isPrimaryKey": {
9540
+ "type": "bool",
9541
+ "id": 3
9542
+ },
9543
+ "ordinalPosition": {
9544
+ "type": "int64",
9545
+ "id": 4
9546
+ }
9547
+ }
9548
+ },
9549
+ "ModValue": {
9550
+ "fields": {
9551
+ "columnMetadataIndex": {
9552
+ "type": "int32",
9553
+ "id": 1
9554
+ },
9555
+ "value": {
9556
+ "type": "google.protobuf.Value",
9557
+ "id": 2
9558
+ }
9559
+ }
9560
+ },
9561
+ "Mod": {
9562
+ "fields": {
9563
+ "keys": {
9564
+ "rule": "repeated",
9565
+ "type": "ModValue",
9566
+ "id": 1
9567
+ },
9568
+ "oldValues": {
9569
+ "rule": "repeated",
9570
+ "type": "ModValue",
9571
+ "id": 2
9572
+ },
9573
+ "newValues": {
9574
+ "rule": "repeated",
9575
+ "type": "ModValue",
9576
+ "id": 3
9577
+ }
9578
+ }
9579
+ },
9580
+ "ModType": {
9581
+ "values": {
9582
+ "MOD_TYPE_UNSPECIFIED": 0,
9583
+ "INSERT": 10,
9584
+ "UPDATE": 20,
9585
+ "DELETE": 30
9586
+ }
9587
+ },
9588
+ "ValueCaptureType": {
9589
+ "values": {
9590
+ "VALUE_CAPTURE_TYPE_UNSPECIFIED": 0,
9591
+ "OLD_AND_NEW_VALUES": 10,
9592
+ "NEW_VALUES": 20,
9593
+ "NEW_ROW": 30,
9594
+ "NEW_ROW_AND_OLD_VALUES": 40
9595
+ }
9596
+ }
9597
+ }
9598
+ },
9599
+ "HeartbeatRecord": {
9600
+ "fields": {
9601
+ "timestamp": {
9602
+ "type": "google.protobuf.Timestamp",
9603
+ "id": 1
9604
+ }
9605
+ }
9606
+ },
9607
+ "PartitionStartRecord": {
9608
+ "fields": {
9609
+ "startTimestamp": {
9610
+ "type": "google.protobuf.Timestamp",
9611
+ "id": 1
9612
+ },
9613
+ "recordSequence": {
9614
+ "type": "string",
9615
+ "id": 2
9616
+ },
9617
+ "partitionTokens": {
9618
+ "rule": "repeated",
9619
+ "type": "string",
9620
+ "id": 3
9621
+ }
9622
+ }
9623
+ },
9624
+ "PartitionEndRecord": {
9625
+ "fields": {
9626
+ "endTimestamp": {
9627
+ "type": "google.protobuf.Timestamp",
9628
+ "id": 1
9629
+ },
9630
+ "recordSequence": {
9631
+ "type": "string",
9632
+ "id": 2
9633
+ },
9634
+ "partitionToken": {
9635
+ "type": "string",
9636
+ "id": 3
9637
+ }
9638
+ }
9639
+ },
9640
+ "PartitionEventRecord": {
9641
+ "fields": {
9642
+ "commitTimestamp": {
9643
+ "type": "google.protobuf.Timestamp",
9644
+ "id": 1
9645
+ },
9646
+ "recordSequence": {
9647
+ "type": "string",
9648
+ "id": 2
9649
+ },
9650
+ "partitionToken": {
9651
+ "type": "string",
9652
+ "id": 3
9653
+ },
9654
+ "moveInEvents": {
9655
+ "rule": "repeated",
9656
+ "type": "MoveInEvent",
9657
+ "id": 4
9658
+ },
9659
+ "moveOutEvents": {
9660
+ "rule": "repeated",
9661
+ "type": "MoveOutEvent",
9662
+ "id": 5
9663
+ }
9664
+ },
9665
+ "nested": {
9666
+ "MoveInEvent": {
9667
+ "fields": {
9668
+ "sourcePartitionToken": {
9669
+ "type": "string",
9670
+ "id": 1
9671
+ }
9672
+ }
9673
+ },
9674
+ "MoveOutEvent": {
9675
+ "fields": {
9676
+ "destinationPartitionToken": {
9677
+ "type": "string",
9678
+ "id": 1
9679
+ }
9680
+ }
9681
+ }
9682
+ }
9683
+ }
9684
+ }
9369
9685
  }
9370
9686
  }
9371
9687
  }
@@ -19,11 +19,11 @@ exports.BatchTransaction = void 0;
19
19
  const precise_date_1 = require("@google-cloud/precise-date");
20
20
  const promisify_1 = require("@google-cloud/promisify");
21
21
  const extend = require("extend");
22
- const is = require("is");
23
22
  const transaction_1 = require("./transaction");
24
23
  const common_1 = require("../src/common");
25
24
  const instrument_1 = require("./instrument");
26
25
  const request_id_header_1 = require("./request_id_header");
26
+ const helper_1 = require("./helper");
27
27
  /**
28
28
  * Use a BatchTransaction object to create partitions and read/query against
29
29
  * your Cloud Spanner database.
@@ -251,7 +251,7 @@ class BatchTransaction extends transaction_1.Snapshot {
251
251
  */
252
252
  executeStream(partition) {
253
253
  // TODO: Instrument the streams with Otel.
254
- if (is.string(partition.table)) {
254
+ if ((0, helper_1.isString)(partition.table)) {
255
255
  return this.createReadStream(partition.table, partition);
256
256
  }
257
257
  return this.runStream(partition);
@@ -20,7 +20,6 @@ const service_1 = require("./common-grpc/service");
20
20
  const precise_date_1 = require("@google-cloud/precise-date");
21
21
  const helper_1 = require("./helper");
22
22
  const big_js_1 = require("big.js");
23
- const is = require("is");
24
23
  const protos_1 = require("../protos/protos");
25
24
  const google_gax_1 = require("google-gax");
26
25
  /**
@@ -357,13 +356,13 @@ class Interval {
357
356
  * @param nanoseconds nanoseconds part of the `Interval`
358
357
  */
359
358
  constructor(months, days, nanoseconds) {
360
- if (!is.integer(months)) {
359
+ if (!(0, helper_1.isInteger)(months)) {
361
360
  throw new google_gax_1.GoogleError(`Invalid months: ${months}, months should be an integral value`);
362
361
  }
363
- if (!is.integer(days)) {
362
+ if (!(0, helper_1.isInteger)(days)) {
364
363
  throw new google_gax_1.GoogleError(`Invalid days: ${days}, days should be an integral value`);
365
364
  }
366
- if (is.null(nanoseconds) || is.undefined(nanoseconds)) {
365
+ if ((0, helper_1.isNull)(nanoseconds) || (0, helper_1.isUndefined)(nanoseconds)) {
367
366
  throw new google_gax_1.GoogleError(`Invalid nanoseconds: ${nanoseconds}, nanoseconds should be a valid bigint value`);
368
367
  }
369
368
  this.months = months;
@@ -404,7 +403,7 @@ class Interval {
404
403
  * Constructs an `Interval` with specified seconds.
405
404
  */
406
405
  static fromSeconds(seconds) {
407
- if (!is.integer(seconds)) {
406
+ if (!(0, helper_1.isInteger)(seconds)) {
408
407
  throw new google_gax_1.GoogleError(`Invalid seconds: ${seconds}, seconds should be an integral value`);
409
408
  }
410
409
  return new Interval(0, 0, BigInt(Interval.NANOSECONDS_PER_SECOND) * BigInt(seconds));
@@ -413,7 +412,7 @@ class Interval {
413
412
  * Constructs an `Interval` with specified milliseconds.
414
413
  */
415
414
  static fromMilliseconds(milliseconds) {
416
- if (!is.integer(milliseconds)) {
415
+ if (!(0, helper_1.isInteger)(milliseconds)) {
417
416
  throw new google_gax_1.GoogleError(`Invalid milliseconds: ${milliseconds}, milliseconds should be an integral value`);
418
417
  }
419
418
  return new Interval(0, 0, BigInt(Interval.NANOSECONDS_PER_MILLISECOND) * BigInt(milliseconds));
@@ -422,7 +421,7 @@ class Interval {
422
421
  * Constructs an `Interval` with specified microseconds.
423
422
  */
424
423
  static fromMicroseconds(microseconds) {
425
- if (!is.integer(microseconds)) {
424
+ if (!(0, helper_1.isInteger)(microseconds)) {
426
425
  throw new google_gax_1.GoogleError(`Invalid microseconds: ${microseconds}, microseconds should be an integral value`);
427
426
  }
428
427
  return new Interval(0, 0, BigInt(Interval.NANOSECONDS_PER_MICROSECOND) * BigInt(microseconds));
@@ -642,7 +641,7 @@ function convertValueToJson(value, options) {
642
641
  * @returns {*}
643
642
  */
644
643
  function decode(value, type, columnMetadata) {
645
- if (is.null(value)) {
644
+ if ((0, helper_1.isNull)(value)) {
646
645
  return null;
647
646
  }
648
647
  let decoded = value;
@@ -760,10 +759,10 @@ function encode(value) {
760
759
  * @returns {*}
761
760
  */
762
761
  function encodeValue(value) {
763
- if (is.number(value) && !is.decimal(value)) {
762
+ if ((0, helper_1.isNumber)(value) && !(0, helper_1.isDecimal)(value)) {
764
763
  return value.toString();
765
764
  }
766
- if (is.date(value)) {
765
+ if ((0, helper_1.isDate)(value)) {
767
766
  return value.toJSON();
768
767
  }
769
768
  if (value instanceof WrappedNumber) {
@@ -787,7 +786,7 @@ function encodeValue(value) {
787
786
  if (value instanceof Struct) {
788
787
  return Array.from(value).map(field => encodeValue(field.value));
789
788
  }
790
- if (is.array(value)) {
789
+ if ((0, helper_1.isArray)(value)) {
791
790
  return value.map(encodeValue);
792
791
  }
793
792
  if (value instanceof PGJsonb) {
@@ -796,7 +795,7 @@ function encodeValue(value) {
796
795
  if (value instanceof Interval) {
797
796
  return value.toISO8601();
798
797
  }
799
- if (is.object(value)) {
798
+ if ((0, helper_1.isObject)(value)) {
800
799
  return JSON.stringify(value);
801
800
  }
802
801
  return value;
@@ -870,14 +869,14 @@ const TypeCode = {
870
869
  * ```
871
870
  */
872
871
  function getType(value) {
873
- const isSpecialNumber = is.infinite(value) || (is.number(value) && isNaN(value));
872
+ const isSpecialNumber = (0, helper_1.isInfinite)(value) || ((0, helper_1.isNumber)(value) && isNaN(value));
874
873
  if (value instanceof Float32) {
875
874
  return { type: 'float32' };
876
875
  }
877
- if (is.decimal(value) || isSpecialNumber || value instanceof Float) {
876
+ if ((0, helper_1.isDecimal)(value) || isSpecialNumber || value instanceof Float) {
878
877
  return { type: 'float64' };
879
878
  }
880
- if (is.number(value) || value instanceof Int) {
879
+ if ((0, helper_1.isNumber)(value) || value instanceof Int) {
881
880
  return { type: 'int64' };
882
881
  }
883
882
  if (value instanceof Numeric) {
@@ -901,10 +900,10 @@ function getType(value) {
901
900
  if (value instanceof ProtoEnum) {
902
901
  return { type: 'enum', fullName: value.fullName };
903
902
  }
904
- if (is.boolean(value)) {
903
+ if ((0, helper_1.isBoolean)(value)) {
905
904
  return { type: 'bool' };
906
905
  }
907
- if (is.string(value)) {
906
+ if ((0, helper_1.isString)(value)) {
908
907
  return { type: 'string' };
909
908
  }
910
909
  if (Buffer.isBuffer(value)) {
@@ -913,7 +912,7 @@ function getType(value) {
913
912
  if (value instanceof SpannerDate) {
914
913
  return { type: 'date' };
915
914
  }
916
- if (is.date(value)) {
915
+ if ((0, helper_1.isDate)(value)) {
917
916
  return { type: 'timestamp' };
918
917
  }
919
918
  if (value instanceof Struct) {
@@ -924,11 +923,11 @@ function getType(value) {
924
923
  }),
925
924
  };
926
925
  }
927
- if (is.array(value)) {
926
+ if ((0, helper_1.isArray)(value)) {
928
927
  let child;
929
928
  for (let i = 0; i < value.length; i++) {
930
929
  child = value[i];
931
- if (!is.null(child)) {
930
+ if (!(0, helper_1.isNull)(child)) {
932
931
  break;
933
932
  }
934
933
  }
@@ -937,7 +936,7 @@ function getType(value) {
937
936
  child: getType(child),
938
937
  };
939
938
  }
940
- if (is.object(value)) {
939
+ if ((0, helper_1.isObject)(value)) {
941
940
  return { type: 'json' };
942
941
  }
943
942
  return { type: 'unspecified' };
@@ -26,9 +26,9 @@ const proto_loader_1 = require("@grpc/proto-loader");
26
26
  const duplexify = require("duplexify");
27
27
  const extend = require("extend");
28
28
  const google_gax_1 = require("google-gax");
29
- const is = require("is");
30
29
  const retryRequest = require("retry-request");
31
30
  const stream_1 = require("stream");
31
+ const helper_1 = require("../helper");
32
32
  const gaxProtoPath = path.join(path.dirname(require.resolve('google-gax')), '..', 'protos');
33
33
  // TODO: convert this object to an array
34
34
  /**
@@ -173,7 +173,7 @@ class ObjectToStructConverter {
173
173
  for (const prop in obj) {
174
174
  if (Object.prototype.hasOwnProperty.call(obj, prop)) {
175
175
  const value = obj[prop];
176
- if (is.undefined(value)) {
176
+ if ((0, helper_1.isUndefined)(value)) {
177
177
  continue;
178
178
  }
179
179
  convertedObject.fields[prop] = this.encodeValue_(value);
@@ -198,22 +198,22 @@ class ObjectToStructConverter {
198
198
  */
199
199
  encodeValue_(value) {
200
200
  let convertedValue;
201
- if (is.null(value)) {
201
+ if ((0, helper_1.isNull)(value)) {
202
202
  convertedValue = {
203
203
  nullValue: 0,
204
204
  };
205
205
  }
206
- else if (is.number(value)) {
206
+ else if ((0, helper_1.isNumber)(value)) {
207
207
  convertedValue = {
208
208
  numberValue: value,
209
209
  };
210
210
  }
211
- else if (is.string(value)) {
211
+ else if ((0, helper_1.isString)(value)) {
212
212
  convertedValue = {
213
213
  stringValue: value,
214
214
  };
215
215
  }
216
- else if (is.boolean(value)) {
216
+ else if ((0, helper_1.isBoolean)(value)) {
217
217
  convertedValue = {
218
218
  boolValue: value,
219
219
  };
@@ -223,7 +223,7 @@ class ObjectToStructConverter {
223
223
  blobValue: value,
224
224
  };
225
225
  }
226
- else if (is.object(value)) {
226
+ else if ((0, helper_1.isObject)(value)) {
227
227
  if (this.seenObjects.has(value)) {
228
228
  // Circular reference.
229
229
  if (!this.removeCircular) {
@@ -242,7 +242,7 @@ class ObjectToStructConverter {
242
242
  };
243
243
  }
244
244
  }
245
- else if (is.array(value)) {
245
+ else if ((0, helper_1.isArray)(value)) {
246
246
  convertedValue = {
247
247
  listValue: {
248
248
  values: value.map(this.encodeValue_.bind(this)),
@@ -531,7 +531,7 @@ class GrpcService extends common_1.Service {
531
531
  const service = this.getService_(protoOpts);
532
532
  const grpcMetadata = this.grpcMetadata;
533
533
  const grpcOpts = {};
534
- if (is.number(protoOpts.timeout)) {
534
+ if ((0, helper_1.isNumber)(protoOpts.timeout)) {
535
535
  grpcOpts.deadline = GrpcService.createDeadline_(protoOpts.timeout);
536
536
  }
537
537
  try {
@@ -615,7 +615,7 @@ class GrpcService extends common_1.Service {
615
615
  * @return {error|null}
616
616
  */
617
617
  static decorateError_(err) {
618
- const errorObj = is.error(err) ? err : {};
618
+ const errorObj = (0, helper_1.isError)(err) ? err : {};
619
619
  return GrpcService.decorateGrpcResponse_(errorObj, err);
620
620
  }
621
621
  /**
@@ -50,6 +50,7 @@ export declare const CLOUD_RESOURCE_HEADER = "google-cloud-resource-prefix";
50
50
  */
51
51
  export declare const LEADER_AWARE_ROUTING_HEADER = "x-goog-spanner-route-to-leader";
52
52
  export declare const END_TO_END_TRACING_HEADER = "x-goog-spanner-end-to-end-tracing";
53
+ export declare const AFE_SERVER_TIMING_HEADER = "x-goog-spanner-enable-afe-server-timing";
53
54
  /**
54
55
  * Add Leader aware routing header to existing header list.
55
56
  * @param headers Existing header list.
@@ -15,9 +15,10 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.END_TO_END_TRACING_HEADER = exports.LEADER_AWARE_ROUTING_HEADER = exports.CLOUD_RESOURCE_HEADER = void 0;
18
+ exports.AFE_SERVER_TIMING_HEADER = exports.END_TO_END_TRACING_HEADER = exports.LEADER_AWARE_ROUTING_HEADER = exports.CLOUD_RESOURCE_HEADER = void 0;
19
19
  exports.addLeaderAwareRoutingHeader = addLeaderAwareRoutingHeader;
20
20
  exports.getCommonHeaders = getCommonHeaders;
21
+ const _1 = require(".");
21
22
  /*!
22
23
  * HTTP header for the resource prefix to improve routing
23
24
  * by the backend.
@@ -31,6 +32,10 @@ exports.LEADER_AWARE_ROUTING_HEADER = 'x-goog-spanner-route-to-leader';
31
32
  * END TO END TRACING header.
32
33
  */
33
34
  exports.END_TO_END_TRACING_HEADER = 'x-goog-spanner-end-to-end-tracing';
35
+ /*
36
+ * AFE SERVER TIMING header.
37
+ */
38
+ exports.AFE_SERVER_TIMING_HEADER = 'x-goog-spanner-enable-afe-server-timing';
34
39
  /**
35
40
  * Add Leader aware routing header to existing header list.
36
41
  * @param headers Existing header list.
@@ -48,6 +53,9 @@ function getCommonHeaders(resourceName, enableTracing) {
48
53
  enableTracing) {
49
54
  headers[exports.END_TO_END_TRACING_HEADER] = 'true';
50
55
  }
56
+ if (_1.Spanner.isAFEServerTimingEnabled()) {
57
+ headers[exports.AFE_SERVER_TIMING_HEADER] = 'true';
58
+ }
51
59
  headers[exports.CLOUD_RESOURCE_HEADER] = resourceName;
52
60
  return headers;
53
61
  }
@@ -177,6 +177,7 @@ declare class Database extends common.GrpcServiceObject {
177
177
  pool_: SessionPoolInterface;
178
178
  sessionFactory_: SessionFactoryInterface;
179
179
  queryOptions_?: spannerClient.spanner.v1.ExecuteSqlRequest.IQueryOptions;
180
+ isMuxEnabledForRW_?: boolean;
180
181
  commonHeaders_: {
181
182
  [k: string]: string;
182
183
  };
@@ -61,6 +61,7 @@ class Database extends common.GrpcServiceObject {
61
61
  pool_;
62
62
  sessionFactory_;
63
63
  queryOptions_;
64
+ isMuxEnabledForRW_;
64
65
  commonHeaders_;
65
66
  request;
66
67
  databaseRole;
@@ -183,6 +184,7 @@ class Database extends common.GrpcServiceObject {
183
184
  this.requestStream = instance.requestStream;
184
185
  this.sessionFactory_ = new session_factory_1.SessionFactory(this, name, poolOptions);
185
186
  this.pool_ = this.sessionFactory_.getPool();
187
+ this.isMuxEnabledForRW_ = this.sessionFactory_.isMultiplexedEnabledForRW();
186
188
  const sessionPoolInstance = this.pool_;
187
189
  if (sessionPoolInstance) {
188
190
  sessionPoolInstance._observabilityOptions =