Skip to content

Image Pipeline Playground

feat(frontend/types): add TypeScript definitions for graph and node states

Mohammad Rajaeif546309168e4
diff --git a/frontend/src/types/graph.ts b/frontend/src/types/graph.ts
new file mode 100644
index 0000000..a268478
--- /dev/null
+++ b/frontend/src/types/graph.ts
@@ -0,0 +1,65 @@
+export type PortDirection = 'input' | 'output'
+
+export interface PortSpec {
+ id: string
+ name: string
+ direction: PortDirection
+ data_type: string
+ multiple: boolean
+}
+
+export interface ParamField {
+ name: string
+ label: string
+ type: string
+ default?: unknown
+ minimum?: number | null
+ maximum?: number | null
+ step?: number | null
+ options?: string[] | null
+ description?: string | null
+}
+
+export interface NodeMetadata {
+ type: string
+ label: string
+ category: string
+ description: string
+ ports: PortSpec[]
+ params: ParamField[]
+ stochastic: boolean
+}
+
+export interface GraphNodeData {
+ type: string
+ label: string
+ params: Record<string, unknown>
+ category: string
+ active?: boolean
+ [key: string]: unknown
+}
+
+export interface ExecutionPreview {
+ nodeId: string
+ sampleIndex: number
+ imageB64: string
+ cacheHit?: boolean | null
+}
+
+export type ExecutionEventType =
+ | 'progress'
+ | 'preview'
+ | 'log'
+ | 'error'
+ | 'done'
+ | 'cancelled'
+
+export interface ExecutionEvent {
+ type: ExecutionEventType
+ node_id?: string | null
+ message?: string | null
+ progress?: number | null
+ image_b64?: string | null
+ sample_index?: number | null
+ cache_hit?: boolean | null
+}
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
new file mode 100644
index 0000000..55ba9da
--- /dev/null
+++ b/frontend/src/types/index.ts
@@ -0,0 +1,10 @@
+export type {
+ ExecutionEvent,
+ ExecutionEventType,
+ ExecutionPreview,
+ GraphNodeData,
+ NodeMetadata,
+ ParamField,
+ PortDirection,
+ PortSpec,
+} from './graph'