pmcf 4.25.9 → 4.25.11

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.9",
3
+ "version": "4.25.11",
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);
package/src/location.mjs CHANGED
@@ -3,17 +3,15 @@ import { addType } from "pacc";
3
3
  import { Owner } from "pmcf";
4
4
  import { loadHooks } from "./hooks.mjs";
5
5
 
6
- const LocationTypeDefinition = {
7
- name: "location",
8
- priority: 2,
9
- owners: [Owner.typeDefinition, "location", "root"],
10
- extends: Owner.typeDefinition,
11
- key: "name",
12
- attributes: {}
13
- };
14
-
15
6
  export class Location extends Owner {
16
- static typeDefinition = LocationTypeDefinition;
7
+ static name = "location";
8
+ static priority = 2;
9
+ static owners = [Owner.typeDefinition, "location", "root"];
10
+ static extends = Owner.typeDefinition;
11
+ static key = "name";
12
+ static attributes = {};
13
+
14
+ static typeDefinition = this;
17
15
 
18
16
  static {
19
17
  addType(this);
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);