pmcf 6.48.3 → 6.49.0

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.48.3",
3
+ "version": "6.49.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -0,0 +1,65 @@
1
+ import { AggregatedMap } from "aggregated-map";
2
+ import { addType, asArray } from "pacc";
3
+ import { host } from "pmcf";
4
+ import { ServiceOwner } from "../service-owner.mjs";
5
+
6
+ /**
7
+ *
8
+ */
9
+ export class Interface extends ServiceOwner {
10
+ static get typeName() {
11
+ return "interface";
12
+ }
13
+
14
+ static commonNamePattern = new RegExp(`^${this.name}\d+$`);
15
+
16
+ static isCommonName(name) {
17
+ return this.commonNamePattern.test(name);
18
+ }
19
+
20
+ static {
21
+ addType(this);
22
+ }
23
+
24
+ get typeName() {
25
+ const type = this.constructor;
26
+ return type.specializationOf?.name || type.name;
27
+ }
28
+
29
+ get kind() {
30
+ return this.constructor.name;
31
+ }
32
+
33
+ get host() {
34
+ if (this.owner instanceof host) {
35
+ return this.owner;
36
+ }
37
+ }
38
+
39
+ get hosts() {
40
+ return asArray(this.host);
41
+ }
42
+
43
+ get domainName() {
44
+ return this.host?.domainName;
45
+ }
46
+
47
+ get domainNames() {
48
+ return new Set();
49
+ }
50
+
51
+ get services() {
52
+ return this.owner
53
+ ? new AggregatedMap([super.services, this.owner._services])
54
+ : super.services;
55
+ }
56
+
57
+ matches(other) {
58
+ if (this.isTemplate) {
59
+ const name = this.name.replaceAll("*", "");
60
+ return name.length === 0 || other.name.indexOf(name) >= 0;
61
+ }
62
+
63
+ return false;
64
+ }
65
+ }
@@ -1,6 +1,6 @@
1
1
  import { addType } from "pacc";
2
2
  import { SUBNET_LOCALHOST_IPV4, SUBNET_LOCALHOST_IPV6 } from "pmcf";
3
- import { SkeletonNetworkInterface } from "./skeleton.mjs";
3
+ import { SkeletonNetworkInterface } from "./skeleton-network-interface.mjs";
4
4
  import { NetworkInterface } from "./network-interface.mjs";
5
5
 
6
6
  const _localAddresses = new Map([
@@ -0,0 +1,11 @@
1
+ import { addType } from "pacc";
2
+ import { Interface } from "./interface.mjs";
3
+
4
+ export class modbus extends Interface {
5
+ static commonNamePattern = /^modbus\d*$/;
6
+
7
+ static {
8
+ addType(this);
9
+ }
10
+
11
+ }
@@ -12,7 +12,7 @@ import {
12
12
  cluster_attribute
13
13
  } from "../common-attributes.mjs";
14
14
  import { writeLines, sectionLines } from "../utils.mjs";
15
- import { SkeletonNetworkInterface } from "./skeleton.mjs";
15
+ import { SkeletonNetworkInterface } from "./skeleton-network-interface.mjs";
16
16
  import { yesno } from "../utils.mjs";
17
17
 
18
18
  export class NetworkInterface extends SkeletonNetworkInterface {
@@ -1,72 +1,23 @@
1
1
  import { join } from "node:path";
2
- import { AggregatedMap } from "aggregated-map";
3
- import { addType, asArray } from "pacc";
2
+ import { addType } from "pacc";
4
3
  import { writeLines, sectionLines } from "../utils.mjs";
5
- import { NetworkAddress, host, cidrAddresses } from "pmcf";
6
- import { ServiceOwner } from "../service-owner.mjs";
4
+ import { NetworkAddress, cidrAddresses } from "pmcf";
5
+ import { Interface } from "./interface.mjs";
7
6
 
8
7
  /**
9
8
  *
10
9
  */
11
- export class SkeletonNetworkInterface extends ServiceOwner {
10
+ export class SkeletonNetworkInterface extends Interface {
12
11
  static get typeName() {
13
12
  return "network_interface";
14
13
  }
15
14
 
16
- static commonNamePattern = new RegExp(`^${this.name}\d+$`);
17
-
18
- static isCommonName(name) {
19
- return this.commonNamePattern.test(name);
20
- }
21
-
22
15
  static {
23
16
  addType(this);
24
17
  }
25
18
 
26
19
  _network;
27
20
 
28
- get typeName() {
29
- const type = this.constructor;
30
- return type.specializationOf?.name || type.name;
31
- }
32
-
33
- get kind() {
34
- return this.constructor.name;
35
- }
36
-
37
- get host() {
38
- if (this.owner instanceof host) {
39
- return this.owner;
40
- }
41
- }
42
-
43
- get services() {
44
- return this.owner
45
- ? new AggregatedMap([super.services, this.owner._services])
46
- : super.services;
47
- }
48
-
49
- get hosts() {
50
- return asArray(this.host);
51
- }
52
-
53
- get domainName() {
54
- return this.host?.domainName;
55
- }
56
-
57
- get domainNames() {
58
- return new Set();
59
- }
60
-
61
- matches(other) {
62
- if (this.isTemplate) {
63
- const name = this.name.replaceAll("*", "");
64
- return name.length === 0 || other.name.indexOf(name) >= 0;
65
- }
66
-
67
- return false;
68
- }
69
-
70
21
  get network() {
71
22
  return this.attribute("_network") ?? this.host?.network;
72
23
  }
@@ -1,5 +1,5 @@
1
1
  import { addType } from "pacc";
2
- import { SkeletonNetworkInterface } from "./skeleton.mjs";
2
+ import { SkeletonNetworkInterface } from "./skeleton-network-interface.mjs";
3
3
  import { NetworkInterface } from "./network-interface.mjs";
4
4
 
5
5
  export class wireguard extends SkeletonNetworkInterface {
package/src/module.mjs CHANGED
@@ -13,12 +13,13 @@ export * from "./network-address.mjs";
13
13
  export * from "./common-attributes.mjs";
14
14
  export * from "./content.mjs";
15
15
  export * from "./host.mjs";
16
- export * from "./network-interfaces/network-interface.mjs";
17
- export * from "./network-interfaces/loopback.mjs";
18
- export * from "./network-interfaces/ethernet.mjs";
19
- export * from "./network-interfaces/wlan.mjs";
20
- export * from "./network-interfaces/wireguard.mjs";
21
- export * from "./network-interfaces/tun.mjs";
16
+ export * from "./interfaces/network-interface.mjs";
17
+ export * from "./interfaces/loopback.mjs";
18
+ export * from "./interfaces/ethernet.mjs";
19
+ export * from "./interfaces/wlan.mjs";
20
+ export * from "./interfaces/wireguard.mjs";
21
+ export * from "./interfaces/tun.mjs";
22
+ export * from "./interfaces/modbus.mjs";
22
23
  export * from "./service-types.mjs";
23
24
  export * from "./core-service.mjs";
24
25
  export * from "./service.mjs";
@@ -1,15 +1,14 @@
1
- import {
2
- default_attribute,
3
- string_attribute,
4
- type_attribute,
5
- getAttribute,
6
- asArray
7
- } from "pacc";
1
+ import { default_attribute, type_attribute, getAttribute, asArray } from "pacc";
8
2
  import { familyIP, formatCIDR, decodeIP, addressType } from "ip-utilties";
9
3
  import { Subnet } from "./subnet.mjs";
10
4
  import { Owner, addType } from "pmcf";
11
- import { NetworkInterface } from "./network-interfaces/network-interface.mjs";
12
- import { family_attribute, subnet_attribute, address_attribute, cidr_address_attribute } from "./common-attributes.mjs";
5
+ import { NetworkInterface } from "./interfaces/network-interface.mjs";
6
+ import {
7
+ family_attribute,
8
+ subnet_attribute,
9
+ address_attribute,
10
+ cidr_address_attribute
11
+ } from "./common-attributes.mjs";
13
12
  /**
14
13
  *
15
14
  */
File without changes
File without changes