quidproquo-actionprocessor-awslambda 0.0.19 → 0.0.21
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/getActionProcessor/core/config/getConfigGetSecretActionProcessor.js +5 -3
- package/lib/runtimeConfig/QPQAWSLambdaConfig.d.ts +3 -0
- package/lib/runtimeConfig/qpqAwsLambdaRuntimeConfigUtils.d.ts +1 -0
- package/lib/runtimeConfig/qpqAwsLambdaRuntimeConfigUtils.js +5 -1
- package/package.json +1 -1
|
@@ -10,15 +10,17 @@ 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 qpqAwsLambdaRuntimeConfigUtils_1 = require("../../../runtimeConfig/qpqAwsLambdaRuntimeConfigUtils");
|
|
13
14
|
const getSecret_1 = require("../../../logic/secretsManager/getSecret");
|
|
14
|
-
const getProcessConfigActionType = () => {
|
|
15
|
+
const getProcessConfigActionType = (runtimeConfig) => {
|
|
15
16
|
return ({ secretName }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const
|
|
17
|
+
const awsSecretKey = (0, qpqAwsLambdaRuntimeConfigUtils_1.resolveSecretKey)(secretName, runtimeConfig);
|
|
18
|
+
const secretValue = yield (0, getSecret_1.getSecret)(awsSecretKey);
|
|
17
19
|
return (0, quidproquo_core_1.actionResult)(secretValue);
|
|
18
20
|
});
|
|
19
21
|
};
|
|
20
22
|
exports.default = (runtimeConfig) => {
|
|
21
23
|
return {
|
|
22
|
-
[quidproquo_core_1.ConfigActionType.GetSecret]: getProcessConfigActionType(),
|
|
24
|
+
[quidproquo_core_1.ConfigActionType.GetSecret]: getProcessConfigActionType(runtimeConfig),
|
|
23
25
|
};
|
|
24
26
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { QPQConfig } from 'quidproquo-core';
|
|
1
2
|
export interface LambdaRuntimeConfig {
|
|
2
3
|
src: string;
|
|
3
4
|
runtime: string;
|
|
4
5
|
}
|
|
5
6
|
export interface QPQAWSLambdaConfig {
|
|
7
|
+
qpqConfig: QPQConfig;
|
|
6
8
|
resourceNameMap: Record<string, string>;
|
|
9
|
+
secretNameMap: Record<string, string>;
|
|
7
10
|
lambdaRuntimeConfig?: LambdaRuntimeConfig;
|
|
8
11
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { QPQAWSLambdaConfig } from './QPQAWSLambdaConfig';
|
|
2
2
|
export declare const resolveResourceName: (resourceName: string, qpqAwsLambdaConfig: QPQAWSLambdaConfig) => string;
|
|
3
|
+
export declare const resolveSecretKey: (secretName: string, qpqAwsLambdaConfig: QPQAWSLambdaConfig) => string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveResourceName = void 0;
|
|
3
|
+
exports.resolveSecretKey = exports.resolveResourceName = void 0;
|
|
4
4
|
const resolveResourceName = (resourceName, qpqAwsLambdaConfig) => {
|
|
5
5
|
return qpqAwsLambdaConfig.resourceNameMap[resourceName] || resourceName;
|
|
6
6
|
};
|
|
7
7
|
exports.resolveResourceName = resolveResourceName;
|
|
8
|
+
const resolveSecretKey = (secretName, qpqAwsLambdaConfig) => {
|
|
9
|
+
return qpqAwsLambdaConfig.secretNameMap[secretName] || secretName;
|
|
10
|
+
};
|
|
11
|
+
exports.resolveSecretKey = resolveSecretKey;
|