@fy-stack/app-construct 0.0.147-alpha.3058 → 0.0.147-alpha.3060
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/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/ecs/apps/next-app-router-construct.d.ts.map +1 -1
- package/dist/lib/ecs/apps/next-app-router-construct.js +1 -1
- package/dist/lib/ecs/shared/taskDefinitionImage.js +1 -1
- package/dist/lib/lambda/apps/image-app-construct.d.ts.map +1 -1
- package/dist/lib/lambda/apps/image-app-construct.js +21 -7
- package/dist/lib/lambda/apps/next-app-router-construct.d.ts.map +1 -1
- package/dist/lib/lambda/apps/next-app-router-construct.js +10 -3
- package/dist/lib/lambda/apps/node-api-construct.d.ts.map +1 -1
- package/dist/lib/lambda/apps/node-api-construct.js +4 -1
- package/dist/lib/lambda/apps/node-app-construct.d.ts.map +1 -1
- package/dist/lib/lambda/apps/node-app-construct.js +4 -1
- package/dist/lib/lambda/types.d.ts +6 -2
- package/dist/lib/lambda/types.d.ts.map +1 -1
- package/dist/lib/lambda/utils/getDefaultLambda.d.ts +1 -2
- package/dist/lib/lambda/utils/getDefaultLambda.d.ts.map +1 -1
- package/dist/lib/lambda/utils/getDefaultLambda.js +1 -1
- package/dist/lib/standalone/image-app-container.d.ts +7 -0
- package/dist/lib/standalone/image-app-container.d.ts.map +1 -0
- package/dist/lib/standalone/image-app-container.js +37 -0
- package/dist/lib/standalone/next-app-router-container.d.ts +7 -0
- package/dist/lib/standalone/next-app-router-container.d.ts.map +1 -0
- package/dist/lib/standalone/next-app-router-container.js +47 -0
- package/dist/lib/standalone/types.d.ts +7 -0
- package/dist/lib/standalone/types.d.ts.map +1 -0
- package/dist/lib/standalone/types.js +2 -0
- package/dist/lib/util/constants.d.ts +32 -0
- package/dist/lib/util/constants.d.ts.map +1 -0
- package/dist/lib/util/constants.js +10 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ImageAppContainer } from './lib/
|
|
2
|
-
export { NextAppRouterContainer } from './lib/
|
|
1
|
+
export { ImageAppContainer } from './lib/standalone/image-app-container';
|
|
2
|
+
export { NextAppRouterContainer } from './lib/standalone/next-app-router-container';
|
|
3
3
|
export { EcsConstruct } from './lib/ecs/ecs-construct';
|
|
4
4
|
export type { EcsConstructProps } from './lib/ecs/types';
|
|
5
5
|
export { LambdaConstruct } from './lib/lambda/lambda-construct';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StaticConstruct = exports.lambdaGrant = exports.lambdaAttach = exports.LambdaConstruct = exports.EcsConstruct = exports.NextAppRouterContainer = exports.ImageAppContainer = void 0;
|
|
4
|
-
var image_app_container_1 = require("./lib/
|
|
4
|
+
var image_app_container_1 = require("./lib/standalone/image-app-container");
|
|
5
5
|
Object.defineProperty(exports, "ImageAppContainer", { enumerable: true, get: function () { return image_app_container_1.ImageAppContainer; } });
|
|
6
|
-
var next_app_router_container_1 = require("./lib/
|
|
6
|
+
var next_app_router_container_1 = require("./lib/standalone/next-app-router-container");
|
|
7
7
|
Object.defineProperty(exports, "NextAppRouterContainer", { enumerable: true, get: function () { return next_app_router_container_1.NextAppRouterContainer; } });
|
|
8
8
|
var ecs_construct_1 = require("./lib/ecs/ecs-construct");
|
|
9
9
|
Object.defineProperty(exports, "EcsConstruct", { enumerable: true, get: function () { return ecs_construct_1.EcsConstruct; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/next-app-router-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,K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AAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAO7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
|
|
@@ -7,7 +7,7 @@ const constructs_1 = require("constructs");
|
|
|
7
7
|
const next_app_router_1 = require("../../shared/next-app-router");
|
|
8
8
|
const params_from_attachable_1 = require("../../util/params-from-attachable");
|
|
9
9
|
const taskDefinitionImage_1 = require("../shared/taskDefinitionImage");
|
|
10
|
-
const constants_1 = require("
|
|
10
|
+
const constants_1 = require("../../util/constants");
|
|
11
11
|
const zod_1 = require("zod");
|
|
12
12
|
const params_from_ssm_1 = require("../../util/params-from-ssm");
|
|
13
13
|
const NextAppRouterContainerAppShema = constants_1.ContainerAppSchema.extend({
|
|
@@ -7,7 +7,7 @@ const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
|
|
|
7
7
|
const ecrAssets = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr-assets"));
|
|
8
8
|
const ecs = tslib_1.__importStar(require("aws-cdk-lib/aws-ecs"));
|
|
9
9
|
const params_from_ssm_1 = require("../../util/params-from-ssm");
|
|
10
|
-
const constants_1 = require("
|
|
10
|
+
const constants_1 = require("../../util/constants");
|
|
11
11
|
function taskDefinitionImage(scope, id, props) {
|
|
12
12
|
let image;
|
|
13
13
|
let containerProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"image-app-construct.d.ts","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C,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;;;;;;;;;;CAG7B"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ImageAppConstruct = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
6
|
const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront");
|
|
6
7
|
const aws_cloudfront_origins_1 = require("aws-cdk-lib/aws-cloudfront-origins");
|
|
7
8
|
const aws_ecr_assets_1 = require("aws-cdk-lib/aws-ecr-assets");
|
|
9
|
+
const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
|
|
8
10
|
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
9
11
|
const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources");
|
|
10
12
|
const aws_sns_subscriptions_1 = require("aws-cdk-lib/aws-sns-subscriptions");
|
|
@@ -15,6 +17,8 @@ const getDefaultLambda_1 = require("../utils/getDefaultLambda");
|
|
|
15
17
|
const lambda_api_1 = require("../utils/lambda-api");
|
|
16
18
|
const lambda_attach_1 = require("../utils/lambda-attach");
|
|
17
19
|
const lambda_grant_1 = require("../utils/lambda-grant");
|
|
20
|
+
const params_from_ssm_1 = require("../../util/params-from-ssm");
|
|
21
|
+
const constants_1 = require("../../util/constants");
|
|
18
22
|
const BuildParamsSchema = zod_1.z
|
|
19
23
|
.object({
|
|
20
24
|
container: zod_1.z
|
|
@@ -32,12 +36,24 @@ class ImageAppConstruct extends constructs_1.Construct {
|
|
|
32
36
|
constructor(scope, id, props) {
|
|
33
37
|
super(scope, id);
|
|
34
38
|
const { container, ...functionProps } = props.buildParams;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
let code;
|
|
40
|
+
if ('reference' in props) {
|
|
41
|
+
const params = (0, params_from_ssm_1.paramsFromSSM)(this, props.reference, constants_1.ContainerAppSchema);
|
|
42
|
+
const repository = ecr.Repository.fromRepositoryName(this, 'Repo', params.repository);
|
|
43
|
+
code = aws_lambda_1.Code.fromEcrImage(repository, {
|
|
44
|
+
tagOrDigest: params.tag,
|
|
45
|
+
cmd: container?.cmd,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
code = aws_lambda_1.Code.fromAssetImage(props.output, {
|
|
38
50
|
platform: aws_ecr_assets_1.Platform.LINUX_AMD64,
|
|
39
51
|
...container,
|
|
40
|
-
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
this.function = new aws_lambda_1.Function(this, `AppFunction`, {
|
|
55
|
+
...(0, getDefaultLambda_1.getDefaultLambda)(props),
|
|
56
|
+
code,
|
|
41
57
|
handler: aws_lambda_1.Handler.FROM_IMAGE,
|
|
42
58
|
runtime: aws_lambda_1.Runtime.FROM_IMAGE,
|
|
43
59
|
...functionProps,
|
|
@@ -49,9 +65,7 @@ class ImageAppConstruct extends constructs_1.Construct {
|
|
|
49
65
|
aws_cdk_lib_1.Duration.seconds((props.timeout ?? 30) + 30),
|
|
50
66
|
...queueProps,
|
|
51
67
|
});
|
|
52
|
-
this.function.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(this.queue, {
|
|
53
|
-
batchSize,
|
|
54
|
-
}));
|
|
68
|
+
this.function.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(this.queue, { batchSize }));
|
|
55
69
|
}
|
|
56
70
|
}
|
|
57
71
|
attach(attachable) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/next-app-router-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,i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MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKvD,QAAA,MAAM,iBAAiB;;;;;;gCAA8C,CAAC;AAEtE,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,YAAY;IACpE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAG9B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IA6CzD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAkBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IA8F3D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;IAIlC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;CAG7B"}
|
|
@@ -24,6 +24,9 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
24
24
|
files;
|
|
25
25
|
constructor(scope, id, props) {
|
|
26
26
|
super(scope, id);
|
|
27
|
+
if (!('output' in props)) {
|
|
28
|
+
throw new Error('Output is required');
|
|
29
|
+
}
|
|
27
30
|
const region = cdk.Stack.of(this).region;
|
|
28
31
|
const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
|
|
29
32
|
this.static = deployment.staticBucket;
|
|
@@ -38,7 +41,7 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
38
41
|
const { cmd, ...functionProps } = props.buildParams;
|
|
39
42
|
const serverOutput = path.join(props.output, '/.next/standalone');
|
|
40
43
|
fs.writeFileSync(path.join(serverOutput, 'run.sh'), cmd);
|
|
41
|
-
const defaultProps = (0, getDefaultLambda_1.getDefaultLambda)(
|
|
44
|
+
const defaultProps = (0, getDefaultLambda_1.getDefaultLambda)(props);
|
|
42
45
|
this.function = new lambda.Function(this, `AppFunction`, {
|
|
43
46
|
...defaultProps,
|
|
44
47
|
environment: Object.assign({}, defaultProps.environment, environment),
|
|
@@ -71,7 +74,9 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
71
74
|
const deployment = new s3Deploy.BucketDeployment(this, `${strippedBasePath}StaticDeployment`, {
|
|
72
75
|
destinationBucket: this.static,
|
|
73
76
|
sources: [staticFiles],
|
|
74
|
-
destinationKeyPrefix:
|
|
77
|
+
destinationKeyPrefix: strippedBasePath
|
|
78
|
+
? `${strippedBasePath}/_next/static/`
|
|
79
|
+
: '_next/static/',
|
|
75
80
|
retainOnDelete: false,
|
|
76
81
|
});
|
|
77
82
|
if (this.files.staticFiles.deployment) {
|
|
@@ -83,7 +88,9 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
83
88
|
const deployment = new s3Deploy.BucketDeployment(this, `${strippedBasePath}PublicDeployment`, {
|
|
84
89
|
destinationBucket: this.static,
|
|
85
90
|
sources: [publicFiles],
|
|
86
|
-
destinationKeyPrefix:
|
|
91
|
+
destinationKeyPrefix: strippedBasePath
|
|
92
|
+
? `${strippedBasePath}/`
|
|
93
|
+
: undefined,
|
|
87
94
|
retainOnDelete: false,
|
|
88
95
|
});
|
|
89
96
|
if (this.files.publicFiles.deployment) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-api-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/node-api-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMvD,QAAA,MAAM,iBAAiB;;;;;;gCAA8C,CAAC;AAEtE,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAGlC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"node-api-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/node-api-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMvD,QAAA,MAAM,iBAAiB;;;;;;gCAA8C,CAAC;AAEtE,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAGlC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAmDzD,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAI1D,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;IAqBvB,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM;;;IAIhB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;CAG7B"}
|
|
@@ -22,6 +22,9 @@ class NodeApiConstruct extends constructs_1.Construct {
|
|
|
22
22
|
queue;
|
|
23
23
|
constructor(scope, id, props) {
|
|
24
24
|
super(scope, id);
|
|
25
|
+
if (!('output' in props)) {
|
|
26
|
+
throw new Error('Output is required');
|
|
27
|
+
}
|
|
25
28
|
const region = cdk.Stack.of(this).region;
|
|
26
29
|
const environment = {
|
|
27
30
|
AWS_LAMBDA_EXEC_WRAPPER: '/opt/bootstrap',
|
|
@@ -33,7 +36,7 @@ class NodeApiConstruct extends constructs_1.Construct {
|
|
|
33
36
|
];
|
|
34
37
|
const { cmd, ...functionProps } = props.buildParams;
|
|
35
38
|
node_fs_1.default.writeFileSync(node_path_1.default.join(props.output, 'run.sh'), cmd);
|
|
36
|
-
const defaultProps = (0, getDefaultLambda_1.getDefaultLambda)(
|
|
39
|
+
const defaultProps = (0, getDefaultLambda_1.getDefaultLambda)(props);
|
|
37
40
|
this.function = new lambda.Function(this, `AppFunction`, {
|
|
38
41
|
...defaultProps,
|
|
39
42
|
environment: Object.assign({}, defaultProps.environment, environment),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/node-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKvD,QAAA,MAAM,iBAAiB;;;;;;gCAEP,CAAC;AAEjB,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAGlC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"node-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AAC,MAAM,EAAE,oBAAoB,CAAC;IAcvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;CAG7B"}
|
|
@@ -21,8 +21,11 @@ class NodeAppConstruct extends constructs_1.Construct {
|
|
|
21
21
|
queue;
|
|
22
22
|
constructor(scope, id, props) {
|
|
23
23
|
super(scope, id);
|
|
24
|
+
if (!('output' in props)) {
|
|
25
|
+
throw new Error('Output is required');
|
|
26
|
+
}
|
|
24
27
|
this.function = new lambda.Function(this, `AppFunction`, {
|
|
25
|
-
...(0, getDefaultLambda_1.getDefaultLambda)(
|
|
28
|
+
...(0, getDefaultLambda_1.getDefaultLambda)(props),
|
|
26
29
|
runtime: lambda.Runtime.NODEJS_20_X,
|
|
27
30
|
handler: props.buildParams.handler ?? 'index.handler',
|
|
28
31
|
code: lambda.Code.fromAsset(props.output),
|
|
@@ -15,6 +15,11 @@ export interface AppConstruct extends Attach, Grant, CDNResource, EventResource,
|
|
|
15
15
|
export type App = {
|
|
16
16
|
type: typeof AppType.IMAGE_APP | typeof AppType.NEXT_APP_ROUTER | typeof AppType.NODE_APP | typeof AppType.NODE_API;
|
|
17
17
|
} & Omit<AppProperties, 'vpc' | 'logGroup'>;
|
|
18
|
+
export type AppResource = {
|
|
19
|
+
output: string;
|
|
20
|
+
} | {
|
|
21
|
+
reference: string;
|
|
22
|
+
};
|
|
18
23
|
export type AppProperties<BuildParams = Record<string, unknown>> = {
|
|
19
24
|
logGroup: ILogGroup;
|
|
20
25
|
queue?: {
|
|
@@ -23,7 +28,6 @@ export type AppProperties<BuildParams = Record<string, unknown>> = {
|
|
|
23
28
|
env?: Record<string, string>;
|
|
24
29
|
timeout?: number;
|
|
25
30
|
buildParams: BuildParams & Partial<FunctionProps>;
|
|
26
|
-
output: string;
|
|
27
31
|
vpc?: IVpc | (() => IVpc);
|
|
28
|
-
};
|
|
32
|
+
} & AppResource;
|
|
29
33
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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AAI,CAAC,aAAa,EAAE,KAAK,GAAG,UAAU,CAAC,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,aAAa,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACjE,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAClD,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;CAC3B,GAAG,WAAW,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FunctionProps } from 'aws-cdk-lib/aws-lambda';
|
|
2
|
-
import type { Construct } from 'constructs';
|
|
3
2
|
import { AppProperties } from '../types';
|
|
4
|
-
export declare function getDefaultLambda(
|
|
3
|
+
export declare function getDefaultLambda(props: AppProperties<unknown>): Partial<FunctionProps>;
|
|
5
4
|
//# sourceMappingURL=getDefaultLambda.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDefaultLambda.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/utils/getDefaultLambda.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAiB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"getDefaultLambda.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/utils/getDefaultLambda.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAiB,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,0BAe7D"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDefaultLambda = getDefaultLambda;
|
|
4
4
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
5
|
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
6
|
-
function getDefaultLambda(
|
|
6
|
+
function getDefaultLambda(props) {
|
|
7
7
|
let params = {
|
|
8
8
|
memorySize: 512,
|
|
9
9
|
timeout: aws_cdk_lib_1.Duration.seconds(props.timeout ?? 30),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import type { StandaloneContainer } from './types';
|
|
3
|
+
export type ImageAppProps = StandaloneContainer;
|
|
4
|
+
export declare class ImageAppContainer extends Construct {
|
|
5
|
+
constructor(scope: Construct, id: string, props: ImageAppProps);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=image-app-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-app-container.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/image-app-container.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;CA+B/D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageAppContainer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
6
|
+
const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
|
|
7
|
+
const ecrAssets = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr-assets"));
|
|
8
|
+
const ssm = tslib_1.__importStar(require("aws-cdk-lib/aws-ssm"));
|
|
9
|
+
const ecrDeployment = tslib_1.__importStar(require("cdk-ecr-deployment"));
|
|
10
|
+
const constructs_1 = require("constructs");
|
|
11
|
+
class ImageAppContainer extends constructs_1.Construct {
|
|
12
|
+
constructor(scope, id, props) {
|
|
13
|
+
super(scope, id);
|
|
14
|
+
const stackName = cdk.Stack.of(this).stackName;
|
|
15
|
+
const repo = new ecr.Repository(this, 'Repository', {
|
|
16
|
+
emptyOnDelete: true,
|
|
17
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
18
|
+
});
|
|
19
|
+
const container = new ecrAssets.DockerImageAsset(this, 'ContainerAsset', {
|
|
20
|
+
directory: props.output,
|
|
21
|
+
platform: ecrAssets.Platform.LINUX_AMD64,
|
|
22
|
+
...props.container,
|
|
23
|
+
});
|
|
24
|
+
new ecrDeployment.ECRDeployment(this, 'DeployedContainer', {
|
|
25
|
+
src: new ecrDeployment.DockerImageName(container.imageUri),
|
|
26
|
+
dest: new ecrDeployment.DockerImageName(cdk.Fn.join(':', [repo.repositoryUri, props.version])),
|
|
27
|
+
});
|
|
28
|
+
new ssm.StringParameter(this, 'OutputParams', {
|
|
29
|
+
parameterName: stackName,
|
|
30
|
+
stringValue: JSON.stringify({
|
|
31
|
+
repository: repo.repositoryName,
|
|
32
|
+
tag: props.version,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ImageAppContainer = ImageAppContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import type { StandaloneContainer } from './types';
|
|
3
|
+
export type NextAppRouterProps = StandaloneContainer;
|
|
4
|
+
export declare class NextAppRouterContainer extends Construct {
|
|
5
|
+
constructor(scope: Construct, id: string, props: NextAppRouterProps);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=next-app-router-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-app-router-container.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/next-app-router-container.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAErD,qBAAa,sBAAuB,SAAQ,SAAS;gBACvC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAyCpE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextAppRouterContainer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
6
|
+
const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
|
|
7
|
+
const ecrAssets = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr-assets"));
|
|
8
|
+
const ssm = tslib_1.__importStar(require("aws-cdk-lib/aws-ssm"));
|
|
9
|
+
const ecrDeployment = tslib_1.__importStar(require("cdk-ecr-deployment"));
|
|
10
|
+
const constructs_1 = require("constructs");
|
|
11
|
+
const next_app_router_1 = require("../shared/next-app-router");
|
|
12
|
+
class NextAppRouterContainer extends constructs_1.Construct {
|
|
13
|
+
constructor(scope, id, props) {
|
|
14
|
+
super(scope, id);
|
|
15
|
+
const stackName = cdk.Stack.of(this).stackName;
|
|
16
|
+
const repo = new ecr.Repository(this, 'Repository', {
|
|
17
|
+
emptyOnDelete: true,
|
|
18
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
19
|
+
});
|
|
20
|
+
const container = new ecrAssets.DockerImageAsset(this, 'ContainerAsset', {
|
|
21
|
+
directory: props.output,
|
|
22
|
+
platform: ecrAssets.Platform.LINUX_AMD64,
|
|
23
|
+
...props.container,
|
|
24
|
+
});
|
|
25
|
+
const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
|
|
26
|
+
new ecrDeployment.ECRDeployment(this, 'DeployedContainer', {
|
|
27
|
+
src: new ecrDeployment.DockerImageName(container.imageUri),
|
|
28
|
+
dest: new ecrDeployment.DockerImageName(cdk.Fn.join(':', [repo.repositoryUri, props.version])),
|
|
29
|
+
});
|
|
30
|
+
new ssm.StringParameter(this, 'OutputParams', {
|
|
31
|
+
parameterName: stackName,
|
|
32
|
+
stringValue: JSON.stringify({
|
|
33
|
+
repository: repo.repositoryName,
|
|
34
|
+
tag: props.version,
|
|
35
|
+
files: {
|
|
36
|
+
staticFiles: {
|
|
37
|
+
key: deployment.files.staticFiles.key,
|
|
38
|
+
},
|
|
39
|
+
publicFiles: {
|
|
40
|
+
key: deployment.files.publicFiles.key,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.NextAppRouterContainer = NextAppRouterContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ContainerAppFileSchema: z.ZodObject<{
|
|
3
|
+
key: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
key: string;
|
|
6
|
+
}, {
|
|
7
|
+
key: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ContainerAppSchema: z.ZodObject<{
|
|
10
|
+
repository: z.ZodString;
|
|
11
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
12
|
+
files: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
|
+
key: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
key: string;
|
|
16
|
+
}, {
|
|
17
|
+
key: string;
|
|
18
|
+
}>>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
repository: string;
|
|
21
|
+
tag?: string | undefined;
|
|
22
|
+
files?: Record<string, {
|
|
23
|
+
key: string;
|
|
24
|
+
}> | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
repository: string;
|
|
27
|
+
tag?: string | undefined;
|
|
28
|
+
files?: Record<string, {
|
|
29
|
+
key: string;
|
|
30
|
+
}> | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/util/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;;EAAgC,CAAC;AAEpE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;EAI7B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContainerAppSchema = exports.ContainerAppFileSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.ContainerAppFileSchema = zod_1.z.object({ key: zod_1.z.string() });
|
|
6
|
+
exports.ContainerAppSchema = zod_1.z.object({
|
|
7
|
+
repository: zod_1.z.string(),
|
|
8
|
+
tag: zod_1.z.string().optional(),
|
|
9
|
+
files: zod_1.z.record(zod_1.z.string(), exports.ContainerAppFileSchema).optional(),
|
|
10
|
+
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-stack/app-construct",
|
|
3
|
-
"version": "0.0.147-alpha.
|
|
3
|
+
"version": "0.0.147-alpha.3060",
|
|
4
4
|
"repository": "https://github.com/festusyuma/fy-stack",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@fy-stack/types": "0.0.147-alpha.
|
|
6
|
+
"@fy-stack/types": "0.0.147-alpha.3060",
|
|
7
7
|
"tslib": "^2.3.0",
|
|
8
8
|
"zod": "^4.3.6"
|
|
9
9
|
},
|