@aws-amplify/auth 4.5.9-auth-hotfix.4 → 4.5.9-auth-hotfix.5

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,18 @@
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.5.9](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.8...@aws-amplify/auth@4.5.9) (2022-07-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **amazon-cognito-identity-js:** Missing cognito user challenge name … ([#10047](https://github.com/aws-amplify/amplify-js/issues/10047)) ([de0441b](https://github.com/aws-amplify/amplify-js/commit/de0441b4fa67409ccbc630c42890e2c58ee779fb)), closes [#6974](https://github.com/aws-amplify/amplify-js/issues/6974)
12
+ * Update Auth to import JS using named export ([#10033](https://github.com/aws-amplify/amplify-js/issues/10033)) ([11b537c](https://github.com/aws-amplify/amplify-js/commit/11b537c62fee74c04e4e3b72ba43a353ba5152c9))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [4.5.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.7...@aws-amplify/auth@4.5.8) (2022-06-18)
7
19
 
8
20
  **Note:** Version bump only for package @aws-amplify/auth
@@ -10728,7 +10728,6 @@ function () {
10728
10728
  this.user = null;
10729
10729
  this.oAuthFlowInProgress = false;
10730
10730
  this.inflightSessionPromise = null;
10731
- this.inflightSession = false;
10732
10731
  this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"];
10733
10732
 
10734
10733
  this.wrapRefreshSessionCallback = function (callback) {
@@ -12681,60 +12680,39 @@ function () {
12681
12680
  };
12682
12681
 
12683
12682
  AuthClass.prototype._userSession = function (_a) {
12684
- var _this = this;
12685
-
12686
12683
  var user = _a.user,
12687
12684
  _b = _a.bypassCache,
12688
12685
  bypassCache = _b === void 0 ? false : _b;
12686
+ return __awaiter(this, void 0, void 0, function () {
12687
+ var clientMetadata;
12689
12688
 
12690
- if (!user) {
12691
- logger.debug('the user is null');
12692
- return this.rejectAuthError(_types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].NoUserSession);
12693
- }
12694
-
12695
- var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
12696
-
12697
- return new Promise(function (resolve, rej) {
12698
- return __awaiter(_this, void 0, void 0, function () {
12699
- var debounceResolver;
12700
-
12701
- var _this = this;
12702
-
12703
- return __generator(this, function (_a) {
12704
- switch (_a.label) {
12705
- case 0:
12706
- // debugger;
12707
- logger.debug('Getting the session from this user:', user);
12708
- if (!this.inflightSession) return [3
12709
- /*break*/
12710
- , 2];
12711
- logger.debug('Waiting for another userSession call:');
12712
- return [4
12713
- /*yield*/
12714
- , this.inflightSessionPromise];
12715
-
12716
- case 1:
12717
- _a.sent();
12718
-
12719
- logger.debug('Debouncer resolved');
12720
- return [3
12721
- /*break*/
12722
- , 3];
12723
-
12724
- case 2:
12725
- logger.debug('Debouncer head');
12726
- this.inflightSession = true;
12727
- this.inflightSessionPromise = new Promise(function (res) {
12728
- debounceResolver = function debounceResolver() {
12729
- logger.debug('Debouncer resolving');
12730
- _this.inflightSessionPromise = null;
12731
- _this.inflightSession = false;
12732
- res();
12733
- };
12734
- });
12735
- _a.label = 3;
12689
+ var _this = this;
12690
+
12691
+ return __generator(this, function (_c) {
12692
+ switch (_c.label) {
12693
+ case 0:
12694
+ if (!user) {
12695
+ logger.debug('the user is null');
12696
+ return [2
12697
+ /*return*/
12698
+ , this.rejectAuthError(_types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].NoUserSession)];
12699
+ }
12700
+
12701
+ clientMetadata = this._config.clientMetadata;
12702
+ if (!this.inflightSessionPromise) return [3
12703
+ /*break*/
12704
+ , 2];
12705
+ return [4
12706
+ /*yield*/
12707
+ , this.inflightSessionPromise];
12708
+
12709
+ case 1:
12710
+ return [2
12711
+ /*return*/
12712
+ , _c.sent()];
12736
12713
 
12737
- case 3:
12714
+ case 2:
12715
+ this.inflightSessionPromise = new Promise(function (resolve, rej) {
12738
12716
  user.getSession(function (err, session) {
12739
12717
  return __awaiter(_this, void 0, void 0, function () {
12740
12718
  var cleanUpError_6;
@@ -12767,22 +12745,12 @@ function () {
12767
12745
  case 3:
12768
12746
  cleanUpError_6 = _a.sent();
12769
12747
  rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_6.message));
12770
-
12771
- if (debounceResolver) {
12772
- debounceResolver();
12773
- }
12774
-
12775
12748
  return [2
12776
12749
  /*return*/
12777
12750
  ];
12778
12751
 
12779
12752
  case 4:
12780
12753
  rej(err);
12781
-
12782
- if (debounceResolver) {
12783
- debounceResolver();
12784
- }
12785
-
12786
12754
  return [2
12787
12755
  /*return*/
12788
12756
  ];
@@ -12790,11 +12758,6 @@ function () {
12790
12758
  case 5:
12791
12759
  logger.debug('Succeed to get the user session', session);
12792
12760
  resolve(session);
12793
-
12794
- if (debounceResolver) {
12795
- debounceResolver();
12796
- }
12797
-
12798
12761
  return [2
12799
12762
  /*return*/
12800
12763
  ];
@@ -12805,11 +12768,17 @@ function () {
12805
12768
  clientMetadata: clientMetadata,
12806
12769
  bypassCache: bypassCache
12807
12770
  });
12808
- return [2
12809
- /*return*/
12810
- ];
12811
- }
12812
- });
12771
+ }).then(function (session) {
12772
+ _this.inflightSessionPromise = null;
12773
+ return session;
12774
+ })["catch"](function (err) {
12775
+ _this.inflightSessionPromise = null;
12776
+ throw err;
12777
+ });
12778
+ return [2
12779
+ /*return*/
12780
+ , this.inflightSessionPromise];
12781
+ }
12813
12782
  });
12814
12783
  });
12815
12784
  };
@@ -13098,7 +13067,7 @@ function () {
13098
13067
  };
13099
13068
 
13100
13069
  AuthClass.prototype.oAuthSignOutRedirect = function (resolve, reject) {
13101
- var isBrowser = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["JS"].browserOrNode().isBrowser;
13070
+ var isBrowser = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["browserOrNode"])().isBrowser;
13102
13071
 
13103
13072
  if (isBrowser) {
13104
13073
  this.oAuthSignOutRedirectOrReject(reject);
@@ -13556,7 +13525,7 @@ function () {
13556
13525
  dispatchAuthEvent('parsingCallbackUrl', {
13557
13526
  url: URL
13558
13527
  }, "The callback url is being parsed");
13559
- currentUrl = URL || (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["JS"].browserOrNode().isBrowser ? window.location.href : '');
13528
+ currentUrl = URL || (Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["browserOrNode"])().isBrowser ? window.location.href : '');
13560
13529
  hasCodeOrError = !!(Object(url__WEBPACK_IMPORTED_MODULE_3__["parse"])(currentUrl).query || '').split('&').map(function (entry) {
13561
13530
  return entry.split('=');
13562
13531
  }).find(function (_a) {
@@ -15012,12 +14981,12 @@ __webpack_require__.r(__webpack_exports__);
15012
14981
  */
15013
14982
 
15014
14983
  /* harmony default export */ __webpack_exports__["default"] = (function (callback) {
15015
- if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["JS"].browserOrNode().isBrowser && window.location) {
14984
+ if (Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["browserOrNode"])().isBrowser && window.location) {
15016
14985
  var url = window.location.href;
15017
14986
  callback({
15018
14987
  url: url
15019
14988
  });
15020
- } else if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["JS"].browserOrNode().isNode) {
14989
+ } else if (Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["browserOrNode"])().isNode) {
15021
14990
  // continue building on ssr
15022
14991
  (function () {}); // noop
15023
14992