feat: migrate legacy flat-named Files into real hierarchy on load #379

This commit is contained in:
Linus Rath
2026-06-03 21:20:25 +02:00
parent 568abb0e33
commit d564c874a3
7 changed files with 253 additions and 4 deletions
+12
View File
@@ -936,6 +936,18 @@ export class DemoJMAPClient implements IJMAPClient {
if (node) Object.assign(node, updates, { updated: new Date().toISOString() });
}
async updateFileNodes(updates: Record<string, Partial<Pick<FileNode, 'name' | 'parentId'>>>): Promise<{ updated: string[]; notUpdated: Record<string, string> }> {
const updated: string[] = [];
for (const [id, patch] of Object.entries(updates)) {
const node = this.data.fileNodes.find(n => n.id === id);
if (node) {
Object.assign(node, patch, { updated: new Date().toISOString() });
updated.push(id);
}
}
return { updated, notUpdated: {} };
}
async destroyFileNodes(ids: string[]): Promise<{ destroyed: string[]; notDestroyed: string[] }> {
const idSet = new Set(ids);
this.data.fileNodes = this.data.fileNodes.filter(n => !idSet.has(n.id));