import { AppDataType , ReportViewType , SeriesConfig } from '../types' ; import { IndexPattern } from '../../../../../../../../src/plugins/data/common' ; import { ReportConfigMap } from '../contexts/exploratory_view_config' ; interface Props { reportType : ReportViewType ; indexPattern : IndexPattern ; dataType : AppDataType ; reportConfigMap : ReportConfigMap ; } export const getDefaultConfigs = ( { reportType , dataType , indexPattern , reportConfigMap , } ) : SeriesConfig => { let configResult ; reportConfigMap [ dataType ] ?. some ( ( fn ) => { const config = fn ( { indexPattern } ) ; if ( config . reportType === reportType ) { configResult = config ; } return config . reportType === reportType ; } ) ; if ( ! configResult ) { throw new Error ( `No report config provided for dataType: ${ dataType } and reportType: ${ reportType }` ) ; } return configResult ; } ;