import { IRequestOptions } from "@esri/arcgis-rest-request" ; import { getItem , getItemData } from "@esri/arcgis-rest-portal" ; import { IInitiativeModel , IInitiativeItem , getPortalApiUrl } from "@esri/hub-common" ; import { migrateSchema } from "./migrator" ; import { convertIndicatorsToDefinitions } from "./migrations/upgrade-two-dot-zero" ; export { convertIndicatorsToDefinitions } ; param id param requestOptions returns export export function getInitiative ( id , requestOptions ? ) { return Promise . all ( [ getItem ( id , requestOptions ) , getItemData ( id , requestOptions ) ] ) . then ( result => { return { item : result [ 0 ] as IInitiativeItem , data : result [ 1 ] } ; } ) . then ( model => { return migrateSchema ( model , getPortalApiUrl ( requestOptions ) ) ; } ) ; }