Update database schema and synchronization logic

- Add `useEffect` in `ScribeLeftBar` for handling book state changes.
- Extend `BooksSyncContext` with new properties and stricter typings.
- Refine `Repositories` to include `lastUpdate` handling for synchronization processes.
- Add comprehensive `fetchComplete*` repository methods for retrieving entity-specific sync data.
- Enhance offline logic for chapters, characters, locations, and world synchronization.
- Improve error handling across IPC handlers and repositories.
This commit is contained in:
natreex
2025-12-15 20:55:24 -05:00
parent bb331b5c22
commit 64c7cb6243
23 changed files with 1609 additions and 79 deletions

14
lib/errors.ts Normal file
View File

@@ -0,0 +1,14 @@
/**
* Clean error messages from Electron IPC prefix
* Transforms: "Error invoking remote method 'channel': Error: Message"
* Into: "Message"
*/
export function cleanErrorMessage(error: unknown): string {
if (error instanceof Error) {
return error.message.replace(/^Error invoking remote method '[^']+': Error: /, '');
}
if (typeof error === 'string') {
return error.replace(/^Error invoking remote method '[^']+': Error: /, '');
}
return 'An unknown error occurred';
}