(flowId: string, workspaceId?: string)
| 313 | } |
| 314 | |
| 315 | const checkFlowValidation = async (flowId: string, workspaceId?: string): Promise<IValidationResult[]> => { |
| 316 | try { |
| 317 | const appServer = getRunningExpressApp() |
| 318 | |
| 319 | // Create query conditions with workspace filtering if provided |
| 320 | const whereCondition: any = { id: flowId } |
| 321 | if (workspaceId) whereCondition.workspaceId = workspaceId |
| 322 | |
| 323 | const flow = await appServer.AppDataSource.getRepository(ChatFlow).findOne({ |
| 324 | where: whereCondition |
| 325 | }) |
| 326 | |
| 327 | if (!flow) { |
| 328 | throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Error: validationService.checkFlowValidation - flow not found!`) |
| 329 | } |
| 330 | |
| 331 | const flowData: IReactFlowObject = JSON.parse(flow.flowData) |
| 332 | return validateFlowData(flowData.nodes, flowData.edges, appServer.nodesPool.componentNodes) |
| 333 | } catch (error) { |
| 334 | throw new InternalFlowiseError( |
| 335 | StatusCodes.INTERNAL_SERVER_ERROR, |
| 336 | `Error: validationService.checkFlowValidation - ${getErrorMessage(error)}` |
| 337 | ) |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | export default { |
| 342 | checkFlowValidation |
nothing calls this directly
no test coverage detected