@aws-amplify/auth 4.3.11-in-app-messaging.53 → 4.3.11-in-app-messaging.61
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 +38 -0
- package/dist/aws-amplify-auth.js +138 -31
- package/dist/aws-amplify-auth.js.map +1 -1
- package/dist/aws-amplify-auth.min.js +1 -1
- package/dist/aws-amplify-auth.min.js.map +1 -1
- package/lib/Auth.d.ts +5 -0
- package/lib/Auth.js +106 -26
- package/lib/Auth.js.map +1 -1
- package/lib-esm/Auth.d.ts +5 -0
- package/lib-esm/Auth.js +106 -26
- package/lib-esm/Auth.js.map +1 -1
- package/package.json +5 -5
- package/src/Auth.ts +87 -28
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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.4.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.20...@aws-amplify/auth@4.4.0) (2022-01-27)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **@aws-amplify/auth:** Delete user API exposed ([#9428](https://github.com/aws-amplify/amplify-js/issues/9428)) ([bf3d189](https://github.com/aws-amplify/amplify-js/commit/bf3d189c9e7e14342230fca8a0cbba6972e7b42c))
|
|
11
|
+
|
|
12
|
+
## [4.3.20](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.19...@aws-amplify/auth@4.3.20) (2022-01-07)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
15
|
+
|
|
16
|
+
## [4.3.19](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.18...@aws-amplify/auth@4.3.19) (2021-12-16)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
19
|
+
|
|
20
|
+
## [4.3.18](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.17...@aws-amplify/auth@4.3.18) (2021-12-03)
|
|
21
|
+
|
|
22
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
23
|
+
|
|
24
|
+
## [4.3.17](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.16...@aws-amplify/auth@4.3.17) (2021-12-02)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
27
|
+
|
|
28
|
+
## [4.3.16](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.15...@aws-amplify/auth@4.3.16) (2021-11-18)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
31
|
+
|
|
32
|
+
## [4.3.18](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.17...@aws-amplify/auth@4.3.18) (2021-12-03)
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
35
|
+
|
|
36
|
+
## [4.3.17](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.16...@aws-amplify/auth@4.3.17) (2021-12-02)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
39
|
+
|
|
40
|
+
## [4.3.16](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.15...@aws-amplify/auth@4.3.16) (2021-11-18)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
43
|
+
|
|
6
44
|
## [4.3.15](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.14...@aws-amplify/auth@4.3.15) (2021-11-16)
|
|
7
45
|
|
|
8
46
|
**Note:** Version bump only for package @aws-amplify/auth
|
package/dist/aws-amplify-auth.js
CHANGED
|
@@ -10645,17 +10645,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10645
10645
|
function _typeof(obj) {
|
|
10646
10646
|
"@babel/helpers - typeof";
|
|
10647
10647
|
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
}
|
|
10653
|
-
_typeof = function _typeof(obj) {
|
|
10654
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
10655
|
-
};
|
|
10656
|
-
}
|
|
10657
|
-
|
|
10658
|
-
return _typeof(obj);
|
|
10648
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
10649
|
+
return typeof obj;
|
|
10650
|
+
} : function (obj) {
|
|
10651
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
10652
|
+
}, _typeof(obj);
|
|
10659
10653
|
}
|
|
10660
10654
|
/*
|
|
10661
10655
|
* Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -12051,6 +12045,119 @@ function () {
|
|
|
12051
12045
|
});
|
|
12052
12046
|
});
|
|
12053
12047
|
};
|
|
12048
|
+
/**
|
|
12049
|
+
* Delete the current authenticated user
|
|
12050
|
+
* @return {Promise}
|
|
12051
|
+
**/
|
|
12052
|
+
//TODO: Check return type void
|
|
12053
|
+
|
|
12054
|
+
|
|
12055
|
+
AuthClass.prototype.deleteUser = function () {
|
|
12056
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12057
|
+
var e_5, isSignedInHostedUI;
|
|
12058
|
+
|
|
12059
|
+
var _this = this;
|
|
12060
|
+
|
|
12061
|
+
return __generator(this, function (_a) {
|
|
12062
|
+
switch (_a.label) {
|
|
12063
|
+
case 0:
|
|
12064
|
+
_a.trys.push([0, 2,, 3]);
|
|
12065
|
+
|
|
12066
|
+
return [4
|
|
12067
|
+
/*yield*/
|
|
12068
|
+
, this._storageSync];
|
|
12069
|
+
|
|
12070
|
+
case 1:
|
|
12071
|
+
_a.sent();
|
|
12072
|
+
|
|
12073
|
+
return [3
|
|
12074
|
+
/*break*/
|
|
12075
|
+
, 3];
|
|
12076
|
+
|
|
12077
|
+
case 2:
|
|
12078
|
+
e_5 = _a.sent();
|
|
12079
|
+
logger.debug('Failed to sync cache info into memory', e_5);
|
|
12080
|
+
throw new Error(e_5);
|
|
12081
|
+
|
|
12082
|
+
case 3:
|
|
12083
|
+
isSignedInHostedUI = this._oAuthHandler && this._storage.getItem('amplify-signin-with-hostedUI') === 'true';
|
|
12084
|
+
return [2
|
|
12085
|
+
/*return*/
|
|
12086
|
+
, new Promise(function (res, rej) {
|
|
12087
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
12088
|
+
var user_1;
|
|
12089
|
+
|
|
12090
|
+
var _this = this;
|
|
12091
|
+
|
|
12092
|
+
return __generator(this, function (_a) {
|
|
12093
|
+
if (this.userPool) {
|
|
12094
|
+
user_1 = this.userPool.getCurrentUser();
|
|
12095
|
+
|
|
12096
|
+
if (!user_1) {
|
|
12097
|
+
logger.debug('Failed to get user from user pool');
|
|
12098
|
+
return [2
|
|
12099
|
+
/*return*/
|
|
12100
|
+
, rej(new Error('No current user.'))];
|
|
12101
|
+
} else {
|
|
12102
|
+
user_1.getSession(function (err, session) {
|
|
12103
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
12104
|
+
var _this = this;
|
|
12105
|
+
|
|
12106
|
+
return __generator(this, function (_a) {
|
|
12107
|
+
if (err) {
|
|
12108
|
+
logger.debug('Failed to get the user session', err);
|
|
12109
|
+
return [2
|
|
12110
|
+
/*return*/
|
|
12111
|
+
, rej(err)];
|
|
12112
|
+
} else {
|
|
12113
|
+
user_1.deleteUser(function (err, result) {
|
|
12114
|
+
if (err) {
|
|
12115
|
+
rej(err);
|
|
12116
|
+
} else {
|
|
12117
|
+
dispatchAuthEvent('userDeleted', result, 'The authenticated user has been deleted.');
|
|
12118
|
+
user_1.signOut();
|
|
12119
|
+
_this.user = null;
|
|
12120
|
+
|
|
12121
|
+
try {
|
|
12122
|
+
_this.cleanCachedItems(); // clean aws credentials
|
|
12123
|
+
|
|
12124
|
+
} catch (e) {
|
|
12125
|
+
// TODO: change to rejects in refactor
|
|
12126
|
+
logger.debug('failed to clear cached items');
|
|
12127
|
+
}
|
|
12128
|
+
|
|
12129
|
+
if (isSignedInHostedUI) {
|
|
12130
|
+
_this.oAuthSignOutRedirect(res, rej);
|
|
12131
|
+
} else {
|
|
12132
|
+
dispatchAuthEvent('signOut', _this.user, "A user has been signed out");
|
|
12133
|
+
res(result);
|
|
12134
|
+
}
|
|
12135
|
+
}
|
|
12136
|
+
});
|
|
12137
|
+
}
|
|
12138
|
+
|
|
12139
|
+
return [2
|
|
12140
|
+
/*return*/
|
|
12141
|
+
];
|
|
12142
|
+
});
|
|
12143
|
+
});
|
|
12144
|
+
});
|
|
12145
|
+
}
|
|
12146
|
+
} else {
|
|
12147
|
+
logger.debug('no Congito User pool');
|
|
12148
|
+
rej(new Error('Cognito User pool does not exist'));
|
|
12149
|
+
}
|
|
12150
|
+
|
|
12151
|
+
return [2
|
|
12152
|
+
/*return*/
|
|
12153
|
+
];
|
|
12154
|
+
});
|
|
12155
|
+
});
|
|
12156
|
+
})];
|
|
12157
|
+
}
|
|
12158
|
+
});
|
|
12159
|
+
});
|
|
12160
|
+
};
|
|
12054
12161
|
/**
|
|
12055
12162
|
* Update an authenticated users' attributes
|
|
12056
12163
|
* @param {CognitoUser} - The currently logged in user object
|
|
@@ -12322,7 +12429,7 @@ function () {
|
|
|
12322
12429
|
|
|
12323
12430
|
AuthClass.prototype.currentAuthenticatedUser = function (params) {
|
|
12324
12431
|
return __awaiter(this, void 0, void 0, function () {
|
|
12325
|
-
var federatedUser,
|
|
12432
|
+
var federatedUser, e_6, federatedInfo, user, e_7;
|
|
12326
12433
|
return __generator(this, function (_a) {
|
|
12327
12434
|
switch (_a.label) {
|
|
12328
12435
|
case 0:
|
|
@@ -12345,9 +12452,9 @@ function () {
|
|
|
12345
12452
|
, 4];
|
|
12346
12453
|
|
|
12347
12454
|
case 3:
|
|
12348
|
-
|
|
12349
|
-
logger.debug('Failed to sync cache info into memory',
|
|
12350
|
-
throw
|
|
12455
|
+
e_6 = _a.sent();
|
|
12456
|
+
logger.debug('Failed to sync cache info into memory', e_6);
|
|
12457
|
+
throw e_6;
|
|
12351
12458
|
|
|
12352
12459
|
case 4:
|
|
12353
12460
|
try {
|
|
@@ -12390,13 +12497,13 @@ function () {
|
|
|
12390
12497
|
, 9];
|
|
12391
12498
|
|
|
12392
12499
|
case 8:
|
|
12393
|
-
|
|
12500
|
+
e_7 = _a.sent();
|
|
12394
12501
|
|
|
12395
|
-
if (
|
|
12502
|
+
if (e_7 === 'No userPool') {
|
|
12396
12503
|
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');
|
|
12397
12504
|
}
|
|
12398
12505
|
|
|
12399
|
-
logger.debug('The user is not authenticated by the error',
|
|
12506
|
+
logger.debug('The user is not authenticated by the error', e_7);
|
|
12400
12507
|
return [2
|
|
12401
12508
|
/*return*/
|
|
12402
12509
|
, Promise.reject('The user is not authenticated')];
|
|
@@ -12481,7 +12588,7 @@ function () {
|
|
|
12481
12588
|
|
|
12482
12589
|
AuthClass.prototype.currentUserCredentials = function () {
|
|
12483
12590
|
return __awaiter(this, void 0, void 0, function () {
|
|
12484
|
-
var
|
|
12591
|
+
var e_8, federatedInfo;
|
|
12485
12592
|
|
|
12486
12593
|
var _this = this;
|
|
12487
12594
|
|
|
@@ -12506,9 +12613,9 @@ function () {
|
|
|
12506
12613
|
, 4];
|
|
12507
12614
|
|
|
12508
12615
|
case 3:
|
|
12509
|
-
|
|
12510
|
-
logger.debug('Failed to sync cache info into memory',
|
|
12511
|
-
throw
|
|
12616
|
+
e_8 = _a.sent();
|
|
12617
|
+
logger.debug('Failed to sync cache info into memory', e_8);
|
|
12618
|
+
throw e_8;
|
|
12512
12619
|
|
|
12513
12620
|
case 4:
|
|
12514
12621
|
federatedInfo = null;
|
|
@@ -12623,7 +12730,7 @@ function () {
|
|
|
12623
12730
|
|
|
12624
12731
|
AuthClass.prototype.cognitoIdentitySignOut = function (opts, user) {
|
|
12625
12732
|
return __awaiter(this, void 0, void 0, function () {
|
|
12626
|
-
var
|
|
12733
|
+
var e_9, isSignedInHostedUI;
|
|
12627
12734
|
|
|
12628
12735
|
var _this = this;
|
|
12629
12736
|
|
|
@@ -12644,9 +12751,9 @@ function () {
|
|
|
12644
12751
|
, 3];
|
|
12645
12752
|
|
|
12646
12753
|
case 2:
|
|
12647
|
-
|
|
12648
|
-
logger.debug('Failed to sync cache info into memory',
|
|
12649
|
-
throw
|
|
12754
|
+
e_9 = _a.sent();
|
|
12755
|
+
logger.debug('Failed to sync cache info into memory', e_9);
|
|
12756
|
+
throw e_9;
|
|
12650
12757
|
|
|
12651
12758
|
case 3:
|
|
12652
12759
|
isSignedInHostedUI = this._oAuthHandler && this._storage.getItem('amplify-signin-with-hostedUI') === 'true';
|
|
@@ -12733,7 +12840,7 @@ function () {
|
|
|
12733
12840
|
|
|
12734
12841
|
AuthClass.prototype.signOut = function (opts) {
|
|
12735
12842
|
return __awaiter(this, void 0, void 0, function () {
|
|
12736
|
-
var
|
|
12843
|
+
var e_10, user;
|
|
12737
12844
|
return __generator(this, function (_a) {
|
|
12738
12845
|
switch (_a.label) {
|
|
12739
12846
|
case 0:
|
|
@@ -12751,7 +12858,7 @@ function () {
|
|
|
12751
12858
|
, 3];
|
|
12752
12859
|
|
|
12753
12860
|
case 2:
|
|
12754
|
-
|
|
12861
|
+
e_10 = _a.sent();
|
|
12755
12862
|
logger.debug('failed to clear cached items');
|
|
12756
12863
|
return [3
|
|
12757
12864
|
/*break*/
|
|
@@ -12952,7 +13059,7 @@ function () {
|
|
|
12952
13059
|
|
|
12953
13060
|
AuthClass.prototype.currentUserInfo = function () {
|
|
12954
13061
|
return __awaiter(this, void 0, void 0, function () {
|
|
12955
|
-
var source, user, attributes, userAttrs, credentials,
|
|
13062
|
+
var source, user, attributes, userAttrs, credentials, e_11, info, err_1, user;
|
|
12956
13063
|
return __generator(this, function (_a) {
|
|
12957
13064
|
switch (_a.label) {
|
|
12958
13065
|
case 0:
|
|
@@ -13004,8 +13111,8 @@ function () {
|
|
|
13004
13111
|
, 7];
|
|
13005
13112
|
|
|
13006
13113
|
case 6:
|
|
13007
|
-
|
|
13008
|
-
logger.debug('Failed to retrieve credentials while getting current user info',
|
|
13114
|
+
e_11 = _a.sent();
|
|
13115
|
+
logger.debug('Failed to retrieve credentials while getting current user info', e_11);
|
|
13009
13116
|
return [3
|
|
13010
13117
|
/*break*/
|
|
13011
13118
|
, 7];
|