@fedify/fastify 1.10.4 → 1.10.6
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/index.cjs +11 -13
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
3
6
|
var __create = Object.create;
|
|
4
7
|
var __defProp = Object.defineProperty;
|
|
5
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,11 +23,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
23
|
value: mod,
|
|
21
24
|
enumerable: true
|
|
22
25
|
}) : target, mod));
|
|
23
|
-
|
|
24
26
|
//#endregion
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
let fastify_plugin = require("fastify-plugin");
|
|
28
|
+
fastify_plugin = __toESM(fastify_plugin);
|
|
29
|
+
let node_stream = require("node:stream");
|
|
28
30
|
//#region src/index.ts
|
|
29
31
|
/**
|
|
30
32
|
* Fastify plugin that integrates with a Federation instance.
|
|
@@ -87,9 +89,7 @@ const defaultNotAcceptableResponse = new Response("Not Acceptable", {
|
|
|
87
89
|
* Convert Fastify request to Web API Request.
|
|
88
90
|
*/
|
|
89
91
|
function toWebRequest(fastifyReq) {
|
|
90
|
-
const
|
|
91
|
-
const host = fastifyReq.headers.host ?? fastifyReq.hostname;
|
|
92
|
-
const url = `${protocol}://${host}${fastifyReq.url}`;
|
|
92
|
+
const url = `${fastifyReq.protocol}://${fastifyReq.headers.host ?? fastifyReq.hostname}${fastifyReq.url}`;
|
|
93
93
|
const headers = new Headers();
|
|
94
94
|
for (const [key, value] of Object.entries(fastifyReq.raw.headers)) if (Array.isArray(value)) for (const v of value) headers.append(key, v);
|
|
95
95
|
else if (value !== void 0) headers.set(key, String(value));
|
|
@@ -100,8 +100,6 @@ function toWebRequest(fastifyReq) {
|
|
|
100
100
|
body
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
var src_default = fedifyPlugin;
|
|
104
|
-
|
|
105
103
|
//#endregion
|
|
106
|
-
exports.default =
|
|
107
|
-
exports.fedifyPlugin = fedifyPlugin;
|
|
104
|
+
exports.default = fedifyPlugin;
|
|
105
|
+
exports.fedifyPlugin = fedifyPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,6 @@ import { Federation, FederationFetchOptions } from "@fedify/fedify";
|
|
|
2
2
|
import { FastifyPluginAsync, FastifyPluginOptions, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
|
|
6
5
|
type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
|
|
7
6
|
/**
|
|
8
7
|
* A factory function that creates context data for the Federation instance.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Federation, FederationFetchOptions } from "@fedify/fedify";
|
|
|
2
2
|
import { FastifyPluginAsync, FastifyPluginOptions, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
|
|
6
5
|
type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
|
|
7
6
|
/**
|
|
8
7
|
* A factory function that creates context data for the Federation instance.
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fp from "fastify-plugin";
|
|
2
2
|
import { Readable } from "node:stream";
|
|
3
|
-
|
|
4
3
|
//#region src/index.ts
|
|
5
4
|
/**
|
|
6
5
|
* Fastify plugin that integrates with a Federation instance.
|
|
@@ -63,9 +62,7 @@ const defaultNotAcceptableResponse = new Response("Not Acceptable", {
|
|
|
63
62
|
* Convert Fastify request to Web API Request.
|
|
64
63
|
*/
|
|
65
64
|
function toWebRequest(fastifyReq) {
|
|
66
|
-
const
|
|
67
|
-
const host = fastifyReq.headers.host ?? fastifyReq.hostname;
|
|
68
|
-
const url = `${protocol}://${host}${fastifyReq.url}`;
|
|
65
|
+
const url = `${fastifyReq.protocol}://${fastifyReq.headers.host ?? fastifyReq.hostname}${fastifyReq.url}`;
|
|
69
66
|
const headers = new Headers();
|
|
70
67
|
for (const [key, value] of Object.entries(fastifyReq.raw.headers)) if (Array.isArray(value)) for (const v of value) headers.append(key, v);
|
|
71
68
|
else if (value !== void 0) headers.set(key, String(value));
|
|
@@ -76,7 +73,5 @@ function toWebRequest(fastifyReq) {
|
|
|
76
73
|
body
|
|
77
74
|
});
|
|
78
75
|
}
|
|
79
|
-
var src_default = fedifyPlugin;
|
|
80
|
-
|
|
81
76
|
//#endregion
|
|
82
|
-
export {
|
|
77
|
+
export { fedifyPlugin as default, fedifyPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fastify",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.6",
|
|
4
4
|
"description": "Integrate Fedify with Fastify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"fastify": "^5.2.0",
|
|
51
|
-
"@fedify/fedify": "1.10.
|
|
51
|
+
"@fedify/fedify": "1.10.6"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^22.16.0",
|
|
55
|
-
"tsdown": "^0.
|
|
55
|
+
"tsdown": "^0.21.6",
|
|
56
56
|
"typescript": "^5.9.2"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|