pmcf 2.62.1 → 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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/base.mjs +17 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.62.1",
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
@@ -142,11 +142,7 @@ export class Base {
142
142
 
143
143
  const instantiateAndAssign = (property, value) => {
144
144
  if (primitives.has(property.type[0])) {
145
- if (value !== undefined) {
146
- value = this.expand(value);
147
- assign(property, value);
148
- //console.log("A1",property.name,value);
149
- }
145
+ assign(property, value);
150
146
  return;
151
147
  }
152
148
 
@@ -162,8 +158,6 @@ export class Base {
162
158
  case "number":
163
159
  case "string":
164
160
  {
165
- value = this.expand(value);
166
-
167
161
  let object;
168
162
 
169
163
  for (const type of property.type) {
@@ -232,7 +226,8 @@ export class Base {
232
226
 
233
227
  for (const property of Object.values(type.properties)) {
234
228
  if (property.writeable) {
235
- const value = data[property.name];
229
+ const value = this.expand(data[property.name]);
230
+
236
231
  if (property.collection) {
237
232
  if (typeof value === "object") {
238
233
  if (Array.isArray(value)) {
@@ -244,7 +239,9 @@ export class Base {
244
239
  assign(property, value);
245
240
  } else {
246
241
  for (const [objectName, objectData] of Object.entries(value)) {
247
- objectData[type.identifier.name] = objectName;
242
+ if (typeof objectData === "object") {
243
+ objectData[type.identifier.name] = objectName;
244
+ }
248
245
  instantiateAndAssign(property, objectData);
249
246
  }
250
247
  }
@@ -482,17 +479,24 @@ export class Base {
482
479
  });
483
480
 
484
481
  case "object":
485
- if (Array.isArray(object)) {
486
- 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
487
487
  }
488
488
 
489
489
  if (object instanceof Set) {
490
490
  return new Set([...object].map(e => this.expand(e)));
491
491
  }
492
492
 
493
- /*return Object.fromEntries(
493
+ if (Array.isArray(object)) {
494
+ return object.map(e => this.expand(e));
495
+ }
496
+
497
+ return Object.fromEntries(
494
498
  Object.entries(object).map(([k, v]) => [k, this.expand(v)])
495
- );*/
499
+ );
496
500
  }
497
501
 
498
502
  return object;