@fedify/vocab-runtime 2.4.0-dev.2233 → 2.4.0-dev.2240

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 (55) hide show
  1. package/deno.json +2 -2
  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 +3 -6
  5. package/dist/internal/portable-dereference.js +3 -6
  6. package/dist/mod.cjs +2 -2
  7. package/dist/mod.d.cts +14 -3
  8. package/dist/mod.d.ts +14 -3
  9. package/dist/mod.js +2 -2
  10. package/dist/tests/{body-BEYUpKvX.mjs → body-C00dWiYW.mjs} +1 -1
  11. package/dist/tests/{body-DQKTFMsH.cjs → body-DHk-vT0I.cjs} +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-ra1lbBfP.mjs → docloader-Bi982uOa.mjs} +3 -3
  17. package/dist/tests/{docloader-DHCYdBXf.cjs → docloader-gX-8knd3.cjs} +3 -3
  18. package/dist/tests/docloader.test.cjs +59 -65
  19. package/dist/tests/docloader.test.mjs +38 -44
  20. package/dist/tests/internal/portable-dereference.test.cjs +21 -149
  21. package/dist/tests/internal/portable-dereference.test.mjs +3 -131
  22. package/dist/tests/{jsonld-cache-BKrsWPCQ.mjs → jsonld-cache-CKfgtxPB.mjs} +1 -1
  23. package/dist/tests/{jsonld-cache-BTgizq9A.cjs → jsonld-cache-DzxT9IXH.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/multibase/multibase.test.cjs +7 -7
  27. package/dist/tests/multibase/multibase.test.mjs +5 -5
  28. package/dist/tests/portable-dereference-C_cwGjz6.mjs +132 -0
  29. package/dist/tests/portable-dereference-CyFYTBnr.cjs +149 -0
  30. package/dist/tests/{portable-media-DHaAEpaQ.cjs → portable-media-B39cvJGK.cjs} +3 -3
  31. package/dist/tests/{portable-media-1NjUQari.mjs → portable-media-l0ET9Pq8.mjs} +3 -3
  32. package/dist/tests/portable-media.test.cjs +1 -1
  33. package/dist/tests/portable-media.test.mjs +1 -1
  34. package/dist/tests/portable-workers.test.cjs +36 -0
  35. package/dist/tests/portable-workers.test.d.cts +2 -0
  36. package/dist/tests/portable-workers.test.d.mts +2 -0
  37. package/dist/tests/portable-workers.test.mjs +35 -0
  38. package/dist/tests/{request-D3elVRyB.mjs → request-BRPiDcmG.mjs} +1 -1
  39. package/dist/tests/{request-BQlkB8du.cjs → request-fo2l2yJS.cjs} +1 -1
  40. package/dist/tests/request.test.cjs +1 -1
  41. package/dist/tests/request.test.mjs +1 -1
  42. package/dist/tests/{url-Cdu4ASgJ.mjs → url-CWC-NI3a.mjs} +63 -7
  43. package/dist/tests/{url-CtHyzMR4.cjs → url-DsMBGqCc.cjs} +63 -7
  44. package/dist/tests/url.test.cjs +74 -1
  45. package/dist/tests/url.test.mjs +74 -1
  46. package/dist/{url-BHfQuRdy.cjs → url-BJMXv2kE.cjs} +63 -7
  47. package/dist/{url-DqqDZY9i.js → url-CZm2-7ZO.js} +63 -7
  48. package/package.json +6 -3
  49. package/scripts/test-bun.mjs +17 -0
  50. package/src/docloader.test.ts +82 -74
  51. package/src/internal/portable-dereference.ts +2 -5
  52. package/src/multibase/multibase.test.ts +5 -5
  53. package/src/portable-workers.test.ts +81 -0
  54. package/src/url.test.ts +90 -0
  55. package/src/url.ts +115 -13
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.4.0-dev.2233+abb4a6b2",
3
+ "version": "2.4.0-dev.2240+79613fa6",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
@@ -36,6 +36,6 @@
36
36
  },
37
37
  "tasks": {
38
38
  "check": "deno fmt --check && deno lint && deno check src/*.ts",
39
- "test": "deno test --allow-net"
39
+ "test": "deno test --allow-net --allow-env=LOG"
40
40
  }
41
41
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_url = require("../url-BHfQuRdy.cjs");
3
+ const require_url = require("../url-BJMXv2kE.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 { d as haveSameIriOrigin, o as formatIri, u as haveSameFe34Origin } from "../url-DqqDZY9i.js";
2
+ import { d as haveSameIriOrigin, o as formatIri, u as haveSameFe34Origin } from "../url-CZm2-7ZO.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-BHfQuRdy.cjs");
4
+ const require_url = require("../url-BJMXv2kE.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");
@@ -137,13 +137,10 @@ function copyPortableProvenance(from, to) {
137
137
  * Semantic Versioning decisions.
138
138
  */
139
139
  function parseCompatibleEf61Reference(url) {
140
- if (typeof url === "string") {
141
- if (!URL.canParse(url)) return void 0;
142
- url = new URL(url);
143
- }
144
140
  try {
145
141
  const id = require_url.fromCompatibleEf61Id(url);
146
142
  if (id == null) return void 0;
143
+ if (typeof url === "string") url = new URL(url);
147
144
  return {
148
145
  id,
149
146
  gateway: new URL(url.origin)
@@ -151,7 +148,7 @@ function parseCompatibleEf61Reference(url) {
151
148
  } catch (error) {
152
149
  if (error instanceof TypeError) {
153
150
  logger.debug("Invalid FEP-ef61 compatible identifier {url}: {error}", {
154
- url: url.href,
151
+ url: typeof url === "string" ? url : url.href,
155
152
  error
156
153
  });
157
154
  return null;
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { t as preloadedContexts } from "../contexts-DPuJ4UYL.js";
3
- import { _ as parseIri, h as parseGatewayOrigin, i as canonicalizePortableUri, o as formatIri, s as fromCompatibleEf61Id, t as GATEWAY_HINT_PARAMETER, u as haveSameFe34Origin, y as toCompatibleEf61Id } from "../url-DqqDZY9i.js";
3
+ import { _ as parseIri, h as parseGatewayOrigin, i as canonicalizePortableUri, o as formatIri, s as fromCompatibleEf61Id, t as GATEWAY_HINT_PARAMETER, u as haveSameFe34Origin, y as toCompatibleEf61Id } from "../url-CZm2-7ZO.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";
@@ -136,13 +136,10 @@ function copyPortableProvenance(from, to) {
136
136
  * Semantic Versioning decisions.
137
137
  */
138
138
  function parseCompatibleEf61Reference(url) {
139
- if (typeof url === "string") {
140
- if (!URL.canParse(url)) return void 0;
141
- url = new URL(url);
142
- }
143
139
  try {
144
140
  const id = fromCompatibleEf61Id(url);
145
141
  if (id == null) return void 0;
142
+ if (typeof url === "string") url = new URL(url);
146
143
  return {
147
144
  id,
148
145
  gateway: new URL(url.origin)
@@ -150,7 +147,7 @@ function parseCompatibleEf61Reference(url) {
150
147
  } catch (error) {
151
148
  if (error instanceof TypeError) {
152
149
  logger.debug("Invalid FEP-ef61 compatible identifier {url}: {error}", {
153
- url: url.href,
150
+ url: typeof url === "string" ? url : url.href,
154
151
  error
155
152
  });
156
153
  return null;
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-BHfQuRdy.cjs");
5
+ const require_url = require("./url-BJMXv2kE.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.2233+abb4a6b2";
19
+ var version = "2.4.0-dev.2240+79613fa6";
20
20
  //#endregion
21
21
  //#region src/request.ts
22
22
  /**
package/dist/mod.d.cts CHANGED
@@ -467,10 +467,19 @@ declare class UrlError extends Error {
467
467
  declare function parseJsonLdId(id: string | undefined, base?: string | URL): URL | undefined;
468
468
  /**
469
469
  * Parses an IRI as a URL, including FEP-ef61 portable ActivityPub IRIs.
470
+ * Portable URI and FEP-ef61 compatible identifier strings whose path contains
471
+ * a `.` or `..` segment, including percent-encoded spellings, throw a
472
+ * `TypeError`: JavaScript `URL` would otherwise identify a different object.
473
+ * This also applies to compatible identifier strings used as relative bases.
474
+ * A `URL` argument may already have lost such segments before this function
475
+ * receives it.
470
476
  */
471
477
  declare function parseIri(iri: string | URL, base?: string | URL): URL;
472
478
  /**
473
479
  * Formats a URL as an IRI, including FEP-ef61 portable ActivityPub IRIs.
480
+ * Portable URI and FEP-ef61 compatible identifier strings with dot segments
481
+ * throw a `TypeError` because their paths cannot be represented by JavaScript
482
+ * `URL` without normalization.
474
483
  */
475
484
  declare function formatIri(iri: string | URL): string;
476
485
  /**
@@ -570,8 +579,9 @@ declare function parseGatewayUrl(url: string): URL;
570
579
  * malformed, e.g., it has an invalid DID, no object path,
571
580
  * invalid percent-encoding, credentials, or location
572
581
  * hints (`@gateway` query parameters, or the legacy
573
- * `gateways` parameter), which FEP-ef61 forbids in
574
- * compatible identifiers.
582
+ * `gateways` parameter), or its raw string path would
583
+ * change during URL parsing. Already-parsed `URL`
584
+ * arguments cannot reveal segments lost by their parser.
575
585
  * @since 2.4.0
576
586
  */
577
587
  declare function fromCompatibleEf61Id(input: string | URL): URL | null;
@@ -603,7 +613,8 @@ declare function fromCompatibleEf61Id(input: string | URL): URL | null;
603
613
  * @returns The compatible identifier.
604
614
  * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
605
615
  * URI, if its path has `.` or `..` segments (which
606
- * HTTP(S) URLs cannot represent), or if the gateway is
616
+ * HTTP(S) URLs cannot represent without changing the
617
+ * identified object), or if the gateway is
607
618
  * not an HTTP(S) origin with no credentials, path, query,
608
619
  * or fragment.
609
620
  * @since 2.4.0
package/dist/mod.d.ts CHANGED
@@ -466,10 +466,19 @@ declare class UrlError extends Error {
466
466
  declare function parseJsonLdId(id: string | undefined, base?: string | URL): URL | undefined;
467
467
  /**
468
468
  * Parses an IRI as a URL, including FEP-ef61 portable ActivityPub IRIs.
469
+ * Portable URI and FEP-ef61 compatible identifier strings whose path contains
470
+ * a `.` or `..` segment, including percent-encoded spellings, throw a
471
+ * `TypeError`: JavaScript `URL` would otherwise identify a different object.
472
+ * This also applies to compatible identifier strings used as relative bases.
473
+ * A `URL` argument may already have lost such segments before this function
474
+ * receives it.
469
475
  */
470
476
  declare function parseIri(iri: string | URL, base?: string | URL): URL;
471
477
  /**
472
478
  * Formats a URL as an IRI, including FEP-ef61 portable ActivityPub IRIs.
479
+ * Portable URI and FEP-ef61 compatible identifier strings with dot segments
480
+ * throw a `TypeError` because their paths cannot be represented by JavaScript
481
+ * `URL` without normalization.
473
482
  */
474
483
  declare function formatIri(iri: string | URL): string;
475
484
  /**
@@ -569,8 +578,9 @@ declare function parseGatewayUrl(url: string): URL;
569
578
  * malformed, e.g., it has an invalid DID, no object path,
570
579
  * invalid percent-encoding, credentials, or location
571
580
  * hints (`@gateway` query parameters, or the legacy
572
- * `gateways` parameter), which FEP-ef61 forbids in
573
- * compatible identifiers.
581
+ * `gateways` parameter), or its raw string path would
582
+ * change during URL parsing. Already-parsed `URL`
583
+ * arguments cannot reveal segments lost by their parser.
574
584
  * @since 2.4.0
575
585
  */
576
586
  declare function fromCompatibleEf61Id(input: string | URL): URL | null;
@@ -602,7 +612,8 @@ declare function fromCompatibleEf61Id(input: string | URL): URL | null;
602
612
  * @returns The compatible identifier.
603
613
  * @throws {TypeError} If the portable ID is not a valid `ap:` or `ap+ef61:`
604
614
  * URI, if its path has `.` or `..` segments (which
605
- * HTTP(S) URLs cannot represent), or if the gateway is
615
+ * HTTP(S) URLs cannot represent without changing the
616
+ * identified object), or if the gateway is
606
617
  * not an HTTP(S) origin with no credentials, path, query,
607
618
  * or fragment.
608
619
  * @since 2.4.0
package/dist/mod.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { t as preloadedContexts } from "./contexts-DPuJ4UYL.js";
3
- import { S as withoutGatewayHints, _ as parseIri, a as expandIPv6Address, b as validatePublicUrl, c as getFe34Origin, d as haveSameIriOrigin, f as isGatewayUrl, g as parseGatewayUrl, i as canonicalizePortableUri, l as getGatewayHints, m as isValidPublicIPv6Address, n as UrlError, o as formatIri, p as isValidPublicIPv4Address, r as arePortableUrisEqual, s as fromCompatibleEf61Id, u as haveSameFe34Origin, v as parseJsonLdId, x as withGatewayHints, y as toCompatibleEf61Id } from "./url-DqqDZY9i.js";
3
+ import { S as withoutGatewayHints, _ as parseIri, a as expandIPv6Address, b as validatePublicUrl, c as getFe34Origin, d as haveSameIriOrigin, f as isGatewayUrl, g as parseGatewayUrl, i as canonicalizePortableUri, l as getGatewayHints, m as isValidPublicIPv6Address, n as UrlError, o as formatIri, p as isValidPublicIPv4Address, r as arePortableUrisEqual, s as fromCompatibleEf61Id, u as haveSameFe34Origin, v as parseJsonLdId, x as withGatewayHints, y as toCompatibleEf61Id } from "./url-CZm2-7ZO.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.2233+abb4a6b2";
15
+ var version = "2.4.0-dev.2240+79613fa6";
16
16
  //#endregion
17
17
  //#region src/request.ts
18
18
  /**
@@ -1,4 +1,4 @@
1
- import { t as FetchError } from "./request-D3elVRyB.mjs";
1
+ import { t as FetchError } from "./request-BRPiDcmG.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_request = require("./request-BQlkB8du.cjs");
1
+ const require_request = require("./request-fo2l2yJS.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
- const require_body = require("./body-DQKTFMsH.cjs");
1
+ const require_body = require("./body-DHk-vT0I.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-BEYUpKvX.mjs";
1
+ import { i as readBoundedText, t as BodyTooLargeError } from "./body-C00dWiYW.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-CtHyzMR4.cjs");
2
- require("./docloader-DHCYdBXf.cjs");
1
+ require("./url-DsMBGqCc.cjs");
2
+ require("./docloader-gX-8knd3.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-DHaAEpaQ.cjs");
7
+ require("./portable-media-B39cvJGK.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-Cdu4ASgJ.mjs";
2
- import "./docloader-ra1lbBfP.mjs";
1
+ import "./url-CWC-NI3a.mjs";
2
+ import "./docloader-Bi982uOa.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-1NjUQari.mjs";
7
+ import "./portable-media-l0ET9Pq8.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
- import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-D3elVRyB.mjs";
2
- import { i as readBoundedText, n as MAX_BODY_SIZE, r as readBoundedBytes, t as BodyTooLargeError } from "./body-BEYUpKvX.mjs";
1
+ import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-BRPiDcmG.mjs";
2
+ import { i as readBoundedText, n as MAX_BODY_SIZE, r as readBoundedBytes, t as BodyTooLargeError } from "./body-C00dWiYW.mjs";
3
3
  import { t as preloadedContexts } from "./contexts-CIKsin4e.mjs";
4
4
  import { t as HttpHeaderLink } from "./link-Cevmc87v.mjs";
5
- import { n as UrlError, x as validatePublicUrl } from "./url-Cdu4ASgJ.mjs";
5
+ import { n as UrlError, x as validatePublicUrl } from "./url-CWC-NI3a.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
- const require_request = require("./request-BQlkB8du.cjs");
2
- const require_body = require("./body-DQKTFMsH.cjs");
1
+ const require_request = require("./request-fo2l2yJS.cjs");
2
+ const require_body = require("./body-DHk-vT0I.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-CtHyzMR4.cjs");
5
+ const require_url = require("./url-DsMBGqCc.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
  //#region src/docloader.ts