( database: IDatabase, table: string, id: string, )
| 287 | } |
| 288 | |
| 289 | export async function nextUpdatedAt( |
| 290 | database: IDatabase, |
| 291 | table: string, |
| 292 | id: string, |
| 293 | ): Promise<number> { |
| 294 | const now = Date.now(); |
| 295 | |
| 296 | try { |
| 297 | const rows = await database.select<{ updated_at: number | null }>( |
| 298 | `SELECT updated_at FROM ${table} WHERE id = ?`, |
| 299 | [id], |
| 300 | ); |
| 301 | const current = rows[0]?.updated_at ?? 0; |
| 302 | return Math.max(now, current + 1); |
| 303 | } catch { |
| 304 | return now; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /** Insert a tombstone record for sync deletion tracking */ |
| 309 | export async function insertTombstone( |
no outgoing calls
no test coverage detected