pmcf 6.2.0 → 6.2.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.2.0",
3
+ "version": "6.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,9 +52,9 @@
52
52
  "dependencies": {
53
53
  "aggregated-map": "^1.0.7",
54
54
  "content-entry-transform": "^1.6.9",
55
- "ip-utilties": "^3.5.1",
55
+ "ip-utilties": "^3.4.0",
56
56
  "npm-pkgbuild": "^20.7.12",
57
- "pacc": "^10.4.0",
57
+ "pacc": "^10.4.1",
58
58
  "package-directory": "^8.2.0"
59
59
  },
60
60
  "devDependencies": {
package/src/base.mjs CHANGED
@@ -287,12 +287,8 @@ export class Base {
287
287
  return Object.fromEntries(this.attributeIterator(filter));
288
288
  }
289
289
 
290
- valueFor(name, at) {
291
- if (at !== undefined) {
292
- return this.attribute(name) ?? this.property(name);
293
- }
294
-
295
- return globals[name];
290
+ value(name) {
291
+ return this.attribute(name) ?? this.property(name);
296
292
  }
297
293
 
298
294
  /**
@@ -374,7 +370,8 @@ export class Base {
374
370
  expression(expression, options) {
375
371
  return parse(expression, {
376
372
  root: this,
377
- valueFor: (name, at) => this.valueFor(name, at),
373
+ valueFor: (name, at) =>
374
+ at === undefined ? globals[name] : at.value(name),
378
375
  ...options
379
376
  });
380
377
  }
@@ -445,7 +442,8 @@ export class Base {
445
442
  expression =>
446
443
  parse(expression, {
447
444
  root: this,
448
- valueFor: (name, at) => this.valueFor(name, at)
445
+ valueFor: (name, at) =>
446
+ at === undefined ? globals[name] : at.value(name)
449
447
  })
450
448
  )
451
449
  ];
@@ -512,7 +510,8 @@ export class Base {
512
510
  return expand(object, {
513
511
  stopClass: Base,
514
512
  root: this,
515
- valueFor: (name, at) => this.valueFor(name, at)
513
+ valueFor: (name, at) =>
514
+ at === undefined ? globals[name] : this.value(name)
516
515
  });
517
516
  }
518
517
 
@@ -17,7 +17,8 @@ import {
17
17
  HTTPEndpoint,
18
18
  UnixEndpoint,
19
19
  addType,
20
- FAMILY_UNIX
20
+ FAMILY_UNIX,
21
+ FAMILY_DNS
21
22
  } from "pmcf";
22
23
  import { asArray } from "./utils.mjs";
23
24
  import { networkAddressAttributes } from "./common-attributes.mjs";
@@ -141,7 +142,7 @@ export class CoreService extends Base {
141
142
  break;
142
143
 
143
144
  case undefined:
144
- case "dns":
145
+ case FAMILY_DNS:
145
146
  case FAMILY_IPV4:
146
147
  case FAMILY_IPV6:
147
148
  const options =
package/src/endpoint.mjs CHANGED
@@ -3,6 +3,7 @@ import { addType } from "pmcf";
3
3
  import { endpointAttributes, CoreService } from "./core-service.mjs";
4
4
 
5
5
  export const FAMILY_UNIX = "unix";
6
+ export const FAMILY_DNS = "dns";
6
7
 
7
8
  class BaseEndpoint {
8
9
  static name = "endpoint";
@@ -114,7 +115,7 @@ export class DomainNameEndpoint extends PortEndpoint {
114
115
  }
115
116
 
116
117
  get family() {
117
- return "dns"; // TODO
118
+ return FAMILY_DNS;
118
119
  }
119
120
 
120
121
  get address() {
@@ -23,7 +23,8 @@ import {
23
23
  serviceEndpoints,
24
24
  addresses,
25
25
  networkAddressType,
26
- addType
26
+ addType,
27
+ FAMILY_DNS
27
28
  } from "pmcf";
28
29
  import { yesno, writeLines, asArray } from "../utils.mjs";
29
30
  import {
@@ -501,8 +502,8 @@ export class bind extends ExtraSourceService {
501
502
 
502
503
  async writeForwarders(outputControl) {
503
504
  const forwarders = serviceEndpoints(this.source, {
504
- services: 'services[types[dns] && priority>=100 && priority<200]',
505
- endpoints: endpoint => endpoint.family !== "dns",
505
+ services: "services[types[dns] && priority>=100 && priority<200]",
506
+ endpoints: endpoint => endpoint.family !== FAMILY_DNS,
506
507
  select: e => e.address,
507
508
  limit: 5
508
509
  });
@@ -8,8 +8,7 @@ export class openldap extends CoreService {
8
8
  };
9
9
  static service = {
10
10
  systemdService: "slapd.service",
11
- extends: ["ldap", "ldapi"],
12
- services: {}
11
+ extends: ["ldap", "ldapi"]
13
12
  };
14
13
 
15
14
  static {
@@ -3,8 +3,7 @@ import { CoreService, addType } from "pmcf";
3
3
  export class postfix extends CoreService {
4
4
  static service = {
5
5
  systemdService: "postfix.service",
6
- extends: ["smtp", "lmtp", "submission"],
7
- services: {}
6
+ extends: ["smtp", "lmtp", "submission"]
8
7
  };
9
8
 
10
9
  static {
package/src/subnet.mjs CHANGED
@@ -7,7 +7,12 @@ import {
7
7
  matchPrefixIP,
8
8
  FAMILY_IPV6
9
9
  } from "ip-utilties";
10
- import { string_attribute, name_attribute, integer_attribute } from "pacc";
10
+ import {
11
+ string_attribute,
12
+ name_attribute,
13
+ integer_attribute,
14
+ getAttribute
15
+ } from "pacc";
11
16
  import { networks_attribute } from "./common-attributes.mjs";
12
17
  import { addType, Network } from "pmcf";
13
18
 
@@ -46,14 +51,21 @@ export class Subnet {
46
51
 
47
52
  set owner(value) {
48
53
  this._owner = value;
49
- if(value instanceof Network) {
54
+ if (value instanceof Network) {
50
55
  this.networks.add(value);
51
56
  }
52
57
  }
53
58
 
54
- *_walkDirections(directions, seen) {
59
+ value(name) {
60
+ const value = getAttribute(this, name);
61
+
62
+ console.log("SUBNET VALUE", name, value);
63
+
64
+ return value;
55
65
  }
56
66
 
67
+ *_walkDirections(directions, seen) {}
68
+
57
69
  get cidr() {
58
70
  return this.address;
59
71
  }