@fjall/generator 0.89.4 → 0.89.6
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 +50 -21
- package/README.md +28 -0
- package/dist/.minified +1 -0
- package/dist/src/ast/astCdnParser.d.ts +5 -0
- package/dist/src/ast/astCdnParser.js +1 -114
- package/dist/src/ast/astCommonParser.d.ts +6 -17
- package/dist/src/ast/astCommonParser.js +1 -351
- package/dist/src/ast/astComputeConnectionParser.d.ts +18 -0
- package/dist/src/ast/astComputeConnectionParser.js +1 -0
- package/dist/src/ast/astComputeParser.d.ts +6 -0
- package/dist/src/ast/astComputeParser.js +1 -473
- package/dist/src/ast/astComputeParserHelpers.d.ts +21 -0
- package/dist/src/ast/astComputeParserHelpers.js +1 -0
- package/dist/src/ast/astDatabaseParser.d.ts +9 -24
- package/dist/src/ast/astDatabaseParser.js +1 -275
- package/dist/src/ast/astDomainParser.d.ts +139 -0
- package/dist/src/ast/astDomainParser.js +1 -0
- package/dist/src/ast/astDynamoDBParser.d.ts +35 -0
- package/dist/src/ast/astDynamoDBParser.js +1 -0
- package/dist/src/ast/astExpressionEvaluator.d.ts +23 -0
- package/dist/src/ast/astExpressionEvaluator.js +1 -0
- package/dist/src/ast/astInfrastructureParser.d.ts +12 -49
- package/dist/src/ast/astInfrastructureParser.js +1 -552
- package/dist/src/ast/astMessagingParser.d.ts +5 -0
- package/dist/src/ast/astMessagingParser.js +1 -78
- package/dist/src/ast/astNetworkParser.d.ts +6 -0
- package/dist/src/ast/astNetworkParser.js +1 -219
- package/dist/src/ast/astPatternParser.d.ts +6 -0
- package/dist/src/ast/astPatternParser.js +1 -155
- package/dist/src/ast/astPlanConverter.d.ts +11 -0
- package/dist/src/ast/astPlanConverter.js +2 -0
- package/dist/src/ast/astStatementClassifier.d.ts +24 -0
- package/dist/src/ast/astStatementClassifier.js +1 -0
- package/dist/src/ast/astStatementQueries.d.ts +21 -0
- package/dist/src/ast/astStatementQueries.js +3 -0
- package/dist/src/ast/astStorageParser.d.ts +5 -0
- package/dist/src/ast/astStorageParser.js +1 -164
- package/dist/src/ast/astSurgicalModification.js +19 -400
- package/dist/src/ast/astTestHelpers.d.ts +635 -0
- package/dist/src/ast/astTestHelpers.js +1 -0
- package/dist/src/ast/index.d.ts +1 -0
- package/dist/src/ast/index.js +1 -6
- package/dist/src/aws/regions.js +1 -254
- package/dist/src/codemod/_internal.d.ts +12 -0
- package/dist/src/codemod/_internal.js +1 -0
- package/dist/src/codemod/edits/addResource/bodyIndex.d.ts +34 -0
- package/dist/src/codemod/edits/addResource/bodyIndex.js +1 -0
- package/dist/src/codemod/edits/addResource/propertyBuilder.d.ts +7 -0
- package/dist/src/codemod/edits/addResource/propertyBuilder.js +1 -0
- package/dist/src/codemod/edits/addResource.d.ts +9 -0
- package/dist/src/codemod/edits/addResource.js +1 -0
- package/dist/src/codemod/edits/ensureImports.d.ts +26 -0
- package/dist/src/codemod/edits/ensureImports.js +1 -0
- package/dist/src/codemod/edits/findInsertionPosition.d.ts +39 -0
- package/dist/src/codemod/edits/findInsertionPosition.js +1 -0
- package/dist/src/codemod/edits/index.d.ts +6 -0
- package/dist/src/codemod/edits/index.js +1 -0
- package/dist/src/codemod/edits/modifyResource/literalConversion.d.ts +37 -0
- package/dist/src/codemod/edits/modifyResource/literalConversion.js +1 -0
- package/dist/src/codemod/edits/modifyResource.d.ts +9 -0
- package/dist/src/codemod/edits/modifyResource.js +1 -0
- package/dist/src/codemod/edits/removeResource/commentHeuristic.d.ts +31 -0
- package/dist/src/codemod/edits/removeResource/commentHeuristic.js +1 -0
- package/dist/src/codemod/edits/removeResource/importPruning.d.ts +8 -0
- package/dist/src/codemod/edits/removeResource/importPruning.js +1 -0
- package/dist/src/codemod/edits/removeResource.d.ts +10 -0
- package/dist/src/codemod/edits/removeResource.js +1 -0
- package/dist/src/codemod/edits/schemaFragments.d.ts +9 -0
- package/dist/src/codemod/edits/schemaFragments.js +1 -0
- package/dist/src/codemod/fileRewriter/builders.d.ts +57 -0
- package/dist/src/codemod/fileRewriter/builders.js +1 -0
- package/dist/src/codemod/fileRewriter/index.d.ts +4 -0
- package/dist/src/codemod/fileRewriter/index.js +1 -0
- package/dist/src/codemod/fileRewriter/locateByRange.d.ts +65 -0
- package/dist/src/codemod/fileRewriter/locateByRange.js +1 -0
- package/dist/src/codemod/fileRewriter/parse.d.ts +18 -0
- package/dist/src/codemod/fileRewriter/parse.js +2 -0
- package/dist/src/codemod/fileRewriter/print.d.ts +46 -0
- package/dist/src/codemod/fileRewriter/print.js +4 -0
- package/dist/src/codemod/historyPaths.d.ts +2 -0
- package/dist/src/codemod/historyPaths.js +1 -0
- package/dist/src/codemod/index.d.ts +7 -0
- package/dist/src/codemod/index.js +1 -0
- package/dist/src/codemod/listResources.d.ts +4 -0
- package/dist/src/codemod/listResources.js +1 -0
- package/dist/src/codemod/semanticIndex/findReferences.d.ts +15 -0
- package/dist/src/codemod/semanticIndex/findReferences.js +2 -0
- package/dist/src/codemod/semanticIndex/index.d.ts +4 -0
- package/dist/src/codemod/semanticIndex/index.js +1 -0
- package/dist/src/codemod/semanticIndex/listImports.d.ts +24 -0
- package/dist/src/codemod/semanticIndex/listImports.js +1 -0
- package/dist/src/codemod/semanticIndex/locateByShape.d.ts +28 -0
- package/dist/src/codemod/semanticIndex/locateByShape.js +1 -0
- package/dist/src/codemod/semanticIndex/projectCache.d.ts +14 -0
- package/dist/src/codemod/semanticIndex/projectCache.js +1 -0
- package/dist/src/codemod/types.d.ts +172 -0
- package/dist/src/codemod/types.js +1 -0
- package/dist/src/dns/bindParser.js +2 -224
- package/dist/src/dns/bindWriter.js +3 -52
- package/dist/src/dns/domainFileGenerator.d.ts +20 -0
- package/dist/src/dns/domainFileGenerator.js +207 -0
- package/dist/src/dns/domainRecords.d.ts +164 -0
- package/dist/src/dns/domainRecords.js +1 -0
- package/dist/src/dns/index.d.ts +2 -1
- package/dist/src/dns/index.js +1 -4
- package/dist/src/dns/types.js +1 -52
- package/dist/src/generation/common.js +6 -161
- package/dist/src/generation/compute.js +82 -590
- package/dist/src/generation/database.js +12 -198
- package/dist/src/generation/generatePatternCode.d.ts +58 -0
- package/dist/src/generation/generatePatternCode.js +33 -0
- package/dist/src/generation/index.js +1 -20
- package/dist/src/generation/infrastructure.d.ts +1 -5
- package/dist/src/generation/infrastructure.js +35 -377
- package/dist/src/generation/messagingConnections.js +1 -73
- package/dist/src/generation/storage.d.ts +0 -15
- package/dist/src/generation/storage.js +35 -168
- package/dist/src/generation/storageConnections.js +1 -75
- package/dist/src/planning/generateResourceChange.d.ts +21 -0
- package/dist/src/planning/generateResourceChange.js +1 -0
- package/dist/src/planning/index.d.ts +3 -0
- package/dist/src/planning/index.js +1 -1
- package/dist/src/planning/resourceAddition.d.ts +154 -0
- package/dist/src/planning/resourceAddition.js +1 -0
- package/dist/src/planning/resourceConnections.d.ts +19 -0
- package/dist/src/planning/resourceConnections.js +1 -0
- package/dist/src/planning/resourcePlanning.js +1 -214
- package/dist/src/presets/index.js +1 -3
- package/dist/src/presets/patternTierPresets.js +1 -131
- package/dist/src/presets/storagePresets.js +1 -36
- package/dist/src/presets/tierPresets.d.ts +5 -8
- package/dist/src/presets/tierPresets.js +1 -384
- package/dist/src/presets/tierTypes.d.ts +1 -1
- package/dist/src/presets/tierTypes.js +0 -7
- package/dist/src/schemas/alarmSchemas.d.ts +19 -0
- package/dist/src/schemas/alarmSchemas.js +1 -0
- package/dist/src/schemas/applicationSchemas.d.ts +22 -6
- package/dist/src/schemas/applicationSchemas.js +1 -80
- package/dist/src/schemas/baseSchemas.d.ts +8 -3
- package/dist/src/schemas/baseSchemas.js +2 -248
- package/dist/src/schemas/cdnSchemas.js +1 -62
- package/dist/src/schemas/computeSchemas.d.ts +25 -3
- package/dist/src/schemas/computeSchemas.js +1 -727
- package/dist/src/schemas/constants.d.ts +5 -7
- package/dist/src/schemas/constants.js +1 -218
- package/dist/src/schemas/databaseSchemas.d.ts +6 -1
- package/dist/src/schemas/databaseSchemas.js +1 -366
- package/dist/src/schemas/index.js +1 -3
- package/dist/src/schemas/instanceTypeArchitecture.js +1 -75
- package/dist/src/schemas/messagingSchemas.js +1 -29
- package/dist/src/schemas/networkSchemas.js +1 -125
- package/dist/src/schemas/patternSchemas.d.ts +1 -1
- package/dist/src/schemas/patternSchemas.js +1 -294
- package/dist/src/schemas/resourceSchemas.d.ts +1 -0
- package/dist/src/schemas/resourceSchemas.js +1 -28
- package/dist/src/schemas/sharedTypes.d.ts +18 -0
- package/dist/src/schemas/sharedTypes.js +1 -0
- package/dist/src/schemas/storageSchemas.d.ts +1 -0
- package/dist/src/schemas/storageSchemas.js +1 -119
- package/dist/src/types/Result.js +1 -31
- package/dist/src/util/errorUtils.js +1 -1
- package/dist/src/validation/patterns.d.ts +9 -0
- package/dist/src/validation/patterns.js +1 -369
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +29 -9
- package/dist/src/dns/infrastructureWriter.d.ts +0 -2
- package/dist/src/dns/infrastructureWriter.js +0 -58
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./constants.js";
|
|
3
|
-
export { getArchitectureForInstanceType, validateArchitectureMatch, isArchitectureCompatible, } from "./instanceTypeArchitecture.js";
|
|
1
|
+
export*from"./resourceSchemas.js";export*from"./constants.js";import{getArchitectureForInstanceType as o,validateArchitectureMatch as i,isArchitectureCompatible as a}from"./instanceTypeArchitecture.js";export{o as getArchitectureForInstanceType,a as isArchitectureCompatible,i as validateArchitectureMatch};
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* EC2 Instance Type Architecture Mapping
|
|
3
|
-
*
|
|
4
|
-
* Maps EC2 instance type prefixes to their required CPU architecture.
|
|
5
|
-
* Used for early validation to prevent architecture mismatches between
|
|
6
|
-
* instance types and AMI hardware types.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Instance type prefixes that use ARM64 architecture (Graviton processors).
|
|
10
|
-
* All other prefixes are assumed to be x86-64 (STANDARD).
|
|
11
|
-
*/
|
|
12
|
-
const ARM_INSTANCE_PREFIXES = new Set([
|
|
13
|
-
"t4g",
|
|
14
|
-
"c6g",
|
|
15
|
-
"c6gd",
|
|
16
|
-
"c6gn",
|
|
17
|
-
"c7g",
|
|
18
|
-
"c7gd",
|
|
19
|
-
"c7gn",
|
|
20
|
-
"r6g",
|
|
21
|
-
"r6gd",
|
|
22
|
-
"r7g",
|
|
23
|
-
"r7gd",
|
|
24
|
-
"m6g",
|
|
25
|
-
"m6gd",
|
|
26
|
-
"m7g",
|
|
27
|
-
"m7gd",
|
|
28
|
-
"a1",
|
|
29
|
-
"x2gd",
|
|
30
|
-
"im4gn",
|
|
31
|
-
"is4gen",
|
|
32
|
-
"i4g",
|
|
33
|
-
"hpc7g",
|
|
34
|
-
]);
|
|
35
|
-
/**
|
|
36
|
-
* Get the required architecture for an EC2 instance type.
|
|
37
|
-
*
|
|
38
|
-
* @param instanceType - EC2 instance type (e.g., "t4g.micro", "t3.small")
|
|
39
|
-
* @returns "ARM" for Graviton instances, "STANDARD" for Intel/AMD
|
|
40
|
-
*/
|
|
41
|
-
export function getArchitectureForInstanceType(instanceType) {
|
|
42
|
-
const prefix = instanceType.split(".")[0];
|
|
43
|
-
return ARM_INSTANCE_PREFIXES.has(prefix) ? "ARM" : "STANDARD";
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Validate that an EC2 instance type is compatible with the specified AMI hardware type.
|
|
47
|
-
*
|
|
48
|
-
* @param instanceType - EC2 instance type (e.g., "t4g.micro")
|
|
49
|
-
* @param amiHardwareType - AMI hardware type ("ARM" or "STANDARD")
|
|
50
|
-
* @returns Validation result with optional error message
|
|
51
|
-
*/
|
|
52
|
-
export function validateArchitectureMatch(instanceType, amiHardwareType) {
|
|
53
|
-
const required = getArchitectureForInstanceType(instanceType);
|
|
54
|
-
if (required !== amiHardwareType) {
|
|
55
|
-
const suggestion = required === "ARM"
|
|
56
|
-
? "Graviton instance (t4g, c6g, r6g, m6g, etc.)"
|
|
57
|
-
: "Intel/AMD instance (t3, c5, r5, m5, etc.)";
|
|
58
|
-
return {
|
|
59
|
-
valid: false,
|
|
60
|
-
message: `Instance type '${instanceType}' requires ${required} architecture, but '${amiHardwareType}' AMI was specified. Use a ${suggestion} instead.`,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return { valid: true };
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Check if an instance type is compatible with a given AMI hardware type.
|
|
67
|
-
* Simpler boolean version of validateArchitectureMatch.
|
|
68
|
-
*
|
|
69
|
-
* @param instanceType - EC2 instance type
|
|
70
|
-
* @param amiHardwareType - AMI hardware type
|
|
71
|
-
* @returns true if compatible, false otherwise
|
|
72
|
-
*/
|
|
73
|
-
export function isArchitectureCompatible(instanceType, amiHardwareType) {
|
|
74
|
-
return getArchitectureForInstanceType(instanceType) === amiHardwareType;
|
|
75
|
-
}
|
|
1
|
+
const g=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","m6g","m6gd","m7g","m7gd","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);function r(t){const e=t.split(".")[0]??"";return g.has(e)?"ARM":"STANDARD"}function i(t,e){const c=r(t);return c!==e?{valid:!1,message:`Instance type '${t}' requires ${c} architecture, but '${e}' AMI was specified. Use a ${c==="ARM"?"Graviton instance (t4g, c6g, r6g, m6g, etc.)":"Intel/AMD instance (t3, c5, r5, m5, etc.)"} instead.`}:{valid:!0}}function s(t,e){return r(t)===e}export{r as getArchitectureForInstanceType,s as isArchitectureCompatible,i as validateArchitectureMatch};
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VALIDATION_MESSAGES } from "../validation/patterns.js";
|
|
3
|
-
import { ResourceNameSchema, ExtraPropertySchema } from "./baseSchemas.js";
|
|
4
|
-
// ─── SQS resource plan ──────────────────────────────────────────────────────
|
|
5
|
-
/**
|
|
6
|
-
* SQS queue resource plan schema (for OpenNext patterns)
|
|
7
|
-
*/
|
|
8
|
-
export const SQSResourcePlanSchema = z
|
|
9
|
-
.object({
|
|
10
|
-
name: ResourceNameSchema,
|
|
11
|
-
queueType: z.enum(["standard", "fifo"]).default("standard"),
|
|
12
|
-
visibilityTimeout: z
|
|
13
|
-
.number()
|
|
14
|
-
.int(VALIDATION_MESSAGES.SQS.VISIBILITY_TIMEOUT.INTEGER)
|
|
15
|
-
.min(0, VALIDATION_MESSAGES.SQS.VISIBILITY_TIMEOUT.MIN)
|
|
16
|
-
.max(43200, VALIDATION_MESSAGES.SQS.VISIBILITY_TIMEOUT.MAX)
|
|
17
|
-
.optional(),
|
|
18
|
-
retentionPeriod: z
|
|
19
|
-
.number()
|
|
20
|
-
.int(VALIDATION_MESSAGES.SQS.RETENTION_PERIOD.INTEGER)
|
|
21
|
-
.min(60, VALIDATION_MESSAGES.SQS.RETENTION_PERIOD.MIN)
|
|
22
|
-
.max(1209600, VALIDATION_MESSAGES.SQS.RETENTION_PERIOD.MAX)
|
|
23
|
-
.optional(),
|
|
24
|
-
contentBasedDeduplication: z.boolean().optional(),
|
|
25
|
-
// Round-trip preservation
|
|
26
|
-
variableName: z.string().optional(),
|
|
27
|
-
extraProperties: z.array(ExtraPropertySchema).optional(),
|
|
28
|
-
})
|
|
29
|
-
.strict();
|
|
1
|
+
import{z as e}from"zod";import{VALIDATION_MESSAGES as o}from"../validation/patterns.js";import{ResourceNameSchema as t,ExtraPropertySchema as a}from"./baseSchemas.js";const n=e.object({name:t,queueType:e.enum(["standard","fifo"]).default("standard"),visibilityTimeout:e.number().int(o.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,o.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,o.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:e.number().int(o.SQS.RETENTION_PERIOD.INTEGER).min(60,o.SQS.RETENTION_PERIOD.MIN).max(1209600,o.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:e.boolean().optional(),variableName:e.string().optional(),extraProperties:e.array(a).optional()}).strict();export{n as SQSResourcePlanSchema};
|
|
@@ -1,125 +1 @@
|
|
|
1
|
-
import {
|
|
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();
|
|
1
|
+
import{z as o}from"zod";import{VALIDATION_PATTERNS as r,VALIDATION_MESSAGES as t}from"../validation/patterns.js";import{optionalOrDisabled as n,AppNameSchema as s}from"./baseSchemas.js";const p=o.object({count:o.number().int(t.NAT_GATEWAY.INTEGER).min(0,t.NAT_GATEWAY.MIN).max(3,t.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),e=n(p),E=o.object({destination:o.enum(["cloudwatch","s3"]).optional(),retentionDays:o.number().int(t.RETENTION_DAYS.INTEGER).min(1,t.RETENTION_DAYS.MIN).max(365,t.RETENTION_DAYS.MAX).optional(),trafficType:o.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),a=n(E),m=o.object({s3:o.boolean().optional(),dynamodb:o.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),A=n(m),l=o.object({ecr:o.boolean().optional(),secretsManager:o.boolean().optional(),kms:o.boolean().optional(),cloudwatchLogs:o.boolean().optional(),ssm:o.boolean().optional(),sts:o.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),N=n(l),S=o.object({gateway:A.optional(),interface:N.optional()}).strict().describe("VPC endpoints configuration"),i=n(S),c=o.object({maxAzs:o.number().int(t.MAX_AZS.INTEGER).min(1,t.MAX_AZS.MIN).max(3,t.MAX_AZS.MAX).optional(),natGateways:e.optional(),flowLogs:a.optional(),vpcEndpoints:i.optional(),cidrMask:o.number().int(t.CIDR_MASK.INTEGER).min(16,t.CIDR_MASK.MIN).max(28,t.CIDR_MASK.MAX).optional()}).strict(),d=c.extend({name:o.string().min(1,t.REQUIRED.NETWORK_NAME).max(50,t.MAX_LENGTH.NETWORK_NAME)}).strict(),f=n(c),T=o.string().min(1,t.REQUIRED.NETWORK_NAME).max(50,t.MAX_LENGTH.NETWORK_NAME).regex(r.RESOURCE_NAME,t.RESOURCE_NAME),g=o.object({appName:s,networkName:T.optional(),maxAzs:o.number().int(t.MAX_AZS.INTEGER).min(1,t.MAX_AZS.MIN).max(3,t.MAX_AZS.MAX).optional(),natGateways:e.optional(),flowLogs:a.optional(),vpcEndpoints:i.optional()}).strict();export{d as AdditionalNetworkResourcePlanSchema,a as FlowLogConfigOrFalseSchema,E as FlowLogConfigSchema,A as GatewayEndpointsConfigOrFalseSchema,m as GatewayEndpointsConfigSchema,N as InterfaceEndpointsConfigOrFalseSchema,l as InterfaceEndpointsConfigSchema,e as NatConfigOrFalseSchema,p as NatConfigSchema,f as NetworkConfigSchema,g as NetworkGeneratorSchema,T as NetworkNameSchema,c as NetworkResourcePlanSchema,i as VpcEndpointsConfigOrFalseSchema,S as VpcEndpointsConfigSchema};
|
|
@@ -663,10 +663,10 @@ export declare const PatternConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
663
663
|
* Defines configuration tiers: lightweight, standard, resilient, custom.
|
|
664
664
|
*/
|
|
665
665
|
export declare const PatternTierSchema: z.ZodEnum<{
|
|
666
|
-
custom: "custom";
|
|
667
666
|
standard: "standard";
|
|
668
667
|
resilient: "resilient";
|
|
669
668
|
lightweight: "lightweight";
|
|
669
|
+
custom: "custom";
|
|
670
670
|
}>;
|
|
671
671
|
export type PatternTier = z.infer<typeof PatternTierSchema>;
|
|
672
672
|
/**
|
|
@@ -1,294 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VALIDATION_MESSAGES } from "../validation/patterns.js";
|
|
3
|
-
import { BackupRetentionSchema, MonitoringIntervalSchema, DatabasePortSchema, ProxyConfigOrFalseSchema, ReadReplicaConfigOrFalseSchema, AuroraWriterConfigSchema, AuroraReadersConfigOrFalseSchema, DatabaseInsightsConfigOrFalseSchema, CredentialsConfigSchema, EncryptionConfigSchema, } from "./databaseSchemas.js";
|
|
4
|
-
import { LambdaMemorySchema } from "./computeSchemas.js";
|
|
5
|
-
// ─── Pattern Lambda configuration ────────────────────────────────────────────
|
|
6
|
-
/**
|
|
7
|
-
* Pattern Lambda configuration for individual functions.
|
|
8
|
-
*/
|
|
9
|
-
export const PatternLambdaConfigSchema = z
|
|
10
|
-
.object({
|
|
11
|
-
/** Memory size in MB. Range: 128-10240. */
|
|
12
|
-
memorySize: LambdaMemorySchema.optional(),
|
|
13
|
-
/** Timeout in seconds. Range: 1-900. */
|
|
14
|
-
timeout: z
|
|
15
|
-
.number()
|
|
16
|
-
.int(VALIDATION_MESSAGES.LAMBDA.TIMEOUT.INTEGER)
|
|
17
|
-
.min(1, VALIDATION_MESSAGES.LAMBDA.TIMEOUT.MIN)
|
|
18
|
-
.max(900, VALIDATION_MESSAGES.LAMBDA.TIMEOUT.MAX)
|
|
19
|
-
.optional(),
|
|
20
|
-
/** Ephemeral storage size in MB. Range: 512-10240. Default: 512. */
|
|
21
|
-
ephemeralStorageSize: z
|
|
22
|
-
.number()
|
|
23
|
-
.int(VALIDATION_MESSAGES.EPHEMERAL_STORAGE.INTEGER)
|
|
24
|
-
.min(512, VALIDATION_MESSAGES.EPHEMERAL_STORAGE.MIN)
|
|
25
|
-
.max(10240, VALIDATION_MESSAGES.EPHEMERAL_STORAGE.MAX)
|
|
26
|
-
.optional(),
|
|
27
|
-
})
|
|
28
|
-
.strict();
|
|
29
|
-
// ─── Payload database configuration ──────────────────────────────────────────
|
|
30
|
-
/**
|
|
31
|
-
* Full Payload database configuration for pattern.
|
|
32
|
-
* Exposes ALL underlying DatabaseFactory props with pattern-specific defaults.
|
|
33
|
-
*/
|
|
34
|
-
export const PayloadDatabaseConfigSchema = z
|
|
35
|
-
.object({
|
|
36
|
-
/** Database type: "Instance" (RDS Instance) or "Aurora". Default: "Instance" */
|
|
37
|
-
type: z.enum(["Instance", "Aurora"]).optional(),
|
|
38
|
-
/** Database name. Default: derived from pattern name */
|
|
39
|
-
databaseName: z.string().optional(),
|
|
40
|
-
/** Database engine. Default: "postgresql" */
|
|
41
|
-
databaseEngine: z.enum(["postgresql", "mysql"]).optional(),
|
|
42
|
-
/** Enable deletion protection. Default: true */
|
|
43
|
-
deletionProtection: z.boolean().optional(),
|
|
44
|
-
/** Backup retention in days. Default: 7 */
|
|
45
|
-
backupRetention: BackupRetentionSchema.optional(),
|
|
46
|
-
/** Database port. Default: engine-specific (5432 for PostgreSQL) */
|
|
47
|
-
port: DatabasePortSchema.optional(),
|
|
48
|
-
/** Make database publicly accessible (for local development). Default: false */
|
|
49
|
-
publiclyAccessible: z.boolean().optional(),
|
|
50
|
-
/** IP CIDR to allow when publicly accessible */
|
|
51
|
-
allowedIpCidr: z.string().optional(),
|
|
52
|
-
/** Instance type for RDS Instance databases (e.g., "t4g.small", "t4g.large") */
|
|
53
|
-
instanceType: z.string().optional(),
|
|
54
|
-
/** Allocated storage in GB for RDS Instance. Default: 20 */
|
|
55
|
-
allocatedStorage: z
|
|
56
|
-
.number()
|
|
57
|
-
.int(VALIDATION_MESSAGES.ALLOCATED_STORAGE.INTEGER)
|
|
58
|
-
.min(20, VALIDATION_MESSAGES.ALLOCATED_STORAGE.MIN)
|
|
59
|
-
.max(65536, VALIDATION_MESSAGES.ALLOCATED_STORAGE.MAX)
|
|
60
|
-
.optional(),
|
|
61
|
-
/** Enable Multi-AZ deployment for high availability. */
|
|
62
|
-
multiAz: z.boolean().optional(),
|
|
63
|
-
/** Read replica configuration for RDS Instance. Set to false to explicitly disable. */
|
|
64
|
-
readReplica: ReadReplicaConfigOrFalseSchema.optional(),
|
|
65
|
-
/** Aurora writer instance configuration. */
|
|
66
|
-
writer: AuroraWriterConfigSchema.optional(),
|
|
67
|
-
/** Aurora reader instances configuration. Set to false to explicitly disable. */
|
|
68
|
-
readers: AuroraReadersConfigOrFalseSchema.optional(),
|
|
69
|
-
/** Allow access from VPC CIDR (avoids cross-stack cyclic dependencies). */
|
|
70
|
-
allowVpcAccess: z.boolean().optional(),
|
|
71
|
-
/** Enhanced monitoring interval in seconds. */
|
|
72
|
-
monitoringInterval: MonitoringIntervalSchema.optional(),
|
|
73
|
-
/** Preferred maintenance window (e.g., "sun:05:00-sun:06:00"). */
|
|
74
|
-
preferredMaintenanceWindow: z.string().optional(),
|
|
75
|
-
/** Database Insights configuration. Set to false to explicitly disable. */
|
|
76
|
-
databaseInsights: DatabaseInsightsConfigOrFalseSchema.optional(),
|
|
77
|
-
/** RDS Proxy configuration for connection pooling. Set to false to explicitly disable. */
|
|
78
|
-
proxy: ProxyConfigOrFalseSchema.optional(),
|
|
79
|
-
/** Credentials configuration (username, rotation). */
|
|
80
|
-
credentials: CredentialsConfigSchema.optional(),
|
|
81
|
-
/** Encryption configuration. */
|
|
82
|
-
encryption: EncryptionConfigSchema.optional(),
|
|
83
|
-
/** ARN or identifier of snapshot to restore from */
|
|
84
|
-
snapshotIdentifier: z.string().optional(),
|
|
85
|
-
/** Username from the snapshot (required when restoring) */
|
|
86
|
-
snapshotUsername: z.string().optional(),
|
|
87
|
-
})
|
|
88
|
-
.strict();
|
|
89
|
-
// ─── Payload compute configuration ──────────────────────────────────────────
|
|
90
|
-
/**
|
|
91
|
-
* Full Payload compute configuration for pattern.
|
|
92
|
-
* Allows per-function configuration for each Lambda in the pattern.
|
|
93
|
-
*/
|
|
94
|
-
export const PayloadComputeConfigSchema = z
|
|
95
|
-
.object({
|
|
96
|
-
/** Server Lambda configuration (handles main application requests). */
|
|
97
|
-
server: PatternLambdaConfigSchema.optional(),
|
|
98
|
-
/** Image optimisation Lambda configuration (handles Next.js image optimisation). */
|
|
99
|
-
imageOptimisation: PatternLambdaConfigSchema.optional(),
|
|
100
|
-
/** Revalidation Lambda configuration (handles ISR revalidation from SQS queue). */
|
|
101
|
-
revalidation: PatternLambdaConfigSchema.optional(),
|
|
102
|
-
})
|
|
103
|
-
.strict();
|
|
104
|
-
// ─── Payload storage configuration ──────────────────────────────────────────
|
|
105
|
-
/**
|
|
106
|
-
* Pattern storage bucket configuration.
|
|
107
|
-
*/
|
|
108
|
-
export const PatternStorageBucketConfigSchema = z
|
|
109
|
-
.object({
|
|
110
|
-
/** Enable versioning. Default: false */
|
|
111
|
-
versioned: z.boolean().optional(),
|
|
112
|
-
})
|
|
113
|
-
.strict();
|
|
114
|
-
/**
|
|
115
|
-
* Full Payload storage configuration for pattern.
|
|
116
|
-
* Allows per-bucket configuration for each S3 bucket in the pattern.
|
|
117
|
-
*/
|
|
118
|
-
export const PayloadStorageConfigSchema = z
|
|
119
|
-
.object({
|
|
120
|
-
/** Assets bucket (static files) */
|
|
121
|
-
assets: PatternStorageBucketConfigSchema.optional(),
|
|
122
|
-
/** Cache bucket (ISR cache) */
|
|
123
|
-
cache: PatternStorageBucketConfigSchema.optional(),
|
|
124
|
-
/** Media bucket (uploads) */
|
|
125
|
-
media: PatternStorageBucketConfigSchema.optional(),
|
|
126
|
-
})
|
|
127
|
-
.strict();
|
|
128
|
-
// ─── Payload messaging configuration ─────────────────────────────────────────
|
|
129
|
-
/**
|
|
130
|
-
* Pattern queue configuration for messaging.
|
|
131
|
-
*/
|
|
132
|
-
export const PatternQueueConfigSchema = z
|
|
133
|
-
.object({
|
|
134
|
-
/** Visibility timeout in seconds. Default: matches revalidation timeout */
|
|
135
|
-
visibilityTimeout: z
|
|
136
|
-
.number()
|
|
137
|
-
.int(VALIDATION_MESSAGES.SQS.VISIBILITY_TIMEOUT.INTEGER)
|
|
138
|
-
.min(0, VALIDATION_MESSAGES.SQS.VISIBILITY_TIMEOUT.MIN)
|
|
139
|
-
.max(43200, VALIDATION_MESSAGES.SQS.VISIBILITY_TIMEOUT.MAX)
|
|
140
|
-
.optional(),
|
|
141
|
-
/** Message retention period in seconds. Default: 345600 (4 days) */
|
|
142
|
-
messageRetentionPeriod: z
|
|
143
|
-
.number()
|
|
144
|
-
.int(VALIDATION_MESSAGES.SQS.RETENTION_PERIOD.INTEGER)
|
|
145
|
-
.min(60, VALIDATION_MESSAGES.SQS.RETENTION_PERIOD.MIN)
|
|
146
|
-
.max(1209600, VALIDATION_MESSAGES.SQS.RETENTION_PERIOD.MAX)
|
|
147
|
-
.optional(),
|
|
148
|
-
/** Maximum message size in bytes. Default: 262144 (256 KB) */
|
|
149
|
-
maxMessageSize: z
|
|
150
|
-
.number()
|
|
151
|
-
.int(VALIDATION_MESSAGES.MAX_MESSAGE_SIZE.INTEGER)
|
|
152
|
-
.min(1024, VALIDATION_MESSAGES.MAX_MESSAGE_SIZE.MIN)
|
|
153
|
-
.max(262144, VALIDATION_MESSAGES.MAX_MESSAGE_SIZE.MAX)
|
|
154
|
-
.optional(),
|
|
155
|
-
/** Dead letter queue configuration. Set to false to explicitly disable. */
|
|
156
|
-
deadLetterQueue: z
|
|
157
|
-
.union([
|
|
158
|
-
z.literal(false),
|
|
159
|
-
z
|
|
160
|
-
.object({
|
|
161
|
-
enabled: z.boolean().optional(),
|
|
162
|
-
maxReceiveCount: z
|
|
163
|
-
.number()
|
|
164
|
-
.int(VALIDATION_MESSAGES.DLQ.MAX_RECEIVE_COUNT.INTEGER)
|
|
165
|
-
.min(1, VALIDATION_MESSAGES.DLQ.MAX_RECEIVE_COUNT.MIN)
|
|
166
|
-
.max(1000, VALIDATION_MESSAGES.DLQ.MAX_RECEIVE_COUNT.MAX)
|
|
167
|
-
.optional(),
|
|
168
|
-
})
|
|
169
|
-
.strict(),
|
|
170
|
-
])
|
|
171
|
-
.optional(),
|
|
172
|
-
})
|
|
173
|
-
.strict();
|
|
174
|
-
/**
|
|
175
|
-
* Full Payload messaging configuration for pattern.
|
|
176
|
-
*/
|
|
177
|
-
export const PayloadMessagingConfigSchema = z
|
|
178
|
-
.object({
|
|
179
|
-
/** Revalidation queue configuration */
|
|
180
|
-
revalidationQueue: PatternQueueConfigSchema.optional(),
|
|
181
|
-
})
|
|
182
|
-
.strict();
|
|
183
|
-
// ─── Payload CDN configuration ───────────────────────────────────────────────
|
|
184
|
-
/**
|
|
185
|
-
* Payload CDN configuration for pattern.
|
|
186
|
-
*/
|
|
187
|
-
export const PayloadCdnConfigSchema = z
|
|
188
|
-
.object({
|
|
189
|
-
/** Custom domain names for CloudFront */
|
|
190
|
-
domainNames: z.array(z.string()).optional(),
|
|
191
|
-
/** ACM certificate ARN for custom domains (must be in us-east-1) */
|
|
192
|
-
certificateArn: z.string().optional(),
|
|
193
|
-
})
|
|
194
|
-
.strict();
|
|
195
|
-
// ─── Pattern config discriminated unions ─────────────────────────────────────
|
|
196
|
-
/**
|
|
197
|
-
* Payload pattern configuration.
|
|
198
|
-
*/
|
|
199
|
-
export const PayloadPatternConfigSchema = z
|
|
200
|
-
.object({
|
|
201
|
-
type: z.literal("payload"),
|
|
202
|
-
/** Pattern name (used for resource naming) */
|
|
203
|
-
name: z.string().min(1, VALIDATION_MESSAGES.REQUIRED.PATTERN_NAME),
|
|
204
|
-
/** Custom domain (auto-creates certificate + DNS) */
|
|
205
|
-
domain: z.string().optional(),
|
|
206
|
-
/** Database configuration */
|
|
207
|
-
database: PayloadDatabaseConfigSchema.optional(),
|
|
208
|
-
/** Compute (Lambda) configuration */
|
|
209
|
-
compute: PayloadComputeConfigSchema.optional(),
|
|
210
|
-
/** Storage (S3) configuration */
|
|
211
|
-
storage: PayloadStorageConfigSchema.optional(),
|
|
212
|
-
/** Messaging (SQS) configuration */
|
|
213
|
-
messaging: PayloadMessagingConfigSchema.optional(),
|
|
214
|
-
/** CDN (CloudFront) configuration - advanced use, prefer `domain` for simple setup */
|
|
215
|
-
cdn: PayloadCdnConfigSchema.optional(),
|
|
216
|
-
/** Additional environment variables for server Lambda */
|
|
217
|
-
environment: z.record(z.string(), z.string()).optional(),
|
|
218
|
-
})
|
|
219
|
-
.strict();
|
|
220
|
-
/**
|
|
221
|
-
* Next.js pattern configuration.
|
|
222
|
-
* Shares the same OpenNext infrastructure as Payload but without
|
|
223
|
-
* requiring a database by default (pure Next.js with optional database).
|
|
224
|
-
*/
|
|
225
|
-
export const NextJSPatternConfigSchema = z
|
|
226
|
-
.object({
|
|
227
|
-
type: z.literal("nextjs"),
|
|
228
|
-
/** Pattern name (used for resource naming) */
|
|
229
|
-
name: z.string().min(1, VALIDATION_MESSAGES.REQUIRED.PATTERN_NAME),
|
|
230
|
-
/** Custom domain (auto-creates certificate + DNS) */
|
|
231
|
-
domain: z.string().optional(),
|
|
232
|
-
/** Database configuration */
|
|
233
|
-
database: PayloadDatabaseConfigSchema.optional(),
|
|
234
|
-
/** Compute (Lambda) configuration */
|
|
235
|
-
compute: PayloadComputeConfigSchema.optional(),
|
|
236
|
-
/** Storage (S3) configuration */
|
|
237
|
-
storage: PayloadStorageConfigSchema.optional(),
|
|
238
|
-
/** Messaging (SQS) configuration */
|
|
239
|
-
messaging: PayloadMessagingConfigSchema.optional(),
|
|
240
|
-
/** CDN (CloudFront) configuration - advanced use, prefer `domain` for simple setup */
|
|
241
|
-
cdn: PayloadCdnConfigSchema.optional(),
|
|
242
|
-
/** Additional environment variables for server Lambda */
|
|
243
|
-
environment: z.record(z.string(), z.string()).optional(),
|
|
244
|
-
})
|
|
245
|
-
.strict();
|
|
246
|
-
/**
|
|
247
|
-
* Pattern configuration discriminated union.
|
|
248
|
-
* Extensible for future patterns (Remix, etc.)
|
|
249
|
-
*/
|
|
250
|
-
export const PatternConfigSchema = z.discriminatedUnion("type", [
|
|
251
|
-
PayloadPatternConfigSchema,
|
|
252
|
-
NextJSPatternConfigSchema,
|
|
253
|
-
]);
|
|
254
|
-
// ─── Pattern tier / custom pattern schemas ───────────────────────────────────
|
|
255
|
-
/**
|
|
256
|
-
* Pattern tier schema for OpenNext patterns (Payload, Next.js).
|
|
257
|
-
* Defines configuration tiers: lightweight, standard, resilient, custom.
|
|
258
|
-
*/
|
|
259
|
-
export const PatternTierSchema = z.enum([
|
|
260
|
-
"lightweight",
|
|
261
|
-
"standard",
|
|
262
|
-
"resilient",
|
|
263
|
-
"custom",
|
|
264
|
-
]);
|
|
265
|
-
/**
|
|
266
|
-
* Custom database configuration for patterns.
|
|
267
|
-
* Used when patternTier is "custom".
|
|
268
|
-
*/
|
|
269
|
-
export const CustomPatternDatabaseSchema = z
|
|
270
|
-
.object({
|
|
271
|
-
type: z.enum(["Instance", "Aurora"]),
|
|
272
|
-
instanceType: z.string().optional(),
|
|
273
|
-
backupRetention: BackupRetentionSchema.optional(),
|
|
274
|
-
deletionProtection: z.boolean().optional(),
|
|
275
|
-
encryption: z
|
|
276
|
-
.union([z.object({ useCMK: z.literal(true) }).strict(), z.literal(false)])
|
|
277
|
-
.optional(),
|
|
278
|
-
})
|
|
279
|
-
.strict();
|
|
280
|
-
/**
|
|
281
|
-
* Custom compute configuration for patterns.
|
|
282
|
-
* Used when patternTier is "custom".
|
|
283
|
-
*/
|
|
284
|
-
export const CustomPatternComputeSchema = z
|
|
285
|
-
.object({
|
|
286
|
-
memorySize: LambdaMemorySchema.optional(),
|
|
287
|
-
timeout: z
|
|
288
|
-
.number()
|
|
289
|
-
.int(VALIDATION_MESSAGES.LAMBDA.TIMEOUT.INTEGER)
|
|
290
|
-
.min(1, VALIDATION_MESSAGES.LAMBDA.TIMEOUT.MIN)
|
|
291
|
-
.max(900, VALIDATION_MESSAGES.LAMBDA.TIMEOUT.MAX)
|
|
292
|
-
.optional(),
|
|
293
|
-
})
|
|
294
|
-
.strict();
|
|
1
|
+
import{z as o}from"zod";import{VALIDATION_MESSAGES as t}from"../validation/patterns.js";import{BackupRetentionSchema as a,MonitoringIntervalSchema as m,DatabasePortSchema as E,ProxyConfigOrFalseSchema as S,ReadReplicaConfigOrFalseSchema as I,AuroraWriterConfigSchema as A,AuroraReadersConfigOrFalseSchema as g,DatabaseInsightsConfigOrFalseSchema as T,CredentialsConfigSchema as M,EncryptionConfigSchema as d}from"./databaseSchemas.js";import{LambdaMemorySchema as i}from"./computeSchemas.js";const e=o.object({memorySize:i.optional(),timeout:o.number().int(t.LAMBDA.TIMEOUT.INTEGER).min(1,t.LAMBDA.TIMEOUT.MIN).max(900,t.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:o.number().int(t.EPHEMERAL_STORAGE.INTEGER).min(512,t.EPHEMERAL_STORAGE.MIN).max(10240,t.EPHEMERAL_STORAGE.MAX).optional()}).strict(),r=o.object({type:o.enum(["Instance","Aurora"]).optional(),databaseName:o.string().optional(),databaseEngine:o.enum(["postgresql","mysql"]).optional(),deletionProtection:o.boolean().optional(),backupRetention:a.optional(),port:E.optional(),publiclyAccessible:o.boolean().optional(),allowedIpCidr:o.string().optional(),instanceType:o.string().optional(),allocatedStorage:o.number().int(t.ALLOCATED_STORAGE.INTEGER).min(20,t.ALLOCATED_STORAGE.MIN).max(65536,t.ALLOCATED_STORAGE.MAX).optional(),multiAz:o.boolean().optional(),readReplica:I.optional(),writer:A.optional(),readers:g.optional(),allowVpcAccess:o.boolean().optional(),monitoringInterval:m.optional(),preferredMaintenanceWindow:o.string().optional(),databaseInsights:T.optional(),proxy:S.optional(),credentials:M.optional(),encryption:d.optional(),snapshotIdentifier:o.string().optional(),snapshotUsername:o.string().optional()}).strict(),l=o.object({server:e.optional(),imageOptimisation:e.optional(),revalidation:e.optional()}).strict(),n=o.object({versioned:o.boolean().optional()}).strict(),s=o.object({assets:n.optional(),cache:n.optional(),media:n.optional()}).strict(),b=o.object({visibilityTimeout:o.number().int(t.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,t.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,t.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:o.number().int(t.SQS.RETENTION_PERIOD.INTEGER).min(60,t.SQS.RETENTION_PERIOD.MIN).max(1209600,t.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:o.number().int(t.MAX_MESSAGE_SIZE.INTEGER).min(1024,t.MAX_MESSAGE_SIZE.MIN).max(262144,t.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:o.union([o.literal(!1),o.object({enabled:o.boolean().optional(),maxReceiveCount:o.number().int(t.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,t.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,t.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),p=o.object({revalidationQueue:b.optional()}).strict(),c=o.object({domainNames:o.array(o.string()).optional(),certificateArn:o.string().optional()}).strict(),u=o.object({type:o.literal("payload"),name:o.string().min(1,t.REQUIRED.PATTERN_NAME),domain:o.string().optional(),database:r.optional(),compute:l.optional(),storage:s.optional(),messaging:p.optional(),cdn:c.optional(),environment:o.record(o.string(),o.string()).optional()}).strict(),R=o.object({type:o.literal("nextjs"),name:o.string().min(1,t.REQUIRED.PATTERN_NAME),domain:o.string().optional(),database:r.optional(),compute:l.optional(),storage:s.optional(),messaging:p.optional(),cdn:c.optional(),environment:o.record(o.string(),o.string()).optional()}).strict(),x=o.discriminatedUnion("type",[u,R]),P=o.enum(["lightweight","standard","resilient","custom"]),f=o.object({type:o.enum(["Instance","Aurora"]),instanceType:o.string().optional(),backupRetention:a.optional(),deletionProtection:o.boolean().optional(),encryption:o.union([o.object({useCMK:o.literal(!0)}).strict(),o.literal(!1)]).optional()}).strict(),_=o.object({memorySize:i.optional(),timeout:o.number().int(t.LAMBDA.TIMEOUT.INTEGER).min(1,t.LAMBDA.TIMEOUT.MIN).max(900,t.LAMBDA.TIMEOUT.MAX).optional()}).strict();export{_ as CustomPatternComputeSchema,f as CustomPatternDatabaseSchema,R as NextJSPatternConfigSchema,x as PatternConfigSchema,e as PatternLambdaConfigSchema,b as PatternQueueConfigSchema,n as PatternStorageBucketConfigSchema,P as PatternTierSchema,c as PayloadCdnConfigSchema,l as PayloadComputeConfigSchema,r as PayloadDatabaseConfigSchema,p as PayloadMessagingConfigSchema,u as PayloadPatternConfigSchema,s as PayloadStorageConfigSchema};
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Re-export barrel for all resource schemas.
|
|
3
|
-
*
|
|
4
|
-
* This file previously contained ~2,400 lines of Zod schemas. They have been
|
|
5
|
-
* split into focused domain-specific modules:
|
|
6
|
-
*
|
|
7
|
-
* baseSchemas.ts — Shared utilities, name/port/env schemas, custom code, backup/tunnel
|
|
8
|
-
* databaseSchemas.ts — RDS, Aurora, DynamoDB, proxy, credentials, encryption
|
|
9
|
-
* networkSchemas.ts — VPC, NAT, flow logs, endpoints
|
|
10
|
-
* storageSchemas.ts — S3 resource plan and generator
|
|
11
|
-
* messagingSchemas.ts — SQS resource plan
|
|
12
|
-
* cdnSchemas.ts — CloudFront CDN resource plan and generator
|
|
13
|
-
* computeSchemas.ts — EC2, Lambda, ECS, container, service configs
|
|
14
|
-
* patternSchemas.ts — Payload/NextJS pattern configs, tier schemas
|
|
15
|
-
* applicationSchemas.ts — ApplicationResourcePlan, ApplicationGenerator
|
|
16
|
-
*
|
|
17
|
-
* All exports are re-exported here so existing consumers continue to work
|
|
18
|
-
* without any import path changes.
|
|
19
|
-
*/
|
|
20
|
-
export * from "./baseSchemas.js";
|
|
21
|
-
export * from "./databaseSchemas.js";
|
|
22
|
-
export * from "./networkSchemas.js";
|
|
23
|
-
export * from "./storageSchemas.js";
|
|
24
|
-
export * from "./messagingSchemas.js";
|
|
25
|
-
export * from "./cdnSchemas.js";
|
|
26
|
-
export * from "./computeSchemas.js";
|
|
27
|
-
export * from "./patternSchemas.js";
|
|
28
|
-
export * from "./applicationSchemas.js";
|
|
1
|
+
export*from"./baseSchemas.js";export*from"./databaseSchemas.js";export*from"./networkSchemas.js";export*from"./storageSchemas.js";export*from"./messagingSchemas.js";export*from"./cdnSchemas.js";export*from"./computeSchemas.js";export*from"./patternSchemas.js";export*from"./applicationSchemas.js";export*from"./alarmSchemas.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions and constants used by both schemas/ and presets/.
|
|
3
|
+
*
|
|
4
|
+
* This file exists to break the circular dependency between schemas/constants.ts
|
|
5
|
+
* and presets/tierPresets.ts. Both modules re-export these symbols for backwards
|
|
6
|
+
* compatibility — consumers can import from either without changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DATABASE_TYPES: readonly ["Aurora", "Instance", "GlobalAurora"];
|
|
9
|
+
export type DatabaseType = (typeof DATABASE_TYPES)[number];
|
|
10
|
+
export declare const ECS_CAPACITY_PROVIDERS: readonly ["FARGATE", "FARGATE_SPOT", "EC2"];
|
|
11
|
+
export type EcsCapacityProvider = (typeof ECS_CAPACITY_PROVIDERS)[number];
|
|
12
|
+
export declare const BACKUP_VAULT_TIERS: readonly ["standard", "resilient", "enterprise"];
|
|
13
|
+
export type BackupVaultTier = (typeof BACKUP_VAULT_TIERS)[number];
|
|
14
|
+
export declare const TIER_NAMES: readonly ["tinkerer", "lightweight", "standard", "resilient", "enterprise"];
|
|
15
|
+
export type TierName = (typeof TIER_NAMES)[number];
|
|
16
|
+
export declare const CUSTOM_TIER: "custom";
|
|
17
|
+
export declare const APP_TYPES: readonly ["tinkerer", "lightweight", "standard", "resilient", "enterprise", "custom"];
|
|
18
|
+
export type AppType = (typeof APP_TYPES)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=["Aurora","Instance","GlobalAurora"],o=["FARGATE","FARGATE_SPOT","EC2"],n=["standard","resilient","enterprise"],t=["tinkerer","lightweight","standard","resilient","enterprise"],e="custom",A=[...t,e];export{A as APP_TYPES,n as BACKUP_VAULT_TIERS,e as CUSTOM_TIER,r as DATABASE_TYPES,o as ECS_CAPACITY_PROVIDERS,t as TIER_NAMES};
|
|
@@ -40,6 +40,7 @@ export declare const S3ResourcePlanSchema: z.ZodObject<{
|
|
|
40
40
|
immutable: z.ZodOptional<z.ZodBoolean>;
|
|
41
41
|
}, z.core.$strict>>;
|
|
42
42
|
}, z.core.$strict>>;
|
|
43
|
+
retain: z.ZodOptional<z.ZodBoolean>;
|
|
43
44
|
stackPlacement: z.ZodOptional<z.ZodEnum<{
|
|
44
45
|
storage: "storage";
|
|
45
46
|
compute: "compute";
|