pmcf 6.25.0 → 6.26.1
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/README.md +21 -21
- package/package.json +1 -1
- package/src/base.mjs +2 -2
- package/src/core-service.mjs +2 -2
- package/src/initialization-context.mjs +1 -1
- package/src/service-types.mjs +7 -0
- package/src/service.mjs +24 -0
- package/src/services/bind.mjs +5 -17
- package/src/services/postfix.mjs +3 -1
- package/src/type.mjs +5 -3
package/README.md
CHANGED
|
@@ -79,30 +79,30 @@ generates config packages for:
|
|
|
79
79
|
* [domainNames](#domainnames)
|
|
80
80
|
* [InitializationContext](#initializationcontext)
|
|
81
81
|
* [Parameters](#parameters-14)
|
|
82
|
-
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
83
|
-
* [networkAddresses](#networkaddresses)
|
|
84
|
-
* [Parameters](#parameters-15)
|
|
85
82
|
* [zones](#zones)
|
|
86
83
|
* [type](#type)
|
|
87
84
|
* [addressesStatement](#addressesstatement)
|
|
88
|
-
* [Parameters](#parameters-
|
|
85
|
+
* [Parameters](#parameters-15)
|
|
89
86
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
90
87
|
* [Properties](#properties)
|
|
91
88
|
* [systemdConfigs](#systemdconfigs)
|
|
92
|
-
* [Parameters](#parameters-
|
|
89
|
+
* [Parameters](#parameters-16)
|
|
93
90
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
94
91
|
* [Properties](#properties-1)
|
|
95
92
|
* [systemdConfigs](#systemdconfigs-1)
|
|
96
|
-
* [Parameters](#parameters-
|
|
93
|
+
* [Parameters](#parameters-17)
|
|
97
94
|
* [NetworkAddress](#networkaddress)
|
|
98
|
-
* [Parameters](#parameters-
|
|
95
|
+
* [Parameters](#parameters-18)
|
|
99
96
|
* [subnet](#subnet)
|
|
100
97
|
* [networkInterface](#networkinterface)
|
|
101
98
|
* [address](#address)
|
|
102
99
|
* [addresses](#addresses)
|
|
103
|
-
* [Parameters](#parameters-
|
|
100
|
+
* [Parameters](#parameters-19)
|
|
104
101
|
* [cidrAddresses](#cidraddresses)
|
|
105
|
-
* [Parameters](#parameters-
|
|
102
|
+
* [Parameters](#parameters-20)
|
|
103
|
+
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
104
|
+
* [networkAddresses](#networkaddresses)
|
|
105
|
+
* [Parameters](#parameters-21)
|
|
106
106
|
* [families](#families)
|
|
107
107
|
* [secretName](#secretname)
|
|
108
108
|
* [directHosts](#directhosts)
|
|
@@ -301,18 +301,6 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
301
301
|
|
|
302
302
|
* `directory` (optional, default `"/"`)
|
|
303
303
|
|
|
304
|
-
## SkeletonNetworkInterface
|
|
305
|
-
|
|
306
|
-
**Extends ServiceOwner**
|
|
307
|
-
|
|
308
|
-
### networkAddresses
|
|
309
|
-
|
|
310
|
-
#### Parameters
|
|
311
|
-
|
|
312
|
-
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
313
|
-
|
|
314
|
-
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
315
|
-
|
|
316
304
|
## zones
|
|
317
305
|
|
|
318
306
|
Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
|
|
@@ -409,6 +397,18 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
|
|
|
409
397
|
|
|
410
398
|
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
411
399
|
|
|
400
|
+
## SkeletonNetworkInterface
|
|
401
|
+
|
|
402
|
+
**Extends ServiceOwner**
|
|
403
|
+
|
|
404
|
+
### networkAddresses
|
|
405
|
+
|
|
406
|
+
#### Parameters
|
|
407
|
+
|
|
408
|
+
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
409
|
+
|
|
410
|
+
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
411
|
+
|
|
412
412
|
## families
|
|
413
413
|
|
|
414
414
|
Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
filterPublic,
|
|
18
18
|
extendingAttributeIterator,
|
|
19
19
|
name_attribute_writable,
|
|
20
|
-
|
|
20
|
+
type_attribute_writable,
|
|
21
21
|
string_attribute_writable,
|
|
22
22
|
string_set_attribute_writable,
|
|
23
23
|
description_attribute_writable,
|
|
@@ -41,7 +41,7 @@ export class Base {
|
|
|
41
41
|
name: name_attribute_writable,
|
|
42
42
|
aliases: aliases_attribute,
|
|
43
43
|
description: description_attribute_writable,
|
|
44
|
-
type:
|
|
44
|
+
type: type_attribute_writable,
|
|
45
45
|
directory: { ...string_attribute_writable, name: "directory" },
|
|
46
46
|
packaging: { ...string_set_attribute_writable, name: "packaging" },
|
|
47
47
|
disabled: { ...boolean_attribute_writable, name: "disabled" },
|
package/src/core-service.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
|
|
|
2
2
|
import {
|
|
3
3
|
string_attribute_writable,
|
|
4
4
|
number_attribute_writable,
|
|
5
|
-
|
|
5
|
+
string_set_attribute_writable,
|
|
6
6
|
boolean_attribute_false,
|
|
7
7
|
port_attribute_writable,
|
|
8
8
|
priority_attribute
|
|
@@ -43,7 +43,7 @@ export const endpointAttributes = {
|
|
|
43
43
|
name: "protocol",
|
|
44
44
|
values: new Set(["tcp", "udp", "quic"])
|
|
45
45
|
},
|
|
46
|
-
types: { ...
|
|
46
|
+
types: { ...string_set_attribute_writable, name: "types" },
|
|
47
47
|
tls: { ...boolean_attribute_false, name: "tls" }
|
|
48
48
|
};
|
|
49
49
|
|
|
@@ -48,7 +48,7 @@ export class InitializationContext {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
instantiateAndAssign(object, attribute, value) {
|
|
51
|
-
if (attribute.type.primitive || attribute.
|
|
51
|
+
if (attribute.type.primitive || attribute.deferredExpression) {
|
|
52
52
|
return assign(attribute, object, value);
|
|
53
53
|
}
|
|
54
54
|
if (value !== undefined) {
|
package/src/service-types.mjs
CHANGED
|
@@ -186,6 +186,13 @@ export const ServiceTypes = {
|
|
|
186
186
|
],
|
|
187
187
|
dnsRecord: { type: "MX" }
|
|
188
188
|
},
|
|
189
|
+
smtps: {
|
|
190
|
+
endpoints: [
|
|
191
|
+
{ family: FAMILY_IPV4, protocol: "tcp", port: 465, tls: true },
|
|
192
|
+
{ family: FAMILY_IPV6, protocol: "tcp", port: 465, tls: true }
|
|
193
|
+
],
|
|
194
|
+
dnsRecord: { type: "MX" }
|
|
195
|
+
},
|
|
189
196
|
submission: {
|
|
190
197
|
endpoints: [
|
|
191
198
|
{ family: FAMILY_IPV4, protocol: "tcp", port: 587, tls: false },
|
package/src/service.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { setBaseService, CoreService, addType } from "pmcf";
|
|
2
|
+
import { serviceTypes, ServiceTypes } from "./service-types.mjs";
|
|
2
3
|
|
|
3
4
|
export class Service extends CoreService {
|
|
4
5
|
static name = "service";
|
|
@@ -8,6 +9,29 @@ export class Service extends CoreService {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
_type;
|
|
12
|
+
_types;
|
|
13
|
+
|
|
14
|
+
set types(value) {
|
|
15
|
+
this._types = value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get types() {
|
|
19
|
+
if (this._types) {
|
|
20
|
+
this._types.add(this.type);
|
|
21
|
+
return this._types;
|
|
22
|
+
}
|
|
23
|
+
if (this._type) {
|
|
24
|
+
return new Set([this._type]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const types = serviceTypes(ServiceTypes[this.type]);
|
|
28
|
+
|
|
29
|
+
if(types.size) {
|
|
30
|
+
return types;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return new Set([this.name]);
|
|
34
|
+
}
|
|
11
35
|
|
|
12
36
|
set type(value) {
|
|
13
37
|
this._type = value;
|
package/src/services/bind.mjs
CHANGED
|
@@ -205,7 +205,7 @@ class bind_group extends Base {
|
|
|
205
205
|
...default_collection_attribute_writable,
|
|
206
206
|
type: NetworkAddress,
|
|
207
207
|
name: "entries",
|
|
208
|
-
|
|
208
|
+
deferredExpression: true
|
|
209
209
|
},
|
|
210
210
|
domains: {
|
|
211
211
|
...string_set_attribute,
|
|
@@ -245,10 +245,6 @@ class bind_group extends Base {
|
|
|
245
245
|
...boolean_attribute_writable_false,
|
|
246
246
|
name: "hasSVRRecords"
|
|
247
247
|
},
|
|
248
|
-
hasLinkLocalAdresses: {
|
|
249
|
-
...boolean_attribute_writable_false,
|
|
250
|
-
name: "hasLinkLocalAdresses"
|
|
251
|
-
},
|
|
252
248
|
hasLocationRecord: {
|
|
253
249
|
...boolean_attribute_writable_true,
|
|
254
250
|
name: "hasLocationRecord"
|
|
@@ -283,23 +279,14 @@ class bind_group extends Base {
|
|
|
283
279
|
notify = true;
|
|
284
280
|
hasCatalog = true;
|
|
285
281
|
hasSVRRecords = true;
|
|
286
|
-
hasLinkLocalAdresses = bind_group.attributes.hasLinkLocalAdresses.default;
|
|
287
282
|
recordTTL = "1W";
|
|
288
283
|
|
|
289
|
-
set entries(value) {
|
|
290
|
-
this._entries = value;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
get entries() {
|
|
294
|
-
return this._entries ? this.expression(this._entries) : [];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
284
|
/**
|
|
298
285
|
* Type of the group.
|
|
299
286
|
* @return {string} view | unknown
|
|
300
287
|
*/
|
|
301
288
|
get type() {
|
|
302
|
-
if (this.sharedWith || this.
|
|
289
|
+
if (this.sharedWith || this.entries) {
|
|
303
290
|
return "view";
|
|
304
291
|
}
|
|
305
292
|
|
|
@@ -334,7 +321,7 @@ class bind_group extends Base {
|
|
|
334
321
|
}
|
|
335
322
|
|
|
336
323
|
get domains() {
|
|
337
|
-
return this.entries
|
|
324
|
+
return this.entries?.reduce(
|
|
338
325
|
(all, address) => all.union(address.domains),
|
|
339
326
|
new Set()
|
|
340
327
|
);
|
|
@@ -367,7 +354,8 @@ class bind_group extends Base {
|
|
|
367
354
|
}
|
|
368
355
|
|
|
369
356
|
get zones() {
|
|
370
|
-
const
|
|
357
|
+
const e = this.entries;
|
|
358
|
+
const entries = e === undefined ? [] : [...e];
|
|
371
359
|
|
|
372
360
|
if (!this._zones && entries.length > 0) {
|
|
373
361
|
this._zoneConfigs = new Map();
|
package/src/services/postfix.mjs
CHANGED
|
@@ -3,7 +3,9 @@ import { CoreService, addType } from "pmcf";
|
|
|
3
3
|
export class postfix extends CoreService {
|
|
4
4
|
static service = {
|
|
5
5
|
systemdService: "postfix.service",
|
|
6
|
-
|
|
6
|
+
systemUserName: "root",
|
|
7
|
+
systemGroupName: "root",
|
|
8
|
+
extends: ["smtp", "smtps", "lmtp", "submission"]
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
static {
|
package/src/type.mjs
CHANGED
|
@@ -33,13 +33,15 @@ export function assign(attribute, object, value) {
|
|
|
33
33
|
value ??= attribute.default;
|
|
34
34
|
|
|
35
35
|
if (value !== undefined) {
|
|
36
|
-
// set
|
|
36
|
+
// set backpointer early so that parent properties can be found during load
|
|
37
37
|
if (attribute.backpointer) {
|
|
38
38
|
assign(attribute.backpointer, value, object);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (attribute.
|
|
42
|
-
object
|
|
41
|
+
if (attribute.deferredExpression) {
|
|
42
|
+
Object.defineProperty(object, attribute.name, {
|
|
43
|
+
get: () => object.expression(value)
|
|
44
|
+
});
|
|
43
45
|
return value;
|
|
44
46
|
}
|
|
45
47
|
|