import type { ElasticsearchClient } from '../../elasticsearch' ; import * as Actions from './actions' ; import type { State } from './state' ; export async function cleanup ( client , state ? ) { if ( ! state ) return ; if ( 'sourceIndexPitId' in state ) { await Actions . closePit ( { client , pitId : state . sourceIndexPitId } ) ( ) ; } }