quidproquo-actionprocessor-awslambda 0.0.219 → 0.0.221
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/awsLambdaUtils.js +9 -8
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.js +0 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/matchStory.js +3 -6
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/matchStory.js +0 -1
- package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/getRecords.js +2 -2
- package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/matchStory.js +4 -5
- package/lib/commonjs/getActionProcessor/core/event/cognito/customMessage/autoRespond.js +3 -4
- package/lib/commonjs/getActionProcessor/core/event/cognito/customMessage/matchStory.js +3 -7
- package/lib/commonjs/getActionProcessor/core/event/cognito/defineAuthChallenge/getRecords.js +8 -2
- package/lib/commonjs/getActionProcessor/core/event/cognito/defineAuthChallenge/matchStory.js +3 -4
- package/lib/commonjs/getActionProcessor/core/event/cognito/utils/getChallengeSessionFromCognitoTriggerEventSession.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/event/cognito/utils/getChallengeSessionFromCognitoTriggerEventSession.js +14 -0
- package/lib/commonjs/getActionProcessor/core/event/cognito/utils/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/event/cognito/{verifyAuthChallenge/utils → utils}/index.js +1 -1
- package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/getRecords.js +1 -1
- package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/matchStory.js +4 -5
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.js +1 -2
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.js +0 -1
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/matchStory.js +0 -1
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/matchStory.js +3 -1
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/types.d.ts +2 -2
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/types.js +2 -1
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/autoRespond.js +2 -2
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/matchStory.js +4 -4
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js +1 -0
- package/lib/commonjs/getActionProcessor/core/system/getExecuteStoryActionProcessor.js +7 -9
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryRespondToAuthChallengeActionProcessor.js +16 -1
- package/lib/commonjs/logic/cognito/respondToAuthChallengeChallenge.d.ts +2 -1
- package/lib/commonjs/logic/cognito/respondToAuthChallengeChallenge.js +2 -2
- package/lib/commonjs/logic/cognito/utils/transformCognitoResponse.js +4 -1
- package/lib/commonjs/runtimeConfig/QPQAWSResourceMap.d.ts +2 -2
- package/lib/commonjs/types/DynamicLoader.d.ts +2 -1
- package/lib/esm/awsLambdaUtils.js +9 -8
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.js +0 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/websocket/matchStory.js +3 -6
- package/lib/esm/getActionProcessor/core/event/cloudFrontOriginRequest/matchStory.js +0 -1
- package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/getRecords.js +2 -2
- package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/matchStory.js +3 -4
- package/lib/esm/getActionProcessor/core/event/cognito/customMessage/autoRespond.js +3 -3
- package/lib/esm/getActionProcessor/core/event/cognito/customMessage/matchStory.js +3 -6
- package/lib/esm/getActionProcessor/core/event/cognito/defineAuthChallenge/getRecords.js +8 -2
- package/lib/esm/getActionProcessor/core/event/cognito/defineAuthChallenge/matchStory.js +3 -4
- package/lib/esm/getActionProcessor/core/event/cognito/utils/getChallengeSessionFromCognitoTriggerEventSession.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/event/cognito/utils/getChallengeSessionFromCognitoTriggerEventSession.js +10 -0
- package/lib/esm/getActionProcessor/core/event/cognito/utils/index.d.ts +1 -0
- package/lib/esm/getActionProcessor/core/event/cognito/utils/index.js +1 -0
- package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/getRecords.js +1 -1
- package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/matchStory.js +3 -4
- package/lib/esm/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.js +1 -2
- package/lib/esm/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.js +0 -1
- package/lib/esm/getActionProcessor/core/event/lambda/serviceFunction/matchStory.js +0 -1
- package/lib/esm/getActionProcessor/core/event/s3/fileEvent/matchStory.js +3 -1
- package/lib/esm/getActionProcessor/core/event/s3/fileEvent/types.d.ts +2 -2
- package/lib/esm/getActionProcessor/core/event/s3/fileEvent/types.js +2 -1
- package/lib/esm/getActionProcessor/core/event/sqs/queue/autoRespond.js +2 -2
- package/lib/esm/getActionProcessor/core/event/sqs/queue/matchStory.js +4 -4
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js +1 -0
- package/lib/esm/getActionProcessor/core/system/getExecuteStoryActionProcessor.js +7 -9
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryRespondToAuthChallengeActionProcessor.js +17 -2
- package/lib/esm/logic/cognito/respondToAuthChallengeChallenge.d.ts +2 -1
- package/lib/esm/logic/cognito/respondToAuthChallengeChallenge.js +3 -3
- package/lib/esm/logic/cognito/utils/transformCognitoResponse.js +6 -3
- package/lib/esm/runtimeConfig/QPQAWSResourceMap.d.ts +2 -2
- package/lib/esm/types/DynamicLoader.d.ts +2 -1
- package/package.json +5 -5
- package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.d.ts +0 -3
- package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.js +0 -14
- package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/utils/index.d.ts +0 -1
- package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/utils/index.js +0 -17
- package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.d.ts +0 -3
- package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.js +0 -14
- package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/index.d.ts +0 -1
- package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.d.ts +0 -3
- package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.js +0 -10
- package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/utils/index.d.ts +0 -1
- package/lib/esm/getActionProcessor/core/event/cognito/createAuthChallenge/utils/index.js +0 -1
- package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.d.ts +0 -3
- package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/getChallengeSessionFromCognitoCreateAuthChallengeTriggerEvent.js +0 -10
- package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/index.d.ts +0 -1
- package/lib/esm/getActionProcessor/core/event/cognito/verifyAuthChallenge/utils/index.js +0 -1
|
@@ -9,6 +9,7 @@ const randomGuid = () => {
|
|
|
9
9
|
};
|
|
10
10
|
exports.randomGuid = randomGuid;
|
|
11
11
|
const matchUrl = (path, url) => {
|
|
12
|
+
console.log('Matching: ', path);
|
|
12
13
|
// /attempt/{attemptUuid}/result/{test} => /attempt/:attemptUuid/result/:test
|
|
13
14
|
const modifiedPath = path.replaceAll(/{(.+?)}/g, (m, g) => `:${g}`);
|
|
14
15
|
const matchResult = (0, node_match_path_1.match)(modifiedPath, url);
|
|
@@ -21,21 +22,21 @@ exports.matchUrl = matchUrl;
|
|
|
21
22
|
const getS3BucketStorageClassFromStorageDriveTier = (driveTier) => {
|
|
22
23
|
switch (driveTier) {
|
|
23
24
|
case quidproquo_core_1.StorageDriveTier.REGULAR:
|
|
24
|
-
return
|
|
25
|
+
return 'STANDARD';
|
|
25
26
|
case quidproquo_core_1.StorageDriveTier.OCCASIONAL_ACCESS:
|
|
26
|
-
return
|
|
27
|
+
return 'STANDARD_IA';
|
|
27
28
|
case quidproquo_core_1.StorageDriveTier.SINGLE_ZONE_OCCASIONAL_ACCESS:
|
|
28
|
-
return
|
|
29
|
+
return 'ONEZONE_IA';
|
|
29
30
|
case quidproquo_core_1.StorageDriveTier.COLD_STORAGE:
|
|
30
|
-
return
|
|
31
|
+
return 'GLACIER';
|
|
31
32
|
case quidproquo_core_1.StorageDriveTier.COLD_STORAGE_INSTANT_ACCESS:
|
|
32
|
-
return
|
|
33
|
+
return 'GLACIER_IR';
|
|
33
34
|
case quidproquo_core_1.StorageDriveTier.DEEP_COLD_STORAGE:
|
|
34
|
-
return
|
|
35
|
+
return 'DEEP_ARCHIVE';
|
|
35
36
|
case quidproquo_core_1.StorageDriveTier.SMART_TIERING:
|
|
36
|
-
return
|
|
37
|
+
return 'INTELLIGENT_TIERING';
|
|
37
38
|
default:
|
|
38
|
-
return
|
|
39
|
+
return 'INTELLIGENT_TIERING';
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
exports.getS3BucketStorageClassFromStorageDriveTier = getS3BucketStorageClassFromStorageDriveTier;
|
|
@@ -30,7 +30,6 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
30
30
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `route not found [${qpqEventRecord.path}] - [${quidproquo_webserver_1.qpqWebServerUtils.getHeaderValue('user-agent', qpqEventRecord.headers)}]`);
|
|
31
31
|
}
|
|
32
32
|
return (0, quidproquo_core_1.actionResult)({
|
|
33
|
-
src: matchedRoute.route.src,
|
|
34
33
|
runtime: matchedRoute.route.runtime,
|
|
35
34
|
runtimeOptions: matchedRoute.match.params || {},
|
|
36
35
|
// TODO: Make this aware of the API that we are eventing
|
|
@@ -18,18 +18,15 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
18
18
|
switch (qpqEventRecord.eventType) {
|
|
19
19
|
case quidproquo_webserver_1.WebSocketEventType.Connect:
|
|
20
20
|
return (0, quidproquo_core_1.actionResult)({
|
|
21
|
-
|
|
22
|
-
runtime: userDirectoryConfig.eventProcessors.onConnect.runtime,
|
|
21
|
+
runtime: userDirectoryConfig.eventProcessors.onConnect,
|
|
23
22
|
});
|
|
24
23
|
case quidproquo_webserver_1.WebSocketEventType.Disconnect:
|
|
25
24
|
return (0, quidproquo_core_1.actionResult)({
|
|
26
|
-
|
|
27
|
-
runtime: userDirectoryConfig.eventProcessors.onDisconnect.runtime,
|
|
25
|
+
runtime: userDirectoryConfig.eventProcessors.onDisconnect,
|
|
28
26
|
});
|
|
29
27
|
case quidproquo_webserver_1.WebSocketEventType.Message:
|
|
30
28
|
return (0, quidproquo_core_1.actionResult)({
|
|
31
|
-
|
|
32
|
-
runtime: userDirectoryConfig.eventProcessors.onMessage.runtime,
|
|
29
|
+
runtime: userDirectoryConfig.eventProcessors.onMessage,
|
|
33
30
|
});
|
|
34
31
|
default:
|
|
35
32
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Websocket lambda not implemented for ${qpqEventRecord.eventType}`);
|
|
@@ -29,7 +29,6 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
29
29
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `seo not found [${qpqEventRecord.path}]`);
|
|
30
30
|
}
|
|
31
31
|
return (0, quidproquo_core_1.actionResult)({
|
|
32
|
-
src: matchedSeoConfig.route.src,
|
|
33
32
|
runtime: matchedSeoConfig.route.runtime,
|
|
34
33
|
runtimeOptions: matchedSeoConfig.match.params || {},
|
|
35
34
|
config: matchedSeoConfig.route,
|
package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/getRecords.js
CHANGED
|
@@ -11,12 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
13
|
const cognitoAttributeMap_1 = require("../../../../../logic/cognito/cognitoAttributeMap");
|
|
14
|
-
const utils_1 = require("
|
|
14
|
+
const utils_1 = require("../utils");
|
|
15
15
|
const getProcessGetRecords = (qpqConfig) => {
|
|
16
16
|
return ({ eventParams: [event, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const internalEventRecord = {
|
|
18
18
|
userName: event.userName,
|
|
19
|
-
session: (0, utils_1.
|
|
19
|
+
session: (0, utils_1.getChallengeSessionFromCognitoTriggerEventSession)(event.request.session),
|
|
20
20
|
userAttributes: (0, cognitoAttributeMap_1.getQpqAttributesFromCognitoStringMap)(event.request.userAttributes),
|
|
21
21
|
};
|
|
22
22
|
return (0, quidproquo_core_1.actionResult)([internalEventRecord]);
|
package/lib/commonjs/getActionProcessor/core/event/cognito/createAuthChallenge/matchStory.js
CHANGED
|
@@ -16,13 +16,12 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
|
|
|
16
16
|
const getProcessMatchStory = (qpqConfig) => {
|
|
17
17
|
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
|
|
18
18
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
var _a
|
|
20
|
-
if (!((
|
|
21
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.createAuthChallenge
|
|
19
|
+
var _a;
|
|
20
|
+
if (!((_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.createAuthChallenge)) {
|
|
21
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.createAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
|
|
22
22
|
}
|
|
23
23
|
return (0, quidproquo_core_2.actionResult)({
|
|
24
|
-
|
|
25
|
-
runtime: userDirectoryConfig.customAuthRuntime.createAuthChallenge.runtime,
|
|
24
|
+
runtime: userDirectoryConfig.customAuthRuntime.createAuthChallenge,
|
|
26
25
|
});
|
|
27
26
|
});
|
|
28
27
|
};
|
|
@@ -15,21 +15,20 @@ const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
|
15
15
|
const getProcessAutoRespond = (qpqConfig) => {
|
|
16
16
|
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === types_1.GLOBAL_USER_DIRECTORY_NAME);
|
|
17
17
|
return ({ qpqEventRecord, matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f;
|
|
19
18
|
const getErrorResult = () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
|
|
20
19
|
switch (qpqEventRecord.eventType) {
|
|
21
20
|
case quidproquo_webserver_1.EmailSendEventType.ResetPassword:
|
|
22
|
-
if (!(
|
|
21
|
+
if (!(userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword)) {
|
|
23
22
|
return getErrorResult();
|
|
24
23
|
}
|
|
25
24
|
break;
|
|
26
25
|
case quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin:
|
|
27
|
-
if (!(
|
|
26
|
+
if (!(userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin)) {
|
|
28
27
|
return getErrorResult();
|
|
29
28
|
}
|
|
30
29
|
break;
|
|
31
30
|
case quidproquo_webserver_1.EmailSendEventType.VerifyEmail:
|
|
32
|
-
if (!(
|
|
31
|
+
if (!(userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail)) {
|
|
33
32
|
return getErrorResult();
|
|
34
33
|
}
|
|
35
34
|
break;
|
|
@@ -16,22 +16,18 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
|
|
|
16
16
|
const getProcessMatchStory = (qpqConfig) => {
|
|
17
17
|
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
|
|
18
18
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f;
|
|
20
19
|
switch (qpqEventRecord.eventType) {
|
|
21
20
|
case quidproquo_webserver_1.EmailSendEventType.ResetPassword:
|
|
22
21
|
return (0, quidproquo_core_1.actionResult)({
|
|
23
|
-
|
|
24
|
-
runtime: (_b = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _b === void 0 ? void 0 : _b.runtime,
|
|
22
|
+
runtime: userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword,
|
|
25
23
|
});
|
|
26
24
|
case quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin:
|
|
27
25
|
return (0, quidproquo_core_1.actionResult)({
|
|
28
|
-
|
|
29
|
-
runtime: (_d = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _d === void 0 ? void 0 : _d.runtime,
|
|
26
|
+
runtime: userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin,
|
|
30
27
|
});
|
|
31
28
|
case quidproquo_webserver_1.EmailSendEventType.VerifyEmail:
|
|
32
29
|
return (0, quidproquo_core_1.actionResult)({
|
|
33
|
-
|
|
34
|
-
runtime: (_f = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _f === void 0 ? void 0 : _f.runtime,
|
|
30
|
+
runtime: userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail,
|
|
35
31
|
});
|
|
36
32
|
default:
|
|
37
33
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
|
package/lib/commonjs/getActionProcessor/core/event/cognito/defineAuthChallenge/getRecords.js
CHANGED
|
@@ -10,9 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const cognitoAttributeMap_1 = require("../../../../../logic/cognito/cognitoAttributeMap");
|
|
14
|
+
const utils_1 = require("../utils");
|
|
13
15
|
const getProcessGetRecords = (qpqConfig) => {
|
|
14
|
-
return ({ eventParams: [
|
|
15
|
-
const internalEventRecord = {
|
|
16
|
+
return ({ eventParams: [event, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const internalEventRecord = {
|
|
18
|
+
userName: event.userName,
|
|
19
|
+
session: (0, utils_1.getChallengeSessionFromCognitoTriggerEventSession)(event.request.session),
|
|
20
|
+
userAttributes: (0, cognitoAttributeMap_1.getQpqAttributesFromCognitoStringMap)(event.request.userAttributes),
|
|
21
|
+
};
|
|
16
22
|
return (0, quidproquo_core_1.actionResult)([internalEventRecord]);
|
|
17
23
|
});
|
|
18
24
|
};
|
package/lib/commonjs/getActionProcessor/core/event/cognito/defineAuthChallenge/matchStory.js
CHANGED
|
@@ -17,12 +17,11 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
17
17
|
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
|
|
18
18
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
19
|
var _a;
|
|
20
|
-
if (!userDirectoryConfig || !((_a = userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.defineAuthChallenge
|
|
21
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.defineAuthChallenge
|
|
20
|
+
if (!userDirectoryConfig || !((_a = userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.defineAuthChallenge)) {
|
|
21
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.defineAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
|
|
22
22
|
}
|
|
23
23
|
return (0, quidproquo_core_2.actionResult)({
|
|
24
|
-
|
|
25
|
-
runtime: userDirectoryConfig.customAuthRuntime.defineAuthChallenge.runtime,
|
|
24
|
+
runtime: userDirectoryConfig.customAuthRuntime.defineAuthChallenge,
|
|
26
25
|
});
|
|
27
26
|
});
|
|
28
27
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChallengeSessionFromCognitoTriggerEventSession = void 0;
|
|
4
|
+
const getChallengeSessionFromCognitoTriggerEventSession = (session) => {
|
|
5
|
+
const challengeSession = session.map((c) => {
|
|
6
|
+
const result = {
|
|
7
|
+
challengeName: c.challengeMetadata || '',
|
|
8
|
+
challengeResult: c.challengeResult,
|
|
9
|
+
};
|
|
10
|
+
return result;
|
|
11
|
+
});
|
|
12
|
+
return challengeSession;
|
|
13
|
+
};
|
|
14
|
+
exports.getChallengeSessionFromCognitoTriggerEventSession = getChallengeSessionFromCognitoTriggerEventSession;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getChallengeSessionFromCognitoTriggerEventSession';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./getChallengeSessionFromCognitoTriggerEventSession"), exports);
|
package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/getRecords.js
CHANGED
|
@@ -14,7 +14,7 @@ const cognitoAttributeMap_1 = require("../../../../../logic/cognito/cognitoAttri
|
|
|
14
14
|
const getProcessGetRecords = (qpqConfig) => {
|
|
15
15
|
return ({ eventParams: [event, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const internalEventRecord = {
|
|
17
|
-
challengeAnswer: event.request.challengeAnswer,
|
|
17
|
+
challengeAnswer: event.request.challengeAnswer ? JSON.parse(event.request.challengeAnswer) : {},
|
|
18
18
|
userAttributes: (0, cognitoAttributeMap_1.getQpqAttributesFromCognitoStringMap)(event.request.userAttributes),
|
|
19
19
|
userNotFound: event.request.userNotFound,
|
|
20
20
|
privateChallengeParameters: event.request.privateChallengeParameters,
|
package/lib/commonjs/getActionProcessor/core/event/cognito/verifyAuthChallenge/matchStory.js
CHANGED
|
@@ -16,13 +16,12 @@ const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
|
|
|
16
16
|
const getProcessMatchStory = (qpqConfig) => {
|
|
17
17
|
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
|
|
18
18
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
var _a
|
|
20
|
-
if (!((
|
|
21
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.verifyAuthChallenge
|
|
19
|
+
var _a;
|
|
20
|
+
if (!((_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.customAuthRuntime) === null || _a === void 0 ? void 0 : _a.verifyAuthChallenge)) {
|
|
21
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Missing customAuthRuntime.verifyAuthChallenge in [${GLOBAL_USER_DIRECTORY_NAME}]`);
|
|
22
22
|
}
|
|
23
23
|
return (0, quidproquo_core_2.actionResult)({
|
|
24
|
-
|
|
25
|
-
runtime: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge.runtime,
|
|
24
|
+
runtime: userDirectoryConfig.customAuthRuntime.verifyAuthChallenge,
|
|
26
25
|
});
|
|
27
26
|
});
|
|
28
27
|
};
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.js
CHANGED
|
@@ -19,8 +19,7 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
19
19
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Could not find deploy event config ${GLOBAL_DEPLOY_EVENT_NAME}`);
|
|
20
20
|
}
|
|
21
21
|
return (0, quidproquo_core_1.actionResult)({
|
|
22
|
-
|
|
23
|
-
runtime: deployConfig.src.runtime,
|
|
22
|
+
runtime: deployConfig.runtime,
|
|
24
23
|
});
|
|
25
24
|
});
|
|
26
25
|
};
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.js
CHANGED
|
@@ -15,7 +15,6 @@ const lambdaRuntimeConfig = JSON.parse(process.env.lambdaRuntimeConfig || '{}');
|
|
|
15
15
|
const getProcessMatchStory = (qpqConfig) => {
|
|
16
16
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
return (0, quidproquo_core_1.actionResult)({
|
|
18
|
-
src: lambdaRuntimeConfig.src,
|
|
19
18
|
runtime: lambdaRuntimeConfig.runtime,
|
|
20
19
|
runtimeOptions: {},
|
|
21
20
|
});
|
|
@@ -20,7 +20,6 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
20
20
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `service function not found [${qpqEventRecord.functionName}]`);
|
|
21
21
|
}
|
|
22
22
|
return (0, quidproquo_core_1.actionResult)({
|
|
23
|
-
src: matchedRoute.src,
|
|
24
23
|
runtime: matchedRoute.runtime,
|
|
25
24
|
});
|
|
26
25
|
});
|
|
@@ -13,7 +13,9 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
13
13
|
const types_1 = require("./types");
|
|
14
14
|
const getProcessMatchStory = (qpqConfig) => {
|
|
15
15
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
return (0, quidproquo_core_1.actionResult)(
|
|
16
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
17
|
+
runtime: types_1.GLOBAL_STORAGE_DRIVE_RUNTIME,
|
|
18
|
+
});
|
|
17
19
|
});
|
|
18
20
|
};
|
|
19
21
|
exports.default = (qpqConfig) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StorageDriveEvent, StorageDriveEventResponse } from 'quidproquo-webserver';
|
|
2
2
|
import { S3Event, Context } from 'aws-lambda';
|
|
3
|
-
import { MatchStoryResult,
|
|
3
|
+
import { MatchStoryResult, QpqFunctionRuntime } from 'quidproquo-core';
|
|
4
4
|
export declare const GLOBAL_STORAGE_DRIVE_NAME: string;
|
|
5
|
-
export declare const GLOBAL_STORAGE_DRIVE_RUNTIME:
|
|
5
|
+
export declare const GLOBAL_STORAGE_DRIVE_RUNTIME: QpqFunctionRuntime;
|
|
6
6
|
export type EventInput = [S3Event, Context];
|
|
7
7
|
export type EventOutput = void;
|
|
8
8
|
export type InternalEventRecord = StorageDriveEvent;
|
|
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GLOBAL_STORAGE_DRIVE_RUNTIME = exports.GLOBAL_STORAGE_DRIVE_NAME = void 0;
|
|
4
4
|
// Customs
|
|
5
5
|
exports.GLOBAL_STORAGE_DRIVE_NAME = process.env.storageDriveName;
|
|
6
|
-
|
|
6
|
+
// TODO: Get this from the storageDriveConfig.
|
|
7
|
+
exports.GLOBAL_STORAGE_DRIVE_RUNTIME = JSON.parse(process.env.storageDriveEntry || '"/::"');
|
|
@@ -11,9 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
13
|
const getProcessAutoRespond = (qpqConfig) => {
|
|
14
|
-
return ({
|
|
14
|
+
return ({ matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
// If we could not match, we can just auto respond...
|
|
16
|
-
if (!matchResult.
|
|
16
|
+
if (!matchResult.runtime) {
|
|
17
17
|
// Just say we have finished gracefully.
|
|
18
18
|
return (0, quidproquo_core_1.actionResult)(true);
|
|
19
19
|
}
|
|
@@ -21,9 +21,10 @@ exports.getQueueConfigSetting = getQueueConfigSetting;
|
|
|
21
21
|
const getProcessMatchStory = (qpqConfig) => {
|
|
22
22
|
// TODO: Get this out of the qpqconfig like the other event processors
|
|
23
23
|
const queueQPQConfigSetting = (0, exports.getQueueConfigSetting)();
|
|
24
|
+
const queueQueueProcessors = quidproquo_core_1.qpqCoreUtils.getQueueQueueProcessors(queueQPQConfigSetting.name, qpqConfig);
|
|
25
|
+
const queueTypes = Object.keys(queueQueueProcessors).sort();
|
|
24
26
|
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
const queueTypes = Object.keys(queueQueueProcessors).sort();
|
|
27
|
+
console.log('qpqEventRecord', JSON.stringify(qpqEventRecord, null, 2));
|
|
27
28
|
// Find the most relevant match
|
|
28
29
|
const matchedQueueType = queueTypes
|
|
29
30
|
.map((qt) => ({
|
|
@@ -41,8 +42,7 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
41
42
|
}
|
|
42
43
|
const sourceEntry = queueQueueProcessors[matchedQueueType.queueType];
|
|
43
44
|
return (0, quidproquo_core_1.actionResult)({
|
|
44
|
-
|
|
45
|
-
runtime: sourceEntry.runtime,
|
|
45
|
+
runtime: sourceEntry,
|
|
46
46
|
runtimeOptions: matchedQueueType.match.params || {},
|
|
47
47
|
config: matchedQueueType.queueType,
|
|
48
48
|
});
|
package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreUpsertActionProcessor.js
CHANGED
|
@@ -36,6 +36,7 @@ const getProcessKeyValueStoreUpsert = (qpqConfig) => {
|
|
|
36
36
|
catch (error) {
|
|
37
37
|
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
38
38
|
InternalServerError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_2.KeyValueStoreUpsertErrorTypeEnum.ServiceUnavailable, 'KVS Service Unavailable'),
|
|
39
|
+
ResourceNotFoundException: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_2.KeyValueStoreUpsertErrorTypeEnum.ResourceNotFound, 'KVS Resource Not Found'),
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
});
|
|
@@ -18,13 +18,12 @@ const getProcessExecuteStory = (qpqConfig, dynamicModuleLoader) => {
|
|
|
18
18
|
const moduleName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
19
19
|
return (payload, session, actionProcessors, logger) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
20
|
var _a, _b, _c, _d;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
const story = module[payload.runtime];
|
|
21
|
+
console.log('Trying to load module');
|
|
22
|
+
let story = yield dynamicModuleLoader(payload.runtime);
|
|
23
|
+
console.log('After - Trying to load module');
|
|
26
24
|
if (!story) {
|
|
27
|
-
|
|
25
|
+
console.log('No story');
|
|
26
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Unable to dynamically load: [${payload.runtime}]`);
|
|
28
27
|
}
|
|
29
28
|
const resolveStory = (0, quidproquo_core_1.createRuntime)(qpqConfig, {
|
|
30
29
|
context: ((_a = payload.storySession) === null || _a === void 0 ? void 0 : _a.context) || session.context,
|
|
@@ -33,11 +32,10 @@ const getProcessExecuteStory = (qpqConfig, dynamicModuleLoader) => {
|
|
|
33
32
|
correlation: ((_d = payload.storySession) === null || _d === void 0 ? void 0 : _d.correlation) || session.correlation,
|
|
34
33
|
}, actionProcessors, exports.getDateNow, logger,
|
|
35
34
|
// TODO: Share this logic.
|
|
36
|
-
`${moduleName}::${(0, awsLambdaUtils_1.randomGuid)()}`, quidproquo_core_1.QpqRuntimeType.EXECUTE_STORY, [
|
|
35
|
+
`${moduleName}::${(0, awsLambdaUtils_1.randomGuid)()}`, quidproquo_core_1.QpqRuntimeType.EXECUTE_STORY, [payload.runtime]);
|
|
37
36
|
const storyResult = yield resolveStory(story, payload.params);
|
|
38
37
|
if (storyResult.error) {
|
|
39
|
-
|
|
40
|
-
return (0, quidproquo_core_1.actionResultError)(storyResult.error.errorType, storyResult.error.errorText, storyResult.error.errorStack ? `${stack} -> [${storyResult.error.errorStack}]` : stack);
|
|
38
|
+
return (0, quidproquo_core_1.actionResultError)(storyResult.error.errorType, storyResult.error.errorText, storyResult.error.errorStack ? `${payload.runtime} -> [${storyResult.error.errorStack}]` : payload.runtime);
|
|
41
39
|
}
|
|
42
40
|
return (0, quidproquo_core_1.actionResult)(storyResult.result);
|
|
43
41
|
});
|
|
@@ -13,22 +13,37 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
13
13
|
const awsNamingUtils_1 = require("../../../awsNamingUtils");
|
|
14
14
|
const getExportedValue_1 = require("../../../logic/cloudformation/getExportedValue");
|
|
15
15
|
const respondToAuthChallengeChallenge_1 = require("../../../logic/cognito/respondToAuthChallengeChallenge");
|
|
16
|
+
const client_cognito_identity_provider_1 = require("@aws-sdk/client-cognito-identity-provider");
|
|
16
17
|
const anyAuthChallengeToCognitoAttributes = (authChallenge) => {
|
|
17
18
|
switch (authChallenge.challenge) {
|
|
18
19
|
case quidproquo_core_1.AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED:
|
|
19
20
|
return {
|
|
20
21
|
NEW_PASSWORD: authChallenge.newPassword,
|
|
21
22
|
};
|
|
23
|
+
case quidproquo_core_1.AuthenticateUserChallenge.CUSTOM_CHALLENGE:
|
|
24
|
+
return {
|
|
25
|
+
ANSWER: JSON.stringify(authChallenge.challengeAnswer),
|
|
26
|
+
};
|
|
22
27
|
default:
|
|
23
28
|
return {};
|
|
24
29
|
}
|
|
25
30
|
};
|
|
31
|
+
const anyAuthChallengeToCognitoChallengeName = (authChallenge) => {
|
|
32
|
+
switch (authChallenge.challenge) {
|
|
33
|
+
case quidproquo_core_1.AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED:
|
|
34
|
+
return client_cognito_identity_provider_1.ChallengeNameType.NEW_PASSWORD_REQUIRED;
|
|
35
|
+
case quidproquo_core_1.AuthenticateUserChallenge.CUSTOM_CHALLENGE:
|
|
36
|
+
return client_cognito_identity_provider_1.ChallengeNameType.CUSTOM_CHALLENGE;
|
|
37
|
+
default:
|
|
38
|
+
throw new Error(`Unknown challenge`);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
26
41
|
const getUserDirectoryRespondToAuthChallengeActionProcessor = (qpqConfig) => {
|
|
27
42
|
return ({ userDirectoryName, authChallenge }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
43
|
const region = quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
29
44
|
const userPoolId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
30
45
|
const userPoolClientId = yield (0, getExportedValue_1.getExportedValue)((0, awsNamingUtils_1.getCFExportNameUserPoolClientIdFromConfig)(userDirectoryName, qpqConfig), region);
|
|
31
|
-
const response = yield (0, respondToAuthChallengeChallenge_1.respondToAuthChallengeChallenge)(userPoolId, userPoolClientId, region, authChallenge.username, authChallenge.session, anyAuthChallengeToCognitoAttributes(authChallenge));
|
|
46
|
+
const response = yield (0, respondToAuthChallengeChallenge_1.respondToAuthChallengeChallenge)(userPoolId, userPoolClientId, region, authChallenge.username, authChallenge.session, anyAuthChallengeToCognitoChallengeName(authChallenge), anyAuthChallengeToCognitoAttributes(authChallenge));
|
|
32
47
|
return (0, quidproquo_core_1.actionResult)(response);
|
|
33
48
|
});
|
|
34
49
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { AuthenticateUserResponse } from 'quidproquo-core';
|
|
2
|
-
|
|
2
|
+
import { ChallengeNameType } from '@aws-sdk/client-cognito-identity-provider';
|
|
3
|
+
export declare const respondToAuthChallengeChallenge: (userPoolId: string, clientId: string, region: string, username: string, session: string, challengeNameType: ChallengeNameType, attributes: Record<string, string>) => Promise<AuthenticateUserResponse>;
|
|
@@ -15,12 +15,12 @@ const calculateSecretHash_1 = require("./utils/calculateSecretHash");
|
|
|
15
15
|
const getUserPoolClientSecret_1 = require("./getUserPoolClientSecret");
|
|
16
16
|
const transformCognitoResponse_1 = require("./utils/transformCognitoResponse");
|
|
17
17
|
const createAwsClient_1 = require("../createAwsClient");
|
|
18
|
-
const respondToAuthChallengeChallenge = (userPoolId, clientId, region, username, session, attributes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const respondToAuthChallengeChallenge = (userPoolId, clientId, region, username, session, challengeNameType, attributes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
19
|
const cognitoClient = (0, createAwsClient_1.createAwsClient)(client_cognito_identity_provider_1.CognitoIdentityProviderClient, { region });
|
|
20
20
|
const clientSecret = yield (0, getUserPoolClientSecret_1.getUserPoolClientSecret)(userPoolId, clientId, region);
|
|
21
21
|
const secretHash = (0, calculateSecretHash_1.calculateSecretHash)(username, clientId, clientSecret);
|
|
22
22
|
const params = {
|
|
23
|
-
ChallengeName:
|
|
23
|
+
ChallengeName: challengeNameType,
|
|
24
24
|
ClientId: clientId,
|
|
25
25
|
Session: session,
|
|
26
26
|
ChallengeResponses: Object.assign({ USERNAME: username, SECRET_HASH: secretHash }, attributes),
|
|
@@ -24,16 +24,19 @@ const cognitoChallengeNameTypeToQpqAuthenticateUserChallenge = (cognitoChallenge
|
|
|
24
24
|
}
|
|
25
25
|
const map = {
|
|
26
26
|
[client_cognito_identity_provider_1.ChallengeNameType.NEW_PASSWORD_REQUIRED]: quidproquo_core_1.AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED,
|
|
27
|
+
[client_cognito_identity_provider_1.ChallengeNameType.CUSTOM_CHALLENGE]: quidproquo_core_1.AuthenticateUserChallenge.CUSTOM_CHALLENGE,
|
|
27
28
|
};
|
|
28
29
|
// TODO: handle the NOT-IMP cases
|
|
29
|
-
const challenge = map[cognitoChallengeName] || `NOT-IMP-${cognitoChallengeName}`;
|
|
30
|
+
const challenge = map[cognitoChallengeName] || `QPQ-NOT-IMP-${cognitoChallengeName}`;
|
|
30
31
|
return challenge;
|
|
31
32
|
};
|
|
32
33
|
exports.cognitoChallengeNameTypeToQpqAuthenticateUserChallenge = cognitoChallengeNameTypeToQpqAuthenticateUserChallenge;
|
|
33
34
|
const cognitoAdminInitiateAuthResponseToQpqAuthenticationInfo = (authResponse, issueDateTime) => {
|
|
35
|
+
console.log('authResponse XYZ', authResponse);
|
|
34
36
|
const res = {
|
|
35
37
|
session: authResponse.Session,
|
|
36
38
|
challenge: (0, exports.cognitoChallengeNameTypeToQpqAuthenticateUserChallenge)(authResponse.ChallengeName),
|
|
39
|
+
challengeParameters: authResponse.ChallengeParameters,
|
|
37
40
|
};
|
|
38
41
|
if (authResponse.AuthenticationResult) {
|
|
39
42
|
res.authenticationInfo = (0, exports.cognitoAuthenticationResultTypeToQpqAuthenticationInfo)(authResponse.AuthenticationResult, issueDateTime);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { QpqFunctionRuntime } from 'quidproquo-core';
|
|
2
|
+
export type DynamicModuleLoader = (runtime: QpqFunctionRuntime) => Promise<any>;
|
|
@@ -5,6 +5,7 @@ export const randomGuid = () => {
|
|
|
5
5
|
return randomUUID();
|
|
6
6
|
};
|
|
7
7
|
export const matchUrl = (path, url) => {
|
|
8
|
+
console.log('Matching: ', path);
|
|
8
9
|
// /attempt/{attemptUuid}/result/{test} => /attempt/:attemptUuid/result/:test
|
|
9
10
|
const modifiedPath = path.replaceAll(/{(.+?)}/g, (m, g) => `:${g}`);
|
|
10
11
|
const matchResult = match(modifiedPath, url);
|
|
@@ -16,20 +17,20 @@ export const matchUrl = (path, url) => {
|
|
|
16
17
|
export const getS3BucketStorageClassFromStorageDriveTier = (driveTier) => {
|
|
17
18
|
switch (driveTier) {
|
|
18
19
|
case StorageDriveTier.REGULAR:
|
|
19
|
-
return
|
|
20
|
+
return 'STANDARD';
|
|
20
21
|
case StorageDriveTier.OCCASIONAL_ACCESS:
|
|
21
|
-
return
|
|
22
|
+
return 'STANDARD_IA';
|
|
22
23
|
case StorageDriveTier.SINGLE_ZONE_OCCASIONAL_ACCESS:
|
|
23
|
-
return
|
|
24
|
+
return 'ONEZONE_IA';
|
|
24
25
|
case StorageDriveTier.COLD_STORAGE:
|
|
25
|
-
return
|
|
26
|
+
return 'GLACIER';
|
|
26
27
|
case StorageDriveTier.COLD_STORAGE_INSTANT_ACCESS:
|
|
27
|
-
return
|
|
28
|
+
return 'GLACIER_IR';
|
|
28
29
|
case StorageDriveTier.DEEP_COLD_STORAGE:
|
|
29
|
-
return
|
|
30
|
+
return 'DEEP_ARCHIVE';
|
|
30
31
|
case StorageDriveTier.SMART_TIERING:
|
|
31
|
-
return
|
|
32
|
+
return 'INTELLIGENT_TIERING';
|
|
32
33
|
default:
|
|
33
|
-
return
|
|
34
|
+
return 'INTELLIGENT_TIERING';
|
|
34
35
|
}
|
|
35
36
|
};
|
|
@@ -19,7 +19,6 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
19
19
|
return actionResultError(ErrorTypeEnum.NotFound, `route not found [${qpqEventRecord.path}] - [${qpqWebServerUtils.getHeaderValue('user-agent', qpqEventRecord.headers)}]`);
|
|
20
20
|
}
|
|
21
21
|
return actionResult({
|
|
22
|
-
src: matchedRoute.route.src,
|
|
23
22
|
runtime: matchedRoute.route.runtime,
|
|
24
23
|
runtimeOptions: matchedRoute.match.params || {},
|
|
25
24
|
// TODO: Make this aware of the API that we are eventing
|
|
@@ -7,18 +7,15 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
7
7
|
switch (qpqEventRecord.eventType) {
|
|
8
8
|
case WebSocketEventType.Connect:
|
|
9
9
|
return actionResult({
|
|
10
|
-
|
|
11
|
-
runtime: userDirectoryConfig.eventProcessors.onConnect.runtime,
|
|
10
|
+
runtime: userDirectoryConfig.eventProcessors.onConnect,
|
|
12
11
|
});
|
|
13
12
|
case WebSocketEventType.Disconnect:
|
|
14
13
|
return actionResult({
|
|
15
|
-
|
|
16
|
-
runtime: userDirectoryConfig.eventProcessors.onDisconnect.runtime,
|
|
14
|
+
runtime: userDirectoryConfig.eventProcessors.onDisconnect,
|
|
17
15
|
});
|
|
18
16
|
case WebSocketEventType.Message:
|
|
19
17
|
return actionResult({
|
|
20
|
-
|
|
21
|
-
runtime: userDirectoryConfig.eventProcessors.onMessage.runtime,
|
|
18
|
+
runtime: userDirectoryConfig.eventProcessors.onMessage,
|
|
22
19
|
});
|
|
23
20
|
default:
|
|
24
21
|
return actionResultError(ErrorTypeEnum.NotFound, `Websocket lambda not implemented for ${qpqEventRecord.eventType}`);
|
|
@@ -18,7 +18,6 @@ const getProcessMatchStory = (qpqConfig) => {
|
|
|
18
18
|
return actionResultError(ErrorTypeEnum.NotFound, `seo not found [${qpqEventRecord.path}]`);
|
|
19
19
|
}
|
|
20
20
|
return actionResult({
|
|
21
|
-
src: matchedSeoConfig.route.src,
|
|
22
21
|
runtime: matchedSeoConfig.route.runtime,
|
|
23
22
|
runtimeOptions: matchedSeoConfig.match.params || {},
|
|
24
23
|
config: matchedSeoConfig.route,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EventActionType, actionResult } from 'quidproquo-core';
|
|
2
2
|
import { getQpqAttributesFromCognitoStringMap } from '../../../../../logic/cognito/cognitoAttributeMap';
|
|
3
|
-
import {
|
|
3
|
+
import { getChallengeSessionFromCognitoTriggerEventSession } from '../utils';
|
|
4
4
|
const getProcessGetRecords = (qpqConfig) => {
|
|
5
5
|
return async ({ eventParams: [event, context] }) => {
|
|
6
6
|
const internalEventRecord = {
|
|
7
7
|
userName: event.userName,
|
|
8
|
-
session:
|
|
8
|
+
session: getChallengeSessionFromCognitoTriggerEventSession(event.request.session),
|
|
9
9
|
userAttributes: getQpqAttributesFromCognitoStringMap(event.request.userAttributes),
|
|
10
10
|
};
|
|
11
11
|
return actionResult([internalEventRecord]);
|