import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "../types/h3.mjs"; import { Route } from "../Route.mjs"; import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs"; import { ResourceRoutes } from "../ResourceRoutes.mjs"; import { RouteGroup } from "../RouteGroup.mjs"; import { CoreRouter } from "../core/CoreRouter.mjs"; import { H3 } from "h3"; //#region src/h3/router.d.ts /** * @class clear-router H3 Router * @description Laravel-style routing system for Express.js and H3 with support for CommonJS, ESM, and TypeScript * @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 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$1[] | Middleware$1): 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; /** * Adds a new GET route to the router with the specified path, handler, and optional middlewares. * * @param path * @param handler * @param middlewares */ static get(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Adds a new POST route to the router with the specified path, handler, and optional middlewares. * * @param path * @param handler * @param middlewares */ static post(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Adds a new PUT route to the router with the specified path, handler, and optional middlewares. * * @param path * @param handler * @param middlewares */ static put(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Adds a new DELETE route to the router with the specified path, handler, and optional middlewares. * * @param path * @param handler * @param middlewares */ static delete(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Adds a new PATCH route to the router with the specified path, handler, and optional middlewares. * * @param path * @param handler * @param middlewares */ static patch(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Adds a new OPTIONS route to the router with the specified path, handler, and optional middlewares. * * @param path * @param handler * @param middlewares */ static options(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Adds a new HEAD route to the router. * * @param path * @param handler * @param middlewares */ static head(path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route>; /** * Defines a group of routes with a common prefix. * * @param prefix * @param callback * @param middlewares */ static group(prefix: string, source: S, middlewares?: Middleware$1[]): RouteGroup, S>; /** * Adds global middlewares to the router, which will be applied to all routes. * * @param middlewares * @param callback */ static middleware(middlewares: Middleware$1[], callback: () => void): void; /** * Retrieves all registered routes in the router, optionally organized by path or method * for easier access and management. * * @param type */ static allRoutes(): Array>>; static allRoutes(type: 'path'): Record>>; static allRoutes(type: 'method'): { [method in Uppercase]?: Array>> }; static allRoutes(type: 'name'): Record>>; static route(name: string): Route> | undefined; /** * Applies the registered routes to the given H3 application instance, setting up the * necessary handlers and middlewares for each route. * * @param app * @returns */ static apply(app: H3): H3App; } //#endregion export { Router };