@art-ws/fastify-http-server 2.0.11 → 2.0.13
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.
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type RouteDef } from "@art-ws/http-server";
|
2
|
-
import { type FastifyInstance, type FastifyReply, type FastifyRequest } from "fastify";
|
2
|
+
import Fastify, { type FastifyInstance, type FastifyReply, type FastifyRequest } from "fastify";
|
3
3
|
export type { FastifyInstance, FastifyReply, FastifyRequest };
|
4
4
|
export declare function createHttpServer({ routes, port, handlers, plugins, onPlugin, }: {
|
5
5
|
routes: RouteDef<FastifyRequest, FastifyReply, FastifyInstance>[];
|
@@ -22,11 +22,11 @@ export declare function createHttpServer({ routes, port, handlers, plugins, onPl
|
|
22
22
|
}) => Promise<void>;
|
23
23
|
}): Promise<{
|
24
24
|
port: number;
|
25
|
-
fastify: FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>,
|
25
|
+
fastify: Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault> & PromiseLike<Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>> & {
|
26
26
|
__linterBrands: "SafePromiseLike";
|
27
27
|
};
|
28
28
|
} | {
|
29
|
-
fastify: FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>,
|
29
|
+
fastify: Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault> & PromiseLike<Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>> & {
|
30
30
|
__linterBrands: "SafePromiseLike";
|
31
31
|
};
|
32
32
|
port?: undefined;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { getRootInjector } from "@art-ws/di";
|
2
2
|
import { CONTEXT, REQUEST, REQUEST_ID, RESPONSE, } from "@art-ws/http-server";
|
3
3
|
import cors from "@fastify/cors";
|
4
4
|
import formbody from "@fastify/formbody";
|
@@ -56,7 +56,7 @@ export async function createHttpServer({ routes, port, handlers, plugins, onPlug
|
|
56
56
|
resolveFunc = resolve;
|
57
57
|
});
|
58
58
|
const context = new FastifyHttpContext(promise, new FastifyHttpReq(req), new FastifyHttpRes(res), new FastifyHttpServer(fastify));
|
59
|
-
const result = await
|
59
|
+
const result = await getRootInjector().runScope(() => handler(context), {
|
60
60
|
onEnd: () => {
|
61
61
|
res.headers({
|
62
62
|
"x-req-id": req_id,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@art-ws/fastify-http-server",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.13",
|
4
4
|
"description": "Fastify Http server",
|
5
5
|
"license": "UNLICENSED",
|
6
6
|
"author": "Alexander Shagin",
|
@@ -16,8 +16,8 @@
|
|
16
16
|
"@fastify/multipart": "^9.0.3",
|
17
17
|
"@fastify/static": "^8.2.0",
|
18
18
|
"fastify": "^5.5.0",
|
19
|
-
"@art-ws/di": "2.0.
|
20
|
-
"@art-ws/http-server": "2.0.
|
19
|
+
"@art-ws/di": "2.0.18",
|
20
|
+
"@art-ws/http-server": "2.0.10"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
23
|
"eslint": "^9.34.0",
|