typed-serverless
Version:
Helps you write a consistent Serverless Framework configuration in TypeScript
28 lines (27 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultTypedServerlessParams = exports.defaultResourceParamsFactory = void 0;
const serverless_1 = require("../utils/serverless");
function defaultResourceParamsFactory(id, config) {
return {
// resourceParamsFactory function will be invoked BEFORE each resource created with
// typed.resources('id', (Params) => SQS.Queue({ Name: Params.name }))
// where Params will be the result of the following function execution:
name: `${config.service}-${(0, serverless_1.getServerlessStage)()}-${id}`,
// Pass tags to all resources
tags: config.provider.tags,
// Transform tags {key: value}, to Array<{Key: string, Value: string}>
awsTags: config.provider.tags &&
Object.entries(config.provider.tags).map((it) => ({
Key: it[0],
Value: it[1],
})),
};
}
exports.defaultResourceParamsFactory = defaultResourceParamsFactory;
function defaultTypedServerlessParams() {
return {
resourceParamsFactory: defaultResourceParamsFactory,
};
}
exports.defaultTypedServerlessParams = defaultTypedServerlessParams;