@fedify/fedify 2.0.0-pr.412.1559 → 2.0.0-pr.412.1794
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 +3 -0
- package/dist/{actor-Cc6B76eG.js → actor-BXHc5r-q.js} +1 -1
- package/dist/actor-Ba9Z1eNJ.cjs +42079 -0
- package/dist/{actor-C22bXuuC.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-CTAuCsWy.js → actor-DzhunPC_.js} +7058 -2722
- package/dist/actor-f2NtjyCg.d.cts +128 -0
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-BOEBObR8.js → builder-u7usRsT3.js} +13 -8
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/client-94iWEfQa.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-BsGzbnV-.d.ts} +3 -75
- package/dist/{client-De-z2UnN.js → client-pY7-3icS.js} +3 -22
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +12 -0
- package/dist/compat/mod.d.ts +11 -12
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +20 -20
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-9gCpIkiz.d.ts → context-DG0huGW-.d.ts} +184 -127
- package/dist/context-DJ8aSy2Q.d.cts +2312 -0
- package/dist/{authdocloader-CLgDGafZ.js → docloader-CrbAy9Oc.js} +17 -8
- package/dist/{esm-CHdxdkuH.js → esm-C-Qa1zEM.js} +11 -11
- package/dist/federation/builder.test.js +9 -12
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +27 -148
- package/dist/federation/idempotency.test.js +201 -0
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +7 -8
- package/dist/federation/middleware.test.js +242 -64
- package/dist/federation/mod.cjs +27 -0
- package/dist/federation/mod.d.cts +12 -0
- package/dist/federation/mod.d.ts +12 -13
- package/dist/federation/mod.js +13 -15
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +26 -0
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/federation-CRpdnOMS.cjs +244 -0
- package/dist/{federation-CMX7WzeL.js → federation-jcR8-ZxP.js} +3 -3
- package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
- package/dist/{http-DqSNLFNY.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/{http-l0TEupZK.js → http-CUVx-vzb.js} +260 -10
- package/dist/{http-CcdM1brU.js → http-D2kIm9la.js} +3 -3
- package/dist/http-Dofes42e.cjs +1106 -0
- package/dist/http-M8k5mKc0.d.cts +253 -0
- package/dist/{inbox-B6DZbGNf.js → inbox-HjG5peXY.js} +24 -7
- package/dist/{key-CzLv1phF.js → key-CxdLUFS6.js} +3 -2
- package/dist/{keycache-B8HdZJSt.js → keycache-bU7COwsh.js} +1 -1
- package/dist/{keys-zZwiKkfx.js → keys-DMHs8XNn.js} +2 -1
- package/dist/kv-Bxr0Q87_.d.cts +81 -0
- package/dist/kv-cache-CGXcDejL.js +122 -0
- package/dist/kv-cache-DN9pfMBe.js +94 -0
- package/dist/kv-cache-Dkvbn6rg.cjs +134 -0
- package/dist/{ld-CBcQdZ6N.js → ld-CIhvSCCr.js} +5 -4
- package/dist/lookup-CHkCVZTU.js +260 -0
- package/dist/lookup-CfFkONZD.cjs +272 -0
- package/dist/{type-SK-d7Tbw.js → lookup-DQRtjvb1.js} +7266 -7087
- package/dist/middleware-Bot7EEwV.js +26 -0
- package/dist/middleware-CFJgmUMW.cjs +15 -0
- package/dist/{middleware-BRgu1IH8.js → middleware-CJlj5Olw.js} +86 -181
- package/dist/middleware-CjHl2NHA.js +15 -0
- package/dist/middleware-D74TgW2E.cjs +4225 -0
- package/dist/{middleware-CxEkcFW0.js → middleware-DMk2Mdn9.js} +117 -127
- package/dist/mod-0noXw66R.d.cts +107 -0
- package/dist/mod-B-hUPT2N.d.cts +1 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-B2iOw50L.d.ts} +3 -3
- package/dist/mod-B9M-8jm2.d.ts +109 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-BlVovdcy.d.ts} +20 -2
- package/dist/{mod-Bqxcp7eN.d.ts → mod-BoHnwOCs.d.ts} +2 -2
- package/dist/mod-BxRCHTz-.d.cts +307 -0
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/mod-C58MZ7Wx.d.cts +113 -0
- package/dist/mod-DJcZDvjA.d.cts +80 -0
- package/dist/mod-DgdBYYa0.d.cts +266 -0
- package/dist/{mod-DBzN0aCM.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
- package/dist/mod.cjs +137 -0
- package/dist/mod.d.cts +16 -0
- package/dist/mod.d.ts +16 -17
- package/dist/mod.js +19 -21
- package/dist/mq-DcJPkXD5.d.cts +140 -0
- package/dist/negotiation-C4nFufNk.js +71 -0
- package/dist/nodeinfo/client.test.js +30 -111
- package/dist/nodeinfo/handler.test.js +25 -26
- package/dist/nodeinfo/mod.cjs +10 -0
- package/dist/nodeinfo/mod.d.cts +3 -0
- package/dist/nodeinfo/mod.d.ts +3 -5
- package/dist/nodeinfo/mod.js +6 -7
- package/dist/nodeinfo/types.test.js +8 -15
- package/dist/nodeinfo-BnthBobC.js +4 -0
- package/dist/nodeinfo-CdN0rEnZ.cjs +4 -0
- package/dist/owner-B4HbyP8s.d.cts +67 -0
- package/dist/{owner-VEIjmR8r.js → owner-Dvh7mBvr.js} +3 -2
- package/dist/{owner-CQPnQVtf.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/proof-D0uThUvD.cjs +674 -0
- package/dist/{proof-DoSQAGkE.js → proof-Dgy35fzc.js} +3 -3
- package/dist/{proof-tgUlT8hw.js → proof-fqzaMJ4g.js} +11 -10
- package/dist/{send-BzS7w-QF.js → send-Drp20VO9.js} +2 -2
- package/dist/sig/http.test.js +13 -14
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +28 -0
- package/dist/sig/mod.d.cts +6 -0
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +8 -10
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/sig-C34-oHBl.js +4 -0
- package/dist/sig-YYj5tCnr.cjs +4 -0
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +387 -224
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-Z2omCvKy.js → testing-g4UC4liW.js} +1 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{types-DgPvoUWN.js → types-BtUjyi5y.js} +8 -169
- package/dist/{types-BIgY6c-l.js → types-C2XVl6gj.js} +1 -3
- package/dist/types-CWgzGaqk.cjs +315 -0
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +14 -15
- package/dist/utils/kv-cache.test.js +209 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/utils-D-Va7aXC.js +4 -0
- package/dist/utils-DyRU1gdZ.cjs +4 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +257 -9
- package/dist/vocab/mod.cjs +86 -0
- package/dist/vocab/mod.d.cts +4 -0
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +6 -7
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +438 -15
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BCWe1Ih5.d.ts} +292 -21
- package/dist/{vocab-CvD6Vbml.js → vocab-BnR3nIU9.js} +26 -17
- package/dist/vocab-CeDBzu-f.d.cts +14903 -0
- package/dist/{lookup-Bn_HEC_d.js → vocab-DFaWWYDn.cjs} +108 -139
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +8 -0
- package/dist/webfinger/mod.d.cts +2 -0
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +5 -6
- package/dist/webfinger-C72Y8lrh.js +4 -0
- package/dist/webfinger-vAtLmxOF.cjs +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +53 -0
- package/dist/x/hono.d.ts +10 -11
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +45 -0
- package/dist/x/sveltekit.d.ts +10 -11
- package/dist/x/sveltekit.js +3 -3
- package/package.json +79 -23
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-BFVqUbyo.js +0 -52
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-DEhniCVa.js +0 -4615
- package/dist/key-CUZQgVlf.js +0 -10
- package/dist/key-Deb0_wWL.js +0 -10
- package/dist/key-DxA6xRtZ.js +0 -260
- package/dist/lookup-dtdr2ftf.js +0 -131
- package/dist/middleware-BE_geSiJ.js +0 -17
- package/dist/middleware-BnU6hzVp.js +0 -26
- package/dist/mod-TFoH2Ql8.d.ts +0 -104
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CSzG2j1P.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-xIj-IT58.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CUKlBw08.d.ts} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
@@ -0,0 +1,201 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import { Create, Follow, Person } from "../lookup-DQRtjvb1.js";
|
7
|
+
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
|
+
import "../assert-MZs1qjMx.js";
|
9
|
+
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
+
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
+
import { createFederation } from "../middleware-CJlj5Olw.js";
|
12
|
+
import "../client-pY7-3icS.js";
|
13
|
+
import "../types-C2XVl6gj.js";
|
14
|
+
import "../actor-BXHc5r-q.js";
|
15
|
+
import "../key-CxdLUFS6.js";
|
16
|
+
import "../http-D2kIm9la.js";
|
17
|
+
import "../ld-CIhvSCCr.js";
|
18
|
+
import "../owner-Dvh7mBvr.js";
|
19
|
+
import { signObject } from "../proof-Dgy35fzc.js";
|
20
|
+
import "../docloader-CrbAy9Oc.js";
|
21
|
+
import "../kv-cache-DN9pfMBe.js";
|
22
|
+
import "../inbox-HjG5peXY.js";
|
23
|
+
import "../builder-u7usRsT3.js";
|
24
|
+
import "../collection-BzWsN9pB.js";
|
25
|
+
import "../keycache-bU7COwsh.js";
|
26
|
+
import "../negotiation-C4nFufNk.js";
|
27
|
+
import "../retry-CfF8Gn4d.js";
|
28
|
+
import "../send-Drp20VO9.js";
|
29
|
+
import { mockDocumentLoader, test } from "../testing-g4UC4liW.js";
|
30
|
+
import "../std__assert-DWivtrGR.js";
|
31
|
+
import "../assert_rejects-Ce45JcFg.js";
|
32
|
+
import "../assert_throws-BNXdRGWP.js";
|
33
|
+
import "../assert_not_equals-C80BG-_5.js";
|
34
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey } from "../keys-DMHs8XNn.js";
|
35
|
+
|
36
|
+
//#region src/federation/idempotency.test.ts
|
37
|
+
const kv = new MemoryKvStore();
|
38
|
+
const federationOptions = {
|
39
|
+
kv,
|
40
|
+
documentLoaderFactory: () => mockDocumentLoader,
|
41
|
+
authenticatedDocumentLoaderFactory: () => mockDocumentLoader
|
42
|
+
};
|
43
|
+
function createTestFederation() {
|
44
|
+
const federation = createFederation(federationOptions);
|
45
|
+
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new Person({}) : null).setKeyPairsDispatcher(() => [{
|
46
|
+
privateKey: ed25519PrivateKey,
|
47
|
+
publicKey: ed25519PublicKey.publicKey
|
48
|
+
}]);
|
49
|
+
return federation;
|
50
|
+
}
|
51
|
+
test("Federation.setInboxListeners().withIdempotency() - per-origin strategy", async () => {
|
52
|
+
const federation = createTestFederation();
|
53
|
+
const processedActivities = [];
|
54
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("per-origin").on(Create, (ctx, activity$1) => {
|
55
|
+
processedActivities.push([ctx.recipient, activity$1]);
|
56
|
+
});
|
57
|
+
const activity = new Create({
|
58
|
+
id: new URL("https://example.com/activities/1"),
|
59
|
+
actor: new URL("https://example.com/person2")
|
60
|
+
});
|
61
|
+
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
62
|
+
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
63
|
+
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
64
|
+
method: "POST",
|
65
|
+
headers: { "Content-Type": "application/activity+json" },
|
66
|
+
body
|
67
|
+
}), { contextData: void 0 });
|
68
|
+
assertEquals(response.status, 202);
|
69
|
+
assertEquals(processedActivities.length, 1);
|
70
|
+
assertEquals(processedActivities[0][0], "john");
|
71
|
+
response = await federation.fetch(new Request("https://example.com/inbox", {
|
72
|
+
method: "POST",
|
73
|
+
headers: { "Content-Type": "application/activity+json" },
|
74
|
+
body
|
75
|
+
}), { contextData: void 0 });
|
76
|
+
assertEquals(response.status, 202);
|
77
|
+
assertEquals(processedActivities.length, 1);
|
78
|
+
await kv.delete([
|
79
|
+
"_fedify",
|
80
|
+
"activityIdempotence",
|
81
|
+
"https://example.com:https://example.com/activities/1"
|
82
|
+
]);
|
83
|
+
});
|
84
|
+
test("Federation.setInboxListeners().withIdempotency() - per-inbox strategy", async () => {
|
85
|
+
const federation = createTestFederation();
|
86
|
+
const processedActivities = [];
|
87
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("per-inbox").on(Create, (ctx, activity$1) => {
|
88
|
+
processedActivities.push([ctx.recipient, activity$1]);
|
89
|
+
});
|
90
|
+
const activity = new Create({
|
91
|
+
id: new URL("https://example.com/activities/2"),
|
92
|
+
actor: new URL("https://example.com/person2")
|
93
|
+
});
|
94
|
+
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
95
|
+
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
96
|
+
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
97
|
+
method: "POST",
|
98
|
+
headers: { "Content-Type": "application/activity+json" },
|
99
|
+
body
|
100
|
+
}), { contextData: void 0 });
|
101
|
+
assertEquals(response.status, 202);
|
102
|
+
assertEquals(processedActivities.length, 1);
|
103
|
+
assertEquals(processedActivities[0][0], "john");
|
104
|
+
response = await federation.fetch(new Request("https://example.com/inbox", {
|
105
|
+
method: "POST",
|
106
|
+
headers: { "Content-Type": "application/activity+json" },
|
107
|
+
body
|
108
|
+
}), { contextData: void 0 });
|
109
|
+
assertEquals(response.status, 202);
|
110
|
+
assertEquals(processedActivities.length, 2);
|
111
|
+
assertEquals(processedActivities[1][0], null);
|
112
|
+
response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
113
|
+
method: "POST",
|
114
|
+
headers: { "Content-Type": "application/activity+json" },
|
115
|
+
body
|
116
|
+
}), { contextData: void 0 });
|
117
|
+
assertEquals(response.status, 202);
|
118
|
+
assertEquals(processedActivities.length, 2);
|
119
|
+
});
|
120
|
+
test("Federation.setInboxListeners().withIdempotency() - global strategy", async () => {
|
121
|
+
const federation = createTestFederation();
|
122
|
+
const processedActivities = [];
|
123
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("global").on(Create, (ctx, activity$1) => {
|
124
|
+
processedActivities.push([ctx.recipient, activity$1]);
|
125
|
+
});
|
126
|
+
const activity = new Create({
|
127
|
+
id: new URL("https://example.com/activities/3"),
|
128
|
+
actor: new URL("https://example.com/person2")
|
129
|
+
});
|
130
|
+
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
131
|
+
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
132
|
+
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
133
|
+
method: "POST",
|
134
|
+
headers: { "Content-Type": "application/activity+json" },
|
135
|
+
body
|
136
|
+
}), { contextData: void 0 });
|
137
|
+
assertEquals(response.status, 202);
|
138
|
+
assertEquals(processedActivities.length, 1);
|
139
|
+
response = await federation.fetch(new Request("https://example.com/inbox", {
|
140
|
+
method: "POST",
|
141
|
+
headers: { "Content-Type": "application/activity+json" },
|
142
|
+
body
|
143
|
+
}), { contextData: void 0 });
|
144
|
+
assertEquals(response.status, 202);
|
145
|
+
assertEquals(processedActivities.length, 1);
|
146
|
+
});
|
147
|
+
test("Federation.setInboxListeners().withIdempotency() - custom callback", async () => {
|
148
|
+
const federation = createTestFederation();
|
149
|
+
const processedActivities = [];
|
150
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency((ctx, activity) => {
|
151
|
+
if (activity instanceof Follow) return null;
|
152
|
+
const inboxId = ctx.recipient ?? "shared";
|
153
|
+
return `${ctx.origin}:${activity.id?.href}:${inboxId}`;
|
154
|
+
}).on(Create, (ctx, activity) => {
|
155
|
+
processedActivities.push([ctx.recipient, activity]);
|
156
|
+
}).on(Follow, (ctx, activity) => {
|
157
|
+
processedActivities.push([ctx.recipient, activity]);
|
158
|
+
});
|
159
|
+
const createActivity = new Create({
|
160
|
+
id: new URL("https://example.com/activities/4"),
|
161
|
+
actor: new URL("https://example.com/person2")
|
162
|
+
});
|
163
|
+
const signedCreate = await signObject(createActivity, ed25519PrivateKey, ed25519Multikey.id);
|
164
|
+
const createBody = JSON.stringify(await signedCreate.toJsonLd({ contextLoader: mockDocumentLoader }));
|
165
|
+
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
166
|
+
method: "POST",
|
167
|
+
headers: { "Content-Type": "application/activity+json" },
|
168
|
+
body: createBody
|
169
|
+
}), { contextData: void 0 });
|
170
|
+
assertEquals(response.status, 202);
|
171
|
+
assertEquals(processedActivities.length, 1);
|
172
|
+
response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
173
|
+
method: "POST",
|
174
|
+
headers: { "Content-Type": "application/activity+json" },
|
175
|
+
body: createBody
|
176
|
+
}), { contextData: void 0 });
|
177
|
+
assertEquals(response.status, 202);
|
178
|
+
assertEquals(processedActivities.length, 1);
|
179
|
+
const followActivity = new Follow({
|
180
|
+
id: new URL("https://example.com/activities/5"),
|
181
|
+
actor: new URL("https://example.com/person2")
|
182
|
+
});
|
183
|
+
const signedFollow = await signObject(followActivity, ed25519PrivateKey, ed25519Multikey.id);
|
184
|
+
const followBody = JSON.stringify(await signedFollow.toJsonLd({ contextLoader: mockDocumentLoader }));
|
185
|
+
response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
186
|
+
method: "POST",
|
187
|
+
headers: { "Content-Type": "application/activity+json" },
|
188
|
+
body: followBody
|
189
|
+
}), { contextData: void 0 });
|
190
|
+
assertEquals(response.status, 202);
|
191
|
+
assertEquals(processedActivities.length, 2);
|
192
|
+
response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
193
|
+
method: "POST",
|
194
|
+
headers: { "Content-Type": "application/activity+json" },
|
195
|
+
body: followBody
|
196
|
+
}), { contextData: void 0 });
|
197
|
+
assertEquals(response.status, 202);
|
198
|
+
assertEquals(processedActivities.length, 3);
|
199
|
+
});
|
200
|
+
|
201
|
+
//#endregion
|
@@ -3,13 +3,11 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Create, Invite, Offer, Update } from "../
|
6
|
+
import { Activity, Create, Invite, Offer, Update } from "../lookup-DQRtjvb1.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
|
-
import "../
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import "../assert_is_error-BPGph1Jx.js";
|
12
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
8
|
+
import { InboxListenerSet } from "../inbox-HjG5peXY.js";
|
9
|
+
import { test } from "../testing-g4UC4liW.js";
|
10
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
13
11
|
|
14
12
|
//#region src/federation/inbox.test.ts
|
15
13
|
test("InboxListenerSet", () => {
|
@@ -3,14 +3,13 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, Multikey } from "../
|
6
|
+
import { CryptographicKey, Multikey } from "../lookup-DQRtjvb1.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
-
import "../
|
12
|
-
import {
|
13
|
-
import { test } from "../testing-Z2omCvKy.js";
|
11
|
+
import { KvKeyCache } from "../keycache-bU7COwsh.js";
|
12
|
+
import { test } from "../testing-g4UC4liW.js";
|
14
13
|
|
15
14
|
//#region src/federation/keycache.test.ts
|
16
15
|
test("KvKeyCache.set()", async () => {
|
@@ -3,18 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "../
|
6
|
+
import "../lookup-DQRtjvb1.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
-
import "../
|
12
|
-
import
|
13
|
-
import "../
|
14
|
-
import "../
|
15
|
-
import "../
|
16
|
-
import "../assert_not_equals-f3m3epl3.js";
|
17
|
-
import "../assert_throws-BOO88avQ.js";
|
11
|
+
import { test } from "../testing-g4UC4liW.js";
|
12
|
+
import "../std__assert-DWivtrGR.js";
|
13
|
+
import "../assert_rejects-Ce45JcFg.js";
|
14
|
+
import "../assert_throws-BNXdRGWP.js";
|
15
|
+
import "../assert_not_equals-C80BG-_5.js";
|
18
16
|
|
19
17
|
//#region src/federation/kv.test.ts
|
20
18
|
test("MemoryKvStore", async (t) => {
|
@@ -24,6 +22,7 @@ test("MemoryKvStore", async (t) => {
|
|
24
22
|
assertEquals(await store.get(["foo", "bar"]), "foobar");
|
25
23
|
assertEquals(await store.get(["foo"]), void 0);
|
26
24
|
await store.set(["foo", "baz"], "baz", { ttl: Temporal.Duration.from({ seconds: 0 }) });
|
25
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
27
26
|
assertEquals(await store.get(["foo", "baz"]), void 0);
|
28
27
|
});
|
29
28
|
await t.step("delete()", async () => {
|