feat: add safe session bulk cleanup actions

This commit is contained in:
Federico Jaramillo Martinez
2026-06-08 17:20:00 +02:00
parent b2a79750a3
commit a3b5b722c9
15 changed files with 474 additions and 46 deletions
@@ -88,6 +88,18 @@ export class SessionArchiveStore {
});
}
async deleteArchived(sessionId: string): Promise<void> {
await this.exclusive(async () => {
const data = await this.read();
const record = data.sessions.find((session) => session.sessionId === sessionId);
if (record === undefined) return;
if (record.archivePath !== undefined && await pathExists(record.archivePath)) await unlink(record.archivePath);
const sessions = data.sessions.filter((session) => session.sessionId !== sessionId);
await this.write({ sessions });
});
}
async isArchived(sessionId: string): Promise<boolean> {
return (await this.get(sessionId)) !== undefined;
}