Deleted lib file unused

This commit is contained in:
Emir Karabeg
2025-02-09 18:11:04 -08:00
parent 0a09e9a6d3
commit ee32818548

View File

@@ -1,54 +0,0 @@
import { Edge } from 'reactflow'
import { BlockState } from '@/stores/workflow/types'
import { Executor } from '@/executor'
import { Serializer } from '@/serializer'
export interface WorkflowExecutionResult {
success: boolean
output?: Record<string, any>
error?: string
}
/**
* Executes a workflow with the given blocks and edges
* @param blocks - The blocks in the workflow
* @param edges - The connections between blocks
* @param workflowId - The ID of the workflow
* @returns A promise that resolves to the workflow execution result
*/
export async function executeWorkflow(
blocks: Record<string, BlockState>,
edges: Edge[],
workflowId: string
): Promise<WorkflowExecutionResult> {
try {
// 1. Serialize the workflow
const serializer = new Serializer()
const serializedWorkflow = serializer.serializeWorkflow(blocks, edges)
// 2. Create executor and run workflow
const executor = new Executor(serializedWorkflow)
const result = await executor.execute(workflowId)
// 3. Return result
if (result.success) {
console.log('Workflow executed successfully:', result.output)
return {
success: true,
output: result.output,
}
} else {
console.error('Workflow execution failed:', result.error)
return {
success: false,
error: result.error,
}
}
} catch (error: any) {
console.error('Error executing workflow:', error)
return {
success: false,
error: error instanceof Error ? error.message : 'Unknown error occurred',
}
}
}