@kevisual/router 0.0.37 → 0.0.38

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.
@@ -82,16 +82,14 @@ type RouteMiddleware = {
82
82
  key?: string;
83
83
  id?: string;
84
84
  } | string;
85
- type RouteOpts<T = {}> = {
85
+ type RouteOpts<U = {}, T = SimpleObject$1> = {
86
86
  path?: string;
87
87
  key?: string;
88
88
  id?: string;
89
- run?: Run<T>;
89
+ run?: Run<U>;
90
90
  nextRoute?: NextRoute;
91
91
  description?: string;
92
- metadata?: {
93
- [key: string]: any;
94
- };
92
+ metadata?: T;
95
93
  middleware?: RouteMiddleware[];
96
94
  type?: 'route' | 'middleware';
97
95
  /**
@@ -109,7 +107,7 @@ declare const pickValue: readonly ["path", "key", "id", "description", "type", "
109
107
  type RouteInfo = Pick<Route, (typeof pickValue)[number]>;
110
108
  declare class Route<U = {
111
109
  [key: string]: any;
112
- }> {
110
+ }, T extends SimpleObject$1 = SimpleObject$1> {
113
111
  /**
114
112
  * 一级路径
115
113
  */
@@ -122,9 +120,7 @@ declare class Route<U = {
122
120
  run?: Run;
123
121
  nextRoute?: NextRoute;
124
122
  description?: string;
125
- metadata?: {
126
- [key: string]: any;
127
- };
123
+ metadata?: T;
128
124
  middleware?: RouteMiddleware[];
129
125
  type?: string;
130
126
  data?: any;
@@ -252,7 +248,7 @@ declare class QueryRouter {
252
248
  * @param ctx
253
249
  */
254
250
  setContext(ctx: RouteContext): void;
255
- getList(): RouteInfo[];
251
+ getList(filter?: (route: Route) => boolean): RouteInfo[];
256
252
  /**
257
253
  * 获取handle函数, 这里会去执行parse函数
258
254
  */
@@ -277,13 +273,13 @@ declare class QueryRouter {
277
273
  }>;
278
274
  exportRoutes(): Route<{
279
275
  [key: string]: any;
280
- }>[];
276
+ }, SimpleObject$1>[];
281
277
  importRoutes(routes: Route[]): void;
282
278
  importRouter(router: QueryRouter): void;
283
279
  throw(code?: number | string, message?: string, tips?: string): void;
284
280
  hasRoute(path: string, key?: string): Route<{
285
281
  [key: string]: any;
286
- }>;
282
+ }, SimpleObject$1>;
287
283
  createRouteList(force?: boolean): void;
288
284
  /**
289
285
  * 等待程序运行, 获取到message的数据,就执行