@guardian/cdk 59.2.0 → 59.2.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.
@@ -35,7 +35,7 @@ class GuHttpsApplicationListener extends (0, app_aware_construct_1.GuAppAwareCon
35
35
  const mergedProps = {
36
36
  port: certificate ? 443 : 8080,
37
37
  protocol: certificate ? aws_elasticloadbalancingv2_1.ApplicationProtocol.HTTPS : aws_elasticloadbalancingv2_1.ApplicationProtocol.HTTP,
38
- sslPolicy: aws_elasticloadbalancingv2_1.SslPolicy.RECOMMENDED_TLS,
38
+ sslPolicy: certificate ? aws_elasticloadbalancingv2_1.SslPolicy.RECOMMENDED_TLS : undefined,
39
39
  ...props,
40
40
  certificates: certificate
41
41
  ? [
@@ -1 +1 @@
1
- {"version":3,"file":"application-listener.js","sourceRoot":"","sources":["../../../../src/constructs/loadbalancing/alb/application-listener.ts"],"names":[],"mappings":";;;AAAA,uFAKgD;AAEhD,kFAA+E;AAO/E;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAsB,SAAQ,IAAA,yCAAmB,EAAC,gDAAmB,CAAC;IACjF,YAAY,KAAc,EAAE,EAAU,EAAE,KAAiC;QACvE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,gDAAmB,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AAJD,sDAIC;AASD;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,IAAA,yCAAmB,EAAC,gDAAmB,CAAC;IACtF,YAAY,KAAc,EAAE,EAAU,EAAE,KAAsC;QAC5E,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;QAE3C,MAAM,WAAW,GAA+B;YAC9C,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;YAC9B,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,gDAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,gDAAmB,CAAC,IAAI;YAC5E,SAAS,EAAE,sCAAS,CAAC,eAAe;YACpC,GAAG,KAAK;YACR,YAAY,EAAE,WAAW;gBACvB,CAAC,CAAC;oBACE;wBACE,cAAc,EAAE,WAAW,CAAC,cAAc;qBAC3C;iBACF;gBACH,CAAC,CAAC,EAAE;YACN,aAAa,EAAE,2CAAc,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;SACrD,CAAC;QAEF,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;IAChC,CAAC;CACF;AArBD,gEAqBC","sourcesContent":["import {\n ApplicationListener,\n ApplicationProtocol,\n ListenerAction,\n SslPolicy,\n} from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport type { ApplicationListenerProps } from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport { GuAppAwareConstruct } from \"../../../utils/mixin/app-aware-construct\";\nimport type { GuCertificate } from \"../../acm\";\nimport type { AppIdentity, GuStack } from \"../../core\";\nimport type { GuApplicationTargetGroup } from \"./application-target-group\";\n\nexport interface GuApplicationListenerProps extends ApplicationListenerProps, AppIdentity {}\n\n/**\n * Construct which creates a Listener.\n *\n * This construct should be used in conjunction with [[`GuApplicationLoadBalancer`]] and [[`GuApplicationTargetGroup`]]\n * to route traffic to your application. For more details on these three components, see the\n * [AWS documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html#application-load-balancer-components).\n *\n * If you are running an application which only accepts traffic over HTTPS, consider using [[`GuHttpsApplicationListener`]]\n * to reduce the amount of boilerplate needed when configuring your Listener.\n *\n * This resource is stateful.\n * @see https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md\n */\nexport class GuApplicationListener extends GuAppAwareConstruct(ApplicationListener) {\n constructor(scope: GuStack, id: string, props: GuApplicationListenerProps) {\n super(scope, id, { port: 443, protocol: ApplicationProtocol.HTTPS, ...props });\n }\n}\n\nexport interface GuHttpsApplicationListenerProps\n extends Omit<GuApplicationListenerProps, \"defaultAction\" | \"certificates\">,\n AppIdentity {\n targetGroup: GuApplicationTargetGroup;\n certificate?: GuCertificate;\n}\n\n/**\n * Construct which creates a Listener which accepts HTTPS traffic.\n *\n * You must pass a [[`GuCertificate`]] to this Listener via the `certificate` prop.\n *\n * For general details about Listeners, see [[`GuApplicationListener`]].\n */\nexport class GuHttpsApplicationListener extends GuAppAwareConstruct(ApplicationListener) {\n constructor(scope: GuStack, id: string, props: GuHttpsApplicationListenerProps) {\n const { certificate, targetGroup } = props;\n\n const mergedProps: GuApplicationListenerProps = {\n port: certificate ? 443 : 8080,\n protocol: certificate ? ApplicationProtocol.HTTPS : ApplicationProtocol.HTTP,\n sslPolicy: SslPolicy.RECOMMENDED_TLS,\n ...props,\n certificates: certificate\n ? [\n {\n certificateArn: certificate.certificateArn,\n },\n ]\n : [],\n defaultAction: ListenerAction.forward([targetGroup]),\n };\n\n super(scope, id, mergedProps);\n }\n}\n"]}
1
+ {"version":3,"file":"application-listener.js","sourceRoot":"","sources":["../../../../src/constructs/loadbalancing/alb/application-listener.ts"],"names":[],"mappings":";;;AAAA,uFAKgD;AAEhD,kFAA+E;AAO/E;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAsB,SAAQ,IAAA,yCAAmB,EAAC,gDAAmB,CAAC;IACjF,YAAY,KAAc,EAAE,EAAU,EAAE,KAAiC;QACvE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,gDAAmB,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AAJD,sDAIC;AASD;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,IAAA,yCAAmB,EAAC,gDAAmB,CAAC;IACtF,YAAY,KAAc,EAAE,EAAU,EAAE,KAAsC;QAC5E,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;QAE3C,MAAM,WAAW,GAA+B;YAC9C,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;YAC9B,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,gDAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,gDAAmB,CAAC,IAAI;YAC5E,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,sCAAS,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;YAC9D,GAAG,KAAK;YACR,YAAY,EAAE,WAAW;gBACvB,CAAC,CAAC;oBACE;wBACE,cAAc,EAAE,WAAW,CAAC,cAAc;qBAC3C;iBACF;gBACH,CAAC,CAAC,EAAE;YACN,aAAa,EAAE,2CAAc,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;SACrD,CAAC;QAEF,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;IAChC,CAAC;CACF;AArBD,gEAqBC","sourcesContent":["import {\n ApplicationListener,\n ApplicationProtocol,\n ListenerAction,\n SslPolicy,\n} from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport type { ApplicationListenerProps } from \"aws-cdk-lib/aws-elasticloadbalancingv2\";\nimport { GuAppAwareConstruct } from \"../../../utils/mixin/app-aware-construct\";\nimport type { GuCertificate } from \"../../acm\";\nimport type { AppIdentity, GuStack } from \"../../core\";\nimport type { GuApplicationTargetGroup } from \"./application-target-group\";\n\nexport interface GuApplicationListenerProps extends ApplicationListenerProps, AppIdentity {}\n\n/**\n * Construct which creates a Listener.\n *\n * This construct should be used in conjunction with [[`GuApplicationLoadBalancer`]] and [[`GuApplicationTargetGroup`]]\n * to route traffic to your application. For more details on these three components, see the\n * [AWS documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html#application-load-balancer-components).\n *\n * If you are running an application which only accepts traffic over HTTPS, consider using [[`GuHttpsApplicationListener`]]\n * to reduce the amount of boilerplate needed when configuring your Listener.\n *\n * This resource is stateful.\n * @see https://github.com/guardian/cdk/blob/main/docs/stateful-resources.md\n */\nexport class GuApplicationListener extends GuAppAwareConstruct(ApplicationListener) {\n constructor(scope: GuStack, id: string, props: GuApplicationListenerProps) {\n super(scope, id, { port: 443, protocol: ApplicationProtocol.HTTPS, ...props });\n }\n}\n\nexport interface GuHttpsApplicationListenerProps\n extends Omit<GuApplicationListenerProps, \"defaultAction\" | \"certificates\">,\n AppIdentity {\n targetGroup: GuApplicationTargetGroup;\n certificate?: GuCertificate;\n}\n\n/**\n * Construct which creates a Listener which accepts HTTPS traffic.\n *\n * You must pass a [[`GuCertificate`]] to this Listener via the `certificate` prop.\n *\n * For general details about Listeners, see [[`GuApplicationListener`]].\n */\nexport class GuHttpsApplicationListener extends GuAppAwareConstruct(ApplicationListener) {\n constructor(scope: GuStack, id: string, props: GuHttpsApplicationListenerProps) {\n const { certificate, targetGroup } = props;\n\n const mergedProps: GuApplicationListenerProps = {\n port: certificate ? 443 : 8080,\n protocol: certificate ? ApplicationProtocol.HTTPS : ApplicationProtocol.HTTP,\n sslPolicy: certificate ? SslPolicy.RECOMMENDED_TLS : undefined,\n ...props,\n certificates: certificate\n ? [\n {\n certificateArn: certificate.certificateArn,\n },\n ]\n : [],\n defaultAction: ListenerAction.forward([targetGroup]),\n };\n\n super(scope, id, mergedProps);\n }\n}\n"]}
@@ -38,9 +38,9 @@ function addAmiParametersToCloudFormationDeployment(cfnDeployment, autoScalingGr
38
38
  throw new Error(`Unable to produce a working riff-raff.yaml file; imageRecipe missing from ASG ${app}`);
39
39
  }
40
40
  const Recipe = typeof imageRecipe === "string" ? imageRecipe : imageRecipe.Recipe;
41
- const AmigoStage = typeof imageRecipe === "string" ? "PROD" : imageRecipe.AmigoStage ?? "PROD";
41
+ const AmigoStage = typeof imageRecipe === "string" ? "PROD" : (imageRecipe.AmigoStage ?? "PROD");
42
42
  // In YAML `true` is a Boolean. Riff-Raff expects a String here, so call `toString` to make it `'true'`.
43
- const Encrypted = (typeof imageRecipe === "string" ? true : imageRecipe.Encrypted ?? true).toString();
43
+ const Encrypted = (typeof imageRecipe === "string" ? true : (imageRecipe.Encrypted ?? true)).toString();
44
44
  return {
45
45
  ...acc,
46
46
  [amiParameter.node.id]: {
@@ -1 +1 @@
1
- {"version":3,"file":"cloudformation.js","sourceRoot":"","sources":["../../../src/riff-raff-yaml-file/deployments/cloudformation.ts"],"names":[],"mappings":";;;AAGA,SAAgB,wBAAwB,CACtC,SAAwC,EACxC,YAAkC,EAClC,gBAAwB;IAExB,qHAAqH;IACrH,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAE7B,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;KAC1F;IAED,MAAM,EACJ,MAAM,EACN,KAAK,EACL,WAAW,EAAE,EAAE,IAAI,EAAE,GACtB,GAAG,QAAQ,CAAC;IAEb,yFAAyF;IACzF,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAE9E,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,CACzC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QACjC,GAAG,GAAG;QACN,CAAC,KAAK,CAAC,EAAE,YAAY;KACtB,CAAC,EACF,EAAE,CACH,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACtD,KAAK,EAAE;YACL,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;YAC1B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YACxB,GAAG,EAAE,cAAc;YACnB,gBAAgB;YAChB,UAAU,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V,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU;YAEjC,gEAAgE;YAChE,GAAG,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC;SAC7D;KACF,CAAC;AACJ,CAAC;AArCD,gGAqCC","sourcesContent":["import type { GuAutoScalingGroup } from \"../../constructs/autoscaling\";\nimport type { CdkStacksDifferingOnlyByStage, RiffRaffDeployment, RiffRaffDeploymentProps } from \"../types\";\n\nexport function cloudFormationDeployment(\n cdkStacks: CdkStacksDifferingOnlyByStage,\n dependencies: RiffRaffDeployment[],\n contentDirectory: string,\n): RiffRaffDeployment {\n // The stacks in `cdkStacks` only differ by stage, so we can just use the first item in the list for key information.\n const [cdkStack] = cdkStacks;\n\n if (!cdkStack) {\n throw new Error(\"Unable to produce a working riff-raff.yaml file; there are no stacks!\");\n }\n\n const {\n region,\n stack,\n constructor: { name },\n } = cdkStack;\n\n // TODO remove `lodash.kebabcase` dep as it's not that much code to kebab-ise a string...\n const kebabClassName = name.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n\n const templateStagePaths = cdkStacks.reduce(\n (acc, { stage, templateFile }) => ({\n ...acc,\n [stage]: templateFile,\n }),\n {},\n );\n\n return {\n name: [\"cfn\", region, stack, kebabClassName].join(\"-\"),\n props: {\n type: \"cloud-formation\",\n regions: new Set([region]),\n stacks: new Set([stack]),\n app: kebabClassName,\n contentDirectory,\n parameters: {\n templateStagePaths,\n },\n // only add the `dependencies` property if there are some\n ...(dependencies.length > 0 && { dependencies: dependencies.map(({ name }) => name) }),\n },\n };\n}\n\nexport function addAmiParametersToCloudFormationDeployment(\n cfnDeployment: RiffRaffDeployment,\n autoScalingGroups: GuAutoScalingGroup[],\n): RiffRaffDeploymentProps {\n const amiParametersToTags = autoScalingGroups.reduce((acc, asg) => {\n const { imageRecipe, app, amiParameter } = asg;\n\n if (!imageRecipe) {\n throw new Error(`Unable to produce a working riff-raff.yaml file; imageRecipe missing from ASG ${app}`);\n }\n\n const Recipe = typeof imageRecipe === \"string\" ? imageRecipe : imageRecipe.Recipe;\n const AmigoStage = typeof imageRecipe === \"string\" ? \"PROD\" : imageRecipe.AmigoStage ?? \"PROD\";\n\n // In YAML `true` is a Boolean. Riff-Raff expects a String here, so call `toString` to make it `'true'`.\n const Encrypted = (typeof imageRecipe === \"string\" ? true : imageRecipe.Encrypted ?? true).toString();\n\n return {\n ...acc,\n [amiParameter.node.id]: {\n BuiltBy: \"amigo\",\n AmigoStage,\n Recipe,\n Encrypted,\n },\n };\n }, {});\n\n return {\n ...cfnDeployment.props,\n parameters: {\n ...cfnDeployment.props.parameters,\n\n // only add the `amiParametersToTags` property if there are some\n ...(autoScalingGroups.length > 0 && { amiParametersToTags }),\n },\n };\n}\n"]}
1
+ {"version":3,"file":"cloudformation.js","sourceRoot":"","sources":["../../../src/riff-raff-yaml-file/deployments/cloudformation.ts"],"names":[],"mappings":";;;AAGA,SAAgB,wBAAwB,CACtC,SAAwC,EACxC,YAAkC,EAClC,gBAAwB;IAExB,qHAAqH;IACrH,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAE7B,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;KAC1F;IAED,MAAM,EACJ,MAAM,EACN,KAAK,EACL,WAAW,EAAE,EAAE,IAAI,EAAE,GACtB,GAAG,QAAQ,CAAC;IAEb,yFAAyF;IACzF,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAE9E,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,CACzC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QACjC,GAAG,GAAG;QACN,CAAC,KAAK,CAAC,EAAE,YAAY;KACtB,CAAC,EACF,EAAE,CACH,CAAC;IAEF,OAAO;QACL,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AC,CAAC,WAAW,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAExG,OAAO;YACL,GAAG,GAAG;YACN,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;gBACtB,OAAO,EAAE,OAAO;gBAChB,UAAU;gBACV,MAAM;gBACN,SAAS;aACV;SACF,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,GAAG,aAAa,CAAC,KAAK;QACtB,UAAU,EAAE;YACV,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU;YAEjC,gEAAgE;YAChE,GAAG,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAC;SAC7D;KACF,CAAC;AACJ,CAAC;AArCD,gGAqCC","sourcesContent":["import type { GuAutoScalingGroup } from \"../../constructs/autoscaling\";\nimport type { CdkStacksDifferingOnlyByStage, RiffRaffDeployment, RiffRaffDeploymentProps } from \"../types\";\n\nexport function cloudFormationDeployment(\n cdkStacks: CdkStacksDifferingOnlyByStage,\n dependencies: RiffRaffDeployment[],\n contentDirectory: string,\n): RiffRaffDeployment {\n // The stacks in `cdkStacks` only differ by stage, so we can just use the first item in the list for key information.\n const [cdkStack] = cdkStacks;\n\n if (!cdkStack) {\n throw new Error(\"Unable to produce a working riff-raff.yaml file; there are no stacks!\");\n }\n\n const {\n region,\n stack,\n constructor: { name },\n } = cdkStack;\n\n // TODO remove `lodash.kebabcase` dep as it's not that much code to kebab-ise a string...\n const kebabClassName = name.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n\n const templateStagePaths = cdkStacks.reduce(\n (acc, { stage, templateFile }) => ({\n ...acc,\n [stage]: templateFile,\n }),\n {},\n );\n\n return {\n name: [\"cfn\", region, stack, kebabClassName].join(\"-\"),\n props: {\n type: \"cloud-formation\",\n regions: new Set([region]),\n stacks: new Set([stack]),\n app: kebabClassName,\n contentDirectory,\n parameters: {\n templateStagePaths,\n },\n // only add the `dependencies` property if there are some\n ...(dependencies.length > 0 && { dependencies: dependencies.map(({ name }) => name) }),\n },\n };\n}\n\nexport function addAmiParametersToCloudFormationDeployment(\n cfnDeployment: RiffRaffDeployment,\n autoScalingGroups: GuAutoScalingGroup[],\n): RiffRaffDeploymentProps {\n const amiParametersToTags = autoScalingGroups.reduce((acc, asg) => {\n const { imageRecipe, app, amiParameter } = asg;\n\n if (!imageRecipe) {\n throw new Error(`Unable to produce a working riff-raff.yaml file; imageRecipe missing from ASG ${app}`);\n }\n\n const Recipe = typeof imageRecipe === \"string\" ? imageRecipe : imageRecipe.Recipe;\n const AmigoStage = typeof imageRecipe === \"string\" ? \"PROD\" : (imageRecipe.AmigoStage ?? \"PROD\");\n\n // In YAML `true` is a Boolean. Riff-Raff expects a String here, so call `toString` to make it `'true'`.\n const Encrypted = (typeof imageRecipe === \"string\" ? true : (imageRecipe.Encrypted ?? true)).toString();\n\n return {\n ...acc,\n [amiParameter.node.id]: {\n BuiltBy: \"amigo\",\n AmigoStage,\n Recipe,\n Encrypted,\n },\n };\n }, {});\n\n return {\n ...cfnDeployment.props,\n parameters: {\n ...cfnDeployment.props.parameters,\n\n // only add the `amiParametersToTags` property if there are some\n ...(autoScalingGroups.length > 0 && { amiParametersToTags }),\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@guardian/cdk",
3
3
  "description": "Generic Guardian flavoured AWS CDK components",
4
- "version": "59.2.0",
4
+ "version": "59.2.2",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
@@ -38,7 +38,7 @@
38
38
  "@types/lodash.camelcase": "^4.3.9",
39
39
  "@types/lodash.kebabcase": "^4.1.9",
40
40
  "@types/lodash.upperfirst": "^4.3.9",
41
- "@types/node": "20.14.10",
41
+ "@types/node": "22.0.2",
42
42
  "@types/yargs": "^17.0.32",
43
43
  "aws-cdk": "2.148.0",
44
44
  "aws-cdk-lib": "2.148.0",
@@ -47,19 +47,19 @@
47
47
  "eslint-plugin-custom-rules": "file:tools/eslint",
48
48
  "gh-pages": "^6.1.1",
49
49
  "jest": "^29.7.0",
50
- "prettier": "^3.3.2",
50
+ "prettier": "^3.3.3",
51
51
  "serve": "^14.2.3",
52
- "ts-jest": "^29.2.2",
52
+ "ts-jest": "^29.2.4",
53
53
  "ts-node": "^10.9.2",
54
- "typedoc": "^0.26.4",
54
+ "typedoc": "^0.26.5",
55
55
  "typescript": "5.1.6"
56
56
  },
57
57
  "dependencies": {
58
58
  "@oclif/core": "3.26.6",
59
- "aws-sdk": "^2.1649.0",
59
+ "aws-sdk": "^2.1665.0",
60
60
  "chalk": "^4.1.2",
61
61
  "codemaker": "^1.101.0",
62
- "git-url-parse": "^14.0.0",
62
+ "git-url-parse": "^14.1.0",
63
63
  "js-yaml": "^4.1.0",
64
64
  "lodash.camelcase": "^4.3.0",
65
65
  "lodash.kebabcase": "^4.1.1",