@fjall/generator 27.1.0 → 28.1.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.
@@ -9,7 +9,7 @@
9
9
  "package.json",
10
10
  "tsconfig.json"
11
11
  ],
12
- "hash": "f52e13667cd593ad981026c4c9c21575c66cc1ed4efa6a40f4a04eceafc34137",
12
+ "hash": "19b90a7a09fb9c66087b50b8a42f7a01124525268239541f7dde9e8129fa099d",
13
13
  "files": {
14
14
  "src/ast/astTestHelpers.ts": "026cac849eb88bdb",
15
15
  "src/ast/domain/astDomainParser.ts": "12107a9864c6670c",
@@ -93,7 +93,7 @@
93
93
  "src/codemod/llmFallback/telemetryEvents.ts": "827282cb185eea6c",
94
94
  "src/codemod/llmFallback/tierRunner.ts": "a26094accd78cf15",
95
95
  "src/codemod/llmFallback/types.ts": "0b528ccbab7d48b8",
96
- "src/codemod/registry.ts": "cb04890990f06ec0",
96
+ "src/codemod/registry.ts": "6bf27884c4dea32a",
97
97
  "src/codemod/semanticIndex/classifyControlFlow.ts": "ed96215d91a3cae3",
98
98
  "src/codemod/semanticIndex/findReferences.ts": "96aea37418d1e91a",
99
99
  "src/codemod/semanticIndex/index.ts": "cfcd212d34ab20fb",
@@ -108,7 +108,7 @@
108
108
  "src/codemod/validationGate/gates/locate.ts": "2c186c32edbb97ce",
109
109
  "src/codemod/validationGate/gates/parse.ts": "5433c5c8ffa35324",
110
110
  "src/codemod/validationGate/gates/projection.ts": "461051f3dc6bf6b2",
111
- "src/codemod/validationGate/gates/schema.ts": "7ed5acaec0620a46",
111
+ "src/codemod/validationGate/gates/schema.ts": "46d4aacde1f2b9bc",
112
112
  "src/codemod/validationGate/index.ts": "bbe1f460330a11cf",
113
113
  "src/codemod/validationGate/types.ts": "4a1cfa054e3383d5",
114
114
  "src/detection/index.ts": "cd321fd291b7388b",
@@ -129,7 +129,7 @@
129
129
  "src/generation/database.ts": "c28a0dbabf91b6a3",
130
130
  "src/generation/generatePatternCode.ts": "342a227d461804c0",
131
131
  "src/generation/index.ts": "915500e352c2bab6",
132
- "src/generation/infrastructure.ts": "0ac7c1954a02b2cc",
132
+ "src/generation/infrastructure.ts": "42d85bb5049192e9",
133
133
  "src/generation/messagingConnections.ts": "09e70af97e055712",
134
134
  "src/generation/statementInvocation.ts": "52ecd948f60e00cb",
135
135
  "src/generation/storage.ts": "8b66549277a97279",
@@ -181,11 +181,11 @@
181
181
  "src/validation/patterns.ts": "f9629eafdad7ac3e",
182
182
  "src/validation/validationMessages.ts": "b03413b3953c3e79",
183
183
  "src/validation/validationPatterns.ts": "865f3d688975b7c8",
184
- "src/version.ts": "574eb569c8a641a2",
184
+ "src/version.ts": "1866e6e4722190d0",
185
185
  "../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
186
- "package.json": "d4bf213ee5abb777",
186
+ "package.json": "da4922cd6ee01aee",
187
187
  "tsconfig.json": "1929cf3f99fe9b1e"
188
188
  },
189
- "outputHash": "789d022ad0f1a9b92dbf55fbff13d46bb26501b94e79a334e560f3a7941a181f",
189
+ "outputHash": "d11cc8e1f0457782687decd0c46442616bfef4298e71cd750af93abfd92e3ff9",
190
190
  "outputFileCount": 343
191
191
  }
package/dist/.minified CHANGED
@@ -1 +1 @@
1
- 171 files minified at 2026-08-31T21:02:39.815Z
1
+ 171 files minified at 2026-09-01T09:01:25.384Z
@@ -1 +1 @@
1
- var R=Object.defineProperty;var r=(e,t)=>R(e,"name",{value:t,configurable:!0});import{DEPLOYABLE_PATTERN_TYPES as I,PATTERN_TYPE_VALUES as N,isPatternType as M,patternConstructId as m}from"@fjall/util";import{z as s}from"zod";import{BuildkitePropsObjectSchema as u,CDNResourcePlanSchema as l,ComputeResourcePlanSchema as g,CrossPlanConnectionResourcePlanSchema as h,DatabaseResourcePlanSchema as y,NetworkResourcePlanSchema as P,NextJSPatternConfigSchema as v,OrganisationResourcePlanSchema as S,PayloadPatternConfigSchema as w,S3ResourcePlanSchema as C,SQSResourcePlanSchema as f,StaticSitePatternConfigSchema as O,VpcPeerAccepterResourcePlanSchema as F,VpcPeerResourcePlanSchema as W}from"../schemas/index.js";import{failure as x}from"../types/Result.js";import{whenAbsent as b}from"./emitGuard.js";const n={database:"DatabaseFactory",storage:"StorageFactory",compute:"ComputeFactory",messaging:"MessagingFactory",cdn:"CdnFactory",network:"NetworkFactory",pattern:"PatternFactory","vpc-peer":"VpcPeerFactory","vpc-peer-accepter":"VpcPeerAccepterFactory","cross-plan-connection":"CrossPlanConnectionFactory",organisation:"OrganisationFactory",buildkite:"BuildkiteFactory"};function c(e){const{name:t,...a}=e.shape;return s.object(a).partial().strict()}r(c,"fragmentOf");function p(e){const{name:t,...a}=e.shape;return s.object(a).strict()}r(p,"completeFragmentOf");const j=c(y),B=c(C),V=(()=>{const{name:e,...t}=g.shape;return s.object(t).partial().strict()})(),D=(()=>{const{name:e,...t}=g.shape;return s.object(t).strict()})(),Y=c(f),G=c(l),L=c(P),E=(()=>{const{name:e,type:t,cdn:a,...A}=w.shape,{name:te,type:re,cdn:ae,...T}=v.shape,{name:ne,type:oe,domain:ce,cdn:_,...k}=O.shape;return{...A,...T,...k,cdn:s.union([a,_]),type:s.enum(I)}})(),q=s.object(E).partial().strict(),Q=s.object(E).partial().required({type:!0}).strict(),U={emitConstructId:r((e,t)=>M(t.type)?m(e,t.type):e,"emitConstructId"),locateCandidates:r(e=>[e,...N.map(t=>m(e,t))],"locateCandidates")},$=c(W),z=c(F),J=c(h),H=c(S),K=c(u);function d(e,t){return x({kind:"SemanticQueryError",reason:`StatementTypeEntry.${e} for ${t} is not wired; existing types dispatch through the shared locator/generator.`})}r(d,"notWiredError");function X(e){return{factoryIdentifier:e,findByShape:r(()=>d("locator.findByShape",e),"findByShape"),validateContext:r(()=>d("locator.validateContext",e),"validateContext")}}r(X,"createLocator");function Z(e){return{build:r(()=>{const t=d("generator.build",e);throw new Error(t.success?"unreachable":t.error.reason)},"build")}}r(Z,"createGenerator");const ee=[{property:"peerAppName",refuseWhen:b("peerAppName"),reason:"`peerAppName` is required: it is the SSM prefix every remote lookup is built from, and omitting it does NOT fail \u2014 synth succeeds and the app deploys a peering connection pointed at `/fjall/default/undefined/vpc-id`. Pass `--peerAppName <remote app>`."},{property:"peerAccountId",refuseWhen:b("peerAccountId"),reason:"`peerAccountId` is required: omitting it does NOT fail, it deploys a VPC peering connection with no `PeerOwnerId`. Pass `--peerAccountId <12-digit account>`."}];function o(e,t,a={}){return{factoryIdentifier:e,locator:X(e),generator:Z(e),schemaFragment:t,...a}}r(o,"createEntry");const i={database:o(n.database,j,{emitWrapper:{appMethod:"addDatabase"},addContract:p(y)}),storage:o(n.storage,B,{emitWrapper:{appMethod:"addStorage"},addContract:p(C)}),compute:o(n.compute,V,{emitWrapper:{appMethod:"addCompute"},addContract:D}),messaging:o(n.messaging,Y,{emitWrapper:{appMethod:"addMessaging"},addContract:p(f)}),cdn:o(n.cdn,G,{emitWrapper:{appMethod:"addCdn"},addContract:p(l)}),network:o(n.network,L,{emitWrapper:{appMethod:"addNetwork"},addContract:p(P)}),pattern:o(n.pattern,q,{emitWrapper:{appMethod:"addPattern"},addContract:Q,statementIdentity:U}),"vpc-peer":o(n["vpc-peer"],$,{emitWrapper:{appMethod:"addVpcPeer"},emitGuard:ee}),"vpc-peer-accepter":o(n["vpc-peer-accepter"],z,{emitWrapper:{appMethod:"addVpcPeerAccepter"},addContract:p(F)}),"cross-plan-connection":o(n["cross-plan-connection"],J,{addContract:p(h)}),organisation:o(n.organisation,H,{addContract:p(S)}),buildkite:o(n.buildkite,K,{emitWrapper:{appMethod:"addBuildkite",propsOverloadConstructId:"Buildkite"},addContract:p(u)})},le=Object.keys(i);function ge(e,t,a){return i[e].statementIdentity?.emitConstructId(t,a)??t}r(ge,"constructIdFor");function he(e,t){return i[e].statementIdentity?.locateCandidates(t)??[t]}r(he,"locateNamesFor");function ye(e){const t=Object.keys(i);for(const a of t)if(i[a].factoryIdentifier===e)return a}r(ye,"findTypeByIdentifier");export{n as FACTORY_IDENTIFIERS,le as REGISTERED_STATEMENT_TYPES,i as STATEMENT_REGISTRY,ge as constructIdFor,ye as findTypeByIdentifier,he as locateNamesFor};
1
+ var k=Object.defineProperty;var r=(e,t)=>k(e,"name",{value:t,configurable:!0});import{DEPLOYABLE_PATTERN_TYPES as N,PATTERN_TYPE_VALUES as R,isPatternType as v,patternConstructId as m}from"@fjall/util";import{z as s}from"zod";import{BuildkitePropsObjectSchema as u,CDNResourcePlanSchema as l,ComputeResourcePlanSchema as h,CrossPlanConnectionResourcePlanSchema as g,DatabaseResourcePlanSchema as y,NetworkResourcePlanSchema as C,NextJSPatternConfigSchema as w,OrganisationResourcePlanSchema as P,PayloadPatternConfigSchema as M,S3ResourcePlanSchema as S,SQSResourcePlanSchema as f,StaticSitePatternConfigSchema as O,VpcPeerAccepterResourcePlanSchema as F,VpcPeerResourcePlanSchema as W}from"../schemas/index.js";import{failure as x}from"../types/Result.js";import{whenAbsent as b}from"./emitGuard.js";const n={database:"DatabaseFactory",storage:"StorageFactory",compute:"ComputeFactory",messaging:"MessagingFactory",cdn:"CdnFactory",network:"NetworkFactory",pattern:"PatternFactory","vpc-peer":"VpcPeerFactory","vpc-peer-accepter":"VpcPeerAccepterFactory","cross-plan-connection":"CrossPlanConnectionFactory",organisation:"OrganisationFactory",buildkite:"BuildkiteFactory"};function c(e){const{name:t,...a}=e.shape;return s.object(a).partial().strict()}r(c,"fragmentOf");function p(e){const{name:t,...a}=e.shape;return s.object(a).strict()}r(p,"completeFragmentOf");const j=c(y),V=c(S),B=(()=>{const{name:e,...t}=h.shape;return s.object(t).partial().strict()})(),D=(()=>{const{name:e,...t}=h.shape;return s.object(t).strict()})(),L=c(f),Y=c(l),G=c(C),A=(()=>{const{name:e,type:t,cdn:a,...E}=M.shape,{name:te,type:re,cdn:ae,...T}=w.shape,{name:ne,type:oe,domain:ce,cdn:I,..._}=O.shape;return{...E,...T,..._,cdn:s.union([a,I]),type:s.enum(N)}})(),q=s.object(A).partial().strict(),Q=s.object(A).partial().required({type:!0}).strict(),U={emitConstructId:r((e,t)=>v(t.type)?m(e,t.type):e,"emitConstructId"),locateCandidates:r(e=>[e,...R.map(t=>m(e,t))],"locateCandidates")},$=c(W),z=c(F),J=c(g),H=c(P),K=c(u);function d(e,t){return x({kind:"SemanticQueryError",reason:`StatementTypeEntry.${e} for ${t} is not wired; existing types dispatch through the shared locator/generator.`})}r(d,"notWiredError");function X(e){return{factoryIdentifier:e,findByShape:r(()=>d("locator.findByShape",e),"findByShape"),validateContext:r(()=>d("locator.validateContext",e),"validateContext")}}r(X,"createLocator");function Z(e){return{build:r(()=>{const t=d("generator.build",e);throw new Error(t.success?"unreachable":t.error.reason)},"build")}}r(Z,"createGenerator");const ee=[{property:"peerAppName",refuseWhen:b("peerAppName"),reason:"`peerAppName` is required: it is the SSM prefix every remote lookup is built from, and omitting it does NOT fail \u2014 synth succeeds and the app deploys a peering connection pointed at `/fjall/default/undefined/vpc-id`. Provide `peerAppName`, the remote application to peer with (CLI: `--peerAppName <remote app>`)."},{property:"peerAccountId",refuseWhen:b("peerAccountId"),reason:"`peerAccountId` is required: omitting it does NOT fail, it deploys a VPC peering connection with no `PeerOwnerId`. Provide `peerAccountId`, the 12-digit account that owns the remote VPC (CLI: `--peerAccountId <12-digit account>`)."}];function o(e,t,a={}){return{factoryIdentifier:e,locator:X(e),generator:Z(e),schemaFragment:t,...a}}r(o,"createEntry");const i={database:o(n.database,j,{emitWrapper:{appMethod:"addDatabase"},addContract:p(y)}),storage:o(n.storage,V,{emitWrapper:{appMethod:"addStorage"},addContract:p(S)}),compute:o(n.compute,B,{emitWrapper:{appMethod:"addCompute"},addContract:D}),messaging:o(n.messaging,L,{emitWrapper:{appMethod:"addMessaging"},addContract:p(f)}),cdn:o(n.cdn,Y,{emitWrapper:{appMethod:"addCdn"},addContract:p(l)}),network:o(n.network,G,{emitWrapper:{appMethod:"addNetwork"},addContract:p(C)}),pattern:o(n.pattern,q,{emitWrapper:{appMethod:"addPattern"},addContract:Q,statementIdentity:U}),"vpc-peer":o(n["vpc-peer"],$,{emitWrapper:{appMethod:"addVpcPeer"},emitGuard:ee}),"vpc-peer-accepter":o(n["vpc-peer-accepter"],z,{emitWrapper:{appMethod:"addVpcPeerAccepter"},addContract:p(F)}),"cross-plan-connection":o(n["cross-plan-connection"],J,{addContract:p(g)}),organisation:o(n.organisation,H,{addContract:p(P)}),buildkite:o(n.buildkite,K,{emitWrapper:{appMethod:"addBuildkite",propsOverloadConstructId:"Buildkite"},addContract:p(u)})},le=Object.keys(i);function he(e,t,a){return i[e].statementIdentity?.emitConstructId(t,a)??t}r(he,"constructIdFor");function ge(e,t){return i[e].statementIdentity?.locateCandidates(t)??[t]}r(ge,"locateNamesFor");function ye(e){const t=Object.keys(i);for(const a of t)if(i[a].factoryIdentifier===e)return a}r(ye,"findTypeByIdentifier");export{n as FACTORY_IDENTIFIERS,le as REGISTERED_STATEMENT_TYPES,i as STATEMENT_REGISTRY,he as constructIdFor,ye as findTypeByIdentifier,ge as locateNamesFor};
@@ -1 +1 @@
1
- var a=Object.defineProperty;var s=(e,r)=>a(e,"name",{value:r,configurable:!0});import{failure as p,success as c}from"../../../types/Result.js";import{STATEMENT_REGISTRY as d}from"../../registry.js";const h={id:"schema",run(e){const r=d[e.plan.type],n=(e.plan.op==="add"?r.addContract??r.schemaFragment:r.schemaFragment).safeParse(e.plan.properties);return n.success?c({action:"proceed"}):p(u(e,n.error))}};function u(e,r){const t=f(e,r);if(t.length>0){const o=t.map(i=>`\`${i}\``).join(", ");return{kind:"InvalidPropertyError",property:t[0]??"<unknown>",reason:`required for a new ${e.plan.type} and not provided (missing: ${o}). Nothing has been written.`}}const n=r.issues[0];if(n!==void 0&&n.code==="unrecognized_keys"){const o=n.keys.map(i=>`\`${i}\``).join(", ");return{kind:"InvalidPropertyError",property:n.keys[0]??"<unknown>",reason:`not a ${e.plan.type} property (unrecognised: ${o}). Nothing has been written.`}}return{kind:"InvalidPropertyError",property:n!==void 0&&n.path.length>0?String(n.path[0]):Object.keys(e.plan.properties)[0]??"<unknown>",reason:n?.message??"Schema validation failed"}}s(u,"toInvalidPropertyError");function f(e,r){const t=[];for(const n of r.issues){if(n.path.length!==1)continue;const o=n.path[0];typeof o=="string"&&(o in e.plan.properties||t.includes(o)||t.push(o))}return t}s(f,"missingRequiredKeys");export{h as schemaGate};
1
+ var u=Object.defineProperty;var o=(e,r)=>u(e,"name",{value:r,configurable:!0});import{failure as c,success as d}from"../../../types/Result.js";import{STATEMENT_REGISTRY as f}from"../../registry.js";const k={id:"schema",run(e){const r=f[e.plan.type],i=e.plan.op==="add"?r.addContract??r.schemaFragment:r.schemaFragment,t=i.safeParse(e.plan.properties);return t.success?d({action:"proceed"}):c(y(e,t.error,i))}};function y(e,r,i){const t=h(e,r);if(t.length>0)return{kind:"InvalidPropertyError",property:t[0]??"<unknown>",reason:`required for a new ${e.plan.type} and not provided (missing: ${s(t)}). Nothing has been written.`};const n=r.issues[0];if(n!==void 0&&n.code==="unrecognized_keys"){const a=s(n.keys),p=s(Object.keys(i.shape));return{kind:"InvalidPropertyError",property:n.keys[0]??"<unknown>",reason:`not a ${e.plan.type} property (unrecognised: ${a}; permitted: ${p}). Nothing has been written.`}}return{kind:"InvalidPropertyError",property:n!==void 0&&n.path.length>0?String(n.path[0]):Object.keys(e.plan.properties)[0]??"<unknown>",reason:`${n?.message??"Schema validation failed"}. Nothing has been written.`}}o(y,"toInvalidPropertyError");function s(e){return e.map(r=>`\`${r}\``).join(", ")}o(s,"formatKeyList");function h(e,r){const i=[];for(const t of r.issues){if(t.path.length!==1)continue;const n=t.path[0];typeof n=="string"&&(n in e.plan.properties||i.includes(n)||i.push(n))}return i}o(h,"missingRequiredKeys");export{k as schemaGate};
@@ -7,7 +7,6 @@
7
7
  import type { ApplicationResourcePlan } from "../schemas/resourceSchemas.js";
8
8
  export { OPENNEXT_DEFAULTS, generatePatternCodeWithComments, } from "./generatePatternCode.js";
9
9
  export declare const COST_ALLOCATION_TAG: "fjall:costAllocation:owner";
10
- export declare const DEFAULT_COST_ALLOCATION_OWNER: "engineering";
11
10
  /**
12
11
  * Generate network infrastructure code for additional networks
13
12
  */
@@ -1,13 +1,13 @@
1
- var y=Object.defineProperty;var r=(e,t)=>y(e,"name",{value:t,configurable:!0});import{toVariableName as N,formatValue as f,resolveResourceVariable as p,emitExtraProperties as T}from"./common.js";import{COMPUTE_TYPE as g}from"../schemas/constants.js";import{scalingTypeBinding as b}from"../projection/compute.js";import{projectLambdaProps as $}from"./compute/lambda.js";import{collectProjectedPropImports as A}from"./structuredSource.js";import{CDN_INVOCATION as s,COMPUTE_INVOCATION as O,DATABASE_INVOCATION as d,MESSAGING_INVOCATION as C,NETWORK_INVOCATION as u,PATTERN_INVOCATION as I,STORAGE_INVOCATION as w}from"./statementInvocation.js";import{OPENNEXT_DEFAULTS as W,generatePatternCodeWithComments as Y}from"./generatePatternCode.js";const h="fjall:costAllocation:owner",P="engineering";function k(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}r(k,"isEmptyObject");function l(e){const t={...e};return k(t.flowLogs)&&delete t.flowLogs,t}r(l,"cleanNetworkConfig");function V(e){if(!e.additionalNetworks||e.additionalNetworks.length===0)return"";let t="";for(const n of e.additionalNetworks){const i=N(n.name),o={};n.maxAzs!==void 0&&(o.maxAzs=n.maxAzs),n.natGateways!==void 0&&(o.natGateways=n.natGateways),n.flowLogs!==void 0&&(o.flowLogs=n.flowLogs),n.vpcEndpoints!==void 0&&(o.vpcEndpoints=n.vpcEndpoints);const c=l(o);t+=`const ${i} = app.${u.appMethod}(
1
+ var y=Object.defineProperty;var r=(e,t)=>y(e,"name",{value:t,configurable:!0});import{DEFAULT_COST_ALLOCATION_OWNER as N}from"@fjall/util/aws";import{toVariableName as T,formatValue as f,resolveResourceVariable as p,emitExtraProperties as b}from"./common.js";import{COMPUTE_TYPE as g}from"../schemas/constants.js";import{scalingTypeBinding as $}from"../projection/compute.js";import{projectLambdaProps as A}from"./compute/lambda.js";import{collectProjectedPropImports as O}from"./structuredSource.js";import{CDN_INVOCATION as s,COMPUTE_INVOCATION as C,DATABASE_INVOCATION as d,MESSAGING_INVOCATION as I,NETWORK_INVOCATION as u,PATTERN_INVOCATION as w,STORAGE_INVOCATION as P}from"./statementInvocation.js";import{OPENNEXT_DEFAULTS as Y,generatePatternCodeWithComments as K}from"./generatePatternCode.js";const h="fjall:costAllocation:owner";function k(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}r(k,"isEmptyObject");function l(e){const t={...e};return k(t.flowLogs)&&delete t.flowLogs,t}r(l,"cleanNetworkConfig");function D(e){if(!e.additionalNetworks||e.additionalNetworks.length===0)return"";let t="";for(const n of e.additionalNetworks){const i=T(n.name),o={};n.maxAzs!==void 0&&(o.maxAzs=n.maxAzs),n.natGateways!==void 0&&(o.natGateways=n.natGateways),n.flowLogs!==void 0&&(o.flowLogs=n.flowLogs),n.vpcEndpoints!==void 0&&(o.vpcEndpoints=n.vpcEndpoints);const c=l(o);t+=`const ${i} = app.${u.appMethod}(
2
2
  ${u.factory}.build("${n.name}", ${f(c," ")})
3
3
  );
4
4
 
5
- `}return t}r(V,"generateNetworkCode");function D(e){const t={};return e.tags&&Object.keys(e.tags).length>0&&Object.assign(t,e.tags),t[h]||(t[h]=e.owner||P),`app.addTags({
5
+ `}return t}r(D,"generateNetworkCode");function M(e){const t={};return e.tags&&Object.keys(e.tags).length>0&&Object.assign(t,e.tags),t[h]||(t[h]=e.owner||N),`app.addTags({
6
6
  ${Object.entries(t).map(([i,o])=>` "${i}": "${o}"`).join(`,
7
7
  `)}
8
8
  });
9
9
 
10
- `}r(D,"generateTags");function M(e){let t=`
10
+ `}r(M,"generateTags");function H(e){let t=`
11
11
  const appName = "${e.appName}";
12
12
  `;const n=e.backup&&typeof e.backup=="object"?e.backup:void 0,i=e.tunnel&&typeof e.tunnel=="object"?e.tunnel:void 0,o=i?i.instanceType?`tunnel: { instanceType: "${i.instanceType}" }`:"tunnel: true":void 0;if(e.vpcId)t+=`const app = App.getApp(appName, {
13
13
  network: { useExisting: "${e.vpcId}" }`,n&&(t+=`,
@@ -21,11 +21,11 @@ const appName = "${e.appName}";
21
21
  });
22
22
  `}else t+="const app = App.getApp(appName, { network: false",n&&(t+=`, backup: { tier: "${n.tier}" }`),o&&(t+=`, ${o}`),t+=` });
23
23
  `;return t+=`
24
- `,t}r(M,"generateAppInit");function j(e){const t=[],n=r(i=>{for(const o of i)t.includes(o)||t.push(o)},"add");for(const i of e.compute)if(i.type===g.LAMBDA&&n(A($(i))),i.type===g.ECS)for(const o of i.services??[])typeof o.scaling=="object"&&o.scaling.scalingType&&n(b(o.scaling.scalingType)?.imports??[]);return t}r(j,"collectComputeImports");function H(e){const t=[];if(e.patternConfig)t.push(I.factory);else{e.database.length>0&&t.push(d.factory),e.s3.length>0&&t.push(w.factory),e.compute.length>0&&t.push(O.factory),(e.compute.length>0||e.database.length>0||e.sqs!==void 0&&e.sqs.length>0)&&t.push("getConfig"),e.dynamodb&&e.dynamodb.length>0&&e.database.length===0&&t.push(d.factory),e.clickhouse&&e.clickhouse.length>0&&e.database.length===0&&!(e.dynamodb&&e.dynamodb.length>0)&&t.push(d.factory),e.sqs&&e.sqs.length>0&&t.push(C.factory),e.cdn&&t.push(s.factory);for(const o of j(e))t.includes(o)||t.push(o)}if(e.additionalNetworks&&e.additionalNetworks.length>0&&t.push(u.factory),e.additionalManagedImports){for(const o of e.additionalManagedImports)if(o.moduleSpecifier==="@fjall/components-infrastructure"||o.moduleSpecifier==="@fjall/infrastructure")for(const c of o.namedImports)t.includes(c)||t.push(c)}let i=`#!/usr/bin/env node
24
+ `,t}r(H,"generateAppInit");function j(e){const t=[],n=r(i=>{for(const o of i)t.includes(o)||t.push(o)},"add");for(const i of e.compute)if(i.type===g.LAMBDA&&n(O(A(i))),i.type===g.ECS)for(const o of i.services??[])typeof o.scaling=="object"&&o.scaling.scalingType&&n($(o.scaling.scalingType)?.imports??[]);return t}r(j,"collectComputeImports");function B(e){const t=[];if(e.patternConfig)t.push(w.factory);else{e.database.length>0&&t.push(d.factory),e.s3.length>0&&t.push(P.factory),e.compute.length>0&&t.push(C.factory),(e.compute.length>0||e.database.length>0||e.sqs!==void 0&&e.sqs.length>0)&&t.push("getConfig"),e.dynamodb&&e.dynamodb.length>0&&e.database.length===0&&t.push(d.factory),e.clickhouse&&e.clickhouse.length>0&&e.database.length===0&&!(e.dynamodb&&e.dynamodb.length>0)&&t.push(d.factory),e.sqs&&e.sqs.length>0&&t.push(I.factory),e.cdn&&t.push(s.factory);for(const o of j(e))t.includes(o)||t.push(o)}if(e.additionalNetworks&&e.additionalNetworks.length>0&&t.push(u.factory),e.additionalManagedImports){for(const o of e.additionalManagedImports)if(o.moduleSpecifier==="@fjall/components-infrastructure"||o.moduleSpecifier==="@fjall/infrastructure")for(const c of o.namedImports)t.includes(c)||t.push(c)}let i=`#!/usr/bin/env node
25
25
 
26
26
  import { App${t.length>0?`, ${t.join(", ")}`:""} } from "@fjall/components-infrastructure";
27
27
  `;if(e.additionalManagedImports)for(const o of e.additionalManagedImports){if(o.moduleSpecifier==="@fjall/components-infrastructure"||o.moduleSpecifier==="@fjall/infrastructure")continue;const c=o.namedImports.length>0?`{ ${o.namedImports.join(", ")} }`:"",m=[o.defaultImport??"",c].filter(Boolean).join(", ");m&&(i+=`import ${m} from "${o.moduleSpecifier}";
28
- `)}return i}r(H,"generateImports");function E(e){if(!e.cdn)return!1;const t=e.compute.find(o=>o.name===e.cdn?.defaultOriginRef);if(t===void 0||t.type!=="ecs")return!1;const n=t.cluster;return n?.domain!==void 0?!1:!(n?.extraProperties??[]).some(o=>o.key==="domainConfig")}r(E,"cdnDefaultOriginNeedsAlbLane");function B(e){if(!e.cdn)return"";const t=p(e,e.cdn.defaultOriginRef);let n=E(e)?`
28
+ `)}return i}r(B,"generateImports");function E(e){if(!e.cdn)return!1;const t=e.compute.find(o=>o.name===e.cdn?.defaultOriginRef);if(t===void 0||t.type!=="ecs")return!1;const n=t.cluster;return n?.domain!==void 0?!1:!(n?.extraProperties??[]).some(o=>o.key==="domainConfig")}r(E,"cdnDefaultOriginNeedsAlbLane");function q(e){if(!e.cdn)return"";const t=p(e,e.cdn.defaultOriginRef);let n=E(e)?`
29
29
  app.${s.appMethod}(
30
30
  ${s.factory}.build("${e.cdn.name}", {
31
31
  // Plain-HTTP origin fetch: the compute has no domain, so no TLS-valid
@@ -51,7 +51,7 @@ app.${s.appMethod}(
51
51
  certificateArn: "${e.cdn.certificateArn}"`),e.cdn.originHostname&&(n+=`,
52
52
  originHostname: "${e.cdn.originHostname}"`),e.cdn.accessGate!==void 0&&(e.cdn.accessGate===!1?n+=`,
53
53
  accessGate: false`:n+=`,
54
- accessGate: ${f(e.cdn.accessGate," ")}`),n+=T(e.cdn.extraProperties),n+=`
54
+ accessGate: ${f(e.cdn.accessGate," ")}`),n+=b(e.cdn.extraProperties),n+=`
55
55
  })
56
56
  );
57
- `,n}r(B,"generateCDNCode");function q(e){const t=new Set;if(e.cdn&&(e.cdn.defaultOriginRef&&t.add(e.cdn.defaultOriginRef),e.cdn.behaviours))for(const n of e.cdn.behaviours)t.add(n.originRef);return t}r(q,"collectCdnReferencedResources");function U(e){return e.patternConfig!==void 0}r(U,"usesPatternApproach");export{h as COST_ALLOCATION_TAG,P as DEFAULT_COST_ALLOCATION_OWNER,W as OPENNEXT_DEFAULTS,E as cdnDefaultOriginNeedsAlbLane,q as collectCdnReferencedResources,M as generateAppInit,B as generateCDNCode,H as generateImports,V as generateNetworkCode,Y as generatePatternCodeWithComments,D as generateTags,U as usesPatternApproach};
57
+ `,n}r(q,"generateCDNCode");function U(e){const t=new Set;if(e.cdn&&(e.cdn.defaultOriginRef&&t.add(e.cdn.defaultOriginRef),e.cdn.behaviours))for(const n of e.cdn.behaviours)t.add(n.originRef);return t}r(U,"collectCdnReferencedResources");function z(e){return e.patternConfig!==void 0}r(z,"usesPatternApproach");export{h as COST_ALLOCATION_TAG,Y as OPENNEXT_DEFAULTS,E as cdnDefaultOriginNeedsAlbLane,U as collectCdnReferencedResources,H as generateAppInit,q as generateCDNCode,B as generateImports,D as generateNetworkCode,K as generatePatternCodeWithComments,M as generateTags,z as usesPatternApproach};
@@ -1 +1 @@
1
- export declare const GENERATOR_VERSION = "27.1.0";
1
+ export declare const GENERATOR_VERSION = "28.1.0";
@@ -1 +1 @@
1
- const E="27.1.0";export{E as GENERATOR_VERSION};
1
+ const E="28.1.0";export{E as GENERATOR_VERSION};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/generator",
3
- "version": "27.1.0",
3
+ "version": "28.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/fjall-tech/fjall.git",
@@ -58,7 +58,7 @@
58
58
  "license": "SEE LICENSE IN LICENSE",
59
59
  "dependencies": {
60
60
  "@babel/parser": "^7.29.8",
61
- "@fjall/util": "^27.1.0",
61
+ "@fjall/util": "^28.1.0",
62
62
  "ast-types": "^0.16.1",
63
63
  "recast": "^0.23.12",
64
64
  "ts-morph": "^28.0.0",