@google-cloud/pubsub 2.18.1 → 2.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +5 -5
  3. package/build/protos/protos.d.ts +1 -1
  4. package/build/protos/protos.js +1 -1
  5. package/build/src/iam.d.ts +180 -0
  6. package/build/src/iam.js +2 -172
  7. package/build/src/iam.js.map +1 -1
  8. package/build/src/index.d.ts +12 -4
  9. package/build/src/index.js +12 -4
  10. package/build/src/index.js.map +1 -1
  11. package/build/src/message-stream.d.ts +0 -7
  12. package/build/src/message-stream.js +6 -17
  13. package/build/src/message-stream.js.map +1 -1
  14. package/build/src/publisher/flow-publisher.d.ts +6 -0
  15. package/build/src/publisher/flow-publisher.js +6 -0
  16. package/build/src/publisher/flow-publisher.js.map +1 -1
  17. package/build/src/publisher/index.d.ts +35 -0
  18. package/build/src/publisher/index.js +0 -35
  19. package/build/src/publisher/index.js.map +1 -1
  20. package/build/src/pubsub.d.ts +354 -4
  21. package/build/src/pubsub.js +28 -322
  22. package/build/src/pubsub.js.map +1 -1
  23. package/build/src/schema.d.ts +9 -4
  24. package/build/src/schema.js +9 -4
  25. package/build/src/schema.js.map +1 -1
  26. package/build/src/snapshot.d.ts +87 -0
  27. package/build/src/snapshot.js +2 -79
  28. package/build/src/snapshot.js.map +1 -1
  29. package/build/src/subscriber.d.ts +6 -0
  30. package/build/src/subscriber.js +6 -0
  31. package/build/src/subscriber.js.map +1 -1
  32. package/build/src/subscription.d.ts +439 -9
  33. package/build/src/subscription.js +24 -400
  34. package/build/src/subscription.js.map +1 -1
  35. package/build/src/topic.d.ts +467 -2
  36. package/build/src/topic.js +17 -417
  37. package/build/src/topic.js.map +1 -1
  38. package/build/src/v1/index.js +1 -1
  39. package/build/src/v1/publisher_client.d.ts +246 -15
  40. package/build/src/v1/publisher_client.js +19 -265
  41. package/build/src/v1/publisher_client.js.map +1 -1
  42. package/build/src/v1/publisher_client_config.json +2 -2
  43. package/build/src/v1/schema_service_client.d.ts +151 -5
  44. package/build/src/v1/schema_service_client.js +7 -158
  45. package/build/src/v1/schema_service_client.js.map +1 -1
  46. package/build/src/v1/subscriber_client.d.ts +536 -16
  47. package/build/src/v1/subscriber_client.js +15 -553
  48. package/build/src/v1/subscriber_client.js.map +1 -1
  49. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -4,6 +4,38 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/@google-cloud/pubsub?activeTab=versions
6
6
 
7
+ ### [2.18.5](https://github.com/googleapis/nodejs-pubsub/compare/v2.18.4...v2.18.5) (2022-01-21)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **deps:** update dependency @opentelemetry/semantic-conventions to v1 ([#1407](https://github.com/googleapis/nodejs-pubsub/issues/1407)) ([740d78c](https://github.com/googleapis/nodejs-pubsub/commit/740d78cb285a136a39d7324c9f0e2e0d7fc1f06d))
13
+ * **deps:** update dependency google-gax to v2.29.0 ([#1452](https://github.com/googleapis/nodejs-pubsub/issues/1452)) ([f419137](https://github.com/googleapis/nodejs-pubsub/commit/f4191372eabc134454db7d24cb38a29597b153dd))
14
+ * **deps:** update dependency google-gax to v2.29.4 ([#1469](https://github.com/googleapis/nodejs-pubsub/issues/1469)) ([8abbfa7](https://github.com/googleapis/nodejs-pubsub/commit/8abbfa77ce9c6e6decbd79c29bcaad8e5e3e1ed6))
15
+ * update to work with latest node types (changed the return type of Stream.destroy()) ([#1464](https://github.com/googleapis/nodejs-pubsub/issues/1464)) ([fddc2e7](https://github.com/googleapis/nodejs-pubsub/commit/fddc2e77ed54c1762afb533965da2e0658b58de6))
16
+
17
+ ### [2.18.4](https://www.github.com/googleapis/nodejs-pubsub/compare/v2.18.3...v2.18.4) (2021-12-09)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **deps:** update dependency google-gax to v2.28.1 ([#1432](https://www.github.com/googleapis/nodejs-pubsub/issues/1432)) ([98840fc](https://www.github.com/googleapis/nodejs-pubsub/commit/98840fcc38a05be07de6e7dc97d8a79616940df9))
23
+
24
+ ### [2.18.3](https://www.github.com/googleapis/nodejs-pubsub/compare/v2.18.2...v2.18.3) (2021-11-18)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * set only Publish to 5000ms ([#1416](https://www.github.com/googleapis/nodejs-pubsub/issues/1416)) ([1e11001](https://www.github.com/googleapis/nodejs-pubsub/commit/1e110016ea04fc41d2fa80d64a54a11fd4078c60))
30
+ * temporary hold-back on google-gax to avoid timeout issues caused by https://github.com/googleapis/gax-nodejs/pull/1100 ([#1431](https://www.github.com/googleapis/nodejs-pubsub/issues/1431)) ([18c6b18](https://www.github.com/googleapis/nodejs-pubsub/commit/18c6b18f621c410aca968a6bfc850e7a6ea404f4))
31
+
32
+ ### [2.18.2](https://www.github.com/googleapis/nodejs-pubsub/compare/v2.18.1...v2.18.2) (2021-11-08)
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **cloud-rad:** move comments for TSDoc ([#1423](https://www.github.com/googleapis/nodejs-pubsub/issues/1423)) ([a40a23e](https://www.github.com/googleapis/nodejs-pubsub/commit/a40a23ee43c6697000996e0ff7070f41610397f5))
38
+
7
39
  ### [2.18.1](https://www.github.com/googleapis/nodejs-pubsub/compare/v2.18.0...v2.18.1) (2021-09-27)
8
40
 
9
41
 
package/README.md CHANGED
@@ -4,9 +4,8 @@
4
4
 
5
5
  # [Google Cloud Pub/Sub: Node.js Client](https://github.com/googleapis/nodejs-pubsub)
6
6
 
7
- [![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
7
+ [![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
8
8
  [![npm version](https://img.shields.io/npm/v/@google-cloud/pubsub.svg)](https://www.npmjs.org/package/@google-cloud/pubsub)
9
- [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-pubsub/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-pubsub)
10
9
 
11
10
 
12
11
 
@@ -203,16 +202,17 @@ _Legacy Node.js versions are supported as a best effort:_
203
202
  This library follows [Semantic Versioning](http://semver.org/).
204
203
 
205
204
 
206
- This library is considered to be **General Availability (GA)**. This means it
207
- is stable; the code surface will not change in backwards-incompatible ways
205
+
206
+ This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways
208
207
  unless absolutely necessary (e.g. because of critical security issues) or with
209
- an extensive deprecation period. Issues and requests against **GA** libraries
208
+ an extensive deprecation period. Issues and requests against **stable** libraries
210
209
  are addressed with the highest priority.
211
210
 
212
211
 
213
212
 
214
213
 
215
214
 
215
+
216
216
  More Information: [Google Cloud Platform Launch Stages][launch_stages]
217
217
 
218
218
  [launch_stages]: https://cloud.google.com/terms/launch-stages
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -62,6 +62,7 @@ export declare type TestIamPermissionsCallback = ResourceCallback<IamPermissions
62
62
  * @see [What is Cloud IAM?]{@link https://cloud.google.com/iam/}
63
63
  *
64
64
  * @example
65
+ * ```
65
66
  * const {PubSub} = require('@google-cloud/pubsub');
66
67
  * const pubsub = new PubSub();
67
68
  *
@@ -70,18 +71,197 @@ export declare type TestIamPermissionsCallback = ResourceCallback<IamPermissions
70
71
  *
71
72
  * const subscription = pubsub.subscription('my-subscription');
72
73
  * // subscription.iam
74
+ * ```
73
75
  */
74
76
  export declare class IAM {
75
77
  pubsub: PubSub;
76
78
  request: typeof PubSub.prototype.request;
77
79
  id: string;
78
80
  constructor(pubsub: PubSub, id: string);
81
+ /**
82
+ * @typedef {array} GetPolicyResponse
83
+ * @property {object} 0 The policy.
84
+ */
85
+ /**
86
+ * @callback GetPolicyCallback
87
+ * @param {?Error} err Request error, if any.
88
+ * @param {object} acl The policy.
89
+ */
90
+ /**
91
+ * Get the IAM policy
92
+ *
93
+ * @param {object} [gaxOptions] Request configuration options, outlined
94
+ * here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.
95
+ * @param {GetPolicyCallback} [callback] Callback function.
96
+ * @returns {Promise<GetPolicyResponse>}
97
+ *
98
+ * @see [Topics: getIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/getIamPolicy}
99
+ * @see [Subscriptions: getIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/getIamPolicy}
100
+ *
101
+ * @example
102
+ * ```
103
+ * const {PubSub} = require('@google-cloud/pubsub');
104
+ * const pubsub = new PubSub();
105
+ *
106
+ * const topic = pubsub.topic('my-topic');
107
+ * const subscription = topic.subscription('my-subscription');
108
+ *
109
+ * topic.iam.getPolicy(function(err, policy, apiResponse) {});
110
+ *
111
+ * subscription.iam.getPolicy(function(err, policy, apiResponse) {});
112
+ *
113
+ * //-
114
+ * // If the callback is omitted, we'll return a Promise.
115
+ * //-
116
+ * topic.iam.getPolicy().then(function(data) {
117
+ * const policy = data[0];
118
+ * const apiResponse = data[1];
119
+ * });
120
+ * ```
121
+ */
79
122
  getPolicy(gaxOpts?: CallOptions): Promise<GetPolicyResponse>;
80
123
  getPolicy(callback: GetPolicyCallback): void;
81
124
  getPolicy(gaxOpts: CallOptions, callback: GetPolicyCallback): void;
125
+ /**
126
+ * @typedef {array} SetPolicyResponse
127
+ * @property {object} 0 The policy.
128
+ */
129
+ /**
130
+ * @callback SetPolicyCallback
131
+ * @param {?Error} err Request error, if any.
132
+ * @param {object} acl The policy.
133
+ */
134
+ /**
135
+ * Set the IAM policy
136
+ *
137
+ * @throws {Error} If no policy is provided.
138
+ *
139
+ * @param {object} policy The [policy](https://cloud.google.com/pubsub/docs/reference/rest/v1/Policy).
140
+ * @param {array} [policy.bindings] Bindings associate members with roles.
141
+ * @param {Array<object>} [policy.rules] Rules to be applied to the policy.
142
+ * @param {string} [policy.etag] Etags are used to perform a read-modify-write.
143
+ * @param {object} [gaxOptions] Request configuration options, outlined
144
+ * here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.
145
+ * @param {SetPolicyCallback} callback Callback function.
146
+ * @returns {Promise<SetPolicyResponse>}
147
+ *
148
+ * @see [Topics: setIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/setIamPolicy}
149
+ * @see [Subscriptions: setIamPolicy API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/setIamPolicy}
150
+ * @see [Policy]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/Policy}
151
+ *
152
+ * @example
153
+ * ```
154
+ * const {PubSub} = require('@google-cloud/pubsub');
155
+ * const pubsub = new PubSub();
156
+ *
157
+ * const topic = pubsub.topic('my-topic');
158
+ * const subscription = topic.subscription('my-subscription');
159
+ *
160
+ * const myPolicy = {
161
+ * bindings: [
162
+ * {
163
+ * role: 'roles/pubsub.subscriber',
164
+ * members:
165
+ * ['serviceAccount:myotherproject@appspot.gserviceaccount.com']
166
+ * }
167
+ * ]
168
+ * };
169
+ *
170
+ * topic.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});
171
+ *
172
+ * subscription.iam.setPolicy(myPolicy, function(err, policy, apiResponse)
173
+ * {});
174
+ *
175
+ * //-
176
+ * // If the callback is omitted, we'll return a Promise.
177
+ * //-
178
+ * topic.iam.setPolicy(myPolicy).then(function(data) {
179
+ * const policy = data[0];
180
+ * const apiResponse = data[1];
181
+ * });
182
+ * ```
183
+ */
82
184
  setPolicy(policy: Policy, gaxOpts?: CallOptions): Promise<SetPolicyResponse>;
83
185
  setPolicy(policy: Policy, gaxOpts: CallOptions, callback: SetPolicyCallback): void;
84
186
  setPolicy(policy: Policy, callback: SetPolicyCallback): void;
187
+ /**
188
+ * @callback TestIamPermissionsCallback
189
+ * @param {?Error} err Request error, if any.
190
+ * @param {TestIamPermissionsAPIResponse} permissions A subset of permissions that the caller is allowed.
191
+ * @param {PermissionsResponse} apiResponse The full API response.
192
+ */
193
+ /**
194
+ * @typedef {array} TestIamPermissionsResponse
195
+ * @property {object[]} 0 A subset of permissions that the caller is allowed.
196
+ * @property {PermissionsResponse} 1 The full API response.
197
+ */
198
+ /**
199
+ * @typedef {string[]} PermissionsResponse
200
+ * A subset of TestPermissionsRequest.permissions that the caller is allowed.
201
+ * @see https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#google.iam.v1.TestIamPermissionsRequest
202
+ */
203
+ /**
204
+ * Test a set of permissions for a resource.
205
+ *
206
+ * Permissions with wildcards such as `*` or `storage.*` are not allowed.
207
+ *
208
+ * @throws {Error} If permissions are not provided.
209
+ *
210
+ * @param {string|string[]} permissions The permission(s) to test for.
211
+ * @param {object} [gaxOptions] Request configuration options, outlined
212
+ * here: https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html.
213
+ * @param {TestIamPermissionsCallback} [callback] Callback function.
214
+ * @returns {Promise<TestIamPermissionsResponse>}
215
+ *
216
+ * @see [Topics: testIamPermissions API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/testIamPermissions}
217
+ * @see [Subscriptions: testIamPermissions API Documentation]{@link https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/testIamPermissions}
218
+ * @see [Permissions Reference]{@link https://cloud.google.com/pubsub/access_control#permissions}
219
+ *
220
+ * @example
221
+ * ```
222
+ * const {PubSub} = require('@google-cloud/pubsub');
223
+ * const pubsub = new PubSub();
224
+ *
225
+ * const topic = pubsub.topic('my-topic');
226
+ * const subscription = topic.subscription('my-subscription');
227
+ *
228
+ * //-
229
+ * // Test a single permission.
230
+ * //-
231
+ * const test = 'pubsub.topics.update';
232
+ *
233
+ * topic.iam.testPermissions(test, function(err, permissions, apiResponse) {
234
+ * console.log(permissions);
235
+ * // {
236
+ * // "pubsub.topics.update": true
237
+ * // }
238
+ * });
239
+ *
240
+ * //-
241
+ * // Test several permissions at once.
242
+ * //-
243
+ * const tests = [
244
+ * 'pubsub.subscriptions.consume',
245
+ * 'pubsub.subscriptions.update'
246
+ * ];
247
+ *
248
+ * subscription.iam.testPermissions(tests, function(err, permissions) {
249
+ * console.log(permissions);
250
+ * // {
251
+ * // "pubsub.subscriptions.consume": true,
252
+ * // "pubsub.subscriptions.update": false
253
+ * // }
254
+ * });
255
+ *
256
+ * //-
257
+ * // If the callback is omitted, we'll return a Promise.
258
+ * //-
259
+ * topic.iam.testPermissions(test).then(function(data) {
260
+ * const permissions = data[0];
261
+ * const apiResponse = data[1];
262
+ * });
263
+ * ```
264
+ */
85
265
  testPermissions(permissions: string | string[], gaxOpts?: CallOptions): Promise<TestIamPermissionsResponse>;
86
266
  testPermissions(permissions: string | string[], gaxOpts: CallOptions, callback: TestIamPermissionsCallback): void;
87
267
  testPermissions(permissions: string | string[], callback: TestIamPermissionsCallback): void;
package/build/src/iam.js CHANGED
@@ -50,6 +50,7 @@ const util_1 = require("./util");
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 util_1 = require("./util");
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.');
@@ -1 +1 @@
1
- {"version":3,"file":"iam.js","sourceRoot":"","sources":["../../src/iam.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,iCAAkC;AAMlC,iCAAqC;AA8BrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;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;IAKD;;;OAGG;IACH;;;;OAIG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,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,kBAA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AA/SD,kBA+SC;AAED;;;;;GAKG;AACH,oBAAa,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE;IAChC,WAAW;IACX,WAAW;IACX,iBAAiB;CAClB,CAAC,CAAC"}
@@ -29,21 +29,29 @@
29
29
  * @module {PubSub} @google-cloud/pubsub
30
30
  * @alias nodejs-pubsub
31
31
  *
32
- * @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
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
- * @example <caption>Import the client library</caption>
36
+ * ```
37
+ * @example Import the client library
38
+ * ```
36
39
  * const {PubSub} = require('@google-cloud/pubsub');
37
40
  *
38
- * @example <caption>Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:</caption>
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
- * @example <caption>Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:</caption>
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:
@@ -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 <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
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
- * @example <caption>Import the client library</caption>
39
+ * ```
40
+ * @example Import the client library
41
+ * ```
39
42
  * const {PubSub} = require('@google-cloud/pubsub');
40
43
  *
41
- * @example <caption>Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:</caption>
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
- * @example <caption>Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:</caption>
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:
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;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,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C,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"}
@@ -74,13 +74,6 @@ export declare class MessageStream extends PassThrough {
74
74
  private _streams;
75
75
  private _subscriber;
76
76
  constructor(sub: Subscriber, options?: MessageStreamOptions);
77
- /**
78
- * Destroys the stream and any underlying streams.
79
- *
80
- * @param {error?} error An error to emit, if any.
81
- * @private
82
- */
83
- destroy(error?: Error | null): void;
84
77
  /**
85
78
  * Destroys the stream and any underlying streams.
86
79
  *
@@ -102,19 +102,6 @@ class MessageStream extends stream_1.PassThrough {
102
102
  this._keepAliveHandle = setInterval(() => this._keepAlive(), KEEP_ALIVE_INTERVAL);
103
103
  this._keepAliveHandle.unref();
104
104
  }
105
- /**
106
- * Destroys the stream and any underlying streams.
107
- *
108
- * @param {error?} error An error to emit, if any.
109
- * @private
110
- */
111
- destroy(error) {
112
- // We can't assume Node has taken care of this in <14.
113
- if (this.destroyed) {
114
- return;
115
- }
116
- super.destroy(error ? error : undefined);
117
- }
118
105
  /**
119
106
  * Destroys the stream and any underlying streams.
120
107
  *
@@ -123,7 +110,6 @@ class MessageStream extends stream_1.PassThrough {
123
110
  * @private
124
111
  */
125
112
  _destroy(error, callback) {
126
- this.destroyed = true;
127
113
  clearInterval(this._keepAliveHandle);
128
114
  for (const stream of this._streams.keys()) {
129
115
  this._removeStream(stream);
@@ -162,7 +148,8 @@ class MessageStream extends stream_1.PassThrough {
162
148
  client = await this._getClient();
163
149
  }
164
150
  catch (e) {
165
- this.destroy(e);
151
+ const err = e;
152
+ this.destroy(err);
166
153
  }
167
154
  if (this.destroyed) {
168
155
  return;
@@ -188,7 +175,8 @@ class MessageStream extends stream_1.PassThrough {
188
175
  await this._waitForClientReady(client);
189
176
  }
190
177
  catch (e) {
191
- this.destroy(e);
178
+ const err = e;
179
+ this.destroy(err);
192
180
  }
193
181
  }
194
182
  /**
@@ -326,7 +314,8 @@ class MessageStream extends stream_1.PassThrough {
326
314
  await promisify_1.promisify(client.waitForReady).call(client, deadline);
327
315
  }
328
316
  catch (e) {
329
- throw new ChannelError(e);
317
+ const err = e;
318
+ throw new ChannelError(err);
330
319
  }
331
320
  }
332
321
  }