@fedify/fedify 2.0.0-pr.451.1730 → 2.0.0-pr.451.1735
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-Cg8ZhoVF.js → actor-BlCt_BFA.js} +1 -1
- package/dist/{actor-Cd2CREO0.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-D020hlx3.cjs → actor-SSKGPs2C.cjs} +186 -187
- package/dist/{actor-DDhZuMGl.d.cts → actor-f2NtjyCg.d.cts} +2 -2
- package/dist/{actor-DPD6Gbdn.js → actor-qRieKMCS.js} +185 -186
- package/dist/{builder-Dn87hy75.js → builder-Daev8Oe3.js} +3 -3
- package/dist/{client-Cle5j1T1.d.cts → client-94iWEfQa.d.cts} +1 -1
- package/dist/{client-Bkaw0_PR.d.ts → client-BsGzbnV-.d.ts} +1 -1
- package/dist/{client-D6-5okV1.js → client-pY7-3icS.js} +1 -1
- package/dist/compat/mod.d.cts +11 -12
- package/dist/compat/mod.d.ts +11 -12
- package/dist/compat/transformers.test.js +16 -16
- package/dist/{context-BOYzcFSe.d.cts → context-BvYz3eOb.d.cts} +11 -11
- package/dist/{context-DqFifMwj.d.ts → context-myrGWbL_.d.ts} +11 -11
- package/dist/{docloader-B2BFBGqv.js → docloader-CuY-IQHN.js} +4 -5
- package/dist/{esm-CU0Dnk7T.js → esm-CO0P-prF.js} +1 -1
- package/dist/federation/builder.test.js +4 -4
- package/dist/federation/collection.test.js +2 -2
- package/dist/federation/handler.test.js +17 -17
- package/dist/federation/idempotency.test.js +17 -17
- package/dist/federation/inbox.test.js +3 -3
- package/dist/federation/keycache.test.js +3 -3
- package/dist/federation/kv.test.js +2 -2
- package/dist/federation/middleware.test.js +18 -18
- package/dist/federation/mod.cjs +9 -10
- package/dist/federation/mod.d.cts +11 -12
- package/dist/federation/mod.d.ts +11 -12
- package/dist/federation/mod.js +9 -10
- package/dist/federation/mq.test.js +2 -2
- package/dist/federation/negotiation.test.js +2 -2
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +2 -2
- package/dist/federation/send.test.js +9 -9
- package/dist/{http-DN0v2zoF.js → http--W_KqmV8.js} +2 -2
- package/dist/{http-BE7aFuqn.d.ts → http-BbO0ejuk.d.ts} +1 -1
- package/dist/{http-DMsjudj8.cjs → http-CZRSpr-0.cjs} +5 -5
- package/dist/{http-B6SKO6NJ.d.cts → http-M8k5mKc0.d.cts} +1 -1
- package/dist/{http-DcDb8r1W.js → http-cj5p1nm9.js} +2 -2
- package/dist/{inbox-CgGy7Hzc.js → inbox-DCOu4Fxg.js} +1 -1
- package/dist/{key-jSvnymAk.js → key-CLBIsQ2b.js} +2 -2
- package/dist/{keycache-IVLjlAK9.js → keycache-C_E92fAZ.js} +1 -1
- package/dist/{keys-BKM2Mqu2.js → keys-CESa8pOV.js} +1 -1
- package/dist/kv-cache-6gn8hq87.cjs +133 -0
- package/dist/kv-cache-D6OS46Qp.js +121 -0
- package/dist/kv-cache-z0lgwFi_.js +93 -0
- package/dist/{ld-CcsryBo0.js → ld-uohK5TcN.js} +2 -2
- package/dist/{lookup-BV3A9Zbc.js → lookup-B4NiLSoR.js} +129 -60
- package/dist/{lookup-BbEekiru.js → lookup-Bp3gBRGD.js} +188 -297
- package/dist/lookup-CfVdYD74.cjs +273 -0
- package/dist/{middleware-ekn2KaOw.cjs → middleware-B5t3REnT.cjs} +18 -19
- package/dist/middleware-B86mRO81.cjs +15 -0
- package/dist/{middleware-D-vPitR-.js → middleware-BEWbWO0t.js} +8 -9
- package/dist/middleware-BzGmhttT.js +26 -0
- package/dist/middleware-DxFOBA0V.js +15 -0
- package/dist/{middleware-Dm8sXYUr.js → middleware-yd4xq6Dt.js} +13 -13
- package/dist/{mod-DLIidI_j.d.ts → mod-B2iOw50L.d.ts} +2 -2
- package/dist/{mod-Cm97bAiT.d.ts → mod-BYynOiJG.d.ts} +2 -2
- package/dist/{mod-CRENK2dd.d.ts → mod-BlVovdcy.d.ts} +2 -3
- package/dist/{mod--K7l84wp.d.cts → mod-BxRCHTz-.d.cts} +2 -3
- package/dist/{mod-DuclhZjh.d.cts → mod-C58MZ7Wx.d.cts} +1 -1
- package/dist/{mod-D9XZsft2.d.cts → mod-DbFNTF7m.d.cts} +2 -2
- package/dist/{mod-COlOrmr9.d.cts → mod-DgdBYYa0.d.cts} +2 -2
- package/dist/{mod-CB80AlIA.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
- package/dist/{mod-CLKu6Uo_.d.cts → mod-VastcQsk.d.cts} +2 -2
- package/dist/{mod-CaWbCg0N.d.ts → mod-k0Dk3fGk.d.ts} +2 -2
- package/dist/mod.cjs +13 -15
- package/dist/mod.d.cts +15 -16
- package/dist/mod.d.ts +16 -17
- package/dist/mod.js +14 -15
- package/dist/nodeinfo/client.test.js +4 -4
- package/dist/nodeinfo/handler.test.js +16 -16
- package/dist/nodeinfo/mod.cjs +2 -3
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/types.test.js +2 -2
- package/dist/{owner-dkg5OpSC.d.cts → owner-B4HbyP8s.d.cts} +2 -2
- package/dist/{owner-n5c_oZ_M.js → owner-DMwt6EnB.js} +2 -2
- package/dist/{owner-CktUdA0h.d.ts → owner-kQRGVXG1.d.ts} +2 -2
- package/dist/{proof-CLwByIT1.js → proof-BRMzWGtg.js} +3 -3
- package/dist/{proof-CZfrp13P.cjs → proof-DVvnQ6WP.cjs} +7 -7
- package/dist/{proof-CsFR7fiS.js → proof-X6v_1MA6.js} +2 -2
- package/dist/{send-eW9JIzQV.js → send-Cy3TUzxE.js} +2 -2
- package/dist/sig/http.test.js +7 -7
- package/dist/sig/key.test.js +5 -5
- package/dist/sig/ld.test.js +6 -6
- package/dist/sig/mod.cjs +5 -6
- package/dist/sig/mod.d.cts +5 -6
- package/dist/sig/mod.d.ts +5 -6
- package/dist/sig/mod.js +5 -6
- package/dist/sig/owner.test.js +6 -6
- package/dist/sig/proof.test.js +6 -6
- package/dist/testing/docloader.test.js +2 -2
- package/dist/testing/mod.d.ts +1 -27
- package/dist/testing/mod.js +2 -2
- package/dist/{testing-ClYSmXdi.js → testing-BJJvJvZe.js} +1 -1
- package/dist/{types-DaPoJTSc.js → types-BtUjyi5y.js} +1 -1
- package/dist/{types-BT0xc4-R.cjs → types-CWgzGaqk.cjs} +3 -3
- package/dist/utils/docloader.test.js +9 -8
- package/dist/utils/kv-cache.test.js +4 -3
- package/dist/utils/mod.cjs +5 -7
- package/dist/utils/mod.d.cts +5 -6
- package/dist/utils/mod.d.ts +5 -6
- package/dist/utils/mod.js +6 -7
- package/dist/vocab/actor.test.js +4 -4
- package/dist/vocab/lookup.test.js +3 -3
- package/dist/vocab/mod.cjs +3 -4
- package/dist/vocab/mod.d.cts +3 -4
- package/dist/vocab/mod.d.ts +3 -4
- package/dist/vocab/mod.js +3 -4
- package/dist/vocab/type.test.js +2 -2
- package/dist/vocab/vocab.test.js +3 -3
- package/dist/{vocab-CxTuoEVd.cjs → vocab-BPtsEU8k.cjs} +3 -4
- package/dist/{vocab-yFT-fQBj.js → vocab-DFaqbY9O.js} +2 -3
- package/dist/webfinger/handler.test.js +16 -16
- package/dist/webfinger/lookup.test.js +3 -3
- package/dist/webfinger/mod.cjs +2 -3
- package/dist/webfinger/mod.d.cts +1 -2
- package/dist/webfinger/mod.d.ts +1 -2
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/cfworkers.d.cts +2 -2
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +2 -2
- package/dist/x/hono.d.cts +10 -11
- package/dist/x/hono.d.ts +10 -11
- package/dist/x/sveltekit.d.cts +10 -11
- package/dist/x/sveltekit.d.ts +10 -11
- package/package.json +2 -3
- package/dist/kv-cache-BHIupktM.cjs +0 -4279
- package/dist/kv-cache-DNvS-egZ.js +0 -4236
- package/dist/kv-cache-ydIs4Ul6.js +0 -4267
- package/dist/lookup-CMAGfQ1Q.cjs +0 -210
- package/dist/middleware-DzA970CF.js +0 -16
- package/dist/middleware-VpoC5jyA.js +0 -26
- package/dist/middleware-W_-inBoE.cjs +0 -16
- package/dist/request-BbHkedIU.d.cts +0 -35
- package/dist/request-DKGQaofB.js +0 -184
- package/dist/request-U1t6zZtk.d.ts +0 -39
- package/dist/request-XHWUW2bi.cjs +0 -208
- package/dist/utils/request.test.d.ts +0 -3
- package/dist/utils/request.test.js +0 -48
- package/dist/utils/url.test.d.ts +0 -3
- package/dist/utils/url.test.js +0 -41
- /package/dist/{federation-DOuZpcAw.cjs → federation-CRpdnOMS.cjs} +0 -0
- /package/dist/{federation-pZJsapBn.js → federation-jcR8-ZxP.js} +0 -0
- /package/dist/{kv-Dt06smFt.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
- /package/dist/{kv-BMKIFXNW.d.cts → kv-Bxr0Q87_.d.cts} +0 -0
- /package/dist/{mod-FZd39qVq.d.cts → mod-B-hUPT2N.d.cts} +0 -0
- /package/dist/{mod-B-ZQqbGe.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-CjsiSl7_.d.ts → mod-xIj-IT58.d.ts} +0 -0
- /package/dist/{mq-CPRJk4mZ.d.ts → mq-CUKlBw08.d.ts} +0 -0
- /package/dist/{mq-B7R1Q-M5.d.cts → mq-DcJPkXD5.d.cts} +0 -0
- /package/dist/{nodeinfo-B0UefMXO.js → nodeinfo-BnthBobC.js} +0 -0
- /package/dist/{nodeinfo-ByTd7HpT.cjs → nodeinfo-CdN0rEnZ.cjs} +0 -0
- /package/dist/{sig-Dx59zAgn.js → sig-C34-oHBl.js} +0 -0
- /package/dist/{sig-DE_NC_VQ.cjs → sig-YYj5tCnr.cjs} +0 -0
- /package/dist/{utils-BXMGcmqK.js → utils-D-Va7aXC.js} +0 -0
- /package/dist/{utils-B6yXfxAQ.cjs → utils-DyRU1gdZ.cjs} +0 -0
- /package/dist/{vocab-ivDKb439.d.ts → vocab-BCWe1Ih5.d.ts} +0 -0
- /package/dist/{vocab-DCBw44JZ.d.cts → vocab-CeDBzu-f.d.cts} +0 -0
- /package/dist/{webfinger-qG8R5jc3.js → webfinger-C72Y8lrh.js} +0 -0
- /package/dist/{webfinger-C949bxcD.cjs → webfinger-vAtLmxOF.cjs} +0 -0
package/dist/federation/mod.js
CHANGED
@@ -3,15 +3,14 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import "../transformers-BFT6d7J5.js";
|
6
|
-
import "../
|
7
|
-
import "../actor-
|
8
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
9
|
-
import "../
|
10
|
-
import "../
|
11
|
-
import "../
|
12
|
-
import
|
13
|
-
import "../
|
14
|
-
import "../
|
15
|
-
import "../vocab-yFT-fQBj.js";
|
6
|
+
import "../lookup-B4NiLSoR.js";
|
7
|
+
import "../actor-qRieKMCS.js";
|
8
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BEWbWO0t.js";
|
9
|
+
import "../http-cj5p1nm9.js";
|
10
|
+
import "../proof-BRMzWGtg.js";
|
11
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-jcR8-ZxP.js";
|
12
|
+
import "../types-BtUjyi5y.js";
|
13
|
+
import "../kv-cache-D6OS46Qp.js";
|
14
|
+
import "../vocab-DFaqbY9O.js";
|
16
15
|
|
17
16
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
@@ -3,11 +3,11 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../lookup-
|
6
|
+
import "../lookup-Bp3gBRGD.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import { test } from "../testing-
|
10
|
+
import { test } from "../testing-BJJvJvZe.js";
|
11
11
|
import { assertGreater, assertGreaterOrEqual } from "../std__assert-DWivtrGR.js";
|
12
12
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
13
13
|
import "../assert_throws-BNXdRGWP.js";
|
@@ -3,12 +3,12 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../lookup-
|
6
|
+
import "../lookup-Bp3gBRGD.js";
|
7
7
|
import "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { acceptsJsonLd } from "../negotiation-C4nFufNk.js";
|
11
|
-
import { test } from "../testing-
|
11
|
+
import { test } from "../testing-BJJvJvZe.js";
|
12
12
|
import "../std__assert-DWivtrGR.js";
|
13
13
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
14
14
|
import "../assert_throws-BNXdRGWP.js";
|
@@ -3,10 +3,10 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../lookup-
|
6
|
+
import "../lookup-Bp3gBRGD.js";
|
7
7
|
import { AssertionError, assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { createExponentialBackoffPolicy } from "../retry-CfF8Gn4d.js";
|
9
|
-
import { test } from "../testing-
|
9
|
+
import { test } from "../testing-BJJvJvZe.js";
|
10
10
|
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
11
11
|
|
12
12
|
//#region src/federation/retry.test.ts
|
@@ -3,11 +3,11 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Router, RouterError } from "../lookup-
|
6
|
+
import { Router, RouterError } from "../lookup-Bp3gBRGD.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import { test } from "../testing-
|
10
|
+
import { test } from "../testing-BJJvJvZe.js";
|
11
11
|
import "../std__assert-DWivtrGR.js";
|
12
12
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
13
13
|
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
@@ -3,22 +3,22 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Application, Endpoints, Group, Person, Service } from "../lookup-
|
6
|
+
import { Activity, Application, Endpoints, Group, Person, Service } from "../lookup-Bp3gBRGD.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../actor-
|
11
|
-
import "../key-
|
12
|
-
import { verifyRequest } from "../http
|
13
|
-
import { doesActorOwnKey } from "../owner-
|
14
|
-
import { extractInboxes, sendActivity } from "../send-
|
15
|
-
import { mockDocumentLoader, test } from "../testing-
|
10
|
+
import "../actor-BlCt_BFA.js";
|
11
|
+
import "../key-CLBIsQ2b.js";
|
12
|
+
import { verifyRequest } from "../http--W_KqmV8.js";
|
13
|
+
import { doesActorOwnKey } from "../owner-DMwt6EnB.js";
|
14
|
+
import { extractInboxes, sendActivity } from "../send-Cy3TUzxE.js";
|
15
|
+
import { mockDocumentLoader, test } from "../testing-BJJvJvZe.js";
|
16
16
|
import "../std__assert-DWivtrGR.js";
|
17
17
|
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
18
18
|
import "../assert_throws-BNXdRGWP.js";
|
19
19
|
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
20
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
21
|
-
import { esm_default } from "../esm-
|
20
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-CESa8pOV.js";
|
21
|
+
import { esm_default } from "../esm-CO0P-prF.js";
|
22
22
|
|
23
23
|
//#region src/federation/send.test.ts
|
24
24
|
test("extractInboxes()", () => {
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, deno_default } from "./lookup-
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
6
|
+
import { CryptographicKey, deno_default } from "./lookup-Bp3gBRGD.js";
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-CLBIsQ2b.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
10
10
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { CryptographicKey, Multikey } from "./vocab-
|
3
|
+
import { CryptographicKey, Multikey } from "./vocab-BCWe1Ih5.js";
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
5
5
|
import { DocumentLoader } from "@fedify/vocab-runtime";
|
6
6
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
|
-
const
|
7
|
-
const require_actor = require('./actor-
|
6
|
+
const require_lookup = require('./lookup-CfVdYD74.cjs');
|
7
|
+
const require_actor = require('./actor-SSKGPs2C.cjs');
|
8
8
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
9
9
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
10
10
|
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
@@ -108,7 +108,7 @@ async function importJwk(jwk, type) {
|
|
108
108
|
*/
|
109
109
|
function fetchKey(keyId, cls, options = {}) {
|
110
110
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
111
|
-
const tracer = tracerProvider.getTracer(
|
111
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
112
112
|
keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
|
113
113
|
return tracer.startActiveSpan("activitypub.fetch_key", {
|
114
114
|
kind: __opentelemetry_api.SpanKind.CLIENT,
|
@@ -276,7 +276,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
276
276
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
277
277
|
validateCryptoKey(privateKey, "private");
|
278
278
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
279
|
-
const tracer = tracerProvider.getTracer(
|
279
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
280
280
|
return await tracer.startActiveSpan("http_signatures.sign", async (span) => {
|
281
281
|
try {
|
282
282
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
@@ -505,7 +505,7 @@ const supportedHashAlgorithms = {
|
|
505
505
|
*/
|
506
506
|
async function verifyRequest(request, options = {}) {
|
507
507
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
508
|
-
const tracer = tracerProvider.getTracer(
|
508
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
509
509
|
return await tracer.startActiveSpan("http_signatures.verify", async (span) => {
|
510
510
|
if (span.isRecording()) {
|
511
511
|
span.setAttribute(__opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD, request.method);
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { deno_default } from "./
|
6
|
-
import { CryptographicKey, Object as Object$1, isActor } from "./actor-
|
5
|
+
import { deno_default } from "./lookup-B4NiLSoR.js";
|
6
|
+
import { CryptographicKey, Object as Object$1, isActor } from "./actor-qRieKMCS.js";
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
9
9
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, deno_default, getTypeId } from "./lookup-
|
6
|
+
import { Activity, deno_default, getTypeId } from "./lookup-Bp3gBRGD.js";
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
8
8
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
9
9
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-
|
7
|
-
import { isActor } from "./actor-
|
6
|
+
import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-Bp3gBRGD.js";
|
7
|
+
import { isActor } from "./actor-BlCt_BFA.js";
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, Multikey } from "./lookup-
|
6
|
+
import { CryptographicKey, Multikey } from "./lookup-Bp3gBRGD.js";
|
7
7
|
|
8
8
|
//#region src/federation/keycache.ts
|
9
9
|
var KvKeyCache = class {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, Multikey } from "./lookup-
|
6
|
+
import { CryptographicKey, Multikey } from "./lookup-Bp3gBRGD.js";
|
7
7
|
import { importSpki } from "@fedify/vocab-runtime";
|
8
8
|
|
9
9
|
//#region src/testing/keys.ts
|
@@ -0,0 +1,133 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
|
+
const require_http = require('./http-CZRSpr-0.cjs');
|
7
|
+
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
8
|
+
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
9
|
+
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
10
|
+
|
11
|
+
//#region src/utils/docloader.ts
|
12
|
+
const logger$1 = (0, __logtape_logtape.getLogger)([
|
13
|
+
"fedify",
|
14
|
+
"utils",
|
15
|
+
"docloader"
|
16
|
+
]);
|
17
|
+
/**
|
18
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
19
|
+
* Note that an authenticated document loader intentionally does not cache
|
20
|
+
* the fetched documents.
|
21
|
+
* @param identity The identity to get the document loader for.
|
22
|
+
* The actor's key pair.
|
23
|
+
* @param options The options for the document loader.
|
24
|
+
* @returns The authenticated document loader.
|
25
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
26
|
+
* @since 0.4.0
|
27
|
+
*/
|
28
|
+
function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
|
29
|
+
require_http.validateCryptoKey(identity.privateKey);
|
30
|
+
async function load(url, options) {
|
31
|
+
if (!allowPrivateAddress) try {
|
32
|
+
await (0, __fedify_vocab_runtime.validatePublicUrl)(url);
|
33
|
+
} catch (error) {
|
34
|
+
if (error instanceof __fedify_vocab_runtime.UrlError) logger$1.error("Disallowed private URL: {url}", {
|
35
|
+
url,
|
36
|
+
error
|
37
|
+
});
|
38
|
+
throw error;
|
39
|
+
}
|
40
|
+
const originalRequest = (0, __fedify_vocab_runtime.createActivityPubRequest)(url, { userAgent });
|
41
|
+
const response = await require_http.doubleKnock(originalRequest, identity, {
|
42
|
+
specDeterminer,
|
43
|
+
log: (0, es_toolkit.curry)(__fedify_vocab_runtime.logRequest)(logger$1),
|
44
|
+
tracerProvider,
|
45
|
+
signal: options?.signal
|
46
|
+
});
|
47
|
+
return (0, __fedify_vocab_runtime.getRemoteDocument)(url, response, load);
|
48
|
+
}
|
49
|
+
return load;
|
50
|
+
}
|
51
|
+
const _fetchDocumentLoader = (0, __fedify_vocab_runtime.getDocumentLoader)();
|
52
|
+
const _fetchDocumentLoader_allowPrivateAddress = (0, __fedify_vocab_runtime.getDocumentLoader)({ allowPrivateAddress: true });
|
53
|
+
|
54
|
+
//#endregion
|
55
|
+
//#region src/utils/kv-cache.ts
|
56
|
+
const logger = (0, __logtape_logtape.getLogger)([
|
57
|
+
"fedify",
|
58
|
+
"utils",
|
59
|
+
"kv-cache"
|
60
|
+
]);
|
61
|
+
/**
|
62
|
+
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
63
|
+
* @param parameters The parameters for the cache.
|
64
|
+
* @returns The decorated document loader which is cache-enabled.
|
65
|
+
*/
|
66
|
+
function kvCache({ loader, kv, prefix, rules }) {
|
67
|
+
const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
|
68
|
+
rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
|
69
|
+
for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
|
70
|
+
return async (url, options) => {
|
71
|
+
if (url in __fedify_vocab_runtime.preloadedContexts) {
|
72
|
+
logger.debug("Using preloaded context: {url}.", { url });
|
73
|
+
return {
|
74
|
+
contextUrl: null,
|
75
|
+
document: __fedify_vocab_runtime.preloadedContexts[url],
|
76
|
+
documentUrl: url
|
77
|
+
};
|
78
|
+
}
|
79
|
+
const match = matchRule(url, rules);
|
80
|
+
if (match == null) return await loader(url, options);
|
81
|
+
const key = [...keyPrefix, url];
|
82
|
+
let cache = void 0;
|
83
|
+
try {
|
84
|
+
cache = await kv.get(key);
|
85
|
+
} catch (error) {
|
86
|
+
if (error instanceof Error) logger.warn("Failed to get the document of {url} from the KV cache: {error}", {
|
87
|
+
url,
|
88
|
+
error
|
89
|
+
});
|
90
|
+
}
|
91
|
+
if (cache == null) {
|
92
|
+
const remoteDoc = await loader(url, options);
|
93
|
+
try {
|
94
|
+
await kv.set(key, remoteDoc, { ttl: match });
|
95
|
+
} catch (error) {
|
96
|
+
logger.warn("Failed to save the document of {url} to the KV cache: {error}", {
|
97
|
+
url,
|
98
|
+
error
|
99
|
+
});
|
100
|
+
}
|
101
|
+
return remoteDoc;
|
102
|
+
}
|
103
|
+
return cache;
|
104
|
+
};
|
105
|
+
}
|
106
|
+
function matchRule(url, rules) {
|
107
|
+
for (const [pattern, duration] of rules) {
|
108
|
+
if (typeof pattern === "string") {
|
109
|
+
if (url === pattern) return duration;
|
110
|
+
continue;
|
111
|
+
}
|
112
|
+
if (pattern instanceof URL) {
|
113
|
+
if (pattern.href == url) return duration;
|
114
|
+
continue;
|
115
|
+
}
|
116
|
+
if (pattern.test(url)) return duration;
|
117
|
+
}
|
118
|
+
return null;
|
119
|
+
}
|
120
|
+
|
121
|
+
//#endregion
|
122
|
+
Object.defineProperty(exports, 'getAuthenticatedDocumentLoader', {
|
123
|
+
enumerable: true,
|
124
|
+
get: function () {
|
125
|
+
return getAuthenticatedDocumentLoader;
|
126
|
+
}
|
127
|
+
});
|
128
|
+
Object.defineProperty(exports, 'kvCache', {
|
129
|
+
enumerable: true,
|
130
|
+
get: function () {
|
131
|
+
return kvCache;
|
132
|
+
}
|
133
|
+
});
|
@@ -0,0 +1,121 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import { doubleKnock, validateCryptoKey } from "./http-cj5p1nm9.js";
|
6
|
+
import { getLogger } from "@logtape/logtape";
|
7
|
+
import { UrlError, createActivityPubRequest, getDocumentLoader, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
8
|
+
import { curry } from "es-toolkit";
|
9
|
+
|
10
|
+
//#region src/utils/docloader.ts
|
11
|
+
const logger$1 = getLogger([
|
12
|
+
"fedify",
|
13
|
+
"utils",
|
14
|
+
"docloader"
|
15
|
+
]);
|
16
|
+
/**
|
17
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
18
|
+
* Note that an authenticated document loader intentionally does not cache
|
19
|
+
* the fetched documents.
|
20
|
+
* @param identity The identity to get the document loader for.
|
21
|
+
* The actor's key pair.
|
22
|
+
* @param options The options for the document loader.
|
23
|
+
* @returns The authenticated document loader.
|
24
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
25
|
+
* @since 0.4.0
|
26
|
+
*/
|
27
|
+
function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
|
28
|
+
validateCryptoKey(identity.privateKey);
|
29
|
+
async function load(url, options) {
|
30
|
+
if (!allowPrivateAddress) try {
|
31
|
+
await validatePublicUrl(url);
|
32
|
+
} catch (error) {
|
33
|
+
if (error instanceof UrlError) logger$1.error("Disallowed private URL: {url}", {
|
34
|
+
url,
|
35
|
+
error
|
36
|
+
});
|
37
|
+
throw error;
|
38
|
+
}
|
39
|
+
const originalRequest = createActivityPubRequest(url, { userAgent });
|
40
|
+
const response = await doubleKnock(originalRequest, identity, {
|
41
|
+
specDeterminer,
|
42
|
+
log: curry(logRequest)(logger$1),
|
43
|
+
tracerProvider,
|
44
|
+
signal: options?.signal
|
45
|
+
});
|
46
|
+
return getRemoteDocument(url, response, load);
|
47
|
+
}
|
48
|
+
return load;
|
49
|
+
}
|
50
|
+
const _fetchDocumentLoader = getDocumentLoader();
|
51
|
+
const _fetchDocumentLoader_allowPrivateAddress = getDocumentLoader({ allowPrivateAddress: true });
|
52
|
+
|
53
|
+
//#endregion
|
54
|
+
//#region src/utils/kv-cache.ts
|
55
|
+
const logger = getLogger([
|
56
|
+
"fedify",
|
57
|
+
"utils",
|
58
|
+
"kv-cache"
|
59
|
+
]);
|
60
|
+
/**
|
61
|
+
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
62
|
+
* @param parameters The parameters for the cache.
|
63
|
+
* @returns The decorated document loader which is cache-enabled.
|
64
|
+
*/
|
65
|
+
function kvCache({ loader, kv, prefix, rules }) {
|
66
|
+
const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
|
67
|
+
rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
|
68
|
+
for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
|
69
|
+
return async (url, options) => {
|
70
|
+
if (url in preloadedContexts) {
|
71
|
+
logger.debug("Using preloaded context: {url}.", { url });
|
72
|
+
return {
|
73
|
+
contextUrl: null,
|
74
|
+
document: preloadedContexts[url],
|
75
|
+
documentUrl: url
|
76
|
+
};
|
77
|
+
}
|
78
|
+
const match = matchRule(url, rules);
|
79
|
+
if (match == null) return await loader(url, options);
|
80
|
+
const key = [...keyPrefix, url];
|
81
|
+
let cache = void 0;
|
82
|
+
try {
|
83
|
+
cache = await kv.get(key);
|
84
|
+
} catch (error) {
|
85
|
+
if (error instanceof Error) logger.warn("Failed to get the document of {url} from the KV cache: {error}", {
|
86
|
+
url,
|
87
|
+
error
|
88
|
+
});
|
89
|
+
}
|
90
|
+
if (cache == null) {
|
91
|
+
const remoteDoc = await loader(url, options);
|
92
|
+
try {
|
93
|
+
await kv.set(key, remoteDoc, { ttl: match });
|
94
|
+
} catch (error) {
|
95
|
+
logger.warn("Failed to save the document of {url} to the KV cache: {error}", {
|
96
|
+
url,
|
97
|
+
error
|
98
|
+
});
|
99
|
+
}
|
100
|
+
return remoteDoc;
|
101
|
+
}
|
102
|
+
return cache;
|
103
|
+
};
|
104
|
+
}
|
105
|
+
function matchRule(url, rules) {
|
106
|
+
for (const [pattern, duration] of rules) {
|
107
|
+
if (typeof pattern === "string") {
|
108
|
+
if (url === pattern) return duration;
|
109
|
+
continue;
|
110
|
+
}
|
111
|
+
if (pattern instanceof URL) {
|
112
|
+
if (pattern.href == url) return duration;
|
113
|
+
continue;
|
114
|
+
}
|
115
|
+
if (pattern.test(url)) return duration;
|
116
|
+
}
|
117
|
+
return null;
|
118
|
+
}
|
119
|
+
|
120
|
+
//#endregion
|
121
|
+
export { getAuthenticatedDocumentLoader, kvCache };
|
@@ -0,0 +1,93 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import { preloadedContexts } from "@fedify/vocab-runtime";
|
7
|
+
import { getLogger } from "@logtape/logtape";
|
8
|
+
|
9
|
+
//#region src/utils/kv-cache.ts
|
10
|
+
const logger = getLogger([
|
11
|
+
"fedify",
|
12
|
+
"utils",
|
13
|
+
"kv-cache"
|
14
|
+
]);
|
15
|
+
/**
|
16
|
+
* A mock implementation of a key–value store for testing purposes.
|
17
|
+
*/
|
18
|
+
var MockKvStore = class {
|
19
|
+
#values = {};
|
20
|
+
get(key) {
|
21
|
+
return Promise.resolve(this.#values[JSON.stringify(key)]);
|
22
|
+
}
|
23
|
+
set(key, value, _options) {
|
24
|
+
this.#values[JSON.stringify(key)] = value;
|
25
|
+
return Promise.resolve();
|
26
|
+
}
|
27
|
+
async delete(_) {}
|
28
|
+
cas(..._) {
|
29
|
+
return Promise.resolve(false);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
34
|
+
* @param parameters The parameters for the cache.
|
35
|
+
* @returns The decorated document loader which is cache-enabled.
|
36
|
+
*/
|
37
|
+
function kvCache({ loader, kv, prefix, rules }) {
|
38
|
+
const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
|
39
|
+
rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
|
40
|
+
for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
|
41
|
+
return async (url, options) => {
|
42
|
+
if (url in preloadedContexts) {
|
43
|
+
logger.debug("Using preloaded context: {url}.", { url });
|
44
|
+
return {
|
45
|
+
contextUrl: null,
|
46
|
+
document: preloadedContexts[url],
|
47
|
+
documentUrl: url
|
48
|
+
};
|
49
|
+
}
|
50
|
+
const match = matchRule(url, rules);
|
51
|
+
if (match == null) return await loader(url, options);
|
52
|
+
const key = [...keyPrefix, url];
|
53
|
+
let cache = void 0;
|
54
|
+
try {
|
55
|
+
cache = await kv.get(key);
|
56
|
+
} catch (error) {
|
57
|
+
if (error instanceof Error) logger.warn("Failed to get the document of {url} from the KV cache: {error}", {
|
58
|
+
url,
|
59
|
+
error
|
60
|
+
});
|
61
|
+
}
|
62
|
+
if (cache == null) {
|
63
|
+
const remoteDoc = await loader(url, options);
|
64
|
+
try {
|
65
|
+
await kv.set(key, remoteDoc, { ttl: match });
|
66
|
+
} catch (error) {
|
67
|
+
logger.warn("Failed to save the document of {url} to the KV cache: {error}", {
|
68
|
+
url,
|
69
|
+
error
|
70
|
+
});
|
71
|
+
}
|
72
|
+
return remoteDoc;
|
73
|
+
}
|
74
|
+
return cache;
|
75
|
+
};
|
76
|
+
}
|
77
|
+
function matchRule(url, rules) {
|
78
|
+
for (const [pattern, duration] of rules) {
|
79
|
+
if (typeof pattern === "string") {
|
80
|
+
if (url === pattern) return duration;
|
81
|
+
continue;
|
82
|
+
}
|
83
|
+
if (pattern instanceof URL) {
|
84
|
+
if (pattern.href == url) return duration;
|
85
|
+
continue;
|
86
|
+
}
|
87
|
+
if (pattern.test(url)) return duration;
|
88
|
+
}
|
89
|
+
return null;
|
90
|
+
}
|
91
|
+
|
92
|
+
//#endregion
|
93
|
+
export { MockKvStore, kvCache };
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, CryptographicKey, Object as Object$1, deno_default, getTypeId } from "./lookup-
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
6
|
+
import { Activity, CryptographicKey, Object as Object$1, deno_default, getTypeId } from "./lookup-Bp3gBRGD.js";
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-CLBIsQ2b.js";
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|