212 lines
5.1 KiB
TypeScript
212 lines
5.1 KiB
TypeScript
// ============================================
|
|
// Re-export shared types from @uptime.link/interfaces
|
|
// ============================================
|
|
|
|
import { data } from '@uptime.link/interfaces';
|
|
|
|
// Re-export core types
|
|
export type TStatusType = data.TStatusType;
|
|
export type TCheckType = data.TCheckType;
|
|
export type TStatusMode = data.TStatusMode;
|
|
export type TIncidentSeverity = data.TIncidentSeverity;
|
|
export type TIncidentStatus = data.TIncidentStatus;
|
|
export type TCheckResultStatus = data.TCheckResultStatus;
|
|
export type TCheckLastResult = data.TCheckLastResult;
|
|
|
|
// Re-export check configuration interfaces
|
|
export type ICheckBase = data.ICheckBase;
|
|
export type IAssumptionCheckConfig = data.IAssumptionCheckConfig;
|
|
export type IFunctionCheckConfig = data.IFunctionCheckConfig;
|
|
export type IPwaCheckConfig = data.IPwaCheckConfig;
|
|
export type IPageRankCheckConfig = data.IPageRankCheckConfig;
|
|
export type TCheckConfig = data.TCheckConfig;
|
|
|
|
// Re-export check execution interfaces
|
|
export type IAssumptionCheck = data.IAssumptionCheck;
|
|
export type IFunctionCheck = data.IFunctionCheck;
|
|
export type IPwaCheck = data.IPwaCheck;
|
|
export type IPageRankCheck = data.IPageRankCheck;
|
|
export type ICheckCollection = data.ICheckCollection;
|
|
|
|
// Re-export incident interfaces
|
|
export type IIncident = data.IIncident;
|
|
export type IIncidentUpdateBase = data.IIncidentUpdate;
|
|
|
|
// Re-export status page config
|
|
export type IServiceGroup = data.IServiceGroup;
|
|
|
|
// ============================================
|
|
// Extended/UI-specific Interfaces
|
|
// ============================================
|
|
|
|
/**
|
|
* Flat check configuration for forms.
|
|
* Maps to TCheckConfig discriminated union when saving.
|
|
*/
|
|
export interface ICheckConfig {
|
|
domain: string;
|
|
// Assumption check fields
|
|
expectedTitle?: string;
|
|
expectedStatusCode?: string;
|
|
expectedDescription?: string;
|
|
assumedStatus?: TStatusType;
|
|
// Function check fields
|
|
functionDef?: string;
|
|
functionUrl?: string;
|
|
expectedStatusCodeNum?: number;
|
|
timeoutMs?: number;
|
|
// PWA check fields
|
|
targetUrl?: string;
|
|
lighthouseThreshold?: number;
|
|
// PageRank check fields
|
|
searchTerm?: string;
|
|
checkBing?: boolean;
|
|
checkGoogle?: boolean;
|
|
bingMinRank?: number;
|
|
googleMinRank?: number;
|
|
}
|
|
|
|
/**
|
|
* Service status for display and management.
|
|
* Extended with UI-specific fields.
|
|
*/
|
|
export interface IServiceStatus {
|
|
id: string;
|
|
name: string;
|
|
displayName: string;
|
|
description?: string;
|
|
currentStatus: TStatusType;
|
|
lastChecked: number;
|
|
uptime30d: number;
|
|
uptime90d: number;
|
|
responseTime: number;
|
|
category?: string;
|
|
dependencies?: string[];
|
|
selected?: boolean;
|
|
// Status management
|
|
statusMode?: TStatusMode;
|
|
manualStatus?: TStatusType;
|
|
paused?: boolean;
|
|
// Check configuration
|
|
checkType?: TCheckType;
|
|
checkConfig?: ICheckConfig;
|
|
intervalMs?: number;
|
|
}
|
|
|
|
/**
|
|
* Status history point.
|
|
*/
|
|
export interface IStatusHistoryPoint {
|
|
timestamp: number;
|
|
status: TStatusType;
|
|
responseTime?: number;
|
|
errorRate?: number;
|
|
}
|
|
|
|
/**
|
|
* Overall status with service counts for dashboard.
|
|
*/
|
|
export interface IOverallStatus {
|
|
status: TStatusType;
|
|
message: string;
|
|
lastUpdated: number;
|
|
affectedServices: number;
|
|
totalServices: number;
|
|
}
|
|
|
|
/**
|
|
* Status page configuration.
|
|
*/
|
|
export interface IStatusPageConfig {
|
|
apiEndpoint?: string;
|
|
refreshInterval?: number;
|
|
timeZone?: string;
|
|
dateFormat?: string;
|
|
enableWebSocket?: boolean;
|
|
enableNotifications?: boolean;
|
|
theme?: 'light' | 'dark' | 'auto';
|
|
language?: string;
|
|
showHistoricalDays?: number;
|
|
whitelabel?: boolean;
|
|
companyName?: string;
|
|
companyLogo?: string;
|
|
supportEmail?: string;
|
|
statusPageUrl?: string;
|
|
legalUrl?: string;
|
|
}
|
|
|
|
/**
|
|
* Incident update entry (UI version with timestamp).
|
|
*/
|
|
export interface IIncidentUpdate {
|
|
id: string;
|
|
timestamp: number;
|
|
status: TIncidentStatus;
|
|
message: string;
|
|
author?: string;
|
|
}
|
|
|
|
/**
|
|
* Incident details for display.
|
|
*/
|
|
export interface IIncidentDetails {
|
|
id: string;
|
|
title: string;
|
|
status: TIncidentStatus;
|
|
severity: TIncidentSeverity;
|
|
affectedServices: string[];
|
|
startTime: number;
|
|
endTime?: number;
|
|
updates: IIncidentUpdate[];
|
|
impact: string;
|
|
rootCause?: string;
|
|
resolution?: string;
|
|
}
|
|
|
|
// ============================================
|
|
// Form Interfaces (UI-specific)
|
|
// ============================================
|
|
|
|
/**
|
|
* Monitor form data for creating/editing monitors.
|
|
*/
|
|
export interface IMonitorFormData {
|
|
id?: string;
|
|
name: string;
|
|
displayName: string;
|
|
description?: string;
|
|
category?: string;
|
|
dependencies?: string[];
|
|
// Status management
|
|
statusMode: TStatusMode;
|
|
manualStatus?: TStatusType;
|
|
paused: boolean;
|
|
// Check configuration
|
|
checkType: TCheckType;
|
|
checkConfig: ICheckConfig;
|
|
intervalMs: number;
|
|
}
|
|
|
|
/**
|
|
* Incident form data for creating/editing incidents.
|
|
*/
|
|
export interface IIncidentFormData {
|
|
id?: string;
|
|
title: string;
|
|
severity: TIncidentSeverity;
|
|
status: TIncidentStatus;
|
|
affectedServices: string[];
|
|
impact: string;
|
|
rootCause?: string;
|
|
resolution?: string;
|
|
}
|
|
|
|
/**
|
|
* Incident update form data.
|
|
*/
|
|
export interface IIncidentUpdateFormData {
|
|
status: TIncidentStatus;
|
|
message: string;
|
|
author?: string;
|
|
}
|