import type { LibraryData } from '#lib/library/types'; import { libraryDatabase } from './database'; import { storedImageIds } from './images'; import { exportMedia, listMedia } from './media'; import { exportBooks, listBooks } from './books'; import { exportGames, listGames } from './games'; import type { ExportedEntry } from './input'; export async function getLibrary(): Promise { const database = await libraryDatabase(); const imageIds = storedImageIds(database); return { ...listMedia(database, imageIds), books: listBooks(database, imageIds), games: listGames(database, imageIds) }; } export interface LibraryExport { media: ExportedEntry[]; books: ExportedEntry[]; games: ExportedEntry[]; } export async function exportLibrary(): Promise { const database = await libraryDatabase(); return { media: exportMedia(database), books: exportBooks(database), games: exportGames(database) }; }