blob: c03fb3012570c0cb442249799a7782fb9bf203f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import * as TE from "fp-ts/lib/TaskEither";
import * as O from "fp-ts/lib/Option";
import type { Job } from "./job";
import type { D } from "../util";
export enum TestType {
EMAIL = "email",
PING = "ping",
HEALTHCHECK = "healthcheck",
DNS = "dns",
}
export interface Schedule {
every: D.Duration;
jitter: D.Duration;
}
export interface Test {
name: string;
type: TestType;
job: Job;
schedule: Schedule;
}
export type Testable<T extends Job> = (job: T) => TE.TaskEither<Error, boolean>;
export const parseTestType = (testType: string): O.Option<TestType> =>
Object.values(TestType).includes(testType as TestType)
? O.some(testType as TestType)
: O.none;
|