@fedify/vocab-runtime 2.4.0-dev.2219 → 2.4.0-dev.2228

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.
Files changed (44) hide show
  1. package/deno.json +1 -1
  2. package/dist/internal/jsonld-cache.cjs +1 -1
  3. package/dist/internal/jsonld-cache.js +1 -1
  4. package/dist/internal/portable-dereference.cjs +2 -2
  5. package/dist/internal/portable-dereference.js +2 -2
  6. package/dist/mod.cjs +2 -2
  7. package/dist/mod.d.cts +2 -0
  8. package/dist/mod.d.ts +2 -0
  9. package/dist/mod.js +2 -2
  10. package/dist/tests/{body-GaHFfkaq.cjs → body-BQZL1aJ1.cjs} +1 -1
  11. package/dist/tests/{body-BzhhuMI0.mjs → body-BmNV5g5S.mjs} +1 -1
  12. package/dist/tests/body.test.cjs +1 -1
  13. package/dist/tests/body.test.mjs +1 -1
  14. package/dist/tests/decimal.test.cjs +3 -3
  15. package/dist/tests/decimal.test.mjs +3 -3
  16. package/dist/tests/{docloader-sGr7kARm.cjs → docloader-BnuGCXLg.cjs} +3 -3
  17. package/dist/tests/{docloader-DiRcdiPp.mjs → docloader-ButlYQxr.mjs} +3 -3
  18. package/dist/tests/docloader.test.cjs +3 -3
  19. package/dist/tests/docloader.test.mjs +3 -3
  20. package/dist/tests/internal/portable-dereference.test.cjs +4 -4
  21. package/dist/tests/internal/portable-dereference.test.mjs +4 -4
  22. package/dist/tests/{jsonld-cache-DUmuWRwp.mjs → jsonld-cache-C7mkqjiE.mjs} +1 -1
  23. package/dist/tests/{jsonld-cache-BQMn_ILF.cjs → jsonld-cache-CXA76Xi6.cjs} +1 -1
  24. package/dist/tests/jsonld-cache.test.cjs +2 -2
  25. package/dist/tests/jsonld-cache.test.mjs +2 -2
  26. package/dist/tests/{portable-media-C_Q9GmqU.cjs → portable-media-CFrGpz-3.cjs} +3 -3
  27. package/dist/tests/{portable-media-BERS_tX_.mjs → portable-media-xFDDMte7.mjs} +3 -3
  28. package/dist/tests/portable-media.test.cjs +1 -1
  29. package/dist/tests/portable-media.test.mjs +1 -1
  30. package/dist/tests/{request-CWTG9_Xx.mjs → request-2GDEEJng.mjs} +1 -1
  31. package/dist/tests/{request-qq1N2cl6.cjs → request-Cme6ShRu.cjs} +1 -1
  32. package/dist/tests/request.test.cjs +1 -1
  33. package/dist/tests/request.test.mjs +1 -1
  34. package/dist/tests/{url-B8xyTwP-.cjs → url-B6WlNhra.cjs} +4 -2
  35. package/dist/tests/{url-DfS-cvwr.mjs → url-R9TTZ67B.mjs} +4 -2
  36. package/dist/tests/url.test.cjs +15 -3
  37. package/dist/tests/url.test.mjs +15 -3
  38. package/dist/{url-Be3moMor.js → url-BfguNa6K.js} +4 -2
  39. package/dist/{url-DDVweCXr.cjs → url-CHAbe3hE.cjs} +4 -2
  40. package/package.json +1 -1
  41. package/src/internal/portable-dereference.test.ts +2 -0
  42. package/src/internal/portable-dereference.ts +2 -8
  43. package/src/url.test.ts +16 -1
  44. package/src/url.ts +4 -8
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.4.0-dev.2219+eb70f060",
3
+ "version": "2.4.0-dev.2228+6d017d55",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
@@ -1,6 +1,6 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_url = require("../url-DDVweCXr.cjs");
3
+ const require_url = require("../url-CHAbe3hE.cjs");
4
4
  const require_jsonld = require("../jsonld.cjs");
5
5
  //#region src/internal/jsonld-cache.ts
6
6
  const noJsonLdContext = Symbol("noJsonLdContext");
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "../url-Be3moMor.js";
2
+ import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "../url-BfguNa6K.js";
3
3
  import jsonld_default from "../jsonld.js";
4
4
  //#region src/internal/jsonld-cache.ts
5
5
  const noJsonLdContext = Symbol("noJsonLdContext");
@@ -1,7 +1,7 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_contexts = require("../contexts-BK1CqBR5.cjs");
4
- const require_url = require("../url-DDVweCXr.cjs");
4
+ const require_url = require("../url-CHAbe3hE.cjs");
5
5
  const require_jsonld = require("../jsonld.cjs");
6
6
  const require_internal_jsonld_cache = require("./jsonld-cache.cjs");
7
7
  let _logtape_logtape = require("@logtape/logtape");
@@ -384,7 +384,7 @@ function parseGatewayOrigin(gateway) {
384
384
  if (gateway instanceof URL) url = new URL(gateway.href);
385
385
  else if (typeof gateway === "string" && URL.canParse(gateway)) url = new URL(gateway);
386
386
  else return null;
387
- if (url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) return null;
387
+ if (!require_url.isGatewayUrl(url)) return null;
388
388
  return url;
389
389
  }
390
390
  /**
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { t as preloadedContexts } from "../contexts-DPuJ4UYL.js";
3
- import { a as formatIri, c as haveSameFe34Origin, g as toCompatibleEf61Id, m as parseIri, o as fromCompatibleEf61Id, r as canonicalizePortableUri } from "../url-Be3moMor.js";
3
+ import { a as formatIri, c as haveSameFe34Origin, g as toCompatibleEf61Id, m as parseIri, o as fromCompatibleEf61Id, r as canonicalizePortableUri, u as isGatewayUrl } from "../url-BfguNa6K.js";
4
4
  import jsonld_default from "../jsonld.js";
5
5
  import { createScopedContextLoader, registerDocumentLoaderWrapper, unwrapReleasedDocumentLoader } from "./jsonld-cache.js";
6
6
  import { getLogger } from "@logtape/logtape";
@@ -383,7 +383,7 @@ function parseGatewayOrigin(gateway) {
383
383
  if (gateway instanceof URL) url = new URL(gateway.href);
384
384
  else if (typeof gateway === "string" && URL.canParse(gateway)) url = new URL(gateway);
385
385
  else return null;
386
- if (url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) return null;
386
+ if (!isGatewayUrl(url)) return null;
387
387
  return url;
388
388
  }
389
389
  /**
package/dist/mod.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_rolldown_runtime = require("./rolldown-runtime-B7lfambq.cjs");
4
4
  const require_contexts = require("./contexts-BK1CqBR5.cjs");
5
- const require_url = require("./url-DDVweCXr.cjs");
5
+ const require_url = require("./url-CHAbe3hE.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
  let node_process = require("node:process");
@@ -16,7 +16,7 @@ let _multiformats_base_x = require("@multiformats/base-x");
16
16
  _multiformats_base_x = require_rolldown_runtime.__toESM(_multiformats_base_x, 1);
17
17
  //#region deno.json
18
18
  var name = "@fedify/vocab-runtime";
19
- var version = "2.4.0-dev.2219+eb70f060";
19
+ var version = "2.4.0-dev.2228+6d017d55";
20
20
  //#endregion
21
21
  //#region src/request.ts
22
22
  /**
package/dist/mod.d.cts CHANGED
@@ -524,6 +524,7 @@ declare function haveSameFe34Origin(left: string | URL, right: string | URL): bo
524
524
  declare function haveSameIriOrigin(left: URL, right: URL): boolean;
525
525
  /**
526
526
  * Checks whether the URL is an FEP-ef61 gateway base URI.
527
+ * @since 2.4.0
527
528
  */
528
529
  declare function isGatewayUrl(url: URL): boolean;
529
530
  /**
@@ -532,6 +533,7 @@ declare function isGatewayUrl(url: URL): boolean;
532
533
  * with no credentials, path, query, or fragment. In the
533
534
  * latter case, the message starts with
534
535
  * `Invalid FEP-ef61 gateway:`.
536
+ * @since 2.4.0
535
537
  */
536
538
  declare function parseGatewayUrl(url: string): URL;
537
539
  /**
package/dist/mod.d.ts CHANGED
@@ -523,6 +523,7 @@ declare function haveSameFe34Origin(left: string | URL, right: string | URL): bo
523
523
  declare function haveSameIriOrigin(left: URL, right: URL): boolean;
524
524
  /**
525
525
  * Checks whether the URL is an FEP-ef61 gateway base URI.
526
+ * @since 2.4.0
526
527
  */
527
528
  declare function isGatewayUrl(url: URL): boolean;
528
529
  /**
@@ -531,6 +532,7 @@ declare function isGatewayUrl(url: URL): boolean;
531
532
  * with no credentials, path, query, or fragment. In the
532
533
  * latter case, the message starts with
533
534
  * `Invalid FEP-ef61 gateway:`.
535
+ * @since 2.4.0
534
536
  */
535
537
  declare function parseGatewayUrl(url: string): URL;
536
538
  /**
package/dist/mod.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { t as preloadedContexts } from "./contexts-DPuJ4UYL.js";
3
- import { _ as validatePublicUrl, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl } from "./url-Be3moMor.js";
3
+ import { _ as validatePublicUrl, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl } from "./url-BfguNa6K.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
6
6
  import process from "node:process";
@@ -12,7 +12,7 @@ import { PublicKeyInfo } from "pkijs";
12
12
  import baseX from "@multiformats/base-x";
13
13
  //#region deno.json
14
14
  var name = "@fedify/vocab-runtime";
15
- var version = "2.4.0-dev.2219+eb70f060";
15
+ var version = "2.4.0-dev.2228+6d017d55";
16
16
  //#endregion
17
17
  //#region src/request.ts
18
18
  /**
@@ -1,4 +1,4 @@
1
- const require_request = require("./request-qq1N2cl6.cjs");
1
+ const require_request = require("./request-Cme6ShRu.cjs");
2
2
  let _logtape_logtape = require("@logtape/logtape");
3
3
  //#region src/body.ts
4
4
  /** Decoded JSON body limit: 16 MiB. @internal */
@@ -1,4 +1,4 @@
1
- import { t as FetchError } from "./request-CWTG9_Xx.mjs";
1
+ import { t as FetchError } from "./request-2GDEEJng.mjs";
2
2
  import { getLogger } from "@logtape/logtape";
3
3
  //#region src/body.ts
4
4
  /** Decoded JSON body limit: 16 MiB. @internal */
@@ -1,4 +1,4 @@
1
- const require_body = require("./body-GaHFfkaq.cjs");
1
+ const require_body = require("./body-BQZL1aJ1.cjs");
2
2
  let node_assert_strict = require("node:assert/strict");
3
3
  let node_test = require("node:test");
4
4
  let node_zlib = require("node:zlib");
@@ -1,4 +1,4 @@
1
- import { i as readBoundedText, t as BodyTooLargeError } from "./body-BzhhuMI0.mjs";
1
+ import { i as readBoundedText, t as BodyTooLargeError } from "./body-BmNV5g5S.mjs";
2
2
  import { deepStrictEqual, ok, rejects } from "node:assert/strict";
3
3
  import { test } from "node:test";
4
4
  import { gunzipSync, gzipSync } from "node:zlib";
@@ -1,10 +1,10 @@
1
- require("./url-B8xyTwP-.cjs");
2
- require("./docloader-sGr7kARm.cjs");
1
+ require("./url-B6WlNhra.cjs");
2
+ require("./docloader-BnuGCXLg.cjs");
3
3
  require("./key-C-AYkdJJ.cjs");
4
4
  require("./multibase-B5Mea7Ip.cjs");
5
5
  require("./digest-3FeH2Y-Q.cjs");
6
6
  require("./langstr-C4Fl80ae.cjs");
7
- require("./portable-media-C_Q9GmqU.cjs");
7
+ require("./portable-media-CFrGpz-3.cjs");
8
8
  let node_test = require("node:test");
9
9
  let node_assert = require("node:assert");
10
10
  //#region src/decimal.ts
@@ -1,10 +1,10 @@
1
- import "./url-DfS-cvwr.mjs";
2
- import "./docloader-DiRcdiPp.mjs";
1
+ import "./url-R9TTZ67B.mjs";
2
+ import "./docloader-ButlYQxr.mjs";
3
3
  import "./key-C2Db_TAJ.mjs";
4
4
  import "./multibase-BPnF_L4e.mjs";
5
5
  import "./digest-COC7xDiQ.mjs";
6
6
  import "./langstr-CQ26J_L7.mjs";
7
- import "./portable-media-BERS_tX_.mjs";
7
+ import "./portable-media-xFDDMte7.mjs";
8
8
  import { test } from "node:test";
9
9
  import { deepStrictEqual, throws } from "node:assert";
10
10
  //#region src/decimal.ts
@@ -1,8 +1,8 @@
1
- const require_request = require("./request-qq1N2cl6.cjs");
2
- const require_body = require("./body-GaHFfkaq.cjs");
1
+ const require_request = require("./request-Cme6ShRu.cjs");
2
+ const require_body = require("./body-BQZL1aJ1.cjs");
3
3
  const require_contexts = require("./contexts-DizzBjz4.cjs");
4
4
  const require_link = require("./link-DlKm8bEr.cjs");
5
- const require_url = require("./url-B8xyTwP-.cjs");
5
+ const require_url = require("./url-B6WlNhra.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
  //#region src/docloader.ts
@@ -1,8 +1,8 @@
1
- import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-CWTG9_Xx.mjs";
2
- import { i as readBoundedText, n as MAX_BODY_SIZE, r as readBoundedBytes, t as BodyTooLargeError } from "./body-BzhhuMI0.mjs";
1
+ import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-2GDEEJng.mjs";
2
+ import { i as readBoundedText, n as MAX_BODY_SIZE, r as readBoundedBytes, t as BodyTooLargeError } from "./body-BmNV5g5S.mjs";
3
3
  import { t as preloadedContexts } from "./contexts-CIKsin4e.mjs";
4
4
  import { t as HttpHeaderLink } from "./link-Cevmc87v.mjs";
5
- import { t as UrlError, v as validatePublicUrl } from "./url-DfS-cvwr.mjs";
5
+ import { t as UrlError, v as validatePublicUrl } from "./url-R9TTZ67B.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  //#region src/docloader.ts
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
- const require_request = require("./request-qq1N2cl6.cjs");
2
+ const require_request = require("./request-Cme6ShRu.cjs");
3
3
  const require_contexts = require("./contexts-DizzBjz4.cjs");
4
- const require_url = require("./url-B8xyTwP-.cjs");
5
- const require_docloader = require("./docloader-sGr7kARm.cjs");
4
+ const require_url = require("./url-B6WlNhra.cjs");
5
+ const require_docloader = require("./docloader-BnuGCXLg.cjs");
6
6
  let node_test = require("node:test");
7
7
  let node_zlib = require("node:zlib");
8
8
  let _logtape_logtape = require("@logtape/logtape");
@@ -1,7 +1,7 @@
1
- import { t as FetchError } from "./request-CWTG9_Xx.mjs";
1
+ import { t as FetchError } from "./request-2GDEEJng.mjs";
2
2
  import { n as cid_v1_default, t as preloadedContexts } from "./contexts-CIKsin4e.mjs";
3
- import { t as UrlError } from "./url-DfS-cvwr.mjs";
4
- import { i as withDocumentLoaderTimeout, n as getRemoteDocument, r as resolveDocumentLoaderTimeout, t as getDocumentLoader } from "./docloader-DiRcdiPp.mjs";
3
+ import { t as UrlError } from "./url-R9TTZ67B.mjs";
4
+ import { i as withDocumentLoaderTimeout, n as getRemoteDocument, r as resolveDocumentLoaderTimeout, t as getDocumentLoader } from "./docloader-ButlYQxr.mjs";
5
5
  import { test } from "node:test";
6
6
  import { gzipSync } from "node:zlib";
7
7
  import { configure, reset } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  const require_contexts = require("../contexts-DizzBjz4.cjs");
2
- const require_url = require("../url-B8xyTwP-.cjs");
3
- const require_jsonld_cache = require("../jsonld-cache-BQMn_ILF.cjs");
2
+ const require_url = require("../url-B6WlNhra.cjs");
3
+ const require_jsonld_cache = require("../jsonld-cache-CXA76Xi6.cjs");
4
4
  let node_assert_strict = require("node:assert/strict");
5
5
  let node_test = require("node:test");
6
6
  let _logtape_logtape = require("@logtape/logtape");
@@ -80,7 +80,7 @@ function parseGatewayOrigin(gateway) {
80
80
  if (gateway instanceof URL) url = new URL(gateway.href);
81
81
  else if (typeof gateway === "string" && URL.canParse(gateway)) url = new URL(gateway);
82
82
  else return null;
83
- if (url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) return null;
83
+ if (!require_url.isGatewayUrl(url)) return null;
84
84
  return url;
85
85
  }
86
86
  /**
@@ -172,7 +172,7 @@ const hrefs = (urls) => urls.map((url) => url.href);
172
172
  ]) (0, node_assert_strict.throws)(() => getPortableGatewayCandidates(url, [gateway]), TypeError);
173
173
  });
174
174
  (0, node_test.test)("getPortableGatewayCandidates() reads @gateway hints", () => {
175
- (0, node_assert_strict.deepStrictEqual)(hrefs(getPortableGatewayCandidates(require_url.parseIri("ap://did:key:z6Mkabc/actor?page=1&@gateway=https%3A%2F%2Fa.example&gateways=https%3A%2F%2Flegacy.example&@gateway=not%20a%20URL&@gateway=https%3A%2F%2Fb.example%2Fpath&%40gateway=https%3A%2F%2Fb.example&@gateway=https%3A%2F%2Fa.example%2F"))), ["https://a.example/", "https://b.example/"]);
175
+ (0, node_assert_strict.deepStrictEqual)(hrefs(getPortableGatewayCandidates(require_url.parseIri("ap://did:key:z6Mkabc/actor?page=1&@gateway=https%3A%2F%2Fa.example&gateways=https%3A%2F%2Flegacy.example&@gateway=not%20a%20URL&@gateway=https%3A%2F%2Fb.example%2Fpath&@gateway=https%3A%2F%2Fquery.example%2F%3F&@gateway=https%3A%2F%2Ffragment.example%2F%23&%40gateway=https%3A%2F%2Fb.example&@gateway=https%3A%2F%2Fa.example%2F"))), ["https://a.example/", "https://b.example/"]);
176
176
  (0, node_assert_strict.deepStrictEqual)(getPortableGatewayCandidates(require_url.parseIri("ap://did:key:z6Mkabc/actor")), []);
177
177
  const hints = Array.from({ length: 7 }, (_, i) => `@gateway=https%3A%2F%2Fg${i}.example`);
178
178
  (0, node_assert_strict.deepStrictEqual)(hrefs(getPortableGatewayCandidates(require_url.parseIri(`ap://did:key:z6Mkabc/actor?${hints.join("&")}`))), [
@@ -1,6 +1,6 @@
1
1
  import { t as preloadedContexts } from "../contexts-CIKsin4e.mjs";
2
- import { a as formatIri, m as parseIri } from "../url-DfS-cvwr.mjs";
3
- import { n as createScopedContextLoader, o as registerDocumentLoaderWrapper, s as unwrapReleasedDocumentLoader } from "../jsonld-cache-DUmuWRwp.mjs";
2
+ import { a as formatIri, m as parseIri, u as isGatewayUrl } from "../url-R9TTZ67B.mjs";
3
+ import { n as createScopedContextLoader, o as registerDocumentLoaderWrapper, s as unwrapReleasedDocumentLoader } from "../jsonld-cache-C7mkqjiE.mjs";
4
4
  import { deepStrictEqual, ok, throws } from "node:assert/strict";
5
5
  import { test } from "node:test";
6
6
  import { getLogger } from "@logtape/logtape";
@@ -80,7 +80,7 @@ function parseGatewayOrigin(gateway) {
80
80
  if (gateway instanceof URL) url = new URL(gateway.href);
81
81
  else if (typeof gateway === "string" && URL.canParse(gateway)) url = new URL(gateway);
82
82
  else return null;
83
- if (url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) return null;
83
+ if (!isGatewayUrl(url)) return null;
84
84
  return url;
85
85
  }
86
86
  /**
@@ -172,7 +172,7 @@ test("getPortableGatewayCandidates() uses explicit gateways", () => {
172
172
  ]) throws(() => getPortableGatewayCandidates(url, [gateway]), TypeError);
173
173
  });
174
174
  test("getPortableGatewayCandidates() reads @gateway hints", () => {
175
- deepStrictEqual(hrefs(getPortableGatewayCandidates(parseIri("ap://did:key:z6Mkabc/actor?page=1&@gateway=https%3A%2F%2Fa.example&gateways=https%3A%2F%2Flegacy.example&@gateway=not%20a%20URL&@gateway=https%3A%2F%2Fb.example%2Fpath&%40gateway=https%3A%2F%2Fb.example&@gateway=https%3A%2F%2Fa.example%2F"))), ["https://a.example/", "https://b.example/"]);
175
+ deepStrictEqual(hrefs(getPortableGatewayCandidates(parseIri("ap://did:key:z6Mkabc/actor?page=1&@gateway=https%3A%2F%2Fa.example&gateways=https%3A%2F%2Flegacy.example&@gateway=not%20a%20URL&@gateway=https%3A%2F%2Fb.example%2Fpath&@gateway=https%3A%2F%2Fquery.example%2F%3F&@gateway=https%3A%2F%2Ffragment.example%2F%23&%40gateway=https%3A%2F%2Fb.example&@gateway=https%3A%2F%2Fa.example%2F"))), ["https://a.example/", "https://b.example/"]);
176
176
  deepStrictEqual(getPortableGatewayCandidates(parseIri("ap://did:key:z6Mkabc/actor")), []);
177
177
  const hints = Array.from({ length: 7 }, (_, i) => `@gateway=https%3A%2F%2Fg${i}.example`);
178
178
  deepStrictEqual(hrefs(getPortableGatewayCandidates(parseIri(`ap://did:key:z6Mkabc/actor?${hints.join("&")}`))), [
@@ -1,4 +1,4 @@
1
- import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "./url-DfS-cvwr.mjs";
1
+ import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "./url-R9TTZ67B.mjs";
2
2
  import jsonld from "jsonld/dist/jsonld.esm.js";
3
3
  //#region src/jsonld.ts
4
4
  var jsonld_default = jsonld;
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
- const require_url = require("./url-B8xyTwP-.cjs");
2
+ const require_url = require("./url-B6WlNhra.cjs");
3
3
  let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
4
4
  jsonld_dist_jsonld_esm_js = require_rolldown_runtime.__toESM(jsonld_dist_jsonld_esm_js, 1);
5
5
  //#region src/jsonld.ts
@@ -1,5 +1,5 @@
1
- const require_url = require("./url-B8xyTwP-.cjs");
2
- const require_jsonld_cache = require("./jsonld-cache-BQMn_ILF.cjs");
1
+ const require_url = require("./url-B6WlNhra.cjs");
2
+ const require_jsonld_cache = require("./jsonld-cache-CXA76Xi6.cjs");
3
3
  let node_test = require("node:test");
4
4
  let node_assert = require("node:assert");
5
5
  //#region src/jsonld-cache.test.ts
@@ -1,5 +1,5 @@
1
- import { m as parseIri } from "./url-DfS-cvwr.mjs";
2
- import { a as normalizeJsonLdIris, c as jsonld_default, i as isTrustedIriOrigin, r as getJsonLdContext, t as compactJsonLdCache } from "./jsonld-cache-DUmuWRwp.mjs";
1
+ import { m as parseIri } from "./url-R9TTZ67B.mjs";
2
+ import { a as normalizeJsonLdIris, c as jsonld_default, i as isTrustedIriOrigin, r as getJsonLdContext, t as compactJsonLdCache } from "./jsonld-cache-C7mkqjiE.mjs";
3
3
  import { test } from "node:test";
4
4
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
5
5
  //#region src/jsonld-cache.test.ts
@@ -1,6 +1,6 @@
1
- const require_request = require("./request-qq1N2cl6.cjs");
2
- const require_body = require("./body-GaHFfkaq.cjs");
3
- const require_url = require("./url-B8xyTwP-.cjs");
1
+ const require_request = require("./request-Cme6ShRu.cjs");
2
+ const require_body = require("./body-BQZL1aJ1.cjs");
3
+ const require_url = require("./url-B6WlNhra.cjs");
4
4
  const require_digest = require("./digest-3FeH2Y-Q.cjs");
5
5
  //#region src/portable-media.ts
6
6
  function resolveTimeout(value, fallback) {
@@ -1,6 +1,6 @@
1
- import { r as getUserAgent } from "./request-CWTG9_Xx.mjs";
2
- import { r as readBoundedBytes } from "./body-BzhhuMI0.mjs";
3
- import { p as parseGatewayUrl, v as validatePublicUrl } from "./url-DfS-cvwr.mjs";
1
+ import { r as getUserAgent } from "./request-2GDEEJng.mjs";
2
+ import { r as readBoundedBytes } from "./body-BmNV5g5S.mjs";
3
+ import { p as parseGatewayUrl, v as validatePublicUrl } from "./url-R9TTZ67B.mjs";
4
4
  import { a as verifyDigestMultibase, i as parseHashlink, r as parseDigestMultibase } from "./digest-COC7xDiQ.mjs";
5
5
  //#region src/portable-media.ts
6
6
  function resolveTimeout(value, fallback) {
@@ -1,5 +1,5 @@
1
1
  const require_digest = require("./digest-3FeH2Y-Q.cjs");
2
- const require_portable_media = require("./portable-media-C_Q9GmqU.cjs");
2
+ const require_portable_media = require("./portable-media-CFrGpz-3.cjs");
3
3
  let node_assert_strict = require("node:assert/strict");
4
4
  let node_test = require("node:test");
5
5
  let node_http = require("node:http");
@@ -1,5 +1,5 @@
1
1
  import { n as createHashlink, t as computeDigestMultibase } from "./digest-COC7xDiQ.mjs";
2
- import { t as fetchPortableMedia } from "./portable-media-BERS_tX_.mjs";
2
+ import { t as fetchPortableMedia } from "./portable-media-xFDDMte7.mjs";
3
3
  import { deepStrictEqual, equal, rejects } from "node:assert/strict";
4
4
  import { test } from "node:test";
5
5
  import { createServer } from "node:http";
@@ -1,7 +1,7 @@
1
1
  import process from "node:process";
2
2
  //#region deno.json
3
3
  var name = "@fedify/vocab-runtime";
4
- var version = "2.4.0-dev.2219+eb70f060";
4
+ var version = "2.4.0-dev.2228+6d017d55";
5
5
  //#endregion
6
6
  //#region src/request.ts
7
7
  /**
@@ -3,7 +3,7 @@ let node_process = require("node:process");
3
3
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
4
4
  //#region deno.json
5
5
  var name = "@fedify/vocab-runtime";
6
- var version = "2.4.0-dev.2219+eb70f060";
6
+ var version = "2.4.0-dev.2228+6d017d55";
7
7
  //#endregion
8
8
  //#region src/request.ts
9
9
  /**
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
- const require_request = require("./request-qq1N2cl6.cjs");
2
+ const require_request = require("./request-Cme6ShRu.cjs");
3
3
  let node_test = require("node:test");
4
4
  let node_process = require("node:process");
5
5
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
@@ -1,4 +1,4 @@
1
- import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-CWTG9_Xx.mjs";
1
+ import { n as createActivityPubRequest, o as version, r as getUserAgent } from "./request-2GDEEJng.mjs";
2
2
  import { test } from "node:test";
3
3
  import process from "node:process";
4
4
  import { deepStrictEqual } from "node:assert";
@@ -220,9 +220,10 @@ function parseAtUri(uri) {
220
220
  }
221
221
  /**
222
222
  * Checks whether the URL is an FEP-ef61 gateway base URI.
223
+ * @since 2.4.0
223
224
  */
224
225
  function isGatewayUrl(url) {
225
- return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
226
+ return (url.protocol === "http:" || url.protocol === "https:") && url.href === `${url.origin}/`;
226
227
  }
227
228
  /**
228
229
  * Parses and validates an FEP-ef61 gateway base URI.
@@ -230,6 +231,7 @@ function isGatewayUrl(url) {
230
231
  * with no credentials, path, query, or fragment. In the
231
232
  * latter case, the message starts with
232
233
  * `Invalid FEP-ef61 gateway:`.
234
+ * @since 2.4.0
233
235
  */
234
236
  function parseGatewayUrl(url) {
235
237
  const parsed = parseIri(url);
@@ -357,7 +359,7 @@ function toCompatibleEf61Id(portableId, gateway) {
357
359
  }
358
360
  function parseCompatibleEf61Gateway(gateway) {
359
361
  const url = gateway instanceof URL ? gateway : typeof gateway === "string" && URL.canParse(gateway) ? new URL(gateway) : null;
360
- if (url == null || url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
362
+ if (url == null || !isGatewayUrl(url)) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
361
363
  return url;
362
364
  }
363
365
  function getRawPortableIri(portableId) {
@@ -218,9 +218,10 @@ function parseAtUri(uri) {
218
218
  }
219
219
  /**
220
220
  * Checks whether the URL is an FEP-ef61 gateway base URI.
221
+ * @since 2.4.0
221
222
  */
222
223
  function isGatewayUrl(url) {
223
- return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
224
+ return (url.protocol === "http:" || url.protocol === "https:") && url.href === `${url.origin}/`;
224
225
  }
225
226
  /**
226
227
  * Parses and validates an FEP-ef61 gateway base URI.
@@ -228,6 +229,7 @@ function isGatewayUrl(url) {
228
229
  * with no credentials, path, query, or fragment. In the
229
230
  * latter case, the message starts with
230
231
  * `Invalid FEP-ef61 gateway:`.
232
+ * @since 2.4.0
231
233
  */
232
234
  function parseGatewayUrl(url) {
233
235
  const parsed = parseIri(url);
@@ -355,7 +357,7 @@ function toCompatibleEf61Id(portableId, gateway) {
355
357
  }
356
358
  function parseCompatibleEf61Gateway(gateway) {
357
359
  const url = gateway instanceof URL ? gateway : typeof gateway === "string" && URL.canParse(gateway) ? new URL(gateway) : null;
358
- if (url == null || url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
360
+ if (url == null || !isGatewayUrl(url)) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
359
361
  return url;
360
362
  }
361
363
  function getRawPortableIri(portableId) {
@@ -1,4 +1,4 @@
1
- const require_url = require("./url-B8xyTwP-.cjs");
1
+ const require_url = require("./url-B6WlNhra.cjs");
2
2
  let node_test = require("node:test");
3
3
  let node_assert = require("node:assert");
4
4
  //#region src/url.test.ts
@@ -228,7 +228,11 @@ let node_assert = require("node:assert");
228
228
  (0, node_assert.deepStrictEqual)(require_url.formatIri(parsed), "ap+ef61://did:web:example.com%00/u/1");
229
229
  });
230
230
  (0, node_test.test)("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
231
- for (const url of ["https://server.example/", "http://server.example/"]) {
231
+ for (const url of [
232
+ "https://server.example",
233
+ "https://server.example/",
234
+ "http://server.example/"
235
+ ]) {
232
236
  (0, node_assert.deepStrictEqual)(require_url.parseGatewayUrl(url), new URL(url));
233
237
  (0, node_assert.ok)(require_url.isGatewayUrl(new URL(url)));
234
238
  }
@@ -238,11 +242,19 @@ let node_assert = require("node:assert");
238
242
  "https://user@server.example/",
239
243
  "https://server.example/path",
240
244
  "https://server.example/?x=1",
241
- "https://server.example/#fragment"
245
+ "https://server.example/?",
246
+ "https://server.example/#fragment",
247
+ "https://server.example/#"
242
248
  ]) {
243
249
  (0, node_assert.throws)(() => require_url.parseGatewayUrl(url), (error) => error instanceof TypeError && error.message.startsWith("Invalid FEP-ef61 gateway: "));
244
250
  (0, node_assert.ok)(!require_url.isGatewayUrl(new URL(url)));
245
251
  }
252
+ const mutated = new URL("https://server.example/");
253
+ mutated.search = "?";
254
+ (0, node_assert.ok)(!require_url.isGatewayUrl(mutated));
255
+ mutated.search = "";
256
+ mutated.hash = "#";
257
+ (0, node_assert.ok)(!require_url.isGatewayUrl(mutated));
246
258
  });
247
259
  (0, node_test.test)("fromCompatibleEf61Id() converts compatible identifiers", () => {
248
260
  for (const [input, expected] of [
@@ -1,4 +1,4 @@
1
- import { _ as validateLookupAddresses, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl, v as validatePublicUrl } from "./url-DfS-cvwr.mjs";
1
+ import { _ as validateLookupAddresses, a as formatIri, c as haveSameFe34Origin, d as isValidPublicIPv4Address, f as isValidPublicIPv6Address, g as toCompatibleEf61Id, h as parseJsonLdId, i as expandIPv6Address, l as haveSameIriOrigin, m as parseIri, n as arePortableUrisEqual, o as fromCompatibleEf61Id, p as parseGatewayUrl, r as canonicalizePortableUri, s as getFe34Origin, t as UrlError, u as isGatewayUrl, v as validatePublicUrl } from "./url-R9TTZ67B.mjs";
2
2
  import { test } from "node:test";
3
3
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert";
4
4
  //#region src/url.test.ts
@@ -228,7 +228,11 @@ test("parseIri() preserves encoded percent signs while decoding delimiters", ()
228
228
  deepStrictEqual(formatIri(parsed), "ap+ef61://did:web:example.com%00/u/1");
229
229
  });
230
230
  test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
231
- for (const url of ["https://server.example/", "http://server.example/"]) {
231
+ for (const url of [
232
+ "https://server.example",
233
+ "https://server.example/",
234
+ "http://server.example/"
235
+ ]) {
232
236
  deepStrictEqual(parseGatewayUrl(url), new URL(url));
233
237
  ok(isGatewayUrl(new URL(url)));
234
238
  }
@@ -238,11 +242,19 @@ test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
238
242
  "https://user@server.example/",
239
243
  "https://server.example/path",
240
244
  "https://server.example/?x=1",
241
- "https://server.example/#fragment"
245
+ "https://server.example/?",
246
+ "https://server.example/#fragment",
247
+ "https://server.example/#"
242
248
  ]) {
243
249
  throws(() => parseGatewayUrl(url), (error) => error instanceof TypeError && error.message.startsWith("Invalid FEP-ef61 gateway: "));
244
250
  ok(!isGatewayUrl(new URL(url)));
245
251
  }
252
+ const mutated = new URL("https://server.example/");
253
+ mutated.search = "?";
254
+ ok(!isGatewayUrl(mutated));
255
+ mutated.search = "";
256
+ mutated.hash = "#";
257
+ ok(!isGatewayUrl(mutated));
246
258
  });
247
259
  test("fromCompatibleEf61Id() converts compatible identifiers", () => {
248
260
  for (const [input, expected] of [
@@ -219,9 +219,10 @@ function parseAtUri(uri) {
219
219
  }
220
220
  /**
221
221
  * Checks whether the URL is an FEP-ef61 gateway base URI.
222
+ * @since 2.4.0
222
223
  */
223
224
  function isGatewayUrl(url) {
224
- return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
225
+ return (url.protocol === "http:" || url.protocol === "https:") && url.href === `${url.origin}/`;
225
226
  }
226
227
  /**
227
228
  * Parses and validates an FEP-ef61 gateway base URI.
@@ -229,6 +230,7 @@ function isGatewayUrl(url) {
229
230
  * with no credentials, path, query, or fragment. In the
230
231
  * latter case, the message starts with
231
232
  * `Invalid FEP-ef61 gateway:`.
233
+ * @since 2.4.0
232
234
  */
233
235
  function parseGatewayUrl(url) {
234
236
  const parsed = parseIri(url);
@@ -356,7 +358,7 @@ function toCompatibleEf61Id(portableId, gateway) {
356
358
  }
357
359
  function parseCompatibleEf61Gateway(gateway) {
358
360
  const url = gateway instanceof URL ? gateway : typeof gateway === "string" && URL.canParse(gateway) ? new URL(gateway) : null;
359
- if (url == null || url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
361
+ if (url == null || !isGatewayUrl(url)) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
360
362
  return url;
361
363
  }
362
364
  function getRawPortableIri(portableId) {
@@ -221,9 +221,10 @@ function parseAtUri(uri) {
221
221
  }
222
222
  /**
223
223
  * Checks whether the URL is an FEP-ef61 gateway base URI.
224
+ * @since 2.4.0
224
225
  */
225
226
  function isGatewayUrl(url) {
226
- return (url.protocol === "http:" || url.protocol === "https:") && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
227
+ return (url.protocol === "http:" || url.protocol === "https:") && url.href === `${url.origin}/`;
227
228
  }
228
229
  /**
229
230
  * Parses and validates an FEP-ef61 gateway base URI.
@@ -231,6 +232,7 @@ function isGatewayUrl(url) {
231
232
  * with no credentials, path, query, or fragment. In the
232
233
  * latter case, the message starts with
233
234
  * `Invalid FEP-ef61 gateway:`.
235
+ * @since 2.4.0
234
236
  */
235
237
  function parseGatewayUrl(url) {
236
238
  const parsed = parseIri(url);
@@ -358,7 +360,7 @@ function toCompatibleEf61Id(portableId, gateway) {
358
360
  }
359
361
  function parseCompatibleEf61Gateway(gateway) {
360
362
  const url = gateway instanceof URL ? gateway : typeof gateway === "string" && URL.canParse(gateway) ? new URL(gateway) : null;
361
- if (url == null || url.protocol !== "http:" && url.protocol !== "https:" || url.href !== `${url.origin}/`) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
363
+ if (url == null || !isGatewayUrl(url)) throw new TypeError("FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins with no credentials, path, query, or fragment.");
362
364
  return url;
363
365
  }
364
366
  function getRawPortableIri(portableId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.4.0-dev.2219+eb70f060",
3
+ "version": "2.4.0-dev.2228+6d017d55",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,6 +55,8 @@ test("getPortableGatewayCandidates() reads @gateway hints", () => {
55
55
  "&gateways=https%3A%2F%2Flegacy.example" +
56
56
  "&@gateway=not%20a%20URL" +
57
57
  "&@gateway=https%3A%2F%2Fb.example%2Fpath" +
58
+ "&@gateway=https%3A%2F%2Fquery.example%2F%3F" +
59
+ "&@gateway=https%3A%2F%2Ffragment.example%2F%23" +
58
60
  "&%40gateway=https%3A%2F%2Fb.example" +
59
61
  "&@gateway=https%3A%2F%2Fa.example%2F",
60
62
  ))),
@@ -22,6 +22,7 @@ import {
22
22
  formatIri,
23
23
  fromCompatibleEf61Id,
24
24
  haveSameFe34Origin,
25
+ isGatewayUrl,
25
26
  parseIri,
26
27
  toCompatibleEf61Id,
27
28
  } from "../url.ts";
@@ -547,14 +548,7 @@ function parseGatewayOrigin(gateway: string | URL): URL | null {
547
548
  else if (typeof gateway === "string" && URL.canParse(gateway)) {
548
549
  url = new URL(gateway);
549
550
  } else return null;
550
- // Comparing href with the origin also rejects credentials, a path, and
551
- // query and fragment components, including empty ? and # delimiters.
552
- if (
553
- (url.protocol !== "http:" && url.protocol !== "https:") ||
554
- url.href !== `${url.origin}/`
555
- ) {
556
- return null;
557
- }
551
+ if (!isGatewayUrl(url)) return null;
558
552
  return url;
559
553
  }
560
554
 
package/src/url.test.ts CHANGED
@@ -644,7 +644,13 @@ test("parseIri() preserves encoded percent signs while decoding delimiters", ()
644
644
  });
645
645
 
646
646
  test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
647
- for (const url of ["https://server.example/", "http://server.example/"]) {
647
+ for (
648
+ const url of [
649
+ "https://server.example",
650
+ "https://server.example/",
651
+ "http://server.example/",
652
+ ]
653
+ ) {
648
654
  deepStrictEqual(parseGatewayUrl(url), new URL(url));
649
655
  ok(isGatewayUrl(new URL(url)));
650
656
  }
@@ -656,7 +662,9 @@ test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
656
662
  "https://user@server.example/",
657
663
  "https://server.example/path",
658
664
  "https://server.example/?x=1",
665
+ "https://server.example/?",
659
666
  "https://server.example/#fragment",
667
+ "https://server.example/#",
660
668
  ]
661
669
  ) {
662
670
  // Inboxes tell a malformed gateway from other errors by this prefix:
@@ -668,6 +676,13 @@ test("parseGatewayUrl() accepts only HTTP(S) base URIs", () => {
668
676
  );
669
677
  ok(!isGatewayUrl(new URL(url)));
670
678
  }
679
+
680
+ const mutated = new URL("https://server.example/");
681
+ mutated.search = "?";
682
+ ok(!isGatewayUrl(mutated));
683
+ mutated.search = "";
684
+ mutated.hash = "#";
685
+ ok(!isGatewayUrl(mutated));
671
686
  });
672
687
 
673
688
  test("fromCompatibleEf61Id() converts compatible identifiers", () => {
package/src/url.ts CHANGED
@@ -339,11 +339,11 @@ function parseAtUri(uri: string): URL {
339
339
 
340
340
  /**
341
341
  * Checks whether the URL is an FEP-ef61 gateway base URI.
342
+ * @since 2.4.0
342
343
  */
343
344
  export function isGatewayUrl(url: URL): boolean {
344
345
  return (url.protocol === "http:" || url.protocol === "https:") &&
345
- url.username === "" && url.password === "" &&
346
- url.pathname === "/" && url.search === "" && url.hash === "";
346
+ url.href === `${url.origin}/`;
347
347
  }
348
348
 
349
349
  /**
@@ -352,6 +352,7 @@ export function isGatewayUrl(url: URL): boolean {
352
352
  * with no credentials, path, query, or fragment. In the
353
353
  * latter case, the message starts with
354
354
  * `Invalid FEP-ef61 gateway:`.
355
+ * @since 2.4.0
355
356
  */
356
357
  export function parseGatewayUrl(url: string): URL {
357
358
  const parsed = parseIri(url);
@@ -550,12 +551,7 @@ function parseCompatibleEf61Gateway(gateway: string | URL): URL {
550
551
  : typeof gateway === "string" && URL.canParse(gateway)
551
552
  ? new URL(gateway)
552
553
  : null;
553
- // Comparing href with the origin also rejects credentials, a path, and
554
- // query and fragment components, including empty ? and # delimiters.
555
- if (
556
- url == null || (url.protocol !== "http:" && url.protocol !== "https:") ||
557
- url.href !== `${url.origin}/`
558
- ) {
554
+ if (url == null || !isGatewayUrl(url)) {
559
555
  throw new TypeError(
560
556
  "FEP-ef61 gateways for compatible identifiers must be HTTP(S) origins " +
561
557
  "with no credentials, path, query, or fragment.",