🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add ASN and query param exclusions to site configuration
Bill Yangbaa795bd3db5
diff --git a/CLAUDE.md b/CLAUDE.mdindex 171a652a6..a149b01dd 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co- Server: `cd server && npm run dev` (TypeScript backend)- Lint: `cd client && npm run lint` or `cd server && npm run build`- TypeCheck: `cd client && tsc --noEmit` or `cd server && tsc`-- Database: `cd server && npm run db:push` (update DB schema)+- Database: `cd server && npm run db:generate` (generate migration files after schema changes; applied with `npm run db:migrate`)## Code Conventionsdiff --git a/client/src/api/admin/endpoints/exclusions.ts b/client/src/api/admin/endpoints/exclusions.tsindex a2ca23d4f..fe71ea75f 100644--- a/client/src/api/admin/endpoints/exclusions.ts+++ b/client/src/api/admin/endpoints/exclusions.ts@@ -34,6 +34,28 @@ export interface UpdateExcludedUserAgentsRequest {excludedUserAgents: string[];}+export interface ExcludedASNsResponse {+ success: boolean;+ excludedASNs: string[];+ error?: string;+}++export interface ExcludedQueryParamsResponse {+ success: boolean;+ excludedQueryParams: string[];+ error?: string;+}++export interface UpdateExcludedASNsRequest {+ siteId: number;+ excludedASNs: string[];+}++export interface UpdateExcludedQueryParamsRequest {+ siteId: number;+ excludedQueryParams: string[];+}+// Excluded pathsexport const fetchExcludedPaths = async (siteId: string): Promise<ExcludedPathsResponse> => {return await authedFetch<ExcludedPathsResponse>(`/sites/${siteId}/excluded-paths`);@@ -60,3 +82,21 @@ export const fetchExcludedUserAgents = async (siteId: string): Promise<ExcludedUexport const updateExcludedUserAgents = async (siteId: number, excludedUserAgents: string[]): Promise<void> => {await updateSiteConfig(siteId, { excludedUserAgents });};++// Excluded ASNs+export const fetchExcludedASNs = async (siteId: string): Promise<ExcludedASNsResponse> => {+ return await authedFetch<ExcludedASNsResponse>(`/sites/${siteId}/excluded-asns`);+};++export const updateExcludedASNs = async (siteId: number, excludedASNs: string[]): Promise<void> => {+ await updateSiteConfig(siteId, { excludedASNs });+};++// Excluded query params+export const fetchExcludedQueryParams = async (siteId: string): Promise<ExcludedQueryParamsResponse> => {+ return await authedFetch<ExcludedQueryParamsResponse>(`/sites/${siteId}/excluded-query-params`);+};++export const updateExcludedQueryParams = async (siteId: number, excludedQueryParams: string[]): Promise<void> => {+ await updateSiteConfig(siteId, { excludedQueryParams });+};diff --git a/client/src/api/admin/endpoints/index.ts b/client/src/api/admin/endpoints/index.tsindex bcedc3403..5e52672ce 100644--- a/client/src/api/admin/endpoints/index.ts+++ b/client/src/api/admin/endpoints/index.ts@@ -66,14 +66,22 @@ export {updateExcludedHostnames,fetchExcludedUserAgents,updateExcludedUserAgents,+ fetchExcludedASNs,+ updateExcludedASNs,+ fetchExcludedQueryParams,+ updateExcludedQueryParams,} from "./exclusions";export type {ExcludedPathsResponse,ExcludedHostnamesResponse,ExcludedUserAgentsResponse,+ ExcludedASNsResponse,+ ExcludedQueryParamsResponse,UpdateExcludedPathsRequest,UpdateExcludedHostnamesRequest,UpdateExcludedUserAgentsRequest,+ UpdateExcludedASNsRequest,+ UpdateExcludedQueryParamsRequest,} from "./exclusions";// Account Settings endpointsdiff --git a/client/src/api/admin/endpoints/sites.ts b/client/src/api/admin/endpoints/sites.tsindex 2bf35340e..5b31d7b0d 100644--- a/client/src/api/admin/endpoints/sites.ts+++ b/client/src/api/admin/endpoints/sites.ts@@ -153,6 +153,8 @@ export function updateSiteConfig(excludedPaths?: string[];excludedHostnames?: string[];excludedUserAgents?: string[];+ excludedASNs?: string[];+ excludedQueryParams?: string[];sessionReplay?: boolean;webVitals?: boolean;trackErrors?: boolean;diff --git a/client/src/api/admin/hooks/useExclusions.ts b/client/src/api/admin/hooks/useExclusions.tsindex c3d5032c5..ac03a1462 100644--- a/client/src/api/admin/hooks/useExclusions.ts+++ b/client/src/api/admin/hooks/useExclusions.ts@@ -7,6 +7,10 @@ import {updateExcludedHostnames,fetchExcludedUserAgents,updateExcludedUserAgents,+ fetchExcludedASNs,+ updateExcludedASNs,+ fetchExcludedQueryParams,+ updateExcludedQueryParams,} from "../endpoints";// Excluded paths@@ -80,3 +84,51 @@ export const useUpdateExcludedUserAgents = () => {},});};++// Excluded ASNs+export const useGetExcludedASNs = (siteId: number) => {+ return useQuery({+ queryKey: ["excludedASNs", siteId],+ queryFn: () => fetchExcludedASNs(siteId.toString()),+ enabled: !!siteId,+ });+};++export const useUpdateExcludedASNs = () => {+ const queryClient = useQueryClient();++ return useMutation<void, Error, { siteId: number; excludedASNs: string[] }>({+ mutationFn: ({ siteId, excludedASNs }) => updateExcludedASNs(siteId, excludedASNs),+ onSuccess: (_, variables) => {+ toast.success("Excluded ASNs updated successfully");+ queryClient.invalidateQueries({ queryKey: ["excludedASNs", variables.siteId] });+ },+ onError: error => {+ toast.error(error.message || "Failed to update excluded ASNs");+ },+ });+};++// Excluded query params+export const useGetExcludedQueryParams = (siteId: number) => {+ return useQuery({+ queryKey: ["excludedQueryParams", siteId],+ queryFn: () => fetchExcludedQueryParams(siteId.toString()),+ enabled: !!siteId,+ });+};++export const useUpdateExcludedQueryParams = () => {+ const queryClient = useQueryClient();++ return useMutation<void, Error, { siteId: number; excludedQueryParams: string[] }>({+ mutationFn: ({ siteId, excludedQueryParams }) => updateExcludedQueryParams(siteId, excludedQueryParams),+ onSuccess: (_, variables) => {+ toast.success("Excluded query params updated successfully");+ queryClient.invalidateQueries({ queryKey: ["excludedQueryParams", variables.siteId] });+ },+ onError: error => {+ toast.error(error.message || "Failed to update excluded query params");+ },+ });+};diff --git a/client/src/components/SiteSettings/ExclusionsTab.tsx b/client/src/components/SiteSettings/ExclusionsTab.tsxindex 6d375fb4d..3f715df4c 100644--- a/client/src/components/SiteSettings/ExclusionsTab.tsx+++ b/client/src/components/SiteSettings/ExclusionsTab.tsx@@ -1,7 +1,10 @@"use client";+import { AlertCircle } from "lucide-react";import { useExtracted } from "next-intl";+import { useGetSite } from "@/api/admin/hooks/useSites";+import { Alert, AlertDescription } from "@/components/ui/alert";import {useGetExcludedPaths,useUpdateExcludedPaths,@@ -9,6 +12,10 @@ import {useUpdateExcludedHostnames,useGetExcludedUserAgents,useUpdateExcludedUserAgents,+ useGetExcludedASNs,+ useUpdateExcludedASNs,+ useGetExcludedQueryParams,+ useUpdateExcludedQueryParams,} from "@/api/admin/hooks/useExclusions";import { IPExclusionManager } from "./IPExclusionManager";import { CountryExclusionManager } from "./CountryExclusionManager";@@ -29,6 +36,12 @@ export function ExclusionsTab({ siteId, disabled = false }: ExclusionsTabProps)const updateHostnames = useUpdateExcludedHostnames();const userAgents = useGetExcludedUserAgents(siteId);const updateUserAgents = useUpdateExcludedUserAgents();+ const asns = useGetExcludedASNs(siteId);+ const updateASNs = useUpdateExcludedASNs();+ const queryParams = useGetExcludedQueryParams(siteId);+ const updateQueryParams = useUpdateExcludedQueryParams();+ const site = useGetSite(siteId);+ const urlParamsTrackingOff = site.data?.trackUrlParams === false;return (<SettingsSections>@@ -50,6 +63,25 @@ export function ExclusionsTab({ siteId, disabled = false }: ExclusionsTabProps)<CountryExclusionManager siteId={siteId} disabled={disabled} /></SettingsSection>+ <SettingsSection+ title={t("ASN Exclusions")}+ description={t(+ "Exclude traffic from specific networks by autonomous system number, such as a corporate VPN or hosting provider. Enter the number with or without the AS prefix (e.g., AS13335 or 13335)."+ )}+ >+ <PatternExclusionManager+ placeholder="e.g., AS13335"+ addLabel={t("Add ASN")}+ loadingLabel={t("Loading ASN exclusions...")}+ maxLabel={t("Maximum 100 ASN exclusions allowed")}+ values={asns.data?.excludedASNs}+ isLoading={asns.isLoading}+ isSaving={updateASNs.isPending}+ onSave={excludedASNs => updateASNs.mutateAsync({ siteId, excludedASNs })}+ disabled={disabled}+ />+ </SettingsSection>+<SettingsSectiontitle={t("Path Exclusions")}description={t(@@ -69,6 +101,35 @@ export function ExclusionsTab({ siteId, disabled = false }: ExclusionsTabProps)/></SettingsSection>+ <SettingsSection+ title={t("Query Param Exclusions")}+ description={t(+ "Exclude traffic to URLs containing specific query parameters. Use a param name alone (e.g., preview) to match whenever it is present, or name=value to match a specific value. Values support * as a wildcard and matching is case-insensitive."+ )}+ >+ {urlParamsTrackingOff && (+ <Alert>+ <AlertCircle className="h-4 w-4" />+ <AlertDescription>+ {t(+ "URL Parameters tracking is disabled for this site, so events are sent without their query string and these exclusions will not match. Enable URL Parameters in the Tracking tab to use them."+ )}+ </AlertDescription>+ </Alert>+ )}+ <PatternExclusionManager+ placeholder="e.g., preview or utm_source=internal"+ addLabel={t("Add Query Param")}+ loadingLabel={t("Loading query param exclusions...")}+ maxLabel={t("Maximum 100 query param exclusions allowed")}+ values={queryParams.data?.excludedQueryParams}+ isLoading={queryParams.isLoading}+ isSaving={updateQueryParams.isPending}+ onSave={excludedQueryParams => updateQueryParams.mutateAsync({ siteId, excludedQueryParams })}+ disabled={disabled}+ />+ </SettingsSection>+<SettingsSectiontitle={t("Hostname Exclusions")}description={t(diff --git a/server/drizzle/0013_square_bloodaxe.sql b/server/drizzle/0013_square_bloodaxe.sqlnew file mode 100644index 000000000..e781a268b--- /dev/null+++ b/server/drizzle/0013_square_bloodaxe.sql@@ -0,0 +1,2 @@+ALTER TABLE "sites" ADD COLUMN IF NOT EXISTS "excluded_asns" jsonb DEFAULT '[]'::jsonb;--> statement-breakpoint+ALTER TABLE "sites" ADD COLUMN IF NOT EXISTS "excluded_query_params" jsonb DEFAULT '[]'::jsonb;diff --git a/server/drizzle/meta/0013_snapshot.json b/server/drizzle/meta/0013_snapshot.jsonnew file mode 100644index 000000000..5d1f200e4--- /dev/null+++ b/server/drizzle/meta/0013_snapshot.json@@ -0,0 +1,3684 @@+{+ "id": "0e3a4617-e367-41a6-b4e5-402ac9f78f16",+ "prevId": "43a2b4e7-703c-4e99-8f84-33e62a6bd3bb",+ "version": "7",+ "dialect": "postgresql",+ "tables": {+ "public.account": {+ "name": "account",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "accountId": {+ "name": "accountId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "providerId": {+ "name": "providerId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "accessToken": {+ "name": "accessToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refreshToken": {+ "name": "refreshToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "idToken": {+ "name": "idToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessTokenExpiresAt": {+ "name": "accessTokenExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "refreshTokenExpiresAt": {+ "name": "refreshTokenExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "account_userId_user_id_fk": {+ "name": "account_userId_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.active_sessions": {+ "name": "active_sessions",+ "schema": "",+ "columns": {+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_time": {+ "name": "start_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "last_activity": {+ "name": "last_activity",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_regions": {+ "name": "agent_regions",+ "schema": "",+ "columns": {+ "code": {+ "name": "code",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "endpoint_url": {+ "name": "endpoint_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "last_health_check": {+ "name": "last_health_check",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "is_healthy": {+ "name": "is_healthy",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.apikey": {+ "name": "apikey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start": {+ "name": "start",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "prefix": {+ "name": "prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "referenceId": {+ "name": "referenceId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refillInterval": {+ "name": "refillInterval",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "refillAmount": {+ "name": "refillAmount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "lastRefillAt": {+ "name": "lastRefillAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "rateLimitEnabled": {+ "name": "rateLimitEnabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "rateLimitTimeWindow": {+ "name": "rateLimitTimeWindow",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "rateLimitMax": {+ "name": "rateLimitMax",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "requestCount": {+ "name": "requestCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "remaining": {+ "name": "remaining",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "lastRequest": {+ "name": "lastRequest",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "configId": {+ "name": "configId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "permissions": {+ "name": "permissions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cancellation_feedback": {+ "name": "cancellation_feedback",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason_details": {+ "name": "reason_details",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retention_offer_shown": {+ "name": "retention_offer_shown",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retention_offer_accepted": {+ "name": "retention_offer_accepted",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "plan_name_at_cancellation": {+ "name": "plan_name_at_cancellation",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monthly_event_count_at_cancellation": {+ "name": "monthly_event_count_at_cancellation",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.dashboards": {+ "name": "dashboards",+ "schema": "",+ "columns": {+ "dashboard_id": {+ "name": "dashboard_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{\"cards\":[]}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "dashboards_site_id_sites_site_id_fk": {+ "name": "dashboards_site_id_sites_site_id_fk",+ "tableFrom": "dashboards",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "dashboards_user_id_user_id_fk": {+ "name": "dashboards_user_id_user_id_fk",+ "tableFrom": "dashboards",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.experiments": {+ "name": "experiments",+ "schema": "",+ "columns": {+ "experiment_id": {+ "name": "experiment_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "feature_flag_id": {+ "name": "feature_flag_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "primary_goal_id": {+ "name": "primary_goal_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "hypothesis": {+ "name": "hypothesis",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'draft'"+ },+ "winning_variant": {+ "name": "winning_variant",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "ended_at": {+ "name": "ended_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "experiments_site_idx": {+ "name": "experiments_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "experiments_feature_flag_idx": {+ "name": "experiments_feature_flag_idx",+ "columns": [+ {+ "expression": "feature_flag_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "experiments_primary_goal_idx": {+ "name": "experiments_primary_goal_idx",+ "columns": [+ {+ "expression": "primary_goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "experiments_site_id_sites_site_id_fk": {+ "name": "experiments_site_id_sites_site_id_fk",+ "tableFrom": "experiments",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "experiments_feature_flag_id_feature_flags_flag_id_fk": {+ "name": "experiments_feature_flag_id_feature_flags_flag_id_fk",+ "tableFrom": "experiments",+ "tableTo": "feature_flags",+ "columnsFrom": [+ "feature_flag_id"+ ],+ "columnsTo": [+ "flag_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "experiments_primary_goal_id_goals_goal_id_fk": {+ "name": "experiments_primary_goal_id_goals_goal_id_fk",+ "tableFrom": "experiments",+ "tableTo": "goals",+ "columnsFrom": [+ "primary_goal_id"+ ],+ "columnsTo": [+ "goal_id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "experiments_site_flag_unique": {+ "name": "experiments_site_flag_unique",+ "nullsNotDistinct": false,+ "columns": [+ "site_id",+ "feature_flag_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "experiments_status_check": {+ "name": "experiments_status_check",+ "value": "status IN ('draft', 'running', 'paused', 'completed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.feature_flags": {+ "name": "feature_flags",+ "schema": "",+ "columns": {+ "flag_id": {+ "name": "flag_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "runtime": {+ "name": "runtime",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'client'"+ },+ "flag_type": {+ "name": "flag_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'boolean'"+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "variants": {+ "name": "variants",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "rollout_percentage": {+ "name": "rollout_percentage",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 100+ },+ "rules": {+ "name": "rules",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "condition_sets": {+ "name": "condition_sets",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "salt": {+ "name": "salt",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "md5(random()::text || clock_timestamp()::text)"+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "feature_flags_site_idx": {+ "name": "feature_flags_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "feature_flags_site_id_sites_site_id_fk": {+ "name": "feature_flags_site_id_sites_site_id_fk",+ "tableFrom": "feature_flags",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "feature_flags_site_key_unique": {+ "name": "feature_flags_site_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "site_id",+ "key"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "feature_flags_rollout_check": {+ "name": "feature_flags_rollout_check",+ "value": "rollout_percentage >= 0 AND rollout_percentage <= 100"+ },+ "feature_flags_runtime_check": {+ "name": "feature_flags_runtime_check",+ "value": "runtime IN ('client', 'server', 'both')"+ },+ "feature_flags_type_check": {+ "name": "feature_flags_type_check",+ "value": "flag_type IN ('boolean', 'multivariate', 'remote_config')"+ }+ },+ "isRLSEnabled": false+ },+ "public.funnels": {+ "name": "funnels",+ "schema": "",+ "columns": {+ "report_id": {+ "name": "report_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "funnels_site_id_sites_site_id_fk": {+ "name": "funnels_site_id_sites_site_id_fk",+ "tableFrom": "funnels",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "funnels_user_id_user_id_fk": {+ "name": "funnels_user_id_user_id_fk",+ "tableFrom": "funnels",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goals": {+ "name": "goals",+ "schema": "",+ "columns": {+ "goal_id": {+ "name": "goal_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "goal_type": {+ "name": "goal_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "goals_site_id_sites_site_id_fk": {+ "name": "goals_site_id_sites_site_id_fk",+ "tableFrom": "goals",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.gsc_connections": {+ "name": "gsc_connections",+ "schema": "",+ "columns": {+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "gsc_property_url": {+ "name": "gsc_property_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "gsc_connections_site_id_sites_site_id_fk": {+ "name": "gsc_connections_site_id_sites_site_id_fk",+ "tableFrom": "gsc_connections",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.import_status": {+ "name": "import_status",+ "schema": "",+ "columns": {+ "import_id": {+ "name": "import_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "platform": {+ "name": "platform",+ "type": "import_platform_enum",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": true+ },+ "imported_events": {+ "name": "imported_events",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "skipped_events": {+ "name": "skipped_events",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "invalid_events": {+ "name": "invalid_events",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "import_status_site_id_sites_site_id_fk": {+ "name": "import_status_site_id_sites_site_id_fk",+ "tableFrom": "import_status",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "import_status_organization_id_organization_id_fk": {+ "name": "import_status_organization_id_organization_id_fk",+ "tableFrom": "import_status",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.invitation": {+ "name": "invitation",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "inviterId": {+ "name": "inviterId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "has_restricted_site_access": {+ "name": "has_restricted_site_access",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "site_ids": {+ "name": "site_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "teamId": {+ "name": "teamId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "invitation_inviterId_user_id_fk": {+ "name": "invitation_inviterId_user_id_fk",+ "tableFrom": "invitation",+ "tableTo": "user",+ "columnsFrom": [+ "inviterId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "invitation_organizationId_organization_id_fk": {+ "name": "invitation_organizationId_organization_id_fk",+ "tableFrom": "invitation",+ "tableTo": "organization",+ "columnsFrom": [+ "organizationId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "invitation_teamId_team_id_fk": {+ "name": "invitation_teamId_team_id_fk",+ "tableFrom": "invitation",+ "tableTo": "team",+ "columnsFrom": [+ "teamId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.member": {+ "name": "member",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "organizationId": {+ "name": "organizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "has_restricted_site_access": {+ "name": "has_restricted_site_access",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "member_organizationId_organization_id_fk": {+ "name": "member_organizationId_organization_id_fk",+ "tableFrom": "member",+ "tableTo": "organization",+ "columnsFrom": [+ "organizationId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "member_userId_user_id_fk": {+ "name": "member_userId_user_id_fk",+ "tableFrom": "member",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.member_site_access": {+ "name": "member_site_access",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "member_id": {+ "name": "member_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "member_site_access_member_idx": {+ "name": "member_site_access_member_idx",+ "columns": [+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "member_site_access_site_idx": {+ "name": "member_site_access_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "member_site_access_member_id_member_id_fk": {+ "name": "member_site_access_member_id_member_id_fk",+ "tableFrom": "member_site_access",+ "tableTo": "member",+ "columnsFrom": [+ "member_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "member_site_access_site_id_sites_site_id_fk": {+ "name": "member_site_access_site_id_sites_site_id_fk",+ "tableFrom": "member_site_access",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "member_site_access_created_by_user_id_fk": {+ "name": "member_site_access_created_by_user_id_fk",+ "tableFrom": "member_site_access",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "member_site_access_unique": {+ "name": "member_site_access_unique",+ "nullsNotDistinct": false,+ "columns": [+ "member_id",+ "site_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification_channels": {+ "name": "notification_channels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "monitor_ids": {+ "name": "monitor_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_events": {+ "name": "trigger_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[\"down\",\"recovery\"]'::jsonb"+ },+ "cooldown_minutes": {+ "name": "cooldown_minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 5+ },+ "last_notified_at": {+ "name": "last_notified_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notification_channels_organization_id_organization_id_fk": {+ "name": "notification_channels_organization_id_organization_id_fk",+ "tableFrom": "notification_channels",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "notification_channels_created_by_user_id_fk": {+ "name": "notification_channels_created_by_user_id_fk",+ "tableFrom": "notification_channels",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthAccessToken": {+ "name": "oauthAccessToken",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "accessToken": {+ "name": "accessToken",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refreshToken": {+ "name": "refreshToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessTokenExpiresAt": {+ "name": "accessTokenExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "refreshTokenExpiresAt": {+ "name": "refreshTokenExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "oauthAccessToken_clientId_oauthApplication_clientId_fk": {+ "name": "oauthAccessToken_clientId_oauthApplication_clientId_fk",+ "tableFrom": "oauthAccessToken",+ "tableTo": "oauthApplication",+ "columnsFrom": [+ "clientId"+ ],+ "columnsTo": [+ "clientId"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthAccessToken_userId_user_id_fk": {+ "name": "oauthAccessToken_userId_user_id_fk",+ "tableFrom": "oauthAccessToken",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauthAccessToken_accessToken_unique": {+ "name": "oauthAccessToken_accessToken_unique",+ "nullsNotDistinct": false,+ "columns": [+ "accessToken"+ ]+ },+ "oauthAccessToken_refreshToken_unique": {+ "name": "oauthAccessToken_refreshToken_unique",+ "nullsNotDistinct": false,+ "columns": [+ "refreshToken"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthApplication": {+ "name": "oauthApplication",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "clientSecret": {+ "name": "clientSecret",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "redirectUrls": {+ "name": "redirectUrls",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "oauthApplication_userId_user_id_fk": {+ "name": "oauthApplication_userId_user_id_fk",+ "tableFrom": "oauthApplication",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauthApplication_clientId_unique": {+ "name": "oauthApplication_clientId_unique",+ "nullsNotDistinct": false,+ "columns": [+ "clientId"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthConsent": {+ "name": "oauthConsent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "scopes": {+ "name": "scopes",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "consentGiven": {+ "name": "consentGiven",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "oauthConsent_clientId_oauthApplication_clientId_fk": {+ "name": "oauthConsent_clientId_oauthApplication_clientId_fk",+ "tableFrom": "oauthConsent",+ "tableTo": "oauthApplication",+ "columnsFrom": [+ "clientId"+ ],+ "columnsTo": [+ "clientId"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthConsent_userId_user_id_fk": {+ "name": "oauthConsent_userId_user_id_fk",+ "tableFrom": "oauthConsent",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.organization": {+ "name": "organization",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "logo": {+ "name": "logo",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monthlyEventCount": {+ "name": "monthlyEventCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "overMonthlyLimit": {+ "name": "overMonthlyLimit",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "approachingLimitNotifiedPeriodStart": {+ "name": "approachingLimitNotifiedPeriodStart",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "planOverride": {+ "name": "planOverride",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "custom_plan": {+ "name": "custom_plan",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "organization_slug_unique": {+ "name": "organization_slug_unique",+ "nullsNotDistinct": false,+ "columns": [+ "slug"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.session": {+ "name": "session",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "ipAddress": {+ "name": "ipAddress",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userAgent": {+ "name": "userAgent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "impersonatedBy": {+ "name": "impersonatedBy",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "activeOrganizationId": {+ "name": "activeOrganizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "activeTeamId": {+ "name": "activeTeamId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "session_userId_user_id_fk": {+ "name": "session_userId_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "session_token_unique": {+ "name": "session_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.sites": {+ "name": "sites",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "site_id": {+ "name": "site_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "domain": {+ "name": "domain",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "public": {+ "name": "public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "embed_enabled": {+ "name": "embed_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "saltUserIds": {+ "name": "saltUserIds",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "blockBots": {+ "name": "blockBots",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "first_party_proxy": {+ "name": "first_party_proxy",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "excluded_ips": {+ "name": "excluded_ips",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_countries": {+ "name": "excluded_countries",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_paths": {+ "name": "excluded_paths",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_hostnames": {+ "name": "excluded_hostnames",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_user_agents": {+ "name": "excluded_user_agents",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_asns": {+ "name": "excluded_asns",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_query_params": {+ "name": "excluded_query_params",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "sessionReplay": {+ "name": "sessionReplay",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "webVitals": {+ "name": "webVitals",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackErrors": {+ "name": "trackErrors",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackOutbound": {+ "name": "trackOutbound",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackUrlParams": {+ "name": "trackUrlParams",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackInitialPageView": {+ "name": "trackInitialPageView",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackSpaNavigation": {+ "name": "trackSpaNavigation",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackIp": {+ "name": "trackIp",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackButtonClicks": {+ "name": "trackButtonClicks",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackCopy": {+ "name": "trackCopy",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackFormInteractions": {+ "name": "trackFormInteractions",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "api_key": {+ "name": "api_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "private_link_key": {+ "name": "private_link_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "sites_created_by_user_id_fk": {+ "name": "sites_created_by_user_id_fk",+ "tableFrom": "sites",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "sites_organization_id_organization_id_fk": {+ "name": "sites_organization_id_organization_id_fk",+ "tableFrom": "sites",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "sites_type_check": {+ "name": "sites_type_check",+ "value": "\"sites\".\"type\" IS NULL OR \"sites\".\"type\" IN ('web', 'mobile')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team": {+ "name": "team",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "organizationId": {+ "name": "organizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "team_organizationId_organization_id_fk": {+ "name": "team_organizationId_organization_id_fk",+ "tableFrom": "team",+ "tableTo": "organization",+ "columnsFrom": [+ "organizationId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.teamMember": {+ "name": "teamMember",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "teamId": {+ "name": "teamId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "teamMember_teamId_team_id_fk": {+ "name": "teamMember_teamId_team_id_fk",+ "tableFrom": "teamMember",+ "tableTo": "team",+ "columnsFrom": [+ "teamId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "teamMember_userId_user_id_fk": {+ "name": "teamMember_userId_user_id_fk",+ "tableFrom": "teamMember",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_site_access": {+ "name": "team_site_access",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_site_access_team_idx": {+ "name": "team_site_access_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_site_access_site_idx": {+ "name": "team_site_access_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_site_access_team_id_team_id_fk": {+ "name": "team_site_access_team_id_team_id_fk",+ "tableFrom": "team_site_access",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_site_access_site_id_sites_site_id_fk": {+ "name": "team_site_access_site_id_sites_site_id_fk",+ "tableFrom": "team_site_access",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_site_access_unique": {+ "name": "team_site_access_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "site_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.telemetry": {+ "name": "telemetry",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "instance_id": {+ "name": "instance_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "timestamp": {+ "name": "timestamp",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "version": {+ "name": "version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "table_counts": {+ "name": "table_counts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "clickhouse_size_gb": {+ "name": "clickhouse_size_gb",+ "type": "real",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_alert_history": {+ "name": "uptime_alert_history",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "alert_id": {+ "name": "alert_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "triggered_at": {+ "name": "triggered_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "alert_data": {+ "name": "alert_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_alert_history_alert_id_uptime_alerts_id_fk": {+ "name": "uptime_alert_history_alert_id_uptime_alerts_id_fk",+ "tableFrom": "uptime_alert_history",+ "tableTo": "uptime_alerts",+ "columnsFrom": [+ "alert_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "uptime_alert_history_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_alert_history_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_alert_history",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_alerts": {+ "name": "uptime_alerts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "alert_type": {+ "name": "alert_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "alert_config": {+ "name": "alert_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "conditions": {+ "name": "conditions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_alerts_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_alerts_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_alerts",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_incidents": {+ "name": "uptime_incidents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_time": {+ "name": "start_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "end_time": {+ "name": "end_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "acknowledged_by": {+ "name": "acknowledged_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "acknowledged_at": {+ "name": "acknowledged_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by": {+ "name": "resolved_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_error_type": {+ "name": "last_error_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "failure_count": {+ "name": "failure_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_incidents_organization_id_organization_id_fk": {+ "name": "uptime_incidents_organization_id_organization_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "uptime_incidents_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_incidents_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "uptime_incidents_acknowledged_by_user_id_fk": {+ "name": "uptime_incidents_acknowledged_by_user_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "user",+ "columnsFrom": [+ "acknowledged_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "uptime_incidents_resolved_by_user_id_fk": {+ "name": "uptime_incidents_resolved_by_user_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "user",+ "columnsFrom": [+ "resolved_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_monitor_status": {+ "name": "uptime_monitor_status",+ "schema": "",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "last_checked_at": {+ "name": "last_checked_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "next_check_at": {+ "name": "next_check_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "current_status": {+ "name": "current_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'unknown'"+ },+ "consecutive_failures": {+ "name": "consecutive_failures",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "consecutive_successes": {+ "name": "consecutive_successes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "uptime_percentage_24h": {+ "name": "uptime_percentage_24h",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "uptime_percentage_7d": {+ "name": "uptime_percentage_7d",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "uptime_percentage_30d": {+ "name": "uptime_percentage_30d",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "average_response_time_24h": {+ "name": "average_response_time_24h",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {+ "uptime_monitor_status_updated_at_idx": {+ "name": "uptime_monitor_status_updated_at_idx",+ "columns": [+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "uptime_monitor_status_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_monitor_status_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_monitor_status",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "uptime_monitor_status_current_status_check": {+ "name": "uptime_monitor_status_current_status_check",+ "value": "current_status IN ('up', 'down', 'unknown')"+ },+ "uptime_monitor_status_uptime_24h_check": {+ "name": "uptime_monitor_status_uptime_24h_check",+ "value": "uptime_percentage_24h >= 0 AND uptime_percentage_24h <= 100"+ },+ "uptime_monitor_status_uptime_7d_check": {+ "name": "uptime_monitor_status_uptime_7d_check",+ "value": "uptime_percentage_7d >= 0 AND uptime_percentage_7d <= 100"+ },+ "uptime_monitor_status_uptime_30d_check": {+ "name": "uptime_monitor_status_uptime_30d_check",+ "value": "uptime_percentage_30d >= 0 AND uptime_percentage_30d <= 100"+ }+ },+ "isRLSEnabled": false+ },+ "public.uptime_monitors": {+ "name": "uptime_monitors",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_type": {+ "name": "monitor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "interval_seconds": {+ "name": "interval_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "http_config": {+ "name": "http_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tcp_config": {+ "name": "tcp_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "validation_rules": {+ "name": "validation_rules",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "monitoring_type": {+ "name": "monitoring_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'local'"+ },+ "selected_regions": {+ "name": "selected_regions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[\"local\"]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_monitors_organization_id_organization_id_fk": {+ "name": "uptime_monitors_organization_id_organization_id_fk",+ "tableFrom": "uptime_monitors",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "uptime_monitors_created_by_user_id_fk": {+ "name": "uptime_monitors_created_by_user_id_fk",+ "tableFrom": "uptime_monitors",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user": {+ "name": "user",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'user'"+ },+ "displayUsername": {+ "name": "displayUsername",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "banned": {+ "name": "banned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "banReason": {+ "name": "banReason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "banExpires": {+ "name": "banExpires",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "overMonthlyLimit": {+ "name": "overMonthlyLimit",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "monthlyEventCount": {+ "name": "monthlyEventCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "sendAutoEmailReports": {+ "name": "sendAutoEmailReports",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "scheduled_tip_email_ids": {+ "name": "scheduled_tip_email_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_username_unique": {+ "name": "user_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "username"+ ]+ },+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_aliases": {+ "name": "user_aliases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "anonymous_id": {+ "name": "anonymous_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_aliases_user_idx": {+ "name": "user_aliases_user_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_aliases_anon_idx": {+ "name": "user_aliases_anon_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "anonymous_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_aliases_site_id_sites_site_id_fk": {+ "name": "user_aliases_site_id_sites_site_id_fk",+ "tableFrom": "user_aliases",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_aliases_site_anon_unique": {+ "name": "user_aliases_site_anon_unique",+ "nullsNotDistinct": false,+ "columns": [+ "site_id",+ "anonymous_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_profiles": {+ "name": "user_profiles",+ "schema": "",+ "columns": {+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "traits": {+ "name": "traits",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_profiles_site_idx": {+ "name": "user_profiles_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_profiles_site_id_sites_site_id_fk": {+ "name": "user_profiles_site_id_sites_site_id_fk",+ "tableFrom": "user_profiles",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "user_profiles_site_id_user_id_pk": {+ "name": "user_profiles_site_id_user_id_pk",+ "columns": [+ "site_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verification": {+ "name": "verification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {+ "public.import_platform_enum": {+ "name": "import_platform_enum",+ "schema": "public",+ "values": [+ "umami",+ "simple_analytics",+ "plausible"+ ]+ }+ },+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/server/drizzle/meta/_journal.json b/server/drizzle/meta/_journal.jsonindex a959fb25c..3b232a627 100644--- a/server/drizzle/meta/_journal.json+++ b/server/drizzle/meta/_journal.json@@ -92,6 +92,13 @@"when": 1784511287442,"tag": "0012_perfect_nebula","breakpoints": true+ },+ {+ "idx": 13,+ "version": "7",+ "when": 1784659838680,+ "tag": "0013_square_bloodaxe",+ "breakpoints": true}]}\ No newline at end of filediff --git a/server/src/api/sessionReplay/recordSessionReplay.test.ts b/server/src/api/sessionReplay/recordSessionReplay.test.tsindex e351c693f..b49e1cc5f 100644--- a/server/src/api/sessionReplay/recordSessionReplay.test.ts+++ b/server/src/api/sessionReplay/recordSessionReplay.test.ts@@ -156,6 +156,7 @@ describe("recordSessionReplay exclusions", () => {ipAddress: "198.51.100.10",candidateIps: ["198.51.100.10", "203.0.113.10"],pathname: "/admin/users",+ querystring: "?tab=settings",hostname: "example.com",userAgent: "Mozilla/5.0 HeadlessChrome/120",}diff --git a/server/src/api/sessionReplay/recordSessionReplay.ts b/server/src/api/sessionReplay/recordSessionReplay.tsindex 11c559e31..c4d9cb105 100644--- a/server/src/api/sessionReplay/recordSessionReplay.ts+++ b/server/src/api/sessionReplay/recordSessionReplay.ts@@ -26,7 +26,11 @@ const recordSessionReplaySchema = z.object({.optional(),});-function parseReplayPageUrl(pageUrl: string | undefined): { hostname?: string; pathname?: string } {+function parseReplayPageUrl(pageUrl: string | undefined): {+ hostname?: string;+ pathname?: string;+ querystring?: string;+} {if (!pageUrl) {return {};}@@ -36,11 +40,13 @@ function parseReplayPageUrl(pageUrl: string | undefined): { hostname?: string; preturn {hostname: url.hostname,pathname: url.pathname,+ querystring: url.search,};} catch {if (pageUrl.startsWith("/")) {return {pathname: pageUrl.split(/[?#]/, 1)[0],+ querystring: pageUrl.split("#", 1)[0].split(/\?(.*)/s)[1],};}@@ -89,13 +95,14 @@ export async function recordSessionReplay(const body = recordSessionReplaySchema.parse(request.body) as RecordSessionReplayRequest;const requestIP = resolveClientIp(request, { firstPartyProxy: siteConfiguration.firstPartyProxy });- const { hostname, pathname } = parseReplayPageUrl(body.metadata?.pageUrl);+ const { hostname, pathname, querystring } = parseReplayPageUrl(body.metadata?.pageUrl);const userAgent = request.headers["user-agent"] || "";const exclusionDecision = await decideSiteExclusion(siteConfiguration, {ipAddress: requestIP,candidateIps: collectCandidateClientIps(request, [requestIP]),pathname,+ querystring,hostname,userAgent: String(userAgent),});diff --git a/server/src/api/sites/getSiteExclusions.ts b/server/src/api/sites/getSiteExclusions.tsindex abf169d6b..742ec9c8b 100644--- a/server/src/api/sites/getSiteExclusions.ts+++ b/server/src/api/sites/getSiteExclusions.ts@@ -15,7 +15,12 @@ const siteParamsSchema = z.object({async function getExclusionColumn(request: FastifyRequest,reply: FastifyReply,- column: typeof sites.excludedPaths | typeof sites.excludedHostnames | typeof sites.excludedUserAgents,+ column:+ | typeof sites.excludedPaths+ | typeof sites.excludedHostnames+ | typeof sites.excludedUserAgents+ | typeof sites.excludedASNs+ | typeof sites.excludedQueryParams,responseKey: string) {try {@@ -72,3 +77,11 @@ export function getSiteExcludedHostnames(request: FastifyRequest, reply: Fastifyexport function getSiteExcludedUserAgents(request: FastifyRequest, reply: FastifyReply) {return getExclusionColumn(request, reply, sites.excludedUserAgents, "excludedUserAgents");}++export function getSiteExcludedASNs(request: FastifyRequest, reply: FastifyReply) {+ return getExclusionColumn(request, reply, sites.excludedASNs, "excludedASNs");+}++export function getSiteExcludedQueryParams(request: FastifyRequest, reply: FastifyReply) {+ return getExclusionColumn(request, reply, sites.excludedQueryParams, "excludedQueryParams");+}diff --git a/server/src/api/sites/index.ts b/server/src/api/sites/index.tsindex 58aa8763c..af28fb376 100644--- a/server/src/api/sites/index.ts+++ b/server/src/api/sites/index.ts@@ -20,6 +20,8 @@ export {getSiteExcludedPaths,getSiteExcludedHostnames,getSiteExcludedUserAgents,+ getSiteExcludedASNs,+ getSiteExcludedQueryParams,} from "./getSiteExclusions.js";// Site Importsdiff --git a/server/src/api/sites/updateSiteConfig.ts b/server/src/api/sites/updateSiteConfig.tsindex 26a46a092..1dabb96ee 100644--- a/server/src/api/sites/updateSiteConfig.ts+++ b/server/src/api/sites/updateSiteConfig.ts@@ -25,6 +25,31 @@ const updateSiteConfigSchema = z.object({excludedPaths: z.array(z.string().trim().min(1).max(2048)).max(100).optional(),excludedHostnames: z.array(z.string().trim().min(1).max(253)).max(100).optional(),excludedUserAgents: z.array(z.string().trim().min(1).max(512)).max(100).optional(),+ excludedASNs: z+ .array(+ z+ .string()+ .trim()+ .regex(/^(?:AS)?\d{1,10}$/i, "ASN must be a number, optionally prefixed with AS (e.g., AS13335 or 13335)")+ .refine(value => Number(value.replace(/^AS/i, "")) <= 4294967295, {+ message: "ASN must be at most 4294967295",+ })+ )+ .max(100)+ .optional(),+ excludedQueryParams: z+ .array(+ z+ .string()+ .trim()+ .min(1)+ .max(512)+ .refine(value => !value.startsWith("="), {+ message: "Query param rule must have a name before '=' (e.g., preview or utm_source=internal)",+ })+ )+ .max(100)+ .optional(),tags: z.array(z.string().trim().min(1).max(50)).max(20).optional(),sessionReplay: z.boolean().optional(),webVitals: z.boolean().optional(),diff --git a/server/src/db/postgres/schema.ts b/server/src/db/postgres/schema.tsindex 776a65e63..999190e5d 100644--- a/server/src/db/postgres/schema.ts+++ b/server/src/db/postgres/schema.ts@@ -84,6 +84,8 @@ export const sites = pgTable(excludedPaths: jsonb("excluded_paths").default([]).$type<string[]>(), // Array of pathname glob patterns to exclude (e.g., ["/admin/*", "/preview"])excludedHostnames: jsonb("excluded_hostnames").default([]).$type<string[]>(), // Array of hostname glob patterns to exclude (e.g., ["localhost", "*.vercel.app"])excludedUserAgents: jsonb("excluded_user_agents").default([]).$type<string[]>(), // Array of case-insensitive user-agent substrings to exclude (e.g., ["HeadlessChrome"])+ excludedASNs: jsonb("excluded_asns").default([]).$type<string[]>(), // Array of autonomous system numbers to exclude, with or without "AS" prefix (e.g., ["AS13335", "16509"])+ excludedQueryParams: jsonb("excluded_query_params").default([]).$type<string[]>(), // Array of query param exclusions: "name" (param present) or "name=value" (value supports * glob), e.g. ["preview", "utm_source=internal-*"]sessionReplay: boolean().default(false),webVitals: boolean().default(false),trackErrors: boolean().default(false),diff --git a/server/src/index.ts b/server/src/index.tsindex 3d5b6ffae..a0c261dca 100644--- a/server/src/index.ts+++ b/server/src/index.ts@@ -121,6 +121,8 @@ import {getSiteExcludedIPs,getSiteExcludedPaths,getSiteExcludedUserAgents,+ getSiteExcludedASNs,+ getSiteExcludedQueryParams,getSiteHasData,getSiteImports,getSiteIsPublic,@@ -438,6 +440,8 @@ async function sitesRoutes(fastify: FastifyInstance) {fastify.get("/sites/:siteId/excluded-paths", authSitesRead, getSiteExcludedPaths);fastify.get("/sites/:siteId/excluded-hostnames", authSitesRead, getSiteExcludedHostnames);fastify.get("/sites/:siteId/excluded-user-agents", authSitesRead, getSiteExcludedUserAgents);+ fastify.get("/sites/:siteId/excluded-asns", authSitesRead, getSiteExcludedASNs);+ fastify.get("/sites/:siteId/excluded-query-params", authSitesRead, getSiteExcludedQueryParams);// Site Usagefastify.get("/sites/:siteId/usage", authSitesRead, getSiteUsage);diff --git a/server/src/lib/auth-utils.test.ts b/server/src/lib/auth-utils.test.tsindex 3c96c07a9..b41b31802 100644--- a/server/src/lib/auth-utils.test.ts+++ b/server/src/lib/auth-utils.test.ts@@ -95,6 +95,8 @@ CREATE TABLE "sites" ("excluded_paths" jsonb DEFAULT '[]',"excluded_hostnames" jsonb DEFAULT '[]',"excluded_user_agents" jsonb DEFAULT '[]',+ "excluded_asns" jsonb DEFAULT '[]',+ "excluded_query_params" jsonb DEFAULT '[]',"sessionReplay" boolean DEFAULT false,"webVitals" boolean DEFAULT false,"trackErrors" boolean DEFAULT false,diff --git a/server/src/lib/siteConfig.ts b/server/src/lib/siteConfig.tsindex 8de765213..4b8b5dc52 100644--- a/server/src/lib/siteConfig.ts+++ b/server/src/lib/siteConfig.ts@@ -19,6 +19,8 @@ export interface SiteConfigData {excludedPaths: string[];excludedHostnames: string[];excludedUserAgents: string[];+ excludedASNs: string[];+ excludedQueryParams: string[];privateLinkKey?: string | null;sessionReplay: boolean;webVitals: boolean;@@ -107,6 +109,8 @@ class SiteConfig {excludedPaths: Array.isArray(site.excludedPaths) ? site.excludedPaths : [],excludedHostnames: Array.isArray(site.excludedHostnames) ? site.excludedHostnames : [],excludedUserAgents: Array.isArray(site.excludedUserAgents) ? site.excludedUserAgents : [],+ excludedASNs: Array.isArray(site.excludedASNs) ? site.excludedASNs : [],+ excludedQueryParams: Array.isArray(site.excludedQueryParams) ? site.excludedQueryParams : [],privateLinkKey: site.privateLinkKey,sessionReplay: site.sessionReplay || false,webVitals: site.webVitals || false,diff --git a/server/src/mcp/tools/sites.ts b/server/src/mcp/tools/sites.tsindex 035624c0c..8eb8d2252 100644--- a/server/src/mcp/tools/sites.ts+++ b/server/src/mcp/tools/sites.ts@@ -145,6 +145,14 @@ export function registerSiteTools(server: McpServer, api: RybbitApiClient, guardexcludedPaths: z.array(z.string()).optional(),excludedHostnames: z.array(z.string()).optional(),excludedUserAgents: z.array(z.string()).optional(),+ excludedASNs: z+ .array(z.string())+ .optional()+ .describe("Autonomous system numbers to exclude, with or without AS prefix (e.g., AS13335)"),+ excludedQueryParams: z+ .array(z.string())+ .optional()+ .describe('Query param exclusions: "name" (param present) or "name=value" (value supports * glob)'),tags: z.array(z.string()).optional(),...siteFeatureInputs,},diff --git a/server/src/services/sites/siteConfigurationLifecycle.ts b/server/src/services/sites/siteConfigurationLifecycle.tsindex fd0a8ca9a..365f043ce 100644--- a/server/src/services/sites/siteConfigurationLifecycle.ts+++ b/server/src/services/sites/siteConfigurationLifecycle.ts@@ -51,6 +51,8 @@ export type UpdateSiteConfigurationInput = {excludedPaths?: string[];excludedHostnames?: string[];excludedUserAgents?: string[];+ excludedASNs?: string[];+ excludedQueryParams?: string[];tags?: string[];sessionReplay?: boolean;webVitals?: boolean;@@ -112,6 +114,8 @@ const DIRECT_UPDATE_FIELDS = ["excludedPaths","excludedHostnames","excludedUserAgents",+ "excludedASNs",+ "excludedQueryParams","tags","sessionReplay","webVitals",diff --git a/server/src/services/sites/siteExclusionDecision.test.ts b/server/src/services/sites/siteExclusionDecision.test.tsindex 4b5114ecc..f1d25ad9f 100644--- a/server/src/services/sites/siteExclusionDecision.test.ts+++ b/server/src/services/sites/siteExclusionDecision.test.ts@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";const mocks = vi.hoisted(() => ({getLocation: vi.fn(),+ lookupAsn: vi.fn(),loggerWarn: vi.fn(),}));@@ -9,6 +10,10 @@ vi.mock("../../db/geolocation/geolocation.js", () => ({getLocation: mocks.getLocation,}));+vi.mock("../../db/geolocation/asn.js", () => ({+ lookupAsn: mocks.lookupAsn,+}));+vi.mock("../../lib/logger/logger.js", () => ({logger: { warn: mocks.loggerWarn },}));@@ -22,6 +27,8 @@ function configuration(overrides: Partial<Parameters<typeof decideSiteExclusion>excludedPaths: [],excludedHostnames: [],excludedUserAgents: [],+ excludedASNs: [],+ excludedQueryParams: [],...overrides,};}@@ -36,6 +43,7 @@ const request = {beforeEach(() => {vi.clearAllMocks();mocks.getLocation.mockResolvedValue({});+ mocks.lookupAsn.mockReturnValue(null);});describe("decideSiteExclusion", () => {@@ -150,6 +158,64 @@ describe("decideSiteExclusion", () => {});});+ it("matches an excluded ASN with or without the AS prefix, ignoring invalid rules", async () => {+ mocks.lookupAsn.mockReturnValue({ asn: 13335, organization: "Cloudflare" });+ const expected = { excluded: true, reason: "asn", label: "ASN", value: "AS13335" };++ await expect(decideSiteExclusion(configuration({ excludedASNs: ["AS13335"] }), request)).resolves.toEqual(expected);+ await expect(decideSiteExclusion(configuration({ excludedASNs: ["as13335"] }), request)).resolves.toEqual(expected);+ await expect(decideSiteExclusion(configuration({ excludedASNs: ["13335"] }), request)).resolves.toEqual(expected);+ await expect(decideSiteExclusion(configuration({ excludedASNs: ["bogus", "AS999"] }), request)).resolves.toEqual({+ excluded: false,+ });+ });++ it("matches an excluded ASN on any candidate IP and skips lookups when no ASN rules exist", async () => {+ mocks.lookupAsn.mockImplementation((ip: string) =>+ ip === "203.0.113.7" ? { asn: 16509, organization: "Amazon" } : null+ );++ await expect(+ decideSiteExclusion(configuration({ excludedASNs: ["AS16509"] }), {+ ...request,+ candidateIps: ["203.0.113.7"],+ })+ ).resolves.toMatchObject({ excluded: true, reason: "asn", value: "AS16509" });++ mocks.lookupAsn.mockClear();+ await expect(decideSiteExclusion(configuration(), request)).resolves.toEqual({ excluded: false });+ expect(mocks.lookupAsn).not.toHaveBeenCalled();+ });++ it("matches query params by presence and by value glob, case-insensitively", async () => {+ const withQuery = { ...request, pathname: "/pricing", hostname: "example.com", userAgent: "Mozilla/5.0" };++ await expect(+ decideSiteExclusion(configuration({ excludedQueryParams: ["preview"] }), {+ ...withQuery,+ querystring: "?Preview=true&x=1",+ })+ ).resolves.toEqual({ excluded: true, reason: "query_param", label: "query param", value: "Preview=true" });++ await expect(+ decideSiteExclusion(configuration({ excludedQueryParams: ["utm_source=internal-*"] }), {+ ...withQuery,+ querystring: "utm_source=Internal-QA",+ })+ ).resolves.toMatchObject({ excluded: true, reason: "query_param", value: "utm_source=Internal-QA" });++ await expect(+ decideSiteExclusion(configuration({ excludedQueryParams: ["utm_source=internal", "preview"] }), {+ ...withQuery,+ querystring: "utm_source=external&other=preview",+ })+ ).resolves.toEqual({ excluded: false });++ await expect(+ decideSiteExclusion(configuration({ excludedQueryParams: ["preview"] }), withQuery)+ ).resolves.toEqual({ excluded: false });+ });+it("returns the first exclusion in the fixed ordering and short-circuits later work", async () => {mocks.getLocation.mockResolvedValue({"198.51.100.10": { countryIso: "US" },diff --git a/server/src/services/sites/siteExclusionDecision.ts b/server/src/services/sites/siteExclusionDecision.tsindex dda4e5958..1de79ee50 100644--- a/server/src/services/sites/siteExclusionDecision.ts+++ b/server/src/services/sites/siteExclusionDecision.ts@@ -1,3 +1,4 @@+import { lookupAsn } from "../../db/geolocation/asn.js";import { getLocation } from "../../db/geolocation/geolocation.js";import { matchesCIDR, matchesRange } from "../../lib/ipUtils.js";import { logger } from "../../lib/logger/logger.js";@@ -5,7 +6,13 @@ import type { SiteConfigData } from "../../lib/siteConfig.js";type SiteExclusionConfiguration = Pick<SiteConfigData,- "excludedIPs" | "excludedCountries" | "excludedPaths" | "excludedHostnames" | "excludedUserAgents"+ | "excludedIPs"+ | "excludedCountries"+ | "excludedPaths"+ | "excludedHostnames"+ | "excludedUserAgents"+ | "excludedASNs"+ | "excludedQueryParams">;export type SiteExclusionRequest = {@@ -19,28 +26,27 @@ export type SiteExclusionRequest = {*/candidateIps?: string[];pathname?: string;+ querystring?: string;hostname?: string;userAgent?: string;};-export type SiteExclusionReason = "ip" | "country" | "path" | "hostname" | "user_agent";+export type SiteExclusionReason = "ip" | "asn" | "country" | "path" | "query_param" | "hostname" | "user_agent";++type SiteExclusionLabel = "IP" | "ASN" | "country" | "path" | "query param" | "hostname" | "user agent";export type SiteExclusionDecision =| { excluded: false }| {excluded: true;reason: SiteExclusionReason;- label: "IP" | "country" | "path" | "hostname" | "user agent";+ label: SiteExclusionLabel;value: string;};const ACCEPTED: SiteExclusionDecision = { excluded: false };-function excluded(- reason: SiteExclusionReason,- label: "IP" | "country" | "path" | "hostname" | "user agent",- value: string-): SiteExclusionDecision {+function excluded(reason: SiteExclusionReason, label: SiteExclusionLabel, value: string): SiteExclusionDecision {return { excluded: true, reason, label, value };}@@ -101,12 +107,50 @@ function matchesIPPattern(ipAddress: string, pattern: string): boolean {}}+/** Accepts "13335" or "AS13335" (case-insensitive); returns null for anything else. */+function parseAsnPattern(pattern: string): number | null {+ const match = pattern.trim().match(/^(?:AS)?(\d+)$/i);+ return match ? Number(match[1]) : null;+}++/**+ * Query param patterns are either "name" (excluded when the param is present)+ * or "name=value" (value matched as a case-insensitive glob). Names are+ * matched case-insensitively.+ */+function matchesQueryParams(querystring: string, patterns: string[]): string | null {+ const params = new URLSearchParams(querystring);+ const entries = [...params.entries()];+ if (entries.length === 0) return null;++ for (const pattern of patterns) {+ const trimmed = pattern.trim();+ if (!trimmed) continue;++ const separatorIndex = trimmed.indexOf("=");+ const name = (separatorIndex === -1 ? trimmed : trimmed.slice(0, separatorIndex)).toLowerCase();+ const valueGlob = separatorIndex === -1 ? null : trimmed.slice(separatorIndex + 1);+ if (!name) continue;++ const matched = entries.find(+ ([key, value]) => key.toLowerCase() === name && (valueGlob === null || matchesGlob(value, valueGlob))+ );+ if (matched) {+ return matched[1] === "" ? matched[0] : `${matched[0]}=${matched[1]}`;+ }+ }++ return null;+}+/*** Returns the first Site Configuration exclusion matched in this fixed order:- * IP, country, path, hostname, then user agent.+ * IP, ASN, country, path, query param, hostname, then user agent.*- * Geolocation is resolved only when country exclusions exist and no earlier- * exclusion matched. Lookup failures from the geolocation adapter propagate.+ * Like IP exclusions, ASN exclusions match against ALL candidate IPs —+ * over-matching is the safe failure mode here. Geolocation is resolved only+ * when country exclusions exist and no earlier exclusion matched. Lookup+ * failures from the geolocation adapter propagate.*/export async function decideSiteExclusion(configuration: SiteExclusionConfiguration,@@ -118,6 +162,19 @@ export async function decideSiteExclusion(return excluded("ip", "IP", matchedIp);}+ if (configuration.excludedASNs.length > 0) {+ const excludedAsnNumbers = new Set(+ configuration.excludedASNs.map(parseAsnPattern).filter((asn): asn is number => asn !== null)+ );++ for (const ip of ipsToCheck) {+ const asnInfo = lookupAsn(ip);+ if (asnInfo && excludedAsnNumbers.has(asnInfo.asn)) {+ return excluded("asn", "ASN", `AS${asnInfo.asn}`);+ }+ }+ }+if (configuration.excludedCountries.length > 0) {const locations = await getLocation([request.ipAddress]);const countryIso = locations[request.ipAddress]?.countryIso;@@ -130,12 +187,19 @@ export async function decideSiteExclusion(}}- const { pathname, hostname, userAgent } = request;+ const { pathname, querystring, hostname, userAgent } = request;if (pathname && configuration.excludedPaths.some(pattern => matchesGlob(pathname, pattern))) {return excluded("path", "path", pathname);}+ if (querystring && configuration.excludedQueryParams.length > 0) {+ const matchedParam = matchesQueryParams(querystring, configuration.excludedQueryParams);+ if (matchedParam) {+ return excluded("query_param", "query param", matchedParam);+ }+ }+if (hostname && configuration.excludedHostnames.some(pattern => matchesGlob(hostname, pattern))) {return excluded("hostname", "hostname", hostname);}diff --git a/server/src/services/tracker/trackEvent.ts b/server/src/services/tracker/trackEvent.tsindex 06eaa7eee..6a2b2c059 100644--- a/server/src/services/tracker/trackEvent.ts+++ b/server/src/services/tracker/trackEvent.ts@@ -326,6 +326,7 @@ export async function trackEvent(request: FastifyRequest, reply: FastifyReply) {ipAddress: requestIP,candidateIps: trackingIdentity.candidateIps,pathname: validatedPayload.pathname,+ querystring: validatedPayload.querystring,hostname: validatedPayload.hostname,userAgent: trackingIdentity.userAgent,});