MCPcopy Index your code
hub / github.com/simstudioai/sim / emitSubflowSuccessEvents

Function emitSubflowSuccessEvents

apps/sim/executor/utils/subflow-utils.ts:288–336  ·  view source on GitHub ↗
(
  ctx: ExecutionContext,
  blockId: string,
  blockType: 'loop' | 'parallel',
  output: { results: unknown },
  contextExtensions: ContextExtensions | null
)

Source from the content-addressed store, hash-verified

286 * block name.
287 */
288export 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}

Callers 2

createExitResultMethod · 0.90

Calls 6

getNextExecutionOrderFunction · 0.90
toErrorFunction · 0.90
onBlockCompleteMethod · 0.80
warnMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected