@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
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.SpannerExecutorProxyClient = void 0;
21
21
  const stream_1 = require("stream");
22
22
  const jsonProtos = require("../../protos/protos.json");
23
+ const google_gax_1 = require("google-gax");
23
24
  /**
24
25
  * Client JSON configuration object, loaded from
25
26
  * `src/v1/spanner_executor_proxy_client_config.json`.
@@ -33,6 +34,27 @@ const version = require('../../../package.json').version;
33
34
  * @memberof v1
34
35
  */
35
36
  class SpannerExecutorProxyClient {
37
+ _terminated = false;
38
+ _opts;
39
+ _providedCustomServicePath;
40
+ _gaxModule;
41
+ _gaxGrpc;
42
+ _protos;
43
+ _defaults;
44
+ _universeDomain;
45
+ _servicePath;
46
+ _log = google_gax_1.loggingUtils.log('executor');
47
+ auth;
48
+ descriptors = {
49
+ page: {},
50
+ stream: {},
51
+ longrunning: {},
52
+ batching: {},
53
+ };
54
+ warn;
55
+ innerApiCalls;
56
+ pathTemplates;
57
+ spannerExecutorProxyStub;
36
58
  /**
37
59
  * Construct an instance of SpannerExecutorProxyClient.
38
60
  *
@@ -55,7 +77,7 @@ class SpannerExecutorProxyClient {
55
77
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
56
78
  * the environment variable GCLOUD_PROJECT for your project ID. If your
57
79
  * app is running in an environment which supports
58
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
80
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
59
81
  * your project ID will be detected automatically.
60
82
  * @param {string} [options.apiEndpoint] - The domain name of the
61
83
  * API remote host.
@@ -73,32 +95,28 @@ class SpannerExecutorProxyClient {
73
95
  * ```
74
96
  */
75
97
  constructor(opts, gaxInstance) {
76
- var _a, _b, _c, _d, _e;
77
- this._terminated = false;
78
- this.descriptors = {
79
- page: {},
80
- stream: {},
81
- longrunning: {},
82
- batching: {},
83
- };
84
98
  // Ensure that options include all the required fields.
85
99
  const staticMembers = this.constructor;
86
- if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
87
- (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
88
- (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
89
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
90
104
  }
91
105
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
92
106
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
93
107
  : undefined;
94
108
  this._universeDomain =
95
- (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
96
113
  this._servicePath = 'spanner-cloud-executor.' + this._universeDomain;
97
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
98
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
99
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
100
- const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
101
- const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
114
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
+ const port = opts?.port || staticMembers.port;
117
+ const clientConfig = opts?.clientConfig ?? {};
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
102
120
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
103
121
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
104
122
  if (servicePath !== this._servicePath && !('scopes' in opts)) {
@@ -304,7 +322,10 @@ class SpannerExecutorProxyClient {
304
322
  * region_tag:spanner-cloud-executor_v1_generated_SpannerExecutorProxy_ExecuteActionAsync_async
305
323
  */
306
324
  executeActionAsync(options) {
307
- this.initialize();
325
+ this.initialize().catch(err => {
326
+ throw err;
327
+ });
328
+ this._log.info('executeActionAsync stream %j', options);
308
329
  return this.innerApiCalls.executeActionAsync(null, options);
309
330
  }
310
331
  // --------------------
@@ -695,6 +716,7 @@ class SpannerExecutorProxyClient {
695
716
  close() {
696
717
  if (this.spannerExecutorProxyStub && !this._terminated) {
697
718
  return this.spannerExecutorProxyStub.then(stub => {
719
+ this._log.info('ending gRPC channel');
698
720
  this._terminated = true;
699
721
  stub.close();
700
722
  });
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@google-cloud/spanner",
3
3
  "description": "Cloud Spanner Client Library for Node.js",
4
- "version": "7.21.0",
4
+ "version": "8.0.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Google Inc.",
7
7
  "engines": {
8
- "node": ">=14.0.0"
8
+ "node": ">=18"
9
9
  },
10
10
  "repository": "googleapis/nodejs-spanner",
11
11
  "main": "./build/src/index.js",
@@ -54,80 +54,79 @@
54
54
  "coverage": "c8 mocha build/test build/test/common && c8 report --check-coverage"
55
55
  },
56
56
  "dependencies": {
57
- "@google-cloud/common": "^5.0.0",
58
- "@google-cloud/precise-date": "^4.0.0",
59
- "@google-cloud/projectify": "^4.0.0",
60
- "@google-cloud/promisify": "4.0.0",
61
- "@grpc/proto-loader": "^0.7.0",
57
+ "@google-cloud/common": "^6.0.0",
58
+ "@google-cloud/precise-date": "^5.0.0",
59
+ "@google-cloud/projectify": "^5.0.0",
60
+ "@google-cloud/promisify": "^5.0.0",
61
+ "@grpc/proto-loader": "^0.7.13",
62
62
  "@opentelemetry/api": "^1.9.0",
63
- "@opentelemetry/core": "^1.27.0",
64
- "@opentelemetry/context-async-hooks": "^1.26.0",
65
- "@opentelemetry/semantic-conventions": "^1.25.1",
66
- "@types/big.js": "^6.0.0",
67
- "@types/stack-trace": "0.0.33",
68
- "arrify": "^2.0.0",
69
- "big.js": "^6.0.0",
70
- "checkpoint-stream": "^0.1.1",
71
- "duplexify": "^4.1.1",
63
+ "@opentelemetry/context-async-hooks": "^2.0.0",
64
+ "@opentelemetry/core": "^2.0.0",
65
+ "@opentelemetry/semantic-conventions": "^1.30.0",
66
+ "@types/big.js": "^6.2.2",
67
+ "@types/stack-trace": "^0.0.33",
68
+ "big.js": "^7.0.0",
69
+ "checkpoint-stream": "^0.1.2",
70
+ "duplexify": "^4.1.3",
72
71
  "events-intercept": "^2.0.0",
73
72
  "extend": "^3.0.2",
74
- "google-auth-library": "^9.0.0",
75
- "google-gax": "4.4.1",
76
- "grpc-gcp": "^1.0.0",
77
- "is": "^3.2.1",
73
+ "google-auth-library": "^10.0.0-rc.1",
74
+ "google-gax": "^5.0.1-rc.0",
75
+ "grpc-gcp": "^1.0.1",
76
+ "is": "^3.3.0",
78
77
  "lodash.snakecase": "^4.1.1",
79
78
  "merge-stream": "^2.0.0",
80
79
  "p-queue": "^6.0.2",
81
- "protobufjs": "^7.0.0",
82
- "retry-request": "^7.0.0",
80
+ "protobufjs": "^7.4.0",
81
+ "retry-request": "^8.0.0",
83
82
  "split-array-stream": "^2.0.0",
84
83
  "stack-trace": "0.0.10",
85
- "stream-events": "^1.0.4",
86
- "teeny-request": "^9.0.0",
87
- "through2": "^4.0.0"
84
+ "stream-events": "^1.0.5",
85
+ "teeny-request": "^10.0.0",
86
+ "through2": "^4.0.2"
88
87
  },
89
88
  "devDependencies": {
90
- "@opentelemetry/sdk-trace-base": "^1.26.0",
91
- "@opentelemetry/sdk-trace-node": "^1.26.0",
92
- "@types/concat-stream": "^2.0.0",
93
- "@types/extend": "^3.0.0",
94
- "@types/is": "0.0.25",
95
- "@types/lodash.snakecase": "^4.1.4",
96
- "@types/merge-stream": "^1.1.2",
97
- "@types/mocha": "^9.0.0",
98
- "@types/mv": "^2.1.0",
99
- "@types/ncp": "^2.0.1",
100
- "@types/proxyquire": "^1.3.28",
101
- "@types/request": "^2.48.3",
102
- "@types/sinon": "^17.0.0",
103
- "@types/through2": "^2.0.34",
89
+ "@opentelemetry/sdk-trace-base": "^2.0.0",
90
+ "@opentelemetry/sdk-trace-node": "^2.0.0",
91
+ "@types/concat-stream": "^2.0.3",
92
+ "@types/extend": "^3.0.4",
93
+ "@types/is": "^0.0.25",
94
+ "@types/lodash.snakecase": "^4.1.9",
95
+ "@types/merge-stream": "^2.0.0",
96
+ "@types/mocha": "^10.0.10",
97
+ "@types/mv": "^2.1.4",
98
+ "@types/ncp": "^2.0.8",
99
+ "@types/proxyquire": "^1.3.31",
100
+ "@types/request": "^2.48.12",
101
+ "@types/sinon": "^17.0.4",
102
+ "@types/through2": "^2.0.41",
104
103
  "@types/uuid": "^10.0.0",
105
- "binary-search-bounds": "^2.0.4",
106
- "c8": "^8.0.1",
107
- "codecov": "^3.0.2",
104
+ "binary-search-bounds": "^2.0.5",
105
+ "c8": "^10.1.3",
106
+ "codecov": "^3.8.3",
108
107
  "concat-stream": "^2.0.0",
109
- "dedent": "^1.0.0",
108
+ "dedent": "^1.5.3",
110
109
  "execa": "^5.0.0",
111
- "gapic-tools": "^0.4.0",
112
- "gts": "^5.0.0",
113
- "jsdoc": "^4.0.0",
110
+ "gapic-tools": "^1.0.1",
111
+ "gts": "^6.0.2",
112
+ "jsdoc": "^4.0.4",
114
113
  "jsdoc-fresh": "^3.0.0",
115
114
  "jsdoc-region-tag": "^3.0.0",
116
- "linkinator": "^3.0.0",
115
+ "linkinator": "^6.1.2",
117
116
  "lodash.random": "^3.2.0",
118
- "mocha": "^9.2.2",
117
+ "mocha": "^11.1.0",
119
118
  "mv": "^2.1.1",
120
119
  "ncp": "^2.0.0",
121
- "nise": "6.0.0",
120
+ "nise": "^6.1.1",
122
121
  "p-limit": "^3.0.1",
123
- "path-to-regexp": "6.2.2",
124
- "proxyquire": "^2.0.1",
125
- "sinon": "^18.0.0",
126
- "stats-lite": "^2.1.1",
127
- "time-span": "^4.0.0",
128
- "tmp": "^0.2.0",
129
- "typescript": "^5.1.6",
130
- "uuid": "^10.0.0",
131
- "yargs": "^17.0.0"
122
+ "path-to-regexp": "^8.2.0",
123
+ "proxyquire": "^2.1.3",
124
+ "sinon": "^20.0.0",
125
+ "stats-lite": "^2.2.0",
126
+ "time-span": "4.0.0",
127
+ "tmp": "^0.2.3",
128
+ "typescript": "^5.8.2",
129
+ "uuid": "^11.1.0",
130
+ "yargs": "^17.7.2"
132
131
  }
133
132
  }