@ibm-cloud/cloudant 0.0.10 → 0.0.14
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/LICENSE +25 -0
- package/README.md +395 -275
- package/auth/couchdbSessionAuthenticator.d.ts +2 -2
- package/auth/couchdbSessionAuthenticator.js +2 -2
- package/auth/couchdbSessionAuthenticator.js.map +1 -1
- package/auth/index.d.ts +1 -1
- package/auth/index.js +2 -1
- package/auth/index.js.map +1 -1
- package/auth/sessionTokenManager.d.ts +2 -2
- package/auth/sessionTokenManager.js +14 -8
- package/auth/sessionTokenManager.js.map +1 -1
- package/cloudant/v1.d.ts +594 -517
- package/cloudant/v1.js +3111 -3290
- package/cloudant/v1.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/lib/cloudantBaseService.d.ts +10 -2
- package/lib/cloudantBaseService.js +16 -2
- package/lib/cloudantBaseService.js.map +1 -1
- package/lib/common.d.ts +1 -1
- package/lib/common.js +1 -1
- package/lib/common.js.map +1 -1
- package/lib/getAuthenticatorFromEnvCloudantExtension.d.ts +2 -2
- package/lib/getAuthenticatorFromEnvCloudantExtension.js +1 -1
- package/lib/getAuthenticatorFromEnvCloudantExtension.js.map +1 -1
- package/package.json +7 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* © Copyright IBM Corporation
|
|
2
|
+
* © Copyright IBM Corporation 2021. All Rights Reserved.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -36,7 +36,7 @@ export declare type CouchdbSessionAuthenticatorOptions = {
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class CouchdbSessionAuthenticator extends Authenticator {
|
|
38
38
|
protected tokenManager: SessionTokenManager;
|
|
39
|
-
protected requiredOptions: [
|
|
39
|
+
protected requiredOptions: ['username', 'password'];
|
|
40
40
|
private tokenOptions;
|
|
41
41
|
/**
|
|
42
42
|
* Create a new CouchdbSessionAuthenticator instance.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* © Copyright IBM Corporation
|
|
3
|
+
* © Copyright IBM Corporation 2021. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -18,7 +18,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
18
18
|
var extendStatics = function (d, b) {
|
|
19
19
|
extendStatics = Object.setPrototypeOf ||
|
|
20
20
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
21
|
-
function (d, b) { for (var p in b) if (
|
|
21
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
22
22
|
return extendStatics(d, b);
|
|
23
23
|
};
|
|
24
24
|
return function (d, b) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"couchdbSessionAuthenticator.js","sourceRoot":"","sources":["../../auth/couchdbSessionAuthenticator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH,yDAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"couchdbSessionAuthenticator.js","sourceRoot":"","sources":["../../auth/couchdbSessionAuthenticator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH,yDAA+E;AAC/E,6DAG+B;AAU/B;;;;;;;;;;;GAWG;AACH;IAAiD,+CAAa;IAK5D;;;;;;;OAOG;IACH,qCAAY,OAA2C;QAAvD,YACE,iBAAO,SAGR;QAFC,kCAAa,CAAC,OAAO,EAAE,KAAI,CAAC,eAAe,CAAC,CAAC;QAC7C,KAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;;IACjD,CAAC;IAED;;;;;;;;OAQG;IACI,kDAAY,GAAnB,UAAoB,cAAsB;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACI,+CAAS,GAAhB,UAAiB,WAAwB;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjE,CAAC;IACH,kCAAC;AAAD,CAAC,AA1CD,CAAiD,kCAAa,GA0C7D;AA1CY,kEAA2B"}
|
package/auth/index.d.ts
CHANGED
package/auth/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* © Copyright IBM Corporation 2020.
|
|
3
|
+
* © Copyright IBM Corporation 2020. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SessionTokenManager = exports.CouchdbSessionAuthenticator = exports.getAuthenticatorFromEnvironment = exports.IamTokenManager = exports.IamAuthenticator = exports.BasicAuthenticator = exports.NoAuthAuthenticator = void 0;
|
|
18
19
|
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
19
20
|
Object.defineProperty(exports, "NoAuthAuthenticator", { enumerable: true, get: function () { return ibm_cloud_sdk_core_1.NoAuthAuthenticator; } });
|
|
20
21
|
Object.defineProperty(exports, "BasicAuthenticator", { enumerable: true, get: function () { return ibm_cloud_sdk_core_1.BasicAuthenticator; } });
|
package/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../auth/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
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,6EAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* © Copyright IBM Corporation 2020.
|
|
2
|
+
* © Copyright IBM Corporation 2020. All Rights Reserved.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
/// <reference types="node" />
|
|
17
|
-
import { OutgoingHttpHeaders } from
|
|
17
|
+
import { OutgoingHttpHeaders } from 'http';
|
|
18
18
|
import { TokenManager, UserOptions } from 'ibm-cloud-sdk-core';
|
|
19
19
|
/** Configuration options for CouchDB session token retrieval. */
|
|
20
20
|
export interface SessionTokenManagerOptions extends UserOptions {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* © Copyright IBM Corporation 2020.
|
|
3
|
+
* © Copyright IBM Corporation 2020. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -18,7 +18,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
18
18
|
var extendStatics = function (d, b) {
|
|
19
19
|
extendStatics = Object.setPrototypeOf ||
|
|
20
20
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
21
|
-
function (d, b) { for (var p in b) if (
|
|
21
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
22
22
|
return extendStatics(d, b);
|
|
23
23
|
};
|
|
24
24
|
return function (d, b) {
|
|
@@ -56,7 +56,12 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
56
56
|
*/
|
|
57
57
|
function SessionTokenManager(options) {
|
|
58
58
|
var _this = _super.call(this, options) || this;
|
|
59
|
-
_this.requiredOptions = [
|
|
59
|
+
_this.requiredOptions = [
|
|
60
|
+
'username',
|
|
61
|
+
'password',
|
|
62
|
+
'serviceUrl',
|
|
63
|
+
'jar',
|
|
64
|
+
];
|
|
60
65
|
ibm_cloud_sdk_core_1.validateInput(options, _this.requiredOptions);
|
|
61
66
|
_this.options = options;
|
|
62
67
|
_this.tokenName = 'AuthSession';
|
|
@@ -89,9 +94,9 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
89
94
|
method: 'POST',
|
|
90
95
|
body: {
|
|
91
96
|
username: this.options.username,
|
|
92
|
-
password: this.options.password
|
|
93
|
-
}
|
|
94
|
-
}
|
|
97
|
+
password: this.options.password,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
95
100
|
};
|
|
96
101
|
return this.requestWrapperInstance.sendRequest(parameters);
|
|
97
102
|
};
|
|
@@ -133,7 +138,8 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
133
138
|
}
|
|
134
139
|
else {
|
|
135
140
|
this.expireTime = Number(refreshTime[1]) + ibm_cloud_sdk_core_1.getCurrentTime();
|
|
136
|
-
this.refreshTime =
|
|
141
|
+
this.refreshTime =
|
|
142
|
+
Number(refreshTime[1]) * fractionOfTtl + ibm_cloud_sdk_core_1.getCurrentTime();
|
|
137
143
|
}
|
|
138
144
|
}
|
|
139
145
|
else {
|
|
@@ -141,7 +147,7 @@ var SessionTokenManager = /** @class */ (function (_super) {
|
|
|
141
147
|
this.expireTime = Date.parse(expireTime[1]) / 1000;
|
|
142
148
|
// Set refresh time from the expire time
|
|
143
149
|
var timeToLive = this.expireTime - ibm_cloud_sdk_core_1.getCurrentTime();
|
|
144
|
-
this.refreshTime = this.expireTime -
|
|
150
|
+
this.refreshTime = this.expireTime - timeToLive * (1.0 - fractionOfTtl);
|
|
145
151
|
}
|
|
146
152
|
};
|
|
147
153
|
return SessionTokenManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionTokenManager.js","sourceRoot":"","sources":["../../auth/sessionTokenManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,
|
|
1
|
+
{"version":3,"file":"sessionTokenManager.js","sourceRoot":"","sources":["../../auth/sessionTokenManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAGH,yDAK4B;AAU5B;;;;;GAKG;AACH;IAAyC,uCAAY;IAUnD;;;;;;;;;;;;;;;OAeG;IACH,6BAAY,OAAmC;QAA/C,YACE,kBAAM,OAAO,CAAC,SAMf;QAhCS,qBAAe,GAAa;YACpC,UAAU;YACV,UAAU;YACV,YAAY;YACZ,KAAK;SACN,CAAC;QAuBA,kCAAa,CAAC,OAAO,EAAE,KAAI,CAAC,eAAe,CAAC,CAAC;QAE7C,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,SAAS,GAAG,aAAa,CAAC;;IACjC,CAAC;IAED;;;;;OAKG;IACI,wCAAU,GAAjB,UAAkB,OAA4B;QAC5C,IAAM,MAAM,GACV,iFAAiF,CAAC;QACpF,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACO,0CAAY,GAAtB;QACE,I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