@kevisual/router 0.0.51 → 0.0.53
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-browser.d.ts +15 -0
- package/dist/router-browser.js +306 -60
- package/dist/router.d.ts +30 -4
- package/dist/router.js +791 -66
- package/package.json +16 -18
- package/src/app.ts +9 -0
- package/src/auto/index.ts +19 -0
- package/src/index.ts +4 -2
- package/src/modules/chat.ts +57 -0
- package/src/route.ts +29 -1
- package/src/server/server-base.ts +5 -1
- package/src/server/server-bun.ts +1 -0
- package/src/server/server-type.ts +1 -1
- package/src/server/ws-server.ts +2 -1
- package/src/test/chat.ts +1 -1
- package/auto.ts +0 -19
- package/dist/router-sign.d.ts +0 -16
- package/dist/router-sign.js +0 -14052
- package/src/chat.ts +0 -40
- package/src/io.ts +0 -6
- package/src/router-simple-lib.ts +0 -3
- package/src/sign.ts +0 -59
- package/src/static.ts +0 -97
package/dist/router-browser.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ type RouterContextT = {
|
|
|
11
11
|
type RouteContext<T = {
|
|
12
12
|
code?: number;
|
|
13
13
|
}, S = any> = {
|
|
14
|
+
/**
|
|
15
|
+
* 本地自己调用的时候使用,可以标识为当前自调用,那么 auth 就不许重复的校验
|
|
16
|
+
* 或者不需要登录的,直接调用
|
|
17
|
+
*/
|
|
18
|
+
appId?: string;
|
|
14
19
|
query?: {
|
|
15
20
|
[key: string]: any;
|
|
16
21
|
};
|
|
@@ -152,6 +157,7 @@ declare class Route<U = {
|
|
|
152
157
|
throw(code?: number | string, message?: string, tips?: string): void;
|
|
153
158
|
}
|
|
154
159
|
declare class QueryRouter {
|
|
160
|
+
appId: string;
|
|
155
161
|
routes: Route[];
|
|
156
162
|
maxNextRoute: number;
|
|
157
163
|
context?: RouteContext;
|
|
@@ -280,6 +286,13 @@ declare class QueryRouter {
|
|
|
280
286
|
hasRoute(path: string, key?: string): Route<{
|
|
281
287
|
[key: string]: any;
|
|
282
288
|
}, SimpleObject$1>;
|
|
289
|
+
findRoute(opts?: {
|
|
290
|
+
path?: string;
|
|
291
|
+
key?: string;
|
|
292
|
+
id?: string;
|
|
293
|
+
}): Route<{
|
|
294
|
+
[key: string]: any;
|
|
295
|
+
}, SimpleObject$1>;
|
|
283
296
|
createRouteList(force?: boolean, filter?: (route: Route) => boolean): void;
|
|
284
297
|
/**
|
|
285
298
|
* 等待程序运行, 获取到message的数据,就执行
|
|
@@ -304,6 +317,7 @@ declare class QueryRouter {
|
|
|
304
317
|
type QueryRouterServerOpts = {
|
|
305
318
|
handleFn?: HandleFn;
|
|
306
319
|
context?: RouteContext;
|
|
320
|
+
appId?: string;
|
|
307
321
|
};
|
|
308
322
|
interface HandleFn<T = any> {
|
|
309
323
|
(msg: {
|
|
@@ -322,6 +336,7 @@ interface HandleFn<T = any> {
|
|
|
322
336
|
* @description 移除server相关的功能,只保留router相关的功能,和http.createServer不相关,独立
|
|
323
337
|
*/
|
|
324
338
|
declare class QueryRouterServer extends QueryRouter {
|
|
339
|
+
appId: string;
|
|
325
340
|
handle: any;
|
|
326
341
|
constructor(opts?: QueryRouterServerOpts);
|
|
327
342
|
setHandle(wrapperFn?: HandleFn, ctx?: RouteContext): void;
|