pmcf 4.30.7 → 5.0.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/bin/pmcf-diagram +1 -1
- package/package.json +7 -7
- package/src/base.mjs +81 -182
- package/src/cluster.mjs +22 -40
- package/src/{network-support.mjs → common-attributes.mjs} +66 -5
- package/src/extra-source-service.mjs +8 -7
- package/src/host.mjs +50 -53
- package/src/initialization-context.mjs +110 -216
- package/src/module.mjs +1 -2
- package/src/network-address.mjs +2 -2
- package/src/network-interfaces/ethernet.mjs +7 -15
- package/src/network-interfaces/loopback.mjs +1 -8
- package/src/network-interfaces/network-interface.mjs +28 -40
- package/src/network-interfaces/skeleton.mjs +14 -9
- package/src/network-interfaces/tun.mjs +0 -5
- package/src/network-interfaces/wireguard.mjs +0 -4
- package/src/network-interfaces/wlan.mjs +7 -18
- package/src/network.mjs +39 -43
- package/src/owner.mjs +120 -236
- package/src/root.mjs +13 -7
- package/src/service-owner.mjs +7 -26
- package/src/service.mjs +32 -19
- package/src/services/alpm.mjs +10 -6
- package/src/services/bind.mjs +73 -79
- package/src/services/chrony.mjs +3 -4
- package/src/services/headscale.mjs +0 -1
- package/src/services/influxdb.mjs +2 -2
- package/src/services/kea.mjs +16 -6
- package/src/services/mosquitto.mjs +4 -1
- package/src/services/openldap.mjs +4 -5
- package/src/services/postfix.mjs +0 -2
- package/src/services/systemd-journal-remote.mjs +12 -2
- package/src/services/systemd-journal-upload.mjs +8 -2
- package/src/services/systemd-journald.mjs +23 -1
- package/src/services/systemd-resolved.mjs +41 -19
- package/src/services/systemd-timesyncd.mjs +32 -10
- package/src/services/tailscale.mjs +0 -1
- package/src/subnet.mjs +38 -34
- package/src/type.mjs +86 -1
- package/src/utils.mjs +2 -2
- package/src/location.mjs +0 -48
|
@@ -4,98 +4,120 @@ import { filterConfigurable, sectionLines } from "../utils.mjs";
|
|
|
4
4
|
|
|
5
5
|
export class SystemdJournaldService extends Service {
|
|
6
6
|
static name = "systemd-journald";
|
|
7
|
-
static specializationOf = Service;
|
|
8
7
|
static attributes = {
|
|
9
8
|
Storage: {
|
|
10
9
|
...string_attribute_writable,
|
|
10
|
+
name: "Storage",
|
|
11
11
|
configurable: true
|
|
12
12
|
},
|
|
13
13
|
Seal: {
|
|
14
14
|
...string_attribute_writable,
|
|
15
|
+
name: "Seal",
|
|
15
16
|
configurable: true
|
|
16
17
|
},
|
|
17
18
|
SplitMode: {
|
|
18
19
|
...string_attribute_writable,
|
|
20
|
+
name: "SplitMode",
|
|
19
21
|
configurable: true
|
|
20
22
|
},
|
|
21
23
|
SyncIntervalSec: {
|
|
22
24
|
...duration_attribute_writable,
|
|
25
|
+
name: "SyncIntervalSec",
|
|
23
26
|
configurable: true
|
|
24
27
|
},
|
|
25
28
|
RateLimitIntervalSec: {
|
|
26
29
|
...duration_attribute_writable,
|
|
30
|
+
name: "RateLimitIntervalSec",
|
|
27
31
|
configurable: true
|
|
28
32
|
},
|
|
29
33
|
RateLimitBurst: {
|
|
30
34
|
...string_attribute_writable,
|
|
35
|
+
name: "RateLimitBurst",
|
|
31
36
|
configurable: true
|
|
32
37
|
},
|
|
33
38
|
SystemMaxUse: {
|
|
34
39
|
...string_attribute_writable,
|
|
40
|
+
name: "SystemMaxUse",
|
|
35
41
|
configurable: true
|
|
36
42
|
},
|
|
37
43
|
SystemKeepFree: {
|
|
38
44
|
...string_attribute_writable,
|
|
45
|
+
name: "SystemKeepFree",
|
|
39
46
|
configurable: true
|
|
40
47
|
},
|
|
41
48
|
SystemMaxFileSize: {
|
|
42
49
|
...string_attribute_writable,
|
|
50
|
+
name: "SystemMaxFileSize",
|
|
43
51
|
configurable: true
|
|
44
52
|
},
|
|
45
53
|
SystemMaxFiles: {
|
|
46
54
|
...string_attribute_writable,
|
|
55
|
+
name: "SystemMaxFiles",
|
|
47
56
|
configurable: true
|
|
48
57
|
},
|
|
49
58
|
RuntimeMaxUse: {
|
|
50
59
|
...string_attribute_writable,
|
|
60
|
+
name: "RuntimeMaxUse",
|
|
51
61
|
configurable: true
|
|
52
62
|
},
|
|
53
63
|
RuntimeKeepFree: {
|
|
54
64
|
...string_attribute_writable,
|
|
65
|
+
name: "RuntimeKeepFree",
|
|
55
66
|
configurable: true
|
|
56
67
|
},
|
|
57
68
|
RuntimeMaxFileSize: {
|
|
58
69
|
...string_attribute_writable,
|
|
70
|
+
name: "RuntimeMaxFileSize",
|
|
59
71
|
configurable: true
|
|
60
72
|
},
|
|
61
73
|
RuntimeMaxFiles: {
|
|
62
74
|
...string_attribute_writable,
|
|
75
|
+
name: "RuntimeMaxFiles",
|
|
63
76
|
configurable: true
|
|
64
77
|
},
|
|
65
78
|
MaxRetentionSec: {
|
|
66
79
|
...duration_attribute_writable,
|
|
80
|
+
name: "MaxRetentionSec",
|
|
67
81
|
configurable: true
|
|
68
82
|
},
|
|
69
83
|
MaxFileSec: {
|
|
70
84
|
...duration_attribute_writable,
|
|
85
|
+
name: "MaxFileSec",
|
|
71
86
|
configurable: true
|
|
72
87
|
},
|
|
73
88
|
ForwardToSyslog: {
|
|
74
89
|
...string_attribute_writable,
|
|
90
|
+
name: "ForwardToSyslog",
|
|
75
91
|
configurable: true
|
|
76
92
|
},
|
|
77
93
|
ForwardToKMsg: {
|
|
78
94
|
...string_attribute_writable,
|
|
95
|
+
name: "ForwardToKMsg",
|
|
79
96
|
configurable: true
|
|
80
97
|
},
|
|
81
98
|
ForwardToConsole: {
|
|
82
99
|
...string_attribute_writable,
|
|
100
|
+
name: "ForwardToConsole",
|
|
83
101
|
configurable: true
|
|
84
102
|
},
|
|
85
103
|
ForwardToWall: {
|
|
86
104
|
...string_attribute_writable,
|
|
105
|
+
name: "ForwardToWall",
|
|
87
106
|
configurable: true
|
|
88
107
|
},
|
|
89
108
|
TTYPath: {
|
|
90
109
|
...string_attribute_writable,
|
|
110
|
+
name: "TTYPath",
|
|
91
111
|
configurable: true
|
|
92
112
|
},
|
|
93
113
|
MaxLevelStore: {
|
|
94
114
|
...string_attribute_writable,
|
|
115
|
+
name: "MaxLevelStore",
|
|
95
116
|
configurable: true
|
|
96
117
|
},
|
|
97
118
|
Compress: {
|
|
98
119
|
...string_attribute_writable,
|
|
120
|
+
name: "Compress",
|
|
99
121
|
configurable: true
|
|
100
122
|
}
|
|
101
123
|
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
boolean_attribute_writable,
|
|
7
7
|
yesno_attribute_writable
|
|
8
8
|
} from "pacc";
|
|
9
|
-
import { ExtraSourceService, serviceEndpoints, addType
|
|
9
|
+
import { ExtraSourceService, serviceEndpoints, addType } from "pmcf";
|
|
10
10
|
import {
|
|
11
11
|
filterConfigurable,
|
|
12
12
|
yesno,
|
|
@@ -16,50 +16,72 @@ import {
|
|
|
16
16
|
|
|
17
17
|
export class SystemdResolvedService extends ExtraSourceService {
|
|
18
18
|
static name = "systemd-resolved";
|
|
19
|
-
static specializationOf = Service;
|
|
20
19
|
static attributes = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
DNS: { ...string_attribute_writable, name: "DNS", configurable: true },
|
|
21
|
+
FallbackDNS: {
|
|
22
|
+
...string_attribute_writable,
|
|
23
|
+
name: "FallbackDNS",
|
|
24
|
+
configurable: true
|
|
25
|
+
},
|
|
27
26
|
domains: {
|
|
28
|
-
externalName: "Domains",
|
|
29
27
|
...string_collection_attribute_writable,
|
|
28
|
+
name: "domains",
|
|
29
|
+
externalName: "Domains",
|
|
30
30
|
configurable: true
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
MulticastDNS: {
|
|
33
|
+
...yesno_attribute_writable,
|
|
34
|
+
name: "MulticastDNS",
|
|
35
|
+
configurable: true
|
|
36
|
+
},
|
|
37
|
+
Cache: { ...boolean_attribute_writable, name: "Cache", configurable: true },
|
|
35
38
|
CacheFromLocalhost: {
|
|
36
39
|
...boolean_attribute_writable,
|
|
40
|
+
name: "CacheFromLocalhost",
|
|
41
|
+
configurable: true
|
|
42
|
+
},
|
|
43
|
+
DNSStubListener: {
|
|
44
|
+
...boolean_attribute_writable,
|
|
45
|
+
name: "DNSStubListener",
|
|
37
46
|
configurable: true
|
|
38
47
|
},
|
|
39
|
-
DNSStubListener: { ...boolean_attribute_writable, configurable: true },
|
|
40
48
|
DNSStubListenerExtra: {
|
|
41
49
|
...string_attribute_writable,
|
|
50
|
+
name: "DNSStubListenerExtra",
|
|
51
|
+
configurable: true
|
|
52
|
+
},
|
|
53
|
+
ReadEtcHosts: {
|
|
54
|
+
...boolean_attribute_writable,
|
|
55
|
+
name: "ReadEtcHosts",
|
|
42
56
|
configurable: true
|
|
43
57
|
},
|
|
44
|
-
ReadEtcHosts: { ...boolean_attribute_writable, configurable: true },
|
|
45
58
|
ResolveUnicastSingleLabel: {
|
|
46
59
|
...boolean_attribute_writable,
|
|
60
|
+
name: "ResolveUnicastSingleLabel",
|
|
47
61
|
configurable: true
|
|
48
62
|
},
|
|
49
63
|
StaleRetentionSec: {
|
|
50
64
|
...duration_attribute_writable,
|
|
65
|
+
name: "StaleRetentionSec",
|
|
66
|
+
configurable: true
|
|
67
|
+
},
|
|
68
|
+
RefuseRecordTypes: {
|
|
69
|
+
...string_attribute_writable,
|
|
70
|
+
name: "RefuseRecordTypes",
|
|
51
71
|
configurable: true
|
|
52
72
|
},
|
|
53
|
-
RefuseRecordTypes: { ...string_attribute_writable, configurable: true },
|
|
54
73
|
DNSSEC: {
|
|
55
74
|
...yesno_attribute_writable,
|
|
75
|
+
name: "DNSSEC",
|
|
56
76
|
default: false,
|
|
57
77
|
configurable: true
|
|
58
78
|
},
|
|
59
|
-
DNSOverTLS: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
DNSOverTLS: {
|
|
80
|
+
...yesno_attribute_writable,
|
|
81
|
+
name: "DNSOverTLS",
|
|
82
|
+
configurable: true
|
|
83
|
+
},
|
|
84
|
+
LLMNR: { ...yesno_attribute_writable, name: "LLMNR", configurable: true }
|
|
63
85
|
};
|
|
64
86
|
static service = {
|
|
65
87
|
extends: ["dns", "mdns", "llmnr"],
|
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
import { string_attribute_writable, duration_attribute_writable } from "pacc";
|
|
2
|
-
import { ExtraSourceService,
|
|
2
|
+
import { ExtraSourceService, serviceEndpoints, addType } from "pmcf";
|
|
3
3
|
import { filterConfigurable, sectionLines } from "../utils.mjs";
|
|
4
4
|
|
|
5
5
|
export class SystemdTimesyncdService extends ExtraSourceService {
|
|
6
6
|
static name = "systemd-timesyncd";
|
|
7
|
-
static specializationOf = Service;
|
|
8
|
-
|
|
9
7
|
static attributes = {
|
|
10
|
-
NTP: { ...string_attribute_writable, configurable: true },
|
|
11
|
-
FallbackNTP: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
NTP: { ...string_attribute_writable, name: "NTP", configurable: true },
|
|
9
|
+
FallbackNTP: {
|
|
10
|
+
...string_attribute_writable,
|
|
11
|
+
name: "FallbackNTP",
|
|
12
|
+
configurable: true
|
|
13
|
+
},
|
|
14
|
+
RootDistanceMaxSec: {
|
|
15
|
+
...duration_attribute_writable,
|
|
16
|
+
name: "RootDistanceMaxSec",
|
|
17
|
+
configurable: true
|
|
18
|
+
},
|
|
19
|
+
PollIntervalMinSec: {
|
|
20
|
+
...duration_attribute_writable,
|
|
21
|
+
name: "PollIntervalMinSec",
|
|
22
|
+
configurable: true
|
|
23
|
+
},
|
|
24
|
+
PollIntervalMaxSec: {
|
|
25
|
+
...duration_attribute_writable,
|
|
26
|
+
name: "PollIntervalMaxSec",
|
|
27
|
+
configurable: true
|
|
28
|
+
},
|
|
29
|
+
ConnectionRetrySec: {
|
|
30
|
+
...duration_attribute_writable,
|
|
31
|
+
name: "ConnectionRetrySec",
|
|
32
|
+
configurable: true
|
|
33
|
+
},
|
|
34
|
+
SaveIntervalSec: {
|
|
35
|
+
...duration_attribute_writable,
|
|
36
|
+
name: "SaveIntervalSec",
|
|
37
|
+
configurable: true
|
|
38
|
+
}
|
|
17
39
|
};
|
|
18
40
|
static service = {
|
|
19
41
|
systemdService: "systemd-timesyncd.service"
|
package/src/subnet.mjs
CHANGED
|
@@ -7,22 +7,21 @@ import {
|
|
|
7
7
|
matchPrefixIP,
|
|
8
8
|
FAMILY_IPV6
|
|
9
9
|
} from "ip-utilties";
|
|
10
|
-
import { string_attribute, name_attribute,
|
|
11
|
-
import { networks_attribute } from "./
|
|
12
|
-
import {
|
|
13
|
-
import { addType } from "pmcf";
|
|
10
|
+
import { string_attribute, name_attribute, integer_attribute } from "pacc";
|
|
11
|
+
import { networks_attribute } from "./common-attributes.mjs";
|
|
12
|
+
import { addType, Network } from "pmcf";
|
|
14
13
|
|
|
15
|
-
export class Subnet
|
|
14
|
+
export class Subnet {
|
|
16
15
|
static name = "subnet";
|
|
17
16
|
static priority = 1;
|
|
18
|
-
static owners = ["
|
|
17
|
+
static owners = ["owner", "network", "network_interface", "root"];
|
|
19
18
|
static constructWithIdentifierOnly = true;
|
|
20
19
|
static key = "address";
|
|
21
20
|
static attributes = {
|
|
22
|
-
address: name_attribute,
|
|
21
|
+
address: { ...name_attribute, name: "address", private: true },
|
|
23
22
|
networks: networks_attribute,
|
|
24
|
-
prefixLength:
|
|
25
|
-
family: string_attribute
|
|
23
|
+
prefixLength: { ...integer_attribute, name: "prefixLength" },
|
|
24
|
+
family: { ...string_attribute, name: "family" }
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
static {
|
|
@@ -31,24 +30,45 @@ export class Subnet extends Base {
|
|
|
31
30
|
|
|
32
31
|
networks = new Set();
|
|
33
32
|
|
|
34
|
-
constructor(
|
|
33
|
+
constructor(address) {
|
|
35
34
|
const { longPrefix, prefix, prefixLength, cidr } = normalizeCIDR(address);
|
|
36
|
-
super(owner, cidr);
|
|
37
35
|
|
|
36
|
+
this.address = cidr;
|
|
38
37
|
this.prefix = prefix;
|
|
39
38
|
this.prefixLength = prefixLength;
|
|
40
39
|
this.longPrefix = longPrefix;
|
|
41
40
|
this.family = familyIP(address);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get owner() {
|
|
44
|
+
return this._owner;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set owner(value) {
|
|
48
|
+
this._owner = value;
|
|
49
|
+
if(value instanceof Network) {
|
|
50
|
+
this.networks.add(value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get children()
|
|
55
|
+
{
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
*_walkDirections(directions, seen) {
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
get cidr() {
|
|
47
|
-
return this.
|
|
63
|
+
return this.address;
|
|
48
64
|
}
|
|
49
65
|
|
|
50
66
|
get fullName() {
|
|
51
|
-
return this.
|
|
67
|
+
return this.address;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get name() {
|
|
71
|
+
return this.address;
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
matchesAddress(address) {
|
|
@@ -73,28 +93,12 @@ export class Subnet extends Base {
|
|
|
73
93
|
];
|
|
74
94
|
}
|
|
75
95
|
|
|
76
|
-
get address() {
|
|
77
|
-
return this.name;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
96
|
get longAddress() {
|
|
81
97
|
return `${this.longPrefix}/${this.prefixLength}`;
|
|
82
98
|
}
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
const
|
|
86
|
-
export const
|
|
87
|
-
export const
|
|
88
|
-
export const
|
|
89
|
-
export const SUBNET_LOCALHOST_IPV6 = new Subnet(_owner, "::1/128");
|
|
90
|
-
export const SUBNET_LINK_LOCAL_IPV6 = new Subnet(_owner, "fe80::/64");
|
|
91
|
-
|
|
92
|
-
export function subnets(sources) {
|
|
93
|
-
let all = new Set();
|
|
94
|
-
|
|
95
|
-
for (const source of sources) {
|
|
96
|
-
all = all.union(source.subnets);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return all;
|
|
100
|
-
}
|
|
101
|
+
export const SUBNET_GLOBAL_IPV4 = new Subnet("0.0.0.0/0");
|
|
102
|
+
export const SUBNET_GLOBAL_IPV6 = new Subnet("::0/0");
|
|
103
|
+
export const SUBNET_LOCALHOST_IPV4 = new Subnet("127.0.0.1/8");
|
|
104
|
+
export const SUBNET_LOCALHOST_IPV6 = new Subnet("::1/128");
|
package/src/type.mjs
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { addType as addTypeBasic } from "pacc";
|
|
1
|
+
import { addType as addTypeBasic, toInternal } from "pacc";
|
|
2
|
+
import { normalizeIP } from "ip-utilties";
|
|
2
3
|
import { addServiceType } from "pmcf";
|
|
4
|
+
import { asArray } from "./utils.mjs";
|
|
5
|
+
|
|
6
|
+
addTypeBasic({
|
|
7
|
+
name: "ip",
|
|
8
|
+
primitive: true,
|
|
9
|
+
asMapEntry: (attribute, value, object) => [
|
|
10
|
+
normalizeIP(value),
|
|
11
|
+
object.addSubnet(value)
|
|
12
|
+
]
|
|
13
|
+
});
|
|
3
14
|
|
|
4
15
|
export function addType(type) {
|
|
5
16
|
addTypeBasic(type);
|
|
@@ -8,3 +19,77 @@ export function addType(type) {
|
|
|
8
19
|
addServiceType(type.service, type.name);
|
|
9
20
|
}
|
|
10
21
|
}
|
|
22
|
+
|
|
23
|
+
function error(message, attribute) {
|
|
24
|
+
throw new Error(message, { cause: attribute.name });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function assign(attribute, object, value) {
|
|
28
|
+
value = toInternal(value, attribute);
|
|
29
|
+
value ??= attribute.default;
|
|
30
|
+
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
if (attribute.values) {
|
|
33
|
+
if (!attribute.values.has(value)) {
|
|
34
|
+
error("unkown value", attribute);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (attribute.backpointer) {
|
|
39
|
+
assign(attribute.backpointer, value, object);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (attribute.collection) {
|
|
43
|
+
const current = object[attribute.name];
|
|
44
|
+
|
|
45
|
+
//console.log("ASSIGN", object.fullName, attribute.name, value.name);
|
|
46
|
+
if (current) {
|
|
47
|
+
if (typeof current.set === "function") {
|
|
48
|
+
if (attribute.type.primitive) {
|
|
49
|
+
if (attribute.type.asMapEntry) {
|
|
50
|
+
for (const v of asArray(value)) {
|
|
51
|
+
const [key, value] = attribute.type.asMapEntry(
|
|
52
|
+
attribute,
|
|
53
|
+
v,
|
|
54
|
+
object
|
|
55
|
+
);
|
|
56
|
+
current.set(key, value);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
for (const v of asArray(value)) {
|
|
60
|
+
current.set(v, v);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
current.set(value[attribute.type.key || "name"], value);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
if (typeof current.add === "function") {
|
|
68
|
+
if (value instanceof Set) {
|
|
69
|
+
object[attribute.name] = current.union(value);
|
|
70
|
+
} else {
|
|
71
|
+
current.add(value);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
if (Array.isArray(current)) {
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
current.push(...value);
|
|
77
|
+
} else {
|
|
78
|
+
current.push(value);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
object[attribute.name][value[attribute.type.key]] = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
object[attribute.name] =
|
|
87
|
+
attribute.constructor === value.constructor ? value : asArray(value);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
object[attribute.name] = value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return value;
|
|
95
|
+
}
|
package/src/utils.mjs
CHANGED
|
@@ -9,7 +9,7 @@ export function yesno(flag) {
|
|
|
9
9
|
* Appends default domain if name does not already have a domain.
|
|
10
10
|
* @param {string} name
|
|
11
11
|
* @param {string} [defaultDomain]
|
|
12
|
-
* @returns {string
|
|
12
|
+
* @returns {string}
|
|
13
13
|
*/
|
|
14
14
|
export function domainName(name, defaultDomain) {
|
|
15
15
|
const dcs = name.split(".");
|
|
@@ -118,7 +118,7 @@ export function asIterator(value) {
|
|
|
118
118
|
return asArray(value);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export const filterConfigurable =
|
|
121
|
+
export const filterConfigurable = attribute =>
|
|
122
122
|
!attribute.private && attribute.configurable;
|
|
123
123
|
|
|
124
124
|
export function union(value, present = new Set()) {
|
package/src/location.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
2
|
-
import { Owner, addType } from "pmcf";
|
|
3
|
-
import { loadHooks } from "./hooks.mjs";
|
|
4
|
-
|
|
5
|
-
export class Location extends Owner {
|
|
6
|
-
static name = "location";
|
|
7
|
-
static owners = [Owner, Location, "root"];
|
|
8
|
-
static attributes = {};
|
|
9
|
-
|
|
10
|
-
static {
|
|
11
|
-
addType(this);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get location() {
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get network() {
|
|
19
|
-
return [...this.typeList("network")][0] || super.network;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async *preparePackages(dir) {
|
|
23
|
-
const packageData = {
|
|
24
|
-
sources: [
|
|
25
|
-
new FileContentProvider(dir + "/"),
|
|
26
|
-
new FileContentProvider(
|
|
27
|
-
{ dir: this.directory, pattern: "location.json" },
|
|
28
|
-
{ destination: "/etc/location/location.json" }
|
|
29
|
-
)
|
|
30
|
-
],
|
|
31
|
-
outputs: this.outputs,
|
|
32
|
-
properties: {
|
|
33
|
-
name: `${this.typeName}-${this.name}`,
|
|
34
|
-
description: `${this.typeName} definitions for ${this.fullName}`,
|
|
35
|
-
access: "private",
|
|
36
|
-
dependencies: { jq: ">=1.6" },
|
|
37
|
-
provides: ["location"]
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
await loadHooks(
|
|
42
|
-
packageData,
|
|
43
|
-
new URL("location.install", import.meta.url).pathname
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
yield packageData;
|
|
47
|
-
}
|
|
48
|
-
}
|