clear-router 2.1.0 → 2.1.2
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/{Route-BJ9lF-Fj.cjs → Route-97p-tEbS.cjs} +1 -0
- package/dist/{Route-DcqlC_Bp.mjs → Route-BtmoiYq5.mjs} +1 -0
- package/dist/express/index.cjs +4 -3
- package/dist/express/{index.d.cts → index.d.ts} +1 -1
- package/dist/express/index.mjs +4 -3
- package/dist/{Route-DS_MAytb.d.cts → express-C77arBZx.d.ts} +50 -49
- package/dist/{Route-DsnulZob.d.mts → express-DyZ-2KK1.d.ts} +50 -49
- package/dist/h3/index.cjs +4 -3
- package/dist/h3/{index.d.cts → index.d.ts} +1 -1
- package/dist/h3/index.mjs +4 -3
- package/dist/index.cjs +56 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.mjs +52 -0
- package/dist/types/{express.d.mts → express.d.ts} +2 -2
- package/dist/types/{h3.d.mts → h3.d.ts} +2 -2
- package/package.json +8 -4
- package/dist/express/index.d.mts +0 -133
- package/dist/h3/index.d.mts +0 -131
- package/dist/src/ClearRequest.d.mts +0 -21
- /package/dist/types/{basic.d.mts → basic.d.ts} +0 -0
package/dist/express/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_Route = require('../Route-
|
|
2
|
+
const require_Route = require('../Route-97p-tEbS.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.ts
|
|
5
5
|
/**
|
|
@@ -241,7 +241,7 @@ var Router = class Router {
|
|
|
241
241
|
next
|
|
242
242
|
};
|
|
243
243
|
const inst = instance ?? route;
|
|
244
|
-
await Router.bindRequestToInstance(ctx, inst);
|
|
244
|
+
await Router.bindRequestToInstance(ctx, inst, route);
|
|
245
245
|
const result = handlerFunction(ctx, inst.clearRequest);
|
|
246
246
|
await Promise.resolve(result);
|
|
247
247
|
} catch (error) {
|
|
@@ -251,7 +251,7 @@ var Router = class Router {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
static async bindRequestToInstance(ctx, instance) {
|
|
254
|
+
static async bindRequestToInstance(ctx, instance, route) {
|
|
255
255
|
if (!instance) return;
|
|
256
256
|
instance.ctx = ctx;
|
|
257
257
|
instance.body = ctx.req.body;
|
|
@@ -259,6 +259,7 @@ var Router = class Router {
|
|
|
259
259
|
instance.params = ctx.req.params;
|
|
260
260
|
instance.clearRequest = new require_Route.ClearRequest({
|
|
261
261
|
ctx,
|
|
262
|
+
route,
|
|
262
263
|
body: instance.body,
|
|
263
264
|
query: instance.query,
|
|
264
265
|
params: instance.params
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as RouteInfo, i as Route, l as ControllerAction, n as HttpContext, r as Middleware, t as Handler, u as HttpMethod } from "../express-C77arBZx.js";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
package/dist/express/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ClearRequest, t as Route } from "../Route-
|
|
1
|
+
import { n as ClearRequest, t as Route } from "../Route-BtmoiYq5.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/express/router.ts
|
|
4
4
|
/**
|
|
@@ -240,7 +240,7 @@ var Router = class Router {
|
|
|
240
240
|
next
|
|
241
241
|
};
|
|
242
242
|
const inst = instance ?? route;
|
|
243
|
-
await Router.bindRequestToInstance(ctx, inst);
|
|
243
|
+
await Router.bindRequestToInstance(ctx, inst, route);
|
|
244
244
|
const result = handlerFunction(ctx, inst.clearRequest);
|
|
245
245
|
await Promise.resolve(result);
|
|
246
246
|
} catch (error) {
|
|
@@ -250,7 +250,7 @@ var Router = class Router {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
static async bindRequestToInstance(ctx, instance) {
|
|
253
|
+
static async bindRequestToInstance(ctx, instance, route) {
|
|
254
254
|
if (!instance) return;
|
|
255
255
|
instance.ctx = ctx;
|
|
256
256
|
instance.body = ctx.req.body;
|
|
@@ -258,6 +258,7 @@ var Router = class Router {
|
|
|
258
258
|
instance.params = ctx.req.params;
|
|
259
259
|
instance.clearRequest = new ClearRequest({
|
|
260
260
|
ctx,
|
|
261
|
+
route,
|
|
261
262
|
body: instance.body,
|
|
262
263
|
query: instance.query,
|
|
263
264
|
params: instance.params
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextFunction, Request, Response as Response$1 } from "express";
|
|
2
|
-
import { H3, H3Event, Middleware, TypedServerRequest } from "h3";
|
|
2
|
+
import { H3, H3Event, Middleware as Middleware$1, TypedServerRequest } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region types/basic.d.ts
|
|
5
5
|
/**
|
|
@@ -28,8 +28,49 @@ type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
|
|
|
28
28
|
*/
|
|
29
29
|
type RequestData = Record<string, any>;
|
|
30
30
|
//#endregion
|
|
31
|
+
//#region types/h3.d.ts
|
|
32
|
+
type H3App = Omit<H3['fetch'], 'fetch'> & {
|
|
33
|
+
fetch: (request: TypedServerRequest) => Promise<Response>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* HTTP context passed to route handlers
|
|
37
|
+
*/
|
|
38
|
+
type HttpContext$1 = H3Event & {};
|
|
39
|
+
/**
|
|
40
|
+
* Route handler function type
|
|
41
|
+
*/
|
|
42
|
+
type RouteHandler$1 = (
|
|
43
|
+
/**
|
|
44
|
+
* H3 event context
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
ctx: HttpContext$1,
|
|
48
|
+
/**
|
|
49
|
+
* ClearRequest instance
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
req: ClearRequest) => any | Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Handler can be either a function or controller reference
|
|
55
|
+
*/
|
|
56
|
+
type Handler$1 = RouteHandler$1 | ControllerHandler;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/Route.d.ts
|
|
59
|
+
declare class Route<X = any, M = Middleware$1 | Middleware> {
|
|
60
|
+
ctx: X;
|
|
61
|
+
body: RequestData;
|
|
62
|
+
query: RequestData;
|
|
63
|
+
params: RequestData;
|
|
64
|
+
clearRequest: ClearRequest;
|
|
65
|
+
methods: HttpMethod[];
|
|
66
|
+
path: string;
|
|
67
|
+
handler: Handler$1;
|
|
68
|
+
middlewares: M[];
|
|
69
|
+
constructor(methods: HttpMethod[], path: string, handler: Handler$1, middlewares?: M[]);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
31
72
|
//#region src/ClearRequest.d.ts
|
|
32
|
-
declare class ClearRequest {
|
|
73
|
+
declare class ClearRequest<X = any, M = Middleware$1 | Middleware> {
|
|
33
74
|
[key: string]: any;
|
|
34
75
|
/**
|
|
35
76
|
* @param body - Parsed request body
|
|
@@ -43,6 +84,7 @@ declare class ClearRequest {
|
|
|
43
84
|
* @param params - Parsed route parameters
|
|
44
85
|
*/
|
|
45
86
|
params: RequestData;
|
|
87
|
+
route: Route<X, M>;
|
|
46
88
|
constructor(init?: Partial<ClearRequest>);
|
|
47
89
|
}
|
|
48
90
|
//#endregion
|
|
@@ -50,7 +92,7 @@ declare class ClearRequest {
|
|
|
50
92
|
/**
|
|
51
93
|
* HTTP context passed to route handlers
|
|
52
94
|
*/
|
|
53
|
-
interface HttpContext
|
|
95
|
+
interface HttpContext {
|
|
54
96
|
req: Request;
|
|
55
97
|
res: Response$1;
|
|
56
98
|
next: NextFunction;
|
|
@@ -58,12 +100,12 @@ interface HttpContext$1 {
|
|
|
58
100
|
/**
|
|
59
101
|
* Route handler function type
|
|
60
102
|
*/
|
|
61
|
-
type RouteHandler
|
|
103
|
+
type RouteHandler = (
|
|
62
104
|
/**
|
|
63
105
|
* Express context object containing req, res, and next
|
|
64
106
|
*/
|
|
65
107
|
|
|
66
|
-
ctx: HttpContext
|
|
108
|
+
ctx: HttpContext,
|
|
67
109
|
/**
|
|
68
110
|
* ClearRequest instance
|
|
69
111
|
*/
|
|
@@ -72,51 +114,10 @@ req: ClearRequest) => any | Promise<any>;
|
|
|
72
114
|
/**
|
|
73
115
|
* Handler can be either a function or controller reference
|
|
74
116
|
*/
|
|
75
|
-
type Handler
|
|
117
|
+
type Handler = RouteHandler | ControllerHandler;
|
|
76
118
|
/**
|
|
77
119
|
* Middleware function type
|
|
78
120
|
*/
|
|
79
|
-
type Middleware
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region types/h3.d.ts
|
|
82
|
-
type H3App = Omit<H3['fetch'], 'fetch'> & {
|
|
83
|
-
fetch: (request: TypedServerRequest) => Promise<Response>;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* HTTP context passed to route handlers
|
|
87
|
-
*/
|
|
88
|
-
type HttpContext = H3Event & {};
|
|
89
|
-
/**
|
|
90
|
-
* Route handler function type
|
|
91
|
-
*/
|
|
92
|
-
type RouteHandler = (
|
|
93
|
-
/**
|
|
94
|
-
* H3 event context
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
ctx: HttpContext,
|
|
98
|
-
/**
|
|
99
|
-
* ClearRequest instance
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
req: ClearRequest) => any | Promise<any>;
|
|
103
|
-
/**
|
|
104
|
-
* Handler can be either a function or controller reference
|
|
105
|
-
*/
|
|
106
|
-
type Handler = RouteHandler | ControllerHandler;
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/Route.d.ts
|
|
109
|
-
declare class Route<X = any, M = Middleware | Middleware$1> {
|
|
110
|
-
ctx: X;
|
|
111
|
-
body: RequestData;
|
|
112
|
-
query: RequestData;
|
|
113
|
-
params: RequestData;
|
|
114
|
-
clearRequest: ClearRequest;
|
|
115
|
-
methods: HttpMethod[];
|
|
116
|
-
path: string;
|
|
117
|
-
handler: Handler;
|
|
118
|
-
middlewares: M[];
|
|
119
|
-
constructor(methods: HttpMethod[], path: string, handler: Handler, middlewares?: M[]);
|
|
120
|
-
}
|
|
121
|
+
type Middleware = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
|
|
121
122
|
//#endregion
|
|
122
|
-
export {
|
|
123
|
+
export { H3App as a, Middleware$1 as c, RouteInfo as d, Route as i, ControllerAction as l, HttpContext as n, Handler$1 as o, Middleware as r, HttpContext$1 as s, Handler as t, HttpMethod as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H3, H3Event, Middleware, TypedServerRequest } from "h3";
|
|
1
|
+
import { H3, H3Event, Middleware as Middleware$1, TypedServerRequest } from "h3";
|
|
2
2
|
import { NextFunction, Request, Response as Response$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region types/basic.d.ts
|
|
@@ -28,8 +28,49 @@ type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
|
|
|
28
28
|
*/
|
|
29
29
|
type RequestData = Record<string, any>;
|
|
30
30
|
//#endregion
|
|
31
|
+
//#region types/h3.d.ts
|
|
32
|
+
type H3App = Omit<H3['fetch'], 'fetch'> & {
|
|
33
|
+
fetch: (request: TypedServerRequest) => Promise<Response>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* HTTP context passed to route handlers
|
|
37
|
+
*/
|
|
38
|
+
type HttpContext$1 = H3Event & {};
|
|
39
|
+
/**
|
|
40
|
+
* Route handler function type
|
|
41
|
+
*/
|
|
42
|
+
type RouteHandler$1 = (
|
|
43
|
+
/**
|
|
44
|
+
* H3 event context
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
ctx: HttpContext$1,
|
|
48
|
+
/**
|
|
49
|
+
* ClearRequest instance
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
req: ClearRequest) => any | Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Handler can be either a function or controller reference
|
|
55
|
+
*/
|
|
56
|
+
type Handler$1 = RouteHandler$1 | ControllerHandler;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/Route.d.ts
|
|
59
|
+
declare class Route<X = any, M = Middleware$1 | Middleware> {
|
|
60
|
+
ctx: X;
|
|
61
|
+
body: RequestData;
|
|
62
|
+
query: RequestData;
|
|
63
|
+
params: RequestData;
|
|
64
|
+
clearRequest: ClearRequest;
|
|
65
|
+
methods: HttpMethod[];
|
|
66
|
+
path: string;
|
|
67
|
+
handler: Handler$1;
|
|
68
|
+
middlewares: M[];
|
|
69
|
+
constructor(methods: HttpMethod[], path: string, handler: Handler$1, middlewares?: M[]);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
31
72
|
//#region src/ClearRequest.d.ts
|
|
32
|
-
declare class ClearRequest {
|
|
73
|
+
declare class ClearRequest<X = any, M = Middleware$1 | Middleware> {
|
|
33
74
|
[key: string]: any;
|
|
34
75
|
/**
|
|
35
76
|
* @param body - Parsed request body
|
|
@@ -43,6 +84,7 @@ declare class ClearRequest {
|
|
|
43
84
|
* @param params - Parsed route parameters
|
|
44
85
|
*/
|
|
45
86
|
params: RequestData;
|
|
87
|
+
route: Route<X, M>;
|
|
46
88
|
constructor(init?: Partial<ClearRequest>);
|
|
47
89
|
}
|
|
48
90
|
//#endregion
|
|
@@ -50,7 +92,7 @@ declare class ClearRequest {
|
|
|
50
92
|
/**
|
|
51
93
|
* HTTP context passed to route handlers
|
|
52
94
|
*/
|
|
53
|
-
interface HttpContext
|
|
95
|
+
interface HttpContext {
|
|
54
96
|
req: Request;
|
|
55
97
|
res: Response$1;
|
|
56
98
|
next: NextFunction;
|
|
@@ -58,12 +100,12 @@ interface HttpContext$1 {
|
|
|
58
100
|
/**
|
|
59
101
|
* Route handler function type
|
|
60
102
|
*/
|
|
61
|
-
type RouteHandler
|
|
103
|
+
type RouteHandler = (
|
|
62
104
|
/**
|
|
63
105
|
* Express context object containing req, res, and next
|
|
64
106
|
*/
|
|
65
107
|
|
|
66
|
-
ctx: HttpContext
|
|
108
|
+
ctx: HttpContext,
|
|
67
109
|
/**
|
|
68
110
|
* ClearRequest instance
|
|
69
111
|
*/
|
|
@@ -72,51 +114,10 @@ req: ClearRequest) => any | Promise<any>;
|
|
|
72
114
|
/**
|
|
73
115
|
* Handler can be either a function or controller reference
|
|
74
116
|
*/
|
|
75
|
-
type Handler
|
|
117
|
+
type Handler = RouteHandler | ControllerHandler;
|
|
76
118
|
/**
|
|
77
119
|
* Middleware function type
|
|
78
120
|
*/
|
|
79
|
-
type Middleware
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region types/h3.d.ts
|
|
82
|
-
type H3App = Omit<H3['fetch'], 'fetch'> & {
|
|
83
|
-
fetch: (request: TypedServerRequest) => Promise<Response>;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* HTTP context passed to route handlers
|
|
87
|
-
*/
|
|
88
|
-
type HttpContext = H3Event & {};
|
|
89
|
-
/**
|
|
90
|
-
* Route handler function type
|
|
91
|
-
*/
|
|
92
|
-
type RouteHandler = (
|
|
93
|
-
/**
|
|
94
|
-
* H3 event context
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
ctx: HttpContext,
|
|
98
|
-
/**
|
|
99
|
-
* ClearRequest instance
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
req: ClearRequest) => any | Promise<any>;
|
|
103
|
-
/**
|
|
104
|
-
* Handler can be either a function or controller reference
|
|
105
|
-
*/
|
|
106
|
-
type Handler = RouteHandler | ControllerHandler;
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/Route.d.ts
|
|
109
|
-
declare class Route<X = any, M = Middleware | Middleware$1> {
|
|
110
|
-
ctx: X;
|
|
111
|
-
body: RequestData;
|
|
112
|
-
query: RequestData;
|
|
113
|
-
params: RequestData;
|
|
114
|
-
clearRequest: ClearRequest;
|
|
115
|
-
methods: HttpMethod[];
|
|
116
|
-
path: string;
|
|
117
|
-
handler: Handler;
|
|
118
|
-
middlewares: M[];
|
|
119
|
-
constructor(methods: HttpMethod[], path: string, handler: Handler, middlewares?: M[]);
|
|
120
|
-
}
|
|
121
|
+
type Middleware = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
|
|
121
122
|
//#endregion
|
|
122
|
-
export {
|
|
123
|
+
export { H3App as a, Middleware$1 as c, RouteInfo as d, Route as i, ControllerAction as l, HttpContext as n, Handler$1 as o, Middleware as r, HttpContext$1 as s, Handler as t, HttpMethod as u };
|
package/dist/h3/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_Route = require('../Route-
|
|
2
|
+
const require_Route = require('../Route-97p-tEbS.cjs');
|
|
3
3
|
let h3 = require("h3");
|
|
4
4
|
|
|
5
5
|
//#region src/h3/router.ts
|
|
@@ -244,7 +244,7 @@ var Router = class Router {
|
|
|
244
244
|
try {
|
|
245
245
|
const ctx = event;
|
|
246
246
|
const inst = instance ?? route;
|
|
247
|
-
await Router.bindRequestToInstance(ctx, inst);
|
|
247
|
+
await Router.bindRequestToInstance(ctx, inst, route);
|
|
248
248
|
const result = handlerFunction(ctx, inst.clearRequest);
|
|
249
249
|
return await Promise.resolve(result);
|
|
250
250
|
} catch (error) {
|
|
@@ -255,7 +255,7 @@ var Router = class Router {
|
|
|
255
255
|
}
|
|
256
256
|
return app;
|
|
257
257
|
}
|
|
258
|
-
static async bindRequestToInstance(ctx, instance) {
|
|
258
|
+
static async bindRequestToInstance(ctx, instance, route) {
|
|
259
259
|
if (!instance) return;
|
|
260
260
|
instance.ctx = ctx;
|
|
261
261
|
instance.body = await (0, h3.readBody)(ctx) ?? {};
|
|
@@ -263,6 +263,7 @@ var Router = class Router {
|
|
|
263
263
|
instance.params = (0, h3.getRouterParams)(ctx, { decode: true });
|
|
264
264
|
instance.clearRequest = new require_Route.ClearRequest({
|
|
265
265
|
ctx,
|
|
266
|
+
route,
|
|
266
267
|
body: instance.body,
|
|
267
268
|
query: instance.query,
|
|
268
269
|
params: instance.params
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Middleware, d as RouteInfo, i as
|
|
1
|
+
import { a as H3App, c as Middleware, d as RouteInfo, i as Route, l as ControllerAction, o as Handler, s as HttpContext, u as HttpMethod } from "../express-C77arBZx.js";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
package/dist/h3/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ClearRequest, t as Route } from "../Route-
|
|
1
|
+
import { n as ClearRequest, t as Route } from "../Route-BtmoiYq5.mjs";
|
|
2
2
|
import { getQuery, getRouterParams, readBody } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.ts
|
|
@@ -243,7 +243,7 @@ var Router = class Router {
|
|
|
243
243
|
try {
|
|
244
244
|
const ctx = event;
|
|
245
245
|
const inst = instance ?? route;
|
|
246
|
-
await Router.bindRequestToInstance(ctx, inst);
|
|
246
|
+
await Router.bindRequestToInstance(ctx, inst, route);
|
|
247
247
|
const result = handlerFunction(ctx, inst.clearRequest);
|
|
248
248
|
return await Promise.resolve(result);
|
|
249
249
|
} catch (error) {
|
|
@@ -254,7 +254,7 @@ var Router = class Router {
|
|
|
254
254
|
}
|
|
255
255
|
return app;
|
|
256
256
|
}
|
|
257
|
-
static async bindRequestToInstance(ctx, instance) {
|
|
257
|
+
static async bindRequestToInstance(ctx, instance, route) {
|
|
258
258
|
if (!instance) return;
|
|
259
259
|
instance.ctx = ctx;
|
|
260
260
|
instance.body = await readBody(ctx) ?? {};
|
|
@@ -262,6 +262,7 @@ var Router = class Router {
|
|
|
262
262
|
instance.params = getRouterParams(ctx, { decode: true });
|
|
263
263
|
instance.clearRequest = new ClearRequest({
|
|
264
264
|
ctx,
|
|
265
|
+
route,
|
|
265
266
|
body: instance.body,
|
|
266
267
|
query: instance.query,
|
|
267
268
|
params: instance.params
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/ClearRequest.ts
|
|
4
|
+
var ClearRequest = class {
|
|
5
|
+
/**
|
|
6
|
+
* @param body - Parsed request body
|
|
7
|
+
*/
|
|
8
|
+
body;
|
|
9
|
+
/**
|
|
10
|
+
* @param query - Parsed query parameters
|
|
11
|
+
*/
|
|
12
|
+
query;
|
|
13
|
+
/**
|
|
14
|
+
* @param params - Parsed route parameters
|
|
15
|
+
*/
|
|
16
|
+
params;
|
|
17
|
+
route;
|
|
18
|
+
constructor(init) {
|
|
19
|
+
Object.assign(this, init);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/Controller.ts
|
|
25
|
+
var Controller = class {
|
|
26
|
+
ctx;
|
|
27
|
+
body;
|
|
28
|
+
query;
|
|
29
|
+
params;
|
|
30
|
+
clearRequest;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/Route.ts
|
|
35
|
+
var Route = class {
|
|
36
|
+
ctx;
|
|
37
|
+
body = {};
|
|
38
|
+
query = {};
|
|
39
|
+
params = {};
|
|
40
|
+
clearRequest;
|
|
41
|
+
methods;
|
|
42
|
+
path;
|
|
43
|
+
handler;
|
|
44
|
+
middlewares;
|
|
45
|
+
constructor(methods, path, handler, middlewares = []) {
|
|
46
|
+
this.methods = methods;
|
|
47
|
+
this.path = path;
|
|
48
|
+
this.handler = handler;
|
|
49
|
+
this.middlewares = middlewares;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.ClearRequest = ClearRequest;
|
|
55
|
+
exports.Controller = Controller;
|
|
56
|
+
exports.Route = Route;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { NextFunction, Request, Response as Response$1 } from "express";
|
|
2
|
+
import { H3Event, Middleware } from "h3";
|
|
3
|
+
|
|
4
|
+
//#region types/basic.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Controller method reference
|
|
7
|
+
*/
|
|
8
|
+
type ControllerHandler = [any, string];
|
|
9
|
+
/**
|
|
10
|
+
* HTTP methods supported by the router
|
|
11
|
+
*/
|
|
12
|
+
type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head';
|
|
13
|
+
/**
|
|
14
|
+
* Generic Object type for request data
|
|
15
|
+
*/
|
|
16
|
+
type RequestData = Record<string, any>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region types/express.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Middleware function type
|
|
21
|
+
*/
|
|
22
|
+
type Middleware$1 = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region types/h3.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* HTTP context passed to route handlers
|
|
27
|
+
*/
|
|
28
|
+
type HttpContext = H3Event & {};
|
|
29
|
+
/**
|
|
30
|
+
* Route handler function type
|
|
31
|
+
*/
|
|
32
|
+
type RouteHandler = (
|
|
33
|
+
/**
|
|
34
|
+
* H3 event context
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
ctx: HttpContext,
|
|
38
|
+
/**
|
|
39
|
+
* ClearRequest instance
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
req: ClearRequest) => any | Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Handler can be either a function or controller reference
|
|
45
|
+
*/
|
|
46
|
+
type Handler = RouteHandler | ControllerHandler;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/Route.d.ts
|
|
49
|
+
declare class Route<X = any, M = Middleware | Middleware$1> {
|
|
50
|
+
ctx: X;
|
|
51
|
+
body: RequestData;
|
|
52
|
+
query: RequestData;
|
|
53
|
+
params: RequestData;
|
|
54
|
+
clearRequest: ClearRequest;
|
|
55
|
+
methods: HttpMethod[];
|
|
56
|
+
path: string;
|
|
57
|
+
handler: Handler;
|
|
58
|
+
middlewares: M[];
|
|
59
|
+
constructor(methods: HttpMethod[], path: string, handler: Handler, middlewares?: M[]);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/ClearRequest.d.ts
|
|
63
|
+
declare class ClearRequest<X = any, M = Middleware | Middleware$1> {
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
/**
|
|
66
|
+
* @param body - Parsed request body
|
|
67
|
+
*/
|
|
68
|
+
body: RequestData;
|
|
69
|
+
/**
|
|
70
|
+
* @param query - Parsed query parameters
|
|
71
|
+
*/
|
|
72
|
+
query: RequestData;
|
|
73
|
+
/**
|
|
74
|
+
* @param params - Parsed route parameters
|
|
75
|
+
*/
|
|
76
|
+
params: RequestData;
|
|
77
|
+
route: Route<X, M>;
|
|
78
|
+
constructor(init?: Partial<ClearRequest>);
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/Controller.d.ts
|
|
82
|
+
declare abstract class Controller<X = any> {
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
ctx: X;
|
|
85
|
+
body: RequestData;
|
|
86
|
+
query: RequestData;
|
|
87
|
+
params: RequestData;
|
|
88
|
+
clearRequest: ClearRequest;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { ClearRequest, Controller, Route };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/ClearRequest.ts
|
|
2
|
+
var ClearRequest = class {
|
|
3
|
+
/**
|
|
4
|
+
* @param body - Parsed request body
|
|
5
|
+
*/
|
|
6
|
+
body;
|
|
7
|
+
/**
|
|
8
|
+
* @param query - Parsed query parameters
|
|
9
|
+
*/
|
|
10
|
+
query;
|
|
11
|
+
/**
|
|
12
|
+
* @param params - Parsed route parameters
|
|
13
|
+
*/
|
|
14
|
+
params;
|
|
15
|
+
route;
|
|
16
|
+
constructor(init) {
|
|
17
|
+
Object.assign(this, init);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/Controller.ts
|
|
23
|
+
var Controller = class {
|
|
24
|
+
ctx;
|
|
25
|
+
body;
|
|
26
|
+
query;
|
|
27
|
+
params;
|
|
28
|
+
clearRequest;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/Route.ts
|
|
33
|
+
var Route = class {
|
|
34
|
+
ctx;
|
|
35
|
+
body = {};
|
|
36
|
+
query = {};
|
|
37
|
+
params = {};
|
|
38
|
+
clearRequest;
|
|
39
|
+
methods;
|
|
40
|
+
path;
|
|
41
|
+
handler;
|
|
42
|
+
middlewares;
|
|
43
|
+
constructor(methods, path, handler, middlewares = []) {
|
|
44
|
+
this.methods = methods;
|
|
45
|
+
this.path = path;
|
|
46
|
+
this.handler = handler;
|
|
47
|
+
this.middlewares = middlewares;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { ClearRequest, Controller, Route };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.
|
|
2
|
-
import { ClearRequest } from "../src/ClearRequest.
|
|
1
|
+
import { ControllerHandler } from "./basic.js";
|
|
2
|
+
import { ClearRequest } from "../src/ClearRequest.js";
|
|
3
3
|
import { NextFunction, Request, Response } from "express";
|
|
4
4
|
|
|
5
5
|
//#region types/express.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.
|
|
2
|
-
import { ClearRequest } from "../src/ClearRequest.
|
|
1
|
+
import { ControllerHandler } from "./basic.js";
|
|
2
|
+
import { ClearRequest } from "../src/ClearRequest.js";
|
|
3
3
|
import { H3, H3Event, Middleware, TypedServerRequest } from "h3";
|
|
4
4
|
|
|
5
5
|
//#region types/h3.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clear-router",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Laravel-style routing system for Express.js and H3, with CommonJS, ESM, and TypeScript support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"h3",
|
|
@@ -28,10 +28,14 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"author": "3m1n1nce <3m1n1nce@toneflix.net>",
|
|
30
30
|
"type": "module",
|
|
31
|
-
"main": "dist/
|
|
32
|
-
"module": "dist/
|
|
33
|
-
"types": "dist/
|
|
31
|
+
"main": "./dist/index.cjs",
|
|
32
|
+
"module": "./dist/index.mjs",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
34
|
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": "./dist/index.mjs",
|
|
37
|
+
"require": "./dist/index.cjs"
|
|
38
|
+
},
|
|
35
39
|
"./express": {
|
|
36
40
|
"import": "./dist/express/index.mjs",
|
|
37
41
|
"require": "./dist/express/index.cjs"
|
package/dist/express/index.d.mts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { c as Middleware, d as RouteInfo, l as ControllerAction, o as Handler, s as HttpContext, t as Route, u as HttpMethod } from "../Route-DsnulZob.mjs";
|
|
2
|
-
import { Router as Router$1 } from "express";
|
|
3
|
-
|
|
4
|
-
//#region src/express/router.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* @class clear-router
|
|
7
|
-
* @description Laravel-style routing system for Express.js and H3 with support for CommonJS, ESM, and TypeScript
|
|
8
|
-
* @author Refkinscallv
|
|
9
|
-
* @author 3m1n3nc3
|
|
10
|
-
* @repository https://github.com/toneflix/clear-router
|
|
11
|
-
*/
|
|
12
|
-
declare class Router {
|
|
13
|
-
/**
|
|
14
|
-
* All registered routes
|
|
15
|
-
*/
|
|
16
|
-
static routes: Array<Route<HttpContext, Middleware>>;
|
|
17
|
-
/**
|
|
18
|
-
* Current route prefix
|
|
19
|
-
*/
|
|
20
|
-
static prefix: string;
|
|
21
|
-
/**
|
|
22
|
-
* Group-level middlewares
|
|
23
|
-
*/
|
|
24
|
-
static groupMiddlewares: Middleware[];
|
|
25
|
-
/**
|
|
26
|
-
* Global-level middlewares
|
|
27
|
-
*/
|
|
28
|
-
static globalMiddlewares: Middleware[];
|
|
29
|
-
/**
|
|
30
|
-
* Normalize path by removing duplicate slashes and ensuring leading slash
|
|
31
|
-
* @param path - Path to normalize
|
|
32
|
-
* @returns Normalized path
|
|
33
|
-
*/
|
|
34
|
-
static normalizePath(path: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Add a route with specified HTTP methods, path, handler, and middlewares
|
|
37
|
-
* @param methods - HTTP method(s) for the route
|
|
38
|
-
* @param path - Route path
|
|
39
|
-
* @param handler - Route handler function or controller reference
|
|
40
|
-
* @param middlewares - Array of middleware functions
|
|
41
|
-
*/
|
|
42
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
43
|
-
/**
|
|
44
|
-
* Register RESTful API resource routes for a controller with optional action filtering
|
|
45
|
-
*
|
|
46
|
-
* @param basePath - Base path for the resource
|
|
47
|
-
* @param controller - Controller object containing action methods
|
|
48
|
-
* @param options - Optional filtering options for actions
|
|
49
|
-
*/
|
|
50
|
-
static apiResource(basePath: string, controller: any, options?: {
|
|
51
|
-
only?: ControllerAction[];
|
|
52
|
-
except?: ControllerAction[];
|
|
53
|
-
}): void;
|
|
54
|
-
/**
|
|
55
|
-
* Register a GET route
|
|
56
|
-
* @param path - Route path
|
|
57
|
-
* @param handler - Route handler
|
|
58
|
-
* @param middlewares - Middleware functions
|
|
59
|
-
*/
|
|
60
|
-
static get(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
61
|
-
/**
|
|
62
|
-
* Register a POST route
|
|
63
|
-
* @param path - Route path
|
|
64
|
-
* @param handler - Route handler
|
|
65
|
-
* @param middlewares - Middleware functions
|
|
66
|
-
*/
|
|
67
|
-
static post(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
68
|
-
/**
|
|
69
|
-
* Register a PUT route
|
|
70
|
-
* @param path - Route path
|
|
71
|
-
* @param handler - Route handler
|
|
72
|
-
* @param middlewares - Middleware functions
|
|
73
|
-
*/
|
|
74
|
-
static put(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
75
|
-
/**
|
|
76
|
-
* Register a DELETE route
|
|
77
|
-
* @param path - Route path
|
|
78
|
-
* @param handler - Route handler
|
|
79
|
-
* @param middlewares - Middleware functions
|
|
80
|
-
*/
|
|
81
|
-
static delete(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
82
|
-
/**
|
|
83
|
-
* Register a PATCH route
|
|
84
|
-
* @param path - Route path
|
|
85
|
-
* @param handler - Route handler
|
|
86
|
-
* @param middlewares - Middleware functions
|
|
87
|
-
*/
|
|
88
|
-
static patch(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
89
|
-
/**
|
|
90
|
-
* Register an OPTIONS route
|
|
91
|
-
* @param path - Route path
|
|
92
|
-
* @param handler - Route handler
|
|
93
|
-
* @param middlewares - Middleware functions
|
|
94
|
-
*/
|
|
95
|
-
static options(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
96
|
-
/**
|
|
97
|
-
* Register a HEAD route
|
|
98
|
-
* @param path - Route path
|
|
99
|
-
* @param handler - Route handler
|
|
100
|
-
* @param middlewares - Middleware functions
|
|
101
|
-
*/
|
|
102
|
-
static head(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
103
|
-
/**
|
|
104
|
-
* Group routes with a common prefix and middlewares
|
|
105
|
-
* @param prefix - URL prefix for grouped routes
|
|
106
|
-
* @param callback - Function containing route definitions
|
|
107
|
-
* @param middlewares - Middleware functions applied to all routes in group
|
|
108
|
-
*/
|
|
109
|
-
static group(prefix: string, callback: () => void, middlewares?: Middleware[]): void;
|
|
110
|
-
/**
|
|
111
|
-
* Apply global middlewares for the duration of the callback
|
|
112
|
-
* @param middlewares - Middleware functions
|
|
113
|
-
* @param callback - Function containing route definitions
|
|
114
|
-
*/
|
|
115
|
-
static middleware(middlewares: Middleware[], callback: () => void): void;
|
|
116
|
-
/**
|
|
117
|
-
* Get all registered routes with their information
|
|
118
|
-
* @returns Array of route information objects
|
|
119
|
-
*/
|
|
120
|
-
static allRoutes(): RouteInfo[];
|
|
121
|
-
/**
|
|
122
|
-
* Apply all registered routes to the provided Express Router instance
|
|
123
|
-
* Handles controller-method binding and middleware application
|
|
124
|
-
* All errors are thrown to Express error handling middleware
|
|
125
|
-
*
|
|
126
|
-
* @param router - Express Router instance
|
|
127
|
-
*/
|
|
128
|
-
static apply(router: Router$1): void;
|
|
129
|
-
static apply(router: Router$1): Promise<void>;
|
|
130
|
-
private static bindRequestToInstance;
|
|
131
|
-
}
|
|
132
|
-
//#endregion
|
|
133
|
-
export { Router };
|
package/dist/h3/index.d.mts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { a as Middleware, d as RouteInfo, i as HttpContext, l as ControllerAction, n as H3App, r as Handler, t as Route, u as HttpMethod } from "../Route-DsnulZob.mjs";
|
|
2
|
-
import { H3 } from "h3";
|
|
3
|
-
|
|
4
|
-
//#region src/h3/router.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* @class clear-router
|
|
7
|
-
* @description Laravel-style routing system for Express.js and H3 with support for CommonJS, ESM, and TypeScript
|
|
8
|
-
* @author 3m1n3nc3
|
|
9
|
-
* @repository https://github.com/toneflix/clear-router
|
|
10
|
-
*/
|
|
11
|
-
declare class Router {
|
|
12
|
-
/**
|
|
13
|
-
* All registered routes
|
|
14
|
-
*/
|
|
15
|
-
static routes: Array<Route<HttpContext, Middleware>>;
|
|
16
|
-
/**
|
|
17
|
-
* Current route prefix
|
|
18
|
-
*/
|
|
19
|
-
static prefix: string;
|
|
20
|
-
/**
|
|
21
|
-
* Group-level middlewares
|
|
22
|
-
*/
|
|
23
|
-
static groupMiddlewares: Middleware[];
|
|
24
|
-
/**
|
|
25
|
-
* Global-level middlewares
|
|
26
|
-
*/
|
|
27
|
-
static globalMiddlewares: Middleware[];
|
|
28
|
-
/**
|
|
29
|
-
* Normalize path by removing duplicate slashes and ensuring leading slash
|
|
30
|
-
* @param path - Path to normalize
|
|
31
|
-
* @returns Normalized path
|
|
32
|
-
*/
|
|
33
|
-
static normalizePath(path: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Add a route with specified HTTP methods, path, handler, and middlewares
|
|
36
|
-
* @param methods - HTTP method(s) for the route
|
|
37
|
-
* @param path - Route path
|
|
38
|
-
* @param handler - Route handler function or controller reference
|
|
39
|
-
* @param middlewares - Array of middleware functions
|
|
40
|
-
*/
|
|
41
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
42
|
-
/**
|
|
43
|
-
* Register RESTful API resource routes for a controller with optional action filtering
|
|
44
|
-
*
|
|
45
|
-
* @param basePath - Base path for the resource
|
|
46
|
-
* @param controller - Controller object containing action methods
|
|
47
|
-
* @param options - Optional filtering options for actions
|
|
48
|
-
*/
|
|
49
|
-
static apiResource(basePath: string, controller: any, options?: {
|
|
50
|
-
only?: ControllerAction[];
|
|
51
|
-
except?: ControllerAction[];
|
|
52
|
-
}): void;
|
|
53
|
-
/**
|
|
54
|
-
* Register a GET route
|
|
55
|
-
* @param path - Route path
|
|
56
|
-
* @param handler - Route handler
|
|
57
|
-
* @param middlewares - Middleware functions
|
|
58
|
-
*/
|
|
59
|
-
static get(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
60
|
-
/**
|
|
61
|
-
* Register a POST route
|
|
62
|
-
* @param path - Route path
|
|
63
|
-
* @param handler - Route handler
|
|
64
|
-
* @param middlewares - Middleware functions
|
|
65
|
-
*/
|
|
66
|
-
static post(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
67
|
-
/**
|
|
68
|
-
* Register a PUT route
|
|
69
|
-
* @param path - Route path
|
|
70
|
-
* @param handler - Route handler
|
|
71
|
-
* @param middlewares - Middleware functions
|
|
72
|
-
*/
|
|
73
|
-
static put(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
74
|
-
/**
|
|
75
|
-
* Register a DELETE route
|
|
76
|
-
* @param path - Route path
|
|
77
|
-
* @param handler - Route handler
|
|
78
|
-
* @param middlewares - Middleware functions
|
|
79
|
-
*/
|
|
80
|
-
static delete(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
81
|
-
/**
|
|
82
|
-
* Register a PATCH route
|
|
83
|
-
* @param path - Route path
|
|
84
|
-
* @param handler - Route handler
|
|
85
|
-
* @param middlewares - Middleware functions
|
|
86
|
-
*/
|
|
87
|
-
static patch(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
88
|
-
/**
|
|
89
|
-
* Register an OPTIONS route
|
|
90
|
-
* @param path - Route path
|
|
91
|
-
* @param handler - Route handler
|
|
92
|
-
* @param middlewares - Middleware functions
|
|
93
|
-
*/
|
|
94
|
-
static options(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
95
|
-
/**
|
|
96
|
-
* Register a HEAD route
|
|
97
|
-
* @param path - Route path
|
|
98
|
-
* @param handler - Route handler
|
|
99
|
-
* @param middlewares - Middleware functions
|
|
100
|
-
*/
|
|
101
|
-
static head(path: string, handler: Handler, middlewares?: Middleware[]): void;
|
|
102
|
-
/**
|
|
103
|
-
* Group routes with a common prefix and middlewares
|
|
104
|
-
* @param prefix - URL prefix for grouped routes
|
|
105
|
-
* @param callback - Function containing route definitions
|
|
106
|
-
* @param middlewares - Middleware functions applied to all routes in group
|
|
107
|
-
*/
|
|
108
|
-
static group(prefix: string, callback: () => void, middlewares?: Middleware[]): void;
|
|
109
|
-
/**
|
|
110
|
-
* Apply global middlewares for the duration of the callback
|
|
111
|
-
* @param middlewares - Middleware functions
|
|
112
|
-
* @param callback - Function containing route definitions
|
|
113
|
-
*/
|
|
114
|
-
static middleware(middlewares: Middleware[], callback: () => void): void;
|
|
115
|
-
/**
|
|
116
|
-
* Get all registered routes with their information
|
|
117
|
-
* @returns Array of route information objects
|
|
118
|
-
*/
|
|
119
|
-
static allRoutes(): RouteInfo[];
|
|
120
|
-
/**
|
|
121
|
-
* Apply all registered routes to the provided H3 Router instance
|
|
122
|
-
* Handles controller-method binding and middleware application
|
|
123
|
-
* All errors are thrown to H3 error handling middleware
|
|
124
|
-
*
|
|
125
|
-
* @param app - H3 app instance
|
|
126
|
-
*/
|
|
127
|
-
static apply(app: H3): H3App;
|
|
128
|
-
private static bindRequestToInstance;
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
export { Router };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RequestData } from "../types/basic.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/ClearRequest.d.ts
|
|
4
|
-
declare class ClearRequest {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
/**
|
|
7
|
-
* @param body - Parsed request body
|
|
8
|
-
*/
|
|
9
|
-
body: RequestData;
|
|
10
|
-
/**
|
|
11
|
-
* @param query - Parsed query parameters
|
|
12
|
-
*/
|
|
13
|
-
query: RequestData;
|
|
14
|
-
/**
|
|
15
|
-
* @param params - Parsed route parameters
|
|
16
|
-
*/
|
|
17
|
-
params: RequestData;
|
|
18
|
-
constructor(init?: Partial<ClearRequest>);
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { ClearRequest };
|
|
File without changes
|