ts-api-core
Version:
Nodejs api framework core
35 lines (34 loc) • 2.06 kB
TypeScript
import { RequestContext } from '../context/request.context';
import { ClassType } from "../base/type";
import { AbstractValidator } from "../mvc/validation/abstract.validator";
import { RequestParam, RequestConfig, RequestParamValidate } from "../base/reqest.data";
import { Result } from "../base/result";
import { RawWrapper } from '../wrapper/base.route.raw.wrapper';
import { BaseController } from "./base.controller";
/** Raw 类型请求 Controller */
export declare class BaseRouteRawController extends BaseController {
/** 默认请求配置 */
static defaultRequestConfig: RequestConfig;
/** 执行请求 */
executeRequest(context: RequestContext): Promise<Result<any>>;
/** 是否可以执行 wrapper */
protected canExecuteWrapper(context: RequestContext): boolean;
/** 获取 Wrapper */
protected getWrapper(context: RequestContext): RawWrapper;
/** 参数校验 */
protected validateParam(context: RequestContext): void;
/** 校验 Query 参数 */
protected validateQueryParam(query: (string | RequestParam)[], context: RequestContext): void;
/** 校验 Body 参数 */
protected validateBodyParam(body: (string | RequestParam) | (string | RequestParam)[] | undefined, context: RequestContext): void;
/** 参数校验 */
protected validateParams(context: RequestContext, parent: Record<string, any> | Array<any>, srcKey: string | number, params: (string | RequestParam | undefined)[], config: RequestConfig): Record<string, any>;
/** 检测是否为动态字段 */
protected isDynamicField(name: string): boolean;
/** 获取参数校验器类 */
protected getValidator(validate: RequestParamValidate): ClassType<AbstractValidator> | undefined;
/** 执行参数校验器 */
protected executeValidate(validate: RequestParamValidate, fieldName: string, value: any | undefined, ...args: any[]): any | undefined;
/** 把对象的key转成小写 */
protected transKeyToLowercase(data: any | undefined): any | undefined;
}