import { ResolveIndexResponseFromES } from './types' ; param indexName param resolvedResponse export const getIndexState = ( indexName , resolvedResponse ) : 'open' | 'closed' => { const index = resolvedResponse . indices . find ( ( i ) => i . name === indexName ) ; if ( index ) { return index . attributes . includes ( 'closed' ) ? 'closed' : 'open' ; } throw new Error ( `${ indexName } not found!` ) ; } ;