import { schema } from '@kbn/config-schema' ; import { IRouter } from '../../http' ; import { CapabilitiesResolver } from '../resolve_capabilities' ; export function registerCapabilitiesRoutes ( router , resolver ) { router . post ( { path : '/api/core/capabilities' , options : { authRequired : 'optional' , } , validate : { query : schema . object ( { useDefaultCapabilities : schema . boolean ( { defaultValue : false } ) , } ) , body : schema . object ( { applications : schema . arrayOf ( schema . string ( ) ) , } ) , } , } , async ( ctx , req , res ) => { const { useDefaultCapabilities } = req . query ; const { applications } = req . body ; const capabilities = await resolver ( req , applications , useDefaultCapabilities ) ; return res . ok ( { body : capabilities , } ) ; } ) ; }