Skip to content

Open-source status page, incident response and uptime monitoring

Add custom theme support for status pages (#2354)

Maximilian Kaskee5e3848e3ef9
diff --git a/apps/dashboard/src/components/forms/status-page/form-custom-theme.tsx b/apps/dashboard/src/components/forms/status-page/form-custom-theme.tsx
new file mode 100644
index 000000000..dab6f3ce8
--- /dev/null
+++ b/apps/dashboard/src/components/forms/status-page/form-custom-theme.tsx
@@ -0,0 +1,216 @@
+import { zodResolver } from "@hookform/resolvers/zod";
+import {
+ type CustomTheme,
+ formatThemeVars,
+ generateThemeVarsTemplate,
+ parseThemeVarsText,
+ THEMES,
+ type ThemeMode,
+} from "@openstatus/theme-store";
+import { Button } from "@openstatus/ui/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormMessage,
+} from "@openstatus/ui/components/ui/form";
+import {
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+} from "@openstatus/ui/components/ui/tabs";
+import { Textarea } from "@openstatus/ui/components/ui/textarea";
+import { cn } from "@openstatus/ui/lib/utils";
+import { isTRPCClientError } from "@trpc/client";
+import { ChevronsDownUp, ChevronsUpDown, Lock } from "lucide-react";
+import { useState, useTransition } from "react";
+import { useForm } from "react-hook-form";
+import { toast } from "sonner";
+import { z } from "zod";
+
+import { Link } from "@/components/common/link";
+import {
+ FormCard,
+ FormCardContent,
+ FormCardDescription,
+ FormCardFooter,
+ FormCardFooterInfo,
+ FormCardHeader,
+ FormCardSeparator,
+ FormCardTitle,
+ FormCardUpgrade,
+} from "@/components/forms/form-card";
+
+const MODES = ["light", "dark"] as const;
+
+const modeText = z.string().superRefine((value, ctx) => {
+ for (const message of parseThemeVarsText(value).errors) {
+ ctx.addIssue({ code: "custom", message });
+ }
+});
+
+const schema = z.object({ light: modeText, dark: modeText });
+
+type FormValues = z.infer<typeof schema>;
+
+export function FormCustomTheme({
+ defaultValue,
+ onSubmit,
+ locked,
+ themeKey,
+}: {
+ defaultValue?: CustomTheme | null;
+ onSubmit: (values: { customTheme: CustomTheme }) => Promise<void>;
+ locked?: boolean;
+ themeKey?: string;
+}) {
+ const theme = THEMES[themeKey ?? "default"] ?? THEMES.default;
+ const [mode, setMode] = useState<ThemeMode>("light");
+ const [extended, setExtended] = useState(false);
+ const [isPending, startTransition] = useTransition();
+ const form = useForm<FormValues>({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ light: formatThemeVars(defaultValue?.light),
+ dark: formatThemeVars(defaultValue?.dark),
+ },
+ });
+
+ function submitAction(values: FormValues) {
+ if (isPending) return;
+
+ startTransition(async () => {
+ try {
+ const promise = onSubmit({
+ customTheme: {
+ light: parseThemeVarsText(values.light).vars,
+ dark: parseThemeVarsText(values.dark).vars,
+ },
+ });
+ 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
+ onSubmit={form.handleSubmit(submitAction, (errors) => {
+ // jump to the first tab with a validation error
+ const errored = MODES.find((m) => errors[m]);
+ if (errored) setMode(errored);
+ })}
+ >
+ <FormCard>
+ {locked ? <FormCardUpgrade /> : null}
+ <FormCardHeader>
+ <FormCardTitle>Custom Theme</FormCardTitle>
+ <FormCardDescription>
+ Override the selected theme&apos;s CSS variables with your own
+ values for light and dark mode.
+ </FormCardDescription>
+ </FormCardHeader>
+ <FormCardSeparator />
+ <FormCardContent>
+ <Tabs value={mode} onValueChange={(v) => setMode(v as ThemeMode)}>
+ <div className="flex items-center justify-between">
+ <TabsList>
+ <TabsTrigger value="light">Light</TabsTrigger>
+ <TabsTrigger value="dark">Dark</TabsTrigger>
+ </TabsList>
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ onClick={() => setExtended((v) => !v)}
+ >
+ {extended ? (
+ <ChevronsDownUp className="size-4" />
+ ) : (
+ <ChevronsUpDown className="size-4" />
+ )}
+ {extended ? "Collapse" : "Extend"}
+ </Button>
+ </div>
+ {MODES.map((m) => (
+ <TabsContent key={m} value={m}>
+ <FormField
+ control={form.control}
+ name={m}
+ render={({ field }) => (
+ <FormItem>
+ <FormControl>
+ <Textarea
+ placeholder={generateThemeVarsTemplate(theme, m)}
+ className={cn(
+ // no ligatures — Geist Mono merges "--" into a
+ // single long-dash glyph
+ "min-h-60 font-mono text-sm [font-variant-ligatures:none]",
+ // fixed sizing while collapsed — sizing the empty
+ // textarea from the placeholder (field-sizing:
+ // content) misplaces the caret
+ !extended && "field-sizing-fixed h-60",
+ )}
+ {...field}
+ />
+ </FormControl>
+ <FormDescription>
+ One declaration per line, e.g.{" "}
+ <code className="[font-variant-ligatures:none]">
+ --primary: oklch(0.6 0.1 250);
+ </code>
+ . Leave empty to fall back to the theme.
+ </FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </TabsContent>
+ ))}
+ </Tabs>
+ </FormCardContent>
+ <FormCardFooter>
+ <FormCardFooterInfo>
+ Check out the supported CSS variables in the{" "}
+ <Link
+ href="https://www.openstatus.dev/docs/reference/status-page#custom-theme"
+ rel="noreferrer"
+ target="_blank"
+ >
+ Status Page Reference
+ </Link>
+ .
+ </FormCardFooterInfo>
+ {locked ? (
+ <Button type="button" asChild>
+ <Link href="/settings/billing">
+ <Lock className="size-4" />
+ Upgrade
+ </Link>
+ </Button>
+ ) : (
+ <Button type="submit" disabled={isPending}>
+ {isPending ? "Submitting..." : "Submit"}
+ </Button>
+ )}
+ </FormCardFooter>
+ </FormCard>
+ </form>
+ </Form>
+ );
+}
diff --git a/apps/dashboard/src/components/forms/status-page/update.tsx b/apps/dashboard/src/components/forms/status-page/update.tsx
index 665c64862..c29dc4c3e 100644
--- a/apps/dashboard/src/components/forms/status-page/update.tsx
+++ b/apps/dashboard/src/components/forms/status-page/update.tsx
@@ -10,6 +10,7 @@ import { useTRPC } from "@/lib/trpc/client";
import { FormAppearance } from "./form-appearance";
import { FormCustomDomain } from "./form-custom-domain";
+import { FormCustomTheme } from "./form-custom-theme";
import { FormDangerZone } from "./form-danger-zone";
import { FormGeneral } from "./form-general";
import { FormLinks } from "./form-links";
@@ -72,6 +73,12 @@ export function FormStatusPageUpdate() {
}),
);
+ const updateCustomThemeMutation = useMutation(
+ trpc.page.updateCustomTheme.mutationOptions({
+ onSuccess: () => refetch(),
+ }),
+ );
+
const updateLinksMutation = useMutation(
trpc.page.updateLinks.mutationOptions({
onSuccess: () => refetch(),
@@ -159,6 +166,17 @@ export function FormStatusPageUpdate() {
});
}}
/>
+ <FormCustomTheme
+ locked={workspace.limits["custom-theme"] === false}
+ themeKey={statusPage.configuration?.theme ?? "default"}
+ defaultValue={statusPage.customTheme}
+ onSubmit={async (values) => {
+ await updateCustomThemeMutation.mutateAsync({
+ id: Number.parseInt(id),
+ customTheme: values.customTheme,
+ });
+ }}
+ />
<FormLocale
locked={workspace.limits.i18n === false}
defaultValues={{
diff --git a/apps/dashboard/src/data/plans.ts b/apps/dashboard/src/data/plans.ts
index 0e1bcc6fe..06adcf0cc 100644
--- a/apps/dashboard/src/data/plans.ts
+++ b/apps/dashboard/src/data/plans.ts
@@ -56,6 +56,10 @@ export const config: Record<
value: "white-label",
label: "White Label",
},
+ {
+ value: "custom-theme",
+ label: "Custom Theme",
+ },
],
},
"status-page-audience": {
diff --git a/apps/status-page/src/app/(status-page)/[domain]/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/layout.tsx
index 5dbcf2932..626a3ad4b 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/layout.tsx
@@ -1,5 +1,5 @@
import { pageConfigurationSchema } from "@openstatus/db/src/schema";
-import { generateThemeStyles } from "@openstatus/theme-store";
+import { generatePageStyles } from "@openstatus/theme-store";
import { Toaster } from "@openstatus/ui/components/ui/sonner";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
@@ -45,9 +45,14 @@ export default async function Layout({
<HydrateClient>
<style
id="theme-styles"
+ // custom theme vars (already plan-gated + validated server-side) are
+ // merged over the selected theme: custom-theme > theme
// oxlint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
- __html: generateThemeStyles(cfg.theme),
+ __html: generatePageStyles({
+ themeKey: cfg.theme,
+ customTheme: page.customTheme,
+ }),
}}
/>
<ThemeProvider
@@ -62,6 +67,7 @@ export default async function Layout({
defaultShowUptime={cfg.uptime}
defaultNumberOfDays={cfg.days}
defaultCommunityTheme={cfg.theme}
+ customTheme={page.customTheme}
>
{children}
<FloatingButton
diff --git a/apps/status-page/src/components/status-page/floating-button.tsx b/apps/status-page/src/components/status-page/floating-button.tsx
index c538dd269..01e0d8074 100644
--- a/apps/status-page/src/components/status-page/floating-button.tsx
+++ b/apps/status-page/src/components/status-page/floating-button.tsx
@@ -1,10 +1,13 @@
"use client";
import {
+ type CustomTheme,
THEMES,
THEME_KEYS,
type ThemeDefinition,
generateThemeStyles,
+ hasCustomTheme,
+ sanitizeCustomTheme,
} from "@openstatus/theme-store";
import { Button } from "@openstatus/ui/components/ui/button";
import {
@@ -84,6 +87,7 @@ export function StatusPageProvider({
defaultShowUptime = true,
defaultNumberOfDays = 45,
defaultCommunityTheme = "default",
+ customTheme,
}: {
children: React.ReactNode;
defaultCardType?: CardType;
@@ -91,6 +95,7 @@ export function StatusPageProvider({
defaultShowUptime?: boolean;
defaultNumberOfDays?: NumberOfDays;
defaultCommunityTheme?: CommunityTheme;
+ customTheme?: CustomTheme | null;
}) {
const [cardType, setCardType] = useState<CardType>(defaultCardType);
const [barType, setBarType] = useState<BarType>(defaultBarType);
@@ -108,9 +113,16 @@ export function StatusPageProvider({
useEffect(() => {
if (isMounted) {
- recomputeStyles(communityTheme);
+ // keep the page's custom vars applied — without them this rewrite
+ // clobbers the server-rendered overrides on hydration
+ recomputeStyles(
+ communityTheme,
+ hasCustomTheme(customTheme)
+ ? sanitizeCustomTheme(customTheme)
+ : undefined,
+ );
}
- }, [communityTheme, isMounted]);
+ }, [communityTheme, isMounted, customTheme]);
return (
<StatusPageContext.Provider
diff --git a/apps/web/public/assets/changelog/status-page-custom-theme.png b/apps/web/public/assets/changelog/status-page-custom-theme.png
new file mode 100644
index 000000000..f0195408d
Binary files /dev/null and b/apps/web/public/assets/changelog/status-page-custom-theme.png differ
diff --git a/apps/web/src/content/pages/changelog/status-page-custom-theme.mdx b/apps/web/src/content/pages/changelog/status-page-custom-theme.mdx
new file mode 100644
index 000000000..2de71c545
--- /dev/null
+++ b/apps/web/src/content/pages/changelog/status-page-custom-theme.mdx
@@ -0,0 +1,16 @@
+---
+title: "Custom theme for status pages"
+description: "Override your status page theme's CSS variables with your own values for light and dark mode."
+publishedAt: "2026-07-08"
+image: "/assets/changelog/status-page-custom-theme.png"
+category: "statuspage"
+author: "openstatus"
+---
+
+Your status page can now go beyond the built-in themes. With the new **Custom Theme** editor, you override individual CSS variables of the selected theme with your own values - separately for **light and dark mode**.
+
+Pick any theme as your base, then adjust exactly what you need: one `--name: value;` declaration per line, e.g. `--primary: oklch(0.6 0.1 250);`. Every variable you leave unset falls back to the theme's value, so you can change a single color or restyle the entire page.
+
+The editor lives in the status page configuration and comes pre-filled with your current theme's values as a template. Use **Extend** to open the full list of supported variables - background, foreground, card, status colors, radius, and more.
+
+Custom themes are available on the **Pro and Scale plans**. Check out the supported CSS variables in the [Status Page Reference](https://www.openstatus.dev/docs/reference/status-page/#custom-theme).
diff --git a/apps/web/src/content/pages/docs/reference/status-page.mdx b/apps/web/src/content/pages/docs/reference/status-page.mdx
index bddb8c1b9..5b42b8ccd 100644
--- a/apps/web/src/content/pages/docs/reference/status-page.mdx
+++ b/apps/web/src/content/pages/docs/reference/status-page.mdx
@@ -79,6 +79,75 @@ Visitors from outside the allowed ranges are redirected to a static "Access Rest
Allows you to upload a custom favicon that will appear in browser tabs and bookmarks for your status page. SVG files are sanitized server-side and must be under 100KB.
+### Theme
+
+**Type:** Enum (optional, defaults to `default`)
+
+Selects one of the community themes for your status page. Browse and preview them in the [Theme Explorer](https://themes.openstatus.dev), or [contribute your own](/docs/guides/how-to-create-status-page-theme).
+
+### Custom theme
+
+**Type:** Per-mode CSS variable overrides (Pro and Scale plans)
+
+Overrides individual CSS variables of the selected theme, separately for light and dark mode. Custom values take precedence over the theme; every variable you leave unset falls back to the theme's value.
+
+**Configuration:** in the dashboard, the editor provides a *Light* and a *Dark* tab. Each accepts one declaration per line:
+
+```css
+--primary: oklch(0.6 0.1 250);
+--radius: 0.5rem;
+```
+
+Values accept any valid CSS value (colors in `oklch`, `hsl`, hex, lengths, etc.). The characters `<`, `{`, `}` and `;` are not allowed inside a value.
+
+#### Supported CSS variables
+
+**Base** — the [shadcn/ui](https://ui.shadcn.com/docs/theming) color tokens used across the page:
+
+| Variable | Description |
+|---|---|
+| `--radius` | Corner radius of cards, buttons and inputs (e.g. `0.625rem`) |
+| `--background` | Page background |
+| `--foreground` | Default text color |
+| `--card` | Card background |
+| `--card-foreground` | Card text color |
+| `--popover` | Popover/dropdown background |
+| `--popover-foreground` | Popover/dropdown text color |
+| `--primary` | Primary buttons and accents |
+| `--primary-foreground` | Text on primary elements |
+| `--secondary` | Secondary buttons and surfaces |
+| `--secondary-foreground` | Text on secondary elements |
+| `--muted` | Muted surfaces |
+| `--muted-foreground` | Muted/secondary text |
+| `--accent` | Hover and highlight surfaces |
+| `--accent-foreground` | Text on accent surfaces |
+| `--border` | Border color |
+| `--input` | Input border color |
+| `--ring` | Focus ring color |
+
+**Status colors** — used for component and system status indicators:
+
+| Variable | Description |
+|---|---|
+| `--success` | Operational status (green) |
+| `--warning` | Degraded status (yellow) |
+| `--info` | Monitoring/maintenance status (blue) |
+| `--destructive` | Outage/error status (red) |
+
+**Charts** — differentiate the response-time percentiles on the public monitor charts:
+
+| Variable | Description |
+|---|---|
+| `--chart-1` | First percentile series |
+| `--chart-2` | Second percentile series |
+| `--chart-3` | Third percentile series |
+| `--chart-4` | Fourth percentile series |
+| `--chart-5` | Fifth percentile series |
+
+**Regions** — differentiate the monitoring regions on the public monitor charts. Optional; the defaults cover all regions:
+
+`--rainbow-1`, `--rainbow-2`, `--rainbow-3`, `--rainbow-4`, `--rainbow-5`, `--rainbow-6`, `--rainbow-7`, `--rainbow-8`, `--rainbow-9`, `--rainbow-10`, `--rainbow-11`, `--rainbow-12`, `--rainbow-13`, `--rainbow-14`, `--rainbow-15`, `--rainbow-16`, `--rainbow-17`
+
### JSON feed
**Type:** Read-only endpoint
diff --git a/apps/web/src/content/pages/unrelated/pricing.mdx b/apps/web/src/content/pages/unrelated/pricing.mdx
index ab1c18903..dcf4582df 100644
--- a/apps/web/src/content/pages/unrelated/pricing.mdx
+++ b/apps/web/src/content/pages/unrelated/pricing.mdx
@@ -42,6 +42,7 @@ faq:
| Toggle numbers visibility | + | + | + |
| Subscribers | + | + | + |
| Custom domain | + | + | + |
+| Custom theme | | + | + |
| Locale switcher | + | + | + |
| Slack Agent | + | + | + |
| White Label | $300/mo. | $300/mo. | + |
diff --git a/deno.lock b/deno.lock
index 89e71aa78..0fb0ec689 100644
--- a/deno.lock
+++ b/deno.lock
@@ -54,240 +54,6 @@
"dependencies": [
]
- },
- "members": {
- "apps/server": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "apps/status-page": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "apps/web": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/ai": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/api": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/db": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/emails": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/header-analysis": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/importers": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/base": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/bird-whatsapp": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/discord": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/google-chat": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/grafana-oncall": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/ms-teams": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/ntfy": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/opsgenie": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/pagerduty": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/slack": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/telegram": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/twillio-sms": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/notifications/webhook": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/services": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/status-fetcher": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/subscriptions": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/test-utils": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/tinybird": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/tracker": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- },
- "packages/utils": {
- "packageJson": {
- "dependencies": [
- "npm:@jsr/std__expect@^1.0.19",
- "npm:@jsr/std__testing@^1.0.19"
- ]
- }
- }
}
}
}
diff --git a/packages/api/src/router/page.ts b/packages/api/src/router/page.ts
index 1ad64dcc6..9dff33a8c 100644
--- a/packages/api/src/router/page.ts
+++ b/packages/api/src/router/page.ts
@@ -9,6 +9,7 @@ import {
CreatePageInput as CreatePageInputSchema,
UpdatePageAppearanceInput,
UpdatePageConfigurationInput,
+ UpdatePageCustomThemeInput,
UpdatePageCustomDomainInput,
createPage,
deletePage,
@@ -20,6 +21,7 @@ import {
pageAccessTypes,
updatePageAppearance,
updatePageConfiguration,
+ updatePageCustomTheme,
updatePageCustomDomain,
updatePageGeneral,
updatePageLinks,
@@ -348,6 +350,20 @@ export const pageRouter = createTRPCRouter({
}
}),
+ updateCustomTheme: protectedProcedure
+ .meta({ track: Events.UpdatePage })
+ .input(UpdatePageCustomThemeInput)
+ .mutation(async ({ ctx, input }) => {
+ try {
+ await updatePageCustomTheme({
+ ctx: toServiceCtx(ctx),
+ input,
+ });
+ } catch (err) {
+ toTRPCError(err);
+ }
+ }),
+
updateLinks: protectedProcedure
.meta({ track: Events.UpdatePage })
.input(
diff --git a/packages/api/src/router/statusPage.ts b/packages/api/src/router/statusPage.ts
index 45bbf0b11..74e9963db 100644
--- a/packages/api/src/router/statusPage.ts
+++ b/packages/api/src/router/statusPage.ts
@@ -389,6 +389,10 @@ export const statusPageRouter = createTRPCRouter({
.sort((a, b) => a.order - b.order);
const whiteLabel = ws.data?.limits["white-label"] ?? false;
+ // stored custom theme stops applying when the plan no longer includes it
+ const customTheme = ws.data?.limits["custom-theme"]
+ ? _page.customTheme
+ : null;
const statusReports = _page.statusReports.sort((a, b) => {
// Sort reports without updates to the beginning
@@ -425,6 +429,7 @@ export const statusPageRouter = createTRPCRouter({
return selectPublicPageSchemaWithRelation.parse({
..._page,
+ customTheme,
monitors,
monitorGroups,
trackers,
@@ -507,9 +512,14 @@ export const statusPageRouter = createTRPCRouter({
const ws = selectWorkspaceSchema.safeParse(_page.workspace);
const whiteLabel = ws.data?.limits["white-label"] ?? false;
+ // stored custom theme stops applying when the plan no longer includes it
+ const customTheme = ws.data?.limits["custom-theme"]
+ ? _page.customTheme
+ : null;
return selectPublicPageLightSchemaWithRelation.parse({
..._page,
+ customTheme,
monitors,
incidents,
statusReports: _page.statusReports,
diff --git a/packages/db/drizzle/0079_fixed_spencer_smythe.sql b/packages/db/drizzle/0079_fixed_spencer_smythe.sql
new file mode 100644
index 000000000..3de848bbd
--- /dev/null
+++ b/packages/db/drizzle/0079_fixed_spencer_smythe.sql
@@ -0,0 +1 @@
+ALTER TABLE `page` ADD `custom_theme` text;
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0079_snapshot.json b/packages/db/drizzle/meta/0079_snapshot.json
new file mode 100644
index 000000000..8e891fe28
--- /dev/null
+++ b/packages/db/drizzle/meta/0079_snapshot.json
@@ -0,0 +1,4719 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "c98a9824-888c-4b13-9731-b1932b03b717",
+ "prevId": "80571dfe-ab0e-4531-823b-33173cedf9a2",
+ "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": {
+ "users_to_workspaces_workspace_id_idx": {
+ "name": "users_to_workspaces_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "status_report_workspace_created_idx": {
+ "name": "status_report_workspace_created_idx",
+ "columns": [
+ "workspace_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "status_report_page_id_idx": {
+ "name": "status_report_page_id_idx",
+ "columns": [
+ "page_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "status_report_update_status_report_id_idx": {
+ "name": "status_report_update_status_report_id_idx",
+ "columns": [
+ "status_report_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "integration_workspace_id_idx": {
+ "name": "integration_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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'"
+ },
+ "custom_theme": {
+ "name": "custom_theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "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
+ },
+ "page_lower_slug_idx": {
+ "name": "page_lower_slug_idx",
+ "columns": [
+ "LOWER(\"slug\")"
+ ],
+ "isUnique": false
+ },
+ "page_lower_custom_domain_idx": {
+ "name": "page_lower_custom_domain_idx",
+ "columns": [
+ "LOWER(\"custom_domain\")"
+ ],
+ "isUnique": false
+ },
+ "page_workspace_id_idx": {
+ "name": "page_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "monitor_workspace_id_active_idx": {
+ "name": "monitor_workspace_id_active_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false,
+ "where": "\"monitor\".\"deleted_at\" IS NULL"
+ }
+ },
+ "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
+ },
+ "slack_channel_id": {
+ "name": "slack_channel_id",
+ "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'"
+ },
+ "idx_page_subscriber_slack_channel_page_active": {
+ "name": "idx_page_subscriber_slack_channel_page_active",
+ "columns": [
+ "slack_channel_id",
+ "page_id"
+ ],
+ "isUnique": true,
+ "where": "\"page_subscriber\".\"unsubscribed_at\" IS NULL AND \"page_subscriber\".\"channel_type\" = 'slack'"
+ }
+ },
+ "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) OR (\"page_subscriber\".\"channel_type\" = 'slack' AND \"page_subscriber\".\"slack_channel_id\" IS NOT NULL AND \"page_subscriber\".\"email\" IS NULL AND \"page_subscriber\".\"webhook_url\" 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": {
+ "notification_workspace_id_idx": {
+ "name": "notification_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "notifications_to_monitors_notification_id_idx": {
+ "name": "notifications_to_monitors_notification_id_idx",
+ "columns": [
+ "notification_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "invitation_workspace_id_idx": {
+ "name": "invitation_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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_workspace_id_idx": {
+ "name": "incident_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "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": {
+ "monitor_tag_workspace_id_idx": {
+ "name": "monitor_tag_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "monitor_tag_to_monitor_monitor_tag_id_idx": {
+ "name": "monitor_tag_to_monitor_monitor_tag_id_idx",
+ "columns": [
+ "monitor_tag_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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
+ },
+ "application_workspace_id_idx": {
+ "name": "application_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "maintenance_page_id_idx": {
+ "name": "maintenance_page_id_idx",
+ "columns": [
+ "page_id"
+ ],
+ "isUnique": false
+ },
+ "maintenance_workspace_id_idx": {
+ "name": "maintenance_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "check_workspace_id_idx": {
+ "name": "check_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "monitor_run_workspace_id_idx": {
+ "name": "monitor_run_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "monitor_run_monitor_id_idx": {
+ "name": "monitor_run_monitor_id_idx",
+ "columns": [
+ "monitor_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "private_location_workspace_id_idx": {
+ "name": "private_location_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "private_location_to_monitor_private_location_id_idx": {
+ "name": "private_location_to_monitor_private_location_id_idx",
+ "columns": [
+ "private_location_id"
+ ],
+ "isUnique": false
+ },
+ "private_location_to_monitor_monitor_id_idx": {
+ "name": "private_location_to_monitor_monitor_id_idx",
+ "columns": [
+ "monitor_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "monitor_group_workspace_id_idx": {
+ "name": "monitor_group_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "monitor_group_page_id_idx": {
+ "name": "monitor_group_page_id_idx",
+ "columns": [
+ "page_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[\"write\"]'"
+ },
+ "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
+ },
+ "api_key_workspace_id_idx": {
+ "name": "api_key_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "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": {
+ "maintenance_to_page_component_page_component_id_idx": {
+ "name": "maintenance_to_page_component_page_component_id_idx",
+ "columns": [
+ "page_component_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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_workspace_id_idx": {
+ "name": "page_component_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "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_update_to_page_component": {
+ "name": "status_report_update_to_page_component",
+ "columns": {
+ "status_report_update_id": {
+ "name": "status_report_update_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_component_id": {
+ "name": "page_component_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "impact": {
+ "name": "impact",
+ "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'))"
+ }
+ },
+ "indexes": {
+ "status_report_update_to_page_component_page_component_id_idx": {
+ "name": "status_report_update_to_page_component_page_component_id_idx",
+ "columns": [
+ "page_component_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "status_report_update_to_page_component_status_report_update_id_status_report_update_id_fk": {
+ "name": "status_report_update_to_page_component_status_report_update_id_status_report_update_id_fk",
+ "tableFrom": "status_report_update_to_page_component",
+ "tableTo": "status_report_update",
+ "columnsFrom": [
+ "status_report_update_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "status_report_update_to_page_component_page_component_id_page_component_id_fk": {
+ "name": "status_report_update_to_page_component_page_component_id_page_component_id_fk",
+ "tableFrom": "status_report_update_to_page_component",
+ "tableTo": "page_component",
+ "columnsFrom": [
+ "page_component_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "status_report_update_to_page_component_status_report_update_id_page_component_id_pk": {
+ "columns": [
+ "status_report_update_id",
+ "page_component_id"
+ ],
+ "name": "status_report_update_to_page_component_status_report_update_id_page_component_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "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": {
+ "status_report_to_page_component_page_component_id_idx": {
+ "name": "status_report_to_page_component_page_component_id_idx",
+ "columns": [
+ "page_component_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "page_component_groups_page_id_idx": {
+ "name": "page_component_groups_page_id_idx",
+ "columns": [
+ "page_id"
+ ],
+ "isUnique": false
+ },
+ "page_component_groups_workspace_id_idx": {
+ "name": "page_component_groups_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {
+ "feedback_workspace_id_idx": {
+ "name": "feedback_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "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": {}
+ },
+ "audit_log": {
+ "name": "audit_log",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "before": {
+ "name": "before",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "after": {
+ "name": "after",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "changed_fields": {
+ "name": "changed_fields",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "audit_log_workspace_created_idx": {
+ "name": "audit_log_workspace_created_idx",
+ "columns": [
+ "workspace_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "audit_log_entity_idx": {
+ "name": "audit_log_entity_idx",
+ "columns": [
+ "workspace_id",
+ "entity_type",
+ "entity_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "external_service": {
+ "name": "external_service",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "aliases": {
+ "name": "aliases",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(json_array())"
+ },
+ "name": {
+ "name": "name",
+ "type": "text(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status_page_url": {
+ "name": "status_page_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "industry": {
+ "name": "industry",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "api_config": {
+ "name": "api_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "deleted_at": {
+ "name": "deleted_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": {
+ "external_service_slug_unique": {
+ "name": "external_service_slug_unique",
+ "columns": [
+ "slug"
+ ],
+ "isUnique": true
+ },
+ "external_service_deleted_at_idx": {
+ "name": "external_service_deleted_at_idx",
+ "columns": [
+ "deleted_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "external_service_component": {
+ "name": "external_service_component",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "external_service_id": {
+ "name": "external_service_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "upstream_component_id": {
+ "name": "upstream_component_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "aliases": {
+ "name": "aliases",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(json_array())"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "group_name": {
+ "name": "group_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "indicator": {
+ "name": "indicator",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "external_service_component_unique_idx": {
+ "name": "external_service_component_unique_idx",
+ "columns": [
+ "external_service_id",
+ "upstream_component_id"
+ ],
+ "isUnique": true
+ },
+ "external_service_component_slug_unique_idx": {
+ "name": "external_service_component_slug_unique_idx",
+ "columns": [
+ "external_service_id",
+ "slug"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "external_service_component_external_service_id_external_service_id_fk": {
+ "name": "external_service_component_external_service_id_external_service_id_fk",
+ "tableFrom": "external_service_component",
+ "tableTo": "external_service",
+ "columnsFrom": [
+ "external_service_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "external_service_incident": {
+ "name": "external_service_incident",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "external_service_id": {
+ "name": "external_service_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_incident_id": {
+ "name": "provider_incident_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "impact": {
+ "name": "impact",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "shortlink": {
+ "name": "shortlink",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "affected_component_ids": {
+ "name": "affected_component_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "raw_payload": {
+ "name": "raw_payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "raw_payload_purged_at": {
+ "name": "raw_payload_purged_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "external_service_incident_unique_idx": {
+ "name": "external_service_incident_unique_idx",
+ "columns": [
+ "external_service_id",
+ "provider_incident_id"
+ ],
+ "isUnique": true
+ },
+ "external_service_incident_started_at_idx": {
+ "name": "external_service_incident_started_at_idx",
+ "columns": [
+ "external_service_id",
+ "started_at"
+ ],
+ "isUnique": false
+ },
+ "external_service_incident_resolved_at_idx": {
+ "name": "external_service_incident_resolved_at_idx",
+ "columns": [
+ "resolved_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "external_service_incident_external_service_id_external_service_id_fk": {
+ "name": "external_service_incident_external_service_id_external_service_id_fk",
+ "tableFrom": "external_service_incident",
+ "tableTo": "external_service",
+ "columnsFrom": [
+ "external_service_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "external_service_report": {
+ "name": "external_service_report",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "external_service_id": {
+ "name": "external_service_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "external_service_component_id": {
+ "name": "external_service_component_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reporter_hash": {
+ "name": "reporter_hash",
+ "type": "text(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "country": {
+ "name": "country",
+ "type": "text(2)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%s', 'now'))"
+ }
+ },
+ "indexes": {
+ "external_service_report_service_idx": {
+ "name": "external_service_report_service_idx",
+ "columns": [
+ "external_service_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "external_service_report_component_idx": {
+ "name": "external_service_report_component_idx",
+ "columns": [
+ "external_service_component_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "external_service_report_external_service_id_external_service_id_fk": {
+ "name": "external_service_report_external_service_id_external_service_id_fk",
+ "tableFrom": "external_service_report",
+ "tableTo": "external_service",
+ "columnsFrom": [
+ "external_service_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "external_service_report_external_service_component_id_external_service_component_id_fk": {
+ "name": "external_service_report_external_service_component_id_external_service_component_id_fk",
+ "tableFrom": "external_service_report",
+ "tableTo": "external_service_component",
+ "columnsFrom": [
+ "external_service_component_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "chat_session": {
+ "name": "chat_session",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "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
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "messages": {
+ "name": "messages",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "chat_session_workspace_user_updated_idx": {
+ "name": "chat_session_workspace_user_updated_idx",
+ "columns": [
+ "workspace_id",
+ "user_id",
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "chat_session_workspace_id_workspace_id_fk": {
+ "name": "chat_session_workspace_id_workspace_id_fk",
+ "tableFrom": "chat_session",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_session_user_id_user_id_fk": {
+ "name": "chat_session_user_id_user_id_fk",
+ "tableFrom": "chat_session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "frozen_monitor_uptime": {
+ "name": "frozen_monitor_uptime",
+ "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
+ },
+ "monitor_id": {
+ "name": "monitor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "month": {
+ "name": "month",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "days": {
+ "name": "days",
+ "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'))"
+ }
+ },
+ "indexes": {
+ "frozen_monitor_uptime_workspace_id_idx": {
+ "name": "frozen_monitor_uptime_workspace_id_idx",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "frozen_monitor_uptime_monitor_id_month_unique": {
+ "name": "frozen_monitor_uptime_monitor_id_month_unique",
+ "columns": [
+ "monitor_id",
+ "month"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "frozen_monitor_uptime_workspace_id_workspace_id_fk": {
+ "name": "frozen_monitor_uptime_workspace_id_workspace_id_fk",
+ "tableFrom": "frozen_monitor_uptime",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "frozen_monitor_uptime_monitor_id_monitor_id_fk": {
+ "name": "frozen_monitor_uptime_monitor_id_monitor_id_fk",
+ "tableFrom": "frozen_monitor_uptime",
+ "tableTo": "monitor",
+ "columnsFrom": [
+ "monitor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {
+ "page_lower_slug_idx": {
+ "columns": {
+ "LOWER(\"slug\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "page_lower_custom_domain_idx": {
+ "columns": {
+ "LOWER(\"custom_domain\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "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 393d75df1..2beaab523 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -554,6 +554,13 @@
"when": 1782994900937,
"tag": "0078_yellow_thor_girl",
"breakpoints": true
+ },
+ {
+ "idx": 79,
+ "version": "6",
+ "when": 1783447957125,
+ "tag": "0079_fixed_spencer_smythe",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/pages/page.ts b/packages/db/src/schema/pages/page.ts
index 5f6e753a6..50f34cb9d 100644
--- a/packages/db/src/schema/pages/page.ts
+++ b/packages/db/src/schema/pages/page.ts
@@ -1,4 +1,5 @@
import type { Locale } from "@openstatus/locales";
+import type { CustomTheme } from "@openstatus/theme-store";
import { relations, sql } from "drizzle-orm";
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
@@ -30,6 +31,10 @@ export const page = sqliteTable(
.notNull()
.default("system"),
+ // Per-mode CSS variable overrides ({ light, dark }) merged over the
+ // configured theme vars. Gated by the "custom-theme" plan limit.
+ customTheme: text("custom_theme", { mode: "json" }).$type<CustomTheme>(),
+
// Password protecting the status page - no specific restriction on password
password: text("password", { length: 256 }),
// @deprecated: instead, use accessType
diff --git a/packages/db/src/schema/pages/validation.ts b/packages/db/src/schema/pages/validation.ts
index ff778e4a0..765bca7bb 100644
--- a/packages/db/src/schema/pages/validation.ts
+++ b/packages/db/src/schema/pages/validation.ts
@@ -112,8 +112,18 @@ export const pageConfigurationSchema = z.object({
});
export type PageConfiguration = z.infer<typeof pageConfigurationSchema>;
+// Loose { light, dark } var maps — write paths enforce the supported var
+// names / safe values; `.catch(null)` degrades corrupt stored json to "no
+// overrides" instead of tanking every page read.
+const themeVarsSchema = z.record(z.string(), z.string());
+export const customThemeSchema = z.object({
+ light: themeVarsSchema.optional(),
+ dark: themeVarsSchema.optional(),
+});
+
export const selectPageSchema = createSelectSchema(page).extend({
password: z.string().optional().nullable().prefault(""),
+ customTheme: customThemeSchema.nullish().catch(null),
configuration: pageConfigurationSchema.nullish().prefault({}),
accessType: z.enum(pageAccessTypes).prefault("public"),
authEmailDomains: stringToArray.prefault([]),
diff --git a/packages/db/src/schema/plan/config.ts b/packages/db/src/schema/plan/config.ts
index f7a3f33ff..58b8cebb0 100644
--- a/packages/db/src/schema/plan/config.ts
+++ b/packages/db/src/schema/plan/config.ts
@@ -53,6 +53,7 @@ export const allPlans: Record<WorkspacePlan, PlanConfig> = {
"ip-restriction": false,
"white-label": false,
"no-index": false,
+ "custom-theme": false,
notifications: true,
sms: false,
"sms-limit": 0,
@@ -137,6 +138,7 @@ export const allPlans: Record<WorkspacePlan, PlanConfig> = {
"ip-restriction": false,
"white-label": false,
"no-index": true,
+ "custom-theme": false,
notifications: true,
pagerduty: true,
opsgenie: true,
@@ -221,6 +223,7 @@ export const allPlans: Record<WorkspacePlan, PlanConfig> = {
"ip-restriction": false,
"white-label": false,
"no-index": true,
+ "custom-theme": true,
notifications: true,
sms: true,
"sms-limit": 100,
@@ -278,6 +281,7 @@ export const allPlans: Record<WorkspacePlan, PlanConfig> = {
"ip-restriction": true,
"white-label": true,
"no-index": true,
+ "custom-theme": true,
notifications: true,
sms: true,
"sms-limit": 100,
diff --git a/packages/db/src/schema/plan/schema.ts b/packages/db/src/schema/plan/schema.ts
index 3a3b15700..cdb172a56 100644
--- a/packages/db/src/schema/plan/schema.ts
+++ b/packages/db/src/schema/plan/schema.ts
@@ -40,6 +40,7 @@ export const limitsSchema = z.object({
"ip-restriction": z.boolean().prefault(false), // add-on but required in limits
"white-label": z.boolean().prefault(false),
"no-index": z.boolean().prefault(false),
+ "custom-theme": z.boolean().prefault(false),
/**
* Notification limits
*/
diff --git a/packages/services/src/page/__tests__/page.test.ts b/packages/services/src/page/__tests__/page.test.ts
index fd8673dae..4cfcb98fe 100644
--- a/packages/services/src/page/__tests__/page.test.ts
+++ b/packages/services/src/page/__tests__/page.test.ts
@@ -1,5 +1,9 @@
import { db, eq } from "@openstatus/db";
-import { monitor, pageComponent } from "@openstatus/db/src/schema";
+import {
+ monitor,
+ page as pageTable,
+ pageComponent,
+} from "@openstatus/db/src/schema";
import { expect } from "@std/expect";
import { afterAll, beforeAll, describe, test } from "@std/testing/bdd";
@@ -25,7 +29,11 @@ import {
import { createPage, newPage } from "../create";
import { deletePage } from "../delete";
import { getPage, getPageBySlug, getSlugAvailable, listPages } from "../list";
-import { updatePageGeneral, updatePageLocales } from "../update";
+import {
+ updatePageCustomTheme,
+ updatePageGeneral,
+ updatePageLocales,
+} from "../update";
const TEST_PREFIX = "svc-page-test";
@@ -253,6 +261,130 @@ describe("updatePageLocales", () => {
});
});
+describe("updatePageCustomTheme", () => {
+ test("happy path stores sanitized vars + audit", async () => {
+ await withTestTransaction(async (tx) => {
+ const ctx = { ...teamCtx, db: tx };
+ const p = await newPage({
+ ctx,
+ input: { title: "Theme", slug: uniqueSlug("theme") },
+ });
+ await updatePageCustomTheme({
+ ctx,
+ input: {
+ id: p.id,
+ customTheme: {
+ light: { "--primary": " red " },
+ dark: { "--primary": "pink" },
+ },
+ },
+ });
+ const row = await tx
+ .select()
+ .from(pageTable)
+ .where(eq(pageTable.id, p.id))
+ .get();
+ expect(row?.customTheme).toEqual({
+ light: { "--primary": "red" },
+ dark: { "--primary": "pink" },
+ });
+ await expectAuditRow({
+ workspaceId: teamCtx.workspace.id,
+ action: "page.update",
+ entityType: "page",
+ entityId: p.id,
+ db: tx,
+ });
+ });
+ });
+
+ test("rejects unknown css variables", async () => {
+ await withTestTransaction(async (tx) => {
+ const ctx = { ...teamCtx, db: tx };
+ await expect(
+ updatePageCustomTheme({
+ ctx,
+ input: { id: 1, customTheme: { light: { "--nope": "red" } } },
+ }),
+ ).rejects.toThrow("Unknown CSS variable");
+ });
+ });
+
+ test("rejects values with style-tag breakout characters", async () => {
+ await withTestTransaction(async (tx) => {
+ const ctx = { ...teamCtx, db: tx };
+ await expect(
+ updatePageCustomTheme({
+ ctx,
+ input: {
+ id: 1,
+ customTheme: { light: { "--primary": "red;} </style>" } },
+ },
+ }),
+ ).rejects.toThrow("unsupported characters");
+ });
+ });
+
+ test("empty custom theme clears the column", async () => {
+ await withTestTransaction(async (tx) => {
+ const ctx = { ...teamCtx, db: tx };
+ const p = await newPage({
+ ctx,
+ input: { title: "Theme Clear", slug: uniqueSlug("theme-clear") },
+ });
+ await updatePageCustomTheme({
+ ctx,
+ input: { id: p.id, customTheme: { dark: { "--primary": "pink" } } },
+ });
+ await updatePageCustomTheme({
+ ctx,
+ input: { id: p.id, customTheme: { light: {}, dark: {} } },
+ });
+ const row = await tx
+ .select()
+ .from(pageTable)
+ .where(eq(pageTable.id, p.id))
+ .get();
+ expect(row?.customTheme).toBeNull();
+ });
+ });
+
+ test("rejects when plan lacks custom-theme", async () => {
+ await withTestTransaction(async (tx) => {
+ const ctx = { ...freeCtx, db: tx };
+ const p = await newPage({
+ ctx,
+ input: { title: "Free Theme", slug: uniqueSlug("free-theme") },
+ });
+ await expect(
+ updatePageCustomTheme({
+ ctx,
+ input: { id: p.id, customTheme: { light: { "--primary": "red" } } },
+ }),
+ ).rejects.toBeInstanceOf(LimitExceededError);
+ });
+ });
+
+ test("rejects read-only actor", async () => {
+ await withTestTransaction(async (tx) => {
+ const readOnlyCtx = {
+ ...makeApiKeyCtx(teamCtx.workspace, {
+ keyId: "k-read",
+ userId: 1,
+ scopes: ["read"],
+ }),
+ db: tx,
+ };
+ await expect(
+ updatePageCustomTheme({
+ ctx: readOnlyCtx,
+ input: { id: 1, customTheme: { light: { "--primary": "red" } } },
+ }),
+ ).rejects.toBeInstanceOf(ForbiddenError);
+ });
+ });
+});
+
describe("list / get / getSlugAvailable", () => {
test("list respects workspace isolation", async () => {
await withTestTransaction(async (tx) => {
diff --git a/packages/services/src/page/index.ts b/packages/services/src/page/index.ts
index 89600cf6d..80f971185 100644
--- a/packages/services/src/page/index.ts
+++ b/packages/services/src/page/index.ts
@@ -12,6 +12,7 @@ export {
export {
updatePageAppearance,
updatePageConfiguration,
+ updatePageCustomTheme,
updatePageCustomDomain,
updatePageGeneral,
updatePageLinks,
@@ -29,6 +30,7 @@ export {
pageAccessTypes,
UpdatePageAppearanceInput,
UpdatePageConfigurationInput,
+ UpdatePageCustomThemeInput,
UpdatePageCustomDomainInput,
UpdatePageGeneralInput,
UpdatePageLinksInput,
diff --git a/packages/services/src/page/schemas.ts b/packages/services/src/page/schemas.ts
index 67dddc6db..2fae132e8 100644
--- a/packages/services/src/page/schemas.ts
+++ b/packages/services/src/page/schemas.ts
@@ -6,7 +6,13 @@ import {
slugSchema,
} from "@openstatus/db/src/schema/pages/validation";
import { locales } from "@openstatus/locales";
-import { THEME_KEYS, type ThemeKey } from "@openstatus/theme-store";
+import {
+ hasCustomTheme,
+ sanitizeCustomTheme,
+ THEME_KEYS,
+ type ThemeKey,
+ validateCustomTheme,
+} from "@openstatus/theme-store";
import { z } from "zod";
export { pageAccessTypes };
@@ -140,6 +146,36 @@ export type UpdatePageAppearanceInput = z.infer<
typeof UpdatePageAppearanceInput
>;
+const themeVarsInput = z.record(z.string(), z.string());
+
+export const UpdatePageCustomThemeInput = z.object({
+ id: z.number().int(),
+ // Validated + sanitized at the boundary: only supported var names and
+ // values that can't break out of the inline <style> tag the status page
+ // renders them into. Empty / nullish input clears the column.
+ customTheme: z
+ .object({
+ light: themeVarsInput.optional(),
+ dark: themeVarsInput.optional(),
+ })
+ .superRefine((value, ctx) => {
+ const result = validateCustomTheme(value);
+ if (!result.valid) {
+ for (const message of result.errors) {
+ ctx.addIssue({ code: "custom", message });
+ }
+ }
+ })
+ .nullish()
+ .transform((v) => {
+ if (v == null || !hasCustomTheme(v)) return null;
+ return sanitizeCustomTheme(v);
+ }),
+});
+export type UpdatePageCustomThemeInput = z.input<
+ typeof UpdatePageCustomThemeInput
+>;
+
export const UpdatePageLinksInput = z.object({
id: z.number().int(),
homepageUrl: z.string().nullish(),
diff --git a/packages/services/src/page/update.ts b/packages/services/src/page/update.ts
index 673d4a969..5737ddfdd 100644
--- a/packages/services/src/page/update.ts
+++ b/packages/services/src/page/update.ts
@@ -13,6 +13,7 @@ import {
import {
UpdatePageAppearanceInput,
UpdatePageConfigurationInput,
+ UpdatePageCustomThemeInput,
UpdatePageCustomDomainInput,
UpdatePageGeneralInput,
UpdatePageLinksInput,
@@ -208,6 +209,42 @@ export async function updatePageAppearance(args: {
});
}
+export async function updatePageCustomTheme(args: {
+ ctx: ServiceContext;
+ input: UpdatePageCustomThemeInput;
+}): Promise<void> {
+ const { ctx } = args;
+ requireScope(ctx, "write");
+ const input = UpdatePageCustomThemeInput.parse(args.input);
+
+ if (!ctx.workspace.limits["custom-theme"]) {
+ throw new LimitExceededError("custom-theme", 0);
+ }
+
+ await withTransaction(ctx, async (tx) => {
+ const existing = await getPageInWorkspace({
+ tx,
+ id: input.id,
+ workspaceId: ctx.workspace.id,
+ });
+
+ const updated = await tx
+ .update(page)
+ .set({ customTheme: input.customTheme, updatedAt: new Date() })
+ .where(eq(page.id, existing.id))
+ .returning()
+ .get();
+
+ await emitAudit(tx, ctx, {
+ action: "page.update",
+ entityType: "page",
+ entityId: existing.id,
+ before: existing,
+ after: updated,
+ });
+ });
+}
+
export async function updatePageLinks(args: {
ctx: ServiceContext;
input: UpdatePageLinksInput;
diff --git a/packages/subscriptions/src/dispatcher.test.ts b/packages/subscriptions/src/dispatcher.test.ts
index 8888bc937..691a84af6 100644
--- a/packages/subscriptions/src/dispatcher.test.ts
+++ b/packages/subscriptions/src/dispatcher.test.ts
@@ -171,9 +171,15 @@ describe("dispatchPageUpdate - component filtering", () => {
assertSpyCalls(sendStatusReportUpdateMock, 1);
const { subscribers } = sendStatusReportUpdateMock.calls[0].args[0];
+ const emails = subscribers.map((s: { email: string }) => s.email);
- expect(subscribers).toHaveLength(1);
- expect(subscribers[0].email).toBe(EMAILS.entirePage);
+ // Assert only against this suite's own subscribers — package test suites
+ // run in parallel against the same seeded page, so an exact count over
+ // all recipients races with concurrently inserted subscribers.
+ const ownEmails = emails.filter((e: string) =>
+ Object.values(EMAILS).includes(e),
+ );
+ expect(ownEmails).toEqual([EMAILS.entirePage]);
});
test("does not notify component subscribers when update affects a different component", async () => {
diff --git a/packages/theme-store/package.json b/packages/theme-store/package.json
index ffc39d712..604a6aef8 100644
--- a/packages/theme-store/package.json
+++ b/packages/theme-store/package.json
@@ -7,11 +7,14 @@
"author": "",
"main": "src/index.ts",
"scripts": {
- "check": "deno check --sloppy-imports ."
+ "check": "deno check --sloppy-imports .",
+ "test": "deno test --parallel -A --no-check --sloppy-imports"
},
"dependencies": {},
"devDependencies": {
"@openstatus/tsconfig": "workspace:*",
+ "@std/expect": "jsr:^1.0.19",
+ "@std/testing": "jsr:^1.0.19",
"typescript": "catalog:"
}
}
diff --git a/packages/theme-store/src/__tests__/custom-theme.test.ts b/packages/theme-store/src/__tests__/custom-theme.test.ts
new file mode 100644
index 000000000..f6a255cb3
--- /dev/null
+++ b/packages/theme-store/src/__tests__/custom-theme.test.ts
@@ -0,0 +1,204 @@
+import { expect } from "@std/expect";
+import { describe, test } from "@std/testing/bdd";
+
+import {
+ CUSTOM_THEME_VALUE_MAX_LENGTH,
+ formatThemeVars,
+ generatePageStyles,
+ generateThemeStyles,
+ generateThemeVarsTemplate,
+ hasCustomTheme,
+ parseThemeVarsText,
+ sanitizeCustomTheme,
+ THEME_VAR_NAMES,
+ THEMES,
+ validateCustomTheme,
+} from "../index";
+
+describe("hasCustomTheme", () => {
+ test("false for null / undefined / empty modes", () => {
+ expect(hasCustomTheme(null)).toBe(false);
+ expect(hasCustomTheme(undefined)).toBe(false);
+ expect(hasCustomTheme({})).toBe(false);
+ expect(hasCustomTheme({ light: {}, dark: {} })).toBe(false);
+ });
+
+ test("true when either mode has a var", () => {
+ expect(hasCustomTheme({ light: { "--primary": "red" } })).toBe(true);
+ expect(hasCustomTheme({ dark: { "--primary": "pink" } })).toBe(true);
+ });
+});
+
+describe("validateCustomTheme", () => {
+ test("valid for known vars with safe values", () => {
+ expect(
+ validateCustomTheme({
+ light: { "--primary": "oklch(0.6 0.1 250)" },
+ dark: { "--radius": "0.5rem" },
+ }),
+ ).toEqual({ valid: true });
+ });
+
+ test("rejects unknown var names", () => {
+ const result = validateCustomTheme({
+ light: { "--not-a-var": "red" },
+ });
+ expect(result.valid).toBe(false);
+ if (!result.valid) {
+ expect(result.errors.join()).toContain(
+ 'Unknown CSS variable "--not-a-var"',
+ );
+ }
+ });
+
+ test("rejects values with style-tag breakout characters", () => {
+ for (const value of ["</style>", "red;}", "red{", "a;b"]) {
+ const result = validateCustomTheme({ light: { "--primary": value } });
+ expect(result.valid).toBe(false);
+ }
+ });
+
+ test("rejects empty and over-long values", () => {
+ expect(validateCustomTheme({ light: { "--primary": " " } }).valid).toBe(
+ false,
+ );
+ expect(
+ validateCustomTheme({
+ light: {
+ "--primary": "a".repeat(CUSTOM_THEME_VALUE_MAX_LENGTH + 1),
+ },
+ }).valid,
+ ).toBe(false);
+ });
+});
+
+describe("sanitizeCustomTheme", () => {
+ test("keeps valid vars and trims values", () => {
+ expect(
+ sanitizeCustomTheme({ light: { "--primary": " hotpink " } }),
+ ).toEqual({ light: { "--primary": "hotpink" }, dark: {} });
+ });
+
+ test("drops unknown vars and unsafe values", () => {
+ const sanitized = sanitizeCustomTheme({
+ light: { "--evil": "red", "--primary": "red;} </style>" },
+ dark: { "--primary": "pink" },
+ });
+ expect(sanitized).toEqual({ light: {}, dark: { "--primary": "pink" } });
+ });
+});
+
+describe("parseThemeVarsText", () => {
+ test("parses one declaration per line, with or without semicolon", () => {
+ const { vars, errors } = parseThemeVarsText(
+ "--primary: hsl(24 94% 50%);\n--radius: 0.5rem",
+ );
+ expect(errors).toEqual([]);
+ expect(vars).toEqual({
+ "--primary": "hsl(24 94% 50%)",
+ "--radius": "0.5rem",
+ });
+ });
+
+ test("ignores blank lines and comment lines", () => {
+ const { vars, errors } = parseThemeVarsText(
+ "\n/* --background: ; */\n--primary: red;\n \n",
+ );
+ expect(errors).toEqual([]);
+ expect(vars).toEqual({ "--primary": "red" });
+ });
+
+ test("reports malformed lines and unknown vars", () => {
+ const { vars, errors } = parseThemeVarsText(
+ "not a declaration\n--nope: red;\n--primary: blue;",
+ );
+ expect(vars).toEqual({ "--primary": "blue" });
+ expect(errors.length).toBe(2);
+ expect(errors.join()).toContain("Invalid declaration");
+ expect(errors.join()).toContain('Unknown CSS variable "--nope"');
+ });
+
+ test("empty input parses to no vars", () => {
+ expect(parseThemeVarsText("")).toEqual({ vars: {}, errors: [] });
+ });
+});
+
+describe("formatThemeVars", () => {
+ test("round-trips with parseThemeVarsText", () => {
+ const vars = { "--primary": "red", "--radius": "0.5rem" } as const;
+ expect(parseThemeVarsText(formatThemeVars(vars)).vars).toEqual(vars);
+ });
+
+ test("empty / nullish vars format to an empty string", () => {
+ expect(formatThemeVars({})).toBe("");
+ expect(formatThemeVars(null)).toBe("");
+ });
+});
+
+describe("generateThemeVarsTemplate", () => {
+ test("lists every supported css var once", () => {
+ const template = generateThemeVarsTemplate(THEMES.default, "light");
+ for (const name of THEME_VAR_NAMES) {
+ const occurrences = template.split(`${name}: `).length - 1;
+ expect(occurrences).toBe(1);
+ }
+ });
+
+ test("comments out vars the theme leaves unset", () => {
+ const template = generateThemeVarsTemplate(THEMES.default, "light");
+ expect(template).toContain("/* --chart-1: ; */");
+ expect(template).not.toContain("--chart-1: ;\n");
+ });
+
+ test("pre-fills values from the given theme and mode", () => {
+ const light = generateThemeVarsTemplate(THEMES.default, "light");
+ const dark = generateThemeVarsTemplate(THEMES.default, "dark");
+ expect(light).toContain(
+ `--background: ${THEMES.default.light["--background"]};`,
+ );
+ expect(dark).toContain(
+ `--background: ${THEMES.default.dark["--background"]};`,
+ );
+ });
+
+ test("parses back without errors", () => {
+ const template = generateThemeVarsTemplate(THEMES.default, "light");
+ expect(parseThemeVarsText(template).errors).toEqual([]);
+ });
+});
+
+describe("generatePageStyles", () => {
+ test("returns plain theme styles without a custom theme", () => {
+ expect(generatePageStyles({ themeKey: "default" })).toBe(
+ generateThemeStyles("default"),
+ );
+ expect(
+ generatePageStyles({ themeKey: "default", customTheme: { light: {} } }),
+ ).toBe(generateThemeStyles("default"));
+ });
+
+ test("merges custom vars over the theme so they win", () => {
+ const styles = generatePageStyles({
+ themeKey: "default",
+ customTheme: { light: { "--primary": "hotpink" } },
+ });
+ expect(styles).toContain("--primary: hotpink;");
+ expect(styles).not.toContain(
+ `--primary: ${THEMES.default.light["--primary"]};`,
+ );
+ });
+
+ test("drops unsafe values from stored data", () => {
+ const styles = generatePageStyles({
+ themeKey: "default",
+ customTheme: { light: { "--primary": "red;} </style>" } },
+ });
+ expect(styles).not.toContain("</style");
+ });
+
+ test("falls back to the default theme for unknown keys", () => {
+ expect(generatePageStyles({ themeKey: "does-not-exist" })).toBe(
+ generateThemeStyles(undefined),
+ );
+ });
+});
diff --git a/packages/theme-store/src/custom-theme.ts b/packages/theme-store/src/custom-theme.ts
new file mode 100644
index 000000000..edf3e67a1
--- /dev/null
+++ b/packages/theme-store/src/custom-theme.ts
@@ -0,0 +1,139 @@
+import type { ThemeDefinition, ThemeVarName, ThemeVars } from "./types";
+import { THEME_VAR_NAMES } from "./types";
+
+/** Per-mode CSS variable overrides merged over the selected theme. */
+export type CustomTheme = Partial<ThemeDefinition>;
+
+export const CUSTOM_THEME_VALUE_MAX_LENGTH = 256;
+
+const THEME_VAR_NAME_SET = new Set<string>(THEME_VAR_NAMES);
+
+// Values are rendered into an inline <style> tag as `--name: value;` —
+// ban everything that could terminate the declaration, the block or the tag.
+const SAFE_VALUE_REGEX = /^[^<{};\u0000-\u001f]+$/;
+
+export function hasCustomTheme(
+ customTheme: CustomTheme | null | undefined,
+): customTheme is CustomTheme {
+ if (!customTheme || typeof customTheme !== "object") return false;
+ return (
+ Object.keys(customTheme.light ?? {}).length > 0 ||
+ Object.keys(customTheme.dark ?? {}).length > 0
+ );
+}
+
+export type CustomThemeValidation =
+ | { valid: true }
+ | { valid: false; errors: string[] };
+
+type LooseThemeVars = Record<string, string>;
+type LooseCustomTheme = { light?: LooseThemeVars; dark?: LooseThemeVars };
+
+function validateVarEntry(name: string, value: string): string[] {
+ const errors: string[] = [];
+ if (!THEME_VAR_NAME_SET.has(name)) {
+ errors.push(`Unknown CSS variable "${name}".`);
+ return errors;
+ }
+ if (value.length > CUSTOM_THEME_VALUE_MAX_LENGTH) {
+ errors.push(
+ `Value of "${name}" must be at most ${CUSTOM_THEME_VALUE_MAX_LENGTH} characters.`,
+ );
+ }
+ if (value.trim().length === 0) {
+ errors.push(`Value of "${name}" must not be empty.`);
+ } else if (!SAFE_VALUE_REGEX.test(value)) {
+ errors.push(`Value of "${name}" contains unsupported characters.`);
+ }
+ return errors;
+}
+
+/** Validates var names against the supported set and values for safe characters. */
+export function validateCustomTheme(
+ customTheme: LooseCustomTheme,
+): CustomThemeValidation {
+ const errors: string[] = [];
+ for (const mode of ["light", "dark"] as const) {
+ for (const [name, value] of Object.entries(customTheme[mode] ?? {})) {
+ errors.push(...validateVarEntry(name, value));
+ }
+ }
+ return errors.length > 0 ? { valid: false, errors } : { valid: true };
+}
+
+/** Drops unknown vars and unsafe values; render-side defense for stored data. */
+export function sanitizeCustomTheme(
+ customTheme: LooseCustomTheme,
+): CustomTheme {
+ const pick = (vars: LooseThemeVars | undefined): ThemeVars => {
+ const out: ThemeVars = {};
+ for (const [name, value] of Object.entries(vars ?? {})) {
+ if (validateVarEntry(name, value).length > 0) continue;
+ // safe: validateVarEntry checked membership in THEME_VAR_NAMES
+ out[name as ThemeVarName] = value.trim();
+ }
+ return out;
+ };
+ return { light: pick(customTheme.light), dark: pick(customTheme.dark) };
+}
+
+/**
+ * Parses editor text — one `--name: value;` declaration per line — into
+ * theme vars. Blank lines and comment lines are ignored.
+ */
+export function parseThemeVarsText(text: string): {
+ vars: ThemeVars;
+ errors: string[];
+} {
+ const vars: ThemeVars = {};
+ const errors: string[] = [];
+ for (const rawLine of text.split("\n")) {
+ const line = rawLine.trim();
+ if (line.length === 0) continue;
+ if (line.startsWith("/*") && line.endsWith("*/")) continue;
+ // manual split instead of a lazy regex over the whole line — the regex
+ // form backtracks quadratically on hostile input (CodeQL js/polynomial-redos)
+ const colonIndex = line.indexOf(":");
+ const name = colonIndex === -1 ? "" : line.slice(0, colonIndex).trimEnd();
+ let value = colonIndex === -1 ? "" : line.slice(colonIndex + 1).trim();
+ if (value.endsWith(";")) value = value.slice(0, -1).trimEnd();
+ if (!/^--[\w-]+$/.test(name) || value.length === 0) {
+ errors.push(
+ `Invalid declaration "${line}". Expected e.g. --primary: hsl(24 94% 50%);`,
+ );
+ continue;
+ }
+ const entryErrors = validateVarEntry(name, value);
+ if (entryErrors.length > 0) {
+ errors.push(...entryErrors);
+ continue;
+ }
+ // safe: validateVarEntry checked membership in THEME_VAR_NAMES
+ vars[name as ThemeVarName] = value.trim();
+ }
+ return { vars, errors };
+}
+
+/** Serializes theme vars back to editor text, one declaration per line. */
+export function formatThemeVars(vars: ThemeVars | null | undefined): string {
+ return Object.entries(vars ?? {})
+ .map(([name, value]) => `${name}: ${value};`)
+ .join("\n");
+}
+
+/**
+ * Editor placeholder listing every supported CSS variable for one mode,
+ * pre-filled with the given theme's values (commented out where unset).
+ */
+export function generateThemeVarsTemplate(
+ theme: ThemeDefinition | undefined,
+ mode: "light" | "dark",
+): string {
+ const vars = theme?.[mode] ?? {};
+ return THEME_VAR_NAMES.map((name) => {
+ const value = vars[name];
+ // vars the theme leaves unset are commented out — a saved empty
+ // value would override the global default
+ return value ? `${name}: ${value};` : `/* ${name}: ; */`;
+ }).join("\n");
+}
diff --git a/packages/theme-store/src/index.ts b/packages/theme-store/src/index.ts
index e2c7d8477..5c1256dbf 100644
--- a/packages/theme-store/src/index.ts
+++ b/packages/theme-store/src/index.ts
@@ -1,4 +1,10 @@
+export * from "./custom-theme";
export * from "./types";
+import {
+ type CustomTheme,
+ hasCustomTheme,
+ sanitizeCustomTheme,
+} from "./custom-theme";
import { DRACULA_THEME } from "./dracula";
import { GITHUB_HIGH_CONTRAST_THEME } from "./github";
import { OPENSTATUS_ROUNDED_THEME, OPENSTATUS_THEME } from "./openstatus";
@@ -52,3 +58,20 @@ export function generateThemeStyles(
}
`;
}
+
+/**
+ * Styles for a status page: the configured theme with the page's custom
+ * theme vars merged over it (custom-theme > theme).
+ */
+export function generatePageStyles({
+ themeKey,
+ customTheme,
+}: {
+ themeKey?: string;
+ customTheme?: CustomTheme | null;
+}) {
+ const overrides = hasCustomTheme(customTheme)
+ ? sanitizeCustomTheme(customTheme)
+ : undefined;
+ return generateThemeStyles(themeKey, overrides);
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2853e3e63..b8888894f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2787,6 +2787,12 @@ importers:
'@openstatus/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ '@std/expect':
+ specifier: jsr:^1.0.19
+ version: '@jsr/[email protected]'
+ '@std/testing':
+ specifier: jsr:^1.0.19
+ version: '@jsr/[email protected]'
typescript:
specifier: 'catalog:'
version: 5.9.3