Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
3.4 kB ยท 116 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117import { base } from "@openstatus/assertions";import { z } from "zod";
import { MONITOR_METHODS, MONITOR_STATUSES } from "./constants";
export const httpPayloadSchema = z.object({ workspaceId: z.string(), monitorId: z.string(), method: z.enum(MONITOR_METHODS), body: z.string().optional(), headers: z.array(z.object({ key: z.string(), value: z.string() })).optional(), url: z.string(), cronTimestamp: z.number(), status: z.enum(MONITOR_STATUSES), assertions: z.array(base).nullable(), timeout: z.number().prefault(45000), degradedAfter: z.number().nullable(), trigger: z.enum(["cron", "api"]).nullable().prefault("cron"), otelConfig: z .object({ endpoint: z.string(), headers: z.record(z.string(), z.string()), }) .optional(), retry: z.number().prefault(3), followRedirects: z.boolean().prefault(true),});
export type HttpPayload = z.infer<typeof httpPayloadSchema>;
export const tpcPayloadSchema = z.object({ status: z.enum(MONITOR_STATUSES), workspaceId: z.string(), uri: z.string(), monitorId: z.string(), assertions: z.array(base).nullable(), cronTimestamp: z.number(), timeout: z.number().prefault(45000), degradedAfter: z.number().nullable(), trigger: z.enum(["cron", "api"]).nullable().prefault("cron"), otelConfig: z .object({ endpoint: z.string(), headers: z.record(z.string(), z.string()), }) .optional(), retry: z.number().prefault(3),});
export type TcpPayload = z.infer<typeof tpcPayloadSchema>;
export const DNSPayloadSchema = z.object({ status: z.enum(MONITOR_STATUSES), workspaceId: z.string(), uri: z.string(), monitorId: z.string(), assertions: z.array(base).nullable(), cronTimestamp: z.number(), timeout: z.number().prefault(45000), degradedAfter: z.number().nullable(), trigger: z.enum(["cron", "api"]).nullable().prefault("cron"), otelConfig: z .object({ endpoint: z.string(), headers: z.record(z.string(), z.string()), }) .optional(), retry: z.number().prefault(3),});
export type DNSPayload = z.infer<typeof DNSPayloadSchema>;
export const icmpPayloadSchema = z.object({ status: z.enum(MONITOR_STATUSES), workspaceId: z.string(), uri: z.string(), monitorId: z.string(), cronTimestamp: z.number(), timeout: z.number().prefault(45000), degradedAfter: z.number().nullable(), trigger: z.enum(["cron", "api"]).nullable().prefault("cron"), otelConfig: z .object({ endpoint: z.string(), headers: z.record(z.string(), z.string()), }) .optional(), retry: z.number().prefault(3),});
export type IcmpPayload = z.infer<typeof icmpPayloadSchema>;
export const GRPC_TLS_MODES = ["plaintext", "tls", "tls_insecure"] as const;
export const grpcPayloadSchema = z.object({ status: z.enum(MONITOR_STATUSES), workspaceId: z.string(), uri: z.string(), monitorId: z.string(), service: z.string().optional(), tls: z.enum(GRPC_TLS_MODES).prefault("tls"), headers: z.record(z.string(), z.string()).optional(), cronTimestamp: z.number(), timeout: z.number().prefault(45000), degradedAfter: z.number().nullable(), trigger: z.enum(["cron", "api"]).nullable().prefault("cron"), otelConfig: z .object({ endpoint: z.string(), headers: z.record(z.string(), z.string()), }) .optional(), retry: z.number().prefault(3),});
export type GrpcPayload = z.infer<typeof grpcPayloadSchema>;