pmcf 4.25.5 → 4.25.7

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
@@ -73,11 +73,11 @@ generates config packages for:
73
73
  * [Parameters](#parameters-12)
74
74
  * [port](#port-1)
75
75
  * [id](#id)
76
- * [InitializationContext](#initializationcontext)
77
- * [Parameters](#parameters-13)
78
76
  * [SkeletonNetworkInterface](#skeletonnetworkinterface)
79
77
  * [networkAddresses](#networkaddresses)
80
- * [Parameters](#parameters-14)
78
+ * [Parameters](#parameters-13)
79
+ * [InitializationContext](#initializationcontext)
80
+ * [Parameters](#parameters-14)
81
81
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
82
82
  * [Properties](#properties)
83
83
  * [systemdConfigs](#systemdconfigs)
@@ -263,14 +263,6 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
263
263
 
264
264
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
265
265
 
266
- ## InitializationContext
267
-
268
- Keeps track of all in flight object creations and loose ends during config initialization.
269
-
270
- ### Parameters
271
-
272
- * `directory` (optional, default `"/"`)
273
-
274
266
  ## SkeletonNetworkInterface
275
267
 
276
268
  **Extends ServiceOwner**
@@ -283,6 +275,14 @@ Keeps track of all in flight object creations and loose ends during config initi
283
275
 
284
276
  Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
285
277
 
278
+ ## InitializationContext
279
+
280
+ Keeps track of all in flight object creations and loose ends during config initialization.
281
+
282
+ ### Parameters
283
+
284
+ * `directory` (optional, default `"/"`)
285
+
286
286
  ## SystemdJournalRemoteService
287
287
 
288
288
  **Extends Service**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.25.5",
3
+ "version": "4.25.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,7 +53,7 @@
53
53
  "aggregated-map": "^1.0.4",
54
54
  "content-entry-transform": "^1.6.9",
55
55
  "ip-utilties": "^3.0.4",
56
- "npm-pkgbuild": "^20.7.1",
56
+ "npm-pkgbuild": "^20.7.2",
57
57
  "pacc": "^9.2.13",
58
58
  "package-directory": "^8.2.0"
59
59
  },
@@ -62,7 +62,7 @@
62
62
  "ava": "^8.0.1",
63
63
  "c8": "^11.0.0",
64
64
  "documentation": "^14.0.3",
65
- "semantic-release": "^25.0.3"
65
+ "semantic-release": "^25.0.5"
66
66
  },
67
67
  "overrides": {
68
68
  "c8": {
package/src/base.mjs CHANGED
@@ -561,6 +561,10 @@ export function extractFrom(
561
561
  return object;
562
562
  }
563
563
 
564
+ if (object instanceof Set) {
565
+ object = [...object];
566
+ }
567
+
564
568
  if (typeof object[Symbol.iterator] === "function") {
565
569
  object = [...object].map(o => (o instanceof Base ? extractFrom(o) : o));
566
570
 
package/src/host.mjs CHANGED
@@ -433,15 +433,13 @@ export class Host extends ServiceOwner {
433
433
  }
434
434
 
435
435
  get subnets() {
436
- const sn = new Map();
436
+ let all = new Set();
437
437
 
438
438
  for (const networkInterface of this.networkInterfaces.values()) {
439
- for (const s of networkInterface.subnets()) {
440
- sn.set(s.address, s);
441
- }
439
+ all = all.union(networkInterface.subnets);
442
440
  }
443
441
 
444
- return new Set(sn.values());
442
+ return all;
445
443
  }
446
444
 
447
445
  async publicKey(type = "ed25519") {
@@ -57,7 +57,7 @@ export function addresses(sources, options) {
57
57
  return s;
58
58
  }
59
59
  if (options?.aggregate && s instanceof Owner && s.subnets) {
60
- return [...s.subnets()];
60
+ return [...s.subnets];
61
61
  }
62
62
 
63
63
  return s.networkAddresses
@@ -24,8 +24,7 @@ export class SkeletonNetworkInterface extends ServiceOwner {
24
24
  }
25
25
  }
26
26
 
27
- get services()
28
- {
27
+ get services() {
29
28
  return new AggregatedMap([super.services, this.owner.services]);
30
29
  }
31
30
 
@@ -66,8 +65,8 @@ export class SkeletonNetworkInterface extends ServiceOwner {
66
65
  this._network = network;
67
66
  }
68
67
 
69
- *subnets() {
70
- yield* this.ipAddresses.values();
68
+ get subnets() {
69
+ return new Set(this.ipAddresses.values());
71
70
  }
72
71
 
73
72
  get ipAddresses() {
package/src/network.mjs CHANGED
@@ -38,7 +38,7 @@ export class Network extends Owner {
38
38
  }
39
39
 
40
40
  get address() {
41
- for (const subnet of this.subnets()) {
41
+ for (const subnet of this.subnets) {
42
42
  return subnet.address;
43
43
  }
44
44
  }
package/src/owner.mjs CHANGED
@@ -54,6 +54,7 @@ export class Owner extends Base {
54
54
 
55
55
  _membersByType = new Map();
56
56
  _bridges = new Set();
57
+ _subnets = new Set();
57
58
 
58
59
  /**
59
60
  * @return {boolean}
@@ -132,26 +133,34 @@ export class Owner extends Base {
132
133
  }
133
134
 
134
135
  addTypeObject(typeName, name, object) {
135
- const typeSlot = this._membersByType.getOrInsertComputed(typeName, () => new Map());
136
+ const typeSlot = this._membersByType.getOrInsertComputed(
137
+ typeName,
138
+ () => new Map()
139
+ );
136
140
  typeSlot.set(name, object);
137
141
  }
138
142
 
139
143
  addObject(object) {
140
- if (object.owner && object.owner !== this) {
141
- this.addTypeObject(
142
- object.typeName,
143
- object.owner.name + "/" + object.name,
144
- object
145
- );
146
-
147
- return;
144
+ if (object instanceof Subnet) {
145
+ this._subnets.add(object);
146
+ } else {
147
+ if (object.owner && object.owner !== this) {
148
+ this.addTypeObject(
149
+ object.typeName,
150
+ object.owner.name + "/" + object.name,
151
+ object
152
+ );
153
+
154
+ return;
155
+ }
156
+ this.addTypeObject(object.typeName, object.name, object);
148
157
  }
149
- this.addTypeObject(object.typeName, object.name, object);
150
158
  }
151
159
 
152
- get services()
153
- {
154
- return [...this.hosts].map(host=>Array.from(host.services.values())).flat();
160
+ get services() {
161
+ return [...this.hosts]
162
+ .map(host => Array.from(host.services.values()))
163
+ .flat();
155
164
  }
156
165
 
157
166
  get locations() {
@@ -192,14 +201,11 @@ export class Owner extends Base {
192
201
  }
193
202
 
194
203
  subnetNamed(name) {
195
- return this.typeNamed("subnet", name);
204
+ return [...this.subnets].find(s => s.name == name);
196
205
  }
197
206
 
198
- *subnets() {
199
- if (this.owner) {
200
- yield* this.owner.subnets();
201
- }
202
- yield* this.typeList("subnet");
207
+ get subnets() {
208
+ return this.unionFromDirections(["this", "owner"], "_subnets");
203
209
  }
204
210
 
205
211
  addSubnet(address) {
@@ -215,19 +221,18 @@ export class Owner extends Base {
215
221
  subnet =
216
222
  familyIP(address) === "IPv4" ? SUBNET_GLOBAL_IPV4 : SUBNET_GLOBAL_IPV6;
217
223
 
218
- /*
219
224
  this.error(
220
225
  `Address without subnet ${address}`,
221
- [...this.subnets()].map(s => s.address)
226
+ [...this.subnets].map(s => s.address)
222
227
  );
223
- */
224
228
  }
225
229
 
230
+ this._subnets.add(subnet);
226
231
  return subnet;
227
232
  }
228
233
 
229
234
  subnetForAddress(address) {
230
- for (const subnet of this.subnets()) {
235
+ for (const subnet of this.subnets) {
231
236
  if (subnet.matchesAddress(address)) {
232
237
  return subnet;
233
238
  }
@@ -301,7 +306,7 @@ export class Owner extends Base {
301
306
  }
302
307
  }
303
308
  // enshure only one subnet address in the bridge
304
- for (const subnet of network.subnets()) {
309
+ for (const subnet of network.subnets) {
305
310
  const present = subnets.get(subnet.address);
306
311
  if (present) {
307
312
  subnet.owner.addObject(present);
package/src/subnet.mjs CHANGED
@@ -108,12 +108,10 @@ export const SUBNET_LOCALHOST_IPV6 = new Subnet(_owner, "::1/128");
108
108
  export const SUBNET_LINK_LOCAL_IPV6 = new Subnet(_owner, "fe80::/64");
109
109
 
110
110
  export function subnets(sources) {
111
- const all = new Set();
111
+ let all = new Set();
112
112
 
113
113
  for (const source of sources) {
114
- for (const subnet of source.subnets()) {
115
- all.add(subnet);
116
- }
114
+ all = all.union(source.subnets);
117
115
  }
118
116
 
119
117
  return all;