@kevisual/router 0.0.49 → 0.0.50

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.
@@ -280,7 +280,7 @@ declare class QueryRouter {
280
280
  hasRoute(path: string, key?: string): Route<{
281
281
  [key: string]: any;
282
282
  }, SimpleObject$1>;
283
- createRouteList(force?: boolean): void;
283
+ createRouteList(force?: boolean, filter?: (route: Route) => boolean): void;
284
284
  /**
285
285
  * 等待程序运行, 获取到message的数据,就执行
286
286
  *
@@ -620,13 +620,13 @@ class QueryRouter {
620
620
  hasRoute(path, key = '') {
621
621
  return this.routes.find((r) => r.path === path && r.key === key);
622
622
  }
623
- createRouteList(force = false) {
624
- const hasListRoute = this.hasRoute('route', 'list');
623
+ createRouteList(force = false, filter) {
624
+ const hasListRoute = this.hasRoute('router', 'list');
625
625
  if (!hasListRoute || force) {
626
- const listRoute = new Route('route', 'list', {
626
+ const listRoute = new Route('router', 'list', {
627
627
  description: '列出当前应用下的所有的路由信息',
628
628
  run: async (ctx) => {
629
- const list = this.getList();
629
+ const list = this.getList(filter);
630
630
  ctx.body = list;
631
631
  },
632
632
  });
package/dist/router.d.ts CHANGED
@@ -286,7 +286,7 @@ declare class QueryRouter {
286
286
  hasRoute(path: string, key?: string): Route<{
287
287
  [key: string]: any;
288
288
  }, SimpleObject$1>;
289
- createRouteList(force?: boolean): void;
289
+ createRouteList(force?: boolean, filter?: (route: Route) => boolean): void;
290
290
  /**
291
291
  * 等待程序运行, 获取到message的数据,就执行
292
292
  *
package/dist/router.js CHANGED
@@ -642,13 +642,13 @@ class QueryRouter {
642
642
  hasRoute(path, key = '') {
643
643
  return this.routes.find((r) => r.path === path && r.key === key);
644
644
  }
645
- createRouteList(force = false) {
646
- const hasListRoute = this.hasRoute('route', 'list');
645
+ createRouteList(force = false, filter) {
646
+ const hasListRoute = this.hasRoute('router', 'list');
647
647
  if (!hasListRoute || force) {
648
- const listRoute = new Route('route', 'list', {
648
+ const listRoute = new Route('router', 'list', {
649
649
  description: '列出当前应用下的所有的路由信息',
650
650
  run: async (ctx) => {
651
- const list = this.getList();
651
+ const list = this.getList(filter);
652
652
  ctx.body = list;
653
653
  },
654
654
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@kevisual/router",
4
- "version": "0.0.49",
4
+ "version": "0.0.50",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main": "./dist/router.js",
package/src/route.ts CHANGED
@@ -555,13 +555,13 @@ export class QueryRouter {
555
555
  hasRoute(path: string, key: string = '') {
556
556
  return this.routes.find((r) => r.path === path && r.key === key);
557
557
  }
558
- createRouteList(force: boolean = false) {
559
- const hasListRoute = this.hasRoute('route', 'list');
558
+ createRouteList(force: boolean = false, filter?: (route: Route) => boolean) {
559
+ const hasListRoute = this.hasRoute('router', 'list');
560
560
  if (!hasListRoute || force) {
561
- const listRoute = new Route('route', 'list', {
561
+ const listRoute = new Route('router', 'list', {
562
562
  description: '列出当前应用下的所有的路由信息',
563
563
  run: async (ctx: RouteContext) => {
564
- const list = this.getList();
564
+ const list = this.getList(filter);
565
565
  ctx.body = list;
566
566
  },
567
567
  });