@fedify/fedify 2.0.0-pr.445.1694 → 2.0.0-pr.451.1730
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/{actor-T6RyhRgk.d.ts → actor-Cd2CREO0.d.ts} +2 -2
- package/dist/{actor-D8gCwLzv.js → actor-Cg8ZhoVF.js} +1 -1
- package/dist/{actor-CwZ2m5rG.cjs → actor-D020hlx3.cjs} +922 -1451
- package/dist/{actor-D6K058Tb.d.cts → actor-DDhZuMGl.d.cts} +2 -2
- package/dist/{actor-DoMcqXsW.js → actor-DPD6Gbdn.js} +190 -677
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-1_skw-d2.js → builder-Dn87hy75.js} +7 -8
- package/dist/{client-bgSdkFa2.d.ts → client-Bkaw0_PR.d.ts} +1 -1
- package/dist/{client-CegPX0Rn.d.cts → client-Cle5j1T1.d.cts} +1 -1
- package/dist/{client-D5CBsPrc.js → client-D6-5okV1.js} +1 -1
- package/dist/compat/mod.d.cts +11 -11
- package/dist/compat/mod.d.ts +12 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-DiqjMRef.d.cts → context-BOYzcFSe.d.cts} +130 -97
- package/dist/{context-DBKpNBnc.d.ts → context-DqFifMwj.d.ts} +131 -98
- package/dist/{authdocloader-DYTNpaMA.js → docloader-B2BFBGqv.js} +18 -8
- package/dist/{esm-Dl5T1RNE.js → esm-CU0Dnk7T.js} +11 -11
- package/dist/federation/builder.test.js +8 -10
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +25 -26
- package/dist/federation/idempotency.test.js +25 -26
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +26 -27
- package/dist/federation/mod.cjs +10 -11
- package/dist/federation/mod.d.cts +11 -11
- package/dist/federation/mod.d.ts +13 -13
- package/dist/federation/mod.js +10 -11
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +7 -9
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/{http-D-e6AFwR.d.cts → http-B6SKO6NJ.d.cts} +2 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-BE7aFuqn.d.ts} +2 -2
- package/dist/{http-CAusBl_3.cjs → http-DMsjudj8.cjs} +289 -9
- package/dist/{http-CuS-d4U0.js → http-DN0v2zoF.js} +2 -2
- package/dist/{http-C_Qc2neP.js → http-DcDb8r1W.js} +256 -6
- package/dist/{inbox-IETv_Qez.js → inbox-CgGy7Hzc.js} +1 -1
- package/dist/{key-DnqhSgAv.js → key-jSvnymAk.js} +3 -2
- package/dist/{keycache-CSBkusP8.js → keycache-IVLjlAK9.js} +1 -1
- package/dist/{keys-D3_MDK7n.js → keys-BKM2Mqu2.js} +2 -1
- package/dist/{docloader-CYnQRIXv.cjs → kv-cache-BHIupktM.cjs} +69 -651
- package/dist/kv-cache-DNvS-egZ.js +4236 -0
- package/dist/{docloader-Czl3xV10.js → kv-cache-ydIs4Ul6.js} +68 -596
- package/dist/{ld-Isot0tiW.js → ld-CcsryBo0.js} +3 -2
- package/dist/{lookup-Dhm78GlK.js → lookup-BV3A9Zbc.js} +63 -2
- package/dist/{type-DaUr3Il7.js → lookup-BbEekiru.js} +588 -5303
- package/dist/{lookup-D6dro5Au.cjs → lookup-CMAGfQ1Q.cjs} +78 -5
- package/dist/{middleware-BuHr2fzh.js → middleware-D-vPitR-.js} +37 -38
- package/dist/{middleware-DQYscW90.js → middleware-Dm8sXYUr.js} +40 -40
- package/dist/middleware-DzA970CF.js +16 -0
- package/dist/middleware-VpoC5jyA.js +26 -0
- package/dist/middleware-W_-inBoE.cjs +16 -0
- package/dist/{middleware-Dgmdgrvb.cjs → middleware-ekn2KaOw.cjs} +57 -58
- package/dist/{mod-CxkWO3Mg.d.cts → mod--K7l84wp.d.cts} +3 -2
- package/dist/{mod-DBzN0aCM.d.ts → mod-CB80AlIA.d.ts} +1 -1
- package/dist/mod-CLKu6Uo_.d.cts +107 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-COlOrmr9.d.cts} +3 -3
- package/dist/{mod-DlU8ISoa.d.ts → mod-CRENK2dd.d.ts} +3 -2
- package/dist/{mod-D_y2y32N.d.ts → mod-CaWbCg0N.d.ts} +2 -2
- package/dist/mod-Cm97bAiT.d.ts +109 -0
- package/dist/{mod-Bpb5QLaZ.d.cts → mod-D9XZsft2.d.cts} +2 -2
- package/dist/{mod-BhUKmBJD.d.ts → mod-DLIidI_j.d.ts} +3 -3
- package/dist/{mod-jQ4OODsl.d.cts → mod-DuclhZjh.d.cts} +1 -1
- package/dist/mod.cjs +21 -32
- package/dist/mod.d.cts +14 -14
- package/dist/mod.d.ts +17 -17
- package/dist/mod.js +15 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +3 -3
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +3 -4
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-hd9lvQcP.d.ts → owner-CktUdA0h.d.ts} +3 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-dkg5OpSC.d.cts} +3 -3
- package/dist/{owner-ChSL4aJ7.js → owner-n5c_oZ_M.js} +3 -2
- package/dist/{proof-BiSCuwyA.js → proof-CLwByIT1.js} +5 -4
- package/dist/{proof-ONNmhInb.cjs → proof-CZfrp13P.cjs} +17 -16
- package/dist/{proof-x3IBewan.js → proof-CsFR7fiS.js} +2 -2
- package/dist/request-BbHkedIU.d.cts +35 -0
- package/dist/request-DKGQaofB.js +184 -0
- package/dist/request-U1t6zZtk.d.ts +39 -0
- package/dist/request-XHWUW2bi.cjs +208 -0
- package/dist/{send-D5fjmUEj.js → send-eW9JIzQV.js} +2 -2
- package/dist/sig/http.test.js +12 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +10 -11
- package/dist/sig/mod.d.cts +6 -7
- package/dist/sig/mod.d.ts +6 -7
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +122 -148
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-tWr1VQxx.js → testing-ClYSmXdi.js} +1 -2
- package/dist/{types-D2Nyz0tR.cjs → types-BT0xc4-R.cjs} +3 -3
- package/dist/{types-DQuSDtDg.js → types-DaPoJTSc.js} +1 -1
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +208 -0
- package/dist/utils/mod.cjs +14 -0
- package/dist/utils/mod.d.cts +6 -0
- package/dist/utils/mod.d.ts +8 -0
- package/dist/utils/mod.js +12 -0
- package/dist/utils/request.test.js +48 -0
- package/dist/utils/url.test.js +41 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.d.cts +4 -5
- package/dist/vocab/mod.d.ts +4 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-Dd4VMrr0.cjs → vocab-CxTuoEVd.cjs} +6 -5
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-DCBw44JZ.d.cts} +2 -21
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-ivDKb439.d.ts} +2 -21
- package/dist/{vocab-w--qk7HF.js → vocab-yFT-fQBj.js} +4 -3
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +3 -3
- package/dist/webfinger/mod.d.cts +2 -3
- package/dist/webfinger/mod.d.ts +2 -3
- package/dist/webfinger/mod.js +3 -3
- package/dist/x/cfworkers.d.cts +1 -1
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -10
- package/dist/x/hono.d.ts +11 -11
- package/dist/x/sveltekit.d.cts +10 -10
- package/dist/x/sveltekit.d.ts +11 -11
- package/package.json +16 -14
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Cv_qEn1G.js +0 -52
- package/dist/authdocloader-bsmVF6eO.cjs +0 -58
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-BNJQQm3h.js +0 -260
- package/dist/key-C_ruQbbl.js +0 -10
- package/dist/key-DIMJMxf4.cjs +0 -10
- package/dist/key-DpFjiItf.js +0 -10
- package/dist/key-DuXv64tg.cjs +0 -290
- package/dist/lookup-CbtuFbtg.js +0 -331
- package/dist/middleware-BpR6186a.js +0 -26
- package/dist/middleware-DDMxdtWM.cjs +0 -17
- package/dist/middleware-T-knSMwl.js +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.js +0 -45
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CcnIw1qY.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{federation-H2_En3j5.cjs → federation-DOuZpcAw.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-pZJsapBn.js} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-BMKIFXNW.d.cts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-Dt06smFt.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-B-ZQqbGe.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-CjsiSl7_.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CPRJk4mZ.d.ts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-B0UefMXO.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-ByTd7HpT.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DE_NC_VQ.cjs} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-Dx59zAgn.js} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{types-BSuWJsOm.js → types-C2XVl6gj.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/request.test.d.ts} +0 -0
- /package/dist/{runtime → utils}/url.test.d.ts +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-B6yXfxAQ.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-BXMGcmqK.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-C949bxcD.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-qG8R5jc3.js} +0 -0
@@ -3,10 +3,71 @@
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
|
-
const
|
6
|
+
const require_request = require('./request-XHWUW2bi.cjs');
|
7
7
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
8
8
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
9
|
+
const node_dns_promises = require_chunk.__toESM(require("node:dns/promises"));
|
10
|
+
const node_net = require_chunk.__toESM(require("node:net"));
|
9
11
|
|
12
|
+
//#region src/utils/url.ts
|
13
|
+
var UrlError = class extends Error {
|
14
|
+
constructor(message) {
|
15
|
+
super(message);
|
16
|
+
this.name = "UrlError";
|
17
|
+
}
|
18
|
+
};
|
19
|
+
/**
|
20
|
+
* Validates a URL to prevent SSRF attacks.
|
21
|
+
*/
|
22
|
+
async function validatePublicUrl(url) {
|
23
|
+
const parsed = new URL(url);
|
24
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new UrlError(`Unsupported protocol: ${parsed.protocol}`);
|
25
|
+
let hostname = parsed.hostname;
|
26
|
+
if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
|
27
|
+
if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
|
28
|
+
if ("Deno" in globalThis && !(0, node_net.isIP)(hostname)) {
|
29
|
+
const netPermission = await Deno.permissions.query({ name: "net" });
|
30
|
+
if (netPermission.state !== "granted") return;
|
31
|
+
}
|
32
|
+
if ("Bun" in globalThis) {
|
33
|
+
if (hostname === "example.com" || hostname.endsWith(".example.com")) return;
|
34
|
+
else if (hostname === "fedify-test.internal") throw new UrlError("Invalid or private address: fedify-test.internal");
|
35
|
+
}
|
36
|
+
let addresses;
|
37
|
+
try {
|
38
|
+
addresses = await (0, node_dns_promises.lookup)(hostname, { all: true });
|
39
|
+
} catch {
|
40
|
+
addresses = [];
|
41
|
+
}
|
42
|
+
for (const { address, family } of addresses) if (family === 4 && !isValidPublicIPv4Address(address) || family === 6 && !isValidPublicIPv6Address(address) || family < 4 || family === 5 || family > 6) throw new UrlError(`Invalid or private address: ${address}`);
|
43
|
+
}
|
44
|
+
function isValidPublicIPv4Address(address) {
|
45
|
+
const parts = address.split(".");
|
46
|
+
const first = parseInt(parts[0]);
|
47
|
+
if (first === 0 || first === 10 || first === 127) return false;
|
48
|
+
const second = parseInt(parts[1]);
|
49
|
+
if (first === 169 && second === 254) return false;
|
50
|
+
if (first === 172 && second >= 16 && second <= 31) return false;
|
51
|
+
if (first === 192 && second === 168) return false;
|
52
|
+
return true;
|
53
|
+
}
|
54
|
+
function isValidPublicIPv6Address(address) {
|
55
|
+
address = expandIPv6Address(address);
|
56
|
+
if (address.at(4) !== ":") return false;
|
57
|
+
const firstWord = parseInt(address.substring(0, 4), 16);
|
58
|
+
return !(firstWord >= 64512 && firstWord <= 65023 || firstWord >= 65152 && firstWord <= 65215 || firstWord === 0 || firstWord >= 65280);
|
59
|
+
}
|
60
|
+
function expandIPv6Address(address) {
|
61
|
+
address = address.toLowerCase();
|
62
|
+
if (address === "::") return "0000:0000:0000:0000:0000:0000:0000:0000";
|
63
|
+
if (address.startsWith("::")) address = "0000" + address;
|
64
|
+
if (address.endsWith("::")) address = address + "0000";
|
65
|
+
address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
|
66
|
+
const parts = address.split(":");
|
67
|
+
return parts.map((part) => part.padStart(4, "0")).join(":");
|
68
|
+
}
|
69
|
+
|
70
|
+
//#endregion
|
10
71
|
//#region src/webfinger/lookup.ts
|
11
72
|
const logger = (0, __logtape_logtape.getLogger)([
|
12
73
|
"fedify",
|
@@ -23,7 +84,7 @@ const DEFAULT_MAX_REDIRECTION = 5;
|
|
23
84
|
*/
|
24
85
|
async function lookupWebFinger(resource, options = {}) {
|
25
86
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
26
|
-
const tracer = tracerProvider.getTracer(
|
87
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
27
88
|
return await tracer.startActiveSpan("webfinger.lookup", {
|
28
89
|
kind: __opentelemetry_api.SpanKind.CLIENT,
|
29
90
|
attributes: {
|
@@ -66,9 +127,9 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
66
127
|
logger.debug("Fetching WebFinger resource descriptor from {url}...", { url: url.href });
|
67
128
|
let response;
|
68
129
|
if (options.allowPrivateAddress !== true) try {
|
69
|
-
await
|
130
|
+
await validatePublicUrl(url.href);
|
70
131
|
} catch (e) {
|
71
|
-
if (e instanceof
|
132
|
+
if (e instanceof UrlError) {
|
72
133
|
logger.error("Invalid URL for WebFinger resource descriptor: {error}", { error: e });
|
73
134
|
return null;
|
74
135
|
}
|
@@ -78,7 +139,7 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
78
139
|
response = await fetch(url, {
|
79
140
|
headers: {
|
80
141
|
Accept: "application/jrd+json",
|
81
|
-
"User-Agent": typeof options.userAgent === "string" ? options.userAgent :
|
142
|
+
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : require_request.getUserAgent(options.userAgent)
|
82
143
|
},
|
83
144
|
redirect: "manual",
|
84
145
|
signal: options.signal
|
@@ -129,9 +190,21 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
129
190
|
}
|
130
191
|
|
131
192
|
//#endregion
|
193
|
+
Object.defineProperty(exports, 'UrlError', {
|
194
|
+
enumerable: true,
|
195
|
+
get: function () {
|
196
|
+
return UrlError;
|
197
|
+
}
|
198
|
+
});
|
132
199
|
Object.defineProperty(exports, 'lookupWebFinger', {
|
133
200
|
enumerable: true,
|
134
201
|
get: function () {
|
135
202
|
return lookupWebFinger;
|
136
203
|
}
|
204
|
+
});
|
205
|
+
Object.defineProperty(exports, 'validatePublicUrl', {
|
206
|
+
enumerable: true,
|
207
|
+
get: function () {
|
208
|
+
return validatePublicUrl;
|
209
|
+
}
|
137
210
|
});
|
@@ -3,21 +3,21 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
|
6
|
-
import { deno_default
|
7
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
9
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-w--qk7HF.js";
|
6
|
+
import { deno_default } from "./request-DKGQaofB.js";
|
7
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-DPD6Gbdn.js";
|
8
|
+
import { lookupWebFinger } from "./lookup-BV3A9Zbc.js";
|
9
|
+
import { doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-DcDb8r1W.js";
|
10
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-CLwByIT1.js";
|
11
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-DaPoJTSc.js";
|
12
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-ydIs4Ul6.js";
|
13
|
+
import { lookupObject, traverseCollection } from "./vocab-yFT-fQBj.js";
|
15
14
|
import { getLogger, withContext } from "@logtape/logtape";
|
16
15
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
17
|
-
import {
|
16
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
18
17
|
import { cloneDeep } from "es-toolkit";
|
19
18
|
import { Router } from "uri-template-router";
|
20
19
|
import { parseTemplate } from "url-template";
|
20
|
+
import { encodeHex } from "byte-encodings/hex";
|
21
21
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
22
22
|
import { domainToASCII } from "node:url";
|
23
23
|
|
@@ -339,7 +339,7 @@ var FederationBuilderImpl = class {
|
|
339
339
|
this.collectionTypeIds = {};
|
340
340
|
}
|
341
341
|
async build(options) {
|
342
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
342
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-DzA970CF.js");
|
343
343
|
const f = new FederationImpl$1(options);
|
344
344
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
345
345
|
f.router = this.router.clone();
|
@@ -792,11 +792,11 @@ var FederationBuilderImpl = class {
|
|
792
792
|
};
|
793
793
|
return setters;
|
794
794
|
}
|
795
|
-
setCollectionDispatcher(name,
|
796
|
-
return this.#setCustomCollectionDispatcher(name, "collection",
|
795
|
+
setCollectionDispatcher(name, itemType, path, dispatcher) {
|
796
|
+
return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
|
797
797
|
}
|
798
|
-
setOrderedCollectionDispatcher(name,
|
799
|
-
return this.#setCustomCollectionDispatcher(name, "orderedCollection",
|
798
|
+
setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
|
799
|
+
return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
|
800
800
|
}
|
801
801
|
#setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
|
802
802
|
const strName = String(name);
|
@@ -1550,7 +1550,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
1550
1550
|
/**
|
1551
1551
|
* Handles a custom collection request.
|
1552
1552
|
* @template TItem The type of items in the collection.
|
1553
|
-
* @template
|
1553
|
+
* @template TParam The parameter names of the requested URL.
|
1554
1554
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
1555
1555
|
* @template TContextData The context data to pass to the `TContext`.
|
1556
1556
|
* @param request The HTTP request.
|
@@ -1568,7 +1568,7 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
1568
1568
|
/**
|
1569
1569
|
* Handles an ordered collection request.
|
1570
1570
|
* @template TItem The type of items in the collection.
|
1571
|
-
* @template
|
1571
|
+
* @template TParam The parameter names of the requested URL.
|
1572
1572
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
1573
1573
|
* @template TContextData The context data to pass to the `TContext`.
|
1574
1574
|
* @param request The HTTP request.
|
@@ -1588,7 +1588,7 @@ async function _handleOrderedCollection(request, { name, values, context: contex
|
|
1588
1588
|
* The main flow is on `getCollection`, `dispatch`.
|
1589
1589
|
*
|
1590
1590
|
* @template TItem The type of items in the collection.
|
1591
|
-
* @template
|
1591
|
+
* @template TParam The parameter names of the requested URL.
|
1592
1592
|
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
|
1593
1593
|
* @template TContextData The context data to pass to the `TContext`.
|
1594
1594
|
* @template TCollection The type of the collection, extending {@link Collection}.
|
@@ -1622,14 +1622,14 @@ var CustomCollectionHandler = class {
|
|
1622
1622
|
#collection = null;
|
1623
1623
|
/**
|
1624
1624
|
* Creates a new CustomCollection instance.
|
1625
|
-
* @param
|
1626
|
-
* @param
|
1627
|
-
* @param
|
1628
|
-
* @param
|
1629
|
-
* @param
|
1630
|
-
* @param
|
1631
|
-
* @param
|
1632
|
-
* @param
|
1625
|
+
* @param name The name of the collection.
|
1626
|
+
* @param values The parameter values for the collection.
|
1627
|
+
* @param context The request context.
|
1628
|
+
* @param callbacks The collection callbacks.
|
1629
|
+
* @param tracerProvider The tracer provider for telemetry.
|
1630
|
+
* @param Collection The Collection constructor.
|
1631
|
+
* @param CollectionPage The CollectionPage constructor.
|
1632
|
+
* @param filterPredicate Optional filter predicate for items.
|
1633
1633
|
*/
|
1634
1634
|
constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
1635
1635
|
this.name = name;
|
@@ -1754,7 +1754,7 @@ var CustomCollectionHandler = class {
|
|
1754
1754
|
/**
|
1755
1755
|
* Creates a function to wrap the dispatcher so tracing can be applied.
|
1756
1756
|
* @param params Parameters including cursor and total items.
|
1757
|
-
* @returns
|
1757
|
+
* @returns A function that handles the span operation.
|
1758
1758
|
*/
|
1759
1759
|
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
1760
1760
|
try {
|
@@ -1775,23 +1775,23 @@ var CustomCollectionHandler = class {
|
|
1775
1775
|
};
|
1776
1776
|
/**
|
1777
1777
|
* Dispatches the collection request to get items.
|
1778
|
-
* @param
|
1779
|
-
* @returns
|
1778
|
+
* @param cursor The cursor for pagination, or null for the first page.
|
1779
|
+
* @returns A promise that resolves to the page items.
|
1780
1780
|
*/
|
1781
1781
|
async dispatch(cursor = null) {
|
1782
1782
|
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
1783
1783
|
}
|
1784
1784
|
/**
|
1785
1785
|
* Filters the items in the collection.
|
1786
|
-
* @param
|
1787
|
-
* @returns
|
1786
|
+
* @param items The items to filter.
|
1787
|
+
* @returns The filtered items.
|
1788
1788
|
*/
|
1789
1789
|
filterItems(items) {
|
1790
1790
|
return filterCollectionItems(items, this.name, this.filterPredicate);
|
1791
1791
|
}
|
1792
1792
|
/**
|
1793
1793
|
* Appends a cursor to the URL if it exists.
|
1794
|
-
* @param
|
1794
|
+
* @param cursor The cursor to append, or null/undefined.
|
1795
1795
|
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
1796
1796
|
*/
|
1797
1797
|
appendToUrl(cursor) {
|
@@ -1799,8 +1799,7 @@ var CustomCollectionHandler = class {
|
|
1799
1799
|
}
|
1800
1800
|
/**
|
1801
1801
|
* Gets the stored collection or collection page.
|
1802
|
-
* @returns
|
1803
|
-
the collection or collection page.
|
1802
|
+
* @returns A promise that resolves to the collection or collection page.
|
1804
1803
|
*/
|
1805
1804
|
get collection() {
|
1806
1805
|
if (this.#collection === null) this.#collection = this.getCollection();
|
@@ -1808,8 +1807,8 @@ var CustomCollectionHandler = class {
|
|
1808
1807
|
}
|
1809
1808
|
/**
|
1810
1809
|
* Gets the total number of items in the collection.
|
1811
|
-
* @returns
|
1812
|
-
|
1810
|
+
* @returns A promise that resolves to the total items count,
|
1811
|
+
* or null if not available.
|
1813
1812
|
*/
|
1814
1813
|
get totalItems() {
|
1815
1814
|
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
@@ -1825,8 +1824,8 @@ var CustomCollectionHandler = class {
|
|
1825
1824
|
}
|
1826
1825
|
/**
|
1827
1826
|
* Gets the first cursor for pagination.
|
1828
|
-
* @returns
|
1829
|
-
or null if not available.
|
1827
|
+
* @returns A promise that resolves to the first cursor,
|
1828
|
+
* or null if not available.
|
1830
1829
|
*/
|
1831
1830
|
get firstCursor() {
|
1832
1831
|
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
@@ -3,23 +3,24 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage,
|
7
|
-
import { getNodeInfo } from "./client-
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import { routeActivity } from "./inbox-
|
17
|
-
import { FederationBuilderImpl } from "./builder-
|
18
|
-
import { buildCollectionSynchronizationHeader } from "./collection-
|
19
|
-
import { KvKeyCache } from "./keycache-
|
20
|
-
import { acceptsJsonLd } from "./negotiation-
|
21
|
-
import { createExponentialBackoffPolicy } from "./retry-
|
22
|
-
import { extractInboxes, sendActivity } from "./send-
|
6
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, RouterError, deno_default, getTypeId, lookupObject, lookupWebFinger, traverseCollection } from "./lookup-BbEekiru.js";
|
7
|
+
import { getNodeInfo } from "./client-D6-5okV1.js";
|
8
|
+
import { nodeInfoToJson } from "./types-C2XVl6gj.js";
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-jSvnymAk.js";
|
10
|
+
import { verifyRequest } from "./http-DN0v2zoF.js";
|
11
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-CcsryBo0.js";
|
12
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-n5c_oZ_M.js";
|
13
|
+
import { signObject, verifyObject } from "./proof-CsFR7fiS.js";
|
14
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-B2BFBGqv.js";
|
15
|
+
import { kvCache } from "./kv-cache-DNvS-egZ.js";
|
16
|
+
import { routeActivity } from "./inbox-CgGy7Hzc.js";
|
17
|
+
import { FederationBuilderImpl } from "./builder-Dn87hy75.js";
|
18
|
+
import { buildCollectionSynchronizationHeader } from "./collection-BzWsN9pB.js";
|
19
|
+
import { KvKeyCache } from "./keycache-IVLjlAK9.js";
|
20
|
+
import { acceptsJsonLd } from "./negotiation-C4nFufNk.js";
|
21
|
+
import { createExponentialBackoffPolicy } from "./retry-CfF8Gn4d.js";
|
22
|
+
import { extractInboxes, sendActivity } from "./send-eW9JIzQV.js";
|
23
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
23
24
|
import { getLogger, withContext } from "@logtape/logtape";
|
24
25
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
25
26
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
@@ -838,7 +839,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
838
839
|
/**
|
839
840
|
* Handles a custom collection request.
|
840
841
|
* @template TItem The type of items in the collection.
|
841
|
-
* @template
|
842
|
+
* @template TParam The parameter names of the requested URL.
|
842
843
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
843
844
|
* @template TContextData The context data to pass to the `TContext`.
|
844
845
|
* @param request The HTTP request.
|
@@ -856,7 +857,7 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
856
857
|
/**
|
857
858
|
* Handles an ordered collection request.
|
858
859
|
* @template TItem The type of items in the collection.
|
859
|
-
* @template
|
860
|
+
* @template TParam The parameter names of the requested URL.
|
860
861
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
861
862
|
* @template TContextData The context data to pass to the `TContext`.
|
862
863
|
* @param request The HTTP request.
|
@@ -876,7 +877,7 @@ async function _handleOrderedCollection(request, { name, values, context: contex
|
|
876
877
|
* The main flow is on `getCollection`, `dispatch`.
|
877
878
|
*
|
878
879
|
* @template TItem The type of items in the collection.
|
879
|
-
* @template
|
880
|
+
* @template TParam The parameter names of the requested URL.
|
880
881
|
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
|
881
882
|
* @template TContextData The context data to pass to the `TContext`.
|
882
883
|
* @template TCollection The type of the collection, extending {@link Collection}.
|
@@ -910,14 +911,14 @@ var CustomCollectionHandler = class {
|
|
910
911
|
#collection = null;
|
911
912
|
/**
|
912
913
|
* Creates a new CustomCollection instance.
|
913
|
-
* @param
|
914
|
-
* @param
|
915
|
-
* @param
|
916
|
-
* @param
|
917
|
-
* @param
|
918
|
-
* @param
|
919
|
-
* @param
|
920
|
-
* @param
|
914
|
+
* @param name The name of the collection.
|
915
|
+
* @param values The parameter values for the collection.
|
916
|
+
* @param context The request context.
|
917
|
+
* @param callbacks The collection callbacks.
|
918
|
+
* @param tracerProvider The tracer provider for telemetry.
|
919
|
+
* @param Collection The Collection constructor.
|
920
|
+
* @param CollectionPage The CollectionPage constructor.
|
921
|
+
* @param filterPredicate Optional filter predicate for items.
|
921
922
|
*/
|
922
923
|
constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
923
924
|
this.name = name;
|
@@ -1042,7 +1043,7 @@ var CustomCollectionHandler = class {
|
|
1042
1043
|
/**
|
1043
1044
|
* Creates a function to wrap the dispatcher so tracing can be applied.
|
1044
1045
|
* @param params Parameters including cursor and total items.
|
1045
|
-
* @returns
|
1046
|
+
* @returns A function that handles the span operation.
|
1046
1047
|
*/
|
1047
1048
|
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
1048
1049
|
try {
|
@@ -1063,23 +1064,23 @@ var CustomCollectionHandler = class {
|
|
1063
1064
|
};
|
1064
1065
|
/**
|
1065
1066
|
* Dispatches the collection request to get items.
|
1066
|
-
* @param
|
1067
|
-
* @returns
|
1067
|
+
* @param cursor The cursor for pagination, or null for the first page.
|
1068
|
+
* @returns A promise that resolves to the page items.
|
1068
1069
|
*/
|
1069
1070
|
async dispatch(cursor = null) {
|
1070
1071
|
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
1071
1072
|
}
|
1072
1073
|
/**
|
1073
1074
|
* Filters the items in the collection.
|
1074
|
-
* @param
|
1075
|
-
* @returns
|
1075
|
+
* @param items The items to filter.
|
1076
|
+
* @returns The filtered items.
|
1076
1077
|
*/
|
1077
1078
|
filterItems(items) {
|
1078
1079
|
return filterCollectionItems(items, this.name, this.filterPredicate);
|
1079
1080
|
}
|
1080
1081
|
/**
|
1081
1082
|
* Appends a cursor to the URL if it exists.
|
1082
|
-
* @param
|
1083
|
+
* @param cursor The cursor to append, or null/undefined.
|
1083
1084
|
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
1084
1085
|
*/
|
1085
1086
|
appendToUrl(cursor) {
|
@@ -1087,8 +1088,7 @@ var CustomCollectionHandler = class {
|
|
1087
1088
|
}
|
1088
1089
|
/**
|
1089
1090
|
* Gets the stored collection or collection page.
|
1090
|
-
* @returns
|
1091
|
-
the collection or collection page.
|
1091
|
+
* @returns A promise that resolves to the collection or collection page.
|
1092
1092
|
*/
|
1093
1093
|
get collection() {
|
1094
1094
|
if (this.#collection === null) this.#collection = this.getCollection();
|
@@ -1096,8 +1096,8 @@ var CustomCollectionHandler = class {
|
|
1096
1096
|
}
|
1097
1097
|
/**
|
1098
1098
|
* Gets the total number of items in the collection.
|
1099
|
-
* @returns
|
1100
|
-
|
1099
|
+
* @returns A promise that resolves to the total items count,
|
1100
|
+
* or null if not available.
|
1101
1101
|
*/
|
1102
1102
|
get totalItems() {
|
1103
1103
|
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
@@ -1113,8 +1113,8 @@ var CustomCollectionHandler = class {
|
|
1113
1113
|
}
|
1114
1114
|
/**
|
1115
1115
|
* Gets the first cursor for pagination.
|
1116
|
-
* @returns
|
1117
|
-
or null if not available.
|
1116
|
+
* @returns A promise that resolves to the first cursor,
|
1117
|
+
* or null if not available.
|
1118
1118
|
*/
|
1119
1119
|
get firstCursor() {
|
1120
1120
|
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "./transformers-BFT6d7J5.js";
|
6
|
+
import "./request-DKGQaofB.js";
|
7
|
+
import "./actor-DPD6Gbdn.js";
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-D-vPitR-.js";
|
9
|
+
import "./lookup-BV3A9Zbc.js";
|
10
|
+
import "./http-DcDb8r1W.js";
|
11
|
+
import "./proof-CLwByIT1.js";
|
12
|
+
import "./types-DaPoJTSc.js";
|
13
|
+
import "./kv-cache-ydIs4Ul6.js";
|
14
|
+
import "./vocab-yFT-fQBj.js";
|
15
|
+
|
16
|
+
export { FederationImpl };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import "./lookup-BbEekiru.js";
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-Dm8sXYUr.js";
|
8
|
+
import "./client-D6-5okV1.js";
|
9
|
+
import "./types-C2XVl6gj.js";
|
10
|
+
import "./actor-Cg8ZhoVF.js";
|
11
|
+
import "./key-jSvnymAk.js";
|
12
|
+
import "./http-DN0v2zoF.js";
|
13
|
+
import "./ld-CcsryBo0.js";
|
14
|
+
import "./owner-n5c_oZ_M.js";
|
15
|
+
import "./proof-CsFR7fiS.js";
|
16
|
+
import "./docloader-B2BFBGqv.js";
|
17
|
+
import "./kv-cache-DNvS-egZ.js";
|
18
|
+
import "./inbox-CgGy7Hzc.js";
|
19
|
+
import "./builder-Dn87hy75.js";
|
20
|
+
import "./collection-BzWsN9pB.js";
|
21
|
+
import "./keycache-IVLjlAK9.js";
|
22
|
+
import "./negotiation-C4nFufNk.js";
|
23
|
+
import "./retry-CfF8Gn4d.js";
|
24
|
+
import "./send-eW9JIzQV.js";
|
25
|
+
|
26
|
+
export { FederationImpl };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('./transformers-CoBS-oFG.cjs');
|
6
|
+
require('./request-XHWUW2bi.cjs');
|
7
|
+
require('./actor-D020hlx3.cjs');
|
8
|
+
const require_middleware = require('./middleware-ekn2KaOw.cjs');
|
9
|
+
require('./lookup-CMAGfQ1Q.cjs');
|
10
|
+
require('./http-DMsjudj8.cjs');
|
11
|
+
require('./proof-CZfrp13P.cjs');
|
12
|
+
require('./types-BT0xc4-R.cjs');
|
13
|
+
require('./kv-cache-BHIupktM.cjs');
|
14
|
+
require('./vocab-CxTuoEVd.cjs');
|
15
|
+
|
16
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|