@fedify/fedify 1.9.0-dev.1668 → 1.9.0-dev.1704

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 (138) hide show
  1. package/dist/{actor-ChSW_rBk.js → actor-B0LpLKRw.js} +7263 -2440
  2. package/dist/{actor-Ch5yFYFG.d.ts → actor-C1Euqngb.d.ts} +1 -1
  3. package/dist/{actor-BHAPrCDB.js → actor-CQzdjHs3.js} +1 -1
  4. package/dist/{actor-fGD4yb1K.cjs → actor-DU96UQUE.cjs} +7263 -2440
  5. package/dist/{actor-CHOM_AN3.d.cts → actor-Ydzhc8dj.d.cts} +1 -1
  6. package/dist/{authdocloader-eSrbn3wM.cjs → authdocloader-BkOerKL-.cjs} +3 -3
  7. package/dist/{authdocloader-CgrKtaQg.js → authdocloader-CzmsYrAn.js} +3 -3
  8. package/dist/{authdocloader-ChsJ9FJN.js → authdocloader-DI67R2Ku.js} +3 -3
  9. package/dist/{builder-DI4-Kpdg.js → builder-D2Oyy8AY.js} +14 -8
  10. package/dist/{client-B8gJ1cw8.js → client-BWusKCWF.js} +1 -1
  11. package/dist/compat/mod.d.cts +7 -7
  12. package/dist/compat/mod.d.ts +7 -7
  13. package/dist/compat/transformers.test.js +16 -16
  14. package/dist/{context-DFruNLny.d.ts → context-C51zGhGC.d.ts} +185 -92
  15. package/dist/{context-KXVF2AhH.d.cts → context-Qnv814-p.d.cts} +185 -92
  16. package/dist/{docloader-CSB8cAnw.cjs → docloader-NcFUThCx.cjs} +1 -1
  17. package/dist/{docloader-Bqh-eFNP.js → docloader-isD0ntZv.js} +1 -1
  18. package/dist/{esm-DTi75ew2.js → esm-BBVcrjH8.js} +1 -1
  19. package/dist/federation/builder.test.js +5 -5
  20. package/dist/federation/collection.test.js +3 -3
  21. package/dist/federation/handler.test.js +17 -17
  22. package/dist/federation/idempotency.test.d.ts +3 -0
  23. package/dist/federation/idempotency.test.js +202 -0
  24. package/dist/federation/inbox.test.js +4 -4
  25. package/dist/federation/keycache.test.js +4 -4
  26. package/dist/federation/kv.test.js +3 -3
  27. package/dist/federation/middleware.test.js +18 -18
  28. package/dist/federation/mod.cjs +10 -10
  29. package/dist/federation/mod.d.cts +7 -7
  30. package/dist/federation/mod.d.ts +7 -7
  31. package/dist/federation/mod.js +10 -10
  32. package/dist/federation/mq.test.js +3 -3
  33. package/dist/federation/retry.test.js +3 -3
  34. package/dist/federation/router.test.js +3 -3
  35. package/dist/federation/send.test.js +10 -10
  36. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
  37. package/dist/{http-B_zBcsai.d.cts → http-B1_DzfAU.d.cts} +1 -1
  38. package/dist/{http-BpAVdmaR.js → http-BiKoa3o_.js} +2 -2
  39. package/dist/{http-BDErrXSN.cjs → http-LVXxICJn.cjs} +3 -3
  40. package/dist/{http-DBHpjcjo.js → http-MyYS6o7t.js} +3 -3
  41. package/dist/{http-D8Q4xH0d.d.ts → http-wsGR6KkT.d.ts} +1 -1
  42. package/dist/{inbox-BA9sYsBf.js → inbox-CzGsgKH-.js} +29 -7
  43. package/dist/key-BEz2ThE9.cjs +10 -0
  44. package/dist/{key-DSOJOcRH.js → key-C0SCHEcf.js} +3 -3
  45. package/dist/{key-B27QtSbc.js → key-C5cRHj8g.js} +2 -2
  46. package/dist/{key-sCE-TgxY.js → key-CRhmBE03.js} +2 -2
  47. package/dist/{key-CYpTUnwf.cjs → key-Ci8OyUTB.cjs} +2 -2
  48. package/dist/{key-2rIHnPaA.js → key-DWPlWnFQ.js} +4 -4
  49. package/dist/{keycache-CiW2SvJu.js → keycache-rO8ea311.js} +1 -1
  50. package/dist/{keys-5cHW76LQ.js → keys-CWdCy_3n.js} +1 -1
  51. package/dist/{ld-upnKn3yw.js → ld-BWADNtQr.js} +2 -2
  52. package/dist/{lookup-B61sZAOY.js → lookup-BBTRFcU5.js} +1 -1
  53. package/dist/{lookup-BrrOs_g1.cjs → lookup-CILOZed9.cjs} +1 -1
  54. package/dist/{lookup-CZBG-vCx.js → lookup-RINL4MOa.js} +21 -12
  55. package/dist/{middleware-CyUVZG3t.js → middleware-Bcv0xCjs.js} +43 -40
  56. package/dist/middleware-Be9qUuwL.cjs +17 -0
  57. package/dist/{middleware-CfP7UhQy.js → middleware-BfhSHVoJ.js} +78 -47
  58. package/dist/middleware-CWlljVpG.js +26 -0
  59. package/dist/{middleware-P3jCWk4K.cjs → middleware-DDyUhxsm.cjs} +78 -47
  60. package/dist/middleware-Dm7sDAVJ.js +17 -0
  61. package/dist/{mod-NKH_G-IY.d.cts → mod-BUbqxBev.d.cts} +19 -1
  62. package/dist/{mod-Cy6pkZSn.d.ts → mod-CDObsV1d.d.ts} +19 -1
  63. package/dist/{mod-BAuhKa9d.d.ts → mod-CIbqfZW0.d.ts} +1 -1
  64. package/dist/{mod-YfAcrVbP.d.cts → mod-COTXAYRl.d.cts} +2 -2
  65. package/dist/{mod-B7Pc0I7F.d.ts → mod-DgcYoyZK.d.ts} +2 -2
  66. package/dist/{mod-C3CGxYoF.d.cts → mod-Dt-G9ZOS.d.cts} +1 -1
  67. package/dist/{mod-COw_caPC.d.cts → mod-fjqfsrty.d.cts} +2 -2
  68. package/dist/{mod-CiXjux2r.d.ts → mod-o-hx_hU8.d.ts} +2 -2
  69. package/dist/mod.cjs +10 -10
  70. package/dist/mod.d.cts +10 -10
  71. package/dist/mod.d.ts +10 -10
  72. package/dist/mod.js +10 -10
  73. package/dist/nodeinfo/client.test.js +5 -5
  74. package/dist/nodeinfo/handler.test.js +16 -16
  75. package/dist/nodeinfo/mod.cjs +2 -2
  76. package/dist/nodeinfo/mod.js +2 -2
  77. package/dist/nodeinfo/semver.test.js +3 -3
  78. package/dist/nodeinfo/types.test.js +3 -3
  79. package/dist/{owner-C9Ry0TOI.d.cts → owner-6KSEp9eV.d.cts} +2 -2
  80. package/dist/{owner-D38zBIMc.d.ts → owner-BbeUDvOu.d.ts} +2 -2
  81. package/dist/{owner-zvsMGYzc.js → owner-QEQV9vx-.js} +2 -2
  82. package/dist/{proof-Bt6yHsMN.js → proof-B_9fbF3f.js} +3 -3
  83. package/dist/{proof-BgKYSJ00.js → proof-g2_9VhUQ.js} +2 -2
  84. package/dist/{proof-CC_7UV_j.cjs → proof-v3B5cJ3c.cjs} +3 -3
  85. package/dist/runtime/authdocloader.test.js +9 -9
  86. package/dist/runtime/docloader.test.js +4 -4
  87. package/dist/runtime/key.test.js +5 -5
  88. package/dist/runtime/langstr.test.js +3 -3
  89. package/dist/runtime/link.test.js +3 -3
  90. package/dist/runtime/mod.cjs +6 -6
  91. package/dist/runtime/mod.d.cts +3 -3
  92. package/dist/runtime/mod.d.ts +3 -3
  93. package/dist/runtime/mod.js +6 -6
  94. package/dist/runtime/multibase/multibase.test.js +3 -3
  95. package/dist/runtime/url.test.js +3 -3
  96. package/dist/{send-DlqdAGHP.js → send-cTLNXtTp.js} +2 -2
  97. package/dist/sig/http.test.js +8 -8
  98. package/dist/sig/key.test.js +6 -6
  99. package/dist/sig/ld.test.js +7 -7
  100. package/dist/sig/mod.cjs +6 -6
  101. package/dist/sig/mod.d.cts +5 -5
  102. package/dist/sig/mod.d.ts +5 -5
  103. package/dist/sig/mod.js +6 -6
  104. package/dist/sig/owner.test.js +7 -7
  105. package/dist/sig/proof.test.js +7 -7
  106. package/dist/testing/docloader.test.js +3 -3
  107. package/dist/testing/mod.d.ts +391 -86
  108. package/dist/testing/mod.js +3 -3
  109. package/dist/{testing-CAAJTPCt.js → testing-CNtyBr2m.js} +2 -2
  110. package/dist/{type-BRNRL3aj.js → type-C5udJemk.js} +6943 -2120
  111. package/dist/{types-Dz0NMslg.cjs → types-C9w81XqW.cjs} +1 -1
  112. package/dist/{types-C8yjtF5A.js → types-DHq9gRM4.js} +1 -1
  113. package/dist/vocab/actor.test.js +5 -5
  114. package/dist/vocab/lookup.test.js +255 -5
  115. package/dist/vocab/mod.cjs +4 -4
  116. package/dist/vocab/mod.d.cts +3 -3
  117. package/dist/vocab/mod.d.ts +3 -3
  118. package/dist/vocab/mod.js +4 -4
  119. package/dist/vocab/type.test.js +3 -3
  120. package/dist/vocab/vocab.test.js +397 -8
  121. package/dist/{vocab-BDMmyzZA.cjs → vocab-BoyCE2Rn.cjs} +23 -14
  122. package/dist/{vocab-BEEm2I6u.d.ts → vocab-CDHNj5zp.d.ts} +290 -0
  123. package/dist/{vocab-BzGg7ltX.d.cts → vocab-Cfs0937i.d.cts} +290 -0
  124. package/dist/{vocab-WpDLcZH7.js → vocab-DxoBe7PI.js} +23 -14
  125. package/dist/webfinger/handler.test.js +16 -16
  126. package/dist/webfinger/lookup.test.js +4 -4
  127. package/dist/webfinger/mod.cjs +2 -2
  128. package/dist/webfinger/mod.js +2 -2
  129. package/dist/x/cfworkers.test.js +3 -3
  130. package/dist/x/hono.d.cts +6 -6
  131. package/dist/x/hono.d.ts +6 -6
  132. package/dist/x/sveltekit.d.cts +6 -6
  133. package/dist/x/sveltekit.d.ts +6 -6
  134. package/package.json +1 -1
  135. package/dist/key-Ck4-GNm0.cjs +0 -10
  136. package/dist/middleware-D8O6iKhr.js +0 -26
  137. package/dist/middleware-DI4sIaI4.js +0 -17
  138. package/dist/middleware-lw0MLhVG.cjs +0 -17
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import { KvKey, KvStore } from "./kv-C7sopW2E.js";
4
4
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
5
5
  import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-DF8anIB5.js";
6
- import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-BEEm2I6u.js";
7
- import { Actor, Recipient } from "./actor-Ch5yFYFG.js";
8
- import { HttpMessageSignaturesSpec } from "./http-D8Q4xH0d.js";
9
- import { GetKeyOwnerOptions } from "./owner-D38zBIMc.js";
10
- import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-Cy6pkZSn.js";
6
+ import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-CDHNj5zp.js";
7
+ import { Actor, Recipient } from "./actor-C1Euqngb.js";
8
+ import { HttpMessageSignaturesSpec } from "./http-wsGR6KkT.js";
9
+ import { GetKeyOwnerOptions } from "./owner-BbeUDvOu.js";
10
+ import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-CDObsV1d.js";
11
11
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-DBzN0aCM.js";
12
12
  import { MessageQueue } from "./mq-CRGm1e_F.js";
13
13
  import { Span, TracerProvider } from "@opentelemetry/api";
@@ -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
  *
@@ -768,7 +768,7 @@ interface Federatable<TContextData> {
768
768
  */
769
769
  setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
770
770
  typeId: URL;
771
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
771
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
772
772
  /**
773
773
  * Registers an object dispatcher.
774
774
  *
@@ -784,7 +784,7 @@ interface Federatable<TContextData> {
784
784
  */
785
785
  setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
786
786
  typeId: URL;
787
- }, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
787
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
788
788
  /**
789
789
  * Registers an object dispatcher.
790
790
  *
@@ -800,7 +800,7 @@ interface Federatable<TContextData> {
800
800
  */
801
801
  setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
802
802
  typeId: URL;
803
- }, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
803
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
804
804
  /**
805
805
  * Registers an inbox dispatcher.
806
806
  *
@@ -812,7 +812,7 @@ interface Federatable<TContextData> {
812
812
  * @param dispatcher An inbox dispatcher callback to register.
813
813
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
814
814
  */
815
- setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
815
+ setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
816
816
  /**
817
817
  * Registers an outbox dispatcher.
818
818
  *
@@ -836,7 +836,7 @@ interface Federatable<TContextData> {
836
836
  * @param dispatcher An outbox dispatcher callback to register.
837
837
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
838
838
  */
839
- setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
839
+ setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
840
840
  /**
841
841
  * Registers a following collection dispatcher.
842
842
  * @param path The URI path pattern for the following collection. The syntax
@@ -848,7 +848,7 @@ interface Federatable<TContextData> {
848
848
  * callbacks.
849
849
  * @throws {RouterError} Thrown if the path pattern is invalid.
850
850
  */
851
- setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
851
+ setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
852
852
  /**
853
853
  * Registers a followers collection dispatcher.
854
854
  * @param path The URI path pattern for the followers collection. The syntax
@@ -860,7 +860,7 @@ interface Federatable<TContextData> {
860
860
  * callbacks.
861
861
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
862
862
  */
863
- setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
863
+ setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
864
864
  /**
865
865
  * Registers a liked collection dispatcher.
866
866
  * @param path The URI path pattern for the liked collection. The syntax
@@ -872,7 +872,7 @@ interface Federatable<TContextData> {
872
872
  * callbacks.
873
873
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
874
874
  */
875
- setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
875
+ 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
876
  /**
877
877
  * Registers a featured collection dispatcher.
878
878
  * @param path The URI path pattern for the featured collection. The syntax
@@ -884,7 +884,7 @@ interface Federatable<TContextData> {
884
884
  * callbacks.
885
885
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
886
886
  */
887
- setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
887
+ setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
888
888
  /**
889
889
  * Registers a featured tags collection dispatcher.
890
890
  * @param path The URI path pattern for the featured tags collection.
@@ -896,7 +896,7 @@ interface Federatable<TContextData> {
896
896
  * callbacks.
897
897
  * @throws {@link RouterError} Thrown if the path pattern is invalid.
898
898
  */
899
- setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
899
+ setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
900
900
  /**
901
901
  * Assigns the URL path for the inbox and starts setting inbox listeners.
902
902
  *
@@ -926,7 +926,7 @@ interface Federatable<TContextData> {
926
926
  * @returns An object to register inbox listeners.
927
927
  * @throws {RouteError} Thrown if the path pattern is invalid.
928
928
  */
929
- setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
929
+ setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
930
930
  /**
931
931
  * Registers a collection of objects dispatcher.
932
932
  *
@@ -941,7 +941,43 @@ interface Federatable<TContextData> {
941
941
  * The path must have one or more variables.
942
942
  * @param dispatcher A collection dispatcher callback to register.
943
943
  */
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>;
944
+ setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
945
+ typeId: URL;
946
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
947
+ /**
948
+ * Registers a collection of objects dispatcher.
949
+ *
950
+ * @template TContextData The context data to pass to the {@link Context}.
951
+ * @template TObject The type of objects to dispatch.
952
+ * @template TParam The parameter names of the requested URL.
953
+ * @param name A unique name for the collection dispatcher.
954
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
955
+ * @param path The URI path pattern for the collection dispatcher.
956
+ * The syntax is based on URI Template
957
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
958
+ * The path must have one or more variables.
959
+ * @param dispatcher A collection dispatcher callback to register.
960
+ */
961
+ setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
962
+ typeId: URL;
963
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
964
+ /**
965
+ * Registers a collection of objects dispatcher.
966
+ *
967
+ * @template TContextData The context data to pass to the {@link Context}.
968
+ * @template TObject The type of objects to dispatch.
969
+ * @template TParam The parameter names of the requested URL.
970
+ * @param name A unique name for the collection dispatcher.
971
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
972
+ * @param path The URI path pattern for the collection dispatcher.
973
+ * The syntax is based on URI Template
974
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
975
+ * The path must have one or more variables.
976
+ * @param dispatcher A collection dispatcher callback to register.
977
+ */
978
+ setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
979
+ typeId: URL;
980
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
945
981
  /**
946
982
  * Registers an ordered collection of objects dispatcher.
947
983
  *
@@ -956,7 +992,43 @@ interface Federatable<TContextData> {
956
992
  * The path must have one or more variables.
957
993
  * @param dispatcher A collection dispatcher callback to register.
958
994
  */
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>;
995
+ setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
996
+ typeId: URL;
997
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
998
+ /**
999
+ * Registers an ordered collection of objects dispatcher.
1000
+ *
1001
+ * @template TContextData The context data to pass to the {@link Context}.
1002
+ * @template TObject The type of objects to dispatch.
1003
+ * @template TParam The parameter names of the requested URL.
1004
+ * @param name A unique name for the collection dispatcher.
1005
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1006
+ * @param path The URI path pattern for the collection dispatcher.
1007
+ * The syntax is based on URI Template
1008
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1009
+ * The path must have one or more variables.
1010
+ * @param dispatcher A collection dispatcher callback to register.
1011
+ */
1012
+ setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
1013
+ typeId: URL;
1014
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
1015
+ /**
1016
+ * Registers an ordered collection of objects dispatcher.
1017
+ *
1018
+ * @template TContextData The context data to pass to the {@link Context}.
1019
+ * @template TObject The type of objects to dispatch.
1020
+ * @template TParam The parameter names of the requested URL.
1021
+ * @param name A unique name for the collection dispatcher.
1022
+ * @param itemType The Activity Vocabulary class of the object to dispatch.
1023
+ * @param path The URI path pattern for the collection dispatcher.
1024
+ * The syntax is based on URI Template
1025
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1026
+ * The path must have one or more variables.
1027
+ * @param dispatcher A collection dispatcher callback to register.
1028
+ */
1029
+ setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
1030
+ typeId: URL;
1031
+ }, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
960
1032
  }
961
1033
  /**
962
1034
  * An object that registers federation-related business logic and dispatches
@@ -1312,6 +1384,36 @@ interface CollectionCallbackSetters<TContext extends Context<TContextData>, TCon
1312
1384
  */
1313
1385
  authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
1314
1386
  }
1387
+ /**
1388
+ * The strategy for handling activity idempotency in inbox processing.
1389
+ *
1390
+ * - `"global"`: Activities are deduplicated globally across all inboxes and
1391
+ * origins. The same activity ID will be processed only once, regardless
1392
+ * of which inbox receives it or which server sent it.
1393
+ *
1394
+ * - `"per-origin"`: Activities are deduplicated per receiving server's origin.
1395
+ * The same activity ID will be processed only once on each receiving server,
1396
+ * but can be processed separately on different receiving servers. This was
1397
+ * the default behavior in Fedify 1.x versions.
1398
+ *
1399
+ * - `"per-inbox"`: Activities are deduplicated per inbox. The same activity
1400
+ * ID can be processed once per inbox, allowing the same activity to be
1401
+ * delivered to multiple inboxes independently. This follows standard
1402
+ * ActivityPub behavior and will be the default in Fedify 2.0.
1403
+ *
1404
+ * @since 1.9.0
1405
+ */
1406
+ type IdempotencyStrategy = "global" | "per-origin" | "per-inbox";
1407
+ /**
1408
+ * A callback to generate a custom idempotency key for an activity.
1409
+ * Returns the cache key to use, or null to skip idempotency checking.
1410
+ * @template TContextData The context data to pass to the {@link InboxContext}.
1411
+ * @param ctx The inbox context.
1412
+ * @param activity The activity being processed.
1413
+ * @returns The idempotency key to use for caching, or null to skip caching.
1414
+ * @since 1.9.0
1415
+ */
1416
+ type IdempotencyKeyCallback<TContextData> = (ctx: InboxContext<TContextData>, activity: Activity) => string | null | Promise<string | null>;
1315
1417
  /**
1316
1418
  * Registry for inbox listeners for different activity types.
1317
1419
  */
@@ -1342,6 +1444,36 @@ interface InboxListenerSetters<TContextData> {
1342
1444
  * @since 0.11.0
1343
1445
  */
1344
1446
  setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
1447
+ /**
1448
+ * Configures the strategy for handling activity idempotency in inbox processing.
1449
+ *
1450
+ * @example
1451
+ * Use per-inbox strategy (standard ActivityPub behavior):
1452
+ * ```
1453
+ * federation
1454
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1455
+ * .withIdempotency("per-inbox");
1456
+ * ```
1457
+ *
1458
+ * Use custom strategy:
1459
+ * ```
1460
+ * federation
1461
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1462
+ * .withIdempotency((ctx, activity) => {
1463
+ * // Return null to skip idempotency
1464
+ * return `${ctx.origin}:${activity.id?.href}:${ctx.recipient}`;
1465
+ * });
1466
+ * ```
1467
+ *
1468
+ * @param strategy The idempotency strategy to use. Can be:
1469
+ * - `"global"`: Activities are deduplicated across all inboxes and origins
1470
+ * - `"per-origin"`: Activities are deduplicated per inbox origin
1471
+ * - `"per-inbox"`: Activities are deduplicated per inbox
1472
+ * - A custom callback function that returns the cache key to use
1473
+ * @returns The setters object so that settings can be chained.
1474
+ * @since 1.9.0
1475
+ */
1476
+ withIdempotency(strategy: IdempotencyStrategy | IdempotencyKeyCallback<TContextData>): InboxListenerSetters<TContextData>;
1345
1477
  }
1346
1478
  /**
1347
1479
  * Parameters of {@link Federation.fetch} method.
@@ -1380,38 +1512,38 @@ interface FederationFetchOptions<TContextData> {
1380
1512
  /**
1381
1513
  * Additional settings for a custom collection dispatcher.
1382
1514
  *
1383
- * @template TParams The type of the parameters in the URL path.
1515
+ * @template TParam The type of the parameters in the URL path.
1384
1516
  * @template TContext The type of the context. {@link Context} or
1385
1517
  * {@link RequestContext}.
1386
1518
  * @template TContextData The context data to pass to the {@link Context}.
1387
1519
  * @template TFilter The type of filter for the collection.
1388
1520
  */
1389
- interface CustomCollectionCallbackSetters<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> {
1521
+ interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
1390
1522
  /**
1391
1523
  * Sets the counter for the custom collection.
1392
1524
  * @param counter A callback that returns the number of items in the custom collection.
1393
1525
  * @returns The setters object so that settings can be chained.
1394
1526
  */
1395
- setCounter(counter: CustomCollectionCounter<TParams, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1527
+ setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1396
1528
  /**
1397
1529
  * Sets the first cursor for the custom collection.
1398
1530
  * @param cursor The cursor for the first item in the custom collection.
1399
1531
  * @returns The setters object so that settings can be chained.
1400
1532
  */
1401
- setFirstCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1533
+ setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1402
1534
  /**
1403
1535
  * Sets the last cursor for the custom collection.
1404
1536
  * @param cursor The cursor for the last item in the custom collection.
1405
1537
  * @returns The setters object so that settings can be chained.
1406
1538
  */
1407
- setLastCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1539
+ setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1408
1540
  /**
1409
1541
  * Specifies the conditions under which requests are authorized.
1410
1542
  * @param predicate A callback that returns whether a request is authorized.
1411
1543
  * @returns The setters object so that settings can be chained.
1412
1544
  * @since 0.7.0
1413
1545
  */
1414
- authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
1546
+ authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
1415
1547
  }
1416
1548
  /**
1417
1549
  * Represents an object with a type ID, which is either a constructor or an
@@ -1423,73 +1555,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
1423
1555
  typeId: URL;
1424
1556
  };
1425
1557
  /**
1426
- * Represents a path from the key of parameter objects.
1427
- * @param Params - A record of parameters where keys are parameter names and
1428
- * values are their string representations.
1429
- * @returns A string representing the path with all parameters.
1430
- * @example
1431
- * ```ts
1432
- * type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
1433
- * let userPostPath: UserPostPath;
1434
- * // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
1435
- * // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
1436
- * userPostPath = "/users/{userId}/posts/{postId}"; // valid
1437
- * userPostPath = "/posts/{postId}/users/{userId}"; // valid
1438
- * ```
1439
- */
1440
- type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
1441
- /**
1442
- * Represents a path with multiple parameters.
1443
- * All permutations of the parameters are included in the union type.
1444
- * The path must have all parameters in the form of `{paramName}`.
1445
- * @param Params - A union of parameter names.
1446
- * @returns A string representing the path with all parameters.
1447
- * @example
1448
- * ```ts
1449
- * type UserPostPath = ParamsPath<"userId" | "postId">;
1450
- * // = `${string}{userId}${string}` & `${string}{postId}${string}`
1451
- * // =
1452
- * // | `${string}{userId}${string}{postId}${string}`
1453
- * // | `${string}{postId}${string}{userId}${string}`
1454
- * let userPostPath: UserPostPath;
1455
- * userPostPath = "/users/posts"; // ❌ invalid
1456
- * userPostPath = "/users/{userId}"; // ❌ invalid
1457
- * userPostPath = "/posts/{postId}"; // ❌ invalid
1458
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
1459
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
1460
- */
1461
- type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
1462
- /**
1463
- * Represents a path with a single parameter.
1464
- * The path must have at least one of the parameters in the form of `{paramName}`.
1465
- * @param Param - The name of the parameter.
1466
- * @returns A string representing the path with the parameter.
1467
- * @example
1468
- * ```ts
1469
- * type UserPostPath = ParamPath<"userId" | "postId">;
1470
- * // = `${string}{userId}${string}` | `${string}{postId}${string}`
1471
- * let userPostPath: UserPostPath;
1472
- * userPostPath = "/users/posts"; // ❌ invalid
1473
- * userPostPath = "/users/{userId}"; // ✅ valid
1474
- * userPostPath = "/posts/{postId}"; // ✅ valid
1475
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
1476
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
1477
- */
1478
- type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
1479
- /**
1480
- * Converts union types to intersection types.
1558
+ * Defines a union of all valid RFC 6570 URI Template expressions for a given
1559
+ * parameter name.
1560
+ *
1561
+ * RFC 6570 specifies a syntax for URI templates, allowing for variable
1562
+ * expansion. This type captures all Level 1-4 operator expressions for a
1563
+ * single, named variable.
1481
1564
  *
1482
- * @template U - The union type to convert.
1483
- * @returns The intersection type of the union.
1565
+ * The supported expression types are:
1566
+ * - `{Param}`: Simple string expansion
1567
+ * - `+{Param}`: Reserved string expansion
1568
+ * - `#{Param}`: Fragment expansion
1569
+ * - `{.Param}`: Label expansion with a dot-prefix
1570
+ * - `{/Param}`: Path segment expansion
1571
+ * - `{;Param}`: Path-style parameter expansion
1572
+ * - `{?Param}`: Query component expansion
1573
+ * - `{&Param}`: Query continuation expansion
1574
+ *
1575
+ * @template Param The name of the parameter to be used in the expressions.
1484
1576
  * @example
1485
1577
  * ```ts
1486
- * type A = { a: string };
1487
- * type B = { b: number };
1488
- * type AorB = A | B;
1489
- * type AandB = UnionToIntersection<AorB>;
1490
- * // AandB = { a: string; b: number }
1578
+ * type UserIdExpression = Rfc6570Expression<"userId">;
1579
+ *
1580
+ * // The variable `userPath` can be assigned any of the valid expressions.
1581
+ * const userPath: UserIdExpression = "{/userId}";
1582
+ * ```
1583
+ * @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
1491
1584
  */
1492
- type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
1585
+ type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
1493
1586
  //#endregion
1494
1587
  //#region src/federation/context.d.ts
1495
1588
  /**
@@ -2260,4 +2353,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2260
2353
  multikey: Multikey;
2261
2354
  }
2262
2355
  //#endregion
2263
- 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 };
2356
+ 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 };