import type { HttpServiceSetup } from 'kibana/server' ; import { schema } from '@kbn/config-schema' ; export function registerRoutes ( http ) { const router = http . createRouter ( ) ; router . post ( { path : '/api/core_deprecations_resolve/' , validate : { body : schema . object ( { mockFail : schema . maybe ( schema . boolean ( ) ) , keyId : schema . maybe ( schema . string ( ) ) , deprecationDetails : schema . object ( { domainId : schema . string ( ) , } ) , } ) , } , } , async ( context , req , res ) => { const { mockFail , keyId } = req . body ; if ( mockFail === true ) { return res . badRequest ( { body : new Error ( 'Mocking api failure' ) , } ) ; } if ( keyId ) { const client = context . core . savedObjects . getClient ( ) ; await client . delete ( 'test-deprecations-plugin' , keyId , { refresh : true , } ) ; } return res . ok ( ) ; } ) ; }