import * as t from 'io-ts' ; import { getIsUsingTransactionEvents } from '../../lib/helpers/transactions/get_is_using_transaction_events' ; import { setupRequest } from '../../lib/helpers/setup_request' ; import { createApmServerRoute } from '../apm_routes/create_apm_server_route' ; import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository' ; import { kueryRt , rangeRt } from '../default_api_types' ; const fallbackToTransactionsRoute = createApmServerRoute ( { endpoint : 'GET /internal/apm/fallback_to_transactions' , params : t . partial ( { query : t . intersection ( [ kueryRt , t . partial ( rangeRt . props ) ] ) , } ) , options : { tags : [ 'access:apm' ] } , handler : async ( resources ) => { const setup = await setupRequest ( resources ) ; const { params : { query : { kuery , start , end } , } , } = resources ; return { fallbackToTransactions : await getIsUsingTransactionEvents ( { setup , kuery , start , end , } ) , } ; } , } ) ; export const fallbackToTransactionsRouteRepository = createApmServerRouteRepository ( ) . add ( fallbackToTransactionsRoute ) ;