import { contextBridge, ipcRenderer } from "electron"; import { CH, type Envelope, type NoteMeta, type NoteRead, type PickedFile, } from "../shared/ipc"; const api = { listNotes: (): Promise> => ipcRenderer.invoke(CH.notesList) as Promise>, readNote: (id: string): Promise> => ipcRenderer.invoke(CH.notesRead, { id }) as Promise>, writeNote: (id: string, content: string): Promise> => ipcRenderer.invoke(CH.notesWrite, { id, content }) as Promise< Envelope >, removeNote: (id: string): Promise> => ipcRenderer.invoke(CH.notesRemove, { id }) as Promise>, resetNotes: (): Promise> => ipcRenderer.invoke(CH.notesReset) as Promise>, openUrl: (url: string): Promise> => ipcRenderer.invoke(CH.shellOpen, { url }) as Promise< Envelope<{ url: string; dryRun: boolean }> >, pickFile: (): Promise> => ipcRenderer.invoke(CH.dialogPick) as Promise>, }; contextBridge.exposeInMainWorld("api", api); export type Api = typeof api;