chore: update version to 0.0.41 and improve Route class formatting
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package",
|
"$schema": "https://json.schemastore.org/package",
|
||||||
"name": "@kevisual/router",
|
"name": "@kevisual/router",
|
||||||
"version": "0.0.40",
|
"version": "0.0.41",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/router.js",
|
"main": "./dist/router.js",
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export type RouteOpts<U = {}, T = SimpleObject> = {
|
|||||||
export type DefineRouteOpts = Omit<RouteOpts, 'idUsePath' | 'nextRoute'>;
|
export type DefineRouteOpts = Omit<RouteOpts, 'idUsePath' | 'nextRoute'>;
|
||||||
const pickValue = ['path', 'key', 'id', 'description', 'type', 'middleware', 'metadata'] as const;
|
const pickValue = ['path', 'key', 'id', 'description', 'type', 'middleware', 'metadata'] as const;
|
||||||
export type RouteInfo = Pick<Route, (typeof pickValue)[number]>;
|
export type RouteInfo = Pick<Route, (typeof pickValue)[number]>;
|
||||||
export class Route<U = { [key: string]: any }, T extends SimpleObject =SimpleObject> {
|
export class Route<U = { [key: string]: any }, T extends SimpleObject = SimpleObject> {
|
||||||
/**
|
/**
|
||||||
* 一级路径
|
* 一级路径
|
||||||
*/
|
*/
|
||||||
@@ -658,8 +658,7 @@ export class QueryRouterServer extends QueryRouter {
|
|||||||
async run(msg: { id?: string; path?: string; key?: string; payload?: any }, ctx?: RouteContext & { [key: string]: any }) {
|
async run(msg: { id?: string; path?: string; key?: string; payload?: any }, ctx?: RouteContext & { [key: string]: any }) {
|
||||||
const handle = this.handle;
|
const handle = this.handle;
|
||||||
if (handle) {
|
if (handle) {
|
||||||
const result = await this.call(msg, ctx);
|
return handle(msg, ctx);
|
||||||
return handle(result);
|
|
||||||
}
|
}
|
||||||
return super.run(msg, ctx);
|
return super.run(msg, ctx);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user