From b543cd1b3d882b40a5c7adda8f47bf013efdc345 Mon Sep 17 00:00:00 2001 From: mrhid6 Date: Tue, 21 Jul 2026 10:28:41 +0100 Subject: [PATCH] feat(web): api client for step import/export/inline/defaults --- web/app/workflows/[id]/page.tsx | 2 +- web/lib/api.ts | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/web/app/workflows/[id]/page.tsx b/web/app/workflows/[id]/page.tsx index 5f9e7e7..cc9656b 100644 --- a/web/app/workflows/[id]/page.tsx +++ b/web/app/workflows/[id]/page.tsx @@ -84,7 +84,7 @@ export default function WorkflowBuilder() { return
Loading…
; } - const libById = (sid: string) => library?.find((l) => l.step_id === sid); + const libById = (sid?: string) => (sid ? library?.find((l) => l.step_id === sid) : undefined); const sortedSteps = [...wf.steps].sort((a, b) => a.order - b.order); const selectedRef = selected !== null ? sortedSteps[selected] : null; diff --git a/web/lib/api.ts b/web/lib/api.ts index 157f87b..bb726d7 100644 --- a/web/lib/api.ts +++ b/web/lib/api.ts @@ -148,10 +148,13 @@ export interface WorkflowStep { declared_outputs: string[]; declared_inputs: InputParam[]; secret_refs: string[]; + source?: "user" | "default"; + slug?: string; } export interface WorkflowStepRef { - step_id: string; + step_id?: string; + inline?: WorkflowStep; order: number; on_failure: "stop" | "continue" | "retry"; max_retries: number; @@ -419,6 +422,30 @@ export const api = { return request(`/steps/${stepId}`, { method: "DELETE" }); }, + exportStepUrl(stepId: string): string { + return `/api/steps/${stepId}/export`; + }, + + importStep(doc: unknown): Promise { + return request("/steps/import", { + method: "POST", + body: JSON.stringify(doc), + }); + }, + + parseStep(doc: unknown): Promise { + return request("/steps/parse", { + method: "POST", + body: JSON.stringify(doc), + }); + }, + + seedDefaults(): Promise<{ created: number; updated: number }> { + return request<{ created: number; updated: number }>("/steps/seed-defaults", { + method: "POST", + }); + }, + // Workflows listWorkflows(): Promise { return request("/workflows");