pmcf 1.79.11 → 1.80.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.79.11",
3
+ "version": "1.80.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -278,6 +278,10 @@ export class Base {
278
278
  return this.owner?.domains || new Set();
279
279
  }
280
280
 
281
+ get localDomains() {
282
+ return this.owner?.localDomains || new Set();
283
+ }
284
+
281
285
  get administratorEmail() {
282
286
  return this.owner?.administratorEmail;
283
287
  }
package/src/dns.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  normalizeIPAddress,
8
8
  isLinkLocal
9
9
  } from "./utils.mjs";
10
- import { DNSRecord, dnsFullName, dnsFormatParameters } from "./dns-utils.mjs";
10
+ import { DNSRecord, dnsFullName } from "./dns-utils.mjs";
11
11
  import { Base } from "./base.mjs";
12
12
  import { addType } from "./types.mjs";
13
13
  import { serviceAddresses } from "./service.mjs";
@@ -186,6 +186,9 @@ async function generateZoneDefs(dns, targetDir) {
186
186
  const updates = [Math.ceil(Date.now() / 1000), ...dns.soaUpdates].join(" ");
187
187
 
188
188
  for (const domain of dns.domains) {
189
+ const isLocalDomain = dns.localDomains.has(domain);
190
+
191
+ const ownerName = isLocalDomain ? dns.owner.name : "FOREIGN";
189
192
  const zones = [];
190
193
  const records = new Set();
191
194
 
@@ -194,13 +197,18 @@ async function generateZoneDefs(dns, targetDir) {
194
197
 
195
198
  let maxKeyLength;
196
199
 
197
- for (const mail of dns.owner.findServices({ type: "smtp" })) {
198
- records.add(
199
- DNSRecord("@", "MX", mail.priority, dnsFullName(mail.domainName))
200
- );
200
+ if (isLocalDomain) {
201
+ for (const mail of dns.owner.findServices({
202
+ type: "smtp",
203
+ priority: "<10"
204
+ })) {
205
+ records.add(
206
+ DNSRecord("@", "MX", mail.priority, dnsFullName(mail.domainName))
207
+ );
208
+ }
201
209
  }
202
210
 
203
- console.log(`${nameService}`, nameService.ipAddressOrDomainName);
211
+ console.log(`${nameService} ${domain}`, nameService.ipAddressOrDomainName);
204
212
  //console.log(dns.owner.fullName, domain, nameService.domainName, rname);
205
213
  const reverseZones = new Map();
206
214
 
@@ -218,26 +226,18 @@ async function generateZoneDefs(dns, targetDir) {
218
226
  dnsFullName(nameService.ipAddressOrDomainName)
219
227
  );
220
228
 
221
- const ALPNRecord = DNSRecord(
222
- "@",
223
- "HTTPS",
224
- 1,
225
- ".",
226
- dnsFormatParameters({ alpn: "h3" })
227
- );
228
-
229
229
  const zone = {
230
230
  id: domain,
231
231
  type: "plain",
232
- file: `${dns.owner.name}/${domain}.zone`,
233
- records: new Set([SOARecord, NSRecord, ALPNRecord, ...records])
232
+ file: `${ownerName}/${domain}.zone`,
233
+ records: new Set([SOARecord, NSRecord, ...records])
234
234
  };
235
235
  zones.push(zone);
236
236
 
237
237
  const catalogZone = {
238
238
  id: `catalog.${domain}`,
239
239
  type: "catalog",
240
- file: `${dns.owner.name}/catalog.${domain}.zone`,
240
+ file: `${ownerName}/catalog.${domain}.zone`,
241
241
  records: new Set([
242
242
  SOARecord,
243
243
  NSRecord,
@@ -249,7 +249,7 @@ async function generateZoneDefs(dns, targetDir) {
249
249
  plain: { name: `${domain}.zone.conf`, content: [] }
250
250
  };
251
251
 
252
- if (dns.hasCatalog) {
252
+ if (isLocalDomain && dns.hasCatalog) {
253
253
  zones.push(catalogZone);
254
254
  configs.catalog = { name: `catalog.${domain}.zone.conf`, content: [] };
255
255
  }
@@ -287,7 +287,7 @@ async function generateZoneDefs(dns, targetDir) {
287
287
  reverseZone = {
288
288
  id: reverseArpa,
289
289
  type: "plain",
290
- file: `${dns.owner.name}/${reverseArpa}.zone`,
290
+ file: `${ownerName}/${reverseArpa}.zone`,
291
291
  records: new Set([SOARecord, NSRecord])
292
292
  };
293
293
  zones.push(reverseZone);
@@ -306,7 +306,7 @@ async function generateZoneDefs(dns, targetDir) {
306
306
  }
307
307
  }
308
308
 
309
- if (!hosts.has(host)) {
309
+ if (isLocalDomain && !hosts.has(host)) {
310
310
  hosts.add(host);
311
311
  for (const service of host.findServices()) {
312
312
  for (const record of service.dnsRecordsForDomainName(
package/src/host.mjs CHANGED
@@ -254,14 +254,9 @@ export class Host extends Base {
254
254
  }
255
255
 
256
256
  get domains() {
257
- const domains = new Set(
257
+ return new Set(
258
258
  [...this.aliases].map(n => domainFromDominName(n, this.domain))
259
- );
260
-
261
- if(this.domain) {
262
- domains.add(this.domain);
263
- }
264
- return domains;
259
+ ).union(this.localDomains);
265
260
  }
266
261
 
267
262
  get domainNames() {
package/src/owner.mjs CHANGED
@@ -28,6 +28,7 @@ const OwnerTypeDefinition = {
28
28
 
29
29
  country: { type: "string", collection: false, writeable: true },
30
30
  domain: { type: "string", collection: false, writeable: true },
31
+ domains: { type: "string", collection: true, writeable: true },
31
32
  timezone: { type: "string", collection: false, writeable: true },
32
33
  locales: { type: "string", collection: true, writeable: true },
33
34
  administratorEmail: { type: "string", collection: false, writeable: true }
@@ -381,6 +382,7 @@ export class Owner extends Base {
381
382
  return this.#domain || this.owner?.domain;
382
383
  }
383
384
 
385
+
384
386
  get domains() {
385
387
  let domains = new Set();
386
388
 
@@ -390,4 +392,20 @@ export class Owner extends Base {
390
392
 
391
393
  return domains;
392
394
  }
395
+
396
+ get localDomains() {
397
+ return this.domain ? new Set([this.domain]) : new Set();
398
+ }
399
+
400
+ /*
401
+ get localDomains() {
402
+ let domains = new Set();
403
+
404
+ for (const object of this.hosts()) {
405
+ domains = domains.union(object.localDomains);
406
+ }
407
+
408
+ return domains;
409
+ }
410
+ */
393
411
  }
package/types/base.d.mts CHANGED
@@ -59,6 +59,7 @@ export class Base {
59
59
  get network(): any;
60
60
  get domain(): any;
61
61
  get domains(): any;
62
+ get localDomains(): any;
62
63
  get administratorEmail(): any;
63
64
  get locales(): any;
64
65
  get country(): any;
@@ -183,6 +183,11 @@ export class Cluster extends Host {
183
183
  collection: boolean;
184
184
  writeable: boolean;
185
185
  };
186
+ domains: {
187
+ type: string;
188
+ collection: boolean;
189
+ writeable: boolean;
190
+ };
186
191
  timezone: {
187
192
  type: string;
188
193
  collection: boolean;
@@ -183,6 +183,11 @@ export class Location extends Owner {
183
183
  collection: boolean;
184
184
  writeable: boolean;
185
185
  };
186
+ domains: {
187
+ type: string;
188
+ collection: boolean;
189
+ writeable: boolean;
190
+ };
186
191
  timezone: {
187
192
  type: string;
188
193
  collection: boolean;
@@ -383,6 +388,11 @@ export class Location extends Owner {
383
388
  collection: boolean;
384
389
  writeable: boolean;
385
390
  };
391
+ domains: {
392
+ type: string;
393
+ collection: boolean;
394
+ writeable: boolean;
395
+ };
386
396
  timezone: {
387
397
  type: string;
388
398
  collection: boolean;
@@ -185,6 +185,11 @@ export class Network extends Owner {
185
185
  collection: boolean;
186
186
  writeable: boolean;
187
187
  };
188
+ domains: {
189
+ type: string;
190
+ collection: boolean;
191
+ writeable: boolean;
192
+ };
188
193
  timezone: {
189
194
  type: string;
190
195
  collection: boolean;
package/types/owner.d.mts CHANGED
@@ -181,6 +181,11 @@ export class Owner extends Base {
181
181
  collection: boolean;
182
182
  writeable: boolean;
183
183
  };
184
+ domains: {
185
+ type: string;
186
+ collection: boolean;
187
+ writeable: boolean;
188
+ };
184
189
  timezone: {
185
190
  type: string;
186
191
  collection: boolean;
@@ -231,6 +236,7 @@ export class Owner extends Base {
231
236
  set domain(value: any);
232
237
  get domain(): any;
233
238
  get domains(): Set<any>;
239
+ get localDomains(): Set<any>;
234
240
  #private;
235
241
  }
236
242
  import { Base } from "./base.mjs";
package/types/root.d.mts CHANGED
@@ -187,6 +187,11 @@ export class Root extends Location {
187
187
  collection: boolean;
188
188
  writeable: boolean;
189
189
  };
190
+ domains: {
191
+ type: string;
192
+ collection: boolean;
193
+ writeable: boolean;
194
+ };
190
195
  timezone: {
191
196
  type: string;
192
197
  collection: boolean;
@@ -387,6 +392,11 @@ export class Root extends Location {
387
392
  collection: boolean;
388
393
  writeable: boolean;
389
394
  };
395
+ domains: {
396
+ type: string;
397
+ collection: boolean;
398
+ writeable: boolean;
399
+ };
390
400
  timezone: {
391
401
  type: string;
392
402
  collection: boolean;