(requestBody: any, orgId: string)
| 9 | import { getRunningExpressApp } from '../../utils/getRunningExpressApp' |
| 10 | |
| 11 | const createTool = async (requestBody: any, orgId: string): Promise<any> => { |
| 12 | try { |
| 13 | const appServer = getRunningExpressApp() |
| 14 | const newTool = new Tool() |
| 15 | Object.assign(newTool, requestBody) |
| 16 | const tool = await appServer.AppDataSource.getRepository(Tool).create(newTool) |
| 17 | const dbResponse = await appServer.AppDataSource.getRepository(Tool).save(tool) |
| 18 | await appServer.telemetry.sendTelemetry( |
| 19 | 'tool_created', |
| 20 | { |
| 21 | version: await getAppVersion(), |
| 22 | toolId: dbResponse.id, |
| 23 | toolName: dbResponse.name |
| 24 | }, |
| 25 | orgId |
| 26 | ) |
| 27 | appServer.metricsProvider?.incrementCounter(FLOWISE_METRIC_COUNTERS.TOOL_CREATED, { status: FLOWISE_COUNTER_STATUS.SUCCESS }) |
| 28 | return dbResponse |
| 29 | } catch (error) { |
| 30 | throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error: toolsService.createTool - ${getErrorMessage(error)}`) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | const deleteTool = async (toolId: string, workspaceId: string): Promise<any> => { |
| 35 | try { |
nothing calls this directly
no test coverage detected