pmcf 2.57.0 → 2.58.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/bin/pmcf-package CHANGED
@@ -33,6 +33,7 @@ const publishingDetails = createPublishingDetails(
33
33
  for (const object of root.find(args)) {
34
34
  const stagingDir = join(options.output, object.fullName);
35
35
 
36
+ //console.log(`packages for ${object.fullName}`);
36
37
  for await (const { sources, outputs, properties } of object.preparePackages(
37
38
  stagingDir
38
39
  )) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.57.0",
3
+ "version": "2.58.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -111,11 +111,10 @@ export class Base {
111
111
  if (Array.isArray(current)) {
112
112
  current.push(value);
113
113
  } else {
114
- if(current instanceof Set) {
114
+ if (current instanceof Set) {
115
115
  // TODO
116
116
  this[property.name] = value;
117
- }
118
- else if (current instanceof Map) {
117
+ } else if (current instanceof Map) {
119
118
  // TODO
120
119
  this[property.name] = value;
121
120
  } else {
@@ -427,16 +426,7 @@ export class Base {
427
426
  return new Set(allOutputs.filter(o => this.packaging.has(o.name)));
428
427
  }
429
428
 
430
- async *preparePackages(stagingDir) {
431
- yield {
432
- sources: [],
433
- outputs: this.outputs,
434
- properties: {
435
- description: `${this.typeName} definitions for ${this.fullName}`,
436
- access: "private"
437
- }
438
- };
439
- }
429
+ async *preparePackages(stagingDir) {}
440
430
 
441
431
  get tags() {
442
432
  return this._tags;
package/src/cluster.mjs CHANGED
@@ -118,7 +118,7 @@ export class Cluster extends Host {
118
118
  cfg.push(" }");
119
119
  cfg.push(` virtual_router_id ${cluster.routerId}`);
120
120
  cfg.push(
121
- ` priority ${host.priority - (cluster.masters.has(ni) ? 0 : 5)}`
121
+ ` priority ${host.priority - 100 + (cluster.masters.has(ni) ? 0 : 5)}`
122
122
  );
123
123
  cfg.push(" smtp_alert");
124
124
  cfg.push(" advert_int 5");
package/src/dns-utils.mjs CHANGED
@@ -23,13 +23,17 @@ export function sortZoneRecords(a, b) {
23
23
  if (a.type === "PTR") {
24
24
  const toNum = a => {
25
25
  const s = a.split(".");
26
- s.pop();s.pop();s.pop();
27
- return s.reverse().reduce((a, c) => BigInt(parseInt(c,16)) + 256n * 256n * a, 0n);
26
+ s.pop();
27
+ s.pop();
28
+ s.pop();
29
+ return s
30
+ .reverse()
31
+ .reduce((a, c) => BigInt(parseInt(c, 16)) + 256n * 256n * a, 0n);
28
32
  };
29
33
  return Number(toNum(a.key) - toNum(b.key));
30
34
  }
31
35
  order = a.key.localeCompare(b.key);
32
- if(order) {
36
+ if (order) {
33
37
  return order;
34
38
  }
35
39
 
@@ -100,3 +104,7 @@ export function dnsMergeParameters(a, b) {
100
104
  ])
101
105
  );
102
106
  }
107
+
108
+ export function dnsPriority(priority) {
109
+ return 500 - (priority ?? 10);
110
+ }
package/src/service.mjs CHANGED
@@ -6,7 +6,8 @@ import {
6
6
  DNSRecord,
7
7
  dnsFullName,
8
8
  dnsFormatParameters,
9
- dnsMergeParameters
9
+ dnsMergeParameters,
10
+ dnsPriority
10
11
  } from "./dns-utils.mjs";
11
12
 
12
13
  const ServiceTypes = {
@@ -268,7 +269,7 @@ export class Service extends Base {
268
269
 
269
270
  dnsRecordsForDomainName(domainName, hasSVRRecords) {
270
271
  const records = [];
271
- if (this.priority <= 1 && this.alias) {
272
+ if (this.priority >= 390 && this.alias) {
272
273
  records.push(DNSRecord(this.alias, "CNAME", dnsFullName(domainName)));
273
274
  }
274
275
 
@@ -283,7 +284,7 @@ export class Service extends Base {
283
284
  DNSRecord(
284
285
  dnsFullName(`_${this.type}._${ep.protocol}.${domainName}`),
285
286
  "SRV",
286
- this.priority ?? 10,
287
+ dnsPriority(this.priority),
287
288
  this.weight,
288
289
  ep.port,
289
290
  dnsFullName(this.domainName)
@@ -311,7 +312,7 @@ export class Service extends Base {
311
312
  DNSRecord(
312
313
  dnsFullName(domainName),
313
314
  dnsRecord.type,
314
- this.priority ?? 10,
315
+ dnsPriority(this.priority),
315
316
  ".",
316
317
  dnsFormatParameters(parameters)
317
318
  )
@@ -321,7 +322,7 @@ export class Service extends Base {
321
322
  DNSRecord(
322
323
  "@",
323
324
  dnsRecord.type,
324
- this.priority ?? 10,
325
+ dnsPriority(this.priority),
325
326
  dnsFullName(domainName)
326
327
  )
327
328
  );
@@ -236,7 +236,7 @@ export class BindService extends ExtraSourceService {
236
236
  };
237
237
 
238
238
  const forwarders = serviceEndpoints(this.source, {
239
- services: { type: "dns", priority: ">=20" },
239
+ services: { type: "dns", priority: ">=300" },
240
240
  select: e => e.address,
241
241
  limit: 5
242
242
  });
@@ -535,7 +535,7 @@ export class BindService extends ExtraSourceService {
535
535
  }
536
536
 
537
537
  get defaultRecords() {
538
- const nameService = this.findService({ type: "dns", priority: "<10" });
538
+ const nameService = this.findService({ type: "dns", priority: ">=300" });
539
539
 
540
540
  const SOARecord = DNSRecord(
541
541
  "@",
@@ -58,7 +58,7 @@ export class ChronyService extends ExtraSourceService {
58
58
  ...serviceEndpoints(this, {
59
59
  services: {
60
60
  type: "ntp",
61
- priority: "<10"
61
+ priority: ">=200"
62
62
  },
63
63
  endpoints: e =>
64
64
  e.service.host !== host &&
@@ -142,7 +142,7 @@ export class KeaService extends Service {
142
142
  const dnsServerEndpoints = serviceEndpoints(network, {
143
143
  services: {
144
144
  type: "dns",
145
- priority: "<10"
145
+ priority: ">=300"
146
146
  },
147
147
  endpoints: endpoint => endpoint.networkInterface.kind !== "loopback"
148
148
  });
@@ -162,7 +162,7 @@ export class KeaService extends Service {
162
162
  const peers = async family =>
163
163
  (
164
164
  await Array.fromAsync(
165
- network.findServices({ type: "dhcp", priority: "<20" })
165
+ network.findServices({ type: "dhcp", priority: ">=200" })
166
166
  )
167
167
  )
168
168
  .sort(sortInverseByPriority)
package/types/base.d.mts CHANGED
@@ -94,14 +94,7 @@ export class Base {
94
94
  get packaging(): Set<any>;
95
95
  get derivedPackaging(): any;
96
96
  get outputs(): Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
97
- preparePackages(stagingDir: any): AsyncGenerator<{
98
- sources: any[];
99
- outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
100
- properties: {
101
- description: string;
102
- access: string;
103
- };
104
- }, void, unknown>;
97
+ preparePackages(stagingDir: any): AsyncGenerator<never, void, unknown>;
105
98
  set tags(value: Set<any>);
106
99
  get tags(): Set<any>;
107
100
  get isTemplate(): boolean;
@@ -11,3 +11,4 @@ export function dnsFormatParameters(parameters: any): string;
11
11
  export function dnsMergeParameters(a: any, b: any): {
12
12
  [k: string]: Set<any>;
13
13
  };
14
+ export function dnsPriority(priority: any): number;