(appDataSource: DataSource, executionId: string, workspaceId: string, data?: Partial<IExecution>)
| 210 | * @returns {Promise<void>} |
| 211 | */ |
| 212 | const updateExecution = async (appDataSource: DataSource, executionId: string, workspaceId: string, data?: Partial<IExecution>) => { |
| 213 | const execution = await appDataSource.getRepository(Execution).findOneBy({ |
| 214 | id: executionId, |
| 215 | workspaceId |
| 216 | }) |
| 217 | |
| 218 | if (!execution) { |
| 219 | throw new Error(`Execution ${executionId} not found`) |
| 220 | } |
| 221 | |
| 222 | const updateExecution = new Execution() |
| 223 | const bodyExecution: ICommonObject = {} |
| 224 | if (data && data.executionData) { |
| 225 | bodyExecution.executionData = typeof data.executionData === 'string' ? data.executionData : JSON.stringify(data.executionData) |
| 226 | } |
| 227 | if (data && data.state) { |
| 228 | bodyExecution.state = data.state |
| 229 | |
| 230 | if (data.state === 'STOPPED') { |
| 231 | bodyExecution.stoppedDate = new Date() |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | Object.assign(updateExecution, bodyExecution) |
| 236 | |
| 237 | appDataSource.getRepository(Execution).merge(execution, updateExecution) |
| 238 | await appDataSource.getRepository(Execution).save(execution) |
| 239 | } |
| 240 | |
| 241 | export const resolveVariables = async ( |
| 242 | reactFlowNodeData: INodeData, |
no test coverage detected