@fedify/vocab-runtime 2.2.14-dev.2082 → 2.2.15-dev.2196

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.2.14-dev.2082+79cd52e9",
3
+ "version": "2.2.15-dev.2196+10201be2",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
package/dist/mod.cjs CHANGED
@@ -6,6 +6,7 @@ let _opentelemetry_api = require("@opentelemetry/api");
6
6
  let node_process = require("node:process");
7
7
  node_process = require_chunk.__toESM(node_process);
8
8
  let node_dns_promises = require("node:dns/promises");
9
+ node_dns_promises = require_chunk.__toESM(node_dns_promises);
9
10
  let node_net = require("node:net");
10
11
  let asn1js = require("asn1js");
11
12
  let byte_encodings_base64 = require("byte-encodings/base64");
@@ -599,6 +600,30 @@ var fep_5711_default = { "@context": {
599
600
  }
600
601
  } };
601
602
  //#endregion
603
+ //#region src/contexts/fep-7aa9.json
604
+ var fep_7aa9_default = { "@context": {
605
+ "FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
606
+ "FeaturedItem": "https://w3id.org/fep/7aa9#FeaturedItem",
607
+ "FeatureRequest": "https://w3id.org/fep/7aa9#FeatureRequest",
608
+ "FeatureAuthorization": "https://w3id.org/fep/7aa9#FeatureAuthorization",
609
+ "topic": {
610
+ "@id": "https://w3id.org/fep/7aa9#topic",
611
+ "@type": "@id"
612
+ },
613
+ "featuredObject": {
614
+ "@id": "https://w3id.org/fep/7aa9#featuredObject",
615
+ "@type": "@id"
616
+ },
617
+ "canFeature": {
618
+ "@id": "https://w3id.org/fep/7aa9#canFeature",
619
+ "@type": "@id"
620
+ },
621
+ "featureAuthorization": {
622
+ "@id": "https://w3id.org/fep/7aa9#featureAuthorization",
623
+ "@type": "@id"
624
+ }
625
+ } };
626
+ //#endregion
602
627
  //#region src/contexts/fep-ef61.json
603
628
  var fep_ef61_default = { "@context": {
604
629
  "gateways": {
@@ -4516,6 +4541,7 @@ const preloadedContexts = {
4516
4541
  "https://w3id.org/fep/5711": fep_5711_default,
4517
4542
  "https://www.w3.org/ns/cid/v1": cid_v1_default,
4518
4543
  "https://w3id.org/fep/ef61": fep_ef61_default,
4544
+ "https://w3id.org/fep/7aa9": fep_7aa9_default,
4519
4545
  "https://join-lemmy.org/context.json": join_lemmy_default,
4520
4546
  "http://joinmastodon.org/ns": joinmastodon_default,
4521
4547
  "https://purl.archive.org/miscellany": miscellany_default
@@ -4523,7 +4549,7 @@ const preloadedContexts = {
4523
4549
  //#endregion
4524
4550
  //#region deno.json
4525
4551
  var name = "@fedify/vocab-runtime";
4526
- var version = "2.2.14-dev.2082+79cd52e9";
4552
+ var version = "2.2.15-dev.2196+10201be2";
4527
4553
  //#endregion
4528
4554
  //#region src/request.ts
4529
4555
  /**
@@ -4852,9 +4878,16 @@ var HttpHeaderLink = class HttpHeaderLink {
4852
4878
  //#endregion
4853
4879
  //#region src/url.ts
4854
4880
  var UrlError = class extends Error {
4881
+ /**
4882
+ * The failure category. Defaults to `"disallowed"`.
4883
+ * `"dns"` includes lookup errors and results with no usable IP addresses.
4884
+ * @since 2.0.29
4885
+ */
4886
+ reason;
4855
4887
  constructor(message, options) {
4856
4888
  super(message, options);
4857
4889
  this.name = "UrlError";
4890
+ this.reason = options?.reason ?? "disallowed";
4858
4891
  }
4859
4892
  };
4860
4893
  /**
@@ -4880,9 +4913,12 @@ async function validatePublicUrl(url) {
4880
4913
  }
4881
4914
  let addresses;
4882
4915
  try {
4883
- addresses = await (0, node_dns_promises.lookup)(hostname, { all: true });
4916
+ addresses = await node_dns_promises.default.lookup(hostname, { all: true });
4884
4917
  } catch (error) {
4885
- throw new UrlError("DNS lookup failed", { cause: error });
4918
+ throw new UrlError("DNS lookup failed", {
4919
+ cause: error,
4920
+ reason: "dns"
4921
+ });
4886
4922
  }
4887
4923
  validateLookupAddresses(addresses);
4888
4924
  }
@@ -4911,7 +4947,7 @@ function validateLookupAddresses(addresses) {
4911
4947
  ipAddressCount++;
4912
4948
  validatePublicIpAddress(address, family);
4913
4949
  }
4914
- if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address");
4950
+ if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address", { reason: "dns" });
4915
4951
  }
4916
4952
  function validatePublicIpAddress(address, family) {
4917
4953
  if (family === 4 && isValidPublicIPv4Address(address) || family === 6 && isValidPublicIPv6Address(address)) return;
@@ -5147,6 +5183,8 @@ async function getRemoteDocument(url, response, fetch) {
5147
5183
  }
5148
5184
  /**
5149
5185
  * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
5186
+ * At most 20 HTTP redirects and alternate document links are followed in total
5187
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
5150
5188
  *
5151
5189
  * The created loader preloads the below frequently used contexts by default
5152
5190
  * (unless `options.skipPreloadedContexts` is set to `true`):
@@ -5158,6 +5196,7 @@ async function getRemoteDocument(url, response, fetch) {
5158
5196
  * - <https://www.w3.org/ns/cid/v1>
5159
5197
  * - <https://w3id.org/security/multikey/v1>
5160
5198
  * - <https://w3id.org/fep/ef61>
5199
+ * - <https://w3id.org/fep/7aa9>
5161
5200
  * - <https://purl.archive.org/socialweb/webfinger>
5162
5201
  * - <http://schema.org/>
5163
5202
  * @param options Options for the document loader.
@@ -5181,7 +5220,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
5181
5220
  if (!allowPrivateAddress) try {
5182
5221
  await validatePublicUrl(currentUrl);
5183
5222
  } catch (error) {
5184
- if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
5223
+ if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
5224
+ url: currentUrl,
5225
+ error
5226
+ });
5227
+ else logger.error("Disallowed private URL: {url}", {
5185
5228
  url: currentUrl,
5186
5229
  error
5187
5230
  });
@@ -5219,7 +5262,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
5219
5262
  }
5220
5263
  return await load(redirectUrl, options, redirected + 1, visited);
5221
5264
  }
5222
- const result = await getRemoteDocument(currentUrl, response, load);
5265
+ const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
5266
+ options?.signal?.throwIfAborted();
5267
+ if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
5268
+ if (visited.has(alternateUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
5269
+ return await load(alternateUrl, options, redirected + 1, visited);
5270
+ });
5223
5271
  span.setAttribute("docloader.document_url", result.documentUrl);
5224
5272
  if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
5225
5273
  return result;
@@ -5235,7 +5283,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
5235
5283
  }
5236
5284
  });
5237
5285
  }
5238
- return load;
5286
+ return (url, options) => load(url, options);
5239
5287
  }
5240
5288
  //#endregion
5241
5289
  //#region src/internal/multicodec.ts
package/dist/mod.d.cts CHANGED
@@ -180,6 +180,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
180
180
  }
181
181
  /**
182
182
  * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
183
+ * At most 20 HTTP redirects and alternate document links are followed in total
184
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
183
185
  *
184
186
  * The created loader preloads the below frequently used contexts by default
185
187
  * (unless `options.skipPreloadedContexts` is set to `true`):
@@ -191,6 +193,7 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
191
193
  * - <https://www.w3.org/ns/cid/v1>
192
194
  * - <https://w3id.org/security/multikey/v1>
193
195
  * - <https://w3id.org/fep/ef61>
196
+ * - <https://w3id.org/fep/7aa9>
194
197
  * - <https://purl.archive.org/socialweb/webfinger>
195
198
  * - <http://schema.org/>
196
199
  * @param options Options for the document loader.
@@ -426,8 +429,15 @@ declare function encodingFromBaseData(data: string | Uint8Array): Base;
426
429
  //#endregion
427
430
  //#region src/url.d.ts
428
431
  declare class UrlError extends Error {
432
+ /**
433
+ * The failure category. Defaults to `"disallowed"`.
434
+ * `"dns"` includes lookup errors and results with no usable IP addresses.
435
+ * @since 2.0.29
436
+ */
437
+ readonly reason: "dns" | "disallowed";
429
438
  constructor(message: string, options?: {
430
439
  cause?: unknown;
440
+ reason?: "dns" | "disallowed";
431
441
  });
432
442
  }
433
443
  /**
package/dist/mod.d.ts CHANGED
@@ -179,6 +179,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
179
179
  }
180
180
  /**
181
181
  * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
182
+ * At most 20 HTTP redirects and alternate document links are followed in total
183
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
182
184
  *
183
185
  * The created loader preloads the below frequently used contexts by default
184
186
  * (unless `options.skipPreloadedContexts` is set to `true`):
@@ -190,6 +192,7 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
190
192
  * - <https://www.w3.org/ns/cid/v1>
191
193
  * - <https://w3id.org/security/multikey/v1>
192
194
  * - <https://w3id.org/fep/ef61>
195
+ * - <https://w3id.org/fep/7aa9>
193
196
  * - <https://purl.archive.org/socialweb/webfinger>
194
197
  * - <http://schema.org/>
195
198
  * @param options Options for the document loader.
@@ -425,8 +428,15 @@ declare function encodingFromBaseData(data: string | Uint8Array): Base;
425
428
  //#endregion
426
429
  //#region src/url.d.ts
427
430
  declare class UrlError extends Error {
431
+ /**
432
+ * The failure category. Defaults to `"disallowed"`.
433
+ * `"dns"` includes lookup errors and results with no usable IP addresses.
434
+ * @since 2.0.29
435
+ */
436
+ readonly reason: "dns" | "disallowed";
428
437
  constructor(message: string, options?: {
429
438
  cause?: unknown;
439
+ reason?: "dns" | "disallowed";
430
440
  });
431
441
  }
432
442
  /**
package/dist/mod.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { getLogger } from "@logtape/logtape";
3
3
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
4
4
  import process from "node:process";
5
- import { lookup } from "node:dns/promises";
5
+ import dns from "node:dns/promises";
6
6
  import { isIP } from "node:net";
7
7
  import { Integer, Sequence } from "asn1js";
8
8
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
@@ -595,6 +595,30 @@ var fep_5711_default = { "@context": {
595
595
  }
596
596
  } };
597
597
  //#endregion
598
+ //#region src/contexts/fep-7aa9.json
599
+ var fep_7aa9_default = { "@context": {
600
+ "FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
601
+ "FeaturedItem": "https://w3id.org/fep/7aa9#FeaturedItem",
602
+ "FeatureRequest": "https://w3id.org/fep/7aa9#FeatureRequest",
603
+ "FeatureAuthorization": "https://w3id.org/fep/7aa9#FeatureAuthorization",
604
+ "topic": {
605
+ "@id": "https://w3id.org/fep/7aa9#topic",
606
+ "@type": "@id"
607
+ },
608
+ "featuredObject": {
609
+ "@id": "https://w3id.org/fep/7aa9#featuredObject",
610
+ "@type": "@id"
611
+ },
612
+ "canFeature": {
613
+ "@id": "https://w3id.org/fep/7aa9#canFeature",
614
+ "@type": "@id"
615
+ },
616
+ "featureAuthorization": {
617
+ "@id": "https://w3id.org/fep/7aa9#featureAuthorization",
618
+ "@type": "@id"
619
+ }
620
+ } };
621
+ //#endregion
598
622
  //#region src/contexts/fep-ef61.json
599
623
  var fep_ef61_default = { "@context": {
600
624
  "gateways": {
@@ -4512,6 +4536,7 @@ const preloadedContexts = {
4512
4536
  "https://w3id.org/fep/5711": fep_5711_default,
4513
4537
  "https://www.w3.org/ns/cid/v1": cid_v1_default,
4514
4538
  "https://w3id.org/fep/ef61": fep_ef61_default,
4539
+ "https://w3id.org/fep/7aa9": fep_7aa9_default,
4515
4540
  "https://join-lemmy.org/context.json": join_lemmy_default,
4516
4541
  "http://joinmastodon.org/ns": joinmastodon_default,
4517
4542
  "https://purl.archive.org/miscellany": miscellany_default
@@ -4519,7 +4544,7 @@ const preloadedContexts = {
4519
4544
  //#endregion
4520
4545
  //#region deno.json
4521
4546
  var name = "@fedify/vocab-runtime";
4522
- var version = "2.2.14-dev.2082+79cd52e9";
4547
+ var version = "2.2.15-dev.2196+10201be2";
4523
4548
  //#endregion
4524
4549
  //#region src/request.ts
4525
4550
  /**
@@ -4848,9 +4873,16 @@ var HttpHeaderLink = class HttpHeaderLink {
4848
4873
  //#endregion
4849
4874
  //#region src/url.ts
4850
4875
  var UrlError = class extends Error {
4876
+ /**
4877
+ * The failure category. Defaults to `"disallowed"`.
4878
+ * `"dns"` includes lookup errors and results with no usable IP addresses.
4879
+ * @since 2.0.29
4880
+ */
4881
+ reason;
4851
4882
  constructor(message, options) {
4852
4883
  super(message, options);
4853
4884
  this.name = "UrlError";
4885
+ this.reason = options?.reason ?? "disallowed";
4854
4886
  }
4855
4887
  };
4856
4888
  /**
@@ -4876,9 +4908,12 @@ async function validatePublicUrl(url) {
4876
4908
  }
4877
4909
  let addresses;
4878
4910
  try {
4879
- addresses = await lookup(hostname, { all: true });
4911
+ addresses = await dns.lookup(hostname, { all: true });
4880
4912
  } catch (error) {
4881
- throw new UrlError("DNS lookup failed", { cause: error });
4913
+ throw new UrlError("DNS lookup failed", {
4914
+ cause: error,
4915
+ reason: "dns"
4916
+ });
4882
4917
  }
4883
4918
  validateLookupAddresses(addresses);
4884
4919
  }
@@ -4907,7 +4942,7 @@ function validateLookupAddresses(addresses) {
4907
4942
  ipAddressCount++;
4908
4943
  validatePublicIpAddress(address, family);
4909
4944
  }
4910
- if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address");
4945
+ if (ipAddressCount === 0) throw new UrlError("DNS lookup did not return any IP address", { reason: "dns" });
4911
4946
  }
4912
4947
  function validatePublicIpAddress(address, family) {
4913
4948
  if (family === 4 && isValidPublicIPv4Address(address) || family === 6 && isValidPublicIPv6Address(address)) return;
@@ -5143,6 +5178,8 @@ async function getRemoteDocument(url, response, fetch) {
5143
5178
  }
5144
5179
  /**
5145
5180
  * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
5181
+ * At most 20 HTTP redirects and alternate document links are followed in total
5182
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
5146
5183
  *
5147
5184
  * The created loader preloads the below frequently used contexts by default
5148
5185
  * (unless `options.skipPreloadedContexts` is set to `true`):
@@ -5154,6 +5191,7 @@ async function getRemoteDocument(url, response, fetch) {
5154
5191
  * - <https://www.w3.org/ns/cid/v1>
5155
5192
  * - <https://w3id.org/security/multikey/v1>
5156
5193
  * - <https://w3id.org/fep/ef61>
5194
+ * - <https://w3id.org/fep/7aa9>
5157
5195
  * - <https://purl.archive.org/socialweb/webfinger>
5158
5196
  * - <http://schema.org/>
5159
5197
  * @param options Options for the document loader.
@@ -5177,7 +5215,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
5177
5215
  if (!allowPrivateAddress) try {
5178
5216
  await validatePublicUrl(currentUrl);
5179
5217
  } catch (error) {
5180
- if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
5218
+ if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
5219
+ url: currentUrl,
5220
+ error
5221
+ });
5222
+ else logger.error("Disallowed private URL: {url}", {
5181
5223
  url: currentUrl,
5182
5224
  error
5183
5225
  });
@@ -5215,7 +5257,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
5215
5257
  }
5216
5258
  return await load(redirectUrl, options, redirected + 1, visited);
5217
5259
  }
5218
- const result = await getRemoteDocument(currentUrl, response, load);
5260
+ const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
5261
+ options?.signal?.throwIfAborted();
5262
+ if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
5263
+ if (visited.has(alternateUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
5264
+ return await load(alternateUrl, options, redirected + 1, visited);
5265
+ });
5219
5266
  span.setAttribute("docloader.document_url", result.documentUrl);
5220
5267
  if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
5221
5268
  return result;
@@ -5231,7 +5278,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
5231
5278
  }
5232
5279
  });
5233
5280
  }
5234
- return load;
5281
+ return (url, options) => load(url, options);
5235
5282
  }
5236
5283
  //#endregion
5237
5284
  //#region src/internal/multicodec.ts
@@ -1,4 +1,4 @@
1
- import { t as FetchError } from "./request-B6Trcv2U.mjs";
1
+ import { t as FetchError } from "./request-CBMShbeb.mjs";
2
2
  import { getLogger } from "@logtape/logtape";
3
3
  //#region src/body.ts
4
4
  /** Decoded JSON body limit: 16 MiB. @internal */
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Do9eywBl.cjs");
2
- const require_request = require("./request-CsYYOooA.cjs");
2
+ const require_request = require("./request-DwSn68eK.cjs");
3
3
  let _logtape_logtape = require("@logtape/logtape");
4
4
  //#region src/body.ts
5
5
  /** Decoded JSON body limit: 16 MiB. @internal */
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Do9eywBl.cjs");
2
- const require_body = require("./body-BM6cz3GR.cjs");
2
+ const require_body = require("./body-ekI0FyTf.cjs");
3
3
  let node_assert_strict = require("node:assert/strict");
4
4
  let node_test = require("node:test");
5
5
  let node_zlib = require("node:zlib");
@@ -1,4 +1,4 @@
1
- import { r as readBoundedText, t as BodyTooLargeError } from "./body-C6xPNNar.mjs";
1
+ import { r as readBoundedText, t as BodyTooLargeError } from "./body-ChuHxuAz.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,6 +1,6 @@
1
1
  require("./chunk-Do9eywBl.cjs");
2
- require("./docloader-CFFoEaR4.cjs");
3
- require("./url-CnyF489g.cjs");
2
+ require("./docloader-CPln0phz.cjs");
3
+ require("./url-vZTgkIZg.cjs");
4
4
  require("./key-BarKGLQz.cjs");
5
5
  require("./multibase-8zhYPa7o.cjs");
6
6
  require("./langstr-BOQHfJDr.cjs");
@@ -1,5 +1,5 @@
1
- import "./docloader-VStEAGHN.mjs";
2
- import "./url-BBfduh6o.mjs";
1
+ import "./docloader-Yp1No3S8.mjs";
2
+ import "./url-3fyJuqC0.mjs";
3
3
  import "./key-BDIsC6hV.mjs";
4
4
  import "./multibase-Ds75BvXs.mjs";
5
5
  import "./langstr-DDLc4833.mjs";
@@ -1,8 +1,8 @@
1
1
  require("./chunk-Do9eywBl.cjs");
2
- const require_request = require("./request-CsYYOooA.cjs");
3
- const require_body = require("./body-BM6cz3GR.cjs");
2
+ const require_request = require("./request-DwSn68eK.cjs");
3
+ const require_body = require("./body-ekI0FyTf.cjs");
4
4
  const require_link = require("./link-qDTmjPw_.cjs");
5
- const require_url = require("./url-CnyF489g.cjs");
5
+ const require_url = require("./url-vZTgkIZg.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
  //#region src/contexts/activitystreams.json
@@ -590,6 +590,30 @@ var fep_5711_default = { "@context": {
590
590
  }
591
591
  } };
592
592
  //#endregion
593
+ //#region src/contexts/fep-7aa9.json
594
+ var fep_7aa9_default = { "@context": {
595
+ "FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
596
+ "FeaturedItem": "https://w3id.org/fep/7aa9#FeaturedItem",
597
+ "FeatureRequest": "https://w3id.org/fep/7aa9#FeatureRequest",
598
+ "FeatureAuthorization": "https://w3id.org/fep/7aa9#FeatureAuthorization",
599
+ "topic": {
600
+ "@id": "https://w3id.org/fep/7aa9#topic",
601
+ "@type": "@id"
602
+ },
603
+ "featuredObject": {
604
+ "@id": "https://w3id.org/fep/7aa9#featuredObject",
605
+ "@type": "@id"
606
+ },
607
+ "canFeature": {
608
+ "@id": "https://w3id.org/fep/7aa9#canFeature",
609
+ "@type": "@id"
610
+ },
611
+ "featureAuthorization": {
612
+ "@id": "https://w3id.org/fep/7aa9#featureAuthorization",
613
+ "@type": "@id"
614
+ }
615
+ } };
616
+ //#endregion
593
617
  //#region src/contexts/fep-ef61.json
594
618
  var fep_ef61_default = { "@context": {
595
619
  "gateways": {
@@ -4507,6 +4531,7 @@ const preloadedContexts = {
4507
4531
  "https://w3id.org/fep/5711": fep_5711_default,
4508
4532
  "https://www.w3.org/ns/cid/v1": cid_v1_default,
4509
4533
  "https://w3id.org/fep/ef61": fep_ef61_default,
4534
+ "https://w3id.org/fep/7aa9": fep_7aa9_default,
4510
4535
  "https://join-lemmy.org/context.json": join_lemmy_default,
4511
4536
  "http://joinmastodon.org/ns": joinmastodon_default,
4512
4537
  "https://purl.archive.org/miscellany": miscellany_default
@@ -4609,6 +4634,8 @@ async function getRemoteDocument(url, response, fetch) {
4609
4634
  }
4610
4635
  /**
4611
4636
  * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
4637
+ * At most 20 HTTP redirects and alternate document links are followed in total
4638
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
4612
4639
  *
4613
4640
  * The created loader preloads the below frequently used contexts by default
4614
4641
  * (unless `options.skipPreloadedContexts` is set to `true`):
@@ -4620,6 +4647,7 @@ async function getRemoteDocument(url, response, fetch) {
4620
4647
  * - <https://www.w3.org/ns/cid/v1>
4621
4648
  * - <https://w3id.org/security/multikey/v1>
4622
4649
  * - <https://w3id.org/fep/ef61>
4650
+ * - <https://w3id.org/fep/7aa9>
4623
4651
  * - <https://purl.archive.org/socialweb/webfinger>
4624
4652
  * - <http://schema.org/>
4625
4653
  * @param options Options for the document loader.
@@ -4643,7 +4671,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
4643
4671
  if (!allowPrivateAddress) try {
4644
4672
  await require_url.validatePublicUrl(currentUrl);
4645
4673
  } catch (error) {
4646
- if (error instanceof require_url.UrlError) logger.error("Disallowed private URL: {url}", {
4674
+ if (error instanceof require_url.UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
4675
+ url: currentUrl,
4676
+ error
4677
+ });
4678
+ else logger.error("Disallowed private URL: {url}", {
4647
4679
  url: currentUrl,
4648
4680
  error
4649
4681
  });
@@ -4681,7 +4713,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
4681
4713
  }
4682
4714
  return await load(redirectUrl, options, redirected + 1, visited);
4683
4715
  }
4684
- const result = await getRemoteDocument(currentUrl, response, load);
4716
+ const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
4717
+ options?.signal?.throwIfAborted();
4718
+ if (redirected >= DEFAULT_MAX_REDIRECTION) throw new require_request.FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
4719
+ if (visited.has(alternateUrl)) throw new require_request.FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
4720
+ return await load(alternateUrl, options, redirected + 1, visited);
4721
+ });
4685
4722
  span.setAttribute("docloader.document_url", result.documentUrl);
4686
4723
  if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
4687
4724
  return result;
@@ -4697,7 +4734,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
4697
4734
  }
4698
4735
  });
4699
4736
  }
4700
- return load;
4737
+ return (url, options) => load(url, options);
4701
4738
  }
4702
4739
  //#endregion
4703
4740
  Object.defineProperty(exports, "cid_v1_default", {
@@ -1,7 +1,7 @@
1
- import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-B6Trcv2U.mjs";
2
- import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-C6xPNNar.mjs";
1
+ import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-CBMShbeb.mjs";
2
+ import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-ChuHxuAz.mjs";
3
3
  import { t as HttpHeaderLink } from "./link-CYszIegt.mjs";
4
- import { o as validatePublicUrl, t as UrlError } from "./url-BBfduh6o.mjs";
4
+ import { o as validatePublicUrl, t as UrlError } from "./url-3fyJuqC0.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  //#region src/contexts/activitystreams.json
@@ -589,6 +589,30 @@ var fep_5711_default = { "@context": {
589
589
  }
590
590
  } };
591
591
  //#endregion
592
+ //#region src/contexts/fep-7aa9.json
593
+ var fep_7aa9_default = { "@context": {
594
+ "FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
595
+ "FeaturedItem": "https://w3id.org/fep/7aa9#FeaturedItem",
596
+ "FeatureRequest": "https://w3id.org/fep/7aa9#FeatureRequest",
597
+ "FeatureAuthorization": "https://w3id.org/fep/7aa9#FeatureAuthorization",
598
+ "topic": {
599
+ "@id": "https://w3id.org/fep/7aa9#topic",
600
+ "@type": "@id"
601
+ },
602
+ "featuredObject": {
603
+ "@id": "https://w3id.org/fep/7aa9#featuredObject",
604
+ "@type": "@id"
605
+ },
606
+ "canFeature": {
607
+ "@id": "https://w3id.org/fep/7aa9#canFeature",
608
+ "@type": "@id"
609
+ },
610
+ "featureAuthorization": {
611
+ "@id": "https://w3id.org/fep/7aa9#featureAuthorization",
612
+ "@type": "@id"
613
+ }
614
+ } };
615
+ //#endregion
592
616
  //#region src/contexts/fep-ef61.json
593
617
  var fep_ef61_default = { "@context": {
594
618
  "gateways": {
@@ -4506,6 +4530,7 @@ const preloadedContexts = {
4506
4530
  "https://w3id.org/fep/5711": fep_5711_default,
4507
4531
  "https://www.w3.org/ns/cid/v1": cid_v1_default,
4508
4532
  "https://w3id.org/fep/ef61": fep_ef61_default,
4533
+ "https://w3id.org/fep/7aa9": fep_7aa9_default,
4509
4534
  "https://join-lemmy.org/context.json": join_lemmy_default,
4510
4535
  "http://joinmastodon.org/ns": joinmastodon_default,
4511
4536
  "https://purl.archive.org/miscellany": miscellany_default
@@ -4608,6 +4633,8 @@ async function getRemoteDocument(url, response, fetch) {
4608
4633
  }
4609
4634
  /**
4610
4635
  * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
4636
+ * At most 20 HTTP redirects and alternate document links are followed in total
4637
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
4611
4638
  *
4612
4639
  * The created loader preloads the below frequently used contexts by default
4613
4640
  * (unless `options.skipPreloadedContexts` is set to `true`):
@@ -4619,6 +4646,7 @@ async function getRemoteDocument(url, response, fetch) {
4619
4646
  * - <https://www.w3.org/ns/cid/v1>
4620
4647
  * - <https://w3id.org/security/multikey/v1>
4621
4648
  * - <https://w3id.org/fep/ef61>
4649
+ * - <https://w3id.org/fep/7aa9>
4622
4650
  * - <https://purl.archive.org/socialweb/webfinger>
4623
4651
  * - <http://schema.org/>
4624
4652
  * @param options Options for the document loader.
@@ -4642,7 +4670,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
4642
4670
  if (!allowPrivateAddress) try {
4643
4671
  await validatePublicUrl(currentUrl);
4644
4672
  } catch (error) {
4645
- if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
4673
+ if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
4674
+ url: currentUrl,
4675
+ error
4676
+ });
4677
+ else logger.error("Disallowed private URL: {url}", {
4646
4678
  url: currentUrl,
4647
4679
  error
4648
4680
  });
@@ -4680,7 +4712,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
4680
4712
  }
4681
4713
  return await load(redirectUrl, options, redirected + 1, visited);
4682
4714
  }
4683
- const result = await getRemoteDocument(currentUrl, response, load);
4715
+ const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
4716
+ options?.signal?.throwIfAborted();
4717
+ if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
4718
+ if (visited.has(alternateUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
4719
+ return await load(alternateUrl, options, redirected + 1, visited);
4720
+ });
4684
4721
  span.setAttribute("docloader.document_url", result.documentUrl);
4685
4722
  if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
4686
4723
  return result;
@@ -4696,7 +4733,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
4696
4733
  }
4697
4734
  });
4698
4735
  }
4699
- return load;
4736
+ return (url, options) => load(url, options);
4700
4737
  }
4701
4738
  //#endregion
4702
4739
  export { cid_v1_default as i, getRemoteDocument as n, preloadedContexts as r, getDocumentLoader as t };