Skip to content

Open-source status page, incident response and uptime monitoring

feat: vendor vs self-served page subscriptions (#2092)

Maximilian Kaskebda19b272e69
diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json
index 528d7fa8d..0e47d26fa 100644
--- a/apps/dashboard/package.json
+++ b/apps/dashboard/package.json
@@ -45,12 +45,14 @@
"@openstatus/notification-webhook": "workspace:*",
"@openstatus/react": "workspace:*",
"@openstatus/regions": "workspace:*",
+ "@openstatus/subscriptions": "workspace:*",
"@openstatus/theme-store": "workspace:*",
"@openstatus/tinybird": "workspace:*",
"@openstatus/tracker": "workspace:*",
"@openstatus/ui": "workspace:*",
"@openstatus/upstash": "workspace:*",
"@openstatus/utils": "workspace:*",
+ "@radix-ui/react-checkbox": "1.3.2",
"@radix-ui/react-dialog": "1.1.14",
"@radix-ui/react-dropdown-menu": "2.1.15",
"@radix-ui/react-portal": "1.1.9",
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/page.tsx
index a37e95091..38c4b1925 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/maintenances/page.tsx
@@ -11,6 +11,7 @@ import {
} from "@/components/content/section";
import { columns } from "@/components/data-table/maintenances/columns";
import { FormSheetMaintenance } from "@/components/forms/maintenance/sheet";
+import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { DataTable } from "@/components/ui/data-table/data-table";
import { useTRPC } from "@/lib/trpc/client";
import { Button } from "@openstatus/ui/components/ui/button";
@@ -63,7 +64,10 @@ export default function Page() {
</SectionHeader>
<div>
<FormSheetMaintenance
- pageComponents={statusPage.pageComponents}
+ items={toCheckboxTreeItems(
+ statusPage.pageComponents,
+ statusPage.pageComponentGroups,
+ )}
onSubmit={async (values) => {
await createMaintenanceMutation.mutateAsync({
pageId: Number.parseInt(id),
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/page.tsx
index 2dd73bba0..74294c8a1 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/status-reports/page.tsx
@@ -12,6 +12,7 @@ import {
import { DataTable as UpdatesDataTable } from "@/components/data-table/status-report-updates/data-table";
import { columns } from "@/components/data-table/status-reports/columns";
import { FormSheetStatusReport } from "@/components/forms/status-report/sheet";
+import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { DataTable } from "@/components/ui/data-table/data-table";
import { useTRPC } from "@/lib/trpc/client";
import { Button } from "@openstatus/ui/components/ui/button";
@@ -81,7 +82,10 @@ export default function Page() {
</>
) : undefined
}
- pageComponents={page.pageComponents}
+ items={toCheckboxTreeItems(
+ page.pageComponents,
+ page.pageComponentGroups,
+ )}
onSubmit={async (values) => {
// NOTE: for type safety, we need to check if the values have a date property
// because of the union type
diff --git a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx
index 74d62d7aa..342af994d 100644
--- a/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx
+++ b/apps/dashboard/src/app/(dashboard)/status-pages/[id]/subscribers/page.tsx
@@ -16,18 +16,23 @@ import {
SectionDescription,
SectionGroup,
SectionHeader,
+ SectionHeaderRow,
SectionTitle,
} from "@/components/content/section";
import { Section } from "@/components/content/section";
import { columns } from "@/components/data-table/subscribers/columns";
+import { SubscribersDataTableToolbar } from "@/components/data-table/subscribers/data-table-toolbar";
import { UpgradeDialog } from "@/components/dialogs/upgrade";
+import { FormSheetSubscriber } from "@/components/forms/subscriber/sheet";
+import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { DataTable } from "@/components/ui/data-table/data-table";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@openstatus/api";
-import { useQuery } from "@tanstack/react-query";
-import { Lock } from "lucide-react";
-import { useParams } from "next/navigation";
+import { Button } from "@openstatus/ui/components/ui/button";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { Lock, Plus } from "lucide-react";
+import { notFound, useParams } from "next/navigation";
import { useState } from "react";
type Subscriber = RouterOutputs["pageSubscriber"]["list"][number];
@@ -39,11 +44,14 @@ const EXAMPLES = [
createdAt: new Date(),
pageId: 1,
channelType: "email",
+ source: "self_signup",
+ name: null,
acceptedAt: new Date(),
unsubscribedAt: null,
components: [],
isEntirePage: true,
webhookUrl: null,
+ channelConfig: null,
},
{
id: 2,
@@ -51,38 +59,98 @@ const EXAMPLES = [
createdAt: new Date(),
pageId: 1,
channelType: "email",
+ source: "self_signup",
+ name: null,
acceptedAt: new Date(),
unsubscribedAt: null,
components: [],
isEntirePage: true,
webhookUrl: null,
+ channelConfig: null,
},
] satisfies Subscriber[];
export default function Page() {
const { id } = useParams<{ id: string }>();
+ const pageId = Number(id);
+ if (!Number.isInteger(pageId) || pageId <= 0) notFound();
const [openDialog, setOpenDialog] = useState(false);
+ const [openAdd, setOpenAdd] = useState(false);
const trpc = useTRPC();
- const { data: page } = useQuery(
- trpc.page.get.queryOptions({ id: Number.parseInt(id) }),
- );
- const { data: subscribers } = useQuery(
- trpc.pageSubscriber.list.queryOptions({ pageId: Number.parseInt(id) }),
+ const { data: page } = useQuery(trpc.page.get.queryOptions({ id: pageId }));
+ const { data: subscribers, refetch } = useQuery(
+ trpc.pageSubscriber.list.queryOptions({ pageId }),
);
const { data: workspace } = useQuery(trpc.workspace.get.queryOptions());
+ const { data: components } = useQuery(
+ trpc.pageComponent.list.queryOptions({ pageId }),
+ );
+
+ const createAction = useMutation(
+ trpc.pageSubscriber.createSubscription.mutationOptions({
+ onSuccess: () => refetch(),
+ }),
+ );
if (!workspace) return null;
+ const isLimited = workspace.limits["status-subscribers"] === false;
+ const items = toCheckboxTreeItems(
+ components ?? [],
+ page?.pageComponentGroups ?? [],
+ );
+
return (
<SectionGroup>
<Section>
- <SectionHeader>
- <SectionTitle>{page?.title}</SectionTitle>
- <SectionDescription>List of all subscribers.</SectionDescription>
- </SectionHeader>
+ <SectionHeaderRow>
+ <SectionHeader>
+ <SectionTitle>{page?.title}</SectionTitle>
+ <SectionDescription>List of all subscribers.</SectionDescription>
+ </SectionHeader>
+ {isLimited ? (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setOpenDialog(true)}
+ >
+ <Lock className="mr-1 size-3.5" /> Add subscriber
+ </Button>
+ ) : (
+ <FormSheetSubscriber
+ open={openAdd}
+ onOpenChange={setOpenAdd}
+ items={items}
+ onSubmit={async (values) => {
+ if (values.channelType === "email") {
+ await createAction.mutateAsync({
+ pageId,
+ channelType: "email",
+ email: values.email,
+ name: values.name || null,
+ componentIds: values.componentIds,
+ });
+ } else {
+ await createAction.mutateAsync({
+ pageId,
+ channelType: "webhook",
+ webhookUrl: values.webhookUrl,
+ name: values.name || null,
+ headers: values.headers,
+ componentIds: values.componentIds,
+ });
+ }
+ }}
+ >
+ <Button variant="outline" size="sm">
+ <Plus className="mr-1 size-3.5" /> Add subscriber
+ </Button>
+ </FormSheetSubscriber>
+ )}
+ </SectionHeaderRow>
</Section>
<Section>
- {workspace.limits["status-subscribers"] === false ? (
+ {isLimited ? (
<BillingOverlayContainer>
<DataTable
columns={columns}
@@ -112,12 +180,17 @@ export default function Page() {
/>
</BillingOverlayContainer>
) : subscribers?.length ? (
- <DataTable columns={columns} data={subscribers} />
+ <DataTable
+ columns={columns}
+ data={subscribers}
+ toolbarComponent={SubscribersDataTableToolbar}
+ defaultColumnFilters={[{ id: "status", value: ["active"] }]}
+ />
) : (
<EmptyStateContainer>
<EmptyStateTitle>No subscribers</EmptyStateTitle>
<EmptyStateDescription>
- No emails have been subscribed to this status page.
+ Nobody has been subscribed to this status page.
</EmptyStateDescription>
</EmptyStateContainer>
)}
diff --git a/apps/dashboard/src/components/data-table/maintenances/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/maintenances/data-table-row-actions.tsx
index eed2d2525..589baf539 100644
--- a/apps/dashboard/src/components/data-table/maintenances/data-table-row-actions.tsx
+++ b/apps/dashboard/src/components/data-table/maintenances/data-table-row-actions.tsx
@@ -2,6 +2,7 @@
import { QuickActions } from "@/components/dropdowns/quick-actions";
import { FormSheetMaintenance } from "@/components/forms/maintenance/sheet";
+import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { getActions } from "@/data/maintenances.client";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@openstatus/api";
@@ -74,7 +75,10 @@ export function DataTableRowActions({ row }: DataTableRowActionsProps) {
}}
/>
<FormSheetMaintenance
- pageComponents={statusPage?.pageComponents ?? []}
+ items={toCheckboxTreeItems(
+ statusPage?.pageComponents ?? [],
+ statusPage?.pageComponentGroups ?? [],
+ )}
defaultValues={{
title: row.original.title,
message: row.original.message,
diff --git a/apps/dashboard/src/components/data-table/status-reports/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/status-reports/data-table-row-actions.tsx
index 16bb36f5e..9cd445c02 100644
--- a/apps/dashboard/src/components/data-table/status-reports/data-table-row-actions.tsx
+++ b/apps/dashboard/src/components/data-table/status-reports/data-table-row-actions.tsx
@@ -3,6 +3,7 @@
import { QuickActions } from "@/components/dropdowns/quick-actions";
import { FormSheetStatusReportUpdate } from "@/components/forms/status-report-update/sheet";
import { FormSheetStatusReport } from "@/components/forms/status-report/sheet";
+import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { getNextStatus } from "@/data/status-report-updates.client";
import { getActions } from "@/data/status-reports.client";
import { useTRPC } from "@/lib/trpc/client";
@@ -124,7 +125,10 @@ export function DataTableRowActions({ row }: DataTableRowActionsProps) {
}}
/>
<FormSheetStatusReport
- pageComponents={page?.pageComponents ?? []}
+ items={toCheckboxTreeItems(
+ page?.pageComponents ?? [],
+ page?.pageComponentGroups ?? [],
+ )}
defaultValues={{
title: row.original.title,
status: row.original.status,
diff --git a/apps/dashboard/src/components/data-table/subscribers/columns.tsx b/apps/dashboard/src/components/data-table/subscribers/columns.tsx
index 538606708..05396fbfc 100644
--- a/apps/dashboard/src/components/data-table/subscribers/columns.tsx
+++ b/apps/dashboard/src/components/data-table/subscribers/columns.tsx
@@ -2,76 +2,137 @@
import { formatDate } from "@/lib/formatter";
import type { RouterOutputs } from "@openstatus/api";
+import { detectWebhookFlavor } from "@openstatus/subscriptions/client";
import { Badge } from "@openstatus/ui/components/ui/badge";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@openstatus/ui/components/ui/tooltip";
import type { ColumnDef } from "@tanstack/react-table";
import { DataTableRowActions } from "./data-table-row-actions";
type Subscriber = RouterOutputs["pageSubscriber"]["list"][number];
+const FLAVOR_LABELS = {
+ slack: "Slack",
+ discord: "Discord",
+ generic: "Webhook",
+} as const;
+
+function detectFlavorBadge(url: string | null) {
+ if (!url) return null;
+ return FLAVOR_LABELS[detectWebhookFlavor(url)];
+}
+
export const columns: ColumnDef<Subscriber>[] = [
{
- accessorKey: "email",
- header: "Email",
+ id: "destination",
+ header: "Destination",
enableSorting: false,
enableHiding: false,
+ cell: ({ row }) => {
+ const sub = row.original;
+ const raw = sub.channelType === "email" ? sub.email : sub.webhookUrl;
+ const display = sub.name ?? raw ?? "";
+ const flavor =
+ sub.channelType === "webhook"
+ ? detectFlavorBadge(sub.webhookUrl)
+ : null;
+
+ return (
+ <div className="flex items-center gap-2">
+ <span className="max-w-[280px] truncate">{display}</span>
+ {flavor ? (
+ <Badge variant="outline" className="text-xs">
+ {flavor}
+ </Badge>
+ ) : null}
+ </div>
+ );
+ },
},
{
- id: "status",
- header: "Status",
+ id: "source",
+ accessorFn: (row) => row.source,
+ header: "Source",
enableSorting: false,
enableHiding: false,
+ filterFn: (row, id, filterValue: string[]) => {
+ if (!filterValue?.length) return true;
+ return filterValue.includes(row.getValue(id) as string);
+ },
cell: ({ row }) => {
- const unsubscribedAt = row.original.unsubscribedAt;
- const acceptedAt = row.original.acceptedAt;
-
- if (unsubscribedAt) {
- return <Badge variant="destructive">Unsubscribed</Badge>;
- }
-
- if (!acceptedAt) {
- return <Badge variant="outline">Pending</Badge>;
- }
-
- return <Badge variant="secondary">Active</Badge>;
+ const source = row.original.source;
+ const label =
+ source === "vendor"
+ ? "Vendor"
+ : source === "import"
+ ? "Import"
+ : "Self-signup";
+ return (
+ <Badge variant="outline" className="text-xs">
+ {label}
+ </Badge>
+ );
},
},
{
- accessorKey: "createdAt",
- header: "Created At",
+ id: "components",
+ header: "Components",
enableSorting: false,
enableHiding: false,
cell: ({ row }) => {
- const value = row.getValue("createdAt");
- if (value instanceof Date) return formatDate(value);
- if (!value) return "-";
- return value;
- },
- meta: {
- cellClassName: "font-mono",
+ const { components, isEntirePage } = row.original;
+ if (isEntirePage) {
+ return (
+ <span className="text-muted-foreground text-xs">Entire page</span>
+ );
+ }
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="text-xs">{components.length} components</span>
+ </TooltipTrigger>
+ <TooltipContent>
+ {components.map((c) => c.name).join(", ")}
+ </TooltipContent>
+ </Tooltip>
+ );
},
},
{
- accessorKey: "acceptedAt",
- header: "Accepted At",
+ id: "status",
+ accessorFn: (row) => {
+ if (row.unsubscribedAt) return "unsubscribed";
+ if (!row.acceptedAt) return "pending";
+ return "active";
+ },
+ header: "Status",
enableSorting: false,
enableHiding: false,
- cell: ({ row }) => {
- const value = row.getValue("acceptedAt");
- if (value instanceof Date) return formatDate(value);
- if (!value) return "-";
- return value;
+ filterFn: (row, id, filterValue: string[]) => {
+ if (!filterValue?.length) return true;
+ return filterValue.includes(row.getValue(id) as string);
},
- meta: {
- cellClassName: "font-mono",
+ cell: ({ row }) => {
+ const status = row.getValue("status") as string;
+ if (status === "unsubscribed") {
+ return <Badge variant="destructive">Unsubscribed</Badge>;
+ }
+ if (status === "pending") {
+ return <Badge variant="outline">Pending</Badge>;
+ }
+ return <Badge variant="secondary">Active</Badge>;
},
},
{
- accessorKey: "unsubscribedAt",
- header: "Unsubscribed At",
+ accessorKey: "createdAt",
+ header: "Created At",
enableSorting: false,
enableHiding: false,
cell: ({ row }) => {
- const value = row.getValue("unsubscribedAt");
+ const value = row.getValue("createdAt");
if (value instanceof Date) return formatDate(value);
if (!value) return "-";
return value;
diff --git a/apps/dashboard/src/components/data-table/subscribers/data-table-row-actions.tsx b/apps/dashboard/src/components/data-table/subscribers/data-table-row-actions.tsx
index 43a17fc33..3e7505ff3 100644
--- a/apps/dashboard/src/components/data-table/subscribers/data-table-row-actions.tsx
+++ b/apps/dashboard/src/components/data-table/subscribers/data-table-row-actions.tsx
@@ -1,10 +1,16 @@
"use client";
import { QuickActions } from "@/components/dropdowns/quick-actions";
+import { FormSheetSubscriber } from "@/components/forms/subscriber/sheet";
+import { toCheckboxTreeItems } from "@/components/ui/checkbox-tree";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@openstatus/api";
import { useMutation, useQuery } from "@tanstack/react-query";
import type { Row } from "@tanstack/react-table";
+import { isTRPCClientError } from "@trpc/client";
+import { Pencil, Send } from "lucide-react";
+import { useState } from "react";
+import { toast } from "sonner";
type Subscriber = RouterOutputs["pageSubscriber"]["list"][number];
@@ -19,25 +25,154 @@ export function DataTableRowActions({ row }: DataTableRowActionsProps) {
pageId: row.original.pageId,
}),
);
+ const [editOpen, setEditOpen] = useState(false);
+
+ const { data: components } = useQuery({
+ ...trpc.pageComponent.list.queryOptions({ pageId: row.original.pageId }),
+ enabled: editOpen,
+ });
+ const { data: statusPage } = useQuery({
+ ...trpc.page.get.queryOptions({ id: row.original.pageId }),
+ enabled: editOpen,
+ });
const deleteAction = useMutation(
trpc.pageSubscriber.delete.mutationOptions({
onSuccess: () => refetch(),
}),
);
+ const updateAction = useMutation(
+ trpc.pageSubscriber.updateChannel.mutationOptions({
+ onSuccess: () => refetch(),
+ }),
+ );
+ const testAction = useMutation(
+ trpc.pageSubscriber.sendTestWebhook.mutationOptions(),
+ );
+
+ const sub = row.original;
+ const isVendorAdded = sub.source === "vendor";
+ const isWebhook = sub.channelType === "webhook";
+ const isActive = !sub.unsubscribedAt;
+
+ const items = toCheckboxTreeItems(
+ components ?? [],
+ statusPage?.pageComponentGroups ?? [],
+ );
+
+ const editDefaults = isVendorAdded
+ ? {
+ channelType: sub.channelType,
+ name: sub.name ?? "",
+ email: sub.email ?? "",
+ webhookUrl: sub.webhookUrl ?? "",
+ headers: parseHeaders(sub.channelConfig),
+ componentIds: sub.components.map((c) => c.id),
+ }
+ : undefined;
+
+ const actions = [
+ ...(isVendorAdded
+ ? [
+ {
+ id: "edit",
+ label: "Edit",
+ icon: Pencil,
+ variant: "default" as const,
+ onClick: () => setEditOpen(true),
+ },
+ ]
+ : []),
+ ...(isVendorAdded && isWebhook && isActive
+ ? [
+ {
+ id: "test",
+ label: "Send test",
+ icon: Send,
+ variant: "default" as const,
+ onClick: async () => {
+ const promise = testAction.mutateAsync({
+ subscriberId: sub.id,
+ pageId: sub.pageId,
+ });
+ toast.promise(promise, {
+ loading: "Sending test…",
+ success: "Test webhook sent",
+ error: (error) => {
+ if (isTRPCClientError(error)) return error.message;
+ return "Failed to send test";
+ },
+ });
+ try {
+ await promise;
+ } catch (error) {
+ console.error(error);
+ }
+ },
+ },
+ ]
+ : []),
+ ];
return (
- <QuickActions
- actions={[]}
- deleteAction={{
- confirmationValue: row.original.email ?? "subscriber",
- submitAction: async () => {
- await deleteAction.mutateAsync({
- id: row.original.id,
- pageId: row.original.pageId,
- });
- },
- }}
- />
+ <>
+ <QuickActions
+ actions={actions}
+ deleteAction={{
+ confirmationValue:
+ sub.name ?? sub.email ?? sub.webhookUrl ?? "subscriber",
+ submitAction: async () => {
+ await deleteAction.mutateAsync({
+ id: sub.id,
+ pageId: sub.pageId,
+ });
+ },
+ }}
+ />
+ {isVendorAdded && editDefaults ? (
+ <FormSheetSubscriber
+ items={items}
+ defaultValues={editDefaults}
+ editMode
+ title="Edit subscriber"
+ description="Update channel config, label, or component scope."
+ open={editOpen}
+ onOpenChange={setEditOpen}
+ onSubmit={async (values) => {
+ if (values.channelType === "webhook") {
+ await updateAction.mutateAsync({
+ subscriberId: sub.id,
+ pageId: sub.pageId,
+ name: values.name || null,
+ webhookUrl: values.webhookUrl,
+ headers: values.headers,
+ componentIds: values.componentIds,
+ });
+ } else {
+ await updateAction.mutateAsync({
+ subscriberId: sub.id,
+ pageId: sub.pageId,
+ name: values.name || null,
+ componentIds: values.componentIds,
+ });
+ }
+ }}
+ />
+ ) : null}
+ </>
);
}
+
+function parseHeaders(
+ channelConfig: string | null,
+): { key: string; value: string }[] {
+ if (!channelConfig) return [];
+ try {
+ const parsed = JSON.parse(channelConfig) as {
+ headers?: { key: string; value: string }[];
+ };
+ return parsed.headers ?? [];
+ } catch {
+ return [];
+ }
+}
diff --git a/apps/dashboard/src/components/data-table/subscribers/data-table-toolbar.tsx b/apps/dashboard/src/components/data-table/subscribers/data-table-toolbar.tsx
new file mode 100644
index 000000000..d46fcae20
--- /dev/null
+++ b/apps/dashboard/src/components/data-table/subscribers/data-table-toolbar.tsx
@@ -0,0 +1,56 @@
+"use client";
+
+import { DataTableFacetedFilter } from "@/components/ui/data-table/data-table-faceted-filter";
+import type { RouterOutputs } from "@openstatus/api";
+import { Button } from "@openstatus/ui/components/ui/button";
+import type { Table } from "@tanstack/react-table";
+import { X } from "lucide-react";
+
+type Subscriber = RouterOutputs["pageSubscriber"]["list"][number];
+
+export function SubscribersDataTableToolbar({
+ table,
+}: {
+ table: Table<Subscriber>;
+}) {
+ const isFiltered = table.getState().columnFilters.length > 0;
+
+ return (
+ <div className="flex items-center justify-between">
+ <div className="flex flex-1 flex-wrap items-center gap-2">
+ {table.getColumn("status") && (
+ <DataTableFacetedFilter
+ column={table.getColumn("status")}
+ title="Status"
+ options={[
+ { label: "Active", value: "active" },
+ { label: "Pending", value: "pending" },
+ { label: "Unsubscribed", value: "unsubscribed" },
+ ]}
+ />
+ )}
+ {table.getColumn("source") && (
+ <DataTableFacetedFilter
+ column={table.getColumn("source")}
+ title="Source"
+ options={[
+ { label: "Self-signup", value: "self_signup" },
+ { label: "Vendor", value: "vendor" },
+ { label: "Import", value: "import" },
+ ]}
+ />
+ )}
+ {isFiltered && (
+ <Button
+ variant="ghost"
+ onClick={() => table.resetColumnFilters()}
+ className="h-8 px-2 lg:px-3"
+ >
+ Reset
+ <X />
+ </Button>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/dashboard/src/components/forms/maintenance/form.tsx b/apps/dashboard/src/components/forms/maintenance/form.tsx
index c4929c0da..aad3c6bc3 100644
--- a/apps/dashboard/src/components/forms/maintenance/form.tsx
+++ b/apps/dashboard/src/components/forms/maintenance/form.tsx
@@ -10,6 +10,10 @@ import {
FormCardSeparator,
} from "@/components/forms/form-card";
import { useFormSheetDirty } from "@/components/forms/form-sheet";
+import {
+ CheckboxTree,
+ type CheckboxTreeItem,
+} from "@/components/ui/checkbox-tree";
import { useTRPC } from "@/lib/trpc/client";
import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
@@ -66,11 +70,11 @@ export function FormMaintenance({
defaultValues,
onSubmit,
className,
- pageComponents,
+ items,
...props
}: Omit<React.ComponentProps<"form">, "onSubmit"> & {
defaultValues?: FormValues;
- pageComponents: { id: number; name: string }[];
+ items: CheckboxTreeItem[];
onSubmit: (values: FormValues) => Promise<void>;
}) {
const trpc = useTRPC();
@@ -424,42 +428,14 @@ export function FormMaintenance({
Connected page components will be affected for the period of
time.
</FormDescription>
- {pageComponents.length ? (
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={
- field.value?.length === pageComponents.length
- }
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? pageComponents.map((c) => c.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {pageComponents.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ {items.length ? (
+ <FormControl>
+ <CheckboxTree
+ items={items}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
) : (
<EmptyStateContainer>
<EmptyStateTitle>No page components found</EmptyStateTitle>
@@ -488,14 +464,13 @@ export function FormMaintenance({
onCheckedChange={field.onChange}
/>
<Label htmlFor="notifySubscribers">
- Send email notification to subscribers
+ Send notification to subscribers
</Label>
</div>
</FormControl>
<FormMessage />
<FormDescription>
- Subscribers will receive an email when creating a
- maintenance.
+ Subscribers will be notified when creating a maintenance.
</FormDescription>
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/maintenance/sheet.tsx b/apps/dashboard/src/components/forms/maintenance/sheet.tsx
index 6c151fb0d..bfe2e0c2a 100644
--- a/apps/dashboard/src/components/forms/maintenance/sheet.tsx
+++ b/apps/dashboard/src/components/forms/maintenance/sheet.tsx
@@ -15,6 +15,7 @@ import {
FormMaintenance,
type FormValues,
} from "@/components/forms/maintenance/form";
+import type { CheckboxTreeItem } from "@/components/ui/checkbox-tree";
import { Button } from "@openstatus/ui/components/ui/button";
import { useState } from "react";
@@ -22,11 +23,11 @@ export function FormSheetMaintenance({
children,
defaultValues,
onSubmit,
- pageComponents,
+ items,
...props
}: Omit<React.ComponentProps<typeof FormSheetTrigger>, "onSubmit"> & {
defaultValues?: FormValues;
- pageComponents: { id: number; name: string }[];
+ items: CheckboxTreeItem[];
onSubmit: (values: FormValues) => Promise<void>;
}) {
const [open, setOpen] = useState(false);
@@ -46,7 +47,7 @@ export function FormSheetMaintenance({
<FormCardGroup className="overflow-y-auto">
<FormCard className="overflow-auto rounded-none border-none">
<FormMaintenance
- pageComponents={pageComponents}
+ items={items}
onSubmit={async (values) => {
await onSubmit(values);
setOpen(false);
diff --git a/apps/dashboard/src/components/forms/notifications/form-discord.tsx b/apps/dashboard/src/components/forms/notifications/form-discord.tsx
index 7652af024..02279cfbc 100644
--- a/apps/dashboard/src/components/forms/notifications/form-discord.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-discord.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -21,7 +21,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -195,39 +194,22 @@ export function FormDiscord({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-email.tsx b/apps/dashboard/src/components/forms/notifications/form-email.tsx
index 024a36cb7..4d6876dde 100644
--- a/apps/dashboard/src/components/forms/notifications/form-email.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-email.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -18,7 +18,6 @@ import { useFormSheetDirty } from "@/components/forms/form-sheet";
import { zodResolver } from "@hookform/resolvers/zod";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { isTRPCClientError } from "@trpc/client";
import React, { useTransition } from "react";
@@ -142,39 +141,22 @@ export function FormEmail({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-google-chat.tsx b/apps/dashboard/src/components/forms/notifications/form-google-chat.tsx
index 2137c112b..f20e7c168 100644
--- a/apps/dashboard/src/components/forms/notifications/form-google-chat.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-google-chat.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -18,7 +18,6 @@ import { useFormSheetDirty } from "@/components/forms/form-sheet";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { useTRPC } from "@/lib/trpc/client";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -187,39 +186,22 @@ export function FormGoogleChat({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-grafana-oncall.tsx b/apps/dashboard/src/components/forms/notifications/form-grafana-oncall.tsx
index cf99ba6a5..9fb55321c 100644
--- a/apps/dashboard/src/components/forms/notifications/form-grafana-oncall.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-grafana-oncall.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -19,7 +19,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -194,39 +193,22 @@ export function FormGrafanaOncall({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-ntfy.tsx b/apps/dashboard/src/components/forms/notifications/form-ntfy.tsx
index 80eba4f78..15b294a90 100644
--- a/apps/dashboard/src/components/forms/notifications/form-ntfy.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-ntfy.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -20,7 +20,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -222,39 +221,22 @@ export function FormNtfy({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-opsgenie.tsx b/apps/dashboard/src/components/forms/notifications/form-opsgenie.tsx
index cbf42b69c..bb963ee14 100644
--- a/apps/dashboard/src/components/forms/notifications/form-opsgenie.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-opsgenie.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -19,7 +19,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import {
Select,
SelectContent,
@@ -212,39 +211,22 @@ export function FormOpsGenie({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-pagerduty.tsx b/apps/dashboard/src/components/forms/notifications/form-pagerduty.tsx
index d95e702cc..37d563633 100644
--- a/apps/dashboard/src/components/forms/notifications/form-pagerduty.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-pagerduty.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -21,7 +21,6 @@ import { PagerDutySchema } from "@openstatus/notification-pagerduty";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -205,39 +204,22 @@ export function FormPagerDuty({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-slack.tsx b/apps/dashboard/src/components/forms/notifications/form-slack.tsx
index 736c0386b..ca05ac25b 100644
--- a/apps/dashboard/src/components/forms/notifications/form-slack.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-slack.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -21,7 +21,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -195,39 +194,22 @@ export function FormSlack({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-sms.tsx b/apps/dashboard/src/components/forms/notifications/form-sms.tsx
index 0946f977b..8086937c4 100644
--- a/apps/dashboard/src/components/forms/notifications/form-sms.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-sms.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -18,7 +18,6 @@ import { useFormSheetDirty } from "@/components/forms/form-sheet";
import { zodResolver } from "@hookform/resolvers/zod";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import React, { useTransition } from "react";
import { useForm } from "react-hook-form";
@@ -132,39 +131,22 @@ export function FormSms({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-telegram.tsx b/apps/dashboard/src/components/forms/notifications/form-telegram.tsx
index 4a1dca3a2..11b248f3c 100644
--- a/apps/dashboard/src/components/forms/notifications/form-telegram.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-telegram.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -18,7 +18,6 @@ import { useFormSheetDirty } from "@/components/forms/form-sheet";
import { zodResolver } from "@hookform/resolvers/zod";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { isTRPCClientError } from "@trpc/client";
import React, { useTransition } from "react";
@@ -157,39 +156,22 @@ export function FormTelegram({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-webhook.tsx b/apps/dashboard/src/components/forms/notifications/form-webhook.tsx
index a19fa6ca1..134d22897 100644
--- a/apps/dashboard/src/components/forms/notifications/form-webhook.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-webhook.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -21,7 +21,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -266,39 +265,22 @@ export function FormWebhook({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form-whatsapp.tsx b/apps/dashboard/src/components/forms/notifications/form-whatsapp.tsx
index 3ee02a0bb..a628dc86b 100644
--- a/apps/dashboard/src/components/forms/notifications/form-whatsapp.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form-whatsapp.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -18,7 +18,6 @@ import { useFormSheetDirty } from "@/components/forms/form-sheet";
import { Button } from "@openstatus/ui/components/ui/button";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { useTRPC } from "@/lib/trpc/client";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -187,39 +186,22 @@ export function FormWhatsApp({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/notifications/form.tsx b/apps/dashboard/src/components/forms/notifications/form.tsx
index 651a6ee0e..c80275a98 100644
--- a/apps/dashboard/src/components/forms/notifications/form.tsx
+++ b/apps/dashboard/src/components/forms/notifications/form.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import {
FormControl,
FormDescription,
@@ -13,7 +13,6 @@ import {
import { zodResolver } from "@hookform/resolvers/zod";
import { Form } from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Label } from "@openstatus/ui/components/ui/label";
import { cn } from "@openstatus/ui/lib/utils";
import { useTransition } from "react";
import { useForm } from "react-hook-form";
@@ -130,39 +129,22 @@ export function NotifierForm({
<FormDescription>
Select the monitors you want to notify.
</FormDescription>
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
<FormMessage />
</FormItem>
)}
diff --git a/apps/dashboard/src/components/forms/private-location/form.tsx b/apps/dashboard/src/components/forms/private-location/form.tsx
index c0679a813..0b01ef69a 100644
--- a/apps/dashboard/src/components/forms/private-location/form.tsx
+++ b/apps/dashboard/src/components/forms/private-location/form.tsx
@@ -9,8 +9,8 @@ import {
FormCardSeparator,
} from "@/components/forms/form-card";
import { useFormSheetDirty } from "@/components/forms/form-sheet";
+import { CheckboxTree } from "@/components/ui/checkbox-tree";
import { zodResolver } from "@hookform/resolvers/zod";
-import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
import {
Form,
FormControl,
@@ -27,7 +27,6 @@ import {
InputGroupButton,
InputGroupInput,
} from "@openstatus/ui/components/ui/input-group";
-import { Label } from "@openstatus/ui/components/ui/label";
import { useCopyToClipboard } from "@openstatus/ui/hooks/use-copy-to-clipboard";
import { cn } from "@openstatus/ui/lib/utils";
import { isTRPCClientError } from "@trpc/client";
@@ -167,39 +166,22 @@ export function FormPrivateLocation({
private location.
</FormDescription>
{monitors.length ? (
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={field.value?.length === monitors.length}
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? monitors.map((m) => m.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {monitors.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ <FormControl>
+ <CheckboxTree
+ items={[
+ {
+ id: -1,
+ label: "Select all",
+ children: monitors.map((m) => ({
+ id: m.id,
+ label: m.name,
+ })),
+ },
+ ]}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
) : (
<EmptyStateContainer>
<EmptyStateTitle>No monitors found</EmptyStateTitle>
diff --git a/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx b/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx
index 03bbcf70f..3baeb753c 100644
--- a/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx
+++ b/apps/dashboard/src/components/forms/status-report-update/form-status-report.tsx
@@ -362,13 +362,13 @@ export function FormStatusReportUpdateCard({
onCheckedChange={field.onChange}
/>
<Label htmlFor="notifySubscribers">
- Send email notification to subscribers
+ Send notification to subscribers
</Label>
</div>
</FormControl>
<FormMessage />
<FormDescription>
- Subscribers will receive an email when creating a status
+ Subscribers will be notified when creating a status
report.
</FormDescription>
</FormItem>
diff --git a/apps/dashboard/src/components/forms/status-report-update/form.tsx b/apps/dashboard/src/components/forms/status-report-update/form.tsx
index e3beb8a77..ad2c8bebe 100644
--- a/apps/dashboard/src/components/forms/status-report-update/form.tsx
+++ b/apps/dashboard/src/components/forms/status-report-update/form.tsx
@@ -324,13 +324,13 @@ export function FormStatusReportUpdate({
onCheckedChange={field.onChange}
/>
<Label htmlFor="notifySubscribers">
- Send email notification to subscribers
+ Send notification to subscribers
</Label>
</div>
</FormControl>
<FormMessage />
<FormDescription>
- Subscribers will receive an email when creating a status
+ Subscribers will be notified when creating a status
report.
</FormDescription>
</FormItem>
diff --git a/apps/dashboard/src/components/forms/status-report/form.tsx b/apps/dashboard/src/components/forms/status-report/form.tsx
index b22d8272d..1049d51f0 100644
--- a/apps/dashboard/src/components/forms/status-report/form.tsx
+++ b/apps/dashboard/src/components/forms/status-report/form.tsx
@@ -10,13 +10,14 @@ import {
FormCardSeparator,
} from "@/components/forms/form-card";
import { useFormSheetDirty } from "@/components/forms/form-sheet";
+import {
+ CheckboxTree,
+ type CheckboxTreeItem,
+} from "@/components/ui/checkbox-tree";
import { colors } from "@/data/status-report-updates.client";
import { useTRPC } from "@/lib/trpc/client";
import { zodResolver } from "@hookform/resolvers/zod";
-import {
- type PageComponent,
- statusReportStatus,
-} from "@openstatus/db/src/schema";
+import { statusReportStatus } from "@openstatus/db/src/schema";
import { Button } from "@openstatus/ui/components/ui/button";
import { Calendar } from "@openstatus/ui/components/ui/calendar";
import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
@@ -79,12 +80,12 @@ export function FormStatusReport({
defaultValues,
onSubmit,
className,
- pageComponents,
+ items,
...props
}: Omit<React.ComponentProps<"form">, "onSubmit"> & {
defaultValues?: FormValues;
onSubmit: (values: FormValues) => Promise<void>;
- pageComponents: Pick<PageComponent, "id" | "name" | "type">[];
+ items: CheckboxTreeItem[];
}) {
const trpc = useTRPC();
const { data: workspace } = useQuery(
@@ -359,42 +360,14 @@ export function FormStatusReport({
<FormDescription>
Select the page components you want to notify.
</FormDescription>
- {pageComponents.length ? (
- <div className="grid gap-3">
- <div className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id="all"
- checked={
- field.value?.length === pageComponents.length
- }
- onCheckedChange={(checked) => {
- field.onChange(
- checked ? pageComponents.map((c) => c.id) : [],
- );
- }}
- />
- </FormControl>
- <Label htmlFor="all">Select all</Label>
- </div>
- {pageComponents.map((item) => (
- <div key={item.id} className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- id={String(item.id)}
- checked={field.value?.includes(item.id)}
- onCheckedChange={(checked) => {
- const newValue = checked
- ? [...(field.value || []), item.id]
- : field.value?.filter((id) => id !== item.id);
- field.onChange(newValue);
- }}
- />
- </FormControl>
- <Label htmlFor={String(item.id)}>{item.name}</Label>
- </div>
- ))}
- </div>
+ {items.length ? (
+ <FormControl>
+ <CheckboxTree
+ items={items}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
) : (
<EmptyStateContainer>
<EmptyStateTitle>No page components found</EmptyStateTitle>
@@ -423,13 +396,13 @@ export function FormStatusReport({
onCheckedChange={field.onChange}
/>
<Label htmlFor="notifySubscribers">
- Send email notification to subscribers
+ Send notification to subscribers
</Label>
</div>
</FormControl>
<FormMessage />
<FormDescription>
- Subscribers will receive an email when creating a status
+ Subscribers will be notified when creating a status
report.
</FormDescription>
</FormItem>
diff --git a/apps/dashboard/src/components/forms/status-report/sheet.tsx b/apps/dashboard/src/components/forms/status-report/sheet.tsx
index 0dcbe7166..7553adb2a 100644
--- a/apps/dashboard/src/components/forms/status-report/sheet.tsx
+++ b/apps/dashboard/src/components/forms/status-report/sheet.tsx
@@ -14,7 +14,7 @@ import {
FormStatusReport,
type FormValues,
} from "@/components/forms/status-report/form";
-import type { PageComponent } from "@openstatus/db/src/schema";
+import type { CheckboxTreeItem } from "@/components/ui/checkbox-tree";
import { Button } from "@openstatus/ui/components/ui/button";
import { Separator } from "@openstatus/ui/components/ui/separator";
import { useState } from "react";
@@ -23,12 +23,12 @@ export function FormSheetStatusReport({
children,
defaultValues,
onSubmit,
- pageComponents,
+ items,
warning,
}: Omit<React.ComponentProps<typeof FormSheetTrigger>, "onSubmit"> & {
defaultValues?: FormValues;
onSubmit: (values: FormValues) => Promise<void>;
- pageComponents: Pick<PageComponent, "id" | "name" | "type">[];
+ items: CheckboxTreeItem[];
warning?: React.ReactNode;
}) {
const [open, setOpen] = useState(false);
@@ -59,7 +59,7 @@ export function FormSheetStatusReport({
setOpen(false);
}}
defaultValues={defaultValues}
- pageComponents={pageComponents}
+ items={items}
/>
</FormCard>
</FormCardGroup>
diff --git a/apps/dashboard/src/components/forms/subscriber/form.tsx b/apps/dashboard/src/components/forms/subscriber/form.tsx
new file mode 100644
index 000000000..96bfcb7d8
--- /dev/null
+++ b/apps/dashboard/src/components/forms/subscriber/form.tsx
@@ -0,0 +1,399 @@
+"use client";
+
+import {
+ EmptyStateContainer,
+ EmptyStateTitle,
+} from "@/components/content/empty-state";
+import {
+ FormCardContent,
+ FormCardSeparator,
+} from "@/components/forms/form-card";
+import { useFormSheetDirty } from "@/components/forms/form-sheet";
+import {
+ CheckboxTree,
+ type CheckboxTreeItem,
+} from "@/components/ui/checkbox-tree";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { detectWebhookFlavor } from "@openstatus/subscriptions/client";
+import { Button } from "@openstatus/ui/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@openstatus/ui/components/ui/form";
+import { Input } from "@openstatus/ui/components/ui/input";
+import { Tabs, TabsList, TabsTrigger } from "@openstatus/ui/components/ui/tabs";
+import { cn } from "@openstatus/ui/lib/utils";
+import { isTRPCClientError } from "@trpc/client";
+import { Plus, X } from "lucide-react";
+import React, { useTransition } from "react";
+import { useFieldArray, useForm } from "react-hook-form";
+import { toast } from "sonner";
+import { z } from "zod";
+
+const headerSchema = z.object({
+ key: z.string().min(1, "Key is required"),
+ value: z.string(),
+});
+
+// Form schema: a single flat shape with optional fields. The submit handler
+// narrows to email-only or webhook-only payload based on `channelType`.
+const formSchema = z
+ .object({
+ channelType: z.enum(["email", "webhook"]),
+ name: z.string().max(255),
+ email: z.string(),
+ webhookUrl: z.string(),
+ headers: z.array(headerSchema),
+ componentIds: z.array(z.number()),
+ })
+ .superRefine((data, ctx) => {
+ if (data.channelType === "email") {
+ const result = z.email().safeParse(data.email);
+ if (!result.success) {
+ ctx.addIssue({
+ code: "custom",
+ path: ["email"],
+ message: "Please enter a valid email",
+ });
+ }
+ } else {
+ const result = z.url().safeParse(data.webhookUrl);
+ if (!result.success) {
+ ctx.addIssue({
+ code: "custom",
+ path: ["webhookUrl"],
+ message: "Please enter a valid URL",
+ });
+ } else if (detectWebhookFlavor(data.webhookUrl) === "generic") {
+ ctx.addIssue({
+ code: "custom",
+ path: ["webhookUrl"],
+ message: "Only Slack and Discord webhook URLs are supported.",
+ });
+ }
+ }
+ });
+
+export type SubscriberFormValues = z.infer<typeof formSchema>;
+
+export type SubmitPayload =
+ | {
+ channelType: "email";
+ name: string;
+ email: string;
+ componentIds: number[];
+ }
+ | {
+ channelType: "webhook";
+ name: string;
+ webhookUrl: string;
+ headers: { key: string; value: string }[];
+ componentIds: number[];
+ };
+
+function toPayload(values: SubscriberFormValues): SubmitPayload {
+ if (values.channelType === "email") {
+ return {
+ channelType: "email",
+ name: values.name,
+ email: values.email,
+ componentIds: values.componentIds,
+ };
+ }
+ return {
+ channelType: "webhook",
+ name: values.name,
+ webhookUrl: values.webhookUrl,
+ headers: values.headers,
+ componentIds: values.componentIds,
+ };
+}
+
+const emptyDefaults: SubscriberFormValues = {
+ channelType: "email",
+ name: "",
+ email: "",
+ webhookUrl: "",
+ headers: [],
+ componentIds: [],
+};
+
+export function FormSubscriber({
+ defaultValues,
+ onSubmit,
+ className,
+ items,
+ editMode = false,
+ ...props
+}: Omit<React.ComponentProps<"form">, "onSubmit"> & {
+ defaultValues?: Partial<SubscriberFormValues>;
+ items: CheckboxTreeItem[];
+ onSubmit: (values: SubmitPayload) => Promise<void>;
+ /** When true, channel type is locked (editing an existing subscriber). */
+ editMode?: boolean;
+}) {
+ const form = useForm<SubscriberFormValues>({
+ resolver: zodResolver(formSchema),
+ defaultValues: { ...emptyDefaults, ...defaultValues },
+ });
+
+ const channelType = form.watch("channelType");
+ const [isPending, startTransition] = useTransition();
+ const { setIsDirty } = useFormSheetDirty();
+
+ const formIsDirty = form.formState.isDirty;
+ React.useEffect(() => {
+ setIsDirty(formIsDirty);
+ }, [formIsDirty, setIsDirty]);
+
+ const { fields, append, remove } = useFieldArray({
+ control: form.control,
+ name: "headers",
+ });
+
+ function submitAction(values: SubscriberFormValues) {
+ if (isPending) return;
+
+ startTransition(async () => {
+ try {
+ const promise = onSubmit(toPayload(values));
+ toast.promise(promise, {
+ loading: "Saving...",
+ success: () => "Saved",
+ error: (error) => {
+ if (isTRPCClientError(error)) {
+ return error.message;
+ }
+ return "Failed to save";
+ },
+ });
+ await promise;
+ } catch (error) {
+ console.error(error);
+ }
+ });
+ }
+
+ return (
+ <Form {...form}>
+ <form
+ className={cn("grid gap-4", className)}
+ onSubmit={form.handleSubmit(submitAction)}
+ {...props}
+ >
+ <FormCardContent>
+ <FormField
+ control={form.control}
+ name="channelType"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Channel</FormLabel>
+ <FormControl>
+ <Tabs
+ value={field.value}
+ onValueChange={(v) => {
+ if (editMode) return;
+ if (v === "email" || v === "webhook") {
+ field.onChange(v);
+ }
+ }}
+ >
+ <TabsList>
+ <TabsTrigger value="email" disabled={editMode}>
+ Email
+ </TabsTrigger>
+ <TabsTrigger value="webhook" disabled={editMode}>
+ Webhook
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </FormCardContent>
+ <FormCardSeparator />
+ <FormCardContent>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Display label (optional)</FormLabel>
+ <FormControl>
+ <Input
+ placeholder={
+ channelType === "webhook"
+ ? "Supabase #incidents"
+ : "Alice (Partner CTO)"
+ }
+ {...field}
+ />
+ </FormControl>
+ <FormDescription>
+ Shown in place of the raw destination in the dashboard.
+ </FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </FormCardContent>
+ <FormCardSeparator />
+ {channelType === "email" ? (
+ <FormCardContent>
+ <FormField
+ control={form.control}
+ name="email"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Email</FormLabel>
+ <FormControl>
+ <Input
+ type="email"
+ placeholder="[email protected]"
+ autoComplete="off"
+ readOnly={editMode}
+ {...field}
+ />
+ </FormControl>
+ {editMode ? (
+ <FormDescription>
+ Email address is immutable. Delete and re-add to change
+ it.
+ </FormDescription>
+ ) : (
+ <FormDescription>
+ By adding this email, you confirm this contact has
+ consented to receive status updates. We'll not be sending
+ a confirmation email.
+ </FormDescription>
+ )}
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </FormCardContent>
+ ) : (
+ <>
+ <FormCardContent>
+ <FormField
+ control={form.control}
+ name="webhookUrl"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Webhook URL</FormLabel>
+ <FormControl>
+ <Input
+ placeholder="https://hooks.slack.com/services/…"
+ autoComplete="off"
+ {...field}
+ />
+ </FormControl>
+ <FormDescription>
+ Only Slack and Discord webhook URLs are supported for now
+ - more channels to come.
+ </FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </FormCardContent>
+ <FormCardSeparator />
+ <FormCardContent>
+ <FormItem>
+ <FormLabel>Request Headers</FormLabel>
+ <FormDescription>
+ Custom headers to include in every webhook request.
+ </FormDescription>
+ {fields.map((f, idx) => (
+ <div key={f.id} className="grid gap-2 sm:grid-cols-5">
+ <FormField
+ control={form.control}
+ name={`headers.${idx}.key`}
+ render={({ field }) => (
+ <FormItem className="col-span-2">
+ <FormControl>
+ <Input placeholder="Key" {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name={`headers.${idx}.value`}
+ render={({ field }) => (
+ <FormItem className="col-span-2">
+ <FormControl>
+ <Input placeholder="Value" {...field} />
+ </FormControl>
+ </FormItem>
+ )}
+ />
+ <Button
+ size="icon"
+ variant="ghost"
+ type="button"
+ aria-label="Remove header"
+ onClick={() => remove(idx)}
+ >
+ <X />
+ </Button>
+ </div>
+ ))}
+ <div>
+ <Button
+ size="sm"
+ variant="outline"
+ type="button"
+ onClick={() => append({ key: "", value: "" })}
+ >
+ <Plus />
+ Add Header
+ </Button>
+ </div>
+ <FormMessage />
+ </FormItem>
+ </FormCardContent>
+ </>
+ )}
+ <FormCardSeparator />
+ <FormCardContent>
+ <FormField
+ control={form.control}
+ name="componentIds"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Page Components</FormLabel>
+ <FormDescription>
+ Leave empty to notify for the entire page. Select components
+ to only notify on matching reports.
+ </FormDescription>
+ {items.length ? (
+ <FormControl>
+ <CheckboxTree
+ items={items}
+ value={field.value ?? []}
+ onValueChange={field.onChange}
+ />
+ </FormControl>
+ ) : (
+ <EmptyStateContainer>
+ <EmptyStateTitle>No page components found</EmptyStateTitle>
+ </EmptyStateContainer>
+ )}
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </FormCardContent>
+ </form>
+ </Form>
+ );
+}
diff --git a/apps/dashboard/src/components/forms/subscriber/sheet.tsx b/apps/dashboard/src/components/forms/subscriber/sheet.tsx
new file mode 100644
index 000000000..25cb5685a
--- /dev/null
+++ b/apps/dashboard/src/components/forms/subscriber/sheet.tsx
@@ -0,0 +1,89 @@
+"use client";
+
+import { FormCard, FormCardGroup } from "@/components/forms/form-card";
+import {
+ FormSheetContent,
+ FormSheetDescription,
+ FormSheetFooter,
+ FormSheetHeader,
+ FormSheetTitle,
+ FormSheetTrigger,
+ FormSheetWithDirtyProtection,
+} from "@/components/forms/form-sheet";
+import {
+ FormSubscriber,
+ type SubmitPayload,
+ type SubscriberFormValues,
+} from "@/components/forms/subscriber/form";
+import type { CheckboxTreeItem } from "@/components/ui/checkbox-tree";
+import { Button } from "@openstatus/ui/components/ui/button";
+import { useState } from "react";
+
+type FormSheetSubscriberProps = {
+ children?: React.ReactNode;
+ defaultValues?: Partial<SubscriberFormValues>;
+ items: CheckboxTreeItem[];
+ onSubmit: (values: SubmitPayload) => Promise<void>;
+ editMode?: boolean;
+ title?: string;
+ description?: string;
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
+ triggerProps?: Omit<
+ React.ComponentProps<typeof FormSheetTrigger>,
+ "onSubmit" | "asChild"
+ >;
+};
+
+export function FormSheetSubscriber({
+ children,
+ defaultValues,
+ onSubmit,
+ items,
+ editMode = false,
+ title = "Add subscriber",
+ description = "Add an email or webhook subscriber. Partner starts receiving notifications immediately - no verification required.",
+ open: controlledOpen,
+ onOpenChange,
+ triggerProps,
+}: FormSheetSubscriberProps) {
+ const [internalOpen, setInternalOpen] = useState(false);
+ const open = controlledOpen ?? internalOpen;
+ const setOpen = onOpenChange ?? setInternalOpen;
+
+ return (
+ <FormSheetWithDirtyProtection open={open} onOpenChange={setOpen}>
+ {children ? (
+ <FormSheetTrigger {...(triggerProps ?? {})} asChild>
+ {children}
+ </FormSheetTrigger>
+ ) : null}
+ <FormSheetContent className="sm:max-w-lg">
+ <FormSheetHeader>
+ <FormSheetTitle>{title}</FormSheetTitle>
+ <FormSheetDescription>{description}</FormSheetDescription>
+ </FormSheetHeader>
+ <FormCardGroup className="overflow-y-auto">
+ <FormCard className="overflow-auto rounded-none border-none">
+ <FormSubscriber
+ items={items}
+ editMode={editMode}
+ onSubmit={async (values) => {
+ await onSubmit(values);
+ setOpen(false);
+ }}
+ defaultValues={defaultValues}
+ id="subscriber-form"
+ className="my-4"
+ />
+ </FormCard>
+ </FormCardGroup>
+ <FormSheetFooter>
+ <Button type="submit" form="subscriber-form">
+ Submit
+ </Button>
+ </FormSheetFooter>
+ </FormSheetContent>
+ </FormSheetWithDirtyProtection>
+ );
+}
diff --git a/apps/dashboard/src/components/ui/checkbox-tree.tsx b/apps/dashboard/src/components/ui/checkbox-tree.tsx
new file mode 100644
index 000000000..736a664d9
--- /dev/null
+++ b/apps/dashboard/src/components/ui/checkbox-tree.tsx
@@ -0,0 +1,148 @@
+"use client";
+
+import { Checkbox } from "@openstatus/ui/components/ui/checkbox";
+import { Label } from "@openstatus/ui/components/ui/label";
+import { cn } from "@openstatus/ui/lib/utils";
+import { useId } from "react";
+
+export type CheckboxTreeItem = {
+ id: number;
+ label: string;
+ children?: { id: number; label: string }[];
+};
+
+/**
+ * Build a CheckboxTree shape from a flat list of page components plus their
+ * optional groups. Components with a `groupId` nest under the matching group;
+ * ungrouped components render as top-level leaves.
+ */
+export function toCheckboxTreeItems(
+ components: { id: number; name: string; groupId?: number | null }[],
+ groups: { id: number; name: string }[] = [],
+): CheckboxTreeItem[] {
+ const groupIds = new Set(groups.map((g) => g.id));
+ const byGroup = new Map<number, { id: number; label: string }[]>();
+ const ungrouped: CheckboxTreeItem[] = [];
+
+ for (const c of components) {
+ if (c.groupId != null && groupIds.has(c.groupId)) {
+ const bucket = byGroup.get(c.groupId) ?? [];
+ bucket.push({ id: c.id, label: c.name });
+ byGroup.set(c.groupId, bucket);
+ } else {
+ ungrouped.push({ id: c.id, label: c.name });
+ }
+ }
+
+ const groupItems: CheckboxTreeItem[] = groups
+ .filter((g) => (byGroup.get(g.id)?.length ?? 0) > 0)
+ .map((g) => ({
+ id: g.id,
+ label: g.name,
+ children: byGroup.get(g.id),
+ }));
+
+ // Group the group IDs first (synthetic group ids may collide with component
+ // ids in rare cases — callers should treat tree ids as opaque). Then leaves.
+ return [...groupItems, ...ungrouped];
+}
+
+export type CheckboxTreeProps = {
+ items: CheckboxTreeItem[];
+ value: number[];
+ onValueChange: (value: number[]) => void;
+ className?: string;
+};
+
+export function CheckboxTree({
+ items,
+ value,
+ onValueChange,
+ className,
+}: CheckboxTreeProps) {
+ return (
+ <div className={cn("flex flex-col gap-2", className)}>
+ {items.map((item) => {
+ // A defined `children` array (even empty) marks this as a parent row,
+ // so callers with synthetic "Select all"-style parents can't accidentally
+ // fall through to the leaf branch and submit the parent's id.
+ if (item.children !== undefined) {
+ if (item.children.length === 0) return null;
+ const childIds = item.children.map((c) => c.id);
+ const allChecked = childIds.every((id) => value.includes(id));
+ const someChecked = childIds.some((id) => value.includes(id));
+ return (
+ <div key={`group-${item.id}`} className="flex flex-col gap-2">
+ <CheckboxTreeRow
+ label={item.label}
+ checked={
+ allChecked ? true : someChecked ? "indeterminate" : false
+ }
+ onCheckedChange={(checked) => {
+ if (checked) {
+ onValueChange([...new Set([...value, ...childIds])]);
+ } else {
+ onValueChange(value.filter((id) => !childIds.includes(id)));
+ }
+ }}
+ />
+ {item.children.map((child) => (
+ <CheckboxTreeRow
+ key={`component-${child.id}`}
+ className="pl-6"
+ label={child.label}
+ checked={value.includes(child.id)}
+ onCheckedChange={(checked) => {
+ if (checked) {
+ onValueChange([...value, child.id]);
+ } else {
+ onValueChange(value.filter((id) => id !== child.id));
+ }
+ }}
+ />
+ ))}
+ </div>
+ );
+ }
+ return (
+ <CheckboxTreeRow
+ key={`component-${item.id}`}
+ label={item.label}
+ checked={value.includes(item.id)}
+ onCheckedChange={(checked) => {
+ if (checked) {
+ onValueChange([...value, item.id]);
+ } else {
+ onValueChange(value.filter((id) => id !== item.id));
+ }
+ }}
+ />
+ );
+ })}
+ </div>
+ );
+}
+
+function CheckboxTreeRow({
+ label,
+ checked,
+ onCheckedChange,
+ className,
+}: {
+ label: string;
+ checked: boolean | "indeterminate";
+ onCheckedChange: (checked: boolean) => void;
+ className?: string;
+}) {
+ const id = useId();
+ return (
+ <div className={cn("flex items-center gap-2", className)}>
+ <Checkbox
+ id={id}
+ checked={checked}
+ onCheckedChange={(c) => onCheckedChange(c === true)}
+ />
+ <Label htmlFor={id}>{label}</Label>
+ </div>
+ );
+}
diff --git a/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx b/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx
index 37fd832c4..5773eaa2e 100644
--- a/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx
+++ b/apps/dashboard/src/components/ui/data-table/data-table-faceted-filter.tsx
@@ -113,7 +113,11 @@ export function DataTableFacetedFilter<TData, TValue>({
: "opacity-50 [&_svg]:invisible",
)}
>
- <Check />
+ <Check
+ className={cn(
+ isSelected ? "text-primary-foreground" : undefined,
+ )}
+ />
</div>
{option.icon && (
<option.icon className="mr-2 h-4 w-4 text-muted-foreground" />
diff --git a/apps/server/package.json b/apps/server/package.json
index 4ed547539..292d6be13 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -61,6 +61,7 @@
"zod": "4.1.13"
},
"devDependencies": {
+ "@openstatus/locales": "workspace:*",
"@openstatus/tsconfig": "workspace:*",
"@types/validator": "13.12.0",
"bun-types": "1.3.1",
diff --git a/apps/server/src/libs/test/preload.ts b/apps/server/src/libs/test/preload.ts
index 304600f80..eede029c8 100644
--- a/apps/server/src/libs/test/preload.ts
+++ b/apps/server/src/libs/test/preload.ts
@@ -1,4 +1,7 @@
import { mock } from "bun:test";
+// Import the real module BEFORE mock.module runs so we can spread real
+// service functions (createSubscription, updateChannel, etc.) into the
+// replacement while still stubbing the dispatch-side spies.
import * as realSubscriptions from "@openstatus/subscriptions";
// Subscription dispatch spies — accessible in tests via globalThis.__subscriptionSpies
diff --git a/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts b/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts
index 531389437..376eff2d7 100644
--- a/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts
+++ b/apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts
@@ -1991,6 +1991,201 @@ describe("StatusPageService.UnsubscribeFromPage", () => {
});
});
+describe("StatusPageService.CreatePageSubscription", () => {
+ test("creates a vendor-added email subscriber", async () => {
+ const email = `${TEST_PREFIX}[email protected]`;
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ {
+ pageId: String(testPageId),
+ name: "Partner contact",
+ componentIds: [String(testComponentId)],
+ emailChannel: { email },
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data).toHaveProperty("subscriber");
+ expect(data.subscriber.email).toBe(email);
+ expect(data.subscriber.pageId).toBe(String(testPageId));
+ expect(data.subscriber.channelType).toBe("email");
+ expect(data.subscriber.name).toBe("Partner contact");
+ expect(data.subscriber.source).toBe("SUBSCRIBER_SOURCE_VENDOR");
+ // Vendor-added rows skip verification — acceptedAt should be stamped.
+ expect(data.subscriber.acceptedAt).not.toBe("");
+ expect(data.subscriber.componentIds).toEqual([String(testComponentId)]);
+
+ // Row exists in DB with expected columns.
+ const row = await db
+ .select()
+ .from(pageSubscriber)
+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)))
+ .get();
+ expect(row?.source).toBe("vendor");
+ expect(row?.channelType).toBe("email");
+ expect(row?.email).toBe(email);
+ expect(row?.token).toBeTruthy();
+
+ await db
+ .delete(pageSubscriber)
+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)));
+ });
+
+ test("creates a vendor-added webhook subscriber with headers", async () => {
+ const webhookUrl = `https://hooks.slack.com/services/T00000000/B00000000/${TEST_PREFIX}-create`;
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ {
+ pageId: String(testPageId),
+ name: "Partner Slack",
+ webhookChannel: {
+ webhookUrl,
+ headers: [{ key: "X-Partner", value: "acme" }],
+ },
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ expect(data.subscriber.channelType).toBe("webhook");
+ expect(data.subscriber.webhookUrl).toBe(webhookUrl);
+ expect(data.subscriber.source).toBe("SUBSCRIBER_SOURCE_VENDOR");
+
+ const row = await db
+ .select()
+ .from(pageSubscriber)
+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)))
+ .get();
+ expect(row?.channelType).toBe("webhook");
+ expect(row?.webhookUrl).toBe(webhookUrl);
+ expect(row?.email).toBeNull();
+ const config = row?.channelConfig ? JSON.parse(row.channelConfig) : null;
+ expect(config?.headers?.[0]).toEqual({ key: "X-Partner", value: "acme" });
+
+ await db
+ .delete(pageSubscriber)
+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)));
+ });
+
+ test("omits channelConfig when no headers supplied", async () => {
+ const webhookUrl = `https://hooks.slack.com/services/T00000000/B00000000/${TEST_PREFIX}-no-headers`;
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ {
+ pageId: String(testPageId),
+ webhookChannel: { webhookUrl },
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(200);
+
+ const data = await res.json();
+ const row = await db
+ .select()
+ .from(pageSubscriber)
+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)))
+ .get();
+ expect(row?.channelConfig).toBeNull();
+
+ await db
+ .delete(pageSubscriber)
+ .where(eq(pageSubscriber.id, Number(data.subscriber.id)));
+ });
+
+ test("rejects when email already has an active subscription", async () => {
+ const email = `${TEST_PREFIX}[email protected]`;
+
+ // Seed an existing active email subscriber.
+ const [existing] = await db
+ .insert(pageSubscriber)
+ .values({
+ pageId: testPageId,
+ email,
+ channelType: "email",
+ source: "self_signup",
+ token: "dup-token",
+ acceptedAt: new Date(),
+ })
+ .returning({ id: pageSubscriber.id });
+
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ {
+ pageId: String(testPageId),
+ emailChannel: { email },
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ // Generic internal error — service's friendly message isn't echoed to the wire.
+ expect(res.status).toBeGreaterThanOrEqual(400);
+
+ await db.delete(pageSubscriber).where(eq(pageSubscriber.id, existing.id));
+ });
+
+ test("returns 401 when no auth key provided", async () => {
+ const res = await connectRequest("CreatePageSubscription", {
+ pageId: String(testPageId),
+ emailChannel: { email: "[email protected]" },
+ });
+
+ expect(res.status).toBe(401);
+ });
+
+ test("returns 404 for non-existent page", async () => {
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ {
+ pageId: "99999",
+ emailChannel: { email: `${TEST_PREFIX}[email protected]` },
+ },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ test("returns error when channel oneof is unset", async () => {
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ { pageId: String(testPageId) },
+ { "x-openstatus-key": "1" },
+ );
+
+ expect(res.status).toBeGreaterThanOrEqual(400);
+ });
+
+ test("rejects when workspace has status-subscribers disabled", async () => {
+ // Temporarily disable the plan flag, hit the endpoint, then restore.
+ await db.run(
+ sql`UPDATE workspace SET limits = json_set(COALESCE(limits, '{}'), '$."status-subscribers"', json('false')) WHERE id = 1`,
+ );
+ try {
+ const res = await connectRequest(
+ "CreatePageSubscription",
+ {
+ pageId: String(testPageId),
+ emailChannel: {
+ email: `${TEST_PREFIX}[email protected]`,
+ },
+ },
+ { "x-openstatus-key": "1" },
+ );
+ expect(res.status).toBe(403);
+ } finally {
+ await db.run(
+ sql`UPDATE workspace SET limits = json_set(COALESCE(limits, '{}'), '$."status-subscribers"', json('true')) WHERE id = 1`,
+ );
+ }
+ });
+});
+
describe("StatusPageService.ListSubscribers", () => {
test("returns subscribers for page", async () => {
const res = await connectRequest(
diff --git a/apps/server/src/routes/rpc/services/status-page/converters.ts b/apps/server/src/routes/rpc/services/status-page/converters.ts
index 7076c238b..b287dd66f 100644
--- a/apps/server/src/routes/rpc/services/status-page/converters.ts
+++ b/apps/server/src/routes/rpc/services/status-page/converters.ts
@@ -5,6 +5,7 @@ import type {
PageSubscriber,
StatusPage,
StatusPageSummary,
+ WebhookChannelHeader,
} from "@openstatus/proto/status_page/v1";
import {
OverallStatus,
@@ -12,6 +13,7 @@ import {
PageComponentType,
PageTheme,
Locale as ProtoLocale,
+ SubscriberSource,
} from "@openstatus/proto/status_page/v1";
/**
@@ -62,14 +64,20 @@ type DBPageComponentGroup = {
updatedAt: Date | null;
};
-type DBPageSubscriber = {
+export type DBPageSubscriber = {
id: number;
pageId: number;
- email: string;
+ email: string | null;
acceptedAt: Date | null;
unsubscribedAt: Date | null;
createdAt: Date | null;
updatedAt: Date | null;
+ source: "self_signup" | "vendor" | "import";
+ name: string | null;
+ channelType: "email" | "webhook";
+ webhookUrl: string | null;
+ channelConfig: string | null;
+ componentIds?: number[];
};
/**
@@ -289,21 +297,76 @@ export function dbGroupToProto(
};
}
+/**
+ * Normalize proto WebhookChannelHeader[] into plain {key,value}[].
+ *
+ * Drops runtime-only fields like `$typeName` so nothing proto-specific
+ * reaches the DB. Mirrors the pattern used by `headersToDbJson` in the
+ * monitor converters (`monitor/converters/headers.ts`).
+ */
+export function protoHeadersToPlain(
+ headers: WebhookChannelHeader[] | undefined,
+): { key: string; value: string }[] {
+ return (headers ?? []).map((h) => ({ key: h.key, value: h.value }));
+}
+
+/**
+ * Convert a DB subscriber-source string to proto enum.
+ */
+export function dbSubscriberSourceToProto(
+ source: "self_signup" | "vendor" | "import",
+): SubscriberSource {
+ switch (source) {
+ case "self_signup":
+ return SubscriberSource.SELF_SIGNUP;
+ case "vendor":
+ return SubscriberSource.VENDOR;
+ case "import":
+ return SubscriberSource.IMPORT;
+ default:
+ return SubscriberSource.UNSPECIFIED;
+ }
+}
+
/**
* Convert a DB subscriber to proto format.
+ *
+ * Mirrors the tRPC `list` behavior: non-vendor rows get the webhook URL
+ * reduced to origin-only and no `channelConfig`. Vendor-owned rows get
+ * the full URL + config because the vendor is the one who configured them.
*/
+function webhookUrlForProto(
+ source: DBPageSubscriber["source"],
+ webhookUrl: string | null,
+): string | undefined {
+ if (!webhookUrl) return undefined;
+ if (source === "vendor") return webhookUrl;
+ try {
+ return new URL(webhookUrl).origin;
+ } catch {
+ return undefined;
+ }
+}
+
export function dbSubscriberToProto(
subscriber: DBPageSubscriber,
): PageSubscriber {
+ const isVendor = subscriber.source === "vendor";
return {
$typeName: "openstatus.status_page.v1.PageSubscriber" as const,
id: String(subscriber.id),
pageId: String(subscriber.pageId),
- email: subscriber.email,
+ email: subscriber.email ?? "",
acceptedAt: subscriber.acceptedAt?.toISOString() ?? "",
unsubscribedAt: subscriber.unsubscribedAt?.toISOString() ?? "",
createdAt: subscriber.createdAt?.toISOString() ?? "",
updatedAt: subscriber.updatedAt?.toISOString() ?? "",
+ source: dbSubscriberSourceToProto(subscriber.source),
+ name: subscriber.name ?? undefined,
+ channelType: subscriber.channelType,
+ webhookUrl: webhookUrlForProto(subscriber.source, subscriber.webhookUrl),
+ channelConfig: isVendor ? subscriber.channelConfig ?? undefined : undefined,
+ componentIds: (subscriber.componentIds ?? []).map(String),
};
}
diff --git a/apps/server/src/routes/rpc/services/status-page/index.ts b/apps/server/src/routes/rpc/services/status-page/index.ts
index 0514703ec..5383308dd 100644
--- a/apps/server/src/routes/rpc/services/status-page/index.ts
+++ b/apps/server/src/routes/rpc/services/status-page/index.ts
@@ -28,16 +28,23 @@ import {
OverallStatus,
PageAccessType,
} from "@openstatus/proto/status_page/v1";
-import { getChannel, upsertEmailSubscription } from "@openstatus/subscriptions";
+import {
+ createSubscription as createSubscriptionService,
+ detectWebhookFlavor,
+ getChannel,
+ upsertEmailSubscription,
+} from "@openstatus/subscriptions";
import { getRpcContext } from "../../interceptors";
import {
+ type DBPageSubscriber,
dbComponentToProto,
dbGroupToProto,
dbPageToProto,
dbPageToProtoSummary,
dbSubscriberToProto,
protoAccessTypeToDb,
+ protoHeadersToPlain,
protoLocaleToDb,
protoThemeToDb,
} from "./converters";
@@ -956,6 +963,88 @@ export const statusPageServiceImpl: ServiceImpl<typeof StatusPageService> = {
};
},
+ async createPageSubscription(req, ctx) {
+ const rpcCtx = getRpcContext(ctx);
+ const workspaceId = rpcCtx.workspace.id;
+
+ if (!rpcCtx.workspace.limits["status-subscribers"]) {
+ throw new ConnectError(
+ "Upgrade to use status subscribers",
+ Code.PermissionDenied,
+ );
+ }
+
+ const pageData = await getPageById(Number(req.pageId), workspaceId);
+ if (!pageData) {
+ throw statusPageNotFoundError(req.pageId);
+ }
+
+ const componentIds = (req.componentIds ?? []).map((id) => Number(id));
+ const name = req.name ?? null;
+
+ let subscriberRow: DBPageSubscriber | undefined;
+ try {
+ if (req.channel.case === "emailChannel") {
+ const created = await createSubscriptionService({
+ pageId: pageData.id,
+ channelType: "email",
+ email: req.channel.value.email,
+ name,
+ componentIds,
+ });
+ subscriberRow = await db
+ .select()
+ .from(pageSubscriber)
+ .where(eq(pageSubscriber.id, created.id))
+ .get();
+ } else if (req.channel.case === "webhookChannel") {
+ const webhookUrl = req.channel.value.webhookUrl;
+ if (detectWebhookFlavor(webhookUrl) === "generic") {
+ throw new ConnectError(
+ "Only Slack and Discord webhook URLs are supported.",
+ Code.InvalidArgument,
+ );
+ }
+ const headers = protoHeadersToPlain(req.channel.value.headers);
+ const created = await createSubscriptionService({
+ pageId: pageData.id,
+ channelType: "webhook",
+ webhookUrl,
+ name,
+ channelConfig: headers.length > 0 ? { headers } : undefined,
+ componentIds,
+ });
+ subscriberRow = await db
+ .select()
+ .from(pageSubscriber)
+ .where(eq(pageSubscriber.id, created.id))
+ .get();
+ } else {
+ throw new ConnectError(
+ "channel oneof must be set to email_channel or webhook_channel",
+ Code.InvalidArgument,
+ );
+ }
+ } catch (error) {
+ if (error instanceof ConnectError) throw error;
+ // Don't echo raw service-layer error messages to RPC clients; they may
+ // contain details that shouldn't be exposed. Log server-side for debugging.
+ console.error("createPageSubscription failed:", error);
+ throw subscriberCreateFailedError();
+ }
+
+ if (!subscriberRow) {
+ throw subscriberCreateFailedError();
+ }
+
+ return {
+ subscriber: dbSubscriberToProto({
+ ...subscriberRow,
+ componentIds,
+ }),
+ };
+ },
+
async unsubscribeFromPage(req, ctx) {
const rpcCtx = getRpcContext(ctx);
const workspaceId = rpcCtx.workspace.id;
diff --git a/apps/server/static/openapi.yaml b/apps/server/static/openapi.yaml
index 72dae9f78..198fd6a6e 100644
--- a/apps/server/static/openapi.yaml
+++ b/apps/server/static/openapi.yaml
@@ -2180,6 +2180,58 @@ components:
title: CreateComponentGroupResponse
additionalProperties: false
description: CreateComponentGroupResponse is the response after creating a component group.
+ openstatus.status_page.v1.CreatePageSubscriptionRequest:
+ type: object
+ allOf:
+ - properties:
+ pageId:
+ type: string
+ title: page_id
+ minLength: 1
+ description: ID of the status page (required).
+ name:
+ type:
+ - string
+ - "null"
+ title: name
+ maxLength: 255
+ description: Optional human-readable label.
+ componentIds:
+ type: array
+ items:
+ type: string
+ title: component_ids
+ description: Component scope. Empty = entire page.
+ - oneOf:
+ - type: object
+ properties:
+ emailChannel:
+ title: email_channel
+ $ref: '#/components/schemas/openstatus.status_page.v1.EmailChannel'
+ title: email_channel
+ required:
+ - emailChannel
+ - type: object
+ properties:
+ webhookChannel:
+ title: webhook_channel
+ $ref: '#/components/schemas/openstatus.status_page.v1.WebhookChannel'
+ title: webhook_channel
+ required:
+ - webhookChannel
+ title: CreatePageSubscriptionRequest
+ additionalProperties: false
+ description: CreatePageSubscriptionRequest is the request to add a vendor-managed subscriber to a status page.
+ openstatus.status_page.v1.CreatePageSubscriptionResponse:
+ type: object
+ properties:
+ subscriber:
+ title: subscriber
+ description: The created subscriber.
+ $ref: '#/components/schemas/openstatus.status_page.v1.PageSubscriber'
+ title: CreatePageSubscriptionResponse
+ additionalProperties: false
+ description: CreatePageSubscriptionResponse is the response after creating a vendor-managed subscription.
openstatus.status_page.v1.CreateStatusPageRequest:
type: object
properties:
@@ -2340,6 +2392,17 @@ components:
title: DeleteStatusPageResponse
additionalProperties: false
description: DeleteStatusPageResponse is the response after deleting a status page.
+ openstatus.status_page.v1.EmailChannel:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ format: email
+ description: Email address of the subscriber (required).
+ title: EmailChannel
+ additionalProperties: false
+ description: EmailChannel carries the email-channel fields for CreatePageSubscription.
openstatus.status_page.v1.GetOverallStatusRequest:
type: object
oneOf:
@@ -2685,7 +2748,7 @@ components:
email:
type: string
title: email
- description: Email address of the subscriber.
+ description: Email address of the subscriber (empty for webhook channels).
acceptedAt:
type: string
title: accepted_at
@@ -2702,6 +2765,38 @@ components:
type: string
title: updated_at
description: Timestamp when the subscription was last updated (RFC 3339 format).
+ source:
+ title: source
+ description: How the subscription was created. Vendor-added rows skip verification.
+ $ref: '#/components/schemas/openstatus.status_page.v1.SubscriberSource'
+ name:
+ type:
+ - string
+ - "null"
+ title: name
+ description: 'Optional human-readable label (e.g. "Supabase #incidents").'
+ channelType:
+ type: string
+ title: channel_type
+ description: 'Channel type: "email" or "webhook".'
+ webhookUrl:
+ type:
+ - string
+ - "null"
+ title: webhook_url
+ description: Webhook URL (populated only for channel_type = "webhook").
+ channelConfig:
+ type:
+ - string
+ - "null"
+ title: channel_config
+ description: JSON-encoded channel config (e.g. custom headers). Populated for webhook channels.
+ componentIds:
+ type: array
+ items:
+ type: string
+ title: component_ids
+ description: IDs of components this subscription is scoped to. Empty = entire page.
title: PageSubscriber
additionalProperties: false
description: PageSubscriber represents a subscriber to a status page.
@@ -2893,6 +2988,15 @@ components:
title: SubscribeToPageResponse
additionalProperties: false
description: SubscribeToPageResponse is the response after subscribing to a status page.
+ openstatus.status_page.v1.SubscriberSource:
+ type: string
+ title: SubscriberSource
+ enum:
+ - SUBSCRIBER_SOURCE_UNSPECIFIED
+ - SUBSCRIBER_SOURCE_SELF_SIGNUP
+ - SUBSCRIBER_SOURCE_VENDOR
+ - SUBSCRIBER_SOURCE_IMPORT
+ description: SubscriberSource indicates how the subscription was created.
openstatus.status_page.v1.UnsubscribeFromPageRequest:
type: object
allOf:
@@ -3145,6 +3249,38 @@ components:
title: UpdateStatusPageResponse
additionalProperties: false
description: UpdateStatusPageResponse is the response after updating a status page.
+ openstatus.status_page.v1.WebhookChannel:
+ type: object
+ properties:
+ webhookUrl:
+ type: string
+ title: webhook_url
+ maxLength: 2048
+ minLength: 1
+ format: uri
+ description: Webhook URL (required). Payload flavor (Slack / Discord / generic) is auto-detected from the URL prefix.
+ headers:
+ type: array
+ items:
+ $ref: '#/components/schemas/openstatus.status_page.v1.WebhookChannelHeader'
+ title: headers
+ description: Optional custom HTTP headers attached to every dispatch.
+ title: WebhookChannel
+ additionalProperties: false
+ description: WebhookChannel carries the webhook-channel fields for CreatePageSubscription.
+ openstatus.status_page.v1.WebhookChannelHeader:
+ type: object
+ properties:
+ key:
+ type: string
+ title: key
+ minLength: 1
+ value:
+ type: string
+ title: value
+ title: WebhookChannelHeader
+ additionalProperties: false
+ description: WebhookChannelHeader is a single custom HTTP header.
openstatus.status_report.v1.AddStatusReportUpdateRequest:
type: object
properties:
@@ -4500,6 +4636,32 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/openstatus.status_page.v1.CreateComponentGroupResponse'
+ /rpc/openstatus.status_page.v1.StatusPageService/CreatePageSubscription:
+ post:
+ tags:
+ - StatusPageService
+ summary: 'CreatePageSubscription: operator-added subscriber (email or webhook), no verification.'
+ description: Operator-added subscriber (email or webhook) with no verification flow — the partner starts receiving notifications immediately. Supports Slack and Discord webhook URLs in addition to email. A management token is still generated so the subscriber can self-manage (update scope, unsubscribe) without operator involvement. Use this for vendor/partner integrations where consent is established out-of-band; use SubscribeToPage for subscriber-initiated signups that require double opt-in.
+ operationId: StatusPageService_CreatePageSubscription
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/openstatus.status_page.v1.CreatePageSubscriptionRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/openstatus.status_page.v1.CreatePageSubscriptionResponse'
/rpc/openstatus.status_page.v1.StatusPageService/CreateStatusPage:
post:
tags:
@@ -4868,8 +5030,8 @@ paths:
post:
tags:
- StatusPageService
- summary: SubscribeToPage
- description: Subscribes an email address to receive notifications from a status page. If the email was previously unsubscribed, the subscription is reactivated instead of creating a duplicate.
+ summary: 'SubscribeToPage: end-user email self-signup with double opt-in verification.'
+ description: End-user email self-signup with double opt-in verification. A verification email is sent and the subscription activates only after the recipient confirms. If the email was previously unsubscribed, the existing row is reactivated instead of a duplicate being created. Use this for subscriber-initiated signups on the public status page; use CreatePageSubscription for operator-initiated (vendor) subscriptions that should skip verification.
operationId: StatusPageService_SubscribeToPage
requestBody:
content:
diff --git a/packages/api/src/router/pageSubscriber.ts b/packages/api/src/router/pageSubscriber.ts
index cb4e2f4a3..6b5297164 100644
--- a/packages/api/src/router/pageSubscriber.ts
+++ b/packages/api/src/router/pageSubscriber.ts
@@ -1,9 +1,18 @@
-import { and, eq } from "@openstatus/db";
-import { page, pageSubscriber } from "@openstatus/db/src/schema";
+import { Events } from "@openstatus/analytics";
+import { and, db, eq } from "@openstatus/db";
import {
+ page,
+ pageSubscriber,
+ selectWorkspaceSchema,
+} from "@openstatus/db/src/schema";
+import {
+ createSubscription,
+ detectWebhookFlavor,
getSubscriptionByToken,
hasPendingUnexpiredSubscription,
+ sendTestWebhook,
unsubscribe,
+ updateChannel,
updateSubscriptionScope,
upsertEmailSubscription,
verifySubscription,
@@ -13,6 +22,81 @@ import { z } from "zod";
import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";
+const webhookHeadersSchema = z
+ .array(
+ z.object({
+ key: z.string().min(1).max(256),
+ value: z.string().max(4096),
+ }),
+ )
+ .max(20)
+ .optional();
+
+const supportedWebhookUrlSchema = z
+ .url()
+ .refine((url) => detectWebhookFlavor(url) !== "generic", {
+ message: "Only Slack and Discord webhook URLs are supported.",
+ });
+
+async function assertPageInWorkspace(pageId: number, workspaceId: number) {
+ const _page = await db.query.page.findFirst({
+ where: and(eq(page.workspaceId, workspaceId), eq(page.id, pageId)),
+ with: { workspace: true },
+ });
+ if (!_page) {
+ throw new TRPCError({ code: "NOT_FOUND", message: "Page not found" });
+ }
+ return _page;
+}
+
+// Explicit allow-list of service-layer messages that are safe to surface to
+// clients. Anything else — including new paths added to the service later —
+// is logged server-side and replaced with the procedure's fallback, so we
+// can't accidentally leak IDs, emails, or raw SQL through an unvetted code
+// path.
+const SAFE_SERVICE_MESSAGES = new Set<string>([
+ "Page not found",
+ "Some components do not belong to this page",
+ "A subscriber with this email already exists for this page.",
+ "A subscriber with this webhook URL already exists for this page.",
+ "Only Slack and Discord webhook URLs are supported.",
+ "Subscriber not found",
+ "Subscriber is not a webhook channel",
+ "Self-signup subscribers manage their own subscription; use the unsubscribe action instead.",
+ "Email subscribers do not have webhook fields to edit.",
+ "Only vendor-added webhook subscribers support test dispatch.",
+ "Subscription not found",
+ "Subscription not yet verified",
+ "Subscription is unsubscribed",
+ "Verification token expired",
+]);
+
+function throwFromException(error: unknown, fallback: string): never {
+ if (error instanceof TRPCError) throw error;
+ console.error("pageSubscriber router error:", error);
+ if (error instanceof Error && SAFE_SERVICE_MESSAGES.has(error.message)) {
+ throw new TRPCError({ code: "BAD_REQUEST", message: error.message });
+ }
+ throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: fallback });
+}
+
+/**
+ * Reduce a webhook URL to its origin so the secret path isn't exposed.
+ * Used when the row isn't owned by the vendor (self-signup / import).
+ */
+function webhookUrlForList(
+ source: string,
+ webhookUrl: string | null,
+): string | null {
+ if (!webhookUrl) return null;
+ if (source === "vendor") return webhookUrl;
+ try {
+ return new URL(webhookUrl).origin;
+ } catch {
+ return null;
+ }
+}
+
export const pageSubscriberRouter = createTRPCRouter({
/**
* PUBLIC: Subscribe to a status page (or update existing subscription)
@@ -22,7 +106,7 @@ export const pageSubscriberRouter = createTRPCRouter({
z.object({
email: z.email(),
pageId: z.number().int().positive(),
- componentIds: z.array(z.number().int().positive()).optional(),
+ componentIds: z.array(z.number().int().positive()).max(500).optional(),
}),
)
.mutation(async (opts) => {
@@ -55,16 +139,7 @@ export const pageSubscriberRouter = createTRPCRouter({
},
};
} catch (error) {
- if (error instanceof Error) {
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: error.message,
- });
- }
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: "Failed to create subscription",
- });
+ throwFromException(error, "Failed to create subscription");
}
}),
@@ -103,17 +178,7 @@ export const pageSubscriberRouter = createTRPCRouter({
},
};
} catch (error) {
- if (error instanceof TRPCError) throw error;
- if (error instanceof Error) {
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: error.message,
- });
- }
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: "Failed to verify subscription",
- });
+ throwFromException(error, "Failed to verify subscription");
}
}),
@@ -160,7 +225,7 @@ export const pageSubscriberRouter = createTRPCRouter({
.input(
z.object({
token: z.string(),
- componentIds: z.array(z.number().int().positive()),
+ componentIds: z.array(z.number().int().positive()).max(500),
domain: z.string().toLowerCase().optional(),
}),
)
@@ -180,16 +245,7 @@ export const pageSubscriberRouter = createTRPCRouter({
},
};
} catch (error) {
- if (error instanceof Error) {
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: error.message,
- });
- }
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: "Failed to update subscription scope",
- });
+ throwFromException(error, "Failed to update subscription scope");
}
}),
@@ -209,16 +265,7 @@ export const pageSubscriberRouter = createTRPCRouter({
return { success: true };
} catch (error) {
- if (error instanceof Error) {
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: error.message,
- });
- }
- throw new TRPCError({
- code: "BAD_REQUEST",
- message: "Failed to unsubscribe",
- });
+ throwFromException(error, "Failed to unsubscribe");
}
}),
@@ -263,26 +310,173 @@ export const pageSubscriberRouter = createTRPCRouter({
: desc(subs.createdAt),
});
- return subscriptions.map((sub) => ({
- id: sub.id,
- channelType: sub.channelType,
- email: sub.email,
- webhookUrl: sub.webhookUrl,
- acceptedAt: sub.acceptedAt,
- unsubscribedAt: sub.unsubscribedAt,
- createdAt: sub.createdAt,
- components: sub.components.map((c) => ({
- id: c.pageComponent.id,
- name: c.pageComponent.name,
- })),
- isEntirePage: sub.components.length === 0,
- pageId: sub.pageId,
- }));
+ return subscriptions.map((sub) => {
+ const isVendor = sub.source === "vendor";
+ return {
+ id: sub.id,
+ channelType: sub.channelType,
+ email: sub.email,
+ // Vendor rows own the URL + config; other sources only expose the
+ // origin (no credential-bearing path) and no channelConfig.
+ webhookUrl: webhookUrlForList(sub.source, sub.webhookUrl),
+ channelConfig: isVendor ? sub.channelConfig : null,
+ source: sub.source,
+ name: sub.name,
+ acceptedAt: sub.acceptedAt,
+ unsubscribedAt: sub.unsubscribedAt,
+ createdAt: sub.createdAt,
+ components: sub.components.map((c) => ({
+ id: c.pageComponent.id,
+ name: c.pageComponent.name,
+ })),
+ isEntirePage: sub.components.length === 0,
+ pageId: sub.pageId,
+ };
+ });
});
return data;
}),
+ /**
+ * PROTECTED: Create a vendor-added subscription (email or webhook).
+ *
+ * Skips the verification flow — partner starts receiving notifications
+ * immediately. `token` is still generated so the partner can self-manage
+ * via the existing `/manage/{token}` and `/unsubscribe/{token}` routes.
+ */
+ createSubscription: protectedProcedure
+ .meta({ track: Events.SubscribePage })
+ .input(
+ z.discriminatedUnion("channelType", [
+ z.object({
+ pageId: z.number().int().positive(),
+ channelType: z.literal("email"),
+ email: z.email(),
+ name: z.string().max(255).nullish(),
+ componentIds: z
+ .array(z.number().int().positive())
+ .max(500)
+ .optional(),
+ }),
+ z.object({
+ pageId: z.number().int().positive(),
+ channelType: z.literal("webhook"),
+ webhookUrl: supportedWebhookUrlSchema,
+ name: z.string().max(255).nullish(),
+ headers: webhookHeadersSchema,
+ componentIds: z
+ .array(z.number().int().positive())
+ .max(500)
+ .optional(),
+ }),
+ ]),
+ )
+ .mutation(async (opts) => {
+ const _page = await assertPageInWorkspace(
+ opts.input.pageId,
+ opts.ctx.workspace.id,
+ );
+
+ const workspace = selectWorkspaceSchema.safeParse(_page.workspace);
+ if (!workspace.success) {
+ throw new TRPCError({
+ code: "BAD_REQUEST",
+ message: "Workspace data is invalid",
+ });
+ }
+ if (!workspace.data.limits["status-subscribers"]) {
+ throw new TRPCError({
+ code: "FORBIDDEN",
+ message: "Upgrade to use status subscribers",
+ });
+ }
+
+ try {
+ if (opts.input.channelType === "email") {
+ const sub = await createSubscription({
+ pageId: opts.input.pageId,
+ channelType: "email",
+ email: opts.input.email,
+ name: opts.input.name ?? null,
+ componentIds: opts.input.componentIds,
+ });
+ return { success: true, id: sub.id };
+ }
+
+ const sub = await createSubscription({
+ pageId: opts.input.pageId,
+ channelType: "webhook",
+ webhookUrl: opts.input.webhookUrl,
+ name: opts.input.name ?? null,
+ channelConfig: opts.input.headers
+ ? { headers: opts.input.headers }
+ : undefined,
+ componentIds: opts.input.componentIds,
+ });
+ return { success: true, id: sub.id };
+ } catch (error) {
+ throwFromException(error, "Failed to create subscription");
+ }
+ }),
+
+ /**
+ * PROTECTED: Update a vendor-added subscription's channel config / scope.
+ * Self-signup rows are rejected — they self-manage via token.
+ */
+ updateChannel: protectedProcedure
+ .input(
+ z.object({
+ subscriberId: z.number().int().positive(),
+ pageId: z.number().int().positive(),
+ name: z.string().max(255).nullish(),
+ webhookUrl: supportedWebhookUrlSchema.optional(),
+ headers: webhookHeadersSchema,
+ componentIds: z.array(z.number().int().positive()).max(500).optional(),
+ }),
+ )
+ .mutation(async (opts) => {
+ await assertPageInWorkspace(opts.input.pageId, opts.ctx.workspace.id);
+
+ try {
+ await updateChannel({
+ subscriberId: opts.input.subscriberId,
+ pageId: opts.input.pageId,
+ name: opts.input.name === undefined ? undefined : opts.input.name,
+ webhookUrl: opts.input.webhookUrl,
+ channelConfig:
+ opts.input.headers !== undefined
+ ? { headers: opts.input.headers }
+ : undefined,
+ componentIds: opts.input.componentIds,
+ });
+ return { success: true };
+ } catch (error) {
+ throwFromException(error, "Failed to update subscription");
+ }
+ }),
+
+ /**
+ * PROTECTED: Send a test payload to a vendor-added webhook subscriber.
+ */
+ sendTestWebhook: protectedProcedure
+ .input(
+ z.object({
+ subscriberId: z.number().int().positive(),
+ pageId: z.number().int().positive(),
+ }),
+ )
+ .mutation(async (opts) => {
+ await assertPageInWorkspace(opts.input.pageId, opts.ctx.workspace.id);
+
+ try {
+ await sendTestWebhook(opts.input.subscriberId, opts.input.pageId);
+ return { success: true };
+ } catch (error) {
+ throwFromException(error, "Failed to send test webhook");
+ }
+ }),
+
/**
* PROTECTED: Delete a subscription (dashboard)
*/
diff --git a/packages/api/src/service/import.ts b/packages/api/src/service/import.ts
index 312093286..07eec23e8 100644
--- a/packages/api/src/service/import.ts
+++ b/packages/api/src/service/import.ts
@@ -973,13 +973,15 @@ async function writeSubscribersPhase(
sourceComponentIds: string[];
};
+ const email = data.email.toLowerCase();
+
// Idempotency check by email + pageId
const existing = await db
.select()
.from(pageSubscriber)
.where(
and(
- eq(pageSubscriber.email, data.email),
+ eq(pageSubscriber.email, email),
eq(pageSubscriber.pageId, pageId),
eq(pageSubscriber.channelType, "email"),
),
@@ -995,9 +997,11 @@ async function writeSubscribersPhase(
const [inserted] = await db
.insert(pageSubscriber)
.values({
- email: data.email,
+ email,
pageId,
channelType: "email",
+ source: "import",
+ token: crypto.randomUUID(),
acceptedAt: data.confirmed ? new Date() : undefined,
})
.returning({ id: pageSubscriber.id });
diff --git a/packages/db/drizzle/0064_dusty_sunfire.sql b/packages/db/drizzle/0064_dusty_sunfire.sql
new file mode 100644
index 000000000..6180a57b1
--- /dev/null
+++ b/packages/db/drizzle/0064_dusty_sunfire.sql
@@ -0,0 +1,35 @@
+DROP INDEX "workspace_slug_unique";--> statement-breakpoint
+DROP INDEX "workspace_stripe_id_unique";--> statement-breakpoint
+DROP INDEX "workspace_id_dsn_unique";--> statement-breakpoint
+DROP INDEX "user_tenant_id_unique";--> statement-breakpoint
+DROP INDEX "page_slug_unique";--> statement-breakpoint
+DROP INDEX "idx_page_subscriber_email_page_active";--> statement-breakpoint
+DROP INDEX "idx_page_subscriber_webhook_page_active";--> statement-breakpoint
+DROP INDEX "notification_id_monitor_id_crontimestampe";--> statement-breakpoint
+DROP INDEX "monitor_status_idx";--> statement-breakpoint
+DROP INDEX "incident_monitor_id_started_at_unique";--> statement-breakpoint
+DROP INDEX "application_dsn_unique";--> statement-breakpoint
+DROP INDEX "viewer_email_unique";--> statement-breakpoint
+DROP INDEX "api_key_prefix_unique";--> statement-breakpoint
+DROP INDEX "api_key_hashed_token_unique";--> statement-breakpoint
+DROP INDEX "api_key_prefix_idx";--> statement-breakpoint
+DROP INDEX "page_component_page_id_monitor_id_unique";--> statement-breakpoint
+ALTER TABLE `page_subscriber` ALTER COLUMN "email" TO "email" text;--> statement-breakpoint
+CREATE UNIQUE INDEX `workspace_slug_unique` ON `workspace` (`slug`);--> statement-breakpoint
+CREATE UNIQUE INDEX `workspace_stripe_id_unique` ON `workspace` (`stripe_id`);--> statement-breakpoint
+CREATE UNIQUE INDEX `workspace_id_dsn_unique` ON `workspace` (`id`,`dsn`);--> statement-breakpoint
+CREATE UNIQUE INDEX `user_tenant_id_unique` ON `user` (`tenant_id`);--> statement-breakpoint
+CREATE UNIQUE INDEX `page_slug_unique` ON `page` (`slug`);--> statement-breakpoint
+CREATE UNIQUE INDEX `idx_page_subscriber_email_page_active` ON `page_subscriber` (LOWER("email"),`page_id`) WHERE "page_subscriber"."unsubscribed_at" IS NULL AND "page_subscriber"."channel_type" = 'email';--> statement-breakpoint
+CREATE UNIQUE INDEX `idx_page_subscriber_webhook_page_active` ON `page_subscriber` (LOWER("webhook_url"),`page_id`) WHERE "page_subscriber"."unsubscribed_at" IS NULL AND "page_subscriber"."channel_type" = 'webhook';--> statement-breakpoint
+CREATE UNIQUE INDEX `notification_id_monitor_id_crontimestampe` ON `notification_trigger` (`notification_id`,`monitor_id`,`cron_timestamp`);--> statement-breakpoint
+CREATE INDEX `monitor_status_idx` ON `monitor_status` (`monitor_id`,`region`);--> statement-breakpoint
+CREATE UNIQUE INDEX `incident_monitor_id_started_at_unique` ON `incident` (`monitor_id`,`started_at`);--> statement-breakpoint
+CREATE UNIQUE INDEX `application_dsn_unique` ON `application` (`dsn`);--> statement-breakpoint
+CREATE UNIQUE INDEX `viewer_email_unique` ON `viewer` (`email`);--> statement-breakpoint
+CREATE UNIQUE INDEX `api_key_prefix_unique` ON `api_key` (`prefix`);--> statement-breakpoint
+CREATE UNIQUE INDEX `api_key_hashed_token_unique` ON `api_key` (`hashed_token`);--> statement-breakpoint
+CREATE INDEX `api_key_prefix_idx` ON `api_key` (`prefix`);--> statement-breakpoint
+CREATE UNIQUE INDEX `page_component_page_id_monitor_id_unique` ON `page_component` (`page_id`,`monitor_id`);--> statement-breakpoint
+ALTER TABLE `page_subscriber` ADD `source` text DEFAULT 'self_signup' NOT NULL;--> statement-breakpoint
+ALTER TABLE `page_subscriber` ADD `name` text;
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0064_snapshot.json b/packages/db/drizzle/meta/0064_snapshot.json
new file mode 100644
index 000000000..a3af8cb6d
--- /dev/null
+++ b/packages/db/drizzle/meta/0064_snapshot.json
@@ -0,0 +1,3518 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "d778c674-ca9a-4b20-8d38-a262f28d922c",
+ "prevId": "8b1e0af0-9240-49e0-b8ea-a2e687bfa6a3",
+ "tables": {
+ "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
+ },
+ "limits": {
+ "name": "limits",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'))"
+ },
+ "dsn": {
+ "name": "dsn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "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
+ },
+ "workspace_id_dsn_unique": {
+ "name": "workspace_id_dsn_unique",
+ "columns": [
+ "id",
+ "dsn"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "account": {
+ "name": "account",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_account_id": {
+ "name": "provider_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_provider_account_id_pk": {
+ "columns": [
+ "provider",
+ "provider_account_id"
+ ],
+ "name": "account_provider_provider_account_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "session_token": {
+ "name": "session_token",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "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": "''"
+ },
+ "photo_url": {
+ "name": "photo_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "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'))"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_tenant_id_unique": {
+ "name": "user_tenant_id_unique",
+ "columns": [
+ "tenant_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "verification_token": {
+ "name": "verification_token",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verification_token_identifier_token_pk": {
+ "columns": [
+ "identifier",
+ "token"
+ ],
+ "name": "verification_token_identifier_token_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "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
+ },
+ "page_id": {
+ "name": "page_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"
+ },
+ "status_report_page_id_page_id_fk": {
+ "name": "status_report_page_id_page_id_fk",
+ "tableFrom": "status_report",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "status_report_update": {
+ "name": "status_report_update",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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
+ },
+ "force_theme": {
+ "name": "force_theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'system'"
+ },
+ "password": {
+ "name": "password",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password_protected": {
+ "name": "password_protected",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "access_type": {
+ "name": "access_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'public'"
+ },
+ "auth_email_domains": {
+ "name": "auth_email_domains",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "allowed_ip_ranges": {
+ "name": "allowed_ip_ranges",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "homepage_url": {
+ "name": "homepage_url",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "contact_url": {
+ "name": "contact_url",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "default_locale": {
+ "name": "default_locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'en'"
+ },
+ "locales": {
+ "name": "locales",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "legacy_page": {
+ "name": "legacy_page",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "configuration": {
+ "name": "configuration",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "allow_index": {
+ "name": "allow_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "show_monitor_values": {
+ "name": "show_monitor_values",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": true
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": "'http'"
+ },
+ "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": "''"
+ },
+ "external_name": {
+ "name": "external_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "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
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 45000
+ },
+ "degraded_after": {
+ "name": "degraded_after",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "assertions": {
+ "name": "assertions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "otel_endpoint": {
+ "name": "otel_endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "otel_headers": {
+ "name": "otel_headers",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "public": {
+ "name": "public",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "retry": {
+ "name": "retry",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 3
+ },
+ "follow_redirects": {
+ "name": "follow_redirects",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": true
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": false,
+ "autoincrement": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "channel_type": {
+ "name": "channel_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'email'"
+ },
+ "webhook_url": {
+ "name": "webhook_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "channel_config": {
+ "name": "channel_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'self_signup'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "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
+ },
+ "unsubscribed_at": {
+ "name": "unsubscribed_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": {
+ "idx_page_subscriber_email_page_active": {
+ "name": "idx_page_subscriber_email_page_active",
+ "columns": [
+ "LOWER(\"email\")",
+ "page_id"
+ ],
+ "isUnique": true,
+ "where": "\"page_subscriber\".\"unsubscribed_at\" IS NULL AND \"page_subscriber\".\"channel_type\" = 'email'"
+ },
+ "idx_page_subscriber_webhook_page_active": {
+ "name": "idx_page_subscriber_webhook_page_active",
+ "columns": [
+ "LOWER(\"webhook_url\")",
+ "page_id"
+ ],
+ "isUnique": true,
+ "where": "\"page_subscriber\".\"unsubscribed_at\" IS NULL AND \"page_subscriber\".\"channel_type\" = 'webhook'"
+ }
+ },
+ "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": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {
+ "page_subscriber_channel_check": {
+ "name": "page_subscriber_channel_check",
+ "value": "(\"page_subscriber\".\"channel_type\" = 'email' AND \"page_subscriber\".\"email\" IS NOT NULL AND \"page_subscriber\".\"webhook_url\" IS NULL) OR (\"page_subscriber\".\"channel_type\" = 'webhook' AND \"page_subscriber\".\"webhook_url\" IS NOT NULL AND \"page_subscriber\".\"email\" IS NULL)"
+ }
+ }
+ },
+ "page_subscriber_to_page_component": {
+ "name": "page_subscriber_to_page_component",
+ "columns": {
+ "page_subscriber_id": {
+ "name": "page_subscriber_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_component_id": {
+ "name": "page_component_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": {
+ "page_subscriber_to_page_component_page_subscriber_id_page_subscriber_id_fk": {
+ "name": "page_subscriber_to_page_component_page_subscriber_id_page_subscriber_id_fk",
+ "tableFrom": "page_subscriber_to_page_component",
+ "tableTo": "page_subscriber",
+ "columnsFrom": [
+ "page_subscriber_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_subscriber_to_page_component_page_component_id_page_component_id_fk": {
+ "name": "page_subscriber_to_page_component_page_component_id_page_component_id_fk",
+ "tableFrom": "page_subscriber_to_page_component",
+ "tableTo": "page_component",
+ "columnsFrom": [
+ "page_component_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "page_subscriber_to_page_component_page_subscriber_id_page_component_id_pk": {
+ "columns": [
+ "page_subscriber_id",
+ "page_component_id"
+ ],
+ "name": "page_subscriber_to_page_component_page_subscriber_id_page_component_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "notification_trigger": {
+ "name": "notification_trigger",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notification_id": {
+ "name": "notification_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cron_timestamp": {
+ "name": "cron_timestamp",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "notification_id_monitor_id_crontimestampe": {
+ "name": "notification_id_monitor_id_crontimestampe",
+ "columns": [
+ "notification_id",
+ "monitor_id",
+ "cron_timestamp"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "notification_trigger_monitor_id_monitor_id_fk": {
+ "name": "notification_trigger_monitor_id_monitor_id_fk",
+ "tableFrom": "notification_trigger",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_trigger_notification_id_notification_id_fk": {
+ "name": "notification_trigger_notification_id_notification_id_fk",
+ "tableFrom": "notification_trigger",
+ "tableTo": "notification",
+ "columnsFrom": [
+ "notification_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "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": {},
+ "checkConstraints": {}
+ },
+ "application": {
+ "name": "application",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "dsn": {
+ "name": "dsn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "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": {
+ "application_dsn_unique": {
+ "name": "application_dsn_unique",
+ "columns": [
+ "dsn"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "application_workspace_id_workspace_id_fk": {
+ "name": "application_workspace_id_workspace_id_fk",
+ "tableFrom": "application",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "maintenance": {
+ "name": "maintenance",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "from": {
+ "name": "from",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "to": {
+ "name": "to",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "page_id": {
+ "name": "page_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": {
+ "maintenance_workspace_id_workspace_id_fk": {
+ "name": "maintenance_workspace_id_workspace_id_fk",
+ "tableFrom": "maintenance",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "maintenance_page_id_page_id_fk": {
+ "name": "maintenance_page_id_page_id_fk",
+ "tableFrom": "maintenance",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "check": {
+ "name": "check",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "regions": {
+ "name": "regions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "url": {
+ "name": "url",
+ "type": "text(4096)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "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'"
+ },
+ "count_requests": {
+ "name": "count_requests",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 1
+ },
+ "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'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "check_workspace_id_workspace_id_fk": {
+ "name": "check_workspace_id_workspace_id_fk",
+ "tableFrom": "check",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "monitor_run": {
+ "name": "monitor_run",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "runned_at": {
+ "name": "runned_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'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "monitor_run_workspace_id_workspace_id_fk": {
+ "name": "monitor_run_workspace_id_workspace_id_fk",
+ "tableFrom": "monitor_run",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "monitor_run_monitor_id_monitor_id_fk": {
+ "name": "monitor_run_monitor_id_monitor_id_fk",
+ "tableFrom": "monitor_run",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "private_location": {
+ "name": "private_location",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "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": {
+ "private_location_workspace_id_workspace_id_fk": {
+ "name": "private_location_workspace_id_workspace_id_fk",
+ "tableFrom": "private_location",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "private_location_to_monitor": {
+ "name": "private_location_to_monitor",
+ "columns": {
+ "private_location_id": {
+ "name": "private_location_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "monitor_id": {
+ "name": "monitor_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'))"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "private_location_to_monitor_private_location_id_private_location_id_fk": {
+ "name": "private_location_to_monitor_private_location_id_private_location_id_fk",
+ "tableFrom": "private_location_to_monitor",
+ "tableTo": "private_location",
+ "columnsFrom": [
+ "private_location_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "private_location_to_monitor_monitor_id_monitor_id_fk": {
+ "name": "private_location_to_monitor_monitor_id_monitor_id_fk",
+ "tableFrom": "private_location_to_monitor",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "monitor_group": {
+ "name": "monitor_group",
+ "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
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "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_group_workspace_id_workspace_id_fk": {
+ "name": "monitor_group_workspace_id_workspace_id_fk",
+ "tableFrom": "monitor_group",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "monitor_group_page_id_page_id_fk": {
+ "name": "monitor_group_page_id_page_id_fk",
+ "tableFrom": "monitor_group",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "viewer": {
+ "name": "viewer",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "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": {
+ "viewer_email_unique": {
+ "name": "viewer_email_unique",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "viewer_accounts": {
+ "name": "viewer_accounts",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "viewer_accounts_user_id_viewer_id_fk": {
+ "name": "viewer_accounts_user_id_viewer_id_fk",
+ "tableFrom": "viewer_accounts",
+ "tableTo": "viewer",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "viewer_accounts_provider_providerAccountId_pk": {
+ "columns": [
+ "provider",
+ "providerAccountId"
+ ],
+ "name": "viewer_accounts_provider_providerAccountId_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "viewer_session": {
+ "name": "viewer_session",
+ "columns": {
+ "session_token": {
+ "name": "session_token",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "viewer_session_user_id_viewer_id_fk": {
+ "name": "viewer_session_user_id_viewer_id_fk",
+ "tableFrom": "viewer_session",
+ "tableTo": "viewer",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "api_key": {
+ "name": "api_key",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hashed_token": {
+ "name": "hashed_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_by_id": {
+ "name": "created_by_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'))"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "api_key_prefix_unique": {
+ "name": "api_key_prefix_unique",
+ "columns": [
+ "prefix"
+ ],
+ "isUnique": true
+ },
+ "api_key_hashed_token_unique": {
+ "name": "api_key_hashed_token_unique",
+ "columns": [
+ "hashed_token"
+ ],
+ "isUnique": true
+ },
+ "api_key_prefix_idx": {
+ "name": "api_key_prefix_idx",
+ "columns": [
+ "prefix"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "api_key_workspace_id_workspace_id_fk": {
+ "name": "api_key_workspace_id_workspace_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "api_key_created_by_id_user_id_fk": {
+ "name": "api_key_created_by_id_user_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "maintenance_to_page_component": {
+ "name": "maintenance_to_page_component",
+ "columns": {
+ "maintenance_id": {
+ "name": "maintenance_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_component_id": {
+ "name": "page_component_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": {
+ "maintenance_to_page_component_maintenance_id_maintenance_id_fk": {
+ "name": "maintenance_to_page_component_maintenance_id_maintenance_id_fk",
+ "tableFrom": "maintenance_to_page_component",
+ "tableTo": "maintenance",
+ "columnsFrom": [
+ "maintenance_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "maintenance_to_page_component_page_component_id_page_component_id_fk": {
+ "name": "maintenance_to_page_component_page_component_id_page_component_id_fk",
+ "tableFrom": "maintenance_to_page_component",
+ "tableTo": "page_component",
+ "columnsFrom": [
+ "page_component_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "maintenance_to_page_component_maintenance_id_page_component_id_pk": {
+ "columns": [
+ "maintenance_id",
+ "page_component_id"
+ ],
+ "name": "maintenance_to_page_component_maintenance_id_page_component_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "page_component": {
+ "name": "page_component",
+ "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
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'monitor'"
+ },
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "order": {
+ "name": "order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "group_order": {
+ "name": "group_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "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_component_page_id_monitor_id_unique": {
+ "name": "page_component_page_id_monitor_id_unique",
+ "columns": [
+ "page_id",
+ "monitor_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "page_component_workspace_id_workspace_id_fk": {
+ "name": "page_component_workspace_id_workspace_id_fk",
+ "tableFrom": "page_component",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_component_page_id_page_id_fk": {
+ "name": "page_component_page_id_page_id_fk",
+ "tableFrom": "page_component",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_component_monitor_id_monitor_id_fk": {
+ "name": "page_component_monitor_id_monitor_id_fk",
+ "tableFrom": "page_component",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_component_group_id_page_component_groups_id_fk": {
+ "name": "page_component_group_id_page_component_groups_id_fk",
+ "tableFrom": "page_component",
+ "tableTo": "page_component_groups",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {
+ "page_component_type_check": {
+ "name": "page_component_type_check",
+ "value": "\"page_component\".\"type\" = 'monitor' AND \"page_component\".\"monitor_id\" IS NOT NULL OR \"page_component\".\"type\" = 'static' AND \"page_component\".\"monitor_id\" IS NULL"
+ }
+ }
+ },
+ "status_report_to_page_component": {
+ "name": "status_report_to_page_component",
+ "columns": {
+ "status_report_id": {
+ "name": "status_report_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_component_id": {
+ "name": "page_component_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_page_component_status_report_id_status_report_id_fk": {
+ "name": "status_report_to_page_component_status_report_id_status_report_id_fk",
+ "tableFrom": "status_report_to_page_component",
+ "tableTo": "status_report",
+ "columnsFrom": [
+ "status_report_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "status_report_to_page_component_page_component_id_page_component_id_fk": {
+ "name": "status_report_to_page_component_page_component_id_page_component_id_fk",
+ "tableFrom": "status_report_to_page_component",
+ "tableTo": "page_component",
+ "columnsFrom": [
+ "page_component_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "status_report_to_page_component_status_report_id_page_component_id_pk": {
+ "columns": [
+ "status_report_id",
+ "page_component_id"
+ ],
+ "name": "status_report_to_page_component_status_report_id_page_component_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "page_component_groups": {
+ "name": "page_component_groups",
+ "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
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "default_open": {
+ "name": "default_open",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "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": {},
+ "foreignKeys": {
+ "page_component_groups_workspace_id_workspace_id_fk": {
+ "name": "page_component_groups_workspace_id_workspace_id_fk",
+ "tableFrom": "page_component_groups",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "page_component_groups_page_id_page_id_fk": {
+ "name": "page_component_groups_page_id_page_id_fk",
+ "tableFrom": "page_component_groups",
+ "tableTo": "page",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "feedback": {
+ "name": "feedback",
+ "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
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "blocker": {
+ "name": "blocker",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "feedback_workspace_id_workspace_id_fk": {
+ "name": "feedback_workspace_id_workspace_id_fk",
+ "tableFrom": "feedback",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "feedback_user_id_user_id_fk": {
+ "name": "feedback_user_id_user_id_fk",
+ "tableFrom": "feedback",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {
+ "idx_page_subscriber_email_page_active": {
+ "columns": {
+ "LOWER(\"email\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "idx_page_subscriber_webhook_page_active": {
+ "columns": {
+ "LOWER(\"webhook_url\")": {
+ "isExpression": true
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index fc3ccdf5b..abf115b29 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -449,6 +449,13 @@
"when": 1776337124190,
"tag": "0063_whole_gressill",
"breakpoints": true
+ },
+ {
+ "idx": 64,
+ "version": "6",
+ "when": 1776753844046,
+ "tag": "0064_dusty_sunfire",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/page_subscribers/page_subscribers.ts b/packages/db/src/schema/page_subscribers/page_subscribers.ts
index dd5ebb3c8..ae77ee022 100644
--- a/packages/db/src/schema/page_subscribers/page_subscribers.ts
+++ b/packages/db/src/schema/page_subscribers/page_subscribers.ts
@@ -14,7 +14,7 @@ export const pageSubscriber = sqliteTable(
"page_subscriber",
{
id: integer("id").primaryKey(),
- email: text("email").notNull(),
+ email: text("email"),
pageId: integer("page_id")
.notNull()
@@ -31,6 +31,18 @@ export const pageSubscriber = sqliteTable(
webhookUrl: text("webhook_url"),
channelConfig: text("channel_config"),
+ // How the subscription was created. Vendor-added rows skip verification
+ // and are editable from the dashboard.
+ source: text("source", {
+ enum: ["self_signup", "vendor", "import"],
+ })
+ .notNull()
+ .default("self_signup"),
+
+ // Optional human-readable label (e.g. "Supabase #incidents").
+ // When set, rendered in place of the raw destination in UI.
+ name: text("name"),
+
token: text("token"),
acceptedAt: integer("accepted_at", { mode: "timestamp" }),
expiresAt: integer("expires_at", { mode: "timestamp" }),
@@ -50,9 +62,9 @@ export const pageSubscriber = sqliteTable(
sql`${table.unsubscribedAt} IS NULL AND ${table.channelType} = 'email'`,
),
- // Partial unique index: one active webhook subscription per page
+ // Partial unique index: one active webhook subscription per page.
webhookPageActiveIdx: uniqueIndex("idx_page_subscriber_webhook_page_active")
- .on(table.webhookUrl, table.pageId)
+ .on(sql`LOWER(${table.webhookUrl})`, table.pageId)
.where(
sql`${table.unsubscribedAt} IS NULL AND ${table.channelType} = 'webhook'`,
),
diff --git a/packages/db/src/schema/page_subscribers/validation.ts b/packages/db/src/schema/page_subscribers/validation.ts
index ce2420f77..0603d3c58 100644
--- a/packages/db/src/schema/page_subscribers/validation.ts
+++ b/packages/db/src/schema/page_subscribers/validation.ts
@@ -22,6 +22,10 @@ export const webhookChannelConfigSchema = z.object({
secret: z.string().optional(),
});
+export const subscriberSourceSchema = z
+ .enum(["self_signup", "vendor", "import"])
+ .default("self_signup");
+
// Discriminated union for type-safe subscribers
export const pageSubscriberSchema = z.discriminatedUnion("channelType", [
// Email channel
@@ -32,6 +36,8 @@ export const pageSubscriberSchema = z.discriminatedUnion("channelType", [
email: z.email(),
webhookUrl: z.null(),
channelConfig: z.null(),
+ source: subscriberSourceSchema,
+ name: z.string().nullable(),
token: z.string().nullable(),
acceptedAt: z.date().nullable(),
expiresAt: z.date().nullable(),
@@ -58,6 +64,8 @@ export const pageSubscriberSchema = z.discriminatedUnion("channelType", [
}
})
.pipe(webhookChannelConfigSchema.nullable()),
+ source: subscriberSourceSchema,
+ name: z.string().nullable(),
token: z.string().nullable(),
acceptedAt: z.date().nullable(),
expiresAt: z.date().nullable(),
@@ -70,6 +78,7 @@ export const pageSubscriberSchema = z.discriminatedUnion("channelType", [
export type InsertPageSubscriber = z.infer<typeof insertPageSubscriberSchema>;
export type PageSubscriber = z.infer<typeof selectPageSubscriberSchema>;
export type ChannelType = "email" | "webhook";
+export type SubscriberSource = z.infer<typeof subscriberSourceSchema>;
export type EmailSubscriber = Extract<
z.infer<typeof pageSubscriberSchema>,
{ channelType: "email" }
diff --git a/packages/proto/api/openstatus/status_page/v1/page_subscriber.proto b/packages/proto/api/openstatus/status_page/v1/page_subscriber.proto
index 3f12dd65f..6eacb9089 100644
--- a/packages/proto/api/openstatus/status_page/v1/page_subscriber.proto
+++ b/packages/proto/api/openstatus/status_page/v1/page_subscriber.proto
@@ -4,6 +4,17 @@ package openstatus.status_page.v1;
option go_package = "github.com/openstatushq/openstatus/packages/proto/openstatus/status_page/v1;statuspagev1";
+// SubscriberSource indicates how the subscription was created.
+enum SubscriberSource {
+ SUBSCRIBER_SOURCE_UNSPECIFIED = 0;
+ // Created by the user themselves via the status-page subscribe form.
+ SUBSCRIBER_SOURCE_SELF_SIGNUP = 1;
+ // Created by the page vendor (dashboard user), skipping verification.
+ SUBSCRIBER_SOURCE_VENDOR = 2;
+ // Imported from a third-party provider (Atlassian Statuspage, Better Stack, Instatus).
+ SUBSCRIBER_SOURCE_IMPORT = 3;
+}
+
// PageSubscriber represents a subscriber to a status page.
message PageSubscriber {
// Unique identifier for the subscriber.
@@ -12,7 +23,7 @@ message PageSubscriber {
// ID of the status page the user is subscribed to.
string page_id = 2;
- // Email address of the subscriber.
+ // Email address of the subscriber (empty for webhook channels).
string email = 3;
// Timestamp when the subscription was accepted/confirmed (RFC 3339 format, optional).
@@ -26,4 +37,22 @@ message PageSubscriber {
// Timestamp when the subscription was last updated (RFC 3339 format).
string updated_at = 7;
+
+ // How the subscription was created. Vendor-added rows skip verification.
+ SubscriberSource source = 8;
+
+ // Optional human-readable label (e.g. "Supabase #incidents").
+ optional string name = 9;
+
+ // Channel type: "email" or "webhook".
+ string channel_type = 10;
+
+ // Webhook URL (populated only for channel_type = "webhook").
+ optional string webhook_url = 11;
+
+ // JSON-encoded channel config (e.g. custom headers). Populated for webhook channels.
+ optional string channel_config = 12;
+
+ // IDs of components this subscription is scoped to. Empty = entire page.
+ repeated string component_ids = 13;
}
diff --git a/packages/proto/api/openstatus/status_page/v1/service.proto b/packages/proto/api/openstatus/status_page/v1/service.proto
index fb1ca4147..1974abfcd 100644
--- a/packages/proto/api/openstatus/status_page/v1/service.proto
+++ b/packages/proto/api/openstatus/status_page/v1/service.proto
@@ -55,10 +55,35 @@ service StatusPageService {
// UpdateComponentGroup updates an existing component group.
rpc UpdateComponentGroup(UpdateComponentGroupRequest) returns (UpdateComponentGroupResponse);
- // SubscribeToPage subscribes an email to a status page. If the email was previously unsubscribed, the subscription is reactivated.
+ // SubscribeToPage: end-user email self-signup with double opt-in verification.
+ //
+ // Use this when an end-user enters their email on the public status page to
+ // subscribe themselves. A verification email is sent and the subscription is
+ // only activated once the recipient confirms. If the email was previously
+ // unsubscribed, the subscription is reactivated rather than duplicated.
+ //
+ // Pair with CreatePageSubscription (vendor-added, no verification) depending
+ // on who is initiating the subscription — the subscriber themselves, or an
+ // operator acting on their behalf.
rpc SubscribeToPage(SubscribeToPageRequest) returns (SubscribeToPageResponse) {
option (gnostic.openapi.v3.operation) = {
- description: "Subscribes an email address to receive notifications from a status page. If the email was previously unsubscribed, the subscription is reactivated instead of creating a duplicate."
+ description: "End-user email self-signup with double opt-in verification. A verification email is sent and the subscription activates only after the recipient confirms. If the email was previously unsubscribed, the existing row is reactivated instead of a duplicate being created. Use this for subscriber-initiated signups on the public status page; use CreatePageSubscription for operator-initiated (vendor) subscriptions that should skip verification."
+ };
+ }
+
+ // CreatePageSubscription: operator-added subscriber (email or webhook), no verification.
+ //
+ // Use this when an operator adds a subscriber on behalf of a partner — the
+ // caller has already established consent out-of-band, so no double opt-in is
+ // required and notifications begin immediately. Supports both email and
+ // webhook (Slack / Discord) channels. A management token is still generated
+ // so the partner can self-manage via /manage/{token} and /unsubscribe/{token}.
+ //
+ // Pair with SubscribeToPage (self-signup with verification) depending on who
+ // is initiating the subscription.
+ rpc CreatePageSubscription(CreatePageSubscriptionRequest) returns (CreatePageSubscriptionResponse) {
+ option (gnostic.openapi.v3.operation) = {
+ description: "Operator-added subscriber (email or webhook) with no verification flow — the partner starts receiving notifications immediately. Supports Slack and Discord webhook URLs in addition to email. A management token is still generated so the subscriber can self-manage (update scope, unsubscribe) without operator involvement. Use this for vendor/partner integrations where consent is established out-of-band; use SubscribeToPage for subscriber-initiated signups that require double opt-in."
};
}
@@ -448,6 +473,57 @@ message SubscribeToPageResponse {
PageSubscriber subscriber = 1;
}
+// EmailChannel carries the email-channel fields for CreatePageSubscription.
+message EmailChannel {
+ // Email address of the subscriber (required).
+ string email = 1 [(buf.validate.field).string.email = true];
+}
+
+// WebhookChannelHeader is a single custom HTTP header.
+message WebhookChannelHeader {
+ string key = 1 [(buf.validate.field).string.min_len = 1];
+ string value = 2;
+}
+
+// WebhookChannel carries the webhook-channel fields for CreatePageSubscription.
+message WebhookChannel {
+ // Webhook URL (required). Payload flavor (Slack / Discord / generic) is auto-detected from the URL prefix.
+ string webhook_url = 1 [(buf.validate.field).string = {
+ min_len: 1,
+ max_len: 2048,
+ uri: true
+ }];
+
+ // Optional custom HTTP headers attached to every dispatch.
+ repeated WebhookChannelHeader headers = 2;
+}
+
+// CreatePageSubscriptionRequest is the request to add a vendor-managed subscriber to a status page.
+message CreatePageSubscriptionRequest {
+ // ID of the status page (required).
+ string page_id = 1 [(buf.validate.field).string.min_len = 1];
+
+ // Optional human-readable label.
+ optional string name = 2 [(buf.validate.field).string.max_len = 255];
+
+ // Component scope. Empty = entire page.
+ repeated string component_ids = 3;
+
+ // Channel-specific fields (exactly one must be set).
+ oneof channel {
+ option (buf.validate.oneof).required = true;
+
+ EmailChannel email_channel = 10;
+ WebhookChannel webhook_channel = 11;
+ }
+}
+
+// CreatePageSubscriptionResponse is the response after creating a vendor-managed subscription.
+message CreatePageSubscriptionResponse {
+ // The created subscriber.
+ PageSubscriber subscriber = 1;
+}
+
// UnsubscribeFromPageRequest is the request to unsubscribe from a status page.
message UnsubscribeFromPageRequest {
// ID of the status page to unsubscribe from (required).
diff --git a/packages/proto/gen/openapi.yaml b/packages/proto/gen/openapi.yaml
index 72dae9f78..198fd6a6e 100644
--- a/packages/proto/gen/openapi.yaml
+++ b/packages/proto/gen/openapi.yaml
@@ -2180,6 +2180,58 @@ components:
title: CreateComponentGroupResponse
additionalProperties: false
description: CreateComponentGroupResponse is the response after creating a component group.
+ openstatus.status_page.v1.CreatePageSubscriptionRequest:
+ type: object
+ allOf:
+ - properties:
+ pageId:
+ type: string
+ title: page_id
+ minLength: 1
+ description: ID of the status page (required).
+ name:
+ type:
+ - string
+ - "null"
+ title: name
+ maxLength: 255
+ description: Optional human-readable label.
+ componentIds:
+ type: array
+ items:
+ type: string
+ title: component_ids
+ description: Component scope. Empty = entire page.
+ - oneOf:
+ - type: object
+ properties:
+ emailChannel:
+ title: email_channel
+ $ref: '#/components/schemas/openstatus.status_page.v1.EmailChannel'
+ title: email_channel
+ required:
+ - emailChannel
+ - type: object
+ properties:
+ webhookChannel:
+ title: webhook_channel
+ $ref: '#/components/schemas/openstatus.status_page.v1.WebhookChannel'
+ title: webhook_channel
+ required:
+ - webhookChannel
+ title: CreatePageSubscriptionRequest
+ additionalProperties: false
+ description: CreatePageSubscriptionRequest is the request to add a vendor-managed subscriber to a status page.
+ openstatus.status_page.v1.CreatePageSubscriptionResponse:
+ type: object
+ properties:
+ subscriber:
+ title: subscriber
+ description: The created subscriber.
+ $ref: '#/components/schemas/openstatus.status_page.v1.PageSubscriber'
+ title: CreatePageSubscriptionResponse
+ additionalProperties: false
+ description: CreatePageSubscriptionResponse is the response after creating a vendor-managed subscription.
openstatus.status_page.v1.CreateStatusPageRequest:
type: object
properties:
@@ -2340,6 +2392,17 @@ components:
title: DeleteStatusPageResponse
additionalProperties: false
description: DeleteStatusPageResponse is the response after deleting a status page.
+ openstatus.status_page.v1.EmailChannel:
+ type: object
+ properties:
+ email:
+ type: string
+ title: email
+ format: email
+ description: Email address of the subscriber (required).
+ title: EmailChannel
+ additionalProperties: false
+ description: EmailChannel carries the email-channel fields for CreatePageSubscription.
openstatus.status_page.v1.GetOverallStatusRequest:
type: object
oneOf:
@@ -2685,7 +2748,7 @@ components:
email:
type: string
title: email
- description: Email address of the subscriber.
+ description: Email address of the subscriber (empty for webhook channels).
acceptedAt:
type: string
title: accepted_at
@@ -2702,6 +2765,38 @@ components:
type: string
title: updated_at
description: Timestamp when the subscription was last updated (RFC 3339 format).
+ source:
+ title: source
+ description: How the subscription was created. Vendor-added rows skip verification.
+ $ref: '#/components/schemas/openstatus.status_page.v1.SubscriberSource'
+ name:
+ type:
+ - string
+ - "null"
+ title: name
+ description: 'Optional human-readable label (e.g. "Supabase #incidents").'
+ channelType:
+ type: string
+ title: channel_type
+ description: 'Channel type: "email" or "webhook".'
+ webhookUrl:
+ type:
+ - string
+ - "null"
+ title: webhook_url
+ description: Webhook URL (populated only for channel_type = "webhook").
+ channelConfig:
+ type:
+ - string
+ - "null"
+ title: channel_config
+ description: JSON-encoded channel config (e.g. custom headers). Populated for webhook channels.
+ componentIds:
+ type: array
+ items:
+ type: string
+ title: component_ids
+ description: IDs of components this subscription is scoped to. Empty = entire page.
title: PageSubscriber
additionalProperties: false
description: PageSubscriber represents a subscriber to a status page.
@@ -2893,6 +2988,15 @@ components:
title: SubscribeToPageResponse
additionalProperties: false
description: SubscribeToPageResponse is the response after subscribing to a status page.
+ openstatus.status_page.v1.SubscriberSource:
+ type: string
+ title: SubscriberSource
+ enum:
+ - SUBSCRIBER_SOURCE_UNSPECIFIED
+ - SUBSCRIBER_SOURCE_SELF_SIGNUP
+ - SUBSCRIBER_SOURCE_VENDOR
+ - SUBSCRIBER_SOURCE_IMPORT
+ description: SubscriberSource indicates how the subscription was created.
openstatus.status_page.v1.UnsubscribeFromPageRequest:
type: object
allOf:
@@ -3145,6 +3249,38 @@ components:
title: UpdateStatusPageResponse
additionalProperties: false
description: UpdateStatusPageResponse is the response after updating a status page.
+ openstatus.status_page.v1.WebhookChannel:
+ type: object
+ properties:
+ webhookUrl:
+ type: string
+ title: webhook_url
+ maxLength: 2048
+ minLength: 1
+ format: uri
+ description: Webhook URL (required). Payload flavor (Slack / Discord / generic) is auto-detected from the URL prefix.
+ headers:
+ type: array
+ items:
+ $ref: '#/components/schemas/openstatus.status_page.v1.WebhookChannelHeader'
+ title: headers
+ description: Optional custom HTTP headers attached to every dispatch.
+ title: WebhookChannel
+ additionalProperties: false
+ description: WebhookChannel carries the webhook-channel fields for CreatePageSubscription.
+ openstatus.status_page.v1.WebhookChannelHeader:
+ type: object
+ properties:
+ key:
+ type: string
+ title: key
+ minLength: 1
+ value:
+ type: string
+ title: value
+ title: WebhookChannelHeader
+ additionalProperties: false
+ description: WebhookChannelHeader is a single custom HTTP header.
openstatus.status_report.v1.AddStatusReportUpdateRequest:
type: object
properties:
@@ -4500,6 +4636,32 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/openstatus.status_page.v1.CreateComponentGroupResponse'
+ /rpc/openstatus.status_page.v1.StatusPageService/CreatePageSubscription:
+ post:
+ tags:
+ - StatusPageService
+ summary: 'CreatePageSubscription: operator-added subscriber (email or webhook), no verification.'
+ description: Operator-added subscriber (email or webhook) with no verification flow — the partner starts receiving notifications immediately. Supports Slack and Discord webhook URLs in addition to email. A management token is still generated so the subscriber can self-manage (update scope, unsubscribe) without operator involvement. Use this for vendor/partner integrations where consent is established out-of-band; use SubscribeToPage for subscriber-initiated signups that require double opt-in.
+ operationId: StatusPageService_CreatePageSubscription
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/openstatus.status_page.v1.CreatePageSubscriptionRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/openstatus.status_page.v1.CreatePageSubscriptionResponse'
/rpc/openstatus.status_page.v1.StatusPageService/CreateStatusPage:
post:
tags:
@@ -4868,8 +5030,8 @@ paths:
post:
tags:
- StatusPageService
- summary: SubscribeToPage
- description: Subscribes an email address to receive notifications from a status page. If the email was previously unsubscribed, the subscription is reactivated instead of creating a duplicate.
+ summary: 'SubscribeToPage: end-user email self-signup with double opt-in verification.'
+ description: End-user email self-signup with double opt-in verification. A verification email is sent and the subscription activates only after the recipient confirms. If the email was previously unsubscribed, the existing row is reactivated instead of a duplicate being created. Use this for subscriber-initiated signups on the public status page; use CreatePageSubscription for operator-initiated (vendor) subscriptions that should skip verification.
operationId: StatusPageService_SubscribeToPage
requestBody:
content:
diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.ts b/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.ts
index 988aa4878..1c12c9763 100644
--- a/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.ts
+++ b/packages/proto/gen/ts/openstatus/status_page/v1/page_subscriber_pb.ts
@@ -2,15 +2,15 @@
// @generated from file openstatus/status_page/v1/page_subscriber.proto (package openstatus.status_page.v1, syntax proto3)
/* eslint-disable */
-import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
-import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
+import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
+import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
/**
* Describes the file openstatus/status_page/v1/page_subscriber.proto.
*/
export const file_openstatus_status_page_v1_page_subscriber: GenFile = /*@__PURE__*/
- fileDesc("Ci9vcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3BhZ2Vfc3Vic2NyaWJlci5wcm90bxIZb3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MSKSAQoOUGFnZVN1YnNjcmliZXISCgoCaWQYASABKAkSDwoHcGFnZV9pZBgCIAEoCRINCgVlbWFpbBgDIAEoCRITCgthY2NlcHRlZF9hdBgEIAEoCRIXCg91bnN1YnNjcmliZWRfYXQYBSABKAkSEgoKY3JlYXRlZF9hdBgGIAEoCRISCgp1cGRhdGVkX2F0GAcgASgJQlpaWGdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9zdGF0dXNfcGFnZS92MTtzdGF0dXNwYWdldjFiBnByb3RvMw");
+ fileDesc("Ci9vcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3BhZ2Vfc3Vic2NyaWJlci5wcm90bxIZb3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MSLyAgoOUGFnZVN1YnNjcmliZXISCgoCaWQYASABKAkSDwoHcGFnZV9pZBgCIAEoCRINCgVlbWFpbBgDIAEoCRITCgthY2NlcHRlZF9hdBgEIAEoCRIXCg91bnN1YnNjcmliZWRfYXQYBSABKAkSEgoKY3JlYXRlZF9hdBgGIAEoCRISCgp1cGRhdGVkX2F0GAcgASgJEjsKBnNvdXJjZRgIIAEoDjIrLm9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEuU3Vic2NyaWJlclNvdXJjZRIRCgRuYW1lGAkgASgJSACIAQESFAoMY2hhbm5lbF90eXBlGAogASgJEhgKC3dlYmhvb2tfdXJsGAsgASgJSAGIAQESGwoOY2hhbm5lbF9jb25maWcYDCABKAlIAogBARIVCg1jb21wb25lbnRfaWRzGA0gAygJQgcKBV9uYW1lQg4KDF93ZWJob29rX3VybEIRCg9fY2hhbm5lbF9jb25maWcqlAEKEFN1YnNjcmliZXJTb3VyY2USIQodU1VCU0NSSUJFUl9TT1VSQ0VfVU5TUEVDSUZJRUQQABIhCh1TVUJTQ1JJQkVSX1NPVVJDRV9TRUxGX1NJR05VUBABEhwKGFNVQlNDUklCRVJfU09VUkNFX1ZFTkRPUhACEhwKGFNVQlNDUklCRVJfU09VUkNFX0lNUE9SVBADQlpaWGdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9zdGF0dXNfcGFnZS92MTtzdGF0dXNwYWdldjFiBnByb3RvMw");
/**
* PageSubscriber represents a subscriber to a status page.
@@ -33,7 +33,7 @@ export type PageSubscriber = Message<"openstatus.status_page.v1.PageSubscriber">
pageId: string;
/**
- * Email address of the subscriber.
+ * Email address of the subscriber (empty for webhook channels).
*
* @generated from field: string email = 3;
*/
@@ -66,6 +66,48 @@ export type PageSubscriber = Message<"openstatus.status_page.v1.PageSubscriber">
* @generated from field: string updated_at = 7;
*/
updatedAt: string;
+
+ /**
+ * How the subscription was created. Vendor-added rows skip verification.
+ *
+ * @generated from field: openstatus.status_page.v1.SubscriberSource source = 8;
+ */
+ source: SubscriberSource;
+
+ /**
+ * Optional human-readable label (e.g. "Supabase #incidents").
+ *
+ * @generated from field: optional string name = 9;
+ */
+ name?: string;
+
+ /**
+ * Channel type: "email" or "webhook".
+ *
+ * @generated from field: string channel_type = 10;
+ */
+ channelType: string;
+
+ /**
+ * Webhook URL (populated only for channel_type = "webhook").
+ *
+ * @generated from field: optional string webhook_url = 11;
+ */
+ webhookUrl?: string;
+
+ /**
+ * JSON-encoded channel config (e.g. custom headers). Populated for webhook channels.
+ *
+ * @generated from field: optional string channel_config = 12;
+ */
+ channelConfig?: string;
+
+ /**
+ * IDs of components this subscription is scoped to. Empty = entire page.
+ *
+ * @generated from field: repeated string component_ids = 13;
+ */
+ componentIds: string[];
};
/**
@@ -75,3 +117,42 @@ export type PageSubscriber = Message<"openstatus.status_page.v1.PageSubscriber">
export const PageSubscriberSchema: GenMessage<PageSubscriber> = /*@__PURE__*/
messageDesc(file_openstatus_status_page_v1_page_subscriber, 0);
+/**
+ * SubscriberSource indicates how the subscription was created.
+ *
+ * @generated from enum openstatus.status_page.v1.SubscriberSource
+ */
+export enum SubscriberSource {
+ /**
+ * @generated from enum value: SUBSCRIBER_SOURCE_UNSPECIFIED = 0;
+ */
+ UNSPECIFIED = 0,
+
+ /**
+ * Created by the user themselves via the status-page subscribe form.
+ *
+ * @generated from enum value: SUBSCRIBER_SOURCE_SELF_SIGNUP = 1;
+ */
+ SELF_SIGNUP = 1,
+
+ /**
+ * Created by the page vendor (dashboard user), skipping verification.
+ *
+ * @generated from enum value: SUBSCRIBER_SOURCE_VENDOR = 2;
+ */
+ VENDOR = 2,
+
+ /**
+ * Imported from a third-party provider (Atlassian Statuspage, Better Stack, Instatus).
+ *
+ * @generated from enum value: SUBSCRIBER_SOURCE_IMPORT = 3;
+ */
+ IMPORT = 3,
+}
+
+/**
+ * Describes the enum openstatus.status_page.v1.SubscriberSource.
+ */
+export const SubscriberSourceSchema: GenEnum<SubscriberSource> = /*@__PURE__*/
+ enumDesc(file_openstatus_status_page_v1_page_subscriber, 0);
+
diff --git a/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts b/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts
index 492eaa018..241293d0f 100644
--- a/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts
+++ b/packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts
@@ -22,7 +22,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file openstatus/status_page/v1/service.proto.
*/
export const file_openstatus_status_page_v1_service: GenFile = /*@__PURE__*/
- fileDesc("CidvcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3NlcnZpY2UucHJvdG8SGW9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEi6gYKF0NyZWF0ZVN0YXR1c1BhZ2VSZXF1ZXN0EjAKBXRpdGxlGAEgASgJQiG6RxQ6EhIQQWNtZSBDb3JwIFN0YXR1c7pIB3IFEAEYgAISIgoLZGVzY3JpcHRpb24YAiABKAlCCLpIBXIDGIAISACIAQESSQoEc2x1ZxgDIAEoCUI7ukcSOhASDm15LXN0YXR1cy1wYWdlukgjciEQARiAAjIaXlthLXowLTldKyg/Oi1bYS16MC05XSspKiQSOQoMaG9tZXBhZ2VfdXJsGAQgASgJQh66Rxs6GRIXaHR0cHM6Ly93d3cuZXhhbXBsZS5jb21IAYgBARIYCgtjb250YWN0X3VybBgFIAEoCUgCiAEBEj4KDmRlZmF1bHRfbG9jYWxlGAYgASgOMiEub3Blb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yb20gYWN0aXZlIHN0YXR1cyByZXBvcnRzKSA+IG1haW50ZW5hbmNlIChmcm9tIGFjdGl2ZSBtYWludGVuYW5jZSB3aW5kb3dzKSA+IG9wZXJhdGlvbmFsLkJaWlhnaXRodWIuY29tL29wZW5zdGF0dXNocS9vcGVuc3RhdHVzL3BhY2thZ2VzL3Byb3RvL29wZW5zdGF0dXMvc3RhdHVzX3BhZ2UvdjE7c3RhdHVzcGFnZXYxYgZwcm90bzM", [file_buf_validate_validate, file_gnostic_openapi_v3_annotations, file_openstatus_maintenance_v1_maintenance, file_openstatus_status_page_v1_page_component, file_openstatus_status_page_v1_page_subscriber, file_openstatus_status_page_v1_status_page, file_openstatus_status_report_v1_status_report]);
+ fileDesc("CidvcGVuc3RhdHVzL3N0YXR1c19wYWdlL3YxL3NlcnZpY2UucHJvdG8SGW9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEi6gYKF0NyZWF0ZVN0YXR1c1BhZ2VSZXF1ZXN0EjAKBXRpdGxlGAEgASgJQiG6RxQ6EhIQQWNtZSBDb3JwIFN0YXR1c7pIB3IFEAEYgAISIgoLZGVzY3JpcHRpb24YAiABKAlCCLpIBXIDGIAISACIAQESSQoEc2x1ZxgDIAEoCUI7ukcSOhASDm15LXN0YXR1cy1wYWdlukgjciEQARiAAjIaXlthLXowLTldKyg/Oi1bYS16MC05XSspKiQSOQoMaG9tZXBhZ2VfdXJsGAQgASgJQh66Rxs6GRIXaHR0cHM6Ly93d3cuZXhhbXBsZS5jb21IAYgBARIYCgtjb250YWN0X3VybBgFIAEoCUgCiAEBEj4KDmRlZmF1bHRfbG9jYWxlGAYgASgOMiEub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5Mb2NhbGVIA4gBARIyCgdsb2NhbGVzGAcgAygOMiEub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5Mb2NhbGUSGwoEaWNvbhgIIAEoCUIIukgFcgMYgAhIBIgBARIkCg1jdXN0b21fZG9tYWluGAk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mUgc3RhdHVzIHJlcG9ydHMsIGFuZCBzY2hlZHVsZWQgbWFpbnRlbmFuY2VzLiBTdXBwb3J0cyB0d28gYWNjZXNzIHBhdGhzOiBieSBJRCAocmVxdWlyZXMgYXV0aGVudGljYXRpb24sIHdvcmtzcGFjZS1zY29wZWQpIG9yIGJ5IHNsdWcgKHB1YmxpYyBhY2Nlc3MsIHJlcXVpcmVzIHRoZSBwYWdlIHRvIGJlIHB1Ymxpc2hlZCB3aXRoIGFjY2Vzc190eXBlPVBVQkxJQykuEqoDChBHZXRPdmVyYWxsU3RhdHVzEjIub3BlbnN0YXR1cy5zdGF0dXNfcGFnZS52MS5HZXRPdmVyYWxsU3RhdHVzUmVxdWVzdBozLm9wZW5zdGF0dXMuc3RhdHVzX3BhZ2UudjEuR2V0T3ZlcmFsbFN0YXR1c1Jlc3BvbnNlIqwCkAIBukelAhqiAlJldHVybnMgdGhlIG92ZXJhbGwgc3RhdHVzIG9mIGEgc3RhdHVzIHBhZ2UgYWxvbmcgd2l0aCBpbmRpdmlkdWFsIGNvbXBvbmVudCBzdGF0dXNlcy4gVGhlIG92ZXJhbGwgc3RhdHVzIGlzIGNvbXB1dGVkIGZyb20gYWN0aXZlIHN0YXR1cyByZXBvcnRzIGFuZCBtYWludGVuYW5jZXMgd2l0aCB0aGUgZm9sbG93aW5nIHByaW9yaXR5OiBkZWdyYWRlZCAoZnJvbSBhY3RpdmUgc3RhdHVzIHJlcG9ydHMpID4gbWFpbnRlbmFuY2UgKGZyb20gYWN0aXZlIG1haW50ZW5hbmNlIHdpbmRvd3MpID4gb3BlcmF0aW9uYWwuQlpaWGdpdGh1Yi5jb20vb3BlbnN0YXR1c2hxL29wZW5zdGF0dXMvcGFja2FnZXMvcHJvdG8vb3BlbnN0YXR1cy9zdGF0dXNfcGFnZS92MTtzdGF0dXNwYWdldjFiBnByb3RvMw", [file_buf_validate_validate, file_gnostic_openapi_v3_annotations, file_openstatus_maintenance_v1_maintenance, file_openstatus_status_page_v1_page_component, file_openstatus_status_page_v1_page_subscriber, file_openstatus_status_page_v1_status_page, file_openstatus_status_report_v1_status_report]);
/**
* CreateStatusPageRequest is the request to create a new status page.
@@ -920,6 +920,154 @@ export type SubscribeToPageResponse = Message<"openstatus.status_page.v1.Subscri
export const SubscribeToPageResponseSchema: GenMessage<SubscribeToPageResponse> = /*@__PURE__*/
messageDesc(file_openstatus_status_page_v1_service, 25);
+/**
+ * EmailChannel carries the email-channel fields for CreatePageSubscription.
+ *
+ * @generated from message openstatus.status_page.v1.EmailChannel
+ */
+export type EmailChannel = Message<"openstatus.status_page.v1.EmailChannel"> & {
+ /**
+ * Email address of the subscriber (required).
+ *
+ * @generated from field: string email = 1;
+ */
+ email: string;
+};
+
+/**
+ * Describes the message openstatus.status_page.v1.EmailChannel.
+ * Use `create(EmailChannelSchema)` to create a new message.
+ */
+export const EmailChannelSchema: GenMessage<EmailChannel> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_page_v1_service, 26);
+
+/**
+ * WebhookChannelHeader is a single custom HTTP header.
+ *
+ * @generated from message openstatus.status_page.v1.WebhookChannelHeader
+ */
+export type WebhookChannelHeader = Message<"openstatus.status_page.v1.WebhookChannelHeader"> & {
+ /**
+ * @generated from field: string key = 1;
+ */
+ key: string;
+
+ /**
+ * @generated from field: string value = 2;
+ */
+ value: string;
+};
+
+/**
+ * Describes the message openstatus.status_page.v1.WebhookChannelHeader.
+ * Use `create(WebhookChannelHeaderSchema)` to create a new message.
+ */
+export const WebhookChannelHeaderSchema: GenMessage<WebhookChannelHeader> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_page_v1_service, 27);
+
+/**
+ * WebhookChannel carries the webhook-channel fields for CreatePageSubscription.
+ *
+ * @generated from message openstatus.status_page.v1.WebhookChannel
+ */
+export type WebhookChannel = Message<"openstatus.status_page.v1.WebhookChannel"> & {
+ /**
+ * Webhook URL (required). Payload flavor (Slack / Discord / generic) is auto-detected from the URL prefix.
+ *
+ * @generated from field: string webhook_url = 1;
+ */
+ webhookUrl: string;
+
+ /**
+ * Optional custom HTTP headers attached to every dispatch.
+ *
+ * @generated from field: repeated openstatus.status_page.v1.WebhookChannelHeader headers = 2;
+ */
+ headers: WebhookChannelHeader[];
+};
+
+/**
+ * Describes the message openstatus.status_page.v1.WebhookChannel.
+ * Use `create(WebhookChannelSchema)` to create a new message.
+ */
+export const WebhookChannelSchema: GenMessage<WebhookChannel> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_page_v1_service, 28);
+
+/**
+ * CreatePageSubscriptionRequest is the request to add a vendor-managed subscriber to a status page.
+ *
+ * @generated from message openstatus.status_page.v1.CreatePageSubscriptionRequest
+ */
+export type CreatePageSubscriptionRequest = Message<"openstatus.status_page.v1.CreatePageSubscriptionRequest"> & {
+ /**
+ * ID of the status page (required).
+ *
+ * @generated from field: string page_id = 1;
+ */
+ pageId: string;
+
+ /**
+ * Optional human-readable label.
+ *
+ * @generated from field: optional string name = 2;
+ */
+ name?: string;
+
+ /**
+ * Component scope. Empty = entire page.
+ *
+ * @generated from field: repeated string component_ids = 3;
+ */
+ componentIds: string[];
+
+ /**
+ * Channel-specific fields (exactly one must be set).
+ *
+ * @generated from oneof openstatus.status_page.v1.CreatePageSubscriptionRequest.channel
+ */
+ channel: {
+ /**
+ * @generated from field: openstatus.status_page.v1.EmailChannel email_channel = 10;
+ */
+ value: EmailChannel;
+ case: "emailChannel";
+ } | {
+ /**
+ * @generated from field: openstatus.status_page.v1.WebhookChannel webhook_channel = 11;
+ */
+ value: WebhookChannel;
+ case: "webhookChannel";
+ } | { case: undefined; value?: undefined };
+};
+
+/**
+ * Describes the message openstatus.status_page.v1.CreatePageSubscriptionRequest.
+ * Use `create(CreatePageSubscriptionRequestSchema)` to create a new message.
+ */
+export const CreatePageSubscriptionRequestSchema: GenMessage<CreatePageSubscriptionRequest> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_page_v1_service, 29);
+
+/**
+ * CreatePageSubscriptionResponse is the response after creating a vendor-managed subscription.
+ *
+ * @generated from message openstatus.status_page.v1.CreatePageSubscriptionResponse
+ */
+export type CreatePageSubscriptionResponse = Message<"openstatus.status_page.v1.CreatePageSubscriptionResponse"> & {
+ /**
+ * The created subscriber.
+ *
+ * @generated from field: openstatus.status_page.v1.PageSubscriber subscriber = 1;
+ */
+ subscriber?: PageSubscriber;
+};
+
+/**
+ * Describes the message openstatus.status_page.v1.CreatePageSubscriptionResponse.
+ * Use `create(CreatePageSubscriptionResponseSchema)` to create a new message.
+ */
+export const CreatePageSubscriptionResponseSchema: GenMessage<CreatePageSubscriptionResponse> = /*@__PURE__*/
+ messageDesc(file_openstatus_status_page_v1_service, 30);
+
/**
* UnsubscribeFromPageRequest is the request to unsubscribe from a status page.
*
@@ -962,7 +1110,7 @@ export type UnsubscribeFromPageRequest = Message<"openstatus.status_page.v1.Unsu
* Use `create(UnsubscribeFromPageRequestSchema)` to create a new message.
*/
export const UnsubscribeFromPageRequestSchema: GenMessage<UnsubscribeFromPageRequest> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 26);
+ messageDesc(file_openstatus_status_page_v1_service, 31);
/**
* UnsubscribeFromPageResponse is the response after unsubscribing from a status page.
@@ -983,7 +1131,7 @@ export type UnsubscribeFromPageResponse = Message<"openstatus.status_page.v1.Uns
* Use `create(UnsubscribeFromPageResponseSchema)` to create a new message.
*/
export const UnsubscribeFromPageResponseSchema: GenMessage<UnsubscribeFromPageResponse> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 27);
+ messageDesc(file_openstatus_status_page_v1_service, 32);
/**
* ListSubscribersRequest is the request to list subscribers of a status page.
@@ -1025,7 +1173,7 @@ export type ListSubscribersRequest = Message<"openstatus.status_page.v1.ListSubs
* Use `create(ListSubscribersRequestSchema)` to create a new message.
*/
export const ListSubscribersRequestSchema: GenMessage<ListSubscribersRequest> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 28);
+ messageDesc(file_openstatus_status_page_v1_service, 33);
/**
* ListSubscribersResponse is the response containing status page subscribers.
@@ -1053,7 +1201,7 @@ export type ListSubscribersResponse = Message<"openstatus.status_page.v1.ListSub
* Use `create(ListSubscribersResponseSchema)` to create a new message.
*/
export const ListSubscribersResponseSchema: GenMessage<ListSubscribersResponse> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 29);
+ messageDesc(file_openstatus_status_page_v1_service, 34);
/**
* GetStatusPageContentRequest is the request to get the full content of a status page.
@@ -1090,7 +1238,7 @@ export type GetStatusPageContentRequest = Message<"openstatus.status_page.v1.Get
* Use `create(GetStatusPageContentRequestSchema)` to create a new message.
*/
export const GetStatusPageContentRequestSchema: GenMessage<GetStatusPageContentRequest> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 30);
+ messageDesc(file_openstatus_status_page_v1_service, 35);
/**
* GetStatusPageContentResponse is the response containing the full status page content.
@@ -1139,7 +1287,7 @@ export type GetStatusPageContentResponse = Message<"openstatus.status_page.v1.Ge
* Use `create(GetStatusPageContentResponseSchema)` to create a new message.
*/
export const GetStatusPageContentResponseSchema: GenMessage<GetStatusPageContentResponse> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 31);
+ messageDesc(file_openstatus_status_page_v1_service, 36);
/**
* GetOverallStatusRequest is the request to get the overall status of a status page.
@@ -1176,7 +1324,7 @@ export type GetOverallStatusRequest = Message<"openstatus.status_page.v1.GetOver
* Use `create(GetOverallStatusRequestSchema)` to create a new message.
*/
export const GetOverallStatusRequestSchema: GenMessage<GetOverallStatusRequest> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 32);
+ messageDesc(file_openstatus_status_page_v1_service, 37);
/**
* ComponentStatus represents the status of a single component.
@@ -1204,7 +1352,7 @@ export type ComponentStatus = Message<"openstatus.status_page.v1.ComponentStatus
* Use `create(ComponentStatusSchema)` to create a new message.
*/
export const ComponentStatusSchema: GenMessage<ComponentStatus> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 33);
+ messageDesc(file_openstatus_status_page_v1_service, 38);
/**
* GetOverallStatusResponse is the response containing the overall status and individual component statuses.
@@ -1232,7 +1380,7 @@ export type GetOverallStatusResponse = Message<"openstatus.status_page.v1.GetOve
* Use `create(GetOverallStatusResponseSchema)` to create a new message.
*/
export const GetOverallStatusResponseSchema: GenMessage<GetOverallStatusResponse> = /*@__PURE__*/
- messageDesc(file_openstatus_status_page_v1_service, 34);
+ messageDesc(file_openstatus_status_page_v1_service, 39);
/**
* StatusPageService provides CRUD and management operations for status pages,
@@ -1362,7 +1510,16 @@ export const StatusPageService: GenService<{
output: typeof UpdateComponentGroupResponseSchema;
},
/**
- * SubscribeToPage subscribes an email to a status page. If the email was previously unsubscribed, the subscription is reactivated.
+ * SubscribeToPage: end-user email self-signup with double opt-in verification.
+ *
+ * Use this when an end-user enters their email on the public status page to
+ * subscribe themselves. A verification email is sent and the subscription is
+ * only activated once the recipient confirms. If the email was previously
+ * unsubscribed, the subscription is reactivated rather than duplicated.
+ *
+ * Pair with CreatePageSubscription (vendor-added, no verification) depending
+ * on who is initiating the subscription — the subscriber themselves, or an
+ * operator acting on their behalf.
*
* @generated from rpc openstatus.status_page.v1.StatusPageService.SubscribeToPage
*/
@@ -1371,6 +1528,25 @@ export const StatusPageService: GenService<{
input: typeof SubscribeToPageRequestSchema;
output: typeof SubscribeToPageResponseSchema;
},
+ /**
+ * CreatePageSubscription: operator-added subscriber (email or webhook), no verification.
+ *
+ * Use this when an operator adds a subscriber on behalf of a partner — the
+ * caller has already established consent out-of-band, so no double opt-in is
+ * required and notifications begin immediately. Supports both email and
+ * webhook (Slack / Discord) channels. A management token is still generated
+ * so the partner can self-manage via /manage/{token} and /unsubscribe/{token}.
+ *
+ * Pair with SubscribeToPage (self-signup with verification) depending on who
+ * is initiating the subscription.
+ *
+ * @generated from rpc openstatus.status_page.v1.StatusPageService.CreatePageSubscription
+ */
+ createPageSubscription: {
+ methodKind: "unary";
+ input: typeof CreatePageSubscriptionRequestSchema;
+ output: typeof CreatePageSubscriptionResponseSchema;
+ },
/**
* UnsubscribeFromPage removes a subscription from a status page.
*
diff --git a/packages/subscriptions/package.json b/packages/subscriptions/package.json
index ac771c976..25475c106 100644
--- a/packages/subscriptions/package.json
+++ b/packages/subscriptions/package.json
@@ -8,6 +8,10 @@
".": {
"import": "./src/index.ts",
"types": "./src/index.ts"
+ },
+ "./client": {
+ "import": "./src/client.ts",
+ "types": "./src/client.ts"
}
},
"scripts": {
@@ -16,6 +20,7 @@
"dependencies": {
"@openstatus/db": "workspace:*",
"@openstatus/emails": "workspace:*",
+ "@openstatus/notification-base": "workspace:*",
"@openstatus/utils": "workspace:*",
"zod": "4.1.13"
},
diff --git a/packages/subscriptions/src/channels/webhook.test.ts b/packages/subscriptions/src/channels/webhook.test.ts
index 4d96558e3..a23bf3d23 100644
--- a/packages/subscriptions/src/channels/webhook.test.ts
+++ b/packages/subscriptions/src/channels/webhook.test.ts
@@ -1,11 +1,18 @@
import { afterEach, beforeEach, describe, expect, spyOn, test } from "bun:test";
import type { PageUpdate, Subscription } from "../types";
import {
+ buildGenericPayload,
+ buildTestPayload,
+ detectWebhookFlavor,
+ sendTestWebhookRequest,
sendWebhookNotifications,
sendWebhookVerification,
validateWebhookConfig,
} from "./webhook";
+const SLACK_URL = "https://hooks.slack.com/services/T1/B1/XXX";
+const DISCORD_URL = "https://discord.com/api/webhooks/1/xxx";
+
// biome-ignore lint/suspicious/noExplicitAny: test spy
let fetchMock: any;
@@ -16,7 +23,7 @@ function makeSub(overrides: Partial<Subscription> = {}): Subscription {
pageName: "Test Page",
pageSlug: "test",
channelType: "webhook",
- webhookUrl: "https://example.com/webhook",
+ webhookUrl: SLACK_URL,
token: "token-123",
componentIds: [],
...overrides,
@@ -138,36 +145,34 @@ describe("sendWebhookNotifications", () => {
test("sends a POST request to each webhook URL", async () => {
fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
- const sub1 = makeSub({ webhookUrl: "https://hook1.example.com" });
- const sub2 = makeSub({ webhookUrl: "https://hook2.example.com" });
+ const sub1 = makeSub({
+ webhookUrl: "https://hooks.slack.com/services/T1/B1/aaa",
+ });
+ const sub2 = makeSub({
+ webhookUrl: "https://hooks.slack.com/services/T2/B2/bbb",
+ });
await sendWebhookNotifications([sub1, sub2], makeUpdate());
expect(fetchMock).toHaveBeenCalledTimes(2);
const urls = fetchMock.mock.calls.map(([url]: [string]) => url);
- expect(urls).toContain("https://hook1.example.com");
- expect(urls).toContain("https://hook2.example.com");
+ expect(urls).toContain("https://hooks.slack.com/services/T1/B1/aaa");
+ expect(urls).toContain("https://hooks.slack.com/services/T2/B2/bbb");
});
- test("sends the correct payload shape", async () => {
+ test("drops subscriptions with non-Slack/Discord URLs", async () => {
fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
- const sub = makeSub({ pageId: 42, pageName: "My Page" });
- const update = makeUpdate({
- title: "Outage",
- status: "resolved",
- pageComponents: ["API"],
+ const generic = makeSub({
+ id: 101,
+ webhookUrl: "https://example.com/webhook",
});
+ const slack = makeSub({ id: 102, webhookUrl: SLACK_URL });
- await sendWebhookNotifications([sub], update);
+ await sendWebhookNotifications([generic, slack], makeUpdate());
- const [, init] = fetchMock.mock.calls[0];
- const body = JSON.parse(init?.body as string);
- expect(body.type).toBe("page_update");
- expect(body.page.id).toBe(42);
- expect(body.page.name).toBe("My Page");
- expect(body.update.status).toBe("resolved");
- expect(body.update.title).toBe("Outage");
- expect(body.update.pageComponents).toEqual(["API"]);
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ const [url] = fetchMock.mock.calls[0];
+ expect(url).toBe(SLACK_URL);
});
test("applies custom headers from channelConfig", async () => {
@@ -190,8 +195,12 @@ describe("sendWebhookNotifications", () => {
.mockRejectedValueOnce(new Error("Network error"))
.mockResolvedValueOnce(new Response(null, { status: 200 }));
- const sub1 = makeSub({ webhookUrl: "https://fail.example.com" });
- const sub2 = makeSub({ webhookUrl: "https://succeed.example.com" });
+ const sub1 = makeSub({
+ webhookUrl: "https://hooks.slack.com/services/T1/B1/fail",
+ });
+ const sub2 = makeSub({
+ webhookUrl: "https://hooks.slack.com/services/T2/B2/succeed",
+ });
await expect(
sendWebhookNotifications([sub1, sub2], makeUpdate()),
@@ -200,3 +209,225 @@ describe("sendWebhookNotifications", () => {
expect(fetchMock).toHaveBeenCalledTimes(2);
});
});
+
+// ─── detectWebhookFlavor ──────────────────────────────────────────────────────
+
+describe("detectWebhookFlavor", () => {
+ test("detects Slack incoming webhook URLs", () => {
+ expect(
+ detectWebhookFlavor("https://hooks.slack.com/services/T00/B00/XXX"),
+ ).toBe("slack");
+ });
+
+ test("detects Discord webhook URLs", () => {
+ expect(
+ detectWebhookFlavor("https://discord.com/api/webhooks/123/abc"),
+ ).toBe("discord");
+ });
+
+ test("falls back to generic for unknown hosts", () => {
+ expect(detectWebhookFlavor("https://example.com/webhook")).toBe("generic");
+ });
+});
+
+// ─── flavor-specific notification payloads ────────────────────────────────────
+
+describe("sendWebhookNotifications (flavor detection)", () => {
+ test("emits Slack blocks payload for hooks.slack.com URLs", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
+ const sub = makeSub({ webhookUrl: SLACK_URL });
+
+ await sendWebhookNotifications([sub], makeUpdate());
+
+ const [, init] = fetchMock.mock.calls[0];
+ const body = JSON.parse(init?.body as string);
+ expect(body.attachments).toBeDefined();
+ expect(body.attachments[0].blocks).toBeInstanceOf(Array);
+ });
+
+ test("emits Discord embed payload for discord.com URLs", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
+ const sub = makeSub({ webhookUrl: DISCORD_URL });
+
+ await sendWebhookNotifications([sub], makeUpdate());
+
+ const [, init] = fetchMock.mock.calls[0];
+ const body = JSON.parse(init?.body as string);
+ expect(body.embeds).toBeInstanceOf(Array);
+ expect(body.embeds[0].title).toBe("Test Incident");
+ });
+
+ test("Slack payload includes manage/unsubscribe links", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
+ const sub = makeSub({
+ token: "tok-123",
+ pageSlug: "demo",
+ });
+
+ await sendWebhookNotifications([sub], makeUpdate());
+
+ const [, init] = fetchMock.mock.calls[0];
+ const stringified = init?.body as string;
+ expect(stringified).toContain("https://demo.openstatus.dev/manage/tok-123");
+ expect(stringified).toContain(
+ "https://demo.openstatus.dev/unsubscribe/tok-123",
+ );
+ });
+
+ test("Slack payload uses custom domain when present", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
+ const sub = makeSub({
+ token: "tok-123",
+ customDomain: "status.partner.com",
+ });
+
+ await sendWebhookNotifications([sub], makeUpdate());
+
+ const [, init] = fetchMock.mock.calls[0];
+ const stringified = init?.body as string;
+ expect(stringified).toContain("https://status.partner.com/manage/tok-123");
+ });
+});
+
+// ─── buildGenericPayload (staged, not yet reachable in production) ────────────
+
+describe("buildGenericPayload", () => {
+ const links = {
+ manageUrl: "https://demo.openstatus.dev/manage/tok-1",
+ unsubscribeUrl: "https://demo.openstatus.dev/unsubscribe/tok-1",
+ };
+
+ test("status_report shape", () => {
+ const sub = makeSub({ pageId: 42, pageName: "Acme", pageSlug: "acme" });
+ const update = makeUpdate({
+ id: 12,
+ title: "API degraded",
+ status: "investigating",
+ message: "Looking into it.",
+ date: "2026-04-21T09:59:58Z",
+ updateId: 42,
+ pageComponentsWithId: [{ id: 7, name: "API" }],
+ });
+
+ const payload = buildGenericPayload(update, sub, links) as {
+ type: string;
+ data: { status_report: Record<string, unknown> };
+ subscription: { manage_url: string; unsubscribe_url: string };
+ };
+
+ expect(payload.type).toBe("status_report");
+ expect(payload.data.status_report).toMatchObject({
+ id: 12,
+ title: "API degraded",
+ update: {
+ id: 42,
+ status: "investigating",
+ message: "Looking into it.",
+ created_at: "2026-04-21T09:59:58Z",
+ },
+ page: { id: 42, name: "Acme", slug: "acme" },
+ components: [{ id: 7, name: "API" }],
+ });
+ expect(payload.subscription).toEqual({
+ manage_url: links.manageUrl,
+ unsubscribe_url: links.unsubscribeUrl,
+ });
+ });
+
+ test("maintenance shape (no status field, includes starts_at/ends_at)", () => {
+ const sub = makeSub({ pageId: 42, pageName: "Acme", pageSlug: "acme" });
+ const update = makeUpdate({
+ id: 17,
+ title: "DB upgrade",
+ status: "maintenance",
+ message: "Rolling primary.",
+ startsAt: "2026-04-22T02:00:00Z",
+ endsAt: "2026-04-22T03:00:00Z",
+ pageComponentsWithId: [{ id: 7, name: "API" }],
+ });
+
+ const payload = buildGenericPayload(update, sub, links) as {
+ type: string;
+ data: { maintenance: Record<string, unknown> };
+ };
+
+ expect(payload.type).toBe("maintenance");
+ expect(payload.data.maintenance).toMatchObject({
+ id: 17,
+ title: "DB upgrade",
+ message: "Rolling primary.",
+ starts_at: "2026-04-22T02:00:00Z",
+ ends_at: "2026-04-22T03:00:00Z",
+ page: { id: 42, name: "Acme", slug: "acme" },
+ components: [{ id: 7, name: "API" }],
+ });
+ expect(payload.data.maintenance).not.toHaveProperty("status");
+ });
+});
+
+// ─── buildTestPayload ─────────────────────────────────────────────────────────
+
+describe("buildTestPayload", () => {
+ test("Slack flavor returns attachments with blocks", () => {
+ const payload = buildTestPayload("slack") as { attachments: unknown[] };
+ expect(payload.attachments).toBeInstanceOf(Array);
+ });
+
+ test("Discord flavor returns embeds", () => {
+ const payload = buildTestPayload("discord") as { embeds: unknown[] };
+ expect(payload.embeds).toBeInstanceOf(Array);
+ });
+
+ test("generic flavor returns type='test' JSON", () => {
+ const payload = buildTestPayload("generic") as {
+ type: string;
+ message: string;
+ };
+ expect(payload.type).toBe("test");
+ expect(typeof payload.message).toBe("string");
+ });
+});
+
+// ─── sendTestWebhookRequest ───────────────────────────────────────────────────
+
+describe("sendTestWebhookRequest", () => {
+ test("POSTs flavor-appropriate payload", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
+ await sendTestWebhookRequest({
+ url: "https://example.com/hook",
+ flavor: "generic",
+ });
+
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ const [url, init] = fetchMock.mock.calls[0];
+ expect(url).toBe("https://example.com/hook");
+ expect(init?.method).toBe("POST");
+ const body = JSON.parse(init?.body as string);
+ expect(body.type).toBe("test");
+ });
+
+ test("throws on non-2xx response", async () => {
+ fetchMock.mockResolvedValue(
+ new Response(null, { status: 404, statusText: "Not Found" }),
+ );
+ await expect(
+ sendTestWebhookRequest({
+ url: "https://example.com/hook",
+ flavor: "generic",
+ }),
+ ).rejects.toThrow(/Test webhook failed: 404/);
+ });
+
+ test("passes custom headers", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 200 }));
+ await sendTestWebhookRequest({
+ url: "https://example.com/hook",
+ flavor: "generic",
+ headers: { "X-Custom": "abc" },
+ });
+
+ const [, init] = fetchMock.mock.calls[0];
+ const headers = init?.headers as Record<string, string>;
+ expect(headers["X-Custom"]).toBe("abc");
+ });
+});
diff --git a/packages/subscriptions/src/channels/webhook.ts b/packages/subscriptions/src/channels/webhook.ts
index 711103896..ebe949503 100644
--- a/packages/subscriptions/src/channels/webhook.ts
+++ b/packages/subscriptions/src/channels/webhook.ts
@@ -1,7 +1,64 @@
+import { COLORS, COLOR_DECIMALS } from "@openstatus/notification-base";
import { assertSafeUrl } from "@openstatus/utils";
import { z } from "zod";
import type { PageUpdate, Subscription } from "../types";
+export type WebhookFlavor = "slack" | "discord" | "generic";
+
+const SLACK_PREFIX = "https://hooks.slack.com/services/";
+const DISCORD_PREFIX = "https://discord.com/api/webhooks/";
+
+/**
+ * Classify a webhook URL by its incoming-webhook origin so we can emit
+ * channel-native payloads. Unknown URLs fall back to generic JSON.
+ */
+export function detectWebhookFlavor(url: string): WebhookFlavor {
+ if (url.startsWith(SLACK_PREFIX)) return "slack";
+ if (url.startsWith(DISCORD_PREFIX)) return "discord";
+ return "generic";
+}
+
+function redactWebhookUrl(url: string): string {
+ try {
+ return `${new URL(url).origin}/***`;
+ } catch {
+ return "<invalid-url>";
+ }
+}
+
+function resolveStatusPageOrigin(subscription: Subscription): string {
+ return subscription.customDomain
+ ? `https://${subscription.customDomain}`
+ : `https://${subscription.pageSlug}.openstatus.dev`;
+}
+
+function buildManagementLinks(subscription: Subscription) {
+ if (!subscription.token) {
+ return { manageUrl: null, unsubscribeUrl: null };
+ }
+ const origin = resolveStatusPageOrigin(subscription);
+ return {
+ manageUrl: `${origin}/manage/${subscription.token}`,
+ unsubscribeUrl: `${origin}/unsubscribe/${subscription.token}`,
+ };
+}
+
+type StatusColor = "red" | "yellow" | "green" | "blue";
+
+function statusColor(status: PageUpdate["status"]): StatusColor {
+ switch (status) {
+ case "investigating":
+ case "identified":
+ return "red";
+ case "monitoring":
+ return "yellow";
+ case "resolved":
+ return "green";
+ case "maintenance":
+ return "blue";
+ }
+}
+
export async function validateWebhookConfig(config: unknown) {
const schema = z.object({
headers: z
@@ -51,11 +108,235 @@ export async function sendWebhookVerification(
}
}
+type ManagementLinks = ReturnType<typeof buildManagementLinks>;
+
+function buildSlackPayload(
+ pageUpdate: PageUpdate,
+ subscription: Subscription,
+ links: ManagementLinks,
+) {
+ const color = statusColor(pageUpdate.status);
+
+ const blocks: Record<string, unknown>[] = [
+ {
+ type: "header",
+ text: {
+ type: "plain_text",
+ text: pageUpdate.title,
+ emoji: true,
+ },
+ },
+ {
+ type: "section",
+ fields: [
+ {
+ type: "mrkdwn",
+ text: `*Status*\n${pageUpdate.status}`,
+ },
+ {
+ type: "mrkdwn",
+ text: `*Page*\n${subscription.pageName}`,
+ },
+ ],
+ },
+ ];
+
+ if (pageUpdate.message) {
+ blocks.push({
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: pageUpdate.message,
+ },
+ });
+ }
+
+ if (pageUpdate.pageComponents.length > 0) {
+ blocks.push({
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: `*Affected*\n${pageUpdate.pageComponents.join(", ")}`,
+ },
+ });
+ }
+
+ blocks.push({
+ type: "context",
+ elements: [
+ {
+ type: "mrkdwn",
+ text: pageUpdate.date,
+ },
+ ],
+ });
+
+ if (links.manageUrl && links.unsubscribeUrl) {
+ blocks.push({
+ type: "context",
+ elements: [
+ {
+ type: "mrkdwn",
+ text: `<${links.manageUrl}|Manage> · <${links.unsubscribeUrl}|Unsubscribe>`,
+ },
+ ],
+ });
+ }
+
+ return {
+ attachments: [
+ {
+ color: COLORS[color],
+ blocks,
+ },
+ ],
+ };
+}
+
+function buildDiscordPayload(
+ pageUpdate: PageUpdate,
+ subscription: Subscription,
+ links: ManagementLinks,
+) {
+ const color = statusColor(pageUpdate.status);
+
+ const descriptionParts: string[] = [];
+ if (pageUpdate.message) descriptionParts.push(pageUpdate.message);
+ if (pageUpdate.pageComponents.length > 0) {
+ descriptionParts.push(
+ `**Affected:** ${pageUpdate.pageComponents.join(", ")}`,
+ );
+ }
+ if (links.manageUrl && links.unsubscribeUrl) {
+ descriptionParts.push(
+ `[Manage](${links.manageUrl}) · [Unsubscribe](${links.unsubscribeUrl})`,
+ );
+ }
+
+ return {
+ embeds: [
+ {
+ title: pageUpdate.title,
+ description: descriptionParts.join("\n\n") || undefined,
+ color: COLOR_DECIMALS[color],
+ fields: [
+ {
+ name: "Status",
+ value: pageUpdate.status,
+ inline: true,
+ },
+ {
+ name: "Page",
+ value: subscription.pageName,
+ inline: true,
+ },
+ ],
+ footer: {
+ text: pageUpdate.date,
+ },
+ },
+ ],
+ };
+}
+
+/**
+ * Prepared (staged) generic webhook payload. Currently unreachable in
+ * production — the input gate rejects non-Slack/Discord URLs, and the
+ * dispatcher filters the same at send-time. Exported for unit-test coverage
+ * so the contract stays green while generic webhooks are held back.
+ */
+export function buildGenericPayload(
+ pageUpdate: PageUpdate,
+ subscription: Subscription,
+ links: ManagementLinks,
+) {
+ const page = {
+ id: subscription.pageId,
+ name: subscription.pageName,
+ slug: subscription.pageSlug,
+ };
+ const components =
+ pageUpdate.pageComponentsWithId ??
+ pageUpdate.pageComponents.map((name, i) => ({ id: i, name }));
+ const subscriptionBlock = {
+ manage_url: links.manageUrl,
+ unsubscribe_url: links.unsubscribeUrl,
+ };
+
+ if (pageUpdate.status === "maintenance") {
+ return {
+ type: "maintenance" as const,
+ data: {
+ maintenance: {
+ id: pageUpdate.id,
+ title: pageUpdate.title,
+ message: pageUpdate.message,
+ starts_at: pageUpdate.startsAt,
+ ends_at: pageUpdate.endsAt,
+ page,
+ components,
+ },
+ },
+ subscription: subscriptionBlock,
+ };
+ }
+
+ return {
+ type: "status_report" as const,
+ data: {
+ status_report: {
+ id: pageUpdate.id,
+ title: pageUpdate.title,
+ update: {
+ id: pageUpdate.updateId,
+ status: pageUpdate.status,
+ message: pageUpdate.message,
+ created_at: pageUpdate.date,
+ },
+ page,
+ components,
+ },
+ },
+ subscription: subscriptionBlock,
+ };
+}
+
+function buildNotificationPayload(
+ pageUpdate: PageUpdate,
+ subscription: Subscription,
+) {
+ if (!hasWebhookUrl(subscription)) {
+ throw new Error("Subscription has no webhook URL");
+ }
+ const flavor = detectWebhookFlavor(subscription.webhookUrl);
+ const links = buildManagementLinks(subscription);
+
+ switch (flavor) {
+ case "slack":
+ return buildSlackPayload(pageUpdate, subscription, links);
+ case "discord":
+ return buildDiscordPayload(pageUpdate, subscription, links);
+ case "generic":
+ return buildGenericPayload(pageUpdate, subscription, links);
+ }
+}
+
export async function sendWebhookNotifications(
subscriptions: Subscription[],
pageUpdate: PageUpdate,
) {
- const validSubscriptions = subscriptions.filter(hasWebhookUrl);
+ // Defense-in-depth: the input gate (tRPC + service layer) already rejects
+ // non-Slack/Discord URLs at save time. Drop any that slip through so the
+ // unreachable generic payload never ships to an unapproved destination.
+ const validSubscriptions = subscriptions
+ .filter(hasWebhookUrl)
+ .filter((sub) => {
+ if (detectWebhookFlavor(sub.webhookUrl) !== "generic") return true;
+ console.warn(
+ `Dropping webhook subscription ${sub.id}: generic URLs are not currently supported`,
+ );
+ return false;
+ });
if (validSubscriptions.length === 0) return;
await Promise.allSettled(
@@ -71,18 +352,7 @@ export async function sendWebhookNotifications(
);
}
- const payload = {
- type: "page_update",
- page: { id: subscription.pageId, name: subscription.pageName },
- update: {
- id: pageUpdate.id,
- title: pageUpdate.title,
- status: pageUpdate.status,
- message: pageUpdate.message,
- pageComponents: pageUpdate.pageComponents,
- date: pageUpdate.date,
- },
- };
+ const payload = buildNotificationPayload(pageUpdate, subscription);
const headers: Record<string, string> = {
"Content-Type": "application/json",
@@ -109,13 +379,13 @@ export async function sendWebhookNotifications(
if (!response.ok) {
console.error(
- `Webhook notification failed for ${subscription.webhookUrl}: ${response.status} ${response.statusText}`,
+ `Webhook notification failed for ${redactWebhookUrl(subscription.webhookUrl)}: ${response.status} ${response.statusText}`,
);
throw new Error(`Webhook returned ${response.status}`);
}
} catch (error) {
console.error(
- `Failed to send webhook notification to ${subscription.webhookUrl}:`,
+ `Failed to send webhook notification to ${redactWebhookUrl(subscription.webhookUrl)}:`,
error,
);
throw error;
@@ -123,3 +393,86 @@ export async function sendWebhookNotifications(
}),
);
}
+
+/**
+ * Build a flavor-specific test payload (used by the "Send test" row action).
+ * Exported for unit-test coverage; also called by `sendTestWebhookRequest`.
+ */
+export function buildTestPayload(flavor: WebhookFlavor) {
+ switch (flavor) {
+ case "slack":
+ return {
+ attachments: [
+ {
+ color: COLORS.green,
+ blocks: [
+ {
+ type: "header",
+ text: {
+ type: "plain_text",
+ text: "Test Notification",
+ emoji: false,
+ },
+ },
+ {
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: "Your openstatus webhook is configured correctly.",
+ },
+ },
+ ],
+ },
+ ],
+ };
+ case "discord":
+ return {
+ embeds: [
+ {
+ title: "Test Notification",
+ description: "Your openstatus webhook is configured correctly.",
+ color: COLOR_DECIMALS.green,
+ timestamp: new Date().toISOString(),
+ },
+ ],
+ };
+ case "generic":
+ return {
+ type: "test",
+ message: "Your openstatus webhook is configured correctly.",
+ timestamp: new Date().toISOString(),
+ };
+ }
+}
+
+/**
+ * Send a test payload to the given webhook URL. SSRF-checked and timeout-capped.
+ * Throws on non-2xx or network error.
+ */
+export async function sendTestWebhookRequest(input: {
+ url: string;
+ flavor: WebhookFlavor;
+ headers?: Record<string, string>;
+}) {
+ const { url, flavor, headers: extraHeaders = {} } = input;
+ await assertSafeUrl(url);
+
+ const headers: Record<string, string> = {
+ "Content-Type": "application/json",
+ "User-Agent": "OpenStatus-Webhooks/1.0",
+ ...extraHeaders,
+ };
+
+ const response = await fetch(url, {
+ method: "POST",
+ headers,
+ body: JSON.stringify(buildTestPayload(flavor)),
+ signal: AbortSignal.timeout(10000),
+ });
+
+ if (!response.ok) {
+ throw new Error(
+ `Test webhook failed: ${response.status} ${response.statusText}`,
+ );
+ }
+}
diff --git a/packages/subscriptions/src/client.ts b/packages/subscriptions/src/client.ts
new file mode 100644
index 000000000..52aac92ad
--- /dev/null
+++ b/packages/subscriptions/src/client.ts
@@ -0,0 +1,4 @@
+// Client-safe entrypoint: re-exports only pure helpers that do not
+// transitively load server-only modules (env vars, Resend, DB, etc).
+export { detectWebhookFlavor } from "./channels/webhook";
+export type { WebhookFlavor } from "./channels/webhook";
diff --git a/packages/subscriptions/src/dispatcher.ts b/packages/subscriptions/src/dispatcher.ts
index 0d707dc1c..9c9000974 100644
--- a/packages/subscriptions/src/dispatcher.ts
+++ b/packages/subscriptions/src/dispatcher.ts
@@ -48,6 +48,11 @@ export async function dispatchStatusReportUpdate(statusReportUpdateId: number) {
pageComponentIds: pageComponents.map((c) => c.id),
pageComponents: pageComponents.map((c) => c.name),
date: update.date.toISOString(),
+ updateId: update.id,
+ pageComponentsWithId: pageComponents.map((c) => ({
+ id: c.id,
+ name: c.name,
+ })),
});
}
@@ -88,6 +93,12 @@ export async function dispatchMaintenanceUpdate(maintenanceId: number) {
pageComponentIds: pageComponents.map((c) => c.id),
pageComponents: pageComponents.map((c) => c.name),
date: `${maintenanceWithComponents.from.toISOString()} - ${maintenanceWithComponents.to.toISOString()}`,
+ startsAt: maintenanceWithComponents.from.toISOString(),
+ endsAt: maintenanceWithComponents.to.toISOString(),
+ pageComponentsWithId: pageComponents.map((c) => ({
+ id: c.id,
+ name: c.name,
+ })),
});
}
diff --git a/packages/subscriptions/src/index.ts b/packages/subscriptions/src/index.ts
index df36411e8..09caf18b5 100644
--- a/packages/subscriptions/src/index.ts
+++ b/packages/subscriptions/src/index.ts
@@ -5,10 +5,14 @@ export {
validateEmailConfig,
} from "./channels/email";
export {
+ buildTestPayload,
+ detectWebhookFlavor,
+ sendTestWebhookRequest,
sendWebhookNotifications,
sendWebhookVerification,
validateWebhookConfig,
} from "./channels/webhook";
+export type { WebhookFlavor } from "./channels/webhook";
export { getChannel } from "./channels/index";
// Export dispatcher functions
@@ -20,13 +24,20 @@ export {
// Export service functions
export {
+ createSubscription,
upsertEmailSubscription,
hasPendingUnexpiredSubscription,
verifySubscription,
getSubscriptionByToken,
+ sendTestWebhook,
+ updateChannel,
updateSubscriptionScope,
unsubscribe,
} from "./service";
+export type {
+ CreateSubscriptionInput,
+ UpdateChannelInput,
+} from "./service";
// Export types
export type { Subscription, PageUpdate, SubscriptionChannel } from "./types";
diff --git a/packages/subscriptions/src/service.test.ts b/packages/subscriptions/src/service.test.ts
index e6b687699..5e0216ae3 100644
--- a/packages/subscriptions/src/service.test.ts
+++ b/packages/subscriptions/src/service.test.ts
@@ -162,13 +162,13 @@ describe("upsertEmailSubscription", () => {
test("throws for component IDs that do not belong to this page", async () => {
await expect(
upsertEmailSubscription({ email, pageId: PAGE_ID, componentIds: [9999] }),
- ).rejects.toThrow("Invalid components: 9999");
+ ).rejects.toThrow("Some components do not belong to this page");
});
test("throws for a page ID that does not exist", async () => {
await expect(
upsertEmailSubscription({ email, pageId: 99999 }),
- ).rejects.toThrow("Page 99999 not found");
+ ).rejects.toThrow("Page not found");
});
});
diff --git a/packages/subscriptions/src/service.ts b/packages/subscriptions/src/service.ts
index c61e4e643..d23e0dcfa 100644
--- a/packages/subscriptions/src/service.ts
+++ b/packages/subscriptions/src/service.ts
@@ -1,10 +1,15 @@
-import { and, db, eq, inArray, isNull } from "@openstatus/db";
+import { and, db, eq, inArray, isNull, ne, sql } from "@openstatus/db";
import {
page,
pageComponent,
pageSubscriber,
pageSubscriberToPageComponent,
} from "@openstatus/db/src/schema";
+import { assertSafeUrl } from "@openstatus/utils";
+import {
+ detectWebhookFlavor,
+ sendTestWebhookRequest,
+} from "./channels/webhook";
/**
* Subscription Service Layer
@@ -26,6 +31,11 @@ function maskEmail(email: string): string {
return `${masked}@${domain}`;
}
+function maskWebhookUrl(webhookUrl: string): string {
+ const url = new URL(webhookUrl);
+ return `${url.origin}***`;
+}
+
interface UpsertEmailSubscriptionInput {
email: string;
pageId: number;
@@ -55,7 +65,7 @@ export async function upsertEmailSubscription(
});
if (!pageData) {
- throw new Error(`Page ${pageId} not found`);
+ throw new Error("Page not found");
}
// Validate component IDs belong to this page
@@ -72,9 +82,7 @@ export async function upsertEmailSubscription(
.all();
if (validComponents.length !== componentIds.length) {
- const validIds = validComponents.map((c) => c.id);
- const invalidIds = componentIds.filter((id) => !validIds.includes(id));
- throw new Error(`Invalid components: ${invalidIds.join(", ")}`);
+ throw new Error("Some components do not belong to this page");
}
}
@@ -295,6 +303,9 @@ export async function getSubscriptionByToken(token: string, domain?: string) {
}
}
+ // Intentionally omitting webhookUrl/channelConfig — this is a public,
+ // token-addressed endpoint and webhook URLs embed credential-bearing
+ // paths that shouldn't leave the server.
return {
id: subscription.id,
pageId: subscription.pageId,
@@ -303,7 +314,9 @@ export async function getSubscriptionByToken(token: string, domain?: string) {
customDomain: subscription.page.customDomain,
channelType: subscription.channelType as "email" | "webhook",
email: subscription.email ? maskEmail(subscription.email) : undefined,
- webhookUrl: subscription.webhookUrl ?? undefined,
+ webhookUrl: subscription.webhookUrl
+ ? maskWebhookUrl(subscription.webhookUrl)
+ : undefined,
acceptedAt: subscription.acceptedAt ?? undefined,
unsubscribedAt: subscription.unsubscribedAt ?? undefined,
componentIds: subscription.components.map((c) => c.pageComponentId),
@@ -426,6 +439,355 @@ export async function updateSubscriptionScope(
};
}
+/**
+ * Create a vendor-added subscription (channel-agnostic).
+ *
+ * Skips the verification flow: `source = "vendor"`, `acceptedAt`
+ * stamped at creation, `expiresAt = null`. Token is still generated so the
+ * partner can self-manage via the existing `/manage/{token}` and
+ * `/unsubscribe/{token}` routes.
+ */
+export type CreateSubscriptionInput =
+ | {
+ pageId: number;
+ channelType: "email";
+ email: string;
+ name?: string | null;
+ componentIds?: number[];
+ }
+ | {
+ pageId: number;
+ channelType: "webhook";
+ webhookUrl: string;
+ name?: string | null;
+ channelConfig?: unknown;
+ componentIds?: number[];
+ };
+
+export async function createSubscription(input: CreateSubscriptionInput) {
+ const { pageId, channelType, name, componentIds = [] } = input;
+
+ const pageData = await db.query.page.findFirst({
+ where: eq(page.id, pageId),
+ });
+
+ if (!pageData) {
+ throw new Error("Page not found");
+ }
+
+ if (componentIds.length > 0) {
+ const validComponents = await db
+ .select({ id: pageComponent.id })
+ .from(pageComponent)
+ .where(
+ and(
+ eq(pageComponent.pageId, pageId),
+ inArray(pageComponent.id, componentIds),
+ ),
+ )
+ .all();
+
+ if (validComponents.length !== componentIds.length) {
+ throw new Error("Some components do not belong to this page");
+ }
+ }
+
+ let emailLower: string | null = null;
+ let webhookUrl: string | null = null;
+ let channelConfig: string | null = null;
+
+ if (channelType === "email") {
+ emailLower = input.email.toLowerCase();
+
+ const duplicate = await db.query.pageSubscriber.findFirst({
+ where: and(
+ eq(pageSubscriber.pageId, pageId),
+ eq(pageSubscriber.email, emailLower),
+ eq(pageSubscriber.channelType, "email"),
+ isNull(pageSubscriber.unsubscribedAt),
+ ),
+ });
+
+ if (duplicate) {
+ throw new Error(
+ "A subscriber with this email already exists for this page.",
+ );
+ }
+ } else {
+ webhookUrl = input.webhookUrl;
+ await assertSafeUrl(webhookUrl);
+
+ if (detectWebhookFlavor(webhookUrl) === "generic") {
+ throw new Error("Only Slack and Discord webhook URLs are supported.");
+ }
+
+ const duplicate = await db.query.pageSubscriber.findFirst({
+ where: and(
+ eq(pageSubscriber.pageId, pageId),
+ sql`LOWER(${pageSubscriber.webhookUrl}) = ${webhookUrl.toLowerCase()}`,
+ eq(pageSubscriber.channelType, "webhook"),
+ isNull(pageSubscriber.unsubscribedAt),
+ ),
+ });
+
+ if (duplicate) {
+ throw new Error(
+ "A subscriber with this webhook URL already exists for this page.",
+ );
+ }
+
+ channelConfig = input.channelConfig
+ ? JSON.stringify(input.channelConfig)
+ : null;
+ }
+
+ const token = crypto.randomUUID();
+ const now = new Date();
+
+ const subscription = await db.transaction(async (tx) => {
+ const sub = await tx
+ .insert(pageSubscriber)
+ .values({
+ channelType,
+ email: emailLower,
+ webhookUrl,
+ channelConfig,
+ pageId,
+ source: "vendor",
+ name: name ?? null,
+ token,
+ acceptedAt: now,
+ expiresAt: null,
+ })
+ .returning()
+ .get();
+
+ if (componentIds.length > 0) {
+ await tx
+ .insert(pageSubscriberToPageComponent)
+ .values(
+ componentIds.map((compId) => ({
+ pageSubscriberId: sub.id,
+ pageComponentId: compId,
+ })),
+ )
+ .run();
+ }
+
+ return sub;
+ });
+
+ return {
+ id: subscription.id,
+ pageId: subscription.pageId,
+ channelType: subscription.channelType as "email" | "webhook",
+ email: subscription.email ?? undefined,
+ webhookUrl: subscription.webhookUrl ?? undefined,
+ channelConfig: subscription.channelConfig ?? undefined,
+ source: subscription.source as "self_signup" | "vendor",
+ name: subscription.name ?? undefined,
+ token: subscription.token,
+ acceptedAt: subscription.acceptedAt ?? undefined,
+ componentIds,
+ };
+}
+
+/**
+ * Update a vendor-added subscription's channel config, name, or component scope.
+ *
+ * Self-signup rows are subscriber-owned (managed via token) and rejected here.
+ * Email rows reject `webhookUrl`/`channelConfig` (no webhook fields to edit).
+ * Webhook rows accept URL/headers/name/scope. Email / webhook identity keys
+ * (email, webhookUrl) are immutable on email rows; webhook URL is mutable.
+ *
+ * componentIds semantics:
+ * - `undefined` → do not touch scope (existing component links preserved).
+ * - `[]` → reset scope to "entire page" (all existing links removed).
+ * - `[a, b, …]` → replace scope with exactly these components. All IDs must
+ * belong to the target page or the update is rejected.
+ */
+export type UpdateChannelInput = {
+ subscriberId: number;
+ pageId: number;
+ name?: string | null;
+ webhookUrl?: string;
+ channelConfig?: unknown;
+ componentIds?: number[];
+};
+
+export async function updateChannel(input: UpdateChannelInput) {
+ const {
+ subscriberId,
+ pageId,
+ name,
+ webhookUrl,
+ channelConfig,
+ componentIds,
+ } = input;
+
+ const existing = await db.query.pageSubscriber.findFirst({
+ where: and(
+ eq(pageSubscriber.id, subscriberId),
+ eq(pageSubscriber.pageId, pageId),
+ ),
+ });
+
+ if (!existing) {
+ throw new Error("Subscriber not found");
+ }
+
+ if (existing.source !== "vendor") {
+ throw new Error(
+ "Self-signup subscribers manage their own subscription; use the unsubscribe action instead.",
+ );
+ }
+
+ if (existing.channelType === "email") {
+ if (webhookUrl !== undefined || channelConfig !== undefined) {
+ throw new Error("Email subscribers do not have webhook fields to edit.");
+ }
+ }
+
+ const updateFields: Record<string, unknown> = { updatedAt: new Date() };
+ if (name !== undefined) updateFields.name = name;
+
+ if (existing.channelType === "webhook") {
+ if (webhookUrl !== undefined && webhookUrl !== existing.webhookUrl) {
+ await assertSafeUrl(webhookUrl);
+ if (detectWebhookFlavor(webhookUrl) === "generic") {
+ throw new Error("Only Slack and Discord webhook URLs are supported.");
+ }
+
+ const duplicate = await db.query.pageSubscriber.findFirst({
+ where: and(
+ eq(pageSubscriber.pageId, pageId),
+ sql`LOWER(${pageSubscriber.webhookUrl}) = ${webhookUrl.toLowerCase()}`,
+ eq(pageSubscriber.channelType, "webhook"),
+ isNull(pageSubscriber.unsubscribedAt),
+ ne(pageSubscriber.id, subscriberId),
+ ),
+ });
+
+ if (duplicate) {
+ throw new Error(
+ "A subscriber with this webhook URL already exists for this page.",
+ );
+ }
+
+ updateFields.webhookUrl = webhookUrl;
+ }
+ if (channelConfig !== undefined) {
+ updateFields.channelConfig = channelConfig
+ ? JSON.stringify(channelConfig)
+ : null;
+ }
+ }
+
+ if (componentIds !== undefined && componentIds.length > 0) {
+ const validComponents = await db
+ .select({ id: pageComponent.id })
+ .from(pageComponent)
+ .where(
+ and(
+ eq(pageComponent.pageId, pageId),
+ inArray(pageComponent.id, componentIds),
+ ),
+ )
+ .all();
+
+ if (validComponents.length !== componentIds.length) {
+ throw new Error("Some components do not belong to this page");
+ }
+ }
+
+ await db.transaction(async (tx) => {
+ await tx
+ .update(pageSubscriber)
+ .set(updateFields)
+ .where(eq(pageSubscriber.id, subscriberId))
+ .run();
+
+ if (componentIds !== undefined) {
+ await tx
+ .delete(pageSubscriberToPageComponent)
+ .where(eq(pageSubscriberToPageComponent.pageSubscriberId, subscriberId))
+ .run();
+
+ if (componentIds.length > 0) {
+ await tx
+ .insert(pageSubscriberToPageComponent)
+ .values(
+ componentIds.map((compId) => ({
+ pageSubscriberId: subscriberId,
+ pageComponentId: compId,
+ })),
+ )
+ .run();
+ }
+ }
+ });
+
+ return { id: subscriberId };
+}
+
+/**
+ * Send a test payload to a vendor-added webhook subscriber.
+ * Shape is flavor-aware (Slack blocks / Discord embed / generic JSON).
+ */
+export async function sendTestWebhook(subscriberId: number, pageId: number) {
+ const existing = await db.query.pageSubscriber.findFirst({
+ where: and(
+ eq(pageSubscriber.id, subscriberId),
+ eq(pageSubscriber.pageId, pageId),
+ ),
+ });
+
+ if (!existing) {
+ throw new Error("Subscriber not found");
+ }
+
+ if (existing.source !== "vendor") {
+ throw new Error(
+ "Only vendor-added webhook subscribers support test dispatch.",
+ );
+ }
+
+ if (existing.channelType !== "webhook" || !existing.webhookUrl) {
+ throw new Error("Subscriber is not a webhook channel");
+ }
+
+ if (existing.unsubscribedAt) {
+ throw new Error("Subscriber is unsubscribed");
+ }
+
+ const flavor = detectWebhookFlavor(existing.webhookUrl);
+ const headers = parseWebhookHeaders(existing.channelConfig);
+
+ await sendTestWebhookRequest({
+ url: existing.webhookUrl,
+ flavor,
+ headers,
+ });
+}
+
+function parseWebhookHeaders(
+ channelConfig: string | null,
+): Record<string, string> {
+ if (!channelConfig) return {};
+ try {
+ const config = JSON.parse(channelConfig) as {
+ headers?: { key: string; value: string }[];
+ };
+ const headers: Record<string, string> = {};
+ for (const h of config.headers ?? []) {
+ headers[h.key] = h.value;
+ }
+ return headers;
+ } catch {
+ return {};
+ }
+}
+
/**
* Unsubscribe by token
*/
diff --git a/packages/subscriptions/src/types.ts b/packages/subscriptions/src/types.ts
index 735780203..908f0fca8 100644
--- a/packages/subscriptions/src/types.ts
+++ b/packages/subscriptions/src/types.ts
@@ -37,6 +37,14 @@ export interface PageUpdate {
pageComponentIds: number[]; // For subscription matching
pageComponents: string[]; // Component names for display
date: string; // can be single string or "from - to"
+
+ // Optional fields consumed by the prepared (staged) generic webhook payload.
+ // Populated by the matching dispatcher; ignored by email/Slack/Discord
+ // builders, which key off the fields above.
+ updateId?: number; // statusReportUpdate.id (status reports only)
+ pageComponentsWithId?: { id: number; name: string }[];
+ startsAt?: string; // maintenance only, ISO
+ endsAt?: string; // maintenance only, ISO
}
/**
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6993856a3..ad217e80d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -143,6 +143,9 @@ importers:
'@openstatus/regions':
specifier: workspace:*
version: link:../../packages/regions
+ '@openstatus/subscriptions':
+ specifier: workspace:*
+ version: link:../../packages/subscriptions
'@openstatus/theme-store':
specifier: workspace:*
version: link:../../packages/theme-store
@@ -161,6 +164,9 @@ importers:
'@openstatus/utils':
specifier: workspace:*
version: link:../../packages/utils
+ '@radix-ui/react-checkbox':
+ specifier: 1.3.2
'@radix-ui/react-dialog':
specifier: 1.1.14
@@ -561,6 +567,9 @@ importers:
specifier: 4.1.13
version: 4.1.13
devDependencies:
+ '@openstatus/locales':
+ specifier: workspace:*
+ version: link:../../packages/locales
'@openstatus/tsconfig':
specifier: workspace:*
version: link:../../packages/tsconfig
@@ -2027,6 +2036,9 @@ importers:
'@openstatus/emails':
specifier: workspace:*
version: link:../emails
+ '@openstatus/notification-base':
+ specifier: workspace:*
+ version: link:../notifications/base
'@openstatus/utils':
specifier: workspace:*
version: link:../utils