pmcf 2.4.0 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/service.mjs CHANGED
@@ -65,20 +65,14 @@ export const ServiceTypeDefinition = {
65
65
  owners: ["host", "cluster"],
66
66
  priority: 0.4,
67
67
  extends: Base.typeDefinition,
68
+ specializations: {},
68
69
  factoryFor(value) {
69
70
  const type = value.type ?? value.name;
71
+ const t = ServiceTypeDefinition.specializations[type];
70
72
 
71
- if (type === "dns") {
73
+ if (t) {
72
74
  delete value.type;
73
- return DNSService;
74
- }
75
- if (type === "ntp") {
76
- delete value.type;
77
- return NTPService;
78
- }
79
- if (type === "dhcp") {
80
- delete value.type;
81
- return DHCPService;
75
+ return t.clazz;
82
76
  }
83
77
 
84
78
  return Service;
@@ -10,6 +10,7 @@ import { writeLines } from "../utils.mjs";
10
10
 
11
11
  const DHCPServiceTypeDefinition = {
12
12
  name: "dhcp",
13
+ specializationOf: ServiceTypeDefinition,
13
14
  owners: ServiceTypeDefinition.owners,
14
15
  extends: ServiceTypeDefinition,
15
16
  priority: 0.1,
@@ -19,6 +19,7 @@ import { subnets } from "../subnet.mjs";
19
19
 
20
20
  const DNSServiceTypeDefinition = {
21
21
  name: "dns",
22
+ specializationOf: ServiceTypeDefinition,
22
23
  owners: ServiceTypeDefinition.owners,
23
24
  extends: ExtraSourceServiceTypeDefinition,
24
25
  priority: 0.1,
@@ -4,6 +4,7 @@ import { ExtraSourceService, ExtraSourceServiceTypeDefinition } from "../extra-s
4
4
 
5
5
  const NTPServiceTypeDefinition = {
6
6
  name: "ntp",
7
+ specializationOf: ServiceTypeDefinition,
7
8
  owners: ServiceTypeDefinition.owners,
8
9
  extends: ExtraSourceServiceTypeDefinition,
9
10
  priority: 0.1,
package/src/types.mjs CHANGED
@@ -3,6 +3,10 @@ export const types = {};
3
3
  export function addType(clazz) {
4
4
  const type = clazz.typeDefinition;
5
5
 
6
+ if(type.specializationOf) {
7
+ type.specializationOf.specializations[type.name] = type;
8
+ }
9
+
6
10
  types[type.name] = type;
7
11
 
8
12
  type.clazz = clazz;
@@ -66,7 +66,8 @@ export class ExtraSourceService extends Service {
66
66
  };
67
67
  };
68
68
  };
69
- factoryFor(value: any): typeof Service | typeof import("./module.mjs").DNSService | typeof import("./module.mjs").NTPService | typeof import("./module.mjs").DHCPService;
69
+ specializations: {};
70
+ factoryFor(value: any): any;
70
71
  properties: {
71
72
  ipAddresses: {
72
73
  type: string;
@@ -51,7 +51,8 @@ export namespace ServiceTypeDefinition {
51
51
  };
52
52
  };
53
53
  export { _extends as extends };
54
- export function factoryFor(value: any): typeof Service | typeof DNSService | typeof NTPService | typeof DHCPService;
54
+ export let specializations: {};
55
+ export function factoryFor(value: any): any;
55
56
  export let properties: {
56
57
  ipAddresses: {
57
58
  type: string;
@@ -173,7 +174,8 @@ export class Service extends Base {
173
174
  };
174
175
  };
175
176
  };
176
- factoryFor(value: any): typeof Service | typeof DNSService | typeof NTPService | typeof DHCPService;
177
+ specializations: {};
178
+ factoryFor(value: any): any;
177
179
  properties: {
178
180
  ipAddresses: {
179
181
  type: string;
@@ -272,7 +274,4 @@ export class Service extends Base {
272
274
  }[];
273
275
  }
274
276
  export function sortByPriority(a: any, b: any): number;
275
- import { DNSService } from "./module.mjs";
276
- import { NTPService } from "./module.mjs";
277
- import { DHCPService } from "./module.mjs";
278
277
  import { Base } from "./base.mjs";
@@ -1,6 +1,128 @@
1
1
  export class DHCPService extends Service {
2
2
  static get typeDefinition(): {
3
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(value: any): any;
57
+ properties: {
58
+ ipAddresses: {
59
+ type: string;
60
+ collection: boolean;
61
+ writeable: boolean;
62
+ };
63
+ port: {
64
+ type: string;
65
+ collection: boolean;
66
+ writeable: boolean;
67
+ };
68
+ protocol: {
69
+ type: string;
70
+ collection: boolean;
71
+ writeable: boolean;
72
+ values: string[];
73
+ };
74
+ alias: {
75
+ type: string;
76
+ collection: boolean;
77
+ writeable: boolean;
78
+ };
79
+ type: {
80
+ type: string;
81
+ collection: boolean;
82
+ writeable: boolean;
83
+ };
84
+ weight: {
85
+ type: string;
86
+ collection: boolean;
87
+ writeable: boolean;
88
+ };
89
+ tls: {
90
+ type: string;
91
+ collection: boolean;
92
+ writeable: boolean;
93
+ };
94
+ systemd: {
95
+ type: string;
96
+ collection: boolean;
97
+ writeable: boolean;
98
+ };
99
+ hostName: {
100
+ type: string;
101
+ collection: boolean;
102
+ writeable: boolean;
103
+ };
104
+ cidrAddresses: {
105
+ type: string;
106
+ collection: boolean;
107
+ writeable: boolean;
108
+ };
109
+ cidrAddress: {
110
+ type: string;
111
+ collection: boolean;
112
+ writeable: boolean;
113
+ };
114
+ rawAddresses: {
115
+ type: string;
116
+ collection: boolean;
117
+ writeable: boolean;
118
+ };
119
+ rawAddress: {
120
+ type: string;
121
+ collection: boolean;
122
+ writeable: boolean;
123
+ };
124
+ };
125
+ };
4
126
  owners: string[];
5
127
  extends: {
6
128
  name: string;
@@ -53,7 +175,8 @@ export class DHCPService extends Service {
53
175
  };
54
176
  };
55
177
  };
56
- factoryFor(value: any): typeof Service | typeof import("./dns.mjs").DNSService | typeof import("./ntp.mjs").NTPService | typeof DHCPService;
178
+ specializations: {};
179
+ factoryFor(value: any): any;
57
180
  properties: {
58
181
  ipAddresses: {
59
182
  type: string;
@@ -3,6 +3,128 @@ export function reverseArpaAddress(address: any): string;
3
3
  export class DNSService extends ExtraSourceService {
4
4
  static get typeDefinition(): {
5
5
  name: string;
6
+ specializationOf: {
7
+ name: string;
8
+ owners: string[];
9
+ priority: number;
10
+ extends: {
11
+ name: string;
12
+ owners: any[];
13
+ properties: {
14
+ owner: {
15
+ type: string;
16
+ collection: boolean;
17
+ writeable: boolean;
18
+ };
19
+ type: {
20
+ type: string;
21
+ collection: boolean;
22
+ writeable: boolean;
23
+ };
24
+ name: {
25
+ type: string;
26
+ collection: boolean;
27
+ identifier: boolean;
28
+ writeable: boolean;
29
+ };
30
+ description: {
31
+ type: string;
32
+ collection: boolean;
33
+ writeable: boolean;
34
+ };
35
+ priority: {
36
+ type: string;
37
+ collection: boolean;
38
+ writeable: boolean;
39
+ };
40
+ directory: {
41
+ type: string;
42
+ collection: boolean;
43
+ writeable: boolean;
44
+ };
45
+ packaging: {
46
+ type: string;
47
+ collection: boolean;
48
+ writeable: boolean;
49
+ };
50
+ tags: {
51
+ type: string;
52
+ collection: boolean;
53
+ writeable: boolean;
54
+ };
55
+ };
56
+ };
57
+ specializations: {};
58
+ factoryFor(value: any): any;
59
+ properties: {
60
+ ipAddresses: {
61
+ type: string;
62
+ collection: boolean;
63
+ writeable: boolean;
64
+ };
65
+ port: {
66
+ type: string;
67
+ collection: boolean;
68
+ writeable: boolean;
69
+ };
70
+ protocol: {
71
+ type: string;
72
+ collection: boolean;
73
+ writeable: boolean;
74
+ values: string[];
75
+ };
76
+ alias: {
77
+ type: string;
78
+ collection: boolean;
79
+ writeable: boolean;
80
+ };
81
+ type: {
82
+ type: string;
83
+ collection: boolean;
84
+ writeable: boolean;
85
+ };
86
+ weight: {
87
+ type: string;
88
+ collection: boolean;
89
+ writeable: boolean;
90
+ };
91
+ tls: {
92
+ type: string;
93
+ collection: boolean;
94
+ writeable: boolean;
95
+ };
96
+ systemd: {
97
+ type: string;
98
+ collection: boolean;
99
+ writeable: 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
+ rawAddresses: {
117
+ type: string;
118
+ collection: boolean;
119
+ writeable: boolean;
120
+ };
121
+ rawAddress: {
122
+ type: string;
123
+ collection: boolean;
124
+ writeable: boolean;
125
+ };
126
+ };
127
+ };
6
128
  owners: string[];
7
129
  extends: {
8
130
  name: string;
@@ -58,7 +180,8 @@ export class DNSService extends ExtraSourceService {
58
180
  };
59
181
  };
60
182
  };
61
- factoryFor(value: any): typeof import("../service.mjs").Service | typeof DNSService | typeof import("./ntp.mjs").NTPService | typeof import("./dhcp.mjs").DHCPService;
183
+ specializations: {};
184
+ factoryFor(value: any): any;
62
185
  properties: {
63
186
  ipAddresses: {
64
187
  type: string;
@@ -1,6 +1,128 @@
1
1
  export class NTPService extends ExtraSourceService {
2
2
  static get typeDefinition(): {
3
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(value: any): any;
57
+ properties: {
58
+ ipAddresses: {
59
+ type: string;
60
+ collection: boolean;
61
+ writeable: boolean;
62
+ };
63
+ port: {
64
+ type: string;
65
+ collection: boolean;
66
+ writeable: boolean;
67
+ };
68
+ protocol: {
69
+ type: string;
70
+ collection: boolean;
71
+ writeable: boolean;
72
+ values: string[];
73
+ };
74
+ alias: {
75
+ type: string;
76
+ collection: boolean;
77
+ writeable: boolean;
78
+ };
79
+ type: {
80
+ type: string;
81
+ collection: boolean;
82
+ writeable: boolean;
83
+ };
84
+ weight: {
85
+ type: string;
86
+ collection: boolean;
87
+ writeable: boolean;
88
+ };
89
+ tls: {
90
+ type: string;
91
+ collection: boolean;
92
+ writeable: boolean;
93
+ };
94
+ systemd: {
95
+ type: string;
96
+ collection: boolean;
97
+ writeable: boolean;
98
+ };
99
+ hostName: {
100
+ type: string;
101
+ collection: boolean;
102
+ writeable: boolean;
103
+ };
104
+ cidrAddresses: {
105
+ type: string;
106
+ collection: boolean;
107
+ writeable: boolean;
108
+ };
109
+ cidrAddress: {
110
+ type: string;
111
+ collection: boolean;
112
+ writeable: boolean;
113
+ };
114
+ rawAddresses: {
115
+ type: string;
116
+ collection: boolean;
117
+ writeable: boolean;
118
+ };
119
+ rawAddress: {
120
+ type: string;
121
+ collection: boolean;
122
+ writeable: boolean;
123
+ };
124
+ };
125
+ };
4
126
  owners: string[];
5
127
  extends: {
6
128
  name: string;
@@ -56,7 +178,8 @@ export class NTPService extends ExtraSourceService {
56
178
  };
57
179
  };
58
180
  };
59
- factoryFor(value: any): typeof import("../service.mjs").Service | typeof import("./dns.mjs").DNSService | typeof NTPService | typeof import("./dhcp.mjs").DHCPService;
181
+ specializations: {};
182
+ factoryFor(value: any): any;
60
183
  properties: {
61
184
  ipAddresses: {
62
185
  type: string;