@google-cloud/pubsub 2.16.6 → 2.18.2
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 +38 -0
- package/README.md +54 -53
- package/build/protos/protos.d.ts +2 -1
- package/build/protos/protos.js +7 -0
- package/build/protos/protos.json +14 -1
- package/build/src/iam.d.ts +180 -0
- package/build/src/iam.js +11 -176
- package/build/src/iam.js.map +1 -1
- package/build/src/index.d.ts +13 -4
- package/build/src/index.js +12 -4
- package/build/src/index.js.map +1 -1
- package/build/src/lease-manager.d.ts +7 -2
- package/build/src/lease-manager.js +19 -4
- package/build/src/lease-manager.js.map +1 -1
- package/build/src/publisher/flow-control.d.ts +90 -0
- package/build/src/publisher/flow-control.js +145 -0
- package/build/src/publisher/flow-control.js.map +1 -0
- package/build/src/publisher/flow-publisher.d.ts +95 -0
- package/build/src/publisher/flow-publisher.js +133 -0
- package/build/src/publisher/flow-publisher.js.map +1 -0
- package/build/src/publisher/index.d.ts +33 -5
- package/build/src/publisher/index.js +16 -39
- package/build/src/publisher/index.js.map +1 -1
- package/build/src/publisher/message-batch.d.ts +1 -1
- package/build/src/publisher/message-batch.js +4 -3
- package/build/src/publisher/message-batch.js.map +1 -1
- package/build/src/publisher/message-queues.js.map +1 -1
- package/build/src/publisher/pubsub-message.d.ts +52 -0
- package/build/src/publisher/pubsub-message.js +56 -0
- package/build/src/publisher/pubsub-message.js.map +1 -0
- package/build/src/pubsub.d.ts +354 -4
- package/build/src/pubsub.js +28 -322
- package/build/src/pubsub.js.map +1 -1
- package/build/src/schema.d.ts +9 -4
- package/build/src/schema.js +9 -4
- package/build/src/schema.js.map +1 -1
- package/build/src/snapshot.d.ts +87 -0
- package/build/src/snapshot.js +7 -83
- package/build/src/snapshot.js.map +1 -1
- package/build/src/subscriber.d.ts +6 -0
- package/build/src/subscriber.js +6 -0
- package/build/src/subscriber.js.map +1 -1
- package/build/src/subscription.d.ts +439 -9
- package/build/src/subscription.js +38 -404
- package/build/src/subscription.js.map +1 -1
- package/build/src/topic.d.ts +481 -1
- package/build/src/topic.js +51 -430
- package/build/src/topic.js.map +1 -1
- package/build/src/util.d.ts +2 -1
- package/build/src/util.js +2 -2
- package/build/src/util.js.map +1 -1
- package/build/src/v1/publisher_client.d.ts +262 -0
- package/build/src/v1/publisher_client.js +11 -244
- package/build/src/v1/publisher_client.js.map +1 -1
- package/build/src/v1/publisher_client_config.json +2 -2
- package/build/src/v1/schema_service_client.d.ts +165 -0
- package/build/src/v1/schema_service_client.js +7 -153
- package/build/src/v1/schema_service_client.js.map +1 -1
- package/build/src/v1/subscriber_client.d.ts +566 -0
- package/build/src/v1/subscriber_client.js +11 -534
- package/build/src/v1/subscriber_client.js.map +1 -1
- package/package.json +2 -2
package/build/src/iam.js
CHANGED
|
@@ -19,8 +19,8 @@ exports.IAM = void 0;
|
|
|
19
19
|
/*!
|
|
20
20
|
* @module pubsub/iam
|
|
21
21
|
*/
|
|
22
|
-
const promisify_1 = require("@google-cloud/promisify");
|
|
23
22
|
const arrify = require("arrify");
|
|
23
|
+
const util_1 = require("./util");
|
|
24
24
|
/**
|
|
25
25
|
* [IAM (Identity and Access
|
|
26
26
|
* Management)](https://cloud.google.com/pubsub/access_control) allows you to
|
|
@@ -50,6 +50,7 @@ const arrify = require("arrify");
|
|
|
50
50
|
* @see [What is Cloud IAM?]{@link https://cloud.google.com/iam/}
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
|
+
* ```
|
|
53
54
|
* const {PubSub} = require('@google-cloud/pubsub');
|
|
54
55
|
* const pubsub = new PubSub();
|
|
55
56
|
*
|
|
@@ -58,6 +59,7 @@ const arrify = require("arrify");
|
|
|
58
59
|
*
|
|
59
60
|
* const subscription = pubsub.subscription('my-subscription');
|
|
60
61
|
* // subscription.iam
|
|
62
|
+
* ```
|
|
61
63
|
*/
|
|
62
64
|
class IAM {
|
|
63
65
|
constructor(pubsub, id) {
|
|
@@ -65,45 +67,6 @@ class IAM {
|
|
|
65
67
|
this.request = pubsub.request.bind(pubsub);
|
|
66
68
|
this.id = id;
|
|
67
69
|
}
|
|
68
|
-
/**
|
|
69
|
-
* @typedef {array} GetPolicyResponse
|
|
70
|
-
* @property {object} 0 The policy.
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* @callback GetPolicyCallback
|
|
74
|
-
* @param {?Error} err Request error, if any.
|
|
75
|
-
* @param {object} acl The policy.
|
|
76
|
-
*/
|
|
77
|
-
/**
|
|
78
|
-
* Get the IAM policy
|
|
79
|
-
*
|
|
80
|
-
* @param {object} [gaxOptions] Request configuration options, outlined
|
|
81
|
-
* here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.
|
|
82
|
-
* @param {GetPolicyCallback} [callback] Callback function.
|
|
83
|
-
* @returns {Promise<GetPolicyResponse>}
|
|
84
|
-
*
|
|
85
|
-
* @see [Topics: getIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/getIamPolicy}
|
|
86
|
-
* @see [Subscriptions: getIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/getIamPolicy}
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* const {PubSub} = require('@google-cloud/pubsub');
|
|
90
|
-
* const pubsub = new PubSub();
|
|
91
|
-
*
|
|
92
|
-
* const topic = pubsub.topic('my-topic');
|
|
93
|
-
* const subscription = topic.subscription('my-subscription');
|
|
94
|
-
*
|
|
95
|
-
* topic.iam.getPolicy(function(err, policy, apiResponse) {});
|
|
96
|
-
*
|
|
97
|
-
* subscription.iam.getPolicy(function(err, policy, apiResponse) {});
|
|
98
|
-
*
|
|
99
|
-
* //-
|
|
100
|
-
* // If the callback is omitted, we'll return a Promise.
|
|
101
|
-
* //-
|
|
102
|
-
* topic.iam.getPolicy().then(function(data) {
|
|
103
|
-
* const policy = data[0];
|
|
104
|
-
* const apiResponse = data[1];
|
|
105
|
-
* });
|
|
106
|
-
*/
|
|
107
70
|
getPolicy(optsOrCallback, callback) {
|
|
108
71
|
const gaxOpts = typeof optsOrCallback === 'object' ? optsOrCallback : {};
|
|
109
72
|
callback = typeof optsOrCallback === 'function' ? optsOrCallback : callback;
|
|
@@ -117,63 +80,6 @@ class IAM {
|
|
|
117
80
|
gaxOpts,
|
|
118
81
|
}, callback);
|
|
119
82
|
}
|
|
120
|
-
/**
|
|
121
|
-
* @typedef {array} SetPolicyResponse
|
|
122
|
-
* @property {object} 0 The policy.
|
|
123
|
-
*/
|
|
124
|
-
/**
|
|
125
|
-
* @callback SetPolicyCallback
|
|
126
|
-
* @param {?Error} err Request error, if any.
|
|
127
|
-
* @param {object} acl The policy.
|
|
128
|
-
*/
|
|
129
|
-
/**
|
|
130
|
-
* Set the IAM policy
|
|
131
|
-
*
|
|
132
|
-
* @throws {Error} If no policy is provided.
|
|
133
|
-
*
|
|
134
|
-
* @param {object} policy The [policy](https://cloud.google.com/pubsub/docs/reference/rest/v1/Policy).
|
|
135
|
-
* @param {array} [policy.bindings] Bindings associate members with roles.
|
|
136
|
-
* @param {Array<object>} [policy.rules] Rules to be applied to the policy.
|
|
137
|
-
* @param {string} [policy.etag] Etags are used to perform a read-modify-write.
|
|
138
|
-
* @param {object} [gaxOptions] Request configuration options, outlined
|
|
139
|
-
* here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.
|
|
140
|
-
* @param {SetPolicyCallback} callback Callback function.
|
|
141
|
-
* @returns {Promise<SetPolicyResponse>}
|
|
142
|
-
*
|
|
143
|
-
* @see [Topics: setIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/setIamPolicy}
|
|
144
|
-
* @see [Subscriptions: setIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/setIamPolicy}
|
|
145
|
-
* @see [Policy]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/Policy}
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* const {PubSub} = require('@google-cloud/pubsub');
|
|
149
|
-
* const pubsub = new PubSub();
|
|
150
|
-
*
|
|
151
|
-
* const topic = pubsub.topic('my-topic');
|
|
152
|
-
* const subscription = topic.subscription('my-subscription');
|
|
153
|
-
*
|
|
154
|
-
* const myPolicy = {
|
|
155
|
-
* bindings: [
|
|
156
|
-
* {
|
|
157
|
-
* role: 'roles/pubsub.subscriber',
|
|
158
|
-
* members:
|
|
159
|
-
* ['serviceAccount:myotherproject@appspot.gserviceaccount.com']
|
|
160
|
-
* }
|
|
161
|
-
* ]
|
|
162
|
-
* };
|
|
163
|
-
*
|
|
164
|
-
* topic.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});
|
|
165
|
-
*
|
|
166
|
-
* subscription.iam.setPolicy(myPolicy, function(err, policy, apiResponse)
|
|
167
|
-
* {});
|
|
168
|
-
*
|
|
169
|
-
* //-
|
|
170
|
-
* // If the callback is omitted, we'll return a Promise.
|
|
171
|
-
* //-
|
|
172
|
-
* topic.iam.setPolicy(myPolicy).then(function(data) {
|
|
173
|
-
* const policy = data[0];
|
|
174
|
-
* const apiResponse = data[1];
|
|
175
|
-
* });
|
|
176
|
-
*/
|
|
177
83
|
setPolicy(policy, optsOrCallback, callback) {
|
|
178
84
|
if (!(typeof policy === 'object')) {
|
|
179
85
|
throw new Error('A policy object is required.');
|
|
@@ -191,82 +97,6 @@ class IAM {
|
|
|
191
97
|
gaxOpts,
|
|
192
98
|
}, callback);
|
|
193
99
|
}
|
|
194
|
-
/**
|
|
195
|
-
* @callback TestIamPermissionsCallback
|
|
196
|
-
* @param {?Error} err Request error, if any.
|
|
197
|
-
* @param {TestIamPermissionsAPIResponse} permissions A subset of permissions that the caller is allowed.
|
|
198
|
-
* @param {PermissionsResponse} apiResponse The full API response.
|
|
199
|
-
*/
|
|
200
|
-
/**
|
|
201
|
-
* @typedef {array} TestIamPermissionsResponse
|
|
202
|
-
* @property {object[]} 0 A subset of permissions that the caller is allowed.
|
|
203
|
-
* @property {PermissionsResponse} 1 The full API response.
|
|
204
|
-
*/
|
|
205
|
-
/**
|
|
206
|
-
* @typedef {string[]} PermissionsResponse
|
|
207
|
-
* A subset of TestPermissionsRequest.permissions that the caller is allowed.
|
|
208
|
-
* @see https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#google.iam.v1.TestIamPermissionsRequest
|
|
209
|
-
*/
|
|
210
|
-
/**
|
|
211
|
-
* Test a set of permissions for a resource.
|
|
212
|
-
*
|
|
213
|
-
* Permissions with wildcards such as `*` or `storage.*` are not allowed.
|
|
214
|
-
*
|
|
215
|
-
* @throws {Error} If permissions are not provided.
|
|
216
|
-
*
|
|
217
|
-
* @param {string|string[]} permissions The permission(s) to test for.
|
|
218
|
-
* @param {object} [gaxOptions] Request configuration options, outlined
|
|
219
|
-
* here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.
|
|
220
|
-
* @param {TestIamPermissionsCallback} [callback] Callback function.
|
|
221
|
-
* @returns {Promise<TestIamPermissionsResponse>}
|
|
222
|
-
*
|
|
223
|
-
* @see [Topics: testIamPermissions API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/testIamPermissions}
|
|
224
|
-
* @see [Subscriptions: testIamPermissions API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/testIamPermissions}
|
|
225
|
-
* @see [Permissions Reference]{@link https://cloud.google.com/pubsub/access_control#permissions}
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* const {PubSub} = require('@google-cloud/pubsub');
|
|
229
|
-
* const pubsub = new PubSub();
|
|
230
|
-
*
|
|
231
|
-
* const topic = pubsub.topic('my-topic');
|
|
232
|
-
* const subscription = topic.subscription('my-subscription');
|
|
233
|
-
*
|
|
234
|
-
* //-
|
|
235
|
-
* // Test a single permission.
|
|
236
|
-
* //-
|
|
237
|
-
* const test = 'pubsub.topics.update';
|
|
238
|
-
*
|
|
239
|
-
* topic.iam.testPermissions(test, function(err, permissions, apiResponse) {
|
|
240
|
-
* console.log(permissions);
|
|
241
|
-
* // {
|
|
242
|
-
* // "pubsub.topics.update": true
|
|
243
|
-
* // }
|
|
244
|
-
* });
|
|
245
|
-
*
|
|
246
|
-
* //-
|
|
247
|
-
* // Test several permissions at once.
|
|
248
|
-
* //-
|
|
249
|
-
* const tests = [
|
|
250
|
-
* 'pubsub.subscriptions.consume',
|
|
251
|
-
* 'pubsub.subscriptions.update'
|
|
252
|
-
* ];
|
|
253
|
-
*
|
|
254
|
-
* subscription.iam.testPermissions(tests, function(err, permissions) {
|
|
255
|
-
* console.log(permissions);
|
|
256
|
-
* // {
|
|
257
|
-
* // "pubsub.subscriptions.consume": true,
|
|
258
|
-
* // "pubsub.subscriptions.update": false
|
|
259
|
-
* // }
|
|
260
|
-
* });
|
|
261
|
-
*
|
|
262
|
-
* //-
|
|
263
|
-
* // If the callback is omitted, we'll return a Promise.
|
|
264
|
-
* //-
|
|
265
|
-
* topic.iam.testPermissions(test).then(function(data) {
|
|
266
|
-
* const permissions = data[0];
|
|
267
|
-
* const apiResponse = data[1];
|
|
268
|
-
* });
|
|
269
|
-
*/
|
|
270
100
|
testPermissions(permissions, optsOrCallback, callback) {
|
|
271
101
|
if (!Array.isArray(permissions) && !(typeof permissions === 'string')) {
|
|
272
102
|
throw new Error('Permissions are required.');
|
|
@@ -299,8 +129,13 @@ class IAM {
|
|
|
299
129
|
exports.IAM = IAM;
|
|
300
130
|
/*! Developer Documentation
|
|
301
131
|
*
|
|
302
|
-
*
|
|
303
|
-
* that a callback is omitted.
|
|
132
|
+
* Existing async methods (except for streams) will return a Promise in the event
|
|
133
|
+
* that a callback is omitted. Future methods will not allow for a callback.
|
|
134
|
+
* (Use .then() on the returned Promise instead.)
|
|
304
135
|
*/
|
|
305
|
-
|
|
136
|
+
util_1.promisifySome(IAM, IAM.prototype, [
|
|
137
|
+
'getPolicy',
|
|
138
|
+
'setPolicy',
|
|
139
|
+
'testPermissions',
|
|
140
|
+
]);
|
|
306
141
|
//# sourceMappingURL=iam.js.map
|
package/build/src/iam.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iam.js","sourceRoot":"","sources":["../../src/iam.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,
|
|
1
|
+
{"version":3,"file":"iam.js","sourceRoot":"","sources":["../../src/iam.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,iCAAkC;AAMlC,iCAAqC;AA8BrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,GAAG;IAKd,YAAY,MAAc,EAAE,EAAU;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IA8CD,SAAS,CACP,cAAgD,EAChD,QAA4B;QAE5B,MAAM,OAAO,GAAG,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,QAAQ,GAAG,OAAO,cAAc,KAAK,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE5E,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,IAAI,CAAC,EAAE;SAClB,CAAC;QAEF,IAAI,CAAC,OAAO,CACV;YACE,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE,cAAc;YACtB,OAAO;YACP,OAAO;SACR,EACD,QAAS,CACV,CAAC;IACJ,CAAC;IAoED,SAAS,CACP,MAAc,EACd,cAAgD,EAChD,QAA4B;QAE5B,IAAI,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,EAAE;YACjC,MAAM,IAA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,CAAC;gBAC5B,OAAO;aACR;YAED,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAK,CAAC,WAAY,CAAC,CAAC;YACxD,MAAM,cAAc,GAClB,WACD,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;gBAC3B,GAAG,CAAC,UAAU,CAAC,GAAG,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChE,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAA8B,CAAC,CAAC;YACnC,QAAS,CAAC,IAAI,EAAE,cAAc,EAAE,IAAK,CAAC,CAAC;QACzC,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA/SD,kBA+SC;AAED;;;;;GAKG;AACH,oBAAa,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE;IAChC,WAAW;IACX,WAAW;IACX,iBAAiB;CAClB,CAAC,CAAC"}
|
package/build/src/index.d.ts
CHANGED
|
@@ -29,21 +29,29 @@
|
|
|
29
29
|
* @module {PubSub} @google-cloud/pubsub
|
|
30
30
|
* @alias nodejs-pubsub
|
|
31
31
|
*
|
|
32
|
-
* @example
|
|
32
|
+
* @example Install the client library with <a href="https://www.npmjs.com/">npm</a>:
|
|
33
|
+
* ```
|
|
33
34
|
* npm install @google-cloud/pubsub
|
|
34
35
|
*
|
|
35
|
-
*
|
|
36
|
+
* ```
|
|
37
|
+
* @example Import the client library
|
|
38
|
+
* ```
|
|
36
39
|
* const {PubSub} = require('@google-cloud/pubsub');
|
|
37
40
|
*
|
|
38
|
-
*
|
|
41
|
+
* ```
|
|
42
|
+
* @example Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:
|
|
43
|
+
* ```
|
|
39
44
|
* const pubsub = new PubSub();
|
|
40
45
|
*
|
|
41
|
-
*
|
|
46
|
+
* ```
|
|
47
|
+
* @example Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:
|
|
48
|
+
* ```
|
|
42
49
|
* const pubsub = new PubSub({
|
|
43
50
|
* projectId: 'your-project-id',
|
|
44
51
|
* keyFilename: '/path/to/keyfile.json'
|
|
45
52
|
* });
|
|
46
53
|
*
|
|
54
|
+
* ```
|
|
47
55
|
* @example <caption>include:samples/quickstart.js</caption>
|
|
48
56
|
* region_tag:pubsub_quickstart_create_topic
|
|
49
57
|
* Full quickstart example:
|
|
@@ -79,6 +87,7 @@ export { Policy, GetPolicyCallback, SetPolicyCallback, SetPolicyResponse, GetPol
|
|
|
79
87
|
export { Attributes, PublishCallback, PublishOptions } from './publisher';
|
|
80
88
|
export { BatchPublishOptions } from './publisher/message-batch';
|
|
81
89
|
export { PublishError } from './publisher/publish-error';
|
|
90
|
+
export { FlowControlOptions } from './publisher/flow-control';
|
|
82
91
|
export { PageOptions, GetSnapshotsCallback, GetSnapshotsResponse, GetSubscriptionsCallback, GetSubscriptionsResponse, GetTopicsCallback, GetTopicsResponse, EmptyCallback, EmptyResponse, ExistsCallback, ExistsResponse, PubSub, ClientConfig, } from './pubsub';
|
|
83
92
|
export { CreateSnapshotCallback, CreateSnapshotResponse, SeekCallback, SeekResponse, Snapshot, } from './snapshot';
|
|
84
93
|
export { Message, SubscriberOptions } from './subscriber';
|
package/build/src/index.js
CHANGED
|
@@ -32,21 +32,29 @@ exports.protos = exports.v1 = void 0;
|
|
|
32
32
|
* @module {PubSub} @google-cloud/pubsub
|
|
33
33
|
* @alias nodejs-pubsub
|
|
34
34
|
*
|
|
35
|
-
* @example
|
|
35
|
+
* @example Install the client library with <a href="https://www.npmjs.com/">npm</a>:
|
|
36
|
+
* ```
|
|
36
37
|
* npm install @google-cloud/pubsub
|
|
37
38
|
*
|
|
38
|
-
*
|
|
39
|
+
* ```
|
|
40
|
+
* @example Import the client library
|
|
41
|
+
* ```
|
|
39
42
|
* const {PubSub} = require('@google-cloud/pubsub');
|
|
40
43
|
*
|
|
41
|
-
*
|
|
44
|
+
* ```
|
|
45
|
+
* @example Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:
|
|
46
|
+
* ```
|
|
42
47
|
* const pubsub = new PubSub();
|
|
43
48
|
*
|
|
44
|
-
*
|
|
49
|
+
* ```
|
|
50
|
+
* @example Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:
|
|
51
|
+
* ```
|
|
45
52
|
* const pubsub = new PubSub({
|
|
46
53
|
* projectId: 'your-project-id',
|
|
47
54
|
* keyFilename: '/path/to/keyfile.json'
|
|
48
55
|
* });
|
|
49
56
|
*
|
|
57
|
+
* ```
|
|
50
58
|
* @example <caption>include:samples/quickstart.js</caption>
|
|
51
59
|
* region_tag:pubsub_quickstart_create_topic
|
|
52
60
|
* Full quickstart example:
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;GAWG;AACH,2BAA2B;AACnB,gBAAE;AAEV,6BAUe;AADb,0FAAA,GAAG,OAAA;AAIL,2DAAuD;AAA/C,6GAAA,YAAY,OAAA;AAEpB,mCAckB;AAFhB,gGAAA,MAAM,OAAA;AAGR,uCAMoB;AADlB,oGAAA,QAAQ,OAAA;AAEV,2CAAwD;AAAhD,qGAAA,OAAO,OAAA;AACf,mCAYkB;AAXhB,gGAAA,MAAM,OAAA;AAIN,qGAAA,WAAW,OAAA;AAIX,qGAAA,WAAW,OAAA;AACX,mGAAA,SAAS,OAAA;AAGX,+CAgBwB;AADtB,4GAAA,YAAY,OAAA;AAEd,iCAciB;AAFf,8FAAA,KAAK,OAAA;AAIP,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;IAC1B,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACxB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;CAC/C;AACD,2CAA2C;AACnC,wBAAM"}
|
|
@@ -19,8 +19,10 @@ import { Message, Subscriber } from './subscriber';
|
|
|
19
19
|
export interface FlowControlOptions {
|
|
20
20
|
allowExcessMessages?: boolean;
|
|
21
21
|
maxBytes?: number;
|
|
22
|
-
maxExtension?: number;
|
|
23
22
|
maxMessages?: number;
|
|
23
|
+
maxExtensionMinutes?: number;
|
|
24
|
+
/** @deprecated Use maxExtensionMinutes. */
|
|
25
|
+
maxExtension?: number;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* @typedef {object} FlowControlOptions
|
|
@@ -33,7 +35,7 @@ export interface FlowControlOptions {
|
|
|
33
35
|
* @property {number} [maxBytes=104857600] The desired amount of memory to
|
|
34
36
|
* allow message data to consume. (Default: 100MB) It's possible that this
|
|
35
37
|
* value will be exceeded, since messages are received in batches.
|
|
36
|
-
* @property {number} [
|
|
38
|
+
* @property {number} [maxExtensionMinutes=60] The maximum duration (in minutes)
|
|
37
39
|
* to extend the message deadline before redelivering.
|
|
38
40
|
* @property {number} [maxMessages=1000] The desired number of messages to allow
|
|
39
41
|
* in memory before pausing the message stream. Unless allowExcessMessages
|
|
@@ -104,6 +106,9 @@ export declare class LeaseManager extends EventEmitter {
|
|
|
104
106
|
* Sets options for the LeaseManager.
|
|
105
107
|
*
|
|
106
108
|
* @param {FlowControlOptions} [options] The options.
|
|
109
|
+
*
|
|
110
|
+
* @throws {RangeError} If both maxExtension and maxExtensionMinutes are set.
|
|
111
|
+
*
|
|
107
112
|
* @private
|
|
108
113
|
*/
|
|
109
114
|
setOptions(options: FlowControlOptions): void;
|
|
@@ -29,7 +29,7 @@ const default_options_1 = require("./default-options");
|
|
|
29
29
|
* @property {number} [maxBytes=104857600] The desired amount of memory to
|
|
30
30
|
* allow message data to consume. (Default: 100MB) It's possible that this
|
|
31
31
|
* value will be exceeded, since messages are received in batches.
|
|
32
|
-
* @property {number} [
|
|
32
|
+
* @property {number} [maxExtensionMinutes=60] The maximum duration (in minutes)
|
|
33
33
|
* to extend the message deadline before redelivering.
|
|
34
34
|
* @property {number} [maxMessages=1000] The desired number of messages to allow
|
|
35
35
|
* in memory before pausing the message stream. Unless allowExcessMessages
|
|
@@ -155,13 +155,27 @@ class LeaseManager extends events_1.EventEmitter {
|
|
|
155
155
|
* Sets options for the LeaseManager.
|
|
156
156
|
*
|
|
157
157
|
* @param {FlowControlOptions} [options] The options.
|
|
158
|
+
*
|
|
159
|
+
* @throws {RangeError} If both maxExtension and maxExtensionMinutes are set.
|
|
160
|
+
*
|
|
158
161
|
* @private
|
|
159
162
|
*/
|
|
160
163
|
setOptions(options) {
|
|
164
|
+
// Convert the old deprecated maxExtension to avoid breaking clients,
|
|
165
|
+
// but allow only one.
|
|
166
|
+
if (options.maxExtension !== undefined &&
|
|
167
|
+
options.maxExtensionMinutes !== undefined) {
|
|
168
|
+
throw new RangeError('Only one of "maxExtension" or "maxExtensionMinutes" may be set for subscriber lease management options');
|
|
169
|
+
}
|
|
170
|
+
if (options.maxExtension !== undefined &&
|
|
171
|
+
options.maxExtensionMinutes === undefined) {
|
|
172
|
+
options.maxExtensionMinutes = options.maxExtension / 60;
|
|
173
|
+
delete options.maxExtension;
|
|
174
|
+
}
|
|
161
175
|
const defaults = {
|
|
162
176
|
allowExcessMessages: true,
|
|
163
177
|
maxBytes: default_options_1.defaultOptions.subscription.maxOutstandingBytes,
|
|
164
|
-
|
|
178
|
+
maxExtensionMinutes: default_options_1.defaultOptions.subscription.maxExtensionMinutes,
|
|
165
179
|
maxMessages: default_options_1.defaultOptions.subscription.maxOutstandingMessages,
|
|
166
180
|
};
|
|
167
181
|
this._options = Object.assign(defaults, options);
|
|
@@ -202,8 +216,9 @@ class LeaseManager extends events_1.EventEmitter {
|
|
|
202
216
|
_extendDeadlines() {
|
|
203
217
|
const deadline = this._subscriber.ackDeadline;
|
|
204
218
|
for (const message of this._messages) {
|
|
205
|
-
|
|
206
|
-
|
|
219
|
+
// Lifespan here is in minutes.
|
|
220
|
+
const lifespan = (Date.now() - message.received) / (60 * 1000);
|
|
221
|
+
if (lifespan < this._options.maxExtensionMinutes) {
|
|
207
222
|
message.modAck(deadline);
|
|
208
223
|
}
|
|
209
224
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-manager.js","sourceRoot":"","sources":["../../src/lease-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,mCAAoC;AAEpC,uDAAiD;
|
|
1
|
+
{"version":3,"file":"lease-manager.js","sourceRoot":"","sources":["../../src/lease-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,mCAAoC;AAEpC,uDAAiD;AAYjD;;;;;;;;;;;;;;;;;;GAkBG;AACH;;;;;;;;;GASG;AACH,MAAa,YAAa,SAAQ,qBAAY;IAQ5C,YAAY,GAAe,EAAE,OAAO,GAAG,EAAE;QACvC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG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* 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
|
+
* @typedef FlowControlOptions
|
|
18
|
+
* @property {number} [maxOutstandingMessages] The maximum number of messages to
|
|
19
|
+
* buffer before publisher flow control kicks in.
|
|
20
|
+
* @property {number} [maxOutstandingBytes] The maximum number of bytes to buffer
|
|
21
|
+
* before publisher flow control kicks in.
|
|
22
|
+
*/
|
|
23
|
+
export interface FlowControlOptions {
|
|
24
|
+
maxOutstandingMessages?: number;
|
|
25
|
+
maxOutstandingBytes?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Manages flow control handling for max bytes and messages.
|
|
29
|
+
*
|
|
30
|
+
* Do not use this class externally, it may change without warning.
|
|
31
|
+
* @private
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export declare class FlowControl {
|
|
35
|
+
options: FlowControlOptions;
|
|
36
|
+
private bytes;
|
|
37
|
+
private messages;
|
|
38
|
+
private requests;
|
|
39
|
+
constructor(options: FlowControlOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Update our options after the fact.
|
|
42
|
+
*
|
|
43
|
+
* Do not use externally, it may change without warning.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
setOptions(options: FlowControlOptions): void;
|
|
47
|
+
/**
|
|
48
|
+
* @returns {number} The number of bytes that are queued up.
|
|
49
|
+
*/
|
|
50
|
+
get currentByteCount(): number;
|
|
51
|
+
/**
|
|
52
|
+
* @returns {number} The number of messages that are queued up.
|
|
53
|
+
*/
|
|
54
|
+
get currentMessageCount(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Adds the specified number of bytes or messages to our count. We'll
|
|
57
|
+
* assume that this is end running around our queueing mechanisms.
|
|
58
|
+
*
|
|
59
|
+
* @param {number} bytes The number of bytes to add to the count.
|
|
60
|
+
* @param {number} messages The number of messages to add to the count.
|
|
61
|
+
*/
|
|
62
|
+
addToCount(bytes: number, messages: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Attempts to queue the specified number of bytes and messages. If
|
|
65
|
+
* there are too many things in the publisher flow control queue
|
|
66
|
+
* already, we will defer and come back to it.
|
|
67
|
+
*
|
|
68
|
+
* Do not use externally, it may change without warning.
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
willSend(bytes: number, messages: number): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Removes the specified number of bytes and messages from our queued
|
|
74
|
+
* counts, after a deferred request was released. If there is enough
|
|
75
|
+
* space.
|
|
76
|
+
*
|
|
77
|
+
* Do not use externally, it may change without warning.
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
sent(bytes: number, messages: number): void;
|
|
81
|
+
private exceeded;
|
|
82
|
+
/**
|
|
83
|
+
* Returns true if adding the specified number of bytes or messages
|
|
84
|
+
* would exceed limits imposed by configuration.
|
|
85
|
+
*
|
|
86
|
+
* Do not use externally, it may change without warning.
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
wouldExceed(bytes: number, messages: number): boolean;
|
|
90
|
+
}
|