quidproquo-actionprocessor-awslambda 0.0.259 → 0.0.261
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/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryAuthenticateUserActionProcessor.js +3 -1
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryConfirmForgotPasswordActionProcessor.js +3 -1
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryForgotPasswordActionProcessor.js +3 -1
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryGetUserAttributesActionProcessor.js +3 -1
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectorySetPasswordActionProcessor.js +3 -1
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectorySetUserAttributesActionProcessor.js +3 -1
- package/lib/commonjs/logic/cognito/resolveUsernameByPreferredUsername.d.ts +1 -0
- package/lib/commonjs/logic/cognito/resolveUsernameByPreferredUsername.js +28 -0
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryAuthenticateUserActionProcessor.js +3 -1
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryConfirmForgotPasswordActionProcessor.js +3 -1
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryForgotPasswordActionProcessor.js +3 -1
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryGetUserAttributesActionProcessor.js +3 -1
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectorySetPasswordActionProcessor.js +3 -1
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectorySetUserAttributesActionProcessor.js +3 -1
- package/lib/esm/logic/cognito/resolveUsernameByPreferredUsername.d.ts +1 -0
- package/lib/esm/logic/cognito/resolveUsernameByPreferredUsername.js +14 -0
- package/package.json +5 -5
|
@@ -15,13 +15,15 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
15
15
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
16
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
17
17
|
const authenticateUser_1 = require("../../../logic/cognito/authenticateUser");
|
|
18
|
+
const resolveUsernameByPreferredUsername_1 = require("../../../logic/cognito/resolveUsernameByPreferredUsername");
|
|
18
19
|
const getProcessAuthenticateUser = (qpqConfig) => {
|
|
19
20
|
return (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
21
|
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
21
22
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(payload.userDirectoryName, qpqConfig), region);
|
|
22
23
|
const userPoolClientId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolClientIdFromConfig)(payload.userDirectoryName, qpqConfig), region);
|
|
23
24
|
try {
|
|
24
|
-
const
|
|
25
|
+
const resolvedUsername = yield (0, resolveUsernameByPreferredUsername_1.resolveUsernameByPreferredUsername)(userPoolId, region, payload.authenticateUserRequest.email);
|
|
26
|
+
const authResponse = yield (0, authenticateUser_1.authenticateUser)(userPoolId, userPoolClientId, region, payload.authenticateUserRequest.isCustom, resolvedUsername, payload.authenticateUserRequest.password);
|
|
25
27
|
return (0, quidproquo_core_1.actionResult)(authResponse);
|
|
26
28
|
}
|
|
27
29
|
catch (error) {
|
|
@@ -15,12 +15,14 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
15
15
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
16
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
17
17
|
const confirmForgotPassword_1 = require("../../../logic/cognito/confirmForgotPassword");
|
|
18
|
+
const resolveUsernameByPreferredUsername_1 = require("../../../logic/cognito/resolveUsernameByPreferredUsername");
|
|
18
19
|
const getProcessConfirmForgotPassword = (qpqConfig) => {
|
|
19
20
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ userDirectoryName, code, username, password }) {
|
|
20
21
|
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
21
22
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
22
23
|
const userPoolClientId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolClientIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
23
|
-
const
|
|
24
|
+
const resolvedUsername = yield (0, resolveUsernameByPreferredUsername_1.resolveUsernameByPreferredUsername)(userPoolId, region, username);
|
|
25
|
+
const authResponse = yield (0, confirmForgotPassword_1.confirmForgotPassword)(userPoolId, userPoolClientId, region, code, resolvedUsername, password);
|
|
24
26
|
return (0, quidproquo_core_1.actionResult)(authResponse);
|
|
25
27
|
});
|
|
26
28
|
};
|
|
@@ -15,12 +15,14 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
15
15
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
16
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
17
17
|
const forgotPassword_1 = require("../../../logic/cognito/forgotPassword");
|
|
18
|
+
const resolveUsernameByPreferredUsername_1 = require("../../../logic/cognito/resolveUsernameByPreferredUsername");
|
|
18
19
|
const getProcessForgotPassword = (qpqConfig) => {
|
|
19
20
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ username, userDirectoryName }) {
|
|
20
21
|
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
21
22
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
22
23
|
const userPoolClientId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolClientIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
23
|
-
const
|
|
24
|
+
const resolvedUsername = yield (0, resolveUsernameByPreferredUsername_1.resolveUsernameByPreferredUsername)(userPoolId, region, username);
|
|
25
|
+
const authResponse = yield (0, forgotPassword_1.forgotPassword)(userPoolId, userPoolClientId, region, resolvedUsername);
|
|
24
26
|
return (0, quidproquo_core_1.actionResult)(authResponse);
|
|
25
27
|
});
|
|
26
28
|
};
|
|
@@ -15,12 +15,14 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
15
15
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
16
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
17
17
|
const getUserAttributes_1 = require("../../../logic/cognito/getUserAttributes");
|
|
18
|
+
const resolveUsernameByPreferredUsername_1 = require("../../../logic/cognito/resolveUsernameByPreferredUsername");
|
|
18
19
|
const getProcessGetUserAttributes = (qpqConfig) => {
|
|
19
20
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ userDirectoryName, username }) {
|
|
20
21
|
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
21
22
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
22
23
|
try {
|
|
23
|
-
const
|
|
24
|
+
const resolvedUsername = yield (0, resolveUsernameByPreferredUsername_1.resolveUsernameByPreferredUsername)(userPoolId, region, username);
|
|
25
|
+
const userAttributes = yield (0, getUserAttributes_1.getUserAttributes)(userPoolId, region, resolvedUsername);
|
|
24
26
|
return (0, quidproquo_core_1.actionResult)(userAttributes);
|
|
25
27
|
}
|
|
26
28
|
catch (error) {
|
|
@@ -14,12 +14,14 @@ const quidproquo_config_aws_1 = require("quidproquo-config-aws");
|
|
|
14
14
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
15
15
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
16
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
17
|
+
const resolveUsernameByPreferredUsername_1 = require("../../../logic/cognito/resolveUsernameByPreferredUsername");
|
|
17
18
|
const setUserPassword_1 = require("../../../logic/cognito/setUserPassword");
|
|
18
19
|
const getProcessSetPassword = (qpqConfig) => {
|
|
19
20
|
return (_a, session_1) => __awaiter(void 0, [_a, session_1], void 0, function* ({ userDirectoryName, newPassword, username }, session) {
|
|
20
21
|
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
21
22
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
22
|
-
yield (0,
|
|
23
|
+
const resolvedUsername = yield (0, resolveUsernameByPreferredUsername_1.resolveUsernameByPreferredUsername)(userPoolId, region, username);
|
|
24
|
+
yield (0, setUserPassword_1.setUserPassword)(region, userPoolId, resolvedUsername, newPassword);
|
|
23
25
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
24
26
|
});
|
|
25
27
|
};
|
|
@@ -14,12 +14,14 @@ const quidproquo_config_aws_1 = require("quidproquo-config-aws");
|
|
|
14
14
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
15
15
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
16
16
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
17
|
+
const resolveUsernameByPreferredUsername_1 = require("../../../logic/cognito/resolveUsernameByPreferredUsername");
|
|
17
18
|
const setUserAttributes_1 = require("../../../logic/cognito/setUserAttributes");
|
|
18
19
|
const getProcessSetUserAttributes = (qpqConfig) => {
|
|
19
20
|
return (_a, session_1) => __awaiter(void 0, [_a, session_1], void 0, function* ({ userDirectoryName, username, userAttributes }, session) {
|
|
20
21
|
const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
21
22
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
22
|
-
yield (0,
|
|
23
|
+
const resolvedUsername = yield (0, resolveUsernameByPreferredUsername_1.resolveUsernameByPreferredUsername)(userPoolId, region, username);
|
|
24
|
+
yield (0, setUserAttributes_1.setUserAttributes)(userPoolId, region, resolvedUsername, userAttributes);
|
|
23
25
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
24
26
|
});
|
|
25
27
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveUsernameByPreferredUsername: (userPoolId: string, region: string, preferredUsername: string) => Promise<string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.resolveUsernameByPreferredUsername = void 0;
|
|
13
|
+
const client_cognito_identity_provider_1 = require("@aws-sdk/client-cognito-identity-provider");
|
|
14
|
+
const createAwsClient_1 = require("../createAwsClient");
|
|
15
|
+
const resolveUsernameByPreferredUsername = (userPoolId, region, preferredUsername) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const cognitoClient = (0, createAwsClient_1.createAwsClient)(client_cognito_identity_provider_1.CognitoIdentityProviderClient, {
|
|
18
|
+
region,
|
|
19
|
+
});
|
|
20
|
+
const response = yield cognitoClient.send(new client_cognito_identity_provider_1.ListUsersCommand({
|
|
21
|
+
UserPoolId: userPoolId,
|
|
22
|
+
Limit: 1,
|
|
23
|
+
Filter: `preferred_username = "${preferredUsername}"`,
|
|
24
|
+
}));
|
|
25
|
+
const resolvedUsername = (_b = (_a = response.Users) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Username;
|
|
26
|
+
return resolvedUsername || preferredUsername;
|
|
27
|
+
});
|
|
28
|
+
exports.resolveUsernameByPreferredUsername = resolveUsernameByPreferredUsername;
|
|
@@ -3,13 +3,15 @@ import { actionResult, actionResultError, actionResultErrorFromCaughtError, User
|
|
|
3
3
|
import { getCFExportNameUserPoolClientIdFromConfig, getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { authenticateUser } from '../../../logic/cognito/authenticateUser';
|
|
6
|
+
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
6
7
|
const getProcessAuthenticateUser = (qpqConfig) => {
|
|
7
8
|
return async (payload) => {
|
|
8
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(payload.userDirectoryName, qpqConfig), region);
|
|
10
11
|
const userPoolClientId = await getExportedValue(getCFExportNameUserPoolClientIdFromConfig(payload.userDirectoryName, qpqConfig), region);
|
|
11
12
|
try {
|
|
12
|
-
const
|
|
13
|
+
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, payload.authenticateUserRequest.email);
|
|
14
|
+
const authResponse = await authenticateUser(userPoolId, userPoolClientId, region, payload.authenticateUserRequest.isCustom, resolvedUsername, payload.authenticateUserRequest.password);
|
|
13
15
|
return actionResult(authResponse);
|
|
14
16
|
}
|
|
15
17
|
catch (error) {
|
|
@@ -3,12 +3,14 @@ import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
|
3
3
|
import { getCFExportNameUserPoolClientIdFromConfig, getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { confirmForgotPassword } from '../../../logic/cognito/confirmForgotPassword';
|
|
6
|
+
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
6
7
|
const getProcessConfirmForgotPassword = (qpqConfig) => {
|
|
7
8
|
return async ({ userDirectoryName, code, username, password }) => {
|
|
8
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
11
|
const userPoolClientId = await getExportedValue(getCFExportNameUserPoolClientIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
11
|
-
const
|
|
12
|
+
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
13
|
+
const authResponse = await confirmForgotPassword(userPoolId, userPoolClientId, region, code, resolvedUsername, password);
|
|
12
14
|
return actionResult(authResponse);
|
|
13
15
|
};
|
|
14
16
|
};
|
|
@@ -3,12 +3,14 @@ import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
|
3
3
|
import { getCFExportNameUserPoolClientIdFromConfig, getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { forgotPassword } from '../../../logic/cognito/forgotPassword';
|
|
6
|
+
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
6
7
|
const getProcessForgotPassword = (qpqConfig) => {
|
|
7
8
|
return async ({ username, userDirectoryName }) => {
|
|
8
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
11
|
const userPoolClientId = await getExportedValue(getCFExportNameUserPoolClientIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
11
|
-
const
|
|
12
|
+
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
13
|
+
const authResponse = await forgotPassword(userPoolId, userPoolClientId, region, resolvedUsername);
|
|
12
14
|
return actionResult(authResponse);
|
|
13
15
|
};
|
|
14
16
|
};
|
|
@@ -3,12 +3,14 @@ import { actionResult, actionResultError, actionResultErrorFromCaughtError, User
|
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { getUserAttributes } from '../../../logic/cognito/getUserAttributes';
|
|
6
|
+
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
6
7
|
const getProcessGetUserAttributes = (qpqConfig) => {
|
|
7
8
|
return async ({ userDirectoryName, username }) => {
|
|
8
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
11
|
try {
|
|
11
|
-
const
|
|
12
|
+
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
13
|
+
const userAttributes = await getUserAttributes(userPoolId, region, resolvedUsername);
|
|
12
14
|
return actionResult(userAttributes);
|
|
13
15
|
}
|
|
14
16
|
catch (error) {
|
package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectorySetPasswordActionProcessor.js
CHANGED
|
@@ -2,12 +2,14 @@ import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
|
2
2
|
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
|
+
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
5
6
|
import { setUserPassword } from '../../../logic/cognito/setUserPassword';
|
|
6
7
|
const getProcessSetPassword = (qpqConfig) => {
|
|
7
8
|
return async ({ userDirectoryName, newPassword, username }, session) => {
|
|
8
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
|
-
await
|
|
11
|
+
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
12
|
+
await setUserPassword(region, userPoolId, resolvedUsername, newPassword);
|
|
11
13
|
return actionResult(void 0);
|
|
12
14
|
};
|
|
13
15
|
};
|
|
@@ -2,12 +2,14 @@ import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
|
2
2
|
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
|
+
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
5
6
|
import { setUserAttributes } from '../../../logic/cognito/setUserAttributes';
|
|
6
7
|
const getProcessSetUserAttributes = (qpqConfig) => {
|
|
7
8
|
return async ({ userDirectoryName, username, userAttributes }, session) => {
|
|
8
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
|
-
await
|
|
11
|
+
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
12
|
+
await setUserAttributes(userPoolId, region, resolvedUsername, userAttributes);
|
|
11
13
|
return actionResult(void 0);
|
|
12
14
|
};
|
|
13
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveUsernameByPreferredUsername: (userPoolId: string, region: string, preferredUsername: string) => Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CognitoIdentityProviderClient, ListUsersCommand } from '@aws-sdk/client-cognito-identity-provider';
|
|
2
|
+
import { createAwsClient } from '../createAwsClient';
|
|
3
|
+
export const resolveUsernameByPreferredUsername = async (userPoolId, region, preferredUsername) => {
|
|
4
|
+
const cognitoClient = createAwsClient(CognitoIdentityProviderClient, {
|
|
5
|
+
region,
|
|
6
|
+
});
|
|
7
|
+
const response = await cognitoClient.send(new ListUsersCommand({
|
|
8
|
+
UserPoolId: userPoolId,
|
|
9
|
+
Limit: 1,
|
|
10
|
+
Filter: `preferred_username = "${preferredUsername}"`,
|
|
11
|
+
}));
|
|
12
|
+
const resolvedUsername = response.Users?.[0]?.Username;
|
|
13
|
+
return resolvedUsername || preferredUsername;
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-awslambda",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.261",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
"lodash": "^4.17.21",
|
|
58
58
|
"node-cache": "^5.1.2",
|
|
59
59
|
"node-match-path": "^0.6.3",
|
|
60
|
-
"quidproquo-config-aws": "0.0.
|
|
61
|
-
"quidproquo-core": "0.0.
|
|
62
|
-
"quidproquo-webserver": "0.0.
|
|
60
|
+
"quidproquo-config-aws": "0.0.261",
|
|
61
|
+
"quidproquo-core": "0.0.261",
|
|
62
|
+
"quidproquo-webserver": "0.0.261"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/busboy": "^1.5.0",
|
|
66
66
|
"@types/jsonwebtoken": "^9.0.2",
|
|
67
67
|
"@types/lodash": "^4.14.194",
|
|
68
68
|
"@types/node": "^22.13.13",
|
|
69
|
-
"quidproquo-tsconfig": "0.0.
|
|
69
|
+
"quidproquo-tsconfig": "0.0.261",
|
|
70
70
|
"typescript": "^5.8.2"
|
|
71
71
|
}
|
|
72
72
|
}
|