pmcf 2.33.7 → 2.34.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": "2.33.7",
3
+ "version": "2.34.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/host.mjs CHANGED
@@ -3,7 +3,12 @@ import { join } from "node:path";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
4
  import { ServiceOwner, Base } from "pmcf";
5
5
  import { networkAddressProperties, addresses } from "./network-support.mjs";
6
- import { domainFromDominName, domainName } from "./utils.mjs";
6
+ import {
7
+ domainFromDominName,
8
+ domainName,
9
+ writeLines,
10
+ sectionLines
11
+ } from "./utils.mjs";
7
12
  import { objectFilter } from "./filter.mjs";
8
13
  import { addType, types } from "./types.mjs";
9
14
  import { loadHooks } from "./hooks.mjs";
@@ -484,6 +489,13 @@ export class Host extends ServiceOwner {
484
489
  await generateMachineInfo(this, packageData);
485
490
  await generateKnownHosts(this.owner.hosts(), join(dir, "root", ".ssh"));
486
491
 
492
+ for (const service of this.services) {
493
+ if (service.systemdConfig) {
494
+ const { name, content } = service.systemdConfig(this.name);
495
+ await writeLines(dir, name, sectionLines(...content));
496
+ }
497
+ }
498
+
487
499
  yield packageData;
488
500
  }
489
501
  }
package/src/location.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { FileContentProvider } from "npm-pkgbuild";
2
- import { Owner } from "./owner.mjs";
2
+ import { Owner } from "pmcf";
3
3
  import { addType } from "./types.mjs";
4
- import { writeLines, sectionLines } from "./utils.mjs";
5
4
  import { loadHooks } from "./hooks.mjs";
6
5
 
7
6
  const LocationTypeDefinition = {
@@ -69,21 +68,6 @@ export class Location extends Owner {
69
68
  }
70
69
  };
71
70
 
72
- const configs = [
73
- { type: "dns" },
74
- { type: "systemd-timesyncd" },
75
- { type: "systemd-journal" }
76
- ];
77
-
78
- for (const cfg of configs) {
79
- const service = this.findService(cfg);
80
-
81
- if (service) {
82
- const { name, content } = service.systemdConfig(this.name);
83
- await writeLines(dir, name, sectionLines(...content));
84
- }
85
- }
86
-
87
71
  yield packageData;
88
72
  }
89
73
  }
package/src/module.mjs CHANGED
@@ -15,10 +15,12 @@ export * from "./network-interfaces/wlan.mjs";
15
15
  export * from "./network-interfaces/wireguard.mjs";
16
16
  export * from "./host.mjs";
17
17
  export * from "./service.mjs";
18
+ export * from "./extra-source-service.mjs";
18
19
  export * from "./endpoint.mjs";
19
20
  export * from "./services/dns.mjs";
20
21
  export * from "./services/ntp.mjs";
21
22
  export * from "./services/dhcp.mjs";
22
23
  export * from "./services/systemd-journal.mjs";
23
24
  export * from "./services/systemd-timesyncd.mjs";
25
+ export * from "./services/systemd-resolved.mjs";
24
26
  export * from "./types.mjs";
@@ -9,13 +9,10 @@ import {
9
9
  dnsRecordTypeForAddressFamily,
10
10
  sortZoneRecords
11
11
  } from "../dns-utils.mjs";
12
- import { Endpoint, serviceEndpoints } from "pmcf";
12
+ import { ExtraSourceService, Endpoint, serviceEndpoints } from "pmcf";
13
13
  import { addType } from "../types.mjs";
14
- import { ServiceTypeDefinition, serviceAddresses } from "../service.mjs";
15
- import {
16
- ExtraSourceService,
17
- ExtraSourceServiceTypeDefinition
18
- } from "../extra-source-service.mjs";
14
+ import { ServiceTypeDefinition } from "../service.mjs";
15
+ import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
19
16
  import { addresses } from "../network-support.mjs";
20
17
  import { addHook } from "../hooks.mjs";
21
18
 
@@ -210,29 +207,6 @@ export class DNSService extends ExtraSourceService {
210
207
  return this._excludeInterfaceKinds;
211
208
  }
212
209
 
213
- systemdConfig(name) {
214
- return {
215
- name: `etc/systemd/resolved.conf.d/${name}.conf`,
216
- content: [
217
- "Resolve",
218
- {
219
- DNS: serviceAddresses(this, {
220
- ...DNS_SERVICE_FILTER,
221
- priority: "<10"
222
- }).join(" "),
223
- FallbackDNS: serviceAddresses(this, {
224
- ...DNS_SERVICE_FILTER,
225
- priority: ">=10"
226
- }).join(" "),
227
- Domains: [...this.localDomains].join(" "),
228
- DNSSEC: "no",
229
- MulticastDNS: this.network.multicastDNS ? "yes" : "no",
230
- LLMNR: "no"
231
- }
232
- ]
233
- };
234
- }
235
-
236
210
  async *preparePackages(dir) {
237
211
  const location = this.owner.owner;
238
212
  const name = location.name;
@@ -0,0 +1,58 @@
1
+ import { ExtraSourceService, ServiceTypeDefinition } from "pmcf";
2
+ import { serviceAddresses } from "../service.mjs";
3
+ import { addType } from "../types.mjs";
4
+
5
+ const SystemdResolvedServiceTypeDefinition = {
6
+ name: "systemd-resolved",
7
+ specializationOf: ServiceTypeDefinition,
8
+ owners: ServiceTypeDefinition.owners,
9
+ extends: ServiceTypeDefinition,
10
+ priority: 0.1,
11
+ properties: {}
12
+ };
13
+
14
+ export class SystemdResolvedService extends ExtraSourceService {
15
+ static {
16
+ addType(this);
17
+ }
18
+
19
+ static get typeDefinition() {
20
+ return SystemdResolvedServiceTypeDefinition;
21
+ }
22
+
23
+ constructor(owner, data) {
24
+ super(owner, data);
25
+ this.read(data, SystemdResolvedServiceTypeDefinition);
26
+ }
27
+
28
+ get type() {
29
+ return SystemdResolvedServiceTypeDefinition.name;
30
+ }
31
+
32
+ get systemdServices() {
33
+ return SystemdResolvedServiceTypeDefinition.name;
34
+ }
35
+
36
+ systemdConfig(name) {
37
+ return {
38
+ name: `etc/systemd/resolved.conf.d/${name}.conf`,
39
+ content: [
40
+ "Resolve",
41
+ {
42
+ DNS: serviceAddresses(this, {
43
+ type: "dns",
44
+ priority: "<10"
45
+ }).join(" "),
46
+ FallbackDNS: serviceAddresses(this, {
47
+ type: "dns",
48
+ priority: ">=10"
49
+ }).join(" "),
50
+ Domains: [...this.localDomains].join(" "),
51
+ DNSSEC: "no",
52
+ MulticastDNS: this.network.multicastDNS ? "yes" : "no",
53
+ LLMNR: "no"
54
+ }
55
+ ]
56
+ };
57
+ }
58
+ }
@@ -1,6 +1,5 @@
1
- import { Service, ServiceTypeDefinition } from "pmcf";
1
+ import { ExtraSourceService, ServiceTypeDefinition } from "pmcf";
2
2
  import { serviceAddresses } from "../service.mjs";
3
-
4
3
  import { addType } from "../types.mjs";
5
4
 
6
5
  const SystemdTimesyncdServiceTypeDefinition = {
@@ -12,7 +11,7 @@ const SystemdTimesyncdServiceTypeDefinition = {
12
11
  properties: {}
13
12
  };
14
13
 
15
- export class SystemdTimesyncdService extends Service {
14
+ export class SystemdTimesyncdService extends ExtraSourceService {
16
15
  static {
17
16
  addType(this);
18
17
  }
@@ -292,5 +292,5 @@ export class Location extends Owner {
292
292
  };
293
293
  }, void, unknown>;
294
294
  }
295
- import { Owner } from "./owner.mjs";
295
+ import { Owner } from "pmcf";
296
296
  import { FileContentProvider } from "npm-pkgbuild";
@@ -15,10 +15,12 @@ export * from "./network-interfaces/wlan.mjs";
15
15
  export * from "./network-interfaces/wireguard.mjs";
16
16
  export * from "./host.mjs";
17
17
  export * from "./service.mjs";
18
+ export * from "./extra-source-service.mjs";
18
19
  export * from "./endpoint.mjs";
19
20
  export * from "./services/dns.mjs";
20
21
  export * from "./services/ntp.mjs";
21
22
  export * from "./services/dhcp.mjs";
22
23
  export * from "./services/systemd-journal.mjs";
23
24
  export * from "./services/systemd-timesyncd.mjs";
25
+ export * from "./services/systemd-resolved.mjs";
24
26
  export * from "./types.mjs";
@@ -377,17 +377,6 @@ export class DNSService extends ExtraSourceService {
377
377
  get exclude(): Set<any>;
378
378
  set excludeInterfaceKinds(value: Set<any>);
379
379
  get excludeInterfaceKinds(): Set<any>;
380
- systemdConfig(name: any): {
381
- name: string;
382
- content: (string | {
383
- DNS: string;
384
- FallbackDNS: string;
385
- Domains: string;
386
- DNSSEC: string;
387
- MulticastDNS: string;
388
- LLMNR: string;
389
- })[];
390
- };
391
380
  preparePackages(dir: any): AsyncGenerator<{
392
381
  dir: string;
393
382
  sources: FileContentProvider[];
@@ -399,5 +388,5 @@ export class DNSService extends ExtraSourceService {
399
388
  };
400
389
  }, void, unknown>;
401
390
  }
402
- import { ExtraSourceService } from "../extra-source-service.mjs";
391
+ import { ExtraSourceService } from "pmcf";
403
392
  import { FileContentProvider } from "npm-pkgbuild";
@@ -0,0 +1,269 @@
1
+ export class SystemdResolvedService extends ExtraSourceService {
2
+ static get typeDefinition(): {
3
+ name: string;
4
+ specializationOf: {
5
+ name: string;
6
+ owners: string[];
7
+ priority: number;
8
+ extends: {
9
+ name: string;
10
+ owners: any[];
11
+ properties: {
12
+ owner: {
13
+ type: string;
14
+ collection: boolean;
15
+ writeable: boolean;
16
+ };
17
+ type: {
18
+ type: string;
19
+ collection: boolean;
20
+ writeable: boolean;
21
+ };
22
+ name: {
23
+ type: string;
24
+ collection: boolean;
25
+ identifier: boolean;
26
+ writeable: boolean;
27
+ };
28
+ description: {
29
+ type: string;
30
+ collection: boolean;
31
+ writeable: boolean;
32
+ };
33
+ priority: {
34
+ type: string;
35
+ collection: boolean;
36
+ writeable: boolean;
37
+ };
38
+ directory: {
39
+ type: string;
40
+ collection: boolean;
41
+ writeable: boolean;
42
+ };
43
+ packaging: {
44
+ type: string;
45
+ collection: boolean;
46
+ writeable: boolean;
47
+ };
48
+ tags: {
49
+ type: string;
50
+ collection: boolean;
51
+ writeable: boolean;
52
+ };
53
+ };
54
+ };
55
+ specializations: {};
56
+ factoryFor(owner: any, value: any): any;
57
+ properties: {
58
+ ipAddresses: {
59
+ type: string;
60
+ collection: boolean;
61
+ writeable: boolean;
62
+ };
63
+ alias: {
64
+ type: string;
65
+ collection: boolean;
66
+ writeable: boolean;
67
+ };
68
+ weight: {
69
+ type: string;
70
+ collection: boolean;
71
+ writeable: boolean;
72
+ default: number;
73
+ };
74
+ systemd: {
75
+ type: string;
76
+ collection: boolean;
77
+ writeable: boolean;
78
+ };
79
+ port: {
80
+ type: string;
81
+ collection: boolean;
82
+ writeable: boolean;
83
+ };
84
+ protocol: {
85
+ type: string;
86
+ collection: boolean;
87
+ writeable: boolean;
88
+ values: string[];
89
+ };
90
+ type: {
91
+ type: string;
92
+ collection: boolean;
93
+ writeable: boolean;
94
+ };
95
+ tls: {
96
+ type: string;
97
+ collection: boolean;
98
+ writeable: boolean;
99
+ default: boolean;
100
+ };
101
+ hostName: {
102
+ type: string;
103
+ collection: boolean;
104
+ writeable: boolean;
105
+ };
106
+ cidrAddresses: {
107
+ type: string;
108
+ collection: boolean;
109
+ writeable: boolean;
110
+ };
111
+ cidrAddress: {
112
+ type: string;
113
+ collection: boolean;
114
+ writeable: boolean;
115
+ };
116
+ addresses: {
117
+ type: string;
118
+ collection: boolean;
119
+ writeable: boolean;
120
+ };
121
+ address: {
122
+ type: string;
123
+ collection: boolean;
124
+ writeable: boolean;
125
+ };
126
+ };
127
+ };
128
+ owners: string[];
129
+ extends: {
130
+ name: string;
131
+ owners: string[];
132
+ priority: number;
133
+ extends: {
134
+ name: string;
135
+ owners: any[];
136
+ properties: {
137
+ owner: {
138
+ type: string;
139
+ collection: boolean;
140
+ writeable: boolean;
141
+ };
142
+ type: {
143
+ type: string;
144
+ collection: boolean;
145
+ writeable: boolean;
146
+ };
147
+ name: {
148
+ type: string;
149
+ collection: boolean;
150
+ identifier: boolean;
151
+ writeable: boolean;
152
+ };
153
+ description: {
154
+ type: string;
155
+ collection: boolean;
156
+ writeable: boolean;
157
+ };
158
+ priority: {
159
+ type: string;
160
+ collection: boolean;
161
+ writeable: boolean;
162
+ };
163
+ directory: {
164
+ type: string;
165
+ collection: boolean;
166
+ writeable: boolean;
167
+ };
168
+ packaging: {
169
+ type: string;
170
+ collection: boolean;
171
+ writeable: boolean;
172
+ };
173
+ tags: {
174
+ type: string;
175
+ collection: boolean;
176
+ writeable: boolean;
177
+ };
178
+ };
179
+ };
180
+ specializations: {};
181
+ factoryFor(owner: any, value: any): any;
182
+ properties: {
183
+ ipAddresses: {
184
+ type: string;
185
+ collection: boolean;
186
+ writeable: boolean;
187
+ };
188
+ alias: {
189
+ type: string;
190
+ collection: boolean;
191
+ writeable: boolean;
192
+ };
193
+ weight: {
194
+ type: string;
195
+ collection: boolean;
196
+ writeable: boolean;
197
+ default: number;
198
+ };
199
+ systemd: {
200
+ type: string;
201
+ collection: boolean;
202
+ writeable: boolean;
203
+ };
204
+ port: {
205
+ type: string;
206
+ collection: boolean;
207
+ writeable: boolean;
208
+ };
209
+ protocol: {
210
+ type: string;
211
+ collection: boolean;
212
+ writeable: boolean;
213
+ values: string[];
214
+ };
215
+ type: {
216
+ type: string;
217
+ collection: boolean;
218
+ writeable: boolean;
219
+ };
220
+ tls: {
221
+ type: string;
222
+ collection: boolean;
223
+ writeable: boolean;
224
+ default: boolean;
225
+ };
226
+ hostName: {
227
+ type: string;
228
+ collection: boolean;
229
+ writeable: boolean;
230
+ };
231
+ cidrAddresses: {
232
+ type: string;
233
+ collection: boolean;
234
+ writeable: boolean;
235
+ };
236
+ cidrAddress: {
237
+ type: string;
238
+ collection: boolean;
239
+ writeable: boolean;
240
+ };
241
+ addresses: {
242
+ type: string;
243
+ collection: boolean;
244
+ writeable: boolean;
245
+ };
246
+ address: {
247
+ type: string;
248
+ collection: boolean;
249
+ writeable: boolean;
250
+ };
251
+ };
252
+ };
253
+ priority: number;
254
+ properties: {};
255
+ };
256
+ get systemdServices(): string;
257
+ systemdConfig(name: any): {
258
+ name: string;
259
+ content: (string | {
260
+ DNS: string;
261
+ FallbackDNS: string;
262
+ Domains: string;
263
+ DNSSEC: string;
264
+ MulticastDNS: string;
265
+ LLMNR: string;
266
+ })[];
267
+ };
268
+ }
269
+ import { ExtraSourceService } from "pmcf";
@@ -1,4 +1,4 @@
1
- export class SystemdTimesyncdService extends Service {
1
+ export class SystemdTimesyncdService extends ExtraSourceService {
2
2
  static get typeDefinition(): {
3
3
  name: string;
4
4
  specializationOf: {
@@ -253,7 +253,6 @@ export class SystemdTimesyncdService extends Service {
253
253
  priority: number;
254
254
  properties: {};
255
255
  };
256
- get type(): string;
257
256
  get systemdServices(): string;
258
257
  systemdConfig(name: any): {
259
258
  name: string;
@@ -262,4 +261,4 @@ export class SystemdTimesyncdService extends Service {
262
261
  })[];
263
262
  };
264
263
  }
265
- import { Service } from "pmcf";
264
+ import { ExtraSourceService } from "pmcf";