@ibm-cloud/cloudant 0.8.2 → 0.8.3
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 +27 -27
- package/auth/couchdbSessionAuthenticator.js +23 -49
- package/auth/couchdbSessionAuthenticator.js.map +1 -1
- package/auth/index.d.ts +1 -1
- package/auth/index.js.map +1 -1
- package/auth/sessionTokenManager.js +35 -51
- package/auth/sessionTokenManager.js.map +1 -1
- package/cloudant/features/changesFollower.d.ts +14 -14
- package/cloudant/features/changesFollower.js +40 -34
- package/cloudant/features/changesFollower.js.map +1 -1
- package/cloudant/features/changesParamsHelper.js +28 -34
- package/cloudant/features/changesParamsHelper.js.map +1 -1
- package/cloudant/features/changesResultItemStream.js +11 -32
- package/cloudant/features/changesResultItemStream.js.map +1 -1
- package/cloudant/features/changesResultIterator.js +190 -240
- package/cloudant/features/changesResultIterator.js.map +1 -1
- package/cloudant/features/stream.js +15 -39
- package/cloudant/features/stream.js.map +1 -1
- package/cloudant/v1.d.ts +8 -0
- package/cloudant/v1.js +1405 -1426
- package/cloudant/v1.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/lib/cloudantBaseService.js +55 -78
- package/lib/cloudantBaseService.js.map +1 -1
- package/lib/common.js +34 -11
- package/lib/common.js.map +1 -1
- package/lib/getAuthenticatorFromEnvCloudantExtension.js +6 -6
- package/lib/getAuthenticatorFromEnvCloudantExtension.js.map +1 -1
- package/package.json +12 -11
|
@@ -14,77 +14,50 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
18
|
exports.ChangesResultIterableIterator = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
19
|
+
const changesParamsHelper_1 = require("./changesParamsHelper");
|
|
20
|
+
const changesFollower_1 = require("./changesFollower");
|
|
21
|
+
const ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
22
|
+
const util_1 = require("util");
|
|
59
23
|
var TransientErrorSuppression;
|
|
60
24
|
(function (TransientErrorSuppression) {
|
|
61
|
-
/** @internal */
|
|
62
25
|
TransientErrorSuppression[TransientErrorSuppression["ALWAYS"] = 0] = "ALWAYS";
|
|
63
26
|
TransientErrorSuppression[TransientErrorSuppression["NEVER"] = 1] = "NEVER";
|
|
64
27
|
TransientErrorSuppression[TransientErrorSuppression["TIMER"] = 2] = "TIMER";
|
|
65
28
|
})(TransientErrorSuppression || (TransientErrorSuppression = {}));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
29
|
+
class ChangesResultIterableIterator {
|
|
30
|
+
timeoutPromise = (0, util_1.promisify)(setTimeout);
|
|
31
|
+
cancelToken = 'CloudantChangesIteratorCancel';
|
|
32
|
+
client;
|
|
33
|
+
doneResult = {
|
|
34
|
+
done: true,
|
|
35
|
+
value: undefined,
|
|
36
|
+
};
|
|
37
|
+
errorTolerance;
|
|
38
|
+
logger = (0, ibm_cloud_sdk_core_1.getNewLogger)('cloudant-node-sdk');
|
|
39
|
+
mode;
|
|
40
|
+
promisedConfig;
|
|
41
|
+
transientErrorSuppression;
|
|
42
|
+
baseDelay = 100;
|
|
43
|
+
expRetryGate = Math.floor(Math.log2(changesParamsHelper_1.ChangesParamsHelper.LONGPOLL_TIMEOUT / this.baseDelay));
|
|
44
|
+
cancel;
|
|
45
|
+
countDown;
|
|
46
|
+
inflight = null;
|
|
47
|
+
params;
|
|
48
|
+
// Default to "infinite"
|
|
49
|
+
pending = Number.MAX_VALUE;
|
|
50
|
+
since;
|
|
51
|
+
stopped = false;
|
|
52
|
+
successTimestamp;
|
|
53
|
+
retry = 0;
|
|
54
|
+
constructor(client, params, mode, errorTolerance) {
|
|
82
55
|
this.client = client;
|
|
83
56
|
this.params = params;
|
|
84
57
|
this.mode = mode;
|
|
85
58
|
this.errorTolerance = errorTolerance;
|
|
86
59
|
if (this.params.limit !== undefined) {
|
|
87
|
-
this.logger.debug(
|
|
60
|
+
this.logger.debug(`Applying changes limit ${this.params.limit}`);
|
|
88
61
|
this.countDown = this.params.limit;
|
|
89
62
|
}
|
|
90
63
|
if (this.errorTolerance === 0) {
|
|
@@ -97,7 +70,7 @@ var ChangesResultIterableIterator = /** @class */ (function () {
|
|
|
97
70
|
}
|
|
98
71
|
else {
|
|
99
72
|
this.transientErrorSuppression = TransientErrorSuppression.TIMER;
|
|
100
|
-
this.logger.debug(
|
|
73
|
+
this.logger.debug(`Suppress errors for ${this.errorTolerance} ms.`);
|
|
101
74
|
}
|
|
102
75
|
if (this.params.since === undefined) {
|
|
103
76
|
this.since = this.mode === changesFollower_1.Mode.LISTEN ? 'now' : '0';
|
|
@@ -108,192 +81,169 @@ var ChangesResultIterableIterator = /** @class */ (function () {
|
|
|
108
81
|
this.promisedConfig = this.configure();
|
|
109
82
|
this.successTimestamp = Date.now();
|
|
110
83
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_this.params.limit =
|
|
130
|
-
Math.floor((5 * 1024 * 1024) /
|
|
131
|
-
(info.result.sizes.external / info.result.doc_count + 500)) || 1;
|
|
132
|
-
}
|
|
133
|
-
})];
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
this.params.limit = changesFollower_1.ChangesFollower.BATCH_SIZE;
|
|
137
|
-
return [2 /*return*/, Promise.resolve()];
|
|
84
|
+
async configure() {
|
|
85
|
+
if (this.params.includeDocs) {
|
|
86
|
+
return this.client
|
|
87
|
+
.getDatabaseInformation({
|
|
88
|
+
db: this.params.db,
|
|
89
|
+
})
|
|
90
|
+
.then((info) => {
|
|
91
|
+
if (info.result &&
|
|
92
|
+
'doc_count' in info.result &&
|
|
93
|
+
info.result.doc_count > 0 &&
|
|
94
|
+
'sizes' in info.result &&
|
|
95
|
+
'external' in info.result.sizes &&
|
|
96
|
+
info.result.sizes.external > 0) {
|
|
97
|
+
// Calculate an average doc size + typical change content size
|
|
98
|
+
// and try to keep each batch to be about 5 MB
|
|
99
|
+
this.params.limit =
|
|
100
|
+
Math.floor((5 * 1024 * 1024) /
|
|
101
|
+
(info.result.sizes.external / info.result.doc_count + 500)) || 1;
|
|
138
102
|
}
|
|
139
|
-
return [2 /*return*/];
|
|
140
103
|
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.params.limit = changesFollower_1.ChangesFollower.BATCH_SIZE;
|
|
107
|
+
return Promise.resolve();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
[Symbol.asyncIterator]() {
|
|
144
111
|
return this;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
112
|
+
}
|
|
113
|
+
async return(value) {
|
|
114
|
+
this.logger.debug('Iterator return entry.');
|
|
115
|
+
if (!this.stopped) {
|
|
116
|
+
this.logger.debug('Setting stopped flag.');
|
|
117
|
+
this.stopped = true;
|
|
118
|
+
if (this.cancel) {
|
|
119
|
+
this.logger.debug('Cancelling inflight requests.');
|
|
120
|
+
this.cancel(new Error(this.cancelToken));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this.logger.debug('Iterator return exiting done.');
|
|
124
|
+
return this.doneResult;
|
|
125
|
+
}
|
|
126
|
+
async next(value) {
|
|
127
|
+
this.logger.debug('Iterator next entry.');
|
|
128
|
+
// Stop the iterator if stopped is set to true.
|
|
129
|
+
if (this.stopped) {
|
|
130
|
+
this.logger.debug('Already stopped, iterator next exiting done.');
|
|
131
|
+
return this.doneResult;
|
|
132
|
+
}
|
|
133
|
+
// Await the async config and also
|
|
134
|
+
// yield to the event loop so our long-running requests don't enqueue
|
|
135
|
+
// more long-running requests on the same microtask queue and
|
|
136
|
+
// end up blocking I/O.
|
|
137
|
+
await Promise.all([
|
|
138
|
+
this.promisedConfig,
|
|
139
|
+
new Promise((resolve) => setImmediate(resolve)),
|
|
140
|
+
]);
|
|
141
|
+
this.logger.debug('Making next request.');
|
|
142
|
+
// Make a new cancellable promise that can race with the request
|
|
143
|
+
// in case the follower is stopped.
|
|
144
|
+
let resolveCancellable;
|
|
145
|
+
const cancellable = new Promise((resolve, reject) => {
|
|
146
|
+
resolveCancellable = resolve;
|
|
147
|
+
this.cancel = reject;
|
|
161
148
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// end up blocking I/O.
|
|
189
|
-
_a.sent();
|
|
190
|
-
this.logger.debug('Making next request.');
|
|
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.');
|
|
213
|
-
_this.stopped = true;
|
|
214
|
-
}
|
|
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;
|
|
221
|
-
}
|
|
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
|
-
})];
|
|
149
|
+
return Promise.race([
|
|
150
|
+
cancellable,
|
|
151
|
+
this.client.postChanges(changesParamsHelper_1.ChangesParamsHelper.cloneParams(this.params, this.since, this.countDown && this.countDown < this.params.limit
|
|
152
|
+
? this.countDown
|
|
153
|
+
: undefined)),
|
|
154
|
+
])
|
|
155
|
+
.then((response) => {
|
|
156
|
+
this.logger.debug('Got next response.');
|
|
157
|
+
// Reset the retry counter
|
|
158
|
+
this.retry = 0;
|
|
159
|
+
if (this.transientErrorSuppression === TransientErrorSuppression.TIMER) {
|
|
160
|
+
this.logger.debug('Setting new timestamp for timer suppression');
|
|
161
|
+
this.successTimestamp = Date.now();
|
|
162
|
+
}
|
|
163
|
+
this.since = response.result.last_seq;
|
|
164
|
+
this.pending = response.result.pending;
|
|
165
|
+
if (this.mode === changesFollower_1.Mode.FINITE && this.pending === 0) {
|
|
166
|
+
this.logger.debug('No more changes pending, setting stopped flag.');
|
|
167
|
+
this.stopped = true;
|
|
168
|
+
}
|
|
169
|
+
if (this.countDown !== undefined) {
|
|
170
|
+
this.logger.debug('Decrementing limit.');
|
|
171
|
+
this.countDown -= response.result.results.length;
|
|
172
|
+
if (this.countDown <= 0) {
|
|
173
|
+
this.logger.debug('Limit reached, setting stopped flag.');
|
|
174
|
+
this.stopped = true;
|
|
292
175
|
}
|
|
293
|
-
}
|
|
176
|
+
}
|
|
177
|
+
this.logger.debug('Iterator next exiting with result.');
|
|
178
|
+
return { done: false, value: response.result };
|
|
179
|
+
})
|
|
180
|
+
.catch((err) => {
|
|
181
|
+
this.logger.debug(`Caught error ${err.message}`);
|
|
182
|
+
if (err.message === this.cancelToken) {
|
|
183
|
+
this.logger.debug('Iterator next exiting cancelled.');
|
|
184
|
+
return this.doneResult;
|
|
185
|
+
}
|
|
186
|
+
switch (this.transientErrorSuppression) {
|
|
187
|
+
case TransientErrorSuppression.ALWAYS:
|
|
188
|
+
break;
|
|
189
|
+
case TransientErrorSuppression.TIMER:
|
|
190
|
+
if (Date.now() < this.successTimestamp + this.errorTolerance) {
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
this.logger.debug('Error tolerance deadline exceeded.');
|
|
194
|
+
// In the case the timer has been exceeded we want to throw so
|
|
195
|
+
// fall through
|
|
196
|
+
case TransientErrorSuppression.NEVER:
|
|
197
|
+
this.logger.verbose(`ChangesResultStream stream: ${err.message}`);
|
|
198
|
+
throw err;
|
|
199
|
+
}
|
|
200
|
+
switch (err.code) {
|
|
201
|
+
case 400:
|
|
202
|
+
case 401:
|
|
203
|
+
case 403:
|
|
204
|
+
case 404:
|
|
205
|
+
// Terminal error, stop running
|
|
206
|
+
this.logger.debug('Terminal error');
|
|
207
|
+
this.logger.verbose(`ChangesResultStream stream: ${err.message}`);
|
|
208
|
+
throw err;
|
|
209
|
+
default:
|
|
210
|
+
// Note this includes Errors
|
|
211
|
+
// which handles cases like disconnections and incomplete
|
|
212
|
+
// bodies where we may have received a successful response
|
|
213
|
+
// code, but couldn't e.g. parse the body
|
|
214
|
+
this.logger.verbose(`Suppressing transient error ${err.message}.`);
|
|
215
|
+
const emptyChangesResultPromise = {
|
|
216
|
+
done: false,
|
|
217
|
+
value: {
|
|
218
|
+
last_seq: this.since,
|
|
219
|
+
pending: this.pending,
|
|
220
|
+
results: [],
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
let expDelay;
|
|
224
|
+
if (this.retry > this.expRetryGate) {
|
|
225
|
+
// If we've exceeded the cap, use the timeout value
|
|
226
|
+
expDelay = changesParamsHelper_1.ChangesParamsHelper.LONGPOLL_TIMEOUT;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
expDelay = Math.pow(2, this.retry) * this.baseDelay;
|
|
230
|
+
}
|
|
231
|
+
const delay = Math.round(Math.random() * expDelay) + 1;
|
|
232
|
+
this.logger.debug(`Backing off for ${delay} ms.`);
|
|
233
|
+
this.retry++;
|
|
234
|
+
return this.timeoutPromise(delay).then(() => {
|
|
235
|
+
this.logger.debug(`Iterator next exiting with empty result.`);
|
|
236
|
+
return emptyChangesResultPromise;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
.finally(() => {
|
|
241
|
+
this.logger.debug('Cleaning up cancellable.');
|
|
242
|
+
this.cancel = null;
|
|
243
|
+
// Resolve the cancellable to ensure clean up can happen
|
|
244
|
+
resolveCancellable();
|
|
294
245
|
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
}());
|
|
246
|
+
}
|
|
247
|
+
}
|
|
298
248
|
exports.ChangesResultIterableIterator = ChangesResultIterableIterator;
|
|
299
249
|
//# sourceMappingURL=changesResultIterator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changesResultIterator.js","sourceRoot":"","sources":["../../../cloudant/features/changesResultIterator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"changesResultIterator.js","sourceRoot":"","sources":["../../../cloudant/features/changesResultIterator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+DAA4D;AAC5D,uDAA0D;AAC1D,2DAAkD;AAElD,+BAAiC;AAGjC,IAAK,yBAIJ;AAJD,WAAK,yBAAyB;IAC5B,6EAAM,CAAA;IACN,2EAAK,CAAA;IACL,2EAAK,CAAA;AACP,CAAC,EAJI,yBAAyB,KAAzB,yBAAyB,QAI7B;AAED,MAAa,6BAA6B;IAGvB,cAAc,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC;IAEvC,WAAW,GAAG,+BAA+B,CAAC;IAE9C,MAAM,CAAa;IAEnB,UAAU,GAA6C;QACtE,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,SAAS;KACjB,CAAC;IAEe,cAAc,CAAU;IAExB,MAAM,GAAG,IAAA,iCAAY,EAAC,mBAAmB,CAAC,CAAC;IAE3C,IAAI,CAAO;IAEX,cAAc,CAAgB;IAE9B,yBAAyB,CAA4B;IAErD,SAAS,GAAW,GAAG,CAAC;IAExB,YAAY,GAAW,IAAI,CAAC,KAAK,CAChD,IAAI,CAAC,IAAI,CAAC,yCAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,CACjE,CAAC;IAEM,MAAM,CAA0B;IAEhC,SAAS,CAAS;IAElB,QAAQ,GAAiB,IAAI,CAAC;IAE9B,MAAM,CAAoB;IAElC,wBAAwB;IAChB,OAAO,GAAW,MAAM,CAAC,SAAS,CAAC;IAEnC,KAAK,CAAS;IAEd,OAAO,GAAY,KAAK,CAAC;IAEzB,gBAAgB,CAAS;IAEzB,KAAK,GAAW,CAAC,CAAC;IAE1B,YACE,MAAkB,EAClB,MAAyB,EACzB,IAAU,EACV,cAAuB;QAEvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB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C,GAAG,EAAE;wBAC1C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;wBAC9D,OAAO,yBAAyB,CAAC;oBACnC,CAAC,CAAC,CAAC;YACP,CAAC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,wDAAwD;YACxD,kBAAkB,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;CACF;AA9QD,sEA8QC"}
|
|
@@ -14,47 +14,23 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var __extends = (this && this.__extends) || (function () {
|
|
18
|
-
var extendStatics = function (d, b) {
|
|
19
|
-
extendStatics = Object.setPrototypeOf ||
|
|
20
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
21
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
22
|
-
return extendStatics(d, b);
|
|
23
|
-
};
|
|
24
|
-
return function (d, b) {
|
|
25
|
-
if (typeof b !== "function" && b !== null)
|
|
26
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
27
|
-
extendStatics(d, b);
|
|
28
|
-
function __() { this.constructor = d; }
|
|
29
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
-
};
|
|
31
|
-
})();
|
|
32
|
-
var __assign = (this && this.__assign) || function () {
|
|
33
|
-
__assign = Object.assign || function(t) {
|
|
34
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
-
s = arguments[i];
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
37
|
-
t[p] = s[p];
|
|
38
|
-
}
|
|
39
|
-
return t;
|
|
40
|
-
};
|
|
41
|
-
return __assign.apply(this, arguments);
|
|
42
|
-
};
|
|
43
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
18
|
exports.Stream = void 0;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
19
|
+
const stream_1 = require("stream");
|
|
20
|
+
class Stream extends stream_1.Transform {
|
|
21
|
+
constructor(opts) {
|
|
22
|
+
super({
|
|
23
|
+
...opts,
|
|
24
|
+
objectMode: true, // sets readableObjectMode and writableObjectMode to true
|
|
25
|
+
highWaterMark: 1,
|
|
26
|
+
});
|
|
50
27
|
}
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}(stream_1.Transform));
|
|
28
|
+
push(chunk, encoding) {
|
|
29
|
+
return super.push(chunk);
|
|
30
|
+
}
|
|
31
|
+
read(size) {
|
|
32
|
+
return super.read(size);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
59
35
|
exports.Stream = Stream;
|
|
60
36
|
//# sourceMappingURL=stream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../cloudant/features/stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../cloudant/features/stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,mCAAqD;AAErD,MAAa,MAAU,SAAQ,kBAAS;IACtC,YAAY,IAAuB;QACjC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI,EAAE,yDAAyD;YAC3E,aAAa,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAAQ,EAAE,QAAyB;QACtC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC,IAAa;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF;AAhBD,wBAgBC"}
|
package/cloudant/v1.d.ts
CHANGED
|
@@ -132,6 +132,8 @@ declare class CloudantV1 extends CloudantBaseService {
|
|
|
132
132
|
* and might repeat changes. Polling modes for this method work like polling modes for the changes feed.
|
|
133
133
|
*
|
|
134
134
|
* @param {Object} [params] - The parameters to send to the service.
|
|
135
|
+
* @param {boolean} [params.descending] - Query parameter to specify whether to return the documents in descending by
|
|
136
|
+
* key order.
|
|
135
137
|
* @param {string} [params.feed] - Query parameter to specify the changes feed type.
|
|
136
138
|
* @param {number} [params.heartbeat] - Query parameter to specify the period in milliseconds after which an empty
|
|
137
139
|
* line is sent in the results. Off by default and only applicable for
|
|
@@ -145,6 +147,8 @@ declare class CloudantV1 extends CloudantBaseService {
|
|
|
145
147
|
* * Switch to scheduled usage of one of the non-continuous changes feed types
|
|
146
148
|
* (`normal` or `longpoll`).
|
|
147
149
|
* * Use TCP keepalive.
|
|
150
|
+
* @param {number} [params.limit] - Query parameter to specify the number of returned documents to limit the result
|
|
151
|
+
* to.
|
|
148
152
|
* @param {number} [params.timeout] - Query parameter to specify the maximum period in milliseconds to wait for a
|
|
149
153
|
* change before the response is sent, even if there are no results. Only applicable for `longpoll` or `continuous`
|
|
150
154
|
* feeds. Default value is specified by `httpd/changes_timeout` configuration option. Note that `60000` value is also
|
|
@@ -2697,6 +2701,8 @@ declare namespace CloudantV1 {
|
|
|
2697
2701
|
}
|
|
2698
2702
|
/** Parameters for the `getDbUpdates` operation. */
|
|
2699
2703
|
interface GetDbUpdatesParams {
|
|
2704
|
+
/** Query parameter to specify whether to return the documents in descending by key order. */
|
|
2705
|
+
descending?: boolean;
|
|
2700
2706
|
/** Query parameter to specify the changes feed type. */
|
|
2701
2707
|
feed?: GetDbUpdatesConstants.Feed | string;
|
|
2702
2708
|
/** Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off
|
|
@@ -2713,6 +2719,8 @@ declare namespace CloudantV1 {
|
|
|
2713
2719
|
* * Use TCP keepalive.
|
|
2714
2720
|
*/
|
|
2715
2721
|
heartbeat?: number;
|
|
2722
|
+
/** Query parameter to specify the number of returned documents to limit the result to. */
|
|
2723
|
+
limit?: number;
|
|
2716
2724
|
/** Query parameter to specify the maximum period in milliseconds to wait for a change before the response is
|
|
2717
2725
|
* sent, even if there are no results. Only applicable for `longpoll` or `continuous` feeds. Default value is
|
|
2718
2726
|
* specified by `httpd/changes_timeout` configuration option. Note that `60000` value is also the default maximum
|