pmcf 1.79.11 → 1.80.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.79.11",
3
+ "version": "1.80.0",
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
@@ -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,13 @@ async function generateZoneDefs(dns, targetDir) {
194
197
 
195
198
  let maxKeyLength;
196
199
 
197
- for (const mail of dns.owner.findServices({ type: "smtp" })) {
200
+ for (const mail of dns.owner.findServices({ type: "smtp", priority: "<10" })) {
198
201
  records.add(
199
202
  DNSRecord("@", "MX", mail.priority, dnsFullName(mail.domainName))
200
203
  );
201
204
  }
202
205
 
203
- console.log(`${nameService}`, nameService.ipAddressOrDomainName);
206
+ console.log(`${nameService} ${domain}`, nameService.ipAddressOrDomainName);
204
207
  //console.log(dns.owner.fullName, domain, nameService.domainName, rname);
205
208
  const reverseZones = new Map();
206
209
 
@@ -218,26 +221,18 @@ async function generateZoneDefs(dns, targetDir) {
218
221
  dnsFullName(nameService.ipAddressOrDomainName)
219
222
  );
220
223
 
221
- const ALPNRecord = DNSRecord(
222
- "@",
223
- "HTTPS",
224
- 1,
225
- ".",
226
- dnsFormatParameters({ alpn: "h3" })
227
- );
228
-
229
224
  const zone = {
230
225
  id: domain,
231
226
  type: "plain",
232
- file: `${dns.owner.name}/${domain}.zone`,
233
- records: new Set([SOARecord, NSRecord, ALPNRecord, ...records])
227
+ file: `${ownerName}/${domain}.zone`,
228
+ records: new Set([SOARecord, NSRecord, ...records])
234
229
  };
235
230
  zones.push(zone);
236
231
 
237
232
  const catalogZone = {
238
233
  id: `catalog.${domain}`,
239
234
  type: "catalog",
240
- file: `${dns.owner.name}/catalog.${domain}.zone`,
235
+ file: `${ownerName}/catalog.${domain}.zone`,
241
236
  records: new Set([
242
237
  SOARecord,
243
238
  NSRecord,
@@ -249,7 +244,7 @@ async function generateZoneDefs(dns, targetDir) {
249
244
  plain: { name: `${domain}.zone.conf`, content: [] }
250
245
  };
251
246
 
252
- if (dns.hasCatalog) {
247
+ if (isLocalDomain && dns.hasCatalog) {
253
248
  zones.push(catalogZone);
254
249
  configs.catalog = { name: `catalog.${domain}.zone.conf`, content: [] };
255
250
  }
@@ -287,7 +282,7 @@ async function generateZoneDefs(dns, targetDir) {
287
282
  reverseZone = {
288
283
  id: reverseArpa,
289
284
  type: "plain",
290
- file: `${dns.owner.name}/${reverseArpa}.zone`,
285
+ file: `${ownerName}/${reverseArpa}.zone`,
291
286
  records: new Set([SOARecord, NSRecord])
292
287
  };
293
288
  zones.push(reverseZone);
@@ -306,7 +301,7 @@ async function generateZoneDefs(dns, targetDir) {
306
301
  }
307
302
  }
308
303
 
309
- if (!hosts.has(host)) {
304
+ if (isLocalDomain && !hosts.has(host)) {
310
305
  hosts.add(host);
311
306
  for (const service of host.findServices()) {
312
307
  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;