@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.
- package/README.md +1 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1 -1
- package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
- package/build/protos/google/spanner/v1/commit_response.proto +1 -1
- package/build/protos/google/spanner/v1/keys.proto +1 -1
- package/build/protos/google/spanner/v1/mutation.proto +1 -1
- package/build/protos/google/spanner/v1/query_plan.proto +1 -1
- package/build/protos/google/spanner/v1/result_set.proto +55 -49
- package/build/protos/google/spanner/v1/spanner.proto +1 -1
- package/build/protos/google/spanner/v1/transaction.proto +1 -1
- package/build/protos/google/spanner/v1/type.proto +1 -1
- package/build/protos/protos.d.ts +56 -50
- package/build/protos/protos.js +1016 -331
- package/build/protos/protos.json +47 -20
- package/build/src/backup.js +7 -0
- package/build/src/batch-transaction.d.ts +48 -29
- package/build/src/batch-transaction.js +13 -98
- package/build/src/codec.js +43 -26
- package/build/src/common-grpc/service-object.js +1 -0
- package/build/src/common-grpc/service.js +25 -8
- package/build/src/database.js +77 -49
- package/build/src/helper.d.ts +9 -0
- package/build/src/helper.js +24 -0
- package/build/src/index.js +24 -13
- package/build/src/instance-config.d.ts +1 -1
- package/build/src/instance-config.js +4 -0
- package/build/src/instance.js +12 -6
- package/build/src/instrument.d.ts +2 -0
- package/build/src/instrument.js +12 -9
- package/build/src/multiplexed-session.js +7 -1
- package/build/src/partial-result-stream.js +9 -5
- package/build/src/request_id_header.js +1 -0
- package/build/src/session-factory.js +5 -2
- package/build/src/session-pool.js +23 -6
- package/build/src/session.d.ts +2 -1
- package/build/src/session.js +8 -2
- package/build/src/table.js +6 -1
- package/build/src/transaction-runner.js +12 -2
- package/build/src/transaction.d.ts +2 -1
- package/build/src/transaction.js +95 -81
- package/build/src/v1/database_admin_client.d.ts +3 -2
- package/build/src/v1/database_admin_client.js +551 -167
- package/build/src/v1/instance_admin_client.d.ts +2 -1
- package/build/src/v1/instance_admin_client.js +453 -133
- package/build/src/v1/spanner_client.d.ts +2 -1
- package/build/src/v1/spanner_client.js +283 -85
- package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
- package/build/src/v1/spanner_executor_proxy_client.js +41 -19
- package/package.json +57 -58
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-spanner/tre
|
|
|
111
111
|
| Creates an incremental backup schedule | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/create-incremental-backup-schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/create-incremental-backup-schedule.js,samples/README.md) |
|
|
112
112
|
| Create-instance-without-default-backup-schedules | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/create-instance-without-default-backup-schedules.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/create-instance-without-default-backup-schedules.js,samples/README.md) |
|
|
113
113
|
| CRUD | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/crud.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/crud.js,samples/README.md) |
|
|
114
|
+
| Adds split points to a database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/database-add-split-points.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/database-add-split-points.js,samples/README.md) |
|
|
114
115
|
| Creates a new database with a specific default leader | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/database-create-with-default-leader.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/database-create-with-default-leader.js,samples/README.md) |
|
|
115
116
|
| Database-create-with-encryption-key | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/database-create-with-encryption-key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/database-create-with-encryption-key.js,samples/README.md) |
|
|
116
117
|
| Database-create-with-multiple-kms-keys | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/database-create-with-multiple-kms-keys.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/database-create-with-multiple-kms-keys.js,samples/README.md) |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 Google LLC
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -22,7 +22,6 @@ import "google/spanner/v1/query_plan.proto";
|
|
|
22
22
|
import "google/spanner/v1/transaction.proto";
|
|
23
23
|
import "google/spanner/v1/type.proto";
|
|
24
24
|
|
|
25
|
-
option cc_enable_arenas = true;
|
|
26
25
|
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
27
26
|
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
28
27
|
option java_multiple_files = true;
|
|
@@ -38,11 +37,10 @@ message ResultSet {
|
|
|
38
37
|
ResultSetMetadata metadata = 1;
|
|
39
38
|
|
|
40
39
|
// Each element in `rows` is a row whose format is defined by
|
|
41
|
-
// [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith
|
|
42
|
-
// in each row matches the ith field in
|
|
43
|
-
// [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements
|
|
44
|
-
// encoded based on type as described
|
|
45
|
-
// [here][google.spanner.v1.TypeCode].
|
|
40
|
+
// [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith
|
|
41
|
+
// element in each row matches the ith field in
|
|
42
|
+
// [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements
|
|
43
|
+
// are encoded based on type as described [here][google.spanner.v1.TypeCode].
|
|
46
44
|
repeated google.protobuf.ListValue rows = 2;
|
|
47
45
|
|
|
48
46
|
// Query plan and execution statistics for the SQL statement that
|
|
@@ -50,18 +48,16 @@ message ResultSet {
|
|
|
50
48
|
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
|
|
51
49
|
// DML statements always produce stats containing the number of rows
|
|
52
50
|
// modified, unless executed using the
|
|
53
|
-
// [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN]
|
|
54
|
-
//
|
|
51
|
+
// [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN]
|
|
52
|
+
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
|
|
53
|
+
// Other fields might or might not be populated, based on the
|
|
55
54
|
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
|
|
56
55
|
ResultSetStats stats = 3;
|
|
57
56
|
|
|
58
|
-
// Optional. A precommit token
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// attempt should be passed to the
|
|
57
|
+
// Optional. A precommit token is included if the read-write transaction is on
|
|
58
|
+
// a multiplexed session. Pass the precommit token with the highest sequence
|
|
59
|
+
// number from this transaction attempt to the
|
|
62
60
|
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
|
|
63
|
-
// This feature is not yet supported and will result in an UNIMPLEMENTED
|
|
64
|
-
// error.
|
|
65
61
|
MultiplexedSessionPrecommitToken precommit_token = 5
|
|
66
62
|
[(google.api.field_behavior) = OPTIONAL];
|
|
67
63
|
}
|
|
@@ -83,13 +79,14 @@ message PartialResultSet {
|
|
|
83
79
|
// Most values are encoded based on type as described
|
|
84
80
|
// [here][google.spanner.v1.TypeCode].
|
|
85
81
|
//
|
|
86
|
-
// It
|
|
82
|
+
// It's possible that the last value in values is "chunked",
|
|
87
83
|
// meaning that the rest of the value is sent in subsequent
|
|
88
|
-
// `PartialResultSet`(s). This is denoted by the
|
|
89
|
-
// field.
|
|
90
|
-
// complete value as
|
|
84
|
+
// `PartialResultSet`(s). This is denoted by the
|
|
85
|
+
// [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] field.
|
|
86
|
+
// Two or more chunked values can be merged to form a complete value as
|
|
87
|
+
// follows:
|
|
91
88
|
//
|
|
92
|
-
// * `bool/number/null`:
|
|
89
|
+
// * `bool/number/null`: can't be chunked
|
|
93
90
|
// * `string`: concatenate the strings
|
|
94
91
|
// * `list`: concatenate the lists. If the last element in a list is a
|
|
95
92
|
// `string`, `list`, or `object`, merge it with the first element in
|
|
@@ -100,28 +97,28 @@ message PartialResultSet {
|
|
|
100
97
|
//
|
|
101
98
|
// Some examples of merging:
|
|
102
99
|
//
|
|
103
|
-
//
|
|
100
|
+
// Strings are concatenated.
|
|
104
101
|
// "foo", "bar" => "foobar"
|
|
105
102
|
//
|
|
106
|
-
//
|
|
103
|
+
// Lists of non-strings are concatenated.
|
|
107
104
|
// [2, 3], [4] => [2, 3, 4]
|
|
108
105
|
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
106
|
+
// Lists are concatenated, but the last and first elements are merged
|
|
107
|
+
// because they are strings.
|
|
111
108
|
// ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
|
|
112
109
|
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
110
|
+
// Lists are concatenated, but the last and first elements are merged
|
|
111
|
+
// because they are lists. Recursively, the last and first elements
|
|
112
|
+
// of the inner lists are merged because they are strings.
|
|
116
113
|
// ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
|
|
117
114
|
//
|
|
118
|
-
//
|
|
115
|
+
// Non-overlapping object fields are combined.
|
|
119
116
|
// {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
|
|
120
117
|
//
|
|
121
|
-
//
|
|
118
|
+
// Overlapping object fields are merged.
|
|
122
119
|
// {"a": "1"}, {"a": "2"} => {"a": "12"}
|
|
123
120
|
//
|
|
124
|
-
//
|
|
121
|
+
// Examples of merging objects containing lists of strings.
|
|
125
122
|
// {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
|
|
126
123
|
//
|
|
127
124
|
// For a more complete example, suppose a streaming SQL query is
|
|
@@ -137,7 +134,6 @@ message PartialResultSet {
|
|
|
137
134
|
// {
|
|
138
135
|
// "values": ["orl"]
|
|
139
136
|
// "chunked_value": true
|
|
140
|
-
// "resume_token": "Bqp2..."
|
|
141
137
|
// }
|
|
142
138
|
// {
|
|
143
139
|
// "values": ["d"]
|
|
@@ -147,11 +143,17 @@ message PartialResultSet {
|
|
|
147
143
|
// This sequence of `PartialResultSet`s encodes two rows, one
|
|
148
144
|
// containing the field value `"Hello"`, and a second containing the
|
|
149
145
|
// field value `"World" = "W" + "orl" + "d"`.
|
|
146
|
+
//
|
|
147
|
+
// Not all `PartialResultSet`s contain a `resume_token`. Execution can only be
|
|
148
|
+
// resumed from a previously yielded `resume_token`. For the above sequence of
|
|
149
|
+
// `PartialResultSet`s, resuming the query with `"resume_token": "Af65..."`
|
|
150
|
+
// yields results from the `PartialResultSet` with value "orl".
|
|
150
151
|
repeated google.protobuf.Value values = 2;
|
|
151
152
|
|
|
152
|
-
// If true, then the final value in
|
|
153
|
-
//
|
|
154
|
-
// to obtain a
|
|
153
|
+
// If true, then the final value in
|
|
154
|
+
// [values][google.spanner.v1.PartialResultSet.values] is chunked, and must be
|
|
155
|
+
// combined with more values from subsequent `PartialResultSet`s to obtain a
|
|
156
|
+
// complete field value.
|
|
155
157
|
bool chunked_value = 3;
|
|
156
158
|
|
|
157
159
|
// Streaming calls might be interrupted for a variety of reasons, such
|
|
@@ -163,27 +165,29 @@ message PartialResultSet {
|
|
|
163
165
|
|
|
164
166
|
// Query plan and execution statistics for the statement that produced this
|
|
165
167
|
// streaming result set. These can be requested by setting
|
|
166
|
-
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]
|
|
167
|
-
// only once with the last response in the stream.
|
|
168
|
-
//
|
|
169
|
-
// statements.
|
|
168
|
+
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]
|
|
169
|
+
// and are sent only once with the last response in the stream. This field is
|
|
170
|
+
// also present in the last response for DML statements.
|
|
170
171
|
ResultSetStats stats = 5;
|
|
171
172
|
|
|
172
|
-
// Optional. A precommit token
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
// attempt should be passed to the
|
|
173
|
+
// Optional. A precommit token is included if the read-write transaction
|
|
174
|
+
// has multiplexed sessions enabled. Pass the precommit token with the highest
|
|
175
|
+
// sequence number from this transaction attempt to the
|
|
176
176
|
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
|
|
177
|
-
// This feature is not yet supported and will result in an UNIMPLEMENTED
|
|
178
|
-
// error.
|
|
179
177
|
MultiplexedSessionPrecommitToken precommit_token = 8
|
|
180
178
|
[(google.api.field_behavior) = OPTIONAL];
|
|
179
|
+
|
|
180
|
+
// Optional. Indicates whether this is the last `PartialResultSet` in the
|
|
181
|
+
// stream. The server might optionally set this field. Clients shouldn't rely
|
|
182
|
+
// on this field being set in all cases.
|
|
183
|
+
bool last = 9 [(google.api.field_behavior) = OPTIONAL];
|
|
181
184
|
}
|
|
182
185
|
|
|
183
|
-
// Metadata about a [ResultSet][google.spanner.v1.ResultSet] or
|
|
186
|
+
// Metadata about a [ResultSet][google.spanner.v1.ResultSet] or
|
|
187
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet].
|
|
184
188
|
message ResultSetMetadata {
|
|
185
189
|
// Indicates the field names and types for the rows in the result
|
|
186
|
-
// set.
|
|
190
|
+
// set. For example, a SQL query like `"SELECT UserId, UserName FROM
|
|
187
191
|
// Users"` could return a `row_type` value like:
|
|
188
192
|
//
|
|
189
193
|
// "fields": [
|
|
@@ -209,9 +213,11 @@ message ResultSetMetadata {
|
|
|
209
213
|
StructType undeclared_parameters = 3;
|
|
210
214
|
}
|
|
211
215
|
|
|
212
|
-
// Additional statistics about a [ResultSet][google.spanner.v1.ResultSet] or
|
|
216
|
+
// Additional statistics about a [ResultSet][google.spanner.v1.ResultSet] or
|
|
217
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet].
|
|
213
218
|
message ResultSetStats {
|
|
214
|
-
// [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this
|
|
219
|
+
// [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this
|
|
220
|
+
// result.
|
|
215
221
|
QueryPlan query_plan = 1;
|
|
216
222
|
|
|
217
223
|
// Aggregated statistics from the execution of the query. Only present when
|
|
@@ -230,7 +236,7 @@ message ResultSetStats {
|
|
|
230
236
|
// Standard DML returns an exact count of rows that were modified.
|
|
231
237
|
int64 row_count_exact = 3;
|
|
232
238
|
|
|
233
|
-
// Partitioned DML
|
|
239
|
+
// Partitioned DML doesn't offer exactly-once semantics, so it
|
|
234
240
|
// returns a lower bound of the rows modified.
|
|
235
241
|
int64 row_count_lower_bound = 4;
|
|
236
242
|
}
|