@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.
- package/CHANGELOG.md +35 -0
- package/README.md +16 -18
- package/build/protos/google/spanner/admin/database/v1/backup.proto +4 -1
- package/build/protos/google/spanner/admin/database/v1/common.proto +14 -1
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +14 -4
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +8 -5
- package/build/protos/google/spanner/v1/commit_response.proto +3 -3
- package/build/protos/google/spanner/v1/keys.proto +1 -1
- package/build/protos/google/spanner/v1/mutation.proto +6 -5
- package/build/protos/google/spanner/v1/query_plan.proto +19 -19
- package/build/protos/google/spanner/v1/result_set.proto +2 -1
- package/build/protos/google/spanner/v1/spanner.proto +21 -19
- package/build/protos/google/spanner/v1/transaction.proto +20 -32
- package/build/protos/google/spanner/v1/type.proto +34 -7
- package/build/protos/protos.d.ts +382 -345
- package/build/protos/protos.js +1022 -837
- package/build/protos/protos.json +168 -108
- package/build/src/codec.js +2 -1
- package/build/src/database.d.ts +1 -1
- package/build/src/database.js +2 -2
- package/build/src/index.d.ts +3 -3
- package/build/src/index.js +7 -7
- package/build/src/instance.d.ts +4 -4
- package/build/src/instance.js +6 -5
- package/build/src/partial-result-stream.d.ts +1 -1
- package/build/src/partial-result-stream.js +5 -1
- package/build/src/session-pool.d.ts +4 -4
- package/build/src/session-pool.js +6 -6
- package/build/src/transaction.js +1 -1
- package/build/src/v1/database_admin_client.d.ts +9 -4
- package/build/src/v1/database_admin_client.js +7 -7
- package/build/src/v1/instance_admin_client.js +2 -3
- package/build/src/v1/spanner_client.d.ts +1 -31
- package/build/src/v1/spanner_client.js +11 -9
- package/package.json +4 -4
package/build/protos/protos.json
CHANGED
|
@@ -1309,6 +1309,13 @@
|
|
|
1309
1309
|
"options": {
|
|
1310
1310
|
"(google.api.field_behavior)": "OUTPUT_ONLY"
|
|
1311
1311
|
}
|
|
1312
|
+
},
|
|
1313
|
+
"databaseDialect": {
|
|
1314
|
+
"type": "DatabaseDialect",
|
|
1315
|
+
"id": 10,
|
|
1316
|
+
"options": {
|
|
1317
|
+
"(google.api.field_behavior)": "OUTPUT_ONLY"
|
|
1318
|
+
}
|
|
1312
1319
|
}
|
|
1313
1320
|
},
|
|
1314
1321
|
"nested": {
|
|
@@ -1613,6 +1620,13 @@
|
|
|
1613
1620
|
}
|
|
1614
1621
|
}
|
|
1615
1622
|
},
|
|
1623
|
+
"DatabaseDialect": {
|
|
1624
|
+
"values": {
|
|
1625
|
+
"DATABASE_DIALECT_UNSPECIFIED": 0,
|
|
1626
|
+
"GOOGLE_STANDARD_SQL": 1,
|
|
1627
|
+
"POSTGRESQL": 2
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1616
1630
|
"DatabaseAdmin": {
|
|
1617
1631
|
"options": {
|
|
1618
1632
|
"(google.api.default_host)": "spanner.googleapis.com",
|
|
@@ -2081,6 +2095,13 @@
|
|
|
2081
2095
|
"options": {
|
|
2082
2096
|
"(google.api.field_behavior)": "OUTPUT_ONLY"
|
|
2083
2097
|
}
|
|
2098
|
+
},
|
|
2099
|
+
"databaseDialect": {
|
|
2100
|
+
"type": "DatabaseDialect",
|
|
2101
|
+
"id": 10,
|
|
2102
|
+
"options": {
|
|
2103
|
+
"(google.api.field_behavior)": "OUTPUT_ONLY"
|
|
2104
|
+
}
|
|
2084
2105
|
}
|
|
2085
2106
|
},
|
|
2086
2107
|
"nested": {
|
|
@@ -2158,6 +2179,13 @@
|
|
|
2158
2179
|
"options": {
|
|
2159
2180
|
"(google.api.field_behavior)": "OPTIONAL"
|
|
2160
2181
|
}
|
|
2182
|
+
},
|
|
2183
|
+
"databaseDialect": {
|
|
2184
|
+
"type": "DatabaseDialect",
|
|
2185
|
+
"id": 5,
|
|
2186
|
+
"options": {
|
|
2187
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
2188
|
+
}
|
|
2161
2189
|
}
|
|
2162
2190
|
}
|
|
2163
2191
|
},
|
|
@@ -2730,18 +2758,25 @@
|
|
|
2730
2758
|
"fields": {
|
|
2731
2759
|
"name": {
|
|
2732
2760
|
"type": "string",
|
|
2733
|
-
"id": 1
|
|
2761
|
+
"id": 1,
|
|
2762
|
+
"options": {
|
|
2763
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
2764
|
+
}
|
|
2734
2765
|
},
|
|
2735
2766
|
"config": {
|
|
2736
2767
|
"type": "string",
|
|
2737
2768
|
"id": 2,
|
|
2738
2769
|
"options": {
|
|
2770
|
+
"(google.api.field_behavior)": "REQUIRED",
|
|
2739
2771
|
"(google.api.resource_reference).type": "spanner.googleapis.com/InstanceConfig"
|
|
2740
2772
|
}
|
|
2741
2773
|
},
|
|
2742
2774
|
"displayName": {
|
|
2743
2775
|
"type": "string",
|
|
2744
|
-
"id": 3
|
|
2776
|
+
"id": 3,
|
|
2777
|
+
"options": {
|
|
2778
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
2779
|
+
}
|
|
2745
2780
|
},
|
|
2746
2781
|
"nodeCount": {
|
|
2747
2782
|
"type": "int32",
|
|
@@ -3106,7 +3141,10 @@
|
|
|
3106
3141
|
"fields": {
|
|
3107
3142
|
"table": {
|
|
3108
3143
|
"type": "string",
|
|
3109
|
-
"id": 1
|
|
3144
|
+
"id": 1,
|
|
3145
|
+
"options": {
|
|
3146
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
3147
|
+
}
|
|
3110
3148
|
},
|
|
3111
3149
|
"columns": {
|
|
3112
3150
|
"rule": "repeated",
|
|
@@ -3124,11 +3162,17 @@
|
|
|
3124
3162
|
"fields": {
|
|
3125
3163
|
"table": {
|
|
3126
3164
|
"type": "string",
|
|
3127
|
-
"id": 1
|
|
3165
|
+
"id": 1,
|
|
3166
|
+
"options": {
|
|
3167
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
3168
|
+
}
|
|
3128
3169
|
},
|
|
3129
3170
|
"keySet": {
|
|
3130
3171
|
"type": "KeySet",
|
|
3131
|
-
"id": 2
|
|
3172
|
+
"id": 2,
|
|
3173
|
+
"options": {
|
|
3174
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
3175
|
+
}
|
|
3132
3176
|
}
|
|
3133
3177
|
}
|
|
3134
3178
|
}
|
|
@@ -3167,6 +3211,13 @@
|
|
|
3167
3211
|
}
|
|
3168
3212
|
},
|
|
3169
3213
|
"nested": {
|
|
3214
|
+
"Kind": {
|
|
3215
|
+
"values": {
|
|
3216
|
+
"KIND_UNSPECIFIED": 0,
|
|
3217
|
+
"RELATIONAL": 1,
|
|
3218
|
+
"SCALAR": 2
|
|
3219
|
+
}
|
|
3220
|
+
},
|
|
3170
3221
|
"ChildLink": {
|
|
3171
3222
|
"fields": {
|
|
3172
3223
|
"childIndex": {
|
|
@@ -3195,13 +3246,6 @@
|
|
|
3195
3246
|
"id": 2
|
|
3196
3247
|
}
|
|
3197
3248
|
}
|
|
3198
|
-
},
|
|
3199
|
-
"Kind": {
|
|
3200
|
-
"values": {
|
|
3201
|
-
"KIND_UNSPECIFIED": 0,
|
|
3202
|
-
"RELATIONAL": 1,
|
|
3203
|
-
"SCALAR": 2
|
|
3204
|
-
}
|
|
3205
3249
|
}
|
|
3206
3250
|
}
|
|
3207
3251
|
},
|
|
@@ -3421,6 +3465,10 @@
|
|
|
3421
3465
|
"structType": {
|
|
3422
3466
|
"type": "StructType",
|
|
3423
3467
|
"id": 3
|
|
3468
|
+
},
|
|
3469
|
+
"typeAnnotation": {
|
|
3470
|
+
"type": "TypeAnnotationCode",
|
|
3471
|
+
"id": 4
|
|
3424
3472
|
}
|
|
3425
3473
|
}
|
|
3426
3474
|
},
|
|
@@ -3463,6 +3511,12 @@
|
|
|
3463
3511
|
"JSON": 11
|
|
3464
3512
|
}
|
|
3465
3513
|
},
|
|
3514
|
+
"TypeAnnotationCode": {
|
|
3515
|
+
"values": {
|
|
3516
|
+
"TYPE_ANNOTATION_CODE_UNSPECIFIED": 0,
|
|
3517
|
+
"PG_NUMERIC": 2
|
|
3518
|
+
}
|
|
3519
|
+
},
|
|
3466
3520
|
"Spanner": {
|
|
3467
3521
|
"options": {
|
|
3468
3522
|
"(google.api.default_host)": "spanner.googleapis.com",
|
|
@@ -3754,7 +3808,10 @@
|
|
|
3754
3808
|
},
|
|
3755
3809
|
"session": {
|
|
3756
3810
|
"type": "Session",
|
|
3757
|
-
"id": 2
|
|
3811
|
+
"id": 2,
|
|
3812
|
+
"options": {
|
|
3813
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
3814
|
+
}
|
|
3758
3815
|
}
|
|
3759
3816
|
}
|
|
3760
3817
|
},
|
|
@@ -3967,6 +4024,13 @@
|
|
|
3967
4024
|
}
|
|
3968
4025
|
},
|
|
3969
4026
|
"nested": {
|
|
4027
|
+
"QueryMode": {
|
|
4028
|
+
"values": {
|
|
4029
|
+
"NORMAL": 0,
|
|
4030
|
+
"PLAN": 1,
|
|
4031
|
+
"PROFILE": 2
|
|
4032
|
+
}
|
|
4033
|
+
},
|
|
3970
4034
|
"QueryOptions": {
|
|
3971
4035
|
"fields": {
|
|
3972
4036
|
"optimizerVersion": {
|
|
@@ -3978,13 +4042,6 @@
|
|
|
3978
4042
|
"id": 2
|
|
3979
4043
|
}
|
|
3980
4044
|
}
|
|
3981
|
-
},
|
|
3982
|
-
"QueryMode": {
|
|
3983
|
-
"values": {
|
|
3984
|
-
"NORMAL": 0,
|
|
3985
|
-
"PLAN": 1,
|
|
3986
|
-
"PROFILE": 2
|
|
3987
|
-
}
|
|
3988
4045
|
}
|
|
3989
4046
|
}
|
|
3990
4047
|
},
|
|
@@ -4030,7 +4087,10 @@
|
|
|
4030
4087
|
"fields": {
|
|
4031
4088
|
"sql": {
|
|
4032
4089
|
"type": "string",
|
|
4033
|
-
"id": 1
|
|
4090
|
+
"id": 1,
|
|
4091
|
+
"options": {
|
|
4092
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
4093
|
+
}
|
|
4034
4094
|
},
|
|
4035
4095
|
"params": {
|
|
4036
4096
|
"type": "google.protobuf.Struct",
|
|
@@ -4325,6 +4385,93 @@
|
|
|
4325
4385
|
"cc_enable_arenas": true
|
|
4326
4386
|
},
|
|
4327
4387
|
"nested": {
|
|
4388
|
+
"http": {
|
|
4389
|
+
"type": "HttpRule",
|
|
4390
|
+
"id": 72295728,
|
|
4391
|
+
"extend": "google.protobuf.MethodOptions"
|
|
4392
|
+
},
|
|
4393
|
+
"Http": {
|
|
4394
|
+
"fields": {
|
|
4395
|
+
"rules": {
|
|
4396
|
+
"rule": "repeated",
|
|
4397
|
+
"type": "HttpRule",
|
|
4398
|
+
"id": 1
|
|
4399
|
+
},
|
|
4400
|
+
"fullyDecodeReservedExpansion": {
|
|
4401
|
+
"type": "bool",
|
|
4402
|
+
"id": 2
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
},
|
|
4406
|
+
"HttpRule": {
|
|
4407
|
+
"oneofs": {
|
|
4408
|
+
"pattern": {
|
|
4409
|
+
"oneof": [
|
|
4410
|
+
"get",
|
|
4411
|
+
"put",
|
|
4412
|
+
"post",
|
|
4413
|
+
"delete",
|
|
4414
|
+
"patch",
|
|
4415
|
+
"custom"
|
|
4416
|
+
]
|
|
4417
|
+
}
|
|
4418
|
+
},
|
|
4419
|
+
"fields": {
|
|
4420
|
+
"selector": {
|
|
4421
|
+
"type": "string",
|
|
4422
|
+
"id": 1
|
|
4423
|
+
},
|
|
4424
|
+
"get": {
|
|
4425
|
+
"type": "string",
|
|
4426
|
+
"id": 2
|
|
4427
|
+
},
|
|
4428
|
+
"put": {
|
|
4429
|
+
"type": "string",
|
|
4430
|
+
"id": 3
|
|
4431
|
+
},
|
|
4432
|
+
"post": {
|
|
4433
|
+
"type": "string",
|
|
4434
|
+
"id": 4
|
|
4435
|
+
},
|
|
4436
|
+
"delete": {
|
|
4437
|
+
"type": "string",
|
|
4438
|
+
"id": 5
|
|
4439
|
+
},
|
|
4440
|
+
"patch": {
|
|
4441
|
+
"type": "string",
|
|
4442
|
+
"id": 6
|
|
4443
|
+
},
|
|
4444
|
+
"custom": {
|
|
4445
|
+
"type": "CustomHttpPattern",
|
|
4446
|
+
"id": 8
|
|
4447
|
+
},
|
|
4448
|
+
"body": {
|
|
4449
|
+
"type": "string",
|
|
4450
|
+
"id": 7
|
|
4451
|
+
},
|
|
4452
|
+
"responseBody": {
|
|
4453
|
+
"type": "string",
|
|
4454
|
+
"id": 12
|
|
4455
|
+
},
|
|
4456
|
+
"additionalBindings": {
|
|
4457
|
+
"rule": "repeated",
|
|
4458
|
+
"type": "HttpRule",
|
|
4459
|
+
"id": 11
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
},
|
|
4463
|
+
"CustomHttpPattern": {
|
|
4464
|
+
"fields": {
|
|
4465
|
+
"kind": {
|
|
4466
|
+
"type": "string",
|
|
4467
|
+
"id": 1
|
|
4468
|
+
},
|
|
4469
|
+
"path": {
|
|
4470
|
+
"type": "string",
|
|
4471
|
+
"id": 2
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
},
|
|
4328
4475
|
"fieldBehavior": {
|
|
4329
4476
|
"rule": "repeated",
|
|
4330
4477
|
"type": "google.api.FieldBehavior",
|
|
@@ -4420,93 +4567,6 @@
|
|
|
4420
4567
|
}
|
|
4421
4568
|
}
|
|
4422
4569
|
},
|
|
4423
|
-
"http": {
|
|
4424
|
-
"type": "HttpRule",
|
|
4425
|
-
"id": 72295728,
|
|
4426
|
-
"extend": "google.protobuf.MethodOptions"
|
|
4427
|
-
},
|
|
4428
|
-
"Http": {
|
|
4429
|
-
"fields": {
|
|
4430
|
-
"rules": {
|
|
4431
|
-
"rule": "repeated",
|
|
4432
|
-
"type": "HttpRule",
|
|
4433
|
-
"id": 1
|
|
4434
|
-
},
|
|
4435
|
-
"fullyDecodeReservedExpansion": {
|
|
4436
|
-
"type": "bool",
|
|
4437
|
-
"id": 2
|
|
4438
|
-
}
|
|
4439
|
-
}
|
|
4440
|
-
},
|
|
4441
|
-
"HttpRule": {
|
|
4442
|
-
"oneofs": {
|
|
4443
|
-
"pattern": {
|
|
4444
|
-
"oneof": [
|
|
4445
|
-
"get",
|
|
4446
|
-
"put",
|
|
4447
|
-
"post",
|
|
4448
|
-
"delete",
|
|
4449
|
-
"patch",
|
|
4450
|
-
"custom"
|
|
4451
|
-
]
|
|
4452
|
-
}
|
|
4453
|
-
},
|
|
4454
|
-
"fields": {
|
|
4455
|
-
"selector": {
|
|
4456
|
-
"type": "string",
|
|
4457
|
-
"id": 1
|
|
4458
|
-
},
|
|
4459
|
-
"get": {
|
|
4460
|
-
"type": "string",
|
|
4461
|
-
"id": 2
|
|
4462
|
-
},
|
|
4463
|
-
"put": {
|
|
4464
|
-
"type": "string",
|
|
4465
|
-
"id": 3
|
|
4466
|
-
},
|
|
4467
|
-
"post": {
|
|
4468
|
-
"type": "string",
|
|
4469
|
-
"id": 4
|
|
4470
|
-
},
|
|
4471
|
-
"delete": {
|
|
4472
|
-
"type": "string",
|
|
4473
|
-
"id": 5
|
|
4474
|
-
},
|
|
4475
|
-
"patch": {
|
|
4476
|
-
"type": "string",
|
|
4477
|
-
"id": 6
|
|
4478
|
-
},
|
|
4479
|
-
"custom": {
|
|
4480
|
-
"type": "CustomHttpPattern",
|
|
4481
|
-
"id": 8
|
|
4482
|
-
},
|
|
4483
|
-
"body": {
|
|
4484
|
-
"type": "string",
|
|
4485
|
-
"id": 7
|
|
4486
|
-
},
|
|
4487
|
-
"responseBody": {
|
|
4488
|
-
"type": "string",
|
|
4489
|
-
"id": 12
|
|
4490
|
-
},
|
|
4491
|
-
"additionalBindings": {
|
|
4492
|
-
"rule": "repeated",
|
|
4493
|
-
"type": "HttpRule",
|
|
4494
|
-
"id": 11
|
|
4495
|
-
}
|
|
4496
|
-
}
|
|
4497
|
-
},
|
|
4498
|
-
"CustomHttpPattern": {
|
|
4499
|
-
"fields": {
|
|
4500
|
-
"kind": {
|
|
4501
|
-
"type": "string",
|
|
4502
|
-
"id": 1
|
|
4503
|
-
},
|
|
4504
|
-
"path": {
|
|
4505
|
-
"type": "string",
|
|
4506
|
-
"id": 2
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
|
-
},
|
|
4510
4570
|
"methodSignature": {
|
|
4511
4571
|
"rule": "repeated",
|
|
4512
4572
|
"type": "string",
|
package/build/src/codec.js
CHANGED
|
@@ -22,6 +22,7 @@ const arrify = require("arrify");
|
|
|
22
22
|
const big_js_1 = require("big.js");
|
|
23
23
|
const is = require("is");
|
|
24
24
|
const protos_1 = require("../protos/protos");
|
|
25
|
+
const google_gax_1 = require("google-gax");
|
|
25
26
|
/**
|
|
26
27
|
* Date-like object used to represent Cloud Spanner Dates. DATE types represent
|
|
27
28
|
* a logical calendar date, independent of time zone. DATE values do not
|
|
@@ -117,7 +118,7 @@ class Int extends WrappedNumber {
|
|
|
117
118
|
valueOf() {
|
|
118
119
|
const num = Number(this.value);
|
|
119
120
|
if (num > Number.MAX_SAFE_INTEGER) {
|
|
120
|
-
throw new
|
|
121
|
+
throw new google_gax_1.GoogleError(`Integer ${this.value} is out of bounds.`);
|
|
121
122
|
}
|
|
122
123
|
return num;
|
|
123
124
|
}
|
package/build/src/database.d.ts
CHANGED
|
@@ -1547,7 +1547,7 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
1547
1547
|
/**
|
|
1548
1548
|
* Get a reference to a Table object.
|
|
1549
1549
|
*
|
|
1550
|
-
* @throws {
|
|
1550
|
+
* @throws {GoogleError} If a name is not provided.
|
|
1551
1551
|
*
|
|
1552
1552
|
* @param {string} name The name of the table.
|
|
1553
1553
|
* @return {Table} A Table object.
|
package/build/src/database.js
CHANGED
|
@@ -1048,7 +1048,7 @@ class Database extends common.GrpcServiceObject {
|
|
|
1048
1048
|
/**
|
|
1049
1049
|
* Get a reference to a Table object.
|
|
1050
1050
|
*
|
|
1051
|
-
* @throws {
|
|
1051
|
+
* @throws {GoogleError} If a name is not provided.
|
|
1052
1052
|
*
|
|
1053
1053
|
* @param {string} name The name of the table.
|
|
1054
1054
|
* @return {Table} A Table object.
|
|
@@ -1066,7 +1066,7 @@ class Database extends common.GrpcServiceObject {
|
|
|
1066
1066
|
*/
|
|
1067
1067
|
table(name) {
|
|
1068
1068
|
if (!name) {
|
|
1069
|
-
throw new
|
|
1069
|
+
throw new google_gax_1.GoogleError('A name is required to access a Table object.');
|
|
1070
1070
|
}
|
|
1071
1071
|
return new table_1.Table(this, name);
|
|
1072
1072
|
}
|
package/build/src/index.d.ts
CHANGED
|
@@ -199,8 +199,8 @@ declare class Spanner extends GrpcService {
|
|
|
199
199
|
* @see {@link v1.InstanceAdminClient#createInstance}
|
|
200
200
|
* @see [CreateInstace API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance)
|
|
201
201
|
*
|
|
202
|
-
* @throws {
|
|
203
|
-
* @throws {
|
|
202
|
+
* @throws {GoogleError} If a name is not provided.
|
|
203
|
+
* @throws {GoogleError} If a configuration object is not provided.
|
|
204
204
|
*
|
|
205
205
|
* @param {string} name The name of the instance to be created.
|
|
206
206
|
* @param {CreateInstanceRequest} config Configuration object.
|
|
@@ -556,7 +556,7 @@ declare class Spanner extends GrpcService {
|
|
|
556
556
|
/**
|
|
557
557
|
* Get a reference to an Instance object.
|
|
558
558
|
*
|
|
559
|
-
* @throws {
|
|
559
|
+
* @throws {GoogleError} If a name is not provided.
|
|
560
560
|
*
|
|
561
561
|
* @param {string} name The name of the instance.
|
|
562
562
|
* @returns {Instance} An Instance object.
|
package/build/src/index.js
CHANGED
|
@@ -156,14 +156,14 @@ class Spanner extends service_1.GrpcService {
|
|
|
156
156
|
if (endpointWithPort) {
|
|
157
157
|
if (endpointWithPort.startsWith('http:') ||
|
|
158
158
|
endpointWithPort.startsWith('https:')) {
|
|
159
|
-
throw new
|
|
159
|
+
throw new google_gax_1.GoogleError('SPANNER_EMULATOR_HOST must not start with a protocol specification (http/https)');
|
|
160
160
|
}
|
|
161
161
|
const index = endpointWithPort.indexOf(':');
|
|
162
162
|
if (index > -1) {
|
|
163
163
|
const portName = endpointWithPort.substring(index + 1);
|
|
164
164
|
const port = +portName;
|
|
165
165
|
if (!port || port < 1 || port > 65535) {
|
|
166
|
-
throw new
|
|
166
|
+
throw new google_gax_1.GoogleError(`Invalid port number: ${portName}`);
|
|
167
167
|
}
|
|
168
168
|
return {
|
|
169
169
|
endpoint: endpointWithPort.substring(0, index),
|
|
@@ -187,10 +187,10 @@ class Spanner extends service_1.GrpcService {
|
|
|
187
187
|
}
|
|
188
188
|
createInstance(name, config, callback) {
|
|
189
189
|
if (!name) {
|
|
190
|
-
throw new
|
|
190
|
+
throw new google_gax_1.GoogleError('A name is required to create an instance.');
|
|
191
191
|
}
|
|
192
192
|
if (!config) {
|
|
193
|
-
throw new
|
|
193
|
+
throw new google_gax_1.GoogleError(['A configuration object is required to create an instance.'].join(''));
|
|
194
194
|
}
|
|
195
195
|
const formattedName = instance_1.Instance.formatName_(this.projectId, name);
|
|
196
196
|
const displayName = config.displayName || formattedName.split('/').pop();
|
|
@@ -205,7 +205,7 @@ class Spanner extends service_1.GrpcService {
|
|
|
205
205
|
}, config),
|
|
206
206
|
};
|
|
207
207
|
if (reqOpts.instance.nodeCount && reqOpts.instance.processingUnits) {
|
|
208
|
-
throw new
|
|
208
|
+
throw new google_gax_1.GoogleError(['Only one of nodeCount or processingUnits can be specified.'].join(''));
|
|
209
209
|
}
|
|
210
210
|
if (!reqOpts.instance.nodeCount && !reqOpts.instance.processingUnits) {
|
|
211
211
|
// If neither nodes nor processingUnits are specified, default to a
|
|
@@ -450,7 +450,7 @@ class Spanner extends service_1.GrpcService {
|
|
|
450
450
|
/**
|
|
451
451
|
* Get a reference to an Instance object.
|
|
452
452
|
*
|
|
453
|
-
* @throws {
|
|
453
|
+
* @throws {GoogleError} If a name is not provided.
|
|
454
454
|
*
|
|
455
455
|
* @param {string} name The name of the instance.
|
|
456
456
|
* @returns {Instance} An Instance object.
|
|
@@ -464,7 +464,7 @@ class Spanner extends service_1.GrpcService {
|
|
|
464
464
|
*/
|
|
465
465
|
instance(name) {
|
|
466
466
|
if (!name) {
|
|
467
|
-
throw new
|
|
467
|
+
throw new google_gax_1.GoogleError('A name is required to access an Instance object.');
|
|
468
468
|
}
|
|
469
469
|
const key = name.split('/').pop();
|
|
470
470
|
if (!this.instances_.has(key)) {
|
package/build/src/instance.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare type GetDatabaseOperationsResponse = PagedResponse<IOperation, da
|
|
|
49
49
|
export interface CreateDatabaseOptions extends databaseAdmin.spanner.admin.database.v1.ICreateDatabaseRequest {
|
|
50
50
|
poolOptions?: SessionPoolOptions;
|
|
51
51
|
poolCtor?: SessionPool;
|
|
52
|
-
schema?: string;
|
|
52
|
+
schema?: string | string[];
|
|
53
53
|
gaxOptions?: CallOptions;
|
|
54
54
|
}
|
|
55
55
|
export declare type GetDatabasesOptions = PagedOptions;
|
|
@@ -105,7 +105,7 @@ declare class Instance extends common.GrpcServiceObject {
|
|
|
105
105
|
/**
|
|
106
106
|
* Get a reference to a Backup object.
|
|
107
107
|
*
|
|
108
|
-
* @throws {
|
|
108
|
+
* @throws {GoogleError} If any parameter is not provided.
|
|
109
109
|
*
|
|
110
110
|
* @param {string} backupId The name of the backup.
|
|
111
111
|
* @return {Backup} A Backup object.
|
|
@@ -317,7 +317,7 @@ declare class Instance extends common.GrpcServiceObject {
|
|
|
317
317
|
* @see {@link v1.DatabaseAdminClient#createDatabase}
|
|
318
318
|
* @see [CreateDatabase API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase)
|
|
319
319
|
*
|
|
320
|
-
* @throws {
|
|
320
|
+
* @throws {GoogleError} If a name is not provided.
|
|
321
321
|
*
|
|
322
322
|
* @param {name} name The name of the database to create.
|
|
323
323
|
* @param {CreateDatabaseRequest} [options] Configuration object.
|
|
@@ -379,7 +379,7 @@ declare class Instance extends common.GrpcServiceObject {
|
|
|
379
379
|
/**
|
|
380
380
|
* Get a reference to a Database object.
|
|
381
381
|
*
|
|
382
|
-
* @throws {
|
|
382
|
+
* @throws {GoogleError} If a name is not provided.
|
|
383
383
|
*
|
|
384
384
|
* @param {string} name The name of the instance.
|
|
385
385
|
* @param {SessionPoolOptions|SessionPoolCtor} [poolOptions] Session pool
|
package/build/src/instance.js
CHANGED
|
@@ -24,6 +24,7 @@ const extend = require("extend");
|
|
|
24
24
|
const snakeCase = require("lodash.snakecase");
|
|
25
25
|
const database_1 = require("./database");
|
|
26
26
|
const common_1 = require("./common");
|
|
27
|
+
const google_gax_1 = require("google-gax");
|
|
27
28
|
const backup_1 = require("./backup");
|
|
28
29
|
/**
|
|
29
30
|
* The {@link Instance} class represents a [Cloud Spanner
|
|
@@ -119,7 +120,7 @@ class Instance extends common.GrpcServiceObject {
|
|
|
119
120
|
/**
|
|
120
121
|
* Get a reference to a Backup object.
|
|
121
122
|
*
|
|
122
|
-
* @throws {
|
|
123
|
+
* @throws {GoogleError} If any parameter is not provided.
|
|
123
124
|
*
|
|
124
125
|
* @param {string} backupId The name of the backup.
|
|
125
126
|
* @return {Backup} A Backup object.
|
|
@@ -134,7 +135,7 @@ class Instance extends common.GrpcServiceObject {
|
|
|
134
135
|
*/
|
|
135
136
|
backup(backupId) {
|
|
136
137
|
if (!backupId) {
|
|
137
|
-
throw new
|
|
138
|
+
throw new google_gax_1.GoogleError('A backup ID is required to create a Backup.');
|
|
138
139
|
}
|
|
139
140
|
return new backup_1.Backup(this, backupId);
|
|
140
141
|
}
|
|
@@ -385,7 +386,7 @@ class Instance extends common.GrpcServiceObject {
|
|
|
385
386
|
}
|
|
386
387
|
createDatabase(name, optionsOrCallback, cb) {
|
|
387
388
|
if (!name) {
|
|
388
|
-
throw new
|
|
389
|
+
throw new google_gax_1.GoogleError('A name is required to create a database.');
|
|
389
390
|
}
|
|
390
391
|
const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
|
|
391
392
|
const options = typeof optionsOrCallback === 'object'
|
|
@@ -422,7 +423,7 @@ class Instance extends common.GrpcServiceObject {
|
|
|
422
423
|
/**
|
|
423
424
|
* Get a reference to a Database object.
|
|
424
425
|
*
|
|
425
|
-
* @throws {
|
|
426
|
+
* @throws {GoogleError} If a name is not provided.
|
|
426
427
|
*
|
|
427
428
|
* @param {string} name The name of the instance.
|
|
428
429
|
* @param {SessionPoolOptions|SessionPoolCtor} [poolOptions] Session pool
|
|
@@ -444,7 +445,7 @@ class Instance extends common.GrpcServiceObject {
|
|
|
444
445
|
*/
|
|
445
446
|
database(name, poolOptions, queryOptions) {
|
|
446
447
|
if (!name) {
|
|
447
|
-
throw new
|
|
448
|
+
throw new google_gax_1.GoogleError('A name is required to access a Database object.');
|
|
448
449
|
}
|
|
449
450
|
// Only add an additional key for SessionPoolOptions and QueryOptions if an
|
|
450
451
|
// options object with at least one value was passed in.
|
|
@@ -127,7 +127,7 @@ export declare class PartialResultStream extends Transform implements ResultEven
|
|
|
127
127
|
*
|
|
128
128
|
* @param {Error} [err] Optional error to destroy stream with.
|
|
129
129
|
*/
|
|
130
|
-
destroy(err?: Error):
|
|
130
|
+
destroy(err?: Error): this;
|
|
131
131
|
/**
|
|
132
132
|
* Processes each chunk.
|
|
133
133
|
*
|
|
@@ -51,7 +51,7 @@ class PartialResultStream extends stream_1.Transform {
|
|
|
51
51
|
*/
|
|
52
52
|
destroy(err) {
|
|
53
53
|
if (this._destroyed) {
|
|
54
|
-
return;
|
|
54
|
+
return this;
|
|
55
55
|
}
|
|
56
56
|
this._destroyed = true;
|
|
57
57
|
process.nextTick(() => {
|
|
@@ -60,6 +60,7 @@ class PartialResultStream extends stream_1.Transform {
|
|
|
60
60
|
}
|
|
61
61
|
this.emit('close');
|
|
62
62
|
});
|
|
63
|
+
return this;
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
65
66
|
* Processes each chunk.
|
|
@@ -224,6 +225,9 @@ class PartialResultStream extends stream_1.Transform {
|
|
|
224
225
|
type.code === 'ARRAY' ||
|
|
225
226
|
type.code === protos_1.google.spanner.v1.TypeCode.STRUCT ||
|
|
226
227
|
type.code === 'STRUCT') {
|
|
228
|
+
if (head === null || tail === null) {
|
|
229
|
+
return [head, tail];
|
|
230
|
+
}
|
|
227
231
|
return [PartialResultStream.mergeLists(type, head, tail)];
|
|
228
232
|
}
|
|
229
233
|
if (is.string(head) && is.string(tail)) {
|