@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 CHANGED
@@ -2,7 +2,7 @@
2
2
  [![Release](https://img.shields.io/github/v/release/IBM/cloudant-node-sdk?include_prereleases&sort=semver)](https://github.com/IBM/cloudant-node-sdk/releases/latest)
3
3
  [![Docs](https://img.shields.io/static/v1?label=TypeDoc&message=latest&color=blue)](https://ibm.github.io/cloudant-node-sdk/)
4
4
 
5
- # IBM Cloudant Node.js SDK Version 0.8.2
5
+ # IBM Cloudant Node.js SDK Version 0.9.0
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 "@ibm-cloud/cloudant";
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
- const { CloudantV1 } = require('@ibm-cloud/cloudant');
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 "@ibm-cloud/cloudant";
480
+ import { CloudantV1 } from '@ibm-cloud/cloudant';
481
481
  ```
482
482
  [embedmd]:# (test/examples/src/ts/GetInfoFromExistingDatabase.ts /\/\/ 1./ $)
483
483
  ```ts
@@ -496,8 +496,8 @@ const dbName = 'orders';
496
496
 
497
497
  // call service with embedded parameters:
498
498
  client.getDatabaseInformation({ db: dbName }).then((dbInfo) => {
499
- const documentCount = dbInfo.result.doc_count;
500
- const dbNameResult = dbInfo.result.db_name;
499
+ const documentCount = dbInfo.result.docCount;
500
+ const dbNameResult = dbInfo.result.dbName;
501
501
 
502
502
  // 4. Show document count in database =========================================
503
503
  console.log(
@@ -526,7 +526,7 @@ client.getDocument(getDocParams).then((documentExample) => {
526
526
  <summary>JavaScript:</summary>
527
527
 
528
528
  ```js
529
- const { CloudantV1 } = require('@ibm-cloud/cloudant');
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
@@ -544,8 +544,8 @@ const getInfoFromExistingDatabase = async () => {
544
544
 
545
545
  // call service with embedded parameters:
546
546
  const dbInfo = await client.getDatabaseInformation({ db: dbName });
547
- const documentCount = dbInfo.result.doc_count;
548
- const dbNameResult = dbInfo.result.db_name;
547
+ const documentCount = dbInfo.result.docCount;
548
+ const dbNameResult = dbInfo.result.dbName;
549
549
 
550
550
  // 4. Show document count in database =========================================
551
551
  console.log(
@@ -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 "@ibm-cloud/cloudant";
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
- const { CloudantV1 } = require('@ibm-cloud/cloudant');
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 "@ibm-cloud/cloudant";
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
- const { CloudantV1 } = require('@ibm-cloud/cloudant');
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.2/examples#examples-for-node).
938
+ For a complete list of code examples, see the [examples directory](https://github.com/IBM/cloudant-node-sdk/tree/v0.9.0/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.2/examples#postchanges) instead of the follower.
1036
+ write code to use the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.9.0/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.2/examples#postchanges).
1071
+ may be achieved by using the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.9.0/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
- const { ChangesFollower, CloudantV1 } = require('@ibm-cloud/cloudant');
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
- const { ChangesFollower, CloudantV1 } = require('@ibm-cloud/cloudant');
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
- const { ChangesFollower, CloudantV1 } = require('@ibm-cloud/cloudant');
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
- const { ChangesFollower, CloudantV1 } = require('@ibm-cloud/cloudant');
1288
- const { Writable } = require('node:stream');
1289
- const { pipeline } = require('node:stream/promises');
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
- const { ChangesFollower, CloudantV1 } = require('@ibm-cloud/cloudant');
1407
- const { Writable } = require('node:stream');
1408
- const { pipeline } = require('node:stream/promises');
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
- const { ChangesFollower, CloudantV1 } = require('@ibm-cloud/cloudant');
1525
- const { Writable } = require('node:stream');
1526
- const { pipeline } = require('node:stream/promises');
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.2/KNOWN_ISSUES.md) to verify that your issue hasn't been reported yet.
1582
+ [KNOWN_ISSUES file](https://github.com/IBM/cloudant-node-sdk/tree/v0.9.0/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.2/CONTRIBUTING.md).
1612
+ For more information, see [CONTRIBUTING](https://github.com/IBM/cloudant-node-sdk/tree/v0.9.0/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.2/LICENSE).
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.9.0/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
- var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
46
- var sessionTokenManager_1 = require("./sessionTokenManager");
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
- var CouchdbSessionAuthenticator = /** @class */ (function (_super) {
60
- __extends(CouchdbSessionAuthenticator, _super);
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
- function CouchdbSessionAuthenticator(options) {
70
- var _this = _super.call(this) || this;
71
- (0, ibm_cloud_sdk_core_1.validateInput)(options, _this.requiredOptions);
72
- _this.tokenOptions = __assign({}, options);
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
- CouchdbSessionAuthenticator.prototype.authenticate = function (requestOptions) {
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
- CouchdbSessionAuthenticator.prototype.configure = function (userOptions) {
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
- var cookieJar = this.tokenOptions.jar;
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
- var originalUpdateCookieFn_1 = cookieJar.store.updateCookie;
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
- var originalExpiryTimeFn = newCookie.expiryTime;
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 (originalUpdateCookieFn_1) {
123
- originalUpdateCookieFn_1.call(cookieJar.store, oldCookie, newCookie, cb);
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
- CouchdbSessionAuthenticator.prototype.authenticationType = function () {
116
+ authenticationType() {
141
117
  return CouchdbSessionAuthenticator.AUTHTYPE_COUCHDB_SESSION;
142
- };
143
- CouchdbSessionAuthenticator.AUTHTYPE_COUCHDB_SESSION = 'COUCHDB_SESSION';
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAA+E;AAC/E,6DAG+B;AAoB/B;;;;;;;;;;;GAWG;AACH;IAAiD,+CAAa;IAS5D;;;;;;;OAOG;IACH,qCAAY,OAA2C;QACrD,YAAA,MAAK,WAAE,SAAC;QACR,IAAA,kCAAa,EAAC,OAAO,EAAE,KAAI,CAAC,eAAe,CAAC,CAAC;QAC7C,KAAI,CAAC,YAAY,gBAAQ,OAAO,CAAE,CAAC;;IACrC,CAAC;IAED;;;;;;;;OAQG;IACI,kDAAY,GAAnB,UAAoB,cAAsB;QACxC,OAAO,IAAI,CAAC,Y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AC;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,6EAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA"}
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
- var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
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
- var SessionTokenManager = /** @class */ (function (_super) {
42
- __extends(SessionTokenManager, _super);
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
- function SessionTokenManager(options) {
60
- var _this = _super.call(this, options) || this;
61
- _this.requiredOptions = [
62
- 'username',
63
- 'password',
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
- SessionTokenManager.prototype.setHeaders = function (headers) {
80
- var errMsg = 'During CouchDB Session Authentication only `request` service headers are in use';
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
- SessionTokenManager.prototype.requestToken = function () {
73
+ requestToken() {
89
74
  if (!this.options.headers) {
90
75
  this.options.headers = {};
91
76
  }
92
77
  // these cannot be overwritten
93
- var parameters = {
78
+ const parameters = {
94
79
  options: {
95
80
  headers: this.options.headers,
96
- url: "".concat(this.options.serviceUrl, "/_session"),
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
- SessionTokenManager.prototype.saveTokenInfo = function (tokenResponse) {
116
- var sessionCookie = tokenResponse.headers['set-cookie'];
100
+ saveTokenInfo(tokenResponse) {
101
+ const sessionCookie = tokenResponse.headers['set-cookie'];
117
102
  if (!Array.isArray(sessionCookie)) {
118
- var err = 'Set-Cookie header not present in response';
103
+ const err = 'Set-Cookie header not present in response';
119
104
  throw new Error(err);
120
105
  }
121
- var sessionToken = null;
122
- var expireTime = null;
123
- var refreshTime = null;
124
- for (var i = 0; i < sessionCookie.length && sessionToken == null; i += 1) {
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
- var err = 'Session token not present in response';
117
+ const err = 'Session token not present in response';
133
118
  throw new Error(err);
134
119
  }
135
- this.accessToken = sessionToken[1];
136
- var fractionOfTtl = 0.8;
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
- var timeToLive = this.expireTime - (0, ibm_cloud_sdk_core_1.getCurrentTime)();
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
- return SessionTokenManager;
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;;;;;;;;;;;;;;;;;;AAGH,yDA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AE,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 #startOneOff()} to fetch the changes from the supplied since sequence
28
+ * * {@link startOneOff} to fetch the changes from the supplied since sequence
30
29
  * until there are no further pending changes.
31
- * * {@link #start()} to fetch the changes from the supplied since sequence and
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 #startOneOff()} the feed will start from the beginning.
37
- * * {@link #start()} the feed will start from "now".
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 #stop()}.
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: ChangesResultIterableIterator;
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 ChangesFollower#stop()} is called.
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 ChangesFollower#start} or {@link ChangesFollower#startOneOff} was already called.
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 ChangesFollower#stop} is called.
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 ChangesFollower#start} or {@link ChangesFollower#startOneOff} was already called.
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 ChangesFollower#start}
138
- * or {@link ChangesFollower#startOneOff} was not called first
137
+ * @throws {Error} if {@link start}
138
+ * or {@link startOneOff} was not called first
139
139
  */
140
140
  stop(): void;
141
141
  /**