import { List , Reminder } from './models' ; import { execJXA , JXA_SCRIPTS , withParsedDates } from './utils' ; export function getLists ( ) { return execJXA ( JXA_SCRIPTS . getLists ) ; } export function getList ( id ) { return execJXA ( JXA_SCRIPTS . getList , { id } ) ; } export async function createList ( data ) { await execJXA ( JXA_SCRIPTS . createList , { data } ) ; const lists = await getLists ( ) ; return lists [ lists . length - 1 ] . id ; } export async function getReminders ( listId , props ? ) { const reminders = await execJXA < readonly Reminder [ ] > ( JXA_SCRIPTS . getReminders , { id : listId , props , } ) ; return reminders . map ( withParsedDates ) ; } export async function getReminder ( reminderId , props ? ) { const reminder = await execJXA < Reminder > ( JXA_SCRIPTS . getReminder , { id : reminderId , props } ) ; return withParsedDates ( reminder ) ; } export function updateReminder ( id , data ) { return execJXA ( JXA_SCRIPTS . updateReminder , { id , data } ) ; } export function deleteReminder ( id ) { return execJXA ( JXA_SCRIPTS . deleteReminder , { id } ) ; } export function createReminder ( listId , data ) { return execJXA ( JXA_SCRIPTS . createReminder , { listId , data } ) ; }