@ibm-cloud/cloudant 0.8.1 → 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 +11 -3
- package/cloudant/v1.js +1407 -1428
- 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 +13 -12
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://github.com/IBM/cloudant-node-sdk/releases/latest)
|
|
3
3
|
[](https://ibm.github.io/cloudant-node-sdk/)
|
|
4
4
|
|
|
5
|
-
# IBM Cloudant Node.js SDK Version 0.8.
|
|
5
|
+
# IBM Cloudant Node.js SDK Version 0.8.3
|
|
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).
|
|
@@ -296,7 +296,7 @@ Once the environment variables are set, you can try out the code examples.
|
|
|
296
296
|
<summary>TypeScript:</summary>
|
|
297
297
|
|
|
298
298
|
```ts
|
|
299
|
-
import { CloudantV1 } from
|
|
299
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
300
300
|
```
|
|
301
301
|
[embedmd]:# (test/examples/src/ts/CreateDbAndDoc.ts /interface/ $)
|
|
302
302
|
```ts
|
|
@@ -376,7 +376,7 @@ createDb.then(() => {
|
|
|
376
376
|
<summary>JavaScript:</summary>
|
|
377
377
|
|
|
378
378
|
```js
|
|
379
|
-
|
|
379
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
380
380
|
```
|
|
381
381
|
[embedmd]:# (test/examples/src/js/CreateDbAndDoc.js /const createDbAndDoc/ /createDbAndDoc\(\);\n\}/)
|
|
382
382
|
```js
|
|
@@ -477,7 +477,7 @@ database or 'example' document was not found."
|
|
|
477
477
|
<summary>TypeScript:</summary>
|
|
478
478
|
|
|
479
479
|
```ts
|
|
480
|
-
import { CloudantV1 } from
|
|
480
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
481
481
|
```
|
|
482
482
|
[embedmd]:# (test/examples/src/ts/GetInfoFromExistingDatabase.ts /\/\/ 1./ $)
|
|
483
483
|
```ts
|
|
@@ -526,7 +526,7 @@ client.getDocument(getDocParams).then((documentExample) => {
|
|
|
526
526
|
<summary>JavaScript:</summary>
|
|
527
527
|
|
|
528
528
|
```js
|
|
529
|
-
|
|
529
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
530
530
|
```
|
|
531
531
|
[embedmd]:# (test/examples/src/js/GetInfoFromExistingDatabase.js /const getInfoFromExistingDatabase/ /getInfoFromExistingDatabase\(\);\n\}/)
|
|
532
532
|
```js
|
|
@@ -605,7 +605,7 @@ database or 'example' document was not found."
|
|
|
605
605
|
<summary>TypeScript:</summary>
|
|
606
606
|
|
|
607
607
|
```ts
|
|
608
|
-
import { CloudantV1 } from
|
|
608
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
609
609
|
```
|
|
610
610
|
[embedmd]:# (test/examples/src/ts/UpdateDoc.ts /interface/ $)
|
|
611
611
|
```ts
|
|
@@ -700,7 +700,7 @@ client
|
|
|
700
700
|
<summary>JavaScript:</summary>
|
|
701
701
|
|
|
702
702
|
```js
|
|
703
|
-
|
|
703
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
704
704
|
```
|
|
705
705
|
[embedmd]:# (test/examples/src/js/UpdateDoc.js /const updateDoc/ /updateDoc\(\);\n\}/)
|
|
706
706
|
```js
|
|
@@ -824,7 +824,7 @@ database or 'example' document was not found."
|
|
|
824
824
|
<summary>TypeScript:</summary>
|
|
825
825
|
|
|
826
826
|
```ts
|
|
827
|
-
import { CloudantV1 } from
|
|
827
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
828
828
|
```
|
|
829
829
|
[embedmd]:# (test/examples/src/ts/DeleteDoc.ts /interface/ $)
|
|
830
830
|
```ts
|
|
@@ -880,7 +880,7 @@ client
|
|
|
880
880
|
<summary>JavaScript:</summary>
|
|
881
881
|
|
|
882
882
|
```js
|
|
883
|
-
|
|
883
|
+
import { CloudantV1 } from '@ibm-cloud/cloudant';
|
|
884
884
|
```
|
|
885
885
|
[embedmd]:# (test/examples/src/js/DeleteDoc.js /const deleteDoc/ /deleteDoc\(\);\n\}/)
|
|
886
886
|
```js
|
|
@@ -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.8.
|
|
938
|
+
For a complete list of code examples, see the [examples directory](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.3/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.8.
|
|
1036
|
+
write code to use the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.3/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.8.
|
|
1071
|
+
may be achieved by using the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.3/examples#postchanges).
|
|
1072
1072
|
|
|
1073
1073
|
#### Checkpointing
|
|
1074
1074
|
|
|
@@ -1124,7 +1124,7 @@ const changesFollower: ChangesFollower = new ChangesFollower(
|
|
|
1124
1124
|
<summary>JavaScript:</summary>
|
|
1125
1125
|
|
|
1126
1126
|
```js
|
|
1127
|
-
|
|
1127
|
+
import { ChangesFollower, CloudantV1 } from '@ibm-cloud/cloudant';
|
|
1128
1128
|
```
|
|
1129
1129
|
[embedmd]:# (test/examples/src/features/js/initialize.js /const client/ $)
|
|
1130
1130
|
```js
|
|
@@ -1170,7 +1170,7 @@ const changesItemsStream: Stream<ChangesResultItem> = changesFollower.start();
|
|
|
1170
1170
|
<summary>JavaScript:</summary>
|
|
1171
1171
|
|
|
1172
1172
|
```js
|
|
1173
|
-
|
|
1173
|
+
import { ChangesFollower, CloudantV1 } from '@ibm-cloud/cloudant';
|
|
1174
1174
|
```
|
|
1175
1175
|
[embedmd]:# (test/examples/src/features/js/start.js /const client/ $)
|
|
1176
1176
|
```js
|
|
@@ -1211,7 +1211,7 @@ const changesItemsStream: Stream<ChangesResultItem> = changesFollower.startOneOf
|
|
|
1211
1211
|
<summary>JavaScript:</summary>
|
|
1212
1212
|
|
|
1213
1213
|
```js
|
|
1214
|
-
|
|
1214
|
+
import { ChangesFollower, CloudantV1 } from '@ibm-cloud/cloudant';
|
|
1215
1215
|
```
|
|
1216
1216
|
[embedmd]:# (test/examples/src/features/js/startOneOff.js /const client/ $)
|
|
1217
1217
|
```js
|
|
@@ -1284,9 +1284,9 @@ pipeline(changesItemsStream, destinationStream)
|
|
|
1284
1284
|
<summary>JavaScript:</summary>
|
|
1285
1285
|
|
|
1286
1286
|
```js
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1287
|
+
import { ChangesFollower, CloudantV1 } from '@ibm-cloud/cloudant';
|
|
1288
|
+
import { Writable } from 'node:stream';
|
|
1289
|
+
import { pipeline } from 'node:stream/promises';
|
|
1290
1290
|
```
|
|
1291
1291
|
[embedmd]:# (test/examples/src/features/js/startAndProcess.js /const client/ $)
|
|
1292
1292
|
```js
|
|
@@ -1403,9 +1403,9 @@ async function getChangesFromFollower(changesItemsStream: Stream<CloudantV1.Chan
|
|
|
1403
1403
|
<summary>JavaScript:</summary>
|
|
1404
1404
|
|
|
1405
1405
|
```js
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1406
|
+
import { ChangesFollower, CloudantV1 } from '@ibm-cloud/cloudant';
|
|
1407
|
+
import { Writable } from 'node:stream';
|
|
1408
|
+
import { pipeline } from 'node:stream/promises';
|
|
1409
1409
|
```
|
|
1410
1410
|
[embedmd]:# (test/examples/src/features/js/startOneOffAndProcess.js /const client/ $)
|
|
1411
1411
|
```js
|
|
@@ -1521,9 +1521,9 @@ setTimeout(() => {
|
|
|
1521
1521
|
<summary>JavaScript:</summary>
|
|
1522
1522
|
|
|
1523
1523
|
```js
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1524
|
+
import { ChangesFollower, CloudantV1 } from '@ibm-cloud/cloudant';
|
|
1525
|
+
import { Writable } from 'node:stream';
|
|
1526
|
+
import { pipeline } from 'node:stream/promises';
|
|
1527
1527
|
```
|
|
1528
1528
|
[embedmd]:# (test/examples/src/features/js/stop.js /const client/ $)
|
|
1529
1529
|
```js
|
|
@@ -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.8.
|
|
1582
|
+
[KNOWN_ISSUES file](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.3/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.8.
|
|
1612
|
+
For more information, see [CONTRIBUTING](https://github.com/IBM/cloudant-node-sdk/tree/v0.8.3/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.8.
|
|
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.3/LICENSE).
|
|
@@ -14,36 +14,10 @@
|
|
|
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.CouchdbSessionAuthenticator = void 0;
|
|
45
|
-
|
|
46
|
-
|
|
19
|
+
const ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
20
|
+
const sessionTokenManager_1 = require("./sessionTokenManager");
|
|
47
21
|
/**
|
|
48
22
|
* The CouchdbSessionAuthenticator is used to get CouchDB session authentication information to
|
|
49
23
|
* requests.
|
|
@@ -56,8 +30,11 @@ var sessionTokenManager_1 = require("./sessionTokenManager");
|
|
|
56
30
|
* Version=1; Path=/; HttpOnly; Secure
|
|
57
31
|
*
|
|
58
32
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
33
|
+
class CouchdbSessionAuthenticator extends ibm_cloud_sdk_core_1.Authenticator {
|
|
34
|
+
tokenManager;
|
|
35
|
+
requiredOptions;
|
|
36
|
+
tokenOptions;
|
|
37
|
+
static AUTHTYPE_COUCHDB_SESSION = 'COUCHDB_SESSION';
|
|
61
38
|
/**
|
|
62
39
|
* Create a new CouchdbSessionAuthenticator instance.
|
|
63
40
|
*
|
|
@@ -66,11 +43,10 @@ var CouchdbSessionAuthenticator = /** @class */ (function (_super) {
|
|
|
66
43
|
* @param {string} options.password The password portion of session authentication.
|
|
67
44
|
* @throws {Error} The configuration options are not valid.
|
|
68
45
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
(0, ibm_cloud_sdk_core_1.validateInput)(options,
|
|
72
|
-
|
|
73
|
-
return _this;
|
|
46
|
+
constructor(options) {
|
|
47
|
+
super();
|
|
48
|
+
(0, ibm_cloud_sdk_core_1.validateInput)(options, this.requiredOptions);
|
|
49
|
+
this.tokenOptions = { ...options };
|
|
74
50
|
}
|
|
75
51
|
/**
|
|
76
52
|
* Acquire a session token that will be stored in a Cookie Jar.
|
|
@@ -81,32 +57,32 @@ var CouchdbSessionAuthenticator = /** @class */ (function (_super) {
|
|
|
81
57
|
* @param {object.<string, string>} requestOptions.headers - The headers the
|
|
82
58
|
* authentication information will be added to.
|
|
83
59
|
*/
|
|
84
|
-
|
|
60
|
+
authenticate(requestOptions) {
|
|
85
61
|
return this.tokenManager.getToken();
|
|
86
|
-
}
|
|
62
|
+
}
|
|
87
63
|
/**
|
|
88
64
|
* Configure the TokenManager to use all the `request` settings
|
|
89
65
|
* together with the basic credentials.
|
|
90
66
|
*
|
|
91
67
|
* @param {object} userOptions - Configuration values for a `request` service.
|
|
92
68
|
*/
|
|
93
|
-
|
|
69
|
+
configure(userOptions) {
|
|
94
70
|
// Merge the options
|
|
95
71
|
Object.assign(this.tokenOptions, userOptions);
|
|
96
72
|
// START monkey patch for https://github.com/salesforce/tough-cookie/issues/154
|
|
97
73
|
// Check if we've already patched the jar
|
|
98
|
-
|
|
74
|
+
const cookieJar = this.tokenOptions.jar;
|
|
99
75
|
if (cookieJar && !cookieJar.cloudantPatch) {
|
|
100
76
|
// Set the patching flag
|
|
101
77
|
cookieJar.cloudantPatch = true;
|
|
102
78
|
// Replace the store's updateCookie function with one that applies a patch to newCookie
|
|
103
|
-
|
|
79
|
+
const originalUpdateCookieFn = cookieJar.store.updateCookie;
|
|
104
80
|
cookieJar.store.updateCookie = function updateCookie(oldCookie, newCookie, cb) {
|
|
105
81
|
// Add current time as an update timestamp to the newCookie
|
|
106
82
|
newCookie.cloudantPatchUpdateTime = new Date();
|
|
107
83
|
// Replace the cookie's expiryTime function with one that uses cloudantPatchUpdateTime
|
|
108
84
|
// in place of creation time to check the expiry.
|
|
109
|
-
|
|
85
|
+
const originalExpiryTimeFn = newCookie.expiryTime;
|
|
110
86
|
newCookie.expiryTime = function expiryTime(now) {
|
|
111
87
|
// The original expiryTime check is relative to a time in this order:
|
|
112
88
|
// 1. supplied now argument
|
|
@@ -119,8 +95,8 @@ var CouchdbSessionAuthenticator = /** @class */ (function (_super) {
|
|
|
119
95
|
// Finally, delegate back to the original update function or the fallback put (which is set by Cookie
|
|
120
96
|
// when an update function is not present on the store). Since we always set an update function for our
|
|
121
97
|
// patch we need to also provide that fallback.
|
|
122
|
-
if (
|
|
123
|
-
|
|
98
|
+
if (originalUpdateCookieFn) {
|
|
99
|
+
originalUpdateCookieFn.call(cookieJar.store, oldCookie, newCookie, cb);
|
|
124
100
|
}
|
|
125
101
|
else {
|
|
126
102
|
cookieJar.store.putCookie.call(cookieJar.store, newCookie, cb);
|
|
@@ -130,18 +106,16 @@ var CouchdbSessionAuthenticator = /** @class */ (function (_super) {
|
|
|
130
106
|
// END cookie jar monkey patch
|
|
131
107
|
// Set the token manager
|
|
132
108
|
this.tokenManager = new sessionTokenManager_1.SessionTokenManager(this.tokenOptions);
|
|
133
|
-
}
|
|
109
|
+
}
|
|
134
110
|
/**
|
|
135
111
|
* Returns the authenticator's type ('COUCHDB_SESSION').
|
|
136
112
|
*
|
|
137
113
|
* @returns a string that indicates the authenticator's type
|
|
138
114
|
*/
|
|
139
115
|
// eslint-disable-next-line class-methods-use-this
|
|
140
|
-
|
|
116
|
+
authenticationType() {
|
|
141
117
|
return CouchdbSessionAuthenticator.AUTHTYPE_COUCHDB_SESSION;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return CouchdbSessionAuthenticator;
|
|
145
|
-
}(ibm_cloud_sdk_core_1.Authenticator));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
146
120
|
exports.CouchdbSessionAuthenticator = CouchdbSessionAuthenticator;
|
|
147
121
|
//# sourceMappingURL=couchdbSessionAuthenticator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"couchdbSessionAuthenticator.js","sourceRoot":"","sources":["../../auth/couchdbSessionAuthenticator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"couchdbSessionAuthenticator.js","sourceRoot":"","sources":["../../auth/couchdbSessionAuthenticator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAA+E;AAC/E,+DAG+B;AAoB/B;;;;;;;;;;;GAWG;AACH,MAAa,2BAA4B,SAAQ,kCAAa;IAClD,YAAY,CAAsB;IAElC,eAAe,CAA2B;IAE5C,YAAY,CAA6B;IAEjD,MAAM,CAAU,wBAAwB,GAAG,iBAAiB,CAAC;IAE7D;;;;;;;OAOG;IACH,YAAY,OAA2C;QACrD,KAAK,EAAE,CAAC;QACR,IAAA,kCAAa,EAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7C,IAA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C,KAAK,EACf,SAAS,EACT,SAAS,EACT,EAAE,CACH,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;QACD,8BAA8B;QAE9B,wBAAwB;QACxB,IAAI,CAAC,YAAY,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,kDAAkD;IAC3C,kBAAkB;QACvB,OAAO,2BAA2B,CAAC,wBAAwB,CAAC;IAC9D,CAAC;;AAzGH,kEA0GC"}
|
package/auth/index.d.ts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { NoAuthAuthenticator, BasicAuthenticator, IamAuthenticator, IamTokenManager, getAuthenticatorFromEnvironment, } from 'ibm-cloud-sdk-core';
|
|
17
|
-
export { CouchdbSessionAuthenticator } from './couchdbSessionAuthenticator';
|
|
17
|
+
export { CouchdbSessionAuthenticator, CouchdbSessionAuthenticatorOptions, } from './couchdbSessionAuthenticator';
|
|
18
18
|
export { SessionTokenManager } from './sessionTokenManager';
|
package/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../auth/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yDAM4B;AAL1B,yHAAA,mBAAmB,OAAA;AACnB,wHAAA,kBAAkB,OAAA;AAClB,sHAAA,gBAAgB,OAAA;AAChB,qHAAA,eAAe,OAAA;AACf,qIAAA,+BAA+B,OAAA;AAGjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../auth/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,yDAM4B;AAL1B,yHAAA,mBAAmB,OAAA;AACnB,wHAAA,kBAAkB,OAAA;AAClB,sHAAA,gBAAgB,OAAA;AAChB,qHAAA,eAAe,OAAA;AACf,qIAAA,+BAA+B,OAAA;AAGjC,6EAGuC;AAFrC,0IAAA,2BAA2B,OAAA;AAG7B,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA"}
|
|
@@ -14,32 +14,24 @@
|
|
|
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
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
18
|
exports.SessionTokenManager = void 0;
|
|
34
|
-
|
|
19
|
+
const ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
35
20
|
/**
|
|
36
21
|
* Token Manager of CouchDB session token.
|
|
37
22
|
*
|
|
38
23
|
* The Token Manager performs basic auth with username and password
|
|
39
24
|
* to acquire session tokens.
|
|
40
25
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
class SessionTokenManager extends ibm_cloud_sdk_core_1.TokenManager {
|
|
27
|
+
requiredOptions = [
|
|
28
|
+
'username',
|
|
29
|
+
'password',
|
|
30
|
+
'serviceUrl',
|
|
31
|
+
'jar',
|
|
32
|
+
];
|
|
33
|
+
tokenName;
|
|
34
|
+
options;
|
|
43
35
|
/**
|
|
44
36
|
* Create a new [[SessionTokenManager]] instance. For internal use by
|
|
45
37
|
* CouchdbSessionAuthenticator only.
|
|
@@ -56,18 +48,11 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
56
48
|
* outbound HTTP requests to token services.
|
|
57
49
|
* @constructor
|
|
58
50
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'serviceUrl',
|
|
65
|
-
'jar',
|
|
66
|
-
];
|
|
67
|
-
(0, ibm_cloud_sdk_core_1.validateInput)(options, _this.requiredOptions);
|
|
68
|
-
_this.options = options;
|
|
69
|
-
_this.tokenName = 'AuthSession';
|
|
70
|
-
return _this;
|
|
51
|
+
constructor(options) {
|
|
52
|
+
super(options);
|
|
53
|
+
(0, ibm_cloud_sdk_core_1.validateInput)(options, this.requiredOptions);
|
|
54
|
+
this.options = options;
|
|
55
|
+
this.tokenName = 'AuthSession';
|
|
71
56
|
}
|
|
72
57
|
/**
|
|
73
58
|
* Only base service specific headers are in use.
|
|
@@ -76,24 +61,24 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
76
61
|
* @returns {Error}
|
|
77
62
|
*/
|
|
78
63
|
// eslint-disable-next-line class-methods-use-this
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
setHeaders(headers) {
|
|
65
|
+
const errMsg = 'During CouchDB Session Authentication only `request` service headers are in use';
|
|
81
66
|
throw new Error(errMsg);
|
|
82
|
-
}
|
|
67
|
+
}
|
|
83
68
|
/**
|
|
84
69
|
* Request a session token using basic credentials.
|
|
85
70
|
*
|
|
86
71
|
* @returns {Promise}
|
|
87
72
|
*/
|
|
88
|
-
|
|
73
|
+
requestToken() {
|
|
89
74
|
if (!this.options.headers) {
|
|
90
75
|
this.options.headers = {};
|
|
91
76
|
}
|
|
92
77
|
// these cannot be overwritten
|
|
93
|
-
|
|
78
|
+
const parameters = {
|
|
94
79
|
options: {
|
|
95
80
|
headers: this.options.headers,
|
|
96
|
-
url:
|
|
81
|
+
url: `${this.options.serviceUrl}/_session`,
|
|
97
82
|
method: 'POST',
|
|
98
83
|
body: {
|
|
99
84
|
username: this.options.username,
|
|
@@ -102,7 +87,7 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
102
87
|
},
|
|
103
88
|
};
|
|
104
89
|
return this.requestWrapperInstance.sendRequest(parameters);
|
|
105
|
-
}
|
|
90
|
+
}
|
|
106
91
|
/**
|
|
107
92
|
* From the response parse and save session token into field `accessToken`.
|
|
108
93
|
* Calculate expiration and refresh time from the received response
|
|
@@ -112,16 +97,16 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
112
97
|
* @private
|
|
113
98
|
* @returns {void}
|
|
114
99
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
saveTokenInfo(tokenResponse) {
|
|
101
|
+
const sessionCookie = tokenResponse.headers['set-cookie'];
|
|
117
102
|
if (!Array.isArray(sessionCookie)) {
|
|
118
|
-
|
|
103
|
+
const err = 'Set-Cookie header not present in response';
|
|
119
104
|
throw new Error(err);
|
|
120
105
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
for (
|
|
106
|
+
let sessionToken = null;
|
|
107
|
+
let expireTime = null;
|
|
108
|
+
let refreshTime = null;
|
|
109
|
+
for (let i = 0; i < sessionCookie.length && sessionToken == null; i += 1) {
|
|
125
110
|
sessionToken = new RegExp('AuthSession=([^;]*);').exec(sessionCookie[i]);
|
|
126
111
|
if (sessionToken != null) {
|
|
127
112
|
expireTime = new RegExp('.*Expires=([^;]*);').exec(sessionCookie[i]);
|
|
@@ -129,11 +114,11 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
129
114
|
}
|
|
130
115
|
}
|
|
131
116
|
if (sessionToken == null) {
|
|
132
|
-
|
|
117
|
+
const err = 'Session token not present in response';
|
|
133
118
|
throw new Error(err);
|
|
134
119
|
}
|
|
135
|
-
this.accessToken = sessionToken
|
|
136
|
-
|
|
120
|
+
[, this.accessToken] = sessionToken;
|
|
121
|
+
const fractionOfTtl = 0.8;
|
|
137
122
|
if (expireTime == null) {
|
|
138
123
|
if (refreshTime == null) {
|
|
139
124
|
this.expireTime = 0;
|
|
@@ -149,11 +134,10 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
149
134
|
// Store expire time in seconds
|
|
150
135
|
this.expireTime = Date.parse(expireTime[1]) / 1000;
|
|
151
136
|
// Set refresh time from the expire time
|
|
152
|
-
|
|
137
|
+
const timeToLive = this.expireTime - (0, ibm_cloud_sdk_core_1.getCurrentTime)();
|
|
153
138
|
this.refreshTime = this.expireTime - timeToLive * (1.0 - fractionOfTtl);
|
|
154
139
|
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
}(ibm_cloud_sdk_core_1.TokenManager));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
158
142
|
exports.SessionTokenManager = SessionTokenManager;
|
|
159
143
|
//# sourceMappingURL=sessionTokenManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionTokenManager.js","sourceRoot":"","sources":["../../auth/sessionTokenManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"sessionTokenManager.js","sourceRoot":"","sources":["../../auth/sessionTokenManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,2DAK4B;AAU5B;;;;;GAKG;AACH,MAAa,mBAAoB,SAAQ,iCAAY;IACzC,eAAe,GAAa;QACpC,UAAU;QACV,UAAU;QACV,YAAY;QACZ,KAAK;KACN,CAAC;IAEM,SAAS,CAAS;IAElB,OAAO,CAA6B;IAE5C;;;;;;;;;;;;;;;OAeG;IACH,YAAY,OA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,mCAAc,GAAE,CAAC;YAC9D,CAAC;QACH,CAAC;aAAM,CAAC;YACN,+BAA+B;YAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YACnD,wCAAwC;YACxC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,IAAA,mCAAc,GAAE,CAAC;YACtD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,UAAU,GAAG,CAAC,GAAG,GAAG,aAAa,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;CACF;AA1HD,kDA0HC"}
|
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ChangesResultItem } from '../v1';
|
|
17
17
|
import { Stream } from './stream';
|
|
18
|
-
import { ChangesResultIterableIterator } from './changesResultIterator';
|
|
19
18
|
import CloudantV1 = require('../v1');
|
|
19
|
+
/** @internal */
|
|
20
20
|
export declare enum Mode {
|
|
21
|
-
/** @internal */
|
|
22
21
|
FINITE = 0,
|
|
23
22
|
LISTEN = 1
|
|
24
23
|
}
|
|
@@ -26,18 +25,18 @@ export declare enum Mode {
|
|
|
26
25
|
* A helper for using the changes feed.
|
|
27
26
|
*
|
|
28
27
|
* There are two modes of operation:
|
|
29
|
-
* * {@link
|
|
28
|
+
* * {@link startOneOff} to fetch the changes from the supplied since sequence
|
|
30
29
|
* until there are no further pending changes.
|
|
31
|
-
* * {@link
|
|
30
|
+
* * {@link start} to fetch the changes from the supplied since sequence and
|
|
32
31
|
* then continuing to listen indefinitely for further new changes.
|
|
33
32
|
*
|
|
34
33
|
* The starting sequence ID can be changed for either mode by using
|
|
35
34
|
* {@link CloudantV1.PostChangesParams.since}. By default when using:
|
|
36
|
-
* * {@link
|
|
37
|
-
* * {@link
|
|
35
|
+
* * {@link startOneOff} the feed will start from the beginning.
|
|
36
|
+
* * {@link start} the feed will start from "now".
|
|
38
37
|
*
|
|
39
38
|
* In either mode the {@link Stream} of changes can be terminated early by calling
|
|
40
|
-
* {@link
|
|
39
|
+
* {@link stop}.
|
|
41
40
|
*
|
|
42
41
|
* By default {@link ChangesFollower} will suppress transient errors indefinitely and
|
|
43
42
|
* endeavour to run to completion or listen forever. For applications where that
|
|
@@ -77,12 +76,13 @@ export declare enum Mode {
|
|
|
77
76
|
* configuration has sufficiently long timeouts.
|
|
78
77
|
*/
|
|
79
78
|
export declare class ChangesFollower {
|
|
79
|
+
/** @internal */
|
|
80
80
|
static BATCH_SIZE: number;
|
|
81
81
|
private readonly client;
|
|
82
82
|
private readonly params;
|
|
83
83
|
private readonly errorTolerance?;
|
|
84
84
|
private limit;
|
|
85
|
-
changesResultIterator
|
|
85
|
+
private changesResultIterator;
|
|
86
86
|
/**
|
|
87
87
|
* Create a new {@link ChangesFollower} using the supplied client and params that
|
|
88
88
|
* suppress transient errors and retry for as long as the given `errorTolerance` duration.
|
|
@@ -103,13 +103,13 @@ export declare class ChangesFollower {
|
|
|
103
103
|
* * a terminal error (e.g. unauthorized client).
|
|
104
104
|
* * transient errors occur for longer than the error suppression duration.
|
|
105
105
|
* * the number of changes received reaches the limit specified in the {@link CloudantV1.PostChangesParams} used to instantiate this {@link ChangesFollower}.
|
|
106
|
-
* * {@link
|
|
106
|
+
* * {@link stop} is called.
|
|
107
107
|
*
|
|
108
108
|
* The same change may be received more than once.
|
|
109
109
|
*
|
|
110
110
|
* @return {Stream} at least one {@link ChangesResultItem} per change
|
|
111
111
|
* @throws {Error} if:
|
|
112
|
-
* * {@link
|
|
112
|
+
* * {@link start} or {@link startOneOff} was already called.
|
|
113
113
|
* * a terminal error or unsuppressed transient error is received from the service when fetching changes.
|
|
114
114
|
*/
|
|
115
115
|
start(): Stream<ChangesResultItem>;
|
|
@@ -121,21 +121,21 @@ export declare class ChangesFollower {
|
|
|
121
121
|
* * a terminal error (e.g. unauthorized client).
|
|
122
122
|
* * transient errors occur for longer than the error suppression duration.
|
|
123
123
|
* * the number of changes received reaches the limit specified in the {@link CloudantV1.PostChangesParams} used to instantiate this {@link ChangesFollower}.
|
|
124
|
-
* * {@link
|
|
124
|
+
* * {@link stop} is called.
|
|
125
125
|
*
|
|
126
126
|
* The same change may be received more than once.
|
|
127
127
|
*
|
|
128
128
|
* @return {Stream} at least one {@link ChangesResultItem} per change
|
|
129
129
|
* @throws {Error} if:
|
|
130
|
-
* * {@link
|
|
130
|
+
* * {@link start} or {@link startOneOff} was already called.
|
|
131
131
|
* * a terminal error or unsuppressed transient error is received from the service when fetching changes.
|
|
132
132
|
*/
|
|
133
133
|
startOneOff(): Stream<ChangesResultItem>;
|
|
134
134
|
/**
|
|
135
135
|
* Stop this {@link ChangesFollower}.
|
|
136
136
|
*
|
|
137
|
-
* @throws {Error} if {@link
|
|
138
|
-
* or {@link
|
|
137
|
+
* @throws {Error} if {@link start}
|
|
138
|
+
* or {@link startOneOff} was not called first
|
|
139
139
|
*/
|
|
140
140
|
stop(): void;
|
|
141
141
|
/**
|