IF Commons GitHub

sql/operations/mod

Written to: 9 requirements: 9 proved, 0 partly, 0 failing, 0 with no test recorded. 0063-operating-model FR-008, 0063-operating-model FR-009, 0063-operating-model FR-010, 0063-operating-model FR-011, 0063-operating-model FR-012, 0063-operating-model FR-013 and 3 more

The operating model at work (commons data 0063-operating-model): the code that works on the tables of the operations model (models/operations). What the work waits on is listed with a status that is computed from its dates; a decision that replaces another says so and the other is marked; limits and expiries are found when the time to act has come; copies of data with no owner or no refresh are found; a release is promoted only through the environments in order, and the versions in each environment are compared; a signal is checked against the catalog before it is emitted; the freshness of a source is computed from its latest load; and the statements of a workload are replayed and compared with what they gave.

Source: commons/data/sql/operations/mod.ts

13 of 25 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Waitinterfaceno test imports it
interface Wait

One thing the work waits on, with the status its dates give it.

MemberTypeWhat it is
waitingIdstring
whatstring
onWhomstring
status"overdue" | "waiting"
daysWaitingnumber
waitingOnfunction
function waitingOn(on: Runner, asOf?: string | Date): Promise<readonly Wait[]>

What the work waits on, the oldest first: overdue where it was needed by a date that has passed.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

resolveWaitfunction
function resolveWait(on: Runner, waitingId: string, at?: string | Date): Promise<void>

Records that what was waited on has come.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

supersedefunction
function supersede(on: Runner, newId: string, oldId: string): Promise<void>

Records that a decision replaces another: the new one is accepted and says what it replaced, and the old one is marked superseded.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

decisionsInForcefunction
function decisionsInForce(on: Runner): Promise<readonly string[]>

The decisions in force: accepted and not replaced.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

DueLimitinterfaceno test imports it
interface DueLimit

A limit that needs someone to act.

MemberTypeWhat it is
limitIdstring
namestring
ownerstring
expiresAtstring
status"act-now" | "expired"
daysLeftnumber
limitsDuefunction
function limitsDue(on: Runner, asOf?: string | Date): Promise<readonly DueLimit[]>

Finds the limits whose time to act has come: expired, or within the days of notice that its owner needs; the soonest first.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

CopyFindinginterfaceno test imports it
interface CopyFinding

A copy that nobody answers for or that has not been refreshed.

MemberTypeWhat it is
dataCopyIdstring
datasetstring
locationstring
why"never refreshed" | "no owner" | "stale"
copyFindingsfunction
function copyFindings(on: Runner, maxAgeDays: number, asOf?: string | Date): Promise<readonly CopyFinding[]>

Finds the copies of data with no owner, never refreshed or not refreshed within the days given.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

PROMOTION_ORDERconstno test imports it
const PROMOTION_ORDER: readonly ["development", "test", "staging", "production"]

The order a release is promoted through.

Promoteinterfaceno test imports it
interface Promote

What a promotion was told.

MemberTypeWhat it is
promotionIdstring
releaseIdstring
environmentIdstring
bystring
evidenceRef?string
at?string | Date
promotefunction
function promote(on: Runner, p: Promote): Promise<Promoted>

Promotes a release to an environment and adds it to the log, unless an environment before it in the order (development, test, staging, production) has not had it, or it has no evidence for production: then it is refused and nothing is written.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Parityinterfaceno test imports it
interface Parity

What runs in each environment.

MemberTypeWhat it is
artifactstring
versionsReadonly<Record<string, string>>
behindreadonly string[]The environments that are not at the version of the last environment of the order that has one.
parityfunction
function parity(on: Runner, artifact: string): Promise<Parity>

The version of an artifact that each environment last received, and which environments are behind the furthest one.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

realDataOutsideProductionfunction
function realDataOutsideProduction(on: Runner): Promise<readonly string[]>

Environments that hold real data and are not production.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

SignalDefinterfaceno test imports it
interface SignalDef

A signal as the catalog defines it.

MemberTypeWhat it is
namestring
kindstring
unitstring
attributesreadonly string[]
catalogfunction
function catalog(on: Runner): Promise<ReadonlyMap<string, SignalDef>>

Reads the catalog of signals.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Sampleinterfaceno test imports it
interface Sample

One sample of a signal, ready to be handed to whatever sends telemetry.

MemberTypeWhat it is
namestring
kindstring
unitstring
valuenumber
attributesReadonly<Record<string, string>>
atstring
samplefunction
function sample(defs: ReadonlyMap<string, SignalDef>, name: string, value: number, attributes?: Readonly<Record<string, string>>, at?: string | Date): Sample

Makes a sample of a signal, and throws where the catalog does not allow it: a name it does not have, attributes that are not exactly the signal's, or a counter that goes down.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Freshnessinterfaceno test imports it
interface Freshness

How fresh one source is.

MemberTypeWhat it is
sourcestring
status"fresh" | "never-loaded" | "stale"
ageHoursnumber | null
maxAgeHoursnumber
ownerstring
freshnessfunction
function freshness(on: Runner, asOf?: string | Date): Promise<readonly Freshness[]>

Computes the freshness of each source from the latest of its loads that was not undone (the loads of the flow model): fresh, stale, or never loaded.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Replayedinterfaceno test imports it
interface Replayed

What replaying one statement found.

MemberTypeWhat it is
workloadStatementIdstring
rowsnumber
baselineRowsnumber
sameboolean
msnumber
replayWorkloadfunction
function replayWorkload(on: Runner, workloadId: string): Promise<readonly Replayed[]>

Replays the recorded statements of a workload against the database and compares the rows each gives with the number and hash recorded. Only a single select is run: a statement that is anything else, or has more than one statement, is refused and not run.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

workloadsfunctionno test imports it
function workloads(on: Runner): Promise<readonly RowOfProjection<{ id: Column<string>; name: Column<string>; owner: Column<string>; criticality: Column<number>; }>[]>

Registers a workload's workloadId lookup so that a caller can name what it replays.

Titles, headings, exports, tables, columns and requirements. Esc closes.