@kevisual/router 0.0.70 → 0.0.72

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.
@@ -1,6 +1,5 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { z } from 'zod';
3
- import { RouteOpts as RouteOpts$1, QueryRouterServer as QueryRouterServer$1, RouteMiddleware as RouteMiddleware$1, Run as Run$1 } from '@kevisual/router';
4
3
  import { Query, DataOpts, Result } from '@kevisual/query/query';
5
4
 
6
5
  declare class MockProcess {
@@ -47,6 +46,9 @@ type RouteContext<T = {
47
46
  query?: {
48
47
  [key: string]: any;
49
48
  };
49
+ args?: {
50
+ [key: string]: any;
51
+ };
50
52
  /** return body */
51
53
  body?: number | string | Object;
52
54
  forward?: (response: {
@@ -195,7 +197,7 @@ declare class Route<U = {
195
197
  define<T extends {
196
198
  [key: string]: any;
197
199
  } = RouterContextT>(path: string, key: string, fn: Run<T & U>): this;
198
- update(opts: DefineRouteOpts, checkList?: string[]): this;
200
+ update(opts: DefineRouteOpts, onlyUpdateList?: string[]): this;
199
201
  addTo(router: QueryRouter | {
200
202
  add: (route: Route) => void;
201
203
  [key: string]: any;
@@ -235,7 +237,7 @@ declare class QueryRouter {
235
237
  * remove route by id
236
238
  * @param uniqueId
237
239
  */
238
- removeById(unique: string): void;
240
+ removeById(uniqueId: string): void;
239
241
  /**
240
242
  * 执行route
241
243
  * @param path
@@ -492,20 +494,20 @@ declare class CustomError extends Error {
492
494
  }
493
495
 
494
496
  type RouteObject = {
495
- [key: string]: RouteOpts$1;
497
+ [key: string]: RouteOpts;
496
498
  };
497
499
  type SimpleObject = Record<string, any>;
498
- declare function define<T extends Record<string, RouteOpts$1>>(value: T): {
499
- [K in keyof T]: T[K] & RouteOpts$1;
500
+ declare function define<T extends Record<string, RouteOpts>>(value: T): {
501
+ [K in keyof T]: T[K] & RouteOpts;
500
502
  };
501
- type RouteArray = RouteOpts$1[];
503
+ type RouteArray = RouteOpts[];
502
504
  type ChainOptions = {
503
- app: QueryRouterServer$1;
505
+ app: QueryRouterServer;
504
506
  };
505
507
  declare class Chain {
506
- object: RouteOpts$1;
507
- app?: QueryRouterServer$1;
508
- constructor(object: RouteOpts$1, opts?: ChainOptions);
508
+ object: RouteOpts;
509
+ app?: QueryRouterServer;
510
+ constructor(object: RouteOpts, opts?: ChainOptions);
509
511
  get key(): string;
510
512
  get path(): string;
511
513
  setDescription(desc: string): this;
@@ -513,11 +515,11 @@ declare class Chain {
513
515
  [key: string]: any;
514
516
  }): this;
515
517
  setPath(path: string): this;
516
- setMiddleware(middleware: RouteMiddleware$1[]): this;
518
+ setMiddleware(middleware: RouteMiddleware[]): this;
517
519
  setKey(key: string): this;
518
520
  setId(key: string): this;
519
- setRun<U extends SimpleObject = {}>(run: Run$1<U>): this;
520
- define<U extends SimpleObject = {}>(run: Run$1<U>): this;
521
+ setRun<U extends SimpleObject = {}>(run: Run<U>): this;
522
+ define<U extends SimpleObject = {}>(run: Run<U>): this;
521
523
  createRoute(): this;
522
524
  }
523
525
  type QueryChainOptions = {
@@ -537,21 +539,21 @@ declare class QueryChain {
537
539
  * @param queryData
538
540
  * @returns
539
541
  */
540
- getKey(queryData?: SimpleObject): Pick<RouteOpts$1, 'path' | 'key' | 'metadata' | 'description'>;
542
+ getKey(queryData?: SimpleObject): Pick<RouteOpts, 'path' | 'key' | 'metadata' | 'description'>;
541
543
  post<R = SimpleObject, P = SimpleObject>(data: P, options?: DataOpts): Promise<Result<R>>;
542
544
  get<R = SimpleObject, P = SimpleObject>(data: P, options?: DataOpts): Promise<Result<R>>;
543
545
  }
544
546
  declare const util: {
545
- getChain: (obj: RouteOpts$1, opts?: ChainOptions) => Chain;
547
+ getChain: (obj: RouteOpts, opts?: ChainOptions) => Chain;
546
548
  };
547
549
  declare class QueryUtil<T extends RouteObject = RouteObject> {
548
550
  obj: T;
549
- app: QueryRouterServer$1;
551
+ app: QueryRouterServer;
550
552
  query: Query;
551
553
  constructor(object: T, opts?: ChainOptions & QueryChainOptions);
552
554
  static createFormObj<U extends RouteObject>(object: U, opts?: ChainOptions): QueryUtil<U>;
553
- static create<U extends Record<string, RouteOpts$1>>(value: U, opts?: ChainOptions): QueryUtil<U>;
554
- get<K extends keyof T>(key: K): RouteOpts$1;
555
+ static create<U extends Record<string, RouteOpts>>(value: U, opts?: ChainOptions): QueryUtil<U>;
556
+ get<K extends keyof T>(key: K): RouteOpts;
555
557
  chain<K extends keyof T>(key: K, opts?: ChainOptions): Chain;
556
558
  queryChain<K extends keyof T>(key: K, opts?: QueryChainOptions): QueryChain;
557
559
  static Chain: typeof Chain;
@@ -562,4 +564,4 @@ declare class QueryUtil<T extends RouteObject = RouteObject> {
562
564
  declare const App: typeof QueryRouterServer;
563
565
 
564
566
  export { App, CustomError, Mini, MockProcess, QueryRouter, QueryRouterServer, QueryUtil, Route, createSchema, createSkill, define, fromJSONSchema, toJSONSchema, tool, util };
565
- export type { ListenProcessParams, ListenProcessResponse, RouteArray, RouteContext, RouteMiddleware, RouteObject, RouteOpts, Rule, Run, Schema, Skill };
567
+ export type { ListenProcessParams, ListenProcessResponse, RouteArray, RouteContext, RouteInfo, RouteMiddleware, RouteObject, RouteOpts, Rule, Run, Schema, Skill };