clear-router 2.7.0 → 2.7.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/core/index.d.cts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/decorators/setup.d.mts +1 -0
- 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 +12 -12
- package/dist/index.d.mts +12 -12
- package/dist/koa/index.d.cts +1 -1
- package/dist/koa/index.d.mts +1 -1
- package/dist/{router-1hB-k4No.d.mts → router-7xO6qBQZ.d.mts} +12 -12
- package/dist/{router-Cl6q9Od3.d.cts → router-CY1BZ3Af.d.cts} +12 -12
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { L as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-
|
|
1
|
+
import { L as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-CY1BZ3Af.cjs";
|
|
2
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 { L as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-
|
|
1
|
+
import { L as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-7xO6qBQZ.mjs";
|
|
2
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 ControllerAction, I as HttpMethod, M as HttpContext, N as Middleware, P as ApiResourceMiddleware, j as Handler, m as Route, t as CoreRouter } from "../router-
|
|
1
|
+
import { F as ControllerAction, I as HttpMethod, M as HttpContext, N as Middleware, P as ApiResourceMiddleware, j as Handler, m as Route, t as CoreRouter } from "../router-CY1BZ3Af.cjs";
|
|
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 ControllerAction, I as HttpMethod, M as HttpContext, N as Middleware, P as ApiResourceMiddleware, j as Handler, m as Route, t as CoreRouter } from "../router-
|
|
1
|
+
import { F as ControllerAction, I as HttpMethod, M as HttpContext, N as Middleware, P as ApiResourceMiddleware, j as Handler, m as Route, t as CoreRouter } from "../router-7xO6qBQZ.mjs";
|
|
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 ControllerAction, I as HttpMethod, O as Handler, P as ApiResourceMiddleware, k as HttpContext, m as Route, t as CoreRouter } from "../router-
|
|
1
|
+
import { A as Middleware, D as FastifyApp, F as ControllerAction, I as HttpMethod, O as Handler, P as ApiResourceMiddleware, k as HttpContext, m as Route, t as CoreRouter } from "../router-CY1BZ3Af.cjs";
|
|
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 ControllerAction, I as HttpMethod, O as Handler, P as ApiResourceMiddleware, k as HttpContext, m as Route, t as CoreRouter } from "../router-
|
|
1
|
+
import { A as Middleware, D as FastifyApp, F as ControllerAction, I as HttpMethod, O as Handler, P as ApiResourceMiddleware, k as HttpContext, m as Route, t as CoreRouter } from "../router-7xO6qBQZ.mjs";
|
|
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 ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-
|
|
1
|
+
import { C as H3App, E as Middleware, F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-CY1BZ3Af.cjs";
|
|
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 ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-
|
|
1
|
+
import { C as H3App, E as Middleware, F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, T as HttpContext, m as Route, t as CoreRouter, w as Handler } from "../router-7xO6qBQZ.mjs";
|
|
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 ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-
|
|
1
|
+
import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-CY1BZ3Af.cjs";
|
|
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 ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-
|
|
1
|
+
import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-7xO6qBQZ.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/hono/router.d.ts
|
|
4
4
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -188,14 +188,14 @@ declare class Container {
|
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/core/plugins.d.ts
|
|
190
190
|
type PluginSetupResult = void | Promise<void>;
|
|
191
|
-
interface ClearRouterPluginRequestContext {
|
|
192
|
-
ctx:
|
|
191
|
+
interface ClearRouterPluginRequestContext<HttpContext = any> {
|
|
192
|
+
ctx: HttpContext;
|
|
193
193
|
request: Request;
|
|
194
194
|
response: Response$1;
|
|
195
195
|
getBindings: () => Record<string, BindValue>;
|
|
196
196
|
[key: string]: any;
|
|
197
197
|
}
|
|
198
|
-
interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestContext {
|
|
198
|
+
interface ClearRouterPluginArgumentsContext<X = any> extends ClearRouterPluginRequestContext<X> {
|
|
199
199
|
target?: object;
|
|
200
200
|
method?: PropertyKey;
|
|
201
201
|
handler?: object;
|
|
@@ -203,11 +203,11 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
|
|
|
203
203
|
tokens: BindToken[];
|
|
204
204
|
designTokens: BindToken[];
|
|
205
205
|
}
|
|
206
|
-
type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
|
|
207
|
-
type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
|
|
208
|
-
type PluginBind = <T>(token: BindToken<T>, value: PluginBindValue<T>) => void;
|
|
209
|
-
type PluginArgumentsResolver = (ctx: ClearRouterPluginArgumentsContext) => any[] | undefined | Promise<any[] | undefined>;
|
|
210
|
-
interface ClearRouterPluginContext<Options = any,
|
|
206
|
+
type PluginBindFactory<T = any, X = any> = (ctx: ClearRouterPluginRequestContext<X>) => T | Promise<T>;
|
|
207
|
+
type PluginBindValue<T = any, X = any> = BindValue<T> | PluginBindFactory<T, X>;
|
|
208
|
+
type PluginBind<X = any> = <T>(token: BindToken<T>, value: PluginBindValue<T, X>) => void;
|
|
209
|
+
type PluginArgumentsResolver<HttpContext = any> = (ctx: ClearRouterPluginArgumentsContext<HttpContext>) => any[] | undefined | Promise<any[] | undefined>;
|
|
210
|
+
interface ClearRouterPluginContext<Options = any, HttpContext = any> {
|
|
211
211
|
/**
|
|
212
212
|
* The service container
|
|
213
213
|
*/
|
|
@@ -215,17 +215,17 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
|
|
|
215
215
|
/**
|
|
216
216
|
* Register service container bindings
|
|
217
217
|
*/
|
|
218
|
-
bind: PluginBind
|
|
218
|
+
bind: PluginBind<HttpContext>;
|
|
219
219
|
/**
|
|
220
220
|
* Replace all controller method arguments
|
|
221
221
|
* @param resolver
|
|
222
222
|
* @returns
|
|
223
223
|
*/
|
|
224
|
-
resolveArguments: (resolver: PluginArgumentsResolver) => void;
|
|
224
|
+
resolveArguments: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
225
225
|
/**
|
|
226
226
|
* Use the current http context
|
|
227
227
|
*/
|
|
228
|
-
useHttpContext: (resolver: PluginArgumentsResolver) => void;
|
|
228
|
+
useHttpContext: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
229
229
|
/**
|
|
230
230
|
* All registered service container bindings
|
|
231
231
|
*/
|
|
@@ -312,7 +312,7 @@ declare abstract class CoreRouter {
|
|
|
312
312
|
prefix: string;
|
|
313
313
|
groupMiddlewares: any[];
|
|
314
314
|
}>;
|
|
315
|
-
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext
|
|
315
|
+
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext<any>>;
|
|
316
316
|
static routes: Set<Route<any, any, any>>;
|
|
317
317
|
static routesByPathMethod: Map<string, Route<any, any, any>>;
|
|
318
318
|
static routesByMethod: Map<"GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD", Route<any, any, any>[]>;
|
package/dist/index.d.mts
CHANGED
|
@@ -188,14 +188,14 @@ declare class Container {
|
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/core/plugins.d.ts
|
|
190
190
|
type PluginSetupResult = void | Promise<void>;
|
|
191
|
-
interface ClearRouterPluginRequestContext {
|
|
192
|
-
ctx:
|
|
191
|
+
interface ClearRouterPluginRequestContext<HttpContext = any> {
|
|
192
|
+
ctx: HttpContext;
|
|
193
193
|
request: Request;
|
|
194
194
|
response: Response$1;
|
|
195
195
|
getBindings: () => Record<string, BindValue>;
|
|
196
196
|
[key: string]: any;
|
|
197
197
|
}
|
|
198
|
-
interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestContext {
|
|
198
|
+
interface ClearRouterPluginArgumentsContext<X = any> extends ClearRouterPluginRequestContext<X> {
|
|
199
199
|
target?: object;
|
|
200
200
|
method?: PropertyKey;
|
|
201
201
|
handler?: object;
|
|
@@ -203,11 +203,11 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
|
|
|
203
203
|
tokens: BindToken[];
|
|
204
204
|
designTokens: BindToken[];
|
|
205
205
|
}
|
|
206
|
-
type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
|
|
207
|
-
type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
|
|
208
|
-
type PluginBind = <T>(token: BindToken<T>, value: PluginBindValue<T>) => void;
|
|
209
|
-
type PluginArgumentsResolver = (ctx: ClearRouterPluginArgumentsContext) => any[] | undefined | Promise<any[] | undefined>;
|
|
210
|
-
interface ClearRouterPluginContext<Options = any,
|
|
206
|
+
type PluginBindFactory<T = any, X = any> = (ctx: ClearRouterPluginRequestContext<X>) => T | Promise<T>;
|
|
207
|
+
type PluginBindValue<T = any, X = any> = BindValue<T> | PluginBindFactory<T, X>;
|
|
208
|
+
type PluginBind<X = any> = <T>(token: BindToken<T>, value: PluginBindValue<T, X>) => void;
|
|
209
|
+
type PluginArgumentsResolver<HttpContext = any> = (ctx: ClearRouterPluginArgumentsContext<HttpContext>) => any[] | undefined | Promise<any[] | undefined>;
|
|
210
|
+
interface ClearRouterPluginContext<Options = any, HttpContext = any> {
|
|
211
211
|
/**
|
|
212
212
|
* The service container
|
|
213
213
|
*/
|
|
@@ -215,17 +215,17 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
|
|
|
215
215
|
/**
|
|
216
216
|
* Register service container bindings
|
|
217
217
|
*/
|
|
218
|
-
bind: PluginBind
|
|
218
|
+
bind: PluginBind<HttpContext>;
|
|
219
219
|
/**
|
|
220
220
|
* Replace all controller method arguments
|
|
221
221
|
* @param resolver
|
|
222
222
|
* @returns
|
|
223
223
|
*/
|
|
224
|
-
resolveArguments: (resolver: PluginArgumentsResolver) => void;
|
|
224
|
+
resolveArguments: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
225
225
|
/**
|
|
226
226
|
* Use the current http context
|
|
227
227
|
*/
|
|
228
|
-
useHttpContext: (resolver: PluginArgumentsResolver) => void;
|
|
228
|
+
useHttpContext: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
229
229
|
/**
|
|
230
230
|
* All registered service container bindings
|
|
231
231
|
*/
|
|
@@ -312,7 +312,7 @@ declare abstract class CoreRouter {
|
|
|
312
312
|
prefix: string;
|
|
313
313
|
groupMiddlewares: any[];
|
|
314
314
|
}>;
|
|
315
|
-
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext
|
|
315
|
+
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext<any>>;
|
|
316
316
|
static routes: Set<Route<any, any, any>>;
|
|
317
317
|
static routesByPathMethod: Map<string, Route<any, any, any>>;
|
|
318
318
|
static routesByMethod: Map<"GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD", Route<any, any, any>[]>;
|
package/dist/koa/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-
|
|
1
|
+
import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-CY1BZ3Af.cjs";
|
|
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 ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-
|
|
1
|
+
import { F as ControllerAction, I as HttpMethod, P as ApiResourceMiddleware, _ as KoaRouterApp, g as HttpContext, h as Handler, m as Route, t as CoreRouter, v as Middleware } from "../router-7xO6qBQZ.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/koa/router.d.ts
|
|
4
4
|
/**
|
|
@@ -265,14 +265,14 @@ declare class Request$1<X = any, M = any> extends ClearRequest<X, M> {
|
|
|
265
265
|
//#endregion
|
|
266
266
|
//#region src/core/plugins.d.ts
|
|
267
267
|
type PluginSetupResult = void | Promise<void>;
|
|
268
|
-
interface ClearRouterPluginRequestContext {
|
|
269
|
-
ctx:
|
|
268
|
+
interface ClearRouterPluginRequestContext<HttpContext = any> {
|
|
269
|
+
ctx: HttpContext;
|
|
270
270
|
request: Request$1;
|
|
271
271
|
response: Response$2;
|
|
272
272
|
getBindings: () => Record<string, BindValue>;
|
|
273
273
|
[key: string]: any;
|
|
274
274
|
}
|
|
275
|
-
interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestContext {
|
|
275
|
+
interface ClearRouterPluginArgumentsContext<X = any> extends ClearRouterPluginRequestContext<X> {
|
|
276
276
|
target?: object;
|
|
277
277
|
method?: PropertyKey;
|
|
278
278
|
handler?: object;
|
|
@@ -280,11 +280,11 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
|
|
|
280
280
|
tokens: BindToken[];
|
|
281
281
|
designTokens: BindToken[];
|
|
282
282
|
}
|
|
283
|
-
type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
|
|
284
|
-
type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
|
|
285
|
-
type PluginBind = <T>(token: BindToken<T>, value: PluginBindValue<T>) => void;
|
|
286
|
-
type PluginArgumentsResolver = (ctx: ClearRouterPluginArgumentsContext) => any[] | undefined | Promise<any[] | undefined>;
|
|
287
|
-
interface ClearRouterPluginContext<Options = any,
|
|
283
|
+
type PluginBindFactory<T = any, X = any> = (ctx: ClearRouterPluginRequestContext<X>) => T | Promise<T>;
|
|
284
|
+
type PluginBindValue<T = any, X = any> = BindValue<T> | PluginBindFactory<T, X>;
|
|
285
|
+
type PluginBind<X = any> = <T>(token: BindToken<T>, value: PluginBindValue<T, X>) => void;
|
|
286
|
+
type PluginArgumentsResolver<HttpContext = any> = (ctx: ClearRouterPluginArgumentsContext<HttpContext>) => any[] | undefined | Promise<any[] | undefined>;
|
|
287
|
+
interface ClearRouterPluginContext<Options = any, HttpContext = any> {
|
|
288
288
|
/**
|
|
289
289
|
* The service container
|
|
290
290
|
*/
|
|
@@ -292,17 +292,17 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
|
|
|
292
292
|
/**
|
|
293
293
|
* Register service container bindings
|
|
294
294
|
*/
|
|
295
|
-
bind: PluginBind
|
|
295
|
+
bind: PluginBind<HttpContext>;
|
|
296
296
|
/**
|
|
297
297
|
* Replace all controller method arguments
|
|
298
298
|
* @param resolver
|
|
299
299
|
* @returns
|
|
300
300
|
*/
|
|
301
|
-
resolveArguments: (resolver: PluginArgumentsResolver) => void;
|
|
301
|
+
resolveArguments: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
302
302
|
/**
|
|
303
303
|
* Use the current http context
|
|
304
304
|
*/
|
|
305
|
-
useHttpContext: (resolver: PluginArgumentsResolver) => void;
|
|
305
|
+
useHttpContext: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
306
306
|
/**
|
|
307
307
|
* All registered service container bindings
|
|
308
308
|
*/
|
|
@@ -399,7 +399,7 @@ declare abstract class CoreRouter {
|
|
|
399
399
|
prefix: string;
|
|
400
400
|
groupMiddlewares: any[];
|
|
401
401
|
}>;
|
|
402
|
-
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext
|
|
402
|
+
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext<any>>;
|
|
403
403
|
static routes: Set<Route<any, any, any>>;
|
|
404
404
|
static routesByPathMethod: Map<string, Route<any, any, any>>;
|
|
405
405
|
static routesByMethod: Map<"GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD", Route<any, any, any>[]>;
|
|
@@ -265,14 +265,14 @@ declare class Request$1<X = any, M = any> extends ClearRequest<X, M> {
|
|
|
265
265
|
//#endregion
|
|
266
266
|
//#region src/core/plugins.d.ts
|
|
267
267
|
type PluginSetupResult = void | Promise<void>;
|
|
268
|
-
interface ClearRouterPluginRequestContext {
|
|
269
|
-
ctx:
|
|
268
|
+
interface ClearRouterPluginRequestContext<HttpContext = any> {
|
|
269
|
+
ctx: HttpContext;
|
|
270
270
|
request: Request$1;
|
|
271
271
|
response: Response$2;
|
|
272
272
|
getBindings: () => Record<string, BindValue>;
|
|
273
273
|
[key: string]: any;
|
|
274
274
|
}
|
|
275
|
-
interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestContext {
|
|
275
|
+
interface ClearRouterPluginArgumentsContext<X = any> extends ClearRouterPluginRequestContext<X> {
|
|
276
276
|
target?: object;
|
|
277
277
|
method?: PropertyKey;
|
|
278
278
|
handler?: object;
|
|
@@ -280,11 +280,11 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
|
|
|
280
280
|
tokens: BindToken[];
|
|
281
281
|
designTokens: BindToken[];
|
|
282
282
|
}
|
|
283
|
-
type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
|
|
284
|
-
type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
|
|
285
|
-
type PluginBind = <T>(token: BindToken<T>, value: PluginBindValue<T>) => void;
|
|
286
|
-
type PluginArgumentsResolver = (ctx: ClearRouterPluginArgumentsContext) => any[] | undefined | Promise<any[] | undefined>;
|
|
287
|
-
interface ClearRouterPluginContext<Options = any,
|
|
283
|
+
type PluginBindFactory<T = any, X = any> = (ctx: ClearRouterPluginRequestContext<X>) => T | Promise<T>;
|
|
284
|
+
type PluginBindValue<T = any, X = any> = BindValue<T> | PluginBindFactory<T, X>;
|
|
285
|
+
type PluginBind<X = any> = <T>(token: BindToken<T>, value: PluginBindValue<T, X>) => void;
|
|
286
|
+
type PluginArgumentsResolver<HttpContext = any> = (ctx: ClearRouterPluginArgumentsContext<HttpContext>) => any[] | undefined | Promise<any[] | undefined>;
|
|
287
|
+
interface ClearRouterPluginContext<Options = any, HttpContext = any> {
|
|
288
288
|
/**
|
|
289
289
|
* The service container
|
|
290
290
|
*/
|
|
@@ -292,17 +292,17 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
|
|
|
292
292
|
/**
|
|
293
293
|
* Register service container bindings
|
|
294
294
|
*/
|
|
295
|
-
bind: PluginBind
|
|
295
|
+
bind: PluginBind<HttpContext>;
|
|
296
296
|
/**
|
|
297
297
|
* Replace all controller method arguments
|
|
298
298
|
* @param resolver
|
|
299
299
|
* @returns
|
|
300
300
|
*/
|
|
301
|
-
resolveArguments: (resolver: PluginArgumentsResolver) => void;
|
|
301
|
+
resolveArguments: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
302
302
|
/**
|
|
303
303
|
* Use the current http context
|
|
304
304
|
*/
|
|
305
|
-
useHttpContext: (resolver: PluginArgumentsResolver) => void;
|
|
305
|
+
useHttpContext: (resolver: PluginArgumentsResolver<HttpContext>) => void;
|
|
306
306
|
/**
|
|
307
307
|
* All registered service container bindings
|
|
308
308
|
*/
|
|
@@ -399,7 +399,7 @@ declare abstract class CoreRouter {
|
|
|
399
399
|
prefix: string;
|
|
400
400
|
groupMiddlewares: any[];
|
|
401
401
|
}>;
|
|
402
|
-
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext
|
|
402
|
+
protected static pluginRequestContext: AsyncLocalStorage<ClearRouterPluginRequestContext<any>>;
|
|
403
403
|
static routes: Set<Route<any, any, any>>;
|
|
404
404
|
static routesByPathMethod: Map<string, Route<any, any, any>>;
|
|
405
405
|
static routesByMethod: Map<"GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD", Route<any, any, any>[]>;
|
package/package.json
CHANGED