@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.
Files changed (168) hide show
  1. package/LICENSE +50 -21
  2. package/README.md +28 -0
  3. package/dist/.minified +1 -0
  4. package/dist/src/ast/astCdnParser.d.ts +5 -0
  5. package/dist/src/ast/astCdnParser.js +1 -114
  6. package/dist/src/ast/astCommonParser.d.ts +6 -17
  7. package/dist/src/ast/astCommonParser.js +1 -351
  8. package/dist/src/ast/astComputeConnectionParser.d.ts +18 -0
  9. package/dist/src/ast/astComputeConnectionParser.js +1 -0
  10. package/dist/src/ast/astComputeParser.d.ts +6 -0
  11. package/dist/src/ast/astComputeParser.js +1 -473
  12. package/dist/src/ast/astComputeParserHelpers.d.ts +21 -0
  13. package/dist/src/ast/astComputeParserHelpers.js +1 -0
  14. package/dist/src/ast/astDatabaseParser.d.ts +9 -24
  15. package/dist/src/ast/astDatabaseParser.js +1 -275
  16. package/dist/src/ast/astDomainParser.d.ts +139 -0
  17. package/dist/src/ast/astDomainParser.js +1 -0
  18. package/dist/src/ast/astDynamoDBParser.d.ts +35 -0
  19. package/dist/src/ast/astDynamoDBParser.js +1 -0
  20. package/dist/src/ast/astExpressionEvaluator.d.ts +23 -0
  21. package/dist/src/ast/astExpressionEvaluator.js +1 -0
  22. package/dist/src/ast/astInfrastructureParser.d.ts +12 -49
  23. package/dist/src/ast/astInfrastructureParser.js +1 -552
  24. package/dist/src/ast/astMessagingParser.d.ts +5 -0
  25. package/dist/src/ast/astMessagingParser.js +1 -78
  26. package/dist/src/ast/astNetworkParser.d.ts +6 -0
  27. package/dist/src/ast/astNetworkParser.js +1 -219
  28. package/dist/src/ast/astPatternParser.d.ts +6 -0
  29. package/dist/src/ast/astPatternParser.js +1 -155
  30. package/dist/src/ast/astPlanConverter.d.ts +11 -0
  31. package/dist/src/ast/astPlanConverter.js +2 -0
  32. package/dist/src/ast/astStatementClassifier.d.ts +24 -0
  33. package/dist/src/ast/astStatementClassifier.js +1 -0
  34. package/dist/src/ast/astStatementQueries.d.ts +21 -0
  35. package/dist/src/ast/astStatementQueries.js +3 -0
  36. package/dist/src/ast/astStorageParser.d.ts +5 -0
  37. package/dist/src/ast/astStorageParser.js +1 -164
  38. package/dist/src/ast/astSurgicalModification.js +19 -400
  39. package/dist/src/ast/astTestHelpers.d.ts +635 -0
  40. package/dist/src/ast/astTestHelpers.js +1 -0
  41. package/dist/src/ast/index.d.ts +1 -0
  42. package/dist/src/ast/index.js +1 -6
  43. package/dist/src/aws/regions.js +1 -254
  44. package/dist/src/codemod/_internal.d.ts +12 -0
  45. package/dist/src/codemod/_internal.js +1 -0
  46. package/dist/src/codemod/edits/addResource/bodyIndex.d.ts +34 -0
  47. package/dist/src/codemod/edits/addResource/bodyIndex.js +1 -0
  48. package/dist/src/codemod/edits/addResource/propertyBuilder.d.ts +7 -0
  49. package/dist/src/codemod/edits/addResource/propertyBuilder.js +1 -0
  50. package/dist/src/codemod/edits/addResource.d.ts +9 -0
  51. package/dist/src/codemod/edits/addResource.js +1 -0
  52. package/dist/src/codemod/edits/ensureImports.d.ts +26 -0
  53. package/dist/src/codemod/edits/ensureImports.js +1 -0
  54. package/dist/src/codemod/edits/findInsertionPosition.d.ts +39 -0
  55. package/dist/src/codemod/edits/findInsertionPosition.js +1 -0
  56. package/dist/src/codemod/edits/index.d.ts +6 -0
  57. package/dist/src/codemod/edits/index.js +1 -0
  58. package/dist/src/codemod/edits/modifyResource/literalConversion.d.ts +37 -0
  59. package/dist/src/codemod/edits/modifyResource/literalConversion.js +1 -0
  60. package/dist/src/codemod/edits/modifyResource.d.ts +9 -0
  61. package/dist/src/codemod/edits/modifyResource.js +1 -0
  62. package/dist/src/codemod/edits/removeResource/commentHeuristic.d.ts +31 -0
  63. package/dist/src/codemod/edits/removeResource/commentHeuristic.js +1 -0
  64. package/dist/src/codemod/edits/removeResource/importPruning.d.ts +8 -0
  65. package/dist/src/codemod/edits/removeResource/importPruning.js +1 -0
  66. package/dist/src/codemod/edits/removeResource.d.ts +10 -0
  67. package/dist/src/codemod/edits/removeResource.js +1 -0
  68. package/dist/src/codemod/edits/schemaFragments.d.ts +9 -0
  69. package/dist/src/codemod/edits/schemaFragments.js +1 -0
  70. package/dist/src/codemod/fileRewriter/builders.d.ts +57 -0
  71. package/dist/src/codemod/fileRewriter/builders.js +1 -0
  72. package/dist/src/codemod/fileRewriter/index.d.ts +4 -0
  73. package/dist/src/codemod/fileRewriter/index.js +1 -0
  74. package/dist/src/codemod/fileRewriter/locateByRange.d.ts +65 -0
  75. package/dist/src/codemod/fileRewriter/locateByRange.js +1 -0
  76. package/dist/src/codemod/fileRewriter/parse.d.ts +18 -0
  77. package/dist/src/codemod/fileRewriter/parse.js +2 -0
  78. package/dist/src/codemod/fileRewriter/print.d.ts +46 -0
  79. package/dist/src/codemod/fileRewriter/print.js +4 -0
  80. package/dist/src/codemod/historyPaths.d.ts +2 -0
  81. package/dist/src/codemod/historyPaths.js +1 -0
  82. package/dist/src/codemod/index.d.ts +7 -0
  83. package/dist/src/codemod/index.js +1 -0
  84. package/dist/src/codemod/listResources.d.ts +4 -0
  85. package/dist/src/codemod/listResources.js +1 -0
  86. package/dist/src/codemod/semanticIndex/findReferences.d.ts +15 -0
  87. package/dist/src/codemod/semanticIndex/findReferences.js +2 -0
  88. package/dist/src/codemod/semanticIndex/index.d.ts +4 -0
  89. package/dist/src/codemod/semanticIndex/index.js +1 -0
  90. package/dist/src/codemod/semanticIndex/listImports.d.ts +24 -0
  91. package/dist/src/codemod/semanticIndex/listImports.js +1 -0
  92. package/dist/src/codemod/semanticIndex/locateByShape.d.ts +28 -0
  93. package/dist/src/codemod/semanticIndex/locateByShape.js +1 -0
  94. package/dist/src/codemod/semanticIndex/projectCache.d.ts +14 -0
  95. package/dist/src/codemod/semanticIndex/projectCache.js +1 -0
  96. package/dist/src/codemod/types.d.ts +172 -0
  97. package/dist/src/codemod/types.js +1 -0
  98. package/dist/src/dns/bindParser.js +2 -224
  99. package/dist/src/dns/bindWriter.js +3 -52
  100. package/dist/src/dns/domainFileGenerator.d.ts +20 -0
  101. package/dist/src/dns/domainFileGenerator.js +207 -0
  102. package/dist/src/dns/domainRecords.d.ts +164 -0
  103. package/dist/src/dns/domainRecords.js +1 -0
  104. package/dist/src/dns/index.d.ts +2 -1
  105. package/dist/src/dns/index.js +1 -4
  106. package/dist/src/dns/types.js +1 -52
  107. package/dist/src/generation/common.js +6 -161
  108. package/dist/src/generation/compute.js +82 -590
  109. package/dist/src/generation/database.js +12 -198
  110. package/dist/src/generation/generatePatternCode.d.ts +58 -0
  111. package/dist/src/generation/generatePatternCode.js +33 -0
  112. package/dist/src/generation/index.js +1 -20
  113. package/dist/src/generation/infrastructure.d.ts +1 -5
  114. package/dist/src/generation/infrastructure.js +35 -377
  115. package/dist/src/generation/messagingConnections.js +1 -73
  116. package/dist/src/generation/storage.d.ts +0 -15
  117. package/dist/src/generation/storage.js +35 -168
  118. package/dist/src/generation/storageConnections.js +1 -75
  119. package/dist/src/planning/generateResourceChange.d.ts +21 -0
  120. package/dist/src/planning/generateResourceChange.js +1 -0
  121. package/dist/src/planning/index.d.ts +3 -0
  122. package/dist/src/planning/index.js +1 -1
  123. package/dist/src/planning/resourceAddition.d.ts +154 -0
  124. package/dist/src/planning/resourceAddition.js +1 -0
  125. package/dist/src/planning/resourceConnections.d.ts +19 -0
  126. package/dist/src/planning/resourceConnections.js +1 -0
  127. package/dist/src/planning/resourcePlanning.js +1 -214
  128. package/dist/src/presets/index.js +1 -3
  129. package/dist/src/presets/patternTierPresets.js +1 -131
  130. package/dist/src/presets/storagePresets.js +1 -36
  131. package/dist/src/presets/tierPresets.d.ts +5 -8
  132. package/dist/src/presets/tierPresets.js +1 -384
  133. package/dist/src/presets/tierTypes.d.ts +1 -1
  134. package/dist/src/presets/tierTypes.js +0 -7
  135. package/dist/src/schemas/alarmSchemas.d.ts +19 -0
  136. package/dist/src/schemas/alarmSchemas.js +1 -0
  137. package/dist/src/schemas/applicationSchemas.d.ts +22 -6
  138. package/dist/src/schemas/applicationSchemas.js +1 -80
  139. package/dist/src/schemas/baseSchemas.d.ts +8 -3
  140. package/dist/src/schemas/baseSchemas.js +2 -248
  141. package/dist/src/schemas/cdnSchemas.js +1 -62
  142. package/dist/src/schemas/computeSchemas.d.ts +25 -3
  143. package/dist/src/schemas/computeSchemas.js +1 -727
  144. package/dist/src/schemas/constants.d.ts +5 -7
  145. package/dist/src/schemas/constants.js +1 -218
  146. package/dist/src/schemas/databaseSchemas.d.ts +6 -1
  147. package/dist/src/schemas/databaseSchemas.js +1 -366
  148. package/dist/src/schemas/index.js +1 -3
  149. package/dist/src/schemas/instanceTypeArchitecture.js +1 -75
  150. package/dist/src/schemas/messagingSchemas.js +1 -29
  151. package/dist/src/schemas/networkSchemas.js +1 -125
  152. package/dist/src/schemas/patternSchemas.d.ts +1 -1
  153. package/dist/src/schemas/patternSchemas.js +1 -294
  154. package/dist/src/schemas/resourceSchemas.d.ts +1 -0
  155. package/dist/src/schemas/resourceSchemas.js +1 -28
  156. package/dist/src/schemas/sharedTypes.d.ts +18 -0
  157. package/dist/src/schemas/sharedTypes.js +1 -0
  158. package/dist/src/schemas/storageSchemas.d.ts +1 -0
  159. package/dist/src/schemas/storageSchemas.js +1 -119
  160. package/dist/src/types/Result.js +1 -31
  161. package/dist/src/util/errorUtils.js +1 -1
  162. package/dist/src/validation/patterns.d.ts +9 -0
  163. package/dist/src/validation/patterns.js +1 -369
  164. package/dist/src/version.d.ts +1 -1
  165. package/dist/src/version.js +1 -1
  166. package/package.json +29 -9
  167. package/dist/src/dns/infrastructureWriter.d.ts +0 -2
  168. package/dist/src/dns/infrastructureWriter.js +0 -58
@@ -1,119 +1 @@
1
- import { z } from "zod";
2
- import { VALIDATION_MESSAGES } from "../validation/patterns.js";
3
- import { BACKUP_VAULT_TIERS, S3_ENCRYPTION_TYPES, STORAGE_PRESET_TYPES, } from "./constants.js";
4
- import { ResourceNameSchema, BucketNameSchema, AppNameSchema, ExtraPropertySchema, } from "./baseSchemas.js";
5
- // ─── S3 resource plan ────────────────────────────────────────────────────────
6
- /**
7
- * Stack placement options for S3 buckets.
8
- * - "storage" (default): Created via app.addStorage() in Storage stack
9
- * - "cdn": Created in CDN stack for CloudFront-consumed buckets (avoids circular dependencies)
10
- * - "compute": Created in Compute stack for Lambda-consumed buckets
11
- */
12
- export const S3_STACK_PLACEMENTS = ["storage", "cdn", "compute"];
13
- export const S3ResourcePlanSchema = z
14
- .object({
15
- name: ResourceNameSchema,
16
- // Explicit S3 bucket name (user-provided, kebab-case)
17
- bucketName: z.string().optional(),
18
- // Access control (replaces bucketType)
19
- publicReadAccess: z.boolean().optional(),
20
- // Website hosting (presence-based)
21
- websiteHosting: z
22
- .object({
23
- indexDocument: z.string(),
24
- errorDocument: z.string().optional(),
25
- })
26
- .strict()
27
- .optional(),
28
- // Core
29
- backupVaultTier: z.enum(BACKUP_VAULT_TIERS).optional(),
30
- versioned: z.boolean().optional(),
31
- encryption: z.enum(S3_ENCRYPTION_TYPES).optional(),
32
- kmsKeyArn: z.string().optional(),
33
- // CORS (any bucket)
34
- cors: z
35
- .array(z
36
- .object({
37
- allowedOrigins: z.array(z.string()),
38
- allowedMethods: z.array(z.string()),
39
- allowedHeaders: z.array(z.string()).optional(),
40
- exposedHeaders: z.array(z.string()).optional(),
41
- maxAge: z.number().optional(),
42
- })
43
- .strict())
44
- .optional(),
45
- // Deployment (any bucket)
46
- deployment: z
47
- .object({
48
- source: z.string(),
49
- prune: z.boolean().optional(),
50
- cacheControl: z
51
- .object({
52
- maxAge: z.number().optional(),
53
- immutable: z.boolean().optional(),
54
- })
55
- .strict()
56
- .optional(),
57
- })
58
- .strict()
59
- .optional(),
60
- // Stack placement
61
- stackPlacement: z.enum(S3_STACK_PLACEMENTS).optional(),
62
- // Round-trip preservation
63
- variableName: z.string().optional(),
64
- extraProperties: z.array(ExtraPropertySchema).optional(),
65
- })
66
- .strict()
67
- .refine((data) => data.encryption !== "KMS" || !!data.kmsKeyArn, {
68
- message: VALIDATION_MESSAGES.KMS.KEY_REQUIRED,
69
- });
70
- // ─── S3 generator schema ────────────────────────────────────────────────────
71
- export const S3GeneratorSchema = z
72
- .object({
73
- appName: AppNameSchema,
74
- bucketName: BucketNameSchema,
75
- nameProvidedByFlag: z.boolean().optional(),
76
- // Preset (generator-only -- resolved to params before plan creation)
77
- storagePreset: z.enum(STORAGE_PRESET_TYPES).optional(),
78
- // Explicit overrides
79
- publicReadAccess: z.boolean().optional(),
80
- websiteHosting: z
81
- .object({
82
- indexDocument: z.string(),
83
- errorDocument: z.string().optional(),
84
- })
85
- .strict()
86
- .optional(),
87
- // Core
88
- backupVaultTier: z.enum(BACKUP_VAULT_TIERS).optional(),
89
- versioned: z.boolean().optional(),
90
- encryption: z.enum(S3_ENCRYPTION_TYPES).optional(),
91
- kmsKeyArn: z.string().optional(),
92
- // CORS
93
- cors: z
94
- .array(z
95
- .object({
96
- allowedOrigins: z.array(z.string()),
97
- allowedMethods: z.array(z.string()),
98
- allowedHeaders: z.array(z.string()).optional(),
99
- exposedHeaders: z.array(z.string()).optional(),
100
- maxAge: z.number().optional(),
101
- })
102
- .strict())
103
- .optional(),
104
- // Connection config (non-interactive mode)
105
- connectionConfig: z
106
- .object({
107
- /** Connect to entire compute resources */
108
- connectToCompute: z.array(z.string()).optional(),
109
- /** Connect to specific ECS services (format: "ClusterName/ServiceName") */
110
- connectToServices: z.array(z.string()).optional(),
111
- })
112
- .strict()
113
- .optional(),
114
- })
115
- .strict()
116
- .refine((data) => data.encryption !== "KMS" || !!data.kmsKeyArn, {
117
- message: VALIDATION_MESSAGES.KMS.KEY_REQUIRED,
118
- path: ["kmsKeyArn"],
119
- });
1
+ import{z as o}from"zod";import{VALIDATION_MESSAGES as t}from"../validation/patterns.js";import{BACKUP_VAULT_TIERS as n,S3_ENCRYPTION_TYPES as a,STORAGE_PRESET_TYPES as r}from"./constants.js";import{ResourceNameSchema as i,BucketNameSchema as s,AppNameSchema as l,ExtraPropertySchema as p}from"./baseSchemas.js";const c=["storage","cdn","compute"],y=o.object({name:i,bucketName:o.string().optional(),publicReadAccess:o.boolean().optional(),websiteHosting:o.object({indexDocument:o.string(),errorDocument:o.string().optional()}).strict().optional(),backupVaultTier:o.enum(n).optional(),versioned:o.boolean().optional(),encryption:o.enum(a).optional(),kmsKeyArn:o.string().optional(),cors:o.array(o.object({allowedOrigins:o.array(o.string()),allowedMethods:o.array(o.string()),allowedHeaders:o.array(o.string()).optional(),exposedHeaders:o.array(o.string()).optional(),maxAge:o.number().optional()}).strict()).optional(),deployment:o.object({source:o.string(),prune:o.boolean().optional(),cacheControl:o.object({maxAge:o.number().optional(),immutable:o.boolean().optional()}).strict().optional()}).strict().optional(),retain:o.boolean().optional(),stackPlacement:o.enum(c).optional(),variableName:o.string().optional(),extraProperties:o.array(p).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:t.KMS.KEY_REQUIRED}),S=o.object({appName:l,bucketName:s,nameProvidedByFlag:o.boolean().optional(),storagePreset:o.enum(r).optional(),publicReadAccess:o.boolean().optional(),websiteHosting:o.object({indexDocument:o.string(),errorDocument:o.string().optional()}).strict().optional(),backupVaultTier:o.enum(n).optional(),versioned:o.boolean().optional(),encryption:o.enum(a).optional(),kmsKeyArn:o.string().optional(),cors:o.array(o.object({allowedOrigins:o.array(o.string()),allowedMethods:o.array(o.string()),allowedHeaders:o.array(o.string()).optional(),exposedHeaders:o.array(o.string()).optional(),maxAge:o.number().optional()}).strict()).optional(),connectionConfig:o.object({connectToCompute:o.array(o.string()).optional(),connectToServices:o.array(o.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:t.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});export{S as S3GeneratorSchema,y as S3ResourcePlanSchema,c as S3_STACK_PLACEMENTS};
@@ -1,31 +1 @@
1
- import { normaliseError } from "../util/errorUtils.js";
2
- export function isSuccess(result) {
3
- return result.success === true;
4
- }
5
- export function isFailure(result) {
6
- return result.success === false;
7
- }
8
- export function success(data) {
9
- return { success: true, data };
10
- }
11
- export function failure(error) {
12
- return { success: false, error };
13
- }
14
- export async function tryAsync(fn) {
15
- try {
16
- const data = await fn();
17
- return success(data);
18
- }
19
- catch (error) {
20
- return failure(normaliseError(error));
21
- }
22
- }
23
- export function trySync(fn) {
24
- try {
25
- const data = fn();
26
- return success(data);
27
- }
28
- catch (error) {
29
- return failure(normaliseError(error));
30
- }
31
- }
1
+ import{normaliseError as e}from"../util/errorUtils.js";function u(r){return r.success===!0}function o(r){return r.success===!1}function c(r){return{success:!0,data:r}}function n(r){return{success:!1,error:r}}async function a(r){try{const t=await r();return c(t)}catch(t){return n(e(t))}}function i(r){try{const t=r();return c(t)}catch(t){return n(e(t))}}export{n as failure,o as isFailure,u as isSuccess,c as success,a as tryAsync,i as trySync};
@@ -1 +1 @@
1
- export { normaliseError, getErrorMessage, hasErrorCode, getErrorCode, getErrorStack, formatErrorString, } from "@fjall/util";
1
+ import{normaliseError as e,getErrorMessage as t,hasErrorCode as E,getErrorCode as a,getErrorStack as g,formatErrorString as s}from"@fjall/util";export{s as formatErrorString,a as getErrorCode,t as getErrorMessage,g as getErrorStack,E as hasErrorCode,e as normaliseError};
@@ -303,6 +303,15 @@ export declare const VALIDATION_MESSAGES: Readonly<{
303
303
  readonly MAX: "Max receive count cannot exceed 1000";
304
304
  };
305
305
  };
306
+ readonly ALARM: {
307
+ readonly PERCENTAGE: {
308
+ readonly MIN: "Threshold must be at least 1%";
309
+ readonly MAX: "Threshold must be at most 100%";
310
+ };
311
+ readonly FREE_STORAGE_GIB: {
312
+ readonly MIN: "Free storage threshold must be at least 1 GiB";
313
+ };
314
+ };
306
315
  readonly REGION: "Invalid AWS region";
307
316
  }>;
308
317
  export type ValidationPatternKey = keyof typeof VALIDATION_PATTERNS;
@@ -1,369 +1 @@
1
- export const VALIDATION_PATTERNS = Object.freeze({
2
- // User-facing identifiers: app names, org names, service names, cluster names
3
- IDENTIFIER: /^[a-zA-Z][a-zA-Z0-9-]*$/,
4
- // CDK construct names: database, storage, network resource labels
5
- RESOURCE_NAME: /^[a-zA-Z][a-zA-Z0-9]*$/,
6
- // ECS service names: allow hyphens for kebab-case service identifiers
7
- ECS_SERVICE_NAME: /^[a-zA-Z][a-zA-Z0-9-]*$/,
8
- // AWS-native patterns
9
- BUCKET_NAME: /^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,
10
- DATABASE_NAME: /^[a-zA-Z][a-zA-Z0-9_]*$/,
11
- // Resource type patterns
12
- RESOURCE_TYPE: /^[a-z]+(:[a-z]+)?$/,
13
- // Path patterns
14
- SSM_PATH: /^\/[a-zA-Z][a-zA-Z0-9-]*(\/[a-zA-Z][a-zA-Z0-9-]*)*$/,
15
- // Secrets patterns (matches SSM Parameter Store allowed characters)
16
- SECRET_NAME: /^[a-zA-Z_][a-zA-Z0-9._-]*$/,
17
- // SSM namespace component pattern (more permissive for CDK-generated names)
18
- SSM_COMPONENT: /^[a-zA-Z][a-zA-Z0-9._-]*$/,
19
- // Email pattern (basic validation)
20
- EMAIL: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
21
- // Docker image pattern
22
- DOCKER_IMAGE: /^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,
23
- // Domain pattern (e.g., cms.example.com)
24
- DOMAIN: /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,
25
- });
26
- export const VALIDATION_MESSAGES = Object.freeze({
27
- // User-facing identifier (app, org, service, cluster names)
28
- IDENTIFIER: "Must start with a letter, contain only letters, numbers, and hyphens",
29
- IDENTIFIER_MIN_LENGTH: "Must be at least 2 characters",
30
- IDENTIFIER_NO_TRAILING_HYPHEN: "Must not end with a hyphen",
31
- IDENTIFIER_NO_CONSECUTIVE_HYPHENS: "Must not contain consecutive hyphens",
32
- // CDK construct names
33
- RESOURCE_NAME: "Must start with a letter and contain only letters and numbers (PascalCase recommended)",
34
- // ECS service names
35
- ECS_SERVICE_NAME: "Service name must start with a letter and contain only letters, numbers, and hyphens",
36
- // AWS-native
37
- BUCKET_NAME: "Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",
38
- DATABASE_NAME: "Database name must start with a letter and contain only letters, numbers, and underscores",
39
- // Resource type messages
40
- RESOURCE_TYPE: "Resource type must be in format 'category' or 'category:type'",
41
- // Path messages
42
- SSM_PATH: "SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",
43
- // Secrets messages
44
- SECRET_NAME: "Secret name must start with a letter or underscore and contain only letters, numbers, underscores, hyphens, or periods",
45
- // SSM component messages
46
- SSM_COMPONENT: "Must start with a letter and contain only letters, numbers, periods, hyphens, or underscores",
47
- // Email messages
48
- EMAIL: "Please enter a valid email address",
49
- // Domain messages
50
- DOMAIN: "Please enter a valid domain (e.g., cms.example.com)",
51
- // Docker messages
52
- DOCKER_IMAGE: "Invalid Docker image name format",
53
- // Required field messages
54
- REQUIRED: {
55
- APP_NAME: "Application name is required",
56
- RESOURCE_NAME: "Resource name is required",
57
- BUCKET_NAME: "Bucket name is required",
58
- SERVICE_NAME: "Service name is required",
59
- NETWORK_NAME: "Network name is required",
60
- DATABASE_NAME: "Database name is required",
61
- ORGANISATION_NAME: "Organisation name is required",
62
- EMAIL: "Email is required",
63
- NAME: "Name is required",
64
- USERNAME: "Username is required",
65
- CONTAINER_NAME: "Container name is required",
66
- FIRST_NAME: "First name is required",
67
- LAST_NAME: "Last name is required",
68
- GROUP: "Group is required",
69
- PATTERN_NAME: "Pattern name is required",
70
- ROUTING_PATH: "Routing path is required",
71
- RESOURCE_TYPE: "Resource type is required",
72
- VARIANT: "Variant is required",
73
- SUBTYPE: "Subtype is required",
74
- DEPLOY_TARGET: "Deploy target is required",
75
- DESTROY_TARGET: "Destroy target is required",
76
- },
77
- // Length constraint messages
78
- MAX_LENGTH: {
79
- APP_NAME: "Application name must be 50 characters or less",
80
- RESOURCE_NAME: "Resource name must be 63 characters or less",
81
- BUCKET_NAME: "Bucket name must be 63 characters or less",
82
- SERVICE_NAME: "Service name must be 255 characters or less",
83
- NETWORK_NAME: "Network name must be 50 characters or less",
84
- DATABASE_NAME: "Database name must be 63 characters or less",
85
- ORGANISATION_NAME: "Organisation name must be 50 characters or less",
86
- },
87
- // Port validation messages
88
- PORT: {
89
- INTEGER: "Port must be an integer",
90
- MIN: "Port must be at least 1",
91
- MAX: "Port cannot exceed 65535",
92
- },
93
- // Username validation messages
94
- USERNAME: {
95
- MAX_LENGTH: "Username cannot exceed 63 characters",
96
- },
97
- // Lambda validation messages
98
- LAMBDA: {
99
- MEMORY: {
100
- INTEGER: "Lambda memory must be an integer",
101
- MIN: "Memory must be at least 128 MB",
102
- MAX: "Memory cannot exceed 10240 MB",
103
- MULTIPLE: "Memory must be 128 MB or a multiple of 64 MB",
104
- },
105
- TIMEOUT: {
106
- INTEGER: "Timeout must be an integer",
107
- MIN: "Timeout must be at least 1 second",
108
- MAX: "Timeout cannot exceed 900 seconds",
109
- },
110
- },
111
- // Priority validation messages (ALB routing rules)
112
- PRIORITY: {
113
- INTEGER: "Priority must be an integer",
114
- MIN: "Priority must be at least 1",
115
- MAX: "Priority cannot exceed 50000",
116
- },
117
- // Capacity validation messages (ECS scaling)
118
- CAPACITY: {
119
- MIN: {
120
- INTEGER: "Minimum capacity must be an integer",
121
- MIN_0: "Minimum capacity must be at least 0",
122
- MIN_1: "Minimum capacity must be at least 1",
123
- MAX: "Minimum capacity cannot exceed 100",
124
- },
125
- MAX: {
126
- INTEGER: "Maximum capacity must be an integer",
127
- MIN_0: "Maximum capacity must be at least 0",
128
- MIN_1: "Maximum capacity must be at least 1",
129
- MAX: "Maximum capacity cannot exceed 100",
130
- },
131
- DESIRED: {
132
- INTEGER: "Desired count must be an integer",
133
- MIN: "Desired count must be at least 0",
134
- MAX: "Desired count cannot exceed 100",
135
- },
136
- WARM_POOL_REQUIRED: "minCapacity 0 requires a warmPool — without it, new tasks wait 60-90s for a cold instance launch",
137
- WARM_POOL: {
138
- MIN_SIZE: {
139
- INTEGER: "Warm pool minSize must be an integer",
140
- MIN: "Warm pool minSize must be at least 0",
141
- MAX: "Warm pool minSize cannot exceed 100",
142
- },
143
- MIN_SIZE_EXCEEDS_MAX_CAPACITY: "warmPool.minSize cannot exceed maxCapacity — the warm pool cannot hold more instances than the ASG allows",
144
- },
145
- },
146
- // Memory limit validation messages (ECS)
147
- MEMORY_LIMIT: {
148
- INTEGER: "Memory limit must be an integer",
149
- MIN_512: "Memory limit must be at least 512 MiB",
150
- MIN_128: "Memory limit must be at least 128 MiB",
151
- MAX: "Memory limit cannot exceed 30720 MiB",
152
- },
153
- // Database validation messages
154
- DATABASE: {
155
- PORT: {
156
- INTEGER: "Database port must be an integer",
157
- MIN: "Database port must be at least 1024",
158
- MAX: "Database port cannot exceed 65535",
159
- },
160
- NAME: {
161
- REQUIRED: "Database name is required",
162
- MAX_LENGTH: "Database name cannot exceed 64 characters",
163
- },
164
- },
165
- // Backup retention validation messages
166
- BACKUP_RETENTION: {
167
- INTEGER: "Backup retention must be an integer",
168
- MIN: "Backup retention must be at least 1 day",
169
- MAX: "Backup retention cannot exceed 35 days",
170
- },
171
- // SQS validation messages
172
- SQS: {
173
- VISIBILITY_TIMEOUT: {
174
- INTEGER: "Visibility timeout must be an integer",
175
- MIN: "Visibility timeout must be at least 0 seconds",
176
- MAX: "Visibility timeout cannot exceed 43200 seconds (12 hours)",
177
- },
178
- RETENTION_PERIOD: {
179
- INTEGER: "Retention period must be an integer",
180
- MIN: "Retention period must be at least 60 seconds",
181
- MAX: "Retention period cannot exceed 1209600 seconds (14 days)",
182
- },
183
- },
184
- // Reader validation messages (Aurora)
185
- READER: {
186
- COUNT: {
187
- INTEGER: "Reader count must be an integer",
188
- MIN: "Reader count must be at least 0",
189
- MAX: "Reader count cannot exceed 15",
190
- },
191
- },
192
- // Identifier suffix validation messages
193
- IDENTIFIER_SUFFIX: {
194
- REQUIRED: "Identifier suffix is required when specified",
195
- MAX_LENGTH: "Identifier suffix cannot exceed 50 characters",
196
- },
197
- // Rotation validation messages
198
- ROTATION: {
199
- INTEGER: "Rotation days must be an integer",
200
- MIN: "Rotation interval must be at least 1 day",
201
- MAX: "Rotation interval cannot exceed 365 days",
202
- },
203
- // Max connections validation messages
204
- MAX_CONNECTIONS: {
205
- INTEGER: "Max connections must be an integer",
206
- MIN: "Max connections must be at least 1",
207
- MAX: "Max connections cannot exceed 100",
208
- },
209
- // Monitoring interval validation messages
210
- MONITORING_INTERVAL: {
211
- INTEGER: "Monitoring interval must be an integer",
212
- MIN: "Monitoring interval must be at least 0",
213
- MAX: "Monitoring interval cannot exceed 60 seconds",
214
- VALUES: "Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds",
215
- },
216
- // Retention days validation messages (Performance Insights)
217
- RETENTION_DAYS: {
218
- INTEGER: "Retention days must be an integer",
219
- MIN: "Retention days must be at least 1",
220
- MAX: "Retention days cannot exceed 365",
221
- },
222
- // Batch size validation messages
223
- BATCH_SIZE: {
224
- INTEGER: "Batch size must be an integer",
225
- MIN: "Batch size must be at least 1",
226
- MAX: "Batch size cannot exceed 10000",
227
- },
228
- // Service validation messages
229
- SERVICE: {
230
- UNIQUE_WITHIN_CLUSTER: "Service names must be unique within a cluster",
231
- MIN_REQUIRED: "At least one service is required",
232
- ROUTING_REQUIRED: "Multiple services with ports require routing config (path or host)",
233
- },
234
- // RDS Proxy configuration messages
235
- PROXY_CONFIG: {
236
- MAX_IDLE_CONNECTIONS: {
237
- INTEGER: "Max idle connections must be an integer",
238
- MIN: "Max idle connections must be at least 0",
239
- MAX: "Max idle connections cannot exceed 100",
240
- },
241
- BORROW_TIMEOUT: {
242
- INTEGER: "Connection borrow timeout must be an integer",
243
- MIN: "Connection borrow timeout must be at least 1 second",
244
- MAX: "Connection borrow timeout cannot exceed 3600 seconds",
245
- },
246
- },
247
- // Network availability zone messages
248
- MAX_AZS: {
249
- INTEGER: "Max AZs must be an integer",
250
- MIN: "Max AZs must be at least 1",
251
- MAX: "Max AZs cannot exceed 3",
252
- },
253
- // SQS batching window messages
254
- BATCHING_WINDOW: {
255
- INTEGER: "Max batching window must be an integer",
256
- MIN: "Max batching window must be at least 0",
257
- MAX: "Max batching window cannot exceed 300 seconds",
258
- },
259
- // Health check validation messages
260
- HEALTH_CHECK: {
261
- INTERVAL: {
262
- INTEGER: "Health check interval must be an integer",
263
- MIN: "Health check interval must be at least 5 seconds",
264
- MAX: "Health check interval cannot exceed 300 seconds",
265
- },
266
- TIMEOUT: {
267
- INTEGER: "Health check timeout must be an integer",
268
- MIN: "Health check timeout must be at least 2 seconds",
269
- MAX: "Health check timeout cannot exceed 60 seconds",
270
- },
271
- RETRIES: {
272
- INTEGER: "Health check retries must be an integer",
273
- MIN: "Health check retries must be at least 1",
274
- MAX: "Health check retries cannot exceed 10",
275
- },
276
- START_PERIOD: {
277
- INTEGER: "Health check start period must be an integer",
278
- MIN: "Health check start period must be at least 0 seconds",
279
- MAX: "Health check start period cannot exceed 300 seconds",
280
- },
281
- },
282
- // Ephemeral storage messages
283
- EPHEMERAL_STORAGE: {
284
- INTEGER: "Ephemeral storage size must be an integer",
285
- MIN: "Ephemeral storage size must be at least 512 MB",
286
- MAX: "Ephemeral storage size cannot exceed 10240 MB",
287
- },
288
- // SQS max message size messages
289
- MAX_MESSAGE_SIZE: {
290
- INTEGER: "Max message size must be an integer",
291
- MIN: "Max message size must be at least 1024 bytes",
292
- MAX: "Max message size cannot exceed 262144 bytes (256 KB)",
293
- },
294
- // Capacity constraint messages
295
- CAPACITY_CONSTRAINT: {
296
- MIN_LTE_MAX: "minCapacity must be less than or equal to maxCapacity",
297
- },
298
- // Direct access constraint messages
299
- DIRECT_ACCESS: {
300
- NO_DOMAIN: "directAccess cannot be used with domain (no ALB for HTTPS)",
301
- NO_LOAD_BALANCER: "directAccess cannot be used with loadBalancer (mutually exclusive)",
302
- },
303
- // Global Aurora messages
304
- GLOBAL_AURORA: {
305
- PRIMARY_REGION_REQUIRED: "primaryRegion is required for GlobalAurora databases",
306
- },
307
- // NAT gateway messages
308
- NAT_GATEWAY: {
309
- INTEGER: "NAT gateway count must be an integer",
310
- MIN: "NAT gateway count must be at least 0",
311
- MAX: "NAT gateway count cannot exceed 3",
312
- },
313
- // CIDR mask messages
314
- CIDR_MASK: {
315
- INTEGER: "CIDR mask must be an integer",
316
- MIN: "CIDR mask must be at least 16",
317
- MAX: "CIDR mask cannot exceed 28",
318
- },
319
- // CPU units messages
320
- CPU: {
321
- INTEGER: "CPU must be an integer",
322
- MIN: "CPU must be at least 256 units",
323
- MAX: "CPU cannot exceed 4096 units",
324
- },
325
- // KMS encryption messages
326
- KMS: {
327
- KEY_REQUIRED: "KMS key ARN is required when using KMS encryption",
328
- },
329
- // Website bucket messages
330
- WEBSITE_BUCKET: {
331
- DOCUMENTS_REQUIRED: "Website index and error documents are required for website buckets",
332
- },
333
- // Aurora reader instances messages
334
- READER_INSTANCES: {
335
- MAX: "Cannot have more than 15 reader instances",
336
- COUNT_OR_INSTANCES: "Cannot specify both 'count' and 'instances' - use one or the other",
337
- },
338
- // Generator capacity messages (1-1000 range for ECS/EC2 generators)
339
- GENERATOR_CAPACITY: {
340
- MIN: {
341
- MIN: "Minimum capacity must be at least 1",
342
- MAX: "Minimum capacity cannot exceed 1000",
343
- },
344
- MAX: {
345
- MIN: "Maximum capacity must be at least 1",
346
- MAX: "Maximum capacity cannot exceed 1000",
347
- },
348
- },
349
- // Instance type messages
350
- INSTANCE_TYPE: "Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",
351
- // Architecture mismatch messages
352
- ARCHITECTURE_MISMATCH: "Architecture mismatch between instance type and AMI",
353
- // Allocated storage messages (RDS Instance)
354
- ALLOCATED_STORAGE: {
355
- INTEGER: "Allocated storage must be an integer",
356
- MIN: "Allocated storage must be at least 20 GB",
357
- MAX: "Allocated storage cannot exceed 65536 GB",
358
- },
359
- // DLQ (dead-letter queue) messages
360
- DLQ: {
361
- MAX_RECEIVE_COUNT: {
362
- INTEGER: "Max receive count must be an integer",
363
- MIN: "Max receive count must be at least 1",
364
- MAX: "Max receive count cannot exceed 1000",
365
- },
366
- },
367
- // Region messages
368
- REGION: "Invalid AWS region",
369
- });
1
+ const e=Object.freeze({IDENTIFIER:/^[a-zA-Z][a-zA-Z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:/^[a-zA-Z][a-zA-Z0-9-]*$/,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:/^\/[a-zA-Z][a-zA-Z0-9-]*(\/[a-zA-Z][a-zA-Z0-9-]*)*$/,SECRET_NAME:/^[a-zA-Z_][a-zA-Z0-9._-]*$/,SSM_COMPONENT:/^[a-zA-Z][a-zA-Z0-9._-]*$/,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i}),t=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:"Secret name must start with a letter or underscore and contain only letters, numbers, underscores, hyphens, or periods",SSM_COMPONENT:"Must start with a letter and contain only letters, numbers, periods, hyphens, or underscores",EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",FIRST_NAME:"First name is required",LAST_NAME:"Last name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",ROUTING_PATH:"Routing path is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"}},PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name cannot exceed 64 characters"}},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days"},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},WEBSITE_BUCKET:{DOCUMENTS_REQUIRED:"Website index and error documents are required for website buckets"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"}},REGION:"Invalid AWS region"});export{t as VALIDATION_MESSAGES,e as VALIDATION_PATTERNS};
@@ -1 +1 @@
1
- export declare const GENERATOR_VERSION = "0.89.3";
1
+ export declare const GENERATOR_VERSION = "0.89.6";
@@ -1 +1 @@
1
- export const GENERATOR_VERSION = "0.89.3";
1
+ export const GENERATOR_VERSION = "0.89.6";
package/package.json CHANGED
@@ -1,34 +1,54 @@
1
1
  {
2
2
  "name": "@fjall/generator",
3
- "version": "0.89.4",
3
+ "version": "0.89.6",
4
4
  "description": "Pure infrastructure generation logic for Fjall",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/src/index.d.ts",
11
+ "default": "./dist/src/index.js"
12
+ },
13
+ "./codemod": {
14
+ "types": "./dist/src/codemod/index.d.ts",
15
+ "default": "./dist/src/codemod/index.js"
16
+ }
17
+ },
8
18
  "files": [
9
19
  "dist/"
10
20
  ],
11
21
  "scripts": {
12
- "clean": "rm -rf ./dist",
13
- "build": "npm run clean && tsc",
22
+ "clean": "rm -rf ./dist ./sourcemaps",
23
+ "build": "npm run clean && tsc && node ../scripts/minify-dist.mjs dist",
14
24
  "watch": "npm run build && tsc --watch --preserveWatchOutput",
25
+ "watch:only": "tsc --watch --preserveWatchOutput",
15
26
  "typecheck": "tsc --noEmit",
16
27
  "test": "vitest run",
17
28
  "test:watch": "vitest",
29
+ "lint": "eslint src/codemod",
18
30
  "format": "prettier --write \"src/**/*.ts\"",
19
31
  "format:check": "prettier --check \"src/**/*.ts\""
20
32
  },
21
33
  "engines": {
22
- "node": ">=18.0.0"
34
+ "node": ">=22.0.0"
23
35
  },
24
- "license": "MIT",
36
+ "license": "SEE LICENSE IN LICENSE",
25
37
  "dependencies": {
26
- "@fjall/util": "^0.89.4",
38
+ "@fjall/util": "^0.89.6",
39
+ "ast-types": "^0.16.1",
40
+ "recast": "^0.23.11",
41
+ "ts-morph": "^28.0.0",
27
42
  "typescript": "^5.8.2",
28
- "zod": "^4.0.14"
43
+ "zod": "^4.3.6"
29
44
  },
30
45
  "devDependencies": {
31
- "vitest": "^3.2.3"
46
+ "@eslint/js": "^9.16.0",
47
+ "@vitest/coverage-v8": "^4.1.2",
48
+ "eslint": "^9.16.0",
49
+ "fast-check": "^4.7.0",
50
+ "typescript-eslint": "^8.19.0",
51
+ "vitest": "^4.1.0"
32
52
  },
33
- "gitHead": "6b2b2d2082b8c07174f4091202cd5bd9862f5556"
53
+ "gitHead": "fb309fa904991ac4f23c49b3bed1be146f738900"
34
54
  }
@@ -1,2 +0,0 @@
1
- import { type ParsedZoneFile } from "./types.js";
2
- export declare function generateInfrastructureFromZone(domainName: string, zone: ParsedZoneFile): string;