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

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 (104) hide show
  1. package/dist/{assert-OguE97r2.mjs → assert-DikXweDx.mjs} +1 -1
  2. package/dist/{assert_instance_of-DBC5X09g.mjs → assert_instance_of-C4Ri6VuN.mjs} +1 -1
  3. package/dist/{assert_not_equals-DkVK8oqV.mjs → assert_not_equals--wG9hV7u.mjs} +1 -1
  4. package/dist/{assert_rejects-DN60FHPX.mjs → assert_rejects-DQP-q39h.mjs} +2 -2
  5. package/dist/{assert_strict_equals-XEgZAlrj.mjs → assert_strict_equals-Dmjbg-bA.mjs} +1 -1
  6. package/dist/{assert_throws-BOkhLGYc.mjs → assert_throws-4NwKEy2q.mjs} +1 -1
  7. package/dist/{builder-CU98OOiD.mjs → builder-Gef_ZeDE.mjs} +23 -3
  8. package/dist/codec-Bf-rTqks.mjs +94 -0
  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-DVoTs_wM.mjs → context-BrIOaBSs.mjs} +7 -1
  15. package/dist/{context-BBVLF7lx.d.cts → context-BuGH_Vft.d.cts} +286 -70
  16. package/dist/{context-BU6jSQdo.d.ts → context-CLtZxCu6.d.ts} +285 -70
  17. package/dist/{deno-Dhn909W6.mjs → deno-BmD7XRaO.mjs} +1 -1
  18. package/dist/{docloader-CX8Auxrr.mjs → docloader-B8AJowCx.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 +200 -19
  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 +5 -260
  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/tasks/codec.test.d.mts +2 -0
  39. package/dist/federation/tasks/codec.test.mjs +292 -0
  40. package/dist/federation/tasks/tasks.test.d.mts +2 -0
  41. package/dist/federation/tasks/tasks.test.mjs +651 -0
  42. package/dist/federation/temporal.test.mjs +4 -4
  43. package/dist/federation/webfinger.test.mjs +6 -6
  44. package/dist/{http-CsSSDB5j.cjs → http-BCSQJ_gv.cjs} +1 -1
  45. package/dist/{http-DndWw3Rs.js → http-CJ0WNyqA.js} +1 -1
  46. package/dist/{http-iapcKTk-.mjs → http-GQoPA_YT.mjs} +4 -4
  47. package/dist/{key-b17Uu8wX.mjs → key-BLy_TeTg.mjs} +2 -2
  48. package/dist/{kv-cache-CLo3nRjl.js → kv-cache-CjEcb9qH.js} +1 -1
  49. package/dist/{kv-cache-BIngyLxt.cjs → kv-cache-DXwu7BtY.cjs} +1 -1
  50. package/dist/{kv-cache-DcsWACki.mjs → kv-cache-pw-kBdVz.mjs} +1 -1
  51. package/dist/{ld-B1503hdI.mjs → ld-CWgxPlZq.mjs} +3 -3
  52. package/dist/{metrics-DSV9HQUk.mjs → metrics-DUKoLd_E.mjs} +1 -1
  53. package/dist/{middleware-DT5sfJam.js → middleware-2Us0G3Iy.js} +277 -10
  54. package/dist/{middleware-DA8JjaXv.cjs → middleware-BiCk4wGY.cjs} +277 -10
  55. package/dist/{middleware-Bb9gR5Ro.mjs → middleware-Dq-HhJHd.mjs} +1 -1
  56. package/dist/{middleware-Dh1xDMbI.mjs → middleware-PZaroDUk.mjs} +182 -23
  57. package/dist/{mod-C0F6kvgS.d.cts → mod-DRokcHeU.d.cts} +1 -1
  58. package/dist/{mod-vPYVoa5n.d.ts → mod-r-1xOW_C.d.ts} +1 -1
  59. package/dist/mod.cjs +4 -4
  60. package/dist/mod.d.cts +4 -4
  61. package/dist/mod.d.ts +4 -4
  62. package/dist/mod.js +4 -4
  63. package/dist/mq-CvJAzRz5.mjs +260 -0
  64. package/dist/nodeinfo/client.test.mjs +3 -3
  65. package/dist/nodeinfo/handler.test.mjs +5 -5
  66. package/dist/nodeinfo/types.test.mjs +4 -4
  67. package/dist/otel/exporter.test.mjs +3 -3
  68. package/dist/{outgoing-jsonld-L_DbOaFe.mjs → outgoing-jsonld-BgFLCJQ_.mjs} +1 -1
  69. package/dist/{owner-PCw-OkL0.mjs → owner-U0Z8Ex6i.mjs} +2 -2
  70. package/dist/{proof-CJCLdaV3.cjs → proof-DA3hLGSO.cjs} +1 -1
  71. package/dist/{proof-BhbSD4bP.js → proof-f7K32nz7.js} +1 -1
  72. package/dist/{proof-Dacxh41h.mjs → proof-nb5tfciW.mjs} +5 -5
  73. package/dist/{send-Cdsbc_Vj.mjs → send-CLfW5Fdf.mjs} +3 -3
  74. package/dist/sig/accept.test.mjs +1 -1
  75. package/dist/sig/http.test.mjs +8 -8
  76. package/dist/sig/key.test.mjs +6 -6
  77. package/dist/sig/ld.test.mjs +7 -7
  78. package/dist/sig/mod.cjs +2 -2
  79. package/dist/sig/mod.js +2 -2
  80. package/dist/sig/owner.test.mjs +6 -6
  81. package/dist/sig/proof.test.mjs +8 -8
  82. package/dist/{std__assert-BBjXFNOb.mjs → std__assert-BTEgfoJo.mjs} +4 -4
  83. package/dist/{temporal-BMMqjhOp.mjs → temporal-2ry_jdCK.mjs} +1 -1
  84. package/dist/testing/mod.d.mts +378 -7
  85. package/dist/testing/mod.mjs +3 -2
  86. package/dist/testing-CjYPStvE.mjs +55 -0
  87. package/dist/utils/docloader.test.mjs +6 -6
  88. package/dist/utils/kv-cache.test.mjs +1 -1
  89. package/dist/utils/mod.cjs +1 -1
  90. package/dist/utils/mod.js +1 -1
  91. package/package.json +9 -7
  92. /package/dist/{accept-CPkZzmGN.mjs → accept-CceiKpCy.mjs} +0 -0
  93. /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
  94. /package/dist/{assert_equals-C-ZRDbaf.mjs → assert_equals-Ew3jOFa3.mjs} +0 -0
  95. /package/dist/{circuit-breaker-CSWsyoef.mjs → circuit-breaker-hJBB6jwA.mjs} +0 -0
  96. /package/dist/{client-ByXmQhYD.mjs → client-B_A6mfn3.mjs} +0 -0
  97. /package/dist/{collection-Cc3DVAhE.mjs → collection-Dp5ky45w.mjs} +0 -0
  98. /package/dist/{keycache-BeU0LCII.mjs → keycache-CaOR6NYg.mjs} +0 -0
  99. /package/dist/{keys-DGu1NFwu.mjs → keys-C3kae-6B.mjs} +0 -0
  100. /package/dist/{kv-rV3vodCc.mjs → kv-x2IvBUyq.mjs} +0 -0
  101. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-m_L2nyS3.mjs} +0 -0
  102. /package/dist/{public-audience-Cvbr2Gzt.mjs → public-audience-N3pyOx2p.mjs} +0 -0
  103. /package/dist/{retry-CXg_MBI-.mjs → retry-DI4O-zYl.mjs} +0 -0
  104. /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
@@ -0,0 +1,260 @@
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ //#region src/federation/mq.ts
5
+ /**
6
+ * A message queue that processes messages in the same process.
7
+ * Do not use this in production as it does neither persist messages nor
8
+ * distribute them across multiple processes.
9
+ *
10
+ * @since 0.5.0
11
+ */
12
+ var InProcessMessageQueue = class {
13
+ #messages;
14
+ #monitors;
15
+ #pollIntervalMs;
16
+ #delayedMessages;
17
+ /**
18
+ * Tracks which ordering keys are currently being processed to ensure
19
+ * sequential processing for messages with the same key.
20
+ */
21
+ #processingKeys;
22
+ /**
23
+ * In-process message queue does not provide native retry mechanisms.
24
+ * @since 1.7.0
25
+ */
26
+ nativeRetrial = false;
27
+ /**
28
+ * Constructs a new {@link InProcessMessageQueue} with the given options.
29
+ * @param options Additional options for the in-process message queue.
30
+ */
31
+ constructor(options = {}) {
32
+ this.#messages = [];
33
+ this.#monitors = {};
34
+ this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
35
+ this.#delayedMessages = 0;
36
+ this.#processingKeys = /* @__PURE__ */ new Set();
37
+ }
38
+ enqueue(message, options) {
39
+ const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
40
+ if (delay > 0) {
41
+ this.#delayedMessages++;
42
+ setTimeout(() => {
43
+ this.#delayedMessages--;
44
+ this.#enqueueReady(message, options);
45
+ }, delay);
46
+ return Promise.resolve();
47
+ }
48
+ this.#enqueueReady(message, options);
49
+ return Promise.resolve();
50
+ }
51
+ #enqueueReady(message, options) {
52
+ const orderingKey = options?.orderingKey ?? null;
53
+ this.#messages.push({
54
+ message,
55
+ orderingKey
56
+ });
57
+ this.#notifyMonitors();
58
+ }
59
+ #notifyMonitors() {
60
+ for (const monitorId in this.#monitors) this.#monitors[monitorId]();
61
+ }
62
+ enqueueMany(messages, options) {
63
+ if (messages.length === 0) return Promise.resolve();
64
+ const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
65
+ if (delay > 0) {
66
+ const delayedCount = messages.length;
67
+ const deferredMessages = [...messages];
68
+ this.#delayedMessages += delayedCount;
69
+ setTimeout(() => {
70
+ this.#delayedMessages -= delayedCount;
71
+ this.#enqueueManyReady(deferredMessages, options);
72
+ }, delay);
73
+ return Promise.resolve();
74
+ }
75
+ this.#enqueueManyReady(messages, options);
76
+ return Promise.resolve();
77
+ }
78
+ #enqueueManyReady(messages, options) {
79
+ const orderingKey = options?.orderingKey ?? null;
80
+ for (const message of messages) this.#messages.push({
81
+ message,
82
+ orderingKey
83
+ });
84
+ this.#notifyMonitors();
85
+ }
86
+ async listen(handler, options = {}) {
87
+ const signal = options.signal;
88
+ while (signal == null || !signal.aborted) {
89
+ const idx = this.#messages.findIndex((m) => m.orderingKey == null || !this.#processingKeys.has(m.orderingKey));
90
+ if (idx >= 0) {
91
+ const { message, orderingKey } = this.#messages.splice(idx, 1)[0];
92
+ if (orderingKey != null) this.#processingKeys.add(orderingKey);
93
+ try {
94
+ await handler(message);
95
+ } finally {
96
+ if (orderingKey != null) this.#processingKeys.delete(orderingKey);
97
+ }
98
+ } else if (this.#messages.length === 0) await this.#wait(this.#pollIntervalMs, signal);
99
+ else await this.#wait(10, signal);
100
+ }
101
+ }
102
+ getDepth() {
103
+ const ready = this.#messages.length;
104
+ const delayed = this.#delayedMessages;
105
+ return Promise.resolve({
106
+ queued: ready + delayed,
107
+ ready,
108
+ delayed
109
+ });
110
+ }
111
+ #wait(ms, signal) {
112
+ let timer = null;
113
+ return Promise.any([new Promise((resolve) => {
114
+ signal?.addEventListener("abort", () => {
115
+ if (timer != null) clearTimeout(timer);
116
+ resolve();
117
+ }, { once: true });
118
+ const monitorId = crypto.randomUUID();
119
+ this.#monitors[monitorId] = () => {
120
+ delete this.#monitors[monitorId];
121
+ if (timer != null) clearTimeout(timer);
122
+ resolve();
123
+ };
124
+ }), new Promise((resolve) => timer = setTimeout(resolve, ms))]);
125
+ }
126
+ };
127
+ /**
128
+ * A message queue that processes messages in parallel. It takes another
129
+ * {@link MessageQueue}, and processes messages in parallel up to a certain
130
+ * number of workers.
131
+ *
132
+ * Actually, it's rather a decorator than a queue itself.
133
+ *
134
+ * Note that the workers do not run in truly parallel, in the sense that they
135
+ * are not running in separate threads or processes. They are running in the
136
+ * same process, but are scheduled to run in parallel. Hence, this is useful
137
+ * for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
138
+ * workloads.
139
+ *
140
+ * When using `ParallelMessageQueue`, the ordering guarantee is preserved
141
+ * *only if* the underlying queue implementation delivers messages in a wrapper
142
+ * format that includes the `__fedify_ordering_key__` property. Currently,
143
+ * only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
144
+ * For other queue implementations (e.g., `InProcessMessageQueue`,
145
+ * `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
146
+ * `AmqpMessageQueue`), the ordering key cannot be detected by
147
+ * `ParallelMessageQueue`, so ordering guarantees are handled by those
148
+ * implementations directly rather than at the `ParallelMessageQueue` level.
149
+ *
150
+ * Messages with the same ordering key will never be processed concurrently
151
+ * by different workers, ensuring sequential processing within each key.
152
+ * Messages with different ordering keys (or no ordering key) can still be
153
+ * processed in parallel.
154
+ *
155
+ * @since 1.0.0
156
+ */
157
+ var ParallelMessageQueue = class ParallelMessageQueue {
158
+ queue;
159
+ workers;
160
+ /**
161
+ * Inherits the native retry capability from the wrapped queue.
162
+ * @since 1.7.0
163
+ */
164
+ nativeRetrial;
165
+ getDepth;
166
+ /**
167
+ * Tracks which ordering keys are currently being processed to ensure
168
+ * sequential processing for messages with the same key.
169
+ */
170
+ #processingKeys = /* @__PURE__ */ new Set();
171
+ /**
172
+ * Pending messages waiting for their ordering key to become available.
173
+ */
174
+ #pendingMessages = [];
175
+ /**
176
+ * Constructs a new {@link ParallelMessageQueue} with the given queue and
177
+ * number of workers.
178
+ * @param queue The message queue to use under the hood. Note that
179
+ * {@link ParallelMessageQueue} cannot be nested.
180
+ * @param workers The number of workers to process messages in parallel.
181
+ * @throws {TypeError} If the given queue is an instance of
182
+ * {@link ParallelMessageQueue}.
183
+ */
184
+ constructor(queue, workers) {
185
+ if (queue instanceof ParallelMessageQueue) throw new TypeError("Cannot nest ParallelMessageQueue.");
186
+ this.queue = queue;
187
+ this.workers = workers;
188
+ this.nativeRetrial = queue.nativeRetrial;
189
+ if (queue.getDepth != null) this.getDepth = () => queue.getDepth();
190
+ }
191
+ enqueue(message, options) {
192
+ return this.queue.enqueue(message, options);
193
+ }
194
+ async enqueueMany(messages, options) {
195
+ if (this.queue.enqueueMany == null) {
196
+ const errors = (await Promise.allSettled(messages.map((message) => this.queue.enqueue(message, options)))).filter((r) => r.status === "rejected").map((r) => r.reason);
197
+ if (errors.length > 1) throw new AggregateError(errors, "Failed to enqueue messages.");
198
+ else if (errors.length === 1) throw errors[0];
199
+ return;
200
+ }
201
+ await this.queue.enqueueMany(messages, options);
202
+ }
203
+ /**
204
+ * Extracts ordering key from a message if present.
205
+ *
206
+ * This method only works for queue implementations that deliver messages
207
+ * in the wrapper format with `__fedify_ordering_key__` property. Currently,
208
+ * only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
209
+ *
210
+ * For other queue implementations (`InProcessMessageQueue`,
211
+ * `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
212
+ * `AmqpMessageQueue`), messages are delivered as raw payloads without the
213
+ * wrapper, so the ordering key cannot be detected here. Those
214
+ * implementations handle ordering guarantees internally.
215
+ */
216
+ #extractOrderingKey(message) {
217
+ if (message != null && typeof message === "object") {
218
+ if ("__fedify_ordering_key__" in message) return message.__fedify_ordering_key__;
219
+ }
220
+ }
221
+ listen(handler, options = {}) {
222
+ const workers = /* @__PURE__ */ new Map();
223
+ return this.queue.listen(async (message) => {
224
+ while (workers.size >= this.workers) {
225
+ const consumedId = await Promise.any(workers.values());
226
+ workers.delete(consumedId);
227
+ }
228
+ const workerId = crypto.randomUUID();
229
+ const orderingKey = this.#extractOrderingKey(message);
230
+ if (orderingKey != null && this.#processingKeys.has(orderingKey)) await new Promise((resolve) => {
231
+ this.#pendingMessages.push({
232
+ message,
233
+ orderingKey,
234
+ resolve
235
+ });
236
+ });
237
+ if (orderingKey != null) this.#processingKeys.add(orderingKey);
238
+ const promise = this.#work(workerId, handler, message, orderingKey);
239
+ workers.set(workerId, promise);
240
+ }, options);
241
+ }
242
+ async #work(workerId, handler, message, orderingKey) {
243
+ await this.#sleep(0);
244
+ try {
245
+ await handler(message);
246
+ } finally {
247
+ if (orderingKey != null) {
248
+ this.#processingKeys.delete(orderingKey);
249
+ const pendingIdx = this.#pendingMessages.findIndex((p) => p.orderingKey === orderingKey);
250
+ if (pendingIdx >= 0) this.#pendingMessages.splice(pendingIdx, 1)[0].resolve();
251
+ }
252
+ }
253
+ return workerId;
254
+ }
255
+ #sleep(ms) {
256
+ return new Promise((resolve) => setTimeout(resolve, ms));
257
+ }
258
+ };
259
+ //#endregion
260
+ export { ParallelMessageQueue as n, InProcessMessageQueue as t };
@@ -2,9 +2,9 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-vrlUxr60.mjs";
5
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
- import "../std__assert-BBjXFNOb.mjs";
7
- import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-ByXmQhYD.mjs";
5
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
+ import "../std__assert-BTEgfoJo.mjs";
7
+ import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-B_A6mfn3.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/nodeinfo/client.test.ts
10
10
  test("getNodeInfo()", async (t) => {
@@ -1,11 +1,11 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { r as createRequestContext } from "../context-DVoTs_wM.mjs";
5
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
- import "../std__assert-BBjXFNOb.mjs";
7
- import { t as MemoryKvStore } from "../kv-rV3vodCc.mjs";
8
- import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-Dh1xDMbI.mjs";
4
+ import { r as createRequestContext } from "../context-BrIOaBSs.mjs";
5
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
+ import "../std__assert-BTEgfoJo.mjs";
7
+ import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
8
+ import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-PZaroDUk.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,10 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
6
- import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
7
- import { t as nodeInfoToJson } from "../types-J53Kw7so.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-BTEgfoJo.mjs";
6
+ import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
+ import { t as nodeInfoToJson } from "../types-BFowWFTT.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/nodeinfo/types.test.ts
10
10
  test("nodeInfoToJson()", () => {
@@ -1,9 +1,9 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
6
- import { t as MemoryKvStore } from "../kv-rV3vodCc.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-BTEgfoJo.mjs";
6
+ import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { ExportResultCode } from "@opentelemetry/core";
9
9
  import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-Cvbr2Gzt.mjs";
4
+ import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-N3pyOx2p.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
7
  import jsonld from "@fedify/vocab-runtime/jsonld";
@@ -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-Dhn909W6.mjs";
5
- import "./key-b17Uu8wX.mjs";
4
+ import { n as version, t as name } from "./deno-BmD7XRaO.mjs";
5
+ import "./key-BLy_TeTg.mjs";
6
6
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-CsSSDB5j.cjs");
4
+ const require_http = require("./http-BCSQJ_gv.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _fedify_vocab = require("@fedify/vocab");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-DndWw3Rs.js";
3
+ import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-CJ0WNyqA.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, PUBLIC_COLLECTION, getTypeId, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,11 +1,11 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Dhn909W6.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DSV9HQUk.mjs";
6
- import { n as fetchKey, o as validateCryptoKey } from "./key-b17Uu8wX.mjs";
7
- import { n as preloadedOnlyDocumentLoader } from "./public-audience-Cvbr2Gzt.mjs";
8
- import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-L_DbOaFe.mjs";
4
+ import { n as version, t as name } from "./deno-BmD7XRaO.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DUKoLd_E.mjs";
6
+ import { n as fetchKey, o as validateCryptoKey } from "./key-BLy_TeTg.mjs";
7
+ import { n as preloadedOnlyDocumentLoader } from "./public-audience-N3pyOx2p.mjs";
8
+ import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-BgFLCJQ_.mjs";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
11
11
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,9 +1,9 @@
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-Dhn909W6.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics } from "./metrics-DSV9HQUk.mjs";
6
- import { n as doubleKnock } from "./http-iapcKTk-.mjs";
4
+ import { n as version, t as name } from "./deno-BmD7XRaO.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics } from "./metrics-DUKoLd_E.mjs";
6
+ import { n as doubleKnock } from "./http-GQoPA_YT.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { FetchError } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature, t as formatAcceptSignature } from "../accept-CPkZzmGN.mjs";
4
+ import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature, t as formatAcceptSignature } from "../accept-CceiKpCy.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, strictEqual } from "node:assert/strict";
7
7
  //#region src/sig/accept.test.ts
@@ -2,14 +2,14 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-vrlUxr60.mjs";
5
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
- import { r as assertExists, t as assertStringIncludes } from "../std__assert-BBjXFNOb.mjs";
7
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
8
- import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
9
- import { t as assert } from "../assert-OguE97r2.mjs";
10
- import { t as exportJwk } from "../key-b17Uu8wX.mjs";
11
- import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-iapcKTk-.mjs";
12
- import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DGu1NFwu.mjs";
5
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
+ import { r as assertExists, t as assertStringIncludes } from "../std__assert-BTEgfoJo.mjs";
7
+ import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
8
+ import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
9
+ import { t as assert } from "../assert-DikXweDx.mjs";
10
+ import { t as exportJwk } from "../key-BLy_TeTg.mjs";
11
+ import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-GQoPA_YT.mjs";
12
+ import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-C3kae-6B.mjs";
13
13
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
15
15
  import { encodeBase64 } from "byte-encodings/base64";
@@ -1,12 +1,12 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
6
- import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
- import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
8
- import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-b17Uu8wX.mjs";
9
- import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-BTEgfoJo.mjs";
6
+ import { t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
7
+ import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
+ import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-BLy_TeTg.mjs";
9
+ import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
10
10
  import { CryptographicKey, Multikey } from "@fedify/vocab";
11
11
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { FetchError } from "@fedify/vocab-runtime";
@@ -1,13 +1,13 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
6
- import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
7
- import { t as assert } from "../assert-OguE97r2.mjs";
8
- import { i as generateCryptoKeyPair } from "../key-b17Uu8wX.mjs";
9
- import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
10
- import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-B1503hdI.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
6
+ import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
+ import { t as assert } from "../assert-DikXweDx.mjs";
8
+ import { i as generateCryptoKeyPair } from "../key-BLy_TeTg.mjs";
9
+ import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
10
+ import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-CWgxPlZq.mjs";
11
11
  import { CryptographicKey } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
package/dist/sig/mod.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_http = require("../http-CsSSDB5j.cjs");
5
- const require_proof = require("../proof-CJCLdaV3.cjs");
4
+ const require_http = require("../http-BCSQJ_gv.cjs");
5
+ const require_proof = require("../proof-DA3hLGSO.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-DndWw3Rs.js";
4
- import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-BhbSD4bP.js";
3
+ import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-CJ0WNyqA.js";
4
+ import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-f7K32nz7.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
@@ -1,12 +1,12 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
6
- import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
7
- import { t as assert } from "../assert-OguE97r2.mjs";
8
- import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DGu1NFwu.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-PCw-OkL0.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-BTEgfoJo.mjs";
6
+ import { r as assertFalse } from "../assert_rejects-DQP-q39h.mjs";
7
+ import { t as assert } from "../assert-DikXweDx.mjs";
8
+ import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-C3kae-6B.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-U0Z8Ex6i.mjs";
10
10
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
11
11
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region src/sig/owner.test.ts
@@ -1,14 +1,14 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
6
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
- import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
8
- import { t as assert } from "../assert-OguE97r2.mjs";
9
- import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
10
- import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-L_DbOaFe.mjs";
11
- import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-Dacxh41h.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-BTEgfoJo.mjs";
6
+ import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
7
+ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
8
+ import { t as assert } from "../assert-DikXweDx.mjs";
9
+ import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
10
+ import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-BgFLCJQ_.mjs";
11
+ import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-nb5tfciW.mjs";
12
12
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
13
13
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -1,10 +1,10 @@
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-C-ZRDbaf.mjs";
5
- import "./assert_rejects-DN60FHPX.mjs";
6
- import "./assert_throws-BOkhLGYc.mjs";
7
- import "./assert_strict_equals-XEgZAlrj.mjs";
4
+ import { l as AssertionError, s as format } from "./assert_equals-Ew3jOFa3.mjs";
5
+ import "./assert_rejects-DQP-q39h.mjs";
6
+ import "./assert_throws-4NwKEy2q.mjs";
7
+ import "./assert_strict_equals-Dmjbg-bA.mjs";
8
8
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
9
9
  /**
10
10
  * Make an assertion that actual is not null or undefined.
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-B1503hdI.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-CWgxPlZq.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {