驱动接入(全部本机真实例验收): - Elasticsearch 原生 SQL API、InfluxDB 原生 HTTP+Flux(官方 JDBC 付费许可,实测弃用) - ZooKeeper/MongoDB JVM agent(连接时自动下载官方驱动 jar,sha256 钉版本到 ~/.opsxdb/drivers/) - 达梦 JDBC agent 桥就绪(待厂商 jar+实例);TiDB 真实例验收 - 协议族代码审查放行 PolarDB/TDSQL/OceanBase/Kingbase/GaussDB/Oracle - 驱动能力模型:按驱动开关对象树分组/右键菜单/行编辑,NoSQL 树拍平(对象直挂库节点) 驱动管理: - 驱动管理弹框(状态/预装/离线包导入/JDK 检测)+ /api/drivers/* 三接口 - opsxdb-driver 驱动商店仓库(清单/fetch.sh/pack.sh 离线包/import.sh) - 连接时懒加载:DMG 零 Java 产物,首连自动下载(实测 ZK 九件套 1.35s),离线包自动回退 UI/交互: - 设置中心(⚙):常规/执行/结果/驱动/快捷键/关于,左导航+右面板(对标 opsxshell) - 实例级展开箭头(行首 SVG chevron,替代字体回退失真的 Unicode 三角) - 树内嵌套渲染修复:对象树挂在激活连接下;工具栏窄窗口不断行(按钮 nowrap+整颗换行) - 侧栏连接行精简(图标+连接名)、SQLite SSH 守卫、Oracle 死参数清理 质量: - Go 协议层/离线回退单测、E2E 门控测试(ES/ZK/Influx/Mongo/TiDB/JDBC 桥) - 驱动注册表单一事实来源 connection-types.json,README/BACKLOG/AGENTS 同步
176 lines
5.0 KiB
YAML
176 lines
5.0 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: OpsxDB Server
|
|
version: 0.3.0
|
|
description: Database workbench API — sessions, metadata, SQL exec, cancel, DDL, search, export
|
|
servers:
|
|
- url: http://127.0.0.1:8788
|
|
paths:
|
|
/health:
|
|
get:
|
|
summary: Health check
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
/api/health:
|
|
get:
|
|
summary: Health check
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
/api/db/test-connection:
|
|
post:
|
|
summary: Ping a database without creating a session
|
|
/api/db/open:
|
|
post:
|
|
summary: Ping and create a server-side session (password stays on server)
|
|
/api/db/close:
|
|
post:
|
|
summary: Close a session
|
|
/api/db/databases:
|
|
post:
|
|
summary: List databases (sessionId or full conn)
|
|
/api/db/tables:
|
|
post:
|
|
summary: List tables in a database
|
|
/api/db/columns:
|
|
post:
|
|
summary: List columns of a table
|
|
/api/db/exec:
|
|
post:
|
|
summary: Execute SQL or Redis command (timeoutMs/requestId honored; dangerous SQL two-phase confirm)
|
|
/api/db/explain:
|
|
post:
|
|
summary: Execution plan (rows for mysql/pg/sqlite, SHOWPLAN_XML for mssql, DBMS_XPLAN for oracle)
|
|
/api/db/cancel:
|
|
post:
|
|
summary: Cancel an in-flight exec/explain by requestId → {"ok":true,"cancelled":bool}
|
|
/api/db/ddl:
|
|
post:
|
|
summary: Show CREATE TABLE DDL for a table → {"ddl":"...","error":""}
|
|
/api/db/search:
|
|
post:
|
|
summary: Fuzzy search tables/views by keyword (max 50) → {"results":[...],"error":""}
|
|
/api/db/export:
|
|
post:
|
|
summary: Stream query results as csv/json/insert attachment (read-only SQL only, two-phase confirm on danger hits)
|
|
/api/db/redis/keys:
|
|
post:
|
|
summary: Redis SCAN keys (whitelist-guarded commands)
|
|
/api/db/redis/key:
|
|
post:
|
|
summary: Redis key value (type/ttl + rows)
|
|
/api/db/redis/key/delete:
|
|
post:
|
|
summary: Delete a Redis key
|
|
/api/ai/chat:
|
|
post:
|
|
summary: AI actions (stub fallback when unconfigured)
|
|
/api/ai/config:
|
|
get:
|
|
summary: Get masked AI config
|
|
post:
|
|
summary: Save AI provider config (apiKey stored 0600, responses masked)
|
|
/api/ai/generate:
|
|
post:
|
|
summary: AI SQL generation (action=generate)
|
|
components:
|
|
schemas:
|
|
ConnReq:
|
|
type: object
|
|
properties:
|
|
driver: { type: string }
|
|
host: { type: string }
|
|
port: { type: integer }
|
|
user: { type: string }
|
|
password: { type: string }
|
|
database: { type: string }
|
|
service: { type: string }
|
|
sql: { type: string }
|
|
table: { type: string }
|
|
limit: { type: integer }
|
|
offset: { type: integer }
|
|
key: { type: string }
|
|
pattern: { type: string }
|
|
keyword: { type: string }
|
|
format: { type: string, enum: [csv, json, insert] }
|
|
sessionId: { type: string }
|
|
ssl: { type: boolean }
|
|
sslMode: { type: string, enum: [disable, require, skip-verify, verify-ca] }
|
|
sslCA: { type: string }
|
|
sslCert: { type: string }
|
|
sslKey: { type: string }
|
|
sslCAContent: { type: string }
|
|
sslCertContent: { type: string }
|
|
sslKeyContent: { type: string }
|
|
tlsServerName: { type: string }
|
|
sshEnabled: { type: boolean }
|
|
sshHost: { type: string }
|
|
sshPort: { type: integer }
|
|
sshUser: { type: string }
|
|
sshAuth: { type: string, enum: [password, privateKey] }
|
|
sshPassword: { type: string }
|
|
sshPrivateKey: { type: string }
|
|
sshPassphrase: { type: string }
|
|
confirmDanger: { type: boolean }
|
|
timeoutMs: { type: integer }
|
|
requestId: { type: string }
|
|
CancelReq:
|
|
type: object
|
|
properties:
|
|
requestId: { type: string }
|
|
CancelResp:
|
|
type: object
|
|
properties:
|
|
ok: { type: boolean }
|
|
cancelled: { type: boolean }
|
|
DDLResp:
|
|
type: object
|
|
properties:
|
|
ddl: { type: string }
|
|
error: { type: string }
|
|
ObjectHit:
|
|
type: object
|
|
properties:
|
|
schema: { type: string }
|
|
name: { type: string }
|
|
type: { type: string, enum: [table, view] }
|
|
SearchResp:
|
|
type: object
|
|
properties:
|
|
results:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/ObjectHit"
|
|
error: { type: string }
|
|
ExecResult:
|
|
type: object
|
|
properties:
|
|
columns:
|
|
type: array
|
|
items: { type: string }
|
|
rows:
|
|
type: array
|
|
items:
|
|
type: object
|
|
rowCount: { type: integer }
|
|
timeMs: { type: integer }
|
|
error: { type: string }
|
|
truncated: { type: boolean }
|
|
limit: { type: integer }
|
|
offset: { type: integer }
|
|
needConfirm: { type: boolean }
|
|
ExplainResult:
|
|
type: object
|
|
properties:
|
|
columns:
|
|
type: array
|
|
items: { type: string }
|
|
rows:
|
|
type: array
|
|
items:
|
|
type: object
|
|
text: { type: string }
|
|
timeMs: { type: integer }
|
|
error: { type: string }
|