@google-cloud/spanner 7.21.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
  2. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
  3. package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
  4. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1 -1
  5. package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
  6. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
  7. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
  8. package/build/protos/google/spanner/v1/commit_response.proto +1 -1
  9. package/build/protos/google/spanner/v1/keys.proto +1 -1
  10. package/build/protos/google/spanner/v1/mutation.proto +1 -1
  11. package/build/protos/google/spanner/v1/query_plan.proto +1 -1
  12. package/build/protos/google/spanner/v1/result_set.proto +55 -49
  13. package/build/protos/google/spanner/v1/spanner.proto +1 -1
  14. package/build/protos/google/spanner/v1/transaction.proto +1 -1
  15. package/build/protos/google/spanner/v1/type.proto +1 -1
  16. package/build/protos/protos.d.ts +56 -194
  17. package/build/protos/protos.js +71 -288
  18. package/build/protos/protos.json +8 -2
  19. package/build/src/backup.js +7 -0
  20. package/build/src/batch-transaction.d.ts +48 -29
  21. package/build/src/batch-transaction.js +13 -98
  22. package/build/src/codec.js +43 -26
  23. package/build/src/common-grpc/service-object.js +1 -0
  24. package/build/src/common-grpc/service.js +25 -8
  25. package/build/src/database.js +52 -42
  26. package/build/src/helper.d.ts +9 -0
  27. package/build/src/helper.js +24 -0
  28. package/build/src/index.js +24 -13
  29. package/build/src/instance-config.d.ts +1 -1
  30. package/build/src/instance-config.js +4 -0
  31. package/build/src/instance.js +12 -6
  32. package/build/src/instrument.js +2 -4
  33. package/build/src/multiplexed-session.js +7 -1
  34. package/build/src/partial-result-stream.js +9 -5
  35. package/build/src/request_id_header.js +1 -0
  36. package/build/src/session-factory.js +5 -2
  37. package/build/src/session-pool.js +23 -6
  38. package/build/src/session.d.ts +0 -1
  39. package/build/src/session.js +7 -2
  40. package/build/src/table.js +6 -3
  41. package/build/src/transaction-runner.js +12 -2
  42. package/build/src/transaction.js +66 -52
  43. package/build/src/v1/database_admin_client.d.ts +3 -2
  44. package/build/src/v1/database_admin_client.js +551 -167
  45. package/build/src/v1/instance_admin_client.d.ts +2 -1
  46. package/build/src/v1/instance_admin_client.js +453 -133
  47. package/build/src/v1/spanner_client.d.ts +2 -1
  48. package/build/src/v1/spanner_client.js +283 -85
  49. package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
  50. package/build/src/v1/spanner_executor_proxy_client.js +41 -19
  51. package/package.json +57 -58
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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 element
42
- // in each row matches the ith field in
43
- // [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are
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] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
54
- // Other fields may or may not be populated, based on the
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 will be included if the read-write transaction
59
- // is on a multiplexed session.
60
- // The precommit token with the highest sequence number from this transaction
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 is possible that the last value in values is "chunked",
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 [chunked_value][google.spanner.v1.PartialResultSet.chunked_value]
89
- // field. Two or more chunked values can be merged to form a
90
- // complete value as follows:
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`: cannot be chunked
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
- // # Strings are concatenated.
100
+ // Strings are concatenated.
104
101
  // "foo", "bar" => "foobar"
105
102
  //
106
- // # Lists of non-strings are concatenated.
103
+ // Lists of non-strings are concatenated.
107
104
  // [2, 3], [4] => [2, 3, 4]
108
105
  //
109
- // # Lists are concatenated, but the last and first elements are merged
110
- // # because they are strings.
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
- // # Lists are concatenated, but the last and first elements are merged
114
- // # because they are lists. Recursively, the last and first elements
115
- // # of the inner lists are merged because they are strings.
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
- // # Non-overlapping object fields are combined.
115
+ // Non-overlapping object fields are combined.
119
116
  // {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
120
117
  //
121
- // # Overlapping object fields are merged.
118
+ // Overlapping object fields are merged.
122
119
  // {"a": "1"}, {"a": "2"} => {"a": "12"}
123
120
  //
124
- // # Examples of merging objects containing lists of strings.
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 [values][google.spanner.v1.PartialResultSet.values] is chunked, and must
153
- // be combined with more values from subsequent `PartialResultSet`s
154
- // to obtain a complete field value.
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] and are sent
167
- // only once with the last response in the stream.
168
- // This field will also be present in the last response for DML
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 will be included if the read-write transaction
173
- // is on a multiplexed session.
174
- // The precommit token with the highest sequence number from this transaction
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 [PartialResultSet][google.spanner.v1.PartialResultSet].
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. For example, a SQL query like `"SELECT UserId, UserName FROM
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 [PartialResultSet][google.spanner.v1.PartialResultSet].
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 result.
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 does not offer exactly-once semantics, so it
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
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.
@@ -1,4 +1,4 @@
1
- // Copyright 2024 Google LLC
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.