@goldstack/template-lambda-api 0.4.41 → 0.4.42
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/dist/src/templateLambdaApi.d.ts +0 -1
- package/dist/src/templateLambdaApi.d.ts.map +1 -1
- package/dist/src/templateLambdaApi.js +0 -71
- package/dist/src/templateLambdaApi.js.map +1 -1
- package/package.json +2 -21
- package/bin/template +0 -12
- package/bin/template.ts +0 -6
- package/dist/src/generateLambdaConfig.d.ts +0 -5
- package/dist/src/generateLambdaConfig.d.ts.map +0 -1
- package/dist/src/generateLambdaConfig.js +0 -28
- package/dist/src/generateLambdaConfig.js.map +0 -1
- package/dist/src/generateLambdaConfig.spec.d.ts +0 -2
- package/dist/src/generateLambdaConfig.spec.d.ts.map +0 -1
- package/dist/src/generateLambdaConfig.spec.js +0 -72
- package/dist/src/generateLambdaConfig.spec.js.map +0 -1
- package/dist/src/templateLambdaApiBuild.d.ts +0 -9
- package/dist/src/templateLambdaApiBuild.d.ts.map +0 -1
- package/dist/src/templateLambdaApiBuild.js +0 -50
- package/dist/src/templateLambdaApiBuild.js.map +0 -1
- package/dist/src/templateLambdaApiBuild.spec.d.ts +0 -2
- package/dist/src/templateLambdaApiBuild.spec.d.ts.map +0 -1
- package/dist/src/templateLambdaApiBuild.spec.js +0 -50
- package/dist/src/templateLambdaApiBuild.spec.js.map +0 -1
- package/dist/src/templateLambdaApiDeploy.d.ts +0 -10
- package/dist/src/templateLambdaApiDeploy.d.ts.map +0 -1
- package/dist/src/templateLambdaApiDeploy.js +0 -37
- package/dist/src/templateLambdaApiDeploy.js.map +0 -1
- package/dist/src/templateLambdaConsts.d.ts +0 -2
- package/dist/src/templateLambdaConsts.d.ts.map +0 -1
- package/dist/src/templateLambdaConsts.js +0 -5
- package/dist/src/templateLambdaConsts.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/jest.config.js +0 -12
- package/schemas/deployment-configuration.schema.json +0 -74
- package/schemas/deployment.schema.json +0 -176
- package/schemas/package-configuration.schema.json +0 -16
- package/schemas/package.schema.json +0 -244
- package/scripts/buildTestLambdas.ts +0 -23
- package/scripts/generateSchemas.ts +0 -3
- package/src/generateLambdaConfig.spec.ts +0 -97
- package/src/generateLambdaConfig.ts +0 -37
- package/src/templateLambdaApi.ts +0 -88
- package/src/templateLambdaApiBuild.spec.ts +0 -49
- package/src/templateLambdaApiBuild.ts +0 -72
- package/src/templateLambdaApiDeploy.ts +0 -54
- package/src/templateLambdaConsts.ts +0 -1
- package/src/types/LambdaApiPackage.ts +0 -90
- package/testData/build-test/customBuild.esbuild.config.json +0 -5
- package/testData/build-test/customBuild.ts +0 -10
- package/testData/build-test/index.ts +0 -12
- package/testData/routes-test/$default.ts +0 -0
- package/testData/routes-test/folder/nested.ts +0 -0
- package/testData/routes-test/folder/{pathparam}.ts +0 -0
- package/testData/routes-test/health/$index.ts +0 -0
- package/testData/routes-test/index.ts +0 -0
- package/testData/routes-test/resource/{path}/object.ts +0 -0
- package/testData/routes-test/resource.ts +0 -0
- package/tsconfig.generate.json +0 -12
- package/tsconfig.json +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApi.d.ts","sourceRoot":"","sources":["../../src/templateLambdaApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateLambdaApi.d.ts","sourceRoot":"","sources":["../../src/templateLambdaApi.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -13,77 +13,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.run = void 0;
|
|
21
|
-
const utils_package_1 = require("@goldstack/utils-package");
|
|
22
|
-
const utils_cli_1 = require("@goldstack/utils-cli");
|
|
23
|
-
const utils_terraform_1 = require("@goldstack/utils-terraform");
|
|
24
|
-
const templateLambdaApiDeploy_1 = require("./templateLambdaApiDeploy");
|
|
25
|
-
const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
|
|
26
|
-
const utils_package_config_1 = require("@goldstack/utils-package-config");
|
|
27
|
-
const utils_package_2 = require("@goldstack/utils-package");
|
|
28
17
|
__exportStar(require("./types/LambdaApiPackage"), exports);
|
|
29
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
30
|
-
const fs_1 = __importDefault(require("fs"));
|
|
31
|
-
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
32
|
-
const generateLambdaConfig_1 = require("./generateLambdaConfig");
|
|
33
|
-
const templateLambdaConsts_1 = require("./templateLambdaConsts");
|
|
34
|
-
const templateLambdaApiBuild_1 = require("./templateLambdaApiBuild");
|
|
35
|
-
const run = async (args) => {
|
|
36
|
-
await (0, utils_cli_1.wrapCli)(async () => {
|
|
37
|
-
const argv = (0, utils_package_1.buildCli)({
|
|
38
|
-
yargs: yargs_1.default,
|
|
39
|
-
deployCommands: (0, utils_package_1.buildDeployCommands)(),
|
|
40
|
-
infraCommands: (0, utils_terraform_1.infraCommands)(),
|
|
41
|
-
})
|
|
42
|
-
.command('build [deployment]', 'Build all lambdas', () => {
|
|
43
|
-
return yargs_1.default.positional('deployment', {
|
|
44
|
-
type: 'string',
|
|
45
|
-
describe: 'Name of the deployment this command should be applied to',
|
|
46
|
-
default: '',
|
|
47
|
-
});
|
|
48
|
-
})
|
|
49
|
-
.help().argv;
|
|
50
|
-
const packageConfig = new utils_package_config_1.PackageConfig({
|
|
51
|
-
packagePath: './',
|
|
52
|
-
});
|
|
53
|
-
const config = packageConfig.getConfig();
|
|
54
|
-
// update routes
|
|
55
|
-
if (!fs_1.default.existsSync('./src/routes')) {
|
|
56
|
-
throw new Error('Please specify lambda function handlers in ./src/routes so that API Gateway route configuration can be generated.');
|
|
57
|
-
}
|
|
58
|
-
const lambdaRoutes = (0, utils_aws_lambda_1.readLambdaConfig)(templateLambdaConsts_1.defaultRoutesPath);
|
|
59
|
-
config.deployments = config.deployments.map((e) => {
|
|
60
|
-
const lambdasConfigs = (0, generateLambdaConfig_1.generateLambdaConfig)(e, lambdaRoutes);
|
|
61
|
-
e.configuration.lambdas = lambdasConfigs;
|
|
62
|
-
(0, generateLambdaConfig_1.validateDeployment)(e.configuration.lambdas);
|
|
63
|
-
return e;
|
|
64
|
-
});
|
|
65
|
-
(0, utils_package_2.writePackageConfig)(config);
|
|
66
|
-
const command = argv._[0];
|
|
67
|
-
const [, , , ...opArgs] = args;
|
|
68
|
-
if (command === 'infra') {
|
|
69
|
-
await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (command === 'build') {
|
|
73
|
-
await (0, templateLambdaApiBuild_1.buildLambdas)({
|
|
74
|
-
routesDir: templateLambdaConsts_1.defaultRoutesPath,
|
|
75
|
-
configs: lambdaRoutes,
|
|
76
|
-
lambdaNamePrefix: packageConfig.getDeployment(opArgs[0]).configuration
|
|
77
|
-
.lambdaNamePrefix,
|
|
78
|
-
});
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (command === 'deploy') {
|
|
82
|
-
await (0, templateLambdaApiDeploy_1.deployCli)(packageConfig.getDeployment(opArgs[0]), lambdaRoutes);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
throw new Error('Unknown command: ' + command);
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
exports.run = run;
|
|
89
18
|
//# sourceMappingURL=templateLambdaApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApi.js","sourceRoot":"","sources":["../../src/templateLambdaApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateLambdaApi.js","sourceRoot":"","sources":["../../src/templateLambdaApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/template-lambda-api",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.42",
|
|
4
4
|
"description": "Companion for project templates for deploying Lambdas as a REST API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
"author": "Max Rohde",
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"main": "dist/src/templateLambdaApi.js",
|
|
27
|
-
"bin": {
|
|
28
|
-
"template": "./bin/template",
|
|
29
|
-
"template-lambda-express": "./bin/template"
|
|
30
|
-
},
|
|
31
27
|
"scripts": {
|
|
32
28
|
"build": "yarn clean && yarn compile",
|
|
33
29
|
"build:watch": "yarn clean && yarn compile-watch",
|
|
@@ -40,7 +36,6 @@
|
|
|
40
36
|
"generate-schema": "ts-node scripts/generateSchemas.ts && cp schemas/* ../../../templates/packages/serverless-api/schemas",
|
|
41
37
|
"prepublishOnly": "yarn run build",
|
|
42
38
|
"publish": "utils-git changed --exec \"yarn npm publish $@\"",
|
|
43
|
-
"test-build-lambdas": "ts-node scripts/buildTestLambdas.ts",
|
|
44
39
|
"test-ci": "jest --passWithNoTests --config=./jest.config.js --runInBand",
|
|
45
40
|
"version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\"",
|
|
46
41
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
@@ -48,23 +43,9 @@
|
|
|
48
43
|
"dependencies": {
|
|
49
44
|
"@goldstack/infra": "0.3.36",
|
|
50
45
|
"@goldstack/infra-aws": "0.3.44",
|
|
51
|
-
"@goldstack/utils-aws-lambda": "0.1.28",
|
|
52
|
-
"@goldstack/utils-cli": "0.2.13",
|
|
53
|
-
"@goldstack/utils-config": "0.3.33",
|
|
54
|
-
"@goldstack/utils-docker": "0.3.38",
|
|
55
|
-
"@goldstack/utils-log": "0.2.14",
|
|
56
46
|
"@goldstack/utils-package": "0.3.38",
|
|
57
|
-
"@goldstack/utils-package-config": "0.3.38",
|
|
58
|
-
"@goldstack/utils-s3-deployment": "0.3.55",
|
|
59
|
-
"@goldstack/utils-sh": "0.4.31",
|
|
60
|
-
"@goldstack/utils-template": "0.3.35",
|
|
61
47
|
"@goldstack/utils-terraform": "0.3.68",
|
|
62
|
-
"
|
|
63
|
-
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.1",
|
|
64
|
-
"archiver": "^5.3.1",
|
|
65
|
-
"esbuild": "^0.14.34",
|
|
66
|
-
"source-map-support": "^0.5.21",
|
|
67
|
-
"yargs": "^15.4.1"
|
|
48
|
+
"source-map-support": "^0.5.21"
|
|
68
49
|
},
|
|
69
50
|
"devDependencies": {
|
|
70
51
|
"@goldstack/utils-docs-cli": "0.3.11",
|
package/bin/template
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
-
require('source-map-support').install();
|
|
6
|
-
|
|
7
|
-
require('./../dist/src/templateLambdaApi')
|
|
8
|
-
.run(process.argv)
|
|
9
|
-
.catch((e) => {
|
|
10
|
-
console.log(e);
|
|
11
|
-
process.exit(1);
|
|
12
|
-
});
|
package/bin/template.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LambdaConfig } from '@goldstack/utils-aws-lambda';
|
|
2
|
-
import { LambdaRoutesConfig, LambdaApiDeployment } from './types/LambdaApiPackage';
|
|
3
|
-
export declare const generateLambdaConfig: (deployment: LambdaApiDeployment, config: LambdaConfig[]) => LambdaRoutesConfig;
|
|
4
|
-
export declare const validateDeployment: (config: LambdaRoutesConfig) => boolean;
|
|
5
|
-
//# sourceMappingURL=generateLambdaConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateLambdaConfig.d.ts","sourceRoot":"","sources":["../../src/generateLambdaConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAElC,eAAO,MAAM,oBAAoB,eACnB,mBAAmB,UACvB,YAAY,EAAE,KACrB,kBAeF,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,kBAAkB,KAAG,OAO/D,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateDeployment = exports.generateLambdaConfig = void 0;
|
|
4
|
-
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
5
|
-
const generateLambdaConfig = (deployment, config) => {
|
|
6
|
-
return config.reduce((last, curr) => {
|
|
7
|
-
let id = curr.route;
|
|
8
|
-
if (id === '$default') {
|
|
9
|
-
id = 'default';
|
|
10
|
-
}
|
|
11
|
-
last[`${id}`] = {
|
|
12
|
-
function_name: (0, utils_aws_lambda_1.generateFunctionName)(deployment.configuration.lambdaNamePrefix, curr),
|
|
13
|
-
route: curr.route,
|
|
14
|
-
};
|
|
15
|
-
return last;
|
|
16
|
-
}, {});
|
|
17
|
-
};
|
|
18
|
-
exports.generateLambdaConfig = generateLambdaConfig;
|
|
19
|
-
const validateDeployment = (config) => {
|
|
20
|
-
let valid = true;
|
|
21
|
-
for (const e of Object.entries(config)) {
|
|
22
|
-
valid = valid && e[0].length > 0;
|
|
23
|
-
valid = valid && !!e[1].function_name && e[1].function_name.length > 0;
|
|
24
|
-
}
|
|
25
|
-
return valid;
|
|
26
|
-
};
|
|
27
|
-
exports.validateDeployment = validateDeployment;
|
|
28
|
-
//# sourceMappingURL=generateLambdaConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateLambdaConfig.js","sourceRoot":"","sources":["../../src/generateLambdaConfig.ts"],"names":[],"mappings":";;;AAAA,kEAGqC;AAM9B,MAAM,oBAAoB,GAAG,CAClC,UAA+B,EAC/B,MAAsB,EACF,EAAE;IACtB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAClC,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACpB,IAAI,EAAE,KAAK,UAAU,EAAE;YACrB,EAAE,GAAG,SAAS,CAAC;SAChB;QACD,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;YACd,aAAa,EAAE,IAAA,uCAAoB,EACjC,UAAU,CAAC,aAAa,CAAC,gBAAgB,EACzC,IAAI,CACL;YACD,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B;AAEK,MAAM,kBAAkB,GAAG,CAAC,MAA0B,EAAW,EAAE;IACxE,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACtC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACjC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;KACxE;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateLambdaConfig.spec.d.ts","sourceRoot":"","sources":["../../src/generateLambdaConfig.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
7
|
-
const assert_1 = __importDefault(require("assert"));
|
|
8
|
-
const generateLambdaConfig_1 = require("./generateLambdaConfig");
|
|
9
|
-
const templateLambdaApiBuild_1 = require("./templateLambdaApiBuild");
|
|
10
|
-
const dummyDeployment = {
|
|
11
|
-
awsRegion: 'ap-east-1',
|
|
12
|
-
awsUser: 'dummy',
|
|
13
|
-
configuration: {
|
|
14
|
-
lambdaNamePrefix: 'test-lambdas',
|
|
15
|
-
apiDomain: 'domain',
|
|
16
|
-
hostedZoneDomain: 'domain',
|
|
17
|
-
lambdas: {},
|
|
18
|
-
},
|
|
19
|
-
name: 'test',
|
|
20
|
-
};
|
|
21
|
-
describe('Generate Lambda config', () => {
|
|
22
|
-
const routesConfig = (0, utils_aws_lambda_1.readLambdaConfig)('./testData/routes-test');
|
|
23
|
-
const config = (0, generateLambdaConfig_1.generateLambdaConfig)(dummyDeployment, routesConfig);
|
|
24
|
-
test('Should render config for Terraform', () => {
|
|
25
|
-
(0, assert_1.default)(config['default'].function_name);
|
|
26
|
-
(0, assert_1.default)(config['ANY /folder/nested'].function_name.indexOf(dummyDeployment.configuration.lambdaNamePrefix || 'fail') !== -1);
|
|
27
|
-
});
|
|
28
|
-
test('Should determine correct output dirs for dist', () => {
|
|
29
|
-
const nestedRoute = routesConfig.find((e) => e.path === '/folder/nested');
|
|
30
|
-
(0, assert_1.default)(nestedRoute);
|
|
31
|
-
const dir = (0, templateLambdaApiBuild_1.getOutDirForLambda)(nestedRoute);
|
|
32
|
-
(0, assert_1.default)(dir === './distLambda/folder/nested');
|
|
33
|
-
});
|
|
34
|
-
test('Should determine path parametmers for file names', () => {
|
|
35
|
-
const nestedRoute = routesConfig.find((e) => e.path === '/folder/{pathparam}');
|
|
36
|
-
(0, assert_1.default)(nestedRoute);
|
|
37
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)(dummyDeployment.configuration.lambdaNamePrefix, nestedRoute);
|
|
38
|
-
(0, assert_1.default)(functionName.indexOf('folder') !== -1);
|
|
39
|
-
(0, assert_1.default)(functionName.indexOf('{') === -1);
|
|
40
|
-
(0, assert_1.default)(functionName.indexOf('}') === -1);
|
|
41
|
-
});
|
|
42
|
-
test('Should determine path parametmers for folder names', () => {
|
|
43
|
-
const nestedRoute = routesConfig.find((e) => e.path === '/resource/{path}/object');
|
|
44
|
-
(0, assert_1.default)(nestedRoute);
|
|
45
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)(dummyDeployment.configuration.lambdaNamePrefix, nestedRoute);
|
|
46
|
-
(0, assert_1.default)(functionName.indexOf('object') !== -1);
|
|
47
|
-
(0, assert_1.default)(functionName.indexOf('resource') !== -1);
|
|
48
|
-
(0, assert_1.default)(functionName.indexOf('{') === -1);
|
|
49
|
-
(0, assert_1.default)(functionName.indexOf('}') === -1);
|
|
50
|
-
});
|
|
51
|
-
test('Should provide a correct path for a nested index file', () => {
|
|
52
|
-
const nestedRoute = routesConfig.find((e) => e.path === '/health');
|
|
53
|
-
(0, assert_1.default)(nestedRoute);
|
|
54
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)(dummyDeployment.configuration.lambdaNamePrefix, nestedRoute);
|
|
55
|
-
expect(functionName).toContain('health');
|
|
56
|
-
});
|
|
57
|
-
test('Should provide a correct path for a file in the API root', () => {
|
|
58
|
-
var _a;
|
|
59
|
-
const nestedRoute = routesConfig.find((e) => e.path === '/resource');
|
|
60
|
-
(0, assert_1.default)(nestedRoute);
|
|
61
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)(dummyDeployment.configuration.lambdaNamePrefix, nestedRoute);
|
|
62
|
-
(0, assert_1.default)(((_a = functionName.match(/resource/g)) === null || _a === void 0 ? void 0 : _a.length) === 1);
|
|
63
|
-
});
|
|
64
|
-
test('Should hash long names', () => {
|
|
65
|
-
const nestedRoute = routesConfig.find((e) => e.path === '/resource');
|
|
66
|
-
(0, assert_1.default)(nestedRoute);
|
|
67
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)('very_long_names_should_end_with_a_hash_and_never_be_longer_than_64_characters', nestedRoute);
|
|
68
|
-
expect(functionName.length <= 64).toBeTruthy();
|
|
69
|
-
expect(functionName.indexOf('characters') === -1).toBe(true);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=generateLambdaConfig.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateLambdaConfig.spec.js","sourceRoot":"","sources":["../../src/generateLambdaConfig.spec.ts"],"names":[],"mappings":";;;;;AAAA,kEAGqC;AACrC,oDAA4B;AAC5B,iEAA8D;AAE9D,qEAA8D;AAE9D,MAAM,eAAe,GAAwB;IAC3C,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE;QACb,gBAAgB,EAAE,cAAc;QAChC,SAAS,EAAE,QAAQ;QACnB,gBAAgB,EAAE,QAAQ;QAC1B,OAAO,EAAE,EAAE;KACZ;IACD,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,MAAM,YAAY,GAAG,IAAA,mCAAgB,EAAC,wBAAwB,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,IAAA,2CAAoB,EAAC,eAAe,EAAE,YAAY,CAAC,CAAC;IACnE,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAA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AC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QACrE,IAAA,gBAAM,EAAC,WAAW,CAAC,CAAC;QAEpB,MAAM,YAAY,GAAG,IAAA,uCAAoB,EACvC,eAAe,CAAC,aAAa,CAAC,gBAAgB,EAC9C,WAAW,CACZ,CAAC;QACF,IAAA,gBAAM,EAAC,CAAA,MAAA,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAE,MAAM,MAAK,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAClC,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QACrE,IAAA,gBAAM,EAAC,WAAW,CAAC,CAAC;QAEpB,MAAM,YAAY,GAAG,IAAA,uCAAoB,EACvC,+EAA+E,EAC/E,WAAW,CACZ,CAAC;QACF,MAAM,CAAC,YAAY,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC;QAC/C,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { LambdaConfig } from '@goldstack/utils-aws-lambda';
|
|
2
|
-
export declare const getOutDirForLambda: (config: LambdaConfig) => string;
|
|
3
|
-
export declare const getOutFileForLambda: (config: LambdaConfig) => string;
|
|
4
|
-
export declare const buildLambdas: ({ routesDir, configs, lambdaNamePrefix, }: {
|
|
5
|
-
routesDir: string;
|
|
6
|
-
configs: LambdaConfig[];
|
|
7
|
-
lambdaNamePrefix?: string | undefined;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
//# sourceMappingURL=templateLambdaApiBuild.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApiBuild.d.ts","sourceRoot":"","sources":["../../src/templateLambdaApiBuild.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EACb,MAAM,6BAA6B,CAAC;AAUrC,eAAO,MAAM,kBAAkB,WAAY,YAAY,KAAG,MAKzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,YAAY,KAAG,MAE1D,CAAC;AAEF,eAAO,MAAM,YAAY;eAKZ,MAAM;aACR,YAAY,EAAE;;MAErB,QAAQ,IAAI,CAqCf,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildLambdas = exports.getOutFileForLambda = exports.getOutDirForLambda = void 0;
|
|
4
|
-
const esbuild_1 = require("esbuild");
|
|
5
|
-
const esbuild_plugin_pnp_1 = require("@yarnpkg/esbuild-plugin-pnp");
|
|
6
|
-
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
7
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
8
|
-
const getOutDirForLambda = (config) => {
|
|
9
|
-
if (config.path === '$default') {
|
|
10
|
-
return `./distLambda/${config.path}`;
|
|
11
|
-
}
|
|
12
|
-
return `./distLambda${config.path}`;
|
|
13
|
-
};
|
|
14
|
-
exports.getOutDirForLambda = getOutDirForLambda;
|
|
15
|
-
const getOutFileForLambda = (config) => {
|
|
16
|
-
return `${(0, exports.getOutDirForLambda)(config)}/lambda.js`;
|
|
17
|
-
};
|
|
18
|
-
exports.getOutFileForLambda = getOutFileForLambda;
|
|
19
|
-
const buildLambdas = async ({ routesDir, configs, lambdaNamePrefix, }) => {
|
|
20
|
-
const esbuildConfig = (0, utils_sh_1.readToType)('./esbuild.config.json');
|
|
21
|
-
await (0, utils_sh_1.rmSafe)('./distLambda');
|
|
22
|
-
(0, utils_sh_1.mkdir)('-p', './distLambda/zips');
|
|
23
|
-
for await (const config of configs) {
|
|
24
|
-
(0, utils_sh_1.mkdir)('-p', (0, exports.getOutDirForLambda)(config));
|
|
25
|
-
const esbuildLocalPath = (0, utils_sh_1.changeExtension)(`${routesDir}/${config.relativeFilePath}`, '.esbuild.config.json');
|
|
26
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)(lambdaNamePrefix, config);
|
|
27
|
-
const localEsbuildConfig = (0, utils_sh_1.readToType)(esbuildLocalPath);
|
|
28
|
-
const res = await (0, esbuild_1.build)({
|
|
29
|
-
plugins: [(0, esbuild_plugin_pnp_1.pnpPlugin)()],
|
|
30
|
-
bundle: true,
|
|
31
|
-
entryPoints: [`${routesDir}/${config.relativeFilePath}`],
|
|
32
|
-
external: ['aws-sdk', 'mock-aws-s3', 'testcontainers'],
|
|
33
|
-
minify: true,
|
|
34
|
-
platform: 'node',
|
|
35
|
-
format: 'cjs',
|
|
36
|
-
target: 'node16.0',
|
|
37
|
-
sourcemap: true,
|
|
38
|
-
outfile: (0, exports.getOutFileForLambda)(config),
|
|
39
|
-
metafile: true,
|
|
40
|
-
...esbuildConfig,
|
|
41
|
-
...localEsbuildConfig,
|
|
42
|
-
});
|
|
43
|
-
if (!res.metafile) {
|
|
44
|
-
throw new Error(`Metafile for ${functionName} not defined.`);
|
|
45
|
-
}
|
|
46
|
-
(0, utils_sh_1.write)(JSON.stringify(res.metafile), `./distLambda/zips/${functionName}.meta.json`);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.buildLambdas = buildLambdas;
|
|
50
|
-
//# sourceMappingURL=templateLambdaApiBuild.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApiBuild.js","sourceRoot":"","sources":["../../src/templateLambdaApiBuild.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAC9C,oEAAwD;AACxD,kEAGqC;AACrC,kDAM6B;AAGtB,MAAM,kBAAkB,GAAG,CAAC,MAAoB,EAA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AAQ,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,gBAAgB,CAAC;YACtD,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAA,2BAAmB,EAAC,MAAM,CAAC;YACpC,QAAQ,EAAE,IAAI;YACd,GAAG,aAAa;YAChB,GAAG,kBAAkB;SACtB,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,gBAAgB,YAAY,eAAe,CAAC,CAAC;SAC9D;QACD,IAAA,gBAAK,EACH,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAC5B,qBAAqB,YAAY,YAAY,CAC9C,CAAC;KACH;AACH,CAAC,CAAC;AA7CW,QAAA,YAAY,gBA6CvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApiBuild.spec.d.ts","sourceRoot":"","sources":["../../src/templateLambdaApiBuild.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
7
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const templateLambdaApiBuild_1 = require("./templateLambdaApiBuild");
|
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
jest.setTimeout(30000);
|
|
12
|
-
describe('Testing lambda build', () => {
|
|
13
|
-
it('Should build lambda', async () => {
|
|
14
|
-
const fileToBuild = path_1.default.resolve('./testData/build-test/index.ts');
|
|
15
|
-
expect(fs_1.default.existsSync(fileToBuild)).toEqual(true);
|
|
16
|
-
await (0, templateLambdaApiBuild_1.buildLambdas)({
|
|
17
|
-
routesDir: './testData/build-test',
|
|
18
|
-
configs: [
|
|
19
|
-
{
|
|
20
|
-
path: '/index',
|
|
21
|
-
relativeFilePath: 'index.ts',
|
|
22
|
-
name: 'test-lambda-index',
|
|
23
|
-
absoluteFilePath: fileToBuild,
|
|
24
|
-
route: 'ANY /',
|
|
25
|
-
type: utils_aws_lambda_1.RouteType.FUNCTION,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
const generated = (0, utils_sh_1.read)('./distLambda/index/lambda.js');
|
|
30
|
-
expect(generated.length).toBeGreaterThan(100);
|
|
31
|
-
});
|
|
32
|
-
it('Should build lambda with custom esbuild config', async () => {
|
|
33
|
-
await (0, templateLambdaApiBuild_1.buildLambdas)({
|
|
34
|
-
routesDir: './testData/build-test',
|
|
35
|
-
configs: [
|
|
36
|
-
{
|
|
37
|
-
path: '/customBuild',
|
|
38
|
-
relativeFilePath: 'customBuild.ts',
|
|
39
|
-
name: 'test-lambda-customBuild',
|
|
40
|
-
absoluteFilePath: path_1.default.resolve('./testData/build-test/customBuild.ts'),
|
|
41
|
-
route: 'ANY /',
|
|
42
|
-
type: utils_aws_lambda_1.RouteType.FUNCTION,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
});
|
|
46
|
-
const generated = (0, utils_sh_1.read)('./distLambda/customBuild/lambda.js');
|
|
47
|
-
expect(generated).toContain('Custom config in operation');
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=templateLambdaApiBuild.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApiBuild.spec.js","sourceRoot":"","sources":["../../src/templateLambdaApiBuild.spec.ts"],"names":[],"mappings":";;;;;AAAA,kEAAwD;AACxD,kDAA2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AAC;QAC7D,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LambdaApiDeployment } from './types/LambdaApiPackage';
|
|
2
|
-
import { LambdaConfig } from '@goldstack/utils-aws-lambda';
|
|
3
|
-
interface DeployLambdaParams {
|
|
4
|
-
deployment: LambdaApiDeployment;
|
|
5
|
-
config: LambdaConfig[];
|
|
6
|
-
}
|
|
7
|
-
export declare const deployLambdas: (params: DeployLambdaParams) => Promise<void>;
|
|
8
|
-
export declare const deployCli: (deployment: LambdaApiDeployment, config: LambdaConfig[]) => Promise<void>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=templateLambdaApiDeploy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApiDeploy.d.ts","sourceRoot":"","sources":["../../src/templateLambdaApiDeploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAEL,YAAY,EAEb,MAAM,6BAA6B,CAAC;AAQrC,UAAU,kBAAkB;IAC1B,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,WAChB,kBAAkB,KACzB,QAAQ,IAAI,CAsBd,CAAC;AAEF,eAAO,MAAM,SAAS,eACR,mBAAmB,UACvB,YAAY,EAAE,KACrB,QAAQ,IAAI,CAKd,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deployCli = exports.deployLambdas = void 0;
|
|
4
|
-
const infra_aws_1 = require("@goldstack/infra-aws");
|
|
5
|
-
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
6
|
-
const utils_aws_lambda_2 = require("@goldstack/utils-aws-lambda");
|
|
7
|
-
const templateLambdaConsts_1 = require("./templateLambdaConsts");
|
|
8
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
9
|
-
const templateLambdaApiBuild_1 = require("./templateLambdaApiBuild");
|
|
10
|
-
const deployLambdas = async (params) => {
|
|
11
|
-
const lambdaConfig = (0, utils_aws_lambda_2.readLambdaConfig)(templateLambdaConsts_1.defaultRoutesPath);
|
|
12
|
-
const operations = lambdaConfig.map(async (config) => {
|
|
13
|
-
const functionName = (0, utils_aws_lambda_1.generateFunctionName)(params.deployment.configuration.lambdaNamePrefix, config);
|
|
14
|
-
console.log(`[${functionName}]: Starting deployment`);
|
|
15
|
-
const functionDir = (0, templateLambdaApiBuild_1.getOutDirForLambda)(config);
|
|
16
|
-
(0, utils_sh_1.mkdir)('-p', functionDir);
|
|
17
|
-
const targetArchive = `./distLambda/zips/${functionName}.zip`;
|
|
18
|
-
await (0, utils_aws_lambda_1.deployFunction)({
|
|
19
|
-
targetArchiveName: targetArchive,
|
|
20
|
-
lambdaPackageDir: functionDir,
|
|
21
|
-
awsCredentials: await (0, infra_aws_1.getAWSUser)(params.deployment.awsUser),
|
|
22
|
-
region: params.deployment.awsRegion,
|
|
23
|
-
functionName,
|
|
24
|
-
});
|
|
25
|
-
console.log(`[${functionName}]: Deployment completed`);
|
|
26
|
-
});
|
|
27
|
-
await Promise.all(operations);
|
|
28
|
-
};
|
|
29
|
-
exports.deployLambdas = deployLambdas;
|
|
30
|
-
const deployCli = async (deployment, config) => {
|
|
31
|
-
await (0, exports.deployLambdas)({
|
|
32
|
-
deployment,
|
|
33
|
-
config,
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
exports.deployCli = deployCli;
|
|
37
|
-
//# sourceMappingURL=templateLambdaApiDeploy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaApiDeploy.js","sourceRoot":"","sources":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AAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaConsts.d.ts","sourceRoot":"","sources":["../../src/templateLambdaConsts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateLambdaConsts.js","sourceRoot":"","sources":["../../src/templateLambdaConsts.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,cAAc,CAAC"}
|