@google-cloud/pubsub 4.11.0 → 5.0.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/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/build/protos/protos.d.ts +6 -6
- package/build/protos/protos.js +423 -141
- package/build/protos/protos.json +39 -18
- 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 +36 -112
- 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 +26 -4
- package/build/src/v1/publisher_client.js +232 -90
- 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 +24 -3
- package/build/src/v1/schema_service_client.js +235 -75
- 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 +39 -3
- package/build/src/v1/subscriber_client.js +327 -97
- package/build/src/v1/subscriber_client.js.map +1 -1
- package/build/src/v1/subscriber_proto_list.json +4 -0
- package/package.json +43 -45
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.PublisherClient = void 0;
|
|
21
21
|
const jsonProtos = require("../../protos/protos.json");
|
|
22
|
+
const google_gax_1 = require("google-gax");
|
|
22
23
|
/**
|
|
23
24
|
* Client JSON configuration object, loaded from
|
|
24
25
|
* `src/v1/publisher_client_config.json`.
|
|
@@ -33,6 +34,28 @@ const version = require('../../../package.json').version;
|
|
|
33
34
|
* @memberof v1
|
|
34
35
|
*/
|
|
35
36
|
class PublisherClient {
|
|
37
|
+
_terminated = false;
|
|
38
|
+
_opts;
|
|
39
|
+
_providedCustomServicePath;
|
|
40
|
+
_gaxModule;
|
|
41
|
+
_gaxGrpc;
|
|
42
|
+
_protos;
|
|
43
|
+
_defaults;
|
|
44
|
+
_universeDomain;
|
|
45
|
+
_servicePath;
|
|
46
|
+
_log = google_gax_1.loggingUtils.log('pubsub');
|
|
47
|
+
auth;
|
|
48
|
+
descriptors = {
|
|
49
|
+
page: {},
|
|
50
|
+
stream: {},
|
|
51
|
+
longrunning: {},
|
|
52
|
+
batching: {},
|
|
53
|
+
};
|
|
54
|
+
warn;
|
|
55
|
+
innerApiCalls;
|
|
56
|
+
iamClient;
|
|
57
|
+
pathTemplates;
|
|
58
|
+
publisherStub;
|
|
36
59
|
/**
|
|
37
60
|
* Construct an instance of PublisherClient.
|
|
38
61
|
*
|
|
@@ -55,7 +78,7 @@ class PublisherClient {
|
|
|
55
78
|
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
|
|
56
79
|
* the environment variable GCLOUD_PROJECT for your project ID. If your
|
|
57
80
|
* app is running in an environment which supports
|
|
58
|
-
* {@link https://
|
|
81
|
+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
|
|
59
82
|
* your project ID will be detected automatically.
|
|
60
83
|
* @param {string} [options.apiEndpoint] - The domain name of the
|
|
61
84
|
* API remote host.
|
|
@@ -73,35 +96,29 @@ class PublisherClient {
|
|
|
73
96
|
* ```
|
|
74
97
|
*/
|
|
75
98
|
constructor(opts, gaxInstance) {
|
|
76
|
-
var _a, _b, _c, _d, _e;
|
|
77
|
-
this._terminated = false;
|
|
78
|
-
this.descriptors = {
|
|
79
|
-
page: {},
|
|
80
|
-
stream: {},
|
|
81
|
-
longrunning: {},
|
|
82
|
-
batching: {},
|
|
83
|
-
};
|
|
84
99
|
// Ensure that options include all the required fields.
|
|
85
100
|
const staticMembers = this.constructor;
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
if (opts?.universe_domain &&
|
|
102
|
+
opts?.universeDomain &&
|
|
103
|
+
opts?.universe_domain !== opts?.universeDomain) {
|
|
89
104
|
throw new Error('Please set either universe_domain or universeDomain, but not both.');
|
|
90
105
|
}
|
|
91
106
|
const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
|
|
92
107
|
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
|
|
93
108
|
: undefined;
|
|
94
109
|
this._universeDomain =
|
|
95
|
-
|
|
110
|
+
opts?.universeDomain ??
|
|
111
|
+
opts?.universe_domain ??
|
|
112
|
+
universeDomainEnvVar ??
|
|
113
|
+
'googleapis.com';
|
|
96
114
|
this._servicePath = 'pubsub.' + this._universeDomain;
|
|
97
|
-
const servicePath =
|
|
98
|
-
this._providedCustomServicePath = !!(
|
|
99
|
-
const port =
|
|
100
|
-
const clientConfig =
|
|
101
|
-
const fallback =
|
|
115
|
+
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
|
|
116
|
+
this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
|
|
117
|
+
const port = opts?.port || staticMembers.port;
|
|
118
|
+
const clientConfig = opts?.clientConfig ?? {};
|
|
119
|
+
const fallback = opts?.fallback ??
|
|
120
|
+
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
|
|
102
121
|
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
|
|
103
|
-
// Request numeric enum values if REST transport is used.
|
|
104
|
-
opts.numericEnums = true;
|
|
105
122
|
// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
|
|
106
123
|
if (servicePath !== this._servicePath && !('scopes' in opts)) {
|
|
107
124
|
opts['scopes'] = staticMembers.scopes;
|
|
@@ -164,14 +181,6 @@ class PublisherClient {
|
|
|
164
181
|
listTopicSubscriptions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subscriptions'),
|
|
165
182
|
listTopicSnapshots: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'snapshots'),
|
|
166
183
|
};
|
|
167
|
-
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
168
|
-
// Some methods on this API support automatically batching
|
|
169
|
-
// requests; denote this.
|
|
170
|
-
this.descriptors.batching = {
|
|
171
|
-
publish: new this._gaxModule.BundleDescriptor('messages', ['topic'], 'message_ids', this._gaxModule.GrpcClient.createByteLengthFunction(
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
-
protoFilesRoot.lookupType('google.pubsub.v1.PubsubMessage'))),
|
|
174
|
-
};
|
|
175
184
|
// Put together the default options sent with requests.
|
|
176
185
|
this._defaults = this._gaxGrpc.constructSettings('google.pubsub.v1.Publisher', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
|
|
177
186
|
// Set up a dictionary of "inner API calls"; the core implementation
|
|
@@ -193,7 +202,6 @@ class PublisherClient {
|
|
|
193
202
|
* @returns {Promise} A promise that resolves to an authenticated service stub.
|
|
194
203
|
*/
|
|
195
204
|
initialize() {
|
|
196
|
-
var _a;
|
|
197
205
|
// If the client stub promise is already initialized, return immediately.
|
|
198
206
|
if (this.publisherStub) {
|
|
199
207
|
return this.publisherStub;
|
|
@@ -227,9 +235,7 @@ class PublisherClient {
|
|
|
227
235
|
}, (err) => () => {
|
|
228
236
|
throw err;
|
|
229
237
|
});
|
|
230
|
-
const descriptor = this.descriptors.page[methodName] ||
|
|
231
|
-
((_a = this.descriptors.batching) === null || _a === void 0 ? void 0 : _a[methodName]) ||
|
|
232
|
-
undefined;
|
|
238
|
+
const descriptor = this.descriptors.page[methodName] || undefined;
|
|
233
239
|
const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
|
|
234
240
|
this.innerApiCalls[methodName] = apiCall;
|
|
235
241
|
}
|
|
@@ -299,7 +305,6 @@ class PublisherClient {
|
|
|
299
305
|
return this.auth.getProjectId();
|
|
300
306
|
}
|
|
301
307
|
createTopic(request, optionsOrCallback, callback) {
|
|
302
|
-
var _a;
|
|
303
308
|
request = request || {};
|
|
304
309
|
let options;
|
|
305
310
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -314,13 +319,26 @@ class PublisherClient {
|
|
|
314
319
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
315
320
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
316
321
|
this._gaxModule.routingHeader.fromParams({
|
|
317
|
-
name:
|
|
322
|
+
name: request.name ?? '',
|
|
318
323
|
});
|
|
319
|
-
this.initialize()
|
|
320
|
-
|
|
324
|
+
this.initialize().catch(err => {
|
|
325
|
+
throw err;
|
|
326
|
+
});
|
|
327
|
+
this._log.info('createTopic request %j', request);
|
|
328
|
+
const wrappedCallback = callback
|
|
329
|
+
? (error, response, options, rawResponse) => {
|
|
330
|
+
this._log.info('createTopic response %j', response);
|
|
331
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
332
|
+
}
|
|
333
|
+
: undefined;
|
|
334
|
+
return this.innerApiCalls
|
|
335
|
+
.createTopic(request, options, wrappedCallback)
|
|
336
|
+
?.then(([response, options, rawResponse]) => {
|
|
337
|
+
this._log.info('createTopic response %j', response);
|
|
338
|
+
return [response, options, rawResponse];
|
|
339
|
+
});
|
|
321
340
|
}
|
|
322
341
|
updateTopic(request, optionsOrCallback, callback) {
|
|
323
|
-
var _a;
|
|
324
342
|
request = request || {};
|
|
325
343
|
let options;
|
|
326
344
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -335,13 +353,26 @@ class PublisherClient {
|
|
|
335
353
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
336
354
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
337
355
|
this._gaxModule.routingHeader.fromParams({
|
|
338
|
-
'topic.name':
|
|
356
|
+
'topic.name': request.topic.name ?? '',
|
|
339
357
|
});
|
|
340
|
-
this.initialize()
|
|
341
|
-
|
|
358
|
+
this.initialize().catch(err => {
|
|
359
|
+
throw err;
|
|
360
|
+
});
|
|
361
|
+
this._log.info('updateTopic request %j', request);
|
|
362
|
+
const wrappedCallback = callback
|
|
363
|
+
? (error, response, options, rawResponse) => {
|
|
364
|
+
this._log.info('updateTopic response %j', response);
|
|
365
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
366
|
+
}
|
|
367
|
+
: undefined;
|
|
368
|
+
return this.innerApiCalls
|
|
369
|
+
.updateTopic(request, options, wrappedCallback)
|
|
370
|
+
?.then(([response, options, rawResponse]) => {
|
|
371
|
+
this._log.info('updateTopic response %j', response);
|
|
372
|
+
return [response, options, rawResponse];
|
|
373
|
+
});
|
|
342
374
|
}
|
|
343
375
|
publish(request, optionsOrCallback, callback) {
|
|
344
|
-
var _a;
|
|
345
376
|
request = request || {};
|
|
346
377
|
let options;
|
|
347
378
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -356,13 +387,26 @@ class PublisherClient {
|
|
|
356
387
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
357
388
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
358
389
|
this._gaxModule.routingHeader.fromParams({
|
|
359
|
-
topic:
|
|
390
|
+
topic: request.topic ?? '',
|
|
360
391
|
});
|
|
361
|
-
this.initialize()
|
|
362
|
-
|
|
392
|
+
this.initialize().catch(err => {
|
|
393
|
+
throw err;
|
|
394
|
+
});
|
|
395
|
+
this._log.info('publish request %j', request);
|
|
396
|
+
const wrappedCallback = callback
|
|
397
|
+
? (error, response, options, rawResponse) => {
|
|
398
|
+
this._log.info('publish response %j', response);
|
|
399
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
400
|
+
}
|
|
401
|
+
: undefined;
|
|
402
|
+
return this.innerApiCalls
|
|
403
|
+
.publish(request, options, wrappedCallback)
|
|
404
|
+
?.then(([response, options, rawResponse]) => {
|
|
405
|
+
this._log.info('publish response %j', response);
|
|
406
|
+
return [response, options, rawResponse];
|
|
407
|
+
});
|
|
363
408
|
}
|
|
364
409
|
getTopic(request, optionsOrCallback, callback) {
|
|
365
|
-
var _a;
|
|
366
410
|
request = request || {};
|
|
367
411
|
let options;
|
|
368
412
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -377,13 +421,26 @@ class PublisherClient {
|
|
|
377
421
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
378
422
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
379
423
|
this._gaxModule.routingHeader.fromParams({
|
|
380
|
-
topic:
|
|
424
|
+
topic: request.topic ?? '',
|
|
381
425
|
});
|
|
382
|
-
this.initialize()
|
|
383
|
-
|
|
426
|
+
this.initialize().catch(err => {
|
|
427
|
+
throw err;
|
|
428
|
+
});
|
|
429
|
+
this._log.info('getTopic request %j', request);
|
|
430
|
+
const wrappedCallback = callback
|
|
431
|
+
? (error, response, options, rawResponse) => {
|
|
432
|
+
this._log.info('getTopic response %j', response);
|
|
433
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
434
|
+
}
|
|
435
|
+
: undefined;
|
|
436
|
+
return this.innerApiCalls
|
|
437
|
+
.getTopic(request, options, wrappedCallback)
|
|
438
|
+
?.then(([response, options, rawResponse]) => {
|
|
439
|
+
this._log.info('getTopic response %j', response);
|
|
440
|
+
return [response, options, rawResponse];
|
|
441
|
+
});
|
|
384
442
|
}
|
|
385
443
|
deleteTopic(request, optionsOrCallback, callback) {
|
|
386
|
-
var _a;
|
|
387
444
|
request = request || {};
|
|
388
445
|
let options;
|
|
389
446
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -398,13 +455,26 @@ class PublisherClient {
|
|
|
398
455
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
399
456
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
400
457
|
this._gaxModule.routingHeader.fromParams({
|
|
401
|
-
topic:
|
|
458
|
+
topic: request.topic ?? '',
|
|
402
459
|
});
|
|
403
|
-
this.initialize()
|
|
404
|
-
|
|
460
|
+
this.initialize().catch(err => {
|
|
461
|
+
throw err;
|
|
462
|
+
});
|
|
463
|
+
this._log.info('deleteTopic request %j', request);
|
|
464
|
+
const wrappedCallback = callback
|
|
465
|
+
? (error, response, options, rawResponse) => {
|
|
466
|
+
this._log.info('deleteTopic response %j', response);
|
|
467
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
468
|
+
}
|
|
469
|
+
: undefined;
|
|
470
|
+
return this.innerApiCalls
|
|
471
|
+
.deleteTopic(request, options, wrappedCallback)
|
|
472
|
+
?.then(([response, options, rawResponse]) => {
|
|
473
|
+
this._log.info('deleteTopic response %j', response);
|
|
474
|
+
return [response, options, rawResponse];
|
|
475
|
+
});
|
|
405
476
|
}
|
|
406
477
|
detachSubscription(request, optionsOrCallback, callback) {
|
|
407
|
-
var _a;
|
|
408
478
|
request = request || {};
|
|
409
479
|
let options;
|
|
410
480
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -419,13 +489,26 @@ class PublisherClient {
|
|
|
419
489
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
420
490
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
421
491
|
this._gaxModule.routingHeader.fromParams({
|
|
422
|
-
subscription:
|
|
492
|
+
subscription: request.subscription ?? '',
|
|
423
493
|
});
|
|
424
|
-
this.initialize()
|
|
425
|
-
|
|
494
|
+
this.initialize().catch(err => {
|
|
495
|
+
throw err;
|
|
496
|
+
});
|
|
497
|
+
this._log.info('detachSubscription request %j', request);
|
|
498
|
+
const wrappedCallback = callback
|
|
499
|
+
? (error, response, options, rawResponse) => {
|
|
500
|
+
this._log.info('detachSubscription response %j', response);
|
|
501
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
502
|
+
}
|
|
503
|
+
: undefined;
|
|
504
|
+
return this.innerApiCalls
|
|
505
|
+
.detachSubscription(request, options, wrappedCallback)
|
|
506
|
+
?.then(([response, options, rawResponse]) => {
|
|
507
|
+
this._log.info('detachSubscription response %j', response);
|
|
508
|
+
return [response, options, rawResponse];
|
|
509
|
+
});
|
|
426
510
|
}
|
|
427
511
|
listTopics(request, optionsOrCallback, callback) {
|
|
428
|
-
var _a;
|
|
429
512
|
request = request || {};
|
|
430
513
|
let options;
|
|
431
514
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -440,13 +523,27 @@ class PublisherClient {
|
|
|
440
523
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
441
524
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
442
525
|
this._gaxModule.routingHeader.fromParams({
|
|
443
|
-
project:
|
|
526
|
+
project: request.project ?? '',
|
|
444
527
|
});
|
|
445
|
-
this.initialize()
|
|
446
|
-
|
|
528
|
+
this.initialize().catch(err => {
|
|
529
|
+
throw err;
|
|
530
|
+
});
|
|
531
|
+
const wrappedCallback = callback
|
|
532
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
533
|
+
this._log.info('listTopics values %j', values);
|
|
534
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
535
|
+
}
|
|
536
|
+
: undefined;
|
|
537
|
+
this._log.info('listTopics request %j', request);
|
|
538
|
+
return this.innerApiCalls
|
|
539
|
+
.listTopics(request, options, wrappedCallback)
|
|
540
|
+
?.then(([response, input, output]) => {
|
|
541
|
+
this._log.info('listTopics values %j', response);
|
|
542
|
+
return [response, input, output];
|
|
543
|
+
});
|
|
447
544
|
}
|
|
448
545
|
/**
|
|
449
|
-
* Equivalent to `
|
|
546
|
+
* Equivalent to `listTopics`, but returns a NodeJS Stream object.
|
|
450
547
|
* @param {Object} request
|
|
451
548
|
* The request object that will be sent.
|
|
452
549
|
* @param {string} request.project
|
|
@@ -470,18 +567,20 @@ class PublisherClient {
|
|
|
470
567
|
* for more details and examples.
|
|
471
568
|
*/
|
|
472
569
|
listTopicsStream(request, options) {
|
|
473
|
-
var _a;
|
|
474
570
|
request = request || {};
|
|
475
571
|
options = options || {};
|
|
476
572
|
options.otherArgs = options.otherArgs || {};
|
|
477
573
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
478
574
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
479
575
|
this._gaxModule.routingHeader.fromParams({
|
|
480
|
-
project:
|
|
576
|
+
project: request.project ?? '',
|
|
481
577
|
});
|
|
482
578
|
const defaultCallSettings = this._defaults['listTopics'];
|
|
483
579
|
const callSettings = defaultCallSettings.merge(options);
|
|
484
|
-
this.initialize()
|
|
580
|
+
this.initialize().catch(err => {
|
|
581
|
+
throw err;
|
|
582
|
+
});
|
|
583
|
+
this._log.info('listTopics stream %j', request);
|
|
485
584
|
return this.descriptors.page.listTopics.createStream(this.innerApiCalls.listTopics, request, callSettings);
|
|
486
585
|
}
|
|
487
586
|
/**
|
|
@@ -508,24 +607,27 @@ class PublisherClient {
|
|
|
508
607
|
* so you can stop the iteration when you don't need more results.
|
|
509
608
|
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
510
609
|
* for more details and examples.
|
|
610
|
+
* @example <caption>include:samples/generated/v1/publisher.list_topics.js</caption>
|
|
611
|
+
* region_tag:pubsub_v1_generated_Publisher_ListTopics_async
|
|
511
612
|
*/
|
|
512
613
|
listTopicsAsync(request, options) {
|
|
513
|
-
var _a;
|
|
514
614
|
request = request || {};
|
|
515
615
|
options = options || {};
|
|
516
616
|
options.otherArgs = options.otherArgs || {};
|
|
517
617
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
518
618
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
519
619
|
this._gaxModule.routingHeader.fromParams({
|
|
520
|
-
project:
|
|
620
|
+
project: request.project ?? '',
|
|
521
621
|
});
|
|
522
622
|
const defaultCallSettings = this._defaults['listTopics'];
|
|
523
623
|
const callSettings = defaultCallSettings.merge(options);
|
|
524
|
-
this.initialize()
|
|
624
|
+
this.initialize().catch(err => {
|
|
625
|
+
throw err;
|
|
626
|
+
});
|
|
627
|
+
this._log.info('listTopics iterate %j', request);
|
|
525
628
|
return this.descriptors.page.listTopics.asyncIterate(this.innerApiCalls['listTopics'], request, callSettings);
|
|
526
629
|
}
|
|
527
630
|
listTopicSubscriptions(request, optionsOrCallback, callback) {
|
|
528
|
-
var _a;
|
|
529
631
|
request = request || {};
|
|
530
632
|
let options;
|
|
531
633
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -540,13 +642,27 @@ class PublisherClient {
|
|
|
540
642
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
541
643
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
542
644
|
this._gaxModule.routingHeader.fromParams({
|
|
543
|
-
topic:
|
|
645
|
+
topic: request.topic ?? '',
|
|
544
646
|
});
|
|
545
|
-
this.initialize()
|
|
546
|
-
|
|
647
|
+
this.initialize().catch(err => {
|
|
648
|
+
throw err;
|
|
649
|
+
});
|
|
650
|
+
const wrappedCallback = callback
|
|
651
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
652
|
+
this._log.info('listTopicSubscriptions values %j', values);
|
|
653
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
654
|
+
}
|
|
655
|
+
: undefined;
|
|
656
|
+
this._log.info('listTopicSubscriptions request %j', request);
|
|
657
|
+
return this.innerApiCalls
|
|
658
|
+
.listTopicSubscriptions(request, options, wrappedCallback)
|
|
659
|
+
?.then(([response, input, output]) => {
|
|
660
|
+
this._log.info('listTopicSubscriptions values %j', response);
|
|
661
|
+
return [response, input, output];
|
|
662
|
+
});
|
|
547
663
|
}
|
|
548
664
|
/**
|
|
549
|
-
* Equivalent to `
|
|
665
|
+
* Equivalent to `listTopicSubscriptions`, but returns a NodeJS Stream object.
|
|
550
666
|
* @param {Object} request
|
|
551
667
|
* The request object that will be sent.
|
|
552
668
|
* @param {string} request.topic
|
|
@@ -570,18 +686,20 @@ class PublisherClient {
|
|
|
570
686
|
* for more details and examples.
|
|
571
687
|
*/
|
|
572
688
|
listTopicSubscriptionsStream(request, options) {
|
|
573
|
-
var _a;
|
|
574
689
|
request = request || {};
|
|
575
690
|
options = options || {};
|
|
576
691
|
options.otherArgs = options.otherArgs || {};
|
|
577
692
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
578
693
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
579
694
|
this._gaxModule.routingHeader.fromParams({
|
|
580
|
-
topic:
|
|
695
|
+
topic: request.topic ?? '',
|
|
581
696
|
});
|
|
582
697
|
const defaultCallSettings = this._defaults['listTopicSubscriptions'];
|
|
583
698
|
const callSettings = defaultCallSettings.merge(options);
|
|
584
|
-
this.initialize()
|
|
699
|
+
this.initialize().catch(err => {
|
|
700
|
+
throw err;
|
|
701
|
+
});
|
|
702
|
+
this._log.info('listTopicSubscriptions stream %j', request);
|
|
585
703
|
return this.descriptors.page.listTopicSubscriptions.createStream(this.innerApiCalls.listTopicSubscriptions, request, callSettings);
|
|
586
704
|
}
|
|
587
705
|
/**
|
|
@@ -608,24 +726,27 @@ class PublisherClient {
|
|
|
608
726
|
* so you can stop the iteration when you don't need more results.
|
|
609
727
|
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
610
728
|
* for more details and examples.
|
|
729
|
+
* @example <caption>include:samples/generated/v1/publisher.list_topic_subscriptions.js</caption>
|
|
730
|
+
* region_tag:pubsub_v1_generated_Publisher_ListTopicSubscriptions_async
|
|
611
731
|
*/
|
|
612
732
|
listTopicSubscriptionsAsync(request, options) {
|
|
613
|
-
var _a;
|
|
614
733
|
request = request || {};
|
|
615
734
|
options = options || {};
|
|
616
735
|
options.otherArgs = options.otherArgs || {};
|
|
617
736
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
618
737
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
619
738
|
this._gaxModule.routingHeader.fromParams({
|
|
620
|
-
topic:
|
|
739
|
+
topic: request.topic ?? '',
|
|
621
740
|
});
|
|
622
741
|
const defaultCallSettings = this._defaults['listTopicSubscriptions'];
|
|
623
742
|
const callSettings = defaultCallSettings.merge(options);
|
|
624
|
-
this.initialize()
|
|
743
|
+
this.initialize().catch(err => {
|
|
744
|
+
throw err;
|
|
745
|
+
});
|
|
746
|
+
this._log.info('listTopicSubscriptions iterate %j', request);
|
|
625
747
|
return this.descriptors.page.listTopicSubscriptions.asyncIterate(this.innerApiCalls['listTopicSubscriptions'], request, callSettings);
|
|
626
748
|
}
|
|
627
749
|
listTopicSnapshots(request, optionsOrCallback, callback) {
|
|
628
|
-
var _a;
|
|
629
750
|
request = request || {};
|
|
630
751
|
let options;
|
|
631
752
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -640,13 +761,27 @@ class PublisherClient {
|
|
|
640
761
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
641
762
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
642
763
|
this._gaxModule.routingHeader.fromParams({
|
|
643
|
-
topic:
|
|
764
|
+
topic: request.topic ?? '',
|
|
644
765
|
});
|
|
645
|
-
this.initialize()
|
|
646
|
-
|
|
766
|
+
this.initialize().catch(err => {
|
|
767
|
+
throw err;
|
|
768
|
+
});
|
|
769
|
+
const wrappedCallback = callback
|
|
770
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
771
|
+
this._log.info('listTopicSnapshots values %j', values);
|
|
772
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
773
|
+
}
|
|
774
|
+
: undefined;
|
|
775
|
+
this._log.info('listTopicSnapshots request %j', request);
|
|
776
|
+
return this.innerApiCalls
|
|
777
|
+
.listTopicSnapshots(request, options, wrappedCallback)
|
|
778
|
+
?.then(([response, input, output]) => {
|
|
779
|
+
this._log.info('listTopicSnapshots values %j', response);
|
|
780
|
+
return [response, input, output];
|
|
781
|
+
});
|
|
647
782
|
}
|
|
648
783
|
/**
|
|
649
|
-
* Equivalent to `
|
|
784
|
+
* Equivalent to `listTopicSnapshots`, but returns a NodeJS Stream object.
|
|
650
785
|
* @param {Object} request
|
|
651
786
|
* The request object that will be sent.
|
|
652
787
|
* @param {string} request.topic
|
|
@@ -670,18 +805,20 @@ class PublisherClient {
|
|
|
670
805
|
* for more details and examples.
|
|
671
806
|
*/
|
|
672
807
|
listTopicSnapshotsStream(request, options) {
|
|
673
|
-
var _a;
|
|
674
808
|
request = request || {};
|
|
675
809
|
options = options || {};
|
|
676
810
|
options.otherArgs = options.otherArgs || {};
|
|
677
811
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
678
812
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
679
813
|
this._gaxModule.routingHeader.fromParams({
|
|
680
|
-
topic:
|
|
814
|
+
topic: request.topic ?? '',
|
|
681
815
|
});
|
|
682
816
|
const defaultCallSettings = this._defaults['listTopicSnapshots'];
|
|
683
817
|
const callSettings = defaultCallSettings.merge(options);
|
|
684
|
-
this.initialize()
|
|
818
|
+
this.initialize().catch(err => {
|
|
819
|
+
throw err;
|
|
820
|
+
});
|
|
821
|
+
this._log.info('listTopicSnapshots stream %j', request);
|
|
685
822
|
return this.descriptors.page.listTopicSnapshots.createStream(this.innerApiCalls.listTopicSnapshots, request, callSettings);
|
|
686
823
|
}
|
|
687
824
|
/**
|
|
@@ -708,20 +845,24 @@ class PublisherClient {
|
|
|
708
845
|
* so you can stop the iteration when you don't need more results.
|
|
709
846
|
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
710
847
|
* for more details and examples.
|
|
848
|
+
* @example <caption>include:samples/generated/v1/publisher.list_topic_snapshots.js</caption>
|
|
849
|
+
* region_tag:pubsub_v1_generated_Publisher_ListTopicSnapshots_async
|
|
711
850
|
*/
|
|
712
851
|
listTopicSnapshotsAsync(request, options) {
|
|
713
|
-
var _a;
|
|
714
852
|
request = request || {};
|
|
715
853
|
options = options || {};
|
|
716
854
|
options.otherArgs = options.otherArgs || {};
|
|
717
855
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
718
856
|
options.otherArgs.headers['x-goog-request-params'] =
|
|
719
857
|
this._gaxModule.routingHeader.fromParams({
|
|
720
|
-
topic:
|
|
858
|
+
topic: request.topic ?? '',
|
|
721
859
|
});
|
|
722
860
|
const defaultCallSettings = this._defaults['listTopicSnapshots'];
|
|
723
861
|
const callSettings = defaultCallSettings.merge(options);
|
|
724
|
-
this.initialize()
|
|
862
|
+
this.initialize().catch(err => {
|
|
863
|
+
throw err;
|
|
864
|
+
});
|
|
865
|
+
this._log.info('listTopicSnapshots iterate %j', request);
|
|
725
866
|
return this.descriptors.page.listTopicSnapshots.asyncIterate(this.innerApiCalls['listTopicSnapshots'], request, callSettings);
|
|
726
867
|
}
|
|
727
868
|
/**
|
|
@@ -986,9 +1127,10 @@ class PublisherClient {
|
|
|
986
1127
|
close() {
|
|
987
1128
|
if (this.publisherStub && !this._terminated) {
|
|
988
1129
|
return this.publisherStub.then(stub => {
|
|
1130
|
+
this._log.info('ending gRPC channel');
|
|
989
1131
|
this._terminated = true;
|
|
990
1132
|
stub.close();
|
|
991
|
-
this.iamClient.close();
|
|
1133
|
+
void this.iamClient.close();
|
|
992
1134
|
});
|
|
993
1135
|
}
|
|
994
1136
|
return Promise.resolve();
|