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.
@@ -1,130 +0,0 @@
1
- import { H3, H3Event, Middleware as Middleware$1, TypedServerRequest } from "h3";
2
- import { NextFunction, Request, Response as Response$1 } from "express";
3
-
4
- //#region types/h3.d.ts
5
- type H3App = Omit<H3['fetch'], 'fetch'> & {
6
- fetch: (request: TypedServerRequest) => Promise<Response>;
7
- };
8
- /**
9
- * HTTP context passed to route handlers
10
- */
11
- type HttpContext$1 = H3Event & {};
12
- /**
13
- * Route handler function type
14
- */
15
- type RouteHandler$1 = (
16
- /**
17
- * H3 event context
18
- */
19
-
20
- ctx: HttpContext$1,
21
- /**
22
- * ClearRequest instance
23
- */
24
-
25
- req: ClearRequest) => any | Promise<any>;
26
- /**
27
- * Handler can be either a function or controller reference
28
- */
29
- type Handler$1 = RouteHandler$1 | ControllerHandler;
30
- //#endregion
31
- //#region src/Route.d.ts
32
- declare class Route<X = any, M = Middleware$1 | Middleware> {
33
- ctx: X;
34
- body: RequestData;
35
- query: RequestData;
36
- params: RequestData;
37
- clearRequest: ClearRequest;
38
- methods: HttpMethod[];
39
- path: string;
40
- handler: Handler$1;
41
- middlewares: M[];
42
- controllerName?: string;
43
- actionName?: string;
44
- handlerType: 'function' | 'controller';
45
- middlewareCount: number;
46
- constructor(methods: HttpMethod[], path: string, handler: Handler$1, middlewares?: M[]);
47
- }
48
- //#endregion
49
- //#region src/ClearRequest.d.ts
50
- declare class ClearRequest<X = any, M = Middleware$1 | Middleware> {
51
- [key: string]: any;
52
- /**
53
- * @param body - Parsed request body
54
- */
55
- body: RequestData;
56
- /**
57
- * @param query - Parsed query parameters
58
- */
59
- query: RequestData;
60
- /**
61
- * @param params - Parsed route parameters
62
- */
63
- params: RequestData;
64
- route: Route<X, M>;
65
- constructor(init?: Partial<ClearRequest>);
66
- }
67
- //#endregion
68
- //#region types/express.d.ts
69
- /**
70
- * HTTP context passed to route handlers
71
- */
72
- interface HttpContext {
73
- req: Request;
74
- res: Response$1;
75
- next: NextFunction;
76
- }
77
- /**
78
- * Route handler function type
79
- */
80
- type RouteHandler = (
81
- /**
82
- * Express context object containing req, res, and next
83
- */
84
-
85
- ctx: HttpContext,
86
- /**
87
- * ClearRequest instance
88
- */
89
-
90
- req: ClearRequest) => any | Promise<any>;
91
- /**
92
- * Handler can be either a function or controller reference
93
- */
94
- type Handler = RouteHandler | ControllerHandler;
95
- /**
96
- * Middleware function type
97
- */
98
- type Middleware = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
99
- //#endregion
100
- //#region types/basic.d.ts
101
- /**
102
- * Controller method reference
103
- */
104
- type ControllerHandler = [any, string];
105
- /**
106
- * HTTP methods supported by the router
107
- */
108
- type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head';
109
- /**
110
- * Common controller action names
111
- */
112
- type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
113
- /**
114
- * Generic Object type for request data
115
- */
116
- type RequestData = Record<string, any>;
117
- type ApiResourceMiddleware<M extends Middleware | Middleware$1> = M | M[] | { [K in ControllerAction]?: M | M[] };
118
- interface RouterConfig {
119
- /**
120
- * Configuration for method override functionality, allowing clients to use a
121
- * specific header or body parameter to override the HTTP method.
122
- */
123
- methodOverride?: {
124
- /** Whether method override is enabled */enabled?: boolean; /** Keys in the request body to check for method override */
125
- bodyKeys?: string[] | string; /** Keys in the request headers to check for method override */
126
- headerKeys?: string[] | string;
127
- };
128
- }
129
- //#endregion
130
- export { Handler as a, Route as c, HttpContext$1 as d, Middleware$1 as f, RouterConfig as i, H3App as l, ControllerAction as n, HttpContext as o, HttpMethod as r, Middleware as s, ApiResourceMiddleware as t, Handler$1 as u };