@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/app.d.ts +5 -0
- package/dist/app.js +19504 -0
- package/dist/opencode.d.ts +2 -2
- package/dist/opencode.js +13380 -14323
- package/dist/router-browser.d.ts +19 -20
- package/dist/router-browser.js +14046 -15099
- package/dist/router-define.d.ts +394 -3
- package/dist/router-define.js +126 -124
- package/dist/router-simple.js +665 -759
- package/dist/router.d.ts +19 -20
- package/dist/router.js +17822 -21151
- package/dist/ws.d.ts +2 -2
- package/dist/ws.js +2980 -150
- package/package.json +19 -54
- package/src/app.ts +2 -2
- package/src/browser.ts +1 -1
- package/src/index.ts +1 -1
- package/src/route.ts +10 -10
- package/src/router-define.ts +1 -1
- package/src/utils/random.ts +8 -0
package/dist/router-browser.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
|
|
|
6
5
|
declare class MockProcess {
|
|
@@ -198,7 +197,7 @@ declare class Route<U = {
|
|
|
198
197
|
define<T extends {
|
|
199
198
|
[key: string]: any;
|
|
200
199
|
} = RouterContextT>(path: string, key: string, fn: Run<T & U>): this;
|
|
201
|
-
update(opts: DefineRouteOpts,
|
|
200
|
+
update(opts: DefineRouteOpts, onlyUpdateList?: string[]): this;
|
|
202
201
|
addTo(router: QueryRouter | {
|
|
203
202
|
add: (route: Route) => void;
|
|
204
203
|
[key: string]: any;
|
|
@@ -238,7 +237,7 @@ declare class QueryRouter {
|
|
|
238
237
|
* remove route by id
|
|
239
238
|
* @param uniqueId
|
|
240
239
|
*/
|
|
241
|
-
removeById(
|
|
240
|
+
removeById(uniqueId: string): void;
|
|
242
241
|
/**
|
|
243
242
|
* 执行route
|
|
244
243
|
* @param path
|
|
@@ -495,20 +494,20 @@ declare class CustomError extends Error {
|
|
|
495
494
|
}
|
|
496
495
|
|
|
497
496
|
type RouteObject = {
|
|
498
|
-
[key: string]: RouteOpts
|
|
497
|
+
[key: string]: RouteOpts;
|
|
499
498
|
};
|
|
500
499
|
type SimpleObject = Record<string, any>;
|
|
501
|
-
declare function define<T extends Record<string, RouteOpts
|
|
502
|
-
[K in keyof T]: T[K] & RouteOpts
|
|
500
|
+
declare function define<T extends Record<string, RouteOpts>>(value: T): {
|
|
501
|
+
[K in keyof T]: T[K] & RouteOpts;
|
|
503
502
|
};
|
|
504
|
-
type RouteArray = RouteOpts
|
|
503
|
+
type RouteArray = RouteOpts[];
|
|
505
504
|
type ChainOptions = {
|
|
506
|
-
app: QueryRouterServer
|
|
505
|
+
app: QueryRouterServer;
|
|
507
506
|
};
|
|
508
507
|
declare class Chain {
|
|
509
|
-
object: RouteOpts
|
|
510
|
-
app?: QueryRouterServer
|
|
511
|
-
constructor(object: RouteOpts
|
|
508
|
+
object: RouteOpts;
|
|
509
|
+
app?: QueryRouterServer;
|
|
510
|
+
constructor(object: RouteOpts, opts?: ChainOptions);
|
|
512
511
|
get key(): string;
|
|
513
512
|
get path(): string;
|
|
514
513
|
setDescription(desc: string): this;
|
|
@@ -516,11 +515,11 @@ declare class Chain {
|
|
|
516
515
|
[key: string]: any;
|
|
517
516
|
}): this;
|
|
518
517
|
setPath(path: string): this;
|
|
519
|
-
setMiddleware(middleware: RouteMiddleware
|
|
518
|
+
setMiddleware(middleware: RouteMiddleware[]): this;
|
|
520
519
|
setKey(key: string): this;
|
|
521
520
|
setId(key: string): this;
|
|
522
|
-
setRun<U extends SimpleObject = {}>(run: Run
|
|
523
|
-
define<U extends SimpleObject = {}>(run: Run
|
|
521
|
+
setRun<U extends SimpleObject = {}>(run: Run<U>): this;
|
|
522
|
+
define<U extends SimpleObject = {}>(run: Run<U>): this;
|
|
524
523
|
createRoute(): this;
|
|
525
524
|
}
|
|
526
525
|
type QueryChainOptions = {
|
|
@@ -540,21 +539,21 @@ declare class QueryChain {
|
|
|
540
539
|
* @param queryData
|
|
541
540
|
* @returns
|
|
542
541
|
*/
|
|
543
|
-
getKey(queryData?: SimpleObject): Pick<RouteOpts
|
|
542
|
+
getKey(queryData?: SimpleObject): Pick<RouteOpts, 'path' | 'key' | 'metadata' | 'description'>;
|
|
544
543
|
post<R = SimpleObject, P = SimpleObject>(data: P, options?: DataOpts): Promise<Result<R>>;
|
|
545
544
|
get<R = SimpleObject, P = SimpleObject>(data: P, options?: DataOpts): Promise<Result<R>>;
|
|
546
545
|
}
|
|
547
546
|
declare const util: {
|
|
548
|
-
getChain: (obj: RouteOpts
|
|
547
|
+
getChain: (obj: RouteOpts, opts?: ChainOptions) => Chain;
|
|
549
548
|
};
|
|
550
549
|
declare class QueryUtil<T extends RouteObject = RouteObject> {
|
|
551
550
|
obj: T;
|
|
552
|
-
app: QueryRouterServer
|
|
551
|
+
app: QueryRouterServer;
|
|
553
552
|
query: Query;
|
|
554
553
|
constructor(object: T, opts?: ChainOptions & QueryChainOptions);
|
|
555
554
|
static createFormObj<U extends RouteObject>(object: U, opts?: ChainOptions): QueryUtil<U>;
|
|
556
|
-
static create<U extends Record<string, RouteOpts
|
|
557
|
-
get<K extends keyof T>(key: K): RouteOpts
|
|
555
|
+
static create<U extends Record<string, RouteOpts>>(value: U, opts?: ChainOptions): QueryUtil<U>;
|
|
556
|
+
get<K extends keyof T>(key: K): RouteOpts;
|
|
558
557
|
chain<K extends keyof T>(key: K, opts?: ChainOptions): Chain;
|
|
559
558
|
queryChain<K extends keyof T>(key: K, opts?: QueryChainOptions): QueryChain;
|
|
560
559
|
static Chain: typeof Chain;
|
|
@@ -565,4 +564,4 @@ declare class QueryUtil<T extends RouteObject = RouteObject> {
|
|
|
565
564
|
declare const App: typeof QueryRouterServer;
|
|
566
565
|
|
|
567
566
|
export { App, CustomError, Mini, MockProcess, QueryRouter, QueryRouterServer, QueryUtil, Route, createSchema, createSkill, define, fromJSONSchema, toJSONSchema, tool, util };
|
|
568
|
-
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 };
|