@guardian/cdk 63.6.2 → 64.1.0
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/lib/aspects/cfn-include-reporter.js.map +1 -1
- package/lib/aspects/cfn-parameter-reporter.js.map +1 -1
- package/lib/aspects/metadata.js.map +1 -1
- package/lib/bin/aws-credential-provider.d.ts.map +1 -1
- package/lib/bin/commands/account-readiness/index.d.ts.map +1 -1
- package/lib/bin/commands/account-readiness/index.js.map +1 -1
- package/lib/bin/commands/account-readiness/ssm.d.ts.map +1 -1
- package/lib/bin/commands/account-readiness/ssm.js.map +1 -1
- package/lib/bin/commands/aws-cdk-version.d.ts.map +1 -1
- package/lib/bin/commands/new-project/index.d.ts.map +1 -1
- package/lib/bin/commands/new-project/index.js.map +1 -1
- package/lib/bin/commands/new-project/utils/app.d.ts.map +1 -1
- package/lib/bin/commands/new-project/utils/app.js.map +1 -1
- package/lib/bin/commands/new-project/utils/imports.js.map +1 -1
- package/lib/bin/commands/new-project/utils/init.d.ts.map +1 -1
- package/lib/bin/commands/new-project/utils/init.js.map +1 -1
- package/lib/bin/commands/new-project/utils/snapshot.d.ts.map +1 -1
- package/lib/bin/commands/new-project/utils/snapshot.js.map +1 -1
- package/lib/bin/commands/new-project/utils/stack.d.ts.map +1 -1
- package/lib/bin/commands/new-project/utils/stack.js.map +1 -1
- package/lib/bin/commands/new-project/utils/utils.js +1 -2
- package/lib/bin/commands/new-project/utils/utils.js.map +1 -1
- package/lib/bin/index.js.map +1 -1
- package/lib/constants/library-info.js +3 -3
- package/lib/constants/library-info.js.map +1 -1
- package/lib/constructs/autoscaling/asg.js.map +1 -1
- package/lib/constructs/autoscaling/user-data.js.map +1 -1
- package/lib/constructs/cloudwatch/alarm.js.map +1 -1
- package/lib/constructs/core/identity.d.ts.map +1 -1
- package/lib/constructs/core/parameters/anghammarad.js.map +1 -1
- package/lib/constructs/core/parameters/fastly.js.map +1 -1
- package/lib/constructs/core/parameters/log-shipping.js.map +1 -1
- package/lib/constructs/core/parameters/s3.js.map +1 -1
- package/lib/constructs/core/parameters/vpc.js.map +1 -1
- package/lib/constructs/core/stack.js.map +1 -1
- package/lib/constructs/dns/dns-records.js.map +1 -1
- package/lib/constructs/ec2/security-groups/base.js.map +1 -1
- package/lib/constructs/ec2/vpc.d.ts.map +1 -1
- package/lib/constructs/ec2/vpc.js.map +1 -1
- package/lib/constructs/ecs/ecs-task.js +1 -1
- package/lib/constructs/ecs/ecs-task.js.map +1 -1
- package/lib/constructs/iam/policies/anghammarad.js.map +1 -1
- package/lib/constructs/iam/policies/describe-ec2.js.map +1 -1
- package/lib/constructs/iam/policies/kcl.js +1 -1
- package/lib/constructs/iam/policies/kcl.js.map +1 -1
- package/lib/constructs/iam/policies/log-shipping.js.map +1 -1
- package/lib/constructs/iam/policies/parameter-store-read.d.ts +8 -1
- package/lib/constructs/iam/policies/parameter-store-read.d.ts.map +1 -1
- package/lib/constructs/iam/policies/parameter-store-read.js +21 -0
- package/lib/constructs/iam/policies/parameter-store-read.js.map +1 -1
- package/lib/constructs/iam/policies/ssm-ssh.js.map +1 -1
- package/lib/constructs/iam/roles/instance-role.js +1 -1
- package/lib/constructs/iam/roles/instance-role.js.map +1 -1
- package/lib/constructs/lambda/lambda.js.map +1 -1
- package/lib/constructs/loadbalancing/alb/application-load-balancer.js.map +1 -1
- package/lib/constructs/loadbalancing/alb/application-target-group.js +1 -1
- package/lib/constructs/loadbalancing/alb/application-target-group.js.map +1 -1
- package/lib/constructs/ses/index.js.map +1 -1
- package/lib/constructs/vpc/vpc.js.map +1 -1
- package/lib/experimental/constructs/iam/policies/developer-policy.js.map +1 -1
- package/lib/experimental/constructs/riff-raff-deployment-id.js.map +1 -1
- package/lib/experimental/patterns/ec2-app.js.map +1 -1
- package/lib/experimental/patterns/gu-load-balanced-app.d.ts +5 -5
- package/lib/experimental/patterns/gu-load-balanced-app.d.ts.map +1 -1
- package/lib/experimental/patterns/gu-load-balanced-app.js +37 -28
- package/lib/experimental/patterns/gu-load-balanced-app.js.map +1 -1
- package/lib/patterns/api-lambda.js.map +1 -1
- package/lib/patterns/api-multiple-lambdas.js.map +1 -1
- package/lib/patterns/ec2-app/base.d.ts +3 -3
- package/lib/patterns/ec2-app/base.d.ts.map +1 -1
- package/lib/patterns/ec2-app/base.js +4 -11
- package/lib/patterns/ec2-app/base.js.map +1 -1
- package/lib/riff-raff-yaml-file/deployments/autoscaling.js +2 -3
- package/lib/riff-raff-yaml-file/deployments/autoscaling.js.map +1 -1
- package/lib/riff-raff-yaml-file/deployments/cloudformation.js +3 -4
- package/lib/riff-raff-yaml-file/deployments/cloudformation.js.map +1 -1
- package/lib/riff-raff-yaml-file/deployments/lambda.js +2 -3
- package/lib/riff-raff-yaml-file/deployments/lambda.js.map +1 -1
- package/lib/riff-raff-yaml-file/deployments/update-parameters.js +1 -2
- package/lib/riff-raff-yaml-file/deployments/update-parameters.js.map +1 -1
- package/lib/riff-raff-yaml-file/group-by.js +5 -6
- package/lib/riff-raff-yaml-file/group-by.js.map +1 -1
- package/lib/riff-raff-yaml-file/index.js +2 -2
- package/lib/riff-raff-yaml-file/index.js.map +1 -1
- package/lib/types/access.js.map +1 -1
- package/lib/utils/array.js +1 -2
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/cli/vpc.d.ts.map +1 -1
- package/lib/utils/cli/vpc.js.map +1 -1
- package/lib/utils/cognito/cognito.d.ts.map +1 -1
- package/lib/utils/exec.js +2 -3
- package/lib/utils/exec.js.map +1 -1
- package/lib/utils/git.js +2 -3
- package/lib/utils/git.js.map +1 -1
- package/lib/utils/lambda/event-source.js +2 -2
- package/lib/utils/lambda/event-source.js.map +1 -1
- package/lib/utils/math.d.ts.map +1 -1
- package/lib/utils/mixin/app-aware-construct.js +1 -2
- package/lib/utils/mixin/app-aware-construct.js.map +1 -1
- package/lib/utils/security-groups/helpers.d.ts.map +1 -1
- package/lib/utils/singleton.d.ts +1 -1
- package/lib/utils/singleton.d.ts.map +1 -1
- package/lib/utils/string.d.ts.map +1 -1
- package/lib/utils/test/assertions.js.map +1 -1
- package/lib/utils/test/attach-policy-to-test-role.d.ts.map +1 -1
- package/lib/utils/test/simple-gu-stack.js +1 -2
- package/lib/utils/test/simple-gu-stack.js.map +1 -1
- package/lib/utils/test/template.js +1 -2
- package/lib/utils/test/template.js.map +1 -1
- package/package.json +4 -4
package/lib/utils/cli/vpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpc.js","sourceRoot":"","sources":["../../../src/utils/cli/vpc.ts"],"names":[],"mappings":";;;AAEA,+CAAoF;AAEpF,kCAA8B;AAEjB,QAAA,2BAA2B,GAAa,mCAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3G,CAAC,CAAC,UAAU,CAAC,oCAAwB,CAAC,CACvC,CAAC;AAEW,QAAA,oBAAoB,GAAa,mCAA2B,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;IAC5F,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAChE,OAAO,IAAI,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH,MAAM,6BAA6B,GAAG,KAAK,EAAE,SAAc,EAAwB,EAAE;IACnF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,mBAAmB,CAAC;QACjD,IAAI,EAAE,oCAAwB;QAC9B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;AACjC,CAAC,CAAC;AAEK,MAAM,sBAAsB,GAAG,KAAK,EAAE,SAAc,EAAwB,EAAE;IACnF,MAAM,mBAAmB,GAAG,MAAM,6BAA6B,CAAC,SAAS,CAAC,CAAC;IAE3E,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type { DescribeSubnetsResult, DescribeVpcsResult, EC2, Subnet, Vpc } from \"@aws-sdk/client-ec2\";\nimport type { Parameter, SSM } from \"@aws-sdk/client-ssm\";\nimport { ALL_SSM_PARAMETER_PATHS, VPC_SSM_PARAMETER_PREFIX } from \"../../constants\";\nimport type { VpcInDetail } from \"../../types/cli\";\nimport { sum } from \"../math\";\n\nexport const primaryVpcSsmParameterPaths: string[] = ALL_SSM_PARAMETER_PATHS.map((_) => _.path).filter((_) =>\n _.startsWith(VPC_SSM_PARAMETER_PREFIX),\n);\n\nexport const vpcSsmParameterPaths: RegExp[] = primaryVpcSsmParameterPaths.map((primaryPath) => {\n const reBody = primaryPath.replace(\"primary\", \"([A-z0-9.-_])+\");\n return new RegExp(`^${reBody}$`);\n});\n\nconst getSsmParametersWithVpcPrefix = async (ssmClient: SSM): Promise<Parameter[]> => {\n const params = await ssmClient.getParametersByPath({\n Path: VPC_SSM_PARAMETER_PREFIX,\n Recursive: true,\n });\n\n return params.Parameters ?? [];\n};\n\nexport const getSsmParametersForVpc = async (ssmClient: SSM): Promise<Parameter[]> => {\n const paramsWithVpcPrefix = await getSsmParametersWithVpcPrefix(ssmClient);\n\n return paramsWithVpcPrefix.filter((param) => {\n const path = param.Name;\n if (!path) {\n return false;\n }\n\n return vpcSsmParameterPaths.filter((re) => re.exec(path)).length > 0;\n });\n};\n\nconst getSubnetsForVpc = async (vpc: Vpc, ec2Client: EC2): Promise<Subnet[]> => {\n if (!vpc.VpcId) {\n return [];\n }\n const response: DescribeSubnetsResult = await ec2Client.describeSubnets({\n Filters: [{ Name: \"vpc-id\", Values: [vpc.VpcId] }],\n });\n return response.Subnets ?? [];\n};\n\nconst getVpcs = async (ec2Client: EC2): Promise<Vpc[]> => {\n const vpcs: DescribeVpcsResult = await ec2Client.describeVpcs();\n return vpcs.Vpcs ?? [];\n};\n\nconst totalUnusedAddressesInSubnet = (subnets: Subnet[]): number => {\n return sum(subnets.map((_) => _.AvailableIpAddressCount ?? 0));\n};\n\nconst countFromCidr = (cidr: string): number => {\n const UNUSABLE_IPS_IN_CIDR_BLOCK = 5;\n\n const [, mask] = cidr.split(\"/\");\n const maskAsNumber = Number(mask);\n\n if (isNaN(maskAsNumber)) {\n return 0;\n }\n\n const hostBits = 32 - maskAsNumber;\n return Math.pow(2, hostBits) - UNUSABLE_IPS_IN_CIDR_BLOCK;\n};\n\nconst totalCapacityOfSubnet = (subnets: Subnet[]): number => {\n const counts = subnets\n .map((subnet) => subnet.CidrBlock)\n .map((cidrBlock) => (cidrBlock ? countFromCidr(cidrBlock) : 0));\n\n return sum(counts.filter((_) => !!_));\n};\n\nexport const getVpcsInDetail = async (ec2Client: EC2): Promise<VpcInDetail[]> => {\n const vpcs = await getVpcs(ec2Client);\n\n return await Promise.all(\n vpcs.map(async (vpc) => {\n const subnets = await getSubnetsForVpc(vpc, ec2Client);\n\n const isUsed: boolean = totalCapacityOfSubnet(subnets) - totalUnusedAddressesInSubnet(subnets) !== 0;\n\n return {\n ...vpc,\n subnets,\n isUsed,\n };\n }),\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cognito.d.ts","sourceRoot":"","sources":["../../../src/utils/cognito/cognito.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"cognito.d.ts","sourceRoot":"","sources":["../../../src/utils/cognito/cognito.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,GAAI,QAAQ,MAAM,KAAG,MAWxD,CAAC"}
|
package/lib/utils/exec.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.execute = execute;
|
|
7
|
+
exports.executeSync = executeSync;
|
|
7
8
|
const child_process_1 = __importDefault(require("child_process"));
|
|
8
9
|
// copied from https://github.com/aws/aws-cdk/blob/eda1640fcaf6375d7edc5f8edcb5d69c82d130a1/packages/aws-cdk/lib/init.ts#L381-L404
|
|
9
10
|
async function execute(cmd, args, { cwd }) {
|
|
@@ -28,7 +29,6 @@ async function execute(cmd, args, { cwd }) {
|
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
exports.execute = execute;
|
|
32
32
|
function executeSync(cmd, args, { cwd }) {
|
|
33
33
|
const { stdout, status } = child_process_1.default.spawnSync(cmd, args, {
|
|
34
34
|
cwd,
|
|
@@ -43,5 +43,4 @@ function executeSync(cmd, args, { cwd }) {
|
|
|
43
43
|
throw new Error(`${cmd} exited with status ${status ?? "unknown"}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
exports.executeSync = executeSync;
|
|
47
46
|
//# sourceMappingURL=exec.js.map
|
package/lib/utils/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":";;;;;AAGA,0BAuBC;AAED,kCAaC;AAzCD,kEAAyC;AAEzC,kIAAkI;AAC3H,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,IAAc,EAAE,EAAE,GAAG,EAAmB;IACjF,MAAM,KAAK,GAAG,uBAAY,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;QAC1C,GAAG;QACH,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;KACrC,CAAC,CAAC;IAEH,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,gHAAgH;IAChH,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,IA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AC","sourcesContent":["import childProcess from \"child_process\";\n\n// copied from https://github.com/aws/aws-cdk/blob/eda1640fcaf6375d7edc5f8edcb5d69c82d130a1/packages/aws-cdk/lib/init.ts#L381-L404\nexport async function execute(cmd: string, args: string[], { cwd }: { cwd: string }): Promise<string> {\n const child = childProcess.spawn(cmd, args, {\n cwd,\n shell: false,\n stdio: [\"ignore\", \"pipe\", \"inherit\"],\n });\n\n let stdout = \"\";\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access -- ???\n child.stdout.on(\"data\", (chunk) => (stdout += chunk.toString()));\n\n return new Promise<string>((ok, fail) => {\n child.once(\"error\", (err) => fail(err));\n child.once(\"exit\", (status) => {\n if (status === 0) {\n return ok(stdout.trim());\n } else {\n process.stderr.write(stdout);\n return fail(new Error(`${cmd} exited with status ${status ?? \"unknown\"}`));\n }\n });\n });\n}\n\nexport function executeSync(cmd: string, args: string[], { cwd }: { cwd: string }): string {\n const { stdout, status } = childProcess.spawnSync(cmd, args, {\n cwd,\n shell: false,\n stdio: [\"ignore\", \"pipe\", \"inherit\"],\n });\n\n if (status === 0) {\n return stdout.toString().trim();\n } else {\n process.stderr.write(stdout);\n throw new Error(`${cmd} exited with status ${status ?? \"unknown\"}`);\n }\n}\n"]}
|
package/lib/utils/git.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.gitRemoteOriginUrl = gitRemoteOriginUrl;
|
|
4
|
+
exports.gitRootOrCwd = gitRootOrCwd;
|
|
4
5
|
const exec_1 = require("./exec");
|
|
5
6
|
function gitRemoteOriginUrl() {
|
|
6
7
|
return (0, exec_1.executeSync)("git", ["config", "--get", "remote.origin.url"], {
|
|
7
8
|
cwd: process.cwd(),
|
|
8
9
|
});
|
|
9
10
|
}
|
|
10
|
-
exports.gitRemoteOriginUrl = gitRemoteOriginUrl;
|
|
11
11
|
function gitRootOrCwd() {
|
|
12
12
|
const cwd = process.cwd();
|
|
13
13
|
try {
|
|
@@ -20,5 +20,4 @@ function gitRootOrCwd() {
|
|
|
20
20
|
return cwd;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.gitRootOrCwd = gitRootOrCwd;
|
|
24
23
|
//# sourceMappingURL=git.js.map
|
package/lib/utils/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":";;AAEA,gDAIC;AAED,oCAWC;AAnBD,iCAAqC;AAErC,SAAgB,kBAAkB;IAChC,OAAO,IAAA,kBAAW,EAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,mBAAmB,CAAC,EAAE;QAClE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;KACnB,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,YAAY;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,IAAI,CAAC;QACH,OAAO,IAAA,kBAAW,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE;YAC1D,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,4DAA4D,GAAG,EAAE,CAAC,CAAC;QAChF,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC","sourcesContent":["import { executeSync } from \"./exec\";\n\nexport function gitRemoteOriginUrl(): string {\n return executeSync(\"git\", [\"config\", \"--get\", \"remote.origin.url\"], {\n cwd: process.cwd(),\n });\n}\n\nexport function gitRootOrCwd(): string {\n const cwd = process.cwd();\n\n try {\n return executeSync(\"git\", [\"rev-parse\", \"--show-toplevel\"], {\n cwd,\n });\n } catch (err) {\n console.warn(`Failed to identify a git repository. Falling back to CWD ${cwd}`);\n return cwd;\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StreamRetry =
|
|
3
|
+
exports.StreamRetry = void 0;
|
|
4
|
+
exports.toAwsErrorHandlingProps = toAwsErrorHandlingProps;
|
|
4
5
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
6
|
function toAwsErrorHandlingProps(errorHandlingProps) {
|
|
6
7
|
return {
|
|
@@ -9,7 +10,6 @@ function toAwsErrorHandlingProps(errorHandlingProps) {
|
|
|
9
10
|
...errorHandlingProps.retryBehaviour.toAwsProp(),
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
|
-
exports.toAwsErrorHandlingProps = toAwsErrorHandlingProps;
|
|
13
13
|
/**
|
|
14
14
|
* To retry based on number of attempts, use:
|
|
15
15
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-source.js","sourceRoot":"","sources":["../../../src/utils/lambda/event-source.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"event-source.js","sourceRoot":"","sources":["../../../src/utils/lambda/event-source.ts"],"names":[],"mappings":";;;AAuCA,0DAMC;AA7CD,6CAAuC;AAuCvC,SAAgB,uBAAuB,CAAC,kBAA4C;IAClF,OAAO;QACL,kBAAkB,EAAE,kBAAkB,CAAC,kBAAkB;QACzD,SAAS,EAAE,kBAAkB,CAAC,gCAAgC;QAC9D,GAAG,kBAAkB,CAAC,cAAc,CAAC,SAAS,EAAE;KACjD,CAAC;AACJ,CAAC;AAKD;;;;;;;;;GASG;AACH,MAAa,WAAW;IACf,MAAM,CAAC,WAAW,CAAC,MAAc;QACtC,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,QAAkB;QACrC,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IACM,SAAS;QACd,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU;YAClC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE;YAChC,CAAC,CAAC,EAAE,YAAY,EAAE,sBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACtD,CAAC;IAID,YAAoB,MAAc,EAAE,IAAe;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AAnBD,kCAmBC","sourcesContent":["import { Duration } from \"aws-cdk-lib\";\nimport type { IEventSourceDlq } from \"aws-cdk-lib/aws-lambda\";\nimport type { KinesisEventSourceProps } from \"aws-cdk-lib/aws-lambda-event-sources\";\n\nexport type StreamProcessingProps = Omit<\n KinesisEventSourceProps,\n \"bisectBatchOnError\" | \"maxRecordAge\" | \"onFailure\" | \"retryAttempts\"\n>;\n\n/**\n * In order to prevent your lambda from continuously retrying if it encounters errors\n * whilst processing a batch, use `retryBehaviour` to give up on a record once it reaches a certain age,\n * or after a specified number of attempts. See [[`StreamRetry`]] for more details.\n *\n * In order to isolate bad records as part of the retry process, you may also want to bisect problematic batches\n * using `bisectBatchOnError`. For example:\n *\n * ```typescript\n * const errorHandlingProps: ErrorHandlingProps = {\n * bisectBatchOnError: true,\n * retryBehaviour: StreamRetry.maxAttempts(5),\n * }\n * ```\n *\n * Records which could not be processed successfully can (optionally) be sent to a dead letter queue\n * via `deadLetterQueueForSkippedRecords`.\n */\nexport interface StreamErrorHandlingProps {\n retryBehaviour: StreamRetry;\n bisectBatchOnError: boolean;\n deadLetterQueueForSkippedRecords?: IEventSourceDlq;\n blockProcessingAndRetryIndefinitely?: false;\n}\n\ntype AwsErrorHandlingProps = Pick<\n KinesisEventSourceProps,\n \"bisectBatchOnError\" | \"maxRecordAge\" | \"onFailure\" | \"retryAttempts\"\n>;\n\nexport function toAwsErrorHandlingProps(errorHandlingProps: StreamErrorHandlingProps): AwsErrorHandlingProps {\n return {\n bisectBatchOnError: errorHandlingProps.bisectBatchOnError,\n onFailure: errorHandlingProps.deadLetterQueueForSkippedRecords,\n ...errorHandlingProps.retryBehaviour.toAwsProp(),\n };\n}\n\ntype AwsRetryProp = Pick<AwsErrorHandlingProps, \"maxRecordAge\" | \"retryAttempts\">;\ntype RetryType = \"attempts\" | \"recordAge\";\n\n/**\n * To retry based on number of attempts, use:\n * ```typescript\n * StreamRetry.maxAttempts(5)\n * ```\n * To retry based on the age of a record, use:\n * ```typescript\n * StreamRetry.maxAge(Duration.minutes(5))\n * ```\n */\nexport class StreamRetry {\n public static maxAttempts(amount: number): StreamRetry {\n return new StreamRetry(amount, \"attempts\");\n }\n public static maxAge(duration: Duration): StreamRetry {\n return new StreamRetry(duration.toSeconds(), \"recordAge\");\n }\n public toAwsProp(): AwsRetryProp {\n return this.retryType === \"attempts\"\n ? { retryAttempts: this.amount }\n : { maxRecordAge: Duration.seconds(this.amount) };\n }\n private readonly amount: number;\n readonly retryType: RetryType;\n\n private constructor(amount: number, type: RetryType) {\n this.amount = amount;\n this.retryType = type;\n }\n}\n"]}
|
package/lib/utils/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,GAAI,OAAO,MAAM,EAAE,KAAG,MAAsE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GuAppAwareConstruct =
|
|
3
|
+
exports.GuAppAwareConstruct = GuAppAwareConstruct;
|
|
4
4
|
const constructs_1 = require("constructs");
|
|
5
5
|
const core_1 = require("../../constructs/core");
|
|
6
6
|
function GuAppAwareConstruct(BaseClass) {
|
|
@@ -32,5 +32,4 @@ function GuAppAwareConstruct(BaseClass) {
|
|
|
32
32
|
}
|
|
33
33
|
return Mixin;
|
|
34
34
|
}
|
|
35
|
-
exports.GuAppAwareConstruct = GuAppAwareConstruct;
|
|
36
35
|
//# sourceMappingURL=app-aware-construct.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-aware-construct.js","sourceRoot":"","sources":["../../../src/utils/mixin/app-aware-construct.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-aware-construct.js","sourceRoot":"","sources":["../../../src/utils/mixin/app-aware-construct.ts"],"names":[],"mappings":";;AAIA,kDAuCC;AA3CD,2CAAuC;AACvC,gDAAoD;AAGpD,SAAgB,mBAAmB,CAA+B,SAAgB;IAChF,MAAM,KAAM,SAAQ,SAAS;QAO3B,wGAAwG;QACxG,YAAsB,GAAG,IAAW;YAClC,4EAA4E;YAC5E,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;YAEzC,IAAI,CAAC,kBAAW,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;YACrF,CAAC;YAED,MAAM,GAAG,GAAW,KAAK,CAAC,GAAG,CAAC;YAC9B,MAAM,SAAS,GAAG,kBAAW,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE,EAAY,CAAC,CAAC;YAEhE,4EAA4E;YAC5E,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;YACnD,0EAA0E;YAC1E,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC;YAElB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAE3B;;;;;iBAKK;YACL,IAAI,sBAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChC,kBAAW,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { Construct } from \"constructs\";\nimport { AppIdentity } from \"../../constructs/core\";\nimport type { AnyConstructor } from \"./types\";\n\nexport function GuAppAwareConstruct<TBase extends AnyConstructor>(BaseClass: TBase) {\n class Mixin extends BaseClass {\n /**\n * The ID of the construct with the App suffix.\n * This should be used in place of `id` when trying to reference the construct.\n */\n readonly idWithApp: string;\n\n // eslint-disable-next-line custom-rules/valid-constructors, @typescript-eslint/no-explicit-any -- mixin\n protected constructor(...args: any[]) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- mixin\n const [scope, id, props, ...rest] = args;\n\n if (!AppIdentity.isAppIdentity(props)) {\n throw new Error(\"Cannot use the GuAppAwareConstruct mixin without an AppIdentity\");\n }\n\n const app: string = props.app;\n const idWithApp = AppIdentity.suffixText({ app }, id as string);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- mixin\n const newArgs = [scope, idWithApp, props, ...rest];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- mixin\n super(...newArgs);\n\n this.idWithApp = idWithApp;\n\n /*\n Add the `App` tag to the construct.\n Although not every resource can be tagged, it's still safe to make the call.\n If AWS support tags on a new resource one day, our test suite will fail and we can celebrate!\n See https://docs.aws.amazon.com/ARG/latest/userguide/supported-resources.html\n */\n if (Construct.isConstruct(this)) {\n AppIdentity.taggedConstruct({ app }, this);\n }\n }\n }\n return Mixin;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/security-groups/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,eAAO,MAAM,kCAAkC,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/security-groups/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,eAAO,MAAM,kCAAkC,GAC7C,YAAY,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACnC,MAAM,IAAI,GAAG,MAAM,KAClB,uBAAuB,EAQzB,CAAC"}
|
package/lib/utils/singleton.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../src/utils/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../src/utils/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,OAAO,EAAE,yBAAyB;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,KAAG,OAGrG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAM1C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MAKzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../../src/utils/test/assertions.ts"],"names":[],"mappings":";;;AAAA,uDAAyD;AAEzD,+CAA4D;AAe5D,SAAS,aAAa,CAAC,IAAW;IAChC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../../src/utils/test/assertions.ts"],"names":[],"mappings":";;;AAAA,uDAAyD;AAEzD,+CAA4D;AAe5D,SAAS,aAAa,CAAC,IAAW;IAChC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;YACvD,OAAO,CAAC,CAAC,CAAC;QACZ,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;YACvD,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CA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IAAI,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,kBAAkB,CAAC,IAAY,EAAE,GAAQ;QACvC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,EAAE;YACxC,IAAI,EAAE,kBAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC;CACF;AAnFD,gCAmFC","sourcesContent":["import { Match, Template } from \"aws-cdk-lib/assertions\";\nimport type { Resource } from \"aws-cdk-lib/assertions/lib/private/template\";\nimport { MetadataKeys, TrackingTag } from \"../../constants\";\nimport type { AppIdentity, GuStack } from \"../../constructs/core\";\n\ninterface Tag {\n Key: string;\n Value: unknown;\n PropagateAtLaunch?: boolean;\n}\n\ninterface GuTagMatcherProps {\n appIdentity?: AppIdentity;\n additionalTags?: Tag[];\n propagateAtLaunch?: boolean;\n}\n\nfunction sortTagsByKey(tags: Tag[]): Tag[] {\n return [...tags].sort((first, second) => {\n if (first.Key.toLowerCase() < second.Key.toLowerCase()) {\n return -1;\n }\n if (first.Key.toLowerCase() > second.Key.toLowerCase()) {\n return 1;\n }\n return 0;\n });\n}\n\nexport class GuTemplate {\n private readonly template: Template;\n private readonly stack: GuStack;\n\n private constructor(scope: GuStack) {\n this.stack = scope;\n this.template = Template.fromStack(scope);\n }\n\n static fromStack(stack: GuStack) {\n return new GuTemplate(stack);\n }\n\n findResourceByLogicalId(type: string, logicalId: string | RegExp): Record<string, Resource> | undefined {\n const resources = this.template.findResources(type) as Record<string, Resource>;\n\n const match = Object.entries(resources).find(([id, resource]) => {\n const idMatch = logicalId instanceof RegExp ? logicalId.test(id) : id === logicalId;\n return idMatch && resource;\n });\n\n if (match) {\n const [logicalId, resource] = match;\n return { [logicalId]: resource };\n }\n\n return undefined;\n }\n\n hasResourceWithLogicalId(type: string, logicalId: string | RegExp) {\n const result = this.findResourceByLogicalId(type, logicalId);\n\n if (!result) {\n throw new Error(`No resource found matching logicalId ${logicalId.toString()} and Type ${type}`);\n }\n }\n\n hasGuTaggedResource(type: string, props?: GuTagMatcherProps) {\n const { stack, stage } = this.stack;\n const { appIdentity, additionalTags, propagateAtLaunch } = props ?? {};\n\n const coreTags = [\n {\n Key: \"Stack\",\n Value: stack,\n },\n {\n Key: \"Stage\",\n Value: stage,\n },\n TrackingTag,\n {\n Key: MetadataKeys.REPOSITORY_NAME,\n Value: \"guardian/cdk\",\n },\n ];\n\n const tagMap = new Map<string, Tag>();\n coreTags.forEach((tag) => tagMap.set(tag.Key, tag));\n\n if (appIdentity) {\n tagMap.set(\"App\", { Key: \"App\", Value: appIdentity.app });\n }\n\n if (additionalTags) {\n additionalTags.forEach((tag) => tagMap.set(tag.Key, tag));\n }\n\n // set `PropagateAtLaunch` if the prop is defined\n if (propagateAtLaunch !== undefined) {\n tagMap.forEach((tag) => {\n tagMap.set(tag.Key, { ...tag, PropagateAtLaunch: propagateAtLaunch });\n });\n }\n\n this.template.hasResourceProperties(type, { Tags: sortTagsByKey(Array.from(tagMap.values())) });\n }\n\n hasResourceWithTag(type: string, tag: Tag) {\n this.template.hasResourceProperties(type, {\n Tags: Match.arrayWith([tag]),\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-policy-to-test-role.d.ts","sourceRoot":"","sources":["../../../src/utils/test/attach-policy-to-test-role.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"attach-policy-to-test-role.d.ts","sourceRoot":"","sources":["../../../src/utils/test/attach-policy-to-test-role.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,eAAO,MAAM,sBAAsB,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,EAAE,KAAI,MAAmB,KAAG,IAM9F,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.simpleGuStackForTesting =
|
|
3
|
+
exports.simpleGuStackForTesting = simpleGuStackForTesting;
|
|
4
4
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
5
|
const core_1 = require("../../constructs/core");
|
|
6
6
|
function simpleGuStackForTesting(props) {
|
|
@@ -10,5 +10,4 @@ function simpleGuStackForTesting(props) {
|
|
|
10
10
|
...props,
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
exports.simpleGuStackForTesting = simpleGuStackForTesting;
|
|
14
13
|
//# sourceMappingURL=simple-gu-stack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-gu-stack.js","sourceRoot":"","sources":["../../../src/utils/test/simple-gu-stack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simple-gu-stack.js","sourceRoot":"","sources":["../../../src/utils/test/simple-gu-stack.ts"],"names":[],"mappings":";;AAIA,0DAMC;AAVD,6CAAkC;AAClC,gDAAgD;AAGhD,SAAgB,uBAAuB,CAAC,KAA6B;IACnE,OAAO,IAAI,cAAO,CAAC,IAAI,iBAAG,EAAE,EAAE,MAAM,EAAE;QACpC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,YAAY;QACnC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM;QAC7B,GAAG,KAAK;KACT,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { App } from \"aws-cdk-lib\";\nimport { GuStack } from \"../../constructs/core\";\nimport type { GuStackProps } from \"../../constructs/core\";\n\nexport function simpleGuStackForTesting(props?: Partial<GuStackProps>) {\n return new GuStack(new App(), \"Test\", {\n stack: props?.stack ?? \"test-stack\",\n stage: props?.stage ?? \"TEST\",\n ...props,\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTemplateAfterAspectInvocation =
|
|
3
|
+
exports.getTemplateAfterAspectInvocation = getTemplateAfterAspectInvocation;
|
|
4
4
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
5
|
const assertions_1 = require("aws-cdk-lib/assertions");
|
|
6
6
|
const cx_api_1 = require("aws-cdk-lib/cx-api");
|
|
@@ -25,5 +25,4 @@ function getTemplateAfterAspectInvocation(stack) {
|
|
|
25
25
|
}
|
|
26
26
|
return assertions_1.Template.fromJSON(cfnStack.template);
|
|
27
27
|
}
|
|
28
|
-
exports.getTemplateAfterAspectInvocation = getTemplateAfterAspectInvocation;
|
|
29
28
|
//# sourceMappingURL=template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/utils/test/template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/utils/test/template.ts"],"names":[],"mappings":";;AAaA,4EAgBC;AA7BD,6CAAkC;AAClC,uDAAkD;AAClD,+CAAiE;AAGjE;;;;;;;GAOG;AACH,SAAgB,gCAAgC,CAAC,KAAc;IAC7D,MAAM,GAAG,GAAG,iBAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAE1B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,mDAAmD,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoC,EAAE,CAAC,CAAC,YAAY,oCAA2B,CAAC,CAAC;IACtH,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE7E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,qBAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAmC,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import { App } from \"aws-cdk-lib\";\nimport { Template } from \"aws-cdk-lib/assertions\";\nimport { CloudFormationStackArtifact } from \"aws-cdk-lib/cx-api\";\nimport type { GuStack } from \"../../constructs/core\";\n\n/**\n * `Aspects` appear to run only at synth time.\n * This means we must synth the stack to see the results of the `Aspect`.\n *\n * @see https://github.com/aws/aws-cdk/issues/29047\n *\n * @param stack the stack to synthesise\n */\nexport function getTemplateAfterAspectInvocation(stack: GuStack): Template {\n const app = App.of(stack);\n\n if (!app) {\n throw new Error(`Unable to locate the enclosing App from GuStack ${stack.node.id}`);\n }\n\n const { artifacts } = app.synth();\n const cfnStacks = artifacts.filter((_): _ is CloudFormationStackArtifact => _ instanceof CloudFormationStackArtifact);\n const cfnStack = cfnStacks.find((artifact) => artifact.id === stack.node.id);\n\n if (!cfnStack) {\n throw new Error(\"Unable to locate a CloudFormationStackArtifact\");\n }\n\n return Template.fromJSON(cfnStack.template as Record<string, unknown>);\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": "
|
|
4
|
+
"version": "64.1.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"@changesets/cli": "2.31.0",
|
|
35
35
|
"@guardian/eslint-config": "14.0.1",
|
|
36
36
|
"@guardian/eslint-plugin-tsdoc-required": "^0.1.3",
|
|
37
|
-
"@guardian/tsconfig": "^
|
|
37
|
+
"@guardian/tsconfig": "^2.0.0",
|
|
38
38
|
"@types/git-url-parse": "^9.0.3",
|
|
39
39
|
"@types/jest": "^29.5.14",
|
|
40
40
|
"@types/js-yaml": "^4.0.9",
|
|
41
|
-
"@types/node": "
|
|
41
|
+
"@types/node": "26.1.0",
|
|
42
42
|
"@types/yargs": "^17.0.33",
|
|
43
43
|
"aws-cdk": "2.1110.0",
|
|
44
44
|
"aws-cdk-lib": "2.241.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"ts-jest": "^29.4.9",
|
|
52
52
|
"ts-node": "^10.9.2",
|
|
53
53
|
"typedoc": "^0.28.19",
|
|
54
|
-
"typescript": "5.
|
|
54
|
+
"typescript": "5.9.3"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@aws-sdk/client-ec2": "^3.1034.0",
|