@fedify/fedify 2.0.0-dev.323 → 2.0.0-dev.335

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 (60) hide show
  1. package/dist/{builder-CvKuNW7P.js → builder-RHW0dkbP.js} +8 -3
  2. package/dist/compat/mod.d.cts +2 -2
  3. package/dist/compat/mod.d.ts +2 -2
  4. package/dist/compat/transformers.test.js +11 -11
  5. package/dist/{context-Zqld1re2.d.cts → context-Cf0-LmZC.d.cts} +92 -1
  6. package/dist/{context-CJO1oqSa.d.ts → context-liIe6DFH.d.ts} +92 -1
  7. package/dist/{deno-BTAi5-ur.js → deno-Dhe5E7NK.js} +1 -1
  8. package/dist/{docloader-D8dzb6AT.js → docloader-D6VuU143.js} +2 -2
  9. package/dist/federation/builder.test.js +3 -3
  10. package/dist/federation/handler.test.js +11 -11
  11. package/dist/federation/idempotency.test.js +11 -11
  12. package/dist/federation/inbox.test.js +2 -2
  13. package/dist/federation/middleware.test.js +171 -11
  14. package/dist/federation/mod.cjs +5 -4
  15. package/dist/federation/mod.d.cts +3 -3
  16. package/dist/federation/mod.d.ts +3 -3
  17. package/dist/federation/mod.js +5 -5
  18. package/dist/federation/send.test.js +89 -6
  19. package/dist/federation/webfinger.test.js +11 -11
  20. package/dist/{http-C4WANccp.js → http-CSqVEUdE.js} +2 -2
  21. package/dist/{http-BCfCt7nq.cjs → http-ChlQCtql.cjs} +1 -1
  22. package/dist/{http-C02fQ5SX.js → http-DZrrJD77.js} +1 -1
  23. package/dist/{inbox-CdBcxHA7.js → inbox-9F91oWJU.js} +1 -1
  24. package/dist/{key-BI6sqU5u.js → key-DFPkYar3.js} +1 -1
  25. package/dist/{kv-cache-BLxaWwPk.js → kv-cache-1TNWtgx7.js} +1 -1
  26. package/dist/{kv-cache-Dk9UX_M2.cjs → kv-cache-DwcKE9EQ.cjs} +1 -1
  27. package/dist/{ld-qTcTL2A4.js → ld-kAhyoO55.js} +2 -2
  28. package/dist/{middleware-BhYGJwH9.js → middleware-BgurYNZ4.js} +4 -4
  29. package/dist/{middleware-nW8ONmt3.cjs → middleware-CULfPNt-.cjs} +85 -6
  30. package/dist/middleware-ChlsNVu2.cjs +12 -0
  31. package/dist/{middleware-LQKxYF7X.js → middleware-DQriD-Kq.js} +80 -7
  32. package/dist/{middleware-DG4UsFBP.js → middleware-DebYvXJs.js} +11 -11
  33. package/dist/{middleware-DaOdxVOc.js → middleware-zvH5O0zk.js} +45 -11
  34. package/dist/{mod-Bpuc-q64.d.ts → mod-B9_l3te3.d.ts} +1 -1
  35. package/dist/{mod-CKtAEVny.d.cts → mod-Do_sZWAA.d.cts} +1 -1
  36. package/dist/{mod-C92O3FpJ.d.ts → mod-Dquroqiv.d.ts} +1 -1
  37. package/dist/{mod-DFWeUq2q.d.cts → mod-H3ScYaOb.d.cts} +1 -1
  38. package/dist/mod.cjs +6 -4
  39. package/dist/mod.d.cts +5 -5
  40. package/dist/mod.d.ts +5 -5
  41. package/dist/mod.js +6 -5
  42. package/dist/nodeinfo/handler.test.js +11 -11
  43. package/dist/{owner-Cfmtlwoe.js → owner-DcyH0sQg.js} +1 -1
  44. package/dist/{proof-Bc8ULrzP.js → proof-D7C8ouBO.js} +2 -2
  45. package/dist/{proof-OjMPhNWs.js → proof-JtZEQaKw.js} +1 -1
  46. package/dist/{proof-BoqEqbih.cjs → proof-_Rz8hNBt.cjs} +1 -1
  47. package/dist/{send-BKW3wSXo.js → send-mAsnzegg.js} +38 -4
  48. package/dist/sig/http.test.js +3 -3
  49. package/dist/sig/key.test.js +2 -2
  50. package/dist/sig/ld.test.js +3 -3
  51. package/dist/sig/mod.cjs +2 -2
  52. package/dist/sig/mod.js +2 -2
  53. package/dist/sig/owner.test.js +3 -3
  54. package/dist/sig/proof.test.js +3 -3
  55. package/dist/testing/mod.d.ts +80 -0
  56. package/dist/utils/docloader.test.js +4 -4
  57. package/dist/utils/mod.cjs +2 -2
  58. package/dist/utils/mod.js +2 -2
  59. package/package.json +5 -5
  60. package/dist/middleware-Dsrm1uhx.cjs +0 -12
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./deno-BTAi5-ur.js";
6
+ import { deno_default } from "./deno-Dhe5E7NK.js";
7
7
  import { Router, RouterError } from "./router-D9eI0s4b.js";
8
- import { InboxListenerSet } from "./inbox-CdBcxHA7.js";
8
+ import { InboxListenerSet } from "./inbox-9F91oWJU.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { getTypeId } from "@fedify/vocab";
11
11
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -29,6 +29,7 @@ var FederationBuilderImpl = class {
29
29
  inboxListeners;
30
30
  inboxErrorHandler;
31
31
  sharedInboxKeyDispatcher;
32
+ outboxPermanentFailureHandler;
32
33
  idempotencyStrategy;
33
34
  collectionTypeIds;
34
35
  collectionCallbacks;
@@ -44,7 +45,7 @@ var FederationBuilderImpl = class {
44
45
  this.collectionTypeIds = {};
45
46
  }
46
47
  async build(options) {
47
- const { FederationImpl } = await import("./middleware-DG4UsFBP.js");
48
+ const { FederationImpl } = await import("./middleware-DebYvXJs.js");
48
49
  const f = new FederationImpl(options);
49
50
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
50
51
  f.router = this.router.clone();
@@ -66,6 +67,7 @@ var FederationBuilderImpl = class {
66
67
  f.inboxListeners = this.inboxListeners?.clone();
67
68
  f.inboxErrorHandler = this.inboxErrorHandler;
68
69
  f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
70
+ f.outboxPermanentFailureHandler = this.outboxPermanentFailureHandler;
69
71
  f.idempotencyStrategy = this.idempotencyStrategy;
70
72
  return f;
71
73
  }
@@ -547,6 +549,9 @@ var FederationBuilderImpl = class {
547
549
  const path = this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
548
550
  return path;
549
551
  }
552
+ setOutboxPermanentFailureHandler(handler) {
553
+ this.outboxPermanentFailureHandler = handler;
554
+ }
550
555
  /**
551
556
  * Converts a name (string or symbol) to a unique string identifier.
552
557
  * For symbols, generates and caches a UUID if not already present.
@@ -1,7 +1,7 @@
1
1
  import "../client-CwkOPN13.cjs";
2
2
  import "../http-CCEu-x1_.cjs";
3
3
  import "../owner-9yZ5Ibsb.cjs";
4
- import { ActivityTransformer } from "../context-Zqld1re2.cjs";
4
+ import { ActivityTransformer } from "../context-Cf0-LmZC.cjs";
5
5
  import "../kv-g9jFc34-.cjs";
6
- import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-DFWeUq2q.cjs";
6
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-H3ScYaOb.cjs";
7
7
  export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -3,7 +3,7 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "../client-a7NwzhA2.js";
4
4
  import "../http-CODSJcKx.js";
5
5
  import "../owner-DQYAbVmX.js";
6
- import { ActivityTransformer } from "../context-CJO1oqSa.js";
6
+ import { ActivityTransformer } from "../context-liIe6DFH.js";
7
7
  import "../kv-jg_8SMc1.js";
8
- import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-Bpuc-q64.js";
8
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-B9_l3te3.js";
9
9
  export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -8,25 +8,25 @@ 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-QzKcOQgP.js";
11
- import "../deno-BTAi5-ur.js";
12
- import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-DaOdxVOc.js";
11
+ import "../deno-Dhe5E7NK.js";
12
+ import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-zvH5O0zk.js";
13
13
  import "../client-Dg7OfUDA.js";
14
14
  import "../router-D9eI0s4b.js";
15
15
  import "../types-CPz01LGH.js";
16
- import "../key-BI6sqU5u.js";
17
- import "../http-C4WANccp.js";
18
- import "../ld-qTcTL2A4.js";
19
- import "../owner-Cfmtlwoe.js";
20
- import "../proof-Bc8ULrzP.js";
21
- import "../docloader-D8dzb6AT.js";
16
+ import "../key-DFPkYar3.js";
17
+ import "../http-CSqVEUdE.js";
18
+ import "../ld-kAhyoO55.js";
19
+ import "../owner-DcyH0sQg.js";
20
+ import "../proof-D7C8ouBO.js";
21
+ import "../docloader-D6VuU143.js";
22
22
  import "../kv-cache-B__dHl7g.js";
23
- import "../inbox-CdBcxHA7.js";
24
- import "../builder-CvKuNW7P.js";
23
+ import "../inbox-9F91oWJU.js";
24
+ import "../builder-RHW0dkbP.js";
25
25
  import "../collection-CcnIw1qY.js";
26
26
  import "../keycache-DRxpZ5r9.js";
27
27
  import "../negotiation-5NPJL6zp.js";
28
28
  import "../retry-D4GJ670a.js";
29
- import "../send-BKW3wSXo.js";
29
+ import "../send-mAsnzegg.js";
30
30
  import { Follow, Person } from "@fedify/vocab";
31
31
 
32
32
  //#region src/compat/transformers.test.ts
@@ -60,6 +60,35 @@ interface SenderKeyPair {
60
60
  /**
61
61
  * Parameters for {@link sendActivity}.
62
62
  */
63
+
64
+ /**
65
+ * An error that is thrown when an activity fails to send to a remote inbox.
66
+ * It contains structured information about the failure, including the HTTP
67
+ * status code, the inbox URL, and the response body.
68
+ * @since 2.0.0
69
+ */
70
+ declare class SendActivityError extends Error {
71
+ /**
72
+ * The inbox URL that the activity was being sent to.
73
+ */
74
+ readonly inbox: URL;
75
+ /**
76
+ * The HTTP status code returned by the inbox.
77
+ */
78
+ readonly statusCode: number;
79
+ /**
80
+ * The response body from the inbox, if any.
81
+ */
82
+ readonly responseBody: string;
83
+ /**
84
+ * Creates a new {@link SendActivityError}.
85
+ * @param inbox The inbox URL.
86
+ * @param statusCode The HTTP status code.
87
+ * @param message The error message.
88
+ * @param responseBody The response body.
89
+ */
90
+ constructor(inbox: URL, statusCode: number, message: string, responseBody: string);
91
+ }
63
92
  //#endregion
64
93
  //#region src/federation/callback.d.ts
65
94
  /**
@@ -222,6 +251,40 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
222
251
  * @since 0.6.0
223
252
  */
224
253
  type OutboxErrorHandler = (error: Error, activity: Activity | null) => void | Promise<void>;
254
+ /**
255
+ * A callback that handles permanent delivery failures when sending activities
256
+ * to remote inboxes.
257
+ *
258
+ * This handler is called when an inbox returns an HTTP status code that
259
+ * indicates permanent failure (such as `410 Gone` or `404 Not Found`),
260
+ * allowing the application to clean up followers that are no longer reachable.
261
+ *
262
+ * Unlike {@link OutboxErrorHandler}, which is called for every delivery failure
263
+ * (including retries), this handler is called only once for permanent failures,
264
+ * after which delivery is not retried.
265
+ *
266
+ * If any errors are thrown in this callback, they are caught, logged,
267
+ * and ignored.
268
+ *
269
+ * @template TContextData The context data to pass to the {@link Context}.
270
+ * @param context The context.
271
+ * @param values The delivery failure information.
272
+ * @since 2.0.0
273
+ */
274
+ type OutboxPermanentFailureHandler<TContextData> = (context: Context<TContextData>, values: {
275
+ /** The inbox URL that failed. */
276
+ readonly inbox: URL;
277
+ /** The activity that failed to deliver. */
278
+ readonly activity: Activity;
279
+ /** The error that occurred. */
280
+ readonly error: SendActivityError;
281
+ /** The HTTP status code returned by the inbox. */
282
+ readonly statusCode: number;
283
+ /**
284
+ * The actor IDs that were supposed to receive the activity at this inbox.
285
+ */
286
+ readonly actorIds: readonly URL[];
287
+ }) => void | Promise<void>;
225
288
  /**
226
289
  * A callback that determines if a request is authorized or not.
227
290
  *
@@ -635,6 +698,7 @@ interface OutboxMessage {
635
698
  readonly activityType: string;
636
699
  readonly inbox: string;
637
700
  readonly sharedInbox: boolean;
701
+ readonly actorIds?: readonly string[];
638
702
  readonly started: string;
639
703
  readonly attempt: number;
640
704
  readonly headers: Readonly<Record<string, string>>;
@@ -1167,6 +1231,22 @@ interface Federatable<TContextData> {
1167
1231
  * @param dispatcher A collection dispatcher callback to register.
1168
1232
  */
1169
1233
  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>;
1234
+ /**
1235
+ * Registers a handler for permanent delivery failures.
1236
+ *
1237
+ * This handler is called when an inbox returns an HTTP status code
1238
+ * that indicates permanent failure (`410 Gone`, `404 Not Found`, etc.),
1239
+ * allowing the application to clean up followers that are no longer
1240
+ * reachable.
1241
+ *
1242
+ * Unlike `onOutboxError`, which is called for every delivery failure
1243
+ * (including retries), this handler is called only once for permanent
1244
+ * failures, after which delivery is not retried.
1245
+ *
1246
+ * @param handler A callback to handle permanent failures.
1247
+ * @since 2.0.0
1248
+ */
1249
+ setOutboxPermanentFailureHandler(handler: OutboxPermanentFailureHandler<TContextData>): void;
1170
1250
  }
1171
1251
  /**
1172
1252
  * An object that registers federation-related business logic and dispatches
@@ -1339,6 +1419,17 @@ interface FederationOptions<TContextData> {
1339
1419
  * If any errors are thrown in this callback, they are ignored.
1340
1420
  */
1341
1421
  onOutboxError?: OutboxErrorHandler;
1422
+ /**
1423
+ * HTTP status codes that should be treated as permanent delivery failures.
1424
+ * When an inbox returns one of these codes, the delivery will not be retried
1425
+ * and the permanent failure handler (if registered via
1426
+ * {@link Federatable.setOutboxPermanentFailureHandler}) will be called.
1427
+ *
1428
+ * By default, `[404, 410]`.
1429
+ *
1430
+ * @since 2.0.0
1431
+ */
1432
+ permanentFailureStatusCodes?: readonly number[];
1342
1433
  /**
1343
1434
  * The time window for verifying HTTP Signatures of incoming requests. If the
1344
1435
  * request is older or newer than this window, it is rejected. Or if it is
@@ -2487,4 +2578,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2487
2578
  readonly multikey: Multikey;
2488
2579
  }
2489
2580
  //#endregion
2490
- export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
2581
+ export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
@@ -62,6 +62,35 @@ interface SenderKeyPair {
62
62
  /**
63
63
  * Parameters for {@link sendActivity}.
64
64
  */
65
+
66
+ /**
67
+ * An error that is thrown when an activity fails to send to a remote inbox.
68
+ * It contains structured information about the failure, including the HTTP
69
+ * status code, the inbox URL, and the response body.
70
+ * @since 2.0.0
71
+ */
72
+ declare class SendActivityError extends Error {
73
+ /**
74
+ * The inbox URL that the activity was being sent to.
75
+ */
76
+ readonly inbox: URL;
77
+ /**
78
+ * The HTTP status code returned by the inbox.
79
+ */
80
+ readonly statusCode: number;
81
+ /**
82
+ * The response body from the inbox, if any.
83
+ */
84
+ readonly responseBody: string;
85
+ /**
86
+ * Creates a new {@link SendActivityError}.
87
+ * @param inbox The inbox URL.
88
+ * @param statusCode The HTTP status code.
89
+ * @param message The error message.
90
+ * @param responseBody The response body.
91
+ */
92
+ constructor(inbox: URL, statusCode: number, message: string, responseBody: string);
93
+ }
65
94
  //#endregion
66
95
  //#region src/federation/callback.d.ts
67
96
  /**
@@ -224,6 +253,40 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
224
253
  * @since 0.6.0
225
254
  */
226
255
  type OutboxErrorHandler = (error: Error, activity: Activity | null) => void | Promise<void>;
256
+ /**
257
+ * A callback that handles permanent delivery failures when sending activities
258
+ * to remote inboxes.
259
+ *
260
+ * This handler is called when an inbox returns an HTTP status code that
261
+ * indicates permanent failure (such as `410 Gone` or `404 Not Found`),
262
+ * allowing the application to clean up followers that are no longer reachable.
263
+ *
264
+ * Unlike {@link OutboxErrorHandler}, which is called for every delivery failure
265
+ * (including retries), this handler is called only once for permanent failures,
266
+ * after which delivery is not retried.
267
+ *
268
+ * If any errors are thrown in this callback, they are caught, logged,
269
+ * and ignored.
270
+ *
271
+ * @template TContextData The context data to pass to the {@link Context}.
272
+ * @param context The context.
273
+ * @param values The delivery failure information.
274
+ * @since 2.0.0
275
+ */
276
+ type OutboxPermanentFailureHandler<TContextData> = (context: Context<TContextData>, values: {
277
+ /** The inbox URL that failed. */
278
+ readonly inbox: URL;
279
+ /** The activity that failed to deliver. */
280
+ readonly activity: Activity;
281
+ /** The error that occurred. */
282
+ readonly error: SendActivityError;
283
+ /** The HTTP status code returned by the inbox. */
284
+ readonly statusCode: number;
285
+ /**
286
+ * The actor IDs that were supposed to receive the activity at this inbox.
287
+ */
288
+ readonly actorIds: readonly URL[];
289
+ }) => void | Promise<void>;
227
290
  /**
228
291
  * A callback that determines if a request is authorized or not.
229
292
  *
@@ -637,6 +700,7 @@ interface OutboxMessage {
637
700
  readonly activityType: string;
638
701
  readonly inbox: string;
639
702
  readonly sharedInbox: boolean;
703
+ readonly actorIds?: readonly string[];
640
704
  readonly started: string;
641
705
  readonly attempt: number;
642
706
  readonly headers: Readonly<Record<string, string>>;
@@ -1169,6 +1233,22 @@ interface Federatable<TContextData> {
1169
1233
  * @param dispatcher A collection dispatcher callback to register.
1170
1234
  */
1171
1235
  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>;
1236
+ /**
1237
+ * Registers a handler for permanent delivery failures.
1238
+ *
1239
+ * This handler is called when an inbox returns an HTTP status code
1240
+ * that indicates permanent failure (`410 Gone`, `404 Not Found`, etc.),
1241
+ * allowing the application to clean up followers that are no longer
1242
+ * reachable.
1243
+ *
1244
+ * Unlike `onOutboxError`, which is called for every delivery failure
1245
+ * (including retries), this handler is called only once for permanent
1246
+ * failures, after which delivery is not retried.
1247
+ *
1248
+ * @param handler A callback to handle permanent failures.
1249
+ * @since 2.0.0
1250
+ */
1251
+ setOutboxPermanentFailureHandler(handler: OutboxPermanentFailureHandler<TContextData>): void;
1172
1252
  }
1173
1253
  /**
1174
1254
  * An object that registers federation-related business logic and dispatches
@@ -1341,6 +1421,17 @@ interface FederationOptions<TContextData> {
1341
1421
  * If any errors are thrown in this callback, they are ignored.
1342
1422
  */
1343
1423
  onOutboxError?: OutboxErrorHandler;
1424
+ /**
1425
+ * HTTP status codes that should be treated as permanent delivery failures.
1426
+ * When an inbox returns one of these codes, the delivery will not be retried
1427
+ * and the permanent failure handler (if registered via
1428
+ * {@link Federatable.setOutboxPermanentFailureHandler}) will be called.
1429
+ *
1430
+ * By default, `[404, 410]`.
1431
+ *
1432
+ * @since 2.0.0
1433
+ */
1434
+ permanentFailureStatusCodes?: readonly number[];
1344
1435
  /**
1345
1436
  * The time window for verifying HTTP Signatures of incoming requests. If the
1346
1437
  * request is older or newer than this window, it is rejected. Or if it is
@@ -2489,4 +2580,4 @@ interface ActorKeyPair extends CryptoKeyPair {
2489
2580
  readonly multikey: Multikey;
2490
2581
  }
2491
2582
  //#endregion
2492
- export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
2583
+ export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
@@ -5,7 +5,7 @@
5
5
 
6
6
  //#region deno.json
7
7
  var name = "@fedify/fedify";
8
- var version = "2.0.0-dev.323+1d796545";
8
+ var version = "2.0.0-dev.335+6fe86704";
9
9
  var license = "MIT";
10
10
  var exports = {
11
11
  ".": "./src/mod.ts",
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { validateCryptoKey } from "./key-BI6sqU5u.js";
7
- import { doubleKnock } from "./http-C4WANccp.js";
6
+ import { validateCryptoKey } from "./key-DFPkYar3.js";
7
+ import { doubleKnock } from "./http-CSqVEUdE.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { curry } from "es-toolkit";
10
10
  import { UrlError, createActivityPubRequest, getDocumentLoader, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -8,10 +8,10 @@ import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
- import "../deno-BTAi5-ur.js";
11
+ import "../deno-Dhe5E7NK.js";
12
12
  import "../router-D9eI0s4b.js";
13
- import "../inbox-CdBcxHA7.js";
14
- import { createFederationBuilder } from "../builder-CvKuNW7P.js";
13
+ import "../inbox-9F91oWJU.js";
14
+ import { createFederationBuilder } from "../builder-RHW0dkbP.js";
15
15
  import { assertExists } from "../std__assert-DWivtrGR.js";
16
16
  import "../assert_rejects-Ce45JcFg.js";
17
17
  import { assertThrows } from "../assert_throws-BNXdRGWP.js";
@@ -8,25 +8,25 @@ import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
- import "../deno-BTAi5-ur.js";
12
- import { createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-DaOdxVOc.js";
11
+ import "../deno-Dhe5E7NK.js";
12
+ import { createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-zvH5O0zk.js";
13
13
  import "../client-Dg7OfUDA.js";
14
14
  import "../router-D9eI0s4b.js";
15
15
  import "../types-CPz01LGH.js";
16
- import "../key-BI6sqU5u.js";
17
- import { signRequest } from "../http-C4WANccp.js";
18
- import "../ld-qTcTL2A4.js";
19
- import "../owner-Cfmtlwoe.js";
20
- import "../proof-Bc8ULrzP.js";
21
- import "../docloader-D8dzb6AT.js";
16
+ import "../key-DFPkYar3.js";
17
+ import { signRequest } from "../http-CSqVEUdE.js";
18
+ import "../ld-kAhyoO55.js";
19
+ import "../owner-DcyH0sQg.js";
20
+ import "../proof-D7C8ouBO.js";
21
+ import "../docloader-D6VuU143.js";
22
22
  import "../kv-cache-B__dHl7g.js";
23
- import { InboxListenerSet } from "../inbox-CdBcxHA7.js";
24
- import "../builder-CvKuNW7P.js";
23
+ import { InboxListenerSet } from "../inbox-9F91oWJU.js";
24
+ import "../builder-RHW0dkbP.js";
25
25
  import "../collection-CcnIw1qY.js";
26
26
  import "../keycache-DRxpZ5r9.js";
27
27
  import "../negotiation-5NPJL6zp.js";
28
28
  import "../retry-D4GJ670a.js";
29
- import "../send-BKW3wSXo.js";
29
+ import "../send-mAsnzegg.js";
30
30
  import "../std__assert-DWivtrGR.js";
31
31
  import "../assert_rejects-Ce45JcFg.js";
32
32
  import "../assert_throws-BNXdRGWP.js";
@@ -8,25 +8,25 @@ import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
- import "../deno-BTAi5-ur.js";
12
- import { createFederation } from "../middleware-DaOdxVOc.js";
11
+ import "../deno-Dhe5E7NK.js";
12
+ import { createFederation } from "../middleware-zvH5O0zk.js";
13
13
  import "../client-Dg7OfUDA.js";
14
14
  import "../router-D9eI0s4b.js";
15
15
  import "../types-CPz01LGH.js";
16
- import "../key-BI6sqU5u.js";
17
- import "../http-C4WANccp.js";
18
- import "../ld-qTcTL2A4.js";
19
- import "../owner-Cfmtlwoe.js";
20
- import { signObject } from "../proof-Bc8ULrzP.js";
21
- import "../docloader-D8dzb6AT.js";
16
+ import "../key-DFPkYar3.js";
17
+ import "../http-CSqVEUdE.js";
18
+ import "../ld-kAhyoO55.js";
19
+ import "../owner-DcyH0sQg.js";
20
+ import { signObject } from "../proof-D7C8ouBO.js";
21
+ import "../docloader-D6VuU143.js";
22
22
  import "../kv-cache-B__dHl7g.js";
23
- import "../inbox-CdBcxHA7.js";
24
- import "../builder-CvKuNW7P.js";
23
+ import "../inbox-9F91oWJU.js";
24
+ import "../builder-RHW0dkbP.js";
25
25
  import "../collection-CcnIw1qY.js";
26
26
  import "../keycache-DRxpZ5r9.js";
27
27
  import "../negotiation-5NPJL6zp.js";
28
28
  import "../retry-D4GJ670a.js";
29
- import "../send-BKW3wSXo.js";
29
+ import "../send-mAsnzegg.js";
30
30
  import "../std__assert-DWivtrGR.js";
31
31
  import "../assert_rejects-Ce45JcFg.js";
32
32
  import "../assert_throws-BNXdRGWP.js";
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { test } from "../dist-B5f6a8Tt.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
- import "../deno-BTAi5-ur.js";
9
- import { InboxListenerSet } from "../inbox-CdBcxHA7.js";
8
+ import "../deno-Dhe5E7NK.js";
9
+ import { InboxListenerSet } from "../inbox-9F91oWJU.js";
10
10
  import { assertThrows } from "../assert_throws-BNXdRGWP.js";
11
11
  import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
12
12