@fjall/generator 0.94.0 → 0.95.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/dist/.minified CHANGED
@@ -1 +1 @@
1
- 93 files minified at 2026-04-21T02:11:58.926Z
1
+ 93 files minified at 2026-04-21T03:05:07.650Z
@@ -2,10 +2,10 @@ import { parseInfrastructure } from "@fjall/generator";
2
2
  export { parseInfrastructure };
3
3
  export declare function parseAndConvert(code: string): {
4
4
  appName: string;
5
- type: "custom" | "tinkerer" | "lightweight" | "standard" | "resilient" | "enterprise";
5
+ type: "standard" | "resilient" | "enterprise" | "tinkerer" | "lightweight" | "custom";
6
6
  database: {
7
7
  name: string;
8
- type: "Instance" | "Aurora" | "GlobalAurora";
8
+ type: "Aurora" | "Instance" | "GlobalAurora";
9
9
  databaseName: string;
10
10
  instanceType?: string | undefined;
11
11
  allocatedStorage?: number | undefined;
@@ -109,7 +109,7 @@ export declare function parseAndConvert(code: string): {
109
109
  } | undefined;
110
110
  } | undefined;
111
111
  retain?: boolean | undefined;
112
- stackPlacement?: "compute" | "storage" | "cdn" | undefined;
112
+ stackPlacement?: "storage" | "compute" | "cdn" | undefined;
113
113
  variableName?: string | undefined;
114
114
  extraProperties?: {
115
115
  key: string;
@@ -213,7 +213,7 @@ export declare function parseAndConvert(code: string): {
213
213
  } | undefined;
214
214
  }[] | undefined;
215
215
  dockerfilePath?: string | undefined;
216
- deployment?: "container" | "code" | undefined;
216
+ deployment?: "code" | "container" | undefined;
217
217
  codePath?: string | undefined;
218
218
  timeout?: number | undefined;
219
219
  memory?: number | undefined;
@@ -272,7 +272,7 @@ export declare function parseAndConvert(code: string): {
272
272
  name: string;
273
273
  domain?: string | undefined;
274
274
  database?: {
275
- type?: "Instance" | "Aurora" | undefined;
275
+ type?: "Aurora" | "Instance" | undefined;
276
276
  databaseName?: string | undefined;
277
277
  databaseEngine?: "postgresql" | "mysql" | undefined;
278
278
  deletionProtection?: boolean | undefined;
@@ -384,7 +384,7 @@ export declare function parseAndConvert(code: string): {
384
384
  name: string;
385
385
  domain?: string | undefined;
386
386
  database?: {
387
- type?: "Instance" | "Aurora" | undefined;
387
+ type?: "Aurora" | "Instance" | undefined;
388
388
  databaseName?: string | undefined;
389
389
  databaseEngine?: "postgresql" | "mysql" | undefined;
390
390
  deletionProtection?: boolean | undefined;
@@ -619,7 +619,7 @@ export declare function parseAndConvert(code: string): {
619
619
  sourceText: string;
620
620
  position: "before-imports" | "after-imports" | "after-app-init" | "after-tags" | "after-resource" | "end-of-file";
621
621
  afterManagedResource?: {
622
- type: "custom" | "pattern" | "database" | "compute" | "storage" | "messaging" | "cdn" | "tags" | "network" | "import" | "app-init";
622
+ type: "custom" | "storage" | "database" | "compute" | "pattern" | "import" | "app-init" | "tags" | "network" | "messaging" | "cdn";
623
623
  name?: string | undefined;
624
624
  } | undefined;
625
625
  originalLine?: number | undefined;
@@ -1,207 +1,46 @@
1
- /**
2
- * Pure domain file generation — replaces CLI's EJS template + copySharedFiles approach.
3
- * Produces all files needed for a domain component as string arrays.
4
- */
5
- import { generateZoneFile } from "./bindWriter.js";
6
- import { toPascalCase } from "../generation/common.js";
7
- import { GENERATOR_VERSION } from "../version.js";
8
- /**
9
- * Generates all files for a domain component as pure strings.
10
- * Returns a `GeneratedFile[]` ready for the GitHub PR pipeline.
11
- */
12
- export function generateDomainFiles(options) {
13
- const { domainName, hostedZoneId, records = [] } = options;
14
- const basePath = `fjall/domains/${domainName}`;
15
- const zone = {
16
- origin: domainName,
17
- ttl: 300,
18
- records,
19
- delegations: [],
20
- certificates: [{ domainName, subjectAlternativeNames: [] }],
21
- };
22
- return [
23
- {
24
- path: `${basePath}/zone.bind`,
25
- content: records.length > 0
26
- ? generateZoneFile(zone)
27
- : generateDefaultZoneFile(domainName),
28
- },
29
- {
30
- path: `${basePath}/infrastructure.ts`,
31
- content: generateDefaultInfrastructureTs({
32
- domainName,
33
- records,
34
- hostedZoneId,
35
- }),
36
- },
37
- {
38
- path: `${basePath}/package.json`,
39
- content: generateDomainPackageJson(domainName),
40
- },
41
- {
42
- path: `${basePath}/tsconfig.json`,
43
- content: TSCONFIG_CONTENT,
44
- },
45
- {
46
- path: `${basePath}/cdk.json`,
47
- content: CDK_JSON_CONTENT,
48
- },
49
- {
50
- path: `${basePath}/.gitignore`,
51
- content: GITIGNORE_CONTENT,
52
- },
53
- ];
54
- }
55
- // Lightweight default-scaffold emitter for the webapp PR pipeline.
56
- // The CLI uses the richer `tsEmitter` in `@fjall/cli` for import-flow output.
57
- function generateDefaultInfrastructureTs(args) {
58
- const { domainName, records, hostedZoneId } = args;
59
- const safeZoneName = toPascalCase(domainName.split(".").join(""));
60
- const recordLines = records.map((r) => {
61
- const ttl = r.ttl !== undefined ? `, ttl: ${r.ttl}` : "";
62
- return ` { type: ${JSON.stringify(r.type)}, name: ${JSON.stringify(r.name)}, value: ${JSON.stringify(r.value)}${ttl} },`;
63
- });
64
- const recordsBlock = recordLines.length > 0 ? `[\n${recordLines.join("\n")}\n ]` : "[]";
65
- const hostedZoneLine = hostedZoneId
66
- ? ` hostedZoneId: ${JSON.stringify(hostedZoneId)},\n`
67
- : "";
68
- return `import {
1
+ import{generateZoneFile as d}from"./bindWriter.js";import{toPascalCase as p}from"../generation/common.js";import{GENERATOR_VERSION as c}from"../version.js";function $(e){const{domainName:t,hostedZoneId:o,records:a=[]}=e,s=`fjall/domains/${t}`,n={origin:t,ttl:300,records:a,delegations:[],certificates:[{domainName:t,subjectAlternativeNames:[]}]};return[{path:`${s}/zone.bind`,content:a.length>0?d(n):w(t)},{path:`${s}/infrastructure.ts`,content:m({domainName:t,records:a,hostedZoneId:o})},{path:`${s}/package.json`,content:f(t)},{path:`${s}/tsconfig.json`,content:k},{path:`${s}/cdk.json`,content:y},{path:`${s}/.gitignore`,content:g}]}function m(e){const{domainName:t,records:o,hostedZoneId:a}=e,s=p(t.split(".").join("")),n=o.map(r=>{const l=r.ttl!==void 0?`, ttl: ${r.ttl}`:"";return` { type: ${JSON.stringify(r.type)}, name: ${JSON.stringify(r.name)}, value: ${JSON.stringify(r.value)}${l} },`}),i=n.length>0?`[
2
+ ${n.join(`
3
+ `)}
4
+ ]`:"[]",u=a?` hostedZoneId: ${JSON.stringify(a)},
5
+ `:"";return`import {
69
6
  App,
70
7
  Domain,
71
8
  } from "@fjall/components-infrastructure";
72
9
 
73
- // Fjall-managed domain edit this file to add or change records.
10
+ // Fjall-managed domain \u2014 edit this file to add or change records.
74
11
  // See docs/domains.md for the Domain construct API.
75
12
 
76
- const app = App.getApp(${JSON.stringify(`${safeZoneName}Domain`)});
13
+ const app = App.getApp(${JSON.stringify(`${s}Domain`)});
77
14
 
78
- new Domain(app, ${JSON.stringify(safeZoneName)}, {
15
+ new Domain(app, ${JSON.stringify(s)}, {
79
16
  registrar: "route53",
80
- zoneName: ${JSON.stringify(domainName)},
81
- ${hostedZoneLine} certificates: [
82
- { domainName: ${JSON.stringify(domainName)} },
17
+ zoneName: ${JSON.stringify(t)},
18
+ ${u} certificates: [
19
+ { domainName: ${JSON.stringify(t)} },
83
20
  ],
84
- records: ${recordsBlock},
21
+ records: ${i},
85
22
  });
86
- `;
87
- }
88
- // ─── File content generators ────────────────────────────────────────────────
89
- function generateDefaultZoneFile(domainName) {
90
- return `; zone.bind — advisory copy only (Fjall reads infrastructure.ts)
23
+ `}function w(e){return`; zone.bind \u2014 advisory copy only (Fjall reads infrastructure.ts)
91
24
  ; This file is written at import time with --preserve-bind; edit infrastructure.ts to change records
92
- $ORIGIN ${domainName}.
25
+ $ORIGIN ${e}.
93
26
  $TTL 300
94
27
 
95
28
  ; Certificate for this domain
96
- $FJALL-CERT ${domainName}
29
+ $FJALL-CERT ${e}
97
30
 
98
31
  ; Add your DNS records below
99
32
  ; Examples:
100
33
  ; @ IN A ALIAS fjall:ecs:my-app
101
- ; www IN CNAME ${domainName}.
34
+ ; www IN CNAME ${e}.
102
35
  ; api IN A ALIAS fjall:ecs:my-api
103
- ; @ IN MX 10 mail.${domainName}.
104
- `;
105
- }
106
- function generateDomainPackageJson(domainName) {
107
- return (JSON.stringify({
108
- name: `domain-${domainName}`,
109
- version: GENERATOR_VERSION,
110
- scripts: {},
111
- devDependencies: {
112
- "@types/node": "20.4.9",
113
- "ts-node": "^10.9.1",
114
- typescript: "~5.1.6",
115
- },
116
- dependencies: {
117
- "@fjall/components-infrastructure": `^${GENERATOR_VERSION}`,
118
- "aws-cdk-lib": "^2.239.0",
119
- constructs: "^10.0.0",
120
- },
121
- }, null, 2) + "\n");
122
- }
123
- const GITIGNORE_CONTENT = `node_modules/
36
+ ; @ IN MX 10 mail.${e}.
37
+ `}function f(e){return JSON.stringify({name:`domain-${e}`,version:c,scripts:{},devDependencies:{"@types/node":"20.4.9","ts-node":"^10.9.1",typescript:"~5.1.6"},dependencies:{"@fjall/components-infrastructure":`^${c}`,"aws-cdk-lib":"^2.239.0",constructs:"^10.0.0"}},null,2)+`
38
+ `}const g=`node_modules/
124
39
  cdk.out/
125
40
  *.d.ts
126
41
  *.js
127
42
  .deploy-state.json
128
43
  .deploy-state.json.tmp
129
- `;
130
- const TSCONFIG_CONTENT = JSON.stringify({
131
- compilerOptions: {
132
- target: "ES2020",
133
- module: "commonjs",
134
- lib: ["es2020", "dom"],
135
- declaration: true,
136
- strict: true,
137
- noImplicitAny: true,
138
- strictNullChecks: true,
139
- noImplicitThis: true,
140
- alwaysStrict: true,
141
- noUnusedLocals: false,
142
- noUnusedParameters: false,
143
- noImplicitReturns: true,
144
- noFallthroughCasesInSwitch: false,
145
- inlineSourceMap: true,
146
- inlineSources: true,
147
- experimentalDecorators: true,
148
- strictPropertyInitialization: false,
149
- typeRoots: ["./node_modules/@types"],
150
- },
151
- exclude: ["node_modules", "cdk.out"],
152
- }, null, 2) + "\n";
153
- const CDK_JSON_CONTENT = JSON.stringify({
154
- app: "npx ts-node --prefer-ts-exts --transpile-only infrastructure.ts",
155
- assetMetadata: false,
156
- pathMetadata: false,
157
- versionReporting: false,
158
- watch: {
159
- include: ["**"],
160
- exclude: [
161
- "README.md",
162
- "cdk*.json",
163
- "**/*.d.ts",
164
- "**/*.js",
165
- "tsconfig.json",
166
- "package*.json",
167
- "yarn.lock",
168
- "node_modules",
169
- "test",
170
- ],
171
- },
172
- context: {
173
- "@aws-cdk/aws-lambda:recognizeLayerVersion": true,
174
- "@aws-cdk/core:checkSecretUsage": true,
175
- "@aws-cdk/core:target-partitions": ["aws", "aws-cn"],
176
- "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
177
- "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
178
- "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
179
- "@aws-cdk/aws-iam:minimizePolicies": true,
180
- "@aws-cdk/core:validateSnapshotRemovalPolicy": true,
181
- "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
182
- "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
183
- "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
184
- "@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
185
- "@aws-cdk/core:enablePartitionLiterals": true,
186
- "@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
187
- "@aws-cdk/aws-iam:standardizedServicePrincipals": true,
188
- "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
189
- "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
190
- "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
191
- "@aws-cdk/aws-route53-patters:useCertificate": true,
192
- "@aws-cdk/customresources:installLatestAwsSdkDefault": false,
193
- "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
194
- "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
195
- "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
196
- "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
197
- "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
198
- "@aws-cdk/aws-redshift:columnId": true,
199
- "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
200
- "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
201
- "@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
202
- "@aws-cdk/aws-kms:aliasNameRef": true,
203
- "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
204
- "@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
205
- "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
206
- },
207
- }, null, 2) + "\n";
44
+ `,k=JSON.stringify({compilerOptions:{target:"ES2020",module:"commonjs",lib:["es2020","dom"],declaration:!0,strict:!0,noImplicitAny:!0,strictNullChecks:!0,noImplicitThis:!0,alwaysStrict:!0,noUnusedLocals:!1,noUnusedParameters:!1,noImplicitReturns:!0,noFallthroughCasesInSwitch:!1,inlineSourceMap:!0,inlineSources:!0,experimentalDecorators:!0,strictPropertyInitialization:!1,typeRoots:["./node_modules/@types"]},exclude:["node_modules","cdk.out"]},null,2)+`
45
+ `,y=JSON.stringify({app:"npx ts-node --prefer-ts-exts --transpile-only infrastructure.ts",assetMetadata:!1,pathMetadata:!1,versionReporting:!1,watch:{include:["**"],exclude:["README.md","cdk*.json","**/*.d.ts","**/*.js","tsconfig.json","package*.json","yarn.lock","node_modules","test"]},context:{"@aws-cdk/aws-lambda:recognizeLayerVersion":!0,"@aws-cdk/core:checkSecretUsage":!0,"@aws-cdk/core:target-partitions":["aws","aws-cn"],"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver":!0,"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName":!0,"@aws-cdk/aws-ecs:arnFormatIncludesClusterName":!0,"@aws-cdk/aws-iam:minimizePolicies":!0,"@aws-cdk/core:validateSnapshotRemovalPolicy":!0,"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName":!0,"@aws-cdk/aws-s3:createDefaultLoggingPolicy":!0,"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption":!0,"@aws-cdk/aws-apigateway:disableCloudWatchRole":!0,"@aws-cdk/core:enablePartitionLiterals":!0,"@aws-cdk/aws-events:eventsTargetQueueSameAccount":!0,"@aws-cdk/aws-iam:standardizedServicePrincipals":!0,"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker":!0,"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName":!0,"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy":!0,"@aws-cdk/aws-route53-patters:useCertificate":!0,"@aws-cdk/customresources:installLatestAwsSdkDefault":!1,"@aws-cdk/aws-rds:databaseProxyUniqueResourceName":!0,"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup":!0,"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId":!0,"@aws-cdk/aws-ec2:launchTemplateDefaultUserData":!0,"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments":!0,"@aws-cdk/aws-redshift:columnId":!0,"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2":!0,"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup":!0,"@aws-cdk/aws-apigateway:requestValidatorUniqueId":!0,"@aws-cdk/aws-kms:aliasNameRef":!0,"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig":!0,"@aws-cdk/core:includePrefixInUniqueNameGeneration":!0,"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby":!0}},null,2)+`
46
+ `;export{$ as generateDomainFiles};
package/dist/src/index.js CHANGED
@@ -1,21 +1 @@
1
- // Utility foundation
2
- export { normaliseError, getErrorMessage } from "./util/errorUtils.js";
3
- export { isSuccess, isFailure, success, failure, tryAsync, trySync, } from "./types/Result.js";
4
- // Validation
5
- export { VALIDATION_PATTERNS, VALIDATION_MESSAGES, } from "./validation/patterns.js";
6
- // AWS
7
- export { DEFAULT_REGION, regions, AWS_REGIONS_METADATA, topRegions, commonRegions, parseRegionList, isValidRegion, isValidRegionFormat, getSuggestions, validateRegion, validateRegionList, filterDuplicateRegions, getRegionOptions, getRegionOptionsExcluding, getRegionName, createRegionFormatter, } from "./aws/regions.js";
8
- // Version
9
- export { GENERATOR_VERSION } from "./version.js";
10
- // Schemas, plan types, constants
11
- export * from "./schemas/index.js";
12
- // Code generation
13
- export * from "./generation/index.js";
14
- // Tier, pattern, and storage presets
15
- export * from "./presets/index.js";
16
- // AST parsing & surgical modification
17
- export * from "./ast/index.js";
18
- // Resource planning
19
- export * from "./planning/index.js";
20
- // DNS
21
- export * from "./dns/index.js";
1
+ import{normaliseError as r,getErrorMessage as i}from"./util/errorUtils.js";import{isSuccess as s,isFailure as g,success as n,failure as R,tryAsync as m,trySync as a}from"./types/Result.js";import{VALIDATION_PATTERNS as f,VALIDATION_MESSAGES as A}from"./validation/patterns.js";import{DEFAULT_REGION as x,regions as c,AWS_REGIONS_METADATA as l,topRegions as S,commonRegions as N,parseRegionList as O,isValidRegion as T,isValidRegionFormat as u,getSuggestions as I,validateRegion as _,validateRegionList as d,filterDuplicateRegions as D,getRegionOptions as L,getRegionOptionsExcluding as V,getRegionName as y,createRegionFormatter as F}from"./aws/regions.js";import{GENERATOR_VERSION as M}from"./version.js";export*from"./schemas/index.js";export*from"./generation/index.js";export*from"./presets/index.js";export*from"./ast/index.js";export*from"./planning/index.js";export*from"./dns/index.js";export{l as AWS_REGIONS_METADATA,x as DEFAULT_REGION,M as GENERATOR_VERSION,A as VALIDATION_MESSAGES,f as VALIDATION_PATTERNS,N as commonRegions,F as createRegionFormatter,R as failure,D as filterDuplicateRegions,i as getErrorMessage,y as getRegionName,L as getRegionOptions,V as getRegionOptionsExcluding,I as getSuggestions,g as isFailure,s as isSuccess,T as isValidRegion,u as isValidRegionFormat,r as normaliseError,O as parseRegionList,c as regions,n as success,S as topRegions,m as tryAsync,a as trySync,_ as validateRegion,d as validateRegionList};
@@ -1 +1 @@
1
- export declare const GENERATOR_VERSION = "0.94.0";
1
+ export declare const GENERATOR_VERSION = "0.94.2";
@@ -1 +1 @@
1
- export const GENERATOR_VERSION = "0.94.0";
1
+ const E="0.94.2";export{E as GENERATOR_VERSION};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/generator",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "description": "Pure infrastructure generation logic for Fjall",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "license": "SEE LICENSE IN LICENSE",
37
37
  "dependencies": {
38
- "@fjall/util": "^0.94.0",
38
+ "@fjall/util": "^0.95.0",
39
39
  "ast-types": "^0.16.1",
40
40
  "recast": "^0.23.11",
41
41
  "ts-morph": "^28.0.0",
@@ -50,5 +50,5 @@
50
50
  "typescript-eslint": "^8.19.0",
51
51
  "vitest": "^4.1.0"
52
52
  },
53
- "gitHead": "97f6b382405bb3068e841d30866222fd76bc3b15"
53
+ "gitHead": "7fdbf0c5dd58088642c67d877e5e224831dfc149"
54
54
  }