@fjall/components-infrastructure 0.100.0 → 1.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.
Files changed (74) hide show
  1. package/dist/lib/lambda-assets/cert-generator/asset/index.js +17948 -0
  2. package/dist/lib/lambda-assets/cert-generator/asset/package.json +4 -0
  3. package/dist/lib/patterns/aws/clickhouseDatabase.d.ts +49 -1
  4. package/dist/lib/patterns/aws/clickhouseDatabase.js +137 -20
  5. package/dist/lib/patterns/aws/clickhouseTls/index.d.ts +1 -0
  6. package/dist/lib/patterns/aws/clickhouseTls/index.js +1 -0
  7. package/dist/lib/patterns/aws/clickhouseTls/types.d.ts +48 -0
  8. package/dist/lib/patterns/aws/computeEcs.d.ts +13 -1
  9. package/dist/lib/patterns/aws/computeEcs.js +88 -8
  10. package/dist/lib/patterns/aws/interfaces/database.d.ts +32 -1
  11. package/dist/lib/patterns/aws/interfaces/database.js +1 -1
  12. package/dist/lib/resources/aws/database/clickhouseConstants.d.ts +21 -0
  13. package/dist/lib/resources/aws/database/clickhouseConstants.js +21 -0
  14. package/dist/lib/resources/aws/database/clickhouseSecurityGroup.d.ts +2 -0
  15. package/dist/lib/resources/aws/database/clickhouseSecurityGroup.js +2 -0
  16. package/dist/lib/resources/aws/database/clickhouseUserData.d.ts +21 -0
  17. package/dist/lib/resources/aws/database/clickhouseUserData.js +48 -3
  18. package/dist/lib/resources/aws/database/clickhouseXmlRenderer.d.ts +1 -1
  19. package/dist/lib/resources/aws/database/clickhouseXmlRenderer.js +1 -1
  20. package/dist/lib/resources/aws/secrets/index.d.ts +2 -0
  21. package/dist/lib/resources/aws/secrets/index.js +2 -0
  22. package/dist/lib/resources/aws/secrets/tlsCaSecret.d.ts +13 -0
  23. package/dist/lib/resources/aws/secrets/tlsCaSecret.js +15 -0
  24. package/dist/lib/resources/aws/secrets/tlsServerSecret.d.ts +15 -0
  25. package/dist/lib/resources/aws/secrets/tlsServerSecret.js +17 -0
  26. package/dist/lib/resources/aws/utilities/index.d.ts +1 -0
  27. package/dist/lib/resources/aws/utilities/index.js +1 -0
  28. package/dist/lib/resources/aws/utilities/tlsCertGenerator.d.ts +33 -0
  29. package/dist/lib/resources/aws/utilities/tlsCertGenerator.js +67 -0
  30. package/package.json +7 -5
  31. package/dist/lib/config/aws/__t17fixture.js +0 -3
  32. package/dist/lib/config/aws/__t17fixtureType.d.ts +0 -2
  33. package/dist/lib/config/aws/__t17fixtureType.js +0 -1
  34. package/dist/lib/config/aws/eventBus.d.ts +0 -7
  35. package/dist/lib/config/aws/eventBus.js +0 -21
  36. package/dist/lib/config/aws/identityCenterGroupMembership.d.ts +0 -10
  37. package/dist/lib/config/aws/identityCenterGroupMembership.js +0 -102
  38. package/dist/lib/config/aws/securityBaseline.d.ts +0 -15
  39. package/dist/lib/config/aws/securityBaseline.js +0 -27
  40. package/dist/lib/patterns/aws/_eslint_test_tmp/leak.d.ts +0 -1
  41. package/dist/lib/patterns/aws/_eslint_test_tmp/leak.js +0 -4
  42. package/dist/lib/patterns/aws/managedIdentityCenter.d.ts +0 -4
  43. package/dist/lib/patterns/aws/managedIdentityCenter.js +0 -19
  44. package/dist/lib/patterns/aws/subdomainHostedZone.d.ts +0 -9
  45. package/dist/lib/patterns/aws/subdomainHostedZone.js +0 -34
  46. package/dist/lib/resources/aws/analytics/clickhouse.d.ts +0 -15
  47. package/dist/lib/resources/aws/analytics/clickhouse.js +0 -310
  48. package/dist/lib/resources/aws/analytics/clickhouseAlarms.d.ts +0 -49
  49. package/dist/lib/resources/aws/analytics/clickhouseAlarms.js +0 -140
  50. package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +0 -73
  51. package/dist/lib/resources/aws/analytics/clickhouseConstants.js +0 -89
  52. package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.d.ts +0 -13
  53. package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.js +0 -28
  54. package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +0 -59
  55. package/dist/lib/resources/aws/analytics/clickhouseTypes.js +0 -1
  56. package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +0 -6
  57. package/dist/lib/resources/aws/analytics/clickhouseUserData.js +0 -299
  58. package/dist/lib/resources/aws/analytics/index.d.ts +0 -4
  59. package/dist/lib/resources/aws/analytics/index.js +0 -2
  60. package/dist/lib/resources/aws/compute/__tmp__/regression-shape.d.ts +0 -2
  61. package/dist/lib/resources/aws/compute/__tmp__/regression-shape.js +0 -11
  62. package/dist/lib/resources/aws/messaging/defaultEventBus.d.ts +0 -7
  63. package/dist/lib/resources/aws/messaging/defaultEventBus.js +0 -21
  64. package/dist/lib/resources/aws/networking/domain.d.ts +0 -13
  65. package/dist/lib/resources/aws/networking/domain.js +0 -100
  66. package/dist/lib/synth_dump.d.ts +0 -1
  67. package/dist/lib/synth_dump.js +0 -42
  68. package/dist/lib/utils/bastionFactory.d.ts +0 -10
  69. package/dist/lib/utils/bastionFactory.js +0 -29
  70. package/dist/lib/utils/constructMap.d.ts +0 -33
  71. package/dist/lib/utils/constructMap.js +0 -154
  72. package/dist/lib/utils/dnsRecords.d.ts +0 -4
  73. package/dist/lib/utils/dnsRecords.js +0 -104
  74. /package/dist/lib/{config/aws/__t17fixture.d.ts → patterns/aws/clickhouseTls/types.js} +0 -0
@@ -1,154 +0,0 @@
1
- /**
2
- * Local construct map utilities for the infrastructure package.
3
- *
4
- * These are local copies of functions from @fjall/util, needed because
5
- * the infrastructure package compiles to CommonJS but @fjall/util is ESM.
6
- * Type-only imports from @fjall/util are fine (compiled away), but runtime
7
- * imports cause Jest/Node CJS-ESM boundary errors.
8
- */
9
- import { readFileSync } from "fs";
10
- import { join } from "path";
11
- /** Manifest file name — must match FJALL_MANIFEST_FILENAME in @fjall/util. */
12
- export const FJALL_MANIFEST_FILENAME = "fjall-manifest.json";
13
- /** Current manifest schema version. Must match @fjall/util. */
14
- export const MANIFEST_SCHEMA_VERSION = 1;
15
- /**
16
- * Account stack construct-to-group mapping.
17
- * Keys are CDK construct IDs (first segment after stack name in construct path).
18
- */
19
- export const ACCOUNT_CONSTRUCT_GROUPS = Object.freeze({
20
- CloudTrail: "monitoring",
21
- MonitoringRole: "monitoring",
22
- AuditRole: "security",
23
- OidcConnector: "security",
24
- EcrDefaultImage: "registry",
25
- EventBus: "events",
26
- DisasterRecovery: "backup"
27
- });
28
- /** Simplified resource categorisation for infrastructure package use. */
29
- const RESOURCE_CATEGORY_MAP = Object.freeze({
30
- "AWS::IAM::Role": "security",
31
- "AWS::IAM::Policy": "security",
32
- "AWS::IAM::OIDCProvider": "security",
33
- "AWS::EC2::SecurityGroup": "security",
34
- "AWS::KMS::Key": "security",
35
- "AWS::KMS::Alias": "security",
36
- "AWS::EC2::VPC": "network",
37
- "AWS::EC2::Subnet": "network",
38
- "AWS::EC2::InternetGateway": "network",
39
- "AWS::EC2::NatGateway": "network",
40
- "AWS::EC2::RouteTable": "network",
41
- "AWS::EC2::Route": "network",
42
- "AWS::ECS::Cluster": "compute",
43
- "AWS::ECS::Service": "compute",
44
- "AWS::ECS::TaskDefinition": "compute",
45
- "AWS::Lambda::Function": "compute",
46
- "AWS::RDS::DBInstance": "database",
47
- "AWS::RDS::DBCluster": "database",
48
- "AWS::S3::Bucket": "storage",
49
- "AWS::CloudTrail::Trail": "monitoring",
50
- "AWS::Logs::LogGroup": "monitoring",
51
- "AWS::Events::EventBus": "events",
52
- "AWS::ECR::Repository": "registry",
53
- "AWS::Route53::RecordSet": "dns",
54
- "AWS::CertificateManager::Certificate": "dns",
55
- "AWS::CloudFront::Distribution": "dns",
56
- "AWS::Backup::BackupVault": "backup",
57
- "AWS::Backup::BackupPlan": "backup",
58
- "AWS::Backup::BackupSelection": "backup"
59
- });
60
- function categoriseResource(resourceType) {
61
- if (!resourceType)
62
- return "compute";
63
- if (resourceType.startsWith("Custom::")) {
64
- return RESOURCE_CATEGORY_MAP[resourceType] ?? "compute";
65
- }
66
- return RESOURCE_CATEGORY_MAP[resourceType] ?? "compute";
67
- }
68
- function deriveGroupFromPath(constructPath, constructGroups) {
69
- const segments = constructPath.split("/").filter(Boolean);
70
- if (segments.length < 2)
71
- return undefined;
72
- const topLevelConstruct = segments[1];
73
- return constructGroups[topLevelConstruct];
74
- }
75
- function readTemplateResourceTypes(cdkOutPath, templateFile) {
76
- const result = new Map();
77
- if (!templateFile)
78
- return result;
79
- try {
80
- const content = readFileSync(join(cdkOutPath, templateFile), "utf-8");
81
- const parsed = JSON.parse(content);
82
- if (typeof parsed !== "object" || parsed === null) {
83
- return result;
84
- }
85
- const template = parsed;
86
- if (template.Resources && typeof template.Resources === "object") {
87
- for (const [logicalId, resource] of Object.entries(template.Resources)) {
88
- if (typeof resource === "object" &&
89
- resource !== null &&
90
- resource.Type) {
91
- result.set(logicalId, resource.Type);
92
- }
93
- }
94
- }
95
- }
96
- catch {
97
- // Template not readable — non-critical, return empty map
98
- }
99
- return result;
100
- }
101
- /**
102
- * Builds a construct map from CDK's manifest.json metadata.
103
- */
104
- export function buildConstructMap(cdkOutPath, constructGroups) {
105
- const result = new Map();
106
- let manifest;
107
- try {
108
- const content = readFileSync(join(cdkOutPath, "manifest.json"), "utf-8");
109
- const parsed = JSON.parse(content);
110
- if (typeof parsed !== "object" || parsed === null) {
111
- return result;
112
- }
113
- manifest = parsed;
114
- }
115
- catch {
116
- // CDK manifest not readable — non-critical, return empty map
117
- return result;
118
- }
119
- if (!manifest.artifacts)
120
- return result;
121
- for (const artifact of Object.values(manifest.artifacts)) {
122
- if (artifact.type !== "aws:cloudformation:stack")
123
- continue;
124
- if (!artifact.metadata)
125
- continue;
126
- const resourceTypes = readTemplateResourceTypes(cdkOutPath, artifact.properties?.templateFile);
127
- for (const [constructPath, entries] of Object.entries(artifact.metadata)) {
128
- for (const entry of entries) {
129
- if (entry.type !== "aws:cdk:logicalId")
130
- continue;
131
- const logicalId = entry.data;
132
- const resourceType = resourceTypes.get(logicalId) ?? "";
133
- const group = deriveGroupFromPath(constructPath, constructGroups) ??
134
- categoriseResource(resourceType);
135
- result.set(logicalId, {
136
- constructPath,
137
- group,
138
- resourceType
139
- });
140
- }
141
- }
142
- }
143
- return result;
144
- }
145
- /**
146
- * Converts a construct map to a plain object for JSON serialisation.
147
- */
148
- export function constructMapToRecord(map) {
149
- const result = {};
150
- for (const [key, value] of map) {
151
- result[key] = value;
152
- }
153
- return result;
154
- }
@@ -1,4 +0,0 @@
1
- import { type Construct } from "constructs";
2
- import { type IHostedZone } from "aws-cdk-lib/aws-route53";
3
- import type { DnsRecordInput } from "./domainTypes.js";
4
- export declare function addDnsRecords(scope: Construct, zone: IHostedZone, zoneName: string, records: DnsRecordInput[]): void;
@@ -1,104 +0,0 @@
1
- import { Duration } from "aws-cdk-lib";
2
- import { ARecord, AaaaRecord, CnameRecord, MxRecord, TxtRecord, NsRecord, SrvRecord, CaaRecord, CaaTag, RecordTarget } from "aws-cdk-lib/aws-route53";
3
- import { toPascalCase, getSafeZoneName } from "./capitaliseString.js";
4
- import { ALIAS_CDK_PREFIX, DNS_APEX } from "./domainTypes.js";
5
- export function addDnsRecords(scope, zone, zoneName, records) {
6
- const safeZone = toPascalCase(getSafeZoneName(zoneName));
7
- records.forEach((record, index) => {
8
- if (record.value.startsWith(ALIAS_CDK_PREFIX)) {
9
- return;
10
- }
11
- const safeName = toPascalCase(record.name === DNS_APEX ? "Apex" : record.name);
12
- const constructId = `${safeZone}${safeName}${record.type}Record${index}`;
13
- const ttl = record.ttl ? Duration.seconds(record.ttl) : undefined;
14
- const recordName = record.name === DNS_APEX ? zoneName : `${record.name}.${zoneName}`;
15
- switch (record.type) {
16
- case "A":
17
- new ARecord(scope, constructId, {
18
- zone,
19
- recordName,
20
- target: RecordTarget.fromIpAddresses(record.value),
21
- ttl
22
- });
23
- break;
24
- case "AAAA":
25
- new AaaaRecord(scope, constructId, {
26
- zone,
27
- recordName,
28
- target: RecordTarget.fromIpAddresses(record.value),
29
- ttl
30
- });
31
- break;
32
- case "CNAME":
33
- new CnameRecord(scope, constructId, {
34
- zone,
35
- recordName,
36
- domainName: record.value,
37
- ttl
38
- });
39
- break;
40
- case "MX":
41
- new MxRecord(scope, constructId, {
42
- zone,
43
- recordName,
44
- values: [
45
- {
46
- hostName: record.value,
47
- priority: record.priority ?? 10
48
- }
49
- ],
50
- ttl
51
- });
52
- break;
53
- case "TXT":
54
- new TxtRecord(scope, constructId, {
55
- zone,
56
- recordName,
57
- values: [record.value],
58
- ttl
59
- });
60
- break;
61
- case "NS":
62
- new NsRecord(scope, constructId, {
63
- zone,
64
- recordName,
65
- values: [record.value],
66
- ttl
67
- });
68
- break;
69
- case "SRV":
70
- new SrvRecord(scope, constructId, {
71
- zone,
72
- recordName,
73
- values: [
74
- {
75
- hostName: record.value,
76
- priority: record.priority ?? 10,
77
- weight: record.weight ?? 0,
78
- port: record.port ?? 443
79
- }
80
- ],
81
- ttl
82
- });
83
- break;
84
- case "CAA":
85
- new CaaRecord(scope, constructId, {
86
- zone,
87
- recordName,
88
- values: [
89
- {
90
- flag: 0,
91
- tag: record.value.includes("issuewild")
92
- ? CaaTag.ISSUEWILD
93
- : record.value.includes("iodef")
94
- ? CaaTag.IODEF
95
- : CaaTag.ISSUE,
96
- value: record.value
97
- }
98
- ],
99
- ttl
100
- });
101
- break;
102
- }
103
- });
104
- }