1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | Object.defineProperty(exports, "__esModule", { value: true });
|
20 | exports.DatastoreClient = void 0;
|
21 | const jsonProtos = require("../../protos/protos.json");
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | const gapicConfig = require("./datastore_client_config.json");
|
28 | const version = require('../../../package.json').version;
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | class DatastoreClient {
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | constructor(opts, gaxInstance) {
|
81 | var _a, _b, _c, _d, _e;
|
82 | this._terminated = false;
|
83 | this.descriptors = {
|
84 | page: {},
|
85 | stream: {},
|
86 | longrunning: {},
|
87 | batching: {},
|
88 | };
|
89 |
|
90 | const staticMembers = this.constructor;
|
91 | if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
|
92 | (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
|
93 | (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
|
94 | throw new Error('Please set either universe_domain or universeDomain, but not both.');
|
95 | }
|
96 | const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
|
97 | ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
|
98 | : undefined;
|
99 | this._universeDomain =
|
100 | (_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';
|
101 | this._servicePath = 'datastore.' + this._universeDomain;
|
102 | const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
|
103 | this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
|
104 | const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
|
105 | const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
|
106 | 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');
|
107 | opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
|
108 |
|
109 | opts.numericEnums = true;
|
110 |
|
111 | if (servicePath !== this._servicePath && !('scopes' in opts)) {
|
112 | opts['scopes'] = staticMembers.scopes;
|
113 | }
|
114 |
|
115 | if (!gaxInstance) {
|
116 | gaxInstance = require('google-gax');
|
117 | }
|
118 |
|
119 | this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
|
120 |
|
121 | this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
|
122 |
|
123 | this._opts = opts;
|
124 |
|
125 | this.auth = this._gaxGrpc.auth;
|
126 |
|
127 | this.auth.useJWTAccessWithScope = true;
|
128 |
|
129 | this.auth.defaultServicePath = this._servicePath;
|
130 |
|
131 | if (servicePath === this._servicePath) {
|
132 | this.auth.defaultScopes = staticMembers.scopes;
|
133 | }
|
134 |
|
135 | const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
|
136 | if (typeof process === 'object' && 'versions' in process) {
|
137 | clientHeader.push(`gl-node/${process.versions.node}`);
|
138 | }
|
139 | else {
|
140 | clientHeader.push(`gl-web/${this._gaxModule.version}`);
|
141 | }
|
142 | if (!opts.fallback) {
|
143 | clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
|
144 | }
|
145 | else {
|
146 | clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
|
147 | }
|
148 | if (opts.libName && opts.libVersion) {
|
149 | clientHeader.push(`${opts.libName}/${opts.libVersion}`);
|
150 | }
|
151 |
|
152 | this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
|
153 | const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
154 |
|
155 |
|
156 |
|
157 | const lroOptions = {
|
158 | auth: this.auth,
|
159 | grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
|
160 | };
|
161 | if (opts.fallback) {
|
162 | lroOptions.protoJson = protoFilesRoot;
|
163 | lroOptions.httpRules = [
|
164 | {
|
165 | selector: 'google.longrunning.Operations.CancelOperation',
|
166 | post: '/v1/{name=projects/*/operations/*}:cancel',
|
167 | },
|
168 | {
|
169 | selector: 'google.longrunning.Operations.DeleteOperation',
|
170 | delete: '/v1/{name=projects/*/operations/*}',
|
171 | },
|
172 | {
|
173 | selector: 'google.longrunning.Operations.GetOperation',
|
174 | get: '/v1/{name=projects |
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 | initialize() {
|
207 |
|
208 | if (this.datastoreStub) {
|
209 | return this.datastoreStub;
|
210 | }
|
211 |
|
212 |
|
213 | this.datastoreStub = this._gaxGrpc.createStub(this._opts.fallback
|
214 | ? this._protos.lookupService('google.datastore.v1.Datastore')
|
215 | :
|
216 | this._protos.google.datastore.v1.Datastore, this._opts, this._providedCustomServicePath);
|
217 |
|
218 |
|
219 | const datastoreStubMethods = [
|
220 | 'lookup',
|
221 | 'runQuery',
|
222 | 'runAggregationQuery',
|
223 | 'beginTransaction',
|
224 | 'commit',
|
225 | 'rollback',
|
226 | 'allocateIds',
|
227 | 'reserveIds',
|
228 | ];
|
229 | for (const methodName of datastoreStubMethods) {
|
230 | const callPromise = this.datastoreStub.then(stub => (...args) => {
|
231 | if (this._terminated) {
|
232 | return Promise.reject('The client has already been closed.');
|
233 | }
|
234 | const func = stub[methodName];
|
235 | return func.apply(stub, args);
|
236 | }, (err) => () => {
|
237 | throw err;
|
238 | });
|
239 | const descriptor = undefined;
|
240 | const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
|
241 | this.innerApiCalls[methodName] = apiCall;
|
242 | }
|
243 | return this.datastoreStub;
|
244 | }
|
245 | |
246 |
|
247 |
|
248 |
|
249 |
|
250 | static get servicePath() {
|
251 | if (typeof process === 'object' &&
|
252 | typeof process.emitWarning === 'function') {
|
253 | process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
|
254 | }
|
255 | return 'datastore.googleapis.com';
|
256 | }
|
257 | |
258 |
|
259 |
|
260 |
|
261 |
|
262 | static get apiEndpoint() {
|
263 | if (typeof process === 'object' &&
|
264 | typeof process.emitWarning === 'function') {
|
265 | process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
|
266 | }
|
267 | return 'datastore.googleapis.com';
|
268 | }
|
269 | |
270 |
|
271 |
|
272 |
|
273 | get apiEndpoint() {
|
274 | return this._servicePath;
|
275 | }
|
276 | get universeDomain() {
|
277 | return this._universeDomain;
|
278 | }
|
279 | |
280 |
|
281 |
|
282 |
|
283 | static get port() {
|
284 | return 443;
|
285 | }
|
286 | |
287 |
|
288 |
|
289 |
|
290 |
|
291 | static get scopes() {
|
292 | return [
|
293 | 'https://www.googleapis.com/auth/cloud-platform',
|
294 | 'https://www.googleapis.com/auth/datastore',
|
295 | ];
|
296 | }
|
297 | |
298 |
|
299 |
|
300 |
|
301 | getProjectId(callback) {
|
302 | if (callback) {
|
303 | this.auth.getProjectId(callback);
|
304 | return;
|
305 | }
|
306 | return this.auth.getProjectId();
|
307 | }
|
308 | lookup(request, optionsOrCallback, callback) {
|
309 | var _a, _b, _c, _d;
|
310 | request = request || {};
|
311 | let options;
|
312 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
313 | callback = optionsOrCallback;
|
314 | options = {};
|
315 | }
|
316 | else {
|
317 | options = optionsOrCallback;
|
318 | }
|
319 | options = options || {};
|
320 | options.otherArgs = options.otherArgs || {};
|
321 | options.otherArgs.headers = options.otherArgs.headers || {};
|
322 | const routingParameter = {};
|
323 | {
|
324 | const fieldValue = request.projectId;
|
325 | if (fieldValue !== undefined && fieldValue !== null) {
|
326 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
327 | if (match) {
|
328 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
329 | Object.assign(routingParameter, { project_id: parameterValue });
|
330 | }
|
331 | }
|
332 | }
|
333 | {
|
334 | const fieldValue = request.databaseId;
|
335 | if (fieldValue !== undefined && fieldValue !== null) {
|
336 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
337 | if (match) {
|
338 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
339 | Object.assign(routingParameter, { database_id: parameterValue });
|
340 | }
|
341 | }
|
342 | }
|
343 | options.otherArgs.headers['x-goog-request-params'] =
|
344 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
345 | this.initialize();
|
346 | return this.innerApiCalls.lookup(request, options, callback);
|
347 | }
|
348 | runQuery(request, optionsOrCallback, callback) {
|
349 | var _a, _b, _c, _d;
|
350 | request = request || {};
|
351 | let options;
|
352 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
353 | callback = optionsOrCallback;
|
354 | options = {};
|
355 | }
|
356 | else {
|
357 | options = optionsOrCallback;
|
358 | }
|
359 | options = options || {};
|
360 | options.otherArgs = options.otherArgs || {};
|
361 | options.otherArgs.headers = options.otherArgs.headers || {};
|
362 | const routingParameter = {};
|
363 | {
|
364 | const fieldValue = request.projectId;
|
365 | if (fieldValue !== undefined && fieldValue !== null) {
|
366 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
367 | if (match) {
|
368 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
369 | Object.assign(routingParameter, { project_id: parameterValue });
|
370 | }
|
371 | }
|
372 | }
|
373 | {
|
374 | const fieldValue = request.databaseId;
|
375 | if (fieldValue !== undefined && fieldValue !== null) {
|
376 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
377 | if (match) {
|
378 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
379 | Object.assign(routingParameter, { database_id: parameterValue });
|
380 | }
|
381 | }
|
382 | }
|
383 | options.otherArgs.headers['x-goog-request-params'] =
|
384 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
385 | this.initialize();
|
386 | return this.innerApiCalls.runQuery(request, options, callback);
|
387 | }
|
388 | runAggregationQuery(request, optionsOrCallback, callback) {
|
389 | var _a, _b, _c, _d;
|
390 | request = request || {};
|
391 | let options;
|
392 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
393 | callback = optionsOrCallback;
|
394 | options = {};
|
395 | }
|
396 | else {
|
397 | options = optionsOrCallback;
|
398 | }
|
399 | options = options || {};
|
400 | options.otherArgs = options.otherArgs || {};
|
401 | options.otherArgs.headers = options.otherArgs.headers || {};
|
402 | const routingParameter = {};
|
403 | {
|
404 | const fieldValue = request.projectId;
|
405 | if (fieldValue !== undefined && fieldValue !== null) {
|
406 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
407 | if (match) {
|
408 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
409 | Object.assign(routingParameter, { project_id: parameterValue });
|
410 | }
|
411 | }
|
412 | }
|
413 | {
|
414 | const fieldValue = request.databaseId;
|
415 | if (fieldValue !== undefined && fieldValue !== null) {
|
416 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
417 | if (match) {
|
418 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
419 | Object.assign(routingParameter, { database_id: parameterValue });
|
420 | }
|
421 | }
|
422 | }
|
423 | options.otherArgs.headers['x-goog-request-params'] =
|
424 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
425 | this.initialize();
|
426 | return this.innerApiCalls.runAggregationQuery(request, options, callback);
|
427 | }
|
428 | beginTransaction(request, optionsOrCallback, callback) {
|
429 | var _a, _b, _c, _d;
|
430 | request = request || {};
|
431 | let options;
|
432 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
433 | callback = optionsOrCallback;
|
434 | options = {};
|
435 | }
|
436 | else {
|
437 | options = optionsOrCallback;
|
438 | }
|
439 | options = options || {};
|
440 | options.otherArgs = options.otherArgs || {};
|
441 | options.otherArgs.headers = options.otherArgs.headers || {};
|
442 | const routingParameter = {};
|
443 | {
|
444 | const fieldValue = request.projectId;
|
445 | if (fieldValue !== undefined && fieldValue !== null) {
|
446 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
447 | if (match) {
|
448 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
449 | Object.assign(routingParameter, { project_id: parameterValue });
|
450 | }
|
451 | }
|
452 | }
|
453 | {
|
454 | const fieldValue = request.databaseId;
|
455 | if (fieldValue !== undefined && fieldValue !== null) {
|
456 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
457 | if (match) {
|
458 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
459 | Object.assign(routingParameter, { database_id: parameterValue });
|
460 | }
|
461 | }
|
462 | }
|
463 | options.otherArgs.headers['x-goog-request-params'] =
|
464 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
465 | this.initialize();
|
466 | return this.innerApiCalls.beginTransaction(request, options, callback);
|
467 | }
|
468 | commit(request, optionsOrCallback, callback) {
|
469 | var _a, _b, _c, _d;
|
470 | request = request || {};
|
471 | let options;
|
472 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
473 | callback = optionsOrCallback;
|
474 | options = {};
|
475 | }
|
476 | else {
|
477 | options = optionsOrCallback;
|
478 | }
|
479 | options = options || {};
|
480 | options.otherArgs = options.otherArgs || {};
|
481 | options.otherArgs.headers = options.otherArgs.headers || {};
|
482 | const routingParameter = {};
|
483 | {
|
484 | const fieldValue = request.projectId;
|
485 | if (fieldValue !== undefined && fieldValue !== null) {
|
486 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
487 | if (match) {
|
488 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
489 | Object.assign(routingParameter, { project_id: parameterValue });
|
490 | }
|
491 | }
|
492 | }
|
493 | {
|
494 | const fieldValue = request.databaseId;
|
495 | if (fieldValue !== undefined && fieldValue !== null) {
|
496 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
497 | if (match) {
|
498 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
499 | Object.assign(routingParameter, { database_id: parameterValue });
|
500 | }
|
501 | }
|
502 | }
|
503 | options.otherArgs.headers['x-goog-request-params'] =
|
504 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
505 | this.initialize();
|
506 | return this.innerApiCalls.commit(request, options, callback);
|
507 | }
|
508 | rollback(request, optionsOrCallback, callback) {
|
509 | var _a, _b, _c, _d;
|
510 | request = request || {};
|
511 | let options;
|
512 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
513 | callback = optionsOrCallback;
|
514 | options = {};
|
515 | }
|
516 | else {
|
517 | options = optionsOrCallback;
|
518 | }
|
519 | options = options || {};
|
520 | options.otherArgs = options.otherArgs || {};
|
521 | options.otherArgs.headers = options.otherArgs.headers || {};
|
522 | const routingParameter = {};
|
523 | {
|
524 | const fieldValue = request.projectId;
|
525 | if (fieldValue !== undefined && fieldValue !== null) {
|
526 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
527 | if (match) {
|
528 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
529 | Object.assign(routingParameter, { project_id: parameterValue });
|
530 | }
|
531 | }
|
532 | }
|
533 | {
|
534 | const fieldValue = request.databaseId;
|
535 | if (fieldValue !== undefined && fieldValue !== null) {
|
536 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
537 | if (match) {
|
538 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
539 | Object.assign(routingParameter, { database_id: parameterValue });
|
540 | }
|
541 | }
|
542 | }
|
543 | options.otherArgs.headers['x-goog-request-params'] =
|
544 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
545 | this.initialize();
|
546 | return this.innerApiCalls.rollback(request, options, callback);
|
547 | }
|
548 | allocateIds(request, optionsOrCallback, callback) {
|
549 | var _a, _b, _c, _d;
|
550 | request = request || {};
|
551 | let options;
|
552 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
553 | callback = optionsOrCallback;
|
554 | options = {};
|
555 | }
|
556 | else {
|
557 | options = optionsOrCallback;
|
558 | }
|
559 | options = options || {};
|
560 | options.otherArgs = options.otherArgs || {};
|
561 | options.otherArgs.headers = options.otherArgs.headers || {};
|
562 | const routingParameter = {};
|
563 | {
|
564 | const fieldValue = request.projectId;
|
565 | if (fieldValue !== undefined && fieldValue !== null) {
|
566 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
567 | if (match) {
|
568 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
569 | Object.assign(routingParameter, { project_id: parameterValue });
|
570 | }
|
571 | }
|
572 | }
|
573 | {
|
574 | const fieldValue = request.databaseId;
|
575 | if (fieldValue !== undefined && fieldValue !== null) {
|
576 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
577 | if (match) {
|
578 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
579 | Object.assign(routingParameter, { database_id: parameterValue });
|
580 | }
|
581 | }
|
582 | }
|
583 | options.otherArgs.headers['x-goog-request-params'] =
|
584 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
585 | this.initialize();
|
586 | return this.innerApiCalls.allocateIds(request, options, callback);
|
587 | }
|
588 | reserveIds(request, optionsOrCallback, callback) {
|
589 | var _a, _b, _c, _d;
|
590 | request = request || {};
|
591 | let options;
|
592 | if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
593 | callback = optionsOrCallback;
|
594 | options = {};
|
595 | }
|
596 | else {
|
597 | options = optionsOrCallback;
|
598 | }
|
599 | options = options || {};
|
600 | options.otherArgs = options.otherArgs || {};
|
601 | options.otherArgs.headers = options.otherArgs.headers || {};
|
602 | const routingParameter = {};
|
603 | {
|
604 | const fieldValue = request.projectId;
|
605 | if (fieldValue !== undefined && fieldValue !== null) {
|
606 | const match = fieldValue.toString().match(RegExp('(?<project_id>.*)'));
|
607 | if (match) {
|
608 | const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['project_id']) !== null && _b !== void 0 ? _b : fieldValue;
|
609 | Object.assign(routingParameter, { project_id: parameterValue });
|
610 | }
|
611 | }
|
612 | }
|
613 | {
|
614 | const fieldValue = request.databaseId;
|
615 | if (fieldValue !== undefined && fieldValue !== null) {
|
616 | const match = fieldValue.toString().match(RegExp('(?<database_id>.*)'));
|
617 | if (match) {
|
618 | const parameterValue = (_d = (_c = match.groups) === null || _c === void 0 ? void 0 : _c['database_id']) !== null && _d !== void 0 ? _d : fieldValue;
|
619 | Object.assign(routingParameter, { database_id: parameterValue });
|
620 | }
|
621 | }
|
622 | }
|
623 | options.otherArgs.headers['x-goog-request-params'] =
|
624 | this._gaxModule.routingHeader.fromParams(routingParameter);
|
625 | this.initialize();
|
626 | return this.innerApiCalls.reserveIds(request, options, callback);
|
627 | }
|
628 | |
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 | getOperation(request, options, callback) {
|
659 | return this.operationsClient.getOperation(request, options, callback);
|
660 | }
|
661 | |
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 | listOperationsAsync(request, options) {
|
692 | return this.operationsClient.listOperationsAsync(request, options);
|
693 | }
|
694 | |
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 | cancelOperation(request, options, callback) {
|
726 | return this.operationsClient.cancelOperation(request, options, callback);
|
727 | }
|
728 | |
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 | deleteOperation(request, options, callback) {
|
754 | return this.operationsClient.deleteOperation(request, options, callback);
|
755 | }
|
756 | |
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 | close() {
|
763 | if (this.datastoreStub && !this._terminated) {
|
764 | return this.datastoreStub.then(stub => {
|
765 | this._terminated = true;
|
766 | stub.close();
|
767 | this.operationsClient.close();
|
768 | });
|
769 | }
|
770 | return Promise.resolve();
|
771 | }
|
772 | }
|
773 | exports.DatastoreClient = DatastoreClient;
|
774 |
|
\ | No newline at end of file |