@fedify/relay 2.4.0-dev.2115 → 2.4.0-dev.2127
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/dist/litepub.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-
|
|
4
|
+
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-jljNKcly.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { deepStrictEqual, ok, strictEqual } from "node:assert";
|
package/dist/mastodon.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-
|
|
4
|
+
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-jljNKcly.js";
|
|
5
5
|
import { MemoryKvStore, signJsonLd, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { deepStrictEqual, ok, strictEqual } from "node:assert";
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Context, KvStore, MessageQueue } from "@fedify/fedify";
|
|
3
3
|
import { Actor } from "@fedify/vocab";
|
|
4
|
-
//#region ../vocab-runtime/dist/docloader-
|
|
4
|
+
//#region ../vocab-runtime/dist/docloader-oRpq1nQ8.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Options for making `User-Agent` string.
|
|
7
7
|
* @see {@link getUserAgent}
|
|
@@ -54,6 +54,12 @@ interface DocumentLoaderOptions {
|
|
|
54
54
|
* @since 1.8.0
|
|
55
55
|
*/
|
|
56
56
|
signal?: AbortSignal;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to lower error-level logs for recoverable document loading
|
|
59
|
+
* failures to warning-level logs. The loader still throws the error.
|
|
60
|
+
* @default `false`
|
|
61
|
+
*/
|
|
62
|
+
suppressError?: boolean;
|
|
57
63
|
}
|
|
58
64
|
/**
|
|
59
65
|
* A JSON-LD document loader that fetches documents from the Web.
|
|
@@ -114,6 +120,7 @@ type AuthenticatedDocumentLoaderFactory = (identity: {
|
|
|
114
120
|
* @param url The URL of the document to load.
|
|
115
121
|
* @param response The response to get the document from.
|
|
116
122
|
* @param fetch The function to fetch the document.
|
|
123
|
+
* @param options The options for loading the document.
|
|
117
124
|
* @returns The loaded remote document.
|
|
118
125
|
* @throws {FetchError} If the response is not OK.
|
|
119
126
|
* @internal
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Context, KvStore, MessageQueue } from "@fedify/fedify";
|
|
3
3
|
import { Actor } from "@fedify/vocab";
|
|
4
|
-
//#region ../vocab-runtime/dist/docloader-
|
|
4
|
+
//#region ../vocab-runtime/dist/docloader-oRpq1nQ8.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Options for making `User-Agent` string.
|
|
7
7
|
* @see {@link getUserAgent}
|
|
@@ -54,6 +54,12 @@ interface DocumentLoaderOptions {
|
|
|
54
54
|
* @since 1.8.0
|
|
55
55
|
*/
|
|
56
56
|
signal?: AbortSignal;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to lower error-level logs for recoverable document loading
|
|
59
|
+
* failures to warning-level logs. The loader still throws the error.
|
|
60
|
+
* @default `false`
|
|
61
|
+
*/
|
|
62
|
+
suppressError?: boolean;
|
|
57
63
|
}
|
|
58
64
|
/**
|
|
59
65
|
* A JSON-LD document loader that fetches documents from the Web.
|
|
@@ -114,6 +120,7 @@ type AuthenticatedDocumentLoaderFactory = (identity: {
|
|
|
114
120
|
* @param url The URL of the document to load.
|
|
115
121
|
* @param response The response to get the document from.
|
|
116
122
|
* @param fetch The function to fetch the document.
|
|
123
|
+
* @param options The options for loading the document.
|
|
117
124
|
* @returns The loaded remote document.
|
|
118
125
|
* @throws {FetchError} If the response is not OK.
|
|
119
126
|
* @internal
|
|
@@ -26104,7 +26104,7 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
26104
26104
|
require_build();
|
|
26105
26105
|
var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
|
|
26106
26106
|
var name = "@fedify/vocab-runtime";
|
|
26107
|
-
var version = "2.4.0-dev.
|
|
26107
|
+
var version = "2.4.0-dev.2127+c41ce2eb";
|
|
26108
26108
|
/**
|
|
26109
26109
|
* Error thrown when fetching a JSON-LD document failed.
|
|
26110
26110
|
*/
|
|
@@ -26449,15 +26449,21 @@ function createResponseMetadata(response) {
|
|
|
26449
26449
|
* @param url The URL of the document to load.
|
|
26450
26450
|
* @param response The response to get the document from.
|
|
26451
26451
|
* @param fetch The function to fetch the document.
|
|
26452
|
+
* @param options The options for loading the document.
|
|
26452
26453
|
* @returns The loaded remote document.
|
|
26453
26454
|
* @throws {FetchError} If the response is not OK.
|
|
26454
26455
|
* @internal
|
|
26455
26456
|
*/
|
|
26456
|
-
async function getRemoteDocument(url, response, fetch) {
|
|
26457
|
+
async function getRemoteDocument(url, response, fetch, options) {
|
|
26457
26458
|
const documentUrl = response.url === "" ? url : response.url;
|
|
26458
26459
|
const docUrl = new URL(documentUrl);
|
|
26459
26460
|
if (!response.ok) {
|
|
26460
|
-
logger.
|
|
26461
|
+
if (options?.suppressError) logger.warn("Failed to fetch document: {status} {url} {headers}", {
|
|
26462
|
+
status: response.status,
|
|
26463
|
+
url: documentUrl,
|
|
26464
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
26465
|
+
});
|
|
26466
|
+
else logger.error("Failed to fetch document: {status} {url} {headers}", {
|
|
26461
26467
|
status: response.status,
|
|
26462
26468
|
url: documentUrl,
|
|
26463
26469
|
headers: Object.fromEntries(response.headers.entries())
|
|
@@ -26491,7 +26497,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
26491
26497
|
alternateUrl: altUri.href,
|
|
26492
26498
|
url: documentUrl
|
|
26493
26499
|
});
|
|
26494
|
-
return await fetch(altUri.href);
|
|
26500
|
+
return await fetch(altUri.href, options);
|
|
26495
26501
|
}
|
|
26496
26502
|
}
|
|
26497
26503
|
}
|
|
@@ -26527,7 +26533,7 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
26527
26533
|
alternateUrl: attribs.href,
|
|
26528
26534
|
url: documentUrl
|
|
26529
26535
|
});
|
|
26530
|
-
return await fetch(new URL(attribs.href, docUrl).href);
|
|
26536
|
+
return await fetch(new URL(attribs.href, docUrl).href, options);
|
|
26531
26537
|
}
|
|
26532
26538
|
}
|
|
26533
26539
|
try {
|
|
@@ -26585,7 +26591,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
26585
26591
|
if (!allowPrivateAddress) try {
|
|
26586
26592
|
await validatePublicUrl(currentUrl);
|
|
26587
26593
|
} catch (error) {
|
|
26588
|
-
if (error instanceof UrlError) logger
|
|
26594
|
+
if (error instanceof UrlError) logger[options?.suppressError ? "warn" : "error"]("Disallowed private URL: {url}", {
|
|
26589
26595
|
url: currentUrl,
|
|
26590
26596
|
error
|
|
26591
26597
|
});
|
|
@@ -26606,7 +26612,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
26606
26612
|
span.setAttribute("http.response.status_code", response.status);
|
|
26607
26613
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
26608
26614
|
if (redirected >= maximumRedirection) {
|
|
26609
|
-
logger
|
|
26615
|
+
logger[options?.suppressError ? "warn" : "error"]("Too many redirections ({redirections}) while fetching document.", {
|
|
26610
26616
|
redirections: redirected + 1,
|
|
26611
26617
|
url: currentUrl
|
|
26612
26618
|
});
|
|
@@ -26615,7 +26621,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
26615
26621
|
const redirectUrl = new URL(response.headers.get("Location"), response.url === "" ? currentUrl : response.url).href;
|
|
26616
26622
|
span.setAttribute("http.redirect.url", redirectUrl);
|
|
26617
26623
|
if (visited.has(redirectUrl)) {
|
|
26618
|
-
logger
|
|
26624
|
+
logger[options?.suppressError ? "warn" : "error"]("Detected a redirect loop while fetching document: {url} -> {redirectUrl}", {
|
|
26619
26625
|
url: currentUrl,
|
|
26620
26626
|
redirectUrl
|
|
26621
26627
|
});
|
|
@@ -26623,7 +26629,7 @@ function getDocumentLoader({ allowPrivateAddress, maxRedirection, skipPreloadedC
|
|
|
26623
26629
|
}
|
|
26624
26630
|
return await load(redirectUrl, options, redirected + 1, visited);
|
|
26625
26631
|
}
|
|
26626
|
-
const result = await getRemoteDocument(currentUrl, response, load);
|
|
26632
|
+
const result = await getRemoteDocument(currentUrl, response, load, options);
|
|
26627
26633
|
span.setAttribute("docloader.document_url", result.documentUrl);
|
|
26628
26634
|
if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
|
|
26629
26635
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/relay",
|
|
3
|
-
"version": "2.4.0-dev.
|
|
3
|
+
"version": "2.4.0-dev.2127+c41ce2eb",
|
|
4
4
|
"description": "ActivityPub relay support for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@logtape/logtape": "^2.2.0",
|
|
49
49
|
"temporal-polyfill": "^1.0.1",
|
|
50
|
-
"@fedify/fedify": "^2.4.0-dev.
|
|
51
|
-
"@fedify/vocab": "2.4.0-dev.
|
|
50
|
+
"@fedify/fedify": "^2.4.0-dev.2127+c41ce2eb",
|
|
51
|
+
"@fedify/vocab": "2.4.0-dev.2127+c41ce2eb"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsdown": "^0.22.0",
|
|
55
55
|
"typescript": "^6.0.0",
|
|
56
56
|
"urlpattern-polyfill": "^10.1.0",
|
|
57
|
-
"@fedify/vocab-runtime": "^2.4.0-dev.
|
|
57
|
+
"@fedify/vocab-runtime": "^2.4.0-dev.2127+c41ce2eb"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build:self": "tsdown",
|