@google-cloud/spanner 7.18.0 → 7.18.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -0
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +757 -0
  4. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
  5. package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
  6. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1209 -0
  7. package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
  8. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2110 -0
  9. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1520 -0
  10. package/build/protos/google/spanner/v1/commit_response.proto +59 -0
  11. package/build/protos/google/spanner/v1/keys.proto +163 -0
  12. package/build/protos/google/spanner/v1/mutation.proto +107 -0
  13. package/build/protos/google/spanner/v1/query_plan.proto +128 -0
  14. package/build/protos/google/spanner/v1/result_set.proto +237 -0
  15. package/build/protos/google/spanner/v1/spanner.proto +1389 -0
  16. package/build/protos/google/spanner/v1/transaction.proto +575 -0
  17. package/build/protos/google/spanner/v1/type.proto +214 -0
  18. package/build/protos/protos.d.ts +39317 -0
  19. package/build/protos/protos.js +100360 -0
  20. package/build/protos/protos.json +10271 -0
  21. package/build/src/backup.d.ts +349 -0
  22. package/build/src/backup.js +246 -0
  23. package/build/src/batch-transaction.d.ts +247 -0
  24. package/build/src/batch-transaction.js +384 -0
  25. package/build/src/codec.d.ts +362 -0
  26. package/build/src/codec.js +791 -0
  27. package/build/src/common-grpc/service-object.d.ts +80 -0
  28. package/build/src/common-grpc/service-object.js +101 -0
  29. package/build/src/common-grpc/service.d.ts +445 -0
  30. package/build/src/common-grpc/service.js +826 -0
  31. package/build/src/common.d.ts +66 -0
  32. package/build/src/common.js +54 -0
  33. package/build/src/database.d.ts +2103 -0
  34. package/build/src/database.js +1655 -0
  35. package/build/src/extra_proto_list.json +1 -0
  36. package/build/src/helper.d.ts +45 -0
  37. package/build/src/helper.js +71 -0
  38. package/build/src/index.d.ts +1195 -0
  39. package/build/src/index.js +1059 -0
  40. package/build/src/instance-config.d.ts +294 -0
  41. package/build/src/instance-config.js +216 -0
  42. package/build/src/instance.d.ts +832 -0
  43. package/build/src/instance.js +781 -0
  44. package/build/src/instrument.d.ts +85 -0
  45. package/build/src/instrument.js +215 -0
  46. package/build/src/multiplexed-session.d.ts +136 -0
  47. package/build/src/multiplexed-session.js +197 -0
  48. package/build/src/partial-result-stream.d.ts +253 -0
  49. package/build/src/partial-result-stream.js +400 -0
  50. package/build/src/session-factory.d.ts +100 -0
  51. package/build/src/session-factory.js +93 -0
  52. package/build/src/session-pool.d.ts +471 -0
  53. package/build/src/session-pool.js +754 -0
  54. package/build/src/session.d.ts +258 -0
  55. package/build/src/session.js +348 -0
  56. package/build/src/spanner_grpc_config.json +92 -0
  57. package/build/src/table.d.ts +831 -0
  58. package/build/src/table.js +277 -0
  59. package/build/src/transaction-runner.d.ts +185 -0
  60. package/build/src/transaction-runner.js +282 -0
  61. package/build/src/transaction.d.ts +1691 -0
  62. package/build/src/transaction.js +2004 -0
  63. package/build/src/v1/database_admin_client.d.ts +2301 -0
  64. package/build/src/v1/database_admin_client.js +2286 -0
  65. package/build/src/v1/database_admin_client_config.json +160 -0
  66. package/build/src/v1/database_admin_proto_list.json +6 -0
  67. package/build/src/v1/gapic_metadata.json +27 -0
  68. package/build/src/v1/index.d.ts +4 -0
  69. package/build/src/v1/index.js +29 -0
  70. package/build/src/v1/instance_admin_client.d.ts +1985 -0
  71. package/build/src/v1/instance_admin_client.js +1768 -0
  72. package/build/src/v1/instance_admin_client_config.json +129 -0
  73. package/build/src/v1/instance_admin_proto_list.json +4 -0
  74. package/build/src/v1/spanner_client.d.ts +1250 -0
  75. package/build/src/v1/spanner_client.js +1086 -0
  76. package/build/src/v1/spanner_client_config.json +119 -0
  77. package/build/src/v1/spanner_executor_proxy_client.d.ts +418 -0
  78. package/build/src/v1/spanner_executor_proxy_client.js +706 -0
  79. package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
  80. package/build/src/v1/spanner_executor_proxy_proto_list.json +14 -0
  81. package/build/src/v1/spanner_proto_list.json +10 -0
  82. package/package.json +1 -1
@@ -0,0 +1,1059 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright 2016 Google Inc. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SpannerDate = exports.PGNumeric = exports.Numeric = exports.Struct = exports.Int = exports.Float = exports.Float32 = exports.protos = exports.v1 = exports.MutationSet = exports.MutationGroup = exports.Transaction = exports.Snapshot = exports.PartitionedDml = exports.Table = exports.SessionPool = exports.Session = exports.Backup = exports.Database = exports.InstanceConfig = exports.Instance = exports.Spanner = void 0;
19
+ const service_1 = require("./common-grpc/service");
20
+ const precise_date_1 = require("@google-cloud/precise-date");
21
+ const projectify_1 = require("@google-cloud/projectify");
22
+ const promisify_1 = require("@google-cloud/promisify");
23
+ const extend = require("extend");
24
+ const google_auth_library_1 = require("google-auth-library");
25
+ const path = require("path");
26
+ const streamEvents = require("stream-events");
27
+ const through = require("through2");
28
+ const codec_1 = require("./codec");
29
+ Object.defineProperty(exports, "Float32", { enumerable: true, get: function () { return codec_1.Float32; } });
30
+ Object.defineProperty(exports, "Float", { enumerable: true, get: function () { return codec_1.Float; } });
31
+ Object.defineProperty(exports, "Int", { enumerable: true, get: function () { return codec_1.Int; } });
32
+ Object.defineProperty(exports, "Numeric", { enumerable: true, get: function () { return codec_1.Numeric; } });
33
+ Object.defineProperty(exports, "PGNumeric", { enumerable: true, get: function () { return codec_1.PGNumeric; } });
34
+ Object.defineProperty(exports, "SpannerDate", { enumerable: true, get: function () { return codec_1.SpannerDate; } });
35
+ Object.defineProperty(exports, "Struct", { enumerable: true, get: function () { return codec_1.Struct; } });
36
+ const api_1 = require("@opentelemetry/api");
37
+ const backup_1 = require("./backup");
38
+ Object.defineProperty(exports, "Backup", { enumerable: true, get: function () { return backup_1.Backup; } });
39
+ const database_1 = require("./database");
40
+ Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return database_1.Database; } });
41
+ const instance_1 = require("./instance");
42
+ Object.defineProperty(exports, "Instance", { enumerable: true, get: function () { return instance_1.Instance; } });
43
+ const instance_config_1 = require("./instance-config");
44
+ Object.defineProperty(exports, "InstanceConfig", { enumerable: true, get: function () { return instance_config_1.InstanceConfig; } });
45
+ const google_gax_1 = require("google-gax");
46
+ const protos_1 = require("../protos/protos");
47
+ const common_1 = require("./common");
48
+ const session_1 = require("./session");
49
+ Object.defineProperty(exports, "Session", { enumerable: true, get: function () { return session_1.Session; } });
50
+ const session_pool_1 = require("./session-pool");
51
+ Object.defineProperty(exports, "SessionPool", { enumerable: true, get: function () { return session_pool_1.SessionPool; } });
52
+ const table_1 = require("./table");
53
+ Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return table_1.Table; } });
54
+ const transaction_1 = require("./transaction");
55
+ Object.defineProperty(exports, "MutationGroup", { enumerable: true, get: function () { return transaction_1.MutationGroup; } });
56
+ Object.defineProperty(exports, "MutationSet", { enumerable: true, get: function () { return transaction_1.MutationSet; } });
57
+ Object.defineProperty(exports, "PartitionedDml", { enumerable: true, get: function () { return transaction_1.PartitionedDml; } });
58
+ Object.defineProperty(exports, "Snapshot", { enumerable: true, get: function () { return transaction_1.Snapshot; } });
59
+ Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_1.Transaction; } });
60
+ const grpcGcpModule = require("grpc-gcp");
61
+ const grpcGcp = grpcGcpModule(google_gax_1.grpc);
62
+ const v1 = require("./v1");
63
+ exports.v1 = v1;
64
+ const instrument_1 = require("./instrument");
65
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
66
+ const gcpApiConfig = require('./spanner_grpc_config.json');
67
+ /**
68
+ * [Cloud Spanner](https://cloud.google.com/spanner) is a highly scalable,
69
+ * transactional, managed, NewSQL database service. Cloud Spanner solves the
70
+ * need for a horizontally-scaling database with consistent global transaction
71
+ * and SQL semantics. With Cloud Spanner you don't need to choose between
72
+ * consistency and horizontal scaling — you get both.
73
+ *
74
+ * @class
75
+ *
76
+ * @see [Cloud Spanner Documentation](https://cloud.google.com/spanner/docs)
77
+ * @see [Cloud Spanner Concepts](https://cloud.google.com/spanner/docs/concepts)
78
+ *
79
+ * @example Install the client library with <a
80
+ * href="https://www.npmjs.com/">npm</a>:
81
+ * ```
82
+ * npm install --save @google-cloud/spanner
83
+ * ```
84
+ *
85
+ * @example Create a client that uses <a
86
+ * href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application
87
+ * Default Credentials (ADC)</a>:
88
+ * ```
89
+ * const client = new Spanner();
90
+ * ```
91
+ *
92
+ * @example Create a client with <a
93
+ * href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit
94
+ * credentials</a>:
95
+ * ```
96
+ * const client = new Spanner({ projectId:
97
+ * 'your-project-id', keyFilename: '/path/to/keyfile.json'
98
+ * });
99
+ * ```
100
+ *
101
+ * @example <caption>include:samples/quickstart.js</caption>
102
+ * region_tag:spanner_quickstart
103
+ * Full quickstart example:
104
+ *
105
+ * @param {ClientConfig} [options] Configuration options.
106
+ */
107
+ class Spanner extends service_1.GrpcService {
108
+ /**
109
+ * Gets the configured Spanner emulator host from an environment variable.
110
+ */
111
+ static getSpannerEmulatorHost() {
112
+ const endpointWithPort = process.env.SPANNER_EMULATOR_HOST;
113
+ if (endpointWithPort) {
114
+ if (endpointWithPort.startsWith('http:') ||
115
+ endpointWithPort.startsWith('https:')) {
116
+ throw new google_gax_1.GoogleError('SPANNER_EMULATOR_HOST must not start with a protocol specification (http/https)');
117
+ }
118
+ const index = endpointWithPort.indexOf(':');
119
+ if (index > -1) {
120
+ const portName = endpointWithPort.substring(index + 1);
121
+ const port = +portName;
122
+ if (!port || port < 1 || port > 65535) {
123
+ throw new google_gax_1.GoogleError(`Invalid port number: ${portName}`);
124
+ }
125
+ return {
126
+ endpoint: endpointWithPort.substring(0, index),
127
+ port: +endpointWithPort.substring(index + 1),
128
+ };
129
+ }
130
+ return { endpoint: endpointWithPort };
131
+ }
132
+ return undefined;
133
+ }
134
+ constructor(options) {
135
+ var _a;
136
+ const scopes = [];
137
+ const clientClasses = [
138
+ v1.DatabaseAdminClient,
139
+ v1.InstanceAdminClient,
140
+ v1.SpannerClient,
141
+ ];
142
+ for (const clientClass of clientClasses) {
143
+ for (const scope of clientClass.scopes) {
144
+ if (scopes.indexOf(scope) === -1) {
145
+ scopes.push(scope);
146
+ }
147
+ }
148
+ }
149
+ options = Object.assign({
150
+ libName: 'gccl',
151
+ libVersion: require('../../package.json').version,
152
+ scopes,
153
+ // Add grpc keep alive setting
154
+ 'grpc.keepalive_time_ms': 30000,
155
+ 'grpc.keepalive_timeout_ms': 10000,
156
+ // Enable grpc-gcp support
157
+ 'grpc.callInvocationTransformer': grpcGcp.gcpCallInvocationTransformer,
158
+ 'grpc.channelFactoryOverride': grpcGcp.gcpChannelFactoryOverride,
159
+ 'grpc.gcpApiConfig': grpcGcp.createGcpApiConfig(gcpApiConfig),
160
+ grpc: google_gax_1.grpc,
161
+ }, options || {});
162
+ const directedReadOptions = options.directedReadOptions
163
+ ? options.directedReadOptions
164
+ : null;
165
+ delete options.directedReadOptions;
166
+ const emulatorHost = Spanner.getSpannerEmulatorHost();
167
+ if (emulatorHost &&
168
+ emulatorHost.endpoint &&
169
+ emulatorHost.endpoint.length > 0) {
170
+ options.servicePath = emulatorHost.endpoint;
171
+ options.port = emulatorHost.port;
172
+ options.sslCreds = google_gax_1.grpc.credentials.createInsecure();
173
+ }
174
+ const config = {
175
+ baseUrl: options.apiEndpoint ||
176
+ options.servicePath ||
177
+ // TODO: for TPC, this needs to support universeDomain
178
+ 'spanner.googleapis.com',
179
+ protosDir: path.resolve(__dirname, '../protos'),
180
+ protoServices: {
181
+ Operations: {
182
+ path: 'google/longrunning/operations.proto',
183
+ service: 'longrunning',
184
+ },
185
+ },
186
+ scopes: ['https://www.googleapis.com/auth/cloud-platform'],
187
+ packageJson: require('../../package.json'),
188
+ };
189
+ super(config, options);
190
+ this.routeToLeaderEnabled = true;
191
+ if (options.routeToLeaderEnabled === false) {
192
+ this.routeToLeaderEnabled = false;
193
+ }
194
+ this.options = options;
195
+ this.auth = new google_auth_library_1.GoogleAuth(this.options);
196
+ this.clients_ = new Map();
197
+ this.instances_ = new Map();
198
+ this.instanceConfigs_ = new Map();
199
+ this.projectIdReplaced_ = false;
200
+ this.projectFormattedName_ = 'projects/' + this.projectId;
201
+ this.directedReadOptions = directedReadOptions;
202
+ this._observabilityOptions = options.observabilityOptions;
203
+ this.commonHeaders_ = (0, common_1.getCommonHeaders)(this.projectFormattedName_, (_a = this._observabilityOptions) === null || _a === void 0 ? void 0 : _a.enableEndToEndTracing);
204
+ (0, instrument_1.ensureInitialContextManagerSet)();
205
+ }
206
+ /**
207
+ * Gets the InstanceAdminClient object.
208
+ * The returned InstanceAdminClient object is a shared, managed instance and should not be manually closed.
209
+ * @returns {v1.InstanceAdminClient} The InstanceAdminClient object
210
+ * @example
211
+ * ```
212
+ * const {Spanner} = require('@google-cloud/spanner');
213
+ * const spanner = new Spanner({
214
+ * projectId: projectId,
215
+ * });
216
+ * const instanceAdminClient = spanner.getInstanceAdminClient();
217
+ * ```
218
+ */
219
+ getInstanceAdminClient() {
220
+ const clientName = 'InstanceAdminClient';
221
+ if (!this.clients_.has(clientName)) {
222
+ this.clients_.set(clientName, new v1[clientName](this.options));
223
+ }
224
+ return this.clients_.get(clientName);
225
+ }
226
+ /**
227
+ * Gets the DatabaseAdminClient object.
228
+ * The returned DatabaseAdminClient object is a managed, shared instance and should not be manually closed.
229
+ * @returns {v1.DatabaseAdminClient} The DatabaseAdminClient object.
230
+ * @example
231
+ * ```
232
+ * const {Spanner} = require('@google-cloud/spanner');
233
+ * const spanner = new Spanner({
234
+ * projectId: projectId,
235
+ * });
236
+ * const databaseAdminClient = spanner.getDatabaseAdminClient();
237
+ * ```
238
+ */
239
+ getDatabaseAdminClient() {
240
+ const clientName = 'DatabaseAdminClient';
241
+ if (!this.clients_.has(clientName)) {
242
+ this.clients_.set(clientName, new v1[clientName](this.options));
243
+ }
244
+ return this.clients_.get(clientName);
245
+ }
246
+ /** Closes this Spanner client and cleans up all resources used by it. */
247
+ close() {
248
+ this.clients_.forEach(c => {
249
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
250
+ const client = c;
251
+ if (client.operationsClient && client.operationsClient.close) {
252
+ client.operationsClient.close();
253
+ }
254
+ client.close();
255
+ });
256
+ }
257
+ createInstance(name, config, callback) {
258
+ if (!name) {
259
+ throw new google_gax_1.GoogleError('A name is required to create an instance.');
260
+ }
261
+ if (!config) {
262
+ throw new google_gax_1.GoogleError(['A configuration object is required to create an instance.'].join(''));
263
+ }
264
+ const formattedName = instance_1.Instance.formatName_(this.projectId, name);
265
+ const displayName = config.displayName || formattedName.split('/').pop();
266
+ const reqOpts = {
267
+ parent: this.projectFormattedName_,
268
+ instanceId: formattedName.split('/').pop(),
269
+ instance: extend({
270
+ name: formattedName,
271
+ displayName,
272
+ nodeCount: config.nodes,
273
+ processingUnits: config.processingUnits,
274
+ }, config),
275
+ };
276
+ if (reqOpts.instance.nodeCount && reqOpts.instance.processingUnits) {
277
+ throw new google_gax_1.GoogleError(['Only one of nodeCount or processingUnits can be specified.'].join(''));
278
+ }
279
+ if (!reqOpts.instance.nodeCount && !reqOpts.instance.processingUnits) {
280
+ // If neither nodes nor processingUnits are specified, default to a
281
+ // nodeCount of 1.
282
+ reqOpts.instance.nodeCount = 1;
283
+ }
284
+ delete reqOpts.instance.nodes;
285
+ delete reqOpts.instance.gaxOptions;
286
+ if (config.config.indexOf('/') === -1) {
287
+ reqOpts.instance.config = `projects/${this.projectId}/instanceConfigs/${config.config}`;
288
+ }
289
+ this.request({
290
+ client: 'InstanceAdminClient',
291
+ method: 'createInstance',
292
+ reqOpts,
293
+ gaxOpts: config.gaxOptions,
294
+ headers: this.commonHeaders_,
295
+ }, (err, operation, resp) => {
296
+ if (err) {
297
+ callback(err, null, null, resp);
298
+ return;
299
+ }
300
+ const instance = this.instance(formattedName);
301
+ instance._observabilityOptions = this._observabilityOptions;
302
+ callback(null, instance, operation, resp);
303
+ });
304
+ }
305
+ getInstances(optionsOrCallback, cb) {
306
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
307
+ const self = this;
308
+ const options = typeof optionsOrCallback === 'object'
309
+ ? optionsOrCallback
310
+ : {};
311
+ const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
312
+ const gaxOpts = extend(true, {}, options.gaxOptions);
313
+ let reqOpts = extend({}, options, {
314
+ parent: 'projects/' + this.projectId,
315
+ });
316
+ delete reqOpts.gaxOptions;
317
+ // Copy over pageSize and pageToken values from gaxOptions.
318
+ // However values set on options take precedence.
319
+ if (gaxOpts) {
320
+ reqOpts = extend({}, {
321
+ pageSize: gaxOpts.pageSize,
322
+ pageToken: gaxOpts.pageToken,
323
+ }, reqOpts);
324
+ delete gaxOpts.pageToken;
325
+ delete gaxOpts.pageSize;
326
+ }
327
+ this.request({
328
+ client: 'InstanceAdminClient',
329
+ method: 'listInstances',
330
+ reqOpts,
331
+ gaxOpts,
332
+ headers: this.commonHeaders_,
333
+ }, (err, instances, nextPageRequest, ...args) => {
334
+ let instanceInstances = null;
335
+ if (instances) {
336
+ instanceInstances = instances.map(instance => {
337
+ const instanceInstance = self.instance(instance.name);
338
+ instanceInstance.metadata = instance;
339
+ return instanceInstance;
340
+ });
341
+ }
342
+ const nextQuery = nextPageRequest
343
+ ? extend({}, options, nextPageRequest)
344
+ : null;
345
+ callback(err, instanceInstances, nextQuery, ...args);
346
+ });
347
+ }
348
+ /**
349
+ * Get a list of {@link Instance} objects as a readable object stream.
350
+ *
351
+ * Wrapper around {@link v1.InstanceAdminClient#listInstances}.
352
+ *
353
+ * @see {@link v1.InstanceAdminClient#listInstances}
354
+ * @see [ListInstances API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.ListInstances)
355
+ *
356
+ * @method Spanner#getInstancesStream
357
+ * @param {GetInstancesOptions} [options] Query object for listing instances.
358
+ * @returns {ReadableStream} A readable stream that emits {@link Instance}
359
+ * instances.
360
+ *
361
+ * @example
362
+ * ```
363
+ * const {Spanner} = require('@google-cloud/spanner');
364
+ * const spanner = new Spanner();
365
+ *
366
+ * spanner.getInstancesStream()
367
+ * .on('error', console.error)
368
+ * .on('data', function(instance) {
369
+ * // `instance` is an `Instance` object.
370
+ * })
371
+ * .on('end', function() {
372
+ * // All instances retrieved.
373
+ * });
374
+ *
375
+ * //-
376
+ * // If you anticipate many results, you can end a stream early to prevent
377
+ * // unnecessary processing and API requests.
378
+ * //-
379
+ * spanner.getInstancesStream()
380
+ * .on('data', function(instance) {
381
+ * this.end();
382
+ * });
383
+ * ```
384
+ */
385
+ getInstancesStream(options = {}) {
386
+ const gaxOpts = extend(true, {}, options.gaxOptions);
387
+ let reqOpts = extend({}, options, {
388
+ parent: 'projects/' + this.projectId,
389
+ });
390
+ delete reqOpts.gaxOptions;
391
+ // Copy over pageSize and pageToken values from gaxOptions.
392
+ // However values set on options take precedence.
393
+ if (gaxOpts) {
394
+ reqOpts = extend({}, {
395
+ pageSize: gaxOpts.pageSize,
396
+ pageToken: gaxOpts.pageToken,
397
+ }, reqOpts);
398
+ delete gaxOpts.pageSize;
399
+ delete gaxOpts.pageToken;
400
+ }
401
+ return this.requestStream({
402
+ client: 'InstanceAdminClient',
403
+ method: 'listInstancesStream',
404
+ reqOpts,
405
+ gaxOpts,
406
+ headers: this.commonHeaders_,
407
+ });
408
+ }
409
+ createInstanceConfig(name, config, callback) {
410
+ if (!name) {
411
+ throw new google_gax_1.GoogleError('A name is required to create an instance config.');
412
+ }
413
+ if (!config) {
414
+ throw new google_gax_1.GoogleError([
415
+ 'A configuration object is required to create an instance config.',
416
+ ].join(''));
417
+ }
418
+ if (!config.baseConfig) {
419
+ throw new google_gax_1.GoogleError(['Base instance config is required to create an instance config.'].join(''));
420
+ }
421
+ const formattedName = instance_config_1.InstanceConfig.formatName_(this.projectId, name);
422
+ const displayName = config.displayName || formattedName.split('/').pop();
423
+ const reqOpts = {
424
+ parent: this.projectFormattedName_,
425
+ instanceConfigId: formattedName.split('/').pop(),
426
+ instanceConfig: extend({
427
+ name: formattedName,
428
+ displayName,
429
+ }, config),
430
+ validateOnly: config.validateOnly,
431
+ };
432
+ if (config.baseConfig.indexOf('/') === -1) {
433
+ reqOpts.instanceConfig.baseConfig = `projects/${this.projectId}/instanceConfigs/${config.baseConfig}`;
434
+ }
435
+ // validateOnly need not be passed in if it is null.
436
+ if (reqOpts.validateOnly === null || reqOpts.validateOnly === undefined)
437
+ delete reqOpts.validateOnly;
438
+ // validateOnly and gaxOptions are not fields in InstanceConfig.
439
+ delete reqOpts.instanceConfig.validateOnly;
440
+ delete reqOpts.instanceConfig.gaxOptions;
441
+ this.request({
442
+ client: 'InstanceAdminClient',
443
+ method: 'createInstanceConfig',
444
+ reqOpts,
445
+ gaxOpts: config.gaxOptions,
446
+ headers: this.commonHeaders_,
447
+ }, (err, operation, resp) => {
448
+ if (err) {
449
+ callback(err, null, null, resp);
450
+ return;
451
+ }
452
+ const instanceConfig = this.instanceConfig(formattedName);
453
+ callback(null, instanceConfig, operation, resp);
454
+ });
455
+ }
456
+ getInstanceConfigs(optionsOrCallback, cb) {
457
+ const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
458
+ const options = typeof optionsOrCallback === 'object'
459
+ ? optionsOrCallback
460
+ : {};
461
+ const gaxOpts = extend(true, {}, options.gaxOptions);
462
+ let reqOpts = extend({}, options, {
463
+ parent: 'projects/' + this.projectId,
464
+ });
465
+ delete reqOpts.gaxOptions;
466
+ // Copy over pageSize and pageToken values from gaxOptions.
467
+ // However values set on options take precedence.
468
+ if (gaxOpts) {
469
+ reqOpts = extend({}, {
470
+ pageSize: gaxOpts.pageSize,
471
+ pageToken: gaxOpts.pageToken,
472
+ }, reqOpts);
473
+ delete gaxOpts.pageSize;
474
+ delete gaxOpts.pageToken;
475
+ }
476
+ return this.request({
477
+ client: 'InstanceAdminClient',
478
+ method: 'listInstanceConfigs',
479
+ reqOpts,
480
+ gaxOpts,
481
+ headers: this.commonHeaders_,
482
+ }, (err, instanceConfigs, nextPageRequest, ...args) => {
483
+ const nextQuery = nextPageRequest
484
+ ? extend({}, options, nextPageRequest)
485
+ : null;
486
+ callback(err, instanceConfigs, nextQuery, ...args);
487
+ });
488
+ }
489
+ /**
490
+ * Get a list of instance configs as a readable object stream.
491
+ *
492
+ * Wrapper around {@link v1.InstanceAdminClient#listInstanceConfigsStream}.
493
+ *
494
+ * @see {@link v1.InstanceAdminClient#listInstanceConfigsStream}
495
+ * @see [ListInstanceConfigs API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs)
496
+ *
497
+ * @method Spanner#getInstanceConfigsStream
498
+ * @param {GetInstanceConfigsOptions} [options] Query object for listing instance
499
+ * configs.
500
+ * @returns {ReadableStream} A readable stream that emits instance configs.
501
+ *
502
+ * @example
503
+ * ```
504
+ * const {Spanner} = require('@google-cloud/spanner');
505
+ * const spanner = new Spanner();
506
+ *
507
+ * spanner.getInstanceConfigsStream()
508
+ * .on('error', console.error)
509
+ * .on('data', function(instanceConfig) {})
510
+ * .on('end', function() {
511
+ * // All instances retrieved.
512
+ * });
513
+ *
514
+ * //-
515
+ * // If you anticipate many results, you can end a stream early to prevent
516
+ * // unnecessary processing and API requests.
517
+ * //-
518
+ * spanner.getInstanceConfigsStream()
519
+ * .on('data', function(instanceConfig) {
520
+ * this.end();
521
+ * });
522
+ * ```
523
+ */
524
+ getInstanceConfigsStream(options = {}) {
525
+ const gaxOpts = extend(true, {}, options.gaxOptions);
526
+ let reqOpts = extend({}, options, {
527
+ parent: 'projects/' + this.projectId,
528
+ });
529
+ // Copy over pageSize and pageToken values from gaxOptions.
530
+ // However values set on options take precedence.
531
+ if (gaxOpts) {
532
+ reqOpts = extend({}, {
533
+ pageSize: gaxOpts.pageSize,
534
+ pageToken: gaxOpts.pageToken,
535
+ }, reqOpts);
536
+ delete gaxOpts.pageSize;
537
+ delete gaxOpts.pageToken;
538
+ }
539
+ delete reqOpts.gaxOptions;
540
+ return this.requestStream({
541
+ client: 'InstanceAdminClient',
542
+ method: 'listInstanceConfigsStream',
543
+ reqOpts,
544
+ gaxOpts,
545
+ headers: this.commonHeaders_,
546
+ });
547
+ }
548
+ getInstanceConfig(name, optionsOrCallback, cb) {
549
+ const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
550
+ const options = typeof optionsOrCallback === 'object'
551
+ ? optionsOrCallback
552
+ : {};
553
+ const reqOpts = extend({}, {
554
+ name: 'projects/' + this.projectId + '/instanceConfigs/' + name,
555
+ });
556
+ const gaxOpts = extend({}, options.gaxOptions);
557
+ return this.request({
558
+ client: 'InstanceAdminClient',
559
+ method: 'getInstanceConfig',
560
+ reqOpts,
561
+ gaxOpts,
562
+ headers: this.commonHeaders_,
563
+ }, (err, instanceConfig) => {
564
+ callback(err, instanceConfig);
565
+ });
566
+ }
567
+ getInstanceConfigOperations(optionsOrCallback, cb) {
568
+ const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
569
+ const options = typeof optionsOrCallback === 'object'
570
+ ? optionsOrCallback
571
+ : {};
572
+ const gaxOpts = extend(true, {}, options.gaxOptions);
573
+ let reqOpts = extend({}, options, {
574
+ parent: this.projectFormattedName_,
575
+ });
576
+ delete reqOpts.gaxOptions;
577
+ // Copy over pageSize and pageToken values from gaxOptions.
578
+ // However, values set on options take precedence.
579
+ if (gaxOpts) {
580
+ reqOpts = extend({}, {
581
+ pageSize: gaxOpts.pageSize,
582
+ pageToken: gaxOpts.pageToken,
583
+ }, reqOpts);
584
+ delete gaxOpts.pageSize;
585
+ delete gaxOpts.pageToken;
586
+ }
587
+ this.request({
588
+ client: 'InstanceAdminClient',
589
+ method: 'listInstanceConfigOperations',
590
+ reqOpts,
591
+ gaxOpts,
592
+ headers: this.commonHeaders_,
593
+ }, (err, operations, nextPageRequest, ...args) => {
594
+ const nextQuery = nextPageRequest
595
+ ? extend({}, options, nextPageRequest)
596
+ : null;
597
+ callback(err, operations, nextQuery, ...args);
598
+ });
599
+ }
600
+ /**
601
+ * Get a reference to an Instance object.
602
+ *
603
+ * @throws {GoogleError} If a name is not provided.
604
+ *
605
+ * @param {string} name The name of the instance.
606
+ * @returns {Instance} An Instance object.
607
+ *
608
+ * @example
609
+ * ```
610
+ * const {Spanner} = require('@google-cloud/spanner');
611
+ * const spanner = new Spanner();
612
+ * const instance = spanner.instance('my-instance');
613
+ * ```
614
+ */
615
+ instance(name) {
616
+ if (!name) {
617
+ throw new google_gax_1.GoogleError('A name is required to access an Instance object.');
618
+ }
619
+ const key = name.split('/').pop();
620
+ if (!this.instances_.has(key)) {
621
+ this.instances_.set(key, new instance_1.Instance(this, name));
622
+ }
623
+ return this.instances_.get(key);
624
+ }
625
+ /**
626
+ * Get a reference to an InstanceConfig object.
627
+ *
628
+ * @throws {GoogleError} If a name is not provided.
629
+ *
630
+ * @param {string} name The name of the instance config.
631
+ * @returns {InstanceConfig} An InstanceConfig object.
632
+ *
633
+ * @example
634
+ * ```
635
+ * const {Spanner} = require('@google-cloud/spanner');
636
+ * const spanner = new Spanner();
637
+ * const instanceConfig = spanner.instanceConfig('my-instance-config');
638
+ * ```
639
+ */
640
+ instanceConfig(name) {
641
+ if (!name) {
642
+ throw new google_gax_1.GoogleError('A name is required to access an InstanceConfig object.');
643
+ }
644
+ const key = name.split('/').pop();
645
+ if (!this.instanceConfigs_.has(key)) {
646
+ this.instanceConfigs_.set(key, new instance_config_1.InstanceConfig(this, name));
647
+ }
648
+ return this.instanceConfigs_.get(key);
649
+ }
650
+ /**
651
+ * Prepare a gapic request. This will cache the GAX client and replace
652
+ * {{projectId}} placeholders, if necessary.
653
+ *
654
+ * @private
655
+ *
656
+ * @param {object} config Request config
657
+ * @param {function} callback Callback function
658
+ */
659
+ prepareGapicRequest_(config, callback) {
660
+ this.auth.getProjectId((err, projectId) => {
661
+ if (err) {
662
+ callback(err);
663
+ return;
664
+ }
665
+ const clientName = config.client;
666
+ if (!this.clients_.has(clientName)) {
667
+ this.clients_.set(clientName, new v1[clientName](this.options));
668
+ }
669
+ const gaxClient = this.clients_.get(clientName);
670
+ let reqOpts = extend(true, {}, config.reqOpts);
671
+ reqOpts = (0, projectify_1.replaceProjectIdToken)(reqOpts, projectId);
672
+ // It would have been preferable to replace the projectId already in the
673
+ // constructor of Spanner, but that is not possible as auth.getProjectId
674
+ // is an async method. This is therefore the first place where we have
675
+ // access to the value that should be used instead of the placeholder.
676
+ if (!this.projectIdReplaced_) {
677
+ this.projectId = (0, projectify_1.replaceProjectIdToken)(this.projectId, projectId);
678
+ this.projectFormattedName_ = (0, projectify_1.replaceProjectIdToken)(this.projectFormattedName_, projectId);
679
+ this.instances_.forEach(instance => {
680
+ instance.formattedName_ = (0, projectify_1.replaceProjectIdToken)(instance.formattedName_, projectId);
681
+ instance.databases_.forEach(database => {
682
+ database.formattedName_ = (0, projectify_1.replaceProjectIdToken)(database.formattedName_, projectId);
683
+ });
684
+ });
685
+ this.projectIdReplaced_ = true;
686
+ }
687
+ config.headers[common_1.CLOUD_RESOURCE_HEADER] = (0, projectify_1.replaceProjectIdToken)(config.headers[common_1.CLOUD_RESOURCE_HEADER], projectId);
688
+ // Do context propagation
689
+ api_1.propagation.inject(api_1.context.active(), config.headers, {
690
+ set: (carrier, key, value) => {
691
+ carrier[key] = value; // Set the span context (trace and span ID)
692
+ },
693
+ });
694
+ const requestFn = gaxClient[config.method].bind(gaxClient, reqOpts,
695
+ // Add headers to `gaxOpts`
696
+ extend(true, {}, config.gaxOpts, {
697
+ otherArgs: {
698
+ headers: config.headers,
699
+ },
700
+ }));
701
+ callback(null, requestFn);
702
+ });
703
+ }
704
+ /**
705
+ * Funnel all API requests through this method to be sure we have a project
706
+ * ID.
707
+ *
708
+ * @param {object} config Configuration object.
709
+ * @param {object} config.gaxOpts GAX options.
710
+ * @param {function} config.method The gax method to call.
711
+ * @param {object} config.reqOpts Request options.
712
+ * @param {function} [callback] Callback function.
713
+ * @returns {Promise}
714
+ */
715
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
716
+ request(config, callback) {
717
+ if (typeof callback === 'function') {
718
+ this.prepareGapicRequest_(config, (err, requestFn) => {
719
+ if (err) {
720
+ callback(err);
721
+ }
722
+ else {
723
+ requestFn(callback);
724
+ }
725
+ });
726
+ }
727
+ else {
728
+ return new Promise((resolve, reject) => {
729
+ this.prepareGapicRequest_(config, (err, requestFn) => {
730
+ if (err) {
731
+ reject(err);
732
+ }
733
+ else {
734
+ resolve(requestFn());
735
+ }
736
+ });
737
+ });
738
+ }
739
+ }
740
+ /**
741
+ * Funnel all streaming API requests through this method to be sure we have a
742
+ * project ID.
743
+ *
744
+ * @param {object} config Configuration object.
745
+ * @param {object} config.gaxOpts GAX options.
746
+ * @param {function} config.method The gax method to call.
747
+ * @param {object} config.reqOpts Request options.
748
+ * @param {function} [callback] Callback function.
749
+ * @returns {Stream}
750
+ */
751
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
752
+ requestStream(config) {
753
+ const stream = streamEvents(through.obj());
754
+ stream.once('reading', () => {
755
+ this.prepareGapicRequest_(config, (err, requestFn) => {
756
+ if (err) {
757
+ stream.destroy(err);
758
+ return;
759
+ }
760
+ requestFn()
761
+ .on('error', err => {
762
+ stream.destroy(err);
763
+ })
764
+ .pipe(stream);
765
+ });
766
+ });
767
+ return stream;
768
+ }
769
+ /**
770
+ * Helper function to get a Cloud Spanner Date object.
771
+ *
772
+ * DATE types represent a logical calendar date, independent of time zone.
773
+ * DATE values do not represent a specific 24-hour period. Rather, a given
774
+ * DATE value represents a different 24-hour period when interpreted in a
775
+ * different time zone. Because of this, all values passed to
776
+ * {@link Spanner.date} will be interpreted as local time.
777
+ *
778
+ * To represent an absolute point in time, use {@link Spanner.timestamp}.
779
+ *
780
+ * @param {string|number} [date] String representing the date or number
781
+ * representing the year.
782
+ * @param {number} [month] Number representing the month.
783
+ * @param {number} [date] Number representing the date.
784
+ * @returns {SpannerDate}
785
+ *
786
+ * @example
787
+ * ```
788
+ * const {Spanner} = require('@google-cloud/spanner');
789
+ * const date = Spanner.date('08-20-1969');
790
+ * ```
791
+ */
792
+ static date(dateStringOrYear, month, date) {
793
+ if (typeof dateStringOrYear === 'number') {
794
+ return new codec_1.codec.SpannerDate(dateStringOrYear, month, date);
795
+ }
796
+ return new codec_1.codec.SpannerDate(dateStringOrYear);
797
+ }
798
+ /**
799
+ * Date object with nanosecond precision. Supports all standard Date arguments
800
+ * in addition to several custom types.
801
+ * @external PreciseDate
802
+ * @see {@link https://github.com/googleapis/nodejs-precise-date|PreciseDate}
803
+ */
804
+ /**
805
+ * Helper function to get a Cloud Spanner Timestamp object.
806
+ *
807
+ * String timestamps should have a canonical format of
808
+ * `YYYY-[M]M-[D]D[( |T)[H]H:[M]M:[S]S[.DDDDDDDDD]]Z`
809
+ *
810
+ * **Timestamp values must be expressed in Zulu time and cannot include a UTC
811
+ * offset.**
812
+ *
813
+ * @see https://cloud.google.com/spanner/docs/data-types#timestamp-type
814
+ *
815
+ * @param {string|number|google.protobuf.Timestamp|external:PreciseDate}
816
+ * [timestamp] Either a RFC 3339 timestamp formatted string or a
817
+ * {@link google.protobuf.Timestamp} object. If a PreciseDate is given, it
818
+ * will return that timestamp as is.
819
+ * @returns {external:PreciseDate}
820
+ *
821
+ * @example
822
+ * ```
823
+ * const timestamp = Spanner.timestamp('2019-02-08T10:34:29.481145231Z');
824
+ *
825
+ * ```
826
+ * @example With a `google.protobuf.Timestamp` object
827
+ * ```
828
+ * const [seconds, nanos] = process.hrtime();
829
+ * const timestamp = Spanner.timestamp({seconds, nanos});
830
+ * ```
831
+ *
832
+ * @example With a Date timestamp
833
+ * ```
834
+ * const timestamp = Spanner.timestamp(Date.now());
835
+ * ```
836
+ */
837
+ static timestamp(value) {
838
+ value = value || Date.now();
839
+ if (value instanceof precise_date_1.PreciseDate) {
840
+ return value;
841
+ }
842
+ return new precise_date_1.PreciseDate(value);
843
+ }
844
+ /**
845
+ * Helper function to get a Cloud Spanner Float32 object.
846
+ *
847
+ * @param {string|number} value The float as a number or string.
848
+ * @returns {Float32}
849
+ *
850
+ * @example
851
+ * ```
852
+ * const {Spanner} = require('@google-cloud/spanner');
853
+ * const float = Spanner.float32(10);
854
+ * ```
855
+ */
856
+ static float32(value) {
857
+ return new codec_1.codec.Float32(value);
858
+ }
859
+ /**
860
+ * Helper function to get a Cloud Spanner Float64 object.
861
+ *
862
+ * @param {string|number} value The float as a number or string.
863
+ * @returns {Float}
864
+ *
865
+ * @example
866
+ * ```
867
+ * const {Spanner} = require('@google-cloud/spanner');
868
+ * const float = Spanner.float(10);
869
+ * ```
870
+ */
871
+ static float(value) {
872
+ return new codec_1.codec.Float(value);
873
+ }
874
+ /**
875
+ * Helper function to get a Cloud Spanner Int64 object.
876
+ *
877
+ * @param {string|number} value The int as a number or string.
878
+ * @returns {Int}
879
+ *
880
+ * @example
881
+ * ```
882
+ * const {Spanner} = require('@google-cloud/spanner');
883
+ * const int = Spanner.int(10);
884
+ * ```
885
+ */
886
+ static int(value) {
887
+ return new codec_1.codec.Int(value);
888
+ }
889
+ /**
890
+ * Helper function to get a Cloud Spanner Numeric object.
891
+ *
892
+ * @param {string} value The numeric value as a string.
893
+ * @returns {Numeric}
894
+ *
895
+ * @example
896
+ * ```
897
+ * const {Spanner} = require('@google-cloud/spanner');
898
+ * const numeric = Spanner.numeric("3.141592653");
899
+ * ```
900
+ */
901
+ static numeric(value) {
902
+ return new codec_1.codec.Numeric(value);
903
+ }
904
+ /**
905
+ * Helper function to get a Cloud Spanner pgNumeric object.
906
+ *
907
+ * @param {string} value The pgNumeric value as a string.
908
+ * @returns {PGNumeric}
909
+ *
910
+ * @example
911
+ * ```
912
+ * const {Spanner} = require('@google-cloud/spanner');
913
+ * const pgNumeric = Spanner.pgNumeric("3.141592653");
914
+ * ```
915
+ */
916
+ static pgNumeric(value) {
917
+ return new codec_1.codec.PGNumeric(value);
918
+ }
919
+ /**
920
+ * Helper function to get a Cloud Spanner pgJsonb object.
921
+ *
922
+ * @param {object|string} value The pgJsonb value as a string or object.
923
+ * @returns {PGJsonb}
924
+ *
925
+ * @example
926
+ * ```
927
+ * const {Spanner} = require('@google-cloud/spanner');
928
+ * const pgJsonb1 = Spanner.pgJsonb({rating: 6});
929
+ * const pgJsonb2 = Spanner.pgJsonb(`[
930
+ * {
931
+ * "name": null,
932
+ * "open": true
933
+ * }]`)
934
+ * ```
935
+ */
936
+ static pgJsonb(value) {
937
+ return new codec_1.codec.PGJsonb(value);
938
+ }
939
+ /**
940
+ * @typedef IProtoMessageParams
941
+ * @property {object} value Proto Message value as serialized-buffer or message object.
942
+ * @property {string} fullName Fully-qualified path name of proto message.
943
+ * @property {Function} [messageFunction] Function generated by protobufs containing
944
+ * helper methods for deserializing and serializing messages.
945
+ */
946
+ /**
947
+ * Helper function to get a Cloud Spanner proto Message object.
948
+ *
949
+ * @param {IProtoMessageParams} params The proto message value params
950
+ * @returns {ProtoMessage}
951
+ *
952
+ * @example
953
+ * ```
954
+ * const {Spanner} = require('@google-cloud/spanner');
955
+ * const protoMessage = Spanner.protoMessage({
956
+ * value: singerInfo,
957
+ * messageFunction: music.SingerInfo,
958
+ * fullName: "examples.spanner.music.SingerInfo"
959
+ * });
960
+ * ```
961
+ */
962
+ static protoMessage(params) {
963
+ return new codec_1.codec.ProtoMessage(params);
964
+ }
965
+ /**
966
+ * @typedef IProtoEnumParams
967
+ * @property {string | number} value Proto Enum value as a string constant or
968
+ * an integer constant.
969
+ * @property {string} fullName Fully-qualified path name of proto enum.
970
+ * @property {object} [enumObject] An enum object generated by protobufjs-cli.
971
+ */
972
+ /**
973
+ * Helper function to get a Cloud Spanner proto enum object.
974
+ *
975
+ * @param {IProtoEnumParams} params The proto enum value params in the format of
976
+ * @code{IProtoEnumParams}
977
+ * @returns {ProtoEnum}
978
+ *
979
+ * @example
980
+ * ```
981
+ * const {Spanner} = require('@google-cloud/spanner');
982
+ * const protoEnum = Spanner.protoEnum({
983
+ * value: 'ROCK',
984
+ * enumObject: music.Genre,
985
+ * fullName: "examples.spanner.music.Genre"
986
+ * });
987
+ * ```
988
+ */
989
+ static protoEnum(params) {
990
+ return new codec_1.codec.ProtoEnum(params);
991
+ }
992
+ /**
993
+ * Helper function to get a Cloud Spanner Struct object.
994
+ *
995
+ * @param {object} value The struct as a JSON object.
996
+ * @returns {Struct}
997
+ *
998
+ * @example
999
+ * ```
1000
+ * const {Spanner} = require('@google-cloud/spanner');
1001
+ * const struct = Spanner.struct({
1002
+ * user: 'bob',
1003
+ * age: 32
1004
+ * });
1005
+ * ```
1006
+ */
1007
+ static struct(value) {
1008
+ if (Array.isArray(value)) {
1009
+ return codec_1.codec.Struct.fromArray(value);
1010
+ }
1011
+ return codec_1.codec.Struct.fromJSON(value);
1012
+ }
1013
+ }
1014
+ exports.Spanner = Spanner;
1015
+ /**
1016
+ * Placeholder used to auto populate a column with the commit timestamp.
1017
+ * This can only be used for timestamp columns that have set the option
1018
+ * "(allow_commit_timestamp=true)" in the schema.
1019
+ *
1020
+ * @type {string}
1021
+ */
1022
+ Spanner.COMMIT_TIMESTAMP = 'spanner.commit_timestamp()';
1023
+ Spanner.POSTGRESQL = protos_1.google.spanner.admin.database.v1.DatabaseDialect.POSTGRESQL;
1024
+ Spanner.GOOGLE_STANDARD_SQL = protos_1.google.spanner.admin.database.v1.DatabaseDialect.GOOGLE_STANDARD_SQL;
1025
+ /*! Developer Documentation
1026
+ *
1027
+ * All async methods (except for streams) will return a Promise in the event
1028
+ * that a callback is omitted.
1029
+ */
1030
+ (0, promisify_1.promisifyAll)(Spanner, {
1031
+ exclude: [
1032
+ 'date',
1033
+ 'float32',
1034
+ 'float',
1035
+ 'instance',
1036
+ 'instanceConfig',
1037
+ 'int',
1038
+ 'numeric',
1039
+ 'pgNumeric',
1040
+ 'pgJsonb',
1041
+ 'operation',
1042
+ 'timestamp',
1043
+ 'getInstanceAdminClient',
1044
+ 'getDatabaseAdminClient',
1045
+ ],
1046
+ });
1047
+ /**
1048
+ * @type {object}
1049
+ * @property {constructor} DatabaseAdminClient
1050
+ * Reference to {@link v1.DatabaseAdminClient}
1051
+ * @property {constructor} InstanceAdminClient
1052
+ * Reference to {@link v1.InstanceAdminClient}
1053
+ * @property {constructor} SpannerClient
1054
+ * Reference to {@link v1.SpannerClient}
1055
+ */
1056
+ const protos = require("../protos/protos");
1057
+ exports.protos = protos;
1058
+ exports.default = { Spanner };
1059
+ //# sourceMappingURL=index.js.map