@ibm-cloud/cloudant 0.8.2 → 0.9.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 +31 -31
- 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 +1330 -267
- package/cloudant/v1.js +7353 -1508
- 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 +17 -16
package/index.d.ts
CHANGED
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
* @module cloudant-node-sdk
|
|
18
18
|
*/
|
|
19
19
|
export import CloudantV1 = require('./cloudant/v1');
|
|
20
|
-
export { BasicAuthenticator, IamAuthenticator, CouchdbSessionAuthenticator, } from './auth';
|
|
20
|
+
export { BasicAuthenticator, IamAuthenticator, CouchdbSessionAuthenticator, CouchdbSessionAuthenticatorOptions, } from './auth';
|
|
21
21
|
export { ChangesFollower } from './cloudant/features/changesFollower';
|
|
22
22
|
export { Stream } from './cloudant/features/stream';
|
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,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,8CAAoD;AAEpD,+BAKgB;AAJd,0GAAA,kBAAkB,OAAA;AAClB,wGAAA,gBAAgB,OAAA;AAChB,mHAAA,2BAA2B,OAAA;AAI7B,uEAAsE;AAA7D,kHAAA,eAAe,OAAA;AACxB,qDAAoD;AAA3C,gGAAA,MAAM,OAAA"}
|
|
@@ -14,37 +14,22 @@
|
|
|
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
|
// eslint-disable-next-line max-classes-per-file
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
const ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
20
|
+
const tough_cookie_1 = require("tough-cookie");
|
|
21
|
+
const auth_1 = require("../auth");
|
|
22
|
+
const common_1 = require("./common");
|
|
23
|
+
const https_1 = require("https");
|
|
24
|
+
const http_1 = require("http");
|
|
40
25
|
/**
|
|
41
26
|
* Set default timeout to 2.5 minutes (= 150 000 ms)
|
|
42
27
|
*/
|
|
43
|
-
|
|
28
|
+
const READ_TIMEOUT = 150_000;
|
|
44
29
|
/**
|
|
45
30
|
* Set Validation rules
|
|
46
31
|
*/
|
|
47
|
-
|
|
32
|
+
const DocumentOperations = [
|
|
48
33
|
'deleteDocument',
|
|
49
34
|
'getDocument',
|
|
50
35
|
'getDocumentAsMixed',
|
|
@@ -57,26 +42,26 @@ var DocumentOperations = [
|
|
|
57
42
|
'headAttachment',
|
|
58
43
|
'putAttachment',
|
|
59
44
|
];
|
|
60
|
-
|
|
45
|
+
const AttachmentOperations = [
|
|
61
46
|
'deleteAttachment',
|
|
62
47
|
'getAttachment',
|
|
63
48
|
'headAttachment',
|
|
64
49
|
'putAttachment',
|
|
65
50
|
];
|
|
66
|
-
|
|
51
|
+
const docIdRule = {
|
|
67
52
|
pathSegment: 'doc_id',
|
|
68
53
|
errorParameterName: 'Document ID',
|
|
69
54
|
operationIds: DocumentOperations,
|
|
70
55
|
};
|
|
71
|
-
|
|
56
|
+
const attIdRule = {
|
|
72
57
|
pathSegment: 'attachment_name',
|
|
73
58
|
errorParameterName: 'Attachment name',
|
|
74
59
|
operationIds: AttachmentOperations,
|
|
75
60
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
validationRules.forEach(
|
|
79
|
-
rule.operationIds.forEach(
|
|
61
|
+
const validationRules = [docIdRule, attIdRule];
|
|
62
|
+
const rulesByOperation = {};
|
|
63
|
+
validationRules.forEach((rule) => {
|
|
64
|
+
rule.operationIds.forEach((operationId) => {
|
|
80
65
|
if (!(operationId in rulesByOperation)) {
|
|
81
66
|
rulesByOperation[operationId] = [];
|
|
82
67
|
}
|
|
@@ -90,42 +75,36 @@ Object.freeze(rulesByOperation);
|
|
|
90
75
|
/**
|
|
91
76
|
* Extend Error interface to access the proper Error definition.
|
|
92
77
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
97
|
-
}
|
|
98
|
-
return InvalidArgumentValueError;
|
|
99
|
-
}(Error));
|
|
78
|
+
class InvalidArgumentValueError extends Error {
|
|
79
|
+
code;
|
|
80
|
+
}
|
|
100
81
|
/**
|
|
101
82
|
* Cloudant specific service that extends the base service functions.
|
|
102
83
|
*
|
|
103
84
|
* Cloudant Service make it available to use CouchDB specific Session authentication
|
|
104
85
|
* during service requests.
|
|
105
86
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
class CloudantBaseService extends ibm_cloud_sdk_core_1.BaseService {
|
|
88
|
+
timeout;
|
|
108
89
|
/**
|
|
109
90
|
* Configuration values to use Cloudant service.
|
|
110
91
|
* @param {Authenticator} userOptions.authenticator CouchdbSessionAuthenticator object can be used
|
|
111
92
|
* to authenticate requests to the service.
|
|
112
93
|
* @param {string} [userOptions.jar] A Cookie Jar. Enabled by default if there is no custom one.
|
|
113
94
|
*/
|
|
114
|
-
|
|
115
|
-
var _this = this;
|
|
95
|
+
constructor(userOptions) {
|
|
116
96
|
userOptions.jar = userOptions.jar || new tough_cookie_1.CookieJar();
|
|
117
97
|
if (!('timeout' in userOptions)) {
|
|
118
98
|
userOptions.timeout = READ_TIMEOUT;
|
|
119
99
|
}
|
|
120
100
|
CloudantBaseService.setDefaultAgentsIfUnset(userOptions);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return _this;
|
|
101
|
+
super(userOptions);
|
|
102
|
+
this.timeout = userOptions.timeout;
|
|
103
|
+
this.configureSessionAuthenticator();
|
|
125
104
|
}
|
|
126
|
-
|
|
105
|
+
getTimeout() {
|
|
127
106
|
return this.timeout;
|
|
128
|
-
}
|
|
107
|
+
}
|
|
129
108
|
/**
|
|
130
109
|
* Set the service URL to send requests to and
|
|
131
110
|
* use the new service URL for CouchDB Session Authentication
|
|
@@ -133,10 +112,10 @@ var CloudantBaseService = /** @class */ (function (_super) {
|
|
|
133
112
|
*
|
|
134
113
|
* @param {string} url The base URL for the service.
|
|
135
114
|
*/
|
|
136
|
-
|
|
137
|
-
|
|
115
|
+
setServiceUrl(url) {
|
|
116
|
+
super.setServiceUrl(url);
|
|
138
117
|
this.configureSessionAuthenticator();
|
|
139
|
-
}
|
|
118
|
+
}
|
|
140
119
|
/**
|
|
141
120
|
* Configure the service using external configuration
|
|
142
121
|
* Cloudant specific extensions:
|
|
@@ -145,11 +124,11 @@ var CloudantBaseService = /** @class */ (function (_super) {
|
|
|
145
124
|
* @param {string} serviceName The name of the service. Will be used to read from external
|
|
146
125
|
* configuration.
|
|
147
126
|
*/
|
|
148
|
-
|
|
127
|
+
configureService(serviceName) {
|
|
149
128
|
// Read external configuration and set as request defaults.
|
|
150
|
-
|
|
129
|
+
super.configureService(serviceName);
|
|
151
130
|
this.configureSessionAuthenticator();
|
|
152
|
-
}
|
|
131
|
+
}
|
|
153
132
|
/**
|
|
154
133
|
* Turn request body compression on or off.
|
|
155
134
|
* Cloudant specific extensions:
|
|
@@ -157,20 +136,20 @@ var CloudantBaseService = /** @class */ (function (_super) {
|
|
|
157
136
|
*
|
|
158
137
|
* @param {boolean} setting Will turn it on if 'true', off if 'false'.
|
|
159
138
|
*/
|
|
160
|
-
|
|
139
|
+
setEnableGzipCompression(setting) {
|
|
161
140
|
// Read external configuration and set as request defaults.
|
|
162
|
-
|
|
141
|
+
super.setEnableGzipCompression(setting);
|
|
163
142
|
this.configureSessionAuthenticator();
|
|
164
|
-
}
|
|
143
|
+
}
|
|
165
144
|
/**
|
|
166
145
|
* In case of CouchdbSessionAuthenticator
|
|
167
146
|
* the service options should be applied on it.
|
|
168
147
|
*/
|
|
169
|
-
|
|
170
|
-
|
|
148
|
+
configureSessionAuthenticator() {
|
|
149
|
+
const auth = this.getAuthenticator();
|
|
171
150
|
if (auth instanceof auth_1.CouchdbSessionAuthenticator) {
|
|
172
|
-
|
|
173
|
-
|
|
151
|
+
const serviceClass = this.constructor;
|
|
152
|
+
const newHeaders = (0, common_1.getSdkHeaders)(serviceClass.DEFAULT_SERVICE_NAME, 'v1', 'authenticatorPostSession');
|
|
174
153
|
if (this.baseOptions.headers === undefined) {
|
|
175
154
|
Object.assign(this.baseOptions, { 'headers': newHeaders });
|
|
176
155
|
}
|
|
@@ -179,43 +158,42 @@ var CloudantBaseService = /** @class */ (function (_super) {
|
|
|
179
158
|
}
|
|
180
159
|
auth.configure(this.baseOptions);
|
|
181
160
|
}
|
|
182
|
-
}
|
|
161
|
+
}
|
|
183
162
|
/**
|
|
184
163
|
* Extend createRequest to handle document and attachment validation.
|
|
185
164
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
var operationId = null;
|
|
165
|
+
createRequest(parameters) {
|
|
166
|
+
let operationId = null;
|
|
189
167
|
if ('X-IBMCloud-SDK-Analytics' in parameters.defaultOptions.headers) {
|
|
190
168
|
// Extract operation id
|
|
191
|
-
|
|
192
|
-
|
|
169
|
+
const analyticsHeader = parameters.defaultOptions.headers['X-IBMCloud-SDK-Analytics'];
|
|
170
|
+
[, operationId] = analyticsHeader
|
|
193
171
|
.split(';')
|
|
194
|
-
.find(
|
|
195
|
-
.split('=')
|
|
172
|
+
.find((element) => element.startsWith('operation_id'))
|
|
173
|
+
.split('=');
|
|
196
174
|
// Check if operation id exists in rulesByOperation object
|
|
197
175
|
if (operationId != null &&
|
|
198
176
|
Object.keys(rulesByOperation).includes(operationId)) {
|
|
199
|
-
|
|
177
|
+
const violatedRules = rulesByOperation[operationId].filter((rule) => {
|
|
200
178
|
// get the path segment e.g. doc_id from the response's path object
|
|
201
179
|
if ('path' in parameters.options &&
|
|
202
180
|
rule.pathSegment in parameters.options.path) {
|
|
203
|
-
|
|
181
|
+
const segmentToValidate = parameters.options.path[rule.pathSegment];
|
|
204
182
|
return segmentToValidate.startsWith('_');
|
|
205
183
|
}
|
|
206
184
|
return false;
|
|
207
185
|
});
|
|
208
186
|
if (violatedRules.length > 0) {
|
|
209
|
-
|
|
187
|
+
const err = new InvalidArgumentValueError(`${violatedRules[0].errorParameterName} ${parameters.options.path[violatedRules[0].pathSegment]} starts with the invalid _ character.`);
|
|
210
188
|
err.code = 'ERR_INVALID_ARG_VALUE';
|
|
211
189
|
return Promise.reject(err);
|
|
212
190
|
}
|
|
213
191
|
}
|
|
214
192
|
}
|
|
215
|
-
return
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
return super.createRequest(parameters);
|
|
194
|
+
}
|
|
195
|
+
static setDefaultAgentsIfUnset(options) {
|
|
196
|
+
const cloudantDefaultAgentOptions = {
|
|
219
197
|
keepAlive: true,
|
|
220
198
|
};
|
|
221
199
|
if (!options.httpAgent) {
|
|
@@ -224,8 +202,7 @@ var CloudantBaseService = /** @class */ (function (_super) {
|
|
|
224
202
|
if (!options.httpsAgent) {
|
|
225
203
|
options.httpsAgent = new https_1.Agent(cloudantDefaultAgentOptions);
|
|
226
204
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
}(ibm_cloud_sdk_core_1.BaseService));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
230
207
|
exports.default = CloudantBaseService;
|
|
231
208
|
//# sourceMappingURL=cloudantBaseService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudantBaseService.js","sourceRoot":"","sources":["../../lib/cloudantBaseService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"cloudantBaseService.js","sourceRoot":"","sources":["../../lib/cloudantBaseService.ts"],"names":[],"mappings":";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I,CAAC,WAAW,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,EAC3C,CAAC;wBACD,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;wBACpE,OAAO,iBAAiB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;oBAC3C,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC,CAAC,CAAC;gBACH,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7B,MAAM,GAAG,GAAG,IAAI,yBAAyB,CACvC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,IACpC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CACtD,uCAAuC,CACxC,CAAC;oBACF,GAAG,CAAC,IAAI,GAAG,uBAAuB,CAAC;oBACnC,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,uBAAuB,CAAC,OAAoB;QACzD,MAAM,2BAA2B,GAAG;YAClC,SAAS,EAAE,IAAI;SAChB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,SAAS,GAAG,IAAI,YAAS,CAAC,2BAA2B,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,CAAC,UAAU,GAAG,IAAI,aAAU,CAAC,2BAA2B,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF;AA7ID,sCA6IC"}
|
package/lib/common.js
CHANGED
|
@@ -14,24 +14,47 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
17
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
41
|
exports.getSdkHeaders = void 0;
|
|
19
|
-
|
|
42
|
+
const os = __importStar(require("os"));
|
|
20
43
|
// tslint:disable-next-line:no-var-requires
|
|
21
|
-
|
|
44
|
+
const pkg = require('../package.json');
|
|
22
45
|
/**
|
|
23
46
|
* Get the request headers to be sent in requests by the SDK.
|
|
24
47
|
*/
|
|
25
48
|
function getSdkHeaders(serviceName, serviceVersion, operationId) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'User-Agent':
|
|
34
|
-
'X-IBMCloud-SDK-Analytics':
|
|
49
|
+
const sdkName = 'cloudant-node-sdk';
|
|
50
|
+
const sdkVersion = pkg.version;
|
|
51
|
+
const osName = os.platform();
|
|
52
|
+
const osVersion = os.release();
|
|
53
|
+
const osArch = os.arch();
|
|
54
|
+
const nodeVersion = process.version;
|
|
55
|
+
const headers = {
|
|
56
|
+
'User-Agent': `${sdkName}/${sdkVersion} (node.version=${nodeVersion}; os.name=${osName}; os.version=${osVersion}; os.arch=${osArch}; lang=Node.js;)`,
|
|
57
|
+
'X-IBMCloud-SDK-Analytics': `service_name=${serviceName};service_version=${serviceVersion};operation_id=${operationId}`,
|
|
35
58
|
};
|
|
36
59
|
return headers;
|
|
37
60
|
}
|
package/lib/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../lib/common.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../lib/common.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA2C;AAC3C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAOvC;;GAEG;AACH,SAAgB,aAAa,CAC3B,WAAmB,EACnB,cAAsB,EACtB,WAAmB;IAEnB,MAAM,OAAO,GAAG,mBAAmB,CAAC;IACpC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC;IAC/B,MAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAEpC,MAAM,OAAO,GAAG;QACd,YAAY,EAAE,GAAG,OAAO,IAAI,UAAU,kBAAkB,WAAW,aAAa,MAAM,gBAAgB,SAAS,aAAa,MAAM,kBAAkB;QACpJ,0BAA0B,EAAE,gBAAgB,WAAW,oBAAoB,cAAc,iBAAiB,WAAW,EAAE;KACxH,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAlBD,sCAkBC"}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
|
|
19
|
+
const auth_1 = require("../auth");
|
|
20
|
+
const COUCHDB_SESSION_AUTH_TYPE = 'couchdb_session';
|
|
21
21
|
/**
|
|
22
22
|
* Extend the creating Authenticator from external configuration function with
|
|
23
23
|
* CouchDB specific Session Authenticator possibility.
|
|
@@ -26,9 +26,9 @@ var COUCHDB_SESSION_AUTH_TYPE = 'couchdb_session';
|
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
28
|
function getAuthenticatorFromEnvCloudantExtension(serviceName) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
let auth;
|
|
30
|
+
const credentials = (0, ibm_cloud_sdk_core_1.readExternalSources)(serviceName);
|
|
31
|
+
let { authType } = credentials;
|
|
32
32
|
if (!authType) {
|
|
33
33
|
// this is the alternative "AUTHTYPE" config property
|
|
34
34
|
authType = credentials.authtype || '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAuthenticatorFromEnvCloudantExtension.js","sourceRoot":"","sources":["../../lib/getAuthenticatorFromEnvCloudantExtension.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,
|
|
1
|
+
{"version":3,"file":"getAuthenticatorFromEnvCloudantExtension.js","sourceRoot":"","sources":["../../lib/getAuthenticatorFromEnvCloudantExtension.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAEH,2DAI4B;AAC5B,kCAAsD;AAEtD,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,SAAwB,wCAAwC,CAC9D,WAAmB;IAEnB,IAAI,IAAI,CAAC;IACT,MAAM,WAAW,GAAG,IAAA,wCAAmB,EAAC,WAAW,CAAC,CAAC;IACrD,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,qDAAqD;QACrD,QAAQ,GAAG,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,yBAAyB,EAAE,CAAC;QACzD,IAAI,GAAG,IAAI,kCAA2B,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,IAAA,oDAA+B,EAAC,WAAW,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAjBD,2DAiBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibm-cloud/cloudant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "IBM Cloudant Node.js SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -29,39 +29,40 @@
|
|
|
29
29
|
"test-ci": "jest --runInBand --testNamePattern='^((?!@slow).)*$' test/",
|
|
30
30
|
"test-unit-ci": "jest --runInBand test/unit/",
|
|
31
31
|
"test-integration-ci": "jest --runInBand --no-colors --testNamePattern='^((?!@slow).)*$' --json test/integration > test-output.log",
|
|
32
|
-
"typedoc": "typedoc
|
|
32
|
+
"typedoc": "typedoc"
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": "^18 || ^20"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@types/node": "18.19.
|
|
40
|
-
"ibm-cloud-sdk-core": "4.2.
|
|
39
|
+
"@types/node": "18.19.23",
|
|
40
|
+
"ibm-cloud-sdk-core": "4.2.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@types/
|
|
44
|
-
"@
|
|
45
|
-
"@typescript-eslint/
|
|
46
|
-
"
|
|
47
|
-
"
|
|
43
|
+
"@types/extend": "3.0.4",
|
|
44
|
+
"@types/jest": "29.5.12",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "7.2.0",
|
|
46
|
+
"@typescript-eslint/parser": "7.2.0",
|
|
47
|
+
"dotenv": "16.4.5",
|
|
48
|
+
"eslint": "8.57.0",
|
|
48
49
|
"eslint-config-airbnb-base": "15.0.0",
|
|
49
|
-
"eslint-config-airbnb-typescript": "
|
|
50
|
+
"eslint-config-airbnb-typescript": "18.0.0",
|
|
50
51
|
"eslint-config-prettier": "9.1.0",
|
|
51
52
|
"eslint-import-resolver-typescript": "3.6.0",
|
|
52
53
|
"eslint-plugin-header": "3.1.1",
|
|
53
54
|
"eslint-plugin-import": "2.29.0",
|
|
54
|
-
"eslint-plugin-jest": "27.
|
|
55
|
-
"eslint-plugin-jsdoc": "48.0
|
|
55
|
+
"eslint-plugin-jest": "27.9.0",
|
|
56
|
+
"eslint-plugin-jsdoc": "48.2.0",
|
|
56
57
|
"eslint-plugin-node": "11.1.0",
|
|
57
58
|
"eslint-plugin-prettier": "5.1.0",
|
|
58
59
|
"jest": "29.7.0",
|
|
59
60
|
"jest-junit": "16.0.0",
|
|
60
|
-
"prettier": "3.
|
|
61
|
+
"prettier": "3.2.5",
|
|
61
62
|
"sinon": "17.0.1",
|
|
62
|
-
"ts-jest": "29.1.
|
|
63
|
-
"typedoc": "0.25.
|
|
64
|
-
"typescript": "5.
|
|
63
|
+
"ts-jest": "29.1.2",
|
|
64
|
+
"typedoc": "0.25.12",
|
|
65
|
+
"typescript": "5.4.2"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
68
|
"@types/tough-cookie": "^4.0.0",
|