import { filter , first } from 'rxjs/operators' ; import { errors } from '@elastic/elasticsearch' ; import { Observable } from 'rxjs' ; import { NodesVersionCompatibility } from './version_check/ensure_es_version' ; param esNodesCompatibility$ remarks export async function isValidConnection ( esNodesCompatibility$ ) { return await esNodesCompatibility$ . pipe ( filter ( ( { nodesInfoRequestError , isCompatible } ) => { if ( nodesInfoRequestError && nodesInfoRequestError instanceof errors . ProductNotSupportedError ) { throw nodesInfoRequestError ; } return isCompatible ; } ) , first ( ) ) . toPromise ( ) ; }