@fy-stack/app-construct 0.0.146 → 0.0.147-0-preview

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.
Files changed (36) hide show
  1. package/dist/lib/ecs/apps/image-app-construct.d.ts.map +1 -1
  2. package/dist/lib/ecs/apps/image-app-construct.js +1 -8
  3. package/dist/lib/ecs/apps/next-app-router-construct.d.ts.map +1 -1
  4. package/dist/lib/ecs/apps/next-app-router-construct.js +1 -8
  5. package/dist/lib/ecs/apps/task-construct.d.ts.map +1 -1
  6. package/dist/lib/ecs/apps/task-construct.js +2 -1
  7. package/dist/lib/ecs/ecs-construct.d.ts.map +1 -1
  8. package/dist/lib/ecs/ecs-construct.js +3 -0
  9. package/dist/lib/ecs/ecs-server-construct.d.ts +2 -0
  10. package/dist/lib/ecs/ecs-server-construct.d.ts.map +1 -1
  11. package/dist/lib/ecs/ecs-server-construct.js +1 -1
  12. package/dist/lib/ecs/shared/taskDefinitionImage.d.ts +3 -2
  13. package/dist/lib/ecs/shared/taskDefinitionImage.d.ts.map +1 -1
  14. package/dist/lib/ecs/shared/taskDefinitionImage.js +2 -1
  15. package/dist/lib/ecs/types.d.ts +5 -1
  16. package/dist/lib/ecs/types.d.ts.map +1 -1
  17. package/dist/lib/lambda/apps/image-app-construct.d.ts +10 -10
  18. package/dist/lib/lambda/apps/image-app-construct.d.ts.map +1 -1
  19. package/dist/lib/lambda/apps/image-app-construct.js +11 -5
  20. package/dist/lib/lambda/apps/next-app-router-construct.d.ts +8 -8
  21. package/dist/lib/lambda/apps/next-app-router-construct.d.ts.map +1 -1
  22. package/dist/lib/lambda/apps/next-app-router-construct.js +8 -9
  23. package/dist/lib/lambda/apps/node-api-construct.d.ts +8 -8
  24. package/dist/lib/lambda/apps/node-api-construct.d.ts.map +1 -1
  25. package/dist/lib/lambda/apps/node-api-construct.js +14 -15
  26. package/dist/lib/lambda/apps/node-app-construct.d.ts +8 -8
  27. package/dist/lib/lambda/apps/node-app-construct.d.ts.map +1 -1
  28. package/dist/lib/lambda/apps/node-app-construct.js +21 -20
  29. package/dist/lib/lambda/lambda-construct.d.ts.map +1 -1
  30. package/dist/lib/lambda/lambda-construct.js +1 -0
  31. package/dist/lib/lambda/types.d.ts +8 -11
  32. package/dist/lib/lambda/types.d.ts.map +1 -1
  33. package/dist/lib/lambda/utils/getDefaultLambda.d.ts +3 -6
  34. package/dist/lib/lambda/utils/getDefaultLambda.d.ts.map +1 -1
  35. package/dist/lib/lambda/utils/getDefaultLambda.js +7 -2
  36. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,YAAY;IAMpE,OAAO,CAAC,KAAK;IALR,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;gBAGxC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAcvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAOpD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAyBzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
1
+ {"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,YAAY;IAMpE,OAAO,CAAC,KAAK;IALR,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;gBAGxC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAMvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAOpD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAyBzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
@@ -11,14 +11,7 @@ class ImageAppConstruct extends constructs_1.Construct {
11
11
  constructor(scope, id, props) {
12
12
  super(scope, id);
13
13
  this.props = props;
14
- this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(`${props.appName}AppContainer`, {
15
- taskDefinition: props.taskDefinition,
16
- port: props.port,
17
- env: props.env,
18
- output: props.output,
19
- container: props.container,
20
- environmentPath: props.environmentPath,
21
- });
14
+ this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(`${props.appName}AppContainer`, props);
22
15
  }
23
16
  attach(attachable) {
24
17
  const params = Object.assign({}, ...(0, params_from_attachable_1.paramsFromAttachable)(attachable));
@@ -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,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AASvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,KAAK,kBAAkB,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;AAEjD,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,YAAY;IAOjC,OAAO,CAAC,KAAK;IANhD,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;IACnC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAEpB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAU,KAAK,EAAE,kBAAkB;IAiB3E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAcpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,M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AAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAO7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
@@ -17,14 +17,7 @@ class NextAppRouterConstruct extends constructs_1.Construct {
17
17
  const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
18
18
  this.static = deployment.staticBucket;
19
19
  this.files = deployment.files;
20
- this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(`${props.appName}AppContainer`, {
21
- taskDefinition: props.taskDefinition,
22
- port: props.port,
23
- env: props.env,
24
- output: props.output,
25
- container: props.container,
26
- environmentPath: props.environmentPath,
27
- });
20
+ this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(`${props.appName}AppContainer`, props);
28
21
  }
29
22
  cloudfront(path) {
30
23
  const { origin, basePath } = this.props.serverOrigin(this.props.port, this.container.containerName, path, '/');
@@ -1 +1 @@
1
- {"version":3,"file":"task-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/task-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,KAAK,EACL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAI3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,aACX,SAAQ,SACR,YAAW,aAAa,EAAE,KAAK,EAAE,MAAM;IAOrC,OAAO,CAAC,KAAK;IALR,UAAU,EAAE,GAAG,CAAC,qBAAqB,CAAC;gBAG3C,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,mBAAmB;IAgCpC,YAAY,CACV,KAAK,EAAE,eAAe,CAAC,iBAAiB,GACvC,GAAG,CAAC,kBAAkB;IA6CzB,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAMvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAS7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
1
+ {"version":3,"file":"task-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/task-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,KAAK,EACL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAI3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,aACX,SAAQ,SACR,YAAW,aAAa,EAAE,KAAK,EAAE,MAAM;IAOrC,OAAO,CAAC,KAAK;IALR,UAAU,EAAE,GAAG,CAAC,qBAAqB,CAAC;gBAG3C,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,mBAAmB;IAiCpC,YAAY,CACV,KAAK,EAAE,eAAe,CAAC,iBAAiB,GACvC,GAAG,CAAC,kBAAkB;IA6CzB,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAMvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAS7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
@@ -34,8 +34,9 @@ class TaskConstruct extends constructs_1.Construct {
34
34
  ...imageProps,
35
35
  }),
36
36
  logging: new ecs.AwsLogDriver({
37
- streamPrefix: `${id}/task-runner`,
37
+ streamPrefix: `${props.taskName}TaskContainer`,
38
38
  logRetention: logDuration ?? logs.RetentionDays.ONE_DAY,
39
+ logGroup: props.logGroup,
39
40
  }),
40
41
  ...containerProps,
41
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ecs-construct.d.ts","sourceRoot":"","sources":["../../../src/lib/ecs/ecs-construct.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,qBAAa,YAAa,SAAQ,SAAS;IAClC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAM;gBAErC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAqCnE"}
1
+ {"version":3,"file":"ecs-construct.d.ts","sourceRoot":"","sources":["../../../src/lib/ecs/ecs-construct.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,qBAAa,YAAa,SAAQ,SAAS;IAClC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAM;gBAErC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAwCnE"}
@@ -18,6 +18,7 @@ class EcsConstruct extends constructs_1.Construct {
18
18
  if (props.server) {
19
19
  this.server = new ecs_server_construct_1.EcsServerConstruct(this, 'Server', {
20
20
  ...props.server,
21
+ logGroup: props.logGroup,
21
22
  cluster: appCluster,
22
23
  environmentPath: props.environmentPath,
23
24
  environment: props.environment,
@@ -29,6 +30,8 @@ class EcsConstruct extends constructs_1.Construct {
29
30
  return [
30
31
  key,
31
32
  new task_construct_1.TaskConstruct(this, `${key}Task`, {
33
+ logGroup: props.logGroup,
34
+ taskName: key,
32
35
  buildParams: task_construct_1.TaskConstruct.parse(app.buildParams ?? {}),
33
36
  cluster: appCluster,
34
37
  vpc: props.vpc,
@@ -2,10 +2,12 @@ import { Grant, Grantable } from '@fy-stack/types';
2
2
  import * as ec2 from 'aws-cdk-lib/aws-ec2';
3
3
  import * as ecs from 'aws-cdk-lib/aws-ecs';
4
4
  import * as elbV2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
5
+ import type { LogGroup } from 'aws-cdk-lib/aws-logs';
5
6
  import { Construct } from 'constructs';
6
7
  import { AppConstruct, EcsConstructProps } from './types';
7
8
  type EcsServerConstructProps = EcsConstructProps['server'] & {
8
9
  vpc: ec2.IVpc;
10
+ logGroup: LogGroup;
9
11
  environmentPath: string;
10
12
  environment: string;
11
13
  cluster: ecs.Cluster;
@@ -1 +1 @@
1
- {"version":3,"file":"ecs-server-construct.d.ts","sourceRoot":"","sources":["../../../src/lib/ecs/ecs-server-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,EAAE,SAAS,EAAgB,MAAM,iBAAiB,CAAC;AAG1E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAO1D,KAAK,uBAAuB,GAAG,iBAAiB,CAA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1D,KAAK,uBAAuB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG;IAC3D,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;CACtB,CAAC;AAEF,qBAAa,kBAAmB,SAAQ,SAAU,YAAW,KAAK;IAa9D,OAAO,CAAC,KAAK;IAZR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAM;IACxC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC;IAEzB,YAAY,CAAC,EAAE;QACpB,GAAG,EAAE,KAAK,CAAC,wBAAwB,CAAC;QACpC,QAAQ,EAAE,KAAK,CAAC,oBAAoB,CAAC;KACtC,CAAC;gBAGA,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,uBAAuB;IAwExC,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAMvC,OAAO,CAAC,YAAY;IA8CpB,gBAAgB;;;;IAuChB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CA+CxC"}
@@ -53,7 +53,6 @@ class EcsServerConstruct extends constructs_1.Construct {
53
53
  propagateTags: ecs.PropagatedTagSource.SERVICE,
54
54
  ...serverProps,
55
55
  });
56
- this.service.connections.securityGroups[0].securityGroupId;
57
56
  const serverOrigin = (port, containerName, appPath, healthPath) => this.serverOrigin(this.service, port, containerName, appPath, healthPath);
58
57
  serverOrigin.bind(this);
59
58
  Object.assign(this.apps, Object.fromEntries(Object.entries(apps).map(([key, app]) => {
@@ -62,6 +61,7 @@ class EcsServerConstruct extends constructs_1.Construct {
62
61
  key,
63
62
  new AppTypeConstruct(this, `${key}App`, {
64
63
  appName: key,
64
+ logGroup: props.logGroup,
65
65
  environmentPath: props.environmentPath,
66
66
  buildParams: AppTypeConstruct.parse(app.buildParams ?? {}),
67
67
  serverOrigin,
@@ -1,12 +1,13 @@
1
1
  import * as ecs from 'aws-cdk-lib/aws-ecs';
2
- import { AppProperties } from '../types';
2
+ import type { LogGroup } from 'aws-cdk-lib/aws-logs';
3
+ import type { AppProperties } from '../types';
3
4
  type Props = {
4
5
  output: string;
6
+ logGroup: LogGroup;
5
7
  taskDefinition: ecs.TaskDefinition;
6
8
  env?: Record<string, string>;
7
9
  port: number;
8
10
  container?: AppProperties['container'];
9
- environmentPath: string;
10
11
  };
11
12
  export declare function taskDefinitionImage(id: string, props: Props): ecs.ContainerDefinition;
12
13
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"taskDefinitionImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/shared/taskDefinitionImage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,2BAmB3D"}
1
+ {"version":3,"file":"taskDefinitionImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/shared/taskDefinitionImage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,2BAoB3D"}
@@ -14,8 +14,9 @@ function taskDefinitionImage(id, props) {
14
14
  ...(image ?? {}),
15
15
  }),
16
16
  logging: new ecs.AwsLogDriver({
17
- streamPrefix: `${props.environmentPath}/${id}`,
17
+ streamPrefix: id,
18
18
  logRetention: logDuration ?? logs.RetentionDays.ONE_DAY,
19
+ logGroup: props.logGroup,
19
20
  }),
20
21
  environment: {
21
22
  ...(props.env ?? {}),
@@ -4,8 +4,9 @@ import type { LoadBalancerV2Origin } from 'aws-cdk-lib/aws-cloudfront-origins';
4
4
  import type { IVpc } from 'aws-cdk-lib/aws-ec2';
5
5
  import type { AssetImageProps, Cluster, ContainerDefinitionOptions, FargateServiceProps, FargateTaskDefinitionProps, TaskDefinition } from 'aws-cdk-lib/aws-ecs';
6
6
  import type { ApplicationLoadBalancerProps } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
7
- import type { RetentionDays } from 'aws-cdk-lib/aws-logs';
7
+ import type { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
8
8
  export type EcsConstructProps = {
9
+ logGroup: LogGroup;
9
10
  environmentPath: string;
10
11
  environment: string;
11
12
  vpc: IVpc;
@@ -59,6 +60,7 @@ export type TaskApp = {
59
60
  export type AppProperties<BuildParams = Record<string, unknown>> = {
60
61
  appName: string;
61
62
  environmentPath: string;
63
+ logGroup: LogGroup;
62
64
  taskDefinition: TaskDefinition;
63
65
  env?: Record<string, string>;
64
66
  buildParams: BuildParams;
@@ -75,6 +77,8 @@ export type AppProperties<BuildParams = Record<string, unknown>> = {
75
77
  };
76
78
  export type TaskConstructsProps = FargateTaskDefinitionProps & {
77
79
  vpc: IVpc;
80
+ logGroup: LogGroup;
81
+ taskName: string;
78
82
  cluster: Cluster;
79
83
  env?: Record<string, string>;
80
84
  /** Directory of build output to be deployed */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/ecs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EACV,eAAe,EACf,OAAO,EACP,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,IAAI,CAAC;IACV,MAAM,CAAC,EAAE,IAAI,CACX,mBAAmB,EACnB,SAAS,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,YAAY,CAC/D,GAAG;QACF,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,0BAA0B,CAAC;QACxC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,C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M,EACf,UAAU,CAAC,EAAE,MAAM,KAChB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,oBAAoB,CAAA;KAAE,CAAC;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC,0BAA0B,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG;QAClE,KAAK,EAAE,eAAe,CAAC;QACvB,WAAW,CAAC,EAAE,aAAa,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,GAAG;IAC7D,GAAG,EAAE,IAAI,CAAC;IACV,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC,0BAA0B,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG;QAClE,KAAK,EAAE,eAAe,CAAC;QACvB,WAAW,CAAC,EAAE,aAAa,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,YAAa,SAAQ,MAAM,EAAE,WAAW,EAAE,WAAW;CAAG"}
@@ -1,14 +1,14 @@
1
1
  import { Attachable, Grantable } from '@fy-stack/types';
2
2
  import type { HttpRouteIntegration } from 'aws-cdk-lib/aws-apigatewayv2';
3
3
  import { BehaviorOptions } from 'aws-cdk-lib/aws-cloudfront';
4
- import { AssetImageCodeProps, Function } from 'aws-cdk-lib/aws-lambda';
4
+ import { Function } from 'aws-cdk-lib/aws-lambda';
5
5
  import { ITopicSubscription, SubscriptionProps } from 'aws-cdk-lib/aws-sns';
6
6
  import { Queue } from 'aws-cdk-lib/aws-sqs';
7
7
  import { Construct } from 'constructs';
8
8
  import { z } from 'zod';
9
9
  import { AppConstruct, AppProperties } from '../types';
10
10
  declare const BuildParamsSchema: z.ZodObject<{
11
- container: z.ZodObject<{
11
+ container: z.ZodOptional<z.ZodObject<{
12
12
  file: z.ZodOptional<z.ZodString>;
13
13
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
14
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -17,9 +17,9 @@ declare const BuildParamsSchema: z.ZodObject<{
17
17
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
18
18
  file: z.ZodOptional<z.ZodString>;
19
19
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
- }, z.ZodTypeAny, "passthrough">>;
20
+ }, z.ZodTypeAny, "passthrough">>>;
21
21
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
22
- container: z.ZodObject<{
22
+ container: z.ZodOptional<z.ZodObject<{
23
23
  file: z.ZodOptional<z.ZodString>;
24
24
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
25
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -28,9 +28,9 @@ declare const BuildParamsSchema: z.ZodObject<{
28
28
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
29
29
  file: z.ZodOptional<z.ZodString>;
30
30
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
- }, z.ZodTypeAny, "passthrough">>;
31
+ }, z.ZodTypeAny, "passthrough">>>;
32
32
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
33
- container: z.ZodObject<{
33
+ container: z.ZodOptional<z.ZodObject<{
34
34
  file: z.ZodOptional<z.ZodString>;
35
35
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
36
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -39,12 +39,12 @@ declare const BuildParamsSchema: z.ZodObject<{
39
39
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
40
40
  file: z.ZodOptional<z.ZodString>;
41
41
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
- }, z.ZodTypeAny, "passthrough">>;
42
+ }, z.ZodTypeAny, "passthrough">>>;
43
43
  }, z.ZodTypeAny, "passthrough">>;
44
44
  export declare class ImageAppConstruct extends Construct implements AppConstruct {
45
45
  function: Function;
46
46
  queue: Queue | undefined;
47
- constructor(scope: Construct, id: string, props: AppProperties<z.infer<typeof BuildParamsSchema> & AssetImageCodeProps>);
47
+ constructor(scope: Construct, id: string, props: AppProperties<z.infer<typeof BuildParamsSchema>>);
48
48
  attach(attachable: Record<string, Attachable>): void;
49
49
  grant(...grantables: Grantable[]): void;
50
50
  subscription(props: SubscriptionProps): ITopicSubscription;
@@ -52,7 +52,7 @@ export declare class ImageAppConstruct extends Construct implements AppConstruct
52
52
  cloudfrontPolicy(distributionId: string): void;
53
53
  api(path: string): Record<string, HttpRouteIntegration>;
54
54
  static parse(params: unknown): z.objectOutputType<{
55
- container: z.ZodObject<{
55
+ container: z.ZodOptional<z.ZodObject<{
56
56
  file: z.ZodOptional<z.ZodString>;
57
57
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
58
58
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -61,7 +61,7 @@ export declare class ImageAppConstruct extends Construct implements AppConstruct
61
61
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
62
62
  file: z.ZodOptional<z.ZodString>;
63
63
  cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
64
- }, z.ZodTypeAny, "passthrough">>;
64
+ }, z.ZodTypeAny, "passthrough">>>;
65
65
  }, z.ZodTypeAny, "passthrough">;
66
66
  }
67
67
  export {};
@@ -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,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AAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;;;;;;;;;;CAG7B"}
@@ -22,7 +22,8 @@ const BuildParamsSchema = zod_1.z
22
22
  file: zod_1.z.string().optional(),
23
23
  cmd: zod_1.z.string().array().optional(),
24
24
  })
25
- .passthrough(),
25
+ .passthrough()
26
+ .optional(),
26
27
  })
27
28
  .passthrough();
28
29
  class ImageAppConstruct extends constructs_1.Construct {
@@ -30,21 +31,26 @@ class ImageAppConstruct extends constructs_1.Construct {
30
31
  queue;
31
32
  constructor(scope, id, props) {
32
33
  super(scope, id);
34
+ const { container, ...functionProps } = props.buildParams;
33
35
  this.function = new aws_lambda_1.Function(this, `AppFunction`, {
34
- ...(0, getDefaultLambda_1.getDefaultLambda)(props),
36
+ ...(0, getDefaultLambda_1.getDefaultLambda)(this, props),
35
37
  code: aws_lambda_1.Code.fromAssetImage(props.output, {
36
38
  platform: aws_ecr_assets_1.Platform.LINUX_AMD64,
37
- ...props.buildParams.container,
39
+ ...container,
38
40
  }),
39
41
  handler: aws_lambda_1.Handler.FROM_IMAGE,
40
42
  runtime: aws_lambda_1.Runtime.FROM_IMAGE,
43
+ ...functionProps,
41
44
  });
42
45
  if (props.queue) {
46
+ const { batchSize, ...queueProps } = props.queue;
43
47
  this.queue = new aws_sqs_1.Queue(this, 'AppQueue', {
44
- visibilityTimeout: aws_cdk_lib_1.Duration.seconds((props.timeout ?? 30) + 30),
48
+ visibilityTimeout: queueProps.visibilityTimeout ??
49
+ aws_cdk_lib_1.Duration.seconds((props.timeout ?? 30) + 30),
50
+ ...queueProps,
45
51
  });
46
52
  this.function.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(this.queue, {
47
- batchSize: props.queue.batchSize,
53
+ batchSize,
48
54
  }));
49
55
  }
50
56
  }
@@ -9,11 +9,11 @@ import { z } from 'zod';
9
9
  import { AppConstruct, AppProperties } from '../types';
10
10
  declare const BuildParamsSchema: z.ZodObject<{
11
11
  cmd: z.ZodString;
12
- }, "strip", z.ZodTypeAny, {
13
- cmd: string;
14
- }, {
15
- cmd: string;
16
- }>;
12
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
13
+ cmd: z.ZodString;
14
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
15
+ cmd: z.ZodString;
16
+ }, z.ZodTypeAny, "passthrough">>;
17
17
  export declare class NextAppRouterConstruct extends Construct implements AppConstruct {
18
18
  function: lambda.Function;
19
19
  queue: sqs.Queue | undefined;
@@ -26,9 +26,9 @@ export declare class NextAppRouterConstruct extends Construct implements AppCons
26
26
  attach(attachable: Record<string, Attachable>): void;
27
27
  grant(...grants: Grantable[]): void;
28
28
  subscription(): ITopicSubscription;
29
- static parse(params: unknown): {
30
- cmd: string;
31
- };
29
+ static parse(params: unknown): z.objectOutputType<{
30
+ cmd: z.ZodString;
31
+ }, z.ZodTypeAny, "passthrough">;
32
32
  }
33
33
  export {};
34
34
  //# sourceMappingURL=next-app-router-construct.d.ts.map
@@ -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,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,C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AAC;AACzD,OAAO,KAAK,GAAG,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;IAyCzD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAiBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,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"}
@@ -10,11 +10,10 @@ const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
10
10
  const constructs_1 = require("constructs");
11
11
  const zod_1 = require("zod");
12
12
  const next_app_router_1 = require("../../shared/next-app-router");
13
+ const getDefaultLambda_1 = require("../utils/getDefaultLambda");
13
14
  const lambda_attach_1 = require("../utils/lambda-attach");
14
15
  const lambda_grant_1 = require("../utils/lambda-grant");
15
- const BuildParamsSchema = zod_1.z.object({
16
- cmd: zod_1.z.string(),
17
- });
16
+ const BuildParamsSchema = zod_1.z.object({ cmd: zod_1.z.string() }).passthrough();
18
17
  class NextAppRouterConstruct extends constructs_1.Construct {
19
18
  function;
20
19
  queue;
@@ -33,18 +32,18 @@ class NextAppRouterConstruct extends constructs_1.Construct {
33
32
  AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
34
33
  AWS_LWA_INVOKE_MODE: 'response_stream',
35
34
  };
36
- Object.assign(environment, props.env);
35
+ const { cmd, ...functionProps } = props.buildParams;
37
36
  const serverOutput = path.join(props.output, '/.next/standalone');
38
- fs.writeFileSync(path.join(serverOutput, 'run.sh'), props.buildParams.cmd);
37
+ fs.writeFileSync(path.join(serverOutput, 'run.sh'), cmd);
38
+ const defaultProps = (0, getDefaultLambda_1.getDefaultLambda)(this, props);
39
39
  this.function = new lambda.Function(this, `AppFunction`, {
40
+ ...defaultProps,
41
+ environment: Object.assign({}, defaultProps.environment, environment),
40
42
  runtime: lambda.Runtime.NODEJS_20_X,
41
- memorySize: 512,
42
43
  handler: 'run.sh',
43
- timeout: cdk.Duration.seconds(60),
44
44
  code: lambda.Code.fromAsset(serverOutput),
45
- loggingFormat: lambda.LoggingFormat.JSON,
46
45
  layers: [webAdapterLayer],
47
- environment,
46
+ ...functionProps,
48
47
  });
49
48
  }
50
49
  cloudfront(path) {
@@ -8,11 +8,11 @@ import { z } from 'zod';
8
8
  import { AppConstruct, AppProperties } from '../types';
9
9
  declare const BuildParamsSchema: z.ZodObject<{
10
10
  cmd: z.ZodString;
11
- }, "strip", z.ZodTypeAny, {
12
- cmd: string;
13
- }, {
14
- cmd: string;
15
- }>;
11
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
12
+ cmd: z.ZodString;
13
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
14
+ cmd: z.ZodString;
15
+ }, z.ZodTypeAny, "passthrough">>;
16
16
  export declare class NodeApiConstruct extends Construct implements AppConstruct {
17
17
  function: lambda.Function;
18
18
  queue: sqs.Queue | undefined;
@@ -35,9 +35,9 @@ export declare class NodeApiConstruct extends Construct implements AppConstruct
35
35
  api(path: string): {
36
36
  [x: string]: cdk.aws_apigatewayv2_integrations.HttpUrlIntegration;
37
37
  };
38
- static parse(params: unknown): {
39
- cmd: string;
40
- };
38
+ static parse(params: unknown): z.objectOutputType<{
39
+ cmd: z.ZodString;
40
+ }, z.ZodTypeAny, "passthrough">;
41
41
  }
42
42
  export {};
43
43
  //# sourceMappingURL=node-api-construct.d.ts.map
@@ -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;AAKvD,QAAA,MAAM,iBAAiB;;;;;;EAErB,CAAA;AAEF,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB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,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"}
@@ -12,37 +12,36 @@ const lambdaEventSource = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda-e
12
12
  const sqs = tslib_1.__importStar(require("aws-cdk-lib/aws-sqs"));
13
13
  const constructs_1 = require("constructs");
14
14
  const zod_1 = require("zod");
15
+ const getDefaultLambda_1 = require("../utils/getDefaultLambda");
15
16
  const lambda_api_1 = require("../utils/lambda-api");
16
17
  const lambda_attach_1 = require("../utils/lambda-attach");
17
18
  const lambda_grant_1 = require("../utils/lambda-grant");
18
- const BuildParamsSchema = zod_1.z.object({
19
- cmd: zod_1.z.string(),
20
- });
19
+ const BuildParamsSchema = zod_1.z.object({ cmd: zod_1.z.string() }).passthrough();
21
20
  class NodeApiConstruct extends constructs_1.Construct {
22
21
  function;
23
22
  queue;
24
23
  constructor(scope, id, props) {
25
24
  super(scope, id);
26
25
  const region = cdk.Stack.of(this).region;
27
- const environment = {};
28
- Object.assign(environment, props.env);
29
- const layers = [
30
- lambda.LayerVersion.fromLayerVersionArn(this, 'WebAdapterLayer', `arn:aws:lambda:${region}:753240598075:layer:LambdaAdapterLayerX86:16`)
31
- ];
32
- Object.assign(environment, {
26
+ const environment = {
33
27
  AWS_LAMBDA_EXEC_WRAPPER: '/opt/bootstrap',
34
28
  AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
35
29
  PORT: '8080',
36
- });
37
- node_fs_1.default.writeFileSync(node_path_1.default.join(props.output, 'run.sh'), props.buildParams.cmd);
30
+ };
31
+ const layers = [
32
+ lambda.LayerVersion.fromLayerVersionArn(this, 'WebAdapterLayer', `arn:aws:lambda:${region}:753240598075:layer:LambdaAdapterLayerX86:16`),
33
+ ];
34
+ const { cmd, ...functionProps } = props.buildParams;
35
+ node_fs_1.default.writeFileSync(node_path_1.default.join(props.output, 'run.sh'), cmd);
36
+ const defaultProps = (0, getDefaultLambda_1.getDefaultLambda)(this, props);
38
37
  this.function = new lambda.Function(this, `AppFunction`, {
38
+ ...defaultProps,
39
+ environment: Object.assign({}, defaultProps.environment, environment),
39
40
  runtime: lambda.Runtime.NODEJS_20_X,
40
- memorySize: 512,
41
41
  handler: 'run.sh',
42
- layers,
43
- timeout: cdk.Duration.seconds(30),
44
42
  code: lambda.Code.fromAsset(props.output),
45
- environment,
43
+ layers,
44
+ ...functionProps,
46
45
  });
47
46
  if (props.queue) {
48
47
  this.queue = new sqs.Queue(this, 'AppQueue', {
@@ -9,11 +9,11 @@ import { z } from 'zod';
9
9
  import { AppConstruct, AppProperties } from '../types';
10
10
  declare const BuildParamsSchema: z.ZodObject<{
11
11
  handler: z.ZodOptional<z.ZodString>;
12
- }, "strip", z.ZodTypeAny, {
13
- handler?: string | undefined;
14
- }, {
15
- handler?: string | undefined;
16
- }>;
12
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
13
+ handler: z.ZodOptional<z.ZodString>;
14
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
15
+ handler: z.ZodOptional<z.ZodString>;
16
+ }, z.ZodTypeAny, "passthrough">>;
17
17
  export declare class NodeAppConstruct extends Construct implements AppConstruct {
18
18
  function: lambda.Function;
19
19
  queue: sqs.Queue | undefined;
@@ -24,9 +24,9 @@ export declare class NodeAppConstruct extends Construct implements AppConstruct
24
24
  cloudfront(path: string): Record<string, BehaviorOptions>;
25
25
  cloudfrontPolicy(distributionId: string): void;
26
26
  api(path: string): Record<string, HttpRouteIntegration>;
27
- static parse(params: unknown): {
28
- handler?: string | undefined;
29
- };
27
+ static parse(params: unknown): z.objectOutputType<{
28
+ handler: z.ZodOptional<z.ZodString>;
29
+ }, z.ZodTypeAny, "passthrough">;
30
30
  }
31
31
  export {};
32
32
  //# sourceMappingURL=node-app-construct.d.ts.map
@@ -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;AAGjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,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;AAIvD,QAAA,MAAM,iBAAiB;;;;;;EAErB,CAAA;AAEF,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IA8BjG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,i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CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAU1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAIzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAcvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;CAG7B"}
@@ -2,42 +2,40 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeAppConstruct = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
5
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
6
6
  const aws_apigatewayv2_integrations_1 = require("aws-cdk-lib/aws-apigatewayv2-integrations");
7
7
  const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
8
- const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
9
- const lambdaEventSource = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda-event-sources"));
8
+ const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources");
10
9
  const snsSubscriptions = tslib_1.__importStar(require("aws-cdk-lib/aws-sns-subscriptions"));
11
- const sqs = tslib_1.__importStar(require("aws-cdk-lib/aws-sqs"));
10
+ const aws_sqs_1 = require("aws-cdk-lib/aws-sqs");
12
11
  const constructs_1 = require("constructs");
13
12
  const zod_1 = require("zod");
13
+ const getDefaultLambda_1 = require("../utils/getDefaultLambda");
14
14
  const lambda_attach_1 = require("../utils/lambda-attach");
15
15
  const lambda_grant_1 = require("../utils/lambda-grant");
16
- const BuildParamsSchema = zod_1.z.object({
17
- handler: zod_1.z.string().optional(),
18
- });
16
+ const BuildParamsSchema = zod_1.z
17
+ .object({ handler: zod_1.z.string().optional() })
18
+ .passthrough();
19
19
  class NodeAppConstruct extends constructs_1.Construct {
20
20
  function;
21
21
  queue;
22
22
  constructor(scope, id, props) {
23
23
  super(scope, id);
24
- const environment = {};
25
- Object.assign(environment, props.env);
26
24
  this.function = new lambda.Function(this, `AppFunction`, {
25
+ ...(0, getDefaultLambda_1.getDefaultLambda)(this, props),
27
26
  runtime: lambda.Runtime.NODEJS_20_X,
28
- memorySize: 512,
29
- handler: props.buildParams.handler ?? "index.handler",
30
- timeout: cdk.Duration.seconds(30),
27
+ handler: props.buildParams.handler ?? 'index.handler',
31
28
  code: lambda.Code.fromAsset(props.output),
32
- loggingFormat: aws_lambda_1.LoggingFormat.JSON,
33
- environment,
34
29
  });
35
30
  if (props.queue) {
36
- this.queue = new sqs.Queue(this, 'AppQueue', {
37
- visibilityTimeout: cdk.Duration.seconds(59),
31
+ const { batchSize, ...queueProps } = props.queue;
32
+ this.queue = new aws_sqs_1.Queue(this, 'AppQueue', {
33
+ visibilityTimeout: queueProps.visibilityTimeout ??
34
+ aws_cdk_lib_1.Duration.seconds((props.timeout ?? 30) + 30),
35
+ ...queueProps,
38
36
  });
39
- this.function.addEventSource(new lambdaEventSource.SqsEventSource(this.queue, {
40
- batchSize: props.queue.batchSize,
37
+ this.function.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(this.queue, {
38
+ batchSize: batchSize,
41
39
  }));
42
40
  }
43
41
  }
@@ -49,7 +47,10 @@ class NodeAppConstruct extends constructs_1.Construct {
49
47
  }
50
48
  subscription(props) {
51
49
  if (this.queue)
52
- return new snsSubscriptions.SqsSubscription(this.queue, { ...props, rawMessageDelivery: true });
50
+ return new snsSubscriptions.SqsSubscription(this.queue, {
51
+ ...props,
52
+ rawMessageDelivery: true,
53
+ });
53
54
  return new snsSubscriptions.LambdaSubscription(this.function, props);
54
55
  }
55
56
  cloudfront(path) {
@@ -63,7 +64,7 @@ class NodeAppConstruct extends constructs_1.Construct {
63
64
  const integration = new aws_apigatewayv2_integrations_1.HttpLambdaIntegration('AppIntegration', this.function);
64
65
  return {
65
66
  [path]: integration,
66
- [`${path}/{proxy+}`]: integration
67
+ [`${path}/{proxy+}`]: integration,
67
68
  };
68
69
  }
69
70
  static parse(params) {
@@ -1 +1 @@
1
- {"version":3,"file":"lambda-construct.d.ts","sourceRoot":"","sources":["../../../src/lib/lambda/lambda-construct.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAMvC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAS7D,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAM;gBAE5B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;CAsBtE"}
1
+ {"version":3,"file":"lambda-construct.d.ts","sourceRoot":"","sources":["../../../src/lib/lambda/lambda-construct.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAMvC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAS7D,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAM;gBAE5B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;CAuBtE"}
@@ -25,6 +25,7 @@ class LambdaConstruct extends constructs_1.Construct {
25
25
  // @ts-expect-error invalid params
26
26
  buildParams: AppTypeConstruct.parse(app.buildParams ?? {}),
27
27
  vpc: props.vpc,
28
+ logGroup: props.logGroup,
28
29
  ...app,
29
30
  }),
30
31
  ];
@@ -1,10 +1,12 @@
1
1
  import { type ApiResource, AppType, type Attach, type CDNResource, type EventResource, type Grant } from '@fy-stack/types';
2
2
  import type { IVpc } from 'aws-cdk-lib/aws-ec2';
3
- import type { Function } from 'aws-cdk-lib/aws-lambda';
4
- import { Queue } from 'aws-cdk-lib/aws-sqs';
3
+ import type { Function, FunctionProps } from 'aws-cdk-lib/aws-lambda';
4
+ import type { ILogGroup } from 'aws-cdk-lib/aws-logs';
5
+ import type { Queue, QueueProps } from 'aws-cdk-lib/aws-sqs';
5
6
  export type LambdaConstructProps = {
6
7
  vpc?: IVpc;
7
8
  apps: Record<string, App>;
9
+ logGroup: ILogGroup;
8
10
  };
9
11
  export interface AppConstruct extends Attach, Grant, CDNResource, EventResource, ApiResource {
10
12
  function: Function;
@@ -12,20 +14,15 @@ export interface AppConstruct extends Attach, Grant, CDNResource, EventResource,
12
14
  }
13
15
  export type App = {
14
16
  type: typeof AppType.IMAGE_APP | typeof AppType.NEXT_APP_ROUTER | typeof AppType.NODE_APP | typeof AppType.NODE_API;
15
- output: string;
16
- env?: Record<string, string>;
17
- queue?: {
18
- batchSize?: number;
19
- };
20
- buildParams?: Record<string, unknown>;
21
- };
17
+ } & Omit<AppProperties, 'vpc' | 'logGroup'>;
22
18
  export type AppProperties<BuildParams = Record<string, unknown>> = {
19
+ logGroup: ILogGroup;
23
20
  queue?: {
24
21
  batchSize?: number;
25
- };
22
+ } & Partial<QueueProps>;
26
23
  env?: Record<string, string>;
27
24
  timeout?: number;
28
- buildParams: BuildParams;
25
+ buildParams: BuildParams & Partial<FunctionProps>;
29
26
  output: string;
30
27
  vpc?: IVpc;
31
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/lambda/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,OAAO,EACP,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,Q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M,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ,CAAC"}
@@ -1,8 +1,5 @@
1
- import { Duration } from 'aws-cdk-lib';
1
+ import { FunctionProps } from 'aws-cdk-lib/aws-lambda';
2
+ import type { Construct } from 'constructs';
2
3
  import { AppProperties } from '../types';
3
- export declare function getDefaultLambda(props: AppProperties<unknown>): {
4
- memorySize: number;
5
- timeout: Duration;
6
- environment: Record<string, string> | undefined;
7
- };
4
+ export declare function getDefaultLambda(scope: Construct, props: AppProperties<unknown>): Partial<FunctionProps>;
8
5
  //# sourceMappingURL=getDefaultLambda.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDefaultLambda.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/utils/getDefaultLambda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;;;;EAM7D"}
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;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,0BAgB9B"}
@@ -2,10 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDefaultLambda = getDefaultLambda;
4
4
  const aws_cdk_lib_1 = require("aws-cdk-lib");
5
- function getDefaultLambda(props) {
6
- return {
5
+ const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
6
+ function getDefaultLambda(scope, props) {
7
+ let params = {
7
8
  memorySize: 512,
8
9
  timeout: aws_cdk_lib_1.Duration.seconds(props.timeout ?? 30),
9
10
  environment: props.env,
10
11
  };
12
+ if (props.logGroup) {
13
+ params = Object.assign(params, { logGroup: props.logGroup, loggingFormat: aws_lambda_1.LoggingFormat.JSON });
14
+ }
15
+ return params;
11
16
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fy-stack/app-construct",
3
- "version": "0.0.146",
3
+ "version": "0.0.147-0-preview",
4
4
  "repository": "https://github.com/festusyuma/fy-stack",
5
5
  "dependencies": {
6
- "@fy-stack/types": "0.0.146",
6
+ "@fy-stack/types": "0.0.147-0-preview",
7
7
  "tslib": "^2.3.0",
8
8
  "zod": "^3.24.1"
9
9
  },