From b32d4e4e480feffaa3adc17e7f0626c361fa8a03 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Mon, 9 Feb 2026 19:04:32 -0800 Subject: [PATCH] remove unused code --- .../sim/lib/workflows/blocks/block-outputs.ts | 148 ------------------ 1 file changed, 148 deletions(-) diff --git a/apps/sim/lib/workflows/blocks/block-outputs.ts b/apps/sim/lib/workflows/blocks/block-outputs.ts index 8574e7422..13f71d6b3 100644 --- a/apps/sim/lib/workflows/blocks/block-outputs.ts +++ b/apps/sim/lib/workflows/blocks/block-outputs.ts @@ -469,24 +469,6 @@ function isFileOutputDefinition(value: unknown): value is { type: FileOutputType return type === 'file' || type === 'file[]' } -export function getBlockOutputPaths( - blockType: string, - subBlocks?: Record, - triggerMode?: boolean -): string[] { - const outputs = getBlockOutputs(blockType, subBlocks, triggerMode) - const paths = generateOutputPaths(outputs) - - if (blockType === TRIGGER_TYPES.START) { - return paths.filter((path) => { - const key = path.split('.')[0] - return !shouldFilterReservedField(blockType, key, '', subBlocks) - }) - } - - return paths -} - function getFilePropertyType(outputs: OutputDefinition, pathParts: string[]): string | null { const lastPart = pathParts[pathParts.length - 1] if (!lastPart || !USER_FILE_PROPERTY_TYPES[lastPart as keyof typeof USER_FILE_PROPERTY_TYPES]) { @@ -570,26 +552,6 @@ function extractType(value: unknown): string { return typeof value === 'string' ? value : 'any' } -export function getBlockOutputType( - blockType: string, - outputPath: string, - subBlocks?: Record, - triggerMode?: boolean -): string { - const outputs = getBlockOutputs(blockType, subBlocks, triggerMode) - - const cleanPath = outputPath.replace(/\[(\d+)\]/g, '') - const pathParts = cleanPath.split('.').filter(Boolean) - - const filePropertyType = getFilePropertyType(outputs, pathParts) - if (filePropertyType) { - return filePropertyType - } - - const value = traverseOutputPath(outputs, pathParts) - return extractType(value) -} - export function getEffectiveBlockOutputType( blockType: string, outputPath: string, @@ -668,60 +630,6 @@ function generateOutputPaths(outputs: Record, prefix = ''): string[ return paths } -/** - * Recursively generates all output paths with their types from an outputs schema. - * - * @param outputs - The outputs schema object - * @param prefix - Current path prefix for recursion - * @returns Array of objects containing path and type for each output field - */ -function generateOutputPathsWithTypes( - outputs: Record, - prefix = '' -): Array<{ path: string; type: string }> { - const paths: Array<{ path: string; type: string }> = [] - - for (const [key, value] of Object.entries(outputs)) { - const currentPath = prefix ? `${prefix}.${key}` : key - - if (typeof value === 'string') { - paths.push({ path: currentPath, type: value }) - } else if (typeof value === 'object' && value !== null) { - if ('type' in value && typeof value.type === 'string') { - if (isFileOutputDefinition(value)) { - paths.push({ path: currentPath, type: value.type }) - for (const prop of USER_FILE_ACCESSIBLE_PROPERTIES) { - paths.push({ - path: `${currentPath}.${prop}`, - type: USER_FILE_PROPERTY_TYPES[prop as keyof typeof USER_FILE_PROPERTY_TYPES], - }) - } - continue - } - - if (value.type === 'array' && value.items?.properties) { - paths.push({ path: currentPath, type: 'array' }) - const subPaths = generateOutputPathsWithTypes(value.items.properties, currentPath) - paths.push(...subPaths) - } else if ((value.type === 'object' || value.type === 'json') && value.properties) { - paths.push({ path: currentPath, type: value.type }) - const subPaths = generateOutputPathsWithTypes(value.properties, currentPath) - paths.push(...subPaths) - } else { - paths.push({ path: currentPath, type: value.type }) - } - } else { - const subPaths = generateOutputPathsWithTypes(value, currentPath) - paths.push(...subPaths) - } - } else { - paths.push({ path: currentPath, type: 'any' }) - } - } - - return paths -} - /** * Gets the tool outputs for a block operation. * @@ -764,41 +672,6 @@ export function getToolOutputs( } } -export function getToolOutputPaths( - blockConfig: BlockConfig, - subBlocks?: Record -): string[] { - const outputs = getToolOutputs(blockConfig, subBlocks) - - if (!outputs || Object.keys(outputs).length === 0) return [] - - if (subBlocks && blockConfig.outputs) { - const filteredOutputs: Record = {} - - for (const [key, value] of Object.entries(outputs)) { - const blockOutput = blockConfig.outputs[key] - - if (!blockOutput || typeof blockOutput !== 'object') { - filteredOutputs[key] = value - continue - } - - const condition = 'condition' in blockOutput ? blockOutput.condition : undefined - if (condition) { - if (evaluateOutputCondition(condition, subBlocks)) { - filteredOutputs[key] = value - } - } else { - filteredOutputs[key] = value - } - } - - return generateOutputPaths(filteredOutputs) - } - - return generateOutputPaths(outputs) -} - /** * Generates output paths from a schema definition. * @@ -808,24 +681,3 @@ export function getToolOutputPaths( export function getOutputPathsFromSchema(outputs: Record): string[] { return generateOutputPaths(outputs) } - -/** - * Gets the output type for a specific path in a tool's outputs. - * - * @param blockConfig - The block configuration containing tools config - * @param subBlocks - SubBlock values for tool selection - * @param path - The dot-separated path to the output field - * @returns The type of the output field, or 'any' if not found - */ -export function getToolOutputType( - blockConfig: BlockConfig, - subBlocks: Record | undefined, - path: string -): string { - const outputs = getToolOutputs(blockConfig, subBlocks) - if (!outputs || Object.keys(outputs).length === 0) return 'any' - - const pathsWithTypes = generateOutputPathsWithTypes(outputs) - const matchingPath = pathsWithTypes.find((p) => p.path === path) - return matchingPath?.type || 'any' -}