Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

1.0 KB
Raw Blame
export const MQ_PINNED_VERSION_AUTO = "auto";

export interface MqPinnedVersionOption {
  value: string;
  label: string;
  description: string;
}

export const MQ_PINNED_VERSION_OPTIONS: MqPinnedVersionOption[] = [
  {
    value: MQ_PINNED_VERSION_AUTO,
    label: "Auto detect",
    description: "Probe /admin/v2/brokers/version and use the default 3.1.x profile if probing fails.",
  },
  {
    value: "3.1.x",
    label: "Apache Pulsar 3.1.x",
    description: "Supported Pulsar 3.x admin API profile, compatible with the 3.0/3.1 LTS line.",
  },
];

export function pinnedVersionToSelection(pinnedVersion: string | null | undefined): string {
  const value = pinnedVersion?.trim();
  if (!value) return MQ_PINNED_VERSION_AUTO;
  if (/^3(?:\.|$)/.test(value)) return "3.1.x";
  return MQ_PINNED_VERSION_AUTO;
}

export function selectionToPinnedVersion(selection: string): string | undefined {
  return MQ_PINNED_VERSION_OPTIONS.some((option) => option.value === selection) && selection !== MQ_PINNED_VERSION_AUTO ? selection : undefined;
}