pmcf 2.61.0 → 2.62.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 +23 -5
- package/src/host.mjs +1 -1
- package/src/network-interfaces/skeleton.mjs +1 -1
- package/types/base.d.mts +2 -0
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const BaseTypeDefinition = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
*
|
|
35
35
|
*/
|
|
36
36
|
export class Base {
|
|
37
37
|
owner;
|
|
@@ -41,6 +41,7 @@ export class Base {
|
|
|
41
41
|
_packaging = new Set();
|
|
42
42
|
_directory;
|
|
43
43
|
_finalize;
|
|
44
|
+
_properties;
|
|
44
45
|
|
|
45
46
|
static {
|
|
46
47
|
addType(this);
|
|
@@ -141,7 +142,11 @@ export class Base {
|
|
|
141
142
|
|
|
142
143
|
const instantiateAndAssign = (property, value) => {
|
|
143
144
|
if (primitives.has(property.type[0])) {
|
|
144
|
-
|
|
145
|
+
if (value !== undefined) {
|
|
146
|
+
value = this.expand(value);
|
|
147
|
+
assign(property, value);
|
|
148
|
+
//console.log("A1",property.name,value);
|
|
149
|
+
}
|
|
145
150
|
return;
|
|
146
151
|
}
|
|
147
152
|
|
|
@@ -221,6 +226,10 @@ export class Base {
|
|
|
221
226
|
}
|
|
222
227
|
};
|
|
223
228
|
|
|
229
|
+
if (data?.properties) {
|
|
230
|
+
this._properties = data.properties;
|
|
231
|
+
}
|
|
232
|
+
|
|
224
233
|
for (const property of Object.values(type.properties)) {
|
|
225
234
|
if (property.writeable) {
|
|
226
235
|
const value = data[property.name];
|
|
@@ -377,8 +386,8 @@ export class Base {
|
|
|
377
386
|
}
|
|
378
387
|
|
|
379
388
|
/**
|
|
380
|
-
*
|
|
381
|
-
* @param {any} filter
|
|
389
|
+
*
|
|
390
|
+
* @param {any} filter
|
|
382
391
|
* @returns service with the highest priority
|
|
383
392
|
*/
|
|
384
393
|
findService(filter) {
|
|
@@ -452,6 +461,15 @@ export class Base {
|
|
|
452
461
|
return false;
|
|
453
462
|
}
|
|
454
463
|
|
|
464
|
+
property(name) {
|
|
465
|
+
const value = this._properties?.[name];
|
|
466
|
+
if (value === undefined && this.owner) {
|
|
467
|
+
return this.owner.property(name);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return value;
|
|
471
|
+
}
|
|
472
|
+
|
|
455
473
|
expand(object) {
|
|
456
474
|
if (this.isTemplate) {
|
|
457
475
|
return object;
|
|
@@ -460,7 +478,7 @@ export class Base {
|
|
|
460
478
|
switch (typeof object) {
|
|
461
479
|
case "string":
|
|
462
480
|
return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
|
|
463
|
-
return getAttribute(this, m1) ?? "${" + m1 + "}";
|
|
481
|
+
return this.property(m1) ?? getAttribute(this, m1) ?? "${" + m1 + "}";
|
|
464
482
|
});
|
|
465
483
|
|
|
466
484
|
case "object":
|
package/src/host.mjs
CHANGED
package/types/base.d.mts
CHANGED
|
@@ -61,6 +61,7 @@ export class Base {
|
|
|
61
61
|
_packaging: Set<any>;
|
|
62
62
|
_directory: any;
|
|
63
63
|
_finalize: any;
|
|
64
|
+
_properties: any;
|
|
64
65
|
ownerFor(property: any, data: any): any;
|
|
65
66
|
read(data: any, type: any): void;
|
|
66
67
|
named(name: any): void;
|
|
@@ -106,6 +107,7 @@ export class Base {
|
|
|
106
107
|
set tags(value: Set<any>);
|
|
107
108
|
get tags(): Set<any>;
|
|
108
109
|
get isTemplate(): boolean;
|
|
110
|
+
property(name: any): any;
|
|
109
111
|
expand(object: any): any;
|
|
110
112
|
finalize(action: any): void;
|
|
111
113
|
execFinalize(): void;
|