@google-cloud/spanner 7.1.0 → 7.3.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 +29 -0
- package/README.md +1 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +40 -0
- package/build/protos/google/spanner/v1/spanner.proto +13 -3
- package/build/protos/google/spanner/v1/type.proto +18 -0
- package/build/protos/protos.d.ts +287 -30
- package/build/protos/protos.js +1134 -120
- package/build/protos/protos.json +116 -36
- package/build/src/common-grpc/service.js +2 -2
- package/build/src/index.d.ts +5 -0
- package/build/src/index.js +7 -1
- package/build/src/session-pool.js +2 -0
- package/build/src/transaction.d.ts +17 -1
- package/build/src/transaction.js +29 -2
- package/build/src/v1/database_admin_client.d.ts +42 -2
- package/build/src/v1/database_admin_client.js +37 -10
- package/build/src/v1/instance_admin_client.d.ts +11 -2
- package/build/src/v1/instance_admin_client.js +37 -10
- package/build/src/v1/spanner_client.d.ts +21 -5
- package/build/src/v1/spanner_client.js +43 -13
- package/package.json +11 -11
package/build/protos/protos.json
CHANGED
|
@@ -34,6 +34,21 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"Edition": {
|
|
38
|
+
"values": {
|
|
39
|
+
"EDITION_UNKNOWN": 0,
|
|
40
|
+
"EDITION_PROTO2": 998,
|
|
41
|
+
"EDITION_PROTO3": 999,
|
|
42
|
+
"EDITION_2023": 1000,
|
|
43
|
+
"EDITION_2024": 1001,
|
|
44
|
+
"EDITION_1_TEST_ONLY": 1,
|
|
45
|
+
"EDITION_2_TEST_ONLY": 2,
|
|
46
|
+
"EDITION_99997_TEST_ONLY": 99997,
|
|
47
|
+
"EDITION_99998_TEST_ONLY": 99998,
|
|
48
|
+
"EDITION_99999_TEST_ONLY": 99999,
|
|
49
|
+
"EDITION_MAX": 2147483647
|
|
50
|
+
}
|
|
51
|
+
},
|
|
37
52
|
"FileDescriptorProto": {
|
|
38
53
|
"fields": {
|
|
39
54
|
"name": {
|
|
@@ -98,8 +113,8 @@
|
|
|
98
113
|
"id": 12
|
|
99
114
|
},
|
|
100
115
|
"edition": {
|
|
101
|
-
"type": "
|
|
102
|
-
"id":
|
|
116
|
+
"type": "Edition",
|
|
117
|
+
"id": 14
|
|
103
118
|
}
|
|
104
119
|
}
|
|
105
120
|
},
|
|
@@ -208,7 +223,8 @@
|
|
|
208
223
|
"type": "VerificationState",
|
|
209
224
|
"id": 3,
|
|
210
225
|
"options": {
|
|
211
|
-
"default": "UNVERIFIED"
|
|
226
|
+
"default": "UNVERIFIED",
|
|
227
|
+
"retention": "RETENTION_SOURCE"
|
|
212
228
|
}
|
|
213
229
|
}
|
|
214
230
|
},
|
|
@@ -330,8 +346,8 @@
|
|
|
330
346
|
"Label": {
|
|
331
347
|
"values": {
|
|
332
348
|
"LABEL_OPTIONAL": 1,
|
|
333
|
-
"
|
|
334
|
-
"
|
|
349
|
+
"LABEL_REPEATED": 3,
|
|
350
|
+
"LABEL_REQUIRED": 2
|
|
335
351
|
}
|
|
336
352
|
}
|
|
337
353
|
}
|
|
@@ -519,13 +535,6 @@
|
|
|
519
535
|
"default": false
|
|
520
536
|
}
|
|
521
537
|
},
|
|
522
|
-
"phpGenericServices": {
|
|
523
|
-
"type": "bool",
|
|
524
|
-
"id": 42,
|
|
525
|
-
"options": {
|
|
526
|
-
"default": false
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
538
|
"deprecated": {
|
|
530
539
|
"type": "bool",
|
|
531
540
|
"id": 23,
|
|
@@ -585,6 +594,10 @@
|
|
|
585
594
|
]
|
|
586
595
|
],
|
|
587
596
|
"reserved": [
|
|
597
|
+
[
|
|
598
|
+
42,
|
|
599
|
+
42
|
|
600
|
+
],
|
|
588
601
|
[
|
|
589
602
|
38,
|
|
590
603
|
38
|
|
@@ -810,8 +823,8 @@
|
|
|
810
823
|
"EditionDefault": {
|
|
811
824
|
"fields": {
|
|
812
825
|
"edition": {
|
|
813
|
-
"type": "
|
|
814
|
-
"id":
|
|
826
|
+
"type": "Edition",
|
|
827
|
+
"id": 3
|
|
815
828
|
},
|
|
816
829
|
"value": {
|
|
817
830
|
"type": "string",
|
|
@@ -1041,7 +1054,7 @@
|
|
|
1041
1054
|
"options": {
|
|
1042
1055
|
"retention": "RETENTION_RUNTIME",
|
|
1043
1056
|
"targets": "TARGET_TYPE_FILE",
|
|
1044
|
-
"edition_defaults.edition": "
|
|
1057
|
+
"edition_defaults.edition": "EDITION_2023",
|
|
1045
1058
|
"edition_defaults.value": "EXPLICIT"
|
|
1046
1059
|
}
|
|
1047
1060
|
},
|
|
@@ -1051,7 +1064,7 @@
|
|
|
1051
1064
|
"options": {
|
|
1052
1065
|
"retention": "RETENTION_RUNTIME",
|
|
1053
1066
|
"targets": "TARGET_TYPE_FILE",
|
|
1054
|
-
"edition_defaults.edition": "
|
|
1067
|
+
"edition_defaults.edition": "EDITION_PROTO3",
|
|
1055
1068
|
"edition_defaults.value": "OPEN"
|
|
1056
1069
|
}
|
|
1057
1070
|
},
|
|
@@ -1061,18 +1074,18 @@
|
|
|
1061
1074
|
"options": {
|
|
1062
1075
|
"retention": "RETENTION_RUNTIME",
|
|
1063
1076
|
"targets": "TARGET_TYPE_FILE",
|
|
1064
|
-
"edition_defaults.edition": "
|
|
1077
|
+
"edition_defaults.edition": "EDITION_PROTO3",
|
|
1065
1078
|
"edition_defaults.value": "PACKED"
|
|
1066
1079
|
}
|
|
1067
1080
|
},
|
|
1068
|
-
"
|
|
1069
|
-
"type": "
|
|
1081
|
+
"utf8Validation": {
|
|
1082
|
+
"type": "Utf8Validation",
|
|
1070
1083
|
"id": 4,
|
|
1071
1084
|
"options": {
|
|
1072
1085
|
"retention": "RETENTION_RUNTIME",
|
|
1073
1086
|
"targets": "TARGET_TYPE_FILE",
|
|
1074
|
-
"edition_defaults.edition": "
|
|
1075
|
-
"edition_defaults.value": "
|
|
1087
|
+
"edition_defaults.edition": "EDITION_PROTO3",
|
|
1088
|
+
"edition_defaults.value": "VERIFY"
|
|
1076
1089
|
}
|
|
1077
1090
|
},
|
|
1078
1091
|
"messageEncoding": {
|
|
@@ -1081,7 +1094,7 @@
|
|
|
1081
1094
|
"options": {
|
|
1082
1095
|
"retention": "RETENTION_RUNTIME",
|
|
1083
1096
|
"targets": "TARGET_TYPE_FILE",
|
|
1084
|
-
"edition_defaults.edition": "
|
|
1097
|
+
"edition_defaults.edition": "EDITION_PROTO2",
|
|
1085
1098
|
"edition_defaults.value": "LENGTH_PREFIXED"
|
|
1086
1099
|
}
|
|
1087
1100
|
},
|
|
@@ -1091,16 +1104,9 @@
|
|
|
1091
1104
|
"options": {
|
|
1092
1105
|
"retention": "RETENTION_RUNTIME",
|
|
1093
1106
|
"targets": "TARGET_TYPE_FILE",
|
|
1094
|
-
"edition_defaults.edition": "
|
|
1107
|
+
"edition_defaults.edition": "EDITION_PROTO3",
|
|
1095
1108
|
"edition_defaults.value": "ALLOW"
|
|
1096
1109
|
}
|
|
1097
|
-
},
|
|
1098
|
-
"rawFeatures": {
|
|
1099
|
-
"type": "FeatureSet",
|
|
1100
|
-
"id": 999,
|
|
1101
|
-
"options": {
|
|
1102
|
-
"targets": "TARGET_TYPE_UNKNOWN"
|
|
1103
|
-
}
|
|
1104
1110
|
}
|
|
1105
1111
|
},
|
|
1106
1112
|
"extensions": [
|
|
@@ -1117,6 +1123,12 @@
|
|
|
1117
1123
|
9999
|
|
1118
1124
|
]
|
|
1119
1125
|
],
|
|
1126
|
+
"reserved": [
|
|
1127
|
+
[
|
|
1128
|
+
999,
|
|
1129
|
+
999
|
|
1130
|
+
]
|
|
1131
|
+
],
|
|
1120
1132
|
"nested": {
|
|
1121
1133
|
"FieldPresence": {
|
|
1122
1134
|
"values": {
|
|
@@ -1140,11 +1152,10 @@
|
|
|
1140
1152
|
"EXPANDED": 2
|
|
1141
1153
|
}
|
|
1142
1154
|
},
|
|
1143
|
-
"
|
|
1155
|
+
"Utf8Validation": {
|
|
1144
1156
|
"values": {
|
|
1145
|
-
"
|
|
1146
|
-
"
|
|
1147
|
-
"HINT": 2,
|
|
1157
|
+
"UTF8_VALIDATION_UNKNOWN": 0,
|
|
1158
|
+
"VERIFY": 2,
|
|
1148
1159
|
"NONE": 3
|
|
1149
1160
|
}
|
|
1150
1161
|
},
|
|
@@ -1164,6 +1175,37 @@
|
|
|
1164
1175
|
}
|
|
1165
1176
|
}
|
|
1166
1177
|
},
|
|
1178
|
+
"FeatureSetDefaults": {
|
|
1179
|
+
"fields": {
|
|
1180
|
+
"defaults": {
|
|
1181
|
+
"rule": "repeated",
|
|
1182
|
+
"type": "FeatureSetEditionDefault",
|
|
1183
|
+
"id": 1
|
|
1184
|
+
},
|
|
1185
|
+
"minimumEdition": {
|
|
1186
|
+
"type": "Edition",
|
|
1187
|
+
"id": 4
|
|
1188
|
+
},
|
|
1189
|
+
"maximumEdition": {
|
|
1190
|
+
"type": "Edition",
|
|
1191
|
+
"id": 5
|
|
1192
|
+
}
|
|
1193
|
+
},
|
|
1194
|
+
"nested": {
|
|
1195
|
+
"FeatureSetEditionDefault": {
|
|
1196
|
+
"fields": {
|
|
1197
|
+
"edition": {
|
|
1198
|
+
"type": "Edition",
|
|
1199
|
+
"id": 3
|
|
1200
|
+
},
|
|
1201
|
+
"features": {
|
|
1202
|
+
"type": "FeatureSet",
|
|
1203
|
+
"id": 2
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1167
1209
|
"SourceCodeInfo": {
|
|
1168
1210
|
"fields": {
|
|
1169
1211
|
"location": {
|
|
@@ -2715,6 +2757,13 @@
|
|
|
2715
2757
|
"options": {
|
|
2716
2758
|
"(google.api.field_behavior)": "OPTIONAL"
|
|
2717
2759
|
}
|
|
2760
|
+
},
|
|
2761
|
+
"protoDescriptors": {
|
|
2762
|
+
"type": "bytes",
|
|
2763
|
+
"id": 6,
|
|
2764
|
+
"options": {
|
|
2765
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
2766
|
+
}
|
|
2718
2767
|
}
|
|
2719
2768
|
}
|
|
2720
2769
|
},
|
|
@@ -2796,6 +2845,13 @@
|
|
|
2796
2845
|
"operationId": {
|
|
2797
2846
|
"type": "string",
|
|
2798
2847
|
"id": 3
|
|
2848
|
+
},
|
|
2849
|
+
"protoDescriptors": {
|
|
2850
|
+
"type": "bytes",
|
|
2851
|
+
"id": 4,
|
|
2852
|
+
"options": {
|
|
2853
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
2854
|
+
}
|
|
2799
2855
|
}
|
|
2800
2856
|
}
|
|
2801
2857
|
},
|
|
@@ -2884,6 +2940,10 @@
|
|
|
2884
2940
|
"rule": "repeated",
|
|
2885
2941
|
"type": "string",
|
|
2886
2942
|
"id": 1
|
|
2943
|
+
},
|
|
2944
|
+
"protoDescriptors": {
|
|
2945
|
+
"type": "bytes",
|
|
2946
|
+
"id": 2
|
|
2887
2947
|
}
|
|
2888
2948
|
}
|
|
2889
2949
|
},
|
|
@@ -4523,6 +4583,10 @@
|
|
|
4523
4583
|
"typeAnnotation": {
|
|
4524
4584
|
"type": "TypeAnnotationCode",
|
|
4525
4585
|
"id": 4
|
|
4586
|
+
},
|
|
4587
|
+
"protoTypeFqn": {
|
|
4588
|
+
"type": "string",
|
|
4589
|
+
"id": 5
|
|
4526
4590
|
}
|
|
4527
4591
|
}
|
|
4528
4592
|
},
|
|
@@ -4555,6 +4619,7 @@
|
|
|
4555
4619
|
"BOOL": 1,
|
|
4556
4620
|
"INT64": 2,
|
|
4557
4621
|
"FLOAT64": 3,
|
|
4622
|
+
"FLOAT32": 15,
|
|
4558
4623
|
"TIMESTAMP": 4,
|
|
4559
4624
|
"DATE": 5,
|
|
4560
4625
|
"STRING": 6,
|
|
@@ -4562,7 +4627,9 @@
|
|
|
4562
4627
|
"ARRAY": 8,
|
|
4563
4628
|
"STRUCT": 9,
|
|
4564
4629
|
"NUMERIC": 10,
|
|
4565
|
-
"JSON": 11
|
|
4630
|
+
"JSON": 11,
|
|
4631
|
+
"PROTO": 13,
|
|
4632
|
+
"ENUM": 14
|
|
4566
4633
|
}
|
|
4567
4634
|
},
|
|
4568
4635
|
"TypeAnnotationCode": {
|
|
@@ -5508,6 +5575,13 @@
|
|
|
5508
5575
|
"type": "bool",
|
|
5509
5576
|
"id": 5
|
|
5510
5577
|
},
|
|
5578
|
+
"maxCommitDelay": {
|
|
5579
|
+
"type": "google.protobuf.Duration",
|
|
5580
|
+
"id": 8,
|
|
5581
|
+
"options": {
|
|
5582
|
+
"(google.api.field_behavior)": "OPTIONAL"
|
|
5583
|
+
}
|
|
5584
|
+
},
|
|
5511
5585
|
"requestOptions": {
|
|
5512
5586
|
"type": "RequestOptions",
|
|
5513
5587
|
"id": 6
|
|
@@ -5617,7 +5691,8 @@
|
|
|
5617
5691
|
"INPUT_ONLY": 4,
|
|
5618
5692
|
"IMMUTABLE": 5,
|
|
5619
5693
|
"UNORDERED_LIST": 6,
|
|
5620
|
-
"NON_EMPTY_DEFAULT": 7
|
|
5694
|
+
"NON_EMPTY_DEFAULT": 7,
|
|
5695
|
+
"IDENTIFIER": 8
|
|
5621
5696
|
}
|
|
5622
5697
|
},
|
|
5623
5698
|
"resourceReference": {
|
|
@@ -6018,6 +6093,11 @@
|
|
|
6018
6093
|
"longRunning": {
|
|
6019
6094
|
"type": "LongRunning",
|
|
6020
6095
|
"id": 2
|
|
6096
|
+
},
|
|
6097
|
+
"autoPopulatedFields": {
|
|
6098
|
+
"rule": "repeated",
|
|
6099
|
+
"type": "string",
|
|
6100
|
+
"id": 3
|
|
6021
6101
|
}
|
|
6022
6102
|
},
|
|
6023
6103
|
"nested": {
|
|
@@ -117,8 +117,8 @@ const GRPC_ERROR_CODE_TO_HTTP = {
|
|
|
117
117
|
*/
|
|
118
118
|
const GRPC_SERVICE_OPTIONS = {
|
|
119
119
|
// RE: https://github.com/GoogleCloudPlatform/google-cloud-node/issues/1991
|
|
120
|
-
'grpc.max_send_message_length': -1,
|
|
121
|
-
'grpc.max_receive_message_length': -1,
|
|
120
|
+
'grpc.max_send_message_length': -1, // unlimited
|
|
121
|
+
'grpc.max_receive_message_length': -1, // unlimited
|
|
122
122
|
// RE: https://github.com/grpc/grpc/issues/8839
|
|
123
123
|
// RE: https://github.com/grpc/grpc/issues/8382
|
|
124
124
|
// RE: https://github.com/GoogleCloudPlatform/google-cloud-node/issues/1991
|
package/build/src/index.d.ts
CHANGED
|
@@ -50,6 +50,9 @@ export type GetInstanceConfigOperationsCallback = PagedCallback<IOperation, inst
|
|
|
50
50
|
* Session pool configuration options.
|
|
51
51
|
* @property {boolean} [routeToLeaderEnabled=True] If set to false leader aware routing will be disabled.
|
|
52
52
|
* Disabling leader aware routing would route all requests in RW/PDML transactions to any region.
|
|
53
|
+
* @property {google.spanner.v1.IDirectedReadOptions} [directedReadOptions] Sets the DirectedReadOptions for all ReadRequests and ExecuteSqlRequests for the Client.
|
|
54
|
+
* Indicates which replicas or regions should be used for non-transactional reads or queries.
|
|
55
|
+
* DirectedReadOptions won't be set for readWrite transactions"
|
|
53
56
|
*/
|
|
54
57
|
export interface SpannerOptions extends GrpcClientOptions {
|
|
55
58
|
apiEndpoint?: string;
|
|
@@ -57,6 +60,7 @@ export interface SpannerOptions extends GrpcClientOptions {
|
|
|
57
60
|
port?: number;
|
|
58
61
|
sslCreds?: grpc.ChannelCredentials;
|
|
59
62
|
routeToLeaderEnabled?: boolean;
|
|
63
|
+
directedReadOptions?: google.spanner.v1.IDirectedReadOptions | null;
|
|
60
64
|
}
|
|
61
65
|
export interface RequestConfig {
|
|
62
66
|
client: string;
|
|
@@ -161,6 +165,7 @@ declare class Spanner extends GrpcService {
|
|
|
161
165
|
[k: string]: string;
|
|
162
166
|
};
|
|
163
167
|
routeToLeaderEnabled: boolean;
|
|
168
|
+
directedReadOptions: google.spanner.v1.IDirectedReadOptions | null;
|
|
164
169
|
/**
|
|
165
170
|
* Placeholder used to auto populate a column with the commit timestamp.
|
|
166
171
|
* This can only be used for timestamp columns that have set the option
|
package/build/src/index.js
CHANGED
|
@@ -150,6 +150,10 @@ class Spanner extends service_1.GrpcService {
|
|
|
150
150
|
'grpc.gcpApiConfig': grpcGcp.createGcpApiConfig(gcpApiConfig),
|
|
151
151
|
grpc: google_gax_1.grpc,
|
|
152
152
|
}, options || {});
|
|
153
|
+
const directedReadOptions = options.directedReadOptions
|
|
154
|
+
? options.directedReadOptions
|
|
155
|
+
: null;
|
|
156
|
+
delete options.directedReadOptions;
|
|
153
157
|
const emulatorHost = Spanner.getSpannerEmulatorHost();
|
|
154
158
|
if (emulatorHost &&
|
|
155
159
|
emulatorHost.endpoint &&
|
|
@@ -161,7 +165,8 @@ class Spanner extends service_1.GrpcService {
|
|
|
161
165
|
const config = {
|
|
162
166
|
baseUrl: options.apiEndpoint ||
|
|
163
167
|
options.servicePath ||
|
|
164
|
-
|
|
168
|
+
// TODO: for TPC, this needs to support universeDomain
|
|
169
|
+
'spanner.googleapis.com',
|
|
165
170
|
protosDir: path.resolve(__dirname, '../protos'),
|
|
166
171
|
protoServices: {
|
|
167
172
|
Operations: {
|
|
@@ -187,6 +192,7 @@ class Spanner extends service_1.GrpcService {
|
|
|
187
192
|
this.resourceHeader_ = {
|
|
188
193
|
[common_1.CLOUD_RESOURCE_HEADER]: this.projectFormattedName_,
|
|
189
194
|
};
|
|
195
|
+
this.directedReadOptions = directedReadOptions;
|
|
190
196
|
}
|
|
191
197
|
/** Closes this Spanner client and cleans up all resources used by it. */
|
|
192
198
|
close() {
|
|
@@ -758,7 +758,9 @@ class SessionPool extends events_1.EventEmitter {
|
|
|
758
758
|
* @private
|
|
759
759
|
*/
|
|
760
760
|
_stopHouseKeeping() {
|
|
761
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
761
762
|
clearInterval(this._pingHandle);
|
|
763
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
762
764
|
clearInterval(this._evictHandle);
|
|
763
765
|
}
|
|
764
766
|
}
|
|
@@ -49,6 +49,7 @@ export interface RequestOptions {
|
|
|
49
49
|
export interface CommitOptions {
|
|
50
50
|
requestOptions?: Pick<IRequestOptions, 'priority'>;
|
|
51
51
|
returnCommitStats?: boolean;
|
|
52
|
+
maxCommitDelay?: spannerClient.protobuf.IDuration;
|
|
52
53
|
gaxOptions?: CallOptions;
|
|
53
54
|
}
|
|
54
55
|
export interface Statement {
|
|
@@ -68,6 +69,7 @@ export interface ExecuteSqlRequest extends Statement, RequestOptions {
|
|
|
68
69
|
queryOptions?: IQueryOptions;
|
|
69
70
|
requestOptions?: Omit<IRequestOptions, 'transactionTag'>;
|
|
70
71
|
dataBoostEnabled?: boolean | null;
|
|
72
|
+
directedReadOptions?: google.spanner.v1.IDirectedReadOptions;
|
|
71
73
|
}
|
|
72
74
|
export interface KeyRange {
|
|
73
75
|
startClosed?: Value[];
|
|
@@ -87,6 +89,7 @@ export interface ReadRequest extends RequestOptions {
|
|
|
87
89
|
partitionToken?: Uint8Array | null;
|
|
88
90
|
requestOptions?: Omit<IRequestOptions, 'transactionTag'>;
|
|
89
91
|
dataBoostEnabled?: boolean | null;
|
|
92
|
+
directedReadOptions?: google.spanner.v1.IDirectedReadOptions;
|
|
90
93
|
}
|
|
91
94
|
export interface BatchUpdateError extends grpc.ServiceError {
|
|
92
95
|
rowCounts: number[];
|
|
@@ -340,6 +343,8 @@ export declare class Snapshot extends EventEmitter {
|
|
|
340
343
|
* PartitionReadRequest message used to create this partition_token.
|
|
341
344
|
* @property {google.spanner.v1.RequestOptions} [requestOptions]
|
|
342
345
|
* Common options for this request.
|
|
346
|
+
* @property {google.spanner.v1.IDirectedReadOptions} [directedReadOptions]
|
|
347
|
+
* Indicates which replicas or regions should be used for non-transactional reads or queries.
|
|
343
348
|
* @property {object} [gaxOptions]
|
|
344
349
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
345
350
|
* for more details.
|
|
@@ -716,7 +721,7 @@ export declare class Snapshot extends EventEmitter {
|
|
|
716
721
|
* execution statistics for the SQL statement that
|
|
717
722
|
* produced this result set.
|
|
718
723
|
* @property {string} partitionToken The partition token.
|
|
719
|
-
* @property {number} seqno The Sequence number.
|
|
724
|
+
* @property {number} seqno The Sequence number. This option is used internally and will be overridden.
|
|
720
725
|
* @property {string} sql The SQL string.
|
|
721
726
|
* @property {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions]
|
|
722
727
|
* Default query options to use with the database. These options will be
|
|
@@ -740,6 +745,8 @@ export declare class Snapshot extends EventEmitter {
|
|
|
740
745
|
* that it is not ready for any more data. Increase this value if you
|
|
741
746
|
* experience 'Stream is still not ready to receive data' errors as a
|
|
742
747
|
* result of a slow writer in your receiving stream.
|
|
748
|
+
* @property {object} [directedReadOptions]
|
|
749
|
+
* Indicates which replicas or regions should be used for non-transactional reads or queries.
|
|
743
750
|
*/
|
|
744
751
|
/**
|
|
745
752
|
* Create a readable object stream to receive resulting rows from a SQL
|
|
@@ -841,6 +848,12 @@ export declare class Snapshot extends EventEmitter {
|
|
|
841
848
|
[field: string]: spannerClient.spanner.v1.Type;
|
|
842
849
|
};
|
|
843
850
|
};
|
|
851
|
+
/**
|
|
852
|
+
* Get directed read options
|
|
853
|
+
* @private
|
|
854
|
+
* @param {google.spanner.v1.IDirectedReadOptions} directedReadOptions Request directedReadOptions object.
|
|
855
|
+
*/
|
|
856
|
+
protected _getDirectedReadOptions(directedReadOptions: google.spanner.v1.IDirectedReadOptions | null | undefined): spannerClient.spanner.v1.IDirectedReadOptions | null | undefined;
|
|
844
857
|
/**
|
|
845
858
|
* Update transaction properties from the response.
|
|
846
859
|
*
|
|
@@ -1071,6 +1084,9 @@ export declare class Transaction extends Dml {
|
|
|
1071
1084
|
* with the commit request.
|
|
1072
1085
|
* @property {boolean} returnCommitStats Include statistics related to the
|
|
1073
1086
|
* transaction in the {@link CommitResponse}.
|
|
1087
|
+
* @property {spannerClient.proto.IDuration} maxCommitDelay Maximum amount
|
|
1088
|
+
* of delay the commit is willing to incur in order to improve
|
|
1089
|
+
* throughput. Value should be between 0ms and 500ms.
|
|
1074
1090
|
* @property {object} [gaxOptions] The request configuration options,
|
|
1075
1091
|
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
1076
1092
|
* for more details.
|
package/build/src/transaction.js
CHANGED
|
@@ -233,6 +233,8 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
233
233
|
* PartitionReadRequest message used to create this partition_token.
|
|
234
234
|
* @property {google.spanner.v1.RequestOptions} [requestOptions]
|
|
235
235
|
* Common options for this request.
|
|
236
|
+
* @property {google.spanner.v1.IDirectedReadOptions} [directedReadOptions]
|
|
237
|
+
* Indicates which replicas or regions should be used for non-transactional reads or queries.
|
|
236
238
|
* @property {object} [gaxOptions]
|
|
237
239
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
238
240
|
* for more details.
|
|
@@ -364,6 +366,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
364
366
|
else {
|
|
365
367
|
transaction.singleUse = this._options;
|
|
366
368
|
}
|
|
369
|
+
const directedReadOptions = this._getDirectedReadOptions(request.directedReadOptions);
|
|
367
370
|
request = Object.assign({}, request);
|
|
368
371
|
delete request.gaxOptions;
|
|
369
372
|
delete request.json;
|
|
@@ -372,9 +375,11 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
372
375
|
delete request.keys;
|
|
373
376
|
delete request.ranges;
|
|
374
377
|
delete request.requestOptions;
|
|
378
|
+
delete request.directedReadOptions;
|
|
375
379
|
const reqOpts = Object.assign(request, {
|
|
376
380
|
session: this.session.formattedName_,
|
|
377
381
|
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),
|
|
382
|
+
directedReadOptions: directedReadOptions,
|
|
378
383
|
transaction,
|
|
379
384
|
table,
|
|
380
385
|
keySet,
|
|
@@ -512,7 +517,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
512
517
|
* execution statistics for the SQL statement that
|
|
513
518
|
* produced this result set.
|
|
514
519
|
* @property {string} partitionToken The partition token.
|
|
515
|
-
* @property {number} seqno The Sequence number.
|
|
520
|
+
* @property {number} seqno The Sequence number. This option is used internally and will be overridden.
|
|
516
521
|
* @property {string} sql The SQL string.
|
|
517
522
|
* @property {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions]
|
|
518
523
|
* Default query options to use with the database. These options will be
|
|
@@ -536,6 +541,8 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
536
541
|
* that it is not ready for any more data. Increase this value if you
|
|
537
542
|
* experience 'Stream is still not ready to receive data' errors as a
|
|
538
543
|
* result of a slow writer in your receiving stream.
|
|
544
|
+
* @property {object} [directedReadOptions]
|
|
545
|
+
* Indicates which replicas or regions should be used for non-transactional reads or queries.
|
|
539
546
|
*/
|
|
540
547
|
/**
|
|
541
548
|
* Create a readable object stream to receive resulting rows from a SQL
|
|
@@ -604,6 +611,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
604
611
|
query.queryOptions = Object.assign(Object.assign({}, this.queryOptions), query.queryOptions);
|
|
605
612
|
const { gaxOptions, json, jsonOptions, maxResumeRetries, requestOptions } = query;
|
|
606
613
|
let reqOpts;
|
|
614
|
+
const directedReadOptions = this._getDirectedReadOptions(query.directedReadOptions);
|
|
607
615
|
const sanitizeRequest = () => {
|
|
608
616
|
var _a, _b;
|
|
609
617
|
query = query;
|
|
@@ -624,10 +632,12 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
624
632
|
delete query.maxResumeRetries;
|
|
625
633
|
delete query.requestOptions;
|
|
626
634
|
delete query.types;
|
|
635
|
+
delete query.directedReadOptions;
|
|
627
636
|
reqOpts = Object.assign(query, {
|
|
628
637
|
session: this.session.formattedName_,
|
|
629
638
|
seqno: this._seqno++,
|
|
630
639
|
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),
|
|
640
|
+
directedReadOptions: directedReadOptions,
|
|
631
641
|
transaction,
|
|
632
642
|
params,
|
|
633
643
|
paramTypes,
|
|
@@ -776,6 +786,19 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
776
786
|
}
|
|
777
787
|
return { params, paramTypes };
|
|
778
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* Get directed read options
|
|
791
|
+
* @private
|
|
792
|
+
* @param {google.spanner.v1.IDirectedReadOptions} directedReadOptions Request directedReadOptions object.
|
|
793
|
+
*/
|
|
794
|
+
_getDirectedReadOptions(directedReadOptions) {
|
|
795
|
+
if (!directedReadOptions &&
|
|
796
|
+
this._getSpanner().directedReadOptions &&
|
|
797
|
+
this._options.readOnly) {
|
|
798
|
+
return this._getSpanner().directedReadOptions;
|
|
799
|
+
}
|
|
800
|
+
return directedReadOptions;
|
|
801
|
+
}
|
|
779
802
|
/**
|
|
780
803
|
* Update transaction properties from the response.
|
|
781
804
|
*
|
|
@@ -978,7 +1001,7 @@ class Transaction extends Dml {
|
|
|
978
1001
|
const rowCounts = [];
|
|
979
1002
|
const error = new Error('batchUpdate requires at least 1 DML statement.');
|
|
980
1003
|
const batchError = Object.assign(error, {
|
|
981
|
-
code: 3,
|
|
1004
|
+
code: 3, // invalid argument
|
|
982
1005
|
rowCounts,
|
|
983
1006
|
});
|
|
984
1007
|
callback(batchError, rowCounts);
|
|
@@ -1081,6 +1104,10 @@ class Transaction extends Dml {
|
|
|
1081
1104
|
options.returnCommitStats) {
|
|
1082
1105
|
reqOpts.returnCommitStats = options.returnCommitStats;
|
|
1083
1106
|
}
|
|
1107
|
+
if ('maxCommitDelay' in options &&
|
|
1108
|
+
options.maxCommitDelay) {
|
|
1109
|
+
reqOpts.maxCommitDelay = options.maxCommitDelay;
|
|
1110
|
+
}
|
|
1084
1111
|
reqOpts.requestOptions = Object.assign(requestOptions || {}, this.requestOptions);
|
|
1085
1112
|
const headers = this.resourceHeader_;
|
|
1086
1113
|
if (this._getSpanner().routeToLeaderEnabled) {
|
|
@@ -22,6 +22,8 @@ export declare class DatabaseAdminClient {
|
|
|
22
22
|
private _gaxGrpc;
|
|
23
23
|
private _protos;
|
|
24
24
|
private _defaults;
|
|
25
|
+
private _universeDomain;
|
|
26
|
+
private _servicePath;
|
|
25
27
|
auth: gax.GoogleAuth;
|
|
26
28
|
descriptors: Descriptors;
|
|
27
29
|
warn: (code: string, message: string, warnType?: string) => void;
|
|
@@ -91,15 +93,22 @@ export declare class DatabaseAdminClient {
|
|
|
91
93
|
}>;
|
|
92
94
|
/**
|
|
93
95
|
* The DNS address for this API service.
|
|
96
|
+
* @deprecated Use the apiEndpoint method of the client instance.
|
|
94
97
|
* @returns {string} The DNS address for this service.
|
|
95
98
|
*/
|
|
96
99
|
static get servicePath(): string;
|
|
97
100
|
/**
|
|
98
|
-
* The DNS address for this API service - same as servicePath
|
|
99
|
-
*
|
|
101
|
+
* The DNS address for this API service - same as servicePath.
|
|
102
|
+
* @deprecated Use the apiEndpoint method of the client instance.
|
|
100
103
|
* @returns {string} The DNS address for this service.
|
|
101
104
|
*/
|
|
102
105
|
static get apiEndpoint(): string;
|
|
106
|
+
/**
|
|
107
|
+
* The DNS address for this API service.
|
|
108
|
+
* @returns {string} The DNS address for this service.
|
|
109
|
+
*/
|
|
110
|
+
get apiEndpoint(): string;
|
|
111
|
+
get universeDomain(): string;
|
|
103
112
|
/**
|
|
104
113
|
* The port for this API service.
|
|
105
114
|
* @returns {number} The default port for this service.
|
|
@@ -400,6 +409,22 @@ export declare class DatabaseAdminClient {
|
|
|
400
409
|
* Google default encryption.
|
|
401
410
|
* @param {google.spanner.admin.database.v1.DatabaseDialect} [request.databaseDialect]
|
|
402
411
|
* Optional. The dialect of the Cloud Spanner Database.
|
|
412
|
+
* @param {Buffer} [request.protoDescriptors]
|
|
413
|
+
* Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
|
|
414
|
+
* 'extra_statements' above.
|
|
415
|
+
* Contains a protobuf-serialized
|
|
416
|
+
* [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
|
|
417
|
+
* To generate it, [install](https://grpc.io/docs/protoc-installation/) and
|
|
418
|
+
* run `protoc` with --include_imports and --descriptor_set_out. For example,
|
|
419
|
+
* to generate for moon/shot/app.proto, run
|
|
420
|
+
* ```
|
|
421
|
+
* $protoc --proto_path=/app_path --proto_path=/lib_path \
|
|
422
|
+
* --include_imports \
|
|
423
|
+
* --descriptor_set_out=descriptors.data \
|
|
424
|
+
* moon/shot/app.proto
|
|
425
|
+
* ```
|
|
426
|
+
* For more details, see protobuffer [self
|
|
427
|
+
* description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
|
|
403
428
|
* @param {object} [options]
|
|
404
429
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
405
430
|
* @returns {Promise} - The promise which resolves to an array.
|
|
@@ -534,6 +559,21 @@ export declare class DatabaseAdminClient {
|
|
|
534
559
|
* underscore. If the named operation already exists,
|
|
535
560
|
* {@link protos.google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl|UpdateDatabaseDdl} returns
|
|
536
561
|
* `ALREADY_EXISTS`.
|
|
562
|
+
* @param {Buffer} [request.protoDescriptors]
|
|
563
|
+
* Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements.
|
|
564
|
+
* Contains a protobuf-serialized
|
|
565
|
+
* [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
|
|
566
|
+
* To generate it, [install](https://grpc.io/docs/protoc-installation/) and
|
|
567
|
+
* run `protoc` with --include_imports and --descriptor_set_out. For example,
|
|
568
|
+
* to generate for moon/shot/app.proto, run
|
|
569
|
+
* ```
|
|
570
|
+
* $protoc --proto_path=/app_path --proto_path=/lib_path \
|
|
571
|
+
* --include_imports \
|
|
572
|
+
* --descriptor_set_out=descriptors.data \
|
|
573
|
+
* moon/shot/app.proto
|
|
574
|
+
* ```
|
|
575
|
+
* For more details, see protobuffer [self
|
|
576
|
+
* description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
|
|
537
577
|
* @param {object} [options]
|
|
538
578
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
539
579
|
* @returns {Promise} - The promise which resolves to an array.
|