pmcf 2.8.0 → 2.9.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.8.0",
3
+ "version": "2.9.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -274,6 +274,32 @@ export class Base {
274
274
  return this.constructor.typeDefinition.name;
275
275
  }
276
276
 
277
+ get extends() {
278
+ return [];
279
+ }
280
+
281
+ _extendedProperty(propertyName, seen) {
282
+ if (!seen.has(this)) {
283
+ seen.add(this);
284
+ for (const e of this.extends) {
285
+ const value =
286
+ e[propertyName] ?? e._extendedProperty(propertyName, seen);
287
+ if (value !== undefined) {
288
+ return value;
289
+ }
290
+ }
291
+ }
292
+ }
293
+
294
+ extendedProperty(propertyName) {
295
+ const value = this[propertyName];
296
+ if (value !== undefined) {
297
+ return value;
298
+ }
299
+
300
+ return this._extendedProperty(propertyName, new Set());
301
+ }
302
+
277
303
  get root() {
278
304
  return this.owner.root;
279
305
  }
package/src/host.mjs CHANGED
@@ -107,9 +107,6 @@ export class Host extends Base {
107
107
  if (data.extends) {
108
108
  this.finalize(() => {
109
109
  for (const host of this.extends) {
110
- if (host === this) {
111
- this.error("Cant extend myself");
112
- }
113
110
  host.execFinalize();
114
111
  this._applyExtends(host);
115
112
  }
@@ -156,7 +153,7 @@ export class Host extends Base {
156
153
  }
157
154
 
158
155
  get serial() {
159
- return this._serial ?? this.extends.find(e => e.serial)?.serial;
156
+ return this.extendedProperty("_serial");
160
157
  }
161
158
 
162
159
  set deployment(value) {
@@ -164,7 +161,7 @@ export class Host extends Base {
164
161
  }
165
162
 
166
163
  get deployment() {
167
- return this._deployment ?? this.extends.find(e => e.deployment)?.deployment;
164
+ return this.extendedProperty("_deployment");
168
165
  }
169
166
 
170
167
  set chassis(value) {
@@ -172,7 +169,7 @@ export class Host extends Base {
172
169
  }
173
170
 
174
171
  get chassis() {
175
- return this._chassis ?? this.extends.find(e => e.chassis)?.chassis;
172
+ return this.extendedProperty("_chassis");
176
173
  }
177
174
 
178
175
  set vendor(value) {
@@ -180,7 +177,7 @@ export class Host extends Base {
180
177
  }
181
178
 
182
179
  get vendor() {
183
- return this._vendor ?? this.extends.find(e => e.vendor)?.vendor;
180
+ return this.extendedProperty("_vendor");
184
181
  }
185
182
 
186
183
  set architecture(value) {
@@ -188,9 +185,7 @@ export class Host extends Base {
188
185
  }
189
186
 
190
187
  get architecture() {
191
- return (
192
- this._architecture ?? this.extends.find(e => e.architecture)?.architecture
193
- );
188
+ return this.extendedProperty("_architecture");
194
189
  }
195
190
 
196
191
  get derivedPackaging() {
@@ -276,7 +271,7 @@ export class Host extends Base {
276
271
  }
277
272
 
278
273
  get os() {
279
- return this._os ?? this.extends.find(e => e.os)?.os;
274
+ return this.extendedProperty("_os");
280
275
  }
281
276
 
282
277
  set distribution(value) {
@@ -284,9 +279,7 @@ export class Host extends Base {
284
279
  }
285
280
 
286
281
  get distribution() {
287
- return (
288
- this._distribution ?? this.extends.find(e => e.distribution)?.distribution
289
- );
282
+ return this.extendedProperty("_distribution");
290
283
  }
291
284
 
292
285
  get modelName() {
@@ -522,7 +515,8 @@ export class NetworkInterface extends Base {
522
515
  _kind;
523
516
  _hostName;
524
517
  _hwaddr;
525
- extends = [];
518
+ _class;
519
+ _extends = [];
526
520
  arpbridge;
527
521
 
528
522
  constructor(owner, data) {
@@ -616,7 +610,7 @@ export class NetworkInterface extends Base {
616
610
  }
617
611
 
618
612
  get hostName() {
619
- return this._hostName ?? this.host.hostName;
613
+ return this.extendedProperty("_hostName") ?? this.host.hostName;
620
614
  }
621
615
 
622
616
  set hostName(value) {
@@ -637,14 +631,16 @@ export class NetworkInterface extends Base {
637
631
  return this;
638
632
  }
639
633
 
640
- extendedProperty(name) {
641
- return this.extends.find(i => i[name])?.[name];
634
+ set extends(value) {
635
+ this._extends.push(value);
636
+ }
637
+
638
+ get extends() {
639
+ return this._extends;
642
640
  }
643
641
 
644
642
  get network() {
645
- return (
646
- this._network ?? this.extendedProperty("_network") ?? this.host.network
647
- );
643
+ return this.extendedProperty("_network") ?? this.host.network;
648
644
  }
649
645
 
650
646
  set network(network) {
@@ -656,12 +652,7 @@ export class NetworkInterface extends Base {
656
652
  }
657
653
 
658
654
  get scope() {
659
- return (
660
- this._scope ??
661
- this.extendedProperty("_scope") ??
662
- this.network?.scope ??
663
- "global"
664
- );
655
+ return this.extendedProperty("_scope") ?? this.network?.scope ?? "global";
665
656
  }
666
657
 
667
658
  set hwaddr(value) {
@@ -669,7 +660,7 @@ export class NetworkInterface extends Base {
669
660
  }
670
661
 
671
662
  get hwaddr() {
672
- return this._hwaddr ?? this.extendedProperty("_hwaddr");
663
+ return this.extendedProperty("_hwaddr");
673
664
  }
674
665
 
675
666
  set metric(value) {
@@ -677,12 +668,15 @@ export class NetworkInterface extends Base {
677
668
  }
678
669
 
679
670
  get metric() {
680
- return (
681
- this._metric ??
682
- this.extendedProperty("_metric") ??
683
- this.network?.metric ??
684
- 1004
685
- );
671
+ return this.extendedProperty("_metric") ?? this.network?.metric ?? 1004;
672
+ }
673
+
674
+ set class(value) {
675
+ this._class = value;
676
+ }
677
+
678
+ get class() {
679
+ return this.extendedProperty("_class") ?? this.network?.class;
686
680
  }
687
681
 
688
682
  set ssid(value) {
@@ -690,7 +684,7 @@ export class NetworkInterface extends Base {
690
684
  }
691
685
 
692
686
  get ssid() {
693
- return this._ssid ?? this.extendedProperty("_ssid") ?? this.network?.ssid;
687
+ return this.extendedProperty("_ssid") ?? this.network?.ssid;
694
688
  }
695
689
 
696
690
  set psk(value) {
@@ -698,7 +692,7 @@ export class NetworkInterface extends Base {
698
692
  }
699
693
 
700
694
  get psk() {
701
- return this._psk ?? this.extendedProperty("_psk") ?? this.network?.psk;
695
+ return this.extendedProperty("_psk") ?? this.network?.psk;
702
696
  }
703
697
 
704
698
  set kind(value) {
@@ -706,8 +700,6 @@ export class NetworkInterface extends Base {
706
700
  }
707
701
 
708
702
  get kind() {
709
- return (
710
- this._kind ?? this.extendedProperty("_kind") ?? this.network?.kind
711
- );
703
+ return this.extendedProperty("_kind") ?? this.network?.kind;
712
704
  }
713
705
  }
@@ -5,6 +5,12 @@ export const networkProperties = {
5
5
  writeable: true,
6
6
  values: ["global", "site", "link", "host"]
7
7
  },
8
+ class: {
9
+ type: "string",
10
+ collection: false,
11
+ writeable: true,
12
+ values: ["10GBASE-T", "1000BASE-T", "100BASE-T", "10BASE-T"]
13
+ },
8
14
  kind: {
9
15
  type: "string",
10
16
  collection: false,
@@ -13,10 +19,10 @@ export const networkProperties = {
13
19
  },
14
20
  ssid: { type: "string", collection: false, writeable: true },
15
21
  psk: { type: "string", collection: false, writeable: true },
16
- metric: { type: "number", collection: false, writeable: true },
17
- MTU: { type: "number", collection: false, writeable: true },
22
+ metric: { type: "number", collection: false, writeable: true, default: 1004 },
23
+ MTU: { type: "number", collection: false, writeable: true, default: 1500 },
18
24
  gateway: { type: "host", collection: false, writeable: true },
19
- multicastDNS: { type: "boolean", collection: false, writeable: true }
25
+ multicastDNS: { type: "boolean", collection: false, writeable: true, default: false }
20
26
  };
21
27
 
22
28
  export const networkAddressProperties = {
package/src/service.mjs CHANGED
@@ -88,8 +88,8 @@ export const ServiceTypeDefinition = {
88
88
  },
89
89
  alias: { type: "string", collection: false, writeable: true },
90
90
  type: { type: "string", collection: false, writeable: true },
91
- weight: { type: "number", collection: false, writeable: true },
92
- tls: { type: "string", collection: false, writeable: false },
91
+ weight: { type: "number", collection: false, writeable: true, default: 1 },
92
+ tls: { type: "string", collection: false, writeable: false, default: false },
93
93
  systemd: { type: "string", collection: true, writeable: true }
94
94
  }
95
95
  };
@@ -27,15 +27,16 @@ const DNSServiceTypeDefinition = {
27
27
  trusted: { type: "network", collection: true, writeable: true },
28
28
  protected: { type: "network", collection: true, writeable: true },
29
29
  open: { type: "network", collection: true, writeable: true },
30
- hasSVRRecords: { type: "boolean", collection: false, writeable: true },
31
- hasCatalog: { type: "boolean", collection: false, writeable: true },
30
+ hasSVRRecords: { type: "boolean", collection: false, writeable: true, default: false },
31
+ hasCatalog: { type: "boolean", collection: false, writeable: true, default: false },
32
32
  hasLinkLocalAdresses: {
33
33
  type: "boolean",
34
34
  collection: false,
35
- writeable: true
35
+ writeable: true,
36
+ default: false
36
37
  },
37
38
  exclude: { type: "network", collection: true, writeable: true },
38
- notify: { type: "boolean", collection: false, writeable: true },
39
+ notify: { type: "boolean", collection: false, writeable: true, default: false },
39
40
  recordTTL: { type: "string", collection: false, writeable: true },
40
41
  serial: { type: "number", collection: false, writeable: true },
41
42
  refresh: { type: "string", collection: false, writeable: true },
package/types/base.d.mts CHANGED
@@ -67,6 +67,9 @@ export class Base {
67
67
  isNamed(name: any): boolean;
68
68
  relativeName(name: any): any;
69
69
  get typeName(): any;
70
+ get extends(): any[];
71
+ _extendedProperty(propertyName: any, seen: any): any;
72
+ extendedProperty(propertyName: any): any;
70
73
  get root(): any;
71
74
  get location(): any;
72
75
  get host(): any;
@@ -99,11 +99,13 @@ export class ExtraSourceService extends Service {
99
99
  type: string;
100
100
  collection: boolean;
101
101
  writeable: boolean;
102
+ default: number;
102
103
  };
103
104
  tls: {
104
105
  type: string;
105
106
  collection: boolean;
106
107
  writeable: boolean;
108
+ default: boolean;
107
109
  };
108
110
  systemd: {
109
111
  type: string;
package/types/host.d.mts CHANGED
@@ -366,6 +366,12 @@ export class NetworkInterface extends Base {
366
366
  writeable: boolean;
367
367
  values: string[];
368
368
  };
369
+ class: {
370
+ type: string;
371
+ collection: boolean;
372
+ writeable: boolean;
373
+ values: string[];
374
+ };
369
375
  kind: {
370
376
  type: string;
371
377
  collection: boolean;
@@ -386,11 +392,13 @@ export class NetworkInterface extends Base {
386
392
  type: string;
387
393
  collection: boolean;
388
394
  writeable: boolean;
395
+ default: number;
389
396
  };
390
397
  MTU: {
391
398
  type: string;
392
399
  collection: boolean;
393
400
  writeable: boolean;
401
+ default: number;
394
402
  };
395
403
  gateway: {
396
404
  type: string;
@@ -401,6 +409,7 @@ export class NetworkInterface extends Base {
401
409
  type: string;
402
410
  collection: boolean;
403
411
  writeable: boolean;
412
+ default: boolean;
404
413
  };
405
414
  };
406
415
  };
@@ -413,7 +422,8 @@ export class NetworkInterface extends Base {
413
422
  _kind: any;
414
423
  _hostName: any;
415
424
  _hwaddr: any;
416
- extends: any[];
425
+ _class: any;
426
+ _extends: any[];
417
427
  arpbridge: any;
418
428
  matches(other: any): boolean;
419
429
  addSubnet(address: any): any;
@@ -432,7 +442,8 @@ export class NetworkInterface extends Base {
432
442
  get hostName(): any;
433
443
  get domainNames(): any;
434
444
  get network_interface(): this;
435
- extendedProperty(name: any): any;
445
+ set extends(value: any[]);
446
+ get extends(): any[];
436
447
  set network(network: any);
437
448
  get network(): any;
438
449
  set scope(value: any);
@@ -441,6 +452,8 @@ export class NetworkInterface extends Base {
441
452
  get hwaddr(): any;
442
453
  set metric(value: any);
443
454
  get metric(): any;
455
+ set class(value: any);
456
+ get class(): any;
444
457
  set ssid(value: any);
445
458
  get ssid(): any;
446
459
  set psk(value: any);
@@ -1,11 +1,11 @@
1
1
  export namespace networkProperties {
2
- namespace scope {
2
+ export namespace scope {
3
3
  let type: string;
4
4
  let collection: boolean;
5
5
  let writeable: boolean;
6
6
  let values: string[];
7
7
  }
8
- namespace kind {
8
+ export namespace _class {
9
9
  let type_1: string;
10
10
  export { type_1 as type };
11
11
  let collection_1: boolean;
@@ -15,15 +15,18 @@ export namespace networkProperties {
15
15
  let values_1: string[];
16
16
  export { values_1 as values };
17
17
  }
18
- namespace ssid {
18
+ export { _class as class };
19
+ export namespace kind {
19
20
  let type_2: string;
20
21
  export { type_2 as type };
21
22
  let collection_2: boolean;
22
23
  export { collection_2 as collection };
23
24
  let writeable_2: boolean;
24
25
  export { writeable_2 as writeable };
26
+ let values_2: string[];
27
+ export { values_2 as values };
25
28
  }
26
- namespace psk {
29
+ export namespace ssid {
27
30
  let type_3: string;
28
31
  export { type_3 as type };
29
32
  let collection_3: boolean;
@@ -31,7 +34,7 @@ export namespace networkProperties {
31
34
  let writeable_3: boolean;
32
35
  export { writeable_3 as writeable };
33
36
  }
34
- namespace metric {
37
+ export namespace psk {
35
38
  let type_4: string;
36
39
  export { type_4 as type };
37
40
  let collection_4: boolean;
@@ -39,23 +42,27 @@ export namespace networkProperties {
39
42
  let writeable_4: boolean;
40
43
  export { writeable_4 as writeable };
41
44
  }
42
- namespace MTU {
45
+ export namespace metric {
43
46
  let type_5: string;
44
47
  export { type_5 as type };
45
48
  let collection_5: boolean;
46
49
  export { collection_5 as collection };
47
50
  let writeable_5: boolean;
48
51
  export { writeable_5 as writeable };
52
+ let _default: number;
53
+ export { _default as default };
49
54
  }
50
- namespace gateway {
55
+ export namespace MTU {
51
56
  let type_6: string;
52
57
  export { type_6 as type };
53
58
  let collection_6: boolean;
54
59
  export { collection_6 as collection };
55
60
  let writeable_6: boolean;
56
61
  export { writeable_6 as writeable };
62
+ let _default_1: number;
63
+ export { _default_1 as default };
57
64
  }
58
- namespace multicastDNS {
65
+ export namespace gateway {
59
66
  let type_7: string;
60
67
  export { type_7 as type };
61
68
  let collection_7: boolean;
@@ -63,17 +70,19 @@ export namespace networkProperties {
63
70
  let writeable_7: boolean;
64
71
  export { writeable_7 as writeable };
65
72
  }
66
- }
67
- export namespace networkAddressProperties {
68
- namespace hostName {
73
+ export namespace multicastDNS {
69
74
  let type_8: string;
70
75
  export { type_8 as type };
71
76
  let collection_8: boolean;
72
77
  export { collection_8 as collection };
73
78
  let writeable_8: boolean;
74
79
  export { writeable_8 as writeable };
80
+ let _default_2: boolean;
81
+ export { _default_2 as default };
75
82
  }
76
- namespace cidrAddresses {
83
+ }
84
+ export namespace networkAddressProperties {
85
+ namespace hostName {
77
86
  let type_9: string;
78
87
  export { type_9 as type };
79
88
  let collection_9: boolean;
@@ -81,7 +90,7 @@ export namespace networkAddressProperties {
81
90
  let writeable_9: boolean;
82
91
  export { writeable_9 as writeable };
83
92
  }
84
- namespace cidrAddress {
93
+ namespace cidrAddresses {
85
94
  let type_10: string;
86
95
  export { type_10 as type };
87
96
  let collection_10: boolean;
@@ -89,7 +98,7 @@ export namespace networkAddressProperties {
89
98
  let writeable_10: boolean;
90
99
  export { writeable_10 as writeable };
91
100
  }
92
- namespace rawAddresses {
101
+ namespace cidrAddress {
93
102
  let type_11: string;
94
103
  export { type_11 as type };
95
104
  let collection_11: boolean;
@@ -97,7 +106,7 @@ export namespace networkAddressProperties {
97
106
  let writeable_11: boolean;
98
107
  export { writeable_11 as writeable };
99
108
  }
100
- namespace rawAddress {
109
+ namespace rawAddresses {
101
110
  let type_12: string;
102
111
  export { type_12 as type };
103
112
  let collection_12: boolean;
@@ -105,4 +114,12 @@ export namespace networkAddressProperties {
105
114
  let writeable_12: boolean;
106
115
  export { writeable_12 as writeable };
107
116
  }
117
+ namespace rawAddress {
118
+ let type_13: string;
119
+ export { type_13 as type };
120
+ let collection_13: boolean;
121
+ export { collection_13 as collection };
122
+ let writeable_13: boolean;
123
+ export { writeable_13 as writeable };
124
+ }
108
125
  }
@@ -152,6 +152,12 @@ export class Network extends Owner {
152
152
  writeable: boolean;
153
153
  values: string[];
154
154
  };
155
+ class: {
156
+ type: string;
157
+ collection: boolean;
158
+ writeable: boolean;
159
+ values: string[];
160
+ };
155
161
  kind: {
156
162
  type: string;
157
163
  collection: boolean;
@@ -172,16 +178,19 @@ export class Network extends Owner {
172
178
  type: string;
173
179
  collection: boolean;
174
180
  writeable: boolean;
181
+ default: number;
175
182
  };
176
183
  MTU: {
177
184
  type: string;
178
185
  collection: boolean;
179
186
  writeable: boolean;
187
+ default: number;
180
188
  };
181
189
  multicastDNS: {
182
190
  type: string;
183
191
  collection: boolean;
184
192
  writeable: boolean;
193
+ default: boolean;
185
194
  };
186
195
  };
187
196
  };
@@ -84,11 +84,13 @@ export namespace ServiceTypeDefinition {
84
84
  type: string;
85
85
  collection: boolean;
86
86
  writeable: boolean;
87
+ default: number;
87
88
  };
88
89
  tls: {
89
90
  type: string;
90
91
  collection: boolean;
91
92
  writeable: boolean;
93
+ default: boolean;
92
94
  };
93
95
  systemd: {
94
96
  type: string;
@@ -207,11 +209,13 @@ export class Service extends Base {
207
209
  type: string;
208
210
  collection: boolean;
209
211
  writeable: boolean;
212
+ default: number;
210
213
  };
211
214
  tls: {
212
215
  type: string;
213
216
  collection: boolean;
214
217
  writeable: boolean;
218
+ default: boolean;
215
219
  };
216
220
  systemd: {
217
221
  type: string;
@@ -85,11 +85,13 @@ export class DHCPService extends Service {
85
85
  type: string;
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
+ default: number;
88
89
  };
89
90
  tls: {
90
91
  type: string;
91
92
  collection: boolean;
92
93
  writeable: boolean;
94
+ default: boolean;
93
95
  };
94
96
  systemd: {
95
97
  type: string;
@@ -208,11 +210,13 @@ export class DHCPService extends Service {
208
210
  type: string;
209
211
  collection: boolean;
210
212
  writeable: boolean;
213
+ default: number;
211
214
  };
212
215
  tls: {
213
216
  type: string;
214
217
  collection: boolean;
215
218
  writeable: boolean;
219
+ default: boolean;
216
220
  };
217
221
  systemd: {
218
222
  type: string;
@@ -85,11 +85,13 @@ export class DNSService extends ExtraSourceService {
85
85
  type: string;
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
+ default: number;
88
89
  };
89
90
  tls: {
90
91
  type: string;
91
92
  collection: boolean;
92
93
  writeable: boolean;
94
+ default: boolean;
93
95
  };
94
96
  systemd: {
95
97
  type: string;
@@ -211,11 +213,13 @@ export class DNSService extends ExtraSourceService {
211
213
  type: string;
212
214
  collection: boolean;
213
215
  writeable: boolean;
216
+ default: number;
214
217
  };
215
218
  tls: {
216
219
  type: string;
217
220
  collection: boolean;
218
221
  writeable: boolean;
222
+ default: boolean;
219
223
  };
220
224
  systemd: {
221
225
  type: string;
@@ -279,16 +283,19 @@ export class DNSService extends ExtraSourceService {
279
283
  type: string;
280
284
  collection: boolean;
281
285
  writeable: boolean;
286
+ default: boolean;
282
287
  };
283
288
  hasCatalog: {
284
289
  type: string;
285
290
  collection: boolean;
286
291
  writeable: boolean;
292
+ default: boolean;
287
293
  };
288
294
  hasLinkLocalAdresses: {
289
295
  type: string;
290
296
  collection: boolean;
291
297
  writeable: boolean;
298
+ default: boolean;
292
299
  };
293
300
  exclude: {
294
301
  type: string;
@@ -299,6 +306,7 @@ export class DNSService extends ExtraSourceService {
299
306
  type: string;
300
307
  collection: boolean;
301
308
  writeable: boolean;
309
+ default: boolean;
302
310
  };
303
311
  recordTTL: {
304
312
  type: string;
@@ -85,11 +85,13 @@ export class NTPService extends ExtraSourceService {
85
85
  type: string;
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
+ default: number;
88
89
  };
89
90
  tls: {
90
91
  type: string;
91
92
  collection: boolean;
92
93
  writeable: boolean;
94
+ default: boolean;
93
95
  };
94
96
  systemd: {
95
97
  type: string;
@@ -211,11 +213,13 @@ export class NTPService extends ExtraSourceService {
211
213
  type: string;
212
214
  collection: boolean;
213
215
  writeable: boolean;
216
+ default: number;
214
217
  };
215
218
  tls: {
216
219
  type: string;
217
220
  collection: boolean;
218
221
  writeable: boolean;
222
+ default: boolean;
219
223
  };
220
224
  systemd: {
221
225
  type: string;