import { TraitLabel } from '../Identifiers' ; import { assert } from '../Common' ; import { OrderedEditSet } from '../EditLog' ; import { Snapshot } from '../Snapshot' ; import { initialTree } from '../InitialTree' ; import { SharedTreeSummary_0_0_2 } from '../SummaryBackCompatibility' ; import { formatVersion , newEdit } from '../generic' ; import { Change } from './PersistedTypes' ; import { setTrait } from './EditUtilities' ; public export function noHistorySummarizer ( _editLog , currentView ) { const currentTree = currentView . getChangeNodeTree ( ) ; const rootId = currentTree . identifier ; const changes = [ ] ; Object . entries ( currentTree . traits ) . forEach ( ( [ label , children ] ) => { changes . push ( ... setTrait ( { parent : rootId , label : label as TraitLabel } , children ) ) ; } ) ; assert ( currentTree . payload === undefined , 'setValue not yet supported.' ) ; assert ( currentTree . identifier === initialTree . identifier && currentTree . definition === initialTree . definition , 'root definition and identifier should be immutable.' ) ; const edit = newEdit ( changes ) ; return { currentTree , sequencedEdits : [ { id : edit . id , changes : edit . changes } ] , version : formatVersion } ; }