@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
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 "../
|
6
|
+
import "../lookup-DQRtjvb1.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import "../assert-MZs1qjMx.js";
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
10
|
-
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 "../std__assert-DWivtrGR.js";
|
12
|
+
import "../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
|
import { getLogger } from "@logtape/logtape";
|
19
17
|
|
package/dist/x/hono.cjs
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_chunk = require('../chunk-DqRYRqnO.cjs');
|
6
|
+
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
7
|
+
|
8
|
+
//#region src/x/hono.ts
|
9
|
+
/**
|
10
|
+
* Create a Hono middleware to integrate with the {@link Federation} object.
|
11
|
+
*
|
12
|
+
* @deprecated This function has been moved to `@fedify/hono` package.
|
13
|
+
* Import `federation` from `@fedify/hono` instead.
|
14
|
+
* This function will be removed in Fedify v2.0.
|
15
|
+
*
|
16
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
17
|
+
* object.
|
18
|
+
* @template THonoContext A type of the Hono context.
|
19
|
+
* @param federation A {@link Federation} object to integrate with Hono.
|
20
|
+
* @param contextDataFactory A function to create a context data for the
|
21
|
+
* {@link Federation} object.
|
22
|
+
* @returns A Hono middleware.
|
23
|
+
*/
|
24
|
+
function federation(federation$1, contextDataFactory) {
|
25
|
+
const logger = (0, __logtape_logtape.getLogger)([
|
26
|
+
"fedify",
|
27
|
+
"federation",
|
28
|
+
"hono"
|
29
|
+
]);
|
30
|
+
logger.warn("The `@fedify/fedify/x/hono` module is deprecated; use `federation` from `@fedify/hono` package instead.");
|
31
|
+
return async (ctx, next) => {
|
32
|
+
let contextData = contextDataFactory(ctx);
|
33
|
+
if (contextData instanceof Promise) contextData = await contextData;
|
34
|
+
return await federation$1.fetch(ctx.req.raw, {
|
35
|
+
contextData,
|
36
|
+
...integrateFetchOptions(ctx, next)
|
37
|
+
});
|
38
|
+
};
|
39
|
+
}
|
40
|
+
function integrateFetchOptions(ctx, next) {
|
41
|
+
return {
|
42
|
+
async onNotFound(_req) {
|
43
|
+
await next();
|
44
|
+
return ctx.res;
|
45
|
+
},
|
46
|
+
async onNotAcceptable(_req) {
|
47
|
+
await next();
|
48
|
+
if (ctx.res.status !== 404) return ctx.res;
|
49
|
+
return new Response("Not acceptable", {
|
50
|
+
status: 406,
|
51
|
+
headers: {
|
52
|
+
"Content-Type": "text/plain",
|
53
|
+
Vary: "Accept"
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
};
|
58
|
+
}
|
59
|
+
|
60
|
+
//#endregion
|
61
|
+
exports.federation = federation;
|
@@ -0,0 +1,53 @@
|
|
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 { Federation } from "../context-DJ8aSy2Q.cjs";
|
9
|
+
import "../kv-Bxr0Q87_.cjs";
|
10
|
+
import "../mq-DcJPkXD5.cjs";
|
11
|
+
|
12
|
+
//#region src/x/hono.d.ts
|
13
|
+
interface HonoRequest {
|
14
|
+
raw: Request;
|
15
|
+
}
|
16
|
+
interface HonoContext {
|
17
|
+
req: HonoRequest;
|
18
|
+
res: Response;
|
19
|
+
}
|
20
|
+
type HonoMiddleware<THonoContext extends HonoContext> = (ctx: THonoContext, next: () => Promise<void>) => Promise<Response | void>;
|
21
|
+
/**
|
22
|
+
* A factory function to create a context data for the {@link Federation}
|
23
|
+
* object.
|
24
|
+
*
|
25
|
+
* @deprecated This type has been moved to `@fedify/hono` package.
|
26
|
+
* Import `ContextDataFactory` from `@fedify/hono` instead.
|
27
|
+
* This type will be removed in Fedify v2.0.
|
28
|
+
*
|
29
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
30
|
+
* object.
|
31
|
+
* @template THonoContext A type of the Hono context.
|
32
|
+
* @param context A Hono context object.
|
33
|
+
* @returns A context data for the {@link Federation} object.
|
34
|
+
*/
|
35
|
+
type ContextDataFactory<TContextData, THonoContext> = (context: THonoContext) => TContextData | Promise<TContextData>;
|
36
|
+
/**
|
37
|
+
* Create a Hono middleware to integrate with the {@link Federation} object.
|
38
|
+
*
|
39
|
+
* @deprecated This function has been moved to `@fedify/hono` package.
|
40
|
+
* Import `federation` from `@fedify/hono` instead.
|
41
|
+
* This function will be removed in Fedify v2.0.
|
42
|
+
*
|
43
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
44
|
+
* object.
|
45
|
+
* @template THonoContext A type of the Hono context.
|
46
|
+
* @param federation A {@link Federation} object to integrate with Hono.
|
47
|
+
* @param contextDataFactory A function to create a context data for the
|
48
|
+
* {@link Federation} object.
|
49
|
+
* @returns A Hono middleware.
|
50
|
+
*/
|
51
|
+
declare function federation<TContextData, THonoContext extends HonoContext>(federation: Federation<TContextData>, contextDataFactory: ContextDataFactory<TContextData, THonoContext>): HonoMiddleware<THonoContext>;
|
52
|
+
//#endregion
|
53
|
+
export { ContextDataFactory, federation };
|
package/dist/x/hono.d.ts
CHANGED
@@ -1,16 +1,15 @@
|
|
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 "../mq-CRGm1e_F.js";
|
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 { Federation } from "../context-DG0huGW-.js";
|
11
|
+
import "../kv-BKNZ-Tb-.js";
|
12
|
+
import "../mq-CUKlBw08.js";
|
14
13
|
|
15
14
|
//#region src/x/hono.d.ts
|
16
15
|
interface HonoRequest {
|
package/dist/x/hono.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
6
6
|
|
7
7
|
//#region src/x/hono.ts
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
const require_chunk = require('../chunk-DqRYRqnO.cjs');
|
6
|
+
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
7
|
+
|
8
|
+
//#region src/x/sveltekit.ts
|
9
|
+
/**
|
10
|
+
* Create a SvelteKit hook handler to integrate with the {@link Federation}
|
11
|
+
* object.
|
12
|
+
*
|
13
|
+
* @deprecated This function has been moved to `@fedify/sveltekit` package.
|
14
|
+
* Import `fedifyHook` from `@fedify/sveltekit` instead.
|
15
|
+
* This function will be removed in Fedify v2.0.
|
16
|
+
*
|
17
|
+
* @example hooks.server.ts
|
18
|
+
* ``` typescript
|
19
|
+
* import { federation } from "./federation"; // Import the `Federation` object
|
20
|
+
*
|
21
|
+
* export const handle = fedifyHook(federation, () => undefined);
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
25
|
+
* object.
|
26
|
+
* @param federation A {@link Federation} object to integrate with SvelteKit.
|
27
|
+
* @param createContextData A function to create a context data for the
|
28
|
+
* {@link Federation} object.
|
29
|
+
* @returns A SvelteKit hook handler.
|
30
|
+
* @since 1.3.0
|
31
|
+
*/
|
32
|
+
function fedifyHook(federation, createContextData) {
|
33
|
+
const logger = (0, __logtape_logtape.getLogger)([
|
34
|
+
"fedify",
|
35
|
+
"federation",
|
36
|
+
"sveltekit"
|
37
|
+
]);
|
38
|
+
logger.warn("The `@fedify/fedify/x/sveltekit` module is deprecated; use `fedifyHook` from `@fedify/sveltekit` package instead.");
|
39
|
+
return async ({ event, resolve }) => {
|
40
|
+
return await federation.fetch(event.request, {
|
41
|
+
contextData: await createContextData(event),
|
42
|
+
...integrateFetchOptions({
|
43
|
+
event,
|
44
|
+
resolve
|
45
|
+
})
|
46
|
+
});
|
47
|
+
};
|
48
|
+
}
|
49
|
+
function integrateFetchOptions({ event, resolve }) {
|
50
|
+
return {
|
51
|
+
async onNotFound() {
|
52
|
+
return await resolve(event);
|
53
|
+
},
|
54
|
+
async onNotAcceptable() {
|
55
|
+
const res = await resolve(event);
|
56
|
+
if (res.status !== 404) return res;
|
57
|
+
return new Response("Not acceptable", {
|
58
|
+
status: 406,
|
59
|
+
headers: {
|
60
|
+
"Content-Type": "text/plain",
|
61
|
+
Vary: "Accept"
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
};
|
66
|
+
}
|
67
|
+
|
68
|
+
//#endregion
|
69
|
+
exports.fedifyHook = fedifyHook;
|
@@ -0,0 +1,45 @@
|
|
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 { Federation } from "../context-DJ8aSy2Q.cjs";
|
9
|
+
import "../kv-Bxr0Q87_.cjs";
|
10
|
+
import "../mq-DcJPkXD5.cjs";
|
11
|
+
|
12
|
+
//#region src/x/sveltekit.d.ts
|
13
|
+
type RequestEvent = {
|
14
|
+
request: Request;
|
15
|
+
};
|
16
|
+
type HookParams = {
|
17
|
+
event: RequestEvent;
|
18
|
+
resolve: (event: RequestEvent) => Promise<Response>;
|
19
|
+
};
|
20
|
+
/**
|
21
|
+
* Create a SvelteKit hook handler to integrate with the {@link Federation}
|
22
|
+
* object.
|
23
|
+
*
|
24
|
+
* @deprecated This function has been moved to `@fedify/sveltekit` package.
|
25
|
+
* Import `fedifyHook` from `@fedify/sveltekit` instead.
|
26
|
+
* This function will be removed in Fedify v2.0.
|
27
|
+
*
|
28
|
+
* @example hooks.server.ts
|
29
|
+
* ``` typescript
|
30
|
+
* import { federation } from "./federation"; // Import the `Federation` object
|
31
|
+
*
|
32
|
+
* export const handle = fedifyHook(federation, () => undefined);
|
33
|
+
* ```
|
34
|
+
*
|
35
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
36
|
+
* object.
|
37
|
+
* @param federation A {@link Federation} object to integrate with SvelteKit.
|
38
|
+
* @param createContextData A function to create a context data for the
|
39
|
+
* {@link Federation} object.
|
40
|
+
* @returns A SvelteKit hook handler.
|
41
|
+
* @since 1.3.0
|
42
|
+
*/
|
43
|
+
declare function fedifyHook<TContextData>(federation: Federation<TContextData>, createContextData: (event: RequestEvent) => TContextData | Promise<TContextData>): (params: HookParams) => Promise<Response>;
|
44
|
+
//#endregion
|
45
|
+
export { fedifyHook };
|
package/dist/x/sveltekit.d.ts
CHANGED
@@ -1,16 +1,15 @@
|
|
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 "../mq-CRGm1e_F.js";
|
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 { Federation } from "../context-DG0huGW-.js";
|
11
|
+
import "../kv-BKNZ-Tb-.js";
|
12
|
+
import "../mq-CUKlBw08.js";
|
14
13
|
|
15
14
|
//#region src/x/sveltekit.d.ts
|
16
15
|
type RequestEvent = {
|
package/dist/x/sveltekit.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
6
6
|
|
7
7
|
//#region src/x/sveltekit.ts
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fedify/fedify",
|
3
|
-
"version": "2.0.0-pr.412.
|
3
|
+
"version": "2.0.0-pr.412.1794+5c393341",
|
4
4
|
"description": "An ActivityPub server framework",
|
5
5
|
"keywords": [
|
6
6
|
"ActivityPub",
|
@@ -35,69 +35,124 @@
|
|
35
35
|
"dist"
|
36
36
|
],
|
37
37
|
"module": "./dist/mod.js",
|
38
|
+
"main": "./dist/mod.cjs",
|
38
39
|
"types": "./dist/mod.d.ts",
|
39
40
|
"exports": {
|
40
41
|
".": {
|
41
|
-
"types":
|
42
|
+
"types": {
|
43
|
+
"import": "./dist/mod.d.ts",
|
44
|
+
"require": "./dist/mod.d.cts",
|
45
|
+
"default": "./dist/mod.d.ts"
|
46
|
+
},
|
42
47
|
"import": "./dist/mod.js",
|
48
|
+
"require": "./dist/mod.cjs",
|
43
49
|
"default": "./dist/mod.js"
|
44
50
|
},
|
45
51
|
"./compat": {
|
46
|
-
"types":
|
52
|
+
"types": {
|
53
|
+
"import": "./dist/compat/mod.d.ts",
|
54
|
+
"require": "./dist/compat/mod.d.cts",
|
55
|
+
"default": "./dist/compat/mod.d.ts"
|
56
|
+
},
|
47
57
|
"import": "./dist/compat/mod.js",
|
58
|
+
"require": "./dist/compat/mod.cjs",
|
48
59
|
"default": "./dist/compat/mod.js"
|
49
60
|
},
|
50
61
|
"./federation": {
|
51
|
-
"types":
|
62
|
+
"types": {
|
63
|
+
"import": "./dist/federation/mod.d.ts",
|
64
|
+
"require": "./dist/federation/mod.d.cts",
|
65
|
+
"default": "./dist/federation/mod.d.ts"
|
66
|
+
},
|
52
67
|
"import": "./dist/federation/mod.js",
|
68
|
+
"require": "./dist/federation/mod.cjs",
|
53
69
|
"default": "./dist/federation/mod.js"
|
54
70
|
},
|
55
71
|
"./nodeinfo": {
|
56
|
-
"types":
|
72
|
+
"types": {
|
73
|
+
"import": "./dist/nodeinfo/mod.d.ts",
|
74
|
+
"require": "./dist/nodeinfo/mod.d.cts",
|
75
|
+
"default": "./dist/nodeinfo/mod.d.ts"
|
76
|
+
},
|
57
77
|
"import": "./dist/nodeinfo/mod.js",
|
78
|
+
"require": "./dist/nodeinfo/mod.cjs",
|
58
79
|
"default": "./dist/nodeinfo/mod.js"
|
59
80
|
},
|
60
|
-
"./runtime": {
|
61
|
-
"types": "./dist/runtime/mod.d.ts",
|
62
|
-
"import": "./dist/runtime/mod.js",
|
63
|
-
"default": "./dist/runtime/mod.js"
|
64
|
-
},
|
65
81
|
"./sig": {
|
66
|
-
"types":
|
82
|
+
"types": {
|
83
|
+
"import": "./dist/sig/mod.d.ts",
|
84
|
+
"require": "./dist/sig/mod.d.cts",
|
85
|
+
"default": "./dist/sig/mod.d.ts"
|
86
|
+
},
|
67
87
|
"import": "./dist/sig/mod.js",
|
88
|
+
"require": "./dist/sig/mod.cjs",
|
68
89
|
"default": "./dist/sig/mod.js"
|
69
90
|
},
|
91
|
+
"./utils": {
|
92
|
+
"types": {
|
93
|
+
"import": "./dist/utils/mod.d.ts",
|
94
|
+
"require": "./dist/utils/mod.d.cts",
|
95
|
+
"default": "./dist/utils/mod.d.ts"
|
96
|
+
},
|
97
|
+
"import": "./dist/utils/mod.js",
|
98
|
+
"require": "./dist/utils/mod.cjs",
|
99
|
+
"default": "./dist/utils/mod.js"
|
100
|
+
},
|
70
101
|
"./vocab": {
|
71
|
-
"types":
|
102
|
+
"types": {
|
103
|
+
"import": "./dist/vocab/mod.d.ts",
|
104
|
+
"require": "./dist/vocab/mod.d.cts",
|
105
|
+
"default": "./dist/vocab/mod.d.ts"
|
106
|
+
},
|
72
107
|
"import": "./dist/vocab/mod.js",
|
108
|
+
"require": "./dist/vocab/mod.cjs",
|
73
109
|
"default": "./dist/vocab/mod.js"
|
74
110
|
},
|
75
111
|
"./webfinger": {
|
76
|
-
"types":
|
112
|
+
"types": {
|
113
|
+
"import": "./dist/webfinger/mod.d.ts",
|
114
|
+
"require": "./dist/webfinger/mod.d.cts",
|
115
|
+
"default": "./dist/webfinger/mod.d.ts"
|
116
|
+
},
|
77
117
|
"import": "./dist/webfinger/mod.js",
|
118
|
+
"require": "./dist/webfinger/mod.cjs",
|
78
119
|
"default": "./dist/webfinger/mod.js"
|
79
120
|
},
|
80
121
|
"./x/cfworkers": {
|
81
|
-
"types":
|
122
|
+
"types": {
|
123
|
+
"import": "./dist/x/cfworkers.d.ts",
|
124
|
+
"require": "./dist/x/cfworkers.d.cts",
|
125
|
+
"default": "./dist/x/cfworkers.d.ts"
|
126
|
+
},
|
82
127
|
"import": "./dist/x/cfworkers.js",
|
128
|
+
"require": "./dist/x/cfworkers.cjs",
|
83
129
|
"default": "./dist/x/cfworkers.js"
|
84
130
|
},
|
85
131
|
"./x/hono": {
|
86
|
-
"types":
|
132
|
+
"types": {
|
133
|
+
"import": "./dist/x/hono.d.ts",
|
134
|
+
"require": "./dist/x/hono.d.cts",
|
135
|
+
"default": "./dist/x/hono.d.ts"
|
136
|
+
},
|
87
137
|
"import": "./dist/x/hono.js",
|
138
|
+
"require": "./dist/x/hono.cjs",
|
88
139
|
"default": "./dist/x/hono.js"
|
89
140
|
},
|
90
141
|
"./x/sveltekit": {
|
91
|
-
"types":
|
142
|
+
"types": {
|
143
|
+
"import": "./dist/x/sveltekit.d.ts",
|
144
|
+
"require": "./dist/x/sveltekit.d.cts",
|
145
|
+
"default": "./dist/x/sveltekit.d.ts"
|
146
|
+
},
|
92
147
|
"import": "./dist/x/sveltekit.js",
|
148
|
+
"require": "./dist/x/sveltekit.cjs",
|
93
149
|
"default": "./dist/x/sveltekit.js"
|
94
150
|
}
|
95
151
|
},
|
96
152
|
"dependencies": {
|
97
153
|
"@cfworker/json-schema": "^4.1.1",
|
98
|
-
"@hugoalh/http-header-link": "^1.0.2",
|
99
154
|
"@js-temporal/polyfill": "^0.5.1",
|
100
|
-
"@logtape/logtape": "^1.
|
155
|
+
"@logtape/logtape": "^1.1.1",
|
101
156
|
"@multiformats/base-x": "^4.0.1",
|
102
157
|
"@opentelemetry/api": "^1.9.0",
|
103
158
|
"@opentelemetry/semantic-conventions": "^1.27.0",
|
@@ -111,7 +166,8 @@
|
|
111
166
|
"structured-field-values": "^2.0.4",
|
112
167
|
"uri-template-router": "^0.0.17",
|
113
168
|
"url-template": "^3.1.1",
|
114
|
-
"urlpattern-polyfill": "^10.1.0"
|
169
|
+
"urlpattern-polyfill": "^10.1.0",
|
170
|
+
"@fedify/vocab-runtime": "2.0.0-pr.412.1794+5c393341"
|
115
171
|
},
|
116
172
|
"devDependencies": {
|
117
173
|
"@cloudflare/workers-types": "^4.20250529.0",
|
@@ -121,7 +177,7 @@
|
|
121
177
|
"@std/yaml": "npm:@jsr/std__yaml@^1.0.6",
|
122
178
|
"@types/node": "^24.2.1",
|
123
179
|
"fast-check": "^3.22.0",
|
124
|
-
"fetch-mock": "^12.5.
|
180
|
+
"fetch-mock": "^12.5.4",
|
125
181
|
"miniflare": "^4.20250523.0",
|
126
182
|
"tsdown": "^0.12.9",
|
127
183
|
"tsx": "^4.19.4",
|
@@ -129,10 +185,10 @@
|
|
129
185
|
"wrangler": "^4.17.0"
|
130
186
|
},
|
131
187
|
"scripts": {
|
132
|
-
"build": "deno task codegen && tsdown",
|
133
|
-
"prepublish": "
|
188
|
+
"build": "deno task codegen && pnpm run --filter vocab-runtime build && tsdown",
|
189
|
+
"prepublish": "pnpm run build",
|
134
190
|
"test": "deno task codegen && tsdown && cd dist/ && node --test",
|
135
|
-
"test:bun": "deno task codegen && tsdown && cd dist/ && bun test --timeout 60000",
|
191
|
+
"test:bun": "deno task codegen && deno task pnpm:build-vocab && tsdown && cd dist/ && bun test --timeout 60000",
|
136
192
|
"test:cfworkers": "deno task codegen && wrangler deploy --dry-run --outdir src/cfworkers && node --import=tsx src/cfworkers/client.ts"
|
137
193
|
}
|
138
194
|
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
4
|
-
globalThis.addEventListener = () => {};
|
5
|
-
|
6
|
-
import { AssertionError } from "./assert_equals-DSbWqCm3.js";
|
7
|
-
import { assertIsError } from "./assert_is_error-BPGph1Jx.js";
|
8
|
-
|
9
|
-
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_throws.js
|
10
|
-
function assertThrows(fn, errorClassOrMsg, msgIncludesOrMsg, msg) {
|
11
|
-
let ErrorClass = void 0;
|
12
|
-
let msgIncludes = void 0;
|
13
|
-
let err;
|
14
|
-
if (typeof errorClassOrMsg !== "string") if (errorClassOrMsg === void 0 || errorClassOrMsg?.prototype instanceof Error || errorClassOrMsg?.prototype === Error.prototype) {
|
15
|
-
ErrorClass = errorClassOrMsg;
|
16
|
-
msgIncludes = msgIncludesOrMsg;
|
17
|
-
} else msg = msgIncludesOrMsg;
|
18
|
-
else msg = errorClassOrMsg;
|
19
|
-
let doesThrow = false;
|
20
|
-
const msgSuffix = msg ? `: ${msg}` : ".";
|
21
|
-
try {
|
22
|
-
fn();
|
23
|
-
} catch (error) {
|
24
|
-
if (ErrorClass) {
|
25
|
-
if (error instanceof Error === false) throw new AssertionError(`A non-Error object was thrown${msgSuffix}`);
|
26
|
-
assertIsError(error, ErrorClass, msgIncludes, msg);
|
27
|
-
}
|
28
|
-
err = error;
|
29
|
-
doesThrow = true;
|
30
|
-
}
|
31
|
-
if (!doesThrow) {
|
32
|
-
msg = `Expected function to throw${msgSuffix}`;
|
33
|
-
throw new AssertionError(msg);
|
34
|
-
}
|
35
|
-
return err;
|
36
|
-
}
|
37
|
-
|
38
|
-
//#endregion
|
39
|
-
export { assertThrows };
|
@@ -1,52 +0,0 @@
|
|
1
|
-
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
4
|
-
|
5
|
-
import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-DEhniCVa.js";
|
6
|
-
import { validateCryptoKey } from "./key-DxA6xRtZ.js";
|
7
|
-
import { doubleKnock } from "./http-l0TEupZK.js";
|
8
|
-
import { getLogger } from "@logtape/logtape";
|
9
|
-
|
10
|
-
//#region src/runtime/authdocloader.ts
|
11
|
-
const logger = getLogger([
|
12
|
-
"fedify",
|
13
|
-
"runtime",
|
14
|
-
"docloader"
|
15
|
-
]);
|
16
|
-
/**
|
17
|
-
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
18
|
-
* Note that an authenticated document loader intentionally does not cache
|
19
|
-
* the fetched documents.
|
20
|
-
* @param identity The identity to get the document loader for.
|
21
|
-
* The actor's key pair.
|
22
|
-
* @param options The options for the document loader.
|
23
|
-
* @returns The authenticated document loader.
|
24
|
-
* @throws {TypeError} If the key is invalid or unsupported.
|
25
|
-
* @since 0.4.0
|
26
|
-
*/
|
27
|
-
function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
|
28
|
-
validateCryptoKey(identity.privateKey);
|
29
|
-
async function load(url, options) {
|
30
|
-
if (!allowPrivateAddress) try {
|
31
|
-
await validatePublicUrl(url);
|
32
|
-
} catch (error) {
|
33
|
-
if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
|
34
|
-
url,
|
35
|
-
error
|
36
|
-
});
|
37
|
-
throw error;
|
38
|
-
}
|
39
|
-
const originalRequest = createRequest(url, { userAgent });
|
40
|
-
const response = await doubleKnock(originalRequest, identity, {
|
41
|
-
specDeterminer,
|
42
|
-
log: logRequest,
|
43
|
-
tracerProvider,
|
44
|
-
signal: options?.signal
|
45
|
-
});
|
46
|
-
return getRemoteDocument(url, response, load);
|
47
|
-
}
|
48
|
-
return load;
|
49
|
-
}
|
50
|
-
|
51
|
-
//#endregion
|
52
|
-
export { getAuthenticatedDocumentLoader };
|
package/dist/compat-Bb5myD13.js
DELETED