@fedify/fedify 1.10.5 → 1.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actor-CjkHF7Cj.cjs → actor-BGIAXtRd.cjs} +3112 -4674
- package/dist/{actor-Ch9BTg3N.js → actor-C-_2S5Mn.mjs} +8 -15
- package/dist/{actor-CQdxP8N-.js → actor-Cujbx4Zv.js} +1205 -2768
- package/dist/{actor-eeONG_sv.d.ts → actor-DXwwgFeR.d.ts} +3 -3
- package/dist/{actor-D190nbTD.d.cts → actor-DxvGbmjm.d.cts} +3 -3
- package/dist/{assert-MZs1qjMx.js → assert-DikXweDx.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-C50x8tnw.mjs} +5 -9
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-CJC9ThS-.mjs} +6 -11
- package/dist/{assert_throws-BOO88avQ.js → assert_throws-BIL7gChy.mjs} +6 -10
- package/dist/{authdocloader-fR-Fqcpa.js → authdocloader-1Sk2bqFx.mjs} +9 -14
- package/dist/{authdocloader-COFZT9Wh.js → authdocloader-D4Y6iyTF.js} +8 -15
- package/dist/{authdocloader-zc5ibOmU.cjs → authdocloader-DQfruCir.cjs} +14 -22
- package/dist/{builder-YD0q32nG.js → builder-CZbrDRl7.mjs} +31 -40
- package/dist/{client-B3mQJNO7.d.ts → client-D7t26_op.d.ts} +2 -2
- package/dist/{client-BgCucCG7.js → client-Dyb8MI3u.mjs} +11 -15
- package/dist/{client-n6L4GtQL.d.cts → client-yc0Z0P6Y.d.cts} +2 -2
- package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -12
- package/dist/compat/mod.d.ts +78 -12
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-Cr5DIxq_.d.ts → context-C6n2yrj0.d.ts} +33 -26
- package/dist/{context-WJoO0SQs.d.cts → context-PfghnHYj.d.cts} +33 -26
- package/dist/{denokv-D0nfNQ1x.js → denokv-NJPMXyK0.mjs} +22 -11
- package/dist/{docloader-BucCRHZI.d.ts → docloader-D7k5A9JP.d.ts} +2 -7
- package/dist/{docloader-ChxNLZAA.d.cts → docloader-DbM94pGY.d.cts} +2 -7
- package/dist/{docloader-BETPdM09.js → docloader-Dtaju6oI.js} +18 -156
- package/dist/{docloader-irBWMSOZ.cjs → docloader-Q3DfzuUi.cjs} +116 -220
- package/dist/{esm-iGH0sRsE.js → esm-DOJg552-.mjs} +49 -85
- package/dist/federation/{builder.test.js → builder.test.mjs} +22 -41
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +29 -58
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +29 -59
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +10 -15
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -18
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +12 -26
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +182 -197
- package/dist/federation/mod.cjs +245 -21
- package/dist/federation/mod.d.cts +4 -13
- package/dist/federation/mod.d.ts +4 -13
- package/dist/federation/mod.js +240 -18
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +23 -38
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +9 -14
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +12 -19
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +24 -34
- package/dist/{http-PgdBoDIj.js → http-BRwSVBn1.mjs} +16 -32
- package/dist/{http-DS9z_HzB.d.ts → http-BYXQvoZQ.d.ts} +5 -9
- package/dist/{http-C_1RU1U_.d.cts → http-CMzg-A9P.d.cts} +5 -9
- package/dist/{http-CQAqR_vx.cjs → http-DCrun8ql.cjs} +51 -68
- package/dist/{http-CxiIW4rD.js → http-DRnRwr3i.js} +17 -33
- package/dist/{inbox-DcDIqTbR.js → inbox-pD1nbb_5.mjs} +17 -25
- package/dist/key-Cmbps6xt.cjs +4 -0
- package/dist/{key-dNFkodH5.cjs → key-DEYIxAFs.cjs} +42 -50
- package/dist/key-DMO0TgTa.mjs +5 -0
- package/dist/{key-I-ibyaZH.js → key-DdL5Oc59.mjs} +12 -18
- package/dist/{key-Cg0kO4dA.js → key-vIzWPiil.js} +19 -19
- package/dist/{keycache-hSs_XFSb.js → keycache-BVR9f06Y.mjs} +6 -10
- package/dist/{keys-CElJez9H.js → keys-Co-0pK8a.mjs} +6 -10
- package/dist/{kv-DipCBaw2.d.ts → kv-C6UC8M9S.d.ts} +1 -1
- package/dist/{kv-BqEOXcZv.d.cts → kv-ClC9WJh5.d.cts} +1 -1
- package/dist/{kv-QzKcOQgP.js → kv-OuT2IU64.mjs} +6 -10
- package/dist/{ld-b16r91YS.js → ld-BFaDk5gX.mjs} +17 -31
- package/dist/{lookup-CySNcNcC.js → lookup-CMYXdjVH.mjs} +8 -17
- package/dist/{lookup-Bfq9Jpm0.cjs → lookup-CZGJqSjm.cjs} +16 -23
- package/dist/{lookup-CiSAeWJl.js → lookup-jlmCTRsO.js} +5 -11
- package/dist/middleware-BWlZ-wms.cjs +4 -0
- package/dist/{middleware-C5emnCh-.js → middleware-BXD5WJbj.mjs} +276 -321
- package/dist/{middleware-Dxo56yae.cjs → middleware-BhMQrJXH.cjs} +494 -547
- package/dist/{middleware-Bs4xDuXR.js → middleware-CmA2E9Bu.js} +349 -393
- package/dist/middleware-H3Ce7yn3.mjs +5 -0
- package/dist/{mod-D5rfgGFE.d.cts → mod-BQ3lrlXU.d.cts} +3 -3
- package/dist/{mod-Dz5Y15Uy.d.cts → mod-C72agZIN.d.cts} +4 -4
- package/dist/{mod-CxMBb_dd.d.cts → mod-CDbqB60V.d.cts} +2 -2
- package/dist/{mod-DS4kJskR.d.ts → mod-Lj0W1nnG.d.ts} +3 -3
- package/dist/{mod-BZfdiPBo.d.ts → mod-_HNKaczF.d.ts} +4 -4
- package/dist/{mod-ChbckRnC.d.ts → mod-lHd-Zdd_.d.ts} +2 -2
- package/dist/mod.cjs +31 -33
- package/dist/mod.d.cts +15 -17
- package/dist/mod.d.ts +15 -17
- package/dist/mod.js +20 -23
- package/dist/{mq-B7R1Q-M5.d.cts → mq-CrItclRD.d.cts} +1 -1
- package/dist/{mq-CRGm1e_F.d.ts → mq-D_ZZRdby.d.ts} +1 -1
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +23 -45
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +14 -43
- package/dist/nodeinfo/mod.cjs +5 -9
- package/dist/nodeinfo/mod.d.cts +2 -5
- package/dist/nodeinfo/mod.d.ts +2 -5
- package/dist/nodeinfo/mod.js +4 -9
- package/dist/nodeinfo/semver.test.d.mts +2 -0
- package/dist/nodeinfo/{semver.test.js → semver.test.mjs} +28 -51
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +10 -21
- package/dist/otel/exporter.test.d.mts +2 -0
- package/dist/otel/{exporter.test.js → exporter.test.mjs} +122 -180
- package/dist/otel/mod.cjs +16 -22
- package/dist/otel/mod.d.cts +2 -2
- package/dist/otel/mod.d.ts +2 -2
- package/dist/otel/mod.js +9 -16
- package/dist/{otel-Chy5T2Xh.js → otel-0v4Zy01l.mjs} +5 -10
- package/dist/{owner-AcrG3Xz1.d.cts → owner-0yNTyGMb.d.cts} +4 -4
- package/dist/{owner-Bs-sPbHX.js → owner-CNdS8zxf.mjs} +11 -16
- package/dist/{owner-8NMhXwJd.d.ts → owner-CPEbNpnZ.d.ts} +4 -4
- package/dist/{proof-SgRikE_Y.js → proof-Co7YmDpv.mjs} +20 -32
- package/dist/{proof-flD2DeA-.js → proof-DHPbi_Mx.js} +34 -60
- package/dist/{proof-BvQS195q.cjs → proof-DcPdtve2.cjs} +115 -140
- package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
- package/dist/rolldown-runtime-C7fyD9f2.js +15 -0
- package/dist/runtime/authdocloader.test.d.mts +2 -0
- package/dist/runtime/{authdocloader.test.js → authdocloader.test.mjs} +16 -28
- package/dist/runtime/docloader.test.d.mts +2 -0
- package/dist/runtime/{docloader.test.js → docloader.test.mjs} +55 -77
- package/dist/runtime/key.test.d.mts +2 -0
- package/dist/runtime/{key.test.js → key.test.mjs} +27 -57
- package/dist/runtime/langstr.test.d.mts +2 -0
- package/dist/runtime/{langstr.test.js → langstr.test.mjs} +9 -19
- package/dist/runtime/link.test.d.mts +2 -0
- package/dist/runtime/{link.test.js → link.test.mjs} +7 -11
- package/dist/runtime/mod.cjs +7 -13
- package/dist/runtime/mod.d.cts +103 -6
- package/dist/runtime/mod.d.ts +103 -6
- package/dist/runtime/mod.js +6 -13
- package/dist/runtime/multibase/multibase.test.d.mts +2 -0
- package/dist/runtime/multibase/{multibase.test.js → multibase.test.mjs} +16 -33
- package/dist/runtime/url.test.d.mts +2 -0
- package/dist/runtime/{url.test.js → url.test.mjs} +10 -15
- package/dist/{semver-dArNLkR9.js → semver-CgD82xxg.mjs} +13 -28
- package/dist/{send-C0gFHa2i.js → send-BRCWNcMa.mjs} +7 -12
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +119 -203
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +13 -22
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +24 -39
- package/dist/sig/mod.cjs +7 -13
- package/dist/sig/mod.d.cts +3 -7
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +6 -13
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/{owner.test.js → owner.test.mjs} +23 -39
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +18 -31
- package/dist/{std__assert-X-_kMxKM.js → std__assert-2v7gYiZp.mjs} +13 -24
- package/dist/testing/docloader.test.d.mts +2 -0
- package/dist/testing/docloader.test.mjs +12 -0
- package/dist/testing/{mod.d.ts → mod.d.mts} +371 -541
- package/dist/testing/mod.mjs +5 -0
- package/dist/{testing-C1GIraJh.js → testing-BLIh1cXz.mjs} +27 -35
- package/dist/{transformers-BFT6d7J5.js → transformers-BV4OeK9o.js} +3 -7
- package/dist/{transformers-CoBS-oFG.cjs → transformers-CLtJ5H8o.cjs} +20 -25
- package/dist/{types-BgUCCngg.cjs → types-B34v-m2N.cjs} +45 -64
- package/dist/{types-BIgY6c-l.js → types-CAnkAQGM.mjs} +5 -9
- package/dist/{types-Bu-epI-z.js → types-CXZk86AG.js} +18 -36
- package/dist/vocab/actor.test.d.mts +2 -0
- package/dist/vocab/{actor.test.js → actor.test.mjs} +308 -550
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/lookup.test.d.mts +2 -0
- package/dist/vocab/{lookup.test.js → lookup.test.mjs} +34 -51
- package/dist/vocab/mod.cjs +256 -16
- package/dist/vocab/mod.d.cts +3 -5
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +249 -10
- package/dist/vocab/type.test.d.mts +2 -0
- package/dist/vocab/type.test.mjs +16 -0
- package/dist/vocab/vocab.test.d.mts +2 -0
- package/dist/vocab/{vocab.test.js → vocab.test.mjs} +178 -311
- package/dist/{vocab-BASuuzcJ.d.ts → vocab-DaT4UsJF.d.ts} +2 -2
- package/dist/{vocab-DPMmFPJ1.d.cts → vocab-DnlmNyXi.d.cts} +2 -2
- package/dist/{type-DUhon7qK.js → vocab-rT_94Pke.mjs} +1178 -2876
- package/dist/webfinger/handler.test.d.mts +2 -0
- package/dist/webfinger/{handler.test.js → handler.test.mjs} +23 -56
- package/dist/webfinger/lookup.test.d.mts +2 -0
- package/dist/webfinger/{lookup.test.js → lookup.test.mjs} +13 -27
- package/dist/webfinger/mod.cjs +5 -9
- package/dist/webfinger/mod.d.cts +1 -3
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +4 -9
- package/dist/x/cfworkers.cjs +25 -14
- package/dist/x/cfworkers.d.cts +33 -6
- package/dist/x/cfworkers.d.ts +33 -6
- package/dist/x/cfworkers.js +22 -12
- package/dist/x/cfworkers.test.d.mts +2 -0
- package/dist/x/{cfworkers.test.js → cfworkers.test.mjs} +28 -26
- package/dist/x/hono.cjs +25 -14
- package/dist/x/hono.d.cts +1 -11
- package/dist/x/hono.d.ts +1 -11
- package/dist/x/hono.js +22 -12
- package/dist/x/sveltekit.cjs +23 -12
- package/dist/x/sveltekit.d.cts +1 -11
- package/dist/x/sveltekit.d.ts +1 -11
- package/dist/x/sveltekit.js +20 -10
- package/package.json +2 -2
- package/dist/chunk-DqRYRqnO.cjs +0 -34
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -86
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/compat-nxUqe4Z-.js +0 -4
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -35
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation-C15gGOh1.cjs +0 -266
- package/dist/federation-K-xsO03l.js +0 -248
- package/dist/key-Bnod5wJl.js +0 -10
- package/dist/key-C6swTX71.js +0 -10
- package/dist/key-_Uq8gkmM.cjs +0 -10
- package/dist/middleware-BWsOtDIF.cjs +0 -17
- package/dist/middleware-Bm4bJzjg.js +0 -26
- package/dist/middleware-BvODpE_U.js +0 -17
- package/dist/mod-C2tOeRkN.d.cts +0 -1
- package/dist/mod-CD7gfdq3.d.ts +0 -104
- package/dist/mod-CnULG6Aa.d.ts +0 -82
- package/dist/mod-FZd39qVq.d.cts +0 -1
- package/dist/mod-JUhOKMHj.d.cts +0 -102
- package/dist/mod-OQfb33eH.d.cts +0 -80
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/semver.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-Co9lJrWl.cjs +0 -4
- package/dist/nodeinfo-DfycQ8Wf.js +0 -4
- package/dist/otel/exporter.test.d.ts +0 -3
- package/dist/runtime/authdocloader.test.d.ts +0 -3
- package/dist/runtime/docloader.test.d.ts +0 -3
- package/dist/runtime/key.test.d.ts +0 -3
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime-C58AJWSv.cjs +0 -4
- package/dist/runtime-DPYEDf-o.js +0 -4
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-ByHXzqUi.cjs +0 -4
- package/dist/sig-Cj3tk-ig.js +0 -4
- package/dist/testing/docloader.test.d.ts +0 -3
- package/dist/testing/docloader.test.js +0 -24
- package/dist/testing/mod.js +0 -10
- package/dist/vocab/actor.test.d.ts +0 -3
- package/dist/vocab/lookup.test.d.ts +0 -3
- 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-5i6DEIi6.cjs +0 -294
- package/dist/vocab-CBavAdew.js +0 -258
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger-BjOEdFPs.cjs +0 -4
- package/dist/webfinger-De_bU0iE.js +0 -4
- package/dist/x/cfworkers.test.d.ts +0 -3
- /package/dist/{mod-1pDWKvUL.d.ts → compat/transformers.test.d.mts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → federation/builder.test.d.mts} +0 -0
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const url_template = require_chunk.__toESM(require("url-template"));
|
|
22
|
-
const __opentelemetry_semantic_conventions = require_chunk.__toESM(require("@opentelemetry/semantic-conventions"));
|
|
23
|
-
const node_url = require_chunk.__toESM(require("node:url"));
|
|
24
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
+
const require_docloader = require("./docloader-Q3DfzuUi.cjs");
|
|
4
|
+
const require_transformers = require("./transformers-CLtJ5H8o.cjs");
|
|
5
|
+
const require_actor = require("./actor-BGIAXtRd.cjs");
|
|
6
|
+
const require_lookup = require("./lookup-CZGJqSjm.cjs");
|
|
7
|
+
const require_key = require("./key-DEYIxAFs.cjs");
|
|
8
|
+
const require_http = require("./http-DCrun8ql.cjs");
|
|
9
|
+
const require_proof = require("./proof-DcPdtve2.cjs");
|
|
10
|
+
const require_types = require("./types-B34v-m2N.cjs");
|
|
11
|
+
const require_authdocloader = require("./authdocloader-DQfruCir.cjs");
|
|
12
|
+
const require_vocab_mod = require("./vocab/mod.cjs");
|
|
13
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
14
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
15
|
+
let byte_encodings_hex = require("byte-encodings/hex");
|
|
16
|
+
let es_toolkit = require("es-toolkit");
|
|
17
|
+
let uri_template_router = require("uri-template-router");
|
|
18
|
+
let url_template = require("url-template");
|
|
19
|
+
let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
20
|
+
let node_url = require("node:url");
|
|
25
21
|
//#region src/federation/inbox.ts
|
|
26
22
|
var InboxListenerSet = class InboxListenerSet {
|
|
27
23
|
#listeners;
|
|
@@ -58,7 +54,7 @@ var InboxListenerSet = class InboxListenerSet {
|
|
|
58
54
|
};
|
|
59
55
|
let warnedAboutDefaultIdempotency = false;
|
|
60
56
|
async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
|
|
61
|
-
const logger
|
|
57
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
62
58
|
"fedify",
|
|
63
59
|
"federation",
|
|
64
60
|
"inbox"
|
|
@@ -68,14 +64,12 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
68
64
|
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, require_actor.getTypeId(activity).href);
|
|
69
65
|
const strategy = idempotencyStrategy ?? "per-origin";
|
|
70
66
|
if (idempotencyStrategy === void 0 && !warnedAboutDefaultIdempotency) {
|
|
71
|
-
logger
|
|
67
|
+
logger.warn("Using default idempotency strategy 'per-origin'. This default will change to 'per-inbox' in Fedify 2.0. Please explicitly set the idempotency strategy using .withIdempotency().");
|
|
72
68
|
warnedAboutDefaultIdempotency = true;
|
|
73
69
|
}
|
|
74
70
|
let keyString;
|
|
75
|
-
if (typeof strategy === "function")
|
|
76
|
-
|
|
77
|
-
keyString = result;
|
|
78
|
-
} else switch (strategy) {
|
|
71
|
+
if (typeof strategy === "function") keyString = await strategy(inboxContext, activity);
|
|
72
|
+
else switch (strategy) {
|
|
79
73
|
case "global":
|
|
80
74
|
keyString = activity.id.href;
|
|
81
75
|
break;
|
|
@@ -90,24 +84,23 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
90
84
|
if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
|
|
91
85
|
}
|
|
92
86
|
if (cacheKey != null) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
logger$1.debug("Activity {activityId} has already been processed.", {
|
|
87
|
+
if (await kv.get(cacheKey) === true) {
|
|
88
|
+
logger.debug("Activity {activityId} has already been processed.", {
|
|
96
89
|
activityId: activity.id?.href,
|
|
97
90
|
activity: json,
|
|
98
91
|
recipient
|
|
99
92
|
});
|
|
100
93
|
span.setStatus({
|
|
101
|
-
code:
|
|
94
|
+
code: _opentelemetry_api.SpanStatusCode.UNSET,
|
|
102
95
|
message: `Activity ${activity.id?.href} has already been processed.`
|
|
103
96
|
});
|
|
104
97
|
return "alreadyProcessed";
|
|
105
98
|
}
|
|
106
99
|
}
|
|
107
100
|
if (activity.actorId == null) {
|
|
108
|
-
logger
|
|
101
|
+
logger.error("Missing actor.", { activity: json });
|
|
109
102
|
span.setStatus({
|
|
110
|
-
code:
|
|
103
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
111
104
|
message: "Missing actor."
|
|
112
105
|
});
|
|
113
106
|
return "missingActor";
|
|
@@ -115,7 +108,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
115
108
|
span.setAttribute("activitypub.actor.id", activity.actorId.href);
|
|
116
109
|
if (queue != null) {
|
|
117
110
|
const carrier = {};
|
|
118
|
-
|
|
111
|
+
_opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
|
|
119
112
|
try {
|
|
120
113
|
await queue.enqueue({
|
|
121
114
|
type: "inbox",
|
|
@@ -128,80 +121,78 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
128
121
|
traceContext: carrier
|
|
129
122
|
});
|
|
130
123
|
} catch (error) {
|
|
131
|
-
logger
|
|
124
|
+
logger.error("Failed to enqueue the incoming activity {activityId}:\n{error}", {
|
|
132
125
|
error,
|
|
133
126
|
activityId: activity.id?.href,
|
|
134
127
|
activity: json,
|
|
135
128
|
recipient
|
|
136
129
|
});
|
|
137
130
|
span.setStatus({
|
|
138
|
-
code:
|
|
131
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
139
132
|
message: `Failed to enqueue the incoming activity ${activity.id?.href}.`
|
|
140
133
|
});
|
|
141
134
|
throw error;
|
|
142
135
|
}
|
|
143
|
-
logger
|
|
136
|
+
logger.info("Activity {activityId} is enqueued.", {
|
|
144
137
|
activityId: activity.id?.href,
|
|
145
138
|
activity: json,
|
|
146
139
|
recipient
|
|
147
140
|
});
|
|
148
141
|
return "enqueued";
|
|
149
142
|
}
|
|
150
|
-
tracerProvider = tracerProvider ??
|
|
151
|
-
|
|
152
|
-
return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: __opentelemetry_api.SpanKind.INTERNAL }, async (span$1) => {
|
|
143
|
+
tracerProvider = tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
144
|
+
return await tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: _opentelemetry_api.SpanKind.INTERNAL }, async (span) => {
|
|
153
145
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
154
146
|
if (dispatched == null) {
|
|
155
|
-
logger
|
|
147
|
+
logger.error("Unsupported activity type:\n{activity}", {
|
|
156
148
|
activity: json,
|
|
157
149
|
recipient
|
|
158
150
|
});
|
|
159
|
-
span
|
|
160
|
-
code:
|
|
151
|
+
span.setStatus({
|
|
152
|
+
code: _opentelemetry_api.SpanStatusCode.UNSET,
|
|
161
153
|
message: `Unsupported activity type: ${require_actor.getTypeId(activity).href}`
|
|
162
154
|
});
|
|
163
|
-
span
|
|
155
|
+
span.end();
|
|
164
156
|
return "unsupportedActivity";
|
|
165
157
|
}
|
|
166
158
|
const { class: cls, listener } = dispatched;
|
|
167
|
-
span
|
|
159
|
+
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
168
160
|
try {
|
|
169
161
|
await listener(inboxContextFactory(recipient, json, activity?.id?.href, require_actor.getTypeId(activity).href), activity);
|
|
170
162
|
} catch (error) {
|
|
171
163
|
try {
|
|
172
164
|
await inboxErrorHandler?.(ctx, error);
|
|
173
|
-
} catch (error
|
|
174
|
-
logger
|
|
175
|
-
error
|
|
165
|
+
} catch (error) {
|
|
166
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
167
|
+
error,
|
|
176
168
|
activityId: activity.id?.href,
|
|
177
169
|
activity: json,
|
|
178
170
|
recipient
|
|
179
171
|
});
|
|
180
172
|
}
|
|
181
|
-
logger
|
|
173
|
+
logger.error("Failed to process the incoming activity {activityId}:\n{error}", {
|
|
182
174
|
error,
|
|
183
175
|
activityId: activity.id?.href,
|
|
184
176
|
activity: json,
|
|
185
177
|
recipient
|
|
186
178
|
});
|
|
187
|
-
span
|
|
188
|
-
code:
|
|
179
|
+
span.setStatus({
|
|
180
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
189
181
|
message: String(error)
|
|
190
182
|
});
|
|
191
|
-
span
|
|
183
|
+
span.end();
|
|
192
184
|
return "error";
|
|
193
185
|
}
|
|
194
186
|
if (cacheKey != null) await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
|
|
195
|
-
logger
|
|
187
|
+
logger.info("Activity {activityId} has been processed.", {
|
|
196
188
|
activityId: activity.id?.href,
|
|
197
189
|
activity: json,
|
|
198
190
|
recipient
|
|
199
191
|
});
|
|
200
|
-
span
|
|
192
|
+
span.end();
|
|
201
193
|
return "success";
|
|
202
194
|
});
|
|
203
195
|
}
|
|
204
|
-
|
|
205
196
|
//#endregion
|
|
206
197
|
//#region src/federation/router.ts
|
|
207
198
|
function cloneInnerRouter(router) {
|
|
@@ -309,7 +300,6 @@ var RouterError = class extends Error {
|
|
|
309
300
|
this.name = "RouterError";
|
|
310
301
|
}
|
|
311
302
|
};
|
|
312
|
-
|
|
313
303
|
//#endregion
|
|
314
304
|
//#region src/federation/builder.ts
|
|
315
305
|
var FederationBuilderImpl = class {
|
|
@@ -345,8 +335,8 @@ var FederationBuilderImpl = class {
|
|
|
345
335
|
this.collectionTypeIds = {};
|
|
346
336
|
}
|
|
347
337
|
async build(options) {
|
|
348
|
-
const { FederationImpl
|
|
349
|
-
const f = new FederationImpl
|
|
338
|
+
const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-BWlZ-wms.cjs"));
|
|
339
|
+
const f = new FederationImpl(options);
|
|
350
340
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
351
341
|
f.router = this.router.clone();
|
|
352
342
|
f.router.trailingSlashInsensitive = trailingSlashInsensitiveValue;
|
|
@@ -371,31 +361,31 @@ var FederationBuilderImpl = class {
|
|
|
371
361
|
return f;
|
|
372
362
|
}
|
|
373
363
|
_getTracer() {
|
|
374
|
-
return
|
|
364
|
+
return _opentelemetry_api.trace.getTracer(require_docloader.name, require_docloader.version);
|
|
375
365
|
}
|
|
376
366
|
setActorDispatcher(path, dispatcher) {
|
|
377
367
|
if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
|
|
378
368
|
const variables = this.router.add(path, "actor");
|
|
379
369
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for actor dispatcher must have one variable: {identifier}");
|
|
380
|
-
if (variables.has("handle")) (0,
|
|
370
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
381
371
|
"fedify",
|
|
382
372
|
"federation",
|
|
383
373
|
"actor"
|
|
384
374
|
]).warn("The {{handle}} variable in the actor dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
385
|
-
const callbacks = { dispatcher: async (context
|
|
375
|
+
const callbacks = { dispatcher: async (context, identifier) => {
|
|
386
376
|
const actor = await this._getTracer().startActiveSpan("activitypub.dispatch_actor", {
|
|
387
|
-
kind:
|
|
377
|
+
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
388
378
|
attributes: { "fedify.actor.identifier": identifier }
|
|
389
379
|
}, async (span) => {
|
|
390
380
|
try {
|
|
391
|
-
const actor
|
|
392
|
-
span.setAttribute("activitypub.actor.id", (actor
|
|
393
|
-
if (actor
|
|
394
|
-
else span.setAttribute("activitypub.actor.type", require_actor.getTypeId(actor
|
|
395
|
-
return actor
|
|
381
|
+
const actor = await dispatcher(context, identifier);
|
|
382
|
+
span.setAttribute("activitypub.actor.id", (actor?.id ?? context.getActorUri(identifier)).href);
|
|
383
|
+
if (actor == null) span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
384
|
+
else span.setAttribute("activitypub.actor.type", require_actor.getTypeId(actor).href);
|
|
385
|
+
return actor;
|
|
396
386
|
} catch (error) {
|
|
397
387
|
span.setStatus({
|
|
398
|
-
code:
|
|
388
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
399
389
|
message: String(error)
|
|
400
390
|
});
|
|
401
391
|
throw error;
|
|
@@ -404,64 +394,64 @@ var FederationBuilderImpl = class {
|
|
|
404
394
|
}
|
|
405
395
|
});
|
|
406
396
|
if (actor == null) return null;
|
|
407
|
-
const logger
|
|
397
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
408
398
|
"fedify",
|
|
409
399
|
"federation",
|
|
410
400
|
"actor"
|
|
411
401
|
]);
|
|
412
|
-
if (actor.id == null) logger
|
|
413
|
-
else if (actor.id.href != context
|
|
402
|
+
if (actor.id == null) logger.warn("Actor dispatcher returned an actor without an id property. Set the property with Context.getActorUri(identifier).");
|
|
403
|
+
else if (actor.id.href != context.getActorUri(identifier).href) logger.warn("Actor dispatcher returned an actor with an id property that does not match the actor URI. Set the property with Context.getActorUri(identifier).");
|
|
414
404
|
if (this.followingCallbacks != null && this.followingCallbacks.dispatcher != null) {
|
|
415
|
-
if (actor.followingId == null) logger
|
|
416
|
-
else if (actor.followingId.href != context
|
|
405
|
+
if (actor.followingId == null) logger.warn("You configured a following collection dispatcher, but the actor does not have a following property. Set the property with Context.getFollowingUri(identifier).");
|
|
406
|
+
else if (actor.followingId.href != context.getFollowingUri(identifier).href) logger.warn("You configured a following collection dispatcher, but the actor's following property does not match the following collection URI. Set the property with Context.getFollowingUri(identifier).");
|
|
417
407
|
}
|
|
418
408
|
if (this.followersCallbacks != null && this.followersCallbacks.dispatcher != null) {
|
|
419
|
-
if (actor.followersId == null) logger
|
|
420
|
-
else if (actor.followersId.href != context
|
|
409
|
+
if (actor.followersId == null) logger.warn("You configured a followers collection dispatcher, but the actor does not have a followers property. Set the property with Context.getFollowersUri(identifier).");
|
|
410
|
+
else if (actor.followersId.href != context.getFollowersUri(identifier).href) logger.warn("You configured a followers collection dispatcher, but the actor's followers property does not match the followers collection URI. Set the property with Context.getFollowersUri(identifier).");
|
|
421
411
|
}
|
|
422
412
|
if (this.outboxCallbacks != null && this.outboxCallbacks.dispatcher != null) {
|
|
423
|
-
if (actor?.outboxId == null) logger
|
|
424
|
-
else if (actor.outboxId.href != context
|
|
413
|
+
if (actor?.outboxId == null) logger.warn("You configured an outbox collection dispatcher, but the actor does not have an outbox property. Set the property with Context.getOutboxUri(identifier).");
|
|
414
|
+
else if (actor.outboxId.href != context.getOutboxUri(identifier).href) logger.warn("You configured an outbox collection dispatcher, but the actor's outbox property does not match the outbox collection URI. Set the property with Context.getOutboxUri(identifier).");
|
|
425
415
|
}
|
|
426
416
|
if (this.likedCallbacks != null && this.likedCallbacks.dispatcher != null) {
|
|
427
|
-
if (actor?.likedId == null) logger
|
|
428
|
-
else if (actor.likedId.href != context
|
|
417
|
+
if (actor?.likedId == null) logger.warn("You configured a liked collection dispatcher, but the actor does not have a liked property. Set the property with Context.getLikedUri(identifier).");
|
|
418
|
+
else if (actor.likedId.href != context.getLikedUri(identifier).href) logger.warn("You configured a liked collection dispatcher, but the actor's liked property does not match the liked collection URI. Set the property with Context.getLikedUri(identifier).");
|
|
429
419
|
}
|
|
430
420
|
if (this.featuredCallbacks != null && this.featuredCallbacks.dispatcher != null) {
|
|
431
|
-
if (actor?.featuredId == null) logger
|
|
432
|
-
else if (actor.featuredId.href != context
|
|
421
|
+
if (actor?.featuredId == null) logger.warn("You configured a featured collection dispatcher, but the actor does not have a featured property. Set the property with Context.getFeaturedUri(identifier).");
|
|
422
|
+
else if (actor.featuredId.href != context.getFeaturedUri(identifier).href) logger.warn("You configured a featured collection dispatcher, but the actor's featured property does not match the featured collection URI. Set the property with Context.getFeaturedUri(identifier).");
|
|
433
423
|
}
|
|
434
424
|
if (this.featuredTagsCallbacks != null && this.featuredTagsCallbacks.dispatcher != null) {
|
|
435
|
-
if (actor?.featuredTagsId == null) logger
|
|
436
|
-
else if (actor.featuredTagsId.href != context
|
|
425
|
+
if (actor?.featuredTagsId == null) logger.warn("You configured a featured tags collection dispatcher, but the actor does not have a featuredTags property. Set the property with Context.getFeaturedTagsUri(identifier).");
|
|
426
|
+
else if (actor.featuredTagsId.href != context.getFeaturedTagsUri(identifier).href) logger.warn("You configured a featured tags collection dispatcher, but the actor's featuredTags property does not match the featured tags collection URI. Set the property with Context.getFeaturedTagsUri(identifier).");
|
|
437
427
|
}
|
|
438
428
|
if (this.router.has("inbox")) {
|
|
439
|
-
if (actor.inboxId == null) logger
|
|
440
|
-
else if (actor.inboxId.href != context
|
|
441
|
-
if (actor.endpoints == null || actor.endpoints.sharedInbox == null) logger
|
|
442
|
-
else if (actor.endpoints.sharedInbox.href != context
|
|
429
|
+
if (actor.inboxId == null) logger.warn("You configured inbox listeners, but the actor does not have an inbox property. Set the property with Context.getInboxUri(identifier).");
|
|
430
|
+
else if (actor.inboxId.href != context.getInboxUri(identifier).href) logger.warn("You configured inbox listeners, but the actor's inbox property does not match the inbox URI. Set the property with Context.getInboxUri(identifier).");
|
|
431
|
+
if (actor.endpoints == null || actor.endpoints.sharedInbox == null) logger.warn("You configured inbox listeners, but the actor does not have a endpoints.sharedInbox property. Set the property with Context.getInboxUri().");
|
|
432
|
+
else if (actor.endpoints.sharedInbox.href != context.getInboxUri().href) logger.warn("You configured inbox listeners, but the actor's endpoints.sharedInbox property does not match the shared inbox URI. Set the property with Context.getInboxUri().");
|
|
443
433
|
}
|
|
444
434
|
if (callbacks.keyPairsDispatcher != null) {
|
|
445
|
-
if (actor.publicKeyId == null) logger
|
|
446
|
-
if (actor.assertionMethodId == null) logger
|
|
435
|
+
if (actor.publicKeyId == null) logger.warn("You configured a key pairs dispatcher, but the actor does not have a publicKey property. Set the property with Context.getActorKeyPairs(identifier).");
|
|
436
|
+
if (actor.assertionMethodId == null) logger.warn("You configured a key pairs dispatcher, but the actor does not have an assertionMethod property. Set the property with Context.getActorKeyPairs(identifier).");
|
|
447
437
|
}
|
|
448
438
|
return actor;
|
|
449
439
|
} };
|
|
450
440
|
this.actorCallbacks = callbacks;
|
|
451
441
|
const setters = {
|
|
452
|
-
setKeyPairsDispatcher: (dispatcher
|
|
442
|
+
setKeyPairsDispatcher: (dispatcher) => {
|
|
453
443
|
callbacks.keyPairsDispatcher = (ctx, identifier) => this._getTracer().startActiveSpan("activitypub.dispatch_actor_key_pairs", {
|
|
454
|
-
kind:
|
|
444
|
+
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
455
445
|
attributes: {
|
|
456
446
|
"activitypub.actor.id": ctx.getActorUri(identifier).href,
|
|
457
447
|
"fedify.actor.identifier": identifier
|
|
458
448
|
}
|
|
459
449
|
}, async (span) => {
|
|
460
450
|
try {
|
|
461
|
-
return await dispatcher
|
|
451
|
+
return await dispatcher(ctx, identifier);
|
|
462
452
|
} catch (e) {
|
|
463
453
|
span.setStatus({
|
|
464
|
-
code:
|
|
454
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
465
455
|
message: String(e)
|
|
466
456
|
});
|
|
467
457
|
throw e;
|
|
@@ -488,8 +478,7 @@ var FederationBuilderImpl = class {
|
|
|
488
478
|
}
|
|
489
479
|
setNodeInfoDispatcher(path, dispatcher) {
|
|
490
480
|
if (this.router.has("nodeInfo")) throw new RouterError("NodeInfo dispatcher already set.");
|
|
491
|
-
|
|
492
|
-
if (variables.size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
|
|
481
|
+
if (this.router.add(path, "nodeInfo").size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
|
|
493
482
|
this.nodeInfoDispatcher = dispatcher;
|
|
494
483
|
}
|
|
495
484
|
setWebFingerLinksDispatcher(dispatcher) {
|
|
@@ -502,9 +491,8 @@ var FederationBuilderImpl = class {
|
|
|
502
491
|
if (variables.size < 1) throw new RouterError("Path for object dispatcher must have at least one variable.");
|
|
503
492
|
const callbacks = {
|
|
504
493
|
dispatcher: (ctx, values) => {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
kind: __opentelemetry_api.SpanKind.SERVER,
|
|
494
|
+
return this._getTracer().startActiveSpan("activitypub.dispatch_object", {
|
|
495
|
+
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
508
496
|
attributes: {
|
|
509
497
|
"fedify.object.type": cls.typeId.href,
|
|
510
498
|
...globalThis.Object.fromEntries(globalThis.Object.entries(values).map(([k, v]) => [`fedify.object.values.${k}`, v]))
|
|
@@ -513,12 +501,12 @@ var FederationBuilderImpl = class {
|
|
|
513
501
|
try {
|
|
514
502
|
const object = await dispatcher(ctx, values);
|
|
515
503
|
span.setAttribute("activitypub.object.id", (object?.id ?? ctx.getObjectUri(cls, values)).href);
|
|
516
|
-
if (object == null) span.setStatus({ code:
|
|
504
|
+
if (object == null) span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
517
505
|
else span.setAttribute("activitypub.object.type", require_actor.getTypeId(object).href);
|
|
518
506
|
return object;
|
|
519
507
|
} catch (e) {
|
|
520
508
|
span.setStatus({
|
|
521
|
-
code:
|
|
509
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
522
510
|
message: String(e)
|
|
523
511
|
});
|
|
524
512
|
throw e;
|
|
@@ -544,7 +532,7 @@ var FederationBuilderImpl = class {
|
|
|
544
532
|
} else {
|
|
545
533
|
const variables = this.router.add(path, "inbox");
|
|
546
534
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for inbox dispatcher must have one variable: {identifier}");
|
|
547
|
-
if (variables.has("handle")) (0,
|
|
535
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
548
536
|
"fedify",
|
|
549
537
|
"federation",
|
|
550
538
|
"inbox"
|
|
@@ -577,7 +565,7 @@ var FederationBuilderImpl = class {
|
|
|
577
565
|
if (this.router.has("outbox")) throw new RouterError("Outbox dispatcher already set.");
|
|
578
566
|
const variables = this.router.add(path, "outbox");
|
|
579
567
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for outbox dispatcher must have one variable: {identifier}");
|
|
580
|
-
if (variables.has("handle")) (0,
|
|
568
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
581
569
|
"fedify",
|
|
582
570
|
"federation",
|
|
583
571
|
"outbox"
|
|
@@ -608,7 +596,7 @@ var FederationBuilderImpl = class {
|
|
|
608
596
|
if (this.router.has("following")) throw new RouterError("Following collection dispatcher already set.");
|
|
609
597
|
const variables = this.router.add(path, "following");
|
|
610
598
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for following collection dispatcher must have one variable: {identifier}");
|
|
611
|
-
if (variables.has("handle")) (0,
|
|
599
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
612
600
|
"fedify",
|
|
613
601
|
"federation",
|
|
614
602
|
"collection"
|
|
@@ -639,7 +627,7 @@ var FederationBuilderImpl = class {
|
|
|
639
627
|
if (this.router.has("followers")) throw new RouterError("Followers collection dispatcher already set.");
|
|
640
628
|
const variables = this.router.add(path, "followers");
|
|
641
629
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for followers collection dispatcher must have one variable: {identifier}");
|
|
642
|
-
if (variables.has("handle")) (0,
|
|
630
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
643
631
|
"fedify",
|
|
644
632
|
"federation",
|
|
645
633
|
"collection"
|
|
@@ -670,7 +658,7 @@ var FederationBuilderImpl = class {
|
|
|
670
658
|
if (this.router.has("liked")) throw new RouterError("Liked collection dispatcher already set.");
|
|
671
659
|
const variables = this.router.add(path, "liked");
|
|
672
660
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for liked collection dispatcher must have one variable: {identifier}");
|
|
673
|
-
if (variables.has("handle")) (0,
|
|
661
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
674
662
|
"fedify",
|
|
675
663
|
"federation",
|
|
676
664
|
"collection"
|
|
@@ -701,7 +689,7 @@ var FederationBuilderImpl = class {
|
|
|
701
689
|
if (this.router.has("featured")) throw new RouterError("Featured collection dispatcher already set.");
|
|
702
690
|
const variables = this.router.add(path, "featured");
|
|
703
691
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for featured collection dispatcher must have one variable: {identifier}");
|
|
704
|
-
if (variables.has("handle")) (0,
|
|
692
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
705
693
|
"fedify",
|
|
706
694
|
"federation",
|
|
707
695
|
"collection"
|
|
@@ -732,7 +720,7 @@ var FederationBuilderImpl = class {
|
|
|
732
720
|
if (this.router.has("featuredTags")) throw new RouterError("Featured tags collection dispatcher already set.");
|
|
733
721
|
const variables = this.router.add(path, "featuredTags");
|
|
734
722
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for featured tags collection dispatcher must have one variable: {identifier}");
|
|
735
|
-
if (variables.has("handle")) (0,
|
|
723
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
736
724
|
"fedify",
|
|
737
725
|
"federation",
|
|
738
726
|
"collection"
|
|
@@ -767,15 +755,14 @@ var FederationBuilderImpl = class {
|
|
|
767
755
|
const variables = this.router.add(inboxPath, "inbox");
|
|
768
756
|
if (variables.size !== 1 || !(variables.has("identifier") || variables.has("handle"))) throw new RouterError("Path for inbox must have one variable: {identifier}");
|
|
769
757
|
this.inboxPath = inboxPath;
|
|
770
|
-
if (variables.has("handle")) (0,
|
|
758
|
+
if (variables.has("handle")) (0, _logtape_logtape.getLogger)([
|
|
771
759
|
"fedify",
|
|
772
760
|
"federation",
|
|
773
761
|
"inbox"
|
|
774
762
|
]).warn("The {{handle}} variable in the inbox path is deprecated. Use {{identifier}} instead.");
|
|
775
763
|
}
|
|
776
764
|
if (sharedInboxPath != null) {
|
|
777
|
-
|
|
778
|
-
if (siVars.size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
|
|
765
|
+
if (this.router.add(sharedInboxPath, "sharedInbox").size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
|
|
779
766
|
}
|
|
780
767
|
const listeners = this.inboxListeners = new InboxListenerSet();
|
|
781
768
|
const setters = {
|
|
@@ -809,8 +796,7 @@ var FederationBuilderImpl = class {
|
|
|
809
796
|
const routeName = `${collectionType}:${this.#uniqueCollectionId(name)}`;
|
|
810
797
|
if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
811
798
|
if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
812
|
-
|
|
813
|
-
if (variables.size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
|
|
799
|
+
if (this.router.add(path, routeName).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
|
|
814
800
|
const callbacks = { dispatcher };
|
|
815
801
|
this.collectionCallbacks[name] = callbacks;
|
|
816
802
|
this.collectionTypeIds[name] = itemType;
|
|
@@ -845,8 +831,7 @@ var FederationBuilderImpl = class {
|
|
|
845
831
|
getCollectionPath(name, values) {
|
|
846
832
|
if (!(name in this.collectionCallbacks)) return null;
|
|
847
833
|
const routeName = this.#uniqueCollectionId(name);
|
|
848
|
-
|
|
849
|
-
return path;
|
|
834
|
+
return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
|
|
850
835
|
}
|
|
851
836
|
/**
|
|
852
837
|
* Converts a name (string or symbol) to a unique string identifier.
|
|
@@ -869,7 +854,6 @@ var FederationBuilderImpl = class {
|
|
|
869
854
|
function createFederationBuilder() {
|
|
870
855
|
return new FederationBuilderImpl();
|
|
871
856
|
}
|
|
872
|
-
|
|
873
857
|
//#endregion
|
|
874
858
|
//#region src/federation/collection.ts
|
|
875
859
|
/**
|
|
@@ -888,8 +872,8 @@ async function digest(uris) {
|
|
|
888
872
|
if (processed.has(u)) continue;
|
|
889
873
|
processed.add(u);
|
|
890
874
|
const encoded = encoder.encode(u);
|
|
891
|
-
const digest
|
|
892
|
-
for (let i = 0; i < 32; i++) result[i] ^= digest
|
|
875
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", encoded));
|
|
876
|
+
for (let i = 0; i < 32; i++) result[i] ^= digest[i];
|
|
893
877
|
}
|
|
894
878
|
return result;
|
|
895
879
|
}
|
|
@@ -907,10 +891,8 @@ async function buildCollectionSynchronizationHeader(collectionId, actorIds) {
|
|
|
907
891
|
const baseUrl = new URL(anyActorId);
|
|
908
892
|
const url = new URL(collectionId);
|
|
909
893
|
url.searchParams.set("base-url", `${baseUrl.origin}/`);
|
|
910
|
-
|
|
911
|
-
return `collectionId="${collectionId}", url="${url}", digest="${hash}"`;
|
|
894
|
+
return `collectionId="${collectionId}", url="${url}", digest="${(0, byte_encodings_hex.encodeHex)(await digest(actorIds))}"`;
|
|
912
895
|
}
|
|
913
|
-
|
|
914
896
|
//#endregion
|
|
915
897
|
//#region src/federation/keycache.ts
|
|
916
898
|
const NULL_KEY_CACHE_VALUE = { _fedify: "key-unavailable" };
|
|
@@ -944,7 +926,7 @@ var KvKeyCache = class {
|
|
|
944
926
|
return await require_actor.Multikey.fromJsonLd(serialized, this.options);
|
|
945
927
|
} catch {
|
|
946
928
|
await this.kv.delete([...this.prefix, keyId.href]);
|
|
947
|
-
return
|
|
929
|
+
return;
|
|
948
930
|
}
|
|
949
931
|
}
|
|
950
932
|
}
|
|
@@ -959,7 +941,6 @@ var KvKeyCache = class {
|
|
|
959
941
|
await this.kv.set([...this.prefix, keyId.href], serialized);
|
|
960
942
|
}
|
|
961
943
|
};
|
|
962
|
-
|
|
963
944
|
//#endregion
|
|
964
945
|
//#region src/federation/negotiation.ts
|
|
965
946
|
function compareSpecs(a, b) {
|
|
@@ -1004,8 +985,8 @@ function parseMediaType(str, i) {
|
|
|
1004
985
|
function parseAccept(accept) {
|
|
1005
986
|
const accepts = accept.split(",").map((p) => p.trim());
|
|
1006
987
|
const mediaTypes = [];
|
|
1007
|
-
for (const [index, accept
|
|
1008
|
-
const mediaType = parseMediaType(accept
|
|
988
|
+
for (const [index, accept] of accepts.entries()) {
|
|
989
|
+
const mediaType = parseMediaType(accept.trim(), index);
|
|
1009
990
|
if (mediaType) mediaTypes.push(mediaType);
|
|
1010
991
|
}
|
|
1011
992
|
return mediaTypes;
|
|
@@ -1014,10 +995,8 @@ function getFullType(spec) {
|
|
|
1014
995
|
return `${spec.type}/${spec.subtype}`;
|
|
1015
996
|
}
|
|
1016
997
|
function preferredMediaTypes(accept) {
|
|
1017
|
-
|
|
1018
|
-
return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
998
|
+
return parseAccept(accept === void 0 ? "*/*" : accept ?? "").filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
1019
999
|
}
|
|
1020
|
-
|
|
1021
1000
|
//#endregion
|
|
1022
1001
|
//#region src/federation/handler.ts
|
|
1023
1002
|
function acceptsJsonLd(request) {
|
|
@@ -1034,24 +1013,24 @@ function acceptsJsonLd(request) {
|
|
|
1034
1013
|
* @param parameters The parameters for handling the actor.
|
|
1035
1014
|
* @returns A promise that resolves to an HTTP response.
|
|
1036
1015
|
*/
|
|
1037
|
-
async function handleActor(request, { identifier, context
|
|
1038
|
-
const logger
|
|
1016
|
+
async function handleActor(request, { identifier, context, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
|
|
1017
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
1039
1018
|
"fedify",
|
|
1040
1019
|
"federation",
|
|
1041
1020
|
"actor"
|
|
1042
1021
|
]);
|
|
1043
1022
|
if (actorDispatcher == null) {
|
|
1044
|
-
logger
|
|
1023
|
+
logger.debug("Actor dispatcher is not set.", { identifier });
|
|
1045
1024
|
return await onNotFound(request);
|
|
1046
1025
|
}
|
|
1047
|
-
const actor = await actorDispatcher(context
|
|
1026
|
+
const actor = await actorDispatcher(context, identifier);
|
|
1048
1027
|
if (actor == null) {
|
|
1049
|
-
logger
|
|
1028
|
+
logger.debug("Actor {identifier} not found.", { identifier });
|
|
1050
1029
|
return await onNotFound(request);
|
|
1051
1030
|
}
|
|
1052
1031
|
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
1053
1032
|
if (authorizePredicate != null) {
|
|
1054
|
-
let key = await context
|
|
1033
|
+
let key = await context.getSignedKey();
|
|
1055
1034
|
key = key?.clone({}, { $warning: {
|
|
1056
1035
|
category: [
|
|
1057
1036
|
"fedify",
|
|
@@ -1060,7 +1039,7 @@ async function handleActor(request, { identifier, context: context$2, actorDispa
|
|
|
1060
1039
|
],
|
|
1061
1040
|
message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
|
|
1062
1041
|
} }) ?? null;
|
|
1063
|
-
let keyOwner = await context
|
|
1042
|
+
let keyOwner = await context.getSignedKeyOwner();
|
|
1064
1043
|
keyOwner = keyOwner?.clone({}, { $warning: {
|
|
1065
1044
|
category: [
|
|
1066
1045
|
"fedify",
|
|
@@ -1069,9 +1048,9 @@ async function handleActor(request, { identifier, context: context$2, actorDispa
|
|
|
1069
1048
|
],
|
|
1070
1049
|
message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
|
|
1071
1050
|
} }) ?? null;
|
|
1072
|
-
if (!await authorizePredicate(context
|
|
1051
|
+
if (!await authorizePredicate(context, identifier, key, keyOwner)) return await onUnauthorized(request);
|
|
1073
1052
|
}
|
|
1074
|
-
const jsonLd = await actor.toJsonLd(context
|
|
1053
|
+
const jsonLd = await actor.toJsonLd(context);
|
|
1075
1054
|
return new Response(JSON.stringify(jsonLd), { headers: {
|
|
1076
1055
|
"Content-Type": "application/activity+json",
|
|
1077
1056
|
Vary: "Accept"
|
|
@@ -1084,13 +1063,13 @@ async function handleActor(request, { identifier, context: context$2, actorDispa
|
|
|
1084
1063
|
* @param parameters The parameters for handling the object.
|
|
1085
1064
|
* @returns A promise that resolves to an HTTP response.
|
|
1086
1065
|
*/
|
|
1087
|
-
async function handleObject(request, { values, context
|
|
1066
|
+
async function handleObject(request, { values, context, objectDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
|
|
1088
1067
|
if (objectDispatcher == null) return await onNotFound(request);
|
|
1089
|
-
const object = await objectDispatcher(context
|
|
1068
|
+
const object = await objectDispatcher(context, values);
|
|
1090
1069
|
if (object == null) return await onNotFound(request);
|
|
1091
1070
|
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
1092
1071
|
if (authorizePredicate != null) {
|
|
1093
|
-
let key = await context
|
|
1072
|
+
let key = await context.getSignedKey();
|
|
1094
1073
|
key = key?.clone({}, { $warning: {
|
|
1095
1074
|
category: [
|
|
1096
1075
|
"fedify",
|
|
@@ -1099,7 +1078,7 @@ async function handleObject(request, { values, context: context$2, objectDispatc
|
|
|
1099
1078
|
],
|
|
1100
1079
|
message: "The third parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
|
|
1101
1080
|
} }) ?? null;
|
|
1102
|
-
let keyOwner = await context
|
|
1081
|
+
let keyOwner = await context.getSignedKeyOwner();
|
|
1103
1082
|
keyOwner = keyOwner?.clone({}, { $warning: {
|
|
1104
1083
|
category: [
|
|
1105
1084
|
"fedify",
|
|
@@ -1108,9 +1087,9 @@ async function handleObject(request, { values, context: context$2, objectDispatc
|
|
|
1108
1087
|
],
|
|
1109
1088
|
message: "The fourth parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
|
|
1110
1089
|
} }) ?? null;
|
|
1111
|
-
if (!await authorizePredicate(context
|
|
1090
|
+
if (!await authorizePredicate(context, values, key, keyOwner)) return await onUnauthorized(request);
|
|
1112
1091
|
}
|
|
1113
|
-
const jsonLd = await object.toJsonLd(context
|
|
1092
|
+
const jsonLd = await object.toJsonLd(context);
|
|
1114
1093
|
return new Response(JSON.stringify(jsonLd), { headers: {
|
|
1115
1094
|
"Content-Type": "application/activity+json",
|
|
1116
1095
|
Vary: "Accept"
|
|
@@ -1126,21 +1105,20 @@ async function handleObject(request, { values, context: context$2, objectDispatc
|
|
|
1126
1105
|
* @param parameters The parameters for handling the collection.
|
|
1127
1106
|
* @returns A promise that resolves to an HTTP response.
|
|
1128
1107
|
*/
|
|
1129
|
-
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context
|
|
1130
|
-
const spanName = name.trim().replace(/\s+/g, "_");
|
|
1131
|
-
tracerProvider = tracerProvider ??
|
|
1132
|
-
const tracer = tracerProvider.getTracer(require_docloader.
|
|
1133
|
-
const
|
|
1134
|
-
const cursor = url.searchParams.get("cursor");
|
|
1108
|
+
async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
|
|
1109
|
+
const spanName = name$2.trim().replace(/\s+/g, "_");
|
|
1110
|
+
tracerProvider = tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
1111
|
+
const tracer = tracerProvider.getTracer(require_docloader.name, require_docloader.version);
|
|
1112
|
+
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1135
1113
|
if (collectionCallbacks == null) return await onNotFound(request);
|
|
1136
1114
|
let collection;
|
|
1137
1115
|
const baseUri = uriGetter(identifier);
|
|
1138
1116
|
if (cursor == null) {
|
|
1139
|
-
const firstCursor = await collectionCallbacks.firstCursor?.(context
|
|
1140
|
-
const totalItems = filter == null ? await collectionCallbacks.counter?.(context
|
|
1117
|
+
const firstCursor = await collectionCallbacks.firstCursor?.(context, identifier);
|
|
1118
|
+
const totalItems = filter == null ? await collectionCallbacks.counter?.(context, identifier) : void 0;
|
|
1141
1119
|
if (firstCursor == null) {
|
|
1142
1120
|
const itemsOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection ${spanName}`, {
|
|
1143
|
-
kind:
|
|
1121
|
+
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
1144
1122
|
attributes: {
|
|
1145
1123
|
"activitypub.collection.id": baseUri.href,
|
|
1146
1124
|
"activitypub.collection.type": require_actor.OrderedCollection.typeId.href
|
|
@@ -1148,9 +1126,9 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1148
1126
|
}, async (span) => {
|
|
1149
1127
|
if (totalItems != null) span.setAttribute("activitypub.collection.total_items", Number(totalItems));
|
|
1150
1128
|
try {
|
|
1151
|
-
const page = await collectionCallbacks.dispatcher(context
|
|
1129
|
+
const page = await collectionCallbacks.dispatcher(context, identifier, null, filter);
|
|
1152
1130
|
if (page == null) {
|
|
1153
|
-
span.setStatus({ code:
|
|
1131
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1154
1132
|
return await onNotFound(request);
|
|
1155
1133
|
}
|
|
1156
1134
|
const { items } = page;
|
|
@@ -1158,7 +1136,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1158
1136
|
return items;
|
|
1159
1137
|
} catch (e) {
|
|
1160
1138
|
span.setStatus({
|
|
1161
|
-
code:
|
|
1139
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1162
1140
|
message: String(e)
|
|
1163
1141
|
});
|
|
1164
1142
|
throw e;
|
|
@@ -1170,15 +1148,15 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1170
1148
|
collection = new require_actor.OrderedCollection({
|
|
1171
1149
|
id: baseUri,
|
|
1172
1150
|
totalItems: totalItems == null ? null : Number(totalItems),
|
|
1173
|
-
items: filterCollectionItems(itemsOrResponse, name, filterPredicate)
|
|
1151
|
+
items: filterCollectionItems(itemsOrResponse, name$2, filterPredicate)
|
|
1174
1152
|
});
|
|
1175
1153
|
} else {
|
|
1176
|
-
const lastCursor = await collectionCallbacks.lastCursor?.(context
|
|
1177
|
-
const first = new URL(context
|
|
1154
|
+
const lastCursor = await collectionCallbacks.lastCursor?.(context, identifier);
|
|
1155
|
+
const first = new URL(context.url);
|
|
1178
1156
|
first.searchParams.set("cursor", firstCursor);
|
|
1179
1157
|
let last = null;
|
|
1180
1158
|
if (lastCursor != null) {
|
|
1181
|
-
last = new URL(context
|
|
1159
|
+
last = new URL(context.url);
|
|
1182
1160
|
last.searchParams.set("cursor", lastCursor);
|
|
1183
1161
|
}
|
|
1184
1162
|
collection = new require_actor.OrderedCollection({
|
|
@@ -1191,8 +1169,8 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1191
1169
|
} else {
|
|
1192
1170
|
const uri = new URL(baseUri);
|
|
1193
1171
|
uri.searchParams.set("cursor", cursor);
|
|
1194
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name}`, {
|
|
1195
|
-
kind:
|
|
1172
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
|
|
1173
|
+
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
1196
1174
|
attributes: {
|
|
1197
1175
|
"activitypub.collection.id": uri.href,
|
|
1198
1176
|
"activitypub.collection.type": require_actor.OrderedCollectionPage.typeId.href,
|
|
@@ -1200,16 +1178,16 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1200
1178
|
}
|
|
1201
1179
|
}, async (span) => {
|
|
1202
1180
|
try {
|
|
1203
|
-
const page = await collectionCallbacks.dispatcher(context
|
|
1181
|
+
const page = await collectionCallbacks.dispatcher(context, identifier, cursor, filter);
|
|
1204
1182
|
if (page == null) {
|
|
1205
|
-
span.setStatus({ code:
|
|
1183
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1206
1184
|
return await onNotFound(request);
|
|
1207
1185
|
}
|
|
1208
1186
|
span.setAttribute("fedify.collection.items", page.items.length);
|
|
1209
1187
|
return page;
|
|
1210
1188
|
} catch (e) {
|
|
1211
1189
|
span.setStatus({
|
|
1212
|
-
code:
|
|
1190
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1213
1191
|
message: String(e)
|
|
1214
1192
|
});
|
|
1215
1193
|
throw e;
|
|
@@ -1221,27 +1199,27 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1221
1199
|
const { items, prevCursor, nextCursor } = pageOrResponse;
|
|
1222
1200
|
let prev = null;
|
|
1223
1201
|
if (prevCursor != null) {
|
|
1224
|
-
prev = new URL(context
|
|
1202
|
+
prev = new URL(context.url);
|
|
1225
1203
|
prev.searchParams.set("cursor", prevCursor);
|
|
1226
1204
|
}
|
|
1227
1205
|
let next = null;
|
|
1228
1206
|
if (nextCursor != null) {
|
|
1229
|
-
next = new URL(context
|
|
1207
|
+
next = new URL(context.url);
|
|
1230
1208
|
next.searchParams.set("cursor", nextCursor);
|
|
1231
1209
|
}
|
|
1232
|
-
const partOf = new URL(context
|
|
1210
|
+
const partOf = new URL(context.url);
|
|
1233
1211
|
partOf.searchParams.delete("cursor");
|
|
1234
1212
|
collection = new require_actor.OrderedCollectionPage({
|
|
1235
1213
|
id: uri,
|
|
1236
1214
|
prev,
|
|
1237
1215
|
next,
|
|
1238
|
-
items: filterCollectionItems(items, name, filterPredicate),
|
|
1216
|
+
items: filterCollectionItems(items, name$2, filterPredicate),
|
|
1239
1217
|
partOf
|
|
1240
1218
|
});
|
|
1241
1219
|
}
|
|
1242
1220
|
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
1243
1221
|
if (collectionCallbacks.authorizePredicate != null) {
|
|
1244
|
-
let key = await context
|
|
1222
|
+
let key = await context.getSignedKey();
|
|
1245
1223
|
key = key?.clone({}, { $warning: {
|
|
1246
1224
|
category: [
|
|
1247
1225
|
"fedify",
|
|
@@ -1250,7 +1228,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1250
1228
|
],
|
|
1251
1229
|
message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
|
|
1252
1230
|
} }) ?? null;
|
|
1253
|
-
let keyOwner = await context
|
|
1231
|
+
let keyOwner = await context.getSignedKeyOwner();
|
|
1254
1232
|
keyOwner = keyOwner?.clone({}, { $warning: {
|
|
1255
1233
|
category: [
|
|
1256
1234
|
"fedify",
|
|
@@ -1259,9 +1237,9 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1259
1237
|
],
|
|
1260
1238
|
message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
|
|
1261
1239
|
} }) ?? null;
|
|
1262
|
-
if (!await collectionCallbacks.authorizePredicate(context
|
|
1240
|
+
if (!await collectionCallbacks.authorizePredicate(context, identifier, key, keyOwner)) return await onUnauthorized(request);
|
|
1263
1241
|
}
|
|
1264
|
-
const jsonLd = await collection.toJsonLd(context
|
|
1242
|
+
const jsonLd = await collection.toJsonLd(context);
|
|
1265
1243
|
return new Response(JSON.stringify(jsonLd), { headers: {
|
|
1266
1244
|
"Content-Type": "application/activity+json",
|
|
1267
1245
|
Vary: "Accept"
|
|
@@ -1285,7 +1263,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
1285
1263
|
else mappedItem = item.id;
|
|
1286
1264
|
if (filterPredicate != null && !filterPredicate(item)) {
|
|
1287
1265
|
if (!logged) {
|
|
1288
|
-
(0,
|
|
1266
|
+
(0, _logtape_logtape.getLogger)([
|
|
1289
1267
|
"fedify",
|
|
1290
1268
|
"federation",
|
|
1291
1269
|
"collection"
|
|
@@ -1306,10 +1284,8 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
1306
1284
|
* @returns A promise that resolves to an HTTP response.
|
|
1307
1285
|
*/
|
|
1308
1286
|
async function handleInbox(request, options) {
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
return await tracer.startActiveSpan("activitypub.inbox", {
|
|
1312
|
-
kind: options.queue == null ? __opentelemetry_api.SpanKind.SERVER : __opentelemetry_api.SpanKind.PRODUCER,
|
|
1287
|
+
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.inbox", {
|
|
1288
|
+
kind: options.queue == null ? _opentelemetry_api.SpanKind.SERVER : _opentelemetry_api.SpanKind.PRODUCER,
|
|
1313
1289
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
|
1314
1290
|
}, async (span) => {
|
|
1315
1291
|
if (options.recipient != null) span.setAttribute("fedify.inbox.recipient", options.recipient);
|
|
@@ -1317,7 +1293,7 @@ async function handleInbox(request, options) {
|
|
|
1317
1293
|
return await handleInboxInternal(request, options, span);
|
|
1318
1294
|
} catch (e) {
|
|
1319
1295
|
span.setStatus({
|
|
1320
|
-
code:
|
|
1296
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1321
1297
|
message: String(e)
|
|
1322
1298
|
});
|
|
1323
1299
|
throw e;
|
|
@@ -1336,33 +1312,32 @@ async function handleInbox(request, options) {
|
|
|
1336
1312
|
*/
|
|
1337
1313
|
async function handleInboxInternal(request, parameters, span) {
|
|
1338
1314
|
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider } = parameters;
|
|
1339
|
-
const logger
|
|
1315
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
1340
1316
|
"fedify",
|
|
1341
1317
|
"federation",
|
|
1342
1318
|
"inbox"
|
|
1343
1319
|
]);
|
|
1344
1320
|
if (actorDispatcher == null) {
|
|
1345
|
-
logger
|
|
1321
|
+
logger.error("Actor dispatcher is not set.", { recipient });
|
|
1346
1322
|
span.setStatus({
|
|
1347
|
-
code:
|
|
1323
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1348
1324
|
message: "Actor dispatcher is not set."
|
|
1349
1325
|
});
|
|
1350
1326
|
return await onNotFound(request);
|
|
1351
1327
|
} else if (recipient != null) {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
logger$1.error("Actor {recipient} not found.", { recipient });
|
|
1328
|
+
if (await actorDispatcher(ctx, recipient) == null) {
|
|
1329
|
+
logger.error("Actor {recipient} not found.", { recipient });
|
|
1355
1330
|
span.setStatus({
|
|
1356
|
-
code:
|
|
1331
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1357
1332
|
message: `Actor ${recipient} not found.`
|
|
1358
1333
|
});
|
|
1359
1334
|
return await onNotFound(request);
|
|
1360
1335
|
}
|
|
1361
1336
|
}
|
|
1362
1337
|
if (request.bodyUsed) {
|
|
1363
|
-
logger
|
|
1338
|
+
logger.error("Request body has already been read.", { recipient });
|
|
1364
1339
|
span.setStatus({
|
|
1365
|
-
code:
|
|
1340
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1366
1341
|
message: "Request body has already been read."
|
|
1367
1342
|
});
|
|
1368
1343
|
return new Response("Internal server error.", {
|
|
@@ -1370,9 +1345,9 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1370
1345
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1371
1346
|
});
|
|
1372
1347
|
} else if (request.body?.locked) {
|
|
1373
|
-
logger
|
|
1348
|
+
logger.error("Request body is locked.", { recipient });
|
|
1374
1349
|
span.setStatus({
|
|
1375
|
-
code:
|
|
1350
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1376
1351
|
message: "Request body is locked."
|
|
1377
1352
|
});
|
|
1378
1353
|
return new Response("Internal server error.", {
|
|
@@ -1384,21 +1359,21 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1384
1359
|
try {
|
|
1385
1360
|
json = await request.clone().json();
|
|
1386
1361
|
} catch (error) {
|
|
1387
|
-
logger
|
|
1362
|
+
logger.error("Failed to parse JSON:\n{error}", {
|
|
1388
1363
|
recipient,
|
|
1389
1364
|
error
|
|
1390
1365
|
});
|
|
1391
1366
|
try {
|
|
1392
1367
|
await inboxErrorHandler?.(ctx, error);
|
|
1393
|
-
} catch (error
|
|
1394
|
-
logger
|
|
1395
|
-
error
|
|
1368
|
+
} catch (error) {
|
|
1369
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
1370
|
+
error,
|
|
1396
1371
|
activity: json,
|
|
1397
1372
|
recipient
|
|
1398
1373
|
});
|
|
1399
1374
|
}
|
|
1400
1375
|
span.setStatus({
|
|
1401
|
-
code:
|
|
1376
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1402
1377
|
message: `Failed to parse JSON:\n${error}`
|
|
1403
1378
|
});
|
|
1404
1379
|
return new Response("Invalid JSON.", {
|
|
@@ -1417,7 +1392,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1417
1392
|
});
|
|
1418
1393
|
} catch (error) {
|
|
1419
1394
|
if (error instanceof Error && error.name === "jsonld.SyntaxError") {
|
|
1420
|
-
logger
|
|
1395
|
+
logger.error("Failed to parse JSON-LD:\n{error}", {
|
|
1421
1396
|
recipient,
|
|
1422
1397
|
error
|
|
1423
1398
|
});
|
|
@@ -1431,13 +1406,13 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1431
1406
|
const jsonWithoutSig = require_proof.detachSignature(json);
|
|
1432
1407
|
let activity = null;
|
|
1433
1408
|
if (ldSigVerified) {
|
|
1434
|
-
logger
|
|
1409
|
+
logger.debug("Linked Data Signatures are verified.", {
|
|
1435
1410
|
recipient,
|
|
1436
1411
|
json
|
|
1437
1412
|
});
|
|
1438
1413
|
activity = await require_actor.Activity.fromJsonLd(jsonWithoutSig, ctx);
|
|
1439
1414
|
} else {
|
|
1440
|
-
logger
|
|
1415
|
+
logger.debug("Linked Data Signatures are not verified.", {
|
|
1441
1416
|
recipient,
|
|
1442
1417
|
json
|
|
1443
1418
|
});
|
|
@@ -1449,22 +1424,22 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1449
1424
|
tracerProvider
|
|
1450
1425
|
});
|
|
1451
1426
|
} catch (error) {
|
|
1452
|
-
logger
|
|
1427
|
+
logger.error("Failed to parse activity:\n{error}", {
|
|
1453
1428
|
recipient,
|
|
1454
1429
|
activity: json,
|
|
1455
1430
|
error
|
|
1456
1431
|
});
|
|
1457
1432
|
try {
|
|
1458
1433
|
await inboxErrorHandler?.(ctx, error);
|
|
1459
|
-
} catch (error
|
|
1460
|
-
logger
|
|
1461
|
-
error
|
|
1434
|
+
} catch (error) {
|
|
1435
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
1436
|
+
error,
|
|
1462
1437
|
activity: json,
|
|
1463
1438
|
recipient
|
|
1464
1439
|
});
|
|
1465
1440
|
}
|
|
1466
1441
|
span.setStatus({
|
|
1467
|
-
code:
|
|
1442
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1468
1443
|
message: `Failed to parse activity:\n${error}`
|
|
1469
1444
|
});
|
|
1470
1445
|
return new Response("Invalid activity.", {
|
|
@@ -1472,11 +1447,11 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1472
1447
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1473
1448
|
});
|
|
1474
1449
|
}
|
|
1475
|
-
if (activity == null) logger
|
|
1450
|
+
if (activity == null) logger.debug("Object Integrity Proofs are not verified.", {
|
|
1476
1451
|
recipient,
|
|
1477
1452
|
activity: json
|
|
1478
1453
|
});
|
|
1479
|
-
else logger
|
|
1454
|
+
else logger.debug("Object Integrity Proofs are verified.", {
|
|
1480
1455
|
recipient,
|
|
1481
1456
|
activity: json
|
|
1482
1457
|
});
|
|
@@ -1492,17 +1467,16 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1492
1467
|
tracerProvider
|
|
1493
1468
|
});
|
|
1494
1469
|
if (key == null) {
|
|
1495
|
-
logger
|
|
1470
|
+
logger.error("Failed to verify the request's HTTP Signatures.", { recipient });
|
|
1496
1471
|
span.setStatus({
|
|
1497
|
-
code:
|
|
1472
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1498
1473
|
message: `Failed to verify the request's HTTP Signatures.`
|
|
1499
1474
|
});
|
|
1500
|
-
|
|
1475
|
+
return new Response("Failed to verify the request signature.", {
|
|
1501
1476
|
status: 401,
|
|
1502
1477
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1503
1478
|
});
|
|
1504
|
-
|
|
1505
|
-
} else logger$1.debug("HTTP Signatures are verified.", { recipient });
|
|
1479
|
+
} else logger.debug("HTTP Signatures are verified.", { recipient });
|
|
1506
1480
|
httpSigKey = key;
|
|
1507
1481
|
}
|
|
1508
1482
|
activity = await require_actor.Activity.fromJsonLd(jsonWithoutSig, ctx);
|
|
@@ -1517,14 +1491,14 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1517
1491
|
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
1518
1492
|
});
|
|
1519
1493
|
if (httpSigKey != null && !await require_proof.doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
1520
|
-
logger
|
|
1494
|
+
logger.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
1521
1495
|
activity: json,
|
|
1522
1496
|
recipient,
|
|
1523
1497
|
keyId: httpSigKey.id?.href,
|
|
1524
1498
|
actorId: activity.actorId?.href
|
|
1525
1499
|
});
|
|
1526
1500
|
span.setStatus({
|
|
1527
|
-
code:
|
|
1501
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1528
1502
|
message: `The signer (${httpSigKey.id?.href}) and the actor (${activity.actorId?.href}) do not match.`
|
|
1529
1503
|
});
|
|
1530
1504
|
return new Response("The signer and the actor do not match.", {
|
|
@@ -1584,12 +1558,12 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1584
1558
|
* @since 1.8.0
|
|
1585
1559
|
*/
|
|
1586
1560
|
const handleCustomCollection = exceptWrapper(_handleCustomCollection);
|
|
1587
|
-
async function _handleCustomCollection(request, { name, values, context
|
|
1561
|
+
async function _handleCustomCollection(request, { name, values, context, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
1588
1562
|
verifyDefined(callbacks);
|
|
1589
1563
|
verifyJsonLdRequest(request);
|
|
1590
|
-
await authIfNeeded(context
|
|
1564
|
+
await authIfNeeded(context, values, callbacks);
|
|
1591
1565
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1592
|
-
return await new CustomCollectionHandler(name, values, context
|
|
1566
|
+
return await new CustomCollectionHandler(name, values, context, callbacks, tracerProvider, require_actor.Collection, require_actor.CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
1593
1567
|
}
|
|
1594
1568
|
/**
|
|
1595
1569
|
* Handles an ordered collection request.
|
|
@@ -1603,12 +1577,12 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
|
1603
1577
|
* @since 1.8.0
|
|
1604
1578
|
*/
|
|
1605
1579
|
const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
|
|
1606
|
-
async function _handleOrderedCollection(request, { name, values, context
|
|
1580
|
+
async function _handleOrderedCollection(request, { name, values, context, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
1607
1581
|
verifyDefined(callbacks);
|
|
1608
1582
|
verifyJsonLdRequest(request);
|
|
1609
|
-
await authIfNeeded(context
|
|
1583
|
+
await authIfNeeded(context, values, callbacks);
|
|
1610
1584
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1611
|
-
return await new CustomCollectionHandler(name, values, context
|
|
1585
|
+
return await new CustomCollectionHandler(name, values, context, callbacks, tracerProvider, require_actor.OrderedCollection, require_actor.OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
1612
1586
|
}
|
|
1613
1587
|
/**
|
|
1614
1588
|
* Handling custom collections with support for pagination and filtering.
|
|
@@ -1658,17 +1632,17 @@ var CustomCollectionHandler = class {
|
|
|
1658
1632
|
* @param CollectionPage The CollectionPage constructor.
|
|
1659
1633
|
* @param filterPredicate Optional filter predicate for items.
|
|
1660
1634
|
*/
|
|
1661
|
-
constructor(name, values, context
|
|
1662
|
-
this.name = name;
|
|
1635
|
+
constructor(name$1, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), Collection, CollectionPage, filterPredicate) {
|
|
1636
|
+
this.name = name$1;
|
|
1663
1637
|
this.values = values;
|
|
1664
|
-
this.context = context
|
|
1638
|
+
this.context = context;
|
|
1665
1639
|
this.callbacks = callbacks;
|
|
1666
1640
|
this.tracerProvider = tracerProvider;
|
|
1667
|
-
this.Collection = Collection
|
|
1668
|
-
this.CollectionPage = CollectionPage
|
|
1641
|
+
this.Collection = Collection;
|
|
1642
|
+
this.CollectionPage = CollectionPage;
|
|
1669
1643
|
this.filterPredicate = filterPredicate;
|
|
1670
1644
|
this.name = this.name.trim().replace(/\s+/g, "_");
|
|
1671
|
-
this.#tracer = this.tracerProvider.getTracer(require_docloader.
|
|
1645
|
+
this.#tracer = this.tracerProvider.getTracer(require_docloader.name, require_docloader.version);
|
|
1672
1646
|
this.#id = new URL(this.context.url);
|
|
1673
1647
|
this.#dispatcher = callbacks.dispatcher.bind(callbacks);
|
|
1674
1648
|
}
|
|
@@ -1697,8 +1671,8 @@ var CustomCollectionHandler = class {
|
|
|
1697
1671
|
*/
|
|
1698
1672
|
async getCollection(cursor = null) {
|
|
1699
1673
|
if (cursor !== null) {
|
|
1700
|
-
const props
|
|
1701
|
-
return new this.CollectionPage(props
|
|
1674
|
+
const props = await this.getPageProps(cursor);
|
|
1675
|
+
return new this.CollectionPage(props);
|
|
1702
1676
|
}
|
|
1703
1677
|
const firstCursor = await this.firstCursor;
|
|
1704
1678
|
const props = typeof firstCursor === "string" ? await this.getProps(firstCursor) : await this.getPropsWithoutCursor();
|
|
@@ -1759,7 +1733,7 @@ var CustomCollectionHandler = class {
|
|
|
1759
1733
|
* @returns A promise that resolves to the page items.
|
|
1760
1734
|
*/
|
|
1761
1735
|
async getPages({ cursor = null, totalItems = null }) {
|
|
1762
|
-
return await this.#tracer.startActiveSpan(`${this.ATTRS.DISPATCH_COLLECTION} ${this.name}`, this.spanOptions(
|
|
1736
|
+
return await this.#tracer.startActiveSpan(`${this.ATTRS.DISPATCH_COLLECTION} ${this.name}`, this.spanOptions(_opentelemetry_api.SpanKind.SERVER, cursor), this.spanPages({
|
|
1763
1737
|
cursor,
|
|
1764
1738
|
totalItems
|
|
1765
1739
|
}));
|
|
@@ -1792,7 +1766,7 @@ var CustomCollectionHandler = class {
|
|
|
1792
1766
|
} catch (e) {
|
|
1793
1767
|
const message = e instanceof Error ? e.message : String(e);
|
|
1794
1768
|
span.setStatus({
|
|
1795
|
-
code:
|
|
1769
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1796
1770
|
message
|
|
1797
1771
|
});
|
|
1798
1772
|
throw e;
|
|
@@ -1846,7 +1820,7 @@ var CustomCollectionHandler = class {
|
|
|
1846
1820
|
* @param value The total items count or a promise that resolves to it.
|
|
1847
1821
|
*/
|
|
1848
1822
|
set totalItems(value) {
|
|
1849
|
-
const toNumber = (value
|
|
1823
|
+
const toNumber = (value) => value == null ? null : Number(value);
|
|
1850
1824
|
this.#totalItems = value instanceof Promise ? value.then(toNumber) : Promise.resolve(toNumber(value));
|
|
1851
1825
|
}
|
|
1852
1826
|
/**
|
|
@@ -1920,11 +1894,9 @@ const verifyJsonLdRequest = (request) => {
|
|
|
1920
1894
|
* @throws {UnauthorizedError} If authorization fails.
|
|
1921
1895
|
* @since 1.8.0
|
|
1922
1896
|
*/
|
|
1923
|
-
const authIfNeeded = async (context
|
|
1897
|
+
const authIfNeeded = async (context, values, { authorizePredicate: authorize = void 0 }) => {
|
|
1924
1898
|
if (authorize === void 0) return;
|
|
1925
|
-
|
|
1926
|
-
const keyOwner = (await context$2.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
|
|
1927
|
-
if (!await authorize(context$2, values, key, keyOwner)) throw new UnauthorizedError();
|
|
1899
|
+
if (!await authorize(context, values, (await context.getSignedKey())?.clone({}, warning.key) ?? null, (await context.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null)) throw new UnauthorizedError();
|
|
1928
1900
|
};
|
|
1929
1901
|
/** Warning messages for `authIfNeeded`. */
|
|
1930
1902
|
const warning = {
|
|
@@ -2038,7 +2010,6 @@ async function respondWithObjectIfAcceptable(object, request, options) {
|
|
|
2038
2010
|
response.headers.set("Vary", "Accept");
|
|
2039
2011
|
return response;
|
|
2040
2012
|
}
|
|
2041
|
-
|
|
2042
2013
|
//#endregion
|
|
2043
2014
|
//#region src/nodeinfo/handler.ts
|
|
2044
2015
|
/**
|
|
@@ -2048,10 +2019,9 @@ async function respondWithObjectIfAcceptable(object, request, options) {
|
|
|
2048
2019
|
* @param parameters The parameters for handling the request.
|
|
2049
2020
|
* @returns The response to the request.
|
|
2050
2021
|
*/
|
|
2051
|
-
async function handleNodeInfo(_request, { context
|
|
2052
|
-
const promise = nodeInfoDispatcher(context
|
|
2053
|
-
const
|
|
2054
|
-
const json = require_types.nodeInfoToJson(nodeInfo);
|
|
2022
|
+
async function handleNodeInfo(_request, { context, nodeInfoDispatcher }) {
|
|
2023
|
+
const promise = nodeInfoDispatcher(context);
|
|
2024
|
+
const json = require_types.nodeInfoToJson(promise instanceof Promise ? await promise : promise);
|
|
2055
2025
|
return new Response(JSON.stringify(json), { headers: { "Content-Type": "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\"" } });
|
|
2056
2026
|
}
|
|
2057
2027
|
/**
|
|
@@ -2061,25 +2031,23 @@ async function handleNodeInfo(_request, { context: context$2, nodeInfoDispatcher
|
|
|
2061
2031
|
* @param context The request context.
|
|
2062
2032
|
* @returns The response to the request.
|
|
2063
2033
|
*/
|
|
2064
|
-
function handleNodeInfoJrd(_request, context
|
|
2034
|
+
function handleNodeInfoJrd(_request, context) {
|
|
2065
2035
|
const links = [];
|
|
2066
2036
|
try {
|
|
2067
2037
|
links.push({
|
|
2068
2038
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
|
2069
|
-
href: context
|
|
2039
|
+
href: context.getNodeInfoUri().href,
|
|
2070
2040
|
type: "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\""
|
|
2071
2041
|
});
|
|
2072
2042
|
} catch (e) {
|
|
2073
2043
|
if (!(e instanceof RouterError)) throw e;
|
|
2074
2044
|
}
|
|
2075
|
-
const
|
|
2076
|
-
const response = new Response(JSON.stringify(jrd), { headers: { "Content-Type": "application/jrd+json" } });
|
|
2045
|
+
const response = new Response(JSON.stringify({ links }), { headers: { "Content-Type": "application/jrd+json" } });
|
|
2077
2046
|
return Promise.resolve(response);
|
|
2078
2047
|
}
|
|
2079
|
-
|
|
2080
2048
|
//#endregion
|
|
2081
2049
|
//#region src/webfinger/handler.ts
|
|
2082
|
-
const logger = (0,
|
|
2050
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
2083
2051
|
"fedify",
|
|
2084
2052
|
"webfinger",
|
|
2085
2053
|
"server"
|
|
@@ -2093,14 +2061,14 @@ const logger = (0, __logtape_logtape.getLogger)([
|
|
|
2093
2061
|
*/
|
|
2094
2062
|
async function handleWebFinger(request, options) {
|
|
2095
2063
|
if (options.tracer == null) return await handleWebFingerInternal(request, options);
|
|
2096
|
-
return await options.tracer.startActiveSpan("webfinger.handle", { kind:
|
|
2064
|
+
return await options.tracer.startActiveSpan("webfinger.handle", { kind: _opentelemetry_api.SpanKind.SERVER }, async (span) => {
|
|
2097
2065
|
try {
|
|
2098
2066
|
const response = await handleWebFingerInternal(request, options);
|
|
2099
|
-
span.setStatus({ code: response.ok ?
|
|
2067
|
+
span.setStatus({ code: response.ok ? _opentelemetry_api.SpanStatusCode.UNSET : _opentelemetry_api.SpanStatusCode.ERROR });
|
|
2100
2068
|
return response;
|
|
2101
2069
|
} catch (error) {
|
|
2102
2070
|
span.setStatus({
|
|
2103
|
-
code:
|
|
2071
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2104
2072
|
message: String(error)
|
|
2105
2073
|
});
|
|
2106
2074
|
throw error;
|
|
@@ -2109,12 +2077,12 @@ async function handleWebFinger(request, options) {
|
|
|
2109
2077
|
}
|
|
2110
2078
|
});
|
|
2111
2079
|
}
|
|
2112
|
-
async function handleWebFingerInternal(request, { context
|
|
2080
|
+
async function handleWebFingerInternal(request, { context, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
|
|
2113
2081
|
if (actorDispatcher == null) {
|
|
2114
2082
|
logger.error("Actor dispatcher is not set.");
|
|
2115
2083
|
return await onNotFound(request);
|
|
2116
2084
|
}
|
|
2117
|
-
const resource = context
|
|
2085
|
+
const resource = context.url.searchParams.get("resource");
|
|
2118
2086
|
if (resource == null) return new Response("Missing resource parameter.", { status: 400 });
|
|
2119
2087
|
span?.setAttribute("webfinger.resource", resource);
|
|
2120
2088
|
let resourceUrl;
|
|
@@ -2130,26 +2098,26 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
|
|
|
2130
2098
|
logger.error("No actor handle mapper is set; use the WebFinger username {username} as the actor's internal identifier.", { username });
|
|
2131
2099
|
return username;
|
|
2132
2100
|
}
|
|
2133
|
-
const identifier
|
|
2134
|
-
if (identifier
|
|
2101
|
+
const identifier = await actorHandleMapper(context, username);
|
|
2102
|
+
if (identifier == null) {
|
|
2135
2103
|
logger.error("Actor {username} not found.", { username });
|
|
2136
2104
|
return null;
|
|
2137
2105
|
}
|
|
2138
|
-
return identifier
|
|
2106
|
+
return identifier;
|
|
2139
2107
|
}
|
|
2140
2108
|
let identifier = null;
|
|
2141
|
-
const uriParsed = context
|
|
2109
|
+
const uriParsed = context.parseUri(resourceUrl);
|
|
2142
2110
|
if (uriParsed?.type != "actor") {
|
|
2143
2111
|
const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
|
|
2144
2112
|
if (match == null) {
|
|
2145
|
-
const result = await actorAliasMapper?.(context
|
|
2113
|
+
const result = await actorAliasMapper?.(context, resourceUrl);
|
|
2146
2114
|
if (result == null) return await onNotFound(request);
|
|
2147
2115
|
if ("identifier" in result) identifier = result.identifier;
|
|
2148
2116
|
else identifier = await mapUsernameToIdentifier(result.username);
|
|
2149
2117
|
} else {
|
|
2150
2118
|
const portMatch = /:\d+$/.exec(match[2]);
|
|
2151
2119
|
const normalizedHost = portMatch == null ? (0, node_url.domainToASCII)(match[2].toLowerCase()) : (0, node_url.domainToASCII)(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
|
|
2152
|
-
if (normalizedHost != context
|
|
2120
|
+
if (normalizedHost != context.url.host && normalizedHost != host) return await onNotFound(request);
|
|
2153
2121
|
else {
|
|
2154
2122
|
identifier = await mapUsernameToIdentifier(match[1]);
|
|
2155
2123
|
resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
|
|
@@ -2157,14 +2125,14 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
|
|
|
2157
2125
|
}
|
|
2158
2126
|
} else identifier = uriParsed.identifier;
|
|
2159
2127
|
if (identifier == null) return await onNotFound(request);
|
|
2160
|
-
const actor = await actorDispatcher(context
|
|
2128
|
+
const actor = await actorDispatcher(context, identifier);
|
|
2161
2129
|
if (actor == null) {
|
|
2162
2130
|
logger.error("Actor {identifier} not found.", { identifier });
|
|
2163
2131
|
return await onNotFound(request);
|
|
2164
2132
|
}
|
|
2165
2133
|
const links = [{
|
|
2166
2134
|
rel: "self",
|
|
2167
|
-
href: context
|
|
2135
|
+
href: context.getActorUri(identifier).href,
|
|
2168
2136
|
type: "application/activity+json"
|
|
2169
2137
|
}];
|
|
2170
2138
|
for (const url of actor.urls) if (url instanceof require_actor.Link && url.href != null) links.push({
|
|
@@ -2186,16 +2154,16 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
|
|
|
2186
2154
|
links.push(link);
|
|
2187
2155
|
}
|
|
2188
2156
|
if (webFingerLinksDispatcher != null) {
|
|
2189
|
-
const customLinks = await webFingerLinksDispatcher(context
|
|
2157
|
+
const customLinks = await webFingerLinksDispatcher(context, resourceUrl);
|
|
2190
2158
|
if (customLinks != null) for (const link of customLinks) links.push(link);
|
|
2191
2159
|
}
|
|
2192
2160
|
const aliases = [];
|
|
2193
2161
|
if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
|
|
2194
|
-
aliases.push(`acct:${actor.preferredUsername}@${host ?? context
|
|
2195
|
-
if (host != null && host !== context
|
|
2162
|
+
aliases.push(`acct:${actor.preferredUsername}@${host ?? context.url.host}`);
|
|
2163
|
+
if (host != null && host !== context.url.host) aliases.push(`acct:${actor.preferredUsername}@${context.url.host}`);
|
|
2196
2164
|
}
|
|
2197
|
-
if (resourceUrl.href !== context
|
|
2198
|
-
if (resourceUrl.protocol === "acct:" && host != null && host !== context
|
|
2165
|
+
if (resourceUrl.href !== context.getActorUri(identifier).href) aliases.push(context.getActorUri(identifier).href);
|
|
2166
|
+
if (resourceUrl.protocol === "acct:" && host != null && host !== context.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
|
|
2199
2167
|
const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
|
|
2200
2168
|
aliases.push(`acct:${username}@${host}`);
|
|
2201
2169
|
}
|
|
@@ -2209,7 +2177,6 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
|
|
|
2209
2177
|
"Access-Control-Allow-Origin": "*"
|
|
2210
2178
|
} });
|
|
2211
2179
|
}
|
|
2212
|
-
|
|
2213
2180
|
//#endregion
|
|
2214
2181
|
//#region src/federation/retry.ts
|
|
2215
2182
|
/**
|
|
@@ -2240,7 +2207,6 @@ function createExponentialBackoffPolicy(options = {}) {
|
|
|
2240
2207
|
return Temporal.Duration.compare(delay, maxDelay) > 0 ? maxDelay : delay;
|
|
2241
2208
|
};
|
|
2242
2209
|
}
|
|
2243
|
-
|
|
2244
2210
|
//#endregion
|
|
2245
2211
|
//#region src/federation/send.ts
|
|
2246
2212
|
/**
|
|
@@ -2277,10 +2243,9 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
|
|
|
2277
2243
|
* @throws {Error} If the activity fails to send.
|
|
2278
2244
|
*/
|
|
2279
2245
|
function sendActivity(options) {
|
|
2280
|
-
const tracerProvider = options.tracerProvider ??
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
kind: __opentelemetry_api.SpanKind.CLIENT,
|
|
2246
|
+
const tracerProvider = options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
2247
|
+
return tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.send_activity", {
|
|
2248
|
+
kind: _opentelemetry_api.SpanKind.CLIENT,
|
|
2284
2249
|
attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
|
|
2285
2250
|
}, async (span) => {
|
|
2286
2251
|
if (options.activityId != null) span.setAttribute("activitypub.activity.id", options.activityId);
|
|
@@ -2292,7 +2257,7 @@ function sendActivity(options) {
|
|
|
2292
2257
|
}, span);
|
|
2293
2258
|
} catch (e) {
|
|
2294
2259
|
span.setStatus({
|
|
2295
|
-
code:
|
|
2260
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2296
2261
|
message: String(e)
|
|
2297
2262
|
});
|
|
2298
2263
|
throw e;
|
|
@@ -2302,7 +2267,7 @@ function sendActivity(options) {
|
|
|
2302
2267
|
});
|
|
2303
2268
|
}
|
|
2304
2269
|
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
|
|
2305
|
-
const logger
|
|
2270
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
2306
2271
|
"fedify",
|
|
2307
2272
|
"federation",
|
|
2308
2273
|
"outbox"
|
|
@@ -2319,7 +2284,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2319
2284
|
rsaKey = key;
|
|
2320
2285
|
break;
|
|
2321
2286
|
}
|
|
2322
|
-
if (rsaKey == null) logger
|
|
2287
|
+
if (rsaKey == null) logger.warn("No supported key found to sign the request to {inbox}. The request will be sent without a signature. In order to sign the request, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
|
|
2323
2288
|
inbox: inbox.href,
|
|
2324
2289
|
keys: keys.map((pair) => ({
|
|
2325
2290
|
keyId: pair.keyId.href,
|
|
@@ -2333,7 +2298,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2333
2298
|
specDeterminer
|
|
2334
2299
|
});
|
|
2335
2300
|
} catch (error) {
|
|
2336
|
-
logger
|
|
2301
|
+
logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
|
|
2337
2302
|
activityId,
|
|
2338
2303
|
inbox: inbox.href,
|
|
2339
2304
|
error
|
|
@@ -2347,7 +2312,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2347
2312
|
} catch (_) {
|
|
2348
2313
|
error = "";
|
|
2349
2314
|
}
|
|
2350
|
-
logger
|
|
2315
|
+
logger.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
|
|
2351
2316
|
activityId,
|
|
2352
2317
|
inbox: inbox.href,
|
|
2353
2318
|
status: response.status,
|
|
@@ -2362,7 +2327,6 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2362
2327
|
"activitypub.activity.id": activityId ?? ""
|
|
2363
2328
|
});
|
|
2364
2329
|
}
|
|
2365
|
-
|
|
2366
2330
|
//#endregion
|
|
2367
2331
|
//#region src/federation/middleware.ts
|
|
2368
2332
|
/**
|
|
@@ -2400,7 +2364,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2400
2364
|
firstKnock;
|
|
2401
2365
|
constructor(options) {
|
|
2402
2366
|
super();
|
|
2403
|
-
const logger
|
|
2367
|
+
const logger = (0, _logtape_logtape.getLogger)(["fedify", "federation"]);
|
|
2404
2368
|
this.kv = options.kv;
|
|
2405
2369
|
this.kvPrefixes = {
|
|
2406
2370
|
activityIdempotence: ["_fedify", "activityIdempotence"],
|
|
@@ -2457,7 +2421,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2457
2421
|
if (options.documentLoader != null) {
|
|
2458
2422
|
if (options.documentLoaderFactory != null) throw new TypeError("Cannot set both documentLoader and documentLoaderFactory options at a time; use documentLoaderFactory only.");
|
|
2459
2423
|
this.documentLoaderFactory = () => options.documentLoader;
|
|
2460
|
-
logger
|
|
2424
|
+
logger.warn("The documentLoader option is deprecated; use documentLoaderFactory option instead.");
|
|
2461
2425
|
} else this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
|
|
2462
2426
|
return require_docloader.kvCache({
|
|
2463
2427
|
loader: require_docloader.getDocumentLoader({
|
|
@@ -2471,7 +2435,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2471
2435
|
if (options.contextLoader != null) {
|
|
2472
2436
|
if (options.contextLoaderFactory != null) throw new TypeError("Cannot set both contextLoader and contextLoaderFactory options at a time; use contextLoaderFactory only.");
|
|
2473
2437
|
this.contextLoaderFactory = () => options.contextLoader;
|
|
2474
|
-
logger
|
|
2438
|
+
logger.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
|
|
2475
2439
|
} else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
|
2476
2440
|
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_authdocloader.getAuthenticatedDocumentLoader(identity, {
|
|
2477
2441
|
allowPrivateAddress,
|
|
@@ -2486,7 +2450,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2486
2450
|
this.outboxRetryPolicy = options.outboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
2487
2451
|
this.inboxRetryPolicy = options.inboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
2488
2452
|
this.activityTransformers = options.activityTransformers ?? require_transformers.getDefaultActivityTransformers();
|
|
2489
|
-
this.tracerProvider = options.tracerProvider ??
|
|
2453
|
+
this.tracerProvider = options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
2490
2454
|
this.firstKnock = options.firstKnock;
|
|
2491
2455
|
}
|
|
2492
2456
|
_initializeRouter() {
|
|
@@ -2494,28 +2458,28 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2494
2458
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
2495
2459
|
}
|
|
2496
2460
|
_getTracer() {
|
|
2497
|
-
return this.tracerProvider.getTracer(require_docloader.
|
|
2461
|
+
return this.tracerProvider.getTracer(require_docloader.name, require_docloader.version);
|
|
2498
2462
|
}
|
|
2499
2463
|
async _startQueueInternal(ctxData, signal, queue) {
|
|
2500
2464
|
if (this.inboxQueue == null && this.outboxQueue == null) return;
|
|
2501
|
-
const logger
|
|
2465
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
2502
2466
|
"fedify",
|
|
2503
2467
|
"federation",
|
|
2504
2468
|
"queue"
|
|
2505
2469
|
]);
|
|
2506
2470
|
const promises = [];
|
|
2507
2471
|
if (this.inboxQueue != null && (queue == null || queue === "inbox") && !this.inboxQueueStarted) {
|
|
2508
|
-
logger
|
|
2472
|
+
logger.debug("Starting an inbox task worker.");
|
|
2509
2473
|
this.inboxQueueStarted = true;
|
|
2510
2474
|
promises.push(this.inboxQueue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
|
|
2511
2475
|
}
|
|
2512
2476
|
if (this.outboxQueue != null && this.outboxQueue !== this.inboxQueue && (queue == null || queue === "outbox") && !this.outboxQueueStarted) {
|
|
2513
|
-
logger
|
|
2477
|
+
logger.debug("Starting an outbox task worker.");
|
|
2514
2478
|
this.outboxQueueStarted = true;
|
|
2515
2479
|
promises.push(this.outboxQueue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
|
|
2516
2480
|
}
|
|
2517
2481
|
if (this.fanoutQueue != null && this.fanoutQueue !== this.inboxQueue && this.fanoutQueue !== this.outboxQueue && (queue == null || queue === "fanout") && !this.fanoutQueueStarted) {
|
|
2518
|
-
logger
|
|
2482
|
+
logger.debug("Starting a fanout task worker.");
|
|
2519
2483
|
this.fanoutQueueStarted = true;
|
|
2520
2484
|
promises.push(this.fanoutQueue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
|
|
2521
2485
|
}
|
|
@@ -2523,10 +2487,10 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2523
2487
|
}
|
|
2524
2488
|
processQueuedTask(contextData, message) {
|
|
2525
2489
|
const tracer = this._getTracer();
|
|
2526
|
-
const extractedContext =
|
|
2527
|
-
return (0,
|
|
2490
|
+
const extractedContext = _opentelemetry_api.propagation.extract(_opentelemetry_api.context.active(), message.traceContext);
|
|
2491
|
+
return (0, _logtape_logtape.withContext)({ messageId: message.id }, async () => {
|
|
2528
2492
|
if (message.type === "fanout") await tracer.startActiveSpan("activitypub.fanout", {
|
|
2529
|
-
kind:
|
|
2493
|
+
kind: _opentelemetry_api.SpanKind.CONSUMER,
|
|
2530
2494
|
attributes: { "activitypub.activity.type": message.activityType }
|
|
2531
2495
|
}, extractedContext, async (span) => {
|
|
2532
2496
|
if (message.activityId != null) span.setAttribute("activitypub.activity.id", message.activityId);
|
|
@@ -2534,7 +2498,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2534
2498
|
await this.#listenFanoutMessage(contextData, message);
|
|
2535
2499
|
} catch (e) {
|
|
2536
2500
|
span.setStatus({
|
|
2537
|
-
code:
|
|
2501
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2538
2502
|
message: String(e)
|
|
2539
2503
|
});
|
|
2540
2504
|
throw e;
|
|
@@ -2543,7 +2507,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2543
2507
|
}
|
|
2544
2508
|
});
|
|
2545
2509
|
else if (message.type === "outbox") await tracer.startActiveSpan("activitypub.outbox", {
|
|
2546
|
-
kind:
|
|
2510
|
+
kind: _opentelemetry_api.SpanKind.CONSUMER,
|
|
2547
2511
|
attributes: {
|
|
2548
2512
|
"activitypub.activity.type": message.activityType,
|
|
2549
2513
|
"activitypub.activity.retries": message.attempt
|
|
@@ -2554,7 +2518,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2554
2518
|
await this.#listenOutboxMessage(contextData, message, span);
|
|
2555
2519
|
} catch (e) {
|
|
2556
2520
|
span.setStatus({
|
|
2557
|
-
code:
|
|
2521
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2558
2522
|
message: String(e)
|
|
2559
2523
|
});
|
|
2560
2524
|
throw e;
|
|
@@ -2563,14 +2527,14 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2563
2527
|
}
|
|
2564
2528
|
});
|
|
2565
2529
|
else if (message.type === "inbox") await tracer.startActiveSpan("activitypub.inbox", {
|
|
2566
|
-
kind:
|
|
2530
|
+
kind: _opentelemetry_api.SpanKind.CONSUMER,
|
|
2567
2531
|
attributes: { "activitypub.shared_inbox": message.identifier == null }
|
|
2568
2532
|
}, extractedContext, async (span) => {
|
|
2569
2533
|
try {
|
|
2570
2534
|
await this.#listenInboxMessage(contextData, message, span);
|
|
2571
2535
|
} catch (e) {
|
|
2572
2536
|
span.setStatus({
|
|
2573
|
-
code:
|
|
2537
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2574
2538
|
message: String(e)
|
|
2575
2539
|
});
|
|
2576
2540
|
throw e;
|
|
@@ -2581,12 +2545,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2581
2545
|
});
|
|
2582
2546
|
}
|
|
2583
2547
|
async #listenFanoutMessage(data, message) {
|
|
2584
|
-
|
|
2548
|
+
(0, _logtape_logtape.getLogger)([
|
|
2585
2549
|
"fedify",
|
|
2586
2550
|
"federation",
|
|
2587
2551
|
"fanout"
|
|
2588
|
-
])
|
|
2589
|
-
logger$1.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
2552
|
+
]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
2590
2553
|
activityId: message.activityId,
|
|
2591
2554
|
inboxes: globalThis.Object.keys(message.inboxes).length
|
|
2592
2555
|
});
|
|
@@ -2605,17 +2568,17 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2605
2568
|
}),
|
|
2606
2569
|
tracerProvider: this.tracerProvider
|
|
2607
2570
|
});
|
|
2608
|
-
const context
|
|
2571
|
+
const context = this.#createContext(new URL(message.baseUrl), data, { documentLoader: this.documentLoaderFactory({
|
|
2609
2572
|
allowPrivateAddress: this.allowPrivateAddress,
|
|
2610
2573
|
userAgent: this.userAgent
|
|
2611
2574
|
}) });
|
|
2612
2575
|
await this.sendActivity(keys, message.inboxes, activity, {
|
|
2613
2576
|
collectionSync: message.collectionSync,
|
|
2614
|
-
context
|
|
2577
|
+
context
|
|
2615
2578
|
});
|
|
2616
2579
|
}
|
|
2617
2580
|
async #listenOutboxMessage(_, message, span) {
|
|
2618
|
-
const logger
|
|
2581
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
2619
2582
|
"fedify",
|
|
2620
2583
|
"federation",
|
|
2621
2584
|
"outbox"
|
|
@@ -2652,7 +2615,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2652
2615
|
});
|
|
2653
2616
|
} catch (error) {
|
|
2654
2617
|
span.setStatus({
|
|
2655
|
-
code:
|
|
2618
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2656
2619
|
message: String(error)
|
|
2657
2620
|
});
|
|
2658
2621
|
const loaderOptions = this.#getLoaderOptions(message.baseUrl);
|
|
@@ -2663,14 +2626,14 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2663
2626
|
});
|
|
2664
2627
|
try {
|
|
2665
2628
|
this.onOutboxError?.(error, activity);
|
|
2666
|
-
} catch (error
|
|
2667
|
-
logger
|
|
2629
|
+
} catch (error) {
|
|
2630
|
+
logger.error("An unexpected error occurred in onError handler:\n{error}", {
|
|
2668
2631
|
...logData,
|
|
2669
|
-
error
|
|
2632
|
+
error
|
|
2670
2633
|
});
|
|
2671
2634
|
}
|
|
2672
2635
|
if (this.outboxQueue?.nativeRetrial) {
|
|
2673
|
-
logger
|
|
2636
|
+
logger.error("Failed to send activity {activityId} to {inbox}; backend will handle retry:\n{error}", {
|
|
2674
2637
|
...logData,
|
|
2675
2638
|
error
|
|
2676
2639
|
});
|
|
@@ -2681,7 +2644,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2681
2644
|
attempts: message.attempt
|
|
2682
2645
|
});
|
|
2683
2646
|
if (delay != null) {
|
|
2684
|
-
logger
|
|
2647
|
+
logger.error("Failed to send activity {activityId} to {inbox} (attempt #{attempt}); retry...:\n{error}", {
|
|
2685
2648
|
...logData,
|
|
2686
2649
|
error
|
|
2687
2650
|
});
|
|
@@ -2689,39 +2652,38 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2689
2652
|
...message,
|
|
2690
2653
|
attempt: message.attempt + 1
|
|
2691
2654
|
}, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
|
|
2692
|
-
} else logger
|
|
2655
|
+
} else logger.error("Failed to send activity {activityId} to {inbox} after {attempt} attempts; giving up:\n{error}", {
|
|
2693
2656
|
...logData,
|
|
2694
2657
|
error
|
|
2695
2658
|
});
|
|
2696
2659
|
return;
|
|
2697
2660
|
}
|
|
2698
|
-
logger
|
|
2661
|
+
logger.info("Successfully sent activity {activityId} to {inbox}.", { ...logData });
|
|
2699
2662
|
}
|
|
2700
2663
|
async #listenInboxMessage(ctxData, message, span) {
|
|
2701
|
-
const logger
|
|
2664
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
2702
2665
|
"fedify",
|
|
2703
2666
|
"federation",
|
|
2704
2667
|
"inbox"
|
|
2705
2668
|
]);
|
|
2706
2669
|
const baseUrl = new URL(message.baseUrl);
|
|
2707
|
-
let context
|
|
2708
|
-
if (message.identifier != null) context
|
|
2670
|
+
let context = this.#createContext(baseUrl, ctxData);
|
|
2671
|
+
if (message.identifier != null) context = this.#createContext(baseUrl, ctxData, { documentLoader: await context.getDocumentLoader({ identifier: message.identifier }) });
|
|
2709
2672
|
else if (this.sharedInboxKeyDispatcher != null) {
|
|
2710
|
-
const identity = await this.sharedInboxKeyDispatcher(context
|
|
2711
|
-
if (identity != null) context
|
|
2673
|
+
const identity = await this.sharedInboxKeyDispatcher(context);
|
|
2674
|
+
if (identity != null) context = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context.getDocumentLoader(identity) : context.getDocumentLoader(identity) });
|
|
2712
2675
|
}
|
|
2713
|
-
const activity = await require_actor.Activity.fromJsonLd(message.activity, context
|
|
2676
|
+
const activity = await require_actor.Activity.fromJsonLd(message.activity, context);
|
|
2714
2677
|
span.setAttribute("activitypub.activity.type", require_actor.getTypeId(activity).href);
|
|
2715
2678
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
2716
2679
|
const cacheKey = activity.id == null ? null : [
|
|
2717
2680
|
...this.kvPrefixes.activityIdempotence,
|
|
2718
|
-
context
|
|
2681
|
+
context.origin,
|
|
2719
2682
|
activity.id.href
|
|
2720
2683
|
];
|
|
2721
2684
|
if (cacheKey != null) {
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
logger$1.debug("Activity {activityId} has already been processed.", {
|
|
2685
|
+
if (await this.kv.get(cacheKey) === true) {
|
|
2686
|
+
logger.debug("Activity {activityId} has already been processed.", {
|
|
2725
2687
|
activityId: activity.id?.href,
|
|
2726
2688
|
activity: message.activity,
|
|
2727
2689
|
recipient: message.identifier
|
|
@@ -2729,32 +2691,32 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2729
2691
|
return;
|
|
2730
2692
|
}
|
|
2731
2693
|
}
|
|
2732
|
-
await this._getTracer().startActiveSpan("activitypub.dispatch_inbox_listener", { kind:
|
|
2694
|
+
await this._getTracer().startActiveSpan("activitypub.dispatch_inbox_listener", { kind: _opentelemetry_api.SpanKind.INTERNAL }, async (span) => {
|
|
2733
2695
|
const dispatched = this.inboxListeners?.dispatchWithClass(activity);
|
|
2734
2696
|
if (dispatched == null) {
|
|
2735
|
-
logger
|
|
2697
|
+
logger.error("Unsupported activity type:\n{activity}", {
|
|
2736
2698
|
activityId: activity.id?.href,
|
|
2737
2699
|
activity: message.activity,
|
|
2738
2700
|
recipient: message.identifier,
|
|
2739
2701
|
trial: message.attempt
|
|
2740
2702
|
});
|
|
2741
|
-
span
|
|
2742
|
-
code:
|
|
2703
|
+
span.setStatus({
|
|
2704
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2743
2705
|
message: `Unsupported activity type: ${require_actor.getTypeId(activity).href}`
|
|
2744
2706
|
});
|
|
2745
|
-
span
|
|
2707
|
+
span.end();
|
|
2746
2708
|
return;
|
|
2747
2709
|
}
|
|
2748
2710
|
const { class: cls, listener } = dispatched;
|
|
2749
|
-
span
|
|
2711
|
+
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
2750
2712
|
try {
|
|
2751
|
-
await listener(context
|
|
2713
|
+
await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, require_actor.getTypeId(activity).href), activity);
|
|
2752
2714
|
} catch (error) {
|
|
2753
2715
|
try {
|
|
2754
|
-
await this.inboxErrorHandler?.(context
|
|
2755
|
-
} catch (error
|
|
2756
|
-
logger
|
|
2757
|
-
error
|
|
2716
|
+
await this.inboxErrorHandler?.(context, error);
|
|
2717
|
+
} catch (error) {
|
|
2718
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
2719
|
+
error,
|
|
2758
2720
|
trial: message.attempt,
|
|
2759
2721
|
activityId: activity.id?.href,
|
|
2760
2722
|
activity: message.activity,
|
|
@@ -2762,17 +2724,17 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2762
2724
|
});
|
|
2763
2725
|
}
|
|
2764
2726
|
if (this.inboxQueue?.nativeRetrial) {
|
|
2765
|
-
logger
|
|
2727
|
+
logger.error("Failed to process the incoming activity {activityId}; backend will handle retry:\n{error}", {
|
|
2766
2728
|
error,
|
|
2767
2729
|
activityId: activity.id?.href,
|
|
2768
2730
|
activity: message.activity,
|
|
2769
2731
|
recipient: message.identifier
|
|
2770
2732
|
});
|
|
2771
|
-
span
|
|
2772
|
-
code:
|
|
2733
|
+
span.setStatus({
|
|
2734
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2773
2735
|
message: String(error)
|
|
2774
2736
|
});
|
|
2775
|
-
span
|
|
2737
|
+
span.end();
|
|
2776
2738
|
throw error;
|
|
2777
2739
|
}
|
|
2778
2740
|
const delay = this.inboxRetryPolicy({
|
|
@@ -2780,7 +2742,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2780
2742
|
attempts: message.attempt
|
|
2781
2743
|
});
|
|
2782
2744
|
if (delay != null) {
|
|
2783
|
-
logger
|
|
2745
|
+
logger.error("Failed to process the incoming activity {activityId} (attempt #{attempt}); retry...:\n{error}", {
|
|
2784
2746
|
error,
|
|
2785
2747
|
attempt: message.attempt,
|
|
2786
2748
|
activityId: activity.id?.href,
|
|
@@ -2791,26 +2753,26 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2791
2753
|
...message,
|
|
2792
2754
|
attempt: message.attempt + 1
|
|
2793
2755
|
}, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
|
|
2794
|
-
} else logger
|
|
2756
|
+
} else logger.error("Failed to process the incoming activity {activityId} after {trial} attempts; giving up:\n{error}", {
|
|
2795
2757
|
error,
|
|
2796
2758
|
activityId: activity.id?.href,
|
|
2797
2759
|
activity: message.activity,
|
|
2798
2760
|
recipient: message.identifier
|
|
2799
2761
|
});
|
|
2800
|
-
span
|
|
2801
|
-
code:
|
|
2762
|
+
span.setStatus({
|
|
2763
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
2802
2764
|
message: String(error)
|
|
2803
2765
|
});
|
|
2804
|
-
span
|
|
2766
|
+
span.end();
|
|
2805
2767
|
return;
|
|
2806
2768
|
}
|
|
2807
2769
|
if (cacheKey != null) await this.kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
|
|
2808
|
-
logger
|
|
2770
|
+
logger.info("Activity {activityId} has been processed.", {
|
|
2809
2771
|
activityId: activity.id?.href,
|
|
2810
2772
|
activity: message.activity,
|
|
2811
2773
|
recipient: message.identifier
|
|
2812
2774
|
});
|
|
2813
|
-
span
|
|
2775
|
+
span.end();
|
|
2814
2776
|
});
|
|
2815
2777
|
}
|
|
2816
2778
|
startQueue(contextData, options = {}) {
|
|
@@ -2854,7 +2816,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2854
2816
|
};
|
|
2855
2817
|
}
|
|
2856
2818
|
async sendActivity(keys, inboxes, activity, options) {
|
|
2857
|
-
const logger
|
|
2819
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
2858
2820
|
"fedify",
|
|
2859
2821
|
"federation",
|
|
2860
2822
|
"outbox"
|
|
@@ -2888,7 +2850,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2888
2850
|
format: "compact",
|
|
2889
2851
|
contextLoader
|
|
2890
2852
|
});
|
|
2891
|
-
if (rsaKey == null) logger
|
|
2853
|
+
if (rsaKey == null) logger.warn("No supported key found to create a Linked Data signature for the activity {activityId}. The activity will be sent without a Linked Data signature. In order to create a Linked Data signature, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
|
|
2892
2854
|
activityId,
|
|
2893
2855
|
keys: keys.map((pair) => ({
|
|
2894
2856
|
keyId: pair.keyId.href,
|
|
@@ -2899,7 +2861,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2899
2861
|
contextLoader,
|
|
2900
2862
|
tracerProvider: this.tracerProvider
|
|
2901
2863
|
});
|
|
2902
|
-
if (!proofCreated) logger
|
|
2864
|
+
if (!proofCreated) logger.warn("No supported key found to create a proof for the activity {activityId}. The activity will be sent without a proof. In order to create a proof, at least one Ed25519 key must be provided.", {
|
|
2903
2865
|
activityId,
|
|
2904
2866
|
keys: keys.map((pair) => ({
|
|
2905
2867
|
keyId: pair.keyId.href,
|
|
@@ -2907,11 +2869,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2907
2869
|
}))
|
|
2908
2870
|
});
|
|
2909
2871
|
if (immediate || this.outboxQueue == null) {
|
|
2910
|
-
if (immediate) logger
|
|
2872
|
+
if (immediate) logger.debug("Sending activity immediately without queue since immediate option is set.", {
|
|
2911
2873
|
activityId: activity.id.href,
|
|
2912
2874
|
activity: jsonLd
|
|
2913
2875
|
});
|
|
2914
|
-
else logger
|
|
2876
|
+
else logger.debug("Sending activity immediately without queue since queue is not set.", {
|
|
2915
2877
|
activityId: activity.id.href,
|
|
2916
2878
|
activity: jsonLd
|
|
2917
2879
|
});
|
|
@@ -2930,7 +2892,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2930
2892
|
await Promise.all(promises);
|
|
2931
2893
|
return;
|
|
2932
2894
|
}
|
|
2933
|
-
logger
|
|
2895
|
+
logger.debug("Enqueuing activity {activityId} to send later.", {
|
|
2934
2896
|
activityId: activity.id.href,
|
|
2935
2897
|
activity: jsonLd
|
|
2936
2898
|
});
|
|
@@ -2944,7 +2906,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2944
2906
|
}
|
|
2945
2907
|
if (!this.manuallyStartQueue) this._startQueueInternal(ctx.data);
|
|
2946
2908
|
const carrier = {};
|
|
2947
|
-
|
|
2909
|
+
_opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
|
|
2948
2910
|
const messages = [];
|
|
2949
2911
|
for (const inbox in inboxes) {
|
|
2950
2912
|
const message = {
|
|
@@ -2967,10 +2929,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2967
2929
|
const { outboxQueue } = this;
|
|
2968
2930
|
if (outboxQueue.enqueueMany == null) {
|
|
2969
2931
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2970
|
-
const
|
|
2971
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2932
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2972
2933
|
if (errors.length > 0) {
|
|
2973
|
-
logger
|
|
2934
|
+
logger.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
2974
2935
|
activityId: activity.id.href,
|
|
2975
2936
|
errors
|
|
2976
2937
|
});
|
|
@@ -2980,7 +2941,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2980
2941
|
} else try {
|
|
2981
2942
|
await outboxQueue.enqueueMany(messages);
|
|
2982
2943
|
} catch (error) {
|
|
2983
|
-
logger
|
|
2944
|
+
logger.error("Failed to enqueue activity {activityId} to send later: {error}", {
|
|
2984
2945
|
activityId: activity.id.href,
|
|
2985
2946
|
error
|
|
2986
2947
|
});
|
|
@@ -2988,22 +2949,21 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2988
2949
|
}
|
|
2989
2950
|
}
|
|
2990
2951
|
fetch(request, options) {
|
|
2991
|
-
|
|
2992
|
-
return (0, __logtape_logtape.withContext)({ requestId }, async () => {
|
|
2952
|
+
return (0, _logtape_logtape.withContext)({ requestId: getRequestId(request) }, async () => {
|
|
2993
2953
|
const tracer = this._getTracer();
|
|
2994
2954
|
return await tracer.startActiveSpan(request.method, {
|
|
2995
|
-
kind:
|
|
2955
|
+
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
2996
2956
|
attributes: {
|
|
2997
|
-
[
|
|
2998
|
-
[
|
|
2957
|
+
[_opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD]: request.method,
|
|
2958
|
+
[_opentelemetry_semantic_conventions.ATTR_URL_FULL]: request.url
|
|
2999
2959
|
}
|
|
3000
2960
|
}, async (span) => {
|
|
3001
|
-
const logger
|
|
2961
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
3002
2962
|
"fedify",
|
|
3003
2963
|
"federation",
|
|
3004
2964
|
"http"
|
|
3005
2965
|
]);
|
|
3006
|
-
if (span.isRecording()) for (const [k, v] of request.headers) span.setAttribute((0,
|
|
2966
|
+
if (span.isRecording()) for (const [k, v] of request.headers) span.setAttribute((0, _opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_HEADER)(k), [v]);
|
|
3007
2967
|
let response;
|
|
3008
2968
|
try {
|
|
3009
2969
|
response = await this.#fetch(request, {
|
|
@@ -3013,11 +2973,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3013
2973
|
});
|
|
3014
2974
|
} catch (error) {
|
|
3015
2975
|
span.setStatus({
|
|
3016
|
-
code:
|
|
2976
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3017
2977
|
message: `${error}`
|
|
3018
2978
|
});
|
|
3019
2979
|
span.end();
|
|
3020
|
-
logger
|
|
2980
|
+
logger.error("An error occurred while serving request {method} {url}: {error}", {
|
|
3021
2981
|
method: request.method,
|
|
3022
2982
|
url: request.url,
|
|
3023
2983
|
error
|
|
@@ -3025,10 +2985,10 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3025
2985
|
throw error;
|
|
3026
2986
|
}
|
|
3027
2987
|
if (span.isRecording()) {
|
|
3028
|
-
span.setAttribute(
|
|
3029
|
-
for (const [k, v] of response.headers) span.setAttribute((0,
|
|
2988
|
+
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);
|
|
2989
|
+
for (const [k, v] of response.headers) span.setAttribute((0, _opentelemetry_semantic_conventions.ATTR_HTTP_RESPONSE_HEADER)(k), [v]);
|
|
3030
2990
|
span.setStatus({
|
|
3031
|
-
code: response.status >= 500 ?
|
|
2991
|
+
code: response.status >= 500 ? _opentelemetry_api.SpanStatusCode.ERROR : _opentelemetry_api.SpanStatusCode.UNSET,
|
|
3032
2992
|
message: response.statusText
|
|
3033
2993
|
});
|
|
3034
2994
|
}
|
|
@@ -3041,9 +3001,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3041
3001
|
url: request.url,
|
|
3042
3002
|
status: response.status
|
|
3043
3003
|
};
|
|
3044
|
-
if (response.status >= 500) logger
|
|
3045
|
-
else if (response.status >= 400) logger
|
|
3046
|
-
else logger
|
|
3004
|
+
if (response.status >= 500) logger.error(logTpl, values);
|
|
3005
|
+
else if (response.status >= 400) logger.warn(logTpl, values);
|
|
3006
|
+
else logger.info(logTpl, values);
|
|
3047
3007
|
return response;
|
|
3048
3008
|
});
|
|
3049
3009
|
});
|
|
@@ -3056,11 +3016,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3056
3016
|
const route = this.router.route(url.pathname);
|
|
3057
3017
|
if (route == null) return await onNotFound(request);
|
|
3058
3018
|
span.updateName(`${request.method} ${route.template}`);
|
|
3059
|
-
let context
|
|
3019
|
+
let context = this.#createContext(request, contextData);
|
|
3060
3020
|
const routeName = route.name.replace(/:.*$/, "");
|
|
3061
3021
|
switch (routeName) {
|
|
3062
3022
|
case "webfinger": return await handleWebFinger(request, {
|
|
3063
|
-
context
|
|
3023
|
+
context,
|
|
3064
3024
|
host: this.origin?.handleHost,
|
|
3065
3025
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
3066
3026
|
actorHandleMapper: this.actorCallbacks?.handleMapper,
|
|
@@ -3069,16 +3029,16 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3069
3029
|
onNotFound,
|
|
3070
3030
|
tracer
|
|
3071
3031
|
});
|
|
3072
|
-
case "nodeInfoJrd": return await handleNodeInfoJrd(request, context
|
|
3032
|
+
case "nodeInfoJrd": return await handleNodeInfoJrd(request, context);
|
|
3073
3033
|
case "nodeInfo": return await handleNodeInfo(request, {
|
|
3074
|
-
context
|
|
3034
|
+
context,
|
|
3075
3035
|
nodeInfoDispatcher: this.nodeInfoDispatcher
|
|
3076
3036
|
});
|
|
3077
3037
|
case "actor":
|
|
3078
|
-
context
|
|
3038
|
+
context = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
|
|
3079
3039
|
return await handleActor(request, {
|
|
3080
3040
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3081
|
-
context
|
|
3041
|
+
context,
|
|
3082
3042
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
3083
3043
|
authorizePredicate: this.actorCallbacks?.authorizePredicate,
|
|
3084
3044
|
onUnauthorized,
|
|
@@ -3089,13 +3049,13 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3089
3049
|
const typeId = route.name.replace(/^object:/, "");
|
|
3090
3050
|
const callbacks = this.objectCallbacks[typeId];
|
|
3091
3051
|
const cls = this.objectTypeIds[typeId];
|
|
3092
|
-
context
|
|
3052
|
+
context = this.#createContext(request, contextData, { invokedFromObjectDispatcher: {
|
|
3093
3053
|
cls,
|
|
3094
3054
|
values: route.values
|
|
3095
3055
|
} });
|
|
3096
3056
|
return await handleObject(request, {
|
|
3097
3057
|
values: route.values,
|
|
3098
|
-
context
|
|
3058
|
+
context,
|
|
3099
3059
|
objectDispatcher: callbacks?.dispatcher,
|
|
3100
3060
|
authorizePredicate: callbacks?.authorizePredicate,
|
|
3101
3061
|
onUnauthorized,
|
|
@@ -3106,8 +3066,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3106
3066
|
case "outbox": return await handleCollection(request, {
|
|
3107
3067
|
name: "outbox",
|
|
3108
3068
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3109
|
-
uriGetter: context
|
|
3110
|
-
context
|
|
3069
|
+
uriGetter: context.getOutboxUri.bind(context),
|
|
3070
|
+
context,
|
|
3111
3071
|
collectionCallbacks: this.outboxCallbacks,
|
|
3112
3072
|
tracerProvider: this.tracerProvider,
|
|
3113
3073
|
onUnauthorized,
|
|
@@ -3118,25 +3078,25 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3118
3078
|
if (request.method !== "POST") return await handleCollection(request, {
|
|
3119
3079
|
name: "inbox",
|
|
3120
3080
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3121
|
-
uriGetter: context
|
|
3122
|
-
context
|
|
3081
|
+
uriGetter: context.getInboxUri.bind(context),
|
|
3082
|
+
context,
|
|
3123
3083
|
collectionCallbacks: this.inboxCallbacks,
|
|
3124
3084
|
tracerProvider: this.tracerProvider,
|
|
3125
3085
|
onUnauthorized,
|
|
3126
3086
|
onNotFound,
|
|
3127
3087
|
onNotAcceptable
|
|
3128
3088
|
});
|
|
3129
|
-
context
|
|
3089
|
+
context = this.#createContext(request, contextData, { documentLoader: await context.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
|
|
3130
3090
|
case "sharedInbox":
|
|
3131
3091
|
if (routeName !== "inbox" && this.sharedInboxKeyDispatcher != null) {
|
|
3132
|
-
const identity = await this.sharedInboxKeyDispatcher(context
|
|
3133
|
-
if (identity != null) context
|
|
3092
|
+
const identity = await this.sharedInboxKeyDispatcher(context);
|
|
3093
|
+
if (identity != null) context = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context.getDocumentLoader(identity) : context.getDocumentLoader(identity) });
|
|
3134
3094
|
}
|
|
3135
3095
|
if (!this.manuallyStartQueue) this._startQueueInternal(contextData);
|
|
3136
3096
|
return await handleInbox(request, {
|
|
3137
3097
|
recipient: route.values.identifier ?? route.values.handle ?? null,
|
|
3138
|
-
context
|
|
3139
|
-
inboxContextFactory: context
|
|
3098
|
+
context,
|
|
3099
|
+
inboxContextFactory: context.toInboxContext.bind(context),
|
|
3140
3100
|
kv: this.kv,
|
|
3141
3101
|
kvPrefixes: this.kvPrefixes,
|
|
3142
3102
|
queue: this.inboxQueue,
|
|
@@ -3152,8 +3112,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3152
3112
|
case "following": return await handleCollection(request, {
|
|
3153
3113
|
name: "following",
|
|
3154
3114
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3155
|
-
uriGetter: context
|
|
3156
|
-
context
|
|
3115
|
+
uriGetter: context.getFollowingUri.bind(context),
|
|
3116
|
+
context,
|
|
3157
3117
|
collectionCallbacks: this.followingCallbacks,
|
|
3158
3118
|
tracerProvider: this.tracerProvider,
|
|
3159
3119
|
onUnauthorized,
|
|
@@ -3170,14 +3130,14 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3170
3130
|
return await handleCollection(request, {
|
|
3171
3131
|
name: "followers",
|
|
3172
3132
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3173
|
-
uriGetter: baseUrl == null ? context
|
|
3174
|
-
const uri = context
|
|
3133
|
+
uriGetter: baseUrl == null ? context.getFollowersUri.bind(context) : (identifier) => {
|
|
3134
|
+
const uri = context.getFollowersUri(identifier);
|
|
3175
3135
|
uri.searchParams.set("base-url", baseUrl);
|
|
3176
3136
|
return uri;
|
|
3177
3137
|
},
|
|
3178
|
-
context
|
|
3138
|
+
context,
|
|
3179
3139
|
filter: baseUrl != null ? new URL(baseUrl) : void 0,
|
|
3180
|
-
filterPredicate: baseUrl != null ? (i) => (i instanceof URL ? i.href : i.id?.href ?? "").startsWith(baseUrl) : void 0,
|
|
3140
|
+
filterPredicate: baseUrl != null ? ((i) => (i instanceof URL ? i.href : i.id?.href ?? "").startsWith(baseUrl)) : void 0,
|
|
3181
3141
|
collectionCallbacks: this.followersCallbacks,
|
|
3182
3142
|
tracerProvider: this.tracerProvider,
|
|
3183
3143
|
onUnauthorized,
|
|
@@ -3188,8 +3148,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3188
3148
|
case "liked": return await handleCollection(request, {
|
|
3189
3149
|
name: "liked",
|
|
3190
3150
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3191
|
-
uriGetter: context
|
|
3192
|
-
context
|
|
3151
|
+
uriGetter: context.getLikedUri.bind(context),
|
|
3152
|
+
context,
|
|
3193
3153
|
collectionCallbacks: this.likedCallbacks,
|
|
3194
3154
|
tracerProvider: this.tracerProvider,
|
|
3195
3155
|
onUnauthorized,
|
|
@@ -3199,8 +3159,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3199
3159
|
case "featured": return await handleCollection(request, {
|
|
3200
3160
|
name: "featured",
|
|
3201
3161
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3202
|
-
uriGetter: context
|
|
3203
|
-
context
|
|
3162
|
+
uriGetter: context.getFeaturedUri.bind(context),
|
|
3163
|
+
context,
|
|
3204
3164
|
collectionCallbacks: this.featuredCallbacks,
|
|
3205
3165
|
tracerProvider: this.tracerProvider,
|
|
3206
3166
|
onUnauthorized,
|
|
@@ -3210,8 +3170,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3210
3170
|
case "featuredTags": return await handleCollection(request, {
|
|
3211
3171
|
name: "featured tags",
|
|
3212
3172
|
identifier: route.values.identifier ?? route.values.handle,
|
|
3213
|
-
uriGetter: context
|
|
3214
|
-
context
|
|
3173
|
+
uriGetter: context.getFeaturedTagsUri.bind(context),
|
|
3174
|
+
context,
|
|
3215
3175
|
collectionCallbacks: this.featuredTagsCallbacks,
|
|
3216
3176
|
tracerProvider: this.tracerProvider,
|
|
3217
3177
|
onUnauthorized,
|
|
@@ -3223,7 +3183,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3223
3183
|
const callbacks = this.collectionCallbacks[name];
|
|
3224
3184
|
return await handleCustomCollection(request, {
|
|
3225
3185
|
name,
|
|
3226
|
-
context
|
|
3186
|
+
context,
|
|
3227
3187
|
values: route.values,
|
|
3228
3188
|
collectionCallbacks: callbacks,
|
|
3229
3189
|
tracerProvider: this.tracerProvider,
|
|
@@ -3237,7 +3197,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3237
3197
|
const callbacks = this.collectionCallbacks[name];
|
|
3238
3198
|
return await handleOrderedCollection(request, {
|
|
3239
3199
|
name,
|
|
3240
|
-
context
|
|
3200
|
+
context,
|
|
3241
3201
|
values: route.values,
|
|
3242
3202
|
collectionCallbacks: callbacks,
|
|
3243
3203
|
tracerProvider: this.tracerProvider,
|
|
@@ -3335,9 +3295,9 @@ var ContextImpl = class ContextImpl {
|
|
|
3335
3295
|
}
|
|
3336
3296
|
getInboxUri(identifier) {
|
|
3337
3297
|
if (identifier == null) {
|
|
3338
|
-
const path
|
|
3339
|
-
if (path
|
|
3340
|
-
return new URL(path
|
|
3298
|
+
const path = this.federation.router.build("sharedInbox", {});
|
|
3299
|
+
if (path == null) throw new RouterError("No shared inbox path registered.");
|
|
3300
|
+
return new URL(path, this.canonicalOrigin);
|
|
3341
3301
|
}
|
|
3342
3302
|
const path = this.federation.router.build("inbox", {
|
|
3343
3303
|
identifier,
|
|
@@ -3395,14 +3355,13 @@ var ContextImpl = class ContextImpl {
|
|
|
3395
3355
|
if (uri == null) return null;
|
|
3396
3356
|
if (uri.origin !== this.origin && uri.origin !== this.canonicalOrigin) return null;
|
|
3397
3357
|
const route = this.federation.router.route(uri.pathname);
|
|
3398
|
-
const logger
|
|
3358
|
+
const logger = (0, _logtape_logtape.getLogger)(["fedify", "federation"]);
|
|
3399
3359
|
if (route == null) return null;
|
|
3400
3360
|
else if (route.name === "sharedInbox") return {
|
|
3401
3361
|
type: "inbox",
|
|
3402
3362
|
identifier: void 0,
|
|
3403
3363
|
get handle() {
|
|
3404
|
-
logger
|
|
3405
|
-
return void 0;
|
|
3364
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3406
3365
|
}
|
|
3407
3366
|
};
|
|
3408
3367
|
const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
|
|
@@ -3410,7 +3369,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3410
3369
|
type: "actor",
|
|
3411
3370
|
identifier,
|
|
3412
3371
|
get handle() {
|
|
3413
|
-
logger
|
|
3372
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3414
3373
|
return identifier;
|
|
3415
3374
|
}
|
|
3416
3375
|
};
|
|
@@ -3426,7 +3385,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3426
3385
|
type: "inbox",
|
|
3427
3386
|
identifier,
|
|
3428
3387
|
get handle() {
|
|
3429
|
-
logger
|
|
3388
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3430
3389
|
return identifier;
|
|
3431
3390
|
}
|
|
3432
3391
|
};
|
|
@@ -3434,7 +3393,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3434
3393
|
type: "outbox",
|
|
3435
3394
|
identifier,
|
|
3436
3395
|
get handle() {
|
|
3437
|
-
logger
|
|
3396
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3438
3397
|
return identifier;
|
|
3439
3398
|
}
|
|
3440
3399
|
};
|
|
@@ -3442,7 +3401,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3442
3401
|
type: "following",
|
|
3443
3402
|
identifier,
|
|
3444
3403
|
get handle() {
|
|
3445
|
-
logger
|
|
3404
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3446
3405
|
return identifier;
|
|
3447
3406
|
}
|
|
3448
3407
|
};
|
|
@@ -3450,7 +3409,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3450
3409
|
type: "followers",
|
|
3451
3410
|
identifier,
|
|
3452
3411
|
get handle() {
|
|
3453
|
-
logger
|
|
3412
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3454
3413
|
return identifier;
|
|
3455
3414
|
}
|
|
3456
3415
|
};
|
|
@@ -3458,7 +3417,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3458
3417
|
type: "liked",
|
|
3459
3418
|
identifier,
|
|
3460
3419
|
get handle() {
|
|
3461
|
-
logger
|
|
3420
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3462
3421
|
return identifier;
|
|
3463
3422
|
}
|
|
3464
3423
|
};
|
|
@@ -3466,7 +3425,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3466
3425
|
type: "featured",
|
|
3467
3426
|
identifier,
|
|
3468
3427
|
get handle() {
|
|
3469
|
-
logger
|
|
3428
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3470
3429
|
return identifier;
|
|
3471
3430
|
}
|
|
3472
3431
|
};
|
|
@@ -3474,12 +3433,11 @@ var ContextImpl = class ContextImpl {
|
|
|
3474
3433
|
type: "featuredTags",
|
|
3475
3434
|
identifier,
|
|
3476
3435
|
get handle() {
|
|
3477
|
-
logger
|
|
3436
|
+
logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3478
3437
|
return identifier;
|
|
3479
3438
|
}
|
|
3480
3439
|
};
|
|
3481
|
-
const
|
|
3482
|
-
const collectionRegex = /* @__PURE__ */ new RegExp(`^(${collectionTypes.join("|")}):(.*)$`);
|
|
3440
|
+
const collectionRegex = new RegExp(`^(${["collection", "orderedCollection"].join("|")}):(.*)$`);
|
|
3483
3441
|
const match = route.name.match(collectionRegex);
|
|
3484
3442
|
if (match !== null) {
|
|
3485
3443
|
const [, type, name] = match;
|
|
@@ -3495,12 +3453,12 @@ var ContextImpl = class ContextImpl {
|
|
|
3495
3453
|
return null;
|
|
3496
3454
|
}
|
|
3497
3455
|
async getActorKeyPairs(identifier) {
|
|
3498
|
-
const logger
|
|
3456
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
3499
3457
|
"fedify",
|
|
3500
3458
|
"federation",
|
|
3501
3459
|
"actor"
|
|
3502
3460
|
]);
|
|
3503
|
-
if (this.invokedFromActorKeyPairsDispatcher != null) logger
|
|
3461
|
+
if (this.invokedFromActorKeyPairsDispatcher != null) logger.warn("Context.getActorKeyPairs({getActorKeyPairsIdentifier}) method is invoked from the actor key pairs dispatcher ({actorKeyPairsDispatcherIdentifier}); this may cause an infinite loop.", {
|
|
3504
3462
|
getActorKeyPairsIdentifier: identifier,
|
|
3505
3463
|
actorKeyPairsDispatcherIdentifier: this.invokedFromActorKeyPairsDispatcher.identifier
|
|
3506
3464
|
});
|
|
@@ -3508,7 +3466,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3508
3466
|
try {
|
|
3509
3467
|
keyPairs = await this.getKeyPairsFromIdentifier(identifier);
|
|
3510
3468
|
} catch (_) {
|
|
3511
|
-
logger
|
|
3469
|
+
logger.warn("No actor key pairs dispatcher registered.");
|
|
3512
3470
|
return [];
|
|
3513
3471
|
}
|
|
3514
3472
|
const owner = this.getActorUri(identifier);
|
|
@@ -3532,7 +3490,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3532
3490
|
return result;
|
|
3533
3491
|
}
|
|
3534
3492
|
async getKeyPairsFromIdentifier(identifier) {
|
|
3535
|
-
const logger
|
|
3493
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
3536
3494
|
"fedify",
|
|
3537
3495
|
"federation",
|
|
3538
3496
|
"actor"
|
|
@@ -3543,7 +3501,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3543
3501
|
actorUri = this.getActorUri(identifier);
|
|
3544
3502
|
} catch (error) {
|
|
3545
3503
|
if (error instanceof RouterError) {
|
|
3546
|
-
logger
|
|
3504
|
+
logger.warn(error.message);
|
|
3547
3505
|
return [];
|
|
3548
3506
|
}
|
|
3549
3507
|
throw error;
|
|
@@ -3552,7 +3510,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3552
3510
|
...this,
|
|
3553
3511
|
invokedFromActorKeyPairsDispatcher: { identifier }
|
|
3554
3512
|
}), identifier);
|
|
3555
|
-
if (keyPairs.length < 1) logger
|
|
3513
|
+
if (keyPairs.length < 1) logger.warn("No key pairs found for actor {identifier}.", { identifier });
|
|
3556
3514
|
let i = 0;
|
|
3557
3515
|
const result = [];
|
|
3558
3516
|
for (const keyPair of keyPairs) {
|
|
@@ -3570,7 +3528,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3570
3528
|
const { privateKey } = keyPair;
|
|
3571
3529
|
if (privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" && privateKey.algorithm.hash.name === "SHA-256") return keyPair;
|
|
3572
3530
|
}
|
|
3573
|
-
(0,
|
|
3531
|
+
(0, _logtape_logtape.getLogger)([
|
|
3574
3532
|
"fedify",
|
|
3575
3533
|
"federation",
|
|
3576
3534
|
"actor"
|
|
@@ -3585,7 +3543,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3585
3543
|
if ("username" in identity) username = identity.username;
|
|
3586
3544
|
else {
|
|
3587
3545
|
username = identity.handle;
|
|
3588
|
-
(0,
|
|
3546
|
+
(0, _logtape_logtape.getLogger)([
|
|
3589
3547
|
"fedify",
|
|
3590
3548
|
"runtime",
|
|
3591
3549
|
"docloader"
|
|
@@ -3600,14 +3558,13 @@ var ContextImpl = class ContextImpl {
|
|
|
3600
3558
|
} else identifierPromise = Promise.resolve(identity.identifier);
|
|
3601
3559
|
return identifierPromise.then((identifier) => {
|
|
3602
3560
|
if (identifier == null) return this.documentLoader;
|
|
3603
|
-
|
|
3604
|
-
return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
3561
|
+
return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
3605
3562
|
});
|
|
3606
3563
|
}
|
|
3607
3564
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
3608
3565
|
}
|
|
3609
3566
|
lookupObject(identifier, options = {}) {
|
|
3610
|
-
return
|
|
3567
|
+
return require_vocab_mod.lookupObject(identifier, {
|
|
3611
3568
|
...options,
|
|
3612
3569
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3613
3570
|
contextLoader: options.contextLoader ?? this.contextLoader,
|
|
@@ -3617,7 +3574,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3617
3574
|
});
|
|
3618
3575
|
}
|
|
3619
3576
|
traverseCollection(collection, options = {}) {
|
|
3620
|
-
return
|
|
3577
|
+
return require_vocab_mod.traverseCollection(collection, {
|
|
3621
3578
|
...options,
|
|
3622
3579
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3623
3580
|
contextLoader: options.contextLoader ?? this.contextLoader
|
|
@@ -3643,9 +3600,8 @@ var ContextImpl = class ContextImpl {
|
|
|
3643
3600
|
});
|
|
3644
3601
|
}
|
|
3645
3602
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
kind: this.federation.outboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
|
3603
|
+
return this.tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
3604
|
+
kind: this.federation.outboxQueue == null || options.immediate ? _opentelemetry_api.SpanKind.CLIENT : _opentelemetry_api.SpanKind.PRODUCER,
|
|
3649
3605
|
attributes: {
|
|
3650
3606
|
"activitypub.activity.type": require_actor.getTypeId(activity).href,
|
|
3651
3607
|
"activitypub.activity.to": activity.toIds.map((to) => to.href),
|
|
@@ -3659,7 +3615,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3659
3615
|
await this.sendActivityInternal(sender, recipients, activity, options, span);
|
|
3660
3616
|
} catch (e) {
|
|
3661
3617
|
span.setStatus({
|
|
3662
|
-
code:
|
|
3618
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3663
3619
|
message: String(e)
|
|
3664
3620
|
});
|
|
3665
3621
|
throw e;
|
|
@@ -3669,7 +3625,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3669
3625
|
});
|
|
3670
3626
|
}
|
|
3671
3627
|
async sendActivityInternal(sender, recipients, activity, options, span) {
|
|
3672
|
-
const logger
|
|
3628
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
3673
3629
|
"fedify",
|
|
3674
3630
|
"federation",
|
|
3675
3631
|
"outbox"
|
|
@@ -3683,7 +3639,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3683
3639
|
if ("username" in sender) username = sender.username;
|
|
3684
3640
|
else {
|
|
3685
3641
|
username = sender.handle;
|
|
3686
|
-
logger
|
|
3642
|
+
logger.warn("The \"handle\" property for the sender parameter is deprecated; use \"identifier\" or \"username\" instead.", { sender });
|
|
3687
3643
|
}
|
|
3688
3644
|
if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
|
|
3689
3645
|
else {
|
|
@@ -3719,7 +3675,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3719
3675
|
for (const activityTransformer of this.federation.activityTransformers) activity = activityTransformer(activity, this);
|
|
3720
3676
|
span?.setAttribute("activitypub.activity.id", activity?.id?.href ?? "");
|
|
3721
3677
|
if (activity.actorId == null) {
|
|
3722
|
-
logger
|
|
3678
|
+
logger.error("Activity {activityId} to send does not have an actor.", {
|
|
3723
3679
|
activity,
|
|
3724
3680
|
activityId: activity?.id?.href
|
|
3725
3681
|
});
|
|
@@ -3730,7 +3686,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3730
3686
|
preferSharedInbox: options.preferSharedInbox,
|
|
3731
3687
|
excludeBaseUris: options.excludeBaseUris
|
|
3732
3688
|
});
|
|
3733
|
-
logger
|
|
3689
|
+
logger.debug("Sending activity {activityId} to inboxes:\n{inboxes}", {
|
|
3734
3690
|
inboxes: globalThis.Object.keys(inboxes),
|
|
3735
3691
|
activityId: activity.id?.href,
|
|
3736
3692
|
activity
|
|
@@ -3744,7 +3700,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3744
3700
|
privateKey: await require_key.exportJwk(privateKey)
|
|
3745
3701
|
})));
|
|
3746
3702
|
const carrier = {};
|
|
3747
|
-
|
|
3703
|
+
_opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
|
|
3748
3704
|
const message = {
|
|
3749
3705
|
type: "fanout",
|
|
3750
3706
|
id: crypto.randomUUID(),
|
|
@@ -3764,7 +3720,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3764
3720
|
traceContext: carrier
|
|
3765
3721
|
};
|
|
3766
3722
|
if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
|
|
3767
|
-
this.federation.fanoutQueue.enqueue(message);
|
|
3723
|
+
await this.federation.fanoutQueue.enqueue(message);
|
|
3768
3724
|
}
|
|
3769
3725
|
async *getFollowers(identifier) {
|
|
3770
3726
|
if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
|
|
@@ -3775,23 +3731,21 @@ var ContextImpl = class ContextImpl {
|
|
|
3775
3731
|
}
|
|
3776
3732
|
if (this.federation.followersCallbacks.firstCursor == null) throw new Error("No first cursor dispatcher registered for followers collection.");
|
|
3777
3733
|
let cursor = await this.federation.followersCallbacks.firstCursor(this, identifier);
|
|
3778
|
-
if (cursor != null) (0,
|
|
3734
|
+
if (cursor != null) (0, _logtape_logtape.getLogger)([
|
|
3779
3735
|
"fedify",
|
|
3780
3736
|
"federation",
|
|
3781
3737
|
"outbox"
|
|
3782
3738
|
]).warn("Since the followers collection dispatcher returned null for no cursor (i.e., one-shot dispatcher), the pagination is used to fetch \"followers\". However, it is recommended to implement the one-shot dispatcher for better performance.", { identifier });
|
|
3783
3739
|
while (cursor != null) {
|
|
3784
|
-
const result
|
|
3785
|
-
if (result
|
|
3786
|
-
for (const recipient of result
|
|
3787
|
-
cursor = result
|
|
3740
|
+
const result = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
|
|
3741
|
+
if (result == null) break;
|
|
3742
|
+
for (const recipient of result.items) yield recipient;
|
|
3743
|
+
cursor = result.nextCursor ?? null;
|
|
3788
3744
|
}
|
|
3789
3745
|
}
|
|
3790
3746
|
routeActivity(recipient, activity, options = {}) {
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
return tracer.startActiveSpan("activitypub.inbox", {
|
|
3794
|
-
kind: this.federation.inboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.INTERNAL : __opentelemetry_api.SpanKind.PRODUCER,
|
|
3747
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.inbox", {
|
|
3748
|
+
kind: this.federation.inboxQueue == null || options.immediate ? _opentelemetry_api.SpanKind.INTERNAL : _opentelemetry_api.SpanKind.PRODUCER,
|
|
3795
3749
|
attributes: { "activitypub.activity.type": require_actor.getTypeId(activity).href }
|
|
3796
3750
|
}, async (span) => {
|
|
3797
3751
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
@@ -3804,11 +3758,11 @@ var ContextImpl = class ContextImpl {
|
|
|
3804
3758
|
if (ok) {
|
|
3805
3759
|
span.setAttribute("activitypub.shared_inbox", recipient == null);
|
|
3806
3760
|
if (recipient != null) span.setAttribute("fedify.inbox.recipient", recipient);
|
|
3807
|
-
} else span.setStatus({ code:
|
|
3761
|
+
} else span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
3808
3762
|
return ok;
|
|
3809
3763
|
} catch (e) {
|
|
3810
3764
|
span.setStatus({
|
|
3811
|
-
code:
|
|
3765
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3812
3766
|
message: String(e)
|
|
3813
3767
|
});
|
|
3814
3768
|
throw e;
|
|
@@ -3818,7 +3772,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3818
3772
|
});
|
|
3819
3773
|
}
|
|
3820
3774
|
async routeActivityInternal(recipient, activity, options = {}, span) {
|
|
3821
|
-
const logger
|
|
3775
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
3822
3776
|
"fedify",
|
|
3823
3777
|
"federation",
|
|
3824
3778
|
"inbox"
|
|
@@ -3826,19 +3780,18 @@ var ContextImpl = class ContextImpl {
|
|
|
3826
3780
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
3827
3781
|
const json = await activity.toJsonLd({ contextLoader });
|
|
3828
3782
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
3829
|
-
|
|
3783
|
+
if (await require_proof.verifyObject(require_actor.Activity, json, {
|
|
3830
3784
|
contextLoader,
|
|
3831
3785
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3832
3786
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
3833
3787
|
keyCache
|
|
3834
|
-
})
|
|
3835
|
-
|
|
3836
|
-
logger$1.debug("Object Integrity Proofs are not verified.", {
|
|
3788
|
+
}) == null) {
|
|
3789
|
+
logger.debug("Object Integrity Proofs are not verified.", {
|
|
3837
3790
|
recipient,
|
|
3838
3791
|
activity: json
|
|
3839
3792
|
});
|
|
3840
3793
|
if (activity.id == null) {
|
|
3841
|
-
logger
|
|
3794
|
+
logger.debug("Activity is missing an ID; unable to fetch.", {
|
|
3842
3795
|
recipient,
|
|
3843
3796
|
activity: json
|
|
3844
3797
|
});
|
|
@@ -3846,26 +3799,26 @@ var ContextImpl = class ContextImpl {
|
|
|
3846
3799
|
}
|
|
3847
3800
|
const fetched = await this.lookupObject(activity.id, options);
|
|
3848
3801
|
if (fetched == null) {
|
|
3849
|
-
logger
|
|
3802
|
+
logger.debug("Failed to fetch the remote activity object {activityId}.", {
|
|
3850
3803
|
recipient,
|
|
3851
3804
|
activity: json,
|
|
3852
3805
|
activityId: activity.id.href
|
|
3853
3806
|
});
|
|
3854
3807
|
return false;
|
|
3855
3808
|
} else if (!(fetched instanceof require_actor.Activity)) {
|
|
3856
|
-
logger
|
|
3809
|
+
logger.debug("Fetched object is not an Activity.", {
|
|
3857
3810
|
recipient,
|
|
3858
3811
|
activity: await fetched.toJsonLd({ contextLoader })
|
|
3859
3812
|
});
|
|
3860
3813
|
return false;
|
|
3861
3814
|
} else if (fetched.id?.href !== activity.id.href) {
|
|
3862
|
-
logger
|
|
3815
|
+
logger.debug("Fetched activity object has a different ID; failed to verify.", {
|
|
3863
3816
|
recipient,
|
|
3864
3817
|
activity: await fetched.toJsonLd({ contextLoader })
|
|
3865
3818
|
});
|
|
3866
3819
|
return false;
|
|
3867
3820
|
} else if (fetched.actorIds.length < 1) {
|
|
3868
|
-
logger
|
|
3821
|
+
logger.debug("Fetched activity object is missing an actor; unable to verify.", {
|
|
3869
3822
|
recipient,
|
|
3870
3823
|
activity: await fetched.toJsonLd({ contextLoader })
|
|
3871
3824
|
});
|
|
@@ -3873,15 +3826,15 @@ var ContextImpl = class ContextImpl {
|
|
|
3873
3826
|
}
|
|
3874
3827
|
const activityId = fetched.id;
|
|
3875
3828
|
if (!fetched.actorIds.every((actor) => actor.origin === activityId.origin)) {
|
|
3876
|
-
logger
|
|
3829
|
+
logger.debug("Fetched activity object has actors from different origins; unable to verify.", {
|
|
3877
3830
|
recipient,
|
|
3878
3831
|
activity: await fetched.toJsonLd({ contextLoader })
|
|
3879
3832
|
});
|
|
3880
3833
|
return false;
|
|
3881
3834
|
}
|
|
3882
|
-
logger
|
|
3835
|
+
logger.debug("Successfully fetched the remote activity object {activityId}; ignore the original activity and use the fetched one, which is trustworthy.");
|
|
3883
3836
|
activity = fetched;
|
|
3884
|
-
} else logger
|
|
3837
|
+
} else logger.debug("Object Integrity Proofs are verified.", {
|
|
3885
3838
|
recipient,
|
|
3886
3839
|
activity: json
|
|
3887
3840
|
});
|
|
@@ -3930,7 +3883,7 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
|
|
|
3930
3883
|
}
|
|
3931
3884
|
async getActor(identifier) {
|
|
3932
3885
|
if (this.federation.actorCallbacks == null || this.federation.actorCallbacks.dispatcher == null) throw new Error("No actor dispatcher registered.");
|
|
3933
|
-
if (this.#invokedFromActorDispatcher != null) (0,
|
|
3886
|
+
if (this.#invokedFromActorDispatcher != null) (0, _logtape_logtape.getLogger)([
|
|
3934
3887
|
"fedify",
|
|
3935
3888
|
"federation",
|
|
3936
3889
|
"actor"
|
|
@@ -3947,7 +3900,7 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
|
|
|
3947
3900
|
const callbacks = this.federation.objectCallbacks[cls.typeId.href];
|
|
3948
3901
|
if (callbacks == null) throw new Error("No object dispatcher registered.");
|
|
3949
3902
|
for (const param of callbacks.parameters) if (!(param in values)) throw new TypeError(`Missing parameter: ${param}`);
|
|
3950
|
-
if (this.#invokedFromObjectDispatcher != null) (0,
|
|
3903
|
+
if (this.#invokedFromObjectDispatcher != null) (0, _logtape_logtape.getLogger)(["fedify", "federation"]).warn("RequestContext.getObject({getObjectClass}, {getObjectValues}) is invoked from the object dispatcher ({actorDispatcherClass}, {actorDispatcherValues}); this may cause an infinite loop.", {
|
|
3951
3904
|
getObjectClass: cls.name,
|
|
3952
3905
|
getObjectValues: values,
|
|
3953
3906
|
actorDispatcherClass: this.#invokedFromObjectDispatcher.cls.name,
|
|
@@ -4007,9 +3960,8 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4007
3960
|
});
|
|
4008
3961
|
}
|
|
4009
3962
|
forwardActivity(forwarder, recipients, options) {
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
kind: this.federation.outboxQueue == null || options?.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
|
3963
|
+
return this.tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.outbox", {
|
|
3964
|
+
kind: this.federation.outboxQueue == null || options?.immediate ? _opentelemetry_api.SpanKind.CLIENT : _opentelemetry_api.SpanKind.PRODUCER,
|
|
4013
3965
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
4014
3966
|
}, async (span) => {
|
|
4015
3967
|
try {
|
|
@@ -4017,7 +3969,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4017
3969
|
await this.forwardActivityInternal(forwarder, recipients, options);
|
|
4018
3970
|
} catch (e) {
|
|
4019
3971
|
span.setStatus({
|
|
4020
|
-
code:
|
|
3972
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
4021
3973
|
message: String(e)
|
|
4022
3974
|
});
|
|
4023
3975
|
throw e;
|
|
@@ -4027,7 +3979,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4027
3979
|
});
|
|
4028
3980
|
}
|
|
4029
3981
|
async forwardActivityInternal(forwarder, recipients, options) {
|
|
4030
|
-
const logger
|
|
3982
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
4031
3983
|
"fedify",
|
|
4032
3984
|
"federation",
|
|
4033
3985
|
"inbox"
|
|
@@ -4041,7 +3993,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4041
3993
|
if ("username" in forwarder) username = forwarder.username;
|
|
4042
3994
|
else {
|
|
4043
3995
|
username = forwarder.handle;
|
|
4044
|
-
logger
|
|
3996
|
+
logger.warn("The \"handle\" property for the forwarder parameter is deprecated; use \"identifier\" or \"username\" instead.", { forwarder });
|
|
4045
3997
|
}
|
|
4046
3998
|
if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
|
|
4047
3999
|
else {
|
|
@@ -4059,14 +4011,13 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4059
4011
|
if (!require_proof.hasSignature(this.activity)) {
|
|
4060
4012
|
let hasProof;
|
|
4061
4013
|
try {
|
|
4062
|
-
|
|
4063
|
-
hasProof = await activity.getProof() != null;
|
|
4014
|
+
hasProof = await (await require_actor.Activity.fromJsonLd(this.activity, this)).getProof() != null;
|
|
4064
4015
|
} catch {
|
|
4065
4016
|
hasProof = false;
|
|
4066
4017
|
}
|
|
4067
4018
|
if (!hasProof) {
|
|
4068
4019
|
if (options?.skipIfUnsigned) return;
|
|
4069
|
-
logger
|
|
4020
|
+
logger.warn("The received activity {activityId} is not signed; even if it is forwarded to other servers as is, it may not be accepted by them due to the lack of a signature/proof.");
|
|
4070
4021
|
}
|
|
4071
4022
|
}
|
|
4072
4023
|
if (recipients === "followers") {
|
|
@@ -4080,14 +4031,14 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4080
4031
|
preferSharedInbox: options?.preferSharedInbox,
|
|
4081
4032
|
excludeBaseUris: options?.excludeBaseUris
|
|
4082
4033
|
});
|
|
4083
|
-
logger
|
|
4034
|
+
logger.debug("Forwarding activity {activityId} to inboxes:\n{inboxes}", {
|
|
4084
4035
|
inboxes: globalThis.Object.keys(inboxes),
|
|
4085
4036
|
activityId: this.activityId,
|
|
4086
4037
|
activity: this.activity
|
|
4087
4038
|
});
|
|
4088
4039
|
if (options?.immediate || this.federation.outboxQueue == null) {
|
|
4089
|
-
if (options?.immediate) logger
|
|
4090
|
-
else logger
|
|
4040
|
+
if (options?.immediate) logger.debug("Forwarding activity immediately without queue since immediate option is set.");
|
|
4041
|
+
else logger.debug("Forwarding activity immediately without queue since queue is not set.");
|
|
4091
4042
|
const promises = [];
|
|
4092
4043
|
for (const inbox in inboxes) promises.push(sendActivity({
|
|
4093
4044
|
keys,
|
|
@@ -4102,7 +4053,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4102
4053
|
await Promise.all(promises);
|
|
4103
4054
|
return;
|
|
4104
4055
|
}
|
|
4105
|
-
logger
|
|
4056
|
+
logger.debug("Enqueuing activity {activityId} to forward later.", {
|
|
4106
4057
|
activityId: this.activityId,
|
|
4107
4058
|
activity: this.activity
|
|
4108
4059
|
});
|
|
@@ -4115,7 +4066,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4115
4066
|
});
|
|
4116
4067
|
}
|
|
4117
4068
|
const carrier = {};
|
|
4118
|
-
|
|
4069
|
+
_opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
|
|
4119
4070
|
const messages = [];
|
|
4120
4071
|
for (const inbox in inboxes) {
|
|
4121
4072
|
const message = {
|
|
@@ -4138,10 +4089,9 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4138
4089
|
const { outboxQueue } = this.federation;
|
|
4139
4090
|
if (outboxQueue.enqueueMany == null) {
|
|
4140
4091
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
4141
|
-
const
|
|
4142
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4092
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4143
4093
|
if (errors.length > 0) {
|
|
4144
|
-
logger
|
|
4094
|
+
logger.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
4145
4095
|
activityId: this.activityId,
|
|
4146
4096
|
errors
|
|
4147
4097
|
});
|
|
@@ -4151,7 +4101,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4151
4101
|
} else try {
|
|
4152
4102
|
await outboxQueue.enqueueMany(messages);
|
|
4153
4103
|
} catch (error) {
|
|
4154
|
-
logger
|
|
4104
|
+
logger.error("Failed to enqueue activity {activityId} to forward later:\n{error}", {
|
|
4155
4105
|
activityId: this.activityId,
|
|
4156
4106
|
error
|
|
4157
4107
|
});
|
|
@@ -4206,87 +4156,84 @@ function unauthorized(_request) {
|
|
|
4206
4156
|
function getRequestId(request) {
|
|
4207
4157
|
const traceId = request.headers.get("X-Request-Id") || request.headers.get("X-Correlation-Id") || request.headers.get("Traceparent")?.split("-")[1];
|
|
4208
4158
|
if (traceId != null) return traceId;
|
|
4209
|
-
|
|
4210
|
-
const random = Math.random().toString(36).slice(2, 8);
|
|
4211
|
-
return `req_${timestamp}${random}`;
|
|
4159
|
+
return `req_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
4212
4160
|
}
|
|
4213
|
-
|
|
4214
4161
|
//#endregion
|
|
4215
|
-
Object.defineProperty(exports,
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4162
|
+
Object.defineProperty(exports, "ContextImpl", {
|
|
4163
|
+
enumerable: true,
|
|
4164
|
+
get: function() {
|
|
4165
|
+
return ContextImpl;
|
|
4166
|
+
}
|
|
4220
4167
|
});
|
|
4221
|
-
Object.defineProperty(exports,
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4168
|
+
Object.defineProperty(exports, "FederationImpl", {
|
|
4169
|
+
enumerable: true,
|
|
4170
|
+
get: function() {
|
|
4171
|
+
return FederationImpl;
|
|
4172
|
+
}
|
|
4226
4173
|
});
|
|
4227
|
-
Object.defineProperty(exports,
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4174
|
+
Object.defineProperty(exports, "InboxContextImpl", {
|
|
4175
|
+
enumerable: true,
|
|
4176
|
+
get: function() {
|
|
4177
|
+
return InboxContextImpl;
|
|
4178
|
+
}
|
|
4232
4179
|
});
|
|
4233
|
-
Object.defineProperty(exports,
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4180
|
+
Object.defineProperty(exports, "KvSpecDeterminer", {
|
|
4181
|
+
enumerable: true,
|
|
4182
|
+
get: function() {
|
|
4183
|
+
return KvSpecDeterminer;
|
|
4184
|
+
}
|
|
4238
4185
|
});
|
|
4239
|
-
Object.defineProperty(exports,
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4186
|
+
Object.defineProperty(exports, "Router", {
|
|
4187
|
+
enumerable: true,
|
|
4188
|
+
get: function() {
|
|
4189
|
+
return Router;
|
|
4190
|
+
}
|
|
4244
4191
|
});
|
|
4245
|
-
Object.defineProperty(exports,
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4192
|
+
Object.defineProperty(exports, "RouterError", {
|
|
4193
|
+
enumerable: true,
|
|
4194
|
+
get: function() {
|
|
4195
|
+
return RouterError;
|
|
4196
|
+
}
|
|
4250
4197
|
});
|
|
4251
|
-
Object.defineProperty(exports,
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4198
|
+
Object.defineProperty(exports, "buildCollectionSynchronizationHeader", {
|
|
4199
|
+
enumerable: true,
|
|
4200
|
+
get: function() {
|
|
4201
|
+
return buildCollectionSynchronizationHeader;
|
|
4202
|
+
}
|
|
4203
|
+
});
|
|
4204
|
+
Object.defineProperty(exports, "createExponentialBackoffPolicy", {
|
|
4205
|
+
enumerable: true,
|
|
4206
|
+
get: function() {
|
|
4207
|
+
return createExponentialBackoffPolicy;
|
|
4208
|
+
}
|
|
4256
4209
|
});
|
|
4257
|
-
Object.defineProperty(exports,
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4210
|
+
Object.defineProperty(exports, "createFederation", {
|
|
4211
|
+
enumerable: true,
|
|
4212
|
+
get: function() {
|
|
4213
|
+
return createFederation;
|
|
4214
|
+
}
|
|
4262
4215
|
});
|
|
4263
|
-
Object.defineProperty(exports,
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4216
|
+
Object.defineProperty(exports, "createFederationBuilder", {
|
|
4217
|
+
enumerable: true,
|
|
4218
|
+
get: function() {
|
|
4219
|
+
return createFederationBuilder;
|
|
4220
|
+
}
|
|
4268
4221
|
});
|
|
4269
|
-
Object.defineProperty(exports,
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4222
|
+
Object.defineProperty(exports, "digest", {
|
|
4223
|
+
enumerable: true,
|
|
4224
|
+
get: function() {
|
|
4225
|
+
return digest;
|
|
4226
|
+
}
|
|
4274
4227
|
});
|
|
4275
|
-
Object.defineProperty(exports,
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4228
|
+
Object.defineProperty(exports, "respondWithObject", {
|
|
4229
|
+
enumerable: true,
|
|
4230
|
+
get: function() {
|
|
4231
|
+
return respondWithObject;
|
|
4232
|
+
}
|
|
4280
4233
|
});
|
|
4281
|
-
Object.defineProperty(exports,
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4234
|
+
Object.defineProperty(exports, "respondWithObjectIfAcceptable", {
|
|
4235
|
+
enumerable: true,
|
|
4236
|
+
get: function() {
|
|
4237
|
+
return respondWithObjectIfAcceptable;
|
|
4238
|
+
}
|
|
4286
4239
|
});
|
|
4287
|
-
Object.defineProperty(exports, 'respondWithObjectIfAcceptable', {
|
|
4288
|
-
enumerable: true,
|
|
4289
|
-
get: function () {
|
|
4290
|
-
return respondWithObjectIfAcceptable;
|
|
4291
|
-
}
|
|
4292
|
-
});
|