@kevisual/router 0.0.38 → 0.0.39

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