pmcf 6.39.0 → 6.39.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
@@ -117,7 +117,7 @@ generates config packages for:
117
117
 
118
118
  ## Base
119
119
 
120
- **Extends Core**
120
+ **Extends core**
121
121
 
122
122
  attributes: as declared in the types
123
123
  properties: use defined values to support attribute value definitions
@@ -214,7 +214,7 @@ Walk the object graph in some directions and deliver seen nodes.
214
214
 
215
215
  * `directions` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** (optional, default `["this","extends","owner"]`)
216
216
 
217
- Returns **Iterable\<Core>**&#x20;
217
+ Returns **Iterable\<core>**&#x20;
218
218
 
219
219
  ## mapFromDirections
220
220
 
package/bin/pmcf-info CHANGED
@@ -112,25 +112,32 @@ function show(value, indent, options) {
112
112
  }
113
113
  }
114
114
  } else {
115
- try {
116
- const l = [...v];
117
-
118
- if (l.length > 1) {
119
- console.log(name(attribute));
120
-
121
- if (l.length >= options.maxEntries) {
122
- l[options.maxEntries] = { fullName: "..." };
123
- l.length = options.maxEntries + 1;
124
- }
125
-
126
- for (const o of l) {
127
- console.log(prefix(indent + 2) + o.fullName);
115
+ if (typeof v.get === "function") {
116
+ console.log(name(attribute));
117
+ for(const [k,o] of v) {
118
+ show(o,indent + 2, options);
119
+ }
120
+ } else {
121
+ try {
122
+ const l = [...v];
123
+
124
+ if (l.length > 1) {
125
+ console.log(name(attribute));
126
+
127
+ if (l.length >= options.maxEntries) {
128
+ l[options.maxEntries] = { fullName: "..." };
129
+ l.length = options.maxEntries + 1;
130
+ }
131
+
132
+ for (const o of l) {
133
+ console.log(prefix(indent + 2) + o.fullName);
134
+ }
135
+ } else if (l.length === 1) {
136
+ console.log(name(attribute) + l[0].fullName);
128
137
  }
129
- } else if (l.length === 1) {
130
- console.log(name(attribute) + l[0].fullName);
138
+ } catch (e) {
139
+ console.log(name(attribute), v);
131
140
  }
132
- } catch (e) {
133
- console.log(name(attribute), v);
134
141
  }
135
142
  }
136
143
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.39.0",
3
+ "version": "6.39.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -100,10 +100,6 @@ export class Base extends core {
100
100
  }
101
101
  }
102
102
 
103
- get root() {
104
- return this.owner?.root;
105
- }
106
-
107
103
  get host() {
108
104
  return this.owner?.host;
109
105
  }
package/src/content.mjs CHANGED
@@ -1,8 +1,10 @@
1
+ import { join } from "node:path";
1
2
  import {
2
3
  name_attribute_writable,
3
4
  string_attribute_writable,
4
5
  string_set_attribute_writable,
5
- default_collection_attribute_writable
6
+ default_collection_attribute_writable,
7
+ description_attribute_writable
6
8
  } from "pacc";
7
9
  import { allOutputs } from "npm-pkgbuild";
8
10
  import { core, addType } from "pmcf";
@@ -11,6 +13,7 @@ import { loadHooks } from "./hooks.mjs";
11
13
 
12
14
  export class permission extends core {
13
15
  static priority = 1.9;
16
+ static key = "pattern";
14
17
  static attributes = {
15
18
  pattern: { ...string_attribute_writable, key: true, name: "pattern" },
16
19
  user: { ...string_attribute_writable, name: "user" },
@@ -22,7 +25,7 @@ export class permission extends core {
22
25
  addType(this);
23
26
  }
24
27
 
25
- get name() {
28
+ get fullName() {
26
29
  return this.pattern;
27
30
  }
28
31
  }
@@ -31,6 +34,7 @@ export class content extends core {
31
34
  static priority = 1.9;
32
35
  static attributes = {
33
36
  name: name_attribute_writable,
37
+ description: description_attribute_writable,
34
38
  permissions: {
35
39
  ...default_collection_attribute_writable,
36
40
  type: permission,
@@ -84,6 +88,24 @@ export class content extends core {
84
88
  this._name = value;
85
89
  }
86
90
 
91
+ get fullName() {
92
+ return this.name;
93
+ }
94
+
95
+ get description() {
96
+ let description = this.attribute("_description");
97
+ if (description !== undefined) {
98
+ return description;
99
+ }
100
+
101
+ const node = this.owner;
102
+ return `${node.typeName} definitions for ${node.fullName}`;
103
+ }
104
+
105
+ set description(value) {
106
+ this._description = value;
107
+ }
108
+
87
109
  /**
88
110
  * @return {string}
89
111
  */
@@ -198,13 +220,25 @@ export class content extends core {
198
220
  */
199
221
  }
200
222
 
223
+ /**
224
+ *
225
+ * @param {object} packageData
226
+ */
227
+ async loadHooks(packageData) {
228
+ for (const node of this.walkDirections(["this", "extends"])) {
229
+ for (const hook of node._hooks) {
230
+ await loadHooks(packageData, join(node.owner.directory, hook));
231
+ }
232
+ }
233
+ }
234
+
201
235
  async packageData(node) {
202
236
  const packageData = {
203
237
  sources: [],
204
238
  outputs: this.outputs,
205
239
  properties: {
206
240
  name: this.name,
207
- description: `${node.typeName} definitions for ${node.fullName}`,
241
+ description: this.description,
208
242
  access: this.access,
209
243
  groups: [...this.groups],
210
244
  depends: [...this.depends],
@@ -215,12 +249,7 @@ export class content extends core {
215
249
  }
216
250
  };
217
251
 
218
- for (const hook of this.hooks) {
219
- await loadHooks(
220
- packageData,
221
- new URL("host.install", import.meta.url).pathname
222
- );
223
- }
252
+ await this.loadHooks(packageData);
224
253
 
225
254
  return packageData;
226
255
  }
package/src/core.mjs CHANGED
@@ -321,4 +321,8 @@ export class core {
321
321
  get isTemplate() {
322
322
  return false;
323
323
  }
324
+
325
+ get root() {
326
+ return this.owner?.root;
327
+ }
324
328
  }
@@ -6,7 +6,7 @@ import {
6
6
  resolveTypeLinks,
7
7
  create
8
8
  } from "pacc";
9
- import { Base, root, assign } from "pmcf";
9
+ import { core, root, assign } from "pmcf";
10
10
 
11
11
  /**
12
12
  * Keeps track of all in flight object creations and loose ends during config initialization.
@@ -122,7 +122,7 @@ export class InitializationContext {
122
122
  this.instantiateAndAssign(object, attribute, v);
123
123
  }
124
124
  } else {
125
- if (value instanceof Base) {
125
+ if (value instanceof core) {
126
126
  assign(attribute, object, value);
127
127
  } else {
128
128
  for (const [objectName, objectData] of Object.entries(value)) {