pmcf 4.7.0 → 4.8.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 +1 -1
- package/src/base.mjs +13 -40
- package/src/host.mjs +8 -8
- package/src/network-interfaces/network-interface.mjs +7 -7
- package/src/network-interfaces/skeleton.mjs +1 -1
- package/src/network-interfaces/wlan.mjs +3 -3
- package/src/service.mjs +3 -3
- package/src/services/openldap.mjs +2 -2
- package/types/base.d.mts +8 -3
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -28,6 +28,8 @@ import { asArray } from "./utils.mjs";
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
*
|
|
31
|
+
* attributes: essential values
|
|
32
|
+
* properties: use defined values to support attribute value definitions
|
|
31
33
|
*/
|
|
32
34
|
export class Base {
|
|
33
35
|
static name = "base";
|
|
@@ -367,49 +369,20 @@ export class Base {
|
|
|
367
369
|
return this.constructor.typeDefinition.name;
|
|
368
370
|
}
|
|
369
371
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
/**
|
|
373
|
+
*
|
|
374
|
+
* @param {string} name
|
|
375
|
+
* @returns {any}
|
|
376
|
+
*/
|
|
377
|
+
extendedAttribute(name) {
|
|
378
|
+
for (const node of this.walkDirections(["this", "extends"])) {
|
|
379
|
+
const value = getAttribute(node, name);
|
|
375
380
|
if (value !== undefined) {
|
|
376
|
-
|
|
377
|
-
} else {
|
|
378
|
-
const value = this._properties?.[propertyName];
|
|
379
|
-
if (value !== undefined) {
|
|
380
|
-
yield value;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
for (const e of this.walkDirections(["extends"])) {
|
|
385
|
-
yield* e._extendedPropertyIterator(propertyName, seen);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
_extendedProperty(propertyName, seen) {
|
|
391
|
-
if (!seen.has(this)) {
|
|
392
|
-
seen.add(this);
|
|
393
|
-
for (const e of this.walkDirections(["extends"])) {
|
|
394
|
-
const value =
|
|
395
|
-
getAttribute(e, propertyName) ??
|
|
396
|
-
e._extendedProperty(propertyName, seen);
|
|
397
|
-
if (value !== undefined) {
|
|
398
|
-
return value;
|
|
399
|
-
}
|
|
381
|
+
return this.expand(value);
|
|
400
382
|
}
|
|
401
383
|
}
|
|
402
384
|
}
|
|
403
385
|
|
|
404
|
-
extendedProperty(propertyName) {
|
|
405
|
-
const value = getAttribute(this, propertyName);
|
|
406
|
-
if (value !== undefined) {
|
|
407
|
-
return value;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
return this._extendedProperty(propertyName, new Set());
|
|
411
|
-
}
|
|
412
|
-
|
|
413
386
|
/**
|
|
414
387
|
* Retrive attribute values from an object.
|
|
415
388
|
* @param {Function} [filter]
|
|
@@ -426,7 +399,7 @@ export class Base {
|
|
|
426
399
|
filter
|
|
427
400
|
)) {
|
|
428
401
|
const name = path.join(".");
|
|
429
|
-
const value = this.
|
|
402
|
+
const value = this.extendedAttribute(name);
|
|
430
403
|
|
|
431
404
|
if (value !== undefined) {
|
|
432
405
|
yield [def.externalName ?? name, toExternal(value, def), path, def];
|
|
@@ -616,7 +589,7 @@ export class Base {
|
|
|
616
589
|
}
|
|
617
590
|
|
|
618
591
|
getGlobal(a) {
|
|
619
|
-
return globals[a] ?? this.property(a);
|
|
592
|
+
return globals[a] ?? this.extendedAttribute(a) ?? this.property(a);
|
|
620
593
|
}
|
|
621
594
|
|
|
622
595
|
get properties() {
|
package/src/host.mjs
CHANGED
|
@@ -143,7 +143,7 @@ export class Host extends ServiceOwner {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
get serial() {
|
|
146
|
-
return this.
|
|
146
|
+
return this.extendedAttribute("_serial");
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
set deployment(value) {
|
|
@@ -151,7 +151,7 @@ export class Host extends ServiceOwner {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
get deployment() {
|
|
154
|
-
return this.
|
|
154
|
+
return this.extendedAttribute("_deployment");
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
set chassis(value) {
|
|
@@ -159,7 +159,7 @@ export class Host extends ServiceOwner {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
get chassis() {
|
|
162
|
-
return this.
|
|
162
|
+
return this.extendedAttribute("_chassis");
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
set vendor(value) {
|
|
@@ -167,7 +167,7 @@ export class Host extends ServiceOwner {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
get vendor() {
|
|
170
|
-
return this.
|
|
170
|
+
return this.extendedAttribute("_vendor");
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
set keymap(value) {
|
|
@@ -175,7 +175,7 @@ export class Host extends ServiceOwner {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
get keymap() {
|
|
178
|
-
return this.
|
|
178
|
+
return this.extendedAttribute("_keymap");
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
set architecture(value) {
|
|
@@ -183,7 +183,7 @@ export class Host extends ServiceOwner {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
get architecture() {
|
|
186
|
-
return this.
|
|
186
|
+
return this.extendedAttribute("_architecture");
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
get derivedPackaging() {
|
|
@@ -261,7 +261,7 @@ export class Host extends ServiceOwner {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
get os() {
|
|
264
|
-
return this.
|
|
264
|
+
return this.extendedAttribute("_os");
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
set distribution(value) {
|
|
@@ -269,7 +269,7 @@ export class Host extends ServiceOwner {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
get distribution() {
|
|
272
|
-
return this.
|
|
272
|
+
return this.extendedAttribute("_distribution");
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
get modelName() {
|
|
@@ -126,7 +126,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
get hostName() {
|
|
129
|
-
return this.
|
|
129
|
+
return this.extendedAttribute("_hostName") ?? this.host.hostName;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
set hostName(value) {
|
|
@@ -147,7 +147,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
147
147
|
|
|
148
148
|
get scope() {
|
|
149
149
|
return (
|
|
150
|
-
this.
|
|
150
|
+
this.extendedAttribute("_scope") ??
|
|
151
151
|
this.network?.scope ??
|
|
152
152
|
networkAttributes.scope.default
|
|
153
153
|
);
|
|
@@ -158,7 +158,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
get hwaddr() {
|
|
161
|
-
return this.
|
|
161
|
+
return this.extendedAttribute("_hwaddr");
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
set metric(value) {
|
|
@@ -167,7 +167,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
167
167
|
|
|
168
168
|
get metric() {
|
|
169
169
|
return (
|
|
170
|
-
this.
|
|
170
|
+
this.extendedAttribute("_metric") ??
|
|
171
171
|
this.network?.metric ??
|
|
172
172
|
networkAttributes.metric.default
|
|
173
173
|
);
|
|
@@ -178,7 +178,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
get mtu() {
|
|
181
|
-
return this.
|
|
181
|
+
return this.extendedAttribute("_mtu"); // ?? networkAttributes.mtu.default;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
set class(value) {
|
|
@@ -186,7 +186,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
get class() {
|
|
189
|
-
return this.
|
|
189
|
+
return this.extendedAttribute("_class") ?? this.network?.class;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
set kind(value) {
|
|
@@ -194,7 +194,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
get kind() {
|
|
197
|
-
return this.
|
|
197
|
+
return this.extendedAttribute("_kind") ?? this.network?.kind;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
async systemdDefinitions(packageData) {
|
|
@@ -52,7 +52,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
52
52
|
|
|
53
53
|
get secretName() {
|
|
54
54
|
return (
|
|
55
|
-
this.
|
|
55
|
+
this.extendedAttribute("_secretName") ??
|
|
56
56
|
this.network?.secretName ??
|
|
57
57
|
`${this.network.name}.password`
|
|
58
58
|
);
|
|
@@ -63,7 +63,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
get ssid() {
|
|
66
|
-
return this.
|
|
66
|
+
return this.extendedAttribute("_ssid") ?? this.network?.ssid;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
set psk(value) {
|
|
@@ -71,7 +71,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
get psk() {
|
|
74
|
-
return this.
|
|
74
|
+
return this.extendedAttribute("_psk") ?? this.network?.psk;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
async systemdDefinitions(packageData) {
|
package/src/service.mjs
CHANGED
|
@@ -218,7 +218,7 @@ export class Service extends Base {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
get alias() {
|
|
221
|
-
return this.
|
|
221
|
+
return this.extendedAttribute("_alias");
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
set port(value) {
|
|
@@ -234,7 +234,7 @@ export class Service extends Base {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
get weight() {
|
|
237
|
-
return this.
|
|
237
|
+
return this.extendedAttribute("_weight") ?? this.owner.weight ?? 1;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
set type(value) {
|
|
@@ -251,7 +251,7 @@ export class Service extends Base {
|
|
|
251
251
|
|
|
252
252
|
get systemdService() {
|
|
253
253
|
return (
|
|
254
|
-
this.
|
|
254
|
+
this.extendedAttribute("_systemdService") ??
|
|
255
255
|
ServiceTypes[this.type]?.systemdService
|
|
256
256
|
);
|
|
257
257
|
}
|
|
@@ -68,7 +68,7 @@ export class OpenLDAPService extends Service {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
get base() {
|
|
71
|
-
return this.
|
|
71
|
+
return this.extendedAttribute("_base");
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
set base(value) {
|
|
@@ -76,7 +76,7 @@ export class OpenLDAPService extends Service {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
get uri() {
|
|
79
|
-
return this._uri;
|
|
79
|
+
return this.extendedAttribute("_uri");
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
set uri(value) {
|
package/types/base.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export function extractFrom(object: any, typeDefinition?: any): any;
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
+
* attributes: essential values
|
|
5
|
+
* properties: use defined values to support attribute value definitions
|
|
4
6
|
*/
|
|
5
7
|
export class Base {
|
|
6
8
|
static name: string;
|
|
@@ -66,9 +68,12 @@ export class Base {
|
|
|
66
68
|
isNamed(name: any): boolean;
|
|
67
69
|
relativeName(name: any): any;
|
|
68
70
|
get typeName(): any;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {string} name
|
|
74
|
+
* @returns {any}
|
|
75
|
+
*/
|
|
76
|
+
extendedAttribute(name: string): any;
|
|
72
77
|
/**
|
|
73
78
|
* Retrive attribute values from an object.
|
|
74
79
|
* @param {Function} [filter]
|