@google-cloud/spanner 7.17.1 → 7.18.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 (81) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +1 -1
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +0 -757
  4. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +0 -230
  5. package/build/protos/google/spanner/admin/database/v1/common.proto +0 -132
  6. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +0 -1209
  7. package/build/protos/google/spanner/admin/instance/v1/common.proto +0 -63
  8. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +0 -1983
  9. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +0 -1520
  10. package/build/protos/google/spanner/v1/commit_response.proto +0 -59
  11. package/build/protos/google/spanner/v1/keys.proto +0 -163
  12. package/build/protos/google/spanner/v1/mutation.proto +0 -107
  13. package/build/protos/google/spanner/v1/query_plan.proto +0 -128
  14. package/build/protos/google/spanner/v1/result_set.proto +0 -237
  15. package/build/protos/google/spanner/v1/spanner.proto +0 -1389
  16. package/build/protos/google/spanner/v1/transaction.proto +0 -575
  17. package/build/protos/google/spanner/v1/type.proto +0 -210
  18. package/build/protos/protos.d.ts +0 -38999
  19. package/build/protos/protos.js +0 -99538
  20. package/build/protos/protos.json +0 -10182
  21. package/build/src/backup.d.ts +0 -349
  22. package/build/src/backup.js +0 -246
  23. package/build/src/batch-transaction.d.ts +0 -247
  24. package/build/src/batch-transaction.js +0 -384
  25. package/build/src/codec.d.ts +0 -362
  26. package/build/src/codec.js +0 -791
  27. package/build/src/common-grpc/service-object.d.ts +0 -80
  28. package/build/src/common-grpc/service-object.js +0 -101
  29. package/build/src/common-grpc/service.d.ts +0 -445
  30. package/build/src/common-grpc/service.js +0 -826
  31. package/build/src/common.d.ts +0 -66
  32. package/build/src/common.js +0 -54
  33. package/build/src/database.d.ts +0 -2104
  34. package/build/src/database.js +0 -1655
  35. package/build/src/extra_proto_list.json +0 -1
  36. package/build/src/helper.d.ts +0 -45
  37. package/build/src/helper.js +0 -71
  38. package/build/src/index.d.ts +0 -1195
  39. package/build/src/index.js +0 -1059
  40. package/build/src/instance-config.d.ts +0 -295
  41. package/build/src/instance-config.js +0 -216
  42. package/build/src/instance.d.ts +0 -833
  43. package/build/src/instance.js +0 -781
  44. package/build/src/instrument.d.ts +0 -85
  45. package/build/src/instrument.js +0 -212
  46. package/build/src/multiplexed-session.d.ts +0 -136
  47. package/build/src/multiplexed-session.js +0 -197
  48. package/build/src/partial-result-stream.d.ts +0 -253
  49. package/build/src/partial-result-stream.js +0 -400
  50. package/build/src/session-factory.d.ts +0 -101
  51. package/build/src/session-factory.js +0 -93
  52. package/build/src/session-pool.d.ts +0 -471
  53. package/build/src/session-pool.js +0 -754
  54. package/build/src/session.d.ts +0 -259
  55. package/build/src/session.js +0 -348
  56. package/build/src/spanner_grpc_config.json +0 -92
  57. package/build/src/table.d.ts +0 -831
  58. package/build/src/table.js +0 -277
  59. package/build/src/transaction-runner.d.ts +0 -185
  60. package/build/src/transaction-runner.js +0 -282
  61. package/build/src/transaction.d.ts +0 -1691
  62. package/build/src/transaction.js +0 -2004
  63. package/build/src/v1/database_admin_client.d.ts +0 -2301
  64. package/build/src/v1/database_admin_client.js +0 -2286
  65. package/build/src/v1/database_admin_client_config.json +0 -160
  66. package/build/src/v1/database_admin_proto_list.json +0 -6
  67. package/build/src/v1/gapic_metadata.json +0 -27
  68. package/build/src/v1/index.d.ts +0 -4
  69. package/build/src/v1/index.js +0 -29
  70. package/build/src/v1/instance_admin_client.d.ts +0 -1982
  71. package/build/src/v1/instance_admin_client.js +0 -1766
  72. package/build/src/v1/instance_admin_client_config.json +0 -129
  73. package/build/src/v1/instance_admin_proto_list.json +0 -4
  74. package/build/src/v1/spanner_client.d.ts +0 -1250
  75. package/build/src/v1/spanner_client.js +0 -1086
  76. package/build/src/v1/spanner_client_config.json +0 -119
  77. package/build/src/v1/spanner_executor_proxy_client.d.ts +0 -418
  78. package/build/src/v1/spanner_executor_proxy_client.js +0 -706
  79. package/build/src/v1/spanner_executor_proxy_client_config.json +0 -30
  80. package/build/src/v1/spanner_executor_proxy_proto_list.json +0 -14
  81. package/build/src/v1/spanner_proto_list.json +0 -10
@@ -1,259 +0,0 @@
1
- /*!
2
- * Copyright 2016 Google Inc. All Rights Reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /*!
17
- * @module spanner/session
18
- */
19
- declare const common: any;
20
- import * as r from 'teeny-request';
21
- import { Snapshot, Transaction, PartitionedDml, TimestampBounds } from './transaction';
22
- import { google } from '../protos/protos';
23
- import { Database } from './database';
24
- import { NormalCallback } from './common';
25
- import { grpc, CallOptions } from 'google-gax';
26
- import IRequestOptions = google.spanner.v1.IRequestOptions;
27
- export type GetSessionResponse = [Session, r.Response];
28
- /**
29
- * @deprecated. enum to capture the possible session types
30
- */
31
- export declare const enum types {
32
- ReadOnly = "readonly",
33
- ReadWrite = "readwrite"
34
- }
35
- export interface GetSessionMetadataResponse {
36
- name?: string | null;
37
- labels?: {
38
- [k: string]: string;
39
- } | null;
40
- createTime?: google.protobuf.ITimestamp | null;
41
- approximateLastUseTime?: google.protobuf.ITimestamp | null;
42
- databaseRole?: string | null;
43
- }
44
- export type GetSessionMetadataCallback = NormalCallback<GetSessionMetadataResponse>;
45
- export type KeepAliveCallback = NormalCallback<google.spanner.v1.IResultSet>;
46
- export type KeepAliveResponse = [google.spanner.v1.IResultSet];
47
- export type DeleteSessionResponse = [google.protobuf.IEmpty];
48
- export type DeleteSessionCallback = NormalCallback<google.protobuf.IEmpty>;
49
- /**
50
- * Create a Session object to interact with a Cloud Spanner session.
51
- *
52
- * **It is unlikely you will need to interact with sessions directly. By
53
- * default, sessions are created and utilized for maximum performance
54
- * automatically.**
55
- *
56
- * @class
57
- * @param {Database} database Parent {@link Database} instance.
58
- * @param {string} [name] The name of the session. If not provided, it is
59
- * assumed you are going to create it.
60
- *
61
- * @example
62
- * ```
63
- * const {Spanner} = require('@google-cloud/spanner');
64
- * const spanner = new Spanner();
65
- *
66
- * const instance = spanner.instance('my-instance');
67
- * const database = instance.database('my-database');
68
- *
69
- * //-
70
- * // To create a session manually, don't provide a name.
71
- * //-
72
- * const session = database.session();
73
- *
74
- * session.create(function(err) {
75
- * if (err) {
76
- * // Error handling omitted.
77
- * }
78
- *
79
- * // Session created successfully.
80
- * // `session.id` = The name of the session.
81
- * });
82
- *
83
- * //-
84
- * // To access a previously-created session, provide a name.
85
- * //-
86
- * const session = database.session('session-name');
87
- * ```
88
- */
89
- export declare class Session extends common.GrpcServiceObject {
90
- static [x: string]: any;
91
- id: string;
92
- formattedName_?: string;
93
- txn?: Transaction;
94
- lastUsed?: number;
95
- lastError?: grpc.ServiceError;
96
- commonHeaders_: {
97
- [k: string]: string;
98
- };
99
- constructor(database: Database, name?: string);
100
- /**
101
- * Delete a session.
102
- *
103
- * Wrapper around {@link v1.SpannerClient#deleteSession}.
104
- *
105
- * @see {@link v1.SpannerClient#deleteSession}
106
- * @see [DeleteSession API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.DeleteSession)
107
- *
108
- * @param {object} [gaxOptions] Request configuration options,
109
- * See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
110
- * for more details.
111
- * @param {DeleteSessionCallback} [callback] Callback function.
112
- * @returns {Promise<DeleteSessionResponse>}
113
- *
114
- * @example
115
- * ```
116
- * session.delete(function(err, apiResponse) {
117
- * if (err) {
118
- * // Error handling omitted.
119
- * }
120
- *
121
- * // Session deleted successfully.
122
- * });
123
- *
124
- * //-
125
- * //Returns a Promise if the callback is omitted.
126
- * //-
127
- * session.delete().then(function(data) {
128
- * const apiResponse = data[0];
129
- * });
130
- * ```
131
- */
132
- delete(gaxOptions?: CallOptions): Promise<DeleteSessionResponse>;
133
- delete(callback: DeleteSessionCallback): void;
134
- delete(gaxOptions: CallOptions, callback: DeleteSessionCallback): void;
135
- /**
136
- * @typedef {array} GetSessionMetadataResponse
137
- * @property {object} 0 The session's metadata.
138
- * @property {object} 1 The full API response.
139
- */
140
- /**
141
- * @callback GetSessionMetadataCallback
142
- * @param {?Error} err Request error, if any.
143
- * @param {object} metadata The session's metadata.
144
- * @param {object} apiResponse The full API response.
145
- */
146
- /**
147
- * Get the session's metadata.
148
- *
149
- * Wrapper around {@link v1.SpannerClient#getSession}.
150
- *
151
- * @see {@link v1.SpannerClient#getSession}
152
- * @see [GetSession API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.GetSession)
153
- *
154
- * @param {object} [gaxOptions] Request configuration options,
155
- * See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
156
- * for more details.
157
- * @param {GetSessionMetadataCallback} [callback] Callback function.
158
- * @returns {Promise<GetSessionMetadataResponse>}
159
- *
160
- * @example
161
- * ```
162
- * session.getMetadata(function(err, metadata, apiResponse) {});
163
- *
164
- * //-
165
- * //Returns a Promise if the callback is omitted.
166
- * //-
167
- * session.getMetadata().then(function(data) {
168
- * const metadata = data[0];
169
- * const apiResponse = data[1];
170
- * });
171
- * ```
172
- */
173
- getMetadata(gaxOptions?: CallOptions): Promise<GetSessionMetadataResponse>;
174
- getMetadata(callback: GetSessionMetadataCallback): void;
175
- getMetadata(gaxOptions: CallOptions, callback: GetSessionMetadataCallback): void;
176
- /**
177
- * Ping the session with `SELECT 1` to prevent it from expiring.
178
- *
179
- * @param {object} [gaxOptions] Request configuration options,
180
- * See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
181
- * for more details.
182
- * @param {BasicCallback} [callback] Callback function.
183
- * @returns {Promise<BasicResponse>}
184
- *
185
- * @example
186
- * ```
187
- * session.keepAlive(function(err) {
188
- * if (err) {
189
- * // An error occurred while trying to keep this session alive.
190
- * }
191
- * });
192
- * ```
193
- */
194
- keepAlive(gaxOptions?: CallOptions): Promise<KeepAliveResponse>;
195
- keepAlive(callback: KeepAliveCallback): void;
196
- keepAlive(gaxOptions: CallOptions, callback: KeepAliveCallback): void;
197
- /**
198
- * Create a PartitionedDml transaction.
199
- *
200
- * @returns {PartitionedDml}
201
- *
202
- * @example
203
- * ```
204
- * const transaction = session.partitionedDml();
205
- * ```
206
- */
207
- partitionedDml(): PartitionedDml;
208
- /**
209
- * Create a Snapshot transaction.
210
- *
211
- * @param {TimestampBounds} [options] The timestamp bounds.
212
- * @param {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions] The default query options to use.
213
- * @returns {Snapshot}
214
- *
215
- * @example
216
- * ```
217
- * const snapshot = session.snapshot({strong: false});
218
- * ```
219
- */
220
- snapshot(options?: TimestampBounds, queryOptions?: google.spanner.v1.ExecuteSqlRequest.IQueryOptions): Snapshot;
221
- /**
222
- * Create a read write Transaction.
223
- *
224
- * @param {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions] The default query options to use.
225
- * @return {Transaction}
226
- *
227
- * @example
228
- * ```
229
- * const transaction = session.transaction();
230
- * ```
231
- */
232
- transaction(queryOptions?: google.spanner.v1.ExecuteSqlRequest.IQueryOptions, requestOptions?: Pick<IRequestOptions, 'transactionTag'>): Transaction;
233
- /**
234
- * Format the session name to include the parent database's name.
235
- *
236
- * @private
237
- *
238
- * @param {string} databaseName The parent database's name.
239
- * @param {string} name The instance name.
240
- * @returns {string}
241
- *
242
- * @example
243
- * ```
244
- * Session.formatName_('my-database', 'my-session');
245
- * // 'projects/grape-spaceship-123/instances/my-instance/' +
246
- * // 'databases/my-database/sessions/my-session'
247
- * ```
248
- */
249
- static formatName_(databaseName: string, name: string): string;
250
- /**
251
- * Gets the Spanner object
252
- *
253
- * @private
254
- *
255
- * @returns {Spanner}
256
- */
257
- private _getSpanner;
258
- }
259
- export {};
@@ -1,348 +0,0 @@
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.Session = void 0;
19
- /*!
20
- * @module spanner/session
21
- */
22
- // eslint-disable-next-line @typescript-eslint/no-var-requires
23
- const common = require('./common-grpc/service-object');
24
- const promisify_1 = require("@google-cloud/promisify");
25
- const extend = require("extend");
26
- const transaction_1 = require("./transaction");
27
- const common_1 = require("./common");
28
- /**
29
- * Create a Session object to interact with a Cloud Spanner session.
30
- *
31
- * **It is unlikely you will need to interact with sessions directly. By
32
- * default, sessions are created and utilized for maximum performance
33
- * automatically.**
34
- *
35
- * @class
36
- * @param {Database} database Parent {@link Database} instance.
37
- * @param {string} [name] The name of the session. If not provided, it is
38
- * assumed you are going to create it.
39
- *
40
- * @example
41
- * ```
42
- * const {Spanner} = require('@google-cloud/spanner');
43
- * const spanner = new Spanner();
44
- *
45
- * const instance = spanner.instance('my-instance');
46
- * const database = instance.database('my-database');
47
- *
48
- * //-
49
- * // To create a session manually, don't provide a name.
50
- * //-
51
- * const session = database.session();
52
- *
53
- * session.create(function(err) {
54
- * if (err) {
55
- * // Error handling omitted.
56
- * }
57
- *
58
- * // Session created successfully.
59
- * // `session.id` = The name of the session.
60
- * });
61
- *
62
- * //-
63
- * // To access a previously-created session, provide a name.
64
- * //-
65
- * const session = database.session('session-name');
66
- * ```
67
- */
68
- class Session extends common.GrpcServiceObject {
69
- constructor(database, name) {
70
- var _a;
71
- const methods = {
72
- /**
73
- * Create a session.
74
- *
75
- * @method Session#create
76
- * @param {object} [options] See {@link Database#createSession}.
77
- * @param {CreateSessionCallback} [callback] Callback function.
78
- * @returns {Promise<CreateSessionResponse>}
79
- *
80
- * @example
81
- * ```
82
- * session.create(function(err, session, apiResponse) {
83
- * if (err) {
84
- * // Error handling omitted.
85
- * }
86
- *
87
- * // Session created successfully.
88
- * });
89
- *
90
- * //-
91
- * //Returns a Promise if the callback is omitted.
92
- * //-
93
- * session.create()
94
- * .then(function(data) {
95
- * const session = data[0];
96
- * const apiResponse = data[1];
97
- *
98
- * // Session created successfully.
99
- * });
100
- * ```
101
- */
102
- create: true,
103
- /**
104
- * @typedef {array} SessionExistsResponse
105
- * @property {boolean} 0 Whether the {@link Session} exists.
106
- */
107
- /**
108
- * @callback SessionExistsCallback
109
- * @param {?Error} err Request error, if any.
110
- * @param {boolean} exists Whether the {@link Session} exists.
111
- */
112
- /**
113
- * Check if a session exists.
114
- *
115
- * @method Session#exists
116
- * @param {SessionExistsCallback} [callback] Callback function.
117
- * @returns {Promise<SessionExistsResponse>}
118
- *
119
- * @example
120
- * ```
121
- * session.exists(function(err, exists) {});
122
- *
123
- * //-
124
- * //Returns a Promise if the callback is omitted.
125
- * //-
126
- * session.exists().then(function(data) {
127
- * const exists = data[0];
128
- * });
129
- * ```
130
- */
131
- exists: true,
132
- /**
133
- * @typedef {array} GetSessionResponse
134
- * @property {Session} 0 The {@link Session}.
135
- * @property {object} 1 The full API response.
136
- */
137
- /**
138
- * @callback CreateSessionCallback
139
- * @param {?Error} err Request error, if any.
140
- * @param {Session} session The {@link Session}.
141
- * @param {object} apiResponse The full API response.
142
- */
143
- /**
144
- * Get a session if it exists.
145
- *
146
- * You may optionally use this to "get or create" an object by providing
147
- * an object with `autoCreate` set to `true`. Any extra configuration that
148
- * is normally required for the `create` method must be contained within
149
- * this object as well.
150
- *
151
- * @method Session#get
152
- * @param {options} [options] Configuration object.
153
- * @param {boolean} [options.autoCreate=false] Automatically create the
154
- * object if it does not exist.
155
- * @param {CreateSessionCallback} [callback] Callback function.
156
- * @returns {Promise<GetSessionResponse>}
157
- *
158
- * @example
159
- * ```
160
- * session.get(function(err, session, apiResponse) {
161
- * // `session.metadata` has been populated.
162
- * });
163
- *
164
- * //-
165
- * //Returns a Promise if the callback is omitted.
166
- * //-
167
- * session.get().then(function(data) {
168
- * const session = data[0];
169
- * const apiResponse = data[0];
170
- * });
171
- * ```
172
- */
173
- get: true,
174
- };
175
- super({
176
- parent: database,
177
- /**
178
- * @name Session#id
179
- * @type {string}
180
- */
181
- id: name,
182
- methods,
183
- createMethod: (_, optionsOrCallback, callback) => {
184
- const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
185
- callback =
186
- typeof optionsOrCallback === 'function'
187
- ? optionsOrCallback
188
- : callback;
189
- this.labels = options.labels || null;
190
- this.databaseRole =
191
- options.databaseRole || database.databaseRole || null;
192
- return database.createSession(options, (err, session, apiResponse) => {
193
- if (err) {
194
- callback(err, null, apiResponse);
195
- return;
196
- }
197
- extend(this, session);
198
- callback(null, this, apiResponse);
199
- });
200
- },
201
- });
202
- this.commonHeaders_ = (0, common_1.getCommonHeaders)(this.parent.formattedName_, (_a = database._observabilityOptions) === null || _a === void 0 ? void 0 : _a.enableEndToEndTracing);
203
- this.request = database.request;
204
- this.requestStream = database.requestStream;
205
- if (name) {
206
- this.formattedName_ = Session.formatName_(database.formattedName_, name);
207
- }
208
- }
209
- delete(optionsOrCallback, cb) {
210
- const gaxOpts = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
211
- const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
212
- const reqOpts = {
213
- name: this.formattedName_,
214
- };
215
- return this.request({
216
- client: 'SpannerClient',
217
- method: 'deleteSession',
218
- reqOpts,
219
- gaxOpts,
220
- headers: this.commonHeaders_,
221
- }, callback);
222
- }
223
- getMetadata(optionsOrCallback, cb) {
224
- const gaxOpts = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
225
- const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
226
- const reqOpts = {
227
- name: this.formattedName_,
228
- };
229
- const headers = this.commonHeaders_;
230
- if (this._getSpanner().routeToLeaderEnabled) {
231
- (0, common_1.addLeaderAwareRoutingHeader)(headers);
232
- }
233
- return this.request({
234
- client: 'SpannerClient',
235
- method: 'getSession',
236
- reqOpts,
237
- gaxOpts,
238
- headers: headers,
239
- }, (err, resp) => {
240
- if (resp) {
241
- resp.databaseRole = resp.creatorRole;
242
- delete resp.creatorRole;
243
- this.metadata = resp;
244
- }
245
- callback(err, resp);
246
- });
247
- }
248
- keepAlive(optionsOrCallback, cb) {
249
- const gaxOpts = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
250
- const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
251
- const reqOpts = {
252
- session: this.formattedName_,
253
- sql: 'SELECT 1',
254
- };
255
- return this.request({
256
- client: 'SpannerClient',
257
- method: 'executeSql',
258
- reqOpts,
259
- gaxOpts,
260
- headers: this.commonHeaders_,
261
- }, callback);
262
- }
263
- /**
264
- * Create a PartitionedDml transaction.
265
- *
266
- * @returns {PartitionedDml}
267
- *
268
- * @example
269
- * ```
270
- * const transaction = session.partitionedDml();
271
- * ```
272
- */
273
- partitionedDml() {
274
- return new transaction_1.PartitionedDml(this);
275
- }
276
- /**
277
- * Create a Snapshot transaction.
278
- *
279
- * @param {TimestampBounds} [options] The timestamp bounds.
280
- * @param {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions] The default query options to use.
281
- * @returns {Snapshot}
282
- *
283
- * @example
284
- * ```
285
- * const snapshot = session.snapshot({strong: false});
286
- * ```
287
- */
288
- snapshot(options, queryOptions) {
289
- return new transaction_1.Snapshot(this, options, queryOptions);
290
- }
291
- /**
292
- * Create a read write Transaction.
293
- *
294
- * @param {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions] The default query options to use.
295
- * @return {Transaction}
296
- *
297
- * @example
298
- * ```
299
- * const transaction = session.transaction();
300
- * ```
301
- */
302
- transaction(queryOptions, requestOptions) {
303
- return new transaction_1.Transaction(this, undefined, queryOptions, requestOptions);
304
- }
305
- /**
306
- * Format the session name to include the parent database's name.
307
- *
308
- * @private
309
- *
310
- * @param {string} databaseName The parent database's name.
311
- * @param {string} name The instance name.
312
- * @returns {string}
313
- *
314
- * @example
315
- * ```
316
- * Session.formatName_('my-database', 'my-session');
317
- * // 'projects/grape-spaceship-123/instances/my-instance/' +
318
- * // 'databases/my-database/sessions/my-session'
319
- * ```
320
- */
321
- static formatName_(databaseName, name) {
322
- if (name.indexOf('/') > -1) {
323
- return name;
324
- }
325
- const sessionName = name.split('/').pop();
326
- return databaseName + '/sessions/' + sessionName;
327
- }
328
- /**
329
- * Gets the Spanner object
330
- *
331
- * @private
332
- *
333
- * @returns {Spanner}
334
- */
335
- _getSpanner() {
336
- return this.parent.parent.parent;
337
- }
338
- }
339
- exports.Session = Session;
340
- /*! Developer Documentation
341
- *
342
- * All async methods (except for streams) will return a Promise in the event
343
- * that a callback is omitted.
344
- */
345
- (0, promisify_1.promisifyAll)(Session, {
346
- exclude: ['delete', 'partitionedDml', 'snapshot', 'transaction'],
347
- });
348
- //# sourceMappingURL=session.js.map
@@ -1,92 +0,0 @@
1
- {
2
- "channelPool": {
3
- "maxSize": 10,
4
- "maxConcurrentStreamsLowWatermark": 100
5
- },
6
- "method": [
7
- {
8
- "name": ["/google.spanner.v1.Spanner/CreateSession"],
9
- "affinity": {
10
- "command": "BIND",
11
- "affinityKey": "name"
12
- }
13
- },
14
- {
15
- "name": ["/google.spanner.v1.Spanner/GetSession"],
16
- "affinity": {
17
- "command": "BOUND",
18
- "affinityKey": "name"
19
- }
20
- },
21
- {
22
- "name": ["/google.spanner.v1.Spanner/DeleteSession"],
23
- "affinity": {
24
- "command": "UNBIND",
25
- "affinityKey": "name"
26
- }
27
- },
28
- {
29
- "name": ["/google.spanner.v1.Spanner/ExecuteSql"],
30
- "affinity": {
31
- "command": "BOUND",
32
- "affinityKey": "session"
33
- }
34
- },
35
- {
36
- "name": ["/google.spanner.v1.Spanner/ExecuteStreamingSql"],
37
- "affinity": {
38
- "command": "BOUND",
39
- "affinityKey": "session"
40
- }
41
- },
42
- {
43
- "name": ["/google.spanner.v1.Spanner/Read"],
44
- "affinity": {
45
- "command": "BOUND",
46
- "affinityKey": "session"
47
- }
48
- },
49
- {
50
- "name": ["/google.spanner.v1.Spanner/StreamingRead"],
51
- "affinity": {
52
- "command": "BOUND",
53
- "affinityKey": "session"
54
- }
55
- },
56
- {
57
- "name": ["/google.spanner.v1.Spanner/BeginTransaction"],
58
- "affinity": {
59
- "command": "BOUND",
60
- "affinityKey": "session"
61
- }
62
- },
63
- {
64
- "name": ["/google.spanner.v1.Spanner/Commit"],
65
- "affinity": {
66
- "command": "BOUND",
67
- "affinityKey": "session"
68
- }
69
- },
70
- {
71
- "name": ["/google.spanner.v1.Spanner/Rollback"],
72
- "affinity": {
73
- "command": "BOUND",
74
- "affinityKey": "session"
75
- }
76
- },
77
- {
78
- "name": ["/google.spanner.v1.Spanner/PartitionQuery"],
79
- "affinity": {
80
- "command": "BOUND",
81
- "affinityKey": "session"
82
- }
83
- },
84
- {
85
- "name": ["/google.spanner.v1.Spanner/PartitionRead"],
86
- "affinity": {
87
- "command": "BOUND",
88
- "affinityKey": "session"
89
- }
90
- }
91
- ]
92
- }