@aws-amplify/auth 4.6.1-unstable.5 → 4.6.2-clean-npm-artifacts.25

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/CHANGELOG.md CHANGED
@@ -3,6 +3,74 @@
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.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
+
8
+ **Note:** Version bump only for package @aws-amplify/auth
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.6.7](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.6...@aws-amplify/auth@4.6.7) (2022-09-20)
15
+
16
+ **Note:** Version bump only for package @aws-amplify/auth
17
+
18
+
19
+
20
+
21
+
22
+ ## [4.6.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.5...@aws-amplify/auth@4.6.6) (2022-09-08)
23
+
24
+ **Note:** Version bump only for package @aws-amplify/auth
25
+
26
+
27
+
28
+
29
+
30
+ ## [4.6.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.4...@aws-amplify/auth@4.6.5) (2022-09-01)
31
+
32
+ **Note:** Version bump only for package @aws-amplify/auth
33
+
34
+
35
+
36
+
37
+
38
+ ## [4.6.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.3...@aws-amplify/auth@4.6.4) (2022-08-23)
39
+
40
+ **Note:** Version bump only for package @aws-amplify/auth
41
+
42
+
43
+
44
+
45
+
46
+ ## [4.6.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.2...@aws-amplify/auth@4.6.3) (2022-08-18)
47
+
48
+ **Note:** Version bump only for package @aws-amplify/auth
49
+
50
+
51
+
52
+
53
+
54
+ ## [4.6.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.1...@aws-amplify/auth@4.6.2) (2022-08-16)
55
+
56
+ **Note:** Version bump only for package @aws-amplify/auth
57
+
58
+
59
+
60
+
61
+
62
+ ## [4.6.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.0...@aws-amplify/auth@4.6.1) (2022-08-01)
63
+
64
+
65
+ ### Bug Fixes
66
+
67
+ * **@aws-amplify/auth:** fix storage bug for auto sign in value ([#10139](https://github.com/aws-amplify/amplify-js/issues/10139)) ([06504e6](https://github.com/aws-amplify/amplify-js/commit/06504e649068f01b85392373fdf80e2ed2a6cada))
68
+ * **auth:** Unauthenticated identity throws AuthError without user … ([#10090](https://github.com/aws-amplify/amplify-js/issues/10090)) ([2ac9035](https://github.com/aws-amplify/amplify-js/commit/2ac903516ec295fbf098f6a6644000177f315184))
69
+
70
+
71
+
72
+
73
+
6
74
  # [4.6.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.10...@aws-amplify/auth@4.6.0) (2022-07-28)
7
75
 
8
76
 
@@ -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');
@@ -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());
@@ -555,9 +490,9 @@ var AuthClass = /** @class */ (function () {
555
490
  var _this = this;
556
491
  var that = this;
557
492
  return {
558
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
493
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
559
494
  var cred, e_1, currentUser, e_2;
560
- return __generator(this, function (_a) {
495
+ return tslib_1.__generator(this, function (_a) {
561
496
  switch (_a.label) {
562
497
  case 0:
563
498
  logger.debug(session);
@@ -713,9 +648,9 @@ var AuthClass = /** @class */ (function () {
713
648
  return new Promise(function (res, rej) {
714
649
  var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
715
650
  var bypassCache = params ? params.bypassCache : false;
716
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
651
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
717
652
  var cleanUpError_1, mfaType;
718
- return __generator(this, function (_a) {
653
+ return tslib_1.__generator(this, function (_a) {
719
654
  switch (_a.label) {
720
655
  case 0:
721
656
  if (!err) return [3 /*break*/, 5];
@@ -787,9 +722,9 @@ var AuthClass = /** @class */ (function () {
787
722
  AuthClass.prototype._getUserData = function (user, params) {
788
723
  var _this = this;
789
724
  return new Promise(function (res, rej) {
790
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
725
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
791
726
  var cleanUpError_2;
792
- return __generator(this, function (_a) {
727
+ return tslib_1.__generator(this, function (_a) {
793
728
  switch (_a.label) {
794
729
  case 0:
795
730
  if (!err) return [3 /*break*/, 5];
@@ -825,10 +760,10 @@ var AuthClass = /** @class */ (function () {
825
760
  * @return - A promise resolve if success
826
761
  */
827
762
  AuthClass.prototype.setPreferredMFA = function (user, mfaMethod) {
828
- return __awaiter(this, void 0, void 0, function () {
763
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
829
764
  var clientMetadata, userData, smsMfaSettings, totpMfaSettings, _a, mfaList, currentMFAType, that;
830
765
  var _this = this;
831
- return __generator(this, function (_b) {
766
+ return tslib_1.__generator(this, function (_b) {
832
767
  switch (_b.label) {
833
768
  case 0:
834
769
  clientMetadata = this._config.clientMetadata;
@@ -918,9 +853,9 @@ var AuthClass = /** @class */ (function () {
918
853
  logger.debug('Set user mfa success', result);
919
854
  logger.debug('Caching the latest user data into local');
920
855
  // cache the latest result into user data
921
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
856
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
922
857
  var cleanUpError_3;
923
- return __generator(this, function (_a) {
858
+ return tslib_1.__generator(this, function (_a) {
924
859
  switch (_a.label) {
925
860
  case 0:
926
861
  if (!err) return [3 /*break*/, 5];
@@ -1050,9 +985,9 @@ var AuthClass = /** @class */ (function () {
1050
985
  var that = this;
1051
986
  return new Promise(function (resolve, reject) {
1052
987
  user.sendMFACode(code, {
1053
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
988
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1054
989
  var cred, e_3;
1055
- return __generator(this, function (_a) {
990
+ return tslib_1.__generator(this, function (_a) {
1056
991
  switch (_a.label) {
1057
992
  case 0:
1058
993
  logger.debug(session);
@@ -1097,9 +1032,9 @@ var AuthClass = /** @class */ (function () {
1097
1032
  var that = this;
1098
1033
  return new Promise(function (resolve, reject) {
1099
1034
  user.completeNewPasswordChallenge(password, requiredAttributes, {
1100
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
1035
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1101
1036
  var cred, e_4;
1102
- return __generator(this, function (_a) {
1037
+ return tslib_1.__generator(this, function (_a) {
1103
1038
  switch (_a.label) {
1104
1039
  case 0:
1105
1040
  logger.debug(session);
@@ -1198,10 +1133,10 @@ var AuthClass = /** @class */ (function () {
1198
1133
  **/
1199
1134
  // TODO: Check return type void
1200
1135
  AuthClass.prototype.deleteUser = function () {
1201
- return __awaiter(this, void 0, void 0, function () {
1136
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1202
1137
  var e_5, isSignedInHostedUI;
1203
1138
  var _this = this;
1204
- return __generator(this, function (_a) {
1139
+ return tslib_1.__generator(this, function (_a) {
1205
1140
  switch (_a.label) {
1206
1141
  case 0:
1207
1142
  _a.trys.push([0, 2, , 3]);
@@ -1216,10 +1151,10 @@ var AuthClass = /** @class */ (function () {
1216
1151
  case 3:
1217
1152
  isSignedInHostedUI = this._oAuthHandler &&
1218
1153
  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 () {
1154
+ return [2 /*return*/, new Promise(function (res, rej) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1220
1155
  var user_1;
1221
1156
  var _this = this;
1222
- return __generator(this, function (_a) {
1157
+ return tslib_1.__generator(this, function (_a) {
1223
1158
  if (this.userPool) {
1224
1159
  user_1 = this.userPool.getCurrentUser();
1225
1160
  if (!user_1) {
@@ -1227,10 +1162,10 @@ var AuthClass = /** @class */ (function () {
1227
1162
  return [2 /*return*/, rej(new Error('No current user.'))];
1228
1163
  }
1229
1164
  else {
1230
- user_1.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1165
+ user_1.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1231
1166
  var cleanUpError_4;
1232
1167
  var _this = this;
1233
- return __generator(this, function (_a) {
1168
+ return tslib_1.__generator(this, function (_a) {
1234
1169
  switch (_a.label) {
1235
1170
  case 0:
1236
1171
  if (!err) return [3 /*break*/, 5];
@@ -1405,10 +1340,10 @@ var AuthClass = /** @class */ (function () {
1405
1340
  this.isRefreshTokenExpiredError(err));
1406
1341
  };
1407
1342
  AuthClass.prototype.cleanUpInvalidSession = function (user) {
1408
- return __awaiter(this, void 0, void 0, function () {
1343
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1409
1344
  var e_6;
1410
1345
  var _this = this;
1411
- return __generator(this, function (_a) {
1346
+ return tslib_1.__generator(this, function (_a) {
1412
1347
  switch (_a.label) {
1413
1348
  case 0:
1414
1349
  user.signOut();
@@ -1449,10 +1384,10 @@ var AuthClass = /** @class */ (function () {
1449
1384
  }
1450
1385
  return new Promise(function (res, rej) {
1451
1386
  _this._storageSync
1452
- .then(function () { return __awaiter(_this, void 0, void 0, function () {
1387
+ .then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1453
1388
  var user, clientMetadata;
1454
1389
  var _this = this;
1455
- return __generator(this, function (_a) {
1390
+ return tslib_1.__generator(this, function (_a) {
1456
1391
  switch (_a.label) {
1457
1392
  case 0:
1458
1393
  if (!this.isOAuthInProgress()) return [3 /*break*/, 2];
@@ -1488,10 +1423,10 @@ var AuthClass = /** @class */ (function () {
1488
1423
  }
1489
1424
  clientMetadata = this._config.clientMetadata;
1490
1425
  // refresh the session if the session expired.
1491
- user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1426
+ user.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1492
1427
  var cleanUpError_5, bypassCache, clientMetadata, _a, scope;
1493
1428
  var _this = this;
1494
- return __generator(this, function (_b) {
1429
+ return tslib_1.__generator(this, function (_b) {
1495
1430
  switch (_b.label) {
1496
1431
  case 0:
1497
1432
  if (!err) return [3 /*break*/, 5];
@@ -1522,9 +1457,9 @@ var AuthClass = /** @class */ (function () {
1522
1457
  clientMetadata = this._config.clientMetadata;
1523
1458
  _a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;
1524
1459
  if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {
1525
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
1460
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1526
1461
  var cleanUpError_6, preferredMFA, attributeList, i, attribute, userAttribute, attributes;
1527
- return __generator(this, function (_a) {
1462
+ return tslib_1.__generator(this, function (_a) {
1528
1463
  switch (_a.label) {
1529
1464
  case 0:
1530
1465
  if (!err) return [3 /*break*/, 7];
@@ -1594,9 +1529,9 @@ var AuthClass = /** @class */ (function () {
1594
1529
  * @return - A promise resolves to current authenticated CognitoUser if success
1595
1530
  */
1596
1531
  AuthClass.prototype.currentAuthenticatedUser = function (params) {
1597
- return __awaiter(this, void 0, void 0, function () {
1532
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1598
1533
  var federatedUser, e_7, federatedInfo, user, e_8;
1599
- return __generator(this, function (_a) {
1534
+ return tslib_1.__generator(this, function (_a) {
1600
1535
  switch (_a.label) {
1601
1536
  case 0:
1602
1537
  logger.debug('getting current authenticated user');
@@ -1616,7 +1551,7 @@ var AuthClass = /** @class */ (function () {
1616
1551
  try {
1617
1552
  federatedInfo = JSON.parse(this._storage.getItem('aws-amplify-federatedInfo'));
1618
1553
  if (federatedInfo) {
1619
- federatedUser = __assign(__assign({}, federatedInfo.user), { token: federatedInfo.token });
1554
+ federatedUser = tslib_1.__assign(tslib_1.__assign({}, federatedInfo.user), { token: federatedInfo.token });
1620
1555
  }
1621
1556
  }
1622
1557
  catch (e) {
@@ -1699,9 +1634,9 @@ var AuthClass = /** @class */ (function () {
1699
1634
  var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
1700
1635
  return new Promise(function (res, rej) {
1701
1636
  logger.debug('Getting the session from this user:', user);
1702
- user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1637
+ user.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1703
1638
  var cleanUpError_7;
1704
- return __generator(this, function (_a) {
1639
+ return tslib_1.__generator(this, function (_a) {
1705
1640
  switch (_a.label) {
1706
1641
  case 0:
1707
1642
  if (!err) return [3 /*break*/, 5];
@@ -1735,10 +1670,10 @@ var AuthClass = /** @class */ (function () {
1735
1670
  * @return - A promise resolves to be current user's credentials
1736
1671
  */
1737
1672
  AuthClass.prototype.currentUserCredentials = function () {
1738
- return __awaiter(this, void 0, void 0, function () {
1673
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1739
1674
  var e_9, federatedInfo;
1740
1675
  var _this = this;
1741
- return __generator(this, function (_a) {
1676
+ return tslib_1.__generator(this, function (_a) {
1742
1677
  switch (_a.label) {
1743
1678
  case 0:
1744
1679
  logger.debug('Getting current user credentials');
@@ -1847,10 +1782,10 @@ var AuthClass = /** @class */ (function () {
1847
1782
  .then(function (user) { return that.verifyUserAttributeSubmit(user, attr, code); });
1848
1783
  };
1849
1784
  AuthClass.prototype.cognitoIdentitySignOut = function (opts, user) {
1850
- return __awaiter(this, void 0, void 0, function () {
1785
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1851
1786
  var e_10, isSignedInHostedUI;
1852
1787
  var _this = this;
1853
- return __generator(this, function (_a) {
1788
+ return tslib_1.__generator(this, function (_a) {
1854
1789
  switch (_a.label) {
1855
1790
  case 0:
1856
1791
  _a.trys.push([0, 2, , 3]);
@@ -1871,10 +1806,10 @@ var AuthClass = /** @class */ (function () {
1871
1806
  // in order to use global signout
1872
1807
  // we must validate the user as an authenticated user by using getSession
1873
1808
  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 () {
1809
+ user.getSession(function (err, result) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1875
1810
  var cleanUpError_8;
1876
1811
  var _this = this;
1877
- return __generator(this, function (_a) {
1812
+ return tslib_1.__generator(this, function (_a) {
1878
1813
  switch (_a.label) {
1879
1814
  case 0:
1880
1815
  if (!err) return [3 /*break*/, 5];
@@ -1953,9 +1888,9 @@ var AuthClass = /** @class */ (function () {
1953
1888
  * @return - A promise resolved if success
1954
1889
  */
1955
1890
  AuthClass.prototype.signOut = function (opts) {
1956
- return __awaiter(this, void 0, void 0, function () {
1891
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1957
1892
  var e_11, user;
1958
- return __generator(this, function (_a) {
1893
+ return tslib_1.__generator(this, function (_a) {
1959
1894
  switch (_a.label) {
1960
1895
  case 0:
1961
1896
  _a.trys.push([0, 2, , 3]);
@@ -1997,8 +1932,8 @@ var AuthClass = /** @class */ (function () {
1997
1932
  });
1998
1933
  };
1999
1934
  AuthClass.prototype.cleanCachedItems = function () {
2000
- return __awaiter(this, void 0, void 0, function () {
2001
- return __generator(this, function (_a) {
1935
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1936
+ return tslib_1.__generator(this, function (_a) {
2002
1937
  switch (_a.label) {
2003
1938
  case 0:
2004
1939
  // clear cognito cached item
@@ -2112,9 +2047,9 @@ var AuthClass = /** @class */ (function () {
2112
2047
  * @return {Object }- current User's information
2113
2048
  */
2114
2049
  AuthClass.prototype.currentUserInfo = function () {
2115
- return __awaiter(this, void 0, void 0, function () {
2050
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2116
2051
  var source, user, attributes, userAttrs, credentials, e_12, info, err_1, user;
2117
- return __generator(this, function (_a) {
2052
+ return tslib_1.__generator(this, function (_a) {
2118
2053
  switch (_a.label) {
2119
2054
  case 0:
2120
2055
  source = this.Credentials.getCredSource();
@@ -2168,9 +2103,9 @@ var AuthClass = /** @class */ (function () {
2168
2103
  });
2169
2104
  };
2170
2105
  AuthClass.prototype.federatedSignIn = function (providerOrOptions, response, user) {
2171
- return __awaiter(this, void 0, void 0, function () {
2106
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2172
2107
  var options, provider, customState, client_id, redirect_uri, provider, loggedInUser, token, identity_id, expires_at, credentials, currentUser;
2173
- return __generator(this, function (_a) {
2108
+ return tslib_1.__generator(this, function (_a) {
2174
2109
  switch (_a.label) {
2175
2110
  case 0:
2176
2111
  if (!this._config.identityPoolId && !this._config.userPoolId) {
@@ -2235,9 +2170,9 @@ var AuthClass = /** @class */ (function () {
2235
2170
  * @param {String} URL - optional parameter for customers to pass in the response URL
2236
2171
  */
2237
2172
  AuthClass.prototype._handleAuthResponse = function (URL) {
2238
- return __awaiter(this, void 0, void 0, function () {
2173
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2239
2174
  var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState, err_2;
2240
- return __generator(this, function (_b) {
2175
+ return tslib_1.__generator(this, function (_b) {
2241
2176
  switch (_b.label) {
2242
2177
  case 0:
2243
2178
  if (this.oAuthFlowInProgress) {
@@ -2257,7 +2192,7 @@ var AuthClass = /** @class */ (function () {
2257
2192
  .split('&')
2258
2193
  .map(function (entry) { return entry.split('='); })
2259
2194
  .find(function (_a) {
2260
- var _b = __read(_a, 1), k = _b[0];
2195
+ var _b = tslib_1.__read(_a, 1), k = _b[0];
2261
2196
  return k === 'code' || k === 'error';
2262
2197
  });
2263
2198
  hasTokenOrError = !!(url_1.parse(currentUrl).hash || '#')
@@ -2265,7 +2200,7 @@ var AuthClass = /** @class */ (function () {
2265
2200
  .split('&')
2266
2201
  .map(function (entry) { return entry.split('='); })
2267
2202
  .find(function (_a) {
2268
- var _b = __read(_a, 1), k = _b[0];
2203
+ var _b = tslib_1.__read(_a, 1), k = _b[0];
2269
2204
  return k === 'access_token' || k === 'error';
2270
2205
  });
2271
2206
  if (!(hasCodeOrError || hasTokenOrError)) return [3 /*break*/, 7];
@@ -2400,9 +2335,9 @@ var AuthClass = /** @class */ (function () {
2400
2335
  return Promise.reject(new Errors_1.NoUserPoolError(type));
2401
2336
  };
2402
2337
  AuthClass.prototype.rememberDevice = function () {
2403
- return __awaiter(this, void 0, void 0, function () {
2338
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2404
2339
  var currUser, error_2;
2405
- return __generator(this, function (_a) {
2340
+ return tslib_1.__generator(this, function (_a) {
2406
2341
  switch (_a.label) {
2407
2342
  case 0:
2408
2343
  _a.trys.push([0, 2, , 3]);
@@ -2439,9 +2374,9 @@ var AuthClass = /** @class */ (function () {
2439
2374
  });
2440
2375
  };
2441
2376
  AuthClass.prototype.forgetDevice = function () {
2442
- return __awaiter(this, void 0, void 0, function () {
2377
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2443
2378
  var currUser, error_3;
2444
- return __generator(this, function (_a) {
2379
+ return tslib_1.__generator(this, function (_a) {
2445
2380
  switch (_a.label) {
2446
2381
  case 0:
2447
2382
  _a.trys.push([0, 2, , 3]);
@@ -2478,9 +2413,9 @@ var AuthClass = /** @class */ (function () {
2478
2413
  });
2479
2414
  };
2480
2415
  AuthClass.prototype.fetchDevices = function () {
2481
- return __awaiter(this, void 0, void 0, function () {
2416
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2482
2417
  var currUser, error_4;
2483
- return __generator(this, function (_a) {
2418
+ return tslib_1.__generator(this, function (_a) {
2484
2419
  switch (_a.label) {
2485
2420
  case 0:
2486
2421
  _a.trys.push([0, 2, , 3]);