Skip to content

SnapshotModel

Defined in: packages/core/src/models/snapshot.ts:17

Data operations for snapshot records.

new SnapshotModel(db, tables?): SnapshotModel

Defined in: packages/core/src/models/snapshot.ts:25

DatabaseAdapter

Database adapter.

SnapshotTables

Table handles.

SnapshotModel

create(projectId, buildId, input): Promise<Snapshot>

Defined in: packages/core/src/models/snapshot.ts:38

Create a snapshot for a story within a build.

string

Project ID.

string

Build ID.

SnapshotCreateInput

Snapshot creation input.

Promise<Snapshot>

The created snapshot.


durationsByStory(buildId): Promise<Map<string, number>>

Defined in: packages/core/src/models/snapshot.ts:109

Milliseconds each story cost on one build, summed over its viewports and engines. Stories the renderer did not time are left out, so an empty map means this build carries no timings.

string

Promise<Map<string, number>>


get(id): Promise<Snapshot | null>

Defined in: packages/core/src/models/snapshot.ts:141

Fetch a snapshot by id, or null if not found.

string

Promise<Snapshot | null>


listByBuild(buildId): Promise<Snapshot[]>

Defined in: packages/core/src/models/snapshot.ts:120

List all snapshots belonging to a build.

string

Promise<Snapshot[]>


listByImportPath(projectId, importPath): Promise<Snapshot[]>

Defined in: packages/core/src/models/snapshot.ts:130

Every snapshot of a story file across the project’s builds. Index paths are stored raw (./src/A.stories.tsx), so both spellings of importPath match.

string

string

Promise<Snapshot[]>


removeForBuild(buildId): Promise<number>

Defined in: packages/core/src/models/snapshot.ts:91

Delete every snapshot of a build: a new plan of it starts clean.

string

Promise<number>


removeRendered(buildId, work): Promise<number>

Defined in: packages/core/src/models/snapshot.ts:74

Delete the rendered snapshots a shard is about to write again: rows of (story, engine) pairs in work, so a rerun starts from a clean slate instead of colliding with rows an earlier, interrupted run left behind. Inherited rows are kept: the plan wrote them, for engines or viewports this shard does not render.

string

readonly object[]

Promise<number>


review(id, status, userId): Promise<Snapshot>

Defined in: packages/core/src/models/snapshot.ts:159

Record a reviewer’s decision on a snapshot.

string

"pending" | "approved" | "rejected" | "new" | "unchanged" | "changed"

string | null

Promise<Snapshot>


setStatus(id, status): Promise<Snapshot>

Defined in: packages/core/src/models/snapshot.ts:154

Set the status of a snapshot.

string

"pending" | "approved" | "rejected" | "new" | "unchanged" | "changed"

Promise<Snapshot>


update(id, patch): Promise<Snapshot>

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

Update mutable fields of a snapshot.

string

Partial<Snapshot>

Promise<Snapshot>