ElapsedWindowRule
A window that opens when work starts after a reset and closes length later, whatever rest falls inside it: “no driving more than 14 hours after work began”.
import type { ElapsedWindowRule } 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 | "elapsedWindow" | Selects this rule kind. |
startStatuses | S[] | The statuses whose first entry after the reset opens the window. |
length | string | How long the window stays open, a positive ISO 8601 duration of exact time. |
restrictedStatuses | S[] | The statuses not allowed once the window has closed. |
since | Reset<S> (Reset) | The rest that closes one window, so that the next work opens a new one. |
exclude? | PairSpec | A paired rest that does not count against the window. |
extension? | object | A caller-declared extension: the window open at from closes by later. |
extension.by | string | How much later the window closes, a positive ISO 8601 duration of exact time. |
extension.from | string | The instant the extension is declared at, an ISO 8601 instant string. |
Definition
Section titled “Definition”type ElapsedWindowRule<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: "elapsedWindow"; /** The statuses whose first entry after the reset opens the window. */ startStatuses: S[]; /** How long the window stays open, a positive ISO 8601 duration of exact time. */ length: string; /** The statuses not allowed once the window has closed. */ restrictedStatuses: S[]; /** The rest that closes one window, so that the next work opens a new one. */ since: Reset<S>; /** * A paired rest that does not count against the window. * * @defaultValue None. Rest inside the window never moves it. */ exclude?: PairSpec; /** * A caller-declared extension: the window open at `from` closes `by` later. * * @defaultValue None. No window is extended. */ extension?: { /** How much later the window closes, a positive ISO 8601 duration of exact time. */ by: string; /** The instant the extension is declared at, an ISO 8601 instant string. */ from: string; };};