@fedify/fedify 2.3.0-dev.994 → 2.3.0-pr.809.37
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.
- package/README.md +16 -7
- package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
- package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
- package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
- package/dist/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-DN60FHPX.mjs} +28 -3
- package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
- package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
- package/dist/{builder-yAlpiIqP.mjs → builder-Dl5Sdmc9.mjs} +96 -42
- package/dist/{chunk-nlSIicah.js → chunk-CRNNMoPX.js} +2 -2
- package/dist/circuit-breaker-CSWsyoef.mjs +337 -0
- package/dist/{client-z-8dc-e1.d.cts → client-CAM_bQXx.d.cts} +1 -0
- package/dist/{client-AtlibPOU.d.ts → client-CSddvgWN.d.ts} +1 -2
- package/dist/compat/mod.d.cts +2 -1
- package/dist/compat/mod.d.ts +2 -3
- package/dist/compat/mod.js +3 -3
- package/dist/compat/outgoing-jsonld.test.mjs +4 -4
- package/dist/compat/public-audience.test.mjs +4 -4
- package/dist/compat/transformers.test.mjs +5 -5
- package/dist/{context-BzH2-ajs.d.ts → context-BBVLF7lx.d.cts} +342 -269
- package/dist/{context-DJGagtNd.d.cts → context-BU6jSQdo.d.ts} +344 -266
- package/dist/{context-Dk_tacqz.mjs → context-DVoTs_wM.mjs} +64 -5
- package/dist/{deno-XBVlKnOX.mjs → deno-BID9qTPk.mjs} +1 -1
- package/dist/{docloader-DPp-X6gk.mjs → docloader-BYFuVwwi.mjs} +4 -4
- package/dist/{esm-DVILvP5e.mjs → esm-vrlUxr60.mjs} +4 -7
- package/dist/federation/builder.test.mjs +163 -11
- package/dist/federation/circuit-breaker.test.d.mts +2 -0
- package/dist/federation/circuit-breaker.test.mjs +446 -0
- package/dist/federation/collection.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +1770 -29
- package/dist/federation/idempotency.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +4 -4
- package/dist/federation/keycache.test.mjs +5 -5
- package/dist/federation/kv.test.mjs +2 -2
- package/dist/federation/metrics.test.d.mts +2 -0
- package/dist/federation/metrics.test.mjs +634 -0
- package/dist/federation/middleware.test.mjs +4036 -146
- package/dist/federation/mod.cjs +195 -14
- package/dist/federation/mod.d.cts +6 -4
- package/dist/federation/mod.d.ts +6 -6
- package/dist/federation/mod.js +192 -14
- package/dist/federation/mq.test.mjs +176 -15
- package/dist/federation/negotiation.test.mjs +4 -4
- package/dist/federation/retry.test.mjs +3 -3
- package/dist/federation/router.test.mjs +190 -9
- package/dist/federation/send.test.mjs +153 -15
- package/dist/federation/temporal.test.d.mts +2 -0
- package/dist/federation/temporal.test.mjs +71 -0
- package/dist/federation/webfinger.test.mjs +150 -5
- package/dist/{http-B4rrzxtg.js → http-B47Jg9iX.js} +994 -64
- package/dist/{http-CSlLA54v.mjs → http-CO59u1Yk.mjs} +146 -47
- package/dist/{http-BrGqJDXL.cjs → http-CjZwUPiT.cjs} +1099 -61
- package/dist/{http-aQzN9Ayi.d.ts → http-VyDTd4G3.d.cts} +15 -3
- package/dist/{http-CrGuipxe.d.cts → http-lf8Hsd91.d.ts} +15 -1
- package/dist/{key-Bzx--sHD.mjs → key-Dqdlo3mG.mjs} +43 -18
- package/dist/{kv-CbLNp3zQ.d.cts → kv-D6hNiMTK.d.ts} +1 -0
- package/dist/{kv-cache-DI-Sk7-I.cjs → kv-cache-BQ1-zDKX.cjs} +20 -3
- package/dist/{kv-cache-EMIqoIuB.js → kv-cache-Dh2ZH9Gr.js} +20 -3
- package/dist/{kv-cache-U__xU4qR.mjs → kv-cache-DhLkLv0P.mjs} +21 -3
- package/dist/{kv-GFYnFoOl.d.ts → kv-gJ8LYbxX.d.cts} +1 -3
- package/dist/ld-JbCByP5P.mjs +626 -0
- package/dist/metrics-ColY3QKj.mjs +815 -0
- package/dist/{middleware-zjZ6AFCW.mjs → middleware-Buqzuiaf.mjs} +1 -1
- package/dist/{middleware-An4DjES4.cjs → middleware-CWQ3Yi07.cjs} +2318 -623
- package/dist/{middleware-K1g6bEkV.mjs → middleware-Cg4EyWsq.mjs} +1639 -373
- package/dist/{middleware-nidH7VZH.js → middleware-iAJY2aU-.js} +2260 -556
- package/dist/{mod-CR8soWa9.d.ts → mod-B0hW12_O.d.cts} +26 -4
- package/dist/mod-C0F6kvgS.d.cts +182 -0
- package/dist/{mod-Cr3f-ACa.d.cts → mod-COIAjwRS.d.ts} +26 -2
- package/dist/{mod-CMEbIaNh.d.cts → mod-DFvNJcNb.d.ts} +56 -4
- package/dist/mod-vPYVoa5n.d.ts +182 -0
- package/dist/{mod-CLgIXe9w.d.ts → mod-yvIXFAEi.d.cts} +56 -6
- package/dist/mod.cjs +9 -6
- package/dist/mod.d.cts +12 -10
- package/dist/mod.d.ts +12 -12
- package/dist/mod.js +11 -11
- package/dist/mq-D-nlpY04.d.ts +208 -0
- package/dist/mq-D8uSFzxe.d.cts +208 -0
- package/dist/{negotiation-SQvQgUqe.mjs → negotiation-DDstyBvc.mjs} +29 -0
- package/dist/nodeinfo/client.test.mjs +4 -4
- package/dist/nodeinfo/handler.test.mjs +4 -4
- package/dist/nodeinfo/mod.d.cts +2 -1
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.mjs +3 -3
- package/dist/otel/exporter.test.mjs +28 -25
- package/dist/otel/mod.cjs +6 -5
- package/dist/otel/mod.d.cts +5 -3
- package/dist/otel/mod.d.ts +5 -5
- package/dist/otel/mod.js +8 -7
- package/dist/{outgoing-jsonld-CNmZLixq.mjs → outgoing-jsonld-L_DbOaFe.mjs} +2 -2
- package/dist/{owner-C-tqfvxn.mjs → owner-B4LgOmzV.mjs} +2 -2
- package/dist/{owner-CptqhsOy.d.cts → owner-CnngXDNJ.d.ts} +2 -1
- package/dist/{owner-74ARJ5TL.d.ts → owner-DEvZuyOE.d.cts} +2 -3
- package/dist/{proof-BlmRPzrK.mjs → proof-BoSGOq9q.mjs} +26 -8
- package/dist/{proof-Bbbwf8_x.js → proof-CzhZuawt.js} +378 -15
- package/dist/{proof-BW89QMVB.cjs → proof-DvMI-3vq.cjs} +432 -15
- package/dist/runtime/mod.d.cts +1 -0
- package/dist/runtime/mod.d.ts +1 -2
- package/dist/runtime/mod.js +3 -3
- package/dist/{send-05pJLcb6.mjs → send-ByK1Q7DK.mjs} +72 -26
- package/dist/sig/http.test.mjs +356 -33
- package/dist/sig/key.test.mjs +103 -6
- package/dist/sig/ld.test.mjs +696 -7
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +4 -3
- package/dist/sig/mod.d.ts +4 -5
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +169 -8
- package/dist/{std__assert-CRDpx_HF.mjs → std__assert-BBjXFNOb.mjs} +5 -30
- package/dist/temporal-LpjyAjKb.mjs +95 -0
- package/dist/testing/mod.d.mts +110 -10
- package/dist/testing/mod.mjs +1 -2
- package/dist/{transformers-ve6e2xcg.js → transformers-BGMIq1cs.js} +2 -2
- package/dist/{types-hvL8ElAs.js → types-CAY3OdLq.js} +2 -2
- package/dist/utils/docloader.test.mjs +6 -6
- package/dist/utils/kv-cache.test.mjs +67 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +2 -1
- package/dist/utils/mod.d.ts +2 -3
- package/dist/utils/mod.js +3 -3
- package/dist/vocab/cjs.test.mjs +1 -1
- package/dist/vocab/mod.d.cts +1 -0
- package/dist/vocab/mod.d.ts +1 -2
- package/dist/vocab/mod.js +2 -2
- package/package.json +16 -16
- package/dist/ld-DR78beiv.mjs +0 -279
- package/dist/middleware-BFBaR0mF.cjs +0 -4
- package/dist/mod-2d12ffz3.d.ts +0 -64
- package/dist/mod-D35TRn09.d.cts +0 -62
- package/dist/router-CrMLXoOr.mjs +0 -114
- package/dist/{activity-listener-ell7W1s9.mjs → activity-listener-tztVvlNb.mjs} +0 -0
- package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
- package/dist/{client-D_1QpnWt.mjs → client-ByXmQhYD.mjs} +1 -1
- package/dist/{collection-D-HqUuA2.mjs → collection-Cc3DVAhE.mjs} +0 -0
- package/dist/{keycache-EGATflN-.mjs → keycache-BeU0LCII.mjs} +0 -0
- package/dist/{public-audience-DYFHzm_c.mjs → public-audience-Cvbr2Gzt.mjs} +1 -1
- /package/dist/{retry-bMXBL97A.mjs → retry-CXg_MBI-.mjs} +0 -0
package/dist/sig/key.test.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import "../std__assert-
|
|
6
|
-
import { t as assertRejects } from "../assert_rejects-
|
|
7
|
-
import { t as assertThrows } from "../assert_throws-
|
|
8
|
-
import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-
|
|
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-Dqdlo3mG.mjs";
|
|
9
9
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
|
|
10
|
-
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
11
|
+
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
13
13
|
//#region src/sig/key.test.ts
|
|
14
14
|
test("validateCryptoKey()", async () => {
|
|
@@ -303,5 +303,102 @@ test("fetchKeyDetailed() returns detailed fetch errors", async () => {
|
|
|
303
303
|
if (detailedError == null || !("error" in detailedError)) throw new Error("Expected non-HTTP fetch error details.");
|
|
304
304
|
assertEquals(detailedError.error, failure);
|
|
305
305
|
});
|
|
306
|
+
test("fetchKey() records activitypub.key.lookup with hit on cached key", async () => {
|
|
307
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
308
|
+
const cache = {};
|
|
309
|
+
const options = {
|
|
310
|
+
documentLoader: mockDocumentLoader,
|
|
311
|
+
contextLoader: mockDocumentLoader,
|
|
312
|
+
keyCache: {
|
|
313
|
+
get(keyId) {
|
|
314
|
+
return Promise.resolve(cache[keyId.href]);
|
|
315
|
+
},
|
|
316
|
+
set(keyId, key) {
|
|
317
|
+
cache[keyId.href] = key;
|
|
318
|
+
return Promise.resolve();
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
meterProvider
|
|
322
|
+
};
|
|
323
|
+
await fetchKey("https://example.com/key", CryptographicKey, options);
|
|
324
|
+
recorder.clear();
|
|
325
|
+
assertEquals((await fetchKey("https://example.com/key", CryptographicKey, options)).cached, true);
|
|
326
|
+
const counters = recorder.getMeasurements("activitypub.key.lookup");
|
|
327
|
+
assertEquals(counters.length, 1);
|
|
328
|
+
assertEquals(counters[0].attributes["activitypub.lookup.kind"], "public_key");
|
|
329
|
+
assertEquals(counters[0].attributes["activitypub.lookup.result"], "hit");
|
|
330
|
+
assertEquals(counters[0].attributes["activitypub.cache.enabled"], true);
|
|
331
|
+
assertEquals(counters[0].attributes["activitypub.remote.host"], "example.com");
|
|
332
|
+
const duration = recorder.getMeasurement("activitypub.key.lookup.duration");
|
|
333
|
+
assertEquals(duration?.type, "histogram");
|
|
334
|
+
assertEquals(duration?.attributes["activitypub.lookup.result"], "hit");
|
|
335
|
+
});
|
|
336
|
+
test("fetchKey() records activitypub.key.lookup with fetched on cache miss", async () => {
|
|
337
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
338
|
+
assertEquals((await fetchKey("https://example.com/key", CryptographicKey, {
|
|
339
|
+
documentLoader: mockDocumentLoader,
|
|
340
|
+
contextLoader: mockDocumentLoader,
|
|
341
|
+
meterProvider
|
|
342
|
+
})).cached, false);
|
|
343
|
+
const counter = recorder.getMeasurement("activitypub.key.lookup");
|
|
344
|
+
assertEquals(counter?.attributes["activitypub.lookup.result"], "fetched");
|
|
345
|
+
assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
|
|
346
|
+
assertEquals(counter?.attributes["activitypub.remote.host"], "example.com");
|
|
347
|
+
assertEquals(recorder.getMeasurement("activitypub.key.lookup.duration")?.attributes["activitypub.lookup.result"], "fetched");
|
|
348
|
+
});
|
|
349
|
+
test("fetchKey() records not_found and status code on HTTP 404", async () => {
|
|
350
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
351
|
+
const missingKeyId = new URL("https://example.com/missing-key");
|
|
352
|
+
const documentLoader = (url) => {
|
|
353
|
+
if (url === missingKeyId.href) throw new FetchError(missingKeyId, `HTTP 404: ${missingKeyId.href}`, new Response(null, { status: 404 }));
|
|
354
|
+
return mockDocumentLoader(url);
|
|
355
|
+
};
|
|
356
|
+
assertEquals((await fetchKey(missingKeyId, CryptographicKey, {
|
|
357
|
+
documentLoader,
|
|
358
|
+
contextLoader: mockDocumentLoader,
|
|
359
|
+
meterProvider
|
|
360
|
+
})).key, null);
|
|
361
|
+
const counter = recorder.getMeasurement("activitypub.key.lookup");
|
|
362
|
+
assertEquals(counter?.attributes["activitypub.lookup.result"], "not_found");
|
|
363
|
+
assertEquals(counter?.attributes["http.response.status_code"], 404);
|
|
364
|
+
assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
|
|
365
|
+
assertEquals(counter?.attributes["activitypub.remote.host"], "example.com");
|
|
366
|
+
});
|
|
367
|
+
test("fetchKey() records network_error on TypeError from the document loader", async () => {
|
|
368
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
369
|
+
const documentLoader = () => {
|
|
370
|
+
throw new TypeError("connect failed");
|
|
371
|
+
};
|
|
372
|
+
await fetchKey("https://example.com/key", CryptographicKey, {
|
|
373
|
+
documentLoader,
|
|
374
|
+
contextLoader: mockDocumentLoader,
|
|
375
|
+
meterProvider
|
|
376
|
+
});
|
|
377
|
+
const counter = recorder.getMeasurement("activitypub.key.lookup");
|
|
378
|
+
assertEquals(counter?.attributes["activitypub.lookup.result"], "network_error");
|
|
379
|
+
assertEquals("http.response.status_code" in counter.attributes, false);
|
|
380
|
+
});
|
|
381
|
+
test("fetchKeyDetailed() records activitypub.key.lookup with the same taxonomy", async () => {
|
|
382
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
383
|
+
const goneKeyId = new URL("https://example.com/gone-key");
|
|
384
|
+
const documentLoader = (url) => {
|
|
385
|
+
if (url === goneKeyId.href) throw new FetchError(goneKeyId, `HTTP 410: ${goneKeyId.href}`, new Response(null, { status: 410 }));
|
|
386
|
+
return mockDocumentLoader(url);
|
|
387
|
+
};
|
|
388
|
+
await fetchKeyDetailed(goneKeyId, CryptographicKey, {
|
|
389
|
+
documentLoader,
|
|
390
|
+
contextLoader: mockDocumentLoader,
|
|
391
|
+
meterProvider
|
|
392
|
+
});
|
|
393
|
+
const counter = recorder.getMeasurement("activitypub.key.lookup");
|
|
394
|
+
assertEquals(counter?.attributes["activitypub.lookup.result"], "not_found");
|
|
395
|
+
assertEquals(counter?.attributes["http.response.status_code"], 410);
|
|
396
|
+
});
|
|
397
|
+
test("fetchKey() works when meterProvider is omitted", async () => {
|
|
398
|
+
assertEquals((await fetchKey("https://example.com/key", CryptographicKey, {
|
|
399
|
+
documentLoader: mockDocumentLoader,
|
|
400
|
+
contextLoader: mockDocumentLoader
|
|
401
|
+
})).cached, false);
|
|
402
|
+
});
|
|
306
403
|
//#endregion
|
|
307
404
|
export {};
|