@fjall/generator 0.88.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/src/ast/astComputeParser.d.ts +4 -0
  2. package/dist/src/ast/astComputeParser.js +427 -0
  3. package/dist/src/ast/astInfrastructureParser.d.ts +357 -0
  4. package/dist/src/ast/astInfrastructureParser.js +1925 -0
  5. package/dist/src/ast/astSurgicalModification.d.ts +47 -0
  6. package/dist/src/ast/astSurgicalModification.js +400 -0
  7. package/dist/src/ast/index.d.ts +2 -0
  8. package/dist/src/ast/index.js +2 -0
  9. package/dist/src/aws/regions.d.ts +30 -0
  10. package/dist/src/aws/regions.js +254 -0
  11. package/dist/src/generation/common.d.ts +86 -0
  12. package/dist/src/generation/common.js +187 -0
  13. package/dist/src/generation/compute.d.ts +6 -0
  14. package/dist/src/generation/compute.js +547 -0
  15. package/dist/src/generation/database.d.ts +54 -0
  16. package/dist/src/generation/database.js +201 -0
  17. package/dist/src/generation/index.d.ts +12 -0
  18. package/dist/src/generation/index.js +18 -0
  19. package/dist/src/generation/infrastructure.d.ts +44 -0
  20. package/dist/src/generation/infrastructure.js +389 -0
  21. package/dist/src/generation/storage.d.ts +23 -0
  22. package/dist/src/generation/storage.js +174 -0
  23. package/dist/src/generation/storageConnections.d.ts +37 -0
  24. package/dist/src/generation/storageConnections.js +71 -0
  25. package/dist/src/index.d.ts +10 -0
  26. package/dist/src/index.js +19 -0
  27. package/dist/src/planning/index.d.ts +1 -0
  28. package/dist/src/planning/index.js +1 -0
  29. package/dist/src/planning/resourcePlanning.d.ts +58 -0
  30. package/dist/src/planning/resourcePlanning.js +216 -0
  31. package/dist/src/presets/index.d.ts +3 -0
  32. package/dist/src/presets/index.js +3 -0
  33. package/dist/src/presets/patternTierPresets.d.ts +93 -0
  34. package/dist/src/presets/patternTierPresets.js +131 -0
  35. package/dist/src/presets/storagePresets.d.ts +11 -0
  36. package/dist/src/presets/storagePresets.js +36 -0
  37. package/dist/src/presets/tierPresets.d.ts +59 -0
  38. package/dist/src/presets/tierPresets.js +384 -0
  39. package/dist/src/presets/tierTypes.d.ts +301 -0
  40. package/dist/src/presets/tierTypes.js +7 -0
  41. package/dist/src/schemas/constants.d.ts +74 -0
  42. package/dist/src/schemas/constants.js +208 -0
  43. package/dist/src/schemas/index.d.ts +3 -0
  44. package/dist/src/schemas/index.js +3 -0
  45. package/dist/src/schemas/instanceTypeArchitecture.d.ts +35 -0
  46. package/dist/src/schemas/instanceTypeArchitecture.js +75 -0
  47. package/dist/src/schemas/resourceSchemas.d.ts +3534 -0
  48. package/dist/src/schemas/resourceSchemas.js +2015 -0
  49. package/dist/src/types/Result.d.ts +19 -0
  50. package/dist/src/types/Result.js +31 -0
  51. package/dist/src/util/errorUtils.d.ts +2 -0
  52. package/dist/src/util/errorUtils.js +15 -0
  53. package/dist/src/validation/patterns.d.ts +300 -0
  54. package/dist/src/validation/patterns.js +360 -0
  55. package/dist/src/version.d.ts +1 -0
  56. package/dist/src/version.js +1 -0
  57. package/package.json +32 -0
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Pattern Tier Presets
3
+ *
4
+ * Defines configuration presets for OpenNext patterns (Payload, Next.js).
5
+ * Mirrors the application TIER_PRESETS structure for consistency.
6
+ *
7
+ * Architecture:
8
+ * - PATTERN_TIER_PRESETS defines what each tier means for patterns
9
+ * - planOpenNextResources() uses these during `fjall create`
10
+ * - CreateScreen uses these for pattern tier selection
11
+ * - Custom mode bypasses presets and prompts for each parameter
12
+ */
13
+ import type { NetworkTierPreset } from "./tierPresets.js";
14
+ import type { BackupVaultTier } from "../schemas/constants.js";
15
+ /**
16
+ * Pattern tier names - ordered from least to most capable/expensive
17
+ * Tinkerer and Enterprise are deferred for future implementation.
18
+ */
19
+ export declare const PATTERN_TIER_NAMES: readonly ["lightweight", "standard", "resilient"];
20
+ export type PatternTierName = (typeof PATTERN_TIER_NAMES)[number];
21
+ export declare const PATTERN_TYPES_WITH_CUSTOM: readonly ["lightweight", "standard", "resilient", "custom"];
22
+ export type PatternTypeWithCustom = (typeof PATTERN_TYPES_WITH_CUSTOM)[number];
23
+ /**
24
+ * Database preset for pattern tiers.
25
+ */
26
+ export interface PatternDatabasePreset {
27
+ /** Database type: RDS Instance or Aurora (Serverless V2) */
28
+ type: "Instance" | "Aurora";
29
+ /** Instance type for RDS Instance databases */
30
+ instanceType?: string;
31
+ /** Backup retention in days */
32
+ backupRetention?: number;
33
+ /** Enable deletion protection */
34
+ deletionProtection?: boolean;
35
+ /** KMS encryption configuration */
36
+ encryption?: {
37
+ useCMK: true;
38
+ } | false;
39
+ }
40
+ /**
41
+ * Compute preset for pattern tiers (Lambda configuration).
42
+ */
43
+ export interface PatternComputePreset {
44
+ /** Lambda memory size in MB */
45
+ memorySize: number;
46
+ /** Lambda timeout in seconds */
47
+ timeout: number;
48
+ }
49
+ /**
50
+ * Complete pattern tier preset configuration.
51
+ */
52
+ export interface PatternTierPreset {
53
+ /** Human-readable name for UI display */
54
+ displayName: string;
55
+ /** Brief description of what this tier is for */
56
+ description: string;
57
+ /** Database configuration */
58
+ database: PatternDatabasePreset;
59
+ /** Compute (Lambda) configuration */
60
+ compute: PatternComputePreset;
61
+ /** Network configuration */
62
+ network: NetworkTierPreset;
63
+ /** Backup configuration. Object = enrol in AWS Backup, false = no backup. */
64
+ backup: {
65
+ tier: BackupVaultTier;
66
+ } | false;
67
+ }
68
+ /**
69
+ * Master configuration for all pattern tiers.
70
+ *
71
+ * | Tier | Database | Lambda Memory | Lambda Timeout | Network |
72
+ * |-------------|----------------------|---------------|----------------|------------------|
73
+ * | Lightweight | Instance (t4g.small) | 512 MB | 30s | 2 AZ, 1 NAT |
74
+ * | Standard | Instance (t4g.large) | 1536 MB | 60s | 3 AZ, 1 NAT |
75
+ * | Resilient | Aurora V2 + KMS | 2048 MB | 120s | 3 AZ, 3 NAT |
76
+ */
77
+ export declare const PATTERN_TIER_PRESETS: Readonly<Record<PatternTierName, PatternTierPreset>>;
78
+ /**
79
+ * Get pattern tier preset by name.
80
+ */
81
+ export declare function getPatternTierPreset(tier: PatternTierName): PatternTierPreset;
82
+ /**
83
+ * Get tier options formatted for UI Select component.
84
+ */
85
+ export declare function getPatternTierOptions(): Array<{
86
+ label: string;
87
+ value: PatternTierName | "custom";
88
+ description: string;
89
+ }>;
90
+ /**
91
+ * Check if a tier name is a valid pattern tier.
92
+ */
93
+ export declare function isPatternTierName(tier: string): tier is PatternTierName;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Pattern Tier Presets
3
+ *
4
+ * Defines configuration presets for OpenNext patterns (Payload, Next.js).
5
+ * Mirrors the application TIER_PRESETS structure for consistency.
6
+ *
7
+ * Architecture:
8
+ * - PATTERN_TIER_PRESETS defines what each tier means for patterns
9
+ * - planOpenNextResources() uses these during `fjall create`
10
+ * - CreateScreen uses these for pattern tier selection
11
+ * - Custom mode bypasses presets and prompts for each parameter
12
+ */
13
+ /**
14
+ * Pattern tier names - ordered from least to most capable/expensive
15
+ * Tinkerer and Enterprise are deferred for future implementation.
16
+ */
17
+ export const PATTERN_TIER_NAMES = [
18
+ "lightweight",
19
+ "standard",
20
+ "resilient",
21
+ ];
22
+ export const PATTERN_TYPES_WITH_CUSTOM = [
23
+ ...PATTERN_TIER_NAMES,
24
+ "custom",
25
+ ];
26
+ /**
27
+ * Master configuration for all pattern tiers.
28
+ *
29
+ * | Tier | Database | Lambda Memory | Lambda Timeout | Network |
30
+ * |-------------|----------------------|---------------|----------------|------------------|
31
+ * | Lightweight | Instance (t4g.small) | 512 MB | 30s | 2 AZ, 1 NAT |
32
+ * | Standard | Instance (t4g.large) | 1536 MB | 60s | 3 AZ, 1 NAT |
33
+ * | Resilient | Aurora V2 + KMS | 2048 MB | 120s | 3 AZ, 3 NAT |
34
+ */
35
+ export const PATTERN_TIER_PRESETS = Object.freeze({
36
+ lightweight: {
37
+ displayName: "Lightweight",
38
+ description: "Cost-effective · Instance DB, minimal Lambda",
39
+ database: {
40
+ type: "Instance",
41
+ instanceType: "t4g.small",
42
+ backupRetention: 7,
43
+ deletionProtection: false,
44
+ },
45
+ compute: {
46
+ memorySize: 512,
47
+ timeout: 30,
48
+ },
49
+ network: { maxAzs: 2, natGateways: { count: 1 }, flowLogs: false },
50
+ backup: false,
51
+ },
52
+ standard: {
53
+ displayName: "Standard",
54
+ description: "Production-ready · Instance DB, balanced Lambda",
55
+ database: {
56
+ type: "Instance",
57
+ instanceType: "t4g.large",
58
+ backupRetention: 14,
59
+ deletionProtection: true,
60
+ },
61
+ compute: {
62
+ memorySize: 1536,
63
+ timeout: 60,
64
+ },
65
+ network: { maxAzs: 3, natGateways: { count: 1 }, flowLogs: {} },
66
+ backup: { tier: "standard" },
67
+ },
68
+ resilient: {
69
+ displayName: "Resilient",
70
+ description: "High-availability · Aurora V2, KMS encryption",
71
+ database: {
72
+ type: "Aurora",
73
+ backupRetention: 30,
74
+ deletionProtection: true,
75
+ encryption: { useCMK: true },
76
+ },
77
+ compute: {
78
+ memorySize: 2048,
79
+ timeout: 120,
80
+ },
81
+ network: {
82
+ maxAzs: 3,
83
+ natGateways: { count: 3 },
84
+ flowLogs: { retentionDays: 90 },
85
+ },
86
+ backup: { tier: "resilient" },
87
+ },
88
+ });
89
+ /**
90
+ * Get pattern tier preset by name.
91
+ */
92
+ export function getPatternTierPreset(tier) {
93
+ return PATTERN_TIER_PRESETS[tier];
94
+ }
95
+ /**
96
+ * Get tier options formatted for UI Select component.
97
+ */
98
+ export function getPatternTierOptions() {
99
+ return [
100
+ {
101
+ label: PATTERN_TIER_PRESETS.standard.displayName,
102
+ value: "standard",
103
+ description: PATTERN_TIER_PRESETS.standard.description,
104
+ },
105
+ {
106
+ label: PATTERN_TIER_PRESETS.lightweight.displayName,
107
+ value: "lightweight",
108
+ description: PATTERN_TIER_PRESETS.lightweight.description,
109
+ },
110
+ {
111
+ label: PATTERN_TIER_PRESETS.resilient.displayName,
112
+ value: "resilient",
113
+ description: PATTERN_TIER_PRESETS.resilient.description,
114
+ },
115
+ {
116
+ label: "Custom",
117
+ value: "custom",
118
+ description: "Full control · Configure everything",
119
+ },
120
+ ];
121
+ }
122
+ /**
123
+ * Set of pattern tier names for O(1) lookup.
124
+ */
125
+ const PATTERN_TIER_NAMES_SET = new Set(PATTERN_TIER_NAMES);
126
+ /**
127
+ * Check if a tier name is a valid pattern tier.
128
+ */
129
+ export function isPatternTierName(tier) {
130
+ return PATTERN_TIER_NAMES_SET.has(tier);
131
+ }
@@ -0,0 +1,11 @@
1
+ import type { S3ResourcePlan } from "../schemas/resourceSchemas.js";
2
+ import type { STORAGE_PRESET_TYPES } from "../schemas/constants.js";
3
+ export type StoragePreset = (typeof STORAGE_PRESET_TYPES)[number];
4
+ type S3PresetOverrides = Partial<Omit<S3ResourcePlan, "name" | "variableName" | "extraProperties">>;
5
+ export declare const STORAGE_PRESETS: Readonly<Record<StoragePreset, S3PresetOverrides>>;
6
+ export declare function getStoragePreset(preset: StoragePreset): S3PresetOverrides;
7
+ export declare function getStoragePresetOptions(): ReadonlyArray<{
8
+ readonly label: string;
9
+ readonly value: StoragePreset;
10
+ }>;
11
+ export {};
@@ -0,0 +1,36 @@
1
+ export const STORAGE_PRESETS = Object.freeze({
2
+ standard: {},
3
+ assets: {
4
+ versioned: true,
5
+ deployment: {
6
+ source: "./assets",
7
+ },
8
+ },
9
+ upload: {
10
+ versioned: true,
11
+ cors: [
12
+ {
13
+ allowedOrigins: ["*"],
14
+ allowedMethods: ["GET", "PUT", "POST"],
15
+ },
16
+ ],
17
+ },
18
+ website: {
19
+ publicReadAccess: true,
20
+ websiteHosting: {
21
+ indexDocument: "index.html",
22
+ errorDocument: "error.html",
23
+ },
24
+ },
25
+ });
26
+ export function getStoragePreset(preset) {
27
+ return { ...STORAGE_PRESETS[preset] };
28
+ }
29
+ export function getStoragePresetOptions() {
30
+ return [
31
+ { label: "Standard", value: "standard" },
32
+ { label: "Assets", value: "assets" },
33
+ { label: "Upload", value: "upload" },
34
+ { label: "Website Hosting", value: "website" },
35
+ ];
36
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Tier Presets
3
+ *
4
+ * This file defines the configuration presets for each tier (Tinkerer, Standard,
5
+ * Resilient, Enterprise) across all resource types. Both the `create` flow and
6
+ * `add` flow consume these presets to ensure consistency.
7
+ *
8
+ * Architecture:
9
+ * - TIER_PRESETS defines what each tier means for each resource type
10
+ * - planApplicationResources() uses these during `fjall create`
11
+ * - AddResourceScreen uses these during `fjall add`
12
+ * - Custom mode bypasses presets and prompts for each parameter
13
+ *
14
+ * Type definitions live in ./tierTypes.ts and are re-exported here.
15
+ */
16
+ import type { DatabaseType } from "../schemas/constants.js";
17
+ import type { TierProxyConfig, TierReadReplicaConfig, TierCredentialsConfig, TierAuroraReadersConfig, TierDatabaseInsightsConfig, TierEncryptionConfig, DatabaseTierPreset, TierEc2CapacityConfig, TierClusterConfig, TierEcsServiceConfig, EcsTierPreset, LambdaTierPreset, TierNatConfig, TierFlowLogConfig, TierGatewayEndpointsConfig, TierInterfaceEndpointsConfig, TierVpcEndpointsConfig, NetworkTierPreset, TierPreset, UserServiceConfig } from "./tierTypes.js";
18
+ export type { TierProxyConfig, TierReadReplicaConfig, TierCredentialsConfig, TierAuroraReadersConfig, TierDatabaseInsightsConfig, TierEncryptionConfig, DatabaseTierPreset, TierEc2CapacityConfig, TierClusterConfig, TierEcsServiceConfig, EcsTierPreset, LambdaTierPreset, TierNatConfig, TierFlowLogConfig, TierGatewayEndpointsConfig, TierInterfaceEndpointsConfig, TierVpcEndpointsConfig, NetworkTierPreset, TierPreset, UserServiceConfig, };
19
+ /**
20
+ * Tier names - ordered from least to most capable/expensive
21
+ * This is the single source of truth for all tier-based configuration.
22
+ */
23
+ export declare const TIER_NAMES: readonly ["tinkerer", "lightweight", "standard", "resilient", "enterprise"];
24
+ export type TierName = (typeof TIER_NAMES)[number];
25
+ export declare const CUSTOM_TIER: "custom";
26
+ export declare const APP_TYPES: readonly ["tinkerer", "lightweight", "standard", "resilient", "enterprise", "custom"];
27
+ export type AppType = (typeof APP_TYPES)[number];
28
+ /**
29
+ * Master configuration for all tiers
30
+ */
31
+ export declare const TIER_PRESETS: Record<TierName, TierPreset>;
32
+ export declare function getDatabasePreset(tier: TierName, databaseType: DatabaseType): DatabaseTierPreset | null;
33
+ /**
34
+ * Get ECS preset for a specific tier
35
+ */
36
+ export declare function getEcsPreset(tier: TierName): EcsTierPreset;
37
+ /**
38
+ * Get network preset for a specific tier
39
+ */
40
+ export declare function getNetworkPreset(tier: TierName): NetworkTierPreset;
41
+ export declare function getAvailableTiersForDatabase(databaseType: DatabaseType): TierName[];
42
+ /**
43
+ * Get tier options formatted for UI Select component
44
+ */
45
+ export declare function getTierOptionsForDatabase(databaseType: DatabaseType): Array<{
46
+ label: string;
47
+ value: TierName;
48
+ description: string;
49
+ }>;
50
+ /**
51
+ * Get the default database type for a tier
52
+ */
53
+ export declare function getDefaultDatabaseTypeForTier(tier: TierName): DatabaseType;
54
+ /**
55
+ * Apply tier defaults to user-provided services.
56
+ * Takes user service names and applies the tier's cpu, memory, scaling,
57
+ * capacityProvider, and ec2Config defaults.
58
+ */
59
+ export declare function applyTierDefaultsToServices(tier: TierName, userServices: UserServiceConfig[]): TierEcsServiceConfig[];