(
db: Database,
opts?: { limit?: number; includeTransient?: boolean },
)
| 583 | } |
| 584 | |
| 585 | export function listDiagnosticEvents( |
| 586 | db: Database, |
| 587 | opts?: { limit?: number; includeTransient?: boolean }, |
| 588 | ): DiagnosticEventRow[] { |
| 589 | const limit = opts?.limit ?? 100; |
| 590 | const includeTransient = opts?.includeTransient ?? false; |
| 591 | return readStore(db) |
| 592 | .diagnosticEvents.filter((event) => includeTransient || !event.transient) |
| 593 | .sort((a, b) => b.ts - a.ts || b.id - a.id) |
| 594 | .slice(0, limit) |
| 595 | .map(rowToDiagnosticEvent); |
| 596 | } |
| 597 | |
| 598 | export function pruneDiagnosticEvents(db: Database, maxRows: number): number { |
| 599 | return mutateStore(db, (data) => { |
no test coverage detected