Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

644 B
Raw Blame
import { LocalCalendarRepository } from './local/calendarRepository';
import type { CalendarRepository } from './calendarTypes';

let defaultCalendarRepository: CalendarRepository | null = null;

export function getCalendarRepository(): CalendarRepository {
  defaultCalendarRepository ??= new LocalCalendarRepository();
  return defaultCalendarRepository;
}

export const calendarRepository: CalendarRepository = new Proxy({} as CalendarRepository, {
  get(_target, property) {
    const repo = getCalendarRepository();
    const value = Reflect.get(repo, property);
    return typeof value === 'function' ? value.bind(repo) : value;
  },
});