feat: add metadata catalog cleanup commands
This commit is contained in:
@@ -123,6 +123,15 @@ export interface CatalogRelationship {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type CatalogDatabaseMetadataDeleteTarget = "tables" | "relationships";
|
||||
export type CatalogTableMetadataDeleteTarget = "columns" | "relationships";
|
||||
|
||||
export interface CatalogMetadataDeleteCounts {
|
||||
tables: number;
|
||||
columns: number;
|
||||
relationships: number;
|
||||
}
|
||||
|
||||
export type CatalogSyncScope = "tables" | "columns" | "relationships" | "all";
|
||||
export type CatalogSyncState = "queued" | "running" | "awaiting_confirmation" | "applying"
|
||||
| "succeeded" | "failed" | "cancelled" | "interrupted";
|
||||
@@ -228,6 +237,23 @@ export const updateCatalogColumnMetadata = (
|
||||
export const listCatalogRelationships = (databaseId: string) =>
|
||||
apiFetch<CatalogRelationship[]>(`/catalog/databases/${encodeURIComponent(databaseId)}/relationships`);
|
||||
|
||||
export const deleteCatalogDatabaseMetadata = (
|
||||
databaseIds: string[],
|
||||
target: CatalogDatabaseMetadataDeleteTarget,
|
||||
) => apiFetch<CatalogMetadataDeleteCounts>("/catalog/databases/metadata-cleanup", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ databaseIds, target }),
|
||||
});
|
||||
|
||||
export const deleteCatalogTableMetadata = (
|
||||
databaseId: string,
|
||||
tableIds: string[],
|
||||
target: CatalogTableMetadataDeleteTarget,
|
||||
) => apiFetch<CatalogMetadataDeleteCounts>(
|
||||
`/catalog/databases/${encodeURIComponent(databaseId)}/tables/metadata-cleanup`,
|
||||
{ method: "POST", body: JSON.stringify({ tableIds, target }) },
|
||||
);
|
||||
|
||||
export const startCatalogSync = (
|
||||
databaseId: string,
|
||||
version: number,
|
||||
|
||||
Reference in New Issue
Block a user