import { type Middleware, MiddlewareRoute, type OptionsResponse, RouterAsync, type Routable, type RouteBuilderArguments, type RouterOptions, type MiddlewareResult, type SpecialNextParam } from '@akala/core'; /** * Represents a request object containing routing information. */ export declare class RouterRequest { /** * Creates a new RouterRequest instance. * @param loc The location path (default: '/'). */ constructor(loc: string); /** The path of the request. */ path: string; /** The full URL object of the request. */ url: URL; /** Query parameters from the URL. */ query: URLSearchParams; /** Dynamic route parameters extracted from the path. */ params: Record; } /** * Routing class for handling client-side routes. * Extends RouterAsync to provide asynchronous routing capabilities. */ export declare class Router extends RouterAsync<[RouterRequest & Routable]> { /** * Creates a new Router instance. * @param options Configuration options for the router. */ constructor(options?: RouterOptions); } /** * Factory function for creating a new Router instance. * @param name Optional name for the router instance. * @returns A configured Router instance. */ export declare function router(name?: string): Router; export type simpleRequest = { method: string; url: string; }; /** * Middleware class for handling HTTP method-specific routing logic. * @template T The request type extending simpleRequest & Routable * @template U Additional arguments for the middleware handler * @template TSpecialNextParam Special next parameter type */ export declare class MethodMiddleware extends MiddlewareRoute<[T, ...U], TSpecialNextParam> implements Middleware<[T, ...U], TSpecialNextParam> { private method; /** * Creates a new MethodMiddleware instance. * @param method HTTP method this middleware handles (e.g., 'GET', 'POST') * @param args Route builder arguments */ constructor(method: string, ...args: RouteBuilderArguments); /** * Checks if the middleware is applicable for the given request. * @param req The request object * @returns True if the request method matches the middleware's method */ isApplicable: (req: simpleRequest) => boolean; /** * Handles incoming requests by ensuring proper routable request structure. * @param req The incoming request * @param args Additional arguments * @returns Middleware result */ handle(req: simpleRequest | T, ...args: U): MiddlewareResult; /** * Handles errors by ensuring proper routable request structure before propagating. * @param error Error or response object * @param req The incoming request * @param args Additional arguments * @returns Middleware result */ handleError(error: Error | OptionsResponse, req: simpleRequest | T, ...args: U): MiddlewareResult; }