PatternRule
A count of rests by class inside a window: “at least 4 weekly rests in any 4 weeks, at least 2 of them regular”.
import type { PatternRule } from "@northguild/gmt";Members
Section titled “Members”| Member | Type | Description |
|---|---|---|
label | string | The caller’s name for the rule. The report is keyed by it; labels must be unique. |
severity? | "violation" | "advisory" (DutySeverity) | Whether a failure is a violation or an advisory. |
kind | "pattern" | Selects this rule kind. |
period | Period | The unit the window is counted in. |
lookback | number | How many periods the window covers, an integer from 1 to 10,000. Times a count period, it is 10,000 at most. |
classes | object[] | The classes of rest, each named for require. |
classes[].label | string | The class’s name, unique within the rule. |
classes[].statuses | S[] | The statuses a run of this class is made of. |
classes[].minimum | string | The shortest run of this class, a positive ISO 8601 duration of exact time. |
require | object[] | The count each class needs. |
require[].label | string | The class, one of the labels in classes. |
require[].atLeast | number | The fewest runs of that class the window must hold, a non-negative integer. |
Definition
Section titled “Definition”type PatternRule<S extends string = string> = { /** The caller's name for the rule. The report is keyed by it; labels must be unique. */ label: string; /** * Whether a failure is a violation or an advisory. * * @defaultValue `"violation"`. */ severity?: DutySeverity; /** Selects this rule kind. */ kind: "pattern"; /** The unit the window is counted in. */ period: Period; /** * How many periods the window covers, an integer from 1 to 10,000. Times a count `period`, it is * 10,000 at most. */ lookback: number; /** The classes of rest, each named for `require`. */ classes: { /** The class's name, unique within the rule. */ label: string; /** The statuses a run of this class is made of. */ statuses: S[]; /** The shortest run of this class, a positive ISO 8601 duration of exact time. */ minimum: string; }[]; /** The count each class needs. */ require: { /** The class, one of the labels in `classes`. */ label: string; /** The fewest runs of that class the window must hold, a non-negative integer. */ atLeast: number; }[];};