@codedazur/cdk-docker-cluster 1.1.0 → 1.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @codedazur/cdk-docker-cluster
2
2
 
3
+ ## 1.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2734c9d`](https://github.com/codedazur/toolkit/commit/2734c9d2f1a6fbdbae8e7d676b1e06437200df23) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Props are now marked as readonly.
8
+
9
+ - [`62b823b`](https://github.com/codedazur/toolkit/commit/62b823bfb366f0b7b037b0485aafe7084fe3743f) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Following a CDK update, the cache policy and origin request policy are now created as constructs instead of using a simple object.
10
+
11
+ - Updated dependencies [[`2734c9d`](https://github.com/codedazur/toolkit/commit/2734c9d2f1a6fbdbae8e7d676b1e06437200df23)]:
12
+ - @codedazur/cdk-site-distribution@1.0.2
13
+
14
+ ## 1.1.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [`b24894a`](https://github.com/codedazur/toolkit/commit/b24894a2de01e596669c2b5aca51bc0b28533106) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Mark the package as side-effect-free for tree shaking.
19
+
20
+ - Updated dependencies [[`b24894a`](https://github.com/codedazur/toolkit/commit/b24894a2de01e596669c2b5aca51bc0b28533106)]:
21
+ - @codedazur/cdk-site-distribution@1.0.1
22
+
3
23
  ## 1.1.0
4
24
 
5
25
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as aws_cdk_lib_aws_cloudfront from 'aws-cdk-lib/aws-cloudfront';
1
2
  import * as aws_cdk_lib_aws_ecs from 'aws-cdk-lib/aws-ecs';
2
3
  import { ContainerImage, Secret, ScalableTaskCount } from 'aws-cdk-lib/aws-ecs';
3
4
  import { SiteDistributionProps, SiteDistribution } from '@codedazur/cdk-site-distribution';
@@ -6,16 +7,17 @@ import { ApplicationLoadBalancedFargateServiceProps, ApplicationLoadBalancedFarg
6
7
  import { Construct } from 'constructs';
7
8
 
8
9
  interface DockerClusterProps {
9
- source: string | SourceProps | ContainerImage;
10
- service?: {
11
- port?: number;
12
- tasks?: number | AutoScalingConfig;
13
- cpu?: ApplicationLoadBalancedFargateServiceProps["cpu"];
14
- memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
15
- environment?: Record<string, string>;
16
- secrets?: Record<string, Secret>;
17
- };
18
- distribution?: Omit<SiteDistributionProps, "origin">;
10
+ readonly source: string | SourceProps | ContainerImage;
11
+ readonly service?: ServiceProps;
12
+ readonly distribution?: Omit<SiteDistributionProps, "origin">;
13
+ }
14
+ interface ServiceProps {
15
+ readonly port?: number;
16
+ readonly tasks?: number | AutoScalingConfig;
17
+ readonly cpu?: ApplicationLoadBalancedFargateServiceProps["cpu"];
18
+ readonly memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
19
+ readonly environment?: Record<string, string>;
20
+ readonly secrets?: Record<string, Secret>;
19
21
  }
20
22
  interface AutoScalingConfig {
21
23
  /**
@@ -52,11 +54,11 @@ interface AutoScalingConfig {
52
54
  };
53
55
  }
54
56
  interface SourceProps {
55
- directory: string;
56
- exclude?: string[];
57
- file?: string;
58
- arguments?: Record<string, string>;
59
- secrets?: Record<string, string>;
57
+ readonly directory: string;
58
+ readonly exclude?: string[];
59
+ readonly file?: string;
60
+ readonly arguments?: Record<string, string>;
61
+ readonly secrets?: Record<string, string>;
60
62
  }
61
63
  /**
62
64
  * An Docker cluster on a load balanced Fargate service on EC2, using an image
@@ -76,7 +78,22 @@ declare class DockerCluster extends Construct {
76
78
  protected createService(): ApplicationLoadBalancedFargateService;
77
79
  protected createAutoScaling(service: ApplicationLoadBalancedFargateService): ScalableTaskCount | undefined;
78
80
  protected createSiteDistribution(): SiteDistribution;
81
+ /**
82
+ * The managed "UseOriginCacheControlHeaders-QueryStrings" cache policy, which
83
+ * is designed for use with an origin that sends Cache-Control headers with
84
+ * the object, which is recommended for use with an Application Load Balancer,
85
+ * and includes query strings in the cache key.
86
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings
87
+ */
88
+ protected createCachePolicy(): aws_cdk_lib_aws_cloudfront.ICachePolicy;
89
+ /**
90
+ * The managed "AllViewer" origin request policy, which includes all values
91
+ * (query strings, headers, and cookies) in the viewer request, which is
92
+ * recommended for use with an Application Load Balancer endpoint.
93
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer
94
+ */
95
+ protected createOriginRequestPolicy(): aws_cdk_lib_aws_cloudfront.IOriginRequestPolicy;
79
96
  protected getOutputDirectory(): string;
80
97
  }
81
98
 
82
- export { DockerCluster, type DockerClusterProps };
99
+ export { DockerCluster, type DockerClusterProps, type ServiceProps };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as aws_cdk_lib_aws_cloudfront from 'aws-cdk-lib/aws-cloudfront';
1
2
  import * as aws_cdk_lib_aws_ecs from 'aws-cdk-lib/aws-ecs';
2
3
  import { ContainerImage, Secret, ScalableTaskCount } from 'aws-cdk-lib/aws-ecs';
3
4
  import { SiteDistributionProps, SiteDistribution } from '@codedazur/cdk-site-distribution';
@@ -6,16 +7,17 @@ import { ApplicationLoadBalancedFargateServiceProps, ApplicationLoadBalancedFarg
6
7
  import { Construct } from 'constructs';
7
8
 
8
9
  interface DockerClusterProps {
9
- source: string | SourceProps | ContainerImage;
10
- service?: {
11
- port?: number;
12
- tasks?: number | AutoScalingConfig;
13
- cpu?: ApplicationLoadBalancedFargateServiceProps["cpu"];
14
- memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
15
- environment?: Record<string, string>;
16
- secrets?: Record<string, Secret>;
17
- };
18
- distribution?: Omit<SiteDistributionProps, "origin">;
10
+ readonly source: string | SourceProps | ContainerImage;
11
+ readonly service?: ServiceProps;
12
+ readonly distribution?: Omit<SiteDistributionProps, "origin">;
13
+ }
14
+ interface ServiceProps {
15
+ readonly port?: number;
16
+ readonly tasks?: number | AutoScalingConfig;
17
+ readonly cpu?: ApplicationLoadBalancedFargateServiceProps["cpu"];
18
+ readonly memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
19
+ readonly environment?: Record<string, string>;
20
+ readonly secrets?: Record<string, Secret>;
19
21
  }
20
22
  interface AutoScalingConfig {
21
23
  /**
@@ -52,11 +54,11 @@ interface AutoScalingConfig {
52
54
  };
53
55
  }
54
56
  interface SourceProps {
55
- directory: string;
56
- exclude?: string[];
57
- file?: string;
58
- arguments?: Record<string, string>;
59
- secrets?: Record<string, string>;
57
+ readonly directory: string;
58
+ readonly exclude?: string[];
59
+ readonly file?: string;
60
+ readonly arguments?: Record<string, string>;
61
+ readonly secrets?: Record<string, string>;
60
62
  }
61
63
  /**
62
64
  * An Docker cluster on a load balanced Fargate service on EC2, using an image
@@ -76,7 +78,22 @@ declare class DockerCluster extends Construct {
76
78
  protected createService(): ApplicationLoadBalancedFargateService;
77
79
  protected createAutoScaling(service: ApplicationLoadBalancedFargateService): ScalableTaskCount | undefined;
78
80
  protected createSiteDistribution(): SiteDistribution;
81
+ /**
82
+ * The managed "UseOriginCacheControlHeaders-QueryStrings" cache policy, which
83
+ * is designed for use with an origin that sends Cache-Control headers with
84
+ * the object, which is recommended for use with an Application Load Balancer,
85
+ * and includes query strings in the cache key.
86
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings
87
+ */
88
+ protected createCachePolicy(): aws_cdk_lib_aws_cloudfront.ICachePolicy;
89
+ /**
90
+ * The managed "AllViewer" origin request policy, which includes all values
91
+ * (query strings, headers, and cookies) in the viewer request, which is
92
+ * recommended for use with an Application Load Balancer endpoint.
93
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer
94
+ */
95
+ protected createOriginRequestPolicy(): aws_cdk_lib_aws_cloudfront.IOriginRequestPolicy;
79
96
  protected getOutputDirectory(): string;
80
97
  }
81
98
 
82
- export { DockerCluster, type DockerClusterProps };
99
+ export { DockerCluster, type DockerClusterProps, type ServiceProps };
package/dist/index.js CHANGED
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  DockerCluster: () => DockerCluster
24
24
  });
25
- module.exports = __toCommonJS(src_exports);
25
+ module.exports = __toCommonJS(index_exports);
26
26
 
27
27
  // src/constructs/DockerCluster.ts
28
28
  var import_cdk_site_distribution = require("@codedazur/cdk-site-distribution");
@@ -60,18 +60,17 @@ var DockerCluster = class extends import_constructs.Construct {
60
60
  });
61
61
  }
62
62
  createService() {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
64
- const desiredTasks = typeof ((_a = this.props.service) == null ? void 0 : _a.tasks) === "number" ? (_b = this.props.service) == null ? void 0 : _b.tasks : (_d = (_c = this.props.service) == null ? void 0 : _c.tasks) == null ? void 0 : _d.minimum;
63
+ const desiredTasks = typeof this.props.service?.tasks === "number" ? this.props.service?.tasks : this.props.service?.tasks?.minimum;
65
64
  const service = new import_aws_ecs_patterns.ApplicationLoadBalancedFargateService(this, "Service", {
66
65
  cluster: new import_aws_ecs.Cluster(this, "Cluster"),
67
- cpu: (_e = this.props.service) == null ? void 0 : _e.cpu,
68
- memoryLimitMiB: (_f = this.props.service) == null ? void 0 : _f.memory,
66
+ cpu: this.props.service?.cpu,
67
+ memoryLimitMiB: this.props.service?.memory,
69
68
  desiredCount: desiredTasks,
70
69
  taskImageOptions: {
71
70
  image: this.image,
72
- containerPort: (_g = this.props.service) == null ? void 0 : _g.port,
73
- environment: (_h = this.props.service) == null ? void 0 : _h.environment,
74
- secrets: (_i = this.props.service) == null ? void 0 : _i.secrets
71
+ containerPort: this.props.service?.port,
72
+ environment: this.props.service?.environment,
73
+ secrets: this.props.service?.secrets
75
74
  },
76
75
  circuitBreaker: {
77
76
  enable: true,
@@ -81,59 +80,66 @@ var DockerCluster = class extends import_constructs.Construct {
81
80
  return service;
82
81
  }
83
82
  createAutoScaling(service) {
84
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
85
- if (typeof ((_a = this.props.service) == null ? void 0 : _a.tasks) !== "object") {
83
+ if (typeof this.props.service?.tasks !== "object") {
86
84
  return;
87
85
  }
88
86
  const autoScaling = service.service.autoScaleTaskCount({
89
- minCapacity: (_b = this.props.service) == null ? void 0 : _b.tasks.minimum,
90
- maxCapacity: (_c = this.props.service) == null ? void 0 : _c.tasks.maximum
87
+ minCapacity: this.props.service?.tasks.minimum,
88
+ maxCapacity: this.props.service?.tasks.maximum
91
89
  });
92
90
  autoScaling.scaleOnMemoryUtilization("MemoryScaling", {
93
- targetUtilizationPercent: (_f = (_e = (_d = this.props.service) == null ? void 0 : _d.tasks.threshold) == null ? void 0 : _e.memory) != null ? _f : 75,
94
- scaleInCooldown: (_h = (_g = this.props.service) == null ? void 0 : _g.tasks.cooldown) == null ? void 0 : _h.in,
95
- scaleOutCooldown: (_j = (_i = this.props.service) == null ? void 0 : _i.tasks.cooldown) == null ? void 0 : _j.out
91
+ targetUtilizationPercent: this.props.service?.tasks.threshold?.memory ?? 75,
92
+ scaleInCooldown: this.props.service?.tasks.cooldown?.in,
93
+ scaleOutCooldown: this.props.service?.tasks.cooldown?.out
96
94
  });
97
95
  autoScaling.scaleOnCpuUtilization("CpuScaling", {
98
- targetUtilizationPercent: (_m = (_l = (_k = this.props.service) == null ? void 0 : _k.tasks.threshold) == null ? void 0 : _l.cpu) != null ? _m : 75,
99
- scaleInCooldown: (_o = (_n = this.props.service) == null ? void 0 : _n.tasks.cooldown) == null ? void 0 : _o.in,
100
- scaleOutCooldown: (_q = (_p = this.props.service) == null ? void 0 : _p.tasks.cooldown) == null ? void 0 : _q.out
96
+ targetUtilizationPercent: this.props.service?.tasks.threshold?.cpu ?? 75,
97
+ scaleInCooldown: this.props.service?.tasks.cooldown?.in,
98
+ scaleOutCooldown: this.props.service?.tasks.cooldown?.out
101
99
  });
102
100
  return autoScaling;
103
101
  }
104
102
  createSiteDistribution() {
103
+ const { cachePolicy, originRequestPolicy, ...distribution } = this.props.distribution ?? {};
105
104
  return new import_cdk_site_distribution.SiteDistribution(this, "Distribution", {
106
105
  allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_ALL,
107
- cachePolicy: {
108
- /**
109
- * The managed "UseOriginCacheControlHeaders-QueryStrings" cache policy,
110
- * which is designed for use with an origin that sends Cache-Control
111
- * headers with the object, which is recommended for use with an
112
- * Application Load Balancer, and includes query strings in the cache
113
- * key.
114
- * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings
115
- */
116
- cachePolicyId: "4cc15a8a-d715-48a4-82b8-cc0b614638fe"
117
- },
118
- originRequestPolicy: {
119
- /**
120
- * The managed "AllViewer" origin request policy, which includes all
121
- * values (query strings, headers, and cookies) in the viewer request,
122
- * which is recommended for use with an Application Load Balancer
123
- * endpoint.
124
- * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer
125
- */
126
- originRequestPolicyId: "216adef6-5c7f-47e4-b989-5492eafa07d3"
127
- },
128
- ...this.props.distribution,
106
+ cachePolicy: cachePolicy ?? this.createCachePolicy(),
107
+ originRequestPolicy: originRequestPolicy ?? this.createOriginRequestPolicy(),
108
+ ...distribution,
129
109
  origin: new import_aws_cloudfront_origins.LoadBalancerV2Origin(this.service.loadBalancer, {
130
110
  protocolPolicy: import_aws_cloudfront.OriginProtocolPolicy.HTTP_ONLY
131
111
  })
132
112
  });
133
113
  }
114
+ /**
115
+ * The managed "UseOriginCacheControlHeaders-QueryStrings" cache policy, which
116
+ * is designed for use with an origin that sends Cache-Control headers with
117
+ * the object, which is recommended for use with an Application Load Balancer,
118
+ * and includes query strings in the cache key.
119
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings
120
+ */
121
+ createCachePolicy() {
122
+ return import_aws_cloudfront.CachePolicy.fromCachePolicyId(
123
+ this,
124
+ "CachePolicy",
125
+ "4cc15a8a-d715-48a4-82b8-cc0b614638fe" /* UseOriginCacheControlHeadersQueryStrings */
126
+ );
127
+ }
128
+ /**
129
+ * The managed "AllViewer" origin request policy, which includes all values
130
+ * (query strings, headers, and cookies) in the viewer request, which is
131
+ * recommended for use with an Application Load Balancer endpoint.
132
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer
133
+ */
134
+ createOriginRequestPolicy() {
135
+ return import_aws_cloudfront.OriginRequestPolicy.fromOriginRequestPolicyId(
136
+ this,
137
+ "OriginRequestPolicy",
138
+ "216adef6-5c7f-47e4-b989-5492eafa07d3" /* AllViewer */
139
+ );
140
+ }
134
141
  getOutputDirectory() {
135
- var _a, _b;
136
- return (_b = (_a = import_aws_cdk_lib.App.of(this)) == null ? void 0 : _a.outdir) != null ? _b : "cdk.out";
142
+ return import_aws_cdk_lib.App.of(this)?.outdir ?? "cdk.out";
137
143
  }
138
144
  };
139
145
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -5,7 +5,9 @@ import {
5
5
  import { App } from "aws-cdk-lib";
6
6
  import {
7
7
  AllowedMethods,
8
- OriginProtocolPolicy
8
+ CachePolicy,
9
+ OriginProtocolPolicy,
10
+ OriginRequestPolicy
9
11
  } from "aws-cdk-lib/aws-cloudfront";
10
12
  import { LoadBalancerV2Origin } from "aws-cdk-lib/aws-cloudfront-origins";
11
13
  import { Platform } from "aws-cdk-lib/aws-ecr-assets";
@@ -44,18 +46,17 @@ var DockerCluster = class extends Construct {
44
46
  });
45
47
  }
46
48
  createService() {
47
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
48
- const desiredTasks = typeof ((_a = this.props.service) == null ? void 0 : _a.tasks) === "number" ? (_b = this.props.service) == null ? void 0 : _b.tasks : (_d = (_c = this.props.service) == null ? void 0 : _c.tasks) == null ? void 0 : _d.minimum;
49
+ const desiredTasks = typeof this.props.service?.tasks === "number" ? this.props.service?.tasks : this.props.service?.tasks?.minimum;
49
50
  const service = new ApplicationLoadBalancedFargateService(this, "Service", {
50
51
  cluster: new Cluster(this, "Cluster"),
51
- cpu: (_e = this.props.service) == null ? void 0 : _e.cpu,
52
- memoryLimitMiB: (_f = this.props.service) == null ? void 0 : _f.memory,
52
+ cpu: this.props.service?.cpu,
53
+ memoryLimitMiB: this.props.service?.memory,
53
54
  desiredCount: desiredTasks,
54
55
  taskImageOptions: {
55
56
  image: this.image,
56
- containerPort: (_g = this.props.service) == null ? void 0 : _g.port,
57
- environment: (_h = this.props.service) == null ? void 0 : _h.environment,
58
- secrets: (_i = this.props.service) == null ? void 0 : _i.secrets
57
+ containerPort: this.props.service?.port,
58
+ environment: this.props.service?.environment,
59
+ secrets: this.props.service?.secrets
59
60
  },
60
61
  circuitBreaker: {
61
62
  enable: true,
@@ -65,59 +66,66 @@ var DockerCluster = class extends Construct {
65
66
  return service;
66
67
  }
67
68
  createAutoScaling(service) {
68
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
69
- if (typeof ((_a = this.props.service) == null ? void 0 : _a.tasks) !== "object") {
69
+ if (typeof this.props.service?.tasks !== "object") {
70
70
  return;
71
71
  }
72
72
  const autoScaling = service.service.autoScaleTaskCount({
73
- minCapacity: (_b = this.props.service) == null ? void 0 : _b.tasks.minimum,
74
- maxCapacity: (_c = this.props.service) == null ? void 0 : _c.tasks.maximum
73
+ minCapacity: this.props.service?.tasks.minimum,
74
+ maxCapacity: this.props.service?.tasks.maximum
75
75
  });
76
76
  autoScaling.scaleOnMemoryUtilization("MemoryScaling", {
77
- targetUtilizationPercent: (_f = (_e = (_d = this.props.service) == null ? void 0 : _d.tasks.threshold) == null ? void 0 : _e.memory) != null ? _f : 75,
78
- scaleInCooldown: (_h = (_g = this.props.service) == null ? void 0 : _g.tasks.cooldown) == null ? void 0 : _h.in,
79
- scaleOutCooldown: (_j = (_i = this.props.service) == null ? void 0 : _i.tasks.cooldown) == null ? void 0 : _j.out
77
+ targetUtilizationPercent: this.props.service?.tasks.threshold?.memory ?? 75,
78
+ scaleInCooldown: this.props.service?.tasks.cooldown?.in,
79
+ scaleOutCooldown: this.props.service?.tasks.cooldown?.out
80
80
  });
81
81
  autoScaling.scaleOnCpuUtilization("CpuScaling", {
82
- targetUtilizationPercent: (_m = (_l = (_k = this.props.service) == null ? void 0 : _k.tasks.threshold) == null ? void 0 : _l.cpu) != null ? _m : 75,
83
- scaleInCooldown: (_o = (_n = this.props.service) == null ? void 0 : _n.tasks.cooldown) == null ? void 0 : _o.in,
84
- scaleOutCooldown: (_q = (_p = this.props.service) == null ? void 0 : _p.tasks.cooldown) == null ? void 0 : _q.out
82
+ targetUtilizationPercent: this.props.service?.tasks.threshold?.cpu ?? 75,
83
+ scaleInCooldown: this.props.service?.tasks.cooldown?.in,
84
+ scaleOutCooldown: this.props.service?.tasks.cooldown?.out
85
85
  });
86
86
  return autoScaling;
87
87
  }
88
88
  createSiteDistribution() {
89
+ const { cachePolicy, originRequestPolicy, ...distribution } = this.props.distribution ?? {};
89
90
  return new SiteDistribution(this, "Distribution", {
90
91
  allowedMethods: AllowedMethods.ALLOW_ALL,
91
- cachePolicy: {
92
- /**
93
- * The managed "UseOriginCacheControlHeaders-QueryStrings" cache policy,
94
- * which is designed for use with an origin that sends Cache-Control
95
- * headers with the object, which is recommended for use with an
96
- * Application Load Balancer, and includes query strings in the cache
97
- * key.
98
- * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings
99
- */
100
- cachePolicyId: "4cc15a8a-d715-48a4-82b8-cc0b614638fe"
101
- },
102
- originRequestPolicy: {
103
- /**
104
- * The managed "AllViewer" origin request policy, which includes all
105
- * values (query strings, headers, and cookies) in the viewer request,
106
- * which is recommended for use with an Application Load Balancer
107
- * endpoint.
108
- * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer
109
- */
110
- originRequestPolicyId: "216adef6-5c7f-47e4-b989-5492eafa07d3"
111
- },
112
- ...this.props.distribution,
92
+ cachePolicy: cachePolicy ?? this.createCachePolicy(),
93
+ originRequestPolicy: originRequestPolicy ?? this.createOriginRequestPolicy(),
94
+ ...distribution,
113
95
  origin: new LoadBalancerV2Origin(this.service.loadBalancer, {
114
96
  protocolPolicy: OriginProtocolPolicy.HTTP_ONLY
115
97
  })
116
98
  });
117
99
  }
100
+ /**
101
+ * The managed "UseOriginCacheControlHeaders-QueryStrings" cache policy, which
102
+ * is designed for use with an origin that sends Cache-Control headers with
103
+ * the object, which is recommended for use with an Application Load Balancer,
104
+ * and includes query strings in the cache key.
105
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings
106
+ */
107
+ createCachePolicy() {
108
+ return CachePolicy.fromCachePolicyId(
109
+ this,
110
+ "CachePolicy",
111
+ "4cc15a8a-d715-48a4-82b8-cc0b614638fe" /* UseOriginCacheControlHeadersQueryStrings */
112
+ );
113
+ }
114
+ /**
115
+ * The managed "AllViewer" origin request policy, which includes all values
116
+ * (query strings, headers, and cookies) in the viewer request, which is
117
+ * recommended for use with an Application Load Balancer endpoint.
118
+ * @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html#managed-origin-request-policy-all-viewer
119
+ */
120
+ createOriginRequestPolicy() {
121
+ return OriginRequestPolicy.fromOriginRequestPolicyId(
122
+ this,
123
+ "OriginRequestPolicy",
124
+ "216adef6-5c7f-47e4-b989-5492eafa07d3" /* AllViewer */
125
+ );
126
+ }
118
127
  getOutputDirectory() {
119
- var _a, _b;
120
- return (_b = (_a = App.of(this)) == null ? void 0 : _a.outdir) != null ? _b : "cdk.out";
128
+ return App.of(this)?.outdir ?? "cdk.out";
121
129
  }
122
130
  };
123
131
  export {
@@ -0,0 +1,5 @@
1
+ import { cdk, distribution } from "@codedazur/eslint-config";
2
+ import { defineConfig } from "eslint/config";
3
+ import root from "../../eslint.config";
4
+
5
+ export default defineConfig(root, cdk, distribution);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codedazur/cdk-docker-cluster",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": ".dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -14,11 +14,12 @@
14
14
  "access": "public"
15
15
  },
16
16
  "license": "MIT",
17
+ "sideEffects": false,
17
18
  "scripts": {
18
19
  "develop": "tsup src/index.ts --format esm,cjs --dts --watch",
19
20
  "build": "tsup src/index.ts --format esm,cjs --dts",
20
21
  "audit": "npm audit --omit dev --audit-level high",
21
- "lint": "TIMING=1 eslint \"**/*.ts*\"",
22
+ "lint": "eslint .",
22
23
  "types": "tsc --noEmit",
23
24
  "test": "vitest run --passWithNoTests"
24
25
  },
@@ -27,12 +28,12 @@
27
28
  "constructs": ">=10"
28
29
  },
29
30
  "dependencies": {
30
- "@codedazur/cdk-site-distribution": "^1.0.0"
31
+ "@codedazur/cdk-site-distribution": "^1.0.2"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/node": "^20.14.10",
34
- "aws-cdk-lib": "^2.149.0",
35
- "constructs": "^10.3.0",
36
- "esbuild": "^0.23.0"
34
+ "@types/node": "^25.0.3",
35
+ "aws-cdk-lib": "^2.233.0",
36
+ "constructs": "^10.4.4",
37
+ "esbuild": "^0.27.2"
37
38
  }
38
39
  }