import { buildExpression , buildExpressionFunction } from '../../../expressions/public' ; import type { Vis } from '../../../visualizations/public' ; import type { TimeseriesExpressionFunctionDefinition } from './metrics_fn' ; import type { TimeseriesVisParams } from './types' ; export const toExpressionAst = ( vis ) => { const timeseries = buildExpressionFunction < TimeseriesExpressionFunctionDefinition > ( 'tsvb' , { params : JSON . stringify ( vis . params ) , uiState : JSON . stringify ( vis . uiState ) , } ) ; const ast = buildExpression ( [ timeseries ] ) ; return ast . toAst ( ) ; } ;