@goldstack/utils-aws-lambda 0.3.0 → 0.3.3
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/buildFunctions.d.ts +32 -31
- package/dist/src/buildFunctions.d.ts.map +1 -1
- package/dist/src/buildFunctions.js +51 -48
- package/dist/src/buildFunctions.js.map +1 -1
- package/dist/src/defaultBuildOptions.d.ts +3 -3
- package/dist/src/defaultBuildOptions.js +36 -36
- package/dist/src/deployFunction.d.ts +9 -9
- package/dist/src/deployFunction.js +51 -51
- package/dist/src/deployFunctions.d.ts +10 -10
- package/dist/src/deployFunctions.js +28 -29
- package/dist/src/deployFunctions.js.map +1 -1
- package/dist/src/generate/collectLambdasFromFiles.d.ts +2 -2
- package/dist/src/generate/collectLambdasFromFiles.js +101 -101
- package/dist/src/generate/generateFunctionName.d.ts +5 -5
- package/dist/src/generate/generateFunctionName.js +58 -58
- package/dist/src/generateLambdaConfig.d.ts +4 -4
- package/dist/src/generateLambdaConfig.js +27 -27
- package/dist/src/types/LambdaConfig.d.ts +12 -12
- package/dist/src/types/LambdaConfig.js +8 -8
- package/dist/src/types/LambdaDeploymentConfiguration.d.ts +43 -43
- package/dist/src/types/LambdaDeploymentConfiguration.js +2 -2
- package/dist/src/utilsAwsLambda.d.ts +13 -13
- package/dist/src/utilsAwsLambda.js +22 -22
- package/package.json +8 -8
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import type { BuildOptions } from 'esbuild';
|
|
2
|
-
import { LambdaConfig } from './types/LambdaConfig';
|
|
3
|
-
export interface ClientBuildOptionsArgs {
|
|
4
|
-
/**
|
|
5
|
-
* Whether CSS should be injected in the bundled JavaScript
|
|
6
|
-
*/
|
|
7
|
-
includeCss: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* The Goldstack deployment the build is performed for.
|
|
10
|
-
*/
|
|
11
|
-
deploymentName: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ServerBuildOptionsArgs {
|
|
14
|
-
/**
|
|
15
|
-
* Called when CSS is generate for a React component
|
|
16
|
-
*/
|
|
17
|
-
onCSSGenerated: (css: string) => void;
|
|
18
|
-
/**
|
|
19
|
-
* The Goldstack deployment the build is performed for.
|
|
20
|
-
*/
|
|
21
|
-
deploymentName: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const getOutDirForLambda: (config: LambdaConfig) => string;
|
|
24
|
-
export declare const getOutFileForLambda: (config: LambdaConfig) => string;
|
|
25
|
-
export declare const buildFunctions: ({ routesDir, configs, deploymentName, buildOptions, lambdaNamePrefix, }: {
|
|
26
|
-
routesDir: string;
|
|
27
|
-
configs: LambdaConfig[];
|
|
28
|
-
deploymentName: string;
|
|
29
|
-
buildOptions: (args: ServerBuildOptionsArgs) => BuildOptions;
|
|
30
|
-
lambdaNamePrefix: string;
|
|
31
|
-
|
|
1
|
+
import type { BuildOptions } from 'esbuild';
|
|
2
|
+
import { LambdaConfig } from './types/LambdaConfig';
|
|
3
|
+
export interface ClientBuildOptionsArgs {
|
|
4
|
+
/**
|
|
5
|
+
* Whether CSS should be injected in the bundled JavaScript
|
|
6
|
+
*/
|
|
7
|
+
includeCss: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The Goldstack deployment the build is performed for.
|
|
10
|
+
*/
|
|
11
|
+
deploymentName: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ServerBuildOptionsArgs {
|
|
14
|
+
/**
|
|
15
|
+
* Called when CSS is generate for a React component
|
|
16
|
+
*/
|
|
17
|
+
onCSSGenerated: (css: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* The Goldstack deployment the build is performed for.
|
|
20
|
+
*/
|
|
21
|
+
deploymentName: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const getOutDirForLambda: (config: LambdaConfig) => string;
|
|
24
|
+
export declare const getOutFileForLambda: (config: LambdaConfig) => string;
|
|
25
|
+
export declare const buildFunctions: ({ routesDir, configs, deploymentName, buildOptions, lambdaNamePrefix, routeFilter, }: {
|
|
26
|
+
routesDir: string;
|
|
27
|
+
configs: LambdaConfig[];
|
|
28
|
+
deploymentName: string;
|
|
29
|
+
buildOptions: (args: ServerBuildOptionsArgs) => BuildOptions;
|
|
30
|
+
lambdaNamePrefix: string;
|
|
31
|
+
routeFilter?: string | undefined;
|
|
32
|
+
}) => Promise<void>;
|
|
32
33
|
//# sourceMappingURL=buildFunctions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFunctions.d.ts","sourceRoot":"","sources":["../../src/buildFunctions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAUpD,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,WAAY,YAAY,KAAG,MAQzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,YAAY,KAAG,MAE1D,CAAC;AAEF,eAAO,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"buildFunctions.d.ts","sourceRoot":"","sources":["../../src/buildFunctions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAUpD,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,WAAY,YAAY,KAAG,MAQzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,YAAY,KAAG,MAE1D,CAAC;AAEF,eAAO,MAAM,cAAc;eAQd,MAAM;aACR,YAAY,EAAE;oBACP,MAAM;yBACD,sBAAsB,KAAK,YAAY;sBAC1C,MAAM;;MAEtB,QAAQ,IAAI,CAwCf,CAAC"}
|
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildFunctions = exports.getOutFileForLambda = exports.getOutDirForLambda = void 0;
|
|
4
|
-
const esbuild_1 = require("esbuild");
|
|
5
|
-
const generateFunctionName_1 = require("./generate/generateFunctionName");
|
|
6
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
7
|
-
const getOutDirForLambda = (config) => {
|
|
8
|
-
if (config.path === '$default') {
|
|
9
|
-
return `./distLambda/${config.path}`;
|
|
10
|
-
}
|
|
11
|
-
if (config.path.endsWith('/')) {
|
|
12
|
-
return `./distLambda${config.path}index`;
|
|
13
|
-
}
|
|
14
|
-
return `./distLambda${config.path}`;
|
|
15
|
-
};
|
|
16
|
-
exports.getOutDirForLambda = getOutDirForLambda;
|
|
17
|
-
const getOutFileForLambda = (config) => {
|
|
18
|
-
return `${(0, exports.getOutDirForLambda)(config)}/lambda.js`;
|
|
19
|
-
};
|
|
20
|
-
exports.getOutFileForLambda = getOutFileForLambda;
|
|
21
|
-
const buildFunctions = async ({ routesDir, configs, deploymentName, buildOptions, lambdaNamePrefix, }) => {
|
|
22
|
-
const buildConfig = (0, utils_sh_1.readToType)('./esbuild.config.json');
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
(0, utils_sh_1.mkdir)('-p',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildFunctions = exports.getOutFileForLambda = exports.getOutDirForLambda = void 0;
|
|
4
|
+
const esbuild_1 = require("esbuild");
|
|
5
|
+
const generateFunctionName_1 = require("./generate/generateFunctionName");
|
|
6
|
+
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
7
|
+
const getOutDirForLambda = (config) => {
|
|
8
|
+
if (config.path === '$default') {
|
|
9
|
+
return `./distLambda/${config.path}`;
|
|
10
|
+
}
|
|
11
|
+
if (config.path.endsWith('/')) {
|
|
12
|
+
return `./distLambda${config.path}index`;
|
|
13
|
+
}
|
|
14
|
+
return `./distLambda${config.path}`;
|
|
15
|
+
};
|
|
16
|
+
exports.getOutDirForLambda = getOutDirForLambda;
|
|
17
|
+
const getOutFileForLambda = (config) => {
|
|
18
|
+
return `${(0, exports.getOutDirForLambda)(config)}/lambda.js`;
|
|
19
|
+
};
|
|
20
|
+
exports.getOutFileForLambda = getOutFileForLambda;
|
|
21
|
+
const buildFunctions = async ({ routesDir, configs, deploymentName, buildOptions, lambdaNamePrefix, routeFilter, }) => {
|
|
22
|
+
const buildConfig = (0, utils_sh_1.readToType)('./esbuild.config.json');
|
|
23
|
+
// if we have a filter, we don't remove previous outputs
|
|
24
|
+
if (!routeFilter) {
|
|
25
|
+
await (0, utils_sh_1.rmSafe)('./distLambda');
|
|
26
|
+
(0, utils_sh_1.mkdir)('-p', './distLambda/zips');
|
|
27
|
+
}
|
|
28
|
+
for await (const config of configs) {
|
|
29
|
+
(0, utils_sh_1.mkdir)('-p', (0, exports.getOutDirForLambda)(config));
|
|
30
|
+
const esbuildLocalPath = (0, utils_sh_1.changeExtension)(`${routesDir}/${config.relativeFilePath}`, '.esbuild.config.json');
|
|
31
|
+
const functionName = (0, generateFunctionName_1.generateFunctionName)(lambdaNamePrefix, config);
|
|
32
|
+
const localBuildConfig = (0, utils_sh_1.readToType)(esbuildLocalPath);
|
|
33
|
+
const onCSSGenerated = (css) => {
|
|
34
|
+
generatedCss.push(css);
|
|
35
|
+
};
|
|
36
|
+
const generatedCss = [];
|
|
37
|
+
const res = await (0, esbuild_1.build)({
|
|
38
|
+
...buildOptions({ onCSSGenerated, deploymentName }),
|
|
39
|
+
entryPoints: [`${routesDir}/${config.relativeFilePath}`],
|
|
40
|
+
outfile: (0, exports.getOutFileForLambda)(config),
|
|
41
|
+
...buildConfig,
|
|
42
|
+
...localBuildConfig,
|
|
43
|
+
});
|
|
44
|
+
if (res.metafile) {
|
|
45
|
+
(0, utils_sh_1.write)(JSON.stringify(res.metafile), `./distLambda/zips/${functionName}.meta.json`);
|
|
46
|
+
}
|
|
47
|
+
// provide CSS for initial load
|
|
48
|
+
(0, utils_sh_1.write)(generatedCss.join('\n'), `${(0, exports.getOutDirForLambda)(config)}/client.bundle.css`);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.buildFunctions = buildFunctions;
|
|
49
52
|
//# sourceMappingURL=buildFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFunctions.js","sourceRoot":"","sources":["../../src/buildFunctions.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAGhC,0EAAuE;AACvE,kDAM6B;AAwBtB,MAAM,kBAAkB,GAAG,CAAC,MAAoB,EAAU,EAAE;IACjE,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;QAC9B,OAAO,gBAAgB,MAAM,CAAC,IAAI,EAAE,CAAC;KACtC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,OAAO,eAAe,MAAM,CAAC,IAAI,OAAO,CAAC;KAC1C;IACD,OAAO,eAAe,MAAM,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEK,MAAM,mBAAmB,GAAG,CAAC,MAAoB,EAAU,EAAE;IAClE,OAAO,GAAG,IAAA,0BAAkB,EAAC,MAAM,CAAC,YAAY,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEK,MAAM,cAAc,GAAG,KAAK,EAAE,EACnC,SAAS,EACT,OAAO,EACP,cAAc,EACd,YAAY,EACZ,gBAAgB,
|
|
1
|
+
{"version":3,"file":"buildFunctions.js","sourceRoot":"","sources":["../../src/buildFunctions.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAGhC,0EAAuE;AACvE,kDAM6B;AAwBtB,MAAM,kBAAkB,GAAG,CAAC,MAAoB,EAAU,EAAE;IACjE,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;QAC9B,OAAO,gBAAgB,MAAM,CAAC,IAAI,EAAE,CAAC;KACtC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,OAAO,eAAe,MAAM,CAAC,IAAI,OAAO,CAAC;KAC1C;IACD,OAAO,eAAe,MAAM,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEK,MAAM,mBAAmB,GAAG,CAAC,MAAoB,EAAU,EAAE;IAClE,OAAO,GAAG,IAAA,0BAAkB,EAAC,MAAM,CAAC,YAAY,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEK,MAAM,cAAc,GAAG,KAAK,EAAE,EACnC,SAAS,EACT,OAAO,EACP,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,WAAW,GAQZ,EAAiB,EAAE;IAClB,MAAM,WAAW,GAAG,IAAA,qBAAU,EAAe,uBAAuB,CAAC,CAAC;IAEtE,wDAAwD;IACxD,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAA,iBAAM,EAAC,cAAc,CAAC,CAAC;QAC7B,IAAA,gBAAK,EAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;KAClC;IACD,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,OAAO,EAAE;QAClC,IAAA,gBAAK,EAAC,IAAI,EAAE,IAAA,0BAAkB,EAAC,MAAM,CAAC,CAAC,CAAC;QACxC,MAAM,gBAAgB,GAAG,IAAA,0BAAe,EACtC,GAAG,SAAS,IAAI,MAAM,CAAC,gBAAgB,EAAE,EACzC,sBAAsB,CACvB,CAAC;QACF,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,gBAAgB,GAAG,IAAA,qBAAU,EAAe,gBAAgB,CAAC,CAAC;QAEpE,MAAM,cAAc,GAAG,CAAC,GAAW,EAAQ,EAAE;YAC3C,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC,CAAC;QACF,MAAM,YAAY,GAAa,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,MAAM,IAAA,eAAK,EAAC;YACtB,GAAG,YAAY,CAAC,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC;YACnD,WAAW,EAAE,CAAC,GAAG,SAAS,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACxD,OAAO,EAAE,IAAA,2BAAmB,EAAC,MAAM,CAAC;YACpC,GAAG,WAAW;YACd,GAAG,gBAAgB;SACpB,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,QAAQ,EAAE;YAChB,IAAA,gBAAK,EACH,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAC5B,qBAAqB,YAAY,YAAY,CAC9C,CAAC;SACH;QACD,+BAA+B;QAC/B,IAAA,gBAAK,EACH,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EACvB,GAAG,IAAA,0BAAkB,EAAC,MAAM,CAAC,oBAAoB,CAClD,CAAC;KACH;AACH,CAAC,CAAC;AAtDW,QAAA,cAAc,kBAsDzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuildOptions } from 'esbuild';
|
|
2
|
-
import { ServerBuildOptionsArgs } from './buildFunctions';
|
|
3
|
-
export declare function defaultBuildOptions(): (args: ServerBuildOptionsArgs) => BuildOptions;
|
|
1
|
+
import type { BuildOptions } from 'esbuild';
|
|
2
|
+
import { ServerBuildOptionsArgs } from './buildFunctions';
|
|
3
|
+
export declare function defaultBuildOptions(): (args: ServerBuildOptionsArgs) => BuildOptions;
|
|
4
4
|
//# sourceMappingURL=defaultBuildOptions.d.ts.map
|
|
@@ -1,37 +1,37 @@
|
|
|
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
|
-
exports.defaultBuildOptions = void 0;
|
|
7
|
-
const esbuild_plugin_pnp_1 = require("@yarnpkg/esbuild-plugin-pnp");
|
|
8
|
-
const esbuild_css_modules_client_plugin_1 = __importDefault(require("esbuild-css-modules-client-plugin"));
|
|
9
|
-
function defaultBuildOptions() {
|
|
10
|
-
return function (args) {
|
|
11
|
-
return {
|
|
12
|
-
plugins: [
|
|
13
|
-
(0, esbuild_css_modules_client_plugin_1.default)({
|
|
14
|
-
excludeCSSInject: true,
|
|
15
|
-
onCSSGenerated: args.onCSSGenerated,
|
|
16
|
-
}),
|
|
17
|
-
(0, esbuild_plugin_pnp_1.pnpPlugin)(),
|
|
18
|
-
],
|
|
19
|
-
bundle: true,
|
|
20
|
-
external: [
|
|
21
|
-
'aws-sdk', // included in Lambda runtime environment
|
|
22
|
-
],
|
|
23
|
-
minify: true,
|
|
24
|
-
platform: 'node',
|
|
25
|
-
format: 'cjs',
|
|
26
|
-
target: 'node16.0',
|
|
27
|
-
treeShaking: true,
|
|
28
|
-
define: {
|
|
29
|
-
'process.env.NODE_ENV': '"production"',
|
|
30
|
-
},
|
|
31
|
-
sourcemap: true,
|
|
32
|
-
metafile: true,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.defaultBuildOptions = defaultBuildOptions;
|
|
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
|
+
exports.defaultBuildOptions = void 0;
|
|
7
|
+
const esbuild_plugin_pnp_1 = require("@yarnpkg/esbuild-plugin-pnp");
|
|
8
|
+
const esbuild_css_modules_client_plugin_1 = __importDefault(require("esbuild-css-modules-client-plugin"));
|
|
9
|
+
function defaultBuildOptions() {
|
|
10
|
+
return function (args) {
|
|
11
|
+
return {
|
|
12
|
+
plugins: [
|
|
13
|
+
(0, esbuild_css_modules_client_plugin_1.default)({
|
|
14
|
+
excludeCSSInject: true,
|
|
15
|
+
onCSSGenerated: args.onCSSGenerated,
|
|
16
|
+
}),
|
|
17
|
+
(0, esbuild_plugin_pnp_1.pnpPlugin)(),
|
|
18
|
+
],
|
|
19
|
+
bundle: true,
|
|
20
|
+
external: [
|
|
21
|
+
'aws-sdk', // included in Lambda runtime environment
|
|
22
|
+
],
|
|
23
|
+
minify: true,
|
|
24
|
+
platform: 'node',
|
|
25
|
+
format: 'cjs',
|
|
26
|
+
target: 'node16.0',
|
|
27
|
+
treeShaking: true,
|
|
28
|
+
define: {
|
|
29
|
+
'process.env.NODE_ENV': '"production"',
|
|
30
|
+
},
|
|
31
|
+
sourcemap: true,
|
|
32
|
+
metafile: true,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.defaultBuildOptions = defaultBuildOptions;
|
|
37
37
|
//# sourceMappingURL=defaultBuildOptions.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import AWS from 'aws-sdk';
|
|
2
|
-
export interface DeployFunctionParams {
|
|
3
|
-
lambdaPackageDir: string;
|
|
4
|
-
targetArchiveName?: string;
|
|
5
|
-
awsCredentials: AWS.Credentials;
|
|
6
|
-
region: string;
|
|
7
|
-
functionName: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const deployFunction: (params: DeployFunctionParams) => Promise<any>;
|
|
1
|
+
import AWS from 'aws-sdk';
|
|
2
|
+
export interface DeployFunctionParams {
|
|
3
|
+
lambdaPackageDir: string;
|
|
4
|
+
targetArchiveName?: string;
|
|
5
|
+
awsCredentials: AWS.Credentials;
|
|
6
|
+
region: string;
|
|
7
|
+
functionName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const deployFunction: (params: DeployFunctionParams) => Promise<any>;
|
|
10
10
|
//# sourceMappingURL=deployFunction.d.ts.map
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deployFunction = void 0;
|
|
4
|
-
const utils_aws_cli_1 = require("@goldstack/utils-aws-cli");
|
|
5
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
6
|
-
const deployFunction = async (params) => {
|
|
7
|
-
const targetArchive = params.targetArchiveName || `lambda-${new Date().getTime()}.zip`;
|
|
8
|
-
await (0, utils_sh_1.rmSafe)(targetArchive);
|
|
9
|
-
await (0, utils_sh_1.zip)({
|
|
10
|
-
directory: params.lambdaPackageDir,
|
|
11
|
-
target: targetArchive,
|
|
12
|
-
mode: 511,
|
|
13
|
-
});
|
|
14
|
-
let fixedTargetArchive = targetArchive;
|
|
15
|
-
const isWin = process.platform === 'win32';
|
|
16
|
-
if (!isWin) {
|
|
17
|
-
fixedTargetArchive = fixedTargetArchive.replace(/\$/g, '\\$');
|
|
18
|
-
}
|
|
19
|
-
const deployResult = await (0, utils_aws_cli_1.awsCli)({
|
|
20
|
-
credentials: params.awsCredentials,
|
|
21
|
-
region: params.region,
|
|
22
|
-
options: {
|
|
23
|
-
silent: true,
|
|
24
|
-
},
|
|
25
|
-
command: `lambda update-function-code --function-name ${params.functionName} --zip-file fileb://${fixedTargetArchive}`,
|
|
26
|
-
});
|
|
27
|
-
if (!params.targetArchiveName) {
|
|
28
|
-
await (0, utils_sh_1.rmSafe)(targetArchive);
|
|
29
|
-
}
|
|
30
|
-
// wait until lambda becomes active
|
|
31
|
-
let counter = 0;
|
|
32
|
-
let state = '';
|
|
33
|
-
while (counter < 20 && state !== 'Active') {
|
|
34
|
-
const res = await (0, utils_aws_cli_1.awsCli)({
|
|
35
|
-
credentials: params.awsCredentials,
|
|
36
|
-
region: params.region,
|
|
37
|
-
options: {
|
|
38
|
-
silent: true,
|
|
39
|
-
},
|
|
40
|
-
command: `lambda get-function --function-name ${params.functionName}`,
|
|
41
|
-
});
|
|
42
|
-
const data = JSON.parse(res);
|
|
43
|
-
state = data.Configuration.State;
|
|
44
|
-
counter++;
|
|
45
|
-
}
|
|
46
|
-
if (counter >= 20) {
|
|
47
|
-
throw new Error(`Function was still in state '${state}' after deployment`);
|
|
48
|
-
}
|
|
49
|
-
return JSON.parse(deployResult);
|
|
50
|
-
};
|
|
51
|
-
exports.deployFunction = deployFunction;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deployFunction = void 0;
|
|
4
|
+
const utils_aws_cli_1 = require("@goldstack/utils-aws-cli");
|
|
5
|
+
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
6
|
+
const deployFunction = async (params) => {
|
|
7
|
+
const targetArchive = params.targetArchiveName || `lambda-${new Date().getTime()}.zip`;
|
|
8
|
+
await (0, utils_sh_1.rmSafe)(targetArchive);
|
|
9
|
+
await (0, utils_sh_1.zip)({
|
|
10
|
+
directory: params.lambdaPackageDir,
|
|
11
|
+
target: targetArchive,
|
|
12
|
+
mode: 511,
|
|
13
|
+
});
|
|
14
|
+
let fixedTargetArchive = targetArchive;
|
|
15
|
+
const isWin = process.platform === 'win32';
|
|
16
|
+
if (!isWin) {
|
|
17
|
+
fixedTargetArchive = fixedTargetArchive.replace(/\$/g, '\\$');
|
|
18
|
+
}
|
|
19
|
+
const deployResult = await (0, utils_aws_cli_1.awsCli)({
|
|
20
|
+
credentials: params.awsCredentials,
|
|
21
|
+
region: params.region,
|
|
22
|
+
options: {
|
|
23
|
+
silent: true,
|
|
24
|
+
},
|
|
25
|
+
command: `lambda update-function-code --function-name ${params.functionName} --zip-file fileb://${fixedTargetArchive}`,
|
|
26
|
+
});
|
|
27
|
+
if (!params.targetArchiveName) {
|
|
28
|
+
await (0, utils_sh_1.rmSafe)(targetArchive);
|
|
29
|
+
}
|
|
30
|
+
// wait until lambda becomes active
|
|
31
|
+
let counter = 0;
|
|
32
|
+
let state = '';
|
|
33
|
+
while (counter < 20 && state !== 'Active') {
|
|
34
|
+
const res = await (0, utils_aws_cli_1.awsCli)({
|
|
35
|
+
credentials: params.awsCredentials,
|
|
36
|
+
region: params.region,
|
|
37
|
+
options: {
|
|
38
|
+
silent: true,
|
|
39
|
+
},
|
|
40
|
+
command: `lambda get-function --function-name ${params.functionName}`,
|
|
41
|
+
});
|
|
42
|
+
const data = JSON.parse(res);
|
|
43
|
+
state = data.Configuration.State;
|
|
44
|
+
counter++;
|
|
45
|
+
}
|
|
46
|
+
if (counter >= 20) {
|
|
47
|
+
throw new Error(`Function was still in state '${state}' after deployment`);
|
|
48
|
+
}
|
|
49
|
+
return JSON.parse(deployResult);
|
|
50
|
+
};
|
|
51
|
+
exports.deployFunction = deployFunction;
|
|
52
52
|
//# sourceMappingURL=deployFunction.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { AWSDeployment } from '@goldstack/infra-aws';
|
|
2
|
-
import type { LambdaApiDeploymentConfiguration } from './types/LambdaDeploymentConfiguration';
|
|
3
|
-
import type { LambdaConfig } from './types/LambdaConfig';
|
|
4
|
-
export interface DeployFunctionsParams {
|
|
5
|
-
routesPath: string;
|
|
6
|
-
configuration: LambdaApiDeploymentConfiguration;
|
|
7
|
-
deployment: AWSDeployment;
|
|
8
|
-
config: LambdaConfig[];
|
|
9
|
-
}
|
|
10
|
-
export declare const deployFunctions: (params: DeployFunctionsParams) => Promise<void>;
|
|
1
|
+
import type { AWSDeployment } from '@goldstack/infra-aws';
|
|
2
|
+
import type { LambdaApiDeploymentConfiguration } from './types/LambdaDeploymentConfiguration';
|
|
3
|
+
import type { LambdaConfig } from './types/LambdaConfig';
|
|
4
|
+
export interface DeployFunctionsParams {
|
|
5
|
+
routesPath: string;
|
|
6
|
+
configuration: LambdaApiDeploymentConfiguration;
|
|
7
|
+
deployment: AWSDeployment;
|
|
8
|
+
config: LambdaConfig[];
|
|
9
|
+
}
|
|
10
|
+
export declare const deployFunctions: (params: DeployFunctionsParams) => Promise<void>;
|
|
11
11
|
//# sourceMappingURL=deployFunctions.d.ts.map
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deployFunctions = void 0;
|
|
4
|
-
const infra_aws_1 = require("@goldstack/infra-aws");
|
|
5
|
-
const deployFunction_1 = require("./deployFunction");
|
|
6
|
-
const generateFunctionName_1 = require("./generate/generateFunctionName");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.deployFunctions = deployFunctions;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deployFunctions = void 0;
|
|
4
|
+
const infra_aws_1 = require("@goldstack/infra-aws");
|
|
5
|
+
const deployFunction_1 = require("./deployFunction");
|
|
6
|
+
const generateFunctionName_1 = require("./generate/generateFunctionName");
|
|
7
|
+
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
8
|
+
const buildFunctions_1 = require("./buildFunctions");
|
|
9
|
+
const deployFunctions = async (params) => {
|
|
10
|
+
const lambdaConfig = params.config; //readLambdaConfig(params.routesPath);
|
|
11
|
+
const operations = lambdaConfig.map(async (config) => {
|
|
12
|
+
const functionName = (0, generateFunctionName_1.generateFunctionName)(params.configuration.lambdaNamePrefix, config);
|
|
13
|
+
console.log(`[${functionName}]: Starting deployment`);
|
|
14
|
+
const functionDir = (0, buildFunctions_1.getOutDirForLambda)(config);
|
|
15
|
+
(0, utils_sh_1.mkdir)('-p', functionDir);
|
|
16
|
+
const targetArchive = `./distLambda/zips/${functionName}.zip`;
|
|
17
|
+
await (0, deployFunction_1.deployFunction)({
|
|
18
|
+
targetArchiveName: targetArchive,
|
|
19
|
+
lambdaPackageDir: functionDir,
|
|
20
|
+
awsCredentials: await (0, infra_aws_1.getAWSUser)(params.deployment.awsUser),
|
|
21
|
+
region: params.deployment.awsRegion,
|
|
22
|
+
functionName,
|
|
23
|
+
});
|
|
24
|
+
console.log(`[${functionName}]: Deployment completed`);
|
|
25
|
+
});
|
|
26
|
+
await Promise.all(operations);
|
|
27
|
+
};
|
|
28
|
+
exports.deployFunctions = deployFunctions;
|
|
30
29
|
//# sourceMappingURL=deployFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployFunctions.js","sourceRoot":"","sources":["../../src/deployFunctions.ts"],"names":[],"mappings":";;;AAEA,oDAAkD;AAClD,qDAAkD;AAElD,0EAAuE;
|
|
1
|
+
{"version":3,"file":"deployFunctions.js","sourceRoot":"","sources":["../../src/deployFunctions.ts"],"names":[],"mappings":";;;AAEA,oDAAkD;AAClD,qDAAkD;AAElD,0EAAuE;AAIvE,kDAA4C;AAC5C,qDAAsD;AAS/C,MAAM,eAAe,GAAG,KAAK,EAClC,MAA6B,EACd,EAAE;IACjB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,sCAAsC;IAE1E,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACnD,MAAM,YAAY,GAAG,IAAA,2CAAoB,EACvC,MAAM,CAAC,aAAa,CAAC,gBAAgB,EACrC,MAAM,CACP,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,IAAI,YAAY,wBAAwB,CAAC,CAAC;QACtD,MAAM,WAAW,GAAG,IAAA,mCAAkB,EAAC,MAAM,CAAC,CAAC;QAC/C,IAAA,gBAAK,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACzB,MAAM,aAAa,GAAG,qBAAqB,YAAY,MAAM,CAAC;QAC9D,MAAM,IAAA,+BAAc,EAAC;YACnB,iBAAiB,EAAE,aAAa;YAChC,gBAAgB,EAAE,WAAW;YAC7B,cAAc,EAAE,MAAM,IAAA,sBAAU,EAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;YAC3D,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS;YACnC,YAAY;SACb,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,IAAI,YAAY,yBAAyB,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC,CAAC;AAxBW,QAAA,eAAe,mBAwB1B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { LambdaConfig } from '../types/LambdaConfig';
|
|
2
|
-
export declare function readLambdaConfig(dir: string): LambdaConfig[];
|
|
1
|
+
import type { LambdaConfig } from '../types/LambdaConfig';
|
|
2
|
+
export declare function readLambdaConfig(dir: string): LambdaConfig[];
|
|
3
3
|
//# sourceMappingURL=collectLambdasFromFiles.d.ts.map
|
|
@@ -1,102 +1,102 @@
|
|
|
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
|
-
exports.readLambdaConfig = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const LambdaConfig_1 = require("../types/LambdaConfig");
|
|
10
|
-
function readLambdaConfig(dir) {
|
|
11
|
-
const result = readLambdaConfigImpl(dir, dir);
|
|
12
|
-
if (!result.children) {
|
|
13
|
-
throw new Error('Invalid directory ' + dir);
|
|
14
|
-
}
|
|
15
|
-
return flattenConfig(result.children).filter((e) => e.type === LambdaConfig_1.RouteType.FUNCTION);
|
|
16
|
-
}
|
|
17
|
-
exports.readLambdaConfig = readLambdaConfig;
|
|
18
|
-
function flattenConfig(config) {
|
|
19
|
-
const arr = [];
|
|
20
|
-
for (const child of Object.entries(config)) {
|
|
21
|
-
const newVal = { ...child[1] };
|
|
22
|
-
newVal.children = undefined;
|
|
23
|
-
arr.push(newVal);
|
|
24
|
-
if (child[1].children) {
|
|
25
|
-
arr.push(...flattenConfig(child[1].children));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return arr;
|
|
29
|
-
}
|
|
30
|
-
function posixPath(pathString) {
|
|
31
|
-
return pathString.split(path_1.sep).join(path_1.posix.sep);
|
|
32
|
-
}
|
|
33
|
-
function removeExtension(path) {
|
|
34
|
-
return path.replace(/\.[^/.]+$/, '');
|
|
35
|
-
}
|
|
36
|
-
function makePath(configRoot, dir) {
|
|
37
|
-
const path = removeExtension(posixPath((0, path_1.relative)(configRoot, dir)));
|
|
38
|
-
if (path === '$index') {
|
|
39
|
-
return '/';
|
|
40
|
-
}
|
|
41
|
-
if (path.indexOf('$index') !== -1) {
|
|
42
|
-
let newPath = path.replace('$index', '');
|
|
43
|
-
// API Gateway does not accept routes like /my_route/
|
|
44
|
-
newPath = newPath.slice(0, newPath.length - 1);
|
|
45
|
-
return `/${newPath}`;
|
|
46
|
-
}
|
|
47
|
-
if (path === '$default') {
|
|
48
|
-
return '$default';
|
|
49
|
-
}
|
|
50
|
-
return `/${path}`;
|
|
51
|
-
}
|
|
52
|
-
function makeRoute(configRoot, dir) {
|
|
53
|
-
const route = makePath(configRoot, dir);
|
|
54
|
-
if (route === '$default') {
|
|
55
|
-
return '$default';
|
|
56
|
-
}
|
|
57
|
-
return `ANY ${route}`;
|
|
58
|
-
}
|
|
59
|
-
function readLambdaConfigImpl(configRoot, dir) {
|
|
60
|
-
const root = dir;
|
|
61
|
-
const rootRoute = makeRoute(configRoot, dir);
|
|
62
|
-
const configItem = {
|
|
63
|
-
name: root,
|
|
64
|
-
type: LambdaConfig_1.RouteType.DIR,
|
|
65
|
-
absoluteFilePath: dir,
|
|
66
|
-
path: makePath(configRoot, dir),
|
|
67
|
-
relativeFilePath: (0, path_1.relative)(configRoot, dir),
|
|
68
|
-
route: rootRoute,
|
|
69
|
-
};
|
|
70
|
-
const dirHandle = fs_1.default.opendirSync(dir);
|
|
71
|
-
let dirEntry;
|
|
72
|
-
while ((dirEntry = dirHandle.readSync()) !== null) {
|
|
73
|
-
if (!configItem.children) {
|
|
74
|
-
configItem.children = {};
|
|
75
|
-
}
|
|
76
|
-
const name = dirEntry.name;
|
|
77
|
-
const fullPath = (0, path_1.resolve)(root, name);
|
|
78
|
-
if (dirEntry.isDirectory()) {
|
|
79
|
-
configItem.children[name] = readLambdaConfigImpl(configRoot, fullPath);
|
|
80
|
-
}
|
|
81
|
-
else if (dirEntry.isFile()) {
|
|
82
|
-
if (!(dirEntry.name.endsWith('.ts') || dirEntry.name.endsWith('.tsx'))) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
const route = makeRoute(configRoot, fullPath);
|
|
86
|
-
configItem.children[name] = {
|
|
87
|
-
name: removeExtension(name),
|
|
88
|
-
type: LambdaConfig_1.RouteType.FUNCTION,
|
|
89
|
-
path: makePath(configRoot, fullPath),
|
|
90
|
-
absoluteFilePath: fullPath,
|
|
91
|
-
relativeFilePath: (0, path_1.relative)(configRoot, fullPath),
|
|
92
|
-
route: route,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
dirHandle.closeSync();
|
|
100
|
-
return configItem;
|
|
101
|
-
}
|
|
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
|
+
exports.readLambdaConfig = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const LambdaConfig_1 = require("../types/LambdaConfig");
|
|
10
|
+
function readLambdaConfig(dir) {
|
|
11
|
+
const result = readLambdaConfigImpl(dir, dir);
|
|
12
|
+
if (!result.children) {
|
|
13
|
+
throw new Error('Invalid directory ' + dir);
|
|
14
|
+
}
|
|
15
|
+
return flattenConfig(result.children).filter((e) => e.type === LambdaConfig_1.RouteType.FUNCTION);
|
|
16
|
+
}
|
|
17
|
+
exports.readLambdaConfig = readLambdaConfig;
|
|
18
|
+
function flattenConfig(config) {
|
|
19
|
+
const arr = [];
|
|
20
|
+
for (const child of Object.entries(config)) {
|
|
21
|
+
const newVal = { ...child[1] };
|
|
22
|
+
newVal.children = undefined;
|
|
23
|
+
arr.push(newVal);
|
|
24
|
+
if (child[1].children) {
|
|
25
|
+
arr.push(...flattenConfig(child[1].children));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return arr;
|
|
29
|
+
}
|
|
30
|
+
function posixPath(pathString) {
|
|
31
|
+
return pathString.split(path_1.sep).join(path_1.posix.sep);
|
|
32
|
+
}
|
|
33
|
+
function removeExtension(path) {
|
|
34
|
+
return path.replace(/\.[^/.]+$/, '');
|
|
35
|
+
}
|
|
36
|
+
function makePath(configRoot, dir) {
|
|
37
|
+
const path = removeExtension(posixPath((0, path_1.relative)(configRoot, dir)));
|
|
38
|
+
if (path === '$index') {
|
|
39
|
+
return '/';
|
|
40
|
+
}
|
|
41
|
+
if (path.indexOf('$index') !== -1) {
|
|
42
|
+
let newPath = path.replace('$index', '');
|
|
43
|
+
// API Gateway does not accept routes like /my_route/
|
|
44
|
+
newPath = newPath.slice(0, newPath.length - 1);
|
|
45
|
+
return `/${newPath}`;
|
|
46
|
+
}
|
|
47
|
+
if (path === '$default') {
|
|
48
|
+
return '$default';
|
|
49
|
+
}
|
|
50
|
+
return `/${path}`;
|
|
51
|
+
}
|
|
52
|
+
function makeRoute(configRoot, dir) {
|
|
53
|
+
const route = makePath(configRoot, dir);
|
|
54
|
+
if (route === '$default') {
|
|
55
|
+
return '$default';
|
|
56
|
+
}
|
|
57
|
+
return `ANY ${route}`;
|
|
58
|
+
}
|
|
59
|
+
function readLambdaConfigImpl(configRoot, dir) {
|
|
60
|
+
const root = dir;
|
|
61
|
+
const rootRoute = makeRoute(configRoot, dir);
|
|
62
|
+
const configItem = {
|
|
63
|
+
name: root,
|
|
64
|
+
type: LambdaConfig_1.RouteType.DIR,
|
|
65
|
+
absoluteFilePath: dir,
|
|
66
|
+
path: makePath(configRoot, dir),
|
|
67
|
+
relativeFilePath: (0, path_1.relative)(configRoot, dir),
|
|
68
|
+
route: rootRoute,
|
|
69
|
+
};
|
|
70
|
+
const dirHandle = fs_1.default.opendirSync(dir);
|
|
71
|
+
let dirEntry;
|
|
72
|
+
while ((dirEntry = dirHandle.readSync()) !== null) {
|
|
73
|
+
if (!configItem.children) {
|
|
74
|
+
configItem.children = {};
|
|
75
|
+
}
|
|
76
|
+
const name = dirEntry.name;
|
|
77
|
+
const fullPath = (0, path_1.resolve)(root, name);
|
|
78
|
+
if (dirEntry.isDirectory()) {
|
|
79
|
+
configItem.children[name] = readLambdaConfigImpl(configRoot, fullPath);
|
|
80
|
+
}
|
|
81
|
+
else if (dirEntry.isFile()) {
|
|
82
|
+
if (!(dirEntry.name.endsWith('.ts') || dirEntry.name.endsWith('.tsx'))) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const route = makeRoute(configRoot, fullPath);
|
|
86
|
+
configItem.children[name] = {
|
|
87
|
+
name: removeExtension(name),
|
|
88
|
+
type: LambdaConfig_1.RouteType.FUNCTION,
|
|
89
|
+
path: makePath(configRoot, fullPath),
|
|
90
|
+
absoluteFilePath: fullPath,
|
|
91
|
+
relativeFilePath: (0, path_1.relative)(configRoot, fullPath),
|
|
92
|
+
route: route,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
dirHandle.closeSync();
|
|
100
|
+
return configItem;
|
|
101
|
+
}
|
|
102
102
|
//# sourceMappingURL=collectLambdasFromFiles.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { LambdaConfig } from './../types/LambdaConfig';
|
|
2
|
-
/**
|
|
3
|
-
* Generates a valid function name for a route
|
|
4
|
-
*/
|
|
5
|
-
export declare const generateFunctionName: (prefix: string | undefined, config: LambdaConfig) => string;
|
|
1
|
+
import type { LambdaConfig } from './../types/LambdaConfig';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a valid function name for a route
|
|
4
|
+
*/
|
|
5
|
+
export declare const generateFunctionName: (prefix: string | undefined, config: LambdaConfig) => string;
|
|
6
6
|
//# sourceMappingURL=generateFunctionName.d.ts.map
|
|
@@ -1,59 +1,59 @@
|
|
|
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
|
-
exports.generateFunctionName = void 0;
|
|
7
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
-
const INDEX_MARKER = '__index';
|
|
9
|
-
const DEFAULT_MARKER = '__default';
|
|
10
|
-
const sanitiseFunctionName = (input) => {
|
|
11
|
-
return input
|
|
12
|
-
.replace(/\//g, '-')
|
|
13
|
-
.replace(/\$/g, '_')
|
|
14
|
-
.replace(/\{/g, '_')
|
|
15
|
-
.replace(/\}/g, '_')
|
|
16
|
-
.replace(/\+/g, '_')
|
|
17
|
-
.replace(/[^\w\-_]/gi, '_');
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Generates a valid function name for a route
|
|
21
|
-
*/
|
|
22
|
-
const generateFunctionName = (prefix, config) => {
|
|
23
|
-
let name = config.name;
|
|
24
|
-
if (name === '$default') {
|
|
25
|
-
// '$' is not a valid character in a lambda function name
|
|
26
|
-
name = DEFAULT_MARKER;
|
|
27
|
-
}
|
|
28
|
-
if (name === '$index') {
|
|
29
|
-
name = INDEX_MARKER;
|
|
30
|
-
}
|
|
31
|
-
name = sanitiseFunctionName(name);
|
|
32
|
-
let pathPrefix = '';
|
|
33
|
-
const segments = config.path.split('/');
|
|
34
|
-
if (segments.length === 2 && name === INDEX_MARKER) {
|
|
35
|
-
pathPrefix = `${segments[1]}-`;
|
|
36
|
-
}
|
|
37
|
-
if (segments.length > 2) {
|
|
38
|
-
segments.shift(); // remove first element since path starts with '/' and thus the first element is always ''
|
|
39
|
-
segments.pop(); // remove the last element since that is the name of the function in the route
|
|
40
|
-
pathPrefix = sanitiseFunctionName(segments.join('-'));
|
|
41
|
-
pathPrefix = `${pathPrefix}-`;
|
|
42
|
-
}
|
|
43
|
-
name = `${pathPrefix}${name}`;
|
|
44
|
-
if (prefix) {
|
|
45
|
-
name = `${prefix}-` + name;
|
|
46
|
-
}
|
|
47
|
-
// Lambda names cannot be larger than 64 characters
|
|
48
|
-
// in that case shorten name and append a hash
|
|
49
|
-
if (name.length > 64) {
|
|
50
|
-
name = `${name.substring(0, 40)}-${crypto_1.default
|
|
51
|
-
.createHash('md5')
|
|
52
|
-
.update(name)
|
|
53
|
-
.digest('hex')
|
|
54
|
-
.substring(0, 20)}`;
|
|
55
|
-
}
|
|
56
|
-
return name;
|
|
57
|
-
};
|
|
58
|
-
exports.generateFunctionName = generateFunctionName;
|
|
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
|
+
exports.generateFunctionName = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const INDEX_MARKER = '__index';
|
|
9
|
+
const DEFAULT_MARKER = '__default';
|
|
10
|
+
const sanitiseFunctionName = (input) => {
|
|
11
|
+
return input
|
|
12
|
+
.replace(/\//g, '-')
|
|
13
|
+
.replace(/\$/g, '_')
|
|
14
|
+
.replace(/\{/g, '_')
|
|
15
|
+
.replace(/\}/g, '_')
|
|
16
|
+
.replace(/\+/g, '_')
|
|
17
|
+
.replace(/[^\w\-_]/gi, '_');
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Generates a valid function name for a route
|
|
21
|
+
*/
|
|
22
|
+
const generateFunctionName = (prefix, config) => {
|
|
23
|
+
let name = config.name;
|
|
24
|
+
if (name === '$default') {
|
|
25
|
+
// '$' is not a valid character in a lambda function name
|
|
26
|
+
name = DEFAULT_MARKER;
|
|
27
|
+
}
|
|
28
|
+
if (name === '$index') {
|
|
29
|
+
name = INDEX_MARKER;
|
|
30
|
+
}
|
|
31
|
+
name = sanitiseFunctionName(name);
|
|
32
|
+
let pathPrefix = '';
|
|
33
|
+
const segments = config.path.split('/');
|
|
34
|
+
if (segments.length === 2 && name === INDEX_MARKER) {
|
|
35
|
+
pathPrefix = `${segments[1]}-`;
|
|
36
|
+
}
|
|
37
|
+
if (segments.length > 2) {
|
|
38
|
+
segments.shift(); // remove first element since path starts with '/' and thus the first element is always ''
|
|
39
|
+
segments.pop(); // remove the last element since that is the name of the function in the route
|
|
40
|
+
pathPrefix = sanitiseFunctionName(segments.join('-'));
|
|
41
|
+
pathPrefix = `${pathPrefix}-`;
|
|
42
|
+
}
|
|
43
|
+
name = `${pathPrefix}${name}`;
|
|
44
|
+
if (prefix) {
|
|
45
|
+
name = `${prefix}-` + name;
|
|
46
|
+
}
|
|
47
|
+
// Lambda names cannot be larger than 64 characters
|
|
48
|
+
// in that case shorten name and append a hash
|
|
49
|
+
if (name.length > 64) {
|
|
50
|
+
name = `${name.substring(0, 40)}-${crypto_1.default
|
|
51
|
+
.createHash('md5')
|
|
52
|
+
.update(name)
|
|
53
|
+
.digest('hex')
|
|
54
|
+
.substring(0, 20)}`;
|
|
55
|
+
}
|
|
56
|
+
return name;
|
|
57
|
+
};
|
|
58
|
+
exports.generateFunctionName = generateFunctionName;
|
|
59
59
|
//# sourceMappingURL=generateFunctionName.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LambdaConfig } from '@goldstack/utils-aws-lambda';
|
|
2
|
-
import { LambdaRoutesConfig, LambdaApiDeploymentConfiguration } from './types/LambdaDeploymentConfiguration';
|
|
3
|
-
export declare const generateLambdaConfig: (configuration: LambdaApiDeploymentConfiguration, config: LambdaConfig[]) => LambdaRoutesConfig;
|
|
4
|
-
export declare const validateDeployment: (config: LambdaRoutesConfig) => boolean;
|
|
1
|
+
import { LambdaConfig } from '@goldstack/utils-aws-lambda';
|
|
2
|
+
import { LambdaRoutesConfig, LambdaApiDeploymentConfiguration } from './types/LambdaDeploymentConfiguration';
|
|
3
|
+
export declare const generateLambdaConfig: (configuration: LambdaApiDeploymentConfiguration, config: LambdaConfig[]) => LambdaRoutesConfig;
|
|
4
|
+
export declare const validateDeployment: (config: LambdaRoutesConfig) => boolean;
|
|
5
5
|
//# sourceMappingURL=generateLambdaConfig.d.ts.map
|
|
@@ -1,28 +1,28 @@
|
|
|
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 = (configuration, 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)(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;
|
|
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 = (configuration, 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)(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
28
|
//# sourceMappingURL=generateLambdaConfig.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export declare enum RouteType {
|
|
2
|
-
DIR = "DIR",
|
|
3
|
-
FUNCTION = "FUNCTION"
|
|
4
|
-
}
|
|
5
|
-
export interface LambdaConfig {
|
|
6
|
-
name: string;
|
|
7
|
-
type: RouteType;
|
|
8
|
-
absoluteFilePath: string;
|
|
9
|
-
relativeFilePath: string;
|
|
10
|
-
path: string;
|
|
11
|
-
route: string;
|
|
12
|
-
}
|
|
1
|
+
export declare enum RouteType {
|
|
2
|
+
DIR = "DIR",
|
|
3
|
+
FUNCTION = "FUNCTION"
|
|
4
|
+
}
|
|
5
|
+
export interface LambdaConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
type: RouteType;
|
|
8
|
+
absoluteFilePath: string;
|
|
9
|
+
relativeFilePath: string;
|
|
10
|
+
path: string;
|
|
11
|
+
route: string;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=LambdaConfig.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RouteType = void 0;
|
|
4
|
-
var RouteType;
|
|
5
|
-
(function (RouteType) {
|
|
6
|
-
RouteType["DIR"] = "DIR";
|
|
7
|
-
RouteType["FUNCTION"] = "FUNCTION";
|
|
8
|
-
})(RouteType = exports.RouteType || (exports.RouteType = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteType = void 0;
|
|
4
|
+
var RouteType;
|
|
5
|
+
(function (RouteType) {
|
|
6
|
+
RouteType["DIR"] = "DIR";
|
|
7
|
+
RouteType["FUNCTION"] = "FUNCTION";
|
|
8
|
+
})(RouteType = exports.RouteType || (exports.RouteType = {}));
|
|
9
9
|
//# sourceMappingURL=LambdaConfig.js.map
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The prefix to be used for names of the generated lambdas for the API endpoints.
|
|
3
|
-
*
|
|
4
|
-
* @title Lambda Name Prefix
|
|
5
|
-
* @pattern ^[A-Za-z0-9-_]*$
|
|
6
|
-
*/
|
|
7
|
-
declare type LambdaNamePrefix = string;
|
|
8
|
-
/**
|
|
9
|
-
* The domain name that the API should be deployed to (e.g. api.mysite.com)
|
|
10
|
-
*
|
|
11
|
-
* @title API Domain
|
|
12
|
-
* @pattern ^[^\s]*
|
|
13
|
-
*/
|
|
14
|
-
export declare type APIDomain = string;
|
|
15
|
-
/**
|
|
16
|
-
* The domain name of the Route 53 hosted zone that the domain for this API should be added to.
|
|
17
|
-
*
|
|
18
|
-
* @title Hosted Zone Domain
|
|
19
|
-
* @pattern ^[^\s]*
|
|
20
|
-
*/
|
|
21
|
-
export declare type HostedZoneDomain = string;
|
|
22
|
-
/**
|
|
23
|
-
* Optional URL for an UI that should be allowed to access this server.
|
|
24
|
-
*
|
|
25
|
-
* @title CORS Header
|
|
26
|
-
* @pattern ^[^\s]*
|
|
27
|
-
*/
|
|
28
|
-
export declare type CorsHeader = string;
|
|
29
|
-
export interface LambdaRouteConfig {
|
|
30
|
-
function_name: string;
|
|
31
|
-
route: string;
|
|
32
|
-
}
|
|
33
|
-
export declare type LambdaRoutesConfig = {
|
|
34
|
-
[key: string]: LambdaRouteConfig;
|
|
35
|
-
};
|
|
36
|
-
export interface LambdaApiDeploymentConfiguration {
|
|
37
|
-
lambdaNamePrefix?: LambdaNamePrefix;
|
|
38
|
-
apiDomain: APIDomain;
|
|
39
|
-
hostedZoneDomain: HostedZoneDomain;
|
|
40
|
-
cors?: CorsHeader;
|
|
41
|
-
lambdas: LambdaRoutesConfig;
|
|
42
|
-
}
|
|
43
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* The prefix to be used for names of the generated lambdas for the API endpoints.
|
|
3
|
+
*
|
|
4
|
+
* @title Lambda Name Prefix
|
|
5
|
+
* @pattern ^[A-Za-z0-9-_]*$
|
|
6
|
+
*/
|
|
7
|
+
declare type LambdaNamePrefix = string;
|
|
8
|
+
/**
|
|
9
|
+
* The domain name that the API should be deployed to (e.g. api.mysite.com)
|
|
10
|
+
*
|
|
11
|
+
* @title API Domain
|
|
12
|
+
* @pattern ^[^\s]*
|
|
13
|
+
*/
|
|
14
|
+
export declare type APIDomain = string;
|
|
15
|
+
/**
|
|
16
|
+
* The domain name of the Route 53 hosted zone that the domain for this API should be added to.
|
|
17
|
+
*
|
|
18
|
+
* @title Hosted Zone Domain
|
|
19
|
+
* @pattern ^[^\s]*
|
|
20
|
+
*/
|
|
21
|
+
export declare type HostedZoneDomain = string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional URL for an UI that should be allowed to access this server.
|
|
24
|
+
*
|
|
25
|
+
* @title CORS Header
|
|
26
|
+
* @pattern ^[^\s]*
|
|
27
|
+
*/
|
|
28
|
+
export declare type CorsHeader = string;
|
|
29
|
+
export interface LambdaRouteConfig {
|
|
30
|
+
function_name: string;
|
|
31
|
+
route: string;
|
|
32
|
+
}
|
|
33
|
+
export declare type LambdaRoutesConfig = {
|
|
34
|
+
[key: string]: LambdaRouteConfig;
|
|
35
|
+
};
|
|
36
|
+
export interface LambdaApiDeploymentConfiguration {
|
|
37
|
+
lambdaNamePrefix?: LambdaNamePrefix;
|
|
38
|
+
apiDomain: APIDomain;
|
|
39
|
+
hostedZoneDomain: HostedZoneDomain;
|
|
40
|
+
cors?: CorsHeader;
|
|
41
|
+
lambdas: LambdaRoutesConfig;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
44
|
//# sourceMappingURL=LambdaDeploymentConfiguration.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=LambdaDeploymentConfiguration.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { readLambdaConfig } from './generate/collectLambdasFromFiles';
|
|
2
|
-
export { generateFunctionName } from './generate/generateFunctionName';
|
|
3
|
-
export type { LambdaConfig } from './types/LambdaConfig';
|
|
4
|
-
export { RouteType } from './types/LambdaConfig';
|
|
5
|
-
export type { LambdaRoutesConfig, LambdaRouteConfig, LambdaApiDeploymentConfiguration, APIDomain, CorsHeader, HostedZoneDomain, } from './types/LambdaDeploymentConfiguration';
|
|
6
|
-
export type { DeployFunctionParams } from './deployFunction';
|
|
7
|
-
export { deployFunction } from './deployFunction';
|
|
8
|
-
export type { DeployFunctionsParams } from './deployFunctions';
|
|
9
|
-
export { deployFunctions } from './deployFunctions';
|
|
10
|
-
export { defaultBuildOptions } from './defaultBuildOptions';
|
|
11
|
-
export { buildFunctions, getOutDirForLambda, getOutFileForLambda, } from './buildFunctions';
|
|
12
|
-
export type { ClientBuildOptionsArgs, ServerBuildOptionsArgs, } from './buildFunctions';
|
|
13
|
-
export { generateLambdaConfig, validateDeployment, } from './generateLambdaConfig';
|
|
1
|
+
export { readLambdaConfig } from './generate/collectLambdasFromFiles';
|
|
2
|
+
export { generateFunctionName } from './generate/generateFunctionName';
|
|
3
|
+
export type { LambdaConfig } from './types/LambdaConfig';
|
|
4
|
+
export { RouteType } from './types/LambdaConfig';
|
|
5
|
+
export type { LambdaRoutesConfig, LambdaRouteConfig, LambdaApiDeploymentConfiguration, APIDomain, CorsHeader, HostedZoneDomain, } from './types/LambdaDeploymentConfiguration';
|
|
6
|
+
export type { DeployFunctionParams } from './deployFunction';
|
|
7
|
+
export { deployFunction } from './deployFunction';
|
|
8
|
+
export type { DeployFunctionsParams } from './deployFunctions';
|
|
9
|
+
export { deployFunctions } from './deployFunctions';
|
|
10
|
+
export { defaultBuildOptions } from './defaultBuildOptions';
|
|
11
|
+
export { buildFunctions, getOutDirForLambda, getOutFileForLambda, } from './buildFunctions';
|
|
12
|
+
export type { ClientBuildOptionsArgs, ServerBuildOptionsArgs, } from './buildFunctions';
|
|
13
|
+
export { generateLambdaConfig, validateDeployment, } from './generateLambdaConfig';
|
|
14
14
|
//# sourceMappingURL=utilsAwsLambda.d.ts.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateDeployment = exports.generateLambdaConfig = exports.getOutFileForLambda = exports.getOutDirForLambda = exports.buildFunctions = exports.defaultBuildOptions = exports.deployFunctions = exports.deployFunction = exports.RouteType = exports.generateFunctionName = exports.readLambdaConfig = void 0;
|
|
4
|
-
var collectLambdasFromFiles_1 = require("./generate/collectLambdasFromFiles");
|
|
5
|
-
Object.defineProperty(exports, "readLambdaConfig", { enumerable: true, get: function () { return collectLambdasFromFiles_1.readLambdaConfig; } });
|
|
6
|
-
var generateFunctionName_1 = require("./generate/generateFunctionName");
|
|
7
|
-
Object.defineProperty(exports, "generateFunctionName", { enumerable: true, get: function () { return generateFunctionName_1.generateFunctionName; } });
|
|
8
|
-
var LambdaConfig_1 = require("./types/LambdaConfig");
|
|
9
|
-
Object.defineProperty(exports, "RouteType", { enumerable: true, get: function () { return LambdaConfig_1.RouteType; } });
|
|
10
|
-
var deployFunction_1 = require("./deployFunction");
|
|
11
|
-
Object.defineProperty(exports, "deployFunction", { enumerable: true, get: function () { return deployFunction_1.deployFunction; } });
|
|
12
|
-
var deployFunctions_1 = require("./deployFunctions");
|
|
13
|
-
Object.defineProperty(exports, "deployFunctions", { enumerable: true, get: function () { return deployFunctions_1.deployFunctions; } });
|
|
14
|
-
var defaultBuildOptions_1 = require("./defaultBuildOptions");
|
|
15
|
-
Object.defineProperty(exports, "defaultBuildOptions", { enumerable: true, get: function () { return defaultBuildOptions_1.defaultBuildOptions; } });
|
|
16
|
-
var buildFunctions_1 = require("./buildFunctions");
|
|
17
|
-
Object.defineProperty(exports, "buildFunctions", { enumerable: true, get: function () { return buildFunctions_1.buildFunctions; } });
|
|
18
|
-
Object.defineProperty(exports, "getOutDirForLambda", { enumerable: true, get: function () { return buildFunctions_1.getOutDirForLambda; } });
|
|
19
|
-
Object.defineProperty(exports, "getOutFileForLambda", { enumerable: true, get: function () { return buildFunctions_1.getOutFileForLambda; } });
|
|
20
|
-
var generateLambdaConfig_1 = require("./generateLambdaConfig");
|
|
21
|
-
Object.defineProperty(exports, "generateLambdaConfig", { enumerable: true, get: function () { return generateLambdaConfig_1.generateLambdaConfig; } });
|
|
22
|
-
Object.defineProperty(exports, "validateDeployment", { enumerable: true, get: function () { return generateLambdaConfig_1.validateDeployment; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDeployment = exports.generateLambdaConfig = exports.getOutFileForLambda = exports.getOutDirForLambda = exports.buildFunctions = exports.defaultBuildOptions = exports.deployFunctions = exports.deployFunction = exports.RouteType = exports.generateFunctionName = exports.readLambdaConfig = void 0;
|
|
4
|
+
var collectLambdasFromFiles_1 = require("./generate/collectLambdasFromFiles");
|
|
5
|
+
Object.defineProperty(exports, "readLambdaConfig", { enumerable: true, get: function () { return collectLambdasFromFiles_1.readLambdaConfig; } });
|
|
6
|
+
var generateFunctionName_1 = require("./generate/generateFunctionName");
|
|
7
|
+
Object.defineProperty(exports, "generateFunctionName", { enumerable: true, get: function () { return generateFunctionName_1.generateFunctionName; } });
|
|
8
|
+
var LambdaConfig_1 = require("./types/LambdaConfig");
|
|
9
|
+
Object.defineProperty(exports, "RouteType", { enumerable: true, get: function () { return LambdaConfig_1.RouteType; } });
|
|
10
|
+
var deployFunction_1 = require("./deployFunction");
|
|
11
|
+
Object.defineProperty(exports, "deployFunction", { enumerable: true, get: function () { return deployFunction_1.deployFunction; } });
|
|
12
|
+
var deployFunctions_1 = require("./deployFunctions");
|
|
13
|
+
Object.defineProperty(exports, "deployFunctions", { enumerable: true, get: function () { return deployFunctions_1.deployFunctions; } });
|
|
14
|
+
var defaultBuildOptions_1 = require("./defaultBuildOptions");
|
|
15
|
+
Object.defineProperty(exports, "defaultBuildOptions", { enumerable: true, get: function () { return defaultBuildOptions_1.defaultBuildOptions; } });
|
|
16
|
+
var buildFunctions_1 = require("./buildFunctions");
|
|
17
|
+
Object.defineProperty(exports, "buildFunctions", { enumerable: true, get: function () { return buildFunctions_1.buildFunctions; } });
|
|
18
|
+
Object.defineProperty(exports, "getOutDirForLambda", { enumerable: true, get: function () { return buildFunctions_1.getOutDirForLambda; } });
|
|
19
|
+
Object.defineProperty(exports, "getOutFileForLambda", { enumerable: true, get: function () { return buildFunctions_1.getOutFileForLambda; } });
|
|
20
|
+
var generateLambdaConfig_1 = require("./generateLambdaConfig");
|
|
21
|
+
Object.defineProperty(exports, "generateLambdaConfig", { enumerable: true, get: function () { return generateLambdaConfig_1.generateLambdaConfig; } });
|
|
22
|
+
Object.defineProperty(exports, "validateDeployment", { enumerable: true, get: function () { return generateLambdaConfig_1.validateDeployment; } });
|
|
23
23
|
//# sourceMappingURL=utilsAwsLambda.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/utils-aws-lambda",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Utilities for deploying AWS Lambda functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@goldstack/infra-aws": "0.4.
|
|
46
|
-
"@goldstack/utils-aws-cli": "0.4.
|
|
47
|
-
"@goldstack/utils-log": "0.3.
|
|
48
|
-
"@goldstack/utils-sh": "0.5.
|
|
45
|
+
"@goldstack/infra-aws": "0.4.3",
|
|
46
|
+
"@goldstack/utils-aws-cli": "0.4.3",
|
|
47
|
+
"@goldstack/utils-log": "0.3.2",
|
|
48
|
+
"@goldstack/utils-sh": "0.5.2",
|
|
49
49
|
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.15",
|
|
50
50
|
"archiver": "^5.3.1",
|
|
51
51
|
"aws-sdk": "2.1055.0",
|
|
52
52
|
"esbuild": "^0.15.5",
|
|
53
|
-
"esbuild-css-modules-client-plugin": "0.3.
|
|
53
|
+
"esbuild-css-modules-client-plugin": "0.3.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@goldstack/utils-git": "0.2.
|
|
56
|
+
"@goldstack/utils-git": "0.2.2",
|
|
57
57
|
"@types/aws-lambda": "^8.10.88",
|
|
58
|
-
"@types/jest": "^
|
|
58
|
+
"@types/jest": "^29.0.1",
|
|
59
59
|
"@types/node": "^18.7.13",
|
|
60
60
|
"jest": "^28.1.0",
|
|
61
61
|
"rimraf": "^3.0.2",
|