Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
feat: public monitor (#765)
Maximilian Kaskeac438dc35da4
diff --git a/apps/server/src/v1/monitor.test.ts b/apps/server/src/v1/monitor.test.tsindex 89246a62f..b0220a892 100644--- a/apps/server/src/v1/monitor.test.ts+++ b/apps/server/src/v1/monitor.test.ts@@ -1,7 +1,6 @@import { expect, test } from "bun:test";import { api } from ".";-import { iso8601Regex } from "./test-utils";test("GET one monitor", async () => {const res = await api.request("/monitor/1", {@@ -22,6 +21,7 @@ test("GET one monitor", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,});});@@ -43,6 +43,7 @@ test("GET all monitor", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,});});@@ -57,6 +58,7 @@ test("Create a monitor", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: true,};const res = await api.request("/monitor", {method: "POST",@@ -79,6 +81,7 @@ test("Create a monitor", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: true,});});@@ -93,6 +96,7 @@ test("Create a monitor without auth key should return 401", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,};const res = await api.request("/monitor", {method: "POST",@@ -115,6 +119,7 @@ test("Create a monitor with invalid data should return 403", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,};const res = await api.request("/monitor", {method: "POST",@@ -145,6 +150,7 @@ test("Update a Monitor ", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: true,};const res = await api.request("/monitor/1", {@@ -168,6 +174,7 @@ test("Update a Monitor ", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: true,});});@@ -182,6 +189,7 @@ test("Update a monitor not in db should return 404", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,};const res = await api.request("/monitor/404", {@@ -212,6 +220,7 @@ test("Update a monitor without auth key should return 401", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,};const res = await api.request("/monitor/2", {method: "PUT",@@ -233,6 +242,7 @@ test("Update a monitor with invalid data should return 403", async () => {body: '{"hello":"world"}',headers: [{ key: "key", value: "value" }],active: true,+ public: false,};const res = await api.request("/monitor/2", {method: "PUT",diff --git a/apps/server/src/v1/monitor.ts b/apps/server/src/v1/monitor.tsindex 3be975dfb..67be1058a 100644--- a/apps/server/src/v1/monitor.ts+++ b/apps/server/src/v1/monitor.ts@@ -110,6 +110,10 @@ const MonitorSchema = z.boolean().default(false).openapi({ description: "If the monitor is active" }),+ public: z+ .boolean()+ .default(false)+ .openapi({ description: "If the monitor is public" }),}).openapi({description: "The monitor",@@ -146,6 +150,9 @@ const monitorInput = zactive: z.boolean().default(false).openapi({description: "If the monitor is active",}),+ public: z.boolean().default(false).openapi({+ description: "If the monitor is public",+ }),headers: z.preprocess((val) => {diff --git a/apps/web/package.json b/apps/web/package.jsonindex 6fb18960e..9f4d7949e 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -33,6 +33,7 @@"@sentry/nextjs": "7.100.1","@stripe/stripe-js": "2.1.6","@t3-oss/env-nextjs": "0.7.0",+ "@tailwindcss/container-queries": "0.1.1","@tailwindcss/typography": "0.5.10","@tanstack/react-table": "8.10.3","@tremor/react": "3.13.3",diff --git a/apps/web/public/assets/changelog/public-monitors.png b/apps/web/public/assets/changelog/public-monitors.pngnew file mode 100644index 000000000..fd2f3fbccBinary files /dev/null and b/apps/web/public/assets/changelog/public-monitors.png differdiff --git a/apps/web/src/app/api/og/_components/status-check.tsx b/apps/web/src/app/api/og/_components/status-check.tsxindex 2cc69644d..a8ee8455c 100644--- a/apps/web/src/app/api/og/_components/status-check.tsx+++ b/apps/web/src/app/api/og/_components/status-check.tsx@@ -23,8 +23,8 @@ export function StatusCheck({ tracker }: { tracker: Tracker }) {const Icon = getVariant();return (- <div tw="flex flex-col justify-center items-center gap-2 w-full">- <div tw={cn("flex text-white rounded-full p-3 border-2", className)}>+ <div tw="flex flex-col justify-center items-center w-full">+ <div tw={cn("flex text-white rounded-full p-3 border-2 mb-2", className)}><Icon /></div><p style={{ fontFamily: "Cal" }} tw="text-4xl">diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsxindex a3e85d68a..27620775a 100644--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsx+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/layout.tsx@@ -35,12 +35,16 @@ export default async function Layout({active={monitor.active}status={monitor.status}/>- <span className="text-muted-foreground/50 text-xs">•</span>- <TagBadgeWithTooltip- tags={monitor.monitorTagsToMonitors.map(- ({ monitorTag }) => monitorTag,- )}- />+ {monitor.monitorTagsToMonitors.length > 0 ? (+ <>+ <span className="text-muted-foreground/50 text-xs">•</span>+ <TagBadgeWithTooltip+ tags={monitor.monitorTagsToMonitors.map(+ ({ monitorTag }) => monitorTag,+ )}+ />+ </>+ ) : null}<span className="text-muted-foreground/50 text-xs">•</span><span className="text-sm">every <code>{monitor.periodicity}</code>diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/overview/page.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/overview/page.tsxindex a40075c91..afd96b8a2 100644--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/overview/page.tsx+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/overview/page.tsx@@ -110,7 +110,7 @@ export default async function Page({<DatePickerPreset defaultValue={period} values={periods} />{isDirty ? <ButtonReset /> : null}</div>- <Metrics metrics={metrics} period={period} />+ <Metrics metrics={metrics} period={period} showErrorLink /><Separator className="my-8" /><CombinedChartWrapperdata={data}diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsxindex cf83e8cbf..7dac08576 100644--- a/apps/web/src/app/page.tsx+++ b/apps/web/src/app/page.tsx@@ -1,7 +1,7 @@import { MarketingLayout } from "@/components/layout/marketing-layout";import { AlertCard } from "@/components/marketing/alert/card";-import { BottomCTA } from "@/components/marketing/bottom-cta";import { Hero } from "@/components/marketing/hero";+import { BottomCTA, MiddleCTA } from "@/components/marketing/in-between-cta";import { LatestChangelogs } from "@/components/marketing/lastest-changelogs";import { MonitoringCard } from "@/components/marketing/monitor/card";import { Partners } from "@/components/marketing/partners";@@ -18,6 +18,7 @@ export default async function Page() {<Partners /><MonitoringCard /><Stats />+ <MiddleCTA /><StatusPageCard /><AlertCard /><BottomCTA />diff --git a/apps/web/src/app/play/page.tsx b/apps/web/src/app/play/page.tsxindex ecd6938c8..d9defb1c7 100644--- a/apps/web/src/app/play/page.tsx+++ b/apps/web/src/app/play/page.tsx@@ -1,5 +1,12 @@import type { Metadata } from "next";-import { Clock, FileCode, Gauge, Palette, PanelTop } from "lucide-react";+import {+ Activity,+ Clock,+ FileCode,+ Gauge,+ Palette,+ PanelTop,+} from "lucide-react";import { BackButton } from "@/components/layout/back-button";import type { CardProps } from "@/components/play/card";@@ -53,11 +60,16 @@ const playgrounds: CardProps[] = [icon: Gauge,variant: "primary",},+ {+ href: "/public/monitors/1",+ title: "Public Dashboard",+ description: "Get a demo of wha data we collect for your monitor.",+ icon: Activity,+ },{href: "/play/status",title: "Status Page",- description:- "Get a status page for your website or api, supporting timezones.",+ description: "Get a status page for your website or api.",icon: PanelTop,},{diff --git a/apps/web/src/app/public/layout.tsx b/apps/web/src/app/public/layout.tsxnew file mode 100644index 000000000..ee3328865--- /dev/null+++ b/apps/web/src/app/public/layout.tsx@@ -0,0 +1,29 @@+import * as React from "react";+import type { Metadata } from "next";++import {+ defaultMetadata,+ ogMetadata,+ twitterMetadata,+} from "@/app/shared-metadata";+import { PublicLayout } from "@/components/layout/public-layout";++export const metadata: Metadata = {+ ...defaultMetadata,+ twitter: {+ ...twitterMetadata,+ },+ openGraph: {+ ...ogMetadata,+ },+};++export default function DemoLayout({+ children,+}: {+ children: React.ReactNode;+}) {+ // TODO: move first sticky Shell into here+ // that will allow to use a loading state and have it already+ return <PublicLayout>{children}</PublicLayout>;+}diff --git a/apps/web/src/app/public/monitors/[id]/loading.tsx b/apps/web/src/app/public/monitors/[id]/loading.tsxnew file mode 100644index 000000000..5b9b2c3d5--- /dev/null+++ b/apps/web/src/app/public/monitors/[id]/loading.tsx@@ -0,0 +1,54 @@+import { Separator, Skeleton } from "@openstatus/ui";++import { Shell } from "@/components/dashboard/shell";++export default function Loading() {+ return (+ <div className="relative flex w-full flex-col gap-6">+ <Shell className="flex items-center justify-between gap-2">+ <div className="grid gap-2">+ <Skeleton className="h-6 w-24 md:w-40" />+ <Skeleton className="h-4 w-32 md:w-60" />+ </div>+ <div>+ <Skeleton className="h-10 w-[150px]" />+ </div>+ </Shell>+ <Shell className="grid gap-4">+ <div className="grid gap-6">+ <div className="grid grid-cols-2 gap-4 sm:grid-cols-4 md:grid-cols-5 md:gap-6">+ {new Array(4).fill(0).map((_, i) => (+ <Skeleton key={i} className="h-16 w-full" />+ ))}+ </div>+ <div className="grid gap-4">+ <div className="grid grid-cols-2 gap-4 sm:grid-cols-4 md:grid-cols-5 md:gap-6">+ {new Array(5).fill(0).map((_, i) => (+ <Skeleton key={i} className="h-16 w-full" />+ ))}+ </div>+ <Skeleton className="h-3 w-40" />+ </div>+ </div>+ <Separator className="my-8" />+ <div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between">+ <div className="flex w-full gap-2 sm:flex-row sm:justify-between">+ <Skeleton className="h-10 w-[150px]" />+ <Skeleton className="h-10 w-[150px]" />+ </div>+ <div className="flex gap-2">+ <div className="grid gap-1">+ <Skeleton className="h-4 w-12" />+ <Skeleton className="h-10 w-[150px]" />+ </div>+ <div className="grid gap-1">+ <Skeleton className="h-4 w-12" />+ <Skeleton className="h-10 w-[150px]" />+ </div>+ </div>+ </div>+ <Skeleton className="h-[396px] w-full" />+ </Shell>+ </div>+ );+}diff --git a/apps/web/src/app/public/monitors/[id]/page.tsx b/apps/web/src/app/public/monitors/[id]/page.tsxnew file mode 100644index 000000000..b84459321--- /dev/null+++ b/apps/web/src/app/public/monitors/[id]/page.tsx@@ -0,0 +1,130 @@+import * as React from "react";+import { notFound } from "next/navigation";+import * as z from "zod";++import { flyRegions } from "@openstatus/db/src/schema";+import type { Region } from "@openstatus/tinybird";+import { OSTinybird } from "@openstatus/tinybird";+import { Separator } from "@openstatus/ui";++import { Shell } from "@/components/dashboard/shell";+import { CombinedChartWrapper } from "@/components/monitor-charts/combined-chart-wrapper";+import { ButtonReset } from "@/components/monitor-dashboard/button-reset";+import { DatePickerPreset } from "@/components/monitor-dashboard/date-picker-preset";+import { Metrics } from "@/components/monitor-dashboard/metrics";+import { env } from "@/env";+import {+ getMinutesByInterval,+ intervals,+ periods,+ quantiles,+} from "@/lib/monitor/utils";+import { getPreferredSettings } from "@/lib/preferred-settings/server";+import { api } from "@/trpc/server";++const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });++const DEFAULT_QUANTILE = "p95";+const DEFAULT_INTERVAL = "30m";+const DEFAULT_PERIOD = "1d";++/**+ * allowed URL search params+ */+const searchParamsSchema = z.object({+ statusCode: z.coerce.number().optional(),+ cronTimestamp: z.coerce.number().optional(),+ quantile: z.enum(quantiles).optional().default(DEFAULT_QUANTILE),+ interval: z.enum(intervals).optional().default(DEFAULT_INTERVAL),+ period: z.enum(periods).optional().default(DEFAULT_PERIOD),+ regions: z+ .string()+ .optional()+ .transform(+ (value) =>+ value+ ?.trim()+ ?.split(",")+ .filter((i) => flyRegions.includes(i as Region)) ?? flyRegions,+ ),+});++export default async function Page({+ params,+ searchParams,+}: {+ params: { workspaceSlug: string; id: string };+ searchParams: { [key: string]: string | string[] | undefined };+}) {+ const id = params.id;+ const search = searchParamsSchema.safeParse(searchParams);+ const preferredSettings = getPreferredSettings();++ const monitor = await api.monitor.getPublicMonitorById.query({+ id: Number(id),+ });++ if (!monitor || !search.success) {+ return notFound();+ }++ const { period, quantile, interval, regions } = search.data;++ // TODO: work it out easier+ const intervalMinutes = getMinutesByInterval(interval);+ const periodicityMinutes = getMinutesByInterval(monitor.periodicity);++ const isQuantileDisabled = intervalMinutes <= periodicityMinutes;+ const minutes = isQuantileDisabled ? periodicityMinutes : intervalMinutes;++ const metrics = await tb.endpointMetrics(period)({ monitorId: id });++ const data = await tb.endpointChart(period)({+ monitorId: id,+ interval: minutes,+ });++ const metricsByRegion = await tb.endpointMetricsByRegion(period)({+ monitorId: id,+ });++ if (!data || !metrics || !metricsByRegion) return null;++ const isDirty =+ period !== DEFAULT_PERIOD ||+ quantile !== DEFAULT_QUANTILE ||+ interval !== DEFAULT_INTERVAL ||+ flyRegions.length !== regions.length;++ return (+ <div className="relative flex w-full flex-col gap-6">+ <Shell className="bg-background/80 sticky top-2 z-10 flex items-center justify-between gap-2 backdrop-blur-sm">+ <div className="min-w-0">+ <p className="text-sm font-semibold">{monitor.name}</p>+ <p className="text-muted-foreground truncate text-base">+ {monitor.url}+ </p>+ </div>+ <div className="flex items-center gap-2">+ {isDirty ? <ButtonReset /> : null}+ <DatePickerPreset defaultValue={period} values={periods} />+ </div>+ </Shell>+ <Shell className="grid gap-4">+ <Metrics metrics={metrics} period={period} />+ <Separator className="my-8" />+ <CombinedChartWrapper+ data={data}+ period={period}+ quantile={quantile}+ interval={interval}+ regions={regions as Region[]} // FIXME: not properly reseted after filtered+ monitor={monitor}+ isQuantileDisabled={isQuantileDisabled}+ metricsByRegion={metricsByRegion}+ preferredSettings={preferredSettings}+ />+ </Shell>+ </div>+ );+}diff --git a/apps/web/src/app/status-page/[domain]/_components/footer.tsx b/apps/web/src/app/status-page/[domain]/_components/footer.tsxnew file mode 100644index 000000000..d5c6ede09--- /dev/null+++ b/apps/web/src/app/status-page/[domain]/_components/footer.tsx@@ -0,0 +1,31 @@+import { allPlans } from "@openstatus/plans";+import type { WorkspacePlan } from "@openstatus/plans";++import { ThemeToggle } from "@/components/theme-toggle";++interface Props {+ plan: WorkspacePlan;+}++export function Footer({ plan }: Props) {+ const isWhiteLabel = allPlans[plan].limits["white-label"];+ return (+ <footer className="z-10 mx-auto flex w-full items-center justify-between">+ <div />+ {!isWhiteLabel ? (+ <p className="text-muted-foreground text-center text-sm">+ powered by{" "}+ <a+ href="https://www.openstatus.dev"+ target="_blank"+ rel="noreferrer"+ className="text-foreground underline underline-offset-4 hover:no-underline"+ >+ openstatus.dev+ </a>+ </p>+ ) : null}+ <ThemeToggle />+ </footer>+ );+}diff --git a/apps/web/src/app/status-page/[domain]/_components/header.tsx b/apps/web/src/app/status-page/[domain]/_components/header.tsxnew file mode 100644index 000000000..59f084a97--- /dev/null+++ b/apps/web/src/app/status-page/[domain]/_components/header.tsx@@ -0,0 +1,67 @@+"use client";++import Image from "next/image";+import { useSelectedLayoutSegment } from "next/navigation";++import type { PublicPage } from "@openstatus/db/src/schema";+import { allPlans } from "@openstatus/plans";+import type { WorkspacePlan } from "@openstatus/plans";++import { Shell } from "@/components/dashboard/shell";+import { TabsContainer, TabsLink } from "@/components/dashboard/tabs-link";+import { Menu } from "./menu";+import { SubscribeButton } from "./subscribe-button";++type Props = {+ navigation: {+ label: string;+ href: string;+ segment: string | null;+ disabled?: boolean;+ }[];+ plan: WorkspacePlan;+ page: PublicPage;+};++export function Header({ navigation, plan, page }: Props) {+ const selectedSegment = useSelectedLayoutSegment();+ const isSubscribers = allPlans[plan].limits["status-subscribers"];++ return (+ <header className="w-full">+ <Shell className="flex items-center justify-between gap-4 px-3 py-3 md:px-6 md:py-3">+ <div className="relative sm:w-[100px]">+ {page?.icon ? (+ <div className="bg-muted border-border flex h-7 w-7 items-center justify-center overflow-hidden rounded-full border">+ <Image+ height={36}+ width={36}+ src={page.icon}+ alt={page.title}+ className="object-cover"+ />+ </div>+ ) : null}+ </div>+ <TabsContainer className="-mb-[13px] hidden sm:block" hideSeparator>+ {navigation.map(({ label, href, disabled, segment }) => {+ const active = segment === selectedSegment;+ return (+ <TabsLink key={segment} {...{ active, href, label, disabled }}>+ {label}+ </TabsLink>+ );+ })}+ </TabsContainer>+ <div className="flex items-center gap-4">+ <div className="text-end sm:w-[100px]">+ {isSubscribers ? <SubscribeButton slug={page.slug} /> : null}+ </div>+ <div className="block sm:hidden">+ <Menu navigation={navigation} />+ </div>+ </div>+ </Shell>+ </header>+ );+}diff --git a/apps/web/src/app/status-page/[domain]/_components/menu.tsx b/apps/web/src/app/status-page/[domain]/_components/menu.tsxnew file mode 100644index 000000000..fd2085c61--- /dev/null+++ b/apps/web/src/app/status-page/[domain]/_components/menu.tsx@@ -0,0 +1,65 @@+"use client";++import * as React from "react";+import { usePathname, useSelectedLayoutSegment } from "next/navigation";+import { MenuIcon } from "lucide-react";++import {+ Button,+ Sheet,+ SheetContent,+ SheetHeader,+ SheetTitle,+ SheetTrigger,+} from "@openstatus/ui";++import { AppLink } from "@/components/layout/app-link";++interface Props {+ navigation: {+ label: string;+ href: string;+ segment: string | null;+ disabled?: boolean;+ }[];+}++export function Menu({ navigation }: Props) {+ const selectedSegment = useSelectedLayoutSegment();+ const [open, setOpen] = React.useState(false);+ const pathname = usePathname();++ React.useEffect(() => {+ setOpen(false);+ }, [pathname]);++ return (+ <Sheet open={open} onOpenChange={(value) => setOpen(value)}>+ <SheetTrigger asChild>+ <Button+ size="icon"+ variant="outline"+ className="rounded-full"+ aria-label="menu"+ >+ <MenuIcon className="h-6 w-6" />+ </Button>+ </SheetTrigger>+ <SheetContent side="top" className="flex flex-col">+ <SheetHeader>+ <SheetTitle className="ml-2 text-left">Menu</SheetTitle>+ </SheetHeader>+ <ul className="grid gap-1">+ {navigation.map(({ href, label, segment, disabled }) => {+ const active = segment === selectedSegment;+ return (+ <li key={href} className="w-full">+ <AppLink {...{ href, label, active, disabled }} />+ </li>+ );+ })}+ </ul>+ </SheetContent>+ </Sheet>+ );+}diff --git a/apps/web/src/app/status-page/[domain]/_components/navbar.tsx b/apps/web/src/app/status-page/[domain]/_components/navbar.tsxdeleted file mode 100644index 9f70fa7c5..000000000--- a/apps/web/src/app/status-page/[domain]/_components/navbar.tsx+++ /dev/null@@ -1,33 +0,0 @@-"use client";--import Link from "next/link";-import { useSelectedLayoutSegment } from "next/navigation";--import { Button } from "@openstatus/ui";--type Props = {- navigation: { label: string; href: string; segment: string | null }[];-};--export function Navbar({ navigation }: Props) {- const selectedSegment = useSelectedLayoutSegment();-- return (- <ul className="flex items-center gap-2">- {navigation.map(({ label, href, segment }) => {- const isActive = segment === selectedSegment;- return (- <li key={segment}>- <Button- variant={isActive ? "secondary" : "ghost"}- size="sm"- asChild- >- <Link href={href}>{label}</Link>- </Button>- </li>- );- })}- </ul>- );-}diff --git a/apps/web/src/app/status-page/[domain]/incidents/[id]/_components/copy-link-button.tsx b/apps/web/src/app/status-page/[domain]/incidents/[id]/_components/copy-link-button.tsxindex ae50420e8..1071c1047 100644--- a/apps/web/src/app/status-page/[domain]/incidents/[id]/_components/copy-link-button.tsx+++ b/apps/web/src/app/status-page/[domain]/incidents/[id]/_components/copy-link-button.tsx@@ -31,7 +31,6 @@ export function CopyLinkButton() {<Buttonvariant="ghost"size="icon"- className="h-7 w-7"onClick={() => {const text =typeof window !== undefined ? window.location.href : "";diff --git a/apps/web/src/app/status-page/[domain]/incidents/[id]/page.tsx b/apps/web/src/app/status-page/[domain]/incidents/[id]/page.tsxindex d3f3913cf..a1dbae017 100644--- a/apps/web/src/app/status-page/[domain]/incidents/[id]/page.tsx+++ b/apps/web/src/app/status-page/[domain]/incidents/[id]/page.tsx@@ -1,13 +1,11 @@-import Link from "next/link";import { notFound } from "next/navigation";-import { ChevronLeft } from "lucide-react";-import { Button, Separator } from "@openstatus/ui";--import { Events } from "@/components/status-update/events";-import { Summary } from "@/components/status-update/summary";+import { Header } from "@/components/dashboard/header";+import {+ StatusReportDescription,+ StatusReportUpdates,+} from "@/components/status-page/status-report";import { api } from "@/trpc/server";-import { setPrefixUrl } from "../../utils";import { CopyLinkButton } from "./_components/copy-link-button";export default async function IncidentPage({@@ -27,21 +25,18 @@ export default async function IncidentPage({);return (- <div className="grid gap-4 text-left">- <div>- <Button variant="link" size="sm" className="px-0" asChild>- <Link href={setPrefixUrl("/", params)}>- <ChevronLeft className="h-4 w-4" /> Back- </Link>- </Button>- </div>- <div className="flex items-center gap-1">- <h3 className="text-xl font-semibold">{report.title}</h3>- <CopyLinkButton />- </div>- <Summary report={report} monitors={affectedMonitors} />- <Separator />- <Events statusReportUpdates={report.statusReportUpdates} />+ <div className="grid gap-8 text-left">+ <Header+ title={report.title}+ description={+ <StatusReportDescription+ report={report}+ monitors={affectedMonitors}+ />+ }+ actions={<CopyLinkButton />}+ />+ <StatusReportUpdates report={report} /></div>);}diff --git a/apps/web/src/app/status-page/[domain]/incidents/page.tsx b/apps/web/src/app/status-page/[domain]/incidents/page.tsxindex 30404539c..a288a9377 100644--- a/apps/web/src/app/status-page/[domain]/incidents/page.tsx+++ b/apps/web/src/app/status-page/[domain]/incidents/page.tsx@@ -16,7 +16,7 @@ export default async function Page({ params }: Props) {if (!page) return notFound();return (- <div className="grid gap-6">+ <div className="grid gap-8"><Headertitle={page.title}description={page.description}diff --git a/apps/web/src/app/status-page/[domain]/layout.tsx b/apps/web/src/app/status-page/[domain]/layout.tsxindex 3142e158f..93f26dd8c 100644--- a/apps/web/src/app/status-page/[domain]/layout.tsx+++ b/apps/web/src/app/status-page/[domain]/layout.tsx@@ -1,19 +1,15 @@import type { Metadata } from "next";-import Image from "next/image";import { notFound } from "next/navigation";-import { allPlans } from "@openstatus/plans";-import {defaultMetadata,ogMetadata,twitterMetadata,} from "@/app/shared-metadata";import { Shell } from "@/components/dashboard/shell";-import { ThemeToggle } from "@/components/theme-toggle";import { api } from "@/trpc/server";-import { Navbar } from "./_components/navbar";-import { SubscribeButton } from "./_components/subscribe-button";+import { Footer } from "./_components/footer";+import { Header } from "./_components/header";import { setPrefixUrl } from "./utils";type Props = {@@ -26,8 +22,6 @@ export default async function StatusPageLayout({ children, params }: Props) {if (!page) return notFound();const plan = page.workspacePlan;- const isSubscribers = allPlans[plan].limits["status-subscribers"];- const isWhiteLabel = allPlans[plan].limits["white-label"];const navigation = [{@@ -40,53 +34,22 @@ export default async function StatusPageLayout({ children, params }: Props) {segment: "incidents",href: setPrefixUrl("/incidents", params),},+ {+ label: "Monitors",+ segment: "monitors",+ href: setPrefixUrl("/monitors", params),+ disabled:+ page.monitors.filter((monitor) => Boolean(monitor.public)).length === 0,+ },];return (- <div className="flex min-h-screen w-full flex-col space-y-6 p-4 md:p-8">- <header className="mx-auto w-full max-w-xl">- <Shell className="mx-auto flex items-center justify-between gap-4 p-2 px-2 md:p-3">- <div className="relative sm:w-[100px]">- {page?.icon ? (- <div className="bg-muted border-border flex h-7 w-7 items-center justify-center overflow-hidden rounded-full border">- <Image- height={28}- width={28}- src={page.icon}- alt={page.title}- className="object-cover"- />- </div>- ) : null}- </div>- <Navbar navigation={navigation} />- <div className="text-end sm:w-[100px]">- {isSubscribers ? <SubscribeButton slug={params.domain} /> : null}- </div>- </Shell>- </header>+ <div className="mx-auto flex min-h-screen w-full max-w-3xl flex-col space-y-6 p-4 md:p-8">+ <Header navigation={navigation} plan={plan} page={page} /><main className="flex h-full w-full flex-1 flex-col">- <Shell className="mx-auto h-full max-w-xl flex-1 px-4 py-4">- {children}- </Shell>+ <Shell className="mx-auto h-full flex-1 px-4 py-4">{children}</Shell></main>- <footer className="z-10 mx-auto flex w-full max-w-xl items-center justify-between">- <div />- {!isWhiteLabel ? (- <p className="text-muted-foreground text-center text-sm">- powered by{" "}- <a- href="https://www.openstatus.dev"- target="_blank"- rel="noreferrer"- className="text-foreground underline underline-offset-4 hover:no-underline"- >- openstatus.dev- </a>- </p>- ) : null}- <ThemeToggle />- </footer>+ <Footer plan={plan} /></div>);}diff --git a/apps/web/src/app/status-page/[domain]/monitors/[id]/page.tsx b/apps/web/src/app/status-page/[domain]/monitors/[id]/page.tsxnew file mode 100644index 000000000..83763001d--- /dev/null+++ b/apps/web/src/app/status-page/[domain]/monitors/[id]/page.tsx@@ -0,0 +1,126 @@+import * as React from "react";+import { notFound } from "next/navigation";+import * as z from "zod";++import { flyRegions } from "@openstatus/db/src/schema";+import type { Region } from "@openstatus/tinybird";+import { OSTinybird } from "@openstatus/tinybird";+import { Separator } from "@openstatus/ui";++import { Header } from "@/components/dashboard/header";+import { CombinedChartWrapper } from "@/components/monitor-charts/combined-chart-wrapper";+import { ButtonReset } from "@/components/monitor-dashboard/button-reset";+import { DatePickerPreset } from "@/components/monitor-dashboard/date-picker-preset";+import { Metrics } from "@/components/monitor-dashboard/metrics";+import { env } from "@/env";+import {+ getMinutesByInterval,+ intervals,+ quantiles,+} from "@/lib/monitor/utils";+import { getPreferredSettings } from "@/lib/preferred-settings/server";+import { api } from "@/trpc/server";++const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });++const periods = ["1d", "7d"] as const; // satisfies Period[]++const DEFAULT_QUANTILE = "p95";+const DEFAULT_INTERVAL = "30m";+const DEFAULT_PERIOD = "7d";++/**+ * allowed URL search params+ */+const searchParamsSchema = z.object({+ statusCode: z.coerce.number().optional(),+ cronTimestamp: z.coerce.number().optional(),+ quantile: z.enum(quantiles).optional().default(DEFAULT_QUANTILE),+ interval: z.enum(intervals).optional().default(DEFAULT_INTERVAL),+ period: z.enum(periods).optional().default(DEFAULT_PERIOD),+ regions: z+ .string()+ .optional()+ .transform(+ (value) =>+ value+ ?.trim()+ ?.split(",")+ .filter((i) => flyRegions.includes(i as Region)) ?? flyRegions,+ ),+});++export default async function Page({+ params,+ searchParams,+}: {+ params: { domain: string; id: string };+ searchParams: { [key: string]: string | string[] | undefined };+}) {+ const id = params.id;+ const search = searchParamsSchema.safeParse(searchParams);+ const preferredSettings = getPreferredSettings();++ const monitor = await api.monitor.getPublicMonitorById.query({+ id: Number(id),+ slug: params.domain,+ });++ if (!monitor || !search.success) {+ return notFound();+ }++ const { period, quantile, interval, regions } = search.data;++ // TODO: work it out easier+ const intervalMinutes = getMinutesByInterval(interval);+ const periodicityMinutes = getMinutesByInterval(monitor.periodicity);++ const isQuantileDisabled = intervalMinutes <= periodicityMinutes;+ const minutes = isQuantileDisabled ? periodicityMinutes : intervalMinutes;++ const metrics = await tb.endpointMetrics(period)({ monitorId: id });++ const data = await tb.endpointChart(period)({+ monitorId: id,+ interval: minutes,+ });++ const metricsByRegion = await tb.endpointMetricsByRegion(period)({+ monitorId: id,+ });++ if (!data || !metrics || !metricsByRegion) return null;++ const isDirty =+ period !== DEFAULT_PERIOD ||+ quantile !== DEFAULT_QUANTILE ||+ interval !== DEFAULT_INTERVAL ||+ flyRegions.length !== regions.length;++ return (+ <div className="relative flex w-full flex-col gap-6">+ <Header+ title={monitor.name}+ description={monitor.description || monitor.url}+ />+ <div className="flex items-center justify-between gap-2">+ <DatePickerPreset defaultValue={period} values={periods} />+ {isDirty ? <ButtonReset /> : null}+ </div>+ <Metrics metrics={metrics} period={period} />+ <Separator className="my-8" />+ <CombinedChartWrapper+ data={data}+ period={period}+ quantile={quantile}+ interval={interval}+ regions={regions as Region[]} // FIXME: not properly reseted after filtered+ monitor={monitor}+ isQuantileDisabled={isQuantileDisabled}+ metricsByRegion={metricsByRegion}+ preferredSettings={preferredSettings}+ />+ </div>+ );+}diff --git a/apps/web/src/app/status-page/[domain]/monitors/page.tsx b/apps/web/src/app/status-page/[domain]/monitors/page.tsxnew file mode 100644index 000000000..871ebd2a5--- /dev/null+++ b/apps/web/src/app/status-page/[domain]/monitors/page.tsx@@ -0,0 +1,118 @@+import Link from "next/link";+import { notFound } from "next/navigation";+import { ChevronRight } from "lucide-react";+import { z } from "zod";++import { OSTinybird } from "@openstatus/tinybird";+import { Button } from "@openstatus/ui";++import { Header } from "@/components/dashboard/header";+import { SimpleChart } from "@/components/monitor-charts/simple-chart";+import { groupDataByTimestamp } from "@/components/monitor-charts/utils";+import { env } from "@/env";+import { quantiles } from "@/lib/monitor/utils";+import { api } from "@/trpc/server";++// Add loading page++/**+ * allowed URL search params+ */+const searchParamsSchema = z.object({+ quantile: z.enum(quantiles).optional().default("p95"),+ period: z.enum(["7d"]).optional().default("7d"),+});++const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });++export default async function Page({+ params,+ searchParams,+}: {+ params: { domain: string };+ searchParams: { [key: string]: string | string[] | undefined };+}) {+ const page = await api.page.getPageBySlug.query({ slug: params.domain });+ const search = searchParamsSchema.safeParse(searchParams);+ if (!page || !search.success) notFound();++ const { quantile, period } = search.data;++ // filter monitor by public or not++ const publicMonitors = page.monitors.filter((monitor) => monitor.public);++ const monitorsWithData =+ publicMonitors.length > 0+ ? await Promise.all(+ publicMonitors?.map(async (monitor) => {+ const data = await tb.endpointChartAllRegions(period)({+ monitorId: String(monitor.id),+ });++ return { monitor, data };+ }),+ )+ : undefined;++ return (+ <div className="grid gap-8">+ <Header+ title={page.title}+ description={page.description}+ className="text-left"+ />+ {monitorsWithData ? (+ <div className="grid gap-6">+ <p className="text-muted-foreground">+ Response time over the{" "}+ <span className="text-foreground font-medium">last {period}</span>{" "}+ across{" "}+ <span className="text-foreground font-medium">+ all selected regions+ </span>{" "}+ within a{" "}+ <span className="text-foreground font-medium">p95 quantile</span>.+ </p>+ <ul className="grid gap-6">+ {monitorsWithData?.map(({ monitor, data }) => {+ const group =+ data &&+ groupDataByTimestamp(+ data.map((data) => ({ ...data, region: "ams" })),+ period,+ quantile,+ );+ return (+ <li key={monitor.id} className="grid gap-2">+ <div className="flex w-full min-w-0 items-center justify-between gap-3">+ <div className="w-full min-w-0">+ <p className="text-sm font-semibold">{monitor.name}</p>+ <p className="text-muted-foreground truncate text-sm">+ {monitor.url}+ </p>+ </div>+ <Button variant="link" size="sm" asChild>+ <Link href={`./monitors/${monitor.id}`}>+ Details <ChevronRight className="h-4 w-4" />+ </Link>+ </Button>+ </div>+ {group ? (+ <SimpleChart data={group.data} region="ams" />+ ) : (+ <p>missing data</p>+ )}+ </li>+ );+ })}+ </ul>+ </div>+ ) : (+ <p className="text-muted-foreground text-center text-sm font-light">+ No public monitor.+ </p>+ )}+ </div>+ );+}diff --git a/apps/web/src/app/status-page/[domain]/page.tsx b/apps/web/src/app/status-page/[domain]/page.tsxindex 2e6656c8c..85592900f 100644--- a/apps/web/src/app/status-page/[domain]/page.tsx+++ b/apps/web/src/app/status-page/[domain]/page.tsx@@ -1,20 +1,14 @@-import Link from "next/link";import { notFound } from "next/navigation";+import { subDays } from "date-fns";-import { Button } from "@openstatus/ui";+import { Separator } from "@openstatus/ui";-import { EmptyState } from "@/components/dashboard/empty-state";import { Header } from "@/components/dashboard/header";import { MonitorList } from "@/components/status-page/monitor-list";import { StatusCheck } from "@/components/status-page/status-check";import { StatusReportList } from "@/components/status-page/status-report-list";import { api } from "@/trpc/server";-const url =- process.env.NODE_ENV === "development"- ? "http://localhost:3000"- : "https://www.openstatus.dev";-type Props = {params: { domain: string };searchParams: { [key: string]: string | string[] | undefined };@@ -25,46 +19,37 @@ export const revalidate = 600;export default async function Page({ params }: Props) {const page = await api.page.getPageBySlug.query({ slug: params.domain });if (!page) return notFound();- const isEmptyState = !(- Boolean(page.monitors.length) || Boolean(page.statusReports.length)- );return (- <div className="mx-auto flex w-full flex-col gap-6">+ <div className="mx-auto flex w-full flex-col gap-8"><Headertitle={page.title}description={page.description}className="text-left"/>- {isEmptyState ? (- <EmptyState- icon="activity"- title="Missing Monitors"- description="Fill your status page with monitors."- action={- <Button asChild>- <Link href={`${url}/app`}>Go to Dashboard</Link>- </Button>- }+ <StatusCheck+ statusReports={page.statusReports}+ incidents={page.incidents}+ />+ <MonitorList+ monitors={page.monitors}+ statusReports={page.statusReports}+ incidents={page.incidents}+ />+ <Separator />+ <div className="grid gap-6">+ <div>+ <h2 className="text-xl font-semibold">Latest Incidents</h2>+ <p className="text-muted-foreground text-sm">+ Incidents of the last 7 days or that have not been resolved yet.+ </p>+ </div>+ <StatusReportList+ statusReports={page.statusReports}+ monitors={page.monitors}+ filter={{ date: subDays(Date.now(), 7), open: true }}/>- ) : (- <>- <StatusCheck- statusReports={page.statusReports}- incidents={page.incidents}- />- <MonitorList- monitors={page.monitors}- statusReports={page.statusReports}- incidents={page.incidents}- />- <StatusReportList- statusReports={page.statusReports}- monitors={page.monitors}- context="latest"- />- </>- )}+ </div></div>);}diff --git a/apps/web/src/components/forms/monitor/form.tsx b/apps/web/src/components/forms/monitor/form.tsxindex 28c518fc1..f8d140a56 100644--- a/apps/web/src/components/forms/monitor/form.tsx+++ b/apps/web/src/components/forms/monitor/form.tsx@@ -82,6 +82,7 @@ export function MonitorForm({notifications: defaultValues?.notifications ?? [],pages: defaultValues?.pages ?? [],tags: defaultValues?.tags ?? [],+ public: defaultValues?.public ?? false,statusAssertions: _assertions.filter((a) => a.type === "status") as any, // TS considers a.type === "header"headerAssertions: _assertions.filter((a) => a.type === "header") as any, // TS considers a.type === "status"},@@ -286,7 +287,7 @@ export function MonitorForm({</TabsContent>{defaultValues?.id ? (<TabsContent value="danger">- <SectionDanger monitorId={defaultValues.id} />+ <SectionDanger monitorId={defaultValues.id} {...{ form }} /></TabsContent>) : null}</Tabs>diff --git a/apps/web/src/components/forms/monitor/section-danger.tsx b/apps/web/src/components/forms/monitor/section-danger.tsxindex 940466c1d..fba7b7a44 100644--- a/apps/web/src/components/forms/monitor/section-danger.tsx+++ b/apps/web/src/components/forms/monitor/section-danger.tsx@@ -2,7 +2,9 @@import React from "react";import { useRouter } from "next/navigation";+import type { UseFormReturn } from "react-hook-form";+import type { InsertMonitor } from "@openstatus/db/src/schema";import {AlertDialog,AlertDialogAction,@@ -14,6 +16,12 @@ import {AlertDialogTitle,AlertDialogTrigger,Button,+ Checkbox,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,} from "@openstatus/ui";import { LoadingAnimation } from "@/components/loading-animation";@@ -23,9 +31,10 @@ import { SectionHeader } from "../shared/section-header";interface Props {monitorId: number;+ form: UseFormReturn<InsertMonitor>;}-export function SectionDanger({ monitorId }: Props) {+export function SectionDanger({ monitorId, form }: Props) {const router = useRouter();const [open, setOpen] = React.useState(false);const [isPending, startTransition] = React.useTransition();@@ -47,38 +56,70 @@ export function SectionDanger({ monitorId }: Props) {<div className="grid w-full gap-4"><SectionHeadertitle="Danger Zone"- description="This action cannot be undone. This will permanently delete the monitor."+ description="Be aware of the changes you are about to make."/>- <div>- <AlertDialog open={open} onOpenChange={setOpen}>- <AlertDialogTrigger asChild>- <Button variant="destructive" className="w-full sm:w-auto">- Delete- </Button>- </AlertDialogTrigger>- <AlertDialogContent>- <AlertDialogHeader>- <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>- <AlertDialogDescription>- This action cannot be undone. This will permanently delete the- monitor.- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction- onClick={(e) => {- e.preventDefault();- onDelete();- }}- disabled={isPending}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90"- >- {!isPending ? "Delete" : <LoadingAnimation />}- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>+ <div className="grid gap-4 sm:grid-cols-3">+ <FormField+ control={form.control}+ name="public"+ render={({ field }) => (+ <FormItem className="flex flex-row items-start space-x-3 space-y-0 sm:col-span-2">+ <FormControl>+ <Checkbox+ checked={field.value ?? false}+ onCheckedChange={field.onChange}+ />+ </FormControl>+ <div className="space-y-1 leading-none">+ <FormLabel>Allow public monitor</FormLabel>+ <FormDescription>+ Change monitor visibility. When checked, the monitor stats+ from the overview page will be public. You will be able to+ share it via a connected status page or{" "}+ <code className="underline underline-offset-4">+ openstatus.dev/public/monitors/{form.getValues("id")}+ </code>+ .+ </FormDescription>+ </div>+ </FormItem>+ )}+ />+ <div className="col-start-1 flex flex-col items-center gap-4 sm:col-span-2 sm:flex-row">+ <AlertDialog open={open} onOpenChange={setOpen}>+ <AlertDialogTrigger asChild>+ <Button variant="destructive" className="w-full sm:w-auto">+ Delete+ </Button>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>+ <AlertDialogDescription>+ This action cannot be undone. This will permanently delete the+ monitor.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ onClick={(e) => {+ e.preventDefault();+ onDelete();+ }}+ disabled={isPending}+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"+ >+ {!isPending ? "Delete" : <LoadingAnimation />}+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ <FormDescription className="order-1 text-red-500 sm:order-2">+ This action cannot be undone. This will permanently delete the+ monitor.+ </FormDescription>+ </div></div></div>);diff --git a/apps/web/src/components/layout/public-header.tsx b/apps/web/src/components/layout/public-header.tsxnew file mode 100644index 000000000..dd849ef4d--- /dev/null+++ b/apps/web/src/components/layout/public-header.tsx@@ -0,0 +1,18 @@+import { cn } from "@/lib/utils";+import { BrandName } from "./brand-name";+import { LoginButton } from "./login-button";++interface Props {+ className?: string;+}++export function PublicHeader({ className }: Props) {+ return (+ <header+ className={cn("flex w-full items-center justify-between", className)}+ >+ <BrandName />+ <LoginButton />+ </header>+ );+}diff --git a/apps/web/src/components/layout/public-layout.tsx b/apps/web/src/components/layout/public-layout.tsxnew file mode 100644index 000000000..2e468ea38--- /dev/null+++ b/apps/web/src/components/layout/public-layout.tsx@@ -0,0 +1,18 @@+import { ClerkProvider } from "@clerk/nextjs";++import { MarketingFooter } from "./marketing-footer";+import { PublicHeader } from "./public-header";++export function PublicLayout({ children }: { children: React.ReactNode }) {+ return (+ <ClerkProvider>+ <main className="flex min-h-screen w-full flex-col items-center justify-center gap-8 p-4 md:p-8">+ <PublicHeader className="mx-auto w-full max-w-4xl" />+ <div className="mx-auto flex w-full max-w-4xl flex-1 flex-col items-start justify-center">+ {children}+ </div>+ <MarketingFooter className="mx-auto w-full max-w-4xl" />+ </main>+ </ClerkProvider>+ );+}diff --git a/apps/web/src/components/marketing/bottom-cta.tsx b/apps/web/src/components/marketing/bottom-cta.tsxdeleted file mode 100644index 71cab480b..000000000--- a/apps/web/src/components/marketing/bottom-cta.tsx+++ /dev/null@@ -1,24 +0,0 @@-import Link from "next/link";--import { Button } from "@openstatus/ui";--export function BottomCTA() {- return (- <div className="my-8 flex flex-col items-center justify-between gap-6">- <p className="text-muted-foreground max-w-lg text-center text-lg">- Learn over time how your services are performing, and inform your users- when there are issues.- </p>- <div className="flex gap-2">- <Button className="rounded-full" asChild>- <Link href="/app/sign-up">Start for Free</Link>- </Button>- <Button className="rounded-full" variant="outline" asChild>- <Link href="/cal" target="_blank">- Schedule a Demo- </Link>- </Button>- </div>- </div>- );-}diff --git a/apps/web/src/components/marketing/in-between-cta.tsx b/apps/web/src/components/marketing/in-between-cta.tsxnew file mode 100644index 000000000..dd4287149--- /dev/null+++ b/apps/web/src/components/marketing/in-between-cta.tsx@@ -0,0 +1,59 @@+import type { ReactNode } from "react";+import Link from "next/link";++import { Button } from "@openstatus/ui";++interface InBetweenCTAProps {+ description: string;+ actions: Record<+ "primary" | "secondary",+ { label: string; href: string; target?: string }+ >;+}++export function InBetweenCTA({ description, actions }: InBetweenCTAProps) {+ const { primary, secondary } = actions;+ return (+ <div className="my-8 flex flex-col items-center justify-between gap-6">+ <p className="text-muted-foreground max-w-lg text-center text-lg">+ {description}+ </p>+ <div className="flex gap-2">+ <Button className="rounded-full" asChild>+ <Link href={primary.href} target={primary.target}>+ {primary.label}+ </Link>+ </Button>+ <Button className="rounded-full" variant="outline" asChild>+ <Link href={secondary.href} target={secondary.target}>+ {secondary.label}+ </Link>+ </Button>+ </div>+ </div>+ );+}++export function MiddleCTA() {+ return (+ <InBetweenCTA+ description="Sick of booking a demo to know more? Test your endpoint or check our public dashboard right away."+ actions={{+ primary: { label: "Public Dashboard", href: "/public/monitors/1" },+ secondary: { label: "Speed Checker", href: "/play/check" },+ }}+ />+ );+}++export function BottomCTA() {+ return (+ <InBetweenCTA+ description="Learn over time how your services are performing, and inform your users when there are issues."+ actions={{+ primary: { label: "Start for Free", href: "/app/sign-up" },+ secondary: { label: "Schedule a Demo", href: "/cal", target: "_blank" },+ }}+ />+ );+}diff --git a/apps/web/src/components/marketing/monitor/card.tsx b/apps/web/src/components/marketing/monitor/card.tsxindex 6aa920eeb..b2d2b9eba 100644--- a/apps/web/src/components/marketing/monitor/card.tsx+++ b/apps/web/src/components/marketing/monitor/card.tsx@@ -26,7 +26,7 @@ export function MonitoringCard() {<Globe /><CardFeatureContainer>{features?.map((feature, i) => <CardFeature key={i} {...feature} />)}- <div className="text-center">+ <div className="order-first text-center md:order-none"><Button asChild variant="outline" className="rounded-full"><Link href="/play/checker">Playground</Link></Button>diff --git a/apps/web/src/components/monitor-charts/combined-chart-wrapper.tsx b/apps/web/src/components/monitor-charts/combined-chart-wrapper.tsxindex d37bfffa8..96fc0a042 100644--- a/apps/web/src/components/monitor-charts/combined-chart-wrapper.tsx+++ b/apps/web/src/components/monitor-charts/combined-chart-wrapper.tsx@@ -3,7 +3,7 @@import { useMemo } from "react";import { LineChart } from "lucide-react";-import type { Monitor } from "@openstatus/db/src/schema";+import type { Monitor, PublicMonitor } from "@openstatus/db/src/schema";import type {Region,ResponseGraph,@@ -37,7 +37,7 @@ export function CombinedChartWrapper({quantile: Quantile;interval: Interval;regions: Region[];- monitor: Monitor;+ monitor: Monitor | PublicMonitor;isQuantileDisabled: boolean;metricsByRegion: ResponseTimeMetricsByRegion[];preferredSettings: PreferredSettings;diff --git a/apps/web/src/components/monitor-charts/region-table.tsx b/apps/web/src/components/monitor-charts/region-table.tsxindex b7a4d1e13..cdf568823 100644--- a/apps/web/src/components/monitor-charts/region-table.tsx+++ b/apps/web/src/components/monitor-charts/region-table.tsx@@ -27,7 +27,7 @@ export function RegionTable({regions,data,metricsByRegion,- caption = "A list of your regions.",+ caption = "A list of all the selected regions.",}: RegionTableProps) {// console.log(JSON.stringify({ regions, data, metricsByRegion }, null, 2));return (diff --git a/apps/web/src/components/monitor-charts/simple-chart.tsx b/apps/web/src/components/monitor-charts/simple-chart.tsxindex 497f62264..0a1fa0986 100644--- a/apps/web/src/components/monitor-charts/simple-chart.tsx+++ b/apps/web/src/components/monitor-charts/simple-chart.tsx@@ -30,6 +30,7 @@ export function SimpleChart({ data, region }: SimpleChartProps) {valueFormatter={dataFormatter}curveType="monotone"autoMinValue+ showAnimationnoDataText=""showXAxis={false}showYAxis={false}@@ -38,7 +39,6 @@ export function SimpleChart({ data, region }: SimpleChartProps) {customTooltip={customTooltip}// FEATURE: it would be nice, if on click, the tooltip would be open// onValueChange={(v) => setValue(v)}- showAnimation={true}/>);}diff --git a/apps/web/src/components/monitor-dashboard/metrics.tsx b/apps/web/src/components/monitor-dashboard/metrics.tsxindex ef0dfdc2a..d9255d54b 100644--- a/apps/web/src/components/monitor-dashboard/metrics.tsx+++ b/apps/web/src/components/monitor-dashboard/metrics.tsx@@ -18,9 +18,11 @@ const metricsOrder = [export function Metrics({metrics,period,+ showErrorLink,}: {metrics?: ResponseTimeMetrics[];period: Period;+ showErrorLink?: boolean;}) {if (!metrics) return null;@@ -41,8 +43,8 @@ export function Metrics({: undefined;return (- <div className="grid gap-6">- <div className="grid grid-cols-2 gap-4 sm:grid-cols-4 md:grid-cols-5 md:gap-6">+ <div className="@container grid gap-6">+ <div className="@xl:grid-cols-4 @3xl:grid-cols-5 @3xl:gap-6 grid grid-cols-2 gap-4"><MetricsCardtitle="uptime"value={uptime * 100}@@ -74,7 +76,7 @@ export function Metrics({<MetricsCard title="total pings" value={current.count} suffix="#" /></div><div className="grid gap-4">- <div className="grid grid-cols-2 gap-4 sm:grid-cols-4 md:grid-cols-5 md:gap-6">+ <div className="@xl:grid-cols-4 @3xl:grid-cols-5 @3xl:gap-6 grid grid-cols-2 gap-4">{metricsOrder.map((key) => {const value = current[key];const lastValue = last[key];@@ -100,7 +102,9 @@ export function Metrics({over all the regions and compared with the previous period.</p>{/* restricted to max 3d as we only support it in the list -> TODO: add more periods */}- {failures > 0 && ["1h", "1d", "3d", "7d"].includes(period) ? (+ {showErrorLink &&+ failures > 0 &&+ ["1h", "1d", "3d", "7d"].includes(period) ? (<p className="text-destructive text-xs">The monitor had {failures} failed ping(s). See more in the{" "}<Linkdiff --git a/apps/web/src/components/status-page/process-message.tsx b/apps/web/src/components/status-page/process-message.tsxnew file mode 100644index 000000000..c864d7256--- /dev/null+++ b/apps/web/src/components/status-page/process-message.tsx@@ -0,0 +1,22 @@+import type { AnchorHTMLAttributes } from "react";+import { createElement, Fragment } from "react";+import rehypeReact from "rehype-react";+import remarkParse from "remark-parse";+import remarkRehype from "remark-rehype";+import { unified } from "unified";++export function ProcessMessage({ value }: { value: string }) {+ return unified()+ .use(remarkParse)+ .use(remarkRehype)+ .use(rehypeReact, {+ createElement,+ Fragment,+ components: {+ a: (props: AnchorHTMLAttributes<HTMLAnchorElement>) => {+ return <a target="_blank" rel="noreferrer" {...props} />;+ },+ },+ })+ .processSync(value).result;+}diff --git a/apps/web/src/components/status-page/status-check.tsx b/apps/web/src/components/status-page/status-check.tsxindex c4496b0e3..01886aad9 100644--- a/apps/web/src/components/status-page/status-check.tsx+++ b/apps/web/src/components/status-page/status-check.tsx@@ -22,7 +22,7 @@ export async function StatusCheck({return (<div className="flex flex-col items-center gap-3"><div className="flex items-center gap-3">- <p className="text-lg font-semibold">{details.long}</p>+ <h2 className="text-xl font-semibold">{details.long}</h2><span className={cn("rounded-full border p-1.5", className)}><StatusIcon variant={details.variant} /></span>diff --git a/apps/web/src/components/status-page/status-report-list.tsx b/apps/web/src/components/status-page/status-report-list.tsxindex 4dec40692..303dc4317 100644--- a/apps/web/src/components/status-page/status-report-list.tsx+++ b/apps/web/src/components/status-page/status-report-list.tsx@@ -1,51 +1,34 @@"use client";-import Link from "next/link";-import { useParams } from "next/navigation";-import { ChevronRight } from "lucide-react";-import type {PublicMonitor,StatusReportWithUpdates,} from "@openstatus/db/src/schema";-import { Button, Separator } from "@openstatus/ui";+import { Separator } from "@openstatus/ui";-import { setPrefixUrl } from "@/app/status-page/[domain]/utils";import { notEmpty } from "@/lib/utils";-import { Events } from "../status-update/events";-import { Summary } from "../status-update/summary";--// TODO: change layout - it is too packed with data rn+import { StatusReport } from "./status-report";export const StatusReportList = ({statusReports,monitors,- context = "all",+ filter,}: {statusReports: StatusReportWithUpdates[];monitors: PublicMonitor[];- context?: "all" | "latest"; // latest 7 days+ filter?: { date: Date; open?: boolean };}) => {- const params = useParams<{ domain: string }>();- const lastWeek = Date.now() - 1000 * 60 * 60 * 24 * 7;-- function getLastWeekOrOpenIncidents() {- return statusReports.filter((incident) => {- const hasLastWeekReports = incident.statusReportUpdates.some(- (update) => update.date.getTime() > lastWeek,+ function getFilteredReports() {+ if (!filter?.date) return statusReports;+ return statusReports.filter((report) => {+ if (filter.open && report.status !== "resolved") return true;+ return report.statusReportUpdates.some(+ (update) => update.date.getTime() > filter?.date?.getTime(),);- const hasOpenIncident = ["identified", "investigating"].includes(- incident.status,- );-- return hasLastWeekReports || hasOpenIncident;});}- const reports =- context === "all" ? statusReports : getLastWeekOrOpenIncidents();-- reports.sort((a, b) => {+ const reports = getFilteredReports().sort((a, b) => {if (a.updatedAt == undefined) return 1;if (b.updatedAt == undefined) return -1;return b.updatedAt.getTime() - a.updatedAt.getTime();@@ -54,53 +37,35 @@ export const StatusReportList = ({return (<>{reports?.length > 0 ? (- <div className="grid gap-3">- <p className="text-muted-foreground text-sm font-light">- {context === "all" ? "All incidents" : "Latest incidents"}- </p>- <div className="grid gap-8">- {reports.map((report) => {- const affectedMonitors = report.monitorsToStatusReports- .map(({ monitorId }) => {- const monitor = monitors.find(({ id }) => monitorId === id);- return monitor || undefined;- })- .filter(notEmpty);- return (- <div key={report.id} className="group grid gap-4 text-left">- <div className="flex items-center gap-1">- <h3 className="text-xl font-semibold">{report.title}</h3>- <Button- variant="ghost"- size="icon"- className="invisible h-7 w-7 group-hover:visible"- asChild- >- <Link- href={setPrefixUrl(`/incidents/${report.id}`, params)}- >- <ChevronRight className="h-4 w-4" />- </Link>- </Button>- </div>- <Summary report={report} monitors={affectedMonitors} />- <Separator />- <Events- statusReportUpdates={report.statusReportUpdates}- collabsible- />- </div>- );- })}- </div>+ <div className="grid gap-8">+ {reports.map((report, i) => {+ const affectedMonitors = report.monitorsToStatusReports+ .map(({ monitorId }) => {+ const monitor = monitors.find(({ id }) => monitorId === id);+ return monitor || undefined;+ })+ .filter(notEmpty);+ const isLast = reports.length - 1 === i;++ return (+ <div key={report.id} className="grid gap-6">+ <StatusReport monitors={affectedMonitors} report={report} />+ {!isLast ? <Separator /> : null}+ </div>+ );+ })}</div>) : (- <p className="text-muted-foreground text-center text-sm font-light">- {context === "all"- ? "No incidents."- : "No incidents in the last week."}- </p>+ <EmptyState />)}</>);};++function EmptyState() {+ return (+ <p className="text-muted-foreground text-center text-sm font-light">+ No incident reported.+ </p>+ );+}diff --git a/apps/web/src/components/status-page/status-report.tsx b/apps/web/src/components/status-page/status-report.tsxnew file mode 100644index 000000000..8b719dbb2--- /dev/null+++ b/apps/web/src/components/status-page/status-report.tsx@@ -0,0 +1,118 @@+"use client";++import { Fragment } from "react";+import Link from "next/link";+import { useParams } from "next/navigation";+import { format } from "date-fns";+import { ChevronRight } from "lucide-react";++import type {+ PublicMonitor,+ StatusReportWithUpdates,+} from "@openstatus/db/src/schema";+import { Badge, Button } from "@openstatus/ui";++import { setPrefixUrl } from "@/app/status-page/[domain]/utils";+import { StatusBadge } from "../status-update/status-badge";+import { ProcessMessage } from "./process-message";++function StatusReport({+ report,+ monitors,+}: {+ report: StatusReportWithUpdates;+ monitors: PublicMonitor[];+}) {+ return (+ <div className="group grid gap-4">+ <div className="grid gap-1">+ <StatusReportHeader {...{ report }} />+ <StatusReportDescription {...{ report, monitors }} />+ </div>+ <StatusReportUpdates {...{ report }} />+ </div>+ );+}++function StatusReportHeader({ report }: { report: StatusReportWithUpdates }) {+ const params = useParams<{ domain: string }>();+ return (+ <div className="flex items-center gap-2">+ <h3 className="text-2xl font-semibold">{report.title}</h3>+ <Button+ variant="ghost"+ size="icon"+ className="text-muted-foreground/50 group-hover:text-foreground"+ asChild+ >+ <Link href={setPrefixUrl(`/incidents/${report.id}`, params)}>+ <ChevronRight className="h-4 w-4" />+ </Link>+ </Button>+ </div>+ );+}++function StatusReportDescription({+ report,+ monitors,+}: {+ report: StatusReportWithUpdates;+ monitors: PublicMonitor[];+}) {+ const firstReport =+ report.statusReportUpdates[report.statusReportUpdates.length - 1];+ return (+ <div className="flex flex-wrap items-center gap-2">+ <p className="text-muted-foreground">+ {format(firstReport.date || new Date(), "LLL dd, y HH:mm")}+ </p>+ <span className="text-muted-foreground/50 text-xs">•</span>+ <StatusBadge status={report.status} />+ {monitors.length > 0 ? (+ <>+ <span className="text-muted-foreground/50 text-xs">•</span>+ {monitors.map((monitor) => (+ <Badge key={monitor.id} variant="secondary">+ {monitor.name}+ </Badge>+ ))}+ </>+ ) : null}+ </div>+ );+}++// reports are already `orderBy: desc(report.date)` within the query itself+function StatusReportUpdates({ report }: { report: StatusReportWithUpdates }) {+ return (+ <div className="grid gap-4 md:grid-cols-4">+ {report.statusReportUpdates.map((update) => {+ return (+ <Fragment key={update.id}>+ <div className="flex items-center gap-2 md:col-span-1 md:flex-col md:items-start md:gap-1">+ <p className="font-medium capitalize">{update.status}</p>+ <p className="text-muted-foreground font-mono text-sm md:text-xs">+ {format(update.date, "LLL dd, y HH:mm")}+ </p>+ </div>+ <div className="prose dark:prose-invert md:col-span-3">+ <ProcessMessage value={update.message} />+ </div>+ </Fragment>+ );+ })}+ </div>+ );+}++StatusReport.Header = StatusReportHeader;+StatusReport.Description = StatusReportDescription;+StatusReport.Updates = StatusReportUpdates;++export {+ StatusReport,+ StatusReportDescription,+ StatusReportHeader,+ StatusReportUpdates,+};diff --git a/apps/web/src/components/status-update/status-badge.tsx b/apps/web/src/components/status-update/status-badge.tsxindex d84708823..34b9bad25 100644--- a/apps/web/src/components/status-update/status-badge.tsx+++ b/apps/web/src/components/status-update/status-badge.tsx@@ -1,14 +1,22 @@+import type { StatusReport } from "@openstatus/db/src/schema";import { Badge } from "@openstatus/ui";import { statusDict } from "@/data/incidents-dictionary";import { cn } from "@/lib/utils";import { Icons } from "../icons";+const variant = {+ investigating: "border-rose-500/20 bg-rose-500/10 text-rose-500",+ identified: "border-amber-500/20 bg-amber-500/10 text-amber-500",+ monitoring: "border-blue-500/20 bg-blue-500/10 text-blue-500",+ resolved: "border-green-500/20 bg-green-500/10 text-green-500",+} satisfies Record<StatusReport["status"], string>;+export function StatusBadge({status,className,}: {- status: keyof typeof statusDict;+ status: StatusReport["status"];className?: string;}) {const { label, icon } = statusDict[status];@@ -16,20 +24,7 @@ export function StatusBadge({return (<Badgevariant="outline"- className={cn(- "font-normal",- {- "border-rose-500/20 bg-rose-500/10 text-rose-500":- status === "investigating",- "border-amber-500/20 bg-amber-500/10 text-amber-500":- status === "identified",- "border-blue-500/20 bg-blue-500/10 text-blue-500":- status === "monitoring",- "border-green-500/20 bg-green-500/10 text-green-500":- status === "resolved",- },- className,- )}+ className={cn("font-normal", variant[status], className)}><Icon className="mr-1 h-3 w-3" />{label}diff --git a/apps/web/src/components/status-update/summary.tsx b/apps/web/src/components/status-update/summary.tsxindex f783ab76c..0ff90bea6 100644--- a/apps/web/src/components/status-update/summary.tsx+++ b/apps/web/src/components/status-update/summary.tsx@@ -16,13 +16,9 @@ export function Summary({report: StatusReport & { statusReportUpdates: StatusReportUpdate[] };monitors: Pick<Monitor, "name">[];}) {- const sortedStatusReportUpdates = report.statusReportUpdates.sort(- (a, b) => a.date.getTime() - b.date.getTime(),- );-- const firstUpdate = sortedStatusReportUpdates?.[0];+ const firstUpdate = report.statusReportUpdates?.[0];const lastUpdate =- sortedStatusReportUpdates?.[sortedStatusReportUpdates.length - 1];+ report.statusReportUpdates?.[report.statusReportUpdates.length - 1];return (<div className="grid grid-cols-5 gap-3 text-sm">diff --git a/apps/web/src/config/features.ts b/apps/web/src/config/features.tsindex 2ae49f48d..6d8cb76d7 100644--- a/apps/web/src/config/features.ts+++ b/apps/web/src/config/features.ts@@ -37,7 +37,7 @@ export const cardConfig = {icon: "globe",catchline: "Latency Monitoring.",description:- "Monitor the latency of your endpoints from all over the world. We currently support all the continents.",+ "Monitor the latency of your endpoints from all over the world. We support all the continents.",},{icon: "play",diff --git a/apps/web/src/content/changelog/public-monitors.mdx b/apps/web/src/content/changelog/public-monitors.mdxnew file mode 100644index 000000000..72711882b--- /dev/null+++ b/apps/web/src/content/changelog/public-monitors.mdx@@ -0,0 +1,20 @@+---+title: Public Monitors+description: Make your monitors public and share more metrics with your users.+image: /assets/changelog/public-monitors.png+publishedAt: 2024-04-14+---++You can now change the monitors visibility to public. This will allow you to+share the monitor's metrics _(the overview page)_ with your users. The period is+restricted to **1d** and **7d** for now.++The monitor can be accessed either by the **public URL** or/and by embedding the+monitor within a **status page**.++- Public URL:+ [openstatus.dev/public/monitors/1](https://openstatus.dev/public/monitors/1)+- Status Page URL:+ [status.openstatus.dev/monitors/1](https://status.openstatus.dev/monitors/1)++You can enable public mode from the monitor _Danger_ section setting.diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.tsindex c55c004a9..cab46178f 100644--- a/apps/web/src/middleware.ts+++ b/apps/web/src/middleware.ts@@ -87,6 +87,7 @@ export default authMiddleware({"/incidents", // used when trying subdomain slug via status.documenso.com/incidents"/incidents/(.*)", // used when trying subdomain slug via status.documenso.com/incidents/123"/verify/(.*)", // used when trying subdomain slug via status.documenso.com/incidents+ "/public/(.*)",],ignoredRoutes: ["/api/og", "/discord", "/github", "/status-page/(.*)"], // FIXME: we should check the `publicRoutes`beforeAuth: before,diff --git a/apps/web/tailwind.config.ts b/apps/web/tailwind.config.tsindex a6212698e..9d05c44a3 100644--- a/apps/web/tailwind.config.ts+++ b/apps/web/tailwind.config.ts@@ -216,6 +216,7 @@ module.exports = {/* */plugins: [require("tailwindcss-animate"),+ require("@tailwindcss/container-queries"),require("@tailwindcss/typography"),require("@headlessui/tailwindcss"),],diff --git a/packages/api/src/router/monitor.ts b/packages/api/src/router/monitor.tsindex 997183c03..d0950cb8b 100644--- a/packages/api/src/router/monitor.ts+++ b/packages/api/src/router/monitor.ts@@ -21,6 +21,7 @@ import {selectMonitorSchema,selectMonitorTagSchema,selectNotificationSchema,+ selectPublicMonitorSchema,} from "@openstatus/db/src/schema";import { allPlans } from "@openstatus/plans";@@ -189,6 +190,36 @@ export const monitorRouter = createTRPCRouter({return parsedMonitor.data;}),+ getPublicMonitorById: publicProcedure+ // REMINDER: if on status page, we should check if the monitor is associated with the page+ // otherwise, using `/public` we don't need to check+ .input(z.object({ id: z.number(), slug: z.string().optional() }))+ .query(async (opts) => {+ const _monitor = await opts.ctx.db.query.monitor.findFirst({+ where: and(+ eq(monitor.id, opts.input.id),+ isNull(monitor.deletedAt),+ eq(monitor.public, true),+ ),+ });+ if (!_monitor) return undefined;++ if (opts.input.slug) {+ const _page = await opts.ctx.db.query.page.findFirst({+ where: sql`lower(${page.slug}) = ${opts.input.slug} OR lower(${page.customDomain}) = ${opts.input.slug}`,+ with: { monitorsToPages: true },+ });++ const hasPageRelation = _page?.monitorsToPages.find(+ ({ monitorId }) => _monitor.id === monitorId,+ );++ if (!hasPageRelation) return undefined;+ }++ return selectPublicMonitorSchema.parse(_monitor);+ }),+update: protectedProcedure.input(insertMonitorSchema).mutation(async (opts) => {diff --git a/packages/api/src/router/page.ts b/packages/api/src/router/page.tsindex 275523746..703ccaf0b 100644--- a/packages/api/src/router/page.ts+++ b/packages/api/src/router/page.ts@@ -222,7 +222,9 @@ export const pageRouter = createTRPCRouter({? await opts.ctx.db.query.statusReport.findMany({where: or(inArray(statusReport.id, statusReportIds)),with: {- statusReportUpdates: true,+ statusReportUpdates: {+ orderBy: (reports, { desc }) => desc(reports.date),+ },monitorsToStatusReports: { with: { monitor: true } },pagesToStatusReports: true,},diff --git a/packages/api/src/router/statusReport.ts b/packages/api/src/router/statusReport.tsindex 4767ede28..15a2ef67c 100644--- a/packages/api/src/router/statusReport.ts+++ b/packages/api/src/router/statusReport.ts@@ -393,7 +393,9 @@ export const statusReportRouter = createTRPCRouter({),with: {monitorsToStatusReports: { with: { monitor: true } },- statusReportUpdates: true,+ statusReportUpdates: {+ orderBy: (reports, { desc }) => desc(reports.date),+ },},});diff --git a/packages/db/drizzle/0025_strong_thunderball.sql b/packages/db/drizzle/0025_strong_thunderball.sqlnew file mode 100644index 000000000..0d2a82327--- /dev/null+++ b/packages/db/drizzle/0025_strong_thunderball.sql@@ -0,0 +1 @@+ALTER TABLE monitor ADD `public` integer DEFAULT false;\ No newline at end of filediff --git a/packages/db/drizzle/meta/0025_snapshot.json b/packages/db/drizzle/meta/0025_snapshot.jsonnew file mode 100644index 000000000..7edfe20c2--- /dev/null+++ b/packages/db/drizzle/meta/0025_snapshot.json@@ -0,0 +1,1641 @@+{+ "version": "5",+ "dialect": "sqlite",+ "id": "40ddc769-9652-470e-87af-71f269131bc3",+ "prevId": "96f82403-94f3-49fd-871b-946bc0a687f2",+ "tables": {+ "status_report_to_monitors": {+ "name": "status_report_to_monitors",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status_report_id": {+ "name": "status_report_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_report_to_monitors_monitor_id_monitor_id_fk": {+ "name": "status_report_to_monitors_monitor_id_monitor_id_fk",+ "tableFrom": "status_report_to_monitors",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "status_report_to_monitors_status_report_id_status_report_id_fk": {+ "name": "status_report_to_monitors_status_report_id_status_report_id_fk",+ "tableFrom": "status_report_to_monitors",+ "tableTo": "status_report",+ "columnsFrom": [+ "status_report_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "status_report_to_monitors_monitor_id_status_report_id_pk": {+ "columns": [+ "monitor_id",+ "status_report_id"+ ],+ "name": "status_report_to_monitors_monitor_id_status_report_id_pk"+ }+ },+ "uniqueConstraints": {}+ },+ "status_reports_to_pages": {+ "name": "status_reports_to_pages",+ "columns": {+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status_report_id": {+ "name": "status_report_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_reports_to_pages_page_id_page_id_fk": {+ "name": "status_reports_to_pages_page_id_page_id_fk",+ "tableFrom": "status_reports_to_pages",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "status_reports_to_pages_status_report_id_status_report_id_fk": {+ "name": "status_reports_to_pages_status_report_id_status_report_id_fk",+ "tableFrom": "status_reports_to_pages",+ "tableTo": "status_report",+ "columnsFrom": [+ "status_report_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "status_reports_to_pages_page_id_status_report_id_pk": {+ "columns": [+ "page_id",+ "status_report_id"+ ],+ "name": "status_reports_to_pages_page_id_status_report_id_pk"+ }+ },+ "uniqueConstraints": {}+ },+ "status_report": {+ "name": "status_report",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_report_workspace_id_workspace_id_fk": {+ "name": "status_report_workspace_id_workspace_id_fk",+ "tableFrom": "status_report",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "status_report_update": {+ "name": "status_report_update",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text(4)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "date": {+ "name": "date",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "message": {+ "name": "message",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status_report_id": {+ "name": "status_report_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_report_update_status_report_id_status_report_id_fk": {+ "name": "status_report_update_status_report_id_status_report_id_fk",+ "tableFrom": "status_report_update",+ "tableTo": "status_report",+ "columnsFrom": [+ "status_report_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "integration": {+ "name": "integration",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "credential": {+ "name": "credential",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "data": {+ "name": "data",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "integration_workspace_id_workspace_id_fk": {+ "name": "integration_workspace_id_workspace_id_fk",+ "tableFrom": "integration",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "page": {+ "name": "page",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "icon": {+ "name": "icon",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "slug": {+ "name": "slug",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "custom_domain": {+ "name": "custom_domain",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "published": {+ "name": "published",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "page_slug_unique": {+ "name": "page_slug_unique",+ "columns": [+ "slug"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "page_workspace_id_workspace_id_fk": {+ "name": "page_workspace_id_workspace_id_fk",+ "tableFrom": "page",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "monitor": {+ "name": "monitor",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "job_type": {+ "name": "job_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'other'"+ },+ "periodicity": {+ "name": "periodicity",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'other'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'active'"+ },+ "active": {+ "name": "active",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "regions": {+ "name": "regions",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "url": {+ "name": "url",+ "type": "text(2048)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "headers": {+ "name": "headers",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "method": {+ "name": "method",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'GET'"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "assertions": {+ "name": "assertions",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_workspace_id_workspace_id_fk": {+ "name": "monitor_workspace_id_workspace_id_fk",+ "tableFrom": "monitor",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "monitors_to_pages": {+ "name": "monitors_to_pages",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitors_to_pages_monitor_id_monitor_id_fk": {+ "name": "monitors_to_pages_monitor_id_monitor_id_fk",+ "tableFrom": "monitors_to_pages",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "monitors_to_pages_page_id_page_id_fk": {+ "name": "monitors_to_pages_page_id_page_id_fk",+ "tableFrom": "monitors_to_pages",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "monitors_to_pages_monitor_id_page_id_pk": {+ "columns": [+ "monitor_id",+ "page_id"+ ],+ "name": "monitors_to_pages_monitor_id_page_id_pk"+ }+ },+ "uniqueConstraints": {}+ },+ "user": {+ "name": "user",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "tenant_id": {+ "name": "tenant_id",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "first_name": {+ "name": "first_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "last_name": {+ "name": "last_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "photo_url": {+ "name": "photo_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "user_tenant_id_unique": {+ "name": "user_tenant_id_unique",+ "columns": [+ "tenant_id"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "users_to_workspaces": {+ "name": "users_to_workspaces",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "users_to_workspaces_user_id_user_id_fk": {+ "name": "users_to_workspaces_user_id_user_id_fk",+ "tableFrom": "users_to_workspaces",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "users_to_workspaces_workspace_id_workspace_id_fk": {+ "name": "users_to_workspaces_workspace_id_workspace_id_fk",+ "tableFrom": "users_to_workspaces",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "users_to_workspaces_user_id_workspace_id_pk": {+ "columns": [+ "user_id",+ "workspace_id"+ ],+ "name": "users_to_workspaces_user_id_workspace_id_pk"+ }+ },+ "uniqueConstraints": {}+ },+ "page_subscriber": {+ "name": "page_subscriber",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "accepted_at": {+ "name": "accepted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "page_subscriber_page_id_page_id_fk": {+ "name": "page_subscriber_page_id_page_id_fk",+ "tableFrom": "page_subscriber",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "workspace": {+ "name": "workspace",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripe_id": {+ "name": "stripe_id",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "subscription_id": {+ "name": "subscription_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "plan": {+ "name": "plan",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "ends_at": {+ "name": "ends_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "paid_until": {+ "name": "paid_until",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "workspace_slug_unique": {+ "name": "workspace_slug_unique",+ "columns": [+ "slug"+ ],+ "isUnique": true+ },+ "workspace_stripe_id_unique": {+ "name": "workspace_stripe_id_unique",+ "columns": [+ "stripe_id"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "notification": {+ "name": "notification",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "data": {+ "name": "data",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'{}'"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notification_workspace_id_workspace_id_fk": {+ "name": "notification_workspace_id_workspace_id_fk",+ "tableFrom": "notification",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "notifications_to_monitors": {+ "name": "notifications_to_monitors",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "notification_id": {+ "name": "notification_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notifications_to_monitors_monitor_id_monitor_id_fk": {+ "name": "notifications_to_monitors_monitor_id_monitor_id_fk",+ "tableFrom": "notifications_to_monitors",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notifications_to_monitors_notification_id_notification_id_fk": {+ "name": "notifications_to_monitors_notification_id_notification_id_fk",+ "tableFrom": "notifications_to_monitors",+ "tableTo": "notification",+ "columnsFrom": [+ "notification_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "notifications_to_monitors_monitor_id_notification_id_pk": {+ "columns": [+ "monitor_id",+ "notification_id"+ ],+ "name": "notifications_to_monitors_monitor_id_notification_id_pk"+ }+ },+ "uniqueConstraints": {}+ },+ "monitor_status": {+ "name": "monitor_status",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'active'"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "monitor_status_idx": {+ "name": "monitor_status_idx",+ "columns": [+ "monitor_id",+ "region"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "monitor_status_monitor_id_monitor_id_fk": {+ "name": "monitor_status_monitor_id_monitor_id_fk",+ "tableFrom": "monitor_status",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "monitor_status_monitor_id_region_pk": {+ "columns": [+ "monitor_id",+ "region"+ ],+ "name": "monitor_status_monitor_id_region_pk"+ }+ },+ "uniqueConstraints": {}+ },+ "invitation": {+ "name": "invitation",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "accepted_at": {+ "name": "accepted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "incident": {+ "name": "incident",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'triage'"+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "started_at": {+ "name": "started_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "acknowledged_at": {+ "name": "acknowledged_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "acknowledged_by": {+ "name": "acknowledged_by",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "resolved_by": {+ "name": "resolved_by",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "incident_screenshot_url": {+ "name": "incident_screenshot_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "recovery_screenshot_url": {+ "name": "recovery_screenshot_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "auto_resolved": {+ "name": "auto_resolved",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "incident_monitor_id_started_at_unique": {+ "name": "incident_monitor_id_started_at_unique",+ "columns": [+ "monitor_id",+ "started_at"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "incident_monitor_id_monitor_id_fk": {+ "name": "incident_monitor_id_monitor_id_fk",+ "tableFrom": "incident",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set default",+ "onUpdate": "no action"+ },+ "incident_workspace_id_workspace_id_fk": {+ "name": "incident_workspace_id_workspace_id_fk",+ "tableFrom": "incident",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "incident_acknowledged_by_user_id_fk": {+ "name": "incident_acknowledged_by_user_id_fk",+ "tableFrom": "incident",+ "tableTo": "user",+ "columnsFrom": [+ "acknowledged_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "incident_resolved_by_user_id_fk": {+ "name": "incident_resolved_by_user_id_fk",+ "tableFrom": "incident",+ "tableTo": "user",+ "columnsFrom": [+ "resolved_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "monitor_tag": {+ "name": "monitor_tag",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_tag_workspace_id_workspace_id_fk": {+ "name": "monitor_tag_workspace_id_workspace_id_fk",+ "tableFrom": "monitor_tag",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {}+ },+ "monitor_tag_to_monitor": {+ "name": "monitor_tag_to_monitor",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "monitor_tag_id": {+ "name": "monitor_tag_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_tag_to_monitor_monitor_id_monitor_id_fk": {+ "name": "monitor_tag_to_monitor_monitor_id_monitor_id_fk",+ "tableFrom": "monitor_tag_to_monitor",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk": {+ "name": "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk",+ "tableFrom": "monitor_tag_to_monitor",+ "tableTo": "monitor_tag",+ "columnsFrom": [+ "monitor_tag_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk": {+ "columns": [+ "monitor_id",+ "monitor_tag_id"+ ],+ "name": "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk"+ }+ },+ "uniqueConstraints": {}+ }+ },+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex 4ee01509a..a24ba340b 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -176,6 +176,13 @@"when": 1712354121499,"tag": "0024_young_proudstar","breakpoints": true+ },+ {+ "idx": 25,+ "version": "5",+ "when": 1713095971713,+ "tag": "0025_strong_thunderball",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema/monitors/monitor.ts b/packages/db/src/schema/monitors/monitor.tsindex 23fccda61..c5196f265 100644--- a/packages/db/src/schema/monitors/monitor.ts+++ b/packages/db/src/schema/monitors/monitor.ts@@ -43,6 +43,8 @@ export const monitor = sqliteTable("monitor", {assertions: text("assertions"),+ public: integer("public", { mode: "boolean" }).default(false),+createdAt: integer("created_at", { mode: "timestamp" }).default(sql`(strftime('%s', 'now'))`,),diff --git a/packages/db/src/schema/shared.ts b/packages/db/src/schema/shared.tsindex 3478347a4..326220852 100644--- a/packages/db/src/schema/shared.ts+++ b/packages/db/src/schema/shared.ts@@ -14,7 +14,6 @@ import { workspacePlanSchema } from "./workspaces";export const selectPublicMonitorSchema = selectMonitorSchema.omit({body: true,headers: true,- regions: true,method: true,});@@ -54,7 +53,13 @@ export const selectPublicPageSchemaWithRelation = selectPageSchemaexport const selectPublicStatusReportSchemaWithRelation =selectStatusReportSchema.extend({monitorsToStatusReports: z- .array(z.object({ monitor: selectPublicMonitorSchema }))+ .array(+ z.object({+ monitorId: z.number(),+ statusReportId: z.number(),+ monitor: selectPublicMonitorSchema,+ }),+ ).default([]),statusReportUpdates: z.array(selectStatusReportUpdateSchema),});@@ -63,3 +68,4 @@ export type StatusReportWithUpdates = z.infer<typeof selectStatusReportPageSchema>;export type PublicMonitor = z.infer<typeof selectPublicMonitorSchema>;+export type PublicPage = z.infer<typeof selectPublicPageSchemaWithRelation>;diff --git a/packages/db/src/seed.mts b/packages/db/src/seed.mtsindex bc66ebb09..c31fb3d8a 100644--- a/packages/db/src/seed.mts+++ b/packages/db/src/seed.mts@@ -73,6 +73,7 @@ async function main() {url: "https://www.google.com",method: "GET",regions: "gru",+ public: true,},{id: 3,diff --git a/packages/tinybird/src/os-client.ts b/packages/tinybird/src/os-client.tsindex 94a6b5332..96115e876 100644--- a/packages/tinybird/src/os-client.ts+++ b/packages/tinybird/src/os-client.ts@@ -71,6 +71,28 @@ export class OSTinybird {};}+ endpointChartAllRegions(period: "7d" | "14d") {+ const parameters = z.object({+ monitorId: z.string(),+ });++ return async (props: z.infer<typeof parameters>) => {+ try {+ const res = await this.tb.buildPipe({+ pipe: `__ttl_${period}_chart_all_regions_get__${VERSION}`, // TODO: add pipe to @openstatus/tinybird+ parameters,+ data: z.object({ timestamp: z.number().int() }).merge(latencySchema),+ opts: {+ revalidate: DEFAULT_CACHE,+ },+ })(props);+ return res.data;+ } catch (e) {+ console.error(e);+ }+ };+ }+endpointMetrics(period: "1h" | "1d" | "3d" | "7d" | "14d") {const parameters = z.object({ monitorId: z.string() });diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 5a6307d28..8219ae37d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -262,6 +262,9 @@ importers:'@t3-oss/env-nextjs':specifier: 0.7.0version: 0.7.0([email protected])([email protected])+ '@tailwindcss/container-queries':+ specifier: 0.1.1+ version: 0.1.1([email protected])'@tailwindcss/typography':specifier: 0.5.10version: 0.5.10([email protected])@@ -2206,6 +2209,10 @@ packages:peerDependencies:'@effect-ts/otel-node': '*'peerDependenciesMeta:+ '@effect-ts/core':+ optional: true+ '@effect-ts/otel':+ optional: true'@effect-ts/otel-node':optional: truedependencies:@@ -6399,6 +6406,14 @@ packages:zod: 3.22.2dev: false+ /@tailwindcss/[email protected]([email protected]):+ resolution: {integrity: sha512-p18dswChx6WnTSaJCSGx6lTmrGzNNvm2FtXmiO6AuA1V4U5REyoqwmT6kgAsIMdjo07QdAfYXHJ4hnMtfHzWgA==}+ peerDependencies:+ tailwindcss: '>=3.2.0'+ dependencies:+ tailwindcss: 3.3.2+ dev: false+/@tailwindcss/[email protected]([email protected]):resolution: {integrity: sha512-Pe8BuPJQJd3FfRnm6H0ulKIGoMEQS+Vq01R6M5aCrFB/ccR/shT+0kXLjouGC1gFLm9hopTFN+DMP0pfwRWzPw==}peerDependencies: