feat(connection): centralize connection type registration

This commit is contained in:
t8y2 committed 2026-08-23 16:38:06 +08:00
1 parent 38664e6aea
commit 0827478078
114 files changed
+5284 -1342

No files matched your search

@@ -15,6 +15,7 @@ import { HelpTooltip, Tooltip, TooltipContent, TooltipTrigger } from "@/componen
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { Switch } from "@/components/ui/switch";
import type { ConnectionConfig, ConnectionTestResult, DatabaseConnectionInfo, DatabaseType, HttpTunnelConfig, IdentifierCase, JdbcDriverInfo, JdbcLocalBundleInfo, JdbcMavenBundleInfo, ProxyTunnelConfig, SshConfigHostEntry, SshTunnelConfig, TransportLayerConfig } from "@/types/database";
import { CONNECTION_PICKER_OPTIONS, CONNECTION_PROFILES, CONNECTION_PROFILE_ICONS, type ConnectionPickerOption, type ConnectionProfileCategory, type ConnectionProfileDefinition } from "@/types/generated/connectionProfiles";
import type { InfluxDbExternalConfig, InfluxDbVersion } from "@/types/influxdb";
import type { VictoriaMetricsExternalConfig } from "@/types/victoriametrics";
import type { MqAdminConfig, MqAuth, MqSystemKind } from "@/types/mq";
@@ -104,6 +105,7 @@ import {
import { buildDraftVisibleDatabasesConnectionId, connectionCanChooseVisibleDatabases, initialVisibleDatabaseSelection, visibleObjectFiltersNeedReset } from "@/lib/connection/connectionVisibleDatabases";
import { canSaveVisibleDatabaseSelection, connectionUsesVisibleSchemaFilter, filterDatabaseNamesForVisiblePicker, filterSchemaNamesForVisiblePicker, normalizeVisibleDatabaseSelection, buildDraftVisibleSchemasConnectionId, normalizeVisibleSchemaSelection } from "@/lib/database/visibleDatabases";
import { isSchemaAware, isSingleDatabase } from "@/lib/database/databaseFeatureSupport";
import { databaseConnectionFormKind } from "@/lib/database/databaseDriverManifest";
import VisibleSchemasDialog from "@/components/sidebar/VisibleSchemasDialog.vue";
import CloudflareD1ConnectionFields from "@/components/connection/CloudflareD1ConnectionFields.vue";
import SpannerConnectionFields from "@/components/connection/SpannerConnectionFields.vue";
@@ -161,8 +163,8 @@ import {
jdbcProductProfileIdsForCategory,
} from "@/lib/database/jdbcProductProfiles";
type DbOption = { value: string; label: string };
type DbCategoryKey = "sql" | "analytics" | "domestic" | "lightweight" | "document" | "graph_ai" | "timeseries" | "mq" | "registry_config";
type DbOption = ConnectionPickerOption;
type DbCategoryKey = ConnectionProfileCategory;
type DbCategory = { key: DbCategoryKey; title: string; options: DbOption[] };
type DialogStep = "select" | "config";
export type ConfigTab = "connection" | "advanced" | "tls" | "transport";
@@ -1085,230 +1087,8 @@ function handleCustomColorInput(value: string) {
applyCustomColor(value);
}
const driverProfiles: Record<
string,
{
type: DatabaseType;
port: number;
user: string;
label: string;
icon: string;
host?: string;
urlParams?: string;
}
> = {
mysql: { type: "mysql", port: 3306, user: "root", label: "MySQL", icon: "mysql", urlParams: "" },
postgres: {
type: "postgres",
port: 5432,
user: "postgres",
label: "PostgreSQL",
icon: "postgres",
urlParams: "",
},
cloudberry: {
type: "postgres",
port: 5432,
user: "postgres",
label: "Apache Cloudberry",
icon: "cloudberry",
urlParams: "",
},
opentenbase: {
type: "postgres",
port: 11000,
user: "opentenbase",
label: "OpenTenBase",
icon: "opentenbase",
urlParams: "",
},
redis: { type: "redis", port: 6379, user: "", label: "Redis", icon: "redis" },
sqlite: { type: "sqlite", port: 0, user: "", label: "SQLite", icon: "sqlite" },
rqlite: { type: "rqlite", port: 4001, user: "", label: "RQLite", icon: "rqlite" },
turso: { type: "turso", port: 443, user: "", label: "Turso", icon: "turso" },
"cloudflare-d1": { type: "cloudflare-d1", port: 443, user: "", label: "Cloudflare D1", icon: "cloudflare-d1" },
duckdb: { type: "duckdb", port: 0, user: "", label: "DuckDB", icon: "duckdb" },
access: { type: "access", port: 0, user: "", label: "Microsoft Access", icon: "access" },
mongodb: { type: "mongodb", port: 27017, user: "", label: "MongoDB", icon: "mongodb" },
"mongodb-legacy": { type: "mongodb", port: 27017, user: "", label: "MongoDB (Legacy)", icon: "mongodb" },
dynamodb: {
type: "dynamodb",
port: 443,
user: "",
label: "Amazon DynamoDB",
icon: "dynamodb",
host: "dynamodb.us-east-1.amazonaws.com",
},
clickhouse: {
type: "clickhouse",
port: 8123,
user: "default",
label: "ClickHouse",
icon: "clickhouse",
},
sqlserver: { type: "sqlserver", port: 1433, user: "sa", label: "SQL Server", icon: "sqlserver" },
oracle: { type: "oracle", port: 1521, user: "system", label: "Oracle", icon: "oracle" },
elasticsearch: {
type: "elasticsearch",
port: 9200,
user: "",
label: "Elasticsearch",
icon: "elasticsearch",
},
easysearch: {
type: "easysearch",
port: 9200,
user: "",
label: "Easysearch",
icon: "easysearch",
},
meilisearch: {
type: "meilisearch",
port: 7700,
user: "",
label: "Meilisearch",
icon: "meilisearch",
},
hbase: { type: "hbase", port: 8080, user: "", label: "Apache HBase", icon: "hbase" },
qdrant: { type: "qdrant", port: 6333, user: "", label: "Qdrant", icon: "qdrant" },
milvus: { type: "milvus", port: 19530, user: "root", label: "Milvus", icon: "milvus" },
weaviate: { type: "weaviate", port: 8080, user: "", label: "Weaviate", icon: "weaviate" },
chromadb: { type: "chromadb", port: 8000, user: "", label: "ChromaDB", icon: "chromadb" },
mariadb: { type: "mysql", port: 3306, user: "root", label: "MariaDB", icon: "mariadb" },
tidb: { type: "mysql", port: 4000, user: "root", label: "TiDB", icon: "tidb" },
oceanbase: { type: "mysql", port: 2883, user: "root", label: "OceanBase", icon: "oceanbase" },
"oceanbase-oracle": {
type: "oceanbase-oracle",
port: 2883,
user: "SYS",
label: "OceanBase Oracle Mode",
icon: "oceanbase",
},
goldendb: { type: "goldendb", port: 3306, user: "root", label: "金篆 GoldenDB", icon: "goldendb" },
databend: { type: "databend", port: 8000, user: "databend", label: "Databend", icon: "databend" },
tdsql: { type: "mysql", port: 3306, user: "root", label: "TDSQL", icon: "tdsql" },
polardb: { type: "mysql", port: 3306, user: "root", label: "PolarDB", icon: "polardb" },
greatsql: { type: "mysql", port: 3306, user: "root", label: "GreatSQL", icon: "greatsql" },
databricks: { type: "databricks", port: 443, user: "token", label: "Databricks SQL", icon: "databricks" },
saphana: { type: "saphana", port: 30015, user: "SYSTEM", label: "SAP HANA", icon: "saphana" },
teradata: { type: "teradata", port: 1025, user: "", label: "Teradata", icon: "teradata" },
vertica: { type: "vertica", port: 5433, user: "dbadmin", label: "Vertica", icon: "vertica" },
firebird: { type: "firebird", port: 3050, user: "SYSDBA", label: "Firebird", icon: "firebird" },
exasol: { type: "exasol", port: 8563, user: "sys", label: "Exasol", icon: "exasol" },
gbase: { type: "gbase", port: 5258, user: "gbasedbt", label: "南大通用 GBase 8a", icon: "gbase" },
gbase8a: { type: "gbase", port: 5258, user: "gbasedbt", label: "南大通用 GBase 8a", icon: "gbase" },
gbase8s: { type: "gbase", port: 9088, user: "gbasedbt", label: "南大通用 GBase 8s", icon: "gbase" },
opengauss: {
type: "opengauss",
port: 5432,
user: "gaussdb",
label: "openGauss",
icon: "opengauss",
},
gaussdb: { type: "gaussdb", port: 5432, user: "gaussdb", label: "GaussDB", icon: "gaussdb" },
kwdb: { type: "kwdb", port: 26257, user: "root", label: "KWDB", icon: "kwdb" },
questdb: { type: "questdb", port: 8812, user: "questdb", label: "QuestDB", icon: "questdb" },
kingbase: { type: "kingbase", port: 54321, user: "system", label: "金仓KingbaseES", icon: "kingbase" },
highgo: { type: "highgo", port: 5866, user: "highgo", label: "瀚高 HighGo", icon: "highgo" },
uxdb: { type: "uxdb", port: 52025, user: "uxdb", label: "优炫 UXDB", icon: "uxdb" },
yashandb: { type: "yashandb", port: 1688, user: "sys", label: "崖山 YashanDB", icon: "yashandb" },
vastbase: { type: "vastbase", port: 5432, user: "vastbase", label: "海量 Vastbase", icon: "vastbase" },
doris: { type: "mysql", port: 9030, user: "root", label: "Doris", icon: "doris", urlParams: "" },
selectdb: {
type: "mysql",
port: 9030,
user: "root",
label: "SelectDB",
icon: "selectdb",
urlParams: "",
},
starrocks: {
type: "mysql",
port: 9030,
user: "root",
label: "StarRocks",
icon: "starrocks",
urlParams: "",
},
manticoresearch: {
type: "manticoresearch",
port: 9306,
user: "root",
label: "Manticore Search",
icon: "manticoresearch",
urlParams: "",
},
redshift: { type: "redshift", port: 5439, user: "awsuser", label: "Redshift", icon: "redshift" },
cockroachdb: {
type: "postgres",
port: 26257,
user: "root",
label: "CockroachDB",
icon: "cockroachdb",
},
dm: { type: "dameng", port: 5236, user: "SYSDBA", label: "达梦 Dameng", icon: "dm" },
h2: { type: "h2", port: 9092, user: "sa", label: "H2", icon: "h2" },
"h2-legacy": { type: "h2", port: 9092, user: "sa", label: "H2 2.1 Legacy", icon: "h2" },
snowflake: { type: "snowflake", port: 443, user: "", label: "Snowflake", icon: "snowflake" },
trino: { type: "trino", port: 8080, user: "", label: "Trino", icon: "trino" },
prestosql: { type: "prestosql", port: 8080, user: "", label: "PrestoSQL", icon: "presto" },
hive: { type: "hive", port: 10000, user: "", label: "Apache Hive", icon: "hive" },
kyuubi: { type: "kyuubi", port: 10009, user: "", label: "Apache Kyuubi", icon: "kyuubi", urlParams: "auth=NONE" },
impala: { type: "impala", port: 21050, user: "", label: "Apache Impala", icon: "impala", urlParams: "auth=noSasl" },
spark: { type: "spark", port: 10015, user: "", label: "Apache Spark", icon: "spark" },
db2: { type: "db2", port: 50000, user: "db2inst1", label: "IBM DB2", icon: "db2" },
informix: { type: "informix", port: 9088, user: "informix", label: "Informix", icon: "informix" },
dremio: { type: "jdbc", port: 31010, user: "", label: "Dremio", icon: "dremio" },
jdbcx: { type: "jdbc", port: 0, user: "", label: "JDBCX", icon: "jdbcx" },
neo4j: { type: "neo4j", port: 7687, user: "neo4j", label: "Neo4j", icon: "neo4j" },
cassandra: { type: "cassandra", port: 9042, user: "cassandra", label: "Cassandra", icon: "cassandra" },
bigquery: {
type: "bigquery",
port: 443,
user: "",
label: "BigQuery",
icon: "bigquery",
host: "https://www.googleapis.com/bigquery/v2",
},
spanner: { type: "spanner", port: 443, user: "", label: "Cloud Spanner", icon: "spanner" },
kylin: { type: "kylin", port: 7070, user: "ADMIN", label: "Apache Kylin", icon: "kylin" },
ignite: { type: "ignite", port: 10800, user: "", label: "Apache Ignite", icon: "ignite" },
ignite3: { type: "ignite3", port: 10800, user: "", label: "Apache Ignite 3", icon: "ignite" },
sundb: { type: "sundb", port: 22000, user: "root", label: "科蓝 SUNDB", icon: "sundb" },
oscar: { type: "oscar", port: 2003, user: "SYSDBA", label: "神通 OSCAR", icon: "oscar" },
jdbc: { type: "jdbc", port: 0, user: "", label: "JDBC", icon: "jdbc" },
tdengine: { type: "tdengine", port: 6041, user: "root", label: "TDengine", icon: "tdengine" },
xugu: { type: "xugu", port: 5138, user: "", label: "虚谷 XuguDB", icon: "xugu" },
iotdb: { type: "iotdb", port: 6667, user: "root", label: "Apache IoTDB", icon: "iotdb" },
etcd: { type: "etcd", port: 2379, user: "", label: "etcd", icon: "etcd" },
zookeeper: { type: "zookeeper", port: 2181, user: "", label: "Apache ZooKeeper", icon: "zookeeper" },
mq: { type: "mq", port: 8080, user: "", label: "Apache Pulsar", icon: "pulsar", host: "127.0.0.1" },
kafka: { type: "mq", port: 9092, user: "", label: "Apache Kafka", icon: "kafka", host: "127.0.0.1" },
rocketmq: { type: "mq", port: 9876, user: "", label: "Apache RocketMQ", icon: "rocketmq", host: "127.0.0.1" },
rabbitmq: { type: "mq", port: 5672, user: "", label: "RabbitMQ", icon: "rabbitmq", host: "127.0.0.1" },
nacos: { type: "nacos", port: 8848, user: "nacos", label: "Nacos", icon: "nacos", host: "127.0.0.1" },
consul: { type: "consul", port: 8500, user: "", label: "Consul", icon: "consul", host: "127.0.0.1" },
mqtt: { type: "mqtt", port: 1883, user: "", label: "MQTT", icon: "mqtt", host: "127.0.0.1" },
iris: { type: "iris", port: 1972, user: "_SYSTEM", label: "IRIS", icon: "iris" },
influxdb: { type: "influxdb", port: 8086, user: "", label: "InfluxDB", icon: "InfluxDB" },
victoriametrics: { type: "victoriametrics", port: 8428, user: "", label: "VictoriaMetrics", icon: "victoriametrics" },
custom_mysql: {
type: "mysql",
port: 3306,
user: "root",
label: "Custom",
icon: "mysql",
urlParams: "",
},
dolt: { type: "mysql", port: 3306, user: "root", label: "Dolt", icon: "dolt", urlParams: "" },
custom_postgres: {
type: "postgres",
port: 5432,
user: "postgres",
label: "Custom",
icon: "postgres",
urlParams: "",
},
const driverProfiles: Record<string, ConnectionProfileDefinition> = {
...CONNECTION_PROFILES,
...jdbcProductDriverProfiles(),
};
@@ -2971,259 +2751,35 @@ function isH2FileJdbcUrlLikePath(value: string): boolean {
}
const iconTypeMap: Record<string, string> = {
mysql: "mysql",
postgres: "postgres",
cloudberry: "cloudberry",
opentenbase: "opentenbase",
sqlite: "sqlite",
rqlite: "rqlite",
turso: "turso",
"cloudflare-d1": "cloudflare-d1",
access: "access",
redis: "redis",
mongodb: "mongodb",
dynamodb: "dynamodb",
duckdb: "duckdb",
clickhouse: "clickhouse",
sqlserver: "sqlserver",
oracle: "oracle",
elasticsearch: "elasticsearch",
easysearch: "easysearch",
meilisearch: "meilisearch",
hbase: "hbase",
qdrant: "qdrant",
milvus: "milvus",
weaviate: "weaviate",
chromadb: "chromadb",
mariadb: "mariadb",
tidb: "tidb",
oceanbase: "oceanbase",
"oceanbase-oracle": "oceanbase",
goldendb: "goldendb",
databend: "databend",
tdsql: "tdsql",
polardb: "polardb",
greatsql: "greatsql",
databricks: "databricks",
saphana: "saphana",
teradata: "teradata",
vertica: "vertica",
firebird: "firebird",
exasol: "exasol",
gbase: "gbase",
opengauss: "opengauss",
gaussdb: "gaussdb",
kwdb: "kwdb",
questdb: "questdb",
kingbase: "kingbase",
highgo: "highgo",
uxdb: "uxdb",
yashandb: "yashandb",
vastbase: "vastbase",
doris: "doris",
selectdb: "selectdb",
starrocks: "starrocks",
manticoresearch: "manticoresearch",
redshift: "redshift",
cockroachdb: "cockroachdb",
tdengine: "tdengine",
xugu: "xugu",
iotdb: "iotdb",
etcd: "etcd",
zookeeper: "zookeeper",
mq: "mq",
kafka: "kafka",
rocketmq: "rocketmq",
rabbitmq: "rabbitmq",
nacos: "nacos",
consul: "consul",
mqtt: "mqtt",
dm: "dm",
h2: "h2",
snowflake: "snowflake",
trino: "trino",
prestosql: "prestosql",
hive: "hive",
kyuubi: "kyuubi",
impala: "impala",
spark: "spark",
db2: "db2",
informix: "informix",
dremio: "dremio",
jdbcx: "jdbcx",
iris: "iris",
neo4j: "neo4j",
cassandra: "cassandra",
bigquery: "bigquery",
spanner: "spanner",
kylin: "kylin",
ignite: "ignite",
ignite3: "ignite",
sundb: "sundb",
oscar: "oscar",
influxdb: "influxdb",
victoriametrics: "victoriametrics",
jdbc: "jdbc",
custom_mysql: "mysql",
dolt: "dolt",
custom_postgres: "postgres",
...CONNECTION_PROFILE_ICONS,
...jdbcProductIconTypes(),
};
const dbOptions: DbOption[] = [
{ value: "postgres", label: "PostgreSQL" },
{ value: "cloudberry", label: "Apache Cloudberry" },
{ value: "opentenbase", label: "OpenTenBase" },
{ value: "mysql", label: "MySQL" },
{ value: "mongodb", label: "MongoDB" },
{ value: "dynamodb", label: "Amazon DynamoDB" },
{ value: "redis", label: "Redis" },
{ value: "oracle", label: "Oracle" },
{ value: "sqlite", label: "SQLite" },
{ value: "sqlserver", label: "SQL Server" },
{ value: "elasticsearch", label: "Elasticsearch" },
{ value: "easysearch", label: "Easysearch" },
{ value: "meilisearch", label: "Meilisearch" },
{ value: "hbase", label: "Apache HBase" },
{ value: "qdrant", label: "Qdrant" },
{ value: "milvus", label: "Milvus" },
{ value: "weaviate", label: "Weaviate" },
{ value: "chromadb", label: "ChromaDB" },
{ value: "dm", label: "达梦 Dameng" },
{ value: "opengauss", label: "openGauss" },
{ value: "turso", label: "Turso" },
{ value: "cloudflare-d1", label: "Cloudflare D1" },
{ value: "duckdb", label: "DuckDB" },
{ value: "rqlite", label: "RQLite" },
{ value: "access", label: "Microsoft Access" },
{ value: "mariadb", label: "MariaDB" },
{ value: "clickhouse", label: "ClickHouse" },
{ value: "gaussdb", label: "GaussDB" },
{ value: "kwdb", label: "KWDB" },
{ value: "questdb", label: "QuestDB" },
{ value: "tidb", label: "TiDB" },
{ value: "oceanbase", label: "OceanBase" },
{ value: "goldendb", label: "金篆 GoldenDB" },
{ value: "databend", label: "Databend" },
{ value: "tdsql", label: "TDSQL" },
{ value: "polardb", label: "PolarDB" },
{ value: "greatsql", label: "GreatSQL" },
{ value: "doris", label: "Doris" },
{ value: "selectdb", label: "SelectDB" },
{ value: "starrocks", label: "StarRocks" },
{ value: "tdengine", label: "TDengine" },
{ value: "databricks", label: "Databricks SQL" },
{ value: "saphana", label: "SAP HANA" },
{ value: "teradata", label: "Teradata" },
{ value: "vertica", label: "Vertica" },
{ value: "firebird", label: "Firebird" },
{ value: "exasol", label: "Exasol" },
{ value: "gbase", label: "南大通用 GBase" },
{ value: "kingbase", label: "金仓KingbaseES" },
{ value: "highgo", label: "瀚高 HighGo" },
{ value: "uxdb", label: "优炫 UXDB" },
{ value: "yashandb", label: "崖山 YashanDB" },
{ value: "vastbase", label: "海量 Vastbase" },
{ value: "redshift", label: "Redshift" },
{ value: "cockroachdb", label: "CockroachDB" },
{ value: "h2", label: "H2" },
{ value: "snowflake", label: "Snowflake" },
{ value: "trino", label: "Trino" },
{ value: "prestosql", label: "PrestoSQL" },
{ value: "hive", label: "Hive" },
{ value: "kyuubi", label: "Apache Kyuubi" },
{ value: "impala", label: "Apache Impala" },
{ value: "spark", label: "Apache Spark" },
{ value: "db2", label: "DB2" },
{ value: "informix", label: "Informix" },
{ value: "neo4j", label: "Neo4j" },
{ value: "cassandra", label: "Cassandra" },
{ value: "bigquery", label: "BigQuery" },
{ value: "spanner", label: "Cloud Spanner" },
{ value: "kylin", label: "Kylin" },
{ value: "ignite", label: "Apache Ignite" },
{ value: "ignite3", label: "Apache Ignite 3" },
{ value: "sundb", label: "科蓝 SUNDB" },
{ value: "oscar", label: "神通 OSCAR" },
{ value: "xugu", label: "虚谷 XuguDB" },
{ value: "iotdb", label: "Apache IoTDB" },
{ value: "etcd", label: "etcd" },
{ value: "zookeeper", label: "Apache ZooKeeper" },
{ value: "mq", label: "Apache Pulsar" },
{ value: "kafka", label: "Apache Kafka" },
{ value: "rocketmq", label: "Apache RocketMQ" },
{ value: "rabbitmq", label: "RabbitMQ" },
{ value: "mqtt", label: "MQTT" },
{ value: "nacos", label: "Nacos" },
{ value: "consul", label: "Consul" },
{ value: "influxdb", label: "InfluxDB" },
{ value: "victoriametrics", label: "VictoriaMetrics" },
{ value: "iris", label: "IRIS" },
{ value: "jdbcx", label: "JDBCX" },
{ value: "manticoresearch", label: "Manticore Search" },
{ value: "custom_mysql", label: "Custom (MySQL)" },
{ value: "dolt", label: "Dolt" },
{ value: "custom_postgres", label: "Custom (PostgreSQL)" },
{ value: "dremio", label: "Dremio" },
...jdbcProductPickerOptions(),
const dbCategoryMetadata: Array<{ key: DbCategoryKey; titleKey: string }> = [
{ key: "sql", titleKey: "connection.databaseCategorySql" },
{ key: "analytics", titleKey: "connection.databaseCategoryAnalytics" },
{ key: "domestic", titleKey: "connection.databaseCategoryDomestic" },
{ key: "lightweight", titleKey: "connection.databaseCategoryLightweight" },
{ key: "document", titleKey: "connection.databaseCategoryDocument" },
{ key: "graph_ai", titleKey: "connection.databaseCategoryGraphAi" },
{ key: "timeseries", titleKey: "connection.databaseCategoryTimeseries" },
{ key: "mq", titleKey: "connection.databaseCategoryMq" },
{ key: "registry_config", titleKey: "connection.databaseCategoryRegistryConfig" },
];
const dbCategoryDefinitions: Array<{
key: DbCategoryKey;
titleKey: string;
optionValues: string[];
}> = [
{
key: "sql",
titleKey: "connection.databaseCategorySql",
optionValues: ["postgres", "mysql", "oracle", "sqlserver", "mariadb", "cockroachdb", "db2", "informix", "firebird", "iris", "spanner", "jdbcx", "custom_mysql", "custom_postgres", "dolt"],
},
{
key: "analytics",
titleKey: "connection.databaseCategoryAnalytics",
optionValues: ["cloudberry", "clickhouse", "doris", "starrocks", "databend", "selectdb", "databricks", "saphana", "teradata", "vertica", "exasol", "redshift", "snowflake", "trino", "prestosql", "hive", "kyuubi", "impala", "spark", "bigquery", "kylin", "ignite", "ignite3", "dremio"],
},
{
key: "domestic",
titleKey: "connection.databaseCategoryDomestic",
optionValues: ["dm", "opengauss", "opentenbase", "gaussdb", "kwdb", "tidb", "oceanbase", "goldendb", "tdsql", "polardb", "greatsql", "gbase", "kingbase", "highgo", "uxdb", "yashandb", "vastbase", "sundb", "oscar", "xugu"],
},
{
key: "lightweight",
titleKey: "connection.databaseCategoryLightweight",
optionValues: ["sqlite", "turso", "cloudflare-d1", "duckdb", "rqlite", "access", "h2"],
},
{
key: "document",
titleKey: "connection.databaseCategoryDocument",
optionValues: ["mongodb", "dynamodb", "redis", "elasticsearch", "easysearch", "meilisearch", "hbase", "manticoresearch", "cassandra"],
},
{
key: "graph_ai",
titleKey: "connection.databaseCategoryGraphAi",
optionValues: ["neo4j", "qdrant", "milvus", "weaviate", "chromadb"],
},
{
key: "timeseries",
titleKey: "connection.databaseCategoryTimeseries",
optionValues: ["questdb", "tdengine", "iotdb", "influxdb", "victoriametrics"],
},
{
key: "mq",
titleKey: "connection.databaseCategoryMq",
optionValues: ["mq", "kafka", "rocketmq", "rabbitmq", "mqtt"],
},
{
key: "registry_config",
titleKey: "connection.databaseCategoryRegistryConfig",
optionValues: ["etcd", "zookeeper", "nacos", "consul"],
},
];
for (const category of dbCategoryDefinitions) {
category.optionValues.push(...jdbcProductProfileIdsForCategory(category.key));
function jdbcProductCategory(profileId: string): DbCategoryKey {
const category = dbCategoryMetadata.find(({ key }) => jdbcProductProfileIdsForCategory(key).includes(profileId))?.key;
if (!category) throw new Error(`JDBC product profile ${profileId} has no connection picker category`);
return category;
}
const dbOptions: DbOption[] = [...CONNECTION_PICKER_OPTIONS, ...jdbcProductPickerOptions().map((option) => ({ ...option, category: jdbcProductCategory(option.value) }))];
const dbCategoryDefinitions = dbCategoryMetadata.map((category) => ({
...category,
optionValues: dbOptions.filter((option) => option.category === category.key).map((option) => option.value),
}));
// Keep the picker exhaustive as database drivers are added or reorganized.
assertCompleteDatabaseCategories(
dbOptions.map((option) => option.value),
@@ -3298,7 +2854,8 @@ function supportsNativeAgentJdbcDriverConfigType(dbType: DatabaseType): boolean
}
const jdbcBackedDatabaseTypes = new Set<DatabaseType>(["jdbc", "prestosql", "bigquery"]);
const isJdbcConnection = computed(() => form.value.db_type === "jdbc");
const connectionFormKind = computed(() => databaseConnectionFormKind(form.value.db_type));
const isJdbcConnection = computed(() => connectionFormKind.value === "jdbc");
const isJdbcxConnection = computed(() => isJdbcConnection.value && form.value.driver_profile === JDBCX_DRIVER_PROFILE);
const isJdbcProductConnection = computed(() => Boolean(activeJdbcProductProfile.value));
const jdbcxHighPrivilegeExtensionsAllowed = computed({
@@ -1,8 +1,8 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { CONNECTION_PICKER_OPTIONS, CONNECTION_PROFILES } from "@/types/generated/connectionProfiles";
const dialogSource = readFileSync(new URL("../../../components/connection/ConnectionDialog.vue", import.meta.url), "utf8");
const categoriesSource = readFileSync(new URL("../../connection/driver-category-definitions.ts", import.meta.url), "utf8");
describe("H2 connection dialog driver profiles", () => {
it("offers auto, bundled compatibility ranges, and a custom JAR fallback", () => {
@@ -35,8 +35,8 @@ describe("H2 connection dialog driver profiles", () => {
});
it("keeps legacy profile hydration without exposing a second H2 catalog entry", () => {
expect(dialogSource).toContain('"h2-legacy": { type: "h2"');
expect(categoriesSource).toContain('h2: "lightweight"');
expect(categoriesSource).not.toContain('"h2-legacy": "lightweight"');
expect(CONNECTION_PROFILES["h2-legacy"]).toMatchObject({ type: "h2", port: 9092, user: "sa" });
expect(CONNECTION_PICKER_OPTIONS.find((option) => option.value === "h2")?.category).toBe("lightweight");
expect(CONNECTION_PICKER_OPTIONS.some((option) => option.value === "h2-legacy")).toBe(false);
});
});
@@ -1,21 +1,14 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { CONNECTION_PICKER_OPTIONS, CONNECTION_PROFILES } from "@/types/generated/connectionProfiles";
const dialogSource = readFileSync(new URL("../../../components/connection/ConnectionDialog.vue", import.meta.url), "utf8");
const fieldsSource = readFileSync(new URL("../../../components/connection/SpannerConnectionFields.vue", import.meta.url), "utf8");
describe("Cloud Spanner connection dialog", () => {
it("registers the bundled agent profile in the SQL category", () => {
expect(dialogSource).toContain('spanner: { type: "spanner", port: 443, user: "", label: "Cloud Spanner", icon: "spanner" }');
expect(dialogSource).toContain('{ value: "spanner", label: "Cloud Spanner" }');
expect(dialogSource).toContain('spanner: "spanner",');
// Cloud Spanner is an OLTP relational database, so it belongs to the SQL
// category rather than the analytics one.
const sqlCategory = dialogSource.match(/key: "sql",\s*\n\s*titleKey: "connection\.databaseCategorySql",\s*\n\s*optionValues: \[([\s\S]*?)\]/)?.[1] ?? "";
const analyticsCategory = dialogSource.match(/key: "analytics",[\s\S]*?optionValues: \[([\s\S]*?)\]/)?.[1] ?? "";
expect(sqlCategory).toContain('"spanner"');
expect(analyticsCategory).not.toContain('"spanner"');
expect(CONNECTION_PROFILES.spanner).toMatchObject({ type: "spanner", port: 443, user: "", label: "Cloud Spanner", icon: "spanner" });
expect(CONNECTION_PICKER_OPTIONS.find((option) => option.value === "spanner")).toEqual({ value: "spanner", label: "Cloud Spanner", category: "sql" });
});
it("does not expose external JDBC driver configuration because the driver is bundled", () => {
@@ -0,0 +1,29 @@
import { describe, expect, it } from "vitest";
import { CONNECTION_PICKER_OPTIONS, CONNECTION_PROFILES, CONNECTION_PROFILE_ICONS } from "@/types/generated/connectionProfiles";
describe("generated connection profiles", () => {
it("keeps picker options unique and backed by profiles", () => {
const optionIds = CONNECTION_PICKER_OPTIONS.map((option) => option.value);
expect(new Set(optionIds).size).toBe(optionIds.length);
expect(optionIds.every((id) => id in CONNECTION_PROFILES)).toBe(true);
});
it("preserves compatible products and specialized protocol defaults", () => {
expect(CONNECTION_PROFILES.mariadb).toMatchObject({ type: "mysql", port: 3306, user: "root" });
expect(CONNECTION_PROFILES.rabbitmq).toMatchObject({ type: "mq", port: 5672, host: "127.0.0.1" });
expect(CONNECTION_PROFILES.nacos).toMatchObject({ type: "nacos", port: 8848, user: "nacos" });
});
it("keeps internal variants out of the main picker", () => {
const optionIds = new Set(CONNECTION_PICKER_OPTIONS.map((option) => option.value));
expect(optionIds.has("mongodb-legacy")).toBe(false);
expect(optionIds.has("oceanbase-oracle")).toBe(false);
expect(optionIds.has("h2-legacy")).toBe(false);
});
it("preserves picker-specific icon overrides", () => {
expect(CONNECTION_PROFILE_ICONS.mq).toBe("mq");
expect(CONNECTION_PROFILE_ICONS.prestosql).toBe("prestosql");
expect(CONNECTION_PROFILE_ICONS.influxdb).toBe("influxdb");
});
});
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { databaseRuntimeMode, usesAgentCursorForQuery } from "@/lib/database/databaseDriverManifest";
import { databaseConnectionFormKind, databaseDefaultPort, databaseManifestEntry, databaseRuntimeMode, usesAgentCursorForQuery } from "@/lib/database/databaseDriverManifest";
describe("databaseDriverManifest", () => {
it("uses agent cursor only for agent or external runtimes", () => {
@@ -13,4 +13,23 @@ describe("databaseDriverManifest", () => {
expect(usesAgentCursorForQuery("jdbc")).toBe(true);
expect(usesAgentCursorForQuery("prestosql")).toBe(true);
});
it("exposes connection defaults from the shared manifest", () => {
expect(databaseDefaultPort("mysql")).toBe(3306);
expect(databaseManifestEntry("h2")).toMatchObject({
dbType: "h2",
runtimeMode: "agent",
agentKey: "h2",
skipTcpProbe: true,
localFile: true,
});
});
it("routes only specialized connection forms explicitly", () => {
expect(databaseConnectionFormKind("mysql")).toBe("standard");
expect(databaseConnectionFormKind("jdbc")).toBe("jdbc");
expect(databaseConnectionFormKind("mq")).toBe("mq");
expect(databaseConnectionFormKind("mqtt")).toBe("mqtt");
expect(databaseConnectionFormKind("nacos")).toBe("nacos");
});
});
@@ -1,5 +1,6 @@
import type { ConnectionConfig, DatabaseType } from "@/types/database";
import { h2FilePathFromJdbcUrl } from "@/lib/database/h2Connection";
import { isKnownDatabaseType, isLocalFileDatabaseType } from "@/lib/database/databaseDriverManifest";
/**
* Whether the database type is one that (potentially) backs onto a local file.
@@ -9,7 +10,7 @@ import { h2FilePathFromJdbcUrl } from "@/lib/database/h2Connection";
* available.
*/
export function isLocalFileTypeDb(dbType: DatabaseType | string): boolean {
return dbType === "sqlite" || dbType === "duckdb" || dbType === "access" || dbType === "h2";
return isKnownDatabaseType(dbType) && isLocalFileDatabaseType(dbType);
}
/**
@@ -1,12 +1,12 @@
import type { ConnectionConfig, DatabaseType } from "@/types/database";
import { GAUSSDB_M_JDBC_DRIVER_PROFILE } from "@/lib/database/jdbcDialect";
import { isLocalFileDatabaseType } from "@/lib/database/databaseDriverManifest";
import { parseGaussdbHosts, serializeGaussdbHosts } from "@/lib/connection/gaussdbHosts";
import { spannerDisplayDatabase } from "@/lib/connection/spannerResourcePath";
type ConnectionPresentationConfig = Pick<ConnectionConfig, "db_type" | "driver_profile" | "driver_label" | "host" | "port" | "database">;
type ConnectionNamePresentationConfig = ConnectionPresentationConfig & Pick<ConnectionConfig, "name">;
const LOCAL_DATABASE_TYPES = new Set(["sqlite", "duckdb", "access"]);
const REDACTED_HOST_SEGMENT = "***";
const REDACTED_PORT = "****";
@@ -24,7 +24,7 @@ export function connectionEndpointLabel(connection?: ConnectionPresentationConfi
// Cloud Spanner stores the whole resource path in `database`; only the trailing
// database ID is short enough for a subtitle, and the host is empty on Google Cloud.
if (connection.db_type === "spanner") return connection.host ? `${connection.host}:${connection.port}` : spannerDisplayDatabase(connection.database);
if (LOCAL_DATABASE_TYPES.has(connection.db_type) || (connection.db_type === "h2" && connection.port === 0)) {
if (isLocalFilePresentationConnection(connection)) {
return connection.host || connection.database || "local";
}
const endpoint = normalizedPresentationEndpoint(connection);
@@ -88,7 +88,7 @@ export function connectionRedactedEndpointLabel(connection?: ConnectionPresentat
// no more than any other database name; without this branch the fallback below
// would print the full `projects/.../databases/...` path.
if (connection.db_type === "spanner") return connection.host ? `${redactConnectionHost(connection.host)}:${REDACTED_PORT}` : spannerDisplayDatabase(connection.database);
if (LOCAL_DATABASE_TYPES.has(connection.db_type) || (connection.db_type === "h2" && connection.port === 0)) {
if (isLocalFilePresentationConnection(connection)) {
return connectionEndpointLabel(connection);
}
@@ -106,7 +106,7 @@ export function connectionRedactedEndpointLabel(connection?: ConnectionPresentat
export function connectionRedactedNameLabel(connection?: ConnectionNamePresentationConfig): string {
const name = connection?.name.trim() || "";
if (!connection || !name || LOCAL_DATABASE_TYPES.has(connection.db_type) || (connection.db_type === "h2" && connection.port === 0)) return name;
if (!connection || !name || isLocalFilePresentationConnection(connection)) return name;
const host = connection.host.trim();
if (!host) return name;
@@ -123,6 +123,10 @@ export function connectionRedactedNameLabel(connection?: ConnectionNamePresentat
return hostNames.has(name) ? connectionRedactedEndpointLabel(connection) : name;
}
function isLocalFilePresentationConnection(connection: Pick<ConnectionPresentationConfig, "db_type" | "port">): boolean {
return isLocalFileDatabaseType(connection.db_type) && (connection.db_type !== "h2" || connection.port === 0);
}
export function connectionDisplayUrlScheme(connection: Pick<ConnectionConfig, "db_type"> & Partial<Pick<ConnectionConfig, "driver_profile" | "ssl">>): string {
switch (connection.db_type) {
case "postgres":
@@ -4,7 +4,7 @@ import { manifestDatabaseTypes } from "@/lib/database/databaseDriverManifest";
import { supportsTransfer } from "@/lib/database/databaseFeatureSupport";
import type { DatabaseType } from "@/types/database";
const TABLE_ONLY_TRANSFER_DATABASES: DatabaseType[] = ["sqlite", "rqlite", "cloudflare-d1", "duckdb", "clickhouse", "mongodb", "goldendb", "questdb", "hive", "kyuubi", "impala", "spark"];
const TABLE_ONLY_TRANSFER_DATABASES: DatabaseType[] = ["sqlite", "rqlite", "turso", "cloudflare-d1", "duckdb", "clickhouse", "mongodb", "goldendb", "questdb", "hive", "kyuubi", "impala", "spark"];
describe("transferObjectKinds", () => {
it("groups databases into transfer families", () => {
@@ -1,104 +1,24 @@
import type { DatabaseType } from "@/types/database";
import { databaseTypesWithTrait } from "@/lib/database/databaseDriverManifest";
export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
"postgres",
// Cloud Spanner supports named schemas; GoogleSQL's default schema is the empty string, which
// `spannerObjectTreeSchema` keeps intact through the `schema || database` fallbacks.
"spanner",
"sqlserver",
"oracle",
"redshift",
"dameng",
"gaussdb",
"kwdb",
"kingbase",
"highgo",
"uxdb",
"vastbase",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"jdbc",
"h2",
"ignite",
"ignite3",
"snowflake",
"trino",
"prestosql",
"hive",
"kyuubi",
"impala",
"spark",
"databend",
"db2",
"informix",
"xugu",
"oscar",
"iotdb",
"iris",
"duckdb",
]);
export const SCHEMA_AWARE_TYPES = databaseTypesWithTrait("schemaAware");
// Engines where an object can be addressed as database/catalog.schema.table.
// Keep this narrower than SCHEMA_AWARE_TYPES: PostgreSQL, for example, cannot
// query another database through a three-part name on the same connection.
export const DATABASE_SCHEMA_QUALIFIED_TYPES = new Set<DatabaseType>(["sqlserver", "trino", "prestosql"]);
export const DATABASE_SCHEMA_QUALIFIED_TYPES = databaseTypesWithTrait("databaseSchemaQualified");
export const SINGLE_DATABASE_TYPES = new Set<DatabaseType>(["oracle", "dameng", "firebird", "oceanbase-oracle", "access", "questdb", "victoriametrics"]);
export const SINGLE_DATABASE_TYPES = databaseTypesWithTrait("singleDatabase");
export const CLEARABLE_QUERY_SCHEMA_TYPES = new Set<DatabaseType>(["oracle", "dameng", "gaussdb", "oceanbase-oracle"]);
export const CLEARABLE_QUERY_SCHEMA_TYPES = databaseTypesWithTrait("clearableQuerySchema");
export const FETCH_FIRST_TYPES = new Set<DatabaseType>(["oracle", "dameng"]);
export const FETCH_FIRST_TYPES = databaseTypesWithTrait("fetchFirst");
export const TREE_SCHEMA_TYPES = new Set<DatabaseType>([
"postgres",
// Cloud Spanner needs the schema level for the same reason it is in SCHEMA_AWARE_TYPES: named
// schemas exist and are queryable, so the tree has to expose them. Membership here is what makes
// a database node load schemas instead of tables; SCHEMA_AWARE_TYPES alone only reaches the
// schema pickers in dialogs. The sites gated on `database === ""` stay unreachable because a
// Spanner database is always the resource path.
"spanner",
"redshift",
"sqlserver",
"db2",
"gaussdb",
"kwdb",
"kingbase",
"highgo",
"uxdb",
"vastbase",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"jdbc",
"trino",
"prestosql",
"h2",
"ignite",
"ignite3",
"informix",
"xugu",
"oscar",
"iris",
"duckdb",
]);
export const TREE_SCHEMA_TYPES = databaseTypesWithTrait("treeSchema");
export const DATABASE_OBJECT_TREE_TYPES = new Set<DatabaseType>(["jdbc"]);
export const DATABASE_OBJECT_TREE_TYPES = databaseTypesWithTrait("databaseObjectTree");
export const PG_VACUUM_TYPES = new Set<DatabaseType>(["postgres", "gaussdb", "kwdb", "kingbase", "highgo", "uxdb", "vastbase", "opengauss"]);
export const PG_VACUUM_TYPES = databaseTypesWithTrait("pgVacuum");
export const PG_LIKE_STRUCTURE_TYPES = new Set<DatabaseType>(["postgres", "redshift", "gaussdb", "kwdb", "opengauss", "questdb"]);
export const PG_LIKE_STRUCTURE_TYPES = databaseTypesWithTrait("pgLikeStructure");
export const DIAGRAM_SQL_TYPES = new Set<DatabaseType>(["mysql", "postgres", "sqlite", "rqlite", "turso", "cloudflare-d1", "sqlserver", "oracle", "redshift", "dameng", "gaussdb", "kwdb", "opengauss", "questdb", "oceanbase-oracle"]);
export const DIAGRAM_SQL_TYPES = databaseTypesWithTrait("diagramSql");
@@ -3,6 +3,7 @@ import driverManifest from "../../../../../crates/dbx-core/assets/database-drive
export type DatabaseSupportLevel = "connect" | "browse" | "understand" | "operate";
export type DatabaseRuntimeMode = "native" | "file" | "agent" | "external";
export type ConnectionFormKind = "standard" | "jdbc" | "mq" | "mqtt" | "nacos";
export const DATABASE_PRODUCT_CAPABILITY_KEYS = [
"queryExecution",
@@ -26,9 +27,46 @@ export const DATABASE_PRODUCT_CAPABILITY_KEYS = [
export type DatabaseProductCapability = (typeof DATABASE_PRODUCT_CAPABILITY_KEYS)[number];
export type DatabaseProductCapabilities = Record<DatabaseProductCapability, boolean>;
interface DatabaseDriverManifestEntry {
export const DATABASE_BEHAVIOR_TRAIT_KEYS = ["schemaAware", "databaseSchemaQualified", "singleDatabase", "clearableQuerySchema", "fetchFirst", "treeSchema", "databaseObjectTree", "pgVacuum", "pgLikeStructure", "diagramSql"] as const;
export type DatabaseBehaviorTrait = (typeof DATABASE_BEHAVIOR_TRAIT_KEYS)[number];
export type DatabaseBehaviorTraits = Partial<Record<DatabaseBehaviorTrait, boolean>>;
export interface DatabaseDriverProfile {
profile: string;
agentKey: string;
packageKey?: string;
label: string;
storeVisible: boolean;
storeOrder?: number;
}
export interface ManagedDatabaseDriver {
key: string;
label: string;
storeVisible: boolean;
storeOrder?: number;
}
export interface DatabaseDriverManifestEntry {
dbType: DatabaseType;
label: string;
dialect?: string;
runtimeMode: DatabaseRuntimeMode;
mcpMode: "direct" | "bridge" | "unsupported";
agentKey?: string;
driverStoreVisible?: boolean;
driverStoreOrder?: number;
driverProfiles?: DatabaseDriverProfile[];
managedDrivers?: ManagedDatabaseDriver[];
singleConnectionPool: boolean;
metadataConnectionScoped: boolean;
skipTcpProbe: boolean;
defaultPort?: number;
localFile?: boolean;
specializedSurface?: boolean;
formKind?: ConnectionFormKind;
traits?: DatabaseBehaviorTraits;
supportLevel: DatabaseSupportLevel;
capabilities: Partial<DatabaseProductCapabilities>;
}
@@ -74,6 +112,30 @@ export function databaseSupportLevel(dbType?: DatabaseType): DatabaseSupportLeve
return dbType ? DATABASE_DRIVER_BY_TYPE.get(dbType)?.supportLevel : undefined;
}
export function databaseManifestEntry(dbType?: DatabaseType): DatabaseDriverManifestEntry | undefined {
return dbType ? DATABASE_DRIVER_BY_TYPE.get(dbType) : undefined;
}
export function databaseDefaultPort(dbType?: DatabaseType): number | undefined {
return databaseManifestEntry(dbType)?.defaultPort;
}
export function databaseConnectionFormKind(dbType?: DatabaseType): ConnectionFormKind {
return databaseManifestEntry(dbType)?.formKind ?? "standard";
}
export function isKnownDatabaseType(value: string): value is DatabaseType {
return DATABASE_DRIVER_BY_TYPE.has(value as DatabaseType);
}
export function isLocalFileDatabaseType(dbType?: DatabaseType): boolean {
return databaseManifestEntry(dbType)?.localFile === true;
}
export function databaseTypesWithTrait(trait: DatabaseBehaviorTrait): Set<DatabaseType> {
return new Set(DATABASE_DRIVER_ENTRIES.filter((entry) => entry.traits?.[trait] === true).map((entry) => entry.dbType));
}
export function databaseRuntimeMode(dbType?: DatabaseType): DatabaseRuntimeMode | undefined {
return dbType ? DATABASE_DRIVER_BY_TYPE.get(dbType)?.runtimeMode : undefined;
}
+2 -79
View File
@@ -1,86 +1,9 @@
import type { BackendError } from "@/lib/backend/errorUtils";
import type { TransferContent, TransferMode, TransferObjectKind, TransferTableNameCase } from "@/lib/backend/tauri";
import type { MultiDbExecutionTarget, MultiDbResultRunExecution } from "@/types/sqlExecution";
import type { DatabaseType } from "@/types/generated/databaseTypes";
export type DatabaseType =
| "mysql"
| "postgres"
| "sqlite"
| "rqlite"
| "turso"
| "cloudflare-d1"
| "redis"
| "duckdb"
| "clickhouse"
| "sqlserver"
| "mongodb"
| "dynamodb"
| "oracle"
| "elasticsearch"
| "easysearch"
| "meilisearch"
| "hbase"
| "qdrant"
| "milvus"
| "weaviate"
| "chromadb"
| "doris"
| "starrocks"
| "manticoresearch"
| "databend"
| "redshift"
| "dameng"
| "gaussdb"
| "kingbase"
| "highgo"
| "uxdb"
| "vastbase"
| "goldendb"
| "kwdb"
| "yashandb"
| "databricks"
| "saphana"
| "teradata"
| "vertica"
| "firebird"
| "exasol"
| "opengauss"
| "oceanbase-oracle"
| "questdb"
| "gbase"
| "access"
| "h2"
| "snowflake"
| "trino"
| "prestosql"
| "hive"
| "kyuubi"
| "impala"
| "spark"
| "db2"
| "informix"
| "neo4j"
| "cassandra"
| "bigquery"
| "spanner"
| "kylin"
| "ignite"
| "ignite3"
| "sundb"
| "oscar"
| "tdengine"
| "xugu"
| "iotdb"
| "etcd"
| "zookeeper"
| "iris"
| "influxdb"
| "victoriametrics"
| "jdbc"
| "mq"
| "mqtt"
| "nacos"
| "consul";
export type { DatabaseType } from "@/types/generated/databaseTypes";
export function isElasticsearchCompatibleDatabaseType(dbType?: DatabaseType): boolean {
return dbType === "elasticsearch" || dbType === "easysearch";
@@ -0,0 +1,323 @@
// Generated by scripts/sync-connection-types.mjs. Do not edit manually.
import type { DatabaseType } from "./databaseTypes";
export type ConnectionProfileCategory = "sql" | "analytics" | "domestic" | "lightweight" | "document" | "graph_ai" | "timeseries" | "mq" | "registry_config";
export interface ConnectionProfileDefinition {
type: DatabaseType;
port: number;
user: string;
label: string;
icon: string;
host?: string;
urlParams?: string;
}
export interface ConnectionPickerOption {
value: string;
label: string;
category: ConnectionProfileCategory;
}
export const CONNECTION_PROFILES = {
mysql: { type: "mysql", port: 3306, user: "root", label: "MySQL", icon: "mysql", urlParams: "" },
postgres: { type: "postgres", port: 5432, user: "postgres", label: "PostgreSQL", icon: "postgres", urlParams: "" },
cloudberry: { type: "postgres", port: 5432, user: "postgres", label: "Apache Cloudberry", icon: "cloudberry", urlParams: "" },
opentenbase: { type: "postgres", port: 11000, user: "opentenbase", label: "OpenTenBase", icon: "opentenbase", urlParams: "" },
redis: { type: "redis", port: 6379, user: "", label: "Redis", icon: "redis" },
sqlite: { type: "sqlite", port: 0, user: "", label: "SQLite", icon: "sqlite" },
rqlite: { type: "rqlite", port: 4001, user: "", label: "RQLite", icon: "rqlite" },
turso: { type: "turso", port: 443, user: "", label: "Turso", icon: "turso" },
"cloudflare-d1": { type: "cloudflare-d1", port: 443, user: "", label: "Cloudflare D1", icon: "cloudflare-d1" },
duckdb: { type: "duckdb", port: 0, user: "", label: "DuckDB", icon: "duckdb" },
access: { type: "access", port: 0, user: "", label: "Microsoft Access", icon: "access" },
mongodb: { type: "mongodb", port: 27017, user: "", label: "MongoDB", icon: "mongodb" },
"mongodb-legacy": { type: "mongodb", port: 27017, user: "", label: "MongoDB (Legacy)", icon: "mongodb" },
dynamodb: { type: "dynamodb", port: 443, user: "", label: "Amazon DynamoDB", icon: "dynamodb", host: "dynamodb.us-east-1.amazonaws.com" },
clickhouse: { type: "clickhouse", port: 8123, user: "default", label: "ClickHouse", icon: "clickhouse" },
sqlserver: { type: "sqlserver", port: 1433, user: "sa", label: "SQL Server", icon: "sqlserver" },
oracle: { type: "oracle", port: 1521, user: "system", label: "Oracle", icon: "oracle" },
elasticsearch: { type: "elasticsearch", port: 9200, user: "", label: "Elasticsearch", icon: "elasticsearch" },
easysearch: { type: "easysearch", port: 9200, user: "", label: "Easysearch", icon: "easysearch" },
meilisearch: { type: "meilisearch", port: 7700, user: "", label: "Meilisearch", icon: "meilisearch" },
hbase: { type: "hbase", port: 8080, user: "", label: "Apache HBase", icon: "hbase" },
qdrant: { type: "qdrant", port: 6333, user: "", label: "Qdrant", icon: "qdrant" },
milvus: { type: "milvus", port: 19530, user: "root", label: "Milvus", icon: "milvus" },
weaviate: { type: "weaviate", port: 8080, user: "", label: "Weaviate", icon: "weaviate" },
chromadb: { type: "chromadb", port: 8000, user: "", label: "ChromaDB", icon: "chromadb" },
mariadb: { type: "mysql", port: 3306, user: "root", label: "MariaDB", icon: "mariadb" },
tidb: { type: "mysql", port: 4000, user: "root", label: "TiDB", icon: "tidb" },
oceanbase: { type: "mysql", port: 2883, user: "root", label: "OceanBase", icon: "oceanbase" },
"oceanbase-oracle": { type: "oceanbase-oracle", port: 2883, user: "SYS", label: "OceanBase Oracle Mode", icon: "oceanbase" },
goldendb: { type: "goldendb", port: 3306, user: "root", label: "金篆 GoldenDB", icon: "goldendb" },
databend: { type: "databend", port: 8000, user: "databend", label: "Databend", icon: "databend" },
tdsql: { type: "mysql", port: 3306, user: "root", label: "TDSQL", icon: "tdsql" },
polardb: { type: "mysql", port: 3306, user: "root", label: "PolarDB", icon: "polardb" },
greatsql: { type: "mysql", port: 3306, user: "root", label: "GreatSQL", icon: "greatsql" },
databricks: { type: "databricks", port: 443, user: "token", label: "Databricks SQL", icon: "databricks" },
saphana: { type: "saphana", port: 30015, user: "SYSTEM", label: "SAP HANA", icon: "saphana" },
teradata: { type: "teradata", port: 1025, user: "", label: "Teradata", icon: "teradata" },
vertica: { type: "vertica", port: 5433, user: "dbadmin", label: "Vertica", icon: "vertica" },
firebird: { type: "firebird", port: 3050, user: "SYSDBA", label: "Firebird", icon: "firebird" },
exasol: { type: "exasol", port: 8563, user: "sys", label: "Exasol", icon: "exasol" },
gbase: { type: "gbase", port: 5258, user: "gbasedbt", label: "南大通用 GBase 8a", icon: "gbase" },
gbase8a: { type: "gbase", port: 5258, user: "gbasedbt", label: "南大通用 GBase 8a", icon: "gbase" },
gbase8s: { type: "gbase", port: 9088, user: "gbasedbt", label: "南大通用 GBase 8s", icon: "gbase" },
opengauss: { type: "opengauss", port: 5432, user: "gaussdb", label: "openGauss", icon: "opengauss" },
gaussdb: { type: "gaussdb", port: 5432, user: "gaussdb", label: "GaussDB", icon: "gaussdb" },
kwdb: { type: "kwdb", port: 26257, user: "root", label: "KWDB", icon: "kwdb" },
questdb: { type: "questdb", port: 8812, user: "questdb", label: "QuestDB", icon: "questdb" },
kingbase: { type: "kingbase", port: 54321, user: "system", label: "金仓KingbaseES", icon: "kingbase" },
highgo: { type: "highgo", port: 5866, user: "highgo", label: "瀚高 HighGo", icon: "highgo" },
uxdb: { type: "uxdb", port: 52025, user: "uxdb", label: "优炫 UXDB", icon: "uxdb" },
yashandb: { type: "yashandb", port: 1688, user: "sys", label: "崖山 YashanDB", icon: "yashandb" },
vastbase: { type: "vastbase", port: 5432, user: "vastbase", label: "海量 Vastbase", icon: "vastbase" },
doris: { type: "mysql", port: 9030, user: "root", label: "Doris", icon: "doris", urlParams: "" },
selectdb: { type: "mysql", port: 9030, user: "root", label: "SelectDB", icon: "selectdb", urlParams: "" },
starrocks: { type: "mysql", port: 9030, user: "root", label: "StarRocks", icon: "starrocks", urlParams: "" },
manticoresearch: { type: "manticoresearch", port: 9306, user: "root", label: "Manticore Search", icon: "manticoresearch", urlParams: "" },
redshift: { type: "redshift", port: 5439, user: "awsuser", label: "Redshift", icon: "redshift" },
cockroachdb: { type: "postgres", port: 26257, user: "root", label: "CockroachDB", icon: "cockroachdb" },
dm: { type: "dameng", port: 5236, user: "SYSDBA", label: "达梦 Dameng", icon: "dm" },
h2: { type: "h2", port: 9092, user: "sa", label: "H2", icon: "h2" },
"h2-legacy": { type: "h2", port: 9092, user: "sa", label: "H2 2.1 Legacy", icon: "h2" },
snowflake: { type: "snowflake", port: 443, user: "", label: "Snowflake", icon: "snowflake" },
trino: { type: "trino", port: 8080, user: "", label: "Trino", icon: "trino" },
prestosql: { type: "prestosql", port: 8080, user: "", label: "PrestoSQL", icon: "presto" },
hive: { type: "hive", port: 10000, user: "", label: "Apache Hive", icon: "hive" },
kyuubi: { type: "kyuubi", port: 10009, user: "", label: "Apache Kyuubi", icon: "kyuubi", urlParams: "auth=NONE" },
impala: { type: "impala", port: 21050, user: "", label: "Apache Impala", icon: "impala", urlParams: "auth=noSasl" },
spark: { type: "spark", port: 10015, user: "", label: "Apache Spark", icon: "spark" },
db2: { type: "db2", port: 50000, user: "db2inst1", label: "IBM DB2", icon: "db2" },
informix: { type: "informix", port: 9088, user: "informix", label: "Informix", icon: "informix" },
dremio: { type: "jdbc", port: 31010, user: "", label: "Dremio", icon: "dremio" },
jdbcx: { type: "jdbc", port: 0, user: "", label: "JDBCX", icon: "jdbcx" },
neo4j: { type: "neo4j", port: 7687, user: "neo4j", label: "Neo4j", icon: "neo4j" },
cassandra: { type: "cassandra", port: 9042, user: "cassandra", label: "Cassandra", icon: "cassandra" },
bigquery: { type: "bigquery", port: 443, user: "", label: "BigQuery", icon: "bigquery", host: "https://www.googleapis.com/bigquery/v2" },
spanner: { type: "spanner", port: 443, user: "", label: "Cloud Spanner", icon: "spanner" },
kylin: { type: "kylin", port: 7070, user: "ADMIN", label: "Apache Kylin", icon: "kylin" },
ignite: { type: "ignite", port: 10800, user: "", label: "Apache Ignite", icon: "ignite" },
ignite3: { type: "ignite3", port: 10800, user: "", label: "Apache Ignite 3", icon: "ignite" },
sundb: { type: "sundb", port: 22000, user: "root", label: "科蓝 SUNDB", icon: "sundb" },
oscar: { type: "oscar", port: 2003, user: "SYSDBA", label: "神通 OSCAR", icon: "oscar" },
jdbc: { type: "jdbc", port: 0, user: "", label: "JDBC", icon: "jdbc" },
tdengine: { type: "tdengine", port: 6041, user: "root", label: "TDengine", icon: "tdengine" },
xugu: { type: "xugu", port: 5138, user: "", label: "虚谷 XuguDB", icon: "xugu" },
iotdb: { type: "iotdb", port: 6667, user: "root", label: "Apache IoTDB", icon: "iotdb" },
etcd: { type: "etcd", port: 2379, user: "", label: "etcd", icon: "etcd" },
zookeeper: { type: "zookeeper", port: 2181, user: "", label: "Apache ZooKeeper", icon: "zookeeper" },
mq: { type: "mq", port: 8080, user: "", label: "Apache Pulsar", icon: "pulsar", host: "127.0.0.1" },
kafka: { type: "mq", port: 9092, user: "", label: "Apache Kafka", icon: "kafka", host: "127.0.0.1" },
rocketmq: { type: "mq", port: 9876, user: "", label: "Apache RocketMQ", icon: "rocketmq", host: "127.0.0.1" },
rabbitmq: { type: "mq", port: 5672, user: "", label: "RabbitMQ", icon: "rabbitmq", host: "127.0.0.1" },
nacos: { type: "nacos", port: 8848, user: "nacos", label: "Nacos", icon: "nacos", host: "127.0.0.1" },
consul: { type: "consul", port: 8500, user: "", label: "Consul", icon: "consul", host: "127.0.0.1" },
mqtt: { type: "mqtt", port: 1883, user: "", label: "MQTT", icon: "mqtt", host: "127.0.0.1" },
iris: { type: "iris", port: 1972, user: "_SYSTEM", label: "IRIS", icon: "iris" },
influxdb: { type: "influxdb", port: 8086, user: "", label: "InfluxDB", icon: "InfluxDB" },
victoriametrics: { type: "victoriametrics", port: 8428, user: "", label: "VictoriaMetrics", icon: "victoriametrics" },
custom_mysql: { type: "mysql", port: 3306, user: "root", label: "Custom", icon: "mysql", urlParams: "" },
dolt: { type: "mysql", port: 3306, user: "root", label: "Dolt", icon: "dolt", urlParams: "" },
custom_postgres: { type: "postgres", port: 5432, user: "postgres", label: "Custom", icon: "postgres", urlParams: "" },
} as const satisfies Record<string, ConnectionProfileDefinition>;
export const CONNECTION_PROFILE_ICONS = {
mysql: "mysql",
postgres: "postgres",
cloudberry: "cloudberry",
opentenbase: "opentenbase",
redis: "redis",
sqlite: "sqlite",
rqlite: "rqlite",
turso: "turso",
"cloudflare-d1": "cloudflare-d1",
duckdb: "duckdb",
access: "access",
mongodb: "mongodb",
"mongodb-legacy": "mongodb",
dynamodb: "dynamodb",
clickhouse: "clickhouse",
sqlserver: "sqlserver",
oracle: "oracle",
elasticsearch: "elasticsearch",
easysearch: "easysearch",
meilisearch: "meilisearch",
hbase: "hbase",
qdrant: "qdrant",
milvus: "milvus",
weaviate: "weaviate",
chromadb: "chromadb",
mariadb: "mariadb",
tidb: "tidb",
oceanbase: "oceanbase",
"oceanbase-oracle": "oceanbase",
goldendb: "goldendb",
databend: "databend",
tdsql: "tdsql",
polardb: "polardb",
greatsql: "greatsql",
databricks: "databricks",
saphana: "saphana",
teradata: "teradata",
vertica: "vertica",
firebird: "firebird",
exasol: "exasol",
gbase: "gbase",
gbase8a: "gbase",
gbase8s: "gbase",
opengauss: "opengauss",
gaussdb: "gaussdb",
kwdb: "kwdb",
questdb: "questdb",
kingbase: "kingbase",
highgo: "highgo",
uxdb: "uxdb",
yashandb: "yashandb",
vastbase: "vastbase",
doris: "doris",
selectdb: "selectdb",
starrocks: "starrocks",
manticoresearch: "manticoresearch",
redshift: "redshift",
cockroachdb: "cockroachdb",
dm: "dm",
h2: "h2",
"h2-legacy": "h2",
snowflake: "snowflake",
trino: "trino",
prestosql: "prestosql",
hive: "hive",
kyuubi: "kyuubi",
impala: "impala",
spark: "spark",
db2: "db2",
informix: "informix",
dremio: "dremio",
jdbcx: "jdbcx",
neo4j: "neo4j",
cassandra: "cassandra",
bigquery: "bigquery",
spanner: "spanner",
kylin: "kylin",
ignite: "ignite",
ignite3: "ignite",
sundb: "sundb",
oscar: "oscar",
jdbc: "jdbc",
tdengine: "tdengine",
xugu: "xugu",
iotdb: "iotdb",
etcd: "etcd",
zookeeper: "zookeeper",
mq: "mq",
kafka: "kafka",
rocketmq: "rocketmq",
rabbitmq: "rabbitmq",
nacos: "nacos",
consul: "consul",
mqtt: "mqtt",
iris: "iris",
influxdb: "influxdb",
victoriametrics: "victoriametrics",
custom_mysql: "mysql",
dolt: "dolt",
custom_postgres: "postgres",
} as const satisfies Record<string, string>;
export const CONNECTION_PICKER_OPTIONS = [
{ value: "mysql", label: "MySQL", category: "sql" },
{ value: "postgres", label: "PostgreSQL", category: "sql" },
{ value: "cloudberry", label: "Apache Cloudberry", category: "analytics" },
{ value: "opentenbase", label: "OpenTenBase", category: "domestic" },
{ value: "redis", label: "Redis", category: "document" },
{ value: "sqlite", label: "SQLite", category: "lightweight" },
{ value: "rqlite", label: "RQLite", category: "lightweight" },
{ value: "turso", label: "Turso", category: "lightweight" },
{ value: "cloudflare-d1", label: "Cloudflare D1", category: "lightweight" },
{ value: "duckdb", label: "DuckDB", category: "lightweight" },
{ value: "access", label: "Microsoft Access", category: "lightweight" },
{ value: "mongodb", label: "MongoDB", category: "document" },
{ value: "dynamodb", label: "Amazon DynamoDB", category: "document" },
{ value: "clickhouse", label: "ClickHouse", category: "analytics" },
{ value: "sqlserver", label: "SQL Server", category: "sql" },
{ value: "oracle", label: "Oracle", category: "sql" },
{ value: "elasticsearch", label: "Elasticsearch", category: "document" },
{ value: "easysearch", label: "Easysearch", category: "document" },
{ value: "meilisearch", label: "Meilisearch", category: "document" },
{ value: "hbase", label: "Apache HBase", category: "document" },
{ value: "qdrant", label: "Qdrant", category: "graph_ai" },
{ value: "milvus", label: "Milvus", category: "graph_ai" },
{ value: "weaviate", label: "Weaviate", category: "graph_ai" },
{ value: "chromadb", label: "ChromaDB", category: "graph_ai" },
{ value: "mariadb", label: "MariaDB", category: "sql" },
{ value: "tidb", label: "TiDB", category: "domestic" },
{ value: "oceanbase", label: "OceanBase", category: "domestic" },
{ value: "goldendb", label: "金篆 GoldenDB", category: "domestic" },
{ value: "databend", label: "Databend", category: "analytics" },
{ value: "tdsql", label: "TDSQL", category: "domestic" },
{ value: "polardb", label: "PolarDB", category: "domestic" },
{ value: "greatsql", label: "GreatSQL", category: "domestic" },
{ value: "databricks", label: "Databricks SQL", category: "analytics" },
{ value: "saphana", label: "SAP HANA", category: "analytics" },
{ value: "teradata", label: "Teradata", category: "analytics" },
{ value: "vertica", label: "Vertica", category: "analytics" },
{ value: "firebird", label: "Firebird", category: "sql" },
{ value: "exasol", label: "Exasol", category: "analytics" },
{ value: "gbase", label: "南大通用 GBase", category: "domestic" },
{ value: "opengauss", label: "openGauss", category: "domestic" },
{ value: "gaussdb", label: "GaussDB", category: "domestic" },
{ value: "kwdb", label: "KWDB", category: "domestic" },
{ value: "questdb", label: "QuestDB", category: "timeseries" },
{ value: "kingbase", label: "金仓KingbaseES", category: "domestic" },
{ value: "highgo", label: "瀚高 HighGo", category: "domestic" },
{ value: "uxdb", label: "优炫 UXDB", category: "domestic" },
{ value: "yashandb", label: "崖山 YashanDB", category: "domestic" },
{ value: "vastbase", label: "海量 Vastbase", category: "domestic" },
{ value: "doris", label: "Doris", category: "analytics" },
{ value: "selectdb", label: "SelectDB", category: "analytics" },
{ value: "starrocks", label: "StarRocks", category: "analytics" },
{ value: "manticoresearch", label: "Manticore Search", category: "document" },
{ value: "redshift", label: "Redshift", category: "analytics" },
{ value: "cockroachdb", label: "CockroachDB", category: "sql" },
{ value: "dm", label: "达梦 Dameng", category: "domestic" },
{ value: "h2", label: "H2", category: "lightweight" },
{ value: "snowflake", label: "Snowflake", category: "analytics" },
{ value: "trino", label: "Trino", category: "analytics" },
{ value: "prestosql", label: "PrestoSQL", category: "analytics" },
{ value: "hive", label: "Hive", category: "analytics" },
{ value: "kyuubi", label: "Apache Kyuubi", category: "analytics" },
{ value: "impala", label: "Apache Impala", category: "analytics" },
{ value: "spark", label: "Apache Spark", category: "analytics" },
{ value: "db2", label: "DB2", category: "sql" },
{ value: "informix", label: "Informix", category: "sql" },
{ value: "dremio", label: "Dremio", category: "analytics" },
{ value: "jdbcx", label: "JDBCX", category: "sql" },
{ value: "neo4j", label: "Neo4j", category: "graph_ai" },
{ value: "cassandra", label: "Cassandra", category: "document" },
{ value: "bigquery", label: "BigQuery", category: "analytics" },
{ value: "spanner", label: "Cloud Spanner", category: "sql" },
{ value: "kylin", label: "Kylin", category: "analytics" },
{ value: "ignite", label: "Apache Ignite", category: "analytics" },
{ value: "ignite3", label: "Apache Ignite 3", category: "analytics" },
{ value: "sundb", label: "科蓝 SUNDB", category: "domestic" },
{ value: "oscar", label: "神通 OSCAR", category: "domestic" },
{ value: "tdengine", label: "TDengine", category: "timeseries" },
{ value: "xugu", label: "虚谷 XuguDB", category: "domestic" },
{ value: "iotdb", label: "Apache IoTDB", category: "timeseries" },
{ value: "etcd", label: "etcd", category: "registry_config" },
{ value: "zookeeper", label: "Apache ZooKeeper", category: "registry_config" },
{ value: "mq", label: "Apache Pulsar", category: "mq" },
{ value: "kafka", label: "Apache Kafka", category: "mq" },
{ value: "rocketmq", label: "Apache RocketMQ", category: "mq" },
{ value: "rabbitmq", label: "RabbitMQ", category: "mq" },
{ value: "nacos", label: "Nacos", category: "registry_config" },
{ value: "consul", label: "Consul", category: "registry_config" },
{ value: "mqtt", label: "MQTT", category: "mq" },
{ value: "iris", label: "IRIS", category: "sql" },
{ value: "influxdb", label: "InfluxDB", category: "timeseries" },
{ value: "victoriametrics", label: "VictoriaMetrics", category: "timeseries" },
{ value: "custom_mysql", label: "Custom (MySQL)", category: "sql" },
{ value: "dolt", label: "Dolt", category: "sql" },
{ value: "custom_postgres", label: "Custom (PostgreSQL)", category: "sql" },
] as const satisfies readonly ConnectionPickerOption[];
@@ -0,0 +1,83 @@
// Generated by scripts/sync-connection-types.mjs. Do not edit manually.
export const DATABASE_TYPES = [
"mysql",
"postgres",
"sqlite",
"rqlite",
"turso",
"cloudflare-d1",
"redis",
"duckdb",
"clickhouse",
"sqlserver",
"mongodb",
"dynamodb",
"oracle",
"elasticsearch",
"easysearch",
"meilisearch",
"hbase",
"qdrant",
"chromadb",
"milvus",
"weaviate",
"doris",
"starrocks",
"manticoresearch",
"redshift",
"dameng",
"kingbase",
"highgo",
"uxdb",
"vastbase",
"goldendb",
"databend",
"gaussdb",
"kwdb",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"firebird",
"exasol",
"opengauss",
"questdb",
"oceanbase-oracle",
"gbase",
"access",
"h2",
"snowflake",
"trino",
"prestosql",
"hive",
"kyuubi",
"impala",
"db2",
"informix",
"neo4j",
"cassandra",
"bigquery",
"spanner",
"kylin",
"ignite",
"ignite3",
"sundb",
"oscar",
"tdengine",
"xugu",
"etcd",
"zookeeper",
"nacos",
"consul",
"mq",
"mqtt",
"iotdb",
"iris",
"influxdb",
"victoriametrics",
"jdbc",
"spark",
] as const;
export type DatabaseType = (typeof DATABASE_TYPES)[number];