feat: persistence selected mode

This commit is contained in:
Xiaohan-Tian
2025-12-10 21:54:16 -08:00
parent fa201d11c5
commit dcd2d89d0f
6 changed files with 87 additions and 14 deletions
@@ -1,5 +1,6 @@
import { KGProject } from '../KGProject';
import { upgradeToV1 } from './upgradeToV1';
import { upgradeToV2 } from './upgradeToV2';
/**
* Upgrade the given project to the latest structure version, one version at a time.
@@ -23,6 +24,10 @@ export function upgradeProjectToLatest(project: KGProject): KGProject {
workingProject = upgradeToV1(workingProject);
break;
}
case 2: {
workingProject = upgradeToV2(workingProject);
break;
}
default: {
// If an upgrader is missing, throw to prevent loading incompatible structures
throw new Error(`No upgrader found for project structure version ${nextVersion}`);