pmcf 1.77.2 → 1.78.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.77.2",
3
+ "version": "1.78.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/dns.mjs CHANGED
@@ -18,6 +18,8 @@ const DNSServiceTypeDefinition = {
18
18
  owners: ["location", "owner", "network", "cluster", "root"],
19
19
  priority: 0.1,
20
20
  properties: {
21
+ source: { type: "network", collection: true, writeable: true },
22
+ trusted: { type: "network", collection: true, writeable: true },
21
23
  hasSVRRecords: { type: "boolean", collection: false, writeable: true },
22
24
  hasCatalog: { type: "boolean", collection: false, writeable: true },
23
25
  hasLinkLocalAdresses: {
@@ -31,8 +33,6 @@ const DNSServiceTypeDefinition = {
31
33
  retry: { type: "string", collection: false, writeable: true },
32
34
  expire: { type: "string", collection: false, writeable: true },
33
35
  minimum: { type: "string", collection: false, writeable: true },
34
- forwardsTo: { type: "network", collection: true, writeable: true },
35
- trusted: { type: "network", collection: true, writeable: true },
36
36
  allowedUpdates: { type: "string", collection: true, writeable: true }
37
37
  }
38
38
  };
@@ -46,7 +46,7 @@ export class DNSService extends Base {
46
46
  hasCatalog = true;
47
47
  hasLinkLocalAdresses = true;
48
48
  notify = true;
49
- #forwardsTo = [];
49
+ #source = [];
50
50
  #trusted = [];
51
51
 
52
52
  refresh = 36000;
@@ -84,23 +84,23 @@ export class DNSService extends Base {
84
84
  return this.#trusted;
85
85
  }
86
86
 
87
- set forwardsTo(value) {
88
- this.#forwardsTo.push(value);
87
+ set source(value) {
88
+ this.#source.push(value);
89
89
  }
90
90
 
91
- get forwardsTo() {
92
- return this.#forwardsTo;
91
+ get source() {
92
+ return this.#source;
93
93
  }
94
94
 
95
95
  *findServices(filter) {
96
96
  yield* this.owner.findServices(filter);
97
97
 
98
- for (const s of this.forwardsTo) {
98
+ for (const s of this.source) {
99
99
  yield* s.findServices(filter);
100
100
  }
101
101
  }
102
102
 
103
- get resolvedConfig() {
103
+ get systemdConfig() {
104
104
  return {
105
105
  DNS: serviceAddresses(this, {
106
106
  ...DNS_SERVICE_FILTER,
@@ -133,7 +133,7 @@ export class DNSService extends Base {
133
133
 
134
134
  const options = [
135
135
  "forwarders {",
136
- ...serviceAddresses(this.forwardsTo, DNS_SERVICE_FILTER).map(
136
+ ...serviceAddresses(this.source, DNS_SERVICE_FILTER).map(
137
137
  a => ` ${a};`
138
138
  ),
139
139
  "};"
package/src/location.mjs CHANGED
@@ -55,7 +55,7 @@ export class Location extends Owner {
55
55
  await writeLines(
56
56
  join(stagingDir, "etc/systemd/resolved.conf.d"),
57
57
  `${this.name}.conf`,
58
- sectionLines("Resolve", this.dns.resolvedConfig)
58
+ sectionLines("Resolve", this.dns.systemdConfig)
59
59
  );
60
60
 
61
61
  await writeLines(
@@ -71,11 +71,7 @@ export class Location extends Owner {
71
71
  await writeLines(
72
72
  join(stagingDir, "etc/systemd/timesyncd.conf.d"),
73
73
  `${this.name}.conf`,
74
- sectionLines("Time", {
75
- NTP: this.ntp.servers.join(" "),
76
- PollIntervalMinSec: 60,
77
- SaveIntervalSec: 3600
78
- })
74
+ sectionLines("Time", this.ntp.systemdConfig)
79
75
  );
80
76
 
81
77
  const locationDir = join(stagingDir, "etc", "location");
package/src/module.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./base.mjs";
2
2
  export * from "./service.mjs";
3
3
  export * from "./dns.mjs";
4
+ export * from "./ntp.mjs";
4
5
  export * from "./cluster.mjs";
5
6
  export * from "./owner.mjs";
6
7
  export * from "./location.mjs";
package/src/ntp.mjs ADDED
@@ -0,0 +1,65 @@
1
+ import { Base } from "./base.mjs";
2
+ import { addType } from "./types.mjs";
3
+ import { serviceAddresses } from "./service.mjs";
4
+
5
+ const NTPServiceTypeDefinition = {
6
+ name: "ntp",
7
+ owners: ["location", "owner", "network", "cluster", "root"],
8
+ priority: 0.1,
9
+ properties: {
10
+ source: { type: "network", collection: true, writeable: true }
11
+ }
12
+ };
13
+
14
+ const NTP_SERVICE_FILTER = { type: NTPServiceTypeDefinition.name };
15
+
16
+ export class NTPService extends Base {
17
+ #source = [];
18
+
19
+ static {
20
+ addType(this);
21
+ }
22
+
23
+ static get typeDefinition() {
24
+ return NTPServiceTypeDefinition;
25
+ }
26
+
27
+ constructor(owner, data) {
28
+ if (!data.name) {
29
+ data.name = NTPServiceTypeDefinition.name; // TODO
30
+ }
31
+ super(owner, data);
32
+ this.read(data, NTPServiceTypeDefinition);
33
+
34
+ owner.addObject(this);
35
+ }
36
+
37
+ set source(value) {
38
+ this.#source.push(value);
39
+ }
40
+
41
+ get source() {
42
+ return this.#source;
43
+ }
44
+
45
+ *findServices(filter) {
46
+ yield* this.owner.findServices(filter);
47
+
48
+ for (const s of this.source) {
49
+ yield* s.findServices(filter);
50
+ }
51
+ }
52
+
53
+ get systemdConfig() {
54
+ return {
55
+ NTP: serviceAddresses(
56
+ this,
57
+ {
58
+ ...NTP_SERVICE_FILTER,
59
+ priority: "<20"
60
+ },
61
+ "domainName"
62
+ ).join(" ")
63
+ };
64
+ }
65
+ }
package/src/owner.mjs CHANGED
@@ -3,6 +3,7 @@ import { Base } from "./base.mjs";
3
3
  import { Subnet } from "./subnet.mjs";
4
4
  import { addType } from "./types.mjs";
5
5
  import { DNSService } from "./dns.mjs";
6
+ import { NTPService } from "./ntp.mjs";
6
7
 
7
8
  const OwnerTypeDefinition = {
8
9
  name: "owner",
@@ -19,7 +20,12 @@ const OwnerTypeDefinition = {
19
20
  collection: false,
20
21
  writeable: true
21
22
  },
22
- ntp: { type: "string", collection: false, writeable: true },
23
+ ntp: {
24
+ type: NTPService.typeDefinition,
25
+ collection: false,
26
+ writeable: true
27
+ },
28
+
23
29
  country: { type: "string", collection: false, writeable: true },
24
30
  domain: { type: "string", collection: false, writeable: true },
25
31
  timezone: { type: "string", collection: false, writeable: true },
@@ -33,7 +39,6 @@ const EMPTY = new Map();
33
39
  export class Owner extends Base {
34
40
  #membersByType = new Map();
35
41
  #bridges = new Set();
36
- ntp;
37
42
 
38
43
  static {
39
44
  addType(this);
@@ -57,6 +62,7 @@ export class Owner extends Base {
57
62
  }
58
63
 
59
64
  this.dns?._traverse(...args);
65
+ this.ntp?._traverse(...args);
60
66
 
61
67
  return true;
62
68
  }
@@ -92,6 +92,16 @@ export class Cluster extends Host {
92
92
  owners: string[];
93
93
  priority: number;
94
94
  properties: {
95
+ source: {
96
+ type: string;
97
+ collection: boolean;
98
+ writeable: boolean;
99
+ };
100
+ trusted: {
101
+ type: string;
102
+ collection: boolean;
103
+ writeable: boolean;
104
+ };
95
105
  hasSVRRecords: {
96
106
  type: string;
97
107
  collection: boolean;
@@ -137,16 +147,6 @@ export class Cluster extends Host {
137
147
  collection: boolean;
138
148
  writeable: boolean;
139
149
  };
140
- forwardsTo: {
141
- type: string;
142
- collection: boolean;
143
- writeable: boolean;
144
- };
145
- trusted: {
146
- type: string;
147
- collection: boolean;
148
- writeable: boolean;
149
- };
150
150
  allowedUpdates: {
151
151
  type: string;
152
152
  collection: boolean;
@@ -158,7 +158,18 @@ export class Cluster extends Host {
158
158
  writeable: boolean;
159
159
  };
160
160
  ntp: {
161
- type: string;
161
+ type: {
162
+ name: string;
163
+ owners: string[];
164
+ priority: number;
165
+ properties: {
166
+ source: {
167
+ type: string;
168
+ collection: boolean;
169
+ writeable: boolean;
170
+ };
171
+ };
172
+ };
162
173
  collection: boolean;
163
174
  writeable: boolean;
164
175
  };
@@ -281,6 +292,16 @@ export class Cluster extends Host {
281
292
  owners: string[];
282
293
  priority: number;
283
294
  properties: {
295
+ source: {
296
+ type: string;
297
+ collection: boolean;
298
+ writeable: boolean;
299
+ };
300
+ trusted: {
301
+ type: string;
302
+ collection: boolean;
303
+ writeable: boolean;
304
+ };
284
305
  hasSVRRecords: {
285
306
  type: string;
286
307
  collection: boolean;
@@ -326,16 +347,6 @@ export class Cluster extends Host {
326
347
  collection: boolean;
327
348
  writeable: boolean;
328
349
  };
329
- forwardsTo: {
330
- type: string;
331
- collection: boolean;
332
- writeable: boolean;
333
- };
334
- trusted: {
335
- type: string;
336
- collection: boolean;
337
- writeable: boolean;
338
- };
339
350
  allowedUpdates: {
340
351
  type: string;
341
352
  collection: boolean;
@@ -347,7 +358,18 @@ export class Cluster extends Host {
347
358
  writeable: boolean;
348
359
  };
349
360
  ntp: {
350
- type: string;
361
+ type: {
362
+ name: string;
363
+ owners: string[];
364
+ priority: number;
365
+ properties: {
366
+ source: {
367
+ type: string;
368
+ collection: boolean;
369
+ writeable: boolean;
370
+ };
371
+ };
372
+ };
351
373
  collection: boolean;
352
374
  writeable: boolean;
353
375
  };
package/types/dns.d.mts CHANGED
@@ -6,6 +6,16 @@ export class DNSService extends Base {
6
6
  owners: string[];
7
7
  priority: number;
8
8
  properties: {
9
+ source: {
10
+ type: string;
11
+ collection: boolean;
12
+ writeable: boolean;
13
+ };
14
+ trusted: {
15
+ type: string;
16
+ collection: boolean;
17
+ writeable: boolean;
18
+ };
9
19
  hasSVRRecords: {
10
20
  type: string;
11
21
  collection: boolean;
@@ -51,16 +61,6 @@ export class DNSService extends Base {
51
61
  collection: boolean;
52
62
  writeable: boolean;
53
63
  };
54
- forwardsTo: {
55
- type: string;
56
- collection: boolean;
57
- writeable: boolean;
58
- };
59
- trusted: {
60
- type: string;
61
- collection: boolean;
62
- writeable: boolean;
63
- };
64
64
  allowedUpdates: {
65
65
  type: string;
66
66
  collection: boolean;
@@ -81,9 +81,9 @@ export class DNSService extends Base {
81
81
  get soaUpdates(): number[];
82
82
  set trusted(value: any[]);
83
83
  get trusted(): any[];
84
- set forwardsTo(value: any[]);
85
- get forwardsTo(): any[];
86
- get resolvedConfig(): {
84
+ set source(value: any[]);
85
+ get source(): any[];
86
+ get systemdConfig(): {
87
87
  DNS: string;
88
88
  FallbackDNS: string;
89
89
  Domains: string;
@@ -92,6 +92,16 @@ export class Location extends Owner {
92
92
  owners: string[];
93
93
  priority: number;
94
94
  properties: {
95
+ source: {
96
+ type: string;
97
+ collection: boolean;
98
+ writeable: boolean;
99
+ };
100
+ trusted: {
101
+ type: string;
102
+ collection: boolean;
103
+ writeable: boolean;
104
+ };
95
105
  hasSVRRecords: {
96
106
  type: string;
97
107
  collection: boolean;
@@ -137,16 +147,6 @@ export class Location extends Owner {
137
147
  collection: boolean;
138
148
  writeable: boolean;
139
149
  };
140
- forwardsTo: {
141
- type: string;
142
- collection: boolean;
143
- writeable: boolean;
144
- };
145
- trusted: {
146
- type: string;
147
- collection: boolean;
148
- writeable: boolean;
149
- };
150
150
  allowedUpdates: {
151
151
  type: string;
152
152
  collection: boolean;
@@ -158,7 +158,18 @@ export class Location extends Owner {
158
158
  writeable: boolean;
159
159
  };
160
160
  ntp: {
161
- type: string;
161
+ type: {
162
+ name: string;
163
+ owners: string[];
164
+ priority: number;
165
+ properties: {
166
+ source: {
167
+ type: string;
168
+ collection: boolean;
169
+ writeable: boolean;
170
+ };
171
+ };
172
+ };
162
173
  collection: boolean;
163
174
  writeable: boolean;
164
175
  };
@@ -281,6 +292,16 @@ export class Location extends Owner {
281
292
  owners: string[];
282
293
  priority: number;
283
294
  properties: {
295
+ source: {
296
+ type: string;
297
+ collection: boolean;
298
+ writeable: boolean;
299
+ };
300
+ trusted: {
301
+ type: string;
302
+ collection: boolean;
303
+ writeable: boolean;
304
+ };
284
305
  hasSVRRecords: {
285
306
  type: string;
286
307
  collection: boolean;
@@ -326,16 +347,6 @@ export class Location extends Owner {
326
347
  collection: boolean;
327
348
  writeable: boolean;
328
349
  };
329
- forwardsTo: {
330
- type: string;
331
- collection: boolean;
332
- writeable: boolean;
333
- };
334
- trusted: {
335
- type: string;
336
- collection: boolean;
337
- writeable: boolean;
338
- };
339
350
  allowedUpdates: {
340
351
  type: string;
341
352
  collection: boolean;
@@ -347,7 +358,18 @@ export class Location extends Owner {
347
358
  writeable: boolean;
348
359
  };
349
360
  ntp: {
350
- type: string;
361
+ type: {
362
+ name: string;
363
+ owners: string[];
364
+ priority: number;
365
+ properties: {
366
+ source: {
367
+ type: string;
368
+ collection: boolean;
369
+ writeable: boolean;
370
+ };
371
+ };
372
+ };
351
373
  collection: boolean;
352
374
  writeable: boolean;
353
375
  };
@@ -1,6 +1,7 @@
1
1
  export * from "./base.mjs";
2
2
  export * from "./service.mjs";
3
3
  export * from "./dns.mjs";
4
+ export * from "./ntp.mjs";
4
5
  export * from "./cluster.mjs";
5
6
  export * from "./owner.mjs";
6
7
  export * from "./location.mjs";
@@ -94,6 +94,16 @@ export class Network extends Owner {
94
94
  owners: string[];
95
95
  priority: number;
96
96
  properties: {
97
+ source: {
98
+ type: string;
99
+ collection: boolean;
100
+ writeable: boolean;
101
+ };
102
+ trusted: {
103
+ type: string;
104
+ collection: boolean;
105
+ writeable: boolean;
106
+ };
97
107
  hasSVRRecords: {
98
108
  type: string;
99
109
  collection: boolean;
@@ -139,16 +149,6 @@ export class Network extends Owner {
139
149
  collection: boolean;
140
150
  writeable: boolean;
141
151
  };
142
- forwardsTo: {
143
- type: string;
144
- collection: boolean;
145
- writeable: boolean;
146
- };
147
- trusted: {
148
- type: string;
149
- collection: boolean;
150
- writeable: boolean;
151
- };
152
152
  allowedUpdates: {
153
153
  type: string;
154
154
  collection: boolean;
@@ -160,7 +160,18 @@ export class Network extends Owner {
160
160
  writeable: boolean;
161
161
  };
162
162
  ntp: {
163
- type: string;
163
+ type: {
164
+ name: string;
165
+ owners: string[];
166
+ priority: number;
167
+ properties: {
168
+ source: {
169
+ type: string;
170
+ collection: boolean;
171
+ writeable: boolean;
172
+ };
173
+ };
174
+ };
164
175
  collection: boolean;
165
176
  writeable: boolean;
166
177
  };
@@ -0,0 +1,21 @@
1
+ export class NTPService extends Base {
2
+ static get typeDefinition(): {
3
+ name: string;
4
+ owners: string[];
5
+ priority: number;
6
+ properties: {
7
+ source: {
8
+ type: string;
9
+ collection: boolean;
10
+ writeable: boolean;
11
+ };
12
+ };
13
+ };
14
+ set source(value: any[]);
15
+ get source(): any[];
16
+ get systemdConfig(): {
17
+ NTP: string;
18
+ };
19
+ #private;
20
+ }
21
+ import { Base } from "./base.mjs";
package/types/owner.d.mts CHANGED
@@ -90,6 +90,16 @@ export class Owner extends Base {
90
90
  owners: string[];
91
91
  priority: number;
92
92
  properties: {
93
+ source: {
94
+ type: string;
95
+ collection: boolean;
96
+ writeable: boolean;
97
+ };
98
+ trusted: {
99
+ type: string;
100
+ collection: boolean;
101
+ writeable: boolean;
102
+ };
93
103
  hasSVRRecords: {
94
104
  type: string;
95
105
  collection: boolean;
@@ -135,16 +145,6 @@ export class Owner extends Base {
135
145
  collection: boolean;
136
146
  writeable: boolean;
137
147
  };
138
- forwardsTo: {
139
- type: string;
140
- collection: boolean;
141
- writeable: boolean;
142
- };
143
- trusted: {
144
- type: string;
145
- collection: boolean;
146
- writeable: boolean;
147
- };
148
148
  allowedUpdates: {
149
149
  type: string;
150
150
  collection: boolean;
@@ -156,7 +156,18 @@ export class Owner extends Base {
156
156
  writeable: boolean;
157
157
  };
158
158
  ntp: {
159
- type: string;
159
+ type: {
160
+ name: string;
161
+ owners: string[];
162
+ priority: number;
163
+ properties: {
164
+ source: {
165
+ type: string;
166
+ collection: boolean;
167
+ writeable: boolean;
168
+ };
169
+ };
170
+ };
160
171
  collection: boolean;
161
172
  writeable: boolean;
162
173
  };
@@ -187,7 +198,6 @@ export class Owner extends Base {
187
198
  };
188
199
  };
189
200
  };
190
- ntp: any;
191
201
  _traverse(...args: any[]): boolean;
192
202
  named(name: any): any;
193
203
  typeObject(typeName: any): any;
package/types/root.d.mts CHANGED
@@ -96,6 +96,16 @@ export class Root extends Location {
96
96
  owners: string[];
97
97
  priority: number;
98
98
  properties: {
99
+ source: {
100
+ type: string;
101
+ collection: boolean;
102
+ writeable: boolean;
103
+ };
104
+ trusted: {
105
+ type: string;
106
+ collection: boolean;
107
+ writeable: boolean;
108
+ };
99
109
  hasSVRRecords: {
100
110
  type: string;
101
111
  collection: boolean;
@@ -141,16 +151,6 @@ export class Root extends Location {
141
151
  collection: boolean;
142
152
  writeable: boolean;
143
153
  };
144
- forwardsTo: {
145
- type: string;
146
- collection: boolean;
147
- writeable: boolean;
148
- };
149
- trusted: {
150
- type: string;
151
- collection: boolean;
152
- writeable: boolean;
153
- };
154
154
  allowedUpdates: {
155
155
  type: string;
156
156
  collection: boolean;
@@ -162,7 +162,18 @@ export class Root extends Location {
162
162
  writeable: boolean;
163
163
  };
164
164
  ntp: {
165
- type: string;
165
+ type: {
166
+ name: string;
167
+ owners: string[];
168
+ priority: number;
169
+ properties: {
170
+ source: {
171
+ type: string;
172
+ collection: boolean;
173
+ writeable: boolean;
174
+ };
175
+ };
176
+ };
166
177
  collection: boolean;
167
178
  writeable: boolean;
168
179
  };
@@ -285,6 +296,16 @@ export class Root extends Location {
285
296
  owners: string[];
286
297
  priority: number;
287
298
  properties: {
299
+ source: {
300
+ type: string;
301
+ collection: boolean;
302
+ writeable: boolean;
303
+ };
304
+ trusted: {
305
+ type: string;
306
+ collection: boolean;
307
+ writeable: boolean;
308
+ };
288
309
  hasSVRRecords: {
289
310
  type: string;
290
311
  collection: boolean;
@@ -330,16 +351,6 @@ export class Root extends Location {
330
351
  collection: boolean;
331
352
  writeable: boolean;
332
353
  };
333
- forwardsTo: {
334
- type: string;
335
- collection: boolean;
336
- writeable: boolean;
337
- };
338
- trusted: {
339
- type: string;
340
- collection: boolean;
341
- writeable: boolean;
342
- };
343
354
  allowedUpdates: {
344
355
  type: string;
345
356
  collection: boolean;
@@ -351,7 +362,18 @@ export class Root extends Location {
351
362
  writeable: boolean;
352
363
  };
353
364
  ntp: {
354
- type: string;
365
+ type: {
366
+ name: string;
367
+ owners: string[];
368
+ priority: number;
369
+ properties: {
370
+ source: {
371
+ type: string;
372
+ collection: boolean;
373
+ writeable: boolean;
374
+ };
375
+ };
376
+ };
355
377
  collection: boolean;
356
378
  writeable: boolean;
357
379
  };