@fjall/generator 14.2.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 +36 -34
- package/dist/.minified +1 -1
- package/dist/src/ast/astTestHelpers.d.ts +2 -1
- package/dist/src/ast/domain/astDomainParser.d.ts +12 -0
- package/dist/src/ast/domain/astDomainParser.js +1 -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/index.d.ts +1 -1
- package/dist/src/codemod/drift/index.js +1 -1
- package/dist/src/codemod/drift/snapshot.d.ts +33 -1
- package/dist/src/codemod/drift/snapshot.js +1 -1
- package/dist/src/codemod/drift/types.d.ts +18 -3
- package/dist/src/codemod/drift/types.js +1 -1
- 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/index.d.ts +2 -2
- package/dist/src/codemod/index.js +1 -1
- package/dist/src/codemod/llmFallback/index.d.ts +1 -1
- package/dist/src/codemod/llmFallback/index.js +1 -1
- package/dist/src/codemod/llmFallback/shouldTryFallback.d.ts +9 -0
- package/dist/src/codemod/llmFallback/shouldTryFallback.js +1 -1
- package/dist/src/codemod/types.d.ts +6 -6
- package/dist/src/dns/domainFileGenerator.js +8 -3
- package/dist/src/dns/domainRecords.d.ts +30 -0
- package/dist/src/dns/domainRecords.js +1 -1
- package/dist/src/dns/tsEmitter.js +9 -9
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
import{addResource as o}from"./edits/addResource.js";import{removeResource as c}from"./edits/removeResource.js";import{modifyResource as
|
|
1
|
+
import{addResource as o}from"./edits/addResource.js";import{removeResource as c}from"./edits/removeResource.js";import{modifyResource as a}from"./edits/modifyResource.js";import{appendAccountToStage as s}from"./edits/appendAccountToStage.js";import{setContainerSecrets as E}from"./edits/setContainerSecrets.js";import{connectResourceToCompute as d}from"./edits/connectResourceToCompute.js";import{addVpcPeer as u,modifyVpcPeer as f,removeVpcPeer as R}from"./edits/vpcPeer.js";import{addVpcPeerAccepter as T,modifyVpcPeerAccepter as P,removeVpcPeerAccepter as x}from"./edits/vpcPeerAccepter.js";import{addCrossPlanConnection as C,modifyCrossPlanConnection as v,removeCrossPlanConnection as N}from"./edits/crossPlanConnection.js";import{resolveDriftPolicy as V}from"./edits/driftPolicy.js";import{listResources as h}from"./listResources.js";import{resolveConstructByLiteralProperty as y}from"./semanticIndex/index.js";import{parse as G}from"./fileRewriter/parse.js";import{CrossPlanConnectionResourcePlanSchema as F,VpcPeerAccepterResourcePlanSchema as g,VpcPeerResourcePlanSchema as U}from"../schemas/index.js";import{detectDrift as L,mergeProperties as M,RESOURCE_SNAPSHOT_SCHEMA_VERSION as B,ResourceSnapshotSchema as j,snapshotProperties as H}from"./drift/index.js";import{computeLinesDelta as Y}from"./_internal.js";import{ResourceNameSchema as w,StatementTypeSchema as z}from"./types.js";import{REGISTERED_STATEMENT_TYPES as Q,STATEMENT_REGISTRY as W}from"./registry.js";import{evaluateEmitGuard as Z,UNRESOLVED as $}from"./emitGuard.js";import{projectionRefusals as re}from"./emitProjection.js";import{CODEMOD_ERROR_KINDS as te}from"./telemetry/errorKinds.js";import{buildEgressBlockedEvent as pe,buildFiredEvent as ae,buildGateFailedEvent as me,buildGatePassedEvent as se,buildRejectedEvent as ne,buildSucceededEvent as Ee,buildTimeoutEvent as le,estimateCostUsd as de,FALLBACK_EVENTS as ie,GATE_EVENTS as ue,gateFallbackOutput as fe,matchFallbackTrigger as Re,PARSE_GATE as Se,RUNTIME_GATE as Te,runFallback as Pe,shouldTryFallback as xe,UNATTRIBUTED_ORGANISATION as Ae}from"./llmFallback/index.js";export{te as CODEMOD_ERROR_KINDS,F as CrossPlanConnectionResourcePlanSchema,ie as FALLBACK_EVENTS,ue as GATE_EVENTS,Se as PARSE_GATE,Q as REGISTERED_STATEMENT_TYPES,B as RESOURCE_SNAPSHOT_SCHEMA_VERSION,Te as RUNTIME_GATE,w as ResourceNameSchema,j as ResourceSnapshotSchema,W as STATEMENT_REGISTRY,z as StatementTypeSchema,Ae as UNATTRIBUTED_ORGANISATION,$ as UNRESOLVED,g as VpcPeerAccepterResourcePlanSchema,U as VpcPeerResourcePlanSchema,C as addCrossPlanConnection,o as addResource,u as addVpcPeer,T as addVpcPeerAccepter,s as appendAccountToStage,pe as buildEgressBlockedEvent,ae as buildFiredEvent,me as buildGateFailedEvent,se as buildGatePassedEvent,ne as buildRejectedEvent,Ee as buildSucceededEvent,le as buildTimeoutEvent,Y as computeLinesDelta,d as connectResourceToCompute,L as detectDrift,de as estimateCostUsd,Z as evaluateEmitGuard,fe as gateFallbackOutput,h as listResources,Re as matchFallbackTrigger,M as mergeProperties,v as modifyCrossPlanConnection,a as modifyResource,f as modifyVpcPeer,P as modifyVpcPeerAccepter,G as parse,re as projectionRefusals,N as removeCrossPlanConnection,c as removeResource,R as removeVpcPeer,x as removeVpcPeerAccepter,y as resolveConstructByLiteralProperty,V as resolveDriftPolicy,Pe as runFallback,E as setContainerSecrets,xe as shouldTryFallback,H as snapshotProperties};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { runFallback, type FallbackClients, type RunFallbackInput, } from "./runFallback.js";
|
|
2
2
|
export { gateFallbackOutput, type GateEventAction, type GateFallbackParams, } from "./gateFallbackOutput.js";
|
|
3
|
-
export { shouldTryFallback, type FallbackDecision, type FallbackGuardConfig, } from "./shouldTryFallback.js";
|
|
3
|
+
export { matchFallbackTrigger, shouldTryFallback, type FallbackDecision, type FallbackGuardConfig, } from "./shouldTryFallback.js";
|
|
4
4
|
export { buildEgressBlockedEvent, buildFiredEvent, buildGateFailedEvent, buildGatePassedEvent, buildRejectedEvent, buildSucceededEvent, buildTimeoutEvent, estimateCostUsd, FALLBACK_EVENTS, GATE_EVENTS, UNATTRIBUTED_ORGANISATION, type FallbackEgressBlockedEvent, type FallbackFiredEvent, type FallbackRejectedEvent, type FallbackSucceededEvent, type FallbackTelemetryEvent, type FallbackTimeoutEvent, type GateFailedEvent, type GatePassedEvent, type TelemetrySource, } from "./telemetryEvents.js";
|
|
5
5
|
export { PARSE_GATE, RUNTIME_GATE } from "./types.js";
|
|
6
6
|
export type { AnthropicClientProvider, AnthropicContentBlock, AnthropicResponse, ApplyResult, EgressStage, FallbackInput, FallbackIntent, FallbackOp, FallbackOutput, FallbackTelemetry, MorphClientProvider, MorphResponse, StrReplaceOp, TriggerReason, } from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{runFallback as
|
|
1
|
+
import{runFallback as l}from"./runFallback.js";import{gateFallbackOutput as d}from"./gateFallbackOutput.js";import{matchFallbackTrigger as a,shouldTryFallback as o}from"./shouldTryFallback.js";import{buildEgressBlockedEvent as T,buildFiredEvent as i,buildGateFailedEvent as b,buildGatePassedEvent as c,buildRejectedEvent as A,buildSucceededEvent as m,buildTimeoutEvent as n,estimateCostUsd as s,FALLBACK_EVENTS as v,GATE_EVENTS as F,UNATTRIBUTED_ORGANISATION as p}from"./telemetryEvents.js";import{PARSE_GATE as N,RUNTIME_GATE as f}from"./types.js";export{v as FALLBACK_EVENTS,F as GATE_EVENTS,N as PARSE_GATE,f as RUNTIME_GATE,p as UNATTRIBUTED_ORGANISATION,T as buildEgressBlockedEvent,i as buildFiredEvent,b as buildGateFailedEvent,c as buildGatePassedEvent,A as buildRejectedEvent,m as buildSucceededEvent,n as buildTimeoutEvent,s as estimateCostUsd,d as gateFallbackOutput,a as matchFallbackTrigger,l as runFallback,o as shouldTryFallback};
|
|
@@ -11,3 +11,12 @@ export type FallbackDecision = {
|
|
|
11
11
|
shouldTry: false;
|
|
12
12
|
};
|
|
13
13
|
export declare function shouldTryFallback(error: CodemodError, config: FallbackGuardConfig): FallbackDecision;
|
|
14
|
+
/**
|
|
15
|
+
* The trigger kind a failure would fall back under, or undefined when no
|
|
16
|
+
* amount of enablement could make the fallback attempt it.
|
|
17
|
+
*
|
|
18
|
+
* Pure and local — no config, no I/O. Consumers whose enablement lookup costs
|
|
19
|
+
* something (the CLI reads org config over the network) ask this first, so a
|
|
20
|
+
* failure the fallback can never handle stays free.
|
|
21
|
+
*/
|
|
22
|
+
export declare function matchFallbackTrigger(error: CodemodError): TriggerReason | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o=Object.defineProperty;var n=(r,e)=>o(r,"name",{value:e,configurable:!0});const t={shouldTry:!1};function i(r,e){if(!e.envEnabled||!e.orgAllowsFallback)return t;const l=
|
|
1
|
+
var o=Object.defineProperty;var n=(r,e)=>o(r,"name",{value:e,configurable:!0});const t={shouldTry:!1};function i(r,e){if(!e.envEnabled||!e.orgAllowsFallback)return t;const l=a(r);return l===void 0?t:{shouldTry:!0,trigger:l}}n(i,"shouldTryFallback");function a(r){switch(r.kind){case"TemplateLiteralNameError":return"template-literal-name";case"ResourceNotFoundError":return"resource-not-found";case"ControlFlowClassifierError":return r.reason==="anonymous-helper"?"control-flow-unclassifiable":void 0;case"DriftUnmergeableError":return"drift-unmergeable";default:return}}n(a,"matchFallbackTrigger");export{a as matchFallbackTrigger,i as shouldTryFallback};
|
|
@@ -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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var p=Object.defineProperty;var o=(t,e)=>p(t,"name",{value:e,configurable:!0});import{getDomainStackName as g}from"@fjall/util";import{toPascalCase as
|
|
1
|
+
var p=Object.defineProperty;var o=(t,e)=>p(t,"name",{value:e,configurable:!0});import{getDomainStackName as g}from"@fjall/util";import{toPascalCase as h}from"../generation/common.js";import{GENERATOR_VERSION as d}from"../version.js";function I(t){const{domainName:e,hostedZoneId:r,records:n=[]}=t,a=t.basePath??`fjall/domains/${e}`;return[{path:`${a}/infrastructure.ts`,content:w({domainName:e,records:n,hostedZoneId:r})},{path:`${a}/package.json`,content:f(e)},{path:`${a}/tsconfig.json`,content:y},{path:`${a}/cdk.json`,content:N},{path:`${a}/cdk.context.json`,content:S},{path:`${a}/.gitignore`,content:k}]}o(I,"generateDomainFiles");function w(t){const{domainName:e,records:r,hostedZoneId:n}=t,a=h(e.split(".").join("")),i=g(e),c=r.map(s=>{const m=s.ttl!==void 0?`, ttl: ${s.ttl}`:"";return` { type: ${JSON.stringify(s.type)}, name: ${JSON.stringify(s.name)}, value: ${JSON.stringify(s.value)}${m} },`}),l=c.length>0?`[
|
|
2
2
|
${c.join(`
|
|
3
3
|
`)}
|
|
4
4
|
]`:"[]",u=n?` hostedZoneId: ${JSON.stringify(n)},
|
|
@@ -19,7 +19,12 @@ const stack = app.getStack(${JSON.stringify(i)}).getStack();
|
|
|
19
19
|
new Domain(stack, ${JSON.stringify(a)}, {
|
|
20
20
|
registrar: "route53",
|
|
21
21
|
zoneName: ${JSON.stringify(e)},
|
|
22
|
-
${u}
|
|
22
|
+
${u} // Position-independent record logical IDs (fresh-zone default): records
|
|
23
|
+
// can be inserted, removed, or reordered freely. Never remove this line
|
|
24
|
+
// once the zone has deployed \u2014 flipping the mode renames every record's
|
|
25
|
+
// logical ID (a deliberate two-deploy migration, never a casual edit).
|
|
26
|
+
recordIds: "stable",
|
|
27
|
+
certificates: [
|
|
23
28
|
{ domainName: ${JSON.stringify(e)} },
|
|
24
29
|
// Serving this zone through CloudFront (staticsite/cdn)? Add a viewer
|
|
25
30
|
// certificate with cloudFront: true \u2014 it is minted in us-east-1 (the
|
|
@@ -39,7 +44,7 @@ ${u} certificates: [
|
|
|
39
44
|
// and adoptedNameServers (both together) on the child Domain \u2014 the literals
|
|
40
45
|
// feed the parent NS UPSERT because an imported zone exposes no name-server
|
|
41
46
|
// attribute at synth.
|
|
42
|
-
`}o(
|
|
47
|
+
`}o(w,"generateDefaultInfrastructureTs");function f(t){return`{
|
|
43
48
|
"name": ${JSON.stringify(`domain-${t}`)},
|
|
44
49
|
"version": "${d}",
|
|
45
50
|
"type": "module",
|
|
@@ -40,6 +40,14 @@ export declare const DomainDeployPhaseSchema: z.ZodEnum<{
|
|
|
40
40
|
full: "full";
|
|
41
41
|
}>;
|
|
42
42
|
export type DomainDeployPhase = z.infer<typeof DomainDeployPhaseSchema>;
|
|
43
|
+
/**
|
|
44
|
+
* Per-record construct-id override (`recordIds: "stable"` collision escape
|
|
45
|
+
* hatch) — mirrors `StandardRecord.id` / `AliasRecord.id` in
|
|
46
|
+
* @fjall/components-infrastructure, which validates the same shape (it
|
|
47
|
+
* becomes a CloudFormation logical-ID segment).
|
|
48
|
+
*/
|
|
49
|
+
export declare const RecordConstructIdSchema: z.ZodString;
|
|
50
|
+
export type RecordConstructId = z.infer<typeof RecordConstructIdSchema>;
|
|
43
51
|
export declare const ParsedStandardRecordSchema: z.ZodObject<{
|
|
44
52
|
kind: z.ZodLiteral<"standard">;
|
|
45
53
|
type: z.ZodEnum<{
|
|
@@ -55,6 +63,7 @@ export declare const ParsedStandardRecordSchema: z.ZodObject<{
|
|
|
55
63
|
name: z.ZodString;
|
|
56
64
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
57
65
|
ttl: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
id: z.ZodOptional<z.ZodString>;
|
|
58
67
|
}, z.core.$strict>;
|
|
59
68
|
export declare const ParsedAliasRecordSchema: z.ZodObject<{
|
|
60
69
|
kind: z.ZodLiteral<"alias">;
|
|
@@ -78,6 +87,7 @@ export declare const ParsedAliasRecordSchema: z.ZodObject<{
|
|
|
78
87
|
dnsName: z.ZodString;
|
|
79
88
|
hostedZoneId: z.ZodString;
|
|
80
89
|
}, z.core.$strict>], "kind">;
|
|
90
|
+
id: z.ZodOptional<z.ZodString>;
|
|
81
91
|
}, z.core.$strict>;
|
|
82
92
|
export declare const ParsedDnsRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
93
|
kind: z.ZodLiteral<"standard">;
|
|
@@ -94,6 +104,7 @@ export declare const ParsedDnsRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
94
104
|
name: z.ZodString;
|
|
95
105
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
96
106
|
ttl: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
id: z.ZodOptional<z.ZodString>;
|
|
97
108
|
}, z.core.$strict>, z.ZodObject<{
|
|
98
109
|
kind: z.ZodLiteral<"alias">;
|
|
99
110
|
type: z.ZodEnum<{
|
|
@@ -116,6 +127,7 @@ export declare const ParsedDnsRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
116
127
|
dnsName: z.ZodString;
|
|
117
128
|
hostedZoneId: z.ZodString;
|
|
118
129
|
}, z.core.$strict>], "kind">;
|
|
130
|
+
id: z.ZodOptional<z.ZodString>;
|
|
119
131
|
}, z.core.$strict>], "kind">;
|
|
120
132
|
export declare const ParsedCertificateSchema: z.ZodObject<{
|
|
121
133
|
domainName: z.ZodString;
|
|
@@ -128,6 +140,18 @@ export declare const ParsedSubdomainDelegationSchema: z.ZodObject<{
|
|
|
128
140
|
toAccount: z.ZodString;
|
|
129
141
|
auto: z.ZodOptional<z.ZodBoolean>;
|
|
130
142
|
}, z.core.$strict>;
|
|
143
|
+
/**
|
|
144
|
+
* Construct-id scheme for the records list — mirrors
|
|
145
|
+
* `DomainCommonProps.recordIds`. `"stable"` derives position-independent
|
|
146
|
+
* logical IDs (records can be inserted/removed/reordered freely);
|
|
147
|
+
* `"indexed"`/absent is the legacy position-coupled formula (append-only
|
|
148
|
+
* lists, byte-frozen for deployed stacks). Fresh imports emit `"stable"`.
|
|
149
|
+
*/
|
|
150
|
+
export declare const RecordIdsModeSchema: z.ZodEnum<{
|
|
151
|
+
stable: "stable";
|
|
152
|
+
indexed: "indexed";
|
|
153
|
+
}>;
|
|
154
|
+
export type RecordIdsMode = z.infer<typeof RecordIdsModeSchema>;
|
|
131
155
|
export declare const ParsedDomainRecordsSchema: z.ZodObject<{
|
|
132
156
|
zoneName: z.ZodString;
|
|
133
157
|
registrar: z.ZodEnum<{
|
|
@@ -135,6 +159,10 @@ export declare const ParsedDomainRecordsSchema: z.ZodObject<{
|
|
|
135
159
|
"external-delegated": "external-delegated";
|
|
136
160
|
"external-records": "external-records";
|
|
137
161
|
}>;
|
|
162
|
+
recordIds: z.ZodOptional<z.ZodEnum<{
|
|
163
|
+
stable: "stable";
|
|
164
|
+
indexed: "indexed";
|
|
165
|
+
}>>;
|
|
138
166
|
hostedZoneId: z.ZodOptional<z.ZodString>;
|
|
139
167
|
delegatedSubdomain: z.ZodOptional<z.ZodString>;
|
|
140
168
|
adoptedNameServers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -153,6 +181,7 @@ export declare const ParsedDomainRecordsSchema: z.ZodObject<{
|
|
|
153
181
|
name: z.ZodString;
|
|
154
182
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
155
183
|
ttl: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
id: z.ZodOptional<z.ZodString>;
|
|
156
185
|
}, z.core.$strict>, z.ZodObject<{
|
|
157
186
|
kind: z.ZodLiteral<"alias">;
|
|
158
187
|
type: z.ZodEnum<{
|
|
@@ -175,6 +204,7 @@ export declare const ParsedDomainRecordsSchema: z.ZodObject<{
|
|
|
175
204
|
dnsName: z.ZodString;
|
|
176
205
|
hostedZoneId: z.ZodString;
|
|
177
206
|
}, z.core.$strict>], "kind">;
|
|
207
|
+
id: z.ZodOptional<z.ZodString>;
|
|
178
208
|
}, z.core.$strict>], "kind">>;
|
|
179
209
|
certificates: z.ZodArray<z.ZodObject<{
|
|
180
210
|
domainName: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const r=e.discriminatedUnion("kind",[e.object({kind:e.literal("ecs"),appName:e.string(),computeName:e.string().min(1).optional()}).strict(),e.object({kind:e.literal("cdn"),appName:e.string()}).strict(),e.object({kind:e.literal("bucket"),bucketName:e.string()}).strict(),e.object({kind:e.literal("custom"),dnsName:e.string(),hostedZoneId:e.string()}).strict()]),
|
|
1
|
+
import{z as e}from"zod";const r=e.discriminatedUnion("kind",[e.object({kind:e.literal("ecs"),appName:e.string(),computeName:e.string().min(1).optional()}).strict(),e.object({kind:e.literal("cdn"),appName:e.string()}).strict(),e.object({kind:e.literal("bucket"),bucketName:e.string()}).strict(),e.object({kind:e.literal("custom"),dnsName:e.string(),hostedZoneId:e.string()}).strict()]),p=r.options.map(t=>t.shape.kind.value),n=e.enum(["A","AAAA"]),o=e.enum(["route53","external-delegated","external-records"]),u=e.enum(["zone","full"]),a=e.string().regex(/^[A-Za-z][A-Za-z0-9]*$/),i=e.object({kind:e.literal("standard"),type:e.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:e.string(),value:e.union([e.string(),e.array(e.string())]),ttl:e.number().int().positive().optional(),id:a.optional()}).strict(),s=e.object({kind:e.literal("alias"),type:n,name:e.string(),target:r,id:a.optional()}).strict(),d=e.discriminatedUnion("kind",[i,s]),c=e.object({domainName:e.string(),subjectAlternativeNames:e.array(e.string()).optional(),transparencyLogging:e.boolean().optional(),cloudFront:e.boolean().optional()}).strict(),l=e.object({subdomain:e.string(),toAccount:e.string(),auto:e.boolean().optional()}).strict(),m=e.enum(["indexed","stable"]),x=e.object({zoneName:e.string(),registrar:o,recordIds:m.optional(),hostedZoneId:e.string().optional(),delegatedSubdomain:e.string().optional(),adoptedNameServers:e.array(e.string().min(1)).min(1).optional(),records:e.array(d),certificates:e.array(c),delegations:e.array(l)}).strict().refine(t=>t.registrar!=="external-delegated"||t.delegatedSubdomain!==void 0,{message:"external-delegated requires delegatedSubdomain"}).refine(t=>t.registrar!=="external-records"||t.delegations.length===0,{message:"external-records forbids delegations"}).refine(t=>t.registrar==="external-delegated"||t.adoptedNameServers===void 0,{message:"adoptedNameServers requires registrar external-delegated"}).refine(t=>t.registrar!=="external-delegated"||t.hostedZoneId===void 0==(t.adoptedNameServers===void 0),{message:"external-delegated adoption requires hostedZoneId and adoptedNameServers together (both-or-neither)"});export{n as AliasRecordTypeSchema,u as DomainDeployPhaseSchema,o as DomainRegistrarSchema,s as ParsedAliasRecordSchema,c as ParsedCertificateSchema,d as ParsedDnsRecordSchema,x as ParsedDomainRecordsSchema,i as ParsedStandardRecordSchema,l as ParsedSubdomainDelegationSchema,a as RecordConstructIdSchema,m as RecordIdsModeSchema,p as TYPED_FJALL_TARGET_KINDS,r as TypedFjallTargetSchema};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var A=Object.defineProperty;var o=(e,n)=>A(e,"name",{value:n,configurable:!0});import{getDomainStackName as k,toPascalCase as D}from"@fjall/util";const O=["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"],
|
|
2
|
-
`):e,
|
|
3
|
-
`):n;return t.localeCompare(
|
|
1
|
+
var A=Object.defineProperty;var o=(e,n)=>A(e,"name",{value:n,configurable:!0});import{getDomainStackName as k,toPascalCase as D}from"@fjall/util";const O=["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"],J=new Map(O.map((e,n)=>[e,n]));function b(e,n){return e==="@"&&n!=="@"?-1:e!=="@"&&n==="@"?1:e.localeCompare(n)}o(b,"compareName");function C(e,n){const t=Array.isArray(e)?e.join(`
|
|
2
|
+
`):e,i=Array.isArray(n)?n.join(`
|
|
3
|
+
`):n;return t.localeCompare(i)}o(C,"compareValue");function p(e){const n=e.kind==="standard"?0:1,t=J.get(e.type)??99;return[n,t,e.name]}o(p,"recordSortKey");function R(e){return[...e].sort((n,t)=>{const[i,c,f]=p(n),[s,d,m]=p(t);if(i!==s)return i-s;if(c!==d)return c-d;const u=b(f,m);return u!==0?u:n.kind==="standard"&&t.kind==="standard"?C(n.value,t.value):0})}o(R,"sortRecords");function I(e){return Array.isArray(e)?`[${e.map(t=>JSON.stringify(t)).join(", ")}]`:JSON.stringify(e)}o(I,"formatValue");function P(e){const n=[`type: ${JSON.stringify(e.type)}`,`name: ${JSON.stringify(e.name)}`];return e.id!==void 0&&n.push(`id: ${JSON.stringify(e.id)}`),n.push(`value: ${I(e.value)}`),e.ttl!==void 0&&n.push(`ttl: ${e.ttl}`),`{ ${n.join(", ")} }`}o(P,"emitStandardRecord");function v(e){switch(e.kind){case"ecs":return e.computeName===void 0?`fjallApp(${JSON.stringify(e.appName)})`:`fjallApp(${JSON.stringify(e.appName)}, ${JSON.stringify(e.computeName)})`;case"cdn":return`fjallCdn(${JSON.stringify(e.appName)})`;case"bucket":return`fjallBucket(${JSON.stringify(e.bucketName)})`;case"custom":return`aliasTo(${JSON.stringify(e.dnsName)}, ${JSON.stringify(e.hostedZoneId)})`}}o(v,"emitAliasTarget");function x(e){const n=[`type: ${JSON.stringify(e.type)}`,`name: ${JSON.stringify(e.name)}`];return e.id!==void 0&&n.push(`id: ${JSON.stringify(e.id)}`),n.push(`target: ${v(e.target)}`),`{ ${n.join(", ")} }`}o(x,"emitAliasRecord");function T(e){return e.kind==="standard"?P(e):x(e)}o(T,"emitRecordObjectText");function w(e){return` ${T(e)},`}o(w,"emitRecord");function z(e){const n=[`domainName: ${JSON.stringify(e.domainName)}`];if(e.subjectAlternativeNames&&e.subjectAlternativeNames.length>0){const t=e.subjectAlternativeNames.map(i=>JSON.stringify(i)).join(", ");n.push(`subjectAlternativeNames: [${t}]`)}return e.transparencyLogging!==void 0&&n.push(`transparencyLogging: ${e.transparencyLogging}`),e.cloudFront!==void 0&&n.push(`cloudFront: ${e.cloudFront}`),` { ${n.join(", ")} },`}o(z,"emitCertificate");function B(e,n){if(n.length===0)return"";const t=["","// Delegations (D8 \u2014 child writes NS; no parent-side records here):"];for(const i of n)t.push(`// ${i.subdomain}.${e} \u2192 deploy a Domain { registrar: "external-delegated",`,`// zoneName: ${JSON.stringify(e)}, delegatedSubdomain: ${JSON.stringify(i.subdomain)} }`,`// in account ${JSON.stringify(i.toAccount)}; the CLI injects parentDelegationRoleArn`,"// (ManagedDomainBinding.delegationRoleArn) and the child UPSERTs its NS into this zone.");return t.join(`
|
|
4
4
|
`)+`
|
|
5
5
|
`}o(B,"emitDelegationGuidance");function F(e){const n={fjallApp:!1,fjallCdn:!1,fjallBucket:!1,aliasTo:!1};for(const t of e)if(t.kind==="alias")switch(t.target.kind){case"ecs":n.fjallApp=!0;break;case"cdn":n.fjallCdn=!0;break;case"bucket":n.fjallBucket=!0;break;case"custom":n.aliasTo=!0;break}return n}o(F,"computeUsedHelpers");function L(e){const n=["App","Domain"];return e.aliasTo&&n.push("aliasTo"),e.fjallApp&&n.push("fjallApp"),e.fjallBucket&&n.push("fjallBucket"),e.fjallCdn&&n.push("fjallCdn"),`import {
|
|
6
|
-
${n.map(
|
|
6
|
+
${n.map(i=>` ${i},`).join(`
|
|
7
7
|
`)}
|
|
8
|
-
} from "@fjall/components-infrastructure";`}o(L,"emitImports");function E(e){return D(e.split(".").join(""))}o(E,"safeZoneName");function g(e,n){if(e==="@")return e;const t=e.endsWith(".")?e.slice(0,-1):e;return t===n?"@":t.endsWith(`.${n}`)?t.slice(0,-(n.length+1)):e}o(g,"toRelativeRecordName");function Z(e){return e.registrar==="external-delegated"&&e.delegatedSubdomain?`${e.delegatedSubdomain}.${e.zoneName}`:e.zoneName}o(Z,"effectiveZoneName");function y(e,n,t){if(n.length===0)return` ${e}: [],`;const
|
|
8
|
+
} from "@fjall/components-infrastructure";`}o(L,"emitImports");function E(e){return D(e.split(".").join(""))}o(E,"safeZoneName");function g(e,n){if(e==="@")return e;const t=e.endsWith(".")?e.slice(0,-1):e;return t===n?"@":t.endsWith(`.${n}`)?t.slice(0,-(n.length+1)):e}o(g,"toRelativeRecordName");function Z(e){return e.registrar==="external-delegated"&&e.delegatedSubdomain?`${e.delegatedSubdomain}.${e.zoneName}`:e.zoneName}o(Z,"effectiveZoneName");function y(e,n,t){if(n.length===0)return` ${e}: [],`;const i=n.map(t).join(`
|
|
9
9
|
`);return` ${e}: [
|
|
10
|
-
${
|
|
11
|
-
],`}o(y,"emitBlock");function K(e,n={}){const t=k(n.componentName??e.zoneName),
|
|
10
|
+
${i}
|
|
11
|
+
],`}o(y,"emitBlock");function K(e,n={}){const t=k(n.componentName??e.zoneName),i=E(n.componentName??e.zoneName),c=F(e.records),f=L(c),s=Z(e),d=e.records.map(a=>a.kind==="standard"?{...a,name:g(a.name,s)}:{...a,name:g(a.name,s)}),m=R(d),u=[...e.certificates].sort((a,l)=>a.domainName.localeCompare(l.domainName)),h=[...e.delegations].sort((a,l)=>a.subdomain.localeCompare(l.subdomain)),r=[];if(e.recordIds!==void 0&&r.push(` recordIds: ${JSON.stringify(e.recordIds)},`),e.hostedZoneId&&r.push(` hostedZoneId: ${JSON.stringify(e.hostedZoneId)},`),e.adoptedNameServers&&e.adoptedNameServers.length>0){const a=e.adoptedNameServers.map(l=>JSON.stringify(l)).join(", ");r.push(` adoptedNameServers: [${a}],`)}e.delegatedSubdomain&&r.push(` delegatedSubdomain: ${JSON.stringify(e.delegatedSubdomain)},`),e.registrar==="external-delegated"&&r.push(" // D8 child-writes delegation + two-phase deploy: both values arrive"," // via CDK context, injected by the Fjall CLI at deploy time (see the"," // reads above `new Domain`). Set a literal parentDelegationRoleArn"," // here only for out-of-band deploys.",' ...(domainDeployPhase === "zone" || domainDeployPhase === "full"'," ? { phase: domainDeployPhase }"," : {}),",' ...(typeof parentDelegationRoleArn === "string" &&',' parentDelegationRoleArn !== ""'," ? { parentDelegationRoleArn }"," : {}),");const N=y("certificates",u,z),S=y("records",m,w),$=e.registrar==="external-records"?"":B(e.zoneName,h),j=e.registrar==="external-delegated"?`
|
|
12
12
|
// Injected by the Fjall CLI at deploy time (D8) \u2014 do not set these by hand.
|
|
13
13
|
const domainDeployPhase: unknown = app.node.tryGetContext(
|
|
14
14
|
"fjall:domainDeployPhase"
|
|
@@ -25,7 +25,7 @@ if (
|
|
|
25
25
|
const parentDelegationRoleArn: unknown = app.node.tryGetContext(
|
|
26
26
|
"fjall:parentDelegationRoleArn"
|
|
27
27
|
);
|
|
28
|
-
`:"";return`${
|
|
28
|
+
`:"";return`${f}
|
|
29
29
|
|
|
30
30
|
// Fjall-managed domain \u2014 edit this file to add or change records. See https://docs.fjall.io/resources/networking/domain for the Domain construct API.
|
|
31
31
|
|
|
@@ -35,7 +35,7 @@ const app = App.getApp(${JSON.stringify(t)});
|
|
|
35
35
|
// CloudFormation stack name. Do not rename it.
|
|
36
36
|
const stack = app.getStack(${JSON.stringify(t)}).getStack();
|
|
37
37
|
${j}
|
|
38
|
-
new Domain(stack, ${JSON.stringify(
|
|
38
|
+
new Domain(stack, ${JSON.stringify(i)}, {
|
|
39
39
|
registrar: ${JSON.stringify(e.registrar)},
|
|
40
40
|
zoneName: ${JSON.stringify(e.zoneName)},
|
|
41
41
|
${r.length>0?r.join(`
|
|
@@ -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;
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
handler: ${a(e.handler)},`),e.runtime&&(n+=`
|
|
5
|
-
runtime: Runtime.${e.runtime},`)):n+=`
|
|
6
|
-
deployment: "${l.CONTAINER}",
|
|
7
|
-
ecrRepository: app.getDefaultContainerRegistry(),`,e.timeout!==void 0&&(n+=`
|
|
8
|
-
timeout: ${e.timeout},`),e.memory!==void 0&&(n+=`
|
|
9
|
-
memorySize: ${e.memory},`),e.functionUrl&&(n+=`
|
|
10
|
-
functionUrl: { authType: FunctionUrlAuthType.${e.functionUrl.authType} },`),e.description&&(n+=`
|
|
11
|
-
lambdaDescription: ${a(e.description)},`),e.architecture||e.deployment===l.CONTAINER){const i=e.architecture??P;n+=`
|
|
12
|
-
architecture: Architecture.${i},`}if(e.ephemeralStorageSize!==void 0&&(n+=`
|
|
13
|
-
ephemeralStorageSize: ${e.ephemeralStorageSize},`),e.functionName&&(n+=`
|
|
14
|
-
functionName: ${a(e.functionName)},`),e.ssmSecretsPath&&(n+=`
|
|
15
|
-
ssmSecretsPath: ${a(e.ssmSecretsPath)},`),e.ssmSecrets&&e.ssmSecrets.length>0&&(n+=`
|
|
16
|
-
secrets: [${b(e.ssmSecrets)}],`),!V(e)){const i={...E,...e.environment};n+=`
|
|
1
|
+
var b=Object.defineProperty;var a=(e,n)=>b(e,"name",{value:n,configurable:!0});import{projectPlanToConstructProps as v}from"../../projection/index.js";import{formatValue as C,emitExtraProperties as P}from"../common.js";import{renderProjectedValueSource as k}from"../structuredSource.js";import{getConnectedDatabases as x,generateDatabaseEnvVarEntries as D,toDatabaseEnvVarValue as u}from"../database.js";import{getConnectedStorage as O,generateStorageEnvVarEntries as V,formatAllConnectionsCode as _}from"../storageConnections.js";import{getConnectedMessaging as j,generateMessagingEnvVarEntries as p}from"../messagingConnections.js";import{DEPLOYMENT_TYPE as g,DEFAULT_COMPUTE_ARCHITECTURE as M}from"../../schemas/constants.js";import{BASE_ENVIRONMENT_VARS as y,computeHasConnections as N,computeHasDatabaseConnections as T,computeHasMessagingConnections as $,computeHasStorageConnections as R,formatEnvBlock as A}from"./shared.js";function E(e){return e.deployment===g.CODE&&!!e.codePath}a(E,"isCodeDeployment");function L(e){const n=E(e);return{deployment:n?g.CODE:g.CONTAINER,...n&&{codePath:e.codePath},...n&&e.handler&&{handler:e.handler},...n&&e.runtime&&{runtime:e.runtime},...e.timeout!==void 0&&{timeout:e.timeout},...e.memory!==void 0&&{memory:e.memory},...e.functionUrl&&{functionUrl:e.functionUrl},...e.description&&{description:e.description},...(e.architecture!==void 0||!n)&&{architecture:e.architecture??M},...e.ephemeralStorageSize!==void 0&&{ephemeralStorageSize:e.ephemeralStorageSize},...e.functionName&&{functionName:e.functionName},...e.ssmSecretsPath&&{ssmSecretsPath:e.ssmSecretsPath},...e.ssmSecrets&&e.ssmSecrets.length>0&&{ssmSecrets:e.ssmSecrets}}}a(L,"buildLambdaProjectionFragment");function U(e){const{props:n}=v("compute",L(e));return n}a(U,"projectLambdaProps");function J(e){let n="";for(const o of U(e))n+=`
|
|
2
|
+
${o.key}: ${k(o,{indent:" "})},`,o.key==="deployment"&&!E(e)&&(n+=`
|
|
3
|
+
ecrRepository: app.getDefaultContainerRegistry(),`);if(!N(e)){const o={...y,...e.environment};n+=`
|
|
17
4
|
environment: {
|
|
18
|
-
${
|
|
19
|
-
},`}return n+=
|
|
20
|
-
|
|
5
|
+
${A(o," ")}
|
|
6
|
+
},`}return n+=P(e.extraProperties),n}a(J,"generateLambdaCode");function K(e,n){const o=T(e),m=R(e),h=$(e);if(!o&&!m&&!h)return"";const c=o?x(n,e):[],f=m?O(n,e):[],d=h?j(n,e):[];if(c.length===0&&f.length===0&&d.length===0)return"";const i={...y},l={};if(c.length>0){const r=D(c);for(const t of r){const S=u(t);t.isSecret?l[t.key]={__expression:t.expression}:i[t.key]=S}}if(f.length>0){const r=V(f);for(const t of r)i[t.key]={__expression:t.expression}}if(d.length>0){const r=p(d);for(const t of r)i[t.key]={__expression:t.expression}}if(e.environment)for(const[r,t]of Object.entries(e.environment))i[r]=t;let s="";if(Object.keys(l).length>0){s+=`
|
|
7
|
+
secretsImport: {`;for(const[r,t]of Object.entries(l))s+=`
|
|
21
8
|
${r}: ${C(t)},`;s+=`
|
|
22
|
-
},`}if(Object.keys(
|
|
23
|
-
environment: {`;for(const[r,t]of Object.entries(
|
|
9
|
+
},`}if(Object.keys(i).length>0){s+=`
|
|
10
|
+
environment: {`;for(const[r,t]of Object.entries(i))s+=`
|
|
24
11
|
${r}: ${C(t)},`;s+=`
|
|
25
12
|
},`}return s+=`
|
|
26
|
-
${_(f,
|
|
13
|
+
${_(c,f,d)}`,s}a(K,"generateLambdaConnectionsCode");export{L as buildLambdaProjectionFragment,J as generateLambdaCode,K as generateLambdaConnectionsCode,U as projectLambdaProps};
|