pmcf 4.25.1 → 4.25.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/README.md CHANGED
@@ -49,20 +49,20 @@ generates config packages for:
49
49
  * [Parameters](#parameters-2)
50
50
  * [walkDirections](#walkdirections)
51
51
  * [Parameters](#parameters-3)
52
- * [extendedAttribute](#extendedattribute)
52
+ * [attribute](#attribute)
53
53
  * [Parameters](#parameters-4)
54
- * [propertyIterator](#propertyiterator)
54
+ * [attributeIterator](#attributeiterator)
55
55
  * [Parameters](#parameters-5)
56
- * [getProperties](#getproperties)
56
+ * [getAttributes](#getattributes)
57
57
  * [Parameters](#parameters-6)
58
+ * [property](#property)
59
+ * [Parameters](#parameters-7)
58
60
  * [priority](#priority)
59
61
  * [expression](#expression)
60
- * [Parameters](#parameters-7)
61
- * [templateContent](#templatecontent)
62
62
  * [Parameters](#parameters-8)
63
- * [isTemplate](#istemplate)
64
- * [property](#property)
63
+ * [templateContent](#templatecontent)
65
64
  * [Parameters](#parameters-9)
65
+ * [isTemplate](#istemplate)
66
66
  * [expand](#expand)
67
67
  * [Parameters](#parameters-10)
68
68
  * [PortEndpoint](#portendpoint)
@@ -114,7 +114,7 @@ generates config packages for:
114
114
 
115
115
  ## Base
116
116
 
117
- attributes: essential values
117
+ attributes: as declared in the types
118
118
  properties: use defined values to support attribute value definitions
119
119
 
120
120
  ### Parameters
@@ -154,7 +154,7 @@ Walk the object graph in some directions and deliver seen nodes.
154
154
 
155
155
  Returns **Iterable<[Base](#base)>**&#x20;
156
156
 
157
- ### extendedAttribute
157
+ ### attribute
158
158
 
159
159
  #### Parameters
160
160
 
@@ -162,7 +162,7 @@ Returns **Iterable<[Base](#base)>**&#x20;
162
162
 
163
163
  Returns **any**&#x20;
164
164
 
165
- ### propertyIterator
165
+ ### attributeIterator
166
166
 
167
167
  Retrive attribute values from an object.
168
168
 
@@ -172,7 +172,7 @@ Retrive attribute values from an object.
172
172
 
173
173
  Returns **Iterable<\[[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), any]>** values
174
174
 
175
- ### getProperties
175
+ ### getAttributes
176
176
 
177
177
  Retrive attribute values from an object.
178
178
 
@@ -182,6 +182,14 @@ Retrive attribute values from an object.
182
182
 
183
183
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
184
184
 
185
+ ### property
186
+
187
+ #### Parameters
188
+
189
+ * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
190
+
191
+ Returns **any**&#x20;
192
+
185
193
  ### priority
186
194
 
187
195
  Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**&#x20;
@@ -208,14 +216,6 @@ Returns **AsyncIterable\<ContentProvider>**&#x20;
208
216
 
209
217
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
210
218
 
211
- ### property
212
-
213
- #### Parameters
214
-
215
- * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
216
-
217
- Returns **any**&#x20;
218
-
219
219
  ### expand
220
220
 
221
221
  #### Parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.25.1",
3
+ "version": "4.25.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -58,7 +58,7 @@
58
58
  "package-directory": "^8.2.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@types/node": "^25.9.1",
61
+ "@types/node": "^25.9.2",
62
62
  "ava": "^8.0.1",
63
63
  "c8": "^11.0.0",
64
64
  "documentation": "^14.0.3",
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
  }
package/src/host.mjs CHANGED
@@ -494,7 +494,7 @@ export class Host extends ServiceOwner {
494
494
  for (const { serviceName, configFileName, content } of asArray(
495
495
  service.expand(service.systemdConfigs(this.name))
496
496
  )) {
497
- console.log("SERVICE", service.fullName, configFileName);
497
+ //console.log("SERVICE", service.fullName, configFileName);
498
498
 
499
499
  await writeLines(dir, configFileName, content);
500
500
 
@@ -18,25 +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);
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
+ }
32
32
  }
33
33
  }
34
34
 
35
- /*
36
35
  this.error(
37
- `No such object "${value}" (${attribute.type.name}) for attribute ${name}`,
36
+ `Unable to resolve "${value}" (${attribute.type.name}) for attribute ${name}`,
38
37
  object.root.named(value)?.toString()
39
- );*/
38
+ );
40
39
  }
41
40
  }
42
41
 
@@ -82,6 +81,9 @@ export class InitializationContext {
82
81
  if (value instanceof Set) {
83
82
  object[name] = current.union(value);
84
83
  } else {
84
+ /*if(name === 'extends') {
85
+ console.log("EXT",object.fullName,value.fullName)
86
+ }*/
85
87
  object[name].add(value);
86
88
  }
87
89
  } else if (current instanceof Map) {
@@ -194,7 +196,6 @@ export class InitializationContext {
194
196
  this._read(object, data, type);
195
197
 
196
198
  if (data.extends) {
197
- //console.log("EXTENDS", type.name, object.fullName); // data.extends);
198
199
  object.materializeExtends();
199
200
  }
200
201
  }
@@ -221,7 +222,6 @@ export class InitializationContext {
221
222
  } else {
222
223
  for (const [objectName, objectData] of Object.entries(value)) {
223
224
  if (typeof objectData === "object") {
224
- //console.log("KEY", objectName, type.name, type.key);
225
225
  objectData[attribute.type.key] = objectName;
226
226
  }
227
227
  this.instantiateAndAssign(
@@ -237,10 +237,6 @@ export class InitializationContext {
237
237
  }
238
238
  }
239
239
  this.instantiateAndAssign(object, name, attribute, value);
240
-
241
- /*if (name === "alias" && value) {
242
- console.log("READ ALIAS", object.fullName, object.alias, value);
243
- }*/
244
240
  }
245
241
  }
246
242
  }
@@ -253,7 +249,6 @@ export class InitializationContext {
253
249
  )
254
250
  );
255
251
 
256
- //console.log("LOAD", name);
257
252
  let owner;
258
253
  if (name[0] === "/") {
259
254
  const parentName = name.replace(/\/[^\/]+$/, "");
@@ -8,42 +8,54 @@ export class ServiceOwner extends Base {
8
8
  }
9
9
 
10
10
  get services() {
11
- return this.mapFromDirections(["this", "extends"], "_services");
11
+ return this._services;
12
+ //return this.mapFromDirections(["this", "extends"], "_services");
12
13
  }
13
14
 
14
- addObject(object)
15
- {
16
- if(object instanceof Service) {
15
+ addObject(object) {
16
+ if (object instanceof Service) {
17
17
  this._services.set(object.name, object);
18
18
  }
19
19
 
20
20
  super.addObject(object);
21
21
  }
22
22
 
23
- _materializeExtends() {
23
+ materializeExtends() {
24
24
  super.materializeExtends();
25
25
 
26
- for (const serviceOwner of this.walkDirections(["extends"])) {
27
- /*console.log(
28
- "ServiceOwner materializeExtends",
29
- this.fullName,
30
- serviceOwner.fullName
31
- );*/
32
-
33
- for (const service of serviceOwner.services.values()) {
34
- const present = this.services.get(service.name);
35
-
36
- if (present) {
37
- //console.log("LINK SERVICE", this.fullName, present.fullName, service.fullName);
38
- present.extends.add(service);
39
- } else {
40
- //console.log("ADD SERVICE", this.fullName, service.fullName);
41
-
42
- const s = service.forOwner(this);
43
- this._services.set(s.name, s);
44
- }
26
+ for (const [name, service] of this.mapFromDirections(
27
+ ["extends"],
28
+ "_services"
29
+ )) {
30
+ const present = this._services.get(service.name);
31
+
32
+ if (present) {
33
+ present.extends.add(service);
34
+ } else {
35
+ this.services = service.forOwner(this);
36
+ }
37
+ }
38
+
39
+ /*
40
+ if (this.fullName === "/SW/mini1") {
41
+ const myServiceNames = new Set([...this.services.keys()]);
42
+ const extendingSericeNames = new Set([
43
+ ...this.mapFromDirections(["extends"], "_services").keys()
44
+ ]);
45
+
46
+ console.log("XXX",this.fullName, [...this.extends].map(n=>n.fullName), myServiceNames, extendingSericeNames);
47
+
48
+ if (!extendingSericeNames.isSubsetOf(myServiceNames)) {
49
+ // const diff = myServiceNames.difference(extendingSericeNames);
50
+ console.log(
51
+ "DIFF",
52
+ this.fullName,
53
+ myServiceNames,
54
+ extendingSericeNames
55
+ );
45
56
  }
46
57
  }
58
+ */
47
59
  }
48
60
 
49
61
  _traverse(...args) {
@@ -69,7 +69,10 @@ export class SystemdJournalUploadService extends Service {
69
69
  * @returns {Object}
70
70
  */
71
71
  systemdConfigs(name) {
72
- console.log("PROPS",this.expand(this.getAttributes(filterConfigurable)));
72
+ console.log(this.fullName,this.owner.fullName);
73
+ console.log(this.property('domainName'),this.name);
74
+ console.log(this.property('certs_private_dir'));
75
+ console.log("PROPS", this.expand(this.getAttributes(filterConfigurable)));
73
76
  return {
74
77
  serviceName: this.systemdService,
75
78
  configFileName: `etc/systemd/journal-upload.conf.d/${name}.conf`,