pmcf 1.29.0 → 1.30.1

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/README.md CHANGED
@@ -16,6 +16,10 @@
16
16
 
17
17
  # API
18
18
 
19
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
20
+
21
+ ## Table of Contents
22
+
19
23
  # install
20
24
 
21
25
  With [npm](http://npmjs.org) do:
@@ -6,7 +6,7 @@ import { Host } from "pmcf";
6
6
  import { writeLines, sectionLines } from "../src/utils.mjs";
7
7
  import { prepare } from "../src/cmd.mjs";
8
8
 
9
- const { root, args, options } = prepare();
9
+ const { root, args, options } = await prepare();
10
10
 
11
11
  const hostName = args[0];
12
12
 
package/bin/pmcf-info CHANGED
@@ -1,13 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { prepare } from "../src/cmd.mjs";
3
- const { root, args } = prepare();
4
-
5
- await root.loadAll();
3
+ const { root, args } = await prepare();
6
4
 
7
5
  const objectName = args[0];
8
6
 
9
7
  if (objectName) {
10
- const object = await root.named(objectName);
8
+ const object = root.named(objectName);
11
9
  console.log(object.toJSON());
12
10
  } else {
13
11
  for await (const location of root.locations()) {
@@ -6,9 +6,7 @@ import { Location } from "pmcf";
6
6
  import { writeLines, sectionLines } from "../src/utils.mjs";
7
7
  import { prepare } from "../src/cmd.mjs";
8
8
 
9
- const { root, args, options } = prepare();
10
-
11
- await root.loadAll();
9
+ const { root, args, options } = await prepare();
12
10
 
13
11
  const location = await root.load(args[0], { type: Location });
14
12
 
@@ -9,9 +9,7 @@ import {
9
9
  } from "../src/utils.mjs";
10
10
  import { prepare } from "../src/cmd.mjs";
11
11
 
12
- const { root, args, options } = prepare();
13
-
14
- await root.loadAll();
12
+ const { root, args, options } = await prepare();
15
13
 
16
14
  const owner = await root.load(args[0]);
17
15
  const updates = [
package/bin/pmcf-network CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { prepare } from "../src/cmd.mjs";
4
4
 
5
- const { root, args } = prepare();
5
+ const { root, args } = await prepare();
6
6
 
7
7
  const location = await root.load(args[0]);
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.29.0",
3
+ "version": "1.30.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -9,7 +9,7 @@ export class Base {
9
9
  static get typeName() {
10
10
  return "base";
11
11
  }
12
-
12
+
13
13
  static get pluralTypeName() {
14
14
  return this.typeName + "s";
15
15
  }
@@ -112,7 +112,7 @@ export class Base {
112
112
  return new Set([...object].map(e => this.expand(e)));
113
113
  }
114
114
 
115
- /*return Object.fromEntries(
115
+ /*return Object.fromEntries(
116
116
  Object.entries(object).map(([k, v]) => [k, this.expand(v)])
117
117
  );*/
118
118
  }
package/src/cmd.mjs CHANGED
@@ -2,14 +2,14 @@ import { parseArgs } from "node:util";
2
2
  import { argv, cwd, env } from "node:process";
3
3
  import { Root } from "./model.mjs";
4
4
 
5
- export function prepare() {
5
+ export async function prepare() {
6
6
  const { values, positionals } = parseArgs({
7
7
  args: argv.slice(2),
8
8
  options: {
9
9
  root: {
10
10
  type: "string",
11
- short: "w",
12
- default: env.PMCF_WORLD || cwd()
11
+ short: "r",
12
+ default: env.PMCF_ROOT || cwd()
13
13
  },
14
14
  output: {
15
15
  type: "string",
@@ -22,5 +22,7 @@ export function prepare() {
22
22
 
23
23
  const root = new Root(values.root);
24
24
 
25
+ await root.loadAll();
26
+
25
27
  return { root, options: values, args: positionals };
26
28
  }
package/src/model.mjs CHANGED
@@ -534,5 +534,5 @@ export class NetworkInterface extends Base {
534
534
  }
535
535
  }
536
536
 
537
- const _types = [Location, Network, Subnet, Host, Cluster, Service, DNSService];
537
+ const _types = [Location, Network, Subnet, Host, Cluster, Service, DNSService, NetworkInterface];
538
538
  const _typesByName = Object.fromEntries(_types.map(t => [t.typeName, t]));
package/types/cmd.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- export function prepare(): {
1
+ export function prepare(): Promise<{
2
2
  root: Root;
3
3
  options: {
4
4
  root: string;
5
5
  output: string;
6
6
  };
7
7
  args: string[];
8
- };
8
+ }>;
9
9
  import { Root } from "./model.mjs";
package/types/model.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export class Root extends Owner {
2
2
  static get types(): {
3
- [k: string]: typeof DNSService | typeof Subnet | typeof Cluster | typeof Service | typeof Host;
3
+ [k: string]: typeof DNSService | typeof Subnet | typeof Cluster | typeof Service | typeof Host | typeof NetworkInterface;
4
4
  };
5
5
  constructor(directory: any);
6
6
  get fullName(): string;