mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 06:23:08 +02:00
Add migrate for base environment to sync logic
This commit is contained in:
@@ -66,7 +66,22 @@ export function migrateImport(contents: string) {
|
||||
}
|
||||
}
|
||||
|
||||
return { resources: parsed.resources }; // Should already be in the correct format
|
||||
// Migrate v4 to v5
|
||||
for (const environment of parsed.resources.environments ?? []) {
|
||||
if ('base' in environment && environment.base) {
|
||||
environment.parentId = environment.workspaceId;
|
||||
environment.parentType = 'workspace';
|
||||
delete environment.environmentId;
|
||||
} else if ('base' in environment && !environment.base) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const baseEnvironment = parsed.resources.environments.find((e: any) => e.base);
|
||||
environment.parentId = baseEnvironment?.id ?? null;
|
||||
environment.parentType = 'environment';
|
||||
delete environment.environmentId;
|
||||
}
|
||||
}
|
||||
|
||||
return { resources: parsed.resources };
|
||||
}
|
||||
|
||||
function isJSObject(obj: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user