@fedify/fedify 2.0.0-dev.1690 → 2.0.0-dev.170
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 +70 -34
- 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-CYOcDUkj.js → builder-_MVsWtsS.js} +9 -8
- package/dist/{client-bgSdkFa2.d.ts → client-CUTUGgvJ.d.ts} +19 -19
- package/dist/{client-CnOdwLLN.js → client-Dg7OfUDA.js} +28 -23
- package/dist/{client-CegPX0Rn.d.cts → client-by-PEGAJ.d.cts} +19 -19
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.d.cts +6 -12
- package/dist/compat/mod.d.ts +6 -12
- package/dist/compat/mod.js +1 -1
- package/dist/compat/transformers.test.js +19 -18
- package/dist/context-Bns6uTJq.js +109 -0
- package/dist/{context-ByZprN0S.d.ts → context-C7vzWilY.d.ts} +314 -182
- package/dist/{context-C5BsZkDr.d.cts → context-CrB9RFy5.d.cts} +314 -182
- package/dist/deno-DhWON59o.js +117 -0
- package/dist/{testing-BWNCAbL-.js → dist-B5f6a8Tt.js} +90 -111
- package/dist/{authdocloader-Brax1A32.js → docloader-Cni79dmb.js} +17 -8
- package/dist/{esm-DnIzfEj0.js → esm-DGl7uK1r.js} +32 -17
- package/dist/federation/builder.test.js +11 -11
- package/dist/federation/collection.test.js +5 -8
- package/dist/federation/handler.test.js +111 -24
- package/dist/federation/idempotency.test.js +24 -24
- package/dist/federation/inbox.test.js +5 -6
- package/dist/federation/keycache.test.js +4 -5
- package/dist/federation/kv.test.js +60 -9
- package/dist/federation/middleware.test.js +102 -101
- package/dist/federation/mod.cjs +8 -12
- package/dist/federation/mod.d.cts +7 -13
- package/dist/federation/mod.d.ts +7 -13
- package/dist/federation/mod.js +8 -13
- package/dist/federation/mq.test.js +9 -10
- package/dist/federation/negotiation.test.js +5 -8
- package/dist/federation/retry.test.js +2 -4
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +55 -15
- package/dist/{webfinger/handler.test.js → federation/webfinger.test.js} +25 -24
- package/dist/{federation-H2_En3j5.cjs → federation-B431K2gm.cjs} +22 -0
- package/dist/{federation-D1U8YY9t.js → federation-BbZwNNWj.js} +28 -6
- package/dist/{http-C7vbQwbz.cjs → http-7RQPvAkX.cjs} +410 -14
- package/dist/{http-BxbM8sEy.js → http-CZXlv4xU.js} +371 -11
- package/dist/{http-D-e6AFwR.d.cts → http-ClB3pLcL.d.cts} +2 -2
- package/dist/{http-BNOYnVsU.js → http-CwsBL5_A.js} +3 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-DLBDPal9.d.ts} +2 -2
- package/dist/{inbox-BRru9pX3.js → inbox-CukSCwad.js} +2 -1
- package/dist/{key-1KXru8Ug.js → key-DKkHKzvg.js} +3 -2
- package/dist/{keycache-CN61iGVj.js → keycache-DRxpZ5r9.js} +1 -1
- package/dist/{keys-BPdFKgiy.js → keys-ZbcByPg9.js} +2 -1
- package/dist/{kv-63Cil1MD.d.cts → kv-B4vFhIYL.d.cts} +30 -1
- package/dist/{kv-C7sopW2E.d.ts → kv-CYySNrsn.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
- package/dist/kv-cache-BEeqyGER.js +107 -0
- package/dist/kv-cache-BVA7CrnS.cjs +134 -0
- package/dist/kv-cache-HDuc4ZaJ.js +122 -0
- package/dist/{ld-Dv8DNNAT.js → ld-CM6OO5ar.js} +4 -2
- package/dist/middleware--i9t8nKh.js +26 -0
- package/dist/middleware-C567nJlD.cjs +12 -0
- package/dist/middleware-D9oWuacw.js +12 -0
- package/dist/{middleware-DY9B2lL8.js → middleware-DXRcwk_y.js} +185 -192
- package/dist/{middleware-BmoOlgc1.cjs → middleware-TufpQUzj.cjs} +251 -241
- package/dist/{middleware-Bz_A2jeJ.js → middleware-eDeNdyRA.js} +195 -191
- package/dist/mod-0p9zUdzg.d.cts +107 -0
- package/dist/mod-0qnPv4EC.d.cts +62 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-BrS8tiad.d.cts} +3 -3
- package/dist/mod-C3SOvTD1.d.ts +64 -0
- package/dist/{mod-8DMWKtQE.d.cts → mod-D6pS5_xJ.d.cts} +4 -4
- package/dist/{mod-BhUKmBJD.d.ts → mod-jOa7W503.d.ts} +3 -3
- package/dist/{mod-D6hQoxC5.d.ts → mod-waqu-BL_.d.ts} +4 -4
- package/dist/mod-xc20HhMD.d.ts +109 -0
- package/dist/mod.cjs +17 -112
- package/dist/mod.d.cts +11 -17
- package/dist/mod.d.ts +11 -17
- package/dist/mod.js +11 -17
- package/dist/nodeinfo/client.test.js +7 -10
- package/dist/nodeinfo/handler.test.js +23 -23
- package/dist/nodeinfo/mod.cjs +2 -3
- package/dist/nodeinfo/mod.d.cts +2 -4
- package/dist/nodeinfo/mod.d.ts +2 -4
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/types.test.js +6 -9
- package/dist/otel/exporter.test.js +893 -0
- package/dist/otel/mod.cjs +256 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +255 -0
- package/dist/{owner-e3FYDhsk.js → owner-BOEfZQv2.js} +45 -8
- package/dist/{owner-hd9lvQcP.d.ts → owner-BgI8C-VY.d.ts} +2 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-C-zfmVAD.d.cts} +2 -3
- package/dist/{proof-B-eqv0Ug.cjs → proof-CaDQpGJD.cjs} +69 -33
- package/dist/{proof-DfgvA3al.js → proof-iYIDiv8I.js} +47 -11
- package/dist/{proof-6gFMwMNJ.js → proof-iw6KtIyj.js} +3 -2
- package/dist/router-D9eI0s4b.js +118 -0
- package/dist/{send-Tl9NOnmO.js → send-Bn8o0mjW.js} +9 -4
- package/dist/sig/http.test.js +11 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +7 -11
- package/dist/sig/mod.d.cts +3 -7
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +3 -7
- package/dist/sig/owner.test.js +33 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/mod.d.ts +183 -7194
- package/dist/testing/mod.js +4 -4
- package/dist/{transformers-CoBS-oFG.cjs → transformers-BjBg6Lag.cjs} +2 -2
- package/dist/{transformers-BFT6d7J5.js → transformers-N_ip_y4P.js} +2 -2
- package/dist/{types-DqxyTxOf.js → types-8l28uC8o.js} +31 -26
- package/dist/{types-zqdWZh4O.cjs → types-B6z6CqIz.cjs} +33 -28
- package/dist/{types-BSuWJsOm.js → types-CPz01LGH.js} +3 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +211 -0
- package/dist/utils/mod.cjs +10 -0
- package/dist/utils/mod.d.cts +4 -0
- package/dist/utils/mod.d.ts +6 -0
- package/dist/utils/mod.js +9 -0
- package/package.json +34 -75
- package/dist/actor-Be0ThtXy.cjs +0 -42609
- package/dist/actor-ChbPLm6n.js +0 -42135
- package/dist/actor-D6K058Tb.d.cts +0 -128
- package/dist/actor-DuCeRiNh.js +0 -146
- package/dist/actor-T6RyhRgk.d.ts +0 -130
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-CrxhFL8e.js +0 -52
- package/dist/authdocloader-OSn_teLV.cjs +0 -58
- package/dist/denokv-Bv33Xxea.js +0 -57
- package/dist/docloader-CCqXeagZ.cjs +0 -4861
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/docloader-XK3y2jn5.js +0 -4795
- 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/media.example.com/avatars/test-avatar.jpg.json +0 -6
- 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-B3uag-rz.js +0 -10
- package/dist/key-BiBmb1Yy.cjs +0 -10
- package/dist/key-DK_nfU4I.js +0 -10
- package/dist/key-Z6ceKnZC.cjs +0 -290
- package/dist/key-jyNTxCvK.js +0 -260
- package/dist/lookup-BPviO8ij.js +0 -131
- package/dist/lookup-hnMAAU5r.cjs +0 -137
- package/dist/lookup-pV0JOsuV.js +0 -331
- package/dist/middleware-CI0-zw4U.js +0 -26
- package/dist/middleware-QNK-W-jE.cjs +0 -17
- package/dist/middleware-_vjt6FWU.js +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/mod-CxkWO3Mg.d.cts +0 -307
- package/dist/mod-DBzN0aCM.d.ts +0 -115
- package/dist/mod-DlU8ISoa.d.ts +0 -309
- package/dist/mod-FZd39qVq.d.cts +0 -1
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mod-jQ4OODsl.d.cts +0 -113
- package/dist/mq-B7R1Q-M5.d.cts +0 -140
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- 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.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- 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/type-C69ZBu7f.js +0 -47010
- package/dist/vocab/actor.test.d.ts +0 -3
- package/dist/vocab/actor.test.js +0 -5965
- package/dist/vocab/lookup.test.d.ts +0 -3
- package/dist/vocab/lookup.test.js +0 -456
- package/dist/vocab/mod.cjs +0 -87
- package/dist/vocab/mod.d.cts +0 -6
- package/dist/vocab/mod.d.ts +0 -8
- package/dist/vocab/mod.js +0 -10
- package/dist/vocab/schema.yaml +0 -247
- package/dist/vocab/type.test.d.ts +0 -3
- package/dist/vocab/type.test.js +0 -25
- package/dist/vocab/vocab.test.d.ts +0 -3
- package/dist/vocab/vocab.test.js +0 -3787
- package/dist/vocab-B39-pFl9.cjs +0 -291
- package/dist/vocab-BI0Ak5lL.d.ts +0 -14924
- package/dist/vocab-BWoeZsME.js +0 -255
- package/dist/vocab-Dw1-yVGg.d.cts +0 -14922
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.js +0 -195
- package/dist/webfinger/mod.cjs +0 -9
- package/dist/webfinger/mod.d.cts +0 -4
- package/dist/webfinger/mod.d.ts +0 -6
- package/dist/webfinger/mod.js +0 -9
- package/dist/webfinger-BjOEdFPs.cjs +0 -4
- package/dist/webfinger-De_bU0iE.js +0 -4
- package/dist/x/cfworkers.cjs +0 -100
- package/dist/x/cfworkers.d.cts +0 -59
- 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.cjs +0 -61
- package/dist/x/hono.d.cts +0 -54
- package/dist/x/hono.d.ts +0 -56
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.cjs +0 -69
- package/dist/x/sveltekit.d.cts +0 -46
- package/dist/x/sveltekit.d.ts +0 -48
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/webfinger.test.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-1E3W847c.d.ts} +0 -0
- /package/dist/{mod-C2tOeRkN.d.cts → mod-C81L6_lQ.d.cts} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BlLsRSiT.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-DuMYTpbZ.cjs} +0 -0
- /package/dist/{runtime/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-CwuONEzF.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DeXX2xnj.cjs} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.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
- /package/dist/{sig-ByHXzqUi.cjs → utils-Db0ZmjcD.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-Wranxuoe.js} +0 -0
|
@@ -3,23 +3,21 @@
|
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
|
6
|
-
const require_transformers = require('./transformers-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const require_http = require('./http-C7vbQwbz.cjs');
|
|
12
|
-
const require_proof = require('./proof-B-eqv0Ug.cjs');
|
|
13
|
-
const require_types = require('./types-zqdWZh4O.cjs');
|
|
14
|
-
const require_authdocloader = require('./authdocloader-OSn_teLV.cjs');
|
|
15
|
-
const require_vocab = require('./vocab-B39-pFl9.cjs');
|
|
6
|
+
const require_transformers = require('./transformers-BjBg6Lag.cjs');
|
|
7
|
+
const require_http = require('./http-7RQPvAkX.cjs');
|
|
8
|
+
const require_proof = require('./proof-CaDQpGJD.cjs');
|
|
9
|
+
const require_types = require('./types-B6z6CqIz.cjs');
|
|
10
|
+
const require_kv_cache = require('./kv-cache-BVA7CrnS.cjs');
|
|
16
11
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
12
|
+
const __fedify_vocab = require_chunk.__toESM(require("@fedify/vocab"));
|
|
17
13
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
18
|
-
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
|
19
14
|
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
|
20
15
|
const uri_template_router = require_chunk.__toESM(require("uri-template-router"));
|
|
21
16
|
const url_template = require_chunk.__toESM(require("url-template"));
|
|
17
|
+
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
|
22
18
|
const __opentelemetry_semantic_conventions = require_chunk.__toESM(require("@opentelemetry/semantic-conventions"));
|
|
19
|
+
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
|
20
|
+
const __fedify_webfinger = require_chunk.__toESM(require("@fedify/webfinger"));
|
|
23
21
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
24
22
|
|
|
25
23
|
//#region src/federation/inbox.ts
|
|
@@ -43,7 +41,7 @@ var InboxListenerSet = class InboxListenerSet {
|
|
|
43
41
|
if (inboxListeners == null) return null;
|
|
44
42
|
while (true) {
|
|
45
43
|
if (inboxListeners.has(cls)) break;
|
|
46
|
-
if (cls ===
|
|
44
|
+
if (cls === __fedify_vocab.Activity) return null;
|
|
47
45
|
cls = globalThis.Object.getPrototypeOf(cls);
|
|
48
46
|
}
|
|
49
47
|
const listener = inboxListeners.get(cls);
|
|
@@ -64,7 +62,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
64
62
|
]);
|
|
65
63
|
let cacheKey = null;
|
|
66
64
|
if (activity.id != null) {
|
|
67
|
-
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href,
|
|
65
|
+
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, (0, __fedify_vocab.getTypeId)(activity).href);
|
|
68
66
|
const strategy = idempotencyStrategy ?? "per-inbox";
|
|
69
67
|
let keyString;
|
|
70
68
|
if (typeof strategy === "function") {
|
|
@@ -143,7 +141,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
143
141
|
return "enqueued";
|
|
144
142
|
}
|
|
145
143
|
tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
146
|
-
const tracer = tracerProvider.getTracer(
|
|
144
|
+
const tracer = tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
147
145
|
return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: __opentelemetry_api.SpanKind.INTERNAL }, async (span$1) => {
|
|
148
146
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
149
147
|
if (dispatched == null) {
|
|
@@ -153,7 +151,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
153
151
|
});
|
|
154
152
|
span$1.setStatus({
|
|
155
153
|
code: __opentelemetry_api.SpanStatusCode.UNSET,
|
|
156
|
-
message: `Unsupported activity type: ${
|
|
154
|
+
message: `Unsupported activity type: ${(0, __fedify_vocab.getTypeId)(activity).href}`
|
|
157
155
|
});
|
|
158
156
|
span$1.end();
|
|
159
157
|
return "unsupportedActivity";
|
|
@@ -161,7 +159,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
161
159
|
const { class: cls, listener } = dispatched;
|
|
162
160
|
span$1.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
163
161
|
try {
|
|
164
|
-
await listener(inboxContextFactory(recipient, json, activity?.id?.href,
|
|
162
|
+
await listener(inboxContextFactory(recipient, json, activity?.id?.href, (0, __fedify_vocab.getTypeId)(activity).href), activity);
|
|
165
163
|
} catch (error) {
|
|
166
164
|
try {
|
|
167
165
|
await inboxErrorHandler?.(ctx, error);
|
|
@@ -340,7 +338,7 @@ var FederationBuilderImpl = class {
|
|
|
340
338
|
this.collectionTypeIds = {};
|
|
341
339
|
}
|
|
342
340
|
async build(options) {
|
|
343
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
|
341
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-C567nJlD.cjs"));
|
|
344
342
|
const f = new FederationImpl$1(options);
|
|
345
343
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
346
344
|
f.router = this.router.clone();
|
|
@@ -366,7 +364,7 @@ var FederationBuilderImpl = class {
|
|
|
366
364
|
return f;
|
|
367
365
|
}
|
|
368
366
|
_getTracer() {
|
|
369
|
-
return __opentelemetry_api.trace.getTracer(
|
|
367
|
+
return __opentelemetry_api.trace.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
370
368
|
}
|
|
371
369
|
setActorDispatcher(path, dispatcher) {
|
|
372
370
|
if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
|
|
@@ -386,7 +384,7 @@ var FederationBuilderImpl = class {
|
|
|
386
384
|
const actor$1 = await dispatcher(context$2, identifier);
|
|
387
385
|
span.setAttribute("activitypub.actor.id", (actor$1?.id ?? context$2.getActorUri(identifier)).href);
|
|
388
386
|
if (actor$1 == null) span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
|
|
389
|
-
else span.setAttribute("activitypub.actor.type",
|
|
387
|
+
else span.setAttribute("activitypub.actor.type", (0, __fedify_vocab.getTypeId)(actor$1).href);
|
|
390
388
|
return actor$1;
|
|
391
389
|
} catch (error) {
|
|
392
390
|
span.setStatus({
|
|
@@ -509,7 +507,7 @@ var FederationBuilderImpl = class {
|
|
|
509
507
|
const object = await dispatcher(ctx, values);
|
|
510
508
|
span.setAttribute("activitypub.object.id", (object?.id ?? ctx.getObjectUri(cls, values)).href);
|
|
511
509
|
if (object == null) span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
|
|
512
|
-
else span.setAttribute("activitypub.object.type",
|
|
510
|
+
else span.setAttribute("activitypub.object.type", (0, __fedify_vocab.getTypeId)(object).href);
|
|
513
511
|
return object;
|
|
514
512
|
} catch (e) {
|
|
515
513
|
span.setStatus({
|
|
@@ -793,11 +791,11 @@ var FederationBuilderImpl = class {
|
|
|
793
791
|
};
|
|
794
792
|
return setters;
|
|
795
793
|
}
|
|
796
|
-
setCollectionDispatcher(name,
|
|
797
|
-
return this.#setCustomCollectionDispatcher(name, "collection",
|
|
794
|
+
setCollectionDispatcher(name, itemType, path, dispatcher) {
|
|
795
|
+
return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
|
|
798
796
|
}
|
|
799
|
-
setOrderedCollectionDispatcher(name,
|
|
800
|
-
return this.#setCustomCollectionDispatcher(name, "orderedCollection",
|
|
797
|
+
setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
|
|
798
|
+
return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
|
|
801
799
|
}
|
|
802
800
|
#setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
|
|
803
801
|
const strName = String(name);
|
|
@@ -924,10 +922,10 @@ var KvKeyCache = class {
|
|
|
924
922
|
const serialized = await this.kv.get([...this.prefix, keyId.href]);
|
|
925
923
|
if (serialized == null) return void 0;
|
|
926
924
|
try {
|
|
927
|
-
return await
|
|
925
|
+
return await __fedify_vocab.CryptographicKey.fromJsonLd(serialized, this.options);
|
|
928
926
|
} catch {
|
|
929
927
|
try {
|
|
930
|
-
return await
|
|
928
|
+
return await __fedify_vocab.Multikey.fromJsonLd(serialized, this.options);
|
|
931
929
|
} catch {
|
|
932
930
|
await this.kv.delete([...this.prefix, keyId.href]);
|
|
933
931
|
return void 0;
|
|
@@ -1113,7 +1111,7 @@ async function handleObject(request, { values, context: context$2, objectDispatc
|
|
|
1113
1111
|
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$2, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
|
1114
1112
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
1115
1113
|
tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
1116
|
-
const tracer = tracerProvider.getTracer(
|
|
1114
|
+
const tracer = tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
1117
1115
|
const url = new URL(request.url);
|
|
1118
1116
|
const cursor = url.searchParams.get("cursor");
|
|
1119
1117
|
if (collectionCallbacks == null) return await onNotFound(request);
|
|
@@ -1127,7 +1125,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1127
1125
|
kind: __opentelemetry_api.SpanKind.SERVER,
|
|
1128
1126
|
attributes: {
|
|
1129
1127
|
"activitypub.collection.id": baseUri.href,
|
|
1130
|
-
"activitypub.collection.type":
|
|
1128
|
+
"activitypub.collection.type": __fedify_vocab.OrderedCollection.typeId.href
|
|
1131
1129
|
}
|
|
1132
1130
|
}, async (span) => {
|
|
1133
1131
|
if (totalItems != null) span.setAttribute("activitypub.collection.total_items", Number(totalItems));
|
|
@@ -1151,7 +1149,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1151
1149
|
}
|
|
1152
1150
|
});
|
|
1153
1151
|
if (itemsOrResponse instanceof Response) return itemsOrResponse;
|
|
1154
|
-
collection = new
|
|
1152
|
+
collection = new __fedify_vocab.OrderedCollection({
|
|
1155
1153
|
id: baseUri,
|
|
1156
1154
|
totalItems: totalItems == null ? null : Number(totalItems),
|
|
1157
1155
|
items: filterCollectionItems(itemsOrResponse, name, filterPredicate)
|
|
@@ -1165,7 +1163,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1165
1163
|
last = new URL(context$2.url);
|
|
1166
1164
|
last.searchParams.set("cursor", lastCursor);
|
|
1167
1165
|
}
|
|
1168
|
-
collection = new
|
|
1166
|
+
collection = new __fedify_vocab.OrderedCollection({
|
|
1169
1167
|
id: baseUri,
|
|
1170
1168
|
totalItems: totalItems == null ? null : Number(totalItems),
|
|
1171
1169
|
first,
|
|
@@ -1179,7 +1177,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1179
1177
|
kind: __opentelemetry_api.SpanKind.SERVER,
|
|
1180
1178
|
attributes: {
|
|
1181
1179
|
"activitypub.collection.id": uri.href,
|
|
1182
|
-
"activitypub.collection.type":
|
|
1180
|
+
"activitypub.collection.type": __fedify_vocab.OrderedCollectionPage.typeId.href,
|
|
1183
1181
|
"fedify.collection.cursor": cursor
|
|
1184
1182
|
}
|
|
1185
1183
|
}, async (span) => {
|
|
@@ -1215,7 +1213,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1215
1213
|
}
|
|
1216
1214
|
const partOf = new URL(context$2.url);
|
|
1217
1215
|
partOf.searchParams.delete("cursor");
|
|
1218
|
-
collection = new
|
|
1216
|
+
collection = new __fedify_vocab.OrderedCollectionPage({
|
|
1219
1217
|
id: uri,
|
|
1220
1218
|
prev,
|
|
1221
1219
|
next,
|
|
@@ -1263,7 +1261,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
1263
1261
|
let logged = false;
|
|
1264
1262
|
for (const item of items) {
|
|
1265
1263
|
let mappedItem;
|
|
1266
|
-
if (item instanceof
|
|
1264
|
+
if (item instanceof __fedify_vocab.Object || item instanceof __fedify_vocab.Link || item instanceof URL) mappedItem = item;
|
|
1267
1265
|
else if (item.id == null) continue;
|
|
1268
1266
|
else mappedItem = item.id;
|
|
1269
1267
|
if (filterPredicate != null && !filterPredicate(item)) {
|
|
@@ -1290,7 +1288,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
1290
1288
|
*/
|
|
1291
1289
|
async function handleInbox(request, options) {
|
|
1292
1290
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
1293
|
-
const tracer = tracerProvider.getTracer(
|
|
1291
|
+
const tracer = tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
1294
1292
|
return await tracer.startActiveSpan("activitypub.inbox", {
|
|
1295
1293
|
kind: options.queue == null ? __opentelemetry_api.SpanKind.SERVER : __opentelemetry_api.SpanKind.PRODUCER,
|
|
1296
1294
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
|
@@ -1418,14 +1416,14 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1418
1416
|
recipient,
|
|
1419
1417
|
json
|
|
1420
1418
|
});
|
|
1421
|
-
activity = await
|
|
1419
|
+
activity = await __fedify_vocab.Activity.fromJsonLd(jsonWithoutSig, ctx);
|
|
1422
1420
|
} else {
|
|
1423
1421
|
logger$1.debug("Linked Data Signatures are not verified.", {
|
|
1424
1422
|
recipient,
|
|
1425
1423
|
json
|
|
1426
1424
|
});
|
|
1427
1425
|
try {
|
|
1428
|
-
activity = await require_proof.verifyObject(
|
|
1426
|
+
activity = await require_proof.verifyObject(__fedify_vocab.Activity, jsonWithoutSig, {
|
|
1429
1427
|
contextLoader: ctx.contextLoader,
|
|
1430
1428
|
documentLoader: ctx.documentLoader,
|
|
1431
1429
|
keyCache,
|
|
@@ -1488,10 +1486,17 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1488
1486
|
} else logger$1.debug("HTTP Signatures are verified.", { recipient });
|
|
1489
1487
|
httpSigKey = key;
|
|
1490
1488
|
}
|
|
1491
|
-
activity = await
|
|
1489
|
+
activity = await __fedify_vocab.Activity.fromJsonLd(jsonWithoutSig, ctx);
|
|
1492
1490
|
}
|
|
1493
1491
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
1494
|
-
span.setAttribute("activitypub.activity.type",
|
|
1492
|
+
span.setAttribute("activitypub.activity.type", (0, __fedify_vocab.getTypeId)(activity).href);
|
|
1493
|
+
span.addEvent("activitypub.activity.received", {
|
|
1494
|
+
"activitypub.activity.json": JSON.stringify(json),
|
|
1495
|
+
"activitypub.activity.verified": activity != null,
|
|
1496
|
+
"ld_signatures.verified": ldSigVerified,
|
|
1497
|
+
"http_signatures.verified": httpSigKey != null,
|
|
1498
|
+
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
1499
|
+
});
|
|
1495
1500
|
if (httpSigKey != null && !await require_proof.doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
1496
1501
|
logger$1.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
1497
1502
|
activity: json,
|
|
@@ -1551,7 +1556,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1551
1556
|
/**
|
|
1552
1557
|
* Handles a custom collection request.
|
|
1553
1558
|
* @template TItem The type of items in the collection.
|
|
1554
|
-
* @template
|
|
1559
|
+
* @template TParam The parameter names of the requested URL.
|
|
1555
1560
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
|
1556
1561
|
* @template TContextData The context data to pass to the `TContext`.
|
|
1557
1562
|
* @param request The HTTP request.
|
|
@@ -1564,12 +1569,12 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
|
1564
1569
|
verifyDefined(callbacks);
|
|
1565
1570
|
await authIfNeeded(context$2, values, callbacks);
|
|
1566
1571
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1567
|
-
return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider,
|
|
1572
|
+
return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider, __fedify_vocab.Collection, __fedify_vocab.CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
1568
1573
|
}
|
|
1569
1574
|
/**
|
|
1570
1575
|
* Handles an ordered collection request.
|
|
1571
1576
|
* @template TItem The type of items in the collection.
|
|
1572
|
-
* @template
|
|
1577
|
+
* @template TParam The parameter names of the requested URL.
|
|
1573
1578
|
* @template TContext The type of the context, extending {@link RequestContext}.
|
|
1574
1579
|
* @template TContextData The context data to pass to the `TContext`.
|
|
1575
1580
|
* @param request The HTTP request.
|
|
@@ -1582,14 +1587,14 @@ async function _handleOrderedCollection(request, { name, values, context: contex
|
|
|
1582
1587
|
verifyDefined(callbacks);
|
|
1583
1588
|
await authIfNeeded(context$2, values, callbacks);
|
|
1584
1589
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1585
|
-
return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider,
|
|
1590
|
+
return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider, __fedify_vocab.OrderedCollection, __fedify_vocab.OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
1586
1591
|
}
|
|
1587
1592
|
/**
|
|
1588
1593
|
* Handling custom collections with support for pagination and filtering.
|
|
1589
1594
|
* The main flow is on `getCollection`, `dispatch`.
|
|
1590
1595
|
*
|
|
1591
1596
|
* @template TItem The type of items in the collection.
|
|
1592
|
-
* @template
|
|
1597
|
+
* @template TParam The parameter names of the requested URL.
|
|
1593
1598
|
* @template TContext The type of the context. {@link Context} or {@link RequestContext}.
|
|
1594
1599
|
* @template TContextData The context data to pass to the `TContext`.
|
|
1595
1600
|
* @template TCollection The type of the collection, extending {@link Collection}.
|
|
@@ -1623,14 +1628,14 @@ var CustomCollectionHandler = class {
|
|
|
1623
1628
|
#collection = null;
|
|
1624
1629
|
/**
|
|
1625
1630
|
* Creates a new CustomCollection instance.
|
|
1626
|
-
* @param
|
|
1627
|
-
* @param
|
|
1628
|
-
* @param
|
|
1629
|
-
* @param
|
|
1630
|
-
* @param
|
|
1631
|
-
* @param
|
|
1632
|
-
* @param
|
|
1633
|
-
* @param
|
|
1631
|
+
* @param name The name of the collection.
|
|
1632
|
+
* @param values The parameter values for the collection.
|
|
1633
|
+
* @param context The request context.
|
|
1634
|
+
* @param callbacks The collection callbacks.
|
|
1635
|
+
* @param tracerProvider The tracer provider for telemetry.
|
|
1636
|
+
* @param Collection The Collection constructor.
|
|
1637
|
+
* @param CollectionPage The CollectionPage constructor.
|
|
1638
|
+
* @param filterPredicate Optional filter predicate for items.
|
|
1634
1639
|
*/
|
|
1635
1640
|
constructor(name, values, context$2, callbacks, tracerProvider = __opentelemetry_api.trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
|
1636
1641
|
this.name = name;
|
|
@@ -1642,7 +1647,7 @@ var CustomCollectionHandler = class {
|
|
|
1642
1647
|
this.CollectionPage = CollectionPage$1;
|
|
1643
1648
|
this.filterPredicate = filterPredicate;
|
|
1644
1649
|
this.name = this.name.trim().replace(/\s+/g, "_");
|
|
1645
|
-
this.#tracer = this.tracerProvider.getTracer(
|
|
1650
|
+
this.#tracer = this.tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
1646
1651
|
this.#id = new URL(this.context.url);
|
|
1647
1652
|
this.#dispatcher = callbacks.dispatcher.bind(callbacks);
|
|
1648
1653
|
}
|
|
@@ -1755,7 +1760,7 @@ var CustomCollectionHandler = class {
|
|
|
1755
1760
|
/**
|
|
1756
1761
|
* Creates a function to wrap the dispatcher so tracing can be applied.
|
|
1757
1762
|
* @param params Parameters including cursor and total items.
|
|
1758
|
-
* @returns
|
|
1763
|
+
* @returns A function that handles the span operation.
|
|
1759
1764
|
*/
|
|
1760
1765
|
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
|
1761
1766
|
try {
|
|
@@ -1776,23 +1781,23 @@ var CustomCollectionHandler = class {
|
|
|
1776
1781
|
};
|
|
1777
1782
|
/**
|
|
1778
1783
|
* Dispatches the collection request to get items.
|
|
1779
|
-
* @param
|
|
1780
|
-
* @returns
|
|
1784
|
+
* @param cursor The cursor for pagination, or null for the first page.
|
|
1785
|
+
* @returns A promise that resolves to the page items.
|
|
1781
1786
|
*/
|
|
1782
1787
|
async dispatch(cursor = null) {
|
|
1783
1788
|
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
|
1784
1789
|
}
|
|
1785
1790
|
/**
|
|
1786
1791
|
* Filters the items in the collection.
|
|
1787
|
-
* @param
|
|
1788
|
-
* @returns
|
|
1792
|
+
* @param items The items to filter.
|
|
1793
|
+
* @returns The filtered items.
|
|
1789
1794
|
*/
|
|
1790
1795
|
filterItems(items) {
|
|
1791
1796
|
return filterCollectionItems(items, this.name, this.filterPredicate);
|
|
1792
1797
|
}
|
|
1793
1798
|
/**
|
|
1794
1799
|
* Appends a cursor to the URL if it exists.
|
|
1795
|
-
* @param
|
|
1800
|
+
* @param cursor The cursor to append, or null/undefined.
|
|
1796
1801
|
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
|
1797
1802
|
*/
|
|
1798
1803
|
appendToUrl(cursor) {
|
|
@@ -1800,8 +1805,7 @@ var CustomCollectionHandler = class {
|
|
|
1800
1805
|
}
|
|
1801
1806
|
/**
|
|
1802
1807
|
* Gets the stored collection or collection page.
|
|
1803
|
-
* @returns
|
|
1804
|
-
the collection or collection page.
|
|
1808
|
+
* @returns A promise that resolves to the collection or collection page.
|
|
1805
1809
|
*/
|
|
1806
1810
|
get collection() {
|
|
1807
1811
|
if (this.#collection === null) this.#collection = this.getCollection();
|
|
@@ -1809,8 +1813,8 @@ var CustomCollectionHandler = class {
|
|
|
1809
1813
|
}
|
|
1810
1814
|
/**
|
|
1811
1815
|
* Gets the total number of items in the collection.
|
|
1812
|
-
* @returns
|
|
1813
|
-
|
|
1816
|
+
* @returns A promise that resolves to the total items count,
|
|
1817
|
+
* or null if not available.
|
|
1814
1818
|
*/
|
|
1815
1819
|
get totalItems() {
|
|
1816
1820
|
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
|
@@ -1826,8 +1830,8 @@ var CustomCollectionHandler = class {
|
|
|
1826
1830
|
}
|
|
1827
1831
|
/**
|
|
1828
1832
|
* Gets the first cursor for pagination.
|
|
1829
|
-
* @returns
|
|
1830
|
-
or null if not available.
|
|
1833
|
+
* @returns A promise that resolves to the first cursor,
|
|
1834
|
+
* or null if not available.
|
|
1831
1835
|
*/
|
|
1832
1836
|
get firstCursor() {
|
|
1833
1837
|
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
|
@@ -2033,139 +2037,6 @@ function handleNodeInfoJrd(_request, context$2) {
|
|
|
2033
2037
|
return Promise.resolve(response);
|
|
2034
2038
|
}
|
|
2035
2039
|
|
|
2036
|
-
//#endregion
|
|
2037
|
-
//#region src/webfinger/handler.ts
|
|
2038
|
-
const logger = (0, __logtape_logtape.getLogger)([
|
|
2039
|
-
"fedify",
|
|
2040
|
-
"webfinger",
|
|
2041
|
-
"server"
|
|
2042
|
-
]);
|
|
2043
|
-
/**
|
|
2044
|
-
* Handles a WebFinger request. You would not typically call this function
|
|
2045
|
-
* directly, but instead use {@link Federation.fetch} method.
|
|
2046
|
-
* @param request The WebFinger request to handle.
|
|
2047
|
-
* @param parameters The parameters for handling the request.
|
|
2048
|
-
* @returns The response to the request.
|
|
2049
|
-
*/
|
|
2050
|
-
async function handleWebFinger(request, options) {
|
|
2051
|
-
if (options.tracer == null) return await handleWebFingerInternal(request, options);
|
|
2052
|
-
return await options.tracer.startActiveSpan("webfinger.handle", { kind: __opentelemetry_api.SpanKind.SERVER }, async (span) => {
|
|
2053
|
-
try {
|
|
2054
|
-
const response = await handleWebFingerInternal(request, options);
|
|
2055
|
-
span.setStatus({ code: response.ok ? __opentelemetry_api.SpanStatusCode.UNSET : __opentelemetry_api.SpanStatusCode.ERROR });
|
|
2056
|
-
return response;
|
|
2057
|
-
} catch (error) {
|
|
2058
|
-
span.setStatus({
|
|
2059
|
-
code: __opentelemetry_api.SpanStatusCode.ERROR,
|
|
2060
|
-
message: String(error)
|
|
2061
|
-
});
|
|
2062
|
-
throw error;
|
|
2063
|
-
} finally {
|
|
2064
|
-
span.end();
|
|
2065
|
-
}
|
|
2066
|
-
});
|
|
2067
|
-
}
|
|
2068
|
-
async function handleWebFingerInternal(request, { context: context$2, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
|
|
2069
|
-
if (actorDispatcher == null) {
|
|
2070
|
-
logger.error("Actor dispatcher is not set.");
|
|
2071
|
-
return await onNotFound(request);
|
|
2072
|
-
}
|
|
2073
|
-
const resource = context$2.url.searchParams.get("resource");
|
|
2074
|
-
if (resource == null) return new Response("Missing resource parameter.", { status: 400 });
|
|
2075
|
-
span?.setAttribute("webfinger.resource", resource);
|
|
2076
|
-
let resourceUrl;
|
|
2077
|
-
try {
|
|
2078
|
-
resourceUrl = new URL(resource);
|
|
2079
|
-
} catch (e) {
|
|
2080
|
-
if (e instanceof TypeError) return new Response("Invalid resource URL.", { status: 400 });
|
|
2081
|
-
throw e;
|
|
2082
|
-
}
|
|
2083
|
-
span?.setAttribute("webfinger.resource.scheme", resourceUrl.protocol.replace(/:$/, ""));
|
|
2084
|
-
async function mapUsernameToIdentifier(username) {
|
|
2085
|
-
if (actorHandleMapper == null) {
|
|
2086
|
-
logger.error("No actor handle mapper is set; use the WebFinger username {username} as the actor's internal identifier.", { username });
|
|
2087
|
-
return username;
|
|
2088
|
-
}
|
|
2089
|
-
const identifier$1 = await actorHandleMapper(context$2, username);
|
|
2090
|
-
if (identifier$1 == null) {
|
|
2091
|
-
logger.error("Actor {username} not found.", { username });
|
|
2092
|
-
return null;
|
|
2093
|
-
}
|
|
2094
|
-
return identifier$1;
|
|
2095
|
-
}
|
|
2096
|
-
let identifier = null;
|
|
2097
|
-
const uriParsed = context$2.parseUri(resourceUrl);
|
|
2098
|
-
if (uriParsed?.type != "actor") {
|
|
2099
|
-
const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
|
|
2100
|
-
if (match == null) {
|
|
2101
|
-
const result = await actorAliasMapper?.(context$2, resourceUrl);
|
|
2102
|
-
if (result == null) return await onNotFound(request);
|
|
2103
|
-
if ("identifier" in result) identifier = result.identifier;
|
|
2104
|
-
else identifier = await mapUsernameToIdentifier(result.username);
|
|
2105
|
-
} else {
|
|
2106
|
-
const portMatch = /:\d+$/.exec(match[2]);
|
|
2107
|
-
const normalizedHost = portMatch == null ? (0, node_url.domainToASCII)(match[2].toLowerCase()) : (0, node_url.domainToASCII)(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
|
|
2108
|
-
if (normalizedHost != context$2.url.host && normalizedHost != host) return await onNotFound(request);
|
|
2109
|
-
else {
|
|
2110
|
-
identifier = await mapUsernameToIdentifier(match[1]);
|
|
2111
|
-
resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
} else identifier = uriParsed.identifier;
|
|
2115
|
-
if (identifier == null) return await onNotFound(request);
|
|
2116
|
-
const actor = await actorDispatcher(context$2, identifier);
|
|
2117
|
-
if (actor == null) {
|
|
2118
|
-
logger.error("Actor {identifier} not found.", { identifier });
|
|
2119
|
-
return await onNotFound(request);
|
|
2120
|
-
}
|
|
2121
|
-
const links = [{
|
|
2122
|
-
rel: "self",
|
|
2123
|
-
href: context$2.getActorUri(identifier).href,
|
|
2124
|
-
type: "application/activity+json"
|
|
2125
|
-
}];
|
|
2126
|
-
for (const url of actor.urls) if (url instanceof require_actor.Link && url.href != null) links.push({
|
|
2127
|
-
rel: url.rel ?? "http://webfinger.net/rel/profile-page",
|
|
2128
|
-
href: url.href.href,
|
|
2129
|
-
type: url.mediaType == null ? void 0 : url.mediaType
|
|
2130
|
-
});
|
|
2131
|
-
else if (url instanceof URL) links.push({
|
|
2132
|
-
rel: "http://webfinger.net/rel/profile-page",
|
|
2133
|
-
href: url.href
|
|
2134
|
-
});
|
|
2135
|
-
for await (const image of actor.getIcons()) {
|
|
2136
|
-
if (image.url?.href == null) continue;
|
|
2137
|
-
const link = {
|
|
2138
|
-
rel: "http://webfinger.net/rel/avatar",
|
|
2139
|
-
href: image.url.href.toString()
|
|
2140
|
-
};
|
|
2141
|
-
if (image.mediaType != null) link.type = image.mediaType;
|
|
2142
|
-
links.push(link);
|
|
2143
|
-
}
|
|
2144
|
-
if (webFingerLinksDispatcher != null) {
|
|
2145
|
-
const customLinks = await webFingerLinksDispatcher(context$2, resourceUrl);
|
|
2146
|
-
if (customLinks != null) for (const link of customLinks) links.push(link);
|
|
2147
|
-
}
|
|
2148
|
-
const aliases = [];
|
|
2149
|
-
if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
|
|
2150
|
-
aliases.push(`acct:${actor.preferredUsername}@${host ?? context$2.url.host}`);
|
|
2151
|
-
if (host != null && host !== context$2.url.host) aliases.push(`acct:${actor.preferredUsername}@${context$2.url.host}`);
|
|
2152
|
-
}
|
|
2153
|
-
if (resourceUrl.href !== context$2.getActorUri(identifier).href) aliases.push(context$2.getActorUri(identifier).href);
|
|
2154
|
-
if (resourceUrl.protocol === "acct:" && host != null && host !== context$2.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
|
|
2155
|
-
const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
|
|
2156
|
-
aliases.push(`acct:${username}@${host}`);
|
|
2157
|
-
}
|
|
2158
|
-
const jrd = {
|
|
2159
|
-
subject: resourceUrl.href,
|
|
2160
|
-
aliases,
|
|
2161
|
-
links
|
|
2162
|
-
};
|
|
2163
|
-
return new Response(JSON.stringify(jrd), { headers: {
|
|
2164
|
-
"Content-Type": "application/jrd+json",
|
|
2165
|
-
"Access-Control-Allow-Origin": "*"
|
|
2166
|
-
} });
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
2040
|
//#endregion
|
|
2170
2041
|
//#region src/federation/retry.ts
|
|
2171
2042
|
/**
|
|
@@ -2234,7 +2105,7 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
|
|
|
2234
2105
|
*/
|
|
2235
2106
|
function sendActivity(options) {
|
|
2236
2107
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
2237
|
-
const tracer = tracerProvider.getTracer(
|
|
2108
|
+
const tracer = tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
2238
2109
|
return tracer.startActiveSpan("activitypub.send_activity", {
|
|
2239
2110
|
kind: __opentelemetry_api.SpanKind.CLIENT,
|
|
2240
2111
|
attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
|
|
@@ -2245,7 +2116,7 @@ function sendActivity(options) {
|
|
|
2245
2116
|
await sendActivityInternal({
|
|
2246
2117
|
...options,
|
|
2247
2118
|
tracerProvider
|
|
2248
|
-
});
|
|
2119
|
+
}, span);
|
|
2249
2120
|
} catch (e) {
|
|
2250
2121
|
span.setStatus({
|
|
2251
2122
|
code: __opentelemetry_api.SpanStatusCode.ERROR,
|
|
@@ -2257,7 +2128,7 @@ function sendActivity(options) {
|
|
|
2257
2128
|
}
|
|
2258
2129
|
});
|
|
2259
2130
|
}
|
|
2260
|
-
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }) {
|
|
2131
|
+
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
|
|
2261
2132
|
const logger$1 = (0, __logtape_logtape.getLogger)([
|
|
2262
2133
|
"fedify",
|
|
2263
2134
|
"federation",
|
|
@@ -2312,6 +2183,143 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2312
2183
|
});
|
|
2313
2184
|
throw new Error(`Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`);
|
|
2314
2185
|
}
|
|
2186
|
+
span.addEvent("activitypub.activity.sent", {
|
|
2187
|
+
"activitypub.activity.json": JSON.stringify(activity),
|
|
2188
|
+
"activitypub.inbox.url": inbox.href,
|
|
2189
|
+
"activitypub.activity.id": activityId ?? ""
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
//#endregion
|
|
2194
|
+
//#region src/federation/webfinger.ts
|
|
2195
|
+
const logger = (0, __logtape_logtape.getLogger)([
|
|
2196
|
+
"fedify",
|
|
2197
|
+
"webfinger",
|
|
2198
|
+
"server"
|
|
2199
|
+
]);
|
|
2200
|
+
/**
|
|
2201
|
+
* Handles a WebFinger request. You would not typically call this function
|
|
2202
|
+
* directly, but instead use {@link Federation.fetch} method.
|
|
2203
|
+
* @param request The WebFinger request to handle.
|
|
2204
|
+
* @param parameters The parameters for handling the request.
|
|
2205
|
+
* @returns The response to the request.
|
|
2206
|
+
*/
|
|
2207
|
+
async function handleWebFinger(request, options) {
|
|
2208
|
+
if (options.tracer == null) return await handleWebFingerInternal(request, options);
|
|
2209
|
+
return await options.tracer.startActiveSpan("webfinger.handle", { kind: __opentelemetry_api.SpanKind.SERVER }, async (span) => {
|
|
2210
|
+
try {
|
|
2211
|
+
const response = await handleWebFingerInternal(request, options);
|
|
2212
|
+
span.setStatus({ code: response.ok ? __opentelemetry_api.SpanStatusCode.UNSET : __opentelemetry_api.SpanStatusCode.ERROR });
|
|
2213
|
+
return response;
|
|
2214
|
+
} catch (error) {
|
|
2215
|
+
span.setStatus({
|
|
2216
|
+
code: __opentelemetry_api.SpanStatusCode.ERROR,
|
|
2217
|
+
message: String(error)
|
|
2218
|
+
});
|
|
2219
|
+
throw error;
|
|
2220
|
+
} finally {
|
|
2221
|
+
span.end();
|
|
2222
|
+
}
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
async function handleWebFingerInternal(request, { context: context$2, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
|
|
2226
|
+
if (actorDispatcher == null) {
|
|
2227
|
+
logger.error("Actor dispatcher is not set.");
|
|
2228
|
+
return await onNotFound(request);
|
|
2229
|
+
}
|
|
2230
|
+
const resource = context$2.url.searchParams.get("resource");
|
|
2231
|
+
if (resource == null) return new Response("Missing resource parameter.", { status: 400 });
|
|
2232
|
+
span?.setAttribute("webfinger.resource", resource);
|
|
2233
|
+
let resourceUrl;
|
|
2234
|
+
try {
|
|
2235
|
+
resourceUrl = new URL(resource);
|
|
2236
|
+
} catch (e) {
|
|
2237
|
+
if (e instanceof TypeError) return new Response("Invalid resource URL.", { status: 400 });
|
|
2238
|
+
throw e;
|
|
2239
|
+
}
|
|
2240
|
+
span?.setAttribute("webfinger.resource.scheme", resourceUrl.protocol.replace(/:$/, ""));
|
|
2241
|
+
async function mapUsernameToIdentifier(username) {
|
|
2242
|
+
if (actorHandleMapper == null) {
|
|
2243
|
+
logger.error("No actor handle mapper is set; use the WebFinger username {username} as the actor's internal identifier.", { username });
|
|
2244
|
+
return username;
|
|
2245
|
+
}
|
|
2246
|
+
const identifier$1 = await actorHandleMapper(context$2, username);
|
|
2247
|
+
if (identifier$1 == null) {
|
|
2248
|
+
logger.error("Actor {username} not found.", { username });
|
|
2249
|
+
return null;
|
|
2250
|
+
}
|
|
2251
|
+
return identifier$1;
|
|
2252
|
+
}
|
|
2253
|
+
let identifier = null;
|
|
2254
|
+
const uriParsed = context$2.parseUri(resourceUrl);
|
|
2255
|
+
if (uriParsed?.type != "actor") {
|
|
2256
|
+
const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
|
|
2257
|
+
if (match == null) {
|
|
2258
|
+
const result = await actorAliasMapper?.(context$2, resourceUrl);
|
|
2259
|
+
if (result == null) return await onNotFound(request);
|
|
2260
|
+
if ("identifier" in result) identifier = result.identifier;
|
|
2261
|
+
else identifier = await mapUsernameToIdentifier(result.username);
|
|
2262
|
+
} else {
|
|
2263
|
+
const portMatch = /:\d+$/.exec(match[2]);
|
|
2264
|
+
const normalizedHost = portMatch == null ? (0, node_url.domainToASCII)(match[2].toLowerCase()) : (0, node_url.domainToASCII)(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
|
|
2265
|
+
if (normalizedHost != context$2.url.host && normalizedHost != host) return await onNotFound(request);
|
|
2266
|
+
else {
|
|
2267
|
+
identifier = await mapUsernameToIdentifier(match[1]);
|
|
2268
|
+
resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
} else identifier = uriParsed.identifier;
|
|
2272
|
+
if (identifier == null) return await onNotFound(request);
|
|
2273
|
+
const actor = await actorDispatcher(context$2, identifier);
|
|
2274
|
+
if (actor == null) {
|
|
2275
|
+
logger.error("Actor {identifier} not found.", { identifier });
|
|
2276
|
+
return await onNotFound(request);
|
|
2277
|
+
}
|
|
2278
|
+
const links = [{
|
|
2279
|
+
rel: "self",
|
|
2280
|
+
href: context$2.getActorUri(identifier).href,
|
|
2281
|
+
type: "application/activity+json"
|
|
2282
|
+
}];
|
|
2283
|
+
for (const url of actor.urls) if (url instanceof __fedify_vocab.Link && url.href != null) links.push({
|
|
2284
|
+
rel: url.rel ?? "http://webfinger.net/rel/profile-page",
|
|
2285
|
+
href: url.href.href,
|
|
2286
|
+
type: url.mediaType == null ? void 0 : url.mediaType
|
|
2287
|
+
});
|
|
2288
|
+
else if (url instanceof URL) links.push({
|
|
2289
|
+
rel: "http://webfinger.net/rel/profile-page",
|
|
2290
|
+
href: url.href
|
|
2291
|
+
});
|
|
2292
|
+
for await (const image of actor.getIcons()) {
|
|
2293
|
+
if (image.url?.href == null) continue;
|
|
2294
|
+
links.push({
|
|
2295
|
+
rel: "http://webfinger.net/rel/avatar",
|
|
2296
|
+
href: image.url.href.toString(),
|
|
2297
|
+
...image.mediaType != null && { type: image.mediaType }
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
if (webFingerLinksDispatcher != null) {
|
|
2301
|
+
const customLinks = await webFingerLinksDispatcher(context$2, resourceUrl);
|
|
2302
|
+
if (customLinks != null) for (const link of customLinks) links.push(link);
|
|
2303
|
+
}
|
|
2304
|
+
const aliases = [];
|
|
2305
|
+
if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
|
|
2306
|
+
aliases.push(`acct:${actor.preferredUsername}@${host ?? context$2.url.host}`);
|
|
2307
|
+
if (host != null && host !== context$2.url.host) aliases.push(`acct:${actor.preferredUsername}@${context$2.url.host}`);
|
|
2308
|
+
}
|
|
2309
|
+
if (resourceUrl.href !== context$2.getActorUri(identifier).href) aliases.push(context$2.getActorUri(identifier).href);
|
|
2310
|
+
if (resourceUrl.protocol === "acct:" && host != null && host !== context$2.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
|
|
2311
|
+
const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
|
|
2312
|
+
aliases.push(`acct:${username}@${host}`);
|
|
2313
|
+
}
|
|
2314
|
+
const jrd = {
|
|
2315
|
+
subject: resourceUrl.href,
|
|
2316
|
+
aliases,
|
|
2317
|
+
links
|
|
2318
|
+
};
|
|
2319
|
+
return new Response(JSON.stringify(jrd), { headers: {
|
|
2320
|
+
"Content-Type": "application/jrd+json",
|
|
2321
|
+
"Access-Control-Allow-Origin": "*"
|
|
2322
|
+
} });
|
|
2315
2323
|
}
|
|
2316
2324
|
|
|
2317
2325
|
//#endregion
|
|
@@ -2351,7 +2359,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2351
2359
|
firstKnock;
|
|
2352
2360
|
constructor(options) {
|
|
2353
2361
|
super();
|
|
2354
|
-
const logger$1 = (0, __logtape_logtape.getLogger)(["fedify", "federation"]);
|
|
2355
2362
|
this.kv = options.kv;
|
|
2356
2363
|
this.kvPrefixes = {
|
|
2357
2364
|
activityIdempotence: ["_fedify", "activityIdempotence"],
|
|
@@ -2399,14 +2406,15 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2399
2406
|
this.router.trailingSlashInsensitive = options.trailingSlashInsensitive ?? false;
|
|
2400
2407
|
this._initializeRouter();
|
|
2401
2408
|
if (options.allowPrivateAddress || options.userAgent != null) {
|
|
2402
|
-
if (options.
|
|
2403
|
-
|
|
2409
|
+
if (options.documentLoaderFactory != null) throw new TypeError("Cannot set documentLoaderFactory with allowPrivateAddress or userAgent options.");
|
|
2410
|
+
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set contextLoaderFactory with allowPrivateAddress or userAgent options.");
|
|
2411
|
+
if (options.authenticatedDocumentLoaderFactory != null) throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with allowPrivateAddress or userAgent options.");
|
|
2404
2412
|
}
|
|
2405
2413
|
const { allowPrivateAddress, userAgent } = options;
|
|
2406
2414
|
this.allowPrivateAddress = allowPrivateAddress ?? false;
|
|
2407
2415
|
this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
|
|
2408
|
-
return
|
|
2409
|
-
loader:
|
|
2416
|
+
return require_kv_cache.kvCache({
|
|
2417
|
+
loader: (0, __fedify_vocab_runtime.getDocumentLoader)({
|
|
2410
2418
|
allowPrivateAddress: opts?.allowPrivateAddress ?? allowPrivateAddress,
|
|
2411
2419
|
userAgent: opts?.userAgent ?? userAgent
|
|
2412
2420
|
}),
|
|
@@ -2414,12 +2422,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2414
2422
|
prefix: this.kvPrefixes.remoteDocument
|
|
2415
2423
|
});
|
|
2416
2424
|
});
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
this.contextLoaderFactory = () => options.contextLoader;
|
|
2420
|
-
logger$1.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
|
|
2421
|
-
} else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
|
2422
|
-
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_authdocloader.getAuthenticatedDocumentLoader(identity, {
|
|
2425
|
+
this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
|
2426
|
+
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_kv_cache.getAuthenticatedDocumentLoader(identity, {
|
|
2423
2427
|
allowPrivateAddress,
|
|
2424
2428
|
userAgent,
|
|
2425
2429
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock),
|
|
@@ -2440,7 +2444,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2440
2444
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
2441
2445
|
}
|
|
2442
2446
|
_getTracer() {
|
|
2443
|
-
return this.tracerProvider.getTracer(
|
|
2447
|
+
return this.tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
2444
2448
|
}
|
|
2445
2449
|
async _startQueueInternal(ctxData, signal, queue) {
|
|
2446
2450
|
if (this.inboxQueue == null && this.outboxQueue == null) return;
|
|
@@ -2538,9 +2542,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2538
2542
|
});
|
|
2539
2543
|
const keys = await Promise.all(message.keys.map(async ({ keyId, privateKey }) => ({
|
|
2540
2544
|
keyId: new URL(keyId),
|
|
2541
|
-
privateKey: await
|
|
2545
|
+
privateKey: await require_http.importJwk(privateKey, "private")
|
|
2542
2546
|
})));
|
|
2543
|
-
const activity = await
|
|
2547
|
+
const activity = await __fedify_vocab.Activity.fromJsonLd(message.activity, {
|
|
2544
2548
|
contextLoader: this.contextLoaderFactory({
|
|
2545
2549
|
allowPrivateAddress: this.allowPrivateAddress,
|
|
2546
2550
|
userAgent: this.userAgent
|
|
@@ -2579,7 +2583,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2579
2583
|
for (const { keyId, privateKey } of message.keys) {
|
|
2580
2584
|
const pair = {
|
|
2581
2585
|
keyId: new URL(keyId),
|
|
2582
|
-
privateKey: await
|
|
2586
|
+
privateKey: await require_http.importJwk(privateKey, "private")
|
|
2583
2587
|
};
|
|
2584
2588
|
if (rsaKeyPair == null && pair.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKeyPair = pair;
|
|
2585
2589
|
keys.push(pair);
|
|
@@ -2602,7 +2606,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2602
2606
|
message: String(error)
|
|
2603
2607
|
});
|
|
2604
2608
|
const loaderOptions = this.#getLoaderOptions(message.baseUrl);
|
|
2605
|
-
const activity = await
|
|
2609
|
+
const activity = await __fedify_vocab.Activity.fromJsonLd(message.activity, {
|
|
2606
2610
|
contextLoader: this.contextLoaderFactory(loaderOptions),
|
|
2607
2611
|
documentLoader: rsaKeyPair == null ? this.documentLoaderFactory(loaderOptions) : this.authenticatedDocumentLoaderFactory(rsaKeyPair, loaderOptions),
|
|
2608
2612
|
tracerProvider: this.tracerProvider
|
|
@@ -2656,8 +2660,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2656
2660
|
const identity = await this.sharedInboxKeyDispatcher(context$2);
|
|
2657
2661
|
if (identity != null) context$2 = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context$2.getDocumentLoader(identity) : context$2.getDocumentLoader(identity) });
|
|
2658
2662
|
}
|
|
2659
|
-
const activity = await
|
|
2660
|
-
span.setAttribute("activitypub.activity.type",
|
|
2663
|
+
const activity = await __fedify_vocab.Activity.fromJsonLd(message.activity, context$2);
|
|
2664
|
+
span.setAttribute("activitypub.activity.type", (0, __fedify_vocab.getTypeId)(activity).href);
|
|
2661
2665
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
2662
2666
|
const cacheKey = activity.id == null ? null : [
|
|
2663
2667
|
...this.kvPrefixes.activityIdempotence,
|
|
@@ -2686,7 +2690,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2686
2690
|
});
|
|
2687
2691
|
span$1.setStatus({
|
|
2688
2692
|
code: __opentelemetry_api.SpanStatusCode.ERROR,
|
|
2689
|
-
message: `Unsupported activity type: ${
|
|
2693
|
+
message: `Unsupported activity type: ${(0, __fedify_vocab.getTypeId)(activity).href}`
|
|
2690
2694
|
});
|
|
2691
2695
|
span$1.end();
|
|
2692
2696
|
return;
|
|
@@ -2694,7 +2698,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2694
2698
|
const { class: cls, listener } = dispatched;
|
|
2695
2699
|
span$1.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
2696
2700
|
try {
|
|
2697
|
-
await listener(context$2.toInboxContext(message.identifier, message.activity, activity.id?.href,
|
|
2701
|
+
await listener(context$2.toInboxContext(message.identifier, message.activity, activity.id?.href, (0, __fedify_vocab.getTypeId)(activity).href), activity);
|
|
2698
2702
|
} catch (error) {
|
|
2699
2703
|
try {
|
|
2700
2704
|
await this.inboxErrorHandler?.(context$2, error);
|
|
@@ -2814,7 +2818,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2814
2818
|
let proofCreated = false;
|
|
2815
2819
|
let rsaKey = null;
|
|
2816
2820
|
for (const { keyId, privateKey } of keys) {
|
|
2817
|
-
|
|
2821
|
+
require_http.validateCryptoKey(privateKey, "private");
|
|
2818
2822
|
if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
|
2819
2823
|
rsaKey = {
|
|
2820
2824
|
keyId,
|
|
@@ -2866,7 +2870,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2866
2870
|
keys,
|
|
2867
2871
|
activity: jsonLd,
|
|
2868
2872
|
activityId: activity.id?.href,
|
|
2869
|
-
activityType:
|
|
2873
|
+
activityType: (0, __fedify_vocab.getTypeId)(activity).href,
|
|
2870
2874
|
inbox: new URL(inbox),
|
|
2871
2875
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
2872
2876
|
headers: collectionSync == null ? void 0 : new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) }),
|
|
@@ -2882,7 +2886,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2882
2886
|
});
|
|
2883
2887
|
const keyJwkPairs = [];
|
|
2884
2888
|
for (const { keyId, privateKey } of keys) {
|
|
2885
|
-
const privateKeyJwk = await
|
|
2889
|
+
const privateKeyJwk = await require_http.exportJwk(privateKey);
|
|
2886
2890
|
keyJwkPairs.push({
|
|
2887
2891
|
keyId: keyId.href,
|
|
2888
2892
|
privateKey: privateKeyJwk
|
|
@@ -2900,7 +2904,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2900
2904
|
keys: keyJwkPairs,
|
|
2901
2905
|
activity: jsonLd,
|
|
2902
2906
|
activityId: activity.id?.href,
|
|
2903
|
-
activityType:
|
|
2907
|
+
activityType: (0, __fedify_vocab.getTypeId)(activity).href,
|
|
2904
2908
|
inbox,
|
|
2905
2909
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
2906
2910
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3455,12 +3459,12 @@ var ContextImpl = class ContextImpl {
|
|
|
3455
3459
|
for (const keyPair of keyPairs) {
|
|
3456
3460
|
const newPair = {
|
|
3457
3461
|
...keyPair,
|
|
3458
|
-
cryptographicKey: new
|
|
3462
|
+
cryptographicKey: new __fedify_vocab.CryptographicKey({
|
|
3459
3463
|
id: keyPair.keyId,
|
|
3460
3464
|
owner,
|
|
3461
3465
|
publicKey: keyPair.publicKey
|
|
3462
3466
|
}),
|
|
3463
|
-
multikey: new
|
|
3467
|
+
multikey: new __fedify_vocab.Multikey({
|
|
3464
3468
|
id: keyPair.keyId,
|
|
3465
3469
|
controller: owner,
|
|
3466
3470
|
publicKey: keyPair.publicKey
|
|
@@ -3546,7 +3550,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3546
3550
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
3547
3551
|
}
|
|
3548
3552
|
lookupObject(identifier, options = {}) {
|
|
3549
|
-
return
|
|
3553
|
+
return (0, __fedify_vocab.lookupObject)(identifier, {
|
|
3550
3554
|
...options,
|
|
3551
3555
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3552
3556
|
contextLoader: options.contextLoader ?? this.contextLoader,
|
|
@@ -3556,7 +3560,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3556
3560
|
});
|
|
3557
3561
|
}
|
|
3558
3562
|
traverseCollection(collection, options = {}) {
|
|
3559
|
-
return
|
|
3563
|
+
return (0, __fedify_vocab.traverseCollection)(collection, {
|
|
3560
3564
|
...options,
|
|
3561
3565
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3562
3566
|
contextLoader: options.contextLoader ?? this.contextLoader
|
|
@@ -3574,7 +3578,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3574
3578
|
});
|
|
3575
3579
|
}
|
|
3576
3580
|
lookupWebFinger(resource, options = {}) {
|
|
3577
|
-
return
|
|
3581
|
+
return (0, __fedify_webfinger.lookupWebFinger)(resource, {
|
|
3578
3582
|
...options,
|
|
3579
3583
|
userAgent: options.userAgent ?? this.federation.userAgent,
|
|
3580
3584
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
@@ -3582,11 +3586,11 @@ var ContextImpl = class ContextImpl {
|
|
|
3582
3586
|
});
|
|
3583
3587
|
}
|
|
3584
3588
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
3585
|
-
const tracer = this.tracerProvider.getTracer(
|
|
3589
|
+
const tracer = this.tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
3586
3590
|
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
3587
3591
|
kind: this.federation.outboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
|
3588
3592
|
attributes: {
|
|
3589
|
-
"activitypub.activity.type":
|
|
3593
|
+
"activitypub.activity.type": (0, __fedify_vocab.getTypeId)(activity).href,
|
|
3590
3594
|
"activitypub.activity.to": activity.toIds.map((to) => to.href),
|
|
3591
3595
|
"activitypub.activity.cc": activity.toIds.map((cc) => cc.href),
|
|
3592
3596
|
"activitypub.activity.bto": activity.btoIds.map((bto) => bto.href),
|
|
@@ -3639,7 +3643,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3639
3643
|
keys = sender;
|
|
3640
3644
|
} else keys = [sender];
|
|
3641
3645
|
if (keys.length < 1) throw new TypeError("The sender's keys must not be empty.");
|
|
3642
|
-
for (const { privateKey } of keys)
|
|
3646
|
+
for (const { privateKey } of keys) require_http.validateCryptoKey(privateKey, "private");
|
|
3643
3647
|
const opts = { context: this };
|
|
3644
3648
|
let expandedRecipients;
|
|
3645
3649
|
if (Array.isArray(recipients)) expandedRecipients = recipients;
|
|
@@ -3680,7 +3684,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3680
3684
|
}
|
|
3681
3685
|
const keyJwkPairs = await Promise.all(keys.map(async ({ keyId, privateKey }) => ({
|
|
3682
3686
|
keyId: keyId.href,
|
|
3683
|
-
privateKey: await
|
|
3687
|
+
privateKey: await require_http.exportJwk(privateKey)
|
|
3684
3688
|
})));
|
|
3685
3689
|
const carrier = {};
|
|
3686
3690
|
__opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
|
|
@@ -3698,7 +3702,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3698
3702
|
contextLoader: this.contextLoader
|
|
3699
3703
|
}),
|
|
3700
3704
|
activityId: activity.id?.href,
|
|
3701
|
-
activityType:
|
|
3705
|
+
activityType: (0, __fedify_vocab.getTypeId)(activity).href,
|
|
3702
3706
|
collectionSync: opts.collectionSync,
|
|
3703
3707
|
traceContext: carrier
|
|
3704
3708
|
};
|
|
@@ -3728,10 +3732,10 @@ var ContextImpl = class ContextImpl {
|
|
|
3728
3732
|
}
|
|
3729
3733
|
routeActivity(recipient, activity, options = {}) {
|
|
3730
3734
|
const tracerProvider = this.tracerProvider ?? this.tracerProvider;
|
|
3731
|
-
const tracer = tracerProvider.getTracer(
|
|
3735
|
+
const tracer = tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
3732
3736
|
return tracer.startActiveSpan("activitypub.inbox", {
|
|
3733
3737
|
kind: this.federation.inboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.INTERNAL : __opentelemetry_api.SpanKind.PRODUCER,
|
|
3734
|
-
attributes: { "activitypub.activity.type":
|
|
3738
|
+
attributes: { "activitypub.activity.type": (0, __fedify_vocab.getTypeId)(activity).href }
|
|
3735
3739
|
}, async (span) => {
|
|
3736
3740
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
3737
3741
|
if (activity.toIds.length > 0) span.setAttribute("activitypub.activity.to", activity.toIds.map((to) => to.href));
|
|
@@ -3765,7 +3769,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3765
3769
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
3766
3770
|
const json = await activity.toJsonLd({ contextLoader });
|
|
3767
3771
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
3768
|
-
const verified = await require_proof.verifyObject(
|
|
3772
|
+
const verified = await require_proof.verifyObject(__fedify_vocab.Activity, json, {
|
|
3769
3773
|
contextLoader,
|
|
3770
3774
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3771
3775
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
@@ -3791,7 +3795,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3791
3795
|
activityId: activity.id.href
|
|
3792
3796
|
});
|
|
3793
3797
|
return false;
|
|
3794
|
-
} else if (!(fetched instanceof
|
|
3798
|
+
} else if (!(fetched instanceof __fedify_vocab.Activity)) {
|
|
3795
3799
|
logger$1.debug("Fetched object is not an Activity.", {
|
|
3796
3800
|
recipient,
|
|
3797
3801
|
activity: await fetched.toJsonLd({ contextLoader })
|
|
@@ -3946,7 +3950,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3946
3950
|
});
|
|
3947
3951
|
}
|
|
3948
3952
|
forwardActivity(forwarder, recipients, options) {
|
|
3949
|
-
const tracer = this.tracerProvider.getTracer(
|
|
3953
|
+
const tracer = this.tracerProvider.getTracer(require_http.deno_default.name, require_http.deno_default.version);
|
|
3950
3954
|
return tracer.startActiveSpan("activitypub.outbox", {
|
|
3951
3955
|
kind: this.federation.outboxQueue == null || options?.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
|
3952
3956
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
@@ -3998,7 +4002,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3998
4002
|
if (!require_proof.hasSignature(this.activity)) {
|
|
3999
4003
|
let hasProof;
|
|
4000
4004
|
try {
|
|
4001
|
-
const activity = await
|
|
4005
|
+
const activity = await __fedify_vocab.Activity.fromJsonLd(this.activity, this);
|
|
4002
4006
|
hasProof = await activity.getProof() != null;
|
|
4003
4007
|
} catch {
|
|
4004
4008
|
hasProof = false;
|
|
@@ -4047,7 +4051,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4047
4051
|
});
|
|
4048
4052
|
const keyJwkPairs = [];
|
|
4049
4053
|
for (const { keyId, privateKey } of keys) {
|
|
4050
|
-
const privateKeyJwk = await
|
|
4054
|
+
const privateKeyJwk = await require_http.exportJwk(privateKey);
|
|
4051
4055
|
keyJwkPairs.push({
|
|
4052
4056
|
keyId: keyId.href,
|
|
4053
4057
|
privateKey: privateKeyJwk
|
|
@@ -4217,6 +4221,12 @@ Object.defineProperty(exports, 'digest', {
|
|
|
4217
4221
|
return digest;
|
|
4218
4222
|
}
|
|
4219
4223
|
});
|
|
4224
|
+
Object.defineProperty(exports, 'handleWebFinger', {
|
|
4225
|
+
enumerable: true,
|
|
4226
|
+
get: function () {
|
|
4227
|
+
return handleWebFinger;
|
|
4228
|
+
}
|
|
4229
|
+
});
|
|
4220
4230
|
Object.defineProperty(exports, 'respondWithObject', {
|
|
4221
4231
|
enumerable: true,
|
|
4222
4232
|
get: function () {
|