Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
import { type CertExpiryState } from "./monitor_cert_expiry.ts"; ← from monitor.cert-expiry ^1.0.0 · built alongside by fune
import { type CheckStatus } from "./monitor_check_status.ts"; ← from monitor.check-status ^1.0.0 · built alongside by fune
const STATUS: Readonly<Record<string, CheckStatus>> = { ok: "up", warning: "up", critical: "degraded", expired: "down" };
/**
* A certificate as one check behind a status page component. A warning
* is work for the operator, not something a visitor notices, so it stays
* up; critical is degraded because renewal is now urgent; an expired
* certificate breaks every client, so it is down.
*/
export function certCheck(state: CertExpiryState): CheckStatus {
const status = Object.prototype.hasOwnProperty.call(STATUS, state) ? STATUS[state] : undefined;
if (status === undefined) throw new RangeError(`unknown certificate state: ${String(state)}`);
return status;
}