@fedify/fedify 2.4.0-dev.2219 → 2.4.0-dev.2233

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 (73) hide show
  1. package/dist/{builder-C5rYBZ16.mjs → builder-BmoDmjWk.mjs} +2 -2
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{compound-proof-D0xY7MBs.mjs → compound-proof-Pn8766TV.mjs} +2 -2
  4. package/dist/{deno-Dj1TFhf4.mjs → deno-62DcBMwc.mjs} +1 -1
  5. package/dist/{docloader-CzyJe90o.mjs → docloader-Be9TaKa_.mjs} +2 -2
  6. package/dist/federation/builder.test.mjs +1 -1
  7. package/dist/federation/compound-fanout.test.mjs +3 -3
  8. package/dist/federation/handler-compound-proof.test.mjs +3 -3
  9. package/dist/federation/handler.test.mjs +73 -6
  10. package/dist/federation/hashlink-media.test.mjs +2 -2
  11. package/dist/federation/idempotency.test.mjs +2 -2
  12. package/dist/federation/metrics.test.mjs +1 -1
  13. package/dist/federation/middleware.test.mjs +7 -7
  14. package/dist/federation/mod.cjs +1 -1
  15. package/dist/federation/mod.js +1 -1
  16. package/dist/federation/outgoing-proof.test.mjs +248 -6
  17. package/dist/federation/portable-actor.test.mjs +3 -3
  18. package/dist/federation/portable-chain.test.mjs +3 -3
  19. package/dist/federation/portable-collection.test.mjs +4 -4
  20. package/dist/federation/portable-delivery.test.mjs +2 -2
  21. package/dist/federation/portable-gateway-keys.test.mjs +4 -4
  22. package/dist/federation/portable-inbox.test.mjs +4 -4
  23. package/dist/federation/portable-parse-uri.test.mjs +1 -1
  24. package/dist/federation/portable-route-activity.test.mjs +2 -2
  25. package/dist/federation/portable.test.mjs +80 -3
  26. package/dist/federation/send.test.mjs +3 -3
  27. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  28. package/dist/federation/tasks/tasks.test.mjs +2 -2
  29. package/dist/federation/temporal.test.mjs +1 -1
  30. package/dist/federation/webfinger.test.mjs +1 -1
  31. package/dist/{federation-DC1yfb-8.cjs → federation-BVkPF8vF.cjs} +246 -31
  32. package/dist/{http-Cuk0w0rp.cjs → http-BbDZCEnR.cjs} +1 -1
  33. package/dist/{http-Dx7yMmfw.js → http-D4JQwy-3.js} +1 -1
  34. package/dist/{http-D-DpP4sd.mjs → http-SIEv_YGW.mjs} +4 -4
  35. package/dist/{key-Djyt1BFx.mjs → key-CtAhsSFI.mjs} +2 -2
  36. package/dist/{kv-cache-CUZOCSKZ.js → kv-cache-DXFAaMh2.js} +1 -1
  37. package/dist/{kv-cache-BmLTVLXc.cjs → kv-cache-DxLtK3Np.cjs} +1 -1
  38. package/dist/{kv-cache-ecUXfCqW.mjs → kv-cache-Fn7dxiMu.mjs} +1 -1
  39. package/dist/{ld-CNVWdooi.mjs → ld-BuI0RakW.mjs} +3 -3
  40. package/dist/{metrics-BnYleVpg.mjs → metrics-jr7IbGjd.mjs} +1 -1
  41. package/dist/{middleware-Bh592bk8.mjs → middleware-BWhRFmO0.mjs} +1 -1
  42. package/dist/{middleware-C2_LcbL3.mjs → middleware-BhtaUtlt.mjs} +243 -28
  43. package/dist/{middleware-BdzcazaN.js → middleware-D0t1NBIE.js} +246 -31
  44. package/dist/mod.cjs +4 -4
  45. package/dist/mod.js +4 -4
  46. package/dist/nodeinfo/handler.test.mjs +1 -1
  47. package/dist/{owner-D_BDPwm2.mjs → owner-CoNYVTQp.mjs} +3 -3
  48. package/dist/{portable-collection-hcONGyUs.mjs → portable-collection-CxP30PWK.mjs} +2 -2
  49. package/dist/{portable-collection-DwJ8YJP2.cjs → portable-collection-FLEUNFj5.cjs} +1 -1
  50. package/dist/{portable-collection-C0c0rUN9.js → portable-collection-ZczKiIeK.js} +1 -1
  51. package/dist/{portable-key-B880yVlC.mjs → portable-key-90Ux6h7F.mjs} +1 -1
  52. package/dist/{proof-z6Prgi5I.mjs → proof-Bhsb_KYD.mjs} +4 -4
  53. package/dist/{send-Cw545L_2.mjs → send-CdRJj10a.mjs} +3 -3
  54. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  55. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  56. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  57. package/dist/sig/compound-proof.test.mjs +2 -2
  58. package/dist/sig/http.test.mjs +2 -2
  59. package/dist/sig/key.test.mjs +1 -1
  60. package/dist/sig/ld.test.mjs +2 -2
  61. package/dist/sig/mod.cjs +2 -2
  62. package/dist/sig/mod.js +2 -2
  63. package/dist/sig/owner.test.mjs +1 -1
  64. package/dist/sig/portable-collection.test.mjs +1 -1
  65. package/dist/sig/portable-key.test.mjs +6 -6
  66. package/dist/sig/proof.test.mjs +5 -3
  67. package/dist/{temporal-Cy-8WCod.mjs → temporal-vBRC6bwu.mjs} +1 -1
  68. package/dist/testing/kv.test.mjs +1 -1
  69. package/dist/utils/docloader.test.mjs +2 -2
  70. package/dist/utils/kv-cache.test.mjs +1 -1
  71. package/dist/utils/mod.cjs +1 -1
  72. package/dist/utils/mod.js +1 -1
  73. package/package.json +7 -7
@@ -8,11 +8,11 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
8
8
  import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
9
9
  import "../std__assert-DvMDRPes.mjs";
10
10
  import { t as assert } from "../assert-D1Eafmd_.mjs";
11
- import { p as signJsonLd } from "../ld-CNVWdooi.mjs";
12
- import { a as signObject } from "../proof-z6Prgi5I.mjs";
13
- import { l as signRequest, p as verifyRequestDetailed } from "../http-D-DpP4sd.mjs";
11
+ import { p as signJsonLd } from "../ld-BuI0RakW.mjs";
12
+ import { a as signObject } from "../proof-Bhsb_KYD.mjs";
13
+ import { l as signRequest, p as verifyRequestDetailed } from "../http-SIEv_YGW.mjs";
14
14
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
15
- import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-C2_LcbL3.mjs";
15
+ import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-BhtaUtlt.mjs";
16
16
  import { Create, CryptographicKey, Follow, Note, Person, Tombstone } from "@fedify/vocab";
17
17
  import { exportDidKey, formatIri, parseIri } from "@fedify/vocab-runtime";
18
18
  import { mockDocumentLoader, test } from "@fedify/fixture";
@@ -7,7 +7,7 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
7
7
  import "../std__assert-DvMDRPes.mjs";
8
8
  import { t as assert } from "../assert-D1Eafmd_.mjs";
9
9
  import { r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
10
- import { o as createFederation } from "../middleware-C2_LcbL3.mjs";
10
+ import { o as createFederation } from "../middleware-BhtaUtlt.mjs";
11
11
  import { Note, Object as Object$1, Person } from "@fedify/vocab";
12
12
  import { exportDidKey, parseIri } from "@fedify/vocab-runtime";
13
13
  import { test } from "@fedify/fixture";
@@ -6,9 +6,9 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
7
7
  import "../std__assert-DvMDRPes.mjs";
8
8
  import { t as assert } from "../assert-D1Eafmd_.mjs";
9
- import { a as signObject } from "../proof-z6Prgi5I.mjs";
9
+ import { a as signObject } from "../proof-Bhsb_KYD.mjs";
10
10
  import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
11
- import { o as createFederation } from "../middleware-C2_LcbL3.mjs";
11
+ import { o as createFederation } from "../middleware-BhtaUtlt.mjs";
12
12
  import { Create, Note } from "@fedify/vocab";
13
13
  import { exportDidKey, formatIri, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
14
14
  import { mockDocumentLoader, test } from "@fedify/fixture";
@@ -8,10 +8,10 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
8
8
  import "../std__assert-DvMDRPes.mjs";
9
9
  import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
10
10
  import { t as assert } from "../assert-D1Eafmd_.mjs";
11
- import { a as signObject, c as verifyPortableObjectProof } from "../proof-z6Prgi5I.mjs";
12
- import { l as signRequest } from "../http-D-DpP4sd.mjs";
11
+ import { a as signObject, c as verifyPortableObjectProof } from "../proof-Bhsb_KYD.mjs";
12
+ import { l as signRequest } from "../http-SIEv_YGW.mjs";
13
13
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
14
- import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-C2_LcbL3.mjs";
14
+ import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-BhtaUtlt.mjs";
15
15
  import { configure, reset } from "@logtape/logtape";
16
16
  import { Collection, Create, Note, Object as Object$1, PUBLIC_COLLECTION, Person, Tombstone, lookupObject } from "@fedify/vocab";
17
17
  import { exportDidKey, formatIri, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
@@ -865,6 +865,83 @@ async function captureWarnings(run) {
865
865
  }
866
866
  return records.filter((record) => record.category[0] === "fedify");
867
867
  }
868
+ test("object responses warn about compatible IDs off the owner's first gateway", async () => {
869
+ const federation = createTestFederation();
870
+ const ownerId = parseIri(`ap://${did}/users/alice`);
871
+ const gateways = [new URL("https://primary.example"), new URL("https://secondary.example")];
872
+ const secondary = await sign(new Note({
873
+ id: toCompatibleEf61Id(parseIri(`ap://${did}/notes/secondary`), gateways[1]),
874
+ attribution: ownerId,
875
+ to: PUBLIC_COLLECTION,
876
+ content: "Hello"
877
+ }));
878
+ let actorCalls = 0;
879
+ let actorLookupFails = false;
880
+ federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => {
881
+ actorCalls++;
882
+ if (actorLookupFails) throw new Error("Actor storage unavailable");
883
+ return identifier === "alice" ? new Person({
884
+ id: ownerId,
885
+ gateways
886
+ }) : null;
887
+ });
888
+ federation.setObjectDispatcher(Note, "/notes/{id}", async (_ctx, values) => {
889
+ if (values.id === "secondary") return secondary;
890
+ const note = new Note({
891
+ id: values.id === "portable" ? parseIri(`ap://${did}/notes/portable`) : values.id === "ordinary" ? new URL("https://example.com/notes/ordinary") : toCompatibleEf61Id(parseIri(`ap://${did}/notes/${values.id}`), values.id === "secondary" || values.id === "retained" ? gateways[1] : gateways[0]),
892
+ attribution: ownerId,
893
+ to: PUBLIC_COLLECTION,
894
+ content: "Hello"
895
+ });
896
+ if (values.id === "retained") {
897
+ const raw = await (await sign(note)).toJsonLd({
898
+ format: "compact",
899
+ contextLoader: mockDocumentLoader
900
+ });
901
+ const parsed = await Note.fromJsonLd(raw, {
902
+ contextLoader: mockDocumentLoader,
903
+ documentLoader: mockDocumentLoader
904
+ });
905
+ parsed.id.hostname = "primary.example";
906
+ return parsed;
907
+ }
908
+ return note;
909
+ });
910
+ federation.setObjectDispatcher(Create, "/activities/{id}", (_ctx, values) => new Create({
911
+ id: toCompatibleEf61Id(parseIri(`ap://${did}/activities/${values.id}`), gateways[1]),
912
+ actor: ownerId
913
+ }));
914
+ for (const [id, expected] of [
915
+ ["secondary", 1],
916
+ ["retained", 1],
917
+ ["primary", 0],
918
+ ["portable", 0],
919
+ ["ordinary", 0]
920
+ ]) assertEquals((await captureWarnings(async () => {
921
+ const response = await federation.fetch(new Request(`https://example.com/notes/${id}`, { headers: { Accept: ACCEPT } }), { contextData: void 0 });
922
+ assertEquals(response.status, 200);
923
+ const body = await response.json();
924
+ assertEquals(body.type, "Note");
925
+ if (id === "retained") assertEquals(body.id, `https://secondary.example/.well-known/apgateway/${did}/notes/retained`);
926
+ })).filter((r) => r.properties.kind === "object").length, expected, id);
927
+ assertEquals((await captureWarnings(async () => {
928
+ assertEquals((await federation.fetch(new Request("https://example.com/activities/1", { headers: { Accept: ACCEPT } }), { contextData: void 0 })).status, 200);
929
+ })).filter((r) => r.properties.kind === "activity").length, 1);
930
+ for (const id of ["secondary", "retained"]) assertEquals((await captureWarnings(async () => {
931
+ assertEquals((await federation.fetch(gatewayRequest(`/notes/${id}`), { contextData: void 0 })).status, 200);
932
+ })).filter((r) => r.properties.kind === "object").length, 1);
933
+ actorLookupFails = true;
934
+ const expectedBody = await secondary.toJsonLd({
935
+ format: "compact",
936
+ contextLoader: mockDocumentLoader
937
+ });
938
+ for (const request of [new Request("https://example.com/notes/secondary", { headers: { Accept: ACCEPT } }), gatewayRequest("/notes/secondary")]) assertEquals((await captureWarnings(async () => {
939
+ const response = await federation.fetch(request, { contextData: void 0 });
940
+ assertEquals(response.status, 200);
941
+ assertEquals(await response.json(), expectedBody);
942
+ })).filter((r) => r.properties.kind != null), []);
943
+ assertEquals(actorCalls, 8);
944
+ });
868
945
  test("Federation.fetch() serves compatible-ID actors", async (t) => {
869
946
  const federation = createTestFederation();
870
947
  const actorGateways = {
@@ -10,10 +10,10 @@ import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
10
10
  import "../std__assert-DvMDRPes.mjs";
11
11
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
12
12
  import { t as assert } from "../assert-D1Eafmd_.mjs";
13
- import { f as verifyRequest } from "../http-D-DpP4sd.mjs";
13
+ import { f as verifyRequest } from "../http-SIEv_YGW.mjs";
14
14
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
15
- import { t as doesActorOwnKey } from "../owner-D_BDPwm2.mjs";
16
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-Cw545L_2.mjs";
15
+ import { t as doesActorOwnKey } from "../owner-CoNYVTQp.mjs";
16
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-CdRJj10a.mjs";
17
17
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
18
18
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
19
19
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
5
5
  import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
6
6
  import "../../testing-t8xDeJZ5.mjs";
7
- import { o as createFederation } from "../../middleware-C2_LcbL3.mjs";
7
+ import { o as createFederation } from "../../middleware-BhtaUtlt.mjs";
8
8
  import { n as ParallelMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
9
9
  import { configure, reset } from "@logtape/logtape";
10
10
  import { delay } from "es-toolkit";
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
5
5
  import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
6
6
  import "../../testing-t8xDeJZ5.mjs";
7
- import { o as createFederation } from "../../middleware-C2_LcbL3.mjs";
8
- import { r as createFederationBuilder } from "../../builder-C5rYBZ16.mjs";
7
+ import { o as createFederation } from "../../middleware-BhtaUtlt.mjs";
8
+ import { r as createFederationBuilder } from "../../builder-BmoDmjWk.mjs";
9
9
  import { t as TaskCodec } from "../../codec-C6rTrpIp.mjs";
10
10
  import { t as InProcessMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
11
11
  import { W3CTraceContextPropagator } from "@opentelemetry/core";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
5
5
  import "../std__assert-DvMDRPes.mjs";
6
6
  import { t as assert } from "../assert-D1Eafmd_.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-Cy-8WCod.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-vBRC6bwu.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -6,7 +6,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
6
6
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
7
7
  import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
8
8
  import "../std__assert-DvMDRPes.mjs";
9
- import { o as createFederation, s as handleWebFinger } from "../middleware-C2_LcbL3.mjs";
9
+ import { o as createFederation, s as handleWebFinger } from "../middleware-BhtaUtlt.mjs";
10
10
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
11
11
  import { parseIri } from "@fedify/vocab-runtime";
12
12
  import { createTestMeterProvider, test } from "@fedify/fixture";