@kevisual/router 0.2.10 → 0.2.11

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.js CHANGED
@@ -20120,7 +20120,7 @@ app
20120
20120
  10. **中间件找不到会返回 404**,错误信息中会包含找不到的中间件列表。
20121
20121
  `;
20122
20122
  // package.json
20123
- var version2 = "0.2.9";
20123
+ var version2 = "0.2.10";
20124
20124
 
20125
20125
  // agent/routes/route-create.ts
20126
20126
  app.route({
@@ -53,6 +53,29 @@ declare class MockProcess {
53
53
  on(fn: (msg?: any) => any): void;
54
54
  desctroy(): void;
55
55
  }
56
+ type ListenProcessParams = {
57
+ message?: RunMessage;
58
+ context?: any;
59
+ };
60
+ type ListenProcessResponse = {
61
+ success?: boolean;
62
+ data?: {
63
+ code?: number;
64
+ data?: any;
65
+ message?: string;
66
+ [key: string]: any;
67
+ };
68
+ error?: any;
69
+ timestamp?: string;
70
+ [key: string]: any;
71
+ };
72
+ type ListenProcessOptions = {
73
+ app?: QueryRouterServer;
74
+ mockProcess?: MockProcess;
75
+ params?: ListenProcessParams;
76
+ timeout?: number;
77
+ };
78
+ declare const listenProcess: ({ app, mockProcess, params, timeout }: ListenProcessOptions) => Promise<void>;
56
79
 
57
80
  type RouterContextT = {
58
81
  code?: number;
@@ -682,5 +705,5 @@ declare class QueryUtil<T extends RouteObject = RouteObject> {
682
705
 
683
706
  declare const App: typeof QueryRouterServer;
684
707
 
685
- export { App, CustomError, Mini, QueryRouter, QueryRouterServer, QueryUtil, Route, createSchema, createSkill, define, fromJSONSchema, toJSONSchema, tool, util };
686
- export type { RouteArray, RouteContext, RouteInfo, RouteMiddleware, RouteObject, RouteOpts, Rule, Run, Schema, Skill };
708
+ export { App, CustomError, Mini, MockProcess, QueryRouter, QueryRouterServer, QueryUtil, Route, createSchema, createSkill, define, fromJSONSchema, listenProcess, toJSONSchema, tool, util };
709
+ export type { ListenProcessOptions, ListenProcessParams, ListenProcessResponse, RouteArray, RouteContext, RouteInfo, RouteMiddleware, RouteObject, RouteOpts, Rule, Run, Schema, Skill };
@@ -33426,6 +33426,7 @@ export {
33426
33426
  util,
33427
33427
  tool,
33428
33428
  toJSONSchema3 as toJSONSchema,
33429
+ listenProcess,
33429
33430
  fromJSONSchema3 as fromJSONSchema,
33430
33431
  define2 as define,
33431
33432
  createSkill,
@@ -33434,6 +33435,7 @@ export {
33434
33435
  QueryUtil,
33435
33436
  QueryRouterServer,
33436
33437
  QueryRouter,
33438
+ MockProcess,
33437
33439
  Mini,
33438
33440
  CustomError,
33439
33441
  App
package/dist/router.d.ts CHANGED
@@ -59,6 +59,29 @@ declare class MockProcess {
59
59
  on(fn: (msg?: any) => any): void;
60
60
  desctroy(): void;
61
61
  }
62
+ type ListenProcessParams = {
63
+ message?: RunMessage;
64
+ context?: any;
65
+ };
66
+ type ListenProcessResponse = {
67
+ success?: boolean;
68
+ data?: {
69
+ code?: number;
70
+ data?: any;
71
+ message?: string;
72
+ [key: string]: any;
73
+ };
74
+ error?: any;
75
+ timestamp?: string;
76
+ [key: string]: any;
77
+ };
78
+ type ListenProcessOptions = {
79
+ app?: QueryRouterServer;
80
+ mockProcess?: MockProcess;
81
+ params?: ListenProcessParams;
82
+ timeout?: number;
83
+ };
84
+ declare const listenProcess: ({ app, mockProcess, params, timeout }: ListenProcessOptions) => Promise<void>;
62
85
 
63
86
  type RouterContextT = {
64
87
  code?: number;
@@ -1088,5 +1111,5 @@ declare class App<U = {}> extends QueryRouterServer<AppRouteContext<U>> {
1088
1111
  onServerRequest(fn: (req: IncomingMessage$1, res: ServerResponse$1) => void): void;
1089
1112
  }
1090
1113
 
1091
- export { App, CustomError, Mini, QueryRouter, QueryRouterServer, QueryUtil, Route, ServerNode, createSchema, createSkill, define, fromJSONSchema, handleServer, toJSONSchema, tool, util };
1092
- export type { HttpListenerFun, Listener, OnListener, OnWebSocketFn, RouteArray, RouteContext, RouteInfo, RouteMiddleware, RouteObject, RouteOpts, RouterReq, RouterRes, Rule, Run, Schema, Skill, WS, WebSocketListenerFun, WebSocketReq, WebSocketRes };
1114
+ export { App, CustomError, Mini, MockProcess, QueryRouter, QueryRouterServer, QueryUtil, Route, ServerNode, createSchema, createSkill, define, fromJSONSchema, handleServer, listenProcess, toJSONSchema, tool, util };
1115
+ export type { HttpListenerFun, ListenProcessOptions, ListenProcessParams, ListenProcessResponse, Listener, OnListener, OnWebSocketFn, RouteArray, RouteContext, RouteInfo, RouteMiddleware, RouteObject, RouteOpts, RouterReq, RouterRes, Rule, Run, Schema, Skill, WS, WebSocketListenerFun, WebSocketReq, WebSocketRes };
package/dist/router.js CHANGED
@@ -19087,6 +19087,7 @@ export {
19087
19087
  util,
19088
19088
  tool,
19089
19089
  toJSONSchema3 as toJSONSchema,
19090
+ listenProcess,
19090
19091
  handleServer,
19091
19092
  fromJSONSchema3 as fromJSONSchema,
19092
19093
  define2 as define,
@@ -19097,6 +19098,7 @@ export {
19097
19098
  QueryUtil,
19098
19099
  QueryRouterServer,
19099
19100
  QueryRouter,
19101
+ MockProcess,
19100
19102
  Mini,
19101
19103
  CustomError,
19102
19104
  App
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.2.10",
4
+ "version": "0.2.11",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main": "./dist/router.js",
package/src/browser.ts CHANGED
@@ -13,4 +13,6 @@ export { createSkill, tool, fromJSONSchema, toJSONSchema } from './route.ts';
13
13
  export { CustomError } from './result/error.ts';
14
14
 
15
15
  export * from './router-define.ts';
16
+
17
+ export * from './utils/listen-process.ts'
16
18
  // --- 以上同步更新至 browser.ts ---
package/src/index.ts CHANGED
@@ -13,6 +13,8 @@ export { createSkill, tool, fromJSONSchema, toJSONSchema } from './route.ts';
13
13
  export { CustomError } from './result/error.ts';
14
14
 
15
15
  export * from './router-define.ts';
16
+
17
+ export * from './utils/listen-process.ts'
16
18
  // --- 以上同步更新至 browser.ts ---
17
19
 
18
20
  export { ServerNode, handleServer } from './server/index.ts';