import type { SavedObjectMigrationFn } from 'kibana/server' ; import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../data/common' ; export const replaceIndexPatternReference = ( doc ) => ( { ... doc , references : Array . isArray ( doc . references ) ? doc . references . map ( ( reference ) => { if ( reference . type === 'index_pattern' ) { reference . type = INDEX_PATTERN_SAVED_OBJECT_TYPE ; } return reference ; } ) : doc . references , } ) ;