quidproquo-actionprocessor-awslambda 0.0.53 → 0.0.55
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/awsNamingUtils.js +7 -5
- package/lib/getActionProcessor/core/config/getConfigGetParameterActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/config/getConfigGetParametersActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/config/getConfigGetSecretActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/event/getAPIGatewayEventActionProcessor.js +4 -4
- package/lib/getActionProcessor/core/file/getFileDeleteActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/file/getFileExistsActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/file/getFileListDirectoryActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/file/getFileReadBinaryContentsActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/file/getFileReadTextContentsActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/file/getFileWriteBinaryContentsActionProcessor.js +1 -1
- package/lib/getActionProcessor/core/file/getFileWriteTextContentsActionProcessor.js +1 -1
- package/package.json +1 -1
package/lib/awsNamingUtils.js
CHANGED
|
@@ -3,13 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getQpqRuntimeResourceName = exports.getConfigRuntimeResourceName = void 0;
|
|
4
4
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
5
|
const getConfigRuntimeResourceName = (resourceName, qpqConfig, resourceType = '') => {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const application = quidproquo_core_1.qpqCoreUtils.getApplicationName(qpqConfig);
|
|
7
|
+
const service = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
8
|
+
const environment = quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
9
|
+
const feature = quidproquo_core_1.qpqCoreUtils.getApplicationModuleFeature(qpqConfig);
|
|
10
|
+
const baseName = `${resourceName}-${application}-${service}-${environment}`;
|
|
9
11
|
if (feature) {
|
|
10
|
-
return `${
|
|
12
|
+
return `${baseName}-${feature}`;
|
|
11
13
|
}
|
|
12
|
-
return
|
|
14
|
+
return baseName;
|
|
13
15
|
};
|
|
14
16
|
exports.getConfigRuntimeResourceName = getConfigRuntimeResourceName;
|
|
15
17
|
const getQpqRuntimeResourceName = (resourceName, qpqConfig, resourceType = '') => {
|
|
@@ -15,7 +15,7 @@ const getParameter_1 = require("../../../logic/parametersManager/getParameter");
|
|
|
15
15
|
const getProcessConfigGetParameter = (qpqConfig) => {
|
|
16
16
|
return ({ parameterName }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const awsParameterKey = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveParameterKey)(parameterName, qpqConfig);
|
|
18
|
-
const parameterValue = yield (0, getParameter_1.getParameter)(awsParameterKey, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
const parameterValue = yield (0, getParameter_1.getParameter)(awsParameterKey, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig));
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)(parameterValue);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -15,7 +15,7 @@ const getParameters_1 = require("../../../logic/parametersManager/getParameters"
|
|
|
15
15
|
const getProcessConfigGetParameters = (qpqConfig) => {
|
|
16
16
|
return ({ parameterNames }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const awsParameterKeys = parameterNames.map((pn) => (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveParameterKey)(pn, qpqConfig));
|
|
18
|
-
const parameterValues = yield (0, getParameters_1.getParameters)(awsParameterKeys, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
const parameterValues = yield (0, getParameters_1.getParameters)(awsParameterKeys, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig));
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)(parameterValues);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -15,7 +15,7 @@ const getSecret_1 = require("../../../logic/secretsManager/getSecret");
|
|
|
15
15
|
const getProcessConfigActionType = (qpqConfig) => {
|
|
16
16
|
return ({ secretName }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const awsSecretKey = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveSecretKey)(secretName, qpqConfig);
|
|
18
|
-
const secretValue = yield (0, getSecret_1.getSecret)(awsSecretKey, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
const secretValue = yield (0, getSecret_1.getSecret)(awsSecretKey, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig));
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)(secretValue);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
13
|
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
14
14
|
const awsLambdaUtils_1 = require("../../../awsLambdaUtils");
|
|
15
|
-
const getProcessTransformEventParams = (
|
|
15
|
+
const getProcessTransformEventParams = (serviceName) => {
|
|
16
16
|
return ({ eventParams: [apiGatewayEvent, context] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const path = (apiGatewayEvent.path || '').replace(new RegExp(`^(\/${
|
|
17
|
+
const path = (apiGatewayEvent.path || '').replace(new RegExp(`^(\/${serviceName})/`), '/');
|
|
18
18
|
return (0, quidproquo_core_1.actionResult)({
|
|
19
19
|
path,
|
|
20
20
|
query: Object.assign(Object.assign({}, (apiGatewayEvent.multiValueQueryStringParameters || {})), (apiGatewayEvent.queryStringParameters || {})),
|
|
@@ -84,9 +84,9 @@ const getProcessMatchStory = (routes) => {
|
|
|
84
84
|
};
|
|
85
85
|
exports.default = (config) => {
|
|
86
86
|
const routes = quidproquo_webserver_1.qpqWebServerUtils.getAllRoutes(config);
|
|
87
|
-
const
|
|
87
|
+
const serviceName = quidproquo_core_1.qpqCoreUtils.getApplicationModuleName(config);
|
|
88
88
|
return {
|
|
89
|
-
[quidproquo_core_1.EventActionType.TransformEventParams]: getProcessTransformEventParams(
|
|
89
|
+
[quidproquo_core_1.EventActionType.TransformEventParams]: getProcessTransformEventParams(serviceName),
|
|
90
90
|
[quidproquo_core_1.EventActionType.TransformResponseResult]: getProcessTransformResponseResult(config),
|
|
91
91
|
[quidproquo_core_1.EventActionType.AutoRespond]: getProcessAutoRespond(config),
|
|
92
92
|
[quidproquo_core_1.EventActionType.MatchStory]: getProcessMatchStory(routes),
|
|
@@ -16,7 +16,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
16
16
|
const getProcessFileDelete = (qpqConfig) => {
|
|
17
17
|
return ({ drive, filepaths }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
19
|
-
const errored = yield (0, s3Utils_1.deleteFiles)(s3BucketName, filepaths, quidproquo_core_1.qpqCoreUtils.
|
|
19
|
+
const errored = yield (0, s3Utils_1.deleteFiles)(s3BucketName, filepaths, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig));
|
|
20
20
|
// errored deletes are a graceful success ~ Retry
|
|
21
21
|
// if (errored.length > 0) {
|
|
22
22
|
// return actionResultError(
|
|
@@ -15,7 +15,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
15
15
|
const getProcessFileExists = (qpqConfig) => {
|
|
16
16
|
return ({ drive, filepath }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
18
|
-
return (0, quidproquo_core_1.actionResult)(yield (0, s3Utils_1.objectExists)(s3BucketName, filepath, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
return (0, quidproquo_core_1.actionResult)(yield (0, s3Utils_1.objectExists)(s3BucketName, filepath, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig)));
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
exports.default = (qpqConfig) => ({
|
|
@@ -15,7 +15,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
15
15
|
const getProcessFileListDirectory = (qpqConfig) => {
|
|
16
16
|
return ({ drive, folderPath, maxFiles, pageToken }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
18
|
-
const s3FileList = yield (0, s3Utils_1.listFiles)(s3BucketName, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
const s3FileList = yield (0, s3Utils_1.listFiles)(s3BucketName, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig), folderPath, maxFiles, pageToken);
|
|
19
19
|
// Add the drive onto the list
|
|
20
20
|
const fileInfos = s3FileList.fileInfos.map((s3fi) => (Object.assign(Object.assign({}, s3fi), { drive: drive })));
|
|
21
21
|
return (0, quidproquo_core_1.actionResult)({
|
|
@@ -15,7 +15,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
15
15
|
const getProcessFileReadBinaryContents = (qpqConfig) => {
|
|
16
16
|
return ({ drive, filepath }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
18
|
-
return (0, quidproquo_core_1.actionResult)(yield (0, s3Utils_1.readBinaryFile)(s3BucketName, filepath, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
return (0, quidproquo_core_1.actionResult)(yield (0, s3Utils_1.readBinaryFile)(s3BucketName, filepath, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig)));
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
exports.default = (qpqConfig) => ({
|
|
@@ -15,7 +15,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
15
15
|
const getProcessFileReadTextContents = (qpqConfig) => {
|
|
16
16
|
return ({ drive, filepath }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
18
|
-
return (0, quidproquo_core_1.actionResult)(yield (0, s3Utils_1.readTextFile)(s3BucketName, filepath, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
return (0, quidproquo_core_1.actionResult)(yield (0, s3Utils_1.readTextFile)(s3BucketName, filepath, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig)));
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
exports.default = (qpqConfig) => ({
|
|
@@ -15,7 +15,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
15
15
|
const getProcessFileWriteBinaryContents = (qpqConfig) => {
|
|
16
16
|
return ({ drive, filepath, data }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
18
|
-
yield (0, s3Utils_1.writeBinaryFile)(s3BucketName, filepath, data, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
yield (0, s3Utils_1.writeBinaryFile)(s3BucketName, filepath, data, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig));
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -15,7 +15,7 @@ const s3Utils_1 = require("../../../logic/s3/s3Utils");
|
|
|
15
15
|
const getProcessFileWriteTextContents = (qpqConfig) => {
|
|
16
16
|
return ({ drive, filepath, data }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const s3BucketName = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveResourceName)(drive, qpqConfig);
|
|
18
|
-
yield (0, s3Utils_1.writeTextFile)(s3BucketName, filepath, data, quidproquo_core_1.qpqCoreUtils.
|
|
18
|
+
yield (0, s3Utils_1.writeTextFile)(s3BucketName, filepath, data, quidproquo_core_1.qpqCoreUtils.getApplicationModuleDeployRegion(qpqConfig));
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
20
20
|
});
|
|
21
21
|
};
|