@google-cloud/pubsub 4.11.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/protos/google/pubsub/v1/pubsub.proto +144 -29
- package/build/protos/google/pubsub/v1/schema.proto +2 -3
- package/build/protos/protos.d.ts +477 -11
- package/build/protos/protos.js +1681 -151
- package/build/protos/protos.json +203 -28
- package/build/src/debug.js +2 -0
- package/build/src/debug.js.map +1 -1
- package/build/src/default-options.d.ts +2 -2
- package/build/src/default-options.js +3 -3
- package/build/src/default-options.js.map +1 -1
- package/build/src/exponential-retry.js +4 -1
- package/build/src/exponential-retry.js.map +1 -1
- package/build/src/histogram.js +3 -0
- package/build/src/histogram.js.map +1 -1
- package/build/src/iam.js +3 -0
- package/build/src/iam.js.map +1 -1
- package/build/src/index.d.ts +0 -2
- package/build/src/index.js +1 -5
- package/build/src/index.js.map +1 -1
- package/build/src/lease-manager.d.ts +0 -3
- package/build/src/lease-manager.js +14 -19
- package/build/src/lease-manager.js.map +1 -1
- package/build/src/message-queues.js +31 -23
- package/build/src/message-queues.js.map +1 -1
- package/build/src/message-stream.js +13 -4
- package/build/src/message-stream.js.map +1 -1
- package/build/src/publisher/flow-control.js +4 -1
- package/build/src/publisher/flow-control.js.map +1 -1
- package/build/src/publisher/flow-publisher.js +5 -2
- package/build/src/publisher/flow-publisher.js.map +1 -1
- package/build/src/publisher/index.d.ts +0 -2
- package/build/src/publisher/index.js +9 -6
- package/build/src/publisher/index.js.map +1 -1
- package/build/src/publisher/message-batch.d.ts +0 -11
- package/build/src/publisher/message-batch.js +13 -1
- package/build/src/publisher/message-batch.js.map +1 -1
- package/build/src/publisher/message-queues.js +10 -3
- package/build/src/publisher/message-queues.js.map +1 -1
- package/build/src/publisher/publish-error.js +5 -0
- package/build/src/publisher/publish-error.js.map +1 -1
- package/build/src/publisher/pubsub-message.d.ts +0 -68
- package/build/src/pubsub.js +14 -5
- package/build/src/pubsub.js.map +1 -1
- package/build/src/schema.js +3 -0
- package/build/src/schema.js.map +1 -1
- package/build/src/snapshot.js +3 -0
- package/build/src/snapshot.js.map +1 -1
- package/build/src/subscriber.d.ts +11 -15
- package/build/src/subscriber.js +84 -26
- package/build/src/subscriber.js.map +1 -1
- package/build/src/subscription.js +11 -2
- package/build/src/subscription.js.map +1 -1
- package/build/src/telemetry-tracing.d.ts +2 -220
- package/build/src/telemetry-tracing.js +52 -121
- package/build/src/telemetry-tracing.js.map +1 -1
- package/build/src/temporal.js +8 -8
- package/build/src/temporal.js.map +1 -1
- package/build/src/topic.js +8 -1
- package/build/src/topic.js.map +1 -1
- package/build/src/util.js +3 -2
- package/build/src/util.js.map +1 -1
- package/build/src/v1/publisher_client.d.ts +8 -4
- package/build/src/v1/publisher_client.js +228 -78
- package/build/src/v1/publisher_client.js.map +1 -1
- package/build/src/v1/publisher_proto_list.json +4 -0
- package/build/src/v1/schema_service_client.d.ts +4 -3
- package/build/src/v1/schema_service_client.js +233 -73
- package/build/src/v1/schema_service_client.js.map +1 -1
- package/build/src/v1/schema_service_proto_list.json +4 -0
- package/build/src/v1/subscriber_client.d.ts +11 -7
- package/build/src/v1/subscriber_client.js +324 -96
- package/build/src/v1/subscriber_client.js.map +1 -1
- package/build/src/v1/subscriber_proto_list.json +4 -0
- package/package.json +45 -47
- package/CHANGELOG.md +0 -1606
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.SubscriberClient = void 0;
|
|
21
21
|
const stream_1 = require("stream");
|
|
22
22
|
const jsonProtos = require("../../protos/protos.json");
|
|
23
|
+
const google_gax_1 = require("google-gax");
|
|
23
24
|
/**
|
|
24
25
|
* Client JSON configuration object, loaded from
|
|
25
26
|
* `src/v1/subscriber_client_config.json`.
|
|
@@ -35,6 +36,28 @@ const version = require('../../../package.json').version;
|
|
|
35
36
|
* @memberof v1
|
|
36
37
|
*/
|
|
37
38
|
class SubscriberClient {
|
|
39
|
+
_terminated = false;
|
|
40
|
+
_opts;
|
|
41
|
+
_providedCustomServicePath;
|
|
42
|
+
_gaxModule;
|
|
43
|
+
_gaxGrpc;
|
|
44
|
+
_protos;
|
|
45
|
+
_defaults;
|
|
46
|
+
_universeDomain;
|
|
47
|
+
_servicePath;
|
|
48
|
+
_log = google_gax_1.loggingUtils.log('pubsub');
|
|
49
|
+
auth;
|
|
50
|
+
descriptors = {
|
|
51
|
+
page: {},
|
|
52
|
+
stream: {},
|
|
53
|
+
longrunning: {},
|
|
54
|
+
batching: {},
|
|
55
|
+
};
|
|
56
|
+
warn;
|
|
57
|
+
innerApiCalls;
|
|
58
|
+
iamClient;
|
|
59
|
+
pathTemplates;
|
|
60
|
+
subscriberStub;
|
|
38
61
|
/**
|
|
39
62
|
* Construct an instance of SubscriberClient.
|
|
40
63
|
*
|
|
@@ -57,7 +80,7 @@ class SubscriberClient {
|
|
|
57
80
|
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
|
|
58
81
|
* the environment variable GCLOUD_PROJECT for your project ID. If your
|
|
59
82
|
* app is running in an environment which supports
|
|
60
|
-
* {@link https://
|
|
83
|
+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
|
|
61
84
|
* your project ID will be detected automatically.
|
|
62
85
|
* @param {string} [options.apiEndpoint] - The domain name of the
|
|
63
86
|
* API remote host.
|
|
@@ -75,32 +98,28 @@ class SubscriberClient {
|
|
|
75
98
|
* ```
|
|
76
99
|
*/
|
|
77
100
|
constructor(opts, gaxInstance) {
|
|
78
|
-
var _a, _b, _c, _d, _e;
|
|
79
|
-
this._terminated = false;
|
|
80
|
-
this.descriptors = {
|
|
81
|
-
page: {},
|
|
82
|
-
stream: {},
|
|
83
|
-
longrunning: {},
|
|
84
|
-
batching: {},
|
|
85
|
-
};
|
|
86
101
|
// Ensure that options include all the required fields.
|
|
87
102
|
const staticMembers = this.constructor;
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
if (opts?.universe_domain &&
|
|
104
|
+
opts?.universeDomain &&
|
|
105
|
+
opts?.universe_domain !== opts?.universeDomain) {
|
|
91
106
|
throw new Error('Please set either universe_domain or universeDomain, but not both.');
|
|
92
107
|
}
|
|
93
108
|
const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
|
|
94
109
|
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
|
|
95
110
|
: undefined;
|
|
96
111
|
this._universeDomain =
|
|
97
|
-
|
|
112
|
+
opts?.universeDomain ??
|
|
113
|
+
opts?.universe_domain ??
|
|
114
|
+
universeDomainEnvVar ??
|
|
115
|
+
'googleapis.com';
|
|
98
116
|
this._servicePath = 'pubsub.' + this._universeDomain;
|
|
99
|
-
const servicePath =
|
|
100
|
-
this._providedCustomServicePath = !!(
|
|
101
|
-
const port =
|
|
102
|
-
const clientConfig =
|
|
103
|
-
const fallback =
|
|
117
|
+
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
|
|
118
|
+
this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
|
|
119
|
+
const port = opts?.port || staticMembers.port;
|
|
120
|
+
const clientConfig = opts?.clientConfig ?? {};
|
|
121
|
+
const fallback = opts?.fallback ??
|
|
122
|
+
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
|
|
104
123
|
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
|
|
105
124
|
// Request numeric enum values if REST transport is used.
|
|
106
125
|
opts.numericEnums = true;
|
|
@@ -225,7 +244,7 @@ class SubscriberClient {
|
|
|
225
244
|
const callPromise = this.subscriberStub.then(stub => (...args) => {
|
|
226
245
|
if (this._terminated) {
|
|
227
246
|
if (methodName in this.descriptors.stream) {
|
|
228
|
-
const stream = new stream_1.PassThrough();
|
|
247
|
+
const stream = new stream_1.PassThrough({ objectMode: true });
|
|
229
248
|
setImmediate(() => {
|
|
230
249
|
stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.'));
|
|
231
250
|
});
|
|
@@ -310,7 +329,6 @@ class SubscriberClient {
|
|
|
310
329
|
return this.auth.getProjectId();
|
|
311
330
|
}
|
|
312
331
|
createSubscription(request, optionsOrCallback, callback) {
|
|
313
|
-
var _a;
|
|
314
332
|
request = request || {};
|
|
315
333
|
let options;
|
|
316
334
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -325,13 +343,26 @@ class SubscriberClient {
|
|
|
325
343
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
326
344
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
327
345
|
this._gaxModule.routingHeader.fromParams({
|
|
328
|
-
name:
|
|
346
|
+
name: request.name ?? '',
|
|
329
347
|
});
|
|
330
|
-
this.initialize()
|
|
331
|
-
|
|
348
|
+
this.initialize().catch(err => {
|
|
349
|
+
throw err;
|
|
350
|
+
});
|
|
351
|
+
this._log.info('createSubscription request %j', request);
|
|
352
|
+
const wrappedCallback = callback
|
|
353
|
+
? (error, response, options, rawResponse) => {
|
|
354
|
+
this._log.info('createSubscription response %j', response);
|
|
355
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
356
|
+
}
|
|
357
|
+
: undefined;
|
|
358
|
+
return this.innerApiCalls
|
|
359
|
+
.createSubscription(request, options, wrappedCallback)
|
|
360
|
+
?.then(([response, options, rawResponse]) => {
|
|
361
|
+
this._log.info('createSubscription response %j', response);
|
|
362
|
+
return [response, options, rawResponse];
|
|
363
|
+
});
|
|
332
364
|
}
|
|
333
365
|
getSubscription(request, optionsOrCallback, callback) {
|
|
334
|
-
var _a;
|
|
335
366
|
request = request || {};
|
|
336
367
|
let options;
|
|
337
368
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -346,13 +377,26 @@ class SubscriberClient {
|
|
|
346
377
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
347
378
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
348
379
|
this._gaxModule.routingHeader.fromParams({
|
|
349
|
-
subscription:
|
|
380
|
+
subscription: request.subscription ?? '',
|
|
350
381
|
});
|
|
351
|
-
this.initialize()
|
|
352
|
-
|
|
382
|
+
this.initialize().catch(err => {
|
|
383
|
+
throw err;
|
|
384
|
+
});
|
|
385
|
+
this._log.info('getSubscription request %j', request);
|
|
386
|
+
const wrappedCallback = callback
|
|
387
|
+
? (error, response, options, rawResponse) => {
|
|
388
|
+
this._log.info('getSubscription response %j', response);
|
|
389
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
390
|
+
}
|
|
391
|
+
: undefined;
|
|
392
|
+
return this.innerApiCalls
|
|
393
|
+
.getSubscription(request, options, wrappedCallback)
|
|
394
|
+
?.then(([response, options, rawResponse]) => {
|
|
395
|
+
this._log.info('getSubscription response %j', response);
|
|
396
|
+
return [response, options, rawResponse];
|
|
397
|
+
});
|
|
353
398
|
}
|
|
354
399
|
updateSubscription(request, optionsOrCallback, callback) {
|
|
355
|
-
var _a;
|
|
356
400
|
request = request || {};
|
|
357
401
|
let options;
|
|
358
402
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -367,13 +411,26 @@ class SubscriberClient {
|
|
|
367
411
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
368
412
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
369
413
|
this._gaxModule.routingHeader.fromParams({
|
|
370
|
-
'subscription.name':
|
|
414
|
+
'subscription.name': request.subscription.name ?? '',
|
|
371
415
|
});
|
|
372
|
-
this.initialize()
|
|
373
|
-
|
|
416
|
+
this.initialize().catch(err => {
|
|
417
|
+
throw err;
|
|
418
|
+
});
|
|
419
|
+
this._log.info('updateSubscription request %j', request);
|
|
420
|
+
const wrappedCallback = callback
|
|
421
|
+
? (error, response, options, rawResponse) => {
|
|
422
|
+
this._log.info('updateSubscription response %j', response);
|
|
423
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
424
|
+
}
|
|
425
|
+
: undefined;
|
|
426
|
+
return this.innerApiCalls
|
|
427
|
+
.updateSubscription(request, options, wrappedCallback)
|
|
428
|
+
?.then(([response, options, rawResponse]) => {
|
|
429
|
+
this._log.info('updateSubscription response %j', response);
|
|
430
|
+
return [response, options, rawResponse];
|
|
431
|
+
});
|
|
374
432
|
}
|
|
375
433
|
deleteSubscription(request, optionsOrCallback, callback) {
|
|
376
|
-
var _a;
|
|
377
434
|
request = request || {};
|
|
378
435
|
let options;
|
|
379
436
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -388,13 +445,26 @@ class SubscriberClient {
|
|
|
388
445
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
389
446
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
390
447
|
this._gaxModule.routingHeader.fromParams({
|
|
391
|
-
subscription:
|
|
448
|
+
subscription: request.subscription ?? '',
|
|
392
449
|
});
|
|
393
|
-
this.initialize()
|
|
394
|
-
|
|
450
|
+
this.initialize().catch(err => {
|
|
451
|
+
throw err;
|
|
452
|
+
});
|
|
453
|
+
this._log.info('deleteSubscription request %j', request);
|
|
454
|
+
const wrappedCallback = callback
|
|
455
|
+
? (error, response, options, rawResponse) => {
|
|
456
|
+
this._log.info('deleteSubscription response %j', response);
|
|
457
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
458
|
+
}
|
|
459
|
+
: undefined;
|
|
460
|
+
return this.innerApiCalls
|
|
461
|
+
.deleteSubscription(request, options, wrappedCallback)
|
|
462
|
+
?.then(([response, options, rawResponse]) => {
|
|
463
|
+
this._log.info('deleteSubscription response %j', response);
|
|
464
|
+
return [response, options, rawResponse];
|
|
465
|
+
});
|
|
395
466
|
}
|
|
396
467
|
modifyAckDeadline(request, optionsOrCallback, callback) {
|
|
397
|
-
var _a;
|
|
398
468
|
request = request || {};
|
|
399
469
|
let options;
|
|
400
470
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -409,13 +479,26 @@ class SubscriberClient {
|
|
|
409
479
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
410
480
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
411
481
|
this._gaxModule.routingHeader.fromParams({
|
|
412
|
-
subscription:
|
|
482
|
+
subscription: request.subscription ?? '',
|
|
413
483
|
});
|
|
414
|
-
this.initialize()
|
|
415
|
-
|
|
484
|
+
this.initialize().catch(err => {
|
|
485
|
+
throw err;
|
|
486
|
+
});
|
|
487
|
+
this._log.info('modifyAckDeadline request %j', request);
|
|
488
|
+
const wrappedCallback = callback
|
|
489
|
+
? (error, response, options, rawResponse) => {
|
|
490
|
+
this._log.info('modifyAckDeadline response %j', response);
|
|
491
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
492
|
+
}
|
|
493
|
+
: undefined;
|
|
494
|
+
return this.innerApiCalls
|
|
495
|
+
.modifyAckDeadline(request, options, wrappedCallback)
|
|
496
|
+
?.then(([response, options, rawResponse]) => {
|
|
497
|
+
this._log.info('modifyAckDeadline response %j', response);
|
|
498
|
+
return [response, options, rawResponse];
|
|
499
|
+
});
|
|
416
500
|
}
|
|
417
501
|
acknowledge(request, optionsOrCallback, callback) {
|
|
418
|
-
var _a;
|
|
419
502
|
request = request || {};
|
|
420
503
|
let options;
|
|
421
504
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -430,13 +513,26 @@ class SubscriberClient {
|
|
|
430
513
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
431
514
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
432
515
|
this._gaxModule.routingHeader.fromParams({
|
|
433
|
-
subscription:
|
|
516
|
+
subscription: request.subscription ?? '',
|
|
434
517
|
});
|
|
435
|
-
this.initialize()
|
|
436
|
-
|
|
518
|
+
this.initialize().catch(err => {
|
|
519
|
+
throw err;
|
|
520
|
+
});
|
|
521
|
+
this._log.info('acknowledge request %j', request);
|
|
522
|
+
const wrappedCallback = callback
|
|
523
|
+
? (error, response, options, rawResponse) => {
|
|
524
|
+
this._log.info('acknowledge response %j', response);
|
|
525
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
526
|
+
}
|
|
527
|
+
: undefined;
|
|
528
|
+
return this.innerApiCalls
|
|
529
|
+
.acknowledge(request, options, wrappedCallback)
|
|
530
|
+
?.then(([response, options, rawResponse]) => {
|
|
531
|
+
this._log.info('acknowledge response %j', response);
|
|
532
|
+
return [response, options, rawResponse];
|
|
533
|
+
});
|
|
437
534
|
}
|
|
438
535
|
pull(request, optionsOrCallback, callback) {
|
|
439
|
-
var _a;
|
|
440
536
|
request = request || {};
|
|
441
537
|
let options;
|
|
442
538
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -451,13 +547,26 @@ class SubscriberClient {
|
|
|
451
547
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
452
548
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
453
549
|
this._gaxModule.routingHeader.fromParams({
|
|
454
|
-
subscription:
|
|
550
|
+
subscription: request.subscription ?? '',
|
|
455
551
|
});
|
|
456
|
-
this.initialize()
|
|
457
|
-
|
|
552
|
+
this.initialize().catch(err => {
|
|
553
|
+
throw err;
|
|
554
|
+
});
|
|
555
|
+
this._log.info('pull request %j', request);
|
|
556
|
+
const wrappedCallback = callback
|
|
557
|
+
? (error, response, options, rawResponse) => {
|
|
558
|
+
this._log.info('pull response %j', response);
|
|
559
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
560
|
+
}
|
|
561
|
+
: undefined;
|
|
562
|
+
return this.innerApiCalls
|
|
563
|
+
.pull(request, options, wrappedCallback)
|
|
564
|
+
?.then(([response, options, rawResponse]) => {
|
|
565
|
+
this._log.info('pull response %j', response);
|
|
566
|
+
return [response, options, rawResponse];
|
|
567
|
+
});
|
|
458
568
|
}
|
|
459
569
|
modifyPushConfig(request, optionsOrCallback, callback) {
|
|
460
|
-
var _a;
|
|
461
570
|
request = request || {};
|
|
462
571
|
let options;
|
|
463
572
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -472,13 +581,26 @@ class SubscriberClient {
|
|
|
472
581
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
473
582
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
474
583
|
this._gaxModule.routingHeader.fromParams({
|
|
475
|
-
subscription:
|
|
584
|
+
subscription: request.subscription ?? '',
|
|
476
585
|
});
|
|
477
|
-
this.initialize()
|
|
478
|
-
|
|
586
|
+
this.initialize().catch(err => {
|
|
587
|
+
throw err;
|
|
588
|
+
});
|
|
589
|
+
this._log.info('modifyPushConfig request %j', request);
|
|
590
|
+
const wrappedCallback = callback
|
|
591
|
+
? (error, response, options, rawResponse) => {
|
|
592
|
+
this._log.info('modifyPushConfig response %j', response);
|
|
593
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
594
|
+
}
|
|
595
|
+
: undefined;
|
|
596
|
+
return this.innerApiCalls
|
|
597
|
+
.modifyPushConfig(request, options, wrappedCallback)
|
|
598
|
+
?.then(([response, options, rawResponse]) => {
|
|
599
|
+
this._log.info('modifyPushConfig response %j', response);
|
|
600
|
+
return [response, options, rawResponse];
|
|
601
|
+
});
|
|
479
602
|
}
|
|
480
603
|
getSnapshot(request, optionsOrCallback, callback) {
|
|
481
|
-
var _a;
|
|
482
604
|
request = request || {};
|
|
483
605
|
let options;
|
|
484
606
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -493,13 +615,26 @@ class SubscriberClient {
|
|
|
493
615
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
494
616
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
495
617
|
this._gaxModule.routingHeader.fromParams({
|
|
496
|
-
snapshot:
|
|
618
|
+
snapshot: request.snapshot ?? '',
|
|
497
619
|
});
|
|
498
|
-
this.initialize()
|
|
499
|
-
|
|
620
|
+
this.initialize().catch(err => {
|
|
621
|
+
throw err;
|
|
622
|
+
});
|
|
623
|
+
this._log.info('getSnapshot request %j', request);
|
|
624
|
+
const wrappedCallback = callback
|
|
625
|
+
? (error, response, options, rawResponse) => {
|
|
626
|
+
this._log.info('getSnapshot response %j', response);
|
|
627
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
628
|
+
}
|
|
629
|
+
: undefined;
|
|
630
|
+
return this.innerApiCalls
|
|
631
|
+
.getSnapshot(request, options, wrappedCallback)
|
|
632
|
+
?.then(([response, options, rawResponse]) => {
|
|
633
|
+
this._log.info('getSnapshot response %j', response);
|
|
634
|
+
return [response, options, rawResponse];
|
|
635
|
+
});
|
|
500
636
|
}
|
|
501
637
|
createSnapshot(request, optionsOrCallback, callback) {
|
|
502
|
-
var _a;
|
|
503
638
|
request = request || {};
|
|
504
639
|
let options;
|
|
505
640
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -514,13 +649,26 @@ class SubscriberClient {
|
|
|
514
649
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
515
650
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
516
651
|
this._gaxModule.routingHeader.fromParams({
|
|
517
|
-
name:
|
|
652
|
+
name: request.name ?? '',
|
|
518
653
|
});
|
|
519
|
-
this.initialize()
|
|
520
|
-
|
|
654
|
+
this.initialize().catch(err => {
|
|
655
|
+
throw err;
|
|
656
|
+
});
|
|
657
|
+
this._log.info('createSnapshot request %j', request);
|
|
658
|
+
const wrappedCallback = callback
|
|
659
|
+
? (error, response, options, rawResponse) => {
|
|
660
|
+
this._log.info('createSnapshot response %j', response);
|
|
661
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
662
|
+
}
|
|
663
|
+
: undefined;
|
|
664
|
+
return this.innerApiCalls
|
|
665
|
+
.createSnapshot(request, options, wrappedCallback)
|
|
666
|
+
?.then(([response, options, rawResponse]) => {
|
|
667
|
+
this._log.info('createSnapshot response %j', response);
|
|
668
|
+
return [response, options, rawResponse];
|
|
669
|
+
});
|
|
521
670
|
}
|
|
522
671
|
updateSnapshot(request, optionsOrCallback, callback) {
|
|
523
|
-
var _a;
|
|
524
672
|
request = request || {};
|
|
525
673
|
let options;
|
|
526
674
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -535,13 +683,26 @@ class SubscriberClient {
|
|
|
535
683
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
536
684
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
537
685
|
this._gaxModule.routingHeader.fromParams({
|
|
538
|
-
'snapshot.name':
|
|
686
|
+
'snapshot.name': request.snapshot.name ?? '',
|
|
539
687
|
});
|
|
540
|
-
this.initialize()
|
|
541
|
-
|
|
688
|
+
this.initialize().catch(err => {
|
|
689
|
+
throw err;
|
|
690
|
+
});
|
|
691
|
+
this._log.info('updateSnapshot request %j', request);
|
|
692
|
+
const wrappedCallback = callback
|
|
693
|
+
? (error, response, options, rawResponse) => {
|
|
694
|
+
this._log.info('updateSnapshot response %j', response);
|
|
695
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
696
|
+
}
|
|
697
|
+
: undefined;
|
|
698
|
+
return this.innerApiCalls
|
|
699
|
+
.updateSnapshot(request, options, wrappedCallback)
|
|
700
|
+
?.then(([response, options, rawResponse]) => {
|
|
701
|
+
this._log.info('updateSnapshot response %j', response);
|
|
702
|
+
return [response, options, rawResponse];
|
|
703
|
+
});
|
|
542
704
|
}
|
|
543
705
|
deleteSnapshot(request, optionsOrCallback, callback) {
|
|
544
|
-
var _a;
|
|
545
706
|
request = request || {};
|
|
546
707
|
let options;
|
|
547
708
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -556,13 +717,26 @@ class SubscriberClient {
|
|
|
556
717
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
557
718
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
558
719
|
this._gaxModule.routingHeader.fromParams({
|
|
559
|
-
snapshot:
|
|
720
|
+
snapshot: request.snapshot ?? '',
|
|
560
721
|
});
|
|
561
|
-
this.initialize()
|
|
562
|
-
|
|
722
|
+
this.initialize().catch(err => {
|
|
723
|
+
throw err;
|
|
724
|
+
});
|
|
725
|
+
this._log.info('deleteSnapshot request %j', request);
|
|
726
|
+
const wrappedCallback = callback
|
|
727
|
+
? (error, response, options, rawResponse) => {
|
|
728
|
+
this._log.info('deleteSnapshot response %j', response);
|
|
729
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
730
|
+
}
|
|
731
|
+
: undefined;
|
|
732
|
+
return this.innerApiCalls
|
|
733
|
+
.deleteSnapshot(request, options, wrappedCallback)
|
|
734
|
+
?.then(([response, options, rawResponse]) => {
|
|
735
|
+
this._log.info('deleteSnapshot response %j', response);
|
|
736
|
+
return [response, options, rawResponse];
|
|
737
|
+
});
|
|
563
738
|
}
|
|
564
739
|
seek(request, optionsOrCallback, callback) {
|
|
565
|
-
var _a;
|
|
566
740
|
request = request || {};
|
|
567
741
|
let options;
|
|
568
742
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -577,14 +751,28 @@ class SubscriberClient {
|
|
|
577
751
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
578
752
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
579
753
|
this._gaxModule.routingHeader.fromParams({
|
|
580
|
-
subscription:
|
|
754
|
+
subscription: request.subscription ?? '',
|
|
581
755
|
});
|
|
582
|
-
this.initialize()
|
|
583
|
-
|
|
756
|
+
this.initialize().catch(err => {
|
|
757
|
+
throw err;
|
|
758
|
+
});
|
|
759
|
+
this._log.info('seek request %j', request);
|
|
760
|
+
const wrappedCallback = callback
|
|
761
|
+
? (error, response, options, rawResponse) => {
|
|
762
|
+
this._log.info('seek response %j', response);
|
|
763
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
764
|
+
}
|
|
765
|
+
: undefined;
|
|
766
|
+
return this.innerApiCalls
|
|
767
|
+
.seek(request, options, wrappedCallback)
|
|
768
|
+
?.then(([response, options, rawResponse]) => {
|
|
769
|
+
this._log.info('seek response %j', response);
|
|
770
|
+
return [response, options, rawResponse];
|
|
771
|
+
});
|
|
584
772
|
}
|
|
585
773
|
/**
|
|
586
774
|
* Establishes a stream with the server, which sends messages down to the
|
|
587
|
-
* client. The client streams
|
|
775
|
+
* client. The client streams acknowledgments and ack deadline modifications
|
|
588
776
|
* back to the server. The server will close the stream and return the status
|
|
589
777
|
* on any error. The server may close the stream with status `UNAVAILABLE` to
|
|
590
778
|
* reassign server-side resources, in which case, the client should
|
|
@@ -601,11 +789,13 @@ class SubscriberClient {
|
|
|
601
789
|
* for more details and examples.
|
|
602
790
|
*/
|
|
603
791
|
streamingPull(options) {
|
|
604
|
-
this.initialize()
|
|
792
|
+
this.initialize().catch(err => {
|
|
793
|
+
throw err;
|
|
794
|
+
});
|
|
795
|
+
this._log.info('streamingPull stream %j', options);
|
|
605
796
|
return this.innerApiCalls.streamingPull(null, options);
|
|
606
797
|
}
|
|
607
798
|
listSubscriptions(request, optionsOrCallback, callback) {
|
|
608
|
-
var _a;
|
|
609
799
|
request = request || {};
|
|
610
800
|
let options;
|
|
611
801
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -620,13 +810,27 @@ class SubscriberClient {
|
|
|
620
810
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
621
811
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
622
812
|
this._gaxModule.routingHeader.fromParams({
|
|
623
|
-
project:
|
|
813
|
+
project: request.project ?? '',
|
|
624
814
|
});
|
|
625
|
-
this.initialize()
|
|
626
|
-
|
|
815
|
+
this.initialize().catch(err => {
|
|
816
|
+
throw err;
|
|
817
|
+
});
|
|
818
|
+
const wrappedCallback = callback
|
|
819
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
820
|
+
this._log.info('listSubscriptions values %j', values);
|
|
821
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
822
|
+
}
|
|
823
|
+
: undefined;
|
|
824
|
+
this._log.info('listSubscriptions request %j', request);
|
|
825
|
+
return this.innerApiCalls
|
|
826
|
+
.listSubscriptions(request, options, wrappedCallback)
|
|
827
|
+
?.then(([response, input, output]) => {
|
|
828
|
+
this._log.info('listSubscriptions values %j', response);
|
|
829
|
+
return [response, input, output];
|
|
830
|
+
});
|
|
627
831
|
}
|
|
628
832
|
/**
|
|
629
|
-
* Equivalent to `
|
|
833
|
+
* Equivalent to `listSubscriptions`, but returns a NodeJS Stream object.
|
|
630
834
|
* @param {Object} request
|
|
631
835
|
* The request object that will be sent.
|
|
632
836
|
* @param {string} request.project
|
|
@@ -650,18 +854,20 @@ class SubscriberClient {
|
|
|
650
854
|
* for more details and examples.
|
|
651
855
|
*/
|
|
652
856
|
listSubscriptionsStream(request, options) {
|
|
653
|
-
var _a;
|
|
654
857
|
request = request || {};
|
|
655
858
|
options = options || {};
|
|
656
859
|
options.otherArgs = options.otherArgs || {};
|
|
657
860
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
658
861
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
659
862
|
this._gaxModule.routingHeader.fromParams({
|
|
660
|
-
project:
|
|
863
|
+
project: request.project ?? '',
|
|
661
864
|
});
|
|
662
865
|
const defaultCallSettings = this._defaults['listSubscriptions'];
|
|
663
866
|
const callSettings = defaultCallSettings.merge(options);
|
|
664
|
-
this.initialize()
|
|
867
|
+
this.initialize().catch(err => {
|
|
868
|
+
throw err;
|
|
869
|
+
});
|
|
870
|
+
this._log.info('listSubscriptions stream %j', request);
|
|
665
871
|
return this.descriptors.page.listSubscriptions.createStream(this.innerApiCalls.listSubscriptions, request, callSettings);
|
|
666
872
|
}
|
|
667
873
|
/**
|
|
@@ -690,22 +896,23 @@ class SubscriberClient {
|
|
|
690
896
|
* for more details and examples.
|
|
691
897
|
*/
|
|
692
898
|
listSubscriptionsAsync(request, options) {
|
|
693
|
-
var _a;
|
|
694
899
|
request = request || {};
|
|
695
900
|
options = options || {};
|
|
696
901
|
options.otherArgs = options.otherArgs || {};
|
|
697
902
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
698
903
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
699
904
|
this._gaxModule.routingHeader.fromParams({
|
|
700
|
-
project:
|
|
905
|
+
project: request.project ?? '',
|
|
701
906
|
});
|
|
702
907
|
const defaultCallSettings = this._defaults['listSubscriptions'];
|
|
703
908
|
const callSettings = defaultCallSettings.merge(options);
|
|
704
|
-
this.initialize()
|
|
909
|
+
this.initialize().catch(err => {
|
|
910
|
+
throw err;
|
|
911
|
+
});
|
|
912
|
+
this._log.info('listSubscriptions iterate %j', request);
|
|
705
913
|
return this.descriptors.page.listSubscriptions.asyncIterate(this.innerApiCalls['listSubscriptions'], request, callSettings);
|
|
706
914
|
}
|
|
707
915
|
listSnapshots(request, optionsOrCallback, callback) {
|
|
708
|
-
var _a;
|
|
709
916
|
request = request || {};
|
|
710
917
|
let options;
|
|
711
918
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -720,13 +927,27 @@ class SubscriberClient {
|
|
|
720
927
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
721
928
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
722
929
|
this._gaxModule.routingHeader.fromParams({
|
|
723
|
-
project:
|
|
930
|
+
project: request.project ?? '',
|
|
724
931
|
});
|
|
725
|
-
this.initialize()
|
|
726
|
-
|
|
932
|
+
this.initialize().catch(err => {
|
|
933
|
+
throw err;
|
|
934
|
+
});
|
|
935
|
+
const wrappedCallback = callback
|
|
936
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
937
|
+
this._log.info('listSnapshots values %j', values);
|
|
938
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
939
|
+
}
|
|
940
|
+
: undefined;
|
|
941
|
+
this._log.info('listSnapshots request %j', request);
|
|
942
|
+
return this.innerApiCalls
|
|
943
|
+
.listSnapshots(request, options, wrappedCallback)
|
|
944
|
+
?.then(([response, input, output]) => {
|
|
945
|
+
this._log.info('listSnapshots values %j', response);
|
|
946
|
+
return [response, input, output];
|
|
947
|
+
});
|
|
727
948
|
}
|
|
728
949
|
/**
|
|
729
|
-
* Equivalent to `
|
|
950
|
+
* Equivalent to `listSnapshots`, but returns a NodeJS Stream object.
|
|
730
951
|
* @param {Object} request
|
|
731
952
|
* The request object that will be sent.
|
|
732
953
|
* @param {string} request.project
|
|
@@ -750,18 +971,20 @@ class SubscriberClient {
|
|
|
750
971
|
* for more details and examples.
|
|
751
972
|
*/
|
|
752
973
|
listSnapshotsStream(request, options) {
|
|
753
|
-
var _a;
|
|
754
974
|
request = request || {};
|
|
755
975
|
options = options || {};
|
|
756
976
|
options.otherArgs = options.otherArgs || {};
|
|
757
977
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
758
978
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
759
979
|
this._gaxModule.routingHeader.fromParams({
|
|
760
|
-
project:
|
|
980
|
+
project: request.project ?? '',
|
|
761
981
|
});
|
|
762
982
|
const defaultCallSettings = this._defaults['listSnapshots'];
|
|
763
983
|
const callSettings = defaultCallSettings.merge(options);
|
|
764
|
-
this.initialize()
|
|
984
|
+
this.initialize().catch(err => {
|
|
985
|
+
throw err;
|
|
986
|
+
});
|
|
987
|
+
this._log.info('listSnapshots stream %j', request);
|
|
765
988
|
return this.descriptors.page.listSnapshots.createStream(this.innerApiCalls.listSnapshots, request, callSettings);
|
|
766
989
|
}
|
|
767
990
|
/**
|
|
@@ -790,18 +1013,20 @@ class SubscriberClient {
|
|
|
790
1013
|
* for more details and examples.
|
|
791
1014
|
*/
|
|
792
1015
|
listSnapshotsAsync(request, options) {
|
|
793
|
-
var _a;
|
|
794
1016
|
request = request || {};
|
|
795
1017
|
options = options || {};
|
|
796
1018
|
options.otherArgs = options.otherArgs || {};
|
|
797
1019
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
798
1020
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
799
1021
|
this._gaxModule.routingHeader.fromParams({
|
|
800
|
-
project:
|
|
1022
|
+
project: request.project ?? '',
|
|
801
1023
|
});
|
|
802
1024
|
const defaultCallSettings = this._defaults['listSnapshots'];
|
|
803
1025
|
const callSettings = defaultCallSettings.merge(options);
|
|
804
|
-
this.initialize()
|
|
1026
|
+
this.initialize().catch(err => {
|
|
1027
|
+
throw err;
|
|
1028
|
+
});
|
|
1029
|
+
this._log.info('listSnapshots iterate %j', request);
|
|
805
1030
|
return this.descriptors.page.listSnapshots.asyncIterate(this.innerApiCalls['listSnapshots'], request, callSettings);
|
|
806
1031
|
}
|
|
807
1032
|
/**
|
|
@@ -1066,9 +1291,12 @@ class SubscriberClient {
|
|
|
1066
1291
|
close() {
|
|
1067
1292
|
if (this.subscriberStub && !this._terminated) {
|
|
1068
1293
|
return this.subscriberStub.then(stub => {
|
|
1294
|
+
this._log.info('ending gRPC channel');
|
|
1069
1295
|
this._terminated = true;
|
|
1070
1296
|
stub.close();
|
|
1071
|
-
this.iamClient.close()
|
|
1297
|
+
this.iamClient.close().catch(err => {
|
|
1298
|
+
throw err;
|
|
1299
|
+
});
|
|
1072
1300
|
});
|
|
1073
1301
|
}
|
|
1074
1302
|
return Promise.resolve();
|