Skip to content

InsightModel

Defined in: packages/core/src/models/insight.ts:43

Data operations for insights.

new InsightModel(db, tables?): InsightModel

Defined in: packages/core/src/models/insight.ts:47

DatabaseAdapter

InsightTables

InsightModel

get(id): Promise<InsightRow | null>

Defined in: packages/core/src/models/insight.ts:84

string

Promise<InsightRow | null>


getHealth(projectId, windowKey): Promise<InsightRow | null>

Defined in: packages/core/src/models/insight.ts:98

The health row for a project window, if any.

string

string

Promise<InsightRow | null>


listForBuild(buildId, limit?): Promise<InsightRow[]>

Defined in: packages/core/src/models/insight.ts:89

Newest triage rows for a build (any status), newest first.

string

number = 20

Promise<InsightRow[]>


markDone(id, result): Promise<void>

Defined in: packages/core/src/models/insight.ts:117

string

InsightResultInput

Promise<void>


markFailed(id, errorCode): Promise<void>

Defined in: packages/core/src/models/insight.ts:126

string

string

Promise<void>


markRunning(id): Promise<void>

Defined in: packages/core/src/models/insight.ts:110

string

Promise<void>


peek(input): Promise<InsightRow | null>

Defined in: packages/core/src/models/insight.ts:80

The existing row for a run’s unique key, without creating one.

InsightStartInput

Promise<InsightRow | null>


purgeHealthBefore(cutoffIso): Promise<number>

Defined in: packages/core/src/models/insight.ts:140

Remove health rows created before cutoffIso.

string

Promise<number>


removeForBuild(buildId): Promise<number>

Defined in: packages/core/src/models/insight.ts:135

Explicitly remove all rows of a build (no reliance on FK cascade).

string

Promise<number>


start(input): Promise<InsightStartResult>

Defined in: packages/core/src/models/insight.ts:57

Insert a pending row, or return the existing one for the same unique key (the dedupe: concurrent identical requests share one row). Failed rows, replaced health rows, and force restart the existing row in place.

InsightStartInput

Promise<InsightStartResult>


sweepStale(cutoffIso): Promise<number>

Defined in: packages/core/src/models/insight.ts:146

Mark pending/running rows older than cutoffIso as interrupted.

string

Promise<number>