import fastify from "fastify";
import { PrismaClient } from "@prisma/client";
import type {
AppSessionData,
AppThemeScheme,
SectionsWithPages,
} from "../../app/types";
import type { CryptoServiceAPI } from "../../app/services/crypto/types";
declare module "@ethicdevs/fastify-custom-session" {
declare interface CustomSession extends AppSessionData {}
}
declare module "fastify" {
interface FastifyInstance {
cryptoService: CryptoServiceAPI;
prisma: PrismaClient;
}
interface FastifyRequest {
cryptoService: CryptoServiceAPI;
prisma: PrismaClient;
cookies: {
theme_scheme: AppThemeScheme;
};
sectionsWithPages: SectionsWithPages;
namedViewsPathMap: Record<string, string>;
pathNamedViewsMap: Record<string, string>;
}
interface FastifyReply {
makeRequestHandler: (
request: FastifyRequest,
reply: FastifyReply
) => <T extends Record<string, any>>(
viewName: string,
props: T & CommonViewProps,
viewCtx?: ViewContext
) => Promise<
FastifyReply<
Server,
IncomingMessage,
ServerResponse,
RouteGenericInterface,
unknown
>
>;
}
}