pmcf 2.62.0 → 2.62.2

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.62.0",
3
+ "version": "2.62.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -19,8 +19,8 @@
19
19
  "iwd",
20
20
  "kea",
21
21
  "keepalived",
22
- "systemd",
23
- "openldap"
22
+ "openldap",
23
+ "systemd"
24
24
  ],
25
25
  "contributors": [
26
26
  {
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;
@@ -158,8 +158,6 @@ export class Base {
158
158
  case "number":
159
159
  case "string":
160
160
  {
161
- value = this.expand(value);
162
-
163
161
  let object;
164
162
 
165
163
  for (const type of property.type) {
@@ -222,13 +220,14 @@ export class Base {
222
220
  }
223
221
  };
224
222
 
225
- if(data?.properties) {
223
+ if (data?.properties) {
226
224
  this._properties = data.properties;
227
225
  }
228
226
 
229
227
  for (const property of Object.values(type.properties)) {
230
228
  if (property.writeable) {
231
- const value = data[property.name];
229
+ const value = this.expand(data[property.name]);
230
+
232
231
  if (property.collection) {
233
232
  if (typeof value === "object") {
234
233
  if (Array.isArray(value)) {
@@ -240,7 +239,9 @@ export class Base {
240
239
  assign(property, value);
241
240
  } else {
242
241
  for (const [objectName, objectData] of Object.entries(value)) {
243
- objectData[type.identifier.name] = objectName;
242
+ if (typeof objectData === "object") {
243
+ objectData[type.identifier.name] = objectName;
244
+ }
244
245
  instantiateAndAssign(property, objectData);
245
246
  }
246
247
  }
@@ -382,8 +383,8 @@ export class Base {
382
383
  }
383
384
 
384
385
  /**
385
- *
386
- * @param {any} filter
386
+ *
387
+ * @param {any} filter
387
388
  * @returns service with the highest priority
388
389
  */
389
390
  findService(filter) {
@@ -459,7 +460,7 @@ export class Base {
459
460
 
460
461
  property(name) {
461
462
  const value = this._properties?.[name];
462
- if(value === undefined && this.owner) {
463
+ if (value === undefined && this.owner) {
463
464
  return this.owner.property(name);
464
465
  }
465
466
 
@@ -478,17 +479,24 @@ export class Base {
478
479
  });
479
480
 
480
481
  case "object":
481
- if (Array.isArray(object)) {
482
- return object.map(e => this.expand(e));
482
+ if (object instanceof Base) {
483
+ return object;
484
+ }
485
+ if (object instanceof Map) {
486
+ return object; // TODO
483
487
  }
484
488
 
485
489
  if (object instanceof Set) {
486
490
  return new Set([...object].map(e => this.expand(e)));
487
491
  }
488
492
 
489
- /*return Object.fromEntries(
493
+ if (Array.isArray(object)) {
494
+ return object.map(e => this.expand(e));
495
+ }
496
+
497
+ return Object.fromEntries(
490
498
  Object.entries(object).map(([k, v]) => [k, this.expand(v)])
491
- );*/
499
+ );
492
500
  }
493
501
 
494
502
  return object;
package/src/host.mjs CHANGED
@@ -211,7 +211,7 @@ export class Host extends ServiceOwner {
211
211
  }
212
212
 
213
213
  get isTemplate() {
214
- return this.isModel || this.name.match(/services\//); // TODO
214
+ return this.isModel || this.name?.match(/services\//); // TODO
215
215
  }
216
216
 
217
217
  get isModel() {
@@ -27,7 +27,7 @@ export class SkeletonNetworkInterface extends ServiceOwner {
27
27
  }
28
28
 
29
29
  get isTemplate() {
30
- return this.name.indexOf("*") >= 0;
30
+ return this.name?.indexOf("*") >= 0;
31
31
  }
32
32
 
33
33
  get host() {