import { schema } from '@kbn/config-schema' ; import { IRouter } from '../../http' ; import { InternalCoreUsageDataSetup } from '../../core_usage_data' ; interface RouteDependencies { coreUsageData : InternalCoreUsageDataSetup ; } export const registerResolveRoute = ( router , { coreUsageData } ) => { router . get ( { path : '/resolve/{type}/{id}' , validate : { params : schema . object ( { type : schema . string ( ) , id : schema . string ( ) , } ) , } , } , router . handleLegacyErrors ( async ( context , req , res ) => { const { type , id } = req . params ; const usageStatsClient = coreUsageData . getClient ( ) ; usageStatsClient . incrementSavedObjectsResolve ( { request : req } ) . catch ( ( ) => { } ) ; const result = await context . core . savedObjects . client . resolve ( type , id ) ; return res . ok ( { body : result } ) ; } ) ) ; } ;