@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/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,+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"}
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
- var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
35
- var tough_cookie_1 = require("tough-cookie");
36
- var auth_1 = require("../auth");
37
- var common_1 = require("./common");
38
- var https_1 = require("https");
39
- var http_1 = require("http");
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
- var READ_TIMEOUT = 150000;
28
+ const READ_TIMEOUT = 150000;
44
29
  /**
45
30
  * Set Validation rules
46
31
  */
47
- var DocumentOperations = [
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
- var AttachmentOperations = [
45
+ const AttachmentOperations = [
61
46
  'deleteAttachment',
62
47
  'getAttachment',
63
48
  'headAttachment',
64
49
  'putAttachment',
65
50
  ];
66
- var docIdRule = {
51
+ const docIdRule = {
67
52
  pathSegment: 'doc_id',
68
53
  errorParameterName: 'Document ID',
69
54
  operationIds: DocumentOperations,
70
55
  };
71
- var attIdRule = {
56
+ const attIdRule = {
72
57
  pathSegment: 'attachment_name',
73
58
  errorParameterName: 'Attachment name',
74
59
  operationIds: AttachmentOperations,
75
60
  };
76
- var validationRules = [docIdRule, attIdRule];
77
- var rulesByOperation = {};
78
- validationRules.forEach(function (rule) {
79
- rule.operationIds.forEach(function (operationId) {
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
- var InvalidArgumentValueError = /** @class */ (function (_super) {
94
- __extends(InvalidArgumentValueError, _super);
95
- function InvalidArgumentValueError() {
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
- var CloudantBaseService = /** @class */ (function (_super) {
107
- __extends(CloudantBaseService, _super);
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
- function CloudantBaseService(userOptions) {
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
- _this = _super.call(this, userOptions) || this;
122
- _this.timeout = userOptions.timeout;
123
- _this.configureSessionAuthenticator();
124
- return _this;
101
+ super(userOptions);
102
+ this.timeout = userOptions.timeout;
103
+ this.configureSessionAuthenticator();
125
104
  }
126
- CloudantBaseService.prototype.getTimeout = function () {
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
- CloudantBaseService.prototype.setServiceUrl = function (url) {
137
- _super.prototype.setServiceUrl.call(this, url);
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
- CloudantBaseService.prototype.configureService = function (serviceName) {
127
+ configureService(serviceName) {
149
128
  // Read external configuration and set as request defaults.
150
- _super.prototype.configureService.call(this, serviceName);
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
- CloudantBaseService.prototype.setEnableGzipCompression = function (setting) {
139
+ setEnableGzipCompression(setting) {
161
140
  // Read external configuration and set as request defaults.
162
- _super.prototype.setEnableGzipCompression.call(this, setting);
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
- CloudantBaseService.prototype.configureSessionAuthenticator = function () {
170
- var auth = this.getAuthenticator();
148
+ configureSessionAuthenticator() {
149
+ const auth = this.getAuthenticator();
171
150
  if (auth instanceof auth_1.CouchdbSessionAuthenticator) {
172
- var serviceClass = this.constructor;
173
- var newHeaders = (0, common_1.getSdkHeaders)(serviceClass.DEFAULT_SERVICE_NAME, 'v1', 'authenticatorPostSession');
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
- CloudantBaseService.prototype.createRequest = function (parameters) {
187
- var _a;
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
- var analyticsHeader = parameters.defaultOptions.headers['X-IBMCloud-SDK-Analytics'];
192
- _a = analyticsHeader
169
+ const analyticsHeader = parameters.defaultOptions.headers['X-IBMCloud-SDK-Analytics'];
170
+ [, operationId] = analyticsHeader
193
171
  .split(';')
194
- .find(function (element) { return element.startsWith('operation_id'); })
195
- .split('='), operationId = _a[1];
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
- var violatedRules = rulesByOperation[operationId].filter(function (rule) {
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
- var segmentToValidate = parameters.options.path[rule.pathSegment];
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
- var err = new InvalidArgumentValueError("".concat(violatedRules[0].errorParameterName, " ").concat(parameters.options.path[violatedRules[0].pathSegment], " starts with the invalid _ character."));
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 _super.prototype.createRequest.call(this, parameters);
216
- };
217
- CloudantBaseService.setDefaultAgentsIfUnset = function (options) {
218
- var cloudantDefaultAgentOptions = {
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
- return CloudantBaseService;
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;;;;;;;;;;;;;;;;;AAEH,gDAAgD;AAChD,yDAA6E;AAC7E,6CAAyC;AACzC,gCAAsD;AACtD,mCAAyC;AACzC,+BAA4C;AAC5C,6BAA0C;AAE1C;;GAEG;AACH,IAAM,YAAY,GAAG,MAAO,CAAC;AAE7B;;GAEG;AACH,IAAM,kBAAkB,GAAG;IACzB,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AAU,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
- var os = require("os");
42
+ const os = __importStar(require("os"));
20
43
  // tslint:disable-next-line:no-var-requires
21
- var pkg = require('../package.json');
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
- var sdkName = 'cloudant-node-sdk';
27
- var sdkVersion = pkg.version;
28
- var osName = os.platform();
29
- var osVersion = os.release();
30
- var osArch = os.arch();
31
- var nodeVersion = process.version;
32
- var headers = {
33
- 'User-Agent': "".concat(sdkName, "/").concat(sdkVersion, " (node.version=").concat(nodeVersion, "; os.name=").concat(osName, "; os.version=").concat(osVersion, "; os.arch=").concat(osArch, "; lang=Node.js;)"),
34
- 'X-IBMCloud-SDK-Analytics': "service_name=".concat(serviceName, ";service_version=").concat(serviceVersion, ";operation_id=").concat(operationId),
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;;;AAEH,uBAAyB;AACzB,2CAA2C;AAC3C,IAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAOvC;;GAEG;AACH,SAAgB,aAAa,CAC3B,WAAmB,EACnB,cAAsB,EACtB,WAAmB;IAEnB,IAAM,OAAO,GAAG,mBAAmB,CAAC;IACpC,IAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC;IAC/B,IAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC7B,IAAM,SAAS,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC/B,IAAM,MAAM,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACzB,IAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAEpC,IAAM,OAAO,GAAG;QACd,YAAY,EAAE,UAAG,OAAO,cAAI,UAAU,4BAAkB,WAAW,uBAAa,MAAM,0BAAgB,SAAS,uBAAa,MAAM,qBAAkB;QACpJ,0BAA0B,EAAE,uBAAgB,WAAW,8BAAoB,cAAc,2BAAiB,WAAW,CAAE;KACxH,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAlBD,sCAkBC"}
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
- var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
19
- var auth_1 = require("../auth");
20
- var COUCHDB_SESSION_AUTH_TYPE = 'couchdb_session';
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
- var auth;
30
- var credentials = (0, ibm_cloud_sdk_core_1.readExternalSources)(serviceName);
31
- var authType = credentials.authType;
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,yDAI4B;AAC5B,gCAAsD;AAEtD,IAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,SAAwB,wCAAwC,CAC9D,WAAmB;IAEnB,IAAI,IAAI,CAAC;IACT,IAAM,WAAW,GAAG,IAAA,wCAAmB,EAAC,WAAW,CAAC,CAAC;IAC/C,IAAA,QAAQ,GAAK,WAAW,SAAhB,CAAiB;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"}
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.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "IBM Cloudant Node.js SDK",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -29,21 +29,22 @@
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 --theme default --entryPointStrategy expand --excludeExternals --tsconfig tsconfig.json --out apidocs auth cloudant --includeVersion"
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.4",
40
- "ibm-cloud-sdk-core": "4.2.1"
39
+ "@types/node": "18.19.15",
40
+ "ibm-cloud-sdk-core": "4.2.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/jest": "29.5.11",
44
- "@typescript-eslint/eslint-plugin": "6.17.0",
45
- "@typescript-eslint/parser": "6.17.0",
46
- "dotenv": "16.3.1",
43
+ "@types/extend": "3.0.4",
44
+ "@types/jest": "29.5.12",
45
+ "@typescript-eslint/eslint-plugin": "6.21.0",
46
+ "@typescript-eslint/parser": "6.21.0",
47
+ "dotenv": "16.4.3",
47
48
  "eslint": "8.56.0",
48
49
  "eslint-config-airbnb-base": "15.0.0",
49
50
  "eslint-config-airbnb-typescript": "17.1.0",
@@ -52,15 +53,15 @@
52
53
  "eslint-plugin-header": "3.1.1",
53
54
  "eslint-plugin-import": "2.29.0",
54
55
  "eslint-plugin-jest": "27.6.0",
55
- "eslint-plugin-jsdoc": "47.0.2",
56
+ "eslint-plugin-jsdoc": "48.0.1",
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.1.1",
61
+ "prettier": "3.2.5",
61
62
  "sinon": "17.0.1",
62
- "ts-jest": "29.1.1",
63
- "typedoc": "0.25.6",
63
+ "ts-jest": "29.1.2",
64
+ "typedoc": "0.25.8",
64
65
  "typescript": "5.3.3"
65
66
  },
66
67
  "peerDependencies": {