pmcf 6.18.0 → 6.18.2

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
@@ -42,44 +42,42 @@ generates config packages for:
42
42
  ### Table of Contents
43
43
 
44
44
  * [Base](#base)
45
+ * [Parameters](#parameters)
45
46
  * [mapFromDirections](#mapfromdirections)
46
- * [Parameters](#parameters)
47
- * [unionFromDirections](#unionfromdirections)
48
47
  * [Parameters](#parameters-1)
49
- * [walkDirections](#walkdirections)
48
+ * [unionFromDirections](#unionfromdirections)
50
49
  * [Parameters](#parameters-2)
51
- * [attribute](#attribute)
50
+ * [walkDirections](#walkdirections)
52
51
  * [Parameters](#parameters-3)
53
- * [attributeIterator](#attributeiterator)
52
+ * [attribute](#attribute)
54
53
  * [Parameters](#parameters-4)
55
- * [getAttributes](#getattributes)
54
+ * [attributeIterator](#attributeiterator)
56
55
  * [Parameters](#parameters-5)
57
- * [property](#property)
56
+ * [getAttributes](#getattributes)
58
57
  * [Parameters](#parameters-6)
58
+ * [property](#property)
59
+ * [Parameters](#parameters-7)
59
60
  * [priority](#priority)
60
61
  * [expression](#expression)
61
- * [Parameters](#parameters-7)
62
- * [templateContent](#templatecontent)
63
62
  * [Parameters](#parameters-8)
63
+ * [templateContent](#templatecontent)
64
+ * [Parameters](#parameters-9)
64
65
  * [isTemplate](#istemplate)
65
66
  * [expand](#expand)
66
- * [Parameters](#parameters-9)
67
+ * [Parameters](#parameters-10)
67
68
  * [serviceEndpoints](#serviceendpoints)
68
- * [Parameters](#parameters-10)
69
- * [PortEndpoint](#portendpoint)
70
69
  * [Parameters](#parameters-11)
70
+ * [PortEndpoint](#portendpoint)
71
+ * [Parameters](#parameters-12)
71
72
  * [port](#port)
72
73
  * [socketAddress](#socketaddress)
73
74
  * [HTTPEndpoint](#httpendpoint)
74
- * [Parameters](#parameters-12)
75
+ * [Parameters](#parameters-13)
75
76
  * [port](#port-1)
76
77
  * [id](#id)
77
78
  * [domainNames](#domainnames)
78
79
  * [InitializationContext](#initializationcontext)
79
- * [Parameters](#parameters-13)
80
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
81
- * [networkAddresses](#networkaddresses)
82
- * [Parameters](#parameters-14)
80
+ * [Parameters](#parameters-14)
83
81
  * [type](#type)
84
82
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
85
83
  * [Properties](#properties)
@@ -98,27 +96,35 @@ generates config packages for:
98
96
  * [Parameters](#parameters-18)
99
97
  * [cidrAddresses](#cidraddresses)
100
98
  * [Parameters](#parameters-19)
99
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
100
+ * [networkAddresses](#networkaddresses)
101
+ * [Parameters](#parameters-20)
101
102
  * [families](#families)
102
103
  * [secretName](#secretname)
103
104
  * [directHosts](#directhosts)
104
105
  * [subnetForAddress](#subnetforaddress)
105
- * [Parameters](#parameters-20)
106
- * [domainName](#domainname)
107
106
  * [Parameters](#parameters-21)
108
- * [domainFromDominName](#domainfromdominname)
107
+ * [domainName](#domainname)
109
108
  * [Parameters](#parameters-22)
110
- * [sectionLines](#sectionlines)
109
+ * [domainFromDominName](#domainfromdominname)
111
110
  * [Parameters](#parameters-23)
112
- * [asArray](#asarray)
111
+ * [sectionLines](#sectionlines)
113
112
  * [Parameters](#parameters-24)
114
- * [asIterator](#asiterator)
113
+ * [asArray](#asarray)
115
114
  * [Parameters](#parameters-25)
115
+ * [asIterator](#asiterator)
116
+ * [Parameters](#parameters-26)
116
117
 
117
118
  ## Base
118
119
 
119
120
  attributes: as declared in the types
120
121
  properties: use defined values to support attribute value definitions
121
122
 
123
+ ### Parameters
124
+
125
+ * `owner`  
126
+ * `data`  
127
+
122
128
  ### mapFromDirections
123
129
 
124
130
  Deliver AggregatedMap of all property Maps.
@@ -287,18 +293,6 @@ Keeps track of all in flight object creations and loose ends during config initi
287
293
 
288
294
  * `directory` (optional, default `"/"`)
289
295
 
290
- ## SkeletonNetworkInterface
291
-
292
- **Extends ServiceOwner**
293
-
294
- ### networkAddresses
295
-
296
- #### Parameters
297
-
298
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
299
-
300
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
301
-
302
296
  ## type
303
297
 
304
298
  Type of the group.
@@ -380,6 +374,18 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
380
374
 
381
375
  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;
382
376
 
377
+ ## SkeletonNetworkInterface
378
+
379
+ **Extends ServiceOwner**
380
+
381
+ ### networkAddresses
382
+
383
+ #### Parameters
384
+
385
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
386
+
387
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
388
+
383
389
  ## families
384
390
 
385
391
  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.18.0",
3
+ "version": "6.18.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,8 +53,8 @@
53
53
  "aggregated-map": "^1.0.8",
54
54
  "content-entry-transform": "^1.7.0",
55
55
  "ip-utilties": "^3.10.0",
56
- "npm-pkgbuild": "^20.8.8",
57
- "pacc": "^11.0.1",
56
+ "npm-pkgbuild": "^20.8.9",
57
+ "pacc": "^11.0.2",
58
58
  "package-directory": "^8.2.0",
59
59
  "yaml": "^2.9.0"
60
60
  },
@@ -66,7 +66,7 @@
66
66
  "semantic-release": "^25.0.8"
67
67
  },
68
68
  "engines": {
69
- "node": ">=26.4.0"
69
+ "node": ">=26.5.1"
70
70
  },
71
71
  "repository": {
72
72
  "type": "git",
package/src/base.mjs CHANGED
@@ -37,9 +37,9 @@ export class Base {
37
37
  static key = "name";
38
38
  static priority = 0;
39
39
  static attributes = {
40
+ owner: owner_attribute,
40
41
  name: name_attribute_writable,
41
42
  description: description_attribute_writable,
42
- owner: owner_attribute,
43
43
  type: type_attribute,
44
44
  directory: { ...string_attribute_writable, name: "directory" },
45
45
  packaging: { ...string_set_attribute_writable, name: "packaging" },
@@ -66,6 +66,12 @@ export class Base {
66
66
  _packaging = new Set();
67
67
  _directory;
68
68
 
69
+ constructor(owner, data) {
70
+ if (owner) {
71
+ this.owner = owner;
72
+ }
73
+ }
74
+
69
75
  set owner(value) {
70
76
  if (this === value || this === value?.owner) {
71
77
  this.error("Unable to own myself", value.fullName);
@@ -48,7 +48,7 @@ export class InitializationContext {
48
48
  }
49
49
 
50
50
  instantiateAndAssign(object, attribute, value) {
51
- if (attribute.type.primitive) {
51
+ if (attribute.type.primitive || attribute.expression) {
52
52
  return assign(attribute, object, value);
53
53
  }
54
54
  if (value !== undefined) {
@@ -178,15 +178,9 @@ export class InitializationContext {
178
178
  attribute => attribute.type === type && attribute.collection
179
179
  )) {
180
180
  try {
181
- const object = create(type, owner, data);
182
-
183
- // set backointer early so that parent properties can be found during load
184
- if (attribute.backpointer) {
185
- assign(attribute.backpointer, object, owner);
186
- }
187
- return assign(attribute, owner, this.read(object, data));
181
+ return assign(attribute, owner, this.read(create(type, owner, data), data));
188
182
  } catch (e) {
189
- this.error(`Unable to assign ${type.name}.${attribute.name}`, data);
183
+ this.error(`Unable to assign ${type.name}.${attribute.name}`, e, data);
190
184
  }
191
185
  }
192
186
 
package/src/network.mjs CHANGED
@@ -53,7 +53,7 @@ export class Network extends Owner {
53
53
 
54
54
  get subnets() {
55
55
  if (!this._subnets.get("fe80::/64")) {
56
- const linkLocal = new Subnet("fe80::/64");
56
+ const linkLocal = new Subnet(this, "fe80::/64");
57
57
  this._subnets.set(linkLocal.address, linkLocal);
58
58
  //assign(subnets_attribute, this, linkLocal);
59
59
  }
package/src/owner.mjs CHANGED
@@ -135,7 +135,7 @@ export class Owner extends ServiceOwner {
135
135
  if (cidr && prefixLength !== 0) {
136
136
  return (
137
137
  this._subnets.get(cidr) ||
138
- assign(subnets_attribute, this, new Subnet(cidr))
138
+ assign(subnets_attribute, this, new Subnet(this, cidr))
139
139
  );
140
140
  }
141
141
 
package/src/subnet.mjs CHANGED
@@ -33,8 +33,9 @@ export class Subnet {
33
33
 
34
34
  networks = new Set();
35
35
 
36
- constructor(address) {
37
- const { longPrefix, prefix, prefixLength, cidr, family } = normalizeCIDR(address);
36
+ constructor(owner, address) {
37
+ const { longPrefix, prefix, prefixLength, cidr, family } =
38
+ normalizeCIDR(address);
38
39
 
39
40
  this.address = cidr;
40
41
  this.prefix = prefix;
@@ -99,7 +100,7 @@ export class Subnet {
99
100
  }
100
101
  }
101
102
 
102
- export const SUBNET_GLOBAL_IPV4 = new Subnet("0.0.0.0/0");
103
- export const SUBNET_GLOBAL_IPV6 = new Subnet("::0/0");
104
- export const SUBNET_LOCALHOST_IPV4 = new Subnet("127.0.0.1/8");
105
- export const SUBNET_LOCALHOST_IPV6 = new Subnet("::1/128");
103
+ export const SUBNET_GLOBAL_IPV4 = new Subnet(undefined, "0.0.0.0/0");
104
+ export const SUBNET_GLOBAL_IPV6 = new Subnet(undefined, "::0/0");
105
+ export const SUBNET_LOCALHOST_IPV4 = new Subnet(undefined, "127.0.0.1/8");
106
+ export const SUBNET_LOCALHOST_IPV6 = new Subnet(undefined, "::1/128");
package/src/type.mjs CHANGED
@@ -3,8 +3,7 @@ import { normalizeIP } from "ip-utilties";
3
3
  import { addServiceType } from "pmcf";
4
4
  import { asArray } from "./utils.mjs";
5
5
 
6
-
7
- const SLASH = {...DOT, str: "/" };
6
+ const SLASH = { ...DOT, str: "/" };
8
7
 
9
8
  registerToken(SLASH);
10
9
 
@@ -34,16 +33,22 @@ export function assign(attribute, object, value) {
34
33
  value ??= attribute.default;
35
34
 
36
35
  if (value !== undefined) {
36
+ // set backointer early so that parent properties can be found during load
37
+ if (attribute.backpointer) {
38
+ assign(attribute.backpointer, value, object);
39
+ }
40
+
41
+ if (attribute.expression) { // TODO
42
+ object[attribute.name] = value;
43
+ return value;
44
+ }
45
+
37
46
  if (attribute.values) {
38
47
  if (!attribute.values.has(value)) {
39
48
  error("unkown value", attribute);
40
49
  }
41
50
  }
42
51
 
43
- if (attribute.backpointer) {
44
- assign(attribute.backpointer, value, object);
45
- }
46
-
47
52
  if (attribute.collection) {
48
53
  const current = object[attribute.name];
49
54