@goldstack/template-lambda-http-cli 0.5.31
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/README.md +8 -0
- package/bin/template +12 -0
- package/bin/template.ts +6 -0
- package/dist/scripts/generateSchemas.d.ts +2 -0
- package/dist/scripts/generateSchemas.d.ts.map +1 -0
- package/dist/scripts/generateSchemas.js +5 -0
- package/dist/scripts/generateSchemas.js.map +1 -0
- package/dist/src/templateLambdaHttp.d.ts +3 -0
- package/dist/src/templateLambdaHttp.d.ts.map +1 -0
- package/dist/src/templateLambdaHttp.js +56 -0
- package/dist/src/templateLambdaHttp.js.map +1 -0
- package/dist/src/types/LambdaHttpPackage.d.ts +61 -0
- package/dist/src/types/LambdaHttpPackage.d.ts.map +1 -0
- package/dist/src/types/LambdaHttpPackage.js +3 -0
- package/dist/src/types/LambdaHttpPackage.js.map +1 -0
- package/docs/index.html +970 -0
- package/docs/template-configure.html +66 -0
- package/docs/template.html +106 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Goldstack Lambda Web Server Template Tools
|
|
2
|
+
|
|
3
|
+
This library contains an API and CLI for building templates that allow a Lambda to function as a web server.
|
|
4
|
+
|
|
5
|
+
The following templates make use of this library:
|
|
6
|
+
|
|
7
|
+
- [Lambda Express Template](https://docs.goldstack.party/docs/templates/lambda-express).
|
|
8
|
+
- [Lambda Express Template](https://docs.goldstack.party/docs/templates/lambda-go-gin).
|
package/bin/template
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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/templateLambdaHttp')
|
|
8
|
+
.run(process.argv)
|
|
9
|
+
.catch((e) => {
|
|
10
|
+
console.log(e);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
});
|
package/bin/template.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSchemas.d.ts","sourceRoot":"","sources":["../../scripts/generateSchemas.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_package_config_generate_1 = require("@goldstack/utils-package-config-generate");
|
|
4
|
+
(0, utils_package_config_generate_1.run)(process.argv);
|
|
5
|
+
//# sourceMappingURL=generateSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSchemas.js","sourceRoot":"","sources":["../../scripts/generateSchemas.ts"],"names":[],"mappings":";;AAAA,4FAA+D;AAE/D,IAAA,mCAAG,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateLambdaHttp.d.ts","sourceRoot":"","sources":["../../src/templateLambdaHttp.ts"],"names":[],"mappings":"AAMA,cAAc,2BAA2B,CAAC;AAO1C,eAAO,MAAM,GAAG,SAAgB,MAAM,EAAE,KAAG,QAAQ,IAAI,CAiCtD,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
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 template_lambda_cli_1 = require("@goldstack/template-lambda-cli");
|
|
25
|
+
const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
|
|
26
|
+
const utils_package_config_1 = require("@goldstack/utils-package-config");
|
|
27
|
+
__exportStar(require("./types/LambdaHttpPackage"), exports);
|
|
28
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
29
|
+
const run = async (args) => {
|
|
30
|
+
await (0, utils_cli_1.wrapCli)(async () => {
|
|
31
|
+
const argv = await (0, utils_package_1.buildCli)({
|
|
32
|
+
yargs: yargs_1.default,
|
|
33
|
+
deployCommands: (0, utils_package_1.buildDeployCommands)(),
|
|
34
|
+
infraCommands: (0, utils_terraform_1.infraCommands)(),
|
|
35
|
+
})
|
|
36
|
+
.help()
|
|
37
|
+
.parse();
|
|
38
|
+
const packageConfig = new utils_package_config_1.PackageConfig({
|
|
39
|
+
packagePath: './',
|
|
40
|
+
});
|
|
41
|
+
const config = packageConfig.getConfig();
|
|
42
|
+
const command = argv._[0];
|
|
43
|
+
const [, , , ...opArgs] = args;
|
|
44
|
+
if (command === 'infra') {
|
|
45
|
+
await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (command === 'deploy') {
|
|
49
|
+
await (0, template_lambda_cli_1.deployLambda)(packageConfig.getDeployment(opArgs[0]));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
throw new Error('Unknown command: ' + command);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
exports.run = run;
|
|
56
|
+
//# sourceMappingURL=templateLambdaHttp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateLambdaHttp.js","sourceRoot":"","sources":["../../src/templateLambdaHttp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,4DAAyE;AACzE,oDAA+C;AAC/C,gEAA2D;AAC3D,wEAA8D;AAC9D,wEAAiE;AACjE,0EAAgE;AAChE,4DAA0C;AAC1C,kDAA0B;AAMnB,MAAM,GAAG,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACzD,MAAM,IAAA,mBAAO,EAAC,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAQ,EAAC;YAC1B,KAAK,EAAL,eAAK;YACL,cAAc,EAAE,IAAA,mCAAmB,GAAE;YACrC,aAAa,EAAE,IAAA,+BAAa,GAAE;SAC/B,CAAC;aACC,IAAI,EAAE;aACN,KAAK,EAAE,CAAC;QAEX,MAAM,aAAa,GAAG,IAAI,oCAAa,CAGrC;YACA,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,EAAE,AAAD,EAAG,AAAD,EAAG,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;QAE/B,IAAI,OAAO,KAAK,OAAO,EAAE;YACvB,MAAM,IAAA,qCAAe,EAAC,MAAM,CAAC,CAAC;YAC9B,OAAO;SACR;QAED,IAAI,OAAO,KAAK,QAAQ,EAAE;YACxB,MAAM,IAAA,kCAAY,EAAC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3D,OAAO;SACR;QAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAjCW,QAAA,GAAG,OAiCd"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AWSDeployment } from '@goldstack/infra-aws';
|
|
2
|
+
import { TerraformDeployment } from '@goldstack/utils-terraform';
|
|
3
|
+
import { Deployment, DeploymentConfiguration } from '@goldstack/infra';
|
|
4
|
+
import { Package, Configuration } from '@goldstack/utils-package';
|
|
5
|
+
import { LambdaDeployment, LambdaDeploymentConfiguration, LambdaPackage } from '@goldstack/template-lambda-cli';
|
|
6
|
+
/**
|
|
7
|
+
* The domain name that the API should be deployed to (e.g. api.mysite.com)
|
|
8
|
+
*
|
|
9
|
+
* @title API Domain
|
|
10
|
+
* @pattern ^[^\s]*
|
|
11
|
+
*/
|
|
12
|
+
export declare type APIDomain = string;
|
|
13
|
+
/**
|
|
14
|
+
* The domain name of the Route 53 hosted zone that the domain for this API should be added to.
|
|
15
|
+
*
|
|
16
|
+
* @title Hosted Zone Domain
|
|
17
|
+
* @pattern ^[^\s]*
|
|
18
|
+
*/
|
|
19
|
+
export declare type HostedZoneDomain = string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional URL for an UI that should be allowed to access this server.
|
|
22
|
+
*
|
|
23
|
+
* @title CORS Header
|
|
24
|
+
* @pattern ^[^\s]*
|
|
25
|
+
*/
|
|
26
|
+
export declare type CorsHeader = string;
|
|
27
|
+
export interface ThisDeploymentConfiguration extends DeploymentConfiguration, LambdaDeploymentConfiguration {
|
|
28
|
+
apiDomain: APIDomain;
|
|
29
|
+
hostedZoneDomain: HostedZoneDomain;
|
|
30
|
+
cors?: CorsHeader;
|
|
31
|
+
}
|
|
32
|
+
export interface ThisDeployment extends Deployment, AWSDeployment, LambdaDeployment, TerraformDeployment {
|
|
33
|
+
configuration: ThisDeploymentConfiguration;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Places where the lambda should be deployed to.
|
|
37
|
+
*
|
|
38
|
+
* @title Deployments
|
|
39
|
+
*/
|
|
40
|
+
export declare type LambdaExpressDeployments = ThisDeployment[];
|
|
41
|
+
/**
|
|
42
|
+
* Configures this lambda.
|
|
43
|
+
*
|
|
44
|
+
* @title Lambda Configuration
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
export declare type ThisPackageConfiguration = Configuration;
|
|
48
|
+
/**
|
|
49
|
+
* A lambda deployment for an express server.
|
|
50
|
+
*
|
|
51
|
+
* @title Lambda Express Package
|
|
52
|
+
*/
|
|
53
|
+
export interface ThisPackage extends Package, LambdaPackage {
|
|
54
|
+
configuration: ThisPackageConfiguration;
|
|
55
|
+
deployments: LambdaExpressDeployments;
|
|
56
|
+
}
|
|
57
|
+
export { ThisDeploymentConfiguration as LambdaExpressDeploymentConfiguration };
|
|
58
|
+
export { ThisDeployment as LambdaExpressDeployment };
|
|
59
|
+
export { ThisPackageConfiguration as LambdaExpressConfiguration };
|
|
60
|
+
export { ThisPackage as LambdaExpressPackage };
|
|
61
|
+
//# sourceMappingURL=LambdaHttpPackage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LambdaHttpPackage.d.ts","sourceRoot":"","sources":["../../../src/types/LambdaHttpPackage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAEL,gBAAgB,EAChB,6BAA6B,EAE7B,aAAa,EACd,M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