import { IModel , maybePush , getProp , _unprotectAndRemoveGroup } from "@esri/hub-common" ; import { IUserRequestOptions } from "@esri/arcgis-rest-auth" ; param { Object } siteModel param { IRequestOptions } requestOptions private export function _removeSiteGroups ( siteModel , requestOptions ) { const teamsToDelete = [ "collaborationGroupId" , "contentGroupId" , "followersGroupId" ] . reduce ( ( acc , prop ) => { return maybePush ( getProp ( siteModel , `item.properties.${ prop }` ) , acc ) ; } , [ ] ) ; const promises = teamsToDelete . map ( id => { const opts = Object . assign ( { id } , requestOptions ) ; return _unprotectAndRemoveGroup ( opts ) ; } ) ; return Promise . all ( promises ) ; }