pmcf 4.25.13 → 4.25.15

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": "4.25.13",
3
+ "version": "4.25.15",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -55,7 +55,7 @@ export class Base {
55
55
  }
56
56
 
57
57
  static get typeName() {
58
- return this.typeDefinition.name;
58
+ return this.typeDefinition?.name || this.name;
59
59
  }
60
60
 
61
61
  static get typeFileName() {
package/src/cluster.mjs CHANGED
@@ -15,8 +15,8 @@ import { writeLines } from "./utils.mjs";
15
15
  export class Cluster extends Host {
16
16
  static name = "cluster";
17
17
  static priority = 1.5;
18
- static owners = [Owner.typeDefinition, "network", "location", "root"];
19
- static extends = Host.typeDefinition;
18
+ static owners = [Owner, "network", "location", "root"];
19
+ static extends = Host;
20
20
  static key = "name";
21
21
  static attributes = {
22
22
  routerId: { ...number_attribute_writable, default: 100 },
@@ -1,23 +1,22 @@
1
1
  import { default_attribute_writable, addType } from "pacc";
2
- import { Service, ServiceTypeDefinition } from "./service.mjs";
2
+ import { Service } from "./service.mjs";
3
3
  import { networkAddressType } from "pmcf";
4
4
 
5
- export const ExtraSourceServiceTypeDefinition = {
6
- name: "extra-source-service",
7
- extends: ServiceTypeDefinition,
8
- specializationOf: ServiceTypeDefinition,
9
- owners: ServiceTypeDefinition.owners,
10
- attributes: {
5
+
6
+ export class ExtraSourceService extends Service {
7
+ static name = "extra-source-service";
8
+ static extends = Service;
9
+ static specializationOf = Service;
10
+ static owners = Service.owners;
11
+ static attributes = {
11
12
  source: {
12
13
  ...default_attribute_writable,
13
14
  type: networkAddressType,
14
15
  collection: true
15
16
  }
16
- }
17
- };
17
+ };
18
18
 
19
- export class ExtraSourceService extends Service {
20
- static typeDefinition = ExtraSourceServiceTypeDefinition;
19
+ static typeDefinition = this;
21
20
 
22
21
  static {
23
22
  addType(this);
@@ -26,7 +25,7 @@ export class ExtraSourceService extends Service {
26
25
  source = [];
27
26
 
28
27
  get type() {
29
- return ExtraSourceServiceTypeDefinition.name;
28
+ return this.constructor.name;
30
29
  }
31
30
 
32
31
  get services() {
package/src/host.mjs CHANGED
@@ -10,7 +10,8 @@ import {
10
10
  boolean_attribute_false,
11
11
  addType
12
12
  } from "pacc";
13
- import { ServiceOwner, Base, addresses } from "pmcf";
13
+ import { Base, NetworkInterface, addresses } from "pmcf";
14
+ import { ServiceOwner } from "./service-owner.mjs";
14
15
  import { networkAddressAttributes } from "./network-support.mjs";
15
16
  import { addHook } from "./hooks.mjs";
16
17
  import {
@@ -22,13 +23,12 @@ import {
22
23
  } from "./utils.mjs";
23
24
  import { loadHooks } from "./hooks.mjs";
24
25
  import { generateKnownHosts } from "./host-utils.mjs";
25
- import { NetworkInterfaceTypeDefinition } from "./network-interfaces/network-interface.mjs";
26
26
 
27
27
  export class Host extends ServiceOwner {
28
28
  static name = "host";
29
29
  static priority = 1.9;
30
30
  static owners = ["owner", "network", "root"];
31
- static extends = Base.typeDefinition;
31
+ static extends = Base;
32
32
  static key = "name";
33
33
  static attributes = {
34
34
  ...networkAddressAttributes,
@@ -368,7 +368,7 @@ export class Host extends ServiceOwner {
368
368
  }
369
369
 
370
370
  typeNamed(typeName, name) {
371
- if (typeName === NetworkInterfaceTypeDefinition.name) {
371
+ if (typeName === NetworkInterface.name) {
372
372
  const ni = this._networkInterfaces.get(name);
373
373
  if (ni) {
374
374
  return ni;
package/src/location.mjs CHANGED
@@ -6,8 +6,8 @@ import { loadHooks } from "./hooks.mjs";
6
6
  export class Location extends Owner {
7
7
  static name = "location";
8
8
  static priority = 2;
9
- static owners = [Owner.typeDefinition, "location", "root"];
10
- static extends = Owner.typeDefinition;
9
+ static owners = [Owner, "location", "root"];
10
+ static extends = Owner;
11
11
  static key = "name";
12
12
  static attributes = {};
13
13
 
package/src/network.mjs CHANGED
@@ -7,7 +7,7 @@ export class Network extends Owner {
7
7
  static name = "network";
8
8
  static priority = 2;
9
9
  static owners = ["location", "owner", "root"];
10
- static extends = Owner.typeDefinition;
10
+ static extends = Owner;
11
11
  static key = "name";
12
12
  static attributes = {
13
13
  ...networkAttributes,
package/src/owner.mjs CHANGED
@@ -19,7 +19,7 @@ export class Owner extends Base {
19
19
  static name = "owner";
20
20
  static priority = 2;
21
21
  static owners = ["location", "owner", "root"];
22
- static extends = Base.typeDefinition;
22
+ static extends = Base;
23
23
  static key = "name";
24
24
  static attributes = {
25
25
  networks: networks_attribute,
@@ -31,7 +31,7 @@ export class Owner extends Base {
31
31
  },
32
32
  subnets: {
33
33
  ...default_attribute_writable,
34
- type: Subnet.typeDefinition,
34
+ type: Subnet,
35
35
  collection: true
36
36
  },
37
37
  country: string_attribute_writable,
package/src/service.mjs CHANGED
@@ -48,15 +48,15 @@ export const EndpointTypeDefinition = {
48
48
  attributes: endpointAttributes
49
49
  };
50
50
 
51
- export const ServiceTypeDefinition = {
52
- name: "service",
53
- priority: 1.1,
54
- owners: [Host.typeDefinition, "cluster", "network_interface"],
55
- extends: Base.typeDefinition,
56
- specializations: {},
57
- factoryFor(owner, value) {
51
+ export class Service extends Base {
52
+ static name = "service";
53
+ static priority = 1.1;
54
+ static owners = [Host, "cluster", "network_interface"];
55
+ static extends = Base;
56
+ static specializations = {};
57
+ static factoryFor(owner, value) {
58
58
  const type = value.type ?? value.name;
59
- const t = ServiceTypeDefinition.specializations[type];
59
+ const t = this.specializations[type];
60
60
 
61
61
  if (t) {
62
62
  delete value.type;
@@ -64,19 +64,17 @@ export const ServiceTypeDefinition = {
64
64
  }
65
65
 
66
66
  return Service;
67
- },
68
- key: "name",
69
- attributes: {
67
+ }
68
+ static key = "name";
69
+ static attributes = {
70
70
  ...networkAddressAttributes,
71
71
  ...endpointAttributes,
72
72
  alias: string_attribute_writable,
73
73
  weight: { ...number_attribute_writable /*default: 1*/ },
74
74
  systemdService: string_attribute_writable
75
- }
76
- };
75
+ };
77
76
 
78
- export class Service extends Base {
79
- static typeDefinition = ServiceTypeDefinition;
77
+ static typeDefinition = this;
80
78
 
81
79
  static {
82
80
  addType(this);
@@ -221,7 +219,10 @@ export class Service extends Base {
221
219
  }
222
220
 
223
221
  get port() {
224
- return this.attribute("_port") ?? serviceTypeEndpoints(ServiceTypes[this.type])[0]?.port;
222
+ return (
223
+ this.attribute("_port") ??
224
+ serviceTypeEndpoints(ServiceTypes[this.type])[0]?.port
225
+ );
225
226
  }
226
227
 
227
228
  set weight(value) {
@@ -6,11 +6,11 @@ import {
6
6
  string_set_attribute_writable
7
7
  } from "pacc";
8
8
  import { addServiceType, Base } from "pmcf";
9
- import { ServiceTypeDefinition, Service } from "../service.mjs";
9
+ import { Service } from "../service.mjs";
10
10
 
11
11
  class ALPMRepository extends Base {
12
12
  static name = "alpm_repository";
13
- static extends = Base.typeDefinition;
13
+ static extends = Base;
14
14
  static key = "name";
15
15
  static attributes = {
16
16
  name: name_attribute_writable,
@@ -27,9 +27,9 @@ class ALPMRepository extends Base {
27
27
  export class ALPMService extends Service {
28
28
  static name = "alpm";
29
29
  static priority = 1;
30
- static extends = ServiceTypeDefinition;
31
- static specializationOf = ServiceTypeDefinition;
32
- static owners = ServiceTypeDefinition.owners;
30
+ static extends = Service;
31
+ static specializationOf = Service;
32
+ static owners = Service.owners;
33
33
  static attributes = {
34
34
  repositories: {
35
35
  ...default_attribute_writable,
@@ -27,17 +27,15 @@ import {
27
27
  dnsRecordTypeForAddressFamily,
28
28
  sortZoneRecords
29
29
  } from "../dns-utils.mjs";
30
- import { ServiceTypeDefinition } from "../service.mjs";
31
- import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
30
+ import { Service } from "../service.mjs";
32
31
  import { addHook } from "../hooks.mjs";
33
32
 
34
33
  const bindNetworkAddressTypes = networkAddressType + "|bind_group";
35
34
 
36
- const BindGroupTypeDefinition = {
37
- name: "bind_group",
38
- priority: 1,
39
- key: "name",
40
- attributes: {
35
+ class bind_group extends Base {
36
+ static priority = 1;
37
+ static key = "name";
38
+ static attributes = {
41
39
  name: name_attribute_writable,
42
40
  access: {
43
41
  type: bindNetworkAddressTypes,
@@ -77,11 +75,9 @@ const BindGroupTypeDefinition = {
77
75
  retry: { ...duration_attribute_writable, default: 72000 },
78
76
  expire: { ...duration_attribute_writable, default: 600000 },
79
77
  minimum: { ...duration_attribute_writable, default: 60000 }
80
- }
81
- };
78
+ };
82
79
 
83
- class BindGroup extends Base {
84
- static typeDefinition = BindGroupTypeDefinition;
80
+ static typeDefinition = this;
85
81
  static {
86
82
  addType(this);
87
83
  }
@@ -94,8 +90,7 @@ class BindGroup extends Base {
94
90
  notify = true;
95
91
  hasCatalog = true;
96
92
  hasSVRRecords = true;
97
- hasLinkLocalAdresses =
98
- BindGroupTypeDefinition.attributes.hasLinkLocalAdresses.default;
93
+ hasLinkLocalAdresses = bind_group.attributes.hasLinkLocalAdresses.default;
99
94
 
100
95
  recordTTL = "1W";
101
96
 
@@ -392,16 +387,26 @@ class BindGroup extends Base {
392
387
  }
393
388
  }
394
389
 
395
- const BindServiceTypeDefinition = {
396
- name: "bind",
397
- extends: ExtraSourceServiceTypeDefinition,
398
- specializationOf: ServiceTypeDefinition,
399
- owners: ServiceTypeDefinition.owners,
400
- key: "name",
401
- attributes: {
390
+ function addressesStatement(prefix, objects, generateEmpty = false) {
391
+ const body = asArray(objects).map(name => ` ${name};`);
392
+
393
+ if (body.length || generateEmpty) {
394
+ return [`${prefix} {`, body, "};"];
395
+ }
396
+
397
+ return [];
398
+ }
399
+
400
+ export class BindService extends ExtraSourceService {
401
+ static name = "bind";
402
+ static extends = ExtraSourceService;
403
+ static specializationOf = Service;
404
+ static owners = Service.owners;
405
+ static key = "name";
406
+ static attributes = {
402
407
  groups: {
403
408
  ...default_attribute_writable,
404
- type: BindGroupTypeDefinition,
409
+ type: bind_group,
405
410
  collection: true,
406
411
  writable: true
407
412
  },
@@ -410,8 +415,8 @@ const BindServiceTypeDefinition = {
410
415
  type: networkAddressType,
411
416
  collection: true
412
417
  }
413
- },
414
- service: {
418
+ };
419
+ static service = {
415
420
  systemdService: "bind.service",
416
421
  extends: ["dns"],
417
422
  services: {
@@ -447,31 +452,19 @@ const BindServiceTypeDefinition = {
447
452
  ]
448
453
  }
449
454
  }
450
- }
451
- };
452
-
453
- function addressesStatement(prefix, objects, generateEmpty = false) {
454
- const body = asArray(objects).map(name => ` ${name};`);
455
-
456
- if (body.length || generateEmpty) {
457
- return [`${prefix} {`, body, "};"];
458
- }
459
-
460
- return [];
461
- }
455
+ };
462
456
 
463
- export class BindService extends ExtraSourceService {
464
- static typeDefinition = BindServiceTypeDefinition;
457
+ static typeDefinition = this;
465
458
 
466
459
  static {
467
460
  addType(this);
468
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
461
+ addServiceType(this.service, this.name);
469
462
  }
470
463
 
471
464
  groups = {};
472
465
 
473
466
  get type() {
474
- return BindServiceTypeDefinition.name;
467
+ return this.constructor.name;
475
468
  }
476
469
 
477
470
  materializeExtends() {
@@ -522,7 +515,7 @@ export class BindService extends ExtraSourceService {
522
515
  }
523
516
 
524
517
  typeNamed(type, name) {
525
- if (type === BindGroupTypeDefinition.name) {
518
+ if (type === bind_group.name) {
526
519
  return this.groups[name];
527
520
  }
528
521
 
@@ -2,22 +2,18 @@ import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
3
  import { isLinkLocal } from "ip-utilties";
4
4
  import { addType } from "pacc";
5
- import { addServiceType } from "pmcf";
6
- import { ServiceTypeDefinition, serviceEndpoints } from "../service.mjs";
7
- import {
8
- ExtraSourceService,
9
- ExtraSourceServiceTypeDefinition
10
- } from "../extra-source-service.mjs";
5
+ import { addServiceType, ExtraSourceService } from "pmcf";
6
+ import { Service, serviceEndpoints } from "../service.mjs";
11
7
  import { writeLines } from "../utils.mjs";
12
8
 
13
- const ChronyServiceTypeDefinition = {
14
- name: "chrony",
15
- priority: 1,
16
- extends: ExtraSourceServiceTypeDefinition,
17
- specializationOf: ServiceTypeDefinition,
18
- owners: ServiceTypeDefinition.owners,
19
- key: "name",
20
- service: {
9
+ export class ChronyService extends ExtraSourceService {
10
+ static name = "chrony";
11
+ static priority = 1;
12
+ static extends = ExtraSourceService;
13
+ static specializationOf = Service;
14
+ static owners = Service.owners;
15
+ static key = "name";
16
+ static service = {
21
17
  systemdService: "chronyd.service",
22
18
  extends: ["ntp"],
23
19
  services: {
@@ -42,18 +38,16 @@ const ChronyServiceTypeDefinition = {
42
38
  ]
43
39
  }
44
40
  }
45
- }
46
- };
41
+ };
47
42
 
48
- export class ChronyService extends ExtraSourceService {
49
- static typeDefinition = ChronyServiceTypeDefinition;
43
+ static typeDefinition = this;
50
44
  static {
51
45
  addType(this);
52
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
46
+ addServiceType(this.service, this.name);
53
47
  }
54
48
 
55
49
  get type() {
56
- return ChronyServiceTypeDefinition.name;
50
+ return this.constructor.name;
57
51
  }
58
52
 
59
53
  async *preparePackages(dir) {
@@ -1,15 +1,15 @@
1
1
  import { addType } from "pacc";
2
2
  import { addServiceType } from "pmcf";
3
- import { ServiceTypeDefinition, Service } from "../service.mjs";
3
+ import { Service } from "../service.mjs";
4
4
 
5
- const HeadscaleServiceTypeDefinition = {
6
- name: "headscale",
7
- priority: 1,
8
- extends: ServiceTypeDefinition,
9
- specializationOf: ServiceTypeDefinition,
10
- owners: ServiceTypeDefinition.owners,
11
- key: "name",
12
- service: {
5
+ export class HeadscaleService extends Service {
6
+ static name = "headscale";
7
+ static priority = 1;
8
+ static extends = Service;
9
+ static specializationOf = Service;
10
+ static owners = Service.owners;
11
+ static key = "name";
12
+ static service = {
13
13
  endpoints: [
14
14
  {
15
15
  family: "unix",
@@ -36,13 +36,10 @@ const HeadscaleServiceTypeDefinition = {
36
36
  tls: false
37
37
  }
38
38
  ]
39
- }
40
- };
41
-
42
- export class HeadscaleService extends Service {
43
- static typeDefinition = HeadscaleServiceTypeDefinition;
39
+ };
40
+ static typeDefinition = this;
44
41
  static {
45
42
  addType(this);
46
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
43
+ addServiceType(this.service, this.name);
47
44
  }
48
45
  }
@@ -7,23 +7,23 @@ import {
7
7
  setionLinesFromPropertyIterator,
8
8
  filterConfigurable
9
9
  } from "../utils.mjs";
10
- import { Service, ServiceTypeDefinition } from "../service.mjs";
10
+ import { Service } from "../service.mjs";
11
11
 
12
- const InfluxdbServiceTypeDefinition = {
13
- name: "influxdb",
14
- priority: 1,
15
- extends: ServiceTypeDefinition,
16
- specializationOf: ServiceTypeDefinition,
17
- owners: ServiceTypeDefinition.owners,
18
- key: "name",
19
- attributes: {
12
+ export class InfluxdbService extends Service {
13
+ static name = "influxdb";
14
+ static priority = 1;
15
+ static extends = Service;
16
+ static specializationOf = Service;
17
+ static owners = Service.owners;
18
+ static key = "name";
19
+ static attributes = {
20
20
  metricsDisabled: {
21
21
  externalName: "metrics-disabled",
22
22
  ...boolean_attribute_writable_true,
23
23
  configurable: true
24
24
  }
25
- },
26
- service: {
25
+ };
26
+ static service = {
27
27
  endpoints: [
28
28
  {
29
29
  family: "IPv4",
@@ -40,18 +40,16 @@ const InfluxdbServiceTypeDefinition = {
40
40
  pathname: "/"
41
41
  }
42
42
  ]
43
- }
44
- };
43
+ };
45
44
 
46
- export class InfluxdbService extends Service {
47
- static typeDefinition = InfluxdbServiceTypeDefinition;
45
+ static typeDefinition = this;
48
46
  static {
49
47
  addType(this);
50
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
48
+ addServiceType(this.service, this.name);
51
49
  }
52
50
 
53
51
  get type() {
54
- return InfluxdbServiceTypeDefinition.name;
52
+ return this.constructor.name;
55
53
  }
56
54
 
57
55
  async *preparePackages(dir) {
@@ -62,7 +60,9 @@ export class InfluxdbService extends Service {
62
60
  await writeLines(
63
61
  join(dir, "etc", "influxdb"),
64
62
  "config.yml",
65
- setionLinesFromPropertyIterator(this.attributeIterator(filterConfigurable))
63
+ setionLinesFromPropertyIterator(
64
+ this.attributeIterator(filterConfigurable)
65
+ )
66
66
  );
67
67
 
68
68
  yield packageData;
@@ -11,21 +11,22 @@ import {
11
11
  addServiceType,
12
12
  Service,
13
13
  sortDescendingByPriority,
14
- ServiceTypeDefinition,
15
14
  serviceEndpoints,
16
15
  SUBNET_LOCALHOST_IPV4,
17
16
  SUBNET_LOCALHOST_IPV6
18
17
  } from "pmcf";
19
18
  import { writeLines } from "../utils.mjs";
20
19
 
21
- const KeaServiceTypeDefinition = {
22
- name: "kea",
23
- priority: 1,
24
- extends: ServiceTypeDefinition,
25
- specializationOf: ServiceTypeDefinition,
26
- owners: ServiceTypeDefinition.owners,
27
- key: "name",
28
- attributes: {
20
+ const keaVersion = "3.0.1";
21
+
22
+ export class KeaService extends Service {
23
+ static name = "kea";
24
+ static priority = 1;
25
+ static extends = Service;
26
+ static specializationOf = Service;
27
+ static owners = Service.owners;
28
+ static key = "name";
29
+ static attributes = {
29
30
  "ddns-send-updates": {
30
31
  ...boolean_attribute_writable_true,
31
32
  configurable: true
@@ -51,8 +52,8 @@ const KeaServiceTypeDefinition = {
51
52
  configurable: true
52
53
  //values: ["check-exists-with-dhcid","no-check-with-dhcid"]
53
54
  }
54
- },
55
- service: {
55
+ };
56
+ static service = {
56
57
  extends: ["dhcp"],
57
58
  services: {
58
59
  "kea-ddns": {
@@ -124,20 +125,16 @@ const KeaServiceTypeDefinition = {
124
125
  ]
125
126
  }
126
127
  }
127
- }
128
- };
128
+ };
129
129
 
130
- const keaVersion = "3.0.1";
131
-
132
- export class KeaService extends Service {
133
- static typeDefinition = KeaServiceTypeDefinition;
130
+ static typeDefinition = this;
134
131
  static {
135
132
  addType(this);
136
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
133
+ addServiceType(this.service, this.name);
137
134
  }
138
135
 
139
136
  get type() {
140
- return KeaServiceTypeDefinition.name;
137
+ return this.constructor.name;
141
138
  }
142
139
 
143
140
  async *preparePackages(dir) {
@@ -268,7 +265,7 @@ export class KeaService extends Service {
268
265
  };
269
266
 
270
267
  for (const [key] of Object.entries(
271
- KeaServiceTypeDefinition.attributes
268
+ KeaService.attributes
272
269
  ).filter(
273
270
  ([key, attribute]) => attribute.configurable && this[key] !== undefined
274
271
  )) {
@@ -1,15 +1,15 @@
1
1
  import { port_attribute, string_attribute_writable, addType } from "pacc";
2
2
  import { addServiceType } from "pmcf";
3
- import { Service, ServiceTypeDefinition } from "../service.mjs";
3
+ import { Service } from "../service.mjs";
4
4
 
5
- const MosquittoServiceTypeDefinition = {
6
- name: "mosquitto",
7
- priority: 1,
8
- extends: ServiceTypeDefinition,
9
- specializationOf: ServiceTypeDefinition,
10
- owners: ServiceTypeDefinition.owners,
11
- key: "name",
12
- attributes: {
5
+ export class MosquittoService extends Service {
6
+ static name = "mosquitto";
7
+ static priority = 1;
8
+ static extends = Service;
9
+ static specializationOf = Service;
10
+ static owners = Service.owners;
11
+ static key = "name";
12
+ static attributes = {
13
13
  listener: {
14
14
  ...port_attribute,
15
15
  writable: true,
@@ -27,21 +27,18 @@ const MosquittoServiceTypeDefinition = {
27
27
  ...string_attribute_writable,
28
28
  configurable: true
29
29
  }
30
- },
31
- service: {
30
+ };
31
+ static service = {
32
32
  extends: ["mqtt"]
33
- }
34
- };
35
-
36
- export class MosquittoService extends Service {
37
- static typeDefinition = MosquittoServiceTypeDefinition;
33
+ };
34
+ static typeDefinition = this;
38
35
  static {
39
36
  addType(this);
40
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
37
+ addServiceType(this.service, this.name);
41
38
  }
42
39
 
43
40
  get type() {
44
- return MosquittoServiceTypeDefinition.name;
41
+ return this.constructor.name;
45
42
  }
46
43
 
47
44
  get listener() {
@@ -1,42 +1,34 @@
1
- import { FileContentProvider } from "npm-pkgbuild";
2
- import {
3
- string_attribute_writable,
4
- number_attribute_writable,
5
- object_attribute,
6
- addType
7
- } from "pacc";
1
+ import { string_attribute_writable, addType } from "pacc";
8
2
  import { addServiceType } from "pmcf";
9
- import { ServiceTypeDefinition, Service } from "../service.mjs";
3
+ import { Service } from "../service.mjs";
10
4
 
11
- const OpenLDAPServiceTypeDefinition = {
12
- name: "openldap",
13
- priority: 1,
14
- extends: ServiceTypeDefinition,
15
- specializationOf: ServiceTypeDefinition,
16
- owners: ServiceTypeDefinition.owners,
17
- key: "name",
18
- attributes: {
5
+ export class OpenLDAPService extends Service {
6
+ static name = "openldap";
7
+ static priority = 1;
8
+ static extends = Service;
9
+ static specializationOf = Service;
10
+ static owners = Service.owners;
11
+ static key = "name";
12
+ static attributes = {
19
13
  base: string_attribute_writable,
20
14
  uri: string_attribute_writable
21
- },
22
- service: {
15
+ };
16
+ static service = {
23
17
  systemdService: "slapd.service",
24
18
  extends: ["ldap", "ldapi"],
25
19
  services: {}
26
- }
27
- };
20
+ };
28
21
 
29
- export class OpenLDAPService extends Service {
30
- static typeDefinition = OpenLDAPServiceTypeDefinition;
22
+ static typeDefinition = this;
31
23
  static {
32
24
  addType(this);
33
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
25
+ addServiceType(this.service, this.name);
34
26
  }
35
27
 
36
28
  _base;
37
29
 
38
30
  get type() {
39
- return OpenLDAPServiceTypeDefinition.name;
31
+ return this.constructor.name;
40
32
  }
41
33
 
42
34
  get base() {
@@ -1,13 +1,13 @@
1
1
  import { addType } from "pacc";
2
2
  import { addServiceType } from "pmcf";
3
- import { ServiceTypeDefinition, Service } from "../service.mjs";
3
+ import { Service } from "../service.mjs";
4
4
 
5
5
  export class PostfixService extends Service {
6
6
  static name = "postfix";
7
7
  static priority = 1;
8
- static extends = ServiceTypeDefinition;
9
- static specializationOf = ServiceTypeDefinition;
10
- static owners = ServiceTypeDefinition.owners;
8
+ static extends = Service;
9
+ static specializationOf = Service;
10
+ static owners = Service.owners;
11
11
  static key = "name";
12
12
  static attributes = {};
13
13
  static service = {
@@ -23,6 +23,6 @@ export class PostfixService extends Service {
23
23
  }
24
24
 
25
25
  get type() {
26
- return "postfix";
26
+ return this.constructor.name;
27
27
  }
28
28
  }
@@ -5,17 +5,21 @@ import {
5
5
  boolean_attribute_writable,
6
6
  integer_attribute_writable
7
7
  } from "pacc";
8
- import { Service, ServiceTypeDefinition, addServiceType } from "pmcf";
8
+ import { Service, addServiceType } from "pmcf";
9
9
  import { filterConfigurable, sectionLines } from "../utils.mjs";
10
10
 
11
- const SystemdJournalRemoteServiceTypeDefinition = {
12
- name: "systemd-journal-remote",
13
- priority: 1,
14
- extends: ServiceTypeDefinition,
15
- specializationOf: ServiceTypeDefinition,
16
- owners: ServiceTypeDefinition.owners,
17
- key: "name",
18
- attributes: {
11
+ /**
12
+ * @property {string} ServerCertificateFile
13
+ * @property {string} ServerKeyFile
14
+ */
15
+ export class SystemdJournalRemoteService extends Service {
16
+ static name = "systemd-journal-remote";
17
+ static priority = 1;
18
+ static extends = Service;
19
+ static specializationOf = Service;
20
+ static owners = Service.owners;
21
+ static key = "name";
22
+ static attributes = {
19
23
  Seal: {
20
24
  ...boolean_attribute_writable,
21
25
  configurable: true
@@ -61,8 +65,8 @@ const SystemdJournalRemoteServiceTypeDefinition = {
61
65
  configurable: true
62
66
  // default: "zstd lz4 xz"
63
67
  }
64
- },
65
- service: {
68
+ };
69
+ static service = {
66
70
  systemdService: "systemd-journal-remote.service",
67
71
  endpoints: [
68
72
  {
@@ -80,22 +84,16 @@ const SystemdJournalRemoteServiceTypeDefinition = {
80
84
  pathname: "/"
81
85
  }
82
86
  ]
83
- }
84
- };
87
+ };
85
88
 
86
- /**
87
- * @property {string} ServerCertificateFile
88
- * @property {string} ServerKeyFile
89
- */
90
- export class SystemdJournalRemoteService extends Service {
91
- static typeDefinition = SystemdJournalRemoteServiceTypeDefinition;
89
+ static typeDefinition = this;
92
90
  static {
93
91
  addType(this);
94
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
92
+ addServiceType(this.service, this.name);
95
93
  }
96
94
 
97
95
  get type() {
98
- return SystemdJournalRemoteServiceTypeDefinition.name;
96
+ return this.constructor.name;
99
97
  }
100
98
 
101
99
  /**
@@ -4,17 +4,22 @@ import {
4
4
  boolean_attribute_writable,
5
5
  addType
6
6
  } from "pacc";
7
- import { Service, ServiceTypeDefinition, addServiceType } from "pmcf";
7
+ import { Service, addServiceType } from "pmcf";
8
8
  import { filterConfigurable, sectionLines } from "../utils.mjs";
9
9
 
10
- const SystemdJournalUploadServiceTypeDefinition = {
11
- name: "systemd-journal-upload",
12
- priority: 1,
13
- extends: ServiceTypeDefinition,
14
- specializationOf: ServiceTypeDefinition,
15
- owners: ServiceTypeDefinition.owners,
16
- key: "name",
17
- attributes: {
10
+ /**
11
+ * @property {string} URL
12
+ * @property {string} ServerCertificateFile
13
+ * @property {string} ServerKeyFile
14
+ */
15
+ export class SystemdJournalUploadService extends Service {
16
+ static name = "systemd-journal-upload";
17
+ static priority = 1;
18
+ static extends = Service;
19
+ static specializationOf = Service;
20
+ static owners = Service.owners;
21
+ static key = "name";
22
+ static attributes = {
18
23
  URL: { ...string_attribute_writable, configurable: true },
19
24
  ServerKeyFile: {
20
25
  ...string_attribute_writable,
@@ -41,26 +46,18 @@ const SystemdJournalUploadServiceTypeDefinition = {
41
46
  configurable: true
42
47
  // default: false
43
48
  }
44
- },
45
- service: {
49
+ };
50
+ static service = {
46
51
  systemdService: "systemd-journal-upload.service"
47
- }
48
- };
49
-
50
- /**
51
- * @property {string} URL
52
- * @property {string} ServerCertificateFile
53
- * @property {string} ServerKeyFile
54
- */
55
- export class SystemdJournalUploadService extends Service {
56
- static typeDefinition = SystemdJournalUploadServiceTypeDefinition;
52
+ };
53
+ static typeDefinition = this;
57
54
  static {
58
55
  addType(this);
59
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
56
+ addServiceType(this.service, this.name);
60
57
  }
61
58
 
62
59
  get type() {
63
- return SystemdJournalUploadServiceTypeDefinition.name;
60
+ return this.constructor.name;
64
61
  }
65
62
 
66
63
  /**
@@ -69,9 +66,9 @@ export class SystemdJournalUploadService extends Service {
69
66
  * @returns {Object}
70
67
  */
71
68
  systemdConfigs(name) {
72
- console.log(this.fullName,this.owner.fullName);
73
- console.log(this.property('domainName'),this.name);
74
- console.log(this.property('certs_private_dir'));
69
+ console.log(this.fullName, this.owner.fullName);
70
+ console.log(this.property("domainName"), this.name);
71
+ console.log(this.property("certs_private_dir"));
75
72
  console.log("PROPS", this.expand(this.getAttributes(filterConfigurable)));
76
73
  return {
77
74
  serviceName: this.systemdService,
@@ -3,17 +3,17 @@ import {
3
3
  string_attribute_writable,
4
4
  duration_attribute_writable
5
5
  } from "pacc";
6
- import { Service, ServiceTypeDefinition, addServiceType } from "pmcf";
6
+ import { Service, addServiceType } from "pmcf";
7
7
  import { filterConfigurable, sectionLines } from "../utils.mjs";
8
8
 
9
- const SystemdJournalServiceTypeDefinition = {
10
- name: "systemd-journald",
11
- priority: 1,
12
- extends: ServiceTypeDefinition,
13
- specializationOf: ServiceTypeDefinition,
14
- owners: ServiceTypeDefinition.owners,
15
- key: "name",
16
- attributes: {
9
+ export class SystemdJournaldService extends Service {
10
+ static name = "systemd-journald";
11
+ static priority = 1;
12
+ static extends = Service;
13
+ static specializationOf = Service;
14
+ static owners = Service.owners;
15
+ static key = "name";
16
+ static attributes = {
17
17
  Storage: {
18
18
  ...string_attribute_writable,
19
19
  configurable: true
@@ -106,21 +106,18 @@ const SystemdJournalServiceTypeDefinition = {
106
106
  ...string_attribute_writable,
107
107
  configurable: true
108
108
  }
109
- },
110
- service: {
109
+ };
110
+ static service = {
111
111
  systemdService: "systemd-journald.service"
112
- }
113
- };
114
-
115
- export class SystemdJournaldService extends Service {
116
- static typeDefinition = SystemdJournalServiceTypeDefinition;
112
+ };
113
+ static typeDefinition = this;
117
114
  static {
118
115
  addType(this);
119
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
116
+ addServiceType(this.service, this.name);
120
117
  }
121
118
 
122
119
  get type() {
123
- return SystemdJournalServiceTypeDefinition.name;
120
+ return this.constructor.name;
124
121
  }
125
122
 
126
123
  systemdConfigs(name) {
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  addType,
3
- object_attribute,
4
3
  string_collection_attribute_writable,
5
4
  duration_attribute_writable,
6
5
  string_attribute_writable,
@@ -9,10 +8,9 @@ import {
9
8
  } from "pacc";
10
9
  import {
11
10
  ExtraSourceService,
12
- ExtraSourceServiceTypeDefinition,
13
- ServiceTypeDefinition,
14
11
  serviceEndpoints,
15
- addServiceType
12
+ addServiceType,
13
+ Service
16
14
  } from "pmcf";
17
15
  import {
18
16
  filterConfigurable,
@@ -21,14 +19,14 @@ import {
21
19
  setionLinesFromPropertyIterator
22
20
  } from "../utils.mjs";
23
21
 
24
- const SystemdResolvedServiceTypeDefinition = {
25
- name: "systemd-resolved",
26
- priority: 1,
27
- extends: ExtraSourceServiceTypeDefinition,
28
- specializationOf: ServiceTypeDefinition,
29
- owners: ServiceTypeDefinition.owners,
30
- key: "name",
31
- attributes: {
22
+ export class SystemdResolvedService extends ExtraSourceService {
23
+ static name = "systemd-resolved";
24
+ static priority = 1;
25
+ static extends = ExtraSourceService;
26
+ static specializationOf = Service;
27
+ static owners = Service.owners;
28
+ static key = "name";
29
+ static attributes = {
32
30
  /* Resolve: {
33
31
  ...object_attribute,
34
32
  attributes: {*/
@@ -71,22 +69,20 @@ const SystemdResolvedServiceTypeDefinition = {
71
69
  LLMNR: { ...yesno_attribute_writable, configurable: true }
72
70
  /* }
73
71
  }*/
74
- },
75
- service: {
76
- extends: ["dns","mdns","llmnr"],
72
+ };
73
+ static service = {
74
+ extends: ["dns", "mdns", "llmnr"],
77
75
  systemdService: "systemd-resolved.service"
78
- }
79
- };
76
+ };
80
77
 
81
- export class SystemdResolvedService extends ExtraSourceService {
82
- static typeDefinition = SystemdResolvedServiceTypeDefinition;
78
+ static typeDefinition = this;
83
79
  static {
84
80
  addType(this);
85
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
81
+ addServiceType(this.service, this.name);
86
82
  }
87
83
 
88
84
  get type() {
89
- return SystemdResolvedServiceTypeDefinition.name;
85
+ return this.constructor.name;
90
86
  }
91
87
 
92
88
  systemdConfigs(name) {
@@ -5,21 +5,20 @@ import {
5
5
  } from "pacc";
6
6
  import {
7
7
  ExtraSourceService,
8
- ExtraSourceServiceTypeDefinition,
9
- ServiceTypeDefinition,
8
+ Service,
10
9
  serviceEndpoints,
11
10
  addServiceType
12
11
  } from "pmcf";
13
12
  import { filterConfigurable, sectionLines } from "../utils.mjs";
14
13
 
15
- const SystemdTimesyncdServiceTypeDefinition = {
16
- name: "systemd-timesyncd",
17
- priority: 1,
18
- extends: ExtraSourceServiceTypeDefinition,
19
- specializationOf: ServiceTypeDefinition,
20
- owners: ServiceTypeDefinition.owners,
14
+ export class SystemdTimesyncdService extends ExtraSourceService {
15
+ static name = "systemd-timesyncd";
16
+ static priority = 1;
17
+ static extends = ExtraSourceService;
18
+ static specializationOf = Service;
19
+ static owners = Service.owners;
21
20
 
22
- attributes: {
21
+ static attributes = {
23
22
  NTP: { ...string_attribute_writable, configurable: true },
24
23
  FallbackNTP: { ...string_attribute_writable, configurable: true },
25
24
  RootDistanceMaxSec: { ...duration_attribute_writable, configurable: true },
@@ -27,21 +26,19 @@ const SystemdTimesyncdServiceTypeDefinition = {
27
26
  PollIntervalMaxSec: { ...duration_attribute_writable, configurable: true },
28
27
  ConnectionRetrySec: { ...duration_attribute_writable, configurable: true },
29
28
  SaveIntervalSec: { ...duration_attribute_writable, configurable: true }
30
- },
31
- service: {
29
+ };
30
+ static service = {
32
31
  systemdService: "systemd-timesyncd.service"
33
- }
34
- };
32
+ };
35
33
 
36
- export class SystemdTimesyncdService extends ExtraSourceService {
37
- static typeDefinition = SystemdTimesyncdServiceTypeDefinition;
34
+ static typeDefinition = this;
38
35
  static {
39
36
  addType(this);
40
- addServiceType(this.typeDefinition.service, this.typeDefinition.name);
37
+ addServiceType(this.service, this.name);
41
38
  }
42
39
 
43
40
  get type() {
44
- return SystemdTimesyncdServiceTypeDefinition.name;
41
+ return this.constructor.name;
45
42
  }
46
43
 
47
44
  systemdConfigs(name) {
@@ -1,12 +1,12 @@
1
1
  import { addType } from "pacc";
2
- import { ServiceTypeDefinition, Service } from "../service.mjs";
2
+ import { Service } from "../service.mjs";
3
3
 
4
4
  export class TailscaleService extends Service {
5
5
  static name = "tailscale";
6
6
  static priority = 1;
7
- static extends = ServiceTypeDefinition;
8
- static specializationOf = ServiceTypeDefinition;
9
- static owners = ServiceTypeDefinition.owners;
7
+ static extends = Service;
8
+ static specializationOf = Service;
9
+ static owners = Service.owners;
10
10
  static key = "name";
11
11
  static service = {
12
12
  endpoints: [