pmcf 3.11.2 → 3.11.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.
Files changed (37) hide show
  1. package/package.json +2 -2
  2. package/src/base.mjs +4 -3
  3. package/src/cluster.mjs +22 -5
  4. package/src/extra-source-service.mjs +6 -1
  5. package/src/host.mjs +10 -6
  6. package/src/network-interfaces/ethernet.mjs +6 -1
  7. package/src/network-interfaces/network-interface.mjs +15 -8
  8. package/src/owner.mjs +12 -3
  9. package/src/services/bind.mjs +19 -4
  10. package/src/services/chrony.mjs +1 -1
  11. package/types/base.d.mts +4 -8
  12. package/types/cluster.d.mts +125 -16
  13. package/types/extra-source-service.d.mts +164 -38
  14. package/types/host.d.mts +43 -8
  15. package/types/location.d.mts +86 -16
  16. package/types/network-interfaces/ethernet.d.mts +137 -99
  17. package/types/network-interfaces/loopback.d.mts +106 -94
  18. package/types/network-interfaces/network-interface.d.mts +106 -94
  19. package/types/network-interfaces/tun.d.mts +106 -94
  20. package/types/network-interfaces/wireguard.d.mts +106 -94
  21. package/types/network-interfaces/wlan.d.mts +172 -141
  22. package/types/network.d.mts +86 -16
  23. package/types/owner.d.mts +43 -8
  24. package/types/root.d.mts +86 -16
  25. package/types/service.d.mts +94 -32
  26. package/types/services/bind.d.mts +232 -48
  27. package/types/services/chrony.d.mts +193 -48
  28. package/types/services/headscale.d.mts +193 -48
  29. package/types/services/influxdb.d.mts +137 -40
  30. package/types/services/kea.d.mts +137 -40
  31. package/types/services/mosquitto.d.mts +137 -40
  32. package/types/services/openldap.d.mts +137 -40
  33. package/types/services/systemd-journal-remote.d.mts +137 -40
  34. package/types/services/systemd-journal-upload.d.mts +137 -40
  35. package/types/services/systemd-journal.d.mts +137 -40
  36. package/types/services/systemd-resolved.d.mts +193 -48
  37. package/types/services/systemd-timesyncd.d.mts +193 -48
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "3.11.2",
3
+ "version": "3.11.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "ip-utilties": "^1.4.9",
55
55
  "npm-pkgbuild": "^18.3.7",
56
- "pacc": "^4.37.7",
56
+ "pacc": "^4.39.0",
57
57
  "package-directory": "^8.1.0"
58
58
  },
59
59
  "devDependencies": {
package/src/base.mjs CHANGED
@@ -4,12 +4,13 @@ import {
4
4
  parse,
5
5
  expand,
6
6
  attributeIterator,
7
+ default_attribute,
7
8
  name_attribute_writable,
8
9
  string_attribute,
9
10
  string_attribute_writable,
10
11
  string_collection_attribute_writable,
11
12
  number_attribute_writable,
12
- description_attribute,
13
+ description_attribute_writable,
13
14
  boolean_attribute_writable
14
15
  } from "pacc";
15
16
  import { addType, typeFactory } from "./types.mjs";
@@ -19,10 +20,10 @@ const BaseTypeDefinition = {
19
20
  name: "base",
20
21
  key: "name",
21
22
  attributes: {
22
- owner: { type: "base", collection: false, writable: false },
23
+ owner: { ...default_attribute, type: "base" },
23
24
  type: string_attribute,
24
25
  name: name_attribute_writable,
25
- description: { ...description_attribute, writable: true },
26
+ description: description_attribute_writable,
26
27
  priority: number_attribute_writable,
27
28
  directory: string_attribute_writable,
28
29
  packaging: string_attribute_writable,
package/src/cluster.mjs CHANGED
@@ -1,6 +1,10 @@
1
1
  import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
- import { number_attribute_writable } from "pacc";
3
+ import {
4
+ default_attribute_writable,
5
+ default_attribute,
6
+ number_attribute_writable
7
+ } from "pacc";
4
8
  import { Owner } from "./owner.mjs";
5
9
  import { Host } from "./host.mjs";
6
10
  import { serviceEndpoints } from "pmcf";
@@ -15,9 +19,21 @@ const ClusterTypeDefinition = {
15
19
  key: "name",
16
20
  attributes: {
17
21
  routerId: number_attribute_writable,
18
- masters: { type: "network_interface", collection: true, writable: true },
19
- backups: { type: "network_interface", collection: true, writable: true },
20
- members: { type: "network_interface", collection: true, writable: false },
22
+ masters: {
23
+ ...default_attribute_writable,
24
+ type: "network_interface",
25
+ collection: true
26
+ },
27
+ backups: {
28
+ ...default_attribute_writable,
29
+ type: "network_interface",
30
+ collection: true
31
+ },
32
+ members: {
33
+ ...default_attribute,
34
+ type: "network_interface",
35
+ collection: true
36
+ },
21
37
  checkInterval: number_attribute_writable
22
38
  }
23
39
  };
@@ -146,7 +162,8 @@ export class Cluster extends Host {
146
162
 
147
163
  for (const endpoint of serviceEndpoints(cluster, {
148
164
  services: 'type="http"',
149
- endpoints: e => e.networkInterface && e.networkInterface.kind !== "loopback"
165
+ endpoints: e =>
166
+ e.networkInterface && e.networkInterface.kind !== "loopback"
150
167
  })) {
151
168
  cfg.push(`virtual_server ${cluster.address} ${endpoint.port} {`);
152
169
  cfg.push(` delay_loop ${cluster.checkInterval}`);
@@ -1,3 +1,4 @@
1
+ import { default_attribute_writable } from "pacc";
1
2
  import { addType } from "./types.mjs";
2
3
  import { Service, ServiceTypeDefinition } from "./service.mjs";
3
4
  import { networkAddressType } from "pmcf";
@@ -8,7 +9,11 @@ export const ExtraSourceServiceTypeDefinition = {
8
9
  extends: ServiceTypeDefinition,
9
10
  priority: 0.1,
10
11
  attributes: {
11
- source: { type: networkAddressType, collection: true, writable: true }
12
+ source: {
13
+ ...default_attribute_writable,
14
+ type: networkAddressType,
15
+ collection: true
16
+ }
12
17
  }
13
18
  };
14
19
 
package/src/host.mjs CHANGED
@@ -2,12 +2,12 @@ import { readFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
4
  import {
5
+ default_attribute_writable,
5
6
  string_attribute,
6
7
  string_attribute_writable,
7
8
  string_collection_attribute_writable,
8
9
  number_attribute_writable,
9
- boolean_attribute_false,
10
- name_attribute
10
+ boolean_attribute_false
11
11
  } from "pacc";
12
12
  import { ServiceOwner, Base, addresses } from "pmcf";
13
13
  import { networkAddressAttributes } from "./network-support.mjs";
@@ -33,11 +33,15 @@ const HostTypeDefinition = {
33
33
  attributes: {
34
34
  ...networkAddressAttributes,
35
35
  networkInterfaces: {
36
+ ...default_attribute_writable,
36
37
  type: "network_interface",
37
- collection: true,
38
- writable: true
38
+ collection: true
39
+ },
40
+ services: {
41
+ ...default_attribute_writable,
42
+ type: "service",
43
+ collection: true
39
44
  },
40
- services: { type: "service", collection: true, writable: true },
41
45
  aliases: string_collection_attribute_writable,
42
46
  os: {
43
47
  ...string_attribute_writable,
@@ -78,7 +82,7 @@ const HostTypeDefinition = {
78
82
  replaces: string_collection_attribute_writable,
79
83
  depends: string_collection_attribute_writable,
80
84
  provides: string_collection_attribute_writable,
81
- extends: { type: "host", collection: true, writable: true },
85
+ extends: { ...default_attribute_writable, type: "host", collection: true },
82
86
  model: string_attribute,
83
87
  isModel: boolean_attribute_false
84
88
  }
@@ -1,3 +1,4 @@
1
+ import { default_attribute_writable } from "pacc";
1
2
  import { addType } from "../types.mjs";
2
3
  import {
3
4
  NetworkInterface,
@@ -12,7 +13,11 @@ export const EthernetNetworkInterfaceTypeDefinition = {
12
13
  priority: 0.1,
13
14
  key: "name",
14
15
  attributes: {
15
- arpbridge: { type: "network_interface", collection: true, writable: true }
16
+ arpbridge: {
17
+ ...default_attribute_writable,
18
+ type: "network_interface",
19
+ collection: true
20
+ }
16
21
  }
17
22
  };
18
23
 
@@ -1,6 +1,10 @@
1
1
  import { join } from "node:path";
2
2
  import { hasWellKnownSubnet, normalizeIP } from "ip-utilties";
3
- import { string_attribute_writable, hostname_attribute } from "pacc";
3
+ import {
4
+ default_attribute_writable,
5
+ string_attribute_writable,
6
+ hostname_attribute
7
+ } from "pacc";
4
8
  import { Base, cidrAddresses } from "pmcf";
5
9
  import {
6
10
  networkAttributes,
@@ -42,16 +46,19 @@ export const NetworkInterfaceTypeDefinition = {
42
46
  ...networkAttributes,
43
47
  ...networkAddressAttributes,
44
48
 
45
- services: { type: "service", collection: true, writable: true },
49
+ services: {
50
+ ...default_attribute_writable,
51
+ collection: true,
52
+ type: "service"
53
+ },
46
54
  hostName: { ...hostname_attribute, writable: true },
47
- ipAddresses: { ...string_attribute_writable },
48
- hwaddr: { ...string_attribute_writable },
55
+ ipAddresses: string_attribute_writable,
56
+ hwaddr: string_attribute_writable,
49
57
  network: {
50
- type: Network.typeDefinition,
51
- collection: false,
52
- writable: true
58
+ ...default_attribute_writable,
59
+ type: Network.typeDefinition
53
60
  },
54
- destination: { ...string_attribute_writable }
61
+ destination: string_attribute_writable
55
62
  }
56
63
  };
57
64
 
package/src/owner.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { normalizeCIDR, familyIP } from "ip-utilties";
2
2
  import {
3
+ default_attribute_writable,
3
4
  string_collection_attribute_writable,
4
5
  string_attribute_writable,
5
6
  email_attribute
@@ -18,9 +19,17 @@ const OwnerTypeDefinition = {
18
19
  key: "name",
19
20
  attributes: {
20
21
  networks: networks_attribute,
21
- hosts: { type: "host", collection: true, writable: true },
22
- clusters: { type: "cluster", collection: true, writable: true },
23
- subnets: { type: Subnet.typeDefinition, collection: true, writable: true },
22
+ hosts: { ...default_attribute_writable, type: "host", collection: true },
23
+ clusters: {
24
+ ...default_attribute_writable,
25
+ type: "cluster",
26
+ collection: true
27
+ },
28
+ subnets: {
29
+ ...default_attribute_writable,
30
+ type: Subnet.typeDefinition,
31
+ collection: true
32
+ },
24
33
  country: string_attribute_writable,
25
34
  domain: string_attribute_writable,
26
35
  domains: string_collection_attribute_writable,
@@ -4,6 +4,7 @@ import { FileContentProvider } from "npm-pkgbuild";
4
4
  import { isLinkLocal, reverseArpa } from "ip-utilties";
5
5
  import {
6
6
  oneOfType,
7
+ default_attribute_writable,
7
8
  string_attribute_writable,
8
9
  boolean_attribute_writable_true,
9
10
  boolean_attribute_writable_false,
@@ -46,14 +47,26 @@ const BindServiceTypeDefinition = {
46
47
  collection: true,
47
48
  writable: true
48
49
  },
49
- protected: { type: networkAddressType, collection: true, writable: true },
50
- internal: { type: networkAddressType, collection: true, writable: true },
50
+ protected: {
51
+ ...default_attribute_writable,
52
+ type: networkAddressType,
53
+ collection: true
54
+ },
55
+ internal: {
56
+ ...default_attribute_writable,
57
+ type: networkAddressType,
58
+ collection: true
59
+ },
51
60
  hasSVRRecords: boolean_attribute_writable_false,
52
61
  hasCatalog: boolean_attribute_writable_true,
53
62
  hasLinkLocalAdresses: boolean_attribute_writable_false,
54
63
  hasLocationRecord: boolean_attribute_writable_true,
55
64
  excludeInterfaceKinds: string_collection_attribute_writable,
56
- exclude: { type: networkAddressType, collection: true, writable: true },
65
+ exclude: {
66
+ ...default_attribute_writable,
67
+ type: networkAddressType,
68
+ collection: true
69
+ },
57
70
  notify: boolean_attribute_writable_false,
58
71
  recordTTL: string_attribute_writable,
59
72
  serial: number_attribute_writable,
@@ -543,7 +556,9 @@ export class BindService extends ExtraSourceService {
543
556
  }
544
557
 
545
558
  get defaultRecords() {
546
- const nameService = this.findService('(type="dns" || type="bind") && priority>=300'); // TODO bind = dns ?
559
+ const nameService = this.findService(
560
+ '(type="dns" || type="bind") && priority>=300'
561
+ ); // TODO bind = dns ?
547
562
 
548
563
  const SOARecord = DNSRecord(
549
564
  "@",
@@ -87,7 +87,7 @@ export class ChronyService extends ExtraSourceService {
87
87
 
88
88
  const lines = [
89
89
  ...serviceEndpoints(this, {
90
- services: 'type="ntp" && priority>=100',
90
+ services: '(type="ntp" || type="chrony") && priority>=100',
91
91
  endpoints: e =>
92
92
  e.type === "ntp" &&
93
93
  !isLinkLocal(e.address) &&
package/types/base.d.mts CHANGED
@@ -10,15 +10,8 @@ export class Base {
10
10
  attributes: {
11
11
  owner: {
12
12
  type: string;
13
- collection: boolean;
14
- writable: boolean;
15
- };
16
- type: import("pacc").AttributeDefinition;
17
- name: import("pacc").AttributeDefinition;
18
- description: {
19
- writable: boolean;
20
- type: object;
21
13
  isKey: boolean;
14
+ writable: boolean;
22
15
  mandatory: boolean;
23
16
  collection: boolean;
24
17
  private?: boolean;
@@ -33,6 +26,9 @@ export class Base {
33
26
  env?: string[] | string;
34
27
  additionalValues?: object;
35
28
  };
29
+ type: import("pacc").AttributeDefinition;
30
+ name: import("pacc").AttributeDefinition;
31
+ description: import("pacc").AttributeDefinition;
36
32
  priority: import("pacc").AttributeDefinition;
37
33
  directory: import("pacc").AttributeDefinition;
38
34
  packaging: import("pacc").AttributeDefinition;
@@ -11,15 +11,8 @@ export class Cluster extends Host {
11
11
  attributes: {
12
12
  owner: {
13
13
  type: string;
14
- collection: boolean;
15
- writable: boolean;
16
- };
17
- type: import("pacc").AttributeDefinition;
18
- name: import("pacc").AttributeDefinition;
19
- description: {
20
- writable: boolean;
21
- type: object;
22
14
  isKey: boolean;
15
+ writable: boolean;
23
16
  mandatory: boolean;
24
17
  collection: boolean;
25
18
  private?: boolean;
@@ -34,6 +27,9 @@ export class Cluster extends Host {
34
27
  env?: string[] | string;
35
28
  additionalValues?: object;
36
29
  };
30
+ type: import("pacc").AttributeDefinition;
31
+ name: import("pacc").AttributeDefinition;
32
+ description: import("pacc").AttributeDefinition;
37
33
  priority: import("pacc").AttributeDefinition;
38
34
  directory: import("pacc").AttributeDefinition;
39
35
  packaging: import("pacc").AttributeDefinition;
@@ -64,12 +60,38 @@ export class Cluster extends Host {
64
60
  hosts: {
65
61
  type: string;
66
62
  collection: boolean;
63
+ isKey: boolean;
67
64
  writable: boolean;
65
+ mandatory: boolean;
66
+ private?: boolean;
67
+ depends?: string;
68
+ description?: string;
69
+ default?: any;
70
+ set?: Function;
71
+ get?: Function;
72
+ prepareValue?: Function;
73
+ values?: Set<any>;
74
+ externalName?: string;
75
+ env?: string[] | string;
76
+ additionalValues?: object;
68
77
  };
69
78
  clusters: {
70
79
  type: string;
71
80
  collection: boolean;
81
+ isKey: boolean;
72
82
  writable: boolean;
83
+ mandatory: boolean;
84
+ private?: boolean;
85
+ depends?: string;
86
+ description?: string;
87
+ default?: any;
88
+ set?: Function;
89
+ get?: Function;
90
+ prepareValue?: Function;
91
+ values?: Set<any>;
92
+ externalName?: string;
93
+ env?: string[] | string;
94
+ additionalValues?: object;
73
95
  };
74
96
  subnets: {
75
97
  type: {
@@ -103,7 +125,20 @@ export class Cluster extends Host {
103
125
  };
104
126
  };
105
127
  collection: boolean;
128
+ isKey: boolean;
106
129
  writable: boolean;
130
+ mandatory: boolean;
131
+ private?: boolean;
132
+ depends?: string;
133
+ description?: string;
134
+ default?: any;
135
+ set?: Function;
136
+ get?: Function;
137
+ prepareValue?: Function;
138
+ values?: Set<any>;
139
+ externalName?: string;
140
+ env?: string[] | string;
141
+ additionalValues?: object;
107
142
  };
108
143
  country: import("pacc").AttributeDefinition;
109
144
  domain: import("pacc").AttributeDefinition;
@@ -142,15 +177,8 @@ export class Cluster extends Host {
142
177
  attributes: {
143
178
  owner: {
144
179
  type: string;
145
- collection: boolean;
146
- writable: boolean;
147
- };
148
- type: import("pacc").AttributeDefinition;
149
- name: import("pacc").AttributeDefinition;
150
- description: {
151
- writable: boolean;
152
- type: object;
153
180
  isKey: boolean;
181
+ writable: boolean;
154
182
  mandatory: boolean;
155
183
  collection: boolean;
156
184
  private?: boolean;
@@ -165,6 +193,9 @@ export class Cluster extends Host {
165
193
  env?: string[] | string;
166
194
  additionalValues?: object;
167
195
  };
196
+ type: import("pacc").AttributeDefinition;
197
+ name: import("pacc").AttributeDefinition;
198
+ description: import("pacc").AttributeDefinition;
168
199
  priority: import("pacc").AttributeDefinition;
169
200
  directory: import("pacc").AttributeDefinition;
170
201
  packaging: import("pacc").AttributeDefinition;
@@ -177,12 +208,38 @@ export class Cluster extends Host {
177
208
  networkInterfaces: {
178
209
  type: string;
179
210
  collection: boolean;
211
+ isKey: boolean;
180
212
  writable: boolean;
213
+ mandatory: boolean;
214
+ private?: boolean;
215
+ depends?: string;
216
+ description?: string;
217
+ default?: any;
218
+ set?: Function;
219
+ get?: Function;
220
+ prepareValue?: Function;
221
+ values?: Set<any>;
222
+ externalName?: string;
223
+ env?: string[] | string;
224
+ additionalValues?: object;
181
225
  };
182
226
  services: {
183
227
  type: string;
184
228
  collection: boolean;
229
+ isKey: boolean;
185
230
  writable: boolean;
231
+ mandatory: boolean;
232
+ private?: boolean;
233
+ depends?: string;
234
+ description?: string;
235
+ default?: any;
236
+ set?: Function;
237
+ get?: Function;
238
+ prepareValue?: Function;
239
+ values?: Set<any>;
240
+ externalName?: string;
241
+ env?: string[] | string;
242
+ additionalValues?: object;
186
243
  };
187
244
  aliases: import("pacc").AttributeDefinition;
188
245
  os: {
@@ -269,7 +326,20 @@ export class Cluster extends Host {
269
326
  extends: {
270
327
  type: string;
271
328
  collection: boolean;
329
+ isKey: boolean;
272
330
  writable: boolean;
331
+ mandatory: boolean;
332
+ private?: boolean;
333
+ depends?: string;
334
+ description?: string;
335
+ default?: any;
336
+ set?: Function;
337
+ get?: Function;
338
+ prepareValue?: Function;
339
+ values?: Set<any>;
340
+ externalName?: string;
341
+ env?: string[] | string;
342
+ additionalValues?: object;
273
343
  };
274
344
  model: import("pacc").AttributeDefinition;
275
345
  isModel: import("pacc").AttributeDefinition;
@@ -303,17 +373,56 @@ export class Cluster extends Host {
303
373
  masters: {
304
374
  type: string;
305
375
  collection: boolean;
376
+ isKey: boolean;
306
377
  writable: boolean;
378
+ mandatory: boolean;
379
+ private?: boolean;
380
+ depends?: string;
381
+ description?: string;
382
+ default?: any;
383
+ set?: Function;
384
+ get?: Function;
385
+ prepareValue?: Function;
386
+ values?: Set<any>;
387
+ externalName?: string;
388
+ env?: string[] | string;
389
+ additionalValues?: object;
307
390
  };
308
391
  backups: {
309
392
  type: string;
310
393
  collection: boolean;
394
+ isKey: boolean;
311
395
  writable: boolean;
396
+ mandatory: boolean;
397
+ private?: boolean;
398
+ depends?: string;
399
+ description?: string;
400
+ default?: any;
401
+ set?: Function;
402
+ get?: Function;
403
+ prepareValue?: Function;
404
+ values?: Set<any>;
405
+ externalName?: string;
406
+ env?: string[] | string;
407
+ additionalValues?: object;
312
408
  };
313
409
  members: {
314
410
  type: string;
315
411
  collection: boolean;
412
+ isKey: boolean;
316
413
  writable: boolean;
414
+ mandatory: boolean;
415
+ private?: boolean;
416
+ depends?: string;
417
+ description?: string;
418
+ default?: any;
419
+ set?: Function;
420
+ get?: Function;
421
+ prepareValue?: Function;
422
+ values?: Set<any>;
423
+ externalName?: string;
424
+ env?: string[] | string;
425
+ additionalValues?: object;
317
426
  };
318
427
  checkInterval: import("pacc").AttributeDefinition;
319
428
  };