@fedify/fedify 1.8.1-pr.328.1165 → 1.8.1-pr.329.1209
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 +1 -4
- package/dist/{actor-6WfgEEM7.js → actor-CiCVXwx3.js} +4 -1
- package/dist/{actor-BvUN9QgD.js → actor-DOUbHIhg.js} +179 -179
- package/dist/{assert_rejects-AjlKk-Vo.js → assert_rejects-DceVjUlD.js} +1 -1
- package/dist/{assert_throws-CqMKbTh_.js → assert_throws-DTDC_gwN.js} +1 -1
- package/dist/{authdocloader-BxpW2l0x.js → authdocloader-CMmTK9S5.js} +3 -3
- package/dist/{authdocloader-DlQKiAuj.js → authdocloader-CrpSsLr1.js} +4 -3
- package/dist/{builder-Bql0U6IX.js → builder-DFk9FOJ6.js} +5 -4
- package/dist/chunk-HsBuZ-b2.js +41 -0
- package/dist/{client-CI4TcEtW.js → client-CYFhpq6p.js} +2 -2
- package/dist/compat/transformers.test.js +27 -20
- package/dist/context-B4-Ypxls.js +108 -0
- package/dist/docloader-09nVWLAZ.js +68 -0
- package/dist/{docloader-B6dtEu0e.js → docloader-B8jv3Z2V.js} +1 -2
- package/dist/docloader-xLomwjk3.js +4526 -0
- package/dist/{esm-80CEOYyg.js → esm-d-9EVGaP.js} +1 -1
- package/dist/federation/builder.test.js +16 -11
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +35 -26
- package/dist/federation/inbox.test.js +10 -6
- package/dist/federation/keycache.test.js +7 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +35 -27
- package/dist/federation/mod.js +10 -10
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/retry.test.js +3 -5
- package/dist/federation/router.test.js +7 -8
- package/dist/federation/send.test.js +21 -15
- package/dist/{http-Cdm4poZb.js → http-6MXyLsoh.js} +3 -2
- package/dist/{http-epXQkoos.js → http-DLoFeou5.js} +3 -3
- package/dist/{inbox-ClBcgVPg.js → inbox-K6Jqy_1j.js} +3 -1
- package/dist/{key-B2Vg4tVB.js → key-B56jBz9U.js} +4 -4
- package/dist/{key-Cl_Xlkrv.js → key-BAIJJ5gY.js} +2 -2
- package/dist/key-Be2GEH6h.js +16 -0
- package/dist/{key-D2T-GDYd.js → key-DbuLgndY.js} +3 -2
- package/dist/{keycache-M-zWLLCU.js → keycache-D2ce3zUW.js} +1 -1
- package/dist/{keys-qx88le-G.js → keys-Cl8uuXBD.js} +1 -1
- package/dist/langstr-DbWheeIS.js +33 -0
- package/dist/{ld-ZkyR7ab4.js → ld-WpKwgDtk.js} +4 -2
- package/dist/lookup-BhK5FmDe.js +132 -0
- package/dist/{lookup-BlMMBOS2.js → lookup-ByMEYudm.js} +1 -1
- package/dist/{lookup-BH2SgpoS.js → lookup-DMKWAbKW.js} +6 -113
- package/dist/middleware-B-tW_fwo.js +17 -0
- package/dist/middleware-Ba5IuZoK.js +33 -0
- package/dist/{middleware-0TQ_tx1T.js → middleware-Dbj6Ns6x.js} +21 -17
- package/dist/{middleware-Cye6GERQ.js → middleware-vpRI19Dq.js} +11 -11
- package/dist/mod.js +10 -10
- package/dist/multibase-DeCHcK8L.js +316 -0
- package/dist/nodeinfo/client.test.js +11 -11
- package/dist/nodeinfo/handler.test.js +34 -25
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +7 -9
- package/dist/nodeinfo/types.test.js +8 -10
- package/dist/{owner-C_vL0hRG.js → owner-jodbuyfr.js} +3 -2
- package/dist/{proof-CiYpiavN.js → proof-BSG6S-sj.js} +3 -3
- package/dist/{proof-Dz3Yq7kI.js → proof-DZrqpsSm.js} +4 -2
- package/dist/router-D3UybECj.js +118 -0
- package/dist/runtime/authdocloader.test.js +20 -14
- package/dist/runtime/docloader.test.js +10 -9
- package/dist/runtime/key.test.js +15 -10
- package/dist/runtime/langstr.test.js +7 -8
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +7 -8
- package/dist/runtime/url.test.js +4 -5
- package/dist/{send-CDQXxlmm.js → send-CNN4e6xr.js} +2 -2
- package/dist/sig/http.test.js +19 -13
- package/dist/sig/key.test.js +17 -11
- package/dist/sig/ld.test.js +16 -10
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +19 -12
- package/dist/sig/proof.test.js +18 -12
- package/dist/testing/docloader.test.js +7 -8
- package/dist/testing/mod.d.ts +1 -8387
- package/dist/testing/mod.js +2 -4
- package/dist/testing-BZ0dJ4qn.js +143 -0
- package/dist/type-D2s5lmbZ.js +14 -0
- package/dist/{types-E0EOd3en.js → types-9rwT068o.js} +1 -1
- package/dist/{types-n7HI7VFr.js → types-C7C_l-jz.js} +1 -1
- package/dist/url-kTAI6_KP.js +68 -0
- package/dist/vocab/actor.test.js +16 -10
- package/dist/vocab/lookup.test.js +16 -9
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +7 -3
- package/dist/vocab/vocab.test.js +13 -9
- package/dist/{type-BvQGw6hv.js → vocab-Db0G5VQ2.js} +183 -5255
- package/dist/{vocab-fVvi4e5m.js → vocab-iY_A93sn.js} +3 -3
- package/dist/webfinger/handler.test.js +34 -25
- package/dist/webfinger/lookup.test.js +10 -9
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/package.json +1 -1
- package/dist/key-CE5RdobB.js +0 -10
- package/dist/middleware-DPQqiqLu.js +0 -26
- package/dist/middleware-Dh8xaPyd.js +0 -17
- package/dist/testing-COl4JbdC.js +0 -301
- /package/dist/{assert_is_error-CeVBLPsZ.js → assert_is_error-DQdKoRgb.js} +0 -0
- /package/dist/{assert_not_equals-D2R2nl5h.js → assert_not_equals-7pyUM3Ib.js} +0 -0
- /package/dist/{collection-D5V3UzU3.js → collection-Dfb0TPno.js} +0 -0
- /package/dist/{denokv-DK9P5Jq7.js → denokv-QWKsIqML.js} +0 -0
- /package/dist/{retry-BnpVRGFC.js → retry-BiIhZWgD.js} +0 -0
- /package/dist/{semver-DCqorrj5.js → semver-DWClQt_5.js} +0 -0
- /package/dist/{std__assert-BQdmxyzF.js → std__assert-B3iAixc-.js} +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
|
6
|
-
import { Object as Object$1, getTypeId } from "./actor-
|
|
7
|
-
import { lookupWebFinger } from "./lookup-
|
|
5
|
+
import { deno_default, getDocumentLoader } from "./docloader-B8jv3Z2V.js";
|
|
6
|
+
import { Object as Object$1, getTypeId } from "./actor-DOUbHIhg.js";
|
|
7
|
+
import { lookupWebFinger } from "./lookup-ByMEYudm.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import { delay } from "es-toolkit";
|
|
@@ -3,35 +3,44 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Image, Link, Person } from "../type-BvQGw6hv.js";
|
|
7
6
|
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
|
8
7
|
import "../assert-DwEa6glZ.js";
|
|
9
8
|
import "../assert_instance_of-C9QtN-X9.js";
|
|
10
9
|
import { MemoryKvStore } from "../kv-D7Yt6pnB.js";
|
|
11
|
-
import { createFederation, handleWebFinger } 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 "../
|
|
28
|
-
import "../
|
|
29
|
-
import
|
|
30
|
-
import "../
|
|
31
|
-
import "../
|
|
32
|
-
import "../
|
|
33
|
-
import "../
|
|
34
|
-
import "../
|
|
10
|
+
import { createFederation, handleWebFinger } from "../middleware-Dbj6Ns6x.js";
|
|
11
|
+
import "../docloader-xLomwjk3.js";
|
|
12
|
+
import "../url-kTAI6_KP.js";
|
|
13
|
+
import "../semver-DWClQt_5.js";
|
|
14
|
+
import "../client-CYFhpq6p.js";
|
|
15
|
+
import "../router-D3UybECj.js";
|
|
16
|
+
import "../types-C7C_l-jz.js";
|
|
17
|
+
import "../multibase-DeCHcK8L.js";
|
|
18
|
+
import { Image, Link, Person } from "../vocab-Db0G5VQ2.js";
|
|
19
|
+
import "../langstr-DbWheeIS.js";
|
|
20
|
+
import "../lookup-BhK5FmDe.js";
|
|
21
|
+
import "../type-D2s5lmbZ.js";
|
|
22
|
+
import "../actor-CiCVXwx3.js";
|
|
23
|
+
import "../key-DbuLgndY.js";
|
|
24
|
+
import "../http-6MXyLsoh.js";
|
|
25
|
+
import "../authdocloader-CrpSsLr1.js";
|
|
26
|
+
import "../ld-WpKwgDtk.js";
|
|
27
|
+
import "../owner-jodbuyfr.js";
|
|
28
|
+
import "../proof-DZrqpsSm.js";
|
|
29
|
+
import "../lookup-DMKWAbKW.js";
|
|
30
|
+
import "../inbox-K6Jqy_1j.js";
|
|
31
|
+
import "../builder-DFk9FOJ6.js";
|
|
32
|
+
import "../collection-Dfb0TPno.js";
|
|
33
|
+
import "../keycache-D2ce3zUW.js";
|
|
34
|
+
import "../retry-BiIhZWgD.js";
|
|
35
|
+
import "../send-CNN4e6xr.js";
|
|
36
|
+
import { test } from "../testing-BZ0dJ4qn.js";
|
|
37
|
+
import "../std__assert-B3iAixc-.js";
|
|
38
|
+
import "../assert_rejects-DceVjUlD.js";
|
|
39
|
+
import "../assert_is_error-DQdKoRgb.js";
|
|
40
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
|
41
|
+
import "../assert_throws-DTDC_gwN.js";
|
|
42
|
+
import "../docloader-09nVWLAZ.js";
|
|
43
|
+
import { createRequestContext } from "../context-B4-Ypxls.js";
|
|
35
44
|
|
|
36
45
|
//#region webfinger/handler.test.ts
|
|
37
46
|
test("handleWebFinger()", async (t) => {
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { lookupWebFinger } from "../type-BvQGw6hv.js";
|
|
7
6
|
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
|
8
7
|
import "../assert-DwEa6glZ.js";
|
|
9
8
|
import "../assert_instance_of-C9QtN-X9.js";
|
|
10
|
-
import "../
|
|
11
|
-
import
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import
|
|
9
|
+
import "../docloader-xLomwjk3.js";
|
|
10
|
+
import "../url-kTAI6_KP.js";
|
|
11
|
+
import { lookupWebFinger } from "../lookup-BhK5FmDe.js";
|
|
12
|
+
import { test } from "../testing-BZ0dJ4qn.js";
|
|
13
|
+
import "../std__assert-B3iAixc-.js";
|
|
14
|
+
import "../assert_rejects-DceVjUlD.js";
|
|
15
|
+
import "../assert_is_error-DQdKoRgb.js";
|
|
16
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
|
17
|
+
import "../assert_throws-DTDC_gwN.js";
|
|
18
|
+
import { esm_default } from "../esm-d-9EVGaP.js";
|
|
18
19
|
import { withTimeout } from "es-toolkit";
|
|
19
20
|
|
|
20
21
|
//#region webfinger/lookup.test.ts
|
package/dist/webfinger/mod.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../docloader-
|
|
6
|
-
import { lookupWebFinger } from "../lookup-
|
|
5
|
+
import "../docloader-B8jv3Z2V.js";
|
|
6
|
+
import { lookupWebFinger } from "../lookup-ByMEYudm.js";
|
|
7
7
|
import "../webfinger-C3GIyXIg.js";
|
|
8
8
|
|
|
9
9
|
export { lookupWebFinger };
|
package/dist/x/cfworkers.test.js
CHANGED
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../type-BvQGw6hv.js";
|
|
7
6
|
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
|
8
7
|
import "../assert-DwEa6glZ.js";
|
|
9
8
|
import "../assert_instance_of-C9QtN-X9.js";
|
|
10
|
-
import "../
|
|
11
|
-
import
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../assert_throws-CqMKbTh_.js";
|
|
9
|
+
import { test } from "../testing-BZ0dJ4qn.js";
|
|
10
|
+
import "../std__assert-B3iAixc-.js";
|
|
11
|
+
import "../assert_rejects-DceVjUlD.js";
|
|
12
|
+
import "../assert_is_error-DQdKoRgb.js";
|
|
13
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
|
14
|
+
import "../assert_throws-DTDC_gwN.js";
|
|
17
15
|
import { delay } from "es-toolkit";
|
|
18
16
|
|
|
19
17
|
//#region x/cfworkers.ts
|
package/package.json
CHANGED
package/dist/key-CE5RdobB.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
6
|
-
import "./type-BvQGw6hv.js";
|
|
7
|
-
import "./actor-6WfgEEM7.js";
|
|
8
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "./key-D2T-GDYd.js";
|
|
9
|
-
|
|
10
|
-
export { validateCryptoKey };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
6
|
-
import "./type-BvQGw6hv.js";
|
|
7
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-0TQ_tx1T.js";
|
|
8
|
-
import "./semver-DCqorrj5.js";
|
|
9
|
-
import "./client-CI4TcEtW.js";
|
|
10
|
-
import "./lookup-BH2SgpoS.js";
|
|
11
|
-
import "./types-n7HI7VFr.js";
|
|
12
|
-
import "./actor-6WfgEEM7.js";
|
|
13
|
-
import "./key-D2T-GDYd.js";
|
|
14
|
-
import "./http-Cdm4poZb.js";
|
|
15
|
-
import "./authdocloader-DlQKiAuj.js";
|
|
16
|
-
import "./ld-ZkyR7ab4.js";
|
|
17
|
-
import "./owner-C_vL0hRG.js";
|
|
18
|
-
import "./proof-Dz3Yq7kI.js";
|
|
19
|
-
import "./inbox-ClBcgVPg.js";
|
|
20
|
-
import "./builder-Bql0U6IX.js";
|
|
21
|
-
import "./collection-D5V3UzU3.js";
|
|
22
|
-
import "./keycache-M-zWLLCU.js";
|
|
23
|
-
import "./retry-BnpVRGFC.js";
|
|
24
|
-
import "./send-CDQXxlmm.js";
|
|
25
|
-
|
|
26
|
-
export { FederationImpl };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
|
|
5
|
-
import "./transformers-ghwJuzGY.js";
|
|
6
|
-
import "./docloader-B6dtEu0e.js";
|
|
7
|
-
import "./actor-BvUN9QgD.js";
|
|
8
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-Cye6GERQ.js";
|
|
9
|
-
import "./lookup-BlMMBOS2.js";
|
|
10
|
-
import "./key-Cl_Xlkrv.js";
|
|
11
|
-
import "./http-epXQkoos.js";
|
|
12
|
-
import "./proof-CiYpiavN.js";
|
|
13
|
-
import "./types-E0EOd3en.js";
|
|
14
|
-
import "./authdocloader-BxpW2l0x.js";
|
|
15
|
-
import "./vocab-fVvi4e5m.js";
|
|
16
|
-
|
|
17
|
-
export { FederationImpl };
|
package/dist/testing-COl4JbdC.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
6
|
-
import { __require, lookupWebFinger } from "./type-BvQGw6hv.js";
|
|
7
|
-
import { RouterError, lookupObject, traverseCollection } from "./lookup-BH2SgpoS.js";
|
|
8
|
-
import { configure, getConsoleSink, getLogger, reset } from "@logtape/logtape";
|
|
9
|
-
import { trace } from "@opentelemetry/api";
|
|
10
|
-
|
|
11
|
-
//#region testing/docloader.ts
|
|
12
|
-
const logger = getLogger([
|
|
13
|
-
"fedify",
|
|
14
|
-
"testing",
|
|
15
|
-
"docloader"
|
|
16
|
-
]);
|
|
17
|
-
/**
|
|
18
|
-
* A mock of the document loader. This does not make any actual HTTP requests
|
|
19
|
-
* towards the remote server, but looks up the local fixture files instead.
|
|
20
|
-
*
|
|
21
|
-
* For instance, `mockDocumentLoader("http://example.com/foo/bar")` will look up
|
|
22
|
-
* the file `testing/fixtures/http/example.com/foo/bar` (no suffix) and return
|
|
23
|
-
* its content as the response.
|
|
24
|
-
*/
|
|
25
|
-
async function mockDocumentLoader(resource) {
|
|
26
|
-
const url = new URL(resource);
|
|
27
|
-
if ("navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers") {
|
|
28
|
-
const testUrl = new URL(url);
|
|
29
|
-
testUrl.hostname += ".test";
|
|
30
|
-
const resp = await fetch(testUrl);
|
|
31
|
-
if (resp.ok) {
|
|
32
|
-
const document$1 = await resp.json();
|
|
33
|
-
logger.debug("Successfully fetched fixture {resource}: {status} {statusText}\n{body}", {
|
|
34
|
-
resource,
|
|
35
|
-
status: resp.status,
|
|
36
|
-
statusText: resp.statusText,
|
|
37
|
-
body: document$1
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
contextUrl: null,
|
|
41
|
-
document: document$1,
|
|
42
|
-
documentUrl: resource
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const error = await resp.text();
|
|
46
|
-
logger.error("Failed to fetch fixture {resource}: {error}", {
|
|
47
|
-
resource,
|
|
48
|
-
error
|
|
49
|
-
});
|
|
50
|
-
throw new Error(error);
|
|
51
|
-
}
|
|
52
|
-
const path = `./fixtures/${url.host}${url.pathname}.json`;
|
|
53
|
-
let document;
|
|
54
|
-
try {
|
|
55
|
-
document = (await import(path, { with: { type: "json" } })).default;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
logger.error("Failed to read fixture file {path}: {error}", {
|
|
58
|
-
path,
|
|
59
|
-
error
|
|
60
|
-
});
|
|
61
|
-
throw error;
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
contextUrl: null,
|
|
65
|
-
document,
|
|
66
|
-
documentUrl: resource
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region testing/context.ts
|
|
72
|
-
function createContext(values) {
|
|
73
|
-
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
|
|
74
|
-
function throwRouteError() {
|
|
75
|
-
throw new RouterError("Not implemented");
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
federation,
|
|
79
|
-
data,
|
|
80
|
-
origin: url.origin,
|
|
81
|
-
canonicalOrigin: canonicalOrigin ?? url.origin,
|
|
82
|
-
host: url.host,
|
|
83
|
-
hostname: url.hostname,
|
|
84
|
-
documentLoader: documentLoader ?? mockDocumentLoader,
|
|
85
|
-
contextLoader: contextLoader ?? mockDocumentLoader,
|
|
86
|
-
tracerProvider: tracerProvider ?? trace.getTracerProvider(),
|
|
87
|
-
clone: clone ?? ((data$1) => createContext({
|
|
88
|
-
...values,
|
|
89
|
-
data: data$1
|
|
90
|
-
})),
|
|
91
|
-
getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
|
|
92
|
-
getActorUri: getActorUri ?? throwRouteError,
|
|
93
|
-
getObjectUri: getObjectUri ?? throwRouteError,
|
|
94
|
-
getOutboxUri: getOutboxUri ?? throwRouteError,
|
|
95
|
-
getInboxUri: getInboxUri ?? throwRouteError,
|
|
96
|
-
getFollowingUri: getFollowingUri ?? throwRouteError,
|
|
97
|
-
getFollowersUri: getFollowersUri ?? throwRouteError,
|
|
98
|
-
getLikedUri: getLikedUri ?? throwRouteError,
|
|
99
|
-
getFeaturedUri: getFeaturedUri ?? throwRouteError,
|
|
100
|
-
getFeaturedTagsUri: getFeaturedTagsUri ?? throwRouteError,
|
|
101
|
-
parseUri: parseUri ?? ((_uri) => {
|
|
102
|
-
throw new Error("Not implemented");
|
|
103
|
-
}),
|
|
104
|
-
getDocumentLoader: getDocumentLoader ?? ((_params) => {
|
|
105
|
-
throw new Error("Not implemented");
|
|
106
|
-
}),
|
|
107
|
-
getActorKeyPairs: getActorKeyPairs ?? ((_handle) => Promise.resolve([])),
|
|
108
|
-
lookupObject: lookupObject$1 ?? ((uri, options = {}) => {
|
|
109
|
-
return lookupObject(uri, {
|
|
110
|
-
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
111
|
-
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
112
|
-
});
|
|
113
|
-
}),
|
|
114
|
-
traverseCollection: traverseCollection$1 ?? ((collection, options = {}) => {
|
|
115
|
-
return traverseCollection(collection, {
|
|
116
|
-
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
117
|
-
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
118
|
-
});
|
|
119
|
-
}),
|
|
120
|
-
lookupNodeInfo: lookupNodeInfo ?? ((_params) => {
|
|
121
|
-
throw new Error("Not implemented");
|
|
122
|
-
}),
|
|
123
|
-
lookupWebFinger: lookupWebFinger$1 ?? ((resource, options = {}) => {
|
|
124
|
-
return lookupWebFinger(resource, options);
|
|
125
|
-
}),
|
|
126
|
-
sendActivity: sendActivity ?? ((_params) => {
|
|
127
|
-
throw new Error("Not implemented");
|
|
128
|
-
}),
|
|
129
|
-
routeActivity: routeActivity ?? ((_params) => {
|
|
130
|
-
throw new Error("Not implemented");
|
|
131
|
-
})
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function createRequestContext(args) {
|
|
135
|
-
return {
|
|
136
|
-
...createContext(args),
|
|
137
|
-
clone: args.clone ?? ((data) => createRequestContext({
|
|
138
|
-
...args,
|
|
139
|
-
data
|
|
140
|
-
})),
|
|
141
|
-
request: args.request ?? new Request(args.url),
|
|
142
|
-
url: args.url,
|
|
143
|
-
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
|
144
|
-
getObject: args.getObject ?? (() => Promise.resolve(null)),
|
|
145
|
-
getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
|
|
146
|
-
getSignedKeyOwner: args.getSignedKeyOwner ?? (() => Promise.resolve(null)),
|
|
147
|
-
sendActivity: args.sendActivity ?? ((_params) => {
|
|
148
|
-
throw new Error("Not implemented");
|
|
149
|
-
})
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function createInboxContext(args) {
|
|
153
|
-
return {
|
|
154
|
-
...createContext(args),
|
|
155
|
-
clone: args.clone ?? ((data) => createInboxContext({
|
|
156
|
-
...args,
|
|
157
|
-
data
|
|
158
|
-
})),
|
|
159
|
-
recipient: args.recipient ?? null,
|
|
160
|
-
forwardActivity: args.forwardActivity ?? ((_params) => {
|
|
161
|
-
throw new Error("Not implemented");
|
|
162
|
-
})
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region testing/mod.ts
|
|
168
|
-
const testDefinitions = [];
|
|
169
|
-
function test(name, options, fn) {
|
|
170
|
-
const def = typeof name === "string" ? typeof options === "function" ? {
|
|
171
|
-
name,
|
|
172
|
-
fn: options
|
|
173
|
-
} : {
|
|
174
|
-
name,
|
|
175
|
-
...options,
|
|
176
|
-
fn
|
|
177
|
-
} : name;
|
|
178
|
-
testDefinitions.push(def);
|
|
179
|
-
if ("Deno" in globalThis) {
|
|
180
|
-
const func = def.fn;
|
|
181
|
-
Deno.test({
|
|
182
|
-
...def,
|
|
183
|
-
async fn(t) {
|
|
184
|
-
const records = [];
|
|
185
|
-
await configure({
|
|
186
|
-
sinks: {
|
|
187
|
-
buffer(record) {
|
|
188
|
-
if (record.category.length > 1 && record.category[0] === "logtape" && record.category[1] === "meta") return;
|
|
189
|
-
records.push(record);
|
|
190
|
-
},
|
|
191
|
-
console: getConsoleSink()
|
|
192
|
-
},
|
|
193
|
-
filters: {},
|
|
194
|
-
loggers: [{
|
|
195
|
-
category: [],
|
|
196
|
-
sinks: [Deno.env.get("LOG") === "always" ? "console" : "buffer"]
|
|
197
|
-
}]
|
|
198
|
-
});
|
|
199
|
-
try {
|
|
200
|
-
await func(t);
|
|
201
|
-
} catch (e) {
|
|
202
|
-
const consoleSink = getConsoleSink();
|
|
203
|
-
for (const record of records) consoleSink(record);
|
|
204
|
-
throw e;
|
|
205
|
-
} finally {
|
|
206
|
-
await reset();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
} else if ("Bun" in globalThis) {
|
|
211
|
-
let failed = void 0;
|
|
212
|
-
async function step(defOrNameOrFn, fn$2) {
|
|
213
|
-
let def$1;
|
|
214
|
-
if (typeof defOrNameOrFn === "string") def$1 = {
|
|
215
|
-
name: defOrNameOrFn,
|
|
216
|
-
fn: fn$2
|
|
217
|
-
};
|
|
218
|
-
else if (typeof defOrNameOrFn === "function") def$1 = {
|
|
219
|
-
name: defOrNameOrFn.name,
|
|
220
|
-
fn: defOrNameOrFn
|
|
221
|
-
};
|
|
222
|
-
else def$1 = defOrNameOrFn;
|
|
223
|
-
if (def$1.ignore) return true;
|
|
224
|
-
try {
|
|
225
|
-
await def$1.fn({
|
|
226
|
-
name: def$1.name,
|
|
227
|
-
origin: "",
|
|
228
|
-
step
|
|
229
|
-
});
|
|
230
|
-
} catch (e) {
|
|
231
|
-
failed ??= e;
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
const ctx = {
|
|
237
|
-
name: def.name,
|
|
238
|
-
origin: "",
|
|
239
|
-
step
|
|
240
|
-
};
|
|
241
|
-
async function fn$1() {
|
|
242
|
-
await def.fn(ctx);
|
|
243
|
-
if (failed) throw failed;
|
|
244
|
-
}
|
|
245
|
-
const bunTest = Bun.jest(caller()).test;
|
|
246
|
-
if (def.ignore) bunTest.skip(def.name, fn$1);
|
|
247
|
-
else if (def.only) bunTest.only(def.name, fn$1);
|
|
248
|
-
else bunTest(def.name, fn$1);
|
|
249
|
-
} else try {
|
|
250
|
-
const { test: nodeTest } = __require("node:test");
|
|
251
|
-
nodeTest(def.name, {
|
|
252
|
-
only: def.only,
|
|
253
|
-
skip: def.ignore
|
|
254
|
-
}, async (t) => {
|
|
255
|
-
await def.fn(intoDenoTestContext(def.name, t));
|
|
256
|
-
});
|
|
257
|
-
} catch {}
|
|
258
|
-
}
|
|
259
|
-
function intoDenoTestContext(name, ctx) {
|
|
260
|
-
async function step(defOrNameOrFn, fn) {
|
|
261
|
-
let def;
|
|
262
|
-
if (typeof defOrNameOrFn === "string") def = {
|
|
263
|
-
name: defOrNameOrFn,
|
|
264
|
-
fn
|
|
265
|
-
};
|
|
266
|
-
else if (typeof defOrNameOrFn === "function") def = {
|
|
267
|
-
name: defOrNameOrFn.name,
|
|
268
|
-
fn: defOrNameOrFn
|
|
269
|
-
};
|
|
270
|
-
else def = defOrNameOrFn;
|
|
271
|
-
let failed = false;
|
|
272
|
-
await ctx.test(def.name, async (ctx2) => {
|
|
273
|
-
try {
|
|
274
|
-
await def.fn(intoDenoTestContext(def.name, ctx2));
|
|
275
|
-
} catch (e) {
|
|
276
|
-
failed = true;
|
|
277
|
-
throw e;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
return failed;
|
|
281
|
-
}
|
|
282
|
-
const denoCtx = {
|
|
283
|
-
name,
|
|
284
|
-
origin: ctx.filePath ?? "",
|
|
285
|
-
step
|
|
286
|
-
};
|
|
287
|
-
return denoCtx;
|
|
288
|
-
}
|
|
289
|
-
/** Retrieve caller test file. */
|
|
290
|
-
function caller() {
|
|
291
|
-
const Trace = Error;
|
|
292
|
-
const _ = Trace.prepareStackTrace;
|
|
293
|
-
Trace.prepareStackTrace = (_$1, stack$1) => stack$1;
|
|
294
|
-
const { stack } = /* @__PURE__ */ new Error();
|
|
295
|
-
Trace.prepareStackTrace = _;
|
|
296
|
-
const caller$1 = stack[2];
|
|
297
|
-
return caller$1.getFileName().replaceAll("\\", "/");
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
//#endregion
|
|
301
|
-
export { createInboxContext, createRequestContext, mockDocumentLoader, test, testDefinitions };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|