What Happens Offline
| Action | Offline behavior |
|---|---|
listDocuments | Returns cached records immediately |
listCases | Returns cached cases immediately |
addDocument | Saves record + blob as upload_failure — retried on reconnect |
editDocument | Patches DB (isEdited: true) — synced on reconnect |
deleteDocument | Soft-deletes (isArchived: true) — hard-deleted on reconnect |
createCase | Saves locally (isRemoteCreated: false) — created on reconnect |
Sync
Clear cache on logout
Reactive UI Updates
Subscribe to DB change events — the UI auto-updates on any write (upload, edit, delete, sync).| Event | Fired after |
|---|---|
documents:changed | Any record write (upload, edit, delete, sync) |
cases:changed | Any case write |
Pending sync count
Logging
The SDK emits a structured event for every CRUD operation (create / read / update / delete) on records and cases, routed through youronLog callback. Events are analytics-ready — forward them straight to Mixpanel, Sentry, Datadog, etc. If onLog is not configured, logging is a no-op.
SDKLog shape:
{Records|Cases}_TS_SDK_{CREATE|READ|UPDATE|DELETE}. Each operation typically fires two events — one with platform: 'database' (local write) and one with platform: 'network' (server sync) — each with its own success / failure status.
Electron Setup
IndexedDB works natively in the Electron renderer process. Only the transport differs:bridge routes Eka API calls through window.networkApi (IPC → main → net.fetch).
S3 uploads always use fetch() directly — the IPC bridge cannot carry binary data.
