clear-router 2.8.5 → 2.8.6
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/ClearRequest.d.cts +1 -1
- package/dist/ClearRequest.d.mts +1 -1
- package/dist/Controller.d.cts +1 -1
- package/dist/Controller.d.mts +1 -1
- package/dist/ResourceRoutes.d.cts +1 -1
- package/dist/ResourceRoutes.d.mts +1 -1
- package/dist/Route.d.cts +1 -1
- package/dist/Route.d.mts +1 -1
- package/dist/RouteGroup.d.cts +4 -4
- package/dist/RouteGroup.d.mts +4 -4
- package/dist/core/CoreRouter.d.cts +2 -2
- package/dist/core/CoreRouter.d.mts +2 -2
- package/dist/core/Request.d.cts +2 -2
- package/dist/core/Request.d.mts +2 -2
- package/dist/core/helpers.d.cts +1 -1
- package/dist/core/helpers.d.mts +1 -1
- package/dist/core/plugins.d.cts +1 -1
- package/dist/core/plugins.d.mts +1 -1
- package/dist/decorators/setup.d.mts +0 -1
- package/dist/express/router.d.cts +2 -2
- package/dist/express/router.d.mts +2 -2
- package/dist/fastify/router.d.cts +2 -2
- package/dist/fastify/router.d.mts +2 -2
- package/dist/h3/router.d.cts +2 -2
- package/dist/h3/router.d.mts +2 -2
- package/dist/hono/router.d.cts +2 -2
- package/dist/hono/router.d.mts +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/koa/router.d.cts +2 -2
- package/dist/koa/router.d.mts +2 -2
- package/dist/types/basic.d.cts +7 -5
- package/dist/types/basic.d.mts +7 -5
- package/dist/types/express.d.cts +1 -1
- package/dist/types/express.d.mts +1 -1
- package/dist/types/fastify.d.cts +1 -1
- package/dist/types/fastify.d.mts +1 -1
- package/dist/types/h3.d.cts +1 -1
- package/dist/types/h3.d.mts +1 -1
- package/dist/types/hono.d.cts +1 -1
- package/dist/types/hono.d.mts +1 -1
- package/dist/types/koa.d.cts +1 -1
- package/dist/types/koa.d.mts +1 -1
- package/package.json +1 -1
package/dist/ClearRequest.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RequestData } from "./types/basic.cjs";
|
|
2
1
|
import { Middleware } from "./types/express.cjs";
|
|
3
2
|
import { Middleware as Middleware$1 } from "./types/fastify.cjs";
|
|
4
3
|
import { Middleware as Middleware$2 } from "./types/h3.cjs";
|
|
5
4
|
import { Middleware as Middleware$3 } from "./types/hono.cjs";
|
|
6
5
|
import { Middleware as Middleware$4 } from "./types/koa.cjs";
|
|
7
6
|
import { Route } from "./Route.cjs";
|
|
7
|
+
import { RequestData } from "./types/basic.cjs";
|
|
8
8
|
|
|
9
9
|
//#region src/ClearRequest.d.ts
|
|
10
10
|
declare class ClearRequest<X = any, M = Middleware$2 | Middleware | Middleware$1 | Middleware$3 | Middleware$4> {
|
package/dist/ClearRequest.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RequestData } from "./types/basic.mjs";
|
|
2
1
|
import { Middleware } from "./types/express.mjs";
|
|
3
2
|
import { Middleware as Middleware$1 } from "./types/fastify.mjs";
|
|
4
3
|
import { Middleware as Middleware$2 } from "./types/h3.mjs";
|
|
5
4
|
import { Middleware as Middleware$3 } from "./types/hono.mjs";
|
|
6
5
|
import { Middleware as Middleware$4 } from "./types/koa.mjs";
|
|
7
6
|
import { Route } from "./Route.mjs";
|
|
7
|
+
import { RequestData } from "./types/basic.mjs";
|
|
8
8
|
|
|
9
9
|
//#region src/ClearRequest.d.ts
|
|
10
10
|
declare class ClearRequest<X = any, M = Middleware$2 | Middleware | Middleware$1 | Middleware$3 | Middleware$4> {
|
package/dist/Controller.d.cts
CHANGED
package/dist/Controller.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions } from "./types/basic.cjs";
|
|
2
1
|
import { Middleware } from "./types/express.cjs";
|
|
3
2
|
import { Middleware as Middleware$1 } from "./types/h3.cjs";
|
|
4
3
|
import { Route } from "./Route.cjs";
|
|
4
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions } from "./types/basic.cjs";
|
|
5
5
|
import { ResourceRouteSelection } from "./ResourceRouteSelection.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/ResourceRoutes.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions } from "./types/basic.mjs";
|
|
2
1
|
import { Middleware } from "./types/express.mjs";
|
|
3
2
|
import { Middleware as Middleware$1 } from "./types/h3.mjs";
|
|
4
3
|
import { Route } from "./Route.mjs";
|
|
4
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions } from "./types/basic.mjs";
|
|
5
5
|
import { ResourceRouteSelection } from "./ResourceRouteSelection.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/ResourceRoutes.d.ts
|
package/dist/Route.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HttpMethod, RequestData } from "./types/basic.cjs";
|
|
2
1
|
import { RouteParameter } from "./Contracts.cjs";
|
|
3
2
|
import { Middleware } from "./types/express.cjs";
|
|
4
3
|
import { Middleware as Middleware$1 } from "./types/h3.cjs";
|
|
5
4
|
import { ClearRequest } from "./ClearRequest.cjs";
|
|
5
|
+
import { HttpMethod, RequestData } from "./types/basic.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/Route.d.ts
|
|
8
8
|
/**
|
package/dist/Route.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HttpMethod, RequestData } from "./types/basic.mjs";
|
|
2
1
|
import { RouteParameter } from "./Contracts.mjs";
|
|
3
2
|
import { Middleware } from "./types/express.mjs";
|
|
4
3
|
import { Middleware as Middleware$1 } from "./types/h3.mjs";
|
|
5
4
|
import { ClearRequest } from "./ClearRequest.mjs";
|
|
5
|
+
import { HttpMethod, RequestData } from "./types/basic.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/Route.d.ts
|
|
8
8
|
/**
|
package/dist/RouteGroup.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RouteGroupCondition, RouteGroupOptions } from "./types/basic.cjs";
|
|
2
1
|
import { Middleware } from "./types/express.cjs";
|
|
3
2
|
import { Middleware as Middleware$1 } from "./types/h3.cjs";
|
|
3
|
+
import { RouteGroupCondition, RouteGroupOptions, RouteGroupSource } from "./types/basic.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/RouteGroup.d.ts
|
|
6
6
|
/**
|
|
@@ -9,21 +9,21 @@ import { Middleware as Middleware$1 } from "./types/h3.cjs";
|
|
|
9
9
|
* @author 3m1n3nc3
|
|
10
10
|
* @repository https://github.com/arkstack-tmp/clear-router
|
|
11
11
|
*/
|
|
12
|
-
declare class RouteGroup<X = any, M = Middleware$1 | Middleware, H = any> implements PromiseLike<void> {
|
|
12
|
+
declare class RouteGroup<X = any, M = Middleware$1 | Middleware, H = any, S extends RouteGroupSource = RouteGroupSource> implements PromiseLike<void> {
|
|
13
13
|
private readonly options;
|
|
14
14
|
private readonly checks;
|
|
15
15
|
private readonly conditions;
|
|
16
16
|
private readonly registration;
|
|
17
17
|
private readonly routes;
|
|
18
18
|
private readonly unfilteredSources;
|
|
19
|
-
constructor(options: RouteGroupOptions);
|
|
19
|
+
constructor(options: RouteGroupOptions<S>);
|
|
20
20
|
/**
|
|
21
21
|
* Returning a falsy value will stop route group registration
|
|
22
22
|
*
|
|
23
23
|
* @param condition
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
|
-
when(condition: RouteGroupCondition): this;
|
|
26
|
+
when(condition: RouteGroupCondition<S>): this;
|
|
27
27
|
/**
|
|
28
28
|
* Register one or more middleware that will be executed before every route in the group.
|
|
29
29
|
*
|
package/dist/RouteGroup.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RouteGroupCondition, RouteGroupOptions } from "./types/basic.mjs";
|
|
2
1
|
import { Middleware } from "./types/express.mjs";
|
|
3
2
|
import { Middleware as Middleware$1 } from "./types/h3.mjs";
|
|
3
|
+
import { RouteGroupCondition, RouteGroupOptions, RouteGroupSource } from "./types/basic.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/RouteGroup.d.ts
|
|
6
6
|
/**
|
|
@@ -9,21 +9,21 @@ import { Middleware as Middleware$1 } from "./types/h3.mjs";
|
|
|
9
9
|
* @author 3m1n3nc3
|
|
10
10
|
* @repository https://github.com/arkstack-tmp/clear-router
|
|
11
11
|
*/
|
|
12
|
-
declare class RouteGroup<X = any, M = Middleware$1 | Middleware, H = any> implements PromiseLike<void> {
|
|
12
|
+
declare class RouteGroup<X = any, M = Middleware$1 | Middleware, H = any, S extends RouteGroupSource = RouteGroupSource> implements PromiseLike<void> {
|
|
13
13
|
private readonly options;
|
|
14
14
|
private readonly checks;
|
|
15
15
|
private readonly conditions;
|
|
16
16
|
private readonly registration;
|
|
17
17
|
private readonly routes;
|
|
18
18
|
private readonly unfilteredSources;
|
|
19
|
-
constructor(options: RouteGroupOptions);
|
|
19
|
+
constructor(options: RouteGroupOptions<S>);
|
|
20
20
|
/**
|
|
21
21
|
* Returning a falsy value will stop route group registration
|
|
22
22
|
*
|
|
23
23
|
* @param condition
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
|
-
when(condition: RouteGroupCondition): this;
|
|
26
|
+
when(condition: RouteGroupCondition<S>): this;
|
|
27
27
|
/**
|
|
28
28
|
* Register one or more middleware that will be executed before every route in the group.
|
|
29
29
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupContext, RouteGroupSource, RouterConfig } from "../types/basic.cjs";
|
|
2
1
|
import { Response } from "./Response.cjs";
|
|
3
2
|
import { Route } from "../Route.cjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupContext, RouteGroupSource, RouterConfig } from "../types/basic.cjs";
|
|
4
4
|
import { Request } from "./Request.cjs";
|
|
5
5
|
import { ClearRouterPluginArgumentsContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, PluginArgumentsResolver, PluginBind } from "./plugins.cjs";
|
|
6
6
|
import { Controller } from "../Controller.cjs";
|
|
@@ -214,7 +214,7 @@ declare abstract class CoreRouter {
|
|
|
214
214
|
* @param callback
|
|
215
215
|
* @param middlewares
|
|
216
216
|
*/
|
|
217
|
-
static group(prefix: string, source:
|
|
217
|
+
static group<S extends RouteGroupSource>(prefix: string, source: S, middlewares?: any[]): RouteGroup<any, any, any, S>;
|
|
218
218
|
/**
|
|
219
219
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
220
220
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupContext, RouteGroupSource, RouterConfig } from "../types/basic.mjs";
|
|
2
1
|
import { Response } from "./Response.mjs";
|
|
3
2
|
import { Route } from "../Route.mjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupContext, RouteGroupSource, RouterConfig } from "../types/basic.mjs";
|
|
4
4
|
import { Request } from "./Request.mjs";
|
|
5
5
|
import { ClearRouterPluginArgumentsContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, PluginArgumentsResolver, PluginBind } from "./plugins.mjs";
|
|
6
6
|
import { Controller } from "../Controller.mjs";
|
|
@@ -214,7 +214,7 @@ declare abstract class CoreRouter {
|
|
|
214
214
|
* @param callback
|
|
215
215
|
* @param middlewares
|
|
216
216
|
*/
|
|
217
|
-
static group(prefix: string, source:
|
|
217
|
+
static group<S extends RouteGroupSource>(prefix: string, source: S, middlewares?: any[]): RouteGroup<any, any, any, S>;
|
|
218
218
|
/**
|
|
219
219
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
220
220
|
*
|
package/dist/core/Request.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HttpMethod, RequestData } from "../types/basic.cjs";
|
|
2
|
-
import { Route } from "../Route.cjs";
|
|
3
1
|
import { ClearRequest } from "../ClearRequest.cjs";
|
|
2
|
+
import { Route } from "../Route.cjs";
|
|
3
|
+
import { HttpMethod, RequestData } from "../types/basic.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/core/Request.d.ts
|
|
6
6
|
declare class Request<X = any, M = any> extends ClearRequest<X, M> {
|
package/dist/core/Request.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HttpMethod, RequestData } from "../types/basic.mjs";
|
|
2
|
-
import { Route } from "../Route.mjs";
|
|
3
1
|
import { ClearRequest } from "../ClearRequest.mjs";
|
|
2
|
+
import { Route } from "../Route.mjs";
|
|
3
|
+
import { HttpMethod, RequestData } from "../types/basic.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/core/Request.d.ts
|
|
6
6
|
declare class Request<X = any, M = any> extends ClearRequest<X, M> {
|
package/dist/core/helpers.d.cts
CHANGED
package/dist/core/helpers.d.mts
CHANGED
package/dist/core/plugins.d.cts
CHANGED
package/dist/core/plugins.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
2
1
|
import { Handler, HttpContext, Middleware } from "../types/express.cjs";
|
|
3
2
|
import { Route } from "../Route.cjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -102,7 +102,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group<T = any>(prefix: string, source:
|
|
105
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
2
1
|
import { Handler, HttpContext, Middleware } from "../types/express.mjs";
|
|
3
2
|
import { Route } from "../Route.mjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -102,7 +102,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group<T = any>(prefix: string, source:
|
|
105
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
2
1
|
import { FastifyApp, Handler, HttpContext, Middleware } from "../types/fastify.cjs";
|
|
3
2
|
import { Route } from "../Route.cjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -100,7 +100,7 @@ declare class Router extends CoreRouter {
|
|
|
100
100
|
* @param callback
|
|
101
101
|
* @param middlewares
|
|
102
102
|
*/
|
|
103
|
-
static group<T = any>(prefix: string, source:
|
|
103
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
104
104
|
/**
|
|
105
105
|
* Apply middlewares to a group of routes defined within the callback
|
|
106
106
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
2
1
|
import { FastifyApp, Handler, HttpContext, Middleware } from "../types/fastify.mjs";
|
|
3
2
|
import { Route } from "../Route.mjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -100,7 +100,7 @@ declare class Router extends CoreRouter {
|
|
|
100
100
|
* @param callback
|
|
101
101
|
* @param middlewares
|
|
102
102
|
*/
|
|
103
|
-
static group<T = any>(prefix: string, source:
|
|
103
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
104
104
|
/**
|
|
105
105
|
* Apply middlewares to a group of routes defined within the callback
|
|
106
106
|
*
|
package/dist/h3/router.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
2
1
|
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "../types/h3.cjs";
|
|
3
2
|
import { Route } from "../Route.cjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group<T = any>(prefix: string, source:
|
|
105
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware$1[]): RouteGroup<HttpContext, Middleware$1, Handler<T>, S>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
package/dist/h3/router.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
2
1
|
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "../types/h3.mjs";
|
|
3
2
|
import { Route } from "../Route.mjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group<T = any>(prefix: string, source:
|
|
105
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware$1[]): RouteGroup<HttpContext, Middleware$1, Handler<T>, S>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
package/dist/hono/router.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
2
1
|
import { Handler, HonoApp, HttpContext, Middleware } from "../types/hono.cjs";
|
|
3
2
|
import { Route } from "../Route.cjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group<T = any>(prefix: string, source:
|
|
105
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
106
106
|
/**
|
|
107
107
|
* Apply middlewares to a group of routes defined within the callback
|
|
108
108
|
*
|
package/dist/hono/router.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
2
1
|
import { Handler, HonoApp, HttpContext, Middleware } from "../types/hono.mjs";
|
|
3
2
|
import { Route } from "../Route.mjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group<T = any>(prefix: string, source:
|
|
105
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
106
106
|
/**
|
|
107
107
|
* Apply middlewares to a group of routes defined within the callback
|
|
108
108
|
*
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClearHttpContext, RouteParameter } from "./Contracts.cjs";
|
|
2
2
|
import { Response } from "./core/Response.cjs";
|
|
3
|
-
import { Route } from "./Route.cjs";
|
|
4
3
|
import { ClearRequest } from "./ClearRequest.cjs";
|
|
4
|
+
import { Route } from "./Route.cjs";
|
|
5
5
|
import { Request } from "./core/Request.cjs";
|
|
6
6
|
import { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, definePlugin } from "./core/plugins.cjs";
|
|
7
7
|
import { Controller } from "./Controller.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClearHttpContext, RouteParameter } from "./Contracts.mjs";
|
|
2
2
|
import { Response } from "./core/Response.mjs";
|
|
3
|
-
import { Route } from "./Route.mjs";
|
|
4
3
|
import { ClearRequest } from "./ClearRequest.mjs";
|
|
4
|
+
import { Route } from "./Route.mjs";
|
|
5
5
|
import { Request } from "./core/Request.mjs";
|
|
6
6
|
import { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, definePlugin } from "./core/plugins.mjs";
|
|
7
7
|
import { Controller } from "./Controller.mjs";
|
package/dist/koa/router.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
2
1
|
import { Handler, HttpContext, KoaRouterApp, Middleware } from "../types/koa.cjs";
|
|
3
2
|
import { Route } from "../Route.cjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -103,7 +103,7 @@ declare class Router extends CoreRouter {
|
|
|
103
103
|
* @param callback
|
|
104
104
|
* @param middlewares
|
|
105
105
|
*/
|
|
106
|
-
static group<T = any>(prefix: string, source:
|
|
106
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
107
107
|
/**
|
|
108
108
|
* Apply middlewares to a group of routes defined within the callback
|
|
109
109
|
*
|
package/dist/koa/router.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
2
1
|
import { Handler, HttpContext, KoaRouterApp, Middleware } from "../types/koa.mjs";
|
|
3
2
|
import { Route } from "../Route.mjs";
|
|
3
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -103,7 +103,7 @@ declare class Router extends CoreRouter {
|
|
|
103
103
|
* @param callback
|
|
104
104
|
* @param middlewares
|
|
105
105
|
*/
|
|
106
|
-
static group<T = any>(prefix: string, source:
|
|
106
|
+
static group<T = any, S extends RouteGroupSource = RouteGroupSource>(prefix: string, source: S, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>, S>;
|
|
107
107
|
/**
|
|
108
108
|
* Apply middlewares to a group of routes defined within the callback
|
|
109
109
|
*
|
package/dist/types/basic.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Route } from "../Route.cjs";
|
|
1
2
|
import { JitiOptions, JitiResolveOptions } from "jiti";
|
|
2
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
import { Route } from "src/Route";
|
|
4
4
|
|
|
5
5
|
//#region src/types/basic.d.ts
|
|
6
6
|
type OwnStatics<T> = Omit<T, keyof Function | 'prototype'>;
|
|
@@ -12,6 +12,8 @@ type MaybePromise<T = any> = T | Promise<T>;
|
|
|
12
12
|
type RouteGroupCallback = () => MaybePromise<any>;
|
|
13
13
|
type RouteGroupEntry = RouteGroupCallback | string;
|
|
14
14
|
type RouteGroupSource = RouteGroupEntry | RouteGroupEntry[];
|
|
15
|
+
type RouteGroupConditionEntry<S extends RouteGroupEntry> = S extends string ? string : S;
|
|
16
|
+
type RouteGroupConditionSource<S extends RouteGroupSource> = RouteGroupConditionEntry<S extends RouteGroupEntry[] ? S[number] : Extract<S, RouteGroupEntry>>;
|
|
15
17
|
type MiddlewareHandle<Args extends any[] = any[], Return = any> = (...args: Args) => MaybePromise<Return>;
|
|
16
18
|
type MiddlewareClass<M extends MiddlewareHandle = MiddlewareHandle> = new () => {
|
|
17
19
|
handle: M;
|
|
@@ -79,9 +81,9 @@ interface RouteGroupContext {
|
|
|
79
81
|
groupMiddlewares: any[];
|
|
80
82
|
routeCollectors?: Array<Set<Route<any, any, any>>>;
|
|
81
83
|
}
|
|
82
|
-
interface RouteGroupOptions {
|
|
84
|
+
interface RouteGroupOptions<S extends RouteGroupSource = RouteGroupSource> {
|
|
83
85
|
prefix: string;
|
|
84
|
-
source:
|
|
86
|
+
source: S;
|
|
85
87
|
middlewares?: any[];
|
|
86
88
|
context: AsyncLocalStorage<RouteGroupContext>;
|
|
87
89
|
defaultPrefix: string;
|
|
@@ -89,7 +91,7 @@ interface RouteGroupOptions {
|
|
|
89
91
|
normalizePath: (path: string) => string;
|
|
90
92
|
removeRoute: (route: Route<any, any, any>) => void;
|
|
91
93
|
}
|
|
92
|
-
type RouteGroupCondition = (source:
|
|
94
|
+
type RouteGroupCondition<S extends RouteGroupSource = RouteGroupSource> = (source: RouteGroupConditionSource<S>) => MaybePromise<unknown>;
|
|
93
95
|
interface FileImporter {
|
|
94
96
|
<T = unknown>(filePath: string): Promise<T>;
|
|
95
97
|
<T = unknown>(filePath: string, userOptions?: JitiOptions | undefined): Promise<T>;
|
|
@@ -98,4 +100,4 @@ interface FileImporter {
|
|
|
98
100
|
})): Promise<T>;
|
|
99
101
|
}
|
|
100
102
|
//#endregion
|
|
101
|
-
export { ApiResourceMiddleware, ClassMiddleware, ControllerHandler, FileImporter, HttpMethod, MaybePromise, MiddlewareClass, MiddlewareHandle, MiddlewareInstance, RequestData, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions, RouteGroupCallback, RouteGroupCondition, RouteGroupContext, RouteGroupEntry, RouteGroupOptions, RouteGroupSource, RouterConfig };
|
|
103
|
+
export { ApiResourceMiddleware, ClassMiddleware, ControllerHandler, FileImporter, HttpMethod, MaybePromise, MiddlewareClass, MiddlewareHandle, MiddlewareInstance, RequestData, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions, RouteGroupCallback, RouteGroupCondition, RouteGroupConditionEntry, RouteGroupConditionSource, RouteGroupContext, RouteGroupEntry, RouteGroupOptions, RouteGroupSource, RouterConfig };
|
package/dist/types/basic.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Route } from "../Route.mjs";
|
|
1
2
|
import { JitiOptions, JitiResolveOptions } from "jiti";
|
|
2
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
import { Route } from "src/Route";
|
|
4
4
|
|
|
5
5
|
//#region src/types/basic.d.ts
|
|
6
6
|
type OwnStatics<T> = Omit<T, keyof Function | 'prototype'>;
|
|
@@ -12,6 +12,8 @@ type MaybePromise<T = any> = T | Promise<T>;
|
|
|
12
12
|
type RouteGroupCallback = () => MaybePromise<any>;
|
|
13
13
|
type RouteGroupEntry = RouteGroupCallback | string;
|
|
14
14
|
type RouteGroupSource = RouteGroupEntry | RouteGroupEntry[];
|
|
15
|
+
type RouteGroupConditionEntry<S extends RouteGroupEntry> = S extends string ? string : S;
|
|
16
|
+
type RouteGroupConditionSource<S extends RouteGroupSource> = RouteGroupConditionEntry<S extends RouteGroupEntry[] ? S[number] : Extract<S, RouteGroupEntry>>;
|
|
15
17
|
type MiddlewareHandle<Args extends any[] = any[], Return = any> = (...args: Args) => MaybePromise<Return>;
|
|
16
18
|
type MiddlewareClass<M extends MiddlewareHandle = MiddlewareHandle> = new () => {
|
|
17
19
|
handle: M;
|
|
@@ -79,9 +81,9 @@ interface RouteGroupContext {
|
|
|
79
81
|
groupMiddlewares: any[];
|
|
80
82
|
routeCollectors?: Array<Set<Route<any, any, any>>>;
|
|
81
83
|
}
|
|
82
|
-
interface RouteGroupOptions {
|
|
84
|
+
interface RouteGroupOptions<S extends RouteGroupSource = RouteGroupSource> {
|
|
83
85
|
prefix: string;
|
|
84
|
-
source:
|
|
86
|
+
source: S;
|
|
85
87
|
middlewares?: any[];
|
|
86
88
|
context: AsyncLocalStorage<RouteGroupContext>;
|
|
87
89
|
defaultPrefix: string;
|
|
@@ -89,7 +91,7 @@ interface RouteGroupOptions {
|
|
|
89
91
|
normalizePath: (path: string) => string;
|
|
90
92
|
removeRoute: (route: Route<any, any, any>) => void;
|
|
91
93
|
}
|
|
92
|
-
type RouteGroupCondition = (source:
|
|
94
|
+
type RouteGroupCondition<S extends RouteGroupSource = RouteGroupSource> = (source: RouteGroupConditionSource<S>) => MaybePromise<unknown>;
|
|
93
95
|
interface FileImporter {
|
|
94
96
|
<T = unknown>(filePath: string): Promise<T>;
|
|
95
97
|
<T = unknown>(filePath: string, userOptions?: JitiOptions | undefined): Promise<T>;
|
|
@@ -98,4 +100,4 @@ interface FileImporter {
|
|
|
98
100
|
})): Promise<T>;
|
|
99
101
|
}
|
|
100
102
|
//#endregion
|
|
101
|
-
export { ApiResourceMiddleware, ClassMiddleware, ControllerHandler, FileImporter, HttpMethod, MaybePromise, MiddlewareClass, MiddlewareHandle, MiddlewareInstance, RequestData, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions, RouteGroupCallback, RouteGroupCondition, RouteGroupContext, RouteGroupEntry, RouteGroupOptions, RouteGroupSource, RouterConfig };
|
|
103
|
+
export { ApiResourceMiddleware, ClassMiddleware, ControllerHandler, FileImporter, HttpMethod, MaybePromise, MiddlewareClass, MiddlewareHandle, MiddlewareInstance, RequestData, ResourceAction, ResourceRouteDefinition, ResourceRouteRegistrar, ResourceRouteRemover, ResourceRoutesOptions, RouteGroupCallback, RouteGroupCondition, RouteGroupConditionEntry, RouteGroupConditionSource, RouteGroupContext, RouteGroupEntry, RouteGroupOptions, RouteGroupSource, RouterConfig };
|
package/dist/types/express.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.cjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.cjs";
|
|
3
2
|
import { Response as Response$1 } from "../core/Response.cjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.cjs";
|
|
4
4
|
import { Request as Request$1 } from "../core/Request.cjs";
|
|
5
5
|
import { NextFunction, Request, Response } from "express";
|
|
6
6
|
|
package/dist/types/express.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.mjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.mjs";
|
|
3
2
|
import { Response as Response$1 } from "../core/Response.mjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.mjs";
|
|
4
4
|
import { Request as Request$1 } from "../core/Request.mjs";
|
|
5
5
|
import { NextFunction, Request, Response } from "express";
|
|
6
6
|
|
package/dist/types/fastify.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.cjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.cjs";
|
|
3
2
|
import { Response } from "../core/Response.cjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.cjs";
|
|
4
4
|
import { Request } from "../core/Request.cjs";
|
|
5
5
|
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
6
6
|
|
package/dist/types/fastify.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.mjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.mjs";
|
|
3
2
|
import { Response } from "../core/Response.mjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler, MiddlewareHandle } from "./basic.mjs";
|
|
4
4
|
import { Request } from "../core/Request.mjs";
|
|
5
5
|
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
6
6
|
|
package/dist/types/h3.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler } from "./basic.cjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.cjs";
|
|
3
2
|
import { Response as Response$1 } from "../core/Response.cjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler } from "./basic.cjs";
|
|
4
4
|
import { Request } from "../core/Request.cjs";
|
|
5
5
|
import { EventHandlerRequest, H3, H3Event, Middleware as Middleware$1, TypedServerRequest } from "h3";
|
|
6
6
|
|
package/dist/types/h3.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler } from "./basic.mjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.mjs";
|
|
3
2
|
import { Response as Response$1 } from "../core/Response.mjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler } from "./basic.mjs";
|
|
4
4
|
import { Request } from "../core/Request.mjs";
|
|
5
5
|
import { EventHandlerRequest, H3, H3Event, Middleware as Middleware$1, TypedServerRequest } from "h3";
|
|
6
6
|
|
package/dist/types/hono.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler } from "./basic.cjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.cjs";
|
|
3
2
|
import { Response } from "../core/Response.cjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler } from "./basic.cjs";
|
|
4
4
|
import { Request } from "../core/Request.cjs";
|
|
5
5
|
import { Context, HonoRequest, MiddlewareHandler } from "hono";
|
|
6
6
|
|
package/dist/types/hono.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler } from "./basic.mjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.mjs";
|
|
3
2
|
import { Response } from "../core/Response.mjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler } from "./basic.mjs";
|
|
4
4
|
import { Request } from "../core/Request.mjs";
|
|
5
5
|
import { Context, HonoRequest, MiddlewareHandler } from "hono";
|
|
6
6
|
|
package/dist/types/koa.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler } from "./basic.cjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.cjs";
|
|
3
2
|
import { Response } from "../core/Response.cjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler } from "./basic.cjs";
|
|
4
4
|
import { Request } from "../core/Request.cjs";
|
|
5
5
|
import Koa from "koa";
|
|
6
6
|
import Router from "@koa/router";
|
package/dist/types/koa.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassMiddleware, ControllerHandler } from "./basic.mjs";
|
|
2
1
|
import { ClearHttpContext } from "../Contracts.mjs";
|
|
3
2
|
import { Response } from "../core/Response.mjs";
|
|
3
|
+
import { ClassMiddleware, ControllerHandler } from "./basic.mjs";
|
|
4
4
|
import { Request } from "../core/Request.mjs";
|
|
5
5
|
import Koa from "koa";
|
|
6
6
|
import Router from "@koa/router";
|
package/package.json
CHANGED