pmcf 6.28.0 → 6.28.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": "6.28.0",
3
+ "version": "6.28.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -8,7 +8,9 @@ import {
8
8
  string_attribute,
9
9
  integer_attribute_writable,
10
10
  hostname_attribute as hostname_attribute_base,
11
- boolean_attribute_writable
11
+ boolean_attribute_writable,
12
+ boolean_attribute_false,
13
+ port_attribute_writable
12
14
  } from "pacc";
13
15
 
14
16
  export const networkAddressType = "network|host|network_interface";
@@ -83,6 +85,12 @@ export const subnets_attribute = {
83
85
  backpointer: owner_attribute
84
86
  };
85
87
 
88
+ export const subnet_attribute = {
89
+ ...default_attribute_writable,
90
+ name: "subnet",
91
+ type: "subnet"
92
+ };
93
+
86
94
  export const bridges_attribute = {
87
95
  ...networks_attribute,
88
96
  name: "bridges",
@@ -142,3 +150,16 @@ export const networkAddressAttributes = {
142
150
  addresses: { ...string_collection_attribute_writable, name: "addresses" },
143
151
  address: { ...string_attribute_writable, name: "address" }
144
152
  };
153
+
154
+ export const endpointAttributes = {
155
+ port: port_attribute_writable,
156
+ protocol: {
157
+ ...string_attribute_writable,
158
+ name: "protocol",
159
+ values: new Set(["tcp", "udp", "quic"])
160
+ },
161
+ types: { ...string_set_attribute_writable, name: "types" },
162
+ tls: { ...boolean_attribute_false, name: "tls" },
163
+ address: { ...string_attribute, name: "address" }
164
+ };
165
+
@@ -1,11 +1,7 @@
1
1
  import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
2
2
  import {
3
- string_attribute,
4
3
  string_attribute_writable,
5
4
  number_attribute_writable,
6
- string_set_attribute_writable,
7
- boolean_attribute_false,
8
- port_attribute_writable,
9
5
  priority_attribute
10
6
  } from "pacc";
11
7
  import {
@@ -14,7 +10,7 @@ import {
14
10
  Endpoint,
15
11
  DomainNameEndpoint,
16
12
  HTTPEndpoint,
17
- UnixEndpoint,
13
+ unix_endpoint,
18
14
  addType,
19
15
  FAMILY_UNIX,
20
16
  FAMILY_DNS
@@ -22,7 +18,8 @@ import {
22
18
  import { asArray } from "./utils.mjs";
23
19
  import {
24
20
  networkAddressAttributes,
25
- extends_attribute
21
+ extends_attribute,
22
+ endpointAttributes
26
23
  } from "./common-attributes.mjs";
27
24
  import {
28
25
  serviceTypeEndpoints,
@@ -37,18 +34,6 @@ import {
37
34
  dnsPriority
38
35
  } from "./dns-utils.mjs";
39
36
 
40
- export const endpointAttributes = {
41
- port: port_attribute_writable,
42
- protocol: {
43
- ...string_attribute_writable,
44
- name: "protocol",
45
- values: new Set(["tcp", "udp", "quic"])
46
- },
47
- types: { ...string_set_attribute_writable, name: "types" },
48
- tls: { ...boolean_attribute_false, name: "tls" },
49
- address: { ...string_attribute, name: "address" }
50
- };
51
-
52
37
  export class CoreService extends Base {
53
38
  static name = "core-service";
54
39
  static priority = 1.1;
@@ -137,7 +122,7 @@ export class CoreService extends Base {
137
122
  for (const e of data) {
138
123
  switch (e.family) {
139
124
  case FAMILY_UNIX:
140
- result.push(new UnixEndpoint(this, e.path, e));
125
+ result.push(new unix_endpoint(this, e.path, e));
141
126
  break;
142
127
 
143
128
  case undefined:
package/src/endpoint.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { getAttribute, string_attribute, url_attribute } from "pacc";
2
2
  import { FAMILY_IPV6 } from "ip-utilties";
3
3
  import { addType } from "pmcf";
4
- import { endpointAttributes, CoreService } from "./core-service.mjs";
5
- import { family_attribute } from "./common-attributes.mjs";
4
+ import { CoreService } from "./core-service.mjs";
5
+ import { family_attribute, endpointAttributes } from "./common-attributes.mjs";
6
6
 
7
7
  export const FAMILY_UNIX = "unix";
8
8
  export const FAMILY_DNS = "dns";
@@ -240,8 +240,7 @@ export class HTTPEndpoint extends BaseEndpoint {
240
240
  }
241
241
  }
242
242
 
243
- export class UnixEndpoint extends BaseEndpoint {
244
- static name = "unix_endpoint";
243
+ export class unix_endpoint extends BaseEndpoint {
245
244
  static attributes = {
246
245
  url: url_attribute
247
246
  };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  default_attribute,
3
3
  string_attribute,
4
- name_attribute,
5
4
  type_attribute,
6
5
  getAttribute
7
6
  } from "pacc";
@@ -9,7 +8,7 @@ import { familyIP, formatCIDR, decodeIP, addressType } from "ip-utilties";
9
8
  import { Subnet } from "./subnet.mjs";
10
9
  import { Owner, addType } from "pmcf";
11
10
  import { NetworkInterface } from "./network-interfaces/network-interface.mjs";
12
- import { family_attribute } from "./common-attributes.mjs";
11
+ import { family_attribute, subnet_attribute } from "./common-attributes.mjs";
13
12
 
14
13
  /**
15
14
  *
@@ -19,7 +18,7 @@ export class NetworkAddress {
19
18
  static priority = 1;
20
19
  static key = "address";
21
20
  static attributes = {
22
- address: { ...name_attribute, name: "address" },
21
+ address: { ...string_attribute, name: "address" },
23
22
  type: type_attribute,
24
23
  cidrAddress: { ...string_attribute, name: "cidrAddress" },
25
24
  networkInterface: {
@@ -27,7 +26,8 @@ export class NetworkAddress {
27
26
  name: "networkInterface",
28
27
  type: "network_interface"
29
28
  },
30
- family: family_attribute
29
+ family: family_attribute,
30
+ subnet: subnet_attribute
31
31
  };
32
32
 
33
33
  static {
@@ -369,11 +369,7 @@ class bind_group extends Base {
369
369
  const address = na.address;
370
370
  const host = na.host;
371
371
 
372
- if (host === undefined) {
373
- console.log("NO HOST", na);
374
- }
375
-
376
- if (!addresses.has(address)) {
372
+ if (host && !addresses.has(address)) {
377
373
  addresses.add(address);
378
374
 
379
375
  const locationName = host.owner.name;
@@ -403,7 +399,7 @@ class bind_group extends Base {
403
399
  )
404
400
  );
405
401
 
406
- if (host && !hosts.has(host)) {
402
+ if (!hosts.has(host)) {
407
403
  hosts.add(host);
408
404
 
409
405
  for (let foreignDomain of host.foreignDomainNames) {