@fedify/fedify 2.0.0-pr.412.1559 → 2.0.0-pr.412.1794

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 (204) hide show
  1. package/README.md +3 -0
  2. package/dist/{actor-Cc6B76eG.js → actor-BXHc5r-q.js} +1 -1
  3. package/dist/actor-Ba9Z1eNJ.cjs +42079 -0
  4. package/dist/{actor-C22bXuuC.d.ts → actor-DqFajh9s.d.ts} +2 -2
  5. package/dist/{actor-CTAuCsWy.js → actor-DzhunPC_.js} +7058 -2722
  6. package/dist/actor-f2NtjyCg.d.cts +128 -0
  7. package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
  8. package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
  9. package/dist/{builder-BOEBObR8.js → builder-u7usRsT3.js} +13 -8
  10. package/dist/chunk-DqRYRqnO.cjs +34 -0
  11. package/dist/client-94iWEfQa.d.cts +222 -0
  12. package/dist/{client-DF8anIB5.d.ts → client-BsGzbnV-.d.ts} +3 -75
  13. package/dist/{client-De-z2UnN.js → client-pY7-3icS.js} +3 -22
  14. package/dist/compat/mod.cjs +10 -0
  15. package/dist/compat/mod.d.cts +12 -0
  16. package/dist/compat/mod.d.ts +11 -12
  17. package/dist/compat/mod.js +5 -5
  18. package/dist/compat/transformers.test.js +20 -20
  19. package/dist/compat-DmDDELst.cjs +4 -0
  20. package/dist/compat-nxUqe4Z-.js +4 -0
  21. package/dist/{context-9gCpIkiz.d.ts → context-DG0huGW-.d.ts} +184 -127
  22. package/dist/context-DJ8aSy2Q.d.cts +2312 -0
  23. package/dist/{authdocloader-CLgDGafZ.js → docloader-CrbAy9Oc.js} +17 -8
  24. package/dist/{esm-CHdxdkuH.js → esm-C-Qa1zEM.js} +11 -11
  25. package/dist/federation/builder.test.js +9 -12
  26. package/dist/federation/collection.test.js +7 -9
  27. package/dist/federation/handler.test.js +27 -148
  28. package/dist/federation/idempotency.test.js +201 -0
  29. package/dist/federation/inbox.test.js +4 -6
  30. package/dist/federation/keycache.test.js +3 -4
  31. package/dist/federation/kv.test.js +7 -8
  32. package/dist/federation/middleware.test.js +242 -64
  33. package/dist/federation/mod.cjs +27 -0
  34. package/dist/federation/mod.d.cts +12 -0
  35. package/dist/federation/mod.d.ts +12 -13
  36. package/dist/federation/mod.js +13 -15
  37. package/dist/federation/mq.test.js +8 -10
  38. package/dist/federation/negotiation.test.js +26 -0
  39. package/dist/federation/retry.test.js +4 -5
  40. package/dist/federation/router.test.js +6 -8
  41. package/dist/federation/send.test.js +13 -15
  42. package/dist/federation-CRpdnOMS.cjs +244 -0
  43. package/dist/{federation-CMX7WzeL.js → federation-jcR8-ZxP.js} +3 -3
  44. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
  45. package/dist/{http-DqSNLFNY.d.ts → http-BbO0ejuk.d.ts} +2 -2
  46. package/dist/{http-l0TEupZK.js → http-CUVx-vzb.js} +260 -10
  47. package/dist/{http-CcdM1brU.js → http-D2kIm9la.js} +3 -3
  48. package/dist/http-Dofes42e.cjs +1106 -0
  49. package/dist/http-M8k5mKc0.d.cts +253 -0
  50. package/dist/{inbox-B6DZbGNf.js → inbox-HjG5peXY.js} +24 -7
  51. package/dist/{key-CzLv1phF.js → key-CxdLUFS6.js} +3 -2
  52. package/dist/{keycache-B8HdZJSt.js → keycache-bU7COwsh.js} +1 -1
  53. package/dist/{keys-zZwiKkfx.js → keys-DMHs8XNn.js} +2 -1
  54. package/dist/kv-Bxr0Q87_.d.cts +81 -0
  55. package/dist/kv-cache-CGXcDejL.js +122 -0
  56. package/dist/kv-cache-DN9pfMBe.js +94 -0
  57. package/dist/kv-cache-Dkvbn6rg.cjs +134 -0
  58. package/dist/{ld-CBcQdZ6N.js → ld-CIhvSCCr.js} +5 -4
  59. package/dist/lookup-CHkCVZTU.js +260 -0
  60. package/dist/lookup-CfFkONZD.cjs +272 -0
  61. package/dist/{type-SK-d7Tbw.js → lookup-DQRtjvb1.js} +7266 -7087
  62. package/dist/middleware-Bot7EEwV.js +26 -0
  63. package/dist/middleware-CFJgmUMW.cjs +15 -0
  64. package/dist/{middleware-BRgu1IH8.js → middleware-CJlj5Olw.js} +86 -181
  65. package/dist/middleware-CjHl2NHA.js +15 -0
  66. package/dist/middleware-D74TgW2E.cjs +4225 -0
  67. package/dist/{middleware-CxEkcFW0.js → middleware-DMk2Mdn9.js} +117 -127
  68. package/dist/mod-0noXw66R.d.cts +107 -0
  69. package/dist/mod-B-hUPT2N.d.cts +1 -0
  70. package/dist/{mod-Drmz72EK.d.ts → mod-B2iOw50L.d.ts} +3 -3
  71. package/dist/mod-B9M-8jm2.d.ts +109 -0
  72. package/dist/{mod-Cxt4Kpf6.d.ts → mod-BlVovdcy.d.ts} +20 -2
  73. package/dist/{mod-Bqxcp7eN.d.ts → mod-BoHnwOCs.d.ts} +2 -2
  74. package/dist/mod-BxRCHTz-.d.cts +307 -0
  75. package/dist/mod-C2tOeRkN.d.cts +1 -0
  76. package/dist/mod-C58MZ7Wx.d.cts +113 -0
  77. package/dist/mod-DJcZDvjA.d.cts +80 -0
  78. package/dist/mod-DgdBYYa0.d.cts +266 -0
  79. package/dist/{mod-DBzN0aCM.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
  80. package/dist/mod.cjs +137 -0
  81. package/dist/mod.d.cts +16 -0
  82. package/dist/mod.d.ts +16 -17
  83. package/dist/mod.js +19 -21
  84. package/dist/mq-DcJPkXD5.d.cts +140 -0
  85. package/dist/negotiation-C4nFufNk.js +71 -0
  86. package/dist/nodeinfo/client.test.js +30 -111
  87. package/dist/nodeinfo/handler.test.js +25 -26
  88. package/dist/nodeinfo/mod.cjs +10 -0
  89. package/dist/nodeinfo/mod.d.cts +3 -0
  90. package/dist/nodeinfo/mod.d.ts +3 -5
  91. package/dist/nodeinfo/mod.js +6 -7
  92. package/dist/nodeinfo/types.test.js +8 -15
  93. package/dist/nodeinfo-BnthBobC.js +4 -0
  94. package/dist/nodeinfo-CdN0rEnZ.cjs +4 -0
  95. package/dist/owner-B4HbyP8s.d.cts +67 -0
  96. package/dist/{owner-VEIjmR8r.js → owner-Dvh7mBvr.js} +3 -2
  97. package/dist/{owner-CQPnQVtf.d.ts → owner-kQRGVXG1.d.ts} +3 -3
  98. package/dist/proof-D0uThUvD.cjs +674 -0
  99. package/dist/{proof-DoSQAGkE.js → proof-Dgy35fzc.js} +3 -3
  100. package/dist/{proof-tgUlT8hw.js → proof-fqzaMJ4g.js} +11 -10
  101. package/dist/{send-BzS7w-QF.js → send-Drp20VO9.js} +2 -2
  102. package/dist/sig/http.test.js +13 -14
  103. package/dist/sig/key.test.js +9 -11
  104. package/dist/sig/ld.test.js +8 -10
  105. package/dist/sig/mod.cjs +28 -0
  106. package/dist/sig/mod.d.cts +6 -0
  107. package/dist/sig/mod.d.ts +5 -7
  108. package/dist/sig/mod.js +8 -10
  109. package/dist/sig/owner.test.js +10 -12
  110. package/dist/sig/proof.test.js +13 -14
  111. package/dist/sig-C34-oHBl.js +4 -0
  112. package/dist/sig-YYj5tCnr.cjs +4 -0
  113. package/dist/testing/docloader.test.js +6 -8
  114. package/dist/testing/mod.d.ts +387 -224
  115. package/dist/testing/mod.js +2 -3
  116. package/dist/{testing-Z2omCvKy.js → testing-g4UC4liW.js} +1 -2
  117. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  118. package/dist/transformers-CoBS-oFG.cjs +116 -0
  119. package/dist/{types-DgPvoUWN.js → types-BtUjyi5y.js} +8 -169
  120. package/dist/{types-BIgY6c-l.js → types-C2XVl6gj.js} +1 -3
  121. package/dist/types-CWgzGaqk.cjs +315 -0
  122. package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +14 -15
  123. package/dist/utils/kv-cache.test.js +209 -0
  124. package/dist/utils/mod.cjs +12 -0
  125. package/dist/utils/mod.d.cts +5 -0
  126. package/dist/utils/mod.d.ts +7 -0
  127. package/dist/utils/mod.js +11 -0
  128. package/dist/utils-D-Va7aXC.js +4 -0
  129. package/dist/utils-DyRU1gdZ.cjs +4 -0
  130. package/dist/vocab/actor.test.js +8 -10
  131. package/dist/vocab/lookup.test.js +257 -9
  132. package/dist/vocab/mod.cjs +86 -0
  133. package/dist/vocab/mod.d.cts +4 -0
  134. package/dist/vocab/mod.d.ts +3 -5
  135. package/dist/vocab/mod.js +6 -7
  136. package/dist/vocab/type.test.js +2 -3
  137. package/dist/vocab/vocab.test.js +438 -15
  138. package/dist/{vocab-SOE1ifCr.d.ts → vocab-BCWe1Ih5.d.ts} +292 -21
  139. package/dist/{vocab-CvD6Vbml.js → vocab-BnR3nIU9.js} +26 -17
  140. package/dist/vocab-CeDBzu-f.d.cts +14903 -0
  141. package/dist/{lookup-Bn_HEC_d.js → vocab-DFaWWYDn.cjs} +108 -139
  142. package/dist/webfinger/handler.test.js +24 -25
  143. package/dist/webfinger/lookup.test.js +7 -9
  144. package/dist/webfinger/mod.cjs +8 -0
  145. package/dist/webfinger/mod.d.cts +2 -0
  146. package/dist/webfinger/mod.d.ts +1 -3
  147. package/dist/webfinger/mod.js +5 -6
  148. package/dist/webfinger-C72Y8lrh.js +4 -0
  149. package/dist/webfinger-vAtLmxOF.cjs +4 -0
  150. package/dist/x/cfworkers.cjs +100 -0
  151. package/dist/x/cfworkers.d.cts +59 -0
  152. package/dist/x/cfworkers.d.ts +2 -2
  153. package/dist/x/cfworkers.js +3 -3
  154. package/dist/x/cfworkers.test.js +6 -8
  155. package/dist/x/hono.cjs +61 -0
  156. package/dist/x/hono.d.cts +53 -0
  157. package/dist/x/hono.d.ts +10 -11
  158. package/dist/x/hono.js +3 -3
  159. package/dist/x/sveltekit.cjs +69 -0
  160. package/dist/x/sveltekit.d.cts +45 -0
  161. package/dist/x/sveltekit.d.ts +10 -11
  162. package/dist/x/sveltekit.js +3 -3
  163. package/package.json +79 -23
  164. package/dist/assert_throws-BOO88avQ.js +0 -39
  165. package/dist/authdocloader-BFVqUbyo.js +0 -52
  166. package/dist/compat-Bb5myD13.js +0 -4
  167. package/dist/docloader-CxWcuWqQ.d.ts +0 -221
  168. package/dist/docloader-DEhniCVa.js +0 -4615
  169. package/dist/key-CUZQgVlf.js +0 -10
  170. package/dist/key-Deb0_wWL.js +0 -10
  171. package/dist/key-DxA6xRtZ.js +0 -260
  172. package/dist/lookup-dtdr2ftf.js +0 -131
  173. package/dist/middleware-BE_geSiJ.js +0 -17
  174. package/dist/middleware-BnU6hzVp.js +0 -26
  175. package/dist/mod-TFoH2Ql8.d.ts +0 -104
  176. package/dist/nodeinfo/semver.test.js +0 -143
  177. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  178. package/dist/runtime/docloader.test.js +0 -522
  179. package/dist/runtime/key.test.js +0 -103
  180. package/dist/runtime/langstr.test.d.ts +0 -3
  181. package/dist/runtime/langstr.test.js +0 -39
  182. package/dist/runtime/mod.d.ts +0 -8
  183. package/dist/runtime/mod.js +0 -13
  184. package/dist/runtime/multibase/multibase.test.d.ts +0 -3
  185. package/dist/runtime/multibase/multibase.test.js +0 -358
  186. package/dist/runtime/url.test.d.ts +0 -3
  187. package/dist/runtime/url.test.js +0 -45
  188. package/dist/runtime-BSkOVUWM.js +0 -4
  189. package/dist/semver-dArNLkR9.js +0 -149
  190. package/dist/sig-BXJO--F9.js +0 -4
  191. package/dist/webfinger-C3GIyXIg.js +0 -4
  192. /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
  193. /package/dist/{collection-CSzG2j1P.js → collection-BzWsN9pB.js} +0 -0
  194. /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
  195. /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
  196. /package/dist/{runtime/authdocloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
  197. /package/dist/{kv-C7sopW2E.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
  198. /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
  199. /package/dist/{mod-g0xFzAP9.d.ts → mod-xIj-IT58.d.ts} +0 -0
  200. /package/dist/{mq-CRGm1e_F.d.ts → mq-CUKlBw08.d.ts} +0 -0
  201. /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
  202. /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
  203. /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
  204. /package/dist/{runtime/key.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../transformers-Dna8Fg7k.js";
6
- import "../compat-Bb5myD13.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../transformers-BFT6d7J5.js";
6
+ import "../compat-nxUqe4Z-.js";
7
7
 
8
8
  export { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -3,30 +3,30 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Follow, Person } from "../type-SK-d7Tbw.js";
6
+ import { Follow, Person } from "../lookup-DQRtjvb1.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-BRgu1IH8.js";
12
- import "../semver-dArNLkR9.js";
13
- import "../client-De-z2UnN.js";
14
- import "../lookup-Bn_HEC_d.js";
15
- import "../types-BIgY6c-l.js";
16
- import "../actor-Cc6B76eG.js";
17
- import "../key-CzLv1phF.js";
18
- import "../http-CcdM1brU.js";
19
- import "../authdocloader-CLgDGafZ.js";
20
- import "../ld-CBcQdZ6N.js";
21
- import "../owner-VEIjmR8r.js";
22
- import "../proof-DoSQAGkE.js";
23
- import "../inbox-B6DZbGNf.js";
24
- import "../builder-BOEBObR8.js";
25
- import "../collection-CSzG2j1P.js";
26
- import "../keycache-B8HdZJSt.js";
27
- import "../retry-D4GJ670a.js";
28
- import "../send-BzS7w-QF.js";
29
- import { test } from "../testing-Z2omCvKy.js";
11
+ import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-CJlj5Olw.js";
12
+ import "../client-pY7-3icS.js";
13
+ import "../types-C2XVl6gj.js";
14
+ import "../actor-BXHc5r-q.js";
15
+ import "../key-CxdLUFS6.js";
16
+ import "../http-D2kIm9la.js";
17
+ import "../ld-CIhvSCCr.js";
18
+ import "../owner-Dvh7mBvr.js";
19
+ import "../proof-Dgy35fzc.js";
20
+ import "../docloader-CrbAy9Oc.js";
21
+ import "../kv-cache-DN9pfMBe.js";
22
+ import "../inbox-HjG5peXY.js";
23
+ import "../builder-u7usRsT3.js";
24
+ import "../collection-BzWsN9pB.js";
25
+ import "../keycache-bU7COwsh.js";
26
+ import "../negotiation-C4nFufNk.js";
27
+ import "../retry-CfF8Gn4d.js";
28
+ import "../send-Drp20VO9.js";
29
+ import { test } from "../testing-g4UC4liW.js";
30
30
 
31
31
  //#region src/compat/transformers.test.ts
32
32
  const federation = new FederationImpl({ kv: new MemoryKvStore() });
@@ -0,0 +1,4 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
@@ -0,0 +1,4 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
@@ -1,16 +1,16 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { KvKey, KvStore } from "./kv-C7sopW2E.js";
4
- import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
5
- import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-DF8anIB5.js";
6
- import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-SOE1ifCr.js";
7
- import { Actor, Recipient } from "./actor-C22bXuuC.js";
8
- import { HttpMessageSignaturesSpec } from "./http-DqSNLFNY.js";
9
- import { GetKeyOwnerOptions } from "./owner-CQPnQVtf.js";
10
- import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-Cxt4Kpf6.js";
11
- import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-DBzN0aCM.js";
12
- import { MessageQueue } from "./mq-CRGm1e_F.js";
3
+ import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-BsGzbnV-.js";
4
+ import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-BCWe1Ih5.js";
5
+ import { Actor, Recipient } from "./actor-DqFajh9s.js";
6
+ import { HttpMessageSignaturesSpec } from "./http-BbO0ejuk.js";
7
+ import { GetKeyOwnerOptions } from "./owner-kQRGVXG1.js";
8
+ import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-BlVovdcy.js";
9
+ import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-Ds0mpFZU.js";
10
+ import { KvKey, KvStore } from "./kv-BKNZ-Tb-.js";
11
+ import { MessageQueue } from "./mq-CUKlBw08.js";
13
12
  import { Span, TracerProvider } from "@opentelemetry/api";
13
+ import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
14
14
 
15
15
  //#region src/compat/types.d.ts
16
16
  /**
@@ -283,7 +283,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
283
283
  * the entire collection without pagination.
284
284
  * @since 1.8.0
285
285
  */
286
- 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>;
286
+ 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>;
287
287
  /**
288
288
  * A callback that counts the number of items in a custom collection.
289
289
  *
@@ -293,7 +293,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
293
293
  * @param values The parameters of the requested URL.
294
294
  * @since 1.8.0
295
295
  */
296
- type CustomCollectionCounter<TParams extends Record<string, string>, TContextData> = (context: RequestContext<TContextData>, values: TParams) => number | bigint | null | Promise<number | bigint | null>;
296
+ type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
297
297
  /**
298
298
  * A callback that returns a cursor for a custom collection.
299
299
  *
@@ -306,7 +306,7 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
306
306
  * @param values The parameters of the requested URL.
307
307
  * @since 1.8.0
308
308
  */
309
- type CustomCollectionCursor<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: TParams) => string | null | Promise<string | null>;
309
+ type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
310
310
  //#endregion
311
311
  //#region src/federation/handler.d.ts
312
312
 
@@ -704,7 +704,7 @@ interface Federatable<TContextData> {
704
704
  * @returns An object with methods to set other actor dispatcher callbacks.
705
705
  * @throws {RouterError} Thrown if the path pattern is invalid.
706
706
  */
707
- setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
707
+ setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
708
708
  /**
709
709
  * Registers an object dispatcher.
710
710
  *
@@ -718,9 +718,7 @@ interface Federatable<TContextData> {
718
718
  * must have one or more variables.
719
719
  * @param dispatcher An object dispatcher callback to register.
720
720
  */
721
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
722
- typeId: URL;
723
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
721
+ 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>;
724
722
  /**
725
723
  * Registers an object dispatcher.
726
724
  *
@@ -734,9 +732,7 @@ interface Federatable<TContextData> {
734
732
  * must have one or more variables.
735
733
  * @param dispatcher An object dispatcher callback to register.
736
734
  */
737
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
738
- typeId: URL;
739
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
735
+ 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>;
740
736
  /**
741
737
  * Registers an object dispatcher.
742
738
  *
@@ -750,9 +746,7 @@ interface Federatable<TContextData> {
750
746
  * must have one or more variables.
751
747
  * @param dispatcher An object dispatcher callback to register.
752
748
  */
753
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
754
- typeId: URL;
755
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
749
+ 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>;
756
750
  /**
757
751
  * Registers an object dispatcher.
758
752
  *
@@ -766,9 +760,7 @@ interface Federatable<TContextData> {
766
760
  * must have one or more variables.
767
761
  * @param dispatcher An object dispatcher callback to register.
768
762
  */
769
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
770
- typeId: URL;
771
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
763
+ 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>;
772
764
  /**
773
765
  * Registers an object dispatcher.
774
766
  *
@@ -782,9 +774,7 @@ interface Federatable<TContextData> {
782
774
  * must have one or more variables.
783
775
  * @param dispatcher An object dispatcher callback to register.
784
776
  */
785
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
786
- typeId: URL;
787
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
777
+ 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>;
788
778
  /**
789
779
  * Registers an object dispatcher.
790
780
  *
@@ -798,9 +788,7 @@ interface Federatable<TContextData> {
798
788
  * must have one or more variables.
799
789
  * @param dispatcher An object dispatcher callback to register.
800
790
  */
801
- setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
802
- typeId: URL;
803
- }, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
791
+ 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>;
804
792
  /**
805
793
  * Registers an inbox dispatcher.
806
794
  *
@@ -812,7 +800,7 @@ interface Federatable<TContextData> {
812
800
  * @param dispatcher An inbox dispatcher callback to register.
813
801
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
814
802
  */
815
- setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
803
+ setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
816
804
  /**
817
805
  * Registers an outbox dispatcher.
818
806
  *
@@ -836,7 +824,7 @@ interface Federatable<TContextData> {
836
824
  * @param dispatcher An outbox dispatcher callback to register.
837
825
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
838
826
  */
839
- setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
827
+ setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
840
828
  /**
841
829
  * Registers a following collection dispatcher.
842
830
  * @param path The URI path pattern for the following collection. The syntax
@@ -848,7 +836,7 @@ interface Federatable<TContextData> {
848
836
  * callbacks.
849
837
  * @throws {RouterError} Thrown if the path pattern is invalid.
850
838
  */
851
- setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
839
+ setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
852
840
  /**
853
841
  * Registers a followers collection dispatcher.
854
842
  * @param path The URI path pattern for the followers collection. The syntax
@@ -860,7 +848,7 @@ interface Federatable<TContextData> {
860
848
  * callbacks.
861
849
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
862
850
  */
863
- setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
851
+ setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
864
852
  /**
865
853
  * Registers a liked collection dispatcher.
866
854
  * @param path The URI path pattern for the liked collection. The syntax
@@ -872,7 +860,7 @@ interface Federatable<TContextData> {
872
860
  * callbacks.
873
861
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
874
862
  */
875
- setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
863
+ setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
876
864
  /**
877
865
  * Registers a featured collection dispatcher.
878
866
  * @param path The URI path pattern for the featured collection. The syntax
@@ -884,7 +872,7 @@ interface Federatable<TContextData> {
884
872
  * callbacks.
885
873
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
886
874
  */
887
- setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
875
+ setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
888
876
  /**
889
877
  * Registers a featured tags collection dispatcher.
890
878
  * @param path The URI path pattern for the featured tags collection.
@@ -896,7 +884,7 @@ interface Federatable<TContextData> {
896
884
  * callbacks.
897
885
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
898
886
  */
899
- setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
887
+ setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
900
888
  /**
901
889
  * Assigns the URL path for the inbox and starts setting inbox listeners.
902
890
  *
@@ -926,7 +914,7 @@ interface Federatable<TContextData> {
926
914
  * @returns An object to register inbox listeners.
927
915
  * @throws {RouteError} Thrown if the path pattern is invalid.
928
916
  */
929
- setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
917
+ setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
930
918
  /**
931
919
  * Registers a collection of objects dispatcher.
932
920
  *
@@ -941,7 +929,52 @@ interface Federatable<TContextData> {
941
929
  * The path must have one or more variables.
942
930
  * @param dispatcher A collection dispatcher callback to register.
943
931
  */
944
- 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>;
932
+ 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>;
933
+ /**
934
+ * Registers a collection of objects dispatcher.
935
+ *
936
+ * @template TContextData The context data to pass to the {@link Context}.
937
+ * @template TObject The type of objects to dispatch.
938
+ * @template TParam The parameter names of the requested URL.
939
+ * @param name A unique name for the collection dispatcher.
940
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
941
+ * @param path The URI path pattern for the collection dispatcher.
942
+ * The syntax is based on URI Template
943
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
944
+ * The path must have one or more variables.
945
+ * @param dispatcher A collection dispatcher callback to register.
946
+ */
947
+ 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>;
948
+ /**
949
+ * Registers a collection of objects dispatcher.
950
+ *
951
+ * @template TContextData The context data to pass to the {@link Context}.
952
+ * @template TObject The type of objects to dispatch.
953
+ * @template TParam The parameter names of the requested URL.
954
+ * @param name A unique name for the collection dispatcher.
955
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
956
+ * @param path The URI path pattern for the collection dispatcher.
957
+ * The syntax is based on URI Template
958
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
959
+ * The path must have one or more variables.
960
+ * @param dispatcher A collection dispatcher callback to register.
961
+ */
962
+ 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>;
963
+ /**
964
+ * Registers an ordered collection of objects dispatcher.
965
+ *
966
+ * @template TContextData The context data to pass to the {@link Context}.
967
+ * @template TObject The type of objects to dispatch.
968
+ * @template TParam The parameter names of the requested URL.
969
+ * @param name A unique name for the collection dispatcher.
970
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
971
+ * @param path The URI path pattern for the collection dispatcher.
972
+ * The syntax is based on URI Template
973
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
974
+ * The path must have one or more variables.
975
+ * @param dispatcher A collection dispatcher callback to register.
976
+ */
977
+ 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>;
945
978
  /**
946
979
  * Registers an ordered collection of objects dispatcher.
947
980
  *
@@ -956,7 +989,22 @@ interface Federatable<TContextData> {
956
989
  * The path must have one or more variables.
957
990
  * @param dispatcher A collection dispatcher callback to register.
958
991
  */
959
- 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>;
992
+ 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>;
993
+ /**
994
+ * Registers an ordered collection of objects dispatcher.
995
+ *
996
+ * @template TContextData The context data to pass to the {@link Context}.
997
+ * @template TObject The type of objects to dispatch.
998
+ * @template TParam The parameter names of the requested URL.
999
+ * @param name A unique name for the collection dispatcher.
1000
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1001
+ * @param path The URI path pattern for the collection dispatcher.
1002
+ * The syntax is based on URI Template
1003
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1004
+ * The path must have one or more variables.
1005
+ * @param dispatcher A collection dispatcher callback to register.
1006
+ */
1007
+ 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>;
960
1008
  }
961
1009
  /**
962
1010
  * An object that registers federation-related business logic and dispatches
@@ -1092,12 +1140,6 @@ interface FederationOptions<TContextData> {
1092
1140
  * @since 1.4.0
1093
1141
  */
1094
1142
  contextLoaderFactory?: DocumentLoaderFactory;
1095
- /**
1096
- * A custom JSON-LD context loader. By default, this uses the same loader
1097
- * as the document loader.
1098
- * @deprecated Use {@link contextLoaderFactory} instead.
1099
- */
1100
- contextLoader?: DocumentLoader;
1101
1143
  /**
1102
1144
  * A factory function that creates an authenticated document loader for a
1103
1145
  * given identity. This is used for fetching documents that require
@@ -1306,6 +1348,36 @@ interface CollectionCallbackSetters<TContext extends Context<TContextData>, TCon
1306
1348
  */
1307
1349
  authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
1308
1350
  }
1351
+ /**
1352
+ * The strategy for handling activity idempotency in inbox processing.
1353
+ *
1354
+ * - `"global"`: Activities are deduplicated globally across all inboxes and
1355
+ * origins. The same activity ID will be processed only once, regardless
1356
+ * of which inbox receives it or which server sent it.
1357
+ *
1358
+ * - `"per-origin"`: Activities are deduplicated per receiving server's origin.
1359
+ * The same activity ID will be processed only once on each receiving server,
1360
+ * but can be processed separately on different receiving servers. This had
1361
+ * been the default behavior in Fedify 1.x versions.
1362
+ *
1363
+ * - `"per-inbox"`: Activities are deduplicated per inbox. The same activity
1364
+ * ID can be processed once per inbox, allowing the same activity to be
1365
+ * delivered to multiple inboxes independently. This follows standard
1366
+ * ActivityPub behavior and is the default strategy since Fedify 2.0.0.
1367
+ *
1368
+ * @since 1.9.0
1369
+ */
1370
+ type IdempotencyStrategy = "global" | "per-origin" | "per-inbox";
1371
+ /**
1372
+ * A callback to generate a custom idempotency key for an activity.
1373
+ * Returns the cache key to use, or null to skip idempotency checking.
1374
+ * @template TContextData The context data to pass to the {@link InboxContext}.
1375
+ * @param ctx The inbox context.
1376
+ * @param activity The activity being processed.
1377
+ * @returns The idempotency key to use for caching, or null to skip caching.
1378
+ * @since 1.9.0
1379
+ */
1380
+ type IdempotencyKeyCallback<TContextData> = (ctx: InboxContext<TContextData>, activity: Activity) => string | null | Promise<string | null>;
1309
1381
  /**
1310
1382
  * Registry for inbox listeners for different activity types.
1311
1383
  */
@@ -1336,6 +1408,36 @@ interface InboxListenerSetters<TContextData> {
1336
1408
  * @since 0.11.0
1337
1409
  */
1338
1410
  setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
1411
+ /**
1412
+ * Configures the strategy for handling activity idempotency in inbox processing.
1413
+ *
1414
+ * @example
1415
+ * Use per-inbox strategy (standard ActivityPub behavior):
1416
+ * ```
1417
+ * federation
1418
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1419
+ * .withIdempotency("per-inbox");
1420
+ * ```
1421
+ *
1422
+ * Use custom strategy:
1423
+ * ```
1424
+ * federation
1425
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1426
+ * .withIdempotency((ctx, activity) => {
1427
+ * // Return null to skip idempotency
1428
+ * return `${ctx.origin}:${activity.id?.href}:${ctx.recipient}`;
1429
+ * });
1430
+ * ```
1431
+ *
1432
+ * @param strategy The idempotency strategy to use. Can be:
1433
+ * - `"global"`: Activities are deduplicated across all inboxes and origins
1434
+ * - `"per-origin"`: Activities are deduplicated per inbox origin
1435
+ * - `"per-inbox"`: Activities are deduplicated per inbox
1436
+ * - A custom callback function that returns the cache key to use
1437
+ * @returns The setters object so that settings can be chained.
1438
+ * @since 1.9.0
1439
+ */
1440
+ withIdempotency(strategy: IdempotencyStrategy | IdempotencyKeyCallback<TContextData>): InboxListenerSetters<TContextData>;
1339
1441
  }
1340
1442
  /**
1341
1443
  * Parameters of {@link Federation.fetch} method.
@@ -1374,38 +1476,38 @@ interface FederationFetchOptions<TContextData> {
1374
1476
  /**
1375
1477
  * Additional settings for a custom collection dispatcher.
1376
1478
  *
1377
- * @template TParams The type of the parameters in the URL path.
1479
+ * @template TParam The type of the parameters in the URL path.
1378
1480
  * @template TContext The type of the context. {@link Context} or
1379
1481
  * {@link RequestContext}.
1380
1482
  * @template TContextData The context data to pass to the {@link Context}.
1381
1483
  * @template TFilter The type of filter for the collection.
1382
1484
  */
1383
- interface CustomCollectionCallbackSetters<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> {
1485
+ interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
1384
1486
  /**
1385
1487
  * Sets the counter for the custom collection.
1386
1488
  * @param counter A callback that returns the number of items in the custom collection.
1387
1489
  * @returns The setters object so that settings can be chained.
1388
1490
  */
1389
- setCounter(counter: CustomCollectionCounter<TParams, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1491
+ setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1390
1492
  /**
1391
1493
  * Sets the first cursor for the custom collection.
1392
1494
  * @param cursor The cursor for the first item in the custom collection.
1393
1495
  * @returns The setters object so that settings can be chained.
1394
1496
  */
1395
- setFirstCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1497
+ setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1396
1498
  /**
1397
1499
  * Sets the last cursor for the custom collection.
1398
1500
  * @param cursor The cursor for the last item in the custom collection.
1399
1501
  * @returns The setters object so that settings can be chained.
1400
1502
  */
1401
- setLastCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1503
+ setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1402
1504
  /**
1403
1505
  * Specifies the conditions under which requests are authorized.
1404
1506
  * @param predicate A callback that returns whether a request is authorized.
1405
1507
  * @returns The setters object so that settings can be chained.
1406
1508
  * @since 0.7.0
1407
1509
  */
1408
- authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1510
+ authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1409
1511
  }
1410
1512
  /**
1411
1513
  * Represents an object with a type ID, which is either a constructor or an
@@ -1417,73 +1519,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
1417
1519
  typeId: URL;
1418
1520
  };
1419
1521
  /**
1420
- * Represents a path from the key of parameter objects.
1421
- * @param Params - A record of parameters where keys are parameter names and
1422
- * values are their string representations.
1423
- * @returns A string representing the path with all parameters.
1424
- * @example
1425
- * ```ts
1426
- * type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
1427
- * let userPostPath: UserPostPath;
1428
- * // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
1429
- * // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
1430
- * userPostPath = "/users/{userId}/posts/{postId}"; // valid
1431
- * userPostPath = "/posts/{postId}/users/{userId}"; // valid
1432
- * ```
1433
- */
1434
- type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
1435
- /**
1436
- * Represents a path with multiple parameters.
1437
- * All permutations of the parameters are included in the union type.
1438
- * The path must have all parameters in the form of `{paramName}`.
1439
- * @param Params - A union of parameter names.
1440
- * @returns A string representing the path with all parameters.
1441
- * @example
1442
- * ```ts
1443
- * type UserPostPath = ParamsPath<"userId" | "postId">;
1444
- * // = `${string}{userId}${string}` & `${string}{postId}${string}`
1445
- * // =
1446
- * // | `${string}{userId}${string}{postId}${string}`
1447
- * // | `${string}{postId}${string}{userId}${string}`
1448
- * let userPostPath: UserPostPath;
1449
- * userPostPath = "/users/posts"; // ❌ invalid
1450
- * userPostPath = "/users/{userId}"; // ❌ invalid
1451
- * userPostPath = "/posts/{postId}"; // ❌ invalid
1452
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
1453
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
1454
- */
1455
- type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
1456
- /**
1457
- * Represents a path with a single parameter.
1458
- * The path must have at least one of the parameters in the form of `{paramName}`.
1459
- * @param Param - The name of the parameter.
1460
- * @returns A string representing the path with the parameter.
1461
- * @example
1462
- * ```ts
1463
- * type UserPostPath = ParamPath<"userId" | "postId">;
1464
- * // = `${string}{userId}${string}` | `${string}{postId}${string}`
1465
- * let userPostPath: UserPostPath;
1466
- * userPostPath = "/users/posts"; // ❌ invalid
1467
- * userPostPath = "/users/{userId}"; // ✅ valid
1468
- * userPostPath = "/posts/{postId}"; // ✅ valid
1469
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
1470
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
1471
- */
1472
- type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
1473
- /**
1474
- * Converts union types to intersection types.
1522
+ * Defines a union of all valid RFC 6570 URI Template expressions for a given
1523
+ * parameter name.
1524
+ *
1525
+ * RFC 6570 specifies a syntax for URI templates, allowing for variable
1526
+ * expansion. This type captures all Level 1-4 operator expressions for a
1527
+ * single, named variable.
1528
+ *
1529
+ * The supported expression types are:
1530
+ * - `{Param}`: Simple string expansion
1531
+ * - `+{Param}`: Reserved string expansion
1532
+ * - `#{Param}`: Fragment expansion
1533
+ * - `{.Param}`: Label expansion with a dot-prefix
1534
+ * - `{/Param}`: Path segment expansion
1535
+ * - `{;Param}`: Path-style parameter expansion
1536
+ * - `{?Param}`: Query component expansion
1537
+ * - `{&Param}`: Query continuation expansion
1475
1538
  *
1476
- * @template U - The union type to convert.
1477
- * @returns The intersection type of the union.
1539
+ * @template Param The name of the parameter to be used in the expressions.
1478
1540
  * @example
1479
1541
  * ```ts
1480
- * type A = { a: string };
1481
- * type B = { b: number };
1482
- * type AorB = A | B;
1483
- * type AandB = UnionToIntersection<AorB>;
1484
- * // AandB = { a: string; b: number }
1542
+ * type UserIdExpression = Rfc6570Expression<"userId">;
1543
+ *
1544
+ * // The variable `userPath` can be assigned any of the valid expressions.
1545
+ * const userPath: UserIdExpression = "{/userId}";
1546
+ * ```
1547
+ * @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
1485
1548
  */
1486
- type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
1549
+ type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
1487
1550
  //#endregion
1488
1551
  //#region src/federation/context.d.ts
1489
1552
  /**
@@ -1572,9 +1635,7 @@ interface Context<TContextData> {
1572
1635
  * @throws {TypeError} If values are invalid.
1573
1636
  * @since 0.7.0
1574
1637
  */
1575
- getObjectUri<TObject extends Object$1>(cls: (new (...args: any[]) => TObject) & {
1576
- typeId: URL;
1577
- }, values: Record<string, string>): URL;
1638
+ getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
1578
1639
  /**
1579
1640
  * Builds the URI of an actor's outbox with the given identifier.
1580
1641
  * @param identifier The actor's identifier.
@@ -1888,9 +1949,7 @@ interface RequestContext<TContextData> extends Context<TContextData> {
1888
1949
  * @throws {TypeError} If values are invalid.
1889
1950
  * @since 0.7.0
1890
1951
  */
1891
- getObject<TObject extends Object$1>(cls: (new (...args: any[]) => TObject) & {
1892
- typeId: URL;
1893
- }, values: Record<string, string>): Promise<TObject | null>;
1952
+ getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
1894
1953
  /**
1895
1954
  * Gets the public key of the sender, if any exists and it is verified.
1896
1955
  * Otherwise, `null` is returned.
@@ -2034,9 +2093,7 @@ type ParseUriResult =
2034
2093
  * The case of an object URI.
2035
2094
  */ | {
2036
2095
  readonly type: "object";
2037
- readonly class: (new (...args: any[]) => Object$1) & {
2038
- typeId: URL;
2039
- };
2096
+ readonly class: ConstructorWithTypeId<Object$1>;
2040
2097
  readonly typeId: URL;
2041
2098
  readonly values: Record<string, string>;
2042
2099
  }
@@ -2254,4 +2311,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2254
2311
  multikey: Multikey;
2255
2312
  }
2256
2313
  //#endregion
2257
- 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 };
2314
+ 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, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };