BaselineModel
Defined in: packages/core/src/models/baseline.ts:33
Data operations for baseline screenshots.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BaselineModel(
db,tables?,storage?,secret?,webhookTables?):BaselineModel
Defined in: packages/core/src/models/baseline.ts:40
Parameters
Section titled “Parameters”tables?
Section titled “tables?”BaselineTables
storage?
Section titled “storage?”secret?
Section titled “secret?”webhookTables?
Section titled “webhookTables?”WebhookTables
Returns
Section titled “Returns”BaselineModel
Methods
Section titled “Methods”backfillFingerprint()
Section titled “backfillFingerprint()”backfillFingerprint(
baseline,infraHash,fingerprint):Promise<void>
Defined in: packages/core/src/models/baseline.ts:107
Record the fingerprint of a baseline that predates fingerprints, without touching its screenshot. Lets the next environment change be detected instead of diffing as a regression.
Parameters
Section titled “Parameters”baseline
Section titled “baseline”infraHash
Section titled “infraHash”string
fingerprint
Section titled “fingerprint”string
Returns
Section titled “Returns”Promise<void>
getFor()
Section titled “getFor()”getFor(
projectId,storyId,viewport,branch,browser?):Promise<Baseline|null>
Defined in: packages/core/src/models/baseline.ts:54
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
storyId
Section titled “storyId”string
viewport
Section titled “viewport”string
branch
Section titled “branch”string
browser?
Section titled “browser?”string = DEFAULT_BROWSER
Returns
Section titled “Returns”Promise<Baseline | null>
hasAny()
Section titled “hasAny()”hasAny(
projectId,browser):Promise<boolean>
Defined in: packages/core/src/models/baseline.ts:92
Whether the project has any baseline captured on this engine.
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
browser
Section titled “browser”string
Returns
Section titled “Returns”Promise<boolean>
list()
Section titled “list()”list(
projectId):Promise<Baseline[]>
Defined in: packages/core/src/models/baseline.ts:238
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
Returns
Section titled “Returns”Promise<Baseline[]>
read()
Section titled “read()”read(
baseline):Promise<Buffer<ArrayBufferLike>>
Defined in: packages/core/src/models/baseline.ts:126
Parameters
Section titled “Parameters”baseline
Section titled “baseline”Returns
Section titled “Returns”Promise<Buffer<ArrayBufferLike>>
removeForBranch()
Section titled “removeForBranch()”removeForBranch(
projectId,branch):Promise<number>
Defined in: packages/core/src/models/baseline.ts:271
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
branch
Section titled “branch”string
Returns
Section titled “Returns”Promise<number>
removeOrphans()
Section titled “removeOrphans()”removeOrphans(
projectId,validStoryIds):Promise<number>
Defined in: packages/core/src/models/baseline.ts:259
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
validStoryIds
Section titled “validStoryIds”Set<string>
Returns
Section titled “Returns”Promise<number>
removeStaleBranches()
Section titled “removeStaleBranches()”removeStaleBranches(
projectId,staleBranches):Promise<number>
Defined in: packages/core/src/models/baseline.ts:284
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
staleBranches
Section titled “staleBranches”ReadonlySet<string>
Returns
Section titled “Returns”Promise<number>
resolve()
Section titled “resolve()”resolve(
projectId,storyId,viewport,branch,defaultBranch,browser?):Promise<Baseline|null>
Defined in: packages/core/src/models/baseline.ts:74
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
storyId
Section titled “storyId”string
viewport
Section titled “viewport”string
branch
Section titled “branch”string
defaultBranch
Section titled “defaultBranch”string
browser?
Section titled “browser?”string = DEFAULT_BROWSER
Returns
Section titled “Returns”Promise<Baseline | null>
upsert()
Section titled “upsert()”upsert(
projectId,storyId,viewport,branch,snapshotId,sourcePath,infraHash?,options?):Promise<Baseline>
Defined in: packages/core/src/models/baseline.ts:130
Parameters
Section titled “Parameters”projectId
Section titled “projectId”string
storyId
Section titled “storyId”string
viewport
Section titled “viewport”string
branch
Section titled “branch”string
snapshotId
Section titled “snapshotId”string
sourcePath
Section titled “sourcePath”string
infraHash?
Section titled “infraHash?”string | null
options?
Section titled “options?”BaselineUpsertOptions = {}
Returns
Section titled “Returns”Promise<Baseline>