import { IEmbeddable } from '../../../../../../src/plugins/embeddable/public' ; const isOutputWithIndexPatterns = ( output ) : output is { indexPatterns : Array < { id : string ; } > ; } => { if ( ! output || typeof output !== 'object' ) return false ; return Array . isArray ( ( output as any ) . indexPatterns ) ; } ; export const getIndexPatterns = ( embeddable ? ) : string [ ] => { if ( ! embeddable ) return [ ] ; const output = embeddable . getOutput ( ) ; return isOutputWithIndexPatterns ( output ) ? output . indexPatterns . map ( ( { id } ) => id ) : [ ] ; } ; export const hasExactlyOneIndexPattern = ( embeddable ? ) : boolean => getIndexPatterns ( embeddable ) . length === 1 ;