pmcf 4.25.17 → 4.25.19

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,28 +73,31 @@ 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)
76
78
  * [SkeletonNetworkInterface](#skeletonnetworkinterface)
77
79
  * [networkAddresses](#networkaddresses)
78
- * [Parameters](#parameters-13)
79
- * [InitializationContext](#initializationcontext)
80
- * [Parameters](#parameters-14)
80
+ * [Parameters](#parameters-14)
81
81
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
82
82
  * [Properties](#properties)
83
83
  * [systemdConfigs](#systemdconfigs)
84
- * [Parameters](#parameters-15)
84
+ * [Parameters](#parameters-14)
85
85
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
86
86
  * [Properties](#properties-1)
87
87
  * [systemdConfigs](#systemdconfigs-1)
88
- * [Parameters](#parameters-16)
88
+ * [Parameters](#parameters-15)
89
89
  * [NetworkAddress](#networkaddress)
90
- * [Parameters](#parameters-17)
90
+ * [Parameters](#parameters-16)
91
91
  * [subnet](#subnet)
92
92
  * [networkInterface](#networkinterface)
93
93
  * [address](#address)
94
94
  * [addresses](#addresses)
95
- * [Parameters](#parameters-18)
95
+ * [Parameters](#parameters-17)
96
96
  * [cidrAddresses](#cidraddresses)
97
- * [Parameters](#parameters-19)
97
+ * [Parameters](#parameters-18)
98
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
99
+ * [networkAddresses](#networkaddresses)
100
+ * [Parameters](#parameters-19)
98
101
  * [secretName](#secretname)
99
102
  * [isTemplate](#istemplate-1)
100
103
  * [named](#named)
@@ -263,6 +266,14 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
263
266
 
264
267
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
265
268
 
269
+ ## InitializationContext
270
+
271
+ Keeps track of all in flight object creations and loose ends during config initialization.
272
+
273
+ ### Parameters
274
+
275
+ * `directory` (optional, default `"/"`)
276
+
266
277
  ## SkeletonNetworkInterface
267
278
 
268
279
  **Extends ServiceOwner**
@@ -275,14 +286,6 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
275
286
 
276
287
  Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
277
288
 
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
289
  ## SystemdJournalRemoteService
287
290
 
288
291
  **Extends Service**
@@ -358,6 +361,18 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
358
361
 
359
362
  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;
360
363
 
364
+ ## SkeletonNetworkInterface
365
+
366
+ **Extends ServiceOwner**
367
+
368
+ ### networkAddresses
369
+
370
+ #### Parameters
371
+
372
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
373
+
374
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
375
+
361
376
  ## secretName
362
377
 
363
378
  Returns **[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": "4.25.17",
3
+ "version": "4.25.19",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -48,14 +48,12 @@ export class Base {
48
48
  type: string_attribute
49
49
  };
50
50
 
51
- static typeDefinition = this;
52
-
53
51
  static {
54
52
  addType(this);
55
53
  }
56
54
 
57
55
  static get typeName() {
58
- return this.typeDefinition?.name || this.name;
56
+ return this.name;
59
57
  }
60
58
 
61
59
  static get typeFileName() {
@@ -213,7 +211,7 @@ export class Base {
213
211
 
214
212
  get typeName() {
215
213
  // @ts-ignore
216
- return this.constructor.typeDefinition.name;
214
+ return this.constructor.name;
217
215
  }
218
216
 
219
217
  /**
@@ -236,15 +234,8 @@ export class Base {
236
234
  * @return {Iterable<[string,any]>} values
237
235
  */
238
236
  *attributeIterator(filter) {
239
- for (
240
- let typeDefinition = this.constructor.typeDefinition;
241
- typeDefinition;
242
- typeDefinition = typeDefinition.extends
243
- ) {
244
- for (const [path, def] of attributeIterator(
245
- typeDefinition.attributes,
246
- filter
247
- )) {
237
+ for (let type = this.constructor; type; type = type.extends) {
238
+ for (const [path, def] of attributeIterator(type.attributes, filter)) {
248
239
  const name = path.join(".");
249
240
  const value = this.attribute(name);
250
241
 
@@ -545,14 +536,11 @@ export class Base {
545
536
  }
546
537
 
547
538
  toJSON() {
548
- return extractFrom(this, this.constructor.typeDefinition);
539
+ return extractFrom(this, this.constructor);
549
540
  }
550
541
  }
551
542
 
552
- export function extractFrom(
553
- object,
554
- typeDefinition = object?.constructor?.typeDefinition
555
- ) {
543
+ export function extractFrom(object, type = object?.constructor) {
556
544
  switch (typeof object) {
557
545
  case "undefined":
558
546
  case "string":
@@ -572,12 +560,12 @@ export function extractFrom(
572
560
  return undefined;
573
561
  }
574
562
 
575
- if (typeDefinition?.key) {
563
+ if (type?.key) {
576
564
  return Object.fromEntries(
577
565
  object.map(o => {
578
566
  o = extractFrom(o);
579
- const name = o[typeDefinition.key];
580
- delete o[typeDefinition.key];
567
+ const name = o[type.key];
568
+ delete o[type.key];
581
569
  return [name, o];
582
570
  })
583
571
  );
@@ -588,9 +576,9 @@ export function extractFrom(
588
576
 
589
577
  const json = {};
590
578
 
591
- for (; typeDefinition; typeDefinition = typeDefinition.extends) {
579
+ for (; type; type = type.extends) {
592
580
  for (const [path, def] of attributeIterator(
593
- typeDefinition.attributes,
581
+ type.attributes,
594
582
  filterPublic
595
583
  )) {
596
584
  const name = path.join(".");
package/src/cluster.mjs CHANGED
@@ -38,7 +38,6 @@ export class Cluster extends Host {
38
38
  checkInterval: { ...duration_attribute_writable, default: 60 }
39
39
  };
40
40
 
41
- static typeDefinition = this;
42
41
 
43
42
  static {
44
43
  addType(this);
@@ -16,7 +16,6 @@ export class ExtraSourceService extends Service {
16
16
  }
17
17
  };
18
18
 
19
- static typeDefinition = this;
20
19
 
21
20
  static {
22
21
  addType(this);
package/src/host.mjs CHANGED
@@ -87,7 +87,6 @@ export class Host extends ServiceOwner {
87
87
  isModel: boolean_attribute_false
88
88
  };
89
89
 
90
- static typeDefinition = this;
91
90
 
92
91
  static {
93
92
  addType(this);
@@ -188,7 +188,7 @@ export class InitializationContext {
188
188
  return object;
189
189
  }
190
190
 
191
- read(object, data, type = object.constructor.typeDefinition) {
191
+ read(object, data, type = object.constructor) {
192
192
  if (data?.properties) {
193
193
  Object.assign(object.properties, data.properties);
194
194
  }
@@ -200,7 +200,7 @@ export class InitializationContext {
200
200
  }
201
201
  }
202
202
 
203
- _read(object, data, type = object.constructor.typeDefinition) {
203
+ _read(object, data, type) {
204
204
  if (type.extends) {
205
205
  this._read(object, data, type.extends);
206
206
  }
package/src/location.mjs CHANGED
@@ -11,7 +11,6 @@ export class Location extends Owner {
11
11
  static key = "name";
12
12
  static attributes = {};
13
13
 
14
- static typeDefinition = this;
15
14
 
16
15
  static {
17
16
  addType(this);
@@ -15,8 +15,6 @@ export class EthernetNetworkInterface extends NetworkInterface {
15
15
  }
16
16
  };
17
17
 
18
- static typeDefinition = this;
19
-
20
18
  static {
21
19
  addType(this);
22
20
  }
@@ -17,8 +17,6 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
17
17
  static owners = NetworkInterface.owners;
18
18
  static key = "name";
19
19
 
20
- static typeDefinition = this;
21
-
22
20
  static {
23
21
  addType(this);
24
22
  }
@@ -28,7 +26,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
28
26
  }
29
27
 
30
28
  get kind() {
31
- return "loopback";
29
+ return this.constructor.name;
32
30
  }
33
31
 
34
32
  set scope(v) {}
@@ -61,8 +61,6 @@ export class NetworkInterface extends SkeletonNetworkInterface {
61
61
  destination: string_attribute_writable
62
62
  };
63
63
 
64
- static typeDefinition = this;
65
-
66
64
  static {
67
65
  addType(this);
68
66
  }
@@ -8,14 +8,12 @@ export class TUNNetworkInterface extends NetworkInterface {
8
8
  static owners = NetworkInterface.owners;
9
9
  static key = "name";
10
10
 
11
- static typeDefinition = this;
12
-
13
11
  static {
14
12
  addType(this);
15
13
  }
16
14
 
17
15
  get kind() {
18
- return "tun";
16
+ return this.constructor.name;
19
17
  }
20
18
 
21
19
  async systemdDefinitions(dir, packageData) {}
@@ -9,14 +9,13 @@ export class WireguardNetworkInterface extends SkeletonNetworkInterface {
9
9
  static owners = NetworkInterface.owners;
10
10
  static key = "name";
11
11
 
12
- static typeDefinition = this;
13
12
 
14
13
  static {
15
14
  addType(this);
16
15
  }
17
16
 
18
17
  get kind() {
19
- return "wireguard";
18
+ return this.constructor.name;
20
19
  }
21
20
 
22
21
  get ipAddresses() {
@@ -21,8 +21,6 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
21
21
  secretName: string_attribute_writable
22
22
  };
23
23
 
24
- static typeDefinition = this;
25
-
26
24
  static {
27
25
  addType(this);
28
26
  }
@@ -36,7 +34,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
36
34
  _secretName;
37
35
 
38
36
  get kind() {
39
- return "wlan";
37
+ return this.constructor.name;
40
38
  }
41
39
 
42
40
  set secretName(value) {
package/src/network.mjs CHANGED
@@ -19,7 +19,6 @@ export class Network extends Owner {
19
19
  gateway: { ...default_attribute_writable, type: "host" }
20
20
  };
21
21
 
22
- static typeDefinition = this;
23
22
 
24
23
  static {
25
24
  addType(this);
package/src/owner.mjs CHANGED
@@ -44,7 +44,6 @@ export class Owner extends Base {
44
44
  template: { ...boolean_attribute_writable, private: true }
45
45
  };
46
46
 
47
- static typeDefinition = this;
48
47
 
49
48
  static {
50
49
  addType(this);
package/src/root.mjs CHANGED
@@ -4,7 +4,6 @@ import { Location } from "./location.mjs";
4
4
  export class Root extends Location {
5
5
  static name = "root";
6
6
  static priority = 3;
7
- static typeDefinition = this;
8
7
 
9
8
  static {
10
9
  addType(this);
package/src/service.mjs CHANGED
@@ -74,7 +74,6 @@ export class Service extends Base {
74
74
  systemdService: string_attribute_writable
75
75
  };
76
76
 
77
- static typeDefinition = this;
78
77
 
79
78
  static {
80
79
  addType(this);
@@ -18,7 +18,6 @@ class ALPMRepository extends Base {
18
18
  architectures: string_set_attribute_writable
19
19
  };
20
20
 
21
- static typeDefinition = this;
22
21
  static {
23
22
  addType(this);
24
23
  }
@@ -42,7 +41,6 @@ export class ALPMService extends Service {
42
41
  extends: ["https", "http"]
43
42
  };
44
43
 
45
- static typeDefinition = this;
46
44
  static {
47
45
  addType(this);
48
46
  addServiceType(this.service, this.name);
@@ -77,7 +77,6 @@ class bind_group extends Base {
77
77
  minimum: { ...duration_attribute_writable, default: 60000 }
78
78
  };
79
79
 
80
- static typeDefinition = this;
81
80
  static {
82
81
  addType(this);
83
82
  }
@@ -454,7 +453,6 @@ export class BindService extends ExtraSourceService {
454
453
  }
455
454
  };
456
455
 
457
- static typeDefinition = this;
458
456
 
459
457
  static {
460
458
  addType(this);
@@ -40,7 +40,6 @@ export class ChronyService extends ExtraSourceService {
40
40
  }
41
41
  };
42
42
 
43
- static typeDefinition = this;
44
43
  static {
45
44
  addType(this);
46
45
  addServiceType(this.service, this.name);
@@ -37,7 +37,6 @@ export class HeadscaleService extends Service {
37
37
  }
38
38
  ]
39
39
  };
40
- static typeDefinition = this;
41
40
  static {
42
41
  addType(this);
43
42
  addServiceType(this.service, this.name);
@@ -42,7 +42,6 @@ export class InfluxdbService extends Service {
42
42
  ]
43
43
  };
44
44
 
45
- static typeDefinition = this;
46
45
  static {
47
46
  addType(this);
48
47
  addServiceType(this.service, this.name);
@@ -127,7 +127,6 @@ export class KeaService extends Service {
127
127
  }
128
128
  };
129
129
 
130
- static typeDefinition = this;
131
130
  static {
132
131
  addType(this);
133
132
  addServiceType(this.service, this.name);
@@ -31,7 +31,6 @@ export class MosquittoService extends Service {
31
31
  static service = {
32
32
  extends: ["mqtt"]
33
33
  };
34
- static typeDefinition = this;
35
34
  static {
36
35
  addType(this);
37
36
  addServiceType(this.service, this.name);
@@ -19,7 +19,6 @@ export class OpenLDAPService extends Service {
19
19
  services: {}
20
20
  };
21
21
 
22
- static typeDefinition = this;
23
22
  static {
24
23
  addType(this);
25
24
  addServiceType(this.service, this.name);
@@ -16,7 +16,6 @@ export class PostfixService extends Service {
16
16
  services: {}
17
17
  };
18
18
 
19
- static typeDefinition = this;
20
19
  static {
21
20
  addType(this);
22
21
  addServiceType(this.service, this.name);
@@ -86,7 +86,6 @@ export class SystemdJournalRemoteService extends Service {
86
86
  ]
87
87
  };
88
88
 
89
- static typeDefinition = this;
90
89
  static {
91
90
  addType(this);
92
91
  addServiceType(this.service, this.name);
@@ -50,7 +50,6 @@ export class SystemdJournalUploadService extends Service {
50
50
  static service = {
51
51
  systemdService: "systemd-journal-upload.service"
52
52
  };
53
- static typeDefinition = this;
54
53
  static {
55
54
  addType(this);
56
55
  addServiceType(this.service, this.name);
@@ -110,7 +110,6 @@ export class SystemdJournaldService extends Service {
110
110
  static service = {
111
111
  systemdService: "systemd-journald.service"
112
112
  };
113
- static typeDefinition = this;
114
113
  static {
115
114
  addType(this);
116
115
  addServiceType(this.service, this.name);
@@ -75,7 +75,6 @@ export class SystemdResolvedService extends ExtraSourceService {
75
75
  systemdService: "systemd-resolved.service"
76
76
  };
77
77
 
78
- static typeDefinition = this;
79
78
  static {
80
79
  addType(this);
81
80
  addServiceType(this.service, this.name);
@@ -31,7 +31,6 @@ export class SystemdTimesyncdService extends ExtraSourceService {
31
31
  systemdService: "systemd-timesyncd.service"
32
32
  };
33
33
 
34
- static typeDefinition = this;
35
34
  static {
36
35
  addType(this);
37
36
  addServiceType(this.service, this.name);
@@ -19,8 +19,6 @@ export class TailscaleService extends Service {
19
19
  ]
20
20
  };
21
21
 
22
- static typeDefinition = this;
23
-
24
22
  static {
25
23
  addType(this);
26
24
  }
package/src/subnet.mjs CHANGED
@@ -28,7 +28,6 @@ export class Subnet extends Base {
28
28
  family: string_attribute
29
29
  };
30
30
 
31
- static typeDefinition = this;
32
31
 
33
32
  static {
34
33
  addType(this);