@kevisual/router 0.2.2 → 0.2.4

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.
@@ -16,7 +16,7 @@ declare class CustomError extends Error {
16
16
  static fromCode(code?: number): CustomError;
17
17
  static fromErrorData(code?: number, data?: any): CustomError;
18
18
  static parseError(e: CustomError): {
19
- code: number;
19
+ code: number | undefined;
20
20
  data: any;
21
21
  message: string;
22
22
  };
@@ -30,7 +30,7 @@ declare class CustomError extends Error {
30
30
  static throw(code?: number | string, opts?: CustomErrorOptions): void;
31
31
  static throw(opts?: CustomErrorOptions): void;
32
32
  parse(e?: CustomError): {
33
- code: number;
33
+ code: number | undefined;
34
34
  data: any;
35
35
  message: string;
36
36
  };
@@ -226,7 +226,7 @@ declare class Route<M extends SimpleObject$1 = SimpleObject$1, U extends SimpleO
226
226
  description?: string;
227
227
  metadata?: M;
228
228
  middleware?: RouteMiddleware[];
229
- type?: string;
229
+ type?: string | undefined;
230
230
  /**
231
231
  * 是否开启debug,开启后会打印错误信息
232
232
  */
@@ -341,7 +341,7 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
341
341
  [key: string]: any;
342
342
  }> | {
343
343
  code: number;
344
- body: any;
344
+ body: null;
345
345
  message: string;
346
346
  }>;
347
347
  /**
@@ -359,9 +359,9 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
359
359
  }, ctx?: RouteContext & {
360
360
  [key: string]: any;
361
361
  }): Promise<{
362
- code: number;
363
- data: any;
364
- message: string;
362
+ code: number | undefined;
363
+ data: string | number | Object | null | undefined;
364
+ message: string | undefined;
365
365
  }>;
366
366
  /**
367
367
  * Router Run获取数据
@@ -377,9 +377,9 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
377
377
  }, ctx?: RouteContext<T> & {
378
378
  [key: string]: any;
379
379
  }): Promise<{
380
- code: number;
381
- data: any;
382
- message: string;
380
+ code: number | undefined;
381
+ data: string | number | Object | null | undefined;
382
+ message: string | undefined;
383
383
  }>;
384
384
  /**
385
385
  * 设置上下文
@@ -414,12 +414,12 @@ declare class QueryRouter<T extends SimpleObject$1 = SimpleObject$1> implements
414
414
  importRoutes(routes: Route[]): void;
415
415
  importRouter(router: QueryRouter): void;
416
416
  throw(...args: any[]): void;
417
- hasRoute(path: string, key?: string): Route<SimpleObject$1, SimpleObject$1>;
417
+ hasRoute(path: string, key?: string): Route<SimpleObject$1, SimpleObject$1> | undefined;
418
418
  findRoute(opts?: {
419
419
  path?: string;
420
420
  key?: string;
421
421
  rid?: string;
422
- }): Route<SimpleObject$1, SimpleObject$1>;
422
+ }): Route<SimpleObject$1, SimpleObject$1> | undefined;
423
423
  createRouteList(opts?: {
424
424
  force?: boolean;
425
425
  filter?: (route: Route) => boolean;
@@ -622,8 +622,8 @@ declare class Chain {
622
622
  object: RouteOpts;
623
623
  app?: QueryRouterServer;
624
624
  constructor(object: RouteOpts, opts?: ChainOptions);
625
- get key(): string;
626
- get path(): string;
625
+ get key(): string | undefined;
626
+ get path(): string | undefined;
627
627
  setDescription(desc: string): this;
628
628
  setMeta(metadata: {
629
629
  [key: string]: any;