import { SavedObjectUnsanitizedDoc } from 'kibana/server' ; import { DashboardDoc730ToLatest } from '../../common' ; function isDoc ( doc ) { return ( typeof doc . id === 'string' && typeof doc . type === 'string' && doc . attributes !== null && typeof doc . attributes === 'object' && doc . references !== null && typeof doc . references === 'object' ) ; } export function isDashboardDoc ( doc ) { if ( ! isDoc ( doc ) ) { return false ; } if ( typeof ( doc as DashboardDoc730ToLatest ) . attributes . panelsJSON !== 'string' ) { return false ; } return true ; }