Expand governed Dataflow editor and node library
This commit is contained in:
@@ -2,6 +2,7 @@ import { apiFetch, type ApiSettings } from "@govoplan/core-webui";
|
||||
|
||||
export type PipelineStatus = "draft" | "active" | "archived";
|
||||
export type EditorMode = "graph" | "sql";
|
||||
export type NodeCategory = "load" | "combine" | "filter" | "transform" | "output";
|
||||
|
||||
export type GraphPosition = { x: number; y: number };
|
||||
export type PipelineGraphNode = {
|
||||
@@ -101,10 +102,109 @@ export type PipelinePreview = {
|
||||
truncated: boolean;
|
||||
diagnostics: DataflowDiagnostic[];
|
||||
node_diagnostics: NodePreviewDiagnostic[];
|
||||
source_fingerprints: Record<string, unknown>[];
|
||||
input_row_count: number;
|
||||
definition_hash: string;
|
||||
executor_version: string;
|
||||
};
|
||||
|
||||
export type NodePortDefinition = {
|
||||
id: string;
|
||||
label: string;
|
||||
required: boolean;
|
||||
multiple: boolean;
|
||||
minimum_connections: number;
|
||||
};
|
||||
|
||||
export type NodeConfigFieldDefinition = {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: string;
|
||||
required: boolean;
|
||||
description?: string | null;
|
||||
options: Array<[string, string]>;
|
||||
};
|
||||
|
||||
export type NodeTypeDefinition = {
|
||||
type: string;
|
||||
category: NodeCategory;
|
||||
category_label: string;
|
||||
label: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
input_ports: NodePortDefinition[];
|
||||
output_ports: NodePortDefinition[];
|
||||
config_fields: NodeConfigFieldDefinition[];
|
||||
default_config: Record<string, unknown>;
|
||||
sql_support: "full" | "partial" | "none";
|
||||
};
|
||||
|
||||
export type TabularSourceColumn = {
|
||||
name: string;
|
||||
data_type: string;
|
||||
nullable: boolean;
|
||||
};
|
||||
|
||||
export type TabularSource = {
|
||||
ref: string;
|
||||
provider: string;
|
||||
source_name: string;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
columns: TabularSourceColumn[];
|
||||
schema_version: string;
|
||||
fingerprint: string;
|
||||
row_count?: number | null;
|
||||
byte_count?: number | null;
|
||||
updated_at?: string | null;
|
||||
capabilities: string[];
|
||||
};
|
||||
|
||||
export type TabularSourceCatalogue = {
|
||||
available: boolean;
|
||||
writable: boolean;
|
||||
sources: TabularSource[];
|
||||
};
|
||||
|
||||
export async function listDataflowNodeTypes(settings: ApiSettings): Promise<NodeTypeDefinition[]> {
|
||||
const response = await apiFetch<{ nodes: NodeTypeDefinition[] }>(
|
||||
settings,
|
||||
"/api/v1/dataflow/node-types"
|
||||
);
|
||||
return response.nodes;
|
||||
}
|
||||
|
||||
export function listDataflowSources(
|
||||
settings: ApiSettings,
|
||||
query = ""
|
||||
): Promise<TabularSourceCatalogue> {
|
||||
const suffix = query.trim() ? `?query=${encodeURIComponent(query.trim())}` : "";
|
||||
return apiFetch<TabularSourceCatalogue>(settings, `/api/v1/dataflow/sources${suffix}`);
|
||||
}
|
||||
|
||||
export function createDataflowSourceSnapshot(
|
||||
settings: ApiSettings,
|
||||
payload: {
|
||||
name: string;
|
||||
source_name: string;
|
||||
description?: string | null;
|
||||
} & (
|
||||
{
|
||||
format: "json";
|
||||
rows: Record<string, unknown>[];
|
||||
} | {
|
||||
format: "csv";
|
||||
csv_text: string;
|
||||
delimiter: string;
|
||||
}
|
||||
)
|
||||
): Promise<TabularSource> {
|
||||
return apiFetch<TabularSource>(settings, "/api/v1/dataflow/sources/snapshots", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export async function listDataflowPipelines(settings: ApiSettings): Promise<Pipeline[]> {
|
||||
const response = await apiFetch<{ pipelines: Pipeline[] }>(settings, "/api/v1/dataflow/pipelines");
|
||||
return response.pipelines;
|
||||
|
||||
Reference in New Issue
Block a user