@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
@@ -1,14 +1,11 @@
1
- import { KvKey, KvStore } from "./kv-63Cil1MD.cjs";
2
- import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "./docloader-D-MrRyHl.cjs";
3
- import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-CegPX0Rn.cjs";
4
- import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-DJTYMqyU.cjs";
5
- import { Actor, Recipient } from "./actor-DMgu-ZjT.cjs";
6
- import { HttpMessageSignaturesSpec } from "./http-BS6766zs.cjs";
7
- import { GetKeyOwnerOptions } from "./owner-B-7Ptt_m.cjs";
8
- import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-evzlRVZq.cjs";
9
- import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-jQ4OODsl.cjs";
10
- import { MessageQueue } from "./mq-B7R1Q-M5.cjs";
11
- import { Span, TracerProvider } from "@opentelemetry/api";
1
+ import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-by-PEGAJ.cjs";
2
+ import { HttpMessageSignaturesSpec } from "./http-ClB3pLcL.cjs";
3
+ import { GetKeyOwnerOptions } from "./owner-C-zfmVAD.cjs";
4
+ import { KvKey, KvStore } from "./kv-B4vFhIYL.cjs";
5
+ import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
6
+ import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
7
+ import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
8
+ import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
12
9
 
13
10
  //#region src/compat/types.d.ts
14
11
  /**
@@ -22,9 +19,9 @@ type ActivityTransformer<TContextData> = (activity: Activity, context: Context<T
22
19
  * A page of items.
23
20
  */
24
21
  interface PageItems<TItem> {
25
- prevCursor?: string | null;
26
- nextCursor?: string | null;
27
- items: TItem[];
22
+ readonly prevCursor?: string | null;
23
+ readonly nextCursor?: string | null;
24
+ readonly items: readonly TItem[];
28
25
  }
29
26
  /**
30
27
  * Calculates the [partial follower collection digest][1].
@@ -54,11 +51,11 @@ interface SenderKeyPair {
54
51
  /**
55
52
  * The actor's private key to sign the request.
56
53
  */
57
- privateKey: CryptoKey;
54
+ readonly privateKey: CryptoKey;
58
55
  /**
59
56
  * The public key ID that corresponds to the private key.
60
57
  */
61
- keyId: URL;
58
+ readonly keyId: URL;
62
59
  }
63
60
  /**
64
61
  * Parameters for {@link sendActivity}.
@@ -281,7 +278,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
281
278
  * the entire collection without pagination.
282
279
  * @since 1.8.0
283
280
  */
284
- type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: TParams, cursor: string | null) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>;
281
+ type CustomCollectionDispatcher<TItem, TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>, cursor: string | null) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>;
285
282
  /**
286
283
  * A callback that counts the number of items in a custom collection.
287
284
  *
@@ -291,7 +288,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
291
288
  * @param values The parameters of the requested URL.
292
289
  * @since 1.8.0
293
290
  */
294
- type CustomCollectionCounter<TParams extends Record<string, string>, TContextData> = (context: RequestContext<TContextData>, values: TParams) => number | bigint | null | Promise<number | bigint | null>;
291
+ type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
295
292
  /**
296
293
  * A callback that returns a cursor for a custom collection.
297
294
  *
@@ -304,10 +301,148 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
304
301
  * @param values The parameters of the requested URL.
305
302
  * @since 1.8.0
306
303
  */
307
- type CustomCollectionCursor<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: TParams) => string | null | Promise<string | null>;
304
+ type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
305
+ //#endregion
306
+ //#region src/federation/mq.d.ts
307
+ /**
308
+ * Additional options for enqueuing a message in a queue.
309
+ *
310
+ * @since 0.5.0
311
+ */
312
+ interface MessageQueueEnqueueOptions {
313
+ /**
314
+ * The delay before the message is enqueued. No delay by default.
315
+ *
316
+ * It must not be negative.
317
+ */
318
+ delay?: Temporal.Duration;
319
+ }
320
+ /**
321
+ * Additional options for listening to a message queue.
322
+ *
323
+ * @since 1.0.0
324
+ */
325
+ interface MessageQueueListenOptions {
326
+ /**
327
+ * The signal to abort listening to the message queue.
328
+ */
329
+ signal?: AbortSignal;
330
+ }
331
+ /**
332
+ * An abstract interface for a message queue.
333
+ *
334
+ * @since 0.5.0
335
+ */
336
+ interface MessageQueue {
337
+ /**
338
+ * Whether the message queue backend provides native retry mechanisms.
339
+ * When `true`, Fedify will skip its own retry logic and rely on the backend
340
+ * to handle retries. When `false` or omitted, Fedify will handle retries
341
+ * using its own retry policies.
342
+ *
343
+ * @default `false`
344
+ * @since 1.7.0
345
+ */
346
+ readonly nativeRetrial?: boolean;
347
+ /**
348
+ * Enqueues a message in the queue.
349
+ * @param message The message to enqueue.
350
+ * @param options Additional options for enqueuing the message.
351
+ */
352
+ enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
353
+ /**
354
+ * Enqueues multiple messages in the queue. This operation is optional,
355
+ * and may not be supported by all implementations. If not supported,
356
+ * Fedify will invoke {@link enqueue} for each message.
357
+ *
358
+ * @param messages The messages to enqueue.
359
+ * @param options Additional options for enqueuing the messages.
360
+ */
361
+ enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
362
+ /**
363
+ * Listens for messages in the queue.
364
+ * @param handler The handler for messages in the queue.
365
+ * @param options Additional options for listening to the message queue.
366
+ * @returns A promise that resolves when the listening is done. It never
367
+ * rejects, and is resolved when the signal is aborted. If no
368
+ * signal is provided, it never resolves.
369
+ */
370
+ listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
371
+ }
372
+ /**
373
+ * Additional options for {@link InProcessMessageQueue}.
374
+ * @since 1.0.0
375
+ */
376
+ interface InProcessMessageQueueOptions {
377
+ /**
378
+ * The interval to poll for messages in the queue. 5 seconds by default.
379
+ * @default `{ seconds: 5 }`
380
+ */
381
+ pollInterval?: Temporal.Duration | Temporal.DurationLike;
382
+ }
383
+ /**
384
+ * A message queue that processes messages in the same process.
385
+ * Do not use this in production as it does neither persist messages nor
386
+ * distribute them across multiple processes.
387
+ *
388
+ * @since 0.5.0
389
+ */
390
+ declare class InProcessMessageQueue implements MessageQueue {
391
+ #private;
392
+ /**
393
+ * In-process message queue does not provide native retry mechanisms.
394
+ * @since 1.7.0
395
+ */
396
+ readonly nativeRetrial = false;
397
+ /**
398
+ * Constructs a new {@link InProcessMessageQueue} with the given options.
399
+ * @param options Additional options for the in-process message queue.
400
+ */
401
+ constructor(options?: InProcessMessageQueueOptions);
402
+ enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
403
+ enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
404
+ listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
405
+ }
406
+ /**
407
+ * A message queue that processes messages in parallel. It takes another
408
+ * {@link MessageQueue}, and processes messages in parallel up to a certain
409
+ * number of workers.
410
+ *
411
+ * Actually, it's rather a decorator than a queue itself.
412
+ *
413
+ * Note that the workers do not run in truly parallel, in the sense that they
414
+ * are not running in separate threads or processes. They are running in the
415
+ * same process, but are scheduled to run in parallel. Hence, this is useful
416
+ * for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
417
+ * workloads.
418
+ *
419
+ * @since 1.0.0
420
+ */
421
+ declare class ParallelMessageQueue implements MessageQueue {
422
+ #private;
423
+ readonly queue: MessageQueue;
424
+ readonly workers: number;
425
+ /**
426
+ * Inherits the native retry capability from the wrapped queue.
427
+ * @since 1.7.0
428
+ */
429
+ readonly nativeRetrial?: boolean;
430
+ /**
431
+ * Constructs a new {@link ParallelMessageQueue} with the given queue and
432
+ * number of workers.
433
+ * @param queue The message queue to use under the hood. Note that
434
+ * {@link ParallelMessageQueue} cannot be nested.
435
+ * @param workers The number of workers to process messages in parallel.
436
+ * @throws {TypeError} If the given queue is an instance of
437
+ * {@link ParallelMessageQueue}.
438
+ */
439
+ constructor(queue: MessageQueue, workers: number);
440
+ enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
441
+ enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
442
+ listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
443
+ }
308
444
  //#endregion
309
445
  //#region src/federation/handler.d.ts
310
-
311
446
  /**
312
447
  * Options for the {@link respondWithObject} and
313
448
  * {@link respondWithObjectIfAcceptable} functions.
@@ -434,8 +569,8 @@ declare function createFederationBuilder<TContextData>(): FederationBuilder<TCon
434
569
  //#endregion
435
570
  //#region src/federation/queue.d.ts
436
571
  interface SenderKeyJwkPair {
437
- keyId: string;
438
- privateKey: JsonWebKey;
572
+ readonly keyId: string;
573
+ readonly privateKey: JsonWebKey;
439
574
  }
440
575
  /**
441
576
  * A message that represents a task to be processed by the background worker.
@@ -448,44 +583,44 @@ interface SenderKeyJwkPair {
448
583
  */
449
584
  type Message = FanoutMessage | OutboxMessage | InboxMessage;
450
585
  interface FanoutMessage {
451
- type: "fanout";
452
- id: ReturnType<typeof crypto.randomUUID>;
453
- baseUrl: string;
454
- keys: SenderKeyJwkPair[];
455
- inboxes: Record<string, {
456
- actorIds: string[];
457
- sharedInbox: boolean;
458
- }>;
459
- activity: unknown;
460
- activityId?: string;
461
- activityType: string;
462
- collectionSync?: string;
463
- traceContext: Record<string, string>;
586
+ readonly type: "fanout";
587
+ readonly id: ReturnType<typeof crypto.randomUUID>;
588
+ readonly baseUrl: string;
589
+ readonly keys: readonly SenderKeyJwkPair[];
590
+ readonly inboxes: Readonly<Record<string, {
591
+ readonly actorIds: readonly string[];
592
+ readonly sharedInbox: boolean;
593
+ }>>;
594
+ readonly activity: unknown;
595
+ readonly activityId?: string;
596
+ readonly activityType: string;
597
+ readonly collectionSync?: string;
598
+ readonly traceContext: Readonly<Record<string, string>>;
464
599
  }
465
600
  interface OutboxMessage {
466
- type: "outbox";
467
- id: ReturnType<typeof crypto.randomUUID>;
468
- baseUrl: string;
469
- keys: SenderKeyJwkPair[];
470
- activity: unknown;
471
- activityId?: string;
472
- activityType: string;
473
- inbox: string;
474
- sharedInbox: boolean;
475
- started: string;
476
- attempt: number;
477
- headers: Record<string, string>;
478
- traceContext: Record<string, string>;
601
+ readonly type: "outbox";
602
+ readonly id: ReturnType<typeof crypto.randomUUID>;
603
+ readonly baseUrl: string;
604
+ readonly keys: readonly SenderKeyJwkPair[];
605
+ readonly activity: unknown;
606
+ readonly activityId?: string;
607
+ readonly activityType: string;
608
+ readonly inbox: string;
609
+ readonly sharedInbox: boolean;
610
+ readonly started: string;
611
+ readonly attempt: number;
612
+ readonly headers: Readonly<Record<string, string>>;
613
+ readonly traceContext: Readonly<Record<string, string>>;
479
614
  }
480
615
  interface InboxMessage {
481
- type: "inbox";
482
- id: ReturnType<typeof crypto.randomUUID>;
483
- baseUrl: string;
484
- activity: unknown;
485
- started: string;
486
- attempt: number;
487
- identifier: string | null;
488
- traceContext: Record<string, string>;
616
+ readonly type: "inbox";
617
+ readonly id: ReturnType<typeof crypto.randomUUID>;
618
+ readonly baseUrl: string;
619
+ readonly activity: unknown;
620
+ readonly started: string;
621
+ readonly attempt: number;
622
+ readonly identifier: string | null;
623
+ readonly traceContext: Readonly<Record<string, string>>;
489
624
  }
490
625
  //#endregion
491
626
  //#region src/federation/retry.d.ts
@@ -569,19 +704,19 @@ interface FederationQueueOptions {
569
704
  * The message queue for incoming activities. If not provided, incoming
570
705
  * activities will not be queued and will be processed immediately.
571
706
  */
572
- inbox?: MessageQueue;
707
+ readonly inbox?: MessageQueue;
573
708
  /**
574
709
  * The message queue for outgoing activities. If not provided, outgoing
575
710
  * activities will not be queued and will be sent immediately.
576
711
  */
577
- outbox?: MessageQueue;
712
+ readonly outbox?: MessageQueue;
578
713
  /**
579
714
  * The message queue for fanning out outgoing activities. If not provided,
580
715
  * outgoing activities will not be fanned out in the background, but will be
581
716
  * fanned out immediately, which causes slow response times on
582
717
  * {@link Context.sendActivity} calls.
583
718
  */
584
- fanout?: MessageQueue;
719
+ readonly fanout?: MessageQueue;
585
720
  }
586
721
  /**
587
722
  * Prefixes for namespacing keys in the Deno KV store.
@@ -592,18 +727,18 @@ interface FederationKvPrefixes {
592
727
  * processed or not.
593
728
  * @default `["_fedify", "activityIdempotence"]`
594
729
  */
595
- activityIdempotence: KvKey;
730
+ readonly activityIdempotence: KvKey;
596
731
  /**
597
732
  * The key prefix used for storing remote JSON-LD documents.
598
733
  * @default `["_fedify", "remoteDocument"]`
599
734
  */
600
- remoteDocument: KvKey;
735
+ readonly remoteDocument: KvKey;
601
736
  /**
602
737
  * The key prefix used for caching public keys.
603
738
  * @default `["_fedify", "publicKey"]`
604
739
  * @since 0.12.0
605
740
  */
606
- publicKey: KvKey;
741
+ readonly publicKey: KvKey;
607
742
  /**
608
743
  * The key prefix used for caching HTTP Message Signatures specs.
609
744
  * The cached spec is used to reduce the number of requests to make signed
@@ -611,7 +746,7 @@ interface FederationKvPrefixes {
611
746
  * @default `["_fedify", "httpMessageSignaturesSpec"]`
612
747
  * @since 1.6.0
613
748
  */
614
- httpMessageSignaturesSpec: KvKey;
749
+ readonly httpMessageSignaturesSpec: KvKey;
615
750
  }
616
751
  /**
617
752
  * Options for {@link CreateFederationOptions.origin} when it is not a string.
@@ -702,7 +837,7 @@ interface Federatable<TContextData> {
702
837
  * @returns An object with methods to set other actor dispatcher callbacks.
703
838
  * @throws {RouterError} Thrown if the path pattern is invalid.
704
839
  */
705
- setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
840
+ setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
706
841
  /**
707
842
  * Registers an object dispatcher.
708
843
  *
@@ -716,9 +851,7 @@ interface Federatable<TContextData> {
716
851
  * must have one or more variables.
717
852
  * @param dispatcher An object dispatcher callback to register.
718
853
  */
719
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
720
- typeId: URL;
721
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
854
+ setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
722
855
  /**
723
856
  * Registers an object dispatcher.
724
857
  *
@@ -732,9 +865,7 @@ interface Federatable<TContextData> {
732
865
  * must have one or more variables.
733
866
  * @param dispatcher An object dispatcher callback to register.
734
867
  */
735
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
736
- typeId: URL;
737
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
868
+ setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
738
869
  /**
739
870
  * Registers an object dispatcher.
740
871
  *
@@ -748,9 +879,7 @@ interface Federatable<TContextData> {
748
879
  * must have one or more variables.
749
880
  * @param dispatcher An object dispatcher callback to register.
750
881
  */
751
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
752
- typeId: URL;
753
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
882
+ setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
754
883
  /**
755
884
  * Registers an object dispatcher.
756
885
  *
@@ -764,9 +893,7 @@ interface Federatable<TContextData> {
764
893
  * must have one or more variables.
765
894
  * @param dispatcher An object dispatcher callback to register.
766
895
  */
767
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
768
- typeId: URL;
769
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
896
+ setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
770
897
  /**
771
898
  * Registers an object dispatcher.
772
899
  *
@@ -780,9 +907,7 @@ interface Federatable<TContextData> {
780
907
  * must have one or more variables.
781
908
  * @param dispatcher An object dispatcher callback to register.
782
909
  */
783
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
784
- typeId: URL;
785
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
910
+ setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
786
911
  /**
787
912
  * Registers an object dispatcher.
788
913
  *
@@ -796,9 +921,7 @@ interface Federatable<TContextData> {
796
921
  * must have one or more variables.
797
922
  * @param dispatcher An object dispatcher callback to register.
798
923
  */
799
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
800
- typeId: URL;
801
- }, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
924
+ setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
802
925
  /**
803
926
  * Registers an inbox dispatcher.
804
927
  *
@@ -810,7 +933,7 @@ interface Federatable<TContextData> {
810
933
  * @param dispatcher An inbox dispatcher callback to register.
811
934
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
812
935
  */
813
- setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
936
+ setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
814
937
  /**
815
938
  * Registers an outbox dispatcher.
816
939
  *
@@ -834,7 +957,7 @@ interface Federatable<TContextData> {
834
957
  * @param dispatcher An outbox dispatcher callback to register.
835
958
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
836
959
  */
837
- setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
960
+ setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
838
961
  /**
839
962
  * Registers a following collection dispatcher.
840
963
  * @param path The URI path pattern for the following collection. The syntax
@@ -846,7 +969,7 @@ interface Federatable<TContextData> {
846
969
  * callbacks.
847
970
  * @throws {RouterError} Thrown if the path pattern is invalid.
848
971
  */
849
- setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
972
+ setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
850
973
  /**
851
974
  * Registers a followers collection dispatcher.
852
975
  * @param path The URI path pattern for the followers collection. The syntax
@@ -858,7 +981,7 @@ interface Federatable<TContextData> {
858
981
  * callbacks.
859
982
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
860
983
  */
861
- setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
984
+ setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
862
985
  /**
863
986
  * Registers a liked collection dispatcher.
864
987
  * @param path The URI path pattern for the liked collection. The syntax
@@ -870,7 +993,7 @@ interface Federatable<TContextData> {
870
993
  * callbacks.
871
994
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
872
995
  */
873
- setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
996
+ setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
874
997
  /**
875
998
  * Registers a featured collection dispatcher.
876
999
  * @param path The URI path pattern for the featured collection. The syntax
@@ -882,7 +1005,7 @@ interface Federatable<TContextData> {
882
1005
  * callbacks.
883
1006
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
884
1007
  */
885
- setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
1008
+ setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
886
1009
  /**
887
1010
  * Registers a featured tags collection dispatcher.
888
1011
  * @param path The URI path pattern for the featured tags collection.
@@ -894,7 +1017,7 @@ interface Federatable<TContextData> {
894
1017
  * callbacks.
895
1018
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
896
1019
  */
897
- setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
1020
+ setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
898
1021
  /**
899
1022
  * Assigns the URL path for the inbox and starts setting inbox listeners.
900
1023
  *
@@ -924,7 +1047,37 @@ interface Federatable<TContextData> {
924
1047
  * @returns An object to register inbox listeners.
925
1048
  * @throws {RouteError} Thrown if the path pattern is invalid.
926
1049
  */
927
- setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
1050
+ setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
1051
+ /**
1052
+ * Registers a collection of objects dispatcher.
1053
+ *
1054
+ * @template TContextData The context data to pass to the {@link Context}.
1055
+ * @template TObject The type of objects to dispatch.
1056
+ * @template TParam The parameter names of the requested URL.
1057
+ * @param name A unique name for the collection dispatcher.
1058
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1059
+ * @param path The URI path pattern for the collection dispatcher.
1060
+ * The syntax is based on URI Template
1061
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1062
+ * The path must have one or more variables.
1063
+ * @param dispatcher A collection dispatcher callback to register.
1064
+ */
1065
+ setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
1066
+ /**
1067
+ * Registers a collection of objects dispatcher.
1068
+ *
1069
+ * @template TContextData The context data to pass to the {@link Context}.
1070
+ * @template TObject The type of objects to dispatch.
1071
+ * @template TParam The parameter names of the requested URL.
1072
+ * @param name A unique name for the collection dispatcher.
1073
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1074
+ * @param path The URI path pattern for the collection dispatcher.
1075
+ * The syntax is based on URI Template
1076
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1077
+ * The path must have one or more variables.
1078
+ * @param dispatcher A collection dispatcher callback to register.
1079
+ */
1080
+ setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
928
1081
  /**
929
1082
  * Registers a collection of objects dispatcher.
930
1083
  *
@@ -939,7 +1092,37 @@ interface Federatable<TContextData> {
939
1092
  * The path must have one or more variables.
940
1093
  * @param dispatcher A collection dispatcher callback to register.
941
1094
  */
942
- setCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: ParamsKeyPath<TParams>, dispatcher: CustomCollectionDispatcher<TObject, TParams, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParams, RequestContext<TContextData>, TContextData>;
1095
+ setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
1096
+ /**
1097
+ * Registers an ordered collection of objects dispatcher.
1098
+ *
1099
+ * @template TContextData The context data to pass to the {@link Context}.
1100
+ * @template TObject The type of objects to dispatch.
1101
+ * @template TParam The parameter names of the requested URL.
1102
+ * @param name A unique name for the collection dispatcher.
1103
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1104
+ * @param path The URI path pattern for the collection dispatcher.
1105
+ * The syntax is based on URI Template
1106
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1107
+ * The path must have one or more variables.
1108
+ * @param dispatcher A collection dispatcher callback to register.
1109
+ */
1110
+ setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
1111
+ /**
1112
+ * Registers an ordered collection of objects dispatcher.
1113
+ *
1114
+ * @template TContextData The context data to pass to the {@link Context}.
1115
+ * @template TObject The type of objects to dispatch.
1116
+ * @template TParam The parameter names of the requested URL.
1117
+ * @param name A unique name for the collection dispatcher.
1118
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1119
+ * @param path The URI path pattern for the collection dispatcher.
1120
+ * The syntax is based on URI Template
1121
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1122
+ * The path must have one or more variables.
1123
+ * @param dispatcher A collection dispatcher callback to register.
1124
+ */
1125
+ setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
943
1126
  /**
944
1127
  * Registers an ordered collection of objects dispatcher.
945
1128
  *
@@ -954,7 +1137,7 @@ interface Federatable<TContextData> {
954
1137
  * The path must have one or more variables.
955
1138
  * @param dispatcher A collection dispatcher callback to register.
956
1139
  */
957
- setOrderedCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: ParamsKeyPath<TParams>, dispatcher: CustomCollectionDispatcher<TObject, TParams, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParams, RequestContext<TContextData>, TContextData>;
1140
+ setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
958
1141
  }
959
1142
  /**
960
1143
  * An object that registers federation-related business logic and dispatches
@@ -1090,12 +1273,6 @@ interface FederationOptions<TContextData> {
1090
1273
  * @since 1.4.0
1091
1274
  */
1092
1275
  contextLoaderFactory?: DocumentLoaderFactory;
1093
- /**
1094
- * A custom JSON-LD context loader. By default, this uses the same loader
1095
- * as the document loader.
1096
- * @deprecated Use {@link contextLoaderFactory} instead.
1097
- */
1098
- contextLoader?: DocumentLoader;
1099
1276
  /**
1100
1277
  * A factory function that creates an authenticated document loader for a
1101
1278
  * given identity. This is used for fetching documents that require
@@ -1304,6 +1481,36 @@ interface CollectionCallbackSetters<TContext extends Context<TContextData>, TCon
1304
1481
  */
1305
1482
  authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
1306
1483
  }
1484
+ /**
1485
+ * The strategy for handling activity idempotency in inbox processing.
1486
+ *
1487
+ * - `"global"`: Activities are deduplicated globally across all inboxes and
1488
+ * origins. The same activity ID will be processed only once, regardless
1489
+ * of which inbox receives it or which server sent it.
1490
+ *
1491
+ * - `"per-origin"`: Activities are deduplicated per receiving server's origin.
1492
+ * The same activity ID will be processed only once on each receiving server,
1493
+ * but can be processed separately on different receiving servers. This had
1494
+ * been the default behavior in Fedify 1.x versions.
1495
+ *
1496
+ * - `"per-inbox"`: Activities are deduplicated per inbox. The same activity
1497
+ * ID can be processed once per inbox, allowing the same activity to be
1498
+ * delivered to multiple inboxes independently. This follows standard
1499
+ * ActivityPub behavior and is the default strategy since Fedify 2.0.0.
1500
+ *
1501
+ * @since 1.9.0
1502
+ */
1503
+ type IdempotencyStrategy = "global" | "per-origin" | "per-inbox";
1504
+ /**
1505
+ * A callback to generate a custom idempotency key for an activity.
1506
+ * Returns the cache key to use, or null to skip idempotency checking.
1507
+ * @template TContextData The context data to pass to the {@link InboxContext}.
1508
+ * @param ctx The inbox context.
1509
+ * @param activity The activity being processed.
1510
+ * @returns The idempotency key to use for caching, or null to skip caching.
1511
+ * @since 1.9.0
1512
+ */
1513
+ type IdempotencyKeyCallback<TContextData> = (ctx: InboxContext<TContextData>, activity: Activity) => string | null | Promise<string | null>;
1307
1514
  /**
1308
1515
  * Registry for inbox listeners for different activity types.
1309
1516
  */
@@ -1334,6 +1541,36 @@ interface InboxListenerSetters<TContextData> {
1334
1541
  * @since 0.11.0
1335
1542
  */
1336
1543
  setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
1544
+ /**
1545
+ * Configures the strategy for handling activity idempotency in inbox processing.
1546
+ *
1547
+ * @example
1548
+ * Use per-inbox strategy (standard ActivityPub behavior):
1549
+ * ```
1550
+ * federation
1551
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1552
+ * .withIdempotency("per-inbox");
1553
+ * ```
1554
+ *
1555
+ * Use custom strategy:
1556
+ * ```
1557
+ * federation
1558
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1559
+ * .withIdempotency((ctx, activity) => {
1560
+ * // Return null to skip idempotency
1561
+ * return `${ctx.origin}:${activity.id?.href}:${ctx.recipient}`;
1562
+ * });
1563
+ * ```
1564
+ *
1565
+ * @param strategy The idempotency strategy to use. Can be:
1566
+ * - `"global"`: Activities are deduplicated across all inboxes and origins
1567
+ * - `"per-origin"`: Activities are deduplicated per inbox origin
1568
+ * - `"per-inbox"`: Activities are deduplicated per inbox
1569
+ * - A custom callback function that returns the cache key to use
1570
+ * @returns The setters object so that settings can be chained.
1571
+ * @since 1.9.0
1572
+ */
1573
+ withIdempotency(strategy: IdempotencyStrategy | IdempotencyKeyCallback<TContextData>): InboxListenerSetters<TContextData>;
1337
1574
  }
1338
1575
  /**
1339
1576
  * Parameters of {@link Federation.fetch} method.
@@ -1372,38 +1609,38 @@ interface FederationFetchOptions<TContextData> {
1372
1609
  /**
1373
1610
  * Additional settings for a custom collection dispatcher.
1374
1611
  *
1375
- * @template TParams The type of the parameters in the URL path.
1612
+ * @template TParam The type of the parameters in the URL path.
1376
1613
  * @template TContext The type of the context. {@link Context} or
1377
1614
  * {@link RequestContext}.
1378
1615
  * @template TContextData The context data to pass to the {@link Context}.
1379
1616
  * @template TFilter The type of filter for the collection.
1380
1617
  */
1381
- interface CustomCollectionCallbackSetters<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> {
1618
+ interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
1382
1619
  /**
1383
1620
  * Sets the counter for the custom collection.
1384
1621
  * @param counter A callback that returns the number of items in the custom collection.
1385
1622
  * @returns The setters object so that settings can be chained.
1386
1623
  */
1387
- setCounter(counter: CustomCollectionCounter<TParams, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1624
+ setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1388
1625
  /**
1389
1626
  * Sets the first cursor for the custom collection.
1390
1627
  * @param cursor The cursor for the first item in the custom collection.
1391
1628
  * @returns The setters object so that settings can be chained.
1392
1629
  */
1393
- setFirstCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1630
+ setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1394
1631
  /**
1395
1632
  * Sets the last cursor for the custom collection.
1396
1633
  * @param cursor The cursor for the last item in the custom collection.
1397
1634
  * @returns The setters object so that settings can be chained.
1398
1635
  */
1399
- setLastCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1636
+ setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1400
1637
  /**
1401
1638
  * Specifies the conditions under which requests are authorized.
1402
1639
  * @param predicate A callback that returns whether a request is authorized.
1403
1640
  * @returns The setters object so that settings can be chained.
1404
1641
  * @since 0.7.0
1405
1642
  */
1406
- authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1643
+ authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1407
1644
  }
1408
1645
  /**
1409
1646
  * Represents an object with a type ID, which is either a constructor or an
@@ -1415,73 +1652,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
1415
1652
  typeId: URL;
1416
1653
  };
1417
1654
  /**
1418
- * Represents a path from the key of parameter objects.
1419
- * @param Params - A record of parameters where keys are parameter names and
1420
- * values are their string representations.
1421
- * @returns A string representing the path with all parameters.
1422
- * @example
1423
- * ```ts
1424
- * type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
1425
- * let userPostPath: UserPostPath;
1426
- * // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
1427
- * // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
1428
- * userPostPath = "/users/{userId}/posts/{postId}"; // valid
1429
- * userPostPath = "/posts/{postId}/users/{userId}"; // valid
1430
- * ```
1431
- */
1432
- type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
1433
- /**
1434
- * Represents a path with multiple parameters.
1435
- * All permutations of the parameters are included in the union type.
1436
- * The path must have all parameters in the form of `{paramName}`.
1437
- * @param Params - A union of parameter names.
1438
- * @returns A string representing the path with all parameters.
1439
- * @example
1440
- * ```ts
1441
- * type UserPostPath = ParamsPath<"userId" | "postId">;
1442
- * // = `${string}{userId}${string}` & `${string}{postId}${string}`
1443
- * // =
1444
- * // | `${string}{userId}${string}{postId}${string}`
1445
- * // | `${string}{postId}${string}{userId}${string}`
1446
- * let userPostPath: UserPostPath;
1447
- * userPostPath = "/users/posts"; // ❌ invalid
1448
- * userPostPath = "/users/{userId}"; // ❌ invalid
1449
- * userPostPath = "/posts/{postId}"; // ❌ invalid
1450
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
1451
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
1452
- */
1453
- type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
1454
- /**
1455
- * Represents a path with a single parameter.
1456
- * The path must have at least one of the parameters in the form of `{paramName}`.
1457
- * @param Param - The name of the parameter.
1458
- * @returns A string representing the path with the parameter.
1459
- * @example
1460
- * ```ts
1461
- * type UserPostPath = ParamPath<"userId" | "postId">;
1462
- * // = `${string}{userId}${string}` | `${string}{postId}${string}`
1463
- * let userPostPath: UserPostPath;
1464
- * userPostPath = "/users/posts"; // ❌ invalid
1465
- * userPostPath = "/users/{userId}"; // ✅ valid
1466
- * userPostPath = "/posts/{postId}"; // ✅ valid
1467
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
1468
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
1469
- */
1470
- type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
1471
- /**
1472
- * Converts union types to intersection types.
1655
+ * Defines a union of all valid RFC 6570 URI Template expressions for a given
1656
+ * parameter name.
1473
1657
  *
1474
- * @template U - The union type to convert.
1475
- * @returns The intersection type of the union.
1658
+ * RFC 6570 specifies a syntax for URI templates, allowing for variable
1659
+ * expansion. This type captures all Level 1-4 operator expressions for a
1660
+ * single, named variable.
1661
+ *
1662
+ * The supported expression types are:
1663
+ * - `{Param}`: Simple string expansion
1664
+ * - `+{Param}`: Reserved string expansion
1665
+ * - `#{Param}`: Fragment expansion
1666
+ * - `{.Param}`: Label expansion with a dot-prefix
1667
+ * - `{/Param}`: Path segment expansion
1668
+ * - `{;Param}`: Path-style parameter expansion
1669
+ * - `{?Param}`: Query component expansion
1670
+ * - `{&Param}`: Query continuation expansion
1671
+ *
1672
+ * @template Param The name of the parameter to be used in the expressions.
1476
1673
  * @example
1477
1674
  * ```ts
1478
- * type A = { a: string };
1479
- * type B = { b: number };
1480
- * type AorB = A | B;
1481
- * type AandB = UnionToIntersection<AorB>;
1482
- * // AandB = { a: string; b: number }
1675
+ * type UserIdExpression = Rfc6570Expression<"userId">;
1676
+ *
1677
+ * // The variable `userPath` can be assigned any of the valid expressions.
1678
+ * const userPath: UserIdExpression = "{/userId}";
1679
+ * ```
1680
+ * @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
1483
1681
  */
1484
- type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
1682
+ type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
1485
1683
  //#endregion
1486
1684
  //#region src/federation/context.d.ts
1487
1685
  /**
@@ -1570,9 +1768,7 @@ interface Context<TContextData> {
1570
1768
  * @throws {TypeError} If values are invalid.
1571
1769
  * @since 0.7.0
1572
1770
  */
1573
- getObjectUri<TObject extends Object$1>(cls: (new (...args: any[]) => TObject) & {
1574
- typeId: URL;
1575
- }, values: Record<string, string>): URL;
1771
+ getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
1576
1772
  /**
1577
1773
  * Builds the URI of an actor's outbox with the given identifier.
1578
1774
  * @param identifier The actor's identifier.
@@ -1886,9 +2082,7 @@ interface RequestContext<TContextData> extends Context<TContextData> {
1886
2082
  * @throws {TypeError} If values are invalid.
1887
2083
  * @since 0.7.0
1888
2084
  */
1889
- getObject<TObject extends Object$1>(cls: (new (...args: any[]) => TObject) & {
1890
- typeId: URL;
1891
- }, values: Record<string, string>): Promise<TObject | null>;
2085
+ getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
1892
2086
  /**
1893
2087
  * Gets the public key of the sender, if any exists and it is verified.
1894
2088
  * Otherwise, `null` is returned.
@@ -1966,7 +2160,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
1966
2160
  * inbox, it is `null`.
1967
2161
  * @since 1.2.0
1968
2162
  */
1969
- recipient: string | null;
2163
+ readonly recipient: string | null;
1970
2164
  /**
1971
2165
  * Creates a new context with the same properties as this one,
1972
2166
  * but with the given data.
@@ -2032,9 +2226,7 @@ type ParseUriResult =
2032
2226
  * The case of an object URI.
2033
2227
  */ | {
2034
2228
  readonly type: "object";
2035
- readonly class: (new (...args: any[]) => Object$1) & {
2036
- typeId: URL;
2037
- };
2229
+ readonly class: ConstructorWithTypeId<Object$1>;
2038
2230
  readonly typeId: URL;
2039
2231
  readonly values: Record<string, string>;
2040
2232
  }
@@ -2158,7 +2350,7 @@ interface SendActivityOptions {
2158
2350
  *
2159
2351
  * @since 0.9.0
2160
2352
  */
2161
- excludeBaseUris?: URL[];
2353
+ readonly excludeBaseUris?: readonly URL[];
2162
2354
  }
2163
2355
  /**
2164
2356
  * Options for {@link Context.sendActivity} method when sending to a collection.
@@ -2241,15 +2433,15 @@ interface ActorKeyPair extends CryptoKeyPair {
2241
2433
  /**
2242
2434
  * The URI of the public key, which is used for verifying HTTP Signatures.
2243
2435
  */
2244
- keyId: URL;
2436
+ readonly keyId: URL;
2245
2437
  /**
2246
2438
  * A {@link CryptographicKey} instance of the public key.
2247
2439
  */
2248
- cryptographicKey: CryptographicKey;
2440
+ readonly cryptographicKey: CryptographicKey;
2249
2441
  /**
2250
2442
  * A {@link Multikey} instance of the public key.
2251
2443
  */
2252
- multikey: Multikey;
2444
+ readonly multikey: Multikey;
2253
2445
  }
2254
2446
  //#endregion
2255
- export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParamsKeyPath, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
2447
+ export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };