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

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 (184) hide show
  1. package/dist/actor-CrTGiTZd.cjs +42609 -0
  2. package/dist/{actor-Cc6B76eG.js → actor-D5S46edz.js} +1 -1
  3. package/dist/actor-D6K058Tb.d.cts +128 -0
  4. package/dist/{actor-CTAuCsWy.js → actor-G2S5sPEA.js} +6951 -2127
  5. package/dist/{actor-C22bXuuC.d.ts → actor-T6RyhRgk.d.ts} +1 -1
  6. package/dist/{authdocloader-BFVqUbyo.js → authdocloader-C5AvdCCi.js} +6 -6
  7. package/dist/authdocloader-CQMPmpaO.cjs +58 -0
  8. package/dist/{authdocloader-CLgDGafZ.js → authdocloader-SjwloJUA.js} +3 -3
  9. package/dist/{builder-BOEBObR8.js → builder-OA47XRft.js} +10 -4
  10. package/dist/chunk-DqRYRqnO.cjs +34 -0
  11. package/dist/{client-De-z2UnN.js → client-Bmd-i8x8.js} +3 -22
  12. package/dist/client-CegPX0Rn.d.cts +222 -0
  13. package/dist/{client-DF8anIB5.d.ts → client-bgSdkFa2.d.ts} +2 -74
  14. package/dist/compat/mod.cjs +10 -0
  15. package/dist/compat/mod.d.cts +13 -0
  16. package/dist/compat/mod.d.ts +8 -8
  17. package/dist/compat/mod.js +5 -5
  18. package/dist/compat/transformers.test.js +19 -19
  19. package/dist/compat-DmDDELst.cjs +4 -0
  20. package/dist/compat-nxUqe4Z-.js +4 -0
  21. package/dist/{context-9gCpIkiz.d.ts → context-ByZprN0S.d.ts} +67 -7
  22. package/dist/context-C5BsZkDr.d.cts +2315 -0
  23. package/dist/docloader-7Ey7wNHx.cjs +4861 -0
  24. package/dist/{docloader-DEhniCVa.js → docloader-CkweNhUH.js} +189 -9
  25. package/dist/docloader-D-MrRyHl.d.cts +219 -0
  26. package/dist/{esm-CHdxdkuH.js → esm-CwHz8Y8t.js} +1 -1
  27. package/dist/federation/builder.test.js +6 -7
  28. package/dist/federation/collection.test.js +4 -4
  29. package/dist/federation/handler.test.js +23 -143
  30. package/dist/federation/idempotency.test.js +202 -0
  31. package/dist/federation/inbox.test.js +4 -4
  32. package/dist/federation/keycache.test.js +4 -4
  33. package/dist/federation/kv.test.js +4 -3
  34. package/dist/federation/middleware.test.js +231 -52
  35. package/dist/federation/mod.cjs +29 -0
  36. package/dist/federation/mod.d.cts +13 -0
  37. package/dist/federation/mod.d.ts +8 -8
  38. package/dist/federation/mod.js +15 -15
  39. package/dist/federation/mq.test.js +3 -3
  40. package/dist/federation/negotiation.test.d.ts +3 -0
  41. package/dist/federation/negotiation.test.js +28 -0
  42. package/dist/federation/retry.test.js +3 -3
  43. package/dist/federation/router.test.js +3 -3
  44. package/dist/federation/send.test.js +10 -10
  45. package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
  46. package/dist/federation-H2_En3j5.cjs +244 -0
  47. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
  48. package/dist/http-BiBofurJ.cjs +826 -0
  49. package/dist/{http-l0TEupZK.js → http-C5tC93Hn.js} +7 -7
  50. package/dist/http-D-e6AFwR.d.cts +253 -0
  51. package/dist/{http-DqSNLFNY.d.ts → http-D6Uj2x2y.d.ts} +1 -1
  52. package/dist/{http-CcdM1brU.js → http-DGjdMiLc.js} +3 -3
  53. package/dist/{inbox-B6DZbGNf.js → inbox-BoDY3z8G.js} +24 -7
  54. package/dist/key-CZR7QraT.cjs +290 -0
  55. package/dist/key-Cf8MffVe.cjs +10 -0
  56. package/dist/{key-DxA6xRtZ.js → key-CkxrAIyp.js} +5 -5
  57. package/dist/key-Dk0j88Jo.js +10 -0
  58. package/dist/{key-CUZQgVlf.js → key-Epcl5jpz.js} +3 -3
  59. package/dist/{key-CzLv1phF.js → key-IxRhZpOF.js} +2 -2
  60. package/dist/{keycache-B8HdZJSt.js → keycache-TEniXNel.js} +1 -1
  61. package/dist/{keys-zZwiKkfx.js → keys-bZxcrZ9Z.js} +1 -1
  62. package/dist/kv-63Cil1MD.d.cts +81 -0
  63. package/dist/{ld-CBcQdZ6N.js → ld-DW7A0uIc.js} +4 -4
  64. package/dist/{lookup-Bn_HEC_d.js → lookup-DhQCVVja.js} +21 -12
  65. package/dist/lookup-DiV4LFBg.cjs +137 -0
  66. package/dist/{lookup-dtdr2ftf.js → lookup-cVRa2QM-.js} +4 -4
  67. package/dist/middleware-Be1JStOx.js +17 -0
  68. package/dist/middleware-CDOK7WOb.js +26 -0
  69. package/dist/{middleware-BRgu1IH8.js → middleware-Cgr3PtaJ.js} +58 -149
  70. package/dist/{middleware-CxEkcFW0.js → middleware-DvvYAIsd.js} +87 -91
  71. package/dist/middleware-EjIW2mZB.cjs +17 -0
  72. package/dist/middleware-TfuVoceY.cjs +4231 -0
  73. package/dist/mod-8DMWKtQE.d.cts +80 -0
  74. package/dist/{mod-Drmz72EK.d.ts → mod-BhUKmBJD.d.ts} +2 -2
  75. package/dist/mod-C2tOeRkN.d.cts +1 -0
  76. package/dist/{mod-TFoH2Ql8.d.ts → mod-CerN_Sza.d.ts} +1 -1
  77. package/dist/mod-Cj1tHXBR.d.cts +102 -0
  78. package/dist/mod-CxkWO3Mg.d.cts +307 -0
  79. package/dist/{mod-Bqxcp7eN.d.ts → mod-D6hQoxC5.d.ts} +2 -2
  80. package/dist/mod-Djzcw2ry.d.cts +266 -0
  81. package/dist/{mod-Cxt4Kpf6.d.ts → mod-DlU8ISoa.d.ts} +19 -1
  82. package/dist/mod-FZd39qVq.d.cts +1 -0
  83. package/dist/mod-jQ4OODsl.d.cts +113 -0
  84. package/dist/mod.cjs +150 -0
  85. package/dist/mod.d.cts +17 -0
  86. package/dist/mod.d.ts +11 -11
  87. package/dist/mod.js +21 -21
  88. package/dist/mq-B7R1Q-M5.d.cts +140 -0
  89. package/dist/negotiation-5NPJL6zp.js +71 -0
  90. package/dist/nodeinfo/client.test.js +27 -106
  91. package/dist/nodeinfo/handler.test.js +20 -20
  92. package/dist/nodeinfo/mod.cjs +11 -0
  93. package/dist/nodeinfo/mod.d.cts +5 -0
  94. package/dist/nodeinfo/mod.d.ts +2 -2
  95. package/dist/nodeinfo/mod.js +7 -7
  96. package/dist/nodeinfo/types.test.js +5 -10
  97. package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
  98. package/dist/nodeinfo-DfycQ8Wf.js +4 -0
  99. package/dist/{owner-VEIjmR8r.js → owner-6Vc3UXXE.js} +2 -2
  100. package/dist/owner-BN_tO3cY.d.cts +67 -0
  101. package/dist/{owner-CQPnQVtf.d.ts → owner-hd9lvQcP.d.ts} +2 -2
  102. package/dist/{proof-DoSQAGkE.js → proof-C1jhbeNv.js} +3 -3
  103. package/dist/proof-CRJWXFfT.cjs +673 -0
  104. package/dist/{proof-tgUlT8hw.js → proof-Chi90OXv.js} +9 -9
  105. package/dist/runtime/authdocloader.test.js +9 -9
  106. package/dist/runtime/docloader.test.js +4 -4
  107. package/dist/runtime/key.test.js +5 -5
  108. package/dist/runtime/langstr.test.js +3 -3
  109. package/dist/runtime/link.test.d.ts +3 -0
  110. package/dist/runtime/link.test.js +61 -0
  111. package/dist/runtime/mod.cjs +25 -0
  112. package/dist/runtime/mod.d.cts +6 -0
  113. package/dist/runtime/mod.d.ts +3 -3
  114. package/dist/runtime/mod.js +10 -10
  115. package/dist/runtime/multibase/multibase.test.js +3 -3
  116. package/dist/runtime/url.test.js +3 -3
  117. package/dist/runtime-C58AJWSv.cjs +4 -0
  118. package/dist/runtime-DPYEDf-o.js +4 -0
  119. package/dist/{send-BzS7w-QF.js → send-DjATl6i3.js} +2 -2
  120. package/dist/sig/http.test.js +9 -9
  121. package/dist/sig/key.test.js +6 -6
  122. package/dist/sig/ld.test.js +7 -7
  123. package/dist/sig/mod.cjs +30 -0
  124. package/dist/sig/mod.d.cts +8 -0
  125. package/dist/sig/mod.d.ts +5 -5
  126. package/dist/sig/mod.js +10 -10
  127. package/dist/sig/owner.test.js +7 -7
  128. package/dist/sig/proof.test.js +7 -7
  129. package/dist/sig-ByHXzqUi.cjs +4 -0
  130. package/dist/sig-Cj3tk-ig.js +4 -0
  131. package/dist/testing/docloader.test.js +3 -3
  132. package/dist/testing/mod.d.ts +273 -28
  133. package/dist/testing/mod.js +3 -3
  134. package/dist/{testing-Z2omCvKy.js → testing-BnfPB5T-.js} +2 -2
  135. package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
  136. package/dist/transformers-CoBS-oFG.cjs +116 -0
  137. package/dist/{type-SK-d7Tbw.js → type-NEA09tSC.js} +7262 -2258
  138. package/dist/{types-BIgY6c-l.js → types-BSuWJsOm.js} +1 -3
  139. package/dist/types-CmmUQisS.cjs +315 -0
  140. package/dist/{types-DgPvoUWN.js → types-dLXLjVLf.js} +8 -169
  141. package/dist/vocab/actor.test.js +5 -5
  142. package/dist/vocab/lookup.test.js +255 -5
  143. package/dist/vocab/mod.cjs +87 -0
  144. package/dist/vocab/mod.d.cts +6 -0
  145. package/dist/vocab/mod.d.ts +3 -3
  146. package/dist/vocab/mod.js +7 -7
  147. package/dist/vocab/type.test.js +3 -3
  148. package/dist/vocab/vocab.test.js +433 -9
  149. package/dist/{vocab-SOE1ifCr.d.ts → vocab-BI0Ak5lL.d.ts} +290 -0
  150. package/dist/vocab-C5Y-0fGj.cjs +291 -0
  151. package/dist/vocab-Dw1-yVGg.d.cts +14922 -0
  152. package/dist/{vocab-CvD6Vbml.js → vocab-rWbHpc2J.js} +26 -17
  153. package/dist/webfinger/handler.test.js +19 -19
  154. package/dist/webfinger/lookup.test.js +4 -4
  155. package/dist/webfinger/mod.cjs +9 -0
  156. package/dist/webfinger/mod.d.cts +4 -0
  157. package/dist/webfinger/mod.js +6 -6
  158. package/dist/webfinger-BjOEdFPs.cjs +4 -0
  159. package/dist/webfinger-De_bU0iE.js +4 -0
  160. package/dist/x/cfworkers.cjs +100 -0
  161. package/dist/x/cfworkers.d.cts +59 -0
  162. package/dist/x/cfworkers.js +3 -3
  163. package/dist/x/cfworkers.test.js +3 -3
  164. package/dist/x/hono.cjs +61 -0
  165. package/dist/x/hono.d.cts +54 -0
  166. package/dist/x/hono.d.ts +7 -7
  167. package/dist/x/hono.js +3 -3
  168. package/dist/x/sveltekit.cjs +69 -0
  169. package/dist/x/sveltekit.d.cts +46 -0
  170. package/dist/x/sveltekit.d.ts +7 -7
  171. package/dist/x/sveltekit.js +3 -3
  172. package/package.json +68 -13
  173. package/dist/compat-Bb5myD13.js +0 -4
  174. package/dist/key-Deb0_wWL.js +0 -10
  175. package/dist/middleware-BE_geSiJ.js +0 -17
  176. package/dist/middleware-BnU6hzVp.js +0 -26
  177. package/dist/nodeinfo/semver.test.js +0 -143
  178. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  179. package/dist/runtime-BSkOVUWM.js +0 -4
  180. package/dist/semver-dArNLkR9.js +0 -149
  181. package/dist/sig-BXJO--F9.js +0 -4
  182. package/dist/webfinger-C3GIyXIg.js +0 -4
  183. /package/dist/{collection-CSzG2j1P.js → collection-CcnIw1qY.js} +0 -0
  184. /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
@@ -2,12 +2,12 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  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
- 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";
5
+ import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-bgSdkFa2.js";
6
+ import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-BI0Ak5lL.js";
7
+ import { Actor, Recipient } from "./actor-T6RyhRgk.js";
8
+ import { HttpMessageSignaturesSpec } from "./http-D6Uj2x2y.js";
9
+ import { GetKeyOwnerOptions } from "./owner-hd9lvQcP.js";
10
+ import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-DlU8ISoa.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";
@@ -1306,6 +1306,36 @@ interface CollectionCallbackSetters<TContext extends Context<TContextData>, TCon
1306
1306
  */
1307
1307
  authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>;
1308
1308
  }
1309
+ /**
1310
+ * The strategy for handling activity idempotency in inbox processing.
1311
+ *
1312
+ * - `"global"`: Activities are deduplicated globally across all inboxes and
1313
+ * origins. The same activity ID will be processed only once, regardless
1314
+ * of which inbox receives it or which server sent it.
1315
+ *
1316
+ * - `"per-origin"`: Activities are deduplicated per receiving server's origin.
1317
+ * The same activity ID will be processed only once on each receiving server,
1318
+ * but can be processed separately on different receiving servers. This had
1319
+ * been the default behavior in Fedify 1.x versions.
1320
+ *
1321
+ * - `"per-inbox"`: Activities are deduplicated per inbox. The same activity
1322
+ * ID can be processed once per inbox, allowing the same activity to be
1323
+ * delivered to multiple inboxes independently. This follows standard
1324
+ * ActivityPub behavior and is the default strategy since Fedify 2.0.0.
1325
+ *
1326
+ * @since 1.9.0
1327
+ */
1328
+ type IdempotencyStrategy = "global" | "per-origin" | "per-inbox";
1329
+ /**
1330
+ * A callback to generate a custom idempotency key for an activity.
1331
+ * Returns the cache key to use, or null to skip idempotency checking.
1332
+ * @template TContextData The context data to pass to the {@link InboxContext}.
1333
+ * @param ctx The inbox context.
1334
+ * @param activity The activity being processed.
1335
+ * @returns The idempotency key to use for caching, or null to skip caching.
1336
+ * @since 1.9.0
1337
+ */
1338
+ type IdempotencyKeyCallback<TContextData> = (ctx: InboxContext<TContextData>, activity: Activity) => string | null | Promise<string | null>;
1309
1339
  /**
1310
1340
  * Registry for inbox listeners for different activity types.
1311
1341
  */
@@ -1336,6 +1366,36 @@ interface InboxListenerSetters<TContextData> {
1336
1366
  * @since 0.11.0
1337
1367
  */
1338
1368
  setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
1369
+ /**
1370
+ * Configures the strategy for handling activity idempotency in inbox processing.
1371
+ *
1372
+ * @example
1373
+ * Use per-inbox strategy (standard ActivityPub behavior):
1374
+ * ```
1375
+ * federation
1376
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1377
+ * .withIdempotency("per-inbox");
1378
+ * ```
1379
+ *
1380
+ * Use custom strategy:
1381
+ * ```
1382
+ * federation
1383
+ * .setInboxListeners("/users/{identifier}/inbox", "/inbox")
1384
+ * .withIdempotency((ctx, activity) => {
1385
+ * // Return null to skip idempotency
1386
+ * return `${ctx.origin}:${activity.id?.href}:${ctx.recipient}`;
1387
+ * });
1388
+ * ```
1389
+ *
1390
+ * @param strategy The idempotency strategy to use. Can be:
1391
+ * - `"global"`: Activities are deduplicated across all inboxes and origins
1392
+ * - `"per-origin"`: Activities are deduplicated per inbox origin
1393
+ * - `"per-inbox"`: Activities are deduplicated per inbox
1394
+ * - A custom callback function that returns the cache key to use
1395
+ * @returns The setters object so that settings can be chained.
1396
+ * @since 1.9.0
1397
+ */
1398
+ withIdempotency(strategy: IdempotencyStrategy | IdempotencyKeyCallback<TContextData>): InboxListenerSetters<TContextData>;
1339
1399
  }
1340
1400
  /**
1341
1401
  * Parameters of {@link Federation.fetch} method.
@@ -2254,4 +2314,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2254
2314
  multikey: Multikey;
2255
2315
  }
2256
2316
  //#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 };
2317
+ 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, ParamsKeyPath, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };