decentralised message store

refactor: refine handler signatures

serenity 5388ea66 5335b869

Changed files
+13 -2
src
lib
types
+13 -2
src/lib/types/routes.ts
···
-
import type { FastifyReply, FastifyRequest, HookHandlerDoneFunction } from "fastify";
+
import type {
+
FastifyReply,
+
FastifyRequest,
+
HookHandlerDoneFunction,
+
} from "fastify";
import type { WebSocket } from "ws";
export type RouteHandler = (
···
reply: FastifyReply,
) => Response | Promise<Response>;
-
export type PreHandler = (req: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => void;
+
export type PreHandler = (
+
req: FastifyRequest,
+
reply: FastifyReply,
+
done: HookHandlerDoneFunction,
+
) => void;
export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
···
method: Method;
handler: RouteHandler;
wsHandler?: undefined;
+
skipRegistrationCheck?: true;
}
export type WsRouteHandler = (socket: WebSocket, req: FastifyRequest) => void;
···
handler?: RouteHandler;
wsHandler: WsRouteHandler;
preHandler?: PreHandler;
+
skipRegistrationCheckHttp?: true;
+
skipRegistrationCheckWs?: true;
}