@kevisual/router 0.0.71 → 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.
package/dist/router.d.ts CHANGED
@@ -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
  import * as http from 'node:http';
6
5
  import http__default, { IncomingMessage, ServerResponse } from 'node:http';
@@ -204,7 +203,7 @@ declare class Route<U = {
204
203
  define<T extends {
205
204
  [key: string]: any;
206
205
  } = RouterContextT>(path: string, key: string, fn: Run<T & U>): this;
207
- update(opts: DefineRouteOpts, checkList?: string[]): this;
206
+ update(opts: DefineRouteOpts, onlyUpdateList?: string[]): this;
208
207
  addTo(router: QueryRouter | {
209
208
  add: (route: Route) => void;
210
209
  [key: string]: any;
@@ -244,7 +243,7 @@ declare class QueryRouter {
244
243
  * remove route by id
245
244
  * @param uniqueId
246
245
  */
247
- removeById(unique: string): void;
246
+ removeById(uniqueId: string): void;
248
247
  /**
249
248
  * 执行route
250
249
  * @param path
@@ -501,20 +500,20 @@ declare class CustomError extends Error {
501
500
  }
502
501
 
503
502
  type RouteObject = {
504
- [key: string]: RouteOpts$1;
503
+ [key: string]: RouteOpts;
505
504
  };
506
505
  type SimpleObject = Record<string, any>;
507
- declare function define<T extends Record<string, RouteOpts$1>>(value: T): {
508
- [K in keyof T]: T[K] & RouteOpts$1;
506
+ declare function define<T extends Record<string, RouteOpts>>(value: T): {
507
+ [K in keyof T]: T[K] & RouteOpts;
509
508
  };
510
- type RouteArray = RouteOpts$1[];
509
+ type RouteArray = RouteOpts[];
511
510
  type ChainOptions = {
512
- app: QueryRouterServer$1;
511
+ app: QueryRouterServer;
513
512
  };
514
513
  declare class Chain {
515
- object: RouteOpts$1;
516
- app?: QueryRouterServer$1;
517
- constructor(object: RouteOpts$1, opts?: ChainOptions);
514
+ object: RouteOpts;
515
+ app?: QueryRouterServer;
516
+ constructor(object: RouteOpts, opts?: ChainOptions);
518
517
  get key(): string;
519
518
  get path(): string;
520
519
  setDescription(desc: string): this;
@@ -522,11 +521,11 @@ declare class Chain {
522
521
  [key: string]: any;
523
522
  }): this;
524
523
  setPath(path: string): this;
525
- setMiddleware(middleware: RouteMiddleware$1[]): this;
524
+ setMiddleware(middleware: RouteMiddleware[]): this;
526
525
  setKey(key: string): this;
527
526
  setId(key: string): this;
528
- setRun<U extends SimpleObject = {}>(run: Run$1<U>): this;
529
- define<U extends SimpleObject = {}>(run: Run$1<U>): this;
527
+ setRun<U extends SimpleObject = {}>(run: Run<U>): this;
528
+ define<U extends SimpleObject = {}>(run: Run<U>): this;
530
529
  createRoute(): this;
531
530
  }
532
531
  type QueryChainOptions = {
@@ -546,21 +545,21 @@ declare class QueryChain {
546
545
  * @param queryData
547
546
  * @returns
548
547
  */
549
- getKey(queryData?: SimpleObject): Pick<RouteOpts$1, 'path' | 'key' | 'metadata' | 'description'>;
548
+ getKey(queryData?: SimpleObject): Pick<RouteOpts, 'path' | 'key' | 'metadata' | 'description'>;
550
549
  post<R = SimpleObject, P = SimpleObject>(data: P, options?: DataOpts): Promise<Result<R>>;
551
550
  get<R = SimpleObject, P = SimpleObject>(data: P, options?: DataOpts): Promise<Result<R>>;
552
551
  }
553
552
  declare const util: {
554
- getChain: (obj: RouteOpts$1, opts?: ChainOptions) => Chain;
553
+ getChain: (obj: RouteOpts, opts?: ChainOptions) => Chain;
555
554
  };
556
555
  declare class QueryUtil<T extends RouteObject = RouteObject> {
557
556
  obj: T;
558
- app: QueryRouterServer$1;
557
+ app: QueryRouterServer;
559
558
  query: Query;
560
559
  constructor(object: T, opts?: ChainOptions & QueryChainOptions);
561
560
  static createFormObj<U extends RouteObject>(object: U, opts?: ChainOptions): QueryUtil<U>;
562
- static create<U extends Record<string, RouteOpts$1>>(value: U, opts?: ChainOptions): QueryUtil<U>;
563
- get<K extends keyof T>(key: K): RouteOpts$1;
561
+ static create<U extends Record<string, RouteOpts>>(value: U, opts?: ChainOptions): QueryUtil<U>;
562
+ get<K extends keyof T>(key: K): RouteOpts;
564
563
  chain<K extends keyof T>(key: K, opts?: ChainOptions): Chain;
565
564
  queryChain<K extends keyof T>(key: K, opts?: QueryChainOptions): QueryChain;
566
565
  static Chain: typeof Chain;
@@ -978,4 +977,4 @@ declare class App<U = {}> extends QueryRouter {
978
977
  }
979
978
 
980
979
  export { App, CustomError, Mini, MockProcess, QueryRouter, QueryRouterServer, QueryUtil, Route, ServerNode, createSchema, createSkill, define, fromJSONSchema, handleServer, toJSONSchema, tool, util };
981
- export type { HttpListenerFun, ListenProcessParams, ListenProcessResponse, Listener, OnListener, OnWebSocketFn, RouteArray, RouteContext, RouteMiddleware, RouteObject, RouteOpts, RouterReq, RouterRes, Rule, Run, Schema, Skill, WS, WebSocketListenerFun, WebSocketReq, WebSocketRes };
980
+ export type { HttpListenerFun, ListenProcessParams, ListenProcessResponse, Listener, OnListener, OnWebSocketFn, RouteArray, RouteContext, RouteInfo, RouteMiddleware, RouteObject, RouteOpts, RouterReq, RouterRes, Rule, Run, Schema, Skill, WS, WebSocketListenerFun, WebSocketReq, WebSocketRes };