refactor: restructure to monorepo with apps and packages directories - Move companion app to apps/companion with electron-vite - Move domain/application/infrastructure to packages/ - Fix ELECTRON_RUN_AS_NODE env var issue for VS Code terminal - Remove legacy esbuild bundler (replaced by electron-vite) - Update workspace scripts in root package.json

This commit is contained in:
2025-11-22 00:25:06 +01:00
parent d20554df55
commit 7eae6e3bd4
39 changed files with 515 additions and 1939 deletions

View File

@@ -0,0 +1,36 @@
import { AutomationSession } from '../../packages/domain/entities/AutomationSession';
import { SessionStateValue } from '../../packages/domain/value-objects/SessionState';
import { ISessionRepository } from '../../packages/application/ports/ISessionRepository';
export class InMemorySessionRepository implements ISessionRepository {
private sessions: Map<string, AutomationSession> = new Map();
async save(session: AutomationSession): Promise<void> {
this.sessions.set(session.id, session);
}
async findById(id: string): Promise<AutomationSession | null> {
return this.sessions.get(id) || null;
}
async update(session: AutomationSession): Promise<void> {
if (!this.sessions.has(session.id)) {
throw new Error('Session not found');
}
this.sessions.set(session.id, session);
}
async delete(id: string): Promise<void> {
this.sessions.delete(id);
}
async findAll(): Promise<AutomationSession[]> {
return Array.from(this.sessions.values());
}
async findByState(state: SessionStateValue): Promise<AutomationSession[]> {
return Array.from(this.sessions.values()).filter(
session => session.state.value === state
);
}
}