import { SavedObjectsClientContract } from '../../saved_objects/types' ; import { isConfigVersionUpgradeable } from './is_config_version_upgradeable' ; param { Object } options property property return { Promise < SavedConfig | undefined > } export async function getUpgradeableConfig ( { savedObjectsClient , version , } ) { const { saved_objects : savedConfigs } = await savedObjectsClient . find ( { type : 'config' , page : 1 , perPage : 1000 , sortField : 'buildNum' , sortOrder : 'desc' , } ) ; return savedConfigs . find ( ( savedConfig ) => isConfigVersionUpgradeable ( savedConfig . id , version ) ) ; }