@fedify/vocab-runtime 2.4.0-dev.1583 → 2.4.0-dev.1618

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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.4.0-dev.1583+1a6f31cb",
3
+ "version": "2.4.0-dev.1618+58858243",
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-BAdyyqAa.cjs");
3
+ const require_url = require("../url-Ck3dGEwH.cjs");
4
4
  const require_jsonld = require("../jsonld.cjs");
5
5
  //#region src/internal/jsonld-cache.ts
6
6
  const noJsonLdContext = Symbol("noJsonLdContext");
@@ -12,7 +12,7 @@ const noJsonLdContext = Symbol("noJsonLdContext");
12
12
  * Semantic Versioning decisions.
13
13
  */
14
14
  function isTrustedIriOrigin(options, left, right) {
15
- return options.crossOrigin === "trust" || left == null || right != null && require_url.haveSameIriOrigin(left, right);
15
+ return options.crossOrigin === "trust" || left == null || right != null && (require_url.haveSameIriOrigin(left, right) || require_url.haveSameFe34Origin(left, right));
16
16
  }
17
17
  /**
18
18
  * Normalizes portable IRIs in JSON-LD cache data.
@@ -1,5 +1,5 @@
1
1
 
2
- import { i as haveSameIriOrigin, r as formatIri } from "../url-BuxPHxK2.js";
2
+ import { a as formatIri, c as haveSameIriOrigin, s as haveSameFe34Origin } from "../url-m1YxGNZ0.js";
3
3
  import jsonld_default from "../jsonld.js";
4
4
  //#region src/internal/jsonld-cache.ts
5
5
  const noJsonLdContext = Symbol("noJsonLdContext");
@@ -11,7 +11,7 @@ const noJsonLdContext = Symbol("noJsonLdContext");
11
11
  * Semantic Versioning decisions.
12
12
  */
13
13
  function isTrustedIriOrigin(options, left, right) {
14
- return options.crossOrigin === "trust" || left == null || right != null && haveSameIriOrigin(left, right);
14
+ return options.crossOrigin === "trust" || left == null || right != null && (haveSameIriOrigin(left, right) || haveSameFe34Origin(left, right));
15
15
  }
16
16
  /**
17
17
  * Normalizes portable IRIs in JSON-LD cache data.
package/dist/mod.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("./chunk-M78iaK0I.cjs");
4
- const require_url = require("./url-BAdyyqAa.cjs");
4
+ const require_url = require("./url-Ck3dGEwH.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _opentelemetry_api = require("@opentelemetry/api");
7
7
  let node_process = require("node:process");
@@ -4367,7 +4367,7 @@ const preloadedContexts = {
4367
4367
  //#endregion
4368
4368
  //#region deno.json
4369
4369
  var name = "@fedify/vocab-runtime";
4370
- var version = "2.4.0-dev.1583+1a6f31cb";
4370
+ var version = "2.4.0-dev.1618+58858243";
4371
4371
  //#endregion
4372
4372
  //#region src/link.ts
4373
4373
  const parametersNeedLowerCase = ["rel", "type"];
@@ -5551,7 +5551,9 @@ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_d
5551
5551
  exports.FetchError = FetchError;
5552
5552
  exports.LanguageString = LanguageString;
5553
5553
  exports.UrlError = require_url.UrlError;
5554
+ exports.arePortableUrisEqual = require_url.arePortableUrisEqual;
5554
5555
  exports.canParseDecimal = canParseDecimal;
5556
+ exports.canonicalizePortableUri = require_url.canonicalizePortableUri;
5555
5557
  exports.createActivityPubRequest = createActivityPubRequest;
5556
5558
  exports.decodeMultibase = decodeMultibase;
5557
5559
  exports.encodeMultibase = encodeMultibase;
@@ -5562,8 +5564,10 @@ exports.exportMultibaseKey = exportMultibaseKey;
5562
5564
  exports.exportSpki = exportSpki;
5563
5565
  exports.formatIri = require_url.formatIri;
5564
5566
  exports.getDocumentLoader = getDocumentLoader;
5567
+ exports.getFe34Origin = require_url.getFe34Origin;
5565
5568
  exports.getRemoteDocument = getRemoteDocument;
5566
5569
  exports.getUserAgent = getUserAgent;
5570
+ exports.haveSameFe34Origin = require_url.haveSameFe34Origin;
5567
5571
  exports.haveSameIriOrigin = require_url.haveSameIriOrigin;
5568
5572
  exports.importDidKey = importDidKey;
5569
5573
  exports.importMultibaseKey = importMultibaseKey;
package/dist/mod.d.cts CHANGED
@@ -326,6 +326,51 @@ declare function parseIri(iri: string | URL, base?: string | URL): URL;
326
326
  */
327
327
  declare function formatIri(iri: string | URL): string;
328
328
  /**
329
+ * Canonicalizes a FEP-ef61 portable ActivityPub URI for comparison.
330
+ *
331
+ * This accepts both `ap:` and `ap+ef61:` URI strings with decoded or
332
+ * percent-encoded DID authorities. The returned value uses the `ap+ef61:`
333
+ * scheme, a decoded DID authority, and no query component. Pass the raw URI
334
+ * string, not a `URL` object, because JavaScript `URL` normalizes opaque path
335
+ * segments before Fedify can compare them.
336
+ *
337
+ * @param input The raw portable ActivityPub URI string to canonicalize.
338
+ * @returns The canonical portable ActivityPub URI string.
339
+ * @throws {TypeError} If the input is not a valid portable ActivityPub IRI.
340
+ * @since 2.4.0
341
+ */
342
+ declare function canonicalizePortableUri(input: string): string;
343
+ /**
344
+ * Checks whether two FEP-ef61 portable ActivityPub URIs identify the same
345
+ * portable object.
346
+ *
347
+ * Non-string inputs return `false`. Non-portable URI strings use strict string
348
+ * equality. Portable URI strings are compared through
349
+ * {@link canonicalizePortableUri}; malformed portable URI strings return
350
+ * `false` unless they are exactly equal.
351
+ *
352
+ * @since 2.4.0
353
+ */
354
+ declare function arePortableUrisEqual(left: string, right: string): boolean;
355
+ /**
356
+ * Computes an IRI's FEP-fe34 origin.
357
+ *
358
+ * HTTP(S) IRIs use their web origin. FEP-ef61 portable ActivityPub IRIs and
359
+ * DID URLs use their DID as a cryptographic origin.
360
+ *
361
+ * @throws {TypeError} If the IRI does not have a supported FEP-fe34 origin.
362
+ * @since 2.4.0
363
+ */
364
+ declare function getFe34Origin(input: string | URL): string;
365
+ /**
366
+ * Checks whether two IRIs have the same FEP-fe34 origin.
367
+ *
368
+ * Malformed or unsupported IRIs are treated as non-matching.
369
+ *
370
+ * @since 2.4.0
371
+ */
372
+ declare function haveSameFe34Origin(left: string | URL, right: string | URL): boolean;
373
+ /**
329
374
  * Checks whether two IRIs have the same origin.
330
375
  */
331
376
  declare function haveSameIriOrigin(left: URL, right: URL): boolean;
@@ -337,4 +382,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
337
382
  declare function isValidPublicIPv6Address(address: string): boolean;
338
383
  declare function expandIPv6Address(address: string): string;
339
384
  //#endregion
340
- export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getRemoteDocument, getUserAgent, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
385
+ export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
package/dist/mod.d.ts CHANGED
@@ -326,6 +326,51 @@ declare function parseIri(iri: string | URL, base?: string | URL): URL;
326
326
  */
327
327
  declare function formatIri(iri: string | URL): string;
328
328
  /**
329
+ * Canonicalizes a FEP-ef61 portable ActivityPub URI for comparison.
330
+ *
331
+ * This accepts both `ap:` and `ap+ef61:` URI strings with decoded or
332
+ * percent-encoded DID authorities. The returned value uses the `ap+ef61:`
333
+ * scheme, a decoded DID authority, and no query component. Pass the raw URI
334
+ * string, not a `URL` object, because JavaScript `URL` normalizes opaque path
335
+ * segments before Fedify can compare them.
336
+ *
337
+ * @param input The raw portable ActivityPub URI string to canonicalize.
338
+ * @returns The canonical portable ActivityPub URI string.
339
+ * @throws {TypeError} If the input is not a valid portable ActivityPub IRI.
340
+ * @since 2.4.0
341
+ */
342
+ declare function canonicalizePortableUri(input: string): string;
343
+ /**
344
+ * Checks whether two FEP-ef61 portable ActivityPub URIs identify the same
345
+ * portable object.
346
+ *
347
+ * Non-string inputs return `false`. Non-portable URI strings use strict string
348
+ * equality. Portable URI strings are compared through
349
+ * {@link canonicalizePortableUri}; malformed portable URI strings return
350
+ * `false` unless they are exactly equal.
351
+ *
352
+ * @since 2.4.0
353
+ */
354
+ declare function arePortableUrisEqual(left: string, right: string): boolean;
355
+ /**
356
+ * Computes an IRI's FEP-fe34 origin.
357
+ *
358
+ * HTTP(S) IRIs use their web origin. FEP-ef61 portable ActivityPub IRIs and
359
+ * DID URLs use their DID as a cryptographic origin.
360
+ *
361
+ * @throws {TypeError} If the IRI does not have a supported FEP-fe34 origin.
362
+ * @since 2.4.0
363
+ */
364
+ declare function getFe34Origin(input: string | URL): string;
365
+ /**
366
+ * Checks whether two IRIs have the same FEP-fe34 origin.
367
+ *
368
+ * Malformed or unsupported IRIs are treated as non-matching.
369
+ *
370
+ * @since 2.4.0
371
+ */
372
+ declare function haveSameFe34Origin(left: string | URL, right: string | URL): boolean;
373
+ /**
329
374
  * Checks whether two IRIs have the same origin.
330
375
  */
331
376
  declare function haveSameIriOrigin(left: URL, right: URL): boolean;
@@ -337,4 +382,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
337
382
  declare function isValidPublicIPv6Address(address: string): boolean;
338
383
  declare function expandIPv6Address(address: string): string;
339
384
  //#endregion
340
- export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getRemoteDocument, getUserAgent, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
385
+ export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DidKeyVerificationMethod, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
package/dist/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as isValidPublicIPv4Address, c as parseJsonLdId, i as haveSameIriOrigin, l as validatePublicUrl, n as expandIPv6Address, o as isValidPublicIPv6Address, r as formatIri, s as parseIri, t as UrlError } from "./url-BuxPHxK2.js";
2
+ import { a as formatIri, c as haveSameIriOrigin, d as parseIri, f as parseJsonLdId, i as expandIPv6Address, l as isValidPublicIPv4Address, n as arePortableUrisEqual, o as getFe34Origin, p as validatePublicUrl, r as canonicalizePortableUri, s as haveSameFe34Origin, t as UrlError, u as isValidPublicIPv6Address } from "./url-m1YxGNZ0.js";
3
3
  import { getLogger } from "@logtape/logtape";
4
4
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
5
5
  import process from "node:process";
@@ -4363,7 +4363,7 @@ const preloadedContexts = {
4363
4363
  //#endregion
4364
4364
  //#region deno.json
4365
4365
  var name = "@fedify/vocab-runtime";
4366
- var version = "2.4.0-dev.1583+1a6f31cb";
4366
+ var version = "2.4.0-dev.1618+58858243";
4367
4367
  //#endregion
4368
4368
  //#region src/link.ts
4369
4369
  const parametersNeedLowerCase = ["rel", "type"];
@@ -5544,4 +5544,4 @@ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_d
5544
5544
  return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5545
5545
  };
5546
5546
  //#endregion
5547
- export { FetchError, LanguageString, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getRemoteDocument, getUserAgent, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
5547
+ export { FetchError, LanguageString, UrlError, arePortableUrisEqual, canParseDecimal, canonicalizePortableUri, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportDidKey, exportMultibaseKey, exportSpki, formatIri, getDocumentLoader, getFe34Origin, getRemoteDocument, getUserAgent, haveSameFe34Origin, haveSameIriOrigin, importDidKey, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, parseDidKeyVerificationMethod, parseIri, parseJsonLdId, preloadedContexts, validatePublicUrl };
@@ -1,6 +1,6 @@
1
1
  require("./chunk-C2EiDwsr.cjs");
2
- require("./docloader-CSsDIyQU.cjs");
3
- require("./url-2XwVbUS_.cjs");
2
+ require("./docloader-QmR6VOqT.cjs");
3
+ require("./url-BvjYQdxL.cjs");
4
4
  require("./key-_wXwomh_.cjs");
5
5
  require("./multibase-Bz_UUDtL.cjs");
6
6
  require("./langstr-CbAxaeEZ.cjs");
@@ -1,5 +1,5 @@
1
- import "./docloader-z8KkbO2O.mjs";
2
- import "./url-YWJbnRlf.mjs";
1
+ import "./docloader-CBVde8Va.mjs";
2
+ import "./url-a2D8NAgh.mjs";
3
3
  import "./key-CDGDH_vC.mjs";
4
4
  import "./multibase-B4bvakyA.mjs";
5
5
  import "./langstr-Di5AvKpB.mjs";
@@ -1,6 +1,6 @@
1
- import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-CLZQgTNJ.mjs";
1
+ import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-BHx0fCb5.mjs";
2
2
  import { t as HttpHeaderLink } from "./link-NUUWCdnK.mjs";
3
- import { l as validatePublicUrl, t as UrlError } from "./url-YWJbnRlf.mjs";
3
+ import { p as validatePublicUrl, t as UrlError } from "./url-a2D8NAgh.mjs";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
6
6
  //#endregion
@@ -1,7 +1,7 @@
1
1
  require("./chunk-C2EiDwsr.cjs");
2
- const require_request = require("./request-DpegHvk6.cjs");
2
+ const require_request = require("./request-DxSceLvB.cjs");
3
3
  const require_link = require("./link-FguCydMA.cjs");
4
- const require_url = require("./url-2XwVbUS_.cjs");
4
+ const require_url = require("./url-BvjYQdxL.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _opentelemetry_api = require("@opentelemetry/api");
7
7
  //#endregion
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-C2EiDwsr.cjs");
2
- const require_docloader = require("./docloader-CSsDIyQU.cjs");
3
- const require_request = require("./request-DpegHvk6.cjs");
4
- const require_url = require("./url-2XwVbUS_.cjs");
2
+ const require_docloader = require("./docloader-QmR6VOqT.cjs");
3
+ const require_request = require("./request-DxSceLvB.cjs");
4
+ const require_url = require("./url-BvjYQdxL.cjs");
5
5
  let node_assert = require("node:assert");
6
6
  let node_test = require("node:test");
7
7
  //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
@@ -1,6 +1,6 @@
1
- import { n as getRemoteDocument, r as preloadedContexts, t as getDocumentLoader } from "./docloader-z8KkbO2O.mjs";
2
- import { t as FetchError } from "./request-CLZQgTNJ.mjs";
3
- import { t as UrlError } from "./url-YWJbnRlf.mjs";
1
+ import { n as getRemoteDocument, r as preloadedContexts, t as getDocumentLoader } from "./docloader-CBVde8Va.mjs";
2
+ import { t as FetchError } from "./request-BHx0fCb5.mjs";
3
+ import { t as UrlError } from "./url-a2D8NAgh.mjs";
4
4
  import { deepStrictEqual, ok, rejects } from "node:assert";
5
5
  import { test } from "node:test";
6
6
  //#region \0rolldown/runtime.js
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-C2EiDwsr.cjs");
2
- const require_url = require("./url-2XwVbUS_.cjs");
2
+ const require_url = require("./url-BvjYQdxL.cjs");
3
3
  let node_assert = require("node:assert");
4
4
  let node_test = require("node:test");
5
5
  let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
@@ -17,7 +17,7 @@ const noJsonLdContext = Symbol("noJsonLdContext");
17
17
  * Semantic Versioning decisions.
18
18
  */
19
19
  function isTrustedIriOrigin(options, left, right) {
20
- return options.crossOrigin === "trust" || left == null || right != null && require_url.haveSameIriOrigin(left, right);
20
+ return options.crossOrigin === "trust" || left == null || right != null && (require_url.haveSameIriOrigin(left, right) || require_url.haveSameFe34Origin(left, right));
21
21
  }
22
22
  /**
23
23
  * Normalizes portable IRIs in JSON-LD cache data.
@@ -1,4 +1,4 @@
1
- import { i as haveSameIriOrigin, r as formatIri, s as parseIri } from "./url-YWJbnRlf.mjs";
1
+ import { a as formatIri, c as haveSameIriOrigin, d as parseIri, s as haveSameFe34Origin } from "./url-a2D8NAgh.mjs";
2
2
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
3
3
  import { test } from "node:test";
4
4
  import jsonld from "jsonld/dist/jsonld.esm.js";
@@ -15,7 +15,7 @@ const noJsonLdContext = Symbol("noJsonLdContext");
15
15
  * Semantic Versioning decisions.
16
16
  */
17
17
  function isTrustedIriOrigin(options, left, right) {
18
- return options.crossOrigin === "trust" || left == null || right != null && haveSameIriOrigin(left, right);
18
+ return options.crossOrigin === "trust" || left == null || right != null && (haveSameIriOrigin(left, right) || haveSameFe34Origin(left, right));
19
19
  }
20
20
  /**
21
21
  * Normalizes portable IRIs in JSON-LD cache data.
@@ -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.1583+1a6f31cb";
4
+ var version = "2.4.0-dev.1618+58858243";
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_chunk.__toESM(node_process, 1);
4
4
  //#region deno.json
5
5
  var name = "@fedify/vocab-runtime";
6
- var version = "2.4.0-dev.1583+1a6f31cb";
6
+ var version = "2.4.0-dev.1618+58858243";
7
7
  //#endregion
8
8
  //#region src/request.ts
9
9
  /**
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-C2EiDwsr.cjs");
2
- const require_request = require("./request-DpegHvk6.cjs");
2
+ const require_request = require("./request-DxSceLvB.cjs");
3
3
  let node_assert = require("node:assert");
4
4
  let node_test = require("node:test");
5
5
  let node_process = require("node:process");
@@ -1,4 +1,4 @@
1
- import { o as version, r as getUserAgent } from "./request-CLZQgTNJ.mjs";
1
+ import { o as version, r as getUserAgent } from "./request-BHx0fCb5.mjs";
2
2
  import { deepStrictEqual } from "node:assert";
3
3
  import { test } from "node:test";
4
4
  import process from "node:process";
@@ -10,6 +10,7 @@ var UrlError = class extends Error {
10
10
  };
11
11
  const PORTABLE_IRI_PATTERN = /^(ap|ap\+ef61):\/\/([^/?#]*)([^?#]*)(\?[^#]*)?(#.*)?$/i;
12
12
  const INVALID_PERCENT_ENCODING_PATTERN = /%(?![0-9A-Fa-f]{2})/;
13
+ const PERCENT_ENCODING_PATTERN = /%[0-9A-Fa-f]{2}/g;
13
14
  const DID_SCHEME_PATTERN = /^did:/i;
14
15
  const DID_PATTERN = /^did:[a-z0-9]+:[-A-Za-z0-9._%]+(?::[-A-Za-z0-9._%]+)*$/i;
15
16
  /**
@@ -44,6 +45,88 @@ function formatIri(iri) {
44
45
  return `ap+ef61://${decodePortableAuthority(parsed.host)}${parsed.pathname}${parsed.search}${parsed.hash}`;
45
46
  }
46
47
  /**
48
+ * Canonicalizes a FEP-ef61 portable ActivityPub URI for comparison.
49
+ *
50
+ * This accepts both `ap:` and `ap+ef61:` URI strings with decoded or
51
+ * percent-encoded DID authorities. The returned value uses the `ap+ef61:`
52
+ * scheme, a decoded DID authority, and no query component. Pass the raw URI
53
+ * string, not a `URL` object, because JavaScript `URL` normalizes opaque path
54
+ * segments before Fedify can compare them.
55
+ *
56
+ * @param input The raw portable ActivityPub URI string to canonicalize.
57
+ * @returns The canonical portable ActivityPub URI string.
58
+ * @throws {TypeError} If the input is not a valid portable ActivityPub IRI.
59
+ * @since 2.4.0
60
+ */
61
+ function canonicalizePortableUri(input) {
62
+ if (typeof input !== "string") throw new TypeError("Invalid portable ActivityPub IRI.");
63
+ const parsed = parsePortableIri(input);
64
+ if (parsed == null) throw new TypeError("Invalid portable ActivityPub IRI.");
65
+ const match = input.match(PORTABLE_IRI_PATTERN);
66
+ return `ap+ef61://${normalizePortableAuthority(getDidUrlOrigin(decodePortableAuthority(parsed.host)))}${normalizePortableComponent(match[3])}${match[5] == null ? "" : normalizePortableComponent(match[5])}`;
67
+ }
68
+ /**
69
+ * Checks whether two FEP-ef61 portable ActivityPub URIs identify the same
70
+ * portable object.
71
+ *
72
+ * Non-string inputs return `false`. Non-portable URI strings use strict string
73
+ * equality. Portable URI strings are compared through
74
+ * {@link canonicalizePortableUri}; malformed portable URI strings return
75
+ * `false` unless they are exactly equal.
76
+ *
77
+ * @since 2.4.0
78
+ */
79
+ function arePortableUrisEqual(left, right) {
80
+ if (typeof left !== "string" || typeof right !== "string") return false;
81
+ if (left === right) return true;
82
+ if (!PORTABLE_IRI_PATTERN.test(left) || !PORTABLE_IRI_PATTERN.test(right)) return false;
83
+ try {
84
+ return canonicalizePortableUri(left) === canonicalizePortableUri(right);
85
+ } catch (error) {
86
+ if (error instanceof TypeError) return false;
87
+ throw error;
88
+ }
89
+ }
90
+ /**
91
+ * Computes an IRI's FEP-fe34 origin.
92
+ *
93
+ * HTTP(S) IRIs use their web origin. FEP-ef61 portable ActivityPub IRIs and
94
+ * DID URLs use their DID as a cryptographic origin.
95
+ *
96
+ * @throws {TypeError} If the IRI does not have a supported FEP-fe34 origin.
97
+ * @since 2.4.0
98
+ */
99
+ function getFe34Origin(input) {
100
+ if (input instanceof URL) {
101
+ const portable = normalizePortableUrl(input);
102
+ if (portable != null) return getPortableCryptographicOrigin(portable);
103
+ if (input.protocol === "did:") return getDidUrlOrigin(input.href);
104
+ if (input.protocol === "http:" || input.protocol === "https:") return input.origin;
105
+ throw new TypeError("Unsupported FEP-fe34 origin IRI.");
106
+ }
107
+ const portable = parsePortableIri(input);
108
+ if (portable != null) return getPortableCryptographicOrigin(portable);
109
+ if (DID_SCHEME_PATTERN.test(input)) return getDidUrlOrigin(input);
110
+ const parsed = new URL(input);
111
+ if (parsed.protocol === "http:" || parsed.protocol === "https:") return parsed.origin;
112
+ throw new TypeError("Unsupported FEP-fe34 origin IRI.");
113
+ }
114
+ /**
115
+ * Checks whether two IRIs have the same FEP-fe34 origin.
116
+ *
117
+ * Malformed or unsupported IRIs are treated as non-matching.
118
+ *
119
+ * @since 2.4.0
120
+ */
121
+ function haveSameFe34Origin(left, right) {
122
+ try {
123
+ return getFe34Origin(left) === getFe34Origin(right);
124
+ } catch (error) {
125
+ if (error instanceof TypeError) return false;
126
+ throw error;
127
+ }
128
+ }
129
+ /**
47
130
  * Checks whether two IRIs have the same origin.
48
131
  */
49
132
  function haveSameIriOrigin(left, right) {
@@ -53,15 +136,25 @@ function getComparableIriOrigin(iri) {
53
136
  iri = normalizePortableUrl(iri) ?? iri;
54
137
  if (iri.origin !== "null") return iri.origin;
55
138
  if (iri.host !== "") {
56
- const host = iri.protocol === "ap+ef61:" ? encodeURIComponent(decodePortableAuthority(iri.host).replace(DID_SCHEME_PATTERN, "did:")) : iri.host;
139
+ const host = iri.protocol === "ap+ef61:" ? encodeURIComponent(getDidUrlOrigin(decodePortableAuthority(iri.host))) : iri.host;
57
140
  return `${iri.protocol}//${host}`;
58
141
  }
59
142
  return iri.href;
60
143
  }
144
+ function getPortableCryptographicOrigin(iri) {
145
+ return getDidUrlOrigin(decodePortableAuthority(iri.host));
146
+ }
147
+ function getDidUrlOrigin(iri) {
148
+ const did = iri.split(/[/?#]/, 1)[0].replace(DID_SCHEME_PATTERN, "did:");
149
+ if (!DID_PATTERN.test(did)) throw new TypeError("Invalid DID URL.");
150
+ const parts = did.split(":");
151
+ parts[1] = parts[1].toLowerCase();
152
+ return normalizePortableAuthority(parts.join(":"));
153
+ }
61
154
  function parsePortableIri(iri) {
62
155
  const match = iri.match(PORTABLE_IRI_PATTERN);
63
156
  if (match == null) return null;
64
- const authority = decodePortableAuthority(match[2]);
157
+ const authority = getDidUrlOrigin(decodePortableAuthority(match[2]));
65
158
  if (!DID_PATTERN.test(authority)) throw new TypeError("Invalid portable ActivityPub IRI authority.");
66
159
  if (match[3] === "") throw new TypeError("Invalid portable ActivityPub IRI path.");
67
160
  return new URL(`ap+ef61://${encodeURIComponent(authority)}${match[3]}${match[4] ?? ""}${match[5] ?? ""}`);
@@ -86,6 +179,31 @@ function decodePortableAuthority(authority) {
86
179
  if (INVALID_PERCENT_ENCODING_PATTERN.test(decoded)) throw new TypeError("Invalid portable ActivityPub IRI authority.");
87
180
  return decoded;
88
181
  }
182
+ function normalizePercentEncoding(value) {
183
+ return value.replace(PERCENT_ENCODING_PATTERN, (match) => match.toUpperCase());
184
+ }
185
+ function normalizePortableAuthority(authority) {
186
+ return normalizePercentEncoding(authority).replace(PERCENT_ENCODING_PATTERN, (match) => {
187
+ const decoded = String.fromCharCode(Number.parseInt(match.slice(1), 16));
188
+ return /[A-Za-z0-9._~-]/.test(decoded) ? decoded : match;
189
+ });
190
+ }
191
+ function normalizePortableComponent(value) {
192
+ if (INVALID_PERCENT_ENCODING_PATTERN.test(value)) throw new TypeError("Invalid portable ActivityPub IRI component.");
193
+ return value.replace(/%[0-9A-Fa-f]{2}|[^%]+/g, (match) => {
194
+ if (match.startsWith("%")) {
195
+ const upper = match.toUpperCase();
196
+ const decoded = String.fromCharCode(Number.parseInt(upper.slice(1), 16));
197
+ return /[A-Za-z0-9._~-]/.test(decoded) ? decoded : upper;
198
+ }
199
+ try {
200
+ return encodeURI(match);
201
+ } catch (error) {
202
+ if (error instanceof URIError) throw new TypeError("Invalid portable ActivityPub IRI component.");
203
+ throw error;
204
+ }
205
+ });
206
+ }
89
207
  function parseAtUri(uri) {
90
208
  const index = uri.indexOf("/", 5);
91
209
  const authority = index >= 0 ? uri.slice(5, index) : uri.slice(5);
@@ -264,6 +382,18 @@ Object.defineProperty(exports, "UrlError", {
264
382
  return UrlError;
265
383
  }
266
384
  });
385
+ Object.defineProperty(exports, "arePortableUrisEqual", {
386
+ enumerable: true,
387
+ get: function() {
388
+ return arePortableUrisEqual;
389
+ }
390
+ });
391
+ Object.defineProperty(exports, "canonicalizePortableUri", {
392
+ enumerable: true,
393
+ get: function() {
394
+ return canonicalizePortableUri;
395
+ }
396
+ });
267
397
  Object.defineProperty(exports, "expandIPv6Address", {
268
398
  enumerable: true,
269
399
  get: function() {
@@ -276,6 +406,18 @@ Object.defineProperty(exports, "formatIri", {
276
406
  return formatIri;
277
407
  }
278
408
  });
409
+ Object.defineProperty(exports, "getFe34Origin", {
410
+ enumerable: true,
411
+ get: function() {
412
+ return getFe34Origin;
413
+ }
414
+ });
415
+ Object.defineProperty(exports, "haveSameFe34Origin", {
416
+ enumerable: true,
417
+ get: function() {
418
+ return haveSameFe34Origin;
419
+ }
420
+ });
279
421
  Object.defineProperty(exports, "haveSameIriOrigin", {
280
422
  enumerable: true,
281
423
  get: function() {