clear-router 2.7.2 → 2.7.3
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/Request-DNXqFcES.d.mts +103 -0
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/decorators/setup.d.mts +0 -1
- package/dist/express/index.d.cts +1 -1
- package/dist/express/index.d.mts +1 -1
- package/dist/fastify/index.d.cts +1 -1
- package/dist/fastify/index.d.mts +1 -1
- package/dist/h3/index.d.cts +1 -1
- package/dist/h3/index.d.mts +1 -1
- package/dist/hono/index.d.cts +1 -1
- package/dist/hono/index.d.mts +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/koa/index.d.cts +1 -1
- package/dist/koa/index.d.mts +1 -1
- package/dist/{router-7xO6qBQZ.d.mts → router-BxQ2xVPM.d.mts} +43 -37
- package/dist/{router-CY1BZ3Af.d.cts → router-TAQWO9Tt.d.cts} +43 -37
- package/dist/types/basic.d.mts +6 -2
- package/dist/types/express.d.mts +4 -5
- package/dist/types/fastify.d.mts +4 -5
- package/dist/types/h3.d.mts +5 -6
- package/dist/types/hono.d.mts +6 -6
- package/dist/types/koa.d.mts +5 -5
- package/package.json +1 -1
- package/dist/types/ClearRequest.d.mts +0 -28
- package/dist/types/Route.d.mts +0 -39
- package/dist/types/core/Request.d.mts +0 -25
- package/dist/types/core/Response.d.mts +0 -24
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
export { Response as n, Request as t };
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P 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-TAQWO9Tt.cjs";
|
|
2
2
|
export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P 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-BxQ2xVPM.mjs";
|
|
2
2
|
export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
|
package/dist/express/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, M as HttpContext, N as Middleware, j as Handler, m as Route, t as CoreRouter } from "../router-TAQWO9Tt.cjs";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
package/dist/express/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, M as HttpContext, N as Middleware, j as Handler, m as Route, t as CoreRouter } from "../router-BxQ2xVPM.mjs";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
package/dist/fastify/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Middleware, D as FastifyApp, F as
|
|
1
|
+
import { A as Middleware, D as FastifyApp, F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, O as Handler, k as HttpContext, m as Route, t as CoreRouter } from "../router-TAQWO9Tt.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/fastify/router.d.ts
|
|
4
4
|
/**
|
package/dist/fastify/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Middleware, D as FastifyApp, F as
|
|
1
|
+
import { A as Middleware, D as FastifyApp, F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, O as Handler, k as HttpContext, m as Route, t as CoreRouter } from "../router-BxQ2xVPM.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/fastify/router.d.ts
|
|
4
4
|
/**
|
package/dist/h3/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as H3App, E as Middleware, F as
|
|
1
|
+
import { C as H3App, E as Middleware, F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-TAQWO9Tt.cjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
package/dist/h3/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as H3App, E as Middleware, F as
|
|
1
|
+
import { C as H3App, E as Middleware, F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-BxQ2xVPM.mjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
package/dist/hono/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-TAQWO9Tt.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/hono/router.d.ts
|
|
4
4
|
/**
|
package/dist/hono/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-BxQ2xVPM.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/hono/router.d.ts
|
|
4
4
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { MiddlewareHandler } from "hono";
|
|
|
5
5
|
import Koa from "koa";
|
|
6
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,23 +119,23 @@ 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
|
|
122
|
+
//#region src/types/express.d.ts
|
|
123
123
|
/**
|
|
124
124
|
* Middleware function type
|
|
125
125
|
*/
|
|
126
126
|
type Middleware$3 = (req: Request$1, res: Response$2, next: NextFunction) => any | Promise<any>;
|
|
127
127
|
//#endregion
|
|
128
|
-
//#region types/fastify.d.ts
|
|
128
|
+
//#region src/types/fastify.d.ts
|
|
129
129
|
interface RequestWithGetBody extends FastifyRequest {
|
|
130
130
|
getBody: () => Record<string, any>;
|
|
131
131
|
}
|
|
132
132
|
type NextFunction$1 = (err?: Error) => void;
|
|
133
133
|
type Middleware$2 = (req: RequestWithGetBody, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
|
|
134
134
|
//#endregion
|
|
135
|
-
//#region types/hono.d.ts
|
|
135
|
+
//#region src/types/hono.d.ts
|
|
136
136
|
type Middleware$1 = MiddlewareHandler;
|
|
137
137
|
//#endregion
|
|
138
|
-
//#region types/koa.d.ts
|
|
138
|
+
//#region src/types/koa.d.ts
|
|
139
139
|
type Middleware = Koa.Middleware<any, any>;
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/ClearRequest.d.ts
|
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,23 +119,23 @@ 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
|
|
122
|
+
//#region src/types/express.d.ts
|
|
123
123
|
/**
|
|
124
124
|
* Middleware function type
|
|
125
125
|
*/
|
|
126
126
|
type Middleware$3 = (req: Request$1, res: Response$2, next: NextFunction) => any | Promise<any>;
|
|
127
127
|
//#endregion
|
|
128
|
-
//#region types/fastify.d.ts
|
|
128
|
+
//#region src/types/fastify.d.ts
|
|
129
129
|
interface RequestWithGetBody extends FastifyRequest {
|
|
130
130
|
getBody: () => Record<string, any>;
|
|
131
131
|
}
|
|
132
132
|
type NextFunction$1 = (err?: Error) => void;
|
|
133
133
|
type Middleware$2 = (req: RequestWithGetBody, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
|
|
134
134
|
//#endregion
|
|
135
|
-
//#region types/hono.d.ts
|
|
135
|
+
//#region src/types/hono.d.ts
|
|
136
136
|
type Middleware$1 = MiddlewareHandler;
|
|
137
137
|
//#endregion
|
|
138
|
-
//#region types/koa.d.ts
|
|
138
|
+
//#region src/types/koa.d.ts
|
|
139
139
|
type Middleware = Koa.Middleware<any, any>;
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/ClearRequest.d.ts
|
package/dist/koa/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-TAQWO9Tt.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/koa/router.d.ts
|
|
4
4
|
/**
|
package/dist/koa/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-BxQ2xVPM.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/koa/router.d.ts
|
|
4
4
|
/**
|
|
@@ -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/
|
|
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
|
*/
|
|
@@ -48,6 +25,10 @@ type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
|
|
|
48
25
|
*/
|
|
49
26
|
type RequestData = Record<string, any>;
|
|
50
27
|
type ApiResourceMiddleware<M = any> = M | M[] | { [K in ControllerAction]?: M | M[] };
|
|
28
|
+
/**
|
|
29
|
+
* HTTP context passed to route handlers
|
|
30
|
+
*/
|
|
31
|
+
interface ClearHttpContext {}
|
|
51
32
|
interface RouterConfig {
|
|
52
33
|
/**
|
|
53
34
|
* When enabled, API param name will be infered from the route path.
|
|
@@ -72,14 +53,37 @@ interface RouterConfig {
|
|
|
72
53
|
};
|
|
73
54
|
}
|
|
74
55
|
//#endregion
|
|
75
|
-
//#region
|
|
56
|
+
//#region src/core/Response.d.ts
|
|
57
|
+
declare class Response$2 {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
body: any;
|
|
60
|
+
headers: Headers;
|
|
61
|
+
sent: boolean;
|
|
62
|
+
statusCode: number;
|
|
63
|
+
statusText: string;
|
|
64
|
+
constructor(init?: Partial<Response$2 | globalThis.Response>);
|
|
65
|
+
status(code: number): this;
|
|
66
|
+
setStatusText(text: string): this;
|
|
67
|
+
code(code: number): this;
|
|
68
|
+
setHeader(name: string, value: string): this;
|
|
69
|
+
header(name: string, value: string): this;
|
|
70
|
+
set(name: string, value: string): this;
|
|
71
|
+
type(contentType: string): this;
|
|
72
|
+
send(body?: any): this;
|
|
73
|
+
json(body: any): this;
|
|
74
|
+
html(body: string): this;
|
|
75
|
+
text(body: string): this;
|
|
76
|
+
noContent(): this;
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/types/express.d.ts
|
|
76
80
|
interface RequestWithGetBody$3 extends Request {
|
|
77
81
|
getBody: () => Record<string, any>;
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* HTTP context passed to route handlers
|
|
81
85
|
*/
|
|
82
|
-
interface HttpContext$4 {
|
|
86
|
+
interface HttpContext$4 extends ClearHttpContext {
|
|
83
87
|
req: RequestWithGetBody$3;
|
|
84
88
|
res: Response$1;
|
|
85
89
|
next: NextFunction;
|
|
@@ -109,11 +113,11 @@ type Handler$4 = RouteHandler$4 | ControllerHandler;
|
|
|
109
113
|
*/
|
|
110
114
|
type Middleware$4 = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
|
|
111
115
|
//#endregion
|
|
112
|
-
//#region types/fastify.d.ts
|
|
116
|
+
//#region src/types/fastify.d.ts
|
|
113
117
|
interface RequestWithGetBody$2 extends FastifyRequest {
|
|
114
118
|
getBody: () => Record<string, any>;
|
|
115
119
|
}
|
|
116
|
-
interface HttpContext$3 {
|
|
120
|
+
interface HttpContext$3 extends ClearHttpContext {
|
|
117
121
|
req: RequestWithGetBody$2;
|
|
118
122
|
reply: FastifyReply;
|
|
119
123
|
clearRequest: Request$1;
|
|
@@ -125,18 +129,18 @@ type NextFunction$1 = (err?: Error) => void;
|
|
|
125
129
|
type Middleware$3 = (req: RequestWithGetBody$2, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
|
|
126
130
|
type FastifyApp = FastifyInstance;
|
|
127
131
|
//#endregion
|
|
128
|
-
//#region types/h3.d.ts
|
|
132
|
+
//#region src/types/h3.d.ts
|
|
129
133
|
type H3App = Omit<H3, 'fetch'> & {
|
|
130
134
|
fetch: (request: TypedServerRequest<EventHandlerRequest>) => Promise<Response>;
|
|
131
135
|
};
|
|
132
136
|
interface HttpRequest extends TypedServerRequest<EventHandlerRequest> {
|
|
133
137
|
getBody: () => Record<string, any>;
|
|
134
138
|
}
|
|
135
|
-
type
|
|
139
|
+
type MergedHttpContext$2 = Omit<H3Event, 'req'> & ClearHttpContext;
|
|
136
140
|
/**
|
|
137
141
|
* HTTP context passed to route handlers
|
|
138
142
|
*/
|
|
139
|
-
interface HttpContext$2 extends
|
|
143
|
+
interface HttpContext$2 extends MergedHttpContext$2 {
|
|
140
144
|
req: HttpRequest;
|
|
141
145
|
clearRequest: Request$1;
|
|
142
146
|
clearResponse: Response$2;
|
|
@@ -160,26 +164,28 @@ req: Request$1) => any | Promise<any>;
|
|
|
160
164
|
*/
|
|
161
165
|
type Handler$2 = RouteHandler$2 | ControllerHandler;
|
|
162
166
|
//#endregion
|
|
163
|
-
//#region types/hono.d.ts
|
|
167
|
+
//#region src/types/hono.d.ts
|
|
164
168
|
type RequestWithGetBody$1 = HonoRequest & {
|
|
165
169
|
getBody: () => Record<string, any>;
|
|
166
170
|
};
|
|
167
|
-
type
|
|
171
|
+
type MergedHttpContext$1 = ClearHttpContext & Context;
|
|
172
|
+
interface HttpContext$1 extends MergedHttpContext$1 {
|
|
168
173
|
req: RequestWithGetBody$1;
|
|
169
174
|
clearRequest: Request$1;
|
|
170
175
|
clearResponse: Response$2;
|
|
171
|
-
}
|
|
176
|
+
}
|
|
172
177
|
type RouteHandler$1 = (ctx: HttpContext$1, req: Request$1) => any | Promise<any>;
|
|
173
178
|
type Handler$1 = RouteHandler$1 | ControllerHandler;
|
|
174
179
|
type Middleware$1 = MiddlewareHandler;
|
|
175
180
|
type HonoApp = { [K in 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head']: (path: string, ...handlers: Middleware$1[]) => any };
|
|
176
181
|
//#endregion
|
|
177
|
-
//#region types/koa.d.ts
|
|
182
|
+
//#region src/types/koa.d.ts
|
|
178
183
|
interface RequestWithGetBody extends Koa.Request {
|
|
179
184
|
getBody: () => Record<string, any>;
|
|
180
185
|
body?: any;
|
|
181
186
|
}
|
|
182
|
-
|
|
187
|
+
type MergedHttpContext = ClearHttpContext & Koa.Context;
|
|
188
|
+
interface HttpContext extends MergedHttpContext {
|
|
183
189
|
request: RequestWithGetBody;
|
|
184
190
|
clearRequest: Request$1;
|
|
185
191
|
clearResponse: Response$2;
|
|
@@ -641,4 +647,4 @@ declare abstract class CoreRouter {
|
|
|
641
647
|
}): void;
|
|
642
648
|
}
|
|
643
649
|
//#endregion
|
|
644
|
-
export { Middleware$3 as A, H3App as C, FastifyApp as D, Middleware$2 as E,
|
|
650
|
+
export { Middleware$3 as A, H3App as C, FastifyApp as D, Middleware$2 as E, ApiResourceMiddleware as F, ControllerAction as I, HttpMethod as L, HttpContext$4 as M, Middleware$4 as N, Handler$3 as O, Response$2 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 };
|
|
@@ -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/
|
|
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
|
*/
|
|
@@ -48,6 +25,10 @@ type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
|
|
|
48
25
|
*/
|
|
49
26
|
type RequestData = Record<string, any>;
|
|
50
27
|
type ApiResourceMiddleware<M = any> = M | M[] | { [K in ControllerAction]?: M | M[] };
|
|
28
|
+
/**
|
|
29
|
+
* HTTP context passed to route handlers
|
|
30
|
+
*/
|
|
31
|
+
interface ClearHttpContext {}
|
|
51
32
|
interface RouterConfig {
|
|
52
33
|
/**
|
|
53
34
|
* When enabled, API param name will be infered from the route path.
|
|
@@ -72,14 +53,37 @@ interface RouterConfig {
|
|
|
72
53
|
};
|
|
73
54
|
}
|
|
74
55
|
//#endregion
|
|
75
|
-
//#region
|
|
56
|
+
//#region src/core/Response.d.ts
|
|
57
|
+
declare class Response$2 {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
body: any;
|
|
60
|
+
headers: Headers;
|
|
61
|
+
sent: boolean;
|
|
62
|
+
statusCode: number;
|
|
63
|
+
statusText: string;
|
|
64
|
+
constructor(init?: Partial<Response$2 | globalThis.Response>);
|
|
65
|
+
status(code: number): this;
|
|
66
|
+
setStatusText(text: string): this;
|
|
67
|
+
code(code: number): this;
|
|
68
|
+
setHeader(name: string, value: string): this;
|
|
69
|
+
header(name: string, value: string): this;
|
|
70
|
+
set(name: string, value: string): this;
|
|
71
|
+
type(contentType: string): this;
|
|
72
|
+
send(body?: any): this;
|
|
73
|
+
json(body: any): this;
|
|
74
|
+
html(body: string): this;
|
|
75
|
+
text(body: string): this;
|
|
76
|
+
noContent(): this;
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/types/express.d.ts
|
|
76
80
|
interface RequestWithGetBody$3 extends Request {
|
|
77
81
|
getBody: () => Record<string, any>;
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* HTTP context passed to route handlers
|
|
81
85
|
*/
|
|
82
|
-
interface HttpContext$4 {
|
|
86
|
+
interface HttpContext$4 extends ClearHttpContext {
|
|
83
87
|
req: RequestWithGetBody$3;
|
|
84
88
|
res: Response$1;
|
|
85
89
|
next: NextFunction;
|
|
@@ -109,11 +113,11 @@ type Handler$4 = RouteHandler$4 | ControllerHandler;
|
|
|
109
113
|
*/
|
|
110
114
|
type Middleware$4 = (req: Request, res: Response$1, next: NextFunction) => any | Promise<any>;
|
|
111
115
|
//#endregion
|
|
112
|
-
//#region types/fastify.d.ts
|
|
116
|
+
//#region src/types/fastify.d.ts
|
|
113
117
|
interface RequestWithGetBody$2 extends FastifyRequest {
|
|
114
118
|
getBody: () => Record<string, any>;
|
|
115
119
|
}
|
|
116
|
-
interface HttpContext$3 {
|
|
120
|
+
interface HttpContext$3 extends ClearHttpContext {
|
|
117
121
|
req: RequestWithGetBody$2;
|
|
118
122
|
reply: FastifyReply;
|
|
119
123
|
clearRequest: Request$1;
|
|
@@ -125,18 +129,18 @@ type NextFunction$1 = (err?: Error) => void;
|
|
|
125
129
|
type Middleware$3 = (req: RequestWithGetBody$2, reply: FastifyReply, next: NextFunction$1) => any | Promise<any>;
|
|
126
130
|
type FastifyApp = FastifyInstance;
|
|
127
131
|
//#endregion
|
|
128
|
-
//#region types/h3.d.ts
|
|
132
|
+
//#region src/types/h3.d.ts
|
|
129
133
|
type H3App = Omit<H3, 'fetch'> & {
|
|
130
134
|
fetch: (request: TypedServerRequest<EventHandlerRequest>) => Promise<Response>;
|
|
131
135
|
};
|
|
132
136
|
interface HttpRequest extends TypedServerRequest<EventHandlerRequest> {
|
|
133
137
|
getBody: () => Record<string, any>;
|
|
134
138
|
}
|
|
135
|
-
type
|
|
139
|
+
type MergedHttpContext$2 = Omit<H3Event, 'req'> & ClearHttpContext;
|
|
136
140
|
/**
|
|
137
141
|
* HTTP context passed to route handlers
|
|
138
142
|
*/
|
|
139
|
-
interface HttpContext$2 extends
|
|
143
|
+
interface HttpContext$2 extends MergedHttpContext$2 {
|
|
140
144
|
req: HttpRequest;
|
|
141
145
|
clearRequest: Request$1;
|
|
142
146
|
clearResponse: Response$2;
|
|
@@ -160,26 +164,28 @@ req: Request$1) => any | Promise<any>;
|
|
|
160
164
|
*/
|
|
161
165
|
type Handler$2 = RouteHandler$2 | ControllerHandler;
|
|
162
166
|
//#endregion
|
|
163
|
-
//#region types/hono.d.ts
|
|
167
|
+
//#region src/types/hono.d.ts
|
|
164
168
|
type RequestWithGetBody$1 = HonoRequest & {
|
|
165
169
|
getBody: () => Record<string, any>;
|
|
166
170
|
};
|
|
167
|
-
type
|
|
171
|
+
type MergedHttpContext$1 = ClearHttpContext & Context;
|
|
172
|
+
interface HttpContext$1 extends MergedHttpContext$1 {
|
|
168
173
|
req: RequestWithGetBody$1;
|
|
169
174
|
clearRequest: Request$1;
|
|
170
175
|
clearResponse: Response$2;
|
|
171
|
-
}
|
|
176
|
+
}
|
|
172
177
|
type RouteHandler$1 = (ctx: HttpContext$1, req: Request$1) => any | Promise<any>;
|
|
173
178
|
type Handler$1 = RouteHandler$1 | ControllerHandler;
|
|
174
179
|
type Middleware$1 = MiddlewareHandler;
|
|
175
180
|
type HonoApp = { [K in 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head']: (path: string, ...handlers: Middleware$1[]) => any };
|
|
176
181
|
//#endregion
|
|
177
|
-
//#region types/koa.d.ts
|
|
182
|
+
//#region src/types/koa.d.ts
|
|
178
183
|
interface RequestWithGetBody extends Koa.Request {
|
|
179
184
|
getBody: () => Record<string, any>;
|
|
180
185
|
body?: any;
|
|
181
186
|
}
|
|
182
|
-
|
|
187
|
+
type MergedHttpContext = ClearHttpContext & Koa.Context;
|
|
188
|
+
interface HttpContext extends MergedHttpContext {
|
|
183
189
|
request: RequestWithGetBody;
|
|
184
190
|
clearRequest: Request$1;
|
|
185
191
|
clearResponse: Response$2;
|
|
@@ -641,4 +647,4 @@ declare abstract class CoreRouter {
|
|
|
641
647
|
}): void;
|
|
642
648
|
}
|
|
643
649
|
//#endregion
|
|
644
|
-
export { Middleware$3 as A, H3App as C, FastifyApp as D, Middleware$2 as E,
|
|
650
|
+
export { Middleware$3 as A, H3App as C, FastifyApp as D, Middleware$2 as E, ApiResourceMiddleware as F, ControllerAction as I, HttpMethod as L, HttpContext$4 as M, Middleware$4 as N, Handler$3 as O, Response$2 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 };
|
package/dist/types/basic.d.mts
CHANGED
|
@@ -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
|
*/
|
|
@@ -16,6 +16,10 @@ type ControllerAction = 'index' | 'show' | 'create' | 'update' | 'destroy';
|
|
|
16
16
|
*/
|
|
17
17
|
type RequestData = Record<string, any>;
|
|
18
18
|
type ApiResourceMiddleware<M = any> = M | M[] | { [K in ControllerAction]?: M | M[] };
|
|
19
|
+
/**
|
|
20
|
+
* HTTP context passed to route handlers
|
|
21
|
+
*/
|
|
22
|
+
interface ClearHttpContext {}
|
|
19
23
|
interface RouterConfig {
|
|
20
24
|
/**
|
|
21
25
|
* When enabled, API param name will be infered from the route path.
|
|
@@ -40,4 +44,4 @@ interface RouterConfig {
|
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
//#endregion
|
|
43
|
-
export { ApiResourceMiddleware, ControllerAction, ControllerHandler, HttpMethod, RequestData, RouterConfig };
|
|
47
|
+
export { ApiResourceMiddleware, ClearHttpContext, ControllerAction, ControllerHandler, HttpMethod, RequestData, RouterConfig };
|
package/dist/types/express.d.mts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { Request as Request$1 } from "./core/Request.mjs";
|
|
1
|
+
import { ClearHttpContext, ControllerHandler } from "./basic.mjs";
|
|
2
|
+
import { n as Response$1, t as Request$1 } from "../Request-DNXqFcES.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;
|
package/dist/types/fastify.d.mts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.mjs";
|
|
2
|
-
import { Response } from "
|
|
3
|
-
import { Request } from "./core/Request.mjs";
|
|
1
|
+
import { ClearHttpContext, ControllerHandler } from "./basic.mjs";
|
|
2
|
+
import { n as Response, t as Request } from "../Request-DNXqFcES.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;
|
package/dist/types/h3.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { Request } from "./core/Request.mjs";
|
|
1
|
+
import { ClearHttpContext, ControllerHandler } from "./basic.mjs";
|
|
2
|
+
import { n as Response$1, t as Request } from "../Request-DNXqFcES.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
|
|
13
|
+
type MergedHttpContext = Omit<H3Event, 'req'> & ClearHttpContext;
|
|
15
14
|
/**
|
|
16
15
|
* HTTP context passed to route handlers
|
|
17
16
|
*/
|
|
18
|
-
interface HttpContext extends
|
|
17
|
+
interface HttpContext extends MergedHttpContext {
|
|
19
18
|
req: HttpRequest;
|
|
20
19
|
clearRequest: Request;
|
|
21
20
|
clearResponse: Response$1;
|
package/dist/types/hono.d.mts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.mjs";
|
|
2
|
-
import { Response } from "
|
|
3
|
-
import { Request } from "./core/Request.mjs";
|
|
1
|
+
import { ClearHttpContext, ControllerHandler } from "./basic.mjs";
|
|
2
|
+
import { n as Response, t as Request } from "../Request-DNXqFcES.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
|
|
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>;
|
package/dist/types/koa.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ControllerHandler } from "./basic.mjs";
|
|
2
|
-
import { Response } from "
|
|
3
|
-
import { Request } from "./core/Request.mjs";
|
|
1
|
+
import { ClearHttpContext, ControllerHandler } from "./basic.mjs";
|
|
2
|
+
import { n as Response, t as Request } from "../Request-DNXqFcES.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
|
-
|
|
11
|
+
type MergedHttpContext = ClearHttpContext & Koa.Context;
|
|
12
|
+
interface HttpContext extends MergedHttpContext {
|
|
13
13
|
request: RequestWithGetBody;
|
|
14
14
|
clearRequest: Request;
|
|
15
15
|
clearResponse: Response;
|
package/package.json
CHANGED
|
@@ -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 };
|
package/dist/types/Route.d.mts
DELETED
|
@@ -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 };
|