pmcf 4.25.2 → 4.25.4

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/README.md CHANGED
@@ -73,11 +73,11 @@ generates config packages for:
73
73
  * [Parameters](#parameters-12)
74
74
  * [port](#port-1)
75
75
  * [id](#id)
76
+ * [InitializationContext](#initializationcontext)
77
+ * [Parameters](#parameters-13)
76
78
  * [SkeletonNetworkInterface](#skeletonnetworkinterface)
77
79
  * [networkAddresses](#networkaddresses)
78
- * [Parameters](#parameters-13)
79
- * [InitializationContext](#initializationcontext)
80
- * [Parameters](#parameters-14)
80
+ * [Parameters](#parameters-14)
81
81
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
82
82
  * [Properties](#properties)
83
83
  * [systemdConfigs](#systemdconfigs)
@@ -263,6 +263,14 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
263
263
 
264
264
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
265
265
 
266
+ ## InitializationContext
267
+
268
+ Keeps track of all in flight object creations and loose ends during config initialization.
269
+
270
+ ### Parameters
271
+
272
+ * `directory` (optional, default `"/"`)
273
+
266
274
  ## SkeletonNetworkInterface
267
275
 
268
276
  **Extends ServiceOwner**
@@ -275,14 +283,6 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
275
283
 
276
284
  Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
277
285
 
278
- ## InitializationContext
279
-
280
- Keeps track of all in flight object creations and loose ends during config initialization.
281
-
282
- ### Parameters
283
-
284
- * `directory` (optional, default `"/"`)
285
-
286
286
  ## SystemdJournalRemoteService
287
287
 
288
288
  **Extends Service**
package/bin/pmcf-info CHANGED
@@ -4,11 +4,28 @@ import { prepare } from "../src/cli.mjs";
4
4
  const { root, args, options } = await prepare({});
5
5
 
6
6
  for (const expression of args) {
7
- let result = root.expression(expression);
7
+ const result = root.named(expression);
8
8
 
9
- if (result instanceof Iterator) {
10
- result = Array.from(result);
9
+ show(result);
10
+ }
11
+
12
+ function show(value) {
13
+ if (value instanceof Iterator) {
14
+ for (const v of value) {
15
+ show(v);
16
+ }
17
+ } else {
18
+ console.log(`${value.fullName}:`);
19
+ ex(value);
11
20
  }
21
+ }
12
22
 
13
- console.log(result);
23
+ function ex(node, indent = 1) {
24
+ if (indent > 5) {
25
+ return;
26
+ }
27
+ for (const e of node.extends) {
28
+ console.log(" ".repeat(indent * 2) + e.fullName);
29
+ ex(e, indent + 1);
30
+ }
14
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.25.2",
3
+ "version": "4.25.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -194,7 +194,6 @@ export class Base {
194
194
  forOwner(owner) {
195
195
  if (this.owner !== owner) {
196
196
  const newObject = Object.create(this);
197
- newObject.extends = new Set([...this.extends]);
198
197
  newObject.owner = owner;
199
198
  return newObject;
200
199
  }
@@ -18,28 +18,24 @@ export class InitializationContext {
18
18
  }
19
19
 
20
20
  resolveOutstanding() {
21
- for (let { object, attribute, name, value } of this.outstandingResolves) {
21
+ nextOutstanding: for (let { object, attribute, name, value } of this
22
+ .outstandingResolves) {
22
23
  value = object.expand(value);
23
24
 
24
25
  for (const type of attribute.type.members || [attribute.type]) {
25
- const o =
26
- object.typeNamed(type.name, value) ||
27
- object.owner.typeNamed(type.name, value) ||
28
- object.root.typeNamed(type.name, value); // TODO
29
-
30
- if (o) {
31
- this.assign(object, name, attribute, o);
32
-
33
- // console.log("RESOLVE", object.fullName,name,o.fullName);
34
- // continue;
26
+ for (const node of object.walkDirections(["this", "owner"])) {
27
+ const resolved = node.typeNamed(type.name, value);
28
+ if (resolved) {
29
+ this.assign(object, name, attribute, resolved);
30
+ continue nextOutstanding;
31
+ }
35
32
  }
36
33
  }
37
34
 
38
- /*
39
35
  this.error(
40
- `No such object "${value}" (${attribute.type.name}) for attribute ${name}`,
36
+ `Unable to resolve "${value}" (${attribute.type.name}) for attribute ${name}`,
41
37
  object.root.named(value)?.toString()
42
- );*/
38
+ );
43
39
  }
44
40
  }
45
41
 
@@ -85,6 +81,9 @@ export class InitializationContext {
85
81
  if (value instanceof Set) {
86
82
  object[name] = current.union(value);
87
83
  } else {
84
+ /*if(name === 'extends') {
85
+ console.log("EXT",object.fullName,value.fullName)
86
+ }*/
88
87
  object[name].add(value);
89
88
  }
90
89
  } else if (current instanceof Map) {
@@ -30,10 +30,8 @@ export class ServiceOwner extends Base {
30
30
  const present = this._services.get(service.name);
31
31
 
32
32
  if (present) {
33
- //console.log("LINK SERVICE", this.fullName, present.fullName, service.fullName);
34
33
  present.extends.add(service);
35
34
  } else {
36
- //console.log("ADD SERVICE", this.fullName, service.fullName);
37
35
  this.services = service.forOwner(this);
38
36
  }
39
37
  }