feat: complete catalog-driven preprocessing
Publish documentation / publish (push) Successful in 2m12s
Publish documentation / publish (push) Successful in 2m12s
This commit is contained in:
@@ -247,7 +247,7 @@ export interface CatalogMetadataDeleteCounts {
|
||||
relationships: number;
|
||||
}
|
||||
|
||||
export type CatalogDescriptionTarget = "tables" | "columns" | "database_columns";
|
||||
export type CatalogDescriptionTarget = "tables" | "columns" | "database" | "database_columns";
|
||||
|
||||
export interface CatalogDescriptionConsolidationCounts {
|
||||
copied: number;
|
||||
@@ -559,11 +559,11 @@ export const deleteCatalogTableMetadata = (
|
||||
|
||||
export function consolidateCatalogDescriptions(
|
||||
databaseId: string,
|
||||
target: "database_columns",
|
||||
target: Extract<CatalogDescriptionTarget, "database" | "database_columns">,
|
||||
): Promise<CatalogDescriptionConsolidationCounts>;
|
||||
export function consolidateCatalogDescriptions(
|
||||
databaseId: string,
|
||||
target: Exclude<CatalogDescriptionTarget, "database_columns">,
|
||||
target: Exclude<CatalogDescriptionTarget, "database" | "database_columns">,
|
||||
targetIds: string[],
|
||||
): Promise<CatalogDescriptionConsolidationCounts>;
|
||||
export function consolidateCatalogDescriptions(
|
||||
@@ -575,7 +575,9 @@ export function consolidateCatalogDescriptions(
|
||||
`/catalog/databases/${encodeURIComponent(databaseId)}/descriptions/consolidate`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify(target === "database_columns" ? { target } : { target, targetIds }),
|
||||
body: JSON.stringify(
|
||||
target === "database" || target === "database_columns" ? { target } : { target, targetIds },
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ const safeErrorCodes = new Set([
|
||||
"relationship_not_found", "relationship_duplicate", "relationship_target_not_unique",
|
||||
"relationship_type_incompatible", "relationship_read_only", "relationship_request_invalid",
|
||||
"relationship_operation_failed", "relationship_schema_stale", "column_not_found",
|
||||
"preprocessing_request_invalid", "preprocessing_blocked", "preprocessing_run_failed",
|
||||
]);
|
||||
|
||||
type SafeErrorPayload = {
|
||||
@@ -116,6 +117,9 @@ const localCodeMessages: Record<string, string> = {
|
||||
relationship_operation_failed: "The relationship operation failed.",
|
||||
relationship_schema_stale: "Synchronize the current database schema before managing logical relationships.",
|
||||
column_not_found: "The selected catalog column was not found. Refresh and try again.",
|
||||
preprocessing_request_invalid: "The preprocessing request is invalid.",
|
||||
preprocessing_blocked: "Preprocessing is blocked by a current workspace prerequisite.",
|
||||
preprocessing_run_failed: "Preprocessing failed. Review the latest diagnostic and retry.",
|
||||
};
|
||||
|
||||
const localStatusMessages: Record<number, string> = {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { apiFetch } from "./client";
|
||||
|
||||
export type WorkspacePreprocessingState =
|
||||
| "ready"
|
||||
| "required"
|
||||
| "running"
|
||||
| "blocked"
|
||||
| "failed";
|
||||
|
||||
export interface WorkspacePreprocessingStatus {
|
||||
schemaVersion: 1;
|
||||
workspaceId: string;
|
||||
state: WorkspacePreprocessingState;
|
||||
actionable: boolean;
|
||||
clearable: boolean;
|
||||
detail: string;
|
||||
reason?: string;
|
||||
nextStep?: string;
|
||||
metadataRevision?: number;
|
||||
preprocessedMetadataRevision?: number;
|
||||
startedAt?: string;
|
||||
finishedAt?: string;
|
||||
progress?: {
|
||||
stage: "catalog_snapshot" | "schema_index" | "evidence" | "finalizing";
|
||||
step: number;
|
||||
totalSteps: 4;
|
||||
};
|
||||
lastFailure?: {
|
||||
stage: string;
|
||||
errorCode: string;
|
||||
finishedAt: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const getWorkspacePreprocessingStatus = (workspaceId: string) =>
|
||||
apiFetch<WorkspacePreprocessingStatus>(
|
||||
`/workspaces/${encodeURIComponent(workspaceId)}/preprocessing`,
|
||||
);
|
||||
|
||||
export const runWorkspacePreprocessing = (workspaceId: string) =>
|
||||
apiFetch<WorkspacePreprocessingStatus>(
|
||||
`/workspaces/${encodeURIComponent(workspaceId)}/preprocessing`,
|
||||
{ method: "POST" },
|
||||
);
|
||||
|
||||
export const clearWorkspacePreprocessing = (workspaceId: string) =>
|
||||
apiFetch<WorkspacePreprocessingStatus>(
|
||||
`/workspaces/${encodeURIComponent(workspaceId)}/preprocessing`,
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
@@ -69,7 +69,8 @@ export interface CanonicalWorkspace {
|
||||
description?: string;
|
||||
language: "en" | "it";
|
||||
};
|
||||
dwh: {
|
||||
/** Generated runtime descriptors may contain this block; authored workspace YAML never does. */
|
||||
dwh?: {
|
||||
engine: "postgres";
|
||||
database: string;
|
||||
schema: string;
|
||||
|
||||
Reference in New Issue
Block a user