@google-cloud/spanner 7.21.0 → 8.1.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 (76) hide show
  1. package/README.md +2 -0
  2. package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
  3. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +36 -1
  6. package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
  7. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
  8. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
  9. package/build/protos/google/spanner/v1/change_stream.proto +451 -0
  10. package/build/protos/google/spanner/v1/commit_response.proto +10 -5
  11. package/build/protos/google/spanner/v1/keys.proto +1 -1
  12. package/build/protos/google/spanner/v1/mutation.proto +1 -1
  13. package/build/protos/google/spanner/v1/query_plan.proto +1 -1
  14. package/build/protos/google/spanner/v1/result_set.proto +55 -49
  15. package/build/protos/google/spanner/v1/spanner.proto +1 -1
  16. package/build/protos/google/spanner/v1/transaction.proto +41 -357
  17. package/build/protos/google/spanner/v1/type.proto +1 -1
  18. package/build/protos/protos.d.ts +1577 -194
  19. package/build/protos/protos.js +3977 -288
  20. package/build/protos/protos.json +325 -3
  21. package/build/src/backup.js +7 -0
  22. package/build/src/batch-transaction.d.ts +48 -29
  23. package/build/src/batch-transaction.js +15 -100
  24. package/build/src/codec.js +63 -47
  25. package/build/src/common-grpc/service-object.js +1 -0
  26. package/build/src/common-grpc/service.js +35 -18
  27. package/build/src/common.d.ts +1 -0
  28. package/build/src/common.js +9 -1
  29. package/build/src/database.d.ts +1 -0
  30. package/build/src/database.js +54 -42
  31. package/build/src/helper.d.ts +99 -0
  32. package/build/src/helper.js +178 -0
  33. package/build/src/index.d.ts +33 -0
  34. package/build/src/index.js +202 -21
  35. package/build/src/instance-config.d.ts +1 -1
  36. package/build/src/instance-config.js +4 -0
  37. package/build/src/instance.js +12 -6
  38. package/build/src/instrument.js +5 -6
  39. package/build/src/metrics/constants.d.ts +36 -0
  40. package/build/src/metrics/constants.js +106 -0
  41. package/build/src/metrics/external-types.d.ts +20 -0
  42. package/build/src/metrics/external-types.js +32 -0
  43. package/build/src/metrics/interceptor.d.ts +13 -0
  44. package/build/src/metrics/interceptor.js +87 -0
  45. package/build/src/metrics/metrics-tracer-factory.d.ts +165 -0
  46. package/build/src/metrics/metrics-tracer-factory.js +389 -0
  47. package/build/src/metrics/metrics-tracer.d.ts +204 -0
  48. package/build/src/metrics/metrics-tracer.js +371 -0
  49. package/build/src/metrics/spanner-metrics-exporter.d.ts +35 -0
  50. package/build/src/metrics/spanner-metrics-exporter.js +119 -0
  51. package/build/src/metrics/transform.d.ts +144 -0
  52. package/build/src/metrics/transform.js +272 -0
  53. package/build/src/multiplexed-session.js +7 -1
  54. package/build/src/partial-result-stream.js +18 -10
  55. package/build/src/request_id_header.js +1 -0
  56. package/build/src/session-factory.d.ts +34 -0
  57. package/build/src/session-factory.js +35 -2
  58. package/build/src/session-pool.js +24 -8
  59. package/build/src/session.d.ts +0 -1
  60. package/build/src/session.js +7 -2
  61. package/build/src/table.js +6 -3
  62. package/build/src/transaction-runner.d.ts +1 -0
  63. package/build/src/transaction-runner.js +18 -2
  64. package/build/src/transaction.d.ts +42 -1
  65. package/build/src/transaction.js +258 -94
  66. package/build/src/v1/database_admin_client.d.ts +37 -2
  67. package/build/src/v1/database_admin_client.js +718 -168
  68. package/build/src/v1/database_admin_client_config.json +4 -0
  69. package/build/src/v1/instance_admin_client.d.ts +122 -1
  70. package/build/src/v1/instance_admin_client.js +765 -146
  71. package/build/src/v1/spanner_client.d.ts +2 -1
  72. package/build/src/v1/spanner_client.js +391 -85
  73. package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
  74. package/build/src/v1/spanner_executor_proxy_client.js +41 -19
  75. package/build/src/v1/spanner_proto_list.json +1 -0
  76. package/package.json +64 -58
@@ -15,6 +15,7 @@ export declare class SpannerExecutorProxyClient {
15
15
  private _defaults;
16
16
  private _universeDomain;
17
17
  private _servicePath;
18
+ private _log;
18
19
  auth: gax.GoogleAuth;
19
20
  descriptors: Descriptors;
20
21
  warn: (code: string, message: string, warnType?: string) => void;
@@ -49,7 +50,7 @@ export declare class SpannerExecutorProxyClient {
49
50
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
50
51
  * the environment variable GCLOUD_PROJECT for your project ID. If your
51
52
  * app is running in an environment which supports
52
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
53
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
53
54
  * your project ID will be detected automatically.
54
55
  * @param {string} [options.apiEndpoint] - The domain name of the
55
56
  * API remote host.
@@ -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
  });
@@ -1,4 +1,5 @@
1
1
  [
2
+ "../../protos/google/spanner/v1/change_stream.proto",
2
3
  "../../protos/google/spanner/v1/commit_response.proto",
3
4
  "../../protos/google/spanner/v1/keys.proto",
4
5
  "../../protos/google/spanner/v1/mutation.proto",
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.1.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,86 @@
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/monitoring": "^5.0.0",
59
+ "@google-cloud/opentelemetry-resource-util": "^2.4.0",
60
+ "@google-cloud/precise-date": "^5.0.0",
61
+ "@google-cloud/projectify": "^5.0.0",
62
+ "@google-cloud/promisify": "^5.0.0",
63
+ "@grpc/grpc-js": "^1.13.2",
64
+ "@grpc/proto-loader": "^0.7.13",
62
65
  "@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",
66
+ "@opentelemetry/context-async-hooks": "^2.0.0",
67
+ "@opentelemetry/core": "^2.0.0",
68
+ "@opentelemetry/resources": "^1.8.0",
69
+ "@opentelemetry/sdk-metrics": "^1.30.1",
70
+ "@opentelemetry/semantic-conventions": "^1.30.0",
71
+ "@types/big.js": "^6.2.2",
72
+ "@types/stack-trace": "^0.0.33",
73
+ "big.js": "^7.0.0",
74
+ "checkpoint-stream": "^0.1.2",
75
+ "duplexify": "^4.1.3",
72
76
  "events-intercept": "^2.0.0",
73
77
  "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",
78
+ "google-auth-library": "^10.0.0-rc.1",
79
+ "google-gax": "5.0.0",
80
+ "grpc-gcp": "^1.0.1",
78
81
  "lodash.snakecase": "^4.1.1",
79
82
  "merge-stream": "^2.0.0",
80
83
  "p-queue": "^6.0.2",
81
- "protobufjs": "^7.0.0",
82
- "retry-request": "^7.0.0",
84
+ "protobufjs": "^7.4.0",
85
+ "retry-request": "^8.0.0",
83
86
  "split-array-stream": "^2.0.0",
84
87
  "stack-trace": "0.0.10",
85
- "stream-events": "^1.0.4",
86
- "teeny-request": "^9.0.0",
87
- "through2": "^4.0.0"
88
+ "stream-events": "^1.0.5",
89
+ "teeny-request": "^10.0.0",
90
+ "through2": "^4.0.2",
91
+ "@babel/traverse": "7.27.7",
92
+ "@babel/core": "7.27.7",
93
+ "@babel/helpers": "7.27.6"
88
94
  },
89
95
  "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",
96
+ "@opentelemetry/sdk-trace-base": "^2.0.0",
97
+ "@opentelemetry/sdk-trace-node": "^2.0.0",
98
+ "@types/concat-stream": "^2.0.3",
99
+ "@types/extend": "^3.0.4",
100
+ "@types/is": "^0.0.25",
101
+ "@types/lodash.snakecase": "^4.1.9",
102
+ "@types/merge-stream": "^2.0.0",
103
+ "@types/mocha": "^10.0.10",
104
+ "@types/mv": "^2.1.4",
105
+ "@types/ncp": "^2.0.8",
106
+ "@types/proxyquire": "^1.3.31",
107
+ "@types/request": "^2.48.12",
108
+ "@types/sinon": "^17.0.4",
109
+ "@types/through2": "^2.0.41",
104
110
  "@types/uuid": "^10.0.0",
105
- "binary-search-bounds": "^2.0.4",
106
- "c8": "^8.0.1",
107
- "codecov": "^3.0.2",
111
+ "binary-search-bounds": "^2.0.5",
112
+ "c8": "^10.1.3",
113
+ "codecov": "^3.8.3",
108
114
  "concat-stream": "^2.0.0",
109
- "dedent": "^1.0.0",
115
+ "dedent": "^1.5.3",
110
116
  "execa": "^5.0.0",
111
- "gapic-tools": "^0.4.0",
112
- "gts": "^5.0.0",
113
- "jsdoc": "^4.0.0",
117
+ "gapic-tools": "^1.0.1",
118
+ "gts": "^6.0.2",
119
+ "jsdoc": "^4.0.4",
114
120
  "jsdoc-fresh": "^3.0.0",
115
121
  "jsdoc-region-tag": "^3.0.0",
116
- "linkinator": "^3.0.0",
122
+ "linkinator": "^6.1.2",
117
123
  "lodash.random": "^3.2.0",
118
- "mocha": "^9.2.2",
124
+ "mocha": "^11.1.0",
119
125
  "mv": "^2.1.1",
120
126
  "ncp": "^2.0.0",
121
- "nise": "6.0.0",
127
+ "nise": "^6.1.1",
122
128
  "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"
129
+ "path-to-regexp": "^8.2.0",
130
+ "proxyquire": "^2.1.3",
131
+ "sinon": "^21.0.0",
132
+ "stats-lite": "^2.2.0",
133
+ "time-span": "4.0.0",
134
+ "tmp": "^0.2.3",
135
+ "typescript": "^5.8.2",
136
+ "uuid": "^11.1.0",
137
+ "yargs": "^17.7.2"
132
138
  }
133
139
  }