diff --git a/dist/route.d.ts b/dist/route.d.ts index 28ae5103aea403c9bf71f7fc897d3d0aecd17c70..f900e21871df3586f05105504228695e31725256 100644 --- a/dist/route.d.ts +++ b/dist/route.d.ts @@ -1,4 +1,5 @@ import { Schema, Rule } from './validator/index.ts'; +export type RouterContextT = { code?:number, [key: string]: any}; export type RouteContext = { @@ -22,7 +23,7 @@ export type RouteContext = (ctx?: RouteContext) => Promise; +export type Run = (ctx?: RouteContext) => Promise | null | void>; export type NextRoute = Pick; export type RouteOpts = { path?: string; @@ -43,7 +44,7 @@ export type RouteOpts = { verifyKey?: (key: string, ctx?: RouteContext, dev?: boolean) => boolean; idUsePath?: boolean; }; -export type DefineRouteOpts = Omit; +export type DefineRouteOpts = Omit; declare const pickValue: readonly ["path", "key", "id", "description", "type", "validator", "middleware"]; export type RouteInfo = Pick; export declare class Route { @@ -109,9 +110,9 @@ export declare class Route { error?: undefined; }; define(opts: DefineRouteOpts): this; - define(fn: Run): this; - define(key: string, fn: Run): this; - define(path: string, key: string, fn: Run): this; + define(fn: Run): this; + define(key: string, fn: Run): this; + define(path: string, key: string, fn: Run): this; addTo(router: QueryRouter | { add: (route: Route) => void; [key: string]: any;