import { GitServer } from "@ethicdevs/fastify-git-server";
import fastify from "fastify";
import { PrismaClient } from "@prisma/client";
import type { AppSessionData, AppThemeScheme } 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 {
spawnGitCommand: GitServer.SpawnGitCommandDecorator;
cryptoService: CryptoServiceAPI;
prisma: PrismaClient;
cookies: {
theme_scheme: AppThemeScheme;
};
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
>
>;
}
}