@ibm-cloud/cloudant 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  [![Release](https://img.shields.io/github/v/release/IBM/cloudant-node-sdk?include_prereleases&sort=semver)](https://github.com/IBM/cloudant-node-sdk/releases/latest)
3
3
  [![Docs](https://img.shields.io/static/v1?label=TypeDoc&message=latest&color=blue)](https://ibm.github.io/cloudant-node-sdk/)
4
4
 
5
- # IBM Cloudant Node.js SDK Version 0.7.1
5
+ # IBM Cloudant Node.js SDK Version 0.8.0
6
6
 
7
7
  IBM Cloudant Node.js SDK is a client library that interacts with the
8
8
  [IBM Cloudant APIs](https://cloud.ibm.com/apidocs/cloudant?code=node).
@@ -115,7 +115,7 @@ project:
115
115
  service instance or a
116
116
  [CouchDB](https://docs.couchdb.org/en/latest/install/index.html)
117
117
  server.
118
- - Node.js 18.
118
+ - Node.js 18 or 20.
119
119
 
120
120
 
121
121
  ## Installation
@@ -935,7 +935,7 @@ You have deleted the document.
935
935
 
936
936
  #### Further code examples
937
937
 
938
- For a complete list of code examples, see the [examples directory](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/examples#examples-for-node).
938
+ For a complete list of code examples, see the [examples directory](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.0/examples#examples-for-node).
939
939
 
940
940
  ### Error handling
941
941
 
@@ -1033,7 +1033,7 @@ The changes follower requires the client to have HTTP timeouts of at least 1 min
1033
1033
  instantiation if it is insufficient. The default client configuration has sufficiently long timeouts.
1034
1034
 
1035
1035
  For use-cases where these configuration limitations are deemed too restrictive then it is recommended to
1036
- write code to use the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/examples#postchanges) instead of the follower.
1036
+ write code to use the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.0/examples#postchanges) instead of the follower.
1037
1037
 
1038
1038
  #### Error suppression
1039
1039
 
@@ -1068,7 +1068,7 @@ The follower is not optimized for some use cases and it is not recommended to us
1068
1068
  * The volume of changes is very high (if the rate of changes in the database exceeds the follower's rate of pulling them it will never catch-up).
1069
1069
 
1070
1070
  In these cases use-case specific control over the number of change requests made and the content size of the responses
1071
- may be achieved by using the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/examples#postchanges).
1071
+ may be achieved by using the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.0/examples#postchanges).
1072
1072
 
1073
1073
  #### Checkpointing
1074
1074
 
@@ -1237,7 +1237,7 @@ const changesItemsStream = changesFollower.startOneOff();
1237
1237
  import { ChangesFollower, CloudantV1, Stream } from '@ibm-cloud/cloudant';
1238
1238
  import { ChangesResultItem, PostChangesParams } from '@ibm-cloud/cloudant/cloudant/v1';
1239
1239
  import { Writable } from 'node:stream';
1240
- import { pipeline } from 'node:stream/promises'
1240
+ import { pipeline } from 'node:stream/promises';
1241
1241
  ```
1242
1242
  [embedmd]:# (test/examples/src/features/ts/startAndProcess.ts /const client/ $)
1243
1243
  ```ts
@@ -1245,7 +1245,7 @@ const client = CloudantV1.newInstance({});
1245
1245
  // Start from a previously persisted seq
1246
1246
  // Normally this would be read by the app from persistent storage
1247
1247
  // e.g. previouslyPersistedSeq = yourAppPersistenceReadFunc()
1248
- const previouslyPersistedSeq = '3-g1AG3...'
1248
+ const previouslyPersistedSeq = '3-g1AG3...';
1249
1249
  const changesParams: PostChangesParams = {
1250
1250
  db: 'example',
1251
1251
  since: previouslyPersistedSeq
@@ -1259,10 +1259,10 @@ const destinationStream = new Writable({
1259
1259
  // do something with change item
1260
1260
  console.log(changesItem.id);
1261
1261
  for (const change of changesItem.changes) {
1262
- console.log(change.rev)
1262
+ console.log(change.rev);
1263
1263
  }
1264
1264
  // when change item processing is complete app can store seq
1265
- const seq = changesItem.seq
1265
+ const seq = changesItem.seq;
1266
1266
  // write seq to persistent storage for use as since if required to resume later
1267
1267
  // e.g. yourAppPersistenceWriteFunc()
1268
1268
  callback();
@@ -1294,7 +1294,7 @@ const client = CloudantV1.newInstance();
1294
1294
  // Start from a previously persisted seq
1295
1295
  // Normally this would be read by the app from persistent storage
1296
1296
  // e.g. previouslyPersistedSeq = yourAppPersistenceReadFunc()
1297
- const previouslyPersistedSeq = '3-g1AG3...'
1297
+ const previouslyPersistedSeq = '3-g1AG3...';
1298
1298
  const changesParams = {
1299
1299
  db: 'example',
1300
1300
  since: previouslyPersistedSeq
@@ -1308,10 +1308,10 @@ const destinationStream = new Writable({
1308
1308
  // do something with change item
1309
1309
  console.log(changesItem.id);
1310
1310
  for (const change of changesItem.changes) {
1311
- console.log(change.rev)
1311
+ console.log(change.rev);
1312
1312
  }
1313
1313
  // when change item processing is complete app can store seq
1314
- const seq = changesItem.seq
1314
+ const seq = changesItem.seq;
1315
1315
  // write seq to persistent storage for use as since if required to resume later
1316
1316
  // e.g. yourAppPersistenceWriteFunc()
1317
1317
  callback();
@@ -1338,7 +1338,7 @@ pipeline(changesItemsStream, destinationStream)
1338
1338
  import { ChangesFollower, CloudantV1, Stream } from '@ibm-cloud/cloudant';
1339
1339
  import { ChangesResultItem, PostChangesParams } from '@ibm-cloud/cloudant/cloudant/v1';
1340
1340
  import { Writable } from 'node:stream';
1341
- import { pipeline } from 'node:stream/promises'
1341
+ import { pipeline } from 'node:stream/promises';
1342
1342
  ```
1343
1343
  [embedmd]:# (test/examples/src/features/ts/startOneOffAndProcess.ts /const client/ $)
1344
1344
  ```ts
@@ -1346,7 +1346,7 @@ const client = CloudantV1.newInstance({});
1346
1346
  // Start from a previously persisted seq
1347
1347
  // Normally this would be read by the app from persistent storage
1348
1348
  // e.g. previouslyPersistedSeq = yourAppPersistenceReadFunc()
1349
- const previouslyPersistedSeq = '3-g1AG3...'
1349
+ const previouslyPersistedSeq = '3-g1AG3...';
1350
1350
  const changesParams: PostChangesParams = {
1351
1351
  db: 'example',
1352
1352
  since: previouslyPersistedSeq
@@ -1360,10 +1360,10 @@ const destinationStream = new Writable({
1360
1360
  // do something with change item
1361
1361
  console.log(changesItem.id);
1362
1362
  for (const change of changesItem.changes) {
1363
- console.log(change.rev)
1363
+ console.log(change.rev);
1364
1364
  }
1365
1365
  // when change item processing is complete app can store seq
1366
- const seq = changesItem.seq
1366
+ const seq = changesItem.seq;
1367
1367
  // write seq to persistent storage for use as since if required to resume later
1368
1368
  // e.g. yourAppPersistenceWriteFunc()
1369
1369
  callback();
@@ -1387,12 +1387,12 @@ async function getChangesFromFollower(changesItemsStream: Stream<CloudantV1.Chan
1387
1387
  // write seq to persistent storage for use as since
1388
1388
  console.log(changesItem.id);
1389
1389
  for (const change of changesItem.changes) {
1390
- console.log(change.rev)
1390
+ console.log(change.rev);
1391
1391
  }
1392
1392
  // when change item processing is complete app can store seq
1393
- seq = changesItem.seq
1393
+ seq = changesItem.seq;
1394
1394
  // write seq to persistent storage for use as since if required to resume later
1395
- // e.g. yourAppPersistenceWriteFunc()
1395
+ // e.g. yourAppPersistenceWriteFunc();
1396
1396
  }
1397
1397
  }
1398
1398
  */
@@ -1413,7 +1413,7 @@ const client = CloudantV1.newInstance();
1413
1413
  // Start from a previously persisted seq
1414
1414
  // Normally this would be read by the app from persistent storage
1415
1415
  // e.g. previouslyPersistedSeq = yourAppPersistenceReadFunc()
1416
- const previouslyPersistedSeq = '3-g1AG3...'
1416
+ const previouslyPersistedSeq = '3-g1AG3...';
1417
1417
  const changesParams = {
1418
1418
  db: 'example',
1419
1419
  since: previouslyPersistedSeq
@@ -1427,10 +1427,10 @@ const destinationStream = new Writable({
1427
1427
  // do something with change item
1428
1428
  console.log(changesItem.id);
1429
1429
  for (const change of changesItem.changes) {
1430
- console.log(change.rev)
1430
+ console.log(change.rev);
1431
1431
  }
1432
1432
  // when change item processing is complete app can store seq
1433
- const seq = changesItem.seq
1433
+ const seq = changesItem.seq;
1434
1434
  // write seq to persistent storage for use as since if required to resume later
1435
1435
  // e.g. yourAppPersistenceWriteFunc()
1436
1436
  callback();
@@ -1454,12 +1454,12 @@ async function getChangesFromFollower(changesItemsStream) {
1454
1454
  // write seq to persistent storage for use as since
1455
1455
  console.log(changesItem.id);
1456
1456
  for (const change of changesItem.changes) {
1457
- console.log(change.rev)
1457
+ console.log(change.rev);
1458
1458
  }
1459
1459
  // when change item processing is complete app can store seq
1460
- seq = changesItem.seq
1460
+ seq = changesItem.seq;
1461
1461
  // write seq to persistent storage for use as since if required to resume later
1462
- // e.g. yourAppPersistenceWriteFunc()
1462
+ // e.g. yourAppPersistenceWriteFunc();
1463
1463
  }
1464
1464
  }
1465
1465
  */
@@ -1475,7 +1475,7 @@ async function getChangesFromFollower(changesItemsStream) {
1475
1475
  import { ChangesFollower, CloudantV1, Stream } from '@ibm-cloud/cloudant';
1476
1476
  import { ChangesResultItem, PostChangesParams } from '@ibm-cloud/cloudant/cloudant/v1';
1477
1477
  import { Writable } from 'node:stream';
1478
- import { pipeline } from 'node:stream/promises'
1478
+ import { pipeline } from 'node:stream/promises';
1479
1479
  ```
1480
1480
  [embedmd]:# (test/examples/src/features/ts/stop.ts /const client/ $)
1481
1481
  ```ts
@@ -1579,7 +1579,7 @@ If you encounter an issue with the project, you are welcome to submit a
1579
1579
 
1580
1580
  Before you submit a bug report, search for
1581
1581
  [similar issues](https://github.com/IBM/cloudant-node-sdk/issues?q=is%3Aissue) and review the
1582
- [KNOWN_ISSUES file](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/KNOWN_ISSUES.md) to verify that your issue hasn't been reported yet.
1582
+ [KNOWN_ISSUES file](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.0/KNOWN_ISSUES.md) to verify that your issue hasn't been reported yet.
1583
1583
 
1584
1584
  Please consult the [security policy](https://github.com/IBM/cloudant-node-sdk/security/policy) before opening security related issues.
1585
1585
 
@@ -1609,8 +1609,8 @@ Find more open source projects on the [IBM GitHub](http://ibm.github.io/) page.
1609
1609
 
1610
1610
  ## Contributing
1611
1611
 
1612
- For more information, see [CONTRIBUTING](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/CONTRIBUTING.md).
1612
+ For more information, see [CONTRIBUTING](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.0/CONTRIBUTING.md).
1613
1613
 
1614
1614
  ## License
1615
1615
 
1616
- This SDK is released under the Apache 2.0 license. To read the full text of the license, see [LICENSE](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/LICENSE).
1616
+ This SDK is released under the Apache 2.0 license. To read the full text of the license, see [LICENSE](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.0/LICENSE).
@@ -88,7 +88,8 @@ var ChangesFollower = /** @class */ (function () {
88
88
  if (errorTolerance < 0) {
89
89
  throw new Error('Error tolerance duration must not be negative.');
90
90
  }
91
- if (errorTolerance === undefined) {
91
+ // loose equality for null and undefined values
92
+ if (errorTolerance == undefined) {
92
93
  this.errorTolerance = Number.MAX_VALUE;
93
94
  }
94
95
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"changesFollower.js","sourceRoot":"","sources":["../../../cloudant/features/changesFollower.ts"],"names":[],"mappings":";;;AAiBA,6DAA4D;AAC5D,qEAAoE;AACpE,iCAA4C;AAC5C,iEAAwE;AAGxE,IAAY,IAIX;AAJD,WAAY,IAAI;IACd,gBAAgB;IAChB,mCAAM,CAAA;IACN,mCAAM,CAAA;AACR,CAAC,EAJW,IAAI,oBAAJ,IAAI,QAIf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH;IAcE;;;;;;;;;;;OAWG;IACH,yBACE,MAAkB,EAClB,MAAoC,EACpC,cAAuB;QAEvB,2BAA2B;QAC3B,yCAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,6DAA6D;QAC7D,IAAI,CAAC,MAAM,GAAG,yCAAmB,CAAC,WAAW,CAAC,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AC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAC5C,IAAI,EACJ,IAAI,CAAC,cAAc,CACpB,CAAC;QAEF,OAAO,IAAA,iBAAQ,EACb,iBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,EACzC,IAAI,iDAAuB,EAAE,EAC7B,cAAO,CAAC,CACT,CAAC;IACJ,CAAC;IA1IM,0BAAU,GAAG,KAAM,CAAC;IA2I7B,sBAAC;CAAA,AA5ID,IA4IC;AA5IY,0CAAe"}
@@ -17,7 +17,6 @@ import { Mode } from './changesFollower';
17
17
  import { PostChangesParams } from '../v1';
18
18
  import CloudantV1 = require('../v1');
19
19
  export declare class ChangesResultIterableIterator implements AsyncIterableIterator<CloudantV1.ChangesResult> {
20
- private readonly cancellable;
21
20
  private readonly timeoutPromise;
22
21
  private readonly cancelToken;
23
22
  private readonly client;
@@ -65,10 +65,6 @@ var TransientErrorSuppression;
65
65
  })(TransientErrorSuppression || (TransientErrorSuppression = {}));
66
66
  var ChangesResultIterableIterator = /** @class */ (function () {
67
67
  function ChangesResultIterableIterator(client, params, mode, errorTolerance) {
68
- var _this = this;
69
- this.cancellable = new Promise(function (_resolve, reject) {
70
- _this.cancel = reject;
71
- });
72
68
  this.timeoutPromise = (0, util_1.promisify)(setTimeout);
73
69
  this.cancelToken = 'CloudantChangesIteratorCancel';
74
70
  this.doneResult = {
@@ -154,7 +150,7 @@ var ChangesResultIterableIterator = /** @class */ (function () {
154
150
  if (!this.stopped) {
155
151
  this.logger.debug('Setting stopped flag.');
156
152
  this.stopped = true;
157
- if (this.inflight) {
153
+ if (this.cancel) {
158
154
  this.logger.debug('Cancelling inflight requests.');
159
155
  this.cancel(new Error(this.cancelToken));
160
156
  }
@@ -166,6 +162,7 @@ var ChangesResultIterableIterator = /** @class */ (function () {
166
162
  };
167
163
  ChangesResultIterableIterator.prototype.next = function (value) {
168
164
  return __awaiter(this, void 0, void 0, function () {
165
+ var resolveCancellable, cancellable;
169
166
  var _this = this;
170
167
  return __generator(this, function (_a) {
171
168
  switch (_a.label) {
@@ -191,101 +188,107 @@ var ChangesResultIterableIterator = /** @class */ (function () {
191
188
  // end up blocking I/O.
192
189
  _a.sent();
193
190
  this.logger.debug('Making next request.');
194
- this.inflight = Promise.race([
195
- this.cancellable,
196
- this.client.postChanges(changesParamsHelper_1.ChangesParamsHelper.cloneParams(this.params, this.since, this.countDown && this.countDown < this.params.limit
197
- ? this.countDown
198
- : undefined)),
199
- ])
200
- .then(function (response) {
201
- _this.logger.debug('Got next response.');
202
- // Reset the retry counter
203
- _this.retry = 0;
204
- if (_this.transientErrorSuppression === TransientErrorSuppression.TIMER) {
205
- _this.logger.debug('Setting new timestamp for timer suppression');
206
- _this.successTimestamp = Date.now();
207
- }
208
- _this.since = response.result.last_seq;
209
- _this.pending = response.result.pending;
210
- if (_this.mode === changesFollower_1.Mode.FINITE && _this.pending === 0) {
211
- _this.logger.debug('No more changes pending, setting stopped flag.');
212
- _this.stopped = true;
213
- }
214
- if (_this.countDown !== undefined) {
215
- _this.logger.debug('Decrementing limit.');
216
- _this.countDown -= response.result.results.length;
217
- if (_this.countDown <= 0) {
218
- _this.logger.debug('Limit reached, setting stopped flag.');
191
+ cancellable = new Promise(function (resolve, reject) {
192
+ resolveCancellable = resolve;
193
+ _this.cancel = reject;
194
+ });
195
+ return [2 /*return*/, Promise.race([
196
+ cancellable,
197
+ this.client.postChanges(changesParamsHelper_1.ChangesParamsHelper.cloneParams(this.params, this.since, this.countDown && this.countDown < this.params.limit
198
+ ? this.countDown
199
+ : undefined)),
200
+ ])
201
+ .then(function (response) {
202
+ _this.logger.debug('Got next response.');
203
+ // Reset the retry counter
204
+ _this.retry = 0;
205
+ if (_this.transientErrorSuppression === TransientErrorSuppression.TIMER) {
206
+ _this.logger.debug('Setting new timestamp for timer suppression');
207
+ _this.successTimestamp = Date.now();
208
+ }
209
+ _this.since = response.result.last_seq;
210
+ _this.pending = response.result.pending;
211
+ if (_this.mode === changesFollower_1.Mode.FINITE && _this.pending === 0) {
212
+ _this.logger.debug('No more changes pending, setting stopped flag.');
219
213
  _this.stopped = true;
220
214
  }
221
- }
222
- _this.logger.debug('Iterator next exiting with result.');
223
- return { done: false, value: response.result };
224
- })
225
- .catch(function (err) {
226
- _this.logger.debug("Caught error ".concat(err.message));
227
- if (err.message === _this.cancelToken) {
228
- _this.logger.debug('Iterator next exiting cancelled.');
229
- return _this.doneResult;
230
- }
231
- switch (_this.transientErrorSuppression) {
232
- case TransientErrorSuppression.ALWAYS:
233
- break;
234
- case TransientErrorSuppression.TIMER:
235
- if (Date.now() < _this.successTimestamp + _this.errorTolerance) {
236
- break;
237
- }
238
- _this.logger.debug('Error tolerance deadline exceeded.');
239
- // In the case the timer has been exceeded we want to throw so
240
- // fall through
241
- case TransientErrorSuppression.NEVER:
242
- _this.logger.verbose("ChangesResultStream stream: ".concat(err.message));
243
- throw err;
244
- }
245
- switch (err.code) {
246
- case 400:
247
- case 401:
248
- case 403:
249
- case 404:
250
- // Terminal error, stop running
251
- _this.logger.debug('Terminal error');
252
- _this.logger.verbose("ChangesResultStream stream: ".concat(err.message));
253
- throw err;
254
- default:
255
- // Note this includes Errors
256
- // which handles cases like disconnections and incomplete
257
- // bodies where we may have received a successful response
258
- // code, but couldn't e.g. parse the body
259
- _this.logger.verbose("Suppressing transient error ".concat(err.message, "."));
260
- var emptyChangesResultPromise_1 = {
261
- done: false,
262
- value: {
263
- last_seq: _this.since,
264
- pending: _this.pending,
265
- results: [],
266
- },
267
- };
268
- var expDelay = void 0;
269
- if (_this.retry > _this.expRetryGate) {
270
- // If we've exceeded the cap, use the timeout value
271
- expDelay = changesParamsHelper_1.ChangesParamsHelper.LONGPOLL_TIMEOUT;
272
- }
273
- else {
274
- expDelay = Math.pow(2, _this.retry) * _this.baseDelay;
215
+ if (_this.countDown !== undefined) {
216
+ _this.logger.debug('Decrementing limit.');
217
+ _this.countDown -= response.result.results.length;
218
+ if (_this.countDown <= 0) {
219
+ _this.logger.debug('Limit reached, setting stopped flag.');
220
+ _this.stopped = true;
275
221
  }
276
- var delay = Math.round(Math.random() * expDelay) + 1;
277
- _this.logger.debug("Backing off for ".concat(delay, " ms."));
278
- _this.retry++;
279
- return _this.timeoutPromise(delay).then(function () {
280
- _this.logger.debug("Iterator next exiting with empty result.");
281
- return emptyChangesResultPromise_1;
282
- });
283
- }
284
- })
285
- .finally(function () {
286
- _this.inflight = null;
287
- });
288
- return [2 /*return*/, this.inflight];
222
+ }
223
+ _this.logger.debug('Iterator next exiting with result.');
224
+ return { done: false, value: response.result };
225
+ })
226
+ .catch(function (err) {
227
+ _this.logger.debug("Caught error ".concat(err.message));
228
+ if (err.message === _this.cancelToken) {
229
+ _this.logger.debug('Iterator next exiting cancelled.');
230
+ return _this.doneResult;
231
+ }
232
+ switch (_this.transientErrorSuppression) {
233
+ case TransientErrorSuppression.ALWAYS:
234
+ break;
235
+ case TransientErrorSuppression.TIMER:
236
+ if (Date.now() < _this.successTimestamp + _this.errorTolerance) {
237
+ break;
238
+ }
239
+ _this.logger.debug('Error tolerance deadline exceeded.');
240
+ // In the case the timer has been exceeded we want to throw so
241
+ // fall through
242
+ case TransientErrorSuppression.NEVER:
243
+ _this.logger.verbose("ChangesResultStream stream: ".concat(err.message));
244
+ throw err;
245
+ }
246
+ switch (err.code) {
247
+ case 400:
248
+ case 401:
249
+ case 403:
250
+ case 404:
251
+ // Terminal error, stop running
252
+ _this.logger.debug('Terminal error');
253
+ _this.logger.verbose("ChangesResultStream stream: ".concat(err.message));
254
+ throw err;
255
+ default:
256
+ // Note this includes Errors
257
+ // which handles cases like disconnections and incomplete
258
+ // bodies where we may have received a successful response
259
+ // code, but couldn't e.g. parse the body
260
+ _this.logger.verbose("Suppressing transient error ".concat(err.message, "."));
261
+ var emptyChangesResultPromise_1 = {
262
+ done: false,
263
+ value: {
264
+ last_seq: _this.since,
265
+ pending: _this.pending,
266
+ results: [],
267
+ },
268
+ };
269
+ var expDelay = void 0;
270
+ if (_this.retry > _this.expRetryGate) {
271
+ // If we've exceeded the cap, use the timeout value
272
+ expDelay = changesParamsHelper_1.ChangesParamsHelper.LONGPOLL_TIMEOUT;
273
+ }
274
+ else {
275
+ expDelay = Math.pow(2, _this.retry) * _this.baseDelay;
276
+ }
277
+ var delay = Math.round(Math.random() * expDelay) + 1;
278
+ _this.logger.debug("Backing off for ".concat(delay, " ms."));
279
+ _this.retry++;
280
+ return _this.timeoutPromise(delay).then(function () {
281
+ _this.logger.debug("Iterator next exiting with empty result.");
282
+ return emptyChangesResultPromise_1;
283
+ });
284
+ }
285
+ })
286
+ .finally(function () {
287
+ _this.logger.debug('Cleaning up cancellable.');
288
+ _this.cancel = null;
289
+ // Resolve the cancellable to ensure clean up can happen
290
+ resolveCancellable();
291
+ })];
289
292
  }
290
293
  });
291
294
  });
@@ -1 +1 @@
1
- {"version":3,"file":"changesResultIterator.js","sourceRoot":"","sources":["../../../cloudant/features/changesResultIterator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6DAA4D;AAC5D,qDAA0D;AAC1D,yDAAkD;AAElD,6BAAiC;AAGjC,IAAK,yBAKJ;AALD,WAAK,yBAAyB;IAC5B,gBAAgB;IAChB,6EAAM,CAAA;IACN,2EAAK,CAAA;IACL,2EAAK,CAAA;AACP,CAAC,EALI,yBAAyB,KAAzB,yBAAyB,QAK7B;AAED;IAuDE,uCACE,MAAkB,EAClB,MAAyB,EACzB,IAAU,EACV,cAAuB;QAJzB,iBAkCC;QAtFgB,gBAAW,GAExB,IAAI,OAAO,CAAC,UAAC,QAAQ,EAAE,MAAM;YAC/B,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;QAEc,mBAAc,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC;QAEvC,gBAAW,GAAG,+BAA+B,CAAC;QAI9C,eAAU,GAA6C;YACtE,IAAI,EA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AG,CAAC,CAAC;oCAC/D,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAAmB,KAAK,SAAM,CAAC,CAAC;oCAClD,KAAI,CAAC,KAAK,EAAE,CAAC;oCACb,OAAO,KAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;wCACrC,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;wCAC9D,OAAO,2BAAyB,CAAC;oCACnC,CAAC,CAAC,CAAC;6BACN;wBACH,CAAC,CAAC;6BACD,OAAO,CAAC;4BACP,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACvB,CAAC,CAAC,CAAC;wBACL,sBAAO,IAAI,CAAC,QAAQ,EAAC;;;;KACtB;IACH,oCAAC;AAAD,CAAC,AA1QD,IA0QC;AA1QY,sEAA6B"}
1
+ {"version":3,"file":"changesResultIterator.js","sourceRoot":"","sources":["../../../cloudant/features/changesResultIterator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6DAA4D;AAC5D,qDAA0D;AAC1D,yDAAkD;AAElD,6BAAiC;AAGjC,IAAK,yBAKJ;AALD,WAAK,yBAAyB;IAC5B,gBAAgB;IAChB,6EAAM,CAAA;IACN,2EAAK,CAAA;IACL,2EAAK,CAAA;AACP,CAAC,EALI,yBAAyB,KAAzB,yBAAyB,QAK7B;AAED;IAiDE,uCACE,MAAkB,EAClB,MAAyB,EACzB,IAAU,EACV,cAAuB;QAlDR,mBAAc,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC;QAEvC,gBAAW,GAAG,+BAA+B,CAAC;QAI9C,eAAU,GAA6C;YACtE,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,SAAS;SACjB,CAAC;QAIe,WAAM,GAAG,IAAA,iCAAY,EAAC,mBAAmB,CAAC,CAAC;QAQ3C,cAAS,GAAW,GAAG,CAAC;Q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