@fedify/fedify 2.4.0-dev.2149 → 2.4.0-dev.2157

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 (101) hide show
  1. package/dist/{builder-W2fIPRjv.mjs → builder-CLaS4-yA.mjs} +56 -3
  2. package/dist/{client-DpnpgjyX.mjs → client-CEnNz8O7.mjs} +7 -3
  3. package/dist/compat/mod.d.cts +1 -1
  4. package/dist/compat/mod.d.ts +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/{compound-proof-B1QH25S6.mjs → compound-proof-D7K94KPz.mjs} +216 -4
  7. package/dist/{context-DfSVPcJ8.mjs → context-B2rlkkyJ.mjs} +9 -2
  8. package/dist/{context-CrDDVrbF.d.cts → context-BMggDR-l.d.cts} +394 -5
  9. package/dist/{context-B2C8nuN3.d.ts → context-exYu7gDU.d.ts} +394 -5
  10. package/dist/{deno-yXpYZm4K.mjs → deno-D1gcWWqB.mjs} +1 -1
  11. package/dist/{dist-BQvArojP.mjs → dist-DJQM4u7i.mjs} +2 -1
  12. package/dist/docloader-BMqr3hji.mjs +79 -0
  13. package/dist/federation/builder.test.mjs +1 -1
  14. package/dist/federation/compound-fanout.test.mjs +3 -3
  15. package/dist/federation/handler-compound-proof.test.mjs +4 -4
  16. package/dist/federation/handler.test.mjs +6 -6
  17. package/dist/federation/hashlink-media.test.mjs +2 -2
  18. package/dist/federation/idempotency.test.mjs +2 -2
  19. package/dist/federation/metrics.test.mjs +1 -1
  20. package/dist/federation/middleware.test.mjs +187 -10
  21. package/dist/federation/mod.cjs +1 -1
  22. package/dist/federation/mod.d.cts +3 -3
  23. package/dist/federation/mod.d.ts +3 -3
  24. package/dist/federation/mod.js +1 -1
  25. package/dist/federation/mq.test.mjs +98 -69
  26. package/dist/federation/outgoing-proof.test.mjs +5 -5
  27. package/dist/federation/portable-actor.test.mjs +3 -3
  28. package/dist/federation/portable-chain.test.mjs +3 -3
  29. package/dist/federation/portable-collection.test.d.mts +2 -0
  30. package/dist/federation/portable-collection.test.mjs +768 -0
  31. package/dist/federation/portable-gateway-keys.test.mjs +4 -4
  32. package/dist/federation/portable-inbox.test.mjs +4 -4
  33. package/dist/federation/portable.test.mjs +4 -4
  34. package/dist/federation/send.test.mjs +84 -3
  35. package/dist/federation/tasks/enqueue.test.mjs +3 -3
  36. package/dist/federation/tasks/tasks.test.mjs +4 -4
  37. package/dist/federation/temporal.test.mjs +1 -1
  38. package/dist/federation/webfinger.test.mjs +2 -2
  39. package/dist/{federation-D4j-ZXUN.cjs → federation-2e8XrN7q.cjs} +700 -70
  40. package/dist/{http-C_jobbLz.cjs → http-BObQoB0j.cjs} +18 -3
  41. package/dist/{http-BoH-e8sR.mjs → http-CGcLv8rh.mjs} +9 -5
  42. package/dist/{http-CBRurnlR.js → http-Dgtt45-K.js} +13 -4
  43. package/dist/{key-BtO7WCfP.mjs → key-CPM4r6tP.mjs} +2 -2
  44. package/dist/{kv-cache-E0es0w4R.js → kv-cache-BweyIZTb.js} +35 -9
  45. package/dist/{kv-cache-BxUqVENn.cjs → kv-cache-D2fnB8qu.cjs} +34 -8
  46. package/dist/{kv-cache-CMuTXrkC.mjs → kv-cache-bdPqTR1k.mjs} +1 -1
  47. package/dist/{ld-YYBfDbe_.mjs → ld-lU_ZqzsQ.mjs} +4 -4
  48. package/dist/{metrics-DMqdDud_.mjs → metrics-B41pRPfd.mjs} +1 -1
  49. package/dist/{middleware-D6uiL1Tw.js → middleware-BYWyYjmX.js} +702 -72
  50. package/dist/{middleware-C97UJpkA.mjs → middleware-TrCVULgs.mjs} +1 -1
  51. package/dist/{middleware-CBGR92fz.mjs → middleware-xdukzV3x.mjs} +432 -81
  52. package/dist/{mod-C06GoL5Z.d.ts → mod-CnGtADvO.d.ts} +1 -1
  53. package/dist/{mod-CZetqT5h.d.ts → mod-DaiBrWDW.d.ts} +2 -0
  54. package/dist/{mod-B7SfEqIP.d.cts → mod-Decmur1U.d.cts} +1 -1
  55. package/dist/{mod-D4g9ffEn.d.cts → mod-Mt4aO3DX.d.cts} +2 -0
  56. package/dist/mod.cjs +5 -5
  57. package/dist/mod.d.cts +5 -5
  58. package/dist/mod.d.ts +5 -5
  59. package/dist/mod.js +5 -5
  60. package/dist/nodeinfo/client.test.mjs +49 -1
  61. package/dist/nodeinfo/handler.test.mjs +2 -2
  62. package/dist/nodeinfo/mod.cjs +1 -1
  63. package/dist/nodeinfo/mod.js +1 -1
  64. package/dist/{owner-Cn6CFYBy.mjs → owner-D63yPo_i.mjs} +3 -3
  65. package/dist/{portable-collection-CWgXwOdR.cjs → portable-collection-B8ojoQ50.cjs} +1 -1
  66. package/dist/{portable-collection-CyhFWEB-.js → portable-collection-C3xEzYri.js} +1 -1
  67. package/dist/{portable-collection-B3swTTja.mjs → portable-collection-_lZg-osX.mjs} +2 -2
  68. package/dist/{portable-key-HM5Siym0.mjs → portable-key-D8uWZF7b.mjs} +1 -1
  69. package/dist/{proof-DWkXfZIU.mjs → proof-C2YwD8a_.mjs} +10 -5
  70. package/dist/{send-BQDT_8bc.mjs → send-D9SGhxTB.mjs} +18 -4
  71. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  72. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  73. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  74. package/dist/sig/compound-proof.test.mjs +2 -2
  75. package/dist/sig/http.test.mjs +42 -2
  76. package/dist/sig/key.test.mjs +1 -1
  77. package/dist/sig/ld.test.mjs +5 -2
  78. package/dist/sig/mod.cjs +2 -2
  79. package/dist/sig/mod.js +2 -2
  80. package/dist/sig/owner.test.mjs +1 -1
  81. package/dist/sig/portable-collection.test.mjs +2 -2
  82. package/dist/sig/portable-key.test.mjs +6 -6
  83. package/dist/sig/proof.test.mjs +3 -3
  84. package/dist/{tasks-dbCShlCb.mjs → tasks-IG3pHfvZ.mjs} +1 -1
  85. package/dist/{temporal-CFI__wjQ.mjs → temporal-q6FSekcN.mjs} +1 -1
  86. package/dist/testing/context.test.mjs +1 -1
  87. package/dist/testing/kv.test.mjs +3 -3
  88. package/dist/testing/mod.d.mts +393 -4
  89. package/dist/testing/mod.mjs +4 -4
  90. package/dist/{testing-otQhu4aD.mjs → testing-C1itIjqW.mjs} +3 -3
  91. package/dist/{types-C_cNlNVK.js → types-_S2_MeLF.js} +7 -3
  92. package/dist/{types-Be2zbyeG.cjs → types-poIao40f.cjs} +7 -3
  93. package/dist/utils/docloader.test.mjs +297 -2
  94. package/dist/utils/kv-cache.test.mjs +1 -1
  95. package/dist/utils/mod.cjs +1 -1
  96. package/dist/utils/mod.d.cts +1 -1
  97. package/dist/utils/mod.d.ts +1 -1
  98. package/dist/utils/mod.js +1 -1
  99. package/dist/vocab/cjs.test.mjs +1 -1
  100. package/package.json +7 -7
  101. package/dist/docloader-C4h6PL7m.mjs +0 -53
@@ -2,15 +2,15 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
- import { r as createRequestContext, t as createInboxContext } from "../context-DfSVPcJ8.mjs";
5
+ import { r as createRequestContext, t as createInboxContext } from "../context-B2rlkkyJ.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
7
7
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
8
8
  import "../std__assert-DvMDRPes.mjs";
9
9
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
10
- import { p as signJsonLd } from "../ld-YYBfDbe_.mjs";
11
- import { l as signRequest } from "../http-BoH-e8sR.mjs";
10
+ import { p as signJsonLd } from "../ld-lU_ZqzsQ.mjs";
11
+ import { l as signRequest } from "../http-CGcLv8rh.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
13
- import { f as handleInbox, n as FederationImpl, o as createFederation } from "../middleware-CBGR92fz.mjs";
13
+ import { f as handleInbox, n as FederationImpl, o as createFederation } from "../middleware-xdukzV3x.mjs";
14
14
  import { t as ActivityListenerSet } from "../activity-listener-C-BSbKI7.mjs";
15
15
  import { t as KvKeyCache } from "../keycache-BInaECGj.mjs";
16
16
  import { Create, CryptographicKey, Person } from "@fedify/vocab";
@@ -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-YYBfDbe_.mjs";
12
- import { i as signObject } from "../proof-DWkXfZIU.mjs";
13
- import { f as verifyRequestDetailed, l as signRequest } from "../http-BoH-e8sR.mjs";
11
+ import { p as signJsonLd } from "../ld-lU_ZqzsQ.mjs";
12
+ import { a as signObject } from "../proof-C2YwD8a_.mjs";
13
+ import { f as verifyRequestDetailed, l as signRequest } from "../http-CGcLv8rh.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-CBGR92fz.mjs";
15
+ import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-xdukzV3x.mjs";
16
16
  import { Create, CryptographicKey, Follow, Note, Person, Tombstone } from "@fedify/vocab";
17
17
  import { mockDocumentLoader, test } from "@fedify/fixture";
18
18
  import { exportDidKey, formatIri, parseIri } from "@fedify/vocab-runtime";
@@ -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 { i as signObject, s as verifyPortableObjectProof } from "../proof-DWkXfZIU.mjs";
12
- import { l as signRequest } from "../http-BoH-e8sR.mjs";
11
+ import { a as signObject, c as verifyPortableObjectProof } from "../proof-C2YwD8a_.mjs";
12
+ import { l as signRequest } from "../http-CGcLv8rh.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-CBGR92fz.mjs";
14
+ import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-xdukzV3x.mjs";
15
15
  import { configure, reset } from "@logtape/logtape";
16
16
  import { Collection, Create, Note, Object as Object$1, Person, Tombstone, lookupObject } from "@fedify/vocab";
17
17
  import { mockDocumentLoader, test } from "@fedify/fixture";
@@ -661,7 +661,7 @@ test("Federation.fetch() serves compatible-ID actors", async (t) => {
661
661
  id,
662
662
  preferredUsername: name,
663
663
  inbox: new URL(`${id.href}/inbox`),
664
- followers: new URL(`${id.href}/followers`),
664
+ followers: toCompatibleEf61Id(ctx.getPortableFollowersUri(name, did), "https://example.com"),
665
665
  gateways: gateways.map((g) => new URL(g))
666
666
  }));
667
667
  };
@@ -10,13 +10,14 @@ 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 { d as verifyRequest } from "../http-BoH-e8sR.mjs";
13
+ import { d as verifyRequest } from "../http-CGcLv8rh.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-Cn6CFYBy.mjs";
16
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-BQDT_8bc.mjs";
15
+ import { t as doesActorOwnKey } from "../owner-D63yPo_i.mjs";
16
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-D9SGhxTB.mjs";
17
17
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
18
18
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
19
19
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
20
+ import dns from "node:dns/promises";
20
21
  import { AggregationTemporality, InMemoryMetricExporter, MeterProvider, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
21
22
  //#region src/federation/send.test.ts
22
23
  test("extractInboxes()", () => {
@@ -690,5 +691,85 @@ for (const signed of [false, true]) {
690
691
  });
691
692
  });
692
693
  }
694
+ for (const signed of [false, true]) test({
695
+ name: `sendActivity() classifies DNS failures (signed: ${signed})`,
696
+ ignore: "Deno" in globalThis && (await Deno.permissions.query({ name: "net" })).state !== "granted",
697
+ async fn(t) {
698
+ const activity = {
699
+ type: "Create",
700
+ id: "https://example.com/activity"
701
+ };
702
+ const destination = "https://delivery.invalid/inbox";
703
+ const publicInbox = "https://8.8.8.8/inbox";
704
+ const keys = signed ? [{
705
+ privateKey: rsaPrivateKey2,
706
+ keyId: rsaPublicKey2.id
707
+ }] : [];
708
+ for (const result of [
709
+ "throws",
710
+ "empty",
711
+ "cname",
712
+ "private"
713
+ ]) for (const redirected of [false, true]) await t.step(`${result}, redirected: ${redirected}`, async () => {
714
+ const [meterProvider, recorder] = createTestMeterProvider();
715
+ const originalLookup = dns.lookup;
716
+ const resolverError = /* @__PURE__ */ new Error("Resolver unavailable");
717
+ const lookups = [];
718
+ dns.lookup = ((hostname, options) => {
719
+ lookups.push(hostname);
720
+ assertEquals(hostname, "delivery.invalid");
721
+ assertEquals(options, { all: true });
722
+ if (result === "throws") return Promise.reject(resolverError);
723
+ return Promise.resolve(result === "empty" ? [] : [{
724
+ address: result === "private" ? "127.0.0.1" : "alias.invalid.",
725
+ family: 4
726
+ }]);
727
+ });
728
+ try {
729
+ esm_default.mockGlobal().catch(202);
730
+ if (redirected) esm_default.route(publicInbox, {
731
+ status: 307,
732
+ headers: { Location: destination }
733
+ });
734
+ const send = () => sendActivity({
735
+ activity,
736
+ activityType: "https://www.w3.org/ns/activitystreams#Create",
737
+ meterProvider,
738
+ keys,
739
+ inbox: new URL(redirected ? publicInbox : destination)
740
+ });
741
+ if (result === "private") assertEquals((await assertRejects(send, UrlError)).reason, "disallowed");
742
+ else {
743
+ const error = await assertRejects(send, FetchError);
744
+ assertEquals(error.url.href, destination);
745
+ assertInstanceOf(error.cause, UrlError);
746
+ assertEquals(error.cause.reason, "dns");
747
+ assertEquals(error.cause.cause, result === "throws" ? resolverError : void 0);
748
+ }
749
+ const expectedCount = result === "private" && !redirected ? 0 : 1;
750
+ const sent = recorder.getMeasurements("activitypub.delivery.sent");
751
+ const durations = recorder.getMeasurements("activitypub.delivery.duration");
752
+ assertEquals(sent.length, expectedCount);
753
+ assertEquals(durations.length, expectedCount);
754
+ if (expectedCount === 1) {
755
+ assertEquals(sent[0].value, 1);
756
+ assertEquals(sent[0].attributes, {
757
+ "activitypub.remote.host": redirected ? "8.8.8.8" : "delivery.invalid",
758
+ "activitypub.activity.type": "https://www.w3.org/ns/activitystreams#Create",
759
+ "activitypub.delivery.success": false
760
+ });
761
+ assertEquals(durations[0].attributes, sent[0].attributes);
762
+ assertGreaterOrEqual(durations[0].value, 0);
763
+ }
764
+ assertEquals(lookups, ["delivery.invalid"]);
765
+ assertEquals(esm_default.callHistory.calls(destination).length, 0);
766
+ assertEquals(esm_default.callHistory.calls().length, redirected ? 1 : 0);
767
+ } finally {
768
+ dns.lookup = originalLookup;
769
+ esm_default.hardReset();
770
+ }
771
+ });
772
+ }
773
+ });
693
774
  //#endregion
694
775
  export {};
@@ -2,9 +2,9 @@ import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
5
- import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-dbCShlCb.mjs";
6
- import "../../testing-otQhu4aD.mjs";
7
- import { o as createFederation } from "../../middleware-CBGR92fz.mjs";
5
+ import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
6
+ import "../../testing-C1itIjqW.mjs";
7
+ import { o as createFederation } from "../../middleware-xdukzV3x.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";
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
5
- import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-dbCShlCb.mjs";
6
- import "../../testing-otQhu4aD.mjs";
7
- import { o as createFederation } from "../../middleware-CBGR92fz.mjs";
8
- import { r as createFederationBuilder } from "../../builder-W2fIPRjv.mjs";
5
+ import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
6
+ import "../../testing-C1itIjqW.mjs";
7
+ import { o as createFederation } from "../../middleware-xdukzV3x.mjs";
8
+ import { r as createFederationBuilder } from "../../builder-CLaS4-yA.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-CFI__wjQ.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-q6FSekcN.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 () => {
@@ -1,12 +1,12 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { r as createRequestContext } from "../context-DfSVPcJ8.mjs";
4
+ import { r as createRequestContext } from "../context-B2rlkkyJ.mjs";
5
5
  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-CBGR92fz.mjs";
9
+ import { o as createFederation, s as handleWebFinger } from "../middleware-xdukzV3x.mjs";
10
10
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
11
11
  import { createTestMeterProvider, test } from "@fedify/fixture";
12
12
  import { parseIri } from "@fedify/vocab-runtime";