pmcf 4.7.0 → 4.8.0
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
package/src/base.mjs
CHANGED
|
@@ -367,49 +367,20 @@ export class Base {
|
|
|
367
367
|
return this.constructor.typeDefinition.name;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
370
|
+
/**
|
|
371
|
+
*
|
|
372
|
+
* @param {string} name
|
|
373
|
+
* @returns {any}
|
|
374
|
+
*/
|
|
375
|
+
extendedAttribute(name) {
|
|
376
|
+
for (const node of this.walkDirections(["this", "extends"])) {
|
|
377
|
+
const value = getAttribute(node, name);
|
|
375
378
|
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
|
-
}
|
|
379
|
+
return value;
|
|
400
380
|
}
|
|
401
381
|
}
|
|
402
382
|
}
|
|
403
383
|
|
|
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
384
|
/**
|
|
414
385
|
* Retrive attribute values from an object.
|
|
415
386
|
* @param {Function} [filter]
|
|
@@ -426,7 +397,7 @@ export class Base {
|
|
|
426
397
|
filter
|
|
427
398
|
)) {
|
|
428
399
|
const name = path.join(".");
|
|
429
|
-
const value = this.
|
|
400
|
+
const value = this.extendedAttribute(name);
|
|
430
401
|
|
|
431
402
|
if (value !== undefined) {
|
|
432
403
|
yield [def.externalName ?? name, toExternal(value, def), path, def];
|
|
@@ -616,7 +587,7 @@ export class Base {
|
|
|
616
587
|
}
|
|
617
588
|
|
|
618
589
|
getGlobal(a) {
|
|
619
|
-
return globals[a] ?? this.property(a);
|
|
590
|
+
return globals[a] ?? this.extendedAttribute(a) ?? this.property(a);
|
|
620
591
|
}
|
|
621
592
|
|
|
622
593
|
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
|
}
|
package/types/base.d.mts
CHANGED
|
@@ -66,9 +66,12 @@ export class Base {
|
|
|
66
66
|
isNamed(name: any): boolean;
|
|
67
67
|
relativeName(name: any): any;
|
|
68
68
|
get typeName(): any;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param {string} name
|
|
72
|
+
* @returns {any}
|
|
73
|
+
*/
|
|
74
|
+
extendedAttribute(name: string): any;
|
|
72
75
|
/**
|
|
73
76
|
* Retrive attribute values from an object.
|
|
74
77
|
* @param {Function} [filter]
|