feat(frontend): API type surface for Plan 2 endpoints
This commit is contained in:
100
frontend/src/api/types.ts
Normal file
100
frontend/src/api/types.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
// Mirrors the JSON shape that VolcanicCore.Api endpoints return.
|
||||
// Keep this file the single source of truth; hooks and components import from here.
|
||||
|
||||
export interface JsonSchemaObject {
|
||||
type?: string;
|
||||
title?: string;
|
||||
format?: string;
|
||||
default?: unknown;
|
||||
required?: string[];
|
||||
properties?: Record<string, JsonSchemaObject>;
|
||||
secretFields?: string[];
|
||||
enum?: unknown[];
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export type NodeCategory = "Trigger" | "Action" | "Terminal";
|
||||
|
||||
export interface NodeTypeDto {
|
||||
id: string;
|
||||
displayName: string;
|
||||
category: NodeCategory;
|
||||
inputCount: number;
|
||||
outputCount: number;
|
||||
connectionProviderId: string | null;
|
||||
configSchema: JsonSchemaObject;
|
||||
}
|
||||
|
||||
export interface ConnectionProviderDto {
|
||||
id: string;
|
||||
displayName: string;
|
||||
configSchema: JsonSchemaObject;
|
||||
}
|
||||
|
||||
export interface ConnectionDto {
|
||||
id: string;
|
||||
providerId: string;
|
||||
name: string;
|
||||
config: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// The persisted graph payload — matches what WorkflowGraph.Parse accepts.
|
||||
// `position` is preserved for the SPA canvas; the executor ignores it.
|
||||
export interface GraphNode {
|
||||
id: string;
|
||||
type_id: string;
|
||||
name?: string;
|
||||
position: { x: number; y: number };
|
||||
config: Record<string, unknown>;
|
||||
connection_id?: string | null;
|
||||
}
|
||||
|
||||
export interface GraphEdge {
|
||||
from_node: string;
|
||||
from_port: number;
|
||||
to_node: string;
|
||||
to_port: number;
|
||||
}
|
||||
|
||||
export interface WorkflowGraph {
|
||||
nodes: GraphNode[];
|
||||
edges: GraphEdge[];
|
||||
}
|
||||
|
||||
export interface WorkflowDto {
|
||||
id: string;
|
||||
name: string;
|
||||
active: boolean;
|
||||
graph: WorkflowGraph;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface ExecutionSummary {
|
||||
id: string;
|
||||
workflowId: string;
|
||||
trigger: string;
|
||||
status: "running" | "completed" | "partial" | "failed" | "aborted";
|
||||
startedAt: string;
|
||||
endedAt: string | null;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export interface NodeExecutionDto {
|
||||
nodeId: string;
|
||||
status: "completed" | "failed" | "skipped_due_to_failure";
|
||||
startedAt: string;
|
||||
endedAt: string;
|
||||
error: string | null;
|
||||
inputs: unknown; // [[items on port 0], ...]
|
||||
outputs: unknown; // [[items on out 0], ...]
|
||||
}
|
||||
|
||||
export interface ExecutionDetail extends ExecutionSummary {
|
||||
nodes: NodeExecutionDto[];
|
||||
}
|
||||
|
||||
export interface MeResponse {
|
||||
authenticated: boolean;
|
||||
user: string | null;
|
||||
}
|
||||
Reference in New Issue
Block a user