@google-cloud/spanner 7.16.0 → 7.17.1
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 +20 -0
- package/README.md +2 -0
- package/build/protos/google/spanner/v1/spanner.proto +22 -0
- package/build/protos/protos.d.ts +13 -1
- package/build/protos/protos.js +47 -1
- package/build/protos/protos.json +14 -0
- package/build/src/common.d.ts +8 -0
- package/build/src/common.js +19 -1
- package/build/src/database.d.ts +7 -1
- package/build/src/database.js +61 -57
- package/build/src/helper.d.ts +45 -0
- package/build/src/helper.js +71 -0
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +17 -11
- package/build/src/instance-config.d.ts +1 -0
- package/build/src/instance.d.ts +2 -1
- package/build/src/instance.js +12 -13
- package/build/src/instrument.d.ts +1 -0
- package/build/src/multiplexed-session.d.ts +136 -0
- package/build/src/multiplexed-session.js +197 -0
- package/build/src/session-factory.d.ts +101 -0
- package/build/src/session-factory.js +93 -0
- package/build/src/session-pool.d.ts +1 -39
- package/build/src/session-pool.js +6 -58
- package/build/src/session.d.ts +2 -1
- package/build/src/session.js +5 -6
- package/build/src/transaction.d.ts +1 -1
- package/build/src/transaction.js +8 -9
- package/build/src/v1/spanner_client.d.ts +30 -0
- package/build/src/v1/spanner_client.js +10 -0
- package/package.json +2 -1
package/build/src/session.d.ts
CHANGED
|
@@ -87,12 +87,13 @@ export type DeleteSessionCallback = NormalCallback<google.protobuf.IEmpty>;
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
export declare class Session extends common.GrpcServiceObject {
|
|
90
|
+
static [x: string]: any;
|
|
90
91
|
id: string;
|
|
91
92
|
formattedName_?: string;
|
|
92
93
|
txn?: Transaction;
|
|
93
94
|
lastUsed?: number;
|
|
94
95
|
lastError?: grpc.ServiceError;
|
|
95
|
-
|
|
96
|
+
commonHeaders_: {
|
|
96
97
|
[k: string]: string;
|
|
97
98
|
};
|
|
98
99
|
constructor(database: Database, name?: string);
|
package/build/src/session.js
CHANGED
|
@@ -67,6 +67,7 @@ const common_1 = require("./common");
|
|
|
67
67
|
*/
|
|
68
68
|
class Session extends common.GrpcServiceObject {
|
|
69
69
|
constructor(database, name) {
|
|
70
|
+
var _a;
|
|
70
71
|
const methods = {
|
|
71
72
|
/**
|
|
72
73
|
* Create a session.
|
|
@@ -198,9 +199,7 @@ class Session extends common.GrpcServiceObject {
|
|
|
198
199
|
});
|
|
199
200
|
},
|
|
200
201
|
});
|
|
201
|
-
this.
|
|
202
|
-
[common_1.CLOUD_RESOURCE_HEADER]: this.parent.formattedName_,
|
|
203
|
-
};
|
|
202
|
+
this.commonHeaders_ = (0, common_1.getCommonHeaders)(this.parent.formattedName_, (_a = database._observabilityOptions) === null || _a === void 0 ? void 0 : _a.enableEndToEndTracing);
|
|
204
203
|
this.request = database.request;
|
|
205
204
|
this.requestStream = database.requestStream;
|
|
206
205
|
if (name) {
|
|
@@ -218,7 +217,7 @@ class Session extends common.GrpcServiceObject {
|
|
|
218
217
|
method: 'deleteSession',
|
|
219
218
|
reqOpts,
|
|
220
219
|
gaxOpts,
|
|
221
|
-
headers: this.
|
|
220
|
+
headers: this.commonHeaders_,
|
|
222
221
|
}, callback);
|
|
223
222
|
}
|
|
224
223
|
getMetadata(optionsOrCallback, cb) {
|
|
@@ -227,7 +226,7 @@ class Session extends common.GrpcServiceObject {
|
|
|
227
226
|
const reqOpts = {
|
|
228
227
|
name: this.formattedName_,
|
|
229
228
|
};
|
|
230
|
-
const headers = this.
|
|
229
|
+
const headers = this.commonHeaders_;
|
|
231
230
|
if (this._getSpanner().routeToLeaderEnabled) {
|
|
232
231
|
(0, common_1.addLeaderAwareRoutingHeader)(headers);
|
|
233
232
|
}
|
|
@@ -258,7 +257,7 @@ class Session extends common.GrpcServiceObject {
|
|
|
258
257
|
method: 'executeSql',
|
|
259
258
|
reqOpts,
|
|
260
259
|
gaxOpts,
|
|
261
|
-
headers: this.
|
|
260
|
+
headers: this.commonHeaders_,
|
|
262
261
|
}, callback);
|
|
263
262
|
}
|
|
264
263
|
/**
|
|
@@ -238,7 +238,7 @@ export declare class Snapshot extends EventEmitter {
|
|
|
238
238
|
requestStream: (config: {}) => Readable;
|
|
239
239
|
session: Session;
|
|
240
240
|
queryOptions?: IQueryOptions;
|
|
241
|
-
|
|
241
|
+
commonHeaders_: {
|
|
242
242
|
[k: string]: string;
|
|
243
243
|
};
|
|
244
244
|
requestOptions?: Pick<IRequestOptions, 'transactionTag'>;
|
package/build/src/transaction.js
CHANGED
|
@@ -132,6 +132,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
132
132
|
* are specified for a query.
|
|
133
133
|
*/
|
|
134
134
|
constructor(session, options, queryOptions) {
|
|
135
|
+
var _a;
|
|
135
136
|
super();
|
|
136
137
|
this._seqno = 1;
|
|
137
138
|
this._useInRunner = false;
|
|
@@ -143,12 +144,10 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
143
144
|
const readOnly = Snapshot.encodeTimestampBounds(options || {});
|
|
144
145
|
this._options = { readOnly };
|
|
145
146
|
this._dbName = this.session.parent.formattedName_;
|
|
146
|
-
this.resourceHeader_ = {
|
|
147
|
-
[common_1.CLOUD_RESOURCE_HEADER]: this._dbName,
|
|
148
|
-
};
|
|
149
147
|
this._waitingRequests = [];
|
|
150
148
|
this._inlineBeginStarted = false;
|
|
151
149
|
this._observabilityOptions = session._observabilityOptions;
|
|
150
|
+
this.commonHeaders_ = (0, common_1.getCommonHeaders)(this._dbName, (_a = this._observabilityOptions) === null || _a === void 0 ? void 0 : _a.enableEndToEndTracing);
|
|
152
151
|
}
|
|
153
152
|
begin(gaxOptionsOrCallback, cb) {
|
|
154
153
|
const gaxOpts = typeof gaxOptionsOrCallback === 'object' ? gaxOptionsOrCallback : {};
|
|
@@ -166,7 +165,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
166
165
|
if (this.requestOptions) {
|
|
167
166
|
reqOpts.requestOptions = this.requestOptions;
|
|
168
167
|
}
|
|
169
|
-
const headers = this.
|
|
168
|
+
const headers = this.commonHeaders_;
|
|
170
169
|
if (this._getSpanner().routeToLeaderEnabled &&
|
|
171
170
|
(this._options.readWrite !== undefined ||
|
|
172
171
|
this._options.partitionedDml !== undefined)) {
|
|
@@ -399,7 +398,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
399
398
|
table,
|
|
400
399
|
keySet,
|
|
401
400
|
});
|
|
402
|
-
const headers = this.
|
|
401
|
+
const headers = this.commonHeaders_;
|
|
403
402
|
if (this._getSpanner().routeToLeaderEnabled &&
|
|
404
403
|
(this._options.readWrite !== undefined ||
|
|
405
404
|
this._options.partitionedDml !== undefined)) {
|
|
@@ -740,7 +739,7 @@ class Snapshot extends events_1.EventEmitter {
|
|
|
740
739
|
paramTypes,
|
|
741
740
|
});
|
|
742
741
|
};
|
|
743
|
-
const headers = this.
|
|
742
|
+
const headers = this.commonHeaders_;
|
|
744
743
|
if (this._getSpanner().routeToLeaderEnabled &&
|
|
745
744
|
(this._options.readWrite !== undefined ||
|
|
746
745
|
this._options.partitionedDml !== undefined)) {
|
|
@@ -1195,7 +1194,7 @@ class Transaction extends Dml {
|
|
|
1195
1194
|
seqno: this._seqno++,
|
|
1196
1195
|
statements,
|
|
1197
1196
|
};
|
|
1198
|
-
const headers = this.
|
|
1197
|
+
const headers = this.commonHeaders_;
|
|
1199
1198
|
if (this._getSpanner().routeToLeaderEnabled) {
|
|
1200
1199
|
(0, common_1.addLeaderAwareRoutingHeader)(headers);
|
|
1201
1200
|
}
|
|
@@ -1312,7 +1311,7 @@ class Transaction extends Dml {
|
|
|
1312
1311
|
reqOpts.maxCommitDelay = options.maxCommitDelay;
|
|
1313
1312
|
}
|
|
1314
1313
|
reqOpts.requestOptions = Object.assign(requestOptions || {}, this.requestOptions);
|
|
1315
|
-
const headers = this.
|
|
1314
|
+
const headers = this.commonHeaders_;
|
|
1316
1315
|
if (this._getSpanner().routeToLeaderEnabled) {
|
|
1317
1316
|
(0, common_1.addLeaderAwareRoutingHeader)(headers);
|
|
1318
1317
|
}
|
|
@@ -1585,7 +1584,7 @@ class Transaction extends Dml {
|
|
|
1585
1584
|
session,
|
|
1586
1585
|
transactionId,
|
|
1587
1586
|
};
|
|
1588
|
-
const headers = this.
|
|
1587
|
+
const headers = this.commonHeaders_;
|
|
1589
1588
|
if (this._getSpanner().routeToLeaderEnabled) {
|
|
1590
1589
|
(0, common_1.addLeaderAwareRoutingHeader)(headers);
|
|
1591
1590
|
}
|
|
@@ -335,6 +335,16 @@ export declare class SpannerClient {
|
|
|
335
335
|
*
|
|
336
336
|
* If the field is set to `true` but the request does not set
|
|
337
337
|
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
|
|
338
|
+
* @param {boolean} [request.lastStatement]
|
|
339
|
+
* Optional. If set to true, this statement marks the end of the transaction.
|
|
340
|
+
* The transaction should be committed or aborted after this statement
|
|
341
|
+
* executes, and attempts to execute any other requests against this
|
|
342
|
+
* transaction (including reads and queries) will be rejected.
|
|
343
|
+
*
|
|
344
|
+
* For DML statements, setting this option may cause some error reporting to
|
|
345
|
+
* be deferred until commit time (e.g. validation of unique constraints).
|
|
346
|
+
* Given this, successful execution of a DML statement should not be assumed
|
|
347
|
+
* until a subsequent Commit call completes successfully.
|
|
338
348
|
* @param {object} [options]
|
|
339
349
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
340
350
|
* @returns {Promise} - The promise which resolves to an array.
|
|
@@ -391,6 +401,16 @@ export declare class SpannerClient {
|
|
|
391
401
|
* handled requests will yield the same response as the first execution.
|
|
392
402
|
* @param {google.spanner.v1.RequestOptions} request.requestOptions
|
|
393
403
|
* Common options for this request.
|
|
404
|
+
* @param {boolean} [request.lastStatements]
|
|
405
|
+
* Optional. If set to true, this request marks the end of the transaction.
|
|
406
|
+
* The transaction should be committed or aborted after these statements
|
|
407
|
+
* execute, and attempts to execute any other requests against this
|
|
408
|
+
* transaction (including reads and queries) will be rejected.
|
|
409
|
+
*
|
|
410
|
+
* Setting this option may cause some error reporting to be deferred until
|
|
411
|
+
* commit time (e.g. validation of unique constraints). Given this, successful
|
|
412
|
+
* execution of statements should not be assumed until a subsequent Commit
|
|
413
|
+
* call completes successfully.
|
|
394
414
|
* @param {object} [options]
|
|
395
415
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
396
416
|
* @returns {Promise} - The promise which resolves to an array.
|
|
@@ -873,6 +893,16 @@ export declare class SpannerClient {
|
|
|
873
893
|
*
|
|
874
894
|
* If the field is set to `true` but the request does not set
|
|
875
895
|
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
|
|
896
|
+
* @param {boolean} [request.lastStatement]
|
|
897
|
+
* Optional. If set to true, this statement marks the end of the transaction.
|
|
898
|
+
* The transaction should be committed or aborted after this statement
|
|
899
|
+
* executes, and attempts to execute any other requests against this
|
|
900
|
+
* transaction (including reads and queries) will be rejected.
|
|
901
|
+
*
|
|
902
|
+
* For DML statements, setting this option may cause some error reporting to
|
|
903
|
+
* be deferred until commit time (e.g. validation of unique constraints).
|
|
904
|
+
* Given this, successful execution of a DML statement should not be assumed
|
|
905
|
+
* until a subsequent Commit call completes successfully.
|
|
876
906
|
* @param {object} [options]
|
|
877
907
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
878
908
|
* @returns {Stream}
|
|
@@ -649,6 +649,16 @@ class SpannerClient {
|
|
|
649
649
|
*
|
|
650
650
|
* If the field is set to `true` but the request does not set
|
|
651
651
|
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
|
|
652
|
+
* @param {boolean} [request.lastStatement]
|
|
653
|
+
* Optional. If set to true, this statement marks the end of the transaction.
|
|
654
|
+
* The transaction should be committed or aborted after this statement
|
|
655
|
+
* executes, and attempts to execute any other requests against this
|
|
656
|
+
* transaction (including reads and queries) will be rejected.
|
|
657
|
+
*
|
|
658
|
+
* For DML statements, setting this option may cause some error reporting to
|
|
659
|
+
* be deferred until commit time (e.g. validation of unique constraints).
|
|
660
|
+
* Given this, successful execution of a DML statement should not be assumed
|
|
661
|
+
* until a subsequent Commit call completes successfully.
|
|
652
662
|
* @param {object} [options]
|
|
653
663
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
654
664
|
* @returns {Stream}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-cloud/spanner",
|
|
3
3
|
"description": "Cloud Spanner Client Library for Node.js",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.17.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Google Inc.",
|
|
7
7
|
"engines": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@google-cloud/promisify": "^4.0.0",
|
|
61
61
|
"@grpc/proto-loader": "^0.7.0",
|
|
62
62
|
"@opentelemetry/api": "^1.9.0",
|
|
63
|
+
"@opentelemetry/core": "^1.27.0",
|
|
63
64
|
"@opentelemetry/context-async-hooks": "^1.26.0",
|
|
64
65
|
"@opentelemetry/semantic-conventions": "^1.25.1",
|
|
65
66
|
"@types/big.js": "^6.0.0",
|