@fedify/relay 2.0.28 → 2.0.29-dev.2018

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.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-DqmOP4vo.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-tTFf8RCI.js";
5
5
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { Accept, Announce, Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-DqmOP4vo.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-tTFf8RCI.js";
5
5
  import { MemoryKvStore, signRequest } from "@fedify/fedify";
6
6
  import { createRelay } from "@fedify/relay";
7
7
  import { Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { createRequire } from "node:module";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import process$1 from "node:process";
7
- import { lookup } from "node:dns/promises";
7
+ import dns from "node:dns/promises";
8
8
  import { isIP } from "node:net";
9
9
  //#region \0rolldown/runtime.js
10
10
  var __create = Object.create;
@@ -25647,7 +25647,7 @@ const preloadedContexts = {
25647
25647
  "https://purl.archive.org/miscellany": miscellany_default
25648
25648
  };
25649
25649
  var name = "@fedify/vocab-runtime";
25650
- var version = "2.0.28";
25650
+ var version = "2.0.29-dev.2018+2e67253f";
25651
25651
  /**
25652
25652
  * Error thrown when fetching a JSON-LD document failed.
25653
25653
  */
@@ -25962,9 +25962,16 @@ var HttpHeaderLink = class HttpHeaderLink {
25962
25962
  }
25963
25963
  };
25964
25964
  var UrlError = class extends Error {
25965
+ /**
25966
+ * The failure category. Defaults to `"disallowed"`.
25967
+ * `"dns"` includes lookup errors and results with no usable IP addresses.
25968
+ * @since 2.0.29
25969
+ */
25970
+ reason;
25965
25971
  constructor(message, options) {
25966
25972
  super(message, options);
25967
25973
  this.name = "UrlError";
25974
+ this.reason = options?.reason ?? "disallowed";
25968
25975
  }
25969
25976
  };
25970
25977
  /**
@@ -25990,9 +25997,12 @@ async function validatePublicUrl(url) {
25990
25997
  }
25991
25998
  let addresses;
25992
25999
  try {
25993
- addresses = await lookup(hostname, { all: true });
26000
+ addresses = await dns.lookup(hostname, { all: true });
25994
26001
  } catch (error) {
25995
- throw new UrlError("DNS lookup failed", { cause: error });
26002
+ throw new UrlError("DNS lookup failed", {
26003
+ cause: error,
26004
+ reason: "dns"
26005
+ });
25996
26006
  }
25997
26007
  validateLookupAddresses(addresses);
25998
26008
  }
@@ -26021,7 +26031,7 @@ function validateLookupAddresses(addresses) {
26021
26031
  ipAddressCount++;
26022
26032
  validatePublicIpAddress(address, family);
26023
26033
  }
26024
- if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address");
26034
+ if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address", { reason: "dns" });
26025
26035
  }
26026
26036
  function validatePublicIpAddress(address, family) {
26027
26037
  if (family === 4 && isValidPublicIPv4Address(address) || family === 6 && isValidPublicIPv6Address(address)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/relay",
3
- "version": "2.0.28",
3
+ "version": "2.0.29-dev.2018+2e67253f",
4
4
  "description": "ActivityPub relay support for Fedify",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -50,14 +50,14 @@
50
50
  "dependencies": {
51
51
  "@js-temporal/polyfill": "^0.5.1",
52
52
  "@logtape/logtape": "^2.0.0",
53
- "@fedify/vocab": "2.0.28",
54
- "@fedify/fedify": "^2.0.28"
53
+ "@fedify/vocab": "2.0.29-dev.2018+2e67253f",
54
+ "@fedify/fedify": "^2.0.29-dev.2018+2e67253f"
55
55
  },
56
56
  "devDependencies": {
57
57
  "tsdown": "^0.21.6",
58
58
  "typescript": "^6.0.0",
59
59
  "urlpattern-polyfill": "^10.1.0",
60
- "@fedify/vocab-runtime": "^2.0.28"
60
+ "@fedify/vocab-runtime": "^2.0.29-dev.2018+2e67253f"
61
61
  },
62
62
  "scripts": {
63
63
  "build:self": "tsdown",