import type { AppConfig } from "@vertigis/viewer-spec/app-config"; import type { ConfigUpgrader } from "./ConfigUpgrader"; /** * Information related to configuration upgrades for registered items. */ export interface UpgradeInfo { /** * A callback that returns the saved version of the library's state. */ getSavedVersion: (appConfig: AppConfig) => string; /** * A callback that returns the current version of the library. */ getCurrentVersion: () => string; /** * The upgrades to perform on item config. */ getUpgrades: () => Upgrade[] | Promise; /** * The app item type specific to the upgrade logic. If this property is * undefined, the upgrade will be run for all item types. */ itemType?: string; } /** * Properties related to the implementation(s) of an app item upgrade. */ export interface Upgrade { /** * A callback for upgrading item config before it is passed into a factory * for construction. */ upgrade: ConfigUpgrader; /** * The version the update logic is intended for. If the saved version of the * loaded app is lesser than this value, the upgrade callback will be * executed. */ version: string; }