feat(queries): 完成 M04 查询定义与版本激活
交付不可变查询版本、保存即生效与激活(D26),并带控制台列表筛选排序与试跑预览;补 RLS 下 current_version_no 回填迁移。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8c0335040f
commit
21cc721fcc
97 files changed
+13354
-153
No files matched your search
@@ -6,14 +6,32 @@ import type {
|
||||
ConnectionTestOutcome,
|
||||
Datasource,
|
||||
DatasourceList,
|
||||
DatasourceListParams,
|
||||
DatasourceReferences,
|
||||
DraftTestOutcome,
|
||||
} from "./types";
|
||||
|
||||
const JSON_HEADERS = { "Content-Type": "application/json" };
|
||||
|
||||
export function listDatasources(): Promise<DatasourceList> {
|
||||
return api<DatasourceList>("/datasources");
|
||||
function toQuery(params?: DatasourceListParams): string {
|
||||
if (!params) {
|
||||
return "";
|
||||
}
|
||||
const q = new URLSearchParams();
|
||||
if (params.name) q.set("name", params.name);
|
||||
if (params.engine) q.set("engine", params.engine);
|
||||
if (params.enabled !== undefined) q.set("enabled", String(params.enabled));
|
||||
if (params.sort_by) q.set("sort_by", params.sort_by);
|
||||
if (params.sort_order) q.set("sort_order", params.sort_order);
|
||||
if (params.page !== undefined) q.set("page", String(params.page));
|
||||
if (params.page_size !== undefined) q.set("page_size", String(params.page_size));
|
||||
if (params.usable) q.set("usable", "true");
|
||||
const text = q.toString();
|
||||
return text ? `?${text}` : "";
|
||||
}
|
||||
|
||||
export function listDatasources(params?: DatasourceListParams): Promise<DatasourceList> {
|
||||
return api<DatasourceList>(`/datasources${toQuery(params)}`);
|
||||
}
|
||||
|
||||
export function getDatasource(id: string): Promise<Datasource> {
|
||||
|
||||
Reference in new issue
Block a user