@iyio/aws-credential-providers 0.5.14 → 0.5.16
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { AwsAuthProviders } from "@iyio/aws";
|
|
3
3
|
import { AuthProviders, authService, createScope, MemoryStore, shortUuid, storeRoot, uuid } from "@iyio/common";
|
|
4
|
-
import { fail } from "assert";
|
|
5
4
|
import { CognitoAuthProvider } from "./CognitoAuthProvider";
|
|
6
5
|
export const useTempCognitoUser = (module, work) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
6
|
let provider = undefined;
|
|
@@ -19,8 +18,7 @@ export const useTempCognitoUser = (module, work) => __awaiter(void 0, void 0, vo
|
|
|
19
18
|
const result = yield authService(scope).registerEmailPasswordAsync(email, password);
|
|
20
19
|
if (result.status !== 'success') {
|
|
21
20
|
console.log(result);
|
|
22
|
-
|
|
23
|
-
return;
|
|
21
|
+
throw new Error('Result not success');
|
|
24
22
|
}
|
|
25
23
|
try {
|
|
26
24
|
yield work(scope, result.user, provider.config);
|
|
@@ -28,7 +26,8 @@ export const useTempCognitoUser = (module, work) => __awaiter(void 0, void 0, vo
|
|
|
28
26
|
finally {
|
|
29
27
|
const deleteResult = yield authService(scope).deleteAsync(result.user);
|
|
30
28
|
if (deleteResult.status === 'error') {
|
|
31
|
-
|
|
29
|
+
// eslint-disable-next-line no-unsafe-finally
|
|
30
|
+
throw new Error('Failed to delete user');
|
|
32
31
|
}
|
|
33
32
|
else if (deleteResult.status === 'pending') {
|
|
34
33
|
console.warn('Delete user pending');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cognito-test-helper.js","sourceRoot":"","sources":["../../../../../../packages/aws-credential-providers/src/lib/cognito-test-helper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAY,WAAW,EAAE,WAAW,EAAsB,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC9I,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cognito-test-helper.js","sourceRoot":"","sources":["../../../../../../packages/aws-credential-providers/src/lib/cognito-test-helper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAY,WAAW,EAAE,WAAW,EAAsB,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC9I,OAAO,EAAE,mBAAmB,EAA6B,MAAM,uBAAuB,CAAC;AAEvF,MAAM,CAAC,MAAM,kBAAkB,GAAC,CAAO,MAAkB,EAAC,IAAgF,EAAC,EAAE;IAEzI,IAAI,QAAQ,GAA+B,SAAS,CAAC;IAErD,MAAM,KAAK,GAAC,WAAW,CAAC,GAAG,CAAA,EAAE;QACzB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChB,QAAQ,GAAC,GAAG;aACP,WAAW,CAAC,aAAa,EAAC,KAAK,CAAA,EAAE,CAAA,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;aACtE,GAAG,CAAC,gBAAgB,CAAC;aACrB,QAAQ,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAC,IAAI,WAAW,EAAE,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAC,aAAa,IAAI,EAAE,UAAU,CAAC;IAC1C,MAAM,QAAQ,GAAC,OAAO,GAAC,SAAS,EAAE,CAAC;IAEnC,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,KAAK,QAAQ,EAAE,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAC,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC,0BAA0B,CAAC,KAAK,EAAC,QAAQ,CAAC,CAAC;IAEjF,IAAG,MAAM,CAAC,MAAM,KAAG,SAAS,EAAC;QACzB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACzC;IAED,IAAG;QAEC,MAAM,IAAI,CAAC,KAAK,EAAC,MAAM,CAAC,IAAI,EAAE,QAA2C,CAAC,MAAM,CAAC,CAAC;KAErF;YAAO;QAEJ,MAAM,YAAY,GAAC,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrE,IAAG,YAAY,CAAC,MAAM,KAAG,OAAO,EAAC;YAC7B,6CAA6C;YAC7C,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;SAC5C;aAAK,IAAG,YAAY,CAAC,MAAM,KAAG,SAAS,EAAC;YACrC,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACvC;aAAI;YACD,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,UAAU,CAAC,CAAA;SAClC;KACJ;AACL,CAAC,CAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyio/aws-credential-providers",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.16",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-crypto/sha256-browser": ">=3.0.0",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"zod": ">=3.22.4"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@iyio/aws": "^0.5.
|
|
20
|
-
"@iyio/common": "^0.5.
|
|
19
|
+
"@iyio/aws": "^0.5.16",
|
|
20
|
+
"@iyio/common": "^0.5.16"
|
|
21
21
|
},
|
|
22
22
|
"main": "./src/index.js",
|
|
23
23
|
"types": "./src/index.d.ts",
|
|
@@ -4,7 +4,6 @@ exports.useTempCognitoUser = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const aws_1 = require("@iyio/aws");
|
|
6
6
|
const common_1 = require("@iyio/common");
|
|
7
|
-
const assert_1 = require("assert");
|
|
8
7
|
const CognitoAuthProvider_1 = require("./CognitoAuthProvider");
|
|
9
8
|
const useTempCognitoUser = (module, work) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
9
|
let provider = undefined;
|
|
@@ -22,8 +21,7 @@ const useTempCognitoUser = (module, work) => tslib_1.__awaiter(void 0, void 0, v
|
|
|
22
21
|
const result = yield (0, common_1.authService)(scope).registerEmailPasswordAsync(email, password);
|
|
23
22
|
if (result.status !== 'success') {
|
|
24
23
|
console.log(result);
|
|
25
|
-
|
|
26
|
-
return;
|
|
24
|
+
throw new Error('Result not success');
|
|
27
25
|
}
|
|
28
26
|
try {
|
|
29
27
|
yield work(scope, result.user, provider.config);
|
|
@@ -31,7 +29,8 @@ const useTempCognitoUser = (module, work) => tslib_1.__awaiter(void 0, void 0, v
|
|
|
31
29
|
finally {
|
|
32
30
|
const deleteResult = yield (0, common_1.authService)(scope).deleteAsync(result.user);
|
|
33
31
|
if (deleteResult.status === 'error') {
|
|
34
|
-
|
|
32
|
+
// eslint-disable-next-line no-unsafe-finally
|
|
33
|
+
throw new Error('Failed to delete user');
|
|
35
34
|
}
|
|
36
35
|
else if (deleteResult.status === 'pending') {
|
|
37
36
|
console.warn('Delete user pending');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cognito-test-helper.js","sourceRoot":"","sources":["../../../../../packages/aws-credential-providers/src/lib/cognito-test-helper.ts"],"names":[],"mappings":";;;;AAAA,mCAA6C;AAC7C,yCAA8I;AAC9I
|
|
1
|
+
{"version":3,"file":"cognito-test-helper.js","sourceRoot":"","sources":["../../../../../packages/aws-credential-providers/src/lib/cognito-test-helper.ts"],"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