@fedify/fedify 2.0.8 → 2.0.9
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/dist/{assert-MZs1qjMx.js → assert-ddO5KLpe.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-Ce45JcFg.js → assert_rejects-B-qJtC9Z.mjs} +6 -11
- package/dist/{assert_throws-BNXdRGWP.js → assert_throws-4NwKEy2q.mjs} +5 -10
- package/dist/{builder-B5cKln9v.js → builder-DDoQaGOu.mjs} +32 -41
- package/dist/{chunk-CGaQZ11T.cjs → chunk-DDcVe30Y.cjs} +23 -24
- package/dist/{chunk-DJNbSFdH.js → chunk-nlSIicah.js} +8 -8
- package/dist/{client-CoCIaTNO.js → client-A1UrnX6I.mjs} +9 -13
- package/dist/{client-BxMZiQaD.d.ts → client-AtlibPOU.d.ts} +1 -1
- package/dist/{client-C97KOq3x.d.cts → client-z-8dc-e1.d.cts} +1 -1
- package/dist/{collection-CcnIw1qY.js → collection-ChgDTHLz.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -6
- package/dist/compat/mod.d.ts +78 -6
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-D3QkEtZd.d.cts → context-CNIt-Qn7.d.cts} +9 -18
- package/dist/{context-DZJhUmzF.d.ts → context-Dyg7P1qW.d.ts} +9 -18
- package/dist/{context-pa9aIrwp.js → context-Juj6bdHC.mjs} +7 -11
- package/dist/deno-CuVDEdyj.mjs +8 -0
- package/dist/{docloader-CBHh0rC5.js → docloader-BPq9yzC_.mjs} +8 -14
- package/dist/{esm-nLm00z9V.js → esm-DVILvP5e.mjs} +50 -89
- package/dist/federation/builder.test.d.mts +2 -0
- package/dist/federation/{builder.test.js → builder.test.mjs} +19 -38
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +26 -56
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +31 -62
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +8 -12
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +11 -15
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +11 -22
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +146 -225
- package/dist/federation/mod.cjs +327 -16
- package/dist/federation/mod.d.cts +3 -6
- package/dist/federation/mod.d.ts +3 -6
- package/dist/federation/mod.js +322 -13
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +21 -35
- package/dist/federation/negotiation.test.d.mts +2 -0
- package/dist/federation/{negotiation.test.js → negotiation.test.mjs} +9 -16
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +8 -11
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +11 -16
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +22 -29
- package/dist/federation/webfinger.test.d.mts +2 -0
- package/dist/federation/{webfinger.test.js → webfinger.test.mjs} +22 -55
- package/dist/{http-DkHdFfrc.d.ts → http-B2wiNmSo.d.ts} +1 -6
- package/dist/{http-C_RwU_oN.js → http-Bz7avX57.js} +25 -156
- package/dist/{http-Cz3MlXAZ.d.cts → http-C_tEAiZj.d.cts} +1 -6
- package/dist/{http-Br3-1dRf.js → http-DI213UHg.mjs} +17 -33
- package/dist/{http-DGs_78tx.cjs → http-DKBDoudA.cjs} +110 -235
- package/dist/{inbox-3bZUqDLE.js → inbox-Bdn-CSRd.mjs} +18 -26
- package/dist/{key-D7Y_J9kt.js → key-DzJf84o7.mjs} +12 -19
- package/dist/{keycache-BASM0rrX.js → keycache-DaQ3ndaJ.mjs} +5 -9
- package/dist/{keys-ZbcByPg9.js → keys-CtZLJq76.mjs} +5 -9
- package/dist/{kv-QzKcOQgP.js → kv-BrZHNugx.mjs} +6 -10
- package/dist/{kv-BL4nlICN.d.cts → kv-CbLNp3zQ.d.cts} +1 -1
- package/dist/{kv-DXEUEP6z.d.ts → kv-GFYnFoOl.d.ts} +1 -1
- package/dist/{kv-cache-CMM5VJsc.js → kv-cache-DBd7BezJ.js} +6 -13
- package/dist/{kv-cache-9PANi4tA.cjs → kv-cache-Dj1Q7TiW.cjs} +27 -34
- package/dist/{kv-cache-El7We5sy.js → kv-cache-OWmRLHir.mjs} +4 -8
- package/dist/{ld-Bjq9Z4St.js → ld-DczS1fLK.mjs} +17 -31
- package/dist/middleware-B5CiOImA.mjs +5 -0
- package/dist/{middleware-Bj30TZll.js → middleware-BKNu57ZI.js} +320 -363
- package/dist/middleware-C36TOX-2.cjs +4 -0
- package/dist/{middleware-CQeA5yF7.cjs → middleware-CyjmpK70.cjs} +513 -564
- package/dist/{middleware-DozhKfB6.js → middleware-DoHz9oIo.mjs} +260 -292
- package/dist/{mod-DPkRU3EK.d.cts → mod-1xhgsHef.d.cts} +2 -2
- package/dist/{mod-DUWcVv49.d.ts → mod-BGtYJZKu.d.ts} +2 -2
- package/dist/{mod-DXsQakeS.d.cts → mod-Bld7oeqf.d.cts} +3 -3
- package/dist/{mod-DnSsduJF.d.ts → mod-BnAKGh2w.d.ts} +2 -2
- package/dist/{mod-CwZXZJ9d.d.ts → mod-DTOUyCce.d.ts} +3 -3
- package/dist/{mod-Di3W5OdP.d.cts → mod-DWoQffTD.d.cts} +2 -2
- package/dist/mod.cjs +29 -68
- package/dist/mod.d.cts +11 -14
- package/dist/mod.d.ts +11 -15
- package/dist/mod.js +17 -65
- package/dist/{negotiation-5NPJL6zp.js → negotiation-BehA2uul.mjs} +7 -11
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +22 -40
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +13 -42
- package/dist/nodeinfo/mod.cjs +5 -8
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +4 -8
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +9 -16
- package/dist/otel/exporter.test.d.mts +2 -0
- package/dist/otel/{exporter.test.js → exporter.test.mjs} +117 -169
- package/dist/otel/mod.cjs +15 -20
- package/dist/otel/mod.d.cts +2 -2
- package/dist/otel/mod.d.ts +2 -2
- package/dist/otel/mod.js +8 -14
- package/dist/{owner-gd0Q9FuU.d.ts → owner-74ARJ5TL.d.ts} +1 -1
- package/dist/{owner-1AbPBOOZ.d.cts → owner-CptqhsOy.d.cts} +1 -1
- package/dist/{owner-CImU2dKz.js → owner-DXMGUEOr.mjs} +11 -16
- package/dist/{proof-BygvN4r5.js → proof-C-7NljBU.js} +32 -58
- package/dist/{proof-DLL0MLmV.js → proof-CEOujj0L.mjs} +21 -33
- package/dist/{proof-UhA5do8k.cjs → proof-DMu-6A_w.cjs} +133 -157
- package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
- package/dist/{router-D9eI0s4b.js → router-CrMLXoOr.mjs} +4 -8
- package/dist/runtime/mod.cjs +11 -13
- package/dist/runtime/mod.d.cts +6 -2
- package/dist/runtime/mod.d.ts +0 -1
- package/dist/runtime/mod.js +4 -7
- package/dist/{send-DbW03azY.js → send-DIfrLTB_.mjs} +8 -13
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +117 -199
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +11 -18
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +22 -35
- package/dist/sig/mod.cjs +6 -9
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +5 -9
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/{owner.test.js → owner.test.mjs} +19 -34
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +16 -27
- package/dist/{std__assert-DWivtrGR.js → std__assert-Duiq_YC9.mjs} +12 -24
- package/dist/testing/{mod.d.ts → mod.d.mts} +26 -78
- package/dist/testing/mod.mjs +6 -0
- package/dist/{transformers-3g8GZwkZ.cjs → transformers-NeAONrAq.cjs} +20 -25
- package/dist/{transformers-C3FLHUd6.js → transformers-ve6e2xcg.js} +3 -7
- package/dist/{types-CPz01LGH.js → types-C37hquWI.mjs} +4 -7
- package/dist/{types-Cd_hszr_.cjs → types-KC4QAoxe.cjs} +29 -34
- package/dist/{types-C93Ob9cU.js → types-hvL8ElAs.js} +8 -13
- package/dist/utils/docloader.test.d.mts +2 -0
- package/dist/utils/{docloader.test.js → docloader.test.mjs} +14 -24
- package/dist/utils/kv-cache.test.d.mts +2 -0
- package/dist/utils/{kv-cache.test.js → kv-cache.test.mjs} +25 -40
- package/dist/utils/mod.cjs +5 -9
- package/dist/utils/mod.d.cts +1 -3
- package/dist/utils/mod.d.ts +1 -3
- package/dist/utils/mod.js +4 -9
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/mod.cjs +10 -12
- package/dist/vocab/mod.js +3 -5
- package/package.json +7 -7
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -87
- package/dist/compat-Bb4NuTUO.js +0 -4
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/deno-4w047OFk.js +0 -121
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -32
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/negotiation.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation/webfinger.test.d.ts +0 -3
- package/dist/federation-Bp3HI26G.cjs +0 -350
- package/dist/federation-DaMfqRm4.js +0 -332
- package/dist/middleware-B73ZyDmk.js +0 -12
- package/dist/middleware-Dr61i4Jo.cjs +0 -12
- package/dist/middleware-_1PYruC5.js +0 -26
- package/dist/mod-Bh8mqlYw.d.cts +0 -9
- package/dist/mod-D6HodEq7.d.ts +0 -7
- package/dist/mod-DVwHUI_x.d.cts +0 -80
- package/dist/mod-DosD6NsG.d.ts +0 -82
- package/dist/mod-gq_Xfdz8.d.cts +0 -1
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-DoESQxq5.js +0 -4
- package/dist/nodeinfo-DuMYTpbZ.cjs +0 -4
- package/dist/otel/exporter.test.d.ts +0 -3
- package/dist/runtime-c2Njxsry.cjs +0 -17
- package/dist/runtime-poamPCMb.js +0 -13
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-BNhspNOf.js +0 -4
- package/dist/sig-vX39WyWI.cjs +0 -4
- package/dist/testing/mod.js +0 -10
- package/dist/utils/docloader.test.d.ts +0 -3
- package/dist/utils/kv-cache.test.d.ts +0 -3
- package/dist/utils-BQ9KqEK9.cjs +0 -4
- package/dist/utils-Dn5OPdSW.js +0 -4
- /package/dist/{mod-AGjRfPjT.d.ts → compat/transformers.test.d.mts} +0 -0
|
@@ -1,45 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import "../
|
|
11
|
-
import { createFederation,
|
|
12
|
-
import "../
|
|
13
|
-
import "../router-D9eI0s4b.js";
|
|
14
|
-
import "../types-CPz01LGH.js";
|
|
15
|
-
import "../key-D7Y_J9kt.js";
|
|
16
|
-
import { signRequest } from "../http-Br3-1dRf.js";
|
|
17
|
-
import "../ld-Bjq9Z4St.js";
|
|
18
|
-
import "../owner-CImU2dKz.js";
|
|
19
|
-
import "../proof-DLL0MLmV.js";
|
|
20
|
-
import "../docloader-CBHh0rC5.js";
|
|
21
|
-
import "../kv-cache-El7We5sy.js";
|
|
22
|
-
import { InboxListenerSet } from "../inbox-3bZUqDLE.js";
|
|
23
|
-
import "../builder-B5cKln9v.js";
|
|
24
|
-
import "../collection-CcnIw1qY.js";
|
|
25
|
-
import "../keycache-BASM0rrX.js";
|
|
26
|
-
import "../negotiation-5NPJL6zp.js";
|
|
27
|
-
import "../retry-D4GJ670a.js";
|
|
28
|
-
import "../send-DbW03azY.js";
|
|
29
|
-
import "../std__assert-DWivtrGR.js";
|
|
30
|
-
import "../assert_rejects-Ce45JcFg.js";
|
|
31
|
-
import "../assert_throws-BNXdRGWP.js";
|
|
32
|
-
import "../assert_not_equals-C80BG-_5.js";
|
|
33
|
-
import { createInboxContext, createRequestContext } from "../context-pa9aIrwp.js";
|
|
34
|
-
import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-ZbcByPg9.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { n as createRequestContext, t as createInboxContext } from "../context-Juj6bdHC.mjs";
|
|
5
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
7
|
+
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
8
|
+
import { s as signRequest } from "../http-DI213UHg.mjs";
|
|
9
|
+
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
|
|
10
|
+
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
11
|
+
import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-DoHz9oIo.mjs";
|
|
12
|
+
import { t as InboxListenerSet } from "../inbox-Bdn-CSRd.mjs";
|
|
35
13
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
36
14
|
import { Create, Note, Person } from "@fedify/vocab";
|
|
37
|
-
|
|
38
15
|
//#region src/federation/handler.test.ts
|
|
39
16
|
test("handleActor()", async () => {
|
|
40
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
41
17
|
let context = createRequestContext({
|
|
42
|
-
federation,
|
|
18
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
43
19
|
data: void 0,
|
|
44
20
|
url: new URL("https://example.com/"),
|
|
45
21
|
getActorUri(identifier) {
|
|
@@ -227,9 +203,8 @@ test("handleActor()", async () => {
|
|
|
227
203
|
assertEquals(onUnauthorizedCalled, null);
|
|
228
204
|
});
|
|
229
205
|
test("handleObject()", async () => {
|
|
230
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
231
206
|
let context = createRequestContext({
|
|
232
|
-
federation,
|
|
207
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
233
208
|
data: void 0,
|
|
234
209
|
url: new URL("https://example.com/"),
|
|
235
210
|
getObjectUri(_cls, values) {
|
|
@@ -438,9 +413,8 @@ test("handleObject()", async () => {
|
|
|
438
413
|
assertEquals(onUnauthorizedCalled, null);
|
|
439
414
|
});
|
|
440
415
|
test("handleCollection()", async () => {
|
|
441
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
442
416
|
let context = createRequestContext({
|
|
443
|
-
federation,
|
|
417
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
444
418
|
data: void 0,
|
|
445
419
|
url: new URL("https://example.com/"),
|
|
446
420
|
getActorUri(identifier) {
|
|
@@ -1032,7 +1006,7 @@ test("handleInbox()", async () => {
|
|
|
1032
1006
|
});
|
|
1033
1007
|
assertEquals(onNotFoundCalled, null);
|
|
1034
1008
|
assertEquals(response.status, 202);
|
|
1035
|
-
const
|
|
1009
|
+
const signedInvalidRequest = await signRequest(new Request("https://example.com/", {
|
|
1036
1010
|
method: "POST",
|
|
1037
1011
|
body: JSON.stringify({
|
|
1038
1012
|
"@context": [
|
|
@@ -1047,8 +1021,7 @@ test("handleInbox()", async () => {
|
|
|
1047
1021
|
},
|
|
1048
1022
|
actor: "https://example.com/users/alice"
|
|
1049
1023
|
})
|
|
1050
|
-
});
|
|
1051
|
-
const signedInvalidRequest = await signRequest(invalidRequest, rsaPrivateKey3, rsaPublicKey3.id);
|
|
1024
|
+
}), rsaPrivateKey3, rsaPublicKey3.id);
|
|
1052
1025
|
const signedInvalidContext = createRequestContext({
|
|
1053
1026
|
federation,
|
|
1054
1027
|
request: signedInvalidRequest,
|
|
@@ -1201,9 +1174,8 @@ test("respondWithObjectIfAcceptable", async () => {
|
|
|
1201
1174
|
assertEquals(response, null);
|
|
1202
1175
|
});
|
|
1203
1176
|
test("handleCustomCollection()", async () => {
|
|
1204
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
1205
1177
|
let context = createRequestContext({
|
|
1206
|
-
federation,
|
|
1178
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
1207
1179
|
data: void 0,
|
|
1208
1180
|
url: new URL("https://example.com/")
|
|
1209
1181
|
});
|
|
@@ -1498,12 +1470,11 @@ test("handleInbox() records OpenTelemetry span events", async () => {
|
|
|
1498
1470
|
content: "Hello, world!"
|
|
1499
1471
|
})
|
|
1500
1472
|
});
|
|
1501
|
-
const
|
|
1473
|
+
const signed = await signRequest(new Request("https://example.com/users/someone/inbox", {
|
|
1502
1474
|
method: "POST",
|
|
1503
1475
|
headers: { "Content-Type": "application/activity+json" },
|
|
1504
1476
|
body: JSON.stringify(await activity.toJsonLd())
|
|
1505
|
-
});
|
|
1506
|
-
const signed = await signRequest(request, rsaPrivateKey3, new URL("https://example.com/users/someone#main-key"));
|
|
1477
|
+
}), rsaPrivateKey3, new URL("https://example.com/users/someone#main-key"));
|
|
1507
1478
|
const context = createRequestContext({
|
|
1508
1479
|
federation,
|
|
1509
1480
|
request: signed,
|
|
@@ -1526,10 +1497,10 @@ test("handleInbox() records OpenTelemetry span events", async () => {
|
|
|
1526
1497
|
};
|
|
1527
1498
|
const listeners = new InboxListenerSet();
|
|
1528
1499
|
let receivedActivity = null;
|
|
1529
|
-
listeners.add(Create, (_ctx, activity
|
|
1530
|
-
receivedActivity = activity
|
|
1500
|
+
listeners.add(Create, (_ctx, activity) => {
|
|
1501
|
+
receivedActivity = activity;
|
|
1531
1502
|
});
|
|
1532
|
-
|
|
1503
|
+
assertEquals((await handleInbox(signed, {
|
|
1533
1504
|
recipient: "someone",
|
|
1534
1505
|
context,
|
|
1535
1506
|
inboxContextFactory(_activity) {
|
|
@@ -1550,8 +1521,7 @@ test("handleInbox() records OpenTelemetry span events", async () => {
|
|
|
1550
1521
|
signatureTimeWindow: false,
|
|
1551
1522
|
skipSignatureVerification: true,
|
|
1552
1523
|
tracerProvider
|
|
1553
|
-
});
|
|
1554
|
-
assertEquals(response.status, 202);
|
|
1524
|
+
})).status, 202);
|
|
1555
1525
|
assert(receivedActivity != null);
|
|
1556
1526
|
const spans = exporter.getSpans("activitypub.inbox");
|
|
1557
1527
|
assertEquals(spans.length, 1);
|
|
@@ -1569,5 +1539,5 @@ test("handleInbox() records OpenTelemetry span events", async () => {
|
|
|
1569
1539
|
assertEquals(recordedActivity.id, "https://example.com/activity");
|
|
1570
1540
|
assertEquals(recordedActivity.type, "Create");
|
|
1571
1541
|
});
|
|
1572
|
-
|
|
1573
|
-
|
|
1542
|
+
//#endregion
|
|
1543
|
+
export {};
|
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import "../deno-4w047OFk.js";
|
|
11
|
-
import { createFederation } from "../middleware-DozhKfB6.js";
|
|
12
|
-
import "../client-CoCIaTNO.js";
|
|
13
|
-
import "../router-D9eI0s4b.js";
|
|
14
|
-
import "../types-CPz01LGH.js";
|
|
15
|
-
import "../key-D7Y_J9kt.js";
|
|
16
|
-
import "../http-Br3-1dRf.js";
|
|
17
|
-
import "../ld-Bjq9Z4St.js";
|
|
18
|
-
import "../owner-CImU2dKz.js";
|
|
19
|
-
import { signObject } from "../proof-DLL0MLmV.js";
|
|
20
|
-
import "../docloader-CBHh0rC5.js";
|
|
21
|
-
import "../kv-cache-El7We5sy.js";
|
|
22
|
-
import "../inbox-3bZUqDLE.js";
|
|
23
|
-
import "../builder-B5cKln9v.js";
|
|
24
|
-
import "../collection-CcnIw1qY.js";
|
|
25
|
-
import "../keycache-BASM0rrX.js";
|
|
26
|
-
import "../negotiation-5NPJL6zp.js";
|
|
27
|
-
import "../retry-D4GJ670a.js";
|
|
28
|
-
import "../send-DbW03azY.js";
|
|
29
|
-
import "../std__assert-DWivtrGR.js";
|
|
30
|
-
import "../assert_rejects-Ce45JcFg.js";
|
|
31
|
-
import "../assert_throws-BNXdRGWP.js";
|
|
32
|
-
import "../assert_not_equals-C80BG-_5.js";
|
|
33
|
-
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey } from "../keys-ZbcByPg9.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
|
|
7
|
+
import { n as signObject } from "../proof-CEOujj0L.mjs";
|
|
8
|
+
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
9
|
+
import { a as createFederation } from "../middleware-DoHz9oIo.mjs";
|
|
34
10
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
35
11
|
import { Create, Follow, Person } from "@fedify/vocab";
|
|
36
|
-
|
|
37
12
|
//#region src/federation/idempotency.test.ts
|
|
38
13
|
const kv = new MemoryKvStore();
|
|
39
14
|
const federationOptions = {
|
|
@@ -52,14 +27,13 @@ function createTestFederation() {
|
|
|
52
27
|
test("Federation.setInboxListeners().withIdempotency() - per-origin strategy", async () => {
|
|
53
28
|
const federation = createTestFederation();
|
|
54
29
|
const processedActivities = [];
|
|
55
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("per-origin").on(Create, (ctx, activity
|
|
56
|
-
processedActivities.push([ctx.recipient, activity
|
|
30
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("per-origin").on(Create, (ctx, activity) => {
|
|
31
|
+
processedActivities.push([ctx.recipient, activity]);
|
|
57
32
|
});
|
|
58
|
-
const
|
|
33
|
+
const signedActivity = await signObject(new Create({
|
|
59
34
|
id: new URL("https://example.com/activities/1"),
|
|
60
35
|
actor: new URL("https://example.com/person2")
|
|
61
|
-
});
|
|
62
|
-
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
|
36
|
+
}), ed25519PrivateKey, ed25519Multikey.id);
|
|
63
37
|
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
64
38
|
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
|
65
39
|
method: "POST",
|
|
@@ -85,14 +59,13 @@ test("Federation.setInboxListeners().withIdempotency() - per-origin strategy", a
|
|
|
85
59
|
test("Federation.setInboxListeners().withIdempotency() - per-inbox strategy", async () => {
|
|
86
60
|
const federation = createTestFederation();
|
|
87
61
|
const processedActivities = [];
|
|
88
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("per-inbox").on(Create, (ctx, activity
|
|
89
|
-
processedActivities.push([ctx.recipient, activity
|
|
62
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("per-inbox").on(Create, (ctx, activity) => {
|
|
63
|
+
processedActivities.push([ctx.recipient, activity]);
|
|
90
64
|
});
|
|
91
|
-
const
|
|
65
|
+
const signedActivity = await signObject(new Create({
|
|
92
66
|
id: new URL("https://example.com/activities/2"),
|
|
93
67
|
actor: new URL("https://example.com/person2")
|
|
94
|
-
});
|
|
95
|
-
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
|
68
|
+
}), ed25519PrivateKey, ed25519Multikey.id);
|
|
96
69
|
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
97
70
|
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
|
98
71
|
method: "POST",
|
|
@@ -121,14 +94,13 @@ test("Federation.setInboxListeners().withIdempotency() - per-inbox strategy", as
|
|
|
121
94
|
test("Federation.setInboxListeners().withIdempotency() - global strategy", async () => {
|
|
122
95
|
const federation = createTestFederation();
|
|
123
96
|
const processedActivities = [];
|
|
124
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("global").on(Create, (ctx, activity
|
|
125
|
-
processedActivities.push([ctx.recipient, activity
|
|
97
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").withIdempotency("global").on(Create, (ctx, activity) => {
|
|
98
|
+
processedActivities.push([ctx.recipient, activity]);
|
|
126
99
|
});
|
|
127
|
-
const
|
|
100
|
+
const signedActivity = await signObject(new Create({
|
|
128
101
|
id: new URL("https://example.com/activities/3"),
|
|
129
102
|
actor: new URL("https://example.com/person2")
|
|
130
|
-
});
|
|
131
|
-
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
|
103
|
+
}), ed25519PrivateKey, ed25519Multikey.id);
|
|
132
104
|
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
133
105
|
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
|
134
106
|
method: "POST",
|
|
@@ -157,11 +129,10 @@ test("Federation.setInboxListeners().withIdempotency() - custom callback", async
|
|
|
157
129
|
}).on(Follow, (ctx, activity) => {
|
|
158
130
|
processedActivities.push([ctx.recipient, activity]);
|
|
159
131
|
});
|
|
160
|
-
const
|
|
132
|
+
const signedCreate = await signObject(new Create({
|
|
161
133
|
id: new URL("https://example.com/activities/4"),
|
|
162
134
|
actor: new URL("https://example.com/person2")
|
|
163
|
-
});
|
|
164
|
-
const signedCreate = await signObject(createActivity, ed25519PrivateKey, ed25519Multikey.id);
|
|
135
|
+
}), ed25519PrivateKey, ed25519Multikey.id);
|
|
165
136
|
const createBody = JSON.stringify(await signedCreate.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
166
137
|
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
|
167
138
|
method: "POST",
|
|
@@ -177,11 +148,10 @@ test("Federation.setInboxListeners().withIdempotency() - custom callback", async
|
|
|
177
148
|
}), { contextData: void 0 });
|
|
178
149
|
assertEquals(response.status, 202);
|
|
179
150
|
assertEquals(processedActivities.length, 1);
|
|
180
|
-
const
|
|
151
|
+
const signedFollow = await signObject(new Follow({
|
|
181
152
|
id: new URL("https://example.com/activities/5"),
|
|
182
153
|
actor: new URL("https://example.com/person2")
|
|
183
|
-
});
|
|
184
|
-
const signedFollow = await signObject(followActivity, ed25519PrivateKey, ed25519Multikey.id);
|
|
154
|
+
}), ed25519PrivateKey, ed25519Multikey.id);
|
|
185
155
|
const followBody = JSON.stringify(await signedFollow.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
186
156
|
response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
|
187
157
|
method: "POST",
|
|
@@ -201,14 +171,13 @@ test("Federation.setInboxListeners().withIdempotency() - custom callback", async
|
|
|
201
171
|
test("Federation.setInboxListeners() - default strategy is per-inbox", async () => {
|
|
202
172
|
const federation = createTestFederation();
|
|
203
173
|
const processedActivities = [];
|
|
204
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (ctx, activity
|
|
205
|
-
processedActivities.push([ctx.recipient, activity
|
|
174
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (ctx, activity) => {
|
|
175
|
+
processedActivities.push([ctx.recipient, activity]);
|
|
206
176
|
});
|
|
207
|
-
const
|
|
177
|
+
const signedActivity = await signObject(new Create({
|
|
208
178
|
id: new URL("https://example.com/activities/6"),
|
|
209
179
|
actor: new URL("https://example.com/person2")
|
|
210
|
-
});
|
|
211
|
-
const signedActivity = await signObject(activity, ed25519PrivateKey, ed25519Multikey.id);
|
|
180
|
+
}), ed25519PrivateKey, ed25519Multikey.id);
|
|
212
181
|
const body = JSON.stringify(await signedActivity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
213
182
|
let response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
|
214
183
|
method: "POST",
|
|
@@ -234,5 +203,5 @@ test("Federation.setInboxListeners() - default strategy is per-inbox", async ()
|
|
|
234
203
|
assertEquals(response.status, 202);
|
|
235
204
|
assertEquals(processedActivities.length, 2);
|
|
236
205
|
});
|
|
237
|
-
|
|
238
|
-
|
|
206
|
+
//#endregion
|
|
207
|
+
export {};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import "../deno-4w047OFk.js";
|
|
8
|
-
import { InboxListenerSet } from "../inbox-3bZUqDLE.js";
|
|
9
|
-
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
6
|
+
import { t as InboxListenerSet } from "../inbox-Bdn-CSRd.mjs";
|
|
10
7
|
import { test } from "@fedify/fixture";
|
|
11
8
|
import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
|
|
12
|
-
|
|
13
9
|
//#region src/federation/inbox.test.ts
|
|
14
10
|
test("InboxListenerSet", () => {
|
|
15
11
|
const listeners = new InboxListenerSet();
|
|
@@ -86,5 +82,5 @@ test("InboxListenerSet", () => {
|
|
|
86
82
|
});
|
|
87
83
|
assertThrows(() => listeners.add(Activity, listenActivity), TypeError, "Listener already set for this type.");
|
|
88
84
|
});
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
//#endregion
|
|
86
|
+
export {};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
10
|
-
import { KvKeyCache } from "../keycache-BASM0rrX.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
6
|
+
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
8
|
+
import { t as KvKeyCache } from "../keycache-DaQ3ndaJ.mjs";
|
|
11
9
|
import { test } from "@fedify/fixture";
|
|
12
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
13
|
-
|
|
14
11
|
//#region src/federation/keycache.test.ts
|
|
15
12
|
test("KvKeyCache.set()", async () => {
|
|
16
13
|
const kv = new MemoryKvStore();
|
|
@@ -53,8 +50,7 @@ test("KvKeyCache.get()", async () => {
|
|
|
53
50
|
cache.nullKeys.add("https://example.com/null");
|
|
54
51
|
assertEquals(await cache.get(new URL("https://example.com/null")), null);
|
|
55
52
|
await kv.set(["pk", "https://example.com/null2"], { _fedify: "key-unavailable" });
|
|
56
|
-
|
|
57
|
-
assertEquals(await cache2.get(new URL("https://example.com/null2")), null);
|
|
53
|
+
assertEquals(await new KvKeyCache(kv, ["pk"]).get(new URL("https://example.com/null2")), null);
|
|
58
54
|
});
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
//#endregion
|
|
56
|
+
export {};
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import "../assert-MZs1qjMx.js";
|
|
8
|
-
import "../assert_instance_of-DHz7EHNU.js";
|
|
9
|
-
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
10
|
-
import "../std__assert-DWivtrGR.js";
|
|
11
|
-
import "../assert_rejects-Ce45JcFg.js";
|
|
12
|
-
import "../assert_throws-BNXdRGWP.js";
|
|
13
|
-
import "../assert_not_equals-C80BG-_5.js";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
14
7
|
import { test } from "@fedify/fixture";
|
|
15
|
-
|
|
16
8
|
//#region src/federation/kv.test.ts
|
|
17
9
|
test("MemoryKvStore", async (t) => {
|
|
18
10
|
const store = new MemoryKvStore();
|
|
@@ -52,10 +44,8 @@ test("MemoryKvStore", async (t) => {
|
|
|
52
44
|
await store.set(["prefix"], "exact-match");
|
|
53
45
|
const entries = await Array.fromAsync(store.list(["prefix"]));
|
|
54
46
|
assertEquals(entries.length, 4);
|
|
55
|
-
|
|
56
|
-
assertEquals(
|
|
57
|
-
const noMatch = await Array.fromAsync(store.list(["nonexistent"]));
|
|
58
|
-
assertEquals(noMatch.length, 0);
|
|
47
|
+
assertEquals(entries.find((e) => e.key.length === 2 && e.key[1] === "a")?.value, "value-a");
|
|
48
|
+
assertEquals((await Array.fromAsync(store.list(["nonexistent"]))).length, 0);
|
|
59
49
|
await store.delete(["prefix", "a"]);
|
|
60
50
|
await store.delete(["prefix", "b"]);
|
|
61
51
|
await store.delete([
|
|
@@ -84,8 +74,7 @@ test("MemoryKvStore", async (t) => {
|
|
|
84
74
|
"e",
|
|
85
75
|
"f"
|
|
86
76
|
], "value-def");
|
|
87
|
-
|
|
88
|
-
assertEquals(entries.length, 3);
|
|
77
|
+
assertEquals((await Array.fromAsync(store.list())).length, 3);
|
|
89
78
|
await store.delete(["a"]);
|
|
90
79
|
await store.delete(["b", "c"]);
|
|
91
80
|
await store.delete([
|
|
@@ -95,5 +84,5 @@ test("MemoryKvStore", async (t) => {
|
|
|
95
84
|
]);
|
|
96
85
|
});
|
|
97
86
|
});
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
//#endregion
|
|
88
|
+
export {};
|