96 lines
1.9 KiB
TypeScript
96 lines
1.9 KiB
TypeScript
export interface RouteConfig {
|
||
[route: string]: string;
|
||
}
|
||
|
||
export interface RouteStatusConfig {
|
||
[route: string]: number;
|
||
}
|
||
|
||
export interface AppConfig {
|
||
/** 为 false 时所有请求走代理,不命中 mock 路由;缺省为 true */
|
||
mockEnabled?: boolean;
|
||
cacheConfig: boolean;
|
||
reloadOnChange: boolean;
|
||
defaultContentType: string;
|
||
proxyPort: number;
|
||
targetHost: string;
|
||
/** 代理转发的目标端口;缺省 HTTPS 为 443,HTTP 为 80 */
|
||
targetPort?: number;
|
||
/** 为 false 时用 HTTP 连接上游;缺省 true(HTTPS) */
|
||
targetHttps?: boolean;
|
||
}
|
||
|
||
export interface ConfigFile {
|
||
routes: RouteConfig;
|
||
routeStatuses?: RouteStatusConfig;
|
||
config: AppConfig;
|
||
}
|
||
|
||
export interface ApiListItem {
|
||
name: string;
|
||
route: string;
|
||
}
|
||
|
||
export interface MockFileItem {
|
||
filePath: string;
|
||
alias: string;
|
||
content: string;
|
||
groupId: number | null;
|
||
}
|
||
|
||
export interface RouteRow {
|
||
route_key: string;
|
||
file_path: string;
|
||
status_code: number;
|
||
enabled: number;
|
||
api_name: string;
|
||
}
|
||
|
||
export interface RouteEnabledMap {
|
||
[route: string]: boolean;
|
||
}
|
||
|
||
export interface RouteApiNameMap {
|
||
[route: string]: string;
|
||
}
|
||
|
||
export interface MockGroupRow {
|
||
id: number;
|
||
name: string;
|
||
}
|
||
|
||
export interface MockFileRow {
|
||
file_path: string;
|
||
alias: string;
|
||
group_id: number | null;
|
||
}
|
||
|
||
/** 单 IP 可覆盖的服务端配置(不含 proxyPort) */
|
||
export interface IpRuleConfig {
|
||
mockEnabled?: boolean;
|
||
defaultContentType?: string;
|
||
targetHost?: string;
|
||
targetPort?: number;
|
||
targetHttps?: boolean;
|
||
}
|
||
|
||
export interface IpRule {
|
||
ip: string;
|
||
blocked: boolean;
|
||
remark: string;
|
||
useCustomConfig: boolean;
|
||
config: IpRuleConfig;
|
||
}
|
||
|
||
export interface IpRuleRow {
|
||
ip: string;
|
||
blocked: number;
|
||
remark: string;
|
||
use_custom_config: number;
|
||
mock_enabled: number | null;
|
||
default_content_type: string | null;
|
||
target_host: string | null;
|
||
target_port: number | null;
|
||
target_https: number | null;
|
||
}
|