clear-router 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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-Cl6q9Od3.cjs";
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-C7oMjml0.cjs";
2
2
  export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
@@ -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-1hB-k4No.mjs";
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-B86hTwHL.mjs";
2
2
  export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
@@ -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-Cl6q9Od3.cjs";
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-C7oMjml0.cjs";
2
2
  import { Router as Router$1 } from "express";
3
3
 
4
4
  //#region src/express/router.d.ts
@@ -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-1hB-k4No.mjs";
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-B86hTwHL.mjs";
2
2
  import { Router as Router$1 } from "express";
3
3
 
4
4
  //#region src/express/router.d.ts
@@ -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-Cl6q9Od3.cjs";
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-C7oMjml0.cjs";
2
2
 
3
3
  //#region src/fastify/router.d.ts
4
4
  /**
@@ -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-1hB-k4No.mjs";
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-B86hTwHL.mjs";
2
2
 
3
3
  //#region src/fastify/router.d.ts
4
4
  /**
@@ -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-Cl6q9Od3.cjs";
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-C7oMjml0.cjs";
2
2
  import { H3 } from "h3";
3
3
 
4
4
  //#region src/h3/router.d.ts
@@ -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-1hB-k4No.mjs";
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-B86hTwHL.mjs";
2
2
  import { H3 } from "h3";
3
3
 
4
4
  //#region src/h3/router.d.ts
@@ -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-Cl6q9Od3.cjs";
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-C7oMjml0.cjs";
2
2
 
3
3
  //#region src/hono/router.d.ts
4
4
  /**
@@ -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-1hB-k4No.mjs";
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-B86hTwHL.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: any;
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;
@@ -206,8 +206,8 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
206
206
  type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
207
207
  type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
208
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, _HttpContext = any> {
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
  */
@@ -221,11 +221,11 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
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: any;
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;
@@ -206,8 +206,8 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
206
206
  type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
207
207
  type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
208
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, _HttpContext = any> {
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
  */
@@ -221,11 +221,11 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
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>[]>;
@@ -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-Cl6q9Od3.cjs";
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-C7oMjml0.cjs";
2
2
 
3
3
  //#region src/koa/router.d.ts
4
4
  /**
@@ -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-1hB-k4No.mjs";
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-B86hTwHL.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: any;
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;
@@ -283,8 +283,8 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
283
283
  type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
284
284
  type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
285
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, _HttpContext = any> {
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
  */
@@ -298,11 +298,11 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
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: any;
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;
@@ -283,8 +283,8 @@ interface ClearRouterPluginArgumentsContext extends ClearRouterPluginRequestCont
283
283
  type PluginBindFactory<T = any> = (ctx: ClearRouterPluginRequestContext) => T | Promise<T>;
284
284
  type PluginBindValue<T = any> = BindValue<T> | PluginBindFactory<T>;
285
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, _HttpContext = any> {
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
  */
@@ -298,11 +298,11 @@ interface ClearRouterPluginContext<Options = any, _HttpContext = any> {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-router",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "description": "Laravel-style routing for Node.js with support for Express, H3, Fastify, Hono, and Koa, including CommonJS, ESM, and TypeScript support.",
5
5
  "keywords": [
6
6
  "h3",