@fjall/generator 14.3.0 → 15.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.
Files changed (46) hide show
  1. package/dist/.build-source-hash +26 -24
  2. package/dist/.minified +1 -1
  3. package/dist/src/ast/astTestHelpers.d.ts +2 -1
  4. package/dist/src/ast/parsers/orchestrator/astPlanConverter.js +1 -1
  5. package/dist/src/ast/parsers/resources/astComputeParserHelpers.js +1 -1
  6. package/dist/src/ast/parsers/resources/astScheduleParser.d.ts +3 -0
  7. package/dist/src/ast/parsers/resources/astScheduleParser.js +1 -1
  8. package/dist/src/codemod/drift/types.d.ts +2 -2
  9. package/dist/src/codemod/edits/addResource/propertyBuilder.d.ts +7 -0
  10. package/dist/src/codemod/edits/addResource/propertyBuilder.js +1 -1
  11. package/dist/src/codemod/fileRewriter/builders.d.ts +7 -0
  12. package/dist/src/codemod/fileRewriter/builders.js +1 -1
  13. package/dist/src/codemod/types.d.ts +6 -6
  14. package/dist/src/generation/common.d.ts +0 -7
  15. package/dist/src/generation/common.js +7 -8
  16. package/dist/src/generation/compute/ec2.d.ts +7 -0
  17. package/dist/src/generation/compute/ec2.js +2 -4
  18. package/dist/src/generation/compute/ecs.js +33 -33
  19. package/dist/src/generation/compute/lambda.d.ts +27 -0
  20. package/dist/src/generation/compute/lambda.js +9 -22
  21. package/dist/src/generation/compute.d.ts +18 -0
  22. package/dist/src/generation/compute.js +6 -6
  23. package/dist/src/generation/database.d.ts +2 -1
  24. package/dist/src/generation/database.js +20 -20
  25. package/dist/src/generation/generatePatternCode.js +9 -9
  26. package/dist/src/generation/index.d.ts +3 -2
  27. package/dist/src/generation/index.js +1 -1
  28. package/dist/src/generation/infrastructure.js +34 -34
  29. package/dist/src/generation/statementInvocation.d.ts +30 -0
  30. package/dist/src/generation/statementInvocation.js +1 -0
  31. package/dist/src/generation/storage.js +19 -19
  32. package/dist/src/generation/structuredSource.d.ts +61 -0
  33. package/dist/src/generation/structuredSource.js +9 -0
  34. package/dist/src/planning/resourcePlanning.d.ts +20 -0
  35. package/dist/src/planning/resourcePlanning.js +1 -1
  36. package/dist/src/projection/compute.d.ts +11 -1
  37. package/dist/src/projection/compute.js +1 -1
  38. package/dist/src/schemas/applicationSchemas.d.ts +5 -1
  39. package/dist/src/schemas/baseSchemas.d.ts +2 -2
  40. package/dist/src/schemas/computeSchemas.d.ts +4 -0
  41. package/dist/src/schemas/computeSchemas.js +1 -1
  42. package/dist/src/schemas/constants.d.ts +2 -0
  43. package/dist/src/schemas/constants.js +1 -1
  44. package/dist/src/version.d.ts +1 -1
  45. package/dist/src/version.js +1 -1
  46. package/package.json +2 -2
@@ -9,7 +9,7 @@
9
9
  "package.json",
10
10
  "tsconfig.json"
11
11
  ],
12
- "hash": "c197865438d6a6214248a8902160c0d9169037282836cf9111df93c3bb3f793f",
12
+ "hash": "bea8a4133881b869aa3d0a86b65db2f142a1ab00b04301315bc5fa46ca3ba2b4",
13
13
  "files": {
14
14
  "src/ast/astTestHelpers.ts": "026cac849eb88bdb",
15
15
  "src/ast/domain/astDomainParser.ts": "54a50bcec75a8306",
@@ -21,18 +21,18 @@
21
21
  "src/ast/parsers/common/astStatementClassifier.ts": "d5cfd1f8d5e35132",
22
22
  "src/ast/parsers/common/astStatementQueries.ts": "e40e31e0fcdc15e3",
23
23
  "src/ast/parsers/orchestrator/astInfrastructureParser.ts": "07fd7a94796ebf5f",
24
- "src/ast/parsers/orchestrator/astPlanConverter.ts": "eb9b1f0ab90f6999",
24
+ "src/ast/parsers/orchestrator/astPlanConverter.ts": "8e8ceedc328f4181",
25
25
  "src/ast/parsers/resources/astCdnParser.ts": "726b298b0b580d68",
26
26
  "src/ast/parsers/resources/astClickHouseParser.ts": "cf49943b3d2bbd48",
27
27
  "src/ast/parsers/resources/astComputeConnectionParser.ts": "e0f1533845f3ce8a",
28
28
  "src/ast/parsers/resources/astComputeParser.ts": "8caa5cc22af1913a",
29
- "src/ast/parsers/resources/astComputeParserHelpers.ts": "b824f221f8c7e3d9",
29
+ "src/ast/parsers/resources/astComputeParserHelpers.ts": "4763a0f0afbd4880",
30
30
  "src/ast/parsers/resources/astDatabaseParser.ts": "e18f5483f5e23297",
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
34
  "src/ast/parsers/resources/astPatternParser.ts": "09c624247eaf0786",
35
- "src/ast/parsers/resources/astScheduleParser.ts": "03de29da6d4b7380",
35
+ "src/ast/parsers/resources/astScheduleParser.ts": "dbdac640c75b8bd3",
36
36
  "src/ast/parsers/resources/astStorageParser.ts": "309bc3257f46cfdf",
37
37
  "src/aws/regions.ts": "a028bcb92b0e41d9",
38
38
  "src/codemod/_internal.ts": "e865b7172fcc457b",
@@ -44,7 +44,7 @@
44
44
  "src/codemod/edits/addResource.ts": "bdc90708af588ff4",
45
45
  "src/codemod/edits/addResource/appBinding.ts": "3553fdb30fe06335",
46
46
  "src/codemod/edits/addResource/bodyIndex.ts": "3e179eac10d7bcf4",
47
- "src/codemod/edits/addResource/propertyBuilder.ts": "04d04e8207041381",
47
+ "src/codemod/edits/addResource/propertyBuilder.ts": "05f947d640ee1c42",
48
48
  "src/codemod/edits/addResource/siblingEmission.ts": "a305b45583272eca",
49
49
  "src/codemod/edits/appendAccountToStage.ts": "1796d909fa3ef79d",
50
50
  "src/codemod/edits/computeServiceLocator.ts": "7f86483d9a35e053",
@@ -71,7 +71,7 @@
71
71
  "src/codemod/edits/vpcPeerAccepter.ts": "c9eace933e9e2345",
72
72
  "src/codemod/emitGuard.ts": "d199ccbf91166618",
73
73
  "src/codemod/emitProjection.ts": "bdc862dedf8d649a",
74
- "src/codemod/fileRewriter/builders.ts": "9b7ab0f797c9ab56",
74
+ "src/codemod/fileRewriter/builders.ts": "a3305fd13a3d1e59",
75
75
  "src/codemod/fileRewriter/index.ts": "222aa7493cedbb01",
76
76
  "src/codemod/fileRewriter/locateByRange.ts": "889ee6256201c1fe",
77
77
  "src/codemod/fileRewriter/parse.ts": "b12026c31562a13c",
@@ -119,20 +119,22 @@
119
119
  "src/dns/index.ts": "266288ae3b851e3d",
120
120
  "src/dns/tsEmitter.ts": "1667fe66013e767d",
121
121
  "src/dns/types.ts": "82d6db9d7d26dbc2",
122
- "src/generation/common.ts": "20075ada839797fb",
123
- "src/generation/compute.ts": "4029a0d8e3197686",
124
- "src/generation/compute/ec2.ts": "4d8187d293a57fb1",
125
- "src/generation/compute/ecs.ts": "38a345cbd45c40d4",
126
- "src/generation/compute/lambda.ts": "4f5e31080941b83a",
122
+ "src/generation/common.ts": "50bbd875b9dd737e",
123
+ "src/generation/compute.ts": "068f6fa241838b25",
124
+ "src/generation/compute/ec2.ts": "a906b9076481f66b",
125
+ "src/generation/compute/ecs.ts": "7bc7dcfc5c20ce4e",
126
+ "src/generation/compute/lambda.ts": "932a45cdc26a5730",
127
127
  "src/generation/compute/shared.ts": "3724d4bfe92cfcb7",
128
128
  "src/generation/connectionWiring.ts": "9afb0227f2584ab2",
129
- "src/generation/database.ts": "07c09dd692c8c4be",
130
- "src/generation/generatePatternCode.ts": "ab752292dd72b676",
131
- "src/generation/index.ts": "5745098c57819b3a",
132
- "src/generation/infrastructure.ts": "0e0c70437195bb0e",
129
+ "src/generation/database.ts": "ac25ebfd8f24275b",
130
+ "src/generation/generatePatternCode.ts": "afed698418d90aee",
131
+ "src/generation/index.ts": "915500e352c2bab6",
132
+ "src/generation/infrastructure.ts": "0ac7c1954a02b2cc",
133
133
  "src/generation/messagingConnections.ts": "09e70af97e055712",
134
- "src/generation/storage.ts": "2c0171aeeec3d79e",
134
+ "src/generation/statementInvocation.ts": "52ecd948f60e00cb",
135
+ "src/generation/storage.ts": "8b66549277a97279",
135
136
  "src/generation/storageConnections.ts": "c0dc86aebf7158ae",
137
+ "src/generation/structuredSource.ts": "fa07b7036e66da50",
136
138
  "src/index.ts": "fc8f27b8ffade9ef",
137
139
  "src/planning/generateResourceChange.ts": "1c6411f9a12e7acb",
138
140
  "src/planning/index.ts": "8ef807b31c43310c",
@@ -140,7 +142,7 @@
140
142
  "src/planning/planBuilders.ts": "bea93d0c05caef21",
141
143
  "src/planning/resourceAddition.ts": "7d0320620a74fdcd",
142
144
  "src/planning/resourceConnections.ts": "a6b7db8f733e560f",
143
- "src/planning/resourcePlanning.ts": "1fefdbc93e12ba7f",
145
+ "src/planning/resourcePlanning.ts": "d6bb9fa8e1419908",
144
146
  "src/planning/staticSitePlanning.ts": "242af1e9618821ab",
145
147
  "src/presets/clickhouseTierPreset.ts": "72b2b8a8caf4bdb4",
146
148
  "src/presets/index.ts": "8332c0198b2a6fe9",
@@ -148,7 +150,7 @@
148
150
  "src/presets/storagePresets.ts": "5df2d4d7d21a66d8",
149
151
  "src/presets/tierPresets.ts": "c0148771bffbef9b",
150
152
  "src/presets/tierTypes.ts": "6526373876daacf0",
151
- "src/projection/compute.ts": "b26369999600a11f",
153
+ "src/projection/compute.ts": "66ea8ee6011ad615",
152
154
  "src/projection/index.ts": "3ddb1d53f5781805",
153
155
  "src/projection/project.ts": "06e6a3b872d10243",
154
156
  "src/projection/roundTripKeys.ts": "a6996fc1ae067d27",
@@ -160,8 +162,8 @@
160
162
  "src/schemas/baseSchemas.ts": "93d9bd1c0adfcaa0",
161
163
  "src/schemas/buildkiteSchemas.ts": "a28ec3b40f7851ec",
162
164
  "src/schemas/cdnSchemas.ts": "16784f15894c62ba",
163
- "src/schemas/computeSchemas.ts": "e06dee92ede421d3",
164
- "src/schemas/constants.ts": "732a290de68e4ff8",
165
+ "src/schemas/computeSchemas.ts": "7105193fd34c8bcb",
166
+ "src/schemas/constants.ts": "b0abe53d7a42feb0",
165
167
  "src/schemas/databaseSchemas.ts": "3c05f176e1aadb46",
166
168
  "src/schemas/devRolePolicies.ts": "6ca70fb20f5fbebc",
167
169
  "src/schemas/index.ts": "a1500a885048074b",
@@ -179,11 +181,11 @@
179
181
  "src/validation/patterns.ts": "f9629eafdad7ac3e",
180
182
  "src/validation/validationMessages.ts": "772ae6e5a897a301",
181
183
  "src/validation/validationPatterns.ts": "865f3d688975b7c8",
182
- "src/version.ts": "f45b030d713c0c00",
184
+ "src/version.ts": "e5f68bfd6ec4186d",
183
185
  "../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
184
- "package.json": "300a99e3aa568d7d",
186
+ "package.json": "82c1047d2bfe256a",
185
187
  "tsconfig.json": "1929cf3f99fe9b1e"
186
188
  },
187
- "outputHash": "b1a6f9021e616997964204947d103b53edf2f79639e97e05eea0dcb8d79d76cd",
188
- "outputFileCount": 339
189
+ "outputHash": "19b59493ade88ac7ce614d91f1c445d691310a62ac92c968801636ea999f3cbd",
190
+ "outputFileCount": 343
189
191
  }
package/dist/.minified CHANGED
@@ -1 +1 @@
1
- 169 files minified at 2026-08-20T22:18:56.335Z
1
+ 171 files minified at 2026-08-21T10:08:42.329Z
@@ -311,6 +311,7 @@ export declare function parseAndConvert(code: string): {
311
311
  } | undefined;
312
312
  description?: string | undefined;
313
313
  scheduleExpression?: string | undefined;
314
+ scheduleStackPlacement?: "compute" | "messaging" | undefined;
314
315
  architecture?: "ARM_64" | "X86_64" | undefined;
315
316
  ephemeralStorageSize?: number | undefined;
316
317
  functionName?: string | undefined;
@@ -727,7 +728,7 @@ export declare function parseAndConvert(code: string): {
727
728
  sourceText: string;
728
729
  position: "before-imports" | "after-imports" | "after-app-init" | "after-tags" | "after-resource" | "end-of-file";
729
730
  afterManagedResource?: {
730
- type: "custom" | "storage" | "database" | "compute" | "pattern" | "import" | "app-init" | "tags" | "network" | "messaging" | "cdn" | "vpc-peer" | "vpc-peer-accepter" | "cross-plan-connection";
731
+ type: "custom" | "storage" | "database" | "compute" | "messaging" | "pattern" | "import" | "app-init" | "tags" | "network" | "cdn" | "vpc-peer" | "vpc-peer-accepter" | "cross-plan-connection";
731
732
  name?: string | undefined;
732
733
  } | undefined;
733
734
  originalLine?: number | undefined;
@@ -1,2 +1,2 @@
1
- var u=Object.defineProperty;var c=(e,t)=>u(e,"name",{value:t,configurable:!0});import{ApplicationResourcePlanSchema as a,getZodErrorMessage as m}from"../../../schemas/resourceSchemas.js";import{z as f}from"zod";import{COST_ALLOCATION_TAG as i}from"../../../generation/infrastructure.js";import{convertDatabaseResources as l,convertDynamoDBResources as p,convertClickHouseResources as d}from"../resources/astDatabaseParser.js";import{convertS3Resources as R}from"../resources/astStorageParser.js";import{convertComputeResources as h}from"../resources/astComputeParser.js";import{convertSQSResources as v}from"../resources/astMessagingParser.js";import{convertCDNResource as g}from"../resources/astCdnParser.js";import{convertNetworkConfig as k,convertBackupConfig as I,convertTunnelConfig as b,convertAdditionalNetworks as S}from"../resources/astNetworkParser.js";import{applyPatternConfig as w}from"../resources/astPatternParser.js";import{KNOWN_FJALL_IMPORTS as y,isManagedModuleSpecifier as N}from"../common/astStatementClassifier.js";function C(e,t){for(const r of t){const o=e.compute.find(n=>n.variableName===r.targetVariableName);o!==void 0&&o.type==="lambda"&&(o.scheduleExpression=r.schedule)}}c(C,"applyScheduleBackfill");function A(e,t){Object.keys(t).length>0&&(e.tags={...t}),t[i]&&(e.owner=t[i])}c(A,"applyTagsAndOwner");function M(e){const t=[];for(const r of e)if(N(r.moduleSpecifier))if(r.moduleSpecifier==="@fjall/components-infrastructure"||r.moduleSpecifier==="@fjall/infrastructure"){const o=r.namedImports.filter(n=>!y.has(n));o.length>0&&t.push({moduleSpecifier:r.moduleSpecifier,namedImports:o,defaultImport:r.defaultImport})}else(r.namedImports.length>0||r.defaultImport)&&t.push(r);return t.length>0?t:void 0}c(M,"computeAdditionalManagedImports");function Z(e,t,r){const o={appName:t,type:"standard",database:[],s3:[],compute:[]};if(w(o,e.patternResources),e.vpcId&&(o.vpcId=e.vpcId),o.network=k(e.network),o.backup=I(e.backup),o.tunnel=b(e.tunnel),o.additionalNetworks=S(e.networkResources),A(o,e.tags),o.database=l(e.databaseResources),o.dynamodb=p(e.dynamodbResources),o.clickhouse=d(e.clickhouseResources),o.sqs=v(e.sqsResources),o.cdn=g(e.cdnResource,e.s3Resources,e.computeResources),o.s3=R(e.s3Resources),o.compute=h(e.computeResources,e.databaseResources,e.s3Resources,o),C(o,e.schedules),o.additionalManagedImports=M(e.imports),r?.skipValidation)return o;try{return a.parse(o)}catch(n){if(n instanceof f.ZodError){const s=m(n);throw new Error(`Invalid infrastructure configuration:
1
+ var u=Object.defineProperty;var c=(e,r)=>u(e,"name",{value:r,configurable:!0});import{ApplicationResourcePlanSchema as a,getZodErrorMessage as m}from"../../../schemas/resourceSchemas.js";import{z as f}from"zod";import{COST_ALLOCATION_TAG as i}from"../../../generation/infrastructure.js";import{convertDatabaseResources as l,convertDynamoDBResources as d,convertClickHouseResources as p}from"../resources/astDatabaseParser.js";import{convertS3Resources as R}from"../resources/astStorageParser.js";import{convertComputeResources as h}from"../resources/astComputeParser.js";import{convertSQSResources as k}from"../resources/astMessagingParser.js";import{convertCDNResource as v}from"../resources/astCdnParser.js";import{convertNetworkConfig as g,convertBackupConfig as I,convertTunnelConfig as S,convertAdditionalNetworks as b}from"../resources/astNetworkParser.js";import{applyPatternConfig as w}from"../resources/astPatternParser.js";import{KNOWN_FJALL_IMPORTS as y,isManagedModuleSpecifier as N}from"../common/astStatementClassifier.js";function C(e,r){for(const t of r){const o=e.compute.find(n=>n.variableName===t.targetVariableName);o!==void 0&&o.type==="lambda"&&(o.scheduleExpression=t.schedule,t.stackPlacement!==void 0&&(o.scheduleStackPlacement=t.stackPlacement))}}c(C,"applyScheduleBackfill");function A(e,r){Object.keys(r).length>0&&(e.tags={...r}),r[i]&&(e.owner=r[i])}c(A,"applyTagsAndOwner");function M(e){const r=[];for(const t of e)if(N(t.moduleSpecifier))if(t.moduleSpecifier==="@fjall/components-infrastructure"||t.moduleSpecifier==="@fjall/infrastructure"){const o=t.namedImports.filter(n=>!y.has(n));o.length>0&&r.push({moduleSpecifier:t.moduleSpecifier,namedImports:o,defaultImport:t.defaultImport})}else(t.namedImports.length>0||t.defaultImport)&&r.push(t);return r.length>0?r:void 0}c(M,"computeAdditionalManagedImports");function Z(e,r,t){const o={appName:r,type:"standard",database:[],s3:[],compute:[]};if(w(o,e.patternResources),e.vpcId&&(o.vpcId=e.vpcId),o.network=g(e.network),o.backup=I(e.backup),o.tunnel=S(e.tunnel),o.additionalNetworks=b(e.networkResources),A(o,e.tags),o.database=l(e.databaseResources),o.dynamodb=d(e.dynamodbResources),o.clickhouse=p(e.clickhouseResources),o.sqs=k(e.sqsResources),o.cdn=v(e.cdnResource,e.s3Resources,e.computeResources),o.s3=R(e.s3Resources),o.compute=h(e.computeResources,e.databaseResources,e.s3Resources,o),C(o,e.schedules),o.additionalManagedImports=M(e.imports),t?.skipValidation)return o;try{return a.parse(o)}catch(n){if(n instanceof f.ZodError){const s=m(n);throw new Error(`Invalid infrastructure configuration:
2
2
  ${s}`)}throw n}}c(Z,"convertToResourcePlan");export{Z as convertToResourcePlan};
@@ -1 +1 @@
1
- var S=Object.defineProperty;var a=(e,n)=>S(e,"name",{value:n,configurable:!0});import{isPlainObject as y,isParsedObject as s,isExpressionRef as C,isCallRef as h,asString as r,asNumber as i,asBoolean as f,asStringArray as d,asStringUnion as m,captureExtraProperties as p}from"../common/astCommonParser.js";import{ECS_CAPACITY_PROVIDERS as E,ECS_SERVICE_TYPES as P,LOAD_BALANCER_TYPES as _,SCALING_TYPES as x,AMI_HARDWARE_TYPES as A}from"../../../schemas/constants.js";function N(e){return e!==void 0&&y(e)}a(N,"isEnvironmentRecord");function T(e){if(!s(e))return;const n={};for(const[t,o]of Object.entries(e))if(s(o)){const c=r(o.id),u=r(o.name);c&&u&&(n[t]={id:c,name:u,field:r(o.field)})}return Object.keys(n).length>0?n:void 0}a(T,"parseContainerSecretsImport");function g(e){if(!s(e))return;const n=d(e.command);if(!(!n||n.length===0))return{command:n,interval:i(e.interval),timeout:i(e.timeout),retries:i(e.retries),startPeriod:i(e.startPeriod)}}a(g,"parseContainerHealthCheck");function O(e){const t=p(e,new Set(["name","image","port","environment","essential","command","entryPoint","secretsImport","secrets","healthCheck"]));return{name:r(e.name),image:r(e.image),port:i(e.port),environment:N(e.environment)?e.environment:void 0,essential:f(e.essential),command:d(e.command),entryPoint:d(e.entryPoint),secretsImport:T(e.secretsImport),ssmSecrets:d(e.secrets),healthCheck:g(e.healthCheck),extraProperties:t.length>0?t:void 0}}a(O,"parseServiceContainer");function I(e){if(Array.isArray(e))return e.filter(s).map(n=>({path:r(n.path),host:r(n.host),priority:i(n.priority),healthCheckPath:r(n.healthCheckPath)}));if(s(e))return{path:r(e.path),host:r(e.host),priority:i(e.priority),healthCheckPath:r(e.healthCheckPath)}}a(I,"parseServiceRouting");function R(e){if(e===!1)return!1;if(s(e))return{minCapacity:i(e.minCapacity),maxCapacity:i(e.maxCapacity),desiredCount:i(e.desiredCount),scalingType:m(e.scalingType,x)}}a(R,"parseServiceScaling");const l=new Set(["instanceType","amiHardwareType","minCapacity","maxCapacity","memoryLimitMiB","warmPool"]);function B(e){if(!s(e))return;const n=e.warmPool,t=s(n)?{minSize:i(n.minSize),reuseOnScaleIn:f(n.reuseOnScaleIn)}:void 0,o=p(e,l);return{instanceType:r(e.instanceType),amiHardwareType:m(e.amiHardwareType,A),minCapacity:i(e.minCapacity),maxCapacity:i(e.maxCapacity),memoryLimitMiB:i(e.memoryLimitMiB),warmPool:t,extraProperties:o.length>0?o:void 0}}a(B,"parseServiceEc2Config");const K=new Set(["domain","loadBalancer","directAccess"]);function W(e){if(!s(e))return;const n=e.loadBalancer,t=p(e,K);return{domain:r(e.domain),loadBalancer:n===!1?!1:m(n,_),directAccess:f(e.directAccess),...t.length>0&&{extraProperties:t}}}a(W,"extractClusterConfig");function M(e){const n=e.containers,t=Array.isArray(n)?n.filter(s).map(O):void 0,c=p(e,new Set(["name","image","docker","ssmSecretsPath","containers","routing","connections","serviceType","cpu","memoryLimitMiB","desiredCount","scaling","capacityProvider","ec2Config"]));return{name:r(e.name)??"",image:r(e.image),docker:w(e.docker),ssmSecretsPath:r(e.ssmSecretsPath),containers:t,routing:I(e.routing),serviceType:m(e.serviceType,P),cpu:i(e.cpu),memoryLimitMiB:i(e.memoryLimitMiB),desiredCount:i(e.desiredCount),scaling:R(e.scaling),capacityProvider:m(e.capacityProvider,E)??"FARGATE",ec2Config:B(e.ec2Config),...c.length>0&&{extraProperties:c}}}a(M,"parseEcsService");function w(e){if(!s(e))return;const n=r(e.path);if(n===void 0)return;const t=r(e.context),o=r(e.target);return{path:n,...t!==void 0&&{context:t},...o!==void 0&&{target:o}}}a(w,"parseServiceDocker");function b(e,n){const t=r(e);if(t)return t;if(C(e)&&e.__expression.startsWith(n+"."))return e.__expression.slice(n.length+1)}a(b,"extractEnumString");function D(e){return h(e)?e.__call.match(/\(\s*"([^"]+)"\s*\)/)?.[1]:void 0}a(D,"extractCallStringArg");function H(e,n,t){t!==void 0&&(e[n]=t)}a(H,"assignIfDefined");export{H as assignIfDefined,D as extractCallStringArg,W as extractClusterConfig,b as extractEnumString,N as isEnvironmentRecord,M as parseEcsService};
1
+ var S=Object.defineProperty;var a=(e,n)=>S(e,"name",{value:n,configurable:!0});import{isPlainObject as y,isParsedObject as s,isExpressionRef as C,isCallRef as h,asString as r,asNumber as i,asBoolean as f,asStringArray as d,asStringUnion as m,captureExtraProperties as p}from"../common/astCommonParser.js";import{ECS_CAPACITY_PROVIDERS as E,ECS_SERVICE_TYPES as P,LOAD_BALANCER_TYPES as _,SCALING_TYPES as x,AMI_HARDWARE_TYPES as A}from"../../../schemas/constants.js";function T(e){return e!==void 0&&y(e)}a(T,"isEnvironmentRecord");function g(e){if(!s(e))return;const n={};for(const[t,o]of Object.entries(e))if(s(o)){const c=r(o.id),u=r(o.name);c&&u&&(n[t]={id:c,name:u,field:r(o.field)})}return Object.keys(n).length>0?n:void 0}a(g,"parseContainerSecretsImport");function N(e){if(!s(e))return;const n=d(e.command);if(!(!n||n.length===0))return{command:n,interval:i(e.interval),timeout:i(e.timeout),retries:i(e.retries),startPeriod:i(e.startPeriod)}}a(N,"parseContainerHealthCheck");function O(e){const t=p(e,new Set(["name","image","port","environment","essential","command","entryPoint","secretsImport","secrets","healthCheck"]));return{name:r(e.name),image:r(e.image),port:i(e.port),environment:T(e.environment)?e.environment:void 0,essential:f(e.essential),command:d(e.command),entryPoint:d(e.entryPoint),secretsImport:g(e.secretsImport),ssmSecrets:d(e.secrets),healthCheck:N(e.healthCheck),extraProperties:t.length>0?t:void 0}}a(O,"parseServiceContainer");function I(e){if(Array.isArray(e))return e.filter(s).map(n=>({path:r(n.path),host:r(n.host),priority:i(n.priority),healthCheckPath:r(n.healthCheckPath)}));if(s(e))return{path:r(e.path),host:r(e.host),priority:i(e.priority),healthCheckPath:r(e.healthCheckPath)}}a(I,"parseServiceRouting");function R(e){if(e===!1)return!1;if(s(e))return{minCapacity:i(e.minCapacity),maxCapacity:i(e.maxCapacity),desiredCount:i(e.desiredCount),scalingType:m(Y(e.scalingType,"ScalingType"),x)}}a(R,"parseServiceScaling");const l=new Set(["instanceType","amiHardwareType","minCapacity","maxCapacity","memoryLimitMiB","warmPool"]);function B(e){if(!s(e))return;const n=e.warmPool,t=s(n)?{minSize:i(n.minSize),reuseOnScaleIn:f(n.reuseOnScaleIn)}:void 0,o=p(e,l);return{instanceType:r(e.instanceType),amiHardwareType:m(e.amiHardwareType,A),minCapacity:i(e.minCapacity),maxCapacity:i(e.maxCapacity),memoryLimitMiB:i(e.memoryLimitMiB),warmPool:t,extraProperties:o.length>0?o:void 0}}a(B,"parseServiceEc2Config");const K=new Set(["domain","loadBalancer","directAccess"]);function M(e){if(!s(e))return;const n=e.loadBalancer,t=p(e,K);return{domain:r(e.domain),loadBalancer:n===!1?!1:m(n,_),directAccess:f(e.directAccess),...t.length>0&&{extraProperties:t}}}a(M,"extractClusterConfig");function b(e){const n=e.containers,t=Array.isArray(n)?n.filter(s).map(O):void 0,c=p(e,new Set(["name","image","docker","ssmSecretsPath","containers","routing","connections","serviceType","cpu","memoryLimitMiB","desiredCount","scaling","capacityProvider","ec2Config"]));return{name:r(e.name)??"",image:r(e.image),docker:w(e.docker),ssmSecretsPath:r(e.ssmSecretsPath),containers:t,routing:I(e.routing),serviceType:m(e.serviceType,P),cpu:i(e.cpu),memoryLimitMiB:i(e.memoryLimitMiB),desiredCount:i(e.desiredCount),scaling:R(e.scaling),capacityProvider:m(e.capacityProvider,E)??"FARGATE",ec2Config:B(e.ec2Config),...c.length>0&&{extraProperties:c}}}a(b,"parseEcsService");function w(e){if(!s(e))return;const n=r(e.path);if(n===void 0)return;const t=r(e.context),o=r(e.target);return{path:n,...t!==void 0&&{context:t},...o!==void 0&&{target:o}}}a(w,"parseServiceDocker");function Y(e,n){const t=r(e);if(t)return t;if(C(e)&&e.__expression.startsWith(n+"."))return e.__expression.slice(n.length+1)}a(Y,"extractEnumString");function D(e){return h(e)?e.__call.match(/\(\s*"([^"]+)"\s*\)/)?.[1]:void 0}a(D,"extractCallStringArg");function H(e,n,t){t!==void 0&&(e[n]=t)}a(H,"assignIfDefined");export{H as assignIfDefined,D as extractCallStringArg,M as extractClusterConfig,Y as extractEnumString,T as isEnvironmentRecord,b as parseEcsService};
@@ -7,6 +7,7 @@
7
7
  * add mutation helpers here.
8
8
  */
9
9
  import * as ts from "typescript";
10
+ import { type ScheduleStackPlacement } from "../../../schemas/constants.js";
10
11
  export interface ParsedScheduleCall {
11
12
  /** The schedule's CDK construct id, first arg of `app.addSchedule(...)` */
12
13
  id: string;
@@ -14,5 +15,7 @@ export interface ParsedScheduleCall {
14
15
  schedule: string;
15
16
  /** Variable name of the target const (e.g. `myLambda` from `target: myLambda`) */
16
17
  targetVariableName: string;
18
+ /** The statement's `stackPlacement` prop, absent when not written */
19
+ stackPlacement?: ScheduleStackPlacement;
17
20
  }
18
21
  export declare function findSchedules(sourceFile: ts.SourceFile): ParsedScheduleCall[];
@@ -1 +1 @@
1
- var c=Object.defineProperty;var a=(i,r)=>c(i,"name",{value:r,configurable:!0});import*as t from"typescript";import{asString as f,collectFromAst as g,isFactoryMethodCall as m,parseObjectLiteral as p}from"../common/astCommonParser.js";function x(i){return g(i,r=>{if(!t.isCallExpression(r)||!m(r,"addSchedule")||r.arguments.length<2)return null;const l=r.arguments[0],n=r.arguments[1];if(!t.isStringLiteral(l)||!t.isObjectLiteralExpression(n))return null;const o=p(n),u=f(o.schedule);if(u===void 0)return null;const e=n.properties.find(s=>t.isPropertyAssignment(s)&&t.isIdentifier(s.name)&&s.name.text==="target");return!e||!t.isPropertyAssignment(e)||!t.isIdentifier(e.initializer)?null:{id:l.text,schedule:u,targetVariableName:e.initializer.text}})}a(x,"findSchedules");export{x as findSchedules};
1
+ var f=Object.defineProperty;var c=(i,t)=>f(i,"name",{value:t,configurable:!0});import*as e from"typescript";import{asString as m,asStringUnion as g,collectFromAst as p,isFactoryMethodCall as d,parseObjectLiteral as S}from"../common/astCommonParser.js";import{SCHEDULE_STACK_PLACEMENTS as A}from"../../../schemas/constants.js";function P(i){return p(i,t=>{if(!e.isCallExpression(t)||!d(t,"addSchedule")||t.arguments.length<2)return null;const l=t.arguments[0],n=t.arguments[1];if(!e.isStringLiteral(l)||!e.isObjectLiteralExpression(n))return null;const a=S(n),u=m(a.schedule);if(u===void 0)return null;const r=n.properties.find(s=>e.isPropertyAssignment(s)&&e.isIdentifier(s.name)&&s.name.text==="target");if(!r||!e.isPropertyAssignment(r)||!e.isIdentifier(r.initializer))return null;const o=g(a.stackPlacement,A);return{id:l.text,schedule:u,targetVariableName:r.initializer.text,...o!==void 0&&{stackPlacement:o}}})}c(P,"findSchedules");export{P as findSchedules};
@@ -21,9 +21,9 @@ export declare const ResourceSnapshotSchema: z.ZodObject<{
21
21
  storage: "storage";
22
22
  database: "database";
23
23
  compute: "compute";
24
+ messaging: "messaging";
24
25
  pattern: "pattern";
25
26
  network: "network";
26
- messaging: "messaging";
27
27
  cdn: "cdn";
28
28
  "vpc-peer": "vpc-peer";
29
29
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -42,9 +42,9 @@ export declare const DriftStateSchema: z.ZodObject<{
42
42
  storage: "storage";
43
43
  database: "database";
44
44
  compute: "compute";
45
+ messaging: "messaging";
45
46
  pattern: "pattern";
46
47
  network: "network";
47
- messaging: "messaging";
48
48
  cdn: "cdn";
49
49
  "vpc-peer": "vpc-peer";
50
50
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -11,6 +11,13 @@ import type { InvalidPropertyError } from "../../types.js";
11
11
  * every key here is one a construct reads, in emission order.
12
12
  */
13
13
  export declare function buildPropertyInputs(properties: ReadonlyArray<EmittedProp>, quoteStyle: QuoteStyle): Result<ObjectPropertyInput[], InvalidPropertyError>;
14
+ /**
15
+ * The lexical shape an identifier segment must take before either emitter —
16
+ * this module's AST serialiser or the scaffold's string renderer
17
+ * (`generation/structuredSource.ts`) — will print it. Shared so the two
18
+ * printers refuse the same set.
19
+ */
20
+ export declare const IDENTIFIER_SOURCE_PATTERN: RegExp;
14
21
  /**
15
22
  * Names that match {@link IDENTIFIER_SOURCE_PATTERN} lexically but can never
16
23
  * be an identifier in the emitted file: ES reserved words, the strict-mode
@@ -1 +1 @@
1
- var E=Object.defineProperty;var u=(e,r)=>E(e,"name",{value:r,configurable:!0});import{builders as o}from"ast-types";import{failure as a,success as c}from"../../../types/Result.js";import{buildObjectProperty as b}from"../../fileRewriter/index.js";function P(e,r){const i=[];for(const n of e){const t=w(n,r);if(!t.success)return a(t.error);i.push({key:n.key,value:t.data})}return c(i)}u(P,"buildPropertyInputs");const h=/^[A-Za-z_$][A-Za-z0-9_$]*$/,g=new Set(["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","implements","interface","package","private","protected","public","let","static","eval","arguments"]);function w(e,r){if(e.kind==="expression")return h.test(e.source)?g.has(e.source)?a({kind:"InvalidPropertyError",property:e.key,reason:`\`${e.key}\` resolved to \`${e.source}\`, which is a JavaScript reserved word \u2014 no binding can carry that name, so splicing it would write a file that does not parse.`}):c(o.identifier(e.source)):a({kind:"InvalidPropertyError",property:e.key,reason:`\`${e.key}\` resolved to the expression \`${e.source}\`, which is not a bare identifier; this emitter only splices the name of a live binding.`});if(e.kind==="structured")return d(e.key,e.expression,r);const i=f(e.value,r);return i===void 0?a({kind:"InvalidPropertyError",property:e.key,reason:`Unsupported property value for "${e.key}" (accepts string/number/boolean/null/array/object of the same).`}):c(i)}u(w,"buildEmittedValue");function p(e,r){if(!h.test(r))return{kind:"InvalidPropertyError",property:e,reason:`\`${e}\` produced the expression segment \`${r}\`, which is not a bare identifier; structured expressions emit validated identifier segments only.`};if(g.has(r))return{kind:"InvalidPropertyError",property:e,reason:`\`${e}\` produced the expression segment \`${r}\`, which is a JavaScript reserved word \u2014 emitting it would write a file that does not parse.`}}u(p,"identifierSegmentRefusal");function y(e){return{kind:"InvalidPropertyError",property:e,reason:`Unsupported property value for "${e}" (accepts string/number/boolean/null/array/object of the same).`}}u(y,"unsupportedLiteralRefusal");function d(e,r,i){switch(r.kind){case"primary-binding":return a({kind:"InvalidPropertyError",property:e,reason:`\`${e}\` carries an unsubstituted primary-binding marker \u2014 only a sibling statement's props may reference the primary construct, and the sibling engine substitutes the marker before anything is built.`});case"literal":{const n=f(r.value,i);return n===void 0?a(y(e)):c(n)}case"identifier":{const n=p(e,r.name);return n!==void 0?a(n):c(o.identifier(r.name))}case"member":{const n=p(e,r.property);if(n!==void 0)return a(n);const t=d(e,r.object,i);return t.success?c(o.memberExpression(t.data,o.identifier(r.property),!1)):t}case"call":{const n=d(e,r.callee,i);if(!n.success)return n;const t=[];for(const s of r.args){if(s.kind==="identifier"){const m=p(e,s.name);if(m!==void 0)return a(m);t.push(o.identifier(s.name));continue}const l=f(s.value,i);if(l===void 0)return a(y(e));t.push(l)}return c(o.callExpression(n.data,t))}case"object":{const n=[];for(const t of r.entries){const s=d(e,t.value,i);if(!s.success)return s;n.push(b(t.key,s.data,i))}return c(o.objectExpression(n))}case"array":{const n=[];for(const t of r.elements){const s=d(e,t,i);if(!s.success)return s;n.push(s.data)}return c(o.arrayExpression(n))}}}u(d,"buildStructuredValue");function f(e,r){if(typeof e=="string")return x(e,r);if(typeof e=="number"&&Number.isFinite(e))return o.numericLiteral(e);if(typeof e=="boolean")return o.booleanLiteral(e);if(e===null)return o.nullLiteral();if(Array.isArray(e)){const i=[];for(const n of e){const t=f(n,r);if(t===void 0)return;i.push(t)}return o.arrayExpression(i)}if(typeof e=="object"&&e!==null){const i=[];for(const[n,t]of Object.entries(e)){const s=f(t,r);if(s===void 0)return;i.push(b(n,s,r))}return o.objectExpression(i)}}u(f,"toAstValue");function x(e,r){const i=r==="single"?"'":'"',n=r==="single"?e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),t=`${i}${n}${i}`;return o.stringLiteral.from({value:e,extra:{rawValue:e,raw:t}})}u(x,"makeStringLiteral");export{g as RESERVED_IDENTIFIER_NAMES,w as buildEmittedValue,P as buildPropertyInputs,d as buildStructuredValue,x as makeStringLiteral,f as toAstValue};
1
+ var E=Object.defineProperty;var u=(e,r)=>E(e,"name",{value:r,configurable:!0});import{builders as o}from"ast-types";import{failure as a,success as c}from"../../../types/Result.js";import{buildObjectProperty as b}from"../../fileRewriter/index.js";function P(e,r){const i=[];for(const n of e){const t=x(n,r);if(!t.success)return a(t.error);i.push({key:n.key,value:t.data})}return c(i)}u(P,"buildPropertyInputs");const h=/^[A-Za-z_$][A-Za-z0-9_$]*$/,g=new Set(["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","implements","interface","package","private","protected","public","let","static","eval","arguments"]);function x(e,r){if(e.kind==="expression")return h.test(e.source)?g.has(e.source)?a({kind:"InvalidPropertyError",property:e.key,reason:`\`${e.key}\` resolved to \`${e.source}\`, which is a JavaScript reserved word \u2014 no binding can carry that name, so splicing it would write a file that does not parse.`}):c(o.identifier(e.source)):a({kind:"InvalidPropertyError",property:e.key,reason:`\`${e.key}\` resolved to the expression \`${e.source}\`, which is not a bare identifier; this emitter only splices the name of a live binding.`});if(e.kind==="structured")return d(e.key,e.expression,r);const i=f(e.value,r);return i===void 0?a({kind:"InvalidPropertyError",property:e.key,reason:`Unsupported property value for "${e.key}" (accepts string/number/boolean/null/array/object of the same).`}):c(i)}u(x,"buildEmittedValue");function p(e,r){if(!h.test(r))return{kind:"InvalidPropertyError",property:e,reason:`\`${e}\` produced the expression segment \`${r}\`, which is not a bare identifier; structured expressions emit validated identifier segments only.`};if(g.has(r))return{kind:"InvalidPropertyError",property:e,reason:`\`${e}\` produced the expression segment \`${r}\`, which is a JavaScript reserved word \u2014 emitting it would write a file that does not parse.`}}u(p,"identifierSegmentRefusal");function y(e){return{kind:"InvalidPropertyError",property:e,reason:`Unsupported property value for "${e}" (accepts string/number/boolean/null/array/object of the same).`}}u(y,"unsupportedLiteralRefusal");function d(e,r,i){switch(r.kind){case"primary-binding":return a({kind:"InvalidPropertyError",property:e,reason:`\`${e}\` carries an unsubstituted primary-binding marker \u2014 only a sibling statement's props may reference the primary construct, and the sibling engine substitutes the marker before anything is built.`});case"literal":{const n=f(r.value,i);return n===void 0?a(y(e)):c(n)}case"identifier":{const n=p(e,r.name);return n!==void 0?a(n):c(o.identifier(r.name))}case"member":{const n=p(e,r.property);if(n!==void 0)return a(n);const t=d(e,r.object,i);return t.success?c(o.memberExpression(t.data,o.identifier(r.property),!1)):t}case"call":{const n=d(e,r.callee,i);if(!n.success)return n;const t=[];for(const s of r.args){if(s.kind==="identifier"){const m=p(e,s.name);if(m!==void 0)return a(m);t.push(o.identifier(s.name));continue}const l=f(s.value,i);if(l===void 0)return a(y(e));t.push(l)}return c(o.callExpression(n.data,t))}case"object":{const n=[];for(const t of r.entries){const s=d(e,t.value,i);if(!s.success)return s;n.push(b(t.key,s.data,i))}return c(o.objectExpression(n))}case"array":{const n=[];for(const t of r.elements){const s=d(e,t,i);if(!s.success)return s;n.push(s.data)}return c(o.arrayExpression(n))}}}u(d,"buildStructuredValue");function f(e,r){if(typeof e=="string")return w(e,r);if(typeof e=="number"&&Number.isFinite(e))return o.numericLiteral(e);if(typeof e=="boolean")return o.booleanLiteral(e);if(e===null)return o.nullLiteral();if(Array.isArray(e)){const i=[];for(const n of e){const t=f(n,r);if(t===void 0)return;i.push(t)}return o.arrayExpression(i)}if(typeof e=="object"&&e!==null){const i=[];for(const[n,t]of Object.entries(e)){const s=f(t,r);if(s===void 0)return;i.push(b(n,s,r))}return o.objectExpression(i)}}u(f,"toAstValue");function w(e,r){const i=r==="single"?"'":'"',n=r==="single"?e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),t=`${i}${n}${i}`;return o.stringLiteral.from({value:e,extra:{rawValue:e,raw:t}})}u(w,"makeStringLiteral");export{h as IDENTIFIER_SOURCE_PATTERN,g as RESERVED_IDENTIFIER_NAMES,x as buildEmittedValue,P as buildPropertyInputs,d as buildStructuredValue,w as makeStringLiteral,f as toAstValue};
@@ -86,3 +86,10 @@ export declare function buildMemberExpression(object: string, property: string):
86
86
  * printed output stays stable across repeated invocations.
87
87
  */
88
88
  export declare function appendSpecifier(importDecl: n.ImportDeclaration, name: string): void;
89
+ /**
90
+ * Whether `name` may print as a bare object key. Exported so the scaffold's
91
+ * string renderer (`generation/structuredSource.ts`) quotes exactly the keys
92
+ * `buildObjectProperty` quotes \u2014 two predicates would drift into a byte
93
+ * divergence at the renderer\u2261serialiser mirror.
94
+ */
95
+ export declare function isValidIdentifier(name: string): boolean;
@@ -1 +1 @@
1
- var a=Object.defineProperty;var n=(e,i)=>a(e,"name",{value:i,configurable:!0});import{builders as t}from"ast-types";function y(e){return t.expressionStatement(s(e))}n(y,"buildFactoryStatement");function E(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[s(e)]);return t.expressionStatement(i)}n(E,"buildAppMethodWrappedStatement");function g(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[p(e.name,e.quoteStyle),t.objectExpression(e.properties.map(r=>u(r.key,r.value,e.quoteStyle)))]);return t.expressionStatement(i)}n(g,"buildAppMethodStatement");function s(e){const i=t.memberExpression(t.identifier(e.factory),t.identifier("build"),!1),r=p(e.name,e.quoteStyle),o=t.objectExpression(e.properties.map(c=>u(c.key,c.value,e.quoteStyle)));return t.callExpression(i,[r,o])}n(s,"buildFactoryCall");function u(e,i,r){const o=b(e)?t.identifier(e):p(e,r);return t.property("init",o,i)}n(u,"buildObjectProperty");function I(e,i,r="double"){const o=e.map(l=>t.importSpecifier(t.identifier(l))),c=p(i,r);return t.importDeclaration(o,c)}n(I,"buildImportDeclaration");function f(e,i){return t.memberExpression(t.identifier(e),t.identifier(i),!1)}n(f,"buildMemberExpression");function h(e,i){Array.isArray(e.specifiers)||(e.specifiers=[]);for(const r of e.specifiers)if(x(r)&&r.imported.name===i)return;e.specifiers.push(t.importSpecifier(t.identifier(i)))}n(h,"appendSpecifier");function p(e,i){const r=i==="single"?"'":'"',o=`${r}${d(e,i)}${r}`;return t.stringLiteral.from({value:e,extra:{rawValue:e,raw:o}})}n(p,"makeStringLiteral");function d(e,i){const r=e.replace(/\\/g,"\\\\");return i==="single"?r.replace(/'/g,"\\'"):r.replace(/"/g,'\\"')}n(d,"escapeForQuote");function b(e){return/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u.test(e)}n(b,"isValidIdentifier");function x(e){return e!==null&&typeof e=="object"&&"type"in e&&e.type==="ImportSpecifier"}n(x,"isNamedImportSpecifier");export{h as appendSpecifier,g as buildAppMethodStatement,E as buildAppMethodWrappedStatement,y as buildFactoryStatement,I as buildImportDeclaration,f as buildMemberExpression,u as buildObjectProperty};
1
+ var a=Object.defineProperty;var n=(e,i)=>a(e,"name",{value:i,configurable:!0});import{builders as t}from"ast-types";function y(e){return t.expressionStatement(s(e))}n(y,"buildFactoryStatement");function E(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[s(e)]);return t.expressionStatement(i)}n(E,"buildAppMethodWrappedStatement");function g(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[c(e.name,e.quoteStyle),t.objectExpression(e.properties.map(r=>u(r.key,r.value,e.quoteStyle)))]);return t.expressionStatement(i)}n(g,"buildAppMethodStatement");function s(e){const i=t.memberExpression(t.identifier(e.factory),t.identifier("build"),!1),r=c(e.name,e.quoteStyle),o=t.objectExpression(e.properties.map(p=>u(p.key,p.value,e.quoteStyle)));return t.callExpression(i,[r,o])}n(s,"buildFactoryCall");function u(e,i,r){const o=b(e)?t.identifier(e):c(e,r);return t.property("init",o,i)}n(u,"buildObjectProperty");function I(e,i,r="double"){const o=e.map(l=>t.importSpecifier(t.identifier(l))),p=c(i,r);return t.importDeclaration(o,p)}n(I,"buildImportDeclaration");function f(e,i){return t.memberExpression(t.identifier(e),t.identifier(i),!1)}n(f,"buildMemberExpression");function h(e,i){Array.isArray(e.specifiers)||(e.specifiers=[]);for(const r of e.specifiers)if(x(r)&&r.imported.name===i)return;e.specifiers.push(t.importSpecifier(t.identifier(i)))}n(h,"appendSpecifier");function c(e,i){const r=i==="single"?"'":'"',o=`${r}${d(e,i)}${r}`;return t.stringLiteral.from({value:e,extra:{rawValue:e,raw:o}})}n(c,"makeStringLiteral");function d(e,i){const r=e.replace(/\\/g,"\\\\");return i==="single"?r.replace(/'/g,"\\'"):r.replace(/"/g,'\\"')}n(d,"escapeForQuote");function b(e){return/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u.test(e)}n(b,"isValidIdentifier");function x(e){return e!==null&&typeof e=="object"&&"type"in e&&e.type==="ImportSpecifier"}n(x,"isNamedImportSpecifier");export{h as appendSpecifier,g as buildAppMethodStatement,E as buildAppMethodWrappedStatement,y as buildFactoryStatement,I as buildImportDeclaration,f as buildMemberExpression,u as buildObjectProperty,b as isValidIdentifier};
@@ -16,9 +16,9 @@ export declare const StatementTypeSchema: z.ZodEnum<{
16
16
  storage: "storage";
17
17
  database: "database";
18
18
  compute: "compute";
19
+ messaging: "messaging";
19
20
  pattern: "pattern";
20
21
  network: "network";
21
- messaging: "messaging";
22
22
  cdn: "cdn";
23
23
  "vpc-peer": "vpc-peer";
24
24
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -41,9 +41,9 @@ export declare const AddOptionsSchema: z.ZodObject<{
41
41
  storage: "storage";
42
42
  database: "database";
43
43
  compute: "compute";
44
+ messaging: "messaging";
44
45
  pattern: "pattern";
45
46
  network: "network";
46
- messaging: "messaging";
47
47
  cdn: "cdn";
48
48
  "vpc-peer": "vpc-peer";
49
49
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -66,9 +66,9 @@ export declare const RemoveOptionsSchema: z.ZodObject<{
66
66
  storage: "storage";
67
67
  database: "database";
68
68
  compute: "compute";
69
+ messaging: "messaging";
69
70
  pattern: "pattern";
70
71
  network: "network";
71
- messaging: "messaging";
72
72
  cdn: "cdn";
73
73
  "vpc-peer": "vpc-peer";
74
74
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -87,9 +87,9 @@ export declare const ModifyOptionsSchema: z.ZodObject<{
87
87
  storage: "storage";
88
88
  database: "database";
89
89
  compute: "compute";
90
+ messaging: "messaging";
90
91
  pattern: "pattern";
91
92
  network: "network";
92
- messaging: "messaging";
93
93
  cdn: "cdn";
94
94
  "vpc-peer": "vpc-peer";
95
95
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -123,9 +123,9 @@ export declare const ResourceListingEntrySchema: z.ZodObject<{
123
123
  storage: "storage";
124
124
  database: "database";
125
125
  compute: "compute";
126
+ messaging: "messaging";
126
127
  pattern: "pattern";
127
128
  network: "network";
128
- messaging: "messaging";
129
129
  cdn: "cdn";
130
130
  "vpc-peer": "vpc-peer";
131
131
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -147,9 +147,9 @@ export declare const ResourceListingSchema: z.ZodObject<{
147
147
  storage: "storage";
148
148
  database: "database";
149
149
  compute: "compute";
150
+ messaging: "messaging";
150
151
  pattern: "pattern";
151
152
  network: "network";
152
- messaging: "messaging";
153
153
  cdn: "cdn";
154
154
  "vpc-peer": "vpc-peer";
155
155
  "vpc-peer-accepter": "vpc-peer-accepter";
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * Shared helper functions used across all generation modules.
5
5
  */
6
- import type { ProjectedProp } from "../projection/types.js";
7
6
  import type { IdentifierValue, ExpressionValue, CallValue, SpecialValue } from "../schemas/resourceSchemas.js";
8
7
  export type { IdentifierValue, ExpressionValue, CallValue, SpecialValue };
9
8
  export { toPascalCase, toKebab, toValidDatabaseName } from "@fjall/util";
@@ -92,12 +91,6 @@ export declare function resolveResourceVariable(plan: {
92
91
  * Simple objects (few primitive values) are kept on one line.
93
92
  */
94
93
  export declare function formatValue(value: unknown, baseIndent?: string): string;
95
- /**
96
- * Render projected construct props as the body of an object literal —
97
- * `\n<indent>key: value` per prop, comma-separated, no trailing comma. The
98
- * caller supplies the surrounding braces and whatever it appends after.
99
- */
100
- export declare function emitProjectedProps(props: ReadonlyArray<ProjectedProp>, indent?: string): string;
101
94
  type PropertyFormat = "raw" | "string" | "object" | "boolean-or-object";
102
95
  /**
103
96
  * Build a property string for code generation.
@@ -1,8 +1,7 @@
1
- var p=Object.defineProperty;var n=(e,t)=>p(e,"name",{value:t,configurable:!0});import{toPascalCase as T,toKebab as V,toValidDatabaseName as C}from"@fjall/util";function c(e){return JSON.stringify(e)}n(c,"escapeStringLiteral");function g(e){return e.map(c).join(", ")}n(g,"formatStringArray");const d="import:SharedAlarmTopicArn";function _(e=" "){return`
2
- ${e}...(getConfig().environment === "production" ? { alertsTopic: ${c(d)} } : {}),`}n(_,"emitProductionAlertsTopicSpread");function $(e){return e===0?"":`_${String(e+1)}`}n($,"connectionEnvSuffix");function x(e,t){if(e===t)return 1;if(!e.startsWith(`${t}_`))return;const r=e.slice(t.length+1);return/^\d+$/.test(r)?parseInt(r,10):void 0}n(x,"connectionKeyOrdinal");function l(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.__identifier=="string"||typeof t.__expression=="string"||typeof t.__call=="string"}n(l,"isSpecialValue");function u(e){return e.replace(/[^a-zA-Z0-9]/g," ").split(" ").map((t,r)=>r===0?t.charAt(0).toLowerCase()+t.slice(1):t.charAt(0).toUpperCase()+t.slice(1)).join("")}n(u,"toVariableName");function j(e){return e.variableName??u(e.name)}n(j,"getVariableName");function S(e,t){for(const r of e.database)if(r.name===t&&r.variableName)return r.variableName;for(const r of e.s3)if(r.name===t&&r.variableName)return r.variableName;for(const r of e.compute)if(r.name===t&&r.variableName)return r.variableName;for(const r of e.dynamodb??[])if(r.name===t&&r.variableName)return r.variableName;for(const r of e.sqs??[])if(r.name===t&&r.variableName)return r.variableName;return u(t)}n(S,"resolveResourceVariable");function b(e){const t=Object.entries(e);return t.length===0?!0:t.length>1?!1:t.every(([,r])=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null)}n(b,"isSimpleObject");function f(e,t=" "){if(e==null)return"undefined";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(l(e)){if("__identifier"in e)return e.__identifier;if("__expression"in e)return e.__expression;if("__call"in e)return e.__call}if(Array.isArray(e))return`[${e.map(r=>f(r,t)).join(", ")}]`;if(typeof e=="object"){const r=Object.entries(e).filter(([,a])=>a!==void 0);if(b(e)){const a=r.map(([s,m])=>`${s}: ${f(m,t)}`).join(", ");return a?`{ ${a} }`:"{}"}const i=t+" ",o=r.map(([a,s])=>`${i}${a}: ${f(s,i)}`).join(`,
3
- `);return o?`{
4
- ${o}
5
- ${t}}`:"{}"}return JSON.stringify(e)}n(f,"formatValue");function h(e,t=" "){return e.map(i=>{const o=r(i);return`
6
- ${t}${i.key}: ${o}`}).join(",");function r(i){switch(i.value.kind){case"expression":return i.value.source;case"structured":throw new Error(`emitProjectedProps cannot render the structured value for "${i.key}" \u2014 structured expressions are emitted by the codemod's AST serialiser only.`);case"literal":return f(i.value.value,t)}}}n(h,"emitProjectedProps");function N(e,t,r,i="raw"){if(!e)return"";let o;switch(i){case"string":o=c(String(r));break;case"object":o=f(r);break;case"boolean-or-object":o=r===!1?"false":f(r);break;default:o=String(r)}return`
7
- ${t}: ${o},`}n(N,"buildProperty");function A(e,t=" "){return e?.length?e.map(r=>`
8
- ${t}${r.key}: ${r.sourceText},`).join(""):""}n(A,"emitExtraProperties");export{d as PRODUCTION_ALERTS_TOPIC_IMPORT,N as buildProperty,$ as connectionEnvSuffix,x as connectionKeyOrdinal,A as emitExtraProperties,_ as emitProductionAlertsTopicSpread,h as emitProjectedProps,c as escapeStringLiteral,g as formatStringArray,f as formatValue,j as getVariableName,l as isSpecialValue,S as resolveResourceVariable,V as toKebab,T as toPascalCase,C as toValidDatabaseName,u as toVariableName};
1
+ var m=Object.defineProperty;var n=(t,e)=>m(t,"name",{value:e,configurable:!0});import{toPascalCase as T,toKebab as V,toValidDatabaseName as C}from"@fjall/util";function c(t){return JSON.stringify(t)}n(c,"escapeStringLiteral");function _(t){return t.map(c).join(", ")}n(_,"formatStringArray");const b="import:SharedAlarmTopicArn";function y(t=" "){return`
2
+ ${t}...(getConfig().environment === "production" ? { alertsTopic: ${c(b)} } : {}),`}n(y,"emitProductionAlertsTopicSpread");function $(t){return t===0?"":`_${String(t+1)}`}n($,"connectionEnvSuffix");function x(t,e){if(t===e)return 1;if(!t.startsWith(`${e}_`))return;const r=t.slice(e.length+1);return/^\d+$/.test(r)?parseInt(r,10):void 0}n(x,"connectionKeyOrdinal");function l(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.__identifier=="string"||typeof e.__expression=="string"||typeof e.__call=="string"}n(l,"isSpecialValue");function p(t){return t.replace(/[^a-zA-Z0-9]/g," ").split(" ").map((e,r)=>r===0?e.charAt(0).toLowerCase()+e.slice(1):e.charAt(0).toUpperCase()+e.slice(1)).join("")}n(p,"toVariableName");function S(t){return t.variableName??p(t.name)}n(S,"getVariableName");function j(t,e){for(const r of t.database)if(r.name===e&&r.variableName)return r.variableName;for(const r of t.s3)if(r.name===e&&r.variableName)return r.variableName;for(const r of t.compute)if(r.name===e&&r.variableName)return r.variableName;for(const r of t.dynamodb??[])if(r.name===e&&r.variableName)return r.variableName;for(const r of t.sqs??[])if(r.name===e&&r.variableName)return r.variableName;return p(e)}n(j,"resolveResourceVariable");function d(t){const e=Object.entries(t);return e.length===0?!0:e.length>1?!1:e.every(([,r])=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null)}n(d,"isSimpleObject");function f(t,e=" "){if(t==null)return"undefined";if(typeof t=="string")return JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return String(t);if(l(t)){if("__identifier"in t)return t.__identifier;if("__expression"in t)return t.__expression;if("__call"in t)return t.__call}if(Array.isArray(t))return`[${t.map(r=>f(r,e)).join(", ")}]`;if(typeof t=="object"){const r=Object.entries(t).filter(([,o])=>o!==void 0);if(d(t)){const o=r.map(([s,u])=>`${s}: ${f(u,e)}`).join(", ");return o?`{ ${o} }`:"{}"}const a=e+" ",i=r.map(([o,s])=>`${a}${o}: ${f(s,a)}`).join(`,
3
+ `);return i?`{
4
+ ${i}
5
+ ${e}}`:"{}"}return JSON.stringify(t)}n(f,"formatValue");function N(t,e,r,a="raw"){if(!t)return"";let i;switch(a){case"string":i=c(String(r));break;case"object":i=f(r);break;case"boolean-or-object":i=r===!1?"false":f(r);break;default:i=String(r)}return`
6
+ ${e}: ${i},`}n(N,"buildProperty");function O(t,e=" "){return t?.length?t.map(r=>`
7
+ ${e}${r.key}: ${r.sourceText},`).join(""):""}n(O,"emitExtraProperties");export{b as PRODUCTION_ALERTS_TOPIC_IMPORT,N as buildProperty,$ as connectionEnvSuffix,x as connectionKeyOrdinal,O as emitExtraProperties,y as emitProductionAlertsTopicSpread,c as escapeStringLiteral,_ as formatStringArray,f as formatValue,S as getVariableName,l as isSpecialValue,j as resolveResourceVariable,V as toKebab,T as toPascalCase,C as toValidDatabaseName,p as toVariableName};
@@ -1,2 +1,9 @@
1
1
  import type { ComputeResourcePlan } from "../../schemas/resourceSchemas.js";
2
+ /**
3
+ * The EC2's plan fragment for `projectPlanToConstructProps("compute", …)`.
4
+ * Inclusion policy stays here; the shared table owns the names and shapes
5
+ * (`enableSSH` → `ssh: {}` / `ssh: false`; `keyName`/`userData`/
6
+ * `securityGroups` are plan-only and never emitted).
7
+ */
8
+ export declare function buildEc2ProjectionFragment(compute: ComputeResourcePlan): Record<string, unknown>;
2
9
  export declare function generateEc2Code(compute: ComputeResourcePlan): string;
@@ -1,4 +1,2 @@
1
- var i=Object.defineProperty;var r=(e,n)=>i(e,"name",{value:n,configurable:!0});import{emitExtraProperties as t,escapeStringLiteral as a}from"../common.js";function l(e){let n="";return e.instanceType&&(n+=`
2
- instanceType: ${a(e.instanceType)},`),e.enableSSH!==void 0&&(n+=e.enableSSH?`
3
- ssh: {},`:`
4
- ssh: false,`),n+=t(e.extraProperties),n}r(l,"generateEc2Code");export{l as generateEc2Code};
1
+ var i=Object.defineProperty;var o=(e,r)=>i(e,"name",{value:r,configurable:!0});import{projectPlanToConstructProps as p}from"../../projection/index.js";import{emitExtraProperties as a}from"../common.js";import{renderProjectedValueSource as c}from"../structuredSource.js";function s(e){return{...e.instanceType&&{instanceType:e.instanceType},...e.enableSSH!==void 0&&{enableSSH:e.enableSSH}}}o(s,"buildEc2ProjectionFragment");function u(e){const{props:r}=p("compute",s(e));let n="";for(const t of r)n+=`
2
+ ${t.key}: ${c(t,{indent:" "})},`;return n+=a(e.extraProperties),n}o(u,"generateEc2Code");export{s as buildEc2ProjectionFragment,u as generateEc2Code};
@@ -1,43 +1,43 @@
1
- var O=Object.defineProperty;var u=(e,n)=>O(e,"name",{value:n,configurable:!0});import{formatValue as S,emitExtraProperties as E,escapeStringLiteral as o,formatStringArray as k,emitProductionAlertsTopicSpread as R}from"../common.js";import{DATABASE_ENV_VARS as y,getConnectedDatabases as D,buildDatabaseEnvVars as N}from"../database.js";import{STORAGE_ENV_VARS as B,getConnectedStorage as j,buildStorageEnvVars as L,formatAllConnectionsCode as _}from"../storageConnections.js";import{MESSAGING_ENV_VARS as C,getConnectedMessaging as H,buildMessagingEnvVars as w}from"../messagingConnections.js";import{BASE_ENVIRONMENT_VARS as I,computeHasConnections as G,computeHasDatabaseConnections as P,computeHasMessagingConnections as M,computeHasStorageConnections as V,formatCompactOrExpandedObject as $,formatEnvBlock as x}from"./shared.js";function J(e){const n=[];if(e.instanceType!==void 0&&n.push(`instanceType: ${o(e.instanceType)}`),e.amiHardwareType!==void 0&&n.push(`amiHardwareType: ${o(e.amiHardwareType)}`),e.minCapacity!==void 0&&n.push(`minCapacity: ${e.minCapacity}`),e.maxCapacity!==void 0&&n.push(`maxCapacity: ${e.maxCapacity}`),e.memoryLimitMiB!==void 0&&n.push(`memoryLimitMiB: ${e.memoryLimitMiB}`),e.warmPool!==void 0&&n.push(`warmPool: ${S(e.warmPool," ")}`),e.extraProperties?.length)for(const t of e.extraProperties)n.push(`${t.key}: ${t.sourceText}`);return`
2
- ec2Config: ${$(n," "," ")},`}u(J,"generateEcsServiceEc2ConfigCode");function K(e){if(!e.cluster)return"";const n=[];if(e.cluster.directAccess&&n.push("directAccess: true"),e.cluster.domain&&n.push(`domain: ${o(e.cluster.domain)}`),e.cluster.loadBalancer!==void 0&&n.push(e.cluster.loadBalancer===!1?"loadBalancer: false":`loadBalancer: ${o(e.cluster.loadBalancer)}`),e.cluster.extraProperties?.length)for(const t of e.cluster.extraProperties)n.push(`${t.key}: ${t.sourceText}`);return`
3
- cluster: ${$(n," "," ")},`}u(K,"generateEcsClusterCode");function U(e,n,t,l,p,h){let i="";e.name&&(i+=`
1
+ var O=Object.defineProperty;var m=(e,n)=>O(e,"name",{value:n,configurable:!0});import{scalingTypeBinding as k}from"../../projection/compute.js";import{formatValue as v,emitExtraProperties as E,escapeStringLiteral as o,formatStringArray as N,emitProductionAlertsTopicSpread as R}from"../common.js";import{renderStructuredValueSource as B}from"../structuredSource.js";import{DATABASE_ENV_VARS as y,getConnectedDatabases as D,buildDatabaseEnvVars as j}from"../database.js";import{STORAGE_ENV_VARS as L,getConnectedStorage as _,buildStorageEnvVars as w,formatAllConnectionsCode as H}from"../storageConnections.js";import{MESSAGING_ENV_VARS as C,getConnectedMessaging as I,buildMessagingEnvVars as G}from"../messagingConnections.js";import{BASE_ENVIRONMENT_VARS as J,computeHasConnections as K,computeHasDatabaseConnections as P,computeHasMessagingConnections as T,computeHasStorageConnections as V,formatCompactOrExpandedObject as $,formatEnvBlock as M}from"./shared.js";function U(e){const n=[];if(e.instanceType!==void 0&&n.push(`instanceType: ${o(e.instanceType)}`),e.amiHardwareType!==void 0&&n.push(`amiHardwareType: ${o(e.amiHardwareType)}`),e.minCapacity!==void 0&&n.push(`minCapacity: ${e.minCapacity}`),e.maxCapacity!==void 0&&n.push(`maxCapacity: ${e.maxCapacity}`),e.memoryLimitMiB!==void 0&&n.push(`memoryLimitMiB: ${e.memoryLimitMiB}`),e.warmPool!==void 0&&n.push(`warmPool: ${v(e.warmPool," ")}`),e.extraProperties?.length)for(const s of e.extraProperties)n.push(`${s.key}: ${s.sourceText}`);return`
2
+ ec2Config: ${$(n," "," ")},`}m(U,"generateEcsServiceEc2ConfigCode");function W(e){if(!e.cluster)return"";const n=[];if(e.cluster.directAccess&&n.push("directAccess: true"),e.cluster.domain&&n.push(`domain: ${o(e.cluster.domain)}`),e.cluster.loadBalancer!==void 0&&n.push(e.cluster.loadBalancer===!1?"loadBalancer: false":`loadBalancer: ${o(e.cluster.loadBalancer)}`),e.cluster.extraProperties?.length)for(const s of e.cluster.extraProperties)n.push(`${s.key}: ${s.sourceText}`);return`
3
+ cluster: ${$(n," "," ")},`}m(W,"generateEcsClusterCode");function z(e,n,s,f,l,h){let i="";e.name&&(i+=`
4
4
  name: ${o(e.name)},`),e.image&&(i+=`
5
5
  image: ${o(e.image)},`),e.port!==void 0&&(i+=`
6
6
  port: ${e.port},`),e.essential!==void 0&&(i+=`
7
7
  essential: ${e.essential},`),e.command?.length&&(i+=`
8
8
  command: ${JSON.stringify(e.command)},`),e.entryPoint?.length&&(i+=`
9
- entryPoint: ${JSON.stringify(e.entryPoint)},`);const c=[y.HOST,y.PORT,y.NAME,y.SSL,y.USERNAME,y.PASSWORD,B.NAME,C.URL,C.ARN],r=u(a=>{if(!a)return a;const d={};for(const[m,g]of Object.entries(a))c.some(v=>m===v||m.startsWith(`${v}_`))||(d[m]=g);return Object.keys(d).length>0?d:void 0},"stripConnectionEnv"),f=n?{...h,...t.env,...l.env,...p.env,...e.environment}:{...h,...r(e.environment)},s=n?{...t.secrets,...e.secretsImport}:r(e.secretsImport);return f&&Object.keys(f).length>0&&(i+=`
9
+ entryPoint: ${JSON.stringify(e.entryPoint)},`);const c=[y.HOST,y.PORT,y.NAME,y.SSL,y.USERNAME,y.PASSWORD,L.NAME,C.URL,C.ARN],r=m(a=>{if(!a)return a;const d={};for(const[p,g]of Object.entries(a))c.some(S=>p===S||p.startsWith(`${S}_`))||(d[p]=g);return Object.keys(d).length>0?d:void 0},"stripConnectionEnv"),u=n?{...h,...s.env,...f.env,...l.env,...e.environment}:{...h,...r(e.environment)},t=n?{...s.secrets,...e.secretsImport}:r(e.secretsImport);return u&&Object.keys(u).length>0&&(i+=`
10
10
  environment: {
11
- ${x(f," ")}
12
- },`),s&&Object.keys(s).length>0&&(i+=`
11
+ ${M(u," ")}
12
+ },`),t&&Object.keys(t).length>0&&(i+=`
13
13
  secretsImport: {
14
- ${x(s," ")}
14
+ ${M(t," ")}
15
15
  },`),e.ssmSecrets&&e.ssmSecrets.length>0&&(i+=`
16
- secrets: [${k(e.ssmSecrets)}],`),e.healthCheck&&(i+=`
17
- healthCheck: ${S(e.healthCheck," ")},`),i+=E(e.extraProperties," "),i}u(U,"generateEcsContainerCode");function A(e,n){const t=[];return e.path&&t.push(`path: ${o(e.path)}`),e.host&&t.push(`host: ${o(e.host)}`),e.priority!==void 0&&t.push(`priority: ${e.priority}`),e.healthCheckPath&&t.push(`healthCheckPath: ${o(e.healthCheckPath)}`),$(t,n,`${n} `)}u(A,"formatRoutingRule");function W(e){const n=Array.isArray(e)?e:[e];return n.length===1?`
18
- routing: ${A(n[0]," ")},`:`
16
+ secrets: [${N(e.ssmSecrets)}],`),e.healthCheck&&(i+=`
17
+ healthCheck: ${v(e.healthCheck," ")},`),i+=E(e.extraProperties," "),i}m(z,"generateEcsContainerCode");function x(e,n){const s=[];return e.path&&s.push(`path: ${o(e.path)}`),e.host&&s.push(`host: ${o(e.host)}`),e.priority!==void 0&&s.push(`priority: ${e.priority}`),e.healthCheckPath&&s.push(`healthCheckPath: ${o(e.healthCheckPath)}`),$(s,n,`${n} `)}m(x,"formatRoutingRule");function Y(e){const n=Array.isArray(e)?e:[e];return n.length===1?`
18
+ routing: ${x(n[0]," ")},`:`
19
19
  routing: [
20
- ${n.map(l=>A(l," ")).join(`,
20
+ ${n.map(f=>x(f," ")).join(`,
21
21
  `)},
22
- ],`}u(W,"generateEcsServiceRoutingCode");function q(e){if(e===!1)return`
23
- scaling: false,`;if(typeof e!="object"||!(e.minCapacity!==void 0||e.maxCapacity!==void 0||e.desiredCount!==void 0||e.scalingType!==void 0))return"";const t=[];return e.minCapacity!==void 0&&t.push(`minCapacity: ${e.minCapacity}`),e.maxCapacity!==void 0&&t.push(`maxCapacity: ${e.maxCapacity}`),e.desiredCount!==void 0&&t.push(`desiredCount: ${e.desiredCount}`),e.scalingType&&t.push(`scalingType: ${o(e.scalingType)}`),`
24
- scaling: ${$(t," "," ")},`}u(q,"generateEcsServiceScalingCode");function z(e,n,t){return{needsDb:e.needsDatabaseConnection!==void 0?e.needsDatabaseConnection:n&&P(t),needsStorage:e.needsStorageConnection!==void 0?e.needsStorageConnection:n&&V(t),needsMessaging:e.needsMessagingConnection!==void 0?e.needsMessagingConnection:n&&M(t)}}u(z,"deriveServiceConnectionNeeds");function F(e){const{service:n,isFirstService:t,hasConnections:l,dbEnvVars:p,storageEnvVars:h,messagingEnvVars:i,baseEnvVars:c,plan:r,compute:f}=e;let s=`
25
- name: ${o(n.name)},`;s+=`
26
- capacityProvider: ${o(n.capacityProvider)},`,n.serviceType!==void 0&&(s+=`
27
- serviceType: ${o(n.serviceType)},`),n.ec2Config&&(s+=J(n.ec2Config)),n.docker&&(s+=`
28
- docker: ${S(n.docker," ")},`),n.image&&(s+=`
29
- image: ${o(n.image)},`),n.ssmSecretsPath&&(s+=`
30
- ssmSecretsPath: ${o(n.ssmSecretsPath)},`);const a=z(n,t,f);if(n.containers?.length){s+=`
31
- containers: [{`;for(let d=0;d<n.containers.length;d++){const m=n.containers[d];if(!m)continue;const g=d===0&&(a.needsDb||a.needsStorage||a.needsMessaging)&&l,b=a.needsDb?p:{env:{},secrets:{}},v=a.needsStorage?h:{env:{},secrets:{}},T=a.needsMessaging?i:{env:{},secrets:{}};d>0&&(s+=`
32
- }, {`),s+=U(m,g,b,v,T,c)}s+=`
33
- }],`}if(n.routing&&(s+=W(n.routing)),n.cpu!==void 0&&(s+=`
34
- cpu: ${n.cpu},`),n.memoryLimitMiB!==void 0&&(s+=`
35
- memoryLimitMiB: ${n.memoryLimitMiB},`),n.desiredCount!==void 0&&(s+=`
36
- desiredCount: ${n.desiredCount},`),n.scaling!==void 0&&(s+=q(n.scaling)),n.alarms===!1?s+=`
37
- alarms: false,`:typeof n.alarms=="object"&&(s+=`
38
- alarms: ${S(n.alarms," ")},`),s+=E(n.extraProperties," "),a.needsDb||a.needsStorage||a.needsMessaging){const d=a.needsDb?D(r,f):[],m=a.needsStorage?j(r,f):[],g=a.needsMessaging?H(r,f):[];(d.length>0||m.length>0||g.length>0)&&(s+=`
39
- ${_(d,m,g)}`)}return s}u(F,"generateEcsServiceCode");function te(e,n){const t=G(e),l={...I},p={env:{},secrets:{}};if(P(e)){const r=N(n,e);Object.assign(p.env,r.env),Object.assign(p.secrets,r.secrets)}const h={env:{},secrets:{}};if(V(e)){const r=L(n,e);Object.assign(h.env,r.env)}const i={env:{},secrets:{}};if(M(e)){const r=w(n,e);Object.assign(i.env,r.env)}let c=`
40
- ecrRepository: app.getDefaultContainerRegistry(),`;if(c+=K(e),e.services?.length){c+=`
41
- services: [{`;for(let r=0;r<e.services.length;r++){const f=e.services[r];f&&(r>0&&(c+=`
42
- }, {`),c+=F({service:f,isFirstService:r===0,hasConnections:t,dbEnvVars:p,storageEnvVars:h,messagingEnvVars:i,baseEnvVars:l,plan:n,compute:e}))}c+=`
43
- }],`}return c+=E(e.extraProperties),c+=R(),c}u(te,"generateEcsCode");export{te as generateEcsCode};
22
+ ],`}m(Y,"generateEcsServiceRoutingCode");function q(e){if(e===!1)return`
23
+ scaling: false,`;if(typeof e!="object"||!(e.minCapacity!==void 0||e.maxCapacity!==void 0||e.desiredCount!==void 0||e.scalingType!==void 0))return"";const s=[];if(e.minCapacity!==void 0&&s.push(`minCapacity: ${e.minCapacity}`),e.maxCapacity!==void 0&&s.push(`maxCapacity: ${e.maxCapacity}`),e.desiredCount!==void 0&&s.push(`desiredCount: ${e.desiredCount}`),e.scalingType){const f=k(e.scalingType);if(f===void 0)throw new Error(`services[].scaling.scalingType \`${e.scalingType}\` is not a ScalingType member name \u2014 the schema gate (z.enum(SCALING_TYPES)) should have refused this plan.`);s.push(`scalingType: ${B("scalingType",f.expression)}`)}return`
24
+ scaling: ${$(s," "," ")},`}m(q,"generateEcsServiceScalingCode");function F(e,n,s){return{needsDb:e.needsDatabaseConnection!==void 0?e.needsDatabaseConnection:n&&P(s),needsStorage:e.needsStorageConnection!==void 0?e.needsStorageConnection:n&&V(s),needsMessaging:e.needsMessagingConnection!==void 0?e.needsMessagingConnection:n&&T(s)}}m(F,"deriveServiceConnectionNeeds");function Q(e){const{service:n,isFirstService:s,hasConnections:f,dbEnvVars:l,storageEnvVars:h,messagingEnvVars:i,baseEnvVars:c,plan:r,compute:u}=e;let t=`
25
+ name: ${o(n.name)},`;t+=`
26
+ capacityProvider: ${o(n.capacityProvider)},`,n.serviceType!==void 0&&(t+=`
27
+ serviceType: ${o(n.serviceType)},`),n.ec2Config&&(t+=U(n.ec2Config)),n.docker&&(t+=`
28
+ docker: ${v(n.docker," ")},`),n.image&&(t+=`
29
+ image: ${o(n.image)},`),n.ssmSecretsPath&&(t+=`
30
+ ssmSecretsPath: ${o(n.ssmSecretsPath)},`);const a=F(n,s,u);if(n.containers?.length){t+=`
31
+ containers: [{`;for(let d=0;d<n.containers.length;d++){const p=n.containers[d];if(!p)continue;const g=d===0&&(a.needsDb||a.needsStorage||a.needsMessaging)&&f,b=a.needsDb?l:{env:{},secrets:{}},S=a.needsStorage?h:{env:{},secrets:{}},A=a.needsMessaging?i:{env:{},secrets:{}};d>0&&(t+=`
32
+ }, {`),t+=z(p,g,b,S,A,c)}t+=`
33
+ }],`}if(n.routing&&(t+=Y(n.routing)),n.cpu!==void 0&&(t+=`
34
+ cpu: ${n.cpu},`),n.memoryLimitMiB!==void 0&&(t+=`
35
+ memoryLimitMiB: ${n.memoryLimitMiB},`),n.desiredCount!==void 0&&(t+=`
36
+ desiredCount: ${n.desiredCount},`),n.scaling!==void 0&&(t+=q(n.scaling)),n.alarms===!1?t+=`
37
+ alarms: false,`:typeof n.alarms=="object"&&(t+=`
38
+ alarms: ${v(n.alarms," ")},`),t+=E(n.extraProperties," "),a.needsDb||a.needsStorage||a.needsMessaging){const d=a.needsDb?D(r,u):[],p=a.needsStorage?_(r,u):[],g=a.needsMessaging?I(r,u):[];(d.length>0||p.length>0||g.length>0)&&(t+=`
39
+ ${H(d,p,g)}`)}return t}m(Q,"generateEcsServiceCode");function ae(e,n){const s=K(e),f={...J},l={env:{},secrets:{}};if(P(e)){const r=j(n,e);Object.assign(l.env,r.env),Object.assign(l.secrets,r.secrets)}const h={env:{},secrets:{}};if(V(e)){const r=w(n,e);Object.assign(h.env,r.env)}const i={env:{},secrets:{}};if(T(e)){const r=G(n,e);Object.assign(i.env,r.env)}let c=`
40
+ ecrRepository: app.getDefaultContainerRegistry(),`;if(c+=W(e),e.services?.length){c+=`
41
+ services: [{`;for(let r=0;r<e.services.length;r++){const u=e.services[r];u&&(r>0&&(c+=`
42
+ }, {`),c+=Q({service:u,isFirstService:r===0,hasConnections:s,dbEnvVars:l,storageEnvVars:h,messagingEnvVars:i,baseEnvVars:f,plan:n,compute:e}))}c+=`
43
+ }],`}return c+=E(e.extraProperties),c+=R(),c}m(ae,"generateEcsCode");export{ae as generateEcsCode};
@@ -1,3 +1,30 @@
1
1
  import type { ApplicationResourcePlan, ComputeResourcePlan } from "../../schemas/resourceSchemas.js";
2
+ import type { ProjectedProp } from "../../projection/types.js";
3
+ /**
4
+ * The Lambda's plan fragment for `projectPlanToConstructProps("compute", …)`,
5
+ * in the scaffold's emission order (the projection preserves fragment-key
6
+ * order, so this IS the prop order). Inclusion policy stays here — which keys
7
+ * are present, dispatch on deployment mode, the container-default
8
+ * architecture — while every NAME and construct value shape comes from the
9
+ * shared projection table: `memory`→`memorySize`, `ssmSecrets`→`secrets`,
10
+ * `description` stays `description` (never the inert `lambdaDescription`),
11
+ * `functionName` is plan-only and drops, `codePath`/`runtime`/`architecture`/
12
+ * `functionUrl` become their CDK member expressions.
13
+ *
14
+ * `environment` and the connection keys are deliberately ABSENT: the env
15
+ * block carries the scaffold-only `ENVIRONMENT` base var and the connection
16
+ * wiring is a structural block — both stay scaffold-rendered this increment.
17
+ */
18
+ export declare function buildLambdaProjectionFragment(compute: ComputeResourcePlan): Record<string, unknown>;
19
+ /**
20
+ * The Lambda's projected construct props. Plan-only unprojectables are
21
+ * IGNORED here — the scaffold consumes those keys through its own paths, so
22
+ * `functionName` simply does not come back. `unresolved-binding`
23
+ * unprojectables (a structured rule refusing the value) are NOT this
24
+ * function's to judge: `findComputeProjectionRefusal` (generation/compute.ts)
25
+ * refuses the whole plan pre-write through `generateInfrastructureFromPlan`'s
26
+ * failure channel, matching the codemod's refusal posture.
27
+ */
28
+ export declare function projectLambdaProps(compute: ComputeResourcePlan): ProjectedProp[];
2
29
  export declare function generateLambdaCode(compute: ComputeResourcePlan): string;
3
30
  export declare function generateLambdaConnectionsCode(compute: ComputeResourcePlan, plan: ApplicationResourcePlan): string;