No JSDoc comment in source yet.
API
@Component()
export class ErrorsRepo implements ErrorLog {
@Use() private readonly db!: Db;
insert(r: ErrorRecordInsert): void;
summary(projectId: string, f: ErrorFilter = {}): ErrorSummary;
topCode(projectId: string, f: ErrorFilter = {}): ErrorCodeCount | null;
recent(projectId: string, f: ErrorFilter = {}, limit = 20, offset = 0, utcOffsetMinutes?: number): ErrorItem[];
rowCount(projectId: string, f: ErrorFilter = {}, utcOffsetMinutes?: number): number;
deleteFiltered(projectId: string, f: ErrorFilter = {}): number;
deleteByAgent(projectId: string, agentId: string): void;
deleteByProject(projectId: string): void;
}Dependencies & Wiring
Extracted from class decoratorsMethods (8)
insert
insert(r: ErrorRecordInsert): voidErrorRecordInsertvoidsummary
summary(projectId: string, f: ErrorFilter = {}): ErrorSummaryTotal count + how many are unexpected.
stringErrorFilterErrorSummarytopCode
topCode(projectId: string, f: ErrorFilter = {}): ErrorCodeCount | nullThe most frequent source · code (ties broken by code's lexicographic order); null if there are no errors.
stringErrorFilterErrorCodeCount | nullrecent
recent(projectId: string, f: ErrorFilter = {}, limit = 20, offset = 0, utcOffsetMinutes?: number): ErrorItem[]One page of the table, newest first: the records of one calendar day that share a source, code, kind and message fold into a single row, with how many there were and the first and last time among them.
A failure that comes back all day — a connection that drops and recovers every few
minutes, a send that fails whenever it is asked — reads as one line saying how often,
rather than a page of the same line; summary and topCode still count records, which is
what measures how often. The day is utcOffsetMinutes's (see dayOf), so the boundary falls
at the viewer's midnight. Rows are ordered by their newest record, and a page is limit
rows, not records.
stringErrorFilterunknownunknownnumberErrorItem[]rowCount
rowCount(projectId: string, f: ErrorFilter = {}, utcOffsetMinutes?: number): numberHow many rows recent pages through for the same filter and day — what a pager counts.
stringErrorFilternumbernumberdeleteFiltered
deleteFiltered(projectId: string, f: ErrorFilter = {}): numberDeletes the rows a matching read would have returned, and answers how many went.
The WHERE comes from the same conds the SELECTs use, includeGlobal included, so the
delete reaches exactly the rows the caller's own reads reach and never one more: narrowing
a filter narrows both halves together, and there is no second expression to drift. The
caller passes the includeGlobal it reads with — an admin's clear takes the unattributed
rows an admin's panel shows, and a member's clear, like a member's read, never sees them.
Unattributed rows sit in every Project's admin view, so clearing them from one Project's
panel clears them from every other's too: that is the one person who can see them anywhere
emptying instance-wide noise, not one tenant reaching into another. deleteByProject and
deleteByAgent keep leaving them alone — a cascade is not a person deciding to clear.
stringErrorFilternumberdeleteByAgent
deleteByAgent(projectId: string, agentId: string): voidCascading cleanup on Agent deletion (unattributed errors carry no agent_id and are unaffected).
stringstringvoiddeleteByProject
deleteByProject(projectId: string): voidCascading cleanup on Project deletion (unattributed errors belong to no Project and are unaffected).
stringvoid