quidproquo-actionprocessor-awslambda 0.0.137 → 0.0.139
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/getS3FileEventActionProcessor.d.ts +12 -0
- package/lib/commonjs/getActionProcessor/core/event/getS3FileEventActionProcessor.js +53 -0
- package/lib/commonjs/getActionProcessor/core/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/index.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QPQConfig, MatchStoryResult, EventMatchStoryActionProcessor, EventTransformEventParamsActionProcessor, EventTransformResponseResultActionProcessor, EventAutoRespondActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { StorageDriveEvent } from 'quidproquo-webserver';
|
|
3
|
+
import { S3Event, Context } from 'aws-lambda';
|
|
4
|
+
type EventInput = [S3Event, Context];
|
|
5
|
+
type MatchResult = MatchStoryResult<any, any>;
|
|
6
|
+
declare const _default: (qpqConfig: QPQConfig) => {
|
|
7
|
+
"@quidproquo-core/event/TransformEventParams": EventTransformEventParamsActionProcessor<EventInput, StorageDriveEvent>;
|
|
8
|
+
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<void, StorageDriveEvent, void>;
|
|
9
|
+
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<StorageDriveEvent, MatchResult, boolean>;
|
|
10
|
+
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<StorageDriveEvent, MatchResult>;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
console.log(process.env.storageDriveCreateEntry);
|
|
16
|
+
const GLOBAL_STORAGE_DRIVE_NAME = process.env.storageDriveName;
|
|
17
|
+
const GLOBAL_STORAGE_DRIVE_RUNTIME = JSON.parse(process.env.storageDriveCreateEntry || "{}");
|
|
18
|
+
const getProcessTransformEventParams = () => {
|
|
19
|
+
return ({ eventParams: [s3Event, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const transformedEventParams = {
|
|
21
|
+
driveName: GLOBAL_STORAGE_DRIVE_NAME,
|
|
22
|
+
filePaths: s3Event.Records.map(r => decodeURIComponent(r.s3.object.key)),
|
|
23
|
+
eventType: quidproquo_webserver_1.StorageDriveEventType.Create,
|
|
24
|
+
};
|
|
25
|
+
return (0, quidproquo_core_1.actionResult)(transformedEventParams);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const getProcessTransformResponseResult = (qpqConfig) => {
|
|
29
|
+
// We might need to JSON.stringify the body.
|
|
30
|
+
return (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
// always success
|
|
32
|
+
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const getProcessAutoRespond = (qpqConfig) => {
|
|
36
|
+
return (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
// always allow
|
|
38
|
+
return (0, quidproquo_core_1.actionResult)(false);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const getProcessMatchStory = (qpqConfig) => {
|
|
42
|
+
return () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
return (0, quidproquo_core_1.actionResult)(GLOBAL_STORAGE_DRIVE_RUNTIME);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.default = (qpqConfig) => {
|
|
47
|
+
return {
|
|
48
|
+
[quidproquo_core_1.EventActionType.TransformEventParams]: getProcessTransformEventParams(),
|
|
49
|
+
[quidproquo_core_1.EventActionType.TransformResponseResult]: getProcessTransformResponseResult(qpqConfig),
|
|
50
|
+
[quidproquo_core_1.EventActionType.AutoRespond]: getProcessAutoRespond(qpqConfig),
|
|
51
|
+
[quidproquo_core_1.EventActionType.MatchStory]: getProcessMatchStory(qpqConfig),
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -11,6 +11,7 @@ export { default as getEventBridgeEventStackDeployActionProcessor } from './even
|
|
|
11
11
|
export { default as getEventBridgeEventActionProcessor } from './event/getEventBridgeEventActionProcessor';
|
|
12
12
|
export { default as getLambdaCognitoCustomMessage } from './event/getLambdaCognitoCustomMessage';
|
|
13
13
|
export { default as getWebsocketAPIGatewayEventActionProcessor } from './event/getWebsocketAPIGatewayEventActionProcessor';
|
|
14
|
+
export { default as getS3FileEventActionProcessor } from './event/getS3FileEventActionProcessor';
|
|
14
15
|
export { default as getSystemActionProcessor } from './system';
|
|
15
16
|
export { default as getFileActionProcessor } from './file';
|
|
16
17
|
export { default as getKeyValueStoreActionProcessor } from './keyValueStore';
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getEventBusActionProcessor = exports.getUserDirectoryActionProcessor = exports.getQueueActionProcessor = exports.getKeyValueStoreActionProcessor = exports.getFileActionProcessor = exports.getSystemActionProcessor = exports.getWebsocketAPIGatewayEventActionProcessor = exports.getLambdaCognitoCustomMessage = exports.getEventBridgeEventActionProcessor = exports.getEventBridgeEventStackDeployActionProcessor = exports.getServiceFunctionExecuteEventActionProcessor = exports.getSQSEventRecordActionProcessor = exports.getCloudFrontOriginRequestEventActionProcessor = exports.getAPIGatewayEventActionProcessor = exports.getConfigSetParameterActionProcessor = exports.getConfigGetGlobalActionProcessor = exports.getConfigGetParametersActionProcessor = exports.getConfigGetParameterActionProcessor = exports.getConfigGetSecretActionProcessor = void 0;
|
|
6
|
+
exports.getEventBusActionProcessor = exports.getUserDirectoryActionProcessor = exports.getQueueActionProcessor = exports.getKeyValueStoreActionProcessor = exports.getFileActionProcessor = exports.getSystemActionProcessor = exports.getS3FileEventActionProcessor = exports.getWebsocketAPIGatewayEventActionProcessor = exports.getLambdaCognitoCustomMessage = exports.getEventBridgeEventActionProcessor = exports.getEventBridgeEventStackDeployActionProcessor = exports.getServiceFunctionExecuteEventActionProcessor = exports.getSQSEventRecordActionProcessor = exports.getCloudFrontOriginRequestEventActionProcessor = exports.getAPIGatewayEventActionProcessor = exports.getConfigSetParameterActionProcessor = exports.getConfigGetGlobalActionProcessor = exports.getConfigGetParametersActionProcessor = exports.getConfigGetParameterActionProcessor = exports.getConfigGetSecretActionProcessor = void 0;
|
|
7
7
|
var getConfigGetSecretActionProcessor_1 = require("./config/getConfigGetSecretActionProcessor");
|
|
8
8
|
Object.defineProperty(exports, "getConfigGetSecretActionProcessor", { enumerable: true, get: function () { return __importDefault(getConfigGetSecretActionProcessor_1).default; } });
|
|
9
9
|
var getConfigGetParameterActionProcessor_1 = require("./config/getConfigGetParameterActionProcessor");
|
|
@@ -30,6 +30,8 @@ var getLambdaCognitoCustomMessage_1 = require("./event/getLambdaCognitoCustomMes
|
|
|
30
30
|
Object.defineProperty(exports, "getLambdaCognitoCustomMessage", { enumerable: true, get: function () { return __importDefault(getLambdaCognitoCustomMessage_1).default; } });
|
|
31
31
|
var getWebsocketAPIGatewayEventActionProcessor_1 = require("./event/getWebsocketAPIGatewayEventActionProcessor");
|
|
32
32
|
Object.defineProperty(exports, "getWebsocketAPIGatewayEventActionProcessor", { enumerable: true, get: function () { return __importDefault(getWebsocketAPIGatewayEventActionProcessor_1).default; } });
|
|
33
|
+
var getS3FileEventActionProcessor_1 = require("./event/getS3FileEventActionProcessor");
|
|
34
|
+
Object.defineProperty(exports, "getS3FileEventActionProcessor", { enumerable: true, get: function () { return __importDefault(getS3FileEventActionProcessor_1).default; } });
|
|
33
35
|
var system_1 = require("./system");
|
|
34
36
|
Object.defineProperty(exports, "getSystemActionProcessor", { enumerable: true, get: function () { return __importDefault(system_1).default; } });
|
|
35
37
|
var file_1 = require("./file");
|