quidproquo-actionprocessor-awslambda 0.0.197 → 0.0.199
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/event/apiGatwayEvent/api/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/autoRespond.js +47 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getRecords.js +47 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.js +45 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.js +64 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/types.d.ts +10 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/types.js +2 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/index.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/index.js +18 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/autoRespond.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/getRecords.js +38 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/matchStory.js +43 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/transformResponseResult.js +29 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/types.d.ts +16 -0
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/websocket/types.js +5 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/autoRespond.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/getRecords.js +39 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/matchStory.js +43 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/transformResponseResult.js +71 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/types.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/types.js +2 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/autoRespond.js +46 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/getRecords.js +45 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/matchStory.js +45 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/transformResponseResult.js +30 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/types.d.ts +9 -0
- package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/types.js +4 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.js +26 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/getRecords.js +44 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/matchStory.js +31 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/transformResponseResult.js +28 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/types.d.ts +15 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/types.js +2 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/index.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/index.js +18 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/autoRespond.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/getRecords.js +27 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/matchStory.js +28 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/transformResponseResult.js +28 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/types.d.ts +7 -0
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/recurringSchedule/types.js +2 -0
- package/lib/commonjs/getActionProcessor/core/event/index.d.ts +7 -0
- package/lib/commonjs/getActionProcessor/core/event/index.js +23 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/index.js +17 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/autoRespond.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/getRecords.js +26 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/{getServiceFunctionExecuteEventActionProcessor.js → lambda/serviceFunction/matchStory.js} +3 -21
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/transformResponseResult.js +25 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/types.d.ts +11 -0
- package/lib/commonjs/getActionProcessor/core/event/lambda/serviceFunction/types.js +2 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/autoRespond.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/getRecords.js +33 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/getStorySession.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/matchStory.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/matchStory.js +23 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/transformResponseResult.js +28 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/types.d.ts +10 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/fileEvent/types.js +6 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/event/s3/index.js +17 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/index.js +17 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/autoRespond.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/autoRespond.js +22 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/getRecords.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/getRecords.js +35 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/getStorySession.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/getStorySession.js +28 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/index.d.ts +8 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/index.js +13 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/matchStory.d.ts +7 -0
- package/lib/commonjs/getActionProcessor/core/event/{getSQSEventRecordActionProcessor.js → sqs/queue/matchStory.js} +5 -28
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/transformResponseResult.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/transformResponseResult.js +35 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/types.d.ts +12 -0
- package/lib/commonjs/getActionProcessor/core/event/sqs/queue/types.js +2 -0
- package/lib/commonjs/getActionProcessor/core/index.d.ts +1 -10
- package/lib/commonjs/getActionProcessor/core/index.js +16 -21
- package/lib/commonjs/getActionProcessor/core/system/getExecuteStoryActionProcessor.d.ts +1 -1
- package/lib/commonjs/getActionProcessor/core/system/getExecuteStoryActionProcessor.js +7 -1
- package/lib/commonjs/getActionProcessor/core/system/index.d.ts +1 -1
- package/lib/commonjs/getActionProcessor/webserver/serviceFunction/getServiceFunctionActionProcessor.js +6 -3
- package/package.json +5 -5
- package/lib/commonjs/getActionProcessor/core/event/getAPIGatewayEventActionProcessor.d.ts +0 -12
- package/lib/commonjs/getActionProcessor/core/event/getAPIGatewayEventActionProcessor.js +0 -127
- package/lib/commonjs/getActionProcessor/core/event/getCloudFrontOriginRequestEventActionProcessor.d.ts +0 -11
- package/lib/commonjs/getActionProcessor/core/event/getCloudFrontOriginRequestEventActionProcessor.js +0 -73
- package/lib/commonjs/getActionProcessor/core/event/getCustomResourceCloudflareDnsEventActionProcessor.d.ts +0 -12
- package/lib/commonjs/getActionProcessor/core/event/getCustomResourceCloudflareDnsEventActionProcessor.js +0 -80
- package/lib/commonjs/getActionProcessor/core/event/getEventBridgeEventActionProcessor.d.ts +0 -13
- package/lib/commonjs/getActionProcessor/core/event/getEventBridgeEventActionProcessor.js +0 -49
- package/lib/commonjs/getActionProcessor/core/event/getEventBridgeEventStackDeployActionProcessor.d.ts +0 -18
- package/lib/commonjs/getActionProcessor/core/event/getEventBridgeEventStackDeployActionProcessor.js +0 -75
- package/lib/commonjs/getActionProcessor/core/event/getLambdaCognitoCustomMessage.d.ts +0 -12
- package/lib/commonjs/getActionProcessor/core/event/getLambdaCognitoCustomMessage.js +0 -104
- package/lib/commonjs/getActionProcessor/core/event/getS3FileEventActionProcessor.d.ts +0 -12
- package/lib/commonjs/getActionProcessor/core/event/getS3FileEventActionProcessor.js +0 -54
- package/lib/commonjs/getActionProcessor/core/event/getSQSEventRecordActionProcessor.d.ts +0 -13
- package/lib/commonjs/getActionProcessor/core/event/getServiceFunctionExecuteEventActionProcessor.d.ts +0 -14
- package/lib/commonjs/getActionProcessor/core/event/getWebsocketAPIGatewayEventActionProcessor.d.ts +0 -22
- package/lib/commonjs/getActionProcessor/core/event/getWebsocketAPIGatewayEventActionProcessor.js +0 -82
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
14
|
+
const getProcessGetRecords = (qpqConfig) => {
|
|
15
|
+
return ({ eventParams: [cloudFrontRequestEvent, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const records = cloudFrontRequestEvent.Records.map((record) => {
|
|
17
|
+
const cfRecordRequest = record.cf.request;
|
|
18
|
+
const headers = Object.keys(cfRecordRequest.headers).reduce((acc, header) => (Object.assign(Object.assign({}, acc), { [header]: cfRecordRequest.headers[header][0].value })), {});
|
|
19
|
+
const internalRecord = {
|
|
20
|
+
domain: quidproquo_webserver_1.qpqWebServerUtils.getBaseDomainName(qpqConfig),
|
|
21
|
+
body: cfRecordRequest.body,
|
|
22
|
+
correlation: context.awsRequestId,
|
|
23
|
+
method: cfRecordRequest.method,
|
|
24
|
+
path: cfRecordRequest.uri,
|
|
25
|
+
sourceIp: cfRecordRequest.clientIp,
|
|
26
|
+
headers: headers,
|
|
27
|
+
// TODO: query string support
|
|
28
|
+
query: {},
|
|
29
|
+
};
|
|
30
|
+
return internalRecord;
|
|
31
|
+
});
|
|
32
|
+
return (0, quidproquo_core_1.actionResult)(records);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.default = (qpqConfig) => {
|
|
36
|
+
return {
|
|
37
|
+
[quidproquo_core_1.EventActionType.GetRecords]: getProcessGetRecords(qpqConfig),
|
|
38
|
+
};
|
|
39
|
+
};
|
package/lib/commonjs/getActionProcessor/core/event/cloudFrontOriginRequest/getStorySession.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventGetStorySessionActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput, InternalEventRecord } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, InternalEventRecord>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const getProcessGetStorySession = (qpqConfig) => {
|
|
14
|
+
return ({ qpqEventRecord, eventParams }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.default = (qpqConfig) => {
|
|
19
|
+
return {
|
|
20
|
+
[quidproquo_core_1.EventActionType.GetStorySession]: getProcessGetStorySession(qpqConfig),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
export declare const getCloudFrontOriginRequestEventProcessor: (qpqConfig: QPQConfig) => {
|
|
3
|
+
"@quidproquo-core/event/TransformResponseResult": import("quidproquo-core").EventTransformResponseResultActionProcessor<import("./types").EventInput, import("quidproquo-webserver").SeoEventResponse, import("aws-lambda").CloudFrontRequestResult>;
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": import("quidproquo-core").EventAutoRespondActionProcessor<import("./types").InternalEventRecord, import("./types").MatchResult, import("quidproquo-webserver").SeoEventResponse>;
|
|
5
|
+
"@quidproquo-core/event/MatchStory": import("quidproquo-core").EventMatchStoryActionProcessor<import("./types").InternalEventRecord, import("./types").MatchResult>;
|
|
6
|
+
"@quidproquo-core/Event/GetRecords": import("quidproquo-core").EventGetRecordsActionProcessor<import("./types").EventInput, import("./types").InternalEventRecord>;
|
|
7
|
+
"@quidproquo-core/event/GetStorySession": import("quidproquo-core").EventGetStorySessionActionProcessor<import("./types").EventInput, import("./types").InternalEventRecord>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCloudFrontOriginRequestEventProcessor = void 0;
|
|
7
|
+
const autoRespond_1 = __importDefault(require("./autoRespond"));
|
|
8
|
+
const getRecords_1 = __importDefault(require("./getRecords"));
|
|
9
|
+
const matchStory_1 = __importDefault(require("./matchStory"));
|
|
10
|
+
const transformResponseResult_1 = __importDefault(require("./transformResponseResult"));
|
|
11
|
+
const getStorySession_1 = __importDefault(require("./getStorySession"));
|
|
12
|
+
const getCloudFrontOriginRequestEventProcessor = (qpqConfig) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, getStorySession_1.default)(qpqConfig)), (0, getRecords_1.default)(qpqConfig)), (0, matchStory_1.default)(qpqConfig)), (0, autoRespond_1.default)(qpqConfig)), (0, transformResponseResult_1.default)(qpqConfig)));
|
|
13
|
+
exports.getCloudFrontOriginRequestEventProcessor = getCloudFrontOriginRequestEventProcessor;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventMatchStoryActionProcessor, QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { InternalEventRecord, MatchResult } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<InternalEventRecord, MatchResult>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
14
|
+
const awsLambdaUtils_1 = require("../../../../awsLambdaUtils");
|
|
15
|
+
const getProcessMatchStory = (qpqConfig) => {
|
|
16
|
+
const seoConfigs = quidproquo_webserver_1.qpqWebServerUtils.getAllSeo(qpqConfig);
|
|
17
|
+
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
// Sort the routes by string length
|
|
19
|
+
// we don't sort them here for SEO... its the order they are defined.
|
|
20
|
+
const sortedSeoConfigs = seoConfigs; // qpqWebServerUtils.sortPathMatchConfigs(seoConfigs);
|
|
21
|
+
// Find the most relevant match
|
|
22
|
+
const matchedSeoConfig = sortedSeoConfigs
|
|
23
|
+
.map((r) => ({
|
|
24
|
+
match: (0, awsLambdaUtils_1.matchUrl)(r.path, qpqEventRecord.path),
|
|
25
|
+
route: r,
|
|
26
|
+
}))
|
|
27
|
+
.find((m) => m.match.didMatch);
|
|
28
|
+
if (!matchedSeoConfig) {
|
|
29
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `seo not found [${qpqEventRecord.path}]`);
|
|
30
|
+
}
|
|
31
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
32
|
+
src: matchedSeoConfig.route.src,
|
|
33
|
+
runtime: matchedSeoConfig.route.runtime,
|
|
34
|
+
runtimeOptions: matchedSeoConfig.match.params || {},
|
|
35
|
+
config: matchedSeoConfig.route,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.default = (qpqConfig) => {
|
|
40
|
+
return {
|
|
41
|
+
[quidproquo_core_1.EventActionType.MatchStory]: getProcessMatchStory(qpqConfig),
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventTransformResponseResultActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<EventInput, import("quidproquo-webserver").SeoEventResponse, import("aws-lambda").CloudFrontRequestResult>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const ErrorTypeHttpResponseMap = {
|
|
14
|
+
[quidproquo_core_1.ErrorTypeEnum.BadRequest]: 400,
|
|
15
|
+
[quidproquo_core_1.ErrorTypeEnum.Unauthorized]: 401,
|
|
16
|
+
[quidproquo_core_1.ErrorTypeEnum.PaymentRequired]: 402,
|
|
17
|
+
[quidproquo_core_1.ErrorTypeEnum.Forbidden]: 403,
|
|
18
|
+
[quidproquo_core_1.ErrorTypeEnum.NotFound]: 404,
|
|
19
|
+
[quidproquo_core_1.ErrorTypeEnum.TimeOut]: 408,
|
|
20
|
+
[quidproquo_core_1.ErrorTypeEnum.Conflict]: 409,
|
|
21
|
+
[quidproquo_core_1.ErrorTypeEnum.UnsupportedMediaType]: 415,
|
|
22
|
+
[quidproquo_core_1.ErrorTypeEnum.OutOfResources]: 500,
|
|
23
|
+
[quidproquo_core_1.ErrorTypeEnum.GenericError]: 500,
|
|
24
|
+
[quidproquo_core_1.ErrorTypeEnum.NotImplemented]: 501,
|
|
25
|
+
[quidproquo_core_1.ErrorTypeEnum.NoContent]: 204,
|
|
26
|
+
[quidproquo_core_1.ErrorTypeEnum.Invalid]: 422,
|
|
27
|
+
};
|
|
28
|
+
const transformHttpEventHeadersToAPIGatewayProxyResultHeaders = (headers) => {
|
|
29
|
+
return Object.keys(headers)
|
|
30
|
+
.filter((header) => !!headers[header])
|
|
31
|
+
.reduce((acc, header) => (Object.assign(Object.assign({}, acc), { [header]: headers[header] })), {});
|
|
32
|
+
};
|
|
33
|
+
const getResponseFromErrorResult = (error) => {
|
|
34
|
+
const statusCode = ErrorTypeHttpResponseMap[error.errorType] || 500;
|
|
35
|
+
return {
|
|
36
|
+
status: statusCode,
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
errorType: error.errorType,
|
|
39
|
+
errorText: error.errorText,
|
|
40
|
+
}),
|
|
41
|
+
fallbackToCDN: true,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const getProcessTransformResponseResult = (qpqConfig) => {
|
|
45
|
+
// We might need to JSON.stringify the body.
|
|
46
|
+
return ({ eventParams, qpqEventRecordResponses }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const [cloudFrontRequestEvent] = eventParams;
|
|
48
|
+
const [seoEventResponse] = qpqEventRecordResponses;
|
|
49
|
+
// If we have an error, we need to transform it to a response, otherwise we can just use the record as is
|
|
50
|
+
const successRecord = seoEventResponse.success ? seoEventResponse.result : getResponseFromErrorResult(seoEventResponse.error);
|
|
51
|
+
if (successRecord.fallbackToCDN) {
|
|
52
|
+
return (0, quidproquo_core_1.actionResult)(cloudFrontRequestEvent.Records[0].cf.request);
|
|
53
|
+
}
|
|
54
|
+
const headers = successRecord.headers || {};
|
|
55
|
+
const responseHeaders = Object.keys(headers).reduce((acc, header) => (Object.assign(Object.assign({}, acc), { [header]: [{ value: headers[header] }] })), {});
|
|
56
|
+
const result = {
|
|
57
|
+
status: `${successRecord.status}`,
|
|
58
|
+
statusDescription: 'OK',
|
|
59
|
+
body: successRecord.body,
|
|
60
|
+
headers: responseHeaders,
|
|
61
|
+
// TODO: Revist this.
|
|
62
|
+
bodyEncoding: successRecord.bodyEncoding === 'base64' ? 'base64' : 'text',
|
|
63
|
+
};
|
|
64
|
+
return (0, quidproquo_core_1.actionResult)(result);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.default = (qpqConfig) => {
|
|
68
|
+
return {
|
|
69
|
+
[quidproquo_core_1.EventActionType.TransformResponseResult]: getProcessTransformResponseResult(qpqConfig),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SeoEvent, SeoEventResponse, SeoEventRouteParams, SeoQPQWebServerConfigSetting } from 'quidproquo-webserver';
|
|
2
|
+
import { CloudFrontRequestEvent, Context, CloudFrontRequestResult } from 'aws-lambda';
|
|
3
|
+
import { MatchStoryResult } from 'quidproquo-core';
|
|
4
|
+
export type EventInput = [CloudFrontRequestEvent, Context];
|
|
5
|
+
export type EventOutput = CloudFrontRequestResult;
|
|
6
|
+
export type InternalEventRecord = SeoEvent<any>;
|
|
7
|
+
export type InternalEventOutput = SeoEventResponse;
|
|
8
|
+
export type MatchResult = MatchStoryResult<SeoEventRouteParams, SeoQPQWebServerConfigSetting>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventAutoRespondActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { MatchResult } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<import("quidproquo-webserver").EmailSendEvent, MatchResult, import("quidproquo-webserver").EmailSendEventResponse>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
15
|
+
const getProcessAutoRespond = (qpqConfig) => {
|
|
16
|
+
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === types_1.GLOBAL_USER_DIRECTORY_NAME);
|
|
17
|
+
return ({ qpqEventRecord, matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
|
+
const getErrorResult = () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
|
|
20
|
+
switch (qpqEventRecord.eventType) {
|
|
21
|
+
case quidproquo_webserver_1.EmailSendEventType.ResetPassword:
|
|
22
|
+
if (!((_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _a === void 0 ? void 0 : _a.src) || !((_b = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _b === void 0 ? void 0 : _b.runtime)) {
|
|
23
|
+
return getErrorResult();
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
case quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin:
|
|
27
|
+
if (!((_c = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _c === void 0 ? void 0 : _c.src) || !((_d = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _d === void 0 ? void 0 : _d.runtime)) {
|
|
28
|
+
return getErrorResult();
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
case quidproquo_webserver_1.EmailSendEventType.VerifyEmail:
|
|
32
|
+
if (!((_e = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _e === void 0 ? void 0 : _e.src) || !((_f = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _f === void 0 ? void 0 : _f.runtime)) {
|
|
33
|
+
return getErrorResult();
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email processor not implemented for ${qpqEventRecord.eventType}`);
|
|
38
|
+
}
|
|
39
|
+
return (0, quidproquo_core_1.actionResult)(null);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
exports.default = (qpqConfig) => {
|
|
43
|
+
return {
|
|
44
|
+
[quidproquo_core_1.EventActionType.AutoRespond]: getProcessAutoRespond(qpqConfig),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventGetRecordsActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/Event/GetRecords": EventGetRecordsActionProcessor<EventInput, import("quidproquo-webserver").EmailSendEvent>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
14
|
+
const getProcessGetRecords = (qpqConfig) => {
|
|
15
|
+
return ({ eventParams: [customMessageTriggerEvent, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
const internalEventRecord = {
|
|
18
|
+
eventType: quidproquo_webserver_1.EmailSendEventType.VerifyEmail,
|
|
19
|
+
code: customMessageTriggerEvent.request.codeParameter,
|
|
20
|
+
link: customMessageTriggerEvent.request.linkParameter,
|
|
21
|
+
attributes: customMessageTriggerEvent.request.userAttributes,
|
|
22
|
+
username: customMessageTriggerEvent.request.usernameParameter,
|
|
23
|
+
};
|
|
24
|
+
switch (customMessageTriggerEvent.triggerSource) {
|
|
25
|
+
case 'CustomMessage_ForgotPassword': {
|
|
26
|
+
if (((_a = customMessageTriggerEvent.request.clientMetadata) === null || _a === void 0 ? void 0 : _a['userInitiated']) === 'true') {
|
|
27
|
+
internalEventRecord.eventType = quidproquo_webserver_1.EmailSendEventType.ResetPassword;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
internalEventRecord.eventType = quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin;
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case 'CustomMessage_VerifyUserAttribute':
|
|
35
|
+
internalEventRecord.eventType = quidproquo_webserver_1.EmailSendEventType.VerifyEmail;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return (0, quidproquo_core_1.actionResult)([internalEventRecord]);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.default = (qpqConfig) => {
|
|
42
|
+
return {
|
|
43
|
+
[quidproquo_core_1.EventActionType.GetRecords]: getProcessGetRecords(qpqConfig),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventGetStorySessionActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, import("quidproquo-webserver").EmailSendEvent>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const getProcessGetStorySession = (qpqConfig) => {
|
|
14
|
+
return ({ qpqEventRecord, eventParams }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.default = (qpqConfig) => {
|
|
19
|
+
return {
|
|
20
|
+
[quidproquo_core_1.EventActionType.GetStorySession]: getProcessGetStorySession(qpqConfig),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
2
|
+
export declare const getcognitoCustomMessageEventProcessor: (qpqConfig: QPQConfig) => {
|
|
3
|
+
"@quidproquo-core/event/TransformResponseResult": import("quidproquo-core").EventTransformResponseResultActionProcessor<import("./types").EventInput, import("quidproquo-webserver").EmailSendEventResponse, import("aws-lambda").CustomMessageTriggerEvent>;
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": import("quidproquo-core").EventAutoRespondActionProcessor<import("quidproquo-webserver").EmailSendEvent, import("./types").MatchResult, import("quidproquo-webserver").EmailSendEventResponse>;
|
|
5
|
+
"@quidproquo-core/event/MatchStory": import("quidproquo-core").EventMatchStoryActionProcessor<import("quidproquo-webserver").EmailSendEvent, import("./types").MatchResult>;
|
|
6
|
+
"@quidproquo-core/Event/GetRecords": import("quidproquo-core").EventGetRecordsActionProcessor<import("./types").EventInput, import("quidproquo-webserver").EmailSendEvent>;
|
|
7
|
+
"@quidproquo-core/event/GetStorySession": import("quidproquo-core").EventGetStorySessionActionProcessor<import("./types").EventInput, import("quidproquo-webserver").EmailSendEvent>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getcognitoCustomMessageEventProcessor = void 0;
|
|
7
|
+
const autoRespond_1 = __importDefault(require("./autoRespond"));
|
|
8
|
+
const getRecords_1 = __importDefault(require("./getRecords"));
|
|
9
|
+
const matchStory_1 = __importDefault(require("./matchStory"));
|
|
10
|
+
const transformResponseResult_1 = __importDefault(require("./transformResponseResult"));
|
|
11
|
+
const getStorySession_1 = __importDefault(require("./getStorySession"));
|
|
12
|
+
const getcognitoCustomMessageEventProcessor = (qpqConfig) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, getStorySession_1.default)(qpqConfig)), (0, getRecords_1.default)(qpqConfig)), (0, matchStory_1.default)(qpqConfig)), (0, autoRespond_1.default)(qpqConfig)), (0, transformResponseResult_1.default)(qpqConfig)));
|
|
13
|
+
exports.getcognitoCustomMessageEventProcessor = getcognitoCustomMessageEventProcessor;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventMatchStoryActionProcessor, QPQConfig } from 'quidproquo-core';
|
|
2
|
+
import { MatchResult } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<import("quidproquo-webserver").EmailSendEvent, MatchResult>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
14
|
+
// TODO: Don't use Globals like this
|
|
15
|
+
const GLOBAL_USER_DIRECTORY_NAME = process.env.userDirectoryName;
|
|
16
|
+
const getProcessMatchStory = (qpqConfig) => {
|
|
17
|
+
const userDirectoryConfig = quidproquo_core_1.qpqCoreUtils.getUserDirectories(qpqConfig).find((ud) => ud.name === GLOBAL_USER_DIRECTORY_NAME);
|
|
18
|
+
return ({ qpqEventRecord }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20
|
+
switch (qpqEventRecord.eventType) {
|
|
21
|
+
case quidproquo_webserver_1.EmailSendEventType.ResetPassword:
|
|
22
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
23
|
+
src: (_a = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _a === void 0 ? void 0 : _a.src,
|
|
24
|
+
runtime: (_b = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPassword) === null || _b === void 0 ? void 0 : _b.runtime,
|
|
25
|
+
});
|
|
26
|
+
case quidproquo_webserver_1.EmailSendEventType.ResetPasswordAdmin:
|
|
27
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
28
|
+
src: (_c = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _c === void 0 ? void 0 : _c.src,
|
|
29
|
+
runtime: (_d = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.resetPasswordAdmin) === null || _d === void 0 ? void 0 : _d.runtime,
|
|
30
|
+
});
|
|
31
|
+
case quidproquo_webserver_1.EmailSendEventType.VerifyEmail:
|
|
32
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
33
|
+
src: (_e = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _e === void 0 ? void 0 : _e.src,
|
|
34
|
+
runtime: (_f = userDirectoryConfig === null || userDirectoryConfig === void 0 ? void 0 : userDirectoryConfig.emailTemplates.verifyEmail) === null || _f === void 0 ? void 0 : _f.runtime,
|
|
35
|
+
});
|
|
36
|
+
default:
|
|
37
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Email lambda not implemented for ${qpqEventRecord.eventType}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.default = (qpqConfig) => {
|
|
42
|
+
return {
|
|
43
|
+
[quidproquo_core_1.EventActionType.MatchStory]: getProcessMatchStory(qpqConfig),
|
|
44
|
+
};
|
|
45
|
+
};
|
package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/transformResponseResult.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventTransformResponseResultActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<EventInput, import("quidproquo-webserver").EmailSendEventResponse, import("aws-lambda").CustomMessageTriggerEvent>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
package/lib/commonjs/getActionProcessor/core/event/cognitoCustomMessage/transformResponseResult.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const getProcessTransformResponseResult = (qpqConfig) => {
|
|
14
|
+
// We might need to JSON.stringify the body.
|
|
15
|
+
return ({ eventParams, qpqEventRecordResponses }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const [customMessageTriggerEvent] = eventParams;
|
|
17
|
+
const [emailSendEventResponse] = qpqEventRecordResponses;
|
|
18
|
+
if (emailSendEventResponse.success) {
|
|
19
|
+
const updatedEvent = Object.assign(Object.assign({}, customMessageTriggerEvent), { response: Object.assign(Object.assign({}, customMessageTriggerEvent.response), { emailMessage: emailSendEventResponse.result.body, emailSubject: emailSendEventResponse.result.subject }) });
|
|
20
|
+
return (0, quidproquo_core_1.actionResult)(updatedEvent);
|
|
21
|
+
}
|
|
22
|
+
// Just let cognito handle the event
|
|
23
|
+
return (0, quidproquo_core_1.actionResult)(customMessageTriggerEvent);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.default = (qpqConfig) => {
|
|
27
|
+
return {
|
|
28
|
+
[quidproquo_core_1.EventActionType.TransformResponseResult]: getProcessTransformResponseResult(qpqConfig),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EmailSendEvent, EmailSendEventResponse } from 'quidproquo-webserver';
|
|
2
|
+
import { CustomMessageTriggerEvent, Context } from 'aws-lambda';
|
|
3
|
+
import { MatchStoryResult } from 'quidproquo-core';
|
|
4
|
+
export declare const GLOBAL_USER_DIRECTORY_NAME: string;
|
|
5
|
+
export type EventInput = [CustomMessageTriggerEvent, Context];
|
|
6
|
+
export type EventOutput = CustomMessageTriggerEvent;
|
|
7
|
+
export type InternalEventRecord = EmailSendEvent;
|
|
8
|
+
export type InternalEventOutput = EmailSendEventResponse;
|
|
9
|
+
export type MatchResult = MatchStoryResult<any, any>;
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventAutoRespondActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { MatchResult } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<import("quidproquo-core").DeployEvent, MatchResult, void>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const getProcessAutoRespond = (qpqConfig) => {
|
|
14
|
+
return ({ qpqEventRecord, matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
// exit if we don't know what deploy type this is, probably another stack
|
|
16
|
+
const earlyExit = qpqEventRecord.deployEventType === quidproquo_core_1.DeployEventType.Unknown || qpqEventRecord.deployEventStatusType === quidproquo_core_1.DeployEventStatusType.Unknown;
|
|
17
|
+
// THIS IS A HACK... We need to support early exit on void responses...
|
|
18
|
+
// Maybe void reponses should just be "completed successfully"... then we can early exit as it has completed successfully
|
|
19
|
+
return (0, quidproquo_core_1.actionResult)(earlyExit);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.default = (qpqConfig) => {
|
|
23
|
+
return {
|
|
24
|
+
[quidproquo_core_1.EventActionType.AutoRespond]: getProcessAutoRespond(qpqConfig),
|
|
25
|
+
};
|
|
26
|
+
};
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/getRecords.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventGetRecordsActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/Event/GetRecords": EventGetRecordsActionProcessor<EventInput, import("quidproquo-core").DeployEvent>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
+
const awsNamingUtils_1 = require("../../../../../awsNamingUtils");
|
|
14
|
+
const deployTypeMap = {
|
|
15
|
+
UPDATE_COMPLETE: quidproquo_core_1.DeployEventStatusType.Update,
|
|
16
|
+
CREATE_COMPLETE: quidproquo_core_1.DeployEventStatusType.Create,
|
|
17
|
+
DELETE_COMPLETE: quidproquo_core_1.DeployEventStatusType.Delete,
|
|
18
|
+
};
|
|
19
|
+
const getProcessGetRecords = (qpqConfig) => {
|
|
20
|
+
return ({ eventParams: [eventBridgeEvent, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const status = eventBridgeEvent.detail['status-details'].status || '';
|
|
22
|
+
const stackId = eventBridgeEvent.detail['stack-id'];
|
|
23
|
+
const regex = /:stack\/([^\/]+)/;
|
|
24
|
+
const match = stackId.match(regex);
|
|
25
|
+
const stackName = match && match[1] ? match[1] : '';
|
|
26
|
+
const internalEventRecord = {
|
|
27
|
+
deployEventType: quidproquo_core_1.DeployEventType.Unknown,
|
|
28
|
+
deployEventStatusType: deployTypeMap[status] || quidproquo_core_1.DeployEventStatusType.Unknown,
|
|
29
|
+
};
|
|
30
|
+
if (stackName === (0, awsNamingUtils_1.getApiStackName)(qpqConfig)) {
|
|
31
|
+
internalEventRecord.deployEventType = quidproquo_core_1.DeployEventType.Api;
|
|
32
|
+
}
|
|
33
|
+
else if (stackName === (0, awsNamingUtils_1.getWebStackName)(qpqConfig)) {
|
|
34
|
+
internalEventRecord.deployEventType = quidproquo_core_1.DeployEventType.Web;
|
|
35
|
+
}
|
|
36
|
+
console.log('internalEventRecord', internalEventRecord);
|
|
37
|
+
return (0, quidproquo_core_1.actionResult)([internalEventRecord]);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.default = (qpqConfig) => {
|
|
41
|
+
return {
|
|
42
|
+
[quidproquo_core_1.EventActionType.GetRecords]: getProcessGetRecords(qpqConfig),
|
|
43
|
+
};
|
|
44
|
+
};
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/getStorySession.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QPQConfig, EventGetStorySessionActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { EventInput } from './types';
|
|
3
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
+
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, import("quidproquo-core").DeployEvent>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|