clear-router 2.5.12 → 2.5.14

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.
Files changed (45) hide show
  1. package/README.md +2 -0
  2. package/dist/{bindings-CDGLuAq4.cjs → bindings-CLsZjOEy.cjs} +8 -1
  3. package/dist/{bindings-B6x2HfzP.mjs → bindings-XLDXFpHZ.mjs} +8 -1
  4. package/dist/core/index.cjs +2 -2
  5. package/dist/core/index.d.cts +1 -1
  6. package/dist/core/index.d.mts +1 -1
  7. package/dist/core/index.mjs +2 -2
  8. package/dist/decorators/index.cjs +1 -1
  9. package/dist/decorators/index.mjs +1 -1
  10. package/dist/decorators/setup.cjs +2 -2
  11. package/dist/decorators/setup.d.mts +0 -1
  12. package/dist/decorators/setup.mjs +2 -2
  13. package/dist/express/index.cjs +16 -13
  14. package/dist/express/index.d.cts +11 -9
  15. package/dist/express/index.d.mts +11 -9
  16. package/dist/express/index.mjs +16 -13
  17. package/dist/fastify/index.cjs +18 -15
  18. package/dist/fastify/index.d.cts +11 -9
  19. package/dist/fastify/index.d.mts +11 -9
  20. package/dist/fastify/index.mjs +18 -15
  21. package/dist/h3/index.cjs +16 -13
  22. package/dist/h3/index.d.cts +11 -9
  23. package/dist/h3/index.d.mts +11 -9
  24. package/dist/h3/index.mjs +16 -13
  25. package/dist/hono/index.cjs +16 -13
  26. package/dist/hono/index.d.cts +11 -9
  27. package/dist/hono/index.d.mts +11 -9
  28. package/dist/hono/index.mjs +16 -13
  29. package/dist/index.cjs +114 -13
  30. package/dist/index.d.cts +54 -25
  31. package/dist/index.d.mts +54 -25
  32. package/dist/index.mjs +114 -13
  33. package/dist/koa/index.cjs +16 -13
  34. package/dist/koa/index.d.cts +11 -9
  35. package/dist/koa/index.d.mts +11 -9
  36. package/dist/koa/index.mjs +16 -13
  37. package/dist/{responses-DuZeRyGE.mjs → responses-BvETUeDL.mjs} +1 -1
  38. package/dist/{responses-CBP3RYjJ.cjs → responses-Bvnk0uvc.cjs} +1 -1
  39. package/dist/{router-91xVPlV0.d.mts → router-Bk8mXRu1.d.mts} +53 -24
  40. package/dist/{router-DPJfzvy5.cjs → router-CAnd539U.cjs} +107 -13
  41. package/dist/{router-BkJMl4xv.mjs → router-DSq9dtuQ.mjs} +107 -13
  42. package/dist/{router-35iBbCaF.d.cts → router-jwZwD8ZT.d.cts} +53 -24
  43. package/dist/types/Route.d.mts +16 -1
  44. package/dist/types/core/Response.d.mts +3 -1
  45. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -41,8 +41,10 @@ declare class Response$1 {
41
41
  headers: Headers;
42
42
  sent: boolean;
43
43
  statusCode: number;
44
- constructor(init?: Partial<Response$1>);
44
+ statusText: string;
45
+ constructor(init?: Partial<Response$1 | globalThis.Response>);
45
46
  status(code: number): this;
47
+ setStatusText(text: string): this;
46
48
  code(code: number): this;
47
49
  setHeader(name: string, value: string): this;
48
50
  header(name: string, value: string): this;
@@ -56,6 +58,11 @@ declare class Response$1 {
56
58
  }
57
59
  //#endregion
58
60
  //#region src/Route.d.ts
61
+ interface RouteParameter {
62
+ name: string;
63
+ field?: string;
64
+ optional: boolean;
65
+ }
59
66
  declare class Route<X = any, M = Middleware$1 | Middleware, H = any> {
60
67
  ctx: X;
61
68
  body: RequestData;
@@ -64,13 +71,23 @@ declare class Route<X = any, M = Middleware$1 | Middleware, H = any> {
64
71
  clearRequest: ClearRequest;
65
72
  methods: HttpMethod[];
66
73
  path: string;
74
+ registrationPaths: string[];
75
+ parameters: RouteParameter[];
76
+ routeName?: string;
67
77
  handler: H;
68
78
  middlewares: M[];
69
79
  controllerName?: string;
70
80
  actionName?: string;
71
81
  handlerType: 'function' | 'controller';
72
82
  middlewareCount: number;
73
- constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[]);
83
+ constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[], options?: {
84
+ registrationPaths?: string[];
85
+ parameters?: RouteParameter[];
86
+ onName?: (name: string, route: Route<X, M, H>, previousName?: string) => void;
87
+ });
88
+ private onName?;
89
+ name(name: string): this;
90
+ toPath(params?: RequestData): string;
74
91
  }
75
92
  //#endregion
76
93
  //#region src/core/Request.d.ts
@@ -206,7 +223,7 @@ declare abstract class CoreRouter {
206
223
  protected static createBaseConfig(): RouterConfig;
207
224
  protected static mergeConfig(target: RouterConfig, source?: RouterConfig): RouterConfig;
208
225
  protected static getDefaultConfig(): RouterConfig;
209
- protected static resolveStateNamespace(this: any): string;
226
+ protected static resolveStateNamespace(): string;
210
227
  protected static getStateStore(): Record<string, any>;
211
228
  protected static getPluginStore(): Set<string>;
212
229
  protected static getPluginPendingStore(): Set<Promise<void>>;
@@ -220,14 +237,15 @@ declare abstract class CoreRouter {
220
237
  routes: Array<Route<any, any, any>>;
221
238
  routesByPathMethod: Record<string, Route<any, any, any>>;
222
239
  routesByMethod: { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
240
+ routesByName: Record<string, Route<any, any, any>>;
223
241
  prefix: string;
224
242
  groupMiddlewares: any[];
225
243
  globalMiddlewares: any[];
226
244
  };
227
- protected static bindStateAccessors(this: any): void;
245
+ protected static bindStateAccessors(): void;
228
246
  protected static createDefaultOptionsHandler(): any;
229
247
  static config: RouterConfig;
230
- static configureDefaults(this: any, options?: RouterConfig): void;
248
+ static configureDefaults(options?: RouterConfig): void;
231
249
  /**
232
250
  * Use a registered plugin
233
251
  *
@@ -236,8 +254,8 @@ declare abstract class CoreRouter {
236
254
  * @param options
237
255
  * @returns
238
256
  */
239
- static use<Options = any>(this: any, plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
240
- protected static pluginsReady(this: any): Promise<void>;
257
+ static use<Options = any>(plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
258
+ protected static pluginsReady(): Promise<void>;
241
259
  protected static groupContext: AsyncLocalStorage<{
242
260
  prefix: string;
243
261
  groupMiddlewares: any[];
@@ -246,6 +264,7 @@ declare abstract class CoreRouter {
246
264
  static routes: Array<Route<any, any, any>>;
247
265
  static routesByPathMethod: Record<string, Route<any, any, any>>;
248
266
  static routesByMethod: { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
267
+ static routesByName: Record<string, Route<any, any, any>>;
249
268
  static prefix: string;
250
269
  static groupMiddlewares: any[];
251
270
  static globalMiddlewares: any[];
@@ -253,7 +272,7 @@ declare abstract class CoreRouter {
253
272
  protected static createPluginRequestContext(ctx: any): ClearRouterPluginRequestContext;
254
273
  protected static createPluginBind(): PluginBind;
255
274
  protected static resolvePluginArguments(this: any, ctx: any, routeContext: Omit<ClearRouterPluginArgumentsContext, keyof ClearRouterPluginRequestContext>): Promise<any[] | undefined>;
256
- protected static ensureState(this: any): void;
275
+ protected static ensureState(): void;
257
276
  /**
258
277
  * Normalizes a path by ensuring it starts with a single slash and does not have trailing
259
278
  * slashes, while preserving dynamic segments and parameters.
@@ -262,6 +281,13 @@ declare abstract class CoreRouter {
262
281
  * @returns The normalized path.
263
282
  */
264
283
  static normalizePath(path: string): string;
284
+ protected static parseRouteParameters(path: string): Array<{
285
+ name: string;
286
+ field?: string;
287
+ optional: boolean;
288
+ }>;
289
+ protected static expandRoutePath(path: string): string[];
290
+ protected static routeRegistrationPaths(path: string): string[];
265
291
  /**
266
292
  * Configures the router with the given options, such as method override settings.
267
293
  *
@@ -270,7 +296,7 @@ declare abstract class CoreRouter {
270
296
  * @returns
271
297
  */
272
298
  static configure(this: any, options?: RouterConfig): void;
273
- protected static resolveMethodOverride(this: any, method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
299
+ protected static resolveMethodOverride(method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
274
300
  /**
275
301
  * Adds a new route to the router.
276
302
  *
@@ -280,7 +306,7 @@ declare abstract class CoreRouter {
280
306
  * @param handler
281
307
  * @param middlewares
282
308
  */
283
- static add(this: any, methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
309
+ static add(methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
284
310
  /**
285
311
  * Define a resourceful API controller with standard CRUD routes.
286
312
  *
@@ -289,7 +315,7 @@ declare abstract class CoreRouter {
289
315
  * @param controller
290
316
  * @param options
291
317
  */
292
- static apiResource(this: any, basePath: string, controller: any, options?: {
318
+ static apiResource(basePath: string, controller: any, options?: {
293
319
  only?: ControllerAction[];
294
320
  except?: ControllerAction[];
295
321
  middlewares?: ApiResourceMiddleware<any>;
@@ -302,7 +328,7 @@ declare abstract class CoreRouter {
302
328
  * @param handler The handler function for the GET route.
303
329
  * @param middlewares Optional middlewares to apply to the GET route.
304
330
  */
305
- static get(this: any, path: string, handler: any, middlewares?: any[] | any): void;
331
+ static get(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
306
332
  /**
307
333
  * Adds a new POST route to the router.
308
334
  *
@@ -311,7 +337,7 @@ declare abstract class CoreRouter {
311
337
  * @param handler
312
338
  * @param middlewares
313
339
  */
314
- static post(this: any, path: string, handler: any, middlewares?: any[] | any): void;
340
+ static post(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
315
341
  /**
316
342
  * Adds a new PUT route to the router.
317
343
  *
@@ -320,7 +346,7 @@ declare abstract class CoreRouter {
320
346
  * @param handler
321
347
  * @param middlewares
322
348
  */
323
- static put(this: any, path: string, handler: any, middlewares?: any[] | any): void;
349
+ static put(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
324
350
  /**
325
351
  * Adds a new DELETE route to the router.
326
352
  *
@@ -329,7 +355,7 @@ declare abstract class CoreRouter {
329
355
  * @param handler
330
356
  * @param middlewares
331
357
  */
332
- static delete(this: any, path: string, handler: any, middlewares?: any[] | any): void;
358
+ static delete(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
333
359
  /**
334
360
  * Adds a new PATCH route to the router.
335
361
  *
@@ -338,7 +364,7 @@ declare abstract class CoreRouter {
338
364
  * @param handler
339
365
  * @param middlewares
340
366
  */
341
- static patch(this: any, path: string, handler: any, middlewares?: any[] | any): void;
367
+ static patch(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
342
368
  /**
343
369
  * Adds a new OPTIONS route to the router.
344
370
  *
@@ -347,7 +373,7 @@ declare abstract class CoreRouter {
347
373
  * @param handler
348
374
  * @param middlewares
349
375
  */
350
- static options(this: any, path: string, handler: any, middlewares?: any[] | any): void;
376
+ static options(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
351
377
  /**
352
378
  * Adds a new HEAD route to the router.
353
379
  *
@@ -356,7 +382,7 @@ declare abstract class CoreRouter {
356
382
  * @param handler
357
383
  * @param middlewares
358
384
  */
359
- static head(this: any, path: string, handler: any, middlewares?: any[] | any): void;
385
+ static head(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
360
386
  /**
361
387
  * Defines a group of routes with a common prefix.
362
388
  *
@@ -365,7 +391,7 @@ declare abstract class CoreRouter {
365
391
  * @param callback
366
392
  * @param middlewares
367
393
  */
368
- static group(this: any, prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
394
+ static group(prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
369
395
  /**
370
396
  * Adds global middlewares to the router, which will be applied to all routes.
371
397
  *
@@ -373,24 +399,27 @@ declare abstract class CoreRouter {
373
399
  * @param middlewares
374
400
  * @param callback
375
401
  */
376
- static middleware(this: any, middlewares: any[], callback: () => void): void;
402
+ static middleware(middlewares: any[], callback: () => void): void;
377
403
  /**
378
404
  * Retrieves all registered routes in the router, optionally organized by path or method
379
405
  * for easier access and management.
380
406
  *
381
407
  * @param this
382
408
  */
383
- static allRoutes(this: any): Array<Route<any, any, any>>;
409
+ static allRoutes(): Array<Route<any, any, any>>;
384
410
  /**
385
411
  * @param this
386
412
  * @param type - 'path' to get routes organized by path
387
413
  */
388
- static allRoutes(this: any, type: 'path'): Record<string, Route<any, any, any>>;
414
+ static allRoutes(type: 'path'): Record<string, Route<any, any, any>>;
389
415
  /**
390
416
  * @param this
391
417
  * @param type - 'method' to get routes organized by method
392
418
  */
393
- static allRoutes(this: any, type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
419
+ static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
420
+ static allRoutes(type: 'name'): Record<string, Route<any, any, any>>;
421
+ static route(name: string): Route<any, any, any> | undefined;
422
+ static url(name: string, params?: Record<string, any>): string | undefined;
394
423
  protected static resolveHandler(route: Route<any, any, any>): {
395
424
  handlerFunction: ((ctx: any, req: Request) => any | Promise<any>) | null;
396
425
  instance: Controller<any> | null;
@@ -399,7 +428,7 @@ declare abstract class CoreRouter {
399
428
  bindingHandler?: object;
400
429
  bindingMetadata?: object;
401
430
  };
402
- protected static callHandler(this: any, handlerFunction: (ctx: any, req: Request) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
431
+ protected static callHandler(handlerFunction: (ctx: any, req: Request) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
403
432
  protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
404
433
  body: Record<string, any>;
405
434
  query: Record<string, any>;
@@ -408,4 +437,4 @@ declare abstract class CoreRouter {
408
437
  }): void;
409
438
  }
410
439
  //#endregion
411
- export { ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, definePlugin };
440
+ export { ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, RouteParameter, definePlugin };
package/dist/index.d.mts CHANGED
@@ -41,8 +41,10 @@ declare class Response$1 {
41
41
  headers: Headers;
42
42
  sent: boolean;
43
43
  statusCode: number;
44
- constructor(init?: Partial<Response$1>);
44
+ statusText: string;
45
+ constructor(init?: Partial<Response$1 | globalThis.Response>);
45
46
  status(code: number): this;
47
+ setStatusText(text: string): this;
46
48
  code(code: number): this;
47
49
  setHeader(name: string, value: string): this;
48
50
  header(name: string, value: string): this;
@@ -56,6 +58,11 @@ declare class Response$1 {
56
58
  }
57
59
  //#endregion
58
60
  //#region src/Route.d.ts
61
+ interface RouteParameter {
62
+ name: string;
63
+ field?: string;
64
+ optional: boolean;
65
+ }
59
66
  declare class Route<X = any, M = Middleware$1 | Middleware, H = any> {
60
67
  ctx: X;
61
68
  body: RequestData;
@@ -64,13 +71,23 @@ declare class Route<X = any, M = Middleware$1 | Middleware, H = any> {
64
71
  clearRequest: ClearRequest;
65
72
  methods: HttpMethod[];
66
73
  path: string;
74
+ registrationPaths: string[];
75
+ parameters: RouteParameter[];
76
+ routeName?: string;
67
77
  handler: H;
68
78
  middlewares: M[];
69
79
  controllerName?: string;
70
80
  actionName?: string;
71
81
  handlerType: 'function' | 'controller';
72
82
  middlewareCount: number;
73
- constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[]);
83
+ constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[], options?: {
84
+ registrationPaths?: string[];
85
+ parameters?: RouteParameter[];
86
+ onName?: (name: string, route: Route<X, M, H>, previousName?: string) => void;
87
+ });
88
+ private onName?;
89
+ name(name: string): this;
90
+ toPath(params?: RequestData): string;
74
91
  }
75
92
  //#endregion
76
93
  //#region src/core/Request.d.ts
@@ -206,7 +223,7 @@ declare abstract class CoreRouter {
206
223
  protected static createBaseConfig(): RouterConfig;
207
224
  protected static mergeConfig(target: RouterConfig, source?: RouterConfig): RouterConfig;
208
225
  protected static getDefaultConfig(): RouterConfig;
209
- protected static resolveStateNamespace(this: any): string;
226
+ protected static resolveStateNamespace(): string;
210
227
  protected static getStateStore(): Record<string, any>;
211
228
  protected static getPluginStore(): Set<string>;
212
229
  protected static getPluginPendingStore(): Set<Promise<void>>;
@@ -220,14 +237,15 @@ declare abstract class CoreRouter {
220
237
  routes: Array<Route<any, any, any>>;
221
238
  routesByPathMethod: Record<string, Route<any, any, any>>;
222
239
  routesByMethod: { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
240
+ routesByName: Record<string, Route<any, any, any>>;
223
241
  prefix: string;
224
242
  groupMiddlewares: any[];
225
243
  globalMiddlewares: any[];
226
244
  };
227
- protected static bindStateAccessors(this: any): void;
245
+ protected static bindStateAccessors(): void;
228
246
  protected static createDefaultOptionsHandler(): any;
229
247
  static config: RouterConfig;
230
- static configureDefaults(this: any, options?: RouterConfig): void;
248
+ static configureDefaults(options?: RouterConfig): void;
231
249
  /**
232
250
  * Use a registered plugin
233
251
  *
@@ -236,8 +254,8 @@ declare abstract class CoreRouter {
236
254
  * @param options
237
255
  * @returns
238
256
  */
239
- static use<Options = any>(this: any, plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
240
- protected static pluginsReady(this: any): Promise<void>;
257
+ static use<Options = any>(plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
258
+ protected static pluginsReady(): Promise<void>;
241
259
  protected static groupContext: AsyncLocalStorage<{
242
260
  prefix: string;
243
261
  groupMiddlewares: any[];
@@ -246,6 +264,7 @@ declare abstract class CoreRouter {
246
264
  static routes: Array<Route<any, any, any>>;
247
265
  static routesByPathMethod: Record<string, Route<any, any, any>>;
248
266
  static routesByMethod: { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
267
+ static routesByName: Record<string, Route<any, any, any>>;
249
268
  static prefix: string;
250
269
  static groupMiddlewares: any[];
251
270
  static globalMiddlewares: any[];
@@ -253,7 +272,7 @@ declare abstract class CoreRouter {
253
272
  protected static createPluginRequestContext(ctx: any): ClearRouterPluginRequestContext;
254
273
  protected static createPluginBind(): PluginBind;
255
274
  protected static resolvePluginArguments(this: any, ctx: any, routeContext: Omit<ClearRouterPluginArgumentsContext, keyof ClearRouterPluginRequestContext>): Promise<any[] | undefined>;
256
- protected static ensureState(this: any): void;
275
+ protected static ensureState(): void;
257
276
  /**
258
277
  * Normalizes a path by ensuring it starts with a single slash and does not have trailing
259
278
  * slashes, while preserving dynamic segments and parameters.
@@ -262,6 +281,13 @@ declare abstract class CoreRouter {
262
281
  * @returns The normalized path.
263
282
  */
264
283
  static normalizePath(path: string): string;
284
+ protected static parseRouteParameters(path: string): Array<{
285
+ name: string;
286
+ field?: string;
287
+ optional: boolean;
288
+ }>;
289
+ protected static expandRoutePath(path: string): string[];
290
+ protected static routeRegistrationPaths(path: string): string[];
265
291
  /**
266
292
  * Configures the router with the given options, such as method override settings.
267
293
  *
@@ -270,7 +296,7 @@ declare abstract class CoreRouter {
270
296
  * @returns
271
297
  */
272
298
  static configure(this: any, options?: RouterConfig): void;
273
- protected static resolveMethodOverride(this: any, method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
299
+ protected static resolveMethodOverride(method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
274
300
  /**
275
301
  * Adds a new route to the router.
276
302
  *
@@ -280,7 +306,7 @@ declare abstract class CoreRouter {
280
306
  * @param handler
281
307
  * @param middlewares
282
308
  */
283
- static add(this: any, methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
309
+ static add(methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
284
310
  /**
285
311
  * Define a resourceful API controller with standard CRUD routes.
286
312
  *
@@ -289,7 +315,7 @@ declare abstract class CoreRouter {
289
315
  * @param controller
290
316
  * @param options
291
317
  */
292
- static apiResource(this: any, basePath: string, controller: any, options?: {
318
+ static apiResource(basePath: string, controller: any, options?: {
293
319
  only?: ControllerAction[];
294
320
  except?: ControllerAction[];
295
321
  middlewares?: ApiResourceMiddleware<any>;
@@ -302,7 +328,7 @@ declare abstract class CoreRouter {
302
328
  * @param handler The handler function for the GET route.
303
329
  * @param middlewares Optional middlewares to apply to the GET route.
304
330
  */
305
- static get(this: any, path: string, handler: any, middlewares?: any[] | any): void;
331
+ static get(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
306
332
  /**
307
333
  * Adds a new POST route to the router.
308
334
  *
@@ -311,7 +337,7 @@ declare abstract class CoreRouter {
311
337
  * @param handler
312
338
  * @param middlewares
313
339
  */
314
- static post(this: any, path: string, handler: any, middlewares?: any[] | any): void;
340
+ static post(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
315
341
  /**
316
342
  * Adds a new PUT route to the router.
317
343
  *
@@ -320,7 +346,7 @@ declare abstract class CoreRouter {
320
346
  * @param handler
321
347
  * @param middlewares
322
348
  */
323
- static put(this: any, path: string, handler: any, middlewares?: any[] | any): void;
349
+ static put(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
324
350
  /**
325
351
  * Adds a new DELETE route to the router.
326
352
  *
@@ -329,7 +355,7 @@ declare abstract class CoreRouter {
329
355
  * @param handler
330
356
  * @param middlewares
331
357
  */
332
- static delete(this: any, path: string, handler: any, middlewares?: any[] | any): void;
358
+ static delete(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
333
359
  /**
334
360
  * Adds a new PATCH route to the router.
335
361
  *
@@ -338,7 +364,7 @@ declare abstract class CoreRouter {
338
364
  * @param handler
339
365
  * @param middlewares
340
366
  */
341
- static patch(this: any, path: string, handler: any, middlewares?: any[] | any): void;
367
+ static patch(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
342
368
  /**
343
369
  * Adds a new OPTIONS route to the router.
344
370
  *
@@ -347,7 +373,7 @@ declare abstract class CoreRouter {
347
373
  * @param handler
348
374
  * @param middlewares
349
375
  */
350
- static options(this: any, path: string, handler: any, middlewares?: any[] | any): void;
376
+ static options(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
351
377
  /**
352
378
  * Adds a new HEAD route to the router.
353
379
  *
@@ -356,7 +382,7 @@ declare abstract class CoreRouter {
356
382
  * @param handler
357
383
  * @param middlewares
358
384
  */
359
- static head(this: any, path: string, handler: any, middlewares?: any[] | any): void;
385
+ static head(path: string, handler: any, middlewares?: any[] | any): Route<any, any, any>;
360
386
  /**
361
387
  * Defines a group of routes with a common prefix.
362
388
  *
@@ -365,7 +391,7 @@ declare abstract class CoreRouter {
365
391
  * @param callback
366
392
  * @param middlewares
367
393
  */
368
- static group(this: any, prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
394
+ static group(prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
369
395
  /**
370
396
  * Adds global middlewares to the router, which will be applied to all routes.
371
397
  *
@@ -373,24 +399,27 @@ declare abstract class CoreRouter {
373
399
  * @param middlewares
374
400
  * @param callback
375
401
  */
376
- static middleware(this: any, middlewares: any[], callback: () => void): void;
402
+ static middleware(middlewares: any[], callback: () => void): void;
377
403
  /**
378
404
  * Retrieves all registered routes in the router, optionally organized by path or method
379
405
  * for easier access and management.
380
406
  *
381
407
  * @param this
382
408
  */
383
- static allRoutes(this: any): Array<Route<any, any, any>>;
409
+ static allRoutes(): Array<Route<any, any, any>>;
384
410
  /**
385
411
  * @param this
386
412
  * @param type - 'path' to get routes organized by path
387
413
  */
388
- static allRoutes(this: any, type: 'path'): Record<string, Route<any, any, any>>;
414
+ static allRoutes(type: 'path'): Record<string, Route<any, any, any>>;
389
415
  /**
390
416
  * @param this
391
417
  * @param type - 'method' to get routes organized by method
392
418
  */
393
- static allRoutes(this: any, type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
419
+ static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
420
+ static allRoutes(type: 'name'): Record<string, Route<any, any, any>>;
421
+ static route(name: string): Route<any, any, any> | undefined;
422
+ static url(name: string, params?: Record<string, any>): string | undefined;
394
423
  protected static resolveHandler(route: Route<any, any, any>): {
395
424
  handlerFunction: ((ctx: any, req: Request) => any | Promise<any>) | null;
396
425
  instance: Controller<any> | null;
@@ -399,7 +428,7 @@ declare abstract class CoreRouter {
399
428
  bindingHandler?: object;
400
429
  bindingMetadata?: object;
401
430
  };
402
- protected static callHandler(this: any, handlerFunction: (ctx: any, req: Request) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
431
+ protected static callHandler(handlerFunction: (ctx: any, req: Request) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
403
432
  protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
404
433
  body: Record<string, any>;
405
434
  query: Record<string, any>;
@@ -408,4 +437,4 @@ declare abstract class CoreRouter {
408
437
  }): void;
409
438
  }
410
439
  //#endregion
411
- export { ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, definePlugin };
440
+ export { ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, RouteParameter, definePlugin };