clear-router 2.7.2 → 2.7.4

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.
@@ -1,2 +1,2 @@
1
- import { L as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-CY1BZ3Af.cjs";
2
- export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
1
+ import { F as Response, a as ClearRouterPluginContext, c as PluginArgumentsResolver, d as PluginBindValue, f as PluginSetupResult, i as ClearRouterPluginArgumentsContext, l as PluginBind, m as Request, n as CoreRouter, o as ClearRouterPluginInput, p as definePlugin, r as ClearRouterPlugin, s as ClearRouterPluginRequestContext, t as ClearHttpContext, u as PluginBindFactory } from "../types-CWEND0si.cjs";
2
+ export { ClearHttpContext, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
@@ -1,2 +1,2 @@
1
- import { L as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-7xO6qBQZ.mjs";
2
- export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
1
+ import { F as Response, a as ClearRouterPluginContext, c as PluginArgumentsResolver, d as PluginBindValue, f as PluginSetupResult, i as ClearRouterPluginArgumentsContext, l as PluginBind, m as Request, n as CoreRouter, o as ClearRouterPluginInput, p as definePlugin, r as ClearRouterPlugin, s as ClearRouterPluginRequestContext, t as ClearHttpContext, u as PluginBindFactory } from "../types-1JoEn1DP.mjs";
2
+ export { ClearHttpContext, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
@@ -1,4 +1,4 @@
1
- import { F as ControllerAction, I as HttpMethod, M as HttpContext, N as Middleware, P as ApiResourceMiddleware, j as Handler, m as Route, t as CoreRouter } from "../router-CY1BZ3Af.cjs";
1
+ import { I as ApiResourceMiddleware, L as ControllerAction, M as Handler, N as HttpContext, P as Middleware, R as HttpMethod, h as Route, n as CoreRouter } from "../types-CWEND0si.cjs";
2
2
  import { Router as Router$1 } from "express";
3
3
 
4
4
  //#region src/express/router.d.ts
@@ -1,4 +1,4 @@
1
- import { F as ControllerAction, I as HttpMethod, M as HttpContext, N as Middleware, P as ApiResourceMiddleware, j as Handler, m as Route, t as CoreRouter } from "../router-7xO6qBQZ.mjs";
1
+ import { I as ApiResourceMiddleware, L as ControllerAction, M as Handler, N as HttpContext, P as Middleware, R as HttpMethod, h as Route, n as CoreRouter } from "../types-1JoEn1DP.mjs";
2
2
  import { Router as Router$1 } from "express";
3
3
 
4
4
  //#region src/express/router.d.ts
@@ -1,4 +1,4 @@
1
- import { A as Middleware, D as FastifyApp, F as ControllerAction, I as HttpMethod, O as Handler, P as ApiResourceMiddleware, k as HttpContext, m as Route, t as CoreRouter } from "../router-CY1BZ3Af.cjs";
1
+ import { A as HttpContext, I as ApiResourceMiddleware, L as ControllerAction, O as FastifyApp, R as HttpMethod, h as Route, j as Middleware, k as Handler, n as CoreRouter } from "../types-CWEND0si.cjs";
2
2
 
3
3
  //#region src/fastify/router.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { A as Middleware, D as FastifyApp, F as ControllerAction, I as HttpMethod, O as Handler, P as ApiResourceMiddleware, k as HttpContext, m as Route, t as CoreRouter } from "../router-7xO6qBQZ.mjs";
1
+ import { A as HttpContext, I as ApiResourceMiddleware, L as ControllerAction, O as FastifyApp, R as HttpMethod, h as Route, j as Middleware, k as Handler, n as CoreRouter } from "../types-1JoEn1DP.mjs";
2
2
 
3
3
  //#region src/fastify/router.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as H3App, E as Middleware, F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-CY1BZ3Af.cjs";
1
+ import { D as Middleware, E as HttpContext, I as ApiResourceMiddleware, L as ControllerAction, R as HttpMethod, T as Handler, h as Route, n as CoreRouter, w as H3App } from "../types-CWEND0si.cjs";
2
2
  import { H3 } from "h3";
3
3
 
4
4
  //#region src/h3/router.d.ts
@@ -1,4 +1,4 @@
1
- import { C as H3App, E as Middleware, F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-7xO6qBQZ.mjs";
1
+ import { D as Middleware, E as HttpContext, I as ApiResourceMiddleware, L as ControllerAction, R as HttpMethod, T as Handler, h as Route, n as CoreRouter, w as H3App } from "../types-1JoEn1DP.mjs";
2
2
  import { H3 } from "h3";
3
3
 
4
4
  //#region src/h3/router.d.ts
@@ -1,4 +1,4 @@
1
- import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-CY1BZ3Af.cjs";
1
+ import { C as Middleware, I as ApiResourceMiddleware, L as ControllerAction, R as HttpMethod, S as HttpContext, b as Handler, h as Route, n as CoreRouter, x as HonoApp } from "../types-CWEND0si.cjs";
2
2
 
3
3
  //#region src/hono/router.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-7xO6qBQZ.mjs";
1
+ import { C as Middleware, I as ApiResourceMiddleware, L as ControllerAction, R as HttpMethod, S as HttpContext, b as Handler, h as Route, n as CoreRouter, x as HonoApp } from "../types-1JoEn1DP.mjs";
2
2
 
3
3
  //#region src/hono/router.d.ts
4
4
  /**
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { NextFunction, Request as Request$1, Response as Response$2 } from "express";
2
2
  import { Middleware as Middleware$4 } from "h3";
3
+ import { AsyncLocalStorage } from "node:async_hooks";
3
4
  import { FastifyReply, FastifyRequest } from "fastify";
4
5
  import { MiddlewareHandler } from "hono";
5
6
  import Koa from "koa";
6
- import { AsyncLocalStorage } from "node:async_hooks";
7
7
 
8
- //#region types/basic.d.ts
8
+ //#region src/types/basic.d.ts
9
9
  /**
10
10
  * HTTP methods supported by the router
11
11
  */
@@ -119,54 +119,6 @@ declare class Request<X = any, M = any> extends ClearRequest<X, M> {
119
119
  is(method: HttpMethod | string): boolean;
120
120
  }
121
121
  //#endregion
122
- //#region types/express.d.ts
123
- /**
124
- * Middleware function type
125
- */
126
- type Middleware$3 = (req: Request$1, res: Response$2, next: NextFunction) => any | Promise<any>;
127
- //#endregion
128
- //#region types/fastify.d.ts
129
- interface RequestWithGetBody extends FastifyRequest {
130
- getBody: () => Record<string, any>;
131
- }
132
- type NextFunction$1 = (err?: Error) => void;
133
- type Middleware$2 = (req: RequestWithGetBody, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
134
- //#endregion
135
- //#region types/hono.d.ts
136
- type Middleware$1 = MiddlewareHandler;
137
- //#endregion
138
- //#region types/koa.d.ts
139
- type Middleware = Koa.Middleware<any, any>;
140
- //#endregion
141
- //#region src/ClearRequest.d.ts
142
- declare class ClearRequest<X = any, M = Middleware$4 | Middleware$3 | Middleware$2 | Middleware$1 | Middleware> {
143
- [key: string]: any;
144
- /**
145
- * @param body - Parsed request body
146
- */
147
- body: RequestData;
148
- /**
149
- * @param query - Parsed query parameters
150
- */
151
- query: RequestData;
152
- /**
153
- * @param params - Parsed route parameters
154
- */
155
- params: RequestData;
156
- route: Route<X, M>;
157
- constructor(init?: Partial<ClearRequest>);
158
- }
159
- //#endregion
160
- //#region src/Controller.d.ts
161
- declare abstract class Controller<X = any> {
162
- [x: string]: any;
163
- ctx: X;
164
- body: RequestData;
165
- query: RequestData;
166
- params: RequestData;
167
- clearRequest: ClearRequest;
168
- }
169
- //#endregion
170
122
  //#region src/core/bindings.d.ts
171
123
  type BindToken<T = any> = abstract new (...args: any[]) => T;
172
124
  type BindFactory<T = any> = (ctx: any) => T | Promise<T>;
@@ -289,6 +241,16 @@ type ClearRouterPluginInput<Options = any, HttpContext = any> = ClearRouterPlugi
289
241
  */
290
242
  declare function definePlugin<Options = any, HttpContext = any>(plugin: ClearRouterPlugin<Options, HttpContext>): ClearRouterPlugin<Options, HttpContext>;
291
243
  //#endregion
244
+ //#region src/Controller.d.ts
245
+ declare abstract class Controller<X = any> {
246
+ [x: string]: any;
247
+ ctx: X;
248
+ body: RequestData;
249
+ query: RequestData;
250
+ params: RequestData;
251
+ clearRequest: ClearRequest;
252
+ }
253
+ //#endregion
292
254
  //#region src/core/router.d.ts
293
255
  /**
294
256
  * @class clear-router CoreRouter
@@ -554,4 +516,48 @@ declare abstract class CoreRouter {
554
516
  }): void;
555
517
  }
556
518
  //#endregion
557
- export { ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, RouteParameter, definePlugin };
519
+ //#region src/core/types.d.ts
520
+ /**
521
+ * HTTP context passed to route handlers
522
+ */
523
+ interface ClearHttpContext {}
524
+ //#endregion
525
+ //#region src/types/express.d.ts
526
+ /**
527
+ * Middleware function type
528
+ */
529
+ type Middleware$3 = (req: Request$1, res: Response$2, next: NextFunction) => any | Promise<any>;
530
+ //#endregion
531
+ //#region src/types/fastify.d.ts
532
+ interface RequestWithGetBody extends FastifyRequest {
533
+ getBody: () => Record<string, any>;
534
+ }
535
+ type NextFunction$1 = (err?: Error) => void;
536
+ type Middleware$2 = (req: RequestWithGetBody, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
537
+ //#endregion
538
+ //#region src/types/hono.d.ts
539
+ type Middleware$1 = MiddlewareHandler;
540
+ //#endregion
541
+ //#region src/types/koa.d.ts
542
+ type Middleware = Koa.Middleware<any, any>;
543
+ //#endregion
544
+ //#region src/ClearRequest.d.ts
545
+ declare class ClearRequest<X = any, M = Middleware$4 | Middleware$3 | Middleware$2 | Middleware$1 | Middleware> {
546
+ [key: string]: any;
547
+ /**
548
+ * @param body - Parsed request body
549
+ */
550
+ body: RequestData;
551
+ /**
552
+ * @param query - Parsed query parameters
553
+ */
554
+ query: RequestData;
555
+ /**
556
+ * @param params - Parsed route parameters
557
+ */
558
+ params: RequestData;
559
+ route: Route<X, M>;
560
+ constructor(init?: Partial<ClearRequest>);
561
+ }
562
+ //#endregion
563
+ export { ClearHttpContext, 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
@@ -5,7 +5,7 @@ import { FastifyReply, FastifyRequest } from "fastify";
5
5
  import { MiddlewareHandler } from "hono";
6
6
  import Koa from "koa";
7
7
 
8
- //#region types/basic.d.ts
8
+ //#region src/types/basic.d.ts
9
9
  /**
10
10
  * HTTP methods supported by the router
11
11
  */
@@ -119,54 +119,6 @@ declare class Request<X = any, M = any> extends ClearRequest<X, M> {
119
119
  is(method: HttpMethod | string): boolean;
120
120
  }
121
121
  //#endregion
122
- //#region types/express.d.ts
123
- /**
124
- * Middleware function type
125
- */
126
- type Middleware$3 = (req: Request$1, res: Response$2, next: NextFunction) => any | Promise<any>;
127
- //#endregion
128
- //#region types/fastify.d.ts
129
- interface RequestWithGetBody extends FastifyRequest {
130
- getBody: () => Record<string, any>;
131
- }
132
- type NextFunction$1 = (err?: Error) => void;
133
- type Middleware$2 = (req: RequestWithGetBody, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
134
- //#endregion
135
- //#region types/hono.d.ts
136
- type Middleware$1 = MiddlewareHandler;
137
- //#endregion
138
- //#region types/koa.d.ts
139
- type Middleware = Koa.Middleware<any, any>;
140
- //#endregion
141
- //#region src/ClearRequest.d.ts
142
- declare class ClearRequest<X = any, M = Middleware$4 | Middleware$3 | Middleware$2 | Middleware$1 | Middleware> {
143
- [key: string]: any;
144
- /**
145
- * @param body - Parsed request body
146
- */
147
- body: RequestData;
148
- /**
149
- * @param query - Parsed query parameters
150
- */
151
- query: RequestData;
152
- /**
153
- * @param params - Parsed route parameters
154
- */
155
- params: RequestData;
156
- route: Route<X, M>;
157
- constructor(init?: Partial<ClearRequest>);
158
- }
159
- //#endregion
160
- //#region src/Controller.d.ts
161
- declare abstract class Controller<X = any> {
162
- [x: string]: any;
163
- ctx: X;
164
- body: RequestData;
165
- query: RequestData;
166
- params: RequestData;
167
- clearRequest: ClearRequest;
168
- }
169
- //#endregion
170
122
  //#region src/core/bindings.d.ts
171
123
  type BindToken<T = any> = abstract new (...args: any[]) => T;
172
124
  type BindFactory<T = any> = (ctx: any) => T | Promise<T>;
@@ -289,6 +241,16 @@ type ClearRouterPluginInput<Options = any, HttpContext = any> = ClearRouterPlugi
289
241
  */
290
242
  declare function definePlugin<Options = any, HttpContext = any>(plugin: ClearRouterPlugin<Options, HttpContext>): ClearRouterPlugin<Options, HttpContext>;
291
243
  //#endregion
244
+ //#region src/Controller.d.ts
245
+ declare abstract class Controller<X = any> {
246
+ [x: string]: any;
247
+ ctx: X;
248
+ body: RequestData;
249
+ query: RequestData;
250
+ params: RequestData;
251
+ clearRequest: ClearRequest;
252
+ }
253
+ //#endregion
292
254
  //#region src/core/router.d.ts
293
255
  /**
294
256
  * @class clear-router CoreRouter
@@ -554,4 +516,48 @@ declare abstract class CoreRouter {
554
516
  }): void;
555
517
  }
556
518
  //#endregion
557
- export { ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, RouteParameter, definePlugin };
519
+ //#region src/core/types.d.ts
520
+ /**
521
+ * HTTP context passed to route handlers
522
+ */
523
+ interface ClearHttpContext {}
524
+ //#endregion
525
+ //#region src/types/express.d.ts
526
+ /**
527
+ * Middleware function type
528
+ */
529
+ type Middleware$3 = (req: Request$1, res: Response$2, next: NextFunction) => any | Promise<any>;
530
+ //#endregion
531
+ //#region src/types/fastify.d.ts
532
+ interface RequestWithGetBody extends FastifyRequest {
533
+ getBody: () => Record<string, any>;
534
+ }
535
+ type NextFunction$1 = (err?: Error) => void;
536
+ type Middleware$2 = (req: RequestWithGetBody, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
537
+ //#endregion
538
+ //#region src/types/hono.d.ts
539
+ type Middleware$1 = MiddlewareHandler;
540
+ //#endregion
541
+ //#region src/types/koa.d.ts
542
+ type Middleware = Koa.Middleware<any, any>;
543
+ //#endregion
544
+ //#region src/ClearRequest.d.ts
545
+ declare class ClearRequest<X = any, M = Middleware$4 | Middleware$3 | Middleware$2 | Middleware$1 | Middleware> {
546
+ [key: string]: any;
547
+ /**
548
+ * @param body - Parsed request body
549
+ */
550
+ body: RequestData;
551
+ /**
552
+ * @param query - Parsed query parameters
553
+ */
554
+ query: RequestData;
555
+ /**
556
+ * @param params - Parsed route parameters
557
+ */
558
+ params: RequestData;
559
+ route: Route<X, M>;
560
+ constructor(init?: Partial<ClearRequest>);
561
+ }
562
+ //#endregion
563
+ export { ClearHttpContext, ClearRequest, ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, Controller, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response$1 as Response, Route, RouteParameter, definePlugin };
@@ -1,4 +1,4 @@
1
- import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-CY1BZ3Af.cjs";
1
+ import { I as ApiResourceMiddleware, L as ControllerAction, R as HttpMethod, _ as HttpContext, g as Handler, h as Route, n as CoreRouter, v as KoaRouterApp, y as Middleware } from "../types-CWEND0si.cjs";
2
2
 
3
3
  //#region src/koa/router.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-7xO6qBQZ.mjs";
1
+ import { I as ApiResourceMiddleware, L as ControllerAction, R as HttpMethod, _ as HttpContext, g as Handler, h as Route, n as CoreRouter, v as KoaRouterApp, y as Middleware } from "../types-1JoEn1DP.mjs";
2
2
 
3
3
  //#region src/koa/router.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- //#region types/basic.d.ts
1
+ //#region src/types/basic.d.ts
2
2
  /**
3
3
  * Controller method reference
4
4
  */
@@ -1,16 +1,15 @@
1
1
  import { ControllerHandler } from "./basic.mjs";
2
- import { Response as Response$1 } from "./core/Response.mjs";
3
- import { Request as Request$1 } from "./core/Request.mjs";
2
+ import { n as Request$1, r as Response$1, t as ClearHttpContext } from "../types-D6JAxrWo.mjs";
4
3
  import { NextFunction, Request, Response } from "express";
5
4
 
6
- //#region types/express.d.ts
5
+ //#region src/types/express.d.ts
7
6
  interface RequestWithGetBody extends Request {
8
7
  getBody: () => Record<string, any>;
9
8
  }
10
9
  /**
11
10
  * HTTP context passed to route handlers
12
11
  */
13
- interface HttpContext {
12
+ interface HttpContext extends ClearHttpContext {
14
13
  req: RequestWithGetBody;
15
14
  res: Response;
16
15
  next: NextFunction;
@@ -1,13 +1,12 @@
1
1
  import { ControllerHandler } from "./basic.mjs";
2
- import { Response } from "./core/Response.mjs";
3
- import { Request } from "./core/Request.mjs";
2
+ import { n as Request, r as Response, t as ClearHttpContext } from "../types-D6JAxrWo.mjs";
4
3
  import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
5
4
 
6
- //#region types/fastify.d.ts
5
+ //#region src/types/fastify.d.ts
7
6
  interface RequestWithGetBody extends FastifyRequest {
8
7
  getBody: () => Record<string, any>;
9
8
  }
10
- interface HttpContext {
9
+ interface HttpContext extends ClearHttpContext {
11
10
  req: RequestWithGetBody;
12
11
  reply: FastifyReply;
13
12
  clearRequest: Request;
@@ -1,9 +1,8 @@
1
1
  import { ControllerHandler } from "./basic.mjs";
2
- import { Response as Response$1 } from "./core/Response.mjs";
3
- import { Request } from "./core/Request.mjs";
2
+ import { n as Request, r as Response$1, t as ClearHttpContext } from "../types-D6JAxrWo.mjs";
4
3
  import { EventHandlerRequest, H3, H3Event, Middleware, TypedServerRequest } from "h3";
5
4
 
6
- //#region types/h3.d.ts
5
+ //#region src/types/h3.d.ts
7
6
  type H3App = Omit<H3, 'fetch'> & {
8
7
  fetch: (request: TypedServerRequest<EventHandlerRequest>) => Promise<Response>;
9
8
  };
@@ -11,11 +10,11 @@ type MaybePromise<T = unknown> = T | Promise<T>;
11
10
  interface HttpRequest extends TypedServerRequest<EventHandlerRequest> {
12
11
  getBody: () => Record<string, any>;
13
12
  }
14
- type RequestlessH3Event = Omit<H3Event, 'req'>;
13
+ type MergedHttpContext = Omit<H3Event, 'req'> & ClearHttpContext;
15
14
  /**
16
15
  * HTTP context passed to route handlers
17
16
  */
18
- interface HttpContext extends RequestlessH3Event {
17
+ interface HttpContext extends MergedHttpContext {
19
18
  req: HttpRequest;
20
19
  clearRequest: Request;
21
20
  clearResponse: Response$1;
@@ -1,17 +1,17 @@
1
1
  import { ControllerHandler } from "./basic.mjs";
2
- import { Response } from "./core/Response.mjs";
3
- import { Request } from "./core/Request.mjs";
2
+ import { n as Request, r as Response, t as ClearHttpContext } from "../types-D6JAxrWo.mjs";
4
3
  import { Context, HonoRequest, MiddlewareHandler } from "hono";
5
4
 
6
- //#region types/hono.d.ts
5
+ //#region src/types/hono.d.ts
7
6
  type RequestWithGetBody = HonoRequest & {
8
7
  getBody: () => Record<string, any>;
9
8
  };
10
- type HttpContext = Context & {
9
+ type MergedHttpContext = ClearHttpContext & Context;
10
+ interface HttpContext extends MergedHttpContext {
11
11
  req: RequestWithGetBody;
12
12
  clearRequest: Request;
13
13
  clearResponse: Response;
14
- };
14
+ }
15
15
  type RouteHandler = (ctx: HttpContext, req: Request) => any | Promise<any>;
16
16
  type Handler = RouteHandler | ControllerHandler;
17
17
  type NextFunction = () => Promise<void>;
@@ -1,15 +1,15 @@
1
1
  import { ControllerHandler } from "./basic.mjs";
2
- import { Response } from "./core/Response.mjs";
3
- import { Request } from "./core/Request.mjs";
2
+ import { n as Request, r as Response, t as ClearHttpContext } from "../types-D6JAxrWo.mjs";
4
3
  import Koa from "koa";
5
4
  import Router from "@koa/router";
6
5
 
7
- //#region types/koa.d.ts
6
+ //#region src/types/koa.d.ts
8
7
  interface RequestWithGetBody extends Koa.Request {
9
8
  getBody: () => Record<string, any>;
10
9
  body?: any;
11
10
  }
12
- interface HttpContext extends Koa.Context {
11
+ type MergedHttpContext = ClearHttpContext & Koa.Context;
12
+ interface HttpContext extends MergedHttpContext {
13
13
  request: RequestWithGetBody;
14
14
  clearRequest: Request;
15
15
  clearResponse: Response;
@@ -7,30 +7,7 @@ import { Context, HonoRequest, MiddlewareHandler } from "hono";
7
7
  import Koa from "koa";
8
8
  import Router$1 from "@koa/router";
9
9
 
10
- //#region src/core/Response.d.ts
11
- declare class Response$2 {
12
- [key: string]: any;
13
- body: any;
14
- headers: Headers;
15
- sent: boolean;
16
- statusCode: number;
17
- statusText: string;
18
- constructor(init?: Partial<Response$2 | globalThis.Response>);
19
- status(code: number): this;
20
- setStatusText(text: string): this;
21
- code(code: number): this;
22
- setHeader(name: string, value: string): this;
23
- header(name: string, value: string): this;
24
- set(name: string, value: string): this;
25
- type(contentType: string): this;
26
- send(body?: any): this;
27
- json(body: any): this;
28
- html(body: string): this;
29
- text(body: string): this;
30
- noContent(): this;
31
- }
32
- //#endregion
33
- //#region types/basic.d.ts
10
+ //#region src/types/basic.d.ts
34
11
  /**
35
12
  * Controller method reference
36
13
  */
@@ -72,14 +49,37 @@ interface RouterConfig {
72
49
  };
73
50
  }
74
51
  //#endregion
75
- //#region types/express.d.ts
52
+ //#region src/core/Response.d.ts
53
+ declare class Response$2 {
54
+ [key: string]: any;
55
+ body: any;
56
+ headers: Headers;
57
+ sent: boolean;
58
+ statusCode: number;
59
+ statusText: string;
60
+ constructor(init?: Partial<Response$2 | globalThis.Response>);
61
+ status(code: number): this;
62
+ setStatusText(text: string): this;
63
+ code(code: number): this;
64
+ setHeader(name: string, value: string): this;
65
+ header(name: string, value: string): this;
66
+ set(name: string, value: string): this;
67
+ type(contentType: string): this;
68
+ send(body?: any): this;
69
+ json(body: any): this;
70
+ html(body: string): this;
71
+ text(body: string): this;
72
+ noContent(): this;
73
+ }
74
+ //#endregion
75
+ //#region src/types/express.d.ts
76
76
  interface RequestWithGetBody$3 extends Request {
77
77
  getBody: () => Record<string, any>;
78
78
  }
79
79
  /**
80
80
  * HTTP context passed to route handlers
81
81
  */
82
- interface HttpContext$4 {
82
+ interface HttpContext$4 extends ClearHttpContext {
83
83
  req: RequestWithGetBody$3;
84
84
  res: Response$1;
85
85
  next: NextFunction;
@@ -109,11 +109,11 @@ type Handler$4 = RouteHandler$4 | ControllerHandler;
109
109
  */
110
110
  type Middleware$4 = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
111
111
  //#endregion
112
- //#region types/fastify.d.ts
112
+ //#region src/types/fastify.d.ts
113
113
  interface RequestWithGetBody$2 extends FastifyRequest {
114
114
  getBody: () => Record<string, any>;
115
115
  }
116
- interface HttpContext$3 {
116
+ interface HttpContext$3 extends ClearHttpContext {
117
117
  req: RequestWithGetBody$2;
118
118
  reply: FastifyReply;
119
119
  clearRequest: Request$1;
@@ -125,18 +125,18 @@ type NextFunction$1 = (err?: Error) => void;
125
125
  type Middleware$3 = (req: RequestWithGetBody$2, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
126
126
  type FastifyApp = FastifyInstance;
127
127
  //#endregion
128
- //#region types/h3.d.ts
128
+ //#region src/types/h3.d.ts
129
129
  type H3App = Omit<H3, 'fetch'> & {
130
130
  fetch: (request: TypedServerRequest<EventHandlerRequest>) => Promise<Response>;
131
131
  };
132
132
  interface HttpRequest extends TypedServerRequest<EventHandlerRequest> {
133
133
  getBody: () => Record<string, any>;
134
134
  }
135
- type RequestlessH3Event = Omit<H3Event, 'req'>;
135
+ type MergedHttpContext$2 = Omit<H3Event, 'req'> & ClearHttpContext;
136
136
  /**
137
137
  * HTTP context passed to route handlers
138
138
  */
139
- interface HttpContext$2 extends RequestlessH3Event {
139
+ interface HttpContext$2 extends MergedHttpContext$2 {
140
140
  req: HttpRequest;
141
141
  clearRequest: Request$1;
142
142
  clearResponse: Response$2;
@@ -160,26 +160,28 @@ req: Request$1) => any | Promise<any>;
160
160
  */
161
161
  type Handler$2 = RouteHandler$2 | ControllerHandler;
162
162
  //#endregion
163
- //#region types/hono.d.ts
163
+ //#region src/types/hono.d.ts
164
164
  type RequestWithGetBody$1 = HonoRequest & {
165
165
  getBody: () => Record<string, any>;
166
166
  };
167
- type HttpContext$1 = Context & {
167
+ type MergedHttpContext$1 = ClearHttpContext & Context;
168
+ interface HttpContext$1 extends MergedHttpContext$1 {
168
169
  req: RequestWithGetBody$1;
169
170
  clearRequest: Request$1;
170
171
  clearResponse: Response$2;
171
- };
172
+ }
172
173
  type RouteHandler$1 = (ctx: HttpContext$1, req: Request$1) => any | Promise<any>;
173
174
  type Handler$1 = RouteHandler$1 | ControllerHandler;
174
175
  type Middleware$1 = MiddlewareHandler;
175
176
  type HonoApp = { [K in 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head']: (path: string, ...handlers: Middleware$1[]) => any };
176
177
  //#endregion
177
- //#region types/koa.d.ts
178
+ //#region src/types/koa.d.ts
178
179
  interface RequestWithGetBody extends Koa.Request {
179
180
  getBody: () => Record<string, any>;
180
181
  body?: any;
181
182
  }
182
- interface HttpContext extends Koa.Context {
183
+ type MergedHttpContext = ClearHttpContext & Koa.Context;
184
+ interface HttpContext extends MergedHttpContext {
183
185
  request: RequestWithGetBody;
184
186
  clearRequest: Request$1;
185
187
  clearResponse: Response$2;
@@ -641,4 +643,10 @@ declare abstract class CoreRouter {
641
643
  }): void;
642
644
  }
643
645
  //#endregion
644
- export { Middleware$3 as A, H3App as C, FastifyApp as D, Middleware$2 as E, ControllerAction as F, HttpMethod as I, Response$2 as L, HttpContext$4 as M, Middleware$4 as N, Handler$3 as O, ApiResourceMiddleware as P, Middleware$1 as S, HttpContext$2 as T, KoaRouterApp as _, ClearRouterPluginInput as a, HonoApp as b, PluginBind as c, PluginSetupResult as d, definePlugin as f, HttpContext as g, Handler as h, ClearRouterPluginContext as i, Handler$4 as j, HttpContext$3 as k, PluginBindFactory as l, Route as m, ClearRouterPlugin as n, ClearRouterPluginRequestContext as o, Request$1 as p, ClearRouterPluginArgumentsContext as r, PluginArgumentsResolver as s, CoreRouter as t, PluginBindValue as u, Middleware as v, Handler$2 as w, HttpContext$1 as x, Handler$1 as y };
646
+ //#region src/core/types.d.ts
647
+ /**
648
+ * HTTP context passed to route handlers
649
+ */
650
+ interface ClearHttpContext {}
651
+ //#endregion
652
+ export { HttpContext$3 as A, Middleware$1 as C, Middleware$2 as D, HttpContext$2 as E, Response$2 as F, ApiResourceMiddleware as I, ControllerAction as L, Handler$4 as M, HttpContext$4 as N, FastifyApp as O, Middleware$4 as P, HttpMethod as R, HttpContext$1 as S, Handler$2 as T, HttpContext as _, ClearRouterPluginContext as a, Handler$1 as b, PluginArgumentsResolver as c, PluginBindValue as d, PluginSetupResult as f, Handler as g, Route as h, ClearRouterPluginArgumentsContext as i, Middleware$3 as j, Handler$3 as k, PluginBind as l, Request$1 as m, CoreRouter as n, ClearRouterPluginInput as o, definePlugin as p, ClearRouterPlugin as r, ClearRouterPluginRequestContext as s, ClearHttpContext as t, PluginBindFactory as u, KoaRouterApp as v, H3App as w, HonoApp as x, Middleware as y };
@@ -7,30 +7,7 @@ import Koa from "koa";
7
7
  import Router$1 from "@koa/router";
8
8
  import { AsyncLocalStorage } from "node:async_hooks";
9
9
 
10
- //#region src/core/Response.d.ts
11
- declare class Response$2 {
12
- [key: string]: any;
13
- body: any;
14
- headers: Headers;
15
- sent: boolean;
16
- statusCode: number;
17
- statusText: string;
18
- constructor(init?: Partial<Response$2 | globalThis.Response>);
19
- status(code: number): this;
20
- setStatusText(text: string): this;
21
- code(code: number): this;
22
- setHeader(name: string, value: string): this;
23
- header(name: string, value: string): this;
24
- set(name: string, value: string): this;
25
- type(contentType: string): this;
26
- send(body?: any): this;
27
- json(body: any): this;
28
- html(body: string): this;
29
- text(body: string): this;
30
- noContent(): this;
31
- }
32
- //#endregion
33
- //#region types/basic.d.ts
10
+ //#region src/types/basic.d.ts
34
11
  /**
35
12
  * Controller method reference
36
13
  */
@@ -72,14 +49,37 @@ interface RouterConfig {
72
49
  };
73
50
  }
74
51
  //#endregion
75
- //#region types/express.d.ts
52
+ //#region src/core/Response.d.ts
53
+ declare class Response$2 {
54
+ [key: string]: any;
55
+ body: any;
56
+ headers: Headers;
57
+ sent: boolean;
58
+ statusCode: number;
59
+ statusText: string;
60
+ constructor(init?: Partial<Response$2 | globalThis.Response>);
61
+ status(code: number): this;
62
+ setStatusText(text: string): this;
63
+ code(code: number): this;
64
+ setHeader(name: string, value: string): this;
65
+ header(name: string, value: string): this;
66
+ set(name: string, value: string): this;
67
+ type(contentType: string): this;
68
+ send(body?: any): this;
69
+ json(body: any): this;
70
+ html(body: string): this;
71
+ text(body: string): this;
72
+ noContent(): this;
73
+ }
74
+ //#endregion
75
+ //#region src/types/express.d.ts
76
76
  interface RequestWithGetBody$3 extends Request {
77
77
  getBody: () => Record<string, any>;
78
78
  }
79
79
  /**
80
80
  * HTTP context passed to route handlers
81
81
  */
82
- interface HttpContext$4 {
82
+ interface HttpContext$4 extends ClearHttpContext {
83
83
  req: RequestWithGetBody$3;
84
84
  res: Response$1;
85
85
  next: NextFunction;
@@ -109,11 +109,11 @@ type Handler$4 = RouteHandler$4 | ControllerHandler;
109
109
  */
110
110
  type Middleware$4 = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
111
111
  //#endregion
112
- //#region types/fastify.d.ts
112
+ //#region src/types/fastify.d.ts
113
113
  interface RequestWithGetBody$2 extends FastifyRequest {
114
114
  getBody: () => Record<string, any>;
115
115
  }
116
- interface HttpContext$3 {
116
+ interface HttpContext$3 extends ClearHttpContext {
117
117
  req: RequestWithGetBody$2;
118
118
  reply: FastifyReply;
119
119
  clearRequest: Request$1;
@@ -125,18 +125,18 @@ type NextFunction$1 = (err?: Error) => void;
125
125
  type Middleware$3 = (req: RequestWithGetBody$2, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
126
126
  type FastifyApp = FastifyInstance;
127
127
  //#endregion
128
- //#region types/h3.d.ts
128
+ //#region src/types/h3.d.ts
129
129
  type H3App = Omit<H3, 'fetch'> & {
130
130
  fetch: (request: TypedServerRequest<EventHandlerRequest>) => Promise<Response>;
131
131
  };
132
132
  interface HttpRequest extends TypedServerRequest<EventHandlerRequest> {
133
133
  getBody: () => Record<string, any>;
134
134
  }
135
- type RequestlessH3Event = Omit<H3Event, 'req'>;
135
+ type MergedHttpContext$2 = Omit<H3Event, 'req'> & ClearHttpContext;
136
136
  /**
137
137
  * HTTP context passed to route handlers
138
138
  */
139
- interface HttpContext$2 extends RequestlessH3Event {
139
+ interface HttpContext$2 extends MergedHttpContext$2 {
140
140
  req: HttpRequest;
141
141
  clearRequest: Request$1;
142
142
  clearResponse: Response$2;
@@ -160,26 +160,28 @@ req: Request$1) => any | Promise<any>;
160
160
  */
161
161
  type Handler$2 = RouteHandler$2 | ControllerHandler;
162
162
  //#endregion
163
- //#region types/hono.d.ts
163
+ //#region src/types/hono.d.ts
164
164
  type RequestWithGetBody$1 = HonoRequest & {
165
165
  getBody: () => Record<string, any>;
166
166
  };
167
- type HttpContext$1 = Context & {
167
+ type MergedHttpContext$1 = ClearHttpContext & Context;
168
+ interface HttpContext$1 extends MergedHttpContext$1 {
168
169
  req: RequestWithGetBody$1;
169
170
  clearRequest: Request$1;
170
171
  clearResponse: Response$2;
171
- };
172
+ }
172
173
  type RouteHandler$1 = (ctx: HttpContext$1, req: Request$1) => any | Promise<any>;
173
174
  type Handler$1 = RouteHandler$1 | ControllerHandler;
174
175
  type Middleware$1 = MiddlewareHandler;
175
176
  type HonoApp = { [K in 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head']: (path: string, ...handlers: Middleware$1[]) => any };
176
177
  //#endregion
177
- //#region types/koa.d.ts
178
+ //#region src/types/koa.d.ts
178
179
  interface RequestWithGetBody extends Koa.Request {
179
180
  getBody: () => Record<string, any>;
180
181
  body?: any;
181
182
  }
182
- interface HttpContext extends Koa.Context {
183
+ type MergedHttpContext = ClearHttpContext & Koa.Context;
184
+ interface HttpContext extends MergedHttpContext {
183
185
  request: RequestWithGetBody;
184
186
  clearRequest: Request$1;
185
187
  clearResponse: Response$2;
@@ -641,4 +643,10 @@ declare abstract class CoreRouter {
641
643
  }): void;
642
644
  }
643
645
  //#endregion
644
- export { Middleware$3 as A, H3App as C, FastifyApp as D, Middleware$2 as E, ControllerAction as F, HttpMethod as I, Response$2 as L, HttpContext$4 as M, Middleware$4 as N, Handler$3 as O, ApiResourceMiddleware as P, Middleware$1 as S, HttpContext$2 as T, KoaRouterApp as _, ClearRouterPluginInput as a, HonoApp as b, PluginBind as c, PluginSetupResult as d, definePlugin as f, HttpContext as g, Handler as h, ClearRouterPluginContext as i, Handler$4 as j, HttpContext$3 as k, PluginBindFactory as l, Route as m, ClearRouterPlugin as n, ClearRouterPluginRequestContext as o, Request$1 as p, ClearRouterPluginArgumentsContext as r, PluginArgumentsResolver as s, CoreRouter as t, PluginBindValue as u, Middleware as v, Handler$2 as w, HttpContext$1 as x, Handler$1 as y };
646
+ //#region src/core/types.d.ts
647
+ /**
648
+ * HTTP context passed to route handlers
649
+ */
650
+ interface ClearHttpContext {}
651
+ //#endregion
652
+ export { HttpContext$3 as A, Middleware$1 as C, Middleware$2 as D, HttpContext$2 as E, Response$2 as F, ApiResourceMiddleware as I, ControllerAction as L, Handler$4 as M, HttpContext$4 as N, FastifyApp as O, Middleware$4 as P, HttpMethod as R, HttpContext$1 as S, Handler$2 as T, HttpContext as _, ClearRouterPluginContext as a, Handler$1 as b, PluginArgumentsResolver as c, PluginBindValue as d, PluginSetupResult as f, Handler as g, Route as h, ClearRouterPluginArgumentsContext as i, Middleware$3 as j, Handler$3 as k, PluginBind as l, Request$1 as m, CoreRouter as n, ClearRouterPluginInput as o, definePlugin as p, ClearRouterPlugin as r, ClearRouterPluginRequestContext as s, ClearHttpContext as t, PluginBindFactory as u, KoaRouterApp as v, H3App as w, HonoApp as x, Middleware as y };
@@ -0,0 +1,109 @@
1
+ import { HttpMethod, RequestData } from "./types/basic.mjs";
2
+ import { Middleware } from "./types/fastify.mjs";
3
+ import { Middleware as Middleware$1 } from "./types/h3.mjs";
4
+ import { Middleware as Middleware$2 } from "./types/hono.mjs";
5
+ import { Middleware as Middleware$3 } from "./types/koa.mjs";
6
+ import { Middleware as Middleware$4 } from "./types/express.mjs";
7
+
8
+ //#region src/core/Response.d.ts
9
+ declare class Response {
10
+ [key: string]: any;
11
+ body: any;
12
+ headers: Headers;
13
+ sent: boolean;
14
+ statusCode: number;
15
+ statusText: string;
16
+ constructor(init?: Partial<Response | globalThis.Response>);
17
+ status(code: number): this;
18
+ setStatusText(text: string): this;
19
+ code(code: number): this;
20
+ setHeader(name: string, value: string): this;
21
+ header(name: string, value: string): this;
22
+ set(name: string, value: string): this;
23
+ type(contentType: string): this;
24
+ send(body?: any): this;
25
+ json(body: any): this;
26
+ html(body: string): this;
27
+ text(body: string): this;
28
+ noContent(): this;
29
+ }
30
+ //#endregion
31
+ //#region src/Route.d.ts
32
+ interface RouteParameter {
33
+ name: string;
34
+ field?: string;
35
+ optional: boolean;
36
+ }
37
+ declare class Route<X = any, M = Middleware$1 | Middleware$4, H = any> {
38
+ ctx: X;
39
+ body: RequestData;
40
+ query: RequestData;
41
+ params: RequestData;
42
+ clearRequest: ClearRequest;
43
+ methods: HttpMethod[];
44
+ path: string;
45
+ registrationPaths: string[];
46
+ parameters: RouteParameter[];
47
+ routeName?: string;
48
+ handler: H;
49
+ middlewares: M[];
50
+ controllerName?: string;
51
+ actionName?: string;
52
+ handlerType: 'function' | 'controller';
53
+ middlewareCount: number;
54
+ constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[], options?: {
55
+ registrationPaths?: string[];
56
+ parameters?: RouteParameter[];
57
+ onName?: (name: string, route: Route<X, M, H>, previousName?: string) => void;
58
+ });
59
+ private onName?;
60
+ name(name: string): this;
61
+ toPath(params?: RequestData): string;
62
+ }
63
+ //#endregion
64
+ //#region src/ClearRequest.d.ts
65
+ declare class ClearRequest<X = any, M = Middleware$1 | Middleware$4 | Middleware | Middleware$2 | Middleware$3> {
66
+ [key: string]: any;
67
+ /**
68
+ * @param body - Parsed request body
69
+ */
70
+ body: RequestData;
71
+ /**
72
+ * @param query - Parsed query parameters
73
+ */
74
+ query: RequestData;
75
+ /**
76
+ * @param params - Parsed route parameters
77
+ */
78
+ params: RequestData;
79
+ route: Route<X, M>;
80
+ constructor(init?: Partial<ClearRequest>);
81
+ }
82
+ //#endregion
83
+ //#region src/core/Request.d.ts
84
+ declare class Request<X = any, M = any> extends ClearRequest<X, M> {
85
+ original?: any;
86
+ method: string;
87
+ path: string;
88
+ url: string;
89
+ headers: Headers | Record<string, any>;
90
+ constructor(init?: Partial<Request<X, M>> & {
91
+ body?: RequestData;
92
+ query?: RequestData;
93
+ params?: RequestData;
94
+ route?: Route<X, M>;
95
+ });
96
+ getBody(): RequestData;
97
+ header(name: string): string;
98
+ param(name: string): any;
99
+ input(name: string): any;
100
+ is(method: HttpMethod | string): boolean;
101
+ }
102
+ //#endregion
103
+ //#region src/core/types.d.ts
104
+ /**
105
+ * HTTP context passed to route handlers
106
+ */
107
+ interface ClearHttpContext {}
108
+ //#endregion
109
+ export { Request as n, Response as r, ClearHttpContext as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-router",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "Laravel-style routing for Node.js with support for Express, H3, Fastify, Hono, and Koa, including CommonJS, ESM, and TypeScript support.",
5
5
  "keywords": [
6
6
  "h3",
@@ -1,28 +0,0 @@
1
- import { RequestData } from "../types/basic.mjs";
2
- import { Middleware } from "../types/fastify.mjs";
3
- import { Middleware as Middleware$1 } from "../types/h3.mjs";
4
- import { Middleware as Middleware$2 } from "../types/hono.mjs";
5
- import { Middleware as Middleware$3 } from "../types/koa.mjs";
6
- import { Route } from "./Route.mjs";
7
- import { Middleware as Middleware$4 } from "../types/express.mjs";
8
-
9
- //#region src/ClearRequest.d.ts
10
- declare class ClearRequest<X = any, M = Middleware$1 | Middleware$4 | Middleware | Middleware$2 | Middleware$3> {
11
- [key: string]: any;
12
- /**
13
- * @param body - Parsed request body
14
- */
15
- body: RequestData;
16
- /**
17
- * @param query - Parsed query parameters
18
- */
19
- query: RequestData;
20
- /**
21
- * @param params - Parsed route parameters
22
- */
23
- params: RequestData;
24
- route: Route<X, M>;
25
- constructor(init?: Partial<ClearRequest>);
26
- }
27
- //#endregion
28
- export { ClearRequest };
@@ -1,39 +0,0 @@
1
- import { HttpMethod, RequestData } from "../types/basic.mjs";
2
- import { Middleware } from "../types/h3.mjs";
3
- import { ClearRequest } from "./ClearRequest.mjs";
4
- import { Middleware as Middleware$1 } from "../types/express.mjs";
5
-
6
- //#region src/Route.d.ts
7
- interface RouteParameter {
8
- name: string;
9
- field?: string;
10
- optional: boolean;
11
- }
12
- declare class Route<X = any, M = Middleware | Middleware$1, H = any> {
13
- ctx: X;
14
- body: RequestData;
15
- query: RequestData;
16
- params: RequestData;
17
- clearRequest: ClearRequest;
18
- methods: HttpMethod[];
19
- path: string;
20
- registrationPaths: string[];
21
- parameters: RouteParameter[];
22
- routeName?: string;
23
- handler: H;
24
- middlewares: M[];
25
- controllerName?: string;
26
- actionName?: string;
27
- handlerType: 'function' | 'controller';
28
- middlewareCount: number;
29
- constructor(methods: HttpMethod[], path: string, handler: H, middlewares?: M[], options?: {
30
- registrationPaths?: string[];
31
- parameters?: RouteParameter[];
32
- onName?: (name: string, route: Route<X, M, H>, previousName?: string) => void;
33
- });
34
- private onName?;
35
- name(name: string): this;
36
- toPath(params?: RequestData): string;
37
- }
38
- //#endregion
39
- export { Route };
@@ -1,25 +0,0 @@
1
- import { HttpMethod, RequestData } from "../../types/basic.mjs";
2
- import { Route } from "../Route.mjs";
3
- import { ClearRequest } from "../ClearRequest.mjs";
4
-
5
- //#region src/core/Request.d.ts
6
- declare class Request<X = any, M = any> extends ClearRequest<X, M> {
7
- original?: any;
8
- method: string;
9
- path: string;
10
- url: string;
11
- headers: Headers | Record<string, any>;
12
- constructor(init?: Partial<Request<X, M>> & {
13
- body?: RequestData;
14
- query?: RequestData;
15
- params?: RequestData;
16
- route?: Route<X, M>;
17
- });
18
- getBody(): RequestData;
19
- header(name: string): string;
20
- param(name: string): any;
21
- input(name: string): any;
22
- is(method: HttpMethod | string): boolean;
23
- }
24
- //#endregion
25
- export { Request };
@@ -1,24 +0,0 @@
1
- //#region src/core/Response.d.ts
2
- declare class Response {
3
- [key: string]: any;
4
- body: any;
5
- headers: Headers;
6
- sent: boolean;
7
- statusCode: number;
8
- statusText: string;
9
- constructor(init?: Partial<Response | globalThis.Response>);
10
- status(code: number): this;
11
- setStatusText(text: string): this;
12
- code(code: number): this;
13
- setHeader(name: string, value: string): this;
14
- header(name: string, value: string): this;
15
- set(name: string, value: string): this;
16
- type(contentType: string): this;
17
- send(body?: any): this;
18
- json(body: any): this;
19
- html(body: string): this;
20
- text(body: string): this;
21
- noContent(): this;
22
- }
23
- //#endregion
24
- export { Response };