@aws-amplify/auth 4.6.14 → 4.6.15-unstable.2

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 (85) hide show
  1. package/CHANGELOG.md +0 -8
  2. package/lib/.tsbuildinfo +3 -0
  3. package/lib/Auth.d.ts +301 -0
  4. package/lib/Auth.js +65 -140
  5. package/lib/Auth.js.map +1 -1
  6. package/lib/Errors.d.ts +9 -0
  7. package/lib/Errors.js +5 -27
  8. package/lib/Errors.js.map +1 -1
  9. package/lib/OAuth/OAuth.d.ts +29 -0
  10. package/lib/OAuth/OAuth.js +36 -118
  11. package/lib/OAuth/OAuth.js.map +1 -1
  12. package/lib/OAuth/oauthStorage.d.ts +5 -0
  13. package/lib/OAuth/oauthStorage.js +2 -12
  14. package/lib/OAuth/oauthStorage.js.map +1 -1
  15. package/lib/OAuth/oauthStorage.native.d.ts +5 -0
  16. package/lib/OAuth/oauthStorage.native.js +2 -12
  17. package/lib/OAuth/oauthStorage.native.js.map +1 -1
  18. package/lib/OAuth/urlOpener.d.ts +1 -0
  19. package/lib/OAuth/urlOpener.js +2 -12
  20. package/lib/OAuth/urlOpener.js.map +1 -1
  21. package/lib/OAuth/urlOpener.native.d.ts +1 -0
  22. package/lib/OAuth/urlOpener.native.js +2 -12
  23. package/lib/OAuth/urlOpener.native.js.map +1 -1
  24. package/lib/common/AuthErrorStrings.d.ts +17 -0
  25. package/lib/index.d.ts +9 -0
  26. package/lib/index.js +2 -12
  27. package/lib/index.js.map +1 -1
  28. package/lib/types/Auth.d.ts +170 -0
  29. package/lib/types/Auth.js +2 -12
  30. package/lib/types/Auth.js.map +1 -1
  31. package/lib/types/index.d.ts +1 -0
  32. package/lib/types/index.js +4 -16
  33. package/lib/types/index.js.map +1 -1
  34. package/lib/urlListener.d.ts +2 -0
  35. package/lib/urlListener.js +2 -12
  36. package/lib/urlListener.js.map +1 -1
  37. package/lib/urlListener.native.d.ts +2 -0
  38. package/lib/urlListener.native.js +9 -76
  39. package/lib/urlListener.native.js.map +1 -1
  40. package/lib-esm/.tsbuildinfo +3 -0
  41. package/lib-esm/Auth.js +5 -77
  42. package/lib-esm/Auth.js.map +1 -1
  43. package/lib-esm/Errors.js +3 -25
  44. package/lib-esm/Errors.js.map +1 -1
  45. package/lib-esm/OAuth/OAuth.js +13 -85
  46. package/lib-esm/OAuth/OAuth.js.map +1 -1
  47. package/lib-esm/OAuth/oauthStorage.js +2 -12
  48. package/lib-esm/OAuth/oauthStorage.js.map +1 -1
  49. package/lib-esm/OAuth/oauthStorage.native.js +2 -12
  50. package/lib-esm/OAuth/oauthStorage.native.js.map +1 -1
  51. package/lib-esm/OAuth/urlOpener.js +2 -12
  52. package/lib-esm/OAuth/urlOpener.js.map +1 -1
  53. package/lib-esm/OAuth/urlOpener.native.js +2 -12
  54. package/lib-esm/OAuth/urlOpener.native.js.map +1 -1
  55. package/lib-esm/index.js +2 -12
  56. package/lib-esm/index.js.map +1 -1
  57. package/lib-esm/types/Auth.js +2 -12
  58. package/lib-esm/types/Auth.js.map +1 -1
  59. package/lib-esm/types/index.js +2 -12
  60. package/lib-esm/types/index.js.map +1 -1
  61. package/lib-esm/urlListener.js +2 -12
  62. package/lib-esm/urlListener.js.map +1 -1
  63. package/lib-esm/urlListener.native.js +3 -70
  64. package/lib-esm/urlListener.native.js.map +1 -1
  65. package/package.json +13 -11
  66. package/src/Auth.ts +4 -14
  67. package/src/Errors.ts +2 -12
  68. package/src/OAuth/OAuth.ts +27 -37
  69. package/src/OAuth/oauthStorage.native.ts +2 -12
  70. package/src/OAuth/oauthStorage.ts +2 -12
  71. package/src/OAuth/urlOpener.native.ts +2 -12
  72. package/src/OAuth/urlOpener.ts +2 -12
  73. package/src/index.ts +2 -12
  74. package/src/types/Auth.ts +2 -12
  75. package/src/types/index.ts +2 -12
  76. package/src/urlListener.native.ts +2 -12
  77. package/src/urlListener.ts +2 -12
  78. package/build.js +0 -5
  79. package/dist/aws-amplify-auth.js +0 -14708
  80. package/dist/aws-amplify-auth.js.map +0 -1
  81. package/dist/aws-amplify-auth.min.js +0 -44
  82. package/dist/aws-amplify-auth.min.js.map +0 -1
  83. package/index.js +0 -7
  84. package/testSequencer.js +0 -24
  85. package/webpack.config.dev.js +0 -6
package/lib/Auth.js CHANGED
@@ -1,89 +1,14 @@
1
1
  "use strict";
2
- /*
3
- * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
6
- * the License. A copy of the License is located at
7
- *
8
- * http://aws.amazon.com/apache2.0/
9
- *
10
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
12
- * and limitations under the License.
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
- };
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
80
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ var tslib_1 = require("tslib");
81
6
  var types_1 = require("./types");
82
7
  var core_1 = require("@aws-amplify/core");
83
8
  var amazon_cognito_identity_js_1 = require("amazon-cognito-identity-js");
84
9
  var url_1 = require("url");
85
- var OAuth_1 = __importDefault(require("./OAuth/OAuth"));
86
- var urlListener_1 = __importDefault(require("./urlListener"));
10
+ var OAuth_1 = tslib_1.__importDefault(require("./OAuth/OAuth"));
11
+ var urlListener_1 = tslib_1.__importDefault(require("./urlListener"));
87
12
  var Errors_1 = require("./Errors");
88
13
  var Auth_1 = require("./types/Auth");
89
14
  var logger = new core_1.ConsoleLogger('AuthClass');
@@ -155,7 +80,7 @@ var AuthClass = /** @class */ (function () {
155
80
  if (!config)
156
81
  return this._config || {};
157
82
  logger.debug('configure Auth');
158
- var conf = Object.assign({}, this._config, core_1.Parser.parseMobilehubConfig(config).Auth, config);
83
+ var conf = Object.assign({}, this._config, core_1.parseAWSExports(config).Auth, config);
159
84
  this._config = conf;
160
85
  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
86
  if (!this._config.storage) {
@@ -386,10 +311,10 @@ var AuthClass = /** @class */ (function () {
386
311
  }, 5000);
387
312
  };
388
313
  AuthClass.prototype.signInAfterUserConfirmed = function (authDetails, listenEvent, autoSignInPollingIntervalId) {
389
- return __awaiter(this, void 0, void 0, function () {
314
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
390
315
  var user, error_1;
391
316
  var _this = this;
392
- return __generator(this, function (_a) {
317
+ return tslib_1.__generator(this, function (_a) {
393
318
  switch (_a.label) {
394
319
  case 0:
395
320
  user = this.createCognitoUser(authDetails.getUsername());
@@ -556,9 +481,9 @@ var AuthClass = /** @class */ (function () {
556
481
  var _this = this;
557
482
  var that = this;
558
483
  return {
559
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
484
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
560
485
  var cred, e_1, currentUser, e_2;
561
- return __generator(this, function (_a) {
486
+ return tslib_1.__generator(this, function (_a) {
562
487
  switch (_a.label) {
563
488
  case 0:
564
489
  logger.debug(session);
@@ -714,9 +639,9 @@ var AuthClass = /** @class */ (function () {
714
639
  return new Promise(function (res, rej) {
715
640
  var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
716
641
  var bypassCache = params ? params.bypassCache : false;
717
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
642
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
718
643
  var cleanUpError_1, mfaType;
719
- return __generator(this, function (_a) {
644
+ return tslib_1.__generator(this, function (_a) {
720
645
  switch (_a.label) {
721
646
  case 0:
722
647
  if (!err) return [3 /*break*/, 5];
@@ -788,9 +713,9 @@ var AuthClass = /** @class */ (function () {
788
713
  AuthClass.prototype._getUserData = function (user, params) {
789
714
  var _this = this;
790
715
  return new Promise(function (res, rej) {
791
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
716
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
792
717
  var cleanUpError_2;
793
- return __generator(this, function (_a) {
718
+ return tslib_1.__generator(this, function (_a) {
794
719
  switch (_a.label) {
795
720
  case 0:
796
721
  if (!err) return [3 /*break*/, 5];
@@ -826,10 +751,10 @@ var AuthClass = /** @class */ (function () {
826
751
  * @return - A promise resolve if success
827
752
  */
828
753
  AuthClass.prototype.setPreferredMFA = function (user, mfaMethod) {
829
- return __awaiter(this, void 0, void 0, function () {
754
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
830
755
  var clientMetadata, userData, smsMfaSettings, totpMfaSettings, _a, mfaList, currentMFAType, that;
831
756
  var _this = this;
832
- return __generator(this, function (_b) {
757
+ return tslib_1.__generator(this, function (_b) {
833
758
  switch (_b.label) {
834
759
  case 0:
835
760
  clientMetadata = this._config.clientMetadata;
@@ -919,9 +844,9 @@ var AuthClass = /** @class */ (function () {
919
844
  logger.debug('Set user mfa success', result);
920
845
  logger.debug('Caching the latest user data into local');
921
846
  // cache the latest result into user data
922
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
847
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
923
848
  var cleanUpError_3;
924
- return __generator(this, function (_a) {
849
+ return tslib_1.__generator(this, function (_a) {
925
850
  switch (_a.label) {
926
851
  case 0:
927
852
  if (!err) return [3 /*break*/, 5];
@@ -1051,9 +976,9 @@ var AuthClass = /** @class */ (function () {
1051
976
  var that = this;
1052
977
  return new Promise(function (resolve, reject) {
1053
978
  user.sendMFACode(code, {
1054
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
979
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1055
980
  var cred, e_3;
1056
- return __generator(this, function (_a) {
981
+ return tslib_1.__generator(this, function (_a) {
1057
982
  switch (_a.label) {
1058
983
  case 0:
1059
984
  logger.debug(session);
@@ -1098,9 +1023,9 @@ var AuthClass = /** @class */ (function () {
1098
1023
  var that = this;
1099
1024
  return new Promise(function (resolve, reject) {
1100
1025
  user.completeNewPasswordChallenge(password, requiredAttributes, {
1101
- onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {
1026
+ onSuccess: function (session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1102
1027
  var cred, e_4;
1103
- return __generator(this, function (_a) {
1028
+ return tslib_1.__generator(this, function (_a) {
1104
1029
  switch (_a.label) {
1105
1030
  case 0:
1106
1031
  logger.debug(session);
@@ -1199,10 +1124,10 @@ var AuthClass = /** @class */ (function () {
1199
1124
  **/
1200
1125
  // TODO: Check return type void
1201
1126
  AuthClass.prototype.deleteUser = function () {
1202
- return __awaiter(this, void 0, void 0, function () {
1127
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1203
1128
  var e_5, isSignedInHostedUI;
1204
1129
  var _this = this;
1205
- return __generator(this, function (_a) {
1130
+ return tslib_1.__generator(this, function (_a) {
1206
1131
  switch (_a.label) {
1207
1132
  case 0:
1208
1133
  _a.trys.push([0, 2, , 3]);
@@ -1217,10 +1142,10 @@ var AuthClass = /** @class */ (function () {
1217
1142
  case 3:
1218
1143
  isSignedInHostedUI = this._oAuthHandler &&
1219
1144
  this._storage.getItem('amplify-signin-with-hostedUI') === 'true';
1220
- return [2 /*return*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
1145
+ return [2 /*return*/, new Promise(function (res, rej) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1221
1146
  var user_1;
1222
1147
  var _this = this;
1223
- return __generator(this, function (_a) {
1148
+ return tslib_1.__generator(this, function (_a) {
1224
1149
  if (this.userPool) {
1225
1150
  user_1 = this.userPool.getCurrentUser();
1226
1151
  if (!user_1) {
@@ -1228,10 +1153,10 @@ var AuthClass = /** @class */ (function () {
1228
1153
  return [2 /*return*/, rej(new Error('No current user.'))];
1229
1154
  }
1230
1155
  else {
1231
- user_1.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1156
+ user_1.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1232
1157
  var cleanUpError_4;
1233
1158
  var _this = this;
1234
- return __generator(this, function (_a) {
1159
+ return tslib_1.__generator(this, function (_a) {
1235
1160
  switch (_a.label) {
1236
1161
  case 0:
1237
1162
  if (!err) return [3 /*break*/, 5];
@@ -1406,10 +1331,10 @@ var AuthClass = /** @class */ (function () {
1406
1331
  this.isRefreshTokenExpiredError(err));
1407
1332
  };
1408
1333
  AuthClass.prototype.cleanUpInvalidSession = function (user) {
1409
- return __awaiter(this, void 0, void 0, function () {
1334
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1410
1335
  var e_6;
1411
1336
  var _this = this;
1412
- return __generator(this, function (_a) {
1337
+ return tslib_1.__generator(this, function (_a) {
1413
1338
  switch (_a.label) {
1414
1339
  case 0:
1415
1340
  user.signOut();
@@ -1450,10 +1375,10 @@ var AuthClass = /** @class */ (function () {
1450
1375
  }
1451
1376
  return new Promise(function (res, rej) {
1452
1377
  _this._storageSync
1453
- .then(function () { return __awaiter(_this, void 0, void 0, function () {
1378
+ .then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1454
1379
  var user, clientMetadata;
1455
1380
  var _this = this;
1456
- return __generator(this, function (_a) {
1381
+ return tslib_1.__generator(this, function (_a) {
1457
1382
  switch (_a.label) {
1458
1383
  case 0:
1459
1384
  if (!this.isOAuthInProgress()) return [3 /*break*/, 2];
@@ -1489,10 +1414,10 @@ var AuthClass = /** @class */ (function () {
1489
1414
  }
1490
1415
  clientMetadata = this._config.clientMetadata;
1491
1416
  // refresh the session if the session expired.
1492
- user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1417
+ user.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1493
1418
  var cleanUpError_5, bypassCache, clientMetadata, _a, scope;
1494
1419
  var _this = this;
1495
- return __generator(this, function (_b) {
1420
+ return tslib_1.__generator(this, function (_b) {
1496
1421
  switch (_b.label) {
1497
1422
  case 0:
1498
1423
  if (!err) return [3 /*break*/, 5];
@@ -1523,9 +1448,9 @@ var AuthClass = /** @class */ (function () {
1523
1448
  clientMetadata = this._config.clientMetadata;
1524
1449
  _a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;
1525
1450
  if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {
1526
- user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
1451
+ user.getUserData(function (err, data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1527
1452
  var cleanUpError_6, preferredMFA, attributeList, i, attribute, userAttribute, attributes;
1528
- return __generator(this, function (_a) {
1453
+ return tslib_1.__generator(this, function (_a) {
1529
1454
  switch (_a.label) {
1530
1455
  case 0:
1531
1456
  if (!err) return [3 /*break*/, 7];
@@ -1595,9 +1520,9 @@ var AuthClass = /** @class */ (function () {
1595
1520
  * @return - A promise resolves to current authenticated CognitoUser if success
1596
1521
  */
1597
1522
  AuthClass.prototype.currentAuthenticatedUser = function (params) {
1598
- return __awaiter(this, void 0, void 0, function () {
1523
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1599
1524
  var federatedUser, e_7, federatedInfo, user, e_8;
1600
- return __generator(this, function (_a) {
1525
+ return tslib_1.__generator(this, function (_a) {
1601
1526
  switch (_a.label) {
1602
1527
  case 0:
1603
1528
  logger.debug('getting current authenticated user');
@@ -1617,7 +1542,7 @@ var AuthClass = /** @class */ (function () {
1617
1542
  try {
1618
1543
  federatedInfo = JSON.parse(this._storage.getItem('aws-amplify-federatedInfo'));
1619
1544
  if (federatedInfo) {
1620
- federatedUser = __assign(__assign({}, federatedInfo.user), { token: federatedInfo.token });
1545
+ federatedUser = tslib_1.__assign(tslib_1.__assign({}, federatedInfo.user), { token: federatedInfo.token });
1621
1546
  }
1622
1547
  }
1623
1548
  catch (e) {
@@ -1700,9 +1625,9 @@ var AuthClass = /** @class */ (function () {
1700
1625
  var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
1701
1626
  return new Promise(function (res, rej) {
1702
1627
  logger.debug('Getting the session from this user:', user);
1703
- user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
1628
+ user.getSession(function (err, session) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1704
1629
  var cleanUpError_7;
1705
- return __generator(this, function (_a) {
1630
+ return tslib_1.__generator(this, function (_a) {
1706
1631
  switch (_a.label) {
1707
1632
  case 0:
1708
1633
  if (!err) return [3 /*break*/, 5];
@@ -1736,10 +1661,10 @@ var AuthClass = /** @class */ (function () {
1736
1661
  * @return - A promise resolves to be current user's credentials
1737
1662
  */
1738
1663
  AuthClass.prototype.currentUserCredentials = function () {
1739
- return __awaiter(this, void 0, void 0, function () {
1664
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1740
1665
  var e_9, federatedInfo;
1741
1666
  var _this = this;
1742
- return __generator(this, function (_a) {
1667
+ return tslib_1.__generator(this, function (_a) {
1743
1668
  switch (_a.label) {
1744
1669
  case 0:
1745
1670
  logger.debug('Getting current user credentials');
@@ -1848,10 +1773,10 @@ var AuthClass = /** @class */ (function () {
1848
1773
  .then(function (user) { return that.verifyUserAttributeSubmit(user, attr, code); });
1849
1774
  };
1850
1775
  AuthClass.prototype.cognitoIdentitySignOut = function (opts, user) {
1851
- return __awaiter(this, void 0, void 0, function () {
1776
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1852
1777
  var e_10, isSignedInHostedUI;
1853
1778
  var _this = this;
1854
- return __generator(this, function (_a) {
1779
+ return tslib_1.__generator(this, function (_a) {
1855
1780
  switch (_a.label) {
1856
1781
  case 0:
1857
1782
  _a.trys.push([0, 2, , 3]);
@@ -1872,10 +1797,10 @@ var AuthClass = /** @class */ (function () {
1872
1797
  // in order to use global signout
1873
1798
  // we must validate the user as an authenticated user by using getSession
1874
1799
  var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
1875
- user.getSession(function (err, result) { return __awaiter(_this, void 0, void 0, function () {
1800
+ user.getSession(function (err, result) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1876
1801
  var cleanUpError_8;
1877
1802
  var _this = this;
1878
- return __generator(this, function (_a) {
1803
+ return tslib_1.__generator(this, function (_a) {
1879
1804
  switch (_a.label) {
1880
1805
  case 0:
1881
1806
  if (!err) return [3 /*break*/, 5];
@@ -1954,9 +1879,9 @@ var AuthClass = /** @class */ (function () {
1954
1879
  * @return - A promise resolved if success
1955
1880
  */
1956
1881
  AuthClass.prototype.signOut = function (opts) {
1957
- return __awaiter(this, void 0, void 0, function () {
1882
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1958
1883
  var e_11, user;
1959
- return __generator(this, function (_a) {
1884
+ return tslib_1.__generator(this, function (_a) {
1960
1885
  switch (_a.label) {
1961
1886
  case 0:
1962
1887
  _a.trys.push([0, 2, , 3]);
@@ -1998,8 +1923,8 @@ var AuthClass = /** @class */ (function () {
1998
1923
  });
1999
1924
  };
2000
1925
  AuthClass.prototype.cleanCachedItems = function () {
2001
- return __awaiter(this, void 0, void 0, function () {
2002
- return __generator(this, function (_a) {
1926
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
1927
+ return tslib_1.__generator(this, function (_a) {
2003
1928
  switch (_a.label) {
2004
1929
  case 0:
2005
1930
  // clear cognito cached item
@@ -2113,9 +2038,9 @@ var AuthClass = /** @class */ (function () {
2113
2038
  * @return {Object }- current User's information
2114
2039
  */
2115
2040
  AuthClass.prototype.currentUserInfo = function () {
2116
- return __awaiter(this, void 0, void 0, function () {
2041
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2117
2042
  var source, user, attributes, userAttrs, credentials, e_12, info, err_1, user;
2118
- return __generator(this, function (_a) {
2043
+ return tslib_1.__generator(this, function (_a) {
2119
2044
  switch (_a.label) {
2120
2045
  case 0:
2121
2046
  source = this.Credentials.getCredSource();
@@ -2169,9 +2094,9 @@ var AuthClass = /** @class */ (function () {
2169
2094
  });
2170
2095
  };
2171
2096
  AuthClass.prototype.federatedSignIn = function (providerOrOptions, response, user) {
2172
- return __awaiter(this, void 0, void 0, function () {
2097
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2173
2098
  var options, provider, customState, client_id, redirect_uri, provider, loggedInUser, token, identity_id, expires_at, credentials, currentUser;
2174
- return __generator(this, function (_a) {
2099
+ return tslib_1.__generator(this, function (_a) {
2175
2100
  switch (_a.label) {
2176
2101
  case 0:
2177
2102
  if (!this._config.identityPoolId && !this._config.userPoolId) {
@@ -2236,9 +2161,9 @@ var AuthClass = /** @class */ (function () {
2236
2161
  * @param {String} URL - optional parameter for customers to pass in the response URL
2237
2162
  */
2238
2163
  AuthClass.prototype._handleAuthResponse = function (URL) {
2239
- return __awaiter(this, void 0, void 0, function () {
2164
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2240
2165
  var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState, err_2;
2241
- return __generator(this, function (_b) {
2166
+ return tslib_1.__generator(this, function (_b) {
2242
2167
  switch (_b.label) {
2243
2168
  case 0:
2244
2169
  if (this.oAuthFlowInProgress) {
@@ -2258,7 +2183,7 @@ var AuthClass = /** @class */ (function () {
2258
2183
  .split('&')
2259
2184
  .map(function (entry) { return entry.split('='); })
2260
2185
  .find(function (_a) {
2261
- var _b = __read(_a, 1), k = _b[0];
2186
+ var _b = tslib_1.__read(_a, 1), k = _b[0];
2262
2187
  return k === 'code' || k === 'error';
2263
2188
  });
2264
2189
  hasTokenOrError = !!(url_1.parse(currentUrl).hash || '#')
@@ -2266,7 +2191,7 @@ var AuthClass = /** @class */ (function () {
2266
2191
  .split('&')
2267
2192
  .map(function (entry) { return entry.split('='); })
2268
2193
  .find(function (_a) {
2269
- var _b = __read(_a, 1), k = _b[0];
2194
+ var _b = tslib_1.__read(_a, 1), k = _b[0];
2270
2195
  return k === 'access_token' || k === 'error';
2271
2196
  });
2272
2197
  if (!(hasCodeOrError || hasTokenOrError)) return [3 /*break*/, 7];
@@ -2401,9 +2326,9 @@ var AuthClass = /** @class */ (function () {
2401
2326
  return Promise.reject(new Errors_1.NoUserPoolError(type));
2402
2327
  };
2403
2328
  AuthClass.prototype.rememberDevice = function () {
2404
- return __awaiter(this, void 0, void 0, function () {
2329
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2405
2330
  var currUser, error_2;
2406
- return __generator(this, function (_a) {
2331
+ return tslib_1.__generator(this, function (_a) {
2407
2332
  switch (_a.label) {
2408
2333
  case 0:
2409
2334
  _a.trys.push([0, 2, , 3]);
@@ -2440,9 +2365,9 @@ var AuthClass = /** @class */ (function () {
2440
2365
  });
2441
2366
  };
2442
2367
  AuthClass.prototype.forgetDevice = function () {
2443
- return __awaiter(this, void 0, void 0, function () {
2368
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2444
2369
  var currUser, error_3;
2445
- return __generator(this, function (_a) {
2370
+ return tslib_1.__generator(this, function (_a) {
2446
2371
  switch (_a.label) {
2447
2372
  case 0:
2448
2373
  _a.trys.push([0, 2, , 3]);
@@ -2479,9 +2404,9 @@ var AuthClass = /** @class */ (function () {
2479
2404
  });
2480
2405
  };
2481
2406
  AuthClass.prototype.fetchDevices = function () {
2482
- return __awaiter(this, void 0, void 0, function () {
2407
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
2483
2408
  var currUser, error_4;
2484
- return __generator(this, function (_a) {
2409
+ return tslib_1.__generator(this, function (_a) {
2485
2410
  switch (_a.label) {
2486
2411
  case 0:
2487
2412
  _a.trys.push([0, 2, , 3]);