@aws-amplify/datastore 3.7.8-unstable.1 → 3.7.8-unstable.6
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.
|
@@ -51294,20 +51294,8 @@ module.exports = PushStream;
|
|
|
51294
51294
|
__webpack_require__.r(__webpack_exports__);
|
|
51295
51295
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return AuthenticationDetails; });
|
|
51296
51296
|
/*!
|
|
51297
|
-
* Copyright
|
|
51298
|
-
*
|
|
51299
|
-
*
|
|
51300
|
-
* Licensed under the Amazon Software License (the "License").
|
|
51301
|
-
* You may not use this file except in compliance with the
|
|
51302
|
-
* License. A copy of the License is located at
|
|
51303
|
-
*
|
|
51304
|
-
* http://aws.amazon.com/asl/
|
|
51305
|
-
*
|
|
51306
|
-
* or in the "license" file accompanying this file. This file is
|
|
51307
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
51308
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
51309
|
-
* for the specific language governing permissions and
|
|
51310
|
-
* limitations under the License.
|
|
51297
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
51298
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
51311
51299
|
*/
|
|
51312
51300
|
|
|
51313
51301
|
/** @class */
|
|
@@ -51407,20 +51395,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
51407
51395
|
/* harmony import */ var _utils_WordArray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/WordArray */ "../amazon-cognito-identity-js/es/utils/WordArray.js");
|
|
51408
51396
|
/* harmony import */ var _BigInteger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BigInteger */ "../amazon-cognito-identity-js/es/BigInteger.js");
|
|
51409
51397
|
/*!
|
|
51410
|
-
* Copyright
|
|
51411
|
-
*
|
|
51412
|
-
*
|
|
51413
|
-
* Licensed under the Amazon Software License (the "License").
|
|
51414
|
-
* You may not use this file except in compliance with the
|
|
51415
|
-
* License. A copy of the License is located at
|
|
51416
|
-
*
|
|
51417
|
-
* http://aws.amazon.com/asl/
|
|
51418
|
-
*
|
|
51419
|
-
* or in the "license" file accompanying this file. This file is
|
|
51420
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
51421
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
51422
|
-
* for the specific language governing permissions and
|
|
51423
|
-
* limitations under the License.
|
|
51398
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
51399
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
51424
51400
|
*/
|
|
51425
51401
|
|
|
51426
51402
|
|
|
@@ -53057,21 +53033,9 @@ function _setPrototypeOf(o, p) {
|
|
|
53057
53033
|
|
|
53058
53034
|
return _setPrototypeOf(o, p);
|
|
53059
53035
|
}
|
|
53060
|
-
|
|
53061
|
-
* Copyright
|
|
53062
|
-
*
|
|
53063
|
-
*
|
|
53064
|
-
* Licensed under the Amazon Software License (the "License").
|
|
53065
|
-
* You may not use this file except in compliance with the
|
|
53066
|
-
* License. A copy of the License is located at
|
|
53067
|
-
*
|
|
53068
|
-
* http://aws.amazon.com/asl/
|
|
53069
|
-
*
|
|
53070
|
-
* or in the "license" file accompanying this file. This file is
|
|
53071
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
53072
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
53073
|
-
* for the specific language governing permissions and
|
|
53074
|
-
* limitations under the License.
|
|
53036
|
+
/*!
|
|
53037
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
53038
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
53075
53039
|
*/
|
|
53076
53040
|
|
|
53077
53041
|
|
|
@@ -53127,20 +53091,8 @@ function _setPrototypeOf(o, p) {
|
|
|
53127
53091
|
return _setPrototypeOf(o, p);
|
|
53128
53092
|
}
|
|
53129
53093
|
/*!
|
|
53130
|
-
* Copyright
|
|
53131
|
-
*
|
|
53132
|
-
*
|
|
53133
|
-
* Licensed under the Amazon Software License (the "License").
|
|
53134
|
-
* You may not use this file except in compliance with the
|
|
53135
|
-
* License. A copy of the License is located at
|
|
53136
|
-
*
|
|
53137
|
-
* http://aws.amazon.com/asl/
|
|
53138
|
-
*
|
|
53139
|
-
* or in the "license" file accompanying this file. This file is
|
|
53140
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
53141
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
53142
|
-
* for the specific language governing permissions and
|
|
53143
|
-
* limitations under the License.
|
|
53094
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
53095
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
53144
53096
|
*/
|
|
53145
53097
|
|
|
53146
53098
|
|
|
@@ -53182,20 +53134,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53182
53134
|
/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ "../../node_modules/buffer/index.js");
|
|
53183
53135
|
/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(buffer__WEBPACK_IMPORTED_MODULE_0__);
|
|
53184
53136
|
/*!
|
|
53185
|
-
* Copyright
|
|
53186
|
-
*
|
|
53187
|
-
*
|
|
53188
|
-
* Licensed under the Amazon Software License (the "License").
|
|
53189
|
-
* You may not use this file except in compliance with the
|
|
53190
|
-
* License. A copy of the License is located at
|
|
53191
|
-
*
|
|
53192
|
-
* http://aws.amazon.com/asl/
|
|
53193
|
-
*
|
|
53194
|
-
* or in the "license" file accompanying this file. This file is
|
|
53195
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
53196
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
53197
|
-
* for the specific language governing permissions and
|
|
53198
|
-
* limitations under the License.
|
|
53137
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
53138
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
53199
53139
|
*/
|
|
53200
53140
|
|
|
53201
53141
|
/** @class */
|
|
@@ -53269,20 +53209,8 @@ var CognitoJwtToken = /*#__PURE__*/function () {
|
|
|
53269
53209
|
__webpack_require__.r(__webpack_exports__);
|
|
53270
53210
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CognitoRefreshToken; });
|
|
53271
53211
|
/*!
|
|
53272
|
-
* Copyright
|
|
53273
|
-
*
|
|
53274
|
-
*
|
|
53275
|
-
* Licensed under the Amazon Software License (the "License").
|
|
53276
|
-
* You may not use this file except in compliance with the
|
|
53277
|
-
* License. A copy of the License is located at
|
|
53278
|
-
*
|
|
53279
|
-
* http://aws.amazon.com/asl/
|
|
53280
|
-
*
|
|
53281
|
-
* or in the "license" file accompanying this file. This file is
|
|
53282
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
53283
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
53284
|
-
* for the specific language governing permissions and
|
|
53285
|
-
* limitations under the License.
|
|
53212
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
53213
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
53286
53214
|
*/
|
|
53287
53215
|
|
|
53288
53216
|
/** @class */
|
|
@@ -53346,20 +53274,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53346
53274
|
/* harmony import */ var _CognitoUserAttribute__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./CognitoUserAttribute */ "../amazon-cognito-identity-js/es/CognitoUserAttribute.js");
|
|
53347
53275
|
/* harmony import */ var _StorageHelper__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./StorageHelper */ "../amazon-cognito-identity-js/es/StorageHelper.js");
|
|
53348
53276
|
/*!
|
|
53349
|
-
* Copyright
|
|
53350
|
-
*
|
|
53351
|
-
*
|
|
53352
|
-
* Licensed under the Amazon Software License (the "License").
|
|
53353
|
-
* You may not use this file except in compliance with the
|
|
53354
|
-
* License. A copy of the License is located at
|
|
53355
|
-
*
|
|
53356
|
-
* http://aws.amazon.com/asl/
|
|
53357
|
-
*
|
|
53358
|
-
* or in the "license" file accompanying this file. This file is
|
|
53359
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
53360
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
53361
|
-
* for the specific language governing permissions and
|
|
53362
|
-
* limitations under the License.
|
|
53277
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
53278
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
53363
53279
|
*/
|
|
53364
53280
|
|
|
53365
53281
|
|
|
@@ -55467,20 +55383,8 @@ var CognitoUser = /*#__PURE__*/function () {
|
|
|
55467
55383
|
__webpack_require__.r(__webpack_exports__);
|
|
55468
55384
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CognitoUserAttribute; });
|
|
55469
55385
|
/*!
|
|
55470
|
-
* Copyright
|
|
55471
|
-
*
|
|
55472
|
-
*
|
|
55473
|
-
* Licensed under the Amazon Software License (the "License").
|
|
55474
|
-
* You may not use this file except in compliance with the
|
|
55475
|
-
* License. A copy of the License is located at
|
|
55476
|
-
*
|
|
55477
|
-
* http://aws.amazon.com/asl/
|
|
55478
|
-
*
|
|
55479
|
-
* or in the "license" file accompanying this file. This file is
|
|
55480
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
55481
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
55482
|
-
* for the specific language governing permissions and
|
|
55483
|
-
* limitations under the License.
|
|
55386
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
55387
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
55484
55388
|
*/
|
|
55485
55389
|
|
|
55486
55390
|
/** @class */
|
|
@@ -55579,20 +55483,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
55579
55483
|
/* harmony import */ var _CognitoUser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CognitoUser */ "../amazon-cognito-identity-js/es/CognitoUser.js");
|
|
55580
55484
|
/* harmony import */ var _StorageHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StorageHelper */ "../amazon-cognito-identity-js/es/StorageHelper.js");
|
|
55581
55485
|
/*!
|
|
55582
|
-
* Copyright
|
|
55583
|
-
*
|
|
55584
|
-
*
|
|
55585
|
-
* Licensed under the Amazon Software License (the "License").
|
|
55586
|
-
* You may not use this file except in compliance with the
|
|
55587
|
-
* License. A copy of the License is located at
|
|
55588
|
-
*
|
|
55589
|
-
* http://aws.amazon.com/asl/
|
|
55590
|
-
*
|
|
55591
|
-
* or in the "license" file accompanying this file. This file is
|
|
55592
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
55593
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
55594
|
-
* for the specific language governing permissions and
|
|
55595
|
-
* limitations under the License.
|
|
55486
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
55487
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
55596
55488
|
*/
|
|
55597
55489
|
|
|
55598
55490
|
|
|
@@ -55793,20 +55685,8 @@ var CognitoUserPool = /*#__PURE__*/function () {
|
|
|
55793
55685
|
__webpack_require__.r(__webpack_exports__);
|
|
55794
55686
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CognitoUserSession; });
|
|
55795
55687
|
/*!
|
|
55796
|
-
* Copyright
|
|
55797
|
-
*
|
|
55798
|
-
*
|
|
55799
|
-
* Licensed under the Amazon Software License (the "License").
|
|
55800
|
-
* You may not use this file except in compliance with the
|
|
55801
|
-
* License. A copy of the License is located at
|
|
55802
|
-
*
|
|
55803
|
-
* http://aws.amazon.com/asl/
|
|
55804
|
-
*
|
|
55805
|
-
* or in the "license" file accompanying this file. This file is
|
|
55806
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
55807
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
55808
|
-
* for the specific language governing permissions and
|
|
55809
|
-
* limitations under the License.
|
|
55688
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
55689
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
55810
55690
|
*/
|
|
55811
55691
|
|
|
55812
55692
|
/** @class */
|
|
@@ -56055,20 +55935,8 @@ var CookieStorage = /*#__PURE__*/function () {
|
|
|
56055
55935
|
__webpack_require__.r(__webpack_exports__);
|
|
56056
55936
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return DateHelper; });
|
|
56057
55937
|
/*!
|
|
56058
|
-
* Copyright
|
|
56059
|
-
*
|
|
56060
|
-
*
|
|
56061
|
-
* Licensed under the Amazon Software License (the "License").
|
|
56062
|
-
* You may not use this file except in compliance with the
|
|
56063
|
-
* License. A copy of the License is located at
|
|
56064
|
-
*
|
|
56065
|
-
* http://aws.amazon.com/asl/
|
|
56066
|
-
*
|
|
56067
|
-
* or in the "license" file accompanying this file. This file is
|
|
56068
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
56069
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
56070
|
-
* for the specific language governing permissions and
|
|
56071
|
-
* limitations under the License.
|
|
55938
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
55939
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56072
55940
|
*/
|
|
56073
55941
|
var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
56074
55942
|
var weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
@@ -56130,17 +55998,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56130
55998
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return Platform; });
|
|
56131
55999
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserAgent", function() { return getUserAgent; });
|
|
56132
56000
|
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version */ "../amazon-cognito-identity-js/es/Platform/version.js");
|
|
56133
|
-
|
|
56134
|
-
* Copyright
|
|
56135
|
-
*
|
|
56136
|
-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
56137
|
-
* the License. A copy of the License is located at
|
|
56138
|
-
*
|
|
56139
|
-
* http://aws.amazon.com/apache2.0/
|
|
56140
|
-
*
|
|
56141
|
-
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
56142
|
-
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
56143
|
-
* and limitations under the License.
|
|
56001
|
+
/*!
|
|
56002
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
56003
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56144
56004
|
*/
|
|
56145
56005
|
|
|
56146
56006
|
var BASE_USER_AGENT = "aws-amplify/" + _version__WEBPACK_IMPORTED_MODULE_0__["version"];
|
|
@@ -56206,20 +56066,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56206
56066
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MemoryStorage", function() { return MemoryStorage; });
|
|
56207
56067
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return StorageHelper; });
|
|
56208
56068
|
/*!
|
|
56209
|
-
* Copyright
|
|
56210
|
-
*
|
|
56211
|
-
*
|
|
56212
|
-
* Licensed under the Amazon Software License (the "License").
|
|
56213
|
-
* You may not use this file except in compliance with the
|
|
56214
|
-
* License. A copy of the License is located at
|
|
56215
|
-
*
|
|
56216
|
-
* http://aws.amazon.com/asl/
|
|
56217
|
-
*
|
|
56218
|
-
* or in the "license" file accompanying this file. This file is
|
|
56219
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
56220
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
56221
|
-
* for the specific language governing permissions and
|
|
56222
|
-
* limitations under the License.
|
|
56069
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
56070
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56223
56071
|
*/
|
|
56224
56072
|
var dataMemory = {};
|
|
56225
56073
|
/** @class */
|
|
@@ -56391,20 +56239,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56391
56239
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WordArray", function() { return _utils_WordArray__WEBPACK_IMPORTED_MODULE_12__["default"]; });
|
|
56392
56240
|
|
|
56393
56241
|
/*!
|
|
56394
|
-
* Copyright
|
|
56395
|
-
*
|
|
56396
|
-
*
|
|
56397
|
-
* Licensed under the Amazon Software License (the "License").
|
|
56398
|
-
* You may not use this file except in compliance with the
|
|
56399
|
-
* License. A copy of the License is located at
|
|
56400
|
-
*
|
|
56401
|
-
* http://aws.amazon.com/asl/
|
|
56402
|
-
*
|
|
56403
|
-
* or in the "license" file accompanying this file. This file is
|
|
56404
|
-
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
56405
|
-
* CONDITIONS OF ANY KIND, express or implied. See the License
|
|
56406
|
-
* for the specific language governing permissions and
|
|
56407
|
-
* limitations under the License.
|
|
56242
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
56243
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56408
56244
|
*/
|
|
56409
56245
|
|
|
56410
56246
|
|
|
@@ -61349,21 +61185,68 @@ function () {
|
|
|
61349
61185
|
|
|
61350
61186
|
var bypassCache = params ? params.bypassCache : false;
|
|
61351
61187
|
user.getUserData(function (err, data) {
|
|
61352
|
-
|
|
61353
|
-
|
|
61354
|
-
|
|
61355
|
-
|
|
61356
|
-
|
|
61188
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
61189
|
+
var cleanUpError_1, mfaType;
|
|
61190
|
+
return __generator(this, function (_a) {
|
|
61191
|
+
switch (_a.label) {
|
|
61192
|
+
case 0:
|
|
61193
|
+
if (!err) return [3
|
|
61194
|
+
/*break*/
|
|
61195
|
+
, 5];
|
|
61196
|
+
logger.debug('getting preferred mfa failed', err);
|
|
61197
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
61198
|
+
/*break*/
|
|
61199
|
+
, 4];
|
|
61200
|
+
_a.label = 1;
|
|
61357
61201
|
|
|
61358
|
-
|
|
61202
|
+
case 1:
|
|
61203
|
+
_a.trys.push([1, 3,, 4]);
|
|
61359
61204
|
|
|
61360
|
-
|
|
61361
|
-
|
|
61362
|
-
|
|
61363
|
-
|
|
61364
|
-
|
|
61365
|
-
|
|
61366
|
-
|
|
61205
|
+
return [4
|
|
61206
|
+
/*yield*/
|
|
61207
|
+
, this.cleanUpInvalidSession(user)];
|
|
61208
|
+
|
|
61209
|
+
case 2:
|
|
61210
|
+
_a.sent();
|
|
61211
|
+
|
|
61212
|
+
return [3
|
|
61213
|
+
/*break*/
|
|
61214
|
+
, 4];
|
|
61215
|
+
|
|
61216
|
+
case 3:
|
|
61217
|
+
cleanUpError_1 = _a.sent();
|
|
61218
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_1.message));
|
|
61219
|
+
return [2
|
|
61220
|
+
/*return*/
|
|
61221
|
+
];
|
|
61222
|
+
|
|
61223
|
+
case 4:
|
|
61224
|
+
rej(err);
|
|
61225
|
+
return [2
|
|
61226
|
+
/*return*/
|
|
61227
|
+
];
|
|
61228
|
+
|
|
61229
|
+
case 5:
|
|
61230
|
+
mfaType = that._getMfaTypeFromUserData(data);
|
|
61231
|
+
|
|
61232
|
+
if (!mfaType) {
|
|
61233
|
+
rej('invalid MFA Type');
|
|
61234
|
+
return [2
|
|
61235
|
+
/*return*/
|
|
61236
|
+
];
|
|
61237
|
+
} else {
|
|
61238
|
+
res(mfaType);
|
|
61239
|
+
return [2
|
|
61240
|
+
/*return*/
|
|
61241
|
+
];
|
|
61242
|
+
}
|
|
61243
|
+
|
|
61244
|
+
return [2
|
|
61245
|
+
/*return*/
|
|
61246
|
+
];
|
|
61247
|
+
}
|
|
61248
|
+
});
|
|
61249
|
+
});
|
|
61367
61250
|
}, {
|
|
61368
61251
|
bypassCache: bypassCache,
|
|
61369
61252
|
clientMetadata: clientMetadata
|
|
@@ -61405,16 +61288,62 @@ function () {
|
|
|
61405
61288
|
};
|
|
61406
61289
|
|
|
61407
61290
|
AuthClass.prototype._getUserData = function (user, params) {
|
|
61291
|
+
var _this = this;
|
|
61292
|
+
|
|
61408
61293
|
return new Promise(function (res, rej) {
|
|
61409
61294
|
user.getUserData(function (err, data) {
|
|
61410
|
-
|
|
61411
|
-
|
|
61412
|
-
|
|
61413
|
-
|
|
61414
|
-
|
|
61415
|
-
|
|
61416
|
-
|
|
61417
|
-
|
|
61295
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
61296
|
+
var cleanUpError_2;
|
|
61297
|
+
return __generator(this, function (_a) {
|
|
61298
|
+
switch (_a.label) {
|
|
61299
|
+
case 0:
|
|
61300
|
+
if (!err) return [3
|
|
61301
|
+
/*break*/
|
|
61302
|
+
, 5];
|
|
61303
|
+
logger.debug('getting user data failed', err);
|
|
61304
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
61305
|
+
/*break*/
|
|
61306
|
+
, 4];
|
|
61307
|
+
_a.label = 1;
|
|
61308
|
+
|
|
61309
|
+
case 1:
|
|
61310
|
+
_a.trys.push([1, 3,, 4]);
|
|
61311
|
+
|
|
61312
|
+
return [4
|
|
61313
|
+
/*yield*/
|
|
61314
|
+
, this.cleanUpInvalidSession(user)];
|
|
61315
|
+
|
|
61316
|
+
case 2:
|
|
61317
|
+
_a.sent();
|
|
61318
|
+
|
|
61319
|
+
return [3
|
|
61320
|
+
/*break*/
|
|
61321
|
+
, 4];
|
|
61322
|
+
|
|
61323
|
+
case 3:
|
|
61324
|
+
cleanUpError_2 = _a.sent();
|
|
61325
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_2.message));
|
|
61326
|
+
return [2
|
|
61327
|
+
/*return*/
|
|
61328
|
+
];
|
|
61329
|
+
|
|
61330
|
+
case 4:
|
|
61331
|
+
rej(err);
|
|
61332
|
+
return [2
|
|
61333
|
+
/*return*/
|
|
61334
|
+
];
|
|
61335
|
+
|
|
61336
|
+
case 5:
|
|
61337
|
+
res(data);
|
|
61338
|
+
_a.label = 6;
|
|
61339
|
+
|
|
61340
|
+
case 6:
|
|
61341
|
+
return [2
|
|
61342
|
+
/*return*/
|
|
61343
|
+
];
|
|
61344
|
+
}
|
|
61345
|
+
});
|
|
61346
|
+
});
|
|
61418
61347
|
}, params);
|
|
61419
61348
|
});
|
|
61420
61349
|
};
|
|
@@ -61430,6 +61359,8 @@ function () {
|
|
|
61430
61359
|
return __awaiter(this, void 0, void 0, function () {
|
|
61431
61360
|
var clientMetadata, userData, smsMfaSettings, totpMfaSettings, _a, mfaList, currentMFAType, that;
|
|
61432
61361
|
|
|
61362
|
+
var _this = this;
|
|
61363
|
+
|
|
61433
61364
|
return __generator(this, function (_b) {
|
|
61434
61365
|
switch (_b.label) {
|
|
61435
61366
|
case 0:
|
|
@@ -61569,12 +61500,53 @@ function () {
|
|
|
61569
61500
|
logger.debug('Caching the latest user data into local'); // cache the latest result into user data
|
|
61570
61501
|
|
|
61571
61502
|
user.getUserData(function (err, data) {
|
|
61572
|
-
|
|
61573
|
-
|
|
61574
|
-
return
|
|
61575
|
-
|
|
61576
|
-
|
|
61577
|
-
|
|
61503
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
61504
|
+
var cleanUpError_3;
|
|
61505
|
+
return __generator(this, function (_a) {
|
|
61506
|
+
switch (_a.label) {
|
|
61507
|
+
case 0:
|
|
61508
|
+
if (!err) return [3
|
|
61509
|
+
/*break*/
|
|
61510
|
+
, 5];
|
|
61511
|
+
logger.debug('getting user data failed', err);
|
|
61512
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
61513
|
+
/*break*/
|
|
61514
|
+
, 4];
|
|
61515
|
+
_a.label = 1;
|
|
61516
|
+
|
|
61517
|
+
case 1:
|
|
61518
|
+
_a.trys.push([1, 3,, 4]);
|
|
61519
|
+
|
|
61520
|
+
return [4
|
|
61521
|
+
/*yield*/
|
|
61522
|
+
, this.cleanUpInvalidSession(user)];
|
|
61523
|
+
|
|
61524
|
+
case 2:
|
|
61525
|
+
_a.sent();
|
|
61526
|
+
|
|
61527
|
+
return [3
|
|
61528
|
+
/*break*/
|
|
61529
|
+
, 4];
|
|
61530
|
+
|
|
61531
|
+
case 3:
|
|
61532
|
+
cleanUpError_3 = _a.sent();
|
|
61533
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_3.message));
|
|
61534
|
+
return [2
|
|
61535
|
+
/*return*/
|
|
61536
|
+
];
|
|
61537
|
+
|
|
61538
|
+
case 4:
|
|
61539
|
+
return [2
|
|
61540
|
+
/*return*/
|
|
61541
|
+
, rej(err)];
|
|
61542
|
+
|
|
61543
|
+
case 5:
|
|
61544
|
+
return [2
|
|
61545
|
+
/*return*/
|
|
61546
|
+
, res(result)];
|
|
61547
|
+
}
|
|
61548
|
+
});
|
|
61549
|
+
});
|
|
61578
61550
|
}, {
|
|
61579
61551
|
bypassCache: true,
|
|
61580
61552
|
clientMetadata: clientMetadata
|
|
@@ -61911,7 +61883,7 @@ function () {
|
|
|
61911
61883
|
* Delete the current authenticated user
|
|
61912
61884
|
* @return {Promise}
|
|
61913
61885
|
**/
|
|
61914
|
-
//TODO: Check return type void
|
|
61886
|
+
// TODO: Check return type void
|
|
61915
61887
|
|
|
61916
61888
|
|
|
61917
61889
|
AuthClass.prototype.deleteUser = function () {
|
|
@@ -61963,44 +61935,80 @@ function () {
|
|
|
61963
61935
|
} else {
|
|
61964
61936
|
user_1.getSession(function (err, session) {
|
|
61965
61937
|
return __awaiter(_this, void 0, void 0, function () {
|
|
61938
|
+
var cleanUpError_4;
|
|
61939
|
+
|
|
61966
61940
|
var _this = this;
|
|
61967
61941
|
|
|
61968
61942
|
return __generator(this, function (_a) {
|
|
61969
|
-
|
|
61970
|
-
|
|
61971
|
-
|
|
61972
|
-
|
|
61973
|
-
|
|
61974
|
-
|
|
61975
|
-
|
|
61976
|
-
|
|
61977
|
-
|
|
61978
|
-
|
|
61979
|
-
dispatchAuthEvent('userDeleted', result, 'The authenticated user has been deleted.');
|
|
61980
|
-
user_1.signOut();
|
|
61981
|
-
_this.user = null;
|
|
61982
|
-
|
|
61983
|
-
try {
|
|
61984
|
-
_this.cleanCachedItems(); // clean aws credentials
|
|
61985
|
-
|
|
61986
|
-
} catch (e) {
|
|
61987
|
-
// TODO: change to rejects in refactor
|
|
61988
|
-
logger.debug('failed to clear cached items');
|
|
61989
|
-
}
|
|
61943
|
+
switch (_a.label) {
|
|
61944
|
+
case 0:
|
|
61945
|
+
if (!err) return [3
|
|
61946
|
+
/*break*/
|
|
61947
|
+
, 5];
|
|
61948
|
+
logger.debug('Failed to get the user session', err);
|
|
61949
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
61950
|
+
/*break*/
|
|
61951
|
+
, 4];
|
|
61952
|
+
_a.label = 1;
|
|
61990
61953
|
|
|
61991
|
-
|
|
61992
|
-
|
|
61954
|
+
case 1:
|
|
61955
|
+
_a.trys.push([1, 3,, 4]);
|
|
61956
|
+
|
|
61957
|
+
return [4
|
|
61958
|
+
/*yield*/
|
|
61959
|
+
, this.cleanUpInvalidSession(user_1)];
|
|
61960
|
+
|
|
61961
|
+
case 2:
|
|
61962
|
+
_a.sent();
|
|
61963
|
+
|
|
61964
|
+
return [3
|
|
61965
|
+
/*break*/
|
|
61966
|
+
, 4];
|
|
61967
|
+
|
|
61968
|
+
case 3:
|
|
61969
|
+
cleanUpError_4 = _a.sent();
|
|
61970
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_4.message));
|
|
61971
|
+
return [2
|
|
61972
|
+
/*return*/
|
|
61973
|
+
];
|
|
61974
|
+
|
|
61975
|
+
case 4:
|
|
61976
|
+
return [2
|
|
61977
|
+
/*return*/
|
|
61978
|
+
, rej(err)];
|
|
61979
|
+
|
|
61980
|
+
case 5:
|
|
61981
|
+
user_1.deleteUser(function (err, result) {
|
|
61982
|
+
if (err) {
|
|
61983
|
+
rej(err);
|
|
61993
61984
|
} else {
|
|
61994
|
-
dispatchAuthEvent('
|
|
61995
|
-
|
|
61985
|
+
dispatchAuthEvent('userDeleted', result, 'The authenticated user has been deleted.');
|
|
61986
|
+
user_1.signOut();
|
|
61987
|
+
_this.user = null;
|
|
61988
|
+
|
|
61989
|
+
try {
|
|
61990
|
+
_this.cleanCachedItems(); // clean aws credentials
|
|
61991
|
+
|
|
61992
|
+
} catch (e) {
|
|
61993
|
+
// TODO: change to rejects in refactor
|
|
61994
|
+
logger.debug('failed to clear cached items');
|
|
61995
|
+
}
|
|
61996
|
+
|
|
61997
|
+
if (isSignedInHostedUI) {
|
|
61998
|
+
_this.oAuthSignOutRedirect(res, rej);
|
|
61999
|
+
} else {
|
|
62000
|
+
dispatchAuthEvent('signOut', _this.user, "A user has been signed out");
|
|
62001
|
+
res(result);
|
|
62002
|
+
}
|
|
61996
62003
|
}
|
|
61997
|
-
}
|
|
61998
|
-
|
|
61999
|
-
}
|
|
62004
|
+
});
|
|
62005
|
+
_a.label = 6;
|
|
62000
62006
|
|
|
62001
|
-
|
|
62002
|
-
|
|
62003
|
-
|
|
62007
|
+
case 6:
|
|
62008
|
+
return [2
|
|
62009
|
+
/*return*/
|
|
62010
|
+
];
|
|
62011
|
+
}
|
|
62004
62012
|
});
|
|
62005
62013
|
});
|
|
62006
62014
|
});
|
|
@@ -62108,6 +62116,93 @@ function () {
|
|
|
62108
62116
|
};
|
|
62109
62117
|
});
|
|
62110
62118
|
};
|
|
62119
|
+
|
|
62120
|
+
AuthClass.prototype.isErrorWithMessage = function (err) {
|
|
62121
|
+
return _typeof(err) === 'object' && Object.prototype.hasOwnProperty.call(err, 'message');
|
|
62122
|
+
}; // Session revoked by another app
|
|
62123
|
+
|
|
62124
|
+
|
|
62125
|
+
AuthClass.prototype.isTokenRevokedError = function (err) {
|
|
62126
|
+
return this.isErrorWithMessage(err) && err.message === 'Access Token has been revoked';
|
|
62127
|
+
};
|
|
62128
|
+
|
|
62129
|
+
AuthClass.prototype.isRefreshTokenRevokedError = function (err) {
|
|
62130
|
+
return this.isErrorWithMessage(err) && err.message === 'Refresh Token has been revoked';
|
|
62131
|
+
};
|
|
62132
|
+
|
|
62133
|
+
AuthClass.prototype.isUserDisabledError = function (err) {
|
|
62134
|
+
return this.isErrorWithMessage(err) && err.message === 'User is disabled.';
|
|
62135
|
+
};
|
|
62136
|
+
|
|
62137
|
+
AuthClass.prototype.isUserDoesNotExistError = function (err) {
|
|
62138
|
+
return this.isErrorWithMessage(err) && err.message === 'User does not exist.';
|
|
62139
|
+
};
|
|
62140
|
+
|
|
62141
|
+
AuthClass.prototype.isRefreshTokenExpiredError = function (err) {
|
|
62142
|
+
return this.isErrorWithMessage(err) && err.message === 'Refresh Token has expired';
|
|
62143
|
+
};
|
|
62144
|
+
|
|
62145
|
+
AuthClass.prototype.isSignedInHostedUI = function () {
|
|
62146
|
+
return this._oAuthHandler && this._storage.getItem('amplify-signin-with-hostedUI') === 'true';
|
|
62147
|
+
};
|
|
62148
|
+
|
|
62149
|
+
AuthClass.prototype.isSessionInvalid = function (err) {
|
|
62150
|
+
return this.isUserDisabledError(err) || this.isUserDoesNotExistError(err) || this.isTokenRevokedError(err) || this.isRefreshTokenRevokedError(err) || this.isRefreshTokenExpiredError(err);
|
|
62151
|
+
};
|
|
62152
|
+
|
|
62153
|
+
AuthClass.prototype.cleanUpInvalidSession = function (user) {
|
|
62154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62155
|
+
var e_6;
|
|
62156
|
+
|
|
62157
|
+
var _this = this;
|
|
62158
|
+
|
|
62159
|
+
return __generator(this, function (_a) {
|
|
62160
|
+
switch (_a.label) {
|
|
62161
|
+
case 0:
|
|
62162
|
+
user.signOut();
|
|
62163
|
+
this.user = null;
|
|
62164
|
+
_a.label = 1;
|
|
62165
|
+
|
|
62166
|
+
case 1:
|
|
62167
|
+
_a.trys.push([1, 3,, 4]);
|
|
62168
|
+
|
|
62169
|
+
return [4
|
|
62170
|
+
/*yield*/
|
|
62171
|
+
, this.cleanCachedItems()];
|
|
62172
|
+
|
|
62173
|
+
case 2:
|
|
62174
|
+
_a.sent(); // clean aws credentials
|
|
62175
|
+
|
|
62176
|
+
|
|
62177
|
+
return [3
|
|
62178
|
+
/*break*/
|
|
62179
|
+
, 4];
|
|
62180
|
+
|
|
62181
|
+
case 3:
|
|
62182
|
+
e_6 = _a.sent();
|
|
62183
|
+
logger.debug('failed to clear cached items');
|
|
62184
|
+
return [3
|
|
62185
|
+
/*break*/
|
|
62186
|
+
, 4];
|
|
62187
|
+
|
|
62188
|
+
case 4:
|
|
62189
|
+
if (this.isSignedInHostedUI()) {
|
|
62190
|
+
return [2
|
|
62191
|
+
/*return*/
|
|
62192
|
+
, new Promise(function (res, rej) {
|
|
62193
|
+
_this.oAuthSignOutRedirect(res, rej);
|
|
62194
|
+
})];
|
|
62195
|
+
} else {
|
|
62196
|
+
dispatchAuthEvent('signOut', this.user, "A user has been signed out");
|
|
62197
|
+
}
|
|
62198
|
+
|
|
62199
|
+
return [2
|
|
62200
|
+
/*return*/
|
|
62201
|
+
];
|
|
62202
|
+
}
|
|
62203
|
+
});
|
|
62204
|
+
});
|
|
62205
|
+
};
|
|
62111
62206
|
/**
|
|
62112
62207
|
* Get current authenticated user
|
|
62113
62208
|
* @return - A promise resolves to current authenticated CognitoUser if success
|
|
@@ -62178,74 +62273,143 @@ function () {
|
|
|
62178
62273
|
|
|
62179
62274
|
user.getSession(function (err, session) {
|
|
62180
62275
|
return __awaiter(_this, void 0, void 0, function () {
|
|
62181
|
-
var bypassCache, clientMetadata, _a, scope;
|
|
62276
|
+
var cleanUpError_5, bypassCache, clientMetadata, _a, scope;
|
|
62182
62277
|
|
|
62183
62278
|
var _this = this;
|
|
62184
62279
|
|
|
62185
62280
|
return __generator(this, function (_b) {
|
|
62186
62281
|
switch (_b.label) {
|
|
62187
62282
|
case 0:
|
|
62188
|
-
if (err)
|
|
62189
|
-
|
|
62190
|
-
|
|
62191
|
-
|
|
62192
|
-
|
|
62193
|
-
|
|
62194
|
-
|
|
62283
|
+
if (!err) return [3
|
|
62284
|
+
/*break*/
|
|
62285
|
+
, 5];
|
|
62286
|
+
logger.debug('Failed to get the user session', err);
|
|
62287
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
62288
|
+
/*break*/
|
|
62289
|
+
, 4];
|
|
62290
|
+
_b.label = 1;
|
|
62291
|
+
|
|
62292
|
+
case 1:
|
|
62293
|
+
_b.trys.push([1, 3,, 4]);
|
|
62294
|
+
|
|
62295
|
+
return [4
|
|
62296
|
+
/*yield*/
|
|
62297
|
+
, this.cleanUpInvalidSession(user)];
|
|
62298
|
+
|
|
62299
|
+
case 2:
|
|
62300
|
+
_b.sent();
|
|
62301
|
+
|
|
62302
|
+
return [3
|
|
62303
|
+
/*break*/
|
|
62304
|
+
, 4];
|
|
62305
|
+
|
|
62306
|
+
case 3:
|
|
62307
|
+
cleanUpError_5 = _b.sent();
|
|
62308
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_5.message));
|
|
62309
|
+
return [2
|
|
62310
|
+
/*return*/
|
|
62311
|
+
];
|
|
62195
62312
|
|
|
62313
|
+
case 4:
|
|
62314
|
+
rej(err);
|
|
62315
|
+
return [2
|
|
62316
|
+
/*return*/
|
|
62317
|
+
];
|
|
62318
|
+
|
|
62319
|
+
case 5:
|
|
62196
62320
|
bypassCache = params ? params.bypassCache : false;
|
|
62197
62321
|
if (!bypassCache) return [3
|
|
62198
62322
|
/*break*/
|
|
62199
|
-
,
|
|
62323
|
+
, 7];
|
|
62200
62324
|
return [4
|
|
62201
62325
|
/*yield*/
|
|
62202
62326
|
, this.Credentials.clear()];
|
|
62203
62327
|
|
|
62204
|
-
case
|
|
62328
|
+
case 6:
|
|
62205
62329
|
_b.sent();
|
|
62206
62330
|
|
|
62207
|
-
_b.label =
|
|
62331
|
+
_b.label = 7;
|
|
62208
62332
|
|
|
62209
|
-
case
|
|
62333
|
+
case 7:
|
|
62210
62334
|
clientMetadata = this._config.clientMetadata;
|
|
62211
62335
|
_a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;
|
|
62212
62336
|
|
|
62213
62337
|
if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {
|
|
62214
62338
|
user.getUserData(function (err, data) {
|
|
62215
|
-
|
|
62216
|
-
|
|
62217
|
-
|
|
62218
|
-
|
|
62219
|
-
|
|
62220
|
-
|
|
62221
|
-
|
|
62222
|
-
|
|
62223
|
-
|
|
62224
|
-
|
|
62225
|
-
|
|
62339
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
62340
|
+
var cleanUpError_6, preferredMFA, attributeList, i, attribute, userAttribute, attributes;
|
|
62341
|
+
return __generator(this, function (_a) {
|
|
62342
|
+
switch (_a.label) {
|
|
62343
|
+
case 0:
|
|
62344
|
+
if (!err) return [3
|
|
62345
|
+
/*break*/
|
|
62346
|
+
, 7];
|
|
62347
|
+
logger.debug('getting user data failed', err);
|
|
62348
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
62349
|
+
/*break*/
|
|
62350
|
+
, 5];
|
|
62351
|
+
_a.label = 1;
|
|
62226
62352
|
|
|
62227
|
-
|
|
62228
|
-
|
|
62353
|
+
case 1:
|
|
62354
|
+
_a.trys.push([1, 3,, 4]);
|
|
62229
62355
|
|
|
62230
|
-
|
|
62231
|
-
|
|
62356
|
+
return [4
|
|
62357
|
+
/*yield*/
|
|
62358
|
+
, this.cleanUpInvalidSession(user)];
|
|
62232
62359
|
|
|
62233
|
-
|
|
62234
|
-
|
|
62235
|
-
|
|
62236
|
-
|
|
62237
|
-
|
|
62238
|
-
|
|
62239
|
-
|
|
62240
|
-
|
|
62360
|
+
case 2:
|
|
62361
|
+
_a.sent();
|
|
62362
|
+
|
|
62363
|
+
return [3
|
|
62364
|
+
/*break*/
|
|
62365
|
+
, 4];
|
|
62366
|
+
|
|
62367
|
+
case 3:
|
|
62368
|
+
cleanUpError_6 = _a.sent();
|
|
62369
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_6.message));
|
|
62370
|
+
return [2
|
|
62371
|
+
/*return*/
|
|
62372
|
+
];
|
|
62241
62373
|
|
|
62242
|
-
|
|
62374
|
+
case 4:
|
|
62375
|
+
rej(err);
|
|
62376
|
+
return [3
|
|
62377
|
+
/*break*/
|
|
62378
|
+
, 6];
|
|
62379
|
+
|
|
62380
|
+
case 5:
|
|
62381
|
+
res(user);
|
|
62382
|
+
_a.label = 6;
|
|
62243
62383
|
|
|
62244
|
-
|
|
62245
|
-
|
|
62246
|
-
|
|
62384
|
+
case 6:
|
|
62385
|
+
return [2
|
|
62386
|
+
/*return*/
|
|
62387
|
+
];
|
|
62388
|
+
|
|
62389
|
+
case 7:
|
|
62390
|
+
preferredMFA = data.PreferredMfaSetting || 'NOMFA';
|
|
62391
|
+
attributeList = [];
|
|
62392
|
+
|
|
62393
|
+
for (i = 0; i < data.UserAttributes.length; i++) {
|
|
62394
|
+
attribute = {
|
|
62395
|
+
Name: data.UserAttributes[i].Name,
|
|
62396
|
+
Value: data.UserAttributes[i].Value
|
|
62397
|
+
};
|
|
62398
|
+
userAttribute = new amazon_cognito_identity_js__WEBPACK_IMPORTED_MODULE_2__["CognitoUserAttribute"](attribute);
|
|
62399
|
+
attributeList.push(userAttribute);
|
|
62400
|
+
}
|
|
62401
|
+
|
|
62402
|
+
attributes = this.attributesToObject(attributeList);
|
|
62403
|
+
Object.assign(user, {
|
|
62404
|
+
attributes: attributes,
|
|
62405
|
+
preferredMFA: preferredMFA
|
|
62406
|
+
});
|
|
62407
|
+
return [2
|
|
62408
|
+
/*return*/
|
|
62409
|
+
, res(user)];
|
|
62410
|
+
}
|
|
62411
|
+
});
|
|
62247
62412
|
});
|
|
62248
|
-
return res(user);
|
|
62249
62413
|
}, {
|
|
62250
62414
|
bypassCache: bypassCache,
|
|
62251
62415
|
clientMetadata: clientMetadata
|
|
@@ -62291,7 +62455,7 @@ function () {
|
|
|
62291
62455
|
|
|
62292
62456
|
AuthClass.prototype.currentAuthenticatedUser = function (params) {
|
|
62293
62457
|
return __awaiter(this, void 0, void 0, function () {
|
|
62294
|
-
var federatedUser,
|
|
62458
|
+
var federatedUser, e_7, federatedInfo, user, e_8;
|
|
62295
62459
|
return __generator(this, function (_a) {
|
|
62296
62460
|
switch (_a.label) {
|
|
62297
62461
|
case 0:
|
|
@@ -62314,9 +62478,9 @@ function () {
|
|
|
62314
62478
|
, 4];
|
|
62315
62479
|
|
|
62316
62480
|
case 3:
|
|
62317
|
-
|
|
62318
|
-
logger.debug('Failed to sync cache info into memory',
|
|
62319
|
-
throw
|
|
62481
|
+
e_7 = _a.sent();
|
|
62482
|
+
logger.debug('Failed to sync cache info into memory', e_7);
|
|
62483
|
+
throw e_7;
|
|
62320
62484
|
|
|
62321
62485
|
case 4:
|
|
62322
62486
|
try {
|
|
@@ -62359,13 +62523,13 @@ function () {
|
|
|
62359
62523
|
, 9];
|
|
62360
62524
|
|
|
62361
62525
|
case 8:
|
|
62362
|
-
|
|
62526
|
+
e_8 = _a.sent();
|
|
62363
62527
|
|
|
62364
|
-
if (
|
|
62528
|
+
if (e_8 === 'No userPool') {
|
|
62365
62529
|
logger.error('Cannot get the current user because the user pool is missing. ' + 'Please make sure the Auth module is configured with a valid Cognito User Pool ID');
|
|
62366
62530
|
}
|
|
62367
62531
|
|
|
62368
|
-
logger.debug('The user is not authenticated by the error',
|
|
62532
|
+
logger.debug('The user is not authenticated by the error', e_8);
|
|
62369
62533
|
return [2
|
|
62370
62534
|
/*return*/
|
|
62371
62535
|
, Promise.reject('The user is not authenticated')];
|
|
@@ -62390,7 +62554,7 @@ function () {
|
|
|
62390
62554
|
logger.debug('Getting current session'); // Purposely not calling the reject method here because we don't need a console error
|
|
62391
62555
|
|
|
62392
62556
|
if (!this.userPool) {
|
|
62393
|
-
return
|
|
62557
|
+
return this.rejectNoUserPool();
|
|
62394
62558
|
}
|
|
62395
62559
|
|
|
62396
62560
|
return new Promise(function (res, rej) {
|
|
@@ -62418,6 +62582,8 @@ function () {
|
|
|
62418
62582
|
|
|
62419
62583
|
|
|
62420
62584
|
AuthClass.prototype.userSession = function (user) {
|
|
62585
|
+
var _this = this;
|
|
62586
|
+
|
|
62421
62587
|
if (!user) {
|
|
62422
62588
|
logger.debug('the user is null');
|
|
62423
62589
|
return this.rejectAuthError(_types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].NoUserSession);
|
|
@@ -62425,18 +62591,59 @@ function () {
|
|
|
62425
62591
|
|
|
62426
62592
|
var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
|
|
62427
62593
|
|
|
62428
|
-
return new Promise(function (
|
|
62594
|
+
return new Promise(function (res, rej) {
|
|
62429
62595
|
logger.debug('Getting the session from this user:', user);
|
|
62430
62596
|
user.getSession(function (err, session) {
|
|
62431
|
-
|
|
62432
|
-
|
|
62433
|
-
|
|
62434
|
-
|
|
62435
|
-
|
|
62436
|
-
|
|
62437
|
-
|
|
62438
|
-
|
|
62439
|
-
|
|
62597
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
62598
|
+
var cleanUpError_7;
|
|
62599
|
+
return __generator(this, function (_a) {
|
|
62600
|
+
switch (_a.label) {
|
|
62601
|
+
case 0:
|
|
62602
|
+
if (!err) return [3
|
|
62603
|
+
/*break*/
|
|
62604
|
+
, 5];
|
|
62605
|
+
logger.debug('Failed to get the session from user', user);
|
|
62606
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
62607
|
+
/*break*/
|
|
62608
|
+
, 4];
|
|
62609
|
+
_a.label = 1;
|
|
62610
|
+
|
|
62611
|
+
case 1:
|
|
62612
|
+
_a.trys.push([1, 3,, 4]);
|
|
62613
|
+
|
|
62614
|
+
return [4
|
|
62615
|
+
/*yield*/
|
|
62616
|
+
, this.cleanUpInvalidSession(user)];
|
|
62617
|
+
|
|
62618
|
+
case 2:
|
|
62619
|
+
_a.sent();
|
|
62620
|
+
|
|
62621
|
+
return [3
|
|
62622
|
+
/*break*/
|
|
62623
|
+
, 4];
|
|
62624
|
+
|
|
62625
|
+
case 3:
|
|
62626
|
+
cleanUpError_7 = _a.sent();
|
|
62627
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_7.message));
|
|
62628
|
+
return [2
|
|
62629
|
+
/*return*/
|
|
62630
|
+
];
|
|
62631
|
+
|
|
62632
|
+
case 4:
|
|
62633
|
+
rej(err);
|
|
62634
|
+
return [2
|
|
62635
|
+
/*return*/
|
|
62636
|
+
];
|
|
62637
|
+
|
|
62638
|
+
case 5:
|
|
62639
|
+
logger.debug('Succeed to get the user session', session);
|
|
62640
|
+
res(session);
|
|
62641
|
+
return [2
|
|
62642
|
+
/*return*/
|
|
62643
|
+
];
|
|
62644
|
+
}
|
|
62645
|
+
});
|
|
62646
|
+
});
|
|
62440
62647
|
}, {
|
|
62441
62648
|
clientMetadata: clientMetadata
|
|
62442
62649
|
});
|
|
@@ -62450,7 +62657,7 @@ function () {
|
|
|
62450
62657
|
|
|
62451
62658
|
AuthClass.prototype.currentUserCredentials = function () {
|
|
62452
62659
|
return __awaiter(this, void 0, void 0, function () {
|
|
62453
|
-
var
|
|
62660
|
+
var e_9, federatedInfo;
|
|
62454
62661
|
|
|
62455
62662
|
var _this = this;
|
|
62456
62663
|
|
|
@@ -62475,9 +62682,9 @@ function () {
|
|
|
62475
62682
|
, 4];
|
|
62476
62683
|
|
|
62477
62684
|
case 3:
|
|
62478
|
-
|
|
62479
|
-
logger.debug('Failed to sync cache info into memory',
|
|
62480
|
-
throw
|
|
62685
|
+
e_9 = _a.sent();
|
|
62686
|
+
logger.debug('Failed to sync cache info into memory', e_9);
|
|
62687
|
+
throw e_9;
|
|
62481
62688
|
|
|
62482
62689
|
case 4:
|
|
62483
62690
|
federatedInfo = null;
|
|
@@ -62499,8 +62706,8 @@ function () {
|
|
|
62499
62706
|
, this.currentSession().then(function (session) {
|
|
62500
62707
|
logger.debug('getting session success', session);
|
|
62501
62708
|
return _this.Credentials.set(session, 'session');
|
|
62502
|
-
})["catch"](function (
|
|
62503
|
-
logger.debug('getting
|
|
62709
|
+
})["catch"](function () {
|
|
62710
|
+
logger.debug('getting guest credentials');
|
|
62504
62711
|
return _this.Credentials.set(null, 'guest');
|
|
62505
62712
|
})];
|
|
62506
62713
|
}
|
|
@@ -62592,7 +62799,7 @@ function () {
|
|
|
62592
62799
|
|
|
62593
62800
|
AuthClass.prototype.cognitoIdentitySignOut = function (opts, user) {
|
|
62594
62801
|
return __awaiter(this, void 0, void 0, function () {
|
|
62595
|
-
var
|
|
62802
|
+
var e_10, isSignedInHostedUI;
|
|
62596
62803
|
|
|
62597
62804
|
var _this = this;
|
|
62598
62805
|
|
|
@@ -62613,9 +62820,9 @@ function () {
|
|
|
62613
62820
|
, 3];
|
|
62614
62821
|
|
|
62615
62822
|
case 2:
|
|
62616
|
-
|
|
62617
|
-
logger.debug('Failed to sync cache info into memory',
|
|
62618
|
-
throw
|
|
62823
|
+
e_10 = _a.sent();
|
|
62824
|
+
logger.debug('Failed to sync cache info into memory', e_10);
|
|
62825
|
+
throw e_10;
|
|
62619
62826
|
|
|
62620
62827
|
case 3:
|
|
62621
62828
|
isSignedInHostedUI = this._oAuthHandler && this._storage.getItem('amplify-signin-with-hostedUI') === 'true';
|
|
@@ -62629,25 +62836,70 @@ function () {
|
|
|
62629
62836
|
var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
|
|
62630
62837
|
|
|
62631
62838
|
user.getSession(function (err, result) {
|
|
62632
|
-
|
|
62633
|
-
|
|
62634
|
-
return rej(err);
|
|
62635
|
-
}
|
|
62839
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
62840
|
+
var cleanUpError_8;
|
|
62636
62841
|
|
|
62637
|
-
|
|
62638
|
-
onSuccess: function onSuccess(data) {
|
|
62639
|
-
logger.debug('global sign out success');
|
|
62842
|
+
var _this = this;
|
|
62640
62843
|
|
|
62641
|
-
|
|
62642
|
-
|
|
62643
|
-
|
|
62644
|
-
|
|
62844
|
+
return __generator(this, function (_a) {
|
|
62845
|
+
switch (_a.label) {
|
|
62846
|
+
case 0:
|
|
62847
|
+
if (!err) return [3
|
|
62848
|
+
/*break*/
|
|
62849
|
+
, 5];
|
|
62850
|
+
logger.debug('failed to get the user session', err);
|
|
62851
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
62852
|
+
/*break*/
|
|
62853
|
+
, 4];
|
|
62854
|
+
_a.label = 1;
|
|
62855
|
+
|
|
62856
|
+
case 1:
|
|
62857
|
+
_a.trys.push([1, 3,, 4]);
|
|
62858
|
+
|
|
62859
|
+
return [4
|
|
62860
|
+
/*yield*/
|
|
62861
|
+
, this.cleanUpInvalidSession(user)];
|
|
62862
|
+
|
|
62863
|
+
case 2:
|
|
62864
|
+
_a.sent();
|
|
62865
|
+
|
|
62866
|
+
return [3
|
|
62867
|
+
/*break*/
|
|
62868
|
+
, 4];
|
|
62869
|
+
|
|
62870
|
+
case 3:
|
|
62871
|
+
cleanUpError_8 = _a.sent();
|
|
62872
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_8.message));
|
|
62873
|
+
return [2
|
|
62874
|
+
/*return*/
|
|
62875
|
+
];
|
|
62876
|
+
|
|
62877
|
+
case 4:
|
|
62878
|
+
return [2
|
|
62879
|
+
/*return*/
|
|
62880
|
+
, rej(err)];
|
|
62881
|
+
|
|
62882
|
+
case 5:
|
|
62883
|
+
user.globalSignOut({
|
|
62884
|
+
onSuccess: function onSuccess(data) {
|
|
62885
|
+
logger.debug('global sign out success');
|
|
62886
|
+
|
|
62887
|
+
if (isSignedInHostedUI) {
|
|
62888
|
+
_this.oAuthSignOutRedirect(res, rej);
|
|
62889
|
+
} else {
|
|
62890
|
+
return res();
|
|
62891
|
+
}
|
|
62892
|
+
},
|
|
62893
|
+
onFailure: function onFailure(err) {
|
|
62894
|
+
logger.debug('global sign out failed', err);
|
|
62895
|
+
return rej(err);
|
|
62896
|
+
}
|
|
62897
|
+
});
|
|
62898
|
+
return [2
|
|
62899
|
+
/*return*/
|
|
62900
|
+
];
|
|
62645
62901
|
}
|
|
62646
|
-
}
|
|
62647
|
-
onFailure: function onFailure(err) {
|
|
62648
|
-
logger.debug('global sign out failed', err);
|
|
62649
|
-
return rej(err);
|
|
62650
|
-
}
|
|
62902
|
+
});
|
|
62651
62903
|
});
|
|
62652
62904
|
}, {
|
|
62653
62905
|
clientMetadata: clientMetadata
|
|
@@ -62690,7 +62942,7 @@ function () {
|
|
|
62690
62942
|
|
|
62691
62943
|
|
|
62692
62944
|
setTimeout(function () {
|
|
62693
|
-
return reject('Signout timeout fail');
|
|
62945
|
+
return reject(Error('Signout timeout fail'));
|
|
62694
62946
|
}, 3000);
|
|
62695
62947
|
};
|
|
62696
62948
|
/**
|
|
@@ -62702,7 +62954,7 @@ function () {
|
|
|
62702
62954
|
|
|
62703
62955
|
AuthClass.prototype.signOut = function (opts) {
|
|
62704
62956
|
return __awaiter(this, void 0, void 0, function () {
|
|
62705
|
-
var
|
|
62957
|
+
var e_11, user;
|
|
62706
62958
|
return __generator(this, function (_a) {
|
|
62707
62959
|
switch (_a.label) {
|
|
62708
62960
|
case 0:
|
|
@@ -62720,7 +62972,7 @@ function () {
|
|
|
62720
62972
|
, 3];
|
|
62721
62973
|
|
|
62722
62974
|
case 2:
|
|
62723
|
-
|
|
62975
|
+
e_11 = _a.sent();
|
|
62724
62976
|
logger.debug('failed to clear cached items');
|
|
62725
62977
|
return [3
|
|
62726
62978
|
/*break*/
|
|
@@ -62755,7 +63007,7 @@ function () {
|
|
|
62755
63007
|
, 8];
|
|
62756
63008
|
|
|
62757
63009
|
case 7:
|
|
62758
|
-
logger.debug('no
|
|
63010
|
+
logger.debug('no Cognito User pool');
|
|
62759
63011
|
_a.label = 8;
|
|
62760
63012
|
|
|
62761
63013
|
case 8:
|
|
@@ -62921,7 +63173,7 @@ function () {
|
|
|
62921
63173
|
|
|
62922
63174
|
AuthClass.prototype.currentUserInfo = function () {
|
|
62923
63175
|
return __awaiter(this, void 0, void 0, function () {
|
|
62924
|
-
var source, user, attributes, userAttrs, credentials,
|
|
63176
|
+
var source, user, attributes, userAttrs, credentials, e_12, info, err_1, user;
|
|
62925
63177
|
return __generator(this, function (_a) {
|
|
62926
63178
|
switch (_a.label) {
|
|
62927
63179
|
case 0:
|
|
@@ -62973,8 +63225,8 @@ function () {
|
|
|
62973
63225
|
, 7];
|
|
62974
63226
|
|
|
62975
63227
|
case 6:
|
|
62976
|
-
|
|
62977
|
-
logger.debug('Failed to retrieve credentials while getting current user info',
|
|
63228
|
+
e_12 = _a.sent();
|
|
63229
|
+
logger.debug('Failed to retrieve credentials while getting current user info', e_12);
|
|
62978
63230
|
return [3
|
|
62979
63231
|
/*break*/
|
|
62980
63232
|
, 7];
|