(
result: ExecutionResult,
selectedOutputs: string[] | undefined,
streamedContent: Map<string, string>,
completedBlockIds: Set<string>,
streamedSelectedOutputKeys: Set<string>,
requestId: string,
includeFileBase64: boolean,
base64MaxBytes: number | undefined,
executionId?: string,
context: Omit<OutputExtractionContext, 'executionId'> = { requestId }
)
| 194 | } |
| 195 | |
| 196 | async function buildMinimalResult( |
| 197 | result: ExecutionResult, |
| 198 | selectedOutputs: string[] | undefined, |
| 199 | streamedContent: Map<string, string>, |
| 200 | completedBlockIds: Set<string>, |
| 201 | streamedSelectedOutputKeys: Set<string>, |
| 202 | requestId: string, |
| 203 | includeFileBase64: boolean, |
| 204 | base64MaxBytes: number | undefined, |
| 205 | executionId?: string, |
| 206 | context: Omit<OutputExtractionContext, 'executionId'> = { requestId } |
| 207 | ): Promise<{ success: boolean; error?: string; output: Record<string, unknown> }> { |
| 208 | const durableContext = { |
| 209 | workspaceId: context.workspaceId, |
| 210 | workflowId: context.workflowId, |
| 211 | executionId, |
| 212 | userId: context.userId, |
| 213 | requireDurable: Boolean(context.workspaceId && context.workflowId && executionId), |
| 214 | } |
| 215 | |
| 216 | const minimalResult = { |
| 217 | success: result.success, |
| 218 | error: result.error, |
| 219 | output: {} as Record<string, unknown>, |
| 220 | } |
| 221 | |
| 222 | if (result.status === 'paused') { |
| 223 | minimalResult.output = result.output || {} |
| 224 | return compactExecutionPayload(minimalResult, { |
| 225 | ...durableContext, |
| 226 | preserveUserFileBase64: includeFileBase64, |
| 227 | preserveRoot: true, |
| 228 | }) |
| 229 | } |
| 230 | |
| 231 | if (!selectedOutputs?.length) { |
| 232 | minimalResult.output = result.output || {} |
| 233 | return compactExecutionPayload(minimalResult, { |
| 234 | ...durableContext, |
| 235 | preserveUserFileBase64: includeFileBase64, |
| 236 | preserveRoot: true, |
| 237 | }) |
| 238 | } |
| 239 | |
| 240 | if (!result.output || !result.logs) { |
| 241 | return minimalResult |
| 242 | } |
| 243 | |
| 244 | let selectedOutputBytes = assertSelectedOutputBytes(minimalResult.output) |
| 245 | for (const descriptor of getSelectedOutputDescriptors(selectedOutputs)) { |
| 246 | const { blockId, path } = descriptor |
| 247 | |
| 248 | if (streamedContent.has(blockId)) { |
| 249 | continue |
| 250 | } |
| 251 | |
| 252 | if (streamedSelectedOutputKeys.has(descriptor.key)) { |
| 253 | continue |
no test coverage detected