pmcf 6.66.11 → 6.67.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/README.md CHANGED
@@ -71,7 +71,7 @@ generates config packages for:
71
71
  * [expression](#expression)
72
72
  * [Parameters](#parameters-11)
73
73
  * [isTemplate](#istemplate-1)
74
- * [PortEndpoint](#portendpoint)
74
+ * [port\_endpoint](#port_endpoint)
75
75
  * [Parameters](#parameters-12)
76
76
  * [port](#port)
77
77
  * [socketAddress](#socketaddress)
@@ -81,31 +81,31 @@ generates config packages for:
81
81
  * [domainNames](#domainnames)
82
82
  * [InitializationContext](#initializationcontext)
83
83
  * [Parameters](#parameters-14)
84
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
85
+ * [networkAddresses](#networkaddresses)
86
+ * [Parameters](#parameters-15)
84
87
  * [Interface](#interface)
85
88
  * [zones](#zones)
86
89
  * [addressesStatement](#addressesstatement)
87
- * [Parameters](#parameters-15)
90
+ * [Parameters](#parameters-16)
88
91
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
89
92
  * [Properties](#properties)
90
93
  * [systemdConfigs](#systemdconfigs)
91
- * [Parameters](#parameters-16)
94
+ * [Parameters](#parameters-17)
92
95
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
93
96
  * [Properties](#properties-1)
94
97
  * [systemdConfigs](#systemdconfigs-1)
95
- * [Parameters](#parameters-17)
98
+ * [Parameters](#parameters-18)
96
99
  * [priority](#priority-1)
97
100
  * [NetworkAddress](#networkaddress)
98
- * [Parameters](#parameters-18)
101
+ * [Parameters](#parameters-19)
99
102
  * [subnet](#subnet)
100
103
  * [networkInterface](#networkinterface)
101
104
  * [address](#address)
102
105
  * [addresses](#addresses)
103
- * [Parameters](#parameters-19)
104
- * [cidrAddresses](#cidraddresses)
105
106
  * [Parameters](#parameters-20)
106
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
107
- * [networkAddresses](#networkaddresses)
108
- * [Parameters](#parameters-21)
107
+ * [cidrAddresses](#cidraddresses)
108
+ * [Parameters](#parameters-21)
109
109
  * [families](#families)
110
110
  * [secretName](#secretname)
111
111
  * [subnetForAddress](#subnetforaddress)
@@ -261,9 +261,9 @@ Returns **any** 
261
261
 
262
262
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
263
263
 
264
- ## PortEndpoint
264
+ ## port\_endpoint
265
265
 
266
- **Extends BaseEndpoint**
266
+ **Extends base\_endpoint**
267
267
 
268
268
  Endpoint with an ip port
269
269
 
@@ -282,9 +282,9 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
282
282
 
283
283
  ## url\_endpoint
284
284
 
285
- **Extends BaseEndpoint**
285
+ **Extends base\_endpoint**
286
286
 
287
- Endpoint based on url
287
+ endpoint based on url
288
288
 
289
289
  ### Parameters
290
290
 
@@ -308,6 +308,18 @@ Keeps track of all in flight object creations and loose ends during config initi
308
308
 
309
309
  * `directory` (optional, default `"/"`)
310
310
 
311
+ ## SkeletonNetworkInterface
312
+
313
+ **Extends Interface**
314
+
315
+ ### networkAddresses
316
+
317
+ #### Parameters
318
+
319
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
320
+
321
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
322
+
311
323
  ## Interface
312
324
 
313
325
  **Extends ServiceOwner**
@@ -405,18 +417,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
405
417
 
406
418
  Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
407
419
 
408
- ## SkeletonNetworkInterface
409
-
410
- **Extends Interface**
411
-
412
- ### networkAddresses
413
-
414
- #### Parameters
415
-
416
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
417
-
418
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
419
-
420
420
  ## families
421
421
 
422
422
  Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
package/bin/pmcf-diagram CHANGED
@@ -4,7 +4,7 @@ import { prepare } from "../src/cli.mjs";
4
4
 
5
5
  const { root, args } = await prepare();
6
6
 
7
- const location = root.expression(args[0]);
7
+ const site = root.expression(args[0]);
8
8
 
9
9
  function q(str) {
10
10
  return str.match(/^\w+$/) ? str : `"${str}"`;
@@ -12,7 +12,7 @@ function q(str) {
12
12
 
13
13
  console.log("graph G {");
14
14
  console.log(" node [shape=record];");
15
- for await (const host of location.hosts.values()) {
15
+ for await (const host of site.hosts.values()) {
16
16
  if (host.clusters.size === 0) {
17
17
  console.log(
18
18
  ` ${q(host.name)} [label="${host.name}|{${[
@@ -25,7 +25,7 @@ for await (const host of location.hosts.values()) {
25
25
  }
26
26
  }
27
27
 
28
- for await (const network of location.networks.values()) {
28
+ for await (const network of site.networks.values()) {
29
29
  console.log(
30
30
  ` ${q(network.name)} [label="${network.name}\\n${[...network.subnets.keys()]
31
31
  .map(s => s.address)
@@ -46,7 +46,7 @@ for await (const network of location.networks.values()) {
46
46
  }
47
47
  }
48
48
 
49
- for await (const cluster of location.clusters.values()) {
49
+ for await (const cluster of site.clusters.values()) {
50
50
  console.log(` subgraph cluster_${cluster.name} {`);
51
51
 
52
52
  for (const ni of cluster.members) {
@@ -73,7 +73,7 @@ for await (const cluster of location.clusters.values()) {
73
73
  }
74
74
 
75
75
  /*
76
- for (const bridge of location.bridges) {
76
+ for (const bridge of site.bridges) {
77
77
  console.log(` ${[...bridge].map(b => q(b.name)).join(" -- ")};`);
78
78
  }
79
79
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.66.11",
3
+ "version": "6.67.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -15,8 +15,8 @@ import {
15
15
  import {
16
16
  base,
17
17
  host,
18
- Endpoint,
19
- DomainNameEndpoint,
18
+ endpoint,
19
+ domain_endpoint,
20
20
  url_endpoint,
21
21
  unix_endpoint
22
22
  } from "pmcf";
@@ -182,13 +182,13 @@ export class CoreService extends base {
182
182
  result.push(he);
183
183
  }
184
184
  } else {
185
- result.push(new Endpoint(this, na, options));
185
+ result.push(new endpoint(this, na, options));
186
186
  }
187
187
  }
188
188
 
189
189
  if (!domainNames.has(this.domainName)) {
190
190
  domainNames.add(this.domainName);
191
- result.push(new DomainNameEndpoint(this, this.domainName, options));
191
+ result.push(new domain_endpoint(this, this.domainName, options));
192
192
  }
193
193
  break;
194
194
  }
package/src/endpoint.mjs CHANGED
@@ -5,8 +5,7 @@ import { CoreService } from "./core-service.mjs";
5
5
  import { family_attribute, endpointAttributes } from "./common-attributes.mjs";
6
6
  import { FAMILY_DNS, FAMILY_UNIX, PROTOCOL_TCP } from "./constants.mjs";
7
7
 
8
- class BaseEndpoint {
9
- static name = "base_endpoint";
8
+ class base_endpoint {
10
9
  static priority = 1.1;
11
10
  static owners = [CoreService, "network_interface"];
12
11
  static key = "type";
@@ -54,9 +53,7 @@ class BaseEndpoint {
54
53
  /**
55
54
  * Endpoint with an ip port
56
55
  */
57
- class PortEndpoint extends BaseEndpoint {
58
- static name = "port_endpoint";
59
-
56
+ class port_endpoint extends base_endpoint {
60
57
  static {
61
58
  addType(this);
62
59
  }
@@ -95,8 +92,7 @@ class PortEndpoint extends BaseEndpoint {
95
92
  }
96
93
  }
97
94
 
98
- export class Endpoint extends PortEndpoint {
99
- static name = "endpoint";
95
+ export class endpoint extends port_endpoint {
100
96
  static attributes = {
101
97
  family: family_attribute,
102
98
  addressType: { ...string_attribute, name: "addressType" }
@@ -136,8 +132,7 @@ export class Endpoint extends PortEndpoint {
136
132
  }
137
133
  }
138
134
 
139
- export class DomainNameEndpoint extends PortEndpoint {
140
- static name = "domain_endpoint";
135
+ export class domain_endpoint extends port_endpoint {
141
136
  static attributes = {
142
137
  domainName: { ...string_attribute, name: "domainName" }
143
138
  };
@@ -169,9 +164,9 @@ export class DomainNameEndpoint extends PortEndpoint {
169
164
  }
170
165
 
171
166
  /**
172
- * Endpoint based on url
167
+ * endpoint based on url
173
168
  */
174
- export class url_endpoint extends BaseEndpoint {
169
+ export class url_endpoint extends base_endpoint {
175
170
  static attributes = {
176
171
  url: url_attribute,
177
172
  addressType: { ...string_attribute, name: "addressType" }
@@ -262,7 +257,7 @@ export class url_endpoint extends BaseEndpoint {
262
257
  }
263
258
  }
264
259
 
265
- export class unix_endpoint extends BaseEndpoint {
260
+ export class unix_endpoint extends base_endpoint {
266
261
  static attributes = {
267
262
  url: url_attribute
268
263
  };
@@ -1,6 +1,7 @@
1
1
  import { join } from "node:path";
2
2
  import {
3
3
  string_attribute_writable,
4
+ string_set_attribute_writable,
4
5
  default_collection_attribute_writable
5
6
  } from "pacc";
6
7
  import { network_attribute } from "../common-attributes.mjs";
@@ -54,6 +55,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
54
55
  },
55
56
  hwaddr: { ...string_attribute_writable, name: "hwaddr" },
56
57
  dhcpClientId: { ...string_attribute_writable, name: "dhcpClientId" },
58
+ dhcpClientClasses: { ...string_set_attribute_writable, name: "dhcpClientClasses" },
57
59
  destination: { ...string_attribute_writable, name: "destination" }
58
60
 
59
61
  /*
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  base,
23
23
  CoreService,
24
- Endpoint,
24
+ endpoint,
25
25
  endpointAddresses,
26
26
  addresses,
27
27
  networkAddressType,
@@ -753,7 +753,7 @@ export class bind extends CoreService {
753
753
  static attributes = {
754
754
  forwarders: {
755
755
  ...default_collection_attribute_writable,
756
- type: Endpoint,
756
+ type: endpoint,
757
757
  name: "forwarders",
758
758
  deferredExpression: true
759
759
  },
@@ -19,7 +19,7 @@ import {
19
19
  addType,
20
20
  Subnet,
21
21
  CoreService,
22
- Endpoint,
22
+ endpoint,
23
23
  sortDescendingByPriority,
24
24
  bind_key,
25
25
  systemdCredentialFileName,
@@ -66,7 +66,7 @@ export class kea extends CoreService {
66
66
  },
67
67
  dnsServerEndpoints: {
68
68
  ...default_collection_attribute_writable,
69
- type: Endpoint,
69
+ type: endpoint,
70
70
  name: "dnsServerEndpoints",
71
71
  deferredExpression: true
72
72
  },
@@ -424,7 +424,7 @@ export class kea extends CoreService {
424
424
  [...hwmap]
425
425
  .map(([k, networkInterface]) => {
426
426
  let ip = {};
427
- let addr = networkInterface.networkAddress(
427
+ const addr = networkInterface.networkAddress(
428
428
  n => n.family === `IPv${family}`
429
429
  )?.address;
430
430
 
@@ -435,20 +435,29 @@ export class kea extends CoreService {
435
435
  : { "ip-address": addr };
436
436
  }
437
437
 
438
- let ids = { "hw-address": k };
438
+ let other = {};
439
439
 
440
- if (family === "4") {
441
- const dhcpClientId = networkInterface.dhcpClientId;
442
- if (dhcpClientId !== undefined) {
443
- ids = { "client-id": dhcpClientId };
444
- }
440
+ switch (family) {
441
+ case "4":
442
+ {
443
+ const dhcpClientId = networkInterface.dhcpClientId;
444
+ if (dhcpClientId !== undefined) {
445
+ other["client-id"] = dhcpClientId;
446
+ }
447
+ }
448
+ break;
449
+ }
450
+
451
+ const dhcpClientClasses = networkInterface.dhcpClientClasses;
452
+ if (dhcpClientClasses !== undefined) {
453
+ other["client-classes"] = [...dhcpClientClasses];
445
454
  }
446
455
 
447
456
  return {
448
- ...ids,
449
457
  ...ip,
458
+ "hw-address": k,
450
459
  hostname: networkInterface.domainName,
451
- "client-classes": ["SKIP_DDNS"]
460
+ ...other
452
461
  };
453
462
  })
454
463
  .sort((a, b) => a.hostname?.localeCompare(b.hostname));