Consenttypeno test imports ittype Consent = "none" | "metadata" | "content";What a query may do at a place: nothing, read what a listing says, or read the objects too.
What a query is allowed and what it may cost (commons anyfs-query 0004-query-safety FR-001, FR-002): the consent a place is given, the budget of a run, the way a run ends short of its end, the statistics a run reports, and every way a query can fail as one value of one closed type with the span of what was wrong.
Consenttypeno test imports ittype Consent = "none" | "metadata" | "content";What a query may do at a place: nothing, read what a listing says, or read the objects too.
coversconstconst covers: (given: Consent, needed: Consent) => booleanWhether a consent given covers a consent needed.
consentForconstno test imports itconst consentFor: (table: "content" | "files" | "places" | "revisions") => ConsentThe consent a table needs: content reads objects; the others need only what a listing says.
Budgettypeno test imports ittype Budget = {
readonly maxListed: number;
readonly maxRead: number;
readonly maxBytes: number;
readonly maxRows: number;
readonly deadlineMs: number;
};The limits of a run: objects listed, objects read, bytes read, rows given, and the time in milliseconds.
DEFAULT_BUDGETconstconst DEFAULT_BUDGET: BudgetThe budget of a run that was given none.
parseBudgetfunctionfunction parseBudget(given: Partial<Budget>): Result<Budget, string>A budget of what is given over the default, or why it is not one: every limit is a whole number of at least 1.
Truncationtypeno test imports ittype Truncation = "listed" | "read" | "bytes" | "rows" | "deadline";The limit a run ended at, short of its end.
Statstypeno test imports ittype Stats = { readonly listCalls: number; readonly listed: number; readonly statCalls: number; readonly read: number; readonly bytes: number };What a run did.
Diagnostictypeno test imports ittype Diagnostic = { readonly start: number; readonly end: number; readonly message: string; readonly suggestion?: string };Something wrong with the text of a query, with the half-open range of what it was in the text.
QueryProblemtypeno test imports ittype QueryProblem =
| { readonly kind: "syntax"; readonly diagnostics: readonly Diagnostic[] }
| { readonly kind: "p… (928 characters)type QueryProblem =
| { readonly kind: "syntax"; readonly diagnostics: readonly Diagnostic[] }
| { readonly kind: "profile"; readonly diagnostics: readonly Diagnostic[] }
| { readonly kind: "names"; readonly diagnostics: readonly Diagnostic[] }
| { readonly kind: "plan"; readonly diagnostics: readonly Diagnostic[] }
| { readonly kind: "run"; readonly diagnostics: readonly Diagnostic[] }
| { readonly kind: "place"; readonly place: string; readonly reason: string }
| { readonly kind: "consent"; readonly place: string; readonly needed: Consent; readonly granted: Consent }
| { readonly kind: "capability"; readonly place: string; readonly table: TableName; readonly needed: Capability }
| { readonly kind: "path-needed"; readonly table: TableName; readonly why: string }
| { readonly kind: "budget"; readonly why: string }
| { readonly kind: "store"; readonly place: string; readonly problem: Problem };Every way a query fails.
positionOffunctionno test imports itfunction positionOf(text: string, offset: number): { readonly line: number; readonly column: number; }The line a person reads for the position in a text: its line and column, from one.
describeQueryProblemfunctionfunction describeQueryProblem(text: string, p: QueryProblem): stringA problem as the sentences a person reads, one to a line.