pmcf 6.26.4 → 6.26.5

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
@@ -79,30 +79,30 @@ generates config packages for:
79
79
  * [domainNames](#domainnames)
80
80
  * [InitializationContext](#initializationcontext)
81
81
  * [Parameters](#parameters-14)
82
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
83
+ * [networkAddresses](#networkaddresses)
84
+ * [Parameters](#parameters-15)
82
85
  * [zones](#zones)
83
86
  * [type](#type)
84
87
  * [addressesStatement](#addressesstatement)
85
- * [Parameters](#parameters-15)
88
+ * [Parameters](#parameters-16)
86
89
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
87
90
  * [Properties](#properties)
88
91
  * [systemdConfigs](#systemdconfigs)
89
- * [Parameters](#parameters-16)
92
+ * [Parameters](#parameters-17)
90
93
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
91
94
  * [Properties](#properties-1)
92
95
  * [systemdConfigs](#systemdconfigs-1)
93
- * [Parameters](#parameters-17)
96
+ * [Parameters](#parameters-18)
94
97
  * [NetworkAddress](#networkaddress)
95
- * [Parameters](#parameters-18)
98
+ * [Parameters](#parameters-19)
96
99
  * [subnet](#subnet)
97
100
  * [networkInterface](#networkinterface)
98
101
  * [address](#address)
99
102
  * [addresses](#addresses)
100
- * [Parameters](#parameters-19)
101
- * [cidrAddresses](#cidraddresses)
102
103
  * [Parameters](#parameters-20)
103
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
104
- * [networkAddresses](#networkaddresses)
105
- * [Parameters](#parameters-21)
104
+ * [cidrAddresses](#cidraddresses)
105
+ * [Parameters](#parameters-21)
106
106
  * [families](#families)
107
107
  * [secretName](#secretname)
108
108
  * [directHosts](#directhosts)
@@ -301,6 +301,18 @@ Keeps track of all in flight object creations and loose ends during config initi
301
301
 
302
302
  * `directory` (optional, default `"/"`)
303
303
 
304
+ ## SkeletonNetworkInterface
305
+
306
+ **Extends ServiceOwner**
307
+
308
+ ### networkAddresses
309
+
310
+ #### Parameters
311
+
312
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
313
+
314
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
315
+
304
316
  ## zones
305
317
 
306
318
  Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
@@ -397,18 +409,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
397
409
 
398
410
  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;
399
411
 
400
- ## SkeletonNetworkInterface
401
-
402
- **Extends ServiceOwner**
403
-
404
- ### networkAddresses
405
-
406
- #### Parameters
407
-
408
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
409
-
410
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
411
-
412
412
  ## families
413
413
 
414
414
  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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.26.4",
3
+ "version": "6.26.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -430,7 +430,7 @@ export class Base {
430
430
  root: this.root,
431
431
  current: this,
432
432
  valueFor: (name, at) =>
433
- at === undefined ? globals[name] : at.value(name),
433
+ typeof at?.value === "function" ? at.value(name) : globals[name],
434
434
  ...options
435
435
  });
436
436
  }
@@ -622,7 +622,7 @@ export class Base {
622
622
  root: this.root,
623
623
  current: this,
624
624
  valueFor: (name, at) =>
625
- at === undefined ? globals[name] : at.value(name)
625
+ typeof at?.value === "function" ? at.value(name) : globals[name]
626
626
  });
627
627
  }
628
628
 
@@ -5,6 +5,7 @@ import {
5
5
  string_collection_attribute_writable,
6
6
  string_set_attribute_writable,
7
7
  string_attribute_writable,
8
+ string_attribute,
8
9
  integer_attribute_writable,
9
10
  hostname_attribute as hostname_attribute_base,
10
11
  boolean_attribute_writable
@@ -88,6 +89,8 @@ export const bridges_attribute = {
88
89
  backpointer: { ...networks_attribute, name: "bridges" }
89
90
  };
90
91
 
92
+ export const family_attribute = { ...string_attribute, name: "family" };
93
+
91
94
  export const psk_attribute = { ...string_attribute_writable, name: "psk" };
92
95
  export const ssid_attribute = { ...string_attribute_writable, name: "ssid" };
93
96
  export const hostname_attribute = {
@@ -1,5 +1,6 @@
1
1
  import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
2
2
  import {
3
+ string_attribute,
3
4
  string_attribute_writable,
4
5
  number_attribute_writable,
5
6
  string_set_attribute_writable,
@@ -44,7 +45,8 @@ export const endpointAttributes = {
44
45
  values: new Set(["tcp", "udp", "quic"])
45
46
  },
46
47
  types: { ...string_set_attribute_writable, name: "types" },
47
- tls: { ...boolean_attribute_false, name: "tls" }
48
+ tls: { ...boolean_attribute_false, name: "tls" },
49
+ address: { ...string_attribute, name: "address" }
48
50
  };
49
51
 
50
52
  export class CoreService extends Base {
package/src/endpoint.mjs CHANGED
@@ -1,16 +1,18 @@
1
+ import { getAttribute, string_attribute } from "pacc";
1
2
  import { FAMILY_IPV6 } from "ip-utilties";
2
3
  import { addType } from "pmcf";
3
4
  import { endpointAttributes, CoreService } from "./core-service.mjs";
5
+ import { family_attribute } from "./common-attributes.mjs";
4
6
 
5
7
  export const FAMILY_UNIX = "unix";
6
8
  export const FAMILY_DNS = "dns";
7
9
 
8
10
  class BaseEndpoint {
9
- static name = "endpoint";
11
+ static name = "base_endpoint";
10
12
  static priority = 1.1;
11
13
  static owners = [CoreService, "network_interface"];
12
14
  static key = "type";
13
- attributes = endpointAttributes;
15
+ static attributes = endpointAttributes;
14
16
 
15
17
  static {
16
18
  addType(this);
@@ -26,6 +28,10 @@ class BaseEndpoint {
26
28
  }
27
29
  }
28
30
 
31
+ get fullName() {
32
+ return this.service.fullName + "/" + this.type;
33
+ }
34
+
29
35
  get type() {
30
36
  return this._type?.name ?? this.service.type;
31
37
  }
@@ -37,12 +43,26 @@ class BaseEndpoint {
37
43
  toString() {
38
44
  return `${this.type}`;
39
45
  }
46
+
47
+ attribute(name) {
48
+ return getAttribute(this, name);
49
+ }
50
+
51
+ value(name) {
52
+ return this.attribute(name);
53
+ }
40
54
  }
41
55
 
42
56
  /**
43
57
  * Endpoint with an ip port
44
58
  */
45
59
  class PortEndpoint extends BaseEndpoint {
60
+ static name = "port_endpoint";
61
+
62
+ static {
63
+ addType(this);
64
+ }
65
+
46
66
  _port;
47
67
  constructor(service, data) {
48
68
  super(service, data);
@@ -78,6 +98,15 @@ class PortEndpoint extends BaseEndpoint {
78
98
  }
79
99
 
80
100
  export class Endpoint extends PortEndpoint {
101
+ static name = "endpoint";
102
+ static attributes = {
103
+ family: family_attribute
104
+ };
105
+
106
+ static {
107
+ addType(this);
108
+ }
109
+
81
110
  constructor(service, networkAddress, data) {
82
111
  super(service, data);
83
112
  this.networkAddress = networkAddress;
package/src/host.mjs CHANGED
@@ -246,6 +246,13 @@ export class Host extends ServiceOwner {
246
246
  return parts[parts.length - 1].toLowerCase();
247
247
  }
248
248
 
249
+ get services() {
250
+ return new AggregatedMap([
251
+ this._services,
252
+ ...this._networkInterfaces.values().map(ni => ni._services)
253
+ ]);
254
+ }
255
+
249
256
  get foreignDomainNames() {
250
257
  return [...this.aliases].filter(n => n.split(".").length > 1);
251
258
  }
@@ -341,7 +348,6 @@ export class Host extends ServiceOwner {
341
348
 
342
349
  if (!this.isTemplate && networkInterface.network) {
343
350
  assign(hosts_attribute, networkInterface.network, this);
344
- //networkInterface.network.hosts = this;
345
351
  }
346
352
  }
347
353
 
@@ -2,13 +2,14 @@ import {
2
2
  default_attribute,
3
3
  string_attribute,
4
4
  name_attribute,
5
+ type_attribute,
5
6
  getAttribute
6
7
  } from "pacc";
7
-
8
8
  import { familyIP, formatCIDR, decodeIP, addressType } from "ip-utilties";
9
9
  import { Subnet } from "./subnet.mjs";
10
10
  import { Owner, addType } from "pmcf";
11
11
  import { NetworkInterface } from "./network-interfaces/network-interface.mjs";
12
+ import { family_attribute } from "./common-attributes.mjs";
12
13
 
13
14
  /**
14
15
  *
@@ -19,14 +20,14 @@ export class NetworkAddress {
19
20
  static key = "address";
20
21
  static attributes = {
21
22
  address: { ...name_attribute, name: "address" },
22
- type: { ...string_attribute, name: "type" },
23
+ type: type_attribute,
23
24
  cidrAddress: { ...string_attribute, name: "cidrAddress" },
24
25
  networkInterface: {
25
26
  ...default_attribute,
26
27
  name: "networkInterface",
27
28
  type: "network_interface"
28
29
  },
29
- family: { ...string_attribute, name: "family" }
30
+ family: family_attribute
30
31
  };
31
32
 
32
33
  static {