暂存
This commit is contained in:
41
patches/@abearxiong__router@0.0.1-alpha.28.patch
Normal file
41
patches/@abearxiong__router@0.0.1-alpha.28.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
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<T = {
|
||||
code?: number;
|
||||
}, S = any> = {
|
||||
@@ -22,7 +23,7 @@ export type RouteContext<T = {
|
||||
end?: boolean;
|
||||
queryRouter?: QueryRouter;
|
||||
} & T;
|
||||
-export type Run<T = any> = (ctx?: RouteContext<T>) => Promise<typeof ctx | null>;
|
||||
+export type Run<T = any> = (ctx?: RouteContext<T>) => Promise<RouteContext<T> | null | void>;
|
||||
export type NextRoute = Pick<Route, 'id' | 'path' | 'key'>;
|
||||
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<RouteOpts, 'idUsePath' | 'verify' | 'verifyKey'>;
|
||||
+export type DefineRouteOpts = Omit<RouteOpts, 'idUsePath' | 'verify' | 'verifyKey' | 'nextRoute'>;
|
||||
declare const pickValue: readonly ["path", "key", "id", "description", "type", "validator", "middleware"];
|
||||
export type RouteInfo = Pick<Route, (typeof pickValue)[number]>;
|
||||
export declare class Route {
|
||||
@@ -109,9 +110,9 @@ export declare class Route {
|
||||
error?: undefined;
|
||||
};
|
||||
define(opts: DefineRouteOpts): this;
|
||||
- define<T>(fn: Run<T>): this;
|
||||
- define<T>(key: string, fn: Run<T>): this;
|
||||
- define<T>(path: string, key: string, fn: Run<T>): this;
|
||||
+ define<T extends {[key:string]:any} = RouterContextT >(fn: Run<T>): this;
|
||||
+ define<T extends {[key:string]:any} = RouterContextT >(key: string, fn: Run<T>): this;
|
||||
+ define<T extends {[key:string]:any} = RouterContextT>(path: string, key: string, fn: Run<T>): this;
|
||||
addTo(router: QueryRouter | {
|
||||
add: (route: Route) => void;
|
||||
[key: string]: any;
|
||||
Reference in New Issue
Block a user