@fedify/fedify 2.4.0-dev.1668 → 2.4.0-dev.1727

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 (150) hide show
  1. package/README.md +1 -1
  2. package/dist/{assert-CJ1KXcvv.mjs → assert-CebeUf0C.mjs} +1 -1
  3. package/dist/assert_exists-DtzkXC47.mjs +28 -0
  4. package/dist/assert_false-3pLLLsO4.mjs +23 -0
  5. package/dist/assert_greater_or_equal-BApOTh1h.mjs +30 -0
  6. package/dist/{assert_instance_of-Q9KTBnrf.mjs → assert_instance_of-g3WcyYNR.mjs} +1 -1
  7. package/dist/{assert_not_equals-EPJPoxuf.mjs → assert_not_equals-BN7yDMWe.mjs} +1 -1
  8. package/dist/assert_rejects-wFbSPn1O.mjs +39 -0
  9. package/dist/{assert_strict_equals-Ec20AUwa.mjs → assert_strict_equals-Bpjl4Psw.mjs} +1 -1
  10. package/dist/{assert_throws-NiFfqbnH.mjs → assert_throws-BJ5wuvR2.mjs} +1 -1
  11. package/dist/{builder-iXZ5jNVg.mjs → builder-f5-YwHfj.mjs} +5 -3
  12. package/dist/{circuit-breaker-CBGyz5F7.mjs → circuit-breaker-BT7CiPbz.mjs} +191 -9
  13. package/dist/circuit-breaker-test-utils-BYIHoliq.mjs +14 -0
  14. package/dist/{client-CjF5IYQS.mjs → client-CtxvmazV.mjs} +63 -5
  15. package/dist/{collection-BIhlldqK.mjs → collection-CnnP1UAv.mjs} +1 -1
  16. package/dist/compat/mod.cjs +1 -1
  17. package/dist/compat/mod.d.cts +1 -1
  18. package/dist/compat/mod.d.ts +1 -1
  19. package/dist/compat/mod.js +1 -1
  20. package/dist/compat/outgoing-jsonld.test.mjs +3 -3
  21. package/dist/compat/public-audience.test.mjs +3 -3
  22. package/dist/compat/transformers.test.mjs +5 -5
  23. package/dist/{context-C05Rgxmu.d.cts → context-B-dsBjZ9.d.cts} +281 -7
  24. package/dist/{context-Cjnr0ig1.d.ts → context-DrLXudbA.d.ts} +281 -7
  25. package/dist/{deno-DtHcfB0f.mjs → deno-Deyoxesx.mjs} +1 -1
  26. package/dist/{docloader-0vAfF6XW.mjs → docloader-B3kuDBg9.mjs} +2 -2
  27. package/dist/{esm-yYQfPhIY.mjs → esm-BHXXx4Wx.mjs} +13 -6
  28. package/dist/federation/builder.test.mjs +18 -5
  29. package/dist/federation/circuit-breaker.test.mjs +626 -7
  30. package/dist/federation/collection.test.mjs +3 -3
  31. package/dist/federation/handler.test.mjs +14 -13
  32. package/dist/federation/idempotency.test.mjs +6 -6
  33. package/dist/federation/inbox.test.mjs +3 -3
  34. package/dist/federation/keycache.test.mjs +5 -5
  35. package/dist/federation/kv.test.mjs +3 -3
  36. package/dist/federation/metrics.test.mjs +4 -4
  37. package/dist/federation/middleware.test.mjs +37 -28
  38. package/dist/federation/mod.cjs +18 -540
  39. package/dist/federation/mod.d.cts +3 -4
  40. package/dist/federation/mod.d.ts +3 -4
  41. package/dist/federation/mod.js +1 -1
  42. package/dist/federation/mq.test.mjs +32 -5
  43. package/dist/federation/negotiation.test.mjs +4 -4
  44. package/dist/federation/retry.test.mjs +3 -3
  45. package/dist/federation/router.test.mjs +7 -7
  46. package/dist/federation/send.test.mjs +28 -26
  47. package/dist/federation/tasks/codec.test.mjs +4 -4
  48. package/dist/federation/tasks/enqueue.test.mjs +4 -4
  49. package/dist/federation/tasks/tasks.test.mjs +6 -6
  50. package/dist/federation/temporal.test.mjs +4 -4
  51. package/dist/federation/webfinger.test.mjs +74 -12
  52. package/dist/{middleware-DzIUFRO2.cjs → federation-BzRjeOky.cjs} +855 -114
  53. package/dist/{temporal-polyfill-BCdTHexd.cjs → http-AyKngJ_h.cjs} +2801 -104
  54. package/dist/{http-BbnOMQoy.js → http-Bw6s_dOB.js} +3 -3
  55. package/dist/{http-DUmWq5Pw.mjs → http-TjhZfiSN.mjs} +5 -5
  56. package/dist/{key-CM7wDnZG.mjs → key-b4kf4yZT.mjs} +2 -2
  57. package/dist/{kv-cache-zmgG1HUp.cjs → kv-cache-BTVaZrf-.cjs} +2 -4
  58. package/dist/{kv-cache-ZQ22hm44.js → kv-cache-CQsh-KUw.js} +1 -1
  59. package/dist/{kv-cache-DEXKemJ9.mjs → kv-cache-CpILvhUV.mjs} +1 -1
  60. package/dist/{ld-BttH_-8K.mjs → ld-CKujkAfG.mjs} +5 -5
  61. package/dist/{metrics-DT-CnD1g.mjs → metrics-AlCGTDrr.mjs} +2 -2
  62. package/dist/metrics-DVKYY6K1.d.cts +36 -0
  63. package/dist/metrics-DoRtI0qU.d.ts +36 -0
  64. package/dist/{middleware-DrroX3aD.mjs → middleware-C9Y5lLZN.mjs} +60 -43
  65. package/dist/{middleware-D3IAVMcT.js → middleware-CZcuedl-.js} +241 -40
  66. package/dist/{middleware-ChlYS0Af.mjs → middleware-LPbZz6-1.mjs} +1 -1
  67. package/dist/{mod-BrpVsSfY.d.cts → mod-CLHkCwLm.d.cts} +3 -3
  68. package/dist/{mod-B0hW12_O.d.cts → mod-CuDDaIIt.d.cts} +1 -1
  69. package/dist/{mod-COIAjwRS.d.ts → mod-D-IhOEOP.d.ts} +1 -1
  70. package/dist/{mod-DdONo-ep.d.cts → mod-D-abvu2C.d.cts} +1 -1
  71. package/dist/{mod-BsCE5Ihq.d.ts → mod-D6O8C7eN.d.ts} +1 -1
  72. package/dist/{mod-CNef4in0.d.ts → mod-DypxPS9H.d.ts} +3 -3
  73. package/dist/mod.cjs +24 -25
  74. package/dist/mod.d.cts +8 -9
  75. package/dist/mod.d.ts +8 -9
  76. package/dist/mod.js +7 -7
  77. package/dist/nodeinfo/client.test.mjs +64 -4
  78. package/dist/nodeinfo/handler.test.mjs +5 -5
  79. package/dist/nodeinfo/mod.cjs +1 -1
  80. package/dist/nodeinfo/mod.d.cts +1 -1
  81. package/dist/nodeinfo/mod.d.ts +1 -1
  82. package/dist/nodeinfo/mod.js +1 -1
  83. package/dist/nodeinfo/types.test.mjs +4 -4
  84. package/dist/otel/exporter.test.mjs +3 -3
  85. package/dist/otel/mod.cjs +0 -1
  86. package/dist/otel/mod.d.cts +1 -1
  87. package/dist/otel/mod.d.ts +1 -1
  88. package/dist/{outgoing-jsonld-URuqsICz.mjs → outgoing-jsonld-BQSHRLhg.mjs} +2 -2
  89. package/dist/{owner-DZALmhdl.mjs → owner-D1O8v8FB.mjs} +2 -2
  90. package/dist/{proof-CqA-2nfW.js → proof-BTBolSnd.js} +6 -6
  91. package/dist/{proof-a60oVJ_4.cjs → proof-DcSm-2eG.cjs} +10 -11
  92. package/dist/{proof-DiQ0uBal.mjs → proof-DeMR7Akd.mjs} +6 -6
  93. package/dist/{public-audience-Cr5MsnMq.mjs → public-audience--9hx7IGx.mjs} +1 -1
  94. package/dist/runtime/mod.cjs +1 -1
  95. package/dist/runtime/mod.js +1 -1
  96. package/dist/{send-DcwZnQWG.mjs → send-DG7JG280.mjs} +3 -3
  97. package/dist/sig/accept.test.mjs +1 -1
  98. package/dist/sig/http.test.mjs +37 -11
  99. package/dist/sig/key.test.mjs +6 -6
  100. package/dist/sig/ld.test.mjs +9 -7
  101. package/dist/sig/mod.cjs +2 -2
  102. package/dist/sig/mod.d.cts +3 -3
  103. package/dist/sig/mod.d.ts +3 -3
  104. package/dist/sig/mod.js +2 -2
  105. package/dist/sig/owner.test.mjs +6 -6
  106. package/dist/sig/proof.test.mjs +10 -8
  107. package/dist/std__assert-CxFT0MNt.mjs +8 -0
  108. package/dist/{temporal-Bpxpsl2k.mjs → temporal-DA3jx8x1.mjs} +3 -3
  109. package/dist/testing/mod.d.mts +10 -0
  110. package/dist/testing/mod.mjs +2 -2
  111. package/dist/{testing-CO7ftO8A.mjs → testing-BX0Nicyq.mjs} +2 -2
  112. package/dist/{transformers-DGwl-hD1.cjs → transformers-BalCrSsr.cjs} +0 -1
  113. package/dist/{types-DC1pNgJA.js → types-Dtyf8lVj.js} +63 -5
  114. package/dist/{types-CPym83zc.cjs → types-RXm5YxpC.cjs} +62 -5
  115. package/dist/utils/docloader.test.mjs +7 -7
  116. package/dist/utils/kv-cache.test.mjs +1 -1
  117. package/dist/utils/mod.cjs +1 -1
  118. package/dist/utils/mod.d.cts +1 -1
  119. package/dist/utils/mod.d.ts +1 -1
  120. package/dist/utils/mod.js +1 -1
  121. package/package.json +7 -7
  122. package/skills/fedify/SKILL.md +462 -0
  123. package/dist/assert_rejects-EgstcQy5.mjs +0 -82
  124. package/dist/http-BpT5cE6r.cjs +0 -2694
  125. package/dist/metrics-DN13mCAw.d.cts +0 -294
  126. package/dist/metrics-v_e0n5GQ.d.ts +0 -294
  127. package/dist/std__assert-B2NnY9bq.mjs +0 -79
  128. /package/dist/{accept-8PiolDP7.mjs → accept-CPVqki78.mjs} +0 -0
  129. /package/dist/{activity-listener-BtTSxZWA.mjs → activity-listener-C-BSbKI7.mjs} +0 -0
  130. /package/dist/{assert_equals-BV7oLMxm.mjs → assert_equals-CBlRfA-_.mjs} +0 -0
  131. /package/dist/{client-CAM_bQXx.d.cts → client-D-XP_Ccb.d.cts} +0 -0
  132. /package/dist/{client-CSddvgWN.d.ts → client-D-XP_Ccb.d.ts} +0 -0
  133. /package/dist/{codec-BBga-FWI.mjs → codec-peqOdBaE.mjs} +0 -0
  134. /package/dist/{context-BJXxPElm.mjs → context-Dt36KFEJ.mjs} +0 -0
  135. /package/dist/{http-VyDTd4G3.d.cts → http-6TI0tI03.d.cts} +0 -0
  136. /package/dist/{http-lf8Hsd91.d.ts → http-CdrSn2ip.d.ts} +0 -0
  137. /package/dist/{keycache-_DHqz5z_.mjs → keycache-0Jk78XmB.mjs} +0 -0
  138. /package/dist/{keys-Dbyd7bhl.mjs → keys-DIJNHW-Y.mjs} +0 -0
  139. /package/dist/{kv-D6hNiMTK.d.ts → kv-BhNbN8Ed.d.cts} +0 -0
  140. /package/dist/{kv-gJ8LYbxX.d.cts → kv-BhNbN8Ed.d.ts} +0 -0
  141. /package/dist/{kv-CXBAok3k.mjs → kv-DCHkaJ9-.mjs} +0 -0
  142. /package/dist/{mq-Bo7Etgh6.mjs → mq-Dm1Wmtm-.mjs} +0 -0
  143. /package/dist/{negotiation-RuwrPFqi.mjs → negotiation-CCocWT_N.mjs} +0 -0
  144. /package/dist/{owner-CnngXDNJ.d.ts → owner-DGSfntI-.d.ts} +0 -0
  145. /package/dist/{owner-DEvZuyOE.d.cts → owner-r_waTiQj.d.cts} +0 -0
  146. /package/dist/{retry-DgFqeS5k.mjs → retry-zX5xw5e0.mjs} +0 -0
  147. /package/dist/{chunk-D5IdezsZ.js → rolldown-runtime-BC-Eo5Mj.js} +0 -0
  148. /package/dist/{chunk-Czpeue4M.cjs → rolldown-runtime-Dmm3t92W.cjs} +0 -0
  149. /package/dist/{transformers-DXze6FUB.js → transformers-DAtXl_Kc.js} +0 -0
  150. /package/dist/{types-CrtdVuDP.mjs → types-DE_LV1JB.mjs} +0 -0
@@ -1,542 +1,20 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("../chunk-Czpeue4M.cjs");
4
- const require_middleware = require("../middleware-DzIUFRO2.cjs");
5
- const require_temporal_polyfill = require("../temporal-polyfill-BCdTHexd.cjs");
6
- let _logtape_logtape = require("@logtape/logtape");
7
- let _fedify_uri_template = require("@fedify/uri-template");
8
- let es_toolkit = require("es-toolkit");
9
- //#region src/federation/kv.ts
10
- const Temporal$1 = require_temporal_polyfill.Temporal;
11
- /**
12
- * A key–value store that stores values in memory.
13
- * Do not use this in production as it does not persist values.
14
- *
15
- * @since 0.5.0
16
- */
17
- var MemoryKvStore = class {
18
- #values = {};
19
- #encodeKey(key) {
20
- return JSON.stringify(key);
21
- }
22
- /**
23
- * {@inheritDoc KvStore.get}
24
- */
25
- get(key) {
26
- const encodedKey = this.#encodeKey(key);
27
- const entry = this.#values[encodedKey];
28
- if (entry == null) return Promise.resolve(void 0);
29
- const [value, expiration] = entry;
30
- if (expiration != null && Temporal$1.Now.instant().until(expiration).sign < 0) {
31
- delete this.#values[encodedKey];
32
- return Promise.resolve(void 0);
33
- }
34
- return Promise.resolve(value);
35
- }
36
- /**
37
- * {@inheritDoc KvStore.set}
38
- */
39
- set(key, value, options) {
40
- const encodedKey = this.#encodeKey(key);
41
- const expiration = options?.ttl == null ? null : Temporal$1.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
42
- this.#values[encodedKey] = [value, expiration];
43
- return Promise.resolve();
44
- }
45
- /**
46
- * {@inheritDoc KvStore.delete}
47
- */
48
- delete(key) {
49
- const encodedKey = this.#encodeKey(key);
50
- delete this.#values[encodedKey];
51
- return Promise.resolve();
52
- }
53
- /**
54
- * {@inheritDoc KvStore.cas}
55
- */
56
- cas(key, expectedValue, newValue, options) {
57
- const encodedKey = this.#encodeKey(key);
58
- const entry = this.#values[encodedKey];
59
- let currentValue;
60
- if (entry == null) currentValue = void 0;
61
- else {
62
- const [value, expiration] = entry;
63
- if (expiration != null && Temporal$1.Now.instant().until(expiration).sign < 0) {
64
- delete this.#values[encodedKey];
65
- currentValue = void 0;
66
- } else currentValue = value;
67
- }
68
- if (!(0, es_toolkit.isEqual)(currentValue, expectedValue)) return Promise.resolve(false);
69
- const expiration = options?.ttl == null ? null : Temporal$1.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
70
- this.#values[encodedKey] = [newValue, expiration];
71
- return Promise.resolve(true);
72
- }
73
- /**
74
- * {@inheritDoc KvStore.list}
75
- */
76
- async *list(prefix) {
77
- const now = Temporal$1.Now.instant();
78
- for (const [encodedKey, entry] of Object.entries(this.#values)) {
79
- const key = JSON.parse(encodedKey);
80
- if (prefix != null) {
81
- if (key.length < prefix.length) continue;
82
- if (!prefix.every((p, i) => key[i] === p)) continue;
83
- }
84
- const [value, expiration] = entry;
85
- if (expiration != null && now.until(expiration).sign < 0) {
86
- delete this.#values[encodedKey];
87
- continue;
88
- }
89
- yield {
90
- key,
91
- value
92
- };
93
- }
94
- }
95
- };
96
- //#endregion
97
- //#region src/federation/mq.ts
98
- const Temporal = require_temporal_polyfill.Temporal;
99
- /**
100
- * A message queue that processes messages in the same process.
101
- * Do not use this in production as it does neither persist messages nor
102
- * distribute them across multiple processes.
103
- *
104
- * @since 0.5.0
105
- */
106
- var InProcessMessageQueue = class {
107
- #messages;
108
- #monitors;
109
- #pollIntervalMs;
110
- #delayedMessages;
111
- /**
112
- * Tracks which ordering keys are currently being processed to ensure
113
- * sequential processing for messages with the same key.
114
- */
115
- #processingKeys;
116
- /**
117
- * In-process message queue does not provide native retry mechanisms.
118
- * @since 1.7.0
119
- */
120
- nativeRetrial = false;
121
- /**
122
- * In-process message queue does not deduplicate messages natively.
123
- * @since 2.4.0
124
- */
125
- nativeDeduplication = false;
126
- /**
127
- * Constructs a new {@link InProcessMessageQueue} with the given options.
128
- * @param options Additional options for the in-process message queue.
129
- */
130
- constructor(options = {}) {
131
- this.#messages = [];
132
- this.#monitors = {};
133
- this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
134
- this.#delayedMessages = 0;
135
- this.#processingKeys = /* @__PURE__ */ new Set();
136
- }
137
- enqueue(message, options) {
138
- const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
139
- if (delay > 0) {
140
- this.#delayedMessages++;
141
- setTimeout(() => {
142
- this.#delayedMessages--;
143
- this.#enqueueReady(message, options);
144
- }, delay);
145
- return Promise.resolve();
146
- }
147
- this.#enqueueReady(message, options);
148
- return Promise.resolve();
149
- }
150
- #enqueueReady(message, options) {
151
- const orderingKey = options?.orderingKey ?? null;
152
- this.#messages.push({
153
- message,
154
- orderingKey
155
- });
156
- this.#notifyMonitors();
157
- }
158
- #notifyMonitors() {
159
- for (const monitorId in this.#monitors) this.#monitors[monitorId]();
160
- }
161
- enqueueMany(messages, options) {
162
- if (messages.length === 0) return Promise.resolve();
163
- const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
164
- if (delay > 0) {
165
- const delayedCount = messages.length;
166
- const deferredMessages = [...messages];
167
- this.#delayedMessages += delayedCount;
168
- setTimeout(() => {
169
- this.#delayedMessages -= delayedCount;
170
- this.#enqueueManyReady(deferredMessages, options);
171
- }, delay);
172
- return Promise.resolve();
173
- }
174
- this.#enqueueManyReady(messages, options);
175
- return Promise.resolve();
176
- }
177
- #enqueueManyReady(messages, options) {
178
- const orderingKey = options?.orderingKey ?? null;
179
- for (const message of messages) this.#messages.push({
180
- message,
181
- orderingKey
182
- });
183
- this.#notifyMonitors();
184
- }
185
- async listen(handler, options = {}) {
186
- const signal = options.signal;
187
- while (signal == null || !signal.aborted) {
188
- const idx = this.#messages.findIndex((m) => m.orderingKey == null || !this.#processingKeys.has(m.orderingKey));
189
- if (idx >= 0) {
190
- const { message, orderingKey } = this.#messages.splice(idx, 1)[0];
191
- if (orderingKey != null) this.#processingKeys.add(orderingKey);
192
- try {
193
- await handler(message);
194
- } finally {
195
- if (orderingKey != null) this.#processingKeys.delete(orderingKey);
196
- }
197
- } else if (this.#messages.length === 0) await this.#wait(this.#pollIntervalMs, signal);
198
- else await this.#wait(10, signal);
199
- }
200
- }
201
- getDepth() {
202
- const ready = this.#messages.length;
203
- const delayed = this.#delayedMessages;
204
- return Promise.resolve({
205
- queued: ready + delayed,
206
- ready,
207
- delayed
208
- });
209
- }
210
- #wait(ms, signal) {
211
- let timer = null;
212
- return Promise.any([new Promise((resolve) => {
213
- signal?.addEventListener("abort", () => {
214
- if (timer != null) clearTimeout(timer);
215
- resolve();
216
- }, { once: true });
217
- const monitorId = crypto.randomUUID();
218
- this.#monitors[monitorId] = () => {
219
- delete this.#monitors[monitorId];
220
- if (timer != null) clearTimeout(timer);
221
- resolve();
222
- };
223
- }), new Promise((resolve) => timer = setTimeout(resolve, ms))]);
224
- }
225
- };
226
- /**
227
- * A message queue that processes messages in parallel. It takes another
228
- * {@link MessageQueue}, and processes messages in parallel up to a certain
229
- * number of workers.
230
- *
231
- * Actually, it's rather a decorator than a queue itself.
232
- *
233
- * Note that the workers do not run in truly parallel, in the sense that they
234
- * are not running in separate threads or processes. They are running in the
235
- * same process, but are scheduled to run in parallel. Hence, this is useful
236
- * for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
237
- * workloads.
238
- *
239
- * When using `ParallelMessageQueue`, the ordering guarantee is preserved
240
- * *only if* the underlying queue implementation delivers messages in a wrapper
241
- * format that includes the `__fedify_ordering_key__` property. Currently,
242
- * only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
243
- * For other queue implementations (e.g., `InProcessMessageQueue`,
244
- * `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
245
- * `AmqpMessageQueue`), the ordering key cannot be detected by
246
- * `ParallelMessageQueue`, so ordering guarantees are handled by those
247
- * implementations directly rather than at the `ParallelMessageQueue` level.
248
- *
249
- * Messages with the same ordering key will never be processed concurrently
250
- * by different workers, ensuring sequential processing within each key.
251
- * Messages with different ordering keys (or no ordering key) can still be
252
- * processed in parallel.
253
- *
254
- * @since 1.0.0
255
- */
256
- var ParallelMessageQueue = class ParallelMessageQueue {
257
- queue;
258
- workers;
259
- /**
260
- * Inherits the native retry capability from the wrapped queue.
261
- * @since 1.7.0
262
- */
263
- nativeRetrial;
264
- /**
265
- * Inherits the native deduplication capability from the wrapped queue.
266
- * @since 2.4.0
267
- */
268
- nativeDeduplication;
269
- /**
270
- * Inherits the atomic batch capability from the wrapped queue.
271
- * @since 2.4.0
272
- */
273
- atomicEnqueueMany;
274
- getDepth;
275
- /**
276
- * Tracks which ordering keys are currently being processed to ensure
277
- * sequential processing for messages with the same key.
278
- */
279
- #processingKeys = /* @__PURE__ */ new Set();
280
- /**
281
- * Pending messages waiting for their ordering key to become available.
282
- */
283
- #pendingMessages = [];
284
- /**
285
- * Constructs a new {@link ParallelMessageQueue} with the given queue and
286
- * number of workers.
287
- * @param queue The message queue to use under the hood. Note that
288
- * {@link ParallelMessageQueue} cannot be nested.
289
- * @param workers The number of workers to process messages in parallel.
290
- * @throws {TypeError} If the given queue is an instance of
291
- * {@link ParallelMessageQueue}.
292
- */
293
- constructor(queue, workers) {
294
- if (queue instanceof ParallelMessageQueue) throw new TypeError("Cannot nest ParallelMessageQueue.");
295
- this.queue = queue;
296
- this.workers = workers;
297
- this.nativeRetrial = queue.nativeRetrial;
298
- this.nativeDeduplication = queue.nativeDeduplication;
299
- this.atomicEnqueueMany = queue.enqueueMany == null ? false : queue.atomicEnqueueMany;
300
- if (queue.getDepth != null) this.getDepth = () => queue.getDepth();
301
- }
302
- enqueue(message, options) {
303
- return this.queue.enqueue(message, options);
304
- }
305
- async enqueueMany(messages, options) {
306
- if (this.queue.enqueueMany == null) {
307
- if (messages.length === 1) {
308
- await this.queue.enqueue(messages[0], options);
309
- return;
310
- }
311
- if (options?.deduplicationKey != null) throw new TypeError("Cannot enqueue a batch with a deduplicationKey: the wrapped queue does not implement enqueueMany, so ParallelMessageQueue would have to fan out to individual enqueue() calls that cannot share one deduplicationKey atomically. Wrap a queue that implements enqueueMany instead.");
312
- const errors = (await Promise.allSettled(messages.map((message) => this.queue.enqueue(message, options)))).filter((r) => r.status === "rejected").map((r) => r.reason);
313
- if (errors.length > 1) throw new AggregateError(errors, "Failed to enqueue messages.");
314
- else if (errors.length === 1) throw errors[0];
315
- return;
316
- }
317
- await this.queue.enqueueMany(messages, options);
318
- }
319
- /**
320
- * Extracts ordering key from a message if present.
321
- *
322
- * This method only works for queue implementations that deliver messages
323
- * in the wrapper format with `__fedify_ordering_key__` property. Currently,
324
- * only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
325
- *
326
- * For other queue implementations (`InProcessMessageQueue`,
327
- * `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
328
- * `AmqpMessageQueue`), messages are delivered as raw payloads without the
329
- * wrapper, so the ordering key cannot be detected here. Those
330
- * implementations handle ordering guarantees internally.
331
- */
332
- #extractOrderingKey(message) {
333
- if (message != null && typeof message === "object") {
334
- if ("__fedify_ordering_key__" in message) return message.__fedify_ordering_key__;
335
- }
336
- }
337
- listen(handler, options = {}) {
338
- const workers = /* @__PURE__ */ new Map();
339
- return this.queue.listen(async (message) => {
340
- while (workers.size >= this.workers) {
341
- const consumedId = await Promise.any(workers.values());
342
- workers.delete(consumedId);
343
- }
344
- const workerId = crypto.randomUUID();
345
- const orderingKey = this.#extractOrderingKey(message);
346
- if (orderingKey != null && this.#processingKeys.has(orderingKey)) await new Promise((resolve) => {
347
- this.#pendingMessages.push({
348
- message,
349
- orderingKey,
350
- resolve
351
- });
352
- });
353
- if (orderingKey != null) this.#processingKeys.add(orderingKey);
354
- const promise = this.#work(workerId, handler, message, orderingKey);
355
- workers.set(workerId, promise);
356
- }, options);
357
- }
358
- async #work(workerId, handler, message, orderingKey) {
359
- await this.#sleep(0);
360
- try {
361
- await handler(message);
362
- } finally {
363
- if (orderingKey != null) {
364
- this.#processingKeys.delete(orderingKey);
365
- const pendingIdx = this.#pendingMessages.findIndex((p) => p.orderingKey === orderingKey);
366
- if (pendingIdx >= 0) this.#pendingMessages.splice(pendingIdx, 1)[0].resolve();
367
- }
368
- }
369
- return workerId;
370
- }
371
- #sleep(ms) {
372
- return new Promise((resolve) => setTimeout(resolve, ms));
373
- }
374
- };
375
- //#endregion
376
- //#region src/federation/router.ts
377
- const logger = (0, _logtape_logtape.getLogger)([
378
- "fedify",
379
- "federation",
380
- "router",
381
- "deprecated"
382
- ]);
383
- let deprecationWarned = false;
384
- function warnDeprecated() {
385
- if (deprecationWarned) return;
386
- deprecationWarned = true;
387
- logger.warn("The `Router` and `RouterError` classes from `@fedify/fedify` are deprecated. Please use `Router` from `@fedify/uri-template` instead.");
388
- }
389
- /**
390
- * URL router and constructor based on URI Template
391
- * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
392
- *
393
- * @deprecated Import `Router` from `@fedify/uri-template` instead. This class
394
- * remains only for compatibility with older Fedify code. The
395
- * `@fedify/uri-template` router is the replacement implementation
396
- * and should be used directly in new code.
397
- */
398
- var Router = class Router {
399
- #router;
400
- /**
401
- * Create a new {@link Router}.
402
- * @param options Options for the router.
403
- * @deprecated Use `new Router(options)` from `@fedify/uri-template`
404
- * instead.
405
- */
406
- constructor(options) {
407
- this.#router = convertRouterError(() => new _fedify_uri_template.Router(options));
408
- }
409
- /**
410
- * Whether to ignore trailing slashes when matching paths.
411
- * @deprecated Use `Router` from `@fedify/uri-template` instead. This
412
- * accessor forwards to the underlying `@fedify/uri-template`
413
- * router so that post-construction mutation keeps working as
414
- * in older Fedify code.
415
- */
416
- get trailingSlashInsensitive() {
417
- return this.#router.trailingSlashInsensitive;
418
- }
419
- set trailingSlashInsensitive(value) {
420
- this.#router.trailingSlashInsensitive = value;
421
- }
422
- /**
423
- * Clones this router.
424
- * @deprecated Use `Router` from `@fedify/uri-template` instead.
425
- */
426
- clone() {
427
- return convertRouterError(() => {
428
- const clone = new Router();
429
- clone.#router = this.#router.clone();
430
- return clone;
431
- });
432
- }
433
- /**
434
- * Checks if a path name exists in the router.
435
- * @param name The name of the path.
436
- * @returns `true` if the path name exists, otherwise `false`.
437
- * @deprecated Use `Router` from `@fedify/uri-template` instead.
438
- */
439
- has(name) {
440
- return convertRouterError(() => this.#router.has(name));
441
- }
442
- /**
443
- * Adds a new path rule to the router.
444
- * @param template The path pattern.
445
- * @param name The name of the path.
446
- * @returns The names of the variables in the path pattern.
447
- * @deprecated Use `Router` from `@fedify/uri-template` instead. In this
448
- * compatibility class, `add()` both registers the route and
449
- * returns the variables in the path pattern. In
450
- * `@fedify/uri-template`, these two responsibilities are split:
451
- * `router.add(template, name)` registers the route and returns
452
- * `void`, while the pure static method
453
- * `Router.variables(template)` returns the variable names. To
454
- * migrate, call `Router.variables(template)` when variables are
455
- * needed, then call `router.add(template, name)` to register the
456
- * route.
457
- */
458
- add(template, name) {
459
- return convertRouterError(() => {
460
- (0, _fedify_uri_template.assertPath)(template);
461
- this.#router.add(template, name);
462
- return _fedify_uri_template.Router.variables(template);
463
- });
464
- }
465
- /**
466
- * Resolves a path name and values from a URL, if any match.
467
- * @param url The URL to resolve.
468
- * @returns The name of the path and its values, if any match. Otherwise,
469
- * `null`.
470
- * @deprecated Use `Router` from `@fedify/uri-template` instead. Unlike the
471
- * stricter `@fedify/uri-template` router, this compatibility
472
- * method keeps the old Fedify 2.x contract of returning `null`
473
- * (rather than throwing) for inputs that are not router paths.
474
- */
475
- route(url) {
476
- return convertRouterError(() => {
477
- if (!(0, _fedify_uri_template.isPath)(url)) return null;
478
- return this.#router.route(url);
479
- });
480
- }
481
- /**
482
- * Constructs a URL/path from a path name and values.
483
- * @param name The name of the path.
484
- * @param values The values to expand the path with.
485
- * @returns The URL/path, if the name exists. Otherwise, `null`.
486
- * @deprecated Use `Router` from `@fedify/uri-template` instead.
487
- */
488
- build(name, values) {
489
- return convertRouterError(() => this.#router.build(name, values));
490
- }
491
- };
492
- /**
493
- * An error thrown by the {@link Router}.
494
- * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
495
- */
496
- var RouterError = class extends _fedify_uri_template.RouterError {
497
- /**
498
- * Treats every `RouterError` from `@fedify/uri-template` as an instance of
499
- * this deprecated class.
500
- *
501
- * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
502
- */
503
- static [Symbol.hasInstance](instance) {
504
- return instance instanceof _fedify_uri_template.RouterError;
505
- }
506
- /**
507
- * Create a new {@link RouterError}.
508
- * @param message The error message.
509
- * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
510
- */
511
- constructor(message) {
512
- super(message);
513
- warnDeprecated();
514
- }
515
- };
516
- function convertRouterError(func) {
517
- try {
518
- warnDeprecated();
519
- return func();
520
- } catch (error) {
521
- if (error instanceof _fedify_uri_template.RouterError) throw new RouterError(error.message);
522
- throw error;
523
- }
524
- }
525
- //#endregion
526
- exports.CircuitBreaker = require_middleware.CircuitBreaker;
527
- exports.InProcessMessageQueue = InProcessMessageQueue;
528
- exports.MemoryKvStore = MemoryKvStore;
529
- exports.ParallelMessageQueue = ParallelMessageQueue;
530
- exports.Router = Router;
531
- exports.RouterError = RouterError;
532
- exports.SendActivityError = require_middleware.SendActivityError;
533
- exports.buildCollectionSynchronizationHeader = require_middleware.buildCollectionSynchronizationHeader;
534
- exports.createExponentialBackoffPolicy = require_middleware.createExponentialBackoffPolicy;
535
- exports.createFederation = require_middleware.createFederation;
536
- exports.createFederationBuilder = require_middleware.createFederationBuilder;
537
- exports.digest = require_middleware.digest;
538
- exports.handleWebFinger = require_middleware.handleWebFinger;
539
- exports.normalizeCircuitBreakerOptions = require_middleware.normalizeCircuitBreakerOptions;
540
- exports.parseCircuitBreakerKvState = require_middleware.parseCircuitBreakerKvState;
541
- exports.respondWithObject = require_middleware.respondWithObject;
542
- exports.respondWithObjectIfAcceptable = require_middleware.respondWithObjectIfAcceptable;
3
+ const require_federation = require("../federation-BzRjeOky.cjs");
4
+ exports.CircuitBreaker = require_federation.CircuitBreaker;
5
+ exports.InProcessMessageQueue = require_federation.InProcessMessageQueue;
6
+ exports.MemoryKvStore = require_federation.MemoryKvStore;
7
+ exports.ParallelMessageQueue = require_federation.ParallelMessageQueue;
8
+ exports.Router = require_federation.Router;
9
+ exports.RouterError = require_federation.RouterError;
10
+ exports.SendActivityError = require_federation.SendActivityError;
11
+ exports.buildCollectionSynchronizationHeader = require_federation.buildCollectionSynchronizationHeader;
12
+ exports.createExponentialBackoffPolicy = require_federation.createExponentialBackoffPolicy;
13
+ exports.createFederation = require_federation.createFederation;
14
+ exports.createFederationBuilder = require_federation.createFederationBuilder;
15
+ exports.digest = require_federation.digest;
16
+ exports.handleWebFinger = require_federation.handleWebFinger;
17
+ exports.normalizeCircuitBreakerOptions = require_federation.normalizeCircuitBreakerOptions;
18
+ exports.parseCircuitBreakerKvState = require_federation.parseCircuitBreakerKvState;
19
+ exports.respondWithObject = require_federation.respondWithObject;
20
+ exports.respondWithObjectIfAcceptable = require_federation.respondWithObjectIfAcceptable;
@@ -1,6 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as CircuitBreakerCreateOptions, A as OutboxListenerSetters, At as UnverifiedActivityHandler, B as TaskEnqueueOptions, C as FederationStartQueueOptions, Ct as ObjectAuthorizePredicate, D as InboxListenerSetters, Dt as OutboxListenerErrorHandler, E as InboxChallengePolicy, Et as OutboxListener, F as createFederation, Ft as PageItems, G as RetryPolicy, H as TaskRegistry, I as Message, It as buildCollectionSynchronizationHeader, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as digest, M as FederationKvPrefixes, Mt as WebFingerLinksDispatcher, N as FederationOrigin, Nt as SendActivityError, O as MediaUploaderSetters, Ot as OutboxPermanentFailureHandler, P as FederationQueueOptions, Pt as SenderKeyPair, Q as CircuitBreakerBeforeSendDecision, R as TaskDefinition, S as FederationOptions, St as NodeInfoDispatcher, T as IdempotencyStrategy, Tt as OutboxErrorHandler, U as CreateExponentialBackoffPolicyOptions, V as TaskHandler, W as RetryContext, X as CircuitBreaker, Y as respondWithObjectIfAcceptable, Z as CircuitBreakerActivityDrop, _ as Federatable, _t as CustomCollectionCursor, a as GetSignedKeyOptions, at as NormalizedCircuitBreakerOptions, b as FederationBuilder, bt as InboxListener, c as ParseUriResult, ct as ActorAliasMapper, d as SendActivityOptions, dt as ActorKeyPairsDispatcher, et as CircuitBreakerFailurePolicy, f as SendActivityOptionsForCollection, ft as AuthorizePredicate, g as CustomCollectionCallbackSetters, gt as CustomCollectionCounter, h as ConstructorWithTypeId, ht as CollectionDispatcher, i as GetActorOptions, it as CircuitBreakerStateChange, j as Rfc6570Expression, jt as UnverifiedActivityReason, k as ObjectCallbackSetters, kt as SharedInboxKeyDispatcher, l as RequestContext, lt as ActorDispatcher, m as CollectionCallbackSetters, mt as CollectionCursor, n as Context, nt as CircuitBreakerOptions, o as InboxContext, ot as normalizeCircuitBreakerOptions, p as ActorCallbackSetters, pt as CollectionCounter, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreakerState, s as OutboxContext, st as parseCircuitBreakerKvState, t as ActorKeyPair, tt as CircuitBreakerKvState, u as RouteActivityOptions, ut as ActorHandleMapper, v as Federation, vt as CustomCollectionDispatcher, w as IdempotencyKeyCallback, wt as ObjectDispatcher, x as FederationFetchOptions, xt as MediaUploaderCallback, y as FederationBenchmarkOptions, yt as InboxErrorHandler, z as TaskDefinitionOptions } from "../context-C05Rgxmu.cjs";
3
- import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-gJ8LYbxX.cjs";
4
- import { a as MessageQueueDepth, c as ParallelMessageQueue, i as MessageQueue, n as InProcessMessageQueue, o as MessageQueueEnqueueOptions, r as InProcessMessageQueueOptions, s as MessageQueueListenOptions } from "../metrics-DN13mCAw.cjs";
5
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-DdONo-ep.cjs";
2
+ import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "../context-B-dsBjZ9.cjs";
3
+ import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-BhNbN8Ed.cjs";
4
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-D-abvu2C.cjs";
6
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as CircuitBreakerCreateOptions, A as OutboxListenerSetters, At as UnverifiedActivityHandler, B as TaskEnqueueOptions, C as FederationStartQueueOptions, Ct as ObjectAuthorizePredicate, D as InboxListenerSetters, Dt as OutboxListenerErrorHandler, E as InboxChallengePolicy, Et as OutboxListener, F as createFederation, Ft as PageItems, G as RetryPolicy, H as TaskRegistry, I as Message, It as buildCollectionSynchronizationHeader, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as digest, M as FederationKvPrefixes, Mt as WebFingerLinksDispatcher, N as FederationOrigin, Nt as SendActivityError, O as MediaUploaderSetters, Ot as OutboxPermanentFailureHandler, P as FederationQueueOptions, Pt as SenderKeyPair, Q as CircuitBreakerBeforeSendDecision, R as TaskDefinition, S as FederationOptions, St as NodeInfoDispatcher, T as IdempotencyStrategy, Tt as OutboxErrorHandler, U as CreateExponentialBackoffPolicyOptions, V as TaskHandler, W as RetryContext, X as CircuitBreaker, Y as respondWithObjectIfAcceptable, Z as CircuitBreakerActivityDrop, _ as Federatable, _t as CustomCollectionCursor, a as GetSignedKeyOptions, at as NormalizedCircuitBreakerOptions, b as FederationBuilder, bt as InboxListener, c as ParseUriResult, ct as ActorAliasMapper, d as SendActivityOptions, dt as ActorKeyPairsDispatcher, et as CircuitBreakerFailurePolicy, f as SendActivityOptionsForCollection, ft as AuthorizePredicate, g as CustomCollectionCallbackSetters, gt as CustomCollectionCounter, h as ConstructorWithTypeId, ht as CollectionDispatcher, i as GetActorOptions, it as CircuitBreakerStateChange, j as Rfc6570Expression, jt as UnverifiedActivityReason, k as ObjectCallbackSetters, kt as SharedInboxKeyDispatcher, l as RequestContext, lt as ActorDispatcher, m as CollectionCallbackSetters, mt as CollectionCursor, n as Context, nt as CircuitBreakerOptions, o as InboxContext, ot as normalizeCircuitBreakerOptions, p as ActorCallbackSetters, pt as CollectionCounter, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreakerState, s as OutboxContext, st as parseCircuitBreakerKvState, t as ActorKeyPair, tt as CircuitBreakerKvState, u as RouteActivityOptions, ut as ActorHandleMapper, v as Federation, vt as CustomCollectionDispatcher, w as IdempotencyKeyCallback, wt as ObjectDispatcher, x as FederationFetchOptions, xt as MediaUploaderCallback, y as FederationBenchmarkOptions, yt as InboxErrorHandler, z as TaskDefinitionOptions } from "../context-Cjnr0ig1.js";
3
- import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-D6hNiMTK.js";
4
- import { a as MessageQueueDepth, c as ParallelMessageQueue, i as MessageQueue, n as InProcessMessageQueue, o as MessageQueueEnqueueOptions, r as InProcessMessageQueueOptions, s as MessageQueueListenOptions } from "../metrics-v_e0n5GQ.js";
5
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-BsCE5Ihq.js";
2
+ import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "../context-DrLXudbA.js";
3
+ import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-BhNbN8Ed.js";
4
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-D6O8C7eN.js";
6
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "../middleware-D3IAVMcT.js";
3
+ import { a as respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "../middleware-CZcuedl-.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Router as Router$1, RouterError as RouterError$1, assertPath, isPath } from "@fedify/uri-template";
6
6
  import { isEqual } from "es-toolkit";
@@ -1,13 +1,40 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-BV7oLMxm.mjs";
5
- import { n as assertGreater } from "../std__assert-B2NnY9bq.mjs";
6
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-EgstcQy5.mjs";
7
- import { t as assert } from "../assert-CJ1KXcvv.mjs";
8
- import { n as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-Bo7Etgh6.mjs";
4
+ import { l as AssertionError, s as format, t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
5
+ import { t as assertFalse } from "../assert_false-3pLLLsO4.mjs";
6
+ import { t as assertGreaterOrEqual } from "../assert_greater_or_equal-BApOTh1h.mjs";
7
+ import "../std__assert-CxFT0MNt.mjs";
8
+ import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
9
+ import { t as assert } from "../assert-CebeUf0C.mjs";
10
+ import { n as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-Dm1Wmtm-.mjs";
9
11
  import { delay } from "es-toolkit";
10
12
  import { test } from "@fedify/fixture";
13
+ //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater.js
14
+ /**
15
+ * Make an assertion that `actual` is greater than `expected`.
16
+ * If not then throw.
17
+ *
18
+ * @example Usage
19
+ * ```ts no-eval
20
+ * import { assertGreater } from "@std/assert/assert-greater";
21
+ *
22
+ * assertGreater(2, 1); // Doesn't throw
23
+ * assertGreater(1, 1); // Throws
24
+ * assertGreater(0, 1); // Throws
25
+ * ```
26
+ *
27
+ * @typeParam T The type of the values to compare.
28
+ * @param actual The actual value to compare.
29
+ * @param expected The expected value to compare.
30
+ * @param msg The optional message to display if the assertion fails.
31
+ */ function assertGreater(actual, expected, msg) {
32
+ if (actual > expected) return;
33
+ const actualString = format(actual);
34
+ const expectedString = format(expected);
35
+ throw new AssertionError(msg ?? `Expect ${actualString} > ${expectedString}`);
36
+ }
37
+ //#endregion
11
38
  //#region src/federation/mq.test.ts
12
39
  async function disposeMessageQueue(mq) {
13
40
  if (Symbol.asyncDispose in mq) {