DEFAULT_LEVELconstconst DEFAULT_LEVEL: LevelKeyThe level a harness is at where it declares none (0028-conformance-levels FR-008).
The conformance levels as the check reads them (commons 0028-conformance-levels): L0 registered, L1 core, L2 standards and L3 governed, which Mizan's ontology states as typed data (mz:ConformanceLevel, mz:ConformanceRequirement), and the rule of which of Mizan's rules a level runs.
Pure functions over the ontology's individuals. A level entails the requirements it adds and those of every level of a lower rank. A rule is run at a level when a requirement the level entails names it with mz:rule (an id, or a family such as changes/*); a rule that no requirement of any level names runs at L1 and above, and at L0 no rule runs. The default level of a harness is L3, which runs every rule, so that a harness that declares none sees what it saw before levels existed (FR-008).
import { levelOf, ruleRunsAt } from "./levels.ts";
ruleRunsAt("mizan/requirement-ears", "L1"); // true
ruleRunsAt("mizan/decision-missing", "L1"); // false: the audit of terms is L2
levelOf("L9"); // undefinedDEFAULT_LEVELconstconst DEFAULT_LEVEL: LevelKeyThe level a harness is at where it declares none (0028-conformance-levels FR-008).
entailedByfunctionfunction entailedBy(level: LevelKey): readonly Entailed[]The requirements a level entails: those it adds and those of every level below it, lowest level first.
LEVELSconstconst LEVELS: readonly LevelKey[]The four levels, lowest first.
LevelKeytypeno test imports ittype LevelKey = "L0" | "L1" | "L2" | "L3";The notation of a level: L and its rank.
levelOffunctionfunction levelOf(text: string): LevelKey | undefinedText as a level, or undefined where it is not one of the four (L0 to L3).
ruleRunsAtfunctionfunction ruleRunsAt(rule: string, level: LevelKey): booleanWhether the check runs a rule at a level (0028-conformance-levels FR-009): the rule is named by a requirement of that level or a lower one; a rule no requirement names runs at L1 and above, and at L0 none runs.
DEFAULT_LIBRARY_LEVELconstno test imports itconst DEFAULT_LIBRARY_LEVEL: LevelKeyThe level a library is at where its manifest declares none (0027-commons-libraries FR-012).
rankOffunctionno test imports itfunction rankOf(level: LevelKey): numberThe rank of a level: 0 to 3.
Entailedtypeno test imports ittype Entailed = {
readonly key: string;
readonly addedBy: LevelKey;
readonly rules: readonly string[];
readonly enforcedBy: readonly string[];
};A requirement of a level and the level that adds it.
ruleMatchesfunctionfunction ruleMatches(pattern: string, rule: string): booleanWhether a rule id is named by a pattern: the id itself, or a family prefix/*.
levelOfRulefunctionfunction levelOfRule(rule: string): LevelKey | undefinedThe lowest level whose requirements name the rule, or undefined where no requirement of any level does.