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 * as api from "@/lib/backend/api";
import type { InstalledPlugin } from "@/types/database";
import { COMPONENT_PLUGINS_UPDATED_EVENT } from "@/lib/updates/componentUpdateEvents";
let installedPluginsPromise: Promise<InstalledPlugin[]> | null = null;
function installedPlugins(): Promise<InstalledPlugin[]> {
installedPluginsPromise ||= api.listPlugins().catch((error) => {
installedPluginsPromise = null;
throw error;
});
return installedPluginsPromise;
}
export function clearPluginIconCache() {
installedPluginsPromise = null;
}
// This cache is global, but the plugin set can change from entry points other than the plugin
// center (e.g. the update center dispatches COMPONENT_PLUGINS_UPDATED_EVENT from App.vue while the
// center is closed; batch uninstall dispatches only dbx:plugins-changed). Invalidate on both
// events here, at the cache owner, so freshly installed or updated plugins don't keep a stale
// (missing) icon in the sidebar, tabs and connection tree until the plugin center happens to
// mount.
if (typeof window !== "undefined") {
window.addEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, clearPluginIconCache);
window.addEventListener("dbx:plugins-changed", clearPluginIconCache);
}
export async function resolvePluginIcon(pluginId: string, contributionId?: string): Promise<string | undefined> {
const plugin = (await installedPlugins()).find((entry) => entry.manifest.id === pluginId);
if (!plugin) return undefined;
const contribution = contributionId ? plugin.manifest.contributions?.find((entry) => entry.id === contributionId) : undefined;
return (contribution && "icon" in contribution ? contribution.icon : undefined) || plugin.manifest.icon;
}