Skip to content

DueByRule

A rest that must start within a number of periods of the last one: “a weekly rest by the end of six operator days after the previous one”.

import type { DueByRule } 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"dueBy"Selects this rule kind.
eventobjectThe rest that is due.
event.statusesS[]The statuses the rest is made of.
event.minimumstringHow long the rest must be, a positive ISO 8601 duration of exact time.
withinobject (Period)How soon the rest is due.
within.periodsnumberHow many periods, an integer from 1 to 10,000. Times a count period, it is 10,000 at most.
within.periodPeriodThe period counted: an elapsed length, or one local period ({ operatorDays: 1 }).
reset?Reset<S> (Reset)Another rest that also starts the clock.
type DueByRule<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: "dueBy";
/** The rest that is due. */
event: {
/** The statuses the rest is made of. */
statuses: S[];
/** How long the rest must be, a positive ISO 8601 duration of exact time. */
minimum: string;
};
/** How soon the rest is due. */
within: {
/**
* How many periods, an integer from 1 to 10,000. Times a count `period`, it is 10,000 at
* most.
*/
periods: number;
/** The period counted: an `elapsed` length, or one local period (`{ operatorDays: 1 }`). */
period: Period;
};
/**
* Another rest that also starts the clock.
*
* @defaultValue None. Only the event starts the clock.
*/
reset?: Reset<S>;
};

types/duty.ts