@fedify/fedify 2.3.0-dev.1119 → 2.3.0-dev.1131

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 (68) hide show
  1. package/dist/{builder-Ond_h57y.mjs → builder-DckAhD27.mjs} +2 -2
  2. package/dist/compat/mod.d.cts +1 -1
  3. package/dist/compat/mod.d.ts +1 -1
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{context-cSUMk2da.d.ts → context-Cq18Gplu.d.ts} +3 -208
  6. package/dist/{context-Ch-ZLyTQ.d.cts → context-tc6VOOOL.d.cts} +3 -208
  7. package/dist/{deno-DVsHS7rA.mjs → deno--CS-SBS9.mjs} +1 -1
  8. package/dist/{docloader-WsWfKaE5.mjs → docloader-k6huZLQL.mjs} +2 -2
  9. package/dist/federation/builder.test.mjs +1 -1
  10. package/dist/federation/handler.test.mjs +2 -2
  11. package/dist/federation/idempotency.test.mjs +2 -2
  12. package/dist/federation/metrics.test.mjs +229 -1
  13. package/dist/federation/middleware.test.mjs +64 -6
  14. package/dist/federation/mod.cjs +1 -1
  15. package/dist/federation/mod.d.cts +3 -2
  16. package/dist/federation/mod.d.ts +3 -2
  17. package/dist/federation/mod.js +1 -1
  18. package/dist/federation/send.test.mjs +3 -3
  19. package/dist/federation/webfinger.test.mjs +1 -1
  20. package/dist/{http-CubOB9wq.cjs → http-CJfvRL7D.cjs} +263 -19
  21. package/dist/{http-DUV8ysti.mjs → http-IywnQdiX.mjs} +7 -5
  22. package/dist/{http-D6LP89UO.d.ts → http-VyDTd4G3.d.cts} +8 -1
  23. package/dist/{http-CouJSFVK.js → http-cqujdCRz.js} +252 -20
  24. package/dist/{http-D6aw3j2U.d.cts → http-lf8Hsd91.d.ts} +8 -1
  25. package/dist/{key-BoWaYRHm.mjs → key-Df3tMleh.mjs} +42 -17
  26. package/dist/{kv-cache-Dz31ATUT.cjs → kv-cache-L0SMQkcd.cjs} +19 -2
  27. package/dist/{kv-cache-DBNpsneh.js → kv-cache-pEejzYq4.js} +19 -2
  28. package/dist/{kv-cache-DihufyAQ.mjs → kv-cache-q9Ec2ryS.mjs} +19 -1
  29. package/dist/{ld-B5K1mSuG.mjs → ld-BGwiJpl3.mjs} +3 -3
  30. package/dist/{metrics-C4attqv0.mjs → metrics-BTOMkW8C.mjs} +209 -2
  31. package/dist/{middleware-CmsDtIHI.cjs → middleware-B2rtdpFV.cjs} +45 -17
  32. package/dist/{middleware-t0jC8I99.mjs → middleware-BB0IbDow.mjs} +54 -26
  33. package/dist/{middleware-BDKFRjue.mjs → middleware-Dnql59Y8.mjs} +1 -1
  34. package/dist/{middleware-Dtjz-hSk.js → middleware-DtOddSVg.js} +45 -17
  35. package/dist/{mod-BDhgfjP7.d.cts → mod-B0hW12_O.d.cts} +1 -1
  36. package/dist/{mod-B-Lin9Sy.d.ts → mod-COIAjwRS.d.ts} +1 -1
  37. package/dist/{mod-C6E8rkcz.d.ts → mod-CajNYYkt.d.ts} +1 -1
  38. package/dist/{mod-DLrRb0dx.d.ts → mod-DFvNJcNb.d.ts} +54 -3
  39. package/dist/{mod-P9tE2WmM.d.cts → mod-DnzgcPcy.d.cts} +1 -1
  40. package/dist/{mod-BR_BB0bh.d.cts → mod-yvIXFAEi.d.cts} +54 -3
  41. package/dist/mod.cjs +4 -4
  42. package/dist/mod.d.cts +6 -5
  43. package/dist/mod.d.ts +6 -5
  44. package/dist/mod.js +4 -4
  45. package/dist/mq-D-nlpY04.d.ts +208 -0
  46. package/dist/mq-D8uSFzxe.d.cts +208 -0
  47. package/dist/nodeinfo/handler.test.mjs +1 -1
  48. package/dist/{owner-hDxI0ufu.mjs → owner-CIt4hvmM.mjs} +2 -2
  49. package/dist/{proof-BUWfVr6Q.cjs → proof-B1_u25UV.cjs} +1 -1
  50. package/dist/{proof-DhVuz4bc.mjs → proof-BYlrRSmZ.mjs} +3 -3
  51. package/dist/{proof-n60t8o9P.js → proof-DMGIjHYH.js} +1 -1
  52. package/dist/{send-BPhyR5Oo.mjs → send-DJFpze7B.mjs} +3 -3
  53. package/dist/sig/http.test.mjs +6 -2
  54. package/dist/sig/key.test.mjs +99 -2
  55. package/dist/sig/ld.test.mjs +2 -2
  56. package/dist/sig/mod.cjs +2 -2
  57. package/dist/sig/mod.d.cts +2 -2
  58. package/dist/sig/mod.d.ts +2 -2
  59. package/dist/sig/mod.js +2 -2
  60. package/dist/sig/owner.test.mjs +1 -1
  61. package/dist/sig/proof.test.mjs +1 -1
  62. package/dist/utils/docloader.test.mjs +2 -2
  63. package/dist/utils/kv-cache.test.mjs +67 -2
  64. package/dist/utils/mod.cjs +1 -1
  65. package/dist/utils/mod.d.cts +1 -1
  66. package/dist/utils/mod.d.ts +1 -1
  67. package/dist/utils/mod.js +1 -1
  68. package/package.json +6 -6
@@ -3,8 +3,10 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-BTEgfoJo.mjs";
6
- import { c as recordOutboxActivity, l as recordOutboxEnqueue, o as recordFanoutRecipients, s as recordInboxActivity } from "../metrics-C4attqv0.mjs";
6
+ import { t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
7
+ import { a as instrumentDocumentLoader, c as recordDocumentCache, d as recordInboxActivity, f as recordKeyLookup, l as recordDocumentFetch, m as recordOutboxEnqueue, p as recordOutboxActivity, t as classifyFetchError, u as recordFanoutRecipients } from "../metrics-BTOMkW8C.mjs";
7
8
  import { createTestMeterProvider, test } from "@fedify/fixture";
9
+ import { FetchError } from "@fedify/vocab-runtime";
8
10
  //#region src/federation/metrics.test.ts
9
11
  const noopQueue = {
10
12
  enqueue() {
@@ -103,5 +105,231 @@ test("recordOutboxActivity() records counter with result and activity type", ()
103
105
  "abandoned"
104
106
  ]);
105
107
  });
108
+ test("recordKeyLookup() records counter and duration with all attributes", () => {
109
+ const [meterProvider, recorder] = createTestMeterProvider();
110
+ recordKeyLookup(meterProvider, {
111
+ durationMs: 42,
112
+ result: "fetched",
113
+ remoteUrl: new URL("https://example.com/users/alice#main-key"),
114
+ cacheEnabled: true,
115
+ statusCode: 200
116
+ });
117
+ const counters = recorder.getMeasurements("activitypub.key.lookup");
118
+ assertEquals(counters.length, 1);
119
+ assertEquals(counters[0].type, "counter");
120
+ assertEquals(counters[0].value, 1);
121
+ assertEquals(counters[0].attributes["activitypub.lookup.kind"], "public_key");
122
+ assertEquals(counters[0].attributes["activitypub.lookup.result"], "fetched");
123
+ assertEquals(counters[0].attributes["activitypub.remote.host"], "example.com");
124
+ assertEquals(counters[0].attributes["activitypub.cache.enabled"], true);
125
+ assertEquals(counters[0].attributes["http.response.status_code"], 200);
126
+ const durations = recorder.getMeasurements("activitypub.key.lookup.duration");
127
+ assertEquals(durations.length, 1);
128
+ assertEquals(durations[0].type, "histogram");
129
+ assertEquals(durations[0].value, 42);
130
+ assertEquals(durations[0].attributes["activitypub.lookup.kind"], "public_key");
131
+ assertEquals(durations[0].attributes["activitypub.lookup.result"], "fetched");
132
+ assertEquals(durations[0].attributes["activitypub.remote.host"], "example.com");
133
+ assertEquals(durations[0].attributes["activitypub.cache.enabled"], true);
134
+ assertEquals(durations[0].attributes["http.response.status_code"], 200);
135
+ });
136
+ test("recordKeyLookup() omits optional attributes when not provided", () => {
137
+ const [meterProvider, recorder] = createTestMeterProvider();
138
+ recordKeyLookup(meterProvider, {
139
+ durationMs: 0,
140
+ result: "error",
141
+ cacheEnabled: false
142
+ });
143
+ const counter = recorder.getMeasurement("activitypub.key.lookup");
144
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "error");
145
+ assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
146
+ assertEquals("activitypub.remote.host" in counter.attributes, false);
147
+ assertEquals("http.response.status_code" in counter.attributes, false);
148
+ const duration = recorder.getMeasurement("activitypub.key.lookup.duration");
149
+ assertEquals("activitypub.remote.host" in duration.attributes, false);
150
+ assertEquals("http.response.status_code" in duration.attributes, false);
151
+ });
152
+ test("recordDocumentFetch() records counter and duration with all attributes", () => {
153
+ const [meterProvider, recorder] = createTestMeterProvider();
154
+ recordDocumentFetch(meterProvider, {
155
+ durationMs: 123,
156
+ kind: "object",
157
+ result: "not_found",
158
+ remoteUrl: new URL("https://remote.test/objects/123"),
159
+ cacheEnabled: true,
160
+ statusCode: 404
161
+ });
162
+ const counter = recorder.getMeasurement("activitypub.document.fetch");
163
+ assertEquals(counter?.type, "counter");
164
+ assertEquals(counter?.value, 1);
165
+ assertEquals(counter?.attributes["activitypub.lookup.kind"], "object");
166
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "not_found");
167
+ assertEquals(counter?.attributes["activitypub.remote.host"], "remote.test");
168
+ assertEquals(counter?.attributes["activitypub.cache.enabled"], true);
169
+ assertEquals(counter?.attributes["http.response.status_code"], 404);
170
+ const duration = recorder.getMeasurement("activitypub.document.fetch.duration");
171
+ assertEquals(duration?.type, "histogram");
172
+ assertEquals(duration?.value, 123);
173
+ assertEquals(duration?.attributes["activitypub.lookup.kind"], "object");
174
+ assertEquals(duration?.attributes["activitypub.lookup.result"], "not_found");
175
+ });
176
+ test("recordDocumentFetch() omits optional attributes when not provided", () => {
177
+ const [meterProvider, recorder] = createTestMeterProvider();
178
+ recordDocumentFetch(meterProvider, {
179
+ durationMs: 5,
180
+ kind: "context",
181
+ result: "fetched"
182
+ });
183
+ const counter = recorder.getMeasurement("activitypub.document.fetch");
184
+ assertEquals(counter?.attributes["activitypub.lookup.kind"], "context");
185
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "fetched");
186
+ assertEquals("activitypub.remote.host" in counter.attributes, false);
187
+ assertEquals("activitypub.cache.enabled" in counter.attributes, false);
188
+ assertEquals("http.response.status_code" in counter.attributes, false);
189
+ assertEquals(recorder.getMeasurement("activitypub.document.fetch.duration")?.value, 5);
190
+ });
191
+ test("recordDocumentCache() records hit and miss as a counter", () => {
192
+ const [meterProvider, recorder] = createTestMeterProvider();
193
+ recordDocumentCache(meterProvider, {
194
+ kind: "object",
195
+ result: "hit",
196
+ remoteUrl: new URL("https://remote.test/objects/1")
197
+ });
198
+ recordDocumentCache(meterProvider, {
199
+ kind: "context",
200
+ result: "miss",
201
+ remoteUrl: new URL("https://w3id.org/security/v1")
202
+ });
203
+ const measurements = recorder.getMeasurements("activitypub.document.cache");
204
+ assertEquals(measurements.length, 2);
205
+ for (const m of measurements) {
206
+ assertEquals(m.type, "counter");
207
+ assertEquals(m.value, 1);
208
+ }
209
+ assertEquals(measurements[0].attributes["activitypub.lookup.kind"], "object");
210
+ assertEquals(measurements[0].attributes["activitypub.lookup.result"], "hit");
211
+ assertEquals(measurements[0].attributes["activitypub.remote.host"], "remote.test");
212
+ assertEquals(measurements[1].attributes["activitypub.lookup.kind"], "context");
213
+ assertEquals(measurements[1].attributes["activitypub.lookup.result"], "miss");
214
+ assertEquals(measurements[1].attributes["activitypub.remote.host"], "w3id.org");
215
+ });
216
+ test("classifyFetchError() classifies FetchError with 404 as not_found", () => {
217
+ assertEquals(classifyFetchError(new FetchError("https://example.com/k", "not found", new Response("", { status: 404 }))), {
218
+ result: "not_found",
219
+ statusCode: 404
220
+ });
221
+ });
222
+ test("classifyFetchError() classifies FetchError with 410 as not_found", () => {
223
+ assertEquals(classifyFetchError(new FetchError("https://example.com/k", "gone", new Response("", { status: 410 }))), {
224
+ result: "not_found",
225
+ statusCode: 410
226
+ });
227
+ });
228
+ test("classifyFetchError() classifies FetchError with 500 as error", () => {
229
+ assertEquals(classifyFetchError(new FetchError("https://example.com/k", "server error", new Response("", { status: 500 }))), {
230
+ result: "error",
231
+ statusCode: 500
232
+ });
233
+ });
234
+ test("classifyFetchError() classifies FetchError without response as network_error", () => {
235
+ assertEquals(classifyFetchError(new FetchError("https://example.com/k", "boom")), { result: "network_error" });
236
+ });
237
+ test("classifyFetchError() classifies a bare TypeError as network_error", () => {
238
+ assertEquals(classifyFetchError(/* @__PURE__ */ new TypeError("connect failed")), { result: "network_error" });
239
+ });
240
+ test("classifyFetchError() classifies an AbortError as network_error", () => {
241
+ const abort = /* @__PURE__ */ new Error("aborted");
242
+ abort.name = "AbortError";
243
+ assertEquals(classifyFetchError(abort), { result: "network_error" });
244
+ });
245
+ test("classifyFetchError() classifies any other thrown value as error", () => {
246
+ assertEquals(classifyFetchError(/* @__PURE__ */ new Error("nope")), { result: "error" });
247
+ assertEquals(classifyFetchError("string error"), { result: "error" });
248
+ assertEquals(classifyFetchError(void 0), { result: "error" });
249
+ });
250
+ test("instrumentDocumentLoader() records fetched on success", async () => {
251
+ const [meterProvider, recorder] = createTestMeterProvider();
252
+ const inner = (url) => Promise.resolve({
253
+ contextUrl: null,
254
+ documentUrl: url,
255
+ document: { ok: true }
256
+ });
257
+ assertEquals((await instrumentDocumentLoader(inner, {
258
+ meterProvider,
259
+ kind: "object",
260
+ cacheEnabled: true
261
+ })("https://example.com/o")).document, { ok: true });
262
+ const counter = recorder.getMeasurement("activitypub.document.fetch");
263
+ assertEquals(counter?.attributes["activitypub.lookup.kind"], "object");
264
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "fetched");
265
+ assertEquals(counter?.attributes["activitypub.remote.host"], "example.com");
266
+ assertEquals(counter?.attributes["activitypub.cache.enabled"], true);
267
+ assertEquals("http.response.status_code" in counter.attributes, false);
268
+ const duration = recorder.getMeasurement("activitypub.document.fetch.duration");
269
+ assertEquals(duration?.type, "histogram");
270
+ assertEquals(duration?.attributes["activitypub.lookup.result"], "fetched");
271
+ });
272
+ test("instrumentDocumentLoader() records not_found on FetchError 404", async () => {
273
+ const [meterProvider, recorder] = createTestMeterProvider();
274
+ const inner = (url) => Promise.reject(new FetchError(url, "HTTP 404", new Response("", { status: 404 })));
275
+ const wrapped = instrumentDocumentLoader(inner, {
276
+ meterProvider,
277
+ kind: "context",
278
+ cacheEnabled: false
279
+ });
280
+ await assertRejects(() => wrapped("https://example.com/missing"), FetchError);
281
+ const counter = recorder.getMeasurement("activitypub.document.fetch");
282
+ assertEquals(counter?.attributes["activitypub.lookup.kind"], "context");
283
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "not_found");
284
+ assertEquals(counter?.attributes["activitypub.remote.host"], "example.com");
285
+ assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
286
+ assertEquals(counter?.attributes["http.response.status_code"], 404);
287
+ });
288
+ test("instrumentDocumentLoader() records network_error on TypeError", async () => {
289
+ const [meterProvider, recorder] = createTestMeterProvider();
290
+ const inner = () => Promise.reject(/* @__PURE__ */ new TypeError("fetch failed"));
291
+ const wrapped = instrumentDocumentLoader(inner, {
292
+ meterProvider,
293
+ kind: "object"
294
+ });
295
+ await assertRejects(() => wrapped("https://example.com/o"), TypeError);
296
+ const counter = recorder.getMeasurement("activitypub.document.fetch");
297
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "network_error");
298
+ assertEquals("activitypub.cache.enabled" in counter.attributes, false);
299
+ });
300
+ test("instrumentDocumentLoader() returns inner loader unchanged when meterProvider is omitted", async () => {
301
+ const [, recorder] = createTestMeterProvider();
302
+ let callCount = 0;
303
+ const inner = (url) => {
304
+ callCount++;
305
+ return Promise.resolve({
306
+ contextUrl: null,
307
+ documentUrl: url,
308
+ document: { ok: true }
309
+ });
310
+ };
311
+ const wrapped = instrumentDocumentLoader(inner, { kind: "object" });
312
+ assertEquals(wrapped, inner);
313
+ await wrapped("https://example.com/o");
314
+ assertEquals(callCount, 1);
315
+ assertEquals(recorder.getMeasurements("activitypub.document.fetch").length, 0);
316
+ assertEquals(recorder.getMeasurements("activitypub.document.fetch.duration").length, 0);
317
+ });
318
+ test("instrumentDocumentLoader() omits remote.host when URL is unparseable", async () => {
319
+ const [meterProvider, recorder] = createTestMeterProvider();
320
+ const inner = (url) => Promise.resolve({
321
+ contextUrl: null,
322
+ documentUrl: url,
323
+ document: {}
324
+ });
325
+ await instrumentDocumentLoader(inner, {
326
+ meterProvider,
327
+ kind: "other"
328
+ })("not a url");
329
+ const counter = recorder.getMeasurement("activitypub.document.fetch");
330
+ assertEquals(counter?.attributes["activitypub.lookup.kind"], "other");
331
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "fetched");
332
+ assertEquals("activitypub.remote.host" in counter.attributes, false);
333
+ });
106
334
  //#endregion
107
335
  export {};
@@ -11,14 +11,14 @@ import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
11
11
  import { t as assertStrictEquals } from "../assert_strict_equals-Dmjbg-bA.mjs";
12
12
  import { t as assert } from "../assert-DikXweDx.mjs";
13
13
  import { t as esm_default } from "../esm-sdtqOUPu.mjs";
14
- import { l as verifyRequest, s as signRequest } from "../http-DUV8ysti.mjs";
14
+ import { l as verifyRequest, s as signRequest } from "../http-IywnQdiX.mjs";
15
15
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
16
- import { t as getAuthenticatedDocumentLoader } from "../docloader-WsWfKaE5.mjs";
17
- import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-B5K1mSuG.mjs";
18
- import { t as doesActorOwnKey } from "../owner-hDxI0ufu.mjs";
19
- import { i as verifyObject, r as signObject } from "../proof-DhVuz4bc.mjs";
16
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-k6huZLQL.mjs";
17
+ import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-BGwiJpl3.mjs";
18
+ import { t as doesActorOwnKey } from "../owner-CIt4hvmM.mjs";
19
+ import { i as verifyObject, r as signObject } from "../proof-BYlrRSmZ.mjs";
20
20
  import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
21
- import { i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-t0jC8I99.mjs";
21
+ import { i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-BB0IbDow.mjs";
22
22
  import { configure, reset } from "@logtape/logtape";
23
23
  import * as vocab from "@fedify/vocab";
24
24
  import { getTypeId, lookupObject } from "@fedify/vocab";
@@ -4129,5 +4129,63 @@ test("KvSpecDeterminer", async (t) => {
4129
4129
  assertEquals(spec, "rfc9421");
4130
4130
  });
4131
4131
  });
4132
+ test("createFederation() instruments documentLoader with activitypub.document.fetch", async () => {
4133
+ const [meterProvider, recorder] = createTestMeterProvider();
4134
+ await createFederation({
4135
+ kv: new MemoryKvStore(),
4136
+ meterProvider,
4137
+ documentLoaderFactory: () => mockDocumentLoader,
4138
+ contextLoaderFactory: () => mockDocumentLoader
4139
+ }).createContext(new URL("https://example.com/"), void 0).documentLoader("https://example.com/object");
4140
+ const counters = recorder.getMeasurements("activitypub.document.fetch");
4141
+ assertEquals(counters.length, 1);
4142
+ assertEquals(counters[0].attributes["activitypub.lookup.kind"], "object");
4143
+ assertEquals(counters[0].attributes["activitypub.lookup.result"], "fetched");
4144
+ assertEquals(counters[0].attributes["activitypub.remote.host"], "example.com");
4145
+ assertFalse("activitypub.cache.enabled" in counters[0].attributes);
4146
+ });
4147
+ test("createFederation() records kind=context on contextLoader fetches", async () => {
4148
+ const [meterProvider, recorder] = createTestMeterProvider();
4149
+ await createFederation({
4150
+ kv: new MemoryKvStore(),
4151
+ meterProvider,
4152
+ documentLoaderFactory: () => mockDocumentLoader,
4153
+ contextLoaderFactory: () => mockDocumentLoader
4154
+ }).createContext(new URL("https://example.com/"), void 0).contextLoader("https://example.com/object");
4155
+ const counters = recorder.getMeasurements("activitypub.document.fetch");
4156
+ assertEquals(counters.length, 1);
4157
+ assertEquals(counters[0].attributes["activitypub.lookup.kind"], "context");
4158
+ });
4159
+ test("createFederation() forwards DocumentLoaderFactoryOptions to a user-supplied authenticatedDocumentLoaderFactory", () => {
4160
+ const kv = new MemoryKvStore();
4161
+ const seen = [];
4162
+ createFederation({
4163
+ kv,
4164
+ authenticatedDocumentLoaderFactory: (_identity, opts) => {
4165
+ seen.push(opts);
4166
+ return mockDocumentLoader;
4167
+ }
4168
+ }).authenticatedDocumentLoaderFactory({
4169
+ keyId: new URL("https://example.com/users/alice#main-key"),
4170
+ privateKey: {}
4171
+ }, {
4172
+ allowPrivateAddress: true,
4173
+ userAgent: "test-ua"
4174
+ });
4175
+ assertEquals(seen.length, 1);
4176
+ assertEquals(seen[0], {
4177
+ allowPrivateAddress: true,
4178
+ userAgent: "test-ua"
4179
+ });
4180
+ });
4181
+ test("createFederation() omits instrumentation when no meterProvider is set", () => {
4182
+ const ctx = createFederation({
4183
+ kv: new MemoryKvStore(),
4184
+ documentLoaderFactory: () => mockDocumentLoader,
4185
+ contextLoaderFactory: () => mockDocumentLoader
4186
+ }).createContext(new URL("https://example.com/"), void 0);
4187
+ assertStrictEquals(ctx.documentLoader, mockDocumentLoader);
4188
+ assertStrictEquals(ctx.contextLoader, mockDocumentLoader);
4189
+ });
4132
4190
  //#endregion
4133
4191
  export {};
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("../chunk-DDcVe30Y.cjs");
5
- const require_middleware = require("../middleware-CmsDtIHI.cjs");
5
+ const require_middleware = require("../middleware-B2rtdpFV.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -1,5 +1,6 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "../context-Ch-ZLyTQ.cjs";
2
+ import { $ as CollectionCursor, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as ActorDispatcher, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CollectionCounter, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as ActorKeyPairsDispatcher, Y as ActorHandleMapper, Z as AuthorizePredicate, _ as Federatable, _t as SendActivityError, a as GetSignedKeyOptions, at as InboxListener, b as FederationFetchOptions, bt as buildCollectionSynchronizationHeader, c as ParseUriResult, ct as ObjectDispatcher, d as SendActivityOptions, dt as OutboxListenerErrorHandler, et as CollectionDispatcher, f as SendActivityOptionsForCollection, ft as OutboxPermanentFailureHandler, g as CustomCollectionCallbackSetters, gt as WebFingerLinksDispatcher, h as ConstructorWithTypeId, ht as UnverifiedActivityReason, i as GetActorOptions, it as InboxErrorHandler, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as OutboxErrorHandler, m as CollectionCallbackSetters, mt as UnverifiedActivityHandler, n as Context, nt as CustomCollectionCursor, o as InboxContext, ot as NodeInfoDispatcher, p as ActorCallbackSetters, pt as SharedInboxKeyDispatcher, q as ActorAliasMapper, r as ForwardActivityOptions, rt as CustomCollectionDispatcher, s as OutboxContext, st as ObjectAuthorizePredicate, t as ActorKeyPair, tt as CustomCollectionCounter, u as RouteActivityOptions, ut as OutboxListener, v as Federation, vt as SenderKeyPair, w as IdempotencyStrategy, x as FederationOptions, xt as digest, y as FederationBuilder, yt as PageItems, z as createFederationBuilder } from "../context-tc6VOOOL.cjs";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-gJ8LYbxX.cjs";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-P9tE2WmM.cjs";
4
+ import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D8uSFzxe.cjs";
5
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-DnzgcPcy.cjs";
5
6
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, 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, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,5 +1,6 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "../context-cSUMk2da.js";
2
+ import { $ as CollectionCursor, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as ActorDispatcher, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CollectionCounter, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as ActorKeyPairsDispatcher, Y as ActorHandleMapper, Z as AuthorizePredicate, _ as Federatable, _t as SendActivityError, a as GetSignedKeyOptions, at as InboxListener, b as FederationFetchOptions, bt as buildCollectionSynchronizationHeader, c as ParseUriResult, ct as ObjectDispatcher, d as SendActivityOptions, dt as OutboxListenerErrorHandler, et as CollectionDispatcher, f as SendActivityOptionsForCollection, ft as OutboxPermanentFailureHandler, g as CustomCollectionCallbackSetters, gt as WebFingerLinksDispatcher, h as ConstructorWithTypeId, ht as UnverifiedActivityReason, i as GetActorOptions, it as InboxErrorHandler, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as OutboxErrorHandler, m as CollectionCallbackSetters, mt as UnverifiedActivityHandler, n as Context, nt as CustomCollectionCursor, o as InboxContext, ot as NodeInfoDispatcher, p as ActorCallbackSetters, pt as SharedInboxKeyDispatcher, q as ActorAliasMapper, r as ForwardActivityOptions, rt as CustomCollectionDispatcher, s as OutboxContext, st as ObjectAuthorizePredicate, t as ActorKeyPair, tt as CustomCollectionCounter, u as RouteActivityOptions, ut as OutboxListener, v as Federation, vt as SenderKeyPair, w as IdempotencyStrategy, x as FederationOptions, xt as digest, y as FederationBuilder, yt as PageItems, z as createFederationBuilder } from "../context-Cq18Gplu.js";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-D6hNiMTK.js";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-C6E8rkcz.js";
4
+ import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D-nlpY04.js";
5
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CajNYYkt.js";
5
6
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, 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, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-Dtjz-hSk.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-DtOddSVg.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -9,10 +9,10 @@ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
10
10
  import { t as assert } from "../assert-DikXweDx.mjs";
11
11
  import { t as esm_default } from "../esm-sdtqOUPu.mjs";
12
- import { l as verifyRequest } from "../http-DUV8ysti.mjs";
12
+ import { l as verifyRequest } from "../http-IywnQdiX.mjs";
13
13
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
14
- import { t as doesActorOwnKey } from "../owner-hDxI0ufu.mjs";
15
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-BPhyR5Oo.mjs";
14
+ import { t as doesActorOwnKey } from "../owner-CIt4hvmM.mjs";
15
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-DJFpze7B.mjs";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
18
  //#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationTemporality.js
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-BAE7AKLA.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-BTEgfoJo.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
8
- import { o as createFederation, s as handleWebFinger } from "../middleware-t0jC8I99.mjs";
8
+ import { o as createFederation, s as handleWebFinger } from "../middleware-BB0IbDow.mjs";
9
9
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
10
10
  import { test } from "@fedify/fixture";
11
11
  //#region src/federation/webfinger.test.ts