// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { getActorUpdateDataGetter, getCompendiumMigrator, getSceneUpdateDataGetter, migrateActors, migrateCompendiums, migrateItems, migrateScenes, } from "./migrationHelpers"; async function migrate(): Promise { await migrateItems(getItemUpdateData); await migrateActors(getActorUpdateData); await migrateScenes(getSceneUpdateData); await migrateCompendiums(migrateCompendium); } function getItemUpdateData( itemData: Partial, ): DeepPartial | undefined { if (!["equipment", "trinket"].includes(itemData.type ?? "")) return undefined; return { type: itemData.type === "equipment" ? ("loot" as const) : ("equipment" as const) }; } const getActorUpdateData = getActorUpdateDataGetter(getItemUpdateData); const getSceneUpdateData = getSceneUpdateDataGetter(getActorUpdateData); const migrateCompendium = getCompendiumMigrator( { getItemUpdateData, getActorUpdateData, getSceneUpdateData }, { migrateToTemplateEarly: false }, ); export const migration = { migrate, migrateCompendium, };