@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.
- package/dist/.build-source-hash +26 -24
- package/dist/.minified +1 -1
- package/dist/src/ast/astTestHelpers.d.ts +2 -1
- package/dist/src/ast/parsers/orchestrator/astPlanConverter.js +1 -1
- package/dist/src/ast/parsers/resources/astComputeParserHelpers.js +1 -1
- package/dist/src/ast/parsers/resources/astScheduleParser.d.ts +3 -0
- package/dist/src/ast/parsers/resources/astScheduleParser.js +1 -1
- package/dist/src/codemod/drift/types.d.ts +2 -2
- package/dist/src/codemod/edits/addResource/propertyBuilder.d.ts +7 -0
- package/dist/src/codemod/edits/addResource/propertyBuilder.js +1 -1
- package/dist/src/codemod/fileRewriter/builders.d.ts +7 -0
- package/dist/src/codemod/fileRewriter/builders.js +1 -1
- package/dist/src/codemod/types.d.ts +6 -6
- package/dist/src/generation/common.d.ts +0 -7
- package/dist/src/generation/common.js +7 -8
- package/dist/src/generation/compute/ec2.d.ts +7 -0
- package/dist/src/generation/compute/ec2.js +2 -4
- package/dist/src/generation/compute/ecs.js +33 -33
- package/dist/src/generation/compute/lambda.d.ts +27 -0
- package/dist/src/generation/compute/lambda.js +9 -22
- package/dist/src/generation/compute.d.ts +18 -0
- package/dist/src/generation/compute.js +6 -6
- package/dist/src/generation/database.d.ts +2 -1
- package/dist/src/generation/database.js +20 -20
- package/dist/src/generation/generatePatternCode.js +9 -9
- package/dist/src/generation/index.d.ts +3 -2
- package/dist/src/generation/index.js +1 -1
- package/dist/src/generation/infrastructure.js +34 -34
- package/dist/src/generation/statementInvocation.d.ts +30 -0
- package/dist/src/generation/statementInvocation.js +1 -0
- package/dist/src/generation/storage.js +19 -19
- package/dist/src/generation/structuredSource.d.ts +61 -0
- package/dist/src/generation/structuredSource.js +9 -0
- package/dist/src/planning/resourcePlanning.d.ts +20 -0
- package/dist/src/planning/resourcePlanning.js +1 -1
- package/dist/src/projection/compute.d.ts +11 -1
- package/dist/src/projection/compute.js +1 -1
- package/dist/src/schemas/applicationSchemas.d.ts +5 -1
- package/dist/src/schemas/baseSchemas.d.ts +2 -2
- package/dist/src/schemas/computeSchemas.d.ts +4 -0
- package/dist/src/schemas/computeSchemas.js +1 -1
- package/dist/src/schemas/constants.d.ts +2 -0
- package/dist/src/schemas/constants.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +2 -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": "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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
123
|
-
"src/generation/compute.ts": "
|
|
124
|
-
"src/generation/compute/ec2.ts": "
|
|
125
|
-
"src/generation/compute/ecs.ts": "
|
|
126
|
-
"src/generation/compute/lambda.ts": "
|
|
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": "
|
|
130
|
-
"src/generation/generatePatternCode.ts": "
|
|
131
|
-
"src/generation/index.ts": "
|
|
132
|
-
"src/generation/infrastructure.ts": "
|
|
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/
|
|
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": "
|
|
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": "
|
|
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": "
|
|
164
|
-
"src/schemas/constants.ts": "
|
|
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": "
|
|
184
|
+
"src/version.ts": "e5f68bfd6ec4186d",
|
|
183
185
|
"../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
|
|
184
|
-
"package.json": "
|
|
186
|
+
"package.json": "82c1047d2bfe256a",
|
|
185
187
|
"tsconfig.json": "1929cf3f99fe9b1e"
|
|
186
188
|
},
|
|
187
|
-
"outputHash": "
|
|
188
|
-
"outputFileCount":
|
|
189
|
+
"outputHash": "19b59493ade88ac7ce614d91f1c445d691310a62ac92c968801636ea999f3cbd",
|
|
190
|
+
"outputFileCount": 343
|
|
189
191
|
}
|
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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" | "
|
|
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,
|
|
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
|
|
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
|
|
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=
|
|
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),[
|
|
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
|
|
2
|
-
${
|
|
3
|
-
`);return
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
|
|
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
|
|
2
|
-
|
|
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
|
|
2
|
-
ec2Config: ${$(n," "," ")},`}
|
|
3
|
-
cluster: ${$(n," "," ")},`}
|
|
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,
|
|
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
|
-
${
|
|
12
|
-
},`),
|
|
11
|
+
${M(u," ")}
|
|
12
|
+
},`),t&&Object.keys(t).length>0&&(i+=`
|
|
13
13
|
secretsImport: {
|
|
14
|
-
${
|
|
14
|
+
${M(t," ")}
|
|
15
15
|
},`),e.ssmSecrets&&e.ssmSecrets.length>0&&(i+=`
|
|
16
|
-
secrets: [${
|
|
17
|
-
healthCheck: ${
|
|
18
|
-
routing: ${
|
|
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(
|
|
20
|
+
${n.map(f=>x(f," ")).join(`,
|
|
21
21
|
`)},
|
|
22
|
-
],`}
|
|
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
|
|
24
|
-
scaling: ${$(
|
|
25
|
-
name: ${o(n.name)},`;
|
|
26
|
-
capacityProvider: ${o(n.capacityProvider)},`,n.serviceType!==void 0&&(
|
|
27
|
-
serviceType: ${o(n.serviceType)},`),n.ec2Config&&(
|
|
28
|
-
docker: ${
|
|
29
|
-
image: ${o(n.image)},`),n.ssmSecretsPath&&(
|
|
30
|
-
ssmSecretsPath: ${o(n.ssmSecretsPath)},`);const a=
|
|
31
|
-
containers: [{`;for(let d=0;d<n.containers.length;d++){const
|
|
32
|
-
}, {`),
|
|
33
|
-
}],`}if(n.routing&&(
|
|
34
|
-
cpu: ${n.cpu},`),n.memoryLimitMiB!==void 0&&(
|
|
35
|
-
memoryLimitMiB: ${n.memoryLimitMiB},`),n.desiredCount!==void 0&&(
|
|
36
|
-
desiredCount: ${n.desiredCount},`),n.scaling!==void 0&&(
|
|
37
|
-
alarms: false,`:typeof n.alarms=="object"&&(
|
|
38
|
-
alarms: ${
|
|
39
|
-
${
|
|
40
|
-
ecrRepository: app.getDefaultContainerRegistry(),`;if(c+=
|
|
41
|
-
services: [{`;for(let r=0;r<e.services.length;r++){const
|
|
42
|
-
}, {`),c+=
|
|
43
|
-
}],`}return c+=E(e.extraProperties),c+=R(),c}
|
|
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;
|