pmcf 1.45.0 → 1.45.2
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-named-defs +22 -21
- package/package.json +1 -1
- package/src/base.mjs +6 -3
- package/src/host.mjs +9 -5
- package/src/location.mjs +10 -5
- package/src/network.mjs +3 -3
- package/src/owner.mjs +3 -2
- package/src/service.mjs +2 -2
- package/types/host.d.mts +23 -3
- package/types/location.d.mts +10 -6
- package/types/network.d.mts +4 -2
- package/types/owner.d.mts +4 -2
- package/types/service.d.mts +8 -2
package/bin/pmcf-named-defs
CHANGED
|
@@ -69,6 +69,7 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
69
69
|
rname,
|
|
70
70
|
subnets.map(s => `${s.owner.name}/${s.name}`)
|
|
71
71
|
);
|
|
72
|
+
const reverseZones = new Map();
|
|
72
73
|
|
|
73
74
|
const SOARecord = createRecord(
|
|
74
75
|
"@",
|
|
@@ -135,28 +136,28 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
135
136
|
);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
|
-
}
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
140
|
+
if (subnet) {
|
|
141
|
+
let reverseZone = reverseZones.get(subnet.address);
|
|
142
|
+
|
|
143
|
+
if (!reverseZone) {
|
|
144
|
+
const reverseArpa = reverseArpaAddress(subnet.prefix);
|
|
145
|
+
reverseZone = {
|
|
146
|
+
id: reverseArpa,
|
|
147
|
+
file: `${reverseArpa}.zone`,
|
|
148
|
+
records: new Set([SOARecord, NSRecord])
|
|
149
|
+
};
|
|
150
|
+
zones.push(reverseZone);
|
|
151
|
+
reverseZones.set(subnet.address, reverseZone);
|
|
152
|
+
}
|
|
153
|
+
reverseZone.records.add(
|
|
154
|
+
createRecord(
|
|
155
|
+
fullName(reverseArpaAddress(address)),
|
|
156
|
+
"PTR",
|
|
157
|
+
fullName(host.domainName)
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -70,15 +70,18 @@ export class Base {
|
|
|
70
70
|
const slot = data[slotName];
|
|
71
71
|
if (slot) {
|
|
72
72
|
delete data[slotName];
|
|
73
|
+
|
|
74
|
+
const type = typeof typeDef.type === "string" ? typesByName[typeDef.type] : typeDef.type;
|
|
75
|
+
|
|
73
76
|
if (typeDef.collection) {
|
|
74
77
|
if (Array.isArray(slot) || typeof slot === "string") {
|
|
75
78
|
for (const item of asArray(slot)) {
|
|
76
|
-
new
|
|
79
|
+
new type(this, item);
|
|
77
80
|
}
|
|
78
81
|
} else {
|
|
79
82
|
for (const [objectName, objectData] of Object.entries(slot)) {
|
|
80
83
|
objectData.name = objectName;
|
|
81
|
-
new
|
|
84
|
+
new type(this, objectData);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
} else {
|
|
@@ -92,7 +95,7 @@ export class Base {
|
|
|
92
95
|
break;
|
|
93
96
|
|
|
94
97
|
default:
|
|
95
|
-
this[slotName] = new
|
|
98
|
+
this[slotName] = new type(this, slot);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
}
|
package/src/host.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Base } from "./base.mjs";
|
|
2
2
|
import { Network } from "./network.mjs";
|
|
3
|
+
import { Service } from "./service.mjs";
|
|
3
4
|
import {
|
|
4
5
|
asArray,
|
|
5
6
|
isIPv4Address,
|
|
@@ -34,14 +35,17 @@ export class Host extends Base {
|
|
|
34
35
|
extends: Base,
|
|
35
36
|
properties: {
|
|
36
37
|
networkInterfaces: { type: "network_interface", collection: true },
|
|
37
|
-
services: { type:
|
|
38
|
+
services: { type: Service, collection: true },
|
|
38
39
|
os: { type: "string" },
|
|
39
40
|
distribution: { type: "string" },
|
|
40
41
|
deployment: { type: "string" },
|
|
41
42
|
master: { type: "boolean" },
|
|
42
43
|
model: { type: "string" },
|
|
43
44
|
replaces: { type: "string" },
|
|
44
|
-
depends: { type: "string" }
|
|
45
|
+
depends: { type: "string" },
|
|
46
|
+
cidrAddresses: { type: "string", collection: true, writeable: false },
|
|
47
|
+
rawAddresses: { type: "string", collection: true, writeable: false },
|
|
48
|
+
rawAddress: { type: "string", writeable: false }
|
|
45
49
|
}
|
|
46
50
|
};
|
|
47
51
|
}
|
|
@@ -305,9 +309,9 @@ export class NetworkInterface extends Base {
|
|
|
305
309
|
ssid: { type: "string" },
|
|
306
310
|
psk: { type: "string" },
|
|
307
311
|
metric: { type: "number" },
|
|
308
|
-
cidrAddresses: { type: "string", collection: true },
|
|
309
|
-
|
|
310
|
-
network: {},
|
|
312
|
+
cidrAddresses: { type: "string", collection: true, writeable: false },
|
|
313
|
+
rawAddresses: { type: "string", collection: true, writeable: false },
|
|
314
|
+
network: { type: "network" },
|
|
311
315
|
gateway: {},
|
|
312
316
|
arpbridge: {}
|
|
313
317
|
}
|
package/src/location.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Owner } from "./owner.mjs";
|
|
2
|
+
import { Network } from "./network.mjs";
|
|
3
|
+
import { Subnet } from "./subnet.mjs";
|
|
4
|
+
import { Host } from "./host.mjs";
|
|
5
|
+
import { DNSService } from "./dns.mjs";
|
|
6
|
+
import { Cluster } from "./cluster.mjs";
|
|
2
7
|
import { addType } from "./types.mjs";
|
|
3
8
|
|
|
4
9
|
export class Location extends Owner {
|
|
@@ -11,11 +16,11 @@ export class Location extends Owner {
|
|
|
11
16
|
name: "location",
|
|
12
17
|
extends: Owner,
|
|
13
18
|
properties: {
|
|
14
|
-
networks: { type:
|
|
15
|
-
hosts: { type:
|
|
16
|
-
clusters: { type:
|
|
17
|
-
subnets: { type:
|
|
18
|
-
dns: { type:
|
|
19
|
+
networks: { type: Network, collection: true },
|
|
20
|
+
hosts: { type: Host, collection: true },
|
|
21
|
+
clusters: { type: Cluster, collection: true },
|
|
22
|
+
subnets: { type: Subnet, collection: true },
|
|
23
|
+
dns: { type: DNSService },
|
|
19
24
|
country: { type: "string" }
|
|
20
25
|
}
|
|
21
26
|
};
|
package/src/network.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Owner } from "./owner.mjs";
|
|
2
2
|
import { Subnet } from "./subnet.mjs";
|
|
3
|
+
import { Host } from "./host.mjs";
|
|
3
4
|
import { addType } from "./types.mjs";
|
|
4
5
|
|
|
5
6
|
export class Network extends Owner {
|
|
@@ -19,12 +20,11 @@ export class Network extends Owner {
|
|
|
19
20
|
extends: Owner,
|
|
20
21
|
properties: {
|
|
21
22
|
networks: { type: "network", collection: true },
|
|
22
|
-
hosts: { type:
|
|
23
|
+
hosts: { type: Host, collection: true },
|
|
23
24
|
clusters: { type: "cluster", collection: true },
|
|
24
|
-
subnets: { type:
|
|
25
|
+
subnets: { type: Subnet, collection: true },
|
|
25
26
|
dns: { type: "dns", collection: false },
|
|
26
27
|
//metric: { type: "number" }
|
|
27
|
-
|
|
28
28
|
/*kind: { type: "string" },
|
|
29
29
|
scope: { type: "string" },
|
|
30
30
|
/*bridge: {},
|
package/src/owner.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { asArray, normalizeCIDR } from "./utils.mjs";
|
|
|
2
2
|
import { Base } from "./base.mjs";
|
|
3
3
|
import { Subnet } from "./subnet.mjs";
|
|
4
4
|
import { addType } from "./types.mjs";
|
|
5
|
+
import { DNSService } from "./dns.mjs";
|
|
5
6
|
|
|
6
7
|
export class Owner extends Base {
|
|
7
8
|
#membersByType = new Map();
|
|
@@ -22,8 +23,8 @@ export class Owner extends Base {
|
|
|
22
23
|
networks: { type: "network", collection: true },
|
|
23
24
|
hosts: { type: "host", collection: true },
|
|
24
25
|
clusters: { type: "cluster", collection: true },
|
|
25
|
-
subnets: { type:
|
|
26
|
-
dns: { type:
|
|
26
|
+
subnets: { type: Subnet, collection: true },
|
|
27
|
+
dns: { type: DNSService, collection: false },
|
|
27
28
|
domain: { type: "string" },
|
|
28
29
|
administratorEmail: { type: "string" }
|
|
29
30
|
}
|
package/src/service.mjs
CHANGED
|
@@ -31,8 +31,8 @@ export class Service extends Base {
|
|
|
31
31
|
name: "service",
|
|
32
32
|
extends: Base,
|
|
33
33
|
properties: {
|
|
34
|
-
ipAddresses: {},
|
|
35
|
-
addresses: {},
|
|
34
|
+
ipAddresses: { type: "string", collection: true },
|
|
35
|
+
addresses: { type: "string", collection: true },
|
|
36
36
|
port: { type: "number" },
|
|
37
37
|
protocol: { type: "string" },
|
|
38
38
|
alias: { type: "string" },
|
package/types/host.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ export class Host extends Base {
|
|
|
8
8
|
collection: boolean;
|
|
9
9
|
};
|
|
10
10
|
services: {
|
|
11
|
-
type:
|
|
11
|
+
type: typeof Service;
|
|
12
12
|
collection: boolean;
|
|
13
13
|
};
|
|
14
14
|
os: {
|
|
@@ -32,6 +32,20 @@ export class Host extends Base {
|
|
|
32
32
|
depends: {
|
|
33
33
|
type: string;
|
|
34
34
|
};
|
|
35
|
+
cidrAddresses: {
|
|
36
|
+
type: string;
|
|
37
|
+
collection: boolean;
|
|
38
|
+
writeable: boolean;
|
|
39
|
+
};
|
|
40
|
+
rawAddresses: {
|
|
41
|
+
type: string;
|
|
42
|
+
collection: boolean;
|
|
43
|
+
writeable: boolean;
|
|
44
|
+
};
|
|
45
|
+
rawAddress: {
|
|
46
|
+
type: string;
|
|
47
|
+
writeable: boolean;
|
|
48
|
+
};
|
|
35
49
|
};
|
|
36
50
|
};
|
|
37
51
|
static prepareData(root: any, data: any): Promise<typeof Host>;
|
|
@@ -97,11 +111,16 @@ export class NetworkInterface extends Base {
|
|
|
97
111
|
cidrAddresses: {
|
|
98
112
|
type: string;
|
|
99
113
|
collection: boolean;
|
|
114
|
+
writeable: boolean;
|
|
100
115
|
};
|
|
101
|
-
|
|
116
|
+
rawAddresses: {
|
|
117
|
+
type: string;
|
|
118
|
+
collection: boolean;
|
|
119
|
+
writeable: boolean;
|
|
120
|
+
};
|
|
121
|
+
network: {
|
|
102
122
|
type: string;
|
|
103
123
|
};
|
|
104
|
-
network: {};
|
|
105
124
|
gateway: {};
|
|
106
125
|
arpbridge: {};
|
|
107
126
|
};
|
|
@@ -128,3 +147,4 @@ export class NetworkInterface extends Base {
|
|
|
128
147
|
#private;
|
|
129
148
|
}
|
|
130
149
|
import { Base } from "./base.mjs";
|
|
150
|
+
import { Service } from "./service.mjs";
|
package/types/location.d.mts
CHANGED
|
@@ -4,24 +4,23 @@ export class Location extends Owner {
|
|
|
4
4
|
extends: typeof Owner;
|
|
5
5
|
properties: {
|
|
6
6
|
networks: {
|
|
7
|
-
type:
|
|
7
|
+
type: typeof Network;
|
|
8
8
|
collection: boolean;
|
|
9
9
|
};
|
|
10
10
|
hosts: {
|
|
11
|
-
type:
|
|
11
|
+
type: typeof Host;
|
|
12
12
|
collection: boolean;
|
|
13
13
|
};
|
|
14
14
|
clusters: {
|
|
15
|
-
type:
|
|
15
|
+
type: typeof Cluster;
|
|
16
16
|
collection: boolean;
|
|
17
17
|
};
|
|
18
18
|
subnets: {
|
|
19
|
-
type:
|
|
19
|
+
type: typeof Subnet;
|
|
20
20
|
collection: boolean;
|
|
21
21
|
};
|
|
22
22
|
dns: {
|
|
23
|
-
type:
|
|
24
|
-
collection: boolean;
|
|
23
|
+
type: typeof DNSService;
|
|
25
24
|
};
|
|
26
25
|
country: {
|
|
27
26
|
type: string;
|
|
@@ -31,3 +30,8 @@ export class Location extends Owner {
|
|
|
31
30
|
get location(): this;
|
|
32
31
|
}
|
|
33
32
|
import { Owner } from "./owner.mjs";
|
|
33
|
+
import { Network } from "./network.mjs";
|
|
34
|
+
import { Host } from "./host.mjs";
|
|
35
|
+
import { Cluster } from "./cluster.mjs";
|
|
36
|
+
import { Subnet } from "./subnet.mjs";
|
|
37
|
+
import { DNSService } from "./dns.mjs";
|
package/types/network.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ export class Network extends Owner {
|
|
|
8
8
|
collection: boolean;
|
|
9
9
|
};
|
|
10
10
|
hosts: {
|
|
11
|
-
type:
|
|
11
|
+
type: typeof Host;
|
|
12
12
|
collection: boolean;
|
|
13
13
|
};
|
|
14
14
|
clusters: {
|
|
@@ -16,7 +16,7 @@ export class Network extends Owner {
|
|
|
16
16
|
collection: boolean;
|
|
17
17
|
};
|
|
18
18
|
subnets: {
|
|
19
|
-
type:
|
|
19
|
+
type: typeof Subnet;
|
|
20
20
|
collection: boolean;
|
|
21
21
|
};
|
|
22
22
|
dns: {
|
|
@@ -36,3 +36,5 @@ export class Network extends Owner {
|
|
|
36
36
|
#private;
|
|
37
37
|
}
|
|
38
38
|
import { Owner } from "./owner.mjs";
|
|
39
|
+
import { Host } from "./host.mjs";
|
|
40
|
+
import { Subnet } from "./subnet.mjs";
|
package/types/owner.d.mts
CHANGED
|
@@ -16,11 +16,11 @@ export class Owner extends Base {
|
|
|
16
16
|
collection: boolean;
|
|
17
17
|
};
|
|
18
18
|
subnets: {
|
|
19
|
-
type:
|
|
19
|
+
type: typeof Subnet;
|
|
20
20
|
collection: boolean;
|
|
21
21
|
};
|
|
22
22
|
dns: {
|
|
23
|
-
type:
|
|
23
|
+
type: typeof DNSService;
|
|
24
24
|
collection: boolean;
|
|
25
25
|
};
|
|
26
26
|
domain: {
|
|
@@ -64,3 +64,5 @@ export class Owner extends Base {
|
|
|
64
64
|
#private;
|
|
65
65
|
}
|
|
66
66
|
import { Base } from "./base.mjs";
|
|
67
|
+
import { Subnet } from "./subnet.mjs";
|
|
68
|
+
import { DNSService } from "./dns.mjs";
|
package/types/service.d.mts
CHANGED
|
@@ -3,8 +3,14 @@ export class Service extends Base {
|
|
|
3
3
|
name: string;
|
|
4
4
|
extends: typeof Base;
|
|
5
5
|
properties: {
|
|
6
|
-
ipAddresses: {
|
|
7
|
-
|
|
6
|
+
ipAddresses: {
|
|
7
|
+
type: string;
|
|
8
|
+
collection: boolean;
|
|
9
|
+
};
|
|
10
|
+
addresses: {
|
|
11
|
+
type: string;
|
|
12
|
+
collection: boolean;
|
|
13
|
+
};
|
|
8
14
|
port: {
|
|
9
15
|
type: string;
|
|
10
16
|
};
|