Skip to content

QuotaRule

A cap on how often a short rest is taken: “at most 3 reduced rests between two full rests”.

import type { QuotaRule } 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"quota"Selects this rule kind.
eventobjectThe run that counts once.
event.statusesS[]The statuses the run is made of.
event.minimumstringThe shortest run that counts, a positive ISO 8601 duration of exact time.
event.maximumstringThe length a run must stay under to count, a positive ISO 8601 duration of exact time.
countnumberThe most events allowed, a non-negative integer.
resetReset<S> | object (Reset, Period)What starts the count again: a full rest, or a window.
reset.everyPeriodThe window the events are counted in.
type QuotaRule<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: "quota";
/** The run that counts once. */
event: {
/** The statuses the run is made of. */
statuses: S[];
/** The shortest run that counts, a positive ISO 8601 duration of exact time. */
minimum: string;
/** The length a run must stay under to count, a positive ISO 8601 duration of exact time. */
maximum: string;
};
/** The most events allowed, a non-negative integer. */
count: number;
/** What starts the count again: a full rest, or a window. */
reset:
| Reset<S>
| {
/** The window the events are counted in. */
every: Period;
};
};

types/duty.ts