@fjall/generator 0.89.5 → 0.94.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/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 +5 -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/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/registry.d.ts +42 -0
- package/dist/src/codemod/registry.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
|
@@ -12,8 +12,7 @@ export declare const DEFAULTS: Readonly<{
|
|
|
12
12
|
compute: "Compute";
|
|
13
13
|
}>;
|
|
14
14
|
}>;
|
|
15
|
-
export
|
|
16
|
-
export type DatabaseType = (typeof DATABASE_TYPES)[number];
|
|
15
|
+
export { DATABASE_TYPES, type DatabaseType } from "./sharedTypes.js";
|
|
17
16
|
export declare const COMPUTE_TYPES: readonly ["ecs", "lambda", "ec2"];
|
|
18
17
|
export type ComputeType = (typeof COMPUTE_TYPES)[number];
|
|
19
18
|
export declare const COMPUTE_TYPE: Readonly<{
|
|
@@ -30,8 +29,8 @@ export declare const DEPLOYMENT_TYPE: Readonly<{
|
|
|
30
29
|
export declare const COMPUTE_ARCHITECTURES: readonly ["ARM_64", "X86_64"];
|
|
31
30
|
export type ComputeArchitecture = (typeof COMPUTE_ARCHITECTURES)[number];
|
|
32
31
|
export declare const DEFAULT_COMPUTE_ARCHITECTURE: ComputeArchitecture;
|
|
33
|
-
export
|
|
34
|
-
|
|
32
|
+
export { ECS_CAPACITY_PROVIDERS, type EcsCapacityProvider, } from "./sharedTypes.js";
|
|
33
|
+
import type { EcsCapacityProvider } from "./sharedTypes.js";
|
|
35
34
|
export declare const DEFAULT_CAPACITY_PROVIDER: EcsCapacityProvider;
|
|
36
35
|
/**
|
|
37
36
|
* OpenNext deployment patterns.
|
|
@@ -41,7 +40,7 @@ export declare const DEFAULT_CAPACITY_PROVIDER: EcsCapacityProvider;
|
|
|
41
40
|
export declare const PATTERN_TYPE_VALUES: readonly ["payload", "nextjs"];
|
|
42
41
|
export type PatternType = (typeof PATTERN_TYPE_VALUES)[number];
|
|
43
42
|
export declare const PATTERN_TYPES: ReadonlySet<string>;
|
|
44
|
-
export { APP_TYPES, CUSTOM_TIER, type AppType
|
|
43
|
+
export { APP_TYPES, CUSTOM_TIER, type AppType } from "./sharedTypes.js";
|
|
45
44
|
export declare const EC2_INSTANCE_TYPES: readonly ["t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large", "t3.xlarge", "t3.2xlarge", "t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large", "t3a.xlarge", "t3a.2xlarge", "t4g.nano", "t4g.micro", "t4g.small", "t4g.medium", "t4g.large", "t4g.xlarge", "t4g.2xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.12xlarge", "c5.18xlarge", "c5.24xlarge", "c5a.large", "c5a.xlarge", "c5a.2xlarge", "c5a.4xlarge", "c5a.8xlarge", "c5a.12xlarge", "c5a.16xlarge", "c5a.24xlarge", "c6g.medium", "c6g.large", "c6g.xlarge", "c6g.2xlarge", "c6g.4xlarge", "c6g.8xlarge", "c6g.12xlarge", "c6g.16xlarge", "r5.large", "r5.xlarge", "r5.2xlarge", "r5.4xlarge", "r5.8xlarge", "r5.12xlarge", "r5.16xlarge", "r5.24xlarge", "r5a.large", "r5a.xlarge", "r5a.2xlarge", "r5a.4xlarge", "r5a.8xlarge", "r5a.12xlarge", "r5a.16xlarge", "r5a.24xlarge", "r6g.medium", "r6g.large", "r6g.xlarge", "r6g.2xlarge", "r6g.4xlarge", "r6g.8xlarge", "r6g.12xlarge", "r6g.16xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "g4dn.xlarge", "g4dn.2xlarge", "g4dn.4xlarge", "g4dn.8xlarge", "g4dn.12xlarge", "g4dn.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.8xlarge", "m5.12xlarge", "m5.16xlarge", "m5.24xlarge", "m5a.large", "m5a.xlarge", "m5a.2xlarge", "m5a.4xlarge", "m5a.8xlarge", "m5a.12xlarge", "m5a.16xlarge", "m5a.24xlarge"];
|
|
46
45
|
export type EC2InstanceType = (typeof EC2_INSTANCE_TYPES)[number];
|
|
47
46
|
export declare const VALID_MONITORING_INTERVALS: readonly [0, 1, 5, 10, 15, 30, 60];
|
|
@@ -74,5 +73,4 @@ export declare const STORAGE_PRESET_TYPES: readonly ["standard", "assets", "uplo
|
|
|
74
73
|
export type StoragePresetType = (typeof STORAGE_PRESET_TYPES)[number];
|
|
75
74
|
export declare const S3_ENCRYPTION_TYPES: readonly ["AES256", "KMS"];
|
|
76
75
|
export type S3EncryptionType = (typeof S3_ENCRYPTION_TYPES)[number];
|
|
77
|
-
export
|
|
78
|
-
export type BackupVaultTier = (typeof BACKUP_VAULT_TIERS)[number];
|
|
76
|
+
export { BACKUP_VAULT_TIERS, type BackupVaultTier } from "./sharedTypes.js";
|
|
@@ -1,218 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared constants for Fjall CLI generators
|
|
3
|
-
* These defaults are designed to draw attention when not properly configured
|
|
4
|
-
*/
|
|
5
|
-
export const DEFAULTS = Object.freeze({
|
|
6
|
-
// Resource naming conventions
|
|
7
|
-
RESOURCE_SUFFIXES: Object.freeze({
|
|
8
|
-
storage: "Storage",
|
|
9
|
-
database: "Database",
|
|
10
|
-
cluster: "Cluster",
|
|
11
|
-
function: "Function",
|
|
12
|
-
instance: "Instance",
|
|
13
|
-
compute: "Compute",
|
|
14
|
-
}),
|
|
15
|
-
});
|
|
16
|
-
// Resource type constants for validation
|
|
17
|
-
export const DATABASE_TYPES = ["Aurora", "Instance", "GlobalAurora"];
|
|
18
|
-
export const COMPUTE_TYPES = ["ecs", "lambda", "ec2"];
|
|
19
|
-
// Object form for cleaner comparisons: COMPUTE_TYPE.ECS, COMPUTE_TYPE.LAMBDA, etc.
|
|
20
|
-
export const COMPUTE_TYPE = Object.freeze({
|
|
21
|
-
ECS: "ecs",
|
|
22
|
-
LAMBDA: "lambda",
|
|
23
|
-
EC2: "ec2",
|
|
24
|
-
});
|
|
25
|
-
// Deployment types for Lambda compute resources
|
|
26
|
-
export const DEPLOYMENT_TYPES = ["code", "container"];
|
|
27
|
-
export const DEPLOYMENT_TYPE = Object.freeze({
|
|
28
|
-
CODE: "code",
|
|
29
|
-
CONTAINER: "container",
|
|
30
|
-
});
|
|
31
|
-
export const COMPUTE_ARCHITECTURES = ["ARM_64", "X86_64"];
|
|
32
|
-
export const DEFAULT_COMPUTE_ARCHITECTURE = "ARM_64";
|
|
33
|
-
export const ECS_CAPACITY_PROVIDERS = [
|
|
34
|
-
"FARGATE",
|
|
35
|
-
"FARGATE_SPOT",
|
|
36
|
-
"EC2",
|
|
37
|
-
];
|
|
38
|
-
export const DEFAULT_CAPACITY_PROVIDER = "FARGATE";
|
|
39
|
-
/**
|
|
40
|
-
* OpenNext deployment patterns.
|
|
41
|
-
* - payload: Payload CMS (always has database + migrations)
|
|
42
|
-
* - nextjs: Pure Next.js (optional database)
|
|
43
|
-
*/
|
|
44
|
-
export const PATTERN_TYPE_VALUES = ["payload", "nextjs"];
|
|
45
|
-
export const PATTERN_TYPES = new Set(PATTERN_TYPE_VALUES);
|
|
46
|
-
export { APP_TYPES, CUSTOM_TIER, } from "../presets/tierPresets.js";
|
|
47
|
-
// Common EC2 instance types (not exhaustive, but covers common cases)
|
|
48
|
-
export const EC2_INSTANCE_TYPES = [
|
|
49
|
-
// General purpose
|
|
50
|
-
"t3.nano",
|
|
51
|
-
"t3.micro",
|
|
52
|
-
"t3.small",
|
|
53
|
-
"t3.medium",
|
|
54
|
-
"t3.large",
|
|
55
|
-
"t3.xlarge",
|
|
56
|
-
"t3.2xlarge",
|
|
57
|
-
"t3a.nano",
|
|
58
|
-
"t3a.micro",
|
|
59
|
-
"t3a.small",
|
|
60
|
-
"t3a.medium",
|
|
61
|
-
"t3a.large",
|
|
62
|
-
"t3a.xlarge",
|
|
63
|
-
"t3a.2xlarge",
|
|
64
|
-
"t4g.nano",
|
|
65
|
-
"t4g.micro",
|
|
66
|
-
"t4g.small",
|
|
67
|
-
"t4g.medium",
|
|
68
|
-
"t4g.large",
|
|
69
|
-
"t4g.xlarge",
|
|
70
|
-
"t4g.2xlarge",
|
|
71
|
-
// Compute optimised
|
|
72
|
-
"c5.large",
|
|
73
|
-
"c5.xlarge",
|
|
74
|
-
"c5.2xlarge",
|
|
75
|
-
"c5.4xlarge",
|
|
76
|
-
"c5.9xlarge",
|
|
77
|
-
"c5.12xlarge",
|
|
78
|
-
"c5.18xlarge",
|
|
79
|
-
"c5.24xlarge",
|
|
80
|
-
"c5a.large",
|
|
81
|
-
"c5a.xlarge",
|
|
82
|
-
"c5a.2xlarge",
|
|
83
|
-
"c5a.4xlarge",
|
|
84
|
-
"c5a.8xlarge",
|
|
85
|
-
"c5a.12xlarge",
|
|
86
|
-
"c5a.16xlarge",
|
|
87
|
-
"c5a.24xlarge",
|
|
88
|
-
"c6g.medium",
|
|
89
|
-
"c6g.large",
|
|
90
|
-
"c6g.xlarge",
|
|
91
|
-
"c6g.2xlarge",
|
|
92
|
-
"c6g.4xlarge",
|
|
93
|
-
"c6g.8xlarge",
|
|
94
|
-
"c6g.12xlarge",
|
|
95
|
-
"c6g.16xlarge",
|
|
96
|
-
// Memory optimised
|
|
97
|
-
"r5.large",
|
|
98
|
-
"r5.xlarge",
|
|
99
|
-
"r5.2xlarge",
|
|
100
|
-
"r5.4xlarge",
|
|
101
|
-
"r5.8xlarge",
|
|
102
|
-
"r5.12xlarge",
|
|
103
|
-
"r5.16xlarge",
|
|
104
|
-
"r5.24xlarge",
|
|
105
|
-
"r5a.large",
|
|
106
|
-
"r5a.xlarge",
|
|
107
|
-
"r5a.2xlarge",
|
|
108
|
-
"r5a.4xlarge",
|
|
109
|
-
"r5a.8xlarge",
|
|
110
|
-
"r5a.12xlarge",
|
|
111
|
-
"r5a.16xlarge",
|
|
112
|
-
"r5a.24xlarge",
|
|
113
|
-
"r6g.medium",
|
|
114
|
-
"r6g.large",
|
|
115
|
-
"r6g.xlarge",
|
|
116
|
-
"r6g.2xlarge",
|
|
117
|
-
"r6g.4xlarge",
|
|
118
|
-
"r6g.8xlarge",
|
|
119
|
-
"r6g.12xlarge",
|
|
120
|
-
"r6g.16xlarge",
|
|
121
|
-
// Storage optimised
|
|
122
|
-
"i3.large",
|
|
123
|
-
"i3.xlarge",
|
|
124
|
-
"i3.2xlarge",
|
|
125
|
-
"i3.4xlarge",
|
|
126
|
-
"i3.8xlarge",
|
|
127
|
-
"i3.16xlarge",
|
|
128
|
-
// Accelerated computing
|
|
129
|
-
"p3.2xlarge",
|
|
130
|
-
"p3.8xlarge",
|
|
131
|
-
"p3.16xlarge",
|
|
132
|
-
"g4dn.xlarge",
|
|
133
|
-
"g4dn.2xlarge",
|
|
134
|
-
"g4dn.4xlarge",
|
|
135
|
-
"g4dn.8xlarge",
|
|
136
|
-
"g4dn.12xlarge",
|
|
137
|
-
"g4dn.16xlarge",
|
|
138
|
-
// Previous generation (still common)
|
|
139
|
-
"m5.large",
|
|
140
|
-
"m5.xlarge",
|
|
141
|
-
"m5.2xlarge",
|
|
142
|
-
"m5.4xlarge",
|
|
143
|
-
"m5.8xlarge",
|
|
144
|
-
"m5.12xlarge",
|
|
145
|
-
"m5.16xlarge",
|
|
146
|
-
"m5.24xlarge",
|
|
147
|
-
"m5a.large",
|
|
148
|
-
"m5a.xlarge",
|
|
149
|
-
"m5a.2xlarge",
|
|
150
|
-
"m5a.4xlarge",
|
|
151
|
-
"m5a.8xlarge",
|
|
152
|
-
"m5a.12xlarge",
|
|
153
|
-
"m5a.16xlarge",
|
|
154
|
-
"m5a.24xlarge",
|
|
155
|
-
];
|
|
156
|
-
// Valid monitoring intervals for enhanced monitoring (in seconds)
|
|
157
|
-
export const VALID_MONITORING_INTERVALS = [0, 1, 5, 10, 15, 30, 60];
|
|
158
|
-
/** Includes check for `as const` arrays (centralises the widening cast) */
|
|
159
|
-
export function constIncludes(arr, value) {
|
|
160
|
-
return arr.includes(value);
|
|
161
|
-
}
|
|
162
|
-
// Port constraints
|
|
163
|
-
export const MIN_PORT = 1;
|
|
164
|
-
export const MAX_PORT = 65535;
|
|
165
|
-
/**
|
|
166
|
-
* Default database port: 35255 (FJALL on phone keypad)
|
|
167
|
-
* Used when no explicit port is specified in tier presets or configuration.
|
|
168
|
-
*/
|
|
169
|
-
export const DEFAULT_DATABASE_PORT = 35255;
|
|
170
|
-
// Lambda constraints — AWS service hard limits
|
|
171
|
-
export const MIN_LAMBDA_MEMORY = 128;
|
|
172
|
-
export const MAX_LAMBDA_MEMORY = 10240;
|
|
173
|
-
export const MIN_LAMBDA_TIMEOUT = 1;
|
|
174
|
-
export const MAX_LAMBDA_TIMEOUT = 900;
|
|
175
|
-
// ECS constraints — Fjall guardrails (ASG maxSize is the effective AWS ceiling;
|
|
176
|
-
// these cap the generator UI to prevent accidental large-scale provisioning)
|
|
177
|
-
export const MIN_ECS_CAPACITY = 1;
|
|
178
|
-
export const MAX_ECS_CAPACITY = 1000;
|
|
179
|
-
// Per-service scaling ceiling — limits individual service/ASG capacity to prevent
|
|
180
|
-
// accidental large-scale provisioning within a single service definition.
|
|
181
|
-
export const MAX_SCALING_CAPACITY = 100;
|
|
182
|
-
// Warm pool constraints and defaults — Fjall guardrails, not AWS hard limits
|
|
183
|
-
// (ASG maxSize is the effective AWS ceiling; these cap the generator UI)
|
|
184
|
-
export const MAX_WARM_POOL_SIZE = 100;
|
|
185
|
-
export const DEFAULT_WARM_POOL_MIN_SIZE = 1;
|
|
186
|
-
export const DEFAULT_WARM_POOL_REUSE_ON_SCALE_IN = true;
|
|
187
|
-
// Default container port for ECS clusters and services.
|
|
188
|
-
// 3000 is the most common default for Node.js frameworks (Express, Next.js, Remix).
|
|
189
|
-
export const DEFAULT_CONTAINER_PORT = 3000;
|
|
190
|
-
// Default EC2 instance type — Graviton-based, free-tier eligible
|
|
191
|
-
export const DEFAULT_EC2_INSTANCE_TYPE = "t4g.micro";
|
|
192
|
-
/** AWS Secrets Manager recommended rotation interval (days) */
|
|
193
|
-
export const DEFAULT_SECRET_ROTATION_DAYS = 30;
|
|
194
|
-
// Valid HTTP methods for Lambda CORS
|
|
195
|
-
export const HTTP_METHODS = [
|
|
196
|
-
"GET",
|
|
197
|
-
"POST",
|
|
198
|
-
"PUT",
|
|
199
|
-
"DELETE",
|
|
200
|
-
"HEAD",
|
|
201
|
-
"OPTIONS",
|
|
202
|
-
"PATCH",
|
|
203
|
-
];
|
|
204
|
-
// S3 storage preset types (generator-level concept, resolved to params before plan creation)
|
|
205
|
-
export const STORAGE_PRESET_TYPES = [
|
|
206
|
-
"standard",
|
|
207
|
-
"assets",
|
|
208
|
-
"upload",
|
|
209
|
-
"website",
|
|
210
|
-
];
|
|
211
|
-
// S3 encryption types
|
|
212
|
-
export const S3_ENCRYPTION_TYPES = ["AES256", "KMS"];
|
|
213
|
-
// Backup vault tiers for disaster recovery
|
|
214
|
-
export const BACKUP_VAULT_TIERS = [
|
|
215
|
-
"standard",
|
|
216
|
-
"resilient",
|
|
217
|
-
"enterprise",
|
|
218
|
-
];
|
|
1
|
+
const g=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})});import{DATABASE_TYPES as X}from"./sharedTypes.js";const t=["ecs","lambda","ec2"],x=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),l=["code","container"],o=Object.freeze({CODE:"code",CONTAINER:"container"}),c=["ARM_64","X86_64"],E="ARM_64";import{ECS_CAPACITY_PROVIDERS as V}from"./sharedTypes.js";const T="FARGATE",a=["payload","nextjs"],_=new Set(a);import{APP_TYPES as G,CUSTOM_TIER as z}from"./sharedTypes.js";const A=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],n=[0,1,5,10,15,30,60];function s(e,r){return e.includes(r)}const P=1,p=65535,S=35255,O=128,m=10240,C=1,M=900,I=1,R=1e3,D=100,N=100,L=1,U=!0,i=3e3,Y="t4g.micro",d=30,u=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],F=["standard","assets","upload","website"],f=["AES256","KMS"];import{BACKUP_VAULT_TIERS as w}from"./sharedTypes.js";export{G as APP_TYPES,w as BACKUP_VAULT_TIERS,c as COMPUTE_ARCHITECTURES,x as COMPUTE_TYPE,t as COMPUTE_TYPES,z as CUSTOM_TIER,X as DATABASE_TYPES,g as DEFAULTS,T as DEFAULT_CAPACITY_PROVIDER,E as DEFAULT_COMPUTE_ARCHITECTURE,i as DEFAULT_CONTAINER_PORT,S as DEFAULT_DATABASE_PORT,Y as DEFAULT_EC2_INSTANCE_TYPE,d as DEFAULT_SECRET_ROTATION_DAYS,L as DEFAULT_WARM_POOL_MIN_SIZE,U as DEFAULT_WARM_POOL_REUSE_ON_SCALE_IN,o as DEPLOYMENT_TYPE,l as DEPLOYMENT_TYPES,A as EC2_INSTANCE_TYPES,V as ECS_CAPACITY_PROVIDERS,u as HTTP_METHODS,R as MAX_ECS_CAPACITY,m as MAX_LAMBDA_MEMORY,M as MAX_LAMBDA_TIMEOUT,p as MAX_PORT,D as MAX_SCALING_CAPACITY,N as MAX_WARM_POOL_SIZE,I as MIN_ECS_CAPACITY,O as MIN_LAMBDA_MEMORY,C as MIN_LAMBDA_TIMEOUT,P as MIN_PORT,_ as PATTERN_TYPES,a as PATTERN_TYPE_VALUES,f as S3_ENCRYPTION_TYPES,F as STORAGE_PRESET_TYPES,n as VALID_MONITORING_INTERVALS,s as constIncludes};
|
|
@@ -119,9 +119,9 @@ export declare const DatabaseResourcePlanSchema: z.ZodObject<{
|
|
|
119
119
|
}>;
|
|
120
120
|
databaseName: z.ZodString;
|
|
121
121
|
instanceType: z.ZodOptional<z.ZodString>;
|
|
122
|
+
allocatedStorage: z.ZodOptional<z.ZodNumber>;
|
|
122
123
|
multiAz: z.ZodOptional<z.ZodBoolean>;
|
|
123
124
|
publiclyAccessible: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
-
enableSecretRotation: z.ZodOptional<z.ZodBoolean>;
|
|
125
125
|
databaseInsights: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<false>, z.ZodObject<{
|
|
126
126
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
127
127
|
standard: "standard";
|
|
@@ -192,6 +192,11 @@ export declare const DatabaseResourcePlanSchema: z.ZodObject<{
|
|
|
192
192
|
key: z.ZodString;
|
|
193
193
|
sourceText: z.ZodString;
|
|
194
194
|
}, z.core.$strict>>>;
|
|
195
|
+
alarms: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
196
|
+
cpuThreshold: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
freeStorageThresholdGiB: z.ZodOptional<z.ZodNumber>;
|
|
198
|
+
connectionsThreshold: z.ZodOptional<z.ZodNumber>;
|
|
199
|
+
}, z.core.$strict>]>>;
|
|
195
200
|
}, z.core.$strict>;
|
|
196
201
|
/**
|
|
197
202
|
* Database generator schema using discriminated union.
|
|
@@ -1,366 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VALIDATION_PATTERNS, VALIDATION_MESSAGES, } from "../validation/patterns.js";
|
|
3
|
-
import { DATABASE_TYPES, VALID_MONITORING_INTERVALS, constIncludes, } from "./constants.js";
|
|
4
|
-
import { optionalOrDisabled, ResourceNameSchema, AppNameSchema, ExtraPropertySchema, } from "./baseSchemas.js";
|
|
5
|
-
// ─── Reusable database-specific validation schemas ───────────────────────────
|
|
6
|
-
/** Reusable backup retention validation. Range: 1-35 days. */
|
|
7
|
-
export const BackupRetentionSchema = z
|
|
8
|
-
.number()
|
|
9
|
-
.int(VALIDATION_MESSAGES.BACKUP_RETENTION.INTEGER)
|
|
10
|
-
.min(1, VALIDATION_MESSAGES.BACKUP_RETENTION.MIN)
|
|
11
|
-
.max(35, VALIDATION_MESSAGES.BACKUP_RETENTION.MAX);
|
|
12
|
-
/** Reusable monitoring interval validation. Must be one of: 0, 1, 5, 10, 15, 30, 60. */
|
|
13
|
-
export const MonitoringIntervalSchema = z
|
|
14
|
-
.number()
|
|
15
|
-
.int(VALIDATION_MESSAGES.MONITORING_INTERVAL.INTEGER)
|
|
16
|
-
.refine((val) => constIncludes(VALID_MONITORING_INTERVALS, val), {
|
|
17
|
-
message: VALIDATION_MESSAGES.MONITORING_INTERVAL.VALUES,
|
|
18
|
-
});
|
|
19
|
-
/** Reusable database port validation. Range: 1024-65535. */
|
|
20
|
-
export const DatabasePortSchema = z
|
|
21
|
-
.number()
|
|
22
|
-
.int(VALIDATION_MESSAGES.DATABASE.PORT.INTEGER)
|
|
23
|
-
.min(1024, VALIDATION_MESSAGES.DATABASE.PORT.MIN)
|
|
24
|
-
.max(65535, VALIDATION_MESSAGES.DATABASE.PORT.MAX);
|
|
25
|
-
// ─── Database type ───────────────────────────────────────────────────────────
|
|
26
|
-
export const DatabaseTypeSchema = z
|
|
27
|
-
.enum(DATABASE_TYPES)
|
|
28
|
-
.describe(`Database type must be one of: ${DATABASE_TYPES.join(", ")}`);
|
|
29
|
-
// ─── Nested configuration schemas ────────────────────────────────────────────
|
|
30
|
-
export const ProxyConfigSchema = z
|
|
31
|
-
.object({
|
|
32
|
-
maxConnections: z
|
|
33
|
-
.number()
|
|
34
|
-
.int(VALIDATION_MESSAGES.MAX_CONNECTIONS.INTEGER)
|
|
35
|
-
.min(1, VALIDATION_MESSAGES.MAX_CONNECTIONS.MIN)
|
|
36
|
-
.max(100, VALIDATION_MESSAGES.MAX_CONNECTIONS.MAX)
|
|
37
|
-
.optional(),
|
|
38
|
-
maxIdleConnections: z
|
|
39
|
-
.number()
|
|
40
|
-
.int(VALIDATION_MESSAGES.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER)
|
|
41
|
-
.min(0, VALIDATION_MESSAGES.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN)
|
|
42
|
-
.max(100, VALIDATION_MESSAGES.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX)
|
|
43
|
-
.optional(),
|
|
44
|
-
connectionBorrowTimeout: z
|
|
45
|
-
.number()
|
|
46
|
-
.int(VALIDATION_MESSAGES.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER)
|
|
47
|
-
.min(1, VALIDATION_MESSAGES.PROXY_CONFIG.BORROW_TIMEOUT.MIN)
|
|
48
|
-
.max(3600, VALIDATION_MESSAGES.PROXY_CONFIG.BORROW_TIMEOUT.MAX)
|
|
49
|
-
.optional(),
|
|
50
|
-
requireTLS: z.boolean().optional(),
|
|
51
|
-
})
|
|
52
|
-
.strict()
|
|
53
|
-
.describe("RDS Proxy configuration");
|
|
54
|
-
export const ReadReplicaConfigSchema = z
|
|
55
|
-
.object({
|
|
56
|
-
instanceType: z.string().optional(),
|
|
57
|
-
availabilityZone: z.string().optional(),
|
|
58
|
-
})
|
|
59
|
-
.strict()
|
|
60
|
-
.describe("Read replica configuration");
|
|
61
|
-
export const SecretRotationConfigSchema = z
|
|
62
|
-
.object({
|
|
63
|
-
automaticallyAfterDays: z
|
|
64
|
-
.number()
|
|
65
|
-
.int(VALIDATION_MESSAGES.ROTATION.INTEGER)
|
|
66
|
-
.min(1, VALIDATION_MESSAGES.ROTATION.MIN)
|
|
67
|
-
.max(365, VALIDATION_MESSAGES.ROTATION.MAX)
|
|
68
|
-
.optional(),
|
|
69
|
-
})
|
|
70
|
-
.strict()
|
|
71
|
-
.describe("Secret rotation configuration");
|
|
72
|
-
export const CredentialsConfigSchema = z
|
|
73
|
-
.object({
|
|
74
|
-
username: z
|
|
75
|
-
.string()
|
|
76
|
-
.min(1, VALIDATION_MESSAGES.REQUIRED.USERNAME)
|
|
77
|
-
.max(63, VALIDATION_MESSAGES.USERNAME.MAX_LENGTH)
|
|
78
|
-
.optional(),
|
|
79
|
-
secretRotation: SecretRotationConfigSchema.optional(),
|
|
80
|
-
})
|
|
81
|
-
.strict()
|
|
82
|
-
.describe("Database credentials configuration");
|
|
83
|
-
export const ProxyConfigOrFalseSchema = optionalOrDisabled(ProxyConfigSchema);
|
|
84
|
-
export const ReadReplicaConfigOrFalseSchema = optionalOrDisabled(ReadReplicaConfigSchema);
|
|
85
|
-
// ─── Aurora-specific nested configuration ────────────────────────────────────
|
|
86
|
-
export const AuroraReaderConfigSchema = z
|
|
87
|
-
.object({
|
|
88
|
-
scaleWithWriter: z.boolean().optional(),
|
|
89
|
-
enableDatabaseInsights: z.boolean().optional(),
|
|
90
|
-
identifierSuffix: z
|
|
91
|
-
.string()
|
|
92
|
-
.min(1, VALIDATION_MESSAGES.IDENTIFIER_SUFFIX.REQUIRED)
|
|
93
|
-
.max(50, VALIDATION_MESSAGES.IDENTIFIER_SUFFIX.MAX_LENGTH)
|
|
94
|
-
.optional(),
|
|
95
|
-
availabilityZone: z.string().optional(),
|
|
96
|
-
})
|
|
97
|
-
.strict()
|
|
98
|
-
.describe("Configuration for a single Aurora reader instance");
|
|
99
|
-
export const AuroraWriterConfigSchema = z
|
|
100
|
-
.object({
|
|
101
|
-
enableDatabaseInsights: z.boolean().optional(),
|
|
102
|
-
identifierSuffix: z
|
|
103
|
-
.string()
|
|
104
|
-
.min(1, VALIDATION_MESSAGES.IDENTIFIER_SUFFIX.REQUIRED)
|
|
105
|
-
.max(50, VALIDATION_MESSAGES.IDENTIFIER_SUFFIX.MAX_LENGTH)
|
|
106
|
-
.optional(),
|
|
107
|
-
availabilityZone: z.string().optional(),
|
|
108
|
-
})
|
|
109
|
-
.strict()
|
|
110
|
-
.describe("Configuration for Aurora writer instance");
|
|
111
|
-
export const AuroraReadersConfigSchema = z
|
|
112
|
-
.object({
|
|
113
|
-
count: z
|
|
114
|
-
.number()
|
|
115
|
-
.int(VALIDATION_MESSAGES.READER.COUNT.INTEGER)
|
|
116
|
-
.min(0, VALIDATION_MESSAGES.READER.COUNT.MIN)
|
|
117
|
-
.max(15, VALIDATION_MESSAGES.READER.COUNT.MAX)
|
|
118
|
-
.optional(),
|
|
119
|
-
instances: z
|
|
120
|
-
.array(AuroraReaderConfigSchema)
|
|
121
|
-
.max(15, VALIDATION_MESSAGES.READER_INSTANCES.MAX)
|
|
122
|
-
.optional(),
|
|
123
|
-
defaultEnableDatabaseInsights: z.boolean().optional(),
|
|
124
|
-
})
|
|
125
|
-
.strict()
|
|
126
|
-
.refine((data) => !(data.count !== undefined && data.instances !== undefined), {
|
|
127
|
-
message: VALIDATION_MESSAGES.READER_INSTANCES.COUNT_OR_INSTANCES,
|
|
128
|
-
path: ["count"],
|
|
129
|
-
})
|
|
130
|
-
.describe("Aurora readers configuration");
|
|
131
|
-
export const AuroraReadersConfigOrFalseSchema = optionalOrDisabled(AuroraReadersConfigSchema);
|
|
132
|
-
// ─── Encryption key specification ────────────────────────────────────────────
|
|
133
|
-
export const AwsManagedKeySchema = z
|
|
134
|
-
.object({
|
|
135
|
-
awsManaged: z.literal(true),
|
|
136
|
-
})
|
|
137
|
-
.strict();
|
|
138
|
-
export const CustomerManagedKeyMarkerSchema = z
|
|
139
|
-
.object({
|
|
140
|
-
useCMK: z.literal(true),
|
|
141
|
-
})
|
|
142
|
-
.strict();
|
|
143
|
-
export const EncryptionKeySpecSchema = z.union([
|
|
144
|
-
AwsManagedKeySchema,
|
|
145
|
-
CustomerManagedKeyMarkerSchema,
|
|
146
|
-
]);
|
|
147
|
-
export const DatabaseInsightsConfigSchema = z
|
|
148
|
-
.object({
|
|
149
|
-
mode: z.enum(["standard", "advanced"]).optional(),
|
|
150
|
-
encryptionKey: EncryptionKeySpecSchema.optional(),
|
|
151
|
-
})
|
|
152
|
-
.strict()
|
|
153
|
-
.describe("Database Insights configuration");
|
|
154
|
-
export const DatabaseInsightsConfigOrFalseSchema = optionalOrDisabled(DatabaseInsightsConfigSchema);
|
|
155
|
-
export const EncryptionConfigSchema = z
|
|
156
|
-
.object({
|
|
157
|
-
storageKey: EncryptionKeySpecSchema.optional(),
|
|
158
|
-
})
|
|
159
|
-
.strict()
|
|
160
|
-
.describe("Encryption configuration (DESTRUCTIVE to change storageKey)");
|
|
161
|
-
// ─── Database resource plan ──────────────────────────────────────────────────
|
|
162
|
-
export const DatabaseResourcePlanSchema = z
|
|
163
|
-
.object({
|
|
164
|
-
name: ResourceNameSchema,
|
|
165
|
-
type: DatabaseTypeSchema,
|
|
166
|
-
databaseName: z.string().min(1, VALIDATION_MESSAGES.REQUIRED.DATABASE_NAME),
|
|
167
|
-
// Instance-specific props (only apply when type is "Instance")
|
|
168
|
-
instanceType: z.string().optional(),
|
|
169
|
-
multiAz: z.boolean().optional(),
|
|
170
|
-
publiclyAccessible: z.boolean().optional(),
|
|
171
|
-
enableSecretRotation: z.boolean().optional(),
|
|
172
|
-
// Shared props (Instance and Aurora)
|
|
173
|
-
databaseInsights: DatabaseInsightsConfigOrFalseSchema.optional(),
|
|
174
|
-
port: DatabasePortSchema.optional(),
|
|
175
|
-
deletionProtection: z.boolean().optional(),
|
|
176
|
-
// Nested configurations (presence-based: object = enabled, false = disabled)
|
|
177
|
-
proxy: ProxyConfigOrFalseSchema.optional(),
|
|
178
|
-
credentials: CredentialsConfigSchema.optional(),
|
|
179
|
-
// Instance-specific nested config
|
|
180
|
-
readReplica: ReadReplicaConfigOrFalseSchema.optional(),
|
|
181
|
-
// Shared encryption config (Instance and Aurora)
|
|
182
|
-
encryption: EncryptionConfigSchema.optional(),
|
|
183
|
-
// Aurora/GlobalAurora-specific props
|
|
184
|
-
writer: AuroraWriterConfigSchema.optional(),
|
|
185
|
-
readers: AuroraReadersConfigOrFalseSchema.optional(),
|
|
186
|
-
// Shared operational props (Instance, Aurora, GlobalAurora)
|
|
187
|
-
backupRetention: BackupRetentionSchema.optional(),
|
|
188
|
-
preferredMaintenanceWindow: z.string().optional(),
|
|
189
|
-
monitoringInterval: MonitoringIntervalSchema.optional(),
|
|
190
|
-
// GlobalAurora-specific props
|
|
191
|
-
primaryRegion: z.string().optional(),
|
|
192
|
-
secondaryRegions: z.array(z.string()).optional(),
|
|
193
|
-
globalClusterIdentifier: z.string().optional(),
|
|
194
|
-
enableGlobalWriteForwarding: z.boolean().optional(),
|
|
195
|
-
// Shared restore/snapshot props
|
|
196
|
-
snapshotIdentifier: z.string().optional(),
|
|
197
|
-
snapshotUsername: z.string().optional(),
|
|
198
|
-
// Round-trip preservation fields (set by AST parser, used by generator)
|
|
199
|
-
databaseEngine: z.enum(["postgresql", "mysql"]).optional(),
|
|
200
|
-
engineExpression: z.string().optional(),
|
|
201
|
-
variableName: z.string().optional(),
|
|
202
|
-
extraProperties: z.array(ExtraPropertySchema).optional(),
|
|
203
|
-
})
|
|
204
|
-
.strict();
|
|
205
|
-
// ─── Database generator schemas ──────────────────────────────────────────────
|
|
206
|
-
// Common fields shared across all database types
|
|
207
|
-
const DatabaseGeneratorBaseSchema = z
|
|
208
|
-
.object({
|
|
209
|
-
appName: AppNameSchema,
|
|
210
|
-
nameProvidedByFlag: z.boolean().optional(),
|
|
211
|
-
databaseName: z
|
|
212
|
-
.string()
|
|
213
|
-
.min(1, VALIDATION_MESSAGES.REQUIRED.DATABASE_NAME)
|
|
214
|
-
.max(63, VALIDATION_MESSAGES.MAX_LENGTH.DATABASE_NAME)
|
|
215
|
-
.regex(VALIDATION_PATTERNS.DATABASE_NAME, VALIDATION_MESSAGES.DATABASE_NAME),
|
|
216
|
-
resourceName: ResourceNameSchema.optional(),
|
|
217
|
-
connectionConfig: z
|
|
218
|
-
.object({
|
|
219
|
-
/** Connect to entire compute resources (legacy, cluster-level) */
|
|
220
|
-
connectToCompute: z.array(z.string()).optional(),
|
|
221
|
-
/** Connect to specific ECS services (format: "ClusterName/ServiceName") */
|
|
222
|
-
connectToServices: z.array(z.string()).optional(),
|
|
223
|
-
})
|
|
224
|
-
.strict()
|
|
225
|
-
.optional(),
|
|
226
|
-
// Shared fields (all database types)
|
|
227
|
-
databaseInsights: DatabaseInsightsConfigOrFalseSchema.optional(),
|
|
228
|
-
port: DatabasePortSchema.optional(),
|
|
229
|
-
proxy: ProxyConfigOrFalseSchema.optional(),
|
|
230
|
-
credentials: CredentialsConfigSchema.optional(),
|
|
231
|
-
encryption: EncryptionConfigSchema.optional(),
|
|
232
|
-
deletionProtection: z.boolean().optional(),
|
|
233
|
-
})
|
|
234
|
-
.strict();
|
|
235
|
-
// Type-specific field definitions shared between CLI and UI schemas
|
|
236
|
-
const instanceSpecificFields = {
|
|
237
|
-
databaseType: z.literal("Instance"),
|
|
238
|
-
instanceType: z.string().optional(),
|
|
239
|
-
multiAz: z.boolean().optional(),
|
|
240
|
-
readReplica: ReadReplicaConfigOrFalseSchema.optional(),
|
|
241
|
-
publiclyAccessible: z.boolean().optional(),
|
|
242
|
-
backupRetention: BackupRetentionSchema.optional(),
|
|
243
|
-
allocatedStorage: z.number().optional(),
|
|
244
|
-
snapshotIdentifier: z.string().optional(),
|
|
245
|
-
snapshotUsername: z.string().optional(),
|
|
246
|
-
};
|
|
247
|
-
const auroraSpecificFields = {
|
|
248
|
-
databaseType: z.literal("Aurora"),
|
|
249
|
-
writer: AuroraWriterConfigSchema.optional(),
|
|
250
|
-
readers: AuroraReadersConfigOrFalseSchema.optional(),
|
|
251
|
-
backupRetention: BackupRetentionSchema.optional(),
|
|
252
|
-
preferredMaintenanceWindow: z.string().optional(),
|
|
253
|
-
monitoringInterval: MonitoringIntervalSchema.optional(),
|
|
254
|
-
snapshotIdentifier: z.string().optional(),
|
|
255
|
-
snapshotUsername: z.string().optional(),
|
|
256
|
-
};
|
|
257
|
-
const globalAuroraSpecificFields = {
|
|
258
|
-
databaseType: z.literal("GlobalAurora"),
|
|
259
|
-
primaryRegion: z
|
|
260
|
-
.string()
|
|
261
|
-
.min(1, VALIDATION_MESSAGES.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),
|
|
262
|
-
secondaryRegions: z.array(z.string()).optional(),
|
|
263
|
-
globalClusterIdentifier: z.string().optional(),
|
|
264
|
-
enableGlobalWriteForwarding: z.boolean().optional(),
|
|
265
|
-
writer: AuroraWriterConfigSchema.optional(),
|
|
266
|
-
readers: AuroraReadersConfigOrFalseSchema.optional(),
|
|
267
|
-
backupRetention: BackupRetentionSchema.optional(),
|
|
268
|
-
preferredMaintenanceWindow: z.string().optional(),
|
|
269
|
-
monitoringInterval: MonitoringIntervalSchema.optional(),
|
|
270
|
-
snapshotIdentifier: z.string().optional(),
|
|
271
|
-
snapshotUsername: z.string().optional(),
|
|
272
|
-
};
|
|
273
|
-
const InstanceDatabaseGeneratorSchema = DatabaseGeneratorBaseSchema.extend(instanceSpecificFields).strict();
|
|
274
|
-
const AuroraDatabaseGeneratorSchema = DatabaseGeneratorBaseSchema.extend(auroraSpecificFields).strict();
|
|
275
|
-
const GlobalAuroraDatabaseGeneratorSchema = DatabaseGeneratorBaseSchema.extend(globalAuroraSpecificFields).strict();
|
|
276
|
-
/**
|
|
277
|
-
* Database generator schema using discriminated union.
|
|
278
|
-
* This ensures type-specific fields are only allowed for the correct database type:
|
|
279
|
-
* - Instance: instanceType, multiAz, readReplica
|
|
280
|
-
* - Aurora: writer, readers, backupRetention
|
|
281
|
-
* - GlobalAurora: primaryRegion (required!), secondaryRegions, enableGlobalWriteForwarding
|
|
282
|
-
*/
|
|
283
|
-
export const DatabaseGeneratorSchema = z.discriminatedUnion("databaseType", [
|
|
284
|
-
InstanceDatabaseGeneratorSchema,
|
|
285
|
-
AuroraDatabaseGeneratorSchema,
|
|
286
|
-
GlobalAuroraDatabaseGeneratorSchema,
|
|
287
|
-
]);
|
|
288
|
-
// Base schema with required resourceName for UI
|
|
289
|
-
const DatabaseGeneratorBaseSchemaFromUI = DatabaseGeneratorBaseSchema.extend({
|
|
290
|
-
resourceName: ResourceNameSchema,
|
|
291
|
-
}).strict();
|
|
292
|
-
/**
|
|
293
|
-
* Stricter schema for UI-originated database creation.
|
|
294
|
-
* Requires resourceName to prevent silent failures where
|
|
295
|
-
* the generator falls back to a default name that may conflict.
|
|
296
|
-
*/
|
|
297
|
-
const InstanceDatabaseGeneratorSchemaFromUI = DatabaseGeneratorBaseSchemaFromUI.extend(instanceSpecificFields).strict();
|
|
298
|
-
const AuroraDatabaseGeneratorSchemaFromUI = DatabaseGeneratorBaseSchemaFromUI.extend(auroraSpecificFields).strict();
|
|
299
|
-
const GlobalAuroraDatabaseGeneratorSchemaFromUI = DatabaseGeneratorBaseSchemaFromUI.extend(globalAuroraSpecificFields).strict();
|
|
300
|
-
export const DatabaseGeneratorSchemaFromUI = z.discriminatedUnion("databaseType", [
|
|
301
|
-
InstanceDatabaseGeneratorSchemaFromUI,
|
|
302
|
-
AuroraDatabaseGeneratorSchemaFromUI,
|
|
303
|
-
GlobalAuroraDatabaseGeneratorSchemaFromUI,
|
|
304
|
-
]);
|
|
305
|
-
/**
|
|
306
|
-
* Schema for adding RDS Proxy to an existing database.
|
|
307
|
-
* Used by the `fjall add proxy` command.
|
|
308
|
-
*/
|
|
309
|
-
export const AddProxyGeneratorSchema = z
|
|
310
|
-
.object({
|
|
311
|
-
appName: AppNameSchema,
|
|
312
|
-
databaseName: z.string().min(1, VALIDATION_MESSAGES.REQUIRED.DATABASE_NAME),
|
|
313
|
-
maxConnections: z
|
|
314
|
-
.number()
|
|
315
|
-
.int(VALIDATION_MESSAGES.MAX_CONNECTIONS.INTEGER)
|
|
316
|
-
.min(1, VALIDATION_MESSAGES.MAX_CONNECTIONS.MIN)
|
|
317
|
-
.max(100, VALIDATION_MESSAGES.MAX_CONNECTIONS.MAX)
|
|
318
|
-
.optional(),
|
|
319
|
-
maxIdleConnections: z
|
|
320
|
-
.number()
|
|
321
|
-
.int(VALIDATION_MESSAGES.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER)
|
|
322
|
-
.min(0, VALIDATION_MESSAGES.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN)
|
|
323
|
-
.max(100, VALIDATION_MESSAGES.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX)
|
|
324
|
-
.optional(),
|
|
325
|
-
connectionBorrowTimeout: z
|
|
326
|
-
.number()
|
|
327
|
-
.int(VALIDATION_MESSAGES.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER)
|
|
328
|
-
.min(1, VALIDATION_MESSAGES.PROXY_CONFIG.BORROW_TIMEOUT.MIN)
|
|
329
|
-
.max(3600, VALIDATION_MESSAGES.PROXY_CONFIG.BORROW_TIMEOUT.MAX)
|
|
330
|
-
.optional(),
|
|
331
|
-
requireTLS: z.boolean().optional(),
|
|
332
|
-
nameProvidedByFlag: z.boolean().optional(),
|
|
333
|
-
})
|
|
334
|
-
.strict();
|
|
335
|
-
// ─── DynamoDB schemas ────────────────────────────────────────────────────────
|
|
336
|
-
const DYNAMODB_ATTRIBUTE_TYPES = ["S", "N", "B"];
|
|
337
|
-
const DynamoDBKeySchema = z
|
|
338
|
-
.object({
|
|
339
|
-
name: z.string(),
|
|
340
|
-
type: z.enum(DYNAMODB_ATTRIBUTE_TYPES),
|
|
341
|
-
})
|
|
342
|
-
.strict();
|
|
343
|
-
/**
|
|
344
|
-
* DynamoDB table resource plan schema (for OpenNext patterns)
|
|
345
|
-
*/
|
|
346
|
-
export const DynamoDBResourcePlanSchema = z
|
|
347
|
-
.object({
|
|
348
|
-
name: ResourceNameSchema,
|
|
349
|
-
partitionKey: DynamoDBKeySchema,
|
|
350
|
-
sortKey: DynamoDBKeySchema.optional(),
|
|
351
|
-
globalSecondaryIndexes: z
|
|
352
|
-
.array(z
|
|
353
|
-
.object({
|
|
354
|
-
indexName: z.string(),
|
|
355
|
-
partitionKey: DynamoDBKeySchema,
|
|
356
|
-
sortKey: DynamoDBKeySchema.optional(),
|
|
357
|
-
})
|
|
358
|
-
.strict())
|
|
359
|
-
.optional(),
|
|
360
|
-
ttlAttribute: z.string().optional(),
|
|
361
|
-
stream: z.boolean().optional(),
|
|
362
|
-
// Round-trip preservation
|
|
363
|
-
variableName: z.string().optional(),
|
|
364
|
-
extraProperties: z.array(ExtraPropertySchema).optional(),
|
|
365
|
-
})
|
|
366
|
-
.strict();
|
|
1
|
+
import{z as o}from"zod";import{VALIDATION_PATTERNS as _,VALIDATION_MESSAGES as t}from"../validation/patterns.js";import{DATABASE_TYPES as I,VALID_MONITORING_INTERVALS as x,constIncludes as D}from"./constants.js";import{optionalOrDisabled as a,ResourceNameSchema as n,AppNameSchema as E,ExtraPropertySchema as N}from"./baseSchemas.js";import{RdsAlarmConfigSchema as M}from"./alarmSchemas.js";const i=o.number().int(t.BACKUP_RETENTION.INTEGER).min(1,t.BACKUP_RETENTION.MIN).max(35,t.BACKUP_RETENTION.MAX),c=o.number().int(t.MONITORING_INTERVAL.INTEGER).refine(e=>D(x,e),{message:t.MONITORING_INTERVAL.VALUES}),b=o.number().int(t.DATABASE.PORT.INTEGER).min(1024,t.DATABASE.PORT.MIN).max(65535,t.DATABASE.PORT.MAX),y=o.enum(I).describe(`Database type must be one of: ${I.join(", ")}`),h=o.object({maxConnections:o.number().int(t.MAX_CONNECTIONS.INTEGER).min(1,t.MAX_CONNECTIONS.MIN).max(100,t.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:o.number().int(t.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,t.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,t.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:o.number().int(t.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,t.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,t.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:o.boolean().optional()}).strict().describe("RDS Proxy configuration"),f=o.object({instanceType:o.string().optional(),availabilityZone:o.string().optional()}).strict().describe("Read replica configuration"),G=o.object({automaticallyAfterDays:o.number().int(t.ROTATION.INTEGER).min(1,t.ROTATION.MIN).max(365,t.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),A=o.object({username:o.string().min(1,t.REQUIRED.USERNAME).max(63,t.USERNAME.MAX_LENGTH).optional(),secretRotation:G.optional()}).strict().describe("Database credentials configuration"),R=a(h),T=a(f),X=o.object({scaleWithWriter:o.boolean().optional(),enableDatabaseInsights:o.boolean().optional(),identifierSuffix:o.string().min(1,t.IDENTIFIER_SUFFIX.REQUIRED).max(50,t.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:o.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),l=o.object({enableDatabaseInsights:o.boolean().optional(),identifierSuffix:o.string().min(1,t.IDENTIFIER_SUFFIX.REQUIRED).max(50,t.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:o.string().optional()}).strict().describe("Configuration for Aurora writer instance"),U=o.object({count:o.number().int(t.READER.COUNT.INTEGER).min(0,t.READER.COUNT.MIN).max(15,t.READER.COUNT.MAX).optional(),instances:o.array(X).max(15,t.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:o.boolean().optional()}).strict().refine(e=>!(e.count!==void 0&&e.instances!==void 0),{message:t.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),p=a(U),F=o.object({awsManaged:o.literal(!0)}).strict(),P=o.object({useCMK:o.literal(!0)}).strict(),d=o.union([F,P]),B=o.object({mode:o.enum(["standard","advanced"]).optional(),encryptionKey:d.optional()}).strict().describe("Database Insights configuration"),g=a(B),O=o.object({storageKey:d.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),z=o.object({name:n,type:y,databaseName:o.string().min(1,t.REQUIRED.DATABASE_NAME),instanceType:o.string().optional(),allocatedStorage:o.number().optional(),multiAz:o.boolean().optional(),publiclyAccessible:o.boolean().optional(),databaseInsights:g.optional(),port:b.optional(),deletionProtection:o.boolean().optional(),proxy:R.optional(),credentials:A.optional(),readReplica:T.optional(),encryption:O.optional(),writer:l.optional(),readers:p.optional(),backupRetention:i.optional(),preferredMaintenanceWindow:o.string().optional(),monitoringInterval:c.optional(),primaryRegion:o.string().optional(),secondaryRegions:o.array(o.string()).optional(),globalClusterIdentifier:o.string().optional(),enableGlobalWriteForwarding:o.boolean().optional(),snapshotIdentifier:o.string().optional(),snapshotUsername:o.string().optional(),databaseEngine:o.enum(["postgresql","mysql"]).optional(),engineExpression:o.string().optional(),variableName:o.string().optional(),extraProperties:o.array(N).optional(),alarms:M.optional()}).strict(),r=o.object({appName:E,nameProvidedByFlag:o.boolean().optional(),databaseName:o.string().min(1,t.REQUIRED.DATABASE_NAME).max(63,t.MAX_LENGTH.DATABASE_NAME).regex(_.DATABASE_NAME,t.DATABASE_NAME),resourceName:n.optional(),connectionConfig:o.object({connectToCompute:o.array(o.string()).optional(),connectToServices:o.array(o.string()).optional()}).strict().optional(),databaseInsights:g.optional(),port:b.optional(),proxy:R.optional(),credentials:A.optional(),encryption:O.optional(),deletionProtection:o.boolean().optional()}).strict(),S={databaseType:o.literal("Instance"),instanceType:o.string().optional(),multiAz:o.boolean().optional(),readReplica:T.optional(),publiclyAccessible:o.boolean().optional(),backupRetention:i.optional(),allocatedStorage:o.number().optional(),snapshotIdentifier:o.string().optional(),snapshotUsername:o.string().optional()},u={databaseType:o.literal("Aurora"),writer:l.optional(),readers:p.optional(),backupRetention:i.optional(),preferredMaintenanceWindow:o.string().optional(),monitoringInterval:c.optional(),snapshotIdentifier:o.string().optional(),snapshotUsername:o.string().optional()},C={databaseType:o.literal("GlobalAurora"),primaryRegion:o.string().min(1,t.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:o.array(o.string()).optional(),globalClusterIdentifier:o.string().optional(),enableGlobalWriteForwarding:o.boolean().optional(),writer:l.optional(),readers:p.optional(),backupRetention:i.optional(),preferredMaintenanceWindow:o.string().optional(),monitoringInterval:c.optional(),snapshotIdentifier:o.string().optional(),snapshotUsername:o.string().optional()},L=r.extend(S).strict(),j=r.extend(u).strict(),Y=r.extend(C).strict(),Z=o.discriminatedUnion("databaseType",[L,j,Y]),m=r.extend({resourceName:n}).strict(),K=m.extend(S).strict(),W=m.extend(u).strict(),v=m.extend(C).strict(),$=o.discriminatedUnion("databaseType",[K,W,v]),J=o.object({appName:E,databaseName:o.string().min(1,t.REQUIRED.DATABASE_NAME),maxConnections:o.number().int(t.MAX_CONNECTIONS.INTEGER).min(1,t.MAX_CONNECTIONS.MIN).max(100,t.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:o.number().int(t.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,t.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,t.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:o.number().int(t.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,t.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,t.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:o.boolean().optional(),nameProvidedByFlag:o.boolean().optional()}).strict(),w=["S","N","B"],s=o.object({name:o.string(),type:o.enum(w)}).strict(),oo=o.object({name:n,partitionKey:s,sortKey:s.optional(),globalSecondaryIndexes:o.array(o.object({indexName:o.string(),partitionKey:s,sortKey:s.optional()}).strict()).optional(),ttlAttribute:o.string().optional(),stream:o.boolean().optional(),variableName:o.string().optional(),extraProperties:o.array(N).optional()}).strict();export{J as AddProxyGeneratorSchema,X as AuroraReaderConfigSchema,p as AuroraReadersConfigOrFalseSchema,U as AuroraReadersConfigSchema,l as AuroraWriterConfigSchema,F as AwsManagedKeySchema,i as BackupRetentionSchema,A as CredentialsConfigSchema,P as CustomerManagedKeyMarkerSchema,Z as DatabaseGeneratorSchema,$ as DatabaseGeneratorSchemaFromUI,g as DatabaseInsightsConfigOrFalseSchema,B as DatabaseInsightsConfigSchema,b as DatabasePortSchema,z as DatabaseResourcePlanSchema,y as DatabaseTypeSchema,oo as DynamoDBResourcePlanSchema,O as EncryptionConfigSchema,d as EncryptionKeySpecSchema,c as MonitoringIntervalSchema,R as ProxyConfigOrFalseSchema,h as ProxyConfigSchema,T as ReadReplicaConfigOrFalseSchema,f as ReadReplicaConfigSchema,G as SecretRotationConfigSchema};
|