@fedify/fedify 2.0.0-dev.1485 → 2.0.0-dev.149
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/LICENSE +1 -1
- package/README.md +38 -18
- package/dist/actor-CCAL5-E_.cjs +42079 -0
- package/dist/{actor-7ivEf1H3.js → actor-DYdPViDz.js} +4 -1
- package/dist/{actor-C22bXuuC.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-DXTdNCfp.js → actor-U_BZZ2ps.js} +7058 -2722
- package/dist/actor-f2NtjyCg.d.cts +128 -0
- package/dist/{assert-MZs1qjMx.js → assert-Dp5_aoAs.js} +1 -1
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-D1m8F7x0.js} +1 -1
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-B2R_8p36.js} +1 -1
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-BoKYY0g1.js} +2 -2
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-DjkXin1a.js} +32 -2
- package/dist/{builder-BPGqEvtB.js → builder-CYR2yKqn.js} +20 -8
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/chunk-HsBuZ-b2.js +41 -0
- package/dist/client-94iWEfQa.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-BsGzbnV-.d.ts} +3 -75
- package/dist/{client-g2FDBoeY.js → client-CD87uCL_.js} +4 -23
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +11 -0
- package/dist/compat/mod.d.ts +10 -12
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +29 -24
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/context-DBQ7nMCw.d.cts +2449 -0
- package/dist/context-DH7LHJdw.js +109 -0
- package/dist/{context-DmlbRh9p.d.ts → context-mM0Nu5yo.d.ts} +335 -134
- package/dist/deno-BTeveqhY.js +131 -0
- package/dist/{testing-BG_8Fyas.js → dist-lStjlyET.js} +73 -114
- package/dist/{authdocloader-D_IvQE4z.js → docloader-BSGGKhrl.js} +17 -8
- package/dist/{esm-CPZhxxGc.js → esm-B52TuumP.js} +32 -17
- package/dist/federation/builder.test.js +16 -16
- package/dist/federation/collection.test.js +9 -12
- package/dist/federation/handler.test.js +123 -152
- package/dist/federation/idempotency.test.js +206 -0
- package/dist/federation/inbox.test.js +7 -7
- package/dist/federation/keycache.test.js +7 -8
- package/dist/federation/kv.test.js +64 -12
- package/dist/federation/middleware.test.js +281 -99
- package/dist/federation/mod.cjs +27 -0
- package/dist/federation/mod.d.cts +11 -0
- package/dist/federation/mod.d.ts +11 -13
- package/dist/federation/mod.js +13 -15
- package/dist/federation/mq.test.js +12 -13
- package/dist/federation/negotiation.test.js +25 -0
- package/dist/federation/retry.test.js +4 -6
- package/dist/federation/router.test.js +9 -11
- package/dist/federation/send.test.js +61 -18
- package/dist/federation-CoW-KDKv.cjs +266 -0
- package/dist/{federation-CMX7WzeL.js → federation-D0hkM4T7.js} +25 -3
- package/dist/{http-C7rxW7Kh.js → http-BIDOYI9f.js} +4 -3
- package/dist/{http-zsOxPKCt.js → http-BQRnmfXP.js} +260 -10
- package/dist/{http-DqSNLFNY.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/http-DtYHWbwa.cjs +1106 -0
- package/dist/http-M8k5mKc0.d.cts +253 -0
- package/dist/{inbox-eK2W2MF3.js → inbox-DNjplQSR.js} +26 -7
- package/dist/{key-CYOcZ9G5.js → key-dws2_YsP.js} +4 -2
- package/dist/{keycache-BLq6GT4_.js → keycache-BbbXRjc-.js} +1 -1
- package/dist/{keys-BIwlbtMN.js → keys-C6QyjjIN.js} +2 -1
- package/dist/{kv-C7sopW2E.d.ts → kv-BpJND1Hr.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-DaWUKuhD.js} +22 -0
- package/dist/kv-cD_d4hg-.d.cts +110 -0
- package/dist/kv-cache-1_lcnUMp.cjs +134 -0
- package/dist/kv-cache-BEP4OyiZ.js +122 -0
- package/dist/kv-cache-C6NrTtII.js +107 -0
- package/dist/{ld-DWwLYT4e.js → ld-C6UrncJk.js} +7 -4
- package/dist/lookup-BORWbouU.cjs +268 -0
- package/dist/lookup-BV72lfsA.js +256 -0
- package/dist/{lookup-DNQyH8UQ.js → lookup-BoiLMtAx.js} +33 -125
- package/dist/{lookup-BHYMosdS.js → lookup-yv_aH7K7.js} +3 -1
- package/dist/{middleware-BcVqlHyD.js → middleware--1K3DAB8.js} +143 -136
- package/dist/middleware-7Yg2p_nl.js +31 -0
- package/dist/{middleware-DakCaqXu.js → middleware-8Oymc6Na.js} +105 -188
- package/dist/middleware-C6YBw2qx.cjs +15 -0
- package/dist/middleware-D6XNERu3.js +15 -0
- package/dist/middleware-DBHDivdC.cjs +4237 -0
- package/dist/mod-B-hUPT2N.d.cts +1 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-BlVovdcy.d.ts} +20 -2
- package/dist/mod-BxRCHTz-.d.cts +307 -0
- package/dist/mod-C58MZ7Wx.d.cts +113 -0
- package/dist/mod-CAdoBu0x.d.ts +109 -0
- package/dist/mod-CcDPcLJW.d.cts +1 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-D5Z2tISD.d.ts} +3 -3
- package/dist/mod-DgxG-byT.d.cts +266 -0
- package/dist/{lookup-3czM5mmU.d.ts → mod-Ds0mpFZU.d.ts} +9 -2
- package/dist/mod-Dy2fJtmN.d.cts +80 -0
- package/dist/{mod-0EysZ-dJ.d.ts → mod-GetHzY6F.d.ts} +2 -2
- package/dist/mod-fxr25Gv7.d.cts +107 -0
- package/dist/mod.cjs +137 -0
- package/dist/mod.d.cts +15 -0
- package/dist/mod.d.ts +15 -18
- package/dist/mod.js +19 -21
- package/dist/negotiation-B4NJHk1f.js +71 -0
- package/dist/nodeinfo/client.test.js +32 -114
- package/dist/nodeinfo/handler.test.js +35 -30
- package/dist/nodeinfo/mod.cjs +10 -0
- package/dist/nodeinfo/mod.d.cts +3 -0
- package/dist/nodeinfo/mod.d.ts +3 -5
- package/dist/nodeinfo/mod.js +6 -7
- package/dist/nodeinfo/types.test.js +10 -18
- package/dist/nodeinfo-BnthBobC.js +4 -0
- package/dist/nodeinfo-CdN0rEnZ.cjs +4 -0
- package/dist/otel/exporter.test.js +899 -0
- package/dist/otel/mod.cjs +262 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +261 -0
- package/dist/owner-B4HbyP8s.d.cts +67 -0
- package/dist/{owner-smArESGi.js → owner-DQuVKHuY.js} +46 -8
- package/dist/{owner-CQPnQVtf.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-CT1SITRP.js → proof-BG2G4cDG.js} +53 -16
- package/dist/proof-C3K5Z8RT.cjs +710 -0
- package/dist/{proof-C6z-uqeO.js → proof-GrivUN5L.js} +5 -3
- package/dist/router-CVRQXlZi.js +118 -0
- package/dist/{send-1zdmNlUo.js → send-B_dTZyUD.js} +9 -4
- package/dist/sig/http.test.js +19 -17
- package/dist/sig/key.test.js +15 -14
- package/dist/sig/ld.test.js +13 -12
- package/dist/sig/mod.cjs +28 -0
- package/dist/sig/mod.d.cts +6 -0
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +8 -10
- package/dist/sig/owner.test.js +40 -15
- package/dist/sig/proof.test.js +19 -17
- package/dist/sig-C34-oHBl.js +4 -0
- package/dist/sig-YYj5tCnr.cjs +4 -0
- package/dist/{std__assert-X-_kMxKM.js → std__assert-Cm-MfI66.js} +1 -1
- package/dist/testing/mod.d.ts +410 -232
- package/dist/testing/mod.js +9 -4
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/type-BSNcIxTd.js +14 -0
- package/dist/{types-BzyGRkRt.js → types-BtUjyi5y.js} +9 -170
- package/dist/types-CWgzGaqk.cjs +315 -0
- package/dist/{types-BIgY6c-l.js → types-D2jhK2VG.js} +1 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +20 -18
- package/dist/utils/kv-cache.test.js +211 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/utils-D-Va7aXC.js +4 -0
- package/dist/utils-DyRU1gdZ.cjs +4 -0
- package/dist/vocab/actor.test.js +15 -13
- package/dist/vocab/lookup.test.js +285 -12
- package/dist/vocab/mod.cjs +86 -0
- package/dist/vocab/mod.d.cts +4 -0
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +6 -7
- package/dist/vocab/type.test.js +4 -4
- package/dist/vocab/vocab.test.js +8058 -1987
- package/dist/{vocab-Bg1J3mu4.js → vocab-Aig1Fmi8.js} +32 -18
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BCWe1Ih5.d.ts} +292 -21
- package/dist/{type-I68qwqmo.js → vocab-C3nSleOZ.js} +6947 -7381
- package/dist/vocab-CeDBzu-f.d.cts +14903 -0
- package/dist/vocab-DFMYh9aV.cjs +296 -0
- package/dist/webfinger/handler.test.js +62 -29
- package/dist/webfinger/lookup.test.js +11 -12
- package/dist/webfinger/mod.cjs +8 -0
- package/dist/webfinger/mod.d.cts +2 -0
- package/dist/webfinger/mod.d.ts +1 -4
- package/dist/webfinger/mod.js +5 -6
- package/dist/webfinger-C72Y8lrh.js +4 -0
- package/dist/webfinger-vAtLmxOF.cjs +4 -0
- package/package.json +81 -45
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Bq0gEHRj.js +0 -52
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/denokv-Bv33Xxea.js +0 -57
- package/dist/docloader-BlVueewg.js +0 -4615
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/fixtures/activitypub.academy/users/brauca_darradiul.json +0 -83
- package/dist/fixtures/example.com/announce.json +0 -6
- package/dist/fixtures/example.com/collection.json +0 -19
- package/dist/fixtures/example.com/create.json +0 -6
- package/dist/fixtures/example.com/cross-origin-actor.json +0 -6
- package/dist/fixtures/example.com/hong-gildong.json +0 -11
- package/dist/fixtures/example.com/invite.json +0 -7
- package/dist/fixtures/example.com/key.json +0 -7
- package/dist/fixtures/example.com/key2.json +0 -6
- package/dist/fixtures/example.com/object.json +0 -6
- package/dist/fixtures/example.com/orderedcollectionpage.json +0 -24
- package/dist/fixtures/example.com/paged/a.json +0 -13
- package/dist/fixtures/example.com/paged/b.json +0 -16
- package/dist/fixtures/example.com/paged-collection.json +0 -6
- package/dist/fixtures/example.com/person.json +0 -22
- package/dist/fixtures/example.com/person2.json +0 -40
- package/dist/fixtures/example.com/test.json +0 -5
- package/dist/fixtures/example.com/users/handle.json +0 -16
- package/dist/fixtures/example.com/wrong-type.json +0 -3
- package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +0 -24
- package/dist/fixtures/remote.domain/users/bob.json +0 -20
- package/dist/fixtures/server.example/users/alice.json +0 -20
- package/dist/fixtures/w3id.org/identity/v1.json +0 -152
- package/dist/fixtures/w3id.org/security/data-integrity/v1.json +0 -74
- package/dist/fixtures/w3id.org/security/multikey/v1.json +0 -35
- package/dist/fixtures/w3id.org/security/v1.json +0 -50
- package/dist/fixtures/wizard.casa/users/hongminhee.json +0 -69
- package/dist/fixtures/www.w3.org/ns/activitystreams.json +0 -379
- package/dist/fixtures/www.w3.org/ns/did/v1.json +0 -58
- package/dist/key-Dn7Lram-.js +0 -260
- package/dist/key-S7WllAWz.js +0 -10
- package/dist/key-rRCUafNm.js +0 -10
- package/dist/middleware-CWbGhXnl.js +0 -26
- package/dist/middleware-D-OlNiyj.js +0 -17
- package/dist/mod-TFoH2Ql8.d.ts +0 -104
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- 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/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.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/src/vocab/accept.yaml +0 -15
- package/dist/src/vocab/activity.yaml +0 -98
- package/dist/src/vocab/add.yaml +0 -16
- package/dist/src/vocab/announce.yaml +0 -30
- package/dist/src/vocab/application.yaml +0 -324
- package/dist/src/vocab/arrive.yaml +0 -15
- package/dist/src/vocab/article.yaml +0 -46
- package/dist/src/vocab/audio.yaml +0 -11
- package/dist/src/vocab/block.yaml +0 -16
- package/dist/src/vocab/chatmessage.yaml +0 -50
- package/dist/src/vocab/collection.yaml +0 -154
- package/dist/src/vocab/collectionpage.yaml +0 -55
- package/dist/src/vocab/create.yaml +0 -28
- package/dist/src/vocab/dataintegrityproof.yaml +0 -56
- package/dist/src/vocab/delete.yaml +0 -27
- package/dist/src/vocab/didservice.yaml +0 -22
- package/dist/src/vocab/dislike.yaml +0 -14
- package/dist/src/vocab/document.yaml +0 -31
- package/dist/src/vocab/emoji.yaml +0 -12
- package/dist/src/vocab/emojireact.yaml +0 -17
- package/dist/src/vocab/endpoints.yaml +0 -85
- package/dist/src/vocab/event.yaml +0 -11
- package/dist/src/vocab/export.yaml +0 -9
- package/dist/src/vocab/flag.yaml +0 -15
- package/dist/src/vocab/follow.yaml +0 -19
- package/dist/src/vocab/group.yaml +0 -324
- package/dist/src/vocab/hashtag.yaml +0 -14
- package/dist/src/vocab/ignore.yaml +0 -14
- package/dist/src/vocab/image.yaml +0 -9
- package/dist/src/vocab/intransitiveactivity.yaml +0 -15
- package/dist/src/vocab/invite.yaml +0 -14
- package/dist/src/vocab/join.yaml +0 -14
- package/dist/src/vocab/key.yaml +0 -28
- package/dist/src/vocab/leave.yaml +0 -14
- package/dist/src/vocab/like.yaml +0 -16
- package/dist/src/vocab/link.yaml +0 -101
- package/dist/src/vocab/listen.yaml +0 -12
- package/dist/src/vocab/mention.yaml +0 -9
- package/dist/src/vocab/move.yaml +0 -15
- package/dist/src/vocab/multikey.yaml +0 -36
- package/dist/src/vocab/note.yaml +0 -48
- package/dist/src/vocab/object.yaml +0 -404
- package/dist/src/vocab/offer.yaml +0 -15
- package/dist/src/vocab/orderedcollection.yaml +0 -39
- package/dist/src/vocab/orderedcollectionpage.yaml +0 -50
- package/dist/src/vocab/organization.yaml +0 -324
- package/dist/src/vocab/page.yaml +0 -11
- package/dist/src/vocab/person.yaml +0 -324
- package/dist/src/vocab/place.yaml +0 -75
- package/dist/src/vocab/profile.yaml +0 -26
- package/dist/src/vocab/propertyvalue.yaml +0 -32
- package/dist/src/vocab/question.yaml +0 -103
- package/dist/src/vocab/read.yaml +0 -13
- package/dist/src/vocab/reject.yaml +0 -14
- package/dist/src/vocab/relationship.yaml +0 -52
- package/dist/src/vocab/remove.yaml +0 -14
- package/dist/src/vocab/service.yaml +0 -324
- package/dist/src/vocab/source.yaml +0 -26
- package/dist/src/vocab/tentativeaccept.yaml +0 -14
- package/dist/src/vocab/tentativereject.yaml +0 -14
- package/dist/src/vocab/tombstone.yaml +0 -24
- package/dist/src/vocab/travel.yaml +0 -16
- package/dist/src/vocab/undo.yaml +0 -26
- package/dist/src/vocab/update.yaml +0 -58
- package/dist/src/vocab/video.yaml +0 -11
- package/dist/src/vocab/view.yaml +0 -13
- package/dist/testing/docloader.test.js +0 -24
- package/dist/vocab/schema.yaml +0 -247
- package/dist/webfinger-C3GIyXIg.js +0 -4
- package/dist/x/cfworkers.d.ts +0 -61
- package/dist/x/cfworkers.js +0 -98
- package/dist/x/cfworkers.test.d.ts +0 -3
- package/dist/x/cfworkers.test.js +0 -179
- package/dist/x/hono.d.ts +0 -56
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.d.ts +0 -48
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Gbplq4lg.js} +0 -0
- /package/dist/{collection-CSzG2j1P.js → collection-CrkRM5Ep.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-GIh5OYxW.d.ts → mod-bjzj5QIb.d.ts} +0 -0
- /package/dist/{runtime/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-Bz5pP75o.js} +0 -0
- /package/dist/{testing → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import "./deno-BTeveqhY.js";
|
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-8Oymc6Na.js";
|
|
8
|
+
import "./client-CD87uCL_.js";
|
|
9
|
+
import "./router-CVRQXlZi.js";
|
|
10
|
+
import "./types-D2jhK2VG.js";
|
|
11
|
+
import "./vocab-C3nSleOZ.js";
|
|
12
|
+
import "./lookup-yv_aH7K7.js";
|
|
13
|
+
import "./type-BSNcIxTd.js";
|
|
14
|
+
import "./actor-DYdPViDz.js";
|
|
15
|
+
import "./key-dws2_YsP.js";
|
|
16
|
+
import "./http-BIDOYI9f.js";
|
|
17
|
+
import "./ld-C6UrncJk.js";
|
|
18
|
+
import "./owner-DQuVKHuY.js";
|
|
19
|
+
import "./proof-GrivUN5L.js";
|
|
20
|
+
import "./docloader-BSGGKhrl.js";
|
|
21
|
+
import "./kv-cache-C6NrTtII.js";
|
|
22
|
+
import "./lookup-BoiLMtAx.js";
|
|
23
|
+
import "./inbox-DNjplQSR.js";
|
|
24
|
+
import "./builder-CYR2yKqn.js";
|
|
25
|
+
import "./collection-CrkRM5Ep.js";
|
|
26
|
+
import "./keycache-BbbXRjc-.js";
|
|
27
|
+
import "./negotiation-B4NJHk1f.js";
|
|
28
|
+
import "./retry-Bz5pP75o.js";
|
|
29
|
+
import "./send-B_dTZyUD.js";
|
|
30
|
+
|
|
31
|
+
export { FederationImpl };
|
|
@@ -3,23 +3,30 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { getNodeInfo } from "./client-
|
|
8
|
-
import { RouterError
|
|
9
|
-
import { nodeInfoToJson } from "./types-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
6
|
+
import { deno_default } from "./deno-BTeveqhY.js";
|
|
7
|
+
import { getNodeInfo } from "./client-CD87uCL_.js";
|
|
8
|
+
import { RouterError } from "./router-CVRQXlZi.js";
|
|
9
|
+
import { nodeInfoToJson } from "./types-D2jhK2VG.js";
|
|
10
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage } from "./vocab-C3nSleOZ.js";
|
|
11
|
+
import { lookupWebFinger } from "./lookup-yv_aH7K7.js";
|
|
12
|
+
import { getTypeId } from "./type-BSNcIxTd.js";
|
|
13
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-dws2_YsP.js";
|
|
14
|
+
import { verifyRequest } from "./http-BIDOYI9f.js";
|
|
15
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-C6UrncJk.js";
|
|
16
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-DQuVKHuY.js";
|
|
17
|
+
import { signObject, verifyObject } from "./proof-GrivUN5L.js";
|
|
18
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-BSGGKhrl.js";
|
|
19
|
+
import { kvCache } from "./kv-cache-C6NrTtII.js";
|
|
20
|
+
import { lookupObject, traverseCollection } from "./lookup-BoiLMtAx.js";
|
|
21
|
+
import { routeActivity } from "./inbox-DNjplQSR.js";
|
|
22
|
+
import { FederationBuilderImpl } from "./builder-CYR2yKqn.js";
|
|
23
|
+
import { buildCollectionSynchronizationHeader } from "./collection-CrkRM5Ep.js";
|
|
24
|
+
import { KvKeyCache } from "./keycache-BbbXRjc-.js";
|
|
25
|
+
import { acceptsJsonLd } from "./negotiation-B4NJHk1f.js";
|
|
26
|
+
import { createExponentialBackoffPolicy } from "./retry-Bz5pP75o.js";
|
|
27
|
+
import { extractInboxes, sendActivity } from "./send-B_dTZyUD.js";
|
|
22
28
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
29
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
23
30
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
24
31
|
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";
|
|
25
32
|
import { domainToASCII } from "node:url";
|
|
@@ -196,7 +203,7 @@ async function handleWebFinger(request, options) {
|
|
|
196
203
|
}
|
|
197
204
|
});
|
|
198
205
|
}
|
|
199
|
-
async function handleWebFingerInternal(request, { context: context$1, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span }) {
|
|
206
|
+
async function handleWebFingerInternal(request, { context: context$1, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
|
|
200
207
|
if (actorDispatcher == null) {
|
|
201
208
|
logger.error("Actor dispatcher is not set.");
|
|
202
209
|
return await onNotFound(request);
|
|
@@ -272,6 +279,10 @@ async function handleWebFingerInternal(request, { context: context$1, host, acto
|
|
|
272
279
|
if (image.mediaType != null) link.type = image.mediaType;
|
|
273
280
|
links.push(link);
|
|
274
281
|
}
|
|
282
|
+
if (webFingerLinksDispatcher != null) {
|
|
283
|
+
const customLinks = await webFingerLinksDispatcher(context$1, resourceUrl);
|
|
284
|
+
if (customLinks != null) for (const link of customLinks) links.push(link);
|
|
285
|
+
}
|
|
275
286
|
const aliases = [];
|
|
276
287
|
if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
|
|
277
288
|
aliases.push(`acct:${actor.preferredUsername}@${host ?? context$1.url.host}`);
|
|
@@ -293,73 +304,8 @@ async function handleWebFingerInternal(request, { context: context$1, host, acto
|
|
|
293
304
|
} });
|
|
294
305
|
}
|
|
295
306
|
|
|
296
|
-
//#endregion
|
|
297
|
-
//#region src/federation/negotiation.ts
|
|
298
|
-
function compareSpecs(a, b) {
|
|
299
|
-
return b.q - a.q || (b.s ?? 0) - (a.s ?? 0) || (a.o ?? 0) - (b.o ?? 0) || a.i - b.i || 0;
|
|
300
|
-
}
|
|
301
|
-
function isQuality(spec) {
|
|
302
|
-
return spec.q > 0;
|
|
303
|
-
}
|
|
304
|
-
const simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;
|
|
305
|
-
function splitKeyValuePair(str) {
|
|
306
|
-
const [key, value] = str.split("=");
|
|
307
|
-
return [key.toLowerCase(), value];
|
|
308
|
-
}
|
|
309
|
-
function parseMediaType(str, i) {
|
|
310
|
-
const match = simpleMediaTypeRegExp.exec(str);
|
|
311
|
-
if (!match) return;
|
|
312
|
-
const [, type, subtype, parameters] = match;
|
|
313
|
-
if (!type || !subtype) return;
|
|
314
|
-
const params = Object.create(null);
|
|
315
|
-
let q = 1;
|
|
316
|
-
if (parameters) {
|
|
317
|
-
const kvps = parameters.split(";").map((p) => p.trim()).map(splitKeyValuePair);
|
|
318
|
-
for (const [key, val] of kvps) {
|
|
319
|
-
const value = val && val[0] === `"` && val[val.length - 1] === `"` ? val.slice(1, val.length - 1) : val;
|
|
320
|
-
if (key === "q" && value) {
|
|
321
|
-
q = parseFloat(value);
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
params[key] = value;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return {
|
|
328
|
-
type,
|
|
329
|
-
subtype,
|
|
330
|
-
params,
|
|
331
|
-
i,
|
|
332
|
-
o: void 0,
|
|
333
|
-
q,
|
|
334
|
-
s: void 0
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
function parseAccept(accept) {
|
|
338
|
-
const accepts = accept.split(",").map((p) => p.trim());
|
|
339
|
-
const mediaTypes = [];
|
|
340
|
-
for (const [index, accept$1] of accepts.entries()) {
|
|
341
|
-
const mediaType = parseMediaType(accept$1.trim(), index);
|
|
342
|
-
if (mediaType) mediaTypes.push(mediaType);
|
|
343
|
-
}
|
|
344
|
-
return mediaTypes;
|
|
345
|
-
}
|
|
346
|
-
function getFullType(spec) {
|
|
347
|
-
return `${spec.type}/${spec.subtype}`;
|
|
348
|
-
}
|
|
349
|
-
function preferredMediaTypes(accept) {
|
|
350
|
-
const accepts = parseAccept(accept === void 0 ? "*/*" : accept ?? "");
|
|
351
|
-
return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
307
|
//#endregion
|
|
355
308
|
//#region src/federation/handler.ts
|
|
356
|
-
function acceptsJsonLd(request) {
|
|
357
|
-
const accept = request.headers.get("Accept");
|
|
358
|
-
const types = accept ? preferredMediaTypes(accept) : ["*/*"];
|
|
359
|
-
if (types == null) return true;
|
|
360
|
-
if (types[0] === "text/html" || types[0] === "application/xhtml+xml") return false;
|
|
361
|
-
return types.includes("application/activity+json") || types.includes("application/ld+json") || types.includes("application/json");
|
|
362
|
-
}
|
|
363
309
|
/**
|
|
364
310
|
* Handles an actor request.
|
|
365
311
|
* @template TContextData The context data to pass to the context.
|
|
@@ -367,7 +313,7 @@ function acceptsJsonLd(request) {
|
|
|
367
313
|
* @param parameters The parameters for handling the actor.
|
|
368
314
|
* @returns A promise that resolves to an HTTP response.
|
|
369
315
|
*/
|
|
370
|
-
async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound,
|
|
316
|
+
async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
|
|
371
317
|
const logger$2 = getLogger([
|
|
372
318
|
"fedify",
|
|
373
319
|
"federation",
|
|
@@ -382,7 +328,6 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
|
|
|
382
328
|
logger$2.debug("Actor {identifier} not found.", { identifier });
|
|
383
329
|
return await onNotFound(request);
|
|
384
330
|
}
|
|
385
|
-
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
386
331
|
if (authorizePredicate != null) {
|
|
387
332
|
let key = await context$1.getSignedKey();
|
|
388
333
|
key = key?.clone({}, { $warning: {
|
|
@@ -417,11 +362,10 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
|
|
|
417
362
|
* @param parameters The parameters for handling the object.
|
|
418
363
|
* @returns A promise that resolves to an HTTP response.
|
|
419
364
|
*/
|
|
420
|
-
async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound,
|
|
365
|
+
async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
|
|
421
366
|
if (objectDispatcher == null) return await onNotFound(request);
|
|
422
367
|
const object = await objectDispatcher(context$1, values);
|
|
423
368
|
if (object == null) return await onNotFound(request);
|
|
424
|
-
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
425
369
|
if (authorizePredicate != null) {
|
|
426
370
|
let key = await context$1.getSignedKey();
|
|
427
371
|
key = key?.clone({}, { $warning: {
|
|
@@ -459,7 +403,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
|
|
|
459
403
|
* @param parameters The parameters for handling the collection.
|
|
460
404
|
* @returns A promise that resolves to an HTTP response.
|
|
461
405
|
*/
|
|
462
|
-
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound
|
|
406
|
+
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
|
463
407
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
464
408
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
465
409
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
@@ -572,7 +516,6 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
572
516
|
partOf
|
|
573
517
|
});
|
|
574
518
|
}
|
|
575
|
-
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
576
519
|
if (collectionCallbacks.authorizePredicate != null) {
|
|
577
520
|
let key = await context$1.getSignedKey();
|
|
578
521
|
key = key?.clone({}, { $warning: {
|
|
@@ -667,7 +610,8 @@ async function handleInbox(request, options) {
|
|
|
667
610
|
* @param span The OpenTelemetry span for tracing.
|
|
668
611
|
* @returns A promise that resolves to an HTTP response.
|
|
669
612
|
*/
|
|
670
|
-
async function handleInboxInternal(request,
|
|
613
|
+
async function handleInboxInternal(request, parameters, span) {
|
|
614
|
+
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider } = parameters;
|
|
671
615
|
const logger$2 = getLogger([
|
|
672
616
|
"fedify",
|
|
673
617
|
"federation",
|
|
@@ -841,6 +785,13 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
841
785
|
}
|
|
842
786
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
843
787
|
span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
|
|
788
|
+
span.addEvent("activitypub.activity.received", {
|
|
789
|
+
"activitypub.activity.json": JSON.stringify(json),
|
|
790
|
+
"activitypub.activity.verified": activity != null,
|
|
791
|
+
"ld_signatures.verified": ldSigVerified,
|
|
792
|
+
"http_signatures.verified": httpSigKey != null,
|
|
793
|
+
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
794
|
+
});
|
|
844
795
|
if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
845
796
|
logger$2.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
846
797
|
activity: json,
|
|
@@ -869,7 +820,8 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
869
820
|
kvPrefixes,
|
|
870
821
|
queue,
|
|
871
822
|
span,
|
|
872
|
-
tracerProvider
|
|
823
|
+
tracerProvider,
|
|
824
|
+
idempotencyStrategy: parameters.idempotencyStrategy
|
|
873
825
|
});
|
|
874
826
|
if (routeResult === "alreadyProcessed") return new Response(`Activity <${activity.id}> has already been processed.`, {
|
|
875
827
|
status: 202,
|
|
@@ -899,7 +851,7 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
899
851
|
/**
|
|
900
852
|
* Handles a custom collection request.
|
|
901
853
|
* @template TItem The type of items in the collection.
|
|
902
|
-
* @template
|
|
854
|
+
* @template TParam The parameter names of the requested URL.
|
|
903
855
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
|
904
856
|
* @template TContextData The context data to pass to the `TContext`.
|
|
905
857
|
* @param request The HTTP request.
|
|
@@ -910,7 +862,6 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
910
862
|
const handleCustomCollection = exceptWrapper(_handleCustomCollection);
|
|
911
863
|
async function _handleCustomCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
912
864
|
verifyDefined(callbacks);
|
|
913
|
-
verifyJsonLdRequest(request);
|
|
914
865
|
await authIfNeeded(context$1, values, callbacks);
|
|
915
866
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
916
867
|
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, Collection, CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
@@ -918,7 +869,7 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
|
918
869
|
/**
|
|
919
870
|
* Handles an ordered collection request.
|
|
920
871
|
* @template TItem The type of items in the collection.
|
|
921
|
-
* @template
|
|
872
|
+
* @template TParam The parameter names of the requested URL.
|
|
922
873
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
|
923
874
|
* @template TContextData The context data to pass to the `TContext`.
|
|
924
875
|
* @param request The HTTP request.
|
|
@@ -929,7 +880,6 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
|
929
880
|
const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
|
|
930
881
|
async function _handleOrderedCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
931
882
|
verifyDefined(callbacks);
|
|
932
|
-
verifyJsonLdRequest(request);
|
|
933
883
|
await authIfNeeded(context$1, values, callbacks);
|
|
934
884
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
935
885
|
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, OrderedCollection, OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
@@ -939,7 +889,7 @@ async function _handleOrderedCollection(request, { name, values, context: contex
|
|
|
939
889
|
* The main flow is on `getCollection`, `dispatch`.
|
|
940
890
|
*
|
|
941
891
|
* @template TItem The type of items in the collection.
|
|
942
|
-
* @template
|
|
892
|
+
* @template TParam The parameter names of the requested URL.
|
|
943
893
|
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
|
|
944
894
|
* @template TContextData The context data to pass to the `TContext`.
|
|
945
895
|
* @template TCollection The type of the collection, extending {@link Collection}.
|
|
@@ -973,14 +923,14 @@ var CustomCollectionHandler = class {
|
|
|
973
923
|
#collection = null;
|
|
974
924
|
/**
|
|
975
925
|
* Creates a new CustomCollection instance.
|
|
976
|
-
* @param
|
|
977
|
-
* @param
|
|
978
|
-
* @param
|
|
979
|
-
* @param
|
|
980
|
-
* @param
|
|
981
|
-
* @param
|
|
982
|
-
* @param
|
|
983
|
-
* @param
|
|
926
|
+
* @param name The name of the collection.
|
|
927
|
+
* @param values The parameter values for the collection.
|
|
928
|
+
* @param context The request context.
|
|
929
|
+
* @param callbacks The collection callbacks.
|
|
930
|
+
* @param tracerProvider The tracer provider for telemetry.
|
|
931
|
+
* @param Collection The Collection constructor.
|
|
932
|
+
* @param CollectionPage The CollectionPage constructor.
|
|
933
|
+
* @param filterPredicate Optional filter predicate for items.
|
|
984
934
|
*/
|
|
985
935
|
constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
|
986
936
|
this.name = name;
|
|
@@ -1105,7 +1055,7 @@ var CustomCollectionHandler = class {
|
|
|
1105
1055
|
/**
|
|
1106
1056
|
* Creates a function to wrap the dispatcher so tracing can be applied.
|
|
1107
1057
|
* @param params Parameters including cursor and total items.
|
|
1108
|
-
* @returns
|
|
1058
|
+
* @returns A function that handles the span operation.
|
|
1109
1059
|
*/
|
|
1110
1060
|
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
|
1111
1061
|
try {
|
|
@@ -1126,23 +1076,23 @@ var CustomCollectionHandler = class {
|
|
|
1126
1076
|
};
|
|
1127
1077
|
/**
|
|
1128
1078
|
* Dispatches the collection request to get items.
|
|
1129
|
-
* @param
|
|
1130
|
-
* @returns
|
|
1079
|
+
* @param cursor The cursor for pagination, or null for the first page.
|
|
1080
|
+
* @returns A promise that resolves to the page items.
|
|
1131
1081
|
*/
|
|
1132
1082
|
async dispatch(cursor = null) {
|
|
1133
1083
|
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
|
1134
1084
|
}
|
|
1135
1085
|
/**
|
|
1136
1086
|
* Filters the items in the collection.
|
|
1137
|
-
* @param
|
|
1138
|
-
* @returns
|
|
1087
|
+
* @param items The items to filter.
|
|
1088
|
+
* @returns The filtered items.
|
|
1139
1089
|
*/
|
|
1140
1090
|
filterItems(items) {
|
|
1141
1091
|
return filterCollectionItems(items, this.name, this.filterPredicate);
|
|
1142
1092
|
}
|
|
1143
1093
|
/**
|
|
1144
1094
|
* Appends a cursor to the URL if it exists.
|
|
1145
|
-
* @param
|
|
1095
|
+
* @param cursor The cursor to append, or null/undefined.
|
|
1146
1096
|
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
|
1147
1097
|
*/
|
|
1148
1098
|
appendToUrl(cursor) {
|
|
@@ -1150,8 +1100,7 @@ var CustomCollectionHandler = class {
|
|
|
1150
1100
|
}
|
|
1151
1101
|
/**
|
|
1152
1102
|
* Gets the stored collection or collection page.
|
|
1153
|
-
* @returns
|
|
1154
|
-
the collection or collection page.
|
|
1103
|
+
* @returns A promise that resolves to the collection or collection page.
|
|
1155
1104
|
*/
|
|
1156
1105
|
get collection() {
|
|
1157
1106
|
if (this.#collection === null) this.#collection = this.getCollection();
|
|
@@ -1159,8 +1108,8 @@ var CustomCollectionHandler = class {
|
|
|
1159
1108
|
}
|
|
1160
1109
|
/**
|
|
1161
1110
|
* Gets the total number of items in the collection.
|
|
1162
|
-
* @returns
|
|
1163
|
-
|
|
1111
|
+
* @returns A promise that resolves to the total items count,
|
|
1112
|
+
* or null if not available.
|
|
1164
1113
|
*/
|
|
1165
1114
|
get totalItems() {
|
|
1166
1115
|
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
|
@@ -1176,8 +1125,8 @@ var CustomCollectionHandler = class {
|
|
|
1176
1125
|
}
|
|
1177
1126
|
/**
|
|
1178
1127
|
* Gets the first cursor for pagination.
|
|
1179
|
-
* @returns
|
|
1180
|
-
or null if not available.
|
|
1128
|
+
* @returns A promise that resolves to the first cursor,
|
|
1129
|
+
* or null if not available.
|
|
1181
1130
|
*/
|
|
1182
1131
|
get firstCursor() {
|
|
1183
1132
|
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
|
@@ -1207,10 +1156,9 @@ function exceptWrapper(handler) {
|
|
|
1207
1156
|
try {
|
|
1208
1157
|
return await handler(request, handlerParams);
|
|
1209
1158
|
} catch (error) {
|
|
1210
|
-
const { onNotFound,
|
|
1159
|
+
const { onNotFound, onUnauthorized } = handlerParams;
|
|
1211
1160
|
switch (error?.constructor) {
|
|
1212
1161
|
case ItemsNotFoundError: return await onNotFound(request);
|
|
1213
|
-
case NotAcceptableError: return await onNotAcceptable(request);
|
|
1214
1162
|
case UnauthorizedError: return await onUnauthorized(request);
|
|
1215
1163
|
default: throw error;
|
|
1216
1164
|
}
|
|
@@ -1228,15 +1176,6 @@ const verifyDefined = (callbacks) => {
|
|
|
1228
1176
|
if (callbacks === void 0) throw new ItemsNotFoundError();
|
|
1229
1177
|
};
|
|
1230
1178
|
/**
|
|
1231
|
-
* Verifies that a request accepts JSON-LD content type.
|
|
1232
|
-
* @param request The HTTP request to verify.
|
|
1233
|
-
* @throws {NotAcceptableError} If the request doesn't accept JSON-LD.
|
|
1234
|
-
* @since 1.8.0
|
|
1235
|
-
*/
|
|
1236
|
-
const verifyJsonLdRequest = (request) => {
|
|
1237
|
-
if (!acceptsJsonLd(request)) throw new NotAcceptableError();
|
|
1238
|
-
};
|
|
1239
|
-
/**
|
|
1240
1179
|
* Performs authorization if needed based on the authorization predicate.
|
|
1241
1180
|
* @template TContextData The context data type.
|
|
1242
1181
|
* @param {RequestContext<TContextData>} context The request context.
|
|
@@ -1320,15 +1259,6 @@ var ItemsNotFoundError = class extends HandlerError {
|
|
|
1320
1259
|
}
|
|
1321
1260
|
};
|
|
1322
1261
|
/**
|
|
1323
|
-
* Error thrown when the request is not acceptable (e.g., wrong content type).
|
|
1324
|
-
* @since 1.8.0
|
|
1325
|
-
*/
|
|
1326
|
-
var NotAcceptableError = class extends HandlerError {
|
|
1327
|
-
constructor() {
|
|
1328
|
-
super("The request is not acceptable.");
|
|
1329
|
-
}
|
|
1330
|
-
};
|
|
1331
|
-
/**
|
|
1332
1262
|
* Error thrown when access to a collection is unauthorized.
|
|
1333
1263
|
* @since 1.8.0
|
|
1334
1264
|
*/
|
|
@@ -1401,7 +1331,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1401
1331
|
firstKnock;
|
|
1402
1332
|
constructor(options) {
|
|
1403
1333
|
super();
|
|
1404
|
-
const logger$2 = getLogger(["fedify", "federation"]);
|
|
1405
1334
|
this.kv = options.kv;
|
|
1406
1335
|
this.kvPrefixes = {
|
|
1407
1336
|
activityIdempotence: ["_fedify", "activityIdempotence"],
|
|
@@ -1449,17 +1378,13 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1449
1378
|
this.router.trailingSlashInsensitive = options.trailingSlashInsensitive ?? false;
|
|
1450
1379
|
this._initializeRouter();
|
|
1451
1380
|
if (options.allowPrivateAddress || options.userAgent != null) {
|
|
1452
|
-
if (options.
|
|
1453
|
-
|
|
1454
|
-
|
|
1381
|
+
if (options.documentLoaderFactory != null) throw new TypeError("Cannot set documentLoaderFactory with allowPrivateAddress or userAgent options.");
|
|
1382
|
+
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set contextLoaderFactory with allowPrivateAddress or userAgent options.");
|
|
1383
|
+
if (options.authenticatedDocumentLoaderFactory != null) throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with allowPrivateAddress or userAgent options.");
|
|
1455
1384
|
}
|
|
1456
1385
|
const { allowPrivateAddress, userAgent } = options;
|
|
1457
1386
|
this.allowPrivateAddress = allowPrivateAddress ?? false;
|
|
1458
|
-
|
|
1459
|
-
if (options.documentLoaderFactory != null) throw new TypeError("Cannot set both documentLoader and documentLoaderFactory options at a time; use documentLoaderFactory only.");
|
|
1460
|
-
this.documentLoaderFactory = () => options.documentLoader;
|
|
1461
|
-
logger$2.warn("The documentLoader option is deprecated; use documentLoaderFactory option instead.");
|
|
1462
|
-
} else this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
|
|
1387
|
+
this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
|
|
1463
1388
|
return kvCache({
|
|
1464
1389
|
loader: getDocumentLoader({
|
|
1465
1390
|
allowPrivateAddress: opts?.allowPrivateAddress ?? allowPrivateAddress,
|
|
@@ -1469,11 +1394,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1469
1394
|
prefix: this.kvPrefixes.remoteDocument
|
|
1470
1395
|
});
|
|
1471
1396
|
});
|
|
1472
|
-
|
|
1473
|
-
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set both contextLoader and contextLoaderFactory options at a time; use contextLoaderFactory only.");
|
|
1474
|
-
this.contextLoaderFactory = () => options.contextLoader;
|
|
1475
|
-
logger$2.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
|
|
1476
|
-
} else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
|
1397
|
+
this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
|
1477
1398
|
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => getAuthenticatedDocumentLoader(identity, {
|
|
1478
1399
|
allowPrivateAddress,
|
|
1479
1400
|
userAgent,
|
|
@@ -2012,6 +1933,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2012
1933
|
span,
|
|
2013
1934
|
tracer
|
|
2014
1935
|
});
|
|
1936
|
+
if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
|
|
2015
1937
|
} catch (error) {
|
|
2016
1938
|
span.setStatus({
|
|
2017
1939
|
code: SpanStatusCode.ERROR,
|
|
@@ -2066,6 +1988,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2066
1988
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
2067
1989
|
actorHandleMapper: this.actorCallbacks?.handleMapper,
|
|
2068
1990
|
actorAliasMapper: this.actorCallbacks?.aliasMapper,
|
|
1991
|
+
webFingerLinksDispatcher: this.webFingerLinksDispatcher,
|
|
2069
1992
|
onNotFound,
|
|
2070
1993
|
tracer
|
|
2071
1994
|
});
|
|
@@ -2074,6 +1997,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2074
1997
|
context: context$1,
|
|
2075
1998
|
nodeInfoDispatcher: this.nodeInfoDispatcher
|
|
2076
1999
|
});
|
|
2000
|
+
}
|
|
2001
|
+
if (request.method !== "POST" && !acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
2002
|
+
switch (routeName) {
|
|
2077
2003
|
case "actor":
|
|
2078
2004
|
context$1 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
|
|
2079
2005
|
return await handleActor(request, {
|
|
@@ -2082,8 +2008,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2082
2008
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
2083
2009
|
authorizePredicate: this.actorCallbacks?.authorizePredicate,
|
|
2084
2010
|
onUnauthorized,
|
|
2085
|
-
onNotFound
|
|
2086
|
-
onNotAcceptable
|
|
2011
|
+
onNotFound
|
|
2087
2012
|
});
|
|
2088
2013
|
case "object": {
|
|
2089
2014
|
const typeId = route.name.replace(/^object:/, "");
|
|
@@ -2099,8 +2024,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2099
2024
|
objectDispatcher: callbacks?.dispatcher,
|
|
2100
2025
|
authorizePredicate: callbacks?.authorizePredicate,
|
|
2101
2026
|
onUnauthorized,
|
|
2102
|
-
onNotFound
|
|
2103
|
-
onNotAcceptable
|
|
2027
|
+
onNotFound
|
|
2104
2028
|
});
|
|
2105
2029
|
}
|
|
2106
2030
|
case "outbox": return await handleCollection(request, {
|
|
@@ -2111,8 +2035,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2111
2035
|
collectionCallbacks: this.outboxCallbacks,
|
|
2112
2036
|
tracerProvider: this.tracerProvider,
|
|
2113
2037
|
onUnauthorized,
|
|
2114
|
-
onNotFound
|
|
2115
|
-
onNotAcceptable
|
|
2038
|
+
onNotFound
|
|
2116
2039
|
});
|
|
2117
2040
|
case "inbox":
|
|
2118
2041
|
if (request.method !== "POST") return await handleCollection(request, {
|
|
@@ -2123,8 +2046,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2123
2046
|
collectionCallbacks: this.inboxCallbacks,
|
|
2124
2047
|
tracerProvider: this.tracerProvider,
|
|
2125
2048
|
onUnauthorized,
|
|
2126
|
-
onNotFound
|
|
2127
|
-
onNotAcceptable
|
|
2049
|
+
onNotFound
|
|
2128
2050
|
});
|
|
2129
2051
|
context$1 = this.#createContext(request, contextData, { documentLoader: await context$1.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
|
|
2130
2052
|
case "sharedInbox":
|
|
@@ -2146,7 +2068,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2146
2068
|
onNotFound,
|
|
2147
2069
|
signatureTimeWindow: this.signatureTimeWindow,
|
|
2148
2070
|
skipSignatureVerification: this.skipSignatureVerification,
|
|
2149
|
-
tracerProvider: this.tracerProvider
|
|
2071
|
+
tracerProvider: this.tracerProvider,
|
|
2072
|
+
idempotencyStrategy: this.idempotencyStrategy
|
|
2150
2073
|
});
|
|
2151
2074
|
case "following": return await handleCollection(request, {
|
|
2152
2075
|
name: "following",
|
|
@@ -2156,8 +2079,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2156
2079
|
collectionCallbacks: this.followingCallbacks,
|
|
2157
2080
|
tracerProvider: this.tracerProvider,
|
|
2158
2081
|
onUnauthorized,
|
|
2159
|
-
onNotFound
|
|
2160
|
-
onNotAcceptable
|
|
2082
|
+
onNotFound
|
|
2161
2083
|
});
|
|
2162
2084
|
case "followers": {
|
|
2163
2085
|
let baseUrl = url.searchParams.get("base-url");
|
|
@@ -2180,8 +2102,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2180
2102
|
collectionCallbacks: this.followersCallbacks,
|
|
2181
2103
|
tracerProvider: this.tracerProvider,
|
|
2182
2104
|
onUnauthorized,
|
|
2183
|
-
onNotFound
|
|
2184
|
-
onNotAcceptable
|
|
2105
|
+
onNotFound
|
|
2185
2106
|
});
|
|
2186
2107
|
}
|
|
2187
2108
|
case "liked": return await handleCollection(request, {
|
|
@@ -2192,8 +2113,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2192
2113
|
collectionCallbacks: this.likedCallbacks,
|
|
2193
2114
|
tracerProvider: this.tracerProvider,
|
|
2194
2115
|
onUnauthorized,
|
|
2195
|
-
onNotFound
|
|
2196
|
-
onNotAcceptable
|
|
2116
|
+
onNotFound
|
|
2197
2117
|
});
|
|
2198
2118
|
case "featured": return await handleCollection(request, {
|
|
2199
2119
|
name: "featured",
|
|
@@ -2203,8 +2123,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2203
2123
|
collectionCallbacks: this.featuredCallbacks,
|
|
2204
2124
|
tracerProvider: this.tracerProvider,
|
|
2205
2125
|
onUnauthorized,
|
|
2206
|
-
onNotFound
|
|
2207
|
-
onNotAcceptable
|
|
2126
|
+
onNotFound
|
|
2208
2127
|
});
|
|
2209
2128
|
case "featuredTags": return await handleCollection(request, {
|
|
2210
2129
|
name: "featured tags",
|
|
@@ -2214,8 +2133,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2214
2133
|
collectionCallbacks: this.featuredTagsCallbacks,
|
|
2215
2134
|
tracerProvider: this.tracerProvider,
|
|
2216
2135
|
onUnauthorized,
|
|
2217
|
-
onNotFound
|
|
2218
|
-
onNotAcceptable
|
|
2136
|
+
onNotFound
|
|
2219
2137
|
});
|
|
2220
2138
|
case "collection": {
|
|
2221
2139
|
const name = route.name.replace(/^collection:/, "");
|
|
@@ -2227,8 +2145,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2227
2145
|
collectionCallbacks: callbacks,
|
|
2228
2146
|
tracerProvider: this.tracerProvider,
|
|
2229
2147
|
onUnauthorized,
|
|
2230
|
-
onNotFound
|
|
2231
|
-
onNotAcceptable
|
|
2148
|
+
onNotFound
|
|
2232
2149
|
});
|
|
2233
2150
|
}
|
|
2234
2151
|
case "orderedCollection": {
|
|
@@ -2241,8 +2158,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2241
2158
|
collectionCallbacks: callbacks,
|
|
2242
2159
|
tracerProvider: this.tracerProvider,
|
|
2243
2160
|
onUnauthorized,
|
|
2244
|
-
onNotFound
|
|
2245
|
-
onNotAcceptable
|
|
2161
|
+
onNotFound
|
|
2246
2162
|
});
|
|
2247
2163
|
}
|
|
2248
2164
|
default: {
|
|
@@ -2537,15 +2453,16 @@ var ContextImpl = class ContextImpl {
|
|
|
2537
2453
|
"actor"
|
|
2538
2454
|
]);
|
|
2539
2455
|
if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
})
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2456
|
+
let actorUri;
|
|
2457
|
+
try {
|
|
2458
|
+
actorUri = this.getActorUri(identifier);
|
|
2459
|
+
} catch (error) {
|
|
2460
|
+
if (error instanceof RouterError) {
|
|
2461
|
+
logger$2.warn(error.message);
|
|
2462
|
+
return [];
|
|
2463
|
+
}
|
|
2464
|
+
throw error;
|
|
2547
2465
|
}
|
|
2548
|
-
const actorUri = new URL(path, this.canonicalOrigin);
|
|
2549
2466
|
const keyPairs = await this.federation.actorCallbacks?.keyPairsDispatcher(new ContextImpl({
|
|
2550
2467
|
...this,
|
|
2551
2468
|
invokedFromActorKeyPairsDispatcher: { identifier }
|
|
@@ -2706,12 +2623,11 @@ var ContextImpl = class ContextImpl {
|
|
|
2706
2623
|
if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
|
|
2707
2624
|
expandedRecipients = [];
|
|
2708
2625
|
for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
|
|
2709
|
-
if (options.syncCollection) {
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
opts.collectionSync = collectionId == null ? void 0 : new URL(collectionId, this.canonicalOrigin).href;
|
|
2626
|
+
if (options.syncCollection) try {
|
|
2627
|
+
opts.collectionSync = this.getFollowersUri(identifier).href;
|
|
2628
|
+
} catch (error) {
|
|
2629
|
+
if (error instanceof RouterError) opts.collectionSync = void 0;
|
|
2630
|
+
else throw error;
|
|
2715
2631
|
}
|
|
2716
2632
|
} else expandedRecipients = [recipients];
|
|
2717
2633
|
span.setAttribute("activitypub.inboxes", expandedRecipients.length);
|
|
@@ -2896,7 +2812,8 @@ var ContextImpl = class ContextImpl {
|
|
|
2896
2812
|
kvPrefixes: this.federation.kvPrefixes,
|
|
2897
2813
|
queue: this.federation.inboxQueue,
|
|
2898
2814
|
span,
|
|
2899
|
-
tracerProvider: options.tracerProvider ?? this.tracerProvider
|
|
2815
|
+
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
2816
|
+
idempotencyStrategy: this.federation.idempotencyStrategy
|
|
2900
2817
|
});
|
|
2901
2818
|
return routeResult === "alreadyProcessed" || routeResult === "enqueued" || routeResult === "unsupportedActivity" || routeResult === "success";
|
|
2902
2819
|
}
|
|
@@ -3210,4 +3127,4 @@ function getRequestId(request) {
|
|
|
3210
3127
|
}
|
|
3211
3128
|
|
|
3212
3129
|
//#endregion
|
|
3213
|
-
export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer,
|
|
3130
|
+
export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, actorDehydrator, autoIdAssigner, createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleNodeInfo, handleNodeInfoJrd, handleObject, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|