import * as t from 'io-ts' ; import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository' ; import { createApmServerRoute } from '../apm_routes/create_apm_server_route' ; import { getEventMetadata } from './get_event_metadata' ; import { processorEventRt } from '../../../common/processor_event' ; import { setupRequest } from '../../lib/helpers/setup_request' ; const eventMetadataRoute = createApmServerRoute ( { endpoint : 'GET /internal/apm/event_metadata/{processorEvent}/{id}' , options : { tags : [ 'access:apm' ] } , params : t . type ( { path : t . type ( { processorEvent : processorEventRt , id : t . string , } ) , } ) , handler : async ( resources ) => { const setup = await setupRequest ( resources ) ; const { path : { processorEvent , id } , } = resources . params ; const metadata = await getEventMetadata ( { apmEventClient : setup . apmEventClient , processorEvent , id , } ) ; return { metadata , } ; } , } ) ; export const eventMetadataRouteRepository = createApmServerRouteRepository ( ) . add ( eventMetadataRoute ) ;