import { Handler, HonoApp, HttpContext, Middleware } from "../types/hono.cjs"; import { Route } from "../Route.cjs"; import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs"; import { ResourceRoutes } from "../ResourceRoutes.cjs"; import { RouteGroup } from "../RouteGroup.cjs"; import { CoreRouter } from "../core/CoreRouter.cjs"; //#region src/hono/router.d.ts /** * @class clear-router Hono Router * @description Laravel-style routing system for Hono using shared clear-router core * @author 3m1n3nc3 * @repository https://github.com/arkstack-hq/clear-router */ declare class Router extends CoreRouter { protected static routerStateNamespace: string; protected static formatWildcardParam(name: string): string; private static readonly bodyCache; private static toResponse; private static getParams; private static readBodyCached; /** * Adds a new route to the router. * * @param methods * @param path * @param handler * @param middlewares */ static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define a resourceful API controller with standard CRUD routes * * @param basePath * @param controller * @param options */ static apiResource(basePath: string, controller: any, options?: { only?: ResourceAction[]; except?: ResourceAction[]; middlewares?: ApiResourceMiddleware; }): ResourceRoutes; /** * Define a GET route * * @param path * @param handler * @param middlewares */ static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define a POST route * * @param path * @param handler * @param middlewares */ static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define a PUT route * * @param path * @param handler * @param middlewares */ static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define a DELETE route * * @param path * @param handler * @param middlewares */ static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define a PATCH route * * @param path * @param handler * @param middlewares */ static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define an OPTIONS route * * @param path * @param handler * @param middlewares */ static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Define a HEAD route * * @param path * @param handler * @param middlewares */ static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Defines a group of routes with a common prefix. * * @param prefix * @param callback * @param middlewares */ static group(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup, S>; /** * Apply middlewares to a group of routes defined within the callback * * @param middlewares - Middleware or array of middlewares to apply * @param callback - Function that defines the routes to which the middlewares will be applied */ static middleware(middlewares: Middleware[], callback: () => void): void; /** * Get all defined routes, optionally organized by path or method */ static allRoutes(): Array>>; /** * @param type - 'path' to get routes organized by path */ static allRoutes(type: 'path'): Record>>; /** * @param type - 'method' to get routes organized by method */ static allRoutes(type: 'method'): { [method in Uppercase]?: Array>> }; static allRoutes(type: 'name'): Record>>; static route(name: string): Route> | undefined; /** * Apply the defined routes to a Hono application instance * * @param app The Hono application instance * @returns The Hono application instance with the applied routes */ static apply(app: HonoApp): HonoApp; } //#endregion export { Router };