///
import { NextApiRequest, NextApiResponse } from "next/types";
import { NextRequest } from "next/server";
import { Config } from "../config/index.js";
import createHandler from "../handlers/create.js";
export type HandlerArguments = {
query?: Record;
body?: Record;
cookies: {
sessionToken?: string;
};
url: URL;
config: Config;
};
export declare enum HandlerErrorCodes {
Forbidden = "You are already logged in.",
NotFound = "Path not found.",
Unauthorized = "You could not be signed in.",
Gone = "Session not found.",
BadRequest = "Missing required query or body arguments.",
Default = "Unable to sign in."
}
type HandlerError = {
error: keyof typeof HandlerErrorCodes;
log?: string;
message?: string;
status?: 302 | 404 | 410 | 500;
headers?: Record;
};
type HandlerRedirect = {
redirect: URL;
};
type HandlerResponse = {
status?: 200;
headers?: Record;
response: string | Buffer | Record;
};
export type HandlerReturn = HandlerRedirect | HandlerError | HandlerResponse;
export declare function pagesHandler(req: NextApiRequest, res: NextApiResponse, config: Config, handler: (args: HandlerArguments) => Promise): Promise>;
export declare function appHandler(req: NextRequest, config: Config, handler: (args: HandlerArguments) => Promise): Promise;
type Arguments = {
config: Config;
req: NextApiRequest | NextRequest;
res?: NextApiResponse;
};
export default function getHandler(args: Arguments): typeof createHandler;
export {};
//# sourceMappingURL=handlers.d.ts.map