pmcf 1.65.2 → 1.66.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.65.2",
3
+ "version": "1.66.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/dns.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { join } from "node:path";
2
2
  import { createHmac } from "node:crypto";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
- import { writeLines, isIPv6Address, normalizeIPAddress } from "./utils.mjs";
4
+ import { writeLines, isIPv6Address, normalizeIPAddress, isLinkLocal } from "./utils.mjs";
5
5
  import { Base } from "./base.mjs";
6
6
  import { addType } from "./types.mjs";
7
7
 
@@ -12,6 +12,7 @@ const DNSServiceTypeDefinition = {
12
12
  properties: {
13
13
  hasSVRRecords: { type: "boolean", collection: false, writeable: true },
14
14
  hasCatalog: { type: "boolean", collection: false, writeable: true },
15
+ hasLinkLocalAdresses: { type: "boolean", collection: false, writeable: true },
15
16
  notify: { type: "boolean", collection: false, writeable: true },
16
17
  recordTTL: { type: "string", collection: false, writeable: true },
17
18
  refresh: { type: "string", collection: false, writeable: true },
@@ -30,6 +31,7 @@ export class DNSService extends Base {
30
31
  recordTTL = "1W";
31
32
  hasSVRRecords = true;
32
33
  hasCatalog = true;
34
+ hasLinkLocalAdresses = true;
33
35
  notify = true;
34
36
  #forwardsTo = [];
35
37
 
@@ -175,7 +177,7 @@ async function generateNamedDefs(dns, targetDir) {
175
177
  const zone = {
176
178
  id: domain,
177
179
  type: "plain",
178
- file: `${domain}.zone`,
180
+ file: `${dns.owner.name}/${domain}.zone`,
179
181
  records: new Set([SOARecord, NSRecord, ...records])
180
182
  };
181
183
  zones.push(zone);
@@ -183,7 +185,7 @@ async function generateNamedDefs(dns, targetDir) {
183
185
  const catalogZone = {
184
186
  id: `catalog.${domain}`,
185
187
  type: "catalog",
186
- file: `catalog.${domain}.zone`,
188
+ file: `${dns.owner.name}/catalog.${domain}.zone`,
187
189
  records: new Set([
188
190
  SOARecord,
189
191
  NSRecord,
@@ -210,7 +212,7 @@ async function generateNamedDefs(dns, targetDir) {
210
212
  } of dns.owner.networkAddresses()) {
211
213
  const host = networkInterface.host;
212
214
 
213
- if (!addresses.has(address)) {
215
+ if (!addresses.has(address) && (dns.hasLinkLocalAdresses || !isLinkLocal(address))) {
214
216
  addresses.add(address);
215
217
 
216
218
  zone.records.add(
@@ -229,7 +231,7 @@ async function generateNamedDefs(dns, targetDir) {
229
231
  reverseZone = {
230
232
  id: reverseArpa,
231
233
  type: "plain",
232
- file: `${reverseArpa}.zone`,
234
+ file: `${dns.owner.name}/${reverseArpa}.zone`,
233
235
  records: new Set([SOARecord, NSRecord])
234
236
  };
235
237
  zones.push(reverseZone);
package/src/utils.mjs CHANGED
@@ -1,7 +1,11 @@
1
1
  import { writeFile, mkdir } from "node:fs/promises";
2
- import { join } from "node:path";
2
+ import { join, dirname, basename } from "node:path";
3
3
 
4
4
  export async function writeLines(dir, name, lines) {
5
+ const full = join(dir, name);
6
+ dir = dirname(full);
7
+ name = basename(full);
8
+
5
9
  await mkdir(dir, { recursive: true });
6
10
  if (typeof lines === "string") lines = [lines];
7
11
  return writeFile(
@@ -33,11 +37,12 @@ export function asArray(value) {
33
37
  return Array.isArray(value) ? value : value === undefined ? [] : [value];
34
38
  }
35
39
 
36
- export function asIterator(value)
37
- {
38
- if(value === undefined) { return []; }
40
+ export function asIterator(value) {
41
+ if (value === undefined) {
42
+ return [];
43
+ }
39
44
 
40
- if(typeof value[Symbol.iterator] === 'function') {
45
+ if (typeof value[Symbol.iterator] === "function") {
41
46
  return value;
42
47
  }
43
48
 
@@ -182,5 +187,5 @@ export function hasWellKnownSubnet(address) {
182
187
 
183
188
  export const IPV4_LOCALHOST = _encode(ipv4, "127.0.0.1");
184
189
  export const IPV6_LOCALHOST = _encode(ipv6, "::1");
185
- export const IPV6_LINK_LOCAL_BROADCAST = _encode(ipv6,"ff02::1");
186
- export const IPV6_ROUTER_BROADCAST = _encode(ipv6,"ff02::2");
190
+ export const IPV6_LINK_LOCAL_BROADCAST = _encode(ipv6, "ff02::1");
191
+ export const IPV6_ROUTER_BROADCAST = _encode(ipv6, "ff02::2");
@@ -102,6 +102,11 @@ export class Cluster extends Host {
102
102
  collection: boolean;
103
103
  writeable: boolean;
104
104
  };
105
+ hasLinkLocalAdresses: {
106
+ type: string;
107
+ collection: boolean;
108
+ writeable: boolean;
109
+ };
105
110
  notify: {
106
111
  type: string;
107
112
  collection: boolean;
@@ -281,6 +286,11 @@ export class Cluster extends Host {
281
286
  collection: boolean;
282
287
  writeable: boolean;
283
288
  };
289
+ hasLinkLocalAdresses: {
290
+ type: string;
291
+ collection: boolean;
292
+ writeable: boolean;
293
+ };
284
294
  notify: {
285
295
  type: string;
286
296
  collection: boolean;
package/types/dns.d.mts CHANGED
@@ -16,6 +16,11 @@ export class DNSService extends Base {
16
16
  collection: boolean;
17
17
  writeable: boolean;
18
18
  };
19
+ hasLinkLocalAdresses: {
20
+ type: string;
21
+ collection: boolean;
22
+ writeable: boolean;
23
+ };
19
24
  notify: {
20
25
  type: string;
21
26
  collection: boolean;
@@ -62,6 +67,7 @@ export class DNSService extends Base {
62
67
  recordTTL: string;
63
68
  hasSVRRecords: boolean;
64
69
  hasCatalog: boolean;
70
+ hasLinkLocalAdresses: boolean;
65
71
  notify: boolean;
66
72
  refresh: number;
67
73
  retry: number;
@@ -102,6 +102,11 @@ export class Location extends Owner {
102
102
  collection: boolean;
103
103
  writeable: boolean;
104
104
  };
105
+ hasLinkLocalAdresses: {
106
+ type: string;
107
+ collection: boolean;
108
+ writeable: boolean;
109
+ };
105
110
  notify: {
106
111
  type: string;
107
112
  collection: boolean;
@@ -281,6 +286,11 @@ export class Location extends Owner {
281
286
  collection: boolean;
282
287
  writeable: boolean;
283
288
  };
289
+ hasLinkLocalAdresses: {
290
+ type: string;
291
+ collection: boolean;
292
+ writeable: boolean;
293
+ };
284
294
  notify: {
285
295
  type: string;
286
296
  collection: boolean;
@@ -104,6 +104,11 @@ export class Network extends Owner {
104
104
  collection: boolean;
105
105
  writeable: boolean;
106
106
  };
107
+ hasLinkLocalAdresses: {
108
+ type: string;
109
+ collection: boolean;
110
+ writeable: boolean;
111
+ };
107
112
  notify: {
108
113
  type: string;
109
114
  collection: boolean;
package/types/owner.d.mts CHANGED
@@ -100,6 +100,11 @@ export class Owner extends Base {
100
100
  collection: boolean;
101
101
  writeable: boolean;
102
102
  };
103
+ hasLinkLocalAdresses: {
104
+ type: string;
105
+ collection: boolean;
106
+ writeable: boolean;
107
+ };
103
108
  notify: {
104
109
  type: string;
105
110
  collection: boolean;
package/types/root.d.mts CHANGED
@@ -106,6 +106,11 @@ export class Root extends Location {
106
106
  collection: boolean;
107
107
  writeable: boolean;
108
108
  };
109
+ hasLinkLocalAdresses: {
110
+ type: string;
111
+ collection: boolean;
112
+ writeable: boolean;
113
+ };
109
114
  notify: {
110
115
  type: string;
111
116
  collection: boolean;
@@ -285,6 +290,11 @@ export class Root extends Location {
285
290
  collection: boolean;
286
291
  writeable: boolean;
287
292
  };
293
+ hasLinkLocalAdresses: {
294
+ type: string;
295
+ collection: boolean;
296
+ writeable: boolean;
297
+ };
288
298
  notify: {
289
299
  type: string;
290
300
  collection: boolean;