import { ElasticsearchClient } from 'kibana/server' ; import type { Id , ListItemSchema } from '@kbn/securitysolution-io-ts-list-types' ; import { getListItem } from '.' ; export interface DeleteListItemOptions { id : Id ; esClient : ElasticsearchClient ; listItemIndex : string ; } export const deleteListItem = async ( { id , esClient , listItemIndex , } ) : Promise < ListItemSchema | null > => { const listItem = await getListItem ( { esClient , id , listItemIndex } ) ; if ( listItem == null ) { return null ; } else { await esClient . delete ( { id , index : listItemIndex , refresh : 'wait_for' , } ) ; } return listItem ; } ;