pmcf 4.27.0 → 4.27.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.27.0",
3
+ "version": "4.27.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/host.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  boolean_attribute_false,
11
11
  addType
12
12
  } from "pacc";
13
- import { Base, NetworkInterface, addresses } from "pmcf";
13
+ import { NetworkInterface, addresses } from "pmcf";
14
14
  import { ServiceOwner } from "./service-owner.mjs";
15
15
  import { networkAddressAttributes } from "./network-support.mjs";
16
16
  import { addHook } from "./hooks.mjs";
@@ -28,7 +28,7 @@ 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;
31
+ static extends = ServiceOwner;
32
32
  static key = "name";
33
33
  static attributes = {
34
34
  ...networkAddressAttributes,
@@ -37,11 +37,6 @@ export class Host extends ServiceOwner {
37
37
  type: "network_interface",
38
38
  collection: true
39
39
  },
40
- services: {
41
- ...default_attribute_writable,
42
- type: "service",
43
- collection: true
44
- },
45
40
  aliases: string_set_attribute_writable,
46
41
  os: {
47
42
  ...string_attribute_writable,
@@ -87,7 +82,6 @@ export class Host extends ServiceOwner {
87
82
  isModel: boolean_attribute_false
88
83
  };
89
84
 
90
-
91
85
  static {
92
86
  addType(this);
93
87
  }
@@ -111,16 +105,13 @@ export class Host extends ServiceOwner {
111
105
  super.materializeExtends();
112
106
 
113
107
  for (const host of this.walkDirections(["extends"])) {
114
-
115
-
116
108
  for (const [name, ni] of host.networkInterfaces) {
117
- const present = this._networkInterfaces.get(name);
109
+ const present = this._networkInterfaces.get(ni.name);
118
110
 
119
111
  if (present) {
120
- //console.log("LINK", present.fullName, ni.fullName,present.extends);
121
112
  present.extends.add(ni);
122
113
  } else {
123
- this._networkInterfaces.set(name, ni.forOwner(this));
114
+ this.networkInterfaces = ni.forOwner(this);
124
115
  }
125
116
  }
126
117
  }
package/src/owner.mjs CHANGED
@@ -23,11 +23,12 @@ export class Owner extends Base {
23
23
  static key = "name";
24
24
  static attributes = {
25
25
  networks: networks_attribute,
26
- hosts: { ...default_attribute_writable, type: "host", collection: true },
26
+ hosts: { ...default_attribute_writable, type: "host", collection: true, owner: true },
27
27
  clusters: {
28
28
  ...default_attribute_writable,
29
29
  type: "cluster",
30
- collection: true
30
+ collection: true,
31
+ owner: true
31
32
  },
32
33
  subnets: {
33
34
  ...default_attribute_writable,
@@ -1,6 +1,24 @@
1
+ import { default_attribute_writable, addType } from "pacc";
1
2
  import { Base, Service } from "pmcf";
2
3
 
3
4
  export class ServiceOwner extends Base {
5
+ static name = "service-owner";
6
+ static priority = 1.9;
7
+ static owners = ["owner", "network", "root"];
8
+ static extends = Base;
9
+ static key = "name";
10
+ static attributes = {
11
+ services: {
12
+ ...default_attribute_writable,
13
+ type: "service",
14
+ collection: true
15
+ }
16
+ };
17
+
18
+ static {
19
+ addType(this);
20
+ }
21
+
4
22
  _services = new Map();
5
23
 
6
24
  set services(service) {
@@ -14,9 +32,9 @@ export class ServiceOwner extends Base {
14
32
  addObject(object) {
15
33
  if (object instanceof Service) {
16
34
  this._services.set(object.name, object);
35
+ } else {
36
+ super.addObject(object);
17
37
  }
18
-
19
- super.addObject(object);
20
38
  }
21
39
 
22
40
  materializeExtends() {
@@ -34,27 +52,6 @@ export class ServiceOwner extends Base {
34
52
  this.services = service.forOwner(this);
35
53
  }
36
54
  }
37
-
38
- /*
39
- if (this.fullName === "/SW/mini1") {
40
- const myServiceNames = new Set([...this.services.keys()]);
41
- const extendingSericeNames = new Set([
42
- ...this.mapFromDirections(["extends"], "_services").keys()
43
- ]);
44
-
45
- console.log("XXX",this.fullName, [...this.extends].map(n=>n.fullName), myServiceNames, extendingSericeNames);
46
-
47
- if (!extendingSericeNames.isSubsetOf(myServiceNames)) {
48
- // const diff = myServiceNames.difference(extendingSericeNames);
49
- console.log(
50
- "DIFF",
51
- this.fullName,
52
- myServiceNames,
53
- extendingSericeNames
54
- );
55
- }
56
- }
57
- */
58
55
  }
59
56
 
60
57
  _traverse(...args) {
package/src/service.mjs CHANGED
@@ -33,7 +33,7 @@ export const endpointAttributes = {
33
33
  port: number_attribute_writable,
34
34
  protocol: {
35
35
  ...string_attribute_writable,
36
- values: ["tcp", "udp"]
36
+ values: ["tcp", "udp", "quic"]
37
37
  },
38
38
  type: string_attribute_writable,
39
39
  types: string_set_attribute,
@@ -61,7 +61,12 @@ export class Service extends Base {
61
61
  static attributes = {
62
62
  ...networkAddressAttributes,
63
63
  ...endpointAttributes,
64
- extends: { ...default_attribute_writable, type: Service, collection: true, owner: false },
64
+ extends: {
65
+ ...default_attribute_writable,
66
+ type: Service,
67
+ collection: true,
68
+ owner: false
69
+ },
65
70
  alias: string_attribute_writable,
66
71
  weight: { ...number_attribute_writable /*default: 1*/ },
67
72
  systemdService: string_attribute_writable