pmcf 1.48.0 → 1.48.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.
@@ -15,7 +15,10 @@ const host = await root.load(hostName, { type: types.host });
15
15
  await generateNetworkDefs(host, options.output);
16
16
  await generateMachineInfo(host, options.output);
17
17
  await copySshKeys(host, options.output);
18
- await generateKnownHosts(host.owner.hosts(), join(options.output, "root", ".ssh"));
18
+ await generateKnownHosts(
19
+ host.owner.hosts(),
20
+ join(options.output, "root", ".ssh")
21
+ );
19
22
 
20
23
  console.log("provides", "host", ...host.provides);
21
24
  console.log("depends", `location-${host.location.name}`, ...host.depends);
@@ -165,6 +168,7 @@ async function generateKnownHosts(hosts, dir) {
165
168
  for await (const host of hosts) {
166
169
  try {
167
170
  const [alg, key, desc] = (await host.publicKey("ed25519")).split(/\s+/);
171
+
168
172
  keys.push(`${host.domainName} ${alg} ${key}`);
169
173
 
170
174
  for await (const addr of host.networkAddresses()) {
@@ -32,7 +32,7 @@ async function generateNamedDefs(owner, targetDir) {
32
32
  const zones = [];
33
33
  const records = new Set();
34
34
 
35
- const nameserver = (await owner.service({ type: "dns" }))?.owner;
35
+ const nameserver = (await owner.findService({ type: "dns" }))?.owner;
36
36
  const rname = dns.administratorEmail.replace(/@/, ".");
37
37
 
38
38
  let maxKeyLength;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.48.0",
3
+ "version": "1.48.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/host.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
1
3
  import { Base } from "./base.mjs";
2
4
  import { networkProperties } from "./network-support.mjs";
3
5
  import {
package/src/utils.mjs CHANGED
@@ -3,9 +3,10 @@ import { join } from "node:path";
3
3
 
4
4
  export async function writeLines(dir, name, lines) {
5
5
  await mkdir(dir, { recursive: true });
6
+ if (typeof lines === "string") lines = [lines];
6
7
  return writeFile(
7
8
  join(dir, name),
8
- [...asArray(lines)]
9
+ [...lines]
9
10
  .flat()
10
11
  .filter(line => line !== undefined)
11
12
  .map(l => l + "\n")
@@ -130,9 +131,8 @@ export function encodeIP(address) {
130
131
  return _encode(isIPv4Address(address) ? ipv4 : ipv6, address);
131
132
  }
132
133
 
133
- export function formatCIDR(address,subnet)
134
- {
135
- return subnet ? `${address}/${subnet.prefixLength}`: address;
134
+ export function formatCIDR(address, subnet) {
135
+ return subnet ? `${address}/${subnet.prefixLength}` : address;
136
136
  }
137
137
 
138
138
  export function normalizeCIDR(address) {
@@ -164,8 +164,7 @@ export function normalizeCIDR(address) {
164
164
  return { prefix, prefixLength, cidr: `${prefix}/${prefixLength}` };
165
165
  }
166
166
 
167
- export function hasWellKnownSubnet(address)
168
- {
167
+ export function hasWellKnownSubnet(address) {
169
168
  const n = encodeIP(address);
170
169
  return n === IPV4_LOCALHOST || n === IPV6_LOCALHOST || isLinkLocal(address);
171
170
  }
package/types/host.d.mts CHANGED
@@ -181,7 +181,7 @@ export class Host extends Base {
181
181
  get rawAddress(): any;
182
182
  get rawAddresses(): any[];
183
183
  get cidrAddresses(): any[];
184
- publicKey(type?: string): Promise<any>;
184
+ publicKey(type?: string): Promise<string>;
185
185
  #private;
186
186
  }
187
187
  export class NetworkInterface extends Base {