pmcf 1.80.1 → 1.81.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.80.1",
3
+ "version": "1.81.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/host.mjs CHANGED
@@ -13,7 +13,8 @@ import {
13
13
  normalizeIPAddress,
14
14
  formatCIDR,
15
15
  hasWellKnownSubnet,
16
- domainFromDominName
16
+ domainFromDominName,
17
+ domainName
17
18
  } from "./utils.mjs";
18
19
  import { objectFilter } from "./filter.mjs";
19
20
  import { addType, types } from "./types.mjs";
@@ -260,13 +261,13 @@ export class Host extends Base {
260
261
  }
261
262
 
262
263
  get domainNames() {
263
- return [this.domainName, ...this.aliases];
264
+ return [this.hostName, ...this.aliases].map(n =>
265
+ domainName(n, this.domain)
266
+ );
264
267
  }
265
268
 
266
269
  get domainName() {
267
- const domain = this.domain;
268
- const hostName = this.hostName;
269
- return domain ? hostName + "." + domain : hostName;
270
+ return domainName(this.hostName, this.domain);
270
271
  }
271
272
 
272
273
  domainNameIn(domain) {
package/src/owner.mjs CHANGED
@@ -382,7 +382,6 @@ export class Owner extends Base {
382
382
  return this.#domain || this.owner?.domain;
383
383
  }
384
384
 
385
-
386
385
  get domains() {
387
386
  let domains = new Set();
388
387
 
@@ -408,4 +407,14 @@ export class Owner extends Base {
408
407
  return domains;
409
408
  }
410
409
  */
410
+
411
+ get domainNames() {
412
+ let names = new Set();
413
+
414
+ for (const host of this.hosts()) {
415
+ names = names.union(new Set(host.domainNames));
416
+ }
417
+
418
+ return names;
419
+ }
411
420
  }
package/src/utils.mjs CHANGED
@@ -1,6 +1,13 @@
1
1
  import { writeFile, mkdir } from "node:fs/promises";
2
2
  import { join, dirname, basename } from "node:path";
3
3
 
4
+ export function domainName(name, defaultDomain) {
5
+ const dcs = name.split(".");
6
+ return defaultDomain === undefined || dcs.length > 1
7
+ ? name
8
+ : [name, defaultDomain].join(".");
9
+ }
10
+
4
11
  export function domainFromDominName(domainName, defaultDomain) {
5
12
  const dcs = domainName.split(".");
6
13
 
package/types/host.d.mts CHANGED
@@ -187,7 +187,7 @@ export class Host extends Base {
187
187
  get hostName(): string;
188
188
  get domains(): Set<any>;
189
189
  get domainNames(): any[];
190
- get domainName(): string;
190
+ get domainName(): any;
191
191
  domainNameIn(domain: any): any;
192
192
  get host(): this;
193
193
  named(name: any): any;
package/types/owner.d.mts CHANGED
@@ -237,6 +237,7 @@ export class Owner extends Base {
237
237
  get domain(): any;
238
238
  get domains(): Set<any>;
239
239
  get localDomains(): Set<any>;
240
+ get domainNames(): Set<any>;
240
241
  #private;
241
242
  }
242
243
  import { Base } from "./base.mjs";
package/types/utils.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ export function domainName(name: any, defaultDomain: any): any;
1
2
  export function domainFromDominName(domainName: any, defaultDomain: any): any;
2
3
  export function writeLines(dir: any, name: any, lines: any): Promise<void>;
3
4
  export function sectionLines(sectionName: any, values: any): string[];