@fedify/fedify 1.7.10 → 1.7.12

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 (98) hide show
  1. package/dist/{actor-m_MgQ1Da.js → actor-GZRoTRqg.js} +1059 -2276
  2. package/dist/{actor-C9RnX-Fl.js → actor-TYqJGdVq.js} +6 -9
  3. package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
  4. package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
  5. package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
  6. package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
  7. package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
  8. package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
  9. package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
  10. package/dist/{authdocloader-cdK4XSRT.js → authdocloader-BopfyipD.js} +3 -3
  11. package/dist/{authdocloader-7OXAs5XI.js → authdocloader-hiFSyM7V.js} +4 -4
  12. package/dist/{builder-C7nJE1zO.js → builder-mi6RdzNE.js} +7 -10
  13. package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
  14. package/dist/{client-DXIsEekV.js → client-DuUKk4pk.js} +6 -6
  15. package/dist/compat/transformers.test.js +27 -28
  16. package/dist/{context-Bts52fbz.js → context-RMU32mk4.js} +2 -2
  17. package/dist/{docloader-BK2Fp3AJ.js → docloader-DJxET2fN.js} +5 -9
  18. package/dist/{docloader-CgkbWVNz.js → docloader-bgBm1Hd1.js} +4 -6
  19. package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
  20. package/dist/federation/builder.test.js +23 -29
  21. package/dist/federation/collection.test.js +9 -9
  22. package/dist/federation/handler.test.js +33 -33
  23. package/dist/federation/inbox.test.js +10 -10
  24. package/dist/federation/keycache.test.js +9 -9
  25. package/dist/federation/kv.test.js +10 -9
  26. package/dist/federation/middleware.test.js +76 -99
  27. package/dist/federation/mod.js +11 -11
  28. package/dist/federation/mq.test.js +10 -11
  29. package/dist/federation/retry.test.js +3 -3
  30. package/dist/federation/router.test.js +9 -9
  31. package/dist/federation/send.test.js +22 -22
  32. package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
  33. package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +24 -0
  34. package/dist/{http-D1IBucdD.js → http-D2DkwsjA.js} +56 -17
  35. package/dist/{http-CwQqD0nE.js → http-vqMAvOVs.js} +56 -17
  36. package/dist/{inbox-BrMkm2b5.js → inbox-DAAZZl2k.js} +5 -7
  37. package/dist/key-5ssHQ67E.js +16 -0
  38. package/dist/{key-Do-Pud3s.js → key-DSJGnD10.js} +4 -4
  39. package/dist/{key-C6phFgFq.js → key-DmqJj57e.js} +5 -8
  40. package/dist/{key-DtQ4rLnr.js → key-KVhaUM92.js} +6 -9
  41. package/dist/{keycache-B_99o7Nj.js → keycache-C1pEuRyQ.js} +2 -2
  42. package/dist/{keys-BgLpfFXK.js → keys-C4XQHW5_.js} +1 -1
  43. package/dist/{ld-AzOj4-js.js → ld-DzlJ_IpT.js} +9 -16
  44. package/dist/{lookup-DJgGrigh.js → lookup-CSngxuWm.js} +2 -4
  45. package/dist/{lookup-CBbanOdu.js → lookup-D0je8AqR.js} +7 -11
  46. package/dist/{lookup-ChtUDlB-.js → lookup-DL62q3Xh.js} +3 -5
  47. package/dist/{middleware-BS_et69x.js → middleware-3wVT6S9E.js} +34 -52
  48. package/dist/middleware-CxFoFBD8.js +33 -0
  49. package/dist/{middleware-R0UobiAQ.js → middleware-DlDXugwZ.js} +34 -58
  50. package/dist/middleware-w7_U3fFi.js +17 -0
  51. package/dist/mod.js +11 -11
  52. package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
  53. package/dist/nodeinfo/client.test.js +20 -23
  54. package/dist/nodeinfo/handler.test.js +32 -32
  55. package/dist/nodeinfo/mod.js +2 -2
  56. package/dist/nodeinfo/semver.test.js +23 -30
  57. package/dist/nodeinfo/types.test.js +11 -11
  58. package/dist/{owner-Ces3Cs3s.js → owner-81ey_76X.js} +3 -3
  59. package/dist/{proof-BOQF8Trx.js → proof-BlULDH4H.js} +8 -14
  60. package/dist/{proof-BKV4HiE8.js → proof-DlI7QNdn.js} +12 -25
  61. package/dist/runtime/authdocloader.test.js +21 -21
  62. package/dist/runtime/docloader.test.js +16 -18
  63. package/dist/runtime/key.test.js +17 -17
  64. package/dist/runtime/langstr.test.js +9 -9
  65. package/dist/runtime/mod.js +6 -6
  66. package/dist/runtime/multibase/multibase.test.js +11 -12
  67. package/dist/runtime/url.test.js +6 -6
  68. package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
  69. package/dist/{send-aAmnTqe8.js → send-DdxfTHo6.js} +3 -4
  70. package/dist/sig/http.test.js +56 -54
  71. package/dist/sig/key.test.js +18 -18
  72. package/dist/sig/ld.test.js +20 -22
  73. package/dist/sig/mod.js +6 -6
  74. package/dist/sig/owner.test.js +20 -20
  75. package/dist/sig/proof.test.js +19 -19
  76. package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
  77. package/dist/testing/docloader.test.js +9 -9
  78. package/dist/testing/mod.js +1 -1
  79. package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
  80. package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
  81. package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
  82. package/dist/{types-DBIKpLqH.js → types-CmVV9LT1.js} +6 -8
  83. package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
  84. package/dist/vocab/actor.test.js +104 -156
  85. package/dist/vocab/lookup.test.js +17 -17
  86. package/dist/vocab/mod.js +4 -4
  87. package/dist/vocab/type.test.js +11 -15
  88. package/dist/vocab/vocab.test.js +45 -49
  89. package/dist/{vocab-F6vbRsQh.js → vocab-BebR0kAy.js} +6 -10
  90. package/dist/{vocab-BOerhowX.js → vocab-DFlq4Wa6.js} +1057 -2270
  91. package/dist/webfinger/handler.test.js +33 -34
  92. package/dist/webfinger/lookup.test.js +13 -13
  93. package/dist/webfinger/mod.js +2 -2
  94. package/dist/x/cfworkers.test.js +9 -9
  95. package/package.json +1 -1
  96. package/dist/key-ZtjFeVO8.js +0 -16
  97. package/dist/middleware-BVMzYv1x.js +0 -33
  98. package/dist/middleware-CnpuCK_K.js +0 -17
@@ -3,26 +3,26 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import "../docloader-CgkbWVNz.js";
11
- import "../url-kTAI6_KP.js";
12
- import { parseSemVer } from "../semver-DWClQt_5.js";
10
+ import "../docloader-bgBm1Hd1.js";
11
+ import "../url-C2xuoQD1.js";
12
+ import { parseSemVer } from "../semver-BNrOOAs9.js";
13
13
  import "../router-D_aVZZUc.js";
14
- import "../multibase-DeCHcK8L.js";
15
- import { Activity, Note, Person } from "../vocab-BOerhowX.js";
14
+ import "../multibase-CnLHszip.js";
15
+ import { Activity, Note, Person } from "../vocab-DFlq4Wa6.js";
16
16
  import "../langstr-DbWheeIS.js";
17
- import "../type-D2s5lmbZ.js";
18
- import "../inbox-BrMkm2b5.js";
19
- import { createFederationBuilder } from "../builder-C7nJE1zO.js";
20
- import { test } from "../testing-BZ0dJ4qn.js";
21
- import { assertExists } from "../std__assert-vp0TKMS1.js";
22
- import "../assert_rejects-C-sxEMM5.js";
23
- import "../assert_is_error-nrwA1GeT.js";
24
- import "../assert_not_equals-Dc7y-V5Q.js";
25
- import "../assert_throws-Cn9C6Jur.js";
17
+ import "../type-CFuiGLz9.js";
18
+ import "../inbox-DAAZZl2k.js";
19
+ import { createFederationBuilder } from "../builder-mi6RdzNE.js";
20
+ import { test } from "../testing-DLyvtiiW.js";
21
+ import { assertExists } from "../std__assert-o_r9vqm1.js";
22
+ import "../assert_rejects-DWQ4jaf9.js";
23
+ import "../assert_is_error-BTlryvT0.js";
24
+ import "../assert_not_equals-C685gKx6.js";
25
+ import "../assert_throws-YetpVSc-.js";
26
26
 
27
27
  //#region federation/builder.test.ts
28
28
  test("FederationBuilder", async (t) => {
@@ -34,8 +34,7 @@ test("FederationBuilder", async (t) => {
34
34
  };
35
35
  builder.setActorDispatcher("/users/{identifier}", actorDispatcher);
36
36
  const inboxListener = (_ctx, _activity) => {};
37
- const listeners = builder.setInboxListeners("/users/{identifier}/inbox");
38
- listeners.on(Activity, inboxListener);
37
+ builder.setInboxListeners("/users/{identifier}/inbox").on(Activity, inboxListener);
39
38
  const objectDispatcher = (_ctx, _values) => {
40
39
  return null;
41
40
  };
@@ -86,8 +85,7 @@ test("FederationBuilder", async (t) => {
86
85
  const kv = new MemoryKvStore();
87
86
  const federation = await builder.build({ kv });
88
87
  assertExists(federation);
89
- const impl = federation;
90
- assertEquals(impl.kv, kv);
88
+ assertEquals(federation.kv, kv);
91
89
  });
92
90
  await t.step("should pass build options correctly", async () => {
93
91
  const builder = createFederationBuilder();
@@ -112,22 +110,19 @@ test("FederationBuilder", async (t) => {
112
110
  const kv = new MemoryKvStore();
113
111
  const federationDefault = await builder.build({ kv });
114
112
  assertExists(federationDefault);
115
- const implDefault = federationDefault;
116
- assertEquals(implDefault.firstKnock, void 0);
113
+ assertEquals(federationDefault.firstKnock, void 0);
117
114
  const federationCustom = await builder.build({
118
115
  kv,
119
116
  firstKnock: "draft-cavage-http-signatures-12"
120
117
  });
121
118
  assertExists(federationCustom);
122
- const implCustom = federationCustom;
123
- assertEquals(implCustom.firstKnock, "draft-cavage-http-signatures-12");
119
+ assertEquals(federationCustom.firstKnock, "draft-cavage-http-signatures-12");
124
120
  const federationRfc = await builder.build({
125
121
  kv,
126
122
  firstKnock: "rfc9421"
127
123
  });
128
124
  assertExists(federationRfc);
129
- const implRfc = federationRfc;
130
- assertEquals(implRfc.firstKnock, "rfc9421");
125
+ assertEquals(federationRfc.firstKnock, "rfc9421");
131
126
  });
132
127
  await t.step("should register multiple object dispatchers and verify them", async () => {
133
128
  const builder = createFederationBuilder();
@@ -140,8 +135,7 @@ test("FederationBuilder", async (t) => {
140
135
  };
141
136
  builder.setObjectDispatcher(Note, "/notes/{id}", noteDispatcher);
142
137
  builder.setObjectDispatcher(Person, "/people/{id}", personDispatcher);
143
- const federation = await builder.build({ kv });
144
- const impl = federation;
138
+ const impl = await builder.build({ kv });
145
139
  assertExists(impl.objectCallbacks[Note.typeId.href]);
146
140
  assertExists(impl.objectCallbacks[Person.typeId.href]);
147
141
  const notePath = impl.router.build(`object:${Note.typeId.href}`, { id: "123" });
@@ -3,16 +3,16 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
9
  import { buildCollectionSynchronizationHeader, digest } from "../collection-Dfb0TPno.js";
10
- import { test } from "../testing-BZ0dJ4qn.js";
11
- import "../std__assert-vp0TKMS1.js";
12
- import "../assert_rejects-C-sxEMM5.js";
13
- import "../assert_is_error-nrwA1GeT.js";
14
- import "../assert_not_equals-Dc7y-V5Q.js";
15
- import "../assert_throws-Cn9C6Jur.js";
10
+ import { test } from "../testing-DLyvtiiW.js";
11
+ import "../std__assert-o_r9vqm1.js";
12
+ import "../assert_rejects-DWQ4jaf9.js";
13
+ import "../assert_is_error-BTlryvT0.js";
14
+ import "../assert_not_equals-C685gKx6.js";
15
+ import "../assert_throws-YetpVSc-.js";
16
16
  import { decodeHex } from "byte-encodings/hex";
17
17
 
18
18
  //#region federation/collection.test.ts
@@ -3,45 +3,45 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import { assert } from "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import { assert } from "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BS_et69x.js";
11
- import "../docloader-CgkbWVNz.js";
12
- import "../url-kTAI6_KP.js";
13
- import "../semver-DWClQt_5.js";
14
- import "../client-DXIsEekV.js";
10
+ import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-3wVT6S9E.js";
11
+ import "../docloader-bgBm1Hd1.js";
12
+ import "../url-C2xuoQD1.js";
13
+ import "../semver-BNrOOAs9.js";
14
+ import "../client-DuUKk4pk.js";
15
15
  import "../router-D_aVZZUc.js";
16
- import "../types-C7C_l-jz.js";
17
- import "../multibase-DeCHcK8L.js";
18
- import { Create, Note, Person } from "../vocab-BOerhowX.js";
16
+ import "../types-CJHS5pXl.js";
17
+ import "../multibase-CnLHszip.js";
18
+ import { Create, Note, Person } from "../vocab-DFlq4Wa6.js";
19
19
  import "../langstr-DbWheeIS.js";
20
- import "../lookup-ChtUDlB-.js";
21
- import "../type-D2s5lmbZ.js";
22
- import "../actor-C9RnX-Fl.js";
23
- import "../key-DtQ4rLnr.js";
24
- import { signRequest } from "../http-D1IBucdD.js";
25
- import "../authdocloader-7OXAs5XI.js";
26
- import "../ld-AzOj4-js.js";
27
- import "../owner-Ces3Cs3s.js";
28
- import "../proof-BOQF8Trx.js";
29
- import "../lookup-CBbanOdu.js";
30
- import { InboxListenerSet } from "../inbox-BrMkm2b5.js";
31
- import "../builder-C7nJE1zO.js";
20
+ import "../lookup-DL62q3Xh.js";
21
+ import "../type-CFuiGLz9.js";
22
+ import "../actor-TYqJGdVq.js";
23
+ import "../key-KVhaUM92.js";
24
+ import { signRequest } from "../http-D2DkwsjA.js";
25
+ import "../authdocloader-hiFSyM7V.js";
26
+ import "../ld-DzlJ_IpT.js";
27
+ import "../owner-81ey_76X.js";
28
+ import "../proof-BlULDH4H.js";
29
+ import "../lookup-D0je8AqR.js";
30
+ import { InboxListenerSet } from "../inbox-DAAZZl2k.js";
31
+ import "../builder-mi6RdzNE.js";
32
32
  import "../collection-Dfb0TPno.js";
33
- import "../keycache-B_99o7Nj.js";
33
+ import "../keycache-C1pEuRyQ.js";
34
34
  import "../retry-BiIhZWgD.js";
35
- import "../send-aAmnTqe8.js";
36
- import { test } from "../testing-BZ0dJ4qn.js";
37
- import "../std__assert-vp0TKMS1.js";
38
- import { assertFalse } from "../assert_rejects-C-sxEMM5.js";
39
- import "../assert_is_error-nrwA1GeT.js";
40
- import "../assert_not_equals-Dc7y-V5Q.js";
41
- import "../assert_throws-Cn9C6Jur.js";
35
+ import "../send-DdxfTHo6.js";
36
+ import { test } from "../testing-DLyvtiiW.js";
37
+ import "../std__assert-o_r9vqm1.js";
38
+ import { assertFalse } from "../assert_rejects-DWQ4jaf9.js";
39
+ import "../assert_is_error-BTlryvT0.js";
40
+ import "../assert_not_equals-C685gKx6.js";
41
+ import "../assert_throws-YetpVSc-.js";
42
42
  import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
43
- import { createInboxContext, createRequestContext } from "../context-Bts52fbz.js";
44
- import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-BgLpfFXK.js";
43
+ import { createInboxContext, createRequestContext } from "../context-RMU32mk4.js";
44
+ import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-C4XQHW5_.js";
45
45
 
46
46
  //#region federation/handler.test.ts
47
47
  test("acceptsJsonLd()", () => {
@@ -3,17 +3,17 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../docloader-CgkbWVNz.js";
8
- import "../url-kTAI6_KP.js";
9
- import "../multibase-DeCHcK8L.js";
10
- import { Activity, Create, Invite, Offer, Update } from "../vocab-BOerhowX.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../docloader-bgBm1Hd1.js";
8
+ import "../url-C2xuoQD1.js";
9
+ import "../multibase-CnLHszip.js";
10
+ import { Activity, Create, Invite, Offer, Update } from "../vocab-DFlq4Wa6.js";
11
11
  import "../langstr-DbWheeIS.js";
12
- import "../type-D2s5lmbZ.js";
13
- import { InboxListenerSet } from "../inbox-BrMkm2b5.js";
14
- import { test } from "../testing-BZ0dJ4qn.js";
15
- import "../assert_is_error-nrwA1GeT.js";
16
- import { assertThrows } from "../assert_throws-Cn9C6Jur.js";
12
+ import "../type-CFuiGLz9.js";
13
+ import { InboxListenerSet } from "../inbox-DAAZZl2k.js";
14
+ import { test } from "../testing-DLyvtiiW.js";
15
+ import "../assert_is_error-BTlryvT0.js";
16
+ import { assertThrows } from "../assert_throws-YetpVSc-.js";
17
17
 
18
18
  //#region federation/inbox.test.ts
19
19
  test("InboxListenerSet", () => {
@@ -3,17 +3,17 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import { assert } from "../assert-DmFG7ppO.js";
8
- import { assertInstanceOf } from "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import { assert } from "../assert-LOEeCUK5.js";
8
+ import { assertInstanceOf } from "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import "../docloader-CgkbWVNz.js";
11
- import "../url-kTAI6_KP.js";
12
- import "../multibase-DeCHcK8L.js";
13
- import { CryptographicKey, Multikey } from "../vocab-BOerhowX.js";
10
+ import "../docloader-bgBm1Hd1.js";
11
+ import "../url-C2xuoQD1.js";
12
+ import "../multibase-CnLHszip.js";
13
+ import { CryptographicKey, Multikey } from "../vocab-DFlq4Wa6.js";
14
14
  import "../langstr-DbWheeIS.js";
15
- import { KvKeyCache } from "../keycache-B_99o7Nj.js";
16
- import { test } from "../testing-BZ0dJ4qn.js";
15
+ import { KvKeyCache } from "../keycache-C1pEuRyQ.js";
16
+ import { test } from "../testing-DLyvtiiW.js";
17
17
 
18
18
  //#region federation/keycache.test.ts
19
19
  test("KvKeyCache.set()", async () => {
@@ -3,16 +3,16 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import { test } from "../testing-BZ0dJ4qn.js";
11
- import "../std__assert-vp0TKMS1.js";
12
- import "../assert_rejects-C-sxEMM5.js";
13
- import "../assert_is_error-nrwA1GeT.js";
14
- import "../assert_not_equals-Dc7y-V5Q.js";
15
- import "../assert_throws-Cn9C6Jur.js";
10
+ import { test } from "../testing-DLyvtiiW.js";
11
+ import "../std__assert-o_r9vqm1.js";
12
+ import "../assert_rejects-DWQ4jaf9.js";
13
+ import "../assert_is_error-BTlryvT0.js";
14
+ import "../assert_not_equals-C685gKx6.js";
15
+ import "../assert_throws-YetpVSc-.js";
16
16
 
17
17
  //#region federation/kv.test.ts
18
18
  test("MemoryKvStore", async (t) => {
@@ -22,6 +22,7 @@ test("MemoryKvStore", async (t) => {
22
22
  assertEquals(await store.get(["foo", "bar"]), "foobar");
23
23
  assertEquals(await store.get(["foo"]), void 0);
24
24
  await store.set(["foo", "baz"], "baz", { ttl: Temporal.Duration.from({ seconds: 0 }) });
25
+ await new Promise((resolve) => setTimeout(resolve, 10));
25
26
  assertEquals(await store.get(["foo", "baz"]), void 0);
26
27
  });
27
28
  await t.step("delete()", async () => {
@@ -3,45 +3,45 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import { assert } from "../assert-DmFG7ppO.js";
8
- import { assertInstanceOf } from "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import { assert } from "../assert-LOEeCUK5.js";
8
+ import { assertInstanceOf } from "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-BS_et69x.js";
11
- import { FetchError, fetchDocumentLoader } from "../docloader-CgkbWVNz.js";
12
- import "../url-kTAI6_KP.js";
13
- import "../semver-DWClQt_5.js";
14
- import "../client-DXIsEekV.js";
10
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-3wVT6S9E.js";
11
+ import { FetchError, fetchDocumentLoader } from "../docloader-bgBm1Hd1.js";
12
+ import "../url-C2xuoQD1.js";
13
+ import "../semver-BNrOOAs9.js";
14
+ import "../client-DuUKk4pk.js";
15
15
  import { RouterError } from "../router-D_aVZZUc.js";
16
- import "../types-C7C_l-jz.js";
17
- import "../multibase-DeCHcK8L.js";
18
- import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person } from "../vocab-BOerhowX.js";
16
+ import "../types-CJHS5pXl.js";
17
+ import "../multibase-CnLHszip.js";
18
+ import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person } from "../vocab-DFlq4Wa6.js";
19
19
  import "../langstr-DbWheeIS.js";
20
- import "../lookup-ChtUDlB-.js";
21
- import { getTypeId } from "../type-D2s5lmbZ.js";
22
- import "../actor-C9RnX-Fl.js";
23
- import "../key-DtQ4rLnr.js";
24
- import { signRequest, verifyRequest } from "../http-D1IBucdD.js";
25
- import { getAuthenticatedDocumentLoader } from "../authdocloader-7OXAs5XI.js";
26
- import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-AzOj4-js.js";
27
- import { doesActorOwnKey } from "../owner-Ces3Cs3s.js";
28
- import { signObject, verifyObject } from "../proof-BOQF8Trx.js";
29
- import { lookupObject } from "../lookup-CBbanOdu.js";
30
- import "../inbox-BrMkm2b5.js";
31
- import "../builder-C7nJE1zO.js";
20
+ import "../lookup-DL62q3Xh.js";
21
+ import { getTypeId } from "../type-CFuiGLz9.js";
22
+ import "../actor-TYqJGdVq.js";
23
+ import "../key-KVhaUM92.js";
24
+ import { signRequest, verifyRequest } from "../http-D2DkwsjA.js";
25
+ import { getAuthenticatedDocumentLoader } from "../authdocloader-hiFSyM7V.js";
26
+ import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-DzlJ_IpT.js";
27
+ import { doesActorOwnKey } from "../owner-81ey_76X.js";
28
+ import { signObject, verifyObject } from "../proof-BlULDH4H.js";
29
+ import { lookupObject } from "../lookup-D0je8AqR.js";
30
+ import "../inbox-DAAZZl2k.js";
31
+ import "../builder-mi6RdzNE.js";
32
32
  import "../collection-Dfb0TPno.js";
33
- import "../keycache-B_99o7Nj.js";
33
+ import "../keycache-C1pEuRyQ.js";
34
34
  import "../retry-BiIhZWgD.js";
35
- import "../send-aAmnTqe8.js";
36
- import { test } from "../testing-BZ0dJ4qn.js";
37
- import { assertStrictEquals } from "../std__assert-vp0TKMS1.js";
38
- import { assertFalse, assertRejects } from "../assert_rejects-C-sxEMM5.js";
39
- import "../assert_is_error-nrwA1GeT.js";
40
- import { assertNotEquals } from "../assert_not_equals-Dc7y-V5Q.js";
41
- import { assertThrows } from "../assert_throws-Cn9C6Jur.js";
35
+ import "../send-DdxfTHo6.js";
36
+ import { test } from "../testing-DLyvtiiW.js";
37
+ import { assertStrictEquals } from "../std__assert-o_r9vqm1.js";
38
+ import { assertFalse, assertRejects } from "../assert_rejects-DWQ4jaf9.js";
39
+ import "../assert_is_error-BTlryvT0.js";
40
+ import { assertNotEquals } from "../assert_not_equals-C685gKx6.js";
41
+ import { assertThrows } from "../assert_throws-YetpVSc-.js";
42
42
  import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
43
- import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-BgLpfFXK.js";
44
- import { esm_default } from "../esm-Db4De7AS.js";
43
+ import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-C4XQHW5_.js";
44
+ import { esm_default } from "../esm-DO9PrujO.js";
45
45
 
46
46
  //#region testing/fixtures/example.com/person.json
47
47
  var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
@@ -356,12 +356,11 @@ test("Federation.createContext()", async (t) => {
356
356
  assertEquals(await ctx.lookupObject("https://example.com/object"), null);
357
357
  await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new Create({})), TypeError, "The activity to send must have at least one actor property.");
358
358
  await ctx.sendActivity({ identifier: "handle" }, [], new Create({ actor: new URL("https://example.com/users/handle") }));
359
- const federation2 = createFederation({
359
+ const ctx2 = createFederation({
360
360
  kv,
361
361
  documentLoader: mockDocumentLoader,
362
362
  contextLoader: mockDocumentLoader
363
- });
364
- const ctx2 = federation2.createContext(new URL("https://example.com/"), 123);
363
+ }).createContext(new URL("https://example.com/"), 123);
365
364
  assertEquals(await ctx2.lookupObject("https://example.com/object"), new Object$1({
366
365
  id: new URL("https://example.com/object"),
367
366
  name: "Fetched object"
@@ -617,8 +616,7 @@ test("Federation.createContext()", async (t) => {
617
616
  });
618
617
  });
619
618
  await t.step("Context.clone()", () => {
620
- const federation = createFederation({ kv });
621
- const ctx = federation.createContext(new URL("https://example.com/"), 123);
619
+ const ctx = createFederation({ kv }).createContext(new URL("https://example.com/"), 123);
622
620
  const clone = ctx.clone(456);
623
621
  assertStrictEquals(clone.canonicalOrigin, ctx.canonicalOrigin);
624
622
  assertStrictEquals(clone.origin, ctx.origin);
@@ -654,11 +652,10 @@ test("Federation.createContext()", async (t) => {
654
652
  }));
655
653
  });
656
654
  await t.step("Context.lookupNodeInfo()", async () => {
657
- const federation = createFederation({
655
+ const ctx = createFederation({
658
656
  kv,
659
657
  userAgent: "CustomUserAgent/1.2.3"
660
- });
661
- const ctx = federation.createContext(new URL("https://example.com/"), 123);
658
+ }).createContext(new URL("https://example.com/"), 123);
662
659
  const nodeInfo = await ctx.lookupNodeInfo("https://example.com/");
663
660
  assertEquals(nodeInfo, {
664
661
  software: {
@@ -923,8 +920,7 @@ test("Federation.setInboxListeners()", async (t) => {
923
920
  authenticatedDocumentLoaderFactory(identity) {
924
921
  const docLoader = getAuthenticatedDocumentLoader(identity);
925
922
  return (url) => {
926
- const urlObj = new URL(url);
927
- if (urlObj.host === "example.com") return docLoader(url);
923
+ if (new URL(url).host === "example.com") return docLoader(url);
928
924
  return mockDocumentLoader(url);
929
925
  };
930
926
  }
@@ -1072,19 +1068,18 @@ test("FederationImpl.processQueuedTask()", async (t) => {
1072
1068
  await t.step("with MessageQueue having nativeRetrial", async () => {
1073
1069
  const kv = new MemoryKvStore();
1074
1070
  const queuedMessages = [];
1075
- const queue = {
1076
- nativeRetrial: true,
1077
- enqueue(message, _options) {
1078
- queuedMessages.push(message);
1079
- return Promise.resolve();
1080
- },
1081
- listen(_handler, _options) {
1082
- return Promise.resolve();
1083
- }
1084
- };
1085
1071
  const federation = new FederationImpl({
1086
1072
  kv,
1087
- queue
1073
+ queue: {
1074
+ nativeRetrial: true,
1075
+ enqueue(message, _options) {
1076
+ queuedMessages.push(message);
1077
+ return Promise.resolve();
1078
+ },
1079
+ listen(_handler, _options) {
1080
+ return Promise.resolve();
1081
+ }
1082
+ }
1088
1083
  });
1089
1084
  federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
1090
1085
  throw new Error("Intended error for testing");
@@ -1135,18 +1130,17 @@ test("FederationImpl.processQueuedTask()", async (t) => {
1135
1130
  await t.step("with MessageQueue having no nativeRetrial", async () => {
1136
1131
  const kv = new MemoryKvStore();
1137
1132
  let queuedMessages = [];
1138
- const queue = {
1139
- enqueue(message, _options) {
1140
- queuedMessages.push(message);
1141
- return Promise.resolve();
1142
- },
1143
- listen(_handler, _options) {
1144
- return Promise.resolve();
1145
- }
1146
- };
1147
1133
  const federation = new FederationImpl({
1148
1134
  kv,
1149
- queue
1135
+ queue: {
1136
+ enqueue(message, _options) {
1137
+ queuedMessages.push(message);
1138
+ return Promise.resolve();
1139
+ },
1140
+ listen(_handler, _options) {
1141
+ return Promise.resolve();
1142
+ }
1143
+ }
1150
1144
  });
1151
1145
  federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
1152
1146
  throw new Error("Intended error for testing");
@@ -1227,23 +1221,19 @@ test("ContextImpl.lookupObject()", async (t) => {
1227
1221
  }
1228
1222
  });
1229
1223
  await t.step("allowPrivateAddress: true", async () => {
1230
- const federation = createFederation({
1224
+ const result = await createFederation({
1231
1225
  kv: new MemoryKvStore(),
1232
1226
  allowPrivateAddress: true
1233
- });
1234
- const ctx = federation.createContext(new URL("https://example.com/"));
1235
- const result = await ctx.lookupObject("@test@localhost");
1227
+ }).createContext(new URL("https://example.com/")).lookupObject("@test@localhost");
1236
1228
  assertInstanceOf(result, Person);
1237
1229
  assertEquals(result.id, new URL("https://localhost/actor"));
1238
1230
  assertEquals(result.preferredUsername, "test");
1239
1231
  });
1240
1232
  await t.step("allowPrivateAddress: false", async () => {
1241
- const federation = createFederation({
1233
+ const result = await createFederation({
1242
1234
  kv: new MemoryKvStore(),
1243
1235
  allowPrivateAddress: false
1244
- });
1245
- const ctx = federation.createContext(new URL("https://example.com/"));
1246
- const result = await ctx.lookupObject("@test@localhost");
1236
+ }).createContext(new URL("https://example.com/")).lookupObject("@test@localhost");
1247
1237
  assertEquals(result, null);
1248
1238
  });
1249
1239
  esm_default.hardReset();
@@ -1270,11 +1260,9 @@ test("ContextImpl.sendActivity()", async (t) => {
1270
1260
  contextLoader: mockDocumentLoader,
1271
1261
  keyCache: {
1272
1262
  async get(keyId) {
1273
- const ctx = federation.createContext(new URL("https://example.com/"), void 0);
1274
- const keys = await ctx.getActorKeyPairs("1");
1263
+ const keys = await federation.createContext(new URL("https://example.com/"), void 0).getActorKeyPairs("1");
1275
1264
  for (const key$1 of keys) if (key$1.keyId.href === keyId.href) if (key$1.publicKey.algorithm.name === "Ed25519") return key$1.multikey;
1276
1265
  else return key$1.cryptographicKey;
1277
- return void 0;
1278
1266
  },
1279
1267
  async set(_keyId, _key) {}
1280
1268
  }
@@ -1648,20 +1636,18 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
1648
1636
  contextLoader: mockDocumentLoader
1649
1637
  });
1650
1638
  await t.step("skip", async () => {
1651
- const activity = {
1639
+ await new InboxContextImpl(null, {
1652
1640
  "@context": "https://www.w3.org/ns/activitystreams",
1653
1641
  "type": "Create",
1654
1642
  "id": "https://example.com/activity",
1655
1643
  "actor": "https://example.com/person2"
1656
- };
1657
- const ctx = new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
1644
+ }, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
1658
1645
  data: void 0,
1659
1646
  federation,
1660
1647
  url: new URL("https://example.com/"),
1661
1648
  documentLoader: fetchDocumentLoader,
1662
1649
  contextLoader: fetchDocumentLoader
1663
- });
1664
- await ctx.forwardActivity([{
1650
+ }).forwardActivity([{
1665
1651
  privateKey: rsaPrivateKey2,
1666
1652
  keyId: rsaPublicKey2.id
1667
1653
  }], {
@@ -1671,13 +1657,12 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
1671
1657
  assertEquals(verified, null);
1672
1658
  });
1673
1659
  await t.step("unsigned", async () => {
1674
- const activity = {
1660
+ const ctx = new InboxContextImpl(null, {
1675
1661
  "@context": "https://www.w3.org/ns/activitystreams",
1676
1662
  "type": "Create",
1677
1663
  "id": "https://example.com/activity",
1678
1664
  "actor": "https://example.com/person2"
1679
- };
1680
- const ctx = new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
1665
+ }, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
1681
1666
  data: void 0,
1682
1667
  federation,
1683
1668
  url: new URL("https://example.com/"),
@@ -1701,14 +1686,13 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
1701
1686
  contextLoader: mockDocumentLoader,
1702
1687
  documentLoader: mockDocumentLoader
1703
1688
  });
1704
- const ctx = new InboxContextImpl(null, await activity.toJsonLd({ contextLoader: mockDocumentLoader }), activity.id?.href, getTypeId(activity).href, {
1689
+ await new InboxContextImpl(null, await activity.toJsonLd({ contextLoader: mockDocumentLoader }), activity.id?.href, getTypeId(activity).href, {
1705
1690
  data: void 0,
1706
1691
  federation,
1707
1692
  url: new URL("https://example.com/"),
1708
1693
  documentLoader: fetchDocumentLoader,
1709
1694
  contextLoader: fetchDocumentLoader
1710
- });
1711
- await ctx.forwardActivity([{
1695
+ }).forwardActivity([{
1712
1696
  privateKey: rsaPrivateKey2,
1713
1697
  keyId: rsaPublicKey2.id
1714
1698
  }], {
@@ -1724,14 +1708,13 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
1724
1708
  "id": "https://example.com/activity",
1725
1709
  "actor": "https://example.com/person2"
1726
1710
  }, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader });
1727
- const ctx = new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
1711
+ await new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
1728
1712
  data: void 0,
1729
1713
  federation,
1730
1714
  url: new URL("https://example.com/"),
1731
1715
  documentLoader: fetchDocumentLoader,
1732
1716
  contextLoader: fetchDocumentLoader
1733
- });
1734
- await ctx.forwardActivity([{
1717
+ }).forwardActivity([{
1735
1718
  privateKey: rsaPrivateKey2,
1736
1719
  keyId: rsaPublicKey2.id
1737
1720
  }], {
@@ -1745,22 +1728,17 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
1745
1728
  test("KvSpecDeterminer", async (t) => {
1746
1729
  await t.step("should use default spec when not found in KV", async () => {
1747
1730
  const kv = new MemoryKvStore();
1748
- const prefix = ["test", "spec"];
1749
- const determiner = new KvSpecDeterminer(kv, prefix);
1750
- const spec = await determiner.determineSpec("example.com");
1731
+ const spec = await new KvSpecDeterminer(kv, ["test", "spec"]).determineSpec("example.com");
1751
1732
  assertEquals(spec, "rfc9421");
1752
1733
  });
1753
1734
  await t.step("should use custom default spec", async () => {
1754
1735
  const kv = new MemoryKvStore();
1755
- const prefix = ["test", "spec"];
1756
- const determiner = new KvSpecDeterminer(kv, prefix, "draft-cavage-http-signatures-12");
1757
- const spec = await determiner.determineSpec("example.com");
1736
+ const spec = await new KvSpecDeterminer(kv, ["test", "spec"], "draft-cavage-http-signatures-12").determineSpec("example.com");
1758
1737
  assertEquals(spec, "draft-cavage-http-signatures-12");
1759
1738
  });
1760
1739
  await t.step("should remember and retrieve spec from KV", async () => {
1761
1740
  const kv = new MemoryKvStore();
1762
- const prefix = ["test", "spec"];
1763
- const determiner = new KvSpecDeterminer(kv, prefix);
1741
+ const determiner = new KvSpecDeterminer(kv, ["test", "spec"]);
1764
1742
  await determiner.rememberSpec("example.com", "draft-cavage-http-signatures-12");
1765
1743
  const spec = await determiner.determineSpec("example.com");
1766
1744
  assertEquals(spec, "draft-cavage-http-signatures-12");
@@ -1769,8 +1747,7 @@ test("KvSpecDeterminer", async (t) => {
1769
1747
  });
1770
1748
  await t.step("should override remembered spec", async () => {
1771
1749
  const kv = new MemoryKvStore();
1772
- const prefix = ["test", "spec"];
1773
- const determiner = new KvSpecDeterminer(kv, prefix);
1750
+ const determiner = new KvSpecDeterminer(kv, ["test", "spec"]);
1774
1751
  await determiner.rememberSpec("example.com", "draft-cavage-http-signatures-12");
1775
1752
  let spec = await determiner.determineSpec("example.com");
1776
1753
  assertEquals(spec, "draft-cavage-http-signatures-12");