pmcf 3.2.0 → 3.3.0

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 (35) hide show
  1. package/package.json +2 -2
  2. package/src/base.mjs +2 -2
  3. package/src/cluster.mjs +3 -2
  4. package/src/host.mjs +4 -4
  5. package/src/network-support.mjs +3 -3
  6. package/src/service.mjs +5 -8
  7. package/src/services/bind.mjs +23 -25
  8. package/src/subnet.mjs +2 -2
  9. package/types/base.d.mts +10 -1
  10. package/types/cluster.d.mts +71 -12
  11. package/types/extra-source-service.d.mts +39 -17
  12. package/types/host.d.mts +31 -8
  13. package/types/location.d.mts +40 -4
  14. package/types/network-interfaces/ethernet.d.mts +60 -10
  15. package/types/network-interfaces/loopback.d.mts +60 -10
  16. package/types/network-interfaces/network-interface.d.mts +60 -10
  17. package/types/network-interfaces/wireguard.d.mts +60 -10
  18. package/types/network-interfaces/wlan.d.mts +90 -15
  19. package/types/network-support.d.mts +31 -23
  20. package/types/network.d.mts +40 -6
  21. package/types/owner.d.mts +20 -2
  22. package/types/root.d.mts +40 -4
  23. package/types/service.d.mts +89 -49
  24. package/types/services/bind.d.mts +86 -98
  25. package/types/services/chrony.d.mts +78 -34
  26. package/types/services/influxdb.d.mts +78 -34
  27. package/types/services/kea.d.mts +78 -34
  28. package/types/services/mosquitto.d.mts +78 -34
  29. package/types/services/openldap.d.mts +78 -34
  30. package/types/services/systemd-journal-remote.d.mts +78 -34
  31. package/types/services/systemd-journal-upload.d.mts +78 -34
  32. package/types/services/systemd-journal.d.mts +78 -34
  33. package/types/services/systemd-resolved.d.mts +78 -34
  34. package/types/services/systemd-timesyncd.d.mts +78 -34
  35. package/types/subnet.d.mts +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,7 +52,7 @@
52
52
  "dependencies": {
53
53
  "ip-utilties": "^1.4.7",
54
54
  "npm-pkgbuild": "^18.2.16",
55
- "pacc": "^4.1.0",
55
+ "pacc": "^4.1.1",
56
56
  "package-directory": "^8.1.0"
57
57
  },
58
58
  "devDependencies": {
package/src/base.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { allOutputs } from "npm-pkgbuild";
3
- import { getAttribute, default_attribute, description_attribute, boolean_attribute } from "pacc";
3
+ import { getAttribute, default_attribute, number_attribute, description_attribute, boolean_attribute } from "pacc";
4
4
  import { addType, primitives, typeFactory } from "./types.mjs";
5
5
  import { asArray } from "./utils.mjs";
6
6
 
@@ -16,7 +16,7 @@ const BaseTypeDefinition = {
16
16
  writable: true
17
17
  },
18
18
  description: { ...description_attribute, writable: true },
19
- priority: { type: "number", collection: false, writable: true },
19
+ priority: { ...number_attribute, writable: true },
20
20
  directory: { ...default_attribute, writable: false },
21
21
  packaging: { ...default_attribute, writable: true },
22
22
  disabled: {
package/src/cluster.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
+ import { number_attribute } from "pacc";
3
4
  import { Owner } from "./owner.mjs";
4
5
  import { Host } from "./host.mjs";
5
6
  import { serviceEndpoints } from "pmcf";
@@ -12,11 +13,11 @@ const ClusterTypeDefinition = {
12
13
  priority: 0.7,
13
14
  extends: Host.typeDefinition,
14
15
  properties: {
15
- routerId: { type: "number", collection: false, writable: true },
16
+ routerId: { ...number_attribute, writable: true },
16
17
  masters: { type: "network_interface", collection: true, writable: true },
17
18
  backups: { type: "network_interface", collection: true, writable: true },
18
19
  members: { type: "network_interface", collection: true, writable: false },
19
- checkInterval: { type: "number", collection: false, writable: true }
20
+ checkInterval: { ...number_attribute, writable: true }
20
21
  }
21
22
  };
22
23
 
package/src/host.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
- import { default_attribute } from "pacc";
4
+ import { default_attribute, number_attribute, boolean_attribute_false } from "pacc";
5
5
  import { ServiceOwner, Base, addresses } from "pmcf";
6
6
  import { networkAddressProperties } from "./network-support.mjs";
7
7
  import { addHook } from "./hooks.mjs";
@@ -31,7 +31,7 @@ const HostTypeDefinition = {
31
31
  writable: true
32
32
  },
33
33
  services: { type: "service", collection: true, writable: true },
34
- aliases: { type: "string", collection: true, writable: true },
34
+ aliases: { ...default_attribute, collection: true, writable: true },
35
35
  os: {
36
36
  ...default_attribute,
37
37
  writable: true,
@@ -44,7 +44,7 @@ const HostTypeDefinition = {
44
44
  writable: true,
45
45
  values: ["production", "development"]
46
46
  },
47
- weight: { type: "number", collection: false, writable: true },
47
+ weight: { ...number_attribute, writable: true },
48
48
  serial: { ...default_attribute, writable: true },
49
49
  vendor: { ...default_attribute, writable: true },
50
50
  keymap: { ...default_attribute, writable: true },
@@ -76,7 +76,7 @@ const HostTypeDefinition = {
76
76
  provides: { ...default_attribute, collection: true, writable: true },
77
77
  extends: { type: "host", collection: true, writable: true },
78
78
  model: { ...default_attribute, collection: false, writable: false },
79
- isModel: { type: "boolean", collection: false, writable: false }
79
+ isModel: boolean_attribute_false
80
80
  }
81
81
  };
82
82
 
@@ -1,4 +1,4 @@
1
- import { default_attribute, hostname_attribute, boolean_attribute } from "pacc";
1
+ import { default_attribute, number_attribute, hostname_attribute, boolean_attribute } from "pacc";
2
2
 
3
3
  export const networkProperties = {
4
4
  scope: {
@@ -19,8 +19,8 @@ export const networkProperties = {
19
19
  },
20
20
  ssid: { ...default_attribute, writable: true },
21
21
  psk: { ...default_attribute, writable: true },
22
- metric: { type: "number", collection: false, writable: true, default: 1004 },
23
- mtu: { type: "number", collection: false, writable: true, default: 1500 },
22
+ metric: { ...number_attribute, writable: true, default: 1004 },
23
+ mtu: { ...number_attribute, writable: true, default: 1500 },
24
24
  gateway: { type: "host", collection: false, writable: true },
25
25
  multicastDNS: {
26
26
  ...boolean_attribute,
package/src/service.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { default_attribute, boolean_attribute } from "pacc";
1
+ import { default_attribute, string_attribute, number_attribute, boolean_attribute_false } from "pacc";
2
2
  import {
3
3
  Base,
4
4
  Host,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./dns-utils.mjs";
21
21
 
22
22
  export const endpointProperties = {
23
- port: { type: "number", collection: false, writable: true },
23
+ port: { ...number_attribute, writable: true },
24
24
  protocol: {
25
25
  ...default_attribute,
26
26
  writable: true,
@@ -28,10 +28,7 @@ export const endpointProperties = {
28
28
  },
29
29
  type: { ...default_attribute, writable: true },
30
30
  types: { ...default_attribute, collection: true },
31
- tls: {
32
- ...boolean_attribute,
33
- writable: false
34
- }
31
+ tls: boolean_attribute_false
35
32
  };
36
33
 
37
34
  export const EndpointTypeDefinition = {
@@ -63,8 +60,8 @@ export const ServiceTypeDefinition = {
63
60
  ...networkAddressProperties,
64
61
  ...endpointProperties,
65
62
  alias: { ...default_attribute, writable: true },
66
- weight: { type: "number", collection: false, writable: true, default: 1 },
67
- systemd: { type: "string", collection: true, writable: true }
63
+ weight: { ...number_attribute, writable: true, default: 1 },
64
+ systemd: { ...string_attribute, collection: true, writable: true }
68
65
  }
69
66
  };
70
67
 
@@ -2,7 +2,12 @@ import { join } from "node:path";
2
2
  import { createHmac } from "node:crypto";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
4
  import { isLinkLocal, reverseArpa } from "ip-utilties";
5
- import { boolean_attribute, default_attribute } from "pacc";
5
+ import {
6
+ default_attribute,
7
+ boolean_attribute_writeable_true,
8
+ boolean_attribute_writeable_false,
9
+ number_attribute
10
+ } from "pacc";
6
11
  import { writeLines, asArray } from "../utils.mjs";
7
12
  import {
8
13
  DNSRecord,
@@ -38,37 +43,19 @@ const BindServiceTypeDefinition = {
38
43
  },
39
44
  protected: { type: address_types, collection: true, writable: true },
40
45
  internal: { type: address_types, collection: true, writable: true },
41
- hasSVRRecords: {
42
- ...boolean_attribute,
43
- writable: true
44
- },
45
- hasCatalog: {
46
- ...boolean_attribute,
47
- writable: true
48
- },
49
- hasLinkLocalAdresses: {
50
- ...boolean_attribute,
51
- writable: true
52
- },
53
- hasLocationRecord: {
54
- ...boolean_attribute,
55
- writable: true,
56
- default: true
57
- },
46
+ hasSVRRecords: boolean_attribute_writeable_false,
47
+ hasCatalog: boolean_attribute_writeable_true,
48
+ hasLinkLocalAdresses: boolean_attribute_writeable_true,
49
+ hasLocationRecord: boolean_attribute_writeable_true,
58
50
  excludeInterfaceKinds: {
59
51
  ...default_attribute,
60
52
  collection: true,
61
53
  writable: true
62
54
  },
63
-
64
55
  exclude: { type: address_types, collection: true, writable: true },
65
- notify: {
66
- ...boolean_attribute,
67
- writable: true,
68
- default: false
69
- },
56
+ notify: boolean_attribute_writeable_false,
70
57
  recordTTL: { ...default_attribute, writable: true },
71
- serial: { type: "number", collection: false, writable: true },
58
+ serial: { ...number_attribute, writable: true },
72
59
  refresh: { ...default_attribute, writable: true },
73
60
  retry: { ...default_attribute, writable: true },
74
61
  expire: { ...default_attribute, writable: true },
@@ -501,6 +488,11 @@ export class BindService extends ExtraSourceService {
501
488
 
502
489
  outfacingZones(host, view, records) {
503
490
  return host.foreignDomainNames.map(domain => {
491
+ const wildcard = domain.startsWith("*.");
492
+ if (wildcard) {
493
+ domain = domain.substring(2);
494
+ }
495
+
504
496
  const zone = {
505
497
  id: domain,
506
498
  file: `OUTFACING/${domain}.zone`,
@@ -522,6 +514,12 @@ export class BindService extends ExtraSourceService {
522
514
  zone.records.add(
523
515
  DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
524
516
  );
517
+
518
+ if (wildcard) {
519
+ zone.records.add(
520
+ DNSRecord("*", dnsRecordTypeForAddressFamily(na.family), na.address)
521
+ );
522
+ }
525
523
  }
526
524
 
527
525
  return config;
package/src/subnet.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  familyIP,
7
7
  matchPrefixIP
8
8
  } from "ip-utilties";
9
- import { default_attribute } from "pacc";
9
+ import { default_attribute, number_attribute } from "pacc";
10
10
  import { Base } from "./base.mjs";
11
11
  import { addType } from "./types.mjs";
12
12
 
@@ -21,7 +21,7 @@ const SubnetTypeDefinition = {
21
21
  isKey: true
22
22
  },
23
23
  networks: { type: "network", collection: true, writable: true },
24
- prefixLength: { type: "number", collection: false, writable: false }
24
+ prefixLength: { ...number_attribute, writable: false }
25
25
  }
26
26
  };
27
27
 
package/types/base.d.mts CHANGED
@@ -43,9 +43,18 @@ export class Base {
43
43
  env?: string[] | string;
44
44
  };
45
45
  priority: {
46
+ writable: boolean;
46
47
  type: string;
48
+ isKey: boolean;
49
+ mandatory: boolean;
47
50
  collection: boolean;
48
- writable: boolean;
51
+ private?: boolean;
52
+ depends?: string;
53
+ description?: string;
54
+ default?: any;
55
+ set?: Function;
56
+ get?: Function;
57
+ env?: string[] | string;
49
58
  };
50
59
  directory: {
51
60
  writable: boolean;
@@ -44,9 +44,18 @@ export class Cluster extends Host {
44
44
  env?: string[] | string;
45
45
  };
46
46
  priority: {
47
+ writable: boolean;
47
48
  type: string;
49
+ isKey: boolean;
50
+ mandatory: boolean;
48
51
  collection: boolean;
49
- writable: boolean;
52
+ private?: boolean;
53
+ depends?: string;
54
+ description?: string;
55
+ default?: any;
56
+ set?: Function;
57
+ get?: Function;
58
+ env?: string[] | string;
50
59
  };
51
60
  directory: {
52
61
  writable: boolean;
@@ -149,9 +158,18 @@ export class Cluster extends Host {
149
158
  writable: boolean;
150
159
  };
151
160
  prefixLength: {
161
+ writable: boolean;
152
162
  type: string;
163
+ isKey: boolean;
164
+ mandatory: boolean;
153
165
  collection: boolean;
154
- writable: boolean;
166
+ private?: boolean;
167
+ depends?: string;
168
+ description?: string;
169
+ default?: any;
170
+ set?: Function;
171
+ get?: Function;
172
+ env?: string[] | string;
155
173
  };
156
174
  };
157
175
  };
@@ -302,9 +320,18 @@ export class Cluster extends Host {
302
320
  env?: string[] | string;
303
321
  };
304
322
  priority: {
323
+ writable: boolean;
305
324
  type: string;
325
+ isKey: boolean;
326
+ mandatory: boolean;
306
327
  collection: boolean;
307
- writable: boolean;
328
+ private?: boolean;
329
+ depends?: string;
330
+ description?: string;
331
+ default?: any;
332
+ set?: Function;
333
+ get?: Function;
334
+ env?: string[] | string;
308
335
  };
309
336
  directory: {
310
337
  writable: boolean;
@@ -376,9 +403,18 @@ export class Cluster extends Host {
376
403
  writable: boolean;
377
404
  };
378
405
  aliases: {
379
- type: string;
380
406
  collection: boolean;
381
407
  writable: boolean;
408
+ type: string;
409
+ isKey: boolean;
410
+ mandatory: boolean;
411
+ private?: boolean;
412
+ depends?: string;
413
+ description?: string;
414
+ default?: any;
415
+ set?: Function;
416
+ get?: Function;
417
+ env?: string[] | string;
382
418
  };
383
419
  os: {
384
420
  writable: boolean;
@@ -439,9 +475,18 @@ export class Cluster extends Host {
439
475
  env?: string[] | string;
440
476
  };
441
477
  weight: {
478
+ writable: boolean;
442
479
  type: string;
480
+ isKey: boolean;
481
+ mandatory: boolean;
443
482
  collection: boolean;
444
- writable: boolean;
483
+ private?: boolean;
484
+ depends?: string;
485
+ description?: string;
486
+ default?: any;
487
+ set?: Function;
488
+ get?: Function;
489
+ env?: string[] | string;
445
490
  };
446
491
  serial: {
447
492
  writable: boolean;
@@ -576,11 +621,7 @@ export class Cluster extends Host {
576
621
  get?: Function;
577
622
  env?: string[] | string;
578
623
  };
579
- isModel: {
580
- type: string;
581
- collection: boolean;
582
- writable: boolean;
583
- };
624
+ isModel: import("pacc").AttributeDefinition;
584
625
  hostName: {
585
626
  writable: boolean;
586
627
  type: string;
@@ -655,9 +696,18 @@ export class Cluster extends Host {
655
696
  };
656
697
  properties: {
657
698
  routerId: {
699
+ writable: boolean;
658
700
  type: string;
701
+ isKey: boolean;
702
+ mandatory: boolean;
659
703
  collection: boolean;
660
- writable: boolean;
704
+ private?: boolean;
705
+ depends?: string;
706
+ description?: string;
707
+ default?: any;
708
+ set?: Function;
709
+ get?: Function;
710
+ env?: string[] | string;
661
711
  };
662
712
  masters: {
663
713
  type: string;
@@ -675,9 +725,18 @@ export class Cluster extends Host {
675
725
  writable: boolean;
676
726
  };
677
727
  checkInterval: {
728
+ writable: boolean;
678
729
  type: string;
730
+ isKey: boolean;
731
+ mandatory: boolean;
679
732
  collection: boolean;
680
- writable: boolean;
733
+ private?: boolean;
734
+ depends?: string;
735
+ description?: string;
736
+ default?: any;
737
+ set?: Function;
738
+ get?: Function;
739
+ env?: string[] | string;
681
740
  };
682
741
  };
683
742
  };
@@ -58,9 +58,18 @@ export class ExtraSourceService extends Service {
58
58
  env?: string[] | string;
59
59
  };
60
60
  priority: {
61
+ writable: boolean;
61
62
  type: string;
63
+ isKey: boolean;
64
+ mandatory: boolean;
62
65
  collection: boolean;
63
- writable: boolean;
66
+ private?: boolean;
67
+ depends?: string;
68
+ description?: string;
69
+ default?: any;
70
+ set?: Function;
71
+ get?: Function;
72
+ env?: string[] | string;
64
73
  };
65
74
  directory: {
66
75
  writable: boolean;
@@ -138,24 +147,35 @@ export class ExtraSourceService extends Service {
138
147
  env?: string[] | string;
139
148
  };
140
149
  weight: {
141
- type: string;
142
- collection: boolean;
143
150
  writable: boolean;
144
151
  default: number;
145
- };
146
- systemd: {
147
152
  type: string;
153
+ isKey: boolean;
154
+ mandatory: boolean;
148
155
  collection: boolean;
149
- writable: boolean;
156
+ private?: boolean;
157
+ depends?: string;
158
+ description?: string;
159
+ set?: Function;
160
+ get?: Function;
161
+ env?: string[] | string;
150
162
  };
151
- port: {
152
- type: string;
163
+ systemd: {
153
164
  collection: boolean;
154
165
  writable: boolean;
166
+ type: string;
167
+ isKey: boolean;
168
+ mandatory: boolean;
169
+ private?: boolean;
170
+ depends?: string;
171
+ description?: string;
172
+ default?: any;
173
+ set?: Function;
174
+ get?: Function;
175
+ env?: string[] | string;
155
176
  };
156
- protocol: {
177
+ port: {
157
178
  writable: boolean;
158
- values: string[];
159
179
  type: string;
160
180
  isKey: boolean;
161
181
  mandatory: boolean;
@@ -168,8 +188,9 @@ export class ExtraSourceService extends Service {
168
188
  get?: Function;
169
189
  env?: string[] | string;
170
190
  };
171
- type: {
191
+ protocol: {
172
192
  writable: boolean;
193
+ values: string[];
173
194
  type: string;
174
195
  isKey: boolean;
175
196
  mandatory: boolean;
@@ -182,12 +203,12 @@ export class ExtraSourceService extends Service {
182
203
  get?: Function;
183
204
  env?: string[] | string;
184
205
  };
185
- types: {
186
- collection: boolean;
206
+ type: {
207
+ writable: boolean;
187
208
  type: string;
188
209
  isKey: boolean;
189
- writable: boolean;
190
210
  mandatory: boolean;
211
+ collection: boolean;
191
212
  private?: boolean;
192
213
  depends?: string;
193
214
  description?: string;
@@ -196,12 +217,12 @@ export class ExtraSourceService extends Service {
196
217
  get?: Function;
197
218
  env?: string[] | string;
198
219
  };
199
- tls: {
200
- writable: boolean;
220
+ types: {
221
+ collection: boolean;
201
222
  type: string;
202
223
  isKey: boolean;
224
+ writable: boolean;
203
225
  mandatory: boolean;
204
- collection: boolean;
205
226
  private?: boolean;
206
227
  depends?: string;
207
228
  description?: string;
@@ -210,6 +231,7 @@ export class ExtraSourceService extends Service {
210
231
  get?: Function;
211
232
  env?: string[] | string;
212
233
  };
234
+ tls: import("pacc").AttributeDefinition;
213
235
  hostName: {
214
236
  writable: boolean;
215
237
  type: string;
package/types/host.d.mts CHANGED
@@ -42,9 +42,18 @@ export class Host extends ServiceOwner {
42
42
  env?: string[] | string;
43
43
  };
44
44
  priority: {
45
+ writable: boolean;
45
46
  type: string;
47
+ isKey: boolean;
48
+ mandatory: boolean;
46
49
  collection: boolean;
47
- writable: boolean;
50
+ private?: boolean;
51
+ depends?: string;
52
+ description?: string;
53
+ default?: any;
54
+ set?: Function;
55
+ get?: Function;
56
+ env?: string[] | string;
48
57
  };
49
58
  directory: {
50
59
  writable: boolean;
@@ -116,9 +125,18 @@ export class Host extends ServiceOwner {
116
125
  writable: boolean;
117
126
  };
118
127
  aliases: {
119
- type: string;
120
128
  collection: boolean;
121
129
  writable: boolean;
130
+ type: string;
131
+ isKey: boolean;
132
+ mandatory: boolean;
133
+ private?: boolean;
134
+ depends?: string;
135
+ description?: string;
136
+ default?: any;
137
+ set?: Function;
138
+ get?: Function;
139
+ env?: string[] | string;
122
140
  };
123
141
  os: {
124
142
  writable: boolean;
@@ -179,9 +197,18 @@ export class Host extends ServiceOwner {
179
197
  env?: string[] | string;
180
198
  };
181
199
  weight: {
200
+ writable: boolean;
182
201
  type: string;
202
+ isKey: boolean;
203
+ mandatory: boolean;
183
204
  collection: boolean;
184
- writable: boolean;
205
+ private?: boolean;
206
+ depends?: string;
207
+ description?: string;
208
+ default?: any;
209
+ set?: Function;
210
+ get?: Function;
211
+ env?: string[] | string;
185
212
  };
186
213
  serial: {
187
214
  writable: boolean;
@@ -316,11 +343,7 @@ export class Host extends ServiceOwner {
316
343
  get?: Function;
317
344
  env?: string[] | string;
318
345
  };
319
- isModel: {
320
- type: string;
321
- collection: boolean;
322
- writable: boolean;
323
- };
346
+ isModel: import("pacc").AttributeDefinition;
324
347
  hostName: {
325
348
  writable: boolean;
326
349
  type: string;