import { EventEmitter } from "node:events"; export interface WoodlandConfig { autoIndex?: boolean; bodyLimit?: number; cacheSize?: number; cacheTTL?: number; charset?: string; corsExpose?: string; defaultHeaders?: Record; digit?: number; disableTrace?: boolean; etags?: boolean; exposeErrorMessages?: boolean; indexes?: string[]; logging?: object; origins?: string[]; silent?: boolean; time?: boolean; } export interface FileDescriptor { charset: string; etag: string; path: string; stats: { mtime: Date; size: number; }; } export interface RouteInfo { params?: boolean; getParams?: RegExp | null; middleware: Function[]; exit: number; visible: number; } export interface CookieOptions { domain?: string; path?: string; maxAge?: number; expires?: Date; httpOnly?: boolean; secure?: boolean; sameSite?: "strict" | "lax" | "none" | string; encode?: boolean | ((value: string) => string); } export interface ClearCookieOptions { domain?: string; path?: string; } export interface WoodlandResponse { locals: Record; error(status?: number, body?: Error | string): void; header(name: string, value: string | number): void; json(body: any, status?: number, headers?: Record): void; redirect(uri: string, perm?: boolean): void; send(body?: any, status?: number, headers?: Record): void; set(headers: Record): void; status(code: number): void; cookie(name: string, value: string, opts?: CookieOptions): void; clearCookie(name: string, opts?: ClearCookieOptions): void; } export class Woodland extends EventEmitter { // Public read-only properties (getters) readonly logger: Readonly<{ log: (...args: any[]) => void; logError: (...args: any[]) => void; logRoute: (...args: any[]) => void; logMiddleware: (...args: any[]) => void; logDecoration: (...args: any[]) => void; logServe: (...args: any[]) => void; clf: (...args: any[]) => string; }>; // Public error handler property (getter/setter) error: ((err: Error, req: any, res: any) => void) | null; constructor(config?: WoodlandConfig); // Public routing methods - with path always(rpath: string, ...fn: Function[]): Woodland; connect(rpath: string, ...fn: Function[]): Woodland; delete(rpath: string, ...fn: Function[]): Woodland; get(rpath: string, ...fn: Function[]): Woodland; options(rpath: string, ...fn: Function[]): Woodland; patch(rpath: string, ...fn: Function[]): Woodland; post(rpath: string, ...fn: Function[]): Woodland; put(rpath: string, ...fn: Function[]): Woodland; trace(rpath: string, ...fn: Function[]): Woodland; // Public routing methods - without path (handler only) always(...fn: Function[]): Woodland; connect(...fn: Function[]): Woodland; delete(...fn: Function[]): Woodland; get(...fn: Function[]): Woodland; options(...fn: Function[]): Woodland; patch(...fn: Function[]): Woodland; post(...fn: Function[]): Woodland; put(...fn: Function[]): Woodland; trace(...fn: Function[]): Woodland; // Middleware methods ignore(fn: Function): Woodland; list(method?: string, type?: string): any | any[]; use(rpath: string | Function, ...fn: Function[]): Woodland; use(rpath: string, ...fn: (Function | string)[]): Woodland; // Utility methods etag(method: string, ...args: any[]): string; files(root?: string, folder?: string): Woodland; route(req: any, res: any): void; routes(uri: string, method: string, override?: boolean): RouteInfo; serve(req: any, res: any, arg: string, folder?: string): Promise; stream(req: any, res: any, file?: FileDescriptor): void; } export function woodland(arg?: WoodlandConfig): Woodland; export default woodland;