TraceRecordstypetype TraceRecords = { readonly findings: readonly Keyed[]; readonly baseline: readonly string[]; readonly specs: readonly Spec[] };What a question is about: the findings of a check, the keys of its baseline and the specifications.
Questions of the trace in SQL (commons mizan 0002-mizan-query): the findings of the trace check judged against a baseline, the baseline's keys and the specifications with their requirements, made into relations, and a read-only SQL answered over them with the SQL language library (its guard judges that the text is one read and binds it to the catalog, its engine answers). Pure: it is given the findings, the baseline and the specifications it reads.
import { queryTrace } from "@intellectual-frontiers/mizan/query";
// queryTrace(input, "SELECT rule, count(*) AS n FROM findings WHERE status = 'fresh' GROUP BY rule ORDER BY n DESC");TraceRecordstypetype TraceRecords = { readonly findings: readonly Keyed[]; readonly baseline: readonly string[]; readonly specs: readonly Spec[] };What a question is about: the findings of a check, the keys of its baseline and the specifications.
QueryOptionstypeno test imports ittype QueryOptions = { readonly limit?: number; readonly params?: readonly Value[] };What may be given to a question.
Answertypeno test imports ittype Answer = { readonly columns: readonly string[]; readonly rows: readonly (readonly Value[])[]; readonly truncated: boolean };What a question gives.
traceCatalogfunctionfunction traceCatalog(): CatalogThe catalog of the relations.
traceRelationsfunctionfunction traceRelations(records: TraceRecords): Readonly<Record<string, Table>>The relations of the records: a finding is fresh (the baseline does not hold it) or held; a key of the baseline is held (a finding has it) or stale (none has).
queryTracefunctionfunction queryTrace(records: TraceRecords, sql: string, options?: QueryOptions): Result<Answer, string>The answer to one read-only question over the trace, or why it is refused (with its place) or cannot be answered.