UNPKG

@t3ned/channel

Version:

Ergonomic, chaining-based Typescript framework for quick API development for Fastify

125 lines 3.38 kB
import type { ZodError } from "zod"; import { FastifyCorsOptions } from "@fastify/cors"; import { ApplicationLoader } from "./ApplicationLoader"; import { FastifyInstance } from "fastify"; export declare class Application { /** * The fastify instance for the application to use */ instance: FastifyInstance; /** * The application loader for loading routes */ loader: ApplicationLoader; /** * The path to the directory routes are located */ routeDirPath: string | null; /** * The prefix for a route path */ routePathPrefix?: string; /** * The prefix to use in file names to ignore in route paths */ routeFileIgnorePrefix: string; /** * The default route version prefix */ routeDefaultVersionPrefix: string | null; /** * The default route version number */ routeDefaultVersionNumber: number | null; /** * The validation error mapper */ validationErrorMapper: Application.ValidationErrorMapper; /** * The logger to use */ logger: Application.CompatibleLogger; /** * Whether to enable debug logs */ debug: boolean; /** * @param options The application options */ constructor(options?: Application.Options); /** * The default route version */ get routeDefaultVersion(): string; /** * Listen for connections * @param host The host to bind * @param port The port to bind * * @returns The application */ listen(host: string, port: number): Promise<this>; } export declare namespace Application { interface Options { /** * The fastify instance for the application to use */ instance?: FastifyInstance; /** * The application loader for loading routes */ loader?: ApplicationLoader; /** * The path to the directory routes are located */ routeDirPath?: string[] | string; /** * The prefix for a route path */ routePathPrefix?: string; /** * The prefix to use in file names to ignore in route paths */ routeFileIgnorePrefix?: string; /** * The default route version prefix */ routeDefaultVersionPrefix?: string; /** * The default route version number */ routeDefaultVersionNumber?: number; /** * Whether to set the default error handler */ useDefaultErrorHandler?: boolean; /** * Whether to set the default not found handler */ useDefaultNotFoundHandler?: boolean; /** * The validation error mapper */ validationErrorMapper?: ValidationErrorMapper; /** * The logger to use */ logger?: CompatibleLogger; /** * Whether to enable debug logs */ debug?: boolean; /** * Cors options */ cors?: FastifyCorsOptions; } type ValidationErrorMapper = (error: ZodError) => Promise<unknown> | unknown; interface CompatibleLogger { info(message: unknown): unknown; debug(message: unknown): unknown; error(error: Error): unknown; } } //# sourceMappingURL=Application.d.ts.map