This commit is contained in:
2025-12-11 21:06:25 +01:00
parent c49ea2598d
commit ec3ddc3a5c
227 changed files with 3496 additions and 2083 deletions

View File

@@ -24,12 +24,23 @@ export function useEffectiveDriverId(): string {
try {
// Lazy-load to avoid importing DI facade at module evaluation time
const { getDriverRepository } = require('./di-container') as typeof import('./di-container');
const { getDriverRepository } =
require('./di-container') as typeof import('./di-container');
const repo = getDriverRepository();
// In-memory repository is synchronous for findAll in the demo implementation
const allDrivers = repo.findAllSync?.() as Array<{ id: string }> | undefined;
if (allDrivers && allDrivers.length > 0) {
return allDrivers[0].id;
interface DriverRepositoryWithSyncFindAll {
findAllSync?: () => Array<{ id: string }>;
}
// In alpha/demo mode the in-memory repository exposes a synchronous finder;
// access it via a safe dynamic lookup to keep typing compatible with the port.
const repoWithSync = repo as DriverRepositoryWithSyncFindAll;
const allDrivers = repoWithSync.findAllSync?.();
if (Array.isArray(allDrivers) && allDrivers.length > 0) {
const firstDriver = allDrivers[0];
if (firstDriver) {
return firstDriver.id;
}
}
} catch {
// Ignore and fall back to legacy default below