import { schema } from '@kbn/config-schema' ; import { PLUGIN_ID } from '../../../common' ; import { IRouter } from '../../../../../../src/core/server' ; import { savedQuerySavedObjectType } from '../../../common/types' ; export const deleteSavedQueryRoute = ( router ) => { router . delete ( { path : '/internal/osquery/saved_query/{id}' , validate : { params : schema . object ( { id : schema . string ( ) , } ) , } , options : { tags : [ `access:${ PLUGIN_ID }-writeSavedQueries` ] } , } , async ( context , request , response ) => { const savedObjectsClient = context . core . savedObjects . client ; await savedObjectsClient . delete ( savedQuerySavedObjectType , request . params . id , { refresh : 'wait_for' , } ) ; return response . ok ( { body : { } , } ) ; } ) ; } ;