@fedify/fedify 2.4.0-dev.1567 → 2.4.0-dev.1570

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 (113) hide show
  1. package/README.md +4 -0
  2. package/dist/{assert-OguE97r2.mjs → assert-DvVHoIZ0.mjs} +1 -1
  3. package/dist/{assert_instance_of-DBC5X09g.mjs → assert_instance_of-CxoC8bVq.mjs} +1 -1
  4. package/dist/{assert_not_equals-DkVK8oqV.mjs → assert_not_equals-C8vcTTA3.mjs} +1 -1
  5. package/dist/{assert_rejects-DN60FHPX.mjs → assert_rejects-DAdaaIWM.mjs} +2 -2
  6. package/dist/{assert_strict_equals-XEgZAlrj.mjs → assert_strict_equals-BzqyKuYL.mjs} +1 -1
  7. package/dist/{assert_throws-BOkhLGYc.mjs → assert_throws-zN79lgIC.mjs} +1 -1
  8. package/dist/{builder-DGWCUaNQ.mjs → builder-CJnWbgbj.mjs} +23 -3
  9. package/dist/codec-nfBU4Up4.mjs +124 -0
  10. package/dist/compat/mod.d.cts +1 -1
  11. package/dist/compat/mod.d.ts +1 -1
  12. package/dist/compat/outgoing-jsonld.test.mjs +3 -3
  13. package/dist/compat/public-audience.test.mjs +3 -3
  14. package/dist/compat/transformers.test.mjs +5 -5
  15. package/dist/{context-DVoTs_wM.mjs → context-BBRTgkrs.mjs} +8 -2
  16. package/dist/{context-BBVLF7lx.d.cts → context-BLe0NPtZ.d.cts} +530 -259
  17. package/dist/{context-BU6jSQdo.d.ts → context-GfQA-CqB.d.ts} +529 -259
  18. package/dist/{deno-Dho0TW0X.mjs → deno-klNxGW7W.mjs} +1 -1
  19. package/dist/{docloader-DCQSgDOg.mjs → docloader-CuFH35j1.mjs} +3 -3
  20. package/dist/federation/builder.test.mjs +5 -5
  21. package/dist/federation/circuit-breaker.test.mjs +5 -5
  22. package/dist/federation/collection.test.mjs +3 -3
  23. package/dist/federation/handler.test.mjs +13 -23
  24. package/dist/federation/idempotency.test.mjs +6 -6
  25. package/dist/federation/inbox.test.mjs +3 -3
  26. package/dist/federation/keycache.test.mjs +5 -5
  27. package/dist/federation/kv.test.mjs +3 -3
  28. package/dist/federation/metrics.test.mjs +4 -4
  29. package/dist/federation/middleware.test.mjs +204 -19
  30. package/dist/federation/mod.cjs +3 -259
  31. package/dist/federation/mod.d.cts +4 -4
  32. package/dist/federation/mod.d.ts +4 -4
  33. package/dist/federation/mod.js +1 -257
  34. package/dist/federation/mq.test.mjs +103 -261
  35. package/dist/federation/negotiation.test.mjs +4 -4
  36. package/dist/federation/retry.test.mjs +3 -3
  37. package/dist/federation/router.test.mjs +5 -5
  38. package/dist/federation/send.test.mjs +10 -10
  39. package/dist/federation/tasks/codec.test.d.mts +2 -0
  40. package/dist/federation/tasks/codec.test.mjs +302 -0
  41. package/dist/federation/tasks/enqueue.test.d.mts +2 -0
  42. package/dist/federation/tasks/enqueue.test.mjs +1057 -0
  43. package/dist/federation/tasks/tasks.test.d.mts +2 -0
  44. package/dist/federation/tasks/tasks.test.mjs +1228 -0
  45. package/dist/federation/temporal.test.mjs +4 -4
  46. package/dist/federation/webfinger.test.mjs +6 -6
  47. package/dist/{http-sngIMb9S.js → http-D0jH0kco.js} +16 -80
  48. package/dist/{http-C7Lot0it.cjs → http-DeuPW1Oh.cjs} +14 -78
  49. package/dist/{http-Bf8YhWOi.mjs → http-JdRPUYku.mjs} +4 -4
  50. package/dist/{key-3rYgSl9f.mjs → key-o0_ipvUR.mjs} +10 -76
  51. package/dist/{kv-cache-CO2IaDJu.cjs → kv-cache-C3rqzQvu.cjs} +1 -1
  52. package/dist/{kv-cache-P3scUO6t.mjs → kv-cache-CM7w20U5.mjs} +1 -1
  53. package/dist/{kv-cache-B0siRaoZ.js → kv-cache-DSWq2JHU.js} +1 -1
  54. package/dist/{ld-CCOPy-Co.mjs → ld-C__CEgQH.mjs} +3 -3
  55. package/dist/{metrics-CR4UD_gF.mjs → metrics-CLSPm4dZ.mjs} +8 -6
  56. package/dist/{mq-D-nlpY04.d.ts → metrics-CoUJLQhZ.d.cts} +69 -1
  57. package/dist/{mq-D8uSFzxe.d.cts → metrics-Dc4jR-IC.d.ts} +69 -1
  58. package/dist/{middleware-DUelXs9h.cjs → middleware-B502nwxx.cjs} +874 -134
  59. package/dist/{middleware-CIteB8IS.mjs → middleware-CdMiavoh.mjs} +1 -1
  60. package/dist/{middleware-DfBPuuvp.mjs → middleware-CjHqy-1i.mjs} +469 -150
  61. package/dist/{middleware-BoNiH9CQ.js → middleware-zuLSkPIk.js} +863 -135
  62. package/dist/{mod-C0F6kvgS.d.cts → mod-B8Efb9qp.d.cts} +1 -1
  63. package/dist/{mod-yvIXFAEi.d.cts → mod-BtEaIEcD.d.cts} +1 -31
  64. package/dist/{mod-vPYVoa5n.d.ts → mod-Cmr39iWq.d.ts} +1 -1
  65. package/dist/{mod-DFvNJcNb.d.ts → mod-UMmveiO0.d.ts} +1 -31
  66. package/dist/mod.cjs +6 -6
  67. package/dist/mod.d.cts +6 -6
  68. package/dist/mod.d.ts +6 -6
  69. package/dist/mod.js +5 -5
  70. package/dist/mq-03vS-C9P.mjs +276 -0
  71. package/dist/nodeinfo/client.test.mjs +3 -3
  72. package/dist/nodeinfo/handler.test.mjs +5 -5
  73. package/dist/nodeinfo/types.test.mjs +4 -4
  74. package/dist/otel/exporter.test.mjs +3 -3
  75. package/dist/{outgoing-jsonld-L_DbOaFe.mjs → outgoing-jsonld-BNL8AC14.mjs} +1 -1
  76. package/dist/{owner-TUz_H-M9.mjs → owner-gz4TUfKG.mjs} +2 -2
  77. package/dist/{proof-DzKUmE7R.cjs → proof-CiDzRtr0.cjs} +1 -1
  78. package/dist/{proof-CrI3UpuA.mjs → proof-CuQpZ_AT.mjs} +5 -5
  79. package/dist/{proof-C5i7MhbD.js → proof-DQWTf6oB.js} +1 -1
  80. package/dist/{send-BBs_erdP.mjs → send-B60teucv.mjs} +3 -3
  81. package/dist/sig/accept.test.mjs +1 -1
  82. package/dist/sig/http.test.mjs +8 -8
  83. package/dist/sig/key.test.mjs +7 -191
  84. package/dist/sig/ld.test.mjs +7 -7
  85. package/dist/sig/mod.cjs +2 -2
  86. package/dist/sig/mod.js +2 -2
  87. package/dist/sig/owner.test.mjs +6 -6
  88. package/dist/sig/proof.test.mjs +9 -69
  89. package/dist/{std__assert-BBjXFNOb.mjs → std__assert-Dh6uLf_q.mjs} +4 -4
  90. package/dist/{temporal-bBIy2G-F.mjs → temporal-CvVMrvJJ.mjs} +1 -1
  91. package/dist/testing/mod.d.mts +1037 -8
  92. package/dist/testing/mod.mjs +3 -2
  93. package/dist/testing-Dy-WhqpN.mjs +77 -0
  94. package/dist/utils/docloader.test.mjs +6 -6
  95. package/dist/utils/kv-cache.test.mjs +1 -1
  96. package/dist/utils/mod.cjs +1 -1
  97. package/dist/utils/mod.d.cts +1 -1
  98. package/dist/utils/mod.d.ts +1 -1
  99. package/dist/utils/mod.js +1 -1
  100. package/package.json +8 -6
  101. /package/dist/{accept-CPkZzmGN.mjs → accept-CgDcxvjV.mjs} +0 -0
  102. /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
  103. /package/dist/{assert_equals-C-ZRDbaf.mjs → assert_equals-PBVKNMJd.mjs} +0 -0
  104. /package/dist/{circuit-breaker-CSWsyoef.mjs → circuit-breaker-hJBB6jwA.mjs} +0 -0
  105. /package/dist/{client-ByXmQhYD.mjs → client-B_A6mfn3.mjs} +0 -0
  106. /package/dist/{collection-Cc3DVAhE.mjs → collection-Dp5ky45w.mjs} +0 -0
  107. /package/dist/{keycache-BeU0LCII.mjs → keycache-CaOR6NYg.mjs} +0 -0
  108. /package/dist/{keys-DGu1NFwu.mjs → keys-CSYsOMFG.mjs} +0 -0
  109. /package/dist/{kv-rV3vodCc.mjs → kv-CIvR3Non.mjs} +0 -0
  110. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-m_L2nyS3.mjs} +0 -0
  111. /package/dist/{public-audience-Cvbr2Gzt.mjs → public-audience-c9zmYKgA.mjs} +0 -0
  112. /package/dist/{retry-CXg_MBI-.mjs → retry-DI4O-zYl.mjs} +0 -0
  113. /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
@@ -1,4 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
+ import { DocumentLoader } from "@fedify/vocab-runtime";
3
+ import { MeterProvider } from "@opentelemetry/api";
4
+
2
5
  //#region src/federation/mq.d.ts
3
6
  /**
4
7
  * Additional options for enqueuing a message in a queue.
@@ -24,6 +27,19 @@ interface MessageQueueEnqueueOptions {
24
27
  * @since 2.0.0
25
28
  */
26
29
  readonly orderingKey?: string;
30
+ /**
31
+ * An optional key requesting at-most-once enqueue semantics for messages
32
+ * that share it. A backend that declares
33
+ * {@link MessageQueue.nativeDeduplication} `true` owns the check: a message
34
+ * whose `deduplicationKey` was already seen within the backend's
35
+ * deduplication window is dropped instead of enqueued. Backends without
36
+ * native deduplication ignore this field; Fedify performs its own
37
+ * best-effort deduplication before reaching them on the paths that support
38
+ * it.
39
+ *
40
+ * @since 2.4.0
41
+ */
42
+ readonly deduplicationKey?: string;
27
43
  }
28
44
  /**
29
45
  * Additional options for listening to a message queue.
@@ -81,6 +97,17 @@ interface MessageQueue {
81
97
  */
82
98
  readonly nativeRetrial?: boolean;
83
99
  /**
100
+ * Whether the message queue backend deduplicates messages that share a
101
+ * {@link MessageQueueEnqueueOptions.deduplicationKey} natively. When `true`,
102
+ * Fedify forwards the `deduplicationKey` and relies on the backend to drop
103
+ * duplicates; when `false` or omitted, Fedify applies its own best-effort
104
+ * key–value deduplication on the paths that request it.
105
+ *
106
+ * @default `false`
107
+ * @since 2.4.0
108
+ */
109
+ readonly nativeDeduplication?: boolean;
110
+ /**
84
111
  * Enqueues a message in the queue.
85
112
  * @param message The message to enqueue.
86
113
  * @param options Additional options for enqueuing the message.
@@ -141,6 +168,11 @@ declare class InProcessMessageQueue implements MessageQueue {
141
168
  */
142
169
  readonly nativeRetrial = false;
143
170
  /**
171
+ * In-process message queue does not deduplicate messages natively.
172
+ * @since 2.4.0
173
+ */
174
+ readonly nativeDeduplication = false;
175
+ /**
144
176
  * Constructs a new {@link InProcessMessageQueue} with the given options.
145
177
  * @param options Additional options for the in-process message queue.
146
178
  */
@@ -189,6 +221,11 @@ declare class ParallelMessageQueue implements MessageQueue {
189
221
  * @since 1.7.0
190
222
  */
191
223
  readonly nativeRetrial?: boolean;
224
+ /**
225
+ * Inherits the native deduplication capability from the wrapped queue.
226
+ * @since 2.4.0
227
+ */
228
+ readonly nativeDeduplication?: boolean;
192
229
  readonly getDepth?: () => Promise<MessageQueueDepth>;
193
230
  /**
194
231
  * Constructs a new {@link ParallelMessageQueue} with the given queue and
@@ -205,4 +242,35 @@ declare class ParallelMessageQueue implements MessageQueue {
205
242
  listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
206
243
  }
207
244
  //#endregion
208
- export { MessageQueueEnqueueOptions as a, MessageQueueDepth as i, InProcessMessageQueueOptions as n, MessageQueueListenOptions as o, MessageQueue as r, ParallelMessageQueue as s, InProcessMessageQueue as t };
245
+ //#region src/federation/metrics.d.ts
246
+ /**
247
+ * The kind of remote ActivityPub lookup, recorded as
248
+ * `activitypub.lookup.kind` on the public-key lookup and remote document
249
+ * fetch metric families.
250
+ *
251
+ * - `public_key`: a public key lookup performed by `fetchKey` /
252
+ * `fetchKeyDetailed` (always recorded on `activitypub.key.lookup*`).
253
+ * - `actor`: a document fetch whose resolved value is an Actor. The
254
+ * bucket exists in the taxonomy for future actor-aware call sites;
255
+ * today, actor documents fetched through Fedify's generic document
256
+ * loader are still classified as `object` because the kind is decided
257
+ * at the loader boundary, before the response is parsed.
258
+ * - `object`: a generic ActivityPub object fetch through Fedify's
259
+ * document loader. This is the default classification for
260
+ * `documentLoader` invocations that do not match a more specific
261
+ * bucket.
262
+ * - `context`: a JSON-LD `@context` document fetch through Fedify's
263
+ * context loader.
264
+ * - `other`: a fetch that does not fit any of the above classifications.
265
+ * @since 2.3.0
266
+ */
267
+ type LookupKind = "public_key" | "actor" | "object" | "context" | "other";
268
+ /**
269
+ * The {@link LookupKind} values that can appear on remote document fetch
270
+ * metrics. `public_key` lookups are reported on the
271
+ * `activitypub.key.lookup` metric family instead, so it is excluded here.
272
+ * @since 2.3.0
273
+ */
274
+ type DocumentFetchKind = Exclude<LookupKind, "public_key">;
275
+ //#endregion
276
+ export { MessageQueueDepth as a, ParallelMessageQueue as c, MessageQueue as i, InProcessMessageQueue as n, MessageQueueEnqueueOptions as o, InProcessMessageQueueOptions as r, MessageQueueListenOptions as s, DocumentFetchKind as t };
@@ -1,4 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
+ import { MeterProvider } from "@opentelemetry/api";
3
+ import { DocumentLoader } from "@fedify/vocab-runtime";
4
+
2
5
  //#region src/federation/mq.d.ts
3
6
  /**
4
7
  * Additional options for enqueuing a message in a queue.
@@ -24,6 +27,19 @@ interface MessageQueueEnqueueOptions {
24
27
  * @since 2.0.0
25
28
  */
26
29
  readonly orderingKey?: string;
30
+ /**
31
+ * An optional key requesting at-most-once enqueue semantics for messages
32
+ * that share it. A backend that declares
33
+ * {@link MessageQueue.nativeDeduplication} `true` owns the check: a message
34
+ * whose `deduplicationKey` was already seen within the backend's
35
+ * deduplication window is dropped instead of enqueued. Backends without
36
+ * native deduplication ignore this field; Fedify performs its own
37
+ * best-effort deduplication before reaching them on the paths that support
38
+ * it.
39
+ *
40
+ * @since 2.4.0
41
+ */
42
+ readonly deduplicationKey?: string;
27
43
  }
28
44
  /**
29
45
  * Additional options for listening to a message queue.
@@ -81,6 +97,17 @@ interface MessageQueue {
81
97
  */
82
98
  readonly nativeRetrial?: boolean;
83
99
  /**
100
+ * Whether the message queue backend deduplicates messages that share a
101
+ * {@link MessageQueueEnqueueOptions.deduplicationKey} natively. When `true`,
102
+ * Fedify forwards the `deduplicationKey` and relies on the backend to drop
103
+ * duplicates; when `false` or omitted, Fedify applies its own best-effort
104
+ * key–value deduplication on the paths that request it.
105
+ *
106
+ * @default `false`
107
+ * @since 2.4.0
108
+ */
109
+ readonly nativeDeduplication?: boolean;
110
+ /**
84
111
  * Enqueues a message in the queue.
85
112
  * @param message The message to enqueue.
86
113
  * @param options Additional options for enqueuing the message.
@@ -141,6 +168,11 @@ declare class InProcessMessageQueue implements MessageQueue {
141
168
  */
142
169
  readonly nativeRetrial = false;
143
170
  /**
171
+ * In-process message queue does not deduplicate messages natively.
172
+ * @since 2.4.0
173
+ */
174
+ readonly nativeDeduplication = false;
175
+ /**
144
176
  * Constructs a new {@link InProcessMessageQueue} with the given options.
145
177
  * @param options Additional options for the in-process message queue.
146
178
  */
@@ -189,6 +221,11 @@ declare class ParallelMessageQueue implements MessageQueue {
189
221
  * @since 1.7.0
190
222
  */
191
223
  readonly nativeRetrial?: boolean;
224
+ /**
225
+ * Inherits the native deduplication capability from the wrapped queue.
226
+ * @since 2.4.0
227
+ */
228
+ readonly nativeDeduplication?: boolean;
192
229
  readonly getDepth?: () => Promise<MessageQueueDepth>;
193
230
  /**
194
231
  * Constructs a new {@link ParallelMessageQueue} with the given queue and
@@ -205,4 +242,35 @@ declare class ParallelMessageQueue implements MessageQueue {
205
242
  listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
206
243
  }
207
244
  //#endregion
208
- export { MessageQueueEnqueueOptions as a, MessageQueueDepth as i, InProcessMessageQueueOptions as n, MessageQueueListenOptions as o, MessageQueue as r, ParallelMessageQueue as s, InProcessMessageQueue as t };
245
+ //#region src/federation/metrics.d.ts
246
+ /**
247
+ * The kind of remote ActivityPub lookup, recorded as
248
+ * `activitypub.lookup.kind` on the public-key lookup and remote document
249
+ * fetch metric families.
250
+ *
251
+ * - `public_key`: a public key lookup performed by `fetchKey` /
252
+ * `fetchKeyDetailed` (always recorded on `activitypub.key.lookup*`).
253
+ * - `actor`: a document fetch whose resolved value is an Actor. The
254
+ * bucket exists in the taxonomy for future actor-aware call sites;
255
+ * today, actor documents fetched through Fedify's generic document
256
+ * loader are still classified as `object` because the kind is decided
257
+ * at the loader boundary, before the response is parsed.
258
+ * - `object`: a generic ActivityPub object fetch through Fedify's
259
+ * document loader. This is the default classification for
260
+ * `documentLoader` invocations that do not match a more specific
261
+ * bucket.
262
+ * - `context`: a JSON-LD `@context` document fetch through Fedify's
263
+ * context loader.
264
+ * - `other`: a fetch that does not fit any of the above classifications.
265
+ * @since 2.3.0
266
+ */
267
+ type LookupKind = "public_key" | "actor" | "object" | "context" | "other";
268
+ /**
269
+ * The {@link LookupKind} values that can appear on remote document fetch
270
+ * metrics. `public_key` lookups are reported on the
271
+ * `activitypub.key.lookup` metric family instead, so it is excluded here.
272
+ * @since 2.3.0
273
+ */
274
+ type DocumentFetchKind = Exclude<LookupKind, "public_key">;
275
+ //#endregion
276
+ export { MessageQueueDepth as a, ParallelMessageQueue as c, MessageQueue as i, InProcessMessageQueue as n, MessageQueueEnqueueOptions as o, InProcessMessageQueueOptions as r, MessageQueueListenOptions as s, DocumentFetchKind as t };