import { schema } from '@kbn/config-schema' ; import { ensureNoUnsafeProperties } from '@kbn/std' ; import { getVisData } from '../lib/get_vis_data' ; import { ROUTES } from '../../common/constants' ; import { Framework } from '../plugin' ; import type { VisTypeTimeseriesRouter } from '../types' ; import type { VisPayload } from '../../common/types' ; const escapeHatch = schema . object ( { } , { unknowns : 'allow' } ) ; export const visDataRoutes = ( router , framework ) => { router . post < { } , { } , VisPayload > ( { path : ROUTES . VIS_DATA , validate : { body : escapeHatch , } , } , async ( requestContext , request , response ) => { try { ensureNoUnsafeProperties ( request . body ) ; } catch ( error ) { return response . badRequest ( { body : error . message , } ) ; } const results = await getVisData ( requestContext , request , framework ) ; return response . ok ( { body : results } ) ; } ) ; } ;