2021-06-26 22:02:00 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-07-08 02:32:25 +02:00
|
|
|
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() {
|
2021-07-08 02:32:25 +02: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) {
|
2021-07-08 02:32:25 +02:00
|
|
|
if (!["loot"].includes(itemData.type ?? "")) return undefined;
|
|
|
|
return {
|
2022-11-21 03:00:46 +01:00
|
|
|
system: {
|
2021-07-08 07:10:34 +02:00
|
|
|
"-=equipped": null,
|
|
|
|
},
|
2021-07-08 02:32:25 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const getActorUpdateData = getActorUpdateDataGetter(getItemUpdateData);
|
|
|
|
const getSceneUpdateData = getSceneUpdateDataGetter(getActorUpdateData);
|
|
|
|
const migrateCompendium = getCompendiumMigrator(
|
|
|
|
{ getItemUpdateData, getActorUpdateData },
|
|
|
|
{ migrateToTemplateEarly: false },
|
|
|
|
);
|
2022-02-14 00:58:23 +01:00
|
|
|
|
2022-11-17 00:12:29 +01:00
|
|
|
/** @type {import("./migration").Migration} */
|
2022-02-14 00:58:23 +01:00
|
|
|
export const migration = {
|
|
|
|
migrate,
|
|
|
|
migrateCompendium,
|
|
|
|
};
|