@fedify/fedify 2.0.0-dev.1485 → 2.0.0-dev.150

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