pmcf 4.0.8 → 4.1.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 +33 -21
- package/package.json +1 -1
- package/src/base.mjs +18 -11
- package/src/host.mjs +5 -4
- package/src/service.mjs +1 -1
- package/src/services/systemd-journal-remote.mjs +2 -2
- package/src/services/systemd-journal-upload.mjs +2 -2
- package/src/services/systemd-journald.mjs +2 -2
- package/src/services/systemd-resolved.mjs +53 -29
- package/src/services/systemd-timesyncd.mjs +4 -4
- package/src/utils.mjs +20 -10
- package/types/base.d.mts +8 -2
- package/types/services/systemd-journald.d.mts +1 -1
- package/types/services/systemd-resolved.d.mts +2 -18
- package/types/services/systemd-timesyncd.d.mts +1 -1
- package/types/utils.d.mts +1 -0
package/README.md
CHANGED
|
@@ -42,59 +42,61 @@ generates config packages for:
|
|
|
42
42
|
|
|
43
43
|
* [Base](#base)
|
|
44
44
|
* [Parameters](#parameters)
|
|
45
|
-
* [
|
|
45
|
+
* [propertyIterator](#propertyiterator)
|
|
46
46
|
* [Parameters](#parameters-1)
|
|
47
|
+
* [getProperties](#getproperties)
|
|
48
|
+
* [Parameters](#parameters-2)
|
|
47
49
|
* [priority](#priority)
|
|
48
50
|
* [expression](#expression)
|
|
49
|
-
* [Parameters](#parameters-2)
|
|
50
|
-
* [findService](#findservice)
|
|
51
51
|
* [Parameters](#parameters-3)
|
|
52
|
-
* [
|
|
52
|
+
* [findService](#findservice)
|
|
53
53
|
* [Parameters](#parameters-4)
|
|
54
|
+
* [expand](#expand)
|
|
55
|
+
* [Parameters](#parameters-5)
|
|
54
56
|
* [PortEndpoint](#portendpoint)
|
|
55
|
-
* [Parameters](#parameters-
|
|
57
|
+
* [Parameters](#parameters-6)
|
|
56
58
|
* [port](#port)
|
|
57
59
|
* [socketAddress](#socketaddress)
|
|
58
60
|
* [HTTPEndpoint](#httpendpoint)
|
|
59
|
-
* [Parameters](#parameters-
|
|
61
|
+
* [Parameters](#parameters-7)
|
|
60
62
|
* [port](#port-1)
|
|
61
63
|
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
62
64
|
* [networkAddresses](#networkaddresses)
|
|
63
|
-
* [Parameters](#parameters-
|
|
65
|
+
* [Parameters](#parameters-8)
|
|
64
66
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
65
67
|
* [Properties](#properties)
|
|
66
68
|
* [systemdConfigs](#systemdconfigs)
|
|
67
|
-
* [Parameters](#parameters-
|
|
69
|
+
* [Parameters](#parameters-9)
|
|
68
70
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
69
71
|
* [Properties](#properties-1)
|
|
70
72
|
* [systemdConfigs](#systemdconfigs-1)
|
|
71
|
-
* [Parameters](#parameters-
|
|
73
|
+
* [Parameters](#parameters-10)
|
|
72
74
|
* [NetworkAddress](#networkaddress)
|
|
73
|
-
* [Parameters](#parameters-
|
|
75
|
+
* [Parameters](#parameters-11)
|
|
74
76
|
* [subnet](#subnet)
|
|
75
77
|
* [networkInterface](#networkinterface)
|
|
76
78
|
* [address](#address)
|
|
77
79
|
* [addresses](#addresses)
|
|
78
|
-
* [Parameters](#parameters-11)
|
|
79
|
-
* [cidrAddresses](#cidraddresses)
|
|
80
80
|
* [Parameters](#parameters-12)
|
|
81
|
+
* [cidrAddresses](#cidraddresses)
|
|
82
|
+
* [Parameters](#parameters-13)
|
|
81
83
|
* [isTemplate](#istemplate)
|
|
82
84
|
* [services](#services)
|
|
83
|
-
* [Parameters](#parameters-13)
|
|
84
|
-
* [named](#named)
|
|
85
85
|
* [Parameters](#parameters-14)
|
|
86
|
-
* [
|
|
86
|
+
* [named](#named)
|
|
87
87
|
* [Parameters](#parameters-15)
|
|
88
|
-
* [
|
|
88
|
+
* [serviceEndpoints](#serviceendpoints)
|
|
89
89
|
* [Parameters](#parameters-16)
|
|
90
|
-
* [
|
|
90
|
+
* [domainName](#domainname)
|
|
91
91
|
* [Parameters](#parameters-17)
|
|
92
|
-
* [
|
|
92
|
+
* [domainFromDominName](#domainfromdominname)
|
|
93
93
|
* [Parameters](#parameters-18)
|
|
94
|
-
* [
|
|
94
|
+
* [sectionLines](#sectionlines)
|
|
95
95
|
* [Parameters](#parameters-19)
|
|
96
|
-
* [
|
|
96
|
+
* [asArray](#asarray)
|
|
97
97
|
* [Parameters](#parameters-20)
|
|
98
|
+
* [asIterator](#asiterator)
|
|
99
|
+
* [Parameters](#parameters-21)
|
|
98
100
|
|
|
99
101
|
## Base
|
|
100
102
|
|
|
@@ -103,13 +105,23 @@ generates config packages for:
|
|
|
103
105
|
* `owner` **[Base](#base)** 
|
|
104
106
|
* `data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
105
107
|
|
|
108
|
+
### propertyIterator
|
|
109
|
+
|
|
110
|
+
Retrive attribute values from an object.
|
|
111
|
+
|
|
112
|
+
#### Parameters
|
|
113
|
+
|
|
114
|
+
* `filter` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
115
|
+
|
|
116
|
+
Returns **Iterable<\[[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), any]>** values
|
|
117
|
+
|
|
106
118
|
### getProperties
|
|
107
119
|
|
|
108
120
|
Retrive attribute values from an object.
|
|
109
121
|
|
|
110
122
|
#### Parameters
|
|
111
123
|
|
|
112
|
-
* `filter`
|
|
124
|
+
* `filter` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** (optional, default `filterPublic`)
|
|
113
125
|
|
|
114
126
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
|
|
115
127
|
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { allOutputs } from "npm-pkgbuild";
|
|
3
3
|
import {
|
|
4
|
+
getAttribute,
|
|
4
5
|
typeFactory,
|
|
5
6
|
addType,
|
|
6
7
|
parse,
|
|
@@ -346,7 +347,7 @@ export class Base {
|
|
|
346
347
|
if (!seen.has(this)) {
|
|
347
348
|
seen.add(this);
|
|
348
349
|
|
|
349
|
-
const value =
|
|
350
|
+
const value = getAttribute(e, propertyName);
|
|
350
351
|
if (value !== undefined) {
|
|
351
352
|
yield value;
|
|
352
353
|
}
|
|
@@ -362,7 +363,8 @@ export class Base {
|
|
|
362
363
|
seen.add(this);
|
|
363
364
|
for (const e of this.extends) {
|
|
364
365
|
const value =
|
|
365
|
-
e
|
|
366
|
+
getAttribute(e, propertyName) ??
|
|
367
|
+
e._extendedProperty(propertyName, seen);
|
|
366
368
|
if (value !== undefined) {
|
|
367
369
|
return value;
|
|
368
370
|
}
|
|
@@ -371,7 +373,7 @@ export class Base {
|
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
extendedProperty(propertyName) {
|
|
374
|
-
const value = this
|
|
376
|
+
const value = getAttribute(this, propertyName);
|
|
375
377
|
if (value !== undefined) {
|
|
376
378
|
return value;
|
|
377
379
|
}
|
|
@@ -381,11 +383,10 @@ export class Base {
|
|
|
381
383
|
|
|
382
384
|
/**
|
|
383
385
|
* Retrive attribute values from an object.
|
|
384
|
-
* @
|
|
386
|
+
* @param {Function} [filter]
|
|
387
|
+
* @return {Iterable<[string,any]>} values
|
|
385
388
|
*/
|
|
386
|
-
|
|
387
|
-
const result = {};
|
|
388
|
-
|
|
389
|
+
*propertyIterator(filter) {
|
|
389
390
|
for (
|
|
390
391
|
let typeDefinition = this.constructor.typeDefinition;
|
|
391
392
|
typeDefinition;
|
|
@@ -396,16 +397,22 @@ export class Base {
|
|
|
396
397
|
filter
|
|
397
398
|
)) {
|
|
398
399
|
const name = path.join(".");
|
|
399
|
-
|
|
400
|
-
let value = this.extendedProperty(name);
|
|
400
|
+
const value = this.extendedProperty(name);
|
|
401
401
|
|
|
402
402
|
if (value !== undefined) {
|
|
403
|
-
|
|
403
|
+
yield [def.externalName ?? name, toExternal(value, def), path, def];
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
+
}
|
|
407
408
|
|
|
408
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Retrive attribute values from an object.
|
|
411
|
+
* @param {Function} [filter]
|
|
412
|
+
* @return {Object} values
|
|
413
|
+
*/
|
|
414
|
+
getProperties(filter = filterPublic) {
|
|
415
|
+
return Object.fromEntries(this.propertyIterator(filter));
|
|
409
416
|
}
|
|
410
417
|
|
|
411
418
|
get root() {
|
package/src/host.mjs
CHANGED
|
@@ -425,6 +425,7 @@ export class Host extends ServiceOwner {
|
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
async *preparePackages(dir) {
|
|
428
|
+
const pkgName = `${this.typeName}-${this.owner.name}-${this.name}`;
|
|
428
429
|
let packageData = {
|
|
429
430
|
dir,
|
|
430
431
|
sources: [
|
|
@@ -440,7 +441,7 @@ export class Host extends ServiceOwner {
|
|
|
440
441
|
],
|
|
441
442
|
outputs: this.outputs,
|
|
442
443
|
properties: {
|
|
443
|
-
name:
|
|
444
|
+
name: pkgName,
|
|
444
445
|
description: `${this.typeName} definitions for ${this.fullName}`,
|
|
445
446
|
access: "private",
|
|
446
447
|
dependencies: [
|
|
@@ -448,7 +449,7 @@ export class Host extends ServiceOwner {
|
|
|
448
449
|
...this.depends
|
|
449
450
|
],
|
|
450
451
|
provides: [...this.provides],
|
|
451
|
-
replaces: [
|
|
452
|
+
replaces: [...this.replaces],
|
|
452
453
|
requires: [],
|
|
453
454
|
backup: "root/.ssh/known_hosts",
|
|
454
455
|
hooks: await loadHooks(
|
|
@@ -474,7 +475,7 @@ export class Host extends ServiceOwner {
|
|
|
474
475
|
for (const { serviceName, configFileName, content } of asArray(
|
|
475
476
|
service.expand(service.systemdConfigs(this.name))
|
|
476
477
|
)) {
|
|
477
|
-
await writeLines(dir, configFileName,
|
|
478
|
+
await writeLines(dir, configFileName, content);
|
|
478
479
|
|
|
479
480
|
addHook(
|
|
480
481
|
packageData.properties.hooks,
|
|
@@ -496,7 +497,7 @@ export class Host extends ServiceOwner {
|
|
|
496
497
|
name: `${this.typeName}-extra-${this.owner.name}-${this.name}`,
|
|
497
498
|
description: `additional files for ${this.fullName}`,
|
|
498
499
|
access: "private",
|
|
499
|
-
dependencies: [
|
|
500
|
+
dependencies: [pkgName]
|
|
500
501
|
}
|
|
501
502
|
};
|
|
502
503
|
|
package/src/service.mjs
CHANGED
|
@@ -222,7 +222,7 @@ export class Service extends Base {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
get port() {
|
|
225
|
-
return this._port ?? serviceTypeEndpoints(ServiceTypes[this.type])[0]
|
|
225
|
+
return this._port ?? serviceTypeEndpoints(ServiceTypes[this.type])[0]?.port;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
set weight(value) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
boolean_attribute_writable
|
|
5
5
|
} from "pacc";
|
|
6
6
|
import { Service, ServiceTypeDefinition, addServiceType } from "pmcf";
|
|
7
|
-
import { filterConfigurable } from "../utils.mjs";
|
|
7
|
+
import { filterConfigurable, sectionLines } from "../utils.mjs";
|
|
8
8
|
|
|
9
9
|
const SystemdJournalRemoteServiceTypeDefinition = {
|
|
10
10
|
name: "systemd-journal-remote",
|
|
@@ -105,7 +105,7 @@ export class SystemdJournalRemoteService extends Service {
|
|
|
105
105
|
return {
|
|
106
106
|
serviceName: this.systemdService,
|
|
107
107
|
configFileName: `etc/systemd/journal-remote.conf.d/${name}.conf`,
|
|
108
|
-
content:
|
|
108
|
+
content: sectionLines("Remote", this.getProperties(filterConfigurable))
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
addType
|
|
5
5
|
} from "pacc";
|
|
6
6
|
import { Service, ServiceTypeDefinition, addServiceType } from "pmcf";
|
|
7
|
-
import { filterConfigurable } from "../utils.mjs";
|
|
7
|
+
import { filterConfigurable, sectionLines } from "../utils.mjs";
|
|
8
8
|
|
|
9
9
|
const SystemdJournalUploadServiceTypeDefinition = {
|
|
10
10
|
name: "systemd-journal-upload",
|
|
@@ -73,7 +73,7 @@ export class SystemdJournalUploadService extends Service {
|
|
|
73
73
|
return {
|
|
74
74
|
serviceName: this.systemdService,
|
|
75
75
|
configFileName: `etc/systemd/journal-upload.conf.d/${name}.conf`,
|
|
76
|
-
content:
|
|
76
|
+
content: sectionLines("Upload", this.getProperties(filterConfigurable))
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
duration_attribute_writable
|
|
5
5
|
} from "pacc";
|
|
6
6
|
import { Service, ServiceTypeDefinition, addServiceType } from "pmcf";
|
|
7
|
-
import { filterConfigurable } from "../utils.mjs";
|
|
7
|
+
import { filterConfigurable, sectionLines } from "../utils.mjs";
|
|
8
8
|
|
|
9
9
|
const SystemdJournalServiceTypeDefinition = {
|
|
10
10
|
name: "systemd-journald",
|
|
@@ -129,7 +129,7 @@ export class SystemdJournaldService extends Service {
|
|
|
129
129
|
return {
|
|
130
130
|
serviceName: this.systemdService,
|
|
131
131
|
configFileName: `etc/systemd/journal.conf.d/${name}.conf`,
|
|
132
|
-
content:
|
|
132
|
+
content: sectionLines("Journal", this.getProperties(filterConfigurable))
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addType,
|
|
3
|
+
object_attribute,
|
|
3
4
|
duration_attribute_writable,
|
|
4
5
|
string_attribute_writable,
|
|
5
6
|
boolean_attribute_writable,
|
|
@@ -12,7 +13,12 @@ import {
|
|
|
12
13
|
serviceEndpoints,
|
|
13
14
|
addServiceType
|
|
14
15
|
} from "pmcf";
|
|
15
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
filterConfigurable,
|
|
18
|
+
yesno,
|
|
19
|
+
sectionLines,
|
|
20
|
+
setionLinesFromPropertyIterator
|
|
21
|
+
} from "../utils.mjs";
|
|
16
22
|
|
|
17
23
|
const SystemdResolvedServiceTypeDefinition = {
|
|
18
24
|
name: "systemd-resolved",
|
|
@@ -21,24 +27,42 @@ const SystemdResolvedServiceTypeDefinition = {
|
|
|
21
27
|
owners: ServiceTypeDefinition.owners,
|
|
22
28
|
key: "name",
|
|
23
29
|
attributes: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
/* Resolve: {
|
|
31
|
+
...object_attribute,
|
|
32
|
+
attributes: {*/
|
|
33
|
+
DNS: { ...string_attribute_writable, configurable: true },
|
|
34
|
+
FallbackDNS: { ...string_attribute_writable, configurable: true },
|
|
35
|
+
Domains: { ...string_attribute_writable, configurable: true },
|
|
36
|
+
MulticastDNS: { ...yesno_attribute_writable, configurable: true },
|
|
37
|
+
Cache: { ...boolean_attribute_writable, configurable: true },
|
|
38
|
+
CacheFromLocalhost: {
|
|
39
|
+
...boolean_attribute_writable,
|
|
40
|
+
configurable: true
|
|
41
|
+
},
|
|
42
|
+
DNSStubListener: { ...boolean_attribute_writable, configurable: true },
|
|
43
|
+
DNSStubListenerExtra: {
|
|
44
|
+
...string_attribute_writable,
|
|
45
|
+
configurable: true
|
|
46
|
+
},
|
|
47
|
+
ReadEtcHosts: { ...boolean_attribute_writable, configurable: true },
|
|
48
|
+
ResolveUnicastSingleLabel: {
|
|
49
|
+
...boolean_attribute_writable,
|
|
50
|
+
configurable: true
|
|
51
|
+
},
|
|
52
|
+
StaleRetentionSec: {
|
|
53
|
+
...duration_attribute_writable,
|
|
54
|
+
configurable: true
|
|
55
|
+
},
|
|
56
|
+
RefuseRecordTypes: { ...string_attribute_writable, configurable: true },
|
|
57
|
+
DNSSEC: {
|
|
58
|
+
...yesno_attribute_writable,
|
|
59
|
+
default: false,
|
|
60
|
+
configurable: true
|
|
61
|
+
},
|
|
62
|
+
DNSOverTLS: { ...yesno_attribute_writable, configurable: true },
|
|
63
|
+
LLMNR: { ...yesno_attribute_writable, configurable: true }
|
|
64
|
+
/* }
|
|
65
|
+
}*/
|
|
42
66
|
},
|
|
43
67
|
service: {
|
|
44
68
|
systemdService: "systemd-resolved.service"
|
|
@@ -59,6 +83,8 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
59
83
|
return SystemdResolvedServiceTypeDefinition.name;
|
|
60
84
|
}
|
|
61
85
|
|
|
86
|
+
Resolve = {};
|
|
87
|
+
|
|
62
88
|
systemdConfigs(name) {
|
|
63
89
|
const options = (lower, upper, limit) => {
|
|
64
90
|
return {
|
|
@@ -76,16 +102,14 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
76
102
|
return {
|
|
77
103
|
serviceName: this.systemdService,
|
|
78
104
|
configFileName: `etc/systemd/resolved.conf.d/${name}.conf`,
|
|
79
|
-
content: [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
]
|
|
105
|
+
//content: [...setionLinesFromPropertyIterator(this.propertyIterator( filterConfigurable)), "A=1"]
|
|
106
|
+
content: sectionLines("Resolve", {
|
|
107
|
+
DNS: serviceEndpoints(this, options(300, 399, 4)),
|
|
108
|
+
FallbackDNS: serviceEndpoints(this, options(100, 199, 4)),
|
|
109
|
+
Domains: [...this.localDomains].join(" "),
|
|
110
|
+
MulticastDNS: yesno(this.network.multicastDNS),
|
|
111
|
+
...this.getProperties(filterConfigurable)
|
|
112
|
+
})
|
|
89
113
|
};
|
|
90
114
|
}
|
|
91
115
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
serviceEndpoints,
|
|
11
11
|
addServiceType
|
|
12
12
|
} from "pmcf";
|
|
13
|
-
import { filterConfigurable } from "../utils.mjs";
|
|
13
|
+
import { filterConfigurable, sectionLines } from "../utils.mjs";
|
|
14
14
|
|
|
15
15
|
const SystemdTimesyncdServiceTypeDefinition = {
|
|
16
16
|
name: "systemd-timesyncd",
|
|
@@ -61,14 +61,14 @@ export class SystemdTimesyncdService extends ExtraSourceService {
|
|
|
61
61
|
return {
|
|
62
62
|
serviceName: this.systemdService,
|
|
63
63
|
configFileName: `etc/systemd/timesyncd.conf.d/${name}.conf`,
|
|
64
|
-
content:
|
|
64
|
+
content: sectionLines(
|
|
65
65
|
"Time",
|
|
66
66
|
{
|
|
67
67
|
NTP: serviceEndpoints(this, options(300, 399)),
|
|
68
68
|
FallbackNTP: serviceEndpoints(this, options(100, 199)),
|
|
69
69
|
...this.getProperties(filterConfigurable)
|
|
70
|
-
}
|
|
71
|
-
|
|
70
|
+
})
|
|
71
|
+
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/utils.mjs
CHANGED
|
@@ -7,8 +7,8 @@ export function yesno(flag) {
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Appends default domain if name does not already have a domain.
|
|
10
|
-
* @param {string} name
|
|
11
|
-
* @param {string} [defaultDomain]
|
|
10
|
+
* @param {string} name
|
|
11
|
+
* @param {string} [defaultDomain]
|
|
12
12
|
* @returns {string|undefined}
|
|
13
13
|
*/
|
|
14
14
|
export function domainName(name, defaultDomain) {
|
|
@@ -20,7 +20,7 @@ export function domainName(name, defaultDomain) {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Extracts domain name from a name.
|
|
23
|
-
* @param {string} domainName
|
|
23
|
+
* @param {string} domainName
|
|
24
24
|
* @param {string} [defaultDomain]
|
|
25
25
|
* @returns {string|undefined}
|
|
26
26
|
*/
|
|
@@ -62,9 +62,9 @@ export async function writeLines(dir, name, lines) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @param {string} sectionName
|
|
67
|
-
* @param {Object} values
|
|
65
|
+
*
|
|
66
|
+
* @param {string} sectionName
|
|
67
|
+
* @param {Object} values
|
|
68
68
|
* @returns {Array<string>}
|
|
69
69
|
*/
|
|
70
70
|
export function sectionLines(sectionName, values) {
|
|
@@ -77,12 +77,22 @@ export function sectionLines(sectionName, values) {
|
|
|
77
77
|
return lines;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export function* setionLinesFromPropertyIterator(properties) {
|
|
81
|
+
for (const [name, value, path, attribute] of properties) {
|
|
82
|
+
if (attribute.attributes) {
|
|
83
|
+
yield `[${name}]`;
|
|
84
|
+
} else {
|
|
85
|
+
yield `${name}=${value}`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
80
90
|
export function bridgeToJSON(bridge) {
|
|
81
91
|
return [...bridge].map(n => n.fullName || `(${n})`).sort();
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
/**
|
|
85
|
-
* @param {any} value
|
|
95
|
+
* @param {any} value
|
|
86
96
|
* @returns {Array<any>}
|
|
87
97
|
*/
|
|
88
98
|
export function asArray(value) {
|
|
@@ -90,7 +100,7 @@ export function asArray(value) {
|
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
/**
|
|
93
|
-
* @param {any} value
|
|
103
|
+
* @param {any} value
|
|
94
104
|
* @returns {Iterable<any>}
|
|
95
105
|
*/
|
|
96
106
|
export function asIterator(value) {
|
|
@@ -108,5 +118,5 @@ export function asIterator(value) {
|
|
|
108
118
|
return asArray(value);
|
|
109
119
|
}
|
|
110
120
|
|
|
111
|
-
|
|
112
|
-
|
|
121
|
+
export const filterConfigurable = (name, attribute) =>
|
|
122
|
+
!attribute.private & attribute.configurable;
|
package/types/base.d.mts
CHANGED
|
@@ -71,9 +71,16 @@ export class Base {
|
|
|
71
71
|
extendedProperty(propertyName: any): any;
|
|
72
72
|
/**
|
|
73
73
|
* Retrive attribute values from an object.
|
|
74
|
+
* @param {Function} [filter]
|
|
75
|
+
* @return {Iterable<[string,any]>} values
|
|
76
|
+
*/
|
|
77
|
+
propertyIterator(filter?: Function): Iterable<[string, any]>;
|
|
78
|
+
/**
|
|
79
|
+
* Retrive attribute values from an object.
|
|
80
|
+
* @param {Function} [filter]
|
|
74
81
|
* @return {Object} values
|
|
75
82
|
*/
|
|
76
|
-
getProperties(filter?:
|
|
83
|
+
getProperties(filter?: Function): any;
|
|
77
84
|
get root(): any;
|
|
78
85
|
get location(): any;
|
|
79
86
|
get host(): any;
|
|
@@ -136,4 +143,3 @@ export class Base {
|
|
|
136
143
|
toString(): string;
|
|
137
144
|
toJSON(): any;
|
|
138
145
|
}
|
|
139
|
-
import { filterPublic } from "pacc";
|
|
@@ -1303,25 +1303,8 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
1303
1303
|
};
|
|
1304
1304
|
MulticastDNS: {
|
|
1305
1305
|
configurable: boolean;
|
|
1306
|
-
type: object;
|
|
1307
|
-
isKey: boolean;
|
|
1308
1306
|
writable: boolean;
|
|
1309
|
-
mandatory: boolean;
|
|
1310
1307
|
collection: boolean;
|
|
1311
|
-
private?: boolean;
|
|
1312
|
-
credential?: boolean;
|
|
1313
|
-
persistent?: boolean;
|
|
1314
|
-
depends?: string;
|
|
1315
|
-
description?: string;
|
|
1316
|
-
default?: any;
|
|
1317
|
-
set?: Function;
|
|
1318
|
-
get?: Function;
|
|
1319
|
-
toInternal?: Function;
|
|
1320
|
-
toExternal?: Function;
|
|
1321
|
-
values?: Set<any>;
|
|
1322
|
-
externalName?: string;
|
|
1323
|
-
env?: string[] | string;
|
|
1324
|
-
additionalValues?: object;
|
|
1325
1308
|
};
|
|
1326
1309
|
Cache: {
|
|
1327
1310
|
configurable: boolean;
|
|
@@ -1520,10 +1503,11 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
1520
1503
|
systemdService: string;
|
|
1521
1504
|
};
|
|
1522
1505
|
};
|
|
1506
|
+
Resolve: {};
|
|
1523
1507
|
systemdConfigs(name: any): {
|
|
1524
1508
|
serviceName: any;
|
|
1525
1509
|
configFileName: string;
|
|
1526
|
-
content:
|
|
1510
|
+
content: string[];
|
|
1527
1511
|
};
|
|
1528
1512
|
}
|
|
1529
1513
|
import { ExtraSourceService } from "pmcf";
|
|
@@ -1396,7 +1396,7 @@ export class SystemdTimesyncdService extends ExtraSourceService {
|
|
|
1396
1396
|
systemdConfigs(name: any): {
|
|
1397
1397
|
serviceName: any;
|
|
1398
1398
|
configFileName: string;
|
|
1399
|
-
content:
|
|
1399
|
+
content: string[];
|
|
1400
1400
|
};
|
|
1401
1401
|
}
|
|
1402
1402
|
import { ExtraSourceService } from "pmcf";
|
package/types/utils.d.mts
CHANGED
|
@@ -21,6 +21,7 @@ export function writeLines(dir: any, name: any, lines: any): Promise<void>;
|
|
|
21
21
|
* @returns {Array<string>}
|
|
22
22
|
*/
|
|
23
23
|
export function sectionLines(sectionName: string, values: any): Array<string>;
|
|
24
|
+
export function setionLinesFromPropertyIterator(properties: any): Generator<string, void, unknown>;
|
|
24
25
|
export function bridgeToJSON(bridge: any): any[];
|
|
25
26
|
/**
|
|
26
27
|
* @param {any} value
|