25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
export interface AgentOfflineExportFlowOptions<TResult> {
includeJres?: boolean;
driverKeys: string[];
chooseDestination: () => Promise<string | null>;
exportPackage: (destination: string, driverKeys: string[], includeJres?: boolean) => Promise<TResult>;
}
export interface AgentOfflineExportFlowResult<TResult> {
destination: string;
result: TResult;
}
export interface AgentOfflineExportActionOptions<TResult> extends AgentOfflineExportFlowOptions<TResult> {
setBusy: (busy: boolean) => void;
onSuccess: (exported: AgentOfflineExportFlowResult<TResult>) => void | Promise<void>;
onError: (error: unknown) => void | Promise<void>;
}
export type AgentOfflineExportActionResult = "empty" | "cancelled" | "exported" | "failed";
/**
* Keep destination selection and package creation in one testable workflow.
* The caller owns the busy state so it can cover the native save dialog too.
*/
export async function runAgentOfflineExportFlow<TResult>({ driverKeys, includeJres = true, chooseDestination, exportPackage }: AgentOfflineExportFlowOptions<TResult>): Promise<AgentOfflineExportFlowResult<TResult> | null> {
if (driverKeys.length === 0) return null;
const destination = await chooseDestination();
if (!destination) return null;
return {
destination,
result: await exportPackage(destination, [...driverKeys], includeJres),
};
}
/**
* Own the complete UI action lifecycle, including the native save dialog.
* This keeps busy-state release and success/error side effects testable as one
* contract instead of splitting them between the component and export helper.
*/
export async function runAgentOfflineExportAction<TResult>({ driverKeys, includeJres = true, chooseDestination, exportPackage, setBusy, onSuccess, onError }: AgentOfflineExportActionOptions<TResult>): Promise<AgentOfflineExportActionResult> {
if (driverKeys.length === 0) return "empty";
setBusy(true);
try {
const exported = await runAgentOfflineExportFlow({ driverKeys, includeJres, chooseDestination, exportPackage });
if (!exported) return "cancelled";
await onSuccess(exported);
return "exported";
} catch (error) {
await onError(error);
return "failed";
} finally {
setBusy(false);
}
}