@fjall/generator 14.2.0 → 14.3.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 +14 -14
- package/dist/.minified +1 -1
- package/dist/src/ast/domain/astDomainParser.d.ts +12 -0
- package/dist/src/ast/domain/astDomainParser.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 +16 -1
- package/dist/src/codemod/drift/types.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/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/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +2 -2
package/dist/.build-source-hash
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"package.json",
|
|
10
10
|
"tsconfig.json"
|
|
11
11
|
],
|
|
12
|
-
"hash": "
|
|
12
|
+
"hash": "c197865438d6a6214248a8902160c0d9169037282836cf9111df93c3bb3f793f",
|
|
13
13
|
"files": {
|
|
14
14
|
"src/ast/astTestHelpers.ts": "026cac849eb88bdb",
|
|
15
|
-
"src/ast/domain/astDomainParser.ts": "
|
|
15
|
+
"src/ast/domain/astDomainParser.ts": "54a50bcec75a8306",
|
|
16
16
|
"src/ast/index.ts": "48c73220502e5201",
|
|
17
17
|
"src/ast/mutation/astCodeInjection.ts": "c1ebf483fb1e2332",
|
|
18
18
|
"src/ast/mutation/astExpressionEvaluator.ts": "6082789268b91212",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"src/aws/regions.ts": "a028bcb92b0e41d9",
|
|
38
38
|
"src/codemod/_internal.ts": "e865b7172fcc457b",
|
|
39
39
|
"src/codemod/drift/detect.ts": "05f17c36c25a76ad",
|
|
40
|
-
"src/codemod/drift/index.ts": "
|
|
40
|
+
"src/codemod/drift/index.ts": "bff894032fd0ae09",
|
|
41
41
|
"src/codemod/drift/merge.ts": "29093929befa9abd",
|
|
42
|
-
"src/codemod/drift/snapshot.ts": "
|
|
43
|
-
"src/codemod/drift/types.ts": "
|
|
42
|
+
"src/codemod/drift/snapshot.ts": "42748d69d1bc5142",
|
|
43
|
+
"src/codemod/drift/types.ts": "a1d07d77aa48dc17",
|
|
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",
|
|
@@ -77,18 +77,18 @@
|
|
|
77
77
|
"src/codemod/fileRewriter/parse.ts": "b12026c31562a13c",
|
|
78
78
|
"src/codemod/fileRewriter/print.ts": "f5ff7afb5b7786bf",
|
|
79
79
|
"src/codemod/historyPaths.ts": "ef8084013146db57",
|
|
80
|
-
"src/codemod/index.ts": "
|
|
80
|
+
"src/codemod/index.ts": "49bf31b304603e50",
|
|
81
81
|
"src/codemod/listResources.ts": "97f206a50edbea20",
|
|
82
82
|
"src/codemod/llmFallback/apply.ts": "2e656a6e55b3b4e3",
|
|
83
83
|
"src/codemod/llmFallback/claudeTier.ts": "ace3e3baa51383c9",
|
|
84
84
|
"src/codemod/llmFallback/egressGate.ts": "1b9076a5c51508fc",
|
|
85
85
|
"src/codemod/llmFallback/egressGate.types.ts": "e30947f12ee546ff",
|
|
86
86
|
"src/codemod/llmFallback/gateFallbackOutput.ts": "c630f3f0215ef077",
|
|
87
|
-
"src/codemod/llmFallback/index.ts": "
|
|
87
|
+
"src/codemod/llmFallback/index.ts": "b23cd7643ee5db3c",
|
|
88
88
|
"src/codemod/llmFallback/morphTier.ts": "adcc1cf280f9a65d",
|
|
89
89
|
"src/codemod/llmFallback/prompt.ts": "60e8f4ab434bf9ec",
|
|
90
90
|
"src/codemod/llmFallback/runFallback.ts": "03880734d6c456af",
|
|
91
|
-
"src/codemod/llmFallback/shouldTryFallback.ts": "
|
|
91
|
+
"src/codemod/llmFallback/shouldTryFallback.ts": "0ea7eeabf341f2c9",
|
|
92
92
|
"src/codemod/llmFallback/signals.ts": "298bae6465b5f173",
|
|
93
93
|
"src/codemod/llmFallback/telemetryEvents.ts": "827282cb185eea6c",
|
|
94
94
|
"src/codemod/llmFallback/tierRunner.ts": "a26094accd78cf15",
|
|
@@ -114,10 +114,10 @@
|
|
|
114
114
|
"src/detection/index.ts": "b4ad9a935564cb3e",
|
|
115
115
|
"src/dns/bindParser.ts": "376d274bf9e4bf9f",
|
|
116
116
|
"src/dns/bindWriter.ts": "c296911ce5aef77c",
|
|
117
|
-
"src/dns/domainFileGenerator.ts": "
|
|
118
|
-
"src/dns/domainRecords.ts": "
|
|
117
|
+
"src/dns/domainFileGenerator.ts": "cb03cd1a6b1bf452",
|
|
118
|
+
"src/dns/domainRecords.ts": "912ee83fc9ebdfcf",
|
|
119
119
|
"src/dns/index.ts": "266288ae3b851e3d",
|
|
120
|
-
"src/dns/tsEmitter.ts": "
|
|
120
|
+
"src/dns/tsEmitter.ts": "1667fe66013e767d",
|
|
121
121
|
"src/dns/types.ts": "82d6db9d7d26dbc2",
|
|
122
122
|
"src/generation/common.ts": "20075ada839797fb",
|
|
123
123
|
"src/generation/compute.ts": "4029a0d8e3197686",
|
|
@@ -179,11 +179,11 @@
|
|
|
179
179
|
"src/validation/patterns.ts": "f9629eafdad7ac3e",
|
|
180
180
|
"src/validation/validationMessages.ts": "772ae6e5a897a301",
|
|
181
181
|
"src/validation/validationPatterns.ts": "865f3d688975b7c8",
|
|
182
|
-
"src/version.ts": "
|
|
182
|
+
"src/version.ts": "f45b030d713c0c00",
|
|
183
183
|
"../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
|
|
184
|
-
"package.json": "
|
|
184
|
+
"package.json": "300a99e3aa568d7d",
|
|
185
185
|
"tsconfig.json": "1929cf3f99fe9b1e"
|
|
186
186
|
},
|
|
187
|
-
"outputHash": "
|
|
187
|
+
"outputHash": "b1a6f9021e616997964204947d103b53edf2f79639e97e05eea0dcb8d79d76cd",
|
|
188
188
|
"outputFileCount": 339
|
|
189
189
|
}
|
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
169 files minified at 2026-08-
|
|
1
|
+
169 files minified at 2026-08-20T22:18:56.335Z
|
|
@@ -52,12 +52,16 @@ export interface ParsedStandardRecord {
|
|
|
52
52
|
readonly name: string;
|
|
53
53
|
readonly value: string | string[];
|
|
54
54
|
readonly ttl?: number;
|
|
55
|
+
/** Construct-id override (stable-mode collision escape hatch). */
|
|
56
|
+
readonly id?: string;
|
|
55
57
|
}
|
|
56
58
|
export interface ParsedAliasRecord {
|
|
57
59
|
readonly kind: "alias";
|
|
58
60
|
readonly type: "A" | "AAAA";
|
|
59
61
|
readonly name: string;
|
|
60
62
|
readonly target: ParsedFjallTarget;
|
|
63
|
+
/** Construct-id override (stable-mode collision escape hatch). */
|
|
64
|
+
readonly id?: string;
|
|
61
65
|
}
|
|
62
66
|
export type ParsedDnsRecordFromAst = ParsedStandardRecord | ParsedAliasRecord;
|
|
63
67
|
export interface ParsedCertificateFromAst {
|
|
@@ -74,6 +78,14 @@ export interface ParsedCertificateFromAst {
|
|
|
74
78
|
}
|
|
75
79
|
interface ParsedDomainCommon {
|
|
76
80
|
readonly zoneName: string;
|
|
81
|
+
/**
|
|
82
|
+
* Records-list construct-id scheme (`DomainCommonProps.recordIds`);
|
|
83
|
+
* `undefined` means the construct default (`"indexed"`). Parsed
|
|
84
|
+
* fail-closed: dropping it on a round trip would silently flip a
|
|
85
|
+
* stable-mode zone back to indexed IDs — a full delete+recreate of its
|
|
86
|
+
* record sets at the next deploy.
|
|
87
|
+
*/
|
|
88
|
+
readonly recordIds: "indexed" | "stable" | undefined;
|
|
77
89
|
readonly description: string | undefined;
|
|
78
90
|
readonly costAllocationEnvironment: string | undefined;
|
|
79
91
|
readonly tags: Record<string, string> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var u=(n,e)=>T(n,"name",{value:e,configurable:!0});import*as m from"typescript";import{parseObjectLiteral as $,asString as c,asStringUnion as k,asStringArray as S,asBoolean as b,asNumber as I,isCallRef as E,isParsedObject as g}from"../parsers/common/astCommonParser.js";import{success as l,failure as a}from"../../types/Result.js";import{DnsRecordTypeSchema as L}from"../../dns/types.js";import{DomainRegistrarSchema as j,DomainDeployPhaseSchema as O,AliasRecordTypeSchema as Z,TYPED_FJALL_TARGET_KINDS as C}from"../../dns/domainRecords.js";const x=j.options,N=O.options,F=L.options,V=Z.options;function z(n){const e=[],t=u(r=>{if(m.isNewExpression(r)&&P(r.expression)){const o=M(r);o!==void 0&&e.push(o)}m.forEachChild(r,t)},"visit");if(t(n),e.length===0)return l(void 0);if(e.length>1)return a(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${e.length}`));const i=e[0];return i?l(i):l(void 0)}u(z,"findDomainConstructCall");function P(n){return m.isIdentifier(n)&&n.text==="Domain"}u(P,"isDomainIdentifier");function M(n){const e=n.arguments;if(!e||e.length<3)return;const t=e[0],i=e[1],r=e[2];if(!t||!i||!r||!m.isObjectLiteralExpression(r))return;const o=q(n);if(o===void 0)return;const d=B(n),s=m.isStringLiteral(i)?i.text:void 0;return{callExpression:n,containingStatement:o,propsObjectLiteral:r,domainVarId:d,scopeArgumentText:t.getText(),constructIdLiteral:s}}u(M,"buildMatch");function q(n){let e=n;for(;e!==void 0;){if(m.isExpressionStatement(e)||m.isVariableStatement(e))return e;e=e.parent}}u(q,"findContainingTopLevelStatement");function B(n){let e=n.parent;for(;e!==void 0;){if(m.isVariableDeclaration(e)&&m.isIdentifier(e.name)&&e.initializer===n)return e.name.text;e=e.parent}}u(B,"extractDomainVarId");function J(n){switch(n.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${x.join(", ")}, got ${JSON.stringify(n.value)}`;case"missing_field":return`'${n.field}' property is required`;case"invalid_literal":return`'${n.field}' ${n.reason}`;case"removed_field":return`'${n.field}' was removed from the Domain API \u2014 ${n.cure}`}}u(J,"errorMessage");const U="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function G(n){const e=$(n),t=k(e.registrar,x);if(t===void 0){const s=e.registrar;if(s===void 0)return a({kind:"registrar_required"});const f=typeof s=="string"?s:y(s);return a({kind:"registrar_unsupported",value:f})}const i=c(e.zoneName);if(i===void 0)return a({kind:"missing_field",field:"zoneName"});const r=Y(e.records);if(!r.success)return r;const o=W(e.certificates);if(!o.success)return o;if(e.delegations!==void 0)return a({kind:"removed_field",field:"delegations",cure:U});const d={zoneName:i,description:c(e.description),costAllocationEnvironment:c(e.costAllocationEnvironment),tags:X(e.tags),records:r.data,certificates:o.data};switch(t){case"route53":return l({...d,registrar:t,hostedZoneId:c(e.hostedZoneId)});case"external-delegated":{const s=c(e.delegatedSubdomain);if(s===void 0)return a({kind:"missing_field",field:"delegatedSubdomain"});const f=c(e.hostedZoneId);if(e.hostedZoneId!==void 0&&f===void 0)return a({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});const h=S(e.adoptedNameServers);if(e.adoptedNameServers!==void 0&&h===void 0)return a({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(f===void 0!=(h===void 0))return a({kind:"invalid_literal",field:f===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});const _=c(e.parentDelegationRoleArn);if(e.parentDelegationRoleArn!==void 0&&_===void 0)return a({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});const A=k(e.phase,N);return e.phase!==void 0&&A===void 0?a({kind:"invalid_literal",field:"phase",reason:`must be one of ${N.map(R=>`'${R}'`).join(", ")}`}):l({...d,registrar:t,delegatedSubdomain:s,hostedZoneId:f,adoptedNameServers:h,parentDelegationRoleArn:_,phase:A})}case"external-records":return l({...d,registrar:t})}}u(G,"parseDomainProps");function se(n){return J(n)}u(se,"parseDomainErrorMessage");function oe(n,e,t){const i=m.createSourceFile(e,n,m.ScriptTarget.Latest,!0,m.ScriptKind.TS),r=z(i);if(!r.success)return a(new Error(r.error.message));if(r.data===void 0)return a(new Error(`Domain '${t}': no 'new Domain(...)' call found in ${e} \u2014 the file is not a Fjall domain component.`));const o=G(r.data.propsObjectLiteral);return o.success?l(o.data):a(new Error(`Domain '${t}': infrastructure.ts could not be parsed (${o.error.kind}).`))}u(oe,"parseDomainInfrastructureSource");function Y(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"records",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(!g(i))return a({kind:"invalid_literal",field:`records[${t}]`,reason:"must be an object literal"});const r=w(i,t);if(!r.success)return r;e.push(r.data)}return l(e)}u(Y,"parseRecordsArray");function w(n,e){const t=c(n.type),i=c(n.name);if(t===void 0)return a({kind:"missing_field",field:`records[${e}].type`});if(i===void 0)return a({kind:"missing_field",field:`records[${e}].name`});if(n.target!==void 0){if(!V.some(f=>f===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`alias records must have type 'A' or 'AAAA', got '${t}'`});const s=H(n.target);return l({kind:"alias",type:t,name:i,target:s})}if(!F.some(s=>s===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`unsupported record type '${t}'`});const r=K(n.value);if(r===void 0)return a({kind:"invalid_literal",field:`records[${e}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(n.value)})`});const o=I(n.ttl),d={kind:"standard",type:t,name:i,value:r,...o!==void 0?{ttl:o}:{}};return l(d)}u(w,"parseRecord");function K(n){if(n===void 0)return;if(typeof n=="string")return n;const e=S(n);if(e!==void 0)return e}u(K,"parseRecordValue");function H(n){if(E(n))return Q(n);if(g(n)){const e=k(n.kind,C);if(e==="ecs"||e==="cdn"){const t=c(n.appName);if(t!==void 0)return{kind:e,appName:t}}if(e==="bucket"){const t=c(n.bucketName);if(t!==void 0)return{kind:e,bucketName:t}}if(e==="custom"){const t=c(n.dnsName),i=c(n.hostedZoneId);if(t!==void 0&&i!==void 0)return{kind:e,dnsName:t,hostedZoneId:i}}}return{kind:"unresolved",sourceText:y(n)}}u(H,"parseTarget");function Q(n){const e=n.__call.trim(),t=e.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!t)return{kind:"unresolved",sourceText:e};const i=t[1],r=t[2]??"",o=D(r);switch(i){case"fjallApp":{const d=p(o,0);if(d===void 0)return{kind:"dynamic",sourceText:e};if(o.length<2)return{kind:"ecs",appName:d};const s=p(o,1);return s===void 0?{kind:"dynamic",sourceText:e}:{kind:"ecs",appName:d,computeName:s}}case"fjallCdn":{const d=p(o,0);return d===void 0?{kind:"dynamic",sourceText:e}:{kind:"cdn",appName:d}}case"fjallBucket":{const d=p(o,0);return d===void 0?{kind:"dynamic",sourceText:e}:{kind:"bucket",bucketName:d}}case"aliasTo":{if(o.length>=2){const d=p(o,0),s=p(o,1);return d!==void 0&&s!==void 0?{kind:"custom",dnsName:d,hostedZoneId:s}:{kind:"dynamic",sourceText:e}}if(o.length===1){const d=o[0]?.trim()??"",s=v(d,"dnsName"),f=v(d,"hostedZoneId");return s!==void 0&&f!==void 0?{kind:"custom",dnsName:s,hostedZoneId:f}:{kind:"dynamic",sourceText:e}}return{kind:"unresolved",sourceText:e}}default:return{kind:"unresolved",sourceText:e}}}u(Q,"resolveCallRefTarget");function D(n){const e=[];let t=0,i=null,r="";for(let d=0;d<n.length;d++){const s=n[d];if(i!==null){if(r+=s,s==="\\"&&d+1<n.length){const f=n[d+1];f!==void 0&&(r+=f,d+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,r+=s;continue}if(s==="("||s==="{"||s==="["){t+=1,r+=s;continue}if(s===")"||s==="}"||s==="]"){t-=1,r+=s;continue}if(s===","&&t===0){e.push(r.trim()),r="";continue}r+=s}const o=r.trim();return o.length>0&&e.push(o),e}u(D,"splitTopLevelArgs");function p(n,e){const t=n[e];if(t===void 0)return;const i=t.trim();if(i.length<2)return;const r=i[0],o=i[i.length-1];if(r===o&&!(r!=='"'&&r!=="'"&&r!=="`"))return i.slice(1,-1)}u(p,"extractStringLiteralArg");function v(n,e){const t=n.trim().replace(/^\{|\}$/g,""),i=D(t);for(const r of i){const o=r.indexOf(":");if(o<0||r.slice(0,o).trim().replace(/["'`]/g,"")!==e)continue;const s=r.slice(o+1).trim();return p([s],0)}}u(v,"extractObjectFieldString");function W(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"certificates",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(typeof i=="string"){e.push({domainName:i});continue}if(!g(i))return a({kind:"invalid_literal",field:`certificates[${t}]`,reason:"must be a string or object literal"});const r=c(i.domainName);if(r===void 0)return a({kind:"missing_field",field:`certificates[${t}].domainName`});const o=S(i.subjectAlternativeNames),d=b(i.transparencyLogging),s=b(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return a({kind:"invalid_literal",field:`certificates[${t}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});e.push({domainName:r,...o!==void 0?{subjectAlternativeNames:o}:{},...d!==void 0?{transparencyLogging:d}:{},...s!==void 0?{cloudFront:s}:{}})}return l(e)}u(W,"parseCertificatesArray");function X(n){if(n===void 0||!g(n))return;const e={};for(const[t,i]of Object.entries(n)){const r=c(i);r!==void 0&&(e[t]=r)}return Object.keys(e).length===0?void 0:e}u(X,"parseStringRecord");function y(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return String(n);if(Array.isArray(n))return`[${n.map(e=>y(e)).join(", ")}]`;if(typeof n=="object"){if("__call"in n)return String(n.__call);if("__identifier"in n)return String(n.__identifier);if("__expression"in n)return String(n.__expression);if("__unknown"in n)return String(n.__unknown)}return String(n)}u(y,"stringifyParsedValue");export{z as findDomainConstructCall,se as parseDomainErrorMessage,oe as parseDomainInfrastructureSource,G as parseDomainProps,D as splitTopLevelArgs};
|
|
1
|
+
var T=Object.defineProperty;var u=(n,e)=>T(n,"name",{value:e,configurable:!0});import*as m from"typescript";import{parseObjectLiteral as E,asString as f,asStringUnion as h,asStringArray as k,asBoolean as D,asNumber as L,isCallRef as j,isParsedObject as S}from"../parsers/common/astCommonParser.js";import{success as l,failure as a}from"../../types/Result.js";import{DnsRecordTypeSchema as O}from"../../dns/types.js";import{DomainRegistrarSchema as C,DomainDeployPhaseSchema as Z,AliasRecordTypeSchema as F,RecordConstructIdSchema as V,RecordIdsModeSchema as P,TYPED_FJALL_TARGET_KINDS as z}from"../../dns/domainRecords.js";const N=C.options,x=Z.options,I=P.options,M=O.options,q=F.options;function B(n){const e=[],t=u(r=>{if(m.isNewExpression(r)&&J(r.expression)){const d=U(r);d!==void 0&&e.push(d)}m.forEachChild(r,t)},"visit");if(t(n),e.length===0)return l(void 0);if(e.length>1)return a(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${e.length}`));const i=e[0];return i?l(i):l(void 0)}u(B,"findDomainConstructCall");function J(n){return m.isIdentifier(n)&&n.text==="Domain"}u(J,"isDomainIdentifier");function U(n){const e=n.arguments;if(!e||e.length<3)return;const t=e[0],i=e[1],r=e[2];if(!t||!i||!r||!m.isObjectLiteralExpression(r))return;const d=w(n);if(d===void 0)return;const o=G(n),s=m.isStringLiteral(i)?i.text:void 0;return{callExpression:n,containingStatement:d,propsObjectLiteral:r,domainVarId:o,scopeArgumentText:t.getText(),constructIdLiteral:s}}u(U,"buildMatch");function w(n){let e=n;for(;e!==void 0;){if(m.isExpressionStatement(e)||m.isVariableStatement(e))return e;e=e.parent}}u(w,"findContainingTopLevelStatement");function G(n){let e=n.parent;for(;e!==void 0;){if(m.isVariableDeclaration(e)&&m.isIdentifier(e.name)&&e.initializer===n)return e.name.text;e=e.parent}}u(G,"extractDomainVarId");function Y(n){switch(n.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${N.join(", ")}, got ${JSON.stringify(n.value)}`;case"missing_field":return`'${n.field}' property is required`;case"invalid_literal":return`'${n.field}' ${n.reason}`;case"removed_field":return`'${n.field}' was removed from the Domain API \u2014 ${n.cure}`}}u(Y,"errorMessage");const K="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function H(n){const e=E(n),t=h(e.registrar,N);if(t===void 0){const c=e.registrar;if(c===void 0)return a({kind:"registrar_required"});const p=typeof c=="string"?c:y(c);return a({kind:"registrar_unsupported",value:p})}const i=f(e.zoneName);if(i===void 0)return a({kind:"missing_field",field:"zoneName"});const r=h(e.recordIds,I);if(e.recordIds!==void 0&&r===void 0)return a({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${I.map(c=>`'${c}'`).join(", ")}`});const d=Q(e.records);if(!d.success)return d;const o=te(e.certificates);if(!o.success)return o;if(e.delegations!==void 0)return a({kind:"removed_field",field:"delegations",cure:K});const s={zoneName:i,recordIds:r,description:f(e.description),costAllocationEnvironment:f(e.costAllocationEnvironment),tags:re(e.tags),records:d.data,certificates:o.data};switch(t){case"route53":return l({...s,registrar:t,hostedZoneId:f(e.hostedZoneId)});case"external-delegated":{const c=f(e.delegatedSubdomain);if(c===void 0)return a({kind:"missing_field",field:"delegatedSubdomain"});const p=f(e.hostedZoneId);if(e.hostedZoneId!==void 0&&p===void 0)return a({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});const _=k(e.adoptedNameServers);if(e.adoptedNameServers!==void 0&&_===void 0)return a({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(p===void 0!=(_===void 0))return a({kind:"invalid_literal",field:p===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});const A=f(e.parentDelegationRoleArn);if(e.parentDelegationRoleArn!==void 0&&A===void 0)return a({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});const b=h(e.phase,x);return e.phase!==void 0&&b===void 0?a({kind:"invalid_literal",field:"phase",reason:`must be one of ${x.map($=>`'${$}'`).join(", ")}`}):l({...s,registrar:t,delegatedSubdomain:c,hostedZoneId:p,adoptedNameServers:_,parentDelegationRoleArn:A,phase:b})}case"external-records":return l({...s,registrar:t})}}u(H,"parseDomainProps");function ue(n){return Y(n)}u(ue,"parseDomainErrorMessage");function ce(n,e,t){const i=m.createSourceFile(e,n,m.ScriptTarget.Latest,!0,m.ScriptKind.TS),r=B(i);if(!r.success)return a(new Error(r.error.message));if(r.data===void 0)return a(new Error(`Domain '${t}': no 'new Domain(...)' call found in ${e} \u2014 the file is not a Fjall domain component.`));const d=H(r.data.propsObjectLiteral);return d.success?l(d.data):a(new Error(`Domain '${t}': infrastructure.ts could not be parsed (${d.error.kind}).`))}u(ce,"parseDomainInfrastructureSource");function Q(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"records",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(!S(i))return a({kind:"invalid_literal",field:`records[${t}]`,reason:"must be an object literal"});const r=W(i,t);if(!r.success)return r;e.push(r.data)}return l(e)}u(Q,"parseRecordsArray");function W(n,e){const t=f(n.type),i=f(n.name);if(t===void 0)return a({kind:"missing_field",field:`records[${e}].type`});if(i===void 0)return a({kind:"missing_field",field:`records[${e}].name`});const r=f(n.id);if(n.id!==void 0&&(r===void 0||!V.safeParse(r).success))return a({kind:"invalid_literal",field:`records[${e}].id`,reason:"must be a literal alphanumeric string starting with a letter \u2014 it becomes a CloudFormation logical-ID segment"});if(n.target!==void 0){if(!q.some(p=>p===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`alias records must have type 'A' or 'AAAA', got '${t}'`});const c=ee(n.target);return l({kind:"alias",type:t,name:i,target:c,...r!==void 0?{id:r}:{}})}if(!M.some(c=>c===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`unsupported record type '${t}'`});const d=X(n.value);if(d===void 0)return a({kind:"invalid_literal",field:`records[${e}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(n.value)})`});const o=L(n.ttl),s={kind:"standard",type:t,name:i,value:d,...o!==void 0?{ttl:o}:{},...r!==void 0?{id:r}:{}};return l(s)}u(W,"parseRecord");function X(n){if(n===void 0)return;if(typeof n=="string")return n;const e=k(n);if(e!==void 0)return e}u(X,"parseRecordValue");function ee(n){if(j(n))return ne(n);if(S(n)){const e=h(n.kind,z);if(e==="ecs"||e==="cdn"){const t=f(n.appName);if(t!==void 0)return{kind:e,appName:t}}if(e==="bucket"){const t=f(n.bucketName);if(t!==void 0)return{kind:e,bucketName:t}}if(e==="custom"){const t=f(n.dnsName),i=f(n.hostedZoneId);if(t!==void 0&&i!==void 0)return{kind:e,dnsName:t,hostedZoneId:i}}}return{kind:"unresolved",sourceText:y(n)}}u(ee,"parseTarget");function ne(n){const e=n.__call.trim(),t=e.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!t)return{kind:"unresolved",sourceText:e};const i=t[1],r=t[2]??"",d=v(r);switch(i){case"fjallApp":{const o=g(d,0);if(o===void 0)return{kind:"dynamic",sourceText:e};if(d.length<2)return{kind:"ecs",appName:o};const s=g(d,1);return s===void 0?{kind:"dynamic",sourceText:e}:{kind:"ecs",appName:o,computeName:s}}case"fjallCdn":{const o=g(d,0);return o===void 0?{kind:"dynamic",sourceText:e}:{kind:"cdn",appName:o}}case"fjallBucket":{const o=g(d,0);return o===void 0?{kind:"dynamic",sourceText:e}:{kind:"bucket",bucketName:o}}case"aliasTo":{if(d.length>=2){const o=g(d,0),s=g(d,1);return o!==void 0&&s!==void 0?{kind:"custom",dnsName:o,hostedZoneId:s}:{kind:"dynamic",sourceText:e}}if(d.length===1){const o=d[0]?.trim()??"",s=R(o,"dnsName"),c=R(o,"hostedZoneId");return s!==void 0&&c!==void 0?{kind:"custom",dnsName:s,hostedZoneId:c}:{kind:"dynamic",sourceText:e}}return{kind:"unresolved",sourceText:e}}default:return{kind:"unresolved",sourceText:e}}}u(ne,"resolveCallRefTarget");function v(n){const e=[];let t=0,i=null,r="";for(let o=0;o<n.length;o++){const s=n[o];if(i!==null){if(r+=s,s==="\\"&&o+1<n.length){const c=n[o+1];c!==void 0&&(r+=c,o+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,r+=s;continue}if(s==="("||s==="{"||s==="["){t+=1,r+=s;continue}if(s===")"||s==="}"||s==="]"){t-=1,r+=s;continue}if(s===","&&t===0){e.push(r.trim()),r="";continue}r+=s}const d=r.trim();return d.length>0&&e.push(d),e}u(v,"splitTopLevelArgs");function g(n,e){const t=n[e];if(t===void 0)return;const i=t.trim();if(i.length<2)return;const r=i[0],d=i[i.length-1];if(r===d&&!(r!=='"'&&r!=="'"&&r!=="`"))return i.slice(1,-1)}u(g,"extractStringLiteralArg");function R(n,e){const t=n.trim().replace(/^\{|\}$/g,""),i=v(t);for(const r of i){const d=r.indexOf(":");if(d<0||r.slice(0,d).trim().replace(/["'`]/g,"")!==e)continue;const s=r.slice(d+1).trim();return g([s],0)}}u(R,"extractObjectFieldString");function te(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"certificates",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(typeof i=="string"){e.push({domainName:i});continue}if(!S(i))return a({kind:"invalid_literal",field:`certificates[${t}]`,reason:"must be a string or object literal"});const r=f(i.domainName);if(r===void 0)return a({kind:"missing_field",field:`certificates[${t}].domainName`});const d=k(i.subjectAlternativeNames),o=D(i.transparencyLogging),s=D(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return a({kind:"invalid_literal",field:`certificates[${t}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});e.push({domainName:r,...d!==void 0?{subjectAlternativeNames:d}:{},...o!==void 0?{transparencyLogging:o}:{},...s!==void 0?{cloudFront:s}:{}})}return l(e)}u(te,"parseCertificatesArray");function re(n){if(n===void 0||!S(n))return;const e={};for(const[t,i]of Object.entries(n)){const r=f(i);r!==void 0&&(e[t]=r)}return Object.keys(e).length===0?void 0:e}u(re,"parseStringRecord");function y(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return String(n);if(Array.isArray(n))return`[${n.map(e=>y(e)).join(", ")}]`;if(typeof n=="object"){if("__call"in n)return String(n.__call);if("__identifier"in n)return String(n.__identifier);if("__expression"in n)return String(n.__expression);if("__unknown"in n)return String(n.__unknown)}return String(n)}u(y,"stringifyParsedValue");export{B as findDomainConstructCall,ue as parseDomainErrorMessage,ce as parseDomainInfrastructureSource,H as parseDomainProps,v as splitTopLevelArgs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { detectDrift, type DriftOp, type DriftPlan } from "./detect.js";
|
|
2
2
|
export { mergeProperties, type MergeResult } from "./merge.js";
|
|
3
3
|
export { snapshotProperties } from "./snapshot.js";
|
|
4
|
-
export { DriftPolicySchema, DriftStateSchema, PropertyDeltaSchema, ResourceSnapshotSchema, type DriftPolicy, type DriftState, type PropertyDelta, type ResourceSnapshot, } from "./types.js";
|
|
4
|
+
export { DriftPolicySchema, DriftStateSchema, PropertyDeltaSchema, RESOURCE_SNAPSHOT_SCHEMA_VERSION, ResourceSnapshotSchema, type DriftPolicy, type DriftState, type PropertyDelta, type ResourceSnapshot, } from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{detectDrift as t}from"./detect.js";import{mergeProperties as
|
|
1
|
+
import{detectDrift as t}from"./detect.js";import{mergeProperties as S}from"./merge.js";import{snapshotProperties as p}from"./snapshot.js";import{DriftPolicySchema as c,DriftStateSchema as f,PropertyDeltaSchema as h,RESOURCE_SNAPSHOT_SCHEMA_VERSION as i,ResourceSnapshotSchema as s}from"./types.js";export{c as DriftPolicySchema,f as DriftStateSchema,h as PropertyDeltaSchema,i as RESOURCE_SNAPSHOT_SCHEMA_VERSION,s as ResourceSnapshotSchema,t as detectDrift,S as mergeProperties,p as snapshotProperties};
|
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
import { type Result } from "../../types/Result.js";
|
|
2
2
|
import { type NodeShapeLike, type ObjectExpressionNodeLike } from "../edits/modifyResource/literalConversion.js";
|
|
3
3
|
import type { CodemodError, ResourceName, StatementType } from "../types.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type ResourceSnapshot } from "./types.js";
|
|
5
5
|
export declare function snapshotProperties(content: string, type: StatementType, name: ResourceName): Result<ResourceSnapshot, CodemodError>;
|
|
6
|
+
export interface PlanSpelling {
|
|
7
|
+
planKey: string;
|
|
8
|
+
precedence: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const PRECEDENCE_CANONICAL = 2;
|
|
11
|
+
export declare const PRECEDENCE_PLAN_LEAK = 1;
|
|
12
|
+
export declare const PRECEDENCE_ALIAS = 0;
|
|
13
|
+
/**
|
|
14
|
+
* File-spelling → plan-key map for extraction. Since Increment C the file
|
|
15
|
+
* speaks construct vocabulary while the plan (and the baseline compared
|
|
16
|
+
* against it) speaks plan vocabulary, so extraction must recognise a plan
|
|
17
|
+
* key's construct spelling (`retentionPeriod` is emitted as
|
|
18
|
+
* `messageRetentionPeriod`) and any declared alias spellings, normalising
|
|
19
|
+
* every occurrence to the plan spelling — otherwise a hand-edit to a
|
|
20
|
+
* translated construct key is invisible to drift.
|
|
21
|
+
*
|
|
22
|
+
* Claims derive from what the projection can EMIT under a spelling, not from
|
|
23
|
+
* schema-key identity. A plan key claims its own spelling only if the
|
|
24
|
+
* projection can emit it under that spelling: a rule without `as`, or a
|
|
25
|
+
* key/type outside the projection tables (where plan vocabulary is written
|
|
26
|
+
* verbatim). A planOnly key is NEVER emitted as a construct prop, so it
|
|
27
|
+
* claims no file spelling at all — its name stays free for a sibling key's
|
|
28
|
+
* rename target (compute's `ssmSecrets` is emitted as `secrets`, which is
|
|
29
|
+
* itself a planOnly plan key; the file's `secrets` prop can only ever mean
|
|
30
|
+
* the SSM array). Precedence encodes what the construct actually reads when
|
|
31
|
+
* one statement carries several spellings of the same key: canonical
|
|
32
|
+
* construct spelling beats a plan-vocabulary leak beats a declared alias.
|
|
33
|
+
*
|
|
34
|
+
* Exported for the projection-invariant test only; production consumption
|
|
35
|
+
* goes through {@link snapshotProperties}.
|
|
36
|
+
*/
|
|
37
|
+
export declare function planSpellingsFor(type: StatementType): Map<string, PlanSpelling>;
|
|
6
38
|
/**
|
|
7
39
|
* Resolve the config `ObjectExpression` for a located statement by matching
|
|
8
40
|
* the recast/babel span of the factory call's name `StringLiteral` against
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var
|
|
1
|
+
var h=Object.defineProperty;var f=(t,n)=>h(t,"name",{value:n,configurable:!0});import*as x from"recast";import{GENERATOR_VERSION as P}from"../../version.js";import{failure as d,success as b}from"../../types/Result.js";import{extractProgramBody as R}from"../_internal.js";import{astToLiteral as S,isNodeShape as g,NON_LITERAL as A,readKeyName as K}from"../edits/modifyResource/literalConversion.js";import{visit as C}from"../edits/objectGraph.js";import{parse as k}from"../fileRewriter/index.js";import{listResources as T}from"../listResources.js";import{constructKeyAliasesFor as _,isProjectableType as j,TYPE_PROJECTIONS as L}from"../../projection/index.js";import{locateNamesFor as I,STATEMENT_REGISTRY as v}from"../registry.js";import{RESOURCE_SNAPSHOT_SCHEMA_VERSION as F}from"./types.js";function ee(t,n,o){const s=T(t);if(!s.success)return d(s.error);const u=I(n,o),c=s.data.resources.find(i=>i.type===n&&u.includes(i.name));if(c===void 0)return d({kind:"ResourceNotFoundError",type:n,name:o,knownNames:s.data.resources.filter(i=>i.type===n).map(i=>i.name)});const e=k(t,c.filePath);if(!e.success)return d(e.error);const r=R(e.data);if(r===void 0)return d({kind:"SemanticQueryError",reason:"recast File is missing program.body"});const a=D(r,c);if(a===void 0)return d({kind:"SemanticQueryError",reason:"Unable to resolve config ObjectExpression for the located resource."});const l=w(n),m={},y=new Map;for(const i of a.properties){if(i.type!=="Property"&&i.type!=="ObjectProperty"||i.shorthand===!0||i.computed===!0)continue;const E=K(i.key);if(E===void 0)continue;const p=l.get(E);if(p===void 0||i.value===void 0)continue;const N=y.get(p.planKey);N!==void 0&&N>p.precedence||(y.set(p.planKey,p.precedence),m[p.planKey]=G(i.value,t))}return b({type:n,name:o,properties:m,schemaVersion:F,generatorVersion:P})}f(ee,"snapshotProperties");const O=2,V=1,M=0;function w(t){const n=new Map,o=Object.keys(v[t].schemaFragment.shape),s=j(t)?L[t].keys??{}:{},u=f(e=>s[e]?.kind==="planOnly","isPlanOnly"),c=f(e=>{const r=s[e];return r!==void 0&&"as"in r&&r.as!==void 0?r.as:e},"constructKeyOf");for(const e of o)u(e)||c(e)===e&&n.set(e,{planKey:e,precedence:O});for(const e of o){if(u(e))continue;const r=c(e);r!==e&&(n.has(r)||n.set(r,{planKey:e,precedence:O}))}for(const e of o)u(e)||c(e)!==e&&(n.has(e)||n.set(e,{planKey:e,precedence:V}));for(const[e,r]of Object.entries(_(t))){const a=n.get(e);if(a!==void 0)for(const l of r)n.has(l)||n.set(l,{planKey:a.planKey,precedence:M})}return n}f(w,"planSpellingsFor");function D(t,n){const o=n.start+n.length;let s;const u=f(c=>{if(s!==void 0||c.type!=="CallExpression")return;const e=c.arguments;if(!Array.isArray(e)||e.length<2)return;const r=e[0];if(!g(r)||r.type!=="StringLiteral"||r.start!==n.start||r.end!==o)return;const a=e[1];g(a)&&a.type==="ObjectExpression"&&(s=a)},"visitor");for(const c of t)if(C(c,u),s!==void 0)break;return s}f(D,"findConfigObject");function G(t,n){const o=S(t);return o!==A?o:H(t,n)}f(G,"extractPropertyValue");function H(t,n){try{return{kind:"expression",text:x.prettyPrint(t,{tabWidth:2}).code}}catch{const o=typeof t.start=="number"?t.start:void 0,s=typeof t.end=="number"?t.end:void 0;return{kind:"expression",text:o!==void 0&&s!==void 0&&o<s?n.slice(o,s):""}}}f(H,"toExpressionValue");export{M as PRECEDENCE_ALIAS,O as PRECEDENCE_CANONICAL,V as PRECEDENCE_PLAN_LEAK,D as findConfigObject,w as planSpellingsFor,ee as snapshotProperties};
|
|
@@ -2,6 +2,20 @@ import { z } from "zod";
|
|
|
2
2
|
import { PropertyDeltaSchema } from "../types.js";
|
|
3
3
|
export { DriftPolicySchema, type DriftPolicy } from "../types.js";
|
|
4
4
|
export { PropertyDeltaSchema };
|
|
5
|
+
/**
|
|
6
|
+
* Version of the baseline snapshot format. Version 2 records FILE truth:
|
|
7
|
+
* `properties` is `snapshotProperties(...)` of the statement as written —
|
|
8
|
+
* plan-normalised spelling, snapshot value encoding — never the property set
|
|
9
|
+
* a command happened to carry, and `generatorVersion` stamps the emitting
|
|
10
|
+
* `@fjall/generator` so a persisted baseline from another vocabulary era can
|
|
11
|
+
* be discarded at read time.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RESOURCE_SNAPSHOT_SCHEMA_VERSION = 2;
|
|
14
|
+
/**
|
|
15
|
+
* Canonical home of the baseline snapshot schema. The CLI baseline store
|
|
16
|
+
* (`cli/src/operations/codemod/codemodBaselineStore.ts`) consumes THIS
|
|
17
|
+
* schema — re-export, never redeclare (coupled-discriminated-union rule).
|
|
18
|
+
*/
|
|
5
19
|
export declare const ResourceSnapshotSchema: z.ZodObject<{
|
|
6
20
|
type: z.ZodEnum<{
|
|
7
21
|
storage: "storage";
|
|
@@ -19,7 +33,8 @@ export declare const ResourceSnapshotSchema: z.ZodObject<{
|
|
|
19
33
|
}>;
|
|
20
34
|
name: z.ZodString;
|
|
21
35
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
22
|
-
schemaVersion: z.ZodLiteral<
|
|
36
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
37
|
+
generatorVersion: z.ZodString;
|
|
23
38
|
}, z.core.$strict>;
|
|
24
39
|
export declare const DriftStateSchema: z.ZodObject<{
|
|
25
40
|
resource: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";import{PropertyDeltaSchema as t,ResourceNameSchema as r,StatementTypeSchema as o}from"../types.js";import{DriftPolicySchema as
|
|
1
|
+
import{z as e}from"zod";import{PropertyDeltaSchema as t,ResourceNameSchema as r,StatementTypeSchema as o}from"../types.js";import{DriftPolicySchema as S}from"../types.js";const c=2,m=e.object({type:o,name:r,properties:e.record(e.string(),e.unknown()),schemaVersion:e.literal(c),generatorVersion:e.string().min(1)}).strict(),i=e.object({resource:e.object({type:o,name:r}).strict(),deltas:e.array(t),summary:e.enum(["clean","no-op","drifted-compatible","drifted-conflict","unknown"])}).strict();export{S as DriftPolicySchema,i as DriftStateSchema,t as PropertyDeltaSchema,c as RESOURCE_SNAPSHOT_SCHEMA_VERSION,m as ResourceSnapshotSchema};
|
|
@@ -13,7 +13,7 @@ export { resolveConstructByLiteralProperty, type ConstructResolution, type Const
|
|
|
13
13
|
export { parse } from "./fileRewriter/parse.js";
|
|
14
14
|
export { CrossPlanConnectionResourcePlanSchema, VpcPeerAccepterResourcePlanSchema, VpcPeerResourcePlanSchema, } from "../schemas/index.js";
|
|
15
15
|
export type { CrossPlanConnectionResourcePlan, VpcPeerAccepterResourcePlan, VpcPeerResourcePlan, } from "../schemas/index.js";
|
|
16
|
-
export { detectDrift, mergeProperties, snapshotProperties, type DriftOp, type DriftPlan, type DriftPolicy, type DriftState, type MergeResult, type PropertyDelta, type ResourceSnapshot, } from "./drift/index.js";
|
|
16
|
+
export { detectDrift, mergeProperties, RESOURCE_SNAPSHOT_SCHEMA_VERSION, ResourceSnapshotSchema, snapshotProperties, type DriftOp, type DriftPlan, type DriftPolicy, type DriftState, type MergeResult, type PropertyDelta, type ResourceSnapshot, } from "./drift/index.js";
|
|
17
17
|
export { computeLinesDelta } from "./_internal.js";
|
|
18
18
|
export { ResourceNameSchema, StatementTypeSchema } from "./types.js";
|
|
19
19
|
export { REGISTERED_STATEMENT_TYPES, STATEMENT_REGISTRY, type StatementTypeEntry, } from "./registry.js";
|
|
@@ -22,5 +22,5 @@ export { projectionRefusals } from "./emitProjection.js";
|
|
|
22
22
|
export { CODEMOD_ERROR_KINDS } from "./telemetry/errorKinds.js";
|
|
23
23
|
export type { CodemodErrorKind } from "./telemetry/errorKinds.js";
|
|
24
24
|
export type { GateId } from "./validationGate/index.js";
|
|
25
|
-
export { buildEgressBlockedEvent, buildFiredEvent, buildGateFailedEvent, buildGatePassedEvent, buildRejectedEvent, buildSucceededEvent, buildTimeoutEvent, estimateCostUsd, FALLBACK_EVENTS, GATE_EVENTS, gateFallbackOutput, PARSE_GATE, RUNTIME_GATE, runFallback, shouldTryFallback, UNATTRIBUTED_ORGANISATION, type AnthropicClientProvider, type AnthropicContentBlock, type AnthropicResponse, type EgressStage, type FallbackClients, type FallbackDecision, type FallbackEgressBlockedEvent, type FallbackGuardConfig, type FallbackInput, type FallbackIntent, type FallbackOp, type FallbackOutput, type FallbackTelemetry, type FallbackTelemetryEvent, type GateEventAction, type GateFallbackParams, type MorphClientProvider, type RunFallbackInput, type TelemetrySource, type TriggerReason, } from "./llmFallback/index.js";
|
|
25
|
+
export { buildEgressBlockedEvent, buildFiredEvent, buildGateFailedEvent, buildGatePassedEvent, buildRejectedEvent, buildSucceededEvent, buildTimeoutEvent, estimateCostUsd, FALLBACK_EVENTS, GATE_EVENTS, gateFallbackOutput, matchFallbackTrigger, PARSE_GATE, RUNTIME_GATE, runFallback, shouldTryFallback, UNATTRIBUTED_ORGANISATION, type AnthropicClientProvider, type AnthropicContentBlock, type AnthropicResponse, type EgressStage, type FallbackClients, type FallbackDecision, type FallbackEgressBlockedEvent, type FallbackGuardConfig, type FallbackInput, type FallbackIntent, type FallbackOp, type FallbackOutput, type FallbackTelemetry, type FallbackTelemetryEvent, type GateEventAction, type GateFallbackParams, type MorphClientProvider, type RunFallbackInput, type TelemetrySource, type TriggerReason, } from "./llmFallback/index.js";
|
|
26
26
|
export type { AddOptions, CodemodError, CodemodSuccess, ControlFlowClassifierError, DriftConflictError, DriftUnmergeableError, DuplicateResourceError, EditOrchestratorSuccess, InvalidPropertyError, LinesChanged, LlmFallbackRejectedError, LlmFallbackTimeoutError, LlmFallbackTier, LlmFallbackUnsafeInputError, MissingAppInitError, ModifyOptions, NodeLocation, ParseError, PermissionError, ReferenceLocation, ReferencesRemainError, RemoveOptions, ResourceListing, ResourceListingEntry, ResourceName, ResourceNotFoundError, SemanticQueryError, StatementType, TemplateLiteralNameError, } from "./types.js";
|
|
@@ -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};
|
|
@@ -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(`
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "14.
|
|
1
|
+
export declare const GENERATOR_VERSION = "14.3.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const E="14.
|
|
1
|
+
const E="14.3.0";export{E as GENERATOR_VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/generator",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/fjall-tech/fjall.git",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"license": "SEE LICENSE IN LICENSE",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@fjall/util": "^14.
|
|
60
|
+
"@fjall/util": "^14.3.0",
|
|
61
61
|
"ast-types": "^0.16.1",
|
|
62
62
|
"recast": "^0.23.12",
|
|
63
63
|
"ts-morph": "^28.0.0",
|