@fjall/generator 12.3.0 → 13.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.
@@ -9,7 +9,7 @@
9
9
  "package.json",
10
10
  "tsconfig.json"
11
11
  ],
12
- "hash": "70d7052bae6f8d76638dc53a083ec0ad54264f9c933a32bf28b85e86c2b58eb6",
12
+ "hash": "01767ed41d0bbbeaf1222a5e5af3e7e128649e8650dd528c9666736d3a53d2d1",
13
13
  "files": {
14
14
  "src/ast/astTestHelpers.ts": "026cac849eb88bdb",
15
15
  "src/ast/domain/astDomainParser.ts": "940ce5742507477d",
@@ -112,8 +112,8 @@
112
112
  "src/dns/bindWriter.ts": "c296911ce5aef77c",
113
113
  "src/dns/domainFileGenerator.ts": "179258ce9d15d990",
114
114
  "src/dns/domainRecords.ts": "ab917006b92ae916",
115
- "src/dns/index.ts": "c6d17b06c04a0903",
116
- "src/dns/tsEmitter.ts": "d5814cd65ba1a05e",
115
+ "src/dns/index.ts": "266288ae3b851e3d",
116
+ "src/dns/tsEmitter.ts": "2f2f13061d1850db",
117
117
  "src/dns/types.ts": "82d6db9d7d26dbc2",
118
118
  "src/generation/common.ts": "ab66eac580bc227f",
119
119
  "src/generation/compute.ts": "4029a0d8e3197686",
@@ -171,11 +171,11 @@
171
171
  "src/validation/patterns.ts": "f9629eafdad7ac3e",
172
172
  "src/validation/validationMessages.ts": "c727ade4690274f4",
173
173
  "src/validation/validationPatterns.ts": "865f3d688975b7c8",
174
- "src/version.ts": "3a2b6b85d28d1013",
174
+ "src/version.ts": "d048161459b09699",
175
175
  "../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
176
- "package.json": "c615cc7b37876c27",
176
+ "package.json": "4e7eac00c363f215",
177
177
  "tsconfig.json": "1929cf3f99fe9b1e"
178
178
  },
179
- "outputHash": "f4bdba589f6bd59b4d0751e5b2443cc69c006510f8e06b4f23d6e66650d54ab6",
179
+ "outputHash": "6623ab104d0d719053c6f07143a1641e45a0c7bdac7131029a5d528b0b692b45",
180
180
  "outputFileCount": 323
181
181
  }
package/dist/.minified CHANGED
@@ -1 +1 @@
1
- 161 files minified at 2026-08-16T01:19:39.773Z
1
+ 161 files minified at 2026-08-16T02:45:02.211Z
@@ -3,4 +3,4 @@ export * from "./domainRecords.js";
3
3
  export { parseZoneFile, resolveAlias } from "./bindParser.js";
4
4
  export { generateZoneFile } from "./bindWriter.js";
5
5
  export { type GeneratedFile, type DomainGenerationOptions, generateDomainFiles, } from "./domainFileGenerator.js";
6
- export { type EmitDomainTsOptions, emitDomainTs } from "./tsEmitter.js";
6
+ export { type EmitDomainTsOptions, emitDomainTs, emitRecordObjectText, } from "./tsEmitter.js";
@@ -1 +1 @@
1
- export*from"./types.js";export*from"./domainRecords.js";import{parseZoneFile as t,resolveAlias as i}from"./bindParser.js";import{generateZoneFile as a}from"./bindWriter.js";import{generateDomainFiles as n}from"./domainFileGenerator.js";import{emitDomainTs as l}from"./tsEmitter.js";export{l as emitDomainTs,n as generateDomainFiles,a as generateZoneFile,t as parseZoneFile,i as resolveAlias};
1
+ export*from"./types.js";export*from"./domainRecords.js";import{parseZoneFile as m,resolveAlias as i}from"./bindParser.js";import{generateZoneFile as x}from"./bindWriter.js";import{generateDomainFiles as f}from"./domainFileGenerator.js";import{emitDomainTs as l,emitRecordObjectText as s}from"./tsEmitter.js";export{l as emitDomainTs,s as emitRecordObjectText,f as generateDomainFiles,x as generateZoneFile,m as parseZoneFile,i as resolveAlias};
@@ -4,7 +4,14 @@
4
4
  * through (domains completion programme, train B0). Pure string-in/string-out:
5
5
  * no I/O, no CLI coupling.
6
6
  */
7
- import type { ParsedDomainRecords } from "./domainRecords.js";
7
+ import type { ParsedDomainRecords, ParsedDnsRecord } from "./domainRecords.js";
8
+ /**
9
+ * Bare record object literal — no file indent, no trailing comma. Published
10
+ * so the webapp's record-splice edit engine renders spliced records through
11
+ * the same emitter as generated files (train B) instead of restating the
12
+ * byte shape; `emitRecord` wraps it with the records-array indentation.
13
+ */
14
+ export declare function emitRecordObjectText(r: ParsedDnsRecord): string;
8
15
  export interface EmitDomainTsOptions {
9
16
  /**
10
17
  * Domain component name the emitted file is ADDRESSED by (D2 contract:
@@ -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"],C=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 J(e,n){const t=Array.isArray(e)?e.join(`
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"],b=new Map(O.map((e,n)=>[e,n]));function C(e,n){return e==="@"&&n!=="@"?-1:e!=="@"&&n==="@"?1:e.localeCompare(n)}o(C,"compareName");function J(e,n){const t=Array.isArray(e)?e.join(`
2
2
  `):e,a=Array.isArray(n)?n.join(`
3
- `):n;return t.localeCompare(a)}o(J,"compareValue");function p(e){const n=e.kind==="standard"?0:1,t=C.get(e.type)??99;return[n,t,e.name]}o(p,"recordSortKey");function R(e){return[...e].sort((n,t)=>{const[a,c,m]=p(n),[s,d,f]=p(t);if(a!==s)return a-s;if(c!==d)return c-d;const u=b(m,f);return u!==0?u:n.kind==="standard"&&t.kind==="standard"?J(n.value,t.value):0})}o(R,"sortRecords");function P(e){return Array.isArray(e)?`[${e.map(t=>JSON.stringify(t)).join(", ")}]`:JSON.stringify(e)}o(P,"formatValue");function v(e){const n=[`type: ${JSON.stringify(e.type)}`,`name: ${JSON.stringify(e.name)}`,`value: ${P(e.value)}`];return e.ttl!==void 0&&n.push(`ttl: ${e.ttl}`),` { ${n.join(", ")} },`}o(v,"emitStandardRecord");function I(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(I,"emitAliasTarget");function T(e){return` { ${[`type: ${JSON.stringify(e.type)}`,`name: ${JSON.stringify(e.name)}`,`target: ${I(e.target)}`].join(", ")} },`}o(T,"emitAliasRecord");function w(e){return e.kind==="standard"?v(e):T(e)}o(w,"emitRecord");function x(e){const n=[`domainName: ${JSON.stringify(e.domainName)}`];if(e.subjectAlternativeNames&&e.subjectAlternativeNames.length>0){const t=e.subjectAlternativeNames.map(a=>JSON.stringify(a)).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(x,"emitCertificate");function z(e,n){if(n.length===0)return"";const t=["","// Delegations (D8 \u2014 child writes NS; no parent-side records here):"];for(const a of n)t.push(`// ${a.subdomain}.${e} \u2192 deploy a Domain { registrar: "external-delegated",`,`// zoneName: ${JSON.stringify(e)}, delegatedSubdomain: ${JSON.stringify(a.subdomain)} }`,`// in account ${JSON.stringify(a.toAccount)}; the CLI injects parentDelegationRoleArn`,"// (ManagedDomainBinding.delegationRoleArn) and the child UPSERTs its NS into this zone.");return t.join(`
3
+ `):n;return t.localeCompare(a)}o(J,"compareValue");function p(e){const n=e.kind==="standard"?0:1,t=b.get(e.type)??99;return[n,t,e.name]}o(p,"recordSortKey");function R(e){return[...e].sort((n,t)=>{const[a,c,m]=p(n),[s,d,f]=p(t);if(a!==s)return a-s;if(c!==d)return c-d;const u=C(m,f);return u!==0?u:n.kind==="standard"&&t.kind==="standard"?J(n.value,t.value):0})}o(R,"sortRecords");function P(e){return Array.isArray(e)?`[${e.map(t=>JSON.stringify(t)).join(", ")}]`:JSON.stringify(e)}o(P,"formatValue");function v(e){const n=[`type: ${JSON.stringify(e.type)}`,`name: ${JSON.stringify(e.name)}`,`value: ${P(e.value)}`];return e.ttl!==void 0&&n.push(`ttl: ${e.ttl}`),`{ ${n.join(", ")} }`}o(v,"emitStandardRecord");function I(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(I,"emitAliasTarget");function x(e){return`{ ${[`type: ${JSON.stringify(e.type)}`,`name: ${JSON.stringify(e.name)}`,`target: ${I(e.target)}`].join(", ")} }`}o(x,"emitAliasRecord");function T(e){return e.kind==="standard"?v(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(a=>JSON.stringify(a)).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 a of n)t.push(`// ${a.subdomain}.${e} \u2192 deploy a Domain { registrar: "external-delegated",`,`// zoneName: ${JSON.stringify(e)}, delegatedSubdomain: ${JSON.stringify(a.subdomain)} }`,`// in account ${JSON.stringify(a.toAccount)}; the CLI injects parentDelegationRoleArn`,"// (ManagedDomainBinding.delegationRoleArn) and the child UPSERTs its NS into this zone.");return t.join(`
4
4
  `)+`
5
- `}o(z,"emitDelegationGuidance");function B(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(B,"computeUsedHelpers");function F(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 {
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
6
  ${n.map(a=>` ${a},`).join(`
7
7
  `)}
8
- } from "@fjall/components-infrastructure";`}o(F,"emitImports");function L(e){return D(e.split(".").join(""))}o(L,"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 E(e){return e.registrar==="external-delegated"&&e.delegatedSubdomain?`${e.delegatedSubdomain}.${e.zoneName}`:e.zoneName}o(E,"effectiveZoneName");function y(e,n,t){if(n.length===0)return` ${e}: [],`;const a=n.map(t).join(`
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 a=n.map(t).join(`
9
9
  `);return` ${e}: [
10
10
  ${a}
11
- ],`}o(y,"emitBlock");function M(e,n={}){const t=k(n.componentName??e.zoneName),a=L(e.zoneName),c=B(e.records),m=F(c),s=E(e),d=e.records.map(i=>i.kind==="standard"?{...i,name:g(i.name,s)}:{...i,name:g(i.name,s)}),f=R(d),u=[...e.certificates].sort((i,l)=>i.domainName.localeCompare(l.domainName)),h=[...e.delegations].sort((i,l)=>i.subdomain.localeCompare(l.subdomain)),r=[];if(e.hostedZoneId&&r.push(` hostedZoneId: ${JSON.stringify(e.hostedZoneId)},`),e.adoptedNameServers&&e.adoptedNameServers.length>0){const i=e.adoptedNameServers.map(l=>JSON.stringify(l)).join(", ");r.push(` adoptedNameServers: [${i}],`)}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,x),S=y("records",f,w),$=e.registrar==="external-records"?"":z(e.zoneName,h),j=e.registrar==="external-delegated"?`
11
+ ],`}o(y,"emitBlock");function K(e,n={}){const t=k(n.componentName??e.zoneName),a=E(e.zoneName),c=F(e.records),m=L(c),s=Z(e),d=e.records.map(i=>i.kind==="standard"?{...i,name:g(i.name,s)}:{...i,name:g(i.name,s)}),f=R(d),u=[...e.certificates].sort((i,l)=>i.domainName.localeCompare(l.domainName)),h=[...e.delegations].sort((i,l)=>i.subdomain.localeCompare(l.subdomain)),r=[];if(e.hostedZoneId&&r.push(` hostedZoneId: ${JSON.stringify(e.hostedZoneId)},`),e.adoptedNameServers&&e.adoptedNameServers.length>0){const i=e.adoptedNameServers.map(l=>JSON.stringify(l)).join(", ");r.push(` adoptedNameServers: [${i}],`)}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",f,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"
@@ -43,4 +43,4 @@ ${r.length>0?r.join(`
43
43
  `:""}${N}
44
44
  ${S}
45
45
  });
46
- ${$}`}o(M,"emitDomainTs");export{M as emitDomainTs};
46
+ ${$}`}o(K,"emitDomainTs");export{K as emitDomainTs,T as emitRecordObjectText};
@@ -1 +1 @@
1
- export declare const GENERATOR_VERSION = "12.3.0";
1
+ export declare const GENERATOR_VERSION = "13.0.0";
@@ -1 +1 @@
1
- const E="12.3.0";export{E as GENERATOR_VERSION};
1
+ const E="13.0.0";export{E as GENERATOR_VERSION};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/generator",
3
- "version": "12.3.0",
3
+ "version": "13.0.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": "^12.3.0",
60
+ "@fjall/util": "^13.0.0",
61
61
  "ast-types": "^0.16.1",
62
62
  "recast": "^0.23.12",
63
63
  "ts-morph": "^28.0.0",