express-contextualized-router
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -28,2 +28,38 @@ import { Router, NextFunction, Request, Response } from 'express'; | ||
<OutputContext, Route extends string>(path: Route, ...handlers: Array<Array<ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext, P & RouteParameters<Route>, ResBody, ReqBody, ReqQuery>>>): Context & OutputContext extends Record<string, never> ? ContextualizedRouterWithExpressRouter<Context extends Record<string, never> ? OutputContext : Context & OutputContext, Route, P & RouteParameters<Route>> : IContextualizedRouter<Context extends Record<string, never> ? OutputContext : Context & OutputContext, Route, P & RouteParameters<Route>>; | ||
/// ==== | ||
<OutputContext1, OutputContext2, Route extends string>(path: Route, handler1: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 : Context & OutputContext1 & OutputContext2, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, Route extends string>(path: Route, handler1: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 : Context & OutputContext1 & OutputContext2 & OutputContext3, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, Route extends string>(path: Route, handler1: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, handler4: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5, Route extends string>(path: Route, handler1: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, handler4: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, handler5: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5, OutputContext6, Route extends string>(path: Route, handler1: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, handler4: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, handler5: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery>, handle6: ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, OutputContext6, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, Route extends string>(path: Route, handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 : Context & OutputContext1 & OutputContext2, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, Route extends string>(path: Route, handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 : Context & OutputContext1 & OutputContext2 & OutputContext3, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, Route extends string>(path: Route, handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5, Route extends string>(path: Route, handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, Route, P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5, OutputContext6, Route extends string>(path: Route, handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<Route, BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, OutputContext6, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6, "", P, ResBody, ReqBody, ReqQuery>; | ||
} | ||
@@ -35,2 +71,37 @@ /** | ||
<OutputContext>(...handlers: Array<ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext, P, ResBody, ReqBody, ReqQuery>>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext : Context & OutputContext, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2>(handler1: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 : Context & OutputContext1 & OutputContext2, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3>(handler1: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 : Context & OutputContext1 & OutputContext2 & OutputContext3, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4>(handler1: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, handler4: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5>(handler1: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, handler4: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, handler5: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5, OutputContext6>(handler1: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, handler2: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, handler3: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, handler4: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, handler5: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery>, handle6: ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, OutputContext6, P, ResBody, ReqBody, ReqQuery>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2>(handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 : Context & OutputContext1 & OutputContext2, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3>(handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 : Context & OutputContext1 & OutputContext2 & OutputContext3, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4>(handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5>(handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4, OutputContext5, OutputContext6>(handlers: [ | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext1, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1, OutputContext2, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2, OutputContext3, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3, OutputContext4, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4, OutputContext5, P, ResBody, ReqBody, ReqQuery>, | ||
ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context> & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5, OutputContext6, P, ResBody, ReqBody, ReqQuery> | ||
]): IContextualizedRouter<Context extends Record<string, never> ? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6 : Context & OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 & OutputContext5 & OutputContext6, "", P, ResBody, ReqBody, ReqQuery>; | ||
<OutputContext>(...handlers: Array<Array<ContextualizedRequestHandler<ChildRouterContext<"", BasePath, Context>, OutputContext, P, ResBody, ReqBody, ReqQuery>>>): IContextualizedRouter<Context extends Record<string, never> ? OutputContext : Context & OutputContext, "", P, ResBody, ReqBody, ReqQuery>; | ||
@@ -37,0 +108,0 @@ } |
{ | ||
"name": "express-contextualized-router", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -31,6 +31,6 @@ "module": "dist/es/index.js", | ||
"@types/jest": "27.0.3", | ||
"@types/node": "16.11.14", | ||
"@types/node": "16.11.15", | ||
"@types/supertest": "2.0.11", | ||
"@typescript-eslint/eslint-plugin": "5.7.0", | ||
"@typescript-eslint/parser": "5.7.0", | ||
"@typescript-eslint/eslint-plugin": "5.8.0", | ||
"@typescript-eslint/parser": "5.8.0", | ||
"builtin-modules": "3.2.0", | ||
@@ -37,0 +37,0 @@ "commitlint": "15.0.0", |
@@ -319,2 +319,318 @@ import request from 'supertest' | ||
it('should register middlewares with their origin function name', () => { | ||
const app = express() | ||
const contextualizedRouter = ContextualizedRouter() | ||
contextualizedRouter.get('/', function getUser(req, res, next) { | ||
return res.status(200).send({}) | ||
}) | ||
app.use('/user', contextualizedRouter.expressRouter) | ||
expect( | ||
app._router.stack[app._router.stack.length - 1].handle.stack[0].route | ||
.stack[0].name, | ||
).toBe('getUser') | ||
}) | ||
it('should be able to chain handlers with use', async () => { | ||
const app = express() | ||
const contextualizedRouter = ContextualizedRouter() | ||
const aRouterHandler: ContextualizedRequestHandler< | ||
Record<string, any>, | ||
{ a: number } | ||
> = (_req, _res) => { | ||
return new ContextCreator({ a: 1 }) | ||
} | ||
const bRouterHandler: ContextualizedRequestHandler< | ||
{ a: number }, | ||
{ b: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ b: req.context.a + 1 }) | ||
} | ||
const cRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number }, | ||
{ c: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ c: req.context.a + req.context.b }) | ||
} | ||
const dRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number }, | ||
{ d: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
d: req.context.a + req.context.b + req.context.c, | ||
}) | ||
} | ||
const eRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number; d: number }, | ||
{ e: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
e: req.context.a + req.context.b + req.context.c + req.context.d, | ||
}) | ||
} | ||
const fRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number; d: number; e: number }, | ||
{ f: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
f: | ||
req.context.a + | ||
req.context.b + | ||
req.context.c + | ||
req.context.d + | ||
req.context.e, | ||
}) | ||
} | ||
const abRouter = contextualizedRouter.use( | ||
aRouterHandler, | ||
bRouterHandler, | ||
cRouterHandler, | ||
dRouterHandler, | ||
eRouterHandler, | ||
fRouterHandler, | ||
) | ||
abRouter.get('/', (req, res) => { | ||
res.status(200).json({ | ||
a: req.context.a, | ||
b: req.context.b, | ||
c: req.context.c, | ||
d: req.context.d, | ||
e: req.context.e, | ||
f: req.context.f, | ||
}) | ||
}) | ||
app.use(contextualizedRouter.expressRouter) | ||
await request(app) | ||
.get('/') | ||
.expect(200, { a: 1, b: 2, c: 3, d: 6, e: 12, f: 24 }) | ||
}) | ||
it('should be able to chain handlers with use in an array', async () => { | ||
const app = express() | ||
const contextualizedRouter = ContextualizedRouter() | ||
const aRouterHandler: ContextualizedRequestHandler< | ||
Record<string, any>, | ||
{ a: number } | ||
> = (_req, _res) => { | ||
return new ContextCreator({ a: 1 }) | ||
} | ||
const bRouterHandler: ContextualizedRequestHandler< | ||
{ a: number }, | ||
{ b: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ b: req.context.a + 1 }) | ||
} | ||
const cRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number }, | ||
{ c: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ c: req.context.a + req.context.b }) | ||
} | ||
const dRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number }, | ||
{ d: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
d: req.context.a + req.context.b + req.context.c, | ||
}) | ||
} | ||
const eRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number; d: number }, | ||
{ e: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
e: req.context.a + req.context.b + req.context.c + req.context.d, | ||
}) | ||
} | ||
const fRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number; d: number; e: number }, | ||
{ f: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
f: | ||
req.context.a + | ||
req.context.b + | ||
req.context.c + | ||
req.context.d + | ||
req.context.e, | ||
}) | ||
} | ||
const abRouter = contextualizedRouter.use([ | ||
aRouterHandler, | ||
bRouterHandler, | ||
cRouterHandler, | ||
dRouterHandler, | ||
eRouterHandler, | ||
fRouterHandler, | ||
]) | ||
abRouter.get('/', (req, res) => { | ||
res.status(200).json({ | ||
a: req.context.a, | ||
b: req.context.b, | ||
c: req.context.c, | ||
d: req.context.d, | ||
e: req.context.e, | ||
f: req.context.f, | ||
}) | ||
}) | ||
app.use(contextualizedRouter.expressRouter) | ||
await request(app) | ||
.get('/') | ||
.expect(200, { a: 1, b: 2, c: 3, d: 6, e: 12, f: 24 }) | ||
}) | ||
it('should be able to chain handlers with get', async () => { | ||
const app = express() | ||
const contextualizedRouter = ContextualizedRouter() | ||
const aRouterHandler: ContextualizedRequestHandler< | ||
Record<string, any>, | ||
{ a: number } | ||
> = (_req, _res) => { | ||
return new ContextCreator({ a: 1 }) | ||
} | ||
const bRouterHandler: ContextualizedRequestHandler< | ||
{ a: number }, | ||
{ b: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ b: req.context.a + 1 }) | ||
} | ||
const cRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number }, | ||
{ c: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ c: req.context.a + req.context.b }) | ||
} | ||
const dRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number }, | ||
{ d: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
d: req.context.a + req.context.b + req.context.c, | ||
}) | ||
} | ||
const eRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number; d: number }, | ||
{ e: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
e: req.context.a + req.context.b + req.context.c + req.context.d, | ||
}) | ||
} | ||
contextualizedRouter.get( | ||
'/', | ||
aRouterHandler, | ||
bRouterHandler, | ||
cRouterHandler, | ||
dRouterHandler, | ||
eRouterHandler, | ||
(req, res) => { | ||
res.status(200).json({ | ||
a: req.context.a, | ||
b: req.context.b, | ||
c: req.context.c, | ||
d: req.context.d, | ||
e: req.context.e, | ||
}) | ||
}, | ||
) | ||
app.use(contextualizedRouter.expressRouter) | ||
await request(app).get('/').expect(200, { a: 1, b: 2, c: 3, d: 6, e: 12 }) | ||
}) | ||
it('should be able to chain handlers with get in an array', async () => { | ||
const app = express() | ||
const contextualizedRouter = ContextualizedRouter() | ||
const aRouterHandler: ContextualizedRequestHandler< | ||
Record<string, any>, | ||
{ a: number } | ||
> = (_req, _res) => { | ||
return new ContextCreator({ a: 1 }) | ||
} | ||
const bRouterHandler: ContextualizedRequestHandler< | ||
{ a: number }, | ||
{ b: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ b: req.context.a + 1 }) | ||
} | ||
const cRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number }, | ||
{ c: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ c: req.context.a + req.context.b }) | ||
} | ||
const dRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number }, | ||
{ d: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
d: req.context.a + req.context.b + req.context.c, | ||
}) | ||
} | ||
const eRouterHandler: ContextualizedRequestHandler< | ||
{ a: number; b: number; c: number; d: number }, | ||
{ e: number } | ||
> = (req, _res) => { | ||
return new ContextCreator({ | ||
e: req.context.a + req.context.b + req.context.c + req.context.d, | ||
}) | ||
} | ||
contextualizedRouter.get( | ||
'/', | ||
aRouterHandler, | ||
bRouterHandler, | ||
cRouterHandler, | ||
dRouterHandler, | ||
eRouterHandler, | ||
(req, res) => { | ||
res.status(200).json({ | ||
a: req.context.a, | ||
b: req.context.b, | ||
c: req.context.c, | ||
d: req.context.d, | ||
e: req.context.e, | ||
}) | ||
}, | ||
) | ||
app.use(contextualizedRouter.expressRouter) | ||
await request(app).get('/').expect(200, { a: 1, b: 2, c: 3, d: 6, e: 12 }) | ||
}) | ||
describe('Types assertions', () => { | ||
@@ -407,19 +723,3 @@ it('should not be able to pass a handler which expect a different context', () => { | ||
}) | ||
it('should register middlewares with their origin function name', () => { | ||
const app = express() | ||
const contextualizedRouter = ContextualizedRouter() | ||
contextualizedRouter.get('/', function getUser(req, res, next) { | ||
return res.status(200).send({}) | ||
}) | ||
app.use('/user', contextualizedRouter.expressRouter) | ||
expect( | ||
app._router.stack[app._router.stack.length - 1].handle.stack[0].route | ||
.stack[0].name, | ||
).toBe('getUser') | ||
}) | ||
}) | ||
}) |
@@ -146,2 +146,615 @@ import { NextFunction, Request, Response, Router } from 'express' | ||
> | ||
/// ==== | ||
<OutputContext1, OutputContext2, Route extends string>( | ||
path: Route, | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 | ||
: Context & OutputContext1 & OutputContext2, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, OutputContext3, Route extends string>( | ||
path: Route, | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 | ||
: Context & OutputContext1 & OutputContext2 & OutputContext3, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
Route extends string, | ||
>( | ||
path: Route, | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler4: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
Route extends string, | ||
>( | ||
path: Route, | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler4: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler5: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
OutputContext6, | ||
Route extends string, | ||
>( | ||
path: Route, | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler4: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler5: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handle6: ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
OutputContext6, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, Route extends string>( | ||
path: Route, | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 | ||
: Context & OutputContext1 & OutputContext2, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, OutputContext3, Route extends string>( | ||
path: Route, | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 | ||
: Context & OutputContext1 & OutputContext2 & OutputContext3, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
Route extends string, | ||
>( | ||
path: Route, | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
Route extends string, | ||
>( | ||
path: Route, | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
Route, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
OutputContext6, | ||
Route extends string, | ||
>( | ||
path: Route, | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<Route, BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
OutputContext6, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
} | ||
@@ -180,2 +793,588 @@ /** | ||
> | ||
<OutputContext1, OutputContext2>( | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 | ||
: Context & OutputContext1 & OutputContext2, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, OutputContext3>( | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 | ||
: Context & OutputContext1 & OutputContext2 & OutputContext3, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4>( | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler4: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
>( | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler4: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler5: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
OutputContext6, | ||
>( | ||
handler1: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler2: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler3: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler4: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handler5: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
handle6: ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
OutputContext6, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2>( | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 | ||
: Context & OutputContext1 & OutputContext2, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, OutputContext3>( | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 | ||
: Context & OutputContext1 & OutputContext2 & OutputContext3, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext1, OutputContext2, OutputContext3, OutputContext4>( | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & OutputContext2 & OutputContext3 & OutputContext4 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
>( | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
< | ||
OutputContext1, | ||
OutputContext2, | ||
OutputContext3, | ||
OutputContext4, | ||
OutputContext5, | ||
OutputContext6, | ||
>( | ||
handlers: [ | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context>, | ||
OutputContext1, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & OutputContext1, | ||
OutputContext2, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2, | ||
OutputContext3, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3, | ||
OutputContext4, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4, | ||
OutputContext5, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
ContextualizedRequestHandler< | ||
ChildRouterContext<'', BasePath, Context> & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5, | ||
OutputContext6, | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
>, | ||
], | ||
): IContextualizedRouter< | ||
Context extends Record<string, never> | ||
? OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6 | ||
: Context & | ||
OutputContext1 & | ||
OutputContext2 & | ||
OutputContext3 & | ||
OutputContext4 & | ||
OutputContext5 & | ||
OutputContext6, | ||
'', | ||
P, | ||
ResBody, | ||
ReqBody, | ||
ReqQuery | ||
> | ||
<OutputContext>( | ||
@@ -182,0 +1381,0 @@ ...handlers: Array< |
101036
2700