import { forEach , find , get , remove } from "lodash" ; type LibraryFix = ( libraryName : string , content : unknown ) => void ; const libraryFixes = [ addViewDefaultAggregation , fixSelfImplementingClass , ] ; export function fixLibrary ( libraryName , fileContent ) { forEach ( libraryFixes , ( fix ) => { fix ( libraryName , fileContent ) ; } ) ; } export function addViewDefaultAggregation ( libraryName , content ) { const symbol = find ( get ( content , "symbols" ) , ( symbol ) => symbol . name === "sap.ui.core.mvc.View" ) ; if ( symbol !== undefined ) { const metadata = get ( symbol , "ui5-metadata" ) ; if ( metadata !== undefined ) { metadata . defaultAggregation = "content" ; } } } export function fixSelfImplementingClass ( libraryName , content ) { forEach ( get ( content , "symbols" ) , ( symbol ) => { if ( get ( symbol , "kind" ) === "class" ) { const symbolName = get ( symbol , "name" ) ; remove ( symbol . implements , ( name ) => name === symbolName ) ; } } ) ; }