OccurrenceCapRule
A cap on how many local periods hold a status: “night duty no more often than every third night”, “duty started on at most 6 of any 7 days”.
import type { OccurrenceCapRule } 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 | "occurrenceCap" | Selects this rule kind. |
statuses | S[] | The statuses that occur. |
per | LocalPeriod | The local period occurrences are counted by. |
lookback | number | How many periods the window covers, an integer from 1 to 10,000. Times the count in per, it is 10,000 at most. |
maximum | number | The most periods allowed to hold an occurrence, a non-negative integer. |
byInitiationDate? | boolean | Whether a run counts only in the period it starts in, so that two tours starting on one date count once and a night shift counts on the date it began. |
Definition
Section titled “Definition”type OccurrenceCapRule<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: "occurrenceCap"; /** The statuses that occur. */ statuses: S[]; /** The local period occurrences are counted by. */ per: LocalPeriod; /** * How many periods the window covers, an integer from 1 to 10,000. Times the count in `per`, it * is 10,000 at most. */ lookback: number; /** The most periods allowed to hold an occurrence, a non-negative integer. */ maximum: number; /** * Whether a run counts only in the period it starts in, so that two tours starting on one date * count once and a night shift counts on the date it began. * * @defaultValue `false`. A run counts in every period it touches. */ byInitiationDate?: boolean;};