// SPDX-FileCopyrightText: 2021 Johannes Loher // // SPDX-License-Identifier: MIT import { getCompendiumMigrator, getSceneUpdateDataGetter, migrateActors, migrateCompendiums, migrateScenes, } from "./migrationHelpers"; /** @type {import("./migration").Migration["migrate"]} */ async function migrate() { await migrateActors(getActorUpdateData); await migrateScenes(getSceneUpdateData); await migrateCompendiums(migrateCompendium); } /** @type {import("./migrationHelpers").ActorUpdateDataGetter} */ function getActorUpdateData() { const updateData = { system: { combatValues: [ "hitPoints", "defense", "initiative", "movement", "meleeAttack", "rangedAttack", "spellcasting", "targetedSpellcasting", ].reduce((acc, curr) => { acc[curr] = { "-=base": null }; return acc; }, {}), }, }; return updateData; } const getSceneUpdateData = getSceneUpdateDataGetter(getActorUpdateData); const migrateCompendium = getCompendiumMigrator({ getActorUpdateData, getSceneUpdateData }); /** @type {import("./migration").Migration} */ export const migration = { migrate, migrateCompendium, };