import { flow } from 'lodash' ; import { EmbeddableRegistryDefinition } from 'src/plugins/embeddable/server' ; import type { SerializableRecord } from '@kbn/utility-types' ; import { commonAddSupportOfDualIndexSelectionModeInTSVB , commonHideTSVBLastValueIndicator , commonRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel , commonMigrateVislibPie , commonAddEmptyValueColorRule , commonMigrateTagCloud , commonAddDropLastBucketIntoTSVBModel , commonAddDropLastBucketIntoTSVBModel714Above , commonRemoveMarkdownLessFromTSVB , } from '../migrations/visualization_common_migrations' ; const byValueAddSupportOfDualIndexSelectionModeInTSVB = ( state ) => { return { ... state , savedVis : commonAddSupportOfDualIndexSelectionModeInTSVB ( state . savedVis ) , } ; } ; const byValueHideTSVBLastValueIndicator = ( state ) => { return { ... state , savedVis : commonHideTSVBLastValueIndicator ( state . savedVis ) , } ; } ; const byValueAddDropLastBucketIntoTSVBModel = ( state ) => { return { ... state , savedVis : commonAddDropLastBucketIntoTSVBModel ( state . savedVis ) , } ; } ; const byValueAddDropLastBucketIntoTSVBModel714Above = ( state ) => { return { ... state , savedVis : commonAddDropLastBucketIntoTSVBModel714Above ( state . savedVis ) , } ; } ; const byValueRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel = ( state ) => { return { ... state , savedVis : commonRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel ( state . savedVis ) , } ; } ; const byValueAddEmptyValueColorRule = ( state ) => { return { ... state , savedVis : commonAddEmptyValueColorRule ( state . savedVis ) , } ; } ; const byValueMigrateVislibPie = ( state ) => { return { ... state , savedVis : commonMigrateVislibPie ( state . savedVis ) , } ; } ; const byValueMigrateTagcloud = ( state ) => { return { ... state , savedVis : commonMigrateTagCloud ( state . savedVis ) , } ; } ; const byValueRemoveMarkdownLessFromTSVB = ( state ) => { return { ... state , savedVis : commonRemoveMarkdownLessFromTSVB ( state . savedVis ) , } ; } ; export const visualizeEmbeddableFactory = ( ) : EmbeddableRegistryDefinition => { return { id : 'visualization' , migrations : { '7.13.1' : ( state ) => flow ( byValueAddSupportOfDualIndexSelectionModeInTSVB , byValueHideTSVBLastValueIndicator , byValueRemoveDefaultIndexPatternAndTimeFieldFromTSVBModel ) ( state ) , '7.14.0' : ( state ) => flow ( byValueAddEmptyValueColorRule , byValueMigrateVislibPie , byValueMigrateTagcloud , byValueAddDropLastBucketIntoTSVBModel ) ( state ) , '7.17.0' : ( state ) => flow ( byValueAddDropLastBucketIntoTSVBModel714Above ) ( state ) , '8.0.0' : ( state ) => flow ( byValueRemoveMarkdownLessFromTSVB ) ( state ) , } , } ; } ;