@fedify/fedify 2.0.0-dev.1641 → 2.0.0-dev.1690

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 (147) hide show
  1. package/dist/{actor-CP03csrm.cjs → actor-Be0ThtXy.cjs} +7263 -2440
  2. package/dist/{actor-DU511yTk.js → actor-ChbPLm6n.js} +7263 -2440
  3. package/dist/{actor-DMgu-ZjT.d.cts → actor-D6K058Tb.d.cts} +1 -1
  4. package/dist/{actor-DVpsNXhn.js → actor-DuCeRiNh.js} +1 -1
  5. package/dist/{actor-C22bXuuC.d.ts → actor-T6RyhRgk.d.ts} +1 -1
  6. package/dist/{assert_rejects-7UF4R_Qs.js → assert_rejects-DiIiJbZn.js} +1 -1
  7. package/dist/{assert_throws-53_pKeP3.js → assert_throws-BOO88avQ.js} +1 -1
  8. package/dist/{authdocloader-BkIZCKQv.js → authdocloader-Brax1A32.js} +3 -3
  9. package/dist/{authdocloader-DCgMyo82.js → authdocloader-CrxhFL8e.js} +3 -3
  10. package/dist/{authdocloader-BnsFSERg.cjs → authdocloader-OSn_teLV.cjs} +3 -3
  11. package/dist/{builder-E2Icrl_a.js → builder-CYOcDUkj.js} +10 -4
  12. package/dist/{client-BW4V0OJx.js → client-CnOdwLLN.js} +1 -1
  13. package/dist/compat/mod.d.cts +7 -7
  14. package/dist/compat/mod.d.ts +7 -7
  15. package/dist/compat/transformers.test.js +18 -17
  16. package/dist/{context-CDSZdQHD.d.ts → context-ByZprN0S.d.ts} +66 -6
  17. package/dist/{context-Dq8aCtMH.d.cts → context-C5BsZkDr.d.cts} +66 -6
  18. package/dist/{docloader-kae6M-GI.cjs → docloader-CCqXeagZ.cjs} +2 -2
  19. package/dist/{docloader-BtqIh1OE.js → docloader-XK3y2jn5.js} +2 -2
  20. package/dist/{esm-mtx3XJAD.js → esm-DnIzfEj0.js} +1 -1
  21. package/dist/federation/builder.test.js +10 -10
  22. package/dist/federation/collection.test.js +8 -8
  23. package/dist/federation/handler.test.js +26 -145
  24. package/dist/federation/idempotency.test.d.ts +3 -0
  25. package/dist/federation/idempotency.test.js +202 -0
  26. package/dist/federation/inbox.test.js +6 -6
  27. package/dist/federation/keycache.test.js +4 -4
  28. package/dist/federation/kv.test.js +8 -8
  29. package/dist/federation/middleware.test.js +232 -38
  30. package/dist/federation/mod.cjs +10 -10
  31. package/dist/federation/mod.d.cts +7 -7
  32. package/dist/federation/mod.d.ts +7 -7
  33. package/dist/federation/mod.js +10 -10
  34. package/dist/federation/mq.test.js +10 -10
  35. package/dist/federation/negotiation.test.d.ts +3 -0
  36. package/dist/federation/negotiation.test.js +28 -0
  37. package/dist/federation/retry.test.js +5 -5
  38. package/dist/federation/router.test.js +8 -8
  39. package/dist/federation/send.test.js +15 -15
  40. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
  41. package/dist/{http-Cox5GsED.js → http-BNOYnVsU.js} +2 -2
  42. package/dist/{http-C7uYFcBo.js → http-BxbM8sEy.js} +3 -3
  43. package/dist/{http-ZhcoaYEa.cjs → http-C7vbQwbz.cjs} +3 -3
  44. package/dist/{http-BS6766zs.d.cts → http-D-e6AFwR.d.cts} +1 -1
  45. package/dist/{http-DqSNLFNY.d.ts → http-D6Uj2x2y.d.ts} +1 -1
  46. package/dist/{inbox-BDdRbWNI.js → inbox-BRru9pX3.js} +24 -7
  47. package/dist/{key-CfiBDu3o.js → key-1KXru8Ug.js} +2 -2
  48. package/dist/{key-B9Z5ZuX9.js → key-B3uag-rz.js} +4 -4
  49. package/dist/key-BiBmb1Yy.cjs +10 -0
  50. package/dist/{key-CgwCzDC4.js → key-DK_nfU4I.js} +3 -3
  51. package/dist/{key-HqzOCwDc.cjs → key-Z6ceKnZC.cjs} +2 -2
  52. package/dist/{key-Cc0JlcKe.js → key-jyNTxCvK.js} +2 -2
  53. package/dist/{keycache-CVBjz3xi.js → keycache-CN61iGVj.js} +1 -1
  54. package/dist/{keys-CBKbYaJA.js → keys-BPdFKgiy.js} +1 -1
  55. package/dist/{ld-CxgmnSO3.js → ld-Dv8DNNAT.js} +2 -2
  56. package/dist/{lookup-NuT9cCSl.js → lookup-BPviO8ij.js} +1 -1
  57. package/dist/{lookup-QHjmy4Og.cjs → lookup-hnMAAU5r.cjs} +1 -1
  58. package/dist/{lookup-CiU3QxQz.js → lookup-pV0JOsuV.js} +21 -12
  59. package/dist/{middleware-LyCG_YVM.cjs → middleware-BmoOlgc1.cjs} +69 -73
  60. package/dist/{middleware-DXidHY4N.js → middleware-Bz_A2jeJ.js} +69 -73
  61. package/dist/middleware-CI0-zw4U.js +26 -0
  62. package/dist/{middleware-ByPnvMMS.js → middleware-DY9B2lL8.js} +43 -134
  63. package/dist/middleware-QNK-W-jE.cjs +17 -0
  64. package/dist/middleware-_vjt6FWU.js +17 -0
  65. package/dist/{mod-BhMnAkFX.d.cts → mod-8DMWKtQE.d.cts} +2 -2
  66. package/dist/{mod-Drmz72EK.d.ts → mod-BhUKmBJD.d.ts} +2 -2
  67. package/dist/{mod-TFoH2Ql8.d.ts → mod-CerN_Sza.d.ts} +1 -1
  68. package/dist/{mod-Dc_-mf8s.d.cts → mod-Cj1tHXBR.d.cts} +1 -1
  69. package/dist/{mod-evzlRVZq.d.cts → mod-CxkWO3Mg.d.cts} +19 -1
  70. package/dist/{mod-RI3-KvUI.d.ts → mod-D6hQoxC5.d.ts} +2 -2
  71. package/dist/{mod-BClfg3ej.d.cts → mod-Djzcw2ry.d.cts} +2 -2
  72. package/dist/{mod-Cxt4Kpf6.d.ts → mod-DlU8ISoa.d.ts} +19 -1
  73. package/dist/mod.cjs +10 -10
  74. package/dist/mod.d.cts +10 -10
  75. package/dist/mod.d.ts +10 -10
  76. package/dist/mod.js +10 -10
  77. package/dist/negotiation-5NPJL6zp.js +71 -0
  78. package/dist/nodeinfo/client.test.js +10 -10
  79. package/dist/nodeinfo/handler.test.js +23 -22
  80. package/dist/nodeinfo/mod.cjs +2 -2
  81. package/dist/nodeinfo/mod.js +2 -2
  82. package/dist/nodeinfo/types.test.js +8 -8
  83. package/dist/{owner-B-7Ptt_m.d.cts → owner-BN_tO3cY.d.cts} +2 -2
  84. package/dist/{owner-Cxob5_PK.js → owner-e3FYDhsk.js} +2 -2
  85. package/dist/{owner-CQPnQVtf.d.ts → owner-hd9lvQcP.d.ts} +2 -2
  86. package/dist/{proof-BiSQNUmQ.js → proof-6gFMwMNJ.js} +2 -2
  87. package/dist/{proof-2Gcor0_N.cjs → proof-B-eqv0Ug.cjs} +3 -3
  88. package/dist/{proof-DkxwMaWE.js → proof-DfgvA3al.js} +3 -3
  89. package/dist/runtime/authdocloader.test.js +14 -14
  90. package/dist/runtime/docloader.test.js +9 -9
  91. package/dist/runtime/key.test.js +10 -10
  92. package/dist/runtime/langstr.test.js +8 -8
  93. package/dist/runtime/link.test.js +3 -3
  94. package/dist/runtime/mod.cjs +6 -6
  95. package/dist/runtime/mod.d.cts +3 -3
  96. package/dist/runtime/mod.d.ts +3 -3
  97. package/dist/runtime/mod.js +6 -6
  98. package/dist/runtime/multibase/multibase.test.js +8 -8
  99. package/dist/runtime/url.test.js +5 -5
  100. package/dist/{send-DSEhWIYD.js → send-Tl9NOnmO.js} +2 -2
  101. package/dist/sig/http.test.js +13 -13
  102. package/dist/sig/key.test.js +11 -11
  103. package/dist/sig/ld.test.js +10 -10
  104. package/dist/sig/mod.cjs +6 -6
  105. package/dist/sig/mod.d.cts +5 -5
  106. package/dist/sig/mod.d.ts +5 -5
  107. package/dist/sig/mod.js +6 -6
  108. package/dist/sig/owner.test.js +12 -12
  109. package/dist/sig/proof.test.js +12 -12
  110. package/dist/testing/docloader.test.js +8 -8
  111. package/dist/testing/mod.d.ts +272 -0
  112. package/dist/testing/mod.js +3 -3
  113. package/dist/{testing-ByQmUvf-.js → testing-BWNCAbL-.js} +2 -2
  114. package/dist/{type-B4NJkfVg.js → type-C69ZBu7f.js} +6944 -2121
  115. package/dist/{types-l2uh_ZhP.js → types-DqxyTxOf.js} +1 -1
  116. package/dist/{types-Bqt2EgP0.cjs → types-zqdWZh4O.cjs} +1 -1
  117. package/dist/vocab/actor.test.js +10 -10
  118. package/dist/vocab/lookup.test.js +259 -9
  119. package/dist/vocab/mod.cjs +4 -4
  120. package/dist/vocab/mod.d.cts +3 -3
  121. package/dist/vocab/mod.d.ts +3 -3
  122. package/dist/vocab/mod.js +4 -4
  123. package/dist/vocab/type.test.js +3 -3
  124. package/dist/vocab/vocab.test.js +402 -13
  125. package/dist/{vocab-B0-5a8pw.cjs → vocab-B39-pFl9.cjs} +23 -14
  126. package/dist/{vocab-SOE1ifCr.d.ts → vocab-BI0Ak5lL.d.ts} +290 -0
  127. package/dist/{vocab-lBFcVxVF.js → vocab-BWoeZsME.js} +23 -14
  128. package/dist/{vocab-DJTYMqyU.d.cts → vocab-Dw1-yVGg.d.cts} +290 -0
  129. package/dist/webfinger/handler.test.js +23 -22
  130. package/dist/webfinger/lookup.test.js +9 -9
  131. package/dist/webfinger/mod.cjs +2 -2
  132. package/dist/webfinger/mod.js +2 -2
  133. package/dist/x/cfworkers.test.js +8 -8
  134. package/dist/x/hono.d.cts +6 -6
  135. package/dist/x/hono.d.ts +6 -6
  136. package/dist/x/sveltekit.d.cts +6 -6
  137. package/dist/x/sveltekit.d.ts +6 -6
  138. package/package.json +1 -1
  139. package/dist/key-D-7DPHNl.cjs +0 -10
  140. package/dist/middleware-BHboQ4BE.js +0 -25
  141. package/dist/middleware-Bp3I9z8r.js +0 -17
  142. package/dist/middleware-oYqSU5ky.cjs +0 -17
  143. /package/dist/{assert_is_error-B035L3om.js → assert_is_error-BPGph1Jx.js} +0 -0
  144. /package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals-f3m3epl3.js} +0 -0
  145. /package/dist/{denokv-jZ0Z2h0M.js → denokv-Bv33Xxea.js} +0 -0
  146. /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
  147. /package/dist/{std__assert-DWivtrGR.js → std__assert-X-_kMxKM.js} +0 -0
@@ -4,15 +4,15 @@
4
4
 
5
5
  const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
6
  const require_transformers = require('./transformers-CoBS-oFG.cjs');
7
- const require_docloader = require('./docloader-kae6M-GI.cjs');
8
- const require_actor = require('./actor-CP03csrm.cjs');
9
- const require_lookup = require('./lookup-QHjmy4Og.cjs');
10
- const require_key = require('./key-HqzOCwDc.cjs');
11
- const require_http = require('./http-ZhcoaYEa.cjs');
12
- const require_proof = require('./proof-2Gcor0_N.cjs');
13
- const require_types = require('./types-Bqt2EgP0.cjs');
14
- const require_authdocloader = require('./authdocloader-BnsFSERg.cjs');
15
- const require_vocab = require('./vocab-B0-5a8pw.cjs');
7
+ const require_docloader = require('./docloader-CCqXeagZ.cjs');
8
+ const require_actor = require('./actor-Be0ThtXy.cjs');
9
+ const require_lookup = require('./lookup-hnMAAU5r.cjs');
10
+ const require_key = require('./key-Z6ceKnZC.cjs');
11
+ const require_http = require('./http-C7vbQwbz.cjs');
12
+ const require_proof = require('./proof-B-eqv0Ug.cjs');
13
+ const require_types = require('./types-zqdWZh4O.cjs');
14
+ const require_authdocloader = require('./authdocloader-OSn_teLV.cjs');
15
+ const require_vocab = require('./vocab-B39-pFl9.cjs');
16
16
  const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
17
17
  const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
18
18
  const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
@@ -56,17 +56,34 @@ var InboxListenerSet = class InboxListenerSet {
56
56
  return this.dispatchWithClass(activity)?.listener ?? null;
57
57
  }
58
58
  };
59
- async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider }) {
59
+ async function routeActivity({ context: ctx, json, activity, recipient, inboxListeners, inboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
60
60
  const logger$1 = (0, __logtape_logtape.getLogger)([
61
61
  "fedify",
62
62
  "federation",
63
63
  "inbox"
64
64
  ]);
65
- const cacheKey = activity.id == null ? null : [
66
- ...kvPrefixes.activityIdempotence,
67
- ctx.origin,
68
- activity.id.href
69
- ];
65
+ let cacheKey = null;
66
+ if (activity.id != null) {
67
+ const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, require_actor.getTypeId(activity).href);
68
+ const strategy = idempotencyStrategy ?? "per-inbox";
69
+ let keyString;
70
+ if (typeof strategy === "function") {
71
+ const result = await strategy(inboxContext, activity);
72
+ keyString = result;
73
+ } else switch (strategy) {
74
+ case "global":
75
+ keyString = activity.id.href;
76
+ break;
77
+ case "per-origin":
78
+ keyString = `${ctx.origin}\n${activity.id.href}`;
79
+ break;
80
+ case "per-inbox":
81
+ keyString = `${ctx.origin}\n${activity.id.href}\n${recipient == null ? "sharedInbox" : `inbox\n${recipient}`}`;
82
+ break;
83
+ default: keyString = `${ctx.origin}\n${activity.id.href}`;
84
+ }
85
+ if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
86
+ }
70
87
  if (cacheKey != null) {
71
88
  const cached = await kv.get(cacheKey);
72
89
  if (cached === true) {
@@ -308,6 +325,7 @@ var FederationBuilderImpl = class {
308
325
  inboxListeners;
309
326
  inboxErrorHandler;
310
327
  sharedInboxKeyDispatcher;
328
+ idempotencyStrategy;
311
329
  collectionTypeIds;
312
330
  collectionCallbacks;
313
331
  /**
@@ -322,7 +340,7 @@ var FederationBuilderImpl = class {
322
340
  this.collectionTypeIds = {};
323
341
  }
324
342
  async build(options) {
325
- const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-oYqSU5ky.cjs"));
343
+ const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-QNK-W-jE.cjs"));
326
344
  const f = new FederationImpl$1(options);
327
345
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
328
346
  f.router = this.router.clone();
@@ -344,6 +362,7 @@ var FederationBuilderImpl = class {
344
362
  f.inboxListeners = this.inboxListeners?.clone();
345
363
  f.inboxErrorHandler = this.inboxErrorHandler;
346
364
  f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
365
+ f.idempotencyStrategy = this.idempotencyStrategy;
347
366
  return f;
348
367
  }
349
368
  _getTracer() {
@@ -766,6 +785,10 @@ var FederationBuilderImpl = class {
766
785
  setSharedKeyDispatcher: (dispatcher) => {
767
786
  this.sharedInboxKeyDispatcher = dispatcher;
768
787
  return setters;
788
+ },
789
+ withIdempotency: (strategy) => {
790
+ this.idempotencyStrategy = strategy;
791
+ return setters;
769
792
  }
770
793
  };
771
794
  return setters;
@@ -980,9 +1003,6 @@ function preferredMediaTypes(accept) {
980
1003
  const accepts = parseAccept(accept === void 0 ? "*/*" : accept ?? "");
981
1004
  return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
982
1005
  }
983
-
984
- //#endregion
985
- //#region src/federation/handler.ts
986
1006
  function acceptsJsonLd(request) {
987
1007
  const accept = request.headers.get("Accept");
988
1008
  const types = accept ? preferredMediaTypes(accept) : ["*/*"];
@@ -990,6 +1010,9 @@ function acceptsJsonLd(request) {
990
1010
  if (types[0] === "text/html" || types[0] === "application/xhtml+xml") return false;
991
1011
  return types.includes("application/activity+json") || types.includes("application/ld+json") || types.includes("application/json");
992
1012
  }
1013
+
1014
+ //#endregion
1015
+ //#region src/federation/handler.ts
993
1016
  /**
994
1017
  * Handles an actor request.
995
1018
  * @template TContextData The context data to pass to the context.
@@ -997,7 +1020,7 @@ function acceptsJsonLd(request) {
997
1020
  * @param parameters The parameters for handling the actor.
998
1021
  * @returns A promise that resolves to an HTTP response.
999
1022
  */
1000
- async function handleActor(request, { identifier, context: context$2, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
1023
+ async function handleActor(request, { identifier, context: context$2, actorDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
1001
1024
  const logger$1 = (0, __logtape_logtape.getLogger)([
1002
1025
  "fedify",
1003
1026
  "federation",
@@ -1012,7 +1035,6 @@ async function handleActor(request, { identifier, context: context$2, actorDispa
1012
1035
  logger$1.debug("Actor {identifier} not found.", { identifier });
1013
1036
  return await onNotFound(request);
1014
1037
  }
1015
- if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
1016
1038
  if (authorizePredicate != null) {
1017
1039
  let key = await context$2.getSignedKey();
1018
1040
  key = key?.clone({}, { $warning: {
@@ -1047,11 +1069,10 @@ async function handleActor(request, { identifier, context: context$2, actorDispa
1047
1069
  * @param parameters The parameters for handling the object.
1048
1070
  * @returns A promise that resolves to an HTTP response.
1049
1071
  */
1050
- async function handleObject(request, { values, context: context$2, objectDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
1072
+ async function handleObject(request, { values, context: context$2, objectDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
1051
1073
  if (objectDispatcher == null) return await onNotFound(request);
1052
1074
  const object = await objectDispatcher(context$2, values);
1053
1075
  if (object == null) return await onNotFound(request);
1054
- if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
1055
1076
  if (authorizePredicate != null) {
1056
1077
  let key = await context$2.getSignedKey();
1057
1078
  key = key?.clone({}, { $warning: {
@@ -1089,7 +1110,7 @@ async function handleObject(request, { values, context: context$2, objectDispatc
1089
1110
  * @param parameters The parameters for handling the collection.
1090
1111
  * @returns A promise that resolves to an HTTP response.
1091
1112
  */
1092
- async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$2, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
1113
+ async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$2, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
1093
1114
  const spanName = name.trim().replace(/\s+/g, "_");
1094
1115
  tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
1095
1116
  const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
@@ -1202,7 +1223,6 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
1202
1223
  partOf
1203
1224
  });
1204
1225
  }
1205
- if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
1206
1226
  if (collectionCallbacks.authorizePredicate != null) {
1207
1227
  let key = await context$2.getSignedKey();
1208
1228
  key = key?.clone({}, { $warning: {
@@ -1297,7 +1317,8 @@ async function handleInbox(request, options) {
1297
1317
  * @param span The OpenTelemetry span for tracing.
1298
1318
  * @returns A promise that resolves to an HTTP response.
1299
1319
  */
1300
- async function handleInboxInternal(request, { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider }, span) {
1320
+ async function handleInboxInternal(request, parameters, span) {
1321
+ const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider } = parameters;
1301
1322
  const logger$1 = (0, __logtape_logtape.getLogger)([
1302
1323
  "fedify",
1303
1324
  "federation",
@@ -1499,7 +1520,8 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
1499
1520
  kvPrefixes,
1500
1521
  queue,
1501
1522
  span,
1502
- tracerProvider
1523
+ tracerProvider,
1524
+ idempotencyStrategy: parameters.idempotencyStrategy
1503
1525
  });
1504
1526
  if (routeResult === "alreadyProcessed") return new Response(`Activity <${activity.id}> has already been processed.`, {
1505
1527
  status: 202,
@@ -1540,7 +1562,6 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
1540
1562
  const handleCustomCollection = exceptWrapper(_handleCustomCollection);
1541
1563
  async function _handleCustomCollection(request, { name, values, context: context$2, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1542
1564
  verifyDefined(callbacks);
1543
- verifyJsonLdRequest(request);
1544
1565
  await authIfNeeded(context$2, values, callbacks);
1545
1566
  const cursor = new URL(request.url).searchParams.get("cursor");
1546
1567
  return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider, require_actor.Collection, require_actor.CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
@@ -1559,7 +1580,6 @@ async function _handleCustomCollection(request, { name, values, context: context
1559
1580
  const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
1560
1581
  async function _handleOrderedCollection(request, { name, values, context: context$2, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
1561
1582
  verifyDefined(callbacks);
1562
- verifyJsonLdRequest(request);
1563
1583
  await authIfNeeded(context$2, values, callbacks);
1564
1584
  const cursor = new URL(request.url).searchParams.get("cursor");
1565
1585
  return await new CustomCollectionHandler(name, values, context$2, callbacks, tracerProvider, require_actor.OrderedCollection, require_actor.OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
@@ -1837,10 +1857,9 @@ function exceptWrapper(handler) {
1837
1857
  try {
1838
1858
  return await handler(request, handlerParams);
1839
1859
  } catch (error) {
1840
- const { onNotFound, onNotAcceptable, onUnauthorized } = handlerParams;
1860
+ const { onNotFound, onUnauthorized } = handlerParams;
1841
1861
  switch (error?.constructor) {
1842
1862
  case ItemsNotFoundError: return await onNotFound(request);
1843
- case NotAcceptableError: return await onNotAcceptable(request);
1844
1863
  case UnauthorizedError: return await onUnauthorized(request);
1845
1864
  default: throw error;
1846
1865
  }
@@ -1858,15 +1877,6 @@ const verifyDefined = (callbacks) => {
1858
1877
  if (callbacks === void 0) throw new ItemsNotFoundError();
1859
1878
  };
1860
1879
  /**
1861
- * Verifies that a request accepts JSON-LD content type.
1862
- * @param request The HTTP request to verify.
1863
- * @throws {NotAcceptableError} If the request doesn't accept JSON-LD.
1864
- * @since 1.8.0
1865
- */
1866
- const verifyJsonLdRequest = (request) => {
1867
- if (!acceptsJsonLd(request)) throw new NotAcceptableError();
1868
- };
1869
- /**
1870
1880
  * Performs authorization if needed based on the authorization predicate.
1871
1881
  * @template TContextData The context data type.
1872
1882
  * @param {RequestContext<TContextData>} context The request context.
@@ -1950,15 +1960,6 @@ var ItemsNotFoundError = class extends HandlerError {
1950
1960
  }
1951
1961
  };
1952
1962
  /**
1953
- * Error thrown when the request is not acceptable (e.g., wrong content type).
1954
- * @since 1.8.0
1955
- */
1956
- var NotAcceptableError = class extends HandlerError {
1957
- constructor() {
1958
- super("The request is not acceptable.");
1959
- }
1960
- };
1961
- /**
1962
1963
  * Error thrown when access to a collection is unauthorized.
1963
1964
  * @since 1.8.0
1964
1965
  */
@@ -2956,6 +2957,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2956
2957
  span,
2957
2958
  tracer
2958
2959
  });
2960
+ if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
2959
2961
  } catch (error) {
2960
2962
  span.setStatus({
2961
2963
  code: __opentelemetry_api.SpanStatusCode.ERROR,
@@ -3019,6 +3021,9 @@ var FederationImpl = class extends FederationBuilderImpl {
3019
3021
  context: context$2,
3020
3022
  nodeInfoDispatcher: this.nodeInfoDispatcher
3021
3023
  });
3024
+ }
3025
+ if (request.method !== "POST" && !acceptsJsonLd(request)) return await onNotAcceptable(request);
3026
+ switch (routeName) {
3022
3027
  case "actor":
3023
3028
  context$2 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
3024
3029
  return await handleActor(request, {
@@ -3027,8 +3032,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3027
3032
  actorDispatcher: this.actorCallbacks?.dispatcher,
3028
3033
  authorizePredicate: this.actorCallbacks?.authorizePredicate,
3029
3034
  onUnauthorized,
3030
- onNotFound,
3031
- onNotAcceptable
3035
+ onNotFound
3032
3036
  });
3033
3037
  case "object": {
3034
3038
  const typeId = route.name.replace(/^object:/, "");
@@ -3044,8 +3048,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3044
3048
  objectDispatcher: callbacks?.dispatcher,
3045
3049
  authorizePredicate: callbacks?.authorizePredicate,
3046
3050
  onUnauthorized,
3047
- onNotFound,
3048
- onNotAcceptable
3051
+ onNotFound
3049
3052
  });
3050
3053
  }
3051
3054
  case "outbox": return await handleCollection(request, {
@@ -3056,8 +3059,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3056
3059
  collectionCallbacks: this.outboxCallbacks,
3057
3060
  tracerProvider: this.tracerProvider,
3058
3061
  onUnauthorized,
3059
- onNotFound,
3060
- onNotAcceptable
3062
+ onNotFound
3061
3063
  });
3062
3064
  case "inbox":
3063
3065
  if (request.method !== "POST") return await handleCollection(request, {
@@ -3068,8 +3070,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3068
3070
  collectionCallbacks: this.inboxCallbacks,
3069
3071
  tracerProvider: this.tracerProvider,
3070
3072
  onUnauthorized,
3071
- onNotFound,
3072
- onNotAcceptable
3073
+ onNotFound
3073
3074
  });
3074
3075
  context$2 = this.#createContext(request, contextData, { documentLoader: await context$2.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
3075
3076
  case "sharedInbox":
@@ -3091,7 +3092,8 @@ var FederationImpl = class extends FederationBuilderImpl {
3091
3092
  onNotFound,
3092
3093
  signatureTimeWindow: this.signatureTimeWindow,
3093
3094
  skipSignatureVerification: this.skipSignatureVerification,
3094
- tracerProvider: this.tracerProvider
3095
+ tracerProvider: this.tracerProvider,
3096
+ idempotencyStrategy: this.idempotencyStrategy
3095
3097
  });
3096
3098
  case "following": return await handleCollection(request, {
3097
3099
  name: "following",
@@ -3101,8 +3103,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3101
3103
  collectionCallbacks: this.followingCallbacks,
3102
3104
  tracerProvider: this.tracerProvider,
3103
3105
  onUnauthorized,
3104
- onNotFound,
3105
- onNotAcceptable
3106
+ onNotFound
3106
3107
  });
3107
3108
  case "followers": {
3108
3109
  let baseUrl = url.searchParams.get("base-url");
@@ -3125,8 +3126,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3125
3126
  collectionCallbacks: this.followersCallbacks,
3126
3127
  tracerProvider: this.tracerProvider,
3127
3128
  onUnauthorized,
3128
- onNotFound,
3129
- onNotAcceptable
3129
+ onNotFound
3130
3130
  });
3131
3131
  }
3132
3132
  case "liked": return await handleCollection(request, {
@@ -3137,8 +3137,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3137
3137
  collectionCallbacks: this.likedCallbacks,
3138
3138
  tracerProvider: this.tracerProvider,
3139
3139
  onUnauthorized,
3140
- onNotFound,
3141
- onNotAcceptable
3140
+ onNotFound
3142
3141
  });
3143
3142
  case "featured": return await handleCollection(request, {
3144
3143
  name: "featured",
@@ -3148,8 +3147,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3148
3147
  collectionCallbacks: this.featuredCallbacks,
3149
3148
  tracerProvider: this.tracerProvider,
3150
3149
  onUnauthorized,
3151
- onNotFound,
3152
- onNotAcceptable
3150
+ onNotFound
3153
3151
  });
3154
3152
  case "featuredTags": return await handleCollection(request, {
3155
3153
  name: "featured tags",
@@ -3159,8 +3157,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3159
3157
  collectionCallbacks: this.featuredTagsCallbacks,
3160
3158
  tracerProvider: this.tracerProvider,
3161
3159
  onUnauthorized,
3162
- onNotFound,
3163
- onNotAcceptable
3160
+ onNotFound
3164
3161
  });
3165
3162
  case "collection": {
3166
3163
  const name = route.name.replace(/^collection:/, "");
@@ -3172,8 +3169,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3172
3169
  collectionCallbacks: callbacks,
3173
3170
  tracerProvider: this.tracerProvider,
3174
3171
  onUnauthorized,
3175
- onNotFound,
3176
- onNotAcceptable
3172
+ onNotFound
3177
3173
  });
3178
3174
  }
3179
3175
  case "orderedCollection": {
@@ -3186,8 +3182,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3186
3182
  collectionCallbacks: callbacks,
3187
3183
  tracerProvider: this.tracerProvider,
3188
3184
  onUnauthorized,
3189
- onNotFound,
3190
- onNotAcceptable
3185
+ onNotFound
3191
3186
  });
3192
3187
  }
3193
3188
  default: {
@@ -3841,7 +3836,8 @@ var ContextImpl = class ContextImpl {
3841
3836
  kvPrefixes: this.federation.kvPrefixes,
3842
3837
  queue: this.federation.inboxQueue,
3843
3838
  span,
3844
- tracerProvider: options.tracerProvider ?? this.tracerProvider
3839
+ tracerProvider: options.tracerProvider ?? this.tracerProvider,
3840
+ idempotencyStrategy: this.federation.idempotencyStrategy
3845
3841
  });
3846
3842
  return routeResult === "alreadyProcessed" || routeResult === "enqueued" || routeResult === "unsupportedActivity" || routeResult === "success";
3847
3843
  }