@studion/infra-code-blocks 2.0.0-alpha.3 → 2.0.0-alpha.5

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 (35) hide show
  1. package/dist/components/acm-certificate/index.js +6 -1
  2. package/dist/components/cloudfront/index.d.ts.map +1 -1
  3. package/dist/components/cloudfront/index.js +93 -46
  4. package/dist/components/cloudfront/lb-cache-strategy.js +9 -1
  5. package/dist/components/cloudfront/s3-cache-strategy.js +12 -4
  6. package/dist/components/database/builder.js +34 -7
  7. package/dist/components/database/database-replica.js +27 -3
  8. package/dist/components/database/ec2-ssm-connect.d.ts +2 -2
  9. package/dist/components/database/ec2-ssm-connect.d.ts.map +1 -1
  10. package/dist/components/database/ec2-ssm-connect.js +40 -23
  11. package/dist/components/database/index.js +55 -7
  12. package/dist/components/ecs-service/index.d.ts +15 -0
  13. package/dist/components/ecs-service/index.d.ts.map +1 -1
  14. package/dist/components/ecs-service/index.js +73 -30
  15. package/dist/components/grafana/dashboards/panels.js +23 -17
  16. package/dist/components/grafana/dashboards/web-server-slo.js +4 -1
  17. package/dist/components/password/index.js +7 -1
  18. package/dist/components/prometheus/queries.test.js +10 -19
  19. package/dist/components/redis/elasticache-redis.js +6 -1
  20. package/dist/components/redis/upstash-redis.js +8 -2
  21. package/dist/components/static-site/index.js +7 -1
  22. package/dist/components/static-site/s3-assets.js +4 -1
  23. package/dist/components/vpc/index.d.ts.map +1 -1
  24. package/dist/components/vpc/index.js +6 -2
  25. package/dist/components/web-server/builder.d.ts +4 -4
  26. package/dist/components/web-server/builder.d.ts.map +1 -1
  27. package/dist/components/web-server/builder.js +41 -12
  28. package/dist/components/web-server/index.d.ts +1 -1
  29. package/dist/components/web-server/index.d.ts.map +1 -1
  30. package/dist/components/web-server/index.js +49 -14
  31. package/dist/components/web-server/load-balancer.js +13 -3
  32. package/dist/otel/builder.js +4 -1
  33. package/dist/otel/config.js +11 -14
  34. package/dist/otel/index.js +7 -3
  35. package/package.json +34 -44
@@ -4,24 +4,40 @@ exports.WebServerBuilder = void 0;
4
4
  const pulumi = require("@pulumi/pulumi");
5
5
  const _1 = require(".");
6
6
  class WebServerBuilder {
7
+ _name;
8
+ _container;
9
+ _vpc;
10
+ _ecsConfig;
11
+ _domain;
12
+ _hostedZoneId;
13
+ _certificate;
14
+ _healthCheckPath;
15
+ _loadBalancingAlgorithmType;
16
+ _otelCollector;
17
+ _initContainers = [];
18
+ _sidecarContainers = [];
19
+ _volumes = [];
7
20
  constructor(name) {
8
- this._initContainers = [];
9
- this._sidecarContainers = [];
10
- this._volumes = [];
11
21
  this._name = name;
12
22
  }
13
- configureWebServer(image, port, config = {}) {
14
- this._container = Object.assign({ image,
15
- port }, config);
23
+ withContainer(image, port, config = {}) {
24
+ this._container = {
25
+ image,
26
+ port,
27
+ ...config,
28
+ };
16
29
  return this;
17
30
  }
18
- configureEcs(config) {
31
+ withEcsConfig(config) {
19
32
  this._ecsConfig = {
20
33
  cluster: config.cluster,
34
+ name: config.name,
21
35
  deploymentController: config.deploymentController,
22
36
  desiredCount: config.desiredCount,
23
37
  autoscaling: config.autoscaling,
38
+ family: config.family,
24
39
  size: config.size,
40
+ logGroupNamePrefix: config.logGroupNamePrefix,
25
41
  taskExecutionRoleInlinePolicies: config.taskExecutionRoleInlinePolicies,
26
42
  taskRoleInlinePolicies: config.taskRoleInlinePolicies,
27
43
  tags: config.tags,
@@ -47,11 +63,11 @@ class WebServerBuilder {
47
63
  this._domain = domain;
48
64
  return this;
49
65
  }
50
- withInitContainer(container) {
66
+ addInitContainer(container) {
51
67
  this._initContainers.push(container);
52
68
  return this;
53
69
  }
54
- withSidecarContainer(container) {
70
+ addSidecarContainer(container) {
55
71
  this._sidecarContainers.push(container);
56
72
  return this;
57
73
  }
@@ -69,15 +85,28 @@ class WebServerBuilder {
69
85
  }
70
86
  build(opts = {}) {
71
87
  if (!this._container) {
72
- throw new Error('Web server not configured. Make sure to call WebServerBuilder.configureWebServer().');
88
+ throw new Error('Web server not configured. Make sure to call WebServerBuilder.withContainer().');
73
89
  }
74
90
  if (!this._ecsConfig) {
75
- throw new Error('ECS not configured. Make sure to call WebServerBuilder.configureEcs().');
91
+ throw new Error('ECS not configured. Make sure to call WebServerBuilder.withEcsConfig().');
76
92
  }
77
93
  if (!this._vpc) {
78
94
  throw new Error('VPC not provided. Make sure to call WebServerBuilder.withVpc().');
79
95
  }
80
- return new _1.WebServer(this._name, Object.assign(Object.assign(Object.assign({}, this._ecsConfig), this._container), { vpc: this._vpc, volumes: this._volumes, domain: this._domain, hostedZoneId: this._hostedZoneId, certificate: this._certificate, healthCheckPath: this._healthCheckPath, loadBalancingAlgorithmType: this._loadBalancingAlgorithmType, otelCollector: this._otelCollector, initContainers: this._initContainers, sidecarContainers: this._sidecarContainers }), opts);
96
+ return new _1.WebServer(this._name, {
97
+ ...this._ecsConfig,
98
+ ...this._container,
99
+ vpc: this._vpc,
100
+ volumes: this._volumes,
101
+ domain: this._domain,
102
+ hostedZoneId: this._hostedZoneId,
103
+ certificate: this._certificate,
104
+ healthCheckPath: this._healthCheckPath,
105
+ loadBalancingAlgorithmType: this._loadBalancingAlgorithmType,
106
+ otelCollector: this._otelCollector,
107
+ initContainers: this._initContainers,
108
+ sidecarContainers: this._sidecarContainers,
109
+ }, opts);
81
110
  }
82
111
  }
83
112
  exports.WebServerBuilder = WebServerBuilder;
@@ -8,7 +8,7 @@ export declare namespace WebServer {
8
8
  type Container = Pick<EcsService.Container, 'image' | 'environment' | 'secrets' | 'mountPoints'> & {
9
9
  port: pulumi.Input<number>;
10
10
  };
11
- type EcsConfig = Pick<EcsService.Args, 'cluster' | 'vpc' | 'volumes' | 'deploymentController' | 'desiredCount' | 'autoscaling' | 'size' | 'taskExecutionRoleInlinePolicies' | 'taskRoleInlinePolicies' | 'tags'>;
11
+ type EcsConfig = Pick<EcsService.Args, 'cluster' | 'vpc' | 'volumes' | 'name' | 'deploymentController' | 'desiredCount' | 'autoscaling' | 'family' | 'size' | 'logGroupNamePrefix' | 'taskExecutionRoleInlinePolicies' | 'taskRoleInlinePolicies' | 'tags'>;
12
12
  type InitContainer = Omit<EcsService.Container, 'essential'>;
13
13
  type SidecarContainer = Omit<EcsService.Container, 'essential' | 'healthCheck'> & Required<Pick<EcsService.Container, 'healthCheck'>>;
14
14
  type Args = EcsConfig & Container & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/web-server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,yBAAiB,SAAS,CAAC;IACzB,KAAY,SAAS,GAAG,IAAI,CAC1B,UAAU,CAAC,SAAS,EACpB,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,CACpD,GAAG;QACF,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC5B,CAAC;IAEF,KAAY,SAAS,GAAG,IAAI,CAC1B,UAAU,CAAC,IAAI,EACb,SAAS,GACT,KAAK,GACL,SAAS,GACT,sBAAsB,GACtB,cAAc,GACd,aAAa,GACb,MAAM,GACN,iCAAiC,GACjC,wBAAwB,GACxB,MAAM,CACT,CAAC;IAEF,KAAY,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACpE,KAAY,gBAAgB,GAAG,IAAI,CACjC,UAAU,CAAC,SAAS,EACpB,WAAW,GAAG,aAAa,CAC5B,GACC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,aAAa,CAAC,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const load_balancer_1 = require("./load-balancer");
10
10
  class WebServer extends pulumi.ComponentResource {
11
+ name;
12
+ container;
13
+ ecsConfig;
14
+ service;
15
+ serviceSecurityGroup;
16
+ lb;
17
+ initContainers;
18
+ sidecarContainers;
19
+ volumes;
20
+ acmCertificate;
21
+ dnsRecords;
11
22
  constructor(name, args, opts = {}) {
12
- var _a;
13
- super('studion:web-server:WebServer', name, {}, Object.assign(Object.assign({}, opts), { aliases: [...(opts.aliases || []), { type: 'studion:WebServer' }] }));
23
+ super('studion:web-server:WebServer', name, {}, {
24
+ ...opts,
25
+ aliases: [...(opts.aliases || []), { type: 'studion:WebServer' }],
26
+ });
14
27
  const { vpc, domain, hostedZoneId, certificate } = args;
15
28
  const hasCustomDomain = !!domain || !!certificate;
16
29
  if (hasCustomDomain && !hostedZoneId) {
@@ -23,12 +36,15 @@ class WebServer extends pulumi.ComponentResource {
23
36
  this.lb = new load_balancer_1.WebServerLoadBalancer(`${this.name}-lb`, {
24
37
  vpc,
25
38
  port: args.port,
26
- certificate: certificate !== null && certificate !== void 0 ? certificate : (_a = this.acmCertificate) === null || _a === void 0 ? void 0 : _a.certificate,
39
+ certificate: certificate ?? this.acmCertificate?.certificate,
27
40
  healthCheckPath: args.healthCheckPath,
28
41
  loadBalancingAlgorithmType: args.loadBalancingAlgorithmType,
29
- }, Object.assign({ parent: this }, (this.acmCertificate
30
- ? { dependsOn: [this.acmCertificate.certificateValidation] }
31
- : undefined)));
42
+ }, {
43
+ parent: this,
44
+ ...(this.acmCertificate
45
+ ? { dependsOn: [this.acmCertificate.certificateValidation] }
46
+ : undefined),
47
+ });
32
48
  this.serviceSecurityGroup = this.createSecurityGroup(vpc);
33
49
  this.initContainers = this.getInitContainers(args);
34
50
  this.sidecarContainers = this.getSidecarContainers(args);
@@ -37,7 +53,7 @@ class WebServer extends pulumi.ComponentResource {
37
53
  this.volumes = this.getVolumes(args);
38
54
  this.service = this.createEcsService(this.container, this.lb, this.ecsConfig, this.volumes, this.initContainers, this.sidecarContainers);
39
55
  if (hasCustomDomain && hostedZoneId) {
40
- this.dnsRecords = this.createDnsRecords(certificate !== null && certificate !== void 0 ? certificate : this.acmCertificate.certificate, hostedZoneId, domain);
56
+ this.dnsRecords = this.createDnsRecords(certificate ?? this.acmCertificate.certificate, hostedZoneId, domain);
41
57
  }
42
58
  this.registerOutputs();
43
59
  }
@@ -62,7 +78,10 @@ class WebServer extends pulumi.ComponentResource {
62
78
  containers.push(...passedInits);
63
79
  if (otelCollector)
64
80
  containers.push(otelCollector.configContainer);
65
- return containers.map(container => (Object.assign(Object.assign({}, container), { essential: false })));
81
+ return containers.map(container => ({
82
+ ...container,
83
+ essential: false,
84
+ }));
66
85
  });
67
86
  }
68
87
  getSidecarContainers(args) {
@@ -74,7 +93,7 @@ class WebServer extends pulumi.ComponentResource {
74
93
  containers.push(...passedSidecars);
75
94
  if (otelCollector)
76
95
  containers.push(otelCollector.container);
77
- return containers.map(container => (Object.assign(Object.assign({}, container), { essential: true })));
96
+ return containers.map(container => ({ ...container, essential: true }));
78
97
  });
79
98
  }
80
99
  getTaskRoleInlinePolicies(args) {
@@ -97,10 +116,13 @@ class WebServer extends pulumi.ComponentResource {
97
116
  return {
98
117
  vpc: args.vpc,
99
118
  cluster: args.cluster,
119
+ name: args.name,
100
120
  deploymentController: args.deploymentController,
101
121
  desiredCount: args.desiredCount,
102
122
  autoscaling: args.autoscaling,
123
+ family: args.family,
103
124
  size: args.size,
125
+ logGroupNamePrefix: args.logGroupNamePrefix,
104
126
  taskExecutionRoleInlinePolicies: args.taskExecutionRoleInlinePolicies,
105
127
  taskRoleInlinePolicies: this.getTaskRoleInlinePolicies(args),
106
128
  tags: args.tags,
@@ -151,19 +173,32 @@ class WebServer extends pulumi.ComponentResource {
151
173
  sidecarContainers || pulumi.output([]),
152
174
  ])
153
175
  .apply(([inits, sidecars]) => {
154
- return new ecs_service_1.EcsService(`${this.name}-ecs`, Object.assign(Object.assign({}, ecsConfig), { volumes, containers: [
155
- Object.assign(Object.assign({}, webServerContainer), { name: this.name, portMappings: [
176
+ return new ecs_service_1.EcsService(`${this.name}-ecs`, {
177
+ ...ecsConfig,
178
+ volumes,
179
+ containers: [
180
+ {
181
+ ...webServerContainer,
182
+ name: this.name,
183
+ portMappings: [
156
184
  ecs_service_1.EcsService.createTcpPortMapping(webServerContainer.port),
157
- ], essential: true }),
185
+ ],
186
+ essential: true,
187
+ },
158
188
  ...inits,
159
189
  ...sidecars,
160
- ], enableServiceAutoDiscovery: false, loadBalancers: [
190
+ ],
191
+ enableServiceAutoDiscovery: false,
192
+ loadBalancers: [
161
193
  {
162
194
  containerName: this.name,
163
195
  containerPort: webServerContainer.port,
164
196
  targetGroupArn: lb.targetGroup.arn,
165
197
  },
166
- ], assignPublicIp: true, securityGroup: this.serviceSecurityGroup }), {
198
+ ],
199
+ assignPublicIp: true,
200
+ securityGroup: this.serviceSecurityGroup,
201
+ }, {
167
202
  parent: this,
168
203
  dependsOn: [lb, lb.targetGroup],
169
204
  });
@@ -33,6 +33,12 @@ const defaults = {
33
33
  healthCheckPath: '/healthcheck',
34
34
  };
35
35
  class WebServerLoadBalancer extends pulumi.ComponentResource {
36
+ name;
37
+ lb;
38
+ targetGroup;
39
+ httpListener;
40
+ tlsListener;
41
+ securityGroup;
36
42
  constructor(name, args, opts = {}) {
37
43
  super('studion:web-server:WebServerLoadBalancer', name, {}, opts);
38
44
  this.name = name;
@@ -47,7 +53,7 @@ class WebServerLoadBalancer extends pulumi.ComponentResource {
47
53
  securityGroups: [this.securityGroup.id],
48
54
  internal: false,
49
55
  ipAddressType: 'ipv4',
50
- tags: Object.assign(Object.assign({}, common_tags_1.commonTags), { Name: name }),
56
+ tags: { ...common_tags_1.commonTags, Name: name },
51
57
  }, { parent: this });
52
58
  this.targetGroup = this.createLbTargetGroup(port, vpc.vpcId, healthCheckPath, loadBalancingAlgorithmType);
53
59
  this.httpListener = this.createLbHttpListener(this.lb, this.targetGroup, !!certificate);
@@ -109,11 +115,15 @@ class WebServerLoadBalancer extends pulumi.ComponentResource {
109
115
  timeout: 5,
110
116
  path: healthCheckPath,
111
117
  },
112
- tags: Object.assign(Object.assign({}, common_tags_1.commonTags), { Name: `${this.name}-target-group` }),
118
+ tags: { ...common_tags_1.commonTags, Name: `${this.name}-target-group` },
113
119
  }, { parent: this, dependsOn: [this.lb] });
114
120
  }
115
121
  createLbSecurityGroup(vpcId) {
116
- return new aws.ec2.SecurityGroup(`${this.name}-security-group`, Object.assign(Object.assign({}, webServerLoadBalancerNetworkConfig), { vpcId, tags: common_tags_1.commonTags }), { parent: this });
122
+ return new aws.ec2.SecurityGroup(`${this.name}-security-group`, {
123
+ ...webServerLoadBalancerNetworkConfig,
124
+ vpcId,
125
+ tags: common_tags_1.commonTags,
126
+ }, { parent: this });
117
127
  }
118
128
  }
119
129
  exports.WebServerLoadBalancer = WebServerLoadBalancer;
@@ -7,8 +7,11 @@ const memoryLimiterProcessor = require("./memory-limiter-processor");
7
7
  const _1 = require(".");
8
8
  const config_1 = require("./config");
9
9
  class OtelCollectorBuilder {
10
+ _serviceName;
11
+ _env;
12
+ _configBuilder;
13
+ _taskRoleInlinePolicies = [];
10
14
  constructor(serviceName, env) {
11
- this._taskRoleInlinePolicies = [];
12
15
  this._serviceName = pulumi.output(serviceName);
13
16
  this._env = pulumi.output(env);
14
17
  this._configBuilder = new config_1.OtelCollectorConfigBuilder();
@@ -3,15 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OtelCollectorConfigBuilder = void 0;
4
4
  const otlp_receiver_1 = require("./otlp-receiver");
5
5
  class OtelCollectorConfigBuilder {
6
- constructor() {
7
- this._receivers = {};
8
- this._processors = {};
9
- this._exporters = {};
10
- this._extensions = {};
11
- this._service = {
12
- pipelines: {},
13
- };
14
- }
6
+ _receivers = {};
7
+ _processors = {};
8
+ _exporters = {};
9
+ _extensions = {};
10
+ _service = {
11
+ pipelines: {},
12
+ };
15
13
  withOTLPReceiver(protocols = ['http']) {
16
14
  if (!protocols.length) {
17
15
  throw new Error('At least one OTLP receiver protocol should be provided');
@@ -21,7 +19,7 @@ class OtelCollectorConfigBuilder {
21
19
  if (!protocolConfig) {
22
20
  throw new Error(`OTLP receiver protocol ${current} is not supported`);
23
21
  }
24
- return Object.assign(Object.assign({}, all), { [current]: protocolConfig });
22
+ return { ...all, [current]: protocolConfig };
25
23
  }, {});
26
24
  this._receivers.otlp = { protocols: protocolsConfig };
27
25
  return this;
@@ -159,18 +157,17 @@ class OtelCollectorConfigBuilder {
159
157
  }
160
158
  }
161
159
  validatePipelineComponents(pipelineType) {
162
- var _a, _b, _c;
163
- (_a = this._service.pipelines[pipelineType]) === null || _a === void 0 ? void 0 : _a.receivers.forEach(receiver => {
160
+ this._service.pipelines[pipelineType]?.receivers.forEach(receiver => {
164
161
  if (!this._receivers[receiver]) {
165
162
  throw new Error(`Receiver '${receiver}' is used in ${pipelineType} pipeline but not defined`);
166
163
  }
167
164
  });
168
- (_b = this._service.pipelines[pipelineType]) === null || _b === void 0 ? void 0 : _b.processors.forEach(processor => {
165
+ this._service.pipelines[pipelineType]?.processors.forEach(processor => {
169
166
  if (!this._processors[processor]) {
170
167
  throw new Error(`Processor '${processor}' is used in ${pipelineType} pipeline but not defined`);
171
168
  }
172
169
  });
173
- (_c = this._service.pipelines[pipelineType]) === null || _c === void 0 ? void 0 : _c.exporters.forEach(exporter => {
170
+ this._service.pipelines[pipelineType]?.exporters.forEach(exporter => {
174
171
  if (!this._exporters[exporter]) {
175
172
  throw new Error(`Exporter '${exporter}' is used in ${pipelineType} pipeline but not defined`);
176
173
  }
@@ -4,6 +4,11 @@ exports.OtelCollector = void 0;
4
4
  const pulumi = require("@pulumi/pulumi");
5
5
  const yaml = require("yaml");
6
6
  class OtelCollector {
7
+ config;
8
+ configVolume;
9
+ container;
10
+ configContainer;
11
+ taskRoleInlinePolicies;
7
12
  constructor(serviceName, env, config, opts = {}) {
8
13
  const containerName = opts.containerName || pulumi.interpolate `${serviceName}-otel-collector`;
9
14
  const configVolumeName = opts.configVolumeName || 'otel-collector-config-volume';
@@ -45,9 +50,8 @@ class OtelCollector {
45
50
  ];
46
51
  }
47
52
  getCollectorPortMappings(config) {
48
- var _a, _b;
49
- const hasOTLPGRpcReceiver = !!((_a = config.receivers.otlp) === null || _a === void 0 ? void 0 : _a.protocols.grpc);
50
- const hasOTLPHttpReceiver = !!((_b = config.receivers.otlp) === null || _b === void 0 ? void 0 : _b.protocols.http);
53
+ const hasOTLPGRpcReceiver = !!config.receivers.otlp?.protocols.grpc;
54
+ const hasOTLPHttpReceiver = !!config.receivers.otlp?.protocols.http;
51
55
  const protocol = 'tcp';
52
56
  return [
53
57
  ...(hasOTLPGRpcReceiver
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studion/infra-code-blocks",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.5",
4
4
  "description": "Studion common infra components",
5
5
  "keywords": [
6
6
  "infrastructure",
@@ -35,60 +35,50 @@
35
35
  },
36
36
  "prettier": "@studion/prettier-config",
37
37
  "dependencies": {
38
- "@pulumi/aws": "^7.15.0",
39
- "@pulumi/aws-native": "^1.38.0",
40
- "@pulumi/awsx": "^3.1.0",
41
- "@pulumi/pulumi": "^3.146.0",
42
- "@pulumi/random": "^4.17.0",
43
- "@pulumiverse/grafana": "^0.16.3",
38
+ "@pulumi/aws": "^7.21.0",
39
+ "@pulumi/aws-native": "^1.56.0",
40
+ "@pulumi/awsx": "^3.2.1",
41
+ "@pulumi/pulumi": "^3.225.0",
42
+ "@pulumi/random": "^4.19.1",
43
+ "@pulumiverse/grafana": "^2.21.0",
44
44
  "@upstash/pulumi": "^0.5.0",
45
- "yaml": "^2.7.1"
45
+ "yaml": "^2.8.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@aws-sdk/client-acm": "^3.973.5",
49
- "@aws-sdk/client-application-auto-scaling": "^3.973.5",
50
- "@aws-sdk/client-cloudfront": "^3.973.5",
51
- "@aws-sdk/client-cloudwatch-logs": "^3.973.5",
52
- "@aws-sdk/client-ec2": "^3.973.5",
53
- "@aws-sdk/client-ecs": "^3.973.5",
54
- "@aws-sdk/client-efs": "^3.973.5",
55
- "@aws-sdk/client-elastic-load-balancing-v2": "^3.764.5",
56
- "@aws-sdk/client-elasticache": "^3.901.5",
57
- "@aws-sdk/client-iam": "^3.973.5",
58
- "@aws-sdk/client-kms": "^3.973.5",
59
- "@aws-sdk/client-rds": "^3.973.5",
60
- "@aws-sdk/client-route-53": "^3.973.5",
61
- "@aws-sdk/client-s3": "^3.982.0",
62
- "@aws-sdk/client-secrets-manager": "^3.973.5",
63
- "@aws-sdk/client-servicediscovery": "^3.973.5",
64
- "@aws-sdk/client-ssm": "^3.986.0",
65
- "@aws-sdk/client-xray": "^3.989.0",
48
+ "@aws-sdk/client-acm": "^3.1002.0",
49
+ "@aws-sdk/client-application-auto-scaling": "^3.1002.0",
50
+ "@aws-sdk/client-cloudfront": "^3.1002.0",
51
+ "@aws-sdk/client-cloudwatch-logs": "^3.1002.0",
52
+ "@aws-sdk/client-ec2": "^3.1002.0",
53
+ "@aws-sdk/client-ecs": "^3.1002.0",
54
+ "@aws-sdk/client-efs": "^3.1002.0",
55
+ "@aws-sdk/client-elastic-load-balancing-v2": "^3.1002.0",
56
+ "@aws-sdk/client-elasticache": "^3.1002.0",
57
+ "@aws-sdk/client-iam": "^3.1002.0",
58
+ "@aws-sdk/client-kms": "^3.1002.0",
59
+ "@aws-sdk/client-rds": "^3.1002.0",
60
+ "@aws-sdk/client-route-53": "^3.1002.0",
61
+ "@aws-sdk/client-s3": "^3.1002.0",
62
+ "@aws-sdk/client-secrets-manager": "^3.1002.0",
63
+ "@aws-sdk/client-servicediscovery": "^3.1002.0",
64
+ "@aws-sdk/client-ssm": "^3.1002.0",
65
+ "@aws-sdk/client-xray": "^3.1002.0",
66
66
  "@studion/prettier-config": "^0.1.0",
67
- "@types/node": "^22",
68
- "exponential-backoff": "^3.1.2",
67
+ "@types/node": "^25",
68
+ "exponential-backoff": "^3.1.3",
69
69
  "http-status": "^2.1.0",
70
70
  "husky": "^9.1.7",
71
- "ioredis": "^5.8.1",
72
- "lint-staged": "^16.1.2",
71
+ "ioredis": "^5.10.0",
72
+ "lint-staged": "^16.3.2",
73
73
  "mime": "^4.1.0",
74
74
  "nanospinner": "^1.2.2",
75
75
  "pathe": "^2.0.3",
76
- "prettier": "^3.4.2",
76
+ "prettier": "^3.8.1",
77
77
  "release-it": "^19.2.4",
78
- "tstyche": "^4.0.0-beta.9",
78
+ "tstyche": "^6.2.0",
79
79
  "tsx": "^4.21.0",
80
- "typescript": "^5.7.3",
81
- "undici": "^6.21.2"
82
- },
83
- "overrides": {
84
- "@pulumi/pulumi": {
85
- "glob": "10.5.0",
86
- "minimatch": "10.2.2",
87
- "tar": "7.5.9"
88
- },
89
- "@aws-sdk/core": {
90
- "fast-xml-parser": "5.3.6"
91
- }
80
+ "typescript": "^5.9.3",
81
+ "undici": "^7.22.0"
92
82
  },
93
83
  "publishConfig": {
94
84
  "access": "public"