UNPKG

1.85 kBTypeScriptView Raw
1import type { TraceContext } from './context';
2interface CrontabSchedule {
3 type: 'crontab';
4 value: string;
5}
6interface IntervalSchedule {
7 type: 'interval';
8 value: number;
9 unit: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute';
10}
11type MonitorSchedule = CrontabSchedule | IntervalSchedule;
12export interface SerializedCheckIn {
13 check_in_id: string;
14 monitor_slug: string;
15 status: 'in_progress' | 'ok' | 'error';
16 duration?: number;
17 release?: string;
18 environment?: string;
19 monitor_config?: {
20 schedule: MonitorSchedule;
21 checkin_margin?: number;
22 max_runtime?: number;
23 timezone?: string;
24 failure_issue_threshold?: number;
25 recovery_threshold?: number;
26 };
27 contexts?: {
28 trace?: TraceContext;
29 };
30}
31export interface HeartbeatCheckIn {
32 monitorSlug: SerializedCheckIn['monitor_slug'];
33 status: 'ok' | 'error';
34}
35export interface InProgressCheckIn {
36 monitorSlug: SerializedCheckIn['monitor_slug'];
37 status: 'in_progress';
38}
39export interface FinishedCheckIn {
40 monitorSlug: SerializedCheckIn['monitor_slug'];
41 status: 'ok' | 'error';
42 checkInId: SerializedCheckIn['check_in_id'];
43 duration?: SerializedCheckIn['duration'];
44}
45export type CheckIn = HeartbeatCheckIn | InProgressCheckIn | FinishedCheckIn;
46type SerializedMonitorConfig = NonNullable<SerializedCheckIn['monitor_config']>;
47export interface MonitorConfig {
48 schedule: MonitorSchedule;
49 checkinMargin?: SerializedMonitorConfig['checkin_margin'];
50 maxRuntime?: SerializedMonitorConfig['max_runtime'];
51 timezone?: SerializedMonitorConfig['timezone'];
52 failureIssueThreshold?: SerializedMonitorConfig['failure_issue_threshold'];
53 recoveryThreshold?: SerializedMonitorConfig['recovery_threshold'];
54}
55export {};
56//# sourceMappingURL=checkin.d.ts.map
\No newline at end of file