@ibm-cloud/cloudant 0.5.5 → 0.6.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 +695 -65
- package/auth/couchdbSessionAuthenticator.js +2 -1
- package/auth/couchdbSessionAuthenticator.js.map +1 -1
- package/cloudant/features/changesFollower.d.ts +148 -0
- package/cloudant/features/changesFollower.js +178 -0
- package/cloudant/features/changesFollower.js.map +1 -0
- package/cloudant/features/changesParamsHelper.d.ts +32 -0
- package/cloudant/features/changesParamsHelper.js +99 -0
- package/cloudant/features/changesParamsHelper.js.map +1 -0
- package/cloudant/features/changesResultItemStream.d.ts +24 -0
- package/cloudant/features/changesResultItemStream.js +61 -0
- package/cloudant/features/changesResultItemStream.js.map +1 -0
- package/cloudant/features/changesResultIterator.d.ts +46 -0
- package/cloudant/features/changesResultIterator.js +296 -0
- package/cloudant/features/changesResultIterator.js.map +1 -0
- package/cloudant/features/stream.d.ts +23 -0
- package/cloudant/features/stream.js +60 -0
- package/cloudant/features/stream.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/lib/cloudantBaseService.d.ts +3 -2
- package/lib/cloudantBaseService.js +7 -6
- package/lib/cloudantBaseService.js.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* © Copyright IBM Corporation 2022, 2023. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.ChangesResultIterableIterator = void 0;
|
|
55
|
+
var changesParamsHelper_1 = require("./changesParamsHelper");
|
|
56
|
+
var changesFollower_1 = require("./changesFollower");
|
|
57
|
+
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
58
|
+
var util_1 = require("util");
|
|
59
|
+
var TransientErrorSuppression;
|
|
60
|
+
(function (TransientErrorSuppression) {
|
|
61
|
+
/** @internal */
|
|
62
|
+
TransientErrorSuppression[TransientErrorSuppression["ALWAYS"] = 0] = "ALWAYS";
|
|
63
|
+
TransientErrorSuppression[TransientErrorSuppression["NEVER"] = 1] = "NEVER";
|
|
64
|
+
TransientErrorSuppression[TransientErrorSuppression["TIMER"] = 2] = "TIMER";
|
|
65
|
+
})(TransientErrorSuppression || (TransientErrorSuppression = {}));
|
|
66
|
+
var ChangesResultIterableIterator = /** @class */ (function () {
|
|
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
|
+
this.timeoutPromise = (0, util_1.promisify)(setTimeout);
|
|
73
|
+
this.cancelToken = 'CloudantChangesIteratorCancel';
|
|
74
|
+
this.doneResult = {
|
|
75
|
+
done: true,
|
|
76
|
+
value: undefined,
|
|
77
|
+
};
|
|
78
|
+
this.logger = (0, ibm_cloud_sdk_core_1.getNewLogger)('cloudant-node-sdk');
|
|
79
|
+
this.baseDelay = 100;
|
|
80
|
+
this.expRetryGate = Math.floor(Math.log2(changesParamsHelper_1.ChangesParamsHelper.LONGPOLL_TIMEOUT / this.baseDelay));
|
|
81
|
+
this.inflight = null;
|
|
82
|
+
// Default to "infinite"
|
|
83
|
+
this.pending = Number.MAX_VALUE;
|
|
84
|
+
this.stopped = false;
|
|
85
|
+
this.retry = 0;
|
|
86
|
+
this.client = client;
|
|
87
|
+
this.params = params;
|
|
88
|
+
this.mode = mode;
|
|
89
|
+
this.errorTolerance = errorTolerance;
|
|
90
|
+
if (this.params.limit !== undefined) {
|
|
91
|
+
this.logger.debug("Applying changes limit ".concat(this.params.limit));
|
|
92
|
+
this.countDown = this.params.limit;
|
|
93
|
+
}
|
|
94
|
+
if (this.errorTolerance === 0) {
|
|
95
|
+
this.transientErrorSuppression = TransientErrorSuppression.NEVER;
|
|
96
|
+
this.logger.debug('Not suppressing errors.');
|
|
97
|
+
}
|
|
98
|
+
else if (this.errorTolerance === Number.MAX_VALUE) {
|
|
99
|
+
this.transientErrorSuppression = TransientErrorSuppression.ALWAYS;
|
|
100
|
+
this.logger.debug('Maximum error suppression.');
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.transientErrorSuppression = TransientErrorSuppression.TIMER;
|
|
104
|
+
this.logger.debug("Suppress errors for ".concat(this.errorTolerance, " ms."));
|
|
105
|
+
}
|
|
106
|
+
if (this.params.since === undefined) {
|
|
107
|
+
this.since = this.mode === changesFollower_1.Mode.LISTEN ? 'now' : '0';
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.since = this.params.since;
|
|
111
|
+
}
|
|
112
|
+
this.promisedConfig = this.configure();
|
|
113
|
+
this.successTimestamp = Date.now();
|
|
114
|
+
}
|
|
115
|
+
ChangesResultIterableIterator.prototype.configure = function () {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var _this = this;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
if (this.params.includeDocs) {
|
|
120
|
+
return [2 /*return*/, this.client
|
|
121
|
+
.getDatabaseInformation({
|
|
122
|
+
db: this.params.db,
|
|
123
|
+
})
|
|
124
|
+
.then(function (info) {
|
|
125
|
+
if (info.result &&
|
|
126
|
+
'doc_count' in info.result &&
|
|
127
|
+
info.result.doc_count > 0 &&
|
|
128
|
+
'sizes' in info.result &&
|
|
129
|
+
'external' in info.result.sizes &&
|
|
130
|
+
info.result.sizes.external > 0) {
|
|
131
|
+
// Calculate an average doc size + typical change content size
|
|
132
|
+
// and try to keep each batch to be about 5 MB
|
|
133
|
+
_this.params.limit =
|
|
134
|
+
Math.floor((5 * 1024 * 1024) /
|
|
135
|
+
(info.result.sizes.external / info.result.doc_count + 500)) || 1;
|
|
136
|
+
}
|
|
137
|
+
})];
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.params.limit = changesFollower_1.ChangesFollower.BATCH_SIZE;
|
|
141
|
+
return [2 /*return*/, Promise.resolve()];
|
|
142
|
+
}
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
ChangesResultIterableIterator.prototype[Symbol.asyncIterator] = function () {
|
|
148
|
+
return this;
|
|
149
|
+
};
|
|
150
|
+
ChangesResultIterableIterator.prototype.return = function (value) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
this.logger.debug('Iterator return entry.');
|
|
154
|
+
if (!this.stopped) {
|
|
155
|
+
this.logger.debug('Setting stopped flag.');
|
|
156
|
+
this.stopped = true;
|
|
157
|
+
if (this.inflight) {
|
|
158
|
+
this.logger.debug('Cancelling inflight requests.');
|
|
159
|
+
this.cancel(new Error(this.cancelToken));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this.logger.debug('Iterator return exiting done.');
|
|
163
|
+
return [2 /*return*/, this.doneResult];
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
ChangesResultIterableIterator.prototype.next = function (value) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
169
|
+
var _this = this;
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
this.logger.debug('Iterator next entry.');
|
|
174
|
+
// Stop the iterator if stopped is set to true.
|
|
175
|
+
if (this.stopped) {
|
|
176
|
+
this.logger.debug('Already stopped, iterator next exiting done.');
|
|
177
|
+
return [2 /*return*/, this.doneResult];
|
|
178
|
+
}
|
|
179
|
+
// Await the async config and also
|
|
180
|
+
// yield to the event loop so our long-running requests don't enqueue
|
|
181
|
+
// more long-running requests on the same microtask queue and
|
|
182
|
+
// end up blocking I/O.
|
|
183
|
+
return [4 /*yield*/, Promise.all([
|
|
184
|
+
this.promisedConfig,
|
|
185
|
+
new Promise(function (resolve) { return setImmediate(resolve); }),
|
|
186
|
+
])];
|
|
187
|
+
case 1:
|
|
188
|
+
// Await the async config and also
|
|
189
|
+
// yield to the event loop so our long-running requests don't enqueue
|
|
190
|
+
// more long-running requests on the same microtask queue and
|
|
191
|
+
// end up blocking I/O.
|
|
192
|
+
_a.sent();
|
|
193
|
+
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.');
|
|
219
|
+
_this.stopped = true;
|
|
220
|
+
}
|
|
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;
|
|
275
|
+
}
|
|
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];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
return ChangesResultIterableIterator;
|
|
294
|
+
}());
|
|
295
|
+
exports.ChangesResultIterableIterator = ChangesResultIterableIterator;
|
|
296
|
+
//# sourceMappingURL=changesResultIterator.js.map
|
|
@@ -0,0 +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,EAAE,IAAI;YACV,KAAK,EAAE,SAAS;SACjB,CAAC;QAIe,WAAM,GAAG,IAAA,iCAAY,EAAC,mBAAmB,CAAC,CAAC;QAQ3C,cAAS,GAAW,GAAG,CAAC;QAExB,iBAAY,GAAW,IAAI,CAAC,KAAK,CAChD,IAAI,CAAC,IAAI,CAAC,yCAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,CACjE,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CAC9D,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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* © Copyright IBM Corporation 2022. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* 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
|
+
/// <reference types="node" />
|
|
17
|
+
/// <reference types="node" />
|
|
18
|
+
import { Transform, TransformOptions } from 'stream';
|
|
19
|
+
export declare class Stream<T> extends Transform {
|
|
20
|
+
constructor(opts?: TransformOptions);
|
|
21
|
+
push(chunk: T, encoding?: BufferEncoding): boolean;
|
|
22
|
+
read(size?: number): T;
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* © Copyright IBM Corporation 2022. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.Stream = void 0;
|
|
45
|
+
var stream_1 = require("stream");
|
|
46
|
+
var Stream = /** @class */ (function (_super) {
|
|
47
|
+
__extends(Stream, _super);
|
|
48
|
+
function Stream(opts) {
|
|
49
|
+
return _super.call(this, __assign(__assign({}, opts), { objectMode: true, highWaterMark: 1 })) || this;
|
|
50
|
+
}
|
|
51
|
+
Stream.prototype.push = function (chunk, encoding) {
|
|
52
|
+
return _super.prototype.push.call(this, chunk);
|
|
53
|
+
};
|
|
54
|
+
Stream.prototype.read = function (size) {
|
|
55
|
+
return _super.prototype.read.call(this, size);
|
|
56
|
+
};
|
|
57
|
+
return Stream;
|
|
58
|
+
}(stream_1.Transform));
|
|
59
|
+
exports.Stream = Stream;
|
|
60
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../cloudant/features/stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAAqD;AAErD;IAA+B,0BAAS;IACtC,gBAAY,IAAuB;eACjC,wCACK,IAAI,KACP,UAAU,EAAE,IAAI,EAChB,aAAa,EAAE,CAAC,IAChB;IACJ,CAAC;IAED,qBAAI,GAAJ,UAAK,KAAQ,EAAE,QAAyB;QACtC,OAAO,iBAAM,IAAI,YAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,qBAAI,GAAJ,UAAK,IAAa;QAChB,OAAO,iBAAM,IAAI,YAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACH,aAAC;AAAD,CAAC,AAhBD,CAA+B,kBAAS,GAgBvC;AAhBY,wBAAM"}
|
package/index.d.ts
CHANGED
|
@@ -18,3 +18,5 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export import CloudantV1 = require('./cloudant/v1');
|
|
20
20
|
export { BasicAuthenticator, IamAuthenticator, CouchdbSessionAuthenticator, } from './auth';
|
|
21
|
+
export { ChangesFollower } from './cloudant/features/changesFollower';
|
|
22
|
+
export { Stream } from './cloudant/features/stream';
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.CouchdbSessionAuthenticator = exports.IamAuthenticator = exports.BasicAuthenticator = void 0;
|
|
18
|
+
exports.Stream = exports.ChangesFollower = exports.CouchdbSessionAuthenticator = exports.IamAuthenticator = exports.BasicAuthenticator = void 0;
|
|
19
19
|
/**
|
|
20
20
|
* @module cloudant-node-sdk
|
|
21
21
|
*/
|
|
@@ -24,4 +24,8 @@ var auth_1 = require("./auth");
|
|
|
24
24
|
Object.defineProperty(exports, "BasicAuthenticator", { enumerable: true, get: function () { return auth_1.BasicAuthenticator; } });
|
|
25
25
|
Object.defineProperty(exports, "IamAuthenticator", { enumerable: true, get: function () { return auth_1.IamAuthenticator; } });
|
|
26
26
|
Object.defineProperty(exports, "CouchdbSessionAuthenticator", { enumerable: true, get: function () { return auth_1.CouchdbSessionAuthenticator; } });
|
|
27
|
+
var changesFollower_1 = require("./cloudant/features/changesFollower");
|
|
28
|
+
Object.defineProperty(exports, "ChangesFollower", { enumerable: true, get: function () { return changesFollower_1.ChangesFollower; } });
|
|
29
|
+
var stream_1 = require("./cloudant/features/stream");
|
|
30
|
+
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return stream_1.Stream; } });
|
|
27
31
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,8CAAoD;AAEpD,+BAIgB;AAHd,0GAAA,kBAAkB,OAAA;AAClB,wGAAA,gBAAgB,OAAA;AAChB,mHAAA,2BAA2B,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,8CAAoD;AAEpD,+BAIgB;AAHd,0GAAA,kBAAkB,OAAA;AAClB,wGAAA,gBAAgB,OAAA;AAChB,mHAAA,2BAA2B,OAAA;AAG7B,uEAAsE;AAA7D,kHAAA,eAAe,OAAA;AACxB,qDAAoD;AAA3C,gGAAA,MAAM,OAAA"}
|
|
@@ -21,14 +21,15 @@ import { BaseService, UserOptions } from 'ibm-cloud-sdk-core';
|
|
|
21
21
|
* during service requests.
|
|
22
22
|
*/
|
|
23
23
|
export default abstract class CloudantBaseService extends BaseService {
|
|
24
|
+
timeout: number;
|
|
24
25
|
/**
|
|
25
26
|
* Configuration values to use Cloudant service.
|
|
26
27
|
* @param {Authenticator} userOptions.authenticator CouchdbSessionAuthenticator object can be used
|
|
27
28
|
* to authenticate requests to the service.
|
|
28
|
-
* @param {string} [userOptions.jar]
|
|
29
|
-
* must be in use. So a new jar will be created, if there is no custom one.
|
|
29
|
+
* @param {string} [userOptions.jar] A Cookie Jar. Enabled by default if there is no custom one.
|
|
30
30
|
*/
|
|
31
31
|
constructor(userOptions: UserOptions);
|
|
32
|
+
getTimeout(): number;
|
|
32
33
|
/**
|
|
33
34
|
* Set the service URL to send requests to and
|
|
34
35
|
* use the new service URL for CouchDB Session Authentication
|
|
@@ -38,7 +38,7 @@ var common_1 = require("./common");
|
|
|
38
38
|
var https_1 = require("https");
|
|
39
39
|
var http_1 = require("http");
|
|
40
40
|
/**
|
|
41
|
-
* Set default timeout to 2.5 minutes (=
|
|
41
|
+
* Set default timeout to 2.5 minutes (= 150 000 ms)
|
|
42
42
|
*/
|
|
43
43
|
var READ_TIMEOUT = 150000;
|
|
44
44
|
/**
|
|
@@ -109,22 +109,23 @@ var CloudantBaseService = /** @class */ (function (_super) {
|
|
|
109
109
|
* Configuration values to use Cloudant service.
|
|
110
110
|
* @param {Authenticator} userOptions.authenticator CouchdbSessionAuthenticator object can be used
|
|
111
111
|
* to authenticate requests to the service.
|
|
112
|
-
* @param {string} [userOptions.jar]
|
|
113
|
-
* must be in use. So a new jar will be created, if there is no custom one.
|
|
112
|
+
* @param {string} [userOptions.jar] A Cookie Jar. Enabled by default if there is no custom one.
|
|
114
113
|
*/
|
|
115
114
|
function CloudantBaseService(userOptions) {
|
|
116
115
|
var _this = this;
|
|
117
|
-
|
|
118
|
-
userOptions.jar = userOptions.jar || new tough_cookie_1.CookieJar();
|
|
119
|
-
}
|
|
116
|
+
userOptions.jar = userOptions.jar || new tough_cookie_1.CookieJar();
|
|
120
117
|
if (!('timeout' in userOptions)) {
|
|
121
118
|
userOptions.timeout = READ_TIMEOUT;
|
|
122
119
|
}
|
|
123
120
|
CloudantBaseService.setDefaultAgentsIfUnset(userOptions);
|
|
124
121
|
_this = _super.call(this, userOptions) || this;
|
|
122
|
+
_this.timeout = userOptions.timeout;
|
|
125
123
|
_this.configureSessionAuthenticator();
|
|
126
124
|
return _this;
|
|
127
125
|
}
|
|
126
|
+
CloudantBaseService.prototype.getTimeout = function () {
|
|
127
|
+
return this.timeout;
|
|
128
|
+
};
|
|
128
129
|
/**
|
|
129
130
|
* Set the service URL to send requests to and
|
|
130
131
|
* use the new service URL for CouchDB Session Authentication
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudantBaseService.js","sourceRoot":"","sources":["../../lib/cloudantBaseService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAEH,gDAAgD;AAChD,yDAA6E;AAC7E,6CAAyC;AACzC,gCAAsD;AACtD,mCAAyC;AACzC,+BAA4C;AAC5C,6BAA0C;AAE1C;;GAEG;AACH,IAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"cloudantBaseService.js","sourceRoot":"","sources":["../../lib/cloudantBaseService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;AAEH,gDAAgD;AAChD,yDAA6E;AAC7E,6CAAyC;AACzC,gCAAsD;AACtD,mCAAyC;AACzC,+BAA4C;AAC5C,6BAA0C;A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AG,CAAC,CAAC;qBAC1C;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC,CAAC,CAAC;gBACH,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC5B,IAAM,GAAG,GAAG,IAAI,yBAAyB,CACvC,UAAG,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,cACpC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,0CAChB,CACxC,CAAC;oBACF,GAAG,CAAC,IAAI,GAAG,uBAAuB,CAAC;oBACnC,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;iBAC5B;aACF;SACF;QACD,OAAO,iBAAM,aAAa,YAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEc,2CAAuB,GAAtC,UAAuC,OAAoB;QACzD,IAAM,2BAA2B,GAAG;YAClC,SAAS,EAAE,IAAI;SAChB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,OAAO,CAAC,SAAS,GAAG,IAAI,YAAS,CAAC,2BAA2B,CAAC,CAAC;SAChE;QACD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,OAAO,CAAC,UAAU,GAAG,IAAI,aAAU,CAAC,2BAA2B,CAAC,CAAC;SAClE;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AA7ID,CAA0D,gCAAW,GA6IpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibm-cloud/cloudant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "IBM Cloudant Node.js SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -26,41 +26,41 @@
|
|
|
26
26
|
"test": "npm run build && npm run lint && jest --runInBand test/",
|
|
27
27
|
"test-unit": "npm run build && jest --runInBand test/unit/",
|
|
28
28
|
"test-integration": "npm run build && jest --runInBand test/integration",
|
|
29
|
-
"test-
|
|
30
|
-
"test-unit-
|
|
31
|
-
"test-integration-
|
|
29
|
+
"test-ci": "jest --runInBand --testNamePattern='^((?!@slow).)*$' test/",
|
|
30
|
+
"test-unit-ci": "jest --runInBand test/unit/",
|
|
31
|
+
"test-integration-ci": "jest --runInBand --no-colors --testNamePattern='^((?!@slow).)*$' --json test/integration > test-output.log"
|
|
32
32
|
},
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": "^16 || ^18"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@types/node": "16.18.
|
|
38
|
+
"@types/node": "16.18.46",
|
|
39
39
|
"ibm-cloud-sdk-core": "4.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/jest": "29.5.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
44
|
-
"@typescript-eslint/parser": "5.
|
|
42
|
+
"@types/jest": "29.5.4",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "6.5.0",
|
|
44
|
+
"@typescript-eslint/parser": "6.5.0",
|
|
45
45
|
"dotenv": "16.3.1",
|
|
46
|
-
"eslint": "8.
|
|
46
|
+
"eslint": "8.48.0",
|
|
47
47
|
"eslint-config-airbnb-base": "15.0.0",
|
|
48
|
-
"eslint-config-airbnb-typescript": "17.
|
|
49
|
-
"eslint-config-prettier": "
|
|
50
|
-
"eslint-import-resolver-typescript": "3.
|
|
48
|
+
"eslint-config-airbnb-typescript": "17.1.0",
|
|
49
|
+
"eslint-config-prettier": "9.0.0",
|
|
50
|
+
"eslint-import-resolver-typescript": "3.6.0",
|
|
51
51
|
"eslint-plugin-header": "3.1.1",
|
|
52
|
-
"eslint-plugin-import": "2.
|
|
53
|
-
"eslint-plugin-jest": "27.2.
|
|
54
|
-
"eslint-plugin-jsdoc": "46.
|
|
52
|
+
"eslint-plugin-import": "2.28.0",
|
|
53
|
+
"eslint-plugin-jest": "27.2.3",
|
|
54
|
+
"eslint-plugin-jsdoc": "46.5.0",
|
|
55
55
|
"eslint-plugin-node": "11.1.0",
|
|
56
|
-
"eslint-plugin-prettier": "
|
|
57
|
-
"jest": "29.6.
|
|
56
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
57
|
+
"jest": "29.6.4",
|
|
58
58
|
"jest-junit": "16.0.0",
|
|
59
|
-
"prettier": "
|
|
59
|
+
"prettier": "3.0.3",
|
|
60
60
|
"sinon": "15.2.0",
|
|
61
61
|
"ts-jest": "29.1.1",
|
|
62
|
-
"typedoc": "0.
|
|
63
|
-
"typescript": "5.
|
|
62
|
+
"typedoc": "0.25.0",
|
|
63
|
+
"typescript": "5.2.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@types/tough-cookie": "^4.0.0",
|