@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
@@ -3,38 +3,50 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person,
|
6
|
+
import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person, RouterError, getTypeId, lookupObject } 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 { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-
|
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 "../retry-
|
28
|
-
import "../send-
|
29
|
-
import { mockDocumentLoader, test } from "../testing-
|
30
|
-
import { assertStrictEquals } from "../std__assert-
|
31
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
32
|
-
import "../
|
33
|
-
import { assertNotEquals } from "../assert_not_equals-
|
34
|
-
import {
|
35
|
-
import {
|
36
|
-
import { esm_default } from "../esm-CHdxdkuH.js";
|
11
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, 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 { signRequest, verifyRequest } from "../http-D2kIm9la.js";
|
17
|
+
import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-CIhvSCCr.js";
|
18
|
+
import { doesActorOwnKey } from "../owner-Dvh7mBvr.js";
|
19
|
+
import { signObject, verifyObject } from "../proof-Dgy35fzc.js";
|
20
|
+
import { fetchDocumentLoader, getAuthenticatedDocumentLoader } from "../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 { assertStrictEquals } from "../std__assert-DWivtrGR.js";
|
31
|
+
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
32
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
33
|
+
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
34
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-DMHs8XNn.js";
|
35
|
+
import { esm_default } from "../esm-C-Qa1zEM.js";
|
37
36
|
|
37
|
+
//#region src/testing/fixtures/example.com/create.json
|
38
|
+
var __context$2 = "https://www.w3.org/ns/activitystreams";
|
39
|
+
var type$2 = "Create";
|
40
|
+
var id$2 = "https://example.com/create";
|
41
|
+
var actor = "https://example.com/person";
|
42
|
+
var create_default = {
|
43
|
+
"@context": __context$2,
|
44
|
+
type: type$2,
|
45
|
+
id: id$2,
|
46
|
+
actor
|
47
|
+
};
|
48
|
+
|
49
|
+
//#endregion
|
38
50
|
//#region src/testing/fixtures/example.com/person.json
|
39
51
|
var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
|
40
52
|
var id$1 = "https://example.com/person";
|
@@ -108,7 +120,7 @@ test("createFederation()", async (t) => {
|
|
108
120
|
await t.step("allowPrivateAddress", () => {
|
109
121
|
assertThrows(() => createFederation({
|
110
122
|
kv,
|
111
|
-
|
123
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
112
124
|
allowPrivateAddress: true
|
113
125
|
}), TypeError);
|
114
126
|
assertThrows(() => createFederation({
|
@@ -266,11 +278,7 @@ test({
|
|
266
278
|
federation.setNodeInfoDispatcher("/nodeinfo/2.1", () => ({
|
267
279
|
software: {
|
268
280
|
name: "Example",
|
269
|
-
version:
|
270
|
-
major: 1,
|
271
|
-
minor: 2,
|
272
|
-
patch: 3
|
273
|
-
}
|
281
|
+
version: "1.2.3"
|
274
282
|
},
|
275
283
|
protocols: ["activitypub"],
|
276
284
|
usage: {
|
@@ -457,7 +465,7 @@ test({
|
|
457
465
|
kv,
|
458
466
|
origin: "https://ap.example.com",
|
459
467
|
documentLoaderFactory: () => mockDocumentLoader,
|
460
|
-
|
468
|
+
contextLoaderFactory: () => mockDocumentLoader
|
461
469
|
});
|
462
470
|
const ctx = federation.createContext(new URL("https://example.com:1234/"));
|
463
471
|
assertEquals(ctx.origin, "https://example.com:1234");
|
@@ -467,11 +475,7 @@ test({
|
|
467
475
|
federation.setNodeInfoDispatcher("/nodeinfo/2.1", () => ({
|
468
476
|
software: {
|
469
477
|
name: "Example",
|
470
|
-
version:
|
471
|
-
major: 1,
|
472
|
-
minor: 2,
|
473
|
-
patch: 3
|
474
|
-
}
|
478
|
+
version: "1.2.3"
|
475
479
|
},
|
476
480
|
protocols: ["activitypub"],
|
477
481
|
usage: {
|
@@ -661,13 +665,7 @@ test({
|
|
661
665
|
assertEquals(nodeInfo, {
|
662
666
|
software: {
|
663
667
|
name: "foo",
|
664
|
-
version:
|
665
|
-
major: 1,
|
666
|
-
minor: 2,
|
667
|
-
patch: 3,
|
668
|
-
build: [],
|
669
|
-
prerelease: []
|
670
|
-
}
|
668
|
+
version: "1.2.3"
|
671
669
|
},
|
672
670
|
protocols: ["activitypub", "diaspora"],
|
673
671
|
usage: {
|
@@ -695,7 +693,7 @@ test({
|
|
695
693
|
kv,
|
696
694
|
documentLoaderFactory: () => mockDocumentLoader
|
697
695
|
});
|
698
|
-
const req = new Request("https://example.com/");
|
696
|
+
const req = new Request("https://example.com/", { headers: { "accept": "application/ld+json" } });
|
699
697
|
const ctx = federation.createContext(req, 123);
|
700
698
|
assertEquals(ctx.request, req);
|
701
699
|
assertEquals(ctx.url, new URL("https://example.com/"));
|
@@ -713,7 +711,7 @@ test({
|
|
713
711
|
assertEquals(await ctx.getSignedKey(), null);
|
714
712
|
assertEquals(await ctx.getSignedKeyOwner(), null);
|
715
713
|
await assertRejects(() => ctx.getActor("someone"), Error, "No actor dispatcher registered");
|
716
|
-
const signedReq = await signRequest(new Request("https://example.com/"), rsaPrivateKey2, rsaPublicKey2.id);
|
714
|
+
const signedReq = await signRequest(new Request("https://example.com/", { headers: { "accept": "application/ld+json" } }), rsaPrivateKey2, rsaPublicKey2.id);
|
717
715
|
const signedCtx = federation.createContext(signedReq, 456);
|
718
716
|
assertEquals(signedCtx.request, signedReq);
|
719
717
|
assertEquals(signedCtx.url, new URL("https://example.com/"));
|
@@ -722,7 +720,7 @@ test({
|
|
722
720
|
assertEquals(await signedCtx.getSignedKeyOwner(), null);
|
723
721
|
assertEquals(await signedCtx.getSignedKey(), rsaPublicKey2);
|
724
722
|
assertEquals(await signedCtx.getSignedKeyOwner(), null);
|
725
|
-
const signedReq2 = await signRequest(new Request("https://example.com/"), rsaPrivateKey3, rsaPublicKey3.id);
|
723
|
+
const signedReq2 = await signRequest(new Request("https://example.com/", { headers: { "accept": "application/ld+json" } }), rsaPrivateKey3, rsaPublicKey3.id);
|
726
724
|
const signedCtx2 = federation.createContext(signedReq2, 456);
|
727
725
|
assertEquals(signedCtx2.request, signedReq2);
|
728
726
|
assertEquals(signedCtx2.url, new URL("https://example.com/"));
|
@@ -755,7 +753,7 @@ test({
|
|
755
753
|
});
|
756
754
|
await t.step("RequestContext.clone()", () => {
|
757
755
|
const federation = createFederation({ kv });
|
758
|
-
const req = new Request("https://example.com/");
|
756
|
+
const req = new Request("https://example.com/", { headers: { "accept": "application/ld+json" } });
|
759
757
|
const ctx = federation.createContext(req, 123);
|
760
758
|
const clone = ctx.clone(456);
|
761
759
|
assertStrictEquals(clone.request, ctx.request);
|
@@ -771,6 +769,157 @@ test({
|
|
771
769
|
esm_default.hardReset();
|
772
770
|
}
|
773
771
|
});
|
772
|
+
test("Federation.fetch()", async (t) => {
|
773
|
+
esm_default.spyGlobal();
|
774
|
+
esm_default.get("https://example.com/key2", {
|
775
|
+
headers: { "Content-Type": "application/activity+json" },
|
776
|
+
body: await rsaPublicKey2.toJsonLd({ contextLoader: mockDocumentLoader })
|
777
|
+
});
|
778
|
+
esm_default.get("begin:https://example.com/person", {
|
779
|
+
headers: { "Content-Type": "application/activity+json" },
|
780
|
+
body: person_default
|
781
|
+
});
|
782
|
+
const createTestContext = () => {
|
783
|
+
const kv = new MemoryKvStore();
|
784
|
+
const inbox = [];
|
785
|
+
const dispatches = [];
|
786
|
+
const federation = createFederation({
|
787
|
+
kv,
|
788
|
+
documentLoaderFactory: () => mockDocumentLoader,
|
789
|
+
authenticatedDocumentLoaderFactory(identity) {
|
790
|
+
const docLoader = getAuthenticatedDocumentLoader(identity);
|
791
|
+
return (url) => {
|
792
|
+
const urlObj = new URL(url);
|
793
|
+
if (urlObj.host === "example.com") return docLoader(url);
|
794
|
+
return mockDocumentLoader(url);
|
795
|
+
};
|
796
|
+
}
|
797
|
+
});
|
798
|
+
federation.setActorDispatcher("/users/{identifier}", (ctx, identifier) => {
|
799
|
+
dispatches.push(identifier);
|
800
|
+
return new Person({
|
801
|
+
id: ctx.getActorUri(identifier),
|
802
|
+
inbox: ctx.getInboxUri(identifier),
|
803
|
+
preferredUsername: identifier
|
804
|
+
});
|
805
|
+
}).setKeyPairsDispatcher(() => {
|
806
|
+
return [{
|
807
|
+
privateKey: rsaPrivateKey2,
|
808
|
+
publicKey: rsaPublicKey2.publicKey
|
809
|
+
}];
|
810
|
+
});
|
811
|
+
federation.setInboxDispatcher("/users/{identifier}/inbox", () => {
|
812
|
+
return { items: [] };
|
813
|
+
});
|
814
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (_ctx, activity) => {
|
815
|
+
inbox.push(activity.id.toString());
|
816
|
+
return;
|
817
|
+
});
|
818
|
+
return {
|
819
|
+
federation,
|
820
|
+
inbox,
|
821
|
+
dispatches
|
822
|
+
};
|
823
|
+
};
|
824
|
+
await t.step("GET without accepts header", async () => {
|
825
|
+
const { federation, dispatches } = createTestContext();
|
826
|
+
const response = await federation.fetch(new Request("https://example.com/users/actor", { method: "GET" }), { contextData: void 0 });
|
827
|
+
assertEquals(dispatches, []);
|
828
|
+
assertEquals(response.status, 406);
|
829
|
+
});
|
830
|
+
await t.step("POST with application/json", async () => {
|
831
|
+
const { federation, inbox } = createTestContext();
|
832
|
+
const request = await signRequest(new Request("https://example.com/users/json/inbox", {
|
833
|
+
method: "POST",
|
834
|
+
headers: {
|
835
|
+
"Accept": "application/json",
|
836
|
+
"Content-Type": "application/json"
|
837
|
+
},
|
838
|
+
body: JSON.stringify(create_default)
|
839
|
+
}), rsaPrivateKey2, rsaPublicKey2.id);
|
840
|
+
const response = await federation.fetch(request, { contextData: void 0 });
|
841
|
+
assertEquals(response.status, 202);
|
842
|
+
assertEquals(inbox.length, 1, "Expected one item in the inbox, json");
|
843
|
+
assertEquals(inbox[0], create_default.id);
|
844
|
+
});
|
845
|
+
await t.step("GET with application/json", async () => {
|
846
|
+
const { federation, dispatches } = createTestContext();
|
847
|
+
const response = await federation.fetch(new Request("https://example.com/users/json", {
|
848
|
+
method: "GET",
|
849
|
+
headers: { "Accept": "application/json" }
|
850
|
+
}), { contextData: void 0 });
|
851
|
+
assertEquals(dispatches, ["json"]);
|
852
|
+
assertEquals(response.status, 200);
|
853
|
+
});
|
854
|
+
await t.step("POST with application/ld+json", async () => {
|
855
|
+
const { federation, inbox } = createTestContext();
|
856
|
+
const request = await signRequest(new Request("https://example.com/users/ld/inbox", {
|
857
|
+
method: "POST",
|
858
|
+
headers: {
|
859
|
+
"Accept": "application/ld+json",
|
860
|
+
"Content-Type": "application/activity+json"
|
861
|
+
},
|
862
|
+
body: JSON.stringify(create_default)
|
863
|
+
}), rsaPrivateKey2, rsaPublicKey2.id);
|
864
|
+
const response = await federation.fetch(request, { contextData: void 0 });
|
865
|
+
assertEquals(response.status, 202);
|
866
|
+
assertEquals(inbox.length, 1, "Expected one inbox activity, ld+json");
|
867
|
+
assertEquals(inbox[0], create_default.id);
|
868
|
+
});
|
869
|
+
await t.step("GET with application/ld+json", async () => {
|
870
|
+
const { federation, dispatches } = createTestContext();
|
871
|
+
const request = new Request("https://example.com/users/ld", {
|
872
|
+
method: "GET",
|
873
|
+
headers: { "Accept": "application/ld+json" }
|
874
|
+
});
|
875
|
+
const response = await federation.fetch(request, { contextData: void 0 });
|
876
|
+
assertEquals(dispatches, ["ld"]);
|
877
|
+
assertEquals(response.status, 200);
|
878
|
+
});
|
879
|
+
await t.step("POST with application/activity+json", async () => {
|
880
|
+
const { federation, inbox } = createTestContext();
|
881
|
+
const request = await signRequest(new Request("https://example.com/users/activity/inbox", {
|
882
|
+
method: "POST",
|
883
|
+
headers: {
|
884
|
+
"Accept": "application/activity+json",
|
885
|
+
"Content-Type": "application/activity+json"
|
886
|
+
},
|
887
|
+
body: JSON.stringify(create_default)
|
888
|
+
}), rsaPrivateKey2, rsaPublicKey2.id);
|
889
|
+
const response = await federation.fetch(request, { contextData: void 0 });
|
890
|
+
assertEquals(response.status, 202);
|
891
|
+
assertEquals(inbox.length, 1);
|
892
|
+
assertEquals(inbox[0], create_default.id);
|
893
|
+
});
|
894
|
+
await t.step("GET with application/activity+json", async () => {
|
895
|
+
const { federation, dispatches } = createTestContext();
|
896
|
+
const request = new Request("https://example.com/users/activity", {
|
897
|
+
method: "GET",
|
898
|
+
headers: { "Accept": "application/ld+json" }
|
899
|
+
});
|
900
|
+
const response = await federation.fetch(request, { contextData: void 0 });
|
901
|
+
assertEquals(dispatches, ["activity"]);
|
902
|
+
assertEquals(response.status, 200);
|
903
|
+
});
|
904
|
+
await t.step("onNotAcceptable with GET", async () => {
|
905
|
+
const { federation } = createTestContext();
|
906
|
+
let notAcceptableCalled = false;
|
907
|
+
const response = await federation.fetch(new Request("https://example.com/users/html", {
|
908
|
+
method: "GET",
|
909
|
+
headers: { "Accept": "text/html" }
|
910
|
+
}), {
|
911
|
+
contextData: void 0,
|
912
|
+
onNotAcceptable: () => {
|
913
|
+
notAcceptableCalled = true;
|
914
|
+
return new Response("handled by onNotAcceptable", { status: 200 });
|
915
|
+
}
|
916
|
+
});
|
917
|
+
assertEquals(notAcceptableCalled, true);
|
918
|
+
assertEquals(response.status, 200);
|
919
|
+
assertEquals(await response.text(), "handled by onNotAcceptable");
|
920
|
+
});
|
921
|
+
esm_default.hardReset();
|
922
|
+
});
|
774
923
|
test("Federation.setInboxListeners()", async (t) => {
|
775
924
|
const kv = new MemoryKvStore();
|
776
925
|
esm_default.spyGlobal();
|
@@ -823,7 +972,10 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
823
972
|
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (ctx, create) => {
|
824
973
|
inbox.push([ctx, create]);
|
825
974
|
});
|
826
|
-
let response = await federation.fetch(new Request("https://example.com/inbox", {
|
975
|
+
let response = await federation.fetch(new Request("https://example.com/inbox", {
|
976
|
+
method: "POST",
|
977
|
+
headers: { "accept": "application/ld+json" }
|
978
|
+
}), { contextData: void 0 });
|
827
979
|
assertEquals(inbox, []);
|
828
980
|
assertEquals(response.status, 404);
|
829
981
|
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new Person({}) : null).setKeyPairsDispatcher(() => [{
|
@@ -840,23 +992,37 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
840
992
|
});
|
841
993
|
response = await federation.fetch(new Request("https://example.com/inbox", {
|
842
994
|
method: "POST",
|
843
|
-
body: JSON.stringify(await activity().toJsonLd(options))
|
995
|
+
body: JSON.stringify(await activity().toJsonLd(options)),
|
996
|
+
headers: {
|
997
|
+
"accept": "application/ld+json",
|
998
|
+
"content-type": "application/ld+json"
|
999
|
+
}
|
844
1000
|
}), { contextData: void 0 });
|
845
1001
|
assertEquals(inbox, []);
|
846
1002
|
assertEquals(response.status, 401);
|
847
|
-
response = await federation.fetch(new Request("https://example.com/users/no-one/inbox", {
|
1003
|
+
response = await federation.fetch(new Request("https://example.com/users/no-one/inbox", {
|
1004
|
+
method: "POST",
|
1005
|
+
headers: { "accept": "application/ld+json" }
|
1006
|
+
}), { contextData: void 0 });
|
848
1007
|
assertEquals(inbox, []);
|
849
1008
|
assertEquals(response.status, 404);
|
850
1009
|
response = await federation.fetch(new Request("https://example.com/users/john/inbox", {
|
851
1010
|
method: "POST",
|
852
|
-
body: JSON.stringify(await activity().toJsonLd(options))
|
1011
|
+
body: JSON.stringify(await activity().toJsonLd(options)),
|
1012
|
+
headers: {
|
1013
|
+
"accept": "application/ld+json",
|
1014
|
+
"content-type": "application/ld+json"
|
1015
|
+
}
|
853
1016
|
}), { contextData: void 0 });
|
854
1017
|
assertEquals(inbox, []);
|
855
1018
|
assertEquals(response.status, 401);
|
856
1019
|
const activityPayload = await activity().toJsonLd(options);
|
857
1020
|
let request = new Request("https://example.com/users/john/inbox", {
|
858
1021
|
method: "POST",
|
859
|
-
headers: {
|
1022
|
+
headers: {
|
1023
|
+
"Content-Type": "application/activity+json",
|
1024
|
+
accept: "application/ld+json"
|
1025
|
+
},
|
860
1026
|
body: JSON.stringify(activityPayload)
|
861
1027
|
});
|
862
1028
|
request = await signRequest(request, rsaPrivateKey3, new URL("https://example.com/person2#key3"));
|
@@ -873,7 +1039,10 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
873
1039
|
inbox.shift();
|
874
1040
|
request = new Request("https://another.host/users/john/inbox", {
|
875
1041
|
method: "POST",
|
876
|
-
headers: {
|
1042
|
+
headers: {
|
1043
|
+
"Content-Type": "application/activity+json",
|
1044
|
+
"accept": "application/ld+json"
|
1045
|
+
},
|
877
1046
|
body: JSON.stringify(activityPayload)
|
878
1047
|
});
|
879
1048
|
request = await signRequest(request, rsaPrivateKey3, new URL("https://example.com/person2#key3"));
|
@@ -888,7 +1057,10 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
888
1057
|
inbox.shift();
|
889
1058
|
request = new Request("https://example.com/inbox", {
|
890
1059
|
method: "POST",
|
891
|
-
headers: {
|
1060
|
+
headers: {
|
1061
|
+
"Content-Type": "application/activity+json",
|
1062
|
+
"accept": "application/ld+json"
|
1063
|
+
},
|
892
1064
|
body: JSON.stringify(await activity().toJsonLd(options))
|
893
1065
|
});
|
894
1066
|
request = await signRequest(request, rsaPrivateKey3, new URL("https://example.com/person2#key3"));
|
@@ -903,7 +1075,10 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
903
1075
|
inbox.shift();
|
904
1076
|
request = new Request("https://example.com/users/john/inbox", {
|
905
1077
|
method: "POST",
|
906
|
-
headers: {
|
1078
|
+
headers: {
|
1079
|
+
"Content-Type": "application/activity+json",
|
1080
|
+
"accept": "application/ld+json"
|
1081
|
+
},
|
907
1082
|
body: JSON.stringify(await (await signObject(activity(), ed25519PrivateKey, ed25519Multikey.id, options)).toJsonLd(options))
|
908
1083
|
});
|
909
1084
|
response = await federation.fetch(request, { contextData: void 0 });
|
@@ -942,7 +1117,10 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
942
1117
|
const activity = new Create({ actor: new URL("https://example.com/person") });
|
943
1118
|
let request = new Request("https://example.com/users/john/inbox", {
|
944
1119
|
method: "POST",
|
945
|
-
headers: {
|
1120
|
+
headers: {
|
1121
|
+
"Content-Type": "application/activity+json",
|
1122
|
+
"Accept": "application/activity+json"
|
1123
|
+
},
|
946
1124
|
body: JSON.stringify(await activity.toJsonLd({ contextLoader: mockDocumentLoader }))
|
947
1125
|
});
|
948
1126
|
request = await signRequest(request, rsaPrivateKey2, new URL("https://example.com/key2"));
|
@@ -1006,7 +1184,7 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
1006
1184
|
const kv = new MemoryKvStore();
|
1007
1185
|
const federation = new FederationImpl({
|
1008
1186
|
kv,
|
1009
|
-
|
1187
|
+
contextLoaderFactory: () => mockDocumentLoader
|
1010
1188
|
});
|
1011
1189
|
const context = federation.createContext(new URL("https://example.com/"));
|
1012
1190
|
await t.step("success", async () => {
|
@@ -1258,7 +1436,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
1258
1436
|
collectionSyncHeader = cl.request.headers.get("Collection-Synchronization");
|
1259
1437
|
const options = {
|
1260
1438
|
async documentLoader(url) {
|
1261
|
-
const response = await federation.fetch(new Request(url), { contextData: void 0 });
|
1439
|
+
const response = await federation.fetch(new Request(url, { headers: { "accept": "application/ld+json" } }), { contextData: void 0 });
|
1262
1440
|
if (response.ok) return {
|
1263
1441
|
contextUrl: null,
|
1264
1442
|
document: await response.json(),
|
@@ -1292,7 +1470,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
1292
1470
|
const kv = new MemoryKvStore();
|
1293
1471
|
const federation = new FederationImpl({
|
1294
1472
|
kv,
|
1295
|
-
|
1473
|
+
contextLoaderFactory: () => mockDocumentLoader
|
1296
1474
|
});
|
1297
1475
|
federation.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
1298
1476
|
if (identifier !== "1") return null;
|
@@ -1401,7 +1579,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
1401
1579
|
};
|
1402
1580
|
const federation2 = new FederationImpl({
|
1403
1581
|
kv,
|
1404
|
-
|
1582
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
1405
1583
|
queue
|
1406
1584
|
});
|
1407
1585
|
federation2.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
@@ -1681,7 +1859,7 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
1681
1859
|
const kv = new MemoryKvStore();
|
1682
1860
|
const federation = new FederationImpl({
|
1683
1861
|
kv,
|
1684
|
-
|
1862
|
+
contextLoaderFactory: () => mockDocumentLoader
|
1685
1863
|
});
|
1686
1864
|
await t.step("skip", async () => {
|
1687
1865
|
const activity = {
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('../transformers-CoBS-oFG.cjs');
|
6
|
+
require('../lookup-CfFkONZD.cjs');
|
7
|
+
require('../actor-Ba9Z1eNJ.cjs');
|
8
|
+
const require_middleware = require('../middleware-D74TgW2E.cjs');
|
9
|
+
require('../http-Dofes42e.cjs');
|
10
|
+
require('../proof-D0uThUvD.cjs');
|
11
|
+
const require_federation = require('../federation-CRpdnOMS.cjs');
|
12
|
+
require('../types-CWgzGaqk.cjs');
|
13
|
+
require('../kv-cache-Dkvbn6rg.cjs');
|
14
|
+
require('../vocab-DFaWWYDn.cjs');
|
15
|
+
|
16
|
+
exports.InProcessMessageQueue = require_federation.InProcessMessageQueue;
|
17
|
+
exports.MemoryKvStore = require_federation.MemoryKvStore;
|
18
|
+
exports.ParallelMessageQueue = require_federation.ParallelMessageQueue;
|
19
|
+
exports.Router = require_middleware.Router;
|
20
|
+
exports.RouterError = require_middleware.RouterError;
|
21
|
+
exports.buildCollectionSynchronizationHeader = require_middleware.buildCollectionSynchronizationHeader;
|
22
|
+
exports.createExponentialBackoffPolicy = require_middleware.createExponentialBackoffPolicy;
|
23
|
+
exports.createFederation = require_middleware.createFederation;
|
24
|
+
exports.createFederationBuilder = require_middleware.createFederationBuilder;
|
25
|
+
exports.digest = require_middleware.digest;
|
26
|
+
exports.respondWithObject = require_middleware.respondWithObject;
|
27
|
+
exports.respondWithObjectIfAcceptable = require_middleware.respondWithObjectIfAcceptable;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import "../client-94iWEfQa.cjs";
|
2
|
+
import "../vocab-CeDBzu-f.cjs";
|
3
|
+
import "../actor-f2NtjyCg.cjs";
|
4
|
+
import "../http-M8k5mKc0.cjs";
|
5
|
+
import "../owner-B4HbyP8s.cjs";
|
6
|
+
import "../mod-BxRCHTz-.cjs";
|
7
|
+
import "../mod-C58MZ7Wx.cjs";
|
8
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-DJ8aSy2Q.cjs";
|
9
|
+
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-Bxr0Q87_.cjs";
|
10
|
+
import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-DcJPkXD5.cjs";
|
11
|
+
import "../mod-B-hUPT2N.cjs";
|
12
|
+
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import
|
4
|
-
import "../
|
5
|
-
import "../
|
6
|
-
import "../
|
7
|
-
import "../
|
8
|
-
import "../
|
9
|
-
import "../
|
10
|
-
import "../
|
11
|
-
import "../
|
12
|
-
import {
|
13
|
-
import
|
14
|
-
|
15
|
-
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParamsKeyPath, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
3
|
+
import "../client-BsGzbnV-.js";
|
4
|
+
import "../vocab-BCWe1Ih5.js";
|
5
|
+
import "../actor-DqFajh9s.js";
|
6
|
+
import "../http-BbO0ejuk.js";
|
7
|
+
import "../owner-kQRGVXG1.js";
|
8
|
+
import "../mod-BlVovdcy.js";
|
9
|
+
import "../mod-Ds0mpFZU.js";
|
10
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-DG0huGW-.js";
|
11
|
+
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-BKNZ-Tb-.js";
|
12
|
+
import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-CUKlBw08.js";
|
13
|
+
import "../mod-CVgZgliM.js";
|
14
|
+
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
import "../transformers-
|
6
|
-
import "../
|
7
|
-
import "../actor-
|
8
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
9
|
-
import "../
|
10
|
-
import "../
|
11
|
-
import "../
|
12
|
-
import "../
|
13
|
-
import
|
14
|
-
import "../
|
15
|
-
import "../authdocloader-BFVqUbyo.js";
|
16
|
-
import "../vocab-CvD6Vbml.js";
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "../transformers-BFT6d7J5.js";
|
6
|
+
import "../lookup-CHkCVZTU.js";
|
7
|
+
import "../actor-DzhunPC_.js";
|
8
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-DMk2Mdn9.js";
|
9
|
+
import "../http-CUVx-vzb.js";
|
10
|
+
import "../proof-fqzaMJ4g.js";
|
11
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-jcR8-ZxP.js";
|
12
|
+
import "../types-BtUjyi5y.js";
|
13
|
+
import "../kv-cache-CGXcDejL.js";
|
14
|
+
import "../vocab-BnR3nIU9.js";
|
17
15
|
|
18
16
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
@@ -3,17 +3,15 @@
|
|
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 } from "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
import "../
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import
|
14
|
-
import "../
|
15
|
-
import "../assert_not_equals-f3m3epl3.js";
|
16
|
-
import "../assert_throws-BOO88avQ.js";
|
10
|
+
import { test } from "../testing-g4UC4liW.js";
|
11
|
+
import { assertGreater, assertGreaterOrEqual } from "../std__assert-DWivtrGR.js";
|
12
|
+
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
13
|
+
import "../assert_throws-BNXdRGWP.js";
|
14
|
+
import "../assert_not_equals-C80BG-_5.js";
|
17
15
|
import { delay } from "es-toolkit";
|
18
16
|
|
19
17
|
//#region src/federation/mq.ts
|
@@ -227,7 +225,7 @@ test("InProcessMessageQueue", async (t) => {
|
|
227
225
|
});
|
228
226
|
test("MessageQueue.nativeRetrial", async (t) => {
|
229
227
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
|
230
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
228
|
+
const { DenoKvMessageQueue } = await import("../denokv-CCssOzMJ.js");
|
231
229
|
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
232
230
|
assert(mq.nativeRetrial);
|
233
231
|
if (Symbol.dispose in mq) {
|
@@ -266,7 +264,7 @@ test("MessageQueue.nativeRetrial", async (t) => {
|
|
266
264
|
});
|
267
265
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
268
266
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
269
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
267
|
+
const { DenoKvMessageQueue } = await import("../denokv-CCssOzMJ.js");
|
270
268
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
271
269
|
}
|
272
270
|
for (const mqName in queues) test({
|