@fedify/fedify 2.4.0-dev.1422 → 2.4.0-dev.1488

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 (105) hide show
  1. package/README.md +4 -3
  2. package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
  3. package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
  4. package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
  5. package/dist/{assert_rejects-DQP-q39h.mjs → assert_rejects-DN60FHPX.mjs} +2 -2
  6. package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
  7. package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
  8. package/dist/{builder-Gef_ZeDE.mjs → builder-Dcr6y6XD.mjs} +3 -23
  9. package/dist/compat/mod.d.cts +1 -1
  10. package/dist/compat/mod.d.ts +1 -1
  11. package/dist/compat/outgoing-jsonld.test.mjs +3 -3
  12. package/dist/compat/public-audience.test.mjs +3 -3
  13. package/dist/compat/transformers.test.mjs +5 -5
  14. package/dist/{context-BuGH_Vft.d.cts → context-BBVLF7lx.d.cts} +70 -286
  15. package/dist/{context-CLtZxCu6.d.ts → context-BU6jSQdo.d.ts} +70 -285
  16. package/dist/{context-BrIOaBSs.mjs → context-DVoTs_wM.mjs} +1 -7
  17. package/dist/{deno-BmD7XRaO.mjs → deno-BCFGf8NR.mjs} +1 -1
  18. package/dist/{docloader-B8AJowCx.mjs → docloader-DWEwaGqF.mjs} +2 -2
  19. package/dist/federation/builder.test.mjs +5 -5
  20. package/dist/federation/circuit-breaker.test.mjs +5 -5
  21. package/dist/federation/collection.test.mjs +3 -3
  22. package/dist/federation/handler.test.mjs +13 -13
  23. package/dist/federation/idempotency.test.mjs +6 -6
  24. package/dist/federation/inbox.test.mjs +3 -3
  25. package/dist/federation/keycache.test.mjs +5 -5
  26. package/dist/federation/kv.test.mjs +3 -3
  27. package/dist/federation/metrics.test.mjs +4 -4
  28. package/dist/federation/middleware.test.mjs +19 -200
  29. package/dist/federation/mod.cjs +1 -1
  30. package/dist/federation/mod.d.cts +3 -3
  31. package/dist/federation/mod.d.ts +3 -3
  32. package/dist/federation/mod.js +1 -1
  33. package/dist/federation/mq.test.mjs +260 -5
  34. package/dist/federation/negotiation.test.mjs +4 -4
  35. package/dist/federation/retry.test.mjs +3 -3
  36. package/dist/federation/router.test.mjs +5 -5
  37. package/dist/federation/send.test.mjs +10 -10
  38. package/dist/federation/temporal.test.mjs +4 -4
  39. package/dist/federation/webfinger.test.mjs +6 -6
  40. package/dist/{http-BCSQJ_gv.cjs → http-DLqxhQg1.cjs} +17 -7
  41. package/dist/{http-CJ0WNyqA.js → http-DaVoLyyA.js} +17 -7
  42. package/dist/{http-GQoPA_YT.mjs → http-RriziGDE.mjs} +4 -4
  43. package/dist/{key-BLy_TeTg.mjs → key-Bkg8Zg36.mjs} +18 -8
  44. package/dist/{kv-cache-pw-kBdVz.mjs → kv-cache-BR--9V4L.mjs} +1 -1
  45. package/dist/{kv-cache-CjEcb9qH.js → kv-cache-DxlFLMiU.js} +1 -1
  46. package/dist/{kv-cache-DXwu7BtY.cjs → kv-cache-Fw-iwKjy.cjs} +1 -1
  47. package/dist/{ld-CWgxPlZq.mjs → ld-BjsmbqO7.mjs} +3 -3
  48. package/dist/{metrics-DUKoLd_E.mjs → metrics-BLoa2pab.mjs} +1 -1
  49. package/dist/{middleware-PZaroDUk.mjs → middleware-D3kuDjvb.mjs} +44 -186
  50. package/dist/{middleware-Dq-HhJHd.mjs → middleware-DNR3YBCi.mjs} +1 -1
  51. package/dist/{middleware-BiCk4wGY.cjs → middleware-V-r1QH5Z.cjs} +31 -281
  52. package/dist/{middleware-2Us0G3Iy.js → middleware-_9t5HVBi.js} +31 -281
  53. package/dist/{mod-DRokcHeU.d.cts → mod-C0F6kvgS.d.cts} +1 -1
  54. package/dist/{mod-r-1xOW_C.d.ts → mod-vPYVoa5n.d.ts} +1 -1
  55. package/dist/mod.cjs +4 -4
  56. package/dist/mod.d.cts +4 -4
  57. package/dist/mod.d.ts +4 -4
  58. package/dist/mod.js +4 -4
  59. package/dist/nodeinfo/client.test.mjs +3 -3
  60. package/dist/nodeinfo/handler.test.mjs +5 -5
  61. package/dist/nodeinfo/types.test.mjs +4 -4
  62. package/dist/otel/exporter.test.mjs +3 -3
  63. package/dist/{outgoing-jsonld-BgFLCJQ_.mjs → outgoing-jsonld-L_DbOaFe.mjs} +1 -1
  64. package/dist/{owner-U0Z8Ex6i.mjs → owner-NK2p1ihR.mjs} +2 -2
  65. package/dist/{proof-DA3hLGSO.cjs → proof-2WI6mMbC.cjs} +1 -1
  66. package/dist/{proof-nb5tfciW.mjs → proof-CRXqo703.mjs} +5 -5
  67. package/dist/{proof-f7K32nz7.js → proof-D7WVwQzs.js} +1 -1
  68. package/dist/{send-CLfW5Fdf.mjs → send-CTaPzl8L.mjs} +3 -3
  69. package/dist/sig/accept.test.mjs +1 -1
  70. package/dist/sig/http.test.mjs +8 -8
  71. package/dist/sig/key.test.mjs +56 -6
  72. package/dist/sig/ld.test.mjs +7 -7
  73. package/dist/sig/mod.cjs +2 -2
  74. package/dist/sig/mod.js +2 -2
  75. package/dist/sig/owner.test.mjs +6 -6
  76. package/dist/sig/proof.test.mjs +8 -8
  77. package/dist/{std__assert-BTEgfoJo.mjs → std__assert-BBjXFNOb.mjs} +4 -4
  78. package/dist/{temporal-2ry_jdCK.mjs → temporal-C8M0Y7v9.mjs} +1 -1
  79. package/dist/testing/mod.d.mts +7 -378
  80. package/dist/testing/mod.mjs +2 -3
  81. package/dist/utils/docloader.test.mjs +6 -6
  82. package/dist/utils/kv-cache.test.mjs +1 -1
  83. package/dist/utils/mod.cjs +1 -1
  84. package/dist/utils/mod.js +1 -1
  85. package/package.json +8 -13
  86. package/dist/codec-Bf-rTqks.mjs +0 -94
  87. package/dist/federation/tasks/codec.test.d.mts +0 -2
  88. package/dist/federation/tasks/codec.test.mjs +0 -292
  89. package/dist/federation/tasks/tasks.test.d.mts +0 -2
  90. package/dist/federation/tasks/tasks.test.mjs +0 -651
  91. package/dist/mq-CvJAzRz5.mjs +0 -260
  92. package/dist/testing-CjYPStvE.mjs +0 -55
  93. /package/dist/{accept-CceiKpCy.mjs → accept-CPkZzmGN.mjs} +0 -0
  94. /package/dist/{activity-listener-BeTGV3wc.mjs → activity-listener-tztVvlNb.mjs} +0 -0
  95. /package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
  96. /package/dist/{circuit-breaker-hJBB6jwA.mjs → circuit-breaker-CSWsyoef.mjs} +0 -0
  97. /package/dist/{client-B_A6mfn3.mjs → client-ByXmQhYD.mjs} +0 -0
  98. /package/dist/{collection-Dp5ky45w.mjs → collection-Cc3DVAhE.mjs} +0 -0
  99. /package/dist/{keycache-CaOR6NYg.mjs → keycache-BeU0LCII.mjs} +0 -0
  100. /package/dist/{keys-C3kae-6B.mjs → keys-DGu1NFwu.mjs} +0 -0
  101. /package/dist/{kv-x2IvBUyq.mjs → kv-rV3vodCc.mjs} +0 -0
  102. /package/dist/{negotiation-m_L2nyS3.mjs → negotiation-DDstyBvc.mjs} +0 -0
  103. /package/dist/{public-audience-N3pyOx2p.mjs → public-audience-Cvbr2Gzt.mjs} +0 -0
  104. /package/dist/{retry-DI4O-zYl.mjs → retry-CXg_MBI-.mjs} +0 -0
  105. /package/dist/{types-BFowWFTT.mjs → types-J53Kw7so.mjs} +0 -0
package/README.md CHANGED
@@ -216,21 +216,22 @@ financial contributors:[^2]
216
216
  ### Corporate sponsors
217
217
 
218
218
  - [<img src="https://images.opencollective.com/ghost/avatar/128.png" width="64" height="64"> Ghost](https://ghost.org)
219
+ - [<img src="https://images.opencollective.com/altstore/avatar/128.png" width="64" height="64"> AltStore](https://altstore.io)
219
220
 
220
221
  ### Supporters
221
222
 
222
- - [Daniel Supernault](https://pixelfed.org/)
223
223
  - [tkgka](https://opencollective.com/tkgka)
224
224
  - [Blaine](https://opencollective.com/blaine)
225
225
  - [Erick González Aguilar](https://opencollective.com/erick-gonzalez-aguilar)
226
+ - [Daniel Supernault](https://pixelfed.org/)
226
227
 
227
228
  ### Backers
228
229
 
229
- Robin Riley, yamanoku, Encyclia, taye, okin, Andy Piper, box464, Evan Prodromou, Rafael Goulart, malte
230
+ Robin Riley, Encyclia, taye, box464, Evan Prodromou, okin, yamanoku, malte, Rafael Goulart, Andy Piper
230
231
 
231
232
  ### One-time donations
232
233
 
233
- Robin Riley, Markus P, Nils Bergmann, Rameez
234
+ Robin Riley, malte, Nils Bergmann, Markus P, Rameez
234
235
 
235
236
  <!-- /DO NOT EDIT -->
236
237
 
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { l as AssertionError } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert.js
6
6
  /**
7
7
  * Make an assertion, error will be thrown if `expr` does not have truthy value.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { l as AssertionError } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_instance_of.js
6
6
  /**
7
7
  * Make an assertion that `obj` is an instance of `type`.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as equal, l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { c as equal, l as AssertionError } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_not_equals.js
6
6
  /**
7
7
  * Make an assertion that `actual` and `expected` are not equal, deeply.
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError, s as format } from "./assert_equals-Ew3jOFa3.mjs";
5
- import { n as assertIsError } from "./assert_throws-4NwKEy2q.mjs";
4
+ import { l as AssertionError, s as format } from "./assert_equals-C-ZRDbaf.mjs";
5
+ import { n as assertIsError } from "./assert_throws-BOkhLGYc.mjs";
6
6
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_false.js
7
7
  /**
8
8
  * Make an assertion, error will be thrown if `expr` have truthy value.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js
6
6
  /**
7
7
  * Make an assertion that `actual` and `expected` are equal using
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError, o as stripAnsiCode } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { l as AssertionError, o as stripAnsiCode } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_is_error.js
6
6
  /**
7
7
  * Make an assertion that `error` is an `Error`.
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-BmD7XRaO.mjs";
5
- import { t as ActivityListenerSet } from "./activity-listener-BeTGV3wc.mjs";
4
+ import { n as version, t as name } from "./deno-BCFGf8NR.mjs";
5
+ import { t as ActivityListenerSet } from "./activity-listener-tztVvlNb.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
8
8
  import { Tombstone, getTypeId } from "@fedify/vocab";
@@ -61,7 +61,6 @@ var FederationBuilderImpl = class {
61
61
  idempotencyStrategy;
62
62
  collectionTypeIds;
63
63
  collectionCallbacks;
64
- taskDefinitions;
65
64
  /**
66
65
  * Symbol registry for unique identification of unnamed symbols.
67
66
  */
@@ -72,7 +71,6 @@ var FederationBuilderImpl = class {
72
71
  this.objectTypeIds = {};
73
72
  this.collectionCallbacks = {};
74
73
  this.collectionTypeIds = {};
75
- this.taskDefinitions = /* @__PURE__ */ new Map();
76
74
  }
77
75
  /**
78
76
  * Builds the federation object.
@@ -82,7 +80,7 @@ var FederationBuilderImpl = class {
82
80
  * specified.
83
81
  */
84
82
  async build(options) {
85
- const { FederationImpl } = await import("./middleware-Dq-HhJHd.mjs");
83
+ const { FederationImpl } = await import("./middleware-DNR3YBCi.mjs");
86
84
  const f = new FederationImpl(options);
87
85
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
88
86
  f.router = this.router.clone();
@@ -111,7 +109,6 @@ var FederationBuilderImpl = class {
111
109
  f.unverifiedActivityHandler = this.unverifiedActivityHandler;
112
110
  f.outboxPermanentFailureHandler = this.outboxPermanentFailureHandler;
113
111
  f.idempotencyStrategy = this.idempotencyStrategy;
114
- f.taskDefinitions = new Map(this.taskDefinitions);
115
112
  return f;
116
113
  }
117
114
  _getTracer() {
@@ -244,23 +241,6 @@ var FederationBuilderImpl = class {
244
241
  setWebFingerLinksDispatcher(dispatcher) {
245
242
  this.webFingerLinksDispatcher = dispatcher;
246
243
  }
247
- defineTask(name, options) {
248
- if (this.taskDefinitions.has(name)) throw new TypeError(`Task ${JSON.stringify(name)} is already defined.`);
249
- const handle = {
250
- name,
251
- schema: options.schema
252
- };
253
- this.taskDefinitions.set(name, {
254
- name,
255
- schema: options.schema,
256
- handle,
257
- handler: options.handler,
258
- onError: options.onError,
259
- retryPolicy: options.retryPolicy,
260
- queue: options.queue
261
- });
262
- return handle;
263
- }
264
244
  /**
265
245
  * The RFC 6570 template-literal `path` overloads were removed for
266
246
  * type-checking efficiency, so the URI variable types can no longer be
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { It as ActivityTransformer, n as Context } from "../context-BuGH_Vft.cjs";
2
+ import { jt as ActivityTransformer, n as Context } from "../context-BBVLF7lx.cjs";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { It as ActivityTransformer, n as Context } from "../context-CLtZxCu6.js";
2
+ import { jt as ActivityTransformer, n as Context } from "../context-BU6jSQdo.js";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -1,9 +1,9 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { t as assertStrictEquals } from "../assert_strict_equals-Dmjbg-bA.mjs";
6
- import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-BgFLCJQ_.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import { t as assertStrictEquals } from "../assert_strict_equals-XEgZAlrj.mjs";
6
+ import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-L_DbOaFe.mjs";
7
7
  import { Create, Document, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
8
8
  import { mockDocumentLoader, test } from "@fedify/fixture";
9
9
  //#region src/compat/outgoing-jsonld.test.ts
@@ -1,9 +1,9 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
6
- import { t as normalizePublicAudience } from "../public-audience-N3pyOx2p.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
6
+ import { t as normalizePublicAudience } from "../public-audience-Cvbr2Gzt.mjs";
7
7
  import { Create, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
@@ -1,11 +1,11 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
6
- import { t as assert } from "../assert-DikXweDx.mjs";
7
- import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
8
- import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-PZaroDUk.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
6
+ import { t as assert } from "../assert-OguE97r2.mjs";
7
+ import { t as MemoryKvStore } from "../kv-rV3vodCc.mjs";
8
+ import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-D3kuDjvb.mjs";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  import { test } from "@fedify/fixture";
11
11
  //#region src/compat/transformers.test.ts
@@ -8,8 +8,6 @@ import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObj
8
8
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
9
9
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
10
10
  import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
11
- import { StandardSchemaV1 } from "@standard-schema/spec";
12
-
13
11
  //#region src/compat/types.d.ts
14
12
  /**
15
13
  * A function that transforms an activity object.
@@ -609,201 +607,6 @@ declare function respondWithObject(object: Object$1, options?: RespondWithObject
609
607
  */
610
608
  declare function respondWithObjectIfAcceptable(object: Object$1, request: Request, options?: RespondWithObjectOptions): Promise<Response | null>;
611
609
  //#endregion
612
- //#region src/federation/retry.d.ts
613
- /**
614
- * The context passed to a {@link RetryPolicy} callback.
615
- * @since 0.12.0
616
- */
617
- interface RetryContext {
618
- /**
619
- * The elapsed time since the first attempt.
620
- */
621
- readonly elapsedTime: Temporal.Duration;
622
- /**
623
- * The number of attempts so far.
624
- */
625
- readonly attempts: number;
626
- }
627
- /**
628
- * A policy that determines the delay before the next retry.
629
- * @param context The retry context.
630
- * @returns The delay before the next retry, or `null` to stop retrying.
631
- * It must not negative.
632
- * @since 0.12.0
633
- */
634
- type RetryPolicy = (context: RetryContext) => Temporal.Duration | null;
635
- /**
636
- * Options for {@link createExponentialBackoffPolicy} function.
637
- * @since 0.12.0
638
- */
639
- interface CreateExponentialBackoffPolicyOptions {
640
- /**
641
- * The initial delay before the first retry. Defaults to 1 second.
642
- */
643
- readonly initialDelay?: Temporal.DurationLike;
644
- /**
645
- * The maximum delay between retries. Defaults to 12 hours.
646
- */
647
- readonly maxDelay?: Temporal.DurationLike;
648
- /**
649
- * The maximum number of attempts before giving up.
650
- * Defaults to 10.
651
- */
652
- readonly maxAttempts?: number;
653
- /**
654
- * The factor to multiply the previous delay by for each retry.
655
- * Defaults to 2.
656
- */
657
- readonly factor?: number;
658
- /**
659
- * Whether to add jitter to the delay to avoid synchronization.
660
- * Turned on by default.
661
- */
662
- readonly jitter?: boolean;
663
- }
664
- /**
665
- * Creates an exponential backoff retry policy. The delay between retries
666
- * starts at the `initialDelay` and is multiplied by the `factor` for each
667
- * subsequent retry, up to the `maxDelay`. The policy will give up after
668
- * `maxAttempts` attempts. The actual delay is randomized to avoid
669
- * synchronization (jitter).
670
- * @param options The options for the policy.
671
- * @returns The retry policy.
672
- * @since 0.12.0
673
- */
674
- declare function createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy;
675
- //#endregion
676
- //#region src/federation/tasks/task.d.ts
677
- /**
678
- * A callback that processes a custom background task.
679
- * @template TContextData The context data to pass to the {@link Context}.
680
- * @template TData The type of the task payload, inferred from the task's
681
- * schema.
682
- * @param ctx The context for the worker processing the task.
683
- * @param data The decoded and validated task payload.
684
- * @since 2.x.x
685
- */
686
- type TaskHandler<TContextData, TData> = (ctx: Context<TContextData>, data: TData) => Promise<void> | void;
687
- /**
688
- * Options for {@link TaskRegistry.defineTask}.
689
- * @template TContextData The context data to pass to the {@link Context}.
690
- * @template TSchema The [Standard Schema](https://standardschema.dev/) that
691
- * validates the task payload.
692
- * @since 2.x.x
693
- */
694
- interface TaskDefinitionOptions<TContextData, TSchema extends StandardSchemaV1> {
695
- /**
696
- * The [Standard Schema](https://standardschema.dev/) that validates the
697
- * task payload. The payload type is inferred from this schema.
698
- *
699
- * The payload is validated twice: once at enqueue time (fail fast) and
700
- * once at dequeue time (drift protection against payloads enqueued by an
701
- * older deployment). Because the same schema runs on both sides, its
702
- * validation must be idempotent: the validated output must itself be
703
- * a valid input. Transforming schemas (e.g., Zod's `.transform()`) whose
704
- * output differs in shape from their input are not supported.
705
- */
706
- readonly schema: TSchema;
707
- /**
708
- * The callback that processes the task on a background worker.
709
- */
710
- readonly handler: TaskHandler<TContextData, StandardSchemaV1.InferOutput<TSchema>>;
711
- /**
712
- * The retry policy for this task. If omitted, the federation-wide
713
- * task retry policy is used, which defaults to an exponential backoff
714
- * policy.
715
- */
716
- readonly retryPolicy?: RetryPolicy;
717
- /**
718
- * A callback invoked when the {@link handler} throws an error, before
719
- * a retry is scheduled.
720
- * @param ctx The context for the worker processing the task.
721
- * @param error The error thrown by the handler.
722
- * @param data The decoded and validated task payload.
723
- */
724
- readonly onError?: (ctx: Context<TContextData>, error: unknown, data: StandardSchemaV1.InferOutput<TSchema>) => Promise<void> | void;
725
- /**
726
- * The message queue dedicated to this task. If omitted, the task is
727
- * routed to the federation-wide task queue, falling back to the outbox
728
- * queue (unless `taskQueueResolution: "strict"` is configured).
729
- */
730
- readonly queue?: MessageQueue;
731
- }
732
- /**
733
- * Phantom key binding a {@link TaskDefinition} to its federation's context
734
- * data type. Declared only—no value exists at runtime, and the symbol is
735
- * not exported, so the marker stays out of user-facing completions.
736
- */
737
- declare const contextDataBrand: unique symbol;
738
- /**
739
- * The handle returned by {@link TaskRegistry.defineTask}. It carries the
740
- * task name and schema so that {@link Context.enqueueTask} can validate the
741
- * payload and infer its type at every call site.
742
- * @template TContextData The context data to pass to the {@link Context}.
743
- * @template TData The type of the task payload, inferred from the task's
744
- * schema.
745
- * @since 2.x.x
746
- */
747
- interface TaskDefinition<TContextData, TData> {
748
- /**
749
- * The unique name of the task.
750
- */
751
- readonly name: string;
752
- /**
753
- * The [Standard Schema](https://standardschema.dev/) that validates the
754
- * task payload.
755
- */
756
- readonly schema: StandardSchemaV1<unknown, TData>;
757
- /**
758
- * @internal Phantom marker binding the handle to its federation.
759
- */
760
- readonly [contextDataBrand]?: TContextData;
761
- }
762
- /**
763
- * Registration of custom background tasks. Both {@link Federation} and
764
- * {@link FederationBuilder} implement this interface.
765
- * @template TContextData The context data to pass to the {@link Context}.
766
- * @since 2.x.x
767
- */
768
- interface TaskRegistry<TContextData> {
769
- /**
770
- * Defines a custom background task. The returned handle is passed to
771
- * {@link Context.enqueueTask} to enqueue the task.
772
- *
773
- * @example
774
- * ``` typescript
775
- * const sendDigest = federation.defineTask("sendDigest", {
776
- * schema: digestSchema,
777
- * handler: async (ctx, data) => {
778
- * // …process the payload on a background worker…
779
- * },
780
- * });
781
- * ```
782
- *
783
- * @param name The unique name of the task.
784
- * @param options The task definition options. The payload type is
785
- * inferred from `options.schema`.
786
- * @returns The handle to pass to {@link Context.enqueueTask}.
787
- * @throws {TypeError} If a task with the same name is already defined.
788
- */
789
- defineTask<TSchema extends StandardSchemaV1>(name: string, options: TaskDefinitionOptions<TContextData, TSchema>): TaskDefinition<TContextData, StandardSchemaV1.InferOutput<TSchema>>;
790
- }
791
- /**
792
- * Options for {@link Context.enqueueTask} and {@link Context.enqueueTaskMany}.
793
- * @since 2.x.x
794
- */
795
- interface TaskEnqueueOptions {
796
- /**
797
- * The delay before the task is processed. No delay by default.
798
- */
799
- readonly delay?: Temporal.DurationLike;
800
- /**
801
- * An optional key that ensures tasks with the same ordering key are
802
- * processed sequentially (one at a time).
803
- */
804
- readonly orderingKey?: string;
805
- }
806
- //#endregion
807
610
  //#region src/federation/builder.d.ts
808
611
  /**
809
612
  * Creates a new {@link FederationBuilder} instance.
@@ -826,7 +629,7 @@ interface SenderKeyJwkPair {
826
629
  * type.
827
630
  * @since 1.6.0
828
631
  */
829
- type Message = FanoutMessage | OutboxMessage | InboxMessage | TaskMessage;
632
+ type Message = FanoutMessage | OutboxMessage | InboxMessage;
830
633
  interface FanoutMessage {
831
634
  readonly type: "fanout";
832
635
  readonly id: ReturnType<typeof crypto.randomUUID>;
@@ -880,24 +683,6 @@ interface OutboxMessage {
880
683
  readonly circuitHeldSince?: string;
881
684
  readonly traceContext: Readonly<Record<string, string>>;
882
685
  }
883
- /**
884
- * A message that carries a custom background task. Every field is
885
- * a string, number, or plain record so that the message survives both
886
- * JSON serialization and structured clone on every queue backend.
887
- * @since 2.x.x
888
- */
889
- interface TaskMessage {
890
- readonly type: "task";
891
- readonly id: ReturnType<typeof crypto.randomUUID>;
892
- readonly baseUrl: string;
893
- readonly taskName: string;
894
- /** devalue-encoded task data; vocab objects bridged to expanded JSON-LD. */
895
- readonly data: string;
896
- readonly started: string;
897
- readonly attempt: number;
898
- readonly orderingKey?: string;
899
- readonly traceContext: Readonly<Record<string, string>>;
900
- }
901
686
  interface InboxMessage {
902
687
  readonly type: "inbox";
903
688
  readonly id: ReturnType<typeof crypto.randomUUID>;
@@ -945,6 +730,70 @@ interface InboxMessage {
945
730
  readonly traceContext: Readonly<Record<string, string>>;
946
731
  }
947
732
  //#endregion
733
+ //#region src/federation/retry.d.ts
734
+ /**
735
+ * The context passed to a {@link RetryPolicy} callback.
736
+ * @since 0.12.0
737
+ */
738
+ interface RetryContext {
739
+ /**
740
+ * The elapsed time since the first attempt.
741
+ */
742
+ readonly elapsedTime: Temporal.Duration;
743
+ /**
744
+ * The number of attempts so far.
745
+ */
746
+ readonly attempts: number;
747
+ }
748
+ /**
749
+ * A policy that determines the delay before the next retry.
750
+ * @param context The retry context.
751
+ * @returns The delay before the next retry, or `null` to stop retrying.
752
+ * It must not negative.
753
+ * @since 0.12.0
754
+ */
755
+ type RetryPolicy = (context: RetryContext) => Temporal.Duration | null;
756
+ /**
757
+ * Options for {@link createExponentialBackoffPolicy} function.
758
+ * @since 0.12.0
759
+ */
760
+ interface CreateExponentialBackoffPolicyOptions {
761
+ /**
762
+ * The initial delay before the first retry. Defaults to 1 second.
763
+ */
764
+ readonly initialDelay?: Temporal.DurationLike;
765
+ /**
766
+ * The maximum delay between retries. Defaults to 12 hours.
767
+ */
768
+ readonly maxDelay?: Temporal.DurationLike;
769
+ /**
770
+ * The maximum number of attempts before giving up.
771
+ * Defaults to 10.
772
+ */
773
+ readonly maxAttempts?: number;
774
+ /**
775
+ * The factor to multiply the previous delay by for each retry.
776
+ * Defaults to 2.
777
+ */
778
+ readonly factor?: number;
779
+ /**
780
+ * Whether to add jitter to the delay to avoid synchronization.
781
+ * Turned on by default.
782
+ */
783
+ readonly jitter?: boolean;
784
+ }
785
+ /**
786
+ * Creates an exponential backoff retry policy. The delay between retries
787
+ * starts at the `initialDelay` and is multiplied by the `factor` for each
788
+ * subsequent retry, up to the `maxDelay`. The policy will give up after
789
+ * `maxAttempts` attempts. The actual delay is randomized to avoid
790
+ * synchronization (jitter).
791
+ * @param options The options for the policy.
792
+ * @returns The retry policy.
793
+ * @since 0.12.0
794
+ */
795
+ declare function createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy;
796
+ //#endregion
948
797
  //#region src/federation/middleware.d.ts
949
798
  /**
950
799
  * Configures the task queues for sending and receiving activities.
@@ -968,13 +817,6 @@ interface FederationQueueOptions {
968
817
  * {@link Context.sendActivity} calls.
969
818
  */
970
819
  readonly fanout?: MessageQueue;
971
- /**
972
- * The message queue for custom background tasks. If not provided,
973
- * tasks are routed to the outbox queue (unless
974
- * {@link FederationOptions.taskQueueResolution} is `"strict"`).
975
- * @since 2.x.x
976
- */
977
- readonly task?: MessageQueue;
978
820
  }
979
821
  /**
980
822
  * Prefixes for namespacing keys in the Deno KV store.
@@ -1059,18 +901,18 @@ interface FederationStartQueueOptions {
1059
901
  signal?: AbortSignal;
1060
902
  /**
1061
903
  * Starts the task worker only for the specified queue. If unspecified,
1062
- * which is the default, the task worker starts for all four queues:
1063
- * inbox, outbox, fanout, and task.
904
+ * which is the default, the task worker starts for all three queues:
905
+ * inbox, outbox, and fanout.
1064
906
  * @since 1.3.0
1065
907
  */
1066
- queue?: "inbox" | "outbox" | "fanout" | "task";
908
+ queue?: "inbox" | "outbox" | "fanout";
1067
909
  }
1068
910
  /**
1069
911
  * A common interface between {@link Federation} and {@link FederationBuilder}.
1070
912
  * @template TContextData The context data to pass to the {@link Context}.
1071
913
  * @since 1.6.0
1072
914
  */
1073
- interface Federatable<TContextData> extends TaskRegistry<TContextData> {
915
+ interface Federatable<TContextData> {
1074
916
  /**
1075
917
  * Registers a NodeInfo dispatcher.
1076
918
  * @param path The URI path pattern for the NodeInfo dispatcher. The syntax
@@ -1777,26 +1619,6 @@ interface FederationOptions<TContextData> {
1777
1619
  */
1778
1620
  inboxRetryPolicy?: RetryPolicy;
1779
1621
  /**
1780
- * The retry policy for processing custom background tasks. By default,
1781
- * this uses an exponential backoff strategy with a maximum of 10 attempts
1782
- * and a maximum delay of 12 hours. A per-task retry policy
1783
- * ({@link TaskDefinitionOptions.retryPolicy}) overrides this.
1784
- * @since 2.x.x
1785
- */
1786
- taskRetryPolicy?: RetryPolicy;
1787
- /**
1788
- * How a queue is resolved for a custom background task when neither
1789
- * a per-task queue ({@link TaskDefinitionOptions.queue}) nor a dedicated
1790
- * task queue ({@link FederationQueueOptions.task}) is configured.
1791
- *
1792
- * - `"fallback"` (the default): the task is routed to the outbox queue.
1793
- * - `"strict"`: no fallback; enqueuing the task throws instead of
1794
- * silently sharing the outbox queue.
1795
- * @default `"fallback"`
1796
- * @since 2.x.x
1797
- */
1798
- taskQueueResolution?: "fallback" | "strict";
1799
- /**
1800
1622
  * Activity transformers that are applied to outgoing activities. It is
1801
1623
  * useful for adjusting outgoing activities to satisfy some ActivityPub
1802
1624
  * implementations.
@@ -2549,44 +2371,6 @@ interface Context<TContextData> {
2549
2371
  */
2550
2372
  routeActivity(recipient: string | null, activity: Activity, options?: RouteActivityOptions): Promise<boolean>;
2551
2373
  /**
2552
- * Enqueues a custom background task. The payload is validated against
2553
- * the task's schema, serialized, and processed by the task's handler on
2554
- * a background worker.
2555
- *
2556
- * @example
2557
- * ``` typescript
2558
- * await ctx.enqueueTask(sendDigest, { userId: "alice" });
2559
- * ```
2560
- *
2561
- * @template TData The type of the task payload, inferred from the task's
2562
- * schema.
2563
- * @param task The handle returned by {@link TaskRegistry.defineTask}.
2564
- * @param data The task payload. It is validated against the task's
2565
- * schema before being enqueued.
2566
- * @param options Options for enqueuing the task.
2567
- * @throws {TypeError} If the task is not defined on this federation,
2568
- * if no message queue is configured for tasks, or if
2569
- * the payload fails schema validation.
2570
- * @since 2.x.x
2571
- */
2572
- enqueueTask<TData>(task: TaskDefinition<TContextData, TData>, data: TData, options?: TaskEnqueueOptions): Promise<void>;
2573
- /**
2574
- * Enqueues multiple payloads for a custom background task at once.
2575
- * Uses the queue's bulk enqueue operation when available, falling back
2576
- * to parallel single enqueues.
2577
- * @template TData The type of the task payload, inferred from the task's
2578
- * schema.
2579
- * @param task The handle returned by {@link TaskRegistry.defineTask}.
2580
- * @param payloads The task payloads. Each is validated against the
2581
- * task's schema before being enqueued.
2582
- * @param options Options for enqueuing the tasks.
2583
- * @throws {TypeError} If the task is not defined on this federation,
2584
- * if no message queue is configured for tasks, or if
2585
- * a payload fails schema validation.
2586
- * @since 2.x.x
2587
- */
2588
- enqueueTaskMany<TData>(task: TaskDefinition<TContextData, TData>, payloads: readonly TData[], options?: TaskEnqueueOptions): Promise<void>;
2589
- /**
2590
2374
  * Builds the URI of a collection of objects with the given name and values.
2591
2375
  * @param name The name of the collection, which can be a string or a symbol.
2592
2376
  * @param values The values of the URI parameters.
@@ -3097,4 +2881,4 @@ interface ActorKeyPair extends CryptoKeyPair {
3097
2881
  readonly multikey: Multikey;
3098
2882
  }
3099
2883
  //#endregion
3100
- export { AuthorizePredicate as $, Rfc6570Expression as A, CircuitBreakerOptions as At, TaskHandler as B, FederationStartQueueOptions as C, digest as Ct, InboxListenerSetters as D, CircuitBreakerCreateOptions as Dt, InboxChallengePolicy as E, CircuitBreakerBeforeSendDecision as Et, Message as F, parseCircuitBreakerKvState as Ft, createExponentialBackoffPolicy as G, CreateExponentialBackoffPolicyOptions as H, createFederationBuilder as I, ActivityTransformer as It, respondWithObjectIfAcceptable as J, RespondWithObjectOptions as K, TaskDefinition as L, FederationOrigin as M, CircuitBreakerStateChange as Mt, FederationQueueOptions as N, NormalizedCircuitBreakerOptions as Nt, ObjectCallbackSetters as O, CircuitBreakerFailurePolicy as Ot, createFederation as P, normalizeCircuitBreakerOptions as Pt, ActorKeyPairsDispatcher as Q, TaskDefinitionOptions as R, FederationOptions as S, buildCollectionSynchronizationHeader as St, IdempotencyStrategy as T, CircuitBreakerActivityDrop as Tt, RetryContext as U, TaskRegistry as V, RetryPolicy as W, ActorDispatcher as X, ActorAliasMapper as Y, ActorHandleMapper as Z, Federatable as _, UnverifiedActivityReason as _t, GetSignedKeyOptions as a, CustomCollectionDispatcher as at, FederationBuilder as b, SenderKeyPair as bt, ParseUriResult as c, NodeInfoDispatcher as ct, SendActivityOptions as d, OutboxErrorHandler as dt, CollectionCounter as et, SendActivityOptionsForCollection as f, OutboxListener as ft, CustomCollectionCallbackSetters as g, UnverifiedActivityHandler as gt, ConstructorWithTypeId as h, SharedInboxKeyDispatcher as ht, GetActorOptions as i, CustomCollectionCursor as it, FederationKvPrefixes as j, CircuitBreakerState as jt, OutboxListenerSetters as k, CircuitBreakerKvState as kt, RequestContext as l, ObjectAuthorizePredicate as lt, CollectionCallbackSetters as m, OutboxPermanentFailureHandler as mt, Context as n, CollectionDispatcher as nt, InboxContext as o, InboxErrorHandler as ot, ActorCallbackSetters as p, OutboxListenerErrorHandler as pt, respondWithObject as q, ForwardActivityOptions as r, CustomCollectionCounter as rt, OutboxContext as s, InboxListener as st, ActorKeyPair as t, CollectionCursor as tt, RouteActivityOptions as u, ObjectDispatcher as ut, Federation as v, WebFingerLinksDispatcher as vt, IdempotencyKeyCallback as w, CircuitBreaker as wt, FederationFetchOptions as x, PageItems as xt, FederationBenchmarkOptions as y, SendActivityError as yt, TaskEnqueueOptions as z };
2884
+ export { CustomCollectionCursor as $, Rfc6570Expression as A, parseCircuitBreakerKvState as At, createFederationBuilder as B, FederationStartQueueOptions as C, CircuitBreakerFailurePolicy as Ct, InboxListenerSetters as D, CircuitBreakerStateChange as Dt, InboxChallengePolicy as E, CircuitBreakerState as Et, CreateExponentialBackoffPolicyOptions as F, ActorDispatcher as G, respondWithObject as H, RetryContext as I, AuthorizePredicate as J, ActorHandleMapper as K, RetryPolicy as L, FederationOrigin as M, FederationQueueOptions as N, ObjectCallbackSetters as O, NormalizedCircuitBreakerOptions as Ot, createFederation as P, CustomCollectionCounter as Q, createExponentialBackoffPolicy as R, FederationOptions as S, CircuitBreakerCreateOptions as St, IdempotencyStrategy as T, CircuitBreakerOptions as Tt, respondWithObjectIfAcceptable as U, RespondWithObjectOptions as V, ActorAliasMapper as W, CollectionCursor as X, CollectionCounter as Y, CollectionDispatcher as Z, Federatable as _, buildCollectionSynchronizationHeader as _t, GetSignedKeyOptions as a, ObjectDispatcher as at, FederationBuilder as b, CircuitBreakerActivityDrop as bt, ParseUriResult as c, OutboxListenerErrorHandler as ct, SendActivityOptions as d, UnverifiedActivityHandler as dt, CustomCollectionDispatcher as et, SendActivityOptionsForCollection as f, UnverifiedActivityReason as ft, CustomCollectionCallbackSetters as g, PageItems as gt, ConstructorWithTypeId as h, SenderKeyPair as ht, GetActorOptions as i, ObjectAuthorizePredicate as it, FederationKvPrefixes as j, ActivityTransformer as jt, OutboxListenerSetters as k, normalizeCircuitBreakerOptions as kt, RequestContext as l, OutboxPermanentFailureHandler as lt, CollectionCallbackSetters as m, SendActivityError as mt, Context as n, InboxListener as nt, InboxContext as o, OutboxErrorHandler as ot, ActorCallbackSetters as p, WebFingerLinksDispatcher as pt, ActorKeyPairsDispatcher as q, ForwardActivityOptions as r, NodeInfoDispatcher as rt, OutboxContext as s, OutboxListener as st, ActorKeyPair as t, InboxErrorHandler as tt, RouteActivityOptions as u, SharedInboxKeyDispatcher as ut, Federation as v, digest as vt, IdempotencyKeyCallback as w, CircuitBreakerKvState as wt, FederationFetchOptions as x, CircuitBreakerBeforeSendDecision as xt, FederationBenchmarkOptions as y, CircuitBreaker as yt, Message as z };