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
import type { TenantConfig } from "@/types/mq";
export function normalizeClusterOptions(clusters: readonly unknown[]): string[] {
const seen = new Set<string>();
const result: string[] = [];
for (const cluster of clusters) {
if (typeof cluster !== "string") continue;
const name = cluster.trim();
if (!name || seen.has(name)) continue;
seen.add(name);
result.push(name);
}
return result;
}
export function mqClusterOptionsFromExtra(extra: unknown): string[] {
if (!extra || typeof extra !== "object") return [];
const clusters = (extra as { clusters?: unknown }).clusters;
if (!Array.isArray(clusters)) return [];
return normalizeClusterOptions(clusters);
}
export function defaultTenantConfig(clusterOptions: readonly string[]): TenantConfig {
return {
adminRoles: [],
allowedClusters: normalizeClusterOptions(clusterOptions),
};
}
export function validateTenantForm(name: string | undefined, config: TenantConfig): string | undefined {
if (!name?.trim()) {
return "mqTenants.tenantNameRequired";
}
if (!normalizeClusterOptions(config.allowedClusters).length) {
return "mqTenants.allowedClustersRequired";
}
return undefined;
}