import { deepSet , getProp , IDraft } from "@esri/hub-common" ; import { SITE_SCHEMA_VERSION , _ensureTelemetry } from "@esri/hub-common" ; const schemaVersionPath = "item.properties.schemaVersion" ; const initialDraftVersion = 1.3 ; param draft export function upgradeDraftSchema ( draft ) { if ( getProp ( draft , "item.properties.schemaVersion" ) === undefined ) { deepSet ( draft , schemaVersionPath , initialDraftVersion ) ; } if ( getProp ( draft , "item.properties.schemaVersion" ) === SITE_SCHEMA_VERSION ) { return draft ; } else { let migrated = draft ; migrated = _ensureTelemetry < IDraft > ( draft ) ; return migrated ; } }