pmcf 1.94.1 → 1.94.3

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": "1.94.1",
3
+ "version": "1.94.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -15,7 +15,7 @@ const BaseTypeDefinition = {
15
15
  identifier: true,
16
16
  writeable: true
17
17
  },
18
- /* fullName: {
18
+ /* fullName: {
19
19
  type: "string",
20
20
  collection: false,
21
21
  identifier: true,
@@ -198,9 +198,13 @@ export class Base {
198
198
  instantiateAndAssign(property, v);
199
199
  }
200
200
  } else {
201
- for (const [objectName, objectData] of Object.entries(value)) {
202
- objectData[type.identifier.name] = objectName;
203
- instantiateAndAssign(property, objectData);
201
+ if (value instanceof Base) {
202
+ assign(property, value);
203
+ } else {
204
+ for (const [objectName, objectData] of Object.entries(value)) {
205
+ objectData[type.identifier.name] = objectName;
206
+ instantiateAndAssign(property, objectData);
207
+ }
204
208
  }
205
209
  }
206
210
  continue;
@@ -370,13 +374,11 @@ export class Base {
370
374
  };
371
375
  }
372
376
 
373
- get tags()
374
- {
377
+ get tags() {
375
378
  return this.#tags;
376
379
  }
377
380
 
378
- set tags(value)
379
- {
381
+ set tags(value) {
380
382
  if (value instanceof Set) {
381
383
  this.#tags = this.#tags.union(value);
382
384
  } else {
@@ -384,7 +386,15 @@ export class Base {
384
386
  }
385
387
  }
386
388
 
389
+ get isTemplate() {
390
+ return false;
391
+ }
392
+
387
393
  expand(object) {
394
+ if (this.isTemplate) {
395
+ return object;
396
+ }
397
+
388
398
  switch (typeof object) {
389
399
  case "string":
390
400
  return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
package/src/host.mjs CHANGED
@@ -60,7 +60,6 @@ const HostTypeDefinition = {
60
60
  };
61
61
 
62
62
  export class Host extends Base {
63
- serial;
64
63
  priority = 1;
65
64
  #services = [];
66
65
  #extends = [];
@@ -76,6 +75,7 @@ export class Host extends Base {
76
75
  #chassis;
77
76
  #vendor;
78
77
  #architecture;
78
+ #serial;
79
79
 
80
80
  static {
81
81
  addType(this);
@@ -104,12 +104,6 @@ export class Host extends Base {
104
104
  this.services = service.forOwner(this);
105
105
  }
106
106
  }
107
-
108
- if (!this.isTemplate) {
109
- this.#depends = this.expand(this.depends);
110
- this.#provides = this.expand(this.provides);
111
- this.#replaces = this.expand(this.replaces);
112
- }
113
107
  });
114
108
  }
115
109
  }
@@ -128,6 +122,14 @@ export class Host extends Base {
128
122
  return false;
129
123
  }
130
124
 
125
+ set serial(value) {
126
+ this.#serial = value;
127
+ }
128
+
129
+ get serial() {
130
+ return this.#serial || this.extends.find(e => e.serial)?.serial;
131
+ }
132
+
131
133
  set deployment(value) {
132
134
  this.#deployment = value;
133
135
  }
@@ -207,7 +209,9 @@ export class Host extends Base {
207
209
  }
208
210
 
209
211
  get provides() {
210
- return this.#provides;
212
+ return this.expand(
213
+ this.extends.reduce((a, c) => a.union(c.provides), this.#provides)
214
+ );
211
215
  }
212
216
 
213
217
  set replaces(value) {
@@ -219,7 +223,9 @@ export class Host extends Base {
219
223
  }
220
224
 
221
225
  get replaces() {
222
- return this.#replaces;
226
+ return this.expand(
227
+ this.extends.reduce((a, c) => a.union(c.replaces), this.#replaces)
228
+ );
223
229
  }
224
230
 
225
231
  set depends(value) {
@@ -231,7 +237,9 @@ export class Host extends Base {
231
237
  }
232
238
 
233
239
  get depends() {
234
- return this.#depends;
240
+ return this.expand(
241
+ this.extends.reduce((a, c) => a.union(c.depends), this.#depends)
242
+ );
235
243
  }
236
244
 
237
245
  set master(value) {
package/src/utils.mjs CHANGED
@@ -2,11 +2,6 @@ import { writeFile, mkdir } from "node:fs/promises";
2
2
  import { join, dirname, basename } from "node:path";
3
3
 
4
4
  export function domainName(name, defaultDomain) {
5
-
6
- if(typeof name != "string") {
7
- console.log(name);
8
- }
9
-
10
5
  const dcs = name.split(".");
11
6
  return defaultDomain === undefined || dcs.length > 1
12
7
  ? name
package/types/base.d.mts CHANGED
@@ -89,6 +89,7 @@ export class Base {
89
89
  }, void, unknown>;
90
90
  set tags(value: Set<any>);
91
91
  get tags(): Set<any>;
92
+ get isTemplate(): boolean;
92
93
  expand(object: any): any;
93
94
  finalize(action: any): void;
94
95
  execFinalize(): void;
package/types/host.d.mts CHANGED
@@ -163,17 +163,18 @@ export class Host extends Base {
163
163
  };
164
164
  };
165
165
  };
166
- serial: any;
167
166
  priority: number;
168
- set depends(value: Set<any>);
169
- get depends(): Set<any>;
170
- set provides(value: Set<any>);
171
- get provides(): Set<any>;
172
- set replaces(value: Set<any>);
173
- get replaces(): Set<any>;
167
+ set depends(value: any);
168
+ get depends(): any;
169
+ set provides(value: any);
170
+ get provides(): any;
171
+ set replaces(value: any);
172
+ get replaces(): any;
174
173
  set services(service: any[]);
175
174
  get services(): any[];
176
175
  _traverse(...args: any[]): boolean;
176
+ set serial(value: any);
177
+ get serial(): any;
177
178
  set deployment(value: any);
178
179
  get deployment(): any;
179
180
  set chassis(value: any);