@fjall/generator 23.0.0 → 25.0.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/.build-source-hash +8 -8
- package/dist/.minified +1 -1
- package/dist/src/ast/astTestHelpers.d.ts +9 -0
- package/dist/src/ast/parsers/resources/astPatternParser.d.ts +10 -1
- package/dist/src/ast/parsers/resources/astPatternParser.js +1 -1
- package/dist/src/generation/generatePatternCode.js +11 -11
- package/dist/src/planning/staticSitePlanning.d.ts +11 -4
- package/dist/src/schemas/applicationSchemas.d.ts +13 -0
- package/dist/src/schemas/patternSchemas.d.ts +44 -0
- package/dist/src/schemas/patternSchemas.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +3 -2
package/dist/.build-source-hash
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"package.json",
|
|
10
10
|
"tsconfig.json"
|
|
11
11
|
],
|
|
12
|
-
"hash": "
|
|
12
|
+
"hash": "6d81781923e177038bb9a5337333169cbfefbf92333371e66e09ee752fb67d19",
|
|
13
13
|
"files": {
|
|
14
14
|
"src/ast/astTestHelpers.ts": "026cac849eb88bdb",
|
|
15
15
|
"src/ast/domain/astDomainParser.ts": "a88b990396db0a46",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"src/ast/parsers/resources/astDynamoDBParser.ts": "809c2c633447b388",
|
|
32
32
|
"src/ast/parsers/resources/astMessagingParser.ts": "b185ec22e6b96943",
|
|
33
33
|
"src/ast/parsers/resources/astNetworkParser.ts": "8697dccb454eac7d",
|
|
34
|
-
"src/ast/parsers/resources/astPatternParser.ts": "
|
|
34
|
+
"src/ast/parsers/resources/astPatternParser.ts": "b9c8cbfd593d8fa6",
|
|
35
35
|
"src/ast/parsers/resources/astScheduleParser.ts": "dbdac640c75b8bd3",
|
|
36
36
|
"src/ast/parsers/resources/astStorageParser.ts": "309bc3257f46cfdf",
|
|
37
37
|
"src/aws/regions.ts": "a028bcb92b0e41d9",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"src/generation/compute/shared.ts": "3724d4bfe92cfcb7",
|
|
128
128
|
"src/generation/connectionWiring.ts": "9afb0227f2584ab2",
|
|
129
129
|
"src/generation/database.ts": "c28a0dbabf91b6a3",
|
|
130
|
-
"src/generation/generatePatternCode.ts": "
|
|
130
|
+
"src/generation/generatePatternCode.ts": "342a227d461804c0",
|
|
131
131
|
"src/generation/index.ts": "915500e352c2bab6",
|
|
132
132
|
"src/generation/infrastructure.ts": "0ac7c1954a02b2cc",
|
|
133
133
|
"src/generation/messagingConnections.ts": "09e70af97e055712",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"src/planning/resourceAddition.ts": "7d0320620a74fdcd",
|
|
144
144
|
"src/planning/resourceConnections.ts": "a6b7db8f733e560f",
|
|
145
145
|
"src/planning/resourcePlanning.ts": "d6bb9fa8e1419908",
|
|
146
|
-
"src/planning/staticSitePlanning.ts": "
|
|
146
|
+
"src/planning/staticSitePlanning.ts": "4440e71a2eac5efc",
|
|
147
147
|
"src/presets/clickhouseTierPreset.ts": "1758d991c81d769a",
|
|
148
148
|
"src/presets/index.ts": "8332c0198b2a6fe9",
|
|
149
149
|
"src/presets/patternTierPresets.ts": "f4fc368fc623aae4",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"src/schemas/messagingSchemas.ts": "2c1975fac903fd1b",
|
|
172
172
|
"src/schemas/networkSchemas.ts": "c3a5f30e440dd2f8",
|
|
173
173
|
"src/schemas/organisationSchemas.ts": "50d793aa7ff7f749",
|
|
174
|
-
"src/schemas/patternSchemas.ts": "
|
|
174
|
+
"src/schemas/patternSchemas.ts": "8f9de91fca0571d3",
|
|
175
175
|
"src/schemas/resourceSchemas.ts": "cd050813242ea213",
|
|
176
176
|
"src/schemas/securityBoundary.ts": "54d216807103bab8",
|
|
177
177
|
"src/schemas/sharedTypes.ts": "45210e600bea393e",
|
|
@@ -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": "
|
|
184
|
+
"src/version.ts": "02f8fccc72ba033d",
|
|
185
185
|
"../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
|
|
186
|
-
"package.json": "
|
|
186
|
+
"package.json": "9de423232f97e01c",
|
|
187
187
|
"tsconfig.json": "1929cf3f99fe9b1e"
|
|
188
188
|
},
|
|
189
|
-
"outputHash": "
|
|
189
|
+
"outputHash": "369bcc2b8a51df82c5d654f8a08c0510549639868f801918f269d7995b72c54a",
|
|
190
190
|
"outputFileCount": 343
|
|
191
191
|
}
|
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
171 files minified at 2026-08-
|
|
1
|
+
171 files minified at 2026-08-31T01:55:55.929Z
|
|
@@ -348,6 +348,8 @@ export declare function parseAndConvert(code: string): {
|
|
|
348
348
|
contentSecurityPolicy?: string | undefined;
|
|
349
349
|
} | undefined;
|
|
350
350
|
domain?: string | undefined;
|
|
351
|
+
zoneName?: string | undefined;
|
|
352
|
+
hostedZoneId?: string | undefined;
|
|
351
353
|
forms?: {
|
|
352
354
|
to: string;
|
|
353
355
|
from?: string | undefined;
|
|
@@ -356,6 +358,13 @@ export declare function parseAndConvert(code: string): {
|
|
|
356
358
|
} | undefined;
|
|
357
359
|
cdn?: {
|
|
358
360
|
behaviours?: unknown[] | undefined;
|
|
361
|
+
priceClass?: "PriceClass_100" | "PriceClass_200" | "PriceClass_All" | undefined;
|
|
362
|
+
invalidateOnDeploy?: boolean | undefined;
|
|
363
|
+
} | undefined;
|
|
364
|
+
accessGate?: {
|
|
365
|
+
type: "basic-auth";
|
|
366
|
+
username: string;
|
|
367
|
+
password: string;
|
|
359
368
|
} | undefined;
|
|
360
369
|
} | {
|
|
361
370
|
type: "payload";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as ts from "typescript";
|
|
8
8
|
import type { ApplicationResourcePlan } from "../../../schemas/resourceSchemas.js";
|
|
9
|
-
import { type StaticSiteRouting } from "@fjall/util";
|
|
9
|
+
import { type CloudFrontPriceClass, type StaticSiteRouting } from "@fjall/util";
|
|
10
10
|
/** Parsed Lambda function configuration */
|
|
11
11
|
export interface ParsedLambdaConfig {
|
|
12
12
|
memorySize?: number;
|
|
@@ -105,6 +105,8 @@ export interface ParsedStaticSitePatternConfig {
|
|
|
105
105
|
contentSecurityPolicy?: string;
|
|
106
106
|
};
|
|
107
107
|
domain?: string;
|
|
108
|
+
zoneName?: string;
|
|
109
|
+
hostedZoneId?: string;
|
|
108
110
|
forms?: {
|
|
109
111
|
to?: string;
|
|
110
112
|
from?: string;
|
|
@@ -113,6 +115,13 @@ export interface ParsedStaticSitePatternConfig {
|
|
|
113
115
|
};
|
|
114
116
|
cdn?: {
|
|
115
117
|
behaviours?: unknown[];
|
|
118
|
+
priceClass?: CloudFrontPriceClass;
|
|
119
|
+
invalidateOnDeploy?: boolean;
|
|
120
|
+
};
|
|
121
|
+
accessGate?: {
|
|
122
|
+
type?: "basic-auth";
|
|
123
|
+
username?: string;
|
|
124
|
+
password?: string;
|
|
116
125
|
};
|
|
117
126
|
/**
|
|
118
127
|
* Field paths that were PRESENT in the literal but resolved to a const
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var
|
|
1
|
+
var v=Object.defineProperty;var s=(t,e)=>v(t,"name",{value:e,configurable:!0});import*as x from"typescript";import{CLOUDFRONT_PRICE_CLASS_VALUES as P,STATIC_SITE_ROUTING_VALUES as _}from"@fjall/util";import{asBoolean as y,asNumber as c,asString as a,asStringArray as N,asStringUnion as g,asObjectOrFalse as h,collectFromAst as z,extractSubConfig as u,extractVariableName as D,isFactoryBuildCall as L,isFactoryMethodCall as E,isParsedObject as A,isPlainObject as F,parseObjectLiteral as G,parseOptionalConfig as m,typed as b}from"../common/astCommonParser.js";import{parseDeadLetterQueueConfig as C}from"./astMessagingParser.js";const R=["Instance","Aurora"],T=["postgresql","mysql"];function O(t){if(!A(t))return;const e={...t.memorySize!==void 0&&{memorySize:c(t.memorySize)},...t.timeout!==void 0&&{timeout:c(t.timeout)},...t.ephemeralStorageSize!==void 0&&{ephemeralStorageSize:c(t.ephemeralStorageSize)}};return Object.keys(e).length>0?e:void 0}s(O,"parseLambdaConfig");function U(t){return u(t,"database",e=>({type:g(e.type,R),databaseName:a(e.databaseName),databaseEngine:g(e.databaseEngine,T),deletionProtection:y(e.deletionProtection),backupRetention:c(e.backupRetention),port:c(e.port),publiclyAccessible:y(e.publiclyAccessible),allowedIpCidr:a(e.allowedIpCidr),instanceType:a(e.instanceType),allocatedStorage:c(e.allocatedStorage),multiAz:y(e.multiAz),allowVpcAccess:y(e.allowVpcAccess),monitoringInterval:c(e.monitoringInterval),preferredMaintenanceWindow:a(e.preferredMaintenanceWindow),snapshotIdentifier:a(e.snapshotIdentifier),snapshotUsername:a(e.snapshotUsername),readReplica:h(e.readReplica),writer:m(e.writer,b()),readers:h(e.readers),databaseInsights:h(e.databaseInsights),proxy:h(e.proxy),credentials:m(e.credentials,b()),encryption:m(e.encryption,b())}))}s(U,"extractPatternDatabaseConfig");function k(t){return u(t,"compute",e=>({server:m(e.server,O),imageOptimisation:m(e.imageOptimisation,O),revalidation:m(e.revalidation,O)}))}s(k,"extractPatternComputeConfig");function V(t){const e=s(n=>({versioned:y(n.versioned)}),"parseVersionedConfig");return u(t,"storage",n=>({assets:m(n.assets,e),cache:m(n.cache,e),media:m(n.media,e)}))}s(V,"extractPatternStorageConfig");function j(t){return u(t,"messaging",e=>({revalidationQueue:m(e.revalidationQueue,n=>({visibilityTimeout:c(n.visibilityTimeout),messageRetentionPeriod:c(n.messageRetentionPeriod),maxMessageSize:c(n.maxMessageSize),deadLetterQueue:C(n.deadLetterQueue)}))}))}s(j,"extractPatternMessagingConfig");function w(t){return u(t,"cdn",e=>({domainNames:N(e.domainNames),certificateArn:a(e.certificateArn)}))}s(w,"extractPatternCdnConfig");function M(t){return u(t,"environment",e=>{const n=Object.fromEntries(Object.entries(e).filter(r=>typeof r[1]=="string"));return Object.keys(n).length>0?n:void 0})}s(M,"extractPatternEnvironmentConfig");function Z(t,e){const n=B(t);return{name:e,source:a(t.source),build:u(t,"build",r=>({command:a(r.command),outputDir:a(r.outputDir)})),routing:g(t.routing,_),security:u(t,"security",r=>({headers:y(r.headers),contentSecurityPolicy:a(r.contentSecurityPolicy)})),domain:a(t.domain),zoneName:a(t.zoneName),hostedZoneId:a(t.hostedZoneId),forms:u(t,"forms",r=>({to:a(r.to),from:a(r.from),corsOrigin:a(r.corsOrigin),maxConcurrency:c(r.maxConcurrency)})),cdn:u(t,"cdn",r=>({behaviours:Array.isArray(r.behaviours)?r.behaviours:void 0,priceClass:g(r.priceClass,P),invalidateOnDeploy:y(r.invalidateOnDeploy)})),accessGate:u(t,"accessGate",r=>({type:g(r.type,["basic-auth"]),username:a(r.username),password:a(r.password)})),...n.length>0&&{unreadableFields:n}}}s(Z,"extractStaticSiteConfig");function I(t){return F(t)&&("__identifier"in t||"__expression"in t||"__call"in t||"__unknown"in t)}s(I,"isUnreadableRef");function B(t){const e=[],n=s((i,o)=>{I(i)&&e.push(o)},"check");n(t.source,"source"),n(t.routing,"routing"),n(t.domain,"domain"),n(t.zoneName,"zoneName"),n(t.hostedZoneId,"hostedZoneId");const r=[[t.build,"build",["command","outputDir"]],[t.security,"security",["headers","contentSecurityPolicy"]],[t.forms,"forms",["to","from","corsOrigin","maxConcurrency"]],[t.cdn,"cdn",["behaviours","priceClass","invalidateOnDeploy"]],[t.accessGate,"accessGate",["type","username","password"]]];for(const[i,o,d]of r)if(I(i))e.push(o);else if(A(i))for(const l of d)n(i[l],`${o}.${l}`);return e}s(B,"collectUnreadableStaticSiteFields");function p(t){return t!==void 0&&t!==""}s(p,"isReadable");function S(t,e){return new Error(`Static-site pattern '${t}' in infrastructure.ts: Fjall could not read ${e.join(", ")} as inline literal(s). Fjall reads these fields out of the file and writes them back, so they must be written inline (source: "./site"), not as a variable or an expression.`)}s(S,"unreadableStaticSiteFields");function Q(t,e){const n=e.to;if(!p(n))throw S(t,["forms.to"]);return{to:n,...e.from!==void 0&&{from:e.from},...e.corsOrigin!==void 0&&{corsOrigin:e.corsOrigin},...e.maxConcurrency!==void 0&&{maxConcurrency:e.maxConcurrency}}}s(Q,"readStaticSiteForms");function $(t,e){const n=[];if(e.type!=="basic-auth"&&n.push("accessGate.type"),p(e.username)||n.push("accessGate.username"),p(e.password)||n.push("accessGate.password"),n.length>0||e.username===void 0||e.password===void 0)throw S(t,n);return{type:"basic-auth",username:e.username,password:e.password}}s($,"readStaticSiteAccessGate");function W(t,e){if(t.arguments.length<2)return null;const n=t.arguments[0],r=t.arguments[1];if(!x.isStringLiteral(n)||!x.isObjectLiteralExpression(r))return null;const i=n.text,o=G(r),d=o.type,l=D(e),f=a(o.name);return f?d==="payload"||d==="nextjs"?{variableName:l,constructId:i,type:d,config:{name:f,domain:a(o.domain),database:U(o),compute:k(o),storage:V(o),messaging:j(o),cdn:w(o),environment:M(o)},node:t}:d==="staticsite"?{variableName:l,constructId:i,type:"staticsite",config:Z(o,f),node:t}:null:null}s(W,"extractPatternResource");function X(t){return z(t,e=>{if(!x.isCallExpression(e)||!E(e,"addPattern"))return null;const n=e.arguments[0];return L(n,"PatternFactory")?W(n,e):null})}s(X,"findPatternResources");function q(t,e){if(!e||e.length===0)return;const n=e[0];if(t.pattern=n.type,n.type==="staticsite"){const{config:i}=n,o=i.source,d=i.build?.command,l=i.build?.outputDir;if(i.unreadableFields!==void 0)throw S(i.name,i.unreadableFields);if(!p(o)||!p(d)||!p(l)){const f=[];throw p(o)||f.push("source"),p(d)||f.push("build.command"),p(l)||f.push("build.outputDir"),S(i.name,f)}t.patternConfig={type:"staticsite",name:i.name,source:o,build:{command:d,outputDir:l},routing:i.routing,security:i.security,domain:i.domain,zoneName:i.zoneName,hostedZoneId:i.hostedZoneId,...i.forms!==void 0&&{forms:Q(i.name,i.forms)},cdn:i.cdn,...i.accessGate!==void 0&&{accessGate:$(i.name,i.accessGate)}};return}const{config:r}=n;t.patternConfig={type:n.type,name:r.name,domain:r.domain,database:r.database,compute:r.compute,storage:r.storage,messaging:r.messaging,cdn:r.cdn,environment:r.environment}}s(q,"applyPatternConfig");export{q as applyPatternConfig,X as findPatternResources};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var $=Object.defineProperty;var r=(n,e)=>$(n,"name",{value:e,configurable:!0});import{formatValue as l}from"./common.js";import{PATTERN_INVOCATION as y}from"./statementInvocation.js";import{patternConstructId as b}from"@fjall/util";const
|
|
2
|
-
${t}${n}: ${e},`}r(c,"emitScalar");function
|
|
3
|
-
${t}${n}: ${JSON.stringify(e)},`}r(
|
|
1
|
+
var $=Object.defineProperty;var r=(n,e)=>$(n,"name",{value:e,configurable:!0});import{formatValue as l}from"./common.js";import{PATTERN_INVOCATION as y}from"./statementInvocation.js";import{patternConstructId as b}from"@fjall/util";const s=Object.freeze({database:{type:"Instance",backupRetention:7,deletionProtection:!0},compute:{server:{memorySize:1536,timeout:30},imageOptimisation:{memorySize:1536,timeout:30},revalidation:{memorySize:768,timeout:300}}});function c(n,e,t){return e===void 0?"":`
|
|
2
|
+
${t}${n}: ${e},`}r(c,"emitScalar");function m(n,e,t){return e===void 0?"":`
|
|
3
|
+
${t}${n}: ${JSON.stringify(e)},`}r(m,"emitStringField");function d(n,e,t){return e===void 0?"":e===!1?`
|
|
4
4
|
${t}${n}: false,`:`
|
|
5
5
|
${t}${n}: ${l(e,t)},`}r(d,"emitObjectOrFalse");function a(n,e,t){return e===void 0||Object.keys(e).length===0?"":`
|
|
6
|
-
${t}${n}: ${l(e,t)},`}r(a,"emitObject");function g(n){const e=n??{},t=" ",o=e.type??
|
|
7
|
-
${t}type: "${o}",`;return i+=
|
|
6
|
+
${t}${n}: ${l(e,t)},`}r(a,"emitObject");function g(n){const e=n??{},t=" ",o=e.type??s.database.type,u=e.backupRetention??s.database.backupRetention,p=e.deletionProtection??s.database.deletionProtection;let i=`
|
|
7
|
+
${t}type: "${o}",`;return i+=m("databaseName",e.databaseName,t),i+=m("databaseEngine",e.databaseEngine,t),o==="Instance"&&e.instanceType!==void 0&&(i+=m("instanceType",e.instanceType,t)),i+=c("allocatedStorage",e.allocatedStorage,t),i+=c("port",e.port,t),i+=`
|
|
8
8
|
${t}backupRetention: ${u},`,i+=`
|
|
9
|
-
${t}deletionProtection: ${p},`,i+=c("publiclyAccessible",e.publiclyAccessible,t),i+=
|
|
9
|
+
${t}deletionProtection: ${p},`,i+=c("publiclyAccessible",e.publiclyAccessible,t),i+=m("allowedIpCidr",e.allowedIpCidr,t),i+=c("multiAz",e.multiAz,t),i+=c("allowVpcAccess",e.allowVpcAccess,t),i+=c("monitoringInterval",e.monitoringInterval,t),i+=m("preferredMaintenanceWindow",e.preferredMaintenanceWindow,t),i+=m("snapshotIdentifier",e.snapshotIdentifier,t),i+=m("snapshotUsername",e.snapshotUsername,t),i+=d("readReplica",e.readReplica,t),i+=a("writer",e.writer,t),i+=d("readers",e.readers,t),i+=d("databaseInsights",e.databaseInsights,t),i+=d("proxy",e.proxy,t),i+=a("credentials",e.credentials,t),i+=a("encryption",e.encryption,t),`
|
|
10
10
|
database: {${i}
|
|
11
|
-
},`}r(g,"emitDatabaseBlock");function S(n){const e=n??{},t=e.server?.memorySize??
|
|
11
|
+
},`}r(g,"emitDatabaseBlock");function S(n){const e=n??{},t=e.server?.memorySize??s.compute.server.memorySize,o=e.server?.timeout??s.compute.server.timeout,u=e.imageOptimisation?.memorySize??s.compute.imageOptimisation.memorySize,p=e.imageOptimisation?.timeout??s.compute.imageOptimisation.timeout,i=e.revalidation?.memorySize??s.compute.revalidation.memorySize,f=e.revalidation?.timeout??s.compute.revalidation.timeout;return`
|
|
12
12
|
compute: {
|
|
13
13
|
server: {
|
|
14
14
|
memorySize: ${t},
|
|
@@ -22,13 +22,13 @@ ${t}deletionProtection: ${p},`,i+=c("publiclyAccessible",e.publiclyAccessible,t)
|
|
|
22
22
|
memorySize: ${i},
|
|
23
23
|
timeout: ${f},
|
|
24
24
|
},
|
|
25
|
-
},`}r(S,"emitComputeBlock");function v(n){return a("storage",n," ")}r(v,"emitStorageBlock");function
|
|
26
|
-
${e}domain: ${JSON.stringify(n.domain)},`),t+=a("forms",n.forms,e),t+=a("cdn",n.cdn,e),t}r(T,"emitStaticSiteFields");function
|
|
25
|
+
},`}r(S,"emitComputeBlock");function v(n){return a("storage",n," ")}r(v,"emitStorageBlock");function z(n){return a("messaging",n," ")}r(z,"emitMessagingBlock");function I(n){return a("cdn",n," ")}r(I,"emitCdnBlock");function O(n){return a("environment",n," ")}r(O,"emitEnvironmentBlock");function T(n){const e=" ";let t="";return t+=m("source",n.source,e),t+=a("build",n.build,e),t+=m("routing",n.routing,e),t+=a("security",n.security,e),n.domain!==void 0&&n.domain!==""&&(t+=`
|
|
26
|
+
${e}domain: ${JSON.stringify(n.domain)},`),t+=m("zoneName",n.zoneName,e),t+=m("hostedZoneId",n.hostedZoneId,e),t+=a("forms",n.forms,e),t+=a("cdn",n.cdn,e),t+=a("accessGate",n.accessGate,e),t}r(T,"emitStaticSiteFields");function A(n){if(!n.patternConfig)return"";const e=n.patternConfig,t=b(e.name,e.type);let o=`app.${y.appMethod}(
|
|
27
27
|
${y.factory}.build("${t}", {
|
|
28
28
|
type: "${e.type}",
|
|
29
29
|
name: "${e.name}",`;return e.type==="payload"||e.type==="nextjs"?(e.domain!==void 0&&e.domain!==""&&(o+=`
|
|
30
|
-
domain: "${e.domain}",`),o+=g(e.database),o+=S(e.compute),o+=v(e.storage),o+=
|
|
30
|
+
domain: "${e.domain}",`),o+=g(e.database),o+=S(e.compute),o+=v(e.storage),o+=z(e.messaging),o+=I(e.cdn),o+=O(e.environment)):o+=T(e),o+=`
|
|
31
31
|
})
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
`,o}r(
|
|
34
|
+
`,o}r(A,"generatePatternCodeWithComments");export{s as OPENNEXT_DEFAULTS,A as generatePatternCodeWithComments};
|
|
@@ -4,10 +4,17 @@ import { type StaticSiteBuildConfig, type StaticSiteCdnConfig, type StaticSiteFo
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for planning a static-site application.
|
|
6
6
|
*
|
|
7
|
-
* A static site is a networkless app
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* A static site is a networkless app — it has no tier, database, compute or
|
|
8
|
+
* VPC, so none of the OpenNext tier-preset machinery applies (deliberate:
|
|
9
|
+
* the pattern's controls are orthogonal knobs, not correlated sizing, so a
|
|
10
|
+
* tier axis has nothing to bundle). The plan carries only the pattern
|
|
11
|
+
* config; the CDK `StaticSite` construct owns the private-S3 +
|
|
12
|
+
* CloudFront/OAC topology.
|
|
13
|
+
*
|
|
14
|
+
* This is the CREATE-flow subset of `StaticSitePatternConfigSchema`:
|
|
15
|
+
* authored-only fields with no create flag (`zoneName`, `hostedZoneId`,
|
|
16
|
+
* `accessGate`, `cdn.priceClass`, …) enter by editing infrastructure.ts,
|
|
17
|
+
* not here.
|
|
11
18
|
*/
|
|
12
19
|
export interface StaticSiteResourceOptions {
|
|
13
20
|
/** Repo root the build runs in and assets are uploaded from. */
|
|
@@ -279,6 +279,8 @@ export declare const ApplicationResourcePlanSchema: z.ZodObject<{
|
|
|
279
279
|
contentSecurityPolicy: z.ZodOptional<z.ZodString>;
|
|
280
280
|
}, z.core.$strict>>;
|
|
281
281
|
domain: z.ZodOptional<z.ZodString>;
|
|
282
|
+
zoneName: z.ZodOptional<z.ZodString>;
|
|
283
|
+
hostedZoneId: z.ZodOptional<z.ZodString>;
|
|
282
284
|
forms: z.ZodOptional<z.ZodObject<{
|
|
283
285
|
to: z.ZodString;
|
|
284
286
|
from: z.ZodOptional<z.ZodString>;
|
|
@@ -287,6 +289,17 @@ export declare const ApplicationResourcePlanSchema: z.ZodObject<{
|
|
|
287
289
|
}, z.core.$strict>>;
|
|
288
290
|
cdn: z.ZodOptional<z.ZodObject<{
|
|
289
291
|
behaviours: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
292
|
+
priceClass: z.ZodOptional<z.ZodEnum<{
|
|
293
|
+
PriceClass_100: "PriceClass_100";
|
|
294
|
+
PriceClass_200: "PriceClass_200";
|
|
295
|
+
PriceClass_All: "PriceClass_All";
|
|
296
|
+
}>>;
|
|
297
|
+
invalidateOnDeploy: z.ZodOptional<z.ZodBoolean>;
|
|
298
|
+
}, z.core.$strict>>;
|
|
299
|
+
accessGate: z.ZodOptional<z.ZodObject<{
|
|
300
|
+
type: z.ZodLiteral<"basic-auth">;
|
|
301
|
+
username: z.ZodString;
|
|
302
|
+
password: z.ZodString;
|
|
290
303
|
}, z.core.$strict>>;
|
|
291
304
|
}, z.core.$strict>], "type">>;
|
|
292
305
|
owner: z.ZodOptional<z.ZodString>;
|
|
@@ -467,8 +467,26 @@ export type StaticSiteFormsConfig = z.infer<typeof StaticSiteFormsConfigSchema>;
|
|
|
467
467
|
*/
|
|
468
468
|
export declare const StaticSiteCdnConfigSchema: z.ZodObject<{
|
|
469
469
|
behaviours: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
470
|
+
priceClass: z.ZodOptional<z.ZodEnum<{
|
|
471
|
+
PriceClass_100: "PriceClass_100";
|
|
472
|
+
PriceClass_200: "PriceClass_200";
|
|
473
|
+
PriceClass_All: "PriceClass_All";
|
|
474
|
+
}>>;
|
|
475
|
+
invalidateOnDeploy: z.ZodOptional<z.ZodBoolean>;
|
|
470
476
|
}, z.core.$strict>;
|
|
471
477
|
export type StaticSiteCdnConfig = z.infer<typeof StaticSiteCdnConfigSchema>;
|
|
478
|
+
/**
|
|
479
|
+
* Basic-auth access gate for a static site — an edge-side obscurity gate for
|
|
480
|
+
* staging sign-off (keeps an unlaunched site out of casual view and search
|
|
481
|
+
* indexes), NOT a security boundary: the credentials sit in plain text in
|
|
482
|
+
* infrastructure.ts and in the distribution's viewer-function code.
|
|
483
|
+
*/
|
|
484
|
+
export declare const StaticSiteAccessGateConfigSchema: z.ZodObject<{
|
|
485
|
+
type: z.ZodLiteral<"basic-auth">;
|
|
486
|
+
username: z.ZodString;
|
|
487
|
+
password: z.ZodString;
|
|
488
|
+
}, z.core.$strict>;
|
|
489
|
+
export type StaticSiteAccessGateConfig = z.infer<typeof StaticSiteAccessGateConfigSchema>;
|
|
472
490
|
/**
|
|
473
491
|
* Static-site pattern configuration.
|
|
474
492
|
*
|
|
@@ -493,6 +511,8 @@ export declare const StaticSitePatternConfigSchema: z.ZodObject<{
|
|
|
493
511
|
contentSecurityPolicy: z.ZodOptional<z.ZodString>;
|
|
494
512
|
}, z.core.$strict>>;
|
|
495
513
|
domain: z.ZodOptional<z.ZodString>;
|
|
514
|
+
zoneName: z.ZodOptional<z.ZodString>;
|
|
515
|
+
hostedZoneId: z.ZodOptional<z.ZodString>;
|
|
496
516
|
forms: z.ZodOptional<z.ZodObject<{
|
|
497
517
|
to: z.ZodString;
|
|
498
518
|
from: z.ZodOptional<z.ZodString>;
|
|
@@ -501,6 +521,17 @@ export declare const StaticSitePatternConfigSchema: z.ZodObject<{
|
|
|
501
521
|
}, z.core.$strict>>;
|
|
502
522
|
cdn: z.ZodOptional<z.ZodObject<{
|
|
503
523
|
behaviours: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
524
|
+
priceClass: z.ZodOptional<z.ZodEnum<{
|
|
525
|
+
PriceClass_100: "PriceClass_100";
|
|
526
|
+
PriceClass_200: "PriceClass_200";
|
|
527
|
+
PriceClass_All: "PriceClass_All";
|
|
528
|
+
}>>;
|
|
529
|
+
invalidateOnDeploy: z.ZodOptional<z.ZodBoolean>;
|
|
530
|
+
}, z.core.$strict>>;
|
|
531
|
+
accessGate: z.ZodOptional<z.ZodObject<{
|
|
532
|
+
type: z.ZodLiteral<"basic-auth">;
|
|
533
|
+
username: z.ZodString;
|
|
534
|
+
password: z.ZodString;
|
|
504
535
|
}, z.core.$strict>>;
|
|
505
536
|
}, z.core.$strict>;
|
|
506
537
|
export type StaticSitePatternConfig = z.infer<typeof StaticSitePatternConfigSchema>;
|
|
@@ -768,6 +799,8 @@ export declare const PatternConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
768
799
|
contentSecurityPolicy: z.ZodOptional<z.ZodString>;
|
|
769
800
|
}, z.core.$strict>>;
|
|
770
801
|
domain: z.ZodOptional<z.ZodString>;
|
|
802
|
+
zoneName: z.ZodOptional<z.ZodString>;
|
|
803
|
+
hostedZoneId: z.ZodOptional<z.ZodString>;
|
|
771
804
|
forms: z.ZodOptional<z.ZodObject<{
|
|
772
805
|
to: z.ZodString;
|
|
773
806
|
from: z.ZodOptional<z.ZodString>;
|
|
@@ -776,6 +809,17 @@ export declare const PatternConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
776
809
|
}, z.core.$strict>>;
|
|
777
810
|
cdn: z.ZodOptional<z.ZodObject<{
|
|
778
811
|
behaviours: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
812
|
+
priceClass: z.ZodOptional<z.ZodEnum<{
|
|
813
|
+
PriceClass_100: "PriceClass_100";
|
|
814
|
+
PriceClass_200: "PriceClass_200";
|
|
815
|
+
PriceClass_All: "PriceClass_All";
|
|
816
|
+
}>>;
|
|
817
|
+
invalidateOnDeploy: z.ZodOptional<z.ZodBoolean>;
|
|
818
|
+
}, z.core.$strict>>;
|
|
819
|
+
accessGate: z.ZodOptional<z.ZodObject<{
|
|
820
|
+
type: z.ZodLiteral<"basic-auth">;
|
|
821
|
+
username: z.ZodString;
|
|
822
|
+
password: z.ZodString;
|
|
779
823
|
}, z.core.$strict>>;
|
|
780
824
|
}, z.core.$strict>], "type">;
|
|
781
825
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as t}from"zod";import{VALIDATION_MESSAGES as o,VALIDATION_PATTERNS as n}from"../validation/patterns.js";import{BackupRetentionSchema as c,MonitoringIntervalSchema as
|
|
1
|
+
import{z as t}from"zod";import{VALIDATION_MESSAGES as o,VALIDATION_PATTERNS as n}from"../validation/patterns.js";import{BackupRetentionSchema as c,MonitoringIntervalSchema as u,DatabasePortSchema as T,ProxyConfigOrFalseSchema as R,ReadReplicaConfigOrFalseSchema as b,AuroraWriterConfigSchema as M,AuroraReadersConfigOrFalseSchema as f,DatabaseInsightsConfigOrFalseSchema as h,CredentialsConfigSchema as C,EncryptionConfigSchema as N}from"./databaseSchemas.js";import{LambdaMemorySchema as p}from"./computeSchemas.js";import{PATTERN_DATABASE_TYPES as l,DATABASE_ENGINES as O}from"./constants.js";import{CLOUDFRONT_PRICE_CLASS_VALUES as _,STATIC_SITE_ROUTING_VALUES as x,isAddressAtDomain as y}from"@fjall/util";const a=t.object({memorySize:p.optional(),timeout:t.number().int(o.LAMBDA.TIMEOUT.INTEGER).min(1,o.LAMBDA.TIMEOUT.MIN).max(900,o.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:t.number().int(o.EPHEMERAL_STORAGE.INTEGER).min(512,o.EPHEMERAL_STORAGE.MIN).max(10240,o.EPHEMERAL_STORAGE.MAX).optional()}).strict(),E=t.object({type:t.enum(l).optional(),databaseName:t.string().optional(),databaseEngine:t.enum(O).optional(),deletionProtection:t.boolean().optional(),backupRetention:c.optional(),port:T.optional(),publiclyAccessible:t.boolean().optional(),allowedIpCidr:t.string().optional(),instanceType:t.string().optional(),allocatedStorage:t.number().int(o.ALLOCATED_STORAGE.INTEGER).min(20,o.ALLOCATED_STORAGE.MIN).max(65536,o.ALLOCATED_STORAGE.MAX).optional(),multiAz:t.boolean().optional(),readReplica:b.optional(),writer:M.optional(),readers:f.optional(),allowVpcAccess:t.boolean().optional(),monitoringInterval:u.optional(),preferredMaintenanceWindow:t.string().optional(),databaseInsights:h.optional(),proxy:R.optional(),credentials:C.optional(),encryption:N.optional(),snapshotIdentifier:t.string().optional(),snapshotUsername:t.string().optional()}).strict(),S=t.object({server:a.optional(),imageOptimisation:a.optional(),revalidation:a.optional()}).strict(),r=t.object({versioned:t.boolean().optional()}).strict(),d=t.object({assets:r.optional(),cache:r.optional(),media:r.optional()}).strict(),P=t.object({visibilityTimeout:t.number().int(o.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,o.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,o.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:t.number().int(o.SQS.RETENTION_PERIOD.INTEGER).min(60,o.SQS.RETENTION_PERIOD.MIN).max(1209600,o.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:t.number().int(o.MAX_MESSAGE_SIZE.INTEGER).min(1024,o.MAX_MESSAGE_SIZE.MIN).max(262144,o.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:t.union([t.literal(!1),t.object({enabled:t.boolean().optional(),maxReceiveCount:t.number().int(o.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,o.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,o.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),A=t.object({revalidationQueue:P.optional()}).strict(),g=t.object({domainNames:t.array(t.string()).optional(),certificateArn:t.string().optional()}).strict(),I=t.record(t.string().regex(n.ENV_VAR_NAME,o.ENV_VAR_NAME),t.string()).optional(),D=t.object({type:t.literal("payload"),name:t.string().min(1,o.REQUIRED.PATTERN_NAME),domain:t.string().optional(),database:E.optional(),compute:S.optional(),storage:d.optional(),messaging:A.optional(),cdn:g.optional(),environment:I}).strict(),L=t.object({type:t.literal("nextjs"),name:t.string().min(1,o.REQUIRED.PATTERN_NAME),domain:t.string().optional(),database:E.optional(),compute:S.optional(),storage:d.optional(),messaging:A.optional(),cdn:g.optional(),environment:I}).strict(),U=t.enum(x),G=t.object({command:t.string().min(1,o.REQUIRED.BUILD_COMMAND),outputDir:t.string().min(1,o.REQUIRED.OUTPUT_DIR)}).strict(),j=t.object({headers:t.boolean().optional(),contentSecurityPolicy:t.string().optional()}).strict(),Q=t.object({to:t.string().min(1,o.REQUIRED.FORMS_TO).regex(n.EMAIL,o.EMAIL),from:t.string().regex(n.EMAIL,o.EMAIL).optional(),corsOrigin:t.string().regex(n.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:t.number().int().min(1).max(100).optional()}).strict(),v=t.object({behaviours:t.array(t.unknown()).optional(),priceClass:t.enum(_).optional(),invalidateOnDeploy:t.boolean().optional()}).strict(),B=t.object({type:t.literal("basic-auth"),username:t.string().min(1,"accessGate.username must not be empty"),password:t.string().min(1,"accessGate.password must not be empty")}).strict(),V=t.object({type:t.literal("staticsite"),name:t.string().min(1,o.REQUIRED.PATTERN_NAME),source:t.string().min(1,o.REQUIRED.SOURCE),build:G,routing:U.optional(),security:j.optional(),domain:t.string().optional(),zoneName:t.string().optional(),hostedZoneId:t.string().optional(),forms:Q.optional(),cdn:v.optional(),accessGate:B.optional()}).strict().superRefine((i,s)=>{if(i.forms===void 0)return;const e=i.domain;if(e===void 0||e===""){s.addIssue({code:"custom",path:["domain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"});return}const m=i.forms.from;m!==void 0&&!y(m,e)&&s.addIssue({code:"custom",path:["forms","from"],message:`forms.from must be an address at ${e} (the verified SES identity) \u2014 for example noreply@${e}. Use forms.to for the recipient.`})}),Y=t.discriminatedUnion("type",[D,L,V]),Z=t.enum(["lightweight","standard","resilient","custom"]),W=t.object({type:t.enum(l),instanceType:t.string().optional(),backupRetention:c.optional(),deletionProtection:t.boolean().optional(),encryption:t.union([t.object({useCMK:t.literal(!0)}).strict(),t.literal(!1)]).optional()}).strict(),$=t.object({memorySize:p.optional(),timeout:t.number().int(o.LAMBDA.TIMEOUT.INTEGER).min(1,o.LAMBDA.TIMEOUT.MIN).max(900,o.LAMBDA.TIMEOUT.MAX).optional()}).strict();export{$ as CustomPatternComputeSchema,W as CustomPatternDatabaseSchema,L as NextJSPatternConfigSchema,Y as PatternConfigSchema,a as PatternLambdaConfigSchema,P as PatternQueueConfigSchema,r as PatternStorageBucketConfigSchema,Z as PatternTierSchema,g as PayloadCdnConfigSchema,S as PayloadComputeConfigSchema,E as PayloadDatabaseConfigSchema,A as PayloadMessagingConfigSchema,D as PayloadPatternConfigSchema,d as PayloadStorageConfigSchema,B as StaticSiteAccessGateConfigSchema,G as StaticSiteBuildConfigSchema,v as StaticSiteCdnConfigSchema,Q as StaticSiteFormsConfigSchema,V as StaticSitePatternConfigSchema,U as StaticSiteRoutingSchema,j as StaticSiteSecurityConfigSchema};
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "
|
|
1
|
+
export declare const GENERATOR_VERSION = "25.0.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const E="
|
|
1
|
+
const E="25.0.0";export{E as GENERATOR_VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/generator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.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": "^
|
|
61
|
+
"@fjall/util": "^25.0.0",
|
|
62
62
|
"ast-types": "^0.16.1",
|
|
63
63
|
"recast": "^0.23.12",
|
|
64
64
|
"ts-morph": "^28.0.0",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@eslint/js": "^10.0.1",
|
|
70
70
|
"@types/node": "^26.1.2",
|
|
71
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
71
72
|
"@vitest/coverage-v8": "^4.1.10",
|
|
72
73
|
"eslint": "^10.8.0",
|
|
73
74
|
"fast-check": "^4.9.0",
|