import { Handler, HttpContext, Middleware } from "../types/express.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"; import { Router } from "express"; //#region src/express/router.d.ts /** * @class clear-router Express Router * @description Laravel-style routing system for Express.js and H3 with support for CommonJS, ESM, and TypeScript * @author Refkinscallv * @author 3m1n3nc3 * @repository https://github.com/arkstack-hq/clear-router */ declare class Router$1 extends CoreRouter { protected static routerStateNamespace: string; protected static formatWildcardParam(name: string): string; private static ensureRequestBodyAccessor; private static sendReturnValue; /** * 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; /** * Adds a new GET route to the router. * * @param path * @param handler * @param middlewares */ static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Adds a new POST route to the router. * * @param path * @param handler * @param middlewares */ static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Adds a new PUT route to the router. * * @param path * @param handler * @param middlewares */ static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Adds a new DELETE route to the router. * * @param path * @param handler * @param middlewares */ static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Adds a new PATCH route to the router. * * @param path * @param handler * @param middlewares */ static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Adds a new OPTIONS route to the router. * * @param path * @param handler * @param middlewares */ static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route>; /** * Adds a new HEAD route to the router. * * @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>; /** * Adds global middlewares to the router, which will be applied to all routes. * * @param middlewares * @param callback */ static middleware(middlewares: Middleware[], callback: () => void): void; /** * Retrieves all registered routes in the router, optionally organized by path or method. * * @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 Express router instance, setting up the necessary * handlers and middlewares for each route. * * @param router */ static apply(router: Router): void; static apply(router: Router): Promise; } //#endregion export { Router$1 as Router };