🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
chore(dependencies): update @better-auth packages to version 1.7.3 and add oauth-provider; update translations and improve authentication guard
Bill Yang36a0cf8a9ff5
diff --git a/client/messages/cs.json b/client/messages/cs.jsonindex 2ccf715a8..fb48f9b53 100644--- a/client/messages/cs.json+++ b/client/messages/cs.json@@ -1080,6 +1080,24 @@"J2wna+": "Odebrat uživatele z organizace?","rDEYPT": "Vyber organizaci, ze které chceš odebrat {email}. Ztratí přístup ke všem zdrojům v dané organizaci.","jjTzIr": "Databáze",+ "Wzg+A9": "Tuto aplikaci se nepodařilo načíst.",+ "oxcZjO": "Autorizaci se nepodařilo dokončit.",+ "A5gGeo": "Tento požadavek na autorizaci je neplatný. Zkuste se znovu připojit ze své aplikace.",+ "0lnnIL": "Přihlaste se a připojte svou aplikaci",+ "AyGauy": "Přihlášení",+ "GZC9FV": "Tuto aplikaci se nepodařilo načíst. Zkuste se znovu připojit ze své aplikace.",+ "j1jt9l": "Připojit k Rybbit",+ "v4/yBh": "{application} žádá o přístup k vašemu účtu Rybbit.",+ "J43YCp": "Požadovaná oprávnění",+ "19AUAn": "Plný přístup k API, včetně prohlížení analytických dat a provádění změn povolených oprávněními vašeho účtu.",+ "0dWy1F": "{resource}: prohlížet a provádět změny",+ "ci6bnw": "{resource}: prohlížet",+ "V9fGSG": "Číst identitu vašeho účtu a informace z profilu.",+ "+b6mhi": "Přistupovat k vašemu účtu i v době, kdy tuto aplikaci nepoužíváte.",+ "OV9gJF": "Další informace z profilu: {claims}",+ "zKbV8g": "Připojujte pouze aplikace, kterým důvěřujete. Přístup je omezen na weby a organizace, které můžete používat.",+ "172N3w": "Čekejte prosím...",+ "YXzlhm": "Povolit přístup","fcj5H7": "Veřejná analytika","qQ21OF": "Když je zapnuto, kdokoli může zobrazit analytiku bez přihlášení","u/sVSP": "Zapnout solení ID uživatelů",@@ -1146,7 +1164,6 @@"Y++tIp": "Zaregistruj se pro přijetí pozvánky","BR9G0H": "Připoj se k {organization}","y9vcUt": "Pozval tě {inviterEmail}",- "AyGauy": "Přihlášení","GM/hd6": "Pozvánka","1wGfyg": "Byl jsi pozván do {organization} uživatelem {inviterEmail}","OMLaQO": "Přijímám...",diff --git a/client/messages/de.json b/client/messages/de.jsonindex 00147515e..65e970439 100644--- a/client/messages/de.json+++ b/client/messages/de.json@@ -1080,6 +1080,24 @@"J2wna+": "Benutzer aus Organisation entfernen?","rDEYPT": "Wählen Sie die Organisation, aus der {email} entfernt werden soll. Der Zugriff auf alle Ressourcen dieser Organisation geht verloren.","jjTzIr": "Datenbank",+ "Wzg+A9": "Diese Anwendung konnte nicht geladen werden.",+ "oxcZjO": "Die Autorisierung konnte nicht abgeschlossen werden.",+ "A5gGeo": "Diese Autorisierungsanfrage ist ungültig. Stelle die Verbindung über deine Anwendung erneut her.",+ "0lnnIL": "Melde dich an, um deine Anwendung zu verbinden",+ "AyGauy": "Anmelden",+ "GZC9FV": "Diese Anwendung konnte nicht geladen werden. Stelle die Verbindung über deine Anwendung erneut her.",+ "j1jt9l": "Mit Rybbit verbinden",+ "v4/yBh": "{application} möchte auf dein Rybbit-Konto zugreifen.",+ "J43YCp": "Angeforderte Berechtigungen",+ "19AUAn": "Vollständiger API-Zugriff, einschließlich des Anzeigens von Analysedaten und der Änderungen, die deine Kontoberechtigungen erlauben.",+ "0dWy1F": "{resource}: anzeigen und Änderungen vornehmen",+ "ci6bnw": "{resource}: anzeigen",+ "V9fGSG": "Deine Kontoidentität und Profilinformationen lesen.",+ "+b6mhi": "Weiterhin auf dein Konto zugreifen, auch wenn du diese Anwendung nicht verwendest.",+ "OV9gJF": "Zusätzliche Profilinformationen: {claims}",+ "zKbV8g": "Verbinde nur Anwendungen, denen du vertraust. Der Zugriff ist auf die Websites und Organisationen beschränkt, die du nutzen kannst.",+ "172N3w": "Bitte warten...",+ "YXzlhm": "Zugriff erlauben","fcj5H7": "Öffentliche Analysen","qQ21OF": "Wenn aktiviert, kann jeder die Analysen ohne Anmeldung einsehen","u/sVSP": "Benutzer-ID-Salting aktivieren",@@ -1146,7 +1164,6 @@"Y++tIp": "Registrieren, um Einladung anzunehmen","BR9G0H": "{organization} beitreten","y9vcUt": "Sie wurden von {inviterEmail} eingeladen",- "AyGauy": "Anmelden","GM/hd6": "Einladung","1wGfyg": "Sie wurden von {inviterEmail} eingeladen, {organization} beizutreten","OMLaQO": "Wird angenommen...",diff --git a/client/messages/en.json b/client/messages/en.jsonindex adf0300b4..9111f7ecd 100644--- a/client/messages/en.json+++ b/client/messages/en.json@@ -1080,6 +1080,24 @@"J2wna+": "Remove user from organization?","rDEYPT": "Select the organization to remove {email} from. They will lose access to all resources in that organization.","jjTzIr": "Database",+ "Wzg+A9": "Unable to load this application.",+ "oxcZjO": "Unable to complete authorization.",+ "A5gGeo": "This authorization request is invalid. Reconnect from your application to try again.",+ "0lnnIL": "Sign in to connect your application",+ "AyGauy": "Login",+ "GZC9FV": "Unable to load this application. Reconnect from your application to try again.",+ "j1jt9l": "Connect to Rybbit",+ "v4/yBh": "{application} is requesting access to your Rybbit account.",+ "J43YCp": "Requested permissions",+ "19AUAn": "Full API access, including viewing analytics and making changes allowed by your account permissions.",+ "0dWy1F": "{resource}: view and make changes",+ "ci6bnw": "{resource}: view",+ "V9fGSG": "Read your account identity and profile information.",+ "+b6mhi": "Keep accessing your account when you are not using this application.",+ "OV9gJF": "Additional profile information: {claims}",+ "zKbV8g": "Only connect applications you trust. Access is limited to the sites and organizations you can use.",+ "172N3w": "Please wait...",+ "YXzlhm": "Allow access","fcj5H7": "Public Analytics","qQ21OF": "When enabled, anyone can view analytics without logging in","u/sVSP": "Enable User ID Salting",@@ -1146,7 +1164,6 @@"Y++tIp": "Sign Up to Accept Invitation","BR9G0H": "Join {organization}","y9vcUt": "You've been invited by {inviterEmail}",- "AyGauy": "Login","GM/hd6": "Invitation","1wGfyg": "You have been invited to join {organization} by {inviterEmail}","OMLaQO": "Accepting...",diff --git a/client/messages/es.json b/client/messages/es.jsonindex eb179755c..f05ab115f 100644--- a/client/messages/es.json+++ b/client/messages/es.json@@ -1080,6 +1080,24 @@"J2wna+": "¿Eliminar usuario de la organización?","rDEYPT": "Selecciona la organización de la que eliminar a {email}. Perderán acceso a todos los recursos en esa organización.","jjTzIr": "Base de datos",+ "Wzg+A9": "No se pudo cargar esta aplicación.",+ "oxcZjO": "No se pudo completar la autorización.",+ "A5gGeo": "Esta solicitud de autorización no es válida. Vuelve a conectarte desde tu aplicación para intentarlo de nuevo.",+ "0lnnIL": "Inicia sesión para conectar tu aplicación",+ "AyGauy": "Iniciar sesión",+ "GZC9FV": "No se pudo cargar esta aplicación. Vuelve a conectarte desde tu aplicación para intentarlo de nuevo.",+ "j1jt9l": "Conectar con Rybbit",+ "v4/yBh": "{application} solicita acceso a tu cuenta de Rybbit.",+ "J43YCp": "Permisos solicitados",+ "19AUAn": "Acceso completo a la API, incluida la consulta de datos analíticos y los cambios que permitan los permisos de tu cuenta.",+ "0dWy1F": "{resource}: ver y realizar cambios",+ "ci6bnw": "{resource}: ver",+ "V9fGSG": "Leer la identidad de tu cuenta y la información de tu perfil.",+ "+b6mhi": "Seguir accediendo a tu cuenta cuando no estés usando esta aplicación.",+ "OV9gJF": "Información adicional del perfil: {claims}",+ "zKbV8g": "Conecta solo aplicaciones en las que confíes. El acceso se limita a los sitios y las organizaciones que puedes utilizar.",+ "172N3w": "Espera un momento...",+ "YXzlhm": "Permitir acceso","fcj5H7": "Analíticas públicas","qQ21OF": "Cuando está habilitado, cualquiera puede ver las analíticas sin iniciar sesión","u/sVSP": "Activar Salting de ID de Usuario",@@ -1146,7 +1164,6 @@"Y++tIp": "Regístrate para aceptar la invitación","BR9G0H": "Únete a {organization}","y9vcUt": "Has sido invitado por {inviterEmail}",- "AyGauy": "Iniciar sesión","GM/hd6": "Invitación","1wGfyg": "Has sido invitado a unirte a {organization} por {inviterEmail}","OMLaQO": "Aceptando...",diff --git a/client/messages/fr.json b/client/messages/fr.jsonindex 350a3305f..b97714ee0 100644--- a/client/messages/fr.json+++ b/client/messages/fr.json@@ -1080,6 +1080,24 @@"J2wna+": "Retirer l'utilisateur de l'organisation ?","rDEYPT": "Sélectionnez l'organisation d'où retirer {email}. L'accès à toutes les ressources de cette organisation sera perdu.","jjTzIr": "Base de données",+ "Wzg+A9": "Impossible de charger cette application.",+ "oxcZjO": "Impossible de terminer l’autorisation.",+ "A5gGeo": "Cette demande d’autorisation est invalide. Relancez la connexion depuis votre application pour réessayer.",+ "0lnnIL": "Connectez-vous pour associer votre application",+ "AyGauy": "Connexion",+ "GZC9FV": "Impossible de charger cette application. Relancez la connexion depuis votre application pour réessayer.",+ "j1jt9l": "Se connecter à Rybbit",+ "v4/yBh": "{application} demande l’accès à votre compte Rybbit.",+ "J43YCp": "Autorisations demandées",+ "19AUAn": "Accès complet à l’API, y compris la consultation des données analytiques et les modifications permises par les autorisations de votre compte.",+ "0dWy1F": "{resource} : consulter et modifier",+ "ci6bnw": "{resource} : consulter",+ "V9fGSG": "Lire votre identité de compte et les informations de votre profil.",+ "+b6mhi": "Continuer à accéder à votre compte lorsque vous n’utilisez pas cette application.",+ "OV9gJF": "Informations de profil supplémentaires : {claims}",+ "zKbV8g": "Connectez uniquement des applications de confiance. L’accès est limité aux sites et aux organisations que vous pouvez utiliser.",+ "172N3w": "Veuillez patienter...",+ "YXzlhm": "Autoriser l’accès","fcj5H7": "Analyses publiques","qQ21OF": "Lorsque activé, n'importe qui peut voir les analyses sans se connecter","u/sVSP": "Activer le salage des ID utilisateur",@@ -1146,7 +1164,6 @@"Y++tIp": "Inscrivez-vous pour accepter l'invitation","BR9G0H": "Rejoindre {organization}","y9vcUt": "Vous avez été invité par {inviterEmail}",- "AyGauy": "Connexion","GM/hd6": "Invitation","1wGfyg": "Vous avez été invité par {inviterEmail} à rejoindre {organization}","OMLaQO": "Acceptation en cours...",diff --git a/client/messages/it.json b/client/messages/it.jsonindex d48a0c54f..2049a447a 100644--- a/client/messages/it.json+++ b/client/messages/it.json@@ -1080,6 +1080,24 @@"J2wna+": "Rimuovere l'utente dall'organizzazione?","rDEYPT": "Seleziona l'organizzazione da cui rimuovere {email}. Perderà l'accesso a tutte le risorse in quell'organizzazione.","jjTzIr": "Database",+ "Wzg+A9": "Impossibile caricare questa applicazione.",+ "oxcZjO": "Impossibile completare l’autorizzazione.",+ "A5gGeo": "Questa richiesta di autorizzazione non è valida. Riconnettiti dalla tua applicazione per riprovare.",+ "0lnnIL": "Accedi per collegare la tua applicazione",+ "AyGauy": "Accedi",+ "GZC9FV": "Impossibile caricare questa applicazione. Riconnettiti dalla tua applicazione per riprovare.",+ "j1jt9l": "Connetti a Rybbit",+ "v4/yBh": "{application} richiede l’accesso al tuo account Rybbit.",+ "J43YCp": "Autorizzazioni richieste",+ "19AUAn": "Accesso completo all’API, inclusa la consultazione dei dati analitici e le modifiche consentite dalle autorizzazioni del tuo account.",+ "0dWy1F": "{resource}: visualizzare e apportare modifiche",+ "ci6bnw": "{resource}: visualizzare",+ "V9fGSG": "Leggere l’identità del tuo account e le informazioni del tuo profilo.",+ "+b6mhi": "Continuare ad accedere al tuo account quando non utilizzi questa applicazione.",+ "OV9gJF": "Informazioni aggiuntive del profilo: {claims}",+ "zKbV8g": "Collega solo applicazioni di cui ti fidi. L’accesso è limitato ai siti e alle organizzazioni che puoi utilizzare.",+ "172N3w": "Attendi...",+ "YXzlhm": "Consenti accesso","fcj5H7": "Analisi Pubbliche","qQ21OF": "Se abilitato, chiunque può visualizzare le analisi senza accedere","u/sVSP": "Abilita Salting ID Utente",@@ -1146,7 +1164,6 @@"Y++tIp": "Registrati per Accettare l'Invito","BR9G0H": "Unisciti a {organization}","y9vcUt": "Sei stato invitato da {inviterEmail}",- "AyGauy": "Accedi","GM/hd6": "Invito","1wGfyg": "Sei stato invitato a unirti a {organization} da {inviterEmail}","OMLaQO": "Accettazione...",diff --git a/client/messages/ja.json b/client/messages/ja.jsonindex 672f99da0..0e725892a 100644--- a/client/messages/ja.json+++ b/client/messages/ja.json@@ -1080,6 +1080,24 @@"J2wna+": "ユーザーを組織から削除しますか?","rDEYPT": "{email}を削除する組織を選択してください。その組織のすべてのリソースへのアクセスが失われます。","jjTzIr": "データベース",+ "Wzg+A9": "このアプリケーションを読み込めませんでした。",+ "oxcZjO": "認可を完了できませんでした。",+ "A5gGeo": "この認可リクエストは無効です。アプリケーションから再接続して、もう一度お試しください。",+ "0lnnIL": "ログインしてアプリケーションを接続",+ "AyGauy": "ログイン",+ "GZC9FV": "このアプリケーションを読み込めませんでした。アプリケーションから再接続して、もう一度お試しください。",+ "j1jt9l": "Rybbit に接続",+ "v4/yBh": "{application} があなたの Rybbit アカウントへのアクセスをリクエストしています。",+ "J43YCp": "リクエストされた権限",+ "19AUAn": "分析データの閲覧や、アカウントの権限で許可されている変更を含む、API への完全なアクセス。",+ "0dWy1F": "{resource}:閲覧と変更",+ "ci6bnw": "{resource}:閲覧",+ "V9fGSG": "アカウントの識別情報とプロフィール情報を読み取ります。",+ "+b6mhi": "このアプリケーションを使用していない間も、アカウントにアクセスします。",+ "OV9gJF": "追加のプロフィール情報:{claims}",+ "zKbV8g": "信頼できるアプリケーションのみを接続してください。アクセスは、あなたが利用できるサイトと組織に限定されます。",+ "172N3w": "お待ちください...",+ "YXzlhm": "アクセスを許可","fcj5H7": "公開アナリティクス","qQ21OF": "有効にすると、ログインなしで誰でもアナリティクスを閲覧できます","u/sVSP": "ユーザーIDソルトを有効化",@@ -1146,7 +1164,6 @@"Y++tIp": "サインアップして招待を承認","BR9G0H": "{organization}に参加","y9vcUt": "{inviterEmail}からの招待です",- "AyGauy": "ログイン","GM/hd6": "招待","1wGfyg": "{inviterEmail}から{organization}への招待を受けました","OMLaQO": "承認中...",diff --git a/client/messages/ko.json b/client/messages/ko.jsonindex a8a7ce373..c9e3782c7 100644--- a/client/messages/ko.json+++ b/client/messages/ko.json@@ -1080,6 +1080,24 @@"J2wna+": "사용자를 조직에서 제거하시겠습니까?","rDEYPT": "{email}을(를) 제거할 조직을 선택하세요. 해당 조직의 모든 리소스에 대한 액세스를 잃게 됩니다.","jjTzIr": "데이터베이스",+ "Wzg+A9": "이 애플리케이션을 불러올 수 없습니다.",+ "oxcZjO": "권한 부여를 완료할 수 없습니다.",+ "A5gGeo": "이 권한 부여 요청은 유효하지 않습니다. 애플리케이션에서 다시 연결해 주세요.",+ "0lnnIL": "로그인하여 애플리케이션 연결",+ "AyGauy": "로그인",+ "GZC9FV": "이 애플리케이션을 불러올 수 없습니다. 애플리케이션에서 다시 연결해 주세요.",+ "j1jt9l": "Rybbit에 연결",+ "v4/yBh": "{application}에서 내 Rybbit 계정에 대한 접근 권한을 요청하고 있습니다.",+ "J43YCp": "요청된 권한",+ "19AUAn": "분석 데이터 조회 및 계정 권한으로 허용된 변경을 포함한 전체 API 접근 권한.",+ "0dWy1F": "{resource}: 조회 및 변경",+ "ci6bnw": "{resource}: 조회",+ "V9fGSG": "계정 식별 정보와 프로필 정보를 읽습니다.",+ "+b6mhi": "이 애플리케이션을 사용하지 않을 때도 계정에 계속 접근합니다.",+ "OV9gJF": "추가 프로필 정보: {claims}",+ "zKbV8g": "신뢰할 수 있는 애플리케이션만 연결하세요. 접근 범위는 내가 사용할 수 있는 사이트와 조직으로 제한됩니다.",+ "172N3w": "잠시 기다려 주세요...",+ "YXzlhm": "접근 허용","fcj5H7": "공개 분석","qQ21OF": "활성화하면 로그인 없이 누구나 분석을 볼 수 있습니다","u/sVSP": "사용자 ID 솔팅 활성화",@@ -1146,7 +1164,6 @@"Y++tIp": "가입하여 초대 수락","BR9G0H": "{organization}에 참여","y9vcUt": "{inviterEmail}님이 초대했습니다",- "AyGauy": "로그인","GM/hd6": "초대","1wGfyg": "{inviterEmail}님이 {organization}에 초대했습니다","OMLaQO": "수락 중...",diff --git a/client/messages/pl.json b/client/messages/pl.jsonindex d05177231..1eee5cdd1 100644--- a/client/messages/pl.json+++ b/client/messages/pl.json@@ -1080,6 +1080,24 @@"J2wna+": "Usunąć użytkownika z organizacji?","rDEYPT": "Wybierz organizację, z której chcesz usunąć {email}. Straci dostęp do wszystkich zasobów tej organizacji.","jjTzIr": "Baza danych",+ "Wzg+A9": "Nie udało się wczytać tej aplikacji.",+ "oxcZjO": "Nie udało się ukończyć autoryzacji.",+ "A5gGeo": "To żądanie autoryzacji jest nieprawidłowe. Ponownie nawiąż połączenie z poziomu aplikacji, aby spróbować jeszcze raz.",+ "0lnnIL": "Zaloguj się, aby połączyć aplikację",+ "AyGauy": "Logowanie",+ "GZC9FV": "Nie udało się wczytać tej aplikacji. Ponownie nawiąż połączenie z poziomu aplikacji, aby spróbować jeszcze raz.",+ "j1jt9l": "Połącz z Rybbit",+ "v4/yBh": "{application} prosi o dostęp do Twojego konta Rybbit.",+ "J43YCp": "Żądane uprawnienia",+ "19AUAn": "Pełny dostęp do API, w tym przeglądanie danych analitycznych i wprowadzanie zmian dozwolonych przez uprawnienia Twojego konta.",+ "0dWy1F": "{resource}: przeglądanie i wprowadzanie zmian",+ "ci6bnw": "{resource}: przeglądanie",+ "V9fGSG": "Odczytywanie tożsamości Twojego konta i informacji z profilu.",+ "+b6mhi": "Dalszy dostęp do Twojego konta, gdy nie korzystasz z tej aplikacji.",+ "OV9gJF": "Dodatkowe informacje z profilu: {claims}",+ "zKbV8g": "Łącz tylko zaufane aplikacje. Dostęp jest ograniczony do witryn i organizacji, z których możesz korzystać.",+ "172N3w": "Proszę czekać...",+ "YXzlhm": "Zezwól na dostęp","fcj5H7": "Publiczna analityka","qQ21OF": "Po włączeniu każdy może przeglądać analitykę bez logowania","u/sVSP": "Włącz solenie ID użytkownika",@@ -1146,7 +1164,6 @@"Y++tIp": "Zarejestruj się, aby zaakceptować zaproszenie","BR9G0H": "Dołącz do {organization}","y9vcUt": "Zostałeś zaproszony przez {inviterEmail}",- "AyGauy": "Logowanie","GM/hd6": "Zaproszenie","1wGfyg": "Zostałeś zaproszony do dołączenia do {organization} przez {inviterEmail}","OMLaQO": "Akceptowanie...",diff --git a/client/messages/pt.json b/client/messages/pt.jsonindex 8a960720f..485e32c15 100644--- a/client/messages/pt.json+++ b/client/messages/pt.json@@ -1080,6 +1080,24 @@"J2wna+": "Remover usuário da organização?","rDEYPT": "Selecione a organização da qual remover {email}. Ele perderá acesso a todos os recursos dessa organização.","jjTzIr": "Banco de dados",+ "Wzg+A9": "Não foi possível carregar este aplicativo.",+ "oxcZjO": "Não foi possível concluir a autorização.",+ "A5gGeo": "Esta solicitação de autorização é inválida. Reconecte pelo seu aplicativo para tentar novamente.",+ "0lnnIL": "Entre para conectar seu aplicativo",+ "AyGauy": "Entrar",+ "GZC9FV": "Não foi possível carregar este aplicativo. Reconecte pelo seu aplicativo para tentar novamente.",+ "j1jt9l": "Conectar ao Rybbit",+ "v4/yBh": "{application} está solicitando acesso à sua conta do Rybbit.",+ "J43YCp": "Permissões solicitadas",+ "19AUAn": "Acesso completo à API, incluindo a visualização de dados analíticos e as alterações permitidas pelas permissões da sua conta.",+ "0dWy1F": "{resource}: visualizar e fazer alterações",+ "ci6bnw": "{resource}: visualizar",+ "V9fGSG": "Ler a identidade da sua conta e as informações do seu perfil.",+ "+b6mhi": "Continuar acessando sua conta quando você não estiver usando este aplicativo.",+ "OV9gJF": "Informações adicionais do perfil: {claims}",+ "zKbV8g": "Conecte apenas aplicativos em que você confia. O acesso é limitado aos sites e às organizações que você pode usar.",+ "172N3w": "Aguarde...",+ "YXzlhm": "Permitir acesso","fcj5H7": "Análises Públicas","qQ21OF": "Quando ativado, qualquer pessoa pode visualizar as análises sem fazer login","u/sVSP": "Ativar Salting de ID de Usuário",@@ -1146,7 +1164,6 @@"Y++tIp": "Cadastre-se para Aceitar o Convite","BR9G0H": "Entrar em {organization}","y9vcUt": "Você foi convidado por {inviterEmail}",- "AyGauy": "Entrar","GM/hd6": "Convite","1wGfyg": "Você foi convidado para entrar em {organization} por {inviterEmail}","OMLaQO": "Aceitando...",diff --git a/client/messages/uk.json b/client/messages/uk.jsonindex b6cc22cd4..7936dcb20 100644--- a/client/messages/uk.json+++ b/client/messages/uk.json@@ -1080,6 +1080,24 @@"J2wna+": "Видалити користувача з організації?","rDEYPT": "Виберіть організацію, з якої потрібно видалити {email}. Вони втратять доступ до всіх ресурсів у цій організації.","jjTzIr": "База даних",+ "Wzg+A9": "Не вдалося завантажити цей застосунок.",+ "oxcZjO": "Не вдалося завершити авторизацію.",+ "A5gGeo": "Цей запит на авторизацію недійсний. Повторно підключіться зі свого застосунку, щоб спробувати ще раз.",+ "0lnnIL": "Увійдіть, щоб підключити застосунок",+ "AyGauy": "Увійти",+ "GZC9FV": "Не вдалося завантажити цей застосунок. Повторно підключіться зі свого застосунку, щоб спробувати ще раз.",+ "j1jt9l": "Підключити до Rybbit",+ "v4/yBh": "{application} запитує доступ до вашого облікового запису Rybbit.",+ "J43YCp": "Запитувані дозволи",+ "19AUAn": "Повний доступ до API, включно з переглядом аналітичних даних і внесенням змін, дозволених правами вашого облікового запису.",+ "0dWy1F": "{resource}: перегляд і внесення змін",+ "ci6bnw": "{resource}: перегляд",+ "V9fGSG": "Читати дані для ідентифікації вашого облікового запису та інформацію профілю.",+ "+b6mhi": "Продовжувати доступ до вашого облікового запису, коли ви не користуєтеся цим застосунком.",+ "OV9gJF": "Додаткова інформація профілю: {claims}",+ "zKbV8g": "Підключайте лише застосунки, яким довіряєте. Доступ обмежено сайтами та організаціями, якими ви можете користуватися.",+ "172N3w": "Зачекайте...",+ "YXzlhm": "Дозволити доступ","fcj5H7": "Публічна аналітика","qQ21OF": "Коли увімкнено, будь-хто зможе переглядати аналітику без входу в систему","u/sVSP": "Увімкнути додавання солі до ID користувачів (Salting)",@@ -1146,7 +1164,6 @@"Y++tIp": "Зареєструйтеся, щоб прийняти запрошення","BR9G0H": "Приєднатися до {organization}","y9vcUt": "Вас запросив {inviterEmail}",- "AyGauy": "Увійти","GM/hd6": "Запрошення","1wGfyg": "Вас було запрошено приєднатися до організації {organization} користувачем {inviterEmail}","OMLaQO": "Прийняття...",diff --git a/client/messages/zh.json b/client/messages/zh.jsonindex 8ba5591fa..0be1eb604 100644--- a/client/messages/zh.json+++ b/client/messages/zh.json@@ -1080,6 +1080,24 @@"J2wna+": "从组织中移除用户?","rDEYPT": "选择要从中移除 {email} 的组织。他们将失去对该组织中所有资源的访问权限。","jjTzIr": "数据库",+ "Wzg+A9": "无法加载此应用。",+ "oxcZjO": "无法完成授权。",+ "A5gGeo": "此授权请求无效。请从你的应用重新连接后再试。",+ "0lnnIL": "登录以连接你的应用",+ "AyGauy": "登录",+ "GZC9FV": "无法加载此应用。请从你的应用重新连接后再试。",+ "j1jt9l": "连接到 Rybbit",+ "v4/yBh": "{application} 正在请求访问你的 Rybbit 账户。",+ "J43YCp": "请求的权限",+ "19AUAn": "完整的 API 访问权限,包括查看分析数据以及执行你的账户权限所允许的更改。",+ "0dWy1F": "{resource}:查看和更改",+ "ci6bnw": "{resource}:查看",+ "V9fGSG": "读取你的账户身份和个人资料信息。",+ "+b6mhi": "在你未使用此应用时继续访问你的账户。",+ "OV9gJF": "其他个人资料信息:{claims}",+ "zKbV8g": "仅连接你信任的应用。访问范围仅限于你有权使用的网站和组织。",+ "172N3w": "请稍候...",+ "YXzlhm": "允许访问","fcj5H7": "公开分析","qQ21OF": "启用后,任何人都可以查看分析数据而无需登录","u/sVSP": "启用用户 ID 加盐",@@ -1146,7 +1164,6 @@"Y++tIp": "注册以接受邀请","BR9G0H": "加入 {organization}","y9vcUt": "您被 {inviterEmail} 邀请",- "AyGauy": "登录","GM/hd6": "邀请","1wGfyg": "您已受邀由 {inviterEmail} 加入 {organization}","OMLaQO": "正在接受...",diff --git a/client/package-lock.json b/client/package-lock.jsonindex 4a2f0aba5..59347e668 100644--- a/client/package-lock.json+++ b/client/package-lock.json@@ -8,8 +8,9 @@"name": "client","version": "2.8.0","dependencies": {- "@better-auth/api-key": "^1.6.25",- "@better-auth/core": "^1.6.25",+ "@better-auth/api-key": "1.7.3",+ "@better-auth/core": "1.7.3",+ "@better-auth/oauth-provider": "1.7.3","@calcom/embed-react": "^1.5.3","@hookform/resolvers": "5.0.1","@icons-pack/react-simple-icons": "^13.6.0",@@ -50,8 +51,8 @@"@types/papaparse": "^5.5.0","@uidotdev/usehooks": "2.4.1","axios": "^1.13.5",- "better-auth": "1.6.25",- "better-call": "^1.3.2",+ "better-auth": "1.7.3",+ "better-call": "1.4.0","class-variance-authority": "0.7.1","clsx": "2.1.1","cmdk": "^1.1.1",@@ -438,43 +439,42 @@}},"node_modules/@better-auth/api-key": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/api-key/-/api-key-1.6.25.tgz",- "integrity": "sha512-A6f3YLN8Ve+D4R7f8jrSKh8Mpu9+bmc8PIb9BFgGgspcedM1PjpSEI5JKAWPUhiGgMeJdCGeCpRP+27jQmW9/w==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/api-key/-/api-key-1.7.3.tgz",+ "integrity": "sha512-SY5IBK4YcxnQdyK6RAxSpze6Zfi2Emtp9c4BFl/FT0U7ZyBnKARKHFC1csf8kvtrbaMIIWUvcM9eeQW6OKUqRQ==","dependencies": {- "zod": "^4.3.6"+ "zod": "^4.5.4"},"peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2",- "better-auth": "^1.6.25",- "better-call": "1.3.7"+ "better-auth": "^1.7.3",+ "better-call": "1.4.0"}},"node_modules/@better-auth/api-key/node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/@better-auth/core": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/core/-/core-1.6.25.tgz",- "integrity": "sha512-lMTlhtwyK4NpY9kPF+2rQCRKYpg136d3gM2xl8esxT1PjJx5Nh5YwZvxcYCIjDuO759sx6TCloJTuwcZGG6ZBw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/core/-/core-1.7.3.tgz",+ "integrity": "sha512-JdP7lOkyE83jgjn7RilJj1XvZ7n2JjRsErKJuaXchjyuNo6cf1iVd3GtbhAtiUyJJkWdk8yL+LaUBKT80H0zLA==","dependencies": {- "@opentelemetry/semantic-conventions": "^1.39.0",+ "@opentelemetry/semantic-conventions": "^1.41.1","@standard-schema/spec": "^1.1.0",- "zod": "^4.3.6"+ "zod": "^4.5.4"},"peerDependencies": {"@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1","@cloudflare/workers-types": ">=4","@opentelemetry/api": "^1.9.0",- "better-call": "1.3.7",+ "better-call": "1.4.0","jose": "^6.1.0","kysely": "^0.28.5 || ^0.29.0","nanostores": "^1.0.1"@@ -495,22 +495,21 @@"license": "MIT"},"node_modules/@better-auth/core/node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/@better-auth/drizzle-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/drizzle-adapter/-/drizzle-adapter-1.6.25.tgz",- "integrity": "sha512-ru/DeKjFPQUVeKkxF/ScazmPqIY7lwfkAV5Yt4j24wmn1Y8vFwoiPRnHgXUeZqBs10+nubaRwEqLF39CP6EhRw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/drizzle-adapter/-/drizzle-adapter-1.7.3.tgz",+ "integrity": "sha512-S+nQRlxbUhkR43LrSv8c98ZvOvmv3nrtOnHkiZXkdDkr60PWp7maC2cqgzZ2C9exCC1a+4TugJlx2jRL+r+/9A==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2",- "drizzle-orm": "^0.45.2"+ "drizzle-orm": "^0.45.2 || >=1.0.0-rc.1 <2.0.0"},"peerDependenciesMeta": {"drizzle-orm": {@@ -519,11 +518,11 @@}},"node_modules/@better-auth/kysely-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/kysely-adapter/-/kysely-adapter-1.6.25.tgz",- "integrity": "sha512-zxiePhtN1YClS1irKYPVwWfN6kYp+QoYlz1hdQUOj8hXyo2aE/ny4RNAb6v332b0+U6Vu88EhYITRPdmvCo6uA==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/kysely-adapter/-/kysely-adapter-1.7.3.tgz",+ "integrity": "sha512-UIsyJMIrjUnT+yTaS6dkCxYYmtPwxFHxwSJ8+CLty2II5w9BewlDxDA0/QzhoL/InYCPxQ5Y6xIgLHZG1dhwRA==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","kysely": "^0.28.17 || ^0.29.0"},@@ -534,20 +533,20 @@}},"node_modules/@better-auth/memory-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/memory-adapter/-/memory-adapter-1.6.25.tgz",- "integrity": "sha512-GhEzTumc8yfTz+OZ6pMg06BA49xob49x1bX+1mEl/FStDJoSF+6mTfI5M2ytFxaiN89336/aUjkW8u+qRyLexw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/memory-adapter/-/memory-adapter-1.7.3.tgz",+ "integrity": "sha512-WdLANFY/QWC3G351RCzxU+Y9YlW+BQ1oG9NwBTSOUWQw5rZ87ws+weU8tvAMO7sQ4C9gKIlkOKBKUKXrSt91Tw==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2"}},"node_modules/@better-auth/mongo-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/mongo-adapter/-/mongo-adapter-1.6.25.tgz",- "integrity": "sha512-ZtMmjcOdXR2Ziqx5y8ptTOaNpe0snNfALbBUPXJsgeyeRkDJDYzyLZ8MpuvNBTNllNeIFDbiXWAK5k+pEBZrUQ==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/mongo-adapter/-/mongo-adapter-1.7.3.tgz",+ "integrity": "sha512-YL9m01tNogmFmRvOWJ46M9WwE6HirCXHDell29mtsQB/Qs1TPNLrgj7ybGMMGhQuyj6S218+8Wbls8m9s+i8RQ==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","mongodb": "^6.0.0 || ^7.0.0"},@@ -557,12 +556,38 @@}}},+ "node_modules/@better-auth/oauth-provider": {+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/oauth-provider/-/oauth-provider-1.7.3.tgz",+ "integrity": "sha512-Eoajj68F1ETmp4NBM98tgj1Uiip4cZiFqFsijAWIvOEQTejr/67PWK1/92N8PiNdLf03ezUWU538W93rd9fyIw==",+ "license": "MIT",+ "dependencies": {+ "jose": "^6.2.3",+ "zod": "^4.5.4"+ },+ "peerDependencies": {+ "@better-auth/core": "^1.7.3",+ "@better-auth/utils": "0.4.2",+ "@better-fetch/fetch": "1.3.1",+ "better-auth": "^1.7.3",+ "better-call": "1.4.0"+ }+ },+ "node_modules/@better-auth/oauth-provider/node_modules/zod": {+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },"node_modules/@better-auth/prisma-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/prisma-adapter/-/prisma-adapter-1.6.25.tgz",- "integrity": "sha512-ym7B6Iqcry+/4aQnYpFwqP/GBIiXvjrm/5B6+0qmx8mkTY/apHFTpHuGzUYYNf4vPTtzF3eYY2+s2GOsomKaRg==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/prisma-adapter/-/prisma-adapter-1.7.3.tgz",+ "integrity": "sha512-TJ/DhlU7oLzrC626/1wfYA1Pl+lVsXa/zXBZ8d7Rlc2YO5fGd5fsAYJdRrYMyA51iZEo+rWLXMhZ0cez1BamsQ==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0","prisma": "^5.0.0 || ^6.0.0 || ^7.0.0"@@ -577,11 +602,11 @@}},"node_modules/@better-auth/telemetry": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/telemetry/-/telemetry-1.6.25.tgz",- "integrity": "sha512-2ZfC9lp7tU6Jw/q2Lz/bKfQqGMdMwc/IQDTYdBhvtGi24qInYVnhp2ZCW57hHM9j+fq1ULOtxgg6M3T1LEaihw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/telemetry/-/telemetry-1.7.3.tgz",+ "integrity": "sha512-aixgHbJhGvS8PRczX/LR3murYyBnIvOGmJw37ZZBMg6ZtLR/UBJAkufbDi1HYn5THSuTJ3D5DtY85Ahh/ABQtw==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1"}@@ -590,7 +615,6 @@"version": "0.4.2","resolved": "https://registry.npmjs.org/@better-auth/utils/-/utils-0.4.2.tgz","integrity": "sha512-AUxrvu+HaaODsUyzDxFgwd/8RZ1yZaYo42LXKSrU2oGgR38pS1ij8nqQKNgtTWoYGpNevNXtCfgTy6loHveW9A==",- "license": "MIT","dependencies": {"@noble/hashes": "^2.0.1"}@@ -598,8 +622,7 @@"node_modules/@better-fetch/fetch": {"version": "1.3.1","resolved": "https://registry.npmjs.org/@better-fetch/fetch/-/fetch-1.3.1.tgz",- "integrity": "sha512-ABkD1WhyfPZprKRQI3bhATjeiFuNWC9PXhfGWqL+sg/gKrM977oFrYkdb4msM3hgUGonr7KlOsOFT5TU2rht9g==",- "license": "MIT"+ "integrity": "sha512-ABkD1WhyfPZprKRQI3bhATjeiFuNWC9PXhfGWqL+sg/gKrM977oFrYkdb4msM3hgUGonr7KlOsOFT5TU2rht9g=="},"node_modules/@bramus/specificity": {"version": "2.4.2",@@ -2590,10 +2613,9 @@}},"node_modules/@noble/ciphers": {- "version": "2.1.1",- "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.1.1.tgz",- "integrity": "sha512-bysYuiVfhxNJuldNXlFEitTVdNnYUc+XNJZd7Qm2a5j1vZHgY+fazadNFWFaMK/2vye0JVlxV3gHmC0WDfAOQw==",- "license": "MIT",+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.4.0.tgz",+ "integrity": "sha512-AnjFn0Jv92laAkvMrghlFZq4qQCIN/4DxFV/eooqtC2YTjB7kBeLMS2T9KJX4Dn+ZVXLOwK0lSgqDtx9gvxtiw==","engines": {"node": ">= 20.19.0"},@@ -2602,10 +2624,9 @@}},"node_modules/@noble/hashes": {- "version": "2.0.1",- "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz",- "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==",- "license": "MIT",+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.4.0.tgz",+ "integrity": "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA==","engines": {"node": ">= 20.19.0"},@@ -7823,27 +7844,27 @@}},"node_modules/better-auth": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/better-auth/-/better-auth-1.6.25.tgz",- "integrity": "sha512-fvoq+oCO+FF5fpP3XfU7znRyGFpHB77UG2EyxsKNy+Cak7Q5pELu+auvvDveQbWQxcoKugZ7jYQQPFQLpUTGOw==",- "dependencies": {- "@better-auth/core": "1.6.25",- "@better-auth/drizzle-adapter": "1.6.25",- "@better-auth/kysely-adapter": "1.6.25",- "@better-auth/memory-adapter": "1.6.25",- "@better-auth/mongo-adapter": "1.6.25",- "@better-auth/prisma-adapter": "1.6.25",- "@better-auth/telemetry": "1.6.25",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/better-auth/-/better-auth-1.7.3.tgz",+ "integrity": "sha512-8xGp68JQ+l36kniDEgP8bP99TLi1GdEv0NTEUBkyqnYnus/cgFUZseUfqUHKzr2BAsg2O6aD88I9f0U68shanQ==",+ "dependencies": {+ "@better-auth/core": "1.7.3",+ "@better-auth/drizzle-adapter": "1.7.3",+ "@better-auth/kysely-adapter": "1.7.3",+ "@better-auth/memory-adapter": "1.7.3",+ "@better-auth/mongo-adapter": "1.7.3",+ "@better-auth/prisma-adapter": "1.7.3",+ "@better-auth/telemetry": "1.7.3","@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1",- "@noble/ciphers": "^2.1.1",- "@noble/hashes": "^2.0.1",- "better-call": "1.3.7",+ "@noble/ciphers": "^2.2.0",+ "@noble/hashes": "^2.2.0",+ "better-call": "1.4.0","defu": "^6.1.4",- "jose": "^6.1.3",+ "jose": "^6.2.3","kysely": "^0.28.17 || ^0.29.0",- "nanostores": "^1.1.1",- "zod": "^4.3.6"+ "nanostores": "^1.3.0",+ "zod": "^4.5.4"},"peerDependencies": {"@lynx-js/react": "*",@@ -7852,8 +7873,8 @@"@tanstack/react-start": "^1.0.0","@tanstack/solid-start": "^1.0.0","better-sqlite3": "^12.0.0",- "drizzle-kit": ">=0.31.4",- "drizzle-orm": "^0.45.2",+ "drizzle-kit": ">=0.31.4 || >=1.0.0-beta.1",+ "drizzle-orm": "^0.45.2 || >=1.0.0-rc.1 <2.0.0","mongodb": "^6.0.0 || ^7.0.0","mysql2": "^3.0.0","next": "^14.0.0 || ^15.0.0 || ^16.0.0",@@ -7927,24 +7948,22 @@}},"node_modules/better-auth/node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/better-call": {- "version": "1.3.7",- "resolved": "https://registry.npmjs.org/better-call/-/better-call-1.3.7.tgz",- "integrity": "sha512-Al51/hjp2SSp6CRTa3F2ptcx4yQVS1xWKoY6jcVXqNYOap6mHFP2jUBn5EwIL4iIed1/Sq4hlQ+Umm6EflZG+w==",- "license": "MIT",+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/better-call/-/better-call-1.4.0.tgz",+ "integrity": "sha512-bBKOT4vv1kZLDgxVePdilk/Jwkn+dtRRsmi3DzHcDP+WnswyVl6dR59l2HEeP/0cB+bDoopASAesWDPIdd/zZA==","dependencies": {- "@better-auth/utils": "^0.4.0",- "@better-fetch/fetch": "^1.1.21",- "rou3": "^0.7.12",- "set-cookie-parser": "^3.0.1"+ "@better-auth/utils": "^0.5.0",+ "@better-fetch/fetch": "^1.3.1",+ "rou3": "^0.9.1",+ "set-cookie-parser": "^3.1.2"},"peerDependencies": {"zod": "^4.0.0"@@ -7955,6 +7974,14 @@}}},+ "node_modules/better-call/node_modules/@better-auth/utils": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/@better-auth/utils/-/utils-0.5.0.tgz",+ "integrity": "sha512-BL8W4EfIZFwlu0r54m3v1ztjDhu6dDe/amLTm0xybmbZaNgYUqhD3SjpAsnq0q8YD6/ki4iwIgxJNLP/N3TxiA==",+ "dependencies": {+ "@noble/hashes": "^2.0.1"+ }+ },"node_modules/bidi-js": {"version": "1.0.3","resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz",@@ -11119,10 +11146,9 @@}},"node_modules/jose": {- "version": "6.2.2",- "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.2.tgz",- "integrity": "sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ==",- "license": "MIT",+ "version": "6.2.12",+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.12.tgz",+ "integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==","funding": {"url": "https://github.com/sponsors/panva"}@@ -12054,16 +12080,15 @@}},"node_modules/nanostores": {- "version": "1.2.0",- "resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.2.0.tgz",- "integrity": "sha512-F0wCzbsH80G7XXo0Jd9/AVQC7ouWY6idUCTnMwW5t/Rv9W8qmO6endavDwg7TNp5GbugwSukFMVZqzPSrSMndg==",+ "version": "1.5.3",+ "resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.5.3.tgz",+ "integrity": "sha512-rQLB6eV4f2AW/n3L0JmwCROpaisYy9EDEADvEFSd1C/qG8hB6O5TPlh9A791JRbJr4CnMQBzptDcvD9OR1+6WA==","funding": [{"type": "github","url": "https://github.com/sponsors/ai"}],- "license": "MIT","engines": {"node": "^20.0.0 || >=22.0.0"}@@ -13413,10 +13438,9 @@}},"node_modules/rou3": {- "version": "0.7.12",- "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.7.12.tgz",- "integrity": "sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg==",- "license": "MIT"+ "version": "0.9.2",+ "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.9.2.tgz",+ "integrity": "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ=="},"node_modules/rrdom": {"version": "2.0.0-alpha.20",@@ -13604,10 +13628,9 @@}},"node_modules/set-cookie-parser": {- "version": "3.0.1",- "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-3.0.1.tgz",- "integrity": "sha512-n7Z7dXZhJbwuAHhNzkTti6Aw9QDDjZtm3JTpTGATIdNzdQz5GuFs22w90BcvF4INfnrL5xrX3oGsuqO5Dx3A1Q==",- "license": "MIT"+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-3.1.2.tgz",+ "integrity": "sha512-5/r/lTwbJ3zQ+qwdUFZYeRNqda7P5HD8zQKqlSjdGt1/S0cjLAphHusj4Y58ahDtWn/g32xrIS58/ikOvwl0Lw=="},"node_modules/set-function-length": {"version": "1.2.2",diff --git a/client/package.json b/client/package.jsonindex e73939a7d..dbc685450 100644--- a/client/package.json+++ b/client/package.json@@ -15,8 +15,9 @@"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\""},"dependencies": {- "@better-auth/api-key": "^1.6.25",- "@better-auth/core": "^1.6.25",+ "@better-auth/api-key": "1.7.3",+ "@better-auth/core": "1.7.3",+ "@better-auth/oauth-provider": "1.7.3","@calcom/embed-react": "^1.5.3","@hookform/resolvers": "5.0.1","@icons-pack/react-simple-icons": "^13.6.0",@@ -57,8 +58,8 @@"@types/papaparse": "^5.5.0","@uidotdev/usehooks": "2.4.1","axios": "^1.13.5",- "better-auth": "1.6.25",- "better-call": "^1.3.2",+ "better-auth": "1.7.3",+ "better-call": "1.4.0","class-variance-authority": "0.7.1","clsx": "2.1.1","cmdk": "^1.1.1",diff --git a/client/src/app/auth/consent/page.test.tsx b/client/src/app/auth/consent/page.test.tsxnew file mode 100644index 000000000..b891d58e3--- /dev/null+++ b/client/src/app/auth/consent/page.test.tsx@@ -0,0 +1,81 @@+import React from "react";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ consent: vi.fn(),+ publicClient: vi.fn(),+ session: { data: { user: { email: "[email protected]" } } as { user: { email: string } } | null, isPending: false },+ query: "client_id=test-client&scope=openid+analytics%3Aread&sig=signed-request&exp=9999999999",+}));++vi.mock("next-intl", () => ({+ useExtracted:+ () =>+ (message: string, values: Record<string, string> = {}) =>+ message.replace(/\{(\w+)\}/g, (_, key: string) => values[key] ?? key),+}));+vi.mock("next/navigation", () => ({ useSearchParams: () => new URLSearchParams(mocks.query) }));+vi.mock("@/lib/auth", () => ({+ authClient: {+ useSession: () => mocks.session,+ oauth2: { consent: mocks.consent, publicClient: mocks.publicClient },+ },+}));+vi.mock("@/components/RybbitLogo", () => ({ RybbitTextLogo: () => <span>Rybbit</span> }));++import ConsentPage from "./page";++function showPage() {+ return render(+ <QueryClientProvider client={new QueryClient({ defaultOptions: { queries: { retry: false } } })}>+ <ConsentPage />+ </QueryClientProvider>+ );+}++beforeEach(() => {+ mocks.session.data = { user: { email: "[email protected]" } };+ mocks.query = "client_id=test-client&scope=openid+analytics%3Aread&sig=signed-request&exp=9999999999";+ mocks.publicClient.mockResolvedValue({ data: { client_name: "Test application" } });+ mocks.consent.mockResolvedValue({ error: { message: "Request expired. Reconnect to try again." } });+});+afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe("OAuth consent", () => {+ it("shows the registered client and requested access, and requires an explicit decision", async () => {+ showPage();+ expect(await screen.findByText("Test application is requesting access to your Rybbit account.")).toBeTruthy();+ expect(screen.getByText("Analytics: view")).toBeTruthy();+ expect(mocks.consent).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole("button", { name: "Allow access" }));+ await waitFor(() => expect(mocks.consent).toHaveBeenCalledWith({ accept: true }));+ expect(await screen.findByText("Request expired. Reconnect to try again.")).toBeTruthy();+ expect((screen.getByRole("button", { name: "Allow access" }) as HTMLButtonElement).disabled).toBe(false);+ });++ it("sends rejection to the provider when the user cancels", async () => {+ showPage();+ fireEvent.click(await screen.findByRole("button", { name: "Cancel" }));+ await waitFor(() => expect(mocks.consent).toHaveBeenCalledWith({ accept: false }));+ });++ it("preserves the signed OAuth request when asking a signed-out user to log in", () => {+ mocks.session.data = null;+ showPage();+ expect(screen.getByRole("link", { name: "Login" }).getAttribute("href")).toBe(`/login?${mocks.query}`);+ expect(mocks.publicClient).not.toHaveBeenCalled();+ });++ it("never offers authorization for a malformed request", () => {+ mocks.query = "client_id=test-client&redirect_uri=https://attacker.example";+ showPage();+ expect(screen.getByText(/This authorization request is invalid/)).toBeTruthy();+ expect(screen.queryByRole("button", { name: "Allow access" })).toBeNull();+ expect(mocks.publicClient).not.toHaveBeenCalled();+ });+});diff --git a/client/src/app/auth/consent/page.tsx b/client/src/app/auth/consent/page.tsxnew file mode 100644index 000000000..87e6e7d9d--- /dev/null+++ b/client/src/app/auth/consent/page.tsx@@ -0,0 +1,151 @@+"use client";++import { RybbitTextLogo } from "@/components/RybbitLogo";+import { AuthError } from "@/components/auth/AuthError";+import { Button } from "@/components/ui/button";+import { authClient } from "@/lib/auth";+import { getScopeLabel } from "@/app/settings/account/components/ApiKeyScopePicker";+import { useQuery } from "@tanstack/react-query";+import { useExtracted } from "next-intl";+import Link from "next/link";+import { useSearchParams } from "next/navigation";+import { Suspense, useState } from "react";++function Consent() {+ const t = useExtracted();+ const params = useSearchParams();+ const clientId = params.get("client_id");+ const validRequest = Boolean(clientId && params.get("sig") && params.get("exp"));+ const scopes = (params.get("scope") ?? "").split(/\s+/).filter(Boolean);+ const customScopes = scopes.filter(scope => !["openid", "profile", "email", "offline_access"].includes(scope));+ let requestedClaims: string[] = [];+ try {+ requestedClaims = Object.keys(JSON.parse(params.get("claims") || "{}").userinfo || {});+ } catch {+ // Malformed or modified claims are rejected by the provider's signature+ // validation. Do not try to repair an invalid authorization request.+ }+ const { data: session, isPending: sessionPending } = authClient.useSession();+ const [pending, setPending] = useState(false);+ const [error, setError] = useState<string>();+ const client = useQuery({+ queryKey: ["oauth-consent-client", clientId],+ enabled: validRequest && Boolean(session),+ retry: false,+ queryFn: async () => {+ const result = await authClient.oauth2.publicClient({ query: { client_id: clientId! } });+ if (result.error) throw new Error(result.error.message || t("Unable to load this application."));+ return result.data;+ },+ });++ async function respond(accept: boolean) {+ setPending(true);+ setError(undefined);+ try {+ // The provider verifies the signed query and registered redirect URI.+ // Never navigate directly to redirect_uri supplied in the page URL.+ const result = await authClient.oauth2.consent({ accept });+ if (result.error) throw new Error(result.error.message || t("Unable to complete authorization."));+ if (result.data?.url) {+ window.location.assign(result.data.url);+ return;+ }+ throw new Error(t("Unable to complete authorization."));+ } catch (cause) {+ setError(cause instanceof Error ? cause.message : t("Unable to complete authorization."));+ setPending(false);+ }+ }++ if (!validRequest)+ return (+ <AuthError error={t("This authorization request is invalid. Reconnect from your application to try again.")} />+ );+ if (sessionPending) return <p role="status">{t("Loading...")}</p>;+ if (!session) {+ return (+ <div className="space-y-4">+ <h1 className="text-xl font-semibold">{t("Sign in to connect your application")}</h1>+ <Button asChild>+ <Link href={`/login?${params.toString()}`}>{t("Login")}</Link>+ </Button>+ </div>+ );+ }+ if (client.isPending) return <p role="status">{t("Loading...")}</p>;+ if (client.error || !client.data)+ return <AuthError error={t("Unable to load this application. Reconnect from your application to try again.")} />;++ return (+ <div className="space-y-6">+ <div className="space-y-2">+ <h1 className="text-xl font-semibold">{t("Connect to Rybbit")}</h1>+ <p className="break-words text-neutral-600 dark:text-neutral-300">+ {t("{application} is requesting access to your Rybbit account.", {+ application: client.data.client_name || clientId!,+ })}+ </p>+ <p className="break-all text-sm text-neutral-600 dark:text-neutral-300">{session.user.email}</p>+ </div>+ <div className="space-y-3">+ <h2 className="font-medium">{t("Requested permissions")}</h2>+ {customScopes.length === 0 ? (+ <p>+ {t("Full API access, including viewing analytics and making changes allowed by your account permissions.")}+ </p>+ ) : (+ <ul className="list-disc space-y-1 pl-5">+ {customScopes.map(scope => {+ const [resource, action] = scope.split(":");+ const label = getScopeLabel(resource);+ return (+ <li key={scope} className="break-words">+ {action === "write"+ ? t("{resource}: view and make changes", { resource: label })+ : action === "read"+ ? t("{resource}: view", { resource: label })+ : scope}+ </li>+ );+ })}+ </ul>+ )}+ {scopes.some(scope => ["openid", "profile", "email"].includes(scope)) && (+ <p className="text-sm">{t("Read your account identity and profile information.")}</p>+ )}+ {scopes.includes("offline_access") && (+ <p className="text-sm">{t("Keep accessing your account when you are not using this application.")}</p>+ )}+ {requestedClaims.length > 0 && (+ <p className="break-words text-sm">+ {t("Additional profile information: {claims}", { claims: requestedClaims.join(", ") })}+ </p>+ )}+ <p className="text-sm text-neutral-600 dark:text-neutral-300">+ {t("Only connect applications you trust. Access is limited to the sites and organizations you can use.")}+ </p>+ </div>+ <AuthError error={error} />+ <div className="flex flex-wrap gap-3">+ <Button variant="success" disabled={pending} onClick={() => respond(true)}>+ {pending ? t("Please wait...") : t("Allow access")}+ </Button>+ <Button disabled={pending} onClick={() => respond(false)}>+ {t("Cancel")}+ </Button>+ </div>+ </div>+ );+}++export default function ConsentPage() {+ return (+ <main className="mx-auto flex min-h-dvh w-full max-w-lg flex-col justify-center gap-8 px-6 py-12">+ <RybbitTextLogo />+ <Suspense>+ <Consent />+ </Suspense>+ </main>+ );+}diff --git a/client/src/components/AuthenticationGuard.tsx b/client/src/components/AuthenticationGuard.tsxindex 9675fba02..0ebff8213 100644--- a/client/src/components/AuthenticationGuard.tsx+++ b/client/src/components/AuthenticationGuard.tsx@@ -5,7 +5,7 @@ import { redirect, usePathname } from "next/navigation";import { userStore } from "../lib/userStore";import { useGetSiteIsPublic } from "../api/admin/hooks/useSites";-const PUBLIC_ROUTES = ["/login", "/signup", "/invitation", "/reset-password", "/as/callback"];+const PUBLIC_ROUTES = ["/login", "/signup", "/invitation", "/reset-password", "/as/callback", "/auth/consent"];export function AuthenticationGuard() {const { user, isPending } = userStore();diff --git a/client/src/lib/auth.ts b/client/src/lib/auth.tsindex 8ddec2223..d968aca41 100644--- a/client/src/lib/auth.ts+++ b/client/src/lib/auth.ts@@ -1,6 +1,7 @@import { adminClient, organizationClient, emailOTPClient } from "better-auth/client/plugins";-import { apiKeyClient } from "@better-auth/api-key/client"+import { apiKeyClient } from "@better-auth/api-key/client";import { createAuthClient } from "better-auth/react";+import { oauthProviderClient } from "@better-auth/oauth-provider/client";const invitationSiteAccessFields = {hasRestrictedSiteAccess: {@@ -17,16 +18,22 @@ const invitationSiteAccessFields = {export const authClient = createAuthClient({baseURL: process.env.NEXT_PUBLIC_BACKEND_URL,- plugins: [adminClient(), organizationClient({- teams: {- enabled: true,- },- schema: {- invitation: {- additionalFields: invitationSiteAccessFields,+ plugins: [+ adminClient(),+ organizationClient({+ teams: {+ enabled: true,},- },- }), emailOTPClient(), apiKeyClient()],+ schema: {+ invitation: {+ additionalFields: invitationSiteAccessFields,+ },+ },+ }),+ emailOTPClient(),+ apiKeyClient(),+ oauthProviderClient(),+ ],fetchOptions: {credentials: "include",},diff --git a/server/docs/better-auth-1.7.3.md b/server/docs/better-auth-1.7.3.mdnew file mode 100644index 000000000..1be1a55d6--- /dev/null+++ b/server/docs/better-auth-1.7.3.md@@ -0,0 +1,127 @@+# Better Auth 1.7.3 migration++This upgrade moves the client, server, API key and SSO packages from 1.6.25 to+1.7.3. MCP OAuth now uses `@better-auth/mcp`, `@better-auth/oauth-provider` and+the JWT plugin, with an explicit consent page at `/auth/consent`.+`@better-auth/infra` keeps its separate 0.1.x version. The MCP SDK and stateless+transport remain on their existing versions; dynamic client registration stays+enabled.++## Database and cutover++Migration `0018_better_auth_173.sql` is additive. It creates the OAuth/JWT tables,+copies registered clients, hashes their previously plaintext secrets, and adds+team membership keys and member counts. Counts are backfilled; existing nullable+membership keys use Better Auth's compatibility lookup. New memberships use the+same key calculation as Better Auth.++Auth uses the native PostgreSQL/Kysely adapter, so its array fields are stored+as JSONB. Drizzle's native PostgreSQL arrays are not compatible with that+adapter's serialization. The Drizzle schema and snapshot reflect this.++1. Back up PostgreSQL and record the current application version. Run only the+ opening `DO` block from migration 0018 as a read-only preflight: it checks+ duplicate account identities and parses every nonempty legacy client metadata+ value with PostgreSQL's JSON parser. Fix any reported record before cutover.+2. Stop the old backend workers before migrating. Client registrations and team+ membership changes must not race the data copy and count backfill.+3. Apply migration 0018 with the existing file-based migration runner. The Docker+ backend entrypoint already runs `npm run db:migrate` before starting. For a+ manual deployment, run that command from `server/` against the deployment's+ database before starting the new backend.+4. Deploy the matching client and server. Keep `BASE_URL` set to the public site+ origin and keep the existing `BETTER_AUTH_SECRET`. OAuth requires HTTPS, with+ an exception for HTTP loopback during development. Plain HTTP LAN deployments+ keep session and API key authentication but do not enable OAuth.+5. Check password login, Google/GitHub sign-in where configured, existing+ sessions/API keys, team updates, and an MCP connection through discovery,+ login, consent and a tool call. Sign out of the linked session and confirm+ its MCP bearer is rejected on the next request. The explicit `BASE_URL` must+ produce the registered `/api/auth/callback/google` and+ `/api/auth/callback/github` URLs; check this in both development and production.++No live database migration is part of preparing this change.++The migration stops before schema writes if accounts contain duplicate+`(providerId, accountId)` pairs or legacy OAuth client metadata is invalid JSON.+The metadata error identifies the affected `oauthApplication.id` without logging+its contents. Resolve these records explicitly before retrying. Do not apply an+account `issuer` backfill from the 1.7.0–1.7.2 instructions: upstream reverted+that migration in 1.7.3.++## MCP client behavior++- Existing OAuth clients must reconnect and approve fresh consent. Old access+ tokens, refresh tokens and consent are retained in the legacy tables but are+ not accepted by the new provider. Password sessions and API keys are not+ rewritten by this migration.+- Registered client IDs and redirect URIs are preserved. Imported confidential+ clients use `client_secret_basic`; the old schema did not record their token+ authentication method. Clients that previously posted a secret must switch to+ HTTP Basic or register again with their intended method.+- New native clients with loopback redirects must register+ `application_type: "native"` and `token_endpoint_auth_method: "none"`.+ Other public clients must also explicitly send+ `token_endpoint_auth_method: "none"`. Omitting it now creates a confidential client using+ `client_secret_basic`, even for unauthenticated registration. Such a client+ receives a secret and must authenticate with it or subsequent token requests+ fail with `invalid_client`.+- Discovery advertises the new `/api/auth/oauth2/*` endpoints. Clients caching+ the old endpoints should rediscover the server.+- Resource tokens are verified for signature, issuer, expiry, audience,+ client state and validity of the linked session. These Bearer routes reject+ proof-bound tokens.+ The single resource remains `<BASE_URL>/api/mcp`; per-client resource join+ enforcement is disabled so imported clients can request it.+- Access tokens are JWTs with the upstream default lifetime of one hour. There+ is no per-access-token database revocation check: `/oauth2/revoke` rejects JWT+ access tokens with `unsupported_token_type`. Revoking a refresh token prevents+ future refreshes but leaves already-issued access JWTs valid until expiry.+ Deleting or disabling the OAuth client, or signing out of the linked session,+ makes those JWTs fail verification. Do not describe a refresh-token revocation+ or consent deletion as immediately disconnecting existing access tokens.+- Existing scope semantics remain: a grant with only standard OIDC scopes has+ full API access within the user's permissions. The consent page states this+ explicitly. Custom scopes narrow that access.++## Rollback++The old OAuth tables remain available, and the new columns are additive. A+rollback needs a coordinated stop of the new workers before restoring the old+application version. New client registrations and consent are not copied back;+those clients will need to register or reconnect again. Old tokens retained in+the legacy tables can become usable again under the old binary, including tokens+whose corresponding access was revoked after cutover. Account for those grants+before restoring OAuth traffic. Recompute team member counts before returning+to 1.7 after any period of running 1.6.++## Verification++The team's internal `memberCount` reservation counter can drift after user+deletions that cascade to memberships. Rybbit's team lists read the membership+rows, and `maximumMembersPerTeam` is not configured. Reconcile this counter on+all deletion paths before enabling that limit; it is not an authoritative count+for reporting. This remains a follow-up rather than a cutover requirement.++The disposable PostgreSQL integration test applies every migration through 0018+using the production Kysely adapter. It checks client migration and secret+hashing, duplicate-account and malformed-metadata rejection, discovery, signed+consent, PKCE token exchange, refresh and its revocation, JWT revocation limits,+bearer verification, sign-out revocation, pre-migration+sessions/API keys, team keys and email OTP password recovery. Client tests cover+consent, rejection, error retry and preservation of the signed login query.++Validation used Node 24: the server suite passed with four workers, the client+suite passed, both packages type-checked, and the client production build passed+with `npm run build -- --webpack`. A headless browser check also exercised the+real client plugin's signed-query submission and the mobile consent layout.+Local Turbopack builds cannot resolve the existing `@rybbit/shared` symlink+outside the client root; the production Dockerfile already materializes that+package before building. `npm run lint` is blocked by the existing empty ESLint+configuration scanning generated `.next` files and encountering undefined rules.+The 17 new consent messages are translated in all 11 non-English locales, with+their interpolation placeholders and existing translations preserved.++Upstream references: [1.7 upgrade guide](https://better-auth.com/docs/guides/1-7-upgrade-guide),+[MCP plugin](https://better-auth.com/docs/plugins/mcp), and+[changelog](https://better-auth.com/changelog).diff --git a/server/drizzle/0018_better_auth_173.sql b/server/drizzle/0018_better_auth_173.sqlnew file mode 100644index 000000000..78499fa5c--- /dev/null+++ b/server/drizzle/0018_better_auth_173.sql@@ -0,0 +1,244 @@+-- Idempotent: every step is guarded so a partial or repeated run converges on+-- the same schema without erroring or duplicating rows.+-- Refuse ambiguous identities rather than silently merging different users.+DO $$+DECLARE legacy_client record;+BEGIN+ IF EXISTS (SELECT 1 FROM account GROUP BY "providerId", "accountId" HAVING count(*) > 1) THEN+ RAISE EXCEPTION 'Better Auth 1.7: resolve duplicate account (providerId, accountId) pairs before migrating';+ END IF;+ -- Validate with PostgreSQL's JSON parser before any schema writes. A prefix+ -- regex would miss malformed objects and incorrectly reject JSON scalars.+ FOR legacy_client IN+ SELECT id, metadata FROM "oauthApplication" WHERE NULLIF(metadata, '') IS NOT NULL+ LOOP+ BEGIN+ PERFORM legacy_client.metadata::jsonb;+ EXCEPTION WHEN data_exception THEN+ RAISE EXCEPTION 'Better Auth 1.7: resolve invalid JSON metadata for oauthApplication id % before migrating', legacy_client.id;+ END;+ END LOOP;+END $$;+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "jwks" (+ "id" text PRIMARY KEY NOT NULL,+ "publicKey" text NOT NULL,+ "privateKey" text NOT NULL,+ "createdAt" timestamp NOT NULL,+ "expiresAt" timestamp,+ "alg" text,+ "crv" text+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthAccessTokenV2" (+ "id" text PRIMARY KEY NOT NULL,+ "token" text NOT NULL,+ "clientId" text NOT NULL,+ "sessionId" text,+ "userId" text,+ "referenceId" text,+ "authorizationCodeId" text,+ "resources" jsonb,+ "requestedUserInfoClaims" jsonb,+ "refreshId" text,+ "expiresAt" timestamp NOT NULL,+ "createdAt" timestamp NOT NULL,+ "revoked" timestamp,+ "confirmation" jsonb,+ "scopes" jsonb NOT NULL,+ CONSTRAINT "oauthAccessTokenV2_token_unique" UNIQUE("token")+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthClient" (+ "id" text PRIMARY KEY NOT NULL,+ "clientId" text NOT NULL,+ "clientSecret" text,+ "clientDiscoveryId" text,+ "disabled" boolean DEFAULT false,+ "skipConsent" boolean,+ "enableEndSession" boolean,+ "subjectType" text,+ "scopes" jsonb,+ "clientCredentialsScopes" jsonb DEFAULT '[]'::jsonb,+ "userId" text,+ "createdAt" timestamp,+ "updatedAt" timestamp,+ "name" text,+ "uri" text,+ "icon" text,+ "contacts" jsonb,+ "tos" text,+ "policy" text,+ "softwareId" text,+ "softwareVersion" text,+ "softwareStatement" text,+ "redirectUris" jsonb NOT NULL,+ "postLogoutRedirectUris" jsonb,+ "backchannelLogoutUri" text,+ "backchannelLogoutSessionRequired" boolean,+ "tokenEndpointAuthMethod" text,+ "applicationType" text,+ "jwks" text,+ "jwksUri" text,+ "grantTypes" jsonb,+ "responseTypes" jsonb,+ "requirePKCE" boolean,+ "dpopBoundAccessTokens" boolean DEFAULT false,+ "referenceId" text,+ "metadata" jsonb,+ CONSTRAINT "oauthClient_clientId_unique" UNIQUE("clientId")+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthClientAssertion" (+ "id" text PRIMARY KEY NOT NULL,+ "expiresAt" timestamp NOT NULL+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthClientResource" (+ "id" text PRIMARY KEY NOT NULL,+ "clientId" text NOT NULL,+ "resourceId" text NOT NULL,+ "metadata" jsonb,+ "createdAt" timestamp+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthConsentV2" (+ "id" text PRIMARY KEY NOT NULL,+ "clientId" text NOT NULL,+ "userId" text,+ "referenceId" text,+ "resources" jsonb,+ "requestedUserInfoClaims" jsonb,+ "scopes" jsonb NOT NULL,+ "createdAt" timestamp NOT NULL,+ "updatedAt" timestamp NOT NULL+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthRefreshToken" (+ "id" text PRIMARY KEY NOT NULL,+ "token" text NOT NULL,+ "clientId" text NOT NULL,+ "sessionId" text,+ "userId" text NOT NULL,+ "referenceId" text,+ "authorizationCodeId" text,+ "resources" jsonb,+ "requestedUserInfoClaims" jsonb,+ "expiresAt" timestamp NOT NULL,+ "createdAt" timestamp NOT NULL,+ "revoked" timestamp,+ "rotatedAt" timestamp,+ "rotationReplayResponse" text,+ "rotationReplayExpiresAt" timestamp,+ "authTime" timestamp,+ "confirmation" jsonb,+ "scopes" jsonb NOT NULL,+ CONSTRAINT "oauthRefreshToken_token_unique" UNIQUE("token")+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "oauthResource" (+ "id" text PRIMARY KEY NOT NULL,+ "identifier" text NOT NULL,+ "name" text NOT NULL,+ "accessTokenTtl" integer,+ "refreshTokenTtl" integer,+ "signingAlgorithm" text,+ "signingKeyId" text,+ "allowedScopes" jsonb,+ "customClaims" jsonb,+ "dpopBoundAccessTokensRequired" boolean DEFAULT false,+ "disabled" boolean DEFAULT false,+ "createdAt" timestamp,+ "updatedAt" timestamp,+ "policyVersion" integer DEFAULT 1,+ "metadata" jsonb,+ CONSTRAINT "oauthResource_identifier_unique" UNIQUE("identifier")+);+--> statement-breakpoint+ALTER TABLE "team" ADD COLUMN IF NOT EXISTS "memberCount" integer DEFAULT 0 NOT NULL;--> statement-breakpoint+ALTER TABLE "teamMember" ADD COLUMN IF NOT EXISTS "membershipKey" text;--> statement-breakpoint+-- Postgres has no ADD CONSTRAINT IF NOT EXISTS; guard each one by name.+DO $$+BEGIN+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthAccessTokenV2"'::regclass AND conname = 'oauthAccessTokenV2_clientId_oauthClient_clientId_fk') THEN+ ALTER TABLE "oauthAccessTokenV2" ADD CONSTRAINT "oauthAccessTokenV2_clientId_oauthClient_clientId_fk" FOREIGN KEY ("clientId") REFERENCES "public"."oauthClient"("clientId") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthAccessTokenV2"'::regclass AND conname = 'oauthAccessTokenV2_sessionId_session_id_fk') THEN+ ALTER TABLE "oauthAccessTokenV2" ADD CONSTRAINT "oauthAccessTokenV2_sessionId_session_id_fk" FOREIGN KEY ("sessionId") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthAccessTokenV2"'::regclass AND conname = 'oauthAccessTokenV2_userId_user_id_fk') THEN+ ALTER TABLE "oauthAccessTokenV2" ADD CONSTRAINT "oauthAccessTokenV2_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthAccessTokenV2"'::regclass AND conname = 'oauthAccessTokenV2_refreshId_oauthRefreshToken_id_fk') THEN+ ALTER TABLE "oauthAccessTokenV2" ADD CONSTRAINT "oauthAccessTokenV2_refreshId_oauthRefreshToken_id_fk" FOREIGN KEY ("refreshId") REFERENCES "public"."oauthRefreshToken"("id") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthClient"'::regclass AND conname = 'oauthClient_userId_user_id_fk') THEN+ ALTER TABLE "oauthClient" ADD CONSTRAINT "oauthClient_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthClientResource"'::regclass AND conname = 'oauthClientResource_clientId_oauthClient_clientId_fk') THEN+ ALTER TABLE "oauthClientResource" ADD CONSTRAINT "oauthClientResource_clientId_oauthClient_clientId_fk" FOREIGN KEY ("clientId") REFERENCES "public"."oauthClient"("clientId") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthClientResource"'::regclass AND conname = 'oauthClientResource_resourceId_oauthResource_identifier_fk') THEN+ ALTER TABLE "oauthClientResource" ADD CONSTRAINT "oauthClientResource_resourceId_oauthResource_identifier_fk" FOREIGN KEY ("resourceId") REFERENCES "public"."oauthResource"("identifier") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthConsentV2"'::regclass AND conname = 'oauthConsentV2_clientId_oauthClient_clientId_fk') THEN+ ALTER TABLE "oauthConsentV2" ADD CONSTRAINT "oauthConsentV2_clientId_oauthClient_clientId_fk" FOREIGN KEY ("clientId") REFERENCES "public"."oauthClient"("clientId") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthConsentV2"'::regclass AND conname = 'oauthConsentV2_userId_user_id_fk') THEN+ ALTER TABLE "oauthConsentV2" ADD CONSTRAINT "oauthConsentV2_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthRefreshToken"'::regclass AND conname = 'oauthRefreshToken_clientId_oauthClient_clientId_fk') THEN+ ALTER TABLE "oauthRefreshToken" ADD CONSTRAINT "oauthRefreshToken_clientId_oauthClient_clientId_fk" FOREIGN KEY ("clientId") REFERENCES "public"."oauthClient"("clientId") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthRefreshToken"'::regclass AND conname = 'oauthRefreshToken_sessionId_session_id_fk') THEN+ ALTER TABLE "oauthRefreshToken" ADD CONSTRAINT "oauthRefreshToken_sessionId_session_id_fk" FOREIGN KEY ("sessionId") REFERENCES "public"."session"("id") ON DELETE set null ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."oauthRefreshToken"'::regclass AND conname = 'oauthRefreshToken_userId_user_id_fk') THEN+ ALTER TABLE "oauthRefreshToken" ADD CONSTRAINT "oauthRefreshToken_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;+ END IF;+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conrelid = 'public."teamMember"'::regclass AND conname = 'teamMember_membershipKey_unique') THEN+ ALTER TABLE "teamMember" ADD CONSTRAINT "teamMember_membershipKey_unique" UNIQUE("membershipKey");+ END IF;+END $$;+--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthAccessTokenV2_clientId_idx" ON "oauthAccessTokenV2" USING btree ("clientId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthAccessTokenV2_sessionId_idx" ON "oauthAccessTokenV2" USING btree ("sessionId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthAccessTokenV2_userId_idx" ON "oauthAccessTokenV2" USING btree ("userId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthAccessTokenV2_authorizationCodeId_idx" ON "oauthAccessTokenV2" USING btree ("authorizationCodeId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthAccessTokenV2_refreshId_idx" ON "oauthAccessTokenV2" USING btree ("refreshId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthClient_userId_idx" ON "oauthClient" USING btree ("userId");--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "oauthClientResource_clientId_resourceId_uidx" ON "oauthClientResource" USING btree ("clientId","resourceId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthClientResource_clientId_idx" ON "oauthClientResource" USING btree ("clientId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthClientResource_resourceId_idx" ON "oauthClientResource" USING btree ("resourceId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthConsentV2_clientId_idx" ON "oauthConsentV2" USING btree ("clientId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthConsentV2_userId_idx" ON "oauthConsentV2" USING btree ("userId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthRefreshToken_clientId_idx" ON "oauthRefreshToken" USING btree ("clientId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthRefreshToken_sessionId_idx" ON "oauthRefreshToken" USING btree ("sessionId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthRefreshToken_userId_idx" ON "oauthRefreshToken" USING btree ("userId");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "oauthRefreshToken_authorizationCodeId_idx" ON "oauthRefreshToken" USING btree ("authorizationCodeId");+--> statement-breakpoint+-- Clients keep their IDs and redirect URIs. The old plugin stored secrets in+-- plaintext; 1.7 stores SHA-256 in unpadded base64url. Existing grants/tokens+-- are intentionally not imported: clients must request fresh consent.+-- ON CONFLICT DO NOTHING (id PK or clientId unique) keeps re-runs from+-- duplicating or overwriting clients that were already imported.+INSERT INTO "oauthClient" (+ id, "clientId", "clientSecret", name, icon, metadata, "redirectUris",+ disabled, "userId", "createdAt", "updatedAt", "tokenEndpointAuthMethod",+ "applicationType", "grantTypes", "responseTypes", "requirePKCE", scopes+)+SELECT id, "clientId",+ CASE WHEN type = 'public' OR NULLIF("clientSecret", '') IS NULL THEN NULL+ ELSE rtrim(translate(encode(sha256(convert_to("clientSecret", 'UTF8')), 'base64'), '+/', '-_'), '=') END,+ name, icon, NULLIF(metadata, '')::jsonb, to_jsonb(string_to_array("redirectUrls", ',')),+ disabled, "userId", "createdAt", "updatedAt",+ CASE WHEN type = 'public' THEN 'none' ELSE 'client_secret_basic' END,+ CASE WHEN type = 'public' THEN 'native' ELSE 'web' END,+ '["authorization_code", "refresh_token"]'::jsonb, '["code"]'::jsonb, true,+ to_jsonb(ARRAY['openid', 'profile', 'email', 'offline_access', 'analytics:read', 'sessions:read', 'events:read', 'users:read', 'users:write', 'goals:read', 'goals:write', 'funnels:read', 'funnels:write', 'dashboards:read', 'dashboards:write', 'annotations:read', 'annotations:write', 'segments:read', 'segments:write', 'flags:read', 'flags:write', 'experiments:read', 'experiments:write', 'sites:read', 'sites:write', 'gsc:read', 'gsc:write', 'org:read', 'org:write', 'replay:read', 'replay:write', 'sql:read', 'ingest:write'])+FROM "oauthApplication"+ON CONFLICT DO NOTHING;+--> statement-breakpoint+-- Existing nullable membership keys are supported by Better Auth's pair+-- lookup fallback. Counts must reflect existing members at cutover.+UPDATE team SET "memberCount" = (SELECT count(*) FROM "teamMember" WHERE "teamId" = team.id);diff --git a/server/drizzle/meta/0018_snapshot.json b/server/drizzle/meta/0018_snapshot.jsonnew file mode 100644index 000000000..c5e218896--- /dev/null+++ b/server/drizzle/meta/0018_snapshot.json@@ -0,0 +1,4543 @@+{+ "id": "ae5d63e0-563a-44f9-b6ed-d5c69fb56fb8",+ "prevId": "951578fe-c04f-4fa0-8ce7-b1246fd746fc",+ "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.annotations": {+ "name": "annotations",+ "schema": "",+ "columns": {+ "annotation_id": {+ "name": "annotation_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "date": {+ "name": "date",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "end_date": {+ "name": "end_date",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "is_public": {+ "name": "is_public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": 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": {+ "annotations_site_date_idx": {+ "name": "annotations_site_date_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "date",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "annotations_org_date_idx": {+ "name": "annotations_org_date_idx",+ "columns": [+ {+ "expression": "organization_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "date",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "annotations_site_id_sites_site_id_fk": {+ "name": "annotations_site_id_sites_site_id_fk",+ "tableFrom": "annotations",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "annotations_organization_id_organization_id_fk": {+ "name": "annotations_organization_id_organization_id_fk",+ "tableFrom": "annotations",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "annotations_user_id_user_id_fk": {+ "name": "annotations_user_id_user_id_fk",+ "tableFrom": "annotations",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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.jwks": {+ "name": "jwks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "publicKey": {+ "name": "publicKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "privateKey": {+ "name": "privateKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "alg": {+ "name": "alg",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "crv": {+ "name": "crv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.lifecycle_email_log": {+ "name": "lifecycle_email_log",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "email_key": {+ "name": "email_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "sent_at": {+ "name": "sent_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "lifecycle_email_log_user_id_user_id_fk": {+ "name": "lifecycle_email_log_user_id_user_id_fk",+ "tableFrom": "lifecycle_email_log",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "lifecycle_email_log_user_email_key_unique": {+ "name": "lifecycle_email_log_user_email_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id",+ "email_key"+ ]+ }+ },+ "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.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.oauthAccessTokenV2": {+ "name": "oauthAccessTokenV2",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sessionId": {+ "name": "sessionId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "referenceId": {+ "name": "referenceId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "authorizationCodeId": {+ "name": "authorizationCodeId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "requestedUserInfoClaims": {+ "name": "requestedUserInfoClaims",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "refreshId": {+ "name": "refreshId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "revoked": {+ "name": "revoked",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "confirmation": {+ "name": "confirmation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthAccessTokenV2_clientId_idx": {+ "name": "oauthAccessTokenV2_clientId_idx",+ "columns": [+ {+ "expression": "clientId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessTokenV2_sessionId_idx": {+ "name": "oauthAccessTokenV2_sessionId_idx",+ "columns": [+ {+ "expression": "sessionId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessTokenV2_userId_idx": {+ "name": "oauthAccessTokenV2_userId_idx",+ "columns": [+ {+ "expression": "userId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessTokenV2_authorizationCodeId_idx": {+ "name": "oauthAccessTokenV2_authorizationCodeId_idx",+ "columns": [+ {+ "expression": "authorizationCodeId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessTokenV2_refreshId_idx": {+ "name": "oauthAccessTokenV2_refreshId_idx",+ "columns": [+ {+ "expression": "refreshId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauthAccessTokenV2_clientId_oauthClient_clientId_fk": {+ "name": "oauthAccessTokenV2_clientId_oauthClient_clientId_fk",+ "tableFrom": "oauthAccessTokenV2",+ "tableTo": "oauthClient",+ "columnsFrom": [+ "clientId"+ ],+ "columnsTo": [+ "clientId"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthAccessTokenV2_sessionId_session_id_fk": {+ "name": "oauthAccessTokenV2_sessionId_session_id_fk",+ "tableFrom": "oauthAccessTokenV2",+ "tableTo": "session",+ "columnsFrom": [+ "sessionId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "oauthAccessTokenV2_userId_user_id_fk": {+ "name": "oauthAccessTokenV2_userId_user_id_fk",+ "tableFrom": "oauthAccessTokenV2",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthAccessTokenV2_refreshId_oauthRefreshToken_id_fk": {+ "name": "oauthAccessTokenV2_refreshId_oauthRefreshToken_id_fk",+ "tableFrom": "oauthAccessTokenV2",+ "tableTo": "oauthRefreshToken",+ "columnsFrom": [+ "refreshId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauthAccessTokenV2_token_unique": {+ "name": "oauthAccessTokenV2_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "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.oauthClient": {+ "name": "oauthClient",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "clientSecret": {+ "name": "clientSecret",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "clientDiscoveryId": {+ "name": "clientDiscoveryId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "skipConsent": {+ "name": "skipConsent",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "enableEndSession": {+ "name": "enableEndSession",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "subjectType": {+ "name": "subjectType",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "clientCredentialsScopes": {+ "name": "clientCredentialsScopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "uri": {+ "name": "uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "contacts": {+ "name": "contacts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tos": {+ "name": "tos",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "policy": {+ "name": "policy",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "softwareId": {+ "name": "softwareId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "softwareVersion": {+ "name": "softwareVersion",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "softwareStatement": {+ "name": "softwareStatement",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "redirectUris": {+ "name": "redirectUris",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "postLogoutRedirectUris": {+ "name": "postLogoutRedirectUris",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "backchannelLogoutUri": {+ "name": "backchannelLogoutUri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "backchannelLogoutSessionRequired": {+ "name": "backchannelLogoutSessionRequired",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "tokenEndpointAuthMethod": {+ "name": "tokenEndpointAuthMethod",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "applicationType": {+ "name": "applicationType",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "jwks": {+ "name": "jwks",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "jwksUri": {+ "name": "jwksUri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "grantTypes": {+ "name": "grantTypes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "responseTypes": {+ "name": "responseTypes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "requirePKCE": {+ "name": "requirePKCE",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "dpopBoundAccessTokens": {+ "name": "dpopBoundAccessTokens",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "referenceId": {+ "name": "referenceId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "oauthClient_userId_idx": {+ "name": "oauthClient_userId_idx",+ "columns": [+ {+ "expression": "userId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauthClient_userId_user_id_fk": {+ "name": "oauthClient_userId_user_id_fk",+ "tableFrom": "oauthClient",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauthClient_clientId_unique": {+ "name": "oauthClient_clientId_unique",+ "nullsNotDistinct": false,+ "columns": [+ "clientId"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthClientAssertion": {+ "name": "oauthClientAssertion",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthClientResource": {+ "name": "oauthClientResource",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resourceId": {+ "name": "resourceId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "oauthClientResource_clientId_resourceId_uidx": {+ "name": "oauthClientResource_clientId_resourceId_uidx",+ "columns": [+ {+ "expression": "clientId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resourceId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthClientResource_clientId_idx": {+ "name": "oauthClientResource_clientId_idx",+ "columns": [+ {+ "expression": "clientId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthClientResource_resourceId_idx": {+ "name": "oauthClientResource_resourceId_idx",+ "columns": [+ {+ "expression": "resourceId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauthClientResource_clientId_oauthClient_clientId_fk": {+ "name": "oauthClientResource_clientId_oauthClient_clientId_fk",+ "tableFrom": "oauthClientResource",+ "tableTo": "oauthClient",+ "columnsFrom": [+ "clientId"+ ],+ "columnsTo": [+ "clientId"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthClientResource_resourceId_oauthResource_identifier_fk": {+ "name": "oauthClientResource_resourceId_oauthResource_identifier_fk",+ "tableFrom": "oauthClientResource",+ "tableTo": "oauthResource",+ "columnsFrom": [+ "resourceId"+ ],+ "columnsTo": [+ "identifier"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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.oauthConsentV2": {+ "name": "oauthConsentV2",+ "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": false+ },+ "referenceId": {+ "name": "referenceId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "requestedUserInfoClaims": {+ "name": "requestedUserInfoClaims",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthConsentV2_clientId_idx": {+ "name": "oauthConsentV2_clientId_idx",+ "columns": [+ {+ "expression": "clientId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthConsentV2_userId_idx": {+ "name": "oauthConsentV2_userId_idx",+ "columns": [+ {+ "expression": "userId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauthConsentV2_clientId_oauthClient_clientId_fk": {+ "name": "oauthConsentV2_clientId_oauthClient_clientId_fk",+ "tableFrom": "oauthConsentV2",+ "tableTo": "oauthClient",+ "columnsFrom": [+ "clientId"+ ],+ "columnsTo": [+ "clientId"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthConsentV2_userId_user_id_fk": {+ "name": "oauthConsentV2_userId_user_id_fk",+ "tableFrom": "oauthConsentV2",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthRefreshToken": {+ "name": "oauthRefreshToken",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "clientId": {+ "name": "clientId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sessionId": {+ "name": "sessionId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "referenceId": {+ "name": "referenceId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "authorizationCodeId": {+ "name": "authorizationCodeId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "requestedUserInfoClaims": {+ "name": "requestedUserInfoClaims",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "revoked": {+ "name": "revoked",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "rotatedAt": {+ "name": "rotatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "rotationReplayResponse": {+ "name": "rotationReplayResponse",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rotationReplayExpiresAt": {+ "name": "rotationReplayExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "authTime": {+ "name": "authTime",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "confirmation": {+ "name": "confirmation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthRefreshToken_clientId_idx": {+ "name": "oauthRefreshToken_clientId_idx",+ "columns": [+ {+ "expression": "clientId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthRefreshToken_sessionId_idx": {+ "name": "oauthRefreshToken_sessionId_idx",+ "columns": [+ {+ "expression": "sessionId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthRefreshToken_userId_idx": {+ "name": "oauthRefreshToken_userId_idx",+ "columns": [+ {+ "expression": "userId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthRefreshToken_authorizationCodeId_idx": {+ "name": "oauthRefreshToken_authorizationCodeId_idx",+ "columns": [+ {+ "expression": "authorizationCodeId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauthRefreshToken_clientId_oauthClient_clientId_fk": {+ "name": "oauthRefreshToken_clientId_oauthClient_clientId_fk",+ "tableFrom": "oauthRefreshToken",+ "tableTo": "oauthClient",+ "columnsFrom": [+ "clientId"+ ],+ "columnsTo": [+ "clientId"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauthRefreshToken_sessionId_session_id_fk": {+ "name": "oauthRefreshToken_sessionId_session_id_fk",+ "tableFrom": "oauthRefreshToken",+ "tableTo": "session",+ "columnsFrom": [+ "sessionId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "oauthRefreshToken_userId_user_id_fk": {+ "name": "oauthRefreshToken_userId_user_id_fk",+ "tableFrom": "oauthRefreshToken",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauthRefreshToken_token_unique": {+ "name": "oauthRefreshToken_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauthResource": {+ "name": "oauthResource",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "accessTokenTtl": {+ "name": "accessTokenTtl",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "refreshTokenTtl": {+ "name": "refreshTokenTtl",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "signingAlgorithm": {+ "name": "signingAlgorithm",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "signingKeyId": {+ "name": "signingKeyId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "allowedScopes": {+ "name": "allowedScopes",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "customClaims": {+ "name": "customClaims",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "dpopBoundAccessTokensRequired": {+ "name": "dpopBoundAccessTokensRequired",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "policyVersion": {+ "name": "policyVersion",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 1+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauthResource_identifier_unique": {+ "name": "oauthResource_identifier_unique",+ "nullsNotDistinct": false,+ "columns": [+ "identifier"+ ]+ }+ },+ "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.segments": {+ "name": "segments",+ "schema": "",+ "columns": {+ "segment_id": {+ "name": "segment_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "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+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "filters": {+ "name": "filters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "is_public": {+ "name": "is_public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'segment'"+ },+ "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": {+ "segments_organization_idx": {+ "name": "segments_organization_idx",+ "columns": [+ {+ "expression": "organization_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "segments_site_idx": {+ "name": "segments_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "segments_organization_id_organization_id_fk": {+ "name": "segments_organization_id_organization_id_fk",+ "tableFrom": "segments",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "segments_site_id_sites_site_id_fk": {+ "name": "segments_site_id_sites_site_id_fk",+ "tableFrom": "segments",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "segments_user_id_user_id_fk": {+ "name": "segments_user_id_user_id_fk",+ "tableFrom": "segments",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "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"+ },+ "detected_platform": {+ "name": "detected_platform",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "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": {+ "memberCount": {+ "name": "memberCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "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": {+ "membershipKey": {+ "name": "membershipKey",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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": {+ "teamMember_membershipKey_unique": {+ "name": "teamMember_membershipKey_unique",+ "nullsNotDistinct": false,+ "columns": [+ "membershipKey"+ ]+ }+ },+ "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.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": {}+ }+}diff --git a/server/drizzle/meta/_journal.json b/server/drizzle/meta/_journal.jsonindex bafd99575..027385299 100644--- a/server/drizzle/meta/_journal.json+++ b/server/drizzle/meta/_journal.json@@ -127,6 +127,13 @@"when": 1788393490335,"tag": "0017_burly_nick_fury","breakpoints": true+ },+ {+ "idx": 18,+ "version": "7",+ "when": 1788910036039,+ "tag": "0018_better_auth_173",+ "breakpoints": true}]}\ No newline at end of filediff --git a/server/package-lock.json b/server/package-lock.jsonindex 2279d6d7f..4bf97e98b 100644--- a/server/package-lock.json+++ b/server/package-lock.json@@ -9,9 +9,11 @@"version": "2.8.0","dependencies": {"@aws-sdk/client-s3": "^3.842.0",- "@better-auth/api-key": "^1.6.25",+ "@better-auth/api-key": "1.7.3","@better-auth/infra": "^0.1.12",- "@better-auth/sso": "^1.6.25",+ "@better-auth/mcp": "1.7.3",+ "@better-auth/oauth-provider": "1.7.3",+ "@better-auth/sso": "1.7.3","@clickhouse/client": "1.11.1","@fastify/cors": "11.2.0","@fastify/rate-limit": "^10.3.0",@@ -22,7 +24,7 @@"@react-email/components": "1.0.1","@react-email/tailwind": "2.0.1","@rybbit/shared": "file:../shared",- "better-auth": "1.6.25",+ "better-auth": "1.7.3","dotenv": "16.5.0","drizzle-orm": "0.45.2","fastify": "5.8.5",@@ -1032,43 +1034,42 @@}},"node_modules/@better-auth/api-key": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/api-key/-/api-key-1.6.25.tgz",- "integrity": "sha512-A6f3YLN8Ve+D4R7f8jrSKh8Mpu9+bmc8PIb9BFgGgspcedM1PjpSEI5JKAWPUhiGgMeJdCGeCpRP+27jQmW9/w==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/api-key/-/api-key-1.7.3.tgz",+ "integrity": "sha512-SY5IBK4YcxnQdyK6RAxSpze6Zfi2Emtp9c4BFl/FT0U7ZyBnKARKHFC1csf8kvtrbaMIIWUvcM9eeQW6OKUqRQ==","dependencies": {- "zod": "^4.3.6"+ "zod": "^4.5.4"},"peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2",- "better-auth": "^1.6.25",- "better-call": "1.3.7"+ "better-auth": "^1.7.3",+ "better-call": "1.4.0"}},"node_modules/@better-auth/api-key/node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/@better-auth/core": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/core/-/core-1.6.25.tgz",- "integrity": "sha512-lMTlhtwyK4NpY9kPF+2rQCRKYpg136d3gM2xl8esxT1PjJx5Nh5YwZvxcYCIjDuO759sx6TCloJTuwcZGG6ZBw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/core/-/core-1.7.3.tgz",+ "integrity": "sha512-JdP7lOkyE83jgjn7RilJj1XvZ7n2JjRsErKJuaXchjyuNo6cf1iVd3GtbhAtiUyJJkWdk8yL+LaUBKT80H0zLA==","dependencies": {- "@opentelemetry/semantic-conventions": "^1.39.0",+ "@opentelemetry/semantic-conventions": "^1.41.1","@standard-schema/spec": "^1.1.0",- "zod": "^4.3.6"+ "zod": "^4.5.4"},"peerDependencies": {"@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1","@cloudflare/workers-types": ">=4","@opentelemetry/api": "^1.9.0",- "better-call": "1.3.7",+ "better-call": "1.4.0","jose": "^6.1.0","kysely": "^0.28.5 || ^0.29.0","nanostores": "^1.0.1"@@ -1083,21 +1084,21 @@}},"node_modules/@better-auth/core/node_modules/zod": {- "version": "4.4.3",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",- "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/@better-auth/drizzle-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/drizzle-adapter/-/drizzle-adapter-1.6.25.tgz",- "integrity": "sha512-ru/DeKjFPQUVeKkxF/ScazmPqIY7lwfkAV5Yt4j24wmn1Y8vFwoiPRnHgXUeZqBs10+nubaRwEqLF39CP6EhRw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/drizzle-adapter/-/drizzle-adapter-1.7.3.tgz",+ "integrity": "sha512-S+nQRlxbUhkR43LrSv8c98ZvOvmv3nrtOnHkiZXkdDkr60PWp7maC2cqgzZ2C9exCC1a+4TugJlx2jRL+r+/9A==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2",- "drizzle-orm": "^0.45.2"+ "drizzle-orm": "^0.45.2 || >=1.0.0-rc.1 <2.0.0"},"peerDependenciesMeta": {"drizzle-orm": {@@ -1124,11 +1125,11 @@}},"node_modules/@better-auth/kysely-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/kysely-adapter/-/kysely-adapter-1.6.25.tgz",- "integrity": "sha512-zxiePhtN1YClS1irKYPVwWfN6kYp+QoYlz1hdQUOj8hXyo2aE/ny4RNAb6v332b0+U6Vu88EhYITRPdmvCo6uA==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/kysely-adapter/-/kysely-adapter-1.7.3.tgz",+ "integrity": "sha512-UIsyJMIrjUnT+yTaS6dkCxYYmtPwxFHxwSJ8+CLty2II5w9BewlDxDA0/QzhoL/InYCPxQ5Y6xIgLHZG1dhwRA==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","kysely": "^0.28.17 || ^0.29.0"},@@ -1138,21 +1139,35 @@}}},+ "node_modules/@better-auth/mcp": {+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/mcp/-/mcp-1.7.3.tgz",+ "integrity": "sha512-tyGOzXytVzcRTE/+txTW2B7skOaOpb3FBA113NWZwa+YLtJ973vRnq0GqEa7lZmAJ8+4x67T6IW/XXpGpA5FZw==",+ "dependencies": {+ "@better-auth/oauth-provider": "^1.7.3",+ "jose": "^6.1.3"+ },+ "peerDependencies": {+ "@better-auth/core": "^1.7.3",+ "better-auth": "^1.7.3",+ "better-call": "1.4.0"+ }+ },"node_modules/@better-auth/memory-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/memory-adapter/-/memory-adapter-1.6.25.tgz",- "integrity": "sha512-GhEzTumc8yfTz+OZ6pMg06BA49xob49x1bX+1mEl/FStDJoSF+6mTfI5M2ytFxaiN89336/aUjkW8u+qRyLexw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/memory-adapter/-/memory-adapter-1.7.3.tgz",+ "integrity": "sha512-WdLANFY/QWC3G351RCzxU+Y9YlW+BQ1oG9NwBTSOUWQw5rZ87ws+weU8tvAMO7sQ4C9gKIlkOKBKUKXrSt91Tw==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2"}},"node_modules/@better-auth/mongo-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/mongo-adapter/-/mongo-adapter-1.6.25.tgz",- "integrity": "sha512-ZtMmjcOdXR2Ziqx5y8ptTOaNpe0snNfALbBUPXJsgeyeRkDJDYzyLZ8MpuvNBTNllNeIFDbiXWAK5k+pEBZrUQ==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/mongo-adapter/-/mongo-adapter-1.7.3.tgz",+ "integrity": "sha512-YL9m01tNogmFmRvOWJ46M9WwE6HirCXHDell29mtsQB/Qs1TPNLrgj7ybGMMGhQuyj6S218+8Wbls8m9s+i8RQ==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","mongodb": "^6.0.0 || ^7.0.0"},@@ -1162,12 +1177,37 @@}}},+ "node_modules/@better-auth/oauth-provider": {+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/oauth-provider/-/oauth-provider-1.7.3.tgz",+ "integrity": "sha512-Eoajj68F1ETmp4NBM98tgj1Uiip4cZiFqFsijAWIvOEQTejr/67PWK1/92N8PiNdLf03ezUWU538W93rd9fyIw==",+ "license": "MIT",+ "dependencies": {+ "jose": "^6.2.3",+ "zod": "^4.5.4"+ },+ "peerDependencies": {+ "@better-auth/core": "^1.7.3",+ "@better-auth/utils": "0.4.2",+ "@better-fetch/fetch": "1.3.1",+ "better-auth": "^1.7.3",+ "better-call": "1.4.0"+ }+ },+ "node_modules/@better-auth/oauth-provider/node_modules/zod": {+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==",+ "funding": {+ "url": "https://github.com/sponsors/colinhacks"+ }+ },"node_modules/@better-auth/prisma-adapter": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/prisma-adapter/-/prisma-adapter-1.6.25.tgz",- "integrity": "sha512-ym7B6Iqcry+/4aQnYpFwqP/GBIiXvjrm/5B6+0qmx8mkTY/apHFTpHuGzUYYNf4vPTtzF3eYY2+s2GOsomKaRg==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/prisma-adapter/-/prisma-adapter-1.7.3.tgz",+ "integrity": "sha512-TJ/DhlU7oLzrC626/1wfYA1Pl+lVsXa/zXBZ8d7Rlc2YO5fGd5fsAYJdRrYMyA51iZEo+rWLXMhZ0cez1BamsQ==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0","prisma": "^5.0.0 || ^6.0.0 || ^7.0.0"@@ -1182,22 +1222,31 @@}},"node_modules/@better-auth/sso": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/sso/-/sso-1.6.25.tgz",- "integrity": "sha512-Svbh1DFrMGlPms4YNuahtNqnro8jwPeOjGfnSEPn1x67+QcP140n9liHxXCWmFgwN1qbpU2VhiqNRQ0goWo85A==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/sso/-/sso-1.7.3.tgz",+ "integrity": "sha512-inxETRuOfyy8m0uEJSfi9uhScp4RkQ7ZYI+GRj+Jtz6ml/p5wTzNOjYZsG43TroUTDfrElF6CYQON5/Xk1XdmA==","dependencies": {+ "@xmldom/xmldom": "^0.9.12","fast-xml-parser": "^5.8.0",- "jose": "^6.1.3",+ "jose": "^6.2.3","samlify": "^2.13.1",- "tldts": "^6.1.0",- "zod": "^4.3.6"+ "tldts": "^7.4.3",+ "zod": "^4.5.4"},"peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1",- "better-auth": "^1.6.25",- "better-call": "1.3.7"+ "better-auth": "^1.7.3",+ "better-call": "1.4.0"+ }+ },+ "node_modules/@better-auth/sso/node_modules/@xmldom/xmldom": {+ "version": "0.9.12",+ "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.12.tgz",+ "integrity": "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A==",+ "engines": {+ "node": ">=14.6"}},"node_modules/@better-auth/sso/node_modules/fast-xml-parser": {@@ -1223,21 +1272,36 @@"fxparser": "src/cli/cli.js"}},+ "node_modules/@better-auth/sso/node_modules/tldts": {+ "version": "7.4.12",+ "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.12.tgz",+ "integrity": "sha512-WylhSDKVeYnWXL3a+vKTaOxjnOeEGw938hImY8zoRWJjRRK/Jp1K+IihBzIONpUmW4e3WmXT6q5FW6vlESVZCA==",+ "dependencies": {+ "tldts-core": "^7.4.12"+ },+ "bin": {+ "tldts": "bin/cli.js"+ }+ },+ "node_modules/@better-auth/sso/node_modules/tldts-core": {+ "version": "7.4.12",+ "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.12.tgz",+ "integrity": "sha512-nYNzS2WRf4QJmjzFFgAxLOBjyBxAGRbCy9PVBPaglcYyYajh40VBn+v5Ngr96ZMc7oM0+aCJdtQnNejvdBnXMQ=="+ },"node_modules/@better-auth/sso/node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/@better-auth/telemetry": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/@better-auth/telemetry/-/telemetry-1.6.25.tgz",- "integrity": "sha512-2ZfC9lp7tU6Jw/q2Lz/bKfQqGMdMwc/IQDTYdBhvtGi24qInYVnhp2ZCW57hHM9j+fq1ULOtxgg6M3T1LEaihw==",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/@better-auth/telemetry/-/telemetry-1.7.3.tgz",+ "integrity": "sha512-aixgHbJhGvS8PRczX/LR3murYyBnIvOGmJw37ZZBMg6ZtLR/UBJAkufbDi1HYn5THSuTJ3D5DtY85Ahh/ABQtw==","peerDependencies": {- "@better-auth/core": "^1.6.25",+ "@better-auth/core": "^1.7.3","@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1"}@@ -2692,10 +2756,9 @@}},"node_modules/@noble/ciphers": {- "version": "2.1.1",- "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.1.1.tgz",- "integrity": "sha512-bysYuiVfhxNJuldNXlFEitTVdNnYUc+XNJZd7Qm2a5j1vZHgY+fazadNFWFaMK/2vye0JVlxV3gHmC0WDfAOQw==",- "license": "MIT",+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.4.0.tgz",+ "integrity": "sha512-AnjFn0Jv92laAkvMrghlFZq4qQCIN/4DxFV/eooqtC2YTjB7kBeLMS2T9KJX4Dn+ZVXLOwK0lSgqDtx9gvxtiw==","engines": {"node": ">= 20.19.0"},@@ -2704,10 +2767,9 @@}},"node_modules/@noble/hashes": {- "version": "2.0.1",- "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.0.1.tgz",- "integrity": "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==",- "license": "MIT",+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.4.0.tgz",+ "integrity": "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA==","engines": {"node": ">= 20.19.0"},@@ -5149,27 +5211,27 @@}},"node_modules/better-auth": {- "version": "1.6.25",- "resolved": "https://registry.npmjs.org/better-auth/-/better-auth-1.6.25.tgz",- "integrity": "sha512-fvoq+oCO+FF5fpP3XfU7znRyGFpHB77UG2EyxsKNy+Cak7Q5pELu+auvvDveQbWQxcoKugZ7jYQQPFQLpUTGOw==",- "dependencies": {- "@better-auth/core": "1.6.25",- "@better-auth/drizzle-adapter": "1.6.25",- "@better-auth/kysely-adapter": "1.6.25",- "@better-auth/memory-adapter": "1.6.25",- "@better-auth/mongo-adapter": "1.6.25",- "@better-auth/prisma-adapter": "1.6.25",- "@better-auth/telemetry": "1.6.25",+ "version": "1.7.3",+ "resolved": "https://registry.npmjs.org/better-auth/-/better-auth-1.7.3.tgz",+ "integrity": "sha512-8xGp68JQ+l36kniDEgP8bP99TLi1GdEv0NTEUBkyqnYnus/cgFUZseUfqUHKzr2BAsg2O6aD88I9f0U68shanQ==",+ "dependencies": {+ "@better-auth/core": "1.7.3",+ "@better-auth/drizzle-adapter": "1.7.3",+ "@better-auth/kysely-adapter": "1.7.3",+ "@better-auth/memory-adapter": "1.7.3",+ "@better-auth/mongo-adapter": "1.7.3",+ "@better-auth/prisma-adapter": "1.7.3",+ "@better-auth/telemetry": "1.7.3","@better-auth/utils": "0.4.2","@better-fetch/fetch": "1.3.1",- "@noble/ciphers": "^2.1.1",- "@noble/hashes": "^2.0.1",- "better-call": "1.3.7",+ "@noble/ciphers": "^2.2.0",+ "@noble/hashes": "^2.2.0",+ "better-call": "1.4.0","defu": "^6.1.4",- "jose": "^6.1.3",+ "jose": "^6.2.3","kysely": "^0.28.17 || ^0.29.0",- "nanostores": "^1.1.1",- "zod": "^4.3.6"+ "nanostores": "^1.3.0",+ "zod": "^4.5.4"},"peerDependencies": {"@lynx-js/react": "*",@@ -5178,8 +5240,8 @@"@tanstack/react-start": "^1.0.0","@tanstack/solid-start": "^1.0.0","better-sqlite3": "^12.0.0",- "drizzle-kit": ">=0.31.4",- "drizzle-orm": "^0.45.2",+ "drizzle-kit": ">=0.31.4 || >=1.0.0-beta.1",+ "drizzle-orm": "^0.45.2 || >=1.0.0-rc.1 <2.0.0","mongodb": "^6.0.0 || ^7.0.0","mysql2": "^3.0.0","next": "^14.0.0 || ^15.0.0 || ^16.0.0",@@ -5253,24 +5315,22 @@}},"node_modules/better-auth/node_modules/zod": {- "version": "4.3.6",- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",- "license": "MIT",+ "version": "4.5.4",+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz",+ "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==","funding": {"url": "https://github.com/sponsors/colinhacks"}},"node_modules/better-call": {- "version": "1.3.7",- "resolved": "https://registry.npmjs.org/better-call/-/better-call-1.3.7.tgz",- "integrity": "sha512-Al51/hjp2SSp6CRTa3F2ptcx4yQVS1xWKoY6jcVXqNYOap6mHFP2jUBn5EwIL4iIed1/Sq4hlQ+Umm6EflZG+w==",- "license": "MIT",+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/better-call/-/better-call-1.4.0.tgz",+ "integrity": "sha512-bBKOT4vv1kZLDgxVePdilk/Jwkn+dtRRsmi3DzHcDP+WnswyVl6dR59l2HEeP/0cB+bDoopASAesWDPIdd/zZA==","dependencies": {- "@better-auth/utils": "^0.4.0",- "@better-fetch/fetch": "^1.1.21",- "rou3": "^0.7.12",- "set-cookie-parser": "^3.0.1"+ "@better-auth/utils": "^0.5.0",+ "@better-fetch/fetch": "^1.3.1",+ "rou3": "^0.9.1",+ "set-cookie-parser": "^3.1.2"},"peerDependencies": {"zod": "^4.0.0"@@ -5281,6 +5341,14 @@}}},+ "node_modules/better-call/node_modules/@better-auth/utils": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/@better-auth/utils/-/utils-0.5.0.tgz",+ "integrity": "sha512-BL8W4EfIZFwlu0r54m3v1ztjDhu6dDe/amLTm0xybmbZaNgYUqhD3SjpAsnq0q8YD6/ki4iwIgxJNLP/N3TxiA==",+ "dependencies": {+ "@noble/hashes": "^2.0.1"+ }+ },"node_modules/better-call/node_modules/set-cookie-parser": {"version": "3.1.2","resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-3.1.2.tgz",@@ -7572,10 +7640,9 @@}},"node_modules/jose": {- "version": "6.1.3",- "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz",- "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==",- "license": "MIT",+ "version": "6.2.12",+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.12.tgz",+ "integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==","funding": {"url": "https://github.com/sponsors/panva"}@@ -8067,16 +8134,15 @@}},"node_modules/nanostores": {- "version": "1.2.0",- "resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.2.0.tgz",- "integrity": "sha512-F0wCzbsH80G7XXo0Jd9/AVQC7ouWY6idUCTnMwW5t/Rv9W8qmO6endavDwg7TNp5GbugwSukFMVZqzPSrSMndg==",+ "version": "1.5.3",+ "resolved": "https://registry.npmjs.org/nanostores/-/nanostores-1.5.3.tgz",+ "integrity": "sha512-rQLB6eV4f2AW/n3L0JmwCROpaisYy9EDEADvEFSd1C/qG8hB6O5TPlh9A791JRbJr4CnMQBzptDcvD9OR1+6WA==","funding": [{"type": "github","url": "https://github.com/sponsors/ai"}],- "license": "MIT","engines": {"node": "^20.0.0 || >=22.0.0"}@@ -9265,10 +9331,9 @@}},"node_modules/rou3": {- "version": "0.7.12",- "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.7.12.tgz",- "integrity": "sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg==",- "license": "MIT"+ "version": "0.9.2",+ "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.9.2.tgz",+ "integrity": "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ=="},"node_modules/router": {"version": "2.2.0",@@ -10097,6 +10162,7 @@"version": "6.1.86","resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz","integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==",+ "dev": true,"license": "MIT","dependencies": {"tldts-core": "^6.1.86"@@ -10109,6 +10175,7 @@"version": "6.1.86","resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz","integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==",+ "dev": true,"license": "MIT"},"node_modules/tmp": {diff --git a/server/package.json b/server/package.jsonindex 74626dbfe..a8405d5d0 100644--- a/server/package.json+++ b/server/package.json@@ -29,9 +29,11 @@},"dependencies": {"@aws-sdk/client-s3": "^3.842.0",- "@better-auth/api-key": "^1.6.25",+ "@better-auth/api-key": "1.7.3","@better-auth/infra": "^0.1.12",- "@better-auth/sso": "^1.6.25",+ "@better-auth/mcp": "1.7.3",+ "@better-auth/oauth-provider": "1.7.3",+ "@better-auth/sso": "1.7.3","@clickhouse/client": "1.11.1","@fastify/cors": "11.2.0","@fastify/rate-limit": "^10.3.0",@@ -42,7 +44,7 @@"@react-email/components": "1.0.1","@react-email/tailwind": "2.0.1","@rybbit/shared": "file:../shared",- "better-auth": "1.6.25",+ "better-auth": "1.7.3","dotenv": "16.5.0","drizzle-orm": "0.45.2","fastify": "5.8.5",diff --git a/server/src/api/analytics/segments/expandSegmentParam.test.ts b/server/src/api/analytics/segments/expandSegmentParam.test.tsindex 2e827bff9..db43ce95b 100644--- a/server/src/api/analytics/segments/expandSegmentParam.test.ts+++ b/server/src/api/analytics/segments/expandSegmentParam.test.ts@@ -16,6 +16,9 @@ vi.mock("./segmentAccess.js", async () => {});vi.mock("../../../db/postgres/postgres.js", () => ({ db: {} }));+// The partial segmentAccess mock imports auth-utils, but this unit test never+// authenticates requests. Keep the production auth/DB initializer out of it.+vi.mock("../../../lib/auth.js", () => ({ auth: { api: {} } }));import { expandSegmentParam, mergeSegmentFilters } from "./expandSegmentParam.js";diff --git a/server/src/api/teams/createTeam.ts b/server/src/api/teams/createTeam.tsindex 26ffbc019..a9b38b2d6 100644--- a/server/src/api/teams/createTeam.ts+++ b/server/src/api/teams/createTeam.ts@@ -2,6 +2,7 @@ import { eq, and, inArray } from "drizzle-orm";import { FastifyReply, FastifyRequest } from "fastify";import { db } from "../../db/postgres/postgres.js";import { team, teamMember, teamSiteAccess, member, sites } from "../../db/postgres/schema.js";+import { teamMembershipKey } from "../../lib/teamMembership.js";import { invalidateSitesAccessCache } from "../../lib/auth-utils.js";interface CreateTeamBody {@@ -18,7 +19,8 @@ export async function createTeam(reply: FastifyReply) {const { organizationId } = request.params;- const { name, memberUserIds, siteIds } = request.body;+ const { name, siteIds } = request.body;+ const memberUserIds = request.body.memberUserIds === undefined ? undefined : [...new Set(request.body.memberUserIds)];if (!name || !name.trim()) {return reply.status(400).send({ error: "Team name is required" });@@ -63,6 +65,7 @@ export async function createTeam(await tx.insert(team).values({id: teamId,name: name.trim(),+ memberCount: memberUserIds?.length ?? 0,organizationId,createdAt: now,updatedAt: now,@@ -75,6 +78,7 @@ export async function createTeam(id: crypto.randomUUID(),teamId,userId,+ membershipKey: teamMembershipKey(teamId, userId),createdAt: now,})));diff --git a/server/src/api/teams/teams.test.ts b/server/src/api/teams/teams.test.tsindex 5d0c45f26..fedea1f9f 100644--- a/server/src/api/teams/teams.test.ts+++ b/server/src/api/teams/teams.test.ts@@ -51,6 +51,7 @@ CREATE TABLE "member" ("has_restricted_site_access" boolean NOT NULL DEFAULT false);CREATE TABLE "team" (+ "memberCount" integer NOT NULL DEFAULT 0,"id" text PRIMARY KEY,"name" text NOT NULL,"organizationId" text NOT NULL REFERENCES "organization"("id") ON DELETE CASCADE,@@ -58,6 +59,7 @@ CREATE TABLE "team" ("updatedAt" timestamp);CREATE TABLE "teamMember" (+ "membershipKey" text UNIQUE,"id" text PRIMARY KEY,"teamId" text NOT NULL REFERENCES "team"("id") ON DELETE CASCADE,"userId" text NOT NULL REFERENCES "user"("id") ON DELETE CASCADE,@@ -153,8 +155,8 @@ describe("createTeam", () => {members: ["member_1", "member_2"],siteIds: [1, 2],});- expect(await rows(`SELECT name, "organizationId" FROM team`)).toEqual([- { name: "Product", organizationId: "org_1" },+ expect(await rows(`SELECT name, "organizationId", "memberCount" FROM team`)).toEqual([+ { name: "Product", organizationId: "org_1", memberCount: 2 },]);expect(await rows(`SELECT "userId" FROM "teamMember" ORDER BY "userId"`)).toEqual([{ userId: "member_1" },@@ -338,7 +340,9 @@ describe("updateTeam", () => {expect(reply.statusCode).toBe(200);expect(reply.body).toEqual({ success: true });- expect(await rows(`SELECT name FROM team WHERE id = 'team_a'`)).toEqual([{ name: "Renamed" }]);+ expect(await rows(`SELECT name, "memberCount" FROM team WHERE id = 'team_a'`)).toEqual([+ { name: "Renamed", memberCount: 1 },+ ]);expect(await rows(`SELECT "userId" FROM "teamMember" WHERE "teamId" = 'team_a'`)).toEqual([{ userId: "member_2" }]);expect(await rows(`SELECT site_id FROM team_site_access WHERE team_id = 'team_a'`)).toEqual([{ site_id: 2 }]);expect(mocks.invalidateSitesAccessCache).toHaveBeenCalledTimes(2);diff --git a/server/src/api/teams/updateTeam.ts b/server/src/api/teams/updateTeam.tsindex e9b2b385c..04b5e4e41 100644--- a/server/src/api/teams/updateTeam.ts+++ b/server/src/api/teams/updateTeam.ts@@ -2,6 +2,7 @@ import { eq, and, inArray } from "drizzle-orm";import { FastifyReply, FastifyRequest } from "fastify";import { db } from "../../db/postgres/postgres.js";import { team, teamMember, teamSiteAccess, member, sites } from "../../db/postgres/schema.js";+import { teamMembershipKey } from "../../lib/teamMembership.js";import { invalidateSitesAccessCache } from "../../lib/auth-utils.js";interface UpdateTeamBody {@@ -18,7 +19,8 @@ export async function updateTeam(reply: FastifyReply) {const { organizationId, teamId } = request.params;- const { name, memberUserIds, siteIds } = request.body;+ const { name, siteIds } = request.body;+ const memberUserIds = request.body.memberUserIds === undefined ? undefined : [...new Set(request.body.memberUserIds)];try {// Verify team belongs to org@@ -73,10 +75,11 @@ export async function updateTeam(await db.transaction(async tx => {// Update team name- const updates: Record<string, string> = { updatedAt: now };+ const updates: Record<string, string | number> = { updatedAt: now };if (name !== undefined) {updates.name = name.trim();}+ if (memberUserIds !== undefined) updates.memberCount = memberUserIds.length;await tx.update(team).set(updates).where(eq(team.id, teamId));// Replace members if provided@@ -88,6 +91,7 @@ export async function updateTeam(id: crypto.randomUUID(),teamId,userId,+ membershipKey: teamMembershipKey(teamId, userId),createdAt: now,})));diff --git a/server/src/api/user/createUserInOrganization.ts b/server/src/api/user/createUserInOrganization.tsindex b58f298ad..bd2a71a57 100644--- a/server/src/api/user/createUserInOrganization.ts+++ b/server/src/api/user/createUserInOrganization.ts@@ -86,11 +86,14 @@ export async function createUserInOrganization(request: FastifyRequest<CreateUse}// Create the user + credential account (mirrors better-auth's admin createUser)- const createdUser = await ctx.internalAdapter.createUser({- email,- name: name || email,- emailVerified: false,- });+ const createdUser = await ctx.internalAdapter.createUser(+ {+ email,+ name: name || email,+ emailVerified: false,+ },+ { method: "admin" }+ );if (!createdUser) {return reply.status(500).send({ error: "Failed to create user" });diff --git a/server/src/db/postgres/schema.ts b/server/src/db/postgres/schema.tsindex cedf36928..d71035e35 100644--- a/server/src/db/postgres/schema.ts+++ b/server/src/db/postgres/schema.ts@@ -14,6 +14,7 @@ import {text,timestamp,unique,+ uniqueIndex,pgEnum,uuid,} from "drizzle-orm/pg-core";@@ -296,6 +297,7 @@ export const memberSiteAccess = pgTable(// Team table (BetterAuth)export const team = pgTable("team", {+ memberCount: integer().notNull().default(0),id: text().primaryKey(),name: text().notNull(),organizationId: text().notNull().references(() => organization.id, { onDelete: "cascade" }),@@ -305,6 +307,7 @@ export const team = pgTable("team", {// Team member table (BetterAuth)export const teamMember = pgTable("teamMember", {+ membershipKey: text().unique(),id: text().primaryKey(),teamId: text().notNull().references(() => team.id, { onDelete: "cascade" }),userId: text().notNull().references(() => user.id, { onDelete: "cascade" }),@@ -381,9 +384,8 @@ export const apiKey = pgTable("apikey", {metadata: jsonb(),});-// OAuth provider tables for the MCP plugin (better-auth oidc-provider schema).-// Field names and nullability mirror better-auth's model definitions; tokens-// are validated by better-auth via auth.api.getMcpSession.+// Legacy Better Auth 1.6 OAuth records, retained for rollback.+// Better Auth 1.7 uses the separate tables below; legacy tokens are not accepted.export const oauthApplication = pgTable("oauthApplication", {id: text().primaryKey().notNull(),name: text().notNull(),@@ -428,6 +430,195 @@ export const oauthConsent = pgTable("oauthConsent", {updatedAt: timestamp({ mode: "string" }).notNull(),});+// Better Auth 1.7 OAuth/JWT schema. Kysely stores array fields as JSON,+// even on PostgreSQL; names retain the existing camelCase convention.+export const jwks = pgTable("jwks", {+ id: text("id").primaryKey(),+ publicKey: text("publicKey").notNull(),+ privateKey: text("privateKey").notNull(),+ createdAt: timestamp("createdAt", { mode: "string" }).notNull(),+ expiresAt: timestamp("expiresAt", { mode: "string" }),+ alg: text("alg"),+ crv: text("crv"),+});++export const oauthClient = pgTable(+ "oauthClient",+ {+ id: text("id").primaryKey(),+ clientId: text("clientId").notNull().unique(),+ clientSecret: text("clientSecret"),+ clientDiscoveryId: text("clientDiscoveryId"),+ disabled: boolean("disabled").default(false),+ skipConsent: boolean("skipConsent"),+ enableEndSession: boolean("enableEndSession"),+ subjectType: text("subjectType"),+ scopes: jsonb("scopes").$type<string[]>(),+ clientCredentialsScopes: jsonb("clientCredentialsScopes").$type<string[]>().default([]),+ userId: text("userId").references(() => user.id, { onDelete: "cascade" }),+ createdAt: timestamp("createdAt", { mode: "string" }),+ updatedAt: timestamp("updatedAt", { mode: "string" }),+ name: text("name"),+ uri: text("uri"),+ icon: text("icon"),+ contacts: jsonb("contacts").$type<string[]>(),+ tos: text("tos"),+ policy: text("policy"),+ softwareId: text("softwareId"),+ softwareVersion: text("softwareVersion"),+ softwareStatement: text("softwareStatement"),+ redirectUris: jsonb("redirectUris").$type<string[]>().notNull(),+ postLogoutRedirectUris: jsonb("postLogoutRedirectUris").$type<string[]>(),+ backchannelLogoutUri: text("backchannelLogoutUri"),+ backchannelLogoutSessionRequired: boolean("backchannelLogoutSessionRequired"),+ tokenEndpointAuthMethod: text("tokenEndpointAuthMethod"),+ applicationType: text("applicationType"),+ jwks: text("jwks"),+ jwksUri: text("jwksUri"),+ grantTypes: jsonb("grantTypes").$type<string[]>(),+ responseTypes: jsonb("responseTypes").$type<string[]>(),+ requirePKCE: boolean("requirePKCE"),+ dpopBoundAccessTokens: boolean("dpopBoundAccessTokens").default(false),+ referenceId: text("referenceId"),+ metadata: jsonb("metadata"),+ },+ table => [index("oauthClient_userId_idx").on(table.userId)]+);++export const oauthResource = pgTable("oauthResource", {+ id: text("id").primaryKey(),+ identifier: text("identifier").notNull().unique(),+ name: text("name").notNull(),+ accessTokenTtl: integer("accessTokenTtl"),+ refreshTokenTtl: integer("refreshTokenTtl"),+ signingAlgorithm: text("signingAlgorithm"),+ signingKeyId: text("signingKeyId"),+ allowedScopes: jsonb("allowedScopes").$type<string[]>(),+ customClaims: jsonb("customClaims"),+ dpopBoundAccessTokensRequired: boolean("dpopBoundAccessTokensRequired").default(false),+ disabled: boolean("disabled").default(false),+ createdAt: timestamp("createdAt", { mode: "string" }),+ updatedAt: timestamp("updatedAt", { mode: "string" }),+ policyVersion: integer("policyVersion").default(1),+ metadata: jsonb("metadata"),+});++export const oauthClientResource = pgTable(+ "oauthClientResource",+ {+ id: text("id").primaryKey(),+ clientId: text("clientId")+ .notNull()+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),+ resourceId: text("resourceId")+ .notNull()+ .references(() => oauthResource.identifier, { onDelete: "cascade" }),+ metadata: jsonb("metadata"),+ createdAt: timestamp("createdAt", { mode: "string" }),+ },+ table => [+ uniqueIndex("oauthClientResource_clientId_resourceId_uidx").on(table.clientId, table.resourceId),+ index("oauthClientResource_clientId_idx").on(table.clientId),+ index("oauthClientResource_resourceId_idx").on(table.resourceId),+ ]+);++export const oauthRefreshToken = pgTable(+ "oauthRefreshToken",+ {+ id: text("id").primaryKey(),+ token: text("token").notNull().unique(),+ clientId: text("clientId")+ .notNull()+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),+ sessionId: text("sessionId").references(() => session.id, {+ onDelete: "set null",+ }),+ userId: text("userId")+ .notNull()+ .references(() => user.id, { onDelete: "cascade" }),+ referenceId: text("referenceId"),+ authorizationCodeId: text("authorizationCodeId"),+ resources: jsonb("resources").$type<string[]>(),+ requestedUserInfoClaims: jsonb("requestedUserInfoClaims").$type<string[]>(),+ expiresAt: timestamp("expiresAt", { mode: "string" }).notNull(),+ createdAt: timestamp("createdAt", { mode: "string" }).notNull(),+ revoked: timestamp("revoked", { mode: "string" }),+ rotatedAt: timestamp("rotatedAt", { mode: "string" }),+ rotationReplayResponse: text("rotationReplayResponse"),+ rotationReplayExpiresAt: timestamp("rotationReplayExpiresAt", { mode: "string" }),+ authTime: timestamp("authTime", { mode: "string" }),+ confirmation: jsonb("confirmation"),+ scopes: jsonb("scopes").$type<string[]>().notNull(),+ },+ table => [+ index("oauthRefreshToken_clientId_idx").on(table.clientId),+ index("oauthRefreshToken_sessionId_idx").on(table.sessionId),+ index("oauthRefreshToken_userId_idx").on(table.userId),+ index("oauthRefreshToken_authorizationCodeId_idx").on(table.authorizationCodeId),+ ]+);++export const oauthAccessTokenV2 = pgTable(+ "oauthAccessTokenV2",+ {+ id: text("id").primaryKey(),+ token: text("token").notNull().unique(),+ clientId: text("clientId")+ .notNull()+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),+ sessionId: text("sessionId").references(() => session.id, {+ onDelete: "set null",+ }),+ userId: text("userId").references(() => user.id, { onDelete: "cascade" }),+ referenceId: text("referenceId"),+ authorizationCodeId: text("authorizationCodeId"),+ resources: jsonb("resources").$type<string[]>(),+ requestedUserInfoClaims: jsonb("requestedUserInfoClaims").$type<string[]>(),+ refreshId: text("refreshId").references(() => oauthRefreshToken.id, {+ onDelete: "cascade",+ }),+ expiresAt: timestamp("expiresAt", { mode: "string" }).notNull(),+ createdAt: timestamp("createdAt", { mode: "string" }).notNull(),+ revoked: timestamp("revoked", { mode: "string" }),+ confirmation: jsonb("confirmation"),+ scopes: jsonb("scopes").$type<string[]>().notNull(),+ },+ table => [+ index("oauthAccessTokenV2_clientId_idx").on(table.clientId),+ index("oauthAccessTokenV2_sessionId_idx").on(table.sessionId),+ index("oauthAccessTokenV2_userId_idx").on(table.userId),+ index("oauthAccessTokenV2_authorizationCodeId_idx").on(table.authorizationCodeId),+ index("oauthAccessTokenV2_refreshId_idx").on(table.refreshId),+ ]+);++export const oauthConsentV2 = pgTable(+ "oauthConsentV2",+ {+ id: text("id").primaryKey(),+ clientId: text("clientId")+ .notNull()+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),+ userId: text("userId").references(() => user.id, { onDelete: "cascade" }),+ referenceId: text("referenceId"),+ resources: jsonb("resources").$type<string[]>(),+ requestedUserInfoClaims: jsonb("requestedUserInfoClaims").$type<string[]>(),+ scopes: jsonb("scopes").$type<string[]>().notNull(),+ createdAt: timestamp("createdAt", { mode: "string" }).notNull(),+ updatedAt: timestamp("updatedAt", { mode: "string" }).notNull(),+ },+ table => [+ index("oauthConsentV2_clientId_idx").on(table.clientId),+ index("oauthConsentV2_userId_idx").on(table.userId),+ ]+);++export const oauthClientAssertion = pgTable("oauthClientAssertion", {+ id: text("id").primaryKey(),+ expiresAt: timestamp("expiresAt", { mode: "string" }).notNull(),+});+// Goals table for tracking conversion goalsexport const goals = pgTable("goals",diff --git a/server/src/lib/apiRateLimitCharging.test.ts b/server/src/lib/apiRateLimitCharging.test.tsindex 9fde2998d..6cad0e23e 100644--- a/server/src/lib/apiRateLimitCharging.test.ts+++ b/server/src/lib/apiRateLimitCharging.test.ts@@ -28,7 +28,9 @@ const consumeRateLimitForIdentity = vi.fn();async function loadModules(isCloud: boolean) {vi.resetModules();vi.doMock("./auth.js", () => ({- auth: { api: { verifyApiKey, getMcpSession: vi.fn(async () => null), getSession: vi.fn(async () => null) } },+ auth: {+ api: { verifyApiKey, verifyRybbitOAuthToken: vi.fn(async () => null), getSession: vi.fn(async () => null) },+ },}));vi.doMock("./apiRateLimitPolicy.js", () => ({ consumeRateLimitForIdentity }));vi.doMock("../db/postgres/postgres.js", () => ({ db: {} }));diff --git a/server/src/lib/auth-utils.test.ts b/server/src/lib/auth-utils.test.tsindex f6dd12ee6..5d50df9dc 100644--- a/server/src/lib/auth-utils.test.ts+++ b/server/src/lib/auth-utils.test.ts@@ -8,7 +8,7 @@ vi.mock("./auth.js", () => ({api: {getSession: vi.fn(async () => null),verifyApiKey: vi.fn(async () => ({ valid: false })),- getMcpSession: vi.fn(async () => null),+ verifyRybbitOAuthToken: vi.fn(async () => null),},},}));@@ -85,6 +85,7 @@ CREATE TABLE "member_site_access" ("created_by" text);CREATE TABLE "team" (+ "memberCount" integer NOT NULL DEFAULT 0,"id" text PRIMARY KEY,"name" text NOT NULL,"organizationId" text NOT NULL,@@ -92,6 +93,7 @@ CREATE TABLE "team" ("updatedAt" timestamp);CREATE TABLE "teamMember" (+ "membershipKey" text UNIQUE,"id" text PRIMARY KEY,"teamId" text NOT NULL,"userId" text NOT NULL,@@ -417,9 +419,9 @@ describe("checkApiKey — scope carrying", () => {beforeEach(async () => {vi.mocked(auth.api.verifyApiKey).mockReset();- vi.mocked(auth.api.getMcpSession as any).mockReset();+ vi.mocked(auth.api.verifyRybbitOAuthToken as any).mockReset();vi.mocked(auth.api.verifyApiKey).mockResolvedValue({ valid: false } as any);- vi.mocked(auth.api.getMcpSession as any).mockResolvedValue(null);+ vi.mocked(auth.api.verifyRybbitOAuthToken as any).mockResolvedValue(null);await db.delete(member).where(eq(member.organizationId, "org_scope"));await db.insert(member)@@ -452,7 +454,7 @@ describe("checkApiKey — scope carrying", () => {});it("carries OAuth token scopes as statements via the fallback", async () => {- vi.mocked(auth.api.getMcpSession as any).mockResolvedValue({+ vi.mocked(auth.api.verifyRybbitOAuthToken as any).mockResolvedValue({userId: "user_scope",scopes: "openid goals:read",accessTokenExpiresAt: new Date(Date.now() + 3600_000),@@ -465,7 +467,7 @@ describe("checkApiKey — scope carrying", () => {});it("OAuth tokens without custom scopes are unrestricted", async () => {- vi.mocked(auth.api.getMcpSession as any).mockResolvedValue({+ vi.mocked(auth.api.verifyRybbitOAuthToken as any).mockResolvedValue({userId: "user_scope",scopes: "openid",accessTokenExpiresAt: new Date(Date.now() + 3600_000),@@ -531,8 +533,8 @@ describe("checkApiKey — organization-owned keys", () => {beforeEach(async () => {vi.mocked(auth.api.verifyApiKey).mockReset();- vi.mocked(auth.api.getMcpSession as any).mockReset();- vi.mocked(auth.api.getMcpSession as any).mockResolvedValue(null);+ vi.mocked(auth.api.verifyRybbitOAuthToken as any).mockReset();+ vi.mocked(auth.api.verifyRybbitOAuthToken as any).mockResolvedValue(null);await db.insert(sites).values([{ id: "hex_org_a", siteId: 501, name: "org-a-site", domain: "a.example.com", organizationId: "org_a" },{ id: "hex_org_b", siteId: 502, name: "org-b-site", domain: "b.example.com", organizationId: "org_b" },diff --git a/server/src/lib/auth-utils.ts b/server/src/lib/auth-utils.tsindex a55b390aa..d44b19893 100644--- a/server/src/lib/auth-utils.ts+++ b/server/src/lib/auth-utils.ts@@ -27,7 +27,7 @@ import { logger } from "./logger/logger.js";// The MCP gate injects fakes; the REST layer always uses better-auth.const bearerResolverDeps: BearerResolverDeps = {verifyApiKey: apiKey => auth.api.verifyApiKey({ body: { key: apiKey } }),- getOAuthSession: token => auth.api.getMcpSession({ headers: new Headers({ authorization: `Bearer ${token}` }) }),+ getOAuthSession: token => auth.api.verifyRybbitOAuthToken({ body: { token } }),};// Several guards resolve the same credential more than once per HTTP request:diff --git a/server/src/lib/auth.ts b/server/src/lib/auth.tsindex 4bf88c255..4b743b7de 100644--- a/server/src/lib/auth.ts+++ b/server/src/lib/auth.ts@@ -1,9 +1,9 @@import { betterAuth } from "better-auth";import { APIError, createAuthMiddleware, getSessionFromCtx } from "better-auth/api";-import { admin, captcha, emailOTP, mcp, organization } from "better-auth/plugins";+import { admin, captcha, emailOTP, organization } from "better-auth/plugins";import { createAccessControl } from "better-auth/plugins/access";import { adminAc, defaultStatements, memberAc, ownerAc } from "better-auth/plugins/organization/access";-import { ALL_SCOPE_STRINGS, OIDC_STANDARD_SCOPES } from "./scopes.js";+import { createOAuthPlugins, getAuthBaseUrl } from "./oauth.js";import dotenv from "dotenv";import { and, asc, eq, inArray } from "drizzle-orm";import pg from "pg";@@ -61,26 +61,7 @@ const apiKeyRateLimit = { enabled: false };const pluginList = [admin(),- // OAuth provider for MCP clients (RFC 8414/9728 discovery, dynamic client- // registration, authorization-code + PKCE). The root /.well-known routes are- // registered in index.ts; token validation happens via auth.api.getMcpSession.- mcp({- loginPage: "/login",- ...(process.env.BASE_URL ? { resource: `${process.env.BASE_URL.replace(/\/$/, "")}/api/mcp` } : {}),- oidcConfig: {- loginPage: "/login",- // Registers the custom resource:action scopes so /mcp/authorize's- // invalid_scope check accepts them (merged after the standard scopes).- scopes: [...ALL_SCOPE_STRINGS],- // Advertised metadata is NOT derived from `scopes`. This feeds the- // RFC 9728 protected-resource document; the RFC 8414 authorization-server- // document is augmented in mcp/wellKnown.ts (better-auth builds it from a- // top-level option the mcp() plugin type doesn't expose).- metadata: {- scopes_supported: [...OIDC_STANDARD_SCOPES, ...ALL_SCOPE_STRINGS],- },- },- }),+ ...createOAuthPlugins(getAuthBaseUrl()),apiKey([{// User-owned keys. Pre-existing rows (NULL configId) resolve here.@@ -251,6 +232,7 @@ const pluginList = [export const auth = betterAuth({basePath: "/api/auth",+ baseURL: getAuthBaseUrl(),appName: "Rybbit",logger: {log: (level, message, ...args) => {diff --git a/server/src/lib/oauth.test.ts b/server/src/lib/oauth.test.tsnew file mode 100644index 000000000..9a75a5375--- /dev/null+++ b/server/src/lib/oauth.test.ts@@ -0,0 +1,371 @@+import { PGlite } from "@electric-sql/pglite";+import { apiKey } from "@better-auth/api-key";+import { betterAuth } from "better-auth";+import { admin, emailOTP, organization } from "better-auth/plugins";+import { Kysely, PostgresDialect, type PostgresPoolClient } from "kysely";+import { createHash, createHmac } from "node:crypto";+import { readFile } from "node:fs/promises";+import { afterAll, beforeAll, describe, expect, it } from "vitest";+import { createOAuthPlugins, getAuthBaseUrl } from "./oauth.js";+import { teamMembershipKey } from "./teamMembership.js";++const origin = "http://localhost:3002";+const resource = `${origin}/api/mcp`;+const secret = "test-only-auth-173-secret-at-least-32-characters";+const existingApiKey = "existing-api-key-at-least-32-characters";+const migrationDirectory = new URL("../../drizzle/", import.meta.url);++describe("Better Auth 1.7 migration and OAuth integration", () => {+ const database = new PGlite();+ // Exercise the production Kysely PostgreSQL adapter using a disposable+ // PostgreSQL engine. No application DB, network or live credentials.+ const kysely = new Kysely({+ dialect: new PostgresDialect({+ pool: {+ connect: async () => ({+ query: (async (sql: string, parameters: unknown[]) => {+ const result = await database.query(sql, parameters);+ return {+ rows: result.rows,+ rowCount: result.affectedRows ?? result.rows.length,+ command: sql.trim().split(/\s/)[0].toUpperCase() as "SELECT" | "INSERT" | "UPDATE" | "DELETE",+ };+ }) as PostgresPoolClient["query"],+ release() {},+ }),+ async end() {},+ },+ }),+ });+ let otp = "";+ const createTestAuth = () =>+ betterAuth({+ baseURL: origin,+ secret,+ database: { db: kysely, type: "postgres" },+ emailAndPassword: { enabled: true },+ plugins: [+ ...createOAuthPlugins(origin),+ admin(),+ organization({ teams: { enabled: true } }),+ apiKey(),+ emailOTP({+ sendVerificationOTP: async data => {+ otp = data.otp;+ },+ }),+ ],+ advanced: { database: { generateId: () => crypto.randomUUID() } },+ });++ let auth: ReturnType<typeof createTestAuth>;++ async function request(path: string, body?: Record<string, unknown>, cookie?: string) {+ const form = path === "/oauth2/token" || path === "/oauth2/revoke";+ return auth.handler(+ new Request(`${origin}/api/auth${path}`, {+ method: body ? "POST" : "GET",+ headers: {+ origin,+ accept: "application/json",+ ...(body ? { "content-type": form ? "application/x-www-form-urlencoded" : "application/json" } : {}),+ ...(cookie ? { cookie } : {}),+ },+ ...(body+ ? { body: form ? new URLSearchParams(body as Record<string, string>).toString() : JSON.stringify(body) }+ : {}),+ })+ );+ }++ beforeAll(async () => {+ const journal = JSON.parse(await readFile(new URL("meta/_journal.json", migrationDirectory), "utf8"));+ for (const entry of journal.entries.filter((entry: { idx: number }) => entry.idx < 18)) {+ await database.exec(await readFile(new URL(`${entry.tag}.sql`, migrationDirectory), "utf8"));+ }+ await database.exec(`+ INSERT INTO "user" (id, name, email, "emailVerified", "createdAt", "updatedAt")+ VALUES ('existing-user', 'Existing', '[email protected]', true, now(), now());+ INSERT INTO organization (id, name, slug, "createdAt") VALUES ('existing-org', 'Existing org', 'existing', now());+ INSERT INTO team (id, name, "organizationId", "createdAt") VALUES ('existing-team', 'Existing team', 'existing-org', now());+ INSERT INTO "teamMember" (id, "teamId", "userId", "createdAt") VALUES ('existing-member', 'existing-team', 'existing-user', now());+ INSERT INTO "oauthApplication" (id, name, "clientId", "clientSecret", "redirectUrls", type, "createdAt", "updatedAt") VALUES+ ('public-row', 'Existing public client', 'existing-public', '', 'http://localhost:9876/callback', 'public', now(), now()),+ ('confidential-row', 'Existing confidential client', 'existing-confidential', 'old-client-secret', 'https://client.example/callback', 'web', now(), now());+ INSERT INTO "oauthAccessToken" (id, "accessToken", "accessTokenExpiresAt", "clientId", "userId", scopes, "createdAt", "updatedAt")+ VALUES ('old-token-row', 'old-token', now() + interval '1 day', 'existing-public', 'existing-user', 'openid', now(), now());+ INSERT INTO session (id, token, "userId", "expiresAt", "createdAt", "updatedAt")+ VALUES ('existing-session', 'existing-session-token', 'existing-user', now() + interval '1 day', now(), now());+ `);+ await database.query(+ `INSERT INTO apikey (id, key, "referenceId", "createdAt", "updatedAt")+ VALUES ('existing-api-key', $1, 'existing-user', now(), now())`,+ [createHash("sha256").update(existingApiKey).digest("base64url")]+ );+ await database.exec(await readFile(new URL("0018_better_auth_173.sql", migrationDirectory), "utf8"));+ auth = createTestAuth();+ await auth.$context;+ }, 30_000);++ afterAll(async () => {+ await kysely.destroy();+ await database.close();+ });++ it("keeps pre-migration session cookies and API keys usable", async () => {+ const token = "existing-session-token";+ const signed = `${token}.${createHmac("sha256", secret).update(token).digest("base64")}`;+ const session = await request("/get-session", undefined, `better-auth.session_token=${encodeURIComponent(signed)}`);+ expect(session.status).toBe(200);+ expect(await session.json()).toMatchObject({ user: { id: "existing-user" } });+ expect(await auth.api.verifyApiKey({ body: { key: existingApiKey } })).toMatchObject({+ valid: true,+ key: { referenceId: "existing-user" },+ });+ });++ it("preserves clients, hashes confidential secrets, backfills team counts and retains legacy records", async () => {+ const { rows } = await database.query<{+ clientId: string;+ clientSecret: string | null;+ tokenEndpointAuthMethod: string;+ }>(`SELECT * FROM "oauthClient" ORDER BY "clientId"`);+ expect(rows).toEqual(+ expect.arrayContaining([+ expect.objectContaining({ clientId: "existing-public", clientSecret: null, tokenEndpointAuthMethod: "none" }),+ expect.objectContaining({+ clientId: "existing-confidential",+ clientSecret: createHash("sha256").update("old-client-secret").digest("base64url"),+ tokenEndpointAuthMethod: "client_secret_basic",+ }),+ ])+ );+ expect((await database.query(`SELECT "memberCount" FROM team WHERE id = 'existing-team'`)).rows).toEqual([+ { memberCount: 1 },+ ]);+ expect((await database.query(`SELECT id FROM "oauthAccessToken"`)).rows).toEqual([{ id: "old-token-row" }]);+ await expect(auth.api.verifyRybbitOAuthToken({ body: { token: "old-token" } })).rejects.toThrow();+ });++ it("serves current discovery and never exposes the server-only token verifier", async () => {+ const metadata = await auth.api.getOAuthServerConfig();+ expect(metadata.authorization_endpoint).toBe(`${origin}/api/auth/oauth2/authorize`);+ expect(metadata.registration_endpoint).toBe(`${origin}/api/auth/oauth2/register`);+ const response = await auth.handler(new Request(`${origin}/.well-known/oauth-protected-resource`));+ expect(response.status).toBe(200);+ expect(await response.json()).toMatchObject({+ resource,+ scopes_supported: expect.arrayContaining(["analytics:read"]),+ });+ expect((await request("/rybbit/verify-oauth", { token: "old-token" })).status).toBe(404);+ });++ it("rejects expired, wrong-audience and proof-bound tokens, and disabled clients", async () => {+ const payload = {+ sub: "existing-user",+ azp: "existing-public",+ scope: "analytics:read",+ iss: `${origin}/api/auth`,+ aud: resource,+ exp: Math.floor(Date.now() / 1000) + 600,+ };+ const sign = async (overrides: Record<string, unknown> = {}) =>+ (await auth.api.signJWT({ body: { payload: { ...payload, ...overrides } } })).token;+ const valid = await sign();+ expect(await auth.api.verifyRybbitOAuthToken({ body: { token: valid } })).toMatchObject({+ userId: "existing-user",+ });+ for (const overrides of [{ exp: 1 }, { aud: "https://other.example/api" }, { iss: "https://other.example" }]) {+ await expect(auth.api.verifyRybbitOAuthToken({ body: { token: await sign(overrides) } })).rejects.toThrow();+ }+ expect(+ await auth.api.verifyRybbitOAuthToken({ body: { token: await sign({ cnf: { jkt: "proof-required" } }) } })+ ).toBeNull();+ await database.exec(`UPDATE "oauthClient" SET disabled = true WHERE "clientId" = 'existing-public'`);+ await expect(auth.api.verifyRybbitOAuthToken({ body: { token: valid } })).rejects.toThrow();+ await database.exec(`UPDATE "oauthClient" SET disabled = false WHERE "clientId" = 'existing-public'`);+ });++ it("completes DCR, login, consent, PKCE, refresh and bearer verification", async () => {+ const registration = await request("/oauth2/register", {+ client_name: "Migration integration client",+ redirect_uris: ["http://localhost:9876/callback"],+ application_type: "native",+ token_endpoint_auth_method: "none",+ grant_types: ["authorization_code", "refresh_token"],+ response_types: ["code"],+ });+ expect(registration.status, await registration.clone().text()).toBe(201);+ const client = await registration.json();+ const verifier = "v".repeat(64);+ const query = new URLSearchParams({+ client_id: client.client_id,+ redirect_uri: "http://localhost:9876/callback",+ response_type: "code",+ scope: "openid offline_access analytics:read",+ resource,+ code_challenge: createHash("sha256").update(verifier).digest("base64url"),+ code_challenge_method: "S256",+ state: "test-state",+ });+ const authorize = await request(`/oauth2/authorize?${query}`);+ const loginUrl = new URL((await authorize.json()).url);+ expect(loginUrl.pathname).toBe("/login");+ const signup = await request("/sign-up/email", {+ name: "OAuth test",+ email: "[email protected]",+ password: "strong-test-password-123",+ oauth_query: loginUrl.search.slice(1),+ });+ expect(signup.status, await signup.clone().text()).toBe(200);+ const signedIn = await signup.json();+ const cookie = signup.headers+ .getSetCookie()+ .map(value => value.split(";")[0])+ .join("; ");+ const consentUrl = new URL(signedIn.url);+ expect(consentUrl.pathname).toBe("/auth/consent");+ const tamperedQuery = new URLSearchParams(consentUrl.search);+ tamperedQuery.set("scope", "openid offline_access org:write");+ expect(+ (await request("/oauth2/consent", { accept: true, oauth_query: tamperedQuery.toString() }, cookie)).status+ ).toBe(400);+ const consent = await request("/oauth2/consent", { accept: true, oauth_query: consentUrl.search.slice(1) }, cookie);+ expect(consent.status, await consent.clone().text()).toBe(200);+ const callback = new URL((await consent.json()).url);+ expect(callback.searchParams.get("state")).toBe("test-state");+ const exchange = await request("/oauth2/token", {+ grant_type: "authorization_code",+ client_id: client.client_id,+ code: callback.searchParams.get("code"),+ redirect_uri: "http://localhost:9876/callback",+ code_verifier: verifier,+ resource,+ });+ expect(exchange.status, await exchange.clone().text()).toBe(200);+ const tokens = await exchange.json();+ const identity = await auth.api.verifyRybbitOAuthToken({ body: { token: tokens.access_token } });+ expect(identity).toMatchObject({ scopes: "openid offline_access analytics:read", userId: expect.any(String) });+ const refresh = await request("/oauth2/token", {+ grant_type: "refresh_token",+ refresh_token: tokens.refresh_token,+ client_id: client.client_id,+ resource,+ });+ expect(refresh.status, await refresh.clone().text()).toBe(200);+ const renewed = await refresh.json();+ expect(await auth.api.verifyRybbitOAuthToken({ body: { token: renewed.access_token } })).toMatchObject({+ userId: identity!.userId,+ });+ const revokeAccess = await request("/oauth2/revoke", {+ token: renewed.access_token,+ token_type_hint: "access_token",+ client_id: client.client_id,+ });+ expect(revokeAccess.status, await revokeAccess.clone().text()).toBe(400);+ expect(await revokeAccess.json()).toMatchObject({ error: "unsupported_token_type" });+ const revokeRefresh = await request("/oauth2/revoke", {+ token: renewed.refresh_token,+ token_type_hint: "refresh_token",+ client_id: client.client_id,+ });+ expect(revokeRefresh.status, await revokeRefresh.clone().text()).toBe(200);+ const refreshAfterRevocation = await request("/oauth2/token", {+ grant_type: "refresh_token",+ refresh_token: renewed.refresh_token,+ client_id: client.client_id,+ resource,+ });+ expect(refreshAfterRevocation.status).toBe(400);+ // Refresh revocation cannot revoke the already-issued JWT. The linked+ // session check below still invalidates it as soon as the user signs out.+ expect(await auth.api.verifyRybbitOAuthToken({ body: { token: renewed.access_token } })).toMatchObject({+ userId: identity!.userId,+ });+ await expect(+ auth.api.verifyRybbitOAuthToken({ body: { token: tokens.access_token + "tampered" } })+ ).rejects.toThrow();+ expect((await request("/sign-out", {}, cookie)).status).toBe(200);+ await expect(auth.api.verifyRybbitOAuthToken({ body: { token: renewed.access_token } })).rejects.toThrow();+ });++ it("uses the same membership key as Better Auth's team API", async () => {+ const result = await request("/sign-up/email", {+ name: "Team owner",+ email: "[email protected]",+ password: "strong-test-password-123",+ });+ expect(result.status, await result.clone().text()).toBe(200);+ const user = (await result.json()).user;+ const cookie = result.headers+ .getSetCookie()+ .map(value => value.split(";")[0])+ .join("; ");+ const org = await auth.api.createOrganization({+ body: { name: "Test org", slug: "test-org" },+ headers: new Headers({ cookie }),+ });+ const { rows } = await database.query<{ teamId: string; membershipKey: string }>(+ `SELECT "teamId", "membershipKey" FROM "teamMember" WHERE "userId" = $1`,+ [user.id]+ );+ expect(org).toBeTruthy();+ expect(rows.length).toBeGreaterThan(0);+ expect(rows[0].membershipKey).toBe(teamMembershipKey(rows[0].teamId, user.id));+ });++ it("supports password recovery with email OTP on an unverified password account", async () => {+ await request("/sign-up/email", {+ name: "OTP user",+ email: "[email protected]",+ password: "strong-test-password-123",+ });+ const sent = await request("/email-otp/send-verification-otp", {+ email: "[email protected]",+ type: "forget-password",+ });+ expect(sent.status, await sent.clone().text()).toBe(200);+ const reset = await request("/email-otp/reset-password", {+ email: "[email protected]",+ otp,+ password: "new-strong-test-password-456",+ });+ expect(reset.status, await reset.clone().text()).toBe(200);+ const login = await request("/sign-in/email", {+ email: "[email protected]",+ password: "new-strong-test-password-456",+ });+ expect(login.status, await login.clone().text()).toBe(200);+ });++ it("rejects duplicate account identities before attempting schema changes", async () => {+ await database.exec(`INSERT INTO account (id, "accountId", "providerId", "userId", "createdAt", "updatedAt") VALUES+ ('duplicate-1', 'same', 'test', 'existing-user', now(), now()),+ ('duplicate-2', 'same', 'test', 'existing-user', now(), now());`);+ const migration = await readFile(new URL("0018_better_auth_173.sql", migrationDirectory), "utf8");+ await expect(database.exec(migration.split("--> statement-breakpoint")[0])).rejects.toThrow(+ "resolve duplicate account"+ );+ await database.exec(`DELETE FROM account WHERE "providerId" = 'test'`);+ });++ it("validates legacy metadata with PostgreSQL before attempting schema changes", async () => {+ const migration = await readFile(new URL("0018_better_auth_173.sql", migrationDirectory), "utf8");+ const preflight = migration.split("--> statement-breakpoint")[0];+ for (const metadata of ["not json", '{"broken":']) {+ await database.query(`UPDATE "oauthApplication" SET metadata = $1 WHERE id = 'public-row'`, [metadata]);+ await expect(database.exec(preflight)).rejects.toThrow(+ "resolve invalid JSON metadata for oauthApplication id public-row"+ );+ }+ for (const metadata of [null, "", '{"valid":true}', '"valid scalar"', "null"]) {+ await database.query(`UPDATE "oauthApplication" SET metadata = $1 WHERE id = 'public-row'`, [metadata]);+ await database.exec(preflight);+ }+ });+});++it("keeps authentication available for non-TLS LAN self-hosting", () => {+ expect(getAuthBaseUrl({ BASE_URL: " https://rybbit.example/ " })).toBe("https://rybbit.example");+ expect(createOAuthPlugins("http://192.168.1.10").map(plugin => plugin.id)).toEqual(["rybbit-oauth"]);+});diff --git a/server/src/lib/oauth.ts b/server/src/lib/oauth.tsnew file mode 100644index 000000000..08a3b22d4--- /dev/null+++ b/server/src/lib/oauth.ts@@ -0,0 +1,77 @@+import { mcp } from "@better-auth/mcp";+import { getOAuthProviderApi } from "@better-auth/oauth-provider";+import { createAuthEndpoint } from "better-auth/api";+import { jwt } from "better-auth/plugins";+import { z } from "zod";+import { ALL_SCOPE_STRINGS, OIDC_STANDARD_SCOPES } from "./scopes.js";++export function getAuthBaseUrl(env: NodeJS.ProcessEnv = process.env): string {+ return (env.BASE_URL || env.BETTER_AUTH_URL || "http://localhost:3002")+ .trim()+ .replace(/\/+$/, "")+ .replace(/\/api\/auth$/, "");+}++export function createOAuthPlugins(baseUrl: string) {+ const resource = `${baseUrl}/api/mcp`;+ const url = new URL(baseUrl);+ const supportsOAuth =+ url.protocol === "https:" ||+ (url.protocol === "http:" &&+ (url.hostname === "localhost" || url.hostname === "[::1]" || /^127\./.test(url.hostname)));+ const options = {+ loginPage: `${baseUrl}/login`,+ consentPage: `${baseUrl}/auth/consent`,+ resource,+ resources: [resource],+ // Separate stores let the migration preserve 1.6 tokens and consent for+ // rollback without ever accepting them through the 1.7 verifier.+ schema: {+ oauthAccessToken: { modelName: "oauthAccessTokenV2" },+ oauthConsent: { modelName: "oauthConsentV2" },+ },+ scopes: [...OIDC_STANDARD_SCOPES, ...ALL_SCOPE_STRINGS],+ grantTypes: ["authorization_code", "refresh_token"] as ("authorization_code" | "refresh_token")[],+ // Existing MCP clients use DCR. Keep it explicitly enabled after 1.7.+ allowDynamicClientRegistration: true,+ allowUnauthenticatedClientRegistration: true,+ // There is one public resource. Imported 1.6 clients have no resource+ // join rows; issued tokens are still bound to this resource and verified.+ enforcePerClientResources: false,+ };+ return [+ // Non-TLS LAN self-hosting still supports password sessions and API keys.+ // Better Auth 1.7 requires HTTPS (or loopback) for an OAuth resource.+ ...(supportsOAuth ? [jwt(), mcp(options)] : []),+ {+ id: "rybbit-oauth",+ endpoints: {+ // Keep verification inside a Better Auth endpoint context so the+ // provider checks signatures, expiry, linked sessions and client state.+ // JWTs have no per-token revocation check; see the rollout notes.+ // This capability is never exposed as an HTTP route.+ verifyRybbitOAuthToken: createAuthEndpoint(+ "/rybbit/verify-oauth",+ {+ method: "POST",+ body: z.object({ token: z.string() }),+ metadata: { SERVER_ONLY: true },+ },+ async ctx => {+ if (!supportsOAuth) return null;+ const token = await getOAuthProviderApi(ctx, options).requireActiveAccessToken(ctx.body.token);+ const audiences = Array.isArray(token.aud) ? token.aud : [token.aud];+ // These routes accept Bearer only. A bound token must never bypass+ // proof validation by being presented as an ordinary bearer token.+ if (!token.sub || !token.exp || token.cnf || !audiences.includes(resource)) return null;+ return {+ userId: token.sub,+ accessTokenExpiresAt: new Date(token.exp * 1000),+ scopes: typeof token.scope === "string" ? token.scope : "",+ };+ }+ ),+ },+ },+ ];+}diff --git a/server/src/lib/teamMembership.ts b/server/src/lib/teamMembership.tsnew file mode 100644index 000000000..56d737600--- /dev/null+++ b/server/src/lib/teamMembership.ts@@ -0,0 +1,9 @@+import { createHash } from "node:crypto";++// Matches Better Auth 1.7's organization adapter. Direct team writes must+// maintain the same membership identity as writes through the auth API.+export function teamMembershipKey(teamId: string, userId: string): string {+ return createHash("sha256")+ .update(JSON.stringify([teamId, userId]))+ .digest("base64url");+}diff --git a/server/src/mcp/auth.ts b/server/src/mcp/auth.tsindex 594dff113..24d3a0cd8 100644--- a/server/src/mcp/auth.ts+++ b/server/src/mcp/auth.ts@@ -42,7 +42,7 @@ const defaultDependencies: McpAuthenticatorDependencies = {},getOAuthSession: async bearerToken => {const { auth } = await import("../lib/auth.js");- return auth.api.getMcpSession({ headers: new Headers({ authorization: `Bearer ${bearerToken}` }) });+ return auth.api.verifyRybbitOAuthToken({ body: { token: bearerToken } });},consumeRateLimit: async identity => {const { IS_CLOUD } = await import("../lib/const.js");diff --git a/server/src/mcp/wellKnown.test.ts b/server/src/mcp/wellKnown.test.tsindex ee98b63f7..dfdd66c50 100644--- a/server/src/mcp/wellKnown.test.ts+++ b/server/src/mcp/wellKnown.test.ts@@ -4,9 +4,9 @@ import { createOAuthWellKnownRoutes, getResourceMetadataUrl, type OAuthWellKnownconst AS_METADATA = {issuer: "https://rybbit.example.com",- authorization_endpoint: "https://rybbit.example.com/api/auth/mcp/authorize",- token_endpoint: "https://rybbit.example.com/api/auth/mcp/token",- registration_endpoint: "https://rybbit.example.com/api/auth/mcp/register",+ authorization_endpoint: "https://rybbit.example.com/api/auth/oauth2/authorize",+ token_endpoint: "https://rybbit.example.com/api/auth/oauth2/token",+ registration_endpoint: "https://rybbit.example.com/api/auth/oauth2/register",};const PR_METADATA = {@@ -41,8 +41,10 @@ describe("oauth well-known routes", () => {for (const url of ["/.well-known/oauth-authorization-server","/.well-known/oauth-authorization-server/api/mcp",+ "/.well-known/oauth-authorization-server/api/auth","/.well-known/openid-configuration","/.well-known/openid-configuration/api/mcp",+ "/.well-known/openid-configuration/api/auth",]) {const response = await app.inject({ method: "GET", url });diff --git a/server/src/mcp/wellKnown.ts b/server/src/mcp/wellKnown.tsindex 07455a181..e5d890430 100644--- a/server/src/mcp/wellKnown.ts+++ b/server/src/mcp/wellKnown.ts@@ -1,4 +1,3 @@-import { ALL_SCOPE_STRINGS, OIDC_STANDARD_SCOPES } from "../lib/scopes.js";import type { FastifyInstance, FastifyReply } from "fastify";export interface OAuthWellKnownDependencies {@@ -6,29 +5,20 @@ export interface OAuthWellKnownDependencies {getProtectedResourceMetadata: () => Promise<object | null>;}-const SCOPES_SUPPORTED = [...OIDC_STANDARD_SCOPES, ...ALL_SCOPE_STRINGS];--// better-auth's authorization-server metadata builder only reads a top-level-// `metadata` option (which the mcp() plugin type doesn't expose), so it can't-// advertise our custom resource:action scopes — it hardcodes the 4 OIDC ones.-// We re-serve this document at the domain root, so inject scopes_supported here-// where clients actually read it. (The protected-resource document does honor-// oidcConfig.metadata, but we normalize both for consistency.)-function withScopesSupported(metadata: object | null): object | null {- if (!metadata) return metadata;- return { ...metadata, scopes_supported: SCOPES_SUPPORTED };-}-// Dynamic imports keep this module (and its tests) from loading the full// better-auth dependency chain at import time.const defaultDependencies: OAuthWellKnownDependencies = {getAuthorizationServerMetadata: async () => {const { auth } = await import("../lib/auth.js");- return withScopesSupported(await auth.api.getMcpOAuthConfig());+ if (!auth.api.getOAuthServerConfig) return null;+ return auth.api.getOAuthServerConfig();},getProtectedResourceMetadata: async () => {const { auth } = await import("../lib/auth.js");- return withScopesSupported(await auth.api.getMCPProtectedResource());+ const { getAuthBaseUrl } = await import("../lib/oauth.js");+ const response = await auth.handler(new Request(`${getAuthBaseUrl()}/.well-known/oauth-protected-resource`));+ if (!response.ok) return null;+ return response.json();},};@@ -72,8 +62,10 @@ export function createOAuthWellKnownRoutes(dependencies: OAuthWellKnownDependencconst authorizationServerPaths = ["/.well-known/oauth-authorization-server","/.well-known/oauth-authorization-server/api/mcp",+ "/.well-known/oauth-authorization-server/api/auth","/.well-known/openid-configuration","/.well-known/openid-configuration/api/mcp",+ "/.well-known/openid-configuration/api/auth",];for (const path of authorizationServerPaths) {fastify.get(path, (_request, reply) => send(reply, dependencies.getAuthorizationServerMetadata));