@aws-amplify/auth 4.6.2-next.13 → 4.6.2-next.32

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/lib/.tsbuildinfo +3 -0
  3. package/lib/Auth.js +65 -129
  4. package/lib/Auth.js.map +1 -1
  5. package/lib/Errors.js +3 -15
  6. package/lib/Errors.js.map +1 -1
  7. package/lib/OAuth/OAuth.js +34 -106
  8. package/lib/OAuth/OAuth.js.map +1 -1
  9. package/lib/types/index.js +2 -4
  10. package/lib/types/index.js.map +1 -1
  11. package/lib/urlListener.native.js +7 -64
  12. package/lib/urlListener.native.js.map +1 -1
  13. package/lib-esm/.tsbuildinfo +3 -0
  14. package/lib-esm/Auth.d.ts +2 -1
  15. package/lib-esm/Auth.js +5 -66
  16. package/lib-esm/Auth.js.map +1 -1
  17. package/lib-esm/Errors.js +1 -13
  18. package/lib-esm/Errors.js.map +1 -1
  19. package/lib-esm/OAuth/OAuth.js +11 -73
  20. package/lib-esm/OAuth/OAuth.js.map +1 -1
  21. package/lib-esm/urlListener.native.js +1 -58
  22. package/lib-esm/urlListener.native.js.map +1 -1
  23. package/package.json +12 -6
  24. package/src/Auth.ts +4 -3
  25. package/src/OAuth/OAuth.ts +25 -25
  26. package/build.js +0 -5
  27. package/dist/aws-amplify-auth.js +0 -16358
  28. package/dist/aws-amplify-auth.js.map +0 -1
  29. package/dist/aws-amplify-auth.min.js +0 -44
  30. package/dist/aws-amplify-auth.min.js.map +0 -1
  31. package/index.js +0 -7
  32. package/lib/Auth.d.ts +0 -300
  33. package/lib/Errors.d.ts +0 -9
  34. package/lib/OAuth/OAuth.d.ts +0 -29
  35. package/lib/OAuth/oauthStorage.d.ts +0 -5
  36. package/lib/OAuth/oauthStorage.native.d.ts +0 -5
  37. package/lib/OAuth/urlOpener.d.ts +0 -1
  38. package/lib/OAuth/urlOpener.native.d.ts +0 -1
  39. package/lib/common/AuthErrorStrings.d.ts +0 -17
  40. package/lib/index.d.ts +0 -9
  41. package/lib/types/Auth.d.ts +0 -170
  42. package/lib/types/index.d.ts +0 -1
  43. package/lib/urlListener.d.ts +0 -2
  44. package/lib/urlListener.native.d.ts +0 -2
  45. package/testSequencer.js +0 -24
  46. package/webpack.config.dev.js +0 -6
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.6.12](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.11...@aws-amplify/auth@4.6.12) (2022-10-26)
7
+
8
+ **Note:** Version bump only for package @aws-amplify/auth
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.6.11](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.10...@aws-amplify/auth@4.6.11) (2022-10-25)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **@aws-amplify/datastore:** introduce "settlement" guarantees to stop() and clear() ([#10450](https://github.com/aws-amplify/amplify-js/issues/10450)) ([16c535b](https://github.com/aws-amplify/amplify-js/commit/16c535beda9386a027c2805f29a359fbeb8bac15)), closes [#10449](https://github.com/aws-amplify/amplify-js/issues/10449)
20
+
21
+
22
+
23
+
24
+
25
+ ## [4.6.10](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.9...@aws-amplify/auth@4.6.10) (2022-10-14)
26
+
27
+ **Note:** Version bump only for package @aws-amplify/auth
28
+
29
+
30
+
31
+
32
+
33
+ ## [4.6.9](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.8...@aws-amplify/auth@4.6.9) (2022-10-14)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **@aws-amplify/datastore:** introduce "settlement" guarantees to stop() and clear() ([#10055](https://github.com/aws-amplify/amplify-js/issues/10055)) ([c64d7d6](https://github.com/aws-amplify/amplify-js/commit/c64d7d6284bc7b41a5a65b4b47d35ea274aed6b3))
39
+
40
+
41
+ ### Reverts
42
+
43
+ * "fix(@aws-amplify/datastore): introduce "settlement" guarantees to stop() and clear()" ([#10449](https://github.com/aws-amplify/amplify-js/issues/10449)) ([d726bcc](https://github.com/aws-amplify/amplify-js/commit/d726bccca9712b8f43bc273052f970f8f931dd8c)), closes [aws-amplify/amplify-js#10055](https://github.com/aws-amplify/amplify-js/issues/10055)
44
+
45
+
46
+
47
+
48
+
6
49
  ## [4.6.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.6...@aws-amplify/auth@4.6.8) (2022-09-30)
7
50
 
8
51
  **Note:** Version bump only for package @aws-amplify/auth
@@ -0,0 +1,3 @@
1
+ {
2
+ "version": "3.8.3"
3
+ }
package/lib/Auth.js CHANGED
@@ -11,79 +11,14 @@
11
11
  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
12
12
  * and limitations under the License.
13
13
  */
14
- var __assign = (this && this.__assign) || function () {
15
- __assign = Object.assign || function(t) {
16
- for (var s, i = 1, n = arguments.length; i < n; i++) {
17
- s = arguments[i];
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
- t[p] = s[p];
20
- }
21
- return t;
22
- };
23
- return __assign.apply(this, arguments);
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (_) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
- var __read = (this && this.__read) || function (o, n) {
62
- var m = typeof Symbol === "function" && o[Symbol.iterator];
63
- if (!m) return o;
64
- var i = m.call(o), r, ar = [], e;
65
- try {
66
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
67
- }
68
- catch (error) { e = { error: error }; }
69
- finally {
70
- try {
71
- if (r && !r.done && (m = i["return"])) m.call(i);
72
- }
73
- finally { if (e) throw e.error; }
74
- }
75
- return ar;
76
- };
77
- var __importDefault = (this && this.__importDefault) || function (mod) {
78
- return (mod && mod.__esModule) ? mod : { "default": mod };
79
- };
80
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ var tslib_1 = require("tslib");
81
16
  var types_1 = require("./types");
82
17
  var core_1 = require("@aws-amplify/core");
83
18
  var amazon_cognito_identity_js_1 = require("amazon-cognito-identity-js");
84
19
  var url_1 = require("url");
85
- var OAuth_1 = __importDefault(require("./OAuth/OAuth"));
86
- var urlListener_1 = __importDefault(require("./urlListener"));
20
+ var OAuth_1 = tslib_1.__importDefault(require("./OAuth/OAuth"));
21
+ var urlListener_1 = tslib_1.__importDefault(require("./urlListener"));
87
22
  var Errors_1 = require("./Errors");
88
23
  var Auth_1 = require("./types/Auth");
89
24
  var logger = new core_1.ConsoleLogger('AuthClass');
@@ -155,7 +90,7 @@ var AuthClass = /** @class */ (function () {
155
90
  if (!config)
156
91
  return this._config || {};
157
92
  logger.debug('configure Auth');
158
- var conf = Object.assign({}, this._config, core_1.Parser.parseMobilehubConfig(config).Auth, config);
93
+ var conf = Object.assign({}, this._config, core_1.parseAWSExports(config).Auth, config);
159
94
  this._config = conf;
160
95
  var _a = this._config, userPoolId = _a.userPoolId, userPoolWebClientId = _a.userPoolWebClientId, cookieStorage = _a.cookieStorage, oauth = _a.oauth, region = _a.region, identityPoolId = _a.identityPoolId, mandatorySignIn = _a.mandatorySignIn, refreshHandlers = _a.refreshHandlers, identityPoolRegion = _a.identityPoolRegion, clientMetadata = _a.clientMetadata, endpoint = _a.endpoint;
161
96
  if (!this._config.storage) {
@@ -386,10 +321,10 @@ var AuthClass = /** @class */ (function () {
386
321
  }, 5000);
387
322
  };
388
323
  AuthClass.prototype.signInAfterUserConfirmed = function (authDetails, listenEvent, autoSignInPollingIntervalId) {
389
- return __awaiter(this, void 0, void 0, function () {
324
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
390
325
  var user, error_1;
391
326
  var _this = this;
392
- return __generator(this, function (_a) {
327
+ return tslib_1.__generator(this, function (_a) {
393
328
  switch (_a.label) {
394
329
  case 0:
395
330
  user = this.createCognitoUser(authDetails.getUsername());
@@ -501,7 +436,8 @@ var AuthClass = /** @class */ (function () {
501
436
  /**
502
437
  * Sign in
503
438
  * @param {String | SignInOpts} usernameOrSignInOpts - The username to be signed in or the sign in options
504
- * @param {String} password - The password of the username
439
+ * @param {String} pw - The password of the username
440
+ * @param {ClientMetaData} clientMetadata - Client metadata for custom workflows
505
441
  * @return - A promise resolves the CognitoUser
506
442
  */
507
443
  AuthClass.prototype.signIn = function (usernameOrSignInOpts, pw, clientMetadata) {
@@ -555,9 +491,9 @@ var AuthClass = /** @class */ (function () {
555
491
  var _this = this;
556
492
  var that = this;
557
493
  return {
558
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
494
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
559
495
  var cred, e_1, currentUser, e_2;
560
- return __generator(this, function (_a) {
496
+ return tslib_1.__generator(this, function (_a) {
561
497
  switch (_a.label) {
562
498
  case 0:
563
499
  logger.debug(session);
@@ -713,9 +649,9 @@ var AuthClass = /** @class */ (function () {
713
649
  return new Promise(function (res, rej) {
714
650
  var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
715
651
  var bypassCache = params ? params.bypassCache : false;
716
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
652
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
717
653
  var cleanUpError_1, mfaType;
718
- return __generator(this, function (_a) {
654
+ return tslib_1.__generator(this, function (_a) {
719
655
  switch (_a.label) {
720
656
  case 0:
721
657
  if (!err) return [3 /*break*/, 5];
@@ -787,9 +723,9 @@ var AuthClass = /** @class */ (function () {
787
723
  AuthClass.prototype._getUserData = function (user, params) {
788
724
  var _this = this;
789
725
  return new Promise(function (res, rej) {
790
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
726
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
791
727
  var cleanUpError_2;
792
- return __generator(this, function (_a) {
728
+ return tslib_1.__generator(this, function (_a) {
793
729
  switch (_a.label) {
794
730
  case 0:
795
731
  if (!err) return [3 /*break*/, 5];
@@ -825,10 +761,10 @@ var AuthClass = /** @class */ (function () {
825
761
  * @return - A promise resolve if success
826
762
  */
827
763
  AuthClass.prototype.setPreferredMFA = function (user, mfaMethod) {
828
- return __awaiter(this, void 0, void 0, function () {
764
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
829
765
  var clientMetadata, userData, smsMfaSettings, totpMfaSettings, _a, mfaList, currentMFAType, that;
830
766
  var _this = this;
831
- return __generator(this, function (_b) {
767
+ return tslib_1.__generator(this, function (_b) {
832
768
  switch (_b.label) {
833
769
  case 0:
834
770
  clientMetadata = this._config.clientMetadata;
@@ -918,9 +854,9 @@ var AuthClass = /** @class */ (function () {
918
854
  logger.debug('Set user mfa success', result);
919
855
  logger.debug('Caching the latest user data into local');
920
856
  // cache the latest result into user data
921
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
857
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
922
858
  var cleanUpError_3;
923
- return __generator(this, function (_a) {
859
+ return tslib_1.__generator(this, function (_a) {
924
860
  switch (_a.label) {
925
861
  case 0:
926
862
  if (!err) return [3 /*break*/, 5];
@@ -1050,9 +986,9 @@ var AuthClass = /** @class */ (function () {
1050
986
  var that = this;
1051
987
  return new Promise(function (resolve, reject) {
1052
988
  user.sendMFACode(code, {
1053
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
989
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1054
990
  var cred, e_3;
1055
- return __generator(this, function (_a) {
991
+ return tslib_1.__generator(this, function (_a) {
1056
992
  switch (_a.label) {
1057
993
  case 0:
1058
994
  logger.debug(session);
@@ -1097,9 +1033,9 @@ var AuthClass = /** @class */ (function () {
1097
1033
  var that = this;
1098
1034
  return new Promise(function (resolve, reject) {
1099
1035
  user.completeNewPasswordChallenge(password, requiredAttributes, {
1100
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
1036
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1101
1037
  var cred, e_4;
1102
- return __generator(this, function (_a) {
1038
+ return tslib_1.__generator(this, function (_a) {
1103
1039
  switch (_a.label) {
1104
1040
  case 0:
1105
1041
  logger.debug(session);
@@ -1198,10 +1134,10 @@ var AuthClass = /** @class */ (function () {
1198
1134
  **/
1199
1135
  // TODO: Check return type void
1200
1136
  AuthClass.prototype.deleteUser = function () {
1201
- return __awaiter(this, void 0, void 0, function () {
1137
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1202
1138
  var e_5, isSignedInHostedUI;
1203
1139
  var _this = this;
1204
- return __generator(this, function (_a) {
1140
+ return tslib_1.__generator(this, function (_a) {
1205
1141
  switch (_a.label) {
1206
1142
  case 0:
1207
1143
  _a.trys.push([0, 2, , 3]);
@@ -1216,10 +1152,10 @@ var AuthClass = /** @class */ (function () {
1216
1152
  case 3:
1217
1153
  isSignedInHostedUI = this._oAuthHandler &&
1218
1154
  this._storage.getItem('amplify-signin-with-hostedUI') === 'true';
1219
- return [2 /*return*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
1155
+ return [2 /*return*/, new Promise(function (res, rej) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1220
1156
  var user_1;
1221
1157
  var _this = this;
1222
- return __generator(this, function (_a) {
1158
+ return tslib_1.__generator(this, function (_a) {
1223
1159
  if (this.userPool) {
1224
1160
  user_1 = this.userPool.getCurrentUser();
1225
1161
  if (!user_1) {
@@ -1227,10 +1163,10 @@ var AuthClass = /** @class */ (function () {
1227
1163
  return [2 /*return*/, rej(new Error('No current user.'))];
1228
1164
  }
1229
1165
  else {
1230
- user_1.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1166
+ user_1.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1231
1167
  var cleanUpError_4;
1232
1168
  var _this = this;
1233
- return __generator(this, function (_a) {
1169
+ return tslib_1.__generator(this, function (_a) {
1234
1170
  switch (_a.label) {
1235
1171
  case 0:
1236
1172
  if (!err) return [3 /*break*/, 5];
@@ -1405,10 +1341,10 @@ var AuthClass = /** @class */ (function () {
1405
1341
  this.isRefreshTokenExpiredError(err));
1406
1342
  };
1407
1343
  AuthClass.prototype.cleanUpInvalidSession = function (user) {
1408
- return __awaiter(this, void 0, void 0, function () {
1344
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1409
1345
  var e_6;
1410
1346
  var _this = this;
1411
- return __generator(this, function (_a) {
1347
+ return tslib_1.__generator(this, function (_a) {
1412
1348
  switch (_a.label) {
1413
1349
  case 0:
1414
1350
  user.signOut();
@@ -1449,10 +1385,10 @@ var AuthClass = /** @class */ (function () {
1449
1385
  }
1450
1386
  return new Promise(function (res, rej) {
1451
1387
  _this._storageSync
1452
- .then(function () { return __awaiter(_this, void 0, void 0, function () {
1388
+ .then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1453
1389
  var user, clientMetadata;
1454
1390
  var _this = this;
1455
- return __generator(this, function (_a) {
1391
+ return tslib_1.__generator(this, function (_a) {
1456
1392
  switch (_a.label) {
1457
1393
  case 0:
1458
1394
  if (!this.isOAuthInProgress()) return [3 /*break*/, 2];
@@ -1488,10 +1424,10 @@ var AuthClass = /** @class */ (function () {
1488
1424
  }
1489
1425
  clientMetadata = this._config.clientMetadata;
1490
1426
  // refresh the session if the session expired.
1491
- user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1427
+ user.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1492
1428
  var cleanUpError_5, bypassCache, clientMetadata, _a, scope;
1493
1429
  var _this = this;
1494
- return __generator(this, function (_b) {
1430
+ return tslib_1.__generator(this, function (_b) {
1495
1431
  switch (_b.label) {
1496
1432
  case 0:
1497
1433
  if (!err) return [3 /*break*/, 5];
@@ -1522,9 +1458,9 @@ var AuthClass = /** @class */ (function () {
1522
1458
  clientMetadata = this._config.clientMetadata;
1523
1459
  _a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;
1524
1460
  if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {
1525
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
1461
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1526
1462
  var cleanUpError_6, preferredMFA, attributeList, i, attribute, userAttribute, attributes;
1527
- return __generator(this, function (_a) {
1463
+ return tslib_1.__generator(this, function (_a) {
1528
1464
  switch (_a.label) {
1529
1465
  case 0:
1530
1466
  if (!err) return [3 /*break*/, 7];
@@ -1594,9 +1530,9 @@ var AuthClass = /** @class */ (function () {
1594
1530
  * @return - A promise resolves to current authenticated CognitoUser if success
1595
1531
  */
1596
1532
  AuthClass.prototype.currentAuthenticatedUser = function (params) {
1597
- return __awaiter(this, void 0, void 0, function () {
1533
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1598
1534
  var federatedUser, e_7, federatedInfo, user, e_8;
1599
- return __generator(this, function (_a) {
1535
+ return tslib_1.__generator(this, function (_a) {
1600
1536
  switch (_a.label) {
1601
1537
  case 0:
1602
1538
  logger.debug('getting current authenticated user');
@@ -1616,7 +1552,7 @@ var AuthClass = /** @class */ (function () {
1616
1552
  try {
1617
1553
  federatedInfo = JSON.parse(this._storage.getItem('aws-amplify-federatedInfo'));
1618
1554
  if (federatedInfo) {
1619
- federatedUser = __assign(__assign({}, federatedInfo.user), { token: federatedInfo.token });
1555
+ federatedUser = tslib_1.__assign(tslib_1.__assign({}, federatedInfo.user), { token: federatedInfo.token });
1620
1556
  }
1621
1557
  }
1622
1558
  catch (e) {
@@ -1699,9 +1635,9 @@ var AuthClass = /** @class */ (function () {
1699
1635
  var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
1700
1636
  return new Promise(function (res, rej) {
1701
1637
  logger.debug('Getting the session from this user:', user);
1702
- user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1638
+ user.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1703
1639
  var cleanUpError_7;
1704
- return __generator(this, function (_a) {
1640
+ return tslib_1.__generator(this, function (_a) {
1705
1641
  switch (_a.label) {
1706
1642
  case 0:
1707
1643
  if (!err) return [3 /*break*/, 5];
@@ -1735,10 +1671,10 @@ var AuthClass = /** @class */ (function () {
1735
1671
  * @return - A promise resolves to be current user's credentials
1736
1672
  */
1737
1673
  AuthClass.prototype.currentUserCredentials = function () {
1738
- return __awaiter(this, void 0, void 0, function () {
1674
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1739
1675
  var e_9, federatedInfo;
1740
1676
  var _this = this;
1741
- return __generator(this, function (_a) {
1677
+ return tslib_1.__generator(this, function (_a) {
1742
1678
  switch (_a.label) {
1743
1679
  case 0:
1744
1680
  logger.debug('Getting current user credentials');
@@ -1847,10 +1783,10 @@ var AuthClass = /** @class */ (function () {
1847
1783
  .then(function (user) { return that.verifyUserAttributeSubmit(user, attr, code); });
1848
1784
  };
1849
1785
  AuthClass.prototype.cognitoIdentitySignOut = function (opts, user) {
1850
- return __awaiter(this, void 0, void 0, function () {
1786
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1851
1787
  var e_10, isSignedInHostedUI;
1852
1788
  var _this = this;
1853
- return __generator(this, function (_a) {
1789
+ return tslib_1.__generator(this, function (_a) {
1854
1790
  switch (_a.label) {
1855
1791
  case 0:
1856
1792
  _a.trys.push([0, 2, , 3]);
@@ -1871,10 +1807,10 @@ var AuthClass = /** @class */ (function () {
1871
1807
  // in order to use global signout
1872
1808
  // we must validate the user as an authenticated user by using getSession
1873
1809
  var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
1874
- user.getSession(function (err, result) { return __awaiter(_this, void 0, void 0, function () {
1810
+ user.getSession(function (err, result) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1875
1811
  var cleanUpError_8;
1876
1812
  var _this = this;
1877
- return __generator(this, function (_a) {
1813
+ return tslib_1.__generator(this, function (_a) {
1878
1814
  switch (_a.label) {
1879
1815
  case 0:
1880
1816
  if (!err) return [3 /*break*/, 5];
@@ -1953,9 +1889,9 @@ var AuthClass = /** @class */ (function () {
1953
1889
  * @return - A promise resolved if success
1954
1890
  */
1955
1891
  AuthClass.prototype.signOut = function (opts) {
1956
- return __awaiter(this, void 0, void 0, function () {
1892
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1957
1893
  var e_11, user;
1958
- return __generator(this, function (_a) {
1894
+ return tslib_1.__generator(this, function (_a) {
1959
1895
  switch (_a.label) {
1960
1896
  case 0:
1961
1897
  _a.trys.push([0, 2, , 3]);
@@ -1997,8 +1933,8 @@ var AuthClass = /** @class */ (function () {
1997
1933
  });
1998
1934
  };
1999
1935
  AuthClass.prototype.cleanCachedItems = function () {
2000
- return __awaiter(this, void 0, void 0, function () {
2001
- return __generator(this, function (_a) {
1936
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1937
+ return tslib_1.__generator(this, function (_a) {
2002
1938
  switch (_a.label) {
2003
1939
  case 0:
2004
1940
  // clear cognito cached item
@@ -2112,9 +2048,9 @@ var AuthClass = /** @class */ (function () {
2112
2048
  * @return {Object }- current User's information
2113
2049
  */
2114
2050
  AuthClass.prototype.currentUserInfo = function () {
2115
- return __awaiter(this, void 0, void 0, function () {
2051
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2116
2052
  var source, user, attributes, userAttrs, credentials, e_12, info, err_1, user;
2117
- return __generator(this, function (_a) {
2053
+ return tslib_1.__generator(this, function (_a) {
2118
2054
  switch (_a.label) {
2119
2055
  case 0:
2120
2056
  source = this.Credentials.getCredSource();
@@ -2168,9 +2104,9 @@ var AuthClass = /** @class */ (function () {
2168
2104
  });
2169
2105
  };
2170
2106
  AuthClass.prototype.federatedSignIn = function (providerOrOptions, response, user) {
2171
- return __awaiter(this, void 0, void 0, function () {
2107
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2172
2108
  var options, provider, customState, client_id, redirect_uri, provider, loggedInUser, token, identity_id, expires_at, credentials, currentUser;
2173
- return __generator(this, function (_a) {
2109
+ return tslib_1.__generator(this, function (_a) {
2174
2110
  switch (_a.label) {
2175
2111
  case 0:
2176
2112
  if (!this._config.identityPoolId && !this._config.userPoolId) {
@@ -2235,9 +2171,9 @@ var AuthClass = /** @class */ (function () {
2235
2171
  * @param {String} URL - optional parameter for customers to pass in the response URL
2236
2172
  */
2237
2173
  AuthClass.prototype._handleAuthResponse = function (URL) {
2238
- return __awaiter(this, void 0, void 0, function () {
2174
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2239
2175
  var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState, err_2;
2240
- return __generator(this, function (_b) {
2176
+ return tslib_1.__generator(this, function (_b) {
2241
2177
  switch (_b.label) {
2242
2178
  case 0:
2243
2179
  if (this.oAuthFlowInProgress) {
@@ -2257,7 +2193,7 @@ var AuthClass = /** @class */ (function () {
2257
2193
  .split('&')
2258
2194
  .map(function (entry) { return entry.split('='); })
2259
2195
  .find(function (_a) {
2260
- var _b = __read(_a, 1), k = _b[0];
2196
+ var _b = tslib_1.__read(_a, 1), k = _b[0];
2261
2197
  return k === 'code' || k === 'error';
2262
2198
  });
2263
2199
  hasTokenOrError = !!(url_1.parse(currentUrl).hash || '#')
@@ -2265,7 +2201,7 @@ var AuthClass = /** @class */ (function () {
2265
2201
  .split('&')
2266
2202
  .map(function (entry) { return entry.split('='); })
2267
2203
  .find(function (_a) {
2268
- var _b = __read(_a, 1), k = _b[0];
2204
+ var _b = tslib_1.__read(_a, 1), k = _b[0];
2269
2205
  return k === 'access_token' || k === 'error';
2270
2206
  });
2271
2207
  if (!(hasCodeOrError || hasTokenOrError)) return [3 /*break*/, 7];
@@ -2400,9 +2336,9 @@ var AuthClass = /** @class */ (function () {
2400
2336
  return Promise.reject(new Errors_1.NoUserPoolError(type));
2401
2337
  };
2402
2338
  AuthClass.prototype.rememberDevice = function () {
2403
- return __awaiter(this, void 0, void 0, function () {
2339
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2404
2340
  var currUser, error_2;
2405
- return __generator(this, function (_a) {
2341
+ return tslib_1.__generator(this, function (_a) {
2406
2342
  switch (_a.label) {
2407
2343
  case 0:
2408
2344
  _a.trys.push([0, 2, , 3]);
@@ -2439,9 +2375,9 @@ var AuthClass = /** @class */ (function () {
2439
2375
  });
2440
2376
  };
2441
2377
  AuthClass.prototype.forgetDevice = function () {
2442
- return __awaiter(this, void 0, void 0, function () {
2378
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2443
2379
  var currUser, error_3;
2444
- return __generator(this, function (_a) {
2380
+ return tslib_1.__generator(this, function (_a) {
2445
2381
  switch (_a.label) {
2446
2382
  case 0:
2447
2383
  _a.trys.push([0, 2, , 3]);
@@ -2478,9 +2414,9 @@ var AuthClass = /** @class */ (function () {
2478
2414
  });
2479
2415
  };
2480
2416
  AuthClass.prototype.fetchDevices = function () {
2481
- return __awaiter(this, void 0, void 0, function () {
2417
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2482
2418
  var currUser, error_4;
2483
- return __generator(this, function (_a) {
2419
+ return tslib_1.__generator(this, function (_a) {
2484
2420
  switch (_a.label) {
2485
2421
  case 0:
2486
2422
  _a.trys.push([0, 2, , 3]);