import { FieldType } from '@terascope/types' ; import { FieldTransformConfig , ProcessMode , FunctionDefinitionType , DataTypeFieldAndChildren , FunctionDefinitionCategory } from '../interfaces' ; import { encodeURL } from './encode-utils' ; export const encodeURLConfig = { name : 'encodeURL' , type : FunctionDefinitionType . FIELD_TRANSFORM , process_mode : ProcessMode . INDIVIDUAL_VALUES , category : FunctionDefinitionCategory . STRING , description : 'Returns a URL encoded version of the input value' , examples : [ { args : { } , config : { version : 1 , fields : { testField : { type : FieldType . String } } } , field : 'testField' , input : 'google.com?q=HELLO AND GOODBYE' , output : 'google.com%3Fq%3DHELLO%20AND%20GOODBYE' } ] , create ( ) { return encodeURL ; } , accepts : [ FieldType . String ] , output_type ( inputConfig ) { const { field_config , child_config } = inputConfig ; return { field_config : { ... field_config , type : FieldType . String } , child_config } ; } } ;