- Vue 3 + TypeScript + Element Plus 前端界面 - Pinia 状态管理 - Vue Router 4 路由管理 - Axios HTTP 客户端 - MSW (Mock Service Worker) 开发环境模拟 - 账户管理界面 (列表、详情、三科目余额展示) - 交易管理界面 (列表、详情) - 对账管理界面 (三账校验) - 完善的 API 客户端封装 - Docker 容器化配置 - Nginx 配置用于生产环境
75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
interface RequestControllerSource {
|
|
passthrough(): void;
|
|
respondWith(response: Response): void;
|
|
errorWith(reason?: unknown): void;
|
|
}
|
|
declare class RequestController {
|
|
#private;
|
|
protected readonly request: Request;
|
|
protected readonly source: RequestControllerSource;
|
|
static PENDING: 0;
|
|
static PASSTHROUGH: 1;
|
|
static RESPONSE: 2;
|
|
static ERROR: 3;
|
|
readyState: number;
|
|
/**
|
|
* A Promise that resolves when this controller handles a request.
|
|
* See `controller.readyState` for more information on the handling result.
|
|
*/
|
|
handled: Promise<void>;
|
|
constructor(request: Request, source: RequestControllerSource);
|
|
/**
|
|
* Perform this request as-is.
|
|
*/
|
|
passthrough(): Promise<void>;
|
|
/**
|
|
* Respond to this request with the given `Response` instance.
|
|
*
|
|
* @example
|
|
* controller.respondWith(new Response())
|
|
* controller.respondWith(Response.json({ id }))
|
|
* controller.respondWith(Response.error())
|
|
*/
|
|
respondWith(response: Response): void;
|
|
/**
|
|
* Error this request with the given reason.
|
|
*
|
|
* @example
|
|
* controller.errorWith()
|
|
* controller.errorWith(new Error('Oops!'))
|
|
* controller.errorWith({ message: 'Oops!'})
|
|
*/
|
|
errorWith(reason?: unknown): void;
|
|
}
|
|
|
|
declare const IS_PATCHED_MODULE: unique symbol;
|
|
|
|
type RequestCredentials = 'omit' | 'include' | 'same-origin';
|
|
type HttpRequestEventMap = {
|
|
request: [
|
|
args: {
|
|
request: Request;
|
|
requestId: string;
|
|
controller: RequestController;
|
|
}
|
|
];
|
|
response: [
|
|
args: {
|
|
response: Response;
|
|
isMockedResponse: boolean;
|
|
request: Request;
|
|
requestId: string;
|
|
}
|
|
];
|
|
unhandledException: [
|
|
args: {
|
|
error: unknown;
|
|
request: Request;
|
|
requestId: string;
|
|
controller: RequestController;
|
|
}
|
|
];
|
|
};
|
|
|
|
export { HttpRequestEventMap as H, IS_PATCHED_MODULE as I, RequestController as R, RequestControllerSource as a, RequestCredentials as b };
|