@@ -2,17 +2,10 @@ import { EnrichmentIcon } from '@/components/icons'
22import type { BlockConfig , OutputFieldDefinition , ParamType } from '@/blocks/types'
33import { IntegrationType } from '@/blocks/types'
44import { ALL_ENRICHMENTS , getEnrichment } from '@/enrichments'
5- import type { EnrichmentInputField , EnrichmentOutputField } from '@/enrichments/types'
5+ import { mapFieldType } from '@/enrichments/providers'
6+ import type { EnrichmentOutputField } from '@/enrichments/types'
67import type { EnrichmentRunResponse } from '@/tools/enrichment/types'
78
8- /** Maps an enrichment input/output column type to a block field type. */
9- function fieldType ( type : EnrichmentInputField [ 'type' ] | EnrichmentOutputField [ 'type' ] ) : ParamType {
10- if ( type === 'number' ) return 'number'
11- if ( type === 'boolean' ) return 'boolean'
12- if ( type === 'json' ) return 'json'
13- return 'string'
14- }
15-
169/** Stable subBlock id for an enrichment input (unique across enrichments). */
1710const inputFieldId = ( enrichmentId : string , inputId : string ) => `${ enrichmentId } __${ inputId } `
1811
@@ -35,7 +28,7 @@ const blockInputs: Record<string, { type: ParamType; description: string }> = {
3528for ( const enrichment of ALL_ENRICHMENTS ) {
3629 for ( const input of enrichment . inputs ) {
3730 blockInputs [ inputFieldId ( enrichment . id , input . id ) ] = {
38- type : fieldType ( input . type ) ,
31+ type : mapFieldType ( input . type ) ,
3932 description : `${ input . name } (for ${ enrichment . name } )` ,
4033 }
4134 }
@@ -60,7 +53,7 @@ const blockOutputs: Record<string, OutputFieldDefinition> = {
6053}
6154for ( const [ id , { field, operations } ] of outputProducers ) {
6255 blockOutputs [ id ] = {
63- type : fieldType ( field . type ) ,
56+ type : mapFieldType ( field . type ) ,
6457 description : field . name ,
6558 condition : { field : 'operation' , value : operations } ,
6659 }
0 commit comments