@fedify/fedify 1.9.6 → 1.9.8

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.
Files changed (274) hide show
  1. package/dist/{actor-CEGEmRll.js → actor-BTA45fXF.js} +1205 -2768
  2. package/dist/{actor-Ydzhc8dj.d.cts → actor-Be-68iJP.d.cts} +3 -3
  3. package/dist/{actor-C1Euqngb.d.ts → actor-C5AY0Tno.d.ts} +3 -3
  4. package/dist/{actor-DbpZ6pzg.js → actor-DGa1EWaV.mjs} +8 -15
  5. package/dist/{actor-DlS-Q8hE.cjs → actor-DxfJk4lY.cjs} +3112 -4674
  6. package/dist/{assert-MZs1qjMx.js → assert-DikXweDx.mjs} +5 -9
  7. package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
  8. package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
  9. package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-C50x8tnw.mjs} +5 -9
  10. package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
  11. package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-CJC9ThS-.mjs} +6 -11
  12. package/dist/{assert_throws-BOO88avQ.js → assert_throws-BIL7gChy.mjs} +6 -10
  13. package/dist/{authdocloader-DUQcOTRS.js → authdocloader-BC2rYCy1.mjs} +9 -14
  14. package/dist/{authdocloader-CT_V4Z7G.cjs → authdocloader-BrhFB421.cjs} +14 -22
  15. package/dist/{authdocloader-BLqMyboS.js → authdocloader-CqtNsX_N.js} +8 -15
  16. package/dist/{builder-BO61xeXE.js → builder-CIkAhIGC.mjs} +31 -40
  17. package/dist/{client-DF8anIB5.d.ts → client-D8OSiPBT.d.ts} +2 -2
  18. package/dist/{client-UG5wpNhG.js → client-MXqit6c-.mjs} +11 -15
  19. package/dist/{client-DjT_tegg.d.cts → client-T0VFOdMw.d.cts} +2 -2
  20. package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
  21. package/dist/compat/mod.cjs +5 -8
  22. package/dist/compat/mod.d.cts +78 -12
  23. package/dist/compat/mod.d.ts +78 -12
  24. package/dist/compat/mod.js +4 -8
  25. package/dist/compat/transformers.test.mjs +62 -0
  26. package/dist/{context-CwUAkopp.d.cts → context-CACMqDzl.d.cts} +33 -26
  27. package/dist/{context-CXUibY4L.d.ts → context-K4cCphQj.d.ts} +33 -26
  28. package/dist/{denokv-Bv33Xxea.js → denokv-CoSB_Eps.mjs} +22 -11
  29. package/dist/{docloader-BIFI3OS7.cjs → docloader-BVuUhBLI.cjs} +112 -212
  30. package/dist/{docloader-fJgJeqiX.js → docloader-BoXhusJ1.js} +17 -151
  31. package/dist/{docloader-CxWcuWqQ.d.ts → docloader-DSaLRXEA.d.ts} +2 -7
  32. package/dist/{docloader-D-MrRyHl.d.cts → docloader-DpGRDZrn.d.cts} +2 -7
  33. package/dist/{esm-C1EfGjSS.js → esm-BHJ7sdNg.mjs} +49 -85
  34. package/dist/federation/{builder.test.js → builder.test.mjs} +22 -41
  35. package/dist/federation/collection.test.d.mts +2 -0
  36. package/dist/federation/collection.test.mjs +21 -0
  37. package/dist/federation/handler.test.d.mts +2 -0
  38. package/dist/federation/{handler.test.js → handler.test.mjs} +22 -49
  39. package/dist/federation/idempotency.test.d.mts +2 -0
  40. package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +29 -59
  41. package/dist/federation/inbox.test.d.mts +2 -0
  42. package/dist/federation/{inbox.test.js → inbox.test.mjs} +10 -15
  43. package/dist/federation/keycache.test.d.mts +2 -0
  44. package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -18
  45. package/dist/federation/kv.test.d.mts +2 -0
  46. package/dist/federation/{kv.test.js → kv.test.mjs} +9 -20
  47. package/dist/federation/middleware.test.d.mts +2 -0
  48. package/dist/federation/{middleware.test.js → middleware.test.mjs} +182 -197
  49. package/dist/federation/mod.cjs +223 -21
  50. package/dist/federation/mod.d.cts +4 -13
  51. package/dist/federation/mod.d.ts +4 -13
  52. package/dist/federation/mod.js +218 -18
  53. package/dist/federation/mq.test.d.mts +2 -0
  54. package/dist/federation/{mq.test.js → mq.test.mjs} +23 -38
  55. package/dist/federation/retry.test.d.mts +2 -0
  56. package/dist/federation/{retry.test.js → retry.test.mjs} +9 -14
  57. package/dist/federation/router.test.d.mts +2 -0
  58. package/dist/federation/{router.test.js → router.test.mjs} +12 -19
  59. package/dist/federation/send.test.d.mts +2 -0
  60. package/dist/federation/{send.test.js → send.test.mjs} +17 -26
  61. package/dist/{http-wsGR6KkT.d.ts → http-BZpls--H.d.ts} +5 -9
  62. package/dist/{http-CR-Eg1Uq.js → http-Bu5ZNlhZ.mjs} +16 -32
  63. package/dist/{http-B1_DzfAU.d.cts → http-C7WoprmE.d.cts} +5 -9
  64. package/dist/{http-BgopPF-8.cjs → http-DKw-O_VY.cjs} +51 -68
  65. package/dist/{http-05HxN-lp.js → http-VJbz6sKD.js} +17 -33
  66. package/dist/{inbox-DcJN1cxM.js → inbox-DkbTULXE.mjs} +17 -25
  67. package/dist/key-4fu6v0Jf.mjs +5 -0
  68. package/dist/{key-DjS1X9TG.cjs → key-B-wFdaPB.cjs} +42 -50
  69. package/dist/{key-ibMO03_0.js → key-BNMK_IVr.mjs} +12 -18
  70. package/dist/key-CancShOo.cjs +4 -0
  71. package/dist/{key-CPJcJjp-.js → key-DK3o0FEH.js} +19 -19
  72. package/dist/{keycache-CMUfqYqr.js → keycache-D-Vj8z88.mjs} +6 -10
  73. package/dist/{keys-IZ5050fT.js → keys-B27nVeIs.mjs} +6 -10
  74. package/dist/{kv-C7sopW2E.d.ts → kv-Bq9QLKm5.d.ts} +1 -1
  75. package/dist/{kv-CRZrzyXm.js → kv-DM1zFCtL.mjs} +6 -10
  76. package/dist/{kv-63Cil1MD.d.cts → kv-GIrOktyG.d.cts} +1 -1
  77. package/dist/{ld-DHNA2RSQ.js → ld-6jAVu3jV.mjs} +17 -31
  78. package/dist/{lookup-CKZfuyxA.js → lookup-BaU75j-d.js} +5 -11
  79. package/dist/{lookup-C4_dVYz7.cjs → lookup-BiIPmTwB.cjs} +16 -23
  80. package/dist/{lookup-BMAWLsP2.js → lookup-DmeJ8WUw.mjs} +8 -17
  81. package/dist/middleware-9ByEpBvV.cjs +4 -0
  82. package/dist/{middleware-CGbvIGvy.cjs → middleware-C188G4Go.cjs} +494 -547
  83. package/dist/{middleware-DrhEvfTo.js → middleware-Db1yZQaT.mjs} +276 -321
  84. package/dist/{middleware-ODfDRN3q.js → middleware-Do06X21v.js} +349 -393
  85. package/dist/middleware-DrfZEjyc.mjs +5 -0
  86. package/dist/{mod-CDObsV1d.d.ts → mod-BSwc3_rD.d.ts} +3 -3
  87. package/dist/{mod-DBzN0aCM.d.ts → mod-BTNpXcPj.d.ts} +2 -2
  88. package/dist/{mod-fjqfsrty.d.cts → mod-Chb_NKPp.d.cts} +4 -4
  89. package/dist/{mod-DgcYoyZK.d.ts → mod-DHoc3toL.d.ts} +4 -4
  90. package/dist/{mod-jQ4OODsl.d.cts → mod-DIMx6YjJ.d.cts} +2 -2
  91. package/dist/{mod-BUbqxBev.d.cts → mod-HElaq2UB.d.cts} +3 -3
  92. package/dist/mod.cjs +31 -33
  93. package/dist/mod.d.cts +15 -17
  94. package/dist/mod.d.ts +15 -17
  95. package/dist/mod.js +20 -23
  96. package/dist/{mq-B7R1Q-M5.d.cts → mq-CrItclRD.d.cts} +1 -1
  97. package/dist/{mq-CRGm1e_F.d.ts → mq-D_ZZRdby.d.ts} +1 -1
  98. package/dist/nodeinfo/client.test.d.mts +2 -0
  99. package/dist/nodeinfo/{client.test.js → client.test.mjs} +23 -45
  100. package/dist/nodeinfo/handler.test.d.mts +2 -0
  101. package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +14 -43
  102. package/dist/nodeinfo/mod.cjs +5 -9
  103. package/dist/nodeinfo/mod.d.cts +2 -5
  104. package/dist/nodeinfo/mod.d.ts +2 -5
  105. package/dist/nodeinfo/mod.js +4 -9
  106. package/dist/nodeinfo/semver.test.d.mts +2 -0
  107. package/dist/nodeinfo/{semver.test.js → semver.test.mjs} +28 -51
  108. package/dist/nodeinfo/types.test.d.mts +2 -0
  109. package/dist/nodeinfo/{types.test.js → types.test.mjs} +10 -21
  110. package/dist/{owner-DDHsHYQO.js → owner-CKuGt_T9.mjs} +10 -13
  111. package/dist/{owner-BbeUDvOu.d.ts → owner-DPAPnB0R.d.ts} +4 -4
  112. package/dist/{owner-6KSEp9eV.d.cts → owner-_rFs0ik_.d.cts} +4 -4
  113. package/dist/{proof-V1uQaB2y.js → proof-CmTtG_t-.js} +33 -57
  114. package/dist/{proof-CX7ujFFX.cjs → proof-DLOy7HYU.cjs} +112 -135
  115. package/dist/{proof-exgGRW88.js → proof-mJLL2gSA.mjs} +20 -32
  116. package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
  117. package/dist/rolldown-runtime-C7fyD9f2.js +15 -0
  118. package/dist/runtime/authdocloader.test.d.mts +2 -0
  119. package/dist/runtime/{authdocloader.test.js → authdocloader.test.mjs} +16 -28
  120. package/dist/runtime/docloader.test.d.mts +2 -0
  121. package/dist/runtime/{docloader.test.js → docloader.test.mjs} +52 -72
  122. package/dist/runtime/key.test.d.mts +2 -0
  123. package/dist/runtime/{key.test.js → key.test.mjs} +27 -57
  124. package/dist/runtime/langstr.test.d.mts +2 -0
  125. package/dist/runtime/{langstr.test.js → langstr.test.mjs} +9 -19
  126. package/dist/runtime/link.test.d.mts +2 -0
  127. package/dist/runtime/{link.test.js → link.test.mjs} +7 -11
  128. package/dist/runtime/mod.cjs +7 -13
  129. package/dist/runtime/mod.d.cts +103 -6
  130. package/dist/runtime/mod.d.ts +103 -6
  131. package/dist/runtime/mod.js +6 -13
  132. package/dist/runtime/multibase/multibase.test.d.mts +2 -0
  133. package/dist/runtime/multibase/{multibase.test.js → multibase.test.mjs} +16 -33
  134. package/dist/runtime/url.test.d.mts +2 -0
  135. package/dist/runtime/{url.test.js → url.test.mjs} +10 -15
  136. package/dist/{semver-dArNLkR9.js → semver-CgD82xxg.mjs} +13 -28
  137. package/dist/{send-BfMYakUE.js → send-BsQbGuw4.mjs} +7 -12
  138. package/dist/sig/http.test.d.mts +2 -0
  139. package/dist/sig/{http.test.js → http.test.mjs} +119 -203
  140. package/dist/sig/key.test.d.mts +2 -0
  141. package/dist/sig/{key.test.js → key.test.mjs} +13 -22
  142. package/dist/sig/ld.test.d.mts +2 -0
  143. package/dist/sig/{ld.test.js → ld.test.mjs} +24 -39
  144. package/dist/sig/mod.cjs +7 -13
  145. package/dist/sig/mod.d.cts +3 -7
  146. package/dist/sig/mod.d.ts +3 -7
  147. package/dist/sig/mod.js +6 -13
  148. package/dist/sig/owner.test.d.mts +2 -0
  149. package/dist/sig/owner.test.mjs +39 -0
  150. package/dist/sig/proof.test.d.mts +2 -0
  151. package/dist/sig/{proof.test.js → proof.test.mjs} +18 -31
  152. package/dist/{std__assert-X-_kMxKM.js → std__assert-2v7gYiZp.mjs} +13 -24
  153. package/dist/testing/docloader.test.d.mts +2 -0
  154. package/dist/testing/docloader.test.mjs +12 -0
  155. package/dist/testing/{mod.d.ts → mod.d.mts} +371 -541
  156. package/dist/testing/mod.mjs +5 -0
  157. package/dist/{testing-RPOc_gVG.js → testing-DS3gcq8V.mjs} +27 -35
  158. package/dist/{transformers-CoBS-oFG.cjs → transformers-BM0M8hnW.cjs} +20 -25
  159. package/dist/{transformers-BFT6d7J5.js → transformers-BV4OeK9o.js} +3 -7
  160. package/dist/{types-Cptev2nt.js → types-BXfL-dsX.js} +18 -36
  161. package/dist/{types-BIgY6c-l.js → types-CAnkAQGM.mjs} +5 -9
  162. package/dist/{types-CGnM1vft.cjs → types-DpM4FhjW.cjs} +45 -64
  163. package/dist/vocab/actor.test.d.mts +2 -0
  164. package/dist/vocab/{actor.test.js → actor.test.mjs} +308 -550
  165. package/dist/vocab/cjs.test.d.mts +2 -0
  166. package/dist/vocab/cjs.test.mjs +14 -0
  167. package/dist/vocab/lookup.test.d.mts +2 -0
  168. package/dist/vocab/{lookup.test.js → lookup.test.mjs} +29 -45
  169. package/dist/vocab/mod.cjs +251 -16
  170. package/dist/vocab/mod.d.cts +3 -5
  171. package/dist/vocab/mod.d.ts +3 -5
  172. package/dist/vocab/mod.js +244 -10
  173. package/dist/vocab/type.test.d.mts +2 -0
  174. package/dist/vocab/type.test.mjs +16 -0
  175. package/dist/vocab/vocab.test.d.mts +2 -0
  176. package/dist/vocab/{vocab.test.js → vocab.test.mjs} +178 -311
  177. package/dist/{vocab-CDHNj5zp.d.ts → vocab-BLvSEtuz.d.cts} +2 -4
  178. package/dist/{type-COPv6pMi.js → vocab-DuW9rL1h.mjs} +1177 -2871
  179. package/dist/{vocab-Cfs0937i.d.cts → vocab-lhCS9lzq.d.ts} +4 -2
  180. package/dist/webfinger/handler.test.d.mts +2 -0
  181. package/dist/webfinger/{handler.test.js → handler.test.mjs} +23 -56
  182. package/dist/webfinger/lookup.test.d.mts +2 -0
  183. package/dist/webfinger/{lookup.test.js → lookup.test.mjs} +13 -27
  184. package/dist/webfinger/mod.cjs +5 -9
  185. package/dist/webfinger/mod.d.cts +1 -3
  186. package/dist/webfinger/mod.d.ts +1 -3
  187. package/dist/webfinger/mod.js +4 -9
  188. package/dist/x/cfworkers.cjs +25 -14
  189. package/dist/x/cfworkers.d.cts +33 -6
  190. package/dist/x/cfworkers.d.ts +33 -6
  191. package/dist/x/cfworkers.js +22 -12
  192. package/dist/x/cfworkers.test.d.mts +2 -0
  193. package/dist/x/{cfworkers.test.js → cfworkers.test.mjs} +28 -26
  194. package/dist/x/hono.cjs +25 -14
  195. package/dist/x/hono.d.cts +1 -11
  196. package/dist/x/hono.d.ts +1 -11
  197. package/dist/x/hono.js +22 -12
  198. package/dist/x/sveltekit.cjs +23 -12
  199. package/dist/x/sveltekit.d.cts +1 -11
  200. package/dist/x/sveltekit.d.ts +1 -11
  201. package/dist/x/sveltekit.js +20 -10
  202. package/package.json +2 -2
  203. package/dist/chunk-DqRYRqnO.cjs +0 -34
  204. package/dist/compat/transformers.test.d.ts +0 -3
  205. package/dist/compat/transformers.test.js +0 -86
  206. package/dist/compat-DmDDELst.cjs +0 -4
  207. package/dist/compat-nxUqe4Z-.js +0 -4
  208. package/dist/federation/builder.test.d.ts +0 -3
  209. package/dist/federation/collection.test.d.ts +0 -3
  210. package/dist/federation/collection.test.js +0 -35
  211. package/dist/federation/handler.test.d.ts +0 -3
  212. package/dist/federation/idempotency.test.d.ts +0 -3
  213. package/dist/federation/inbox.test.d.ts +0 -3
  214. package/dist/federation/keycache.test.d.ts +0 -3
  215. package/dist/federation/kv.test.d.ts +0 -3
  216. package/dist/federation/middleware.test.d.ts +0 -3
  217. package/dist/federation/mq.test.d.ts +0 -3
  218. package/dist/federation/retry.test.d.ts +0 -3
  219. package/dist/federation/router.test.d.ts +0 -3
  220. package/dist/federation/send.test.d.ts +0 -3
  221. package/dist/federation-D1U8YY9t.js +0 -226
  222. package/dist/federation-H2_En3j5.cjs +0 -244
  223. package/dist/key-BCUd8FWp.js +0 -10
  224. package/dist/key-BUardnTH.cjs +0 -10
  225. package/dist/key-Dr6H_e3K.js +0 -10
  226. package/dist/middleware-BJ83veqi.js +0 -26
  227. package/dist/middleware-CJ4W2ir5.cjs +0 -17
  228. package/dist/middleware-Ve2mHJgo.js +0 -17
  229. package/dist/mod-BcObK1Lz.d.ts +0 -82
  230. package/dist/mod-C2tOeRkN.d.cts +0 -1
  231. package/dist/mod-CIbqfZW0.d.ts +0 -104
  232. package/dist/mod-Dt-G9ZOS.d.cts +0 -102
  233. package/dist/mod-FZd39qVq.d.cts +0 -1
  234. package/dist/mod-mXx9V0q5.d.cts +0 -80
  235. package/dist/nodeinfo/client.test.d.ts +0 -3
  236. package/dist/nodeinfo/handler.test.d.ts +0 -3
  237. package/dist/nodeinfo/semver.test.d.ts +0 -3
  238. package/dist/nodeinfo/types.test.d.ts +0 -3
  239. package/dist/nodeinfo-Co9lJrWl.cjs +0 -4
  240. package/dist/nodeinfo-DfycQ8Wf.js +0 -4
  241. package/dist/runtime/authdocloader.test.d.ts +0 -3
  242. package/dist/runtime/docloader.test.d.ts +0 -3
  243. package/dist/runtime/key.test.d.ts +0 -3
  244. package/dist/runtime/langstr.test.d.ts +0 -3
  245. package/dist/runtime/link.test.d.ts +0 -3
  246. package/dist/runtime/multibase/multibase.test.d.ts +0 -3
  247. package/dist/runtime/url.test.d.ts +0 -3
  248. package/dist/runtime-C58AJWSv.cjs +0 -4
  249. package/dist/runtime-DPYEDf-o.js +0 -4
  250. package/dist/sig/http.test.d.ts +0 -3
  251. package/dist/sig/key.test.d.ts +0 -3
  252. package/dist/sig/ld.test.d.ts +0 -3
  253. package/dist/sig/owner.test.d.ts +0 -3
  254. package/dist/sig/owner.test.js +0 -52
  255. package/dist/sig/proof.test.d.ts +0 -3
  256. package/dist/sig-ByHXzqUi.cjs +0 -4
  257. package/dist/sig-Cj3tk-ig.js +0 -4
  258. package/dist/testing/docloader.test.d.ts +0 -3
  259. package/dist/testing/docloader.test.js +0 -24
  260. package/dist/testing/mod.js +0 -10
  261. package/dist/vocab/actor.test.d.ts +0 -3
  262. package/dist/vocab/lookup.test.d.ts +0 -3
  263. package/dist/vocab/type.test.d.ts +0 -3
  264. package/dist/vocab/type.test.js +0 -25
  265. package/dist/vocab/vocab.test.d.ts +0 -3
  266. package/dist/vocab-BFy1CS5L.cjs +0 -289
  267. package/dist/vocab-BPFiQ650.js +0 -253
  268. package/dist/webfinger/handler.test.d.ts +0 -3
  269. package/dist/webfinger/lookup.test.d.ts +0 -3
  270. package/dist/webfinger-BjOEdFPs.cjs +0 -4
  271. package/dist/webfinger-De_bU0iE.js +0 -4
  272. package/dist/x/cfworkers.test.d.ts +0 -3
  273. /package/dist/{mod-1pDWKvUL.d.ts → compat/transformers.test.d.mts} +0 -0
  274. /package/dist/{mod-g0xFzAP9.d.ts → federation/builder.test.d.mts} +0 -0
@@ -1,27 +1,23 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
5
- const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
- const require_transformers = require('./transformers-CoBS-oFG.cjs');
7
- const require_docloader = require('./docloader-BIFI3OS7.cjs');
8
- const require_actor = require('./actor-DlS-Q8hE.cjs');
9
- const require_lookup = require('./lookup-C4_dVYz7.cjs');
10
- const require_key = require('./key-DjS1X9TG.cjs');
11
- const require_http = require('./http-BgopPF-8.cjs');
12
- const require_proof = require('./proof-CX7ujFFX.cjs');
13
- const require_types = require('./types-CGnM1vft.cjs');
14
- const require_authdocloader = require('./authdocloader-CT_V4Z7G.cjs');
15
- const require_vocab = require('./vocab-BFy1CS5L.cjs');
16
- const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
17
- const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
18
- const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
19
- const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
20
- const uri_template_router = require_chunk.__toESM(require("uri-template-router"));
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-BVuUhBLI.cjs");
4
+ const require_transformers = require("./transformers-BM0M8hnW.cjs");
5
+ const require_actor = require("./actor-DxfJk4lY.cjs");
6
+ const require_lookup = require("./lookup-BiIPmTwB.cjs");
7
+ const require_key = require("./key-B-wFdaPB.cjs");
8
+ const require_http = require("./http-DKw-O_VY.cjs");
9
+ const require_proof = require("./proof-DLOy7HYU.cjs");
10
+ const require_types = require("./types-DpM4FhjW.cjs");
11
+ const require_authdocloader = require("./authdocloader-BrhFB421.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$1 = (0, __logtape_logtape.getLogger)([
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$1.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().");
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
- const result = await strategy(inboxContext, activity);
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
- const cached = await kv.get(cacheKey);
94
- if (cached === true) {
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: __opentelemetry_api.SpanStatusCode.UNSET,
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$1.error("Missing actor.", { activity: json });
101
+ logger.error("Missing actor.", { activity: json });
109
102
  span.setStatus({
110
- code: __opentelemetry_api.SpanStatusCode.ERROR,
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
- __opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
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$1.error("Failed to enqueue the incoming activity {activityId}:\n{error}", {
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$1.info("Activity {activityId} is enqueued.", {
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 ?? __opentelemetry_api.trace.getTracerProvider();
151
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
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$1.error("Unsupported activity type:\n{activity}", {
147
+ logger.error("Unsupported activity type:\n{activity}", {
156
148
  activity: json,
157
149
  recipient
158
150
  });
159
- span$1.setStatus({
160
- code: __opentelemetry_api.SpanStatusCode.UNSET,
151
+ span.setStatus({
152
+ code: _opentelemetry_api.SpanStatusCode.UNSET,
161
153
  message: `Unsupported activity type: ${require_actor.getTypeId(activity).href}`
162
154
  });
163
- span$1.end();
155
+ span.end();
164
156
  return "unsupportedActivity";
165
157
  }
166
158
  const { class: cls, listener } = dispatched;
167
- span$1.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
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$1) {
174
- logger$1.error("An unexpected error occurred in inbox error handler:\n{error}", {
175
- error: error$1,
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$1.error("Failed to process the incoming activity {activityId}:\n{error}", {
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$1.setStatus({
188
- code: __opentelemetry_api.SpanStatusCode.ERROR,
179
+ span.setStatus({
180
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
189
181
  message: String(error)
190
182
  });
191
- span$1.end();
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$1.info("Activity {activityId} has been processed.", {
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$1.end();
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: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-CJ4W2ir5.cjs"));
349
- const f = new FederationImpl$1(options);
338
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-9ByEpBvV.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 __opentelemetry_api.trace.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
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, __logtape_logtape.getLogger)([
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$2, identifier) => {
375
+ const callbacks = { dispatcher: async (context, identifier) => {
386
376
  const actor = await this._getTracer().startActiveSpan("activitypub.dispatch_actor", {
387
- kind: __opentelemetry_api.SpanKind.SERVER,
377
+ kind: _opentelemetry_api.SpanKind.SERVER,
388
378
  attributes: { "fedify.actor.identifier": identifier }
389
379
  }, async (span) => {
390
380
  try {
391
- const actor$1 = await dispatcher(context$2, identifier);
392
- span.setAttribute("activitypub.actor.id", (actor$1?.id ?? context$2.getActorUri(identifier)).href);
393
- if (actor$1 == null) span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
394
- else span.setAttribute("activitypub.actor.type", require_actor.getTypeId(actor$1).href);
395
- return actor$1;
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$1 = (0, __logtape_logtape.getLogger)([
397
+ const logger = (0, _logtape_logtape.getLogger)([
408
398
  "fedify",
409
399
  "federation",
410
400
  "actor"
411
401
  ]);
412
- if (actor.id == null) logger$1.warn("Actor dispatcher returned an actor without an id property. Set the property with Context.getActorUri(identifier).");
413
- else if (actor.id.href != context$2.getActorUri(identifier).href) logger$1.warn("Actor dispatcher returned an actor with an id property that does not match the actor URI. Set the property with Context.getActorUri(identifier).");
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$1.warn("You configured a following collection dispatcher, but the actor does not have a following property. Set the property with Context.getFollowingUri(identifier).");
416
- else if (actor.followingId.href != context$2.getFollowingUri(identifier).href) logger$1.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).");
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$1.warn("You configured a followers collection dispatcher, but the actor does not have a followers property. Set the property with Context.getFollowersUri(identifier).");
420
- else if (actor.followersId.href != context$2.getFollowersUri(identifier).href) logger$1.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).");
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$1.warn("You configured an outbox collection dispatcher, but the actor does not have an outbox property. Set the property with Context.getOutboxUri(identifier).");
424
- else if (actor.outboxId.href != context$2.getOutboxUri(identifier).href) logger$1.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).");
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$1.warn("You configured a liked collection dispatcher, but the actor does not have a liked property. Set the property with Context.getLikedUri(identifier).");
428
- else if (actor.likedId.href != context$2.getLikedUri(identifier).href) logger$1.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).");
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$1.warn("You configured a featured collection dispatcher, but the actor does not have a featured property. Set the property with Context.getFeaturedUri(identifier).");
432
- else if (actor.featuredId.href != context$2.getFeaturedUri(identifier).href) logger$1.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).");
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$1.warn("You configured a featured tags collection dispatcher, but the actor does not have a featuredTags property. Set the property with Context.getFeaturedTagsUri(identifier).");
436
- else if (actor.featuredTagsId.href != context$2.getFeaturedTagsUri(identifier).href) logger$1.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).");
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$1.warn("You configured inbox listeners, but the actor does not have an inbox property. Set the property with Context.getInboxUri(identifier).");
440
- else if (actor.inboxId.href != context$2.getInboxUri(identifier).href) logger$1.warn("You configured inbox listeners, but the actor's inbox property does not match the inbox URI. Set the property with Context.getInboxUri(identifier).");
441
- if (actor.endpoints == null || actor.endpoints.sharedInbox == null) logger$1.warn("You configured inbox listeners, but the actor does not have a endpoints.sharedInbox property. Set the property with Context.getInboxUri().");
442
- else if (actor.endpoints.sharedInbox.href != context$2.getInboxUri().href) logger$1.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().");
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$1.warn("You configured a key pairs dispatcher, but the actor does not have a publicKey property. Set the property with Context.getActorKeyPairs(identifier).");
446
- if (actor.assertionMethodId == null) logger$1.warn("You configured a key pairs dispatcher, but the actor does not have an assertionMethod property. Set the property with Context.getActorKeyPairs(identifier).");
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$1) => {
442
+ setKeyPairsDispatcher: (dispatcher) => {
453
443
  callbacks.keyPairsDispatcher = (ctx, identifier) => this._getTracer().startActiveSpan("activitypub.dispatch_actor_key_pairs", {
454
- kind: __opentelemetry_api.SpanKind.SERVER,
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$1(ctx, identifier);
451
+ return await dispatcher(ctx, identifier);
462
452
  } catch (e) {
463
453
  span.setStatus({
464
- code: __opentelemetry_api.SpanStatusCode.ERROR,
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
- const variables = this.router.add(path, "nodeInfo");
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
- const tracer = this._getTracer();
506
- return tracer.startActiveSpan("activitypub.dispatch_object", {
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: __opentelemetry_api.SpanStatusCode.ERROR });
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: __opentelemetry_api.SpanStatusCode.ERROR,
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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, __logtape_logtape.getLogger)([
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
- const siVars = this.router.add(sharedInboxPath, "sharedInbox");
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
- const variables = this.router.add(path, routeName);
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
- const path = this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
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$1 = new Uint8Array(await crypto.subtle.digest("SHA-256", encoded));
892
- for (let i = 0; i < 32; i++) result[i] ^= digest$1[i];
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
- const hash = (0, byte_encodings_hex.encodeHex)(await digest(actorIds));
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 void 0;
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$1] of accepts.entries()) {
1008
- const mediaType = parseMediaType(accept$1.trim(), index);
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
- const accepts = parseAccept(accept === void 0 ? "*/*" : accept ?? "");
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: context$2, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
1038
- const logger$1 = (0, __logtape_logtape.getLogger)([
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$1.debug("Actor dispatcher is not set.", { identifier });
1023
+ logger.debug("Actor dispatcher is not set.", { identifier });
1045
1024
  return await onNotFound(request);
1046
1025
  }
1047
- const actor = await actorDispatcher(context$2, identifier);
1026
+ const actor = await actorDispatcher(context, identifier);
1048
1027
  if (actor == null) {
1049
- logger$1.debug("Actor {identifier} not found.", { identifier });
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$2.getSignedKey();
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$2.getSignedKeyOwner();
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$2, identifier, key, keyOwner)) return await onUnauthorized(request);
1051
+ if (!await authorizePredicate(context, identifier, key, keyOwner)) return await onUnauthorized(request);
1073
1052
  }
1074
- const jsonLd = await actor.toJsonLd(context$2);
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: context$2, objectDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
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$2, values);
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$2.getSignedKey();
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$2.getSignedKeyOwner();
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$2, values, key, keyOwner)) return await onUnauthorized(request);
1090
+ if (!await authorizePredicate(context, values, key, keyOwner)) return await onUnauthorized(request);
1112
1091
  }
1113
- const jsonLd = await object.toJsonLd(context$2);
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: context$2, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
1130
- const spanName = name.trim().replace(/\s+/g, "_");
1131
- tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
1132
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
1133
- const url = new URL(request.url);
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$2, identifier);
1140
- const totalItems = filter == null ? await collectionCallbacks.counter?.(context$2, identifier) : void 0;
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: __opentelemetry_api.SpanKind.SERVER,
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$2, identifier, null, filter);
1129
+ const page = await collectionCallbacks.dispatcher(context, identifier, null, filter);
1152
1130
  if (page == null) {
1153
- span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$2, identifier);
1177
- const first = new URL(context$2.url);
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$2.url);
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: __opentelemetry_api.SpanKind.SERVER,
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$2, identifier, cursor, filter);
1181
+ const page = await collectionCallbacks.dispatcher(context, identifier, cursor, filter);
1204
1182
  if (page == null) {
1205
- span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$2.url);
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$2.url);
1207
+ next = new URL(context.url);
1230
1208
  next.searchParams.set("cursor", nextCursor);
1231
1209
  }
1232
- const partOf = new URL(context$2.url);
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$2.getSignedKey();
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$2.getSignedKeyOwner();
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$2, identifier, key, keyOwner)) return await onUnauthorized(request);
1240
+ if (!await collectionCallbacks.authorizePredicate(context, identifier, key, keyOwner)) return await onUnauthorized(request);
1263
1241
  }
1264
- const jsonLd = await collection.toJsonLd(context$2);
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, __logtape_logtape.getLogger)([
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
- const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
1310
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$1 = (0, __logtape_logtape.getLogger)([
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$1.error("Actor dispatcher is not set.", { recipient });
1321
+ logger.error("Actor dispatcher is not set.", { recipient });
1346
1322
  span.setStatus({
1347
- code: __opentelemetry_api.SpanStatusCode.ERROR,
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
- const actor = await actorDispatcher(ctx, recipient);
1353
- if (actor == null) {
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$1.error("Request body has already been read.", { recipient });
1338
+ logger.error("Request body has already been read.", { recipient });
1364
1339
  span.setStatus({
1365
- code: __opentelemetry_api.SpanStatusCode.ERROR,
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$1.error("Request body is locked.", { recipient });
1348
+ logger.error("Request body is locked.", { recipient });
1374
1349
  span.setStatus({
1375
- code: __opentelemetry_api.SpanStatusCode.ERROR,
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$1.error("Failed to parse JSON:\n{error}", {
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$1) {
1394
- logger$1.error("An unexpected error occurred in inbox error handler:\n{error}", {
1395
- error: error$1,
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$1.error("Failed to parse JSON-LD:\n{error}", {
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$1.debug("Linked Data Signatures are verified.", {
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$1.debug("Linked Data Signatures are not verified.", {
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$1.error("Failed to parse activity:\n{error}", {
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$1) {
1460
- logger$1.error("An unexpected error occurred in inbox error handler:\n{error}", {
1461
- error: error$1,
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: __opentelemetry_api.SpanStatusCode.ERROR,
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$1.debug("Object Integrity Proofs are not verified.", {
1450
+ if (activity == null) logger.debug("Object Integrity Proofs are not verified.", {
1476
1451
  recipient,
1477
1452
  activity: json
1478
1453
  });
1479
- else logger$1.debug("Object Integrity Proofs are verified.", {
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$1.error("Failed to verify the request's HTTP Signatures.", { recipient });
1470
+ logger.error("Failed to verify the request's HTTP Signatures.", { recipient });
1496
1471
  span.setStatus({
1497
- code: __opentelemetry_api.SpanStatusCode.ERROR,
1472
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
1498
1473
  message: `Failed to verify the request's HTTP Signatures.`
1499
1474
  });
1500
- const response = new Response("Failed to verify the request signature.", {
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
- return response;
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);
@@ -1510,14 +1484,14 @@ async function handleInboxInternal(request, parameters, span) {
1510
1484
  if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
1511
1485
  span.setAttribute("activitypub.activity.type", require_actor.getTypeId(activity).href);
1512
1486
  if (httpSigKey != null && !await require_proof.doesActorOwnKey(activity, httpSigKey, ctx)) {
1513
- logger$1.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
1487
+ logger.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
1514
1488
  activity: json,
1515
1489
  recipient,
1516
1490
  keyId: httpSigKey.id?.href,
1517
1491
  actorId: activity.actorId?.href
1518
1492
  });
1519
1493
  span.setStatus({
1520
- code: __opentelemetry_api.SpanStatusCode.ERROR,
1494
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
1521
1495
  message: `The signer (${httpSigKey.id?.href}) and the actor (${activity.actorId?.href}) do not match.`
1522
1496
  });
1523
1497
  return new Response("The signer and the actor do not match.", {
@@ -1577,12 +1551,12 @@ async function handleInboxInternal(request, parameters, span) {
1577
1551
  * @since 1.8.0
1578
1552
  */
1579
1553
  const handleCustomCollection = exceptWrapper(_handleCustomCollection);
1580
- async function _handleCustomCollection(request, { name, values, context: context$2, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1554
+ async function _handleCustomCollection(request, { name, values, context, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1581
1555
  verifyDefined(callbacks);
1582
1556
  verifyJsonLdRequest(request);
1583
- await authIfNeeded(context$2, values, callbacks);
1557
+ await authIfNeeded(context, values, callbacks);
1584
1558
  const cursor = new URL(request.url).searchParams.get("cursor");
1585
- return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider, require_actor.Collection, require_actor.CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
1559
+ return await new CustomCollectionHandler(name, values, context, callbacks, tracerProvider, require_actor.Collection, require_actor.CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
1586
1560
  }
1587
1561
  /**
1588
1562
  * Handles an ordered collection request.
@@ -1596,12 +1570,12 @@ async function _handleCustomCollection(request, { name, values, context: context
1596
1570
  * @since 1.8.0
1597
1571
  */
1598
1572
  const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
1599
- async function _handleOrderedCollection(request, { name, values, context: context$2, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1573
+ async function _handleOrderedCollection(request, { name, values, context, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1600
1574
  verifyDefined(callbacks);
1601
1575
  verifyJsonLdRequest(request);
1602
- await authIfNeeded(context$2, values, callbacks);
1576
+ await authIfNeeded(context, values, callbacks);
1603
1577
  const cursor = new URL(request.url).searchParams.get("cursor");
1604
- return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider, require_actor.OrderedCollection, require_actor.OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
1578
+ return await new CustomCollectionHandler(name, values, context, callbacks, tracerProvider, require_actor.OrderedCollection, require_actor.OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
1605
1579
  }
1606
1580
  /**
1607
1581
  * Handling custom collections with support for pagination and filtering.
@@ -1651,17 +1625,17 @@ var CustomCollectionHandler = class {
1651
1625
  * @param CollectionPage The CollectionPage constructor.
1652
1626
  * @param filterPredicate Optional filter predicate for items.
1653
1627
  */
1654
- constructor(name, values, context$2, callbacks, tracerProvider = __opentelemetry_api.trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
1655
- this.name = name;
1628
+ constructor(name$1, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), Collection, CollectionPage, filterPredicate) {
1629
+ this.name = name$1;
1656
1630
  this.values = values;
1657
- this.context = context$2;
1631
+ this.context = context;
1658
1632
  this.callbacks = callbacks;
1659
1633
  this.tracerProvider = tracerProvider;
1660
- this.Collection = Collection$1;
1661
- this.CollectionPage = CollectionPage$1;
1634
+ this.Collection = Collection;
1635
+ this.CollectionPage = CollectionPage;
1662
1636
  this.filterPredicate = filterPredicate;
1663
1637
  this.name = this.name.trim().replace(/\s+/g, "_");
1664
- this.#tracer = this.tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
1638
+ this.#tracer = this.tracerProvider.getTracer(require_docloader.name, require_docloader.version);
1665
1639
  this.#id = new URL(this.context.url);
1666
1640
  this.#dispatcher = callbacks.dispatcher.bind(callbacks);
1667
1641
  }
@@ -1690,8 +1664,8 @@ var CustomCollectionHandler = class {
1690
1664
  */
1691
1665
  async getCollection(cursor = null) {
1692
1666
  if (cursor !== null) {
1693
- const props$1 = await this.getPageProps(cursor);
1694
- return new this.CollectionPage(props$1);
1667
+ const props = await this.getPageProps(cursor);
1668
+ return new this.CollectionPage(props);
1695
1669
  }
1696
1670
  const firstCursor = await this.firstCursor;
1697
1671
  const props = typeof firstCursor === "string" ? await this.getProps(firstCursor) : await this.getPropsWithoutCursor();
@@ -1752,7 +1726,7 @@ var CustomCollectionHandler = class {
1752
1726
  * @returns A promise that resolves to the page items.
1753
1727
  */
1754
1728
  async getPages({ cursor = null, totalItems = null }) {
1755
- return await this.#tracer.startActiveSpan(`${this.ATTRS.DISPATCH_COLLECTION} ${this.name}`, this.spanOptions(__opentelemetry_api.SpanKind.SERVER, cursor), this.spanPages({
1729
+ return await this.#tracer.startActiveSpan(`${this.ATTRS.DISPATCH_COLLECTION} ${this.name}`, this.spanOptions(_opentelemetry_api.SpanKind.SERVER, cursor), this.spanPages({
1756
1730
  cursor,
1757
1731
  totalItems
1758
1732
  }));
@@ -1785,7 +1759,7 @@ var CustomCollectionHandler = class {
1785
1759
  } catch (e) {
1786
1760
  const message = e instanceof Error ? e.message : String(e);
1787
1761
  span.setStatus({
1788
- code: __opentelemetry_api.SpanStatusCode.ERROR,
1762
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
1789
1763
  message
1790
1764
  });
1791
1765
  throw e;
@@ -1839,7 +1813,7 @@ var CustomCollectionHandler = class {
1839
1813
  * @param value The total items count or a promise that resolves to it.
1840
1814
  */
1841
1815
  set totalItems(value) {
1842
- const toNumber = (value$1) => value$1 == null ? null : Number(value$1);
1816
+ const toNumber = (value) => value == null ? null : Number(value);
1843
1817
  this.#totalItems = value instanceof Promise ? value.then(toNumber) : Promise.resolve(toNumber(value));
1844
1818
  }
1845
1819
  /**
@@ -1913,11 +1887,9 @@ const verifyJsonLdRequest = (request) => {
1913
1887
  * @throws {UnauthorizedError} If authorization fails.
1914
1888
  * @since 1.8.0
1915
1889
  */
1916
- const authIfNeeded = async (context$2, values, { authorizePredicate: authorize = void 0 }) => {
1890
+ const authIfNeeded = async (context, values, { authorizePredicate: authorize = void 0 }) => {
1917
1891
  if (authorize === void 0) return;
1918
- const key = (await context$2.getSignedKey())?.clone({}, warning.key) ?? null;
1919
- const keyOwner = (await context$2.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
1920
- if (!await authorize(context$2, values, key, keyOwner)) throw new UnauthorizedError();
1892
+ if (!await authorize(context, values, (await context.getSignedKey())?.clone({}, warning.key) ?? null, (await context.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null)) throw new UnauthorizedError();
1921
1893
  };
1922
1894
  /** Warning messages for `authIfNeeded`. */
1923
1895
  const warning = {
@@ -2031,7 +2003,6 @@ async function respondWithObjectIfAcceptable(object, request, options) {
2031
2003
  response.headers.set("Vary", "Accept");
2032
2004
  return response;
2033
2005
  }
2034
-
2035
2006
  //#endregion
2036
2007
  //#region src/nodeinfo/handler.ts
2037
2008
  /**
@@ -2041,10 +2012,9 @@ async function respondWithObjectIfAcceptable(object, request, options) {
2041
2012
  * @param parameters The parameters for handling the request.
2042
2013
  * @returns The response to the request.
2043
2014
  */
2044
- async function handleNodeInfo(_request, { context: context$2, nodeInfoDispatcher }) {
2045
- const promise = nodeInfoDispatcher(context$2);
2046
- const nodeInfo = promise instanceof Promise ? await promise : promise;
2047
- const json = require_types.nodeInfoToJson(nodeInfo);
2015
+ async function handleNodeInfo(_request, { context, nodeInfoDispatcher }) {
2016
+ const promise = nodeInfoDispatcher(context);
2017
+ const json = require_types.nodeInfoToJson(promise instanceof Promise ? await promise : promise);
2048
2018
  return new Response(JSON.stringify(json), { headers: { "Content-Type": "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\"" } });
2049
2019
  }
2050
2020
  /**
@@ -2054,25 +2024,23 @@ async function handleNodeInfo(_request, { context: context$2, nodeInfoDispatcher
2054
2024
  * @param context The request context.
2055
2025
  * @returns The response to the request.
2056
2026
  */
2057
- function handleNodeInfoJrd(_request, context$2) {
2027
+ function handleNodeInfoJrd(_request, context) {
2058
2028
  const links = [];
2059
2029
  try {
2060
2030
  links.push({
2061
2031
  rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
2062
- href: context$2.getNodeInfoUri().href,
2032
+ href: context.getNodeInfoUri().href,
2063
2033
  type: "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\""
2064
2034
  });
2065
2035
  } catch (e) {
2066
2036
  if (!(e instanceof RouterError)) throw e;
2067
2037
  }
2068
- const jrd = { links };
2069
- const response = new Response(JSON.stringify(jrd), { headers: { "Content-Type": "application/jrd+json" } });
2038
+ const response = new Response(JSON.stringify({ links }), { headers: { "Content-Type": "application/jrd+json" } });
2070
2039
  return Promise.resolve(response);
2071
2040
  }
2072
-
2073
2041
  //#endregion
2074
2042
  //#region src/webfinger/handler.ts
2075
- const logger = (0, __logtape_logtape.getLogger)([
2043
+ const logger = (0, _logtape_logtape.getLogger)([
2076
2044
  "fedify",
2077
2045
  "webfinger",
2078
2046
  "server"
@@ -2086,14 +2054,14 @@ const logger = (0, __logtape_logtape.getLogger)([
2086
2054
  */
2087
2055
  async function handleWebFinger(request, options) {
2088
2056
  if (options.tracer == null) return await handleWebFingerInternal(request, options);
2089
- return await options.tracer.startActiveSpan("webfinger.handle", { kind: __opentelemetry_api.SpanKind.SERVER }, async (span) => {
2057
+ return await options.tracer.startActiveSpan("webfinger.handle", { kind: _opentelemetry_api.SpanKind.SERVER }, async (span) => {
2090
2058
  try {
2091
2059
  const response = await handleWebFingerInternal(request, options);
2092
- span.setStatus({ code: response.ok ? __opentelemetry_api.SpanStatusCode.UNSET : __opentelemetry_api.SpanStatusCode.ERROR });
2060
+ span.setStatus({ code: response.ok ? _opentelemetry_api.SpanStatusCode.UNSET : _opentelemetry_api.SpanStatusCode.ERROR });
2093
2061
  return response;
2094
2062
  } catch (error) {
2095
2063
  span.setStatus({
2096
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2064
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2097
2065
  message: String(error)
2098
2066
  });
2099
2067
  throw error;
@@ -2102,12 +2070,12 @@ async function handleWebFinger(request, options) {
2102
2070
  }
2103
2071
  });
2104
2072
  }
2105
- async function handleWebFingerInternal(request, { context: context$2, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
2073
+ async function handleWebFingerInternal(request, { context, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
2106
2074
  if (actorDispatcher == null) {
2107
2075
  logger.error("Actor dispatcher is not set.");
2108
2076
  return await onNotFound(request);
2109
2077
  }
2110
- const resource = context$2.url.searchParams.get("resource");
2078
+ const resource = context.url.searchParams.get("resource");
2111
2079
  if (resource == null) return new Response("Missing resource parameter.", { status: 400 });
2112
2080
  span?.setAttribute("webfinger.resource", resource);
2113
2081
  let resourceUrl;
@@ -2123,26 +2091,26 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
2123
2091
  logger.error("No actor handle mapper is set; use the WebFinger username {username} as the actor's internal identifier.", { username });
2124
2092
  return username;
2125
2093
  }
2126
- const identifier$1 = await actorHandleMapper(context$2, username);
2127
- if (identifier$1 == null) {
2094
+ const identifier = await actorHandleMapper(context, username);
2095
+ if (identifier == null) {
2128
2096
  logger.error("Actor {username} not found.", { username });
2129
2097
  return null;
2130
2098
  }
2131
- return identifier$1;
2099
+ return identifier;
2132
2100
  }
2133
2101
  let identifier = null;
2134
- const uriParsed = context$2.parseUri(resourceUrl);
2102
+ const uriParsed = context.parseUri(resourceUrl);
2135
2103
  if (uriParsed?.type != "actor") {
2136
2104
  const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
2137
2105
  if (match == null) {
2138
- const result = await actorAliasMapper?.(context$2, resourceUrl);
2106
+ const result = await actorAliasMapper?.(context, resourceUrl);
2139
2107
  if (result == null) return await onNotFound(request);
2140
2108
  if ("identifier" in result) identifier = result.identifier;
2141
2109
  else identifier = await mapUsernameToIdentifier(result.username);
2142
2110
  } else {
2143
2111
  const portMatch = /:\d+$/.exec(match[2]);
2144
2112
  const normalizedHost = portMatch == null ? (0, node_url.domainToASCII)(match[2].toLowerCase()) : (0, node_url.domainToASCII)(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
2145
- if (normalizedHost != context$2.url.host && normalizedHost != host) return await onNotFound(request);
2113
+ if (normalizedHost != context.url.host && normalizedHost != host) return await onNotFound(request);
2146
2114
  else {
2147
2115
  identifier = await mapUsernameToIdentifier(match[1]);
2148
2116
  resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
@@ -2150,14 +2118,14 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
2150
2118
  }
2151
2119
  } else identifier = uriParsed.identifier;
2152
2120
  if (identifier == null) return await onNotFound(request);
2153
- const actor = await actorDispatcher(context$2, identifier);
2121
+ const actor = await actorDispatcher(context, identifier);
2154
2122
  if (actor == null) {
2155
2123
  logger.error("Actor {identifier} not found.", { identifier });
2156
2124
  return await onNotFound(request);
2157
2125
  }
2158
2126
  const links = [{
2159
2127
  rel: "self",
2160
- href: context$2.getActorUri(identifier).href,
2128
+ href: context.getActorUri(identifier).href,
2161
2129
  type: "application/activity+json"
2162
2130
  }];
2163
2131
  for (const url of actor.urls) if (url instanceof require_actor.Link && url.href != null) links.push({
@@ -2179,16 +2147,16 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
2179
2147
  links.push(link);
2180
2148
  }
2181
2149
  if (webFingerLinksDispatcher != null) {
2182
- const customLinks = await webFingerLinksDispatcher(context$2, resourceUrl);
2150
+ const customLinks = await webFingerLinksDispatcher(context, resourceUrl);
2183
2151
  if (customLinks != null) for (const link of customLinks) links.push(link);
2184
2152
  }
2185
2153
  const aliases = [];
2186
2154
  if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
2187
- aliases.push(`acct:${actor.preferredUsername}@${host ?? context$2.url.host}`);
2188
- if (host != null && host !== context$2.url.host) aliases.push(`acct:${actor.preferredUsername}@${context$2.url.host}`);
2155
+ aliases.push(`acct:${actor.preferredUsername}@${host ?? context.url.host}`);
2156
+ if (host != null && host !== context.url.host) aliases.push(`acct:${actor.preferredUsername}@${context.url.host}`);
2189
2157
  }
2190
- if (resourceUrl.href !== context$2.getActorUri(identifier).href) aliases.push(context$2.getActorUri(identifier).href);
2191
- if (resourceUrl.protocol === "acct:" && host != null && host !== context$2.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
2158
+ if (resourceUrl.href !== context.getActorUri(identifier).href) aliases.push(context.getActorUri(identifier).href);
2159
+ if (resourceUrl.protocol === "acct:" && host != null && host !== context.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
2192
2160
  const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
2193
2161
  aliases.push(`acct:${username}@${host}`);
2194
2162
  }
@@ -2202,7 +2170,6 @@ async function handleWebFingerInternal(request, { context: context$2, host, acto
2202
2170
  "Access-Control-Allow-Origin": "*"
2203
2171
  } });
2204
2172
  }
2205
-
2206
2173
  //#endregion
2207
2174
  //#region src/federation/retry.ts
2208
2175
  /**
@@ -2233,7 +2200,6 @@ function createExponentialBackoffPolicy(options = {}) {
2233
2200
  return Temporal.Duration.compare(delay, maxDelay) > 0 ? maxDelay : delay;
2234
2201
  };
2235
2202
  }
2236
-
2237
2203
  //#endregion
2238
2204
  //#region src/federation/send.ts
2239
2205
  /**
@@ -2270,10 +2236,9 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
2270
2236
  * @throws {Error} If the activity fails to send.
2271
2237
  */
2272
2238
  function sendActivity(options) {
2273
- const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
2274
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
2275
- return tracer.startActiveSpan("activitypub.send_activity", {
2276
- kind: __opentelemetry_api.SpanKind.CLIENT,
2239
+ const tracerProvider = options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
2240
+ return tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.send_activity", {
2241
+ kind: _opentelemetry_api.SpanKind.CLIENT,
2277
2242
  attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
2278
2243
  }, async (span) => {
2279
2244
  if (options.activityId != null) span.setAttribute("activitypub.activity.id", options.activityId);
@@ -2285,7 +2250,7 @@ function sendActivity(options) {
2285
2250
  });
2286
2251
  } catch (e) {
2287
2252
  span.setStatus({
2288
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2253
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2289
2254
  message: String(e)
2290
2255
  });
2291
2256
  throw e;
@@ -2295,7 +2260,7 @@ function sendActivity(options) {
2295
2260
  });
2296
2261
  }
2297
2262
  async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }) {
2298
- const logger$1 = (0, __logtape_logtape.getLogger)([
2263
+ const logger = (0, _logtape_logtape.getLogger)([
2299
2264
  "fedify",
2300
2265
  "federation",
2301
2266
  "outbox"
@@ -2312,7 +2277,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
2312
2277
  rsaKey = key;
2313
2278
  break;
2314
2279
  }
2315
- if (rsaKey == null) logger$1.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.", {
2280
+ 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.", {
2316
2281
  inbox: inbox.href,
2317
2282
  keys: keys.map((pair) => ({
2318
2283
  keyId: pair.keyId.href,
@@ -2326,7 +2291,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
2326
2291
  specDeterminer
2327
2292
  });
2328
2293
  } catch (error) {
2329
- logger$1.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
2294
+ logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
2330
2295
  activityId,
2331
2296
  inbox: inbox.href,
2332
2297
  error
@@ -2340,7 +2305,7 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
2340
2305
  } catch (_) {
2341
2306
  error = "";
2342
2307
  }
2343
- logger$1.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
2308
+ logger.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
2344
2309
  activityId,
2345
2310
  inbox: inbox.href,
2346
2311
  status: response.status,
@@ -2350,7 +2315,6 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
2350
2315
  throw new Error(`Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`);
2351
2316
  }
2352
2317
  }
2353
-
2354
2318
  //#endregion
2355
2319
  //#region src/federation/middleware.ts
2356
2320
  /**
@@ -2388,7 +2352,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2388
2352
  firstKnock;
2389
2353
  constructor(options) {
2390
2354
  super();
2391
- const logger$1 = (0, __logtape_logtape.getLogger)(["fedify", "federation"]);
2355
+ const logger = (0, _logtape_logtape.getLogger)(["fedify", "federation"]);
2392
2356
  this.kv = options.kv;
2393
2357
  this.kvPrefixes = {
2394
2358
  activityIdempotence: ["_fedify", "activityIdempotence"],
@@ -2445,7 +2409,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2445
2409
  if (options.documentLoader != null) {
2446
2410
  if (options.documentLoaderFactory != null) throw new TypeError("Cannot set both documentLoader and documentLoaderFactory options at a time; use documentLoaderFactory only.");
2447
2411
  this.documentLoaderFactory = () => options.documentLoader;
2448
- logger$1.warn("The documentLoader option is deprecated; use documentLoaderFactory option instead.");
2412
+ logger.warn("The documentLoader option is deprecated; use documentLoaderFactory option instead.");
2449
2413
  } else this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
2450
2414
  return require_docloader.kvCache({
2451
2415
  loader: require_docloader.getDocumentLoader({
@@ -2459,7 +2423,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2459
2423
  if (options.contextLoader != null) {
2460
2424
  if (options.contextLoaderFactory != null) throw new TypeError("Cannot set both contextLoader and contextLoaderFactory options at a time; use contextLoaderFactory only.");
2461
2425
  this.contextLoaderFactory = () => options.contextLoader;
2462
- logger$1.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
2426
+ logger.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
2463
2427
  } else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
2464
2428
  this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_authdocloader.getAuthenticatedDocumentLoader(identity, {
2465
2429
  allowPrivateAddress,
@@ -2474,7 +2438,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2474
2438
  this.outboxRetryPolicy = options.outboxRetryPolicy ?? createExponentialBackoffPolicy();
2475
2439
  this.inboxRetryPolicy = options.inboxRetryPolicy ?? createExponentialBackoffPolicy();
2476
2440
  this.activityTransformers = options.activityTransformers ?? require_transformers.getDefaultActivityTransformers();
2477
- this.tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
2441
+ this.tracerProvider = options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
2478
2442
  this.firstKnock = options.firstKnock;
2479
2443
  }
2480
2444
  _initializeRouter() {
@@ -2482,28 +2446,28 @@ var FederationImpl = class extends FederationBuilderImpl {
2482
2446
  this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
2483
2447
  }
2484
2448
  _getTracer() {
2485
- return this.tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
2449
+ return this.tracerProvider.getTracer(require_docloader.name, require_docloader.version);
2486
2450
  }
2487
2451
  async _startQueueInternal(ctxData, signal, queue) {
2488
2452
  if (this.inboxQueue == null && this.outboxQueue == null) return;
2489
- const logger$1 = (0, __logtape_logtape.getLogger)([
2453
+ const logger = (0, _logtape_logtape.getLogger)([
2490
2454
  "fedify",
2491
2455
  "federation",
2492
2456
  "queue"
2493
2457
  ]);
2494
2458
  const promises = [];
2495
2459
  if (this.inboxQueue != null && (queue == null || queue === "inbox") && !this.inboxQueueStarted) {
2496
- logger$1.debug("Starting an inbox task worker.");
2460
+ logger.debug("Starting an inbox task worker.");
2497
2461
  this.inboxQueueStarted = true;
2498
2462
  promises.push(this.inboxQueue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
2499
2463
  }
2500
2464
  if (this.outboxQueue != null && this.outboxQueue !== this.inboxQueue && (queue == null || queue === "outbox") && !this.outboxQueueStarted) {
2501
- logger$1.debug("Starting an outbox task worker.");
2465
+ logger.debug("Starting an outbox task worker.");
2502
2466
  this.outboxQueueStarted = true;
2503
2467
  promises.push(this.outboxQueue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
2504
2468
  }
2505
2469
  if (this.fanoutQueue != null && this.fanoutQueue !== this.inboxQueue && this.fanoutQueue !== this.outboxQueue && (queue == null || queue === "fanout") && !this.fanoutQueueStarted) {
2506
- logger$1.debug("Starting a fanout task worker.");
2470
+ logger.debug("Starting a fanout task worker.");
2507
2471
  this.fanoutQueueStarted = true;
2508
2472
  promises.push(this.fanoutQueue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
2509
2473
  }
@@ -2511,10 +2475,10 @@ var FederationImpl = class extends FederationBuilderImpl {
2511
2475
  }
2512
2476
  processQueuedTask(contextData, message) {
2513
2477
  const tracer = this._getTracer();
2514
- const extractedContext = __opentelemetry_api.propagation.extract(__opentelemetry_api.context.active(), message.traceContext);
2515
- return (0, __logtape_logtape.withContext)({ messageId: message.id }, async () => {
2478
+ const extractedContext = _opentelemetry_api.propagation.extract(_opentelemetry_api.context.active(), message.traceContext);
2479
+ return (0, _logtape_logtape.withContext)({ messageId: message.id }, async () => {
2516
2480
  if (message.type === "fanout") await tracer.startActiveSpan("activitypub.fanout", {
2517
- kind: __opentelemetry_api.SpanKind.CONSUMER,
2481
+ kind: _opentelemetry_api.SpanKind.CONSUMER,
2518
2482
  attributes: { "activitypub.activity.type": message.activityType }
2519
2483
  }, extractedContext, async (span) => {
2520
2484
  if (message.activityId != null) span.setAttribute("activitypub.activity.id", message.activityId);
@@ -2522,7 +2486,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2522
2486
  await this.#listenFanoutMessage(contextData, message);
2523
2487
  } catch (e) {
2524
2488
  span.setStatus({
2525
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2489
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2526
2490
  message: String(e)
2527
2491
  });
2528
2492
  throw e;
@@ -2531,7 +2495,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2531
2495
  }
2532
2496
  });
2533
2497
  else if (message.type === "outbox") await tracer.startActiveSpan("activitypub.outbox", {
2534
- kind: __opentelemetry_api.SpanKind.CONSUMER,
2498
+ kind: _opentelemetry_api.SpanKind.CONSUMER,
2535
2499
  attributes: {
2536
2500
  "activitypub.activity.type": message.activityType,
2537
2501
  "activitypub.activity.retries": message.attempt
@@ -2542,7 +2506,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2542
2506
  await this.#listenOutboxMessage(contextData, message, span);
2543
2507
  } catch (e) {
2544
2508
  span.setStatus({
2545
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2509
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2546
2510
  message: String(e)
2547
2511
  });
2548
2512
  throw e;
@@ -2551,14 +2515,14 @@ var FederationImpl = class extends FederationBuilderImpl {
2551
2515
  }
2552
2516
  });
2553
2517
  else if (message.type === "inbox") await tracer.startActiveSpan("activitypub.inbox", {
2554
- kind: __opentelemetry_api.SpanKind.CONSUMER,
2518
+ kind: _opentelemetry_api.SpanKind.CONSUMER,
2555
2519
  attributes: { "activitypub.shared_inbox": message.identifier == null }
2556
2520
  }, extractedContext, async (span) => {
2557
2521
  try {
2558
2522
  await this.#listenInboxMessage(contextData, message, span);
2559
2523
  } catch (e) {
2560
2524
  span.setStatus({
2561
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2525
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2562
2526
  message: String(e)
2563
2527
  });
2564
2528
  throw e;
@@ -2569,12 +2533,11 @@ var FederationImpl = class extends FederationBuilderImpl {
2569
2533
  });
2570
2534
  }
2571
2535
  async #listenFanoutMessage(data, message) {
2572
- const logger$1 = (0, __logtape_logtape.getLogger)([
2536
+ (0, _logtape_logtape.getLogger)([
2573
2537
  "fedify",
2574
2538
  "federation",
2575
2539
  "fanout"
2576
- ]);
2577
- logger$1.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
2540
+ ]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
2578
2541
  activityId: message.activityId,
2579
2542
  inboxes: globalThis.Object.keys(message.inboxes).length
2580
2543
  });
@@ -2593,17 +2556,17 @@ var FederationImpl = class extends FederationBuilderImpl {
2593
2556
  }),
2594
2557
  tracerProvider: this.tracerProvider
2595
2558
  });
2596
- const context$2 = this.#createContext(new URL(message.baseUrl), data, { documentLoader: this.documentLoaderFactory({
2559
+ const context = this.#createContext(new URL(message.baseUrl), data, { documentLoader: this.documentLoaderFactory({
2597
2560
  allowPrivateAddress: this.allowPrivateAddress,
2598
2561
  userAgent: this.userAgent
2599
2562
  }) });
2600
2563
  await this.sendActivity(keys, message.inboxes, activity, {
2601
2564
  collectionSync: message.collectionSync,
2602
- context: context$2
2565
+ context
2603
2566
  });
2604
2567
  }
2605
2568
  async #listenOutboxMessage(_, message, span) {
2606
- const logger$1 = (0, __logtape_logtape.getLogger)([
2569
+ const logger = (0, _logtape_logtape.getLogger)([
2607
2570
  "fedify",
2608
2571
  "federation",
2609
2572
  "outbox"
@@ -2640,7 +2603,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2640
2603
  });
2641
2604
  } catch (error) {
2642
2605
  span.setStatus({
2643
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2606
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2644
2607
  message: String(error)
2645
2608
  });
2646
2609
  const loaderOptions = this.#getLoaderOptions(message.baseUrl);
@@ -2651,14 +2614,14 @@ var FederationImpl = class extends FederationBuilderImpl {
2651
2614
  });
2652
2615
  try {
2653
2616
  this.onOutboxError?.(error, activity);
2654
- } catch (error$1) {
2655
- logger$1.error("An unexpected error occurred in onError handler:\n{error}", {
2617
+ } catch (error) {
2618
+ logger.error("An unexpected error occurred in onError handler:\n{error}", {
2656
2619
  ...logData,
2657
- error: error$1
2620
+ error
2658
2621
  });
2659
2622
  }
2660
2623
  if (this.outboxQueue?.nativeRetrial) {
2661
- logger$1.error("Failed to send activity {activityId} to {inbox}; backend will handle retry:\n{error}", {
2624
+ logger.error("Failed to send activity {activityId} to {inbox}; backend will handle retry:\n{error}", {
2662
2625
  ...logData,
2663
2626
  error
2664
2627
  });
@@ -2669,7 +2632,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2669
2632
  attempts: message.attempt
2670
2633
  });
2671
2634
  if (delay != null) {
2672
- logger$1.error("Failed to send activity {activityId} to {inbox} (attempt #{attempt}); retry...:\n{error}", {
2635
+ logger.error("Failed to send activity {activityId} to {inbox} (attempt #{attempt}); retry...:\n{error}", {
2673
2636
  ...logData,
2674
2637
  error
2675
2638
  });
@@ -2677,39 +2640,38 @@ var FederationImpl = class extends FederationBuilderImpl {
2677
2640
  ...message,
2678
2641
  attempt: message.attempt + 1
2679
2642
  }, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
2680
- } else logger$1.error("Failed to send activity {activityId} to {inbox} after {attempt} attempts; giving up:\n{error}", {
2643
+ } else logger.error("Failed to send activity {activityId} to {inbox} after {attempt} attempts; giving up:\n{error}", {
2681
2644
  ...logData,
2682
2645
  error
2683
2646
  });
2684
2647
  return;
2685
2648
  }
2686
- logger$1.info("Successfully sent activity {activityId} to {inbox}.", { ...logData });
2649
+ logger.info("Successfully sent activity {activityId} to {inbox}.", { ...logData });
2687
2650
  }
2688
2651
  async #listenInboxMessage(ctxData, message, span) {
2689
- const logger$1 = (0, __logtape_logtape.getLogger)([
2652
+ const logger = (0, _logtape_logtape.getLogger)([
2690
2653
  "fedify",
2691
2654
  "federation",
2692
2655
  "inbox"
2693
2656
  ]);
2694
2657
  const baseUrl = new URL(message.baseUrl);
2695
- let context$2 = this.#createContext(baseUrl, ctxData);
2696
- if (message.identifier != null) context$2 = this.#createContext(baseUrl, ctxData, { documentLoader: await context$2.getDocumentLoader({ identifier: message.identifier }) });
2658
+ let context = this.#createContext(baseUrl, ctxData);
2659
+ if (message.identifier != null) context = this.#createContext(baseUrl, ctxData, { documentLoader: await context.getDocumentLoader({ identifier: message.identifier }) });
2697
2660
  else if (this.sharedInboxKeyDispatcher != null) {
2698
- const identity = await this.sharedInboxKeyDispatcher(context$2);
2699
- if (identity != null) context$2 = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context$2.getDocumentLoader(identity) : context$2.getDocumentLoader(identity) });
2661
+ const identity = await this.sharedInboxKeyDispatcher(context);
2662
+ 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) });
2700
2663
  }
2701
- const activity = await require_actor.Activity.fromJsonLd(message.activity, context$2);
2664
+ const activity = await require_actor.Activity.fromJsonLd(message.activity, context);
2702
2665
  span.setAttribute("activitypub.activity.type", require_actor.getTypeId(activity).href);
2703
2666
  if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
2704
2667
  const cacheKey = activity.id == null ? null : [
2705
2668
  ...this.kvPrefixes.activityIdempotence,
2706
- context$2.origin,
2669
+ context.origin,
2707
2670
  activity.id.href
2708
2671
  ];
2709
2672
  if (cacheKey != null) {
2710
- const cached = await this.kv.get(cacheKey);
2711
- if (cached === true) {
2712
- logger$1.debug("Activity {activityId} has already been processed.", {
2673
+ if (await this.kv.get(cacheKey) === true) {
2674
+ logger.debug("Activity {activityId} has already been processed.", {
2713
2675
  activityId: activity.id?.href,
2714
2676
  activity: message.activity,
2715
2677
  recipient: message.identifier
@@ -2717,32 +2679,32 @@ var FederationImpl = class extends FederationBuilderImpl {
2717
2679
  return;
2718
2680
  }
2719
2681
  }
2720
- await this._getTracer().startActiveSpan("activitypub.dispatch_inbox_listener", { kind: __opentelemetry_api.SpanKind.INTERNAL }, async (span$1) => {
2682
+ await this._getTracer().startActiveSpan("activitypub.dispatch_inbox_listener", { kind: _opentelemetry_api.SpanKind.INTERNAL }, async (span) => {
2721
2683
  const dispatched = this.inboxListeners?.dispatchWithClass(activity);
2722
2684
  if (dispatched == null) {
2723
- logger$1.error("Unsupported activity type:\n{activity}", {
2685
+ logger.error("Unsupported activity type:\n{activity}", {
2724
2686
  activityId: activity.id?.href,
2725
2687
  activity: message.activity,
2726
2688
  recipient: message.identifier,
2727
2689
  trial: message.attempt
2728
2690
  });
2729
- span$1.setStatus({
2730
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2691
+ span.setStatus({
2692
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2731
2693
  message: `Unsupported activity type: ${require_actor.getTypeId(activity).href}`
2732
2694
  });
2733
- span$1.end();
2695
+ span.end();
2734
2696
  return;
2735
2697
  }
2736
2698
  const { class: cls, listener } = dispatched;
2737
- span$1.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
2699
+ span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
2738
2700
  try {
2739
- await listener(context$2.toInboxContext(message.identifier, message.activity, activity.id?.href, require_actor.getTypeId(activity).href), activity);
2701
+ await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, require_actor.getTypeId(activity).href), activity);
2740
2702
  } catch (error) {
2741
2703
  try {
2742
- await this.inboxErrorHandler?.(context$2, error);
2743
- } catch (error$1) {
2744
- logger$1.error("An unexpected error occurred in inbox error handler:\n{error}", {
2745
- error: error$1,
2704
+ await this.inboxErrorHandler?.(context, error);
2705
+ } catch (error) {
2706
+ logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
2707
+ error,
2746
2708
  trial: message.attempt,
2747
2709
  activityId: activity.id?.href,
2748
2710
  activity: message.activity,
@@ -2750,17 +2712,17 @@ var FederationImpl = class extends FederationBuilderImpl {
2750
2712
  });
2751
2713
  }
2752
2714
  if (this.inboxQueue?.nativeRetrial) {
2753
- logger$1.error("Failed to process the incoming activity {activityId}; backend will handle retry:\n{error}", {
2715
+ logger.error("Failed to process the incoming activity {activityId}; backend will handle retry:\n{error}", {
2754
2716
  error,
2755
2717
  activityId: activity.id?.href,
2756
2718
  activity: message.activity,
2757
2719
  recipient: message.identifier
2758
2720
  });
2759
- span$1.setStatus({
2760
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2721
+ span.setStatus({
2722
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2761
2723
  message: String(error)
2762
2724
  });
2763
- span$1.end();
2725
+ span.end();
2764
2726
  throw error;
2765
2727
  }
2766
2728
  const delay = this.inboxRetryPolicy({
@@ -2768,7 +2730,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2768
2730
  attempts: message.attempt
2769
2731
  });
2770
2732
  if (delay != null) {
2771
- logger$1.error("Failed to process the incoming activity {activityId} (attempt #{attempt}); retry...:\n{error}", {
2733
+ logger.error("Failed to process the incoming activity {activityId} (attempt #{attempt}); retry...:\n{error}", {
2772
2734
  error,
2773
2735
  attempt: message.attempt,
2774
2736
  activityId: activity.id?.href,
@@ -2779,26 +2741,26 @@ var FederationImpl = class extends FederationBuilderImpl {
2779
2741
  ...message,
2780
2742
  attempt: message.attempt + 1
2781
2743
  }, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
2782
- } else logger$1.error("Failed to process the incoming activity {activityId} after {trial} attempts; giving up:\n{error}", {
2744
+ } else logger.error("Failed to process the incoming activity {activityId} after {trial} attempts; giving up:\n{error}", {
2783
2745
  error,
2784
2746
  activityId: activity.id?.href,
2785
2747
  activity: message.activity,
2786
2748
  recipient: message.identifier
2787
2749
  });
2788
- span$1.setStatus({
2789
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2750
+ span.setStatus({
2751
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
2790
2752
  message: String(error)
2791
2753
  });
2792
- span$1.end();
2754
+ span.end();
2793
2755
  return;
2794
2756
  }
2795
2757
  if (cacheKey != null) await this.kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
2796
- logger$1.info("Activity {activityId} has been processed.", {
2758
+ logger.info("Activity {activityId} has been processed.", {
2797
2759
  activityId: activity.id?.href,
2798
2760
  activity: message.activity,
2799
2761
  recipient: message.identifier
2800
2762
  });
2801
- span$1.end();
2763
+ span.end();
2802
2764
  });
2803
2765
  }
2804
2766
  startQueue(contextData, options = {}) {
@@ -2842,7 +2804,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2842
2804
  };
2843
2805
  }
2844
2806
  async sendActivity(keys, inboxes, activity, options) {
2845
- const logger$1 = (0, __logtape_logtape.getLogger)([
2807
+ const logger = (0, _logtape_logtape.getLogger)([
2846
2808
  "fedify",
2847
2809
  "federation",
2848
2810
  "outbox"
@@ -2876,7 +2838,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2876
2838
  format: "compact",
2877
2839
  contextLoader
2878
2840
  });
2879
- if (rsaKey == null) logger$1.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.", {
2841
+ 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.", {
2880
2842
  activityId,
2881
2843
  keys: keys.map((pair) => ({
2882
2844
  keyId: pair.keyId.href,
@@ -2887,7 +2849,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2887
2849
  contextLoader,
2888
2850
  tracerProvider: this.tracerProvider
2889
2851
  });
2890
- if (!proofCreated) logger$1.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.", {
2852
+ 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.", {
2891
2853
  activityId,
2892
2854
  keys: keys.map((pair) => ({
2893
2855
  keyId: pair.keyId.href,
@@ -2895,11 +2857,11 @@ var FederationImpl = class extends FederationBuilderImpl {
2895
2857
  }))
2896
2858
  });
2897
2859
  if (immediate || this.outboxQueue == null) {
2898
- if (immediate) logger$1.debug("Sending activity immediately without queue since immediate option is set.", {
2860
+ if (immediate) logger.debug("Sending activity immediately without queue since immediate option is set.", {
2899
2861
  activityId: activity.id.href,
2900
2862
  activity: jsonLd
2901
2863
  });
2902
- else logger$1.debug("Sending activity immediately without queue since queue is not set.", {
2864
+ else logger.debug("Sending activity immediately without queue since queue is not set.", {
2903
2865
  activityId: activity.id.href,
2904
2866
  activity: jsonLd
2905
2867
  });
@@ -2918,7 +2880,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2918
2880
  await Promise.all(promises);
2919
2881
  return;
2920
2882
  }
2921
- logger$1.debug("Enqueuing activity {activityId} to send later.", {
2883
+ logger.debug("Enqueuing activity {activityId} to send later.", {
2922
2884
  activityId: activity.id.href,
2923
2885
  activity: jsonLd
2924
2886
  });
@@ -2932,7 +2894,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2932
2894
  }
2933
2895
  if (!this.manuallyStartQueue) this._startQueueInternal(ctx.data);
2934
2896
  const carrier = {};
2935
- __opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
2897
+ _opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
2936
2898
  const messages = [];
2937
2899
  for (const inbox in inboxes) {
2938
2900
  const message = {
@@ -2955,10 +2917,9 @@ var FederationImpl = class extends FederationBuilderImpl {
2955
2917
  const { outboxQueue } = this;
2956
2918
  if (outboxQueue.enqueueMany == null) {
2957
2919
  const promises = messages.map((m) => outboxQueue.enqueue(m));
2958
- const results = await Promise.allSettled(promises);
2959
- const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
2920
+ const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
2960
2921
  if (errors.length > 0) {
2961
- logger$1.error("Failed to enqueue activity {activityId} to send later: {errors}", {
2922
+ logger.error("Failed to enqueue activity {activityId} to send later: {errors}", {
2962
2923
  activityId: activity.id.href,
2963
2924
  errors
2964
2925
  });
@@ -2968,7 +2929,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2968
2929
  } else try {
2969
2930
  await outboxQueue.enqueueMany(messages);
2970
2931
  } catch (error) {
2971
- logger$1.error("Failed to enqueue activity {activityId} to send later: {error}", {
2932
+ logger.error("Failed to enqueue activity {activityId} to send later: {error}", {
2972
2933
  activityId: activity.id.href,
2973
2934
  error
2974
2935
  });
@@ -2976,22 +2937,21 @@ var FederationImpl = class extends FederationBuilderImpl {
2976
2937
  }
2977
2938
  }
2978
2939
  fetch(request, options) {
2979
- const requestId = getRequestId(request);
2980
- return (0, __logtape_logtape.withContext)({ requestId }, async () => {
2940
+ return (0, _logtape_logtape.withContext)({ requestId: getRequestId(request) }, async () => {
2981
2941
  const tracer = this._getTracer();
2982
2942
  return await tracer.startActiveSpan(request.method, {
2983
- kind: __opentelemetry_api.SpanKind.SERVER,
2943
+ kind: _opentelemetry_api.SpanKind.SERVER,
2984
2944
  attributes: {
2985
- [__opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD]: request.method,
2986
- [__opentelemetry_semantic_conventions.ATTR_URL_FULL]: request.url
2945
+ [_opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD]: request.method,
2946
+ [_opentelemetry_semantic_conventions.ATTR_URL_FULL]: request.url
2987
2947
  }
2988
2948
  }, async (span) => {
2989
- const logger$1 = (0, __logtape_logtape.getLogger)([
2949
+ const logger = (0, _logtape_logtape.getLogger)([
2990
2950
  "fedify",
2991
2951
  "federation",
2992
2952
  "http"
2993
2953
  ]);
2994
- if (span.isRecording()) for (const [k, v] of request.headers) span.setAttribute((0, __opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_HEADER)(k), [v]);
2954
+ if (span.isRecording()) for (const [k, v] of request.headers) span.setAttribute((0, _opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_HEADER)(k), [v]);
2995
2955
  let response;
2996
2956
  try {
2997
2957
  response = await this.#fetch(request, {
@@ -3001,11 +2961,11 @@ var FederationImpl = class extends FederationBuilderImpl {
3001
2961
  });
3002
2962
  } catch (error) {
3003
2963
  span.setStatus({
3004
- code: __opentelemetry_api.SpanStatusCode.ERROR,
2964
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
3005
2965
  message: `${error}`
3006
2966
  });
3007
2967
  span.end();
3008
- logger$1.error("An error occurred while serving request {method} {url}: {error}", {
2968
+ logger.error("An error occurred while serving request {method} {url}: {error}", {
3009
2969
  method: request.method,
3010
2970
  url: request.url,
3011
2971
  error
@@ -3013,10 +2973,10 @@ var FederationImpl = class extends FederationBuilderImpl {
3013
2973
  throw error;
3014
2974
  }
3015
2975
  if (span.isRecording()) {
3016
- span.setAttribute(__opentelemetry_semantic_conventions.ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);
3017
- for (const [k, v] of response.headers) span.setAttribute((0, __opentelemetry_semantic_conventions.ATTR_HTTP_RESPONSE_HEADER)(k), [v]);
2976
+ span.setAttribute(_opentelemetry_semantic_conventions.ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);
2977
+ for (const [k, v] of response.headers) span.setAttribute((0, _opentelemetry_semantic_conventions.ATTR_HTTP_RESPONSE_HEADER)(k), [v]);
3018
2978
  span.setStatus({
3019
- code: response.status >= 500 ? __opentelemetry_api.SpanStatusCode.ERROR : __opentelemetry_api.SpanStatusCode.UNSET,
2979
+ code: response.status >= 500 ? _opentelemetry_api.SpanStatusCode.ERROR : _opentelemetry_api.SpanStatusCode.UNSET,
3020
2980
  message: response.statusText
3021
2981
  });
3022
2982
  }
@@ -3029,9 +2989,9 @@ var FederationImpl = class extends FederationBuilderImpl {
3029
2989
  url: request.url,
3030
2990
  status: response.status
3031
2991
  };
3032
- if (response.status >= 500) logger$1.error(logTpl, values);
3033
- else if (response.status >= 400) logger$1.warn(logTpl, values);
3034
- else logger$1.info(logTpl, values);
2992
+ if (response.status >= 500) logger.error(logTpl, values);
2993
+ else if (response.status >= 400) logger.warn(logTpl, values);
2994
+ else logger.info(logTpl, values);
3035
2995
  return response;
3036
2996
  });
3037
2997
  });
@@ -3044,11 +3004,11 @@ var FederationImpl = class extends FederationBuilderImpl {
3044
3004
  const route = this.router.route(url.pathname);
3045
3005
  if (route == null) return await onNotFound(request);
3046
3006
  span.updateName(`${request.method} ${route.template}`);
3047
- let context$2 = this.#createContext(request, contextData);
3007
+ let context = this.#createContext(request, contextData);
3048
3008
  const routeName = route.name.replace(/:.*$/, "");
3049
3009
  switch (routeName) {
3050
3010
  case "webfinger": return await handleWebFinger(request, {
3051
- context: context$2,
3011
+ context,
3052
3012
  host: this.origin?.handleHost,
3053
3013
  actorDispatcher: this.actorCallbacks?.dispatcher,
3054
3014
  actorHandleMapper: this.actorCallbacks?.handleMapper,
@@ -3057,16 +3017,16 @@ var FederationImpl = class extends FederationBuilderImpl {
3057
3017
  onNotFound,
3058
3018
  tracer
3059
3019
  });
3060
- case "nodeInfoJrd": return await handleNodeInfoJrd(request, context$2);
3020
+ case "nodeInfoJrd": return await handleNodeInfoJrd(request, context);
3061
3021
  case "nodeInfo": return await handleNodeInfo(request, {
3062
- context: context$2,
3022
+ context,
3063
3023
  nodeInfoDispatcher: this.nodeInfoDispatcher
3064
3024
  });
3065
3025
  case "actor":
3066
- context$2 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
3026
+ context = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
3067
3027
  return await handleActor(request, {
3068
3028
  identifier: route.values.identifier ?? route.values.handle,
3069
- context: context$2,
3029
+ context,
3070
3030
  actorDispatcher: this.actorCallbacks?.dispatcher,
3071
3031
  authorizePredicate: this.actorCallbacks?.authorizePredicate,
3072
3032
  onUnauthorized,
@@ -3077,13 +3037,13 @@ var FederationImpl = class extends FederationBuilderImpl {
3077
3037
  const typeId = route.name.replace(/^object:/, "");
3078
3038
  const callbacks = this.objectCallbacks[typeId];
3079
3039
  const cls = this.objectTypeIds[typeId];
3080
- context$2 = this.#createContext(request, contextData, { invokedFromObjectDispatcher: {
3040
+ context = this.#createContext(request, contextData, { invokedFromObjectDispatcher: {
3081
3041
  cls,
3082
3042
  values: route.values
3083
3043
  } });
3084
3044
  return await handleObject(request, {
3085
3045
  values: route.values,
3086
- context: context$2,
3046
+ context,
3087
3047
  objectDispatcher: callbacks?.dispatcher,
3088
3048
  authorizePredicate: callbacks?.authorizePredicate,
3089
3049
  onUnauthorized,
@@ -3094,8 +3054,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3094
3054
  case "outbox": return await handleCollection(request, {
3095
3055
  name: "outbox",
3096
3056
  identifier: route.values.identifier ?? route.values.handle,
3097
- uriGetter: context$2.getOutboxUri.bind(context$2),
3098
- context: context$2,
3057
+ uriGetter: context.getOutboxUri.bind(context),
3058
+ context,
3099
3059
  collectionCallbacks: this.outboxCallbacks,
3100
3060
  tracerProvider: this.tracerProvider,
3101
3061
  onUnauthorized,
@@ -3106,25 +3066,25 @@ var FederationImpl = class extends FederationBuilderImpl {
3106
3066
  if (request.method !== "POST") return await handleCollection(request, {
3107
3067
  name: "inbox",
3108
3068
  identifier: route.values.identifier ?? route.values.handle,
3109
- uriGetter: context$2.getInboxUri.bind(context$2),
3110
- context: context$2,
3069
+ uriGetter: context.getInboxUri.bind(context),
3070
+ context,
3111
3071
  collectionCallbacks: this.inboxCallbacks,
3112
3072
  tracerProvider: this.tracerProvider,
3113
3073
  onUnauthorized,
3114
3074
  onNotFound,
3115
3075
  onNotAcceptable
3116
3076
  });
3117
- context$2 = this.#createContext(request, contextData, { documentLoader: await context$2.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
3077
+ context = this.#createContext(request, contextData, { documentLoader: await context.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
3118
3078
  case "sharedInbox":
3119
3079
  if (routeName !== "inbox" && this.sharedInboxKeyDispatcher != null) {
3120
- const identity = await this.sharedInboxKeyDispatcher(context$2);
3121
- if (identity != null) context$2 = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context$2.getDocumentLoader(identity) : context$2.getDocumentLoader(identity) });
3080
+ const identity = await this.sharedInboxKeyDispatcher(context);
3081
+ 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) });
3122
3082
  }
3123
3083
  if (!this.manuallyStartQueue) this._startQueueInternal(contextData);
3124
3084
  return await handleInbox(request, {
3125
3085
  recipient: route.values.identifier ?? route.values.handle ?? null,
3126
- context: context$2,
3127
- inboxContextFactory: context$2.toInboxContext.bind(context$2),
3086
+ context,
3087
+ inboxContextFactory: context.toInboxContext.bind(context),
3128
3088
  kv: this.kv,
3129
3089
  kvPrefixes: this.kvPrefixes,
3130
3090
  queue: this.inboxQueue,
@@ -3140,8 +3100,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3140
3100
  case "following": return await handleCollection(request, {
3141
3101
  name: "following",
3142
3102
  identifier: route.values.identifier ?? route.values.handle,
3143
- uriGetter: context$2.getFollowingUri.bind(context$2),
3144
- context: context$2,
3103
+ uriGetter: context.getFollowingUri.bind(context),
3104
+ context,
3145
3105
  collectionCallbacks: this.followingCallbacks,
3146
3106
  tracerProvider: this.tracerProvider,
3147
3107
  onUnauthorized,
@@ -3158,14 +3118,14 @@ var FederationImpl = class extends FederationBuilderImpl {
3158
3118
  return await handleCollection(request, {
3159
3119
  name: "followers",
3160
3120
  identifier: route.values.identifier ?? route.values.handle,
3161
- uriGetter: baseUrl == null ? context$2.getFollowersUri.bind(context$2) : (identifier) => {
3162
- const uri = context$2.getFollowersUri(identifier);
3121
+ uriGetter: baseUrl == null ? context.getFollowersUri.bind(context) : (identifier) => {
3122
+ const uri = context.getFollowersUri(identifier);
3163
3123
  uri.searchParams.set("base-url", baseUrl);
3164
3124
  return uri;
3165
3125
  },
3166
- context: context$2,
3126
+ context,
3167
3127
  filter: baseUrl != null ? new URL(baseUrl) : void 0,
3168
- filterPredicate: baseUrl != null ? (i) => (i instanceof URL ? i.href : i.id?.href ?? "").startsWith(baseUrl) : void 0,
3128
+ filterPredicate: baseUrl != null ? ((i) => (i instanceof URL ? i.href : i.id?.href ?? "").startsWith(baseUrl)) : void 0,
3169
3129
  collectionCallbacks: this.followersCallbacks,
3170
3130
  tracerProvider: this.tracerProvider,
3171
3131
  onUnauthorized,
@@ -3176,8 +3136,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3176
3136
  case "liked": return await handleCollection(request, {
3177
3137
  name: "liked",
3178
3138
  identifier: route.values.identifier ?? route.values.handle,
3179
- uriGetter: context$2.getLikedUri.bind(context$2),
3180
- context: context$2,
3139
+ uriGetter: context.getLikedUri.bind(context),
3140
+ context,
3181
3141
  collectionCallbacks: this.likedCallbacks,
3182
3142
  tracerProvider: this.tracerProvider,
3183
3143
  onUnauthorized,
@@ -3187,8 +3147,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3187
3147
  case "featured": return await handleCollection(request, {
3188
3148
  name: "featured",
3189
3149
  identifier: route.values.identifier ?? route.values.handle,
3190
- uriGetter: context$2.getFeaturedUri.bind(context$2),
3191
- context: context$2,
3150
+ uriGetter: context.getFeaturedUri.bind(context),
3151
+ context,
3192
3152
  collectionCallbacks: this.featuredCallbacks,
3193
3153
  tracerProvider: this.tracerProvider,
3194
3154
  onUnauthorized,
@@ -3198,8 +3158,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3198
3158
  case "featuredTags": return await handleCollection(request, {
3199
3159
  name: "featured tags",
3200
3160
  identifier: route.values.identifier ?? route.values.handle,
3201
- uriGetter: context$2.getFeaturedTagsUri.bind(context$2),
3202
- context: context$2,
3161
+ uriGetter: context.getFeaturedTagsUri.bind(context),
3162
+ context,
3203
3163
  collectionCallbacks: this.featuredTagsCallbacks,
3204
3164
  tracerProvider: this.tracerProvider,
3205
3165
  onUnauthorized,
@@ -3211,7 +3171,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3211
3171
  const callbacks = this.collectionCallbacks[name];
3212
3172
  return await handleCustomCollection(request, {
3213
3173
  name,
3214
- context: context$2,
3174
+ context,
3215
3175
  values: route.values,
3216
3176
  collectionCallbacks: callbacks,
3217
3177
  tracerProvider: this.tracerProvider,
@@ -3225,7 +3185,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3225
3185
  const callbacks = this.collectionCallbacks[name];
3226
3186
  return await handleOrderedCollection(request, {
3227
3187
  name,
3228
- context: context$2,
3188
+ context,
3229
3189
  values: route.values,
3230
3190
  collectionCallbacks: callbacks,
3231
3191
  tracerProvider: this.tracerProvider,
@@ -3323,9 +3283,9 @@ var ContextImpl = class ContextImpl {
3323
3283
  }
3324
3284
  getInboxUri(identifier) {
3325
3285
  if (identifier == null) {
3326
- const path$1 = this.federation.router.build("sharedInbox", {});
3327
- if (path$1 == null) throw new RouterError("No shared inbox path registered.");
3328
- return new URL(path$1, this.canonicalOrigin);
3286
+ const path = this.federation.router.build("sharedInbox", {});
3287
+ if (path == null) throw new RouterError("No shared inbox path registered.");
3288
+ return new URL(path, this.canonicalOrigin);
3329
3289
  }
3330
3290
  const path = this.federation.router.build("inbox", {
3331
3291
  identifier,
@@ -3383,14 +3343,13 @@ var ContextImpl = class ContextImpl {
3383
3343
  if (uri == null) return null;
3384
3344
  if (uri.origin !== this.origin && uri.origin !== this.canonicalOrigin) return null;
3385
3345
  const route = this.federation.router.route(uri.pathname);
3386
- const logger$1 = (0, __logtape_logtape.getLogger)(["fedify", "federation"]);
3346
+ const logger = (0, _logtape_logtape.getLogger)(["fedify", "federation"]);
3387
3347
  if (route == null) return null;
3388
3348
  else if (route.name === "sharedInbox") return {
3389
3349
  type: "inbox",
3390
3350
  identifier: void 0,
3391
3351
  get handle() {
3392
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3393
- return void 0;
3352
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3394
3353
  }
3395
3354
  };
3396
3355
  const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
@@ -3398,7 +3357,7 @@ var ContextImpl = class ContextImpl {
3398
3357
  type: "actor",
3399
3358
  identifier,
3400
3359
  get handle() {
3401
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3360
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3402
3361
  return identifier;
3403
3362
  }
3404
3363
  };
@@ -3414,7 +3373,7 @@ var ContextImpl = class ContextImpl {
3414
3373
  type: "inbox",
3415
3374
  identifier,
3416
3375
  get handle() {
3417
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3376
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3418
3377
  return identifier;
3419
3378
  }
3420
3379
  };
@@ -3422,7 +3381,7 @@ var ContextImpl = class ContextImpl {
3422
3381
  type: "outbox",
3423
3382
  identifier,
3424
3383
  get handle() {
3425
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3384
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3426
3385
  return identifier;
3427
3386
  }
3428
3387
  };
@@ -3430,7 +3389,7 @@ var ContextImpl = class ContextImpl {
3430
3389
  type: "following",
3431
3390
  identifier,
3432
3391
  get handle() {
3433
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3392
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3434
3393
  return identifier;
3435
3394
  }
3436
3395
  };
@@ -3438,7 +3397,7 @@ var ContextImpl = class ContextImpl {
3438
3397
  type: "followers",
3439
3398
  identifier,
3440
3399
  get handle() {
3441
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3400
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3442
3401
  return identifier;
3443
3402
  }
3444
3403
  };
@@ -3446,7 +3405,7 @@ var ContextImpl = class ContextImpl {
3446
3405
  type: "liked",
3447
3406
  identifier,
3448
3407
  get handle() {
3449
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3408
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3450
3409
  return identifier;
3451
3410
  }
3452
3411
  };
@@ -3454,7 +3413,7 @@ var ContextImpl = class ContextImpl {
3454
3413
  type: "featured",
3455
3414
  identifier,
3456
3415
  get handle() {
3457
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3416
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3458
3417
  return identifier;
3459
3418
  }
3460
3419
  };
@@ -3462,12 +3421,11 @@ var ContextImpl = class ContextImpl {
3462
3421
  type: "featuredTags",
3463
3422
  identifier,
3464
3423
  get handle() {
3465
- logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3424
+ logger.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
3466
3425
  return identifier;
3467
3426
  }
3468
3427
  };
3469
- const collectionTypes = ["collection", "orderedCollection"];
3470
- const collectionRegex = /* @__PURE__ */ new RegExp(`^(${collectionTypes.join("|")}):(.*)$`);
3428
+ const collectionRegex = new RegExp(`^(${["collection", "orderedCollection"].join("|")}):(.*)$`);
3471
3429
  const match = route.name.match(collectionRegex);
3472
3430
  if (match !== null) {
3473
3431
  const [, type, name] = match;
@@ -3483,12 +3441,12 @@ var ContextImpl = class ContextImpl {
3483
3441
  return null;
3484
3442
  }
3485
3443
  async getActorKeyPairs(identifier) {
3486
- const logger$1 = (0, __logtape_logtape.getLogger)([
3444
+ const logger = (0, _logtape_logtape.getLogger)([
3487
3445
  "fedify",
3488
3446
  "federation",
3489
3447
  "actor"
3490
3448
  ]);
3491
- if (this.invokedFromActorKeyPairsDispatcher != null) logger$1.warn("Context.getActorKeyPairs({getActorKeyPairsIdentifier}) method is invoked from the actor key pairs dispatcher ({actorKeyPairsDispatcherIdentifier}); this may cause an infinite loop.", {
3449
+ 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.", {
3492
3450
  getActorKeyPairsIdentifier: identifier,
3493
3451
  actorKeyPairsDispatcherIdentifier: this.invokedFromActorKeyPairsDispatcher.identifier
3494
3452
  });
@@ -3496,7 +3454,7 @@ var ContextImpl = class ContextImpl {
3496
3454
  try {
3497
3455
  keyPairs = await this.getKeyPairsFromIdentifier(identifier);
3498
3456
  } catch (_) {
3499
- logger$1.warn("No actor key pairs dispatcher registered.");
3457
+ logger.warn("No actor key pairs dispatcher registered.");
3500
3458
  return [];
3501
3459
  }
3502
3460
  const owner = this.getActorUri(identifier);
@@ -3520,7 +3478,7 @@ var ContextImpl = class ContextImpl {
3520
3478
  return result;
3521
3479
  }
3522
3480
  async getKeyPairsFromIdentifier(identifier) {
3523
- const logger$1 = (0, __logtape_logtape.getLogger)([
3481
+ const logger = (0, _logtape_logtape.getLogger)([
3524
3482
  "fedify",
3525
3483
  "federation",
3526
3484
  "actor"
@@ -3531,7 +3489,7 @@ var ContextImpl = class ContextImpl {
3531
3489
  actorUri = this.getActorUri(identifier);
3532
3490
  } catch (error) {
3533
3491
  if (error instanceof RouterError) {
3534
- logger$1.warn(error.message);
3492
+ logger.warn(error.message);
3535
3493
  return [];
3536
3494
  }
3537
3495
  throw error;
@@ -3540,7 +3498,7 @@ var ContextImpl = class ContextImpl {
3540
3498
  ...this,
3541
3499
  invokedFromActorKeyPairsDispatcher: { identifier }
3542
3500
  }), identifier);
3543
- if (keyPairs.length < 1) logger$1.warn("No key pairs found for actor {identifier}.", { identifier });
3501
+ if (keyPairs.length < 1) logger.warn("No key pairs found for actor {identifier}.", { identifier });
3544
3502
  let i = 0;
3545
3503
  const result = [];
3546
3504
  for (const keyPair of keyPairs) {
@@ -3558,7 +3516,7 @@ var ContextImpl = class ContextImpl {
3558
3516
  const { privateKey } = keyPair;
3559
3517
  if (privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" && privateKey.algorithm.hash.name === "SHA-256") return keyPair;
3560
3518
  }
3561
- (0, __logtape_logtape.getLogger)([
3519
+ (0, _logtape_logtape.getLogger)([
3562
3520
  "fedify",
3563
3521
  "federation",
3564
3522
  "actor"
@@ -3573,7 +3531,7 @@ var ContextImpl = class ContextImpl {
3573
3531
  if ("username" in identity) username = identity.username;
3574
3532
  else {
3575
3533
  username = identity.handle;
3576
- (0, __logtape_logtape.getLogger)([
3534
+ (0, _logtape_logtape.getLogger)([
3577
3535
  "fedify",
3578
3536
  "runtime",
3579
3537
  "docloader"
@@ -3588,14 +3546,13 @@ var ContextImpl = class ContextImpl {
3588
3546
  } else identifierPromise = Promise.resolve(identity.identifier);
3589
3547
  return identifierPromise.then((identifier) => {
3590
3548
  if (identifier == null) return this.documentLoader;
3591
- const keyPair = this.getRsaKeyPairFromIdentifier(identifier);
3592
- return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
3549
+ return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
3593
3550
  });
3594
3551
  }
3595
3552
  return this.federation.authenticatedDocumentLoaderFactory(identity);
3596
3553
  }
3597
3554
  lookupObject(identifier, options = {}) {
3598
- return require_vocab.lookupObject(identifier, {
3555
+ return require_vocab_mod.lookupObject(identifier, {
3599
3556
  ...options,
3600
3557
  documentLoader: options.documentLoader ?? this.documentLoader,
3601
3558
  contextLoader: options.contextLoader ?? this.contextLoader,
@@ -3605,7 +3562,7 @@ var ContextImpl = class ContextImpl {
3605
3562
  });
3606
3563
  }
3607
3564
  traverseCollection(collection, options = {}) {
3608
- return require_vocab.traverseCollection(collection, {
3565
+ return require_vocab_mod.traverseCollection(collection, {
3609
3566
  ...options,
3610
3567
  documentLoader: options.documentLoader ?? this.documentLoader,
3611
3568
  contextLoader: options.contextLoader ?? this.contextLoader
@@ -3631,9 +3588,8 @@ var ContextImpl = class ContextImpl {
3631
3588
  });
3632
3589
  }
3633
3590
  sendActivity(sender, recipients, activity, options = {}) {
3634
- const tracer = this.tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
3635
- return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
3636
- kind: this.federation.outboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
3591
+ return this.tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
3592
+ kind: this.federation.outboxQueue == null || options.immediate ? _opentelemetry_api.SpanKind.CLIENT : _opentelemetry_api.SpanKind.PRODUCER,
3637
3593
  attributes: {
3638
3594
  "activitypub.activity.type": require_actor.getTypeId(activity).href,
3639
3595
  "activitypub.activity.to": activity.toIds.map((to) => to.href),
@@ -3647,7 +3603,7 @@ var ContextImpl = class ContextImpl {
3647
3603
  await this.sendActivityInternal(sender, recipients, activity, options, span);
3648
3604
  } catch (e) {
3649
3605
  span.setStatus({
3650
- code: __opentelemetry_api.SpanStatusCode.ERROR,
3606
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
3651
3607
  message: String(e)
3652
3608
  });
3653
3609
  throw e;
@@ -3657,7 +3613,7 @@ var ContextImpl = class ContextImpl {
3657
3613
  });
3658
3614
  }
3659
3615
  async sendActivityInternal(sender, recipients, activity, options, span) {
3660
- const logger$1 = (0, __logtape_logtape.getLogger)([
3616
+ const logger = (0, _logtape_logtape.getLogger)([
3661
3617
  "fedify",
3662
3618
  "federation",
3663
3619
  "outbox"
@@ -3671,7 +3627,7 @@ var ContextImpl = class ContextImpl {
3671
3627
  if ("username" in sender) username = sender.username;
3672
3628
  else {
3673
3629
  username = sender.handle;
3674
- logger$1.warn("The \"handle\" property for the sender parameter is deprecated; use \"identifier\" or \"username\" instead.", { sender });
3630
+ logger.warn("The \"handle\" property for the sender parameter is deprecated; use \"identifier\" or \"username\" instead.", { sender });
3675
3631
  }
3676
3632
  if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
3677
3633
  else {
@@ -3707,7 +3663,7 @@ var ContextImpl = class ContextImpl {
3707
3663
  for (const activityTransformer of this.federation.activityTransformers) activity = activityTransformer(activity, this);
3708
3664
  span?.setAttribute("activitypub.activity.id", activity?.id?.href ?? "");
3709
3665
  if (activity.actorId == null) {
3710
- logger$1.error("Activity {activityId} to send does not have an actor.", {
3666
+ logger.error("Activity {activityId} to send does not have an actor.", {
3711
3667
  activity,
3712
3668
  activityId: activity?.id?.href
3713
3669
  });
@@ -3718,7 +3674,7 @@ var ContextImpl = class ContextImpl {
3718
3674
  preferSharedInbox: options.preferSharedInbox,
3719
3675
  excludeBaseUris: options.excludeBaseUris
3720
3676
  });
3721
- logger$1.debug("Sending activity {activityId} to inboxes:\n{inboxes}", {
3677
+ logger.debug("Sending activity {activityId} to inboxes:\n{inboxes}", {
3722
3678
  inboxes: globalThis.Object.keys(inboxes),
3723
3679
  activityId: activity.id?.href,
3724
3680
  activity
@@ -3732,7 +3688,7 @@ var ContextImpl = class ContextImpl {
3732
3688
  privateKey: await require_key.exportJwk(privateKey)
3733
3689
  })));
3734
3690
  const carrier = {};
3735
- __opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
3691
+ _opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
3736
3692
  const message = {
3737
3693
  type: "fanout",
3738
3694
  id: crypto.randomUUID(),
@@ -3752,7 +3708,7 @@ var ContextImpl = class ContextImpl {
3752
3708
  traceContext: carrier
3753
3709
  };
3754
3710
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
3755
- this.federation.fanoutQueue.enqueue(message);
3711
+ await this.federation.fanoutQueue.enqueue(message);
3756
3712
  }
3757
3713
  async *getFollowers(identifier) {
3758
3714
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -3763,23 +3719,21 @@ var ContextImpl = class ContextImpl {
3763
3719
  }
3764
3720
  if (this.federation.followersCallbacks.firstCursor == null) throw new Error("No first cursor dispatcher registered for followers collection.");
3765
3721
  let cursor = await this.federation.followersCallbacks.firstCursor(this, identifier);
3766
- if (cursor != null) (0, __logtape_logtape.getLogger)([
3722
+ if (cursor != null) (0, _logtape_logtape.getLogger)([
3767
3723
  "fedify",
3768
3724
  "federation",
3769
3725
  "outbox"
3770
3726
  ]).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 });
3771
3727
  while (cursor != null) {
3772
- const result$1 = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
3773
- if (result$1 == null) break;
3774
- for (const recipient of result$1.items) yield recipient;
3775
- cursor = result$1.nextCursor ?? null;
3728
+ const result = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
3729
+ if (result == null) break;
3730
+ for (const recipient of result.items) yield recipient;
3731
+ cursor = result.nextCursor ?? null;
3776
3732
  }
3777
3733
  }
3778
3734
  routeActivity(recipient, activity, options = {}) {
3779
- const tracerProvider = this.tracerProvider ?? this.tracerProvider;
3780
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
3781
- return tracer.startActiveSpan("activitypub.inbox", {
3782
- kind: this.federation.inboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.INTERNAL : __opentelemetry_api.SpanKind.PRODUCER,
3735
+ return (this.tracerProvider ?? this.tracerProvider).getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.inbox", {
3736
+ kind: this.federation.inboxQueue == null || options.immediate ? _opentelemetry_api.SpanKind.INTERNAL : _opentelemetry_api.SpanKind.PRODUCER,
3783
3737
  attributes: { "activitypub.activity.type": require_actor.getTypeId(activity).href }
3784
3738
  }, async (span) => {
3785
3739
  if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
@@ -3792,11 +3746,11 @@ var ContextImpl = class ContextImpl {
3792
3746
  if (ok) {
3793
3747
  span.setAttribute("activitypub.shared_inbox", recipient == null);
3794
3748
  if (recipient != null) span.setAttribute("fedify.inbox.recipient", recipient);
3795
- } else span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
3749
+ } else span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
3796
3750
  return ok;
3797
3751
  } catch (e) {
3798
3752
  span.setStatus({
3799
- code: __opentelemetry_api.SpanStatusCode.ERROR,
3753
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
3800
3754
  message: String(e)
3801
3755
  });
3802
3756
  throw e;
@@ -3806,7 +3760,7 @@ var ContextImpl = class ContextImpl {
3806
3760
  });
3807
3761
  }
3808
3762
  async routeActivityInternal(recipient, activity, options = {}, span) {
3809
- const logger$1 = (0, __logtape_logtape.getLogger)([
3763
+ const logger = (0, _logtape_logtape.getLogger)([
3810
3764
  "fedify",
3811
3765
  "federation",
3812
3766
  "inbox"
@@ -3814,19 +3768,18 @@ var ContextImpl = class ContextImpl {
3814
3768
  const contextLoader = options.contextLoader ?? this.contextLoader;
3815
3769
  const json = await activity.toJsonLd({ contextLoader });
3816
3770
  const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
3817
- const verified = await require_proof.verifyObject(require_actor.Activity, json, {
3771
+ if (await require_proof.verifyObject(require_actor.Activity, json, {
3818
3772
  contextLoader,
3819
3773
  documentLoader: options.documentLoader ?? this.documentLoader,
3820
3774
  tracerProvider: options.tracerProvider ?? this.tracerProvider,
3821
3775
  keyCache
3822
- });
3823
- if (verified == null) {
3824
- logger$1.debug("Object Integrity Proofs are not verified.", {
3776
+ }) == null) {
3777
+ logger.debug("Object Integrity Proofs are not verified.", {
3825
3778
  recipient,
3826
3779
  activity: json
3827
3780
  });
3828
3781
  if (activity.id == null) {
3829
- logger$1.debug("Activity is missing an ID; unable to fetch.", {
3782
+ logger.debug("Activity is missing an ID; unable to fetch.", {
3830
3783
  recipient,
3831
3784
  activity: json
3832
3785
  });
@@ -3834,26 +3787,26 @@ var ContextImpl = class ContextImpl {
3834
3787
  }
3835
3788
  const fetched = await this.lookupObject(activity.id, options);
3836
3789
  if (fetched == null) {
3837
- logger$1.debug("Failed to fetch the remote activity object {activityId}.", {
3790
+ logger.debug("Failed to fetch the remote activity object {activityId}.", {
3838
3791
  recipient,
3839
3792
  activity: json,
3840
3793
  activityId: activity.id.href
3841
3794
  });
3842
3795
  return false;
3843
3796
  } else if (!(fetched instanceof require_actor.Activity)) {
3844
- logger$1.debug("Fetched object is not an Activity.", {
3797
+ logger.debug("Fetched object is not an Activity.", {
3845
3798
  recipient,
3846
3799
  activity: await fetched.toJsonLd({ contextLoader })
3847
3800
  });
3848
3801
  return false;
3849
3802
  } else if (fetched.id?.href !== activity.id.href) {
3850
- logger$1.debug("Fetched activity object has a different ID; failed to verify.", {
3803
+ logger.debug("Fetched activity object has a different ID; failed to verify.", {
3851
3804
  recipient,
3852
3805
  activity: await fetched.toJsonLd({ contextLoader })
3853
3806
  });
3854
3807
  return false;
3855
3808
  } else if (fetched.actorIds.length < 1) {
3856
- logger$1.debug("Fetched activity object is missing an actor; unable to verify.", {
3809
+ logger.debug("Fetched activity object is missing an actor; unable to verify.", {
3857
3810
  recipient,
3858
3811
  activity: await fetched.toJsonLd({ contextLoader })
3859
3812
  });
@@ -3861,15 +3814,15 @@ var ContextImpl = class ContextImpl {
3861
3814
  }
3862
3815
  const activityId = fetched.id;
3863
3816
  if (!fetched.actorIds.every((actor) => actor.origin === activityId.origin)) {
3864
- logger$1.debug("Fetched activity object has actors from different origins; unable to verify.", {
3817
+ logger.debug("Fetched activity object has actors from different origins; unable to verify.", {
3865
3818
  recipient,
3866
3819
  activity: await fetched.toJsonLd({ contextLoader })
3867
3820
  });
3868
3821
  return false;
3869
3822
  }
3870
- logger$1.debug("Successfully fetched the remote activity object {activityId}; ignore the original activity and use the fetched one, which is trustworthy.");
3823
+ logger.debug("Successfully fetched the remote activity object {activityId}; ignore the original activity and use the fetched one, which is trustworthy.");
3871
3824
  activity = fetched;
3872
- } else logger$1.debug("Object Integrity Proofs are verified.", {
3825
+ } else logger.debug("Object Integrity Proofs are verified.", {
3873
3826
  recipient,
3874
3827
  activity: json
3875
3828
  });
@@ -3918,7 +3871,7 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
3918
3871
  }
3919
3872
  async getActor(identifier) {
3920
3873
  if (this.federation.actorCallbacks == null || this.federation.actorCallbacks.dispatcher == null) throw new Error("No actor dispatcher registered.");
3921
- if (this.#invokedFromActorDispatcher != null) (0, __logtape_logtape.getLogger)([
3874
+ if (this.#invokedFromActorDispatcher != null) (0, _logtape_logtape.getLogger)([
3922
3875
  "fedify",
3923
3876
  "federation",
3924
3877
  "actor"
@@ -3935,7 +3888,7 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
3935
3888
  const callbacks = this.federation.objectCallbacks[cls.typeId.href];
3936
3889
  if (callbacks == null) throw new Error("No object dispatcher registered.");
3937
3890
  for (const param of callbacks.parameters) if (!(param in values)) throw new TypeError(`Missing parameter: ${param}`);
3938
- 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.", {
3891
+ 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.", {
3939
3892
  getObjectClass: cls.name,
3940
3893
  getObjectValues: values,
3941
3894
  actorDispatcherClass: this.#invokedFromObjectDispatcher.cls.name,
@@ -3995,9 +3948,8 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
3995
3948
  });
3996
3949
  }
3997
3950
  forwardActivity(forwarder, recipients, options) {
3998
- const tracer = this.tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
3999
- return tracer.startActiveSpan("activitypub.outbox", {
4000
- kind: this.federation.outboxQueue == null || options?.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
3951
+ return this.tracerProvider.getTracer(require_docloader.name, require_docloader.version).startActiveSpan("activitypub.outbox", {
3952
+ kind: this.federation.outboxQueue == null || options?.immediate ? _opentelemetry_api.SpanKind.CLIENT : _opentelemetry_api.SpanKind.PRODUCER,
4001
3953
  attributes: { "activitypub.activity.type": this.activityType }
4002
3954
  }, async (span) => {
4003
3955
  try {
@@ -4005,7 +3957,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4005
3957
  await this.forwardActivityInternal(forwarder, recipients, options);
4006
3958
  } catch (e) {
4007
3959
  span.setStatus({
4008
- code: __opentelemetry_api.SpanStatusCode.ERROR,
3960
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
4009
3961
  message: String(e)
4010
3962
  });
4011
3963
  throw e;
@@ -4015,7 +3967,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4015
3967
  });
4016
3968
  }
4017
3969
  async forwardActivityInternal(forwarder, recipients, options) {
4018
- const logger$1 = (0, __logtape_logtape.getLogger)([
3970
+ const logger = (0, _logtape_logtape.getLogger)([
4019
3971
  "fedify",
4020
3972
  "federation",
4021
3973
  "inbox"
@@ -4029,7 +3981,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4029
3981
  if ("username" in forwarder) username = forwarder.username;
4030
3982
  else {
4031
3983
  username = forwarder.handle;
4032
- logger$1.warn("The \"handle\" property for the forwarder parameter is deprecated; use \"identifier\" or \"username\" instead.", { forwarder });
3984
+ logger.warn("The \"handle\" property for the forwarder parameter is deprecated; use \"identifier\" or \"username\" instead.", { forwarder });
4033
3985
  }
4034
3986
  if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
4035
3987
  else {
@@ -4047,14 +3999,13 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4047
3999
  if (!require_proof.hasSignature(this.activity)) {
4048
4000
  let hasProof;
4049
4001
  try {
4050
- const activity = await require_actor.Activity.fromJsonLd(this.activity, this);
4051
- hasProof = await activity.getProof() != null;
4002
+ hasProof = await (await require_actor.Activity.fromJsonLd(this.activity, this)).getProof() != null;
4052
4003
  } catch {
4053
4004
  hasProof = false;
4054
4005
  }
4055
4006
  if (!hasProof) {
4056
4007
  if (options?.skipIfUnsigned) return;
4057
- logger$1.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.");
4008
+ 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.");
4058
4009
  }
4059
4010
  }
4060
4011
  if (recipients === "followers") {
@@ -4068,14 +4019,14 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4068
4019
  preferSharedInbox: options?.preferSharedInbox,
4069
4020
  excludeBaseUris: options?.excludeBaseUris
4070
4021
  });
4071
- logger$1.debug("Forwarding activity {activityId} to inboxes:\n{inboxes}", {
4022
+ logger.debug("Forwarding activity {activityId} to inboxes:\n{inboxes}", {
4072
4023
  inboxes: globalThis.Object.keys(inboxes),
4073
4024
  activityId: this.activityId,
4074
4025
  activity: this.activity
4075
4026
  });
4076
4027
  if (options?.immediate || this.federation.outboxQueue == null) {
4077
- if (options?.immediate) logger$1.debug("Forwarding activity immediately without queue since immediate option is set.");
4078
- else logger$1.debug("Forwarding activity immediately without queue since queue is not set.");
4028
+ if (options?.immediate) logger.debug("Forwarding activity immediately without queue since immediate option is set.");
4029
+ else logger.debug("Forwarding activity immediately without queue since queue is not set.");
4079
4030
  const promises = [];
4080
4031
  for (const inbox in inboxes) promises.push(sendActivity({
4081
4032
  keys,
@@ -4090,7 +4041,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4090
4041
  await Promise.all(promises);
4091
4042
  return;
4092
4043
  }
4093
- logger$1.debug("Enqueuing activity {activityId} to forward later.", {
4044
+ logger.debug("Enqueuing activity {activityId} to forward later.", {
4094
4045
  activityId: this.activityId,
4095
4046
  activity: this.activity
4096
4047
  });
@@ -4103,7 +4054,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4103
4054
  });
4104
4055
  }
4105
4056
  const carrier = {};
4106
- __opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
4057
+ _opentelemetry_api.propagation.inject(_opentelemetry_api.context.active(), carrier);
4107
4058
  const messages = [];
4108
4059
  for (const inbox in inboxes) {
4109
4060
  const message = {
@@ -4126,10 +4077,9 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4126
4077
  const { outboxQueue } = this.federation;
4127
4078
  if (outboxQueue.enqueueMany == null) {
4128
4079
  const promises = messages.map((m) => outboxQueue.enqueue(m));
4129
- const results = await Promise.allSettled(promises);
4130
- const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
4080
+ const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
4131
4081
  if (errors.length > 0) {
4132
- logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
4082
+ logger.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
4133
4083
  activityId: this.activityId,
4134
4084
  errors
4135
4085
  });
@@ -4139,7 +4089,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4139
4089
  } else try {
4140
4090
  await outboxQueue.enqueueMany(messages);
4141
4091
  } catch (error) {
4142
- logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{error}", {
4092
+ logger.error("Failed to enqueue activity {activityId} to forward later:\n{error}", {
4143
4093
  activityId: this.activityId,
4144
4094
  error
4145
4095
  });
@@ -4194,87 +4144,84 @@ function unauthorized(_request) {
4194
4144
  function getRequestId(request) {
4195
4145
  const traceId = request.headers.get("X-Request-Id") || request.headers.get("X-Correlation-Id") || request.headers.get("Traceparent")?.split("-")[1];
4196
4146
  if (traceId != null) return traceId;
4197
- const timestamp = Date.now().toString(36);
4198
- const random = Math.random().toString(36).slice(2, 8);
4199
- return `req_${timestamp}${random}`;
4147
+ return `req_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
4200
4148
  }
4201
-
4202
4149
  //#endregion
4203
- Object.defineProperty(exports, 'ContextImpl', {
4204
- enumerable: true,
4205
- get: function () {
4206
- return ContextImpl;
4207
- }
4150
+ Object.defineProperty(exports, "ContextImpl", {
4151
+ enumerable: true,
4152
+ get: function() {
4153
+ return ContextImpl;
4154
+ }
4208
4155
  });
4209
- Object.defineProperty(exports, 'FederationImpl', {
4210
- enumerable: true,
4211
- get: function () {
4212
- return FederationImpl;
4213
- }
4156
+ Object.defineProperty(exports, "FederationImpl", {
4157
+ enumerable: true,
4158
+ get: function() {
4159
+ return FederationImpl;
4160
+ }
4214
4161
  });
4215
- Object.defineProperty(exports, 'InboxContextImpl', {
4216
- enumerable: true,
4217
- get: function () {
4218
- return InboxContextImpl;
4219
- }
4162
+ Object.defineProperty(exports, "InboxContextImpl", {
4163
+ enumerable: true,
4164
+ get: function() {
4165
+ return InboxContextImpl;
4166
+ }
4220
4167
  });
4221
- Object.defineProperty(exports, 'KvSpecDeterminer', {
4222
- enumerable: true,
4223
- get: function () {
4224
- return KvSpecDeterminer;
4225
- }
4168
+ Object.defineProperty(exports, "KvSpecDeterminer", {
4169
+ enumerable: true,
4170
+ get: function() {
4171
+ return KvSpecDeterminer;
4172
+ }
4226
4173
  });
4227
- Object.defineProperty(exports, 'Router', {
4228
- enumerable: true,
4229
- get: function () {
4230
- return Router;
4231
- }
4174
+ Object.defineProperty(exports, "Router", {
4175
+ enumerable: true,
4176
+ get: function() {
4177
+ return Router;
4178
+ }
4232
4179
  });
4233
- Object.defineProperty(exports, 'RouterError', {
4234
- enumerable: true,
4235
- get: function () {
4236
- return RouterError;
4237
- }
4180
+ Object.defineProperty(exports, "RouterError", {
4181
+ enumerable: true,
4182
+ get: function() {
4183
+ return RouterError;
4184
+ }
4238
4185
  });
4239
- Object.defineProperty(exports, 'buildCollectionSynchronizationHeader', {
4240
- enumerable: true,
4241
- get: function () {
4242
- return buildCollectionSynchronizationHeader;
4243
- }
4186
+ Object.defineProperty(exports, "buildCollectionSynchronizationHeader", {
4187
+ enumerable: true,
4188
+ get: function() {
4189
+ return buildCollectionSynchronizationHeader;
4190
+ }
4191
+ });
4192
+ Object.defineProperty(exports, "createExponentialBackoffPolicy", {
4193
+ enumerable: true,
4194
+ get: function() {
4195
+ return createExponentialBackoffPolicy;
4196
+ }
4244
4197
  });
4245
- Object.defineProperty(exports, 'createExponentialBackoffPolicy', {
4246
- enumerable: true,
4247
- get: function () {
4248
- return createExponentialBackoffPolicy;
4249
- }
4198
+ Object.defineProperty(exports, "createFederation", {
4199
+ enumerable: true,
4200
+ get: function() {
4201
+ return createFederation;
4202
+ }
4250
4203
  });
4251
- Object.defineProperty(exports, 'createFederation', {
4252
- enumerable: true,
4253
- get: function () {
4254
- return createFederation;
4255
- }
4204
+ Object.defineProperty(exports, "createFederationBuilder", {
4205
+ enumerable: true,
4206
+ get: function() {
4207
+ return createFederationBuilder;
4208
+ }
4256
4209
  });
4257
- Object.defineProperty(exports, 'createFederationBuilder', {
4258
- enumerable: true,
4259
- get: function () {
4260
- return createFederationBuilder;
4261
- }
4210
+ Object.defineProperty(exports, "digest", {
4211
+ enumerable: true,
4212
+ get: function() {
4213
+ return digest;
4214
+ }
4262
4215
  });
4263
- Object.defineProperty(exports, 'digest', {
4264
- enumerable: true,
4265
- get: function () {
4266
- return digest;
4267
- }
4216
+ Object.defineProperty(exports, "respondWithObject", {
4217
+ enumerable: true,
4218
+ get: function() {
4219
+ return respondWithObject;
4220
+ }
4268
4221
  });
4269
- Object.defineProperty(exports, 'respondWithObject', {
4270
- enumerable: true,
4271
- get: function () {
4272
- return respondWithObject;
4273
- }
4222
+ Object.defineProperty(exports, "respondWithObjectIfAcceptable", {
4223
+ enumerable: true,
4224
+ get: function() {
4225
+ return respondWithObjectIfAcceptable;
4226
+ }
4274
4227
  });
4275
- Object.defineProperty(exports, 'respondWithObjectIfAcceptable', {
4276
- enumerable: true,
4277
- get: function () {
4278
- return respondWithObjectIfAcceptable;
4279
- }
4280
- });