(blockId: string, output: unknown)
| 441 | const base64MaxBytes = streamConfig.base64MaxBytes |
| 442 | |
| 443 | const onBlockCompleteCallback = async (blockId: string, output: unknown) => { |
| 444 | state.completedBlockIds.add(blockId) |
| 445 | |
| 446 | if (!streamConfig.selectedOutputs?.length) { |
| 447 | return |
| 448 | } |
| 449 | |
| 450 | if (state.streamedChunks.has(blockId)) { |
| 451 | return |
| 452 | } |
| 453 | |
| 454 | const matchingOutputs = getSelectedOutputDescriptors(streamConfig.selectedOutputs).filter( |
| 455 | (descriptor) => descriptor.blockId === blockId |
| 456 | ) |
| 457 | |
| 458 | for (const descriptor of matchingOutputs) { |
| 459 | if (state.selectedOutputError) { |
| 460 | break |
| 461 | } |
| 462 | try { |
| 463 | const remainingBytes = getRemainingSelectedOutputBytes(state.selectedOutputBytes) |
| 464 | const extractionContext = { |
| 465 | requestId, |
| 466 | workspaceId: options.workspaceId, |
| 467 | workflowId: options.workflowId, |
| 468 | executionId, |
| 469 | largeValueExecutionIds: options.largeValueExecutionIds, |
| 470 | largeValueKeys: options.largeValueKeys, |
| 471 | fileKeys: options.fileKeys, |
| 472 | allowLargeValueWorkflowScope: options.allowLargeValueWorkflowScope, |
| 473 | userId: options.userId, |
| 474 | base64MaxBytes: Math.min( |
| 475 | base64MaxBytes ?? MAX_INLINE_MATERIALIZATION_BYTES, |
| 476 | getBase64DecodedByteBudget(remainingBytes) |
| 477 | ), |
| 478 | } |
| 479 | const materializationContext = buildMaterializationContext(extractionContext) |
| 480 | const outputValue = await extractOutputValue(output, descriptor.path, extractionContext) |
| 481 | |
| 482 | if (outputValue !== undefined) { |
| 483 | const materializedOutput = await materializeInlineExecutionValue( |
| 484 | outputValue, |
| 485 | materializationContext, |
| 486 | { maxBytes: remainingBytes } |
| 487 | ) |
| 488 | const shouldHydrateOutput = includeFileBase64 |
| 489 | const hydratedOutput = shouldHydrateOutput |
| 490 | ? await hydrateUserFilesWithBase64(materializedOutput, { |
| 491 | requestId, |
| 492 | ...materializationContext, |
| 493 | maxBytes: Math.min( |
| 494 | base64MaxBytes ?? MAX_INLINE_MATERIALIZATION_BYTES, |
| 495 | getBase64DecodedByteBudget(remainingBytes) |
| 496 | ), |
| 497 | preserveLargeValueMetadata: true, |
| 498 | }) |
| 499 | : materializedOutput |
| 500 | await materializeInlineExecutionValue(hydratedOutput, materializationContext, { |
no test coverage detected