@kevisual/router 0.0.52 → 0.0.53

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.
@@ -11,6 +11,11 @@ type RouterContextT = {
11
11
  type RouteContext<T = {
12
12
  code?: number;
13
13
  }, S = any> = {
14
+ /**
15
+ * 本地自己调用的时候使用,可以标识为当前自调用,那么 auth 就不许重复的校验
16
+ * 或者不需要登录的,直接调用
17
+ */
18
+ appId?: string;
14
19
  query?: {
15
20
  [key: string]: any;
16
21
  };
@@ -152,6 +157,7 @@ declare class Route<U = {
152
157
  throw(code?: number | string, message?: string, tips?: string): void;
153
158
  }
154
159
  declare class QueryRouter {
160
+ appId: string;
155
161
  routes: Route[];
156
162
  maxNextRoute: number;
157
163
  context?: RouteContext;
@@ -280,6 +286,13 @@ declare class QueryRouter {
280
286
  hasRoute(path: string, key?: string): Route<{
281
287
  [key: string]: any;
282
288
  }, SimpleObject$1>;
289
+ findRoute(opts?: {
290
+ path?: string;
291
+ key?: string;
292
+ id?: string;
293
+ }): Route<{
294
+ [key: string]: any;
295
+ }, SimpleObject$1>;
283
296
  createRouteList(force?: boolean, filter?: (route: Route) => boolean): void;
284
297
  /**
285
298
  * 等待程序运行, 获取到message的数据,就执行
@@ -304,6 +317,7 @@ declare class QueryRouter {
304
317
  type QueryRouterServerOpts = {
305
318
  handleFn?: HandleFn;
306
319
  context?: RouteContext;
320
+ appId?: string;
307
321
  };
308
322
  interface HandleFn<T = any> {
309
323
  (msg: {
@@ -322,6 +336,7 @@ interface HandleFn<T = any> {
322
336
  * @description 移除server相关的功能,只保留router相关的功能,和http.createServer不相关,独立
323
337
  */
324
338
  declare class QueryRouterServer extends QueryRouter {
339
+ appId: string;
325
340
  handle: any;
326
341
  constructor(opts?: QueryRouterServerOpts);
327
342
  setHandle(wrapperFn?: HandleFn, ctx?: RouteContext): void;