@fedify/fedify 2.0.0-pr.467.1877 → 2.0.0-pr.469.1873
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actor-DMbX2bPf.js → actor-Bo3uuvwH.js} +185 -185
- package/dist/{actor-DslgGxD8.js → actor-DhFfLv7K.js} +1 -1
- package/dist/{actor-BrMdE_1G.cjs → actor-DoaVs0vL.cjs} +185 -185
- package/dist/{builder-DvuChHyB.js → builder-DFaO3_4-.js} +3 -3
- package/dist/compat/mod.d.cts +3 -2
- package/dist/compat/mod.d.ts +3 -2
- package/dist/compat/transformers.test.js +14 -14
- package/dist/{context-V-XS2_6O.d.ts → context-DG0huGW-.d.ts} +3 -140
- package/dist/{context-PxGADCsD.d.cts → context-DJ8aSy2Q.d.cts} +3 -140
- package/dist/denokv-CCssOzMJ.js +57 -0
- package/dist/{docloader-CQCA5QKZ.js → docloader-B1AZ1LMA.js} +2 -2
- package/dist/{esm-DVill8zU.js → esm-CbckHird.js} +1 -1
- package/dist/federation/builder.test.js +4 -4
- package/dist/federation/collection.test.js +2 -2
- package/dist/federation/handler.test.js +15 -15
- package/dist/federation/idempotency.test.js +15 -15
- package/dist/federation/inbox.test.js +3 -3
- package/dist/federation/keycache.test.js +3 -3
- package/dist/federation/kv.test.js +2 -2
- package/dist/federation/middleware.test.js +16 -16
- package/dist/federation/mod.cjs +7 -7
- package/dist/federation/mod.d.cts +3 -2
- package/dist/federation/mod.d.ts +3 -2
- package/dist/federation/mod.js +7 -7
- package/dist/federation/mq.test.js +4 -6
- package/dist/federation/negotiation.test.js +2 -2
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +2 -2
- package/dist/federation/send.test.js +9 -9
- package/dist/{http-GjJOLe0t.cjs → http-D27ZccIJ.cjs} +2 -2
- package/dist/{http-pBJCYh50.js → http-D8SvAGVC.js} +2 -2
- package/dist/{http-W1mkXyFw.js → http-nnaaa9xj.js} +2 -2
- package/dist/{inbox-Bk4PjO2V.js → inbox-C5M1_a0k.js} +1 -1
- package/dist/{key-BlPc80ei.js → key-bc3A8THw.js} +2 -2
- package/dist/{keycache-qku87Evf.js → keycache-CpTjHRpy.js} +1 -1
- package/dist/{keys-CXQWhBgw.js → keys-D6W2Pnoh.js} +1 -1
- package/dist/{kv-cache-BGGmyOF-.js → kv-cache-B_RVzls5.js} +1 -1
- package/dist/{kv-cache-BGfFfQma.cjs → kv-cache-CZcZLaEo.cjs} +1 -1
- package/dist/{ld-CQj76XXM.js → ld-D5Vg307g.js} +2 -2
- package/dist/{lookup-CUj1Ayf2.js → lookup-BBrk-_5k.js} +191 -186
- package/dist/{lookup-ZLHmgBj5.js → lookup-BXY5QJif.js} +7 -2
- package/dist/{lookup-BahLrzT6.cjs → lookup-DO7ZeFb2.cjs} +7 -2
- package/dist/middleware-BU2XnCCI.js +15 -0
- package/dist/{middleware-4BJL-9x8.js → middleware-CU0RJROn.js} +11 -11
- package/dist/middleware-D4qQ6MLq.cjs +15 -0
- package/dist/middleware-DEu9Xuza.js +26 -0
- package/dist/{middleware-CCBsGJcn.cjs → middleware-Dy7xPuu-.cjs} +7 -7
- package/dist/{middleware-DXsuKk_U.js → middleware-RgDZByG7.js} +7 -7
- package/dist/{mod-Cdo6SYlJ.d.ts → mod-BoHnwOCs.d.ts} +1 -1
- package/dist/{mod-BoRKfJPE.d.cts → mod-DJcZDvjA.d.cts} +1 -1
- package/dist/mod.cjs +7 -7
- package/dist/mod.d.cts +6 -5
- package/dist/mod.d.ts +6 -5
- package/dist/mod.js +7 -7
- package/dist/mq-CUKlBw08.d.ts +143 -0
- package/dist/mq-DcJPkXD5.d.cts +140 -0
- package/dist/nodeinfo/client.test.js +3 -3
- package/dist/nodeinfo/handler.test.js +14 -14
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/types.test.js +2 -2
- package/dist/{owner-Buqg_Myf.js → owner-DSDpCSms.js} +2 -2
- package/dist/{proof-DJjdTnEN.js → proof-4L3D-iT4.js} +3 -3
- package/dist/{proof-AxiARBr_.js → proof-Bvu8zaM1.js} +2 -2
- package/dist/{proof-DizHNX8y.cjs → proof-C1-VSUNW.cjs} +3 -3
- package/dist/{send-B9ByF5wN.js → send-Cr3PSs0N.js} +2 -2
- package/dist/sig/http.test.js +7 -7
- package/dist/sig/key.test.js +5 -5
- package/dist/sig/ld.test.js +6 -6
- package/dist/sig/mod.cjs +4 -4
- package/dist/sig/mod.d.cts +1 -1
- package/dist/sig/mod.d.ts +1 -1
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.js +6 -6
- package/dist/sig/proof.test.js +6 -6
- package/dist/testing/docloader.test.js +2 -2
- package/dist/testing/mod.js +2 -2
- package/dist/{testing-vN3EpiIw.js → testing-Bw9AfLxQ.js} +1 -1
- package/dist/utils/docloader.test.js +8 -8
- package/dist/utils/kv-cache.test.js +2 -2
- package/dist/utils/mod.cjs +4 -4
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +4 -4
- package/dist/vocab/actor.test.js +4 -4
- package/dist/vocab/lookup.test.js +3 -3
- package/dist/vocab/mod.cjs +3 -3
- package/dist/vocab/mod.js +3 -3
- package/dist/vocab/type.test.js +2 -2
- package/dist/vocab/vocab.test.js +3 -3
- package/dist/{vocab-CdguqeJf.js → vocab-B74bq08l.js} +2 -2
- package/dist/{vocab-DEaLWwSP.cjs → vocab-HJLl6-1F.cjs} +2 -2
- package/dist/webfinger/handler.test.js +14 -14
- package/dist/webfinger/lookup.test.js +3 -3
- package/dist/webfinger/mod.cjs +1 -1
- package/dist/webfinger/mod.js +1 -1
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.d.ts +61 -0
- package/dist/x/cfworkers.js +98 -0
- package/dist/x/cfworkers.test.d.ts +3 -0
- package/dist/x/cfworkers.test.js +177 -0
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +53 -0
- package/dist/x/hono.d.ts +55 -0
- package/dist/x/hono.js +60 -0
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +45 -0
- package/dist/x/sveltekit.d.ts +47 -0
- package/dist/x/sveltekit.js +68 -0
- package/package.json +34 -3
- package/dist/middleware-BLZsPbCt.js +0 -15
- package/dist/middleware-D8qnhAFG.cjs +0 -15
- package/dist/middleware-Dw-pChHQ.js +0 -26
- /package/dist/{mod-DMpuiKXi.d.cts → mod-0noXw66R.d.cts} +0 -0
- /package/dist/{mod-D5Z2tISD.d.ts → mod-B2iOw50L.d.ts} +0 -0
- /package/dist/{mod-aAE2wOWV.d.ts → mod-B9M-8jm2.d.ts} +0 -0
- /package/dist/{mod-CcDPcLJW.d.cts → mod-C2tOeRkN.d.cts} +0 -0
- /package/dist/{mod-DgxG-byT.d.cts → mod-DgdBYYa0.d.cts} +0 -0
- /package/dist/{mod-bjzj5QIb.d.ts → mod-xIj-IT58.d.ts} +0 -0
|
@@ -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
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
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";
|
|
13
|
+
|
|
14
|
+
//#region src/x/hono.d.ts
|
|
15
|
+
interface HonoRequest {
|
|
16
|
+
raw: Request;
|
|
17
|
+
}
|
|
18
|
+
interface HonoContext {
|
|
19
|
+
req: HonoRequest;
|
|
20
|
+
res: Response;
|
|
21
|
+
}
|
|
22
|
+
type HonoMiddleware<THonoContext extends HonoContext> = (ctx: THonoContext, next: () => Promise<void>) => Promise<Response | void>;
|
|
23
|
+
/**
|
|
24
|
+
* A factory function to create a context data for the {@link Federation}
|
|
25
|
+
* object.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated This type has been moved to `@fedify/hono` package.
|
|
28
|
+
* Import `ContextDataFactory` from `@fedify/hono` instead.
|
|
29
|
+
* This type will be removed in Fedify v2.0.
|
|
30
|
+
*
|
|
31
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
|
32
|
+
* object.
|
|
33
|
+
* @template THonoContext A type of the Hono context.
|
|
34
|
+
* @param context A Hono context object.
|
|
35
|
+
* @returns A context data for the {@link Federation} object.
|
|
36
|
+
*/
|
|
37
|
+
type ContextDataFactory<TContextData, THonoContext> = (context: THonoContext) => TContextData | Promise<TContextData>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a Hono middleware to integrate with the {@link Federation} object.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated This function has been moved to `@fedify/hono` package.
|
|
42
|
+
* Import `federation` from `@fedify/hono` instead.
|
|
43
|
+
* This function will be removed in Fedify v2.0.
|
|
44
|
+
*
|
|
45
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
|
46
|
+
* object.
|
|
47
|
+
* @template THonoContext A type of the Hono context.
|
|
48
|
+
* @param federation A {@link Federation} object to integrate with Hono.
|
|
49
|
+
* @param contextDataFactory A function to create a context data for the
|
|
50
|
+
* {@link Federation} object.
|
|
51
|
+
* @returns A Hono middleware.
|
|
52
|
+
*/
|
|
53
|
+
declare function federation<TContextData, THonoContext extends HonoContext>(federation: Federation<TContextData>, contextDataFactory: ContextDataFactory<TContextData, THonoContext>): HonoMiddleware<THonoContext>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ContextDataFactory, federation };
|
package/dist/x/hono.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import { getLogger } from "@logtape/logtape";
|
|
6
|
+
|
|
7
|
+
//#region src/x/hono.ts
|
|
8
|
+
/**
|
|
9
|
+
* Create a Hono middleware to integrate with the {@link Federation} object.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated This function has been moved to `@fedify/hono` package.
|
|
12
|
+
* Import `federation` from `@fedify/hono` instead.
|
|
13
|
+
* This function will be removed in Fedify v2.0.
|
|
14
|
+
*
|
|
15
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
|
16
|
+
* object.
|
|
17
|
+
* @template THonoContext A type of the Hono context.
|
|
18
|
+
* @param federation A {@link Federation} object to integrate with Hono.
|
|
19
|
+
* @param contextDataFactory A function to create a context data for the
|
|
20
|
+
* {@link Federation} object.
|
|
21
|
+
* @returns A Hono middleware.
|
|
22
|
+
*/
|
|
23
|
+
function federation(federation$1, contextDataFactory) {
|
|
24
|
+
const logger = getLogger([
|
|
25
|
+
"fedify",
|
|
26
|
+
"federation",
|
|
27
|
+
"hono"
|
|
28
|
+
]);
|
|
29
|
+
logger.warn("The `@fedify/fedify/x/hono` module is deprecated; use `federation` from `@fedify/hono` package instead.");
|
|
30
|
+
return async (ctx, next) => {
|
|
31
|
+
let contextData = contextDataFactory(ctx);
|
|
32
|
+
if (contextData instanceof Promise) contextData = await contextData;
|
|
33
|
+
return await federation$1.fetch(ctx.req.raw, {
|
|
34
|
+
contextData,
|
|
35
|
+
...integrateFetchOptions(ctx, next)
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function integrateFetchOptions(ctx, next) {
|
|
40
|
+
return {
|
|
41
|
+
async onNotFound(_req) {
|
|
42
|
+
await next();
|
|
43
|
+
return ctx.res;
|
|
44
|
+
},
|
|
45
|
+
async onNotAcceptable(_req) {
|
|
46
|
+
await next();
|
|
47
|
+
if (ctx.res.status !== 404) return ctx.res;
|
|
48
|
+
return new Response("Not acceptable", {
|
|
49
|
+
status: 406,
|
|
50
|
+
headers: {
|
|
51
|
+
"Content-Type": "text/plain",
|
|
52
|
+
Vary: "Accept"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { federation };
|
|
@@ -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 };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
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";
|
|
13
|
+
|
|
14
|
+
//#region src/x/sveltekit.d.ts
|
|
15
|
+
type RequestEvent = {
|
|
16
|
+
request: Request;
|
|
17
|
+
};
|
|
18
|
+
type HookParams = {
|
|
19
|
+
event: RequestEvent;
|
|
20
|
+
resolve: (event: RequestEvent) => Promise<Response>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Create a SvelteKit hook handler to integrate with the {@link Federation}
|
|
24
|
+
* object.
|
|
25
|
+
*
|
|
26
|
+
* @deprecated This function has been moved to `@fedify/sveltekit` package.
|
|
27
|
+
* Import `fedifyHook` from `@fedify/sveltekit` instead.
|
|
28
|
+
* This function will be removed in Fedify v2.0.
|
|
29
|
+
*
|
|
30
|
+
* @example hooks.server.ts
|
|
31
|
+
* ``` typescript
|
|
32
|
+
* import { federation } from "./federation"; // Import the `Federation` object
|
|
33
|
+
*
|
|
34
|
+
* export const handle = fedifyHook(federation, () => undefined);
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
|
38
|
+
* object.
|
|
39
|
+
* @param federation A {@link Federation} object to integrate with SvelteKit.
|
|
40
|
+
* @param createContextData A function to create a context data for the
|
|
41
|
+
* {@link Federation} object.
|
|
42
|
+
* @returns A SvelteKit hook handler.
|
|
43
|
+
* @since 1.3.0
|
|
44
|
+
*/
|
|
45
|
+
declare function fedifyHook<TContextData>(federation: Federation<TContextData>, createContextData: (event: RequestEvent) => TContextData | Promise<TContextData>): (params: HookParams) => Promise<Response>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { fedifyHook };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import { getLogger } from "@logtape/logtape";
|
|
6
|
+
|
|
7
|
+
//#region src/x/sveltekit.ts
|
|
8
|
+
/**
|
|
9
|
+
* Create a SvelteKit hook handler to integrate with the {@link Federation}
|
|
10
|
+
* object.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated This function has been moved to `@fedify/sveltekit` package.
|
|
13
|
+
* Import `fedifyHook` from `@fedify/sveltekit` instead.
|
|
14
|
+
* This function will be removed in Fedify v2.0.
|
|
15
|
+
*
|
|
16
|
+
* @example hooks.server.ts
|
|
17
|
+
* ``` typescript
|
|
18
|
+
* import { federation } from "./federation"; // Import the `Federation` object
|
|
19
|
+
*
|
|
20
|
+
* export const handle = fedifyHook(federation, () => undefined);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @template TContextData A type of the context data for the {@link Federation}
|
|
24
|
+
* object.
|
|
25
|
+
* @param federation A {@link Federation} object to integrate with SvelteKit.
|
|
26
|
+
* @param createContextData A function to create a context data for the
|
|
27
|
+
* {@link Federation} object.
|
|
28
|
+
* @returns A SvelteKit hook handler.
|
|
29
|
+
* @since 1.3.0
|
|
30
|
+
*/
|
|
31
|
+
function fedifyHook(federation, createContextData) {
|
|
32
|
+
const logger = getLogger([
|
|
33
|
+
"fedify",
|
|
34
|
+
"federation",
|
|
35
|
+
"sveltekit"
|
|
36
|
+
]);
|
|
37
|
+
logger.warn("The `@fedify/fedify/x/sveltekit` module is deprecated; use `fedifyHook` from `@fedify/sveltekit` package instead.");
|
|
38
|
+
return async ({ event, resolve }) => {
|
|
39
|
+
return await federation.fetch(event.request, {
|
|
40
|
+
contextData: await createContextData(event),
|
|
41
|
+
...integrateFetchOptions({
|
|
42
|
+
event,
|
|
43
|
+
resolve
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function integrateFetchOptions({ event, resolve }) {
|
|
49
|
+
return {
|
|
50
|
+
async onNotFound() {
|
|
51
|
+
return await resolve(event);
|
|
52
|
+
},
|
|
53
|
+
async onNotAcceptable() {
|
|
54
|
+
const res = await resolve(event);
|
|
55
|
+
if (res.status !== 404) return res;
|
|
56
|
+
return new Response("Not acceptable", {
|
|
57
|
+
status: 406,
|
|
58
|
+
headers: {
|
|
59
|
+
"Content-Type": "text/plain",
|
|
60
|
+
Vary: "Accept"
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { fedifyHook };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fedify",
|
|
3
|
-
"version": "2.0.0-pr.
|
|
3
|
+
"version": "2.0.0-pr.469.1873+ebbd8642",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -117,6 +117,36 @@
|
|
|
117
117
|
"import": "./dist/webfinger/mod.js",
|
|
118
118
|
"require": "./dist/webfinger/mod.cjs",
|
|
119
119
|
"default": "./dist/webfinger/mod.js"
|
|
120
|
+
},
|
|
121
|
+
"./x/cfworkers": {
|
|
122
|
+
"types": {
|
|
123
|
+
"import": "./dist/x/cfworkers.d.ts",
|
|
124
|
+
"require": "./dist/x/cfworkers.d.cts",
|
|
125
|
+
"default": "./dist/x/cfworkers.d.ts"
|
|
126
|
+
},
|
|
127
|
+
"import": "./dist/x/cfworkers.js",
|
|
128
|
+
"require": "./dist/x/cfworkers.cjs",
|
|
129
|
+
"default": "./dist/x/cfworkers.js"
|
|
130
|
+
},
|
|
131
|
+
"./x/hono": {
|
|
132
|
+
"types": {
|
|
133
|
+
"import": "./dist/x/hono.d.ts",
|
|
134
|
+
"require": "./dist/x/hono.d.cts",
|
|
135
|
+
"default": "./dist/x/hono.d.ts"
|
|
136
|
+
},
|
|
137
|
+
"import": "./dist/x/hono.js",
|
|
138
|
+
"require": "./dist/x/hono.cjs",
|
|
139
|
+
"default": "./dist/x/hono.js"
|
|
140
|
+
},
|
|
141
|
+
"./x/sveltekit": {
|
|
142
|
+
"types": {
|
|
143
|
+
"import": "./dist/x/sveltekit.d.ts",
|
|
144
|
+
"require": "./dist/x/sveltekit.d.cts",
|
|
145
|
+
"default": "./dist/x/sveltekit.d.ts"
|
|
146
|
+
},
|
|
147
|
+
"import": "./dist/x/sveltekit.js",
|
|
148
|
+
"require": "./dist/x/sveltekit.cjs",
|
|
149
|
+
"default": "./dist/x/sveltekit.js"
|
|
120
150
|
}
|
|
121
151
|
},
|
|
122
152
|
"dependencies": {
|
|
@@ -136,9 +166,10 @@
|
|
|
136
166
|
"uri-template-router": "^1.0.0",
|
|
137
167
|
"url-template": "^3.1.1",
|
|
138
168
|
"urlpattern-polyfill": "^10.1.0",
|
|
139
|
-
"@fedify/vocab-runtime": "2.0.0-pr.
|
|
169
|
+
"@fedify/vocab-runtime": "2.0.0-pr.469.1873+ebbd8642"
|
|
140
170
|
},
|
|
141
171
|
"devDependencies": {
|
|
172
|
+
"@cloudflare/workers-types": "^4.20250529.0",
|
|
142
173
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
143
174
|
"@std/path": "npm:@jsr/std__path@^1.0.6",
|
|
144
175
|
"@std/url": "npm:@jsr/std__url@1.0.0-rc.3",
|
|
@@ -151,7 +182,7 @@
|
|
|
151
182
|
"tsx": "^4.19.4",
|
|
152
183
|
"typescript": "^5.9.3",
|
|
153
184
|
"wrangler": "^4.17.0",
|
|
154
|
-
"@fedify/vocab-tools": "^2.0.0-pr.
|
|
185
|
+
"@fedify/vocab-tools": "^2.0.0-pr.469.1873+ebbd8642"
|
|
155
186
|
},
|
|
156
187
|
"scripts": {
|
|
157
188
|
"build": "deno task codegen && pnpm run --filter vocab-runtime build && pnpm run --filter vocab-tools build && tsdown",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
|
|
5
|
-
import "./transformers-BFT6d7J5.js";
|
|
6
|
-
import "./lookup-ZLHmgBj5.js";
|
|
7
|
-
import "./actor-DMbX2bPf.js";
|
|
8
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-DXsuKk_U.js";
|
|
9
|
-
import "./http-W1mkXyFw.js";
|
|
10
|
-
import "./proof-DJjdTnEN.js";
|
|
11
|
-
import "./types-BtUjyi5y.js";
|
|
12
|
-
import "./kv-cache-BGGmyOF-.js";
|
|
13
|
-
import "./vocab-CdguqeJf.js";
|
|
14
|
-
|
|
15
|
-
export { FederationImpl };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
-
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
-
|
|
5
|
-
require('./transformers-CoBS-oFG.cjs');
|
|
6
|
-
require('./lookup-BahLrzT6.cjs');
|
|
7
|
-
require('./actor-BrMdE_1G.cjs');
|
|
8
|
-
const require_middleware = require('./middleware-CCBsGJcn.cjs');
|
|
9
|
-
require('./http-GjJOLe0t.cjs');
|
|
10
|
-
require('./proof-DizHNX8y.cjs');
|
|
11
|
-
require('./types-CWgzGaqk.cjs');
|
|
12
|
-
require('./kv-cache-BGfFfQma.cjs');
|
|
13
|
-
require('./vocab-DEaLWwSP.cjs');
|
|
14
|
-
|
|
15
|
-
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
6
|
-
import "./lookup-CUj1Ayf2.js";
|
|
7
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-4BJL-9x8.js";
|
|
8
|
-
import "./client-pY7-3icS.js";
|
|
9
|
-
import "./types-C2XVl6gj.js";
|
|
10
|
-
import "./actor-DslgGxD8.js";
|
|
11
|
-
import "./key-BlPc80ei.js";
|
|
12
|
-
import "./http-pBJCYh50.js";
|
|
13
|
-
import "./ld-CQj76XXM.js";
|
|
14
|
-
import "./owner-Buqg_Myf.js";
|
|
15
|
-
import "./proof-AxiARBr_.js";
|
|
16
|
-
import "./docloader-CQCA5QKZ.js";
|
|
17
|
-
import "./kv-cache-DN9pfMBe.js";
|
|
18
|
-
import "./inbox-Bk4PjO2V.js";
|
|
19
|
-
import "./builder-DvuChHyB.js";
|
|
20
|
-
import "./collection-BzWsN9pB.js";
|
|
21
|
-
import "./keycache-qku87Evf.js";
|
|
22
|
-
import "./negotiation-C4nFufNk.js";
|
|
23
|
-
import "./retry-CfF8Gn4d.js";
|
|
24
|
-
import "./send-B9ByF5wN.js";
|
|
25
|
-
|
|
26
|
-
export { FederationImpl };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|