pmcf 4.25.10 → 4.25.12

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.10",
3
+ "version": "4.25.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -12,13 +12,13 @@ import { Host } from "./host.mjs";
12
12
  import { serviceEndpoints } from "pmcf";
13
13
  import { writeLines } from "./utils.mjs";
14
14
 
15
- const ClusterTypeDefinition = {
16
- name: "cluster",
17
- priority: 1.5,
18
- owners: [Owner.typeDefinition, "network", "location", "root"],
19
- extends: Host.typeDefinition,
20
- key: "name",
21
- attributes: {
15
+ export class Cluster extends Host {
16
+ static name = "cluster";
17
+ static priority = 1.5;
18
+ static owners = [Owner.typeDefinition, "network", "location", "root"];
19
+ static extends = Host.typeDefinition;
20
+ static key = "name";
21
+ static attributes = {
22
22
  routerId: { ...number_attribute_writable, default: 100 },
23
23
  masters: {
24
24
  ...default_attribute_writable,
@@ -36,11 +36,9 @@ const ClusterTypeDefinition = {
36
36
  collection: true
37
37
  },
38
38
  checkInterval: { ...duration_attribute_writable, default: 60 }
39
- }
40
- };
39
+ };
41
40
 
42
- export class Cluster extends Host {
43
- static typeDefinition = ClusterTypeDefinition;
41
+ static typeDefinition = this;
44
42
 
45
43
  static {
46
44
  addType(this);
@@ -177,9 +175,7 @@ export class Cluster extends Host {
177
175
 
178
176
  for (const member of this.members) {
179
177
  const memberService = Array.from(
180
- member.expression(
181
- `services[types[${endpoint.type}]][0]`
182
- )
178
+ member.expression(`services[types[${endpoint.type}]][0]`)
183
179
  );
184
180
 
185
181
  console.log(member.fullName, endpoint.type, memberService);
package/src/host.mjs CHANGED
@@ -24,13 +24,13 @@ import { loadHooks } from "./hooks.mjs";
24
24
  import { generateKnownHosts } from "./host-utils.mjs";
25
25
  import { NetworkInterfaceTypeDefinition } from "./network-interfaces/network-interface.mjs";
26
26
 
27
- const HostTypeDefinition = {
28
- name: "host",
29
- priority: 1.9,
30
- owners: ["owner", "network", "root"],
31
- extends: Base.typeDefinition,
32
- key: "name",
33
- attributes: {
27
+ export class Host extends ServiceOwner {
28
+ static name = "host";
29
+ static priority = 1.9;
30
+ static owners = ["owner", "network", "root"];
31
+ static extends = Base.typeDefinition;
32
+ static key = "name";
33
+ static attributes = {
34
34
  ...networkAddressAttributes,
35
35
  networkInterfaces: {
36
36
  ...default_attribute_writable,
@@ -85,11 +85,9 @@ const HostTypeDefinition = {
85
85
  extends: { ...default_attribute_writable, type: "host", collection: true },
86
86
  model: string_attribute,
87
87
  isModel: boolean_attribute_false
88
- }
89
- };
88
+ };
90
89
 
91
- export class Host extends ServiceOwner {
92
- static typeDefinition = HostTypeDefinition;
90
+ static typeDefinition = this;
93
91
 
94
92
  static {
95
93
  addType(this);
@@ -3,14 +3,6 @@ import { SUBNET_LOCALHOST_IPV4, SUBNET_LOCALHOST_IPV6 } from "pmcf";
3
3
  import { SkeletonNetworkInterface } from "./skeleton.mjs";
4
4
  import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
5
5
 
6
- const LoopbackNetworkInterfaceTypeDefinition = {
7
- name: "loopback",
8
- extends: NetworkInterfaceTypeDefinition,
9
- specializationOf: NetworkInterfaceTypeDefinition,
10
- owners: NetworkInterfaceTypeDefinition.owners,
11
- key: "name"
12
- };
13
-
14
6
  const _localAddresses = new Map([
15
7
  ["127.0.0.1", SUBNET_LOCALHOST_IPV4],
16
8
  ["::1", SUBNET_LOCALHOST_IPV6]
@@ -19,7 +11,13 @@ const _localAddresses = new Map([
19
11
  const _localDomains = new Set(["localhost"]);
20
12
 
21
13
  export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
22
- static typeDefinition = LoopbackNetworkInterfaceTypeDefinition;
14
+ static name = "loopback";
15
+ static extends = NetworkInterfaceTypeDefinition;
16
+ static specializationOf = NetworkInterfaceTypeDefinition;
17
+ static owners = NetworkInterfaceTypeDefinition.owners;
18
+ static key = "name";
19
+
20
+ static typeDefinition = this;
23
21
 
24
22
  static {
25
23
  addType(this);
@@ -30,7 +28,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
30
28
  }
31
29
 
32
30
  get kind() {
33
- return LoopbackNetworkInterfaceTypeDefinition.name;
31
+ return "loopback";
34
32
  }
35
33
 
36
34
  set scope(v) {}
@@ -2,23 +2,21 @@ import { addType } from "pacc";
2
2
  import { NetworkInterface } from "./network-interface.mjs";
3
3
  import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
4
4
 
5
- const TUNdNetworkInterfaceTypeDefinition = {
6
- name: "tun",
7
- extends: NetworkInterfaceTypeDefinition,
8
- specializationOf: NetworkInterfaceTypeDefinition,
9
- owners: NetworkInterfaceTypeDefinition.owners,
10
- key: "name"
11
- };
12
-
13
5
  export class TUNNetworkInterface extends NetworkInterface {
14
- static typeDefinition = TUNdNetworkInterfaceTypeDefinition;
6
+ static name = "tun";
7
+ static extends = NetworkInterfaceTypeDefinition;
8
+ static specializationOf = NetworkInterfaceTypeDefinition;
9
+ static owners = NetworkInterfaceTypeDefinition.owners;
10
+ static key = "name";
11
+
12
+ static typeDefinition = this;
15
13
 
16
14
  static {
17
15
  addType(this);
18
16
  }
19
17
 
20
18
  get kind() {
21
- return TUNdNetworkInterfaceTypeDefinition.name;
19
+ return "tun";
22
20
  }
23
21
 
24
22
  async systemdDefinitions(dir, packageData) {}
@@ -2,23 +2,21 @@ import { addType } from "pacc";
2
2
  import { SkeletonNetworkInterface } from "./skeleton.mjs";
3
3
  import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
4
4
 
5
- const WireguardNetworkInterfaceTypeDefinition = {
6
- name: "wireguard",
7
- extends: NetworkInterfaceTypeDefinition,
8
- specializationOf: NetworkInterfaceTypeDefinition,
9
- owners: NetworkInterfaceTypeDefinition.owners,
10
- key: "name"
11
- };
12
-
13
5
  export class WireguardNetworkInterface extends SkeletonNetworkInterface {
14
- static typeDefinition = WireguardNetworkInterfaceTypeDefinition;
6
+ static name = "wireguard";
7
+ static extends = NetworkInterfaceTypeDefinition;
8
+ static specializationOf = NetworkInterfaceTypeDefinition;
9
+ static owners = NetworkInterfaceTypeDefinition.owners;
10
+ static key = "name";
11
+
12
+ static typeDefinition = this;
15
13
 
16
14
  static {
17
15
  addType(this);
18
16
  }
19
-
17
+
20
18
  get kind() {
21
- return WireguardNetworkInterfaceTypeDefinition.name;
19
+ return "wireguard";
22
20
  }
23
21
 
24
22
  get ipAddresses() {
@@ -12,21 +12,19 @@ import {
12
12
  EthernetNetworkInterfaceTypeDefinition
13
13
  } from "./ethernet.mjs";
14
14
 
15
- const WLANNetworkInterfaceTypeDefinition = {
16
- name: "wlan",
17
- extends: EthernetNetworkInterfaceTypeDefinition,
18
- specializationOf: NetworkInterfaceTypeDefinition,
19
- owners: EthernetNetworkInterfaceTypeDefinition.owners,
20
- key: "name",
21
- attributes: {
15
+ export class WLANNetworkInterface extends EthernetNetworkInterface {
16
+ static name = "wlan";
17
+ static extends = EthernetNetworkInterfaceTypeDefinition;
18
+ static specializationOf = NetworkInterfaceTypeDefinition;
19
+ static owners = EthernetNetworkInterfaceTypeDefinition.owners;
20
+ static key = "name";
21
+ static attributes = {
22
22
  ssid: string_attribute_writable,
23
23
  psk: secret_attribute_writable,
24
24
  secretName: string_attribute_writable
25
- }
26
- };
25
+ };
27
26
 
28
- export class WLANNetworkInterface extends EthernetNetworkInterface {
29
- static typeDefinition = WLANNetworkInterfaceTypeDefinition;
27
+ static typeDefinition = this;
30
28
 
31
29
  static {
32
30
  addType(this);
@@ -41,7 +39,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
41
39
  _secretName;
42
40
 
43
41
  get kind() {
44
- return WLANNetworkInterfaceTypeDefinition.name;
42
+ return "wlan";
45
43
  }
46
44
 
47
45
  set secretName(value) {
package/src/network.mjs CHANGED
@@ -3,13 +3,13 @@ import { Owner } from "./owner.mjs";
3
3
  import { Subnet } from "./subnet.mjs";
4
4
  import { networkAttributes } from "./network-support.mjs";
5
5
 
6
- export const NetworkTypeDefinition = {
7
- name: "network",
8
- priority: 2,
9
- owners: ["location", "owner", "root"],
10
- extends: Owner.typeDefinition,
11
- key: "name",
12
- attributes: {
6
+ export class Network extends Owner {
7
+ static name = "network";
8
+ static priority = 2;
9
+ static owners = ["location", "owner", "root"];
10
+ static extends = Owner.typeDefinition;
11
+ static key = "name";
12
+ static attributes = {
13
13
  ...networkAttributes,
14
14
  bridge: {
15
15
  ...default_attribute_writable,
@@ -17,11 +17,9 @@ export const NetworkTypeDefinition = {
17
17
  collection: true
18
18
  },
19
19
  gateway: { ...default_attribute_writable, type: "host" }
20
- }
21
- };
20
+ };
22
21
 
23
- export class Network extends Owner {
24
- static typeDefinition = NetworkTypeDefinition;
22
+ static typeDefinition = this;
25
23
 
26
24
  static {
27
25
  addType(this);
package/src/owner.mjs CHANGED
@@ -13,13 +13,15 @@ import { Base } from "./base.mjs";
13
13
  import { Subnet, SUBNET_GLOBAL_IPV4, SUBNET_GLOBAL_IPV6 } from "./subnet.mjs";
14
14
  import { networks_attribute } from "./network-support.mjs";
15
15
 
16
- const OwnerTypeDefinition = {
17
- name: "owner",
18
- priority: 2,
19
- owners: ["location", "owner", "root"],
20
- extends: Base.typeDefinition,
21
- key: "name",
22
- attributes: {
16
+ const EMPTY = new Map();
17
+
18
+ export class Owner extends Base {
19
+ static name = "owner";
20
+ static priority = 2;
21
+ static owners = ["location", "owner", "root"];
22
+ static extends = Base.typeDefinition;
23
+ static key = "name";
24
+ static attributes = {
23
25
  networks: networks_attribute,
24
26
  hosts: { ...default_attribute_writable, type: "host", collection: true },
25
27
  clusters: {
@@ -40,13 +42,9 @@ const OwnerTypeDefinition = {
40
42
  locales: { ...string_set_attribute_writable, description: "unix locale" },
41
43
  administratorEmail: { ...email_attribute, writable: true },
42
44
  template: { ...boolean_attribute_writable, private: true }
43
- }
44
- };
45
+ };
45
46
 
46
- const EMPTY = new Map();
47
-
48
- export class Owner extends Base {
49
- static typeDefinition = OwnerTypeDefinition;
47
+ static typeDefinition = this;
50
48
 
51
49
  static {
52
50
  addType(this);