@fedify/fedify 2.0.0-dev.1641 → 2.0.0-dev.166

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 (316) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +66 -30
  3. package/dist/{assert_rejects-7UF4R_Qs.js → assert_rejects-Ce45JcFg.js} +1 -1
  4. package/dist/{assert_is_error-B035L3om.js → assert_throws-BNXdRGWP.js} +31 -1
  5. package/dist/{builder-E2Icrl_a.js → builder-Khy2m25E.js} +15 -8
  6. package/dist/{client-bgSdkFa2.d.ts → client-CUTUGgvJ.d.ts} +19 -19
  7. package/dist/{client-BW4V0OJx.js → client-Dg7OfUDA.js} +28 -23
  8. package/dist/{client-CegPX0Rn.d.cts → client-by-PEGAJ.d.cts} +19 -19
  9. package/dist/compat/mod.cjs +1 -1
  10. package/dist/compat/mod.d.cts +6 -12
  11. package/dist/compat/mod.d.ts +6 -12
  12. package/dist/compat/mod.js +1 -1
  13. package/dist/compat/transformers.test.js +21 -19
  14. package/dist/context-Bns6uTJq.js +109 -0
  15. package/dist/{context-CDSZdQHD.d.ts → context-C7vzWilY.d.ts} +374 -182
  16. package/dist/{context-Dq8aCtMH.d.cts → context-CrB9RFy5.d.cts} +374 -182
  17. package/dist/deno-Cif1-iL_.js +117 -0
  18. package/dist/{testing-ByQmUvf-.js → dist-B5f6a8Tt.js} +90 -111
  19. package/dist/{authdocloader-BkIZCKQv.js → docloader-CVaWaEcp.js} +17 -8
  20. package/dist/{esm-mtx3XJAD.js → esm-DGl7uK1r.js} +32 -17
  21. package/dist/federation/builder.test.js +9 -9
  22. package/dist/federation/collection.test.js +3 -6
  23. package/dist/federation/handler.test.js +113 -145
  24. package/dist/federation/idempotency.test.js +202 -0
  25. package/dist/federation/inbox.test.js +5 -6
  26. package/dist/federation/keycache.test.js +4 -5
  27. package/dist/federation/kv.test.js +58 -7
  28. package/dist/federation/middleware.test.js +306 -111
  29. package/dist/federation/mod.cjs +8 -12
  30. package/dist/federation/mod.d.cts +7 -13
  31. package/dist/federation/mod.d.ts +7 -13
  32. package/dist/federation/mod.js +8 -13
  33. package/dist/federation/mq.test.js +7 -8
  34. package/dist/federation/negotiation.test.js +25 -0
  35. package/dist/federation/retry.test.js +2 -4
  36. package/dist/federation/router.test.js +4 -6
  37. package/dist/federation/send.test.js +53 -13
  38. package/dist/{webfinger/handler.test.js → federation/webfinger.test.js} +25 -23
  39. package/dist/{federation-H2_En3j5.cjs → federation-B431K2gm.cjs} +22 -0
  40. package/dist/{federation-D1U8YY9t.js → federation-BbZwNNWj.js} +28 -6
  41. package/dist/{http-Cox5GsED.js → http-B99rtXjf.js} +3 -2
  42. package/dist/{http-C7uYFcBo.js → http-CY-Bbe9s.js} +371 -11
  43. package/dist/{http-BS6766zs.d.cts → http-ClB3pLcL.d.cts} +2 -2
  44. package/dist/{http-DqSNLFNY.d.ts → http-DLBDPal9.d.ts} +2 -2
  45. package/dist/{http-ZhcoaYEa.cjs → http-DfyrqzT4.cjs} +410 -14
  46. package/dist/{inbox-BDdRbWNI.js → inbox-BC3B2xqc.js} +25 -7
  47. package/dist/{key-CfiBDu3o.js → key-Bw4eVboO.js} +3 -2
  48. package/dist/{keycache-CVBjz3xi.js → keycache-DRxpZ5r9.js} +1 -1
  49. package/dist/{keys-CBKbYaJA.js → keys-ZbcByPg9.js} +2 -1
  50. package/dist/{kv-63Cil1MD.d.cts → kv-B4vFhIYL.d.cts} +30 -1
  51. package/dist/{kv-C7sopW2E.d.ts → kv-CYySNrsn.d.ts} +30 -1
  52. package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
  53. package/dist/kv-cache-BCsLgQXU.js +122 -0
  54. package/dist/kv-cache-BEeqyGER.js +107 -0
  55. package/dist/kv-cache-Cerg94jw.cjs +134 -0
  56. package/dist/{ld-CxgmnSO3.js → ld-1OEVoX2N.js} +4 -2
  57. package/dist/{middleware-DXidHY4N.js → middleware-7qNi2Qwp.js} +254 -254
  58. package/dist/middleware-B7mdNwwo.js +12 -0
  59. package/dist/{middleware-ByPnvMMS.js → middleware-CQv0UNYy.js} +215 -313
  60. package/dist/{middleware-LyCG_YVM.cjs → middleware-CvNusBTn.cjs} +309 -303
  61. package/dist/middleware-Dem4kH_q.js +26 -0
  62. package/dist/middleware-TgcMW8QT.cjs +12 -0
  63. package/dist/mod-0p9zUdzg.d.cts +107 -0
  64. package/dist/mod-0qnPv4EC.d.cts +62 -0
  65. package/dist/{mod-BClfg3ej.d.cts → mod-BrS8tiad.d.cts} +3 -3
  66. package/dist/mod-C3SOvTD1.d.ts +64 -0
  67. package/dist/{mod-BhMnAkFX.d.cts → mod-D6pS5_xJ.d.cts} +4 -4
  68. package/dist/{mod-Drmz72EK.d.ts → mod-jOa7W503.d.ts} +3 -3
  69. package/dist/{mod-RI3-KvUI.d.ts → mod-waqu-BL_.d.ts} +4 -4
  70. package/dist/mod-xc20HhMD.d.ts +109 -0
  71. package/dist/mod.cjs +17 -112
  72. package/dist/mod.d.cts +11 -17
  73. package/dist/mod.d.ts +11 -17
  74. package/dist/mod.js +11 -17
  75. package/dist/negotiation-5NPJL6zp.js +71 -0
  76. package/dist/nodeinfo/client.test.js +5 -8
  77. package/dist/nodeinfo/handler.test.js +23 -22
  78. package/dist/nodeinfo/mod.cjs +2 -3
  79. package/dist/nodeinfo/mod.d.cts +2 -4
  80. package/dist/nodeinfo/mod.d.ts +2 -4
  81. package/dist/nodeinfo/mod.js +2 -3
  82. package/dist/nodeinfo/types.test.js +4 -7
  83. package/dist/otel/exporter.test.js +893 -0
  84. package/dist/otel/mod.cjs +256 -0
  85. package/dist/otel/mod.d.cts +230 -0
  86. package/dist/otel/mod.d.ts +232 -0
  87. package/dist/otel/mod.js +255 -0
  88. package/dist/{owner-CQPnQVtf.d.ts → owner-BgI8C-VY.d.ts} +2 -3
  89. package/dist/{owner-B-7Ptt_m.d.cts → owner-C-zfmVAD.d.cts} +2 -3
  90. package/dist/{owner-Cxob5_PK.js → owner-w_YNARRI.js} +45 -8
  91. package/dist/{proof-BiSQNUmQ.js → proof-C8vStykH.js} +3 -2
  92. package/dist/{proof-2Gcor0_N.cjs → proof-CJZ5gNjq.cjs} +69 -33
  93. package/dist/{proof-DkxwMaWE.js → proof-aPT2G2bY.js} +47 -11
  94. package/dist/router-D9eI0s4b.js +118 -0
  95. package/dist/{send-DSEhWIYD.js → send-C77cZsvd.js} +9 -4
  96. package/dist/sig/http.test.js +9 -11
  97. package/dist/sig/key.test.js +7 -9
  98. package/dist/sig/ld.test.js +8 -10
  99. package/dist/sig/mod.cjs +7 -11
  100. package/dist/sig/mod.d.cts +3 -7
  101. package/dist/sig/mod.d.ts +3 -7
  102. package/dist/sig/mod.js +3 -7
  103. package/dist/sig/owner.test.js +31 -10
  104. package/dist/sig/proof.test.js +11 -12
  105. package/dist/testing/mod.d.ts +243 -6982
  106. package/dist/testing/mod.js +4 -4
  107. package/dist/{transformers-CoBS-oFG.cjs → transformers-BjBg6Lag.cjs} +2 -2
  108. package/dist/{transformers-BFT6d7J5.js → transformers-N_ip_y4P.js} +2 -2
  109. package/dist/{types-l2uh_ZhP.js → types-8l28uC8o.js} +31 -26
  110. package/dist/{types-Bqt2EgP0.cjs → types-B6z6CqIz.cjs} +33 -28
  111. package/dist/{types-BSuWJsOm.js → types-CPz01LGH.js} +3 -3
  112. package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +11 -13
  113. package/dist/utils/kv-cache.test.js +211 -0
  114. package/dist/utils/mod.cjs +10 -0
  115. package/dist/utils/mod.d.cts +4 -0
  116. package/dist/utils/mod.d.ts +6 -0
  117. package/dist/utils/mod.js +9 -0
  118. package/package.json +34 -75
  119. package/dist/actor-C22bXuuC.d.ts +0 -130
  120. package/dist/actor-CP03csrm.cjs +0 -37786
  121. package/dist/actor-DMgu-ZjT.d.cts +0 -128
  122. package/dist/actor-DU511yTk.js +0 -37312
  123. package/dist/actor-DVpsNXhn.js +0 -146
  124. package/dist/assert_throws-53_pKeP3.js +0 -39
  125. package/dist/authdocloader-BnsFSERg.cjs +0 -58
  126. package/dist/authdocloader-DCgMyo82.js +0 -52
  127. package/dist/denokv-jZ0Z2h0M.js +0 -57
  128. package/dist/docloader-BtqIh1OE.js +0 -4795
  129. package/dist/docloader-CxWcuWqQ.d.ts +0 -221
  130. package/dist/docloader-D-MrRyHl.d.cts +0 -219
  131. package/dist/docloader-kae6M-GI.cjs +0 -4861
  132. package/dist/fixtures/activitypub.academy/users/brauca_darradiul.json +0 -83
  133. package/dist/fixtures/example.com/announce.json +0 -6
  134. package/dist/fixtures/example.com/collection.json +0 -19
  135. package/dist/fixtures/example.com/create.json +0 -6
  136. package/dist/fixtures/example.com/cross-origin-actor.json +0 -6
  137. package/dist/fixtures/example.com/hong-gildong.json +0 -11
  138. package/dist/fixtures/example.com/invite.json +0 -7
  139. package/dist/fixtures/example.com/key.json +0 -7
  140. package/dist/fixtures/example.com/key2.json +0 -6
  141. package/dist/fixtures/example.com/object.json +0 -6
  142. package/dist/fixtures/example.com/orderedcollectionpage.json +0 -24
  143. package/dist/fixtures/example.com/paged/a.json +0 -13
  144. package/dist/fixtures/example.com/paged/b.json +0 -16
  145. package/dist/fixtures/example.com/paged-collection.json +0 -6
  146. package/dist/fixtures/example.com/person.json +0 -22
  147. package/dist/fixtures/example.com/person2.json +0 -40
  148. package/dist/fixtures/example.com/test.json +0 -5
  149. package/dist/fixtures/example.com/users/handle.json +0 -16
  150. package/dist/fixtures/example.com/wrong-type.json +0 -3
  151. package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +0 -24
  152. package/dist/fixtures/remote.domain/users/bob.json +0 -20
  153. package/dist/fixtures/server.example/users/alice.json +0 -20
  154. package/dist/fixtures/w3id.org/identity/v1.json +0 -152
  155. package/dist/fixtures/w3id.org/security/data-integrity/v1.json +0 -74
  156. package/dist/fixtures/w3id.org/security/multikey/v1.json +0 -35
  157. package/dist/fixtures/w3id.org/security/v1.json +0 -50
  158. package/dist/fixtures/wizard.casa/users/hongminhee.json +0 -69
  159. package/dist/fixtures/www.w3.org/ns/activitystreams.json +0 -379
  160. package/dist/fixtures/www.w3.org/ns/did/v1.json +0 -58
  161. package/dist/key-B9Z5ZuX9.js +0 -10
  162. package/dist/key-Cc0JlcKe.js +0 -260
  163. package/dist/key-CgwCzDC4.js +0 -10
  164. package/dist/key-D-7DPHNl.cjs +0 -10
  165. package/dist/key-HqzOCwDc.cjs +0 -290
  166. package/dist/lookup-CiU3QxQz.js +0 -322
  167. package/dist/lookup-NuT9cCSl.js +0 -131
  168. package/dist/lookup-QHjmy4Og.cjs +0 -137
  169. package/dist/middleware-BHboQ4BE.js +0 -25
  170. package/dist/middleware-Bp3I9z8r.js +0 -17
  171. package/dist/middleware-oYqSU5ky.cjs +0 -17
  172. package/dist/mod-Cxt4Kpf6.d.ts +0 -291
  173. package/dist/mod-DBzN0aCM.d.ts +0 -115
  174. package/dist/mod-Dc_-mf8s.d.cts +0 -102
  175. package/dist/mod-FZd39qVq.d.cts +0 -1
  176. package/dist/mod-TFoH2Ql8.d.ts +0 -104
  177. package/dist/mod-evzlRVZq.d.cts +0 -289
  178. package/dist/mod-g0xFzAP9.d.ts +0 -2
  179. package/dist/mod-jQ4OODsl.d.cts +0 -113
  180. package/dist/mq-B7R1Q-M5.d.cts +0 -140
  181. package/dist/mq-CRGm1e_F.d.ts +0 -143
  182. package/dist/runtime/docloader.test.js +0 -522
  183. package/dist/runtime/key.test.js +0 -103
  184. package/dist/runtime/langstr.test.js +0 -39
  185. package/dist/runtime/link.test.js +0 -61
  186. package/dist/runtime/mod.cjs +0 -25
  187. package/dist/runtime/mod.d.cts +0 -6
  188. package/dist/runtime/mod.d.ts +0 -8
  189. package/dist/runtime/mod.js +0 -13
  190. package/dist/runtime/multibase/multibase.test.d.ts +0 -3
  191. package/dist/runtime/multibase/multibase.test.js +0 -358
  192. package/dist/runtime/url.test.d.ts +0 -3
  193. package/dist/runtime/url.test.js +0 -45
  194. package/dist/src/vocab/accept.yaml +0 -15
  195. package/dist/src/vocab/activity.yaml +0 -98
  196. package/dist/src/vocab/add.yaml +0 -16
  197. package/dist/src/vocab/announce.yaml +0 -30
  198. package/dist/src/vocab/application.yaml +0 -324
  199. package/dist/src/vocab/arrive.yaml +0 -15
  200. package/dist/src/vocab/article.yaml +0 -46
  201. package/dist/src/vocab/audio.yaml +0 -11
  202. package/dist/src/vocab/block.yaml +0 -16
  203. package/dist/src/vocab/chatmessage.yaml +0 -50
  204. package/dist/src/vocab/collection.yaml +0 -154
  205. package/dist/src/vocab/collectionpage.yaml +0 -55
  206. package/dist/src/vocab/create.yaml +0 -28
  207. package/dist/src/vocab/dataintegrityproof.yaml +0 -56
  208. package/dist/src/vocab/delete.yaml +0 -27
  209. package/dist/src/vocab/didservice.yaml +0 -22
  210. package/dist/src/vocab/dislike.yaml +0 -14
  211. package/dist/src/vocab/document.yaml +0 -31
  212. package/dist/src/vocab/emoji.yaml +0 -12
  213. package/dist/src/vocab/emojireact.yaml +0 -17
  214. package/dist/src/vocab/endpoints.yaml +0 -85
  215. package/dist/src/vocab/event.yaml +0 -11
  216. package/dist/src/vocab/export.yaml +0 -9
  217. package/dist/src/vocab/flag.yaml +0 -15
  218. package/dist/src/vocab/follow.yaml +0 -19
  219. package/dist/src/vocab/group.yaml +0 -324
  220. package/dist/src/vocab/hashtag.yaml +0 -14
  221. package/dist/src/vocab/ignore.yaml +0 -14
  222. package/dist/src/vocab/image.yaml +0 -9
  223. package/dist/src/vocab/intransitiveactivity.yaml +0 -15
  224. package/dist/src/vocab/invite.yaml +0 -14
  225. package/dist/src/vocab/join.yaml +0 -14
  226. package/dist/src/vocab/key.yaml +0 -28
  227. package/dist/src/vocab/leave.yaml +0 -14
  228. package/dist/src/vocab/like.yaml +0 -16
  229. package/dist/src/vocab/link.yaml +0 -101
  230. package/dist/src/vocab/listen.yaml +0 -12
  231. package/dist/src/vocab/mention.yaml +0 -9
  232. package/dist/src/vocab/move.yaml +0 -15
  233. package/dist/src/vocab/multikey.yaml +0 -36
  234. package/dist/src/vocab/note.yaml +0 -48
  235. package/dist/src/vocab/object.yaml +0 -404
  236. package/dist/src/vocab/offer.yaml +0 -15
  237. package/dist/src/vocab/orderedcollection.yaml +0 -39
  238. package/dist/src/vocab/orderedcollectionpage.yaml +0 -50
  239. package/dist/src/vocab/organization.yaml +0 -324
  240. package/dist/src/vocab/page.yaml +0 -11
  241. package/dist/src/vocab/person.yaml +0 -324
  242. package/dist/src/vocab/place.yaml +0 -75
  243. package/dist/src/vocab/profile.yaml +0 -26
  244. package/dist/src/vocab/propertyvalue.yaml +0 -32
  245. package/dist/src/vocab/question.yaml +0 -103
  246. package/dist/src/vocab/read.yaml +0 -13
  247. package/dist/src/vocab/reject.yaml +0 -14
  248. package/dist/src/vocab/relationship.yaml +0 -52
  249. package/dist/src/vocab/remove.yaml +0 -14
  250. package/dist/src/vocab/service.yaml +0 -324
  251. package/dist/src/vocab/source.yaml +0 -26
  252. package/dist/src/vocab/tentativeaccept.yaml +0 -14
  253. package/dist/src/vocab/tentativereject.yaml +0 -14
  254. package/dist/src/vocab/tombstone.yaml +0 -24
  255. package/dist/src/vocab/travel.yaml +0 -16
  256. package/dist/src/vocab/undo.yaml +0 -26
  257. package/dist/src/vocab/update.yaml +0 -58
  258. package/dist/src/vocab/video.yaml +0 -11
  259. package/dist/src/vocab/view.yaml +0 -13
  260. package/dist/testing/docloader.test.js +0 -24
  261. package/dist/type-B4NJkfVg.js +0 -42187
  262. package/dist/vocab/actor.test.d.ts +0 -3
  263. package/dist/vocab/actor.test.js +0 -5965
  264. package/dist/vocab/lookup.test.d.ts +0 -3
  265. package/dist/vocab/lookup.test.js +0 -206
  266. package/dist/vocab/mod.cjs +0 -87
  267. package/dist/vocab/mod.d.cts +0 -6
  268. package/dist/vocab/mod.d.ts +0 -8
  269. package/dist/vocab/mod.js +0 -10
  270. package/dist/vocab/schema.yaml +0 -247
  271. package/dist/vocab/type.test.d.ts +0 -3
  272. package/dist/vocab/type.test.js +0 -25
  273. package/dist/vocab/vocab.test.d.ts +0 -3
  274. package/dist/vocab/vocab.test.js +0 -3398
  275. package/dist/vocab-B0-5a8pw.cjs +0 -282
  276. package/dist/vocab-DJTYMqyU.d.cts +0 -14632
  277. package/dist/vocab-SOE1ifCr.d.ts +0 -14634
  278. package/dist/vocab-lBFcVxVF.js +0 -246
  279. package/dist/webfinger/handler.test.d.ts +0 -3
  280. package/dist/webfinger/lookup.test.d.ts +0 -3
  281. package/dist/webfinger/lookup.test.js +0 -195
  282. package/dist/webfinger/mod.cjs +0 -9
  283. package/dist/webfinger/mod.d.cts +0 -4
  284. package/dist/webfinger/mod.d.ts +0 -6
  285. package/dist/webfinger/mod.js +0 -9
  286. package/dist/webfinger-BjOEdFPs.cjs +0 -4
  287. package/dist/webfinger-De_bU0iE.js +0 -4
  288. package/dist/x/cfworkers.cjs +0 -100
  289. package/dist/x/cfworkers.d.cts +0 -59
  290. package/dist/x/cfworkers.d.ts +0 -61
  291. package/dist/x/cfworkers.js +0 -98
  292. package/dist/x/cfworkers.test.d.ts +0 -3
  293. package/dist/x/cfworkers.test.js +0 -179
  294. package/dist/x/hono.cjs +0 -61
  295. package/dist/x/hono.d.cts +0 -54
  296. package/dist/x/hono.d.ts +0 -56
  297. package/dist/x/hono.js +0 -60
  298. package/dist/x/sveltekit.cjs +0 -69
  299. package/dist/x/sveltekit.d.cts +0 -46
  300. package/dist/x/sveltekit.d.ts +0 -48
  301. package/dist/x/sveltekit.js +0 -68
  302. /package/dist/{runtime/authdocloader.test.d.ts → federation/idempotency.test.d.ts} +0 -0
  303. /package/dist/{runtime/docloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
  304. /package/dist/{runtime/key.test.d.ts → federation/webfinger.test.d.ts} +0 -0
  305. /package/dist/{mod-1pDWKvUL.d.ts → mod-1E3W847c.d.ts} +0 -0
  306. /package/dist/{mod-C2tOeRkN.d.cts → mod-C81L6_lQ.d.cts} +0 -0
  307. /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BlLsRSiT.js} +0 -0
  308. /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-DuMYTpbZ.cjs} +0 -0
  309. /package/dist/{runtime/langstr.test.d.ts → otel/exporter.test.d.ts} +0 -0
  310. /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
  311. /package/dist/{runtime-DPYEDf-o.js → sig-CwuONEzF.js} +0 -0
  312. /package/dist/{runtime-C58AJWSv.cjs → sig-DeXX2xnj.cjs} +0 -0
  313. /package/dist/{testing → utils}/docloader.test.d.ts +0 -0
  314. /package/dist/{runtime/link.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
  315. /package/dist/{sig-ByHXzqUi.cjs → utils-Db0ZmjcD.cjs} +0 -0
  316. /package/dist/{sig-Cj3tk-ig.js → utils-Wranxuoe.js} +0 -0
@@ -2,23 +2,21 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
6
- import { deno_default, getDocumentLoader, kvCache } from "./docloader-BtqIh1OE.js";
7
- import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-DU511yTk.js";
8
- import { lookupWebFinger } from "./lookup-NuT9cCSl.js";
9
- import { exportJwk, importJwk, validateCryptoKey } from "./key-Cc0JlcKe.js";
10
- import { doubleKnock, verifyRequest } from "./http-C7uYFcBo.js";
11
- import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-DkxwMaWE.js";
12
- import { getNodeInfo, nodeInfoToJson } from "./types-l2uh_ZhP.js";
13
- import { getAuthenticatedDocumentLoader } from "./authdocloader-DCgMyo82.js";
14
- import { lookupObject, traverseCollection } from "./vocab-lBFcVxVF.js";
5
+ import { getDefaultActivityTransformers } from "./transformers-N_ip_y4P.js";
6
+ import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-CY-Bbe9s.js";
7
+ import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-aPT2G2bY.js";
8
+ import { getNodeInfo, nodeInfoToJson } from "./types-8l28uC8o.js";
9
+ import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-BCsLgQXU.js";
15
10
  import { getLogger, withContext } from "@logtape/logtape";
11
+ import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
16
12
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
17
- import { encodeHex } from "byte-encodings/hex";
18
13
  import { cloneDeep } from "es-toolkit";
19
14
  import { Router } from "uri-template-router";
20
15
  import { parseTemplate } from "url-template";
16
+ import { encodeHex } from "byte-encodings/hex";
21
17
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
18
+ import { getDocumentLoader } from "@fedify/vocab-runtime";
19
+ import { lookupWebFinger } from "@fedify/webfinger";
22
20
  import { domainToASCII } from "node:url";
23
21
 
24
22
  //#region src/federation/inbox.ts
@@ -55,17 +53,34 @@ var InboxListenerSet = class InboxListenerSet {
55
53
  return this.dispatchWithClass(activity)?.listener ?? null;
56
54
  }
57
55
  };
58
- async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider }) {
56
+ async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
59
57
  const logger$1 = getLogger([
60
58
  "fedify",
61
59
  "federation",
62
60
  "inbox"
63
61
  ]);
64
- const cacheKey = activity.id == null ? null : [
65
- ...kvPrefixes.activityIdempotence,
66
- ctx.origin,
67
- activity.id.href
68
- ];
62
+ let cacheKey = null;
63
+ if (activity.id != null) {
64
+ const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
65
+ const strategy = idempotencyStrategy ?? "per-inbox";
66
+ let keyString;
67
+ if (typeof strategy === "function") {
68
+ const result = await strategy(inboxContext, activity);
69
+ keyString = result;
70
+ } else switch (strategy) {
71
+ case "global":
72
+ keyString = activity.id.href;
73
+ break;
74
+ case "per-origin":
75
+ keyString = `${ctx.origin}\n${activity.id.href}`;
76
+ break;
77
+ case "per-inbox":
78
+ keyString = `${ctx.origin}\n${activity.id.href}\n${recipient == null ? "sharedInbox" : `inbox\n${recipient}`}`;
79
+ break;
80
+ default: keyString = `${ctx.origin}\n${activity.id.href}`;
81
+ }
82
+ if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
83
+ }
69
84
  if (cacheKey != null) {
70
85
  const cached = await kv.get(cacheKey);
71
86
  if (cached === true) {
@@ -307,6 +322,7 @@ var FederationBuilderImpl = class {
307
322
  inboxListeners;
308
323
  inboxErrorHandler;
309
324
  sharedInboxKeyDispatcher;
325
+ idempotencyStrategy;
310
326
  collectionTypeIds;
311
327
  collectionCallbacks;
312
328
  /**
@@ -321,7 +337,7 @@ var FederationBuilderImpl = class {
321
337
  this.collectionTypeIds = {};
322
338
  }
323
339
  async build(options) {
324
- const { FederationImpl: FederationImpl$1 } = await import("./middleware-Bp3I9z8r.js");
340
+ const { FederationImpl: FederationImpl$1 } = await import("./middleware-B7mdNwwo.js");
325
341
  const f = new FederationImpl$1(options);
326
342
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
327
343
  f.router = this.router.clone();
@@ -343,6 +359,7 @@ var FederationBuilderImpl = class {
343
359
  f.inboxListeners = this.inboxListeners?.clone();
344
360
  f.inboxErrorHandler = this.inboxErrorHandler;
345
361
  f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
362
+ f.idempotencyStrategy = this.idempotencyStrategy;
346
363
  return f;
347
364
  }
348
365
  _getTracer() {
@@ -765,15 +782,19 @@ var FederationBuilderImpl = class {
765
782
  setSharedKeyDispatcher: (dispatcher) => {
766
783
  this.sharedInboxKeyDispatcher = dispatcher;
767
784
  return setters;
785
+ },
786
+ withIdempotency: (strategy) => {
787
+ this.idempotencyStrategy = strategy;
788
+ return setters;
768
789
  }
769
790
  };
770
791
  return setters;
771
792
  }
772
- setCollectionDispatcher(name, ...args) {
773
- return this.#setCustomCollectionDispatcher(name, "collection", ...args);
793
+ setCollectionDispatcher(name, itemType, path, dispatcher) {
794
+ return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
774
795
  }
775
- setOrderedCollectionDispatcher(name, ...args) {
776
- return this.#setCustomCollectionDispatcher(name, "orderedCollection", ...args);
796
+ setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
797
+ return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
777
798
  }
778
799
  #setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
779
800
  const strName = String(name);
@@ -979,9 +1000,6 @@ function preferredMediaTypes(accept) {
979
1000
  const accepts = parseAccept(accept === void 0 ? "*/*" : accept ?? "");
980
1001
  return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
981
1002
  }
982
-
983
- //#endregion
984
- //#region src/federation/handler.ts
985
1003
  function acceptsJsonLd(request) {
986
1004
  const accept = request.headers.get("Accept");
987
1005
  const types = accept ? preferredMediaTypes(accept) : ["*/*"];
@@ -989,6 +1007,9 @@ function acceptsJsonLd(request) {
989
1007
  if (types[0] === "text/html" || types[0] === "application/xhtml+xml") return false;
990
1008
  return types.includes("application/activity+json") || types.includes("application/ld+json") || types.includes("application/json");
991
1009
  }
1010
+
1011
+ //#endregion
1012
+ //#region src/federation/handler.ts
992
1013
  /**
993
1014
  * Handles an actor request.
994
1015
  * @template TContextData The context data to pass to the context.
@@ -996,7 +1017,7 @@ function acceptsJsonLd(request) {
996
1017
  * @param parameters The parameters for handling the actor.
997
1018
  * @returns A promise that resolves to an HTTP response.
998
1019
  */
999
- async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
1020
+ async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
1000
1021
  const logger$1 = getLogger([
1001
1022
  "fedify",
1002
1023
  "federation",
@@ -1011,7 +1032,6 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
1011
1032
  logger$1.debug("Actor {identifier} not found.", { identifier });
1012
1033
  return await onNotFound(request);
1013
1034
  }
1014
- if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
1015
1035
  if (authorizePredicate != null) {
1016
1036
  let key = await context$1.getSignedKey();
1017
1037
  key = key?.clone({}, { $warning: {
@@ -1046,11 +1066,10 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
1046
1066
  * @param parameters The parameters for handling the object.
1047
1067
  * @returns A promise that resolves to an HTTP response.
1048
1068
  */
1049
- async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
1069
+ async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
1050
1070
  if (objectDispatcher == null) return await onNotFound(request);
1051
1071
  const object = await objectDispatcher(context$1, values);
1052
1072
  if (object == null) return await onNotFound(request);
1053
- if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
1054
1073
  if (authorizePredicate != null) {
1055
1074
  let key = await context$1.getSignedKey();
1056
1075
  key = key?.clone({}, { $warning: {
@@ -1088,7 +1107,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
1088
1107
  * @param parameters The parameters for handling the collection.
1089
1108
  * @returns A promise that resolves to an HTTP response.
1090
1109
  */
1091
- async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
1110
+ async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
1092
1111
  const spanName = name.trim().replace(/\s+/g, "_");
1093
1112
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
1094
1113
  const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
@@ -1201,7 +1220,6 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
1201
1220
  partOf
1202
1221
  });
1203
1222
  }
1204
- if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
1205
1223
  if (collectionCallbacks.authorizePredicate != null) {
1206
1224
  let key = await context$1.getSignedKey();
1207
1225
  key = key?.clone({}, { $warning: {
@@ -1296,7 +1314,8 @@ async function handleInbox(request, options) {
1296
1314
  * @param span The OpenTelemetry span for tracing.
1297
1315
  * @returns A promise that resolves to an HTTP response.
1298
1316
  */
1299
- async function handleInboxInternal(request, { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider }, span) {
1317
+ async function handleInboxInternal(request, parameters, span) {
1318
+ const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider } = parameters;
1300
1319
  const logger$1 = getLogger([
1301
1320
  "fedify",
1302
1321
  "federation",
@@ -1470,6 +1489,13 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
1470
1489
  }
1471
1490
  if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
1472
1491
  span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
1492
+ span.addEvent("activitypub.activity.received", {
1493
+ "activitypub.activity.json": JSON.stringify(json),
1494
+ "activitypub.activity.verified": activity != null,
1495
+ "ld_signatures.verified": ldSigVerified,
1496
+ "http_signatures.verified": httpSigKey != null,
1497
+ "http_signatures.key_id": httpSigKey?.id?.href ?? ""
1498
+ });
1473
1499
  if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
1474
1500
  logger$1.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
1475
1501
  activity: json,
@@ -1498,7 +1524,8 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
1498
1524
  kvPrefixes,
1499
1525
  queue,
1500
1526
  span,
1501
- tracerProvider
1527
+ tracerProvider,
1528
+ idempotencyStrategy: parameters.idempotencyStrategy
1502
1529
  });
1503
1530
  if (routeResult === "alreadyProcessed") return new Response(`Activity <${activity.id}> has already been processed.`, {
1504
1531
  status: 202,
@@ -1528,7 +1555,7 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
1528
1555
  /**
1529
1556
  * Handles a custom collection request.
1530
1557
  * @template TItem The type of items in the collection.
1531
- * @template TParams The parameter names of the requested URL.
1558
+ * @template TParam The parameter names of the requested URL.
1532
1559
  * @template TContext The type of the context, extending {@link RequestContext}.
1533
1560
  * @template TContextData The context data to pass to the `TContext`.
1534
1561
  * @param request The HTTP request.
@@ -1539,7 +1566,6 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
1539
1566
  const handleCustomCollection = exceptWrapper(_handleCustomCollection);
1540
1567
  async function _handleCustomCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1541
1568
  verifyDefined(callbacks);
1542
- verifyJsonLdRequest(request);
1543
1569
  await authIfNeeded(context$1, values, callbacks);
1544
1570
  const cursor = new URL(request.url).searchParams.get("cursor");
1545
1571
  return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, Collection, CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
@@ -1547,7 +1573,7 @@ async function _handleCustomCollection(request, { name, values, context: context
1547
1573
  /**
1548
1574
  * Handles an ordered collection request.
1549
1575
  * @template TItem The type of items in the collection.
1550
- * @template TParams The parameter names of the requested URL.
1576
+ * @template TParam The parameter names of the requested URL.
1551
1577
  * @template TContext The type of the context, extending {@link RequestContext}.
1552
1578
  * @template TContextData The context data to pass to the `TContext`.
1553
1579
  * @param request The HTTP request.
@@ -1558,7 +1584,6 @@ async function _handleCustomCollection(request, { name, values, context: context
1558
1584
  const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
1559
1585
  async function _handleOrderedCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1560
1586
  verifyDefined(callbacks);
1561
- verifyJsonLdRequest(request);
1562
1587
  await authIfNeeded(context$1, values, callbacks);
1563
1588
  const cursor = new URL(request.url).searchParams.get("cursor");
1564
1589
  return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, OrderedCollection, OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
@@ -1568,7 +1593,7 @@ async function _handleOrderedCollection(request, { name, values, context: contex
1568
1593
  * The main flow is on `getCollection`, `dispatch`.
1569
1594
  *
1570
1595
  * @template TItem The type of items in the collection.
1571
- * @template TParams The parameter names of the requested URL.
1596
+ * @template TParam The parameter names of the requested URL.
1572
1597
  * @template TContext The type of the context. {@link Context} or {@link RequestContext}.
1573
1598
  * @template TContextData The context data to pass to the `TContext`.
1574
1599
  * @template TCollection The type of the collection, extending {@link Collection}.
@@ -1602,14 +1627,14 @@ var CustomCollectionHandler = class {
1602
1627
  #collection = null;
1603
1628
  /**
1604
1629
  * Creates a new CustomCollection instance.
1605
- * @param {string} name The name of the collection.
1606
- * @param {TParams} values The parameter values for the collection.
1607
- * @param {TContext} context The request context.
1608
- * @param {CustomCollectionCallbacks} callbacks The collection callbacks.
1609
- * @param {TracerProvider} tracerProvider The tracer provider for telemetry.
1610
- * @param {ConstructorWithTypeId<TCollection>} Collection The Collection constructor.
1611
- * @param {ConstructorWithTypeId<TCollectionPage>} CollectionPage The CollectionPage constructor.
1612
- * @param {(item: TItem) => boolean} filterPredicate Optional filter predicate for items.
1630
+ * @param name The name of the collection.
1631
+ * @param values The parameter values for the collection.
1632
+ * @param context The request context.
1633
+ * @param callbacks The collection callbacks.
1634
+ * @param tracerProvider The tracer provider for telemetry.
1635
+ * @param Collection The Collection constructor.
1636
+ * @param CollectionPage The CollectionPage constructor.
1637
+ * @param filterPredicate Optional filter predicate for items.
1613
1638
  */
1614
1639
  constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
1615
1640
  this.name = name;
@@ -1734,7 +1759,7 @@ var CustomCollectionHandler = class {
1734
1759
  /**
1735
1760
  * Creates a function to wrap the dispatcher so tracing can be applied.
1736
1761
  * @param params Parameters including cursor and total items.
1737
- * @returns {(span: Span) => Promise<PageItems<TItem>>} A function that handles the span operation.
1762
+ * @returns A function that handles the span operation.
1738
1763
  */
1739
1764
  spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
1740
1765
  try {
@@ -1755,23 +1780,23 @@ var CustomCollectionHandler = class {
1755
1780
  };
1756
1781
  /**
1757
1782
  * Dispatches the collection request to get items.
1758
- * @param {string | null} cursor The cursor for pagination, or null for the first page.
1759
- * @returns {Promise<PageItems<TItem>>} A promise that resolves to the page items.
1783
+ * @param cursor The cursor for pagination, or null for the first page.
1784
+ * @returns A promise that resolves to the page items.
1760
1785
  */
1761
1786
  async dispatch(cursor = null) {
1762
1787
  return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
1763
1788
  }
1764
1789
  /**
1765
1790
  * Filters the items in the collection.
1766
- * @param {TItem[]} items The items to filter.
1767
- * @returns {(Object | Link | URL)[]} The filtered items.
1791
+ * @param items The items to filter.
1792
+ * @returns The filtered items.
1768
1793
  */
1769
1794
  filterItems(items) {
1770
1795
  return filterCollectionItems(items, this.name, this.filterPredicate);
1771
1796
  }
1772
1797
  /**
1773
1798
  * Appends a cursor to the URL if it exists.
1774
- * @param {string | null | undefined} cursor The cursor to append, or null/undefined.
1799
+ * @param cursor The cursor to append, or null/undefined.
1775
1800
  * @returns The URL with cursor appended, or null if cursor is null/undefined.
1776
1801
  */
1777
1802
  appendToUrl(cursor) {
@@ -1779,8 +1804,7 @@ var CustomCollectionHandler = class {
1779
1804
  }
1780
1805
  /**
1781
1806
  * Gets the stored collection or collection page.
1782
- * @returns {Promise<TCollection | TCollectionPage>} A promise that resolves to
1783
- the collection or collection page.
1807
+ * @returns A promise that resolves to the collection or collection page.
1784
1808
  */
1785
1809
  get collection() {
1786
1810
  if (this.#collection === null) this.#collection = this.getCollection();
@@ -1788,8 +1812,8 @@ var CustomCollectionHandler = class {
1788
1812
  }
1789
1813
  /**
1790
1814
  * Gets the total number of items in the collection.
1791
- * @returns {Promise<number | null>} A promise that
1792
- resolves to the total items count, or null if not available.
1815
+ * @returns A promise that resolves to the total items count,
1816
+ * or null if not available.
1793
1817
  */
1794
1818
  get totalItems() {
1795
1819
  if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
@@ -1805,8 +1829,8 @@ var CustomCollectionHandler = class {
1805
1829
  }
1806
1830
  /**
1807
1831
  * Gets the first cursor for pagination.
1808
- * @returns {Promise<string | null>} A promise that resolves to the first cursor,
1809
- or null if not available.
1832
+ * @returns A promise that resolves to the first cursor,
1833
+ * or null if not available.
1810
1834
  */
1811
1835
  get firstCursor() {
1812
1836
  const cursor = this.callbacks.firstCursor?.(this.context, this.values);
@@ -1836,10 +1860,9 @@ function exceptWrapper(handler) {
1836
1860
  try {
1837
1861
  return await handler(request, handlerParams);
1838
1862
  } catch (error) {
1839
- const { onNotFound, onNotAcceptable, onUnauthorized } = handlerParams;
1863
+ const { onNotFound, onUnauthorized } = handlerParams;
1840
1864
  switch (error?.constructor) {
1841
1865
  case ItemsNotFoundError: return await onNotFound(request);
1842
- case NotAcceptableError: return await onNotAcceptable(request);
1843
1866
  case UnauthorizedError: return await onUnauthorized(request);
1844
1867
  default: throw error;
1845
1868
  }
@@ -1857,15 +1880,6 @@ const verifyDefined = (callbacks) => {
1857
1880
  if (callbacks === void 0) throw new ItemsNotFoundError();
1858
1881
  };
1859
1882
  /**
1860
- * Verifies that a request accepts JSON-LD content type.
1861
- * @param request The HTTP request to verify.
1862
- * @throws {NotAcceptableError} If the request doesn't accept JSON-LD.
1863
- * @since 1.8.0
1864
- */
1865
- const verifyJsonLdRequest = (request) => {
1866
- if (!acceptsJsonLd(request)) throw new NotAcceptableError();
1867
- };
1868
- /**
1869
1883
  * Performs authorization if needed based on the authorization predicate.
1870
1884
  * @template TContextData The context data type.
1871
1885
  * @param {RequestContext<TContextData>} context The request context.
@@ -1949,15 +1963,6 @@ var ItemsNotFoundError = class extends HandlerError {
1949
1963
  }
1950
1964
  };
1951
1965
  /**
1952
- * Error thrown when the request is not acceptable (e.g., wrong content type).
1953
- * @since 1.8.0
1954
- */
1955
- var NotAcceptableError = class extends HandlerError {
1956
- constructor() {
1957
- super("The request is not acceptable.");
1958
- }
1959
- };
1960
- /**
1961
1966
  * Error thrown when access to a collection is unauthorized.
1962
1967
  * @since 1.8.0
1963
1968
  */
@@ -2031,139 +2036,6 @@ function handleNodeInfoJrd(_request, context$1) {
2031
2036
  return Promise.resolve(response);
2032
2037
  }
2033
2038
 
2034
- //#endregion
2035
- //#region src/webfinger/handler.ts
2036
- const logger = getLogger([
2037
- "fedify",
2038
- "webfinger",
2039
- "server"
2040
- ]);
2041
- /**
2042
- * Handles a WebFinger request. You would not typically call this function
2043
- * directly, but instead use {@link Federation.fetch} method.
2044
- * @param request The WebFinger request to handle.
2045
- * @param parameters The parameters for handling the request.
2046
- * @returns The response to the request.
2047
- */
2048
- async function handleWebFinger(request, options) {
2049
- if (options.tracer == null) return await handleWebFingerInternal(request, options);
2050
- return await options.tracer.startActiveSpan("webfinger.handle", { kind: SpanKind.SERVER }, async (span) => {
2051
- try {
2052
- const response = await handleWebFingerInternal(request, options);
2053
- span.setStatus({ code: response.ok ? SpanStatusCode.UNSET : SpanStatusCode.ERROR });
2054
- return response;
2055
- } catch (error) {
2056
- span.setStatus({
2057
- code: SpanStatusCode.ERROR,
2058
- message: String(error)
2059
- });
2060
- throw error;
2061
- } finally {
2062
- span.end();
2063
- }
2064
- });
2065
- }
2066
- async function handleWebFingerInternal(request, { context: context$1, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
2067
- if (actorDispatcher == null) {
2068
- logger.error("Actor dispatcher is not set.");
2069
- return await onNotFound(request);
2070
- }
2071
- const resource = context$1.url.searchParams.get("resource");
2072
- if (resource == null) return new Response("Missing resource parameter.", { status: 400 });
2073
- span?.setAttribute("webfinger.resource", resource);
2074
- let resourceUrl;
2075
- try {
2076
- resourceUrl = new URL(resource);
2077
- } catch (e) {
2078
- if (e instanceof TypeError) return new Response("Invalid resource URL.", { status: 400 });
2079
- throw e;
2080
- }
2081
- span?.setAttribute("webfinger.resource.scheme", resourceUrl.protocol.replace(/:$/, ""));
2082
- async function mapUsernameToIdentifier(username) {
2083
- if (actorHandleMapper == null) {
2084
- logger.error("No actor handle mapper is set; use the WebFinger username {username} as the actor's internal identifier.", { username });
2085
- return username;
2086
- }
2087
- const identifier$1 = await actorHandleMapper(context$1, username);
2088
- if (identifier$1 == null) {
2089
- logger.error("Actor {username} not found.", { username });
2090
- return null;
2091
- }
2092
- return identifier$1;
2093
- }
2094
- let identifier = null;
2095
- const uriParsed = context$1.parseUri(resourceUrl);
2096
- if (uriParsed?.type != "actor") {
2097
- const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
2098
- if (match == null) {
2099
- const result = await actorAliasMapper?.(context$1, resourceUrl);
2100
- if (result == null) return await onNotFound(request);
2101
- if ("identifier" in result) identifier = result.identifier;
2102
- else identifier = await mapUsernameToIdentifier(result.username);
2103
- } else {
2104
- const portMatch = /:\d+$/.exec(match[2]);
2105
- const normalizedHost = portMatch == null ? domainToASCII(match[2].toLowerCase()) : domainToASCII(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
2106
- if (normalizedHost != context$1.url.host && normalizedHost != host) return await onNotFound(request);
2107
- else {
2108
- identifier = await mapUsernameToIdentifier(match[1]);
2109
- resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
2110
- }
2111
- }
2112
- } else identifier = uriParsed.identifier;
2113
- if (identifier == null) return await onNotFound(request);
2114
- const actor = await actorDispatcher(context$1, identifier);
2115
- if (actor == null) {
2116
- logger.error("Actor {identifier} not found.", { identifier });
2117
- return await onNotFound(request);
2118
- }
2119
- const links = [{
2120
- rel: "self",
2121
- href: context$1.getActorUri(identifier).href,
2122
- type: "application/activity+json"
2123
- }];
2124
- for (const url of actor.urls) if (url instanceof Link && url.href != null) links.push({
2125
- rel: url.rel ?? "http://webfinger.net/rel/profile-page",
2126
- href: url.href.href,
2127
- type: url.mediaType == null ? void 0 : url.mediaType
2128
- });
2129
- else if (url instanceof URL) links.push({
2130
- rel: "http://webfinger.net/rel/profile-page",
2131
- href: url.href
2132
- });
2133
- for await (const image of actor.getIcons()) {
2134
- if (image.url?.href == null) continue;
2135
- const link = {
2136
- rel: "http://webfinger.net/rel/avatar",
2137
- href: image.url.href.toString()
2138
- };
2139
- if (image.mediaType != null) link.type = image.mediaType;
2140
- links.push(link);
2141
- }
2142
- if (webFingerLinksDispatcher != null) {
2143
- const customLinks = await webFingerLinksDispatcher(context$1, resourceUrl);
2144
- if (customLinks != null) for (const link of customLinks) links.push(link);
2145
- }
2146
- const aliases = [];
2147
- if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
2148
- aliases.push(`acct:${actor.preferredUsername}@${host ?? context$1.url.host}`);
2149
- if (host != null && host !== context$1.url.host) aliases.push(`acct:${actor.preferredUsername}@${context$1.url.host}`);
2150
- }
2151
- if (resourceUrl.href !== context$1.getActorUri(identifier).href) aliases.push(context$1.getActorUri(identifier).href);
2152
- if (resourceUrl.protocol === "acct:" && host != null && host !== context$1.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
2153
- const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
2154
- aliases.push(`acct:${username}@${host}`);
2155
- }
2156
- const jrd = {
2157
- subject: resourceUrl.href,
2158
- aliases,
2159
- links
2160
- };
2161
- return new Response(JSON.stringify(jrd), { headers: {
2162
- "Content-Type": "application/jrd+json",
2163
- "Access-Control-Allow-Origin": "*"
2164
- } });
2165
- }
2166
-
2167
2039
  //#endregion
2168
2040
  //#region src/federation/retry.ts
2169
2041
  /**
@@ -2190,8 +2062,8 @@ function createExponentialBackoffPolicy(options = {}) {
2190
2062
  milliseconds *= 1 + Math.random();
2191
2063
  milliseconds = Math.round(milliseconds);
2192
2064
  }
2193
- const delay$1 = Temporal.Duration.from({ milliseconds });
2194
- return Temporal.Duration.compare(delay$1, maxDelay) > 0 ? maxDelay : delay$1;
2065
+ const delay = Temporal.Duration.from({ milliseconds });
2066
+ return Temporal.Duration.compare(delay, maxDelay) > 0 ? maxDelay : delay;
2195
2067
  };
2196
2068
  }
2197
2069
 
@@ -2243,7 +2115,7 @@ function sendActivity(options) {
2243
2115
  await sendActivityInternal({
2244
2116
  ...options,
2245
2117
  tracerProvider
2246
- });
2118
+ }, span);
2247
2119
  } catch (e) {
2248
2120
  span.setStatus({
2249
2121
  code: SpanStatusCode.ERROR,
@@ -2255,7 +2127,7 @@ function sendActivity(options) {
2255
2127
  }
2256
2128
  });
2257
2129
  }
2258
- async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }) {
2130
+ async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
2259
2131
  const logger$1 = getLogger([
2260
2132
  "fedify",
2261
2133
  "federation",
@@ -2310,6 +2182,143 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
2310
2182
  });
2311
2183
  throw new Error(`Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`);
2312
2184
  }
2185
+ span.addEvent("activitypub.activity.sent", {
2186
+ "activitypub.activity.json": JSON.stringify(activity),
2187
+ "activitypub.inbox.url": inbox.href,
2188
+ "activitypub.activity.id": activityId ?? ""
2189
+ });
2190
+ }
2191
+
2192
+ //#endregion
2193
+ //#region src/federation/webfinger.ts
2194
+ const logger = getLogger([
2195
+ "fedify",
2196
+ "webfinger",
2197
+ "server"
2198
+ ]);
2199
+ /**
2200
+ * Handles a WebFinger request. You would not typically call this function
2201
+ * directly, but instead use {@link Federation.fetch} method.
2202
+ * @param request The WebFinger request to handle.
2203
+ * @param parameters The parameters for handling the request.
2204
+ * @returns The response to the request.
2205
+ */
2206
+ async function handleWebFinger(request, options) {
2207
+ if (options.tracer == null) return await handleWebFingerInternal(request, options);
2208
+ return await options.tracer.startActiveSpan("webfinger.handle", { kind: SpanKind.SERVER }, async (span) => {
2209
+ try {
2210
+ const response = await handleWebFingerInternal(request, options);
2211
+ span.setStatus({ code: response.ok ? SpanStatusCode.UNSET : SpanStatusCode.ERROR });
2212
+ return response;
2213
+ } catch (error) {
2214
+ span.setStatus({
2215
+ code: SpanStatusCode.ERROR,
2216
+ message: String(error)
2217
+ });
2218
+ throw error;
2219
+ } finally {
2220
+ span.end();
2221
+ }
2222
+ });
2223
+ }
2224
+ async function handleWebFingerInternal(request, { context: context$1, host, actorDispatcher, actorHandleMapper, actorAliasMapper, onNotFound, span, webFingerLinksDispatcher }) {
2225
+ if (actorDispatcher == null) {
2226
+ logger.error("Actor dispatcher is not set.");
2227
+ return await onNotFound(request);
2228
+ }
2229
+ const resource = context$1.url.searchParams.get("resource");
2230
+ if (resource == null) return new Response("Missing resource parameter.", { status: 400 });
2231
+ span?.setAttribute("webfinger.resource", resource);
2232
+ let resourceUrl;
2233
+ try {
2234
+ resourceUrl = new URL(resource);
2235
+ } catch (e) {
2236
+ if (e instanceof TypeError) return new Response("Invalid resource URL.", { status: 400 });
2237
+ throw e;
2238
+ }
2239
+ span?.setAttribute("webfinger.resource.scheme", resourceUrl.protocol.replace(/:$/, ""));
2240
+ async function mapUsernameToIdentifier(username) {
2241
+ if (actorHandleMapper == null) {
2242
+ logger.error("No actor handle mapper is set; use the WebFinger username {username} as the actor's internal identifier.", { username });
2243
+ return username;
2244
+ }
2245
+ const identifier$1 = await actorHandleMapper(context$1, username);
2246
+ if (identifier$1 == null) {
2247
+ logger.error("Actor {username} not found.", { username });
2248
+ return null;
2249
+ }
2250
+ return identifier$1;
2251
+ }
2252
+ let identifier = null;
2253
+ const uriParsed = context$1.parseUri(resourceUrl);
2254
+ if (uriParsed?.type != "actor") {
2255
+ const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
2256
+ if (match == null) {
2257
+ const result = await actorAliasMapper?.(context$1, resourceUrl);
2258
+ if (result == null) return await onNotFound(request);
2259
+ if ("identifier" in result) identifier = result.identifier;
2260
+ else identifier = await mapUsernameToIdentifier(result.username);
2261
+ } else {
2262
+ const portMatch = /:\d+$/.exec(match[2]);
2263
+ const normalizedHost = portMatch == null ? domainToASCII(match[2].toLowerCase()) : domainToASCII(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
2264
+ if (normalizedHost != context$1.url.host && normalizedHost != host) return await onNotFound(request);
2265
+ else {
2266
+ identifier = await mapUsernameToIdentifier(match[1]);
2267
+ resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
2268
+ }
2269
+ }
2270
+ } else identifier = uriParsed.identifier;
2271
+ if (identifier == null) return await onNotFound(request);
2272
+ const actor = await actorDispatcher(context$1, identifier);
2273
+ if (actor == null) {
2274
+ logger.error("Actor {identifier} not found.", { identifier });
2275
+ return await onNotFound(request);
2276
+ }
2277
+ const links = [{
2278
+ rel: "self",
2279
+ href: context$1.getActorUri(identifier).href,
2280
+ type: "application/activity+json"
2281
+ }];
2282
+ for (const url of actor.urls) if (url instanceof Link && url.href != null) links.push({
2283
+ rel: url.rel ?? "http://webfinger.net/rel/profile-page",
2284
+ href: url.href.href,
2285
+ type: url.mediaType == null ? void 0 : url.mediaType
2286
+ });
2287
+ else if (url instanceof URL) links.push({
2288
+ rel: "http://webfinger.net/rel/profile-page",
2289
+ href: url.href
2290
+ });
2291
+ for await (const image of actor.getIcons()) {
2292
+ if (image.url?.href == null) continue;
2293
+ links.push({
2294
+ rel: "http://webfinger.net/rel/avatar",
2295
+ href: image.url.href.toString(),
2296
+ ...image.mediaType != null && { type: image.mediaType }
2297
+ });
2298
+ }
2299
+ if (webFingerLinksDispatcher != null) {
2300
+ const customLinks = await webFingerLinksDispatcher(context$1, resourceUrl);
2301
+ if (customLinks != null) for (const link of customLinks) links.push(link);
2302
+ }
2303
+ const aliases = [];
2304
+ if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
2305
+ aliases.push(`acct:${actor.preferredUsername}@${host ?? context$1.url.host}`);
2306
+ if (host != null && host !== context$1.url.host) aliases.push(`acct:${actor.preferredUsername}@${context$1.url.host}`);
2307
+ }
2308
+ if (resourceUrl.href !== context$1.getActorUri(identifier).href) aliases.push(context$1.getActorUri(identifier).href);
2309
+ if (resourceUrl.protocol === "acct:" && host != null && host !== context$1.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
2310
+ const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
2311
+ aliases.push(`acct:${username}@${host}`);
2312
+ }
2313
+ const jrd = {
2314
+ subject: resourceUrl.href,
2315
+ aliases,
2316
+ links
2317
+ };
2318
+ return new Response(JSON.stringify(jrd), { headers: {
2319
+ "Content-Type": "application/jrd+json",
2320
+ "Access-Control-Allow-Origin": "*"
2321
+ } });
2313
2322
  }
2314
2323
 
2315
2324
  //#endregion
@@ -2349,7 +2358,6 @@ var FederationImpl = class extends FederationBuilderImpl {
2349
2358
  firstKnock;
2350
2359
  constructor(options) {
2351
2360
  super();
2352
- const logger$1 = getLogger(["fedify", "federation"]);
2353
2361
  this.kv = options.kv;
2354
2362
  this.kvPrefixes = {
2355
2363
  activityIdempotence: ["_fedify", "activityIdempotence"],
@@ -2397,8 +2405,9 @@ var FederationImpl = class extends FederationBuilderImpl {
2397
2405
  this.router.trailingSlashInsensitive = options.trailingSlashInsensitive ?? false;
2398
2406
  this._initializeRouter();
2399
2407
  if (options.allowPrivateAddress || options.userAgent != null) {
2400
- if (options.contextLoader != null) throw new TypeError("Cannot set contextLoader with allowPrivateAddress or userAgent options.");
2401
- else if (options.authenticatedDocumentLoaderFactory != null) throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with allowPrivateAddress or userAgent options.");
2408
+ if (options.documentLoaderFactory != null) throw new TypeError("Cannot set documentLoaderFactory with allowPrivateAddress or userAgent options.");
2409
+ if (options.contextLoaderFactory != null) throw new TypeError("Cannot set contextLoaderFactory with allowPrivateAddress or userAgent options.");
2410
+ if (options.authenticatedDocumentLoaderFactory != null) throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with allowPrivateAddress or userAgent options.");
2402
2411
  }
2403
2412
  const { allowPrivateAddress, userAgent } = options;
2404
2413
  this.allowPrivateAddress = allowPrivateAddress ?? false;
@@ -2412,11 +2421,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2412
2421
  prefix: this.kvPrefixes.remoteDocument
2413
2422
  });
2414
2423
  });
2415
- if (options.contextLoader != null) {
2416
- if (options.contextLoaderFactory != null) throw new TypeError("Cannot set both contextLoader and contextLoaderFactory options at a time; use contextLoaderFactory only.");
2417
- this.contextLoaderFactory = () => options.contextLoader;
2418
- logger$1.warn("The contextLoader option is deprecated; use contextLoaderFactory option instead.");
2419
- } else this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
2424
+ this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
2420
2425
  this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => getAuthenticatedDocumentLoader(identity, {
2421
2426
  allowPrivateAddress,
2422
2427
  userAgent,
@@ -2620,11 +2625,11 @@ var FederationImpl = class extends FederationBuilderImpl {
2620
2625
  });
2621
2626
  throw error;
2622
2627
  }
2623
- const delay$1 = this.outboxRetryPolicy({
2628
+ const delay = this.outboxRetryPolicy({
2624
2629
  elapsedTime: Temporal.Instant.from(message.started).until(Temporal.Now.instant()),
2625
2630
  attempts: message.attempt
2626
2631
  });
2627
- if (delay$1 != null) {
2632
+ if (delay != null) {
2628
2633
  logger$1.error("Failed to send activity {activityId} to {inbox} (attempt #{attempt}); retry...:\n{error}", {
2629
2634
  ...logData,
2630
2635
  error
@@ -2632,7 +2637,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2632
2637
  await this.outboxQueue?.enqueue({
2633
2638
  ...message,
2634
2639
  attempt: message.attempt + 1
2635
- }, { delay: Temporal.Duration.compare(delay$1, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay$1 });
2640
+ }, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
2636
2641
  } else logger$1.error("Failed to send activity {activityId} to {inbox} after {attempt} attempts; giving up:\n{error}", {
2637
2642
  ...logData,
2638
2643
  error
@@ -2719,11 +2724,11 @@ var FederationImpl = class extends FederationBuilderImpl {
2719
2724
  span$1.end();
2720
2725
  throw error;
2721
2726
  }
2722
- const delay$1 = this.inboxRetryPolicy({
2727
+ const delay = this.inboxRetryPolicy({
2723
2728
  elapsedTime: Temporal.Instant.from(message.started).until(Temporal.Now.instant()),
2724
2729
  attempts: message.attempt
2725
2730
  });
2726
- if (delay$1 != null) {
2731
+ if (delay != null) {
2727
2732
  logger$1.error("Failed to process the incoming activity {activityId} (attempt #{attempt}); retry...:\n{error}", {
2728
2733
  error,
2729
2734
  attempt: message.attempt,
@@ -2734,7 +2739,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2734
2739
  await this.inboxQueue?.enqueue({
2735
2740
  ...message,
2736
2741
  attempt: message.attempt + 1
2737
- }, { delay: Temporal.Duration.compare(delay$1, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay$1 });
2742
+ }, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
2738
2743
  } else logger$1.error("Failed to process the incoming activity {activityId} after {trial} attempts; giving up:\n{error}", {
2739
2744
  error,
2740
2745
  activityId: activity.id?.href,
@@ -2955,6 +2960,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2955
2960
  span,
2956
2961
  tracer
2957
2962
  });
2963
+ if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
2958
2964
  } catch (error) {
2959
2965
  span.setStatus({
2960
2966
  code: SpanStatusCode.ERROR,
@@ -3018,6 +3024,9 @@ var FederationImpl = class extends FederationBuilderImpl {
3018
3024
  context: context$1,
3019
3025
  nodeInfoDispatcher: this.nodeInfoDispatcher
3020
3026
  });
3027
+ }
3028
+ if (request.method !== "POST" && !acceptsJsonLd(request)) return await onNotAcceptable(request);
3029
+ switch (routeName) {
3021
3030
  case "actor":
3022
3031
  context$1 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
3023
3032
  return await handleActor(request, {
@@ -3026,8 +3035,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3026
3035
  actorDispatcher: this.actorCallbacks?.dispatcher,
3027
3036
  authorizePredicate: this.actorCallbacks?.authorizePredicate,
3028
3037
  onUnauthorized,
3029
- onNotFound,
3030
- onNotAcceptable
3038
+ onNotFound
3031
3039
  });
3032
3040
  case "object": {
3033
3041
  const typeId = route.name.replace(/^object:/, "");
@@ -3043,8 +3051,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3043
3051
  objectDispatcher: callbacks?.dispatcher,
3044
3052
  authorizePredicate: callbacks?.authorizePredicate,
3045
3053
  onUnauthorized,
3046
- onNotFound,
3047
- onNotAcceptable
3054
+ onNotFound
3048
3055
  });
3049
3056
  }
3050
3057
  case "outbox": return await handleCollection(request, {
@@ -3055,8 +3062,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3055
3062
  collectionCallbacks: this.outboxCallbacks,
3056
3063
  tracerProvider: this.tracerProvider,
3057
3064
  onUnauthorized,
3058
- onNotFound,
3059
- onNotAcceptable
3065
+ onNotFound
3060
3066
  });
3061
3067
  case "inbox":
3062
3068
  if (request.method !== "POST") return await handleCollection(request, {
@@ -3067,8 +3073,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3067
3073
  collectionCallbacks: this.inboxCallbacks,
3068
3074
  tracerProvider: this.tracerProvider,
3069
3075
  onUnauthorized,
3070
- onNotFound,
3071
- onNotAcceptable
3076
+ onNotFound
3072
3077
  });
3073
3078
  context$1 = this.#createContext(request, contextData, { documentLoader: await context$1.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
3074
3079
  case "sharedInbox":
@@ -3090,7 +3095,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3090
3095
  onNotFound,
3091
3096
  signatureTimeWindow: this.signatureTimeWindow,
3092
3097
  skipSignatureVerification: this.skipSignatureVerification,
3093
- tracerProvider: this.tracerProvider
3098
+ tracerProvider: this.tracerProvider,
3099
+ idempotencyStrategy: this.idempotencyStrategy
3094
3100
  });
3095
3101
  case "following": return await handleCollection(request, {
3096
3102
  name: "following",
@@ -3100,8 +3106,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3100
3106
  collectionCallbacks: this.followingCallbacks,
3101
3107
  tracerProvider: this.tracerProvider,
3102
3108
  onUnauthorized,
3103
- onNotFound,
3104
- onNotAcceptable
3109
+ onNotFound
3105
3110
  });
3106
3111
  case "followers": {
3107
3112
  let baseUrl = url.searchParams.get("base-url");
@@ -3124,8 +3129,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3124
3129
  collectionCallbacks: this.followersCallbacks,
3125
3130
  tracerProvider: this.tracerProvider,
3126
3131
  onUnauthorized,
3127
- onNotFound,
3128
- onNotAcceptable
3132
+ onNotFound
3129
3133
  });
3130
3134
  }
3131
3135
  case "liked": return await handleCollection(request, {
@@ -3136,8 +3140,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3136
3140
  collectionCallbacks: this.likedCallbacks,
3137
3141
  tracerProvider: this.tracerProvider,
3138
3142
  onUnauthorized,
3139
- onNotFound,
3140
- onNotAcceptable
3143
+ onNotFound
3141
3144
  });
3142
3145
  case "featured": return await handleCollection(request, {
3143
3146
  name: "featured",
@@ -3147,8 +3150,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3147
3150
  collectionCallbacks: this.featuredCallbacks,
3148
3151
  tracerProvider: this.tracerProvider,
3149
3152
  onUnauthorized,
3150
- onNotFound,
3151
- onNotAcceptable
3153
+ onNotFound
3152
3154
  });
3153
3155
  case "featuredTags": return await handleCollection(request, {
3154
3156
  name: "featured tags",
@@ -3158,8 +3160,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3158
3160
  collectionCallbacks: this.featuredTagsCallbacks,
3159
3161
  tracerProvider: this.tracerProvider,
3160
3162
  onUnauthorized,
3161
- onNotFound,
3162
- onNotAcceptable
3163
+ onNotFound
3163
3164
  });
3164
3165
  case "collection": {
3165
3166
  const name = route.name.replace(/^collection:/, "");
@@ -3171,8 +3172,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3171
3172
  collectionCallbacks: callbacks,
3172
3173
  tracerProvider: this.tracerProvider,
3173
3174
  onUnauthorized,
3174
- onNotFound,
3175
- onNotAcceptable
3175
+ onNotFound
3176
3176
  });
3177
3177
  }
3178
3178
  case "orderedCollection": {
@@ -3185,8 +3185,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3185
3185
  collectionCallbacks: callbacks,
3186
3186
  tracerProvider: this.tracerProvider,
3187
3187
  onUnauthorized,
3188
- onNotFound,
3189
- onNotAcceptable
3188
+ onNotFound
3190
3189
  });
3191
3190
  }
3192
3191
  default: {
@@ -3840,7 +3839,8 @@ var ContextImpl = class ContextImpl {
3840
3839
  kvPrefixes: this.federation.kvPrefixes,
3841
3840
  queue: this.federation.inboxQueue,
3842
3841
  span,
3843
- tracerProvider: options.tracerProvider ?? this.tracerProvider
3842
+ tracerProvider: options.tracerProvider ?? this.tracerProvider,
3843
+ idempotencyStrategy: this.federation.idempotencyStrategy
3844
3844
  });
3845
3845
  return routeResult === "alreadyProcessed" || routeResult === "enqueued" || routeResult === "unsupportedActivity" || routeResult === "success";
3846
3846
  }
@@ -4154,4 +4154,4 @@ function getRequestId(request) {
4154
4154
  }
4155
4155
 
4156
4156
  //#endregion
4157
- export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, Router$1 as Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
4157
+ export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, Router$1 as Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };