2022-11-09 03:02:27 +01:00
|
|
|
// SPDX-FileCopyrightText: 2022 Johannes Loher
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
import {
|
|
|
|
getActorUpdateDataGetter,
|
|
|
|
getCompendiumMigrator,
|
|
|
|
getSceneUpdateDataGetter,
|
|
|
|
migrateActors,
|
|
|
|
migrateCompendiums,
|
|
|
|
migrateItems,
|
|
|
|
migrateScenes,
|
|
|
|
} from "./migrationHelpers";
|
|
|
|
|
2022-11-17 00:12:29 +01:00
|
|
|
/** @type {import("./migration").Migration["migrate"]} */
|
|
|
|
async function migrate() {
|
2022-11-09 03:02:27 +01:00
|
|
|
await migrateItems(getItemUpdateData);
|
|
|
|
await migrateActors(getActorUpdateData);
|
|
|
|
await migrateScenes(getSceneUpdateData);
|
|
|
|
await migrateCompendiums(migrateCompendium);
|
|
|
|
}
|
|
|
|
|
2022-11-17 00:12:29 +01:00
|
|
|
/** @type {import("./migrationHelpers").ItemUpdateDataGetter} */
|
|
|
|
function getItemUpdateData(itemData) {
|
2022-11-09 03:02:27 +01:00
|
|
|
if (itemData.type !== "spell") return;
|
|
|
|
|
|
|
|
return {
|
2022-11-21 03:00:46 +01:00
|
|
|
system: {
|
2022-11-09 03:02:27 +01:00
|
|
|
allowsDefense: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const getActorUpdateData = getActorUpdateDataGetter(getItemUpdateData);
|
|
|
|
const getSceneUpdateData = getSceneUpdateDataGetter(getActorUpdateData);
|
|
|
|
const migrateCompendium = getCompendiumMigrator({ getItemUpdateData, getActorUpdateData, getSceneUpdateData });
|
|
|
|
|
2022-11-17 00:12:29 +01:00
|
|
|
/** @type {import("./migration").Migration} */
|
2022-11-09 03:02:27 +01:00
|
|
|
export const migration = {
|
|
|
|
migrate,
|
|
|
|
migrateCompendium,
|
|
|
|
};
|