clear-router 2.1.11 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let node_async_hooks = require("node:async_hooks");
2
3
 
3
4
  //#region src/ClearRequest.ts
4
5
  var ClearRequest = class {
@@ -58,7 +59,348 @@ var Route = class {
58
59
  }
59
60
  };
60
61
 
62
+ //#endregion
63
+ //#region src/core/router.ts
64
+ /**
65
+ * @class clear-router CoreRouter
66
+ * @description Core routing logic for clear-router, shared between all supported adapters (Express.js, H3, etc.)
67
+ * @author 3m1n3nc3
68
+ * @repository https://github.com/toneflix/clear-router
69
+ */
70
+ var CoreRouter = class {
71
+ static config = { methodOverride: {
72
+ enabled: true,
73
+ bodyKeys: ["_method"],
74
+ headerKeys: ["x-http-method"]
75
+ } };
76
+ static groupContext = new node_async_hooks.AsyncLocalStorage();
77
+ static routes = [];
78
+ static routesByPathMethod = {};
79
+ static routesByMethod = {};
80
+ static prefix = "";
81
+ static groupMiddlewares = [];
82
+ static globalMiddlewares = [];
83
+ static ensureState() {
84
+ if (!Object.prototype.hasOwnProperty.call(this, "config")) this.config = { methodOverride: {
85
+ enabled: true,
86
+ bodyKeys: ["_method"],
87
+ headerKeys: ["x-http-method"]
88
+ } };
89
+ if (!Object.prototype.hasOwnProperty.call(this, "groupContext")) this.groupContext = new node_async_hooks.AsyncLocalStorage();
90
+ if (!Object.prototype.hasOwnProperty.call(this, "routes")) this.routes = [];
91
+ if (!Object.prototype.hasOwnProperty.call(this, "routesByPathMethod")) this.routesByPathMethod = {};
92
+ if (!Object.prototype.hasOwnProperty.call(this, "routesByMethod")) this.routesByMethod = {};
93
+ if (!Object.prototype.hasOwnProperty.call(this, "prefix")) this.prefix = "";
94
+ if (!Object.prototype.hasOwnProperty.call(this, "groupMiddlewares")) this.groupMiddlewares = [];
95
+ if (!Object.prototype.hasOwnProperty.call(this, "globalMiddlewares")) this.globalMiddlewares = [];
96
+ }
97
+ /**
98
+ * Normalizes a path by ensuring it starts with a single slash and does not have trailing
99
+ * slashes, while preserving dynamic segments and parameters.
100
+ *
101
+ * @param path The path to normalize.
102
+ * @returns The normalized path.
103
+ */
104
+ static normalizePath(path) {
105
+ return "/" + path.split("/").filter(Boolean).join("/");
106
+ }
107
+ /**
108
+ * Configures the router with the given options, such as method override settings.
109
+ *
110
+ * @param this
111
+ * @param options
112
+ * @returns
113
+ */
114
+ static configure(options) {
115
+ this.ensureState();
116
+ if (!this.config.methodOverride) this.config.methodOverride = {
117
+ enabled: true,
118
+ bodyKeys: ["_method"],
119
+ headerKeys: ["x-http-method"]
120
+ };
121
+ const override = options?.methodOverride;
122
+ if (!override) return;
123
+ if (typeof override.enabled === "boolean") this.config.methodOverride.enabled = override.enabled;
124
+ const bodyKeys = override.bodyKeys;
125
+ if (typeof bodyKeys !== "undefined") this.config.methodOverride.bodyKeys = (Array.isArray(bodyKeys) ? bodyKeys : [bodyKeys]).map((e) => String(e).trim()).filter(Boolean);
126
+ const headerKeys = override.headerKeys;
127
+ if (typeof headerKeys !== "undefined") this.config.methodOverride.headerKeys = (Array.isArray(headerKeys) ? headerKeys : [headerKeys]).map((e) => String(e).trim().toLowerCase()).filter(Boolean);
128
+ }
129
+ static resolveMethodOverride(method, headers, body) {
130
+ this.ensureState();
131
+ if (!this.config.methodOverride?.enabled || method.toLowerCase() !== "post") return null;
132
+ let override;
133
+ const headerValueFor = (key) => {
134
+ if (typeof headers.get === "function") return headers.get(key);
135
+ const value = headers?.[key];
136
+ return Array.isArray(value) ? value[0] : value;
137
+ };
138
+ for (const key of this.config.methodOverride?.headerKeys || []) {
139
+ const value = headerValueFor(key);
140
+ if (value) {
141
+ override = value;
142
+ break;
143
+ }
144
+ }
145
+ if (!override && body && typeof body === "object") for (const key of this.config.methodOverride?.bodyKeys || []) {
146
+ const value = body[key];
147
+ if (typeof value !== "undefined" && value !== null && value !== "") {
148
+ override = value;
149
+ break;
150
+ }
151
+ }
152
+ const normalized = String(override || "").trim().toLowerCase();
153
+ if (!normalized) return null;
154
+ if ([
155
+ "put",
156
+ "patch",
157
+ "delete",
158
+ "post"
159
+ ].includes(normalized)) return normalized;
160
+ return null;
161
+ }
162
+ /**
163
+ * Adds a new route to the router with the specified methods, path, handler, and middlewares.
164
+ *
165
+ * @param this
166
+ * @param methods
167
+ * @param path
168
+ * @param handler
169
+ * @param middlewares
170
+ */
171
+ static add(methods, path, handler, middlewares) {
172
+ this.ensureState();
173
+ const context = this.groupContext.getStore();
174
+ const activePrefix = context?.prefix ?? this.prefix;
175
+ const activeGroupMiddlewares = context?.groupMiddlewares ?? this.groupMiddlewares;
176
+ methods = Array.isArray(methods) ? methods : [methods];
177
+ middlewares = middlewares ? Array.isArray(middlewares) ? middlewares : [middlewares] : void 0;
178
+ const fullPath = this.normalizePath(`${activePrefix}/${path}`);
179
+ const route = new Route(methods.includes("options") ? methods : methods.concat("options"), fullPath, handler, [
180
+ ...this.globalMiddlewares,
181
+ ...activeGroupMiddlewares,
182
+ ...middlewares || []
183
+ ]);
184
+ if (!methods.includes("options") && !this.routesByPathMethod[`OPTIONS ${fullPath}`]) this.options(path, ({ res }) => {
185
+ if (res?.headers?.set) {
186
+ res.headers.set("Allow", "GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD");
187
+ res.status = 204;
188
+ return;
189
+ }
190
+ if (res?.set) {
191
+ res.set("Allow", "GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD");
192
+ res.sendStatus(204);
193
+ }
194
+ });
195
+ this.routes.push(route);
196
+ for (const method of methods.map((m) => m.toUpperCase())) {
197
+ this.routesByPathMethod[`${method} ${fullPath}`] = route;
198
+ if (!this.routesByMethod[method]) this.routesByMethod[method] = [];
199
+ this.routesByMethod[method].push(route);
200
+ }
201
+ }
202
+ /**
203
+ * Adds a new API resource route to the router for the specified base path and controller, with
204
+ * options to include/exclude specific actions and apply middlewares.
205
+ *
206
+ * @param this
207
+ * @param basePath
208
+ * @param controller
209
+ * @param options
210
+ */
211
+ static apiResource(basePath, controller, options) {
212
+ const actions = {
213
+ index: {
214
+ method: "get",
215
+ path: "/"
216
+ },
217
+ show: {
218
+ method: "get",
219
+ path: "/:id"
220
+ },
221
+ create: {
222
+ method: "post",
223
+ path: "/"
224
+ },
225
+ update: {
226
+ method: "put",
227
+ path: "/:id"
228
+ },
229
+ destroy: {
230
+ method: "delete",
231
+ path: "/:id"
232
+ }
233
+ };
234
+ const only = options?.only || Object.keys(actions);
235
+ const except = options?.except || [];
236
+ const preController = typeof controller === "function" ? new controller() : controller;
237
+ for (const action of only) {
238
+ if (except.includes(action)) continue;
239
+ if (typeof preController[action] === "function") {
240
+ const { method, path } = actions[action];
241
+ const actionMiddlewares = typeof options?.middlewares === "object" && !Array.isArray(options.middlewares) ? options.middlewares[action] : options?.middlewares;
242
+ this.add(method, `${basePath}${path}`, [controller, action], Array.isArray(actionMiddlewares) ? actionMiddlewares : actionMiddlewares ? [actionMiddlewares] : void 0);
243
+ }
244
+ }
245
+ }
246
+ /**
247
+ * Adds a new GET route to the router with the specified path, handler, and optional middlewares.
248
+ *
249
+ * @param this The router instance.
250
+ * @param path The path for the GET route.
251
+ * @param handler The handler function for the GET route.
252
+ * @param middlewares Optional middlewares to apply to the GET route.
253
+ */
254
+ static get(path, handler, middlewares) {
255
+ this.add("get", path, handler, middlewares);
256
+ }
257
+ /**
258
+ * Adds a new POST route to the router with the specified path, handler, and optional middlewares.
259
+ *
260
+ * @param this
261
+ * @param path
262
+ * @param handler
263
+ * @param middlewares
264
+ */
265
+ static post(path, handler, middlewares) {
266
+ this.add("post", path, handler, middlewares);
267
+ }
268
+ /**
269
+ * Adds a new PUT route to the router with the specified path, handler, and optional middlewares.
270
+ *
271
+ * @param this
272
+ * @param path
273
+ * @param handler
274
+ * @param middlewares
275
+ */
276
+ static put(path, handler, middlewares) {
277
+ this.add("put", path, handler, middlewares);
278
+ }
279
+ /**
280
+ * Adds a new DELETE route to the router with the specified path, handler, and optional middlewares.
281
+ *
282
+ * @param this
283
+ * @param path
284
+ * @param handler
285
+ * @param middlewares
286
+ */
287
+ static delete(path, handler, middlewares) {
288
+ this.add("delete", path, handler, middlewares);
289
+ }
290
+ /**
291
+ * Adds a new PATCH route to the router with the specified path, handler, and optional middlewares.
292
+ *
293
+ * @param this
294
+ * @param path
295
+ * @param handler
296
+ * @param middlewares
297
+ */
298
+ static patch(path, handler, middlewares) {
299
+ this.add("patch", path, handler, middlewares);
300
+ }
301
+ /**
302
+ * Adds a new OPTIONS route to the router with the specified path, handler, and optional middlewares.
303
+ *
304
+ * @param this
305
+ * @param path
306
+ * @param handler
307
+ * @param middlewares
308
+ */
309
+ static options(path, handler, middlewares) {
310
+ this.add("options", path, handler, middlewares);
311
+ }
312
+ /**
313
+ * Adds a new HEAD route to the router with the specified path, handler, and optional middlewares.
314
+ *
315
+ * @param this
316
+ * @param path
317
+ * @param handler
318
+ * @param middlewares
319
+ */
320
+ static head(path, handler, middlewares) {
321
+ this.add("head", path, handler, middlewares);
322
+ }
323
+ /**
324
+ * Defines a group of routes with a common prefix and optional middlewares, allowing for better
325
+ * organization and reuse of route configurations.
326
+ *
327
+ * @param this
328
+ * @param prefix
329
+ * @param callback
330
+ * @param middlewares
331
+ */
332
+ static async group(prefix, callback, middlewares) {
333
+ this.ensureState();
334
+ const context = this.groupContext.getStore();
335
+ const previousPrefix = context?.prefix ?? this.prefix;
336
+ const previousMiddlewares = context?.groupMiddlewares ?? this.groupMiddlewares;
337
+ const fullPrefix = [previousPrefix, prefix].filter(Boolean).join("/");
338
+ const nextContext = {
339
+ prefix: this.normalizePath(fullPrefix),
340
+ groupMiddlewares: [...previousMiddlewares, ...middlewares || []]
341
+ };
342
+ await this.groupContext.run(nextContext, async () => {
343
+ await Promise.resolve(callback());
344
+ });
345
+ }
346
+ /**
347
+ * Adds global middlewares to the router, which will be applied to all routes.
348
+ *
349
+ * @param this
350
+ * @param middlewares
351
+ * @param callback
352
+ */
353
+ static middleware(middlewares, callback) {
354
+ this.ensureState();
355
+ const prevMiddlewares = this.globalMiddlewares;
356
+ this.globalMiddlewares = [...prevMiddlewares, ...middlewares || []];
357
+ callback();
358
+ this.globalMiddlewares = prevMiddlewares;
359
+ }
360
+ static allRoutes(type) {
361
+ this.ensureState();
362
+ if (type === "method") return this.routesByMethod;
363
+ if (type === "path") return this.routesByPathMethod;
364
+ return this.routes.filter((e) => e.methods.length > 1 || e.methods[0] !== "options");
365
+ }
366
+ static resolveHandler(route) {
367
+ let handlerFunction;
368
+ let instance = null;
369
+ if (typeof route.handler === "function") handlerFunction = route.handler.bind(route);
370
+ else if (Array.isArray(route.handler) && route.handler.length === 2) {
371
+ const [ControllerType, method] = route.handler;
372
+ if (["function", "object"].includes(typeof ControllerType) && typeof ControllerType[method] === "function") {
373
+ instance = ControllerType;
374
+ handlerFunction = ControllerType[method].bind(ControllerType);
375
+ } else if (typeof ControllerType === "function") {
376
+ instance = new ControllerType();
377
+ if (typeof instance[method] === "function") handlerFunction = instance[method].bind(instance);
378
+ else throw new Error(`Method "${method}" not found in controller instance "${ControllerType.name}"`);
379
+ } else throw new Error(`Invalid controller type for route: ${route.path}`);
380
+ } else throw new Error(`Invalid handler format for route: ${route.path}`);
381
+ return {
382
+ handlerFunction,
383
+ instance
384
+ };
385
+ }
386
+ static bindRequestToInstance(ctx, instance, route, payload) {
387
+ if (!instance) return;
388
+ instance.ctx = ctx;
389
+ instance.body = payload.body;
390
+ instance.query = payload.query;
391
+ instance.params = payload.params;
392
+ instance.clearRequest = new ClearRequest({
393
+ ctx,
394
+ route,
395
+ body: instance.body,
396
+ query: instance.query,
397
+ params: instance.params
398
+ });
399
+ }
400
+ };
401
+
61
402
  //#endregion
62
403
  exports.ClearRequest = ClearRequest;
63
404
  exports.Controller = Controller;
405
+ exports.CoreRouter = CoreRouter;
64
406
  exports.Route = Route;
package/dist/index.d.cts CHANGED
@@ -1,41 +1,32 @@
1
1
  import { NextFunction, Request, Response as Response$1 } from "express";
2
- import { H3Event, Middleware as Middleware$1 } from "h3";
2
+ import { Middleware as Middleware$1 } from "h3";
3
+ import { AsyncLocalStorage } from "node:async_hooks";
3
4
 
4
- //#region types/h3.d.ts
5
- /**
6
- * HTTP context passed to route handlers
7
- */
8
- type HttpContext = H3Event & {};
9
- /**
10
- * Route handler function type
11
- */
12
- type RouteHandler = (
13
- /**
14
- * H3 event context
15
- */
16
- ctx: HttpContext,
17
- /**
18
- * ClearRequest instance
19
- */
20
- req: ClearRequest) => any | Promise<any>;
21
- /**
22
- * Handler can be either a function or controller reference
23
- */
24
- type Handler = RouteHandler | ControllerHandler;
25
- //#endregion
26
5
  //#region types/basic.d.ts
27
- /**
28
- * Controller method reference
29
- */
30
- type ControllerHandler = [any, string];
31
6
  /**
32
7
  * HTTP methods supported by the router
33
8
  */
34
9
  type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head';
10
+ /**
11
+ * Common controller action names
12
+ */
13
+ type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
35
14
  /**
36
15
  * Generic Object type for request data
37
16
  */
38
17
  type RequestData = Record<string, any>;
18
+ type ApiResourceMiddleware<M extends Middleware | Middleware$1> = M | M[] | { [K in ControllerAction]?: M | M[] };
19
+ interface RouterConfig {
20
+ /**
21
+ * Configuration for method override functionality, allowing clients to use a
22
+ * specific header or body parameter to override the HTTP method.
23
+ */
24
+ methodOverride?: {
25
+ /** Whether method override is enabled */enabled?: boolean; /** Keys in the request body to check for method override */
26
+ bodyKeys?: string[] | string; /** Keys in the request headers to check for method override */
27
+ headerKeys?: string[] | string;
28
+ };
29
+ }
39
30
  //#endregion
40
31
  //#region types/express.d.ts
41
32
  /**
@@ -44,7 +35,7 @@ type RequestData = Record<string, any>;
44
35
  type Middleware = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
45
36
  //#endregion
46
37
  //#region src/Route.d.ts
47
- declare class Route<X = any, M = Middleware$1 | Middleware> {
38
+ declare class Route<X = any, M = Middleware$1 | Middleware, H = any> {
48
39
  ctx: X;
49
40
  body: RequestData;
50
41
  query: RequestData;
@@ -52,13 +43,13 @@ declare class Route<X = any, M = Middleware$1 | Middleware> {
52
43
  clearRequest: ClearRequest;
53
44
  methods: HttpMethod[];
54
45
  path: string;
55
- handler: Handler;
46
+ handler: H;
56
47
  middlewares: M[];
57
48
  controllerName?: string;
58
49
  actionName?: string;
59
50
  handlerType: 'function' | 'controller';
60
51
  middlewareCount: number;
61
- constructor(methods: HttpMethod[], path: string, handler: Handler, middlewares?: M[]);
52
+ constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[]);
62
53
  }
63
54
  //#endregion
64
55
  //#region src/ClearRequest.d.ts
@@ -90,4 +81,166 @@ declare abstract class Controller<X = any> {
90
81
  clearRequest: ClearRequest;
91
82
  }
92
83
  //#endregion
93
- export { ClearRequest, Controller, Route };
84
+ //#region src/core/router.d.ts
85
+ /**
86
+ * @class clear-router CoreRouter
87
+ * @description Core routing logic for clear-router, shared between all supported adapters (Express.js, H3, etc.)
88
+ * @author 3m1n3nc3
89
+ * @repository https://github.com/toneflix/clear-router
90
+ */
91
+ declare abstract class CoreRouter {
92
+ static config: RouterConfig;
93
+ protected static groupContext: AsyncLocalStorage<{
94
+ prefix: string;
95
+ groupMiddlewares: any[];
96
+ }>;
97
+ static routes: Array<Route<any, any, any>>;
98
+ static routesByPathMethod: Record<string, Route<any, any, any>>;
99
+ static routesByMethod: { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
100
+ static prefix: string;
101
+ static groupMiddlewares: any[];
102
+ static globalMiddlewares: any[];
103
+ protected static ensureState(this: any): void;
104
+ /**
105
+ * Normalizes a path by ensuring it starts with a single slash and does not have trailing
106
+ * slashes, while preserving dynamic segments and parameters.
107
+ *
108
+ * @param path The path to normalize.
109
+ * @returns The normalized path.
110
+ */
111
+ static normalizePath(path: string): string;
112
+ /**
113
+ * Configures the router with the given options, such as method override settings.
114
+ *
115
+ * @param this
116
+ * @param options
117
+ * @returns
118
+ */
119
+ static configure(this: any, options?: RouterConfig): void;
120
+ protected static resolveMethodOverride(this: any, method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
121
+ /**
122
+ * Adds a new route to the router with the specified methods, path, handler, and middlewares.
123
+ *
124
+ * @param this
125
+ * @param methods
126
+ * @param path
127
+ * @param handler
128
+ * @param middlewares
129
+ */
130
+ static add(this: any, methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
131
+ /**
132
+ * Adds a new API resource route to the router for the specified base path and controller, with
133
+ * options to include/exclude specific actions and apply middlewares.
134
+ *
135
+ * @param this
136
+ * @param basePath
137
+ * @param controller
138
+ * @param options
139
+ */
140
+ static apiResource(this: any, basePath: string, controller: any, options?: {
141
+ only?: ControllerAction[];
142
+ except?: ControllerAction[];
143
+ middlewares?: ApiResourceMiddleware<any>;
144
+ }): void;
145
+ /**
146
+ * Adds a new GET route to the router with the specified path, handler, and optional middlewares.
147
+ *
148
+ * @param this The router instance.
149
+ * @param path The path for the GET route.
150
+ * @param handler The handler function for the GET route.
151
+ * @param middlewares Optional middlewares to apply to the GET route.
152
+ */
153
+ static get(this: any, path: string, handler: any, middlewares?: any[] | any): void;
154
+ /**
155
+ * Adds a new POST route to the router with the specified path, handler, and optional middlewares.
156
+ *
157
+ * @param this
158
+ * @param path
159
+ * @param handler
160
+ * @param middlewares
161
+ */
162
+ static post(this: any, path: string, handler: any, middlewares?: any[] | any): void;
163
+ /**
164
+ * Adds a new PUT route to the router with the specified path, handler, and optional middlewares.
165
+ *
166
+ * @param this
167
+ * @param path
168
+ * @param handler
169
+ * @param middlewares
170
+ */
171
+ static put(this: any, path: string, handler: any, middlewares?: any[] | any): void;
172
+ /**
173
+ * Adds a new DELETE route to the router with the specified path, handler, and optional middlewares.
174
+ *
175
+ * @param this
176
+ * @param path
177
+ * @param handler
178
+ * @param middlewares
179
+ */
180
+ static delete(this: any, path: string, handler: any, middlewares?: any[] | any): void;
181
+ /**
182
+ * Adds a new PATCH route to the router with the specified path, handler, and optional middlewares.
183
+ *
184
+ * @param this
185
+ * @param path
186
+ * @param handler
187
+ * @param middlewares
188
+ */
189
+ static patch(this: any, path: string, handler: any, middlewares?: any[] | any): void;
190
+ /**
191
+ * Adds a new OPTIONS route to the router with the specified path, handler, and optional middlewares.
192
+ *
193
+ * @param this
194
+ * @param path
195
+ * @param handler
196
+ * @param middlewares
197
+ */
198
+ static options(this: any, path: string, handler: any, middlewares?: any[] | any): void;
199
+ /**
200
+ * Adds a new HEAD route to the router with the specified path, handler, and optional middlewares.
201
+ *
202
+ * @param this
203
+ * @param path
204
+ * @param handler
205
+ * @param middlewares
206
+ */
207
+ static head(this: any, path: string, handler: any, middlewares?: any[] | any): void;
208
+ /**
209
+ * Defines a group of routes with a common prefix and optional middlewares, allowing for better
210
+ * organization and reuse of route configurations.
211
+ *
212
+ * @param this
213
+ * @param prefix
214
+ * @param callback
215
+ * @param middlewares
216
+ */
217
+ static group(this: any, prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
218
+ /**
219
+ * Adds global middlewares to the router, which will be applied to all routes.
220
+ *
221
+ * @param this
222
+ * @param middlewares
223
+ * @param callback
224
+ */
225
+ static middleware(this: any, middlewares: any[], callback: () => void): void;
226
+ /**
227
+ * Retrieves all registered routes in the router, optionally organized by path or method
228
+ * for easier access and management.
229
+ *
230
+ * @param this
231
+ */
232
+ static allRoutes(this: any): Array<Route<any, any, any>>;
233
+ static allRoutes(this: any, type: 'path'): Record<string, Route<any, any, any>>;
234
+ static allRoutes(this: any, type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
235
+ protected static resolveHandler(route: Route<any, any, any>): {
236
+ handlerFunction: ((ctx: any, req: ClearRequest) => any | Promise<any>) | null;
237
+ instance: Controller<any> | null;
238
+ };
239
+ protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
240
+ body: Record<string, any>;
241
+ query: Record<string, any>;
242
+ params: Record<string, any>;
243
+ }): void;
244
+ }
245
+ //#endregion
246
+ export { ClearRequest, Controller, CoreRouter, Route };