(
blockId: string,
blockName: string,
blockType: string,
callbackData: any,
iterationContext?: IterationContext,
childWorkflowContext?: ChildWorkflowContext
)
| 1317 | } |
| 1318 | |
| 1319 | const onBlockComplete = async ( |
| 1320 | blockId: string, |
| 1321 | blockName: string, |
| 1322 | blockType: string, |
| 1323 | callbackData: any, |
| 1324 | iterationContext?: IterationContext, |
| 1325 | childWorkflowContext?: ChildWorkflowContext |
| 1326 | ) => { |
| 1327 | const compactCallbackData = { |
| 1328 | ...callbackData, |
| 1329 | input: await compactRoutePayload(callbackData.input, { |
| 1330 | workspaceId, |
| 1331 | workflowId, |
| 1332 | executionId, |
| 1333 | userId: actorUserId, |
| 1334 | preserveUserFileBase64: includeFileBase64, |
| 1335 | preserveRoot: true, |
| 1336 | }), |
| 1337 | output: await compactRoutePayload(callbackData.output, { |
| 1338 | workspaceId, |
| 1339 | workflowId, |
| 1340 | executionId, |
| 1341 | userId: actorUserId, |
| 1342 | preserveUserFileBase64: includeFileBase64, |
| 1343 | preserveRoot: true, |
| 1344 | }), |
| 1345 | } |
| 1346 | const hasError = compactCallbackData.output?.error |
| 1347 | const childWorkflowData = childWorkflowContext |
| 1348 | ? { |
| 1349 | childWorkflowBlockId: childWorkflowContext.parentBlockId, |
| 1350 | childWorkflowName: childWorkflowContext.workflowName, |
| 1351 | } |
| 1352 | : {} |
| 1353 | |
| 1354 | const instanceData = callbackData.childWorkflowInstanceId |
| 1355 | ? { childWorkflowInstanceId: callbackData.childWorkflowInstanceId } |
| 1356 | : {} |
| 1357 | |
| 1358 | if (hasError) { |
| 1359 | reqLogger.info('onBlockComplete (error) called', { |
| 1360 | blockId, |
| 1361 | blockName, |
| 1362 | blockType, |
| 1363 | error: compactCallbackData.output.error, |
| 1364 | }) |
| 1365 | await sendEvent({ |
| 1366 | type: 'block:error', |
| 1367 | timestamp: new Date().toISOString(), |
| 1368 | executionId, |
| 1369 | workflowId, |
| 1370 | data: { |
| 1371 | blockId, |
| 1372 | blockName, |
| 1373 | blockType, |
| 1374 | input: compactCallbackData.input, |
| 1375 | error: compactCallbackData.output.error, |
| 1376 | durationMs: compactCallbackData.executionTime || 0, |
nothing calls this directly
no test coverage detected