pmcf 6.39.1 → 6.39.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": "6.39.1",
3
+ "version": "6.39.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -27,8 +27,7 @@ import { owner_attribute, aliases_attribute } from "./common-attributes.mjs";
27
27
  * attributes: as declared in the types
28
28
  * properties: use defined values to support attribute value definitions
29
29
  */
30
- export class Base extends core {
31
- static name = "base";
30
+ export class base extends core {
32
31
  static key = "name";
33
32
  static priority = 0;
34
33
  static attributes = {
package/src/cluster.mjs CHANGED
@@ -58,7 +58,7 @@ export class Cluster extends Host {
58
58
  const packageStagingDir = join(stagingDir, host.name);
59
59
  const name = `${this.owner.name}-${host.name}`;
60
60
 
61
- const packageData = host.packageData;
61
+ const packageData = await host.packageData;
62
62
  packageData.sources.push(
63
63
  new FileContentProvider(packageStagingDir + "/")
64
64
  );
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";
@@ -10,7 +12,6 @@ import { union } from "./utils.mjs";
10
12
  import { loadHooks } from "./hooks.mjs";
11
13
 
12
14
  export class permission extends core {
13
- static priority = 1.9;
14
15
  static key = "pattern";
15
16
  static attributes = {
16
17
  pattern: { ...string_attribute_writable, key: true, name: "pattern" },
@@ -29,9 +30,9 @@ export class permission extends core {
29
30
  }
30
31
 
31
32
  export class content extends core {
32
- static priority = 1.9;
33
33
  static attributes = {
34
34
  name: name_attribute_writable,
35
+ description: description_attribute_writable,
35
36
  permissions: {
36
37
  ...default_collection_attribute_writable,
37
38
  type: permission,
@@ -89,6 +90,20 @@ export class content extends core {
89
90
  return this.name;
90
91
  }
91
92
 
93
+ get description() {
94
+ let description = this.attribute("_description");
95
+ if (description !== undefined) {
96
+ return description;
97
+ }
98
+
99
+ const node = this.owner;
100
+ return `${node.typeName} definitions for ${node.fullName}`;
101
+ }
102
+
103
+ set description(value) {
104
+ this._description = value;
105
+ }
106
+
92
107
  /**
93
108
  * @return {string}
94
109
  */
@@ -203,13 +218,25 @@ export class content extends core {
203
218
  */
204
219
  }
205
220
 
221
+ /**
222
+ *
223
+ * @param {object} packageData
224
+ */
225
+ async loadHooks(packageData) {
226
+ for (const node of this.walkDirections(["this", "extends"])) {
227
+ for (const hook of node._hooks) {
228
+ await loadHooks(packageData, join(node.owner.directory, hook));
229
+ }
230
+ }
231
+ }
232
+
206
233
  async packageData(node) {
207
234
  const packageData = {
208
235
  sources: [],
209
236
  outputs: this.outputs,
210
237
  properties: {
211
238
  name: this.name,
212
- description: `${node.typeName} definitions for ${node.fullName}`,
239
+ description: this.description,
213
240
  access: this.access,
214
241
  groups: [...this.groups],
215
242
  depends: [...this.depends],
@@ -220,12 +247,7 @@ export class content extends core {
220
247
  }
221
248
  };
222
249
 
223
- for (const hook of this.hooks) {
224
- await loadHooks(
225
- packageData,
226
- new URL("host.install", import.meta.url).pathname
227
- );
228
- }
250
+ await this.loadHooks(packageData);
229
251
 
230
252
  return packageData;
231
253
  }
@@ -6,7 +6,7 @@ import {
6
6
  asArray
7
7
  } from "pacc";
8
8
  import {
9
- Base,
9
+ base,
10
10
  Host,
11
11
  Endpoint,
12
12
  DomainNameEndpoint,
@@ -34,7 +34,7 @@ import {
34
34
  dnsPriority
35
35
  } from "./dns-utils.mjs";
36
36
 
37
- export class CoreService extends Base {
37
+ export class CoreService extends base {
38
38
  static name = "core-service";
39
39
  static priority = 1.1;
40
40
  static owners = [Host, "cluster", "network_interface"];
@@ -125,9 +125,9 @@ export class InitializationContext {
125
125
  if (value instanceof core) {
126
126
  assign(attribute, object, value);
127
127
  } else {
128
- for (const [objectName, objectData] of Object.entries(value)) {
128
+ for (const [objectIdentifier, objectData] of Object.entries(value)) {
129
129
  if (typeof objectData === "object") {
130
- objectData[attribute.type.key] = objectName;
130
+ objectData[attribute.type.key] = objectIdentifier;
131
131
  }
132
132
  this.instantiateAndAssign(object, attribute, objectData);
133
133
  }
@@ -1,8 +1,8 @@
1
1
  import { default_collection_attribute_writable } from "pacc";
2
- import { Base, addType } from "pmcf";
2
+ import { base, addType } from "pmcf";
3
3
  import { owner_attribute } from "./common-attributes.mjs";
4
4
 
5
- export class ServiceOwner extends Base {
5
+ export class ServiceOwner extends base {
6
6
  static name = "service-owner";
7
7
  static priority = 1.9;
8
8
  static owners = ["owner", "network", "root"];
@@ -4,10 +4,10 @@ import {
4
4
  string_attribute_writable,
5
5
  string_set_attribute_writable
6
6
  } from "pacc";
7
- import { addType, CoreService, Base } from "pmcf";
7
+ import { addType, CoreService, base } from "pmcf";
8
8
  import { owner_attribute } from "../common-attributes.mjs";
9
9
 
10
- class alpm_repository extends Base {
10
+ class alpm_repository extends base {
11
11
  static attributes = {
12
12
  name: name_attribute_writable,
13
13
  base: { ...string_attribute_writable, name: "base" },
@@ -7,7 +7,7 @@ import {
7
7
  default_collection_attribute_writable,
8
8
  default_attribute_writable,
9
9
  duration_attribute_writable,
10
- name_attribute,
10
+ id_attribute,
11
11
  string_attribute,
12
12
  string_set_attribute,
13
13
  string_attribute_writable,
@@ -20,7 +20,7 @@ import {
20
20
  asArray
21
21
  } from "pacc";
22
22
  import {
23
- Base,
23
+ base,
24
24
  CoreService,
25
25
  Endpoint,
26
26
  addresses,
@@ -42,11 +42,10 @@ import { NetworkAddress } from "../network-address.mjs";
42
42
  const PRIMARY = "primary";
43
43
  const SECONDARY = "secondary";
44
44
 
45
- class bind_zone extends Base {
46
- static priority = 1;
45
+ class bind_zone extends base {
47
46
  static key = "id";
48
47
  static attributes = {
49
- id: { ...name_attribute, name: "id" },
48
+ id: id_attribute,
50
49
  file: { ...string_attribute, name: "file" },
51
50
  records: {
52
51
  ...string_attribute_writable,
@@ -135,8 +134,7 @@ class catalog_zone extends bind_zone {
135
134
  }
136
135
  }
137
136
 
138
- class bind_zone_config extends Base {
139
- static priority = 1;
137
+ class bind_zone_config extends base {
140
138
  static attributes = {
141
139
  zones: { ...default_collection_attribute, type: bind_zone, name: "zones" },
142
140
  type: { ...string_attribute, name: "type" }
@@ -228,8 +226,7 @@ class bind_zone_config extends Base {
228
226
  }
229
227
  }
230
228
 
231
- export class bind_key extends Base {
232
- static priority = 1;
229
+ export class bind_key extends base {
233
230
  static attributes = {
234
231
  algorithm: {
235
232
  ...string_attribute_writable,
@@ -259,8 +256,7 @@ export class bind_key extends Base {
259
256
  }
260
257
  }
261
258
 
262
- class bind_object extends Base {
263
- static priority = 1;
259
+ class bind_object extends base {
264
260
  static attributes = {
265
261
  order: { ...integer_attribute, name: "order" },
266
262
  entries: {
@@ -285,7 +281,6 @@ class bind_object extends Base {
285
281
  }
286
282
 
287
283
  export class bind_acl extends bind_object {
288
- static priority = 1;
289
284
 
290
285
  static {
291
286
  addType(this);
@@ -825,8 +820,9 @@ export class bind extends CoreService {
825
820
  }
826
821
 
827
822
  async *preparePackages(dir) {
823
+ const packageData = await this.packageData;
824
+
828
825
  const permissions = this.content.permissions;
829
- const packageData = this.packageData;
830
826
 
831
827
  packageData.sources = await Array.fromAsync(
832
828
  this.templateContent(permissions)
@@ -37,7 +37,7 @@ export class chrony extends ExtraSourceService {
37
37
  }
38
38
 
39
39
  async *preparePackages(dir) {
40
- const packageData = this.packageData;
40
+ const packageData = await this.packageData;
41
41
  packageData.sources.push(new FileContentProvider(dir + "/"));
42
42
 
43
43
  const subnets = [...new Map(this.subnets).values()]; // TODO should be normal
@@ -31,7 +31,7 @@ export class influxdb extends CoreService {
31
31
  }
32
32
 
33
33
  async *preparePackages(dir) {
34
- const packageData = this.packageData;
34
+ const packageData = await this.packageData;
35
35
 
36
36
  packageData.sources.push(new FileContentProvider(dir + "/"));
37
37
 
@@ -151,7 +151,7 @@ export class kea extends CoreService {
151
151
  endpoints: endpoint => endpoint.networkInterface?.kind !== "loopback"
152
152
  });
153
153
 
154
- const packageData = this.packageData;
154
+ const packageData = await this.packageData;
155
155
 
156
156
  packageData.sources.push(new FileContentProvider(dir + "/"));
157
157
 
@@ -58,8 +58,8 @@ export class mosquitto extends CoreService {
58
58
  wd.map(n => [n.fullName, n.directory])
59
59
  );*/
60
60
 
61
+ const packageData = await this.packageData;
61
62
  const permissions = this.content.permissions;
62
- const packageData = this.packageData;
63
63
 
64
64
  packageData.sources = await Array.fromAsync(
65
65
  this.templateContent(...permissions)