pmcf 4.25.0 → 4.25.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/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.0",
3
+ "version": "4.25.2",
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
@@ -280,7 +280,7 @@ export class Base {
280
280
  */
281
281
  property(name) {
282
282
  for (const node of this.walkDirections()) {
283
- const value = node.properties?.[name];
283
+ const value = node.properties[name];
284
284
 
285
285
  if (value !== undefined) {
286
286
  return this.expand(value);
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
 
@@ -29,10 +29,13 @@ export class InitializationContext {
29
29
 
30
30
  if (o) {
31
31
  this.assign(object, name, attribute, o);
32
+
33
+ // console.log("RESOLVE", object.fullName,name,o.fullName);
34
+ // continue;
32
35
  }
33
36
  }
34
37
 
35
- /*
38
+ /*
36
39
  this.error(
37
40
  `No such object "${value}" (${attribute.type.name}) for attribute ${name}`,
38
41
  object.root.named(value)?.toString()
@@ -194,7 +197,6 @@ export class InitializationContext {
194
197
  this._read(object, data, type);
195
198
 
196
199
  if (data.extends) {
197
- //console.log("EXTENDS", type.name, object.fullName); // data.extends);
198
200
  object.materializeExtends();
199
201
  }
200
202
  }
@@ -221,7 +223,6 @@ export class InitializationContext {
221
223
  } else {
222
224
  for (const [objectName, objectData] of Object.entries(value)) {
223
225
  if (typeof objectData === "object") {
224
- //console.log("KEY", objectName, type.name, type.key);
225
226
  objectData[attribute.type.key] = objectName;
226
227
  }
227
228
  this.instantiateAndAssign(
@@ -237,10 +238,6 @@ export class InitializationContext {
237
238
  }
238
239
  }
239
240
  this.instantiateAndAssign(object, name, attribute, value);
240
-
241
- /*if (name === "alias" && value) {
242
- console.log("READ ALIAS", object.fullName, object.alias, value);
243
- }*/
244
241
  }
245
242
  }
246
243
  }
@@ -253,7 +250,6 @@ export class InitializationContext {
253
250
  )
254
251
  );
255
252
 
256
- //console.log("LOAD", name);
257
253
  let owner;
258
254
  if (name[0] === "/") {
259
255
  const parentName = name.replace(/\/[^\/]+$/, "");
@@ -8,42 +8,56 @@ 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
+ //console.log("LINK SERVICE", this.fullName, present.fullName, service.fullName);
34
+ present.extends.add(service);
35
+ } else {
36
+ //console.log("ADD SERVICE", this.fullName, service.fullName);
37
+ this.services = service.forOwner(this);
38
+ }
39
+ }
40
+
41
+ /*
42
+ if (this.fullName === "/SW/mini1") {
43
+ const myServiceNames = new Set([...this.services.keys()]);
44
+ const extendingSericeNames = new Set([
45
+ ...this.mapFromDirections(["extends"], "_services").keys()
46
+ ]);
47
+
48
+ console.log("XXX",this.fullName, [...this.extends].map(n=>n.fullName), myServiceNames, extendingSericeNames);
49
+
50
+ if (!extendingSericeNames.isSubsetOf(myServiceNames)) {
51
+ // const diff = myServiceNames.difference(extendingSericeNames);
52
+ console.log(
53
+ "DIFF",
54
+ this.fullName,
55
+ myServiceNames,
56
+ extendingSericeNames
57
+ );
45
58
  }
46
59
  }
60
+ */
47
61
  }
48
62
 
49
63
  _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`,