feat: establish NekoNest Cloud control and relay

This commit is contained in:
2026-08-12 23:25:43 +08:00
commit f27606b709
222 changed files with 71456 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
export type IncidentSeverity = "maintenance" | "degraded" | "outage";
export type ServiceStatusLevel =
| "operational"
| "maintenance"
| "degraded"
| "outage";
const severityRank: Record<IncidentSeverity, number> = {
maintenance: 1,
degraded: 2,
outage: 3,
};
export function deriveServiceStatus(
incidents: ReadonlyArray<{ severity: IncidentSeverity; status: string }>,
): ServiceStatusLevel {
let selected: IncidentSeverity | null = null;
for (const incident of incidents) {
if (incident.status !== "active") continue;
if (!selected || severityRank[incident.severity] > severityRank[selected]) {
selected = incident.severity;
}
}
return selected ?? "operational";
}