(
ctx: ExecutionContext,
blockId: string,
blockType: 'loop' | 'parallel',
output: { results: unknown },
contextExtensions: ContextExtensions | null
)
| 286 | * block name. |
| 287 | */ |
| 288 | export async function emitSubflowSuccessEvents( |
| 289 | ctx: ExecutionContext, |
| 290 | blockId: string, |
| 291 | blockType: 'loop' | 'parallel', |
| 292 | output: { results: unknown }, |
| 293 | contextExtensions: ContextExtensions | null |
| 294 | ): Promise<void> { |
| 295 | const now = new Date().toISOString() |
| 296 | const executionOrder = getNextExecutionOrder(ctx) |
| 297 | const block = ctx.workflow?.blocks.find((b) => b.id === blockId) |
| 298 | const blockName = block?.metadata?.name ?? blockType |
| 299 | const iterationContext = buildContainerIterationContext(ctx, blockId) |
| 300 | |
| 301 | ctx.blockLogs.push({ |
| 302 | blockId, |
| 303 | blockName, |
| 304 | blockType, |
| 305 | startedAt: now, |
| 306 | endedAt: now, |
| 307 | durationMs: DEFAULTS.EXECUTION_TIME, |
| 308 | success: true, |
| 309 | output, |
| 310 | executionOrder, |
| 311 | }) |
| 312 | |
| 313 | if (contextExtensions?.onBlockComplete) { |
| 314 | try { |
| 315 | await contextExtensions.onBlockComplete( |
| 316 | blockId, |
| 317 | blockName, |
| 318 | blockType, |
| 319 | { |
| 320 | output, |
| 321 | executionTime: DEFAULTS.EXECUTION_TIME, |
| 322 | startedAt: now, |
| 323 | executionOrder, |
| 324 | endedAt: now, |
| 325 | }, |
| 326 | iterationContext |
| 327 | ) |
| 328 | } catch (error) { |
| 329 | logger.warn('Subflow success completion callback failed', { |
| 330 | blockId, |
| 331 | blockType, |
| 332 | error: toError(error).message, |
| 333 | }) |
| 334 | } |
| 335 | } |
| 336 | } |
no test coverage detected