Skip to content

FixedPeriodCapRule

A cap on time in statuses over whole local periods: “56 hours in an ISO week”, “90 hours in two adjacent weeks”, “80 hours a week averaged over four”.

import type { FixedPeriodCapRule } from "@northguild/gmt";
MemberTypeDescription
labelstringThe 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"fixedPeriodCap"Selects this rule kind.
statusesS[]The statuses whose time is capped.
capstringThe most time allowed, per period with average, a positive ISO 8601 duration.
periodLocalPeriodThe period, a count of local periods.
adjacent?numberHow many adjacent periods the cap covers, an integer from 1 to 10,000. Times the period’s count, it is 10,000 at most.
average?booleanWhether cap limits the mean over the adjacent periods instead of their total.
type FixedPeriodCapRule<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: "fixedPeriodCap";
/** The statuses whose time is capped. */
statuses: S[];
/** The most time allowed, per period with `average`, a positive ISO 8601 duration. */
cap: string;
/** The period, a count of local periods. */
period: LocalPeriod;
/**
* How many adjacent periods the cap covers, an integer from 1 to 10,000. Times the period's
* count, it is 10,000 at most.
*
* @defaultValue `1`.
*/
adjacent?: number;
/**
* Whether `cap` limits the mean over the `adjacent` periods instead of their total.
*
* @defaultValue `false`.
*/
average?: boolean;
};

types/duty.ts