@fedify/fedify 1.6.11 → 1.6.13
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/{actor-tT_B0pDn.d.ts → actor-5yLVgYbM.d.ts} +3 -3
- package/dist/{actor-KrOvzFz1.js → actor-CcchiJa2.js} +6 -6
- package/dist/{actor-CxnKxfwH.js → actor-_hg-8_KF.js} +329 -465
- package/dist/{assert-LOEeCUK5.js → assert-C-mZuSQl.js} +2 -2
- package/dist/{assert_equals-B44MxcIj.js → assert_equals-Dy0MG_Zw.js} +16 -16
- package/dist/{assert_instance_of-XtuFevV_.js → assert_instance_of-lS0Jr2iu.js} +2 -2
- package/dist/{assert_is_error-BTlryvT0.js → assert_is_error-CIYFACrT.js} +2 -2
- package/dist/{assert_not_equals-C685gKx6.js → assert_not_equals-C1azCAB0.js} +3 -6
- package/dist/{assert_rejects-DWQ4jaf9.js → assert_rejects-Bkh5lA1a.js} +3 -3
- package/dist/{assert_throws-YetpVSc-.js → assert_throws-CmpfkWEM.js} +3 -3
- package/dist/{authdocloader-CsnXlm3V.js → authdocloader-1Ja0Him4.js} +7 -9
- package/dist/{authdocloader-DsULyH5D.js → authdocloader-D0Ds92Vk.js} +6 -8
- package/dist/{builder-BjJSVOvs.js → builder-MOXlzktX.js} +7 -7
- package/dist/{chunk-Cx8LTkjm.js → chunk-DvTpRkcT.js} +22 -15
- package/dist/{client-Cd552pKL.d.ts → client-BvbhJik1.d.ts} +2 -2
- package/dist/{client-BlntqhE9.js → client-C0yKnQtt.js} +3 -3
- package/dist/{collection-Dfb0TPno.js → collection-XNLQhehO.js} +2 -3
- package/dist/{mod-CgmTOt4z.d.ts → compat/mod-MHHm8HmK.d.ts} +3 -3
- package/dist/compat/mod.js +1 -2
- package/dist/compat/transformers.test.js +34 -38
- package/dist/{context-DRhhOsMk.d.ts → context-C0X9n1tC.d.ts} +10 -10
- package/dist/{context-CiyuTkCx.js → context-D7ltDKkC.js} +5 -5
- package/dist/{docloader-09nVWLAZ.js → docloader-BDSHZfTJ.js} +1 -1
- package/dist/{docloader-BYgIBZvh.js → docloader-C8QMM0lt.js} +32 -152
- package/dist/{docloader-DlUDOVSe.d.ts → docloader-DecYq5GI.d.ts} +2 -2
- package/dist/{docloader-DOrb0fRp.js → docloader-M1Np6SYc.js} +31 -151
- package/dist/{esm-DO9PrujO.js → esm-BRXvTSrx.js} +36 -22
- package/dist/federation/builder.test.js +20 -26
- package/dist/federation/collection.test.js +11 -16
- package/dist/federation/handler.test.js +41 -48
- package/dist/federation/inbox.test.js +11 -11
- package/dist/federation/keycache.test.js +12 -11
- package/dist/federation/kv.test.js +8 -10
- package/dist/federation/middleware.test.js +99 -120
- package/dist/federation/mod-CLkToKJa.d.ts +6 -0
- package/dist/federation/mod.js +195 -12
- package/dist/federation/mq.test.js +9 -14
- package/dist/federation/retry.test.js +5 -4
- package/dist/federation/router.test.js +9 -10
- package/dist/federation/send.test.js +23 -24
- package/dist/{http-LsE7i_Zq.js → http-BDLuDcCk.js} +17 -26
- package/dist/{http-Dc8RIaDE.js → http-BHjHzW-Y.js} +17 -26
- package/dist/{http-BkUCISGt.d.ts → http-ByqMVN52.d.ts} +3 -3
- package/dist/{inbox-BVwejjm8.js → inbox-FoFUUhTd.js} +5 -5
- package/dist/{key-BTcmhZp7.js → key-BABKdX0W.js} +5 -5
- package/dist/{key-Bg_PKGpe.js → key-Bj3ZyKd0.js} +4 -4
- package/dist/key-CragWqc4.js +16 -0
- package/dist/key-OMbKIYLU.js +10 -0
- package/dist/{keycache-BnCTs9sG.js → keycache-DONR-3XM.js} +2 -2
- package/dist/{keys-pbGG00jU.js → keys-KKGS1cpG.js} +2 -2
- package/dist/{kv-p8sC8PTT.d.ts → kv-CyvhW67T.d.ts} +1 -1
- package/dist/{kv-DohFOP2C.js → kv-DosGYGwV.js} +1 -1
- package/dist/{langstr-DbWheeIS.js → langstr-pFHBDU4y.js} +1 -1
- package/dist/{ld-n_kUCeXG.js → ld-DWSCvUJ-.js} +9 -12
- package/dist/{lookup-vJccIKCS.d.ts → lookup-BULfTwGb.d.ts} +2 -2
- package/dist/{lookup-Cutk-FXA.js → lookup-C2TcPqxv.js} +4 -4
- package/dist/{lookup-DrAS097Q.js → lookup-DIQCWtDD.js} +3 -3
- package/dist/{lookup-1pupHJbK.js → lookup-DZBZTzld.js} +6 -6
- package/dist/middleware-BdpSheEs.js +32 -0
- package/dist/{middleware-CMTirIyg.js → middleware-C9cbWvtY.js} +35 -39
- package/dist/middleware-CZQPvn1Y.js +17 -0
- package/dist/{middleware-kjrPMCqA.js → middleware-DRRaBIs3.js} +38 -43
- package/dist/{mod-j45KmAfR.d.ts → mod-C3OG1oK4.d.ts} +4 -4
- package/dist/{mod-DSPyncxx.d.ts → mod-CMpqcqIz.d.ts} +3 -3
- package/dist/mod-zMq7BLOW.d.ts +20 -0
- package/dist/mod.js +17 -17
- package/dist/{mq-nceTGCuc.d.ts → mq-CITHOe0n.d.ts} +1 -1
- package/dist/{multibase-CnLHszip.js → multibase-DBcKTV2a.js} +1 -1
- package/dist/nodeinfo/client.test.js +19 -28
- package/dist/nodeinfo/handler.test.js +37 -44
- package/dist/nodeinfo/mod-DY5OWSvB.d.ts +4 -0
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/semver.test.js +13 -21
- package/dist/nodeinfo/types.test.js +9 -11
- package/dist/{owner-CbRc94FP.d.ts → owner-BPGFI8Z3.d.ts} +4 -4
- package/dist/{owner-c-Zzpacz.js → owner-BSBuyxV4.js} +4 -4
- package/dist/{proof-BTx3Maj-.js → proof-B8LPOkvZ.js} +14 -19
- package/dist/{proof-CTOU2zFF.js → proof-CBHYxfh3.js} +11 -13
- package/dist/{retry-BiIhZWgD.js → retry-BQet39_l.js} +1 -1
- package/dist/{router-D_aVZZUc.js → router-BuDkN4RQ.js} +1 -1
- package/dist/runtime/authdocloader.test.js +22 -26
- package/dist/runtime/docloader.test.js +50 -46
- package/dist/runtime/key.test.js +31 -53
- package/dist/runtime/langstr.test.js +8 -10
- package/dist/{mod-BTHfUeLo.d.ts → runtime/mod-C4NyJ6RS.d.ts} +4 -3
- package/dist/runtime/mod.js +6 -7
- package/dist/runtime/multibase/multibase.test.js +12 -18
- package/dist/runtime/url.test.js +7 -6
- package/dist/{semver-BNrOOAs9.js → semver-D9d-VO-_.js} +7 -17
- package/dist/{send-SniNSIKd.js → send-Cah-Z3UO.js} +4 -4
- package/dist/sig/http.test.js +104 -168
- package/dist/sig/key.test.js +17 -20
- package/dist/sig/ld.test.js +28 -35
- package/dist/sig/mod-DM0ceGER.d.ts +6 -0
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +24 -30
- package/dist/sig/proof.test.js +24 -29
- package/dist/{std__assert-o_r9vqm1.js → std__assert-BdP_WkD-.js} +7 -13
- package/dist/testing/docloader.test.js +9 -12
- package/dist/testing/mod.js +2 -1
- package/dist/{testing-DLyvtiiW.js → testing-qaAD4B0t.js} +2 -2
- package/dist/{transformers-ghwJuzGY.js → transformers-CFSWUhNi.js} +1 -1
- package/dist/{type-CFuiGLz9.js → type-DFsmi-p1.js} +1 -1
- package/dist/{types-DG1qZLU9.js → types-BXvx0wJm.js} +8 -18
- package/dist/{types-CJHS5pXl.js → types-CB_2uuCA.js} +2 -2
- package/dist/{url-C2xuoQD1.js → url-BdNvnK9P.js} +1 -1
- package/dist/vocab/actor.test.js +76 -128
- package/dist/vocab/lookup.test.js +19 -23
- package/dist/vocab/mod-CgB887se.d.ts +6 -0
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +10 -10
- package/dist/vocab/vocab.test.js +109 -105
- package/dist/{vocab-lzEJg2bH.js → vocab-B0flx0SI.js} +328 -464
- package/dist/{vocab-DSFLLLe6.d.ts → vocab-BQaYsnhp.d.ts} +2 -2
- package/dist/{vocab-oKloyO0F.js → vocab-BXeM76FR.js} +5 -5
- package/dist/webfinger/handler.test.js +40 -48
- package/dist/webfinger/lookup.test.js +12 -15
- package/dist/webfinger/mod-CE5bmzpH.d.ts +4 -0
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/{cfworkers.d.ts → cfworkers-D_9uuXWs.d.ts} +2 -2
- package/dist/x/cfworkers.test.js +7 -9
- package/dist/x/{hono.d.ts → hono-TxxAGdy4.d.ts} +2 -11
- package/dist/x/{sveltekit.d.ts → sveltekit-KCF9gOdN.d.ts} +2 -11
- package/package.json +1 -1
- package/dist/compat/mod.d.ts +0 -15
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/federation/mod.d.ts +0 -15
- package/dist/federation-DyRlaC4X.js +0 -192
- package/dist/key-BP-Oky5H.js +0 -16
- package/dist/key-DxKqQgGm.js +0 -10
- package/dist/middleware-CDYmpOKW.js +0 -33
- package/dist/middleware-CXZvlTVn.js +0 -17
- package/dist/mod-1pDWKvUL.d.ts +0 -2
- package/dist/mod-GIh5OYxW.d.ts +0 -2
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mod.d.ts +0 -20
- package/dist/nodeinfo/mod.d.ts +0 -7
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig/mod.d.ts +0 -10
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/vocab/mod.d.ts +0 -8
- package/dist/webfinger/mod.d.ts +0 -7
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/compat/{transformers.test.d.ts → transformers.test-DnJbd34u.d.ts} +0 -0
- /package/dist/{denokv-B_GFWjrl.js → denokv-XeyH3cFs.js} +0 -0
- /package/dist/federation/{builder.test.d.ts → builder.test-Bpt6NOZ6.d.ts} +0 -0
- /package/dist/federation/{collection.test.d.ts → collection.test-DKJ6JOZz.d.ts} +0 -0
- /package/dist/federation/{handler.test.d.ts → handler.test-BMT7uLC0.d.ts} +0 -0
- /package/dist/federation/{inbox.test.d.ts → inbox.test-Do6i02Qp.d.ts} +0 -0
- /package/dist/federation/{keycache.test.d.ts → keycache.test-BT83IPZY.d.ts} +0 -0
- /package/dist/federation/{kv.test.d.ts → kv.test-kFzzF2VN.d.ts} +0 -0
- /package/dist/federation/{middleware.test.d.ts → middleware.test-B1R4_e3-.d.ts} +0 -0
- /package/dist/federation/{mq.test.d.ts → mq.test-l79EQQOe.d.ts} +0 -0
- /package/dist/federation/{retry.test.d.ts → retry.test-BqS50VCX.d.ts} +0 -0
- /package/dist/federation/{router.test.d.ts → router.test-CYQl4po-.d.ts} +0 -0
- /package/dist/federation/{send.test.d.ts → send.test-COUnNUzv.d.ts} +0 -0
- /package/dist/nodeinfo/{client.test.d.ts → client.test-CZLe79hL.d.ts} +0 -0
- /package/dist/nodeinfo/{handler.test.d.ts → handler.test-B-EDZ_hK.d.ts} +0 -0
- /package/dist/nodeinfo/{semver.test.d.ts → semver.test-BEuuQSEM.d.ts} +0 -0
- /package/dist/nodeinfo/{types.test.d.ts → types.test-B5AT89WV.d.ts} +0 -0
- /package/dist/runtime/{authdocloader.test.d.ts → authdocloader.test-hCRKzn9v.d.ts} +0 -0
- /package/dist/runtime/{docloader.test.d.ts → docloader.test-CVd7i_5h.d.ts} +0 -0
- /package/dist/runtime/{key.test.d.ts → key.test-DBsILYSD.d.ts} +0 -0
- /package/dist/runtime/{langstr.test.d.ts → langstr.test-CiKxuuRY.d.ts} +0 -0
- /package/dist/runtime/multibase/{multibase.test.d.ts → multibase.test-Brh6gPBP.d.ts} +0 -0
- /package/dist/runtime/{url.test.d.ts → url.test-DlRqkU2j.d.ts} +0 -0
- /package/dist/sig/{http.test.d.ts → http.test-BpXNAWNI.d.ts} +0 -0
- /package/dist/sig/{key.test.d.ts → key.test-B2iLIugy.d.ts} +0 -0
- /package/dist/sig/{ld.test.d.ts → ld.test-D-cI70Gw.d.ts} +0 -0
- /package/dist/sig/{owner.test.d.ts → owner.test-B_YRjMPj.d.ts} +0 -0
- /package/dist/sig/{proof.test.d.ts → proof.test-BagEM_-4.d.ts} +0 -0
- /package/dist/testing/{docloader.test.d.ts → docloader.test-lrzf6sDZ.d.ts} +0 -0
- /package/dist/testing/{mod.d.ts → mod-3uM8ZvS7.d.ts} +0 -0
- /package/dist/vocab/{actor.test.d.ts → actor.test-ClC-iVWk.d.ts} +0 -0
- /package/dist/vocab/{lookup.test.d.ts → lookup.test-Cq1I-27w.d.ts} +0 -0
- /package/dist/vocab/{type.test.d.ts → type.test-bfFiYGcs.d.ts} +0 -0
- /package/dist/vocab/{vocab.test.d.ts → vocab.test-h-ZTisfu.d.ts} +0 -0
- /package/dist/webfinger/{handler.test.d.ts → handler.test-DiUeEDDD.d.ts} +0 -0
- /package/dist/webfinger/{lookup.test.d.ts → lookup.test-D9onm3U3.d.ts} +0 -0
- /package/dist/x/{cfworkers.test.d.ts → cfworkers.test-KXHlJ29z.d.ts} +0 -0
|
@@ -3,110 +3,99 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import
|
|
19
|
-
import "../
|
|
20
|
-
import "../
|
|
21
|
-
import
|
|
22
|
-
import "../
|
|
23
|
-
import "../
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import "../
|
|
31
|
-
import "../
|
|
32
|
-
import "../
|
|
33
|
-
import "../
|
|
34
|
-
import "../
|
|
35
|
-
import "../send-
|
|
36
|
-
import { test } from "../testing-
|
|
37
|
-
import { assertStrictEquals } from "../std__assert-
|
|
38
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
|
39
|
-
import "../assert_is_error-
|
|
40
|
-
import { assertNotEquals } from "../assert_not_equals-
|
|
41
|
-
import { assertThrows } from "../assert_throws-
|
|
42
|
-
import { mockDocumentLoader } from "../docloader-
|
|
43
|
-
import {
|
|
44
|
-
import { esm_default } from "../esm-
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as assert } from "../assert-C-mZuSQl.js";
|
|
9
|
+
import { t as assertInstanceOf } from "../assert_instance_of-lS0Jr2iu.js";
|
|
10
|
+
import { t as MemoryKvStore } from "../kv-DosGYGwV.js";
|
|
11
|
+
import { a as createFederation, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-C9cbWvtY.js";
|
|
12
|
+
import { r as fetchDocumentLoader, t as FetchError } from "../docloader-C8QMM0lt.js";
|
|
13
|
+
import "../url-BdNvnK9P.js";
|
|
14
|
+
import "../semver-D9d-VO-_.js";
|
|
15
|
+
import "../client-C0yKnQtt.js";
|
|
16
|
+
import { n as RouterError } from "../router-BuDkN4RQ.js";
|
|
17
|
+
import "../types-CB_2uuCA.js";
|
|
18
|
+
import "../multibase-DBcKTV2a.js";
|
|
19
|
+
import { S as Person, _ as Object$1, a as Create, g as Note, h as Multikey, n as Announce, p as Invite, t as Activity, v as Offer } from "../vocab-B0flx0SI.js";
|
|
20
|
+
import "../langstr-pFHBDU4y.js";
|
|
21
|
+
import "../lookup-C2TcPqxv.js";
|
|
22
|
+
import { t as getTypeId } from "../type-DFsmi-p1.js";
|
|
23
|
+
import "../actor-CcchiJa2.js";
|
|
24
|
+
import "../key-BABKdX0W.js";
|
|
25
|
+
import { l as verifyRequest, s as signRequest } from "../http-BHjHzW-Y.js";
|
|
26
|
+
import { t as getAuthenticatedDocumentLoader } from "../authdocloader-1Ja0Him4.js";
|
|
27
|
+
import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-DWSCvUJ-.js";
|
|
28
|
+
import { t as doesActorOwnKey } from "../owner-BSBuyxV4.js";
|
|
29
|
+
import { n as signObject, r as verifyObject } from "../proof-CBHYxfh3.js";
|
|
30
|
+
import { t as lookupObject } from "../lookup-DZBZTzld.js";
|
|
31
|
+
import "../inbox-FoFUUhTd.js";
|
|
32
|
+
import "../builder-MOXlzktX.js";
|
|
33
|
+
import "../collection-XNLQhehO.js";
|
|
34
|
+
import "../keycache-DONR-3XM.js";
|
|
35
|
+
import "../send-Cah-Z3UO.js";
|
|
36
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
37
|
+
import { n as assertStrictEquals } from "../std__assert-BdP_WkD-.js";
|
|
38
|
+
import { n as assertFalse, t as assertRejects } from "../assert_rejects-Bkh5lA1a.js";
|
|
39
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
40
|
+
import { t as assertNotEquals } from "../assert_not_equals-C1azCAB0.js";
|
|
41
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
42
|
+
import { t as mockDocumentLoader } from "../docloader-BDSHZfTJ.js";
|
|
43
|
+
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-KKGS1cpG.js";
|
|
44
|
+
import { t as esm_default } from "../esm-BRXvTSrx.js";
|
|
45
45
|
|
|
46
46
|
//#region testing/fixtures/example.com/person.json
|
|
47
|
-
var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
|
|
48
|
-
var id$1 = "https://example.com/person";
|
|
49
|
-
var type$1 = "Person";
|
|
50
|
-
var name$1 = "John Doe";
|
|
51
|
-
var publicKey$1 = [{
|
|
52
|
-
"id": "https://example.com/key",
|
|
53
|
-
"owner": "https://example.com/person",
|
|
54
|
-
"type": "CryptographicKey",
|
|
55
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyIB9rotX8G6r6/6toT+x\n24BUiQ/HaPH1Em9dOt4c94s+OPFoEdH7DY7Iym9A8LlH4JaGF8KD38bLHWe1S4x0\njV3gHJKhK7veJfGZCKUENcQecBZ+YWUs5HWvUIX1vVB//0luHrg6BQKGOrSOE+WI\nAxyr0qsWCFfZzQrvSnUD2yvg1arJX2xhms14uxoRd5Kg9efKSCmmQaNEapicARUm\nFWrIEpGFa/nUUnqimssAGw1eZFqf3wA4TjhsuARBhGaJtv/3KEa016eMZxy3kDlO\njZnXZTaTgWkXdodwUvy8563fes3Al6BlcS2iJ9qbtha8rSm0FHqoUKH73JsLPKQI\nwQIDAQAB\n-----END PUBLIC KEY-----"
|
|
56
|
-
}, {
|
|
57
|
-
"id": "https://example.com/key2",
|
|
58
|
-
"type": "CryptographicKey",
|
|
59
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoRmBtnxbdFutoRd1GLGw\nwGTrsqlRRWUe11hHQaoRLGf5LwQ0tIc6I9q+dynliw+2kxYsLn9SH2je6HcTYOol\ngW7F/cOWXZQN04b+OiYcU1ConAhLjmn4k1uKawJ614y0ScPNd8PQ+CljsnlPxbq9\nofaCMe2BV3B6y09aCuGFJ0nxn1/ubjmIBIWWFTAznoz1J9BhJDGyt3IO3ABy3f9z\nDVlR32L/n5VIkXnxkjUKdzMAOzYb62kuKOp1iznRTPrV71SNtivJMwSh/LVgBrmZ\njtIn/oim+KyX/fdLU3tQ7VClyqmJzyAjccOH6Qj6nFTPh+vX07gqN8IlLT2uye4w\nawIDAQAB\n-----END PUBLIC KEY-----"
|
|
60
|
-
}];
|
|
61
47
|
var person_default = {
|
|
62
|
-
"@context":
|
|
63
|
-
id:
|
|
64
|
-
type:
|
|
65
|
-
name:
|
|
66
|
-
publicKey:
|
|
48
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
49
|
+
id: "https://example.com/person",
|
|
50
|
+
type: "Person",
|
|
51
|
+
name: "John Doe",
|
|
52
|
+
publicKey: [{
|
|
53
|
+
"id": "https://example.com/key",
|
|
54
|
+
"owner": "https://example.com/person",
|
|
55
|
+
"type": "CryptographicKey",
|
|
56
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyIB9rotX8G6r6/6toT+x\n24BUiQ/HaPH1Em9dOt4c94s+OPFoEdH7DY7Iym9A8LlH4JaGF8KD38bLHWe1S4x0\njV3gHJKhK7veJfGZCKUENcQecBZ+YWUs5HWvUIX1vVB//0luHrg6BQKGOrSOE+WI\nAxyr0qsWCFfZzQrvSnUD2yvg1arJX2xhms14uxoRd5Kg9efKSCmmQaNEapicARUm\nFWrIEpGFa/nUUnqimssAGw1eZFqf3wA4TjhsuARBhGaJtv/3KEa016eMZxy3kDlO\njZnXZTaTgWkXdodwUvy8563fes3Al6BlcS2iJ9qbtha8rSm0FHqoUKH73JsLPKQI\nwQIDAQAB\n-----END PUBLIC KEY-----"
|
|
57
|
+
}, {
|
|
58
|
+
"id": "https://example.com/key2",
|
|
59
|
+
"type": "CryptographicKey",
|
|
60
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoRmBtnxbdFutoRd1GLGw\nwGTrsqlRRWUe11hHQaoRLGf5LwQ0tIc6I9q+dynliw+2kxYsLn9SH2je6HcTYOol\ngW7F/cOWXZQN04b+OiYcU1ConAhLjmn4k1uKawJ614y0ScPNd8PQ+CljsnlPxbq9\nofaCMe2BV3B6y09aCuGFJ0nxn1/ubjmIBIWWFTAznoz1J9BhJDGyt3IO3ABy3f9z\nDVlR32L/n5VIkXnxkjUKdzMAOzYb62kuKOp1iznRTPrV71SNtivJMwSh/LVgBrmZ\njtIn/oim+KyX/fdLU3tQ7VClyqmJzyAjccOH6Qj6nFTPh+vX07gqN8IlLT2uye4w\nawIDAQAB\n-----END PUBLIC KEY-----"
|
|
61
|
+
}]
|
|
67
62
|
};
|
|
68
63
|
|
|
69
64
|
//#endregion
|
|
70
65
|
//#region testing/fixtures/example.com/person2.json
|
|
71
|
-
var __context = [
|
|
72
|
-
"https://www.w3.org/ns/activitystreams",
|
|
73
|
-
"https://w3id.org/security/v1",
|
|
74
|
-
"https://w3id.org/security/multikey/v1",
|
|
75
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
76
|
-
"https://www.w3.org/ns/did/v1"
|
|
77
|
-
];
|
|
78
|
-
var id = "https://example.com/person2";
|
|
79
|
-
var type = "Person";
|
|
80
|
-
var name = "Jane Doe";
|
|
81
|
-
var publicKey = [{
|
|
82
|
-
"id": "https://example.com/person2#key3",
|
|
83
|
-
"type": "CryptographicKey",
|
|
84
|
-
"owner": "https://example.com/person2",
|
|
85
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4GUqWgdiYlN3Su5Gr4l6\ni+xRS8gDDVKZ718vpGk6eIpvqs33q430nRbHIzbHRXRaAhc/1++rUBcK0V4/kjZl\nCSzVtRgGU6HMkmjcD+uE56a8XbTczfltbEDj7afoEuB2F3UhQEWrSz+QJ29DPXaL\nMIa1Yv61NR2vxGqNbdtoMjDORMBYtg77CYbcFkiJHw65PDa7+f/yjLxuCRPye5L7\nhncN0UZuuFoRJmHNRLSg5omBad9WTvQXmSyXEhEdk9fHwlI022AqAzlWbT79hldc\nDSKGGLLbQIs1c3JZIG8G5i6Uh5Vy0Z7tSNBcxbhqoI9i9je4f/x/OPIVc19f04BE\n1LgWuHsftZzRgW9Sdqz53W83XxVdxlyHeywXOnstSWT11f8dkLyQUcHKTH+E6urb\nH+aiPLiRpYK8W7D9KTQA9kZ5JXaEuveBd5vJX7wakhbzAn8pWJU7GYIHNY38Ycok\nmivkU5pY8S2cKFMwY0b7ade3MComlir5P3ZYSjF+n6gRVsT96P+9mNfCu9gXt/f8\nXCyjKlH89kGwuJ7HhR8CuVdm0l+jYozVt6GsDy0hHYyn79NCCAEzP7ZbhBMR0T5V\nrkl+TIGXoJH9WFiz4VxO+NnglF6dNQjDS5IzYLoFRXIK1f3cmQiEB4FZmL70l9HL\nrgwR+Xys83xia79OqFDRezMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
|
|
86
|
-
}, {
|
|
87
|
-
"id": "https://example.com/person2#key4",
|
|
88
|
-
"type": "CryptographicKey",
|
|
89
|
-
"owner": "https://example.com/person2",
|
|
90
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEALR8epAGDe+cVq5p2Tx49CCfphpk1rNhkNoY9i+XEUfg=\n-----END PUBLIC KEY-----\n"
|
|
91
|
-
}];
|
|
92
|
-
var assertionMethod = [{
|
|
93
|
-
"id": "https://example.com/peson2#key3",
|
|
94
|
-
"type": "Multikey",
|
|
95
|
-
"controller": "https://example.com/person2",
|
|
96
|
-
"publicKeyMultibase": "zgghBUVkqmWS8e1j4aN2yowLAEkJC6wowB9wWmLRACYCok7UzstWcTBp3waKiDUM7wqL9bbBD9W9FvNaXEK2KPCZ9ffhvd5dxChJL9bdPQSrMwa28FEYMGDtcF1uocrYNmZm2dBBMaWrCu8U3s4PpVVhn4hsWDL8GLuE466pkJs9Hy8xmECoaaVgAZLiYDw2gwrjHDiX2i7aDHKfE7aSZWUWmC8nAGNZ7DX5pXoyXK3pxuaCWxNxXwPmaFwgKDyy9uhtBJ8znp9NZXkXHBTQe5uAi8GFwHY5asvqCmYPrAGWxcT6pdbZaJHdWkM7nw6apBHfakKs42oMqdBoJ2WkkresoT1qHrX2GW7gNP9PLtveF4vfEd6cwgHKQCdYgayG3muGfZiPvML75cyfkNrjkctvuQUfMxY9umbd2TG3V3mPnLrvQnqHpuRMZYtCn3nX1qfZaqFhTwT4NFPqVNLqvgR6k9vcuGXn6Ndaumhd5xtTK64jk3e2gPBit9iq6MrFUSoxNsbTty4kqcHAodtkK8CMSxUxbFP1kK3nyy8ZfeMgDCts1KboBcT2m5FMpQpYxKtNBfvhTuyeDDC34uhbY8itmTAnDwSr5mKrniwwDUGPZFejda51TYs1N9D9Ejzaw5Mvr8qN6wahHmsDBWTbWwV6YKVMD1MjAhJBUopWJWB5x6mEBAX25MssKfAEhJyDtqYWjq63uQHUJCsPJp"
|
|
97
|
-
}, {
|
|
98
|
-
"id": "https://example.com/person2#key4",
|
|
99
|
-
"type": "Multikey",
|
|
100
|
-
"controller": "https://example.com/person2",
|
|
101
|
-
"publicKeyMultibase": "z6MkhVPuyvgG1RkMv67azDqDCDERPXVrUg1i3qchXY5EACE3"
|
|
102
|
-
}];
|
|
103
66
|
var person2_default = {
|
|
104
|
-
"@context":
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
67
|
+
"@context": [
|
|
68
|
+
"https://www.w3.org/ns/activitystreams",
|
|
69
|
+
"https://w3id.org/security/v1",
|
|
70
|
+
"https://w3id.org/security/multikey/v1",
|
|
71
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
72
|
+
"https://www.w3.org/ns/did/v1"
|
|
73
|
+
],
|
|
74
|
+
id: "https://example.com/person2",
|
|
75
|
+
type: "Person",
|
|
76
|
+
name: "Jane Doe",
|
|
77
|
+
publicKey: [{
|
|
78
|
+
"id": "https://example.com/person2#key3",
|
|
79
|
+
"type": "CryptographicKey",
|
|
80
|
+
"owner": "https://example.com/person2",
|
|
81
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4GUqWgdiYlN3Su5Gr4l6\ni+xRS8gDDVKZ718vpGk6eIpvqs33q430nRbHIzbHRXRaAhc/1++rUBcK0V4/kjZl\nCSzVtRgGU6HMkmjcD+uE56a8XbTczfltbEDj7afoEuB2F3UhQEWrSz+QJ29DPXaL\nMIa1Yv61NR2vxGqNbdtoMjDORMBYtg77CYbcFkiJHw65PDa7+f/yjLxuCRPye5L7\nhncN0UZuuFoRJmHNRLSg5omBad9WTvQXmSyXEhEdk9fHwlI022AqAzlWbT79hldc\nDSKGGLLbQIs1c3JZIG8G5i6Uh5Vy0Z7tSNBcxbhqoI9i9je4f/x/OPIVc19f04BE\n1LgWuHsftZzRgW9Sdqz53W83XxVdxlyHeywXOnstSWT11f8dkLyQUcHKTH+E6urb\nH+aiPLiRpYK8W7D9KTQA9kZ5JXaEuveBd5vJX7wakhbzAn8pWJU7GYIHNY38Ycok\nmivkU5pY8S2cKFMwY0b7ade3MComlir5P3ZYSjF+n6gRVsT96P+9mNfCu9gXt/f8\nXCyjKlH89kGwuJ7HhR8CuVdm0l+jYozVt6GsDy0hHYyn79NCCAEzP7ZbhBMR0T5V\nrkl+TIGXoJH9WFiz4VxO+NnglF6dNQjDS5IzYLoFRXIK1f3cmQiEB4FZmL70l9HL\nrgwR+Xys83xia79OqFDRezMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
|
|
82
|
+
}, {
|
|
83
|
+
"id": "https://example.com/person2#key4",
|
|
84
|
+
"type": "CryptographicKey",
|
|
85
|
+
"owner": "https://example.com/person2",
|
|
86
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEALR8epAGDe+cVq5p2Tx49CCfphpk1rNhkNoY9i+XEUfg=\n-----END PUBLIC KEY-----\n"
|
|
87
|
+
}],
|
|
88
|
+
assertionMethod: [{
|
|
89
|
+
"id": "https://example.com/peson2#key3",
|
|
90
|
+
"type": "Multikey",
|
|
91
|
+
"controller": "https://example.com/person2",
|
|
92
|
+
"publicKeyMultibase": "zgghBUVkqmWS8e1j4aN2yowLAEkJC6wowB9wWmLRACYCok7UzstWcTBp3waKiDUM7wqL9bbBD9W9FvNaXEK2KPCZ9ffhvd5dxChJL9bdPQSrMwa28FEYMGDtcF1uocrYNmZm2dBBMaWrCu8U3s4PpVVhn4hsWDL8GLuE466pkJs9Hy8xmECoaaVgAZLiYDw2gwrjHDiX2i7aDHKfE7aSZWUWmC8nAGNZ7DX5pXoyXK3pxuaCWxNxXwPmaFwgKDyy9uhtBJ8znp9NZXkXHBTQe5uAi8GFwHY5asvqCmYPrAGWxcT6pdbZaJHdWkM7nw6apBHfakKs42oMqdBoJ2WkkresoT1qHrX2GW7gNP9PLtveF4vfEd6cwgHKQCdYgayG3muGfZiPvML75cyfkNrjkctvuQUfMxY9umbd2TG3V3mPnLrvQnqHpuRMZYtCn3nX1qfZaqFhTwT4NFPqVNLqvgR6k9vcuGXn6Ndaumhd5xtTK64jk3e2gPBit9iq6MrFUSoxNsbTty4kqcHAodtkK8CMSxUxbFP1kK3nyy8ZfeMgDCts1KboBcT2m5FMpQpYxKtNBfvhTuyeDDC34uhbY8itmTAnDwSr5mKrniwwDUGPZFejda51TYs1N9D9Ejzaw5Mvr8qN6wahHmsDBWTbWwV6YKVMD1MjAhJBUopWJWB5x6mEBAX25MssKfAEhJyDtqYWjq63uQHUJCsPJp"
|
|
93
|
+
}, {
|
|
94
|
+
"id": "https://example.com/person2#key4",
|
|
95
|
+
"type": "Multikey",
|
|
96
|
+
"controller": "https://example.com/person2",
|
|
97
|
+
"publicKeyMultibase": "z6MkhVPuyvgG1RkMv67azDqDCDERPXVrUg1i3qchXY5EACE3"
|
|
98
|
+
}]
|
|
110
99
|
};
|
|
111
100
|
|
|
112
101
|
//#endregion
|
|
@@ -332,23 +321,20 @@ test("Federation.createContext()", async (t) => {
|
|
|
332
321
|
publicKey: ed25519PublicKey.publicKey
|
|
333
322
|
})
|
|
334
323
|
}]);
|
|
335
|
-
|
|
336
|
-
assertEquals(await loader("https://example.com/object"), {
|
|
324
|
+
assertEquals(await (await ctx.getDocumentLoader({ identifier: "handle" }))("https://example.com/object"), {
|
|
337
325
|
contextUrl: null,
|
|
338
326
|
documentUrl: "https://example.com/object",
|
|
339
327
|
document: true
|
|
340
328
|
});
|
|
341
|
-
|
|
342
|
-
assertEquals(await loader2("https://example.com/object"), {
|
|
329
|
+
assertEquals(await (await ctx.getDocumentLoader({ username: "HANDLE" }))("https://example.com/object"), {
|
|
343
330
|
contextUrl: null,
|
|
344
331
|
documentUrl: "https://example.com/object",
|
|
345
332
|
document: true
|
|
346
333
|
});
|
|
347
|
-
|
|
334
|
+
assertEquals(await ctx.getDocumentLoader({
|
|
348
335
|
keyId: new URL("https://example.com/key2"),
|
|
349
336
|
privateKey: rsaPrivateKey2
|
|
350
|
-
})
|
|
351
|
-
assertEquals(await loader3("https://example.com/object"), {
|
|
337
|
+
})("https://example.com/object"), {
|
|
352
338
|
contextUrl: null,
|
|
353
339
|
documentUrl: "https://example.com/object",
|
|
354
340
|
document: true
|
|
@@ -356,12 +342,11 @@ test("Federation.createContext()", async (t) => {
|
|
|
356
342
|
assertEquals(await ctx.lookupObject("https://example.com/object"), null);
|
|
357
343
|
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new Create({})), TypeError, "The activity to send must have at least one actor property.");
|
|
358
344
|
await ctx.sendActivity({ identifier: "handle" }, [], new Create({ actor: new URL("https://example.com/users/handle") }));
|
|
359
|
-
|
|
345
|
+
assertEquals(await createFederation({
|
|
360
346
|
kv,
|
|
361
347
|
documentLoader: mockDocumentLoader,
|
|
362
348
|
contextLoader: mockDocumentLoader
|
|
363
|
-
}).createContext(new URL("https://example.com/"), 123)
|
|
364
|
-
assertEquals(await ctx2.lookupObject("https://example.com/object"), new Object$1({
|
|
349
|
+
}).createContext(new URL("https://example.com/"), 123).lookupObject("https://example.com/object"), new Object$1({
|
|
365
350
|
id: new URL("https://example.com/object"),
|
|
366
351
|
name: "Fetched object"
|
|
367
352
|
}));
|
|
@@ -656,8 +641,7 @@ test("Federation.createContext()", async (t) => {
|
|
|
656
641
|
kv,
|
|
657
642
|
userAgent: "CustomUserAgent/1.2.3"
|
|
658
643
|
}).createContext(new URL("https://example.com/"), 123);
|
|
659
|
-
|
|
660
|
-
assertEquals(nodeInfo, {
|
|
644
|
+
assertEquals(await ctx.lookupNodeInfo("https://example.com/"), {
|
|
661
645
|
software: {
|
|
662
646
|
name: "foo",
|
|
663
647
|
version: {
|
|
@@ -675,8 +659,7 @@ test("Federation.createContext()", async (t) => {
|
|
|
675
659
|
localComments: 456
|
|
676
660
|
}
|
|
677
661
|
});
|
|
678
|
-
|
|
679
|
-
assertEquals(rawNodeInfo, {
|
|
662
|
+
assertEquals(await ctx.lookupNodeInfo("https://example.com/", { parse: "none" }), {
|
|
680
663
|
software: {
|
|
681
664
|
name: "foo",
|
|
682
665
|
version: "1.2.3"
|
|
@@ -1000,9 +983,8 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
|
1000
983
|
if (verified.length > 0) return new Response(null, { status: 202 });
|
|
1001
984
|
return new Response(null, { status: 401 });
|
|
1002
985
|
});
|
|
1003
|
-
const kv = new MemoryKvStore();
|
|
1004
986
|
const federation = new FederationImpl({
|
|
1005
|
-
kv,
|
|
987
|
+
kv: new MemoryKvStore(),
|
|
1006
988
|
contextLoader: mockDocumentLoader
|
|
1007
989
|
});
|
|
1008
990
|
const context = federation.createContext(new URL("https://example.com/"));
|
|
@@ -1096,11 +1078,10 @@ test("ContextImpl.lookupObject()", async (t) => {
|
|
|
1096
1078
|
assertEquals(result.preferredUsername, "test");
|
|
1097
1079
|
});
|
|
1098
1080
|
await t.step("allowPrivateAddress: false", async () => {
|
|
1099
|
-
|
|
1081
|
+
assertEquals(await createFederation({
|
|
1100
1082
|
kv: new MemoryKvStore(),
|
|
1101
1083
|
allowPrivateAddress: false
|
|
1102
|
-
}).createContext(new URL("https://example.com/")).lookupObject("@test@localhost");
|
|
1103
|
-
assertEquals(result, null);
|
|
1084
|
+
}).createContext(new URL("https://example.com/")).lookupObject("@test@localhost"), null);
|
|
1104
1085
|
});
|
|
1105
1086
|
esm_default.hardReset();
|
|
1106
1087
|
});
|
|
@@ -1496,9 +1477,8 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1496
1477
|
if (verified.length > 0) return new Response(null, { status: 202 });
|
|
1497
1478
|
return new Response(null, { status: 401 });
|
|
1498
1479
|
});
|
|
1499
|
-
const kv = new MemoryKvStore();
|
|
1500
1480
|
const federation = new FederationImpl({
|
|
1501
|
-
kv,
|
|
1481
|
+
kv: new MemoryKvStore(),
|
|
1502
1482
|
contextLoader: mockDocumentLoader
|
|
1503
1483
|
});
|
|
1504
1484
|
await t.step("skip", async () => {
|
|
@@ -1568,13 +1548,12 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1568
1548
|
assertEquals(verified, ["proof"]);
|
|
1569
1549
|
});
|
|
1570
1550
|
await t.step("LD Signatures", async () => {
|
|
1571
|
-
|
|
1551
|
+
await new InboxContextImpl(null, await signJsonLd({
|
|
1572
1552
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1573
1553
|
"type": "Create",
|
|
1574
1554
|
"id": "https://example.com/activity",
|
|
1575
1555
|
"actor": "https://example.com/person2"
|
|
1576
|
-
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader })
|
|
1577
|
-
await new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1556
|
+
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader }), "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1578
1557
|
data: void 0,
|
|
1579
1558
|
federation,
|
|
1580
1559
|
url: new URL("https://example.com/"),
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { i as MemoryKvStore, n as KvStore, r as KvStoreSetOptions, t as KvKey } from "../kv-CyvhW67T.js";
|
|
4
|
+
import { $ as SharedInboxKeyDispatcher, A as Message, B as ActorDispatcher, C as FederationOrigin, D as RetryContext, E as CreateExponentialBackoffPolicyOptions, F as RouterRouteResult, G as CollectionCursor, H as ActorKeyPairsDispatcher, I as RespondWithObjectOptions, J as InboxListener, K as CollectionDispatcher, L as respondWithObject, M as Router, N as RouterError, O as RetryPolicy, P as RouterOptions, Q as OutboxErrorHandler, R as respondWithObjectIfAcceptable, S as FederationKvPrefixes, T as createFederation, U as AuthorizePredicate, V as ActorHandleMapper, W as CollectionCounter, X as ObjectAuthorizePredicate, Y as NodeInfoDispatcher, Z as ObjectDispatcher, _ as FederationOptions, a as InboxContext, b as ObjectCallbackSetters, c as RouteActivityOptions, d as ActorCallbackSetters, et as SenderKeyPair, f as CollectionCallbackSetters, g as FederationFetchOptions, h as FederationBuilder, i as GetSignedKeyOptions, j as createFederationBuilder, k as createExponentialBackoffPolicy, l as SendActivityOptions, m as Federation, n as Context, nt as buildCollectionSynchronizationHeader, o as ParseUriResult, p as Federatable, q as InboxErrorHandler, r as ForwardActivityOptions, rt as digest, s as RequestContext, t as ActorKeyPair, tt as PageItems, u as SendActivityOptionsForCollection, v as FederationStartQueueOptions, w as FederationQueueOptions, x as CreateFederationOptions, y as InboxListenerSetters, z as ActorAliasMapper } from "../context-C0X9n1tC.js";
|
|
5
|
+
import { a as MessageQueueListenOptions, i as MessageQueueEnqueueOptions, n as InProcessMessageQueueOptions, o as ParallelMessageQueue, r as MessageQueue, t as InProcessMessageQueue } from "../mq-CITHOe0n.js";
|
|
6
|
+
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, type CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, type FederationKvPrefixes, FederationOptions, type FederationOrigin, type FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, type Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, type RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, type SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
|
@@ -2,17 +2,200 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../transformers-
|
|
6
|
-
import "../docloader-
|
|
7
|
-
import "../actor-
|
|
8
|
-
import {
|
|
9
|
-
import "../lookup-
|
|
10
|
-
import "../key-
|
|
11
|
-
import "../http-
|
|
12
|
-
import "../proof-
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../vocab-oKloyO0F.js";
|
|
5
|
+
import "../transformers-CFSWUhNi.js";
|
|
6
|
+
import "../docloader-M1Np6SYc.js";
|
|
7
|
+
import "../actor-_hg-8_KF.js";
|
|
8
|
+
import { a as createFederation, c as respondWithObjectIfAcceptable, d as createFederationBuilder, f as Router, l as buildCollectionSynchronizationHeader, o as createExponentialBackoffPolicy, p as RouterError, s as respondWithObject, u as digest } from "../middleware-DRRaBIs3.js";
|
|
9
|
+
import "../lookup-DIQCWtDD.js";
|
|
10
|
+
import "../key-Bj3ZyKd0.js";
|
|
11
|
+
import "../http-BDLuDcCk.js";
|
|
12
|
+
import "../proof-B8LPOkvZ.js";
|
|
13
|
+
import "../types-BXvx0wJm.js";
|
|
14
|
+
import "../authdocloader-D0Ds92Vk.js";
|
|
15
|
+
import "../vocab-BXeM76FR.js";
|
|
17
16
|
|
|
17
|
+
//#region federation/kv.ts
|
|
18
|
+
/**
|
|
19
|
+
* A key-value store that stores values in memory.
|
|
20
|
+
* Do not use this in production as it does not persist values.
|
|
21
|
+
*
|
|
22
|
+
* @since 0.5.0
|
|
23
|
+
*/
|
|
24
|
+
var MemoryKvStore = class {
|
|
25
|
+
#values = {};
|
|
26
|
+
#encodeKey(key) {
|
|
27
|
+
return JSON.stringify(key);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* {@inheritDoc KvStore.get}
|
|
31
|
+
*/
|
|
32
|
+
get(key) {
|
|
33
|
+
const encodedKey = this.#encodeKey(key);
|
|
34
|
+
const entry = this.#values[encodedKey];
|
|
35
|
+
if (entry == null) return Promise.resolve(void 0);
|
|
36
|
+
const [value, expiration] = entry;
|
|
37
|
+
if (expiration != null && Temporal.Now.instant().until(expiration).sign < 0) {
|
|
38
|
+
delete this.#values[encodedKey];
|
|
39
|
+
return Promise.resolve(void 0);
|
|
40
|
+
}
|
|
41
|
+
return Promise.resolve(value);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* {@inheritDoc KvStore.set}
|
|
45
|
+
*/
|
|
46
|
+
set(key, value, options) {
|
|
47
|
+
const encodedKey = this.#encodeKey(key);
|
|
48
|
+
const expiration = options?.ttl == null ? null : Temporal.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
|
|
49
|
+
this.#values[encodedKey] = [value, expiration];
|
|
50
|
+
return Promise.resolve();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* {@inheritDoc KvStore.delete}
|
|
54
|
+
*/
|
|
55
|
+
delete(key) {
|
|
56
|
+
const encodedKey = this.#encodeKey(key);
|
|
57
|
+
delete this.#values[encodedKey];
|
|
58
|
+
return Promise.resolve();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region federation/mq.ts
|
|
64
|
+
/**
|
|
65
|
+
* A message queue that processes messages in the same process.
|
|
66
|
+
* Do not use this in production as it does neither persist messages nor
|
|
67
|
+
* distribute them across multiple processes.
|
|
68
|
+
*
|
|
69
|
+
* @since 0.5.0
|
|
70
|
+
*/
|
|
71
|
+
var InProcessMessageQueue = class {
|
|
72
|
+
#messages;
|
|
73
|
+
#monitors;
|
|
74
|
+
#pollIntervalMs;
|
|
75
|
+
/**
|
|
76
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
77
|
+
* @param options Additional options for the in-process message queue.
|
|
78
|
+
*/
|
|
79
|
+
constructor(options = {}) {
|
|
80
|
+
this.#messages = [];
|
|
81
|
+
this.#monitors = {};
|
|
82
|
+
this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
|
|
83
|
+
}
|
|
84
|
+
enqueue(message, options) {
|
|
85
|
+
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
86
|
+
if (delay > 0) {
|
|
87
|
+
setTimeout(() => this.enqueue(message, {
|
|
88
|
+
...options,
|
|
89
|
+
delay: void 0
|
|
90
|
+
}), delay);
|
|
91
|
+
return Promise.resolve();
|
|
92
|
+
}
|
|
93
|
+
this.#messages.push(message);
|
|
94
|
+
for (const monitorId in this.#monitors) this.#monitors[monitorId]();
|
|
95
|
+
return Promise.resolve();
|
|
96
|
+
}
|
|
97
|
+
enqueueMany(messages, options) {
|
|
98
|
+
if (messages.length === 0) return Promise.resolve();
|
|
99
|
+
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
100
|
+
if (delay > 0) {
|
|
101
|
+
setTimeout(() => this.enqueueMany(messages, {
|
|
102
|
+
...options,
|
|
103
|
+
delay: void 0
|
|
104
|
+
}), delay);
|
|
105
|
+
return Promise.resolve();
|
|
106
|
+
}
|
|
107
|
+
this.#messages.push(...messages);
|
|
108
|
+
for (const monitorId in this.#monitors) this.#monitors[monitorId]();
|
|
109
|
+
return Promise.resolve();
|
|
110
|
+
}
|
|
111
|
+
async listen(handler, options = {}) {
|
|
112
|
+
const signal = options.signal;
|
|
113
|
+
while (signal == null || !signal.aborted) {
|
|
114
|
+
while (this.#messages.length > 0) await handler(this.#messages.shift());
|
|
115
|
+
await this.#wait(this.#pollIntervalMs, signal);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
#wait(ms, signal) {
|
|
119
|
+
let timer = null;
|
|
120
|
+
return Promise.any([new Promise((resolve) => {
|
|
121
|
+
signal?.addEventListener("abort", () => {
|
|
122
|
+
if (timer != null) clearTimeout(timer);
|
|
123
|
+
resolve();
|
|
124
|
+
}, { once: true });
|
|
125
|
+
const monitorId = crypto.randomUUID();
|
|
126
|
+
this.#monitors[monitorId] = () => {
|
|
127
|
+
delete this.#monitors[monitorId];
|
|
128
|
+
if (timer != null) clearTimeout(timer);
|
|
129
|
+
resolve();
|
|
130
|
+
};
|
|
131
|
+
}), new Promise((resolve) => timer = setTimeout(resolve, ms))]);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* A message queue that processes messages in parallel. It takes another
|
|
136
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
137
|
+
* number of workers.
|
|
138
|
+
*
|
|
139
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
140
|
+
*
|
|
141
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
142
|
+
* are not running in separate threads or processes. They are running in the
|
|
143
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
144
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
145
|
+
* workloads.
|
|
146
|
+
*
|
|
147
|
+
* @since 1.0.0
|
|
148
|
+
*/
|
|
149
|
+
var ParallelMessageQueue = class ParallelMessageQueue {
|
|
150
|
+
queue;
|
|
151
|
+
workers;
|
|
152
|
+
/**
|
|
153
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
154
|
+
* number of workers.
|
|
155
|
+
* @param queue The message queue to use under the hood. Note that
|
|
156
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
157
|
+
* @param workers The number of workers to process messages in parallel.
|
|
158
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
159
|
+
* {@link ParallelMessageQueue}.
|
|
160
|
+
*/
|
|
161
|
+
constructor(queue, workers) {
|
|
162
|
+
if (queue instanceof ParallelMessageQueue) throw new TypeError("Cannot nest ParallelMessageQueue.");
|
|
163
|
+
this.queue = queue;
|
|
164
|
+
this.workers = workers;
|
|
165
|
+
}
|
|
166
|
+
enqueue(message, options) {
|
|
167
|
+
return this.queue.enqueue(message, options);
|
|
168
|
+
}
|
|
169
|
+
async enqueueMany(messages, options) {
|
|
170
|
+
if (this.queue.enqueueMany == null) {
|
|
171
|
+
const errors = (await Promise.allSettled(messages.map((message) => this.queue.enqueue(message, options)))).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
172
|
+
if (errors.length > 1) throw new AggregateError(errors, "Failed to enqueue messages.");
|
|
173
|
+
else if (errors.length === 1) throw errors[0];
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
await this.queue.enqueueMany(messages, options);
|
|
177
|
+
}
|
|
178
|
+
listen(handler, options = {}) {
|
|
179
|
+
const workers = /* @__PURE__ */ new Map();
|
|
180
|
+
return this.queue.listen(async (message) => {
|
|
181
|
+
while (workers.size >= this.workers) {
|
|
182
|
+
const consumedId = await Promise.any(workers.values());
|
|
183
|
+
workers.delete(consumedId);
|
|
184
|
+
}
|
|
185
|
+
const workerId = crypto.randomUUID();
|
|
186
|
+
const promise = this.#work(workerId, handler, message);
|
|
187
|
+
workers.set(workerId, promise);
|
|
188
|
+
}, options);
|
|
189
|
+
}
|
|
190
|
+
async #work(workerId, handler, message) {
|
|
191
|
+
await this.#sleep(0);
|
|
192
|
+
await handler(message);
|
|
193
|
+
return workerId;
|
|
194
|
+
}
|
|
195
|
+
#sleep(ms) {
|
|
196
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
//#endregion
|
|
18
201
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
14
|
-
import "../assert_throws-YetpVSc-.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
9
|
+
import { i as assertGreaterOrEqual, r as assertGreater } from "../std__assert-BdP_WkD-.js";
|
|
10
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
11
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
12
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
15
13
|
import { delay } from "@es-toolkit/es-toolkit";
|
|
16
14
|
|
|
17
15
|
//#region federation/mq.ts
|
|
@@ -65,10 +63,7 @@ var InProcessMessageQueue = class {
|
|
|
65
63
|
async listen(handler, options = {}) {
|
|
66
64
|
const signal = options.signal;
|
|
67
65
|
while (signal == null || !signal.aborted) {
|
|
68
|
-
while (this.#messages.length > 0)
|
|
69
|
-
const message = this.#messages.shift();
|
|
70
|
-
await handler(message);
|
|
71
|
-
}
|
|
66
|
+
while (this.#messages.length > 0) await handler(this.#messages.shift());
|
|
72
67
|
await this.#wait(this.#pollIntervalMs, signal);
|
|
73
68
|
}
|
|
74
69
|
}
|
|
@@ -210,7 +205,7 @@ test("InProcessMessageQueue", async (t) => {
|
|
|
210
205
|
});
|
|
211
206
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
|
212
207
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
|
213
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
|
208
|
+
const { DenoKvMessageQueue } = await import("../denokv-XeyH3cFs.js");
|
|
214
209
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
|
215
210
|
}
|
|
216
211
|
for (const mqName in queues) test({
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals, u as AssertionError } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as createExponentialBackoffPolicy } from "../retry-BQet39_l.js";
|
|
9
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
10
|
+
import { t as assertNotEquals } from "../assert_not_equals-C1azCAB0.js";
|
|
10
11
|
|
|
11
12
|
//#region federation/retry.test.ts
|
|
12
13
|
test("createExponentialBackoffPolicy()", () => {
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import { test } from "../testing-
|
|
11
|
-
import "../std__assert-
|
|
12
|
-
import { assertFalse } from "../assert_rejects-
|
|
13
|
-
import "../assert_is_error-
|
|
14
|
-
import "../
|
|
15
|
-
import { assertThrows } from "../assert_throws-YetpVSc-.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as assert } from "../assert-C-mZuSQl.js";
|
|
9
|
+
import { n as RouterError, t as Router } from "../router-BuDkN4RQ.js";
|
|
10
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
11
|
+
import "../std__assert-BdP_WkD-.js";
|
|
12
|
+
import { n as assertFalse } from "../assert_rejects-Bkh5lA1a.js";
|
|
13
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
14
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
16
15
|
|
|
17
16
|
//#region federation/router.test.ts
|
|
18
17
|
function setUp(options = {}) {
|