@fjall/generator 0.88.4 → 0.89.4
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/LICENSE +21 -0
- package/dist/src/ast/astCdnParser.d.ts +15 -0
- package/dist/src/ast/astCdnParser.js +114 -0
- package/dist/src/ast/astCommonParser.d.ts +90 -0
- package/dist/src/ast/astCommonParser.js +351 -0
- package/dist/src/ast/astComputeParser.d.ts +14 -2
- package/dist/src/ast/astComputeParser.js +55 -9
- package/dist/src/ast/astDatabaseParser.d.ts +104 -0
- package/dist/src/ast/astDatabaseParser.js +275 -0
- package/dist/src/ast/astInfrastructureParser.d.ts +23 -277
- package/dist/src/ast/astInfrastructureParser.js +83 -1456
- package/dist/src/ast/astMessagingParser.d.ts +25 -0
- package/dist/src/ast/astMessagingParser.js +78 -0
- package/dist/src/ast/astNetworkParser.d.ts +70 -0
- package/dist/src/ast/astNetworkParser.js +219 -0
- package/dist/src/ast/astPatternParser.d.ts +80 -0
- package/dist/src/ast/astPatternParser.js +155 -0
- package/dist/src/ast/astStorageParser.d.ts +18 -0
- package/dist/src/ast/astStorageParser.js +164 -0
- package/dist/src/ast/index.d.ts +1 -0
- package/dist/src/ast/index.js +4 -0
- package/dist/src/dns/bindParser.d.ts +13 -0
- package/dist/src/dns/bindParser.js +224 -0
- package/dist/src/dns/bindWriter.d.ts +2 -0
- package/dist/src/dns/bindWriter.js +52 -0
- package/dist/src/dns/index.d.ts +4 -0
- package/dist/src/dns/index.js +4 -0
- package/dist/src/dns/infrastructureWriter.d.ts +2 -0
- package/dist/src/dns/infrastructureWriter.js +58 -0
- package/dist/src/dns/types.d.ts +82 -0
- package/dist/src/dns/types.js +52 -0
- package/dist/src/generation/common.d.ts +1 -16
- package/dist/src/generation/common.js +2 -28
- package/dist/src/generation/compute.js +77 -28
- package/dist/src/generation/index.d.ts +2 -1
- package/dist/src/generation/index.js +3 -1
- package/dist/src/generation/messagingConnections.d.ts +33 -0
- package/dist/src/generation/messagingConnections.js +73 -0
- package/dist/src/generation/storage.d.ts +5 -1
- package/dist/src/generation/storage.js +9 -1
- package/dist/src/generation/storageConnections.d.ts +3 -3
- package/dist/src/generation/storageConnections.js +8 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/planning/resourcePlanning.js +0 -2
- package/dist/src/presets/tierTypes.d.ts +4 -1
- package/dist/src/schemas/applicationSchemas.d.ts +854 -0
- package/dist/src/schemas/applicationSchemas.js +80 -0
- package/dist/src/schemas/baseSchemas.d.ts +206 -0
- package/dist/src/schemas/baseSchemas.js +248 -0
- package/dist/src/schemas/cdnSchemas.d.ts +61 -0
- package/dist/src/schemas/cdnSchemas.js +62 -0
- package/dist/src/schemas/computeSchemas.d.ts +723 -0
- package/dist/src/schemas/computeSchemas.js +727 -0
- package/dist/src/schemas/constants.d.ts +12 -8
- package/dist/src/schemas/constants.js +14 -4
- package/dist/src/schemas/databaseSchemas.d.ts +638 -0
- package/dist/src/schemas/databaseSchemas.js +366 -0
- package/dist/src/schemas/messagingSchemas.d.ts +20 -0
- package/dist/src/schemas/messagingSchemas.js +29 -0
- package/dist/src/schemas/networkSchemas.d.ts +246 -0
- package/dist/src/schemas/networkSchemas.js +125 -0
- package/dist/src/schemas/patternSchemas.d.ts +708 -0
- package/dist/src/schemas/patternSchemas.js +294 -0
- package/dist/src/schemas/resourceSchemas.d.ts +24 -3530
- package/dist/src/schemas/resourceSchemas.js +24 -2011
- package/dist/src/schemas/storageSchemas.d.ts +93 -0
- package/dist/src/schemas/storageSchemas.js +119 -0
- package/dist/src/util/errorUtils.d.ts +1 -2
- package/dist/src/util/errorUtils.js +1 -15
- package/dist/src/validation/patterns.d.ts +9 -0
- package/dist/src/validation/patterns.js +9 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { VALIDATION_PATTERNS, VALIDATION_MESSAGES, } from "../validation/patterns.js";
|
|
3
|
+
import { optionalOrDisabled, AppNameSchema } from "./baseSchemas.js";
|
|
4
|
+
// ─── Network nested configuration schemas ────────────────────────────────────
|
|
5
|
+
export const NatConfigSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
count: z
|
|
8
|
+
.number()
|
|
9
|
+
.int(VALIDATION_MESSAGES.NAT_GATEWAY.INTEGER)
|
|
10
|
+
.min(0, VALIDATION_MESSAGES.NAT_GATEWAY.MIN)
|
|
11
|
+
.max(3, VALIDATION_MESSAGES.NAT_GATEWAY.MAX)
|
|
12
|
+
.optional(),
|
|
13
|
+
})
|
|
14
|
+
.strict()
|
|
15
|
+
.describe("NAT gateway configuration");
|
|
16
|
+
export const NatConfigOrFalseSchema = optionalOrDisabled(NatConfigSchema);
|
|
17
|
+
export const FlowLogConfigSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
destination: z.enum(["cloudwatch", "s3"]).optional(),
|
|
20
|
+
retentionDays: z
|
|
21
|
+
.number()
|
|
22
|
+
.int(VALIDATION_MESSAGES.RETENTION_DAYS.INTEGER)
|
|
23
|
+
.min(1, VALIDATION_MESSAGES.RETENTION_DAYS.MIN)
|
|
24
|
+
.max(365, VALIDATION_MESSAGES.RETENTION_DAYS.MAX)
|
|
25
|
+
.optional(),
|
|
26
|
+
trafficType: z.enum(["ALL", "ACCEPT", "REJECT"]).optional(),
|
|
27
|
+
})
|
|
28
|
+
.strict()
|
|
29
|
+
.describe("VPC flow log configuration");
|
|
30
|
+
export const FlowLogConfigOrFalseSchema = optionalOrDisabled(FlowLogConfigSchema);
|
|
31
|
+
export const GatewayEndpointsConfigSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
s3: z.boolean().optional(),
|
|
34
|
+
dynamodb: z.boolean().optional(),
|
|
35
|
+
})
|
|
36
|
+
.strict()
|
|
37
|
+
.describe("Gateway VPC endpoints (FREE)");
|
|
38
|
+
export const GatewayEndpointsConfigOrFalseSchema = optionalOrDisabled(GatewayEndpointsConfigSchema);
|
|
39
|
+
export const InterfaceEndpointsConfigSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
ecr: z.boolean().optional(),
|
|
42
|
+
secretsManager: z.boolean().optional(),
|
|
43
|
+
kms: z.boolean().optional(),
|
|
44
|
+
cloudwatchLogs: z.boolean().optional(),
|
|
45
|
+
ssm: z.boolean().optional(),
|
|
46
|
+
sts: z.boolean().optional(),
|
|
47
|
+
})
|
|
48
|
+
.strict()
|
|
49
|
+
.describe("Interface VPC endpoints (cost per hour)");
|
|
50
|
+
export const InterfaceEndpointsConfigOrFalseSchema = optionalOrDisabled(InterfaceEndpointsConfigSchema);
|
|
51
|
+
export const VpcEndpointsConfigSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
gateway: GatewayEndpointsConfigOrFalseSchema.optional(),
|
|
54
|
+
interface: InterfaceEndpointsConfigOrFalseSchema.optional(),
|
|
55
|
+
})
|
|
56
|
+
.strict()
|
|
57
|
+
.describe("VPC endpoints configuration");
|
|
58
|
+
export const VpcEndpointsConfigOrFalseSchema = optionalOrDisabled(VpcEndpointsConfigSchema);
|
|
59
|
+
// ─── Network resource plan ───────────────────────────────────────────────────
|
|
60
|
+
export const NetworkResourcePlanSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
maxAzs: z
|
|
63
|
+
.number()
|
|
64
|
+
.int(VALIDATION_MESSAGES.MAX_AZS.INTEGER)
|
|
65
|
+
.min(1, VALIDATION_MESSAGES.MAX_AZS.MIN)
|
|
66
|
+
.max(3, VALIDATION_MESSAGES.MAX_AZS.MAX)
|
|
67
|
+
.optional(),
|
|
68
|
+
natGateways: NatConfigOrFalseSchema.optional(),
|
|
69
|
+
flowLogs: FlowLogConfigOrFalseSchema.optional(),
|
|
70
|
+
vpcEndpoints: VpcEndpointsConfigOrFalseSchema.optional(),
|
|
71
|
+
cidrMask: z
|
|
72
|
+
.number()
|
|
73
|
+
.int(VALIDATION_MESSAGES.CIDR_MASK.INTEGER)
|
|
74
|
+
.min(16, VALIDATION_MESSAGES.CIDR_MASK.MIN)
|
|
75
|
+
.max(28, VALIDATION_MESSAGES.CIDR_MASK.MAX)
|
|
76
|
+
.optional(),
|
|
77
|
+
})
|
|
78
|
+
.strict();
|
|
79
|
+
/**
|
|
80
|
+
* Additional network resource plan schema for app.addNetwork() VPCs.
|
|
81
|
+
* Extends NetworkResourcePlanSchema with a required name field.
|
|
82
|
+
*/
|
|
83
|
+
export const AdditionalNetworkResourcePlanSchema = NetworkResourcePlanSchema.extend({
|
|
84
|
+
name: z
|
|
85
|
+
.string()
|
|
86
|
+
.min(1, VALIDATION_MESSAGES.REQUIRED.NETWORK_NAME)
|
|
87
|
+
.max(50, VALIDATION_MESSAGES.MAX_LENGTH.NETWORK_NAME),
|
|
88
|
+
}).strict();
|
|
89
|
+
/**
|
|
90
|
+
* Network configuration for App.getApp() options.
|
|
91
|
+
* - false: No network (S3-only apps)
|
|
92
|
+
* - object: Create VPC with specified configuration
|
|
93
|
+
*/
|
|
94
|
+
export const NetworkConfigSchema = optionalOrDisabled(NetworkResourcePlanSchema);
|
|
95
|
+
/**
|
|
96
|
+
* Network name schema for additional VPCs.
|
|
97
|
+
* Must be PascalCase as it's used as a CDK construct ID.
|
|
98
|
+
*/
|
|
99
|
+
export const NetworkNameSchema = z
|
|
100
|
+
.string()
|
|
101
|
+
.min(1, VALIDATION_MESSAGES.REQUIRED.NETWORK_NAME)
|
|
102
|
+
.max(50, VALIDATION_MESSAGES.MAX_LENGTH.NETWORK_NAME)
|
|
103
|
+
.regex(VALIDATION_PATTERNS.RESOURCE_NAME, VALIDATION_MESSAGES.RESOURCE_NAME);
|
|
104
|
+
/**
|
|
105
|
+
* Network generator schema for configuring network infrastructure.
|
|
106
|
+
*
|
|
107
|
+
* Behaviour depends on whether networkName is provided:
|
|
108
|
+
* - With networkName: Adds an additional VPC via app.addNetwork()
|
|
109
|
+
* - Without networkName: Updates the primary network config in App.getApp()
|
|
110
|
+
*/
|
|
111
|
+
export const NetworkGeneratorSchema = z
|
|
112
|
+
.object({
|
|
113
|
+
appName: AppNameSchema,
|
|
114
|
+
networkName: NetworkNameSchema.optional(),
|
|
115
|
+
maxAzs: z
|
|
116
|
+
.number()
|
|
117
|
+
.int(VALIDATION_MESSAGES.MAX_AZS.INTEGER)
|
|
118
|
+
.min(1, VALIDATION_MESSAGES.MAX_AZS.MIN)
|
|
119
|
+
.max(3, VALIDATION_MESSAGES.MAX_AZS.MAX)
|
|
120
|
+
.optional(),
|
|
121
|
+
natGateways: NatConfigOrFalseSchema.optional(),
|
|
122
|
+
flowLogs: FlowLogConfigOrFalseSchema.optional(),
|
|
123
|
+
vpcEndpoints: VpcEndpointsConfigOrFalseSchema.optional(),
|
|
124
|
+
})
|
|
125
|
+
.strict();
|