@fedify/vocab-runtime 2.4.0-dev.2155 → 2.4.0-dev.2159
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 +1 -1
- package/dist/{docloader-oRpq1nQ8.d.cts → docloader-ClQraSWr.d.cts} +3 -0
- package/dist/{docloader-oRpq1nQ8.d.ts → docloader-ClQraSWr.d.ts} +3 -0
- package/dist/internal/jsonld-cache.cjs +1 -1
- package/dist/internal/jsonld-cache.d.cts +1 -1
- package/dist/internal/jsonld-cache.d.ts +1 -1
- package/dist/internal/jsonld-cache.js +1 -1
- package/dist/internal/portable-dereference.cjs +2 -2
- package/dist/internal/portable-dereference.d.cts +2 -2
- package/dist/internal/portable-dereference.d.ts +2 -2
- package/dist/internal/portable-dereference.js +2 -2
- package/dist/internal/signed-representation.cjs +1 -1
- package/dist/internal/signed-representation.js +1 -1
- package/dist/mod.cjs +18 -6
- package/dist/mod.d.cts +9 -2
- package/dist/mod.d.ts +9 -2
- package/dist/mod.js +18 -6
- package/dist/{portable-rwhiyMvY.d.ts → portable-DRtvOxTb.d.ts} +1 -1
- package/dist/{portable-Drfl02vZ.d.cts → portable-ilkFPcXa.d.cts} +1 -1
- package/dist/tests/{body-BJRBGr6n.mjs → body-BtHFjNgj.mjs} +1 -1
- package/dist/tests/{body-CLlfvGkr.cjs → body-qXqIp808.cjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/decimal.test.cjs +2 -2
- package/dist/tests/decimal.test.mjs +2 -2
- package/dist/tests/{docloader-DsoAI6Tk.mjs → docloader-D6THKCoD.mjs} +19 -7
- package/dist/tests/{docloader-s_sA2gs3.cjs → docloader-DeoYwxVw.cjs} +19 -7
- package/dist/tests/docloader.test.cjs +241 -4
- package/dist/tests/docloader.test.mjs +240 -4
- package/dist/tests/internal/portable-dereference.test.cjs +3 -3
- package/dist/tests/internal/portable-dereference.test.mjs +3 -3
- package/dist/tests/{jsonld-cache-DnZS0z1G.mjs → jsonld-cache-B7PKo3Lu.mjs} +1 -1
- package/dist/tests/{jsonld-cache-9jap4yM0.cjs → jsonld-cache-BO-QXxIc.cjs} +1 -1
- package/dist/tests/jsonld-cache.test.cjs +2 -2
- package/dist/tests/jsonld-cache.test.mjs +2 -2
- package/dist/tests/{request-BzZ8Wn6I.mjs → request-1y3WTvsB.mjs} +1 -1
- package/dist/tests/{request-Dt_khD3j.cjs → request-nfOih0SA.cjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/dist/tests/signed-representation.test.cjs +1 -1
- package/dist/tests/signed-representation.test.mjs +1 -1
- package/dist/tests/{url-DgJM9WJn.mjs → url-D7qRF-dF.mjs} +14 -4
- package/dist/tests/{url-BqlldzT8.cjs → url-gLKqAO1H.cjs} +15 -3
- package/dist/tests/url.test.cjs +36 -3
- package/dist/tests/url.test.mjs +37 -4
- package/dist/{url-CEhi4hb4.js → url-BHZYe8Vu.js} +14 -4
- package/dist/{url-Cke4irYD.cjs → url-P6l9s9dN.cjs} +15 -3
- package/package.json +1 -1
- package/src/contexts.ts +7 -1
- package/src/docloader.test.ts +307 -1
- package/src/docloader.ts +32 -7
- package/src/url.test.ts +29 -3
- package/src/url.ts +21 -5
- package/dist/{contexts-2hEbs3Qk.cjs → contexts-BK1CqBR5.cjs} +22 -22
- package/dist/{contexts-DoZUIW7y.js → contexts-DPuJ4UYL.js} +22 -22
- package/dist/tests/{contexts-BBX_qhBL.mjs → contexts-CIKsin4e.mjs} +9 -9
- package/dist/tests/{contexts-Ch3v2Cgu.cjs → contexts-DizzBjz4.cjs} +9 -9
package/deno.json
CHANGED
|
@@ -184,6 +184,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
186
186
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
187
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
188
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
187
189
|
*
|
|
188
190
|
* The created loader preloads the below frequently used contexts by default
|
|
189
191
|
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
@@ -196,6 +198,7 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
196
198
|
* - <https://www.w3.org/ns/cid/v1>
|
|
197
199
|
* - <https://w3id.org/security/multikey/v1>
|
|
198
200
|
* - <https://w3id.org/fep/ef61>
|
|
201
|
+
* - <https://w3id.org/fep/7aa9>
|
|
199
202
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
200
203
|
* - <http://schema.org/>
|
|
201
204
|
* @param options Options for the document loader.
|
|
@@ -184,6 +184,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
186
186
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
187
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
188
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
187
189
|
*
|
|
188
190
|
* The created loader preloads the below frequently used contexts by default
|
|
189
191
|
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
@@ -196,6 +198,7 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
196
198
|
* - <https://www.w3.org/ns/cid/v1>
|
|
197
199
|
* - <https://w3id.org/security/multikey/v1>
|
|
198
200
|
* - <https://w3id.org/fep/ef61>
|
|
201
|
+
* - <https://w3id.org/fep/7aa9>
|
|
199
202
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
200
203
|
* - <http://schema.org/>
|
|
201
204
|
* @param options Options for the document loader.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_url = require("../url-
|
|
3
|
+
const require_url = require("../url-P6l9s9dN.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-
|
|
2
|
+
import { a as formatIri, c as haveSameFe34Origin, l as haveSameIriOrigin } from "../url-BHZYe8Vu.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
|
-
const require_contexts = require("../contexts-
|
|
4
|
-
const require_url = require("../url-
|
|
3
|
+
const require_contexts = require("../contexts-BK1CqBR5.cjs");
|
|
4
|
+
const require_url = require("../url-P6l9s9dN.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");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as DocumentLoader, s as RemoteDocument } from "../docloader-
|
|
3
|
-
import { r as PortableObjectVerifier } from "../portable-
|
|
2
|
+
import { n as DocumentLoader, s as RemoteDocument } from "../docloader-ClQraSWr.cjs";
|
|
3
|
+
import { r as PortableObjectVerifier } from "../portable-ilkFPcXa.cjs";
|
|
4
4
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/internal/portable-dereference.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as DocumentLoader, s as RemoteDocument } from "../docloader-
|
|
3
|
-
import { r as PortableObjectVerifier } from "../portable-
|
|
2
|
+
import { n as DocumentLoader, s as RemoteDocument } from "../docloader-ClQraSWr.js";
|
|
3
|
+
import { r as PortableObjectVerifier } from "../portable-DRtvOxTb.js";
|
|
4
4
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/internal/portable-dereference.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as preloadedContexts } from "../contexts-
|
|
3
|
-
import { a as formatIri, c as haveSameFe34Origin, g as toCompatibleEf61Id, m as parseIri, o as fromCompatibleEf61Id, r as canonicalizePortableUri } from "../url-
|
|
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-BHZYe8Vu.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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_contexts = require("../contexts-
|
|
3
|
+
const require_contexts = require("../contexts-BK1CqBR5.cjs");
|
|
4
4
|
//#region src/internal/signed-representation.ts
|
|
5
5
|
const RETAINED_SIGNED_REPRESENTATION = Symbol.for("@fedify/vocab-runtime.signedRepresentation.v1");
|
|
6
6
|
const SIGNED_VALUE_SCOPE = Symbol.for("@fedify/vocab-runtime.signedValueScope.v1");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as preloadedContexts } from "../contexts-
|
|
2
|
+
import { t as preloadedContexts } from "../contexts-DPuJ4UYL.js";
|
|
3
3
|
//#region src/internal/signed-representation.ts
|
|
4
4
|
const RETAINED_SIGNED_REPRESENTATION = Symbol.for("@fedify/vocab-runtime.signedRepresentation.v1");
|
|
5
5
|
const SIGNED_VALUE_SCOPE = Symbol.for("@fedify/vocab-runtime.signedValueScope.v1");
|
package/dist/mod.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_rolldown_runtime = require("./rolldown-runtime-B7lfambq.cjs");
|
|
4
|
-
const require_contexts = require("./contexts-
|
|
5
|
-
const require_url = require("./url-
|
|
4
|
+
const require_contexts = require("./contexts-BK1CqBR5.cjs");
|
|
5
|
+
const require_url = require("./url-P6l9s9dN.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.
|
|
19
|
+
var version = "2.4.0-dev.2159+bb072eda";
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/request.ts
|
|
22
22
|
/**
|
|
@@ -476,6 +476,8 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
476
476
|
}
|
|
477
477
|
/**
|
|
478
478
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
479
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
480
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
479
481
|
*
|
|
480
482
|
* The created loader preloads the below frequently used contexts by default
|
|
481
483
|
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
@@ -488,6 +490,7 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
488
490
|
* - <https://www.w3.org/ns/cid/v1>
|
|
489
491
|
* - <https://w3id.org/security/multikey/v1>
|
|
490
492
|
* - <https://w3id.org/fep/ef61>
|
|
493
|
+
* - <https://w3id.org/fep/7aa9>
|
|
491
494
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
492
495
|
* - <http://schema.org/>
|
|
493
496
|
* @param options Options for the document loader.
|
|
@@ -511,7 +514,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
511
514
|
if (!allowPrivateAddress) try {
|
|
512
515
|
await require_url.validatePublicUrl(currentUrl);
|
|
513
516
|
} catch (error) {
|
|
514
|
-
if (error instanceof require_url.UrlError)
|
|
517
|
+
if (error instanceof require_url.UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
|
|
518
|
+
url: currentUrl,
|
|
519
|
+
error
|
|
520
|
+
});
|
|
521
|
+
else logger[options?.suppressError ? "warn" : "error"]("Disallowed private URL: {url}", {
|
|
515
522
|
url: currentUrl,
|
|
516
523
|
error
|
|
517
524
|
});
|
|
@@ -549,7 +556,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
549
556
|
}
|
|
550
557
|
return await load(redirectUrl, options, redirected + 1, visited);
|
|
551
558
|
}
|
|
552
|
-
const result = await getRemoteDocument(currentUrl, response,
|
|
559
|
+
const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
|
|
560
|
+
options?.signal?.throwIfAborted();
|
|
561
|
+
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
|
|
562
|
+
if (visited.has(alternateUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
|
|
563
|
+
return await load(alternateUrl, options, redirected + 1, visited);
|
|
564
|
+
}, options);
|
|
553
565
|
span.setAttribute("docloader.document_url", result.documentUrl);
|
|
554
566
|
if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
|
|
555
567
|
return result;
|
|
@@ -565,7 +577,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
565
577
|
}
|
|
566
578
|
});
|
|
567
579
|
}
|
|
568
|
-
return load;
|
|
580
|
+
return (url, options) => load(url, options);
|
|
569
581
|
}
|
|
570
582
|
//#endregion
|
|
571
583
|
//#region src/internal/multicodec.ts
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-
|
|
3
|
-
import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-
|
|
2
|
+
import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-ClQraSWr.cjs";
|
|
3
|
+
import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-ilkFPcXa.cjs";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/contexts.d.ts
|
|
@@ -406,8 +406,15 @@ type PropertyPreprocessor<T = unknown> = (value: Json, context: PropertyPreproce
|
|
|
406
406
|
//#endregion
|
|
407
407
|
//#region src/url.d.ts
|
|
408
408
|
declare class UrlError extends Error {
|
|
409
|
+
/**
|
|
410
|
+
* The failure category. Defaults to `"disallowed"`.
|
|
411
|
+
* `"dns"` includes lookup errors and results with no usable IP addresses.
|
|
412
|
+
* @since 2.0.29
|
|
413
|
+
*/
|
|
414
|
+
readonly reason: "dns" | "disallowed";
|
|
409
415
|
constructor(message: string, options?: {
|
|
410
416
|
cause?: unknown;
|
|
417
|
+
reason?: "dns" | "disallowed";
|
|
411
418
|
});
|
|
412
419
|
}
|
|
413
420
|
/**
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-
|
|
3
|
-
import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-
|
|
2
|
+
import { a as DocumentLoaderOptions, c as getDocumentLoader, d as FetchError, f as GetUserAgentOptions, h as logRequest, i as DocumentLoaderFactoryOptions, l as getRemoteDocument, m as getUserAgent, n as DocumentLoader, o as GetDocumentLoaderOptions, p as createActivityPubRequest, r as DocumentLoaderFactory, s as RemoteDocument, t as AuthenticatedDocumentLoaderFactory, u as CreateRequestOptions } from "./docloader-ClQraSWr.js";
|
|
3
|
+
import { i as PortableObjectVerifierOptions, n as PortableObjectVerification, r as PortableObjectVerifier, t as PortableObjectReferrer } from "./portable-DRtvOxTb.js";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
//#region src/contexts.d.ts
|
|
6
6
|
declare const preloadedContexts: Record<string, unknown>;
|
|
@@ -405,8 +405,15 @@ type PropertyPreprocessor<T = unknown> = (value: Json, context: PropertyPreproce
|
|
|
405
405
|
//#endregion
|
|
406
406
|
//#region src/url.d.ts
|
|
407
407
|
declare class UrlError extends Error {
|
|
408
|
+
/**
|
|
409
|
+
* The failure category. Defaults to `"disallowed"`.
|
|
410
|
+
* `"dns"` includes lookup errors and results with no usable IP addresses.
|
|
411
|
+
* @since 2.0.29
|
|
412
|
+
*/
|
|
413
|
+
readonly reason: "dns" | "disallowed";
|
|
408
414
|
constructor(message: string, options?: {
|
|
409
415
|
cause?: unknown;
|
|
416
|
+
reason?: "dns" | "disallowed";
|
|
410
417
|
});
|
|
411
418
|
}
|
|
412
419
|
/**
|
package/dist/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as preloadedContexts } from "./contexts-
|
|
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-
|
|
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-BHZYe8Vu.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.
|
|
15
|
+
var version = "2.4.0-dev.2159+bb072eda";
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/request.ts
|
|
18
18
|
/**
|
|
@@ -472,6 +472,8 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
474
474
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
475
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
476
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
475
477
|
*
|
|
476
478
|
* The created loader preloads the below frequently used contexts by default
|
|
477
479
|
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
@@ -484,6 +486,7 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
484
486
|
* - <https://www.w3.org/ns/cid/v1>
|
|
485
487
|
* - <https://w3id.org/security/multikey/v1>
|
|
486
488
|
* - <https://w3id.org/fep/ef61>
|
|
489
|
+
* - <https://w3id.org/fep/7aa9>
|
|
487
490
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
488
491
|
* - <http://schema.org/>
|
|
489
492
|
* @param options Options for the document loader.
|
|
@@ -507,7 +510,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
507
510
|
if (!allowPrivateAddress) try {
|
|
508
511
|
await validatePublicUrl(currentUrl);
|
|
509
512
|
} catch (error) {
|
|
510
|
-
if (error instanceof UrlError)
|
|
513
|
+
if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
|
|
514
|
+
url: currentUrl,
|
|
515
|
+
error
|
|
516
|
+
});
|
|
517
|
+
else logger[options?.suppressError ? "warn" : "error"]("Disallowed private URL: {url}", {
|
|
511
518
|
url: currentUrl,
|
|
512
519
|
error
|
|
513
520
|
});
|
|
@@ -545,7 +552,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
545
552
|
}
|
|
546
553
|
return await load(redirectUrl, options, redirected + 1, visited);
|
|
547
554
|
}
|
|
548
|
-
const result = await getRemoteDocument(currentUrl, response,
|
|
555
|
+
const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
|
|
556
|
+
options?.signal?.throwIfAborted();
|
|
557
|
+
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
|
|
558
|
+
if (visited.has(alternateUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
|
|
559
|
+
return await load(alternateUrl, options, redirected + 1, visited);
|
|
560
|
+
}, options);
|
|
549
561
|
span.setAttribute("docloader.document_url", result.documentUrl);
|
|
550
562
|
if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
|
|
551
563
|
return result;
|
|
@@ -561,7 +573,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
561
573
|
}
|
|
562
574
|
});
|
|
563
575
|
}
|
|
564
|
-
return load;
|
|
576
|
+
return (url, options) => load(url, options);
|
|
565
577
|
}
|
|
566
578
|
//#endregion
|
|
567
579
|
//#region src/internal/multicodec.ts
|
package/dist/tests/body.test.cjs
CHANGED
package/dist/tests/body.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { r as readBoundedText, t as BodyTooLargeError } from "./body-BtHFjNgj.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,8 +1,8 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
2
|
-
import { n as MAX_BODY_SIZE, r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
3
|
-
import { t as preloadedContexts } from "./contexts-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-1y3WTvsB.mjs";
|
|
2
|
+
import { n as MAX_BODY_SIZE, r as readBoundedText, t as BodyTooLargeError } from "./body-BtHFjNgj.mjs";
|
|
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-
|
|
5
|
+
import { t as UrlError, v as validatePublicUrl } from "./url-D7qRF-dF.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
//#region src/docloader.ts
|
|
@@ -132,6 +132,8 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
135
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
136
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
135
137
|
*
|
|
136
138
|
* The created loader preloads the below frequently used contexts by default
|
|
137
139
|
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
@@ -144,6 +146,7 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
144
146
|
* - <https://www.w3.org/ns/cid/v1>
|
|
145
147
|
* - <https://w3id.org/security/multikey/v1>
|
|
146
148
|
* - <https://w3id.org/fep/ef61>
|
|
149
|
+
* - <https://w3id.org/fep/7aa9>
|
|
147
150
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
148
151
|
* - <http://schema.org/>
|
|
149
152
|
* @param options Options for the document loader.
|
|
@@ -167,7 +170,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
167
170
|
if (!allowPrivateAddress) try {
|
|
168
171
|
await validatePublicUrl(currentUrl);
|
|
169
172
|
} catch (error) {
|
|
170
|
-
if (error instanceof UrlError)
|
|
173
|
+
if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
|
|
174
|
+
url: currentUrl,
|
|
175
|
+
error
|
|
176
|
+
});
|
|
177
|
+
else logger[options?.suppressError ? "warn" : "error"]("Disallowed private URL: {url}", {
|
|
171
178
|
url: currentUrl,
|
|
172
179
|
error
|
|
173
180
|
});
|
|
@@ -205,7 +212,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
205
212
|
}
|
|
206
213
|
return await load(redirectUrl, options, redirected + 1, visited);
|
|
207
214
|
}
|
|
208
|
-
const result = await getRemoteDocument(currentUrl, response,
|
|
215
|
+
const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
|
|
216
|
+
options?.signal?.throwIfAborted();
|
|
217
|
+
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
|
|
218
|
+
if (visited.has(alternateUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
|
|
219
|
+
return await load(alternateUrl, options, redirected + 1, visited);
|
|
220
|
+
}, options);
|
|
209
221
|
span.setAttribute("docloader.document_url", result.documentUrl);
|
|
210
222
|
if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
|
|
211
223
|
return result;
|
|
@@ -221,7 +233,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
221
233
|
}
|
|
222
234
|
});
|
|
223
235
|
}
|
|
224
|
-
return load;
|
|
236
|
+
return (url, options) => load(url, options);
|
|
225
237
|
}
|
|
226
238
|
//#endregion
|
|
227
239
|
export { getRemoteDocument as n, getDocumentLoader as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_request = require("./request-
|
|
2
|
-
const require_body = require("./body-
|
|
3
|
-
const require_contexts = require("./contexts-
|
|
1
|
+
const require_request = require("./request-nfOih0SA.cjs");
|
|
2
|
+
const require_body = require("./body-qXqIp808.cjs");
|
|
3
|
+
const require_contexts = require("./contexts-DizzBjz4.cjs");
|
|
4
4
|
const require_link = require("./link-DlKm8bEr.cjs");
|
|
5
|
-
const require_url = require("./url-
|
|
5
|
+
const require_url = require("./url-gLKqAO1H.cjs");
|
|
6
6
|
let _logtape_logtape = require("@logtape/logtape");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
8
8
|
//#region src/docloader.ts
|
|
@@ -132,6 +132,8 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
135
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
136
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
135
137
|
*
|
|
136
138
|
* The created loader preloads the below frequently used contexts by default
|
|
137
139
|
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
@@ -144,6 +146,7 @@ async function getRemoteDocument(url, response, fetch, options) {
|
|
|
144
146
|
* - <https://www.w3.org/ns/cid/v1>
|
|
145
147
|
* - <https://w3id.org/security/multikey/v1>
|
|
146
148
|
* - <https://w3id.org/fep/ef61>
|
|
149
|
+
* - <https://w3id.org/fep/7aa9>
|
|
147
150
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
148
151
|
* - <http://schema.org/>
|
|
149
152
|
* @param options Options for the document loader.
|
|
@@ -167,7 +170,11 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
167
170
|
if (!allowPrivateAddress) try {
|
|
168
171
|
await require_url.validatePublicUrl(currentUrl);
|
|
169
172
|
} catch (error) {
|
|
170
|
-
if (error instanceof require_url.UrlError)
|
|
173
|
+
if (error instanceof require_url.UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
|
|
174
|
+
url: currentUrl,
|
|
175
|
+
error
|
|
176
|
+
});
|
|
177
|
+
else logger[options?.suppressError ? "warn" : "error"]("Disallowed private URL: {url}", {
|
|
171
178
|
url: currentUrl,
|
|
172
179
|
error
|
|
173
180
|
});
|
|
@@ -205,7 +212,12 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
205
212
|
}
|
|
206
213
|
return await load(redirectUrl, options, redirected + 1, visited);
|
|
207
214
|
}
|
|
208
|
-
const result = await getRemoteDocument(currentUrl, response,
|
|
215
|
+
const result = await getRemoteDocument(currentUrl, response, async (alternateUrl) => {
|
|
216
|
+
options?.signal?.throwIfAborted();
|
|
217
|
+
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new require_request.FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
|
|
218
|
+
if (visited.has(alternateUrl)) throw new require_request.FetchError(currentUrl, `Redirect loop detected: ${alternateUrl}`);
|
|
219
|
+
return await load(alternateUrl, options, redirected + 1, visited);
|
|
220
|
+
}, options);
|
|
209
221
|
span.setAttribute("docloader.document_url", result.documentUrl);
|
|
210
222
|
if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
|
|
211
223
|
return result;
|
|
@@ -221,7 +233,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
221
233
|
}
|
|
222
234
|
});
|
|
223
235
|
}
|
|
224
|
-
return load;
|
|
236
|
+
return (url, options) => load(url, options);
|
|
225
237
|
}
|
|
226
238
|
//#endregion
|
|
227
239
|
Object.defineProperty(exports, "getDocumentLoader", {
|