initial commit

This commit is contained in:
Alex Holliday committed 2025-11-13 13:47:26 -08:00
1 parent 7cb985116e
commit 75acf7b38f
955 files changed
+37333 -87054

No files matched your search

+173
View File
@@ -0,0 +1,173 @@
export interface CheckTimingPhases {
wait: number;
dns: number;
tcp: number;
tls: number;
request: number;
firstByte: number;
download: number;
total: number;
}
export interface CheckTimings {
start: string;
socket: string;
lookup: string;
connect: string;
secureConnect: string;
response: string;
end: string;
phases: CheckTimingPhases;
}
export interface ILighthouseAudit {
id?: string;
title?: string;
score?: number | null;
displayValue?: string;
numericValue?: number;
numericUnit?: string;
}
export interface ICheckLighthouseFields {
accessibility: number;
bestPractices: number;
seo: number;
performance: number;
audits: {
cls: ILighthouseAudit;
si: ILighthouseAudit;
fcp: ILighthouseAudit;
lcp: ILighthouseAudit;
tbt: ILighthouseAudit;
};
}
export interface ISystemInfo {
cpu: ICpuInfo;
memory: IMemoryInfo;
disk: IDiskInfo[];
host: IHostInfo;
net: INetInfo[];
}
export interface ICpuInfo {
physical_core: number;
logical_core: number;
frequency: number;
current_frequency: number;
temperature: number[]; // per-core temps
free_percent: number;
usage_percent: number;
}
export interface IMemoryInfo {
total_bytes: number;
available_bytes: number;
used_bytes: number;
usage_percent: number;
}
export interface IHostInfo {
os?: string;
platform?: string;
kernel_version?: string;
pretty_name?: string;
}
export interface IDiskInfo {
device: string;
total_bytes: number;
free_bytes: number;
used_bytes: number;
usage_percent: number;
total_inodes?: number;
free_inodes?: number;
used_inodes?: number;
inodes_usage_percent?: number;
read_bytes?: number;
write_bytes?: number;
read_time?: number;
write_time?: number;
}
export interface INetInfo {
name: string;
bytes_sent: number;
bytes_recv: number;
packets_sent: number;
packets_recv: number;
err_in: number;
err_out: number;
drop_in: number;
drop_out: number;
fifo_in: number;
fifo_out: number;
}
export interface ICheck {
_id: string;
metadata: {
monitorId: string;
type: string;
teamId: string;
};
status: string;
message: string;
responseTime: number;
normalResponseTime?: number;
httpStatusCode: number;
ack: boolean;
expiry: string;
createdAt: string;
updatedAt: string;
timings: CheckTimings;
lighthouse?: ICheckLighthouseFields;
system?: ISystemInfo;
}
export interface CheckWithMonitor {
_id: string;
metadata: {
monitorId: {
_id: string;
name: string;
};
type: string;
teamId: string;
};
status: string;
message: string;
responseTime: number;
normalResponseTime?: number;
httpStatusCode: number;
ack: boolean;
expiry: string;
createdAt: string;
updatedAt: string;
timings: CheckTimings;
}
export interface GroupedCheck {
_id: string;
avgResponseTime: number;
count: number;
}
export interface LatestCheck {
status: string;
responseTime: number;
checkedAt: string;
_id: string;
}
export interface IInfraCheck {
_id: string;
avgResponseTime: number;
count: 9;
cpu: ICpuInfo;
memory: IMemoryInfo;
disk: IDiskInfo[];
host: IHostInfo;
net: INetInfo[];
}
export interface IChecksWithCount {
checks: ICheck[];
count: number;
}
+17
View File
@@ -0,0 +1,17 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_APP_API_V2_BASE_URL?: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
declare module "*.svg?react" {
import * as React from "react";
const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement> & { title?: string }
>;
export default ReactComponent;
}
+16
View File
@@ -0,0 +1,16 @@
import type { IMongoUser } from "@/types/user";
import type { IMonitor } from "@/types/monitor";
export interface IIncident {
_id: string;
monitorId: IMonitor;
teamId: string;
startedAt: string;
startCheck: string;
resolved: boolean;
endedAt?: string;
endCheck?: string;
resolvedBy?: IMongoUser;
resolutionType?: string;
resolutionNote?: string;
}
+29
View File
@@ -0,0 +1,29 @@
import type { IMonitor } from "./monitor";
export interface IJob {
active: boolean;
id: string;
data: IMonitor;
lastFinishedAt: number;
lastRunAt: number;
lastRunTook: number;
lockedAt: number | null;
repeat: number;
runCount: number;
template: string;
}
export interface IJobMetrics {
jobs: number;
activeJobs: number;
failingJobs: number;
jobsWithFailures: Array<{
monitorId: string | number;
monitorUrl: string | null;
monitorType: string | null;
failedAt: number | null;
failCount: number | null;
failReason: string | null;
}>;
totalRuns: number;
totalFailures: number;
}
+7
View File
@@ -0,0 +1,7 @@
export interface ILogEntry {
level: "debug" | "info" | "warn" | "error";
message: string;
service: string;
stack: string;
timestamp: string;
}
+18
View File
@@ -0,0 +1,18 @@
export const MaintenanceRepeats = ["no repeat", "daily", "weekly"] as const;
export type MaintenanceRepeat = (typeof MaintenanceRepeats)[number];
export interface IMaintenance extends Document {
_id: string;
orgId: string;
teamId: string;
name: string;
isActive: boolean;
repeat: MaintenanceRepeat;
monitors: string[];
startTime: Date;
endTime: Date;
createdBy: string;
updatedBy: string;
createdAt: Date;
updatedAt: Date;
}
+37
View File
@@ -0,0 +1,37 @@
import type { GroupedCheck, ICheck } from "@/types/check";
import type { IMonitorStats } from "./monitorStats";
export type MonitorStatus = "up" | "down" | "initializing";
export interface IMonitor {
checks: ICheck[];
createdAt: string;
createdBy: string;
interval: number;
isActive: boolean;
latestChecks: ICheck[];
n: number;
name: string;
notificationChannels: string[];
status: MonitorStatus;
type: string;
updatedAt: string;
updatedBy: string;
url: string;
__v: number;
_id: string;
}
export interface IMonitorWithStats {
count: number;
downCount: number;
upCount: number;
pausedCount: number;
monitors: IMonitor[];
}
export interface IMonitorWithMonitorStats {
checks: GroupedCheck[];
monitor: IMonitor;
stats: IMonitorStats;
}
+19
View File
@@ -0,0 +1,19 @@
import type { MonitorStatus } from "@/types//monitor";
export interface IMonitorStats {
monitorId: string;
avgResponseTime: number;
maxResponseTime: number;
totalChecks: number;
totalUpChecks: number;
totalDownChecks: number;
uptimePercentage: number;
lastCheckTimestamp: number;
lastResponseTime: number;
timeOfLastFailure: number;
currentStreak: number;
currentStreakStatus: MonitorStatus;
currentStreakStartedAt: number;
createdAt: Date;
updatedAt: Date;
}
+25
View File
@@ -0,0 +1,25 @@
import "@mui/material/Button";
declare module "@mui/material/styles" {
interface Palette {
accent: Palette["primary"];
tertiary: Palette["primary"];
}
interface PaletteOptions {
accent?: PaletteOptions["primary"];
tertiary?: PaletteOptions["primary"];
}
interface PaletteColor {
contrastTextSecondary?: string;
contrastTextTertiary?: string;
lowContrast?: string;
veryLowContrast?: string;
}
}
declare module "@mui/material/Button" {
interface ButtonPropsColorOverrides {
accent: true;
}
}
+21
View File
@@ -0,0 +1,21 @@
export const ChannelTypes = ["email", "slack", "discord", "webhook"] as const;
export type ChannelType = (typeof ChannelTypes)[number];
export interface INotificationChannelConfig {
url?: string; // For webhook, slack, discord
emailAddress?: string; // For email
}
export interface INotificationChannel {
_id: string;
orgId: string;
teamId: string;
name: string;
type: ChannelType;
config: INotificationChannelConfig;
isActive: boolean;
createdBy: string;
updatedBy: string;
createdAt: Date;
updatedAt: Date;
}
+19
View File
@@ -0,0 +1,19 @@
import type { IMonitor } from "@/types/monitor";
export interface IStatusPage {
_id: string;
name: string;
description: string;
url: string;
isPublished: boolean;
monitors: string[];
}
export interface IStatusPageWithMonitors {
_id: string;
name: string;
description: string;
url: string;
isPublished: boolean;
monitors: IMonitor[];
}
+17
View File
@@ -0,0 +1,17 @@
export interface ITeamMember {
_id: string;
orgId: string;
teamId: string;
userId: {
_id: string;
firstName: string;
lastName: string;
email: string;
};
roleId: {
_id: string;
name: string;
scope: string;
permissions: string[];
};
}
+5
View File
@@ -0,0 +1,5 @@
export interface ITeam {
_id: string;
name: string;
description: string;
}
+4
View File
@@ -0,0 +1,4 @@
export interface ITimeZone {
_id: string;
name: string;
}
+21
View File
@@ -0,0 +1,21 @@
export interface IUser {
id: string;
email: string;
firstName: string;
lastName: string;
org: {
name: string;
permissions: string[];
};
teams: {
id: string;
name: string;
permissions: string;
}[];
}
export interface IMongoUser {
_id: string;
email: string;
firstName: string;
lastName: string;
}