@@ -469,24 +469,6 @@ function isFileOutputDefinition(value: unknown): value is { type: FileOutputType
469469 return type === 'file' || type === 'file[]'
470470}
471471
472- export function getBlockOutputPaths (
473- blockType : string ,
474- subBlocks ?: Record < string , SubBlockWithValue > ,
475- triggerMode ?: boolean
476- ) : string [ ] {
477- const outputs = getBlockOutputs ( blockType , subBlocks , triggerMode )
478- const paths = generateOutputPaths ( outputs )
479-
480- if ( blockType === TRIGGER_TYPES . START ) {
481- return paths . filter ( ( path ) => {
482- const key = path . split ( '.' ) [ 0 ]
483- return ! shouldFilterReservedField ( blockType , key , '' , subBlocks )
484- } )
485- }
486-
487- return paths
488- }
489-
490472function getFilePropertyType ( outputs : OutputDefinition , pathParts : string [ ] ) : string | null {
491473 const lastPart = pathParts [ pathParts . length - 1 ]
492474 if ( ! lastPart || ! USER_FILE_PROPERTY_TYPES [ lastPart as keyof typeof USER_FILE_PROPERTY_TYPES ] ) {
@@ -570,26 +552,6 @@ function extractType(value: unknown): string {
570552 return typeof value === 'string' ? value : 'any'
571553}
572554
573- export function getBlockOutputType (
574- blockType : string ,
575- outputPath : string ,
576- subBlocks ?: Record < string , SubBlockWithValue > ,
577- triggerMode ?: boolean
578- ) : string {
579- const outputs = getBlockOutputs ( blockType , subBlocks , triggerMode )
580-
581- const cleanPath = outputPath . replace ( / \[ ( \d + ) \] / g, '' )
582- const pathParts = cleanPath . split ( '.' ) . filter ( Boolean )
583-
584- const filePropertyType = getFilePropertyType ( outputs , pathParts )
585- if ( filePropertyType ) {
586- return filePropertyType
587- }
588-
589- const value = traverseOutputPath ( outputs , pathParts )
590- return extractType ( value )
591- }
592-
593555export function getEffectiveBlockOutputType (
594556 blockType : string ,
595557 outputPath : string ,
@@ -668,60 +630,6 @@ function generateOutputPaths(outputs: Record<string, any>, prefix = ''): string[
668630 return paths
669631}
670632
671- /**
672- * Recursively generates all output paths with their types from an outputs schema.
673- *
674- * @param outputs - The outputs schema object
675- * @param prefix - Current path prefix for recursion
676- * @returns Array of objects containing path and type for each output field
677- */
678- function generateOutputPathsWithTypes (
679- outputs : Record < string , any > ,
680- prefix = ''
681- ) : Array < { path : string ; type : string } > {
682- const paths : Array < { path : string ; type : string } > = [ ]
683-
684- for ( const [ key , value ] of Object . entries ( outputs ) ) {
685- const currentPath = prefix ? `${ prefix } .${ key } ` : key
686-
687- if ( typeof value === 'string' ) {
688- paths . push ( { path : currentPath , type : value } )
689- } else if ( typeof value === 'object' && value !== null ) {
690- if ( 'type' in value && typeof value . type === 'string' ) {
691- if ( isFileOutputDefinition ( value ) ) {
692- paths . push ( { path : currentPath , type : value . type } )
693- for ( const prop of USER_FILE_ACCESSIBLE_PROPERTIES ) {
694- paths . push ( {
695- path : `${ currentPath } .${ prop } ` ,
696- type : USER_FILE_PROPERTY_TYPES [ prop as keyof typeof USER_FILE_PROPERTY_TYPES ] ,
697- } )
698- }
699- continue
700- }
701-
702- if ( value . type === 'array' && value . items ?. properties ) {
703- paths . push ( { path : currentPath , type : 'array' } )
704- const subPaths = generateOutputPathsWithTypes ( value . items . properties , currentPath )
705- paths . push ( ...subPaths )
706- } else if ( ( value . type === 'object' || value . type === 'json' ) && value . properties ) {
707- paths . push ( { path : currentPath , type : value . type } )
708- const subPaths = generateOutputPathsWithTypes ( value . properties , currentPath )
709- paths . push ( ...subPaths )
710- } else {
711- paths . push ( { path : currentPath , type : value . type } )
712- }
713- } else {
714- const subPaths = generateOutputPathsWithTypes ( value , currentPath )
715- paths . push ( ...subPaths )
716- }
717- } else {
718- paths . push ( { path : currentPath , type : 'any' } )
719- }
720- }
721-
722- return paths
723- }
724-
725633/**
726634 * Gets the tool outputs for a block operation.
727635 *
@@ -764,41 +672,6 @@ export function getToolOutputs(
764672 }
765673}
766674
767- export function getToolOutputPaths (
768- blockConfig : BlockConfig ,
769- subBlocks ?: Record < string , SubBlockWithValue >
770- ) : string [ ] {
771- const outputs = getToolOutputs ( blockConfig , subBlocks )
772-
773- if ( ! outputs || Object . keys ( outputs ) . length === 0 ) return [ ]
774-
775- if ( subBlocks && blockConfig . outputs ) {
776- const filteredOutputs : Record < string , any > = { }
777-
778- for ( const [ key , value ] of Object . entries ( outputs ) ) {
779- const blockOutput = blockConfig . outputs [ key ]
780-
781- if ( ! blockOutput || typeof blockOutput !== 'object' ) {
782- filteredOutputs [ key ] = value
783- continue
784- }
785-
786- const condition = 'condition' in blockOutput ? blockOutput . condition : undefined
787- if ( condition ) {
788- if ( evaluateOutputCondition ( condition , subBlocks ) ) {
789- filteredOutputs [ key ] = value
790- }
791- } else {
792- filteredOutputs [ key ] = value
793- }
794- }
795-
796- return generateOutputPaths ( filteredOutputs )
797- }
798-
799- return generateOutputPaths ( outputs )
800- }
801-
802675/**
803676 * Generates output paths from a schema definition.
804677 *
@@ -808,24 +681,3 @@ export function getToolOutputPaths(
808681export function getOutputPathsFromSchema ( outputs : Record < string , any > ) : string [ ] {
809682 return generateOutputPaths ( outputs )
810683}
811-
812- /**
813- * Gets the output type for a specific path in a tool's outputs.
814- *
815- * @param blockConfig - The block configuration containing tools config
816- * @param subBlocks - SubBlock values for tool selection
817- * @param path - The dot-separated path to the output field
818- * @returns The type of the output field, or 'any' if not found
819- */
820- export function getToolOutputType (
821- blockConfig : BlockConfig ,
822- subBlocks : Record < string , SubBlockWithValue > | undefined ,
823- path : string
824- ) : string {
825- const outputs = getToolOutputs ( blockConfig , subBlocks )
826- if ( ! outputs || Object . keys ( outputs ) . length === 0 ) return 'any'
827-
828- const pathsWithTypes = generateOutputPathsWithTypes ( outputs )
829- const matchingPath = pathsWithTypes . find ( ( p ) => p . path === path )
830- return matchingPath ?. type || 'any'
831- }
0 commit comments