A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: supabase
dextmorgn2cf3c8a3435d
diff --git a/backend/.env.example b/backend/.env.examplenew file mode 100644index 00000000..f17bb4ba--- /dev/null+++ b/backend/.env.example@@ -0,0 +1,123 @@+############+# Secrets+# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION+############++POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password+JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long+ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE+SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q+DASHBOARD_USERNAME=supabase+DASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated+SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq+VAULT_ENC_KEY=your-encryption-key-32-chars-min+++############+# Database - You can change these to any PostgreSQL database that has logical replication enabled.+############++POSTGRES_HOST=db+POSTGRES_DB=postgres+POSTGRES_PORT=5432+# default user is postgres+++############+# Supavisor -- Database pooler+############+POOLER_PROXY_PORT_TRANSACTION=6543+POOLER_DEFAULT_POOL_SIZE=20+POOLER_MAX_CLIENT_CONN=100+POOLER_TENANT_ID=your-tenant-id+++############+# API Proxy - Configuration for the Kong Reverse proxy.+############++KONG_HTTP_PORT=8000+KONG_HTTPS_PORT=8443+++############+# API - Configuration for PostgREST.+############++PGRST_DB_SCHEMAS=public,storage,graphql_public+++############+# Auth - Configuration for the GoTrue authentication server.+############++## General+SITE_URL=http://localhost:3000+ADDITIONAL_REDIRECT_URLS=+JWT_EXPIRY=3600+DISABLE_SIGNUP=false+API_EXTERNAL_URL=http://localhost:8000++## Mailer Config+MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify"+MAILER_URLPATHS_INVITE="/auth/v1/verify"+MAILER_URLPATHS_RECOVERY="/auth/v1/verify"+MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify"++## Email auth+ENABLE_EMAIL_SIGNUP=true+ENABLE_EMAIL_AUTOCONFIRM=true+SMTP_HOST=supabase-mail+SMTP_PORT=2500+SMTP_USER=fake_mail_user+SMTP_PASS=fake_mail_password+SMTP_SENDER_NAME=fake_sender+ENABLE_ANONYMOUS_USERS=false++## Phone auth+ENABLE_PHONE_SIGNUP=true+ENABLE_PHONE_AUTOCONFIRM=true+++############+# Studio - Configuration for the Dashboard+############++STUDIO_DEFAULT_ORGANIZATION=Default Organization+STUDIO_DEFAULT_PROJECT=Default Project++STUDIO_PORT=3000+# replace if you intend to use Studio outside of localhost+SUPABASE_PUBLIC_URL=http://localhost:8000++# Enable webp support+IMGPROXY_ENABLE_WEBP_DETECTION=true++# Add your OpenAI API key to enable SQL Editor Assistant+OPENAI_API_KEY=+++############+# Functions - Configuration for Functions+############+# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet.+FUNCTIONS_VERIFY_JWT=false+++############+# Logs - Configuration for Logflare+# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introduction+############++LOGFLARE_LOGGER_BACKEND_API_KEY=your-super-secret-and-long-logflare-key++# Change vector.toml sinks to reflect this change+LOGFLARE_API_KEY=your-super-secret-and-long-logflare-key++# Docker socket location - this value will differ depending on your OS+DOCKER_SOCKET_LOCATION=/var/run/docker.sock++# Google Cloud Project details+GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID+GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBERdiff --git a/backend/.gitignore b/backend/.gitignorenew file mode 100644index 00000000..a1e9dc61--- /dev/null+++ b/backend/.gitignore@@ -0,0 +1,5 @@+volumes/db/data+volumes/storage+.env+test.http+docker-compose.override.ymldiff --git a/backend/README.md b/backend/README.mdnew file mode 100644index 00000000..9ab215b9--- /dev/null+++ b/backend/README.md@@ -0,0 +1,3 @@+# Supabase Docker++This is a minimal Docker Compose setup for self-hosting Supabase. Follow the steps [here](https://supabase.com/docs/guides/hosting/docker) to get started.diff --git a/backend/dev/data.sql b/backend/dev/data.sqlnew file mode 100644index 00000000..23280041--- /dev/null+++ b/backend/dev/data.sql@@ -0,0 +1,48 @@+create table profiles (+ id uuid references auth.users not null,+ updated_at timestamp with time zone,+ username text unique,+ avatar_url text,+ website text,++ primary key (id),+ unique(username),+ constraint username_length check (char_length(username) >= 3)+);++alter table profiles enable row level security;++create policy "Public profiles are viewable by the owner."+ on profiles for select+ using ( auth.uid() = id );++create policy "Users can insert their own profile."+ on profiles for insert+ with check ( auth.uid() = id );++create policy "Users can update own profile."+ on profiles for update+ using ( auth.uid() = id );++-- Set up Realtime+begin;+ drop publication if exists supabase_realtime;+ create publication supabase_realtime;+commit;+alter publication supabase_realtime add table profiles;++-- Set up Storage+insert into storage.buckets (id, name)+values ('avatars', 'avatars');++create policy "Avatar images are publicly accessible."+ on storage.objects for select+ using ( bucket_id = 'avatars' );++create policy "Anyone can upload an avatar."+ on storage.objects for insert+ with check ( bucket_id = 'avatars' );++create policy "Anyone can update an avatar."+ on storage.objects for update+ with check ( bucket_id = 'avatars' );diff --git a/backend/dev/docker-compose.dev.yml b/backend/dev/docker-compose.dev.ymlnew file mode 100644index 00000000..ca19a0ad--- /dev/null+++ b/backend/dev/docker-compose.dev.yml@@ -0,0 +1,34 @@+version: "3.8"++services:+ studio:+ build:+ context: ..+ dockerfile: studio/Dockerfile+ target: dev+ ports:+ - 8082:8082+ mail:+ container_name: supabase-mail+ image: inbucket/inbucket:3.0.3+ ports:+ - '2500:2500' # SMTP+ - '9000:9000' # web interface+ - '1100:1100' # POP3+ auth:+ environment:+ - GOTRUE_SMTP_USER=+ - GOTRUE_SMTP_PASS=+ meta:+ ports:+ - 5555:8080+ db:+ restart: 'no'+ volumes:+ # Always use a fresh database when developing+ - /var/lib/postgresql/data+ # Seed data should be inserted last (alphabetical order)+ - ./dev/data.sql:/docker-entrypoint-initdb.d/seed.sql+ storage:+ volumes:+ - /var/lib/storagediff --git a/backend/docker-compose.s3.yml b/backend/docker-compose.s3.ymlnew file mode 100644index 00000000..043691a6--- /dev/null+++ b/backend/docker-compose.s3.yml@@ -0,0 +1,94 @@+services:++ minio:+ image: minio/minio+ ports:+ - '9000:9000'+ - '9001:9001'+ environment:+ MINIO_ROOT_USER: supa-storage+ MINIO_ROOT_PASSWORD: secret1234+ command: server --console-address ":9001" /data+ healthcheck:+ test: [ "CMD", "curl", "-f", "http://minio:9000/minio/health/live" ]+ interval: 2s+ timeout: 10s+ retries: 5+ volumes:+ - ./volumes/storage:/data:z++ minio-createbucket:+ image: minio/mc+ depends_on:+ minio:+ condition: service_healthy+ entrypoint: >+ /bin/sh -c "+ /usr/bin/mc alias set supa-minio http://minio:9000 supa-storage secret1234;+ /usr/bin/mc mb supa-minio/stub;+ exit 0;+ "++ storage:+ container_name: supabase-storage+ image: supabase/storage-api:v1.11.13+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ rest:+ condition: service_started+ imgproxy:+ condition: service_started+ minio:+ condition: service_healthy+ healthcheck:+ test:+ [+ "CMD",+ "wget",+ "--no-verbose",+ "--tries=1",+ "--spider",+ "http://localhost:5000/status"+ ]+ timeout: 5s+ interval: 5s+ retries: 3+ restart: unless-stopped+ environment:+ ANON_KEY: ${ANON_KEY}+ SERVICE_KEY: ${SERVICE_ROLE_KEY}+ POSTGREST_URL: http://rest:3000+ PGRST_JWT_SECRET: ${JWT_SECRET}+ DATABASE_URL: postgres://supabase_storage_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}+ FILE_SIZE_LIMIT: 52428800+ STORAGE_BACKEND: s3+ GLOBAL_S3_BUCKET: stub+ GLOBAL_S3_ENDPOINT: http://minio:9000+ GLOBAL_S3_PROTOCOL: http+ GLOBAL_S3_FORCE_PATH_STYLE: true+ AWS_ACCESS_KEY_ID: supa-storage+ AWS_SECRET_ACCESS_KEY: secret1234+ AWS_DEFAULT_REGION: stub+ FILE_STORAGE_BACKEND_PATH: /var/lib/storage+ TENANT_ID: stub+ # TODO: https://github.com/supabase/storage-api/issues/55+ REGION: stub+ ENABLE_IMAGE_TRANSFORMATION: "true"+ IMGPROXY_URL: http://imgproxy:5001+ volumes:+ - ./volumes/storage:/var/lib/storage:z++ imgproxy:+ container_name: supabase-imgproxy+ image: darthsim/imgproxy:v3.8.0+ healthcheck:+ test: [ "CMD", "imgproxy", "health" ]+ timeout: 5s+ interval: 5s+ retries: 3+ environment:+ IMGPROXY_BIND: ":5001"+ IMGPROXY_USE_ETAG: "true"+ IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION}diff --git a/backend/docker-compose.yml b/backend/docker-compose.ymlnew file mode 100644index 00000000..6bf9eae7--- /dev/null+++ b/backend/docker-compose.yml@@ -0,0 +1,528 @@+# Usage+# Start: docker compose up+# With helpers: docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up+# Stop: docker compose down+# Destroy: docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans+# Reset everything: ./reset.sh++name: supabase++services:++ studio:+ container_name: supabase-studio+ image: supabase/studio:20250224-d10db0f+ restart: unless-stopped+ healthcheck:+ test:+ [+ "CMD",+ "node",+ "-e",+ "fetch('http://studio:3000/api/platform/profile').then((r) => {if (r.status !== 200) throw new Error(r.status)})"+ ]+ timeout: 10s+ interval: 5s+ retries: 3+ depends_on:+ analytics:+ condition: service_healthy+ environment:+ STUDIO_PG_META_URL: http://meta:8080+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}++ DEFAULT_ORGANIZATION_NAME: ${STUDIO_DEFAULT_ORGANIZATION}+ DEFAULT_PROJECT_NAME: ${STUDIO_DEFAULT_PROJECT}+ OPENAI_API_KEY: ${OPENAI_API_KEY:-}++ SUPABASE_URL: http://kong:8000+ SUPABASE_PUBLIC_URL: ${SUPABASE_PUBLIC_URL}+ SUPABASE_ANON_KEY: ${ANON_KEY}+ SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}+ AUTH_JWT_SECRET: ${JWT_SECRET}++ LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}+ LOGFLARE_URL: http://analytics:4000+ NEXT_PUBLIC_ENABLE_LOGS: true+ # Comment to use Big Query backend for analytics+ NEXT_ANALYTICS_BACKEND_PROVIDER: postgres+ # Uncomment to use Big Query backend for analytics+ # NEXT_ANALYTICS_BACKEND_PROVIDER: bigquery++ kong:+ container_name: supabase-kong+ image: kong:2.8.1+ restart: unless-stopped+ ports:+ - ${KONG_HTTP_PORT}:8000/tcp+ - ${KONG_HTTPS_PORT}:8443/tcp+ volumes:+ # https://github.com/supabase/supabase/issues/12661+ - ./volumes/api/kong.yml:/home/kong/temp.yml:ro,z+ depends_on:+ analytics:+ condition: service_healthy+ environment:+ KONG_DATABASE: "off"+ KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml+ # https://github.com/supabase/cli/issues/14+ KONG_DNS_ORDER: LAST,A,CNAME+ KONG_PLUGINS: request-transformer,cors,key-auth,acl,basic-auth+ KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k+ KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k+ SUPABASE_ANON_KEY: ${ANON_KEY}+ SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}+ DASHBOARD_USERNAME: ${DASHBOARD_USERNAME}+ DASHBOARD_PASSWORD: ${DASHBOARD_PASSWORD}+ # https://unix.stackexchange.com/a/294837+ entrypoint: bash -c 'eval "echo \"$$(cat ~/temp.yml)\"" > ~/kong.yml && /docker-entrypoint.sh kong docker-start'++ auth:+ container_name: supabase-auth+ image: supabase/gotrue:v2.170.0+ restart: unless-stopped+ healthcheck:+ test:+ [+ "CMD",+ "wget",+ "--no-verbose",+ "--tries=1",+ "--spider",+ "http://localhost:9999/health"+ ]+ timeout: 5s+ interval: 5s+ retries: 3+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ analytics:+ condition: service_healthy+ environment:+ GOTRUE_API_HOST: 0.0.0.0+ GOTRUE_API_PORT: 9999+ API_EXTERNAL_URL: ${API_EXTERNAL_URL}++ GOTRUE_DB_DRIVER: postgres+ GOTRUE_DB_DATABASE_URL: postgres://supabase_auth_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}++ GOTRUE_SITE_URL: ${SITE_URL}+ GOTRUE_URI_ALLOW_LIST: ${ADDITIONAL_REDIRECT_URLS}+ GOTRUE_DISABLE_SIGNUP: ${DISABLE_SIGNUP}++ GOTRUE_JWT_ADMIN_ROLES: service_role+ GOTRUE_JWT_AUD: authenticated+ GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated+ GOTRUE_JWT_EXP: ${JWT_EXPIRY}+ GOTRUE_JWT_SECRET: ${JWT_SECRET}++ GOTRUE_EXTERNAL_EMAIL_ENABLED: ${ENABLE_EMAIL_SIGNUP}+ GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED: ${ENABLE_ANONYMOUS_USERS}+ GOTRUE_MAILER_AUTOCONFIRM: ${ENABLE_EMAIL_AUTOCONFIRM}++ # Uncomment to bypass nonce check in ID Token flow. Commonly set to true when using Google Sign In on mobile.+ # GOTRUE_EXTERNAL_SKIP_NONCE_CHECK: true++ # GOTRUE_MAILER_SECURE_EMAIL_CHANGE_ENABLED: true+ # GOTRUE_SMTP_MAX_FREQUENCY: 1s+ GOTRUE_SMTP_ADMIN_EMAIL: ${SMTP_ADMIN_EMAIL}+ GOTRUE_SMTP_HOST: ${SMTP_HOST}+ GOTRUE_SMTP_PORT: ${SMTP_PORT}+ GOTRUE_SMTP_USER: ${SMTP_USER}+ GOTRUE_SMTP_PASS: ${SMTP_PASS}+ GOTRUE_SMTP_SENDER_NAME: ${SMTP_SENDER_NAME}+ GOTRUE_MAILER_URLPATHS_INVITE: ${MAILER_URLPATHS_INVITE}+ GOTRUE_MAILER_URLPATHS_CONFIRMATION: ${MAILER_URLPATHS_CONFIRMATION}+ GOTRUE_MAILER_URLPATHS_RECOVERY: ${MAILER_URLPATHS_RECOVERY}+ GOTRUE_MAILER_URLPATHS_EMAIL_CHANGE: ${MAILER_URLPATHS_EMAIL_CHANGE}++ GOTRUE_EXTERNAL_PHONE_ENABLED: ${ENABLE_PHONE_SIGNUP}+ GOTRUE_SMS_AUTOCONFIRM: ${ENABLE_PHONE_AUTOCONFIRM}+ # Uncomment to enable custom access token hook. Please see: https://supabase.com/docs/guides/auth/auth-hooks for full list of hooks and additional details about custom_access_token_hook++ # GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_ENABLED: "true"+ # GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_URI: "pg-functions://postgres/public/custom_access_token_hook"+ # GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_SECRETS: "<standard-base64-secret>"++ # GOTRUE_HOOK_MFA_VERIFICATION_ATTEMPT_ENABLED: "true"+ # GOTRUE_HOOK_MFA_VERIFICATION_ATTEMPT_URI: "pg-functions://postgres/public/mfa_verification_attempt"++ # GOTRUE_HOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED: "true"+ # GOTRUE_HOOK_PASSWORD_VERIFICATION_ATTEMPT_URI: "pg-functions://postgres/public/password_verification_attempt"++ # GOTRUE_HOOK_SEND_SMS_ENABLED: "false"+ # GOTRUE_HOOK_SEND_SMS_URI: "pg-functions://postgres/public/custom_access_token_hook"+ # GOTRUE_HOOK_SEND_SMS_SECRETS: "v1,whsec_VGhpcyBpcyBhbiBleGFtcGxlIG9mIGEgc2hvcnRlciBCYXNlNjQgc3RyaW5n"++ # GOTRUE_HOOK_SEND_EMAIL_ENABLED: "false"+ # GOTRUE_HOOK_SEND_EMAIL_URI: "http://host.docker.internal:54321/functions/v1/email_sender"+ # GOTRUE_HOOK_SEND_EMAIL_SECRETS: "v1,whsec_VGhpcyBpcyBhbiBleGFtcGxlIG9mIGEgc2hvcnRlciBCYXNlNjQgc3RyaW5n"++ rest:+ container_name: supabase-rest+ image: postgrest/postgrest:v12.2.8+ restart: unless-stopped+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ analytics:+ condition: service_healthy+ environment:+ PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}+ PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS}+ PGRST_DB_ANON_ROLE: anon+ PGRST_JWT_SECRET: ${JWT_SECRET}+ PGRST_DB_USE_LEGACY_GUCS: "false"+ PGRST_APP_SETTINGS_JWT_SECRET: ${JWT_SECRET}+ PGRST_APP_SETTINGS_JWT_EXP: ${JWT_EXPIRY}+ command:+ [+ "postgrest"+ ]++ realtime:+ # This container name looks inconsistent but is correct because realtime constructs tenant id by parsing the subdomain+ container_name: realtime-dev.supabase-realtime+ image: supabase/realtime:v2.34.40+ restart: unless-stopped+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ analytics:+ condition: service_healthy+ healthcheck:+ test:+ [+ "CMD",+ "curl",+ "-sSfL",+ "--head",+ "-o",+ "/dev/null",+ "-H",+ "Authorization: Bearer ${ANON_KEY}",+ "http://localhost:4000/api/tenants/realtime-dev/health"+ ]+ timeout: 5s+ interval: 5s+ retries: 3+ environment:+ PORT: 4000+ DB_HOST: ${POSTGRES_HOST}+ DB_PORT: ${POSTGRES_PORT}+ DB_USER: supabase_admin+ DB_PASSWORD: ${POSTGRES_PASSWORD}+ DB_NAME: ${POSTGRES_DB}+ DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'+ DB_ENC_KEY: supabaserealtime+ API_JWT_SECRET: ${JWT_SECRET}+ SECRET_KEY_BASE: ${SECRET_KEY_BASE}+ ERL_AFLAGS: -proto_dist inet_tcp+ DNS_NODES: "''"+ RLIMIT_NOFILE: "10000"+ APP_NAME: realtime+ SEED_SELF_HOST: true+ RUN_JANITOR: true++ # To use S3 backed storage: docker compose -f docker-compose.yml -f docker-compose.s3.yml up+ storage:+ container_name: supabase-storage+ image: supabase/storage-api:v1.19.3+ restart: unless-stopped+ volumes:+ - ./volumes/storage:/var/lib/storage:z+ healthcheck:+ test:+ [+ "CMD",+ "wget",+ "--no-verbose",+ "--tries=1",+ "--spider",+ "http://storage:5000/status"+ ]+ timeout: 5s+ interval: 5s+ retries: 3+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ rest:+ condition: service_started+ imgproxy:+ condition: service_started+ environment:+ ANON_KEY: ${ANON_KEY}+ SERVICE_KEY: ${SERVICE_ROLE_KEY}+ POSTGREST_URL: http://rest:3000+ PGRST_JWT_SECRET: ${JWT_SECRET}+ DATABASE_URL: postgres://supabase_storage_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}+ FILE_SIZE_LIMIT: 52428800+ STORAGE_BACKEND: file+ FILE_STORAGE_BACKEND_PATH: /var/lib/storage+ TENANT_ID: stub+ # TODO: https://github.com/supabase/storage-api/issues/55+ REGION: stub+ GLOBAL_S3_BUCKET: stub+ ENABLE_IMAGE_TRANSFORMATION: "true"+ IMGPROXY_URL: http://imgproxy:5001++ imgproxy:+ container_name: supabase-imgproxy+ image: darthsim/imgproxy:v3.8.0+ restart: unless-stopped+ volumes:+ - ./volumes/storage:/var/lib/storage:z+ healthcheck:+ test:+ [+ "CMD",+ "imgproxy",+ "health"+ ]+ timeout: 5s+ interval: 5s+ retries: 3+ environment:+ IMGPROXY_BIND: ":5001"+ IMGPROXY_LOCAL_FILESYSTEM_ROOT: /+ IMGPROXY_USE_ETAG: "true"+ IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION}++ meta:+ container_name: supabase-meta+ image: supabase/postgres-meta:v0.86.1+ restart: unless-stopped+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ analytics:+ condition: service_healthy+ environment:+ PG_META_PORT: 8080+ PG_META_DB_HOST: ${POSTGRES_HOST}+ PG_META_DB_PORT: ${POSTGRES_PORT}+ PG_META_DB_NAME: ${POSTGRES_DB}+ PG_META_DB_USER: supabase_admin+ PG_META_DB_PASSWORD: ${POSTGRES_PASSWORD}++ functions:+ container_name: supabase-edge-functions+ image: supabase/edge-runtime:v1.67.2+ restart: unless-stopped+ volumes:+ - ./volumes/functions:/home/deno/functions:Z+ depends_on:+ analytics:+ condition: service_healthy+ environment:+ JWT_SECRET: ${JWT_SECRET}+ SUPABASE_URL: http://kong:8000+ SUPABASE_ANON_KEY: ${ANON_KEY}+ SUPABASE_SERVICE_ROLE_KEY: ${SERVICE_ROLE_KEY}+ SUPABASE_DB_URL: postgresql://postgres:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}+ # TODO: Allow configuring VERIFY_JWT per function. This PR might help: https://github.com/supabase/cli/pull/786+ VERIFY_JWT: "${FUNCTIONS_VERIFY_JWT}"+ command:+ [+ "start",+ "--main-service",+ "/home/deno/functions/main"+ ]++ analytics:+ container_name: supabase-analytics+ image: supabase/logflare:1.12.5+ restart: unless-stopped+ ports:+ - 4000:4000+ # Uncomment to use Big Query backend for analytics+ # volumes:+ # - type: bind+ # source: ${PWD}/gcloud.json+ # target: /opt/app/rel/logflare/bin/gcloud.json+ # read_only: true+ healthcheck:+ test:+ [+ "CMD",+ "curl",+ "http://localhost:4000/health"+ ]+ timeout: 5s+ interval: 5s+ retries: 10+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ environment:+ LOGFLARE_NODE_HOST: 127.0.0.1+ DB_USERNAME: supabase_admin+ DB_DATABASE: _supabase+ DB_HOSTNAME: ${POSTGRES_HOST}+ DB_PORT: ${POSTGRES_PORT}+ DB_PASSWORD: ${POSTGRES_PASSWORD}+ DB_SCHEMA: _analytics+ LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}+ LOGFLARE_SINGLE_TENANT: true+ LOGFLARE_SUPABASE_MODE: true+ LOGFLARE_MIN_CLUSTER_SIZE: 1++ # Comment variables to use Big Query backend for analytics+ POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/_supabase+ POSTGRES_BACKEND_SCHEMA: _analytics+ LOGFLARE_FEATURE_FLAG_OVERRIDE: multibackend=true+ # Uncomment to use Big Query backend for analytics+ # GOOGLE_PROJECT_ID: ${GOOGLE_PROJECT_ID}+ # GOOGLE_PROJECT_NUMBER: ${GOOGLE_PROJECT_NUMBER}++ # Comment out everything below this point if you are using an external Postgres database+ db:+ container_name: supabase-db+ image: supabase/postgres:15.8.1.049+ restart: unless-stopped+ volumes:+ - ./volumes/db/realtime.sql:/docker-entrypoint-initdb.d/migrations/99-realtime.sql:Z+ # Must be superuser to create event trigger+ - ./volumes/db/webhooks.sql:/docker-entrypoint-initdb.d/init-scripts/98-webhooks.sql:Z+ # Must be superuser to alter reserved role+ - ./volumes/db/roles.sql:/docker-entrypoint-initdb.d/init-scripts/99-roles.sql:Z+ # Initialize the database settings with JWT_SECRET and JWT_EXP+ - ./volumes/db/jwt.sql:/docker-entrypoint-initdb.d/init-scripts/99-jwt.sql:Z+ # PGDATA directory is persisted between restarts+ - ./volumes/db/data:/var/lib/postgresql/data:Z+ # Changes required for internal supabase data such as _analytics+ - ./volumes/db/_supabase.sql:/docker-entrypoint-initdb.d/migrations/97-_supabase.sql:Z+ # Changes required for Analytics support+ - ./volumes/db/logs.sql:/docker-entrypoint-initdb.d/migrations/99-logs.sql:Z+ # Changes required for Pooler support+ - ./volumes/db/pooler.sql:/docker-entrypoint-initdb.d/migrations/99-pooler.sql:Z+ # Use named volume to persist pgsodium decryption key between restarts+ - db-config:/etc/postgresql-custom+ healthcheck:+ test:+ [+ "CMD",+ "pg_isready",+ "-U",+ "postgres",+ "-h",+ "localhost"+ ]+ interval: 5s+ timeout: 5s+ retries: 10+ depends_on:+ vector:+ condition: service_healthy+ environment:+ POSTGRES_HOST: /var/run/postgresql+ PGPORT: ${POSTGRES_PORT}+ POSTGRES_PORT: ${POSTGRES_PORT}+ PGPASSWORD: ${POSTGRES_PASSWORD}+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}+ PGDATABASE: ${POSTGRES_DB}+ POSTGRES_DB: ${POSTGRES_DB}+ JWT_SECRET: ${JWT_SECRET}+ JWT_EXP: ${JWT_EXPIRY}+ command:+ [+ "postgres",+ "-c",+ "config_file=/etc/postgresql/postgresql.conf",+ "-c",+ "log_min_messages=fatal" # prevents Realtime polling queries from appearing in logs+ ]++ vector:+ container_name: supabase-vector+ image: timberio/vector:0.28.1-alpine+ restart: unless-stopped+ volumes:+ - ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro,z+ - ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro,z+ healthcheck:+ test:+ [+ "CMD",+ "wget",+ "--no-verbose",+ "--tries=1",+ "--spider",+ "http://vector:9001/health"+ ]+ timeout: 5s+ interval: 5s+ retries: 3+ environment:+ LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}+ command:+ [+ "--config",+ "/etc/vector/vector.yml"+ ]+ security_opt:+ - "label=disable"++ # Update the DATABASE_URL if you are using an external Postgres database+ supavisor:+ container_name: supabase-pooler+ image: supabase/supavisor:2.4.12+ restart: unless-stopped+ ports:+ - ${POSTGRES_PORT}:5432+ - ${POOLER_PROXY_PORT_TRANSACTION}:6543+ volumes:+ - ./volumes/pooler/pooler.exs:/etc/pooler/pooler.exs:ro,z+ healthcheck:+ test:+ [+ "CMD",+ "curl",+ "-sSfL",+ "--head",+ "-o",+ "/dev/null",+ "http://127.0.0.1:4000/api/health"+ ]+ interval: 10s+ timeout: 5s+ retries: 5+ depends_on:+ db:+ condition: service_healthy+ analytics:+ condition: service_healthy+ environment:+ PORT: 4000+ POSTGRES_PORT: ${POSTGRES_PORT}+ POSTGRES_DB: ${POSTGRES_DB}+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}+ DATABASE_URL: ecto://supabase_admin:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/_supabase+ CLUSTER_POSTGRES: true+ SECRET_KEY_BASE: ${SECRET_KEY_BASE}+ VAULT_ENC_KEY: ${VAULT_ENC_KEY}+ API_JWT_SECRET: ${JWT_SECRET}+ METRICS_JWT_SECRET: ${JWT_SECRET}+ REGION: local+ ERL_AFLAGS: -proto_dist inet_tcp+ POOLER_TENANT_ID: ${POOLER_TENANT_ID}+ POOLER_DEFAULT_POOL_SIZE: ${POOLER_DEFAULT_POOL_SIZE}+ POOLER_MAX_CLIENT_CONN: ${POOLER_MAX_CLIENT_CONN}+ POOLER_POOL_MODE: transaction+ command:+ [+ "/bin/sh",+ "-c",+ "/app/bin/migrate && /app/bin/supavisor eval \"$$(cat /etc/pooler/pooler.exs)\" && /app/bin/server"+ ]++volumes:+ db-config:diff --git a/backend/reset.sh b/backend/reset.shnew file mode 100755index 00000000..d5f3a41d--- /dev/null+++ b/backend/reset.sh@@ -0,0 +1,44 @@+#!/bin/bash++echo "WARNING: This will remove all containers and container data, and will reset the .env file. This action cannot be undone!"+read -p "Are you sure you want to proceed? (y/N) " -n 1 -r+echo # Move to a new line+if [[ ! $REPLY =~ ^[Yy]$ ]]+then+ echo "Operation cancelled."+ exit 1+fi++echo "Stopping and removing all containers..."+docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans++echo "Cleaning up bind-mounted directories..."+BIND_MOUNTS=(+ "./volumes/db/data"+)++for DIR in "${BIND_MOUNTS[@]}"; do+ if [ -d "$DIR" ]; then+ echo "Deleting $DIR..."+ rm -rf "$DIR"+ else+ echo "Directory $DIR does not exist. Skipping bind mount deletion step..."+ fi+done++echo "Resetting .env file..."+if [ -f ".env" ]; then+ echo "Removing existing .env file..."+ rm -f .env+else+ echo "No .env file found. Skipping .env removal step..."+fi++if [ -f ".env.example" ]; then+ echo "Copying .env.example to .env..."+ cp .env.example .env+else+ echo ".env.example file not found. Skipping .env reset step..."+fi++echo "Cleanup complete!"\ No newline at end of filediff --git a/backend/volumes/api/kong.yml b/backend/volumes/api/kong.ymlnew file mode 100644index 00000000..7abf4253--- /dev/null+++ b/backend/volumes/api/kong.yml@@ -0,0 +1,241 @@+_format_version: '2.1'+_transform: true++###+### Consumers / Users+###+consumers:+ - username: DASHBOARD+ - username: anon+ keyauth_credentials:+ - key: $SUPABASE_ANON_KEY+ - username: service_role+ keyauth_credentials:+ - key: $SUPABASE_SERVICE_KEY++###+### Access Control List+###+acls:+ - consumer: anon+ group: anon+ - consumer: service_role+ group: admin++###+### Dashboard credentials+###+basicauth_credentials:+ - consumer: DASHBOARD+ username: $DASHBOARD_USERNAME+ password: $DASHBOARD_PASSWORD++###+### API Routes+###+services:+ ## Open Auth routes+ - name: auth-v1-open+ url: http://auth:9999/verify+ routes:+ - name: auth-v1-open+ strip_path: true+ paths:+ - /auth/v1/verify+ plugins:+ - name: cors+ - name: auth-v1-open-callback+ url: http://auth:9999/callback+ routes:+ - name: auth-v1-open-callback+ strip_path: true+ paths:+ - /auth/v1/callback+ plugins:+ - name: cors+ - name: auth-v1-open-authorize+ url: http://auth:9999/authorize+ routes:+ - name: auth-v1-open-authorize+ strip_path: true+ paths:+ - /auth/v1/authorize+ plugins:+ - name: cors++ ## Secure Auth routes+ - name: auth-v1+ _comment: 'GoTrue: /auth/v1/* -> http://auth:9999/*'+ url: http://auth:9999/+ routes:+ - name: auth-v1-all+ strip_path: true+ paths:+ - /auth/v1/+ plugins:+ - name: cors+ - name: key-auth+ config:+ hide_credentials: false+ - name: acl+ config:+ hide_groups_header: true+ allow:+ - admin+ - anon++ ## Secure REST routes+ - name: rest-v1+ _comment: 'PostgREST: /rest/v1/* -> http://rest:3000/*'+ url: http://rest:3000/+ routes:+ - name: rest-v1-all+ strip_path: true+ paths:+ - /rest/v1/+ plugins:+ - name: cors+ - name: key-auth+ config:+ hide_credentials: true+ - name: acl+ config:+ hide_groups_header: true+ allow:+ - admin+ - anon++ ## Secure GraphQL routes+ - name: graphql-v1+ _comment: 'PostgREST: /graphql/v1/* -> http://rest:3000/rpc/graphql'+ url: http://rest:3000/rpc/graphql+ routes:+ - name: graphql-v1-all+ strip_path: true+ paths:+ - /graphql/v1+ plugins:+ - name: cors+ - name: key-auth+ config:+ hide_credentials: true+ - name: request-transformer+ config:+ add:+ headers:+ - Content-Profile:graphql_public+ - name: acl+ config:+ hide_groups_header: true+ allow:+ - admin+ - anon++ ## Secure Realtime routes+ - name: realtime-v1-ws+ _comment: 'Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*'+ url: http://realtime-dev.supabase-realtime:4000/socket+ protocol: ws+ routes:+ - name: realtime-v1-ws+ strip_path: true+ paths:+ - /realtime/v1/+ plugins:+ - name: cors+ - name: key-auth+ config:+ hide_credentials: false+ - name: acl+ config:+ hide_groups_header: true+ allow:+ - admin+ - anon+ - name: realtime-v1-rest+ _comment: 'Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*'+ url: http://realtime-dev.supabase-realtime:4000/api+ protocol: http+ routes:+ - name: realtime-v1-rest+ strip_path: true+ paths:+ - /realtime/v1/api+ plugins:+ - name: cors+ - name: key-auth+ config:+ hide_credentials: false+ - name: acl+ config:+ hide_groups_header: true+ allow:+ - admin+ - anon+ ## Storage routes: the storage server manages its own auth+ - name: storage-v1+ _comment: 'Storage: /storage/v1/* -> http://storage:5000/*'+ url: http://storage:5000/+ routes:+ - name: storage-v1-all+ strip_path: true+ paths:+ - /storage/v1/+ plugins:+ - name: cors++ ## Edge Functions routes+ - name: functions-v1+ _comment: 'Edge Functions: /functions/v1/* -> http://functions:9000/*'+ url: http://functions:9000/+ routes:+ - name: functions-v1-all+ strip_path: true+ paths:+ - /functions/v1/+ plugins:+ - name: cors++ ## Analytics routes+ - name: analytics-v1+ _comment: 'Analytics: /analytics/v1/* -> http://logflare:4000/*'+ url: http://analytics:4000/+ routes:+ - name: analytics-v1-all+ strip_path: true+ paths:+ - /analytics/v1/++ ## Secure Database routes+ - name: meta+ _comment: 'pg-meta: /pg/* -> http://pg-meta:8080/*'+ url: http://meta:8080/+ routes:+ - name: meta-all+ strip_path: true+ paths:+ - /pg/+ plugins:+ - name: key-auth+ config:+ hide_credentials: false+ - name: acl+ config:+ hide_groups_header: true+ allow:+ - admin++ ## Protected Dashboard - catch all remaining routes+ - name: dashboard+ _comment: 'Studio: /* -> http://studio:3000/*'+ url: http://studio:3000/+ routes:+ - name: dashboard-all+ strip_path: true+ paths:+ - /+ plugins:+ - name: cors+ - name: basic-auth+ config:+ hide_credentials: truediff --git a/backend/volumes/db/_supabase.sql b/backend/volumes/db/_supabase.sqlnew file mode 100644index 00000000..6236ae1b--- /dev/null+++ b/backend/volumes/db/_supabase.sql@@ -0,0 +1,3 @@+\set pguser `echo "$POSTGRES_USER"`++CREATE DATABASE _supabase WITH OWNER :pguser;diff --git a/backend/volumes/db/init/data.sql b/backend/volumes/db/init/data.sqlnew file mode 100755index 00000000..e69de29bdiff --git a/backend/volumes/db/jwt.sql b/backend/volumes/db/jwt.sqlnew file mode 100644index 00000000..cfd3b160--- /dev/null+++ b/backend/volumes/db/jwt.sql@@ -0,0 +1,5 @@+\set jwt_secret `echo "$JWT_SECRET"`+\set jwt_exp `echo "$JWT_EXP"`++ALTER DATABASE postgres SET "app.settings.jwt_secret" TO :'jwt_secret';+ALTER DATABASE postgres SET "app.settings.jwt_exp" TO :'jwt_exp';diff --git a/backend/volumes/db/logs.sql b/backend/volumes/db/logs.sqlnew file mode 100644index 00000000..255c0f40--- /dev/null+++ b/backend/volumes/db/logs.sql@@ -0,0 +1,6 @@+\set pguser `echo "$POSTGRES_USER"`++\c _supabase+create schema if not exists _analytics;+alter schema _analytics owner to :pguser;+\c postgresdiff --git a/backend/volumes/db/pooler.sql b/backend/volumes/db/pooler.sqlnew file mode 100644index 00000000..162c5b96--- /dev/null+++ b/backend/volumes/db/pooler.sql@@ -0,0 +1,6 @@+\set pguser `echo "$POSTGRES_USER"`++\c _supabase+create schema if not exists _supavisor;+alter schema _supavisor owner to :pguser;+\c postgresdiff --git a/backend/volumes/db/realtime.sql b/backend/volumes/db/realtime.sqlnew file mode 100644index 00000000..4d4b9ffb--- /dev/null+++ b/backend/volumes/db/realtime.sql@@ -0,0 +1,4 @@+\set pguser `echo "$POSTGRES_USER"`++create schema if not exists _realtime;+alter schema _realtime owner to :pguser;diff --git a/backend/volumes/db/roles.sql b/backend/volumes/db/roles.sqlnew file mode 100644index 00000000..8f7161a6--- /dev/null+++ b/backend/volumes/db/roles.sql@@ -0,0 +1,8 @@+-- NOTE: change to your own passwords for production environments+\set pgpass `echo "$POSTGRES_PASSWORD"`++ALTER USER authenticator WITH PASSWORD :'pgpass';+ALTER USER pgbouncer WITH PASSWORD :'pgpass';+ALTER USER supabase_auth_admin WITH PASSWORD :'pgpass';+ALTER USER supabase_functions_admin WITH PASSWORD :'pgpass';+ALTER USER supabase_storage_admin WITH PASSWORD :'pgpass';diff --git a/backend/volumes/db/webhooks.sql b/backend/volumes/db/webhooks.sqlnew file mode 100644index 00000000..5837b861--- /dev/null+++ b/backend/volumes/db/webhooks.sql@@ -0,0 +1,208 @@+BEGIN;+ -- Create pg_net extension+ CREATE EXTENSION IF NOT EXISTS pg_net SCHEMA extensions;+ -- Create supabase_functions schema+ CREATE SCHEMA supabase_functions AUTHORIZATION supabase_admin;+ GRANT USAGE ON SCHEMA supabase_functions TO postgres, anon, authenticated, service_role;+ ALTER DEFAULT PRIVILEGES IN SCHEMA supabase_functions GRANT ALL ON TABLES TO postgres, anon, authenticated, service_role;+ ALTER DEFAULT PRIVILEGES IN SCHEMA supabase_functions GRANT ALL ON FUNCTIONS TO postgres, anon, authenticated, service_role;+ ALTER DEFAULT PRIVILEGES IN SCHEMA supabase_functions GRANT ALL ON SEQUENCES TO postgres, anon, authenticated, service_role;+ -- supabase_functions.migrations definition+ CREATE TABLE supabase_functions.migrations (+ version text PRIMARY KEY,+ inserted_at timestamptz NOT NULL DEFAULT NOW()+ );+ -- Initial supabase_functions migration+ INSERT INTO supabase_functions.migrations (version) VALUES ('initial');+ -- supabase_functions.hooks definition+ CREATE TABLE supabase_functions.hooks (+ id bigserial PRIMARY KEY,+ hook_table_id integer NOT NULL,+ hook_name text NOT NULL,+ created_at timestamptz NOT NULL DEFAULT NOW(),+ request_id bigint+ );+ CREATE INDEX supabase_functions_hooks_request_id_idx ON supabase_functions.hooks USING btree (request_id);+ CREATE INDEX supabase_functions_hooks_h_table_id_h_name_idx ON supabase_functions.hooks USING btree (hook_table_id, hook_name);+ COMMENT ON TABLE supabase_functions.hooks IS 'Supabase Functions Hooks: Audit trail for triggered hooks.';+ CREATE FUNCTION supabase_functions.http_request()+ RETURNS trigger+ LANGUAGE plpgsql+ AS $function$+ DECLARE+ request_id bigint;+ payload jsonb;+ url text := TG_ARGV[0]::text;+ method text := TG_ARGV[1]::text;+ headers jsonb DEFAULT '{}'::jsonb;+ params jsonb DEFAULT '{}'::jsonb;+ timeout_ms integer DEFAULT 1000;+ BEGIN+ IF url IS NULL OR url = 'null' THEN+ RAISE EXCEPTION 'url argument is missing';+ END IF;++ IF method IS NULL OR method = 'null' THEN+ RAISE EXCEPTION 'method argument is missing';+ END IF;++ IF TG_ARGV[2] IS NULL OR TG_ARGV[2] = 'null' THEN+ headers = '{"Content-Type": "application/json"}'::jsonb;+ ELSE+ headers = TG_ARGV[2]::jsonb;+ END IF;++ IF TG_ARGV[3] IS NULL OR TG_ARGV[3] = 'null' THEN+ params = '{}'::jsonb;+ ELSE+ params = TG_ARGV[3]::jsonb;+ END IF;++ IF TG_ARGV[4] IS NULL OR TG_ARGV[4] = 'null' THEN+ timeout_ms = 1000;+ ELSE+ timeout_ms = TG_ARGV[4]::integer;+ END IF;++ CASE+ WHEN method = 'GET' THEN+ SELECT http_get INTO request_id FROM net.http_get(+ url,+ params,+ headers,+ timeout_ms+ );+ WHEN method = 'POST' THEN+ payload = jsonb_build_object(+ 'old_record', OLD,+ 'record', NEW,+ 'type', TG_OP,+ 'table', TG_TABLE_NAME,+ 'schema', TG_TABLE_SCHEMA+ );++ SELECT http_post INTO request_id FROM net.http_post(+ url,+ payload,+ params,+ headers,+ timeout_ms+ );+ ELSE+ RAISE EXCEPTION 'method argument % is invalid', method;+ END CASE;++ INSERT INTO supabase_functions.hooks+ (hook_table_id, hook_name, request_id)+ VALUES+ (TG_RELID, TG_NAME, request_id);++ RETURN NEW;+ END+ $function$;+ -- Supabase super admin+ DO+ $$+ BEGIN+ IF NOT EXISTS (+ SELECT 1+ FROM pg_roles+ WHERE rolname = 'supabase_functions_admin'+ )+ THEN+ CREATE USER supabase_functions_admin NOINHERIT CREATEROLE LOGIN NOREPLICATION;+ END IF;+ END+ $$;+ GRANT ALL PRIVILEGES ON SCHEMA supabase_functions TO supabase_functions_admin;+ GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA supabase_functions TO supabase_functions_admin;+ GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA supabase_functions TO supabase_functions_admin;+ ALTER USER supabase_functions_admin SET search_path = "supabase_functions";+ ALTER table "supabase_functions".migrations OWNER TO supabase_functions_admin;+ ALTER table "supabase_functions".hooks OWNER TO supabase_functions_admin;+ ALTER function "supabase_functions".http_request() OWNER TO supabase_functions_admin;+ GRANT supabase_functions_admin TO postgres;+ -- Remove unused supabase_pg_net_admin role+ DO+ $$+ BEGIN+ IF EXISTS (+ SELECT 1+ FROM pg_roles+ WHERE rolname = 'supabase_pg_net_admin'+ )+ THEN+ REASSIGN OWNED BY supabase_pg_net_admin TO supabase_admin;+ DROP OWNED BY supabase_pg_net_admin;+ DROP ROLE supabase_pg_net_admin;+ END IF;+ END+ $$;+ -- pg_net grants when extension is already enabled+ DO+ $$+ BEGIN+ IF EXISTS (+ SELECT 1+ FROM pg_extension+ WHERE extname = 'pg_net'+ )+ THEN+ GRANT USAGE ON SCHEMA net TO supabase_functions_admin, postgres, anon, authenticated, service_role;+ ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER;+ ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER;+ ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net;+ ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net;+ REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC;+ REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC;+ GRANT EXECUTE ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role;+ GRANT EXECUTE ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role;+ END IF;+ END+ $$;+ -- Event trigger for pg_net+ CREATE OR REPLACE FUNCTION extensions.grant_pg_net_access()+ RETURNS event_trigger+ LANGUAGE plpgsql+ AS $$+ BEGIN+ IF EXISTS (+ SELECT 1+ FROM pg_event_trigger_ddl_commands() AS ev+ JOIN pg_extension AS ext+ ON ev.objid = ext.oid+ WHERE ext.extname = 'pg_net'+ )+ THEN+ GRANT USAGE ON SCHEMA net TO supabase_functions_admin, postgres, anon, authenticated, service_role;+ ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER;+ ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SECURITY DEFINER;+ ALTER function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net;+ ALTER function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net;+ REVOKE ALL ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC;+ REVOKE ALL ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) FROM PUBLIC;+ GRANT EXECUTE ON FUNCTION net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role;+ GRANT EXECUTE ON FUNCTION net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO supabase_functions_admin, postgres, anon, authenticated, service_role;+ END IF;+ END;+ $$;+ COMMENT ON FUNCTION extensions.grant_pg_net_access IS 'Grants access to pg_net';+ DO+ $$+ BEGIN+ IF NOT EXISTS (+ SELECT 1+ FROM pg_event_trigger+ WHERE evtname = 'issue_pg_net_access'+ ) THEN+ CREATE EVENT TRIGGER issue_pg_net_access ON ddl_command_end WHEN TAG IN ('CREATE EXTENSION')+ EXECUTE PROCEDURE extensions.grant_pg_net_access();+ END IF;+ END+ $$;+ INSERT INTO supabase_functions.migrations (version) VALUES ('20210809183423_update_grants');+ ALTER function supabase_functions.http_request() SECURITY DEFINER;+ ALTER function supabase_functions.http_request() SET search_path = supabase_functions;+ REVOKE ALL ON FUNCTION supabase_functions.http_request() FROM PUBLIC;+ GRANT EXECUTE ON FUNCTION supabase_functions.http_request() TO postgres, anon, authenticated, service_role;+COMMIT;diff --git a/backend/volumes/functions/hello/index.ts b/backend/volumes/functions/hello/index.tsnew file mode 100644index 00000000..f1e20b90--- /dev/null+++ b/backend/volumes/functions/hello/index.ts@@ -0,0 +1,16 @@+// Follow this setup guide to integrate the Deno language server with your editor:+// https://deno.land/manual/getting_started/setup_your_environment+// This enables autocomplete, go to definition, etc.++import { serve } from "https://deno.land/[email protected]/http/server.ts"++serve(async () => {+ return new Response(+ `"Hello from Edge Functions!"`,+ { headers: { "Content-Type": "application/json" } },+ )+})++// To invoke:+// curl 'http://localhost:<KONG_HTTP_PORT>/functions/v1/hello' \+// --header 'Authorization: Bearer <anon/service_role API key>'diff --git a/backend/volumes/functions/main/index.ts b/backend/volumes/functions/main/index.tsnew file mode 100644index 00000000..a094010b--- /dev/null+++ b/backend/volumes/functions/main/index.ts@@ -0,0 +1,94 @@+import { serve } from 'https://deno.land/[email protected]/http/server.ts'+import * as jose from 'https://deno.land/x/[email protected]/index.ts'++console.log('main function started')++const JWT_SECRET = Deno.env.get('JWT_SECRET')+const VERIFY_JWT = Deno.env.get('VERIFY_JWT') === 'true'++function getAuthToken(req: Request) {+ const authHeader = req.headers.get('authorization')+ if (!authHeader) {+ throw new Error('Missing authorization header')+ }+ const [bearer, token] = authHeader.split(' ')+ if (bearer !== 'Bearer') {+ throw new Error(`Auth header is not 'Bearer {token}'`)+ }+ return token+}++async function verifyJWT(jwt: string): Promise<boolean> {+ const encoder = new TextEncoder()+ const secretKey = encoder.encode(JWT_SECRET)+ try {+ await jose.jwtVerify(jwt, secretKey)+ } catch (err) {+ console.error(err)+ return false+ }+ return true+}++serve(async (req: Request) => {+ if (req.method !== 'OPTIONS' && VERIFY_JWT) {+ try {+ const token = getAuthToken(req)+ const isValidJWT = await verifyJWT(token)++ if (!isValidJWT) {+ return new Response(JSON.stringify({ msg: 'Invalid JWT' }), {+ status: 401,+ headers: { 'Content-Type': 'application/json' },+ })+ }+ } catch (e) {+ console.error(e)+ return new Response(JSON.stringify({ msg: e.toString() }), {+ status: 401,+ headers: { 'Content-Type': 'application/json' },+ })+ }+ }++ const url = new URL(req.url)+ const { pathname } = url+ const path_parts = pathname.split('/')+ const service_name = path_parts[1]++ if (!service_name || service_name === '') {+ const error = { msg: 'missing function name in request' }+ return new Response(JSON.stringify(error), {+ status: 400,+ headers: { 'Content-Type': 'application/json' },+ })+ }++ const servicePath = `/home/deno/functions/${service_name}`+ console.error(`serving the request with ${servicePath}`)++ const memoryLimitMb = 150+ const workerTimeoutMs = 1 * 60 * 1000+ const noModuleCache = false+ const importMapPath = null+ const envVarsObj = Deno.env.toObject()+ const envVars = Object.keys(envVarsObj).map((k) => [k, envVarsObj[k]])++ try {+ const worker = await EdgeRuntime.userWorkers.create({+ servicePath,+ memoryLimitMb,+ workerTimeoutMs,+ noModuleCache,+ importMapPath,+ envVars,+ })+ return await worker.fetch(req)+ } catch (e) {+ const error = { msg: e.toString() }+ return new Response(JSON.stringify(error), {+ status: 500,+ headers: { 'Content-Type': 'application/json' },+ })+ }+})diff --git a/backend/volumes/logs/vector.yml b/backend/volumes/logs/vector.ymlnew file mode 100644index 00000000..cce46df4--- /dev/null+++ b/backend/volumes/logs/vector.yml@@ -0,0 +1,232 @@+api:+ enabled: true+ address: 0.0.0.0:9001++sources:+ docker_host:+ type: docker_logs+ exclude_containers:+ - supabase-vector++transforms:+ project_logs:+ type: remap+ inputs:+ - docker_host+ source: |-+ .project = "default"+ .event_message = del(.message)+ .appname = del(.container_name)+ del(.container_created_at)+ del(.container_id)+ del(.source_type)+ del(.stream)+ del(.label)+ del(.image)+ del(.host)+ del(.stream)+ router:+ type: route+ inputs:+ - project_logs+ route:+ kong: '.appname == "supabase-kong"'+ auth: '.appname == "supabase-auth"'+ rest: '.appname == "supabase-rest"'+ realtime: '.appname == "supabase-realtime"'+ storage: '.appname == "supabase-storage"'+ functions: '.appname == "supabase-functions"'+ db: '.appname == "supabase-db"'+ # Ignores non nginx errors since they are related with kong booting up+ kong_logs:+ type: remap+ inputs:+ - router.kong+ source: |-+ req, err = parse_nginx_log(.event_message, "combined")+ if err == null {+ .timestamp = req.timestamp+ .metadata.request.headers.referer = req.referer+ .metadata.request.headers.user_agent = req.agent+ .metadata.request.headers.cf_connecting_ip = req.client+ .metadata.request.method = req.method+ .metadata.request.path = req.path+ .metadata.request.protocol = req.protocol+ .metadata.response.status_code = req.status+ }+ if err != null {+ abort+ }+ # Ignores non nginx errors since they are related with kong booting up+ kong_err:+ type: remap+ inputs:+ - router.kong+ source: |-+ .metadata.request.method = "GET"+ .metadata.response.status_code = 200+ parsed, err = parse_nginx_log(.event_message, "error")+ if err == null {+ .timestamp = parsed.timestamp+ .severity = parsed.severity+ .metadata.request.host = parsed.host+ .metadata.request.headers.cf_connecting_ip = parsed.client+ url, err = split(parsed.request, " ")+ if err == null {+ .metadata.request.method = url[0]+ .metadata.request.path = url[1]+ .metadata.request.protocol = url[2]+ }+ }+ if err != null {+ abort+ }+ # Gotrue logs are structured json strings which frontend parses directly. But we keep metadata for consistency.+ auth_logs:+ type: remap+ inputs:+ - router.auth+ source: |-+ parsed, err = parse_json(.event_message)+ if err == null {+ .metadata.timestamp = parsed.time+ .metadata = merge!(.metadata, parsed)+ }+ # PostgREST logs are structured so we separate timestamp from message using regex+ rest_logs:+ type: remap+ inputs:+ - router.rest+ source: |-+ parsed, err = parse_regex(.event_message, r'^(?P<time>.*): (?P<msg>.*)$')+ if err == null {+ .event_message = parsed.msg+ .timestamp = to_timestamp!(parsed.time)+ .metadata.host = .project+ }+ # Realtime logs are structured so we parse the severity level using regex (ignore time because it has no date)+ realtime_logs:+ type: remap+ inputs:+ - router.realtime+ source: |-+ .metadata.project = del(.project)+ .metadata.external_id = .metadata.project+ parsed, err = parse_regex(.event_message, r'^(?P<time>\d+:\d+:\d+\.\d+) \[(?P<level>\w+)\] (?P<msg>.*)$')+ if err == null {+ .event_message = parsed.msg+ .metadata.level = parsed.level+ }+ # Storage logs may contain json objects so we parse them for completeness+ storage_logs:+ type: remap+ inputs:+ - router.storage+ source: |-+ .metadata.project = del(.project)+ .metadata.tenantId = .metadata.project+ parsed, err = parse_json(.event_message)+ if err == null {+ .event_message = parsed.msg+ .metadata.level = parsed.level+ .metadata.timestamp = parsed.time+ .metadata.context[0].host = parsed.hostname+ .metadata.context[0].pid = parsed.pid+ }+ # Postgres logs some messages to stderr which we map to warning severity level+ db_logs:+ type: remap+ inputs:+ - router.db+ source: |-+ .metadata.host = "db-default"+ .metadata.parsed.timestamp = .timestamp++ parsed, err = parse_regex(.event_message, r'.*(?P<level>INFO|NOTICE|WARNING|ERROR|LOG|FATAL|PANIC?):.*', numeric_groups: true)++ if err != null || parsed == null {+ .metadata.parsed.error_severity = "info"+ }+ if parsed != null {+ .metadata.parsed.error_severity = parsed.level+ }+ if .metadata.parsed.error_severity == "info" {+ .metadata.parsed.error_severity = "log"+ }+ .metadata.parsed.error_severity = upcase!(.metadata.parsed.error_severity)++sinks:+ logflare_auth:+ type: 'http'+ inputs:+ - auth_logs+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ uri: 'http://analytics:4000/api/logs?source_name=gotrue.logs.prod&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'+ logflare_realtime:+ type: 'http'+ inputs:+ - realtime_logs+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ uri: 'http://analytics:4000/api/logs?source_name=realtime.logs.prod&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'+ logflare_rest:+ type: 'http'+ inputs:+ - rest_logs+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ uri: 'http://analytics:4000/api/logs?source_name=postgREST.logs.prod&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'+ logflare_db:+ type: 'http'+ inputs:+ - db_logs+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ # We must route the sink through kong because ingesting logs before logflare is fully initialised will+ # lead to broken queries from studio. This works by the assumption that containers are started in the+ # following order: vector > db > logflare > kong+ uri: 'http://kong:8000/analytics/v1/api/logs?source_name=postgres.logs&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'+ logflare_functions:+ type: 'http'+ inputs:+ - router.functions+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ uri: 'http://analytics:4000/api/logs?source_name=deno-relay-logs&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'+ logflare_storage:+ type: 'http'+ inputs:+ - storage_logs+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ uri: 'http://analytics:4000/api/logs?source_name=storage.logs.prod.2&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'+ logflare_kong:+ type: 'http'+ inputs:+ - kong_logs+ - kong_err+ encoding:+ codec: 'json'+ method: 'post'+ request:+ retry_max_duration_secs: 10+ uri: 'http://analytics:4000/api/logs?source_name=cloudflare.logs.prod&api_key=${LOGFLARE_API_KEY?LOGFLARE_API_KEY is required}'diff --git a/backend/volumes/migrations/20250323205445_remote_schema.sql b/backend/volumes/migrations/20250323205445_remote_schema.sqlnew file mode 100644index 00000000..dfcc8fca--- /dev/null+++ b/backend/volumes/migrations/20250323205445_remote_schema.sql@@ -0,0 +1,1599 @@+++SET statement_timeout = 0;+SET lock_timeout = 0;+SET idle_in_transaction_session_timeout = 0;+SET client_encoding = 'UTF8';+SET standard_conforming_strings = on;+SELECT pg_catalog.set_config('search_path', '', false);+SET check_function_bodies = false;+SET xmloption = content;+SET client_min_messages = warning;+SET row_security = off;+++CREATE EXTENSION IF NOT EXISTS "pgsodium";+++++++COMMENT ON SCHEMA "public" IS 'standard public schema';++++CREATE EXTENSION IF NOT EXISTS "pg_graphql" WITH SCHEMA "graphql";+++++++CREATE EXTENSION IF NOT EXISTS "pg_stat_statements" WITH SCHEMA "extensions";+++++++CREATE EXTENSION IF NOT EXISTS "pgcrypto" WITH SCHEMA "extensions";+++++++CREATE EXTENSION IF NOT EXISTS "pgjwt" WITH SCHEMA "extensions";+++++++CREATE EXTENSION IF NOT EXISTS "pgmq" WITH SCHEMA "pgmq";+++++++CREATE EXTENSION IF NOT EXISTS "supabase_vault" WITH SCHEMA "vault";+++++++CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA "extensions";+++++++CREATE TYPE "public"."investigation_status" AS ENUM (+ 'active',+ 'pending',+ 'archived'+);+++ALTER TYPE "public"."investigation_status" OWNER TO "postgres";+++COMMENT ON TYPE "public"."investigation_status" IS 'Describes the possible statuses of an investigation.';++++CREATE OR REPLACE FUNCTION "public"."create_investigation_profile"() RETURNS "trigger"+ LANGUAGE "plpgsql"+ AS $$+BEGIN+ INSERT INTO investigations_profiles (profile_id, investigation_id)+ VALUES ((SELECT auth.uid()), NEW.id); -- Use auth.uid() for the profile_id+ RETURN NEW;+END;+$$;+++ALTER FUNCTION "public"."create_investigation_profile"() OWNER TO "postgres";+++CREATE OR REPLACE FUNCTION "public"."handle_new_investigation"() RETURNS "trigger"+ LANGUAGE "plpgsql"+ AS $$+begin+ -- Insère l'entrée dans investigations_profiles en associant l'investigation au créateur+ insert into investigations_profiles (investigation_id, profile_id)+ values (new.id, auth.uid());++ return new;+end;+$$;+++ALTER FUNCTION "public"."handle_new_investigation"() OWNER TO "postgres";+++CREATE OR REPLACE FUNCTION "public"."handle_new_project"() RETURNS "trigger"+ LANGUAGE "plpgsql"+ AS $$+begin+ -- Insère l'entrée dans projects_profiles en associant le projet au créateur+ insert into projects_profiles (project_id, profile_id)+ values (new.id, auth.uid());++ return new;+end;+$$;+++ALTER FUNCTION "public"."handle_new_project"() OWNER TO "postgres";+++CREATE OR REPLACE FUNCTION "public"."handle_new_project_folder"() RETURNS "trigger"+ LANGUAGE "plpgsql"+ AS $$+begin+ -- Crée un "dossier" en ajoutant un `/`+ insert into storage.objects (bucket_id, name, owner)+ values ('documents', new.id || '/', auth.uid());++ return new;+end;+$$;+++ALTER FUNCTION "public"."handle_new_project_folder"() OWNER TO "postgres";+++CREATE OR REPLACE FUNCTION "public"."handle_new_user"() RETURNS "trigger"+ LANGUAGE "plpgsql" SECURITY DEFINER+ SET "search_path" TO ''+ AS $$+begin+ insert into public.profiles (id, first_name, last_name)+ values (new.id, new.raw_user_meta_data ->> 'first_name', new.raw_user_meta_data ->> 'last_name');+ return new;+end;+$$;+++ALTER FUNCTION "public"."handle_new_user"() OWNER TO "postgres";+++CREATE OR REPLACE FUNCTION "public"."update_last_updated_at"() RETURNS "trigger"+ LANGUAGE "plpgsql"+ AS $$+BEGIN+ -- Si la mise à jour concerne 'investigations', mettre à jour 'projects' uniquement si 10s sont écoulées+ IF TG_TABLE_NAME = 'investigations' THEN+ IF OLD.last_updated_at IS NULL OR OLD.last_updated_at < NOW() - INTERVAL '10 seconds' THEN+ UPDATE projects+ SET last_updated_at = NOW()+ WHERE id = NEW.project_id;++ UPDATE investigations+ SET last_updated_at = NOW()+ WHERE id = NEW.id;+ END IF;++ -- Si la mise à jour concerne une table liée, mettre à jour 'investigations' et 'projects' seulement si 10s sont écoulées+ ELSIF TG_TABLE_NAME IN ('emails', 'individuals', 'relationships', 'physical_addresses', 'social_accounts', 'ip_addresses', 'phone_numbers') THEN+ IF (SELECT last_updated_at FROM investigations WHERE id = NEW.investigation_id) IS NULL OR+ (SELECT last_updated_at FROM investigations WHERE id = NEW.investigation_id) < NOW() - INTERVAL '10 seconds' THEN+ UPDATE investigations+ SET last_updated_at = NOW()+ WHERE id = NEW.investigation_id;++ UPDATE projects+ SET last_updated_at = NOW()+ WHERE id = (+ SELECT project_id FROM investigations WHERE id = NEW.investigation_id+ );+ END IF;+ END IF;++ RETURN NEW;+END;+$$;+++ALTER FUNCTION "public"."update_last_updated_at"() OWNER TO "postgres";+++CREATE OR REPLACE FUNCTION "public"."update_project_last_updated"() RETURNS "trigger"+ LANGUAGE "plpgsql"+ AS $$+BEGIN+ -- Si la mise à jour concerne 'investigations', mettre à jour 'projects' uniquement si 10s sont écoulées+ IF TG_TABLE_NAME = 'investigations' THEN+ IF OLD.last_updated_at IS NULL OR OLD.last_updated_at < NOW() - INTERVAL '10 seconds' THEN+ UPDATE projects+ SET last_updated_at = NOW()+ WHERE id = NEW.project_id;+ UPDATE investigations+ SET last_updated_at = NOW()+ WHERE id = NEW.id;+ END IF;++ -- Si la mise à jour concerne une table liée, mettre à jour 'investigations' et 'projects' seulement si 10s sont écoulées+ ELSIF TG_TABLE_NAME IN ('emails', 'individuals', 'relationships', 'physical_addresses', 'social_accounts', 'ip_addresses', 'phone_numbers') THEN+ IF (SELECT last_updated_at FROM investigations WHERE id = NEW.investigation_id) < NOW() - INTERVAL '10 seconds' THEN+ UPDATE investigations+ SET last_updated_at = NOW()+ WHERE id = NEW.investigation_id;++ UPDATE projects+ SET last_updated_at = NOW()+ WHERE id = (+ SELECT project_id FROM investigations WHERE id = NEW.investigation_id+ );+ END IF;+ END IF;++ RETURN NEW;+END;+$$;+++ALTER FUNCTION "public"."update_project_last_updated"() OWNER TO "postgres";++SET default_tablespace = '';++SET default_table_access_method = "heap";+++CREATE TABLE IF NOT EXISTS "public"."accounts_breaches" (+ "id" bigint NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "account" "text",+ "breach_id" bigint+);+++ALTER TABLE "public"."accounts_breaches" OWNER TO "postgres";+++ALTER TABLE "public"."accounts_breaches" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (+ SEQUENCE NAME "public"."accounts_breaches_id_seq"+ START WITH 1+ INCREMENT BY 1+ NO MINVALUE+ NO MAXVALUE+ CACHE 1+);++++CREATE TABLE IF NOT EXISTS "public"."breaches" (+ "id" bigint NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "name" "text" NOT NULL,+ "description" "text",+ "raw_content" "jsonb"+);+++ALTER TABLE "public"."breaches" OWNER TO "postgres";+++ALTER TABLE "public"."breaches" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (+ SEQUENCE NAME "public"."breaches_id_seq"+ START WITH 1+ INCREMENT BY 1+ NO MINVALUE+ NO MAXVALUE+ CACHE 1+);++++CREATE TABLE IF NOT EXISTS "public"."emails" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "individual_id" "uuid",+ "investigation_id" "uuid",+ "email" "text",+ "breach_found" boolean DEFAULT false+);+++ALTER TABLE "public"."emails" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."feedbacks" (+ "id" bigint NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "content" "text",+ "owner_id" "uuid" DEFAULT "auth"."uid"()+);+++ALTER TABLE "public"."feedbacks" OWNER TO "postgres";+++ALTER TABLE "public"."feedbacks" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (+ SEQUENCE NAME "public"."feedbacks_id_seq"+ START WITH 1+ INCREMENT BY 1+ NO MINVALUE+ NO MAXVALUE+ CACHE 1+);++++CREATE TABLE IF NOT EXISTS "public"."groups" (+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "label" "text",+ "investigation_id" "uuid"+);+++ALTER TABLE "public"."groups" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."individuals" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "investigation_id" "uuid",+ "full_name" "text",+ "birth_date" "date",+ "gender" "text",+ "nationality" "text",+ "notes" "jsonb",+ "image_url" "text",+ "group_id" "uuid"+);+++ALTER TABLE "public"."individuals" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."investigations" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "title" "text",+ "description" "text",+ "created_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP,+ "owner_id" "uuid" DEFAULT "auth"."uid"(),+ "status" "public"."investigation_status" DEFAULT 'active'::"public"."investigation_status",+ "project_id" "uuid" NOT NULL,+ "last_updated_at" timestamp with time zone DEFAULT ("now"() AT TIME ZONE 'utc'::"text")+);+++ALTER TABLE "public"."investigations" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."investigations_profiles" (+ "id" bigint NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "profile_id" "uuid",+ "investigation_id" "uuid"+);+++ALTER TABLE "public"."investigations_profiles" OWNER TO "postgres";+++ALTER TABLE "public"."investigations_profiles" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (+ SEQUENCE NAME "public"."investigations_profiles_id_seq"+ START WITH 1+ INCREMENT BY 1+ NO MINVALUE+ NO MAXVALUE+ CACHE 1+);++++CREATE TABLE IF NOT EXISTS "public"."ip_addresses" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "individual_id" "uuid",+ "investigation_id" "uuid",+ "ip_address" "text",+ "geolocation" "jsonb",+ "last_seen" timestamp without time zone DEFAULT "now"()+);+++ALTER TABLE "public"."ip_addresses" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."phone_numbers" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "individual_id" "uuid",+ "investigation_id" "uuid",+ "phone_number" "text",+ "country" "text"+);+++ALTER TABLE "public"."phone_numbers" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."physical_addresses" (+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "address" "text",+ "city" "text",+ "country" "text",+ "zip" "text",+ "investigation_id" "uuid",+ "individual_id" "uuid"+);+++ALTER TABLE "public"."physical_addresses" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."profiles" (+ "id" "uuid" NOT NULL,+ "first_name" "text",+ "last_name" "text",+ "avatar_url" "text"+);+++ALTER TABLE "public"."profiles" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."projects" (+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "name" "text",+ "description" "text",+ "owner_id" "uuid" DEFAULT "auth"."uid"(),+ "last_updated_at" timestamp with time zone DEFAULT ("now"() AT TIME ZONE 'utc'::"text")+);+++ALTER TABLE "public"."projects" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."projects_profiles" (+ "id" bigint NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "project_id" "uuid",+ "profile_id" "uuid"+);+++ALTER TABLE "public"."projects_profiles" OWNER TO "postgres";+++ALTER TABLE "public"."projects_profiles" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (+ SEQUENCE NAME "public"."projects_profiles_id_seq"+ START WITH 1+ INCREMENT BY 1+ NO MINVALUE+ NO MAXVALUE+ CACHE 1+);++++CREATE TABLE IF NOT EXISTS "public"."relationships" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "individual_a" "uuid",+ "individual_b" "uuid",+ "investigation_id" "uuid",+ "relation_type" "text",+ "confidence_level" integer,+ CONSTRAINT "relationships_confidence_level_check" CHECK ((("confidence_level" >= 1) AND ("confidence_level" <= 100)))+);+++ALTER TABLE "public"."relationships" OWNER TO "postgres";+++CREATE TABLE IF NOT EXISTS "public"."scans" (+ "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,+ "created_at" timestamp with time zone DEFAULT "now"() NOT NULL,+ "status" "text",+ "scan_name" "text",+ "results" "jsonb",+ "value" "text",+ "investigation_id" "uuid"+);+++ALTER TABLE "public"."scans" OWNER TO "postgres";+++COMMENT ON COLUMN "public"."scans"."value" IS 'The value that was searched for. Can be a username, an email, an IP address, etc.';++++CREATE TABLE IF NOT EXISTS "public"."social_accounts" (+ "id" "uuid" DEFAULT "extensions"."uuid_generate_v4"() NOT NULL,+ "individual_id" "uuid",+ "investigation_id" "uuid",+ "platform" "text",+ "username" "text",+ "profile_url" "text",+ "last_seen" timestamp without time zone+);+++ALTER TABLE "public"."social_accounts" OWNER TO "postgres";+++ALTER TABLE ONLY "public"."accounts_breaches"+ ADD CONSTRAINT "accounts_breaches_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."breaches"+ ADD CONSTRAINT "breaches_name_key" UNIQUE ("name");++++ALTER TABLE ONLY "public"."breaches"+ ADD CONSTRAINT "breaches_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."emails"+ ADD CONSTRAINT "emails_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."feedbacks"+ ADD CONSTRAINT "feedbacks_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."groups"+ ADD CONSTRAINT "groups_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."individuals"+ ADD CONSTRAINT "individuals_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."investigations"+ ADD CONSTRAINT "investigations_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."investigations_profiles"+ ADD CONSTRAINT "investigations_profiles_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."ip_addresses"+ ADD CONSTRAINT "ip_addresses_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."phone_numbers"+ ADD CONSTRAINT "phone_numbers_phone_number_key" UNIQUE ("phone_number");++++ALTER TABLE ONLY "public"."phone_numbers"+ ADD CONSTRAINT "phone_numbers_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."physical_addresses"+ ADD CONSTRAINT "physical_addresses_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."profiles"+ ADD CONSTRAINT "profiles_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."projects"+ ADD CONSTRAINT "projects_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."projects_profiles"+ ADD CONSTRAINT "projects_profiles_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."relationships"+ ADD CONSTRAINT "relationships_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."scans"+ ADD CONSTRAINT "scans_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."social_accounts"+ ADD CONSTRAINT "social_accounts_pkey" PRIMARY KEY ("id");++++ALTER TABLE ONLY "public"."relationships"+ ADD CONSTRAINT "unique_relationship" UNIQUE ("individual_a", "individual_b");++++ALTER TABLE ONLY "public"."accounts_breaches"+ ADD CONSTRAINT "unique_relationship_breaches" UNIQUE ("breach_id", "account");++++ALTER TABLE ONLY "public"."relationships"+ ADD CONSTRAINT "unique_relationship_individuals" UNIQUE ("individual_a", "individual_b");++++CREATE OR REPLACE TRIGGER "after_investigation_insert" AFTER INSERT ON "public"."investigations" FOR EACH ROW EXECUTE FUNCTION "public"."create_investigation_profile"();++++CREATE OR REPLACE TRIGGER "on_investigation_insert" AFTER INSERT ON "public"."investigations" FOR EACH ROW EXECUTE FUNCTION "public"."handle_new_investigation"();++++CREATE OR REPLACE TRIGGER "on_investigation_insert" AFTER INSERT ON "public"."projects" FOR EACH ROW EXECUTE FUNCTION "public"."handle_new_project"();++++CREATE OR REPLACE TRIGGER "on_investigation_insert_folder" AFTER INSERT ON "public"."projects" FOR EACH ROW EXECUTE FUNCTION "public"."handle_new_project_folder"();++++CREATE OR REPLACE TRIGGER "on_project_insert" AFTER INSERT ON "public"."projects" FOR EACH ROW EXECUTE FUNCTION "public"."handle_new_project"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated" AFTER UPDATE ON "public"."investigations" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_emails" AFTER INSERT OR DELETE OR UPDATE ON "public"."emails" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_individuals" AFTER INSERT OR DELETE OR UPDATE ON "public"."individuals" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_ip_addresses" AFTER INSERT OR DELETE OR UPDATE ON "public"."ip_addresses" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_phone_numbers" AFTER INSERT OR DELETE OR UPDATE ON "public"."phone_numbers" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_physical_addresses" AFTER INSERT OR DELETE OR UPDATE ON "public"."physical_addresses" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_relationships" AFTER INSERT OR DELETE OR UPDATE ON "public"."relationships" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "trigger_update_project_last_updated_social_accounts" AFTER INSERT OR DELETE OR UPDATE ON "public"."social_accounts" FOR EACH ROW EXECUTE FUNCTION "public"."update_project_last_updated"();++++CREATE OR REPLACE TRIGGER "update_last_updated_at_trigger" AFTER UPDATE ON "public"."investigations" FOR EACH ROW EXECUTE FUNCTION "public"."update_last_updated_at"();++++ALTER TABLE ONLY "public"."accounts_breaches"+ ADD CONSTRAINT "accounts_breaches_breach_id_fkey" FOREIGN KEY ("breach_id") REFERENCES "public"."breaches"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."emails"+ ADD CONSTRAINT "emails_individual_id_fkey" FOREIGN KEY ("individual_id") REFERENCES "public"."individuals"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."emails"+ ADD CONSTRAINT "emails_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."feedbacks"+ ADD CONSTRAINT "feedbacks_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "public"."profiles"("id");++++ALTER TABLE ONLY "public"."groups"+ ADD CONSTRAINT "groups_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id");++++ALTER TABLE ONLY "public"."individuals"+ ADD CONSTRAINT "individuals_group_id_fkey" FOREIGN KEY ("group_id") REFERENCES "public"."groups"("id") ON DELETE SET NULL;++++ALTER TABLE ONLY "public"."individuals"+ ADD CONSTRAINT "individuals_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."investigations"+ ADD CONSTRAINT "investigations_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "public"."profiles"("id");++++ALTER TABLE ONLY "public"."investigations_profiles"+ ADD CONSTRAINT "investigations_profiles_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."investigations_profiles"+ ADD CONSTRAINT "investigations_profiles_profile_id_fkey" FOREIGN KEY ("profile_id") REFERENCES "public"."profiles"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."investigations"+ ADD CONSTRAINT "investigations_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."ip_addresses"+ ADD CONSTRAINT "ip_addresses_individual_id_fkey" FOREIGN KEY ("individual_id") REFERENCES "public"."individuals"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."ip_addresses"+ ADD CONSTRAINT "ip_addresses_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."phone_numbers"+ ADD CONSTRAINT "phone_numbers_individual_id_fkey" FOREIGN KEY ("individual_id") REFERENCES "public"."individuals"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."phone_numbers"+ ADD CONSTRAINT "phone_numbers_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."physical_addresses"+ ADD CONSTRAINT "physical_addresses_individual_id_fkey" FOREIGN KEY ("individual_id") REFERENCES "public"."individuals"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."physical_addresses"+ ADD CONSTRAINT "physical_addresses_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."profiles"+ ADD CONSTRAINT "profiles_id_fkey" FOREIGN KEY ("id") REFERENCES "auth"."users"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."projects"+ ADD CONSTRAINT "projects_owner_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "public"."profiles"("id");++++ALTER TABLE ONLY "public"."projects_profiles"+ ADD CONSTRAINT "projects_profiles_profile_id_fkey" FOREIGN KEY ("profile_id") REFERENCES "public"."profiles"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."projects_profiles"+ ADD CONSTRAINT "projects_profiles_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."relationships"+ ADD CONSTRAINT "relationships_individual_a_fkey" FOREIGN KEY ("individual_a") REFERENCES "public"."individuals"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."relationships"+ ADD CONSTRAINT "relationships_individual_b_fkey" FOREIGN KEY ("individual_b") REFERENCES "public"."individuals"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."relationships"+ ADD CONSTRAINT "relationships_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."scans"+ ADD CONSTRAINT "scans_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."social_accounts"+ ADD CONSTRAINT "social_accounts_individual_id_fkey" FOREIGN KEY ("individual_id") REFERENCES "public"."individuals"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++ALTER TABLE ONLY "public"."social_accounts"+ ADD CONSTRAINT "social_accounts_investigation_id_fkey" FOREIGN KEY ("investigation_id") REFERENCES "public"."investigations"("id") ON UPDATE CASCADE ON DELETE CASCADE;++++CREATE POLICY "Allow insert on table investigations for authenticated users." ON "public"."investigations" FOR INSERT WITH CHECK (true);++++CREATE POLICY "Anybody can insert a new scan" ON "public"."scans" FOR INSERT WITH CHECK (true);++++CREATE POLICY "Auth users can insert a new project" ON "public"."projects_profiles" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can delete relationships for their investig" ON "public"."relationships" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "relationships"."investigation_id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid"))))));++++CREATE POLICY "Authenticated users can delete their emails related to their in" ON "public"."emails" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "emails"."investigation_id")))));++++CREATE POLICY "Authenticated users can delete their individuals related to the" ON "public"."individuals" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "individuals"."investigation_id")))));++++CREATE POLICY "Authenticated users can delete their investigations" ON "public"."investigations" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "investigations"."id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid"))))));++++CREATE POLICY "Authenticated users can delete their ip_addresses related to th" ON "public"."ip_addresses" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "ip_addresses"."investigation_id")))));++++CREATE POLICY "Authenticated users can delete their own account breaches" ON "public"."accounts_breaches" FOR DELETE TO "authenticated" USING (true);++++CREATE POLICY "Authenticated users can delete their own account breaches" ON "public"."breaches" FOR DELETE TO "authenticated" USING (true);++++CREATE POLICY "Authenticated users can delete their own investigations profile" ON "public"."investigations_profiles" FOR DELETE TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "profile_id"));++++CREATE POLICY "Authenticated users can delete their own profiles" ON "public"."profiles" FOR DELETE TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "id"));++++CREATE POLICY "Authenticated users can delete their phone_numbers related to t" ON "public"."phone_numbers" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "phone_numbers"."investigation_id")))));++++CREATE POLICY "Authenticated users can delete their physical_addresses related" ON "public"."physical_addresses" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "physical_addresses"."investigation_id")))));++++CREATE POLICY "Authenticated users can delete their social_accounts" ON "public"."social_accounts" FOR DELETE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "social_accounts"."investigation_id")))));++++CREATE POLICY "Authenticated users can insert account breaches" ON "public"."accounts_breaches" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert account breaches" ON "public"."breaches" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert emails related to their investig" ON "public"."emails" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert individuals related to their inv" ON "public"."individuals" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert investigations profiles" ON "public"."investigations_profiles" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert ip_addresses related to their in" ON "public"."ip_addresses" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert phone_numbers related to their i" ON "public"."phone_numbers" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert physical_addresses related to th" ON "public"."physical_addresses" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert profiles" ON "public"."profiles" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can insert relationships for their investig" ON "public"."relationships" FOR INSERT TO "authenticated" WITH CHECK ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "relationships"."investigation_id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid"))))));++++CREATE POLICY "Authenticated users can insert social_accounts related" ON "public"."social_accounts" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Authenticated users can update relationships for their investig" ON "public"."relationships" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "relationships"."investigation_id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their emails related to their in" ON "public"."emails" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "emails"."investigation_id"))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their individuals related to the" ON "public"."individuals" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "individuals"."investigation_id"))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their investigations" ON "public"."investigations" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "investigations"."id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their ip_addresses related to th" ON "public"."ip_addresses" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "ip_addresses"."investigation_id"))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their own account breaches" ON "public"."accounts_breaches" FOR UPDATE TO "authenticated" USING (true) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their own account breaches" ON "public"."breaches" FOR UPDATE TO "authenticated" USING (true) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their own investigations profile" ON "public"."investigations_profiles" FOR UPDATE TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "profile_id")) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their own profiles" ON "public"."profiles" FOR UPDATE TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "id")) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their phone_numbers related to t" ON "public"."phone_numbers" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "phone_numbers"."investigation_id"))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their physical_addresses related" ON "public"."physical_addresses" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "physical_addresses"."investigation_id"))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can update their social_accounts" ON "public"."social_accounts" FOR UPDATE TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "social_accounts"."investigation_id"))))) WITH CHECK (true);++++CREATE POLICY "Authenticated users can view relationships for their investigat" ON "public"."relationships" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "relationships"."investigation_id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid"))))));++++CREATE POLICY "Authenticated users can view their emails related to their inve" ON "public"."emails" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "emails"."investigation_id")))));++++CREATE POLICY "Authenticated users can view their individuals related to their" ON "public"."individuals" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "individuals"."investigation_id")))));++++CREATE POLICY "Authenticated users can view their investigations" ON "public"."investigations" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."investigation_id" = "investigations"."id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid"))))));++++CREATE POLICY "Authenticated users can view their ip_addresses related to thei" ON "public"."ip_addresses" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "ip_addresses"."investigation_id")))));++++CREATE POLICY "Authenticated users can view their own account breaches" ON "public"."accounts_breaches" FOR SELECT TO "authenticated" USING (true);++++CREATE POLICY "Authenticated users can view their own account breaches" ON "public"."breaches" FOR SELECT TO "authenticated" USING (true);++++CREATE POLICY "Authenticated users can view their own investigations profiles" ON "public"."investigations_profiles" FOR SELECT TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "profile_id"));++++CREATE POLICY "Authenticated users can view their own profiles" ON "public"."investigations" FOR SELECT TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "owner_id"));++++CREATE POLICY "Authenticated users can view their own profiles" ON "public"."profiles" FOR SELECT TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "id"));++++CREATE POLICY "Authenticated users can view their phone_numbers related to the" ON "public"."phone_numbers" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "phone_numbers"."investigation_id")))));++++CREATE POLICY "Authenticated users can view their physical_addresses related t" ON "public"."physical_addresses" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "physical_addresses"."investigation_id")))));++++CREATE POLICY "Authenticated users can view their social_accounts related to t" ON "public"."social_accounts" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "social_accounts"."investigation_id")))));++++CREATE POLICY "Enable read access for all users that have read access to the i" ON "public"."scans" FOR SELECT USING ((EXISTS ( SELECT 1+ FROM ("public"."investigations_profiles" "ip"+ JOIN "public"."investigations" "i" ON (("ip"."investigation_id" = "i"."id")))+ WHERE ("ip"."investigation_id" = "scans"."investigation_id"))));++++CREATE POLICY "Users can add a group to investigations they can see" ON "public"."groups" FOR INSERT TO "authenticated" WITH CHECK ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "groups"."investigation_id")))));++++CREATE POLICY "Users can create projects" ON "public"."projects" FOR INSERT TO "authenticated" WITH CHECK (true);++++CREATE POLICY "Users can view groups from investigations they have access to." ON "public"."groups" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "groups"."investigation_id")))));++++CREATE POLICY "Users can view their own projects" ON "public"."projects_profiles" FOR SELECT TO "authenticated" USING ((( SELECT "auth"."uid"() AS "uid") = "profile_id"));++++CREATE POLICY "Users need access to investigation to crud groups" ON "public"."groups" TO "authenticated" USING (true) WITH CHECK ((EXISTS ( SELECT 1+ FROM "public"."investigations_profiles" "ip"+ WHERE (("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid")) AND ("ip"."investigation_id" = "groups"."investigation_id")))));++++CREATE POLICY "Users with read access to project can view its investigations" ON "public"."projects" FOR SELECT TO "authenticated" USING ((EXISTS ( SELECT 1+ FROM "public"."projects_profiles" "ip"+ WHERE (("ip"."project_id" = "projects"."id") AND ("ip"."profile_id" = ( SELECT "auth"."uid"() AS "uid"))))));++++ALTER TABLE "public"."accounts_breaches" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."breaches" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."emails" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."groups" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."individuals" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."investigations" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."investigations_profiles" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."ip_addresses" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."phone_numbers" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."physical_addresses" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."profiles" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."projects_profiles" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."relationships" ENABLE ROW LEVEL SECURITY;+++ALTER TABLE "public"."social_accounts" ENABLE ROW LEVEL SECURITY;+++++ALTER PUBLICATION "supabase_realtime" OWNER TO "postgres";+++++++ALTER PUBLICATION "supabase_realtime" ADD TABLE ONLY "public"."scans";++++GRANT USAGE ON SCHEMA "public" TO "postgres";+GRANT USAGE ON SCHEMA "public" TO "anon";+GRANT USAGE ON SCHEMA "public" TO "authenticated";+GRANT USAGE ON SCHEMA "public" TO "service_role";+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++GRANT ALL ON FUNCTION "public"."create_investigation_profile"() TO "anon";+GRANT ALL ON FUNCTION "public"."create_investigation_profile"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."create_investigation_profile"() TO "service_role";++++GRANT ALL ON FUNCTION "public"."handle_new_investigation"() TO "anon";+GRANT ALL ON FUNCTION "public"."handle_new_investigation"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."handle_new_investigation"() TO "service_role";++++GRANT ALL ON FUNCTION "public"."handle_new_project"() TO "anon";+GRANT ALL ON FUNCTION "public"."handle_new_project"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."handle_new_project"() TO "service_role";++++GRANT ALL ON FUNCTION "public"."handle_new_project_folder"() TO "anon";+GRANT ALL ON FUNCTION "public"."handle_new_project_folder"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."handle_new_project_folder"() TO "service_role";++++GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "anon";+GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "service_role";++++GRANT ALL ON FUNCTION "public"."update_last_updated_at"() TO "anon";+GRANT ALL ON FUNCTION "public"."update_last_updated_at"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."update_last_updated_at"() TO "service_role";++++GRANT ALL ON FUNCTION "public"."update_project_last_updated"() TO "anon";+GRANT ALL ON FUNCTION "public"."update_project_last_updated"() TO "authenticated";+GRANT ALL ON FUNCTION "public"."update_project_last_updated"() TO "service_role";+++++++++++++++++++GRANT ALL ON TABLE "public"."accounts_breaches" TO "anon";+GRANT ALL ON TABLE "public"."accounts_breaches" TO "authenticated";+GRANT ALL ON TABLE "public"."accounts_breaches" TO "service_role";++++GRANT ALL ON SEQUENCE "public"."accounts_breaches_id_seq" TO "anon";+GRANT ALL ON SEQUENCE "public"."accounts_breaches_id_seq" TO "authenticated";+GRANT ALL ON SEQUENCE "public"."accounts_breaches_id_seq" TO "service_role";++++GRANT ALL ON TABLE "public"."breaches" TO "anon";+GRANT ALL ON TABLE "public"."breaches" TO "authenticated";+GRANT ALL ON TABLE "public"."breaches" TO "service_role";++++GRANT ALL ON SEQUENCE "public"."breaches_id_seq" TO "anon";+GRANT ALL ON SEQUENCE "public"."breaches_id_seq" TO "authenticated";+GRANT ALL ON SEQUENCE "public"."breaches_id_seq" TO "service_role";++++GRANT ALL ON TABLE "public"."emails" TO "anon";+GRANT ALL ON TABLE "public"."emails" TO "authenticated";+GRANT ALL ON TABLE "public"."emails" TO "service_role";++++GRANT ALL ON TABLE "public"."feedbacks" TO "anon";+GRANT ALL ON TABLE "public"."feedbacks" TO "authenticated";+GRANT ALL ON TABLE "public"."feedbacks" TO "service_role";++++GRANT ALL ON SEQUENCE "public"."feedbacks_id_seq" TO "anon";+GRANT ALL ON SEQUENCE "public"."feedbacks_id_seq" TO "authenticated";+GRANT ALL ON SEQUENCE "public"."feedbacks_id_seq" TO "service_role";++++GRANT ALL ON TABLE "public"."groups" TO "anon";+GRANT ALL ON TABLE "public"."groups" TO "authenticated";+GRANT ALL ON TABLE "public"."groups" TO "service_role";++++GRANT ALL ON TABLE "public"."individuals" TO "anon";+GRANT ALL ON TABLE "public"."individuals" TO "authenticated";+GRANT ALL ON TABLE "public"."individuals" TO "service_role";++++GRANT ALL ON TABLE "public"."investigations" TO "anon";+GRANT ALL ON TABLE "public"."investigations" TO "authenticated";+GRANT ALL ON TABLE "public"."investigations" TO "service_role";++++GRANT ALL ON TABLE "public"."investigations_profiles" TO "anon";+GRANT ALL ON TABLE "public"."investigations_profiles" TO "authenticated";+GRANT ALL ON TABLE "public"."investigations_profiles" TO "service_role";++++GRANT ALL ON SEQUENCE "public"."investigations_profiles_id_seq" TO "anon";+GRANT ALL ON SEQUENCE "public"."investigations_profiles_id_seq" TO "authenticated";+GRANT ALL ON SEQUENCE "public"."investigations_profiles_id_seq" TO "service_role";++++GRANT ALL ON TABLE "public"."ip_addresses" TO "anon";+GRANT ALL ON TABLE "public"."ip_addresses" TO "authenticated";+GRANT ALL ON TABLE "public"."ip_addresses" TO "service_role";++++GRANT ALL ON TABLE "public"."phone_numbers" TO "anon";+GRANT ALL ON TABLE "public"."phone_numbers" TO "authenticated";+GRANT ALL ON TABLE "public"."phone_numbers" TO "service_role";++++GRANT ALL ON TABLE "public"."physical_addresses" TO "anon";+GRANT ALL ON TABLE "public"."physical_addresses" TO "authenticated";+GRANT ALL ON TABLE "public"."physical_addresses" TO "service_role";++++GRANT ALL ON TABLE "public"."profiles" TO "anon";+GRANT ALL ON TABLE "public"."profiles" TO "authenticated";+GRANT ALL ON TABLE "public"."profiles" TO "service_role";++++GRANT ALL ON TABLE "public"."projects" TO "anon";+GRANT ALL ON TABLE "public"."projects" TO "authenticated";+GRANT ALL ON TABLE "public"."projects" TO "service_role";++++GRANT ALL ON TABLE "public"."projects_profiles" TO "anon";+GRANT ALL ON TABLE "public"."projects_profiles" TO "authenticated";+GRANT ALL ON TABLE "public"."projects_profiles" TO "service_role";++++GRANT ALL ON SEQUENCE "public"."projects_profiles_id_seq" TO "anon";+GRANT ALL ON SEQUENCE "public"."projects_profiles_id_seq" TO "authenticated";+GRANT ALL ON SEQUENCE "public"."projects_profiles_id_seq" TO "service_role";++++GRANT ALL ON TABLE "public"."relationships" TO "anon";+GRANT ALL ON TABLE "public"."relationships" TO "authenticated";+GRANT ALL ON TABLE "public"."relationships" TO "service_role";++++GRANT ALL ON TABLE "public"."scans" TO "anon";+GRANT ALL ON TABLE "public"."scans" TO "authenticated";+GRANT ALL ON TABLE "public"."scans" TO "service_role";++++GRANT ALL ON TABLE "public"."social_accounts" TO "anon";+GRANT ALL ON TABLE "public"."social_accounts" TO "authenticated";+GRANT ALL ON TABLE "public"."social_accounts" TO "service_role";++++ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role";+++++++ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role";+++++++ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated";+ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role";+++++++++++++++++++++++++++++++RESET ALL;diff --git a/backend/volumes/pooler/pooler.exs b/backend/volumes/pooler/pooler.exsnew file mode 100644index 00000000..791d61c8--- /dev/null+++ b/backend/volumes/pooler/pooler.exs@@ -0,0 +1,30 @@+{:ok, _} = Application.ensure_all_started(:supavisor)++{:ok, version} =+ case Supavisor.Repo.query!("select version()") do+ %{rows: [[ver]]} -> Supavisor.Helpers.parse_pg_version(ver)+ _ -> nil+ end++params = %{+ "external_id" => System.get_env("POOLER_TENANT_ID"),+ "db_host" => "db",+ "db_port" => System.get_env("POSTGRES_PORT"),+ "db_database" => System.get_env("POSTGRES_DB"),+ "require_user" => false,+ "auth_query" => "SELECT * FROM pgbouncer.get_auth($1)",+ "default_max_clients" => System.get_env("POOLER_MAX_CLIENT_CONN"),+ "default_pool_size" => System.get_env("POOLER_DEFAULT_POOL_SIZE"),+ "default_parameter_status" => %{"server_version" => version},+ "users" => [%{+ "db_user" => "pgbouncer",+ "db_password" => System.get_env("POSTGRES_PASSWORD"),+ "mode_type" => System.get_env("POOLER_POOL_MODE"),+ "pool_size" => System.get_env("POOLER_DEFAULT_POOL_SIZE"),+ "is_manager" => true+ }]+}++if !Supavisor.Tenants.get_tenant_by_external_id(params["external_id"]) do+ {:ok, _} = Supavisor.Tenants.create_tenant(params)+enddiff --git a/flowsint-web/src/app/api/projects/[project_id]/individuals/[individual_id]/route.ts b/flowsint-web/src/app/api/projects/[project_id]/individuals/[individual_id]/route.tsnew file mode 100644index 00000000..41f57166--- /dev/null+++ b/flowsint-web/src/app/api/projects/[project_id]/individuals/[individual_id]/route.ts@@ -0,0 +1,37 @@+import { createClient } from "@/lib/supabase/server"+import { NextResponse } from "next/server"++export async function GET(_: Request, { params }: { params: Promise<{ individual_id: string, project_id: string }> }) {+ const { project_id, individual_id } = await params+ try {+ const supabase = await createClient()+ const {+ data: { user },+ error: userError,+ } = await supabase.auth.getUser();+ if (!user || userError) {+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 })+ }+ const { data: individual, error } = await supabase+ .from('individuals')+ .select(`+ *,+ ip_addresses(*),+ phone_numbers(*),+ social_accounts(*),+ emails(*)+ `)+ .eq("id", individual_id)+ .single()+ if (error) {+ return NextResponse.json({ error: error.message }, { status: 500 })+ }+ if (!individual) {+ return NextResponse.json({ error: "Individual not found" }, { status: 404 })+ }+ return NextResponse.json({ individual })+ } catch (error) {+ return NextResponse.json({ error: "Internal Server Error" }, { status: 500 })+ }+}+diff --git a/flowsint-web/src/app/dashboard/keys/page.tsx b/flowsint-web/src/app/dashboard/keys/page.tsxindex 06fc6198..bfd63293 100644--- a/flowsint-web/src/app/dashboard/keys/page.tsx+++ b/flowsint-web/src/app/dashboard/keys/page.tsx@@ -4,6 +4,8 @@ import { useState } from "react"import { Button } from "@/components/ui/button"import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"import { Trash2 } from "lucide-react"+import DashboardLayout from "@/components/dashboard/layout"+import { Separator } from "@/components/ui/separator"export default function TokensPage() {const [tokens, setTokens] = useState([@@ -16,135 +18,135 @@ export default function TokensPage() {])return (- <div className="space-y-12 container mx-auto py-12 px-8">- <div>- <div className="flex justify-between items-start mb-4">- <div>- <h1 className="text-3xl font-bold">Vos clés API</h1>- <p className="text-muted-foreground mt-1">- Gérez vos clés API personnelles pour votre espace de travail actuel- </p>+ <DashboardLayout items={[{ name: "Dashboard", href: "/dashboard" }, { name: "Keys and tokens" }]}>+ <div className="space-y-12 container mx-auto py-12 px-8">+ <div>+ <div className="flex justify-between items-start mb-4">+ <div>+ <h1 className="text-2xl font-bold">Vos clés API</h1>+ <p className="text-muted-foreground mt-1">+ Gérez vos clés API personnelles pour votre espace de travail actuel+ </p>+ </div>+ <Button className="bg-primary text-white">Créer une nouvelle clé</Button></div>- <Button className="bg-primary text-white">Créer une nouvelle clé</Button>- </div>-- <div className="border-t my-8"></div>+ <Separator className="my-6" />+ <p className="text-muted-foreground mb-8">+ Vous pouvez créer jusqu'à 10 clés API et les supprimer lorsque vous n'en avez plus besoin.+ </p>- <p className="text-muted-foreground mb-8">- Vous pouvez créer jusqu'à 10 clés API et les supprimer lorsque vous n'en avez plus besoin.- </p>-- <Tabs defaultValue="active">- <TabsList className="bg-transparent border-b w-full justify-start rounded-none p-0 h-auto">- <TabsTrigger- value="active"- className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"- >- Actives- </TabsTrigger>- <TabsTrigger- value="expired"- className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"- >- Expirées- </TabsTrigger>- </TabsList>- <TabsContent value="active" className="mt-6">- <div className="border rounded-md">- <table className="w-full">- <thead>- <tr className="border-b">- <th className="text-left py-3 px-4 font-medium opacity-60">Nom</th>- <th className="text-left py-3 px-4 font-medium opacity-60">Clé</th>- <th className="text-left py-3 px-4 font-medium opacity-60">Expiration</th>- <th className="py-3 px-4"></th>- </tr>- </thead>- <tbody>- {tokens.map((token) => (- <tr key={token.id} className="border-b last:border-0">- <td className="py-4 px-4">{token.name}</td>- <td className="py-4 px-4 font-mono">{token.key}</td>- <td className="py-4 px-4">{token.expiration}</td>- <td className="py-4 px-4 text-right">- <Button variant="ghost" size="icon">- <Trash2 className="h-5 w-5 text-gray-500" />- </Button>- </td>+ <Tabs defaultValue="active">+ <TabsList className="bg-transparent border-b w-full justify-start rounded-none p-0 h-auto">+ <TabsTrigger+ value="active"+ className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"+ >+ Actives+ </TabsTrigger>+ <TabsTrigger+ value="expired"+ className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"+ >+ Expirées+ </TabsTrigger>+ </TabsList>+ <TabsContent value="active" className="mt-6">+ <div className="border rounded-md">+ <table className="w-full">+ <thead>+ <tr className="border-b">+ <th className="text-left py-3 px-4 font-medium opacity-60">Nom</th>+ <th className="text-left py-3 px-4 font-medium opacity-60">Clé</th>+ <th className="text-left py-3 px-4 font-medium opacity-60">Expiration</th>+ <th className="py-3 px-4"></th></tr>- ))}- </tbody>- </table>- </div>- </TabsContent>- <TabsContent value="expired" className="mt-6">- <div className="border rounded-md p-8 text-center text-muted-foreground">- Aucune clé API expirée+ </thead>+ <tbody>+ {tokens.map((token) => (+ <tr key={token.id} className="border-b last:border-0">+ <td className="py-4 px-4">{token.name}</td>+ <td className="py-4 px-4 font-mono">{token.key}</td>+ <td className="py-4 px-4">{token.expiration}</td>+ <td className="py-4 px-4 text-right">+ <Button variant="ghost" size="icon">+ <Trash2 className="h-5 w-5 text-gray-500" />+ </Button>+ </td>+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ </TabsContent>+ <TabsContent value="expired" className="mt-6">+ <div className="border rounded-md p-8 text-center text-muted-foreground">+ Aucune clé API expirée+ </div>+ </TabsContent>+ </Tabs>+ </div>+ <div>+ <div className="flex justify-between items-start mb-4">+ <div>+ <h1 className="text-xl font-bold">Vos clés de services tiers</h1>+ <p className="text-muted-foreground mt-1">+ Gérez vos clés de services tiers pour votre espace de travail actuel+ </p></div>- </TabsContent>- </Tabs>- </div>- <div>- <div className="flex justify-between items-start mb-4">- <div>- <h1 className="text-2xl font-bold">Vos clés de services tiers</h1>- <p className="text-muted-foreground mt-1">- Gérez vos clés de services tiers pour votre espace de travail actuel- </p>+ {/* <Button className="bg-primary text-white">Créer une nouvelle clé</Button> */}</div>- {/* <Button className="bg-primary text-white">Créer une nouvelle clé</Button> */}- </div>- <Tabs defaultValue="active">- <TabsList className="bg-transparent border-b w-full justify-start rounded-none p-0 h-auto">- <TabsTrigger- value="active"- className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"- >- Actives- </TabsTrigger>- <TabsTrigger- value="expired"- className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"- >- Expirées- </TabsTrigger>- </TabsList>- <TabsContent value="active" className="mt-6">- <div className="border rounded-md">- <table className="w-full">- <thead>- <tr className="border-b">- <th className="text-left py-3 px-4 font-medium opacity-60">Nom</th>- <th className="text-left py-3 px-4 font-medium opacity-60">Clé</th>- <th className="text-left py-3 px-4 font-medium opacity-60">Expiration</th>- <th className="py-3 px-4"></th>- </tr>- </thead>- <tbody>- {tokens.map((token) => (- <tr key={token.id} className="border-b last:border-0">- <td className="py-4 px-4">{token.name}</td>- <td className="py-4 px-4 font-mono">{token.key}</td>- <td className="py-4 px-4">{token.expiration}</td>- <td className="py-4 px-4 text-right">- <Button variant="ghost" size="icon">- <Trash2 className="h-5 w-5 text-gray-500" />- </Button>- </td>+ <Tabs defaultValue="active">+ <TabsList className="bg-transparent border-b w-full justify-start rounded-none p-0 h-auto">+ <TabsTrigger+ value="active"+ className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"+ >+ Actives+ </TabsTrigger>+ <TabsTrigger+ value="expired"+ className="rounded-none border-b-2 border-transparent data-[state=active]:shadow-none data-[state=active]:border-primary data-[state=active]:text-primary px-4 py-2 font-medium"+ >+ Expirées+ </TabsTrigger>+ </TabsList>+ <TabsContent value="active" className="mt-6">+ <div className="border rounded-md">+ <table className="w-full">+ <thead>+ <tr className="border-b">+ <th className="text-left py-3 px-4 font-medium opacity-60">Nom</th>+ <th className="text-left py-3 px-4 font-medium opacity-60">Clé</th>+ <th className="text-left py-3 px-4 font-medium opacity-60">Expiration</th>+ <th className="py-3 px-4"></th></tr>- ))}- </tbody>- </table>- </div>- </TabsContent>- <TabsContent value="expired" className="mt-6">- <div className="border rounded-md p-8 text-center text-muted-foreground">- Aucune clé API expirée- </div>- </TabsContent>- </Tabs>+ </thead>+ <tbody>+ {tokens.map((token) => (+ <tr key={token.id} className="border-b last:border-0">+ <td className="py-4 px-4">{token.name}</td>+ <td className="py-4 px-4 font-mono">{token.key}</td>+ <td className="py-4 px-4">{token.expiration}</td>+ <td className="py-4 px-4 text-right">+ <Button variant="ghost" size="icon">+ <Trash2 className="h-5 w-5 text-gray-500" />+ </Button>+ </td>+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ </TabsContent>+ <TabsContent value="expired" className="mt-6">+ <div className="border rounded-md p-8 text-center text-muted-foreground">+ Aucune clé API expirée+ </div>+ </TabsContent>+ </Tabs>+ </div></div>- </div>+ </DashboardLayout>)}diff --git a/flowsint-web/src/app/dashboard/page.tsx b/flowsint-web/src/app/dashboard/page.tsxindex dc3dcae3..57c20096 100644--- a/flowsint-web/src/app/dashboard/page.tsx+++ b/flowsint-web/src/app/dashboard/page.tsx@@ -104,7 +104,14 @@ const DashboardPage = () => {{filteredProjects.length === 0 ? (<TableRow><TableCell colSpan={7} className="text-center py-8 text-muted-foreground">- No projects found+ {searchQuery !== "" ? "No projects found" :+ <div className="flex items-center flex-col gap-3">No projects yet+ <NewProject noDropDown>+ <Button size="sm" className="gap-2">+ <PlusIcon className="h-4 w-4" /> Create a new project+ </Button>+ </NewProject>+ </div>}</TableCell></TableRow>) : (diff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/client.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/client.tsxnew file mode 100644index 00000000..6681ad5b--- /dev/null+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/client.tsx@@ -0,0 +1,37 @@+"use client"+import { useQuery } from "@tanstack/react-query"+import InvestigationGraph from "@/components/investigations/sketch/graph"+import LargeInvestigationGraph from '@/components/investigations/sketch/large-data-graph'+import IndividualModal from "@/components/investigations/individual-modal"+import { notFound } from "next/navigation"+import { useQueryState } from "nuqs"+interface ProfileProps {+ projectId: string+ individualId: string+}+export default function DashboardClient({ projectId, individualId }: ProfileProps) {+ // Use the initial data from the server, but enable background updates+ const [view, _] = useQueryState("view", { defaultValue: "flow-graph" })+ const graphQuery = useQuery({+ queryKey: ["project", individualId, "individuals", individualId],+ queryFn: async () => {+ const res = await fetch(`/api/projects/${projectId}/individuals/${individualId}`)+ if (!res.ok) {+ notFound()+ }+ return res.json()+ },+ refetchOnWindowFocus: true,+ })+ return (+ <div>+ {view === "flow-graph" ?+ <InvestigationGraph graphQuery={graphQuery} />+ :+ <LargeInvestigationGraph graphQuery={graphQuery} />+ }+ <IndividualModal />+ </div>+ )+}+diff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/page.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/page.tsxindex 11e7688e..372f8374 100644--- a/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/page.tsx+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/individuals/[individual_id]/page.tsx@@ -13,6 +13,8 @@ import {Twitter,Youtube,Building2,+ Waypoints,+ UserIcon,} from "lucide-react"import { Card, CardContent, CardHeader } from "@/components/ui/card"@@ -178,7 +180,9 @@ export default async function IndividualPage({ params }: { params: Promise<{ indconst individual = await getIndividual(individual_id)return (- <DashboardLayout items={[{ name: "Projects", href: "/dashboard" }, { name: individual?.investigation?.project?.name, href: `/dashboard/projects/${individual?.investigation?.project?.id}` }, { name: individual?.investigation?.title, href: `/dashboard/projects/${individual?.investigation?.project?.id}/investigations//${individual?.investigation?.id}` }, { name: individual?.full_name }]}>+ <DashboardLayout items={[{ name: "Projects", href: "/dashboard" }, {+ name: individual?.investigation?.project?.name, href: `/dashboard/projects/${individual?.investigation?.project?.id}`,+ }, { name: individual?.investigation?.title, href: `/dashboard/projects/${individual?.investigation?.project?.id}/investigations//${individual?.investigation?.id}`, icon: <Waypoints className="h-4 w-4 text-primary" /> }, { name: individual?.full_name, icon: <UserIcon className="h-4 w-4 text-primary" /> }]}><div className="min-h-screen p-6"><div className="max-w-7xl mx-auto my-12 space-y-6">{/* Header with profile info */}diff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/page.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/page.tsxindex 41dccc53..a65a9f84 100644--- a/flowsint-web/src/app/dashboard/projects/[project_id]/page.tsx+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/page.tsx@@ -122,7 +122,7 @@ const DashboardPage = () => {</TableRow></TableHeader><TableBody>- {project.investigations.length === 0 ? (+ {project.investigations.length === 0 && searchQuery !== "" ? (<TableRow><TableCell colSpan={6} className="text-center w-full py-2 text-muted-foreground">No sketch yet.diff --git a/flowsint-web/src/app/dashboard/settings/account/account-form.tsx b/flowsint-web/src/app/dashboard/settings/account/account-form.tsxnew file mode 100644index 00000000..a8926f25--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/account/account-form.tsx@@ -0,0 +1,219 @@+"use client"++import { zodResolver } from "@hookform/resolvers/zod"+import { format } from "date-fns"+import { CalendarIcon, Check, ChevronsUpDown } from "lucide-react"+import { useForm } from "react-hook-form"+import { z } from "zod"++import { cn } from "@/lib/utils"+import { toast } from "sonner"+import { Button } from "@/components/ui/button"+import { Calendar } from "@/components/ui/calendar"+import {+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandList,+} from "@/components/ui/command"+import {+ Form,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from "@/components/ui/form"+import { Input } from "@/components/ui/input"+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover"++const languages = [+ { label: "English", value: "en" },+ { label: "French", value: "fr" },+ { label: "German", value: "de" },+ { label: "Spanish", value: "es" },+ { label: "Portuguese", value: "pt" },+ { label: "Russian", value: "ru" },+ { label: "Japanese", value: "ja" },+ { label: "Korean", value: "ko" },+ { label: "Chinese", value: "zh" },+] as const++const accountFormSchema = z.object({+ name: z+ .string()+ .min(2, {+ message: "Name must be at least 2 characters.",+ })+ .max(30, {+ message: "Name must not be longer than 30 characters.",+ }),+ dob: z.date({+ required_error: "A date of birth is required.",+ }),+ language: z.string({+ required_error: "Please select a language.",+ }),+})++type AccountFormValues = z.infer<typeof accountFormSchema>++// This can come from your database or API.+const defaultValues: Partial<AccountFormValues> = {+ // name: "Your name",+ // dob: new Date("2023-01-23"),+}++export function AccountForm() {+ const form = useForm<AccountFormValues>({+ resolver: zodResolver(accountFormSchema),+ defaultValues,+ })++ function onSubmit(data: AccountFormValues) {+ toast(+ <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">+ <code className="text-white">{JSON.stringify(data, null, 2)}</code>+ </pre>+ )+ }++ return (+ <Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">+ <FormField+ control={form.control}+ name="name"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Name</FormLabel>+ <FormControl>+ <Input placeholder="Your name" {...field} />+ </FormControl>+ <FormDescription>+ This is the name that will be displayed on your profile and in+ emails.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="dob"+ render={({ field }) => (+ <FormItem className="flex flex-col">+ <FormLabel>Date of birth</FormLabel>+ <Popover>+ <PopoverTrigger asChild>+ <FormControl>+ <Button+ variant={"outline"}+ className={cn(+ "w-[240px] pl-3 text-left font-normal",+ !field.value && "text-muted-foreground"+ )}+ >+ {field.value ? (+ format(field.value, "PPP")+ ) : (+ <span>Pick a date</span>+ )}+ <CalendarIcon className="ml-auto h-4 w-4 opacity-50" />+ </Button>+ </FormControl>+ </PopoverTrigger>+ <PopoverContent className="w-auto p-0" align="start">+ <Calendar+ mode="single"+ selected={field.value}+ onSelect={field.onChange}+ disabled={(date) =>+ date > new Date() || date < new Date("1900-01-01")+ }+ initialFocus+ />+ </PopoverContent>+ </Popover>+ <FormDescription>+ Your date of birth is used to calculate your age.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="language"+ render={({ field }) => (+ <FormItem className="flex flex-col">+ <FormLabel>Language</FormLabel>+ <Popover>+ <PopoverTrigger asChild>+ <FormControl>+ <Button+ variant="outline"+ role="combobox"+ className={cn(+ "w-[200px] justify-between",+ !field.value && "text-muted-foreground"+ )}+ >+ {field.value+ ? languages.find(+ (language) => language.value === field.value+ )?.label+ : "Select language"}+ <ChevronsUpDown className="opacity-50" />+ </Button>+ </FormControl>+ </PopoverTrigger>+ <PopoverContent className="w-[200px] p-0">+ <Command>+ <CommandInput placeholder="Search language..." />+ <CommandList>+ <CommandEmpty>No language found.</CommandEmpty>+ <CommandGroup>+ {languages.map((language) => (+ <CommandItem+ value={language.label}+ key={language.value}+ onSelect={() => {+ form.setValue("language", language.value)+ }}+ >+ <Check+ className={cn(+ "mr-2",+ language.value === field.value+ ? "opacity-100"+ : "opacity-0"+ )}+ />+ {language.label}+ </CommandItem>+ ))}+ </CommandGroup>+ </CommandList>+ </Command>+ </PopoverContent>+ </Popover>+ <FormDescription>+ This is the language that will be used in the dashboard.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <Button type="submit">Update account</Button>+ </form>+ </Form>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/account/page.tsx b/flowsint-web/src/app/dashboard/settings/account/page.tsxnew file mode 100644index 00000000..aafd483a--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/account/page.tsx@@ -0,0 +1,18 @@+import { Separator } from "@/components/ui/separator"+import { AccountForm } from "./account-form"++export default function SettingsAccountPage() {+ return (+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Account</h3>+ <p className="text-sm text-muted-foreground">+ Update your account settings. Set your preferred language and+ timezone.+ </p>+ </div>+ <Separator />+ <AccountForm />+ </div>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/appearance/appearance-form.tsx b/flowsint-web/src/app/dashboard/settings/appearance/appearance-form.tsxnew file mode 100644index 00000000..cd432e85--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/appearance/appearance-form.tsx@@ -0,0 +1,192 @@+"use client"++import { zodResolver } from "@hookform/resolvers/zod"+import { ChevronDown } from "lucide-react"+import { useForm } from "react-hook-form"+import { z } from "zod"++import { cn } from "@/lib/utils"+import { toast } from "sonner"+import { Button, buttonVariants } from "@/components/ui/button"+import {+ Form,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from "@/components/ui/form"+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"+import { useTheme } from "next-themes"++const appearanceFormSchema = z.object({+ theme: z.enum(["light", "dark", "system"], {+ required_error: "Please select a theme.",+ }),+ font: z.enum(["inter", "manrope", "system"], {+ invalid_type_error: "Select a font",+ required_error: "Please select a font.",+ }),+})++type AppearanceFormValues = z.infer<typeof appearanceFormSchema>++// This can come from your database or API.+const defaultValues: Partial<AppearanceFormValues> = {+ theme: "system",+ font: "inter",+}++export function AppearanceForm() {+ const form = useForm<AppearanceFormValues>({+ resolver: zodResolver(appearanceFormSchema),+ defaultValues,+ })+ const { setTheme } = useTheme()+++ function onSubmit(data: AppearanceFormValues) {+ setTheme(data.theme)+ toast(+ <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">+ <code className="text-white">{JSON.stringify(data, null, 2)}</code>+ </pre>+ )+ }++ return (+ <Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">+ <FormField+ control={form.control}+ name="font"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Font</FormLabel>+ <div className="relative w-max">+ <FormControl>+ <select+ className={cn(+ buttonVariants({ variant: "outline" }),+ "w-[200px] appearance-none font-normal"+ )}+ {...field}+ >+ <option value="inter">Inter</option>+ <option value="manrope">Manrope</option>+ <option value="system">System</option>+ </select>+ </FormControl>+ <ChevronDown className="absolute right-3 top-2.5 h-4 w-4 opacity-50" />+ </div>+ <FormDescription>+ Set the font you want to use in the dashboard.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="theme"+ render={({ field }) => (+ <FormItem className="space-y-1">+ <FormLabel>Theme</FormLabel>+ <FormDescription>+ Select the theme for the dashboard.+ </FormDescription>+ <FormMessage />+ <RadioGroup+ onValueChange={field.onChange}+ defaultValue={field.value}+ className="grid max-w-2xl grid-cols-3 gap-8 pt-2"+ >+ <FormItem>+ <FormLabel className="[&:has([data-state=checked])>div]:border-primary">+ <FormControl>+ <RadioGroupItem value="light" className="sr-only" />+ </FormControl>+ <div className="items-center rounded-md border-2 border-muted p-1 hover:border-accent">+ <div className="space-y-2 rounded-sm bg-[#ecedef] p-2">+ <div className="space-y-2 rounded-md bg-white p-2 shadow-sm">+ <div className="h-2 w-[80px] rounded-lg bg-[#ecedef]" />+ <div className="h-2 w-[100px] rounded-lg bg-[#ecedef]" />+ </div>+ <div className="flex items-center space-x-2 rounded-md bg-white p-2 shadow-sm">+ <div className="h-4 w-4 rounded-full bg-[#ecedef]" />+ <div className="h-2 w-[100px] rounded-lg bg-[#ecedef]" />+ </div>+ <div className="flex items-center space-x-2 rounded-md bg-white p-2 shadow-sm">+ <div className="h-4 w-4 rounded-full bg-[#ecedef]" />+ <div className="h-2 w-[100px] rounded-lg bg-[#ecedef]" />+ </div>+ </div>+ </div>+ <span className="block w-full p-2 text-center font-normal">+ Light+ </span>+ </FormLabel>+ </FormItem>+ <FormItem>+ <FormLabel className="[&:has([data-state=checked])>div]:border-primary">+ <FormControl>+ <RadioGroupItem value="dark" className="sr-only" />+ </FormControl>+ <div className="items-center rounded-md border-2 border-muted bg-popover p-1 hover:bg-accent hover:text-accent-foreground">+ <div className="space-y-2 rounded-sm bg-slate-950 p-2">+ <div className="space-y-2 rounded-md bg-slate-800 p-2 shadow-sm">+ <div className="h-2 w-[80px] rounded-lg bg-slate-400" />+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />+ </div>+ <div className="flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-sm">+ <div className="h-4 w-4 rounded-full bg-slate-400" />+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />+ </div>+ <div className="flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-sm">+ <div className="h-4 w-4 rounded-full bg-slate-400" />+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />+ </div>+ </div>+ </div>+ <span className="block w-full p-2 text-center font-normal">+ Dark+ </span>+ </FormLabel>+ </FormItem>+ <FormItem>+ <FormLabel className="[&:has([data-state=checked])>div]:border-primary">+ <FormControl>+ <RadioGroupItem value="system" className="sr-only" />+ </FormControl>+ <div className="items-center rounded-md border-2 border-muted bg-popover p-1 hover:bg-accent hover:text-accent-foreground">+ <div className="space-y-2 rounded-sm bg-slate-950 p-2">+ <div className="space-y-2 rounded-md bg-slate-800 p-2 shadow-sm">+ <div className="h-2 w-[80px] rounded-lg bg-slate-400" />+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />+ </div>+ <div className="flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-sm">+ <div className="h-4 w-4 rounded-full bg-slate-400" />+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />+ </div>+ <div className="flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-sm">+ <div className="h-4 w-4 rounded-full bg-slate-400" />+ <div className="h-2 w-[100px] rounded-lg bg-slate-400" />+ </div>+ </div>+ </div>+ <span className="block w-full p-2 text-center font-normal">+ System+ </span>+ </FormLabel>+ </FormItem>+ </RadioGroup>+ </FormItem>+ )}+ />++ <Button type="submit">Update preferences</Button>+ </form>+ </Form>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/appearance/page.tsx b/flowsint-web/src/app/dashboard/settings/appearance/page.tsxnew file mode 100644index 00000000..6bb6eb13--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/appearance/page.tsx@@ -0,0 +1,18 @@+import { Separator } from "@/components/ui/separator"+import { AppearanceForm } from "./appearance-form"++export default function SettingsAppearancePage() {+ return (+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Appearance</h3>+ <p className="text-sm text-muted-foreground">+ Customize the appearance of the app. Automatically switch between day+ and night themes.+ </p>+ </div>+ <Separator />+ <AppearanceForm />+ </div>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/components/sidebar-nav.tsx b/flowsint-web/src/app/dashboard/settings/components/sidebar-nav.tsxnew file mode 100644index 00000000..48992b00--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/components/sidebar-nav.tsx@@ -0,0 +1,44 @@+"use client"++import Link from "next/link"+import { usePathname } from "next/navigation"++import { cn } from "@/lib/utils"+import { buttonVariants } from "@/components/ui/button"++interface SidebarNavProps extends React.HTMLAttributes<HTMLElement> {+ items: {+ href: string+ title: string+ }[]+}++export function SidebarNav({ className, items, ...props }: SidebarNavProps) {+ const pathname = usePathname()++ return (+ <nav+ className={cn(+ "flex space-x-2 sm:flex-col md:space-y-1",+ className+ )}+ {...props}+ >+ {items.map((item) => (+ <Link+ key={item.href}+ href={item.href}+ className={cn(+ buttonVariants({ variant: "ghost" }),+ pathname === item.href+ ? "bg-muted hover:bg-muted"+ : "hover:bg-transparent hover:underline",+ "justify-start"+ )}+ >+ {item.title}+ </Link>+ ))}+ </nav>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/display/display-form.tsx b/flowsint-web/src/app/dashboard/settings/display/display-form.tsxnew file mode 100644index 00000000..9139caa1--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/display/display-form.tsx@@ -0,0 +1,129 @@+"use client"++import { zodResolver } from "@hookform/resolvers/zod"+import { useForm } from "react-hook-form"+import { z } from "zod"++import { toast } from "sonner"+import { Button } from "@/components/ui/button"+import { Checkbox } from "@/components/ui/checkbox"+import {+ Form,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from "@/components/ui/form"++const items = [+ {+ id: "recents",+ label: "Recents",+ },+ {+ id: "home",+ label: "Home",+ },+ {+ id: "applications",+ label: "Applications",+ },+ {+ id: "desktop",+ label: "Desktop",+ },+ {+ id: "downloads",+ label: "Downloads",+ },+ {+ id: "documents",+ label: "Documents",+ },+] as const++const displayFormSchema = z.object({+ items: z.array(z.string()).refine((value) => value.some((item) => item), {+ message: "You have to select at least one item.",+ }),+})++type DisplayFormValues = z.infer<typeof displayFormSchema>++// This can come from your database or API.+const defaultValues: Partial<DisplayFormValues> = {+ items: ["recents", "home"],+}++export function DisplayForm() {+ const form = useForm<DisplayFormValues>({+ resolver: zodResolver(displayFormSchema),+ defaultValues,+ })++ function onSubmit(data: DisplayFormValues) {+ toast(+ <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">+ <code className="text-white">{JSON.stringify(data, null, 2)}</code>+ </pre>+ )+ }++ return (+ <Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">+ <FormField+ control={form.control}+ name="items"+ render={() => (+ <FormItem>+ <div className="mb-4">+ <FormLabel className="text-base">Sidebar</FormLabel>+ <FormDescription>+ Select the items you want to display in the sidebar.+ </FormDescription>+ </div>+ {items.map((item) => (+ <FormField+ key={item.id}+ control={form.control}+ name="items"+ render={({ field }) => {+ return (+ <FormItem+ key={item.id}+ className="flex flex-row items-start space-x-3 space-y-0"+ >+ <FormControl>+ <Checkbox+ checked={field.value?.includes(item.id)}+ onCheckedChange={(checked) => {+ return checked+ ? field.onChange([...field.value, item.id])+ : field.onChange(+ field.value?.filter(+ (value) => value !== item.id+ )+ )+ }}+ />+ </FormControl>+ <FormLabel className="font-normal">+ {item.label}+ </FormLabel>+ </FormItem>+ )+ }}+ />+ ))}+ <FormMessage />+ </FormItem>+ )}+ />+ <Button type="submit">Update display</Button>+ </form>+ </Form>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/display/page.tsx b/flowsint-web/src/app/dashboard/settings/display/page.tsxnew file mode 100644index 00000000..6c1b06e5--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/display/page.tsx@@ -0,0 +1,17 @@+import { Separator } from "@/components/ui/separator"+import { DisplayForm } from "./display-form"++export default function SettingsDisplayPage() {+ return (+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Display</h3>+ <p className="text-sm text-muted-foreground">+ Turn items on or off to control what's displayed in the app.+ </p>+ </div>+ <Separator />+ <DisplayForm />+ </div>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/layout.tsx b/flowsint-web/src/app/dashboard/settings/layout.tsxnew file mode 100644index 00000000..d1563bb7--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/layout.tsx@@ -0,0 +1,60 @@+import { Metadata } from "next"+import Image from "next/image"++import { Separator } from "@/components/ui/separator"+import { SidebarNav } from "./components/sidebar-nav"+import DashboardLayout from "@/components/dashboard/layout"++export const metadata: Metadata = {+ title: "Forms",+ description: "Advanced form example using react-hook-form and Zod.",+}++const sidebarNavItems = [+ {+ title: "General",+ href: "/dashboard/settings",+ },+ {+ title: "Account",+ href: "/dashboard/settings/account",+ },+ {+ title: "Appearance",+ href: "/dashboard/settings/appearance",+ },+ {+ title: "Notifications",+ href: "/dashboard/settings/notifications",+ },+ {+ title: "Display",+ href: "/dashboard/settings/display",+ },+]++interface SettingsLayoutProps {+ children: React.ReactNode+}++export default function SettingsLayout({ children }: SettingsLayoutProps) {+ return (+ <DashboardLayout items={[{ name: "Dashboard", href: "/dashboard" }, { name: "Settings" }]}>+ <div className="space-y-12 container mx-auto py-12 px-8">+ <div className="space-y-0.5">+ <h2 className="text-2xl font-bold tracking-tight">Settings</h2>+ <p className="text-muted-foreground">+ Manage your account settings and set e-mail preferences.+ </p>+ </div>+ <Separator className="my-6" />+ <div className="flex flex-col space-y-8 md:flex-row space-x-12 gap-6">+ <aside className="lg:w-1/5">+ <SidebarNav items={sidebarNavItems} />+ </aside>+ <div className="flex-1 md:max-w-2xl">{children}</div>+ </div>+ </div>+ </DashboardLayout>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/notifications/notifications-form.tsx b/flowsint-web/src/app/dashboard/settings/notifications/notifications-form.tsxnew file mode 100644index 00000000..f5d1941c--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/notifications/notifications-form.tsx@@ -0,0 +1,219 @@+"use client"++import Link from "next/link"+import { zodResolver } from "@hookform/resolvers/zod"+import { useForm } from "react-hook-form"+import { z } from "zod"++import { toast } from "sonner"+import { Button } from "@/components/ui/button"+import { Checkbox } from "@/components/ui/checkbox"+import {+ Form,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from "@/components/ui/form"+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"+import { Switch } from "@/components/ui/switch"++const notificationsFormSchema = z.object({+ type: z.enum(["all", "mentions", "none"], {+ required_error: "You need to select a notification type.",+ }),+ mobile: z.boolean().default(false).optional(),+ communication_emails: z.boolean().default(false).optional(),+ social_emails: z.boolean().default(false).optional(),+ marketing_emails: z.boolean().default(false).optional(),+ security_emails: z.boolean(),+})++type NotificationsFormValues = z.infer<typeof notificationsFormSchema>++// This can come from your database or API.+const defaultValues: Partial<NotificationsFormValues> = {+ communication_emails: false,+ marketing_emails: false,+ social_emails: true,+ security_emails: true,+}++export function NotificationsForm() {+ const form = useForm<NotificationsFormValues>({+ resolver: zodResolver(notificationsFormSchema),+ defaultValues,+ })++ function onSubmit(data: NotificationsFormValues) {+ toast(+ <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">+ <code className="text-white">{JSON.stringify(data, null, 2)}</code>+ </pre>+ )+ }++ return (+ <Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">+ <FormField+ control={form.control}+ name="type"+ render={({ field }) => (+ <FormItem className="space-y-3">+ <FormLabel>Notify me about...</FormLabel>+ <FormControl>+ <RadioGroup+ onValueChange={field.onChange}+ defaultValue={field.value}+ className="flex flex-col space-y-1"+ >+ <FormItem className="flex items-center space-x-3 space-y-0">+ <FormControl>+ <RadioGroupItem value="all" />+ </FormControl>+ <FormLabel className="font-normal">+ All new messages+ </FormLabel>+ </FormItem>+ <FormItem className="flex items-center space-x-3 space-y-0">+ <FormControl>+ <RadioGroupItem value="mentions" />+ </FormControl>+ <FormLabel className="font-normal">+ Direct messages and mentions+ </FormLabel>+ </FormItem>+ <FormItem className="flex items-center space-x-3 space-y-0">+ <FormControl>+ <RadioGroupItem value="none" />+ </FormControl>+ <FormLabel className="font-normal">Nothing</FormLabel>+ </FormItem>+ </RadioGroup>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <div>+ <h3 className="mb-4 text-lg font-medium">Email Notifications</h3>+ <div className="space-y-4">+ <FormField+ control={form.control}+ name="communication_emails"+ render={({ field }) => (+ <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">+ <div className="space-y-0.5">+ <FormLabel className="text-base">+ Communication emails+ </FormLabel>+ <FormDescription>+ Receive emails about your account activity.+ </FormDescription>+ </div>+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="marketing_emails"+ render={({ field }) => (+ <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">+ <div className="space-y-0.5">+ <FormLabel className="text-base">+ Marketing emails+ </FormLabel>+ <FormDescription>+ Receive emails about new products, features, and more.+ </FormDescription>+ </div>+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="social_emails"+ render={({ field }) => (+ <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">+ <div className="space-y-0.5">+ <FormLabel className="text-base">Social emails</FormLabel>+ <FormDescription>+ Receive emails for friend requests, follows, and more.+ </FormDescription>+ </div>+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="security_emails"+ render={({ field }) => (+ <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">+ <div className="space-y-0.5">+ <FormLabel className="text-base">Security emails</FormLabel>+ <FormDescription>+ Receive emails about your account activity and security.+ </FormDescription>+ </div>+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled+ aria-readonly+ />+ </FormControl>+ </FormItem>+ )}+ />+ </div>+ </div>+ <FormField+ control={form.control}+ name="mobile"+ render={({ field }) => (+ <FormItem className="flex flex-row items-start space-x-3 space-y-0">+ <FormControl>+ <Checkbox+ checked={field.value}+ onCheckedChange={field.onChange}+ />+ </FormControl>+ <div className="space-y-1 leading-none">+ <FormLabel>+ Use different settings for my mobile devices+ </FormLabel>+ <FormDescription>+ You can manage your mobile notifications in the{" "}+ <Link href="/examples/forms">mobile settings</Link> page.+ </FormDescription>+ </div>+ </FormItem>+ )}+ />+ <Button type="submit">Update notifications</Button>+ </form>+ </Form>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/notifications/page.tsx b/flowsint-web/src/app/dashboard/settings/notifications/page.tsxnew file mode 100644index 00000000..75e5c96e--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/notifications/page.tsx@@ -0,0 +1,17 @@+import { Separator } from "@/components/ui/separator"+import { NotificationsForm } from "./notifications-form"++export default function SettingsNotificationsPage() {+ return (+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Notifications</h3>+ <p className="text-sm text-muted-foreground">+ Configure how you receive notifications.+ </p>+ </div>+ <Separator />+ <NotificationsForm />+ </div>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/page.tsx b/flowsint-web/src/app/dashboard/settings/page.tsxnew file mode 100644index 00000000..327cae8a--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/page.tsx@@ -0,0 +1,17 @@+import { Separator } from "@/components/ui/separator"+import { ProfileForm } from "./profile-form"++export default function SettingsProfilePage() {+ return (+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Profile</h3>+ <p className="text-sm text-muted-foreground">+ This is how others will see you on the site.+ </p>+ </div>+ <Separator />+ <ProfileForm />+ </div>+ )+}diff --git a/flowsint-web/src/app/dashboard/settings/profile-form.tsx b/flowsint-web/src/app/dashboard/settings/profile-form.tsxnew file mode 100644index 00000000..caa14072--- /dev/null+++ b/flowsint-web/src/app/dashboard/settings/profile-form.tsx@@ -0,0 +1,188 @@+"use client"++import Link from "next/link"+import { zodResolver } from "@hookform/resolvers/zod"+import { useFieldArray, useForm } from "react-hook-form"+import { z } from "zod"++import { cn } from "@/lib/utils"+import { toast } from "sonner"+import { Button } from "@/components/ui/button"+import {+ Form,+ FormControl,+ FormDescription,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from "@/components/ui/form"+import { Input } from "@/components/ui/input"+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select"+import { Textarea } from "@/components/ui/textarea"++const profileFormSchema = z.object({+ username: z+ .string()+ .min(2, {+ message: "Username must be at least 2 characters.",+ })+ .max(30, {+ message: "Username must not be longer than 30 characters.",+ }),+ email: z+ .string({+ required_error: "Please select an email to display.",+ })+ .email(),+ bio: z.string().max(160).min(4),+ urls: z+ .array(+ z.object({+ value: z.string().url({ message: "Please enter a valid URL." }),+ })+ )+ .optional(),+})++type ProfileFormValues = z.infer<typeof profileFormSchema>++// This can come from your database or API.+const defaultValues: Partial<ProfileFormValues> = {+ bio: "I own a computer.",+ urls: [+ { value: "https://shadcn.com" },+ { value: "http://twitter.com/shadcn" },+ ],+}++export function ProfileForm() {+ const form = useForm<ProfileFormValues>({+ resolver: zodResolver(profileFormSchema),+ defaultValues,+ mode: "onChange",+ })++ const { fields, append } = useFieldArray({+ name: "urls",+ control: form.control,+ })++ function onSubmit(data: ProfileFormValues) {+ toast(+ <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">+ <code className="text-white">{JSON.stringify(data, null, 2)}</code>+ </pre>+ )+ }++ return (+ <Form {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">+ <FormField+ control={form.control}+ name="username"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Username</FormLabel>+ <FormControl>+ <Input placeholder="shadcn" {...field} />+ </FormControl>+ <FormDescription>+ This is your public display name. It can be your real name or a+ pseudonym. You can only change this once every 30 days.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="email"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Email</FormLabel>+ <Select onValueChange={field.onChange} defaultValue={field.value}>+ <FormControl>+ <SelectTrigger>+ <SelectValue placeholder="Select a verified email to display" />+ </SelectTrigger>+ </FormControl>+ <SelectContent>+ <SelectItem value="[email protected]">[email protected]</SelectItem>+ <SelectItem value="[email protected]">[email protected]</SelectItem>+ <SelectItem value="[email protected]">[email protected]</SelectItem>+ </SelectContent>+ </Select>+ <FormDescription>+ You can manage verified email addresses in your{" "}+ <Link href="/examples/forms">email settings</Link>.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="bio"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Bio</FormLabel>+ <FormControl>+ <Textarea+ placeholder="Tell us a little bit about yourself"+ className="resize-none"+ {...field}+ />+ </FormControl>+ <FormDescription>+ You can <span>@mention</span> other users and organizations to+ link to them.+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ <div>+ {fields.map((field, index) => (+ <FormField+ control={form.control}+ key={field.id}+ name={`urls.${index}.value`}+ render={({ field }) => (+ <FormItem>+ <FormLabel className={cn(index !== 0 && "sr-only")}>+ URLs+ </FormLabel>+ <FormDescription className={cn(index !== 0 && "sr-only")}>+ Add links to your website, blog, or social media profiles.+ </FormDescription>+ <FormControl>+ <Input {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ ))}+ <Button+ type="button"+ variant="outline"+ size="sm"+ className="mt-2"+ onClick={() => append({ value: "" })}+ >+ Add URL+ </Button>+ </div>+ <Button type="submit">Update profile</Button>+ </form>+ </Form>+ )+}diff --git a/flowsint-web/src/components/app-sidebar.tsx b/flowsint-web/src/components/app-sidebar.tsxindex c5213539..464ce211 100644--- a/flowsint-web/src/components/app-sidebar.tsx+++ b/flowsint-web/src/components/app-sidebar.tsx@@ -68,12 +68,12 @@ export function AppSidebar({ user, ...props }: AppSidebarProps) {const teamNavItems: NavItem[] = [{title: "My account",- href: "/profile",+ href: "/dashboard/settings/account",icon: UserIcon,},{title: "Team members",- href: "/team",+ href: "/dashboard/settings/team",icon: Users,},]diff --git a/flowsint-web/src/components/dashboard/feedback.tsx b/flowsint-web/src/components/dashboard/feedback.tsxnew file mode 100644index 00000000..74b73a82--- /dev/null+++ b/flowsint-web/src/components/dashboard/feedback.tsx@@ -0,0 +1,50 @@+"use client"++import { useState } from "react"+import { supabase } from "@/lib/supabase/client"+import { Button } from "@/components/ui/button"+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"+import type React from "react" // Added import for React+import { toast } from "sonner"+import { Textarea } from "../ui/textarea"++export default function Feedback() {+ const [open, setOpen] = useState(false)++ const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {+ e.preventDefault()+ const formData = new FormData(e.currentTarget)+ const data = Object.fromEntries(formData)+ try {+ const { error } = await supabase+ .from("feedbacks")+ .insert({ ...data })+ if (error) return toast.error("Could not create new feedback:" + JSON.stringify(error))+ toast.success("Feedback submitted.")+ setOpen(false)+ } catch (error) {+ toast.error("Could not create new feedback:" + JSON.stringify(error))+ }+ }++ return (+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild>+ <Button size={"sm"} variant={"outline"}>Feedback</Button>+ </PopoverTrigger>+ <PopoverContent align="end" className="w-80">+ <form onSubmit={onSubmit} className="flex items-start space-x-3">+ <div className="flex-1 space-y-2">+ <Textarea required name="content" placeholder="Your feedback" />+ <div className="flex justify-end">+ <Button type="submit" size="sm">+ Send feedback+ </Button>+ </div>+ </div>+ </form>+ </PopoverContent>+ </Popover>+ )+}+diff --git a/flowsint-web/src/components/dashboard/layout.tsx b/flowsint-web/src/components/dashboard/layout.tsxindex 08976653..53f4f1d3 100644--- a/flowsint-web/src/components/dashboard/layout.tsx+++ b/flowsint-web/src/components/dashboard/layout.tsx@@ -11,10 +11,12 @@ import {import { Button } from '../ui/button'import { BellIcon, CircleHelpIcon } from 'lucide-react'import Link from 'next/link'+import Feedback from './feedback'interface BreadCrumbItem {name: stringhref?: string | null+ icon?: React.ReactNode}const DashboardLayout = ({ children, items = [] }: { children: React.ReactNode, items: BreadCrumbItem[] }) => {return (@@ -25,6 +27,7 @@ const DashboardLayout = ({ children, items = [] }: { children: React.ReactNode,{items.map((item: BreadCrumbItem, index: number) => (<Fragment key={index}><BreadcrumbItem>+ {item.icon && <span className='mr-1'>{item.icon}</span>}{item.href ?<BreadcrumbLink asChild ><Link href={item.href}>{item.name}</Link></BreadcrumbLink>: <BreadcrumbPage>{item.name}</BreadcrumbPage>@@ -40,7 +43,7 @@ const DashboardLayout = ({ children, items = [] }: { children: React.ReactNode,</BreadcrumbList></Breadcrumb><div className='flex gap-1 items-center'>- <Button size={"sm"} variant={"outline"}>Feedback</Button>+ <Feedback /><Button variant={"ghost"} size={"icon"}><BellIcon className='h-4 w-4 opacity-60' /></Button><Button variant={"ghost"} size={"icon"}><CircleHelpIcon className='h-4 w-4 opacity-60' /></Button></div>diff --git a/flowsint-web/src/components/dashboard/new-project.tsx b/flowsint-web/src/components/dashboard/new-project.tsxindex 2730bd56..dfa2c7ff 100644--- a/flowsint-web/src/components/dashboard/new-project.tsx+++ b/flowsint-web/src/components/dashboard/new-project.tsx@@ -31,7 +31,7 @@ function SubmitButton() {)}-export default function NewProject({ children }: { children: React.ReactNode }) {+export default function NewProject({ children, noDropDown }: { children: React.ReactNode, noDropDown?: boolean }) {const [open, setOpen] = useState(false)const router = useRouter()@@ -46,6 +46,41 @@ export default function NewProject({ children }: { children: React.ReactNode })}}+ if (noDropDown) return (+ <>+ <Button asChild onClick={() => setOpen(true)}>{children}</Button>+ <Dialog open={open} onOpenChange={setOpen}>+ <DialogContent className="sm:max-w-[425px]">+ <DialogHeader>+ <DialogTitle>New project</DialogTitle>+ <DialogDescription>Create a new blank project.</DialogDescription>+ </DialogHeader>+ <form action={handleNewProject}>+ <div className="grid gap-4 py-4">+ <div className="grid gap-2">+ <Label htmlFor="name">Project name</Label>+ <Input id="name" name="name" placeholder="Suspicion de fraude" required />+ </div>+ <div className="grid gap-2">+ <Label htmlFor="description">Description</Label>+ <Input+ id="description"+ name="description"+ placeholder="Investigation sur une campagne de phishing via LinkedIn."+ />+ </div>+ </div>+ <DialogFooter>+ <Button type="button" variant="outline" onClick={() => setOpen(false)}>+ Cancel+ </Button>+ <SubmitButton />+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ </>+ )return (<><DropdownMenu>diff --git a/flowsint-web/src/components/investigations/new-actions.tsx b/flowsint-web/src/components/investigations/new-actions.tsxindex 6cabcca1..c3757073 100644--- a/flowsint-web/src/components/investigations/new-actions.tsx+++ b/flowsint-web/src/components/investigations/new-actions.tsx@@ -9,6 +9,7 @@ import { Avatar, AvatarFallback } from "@/components/ui/avatar"import { Input } from "@/components/ui/input"import { Plus } from "lucide-react"import type React from "react" // Added import for React+import { toast } from "sonner"export default function NewActions({ addNodes }: { addNodes: any }) {const { investigation_id } = useParams()@@ -24,27 +25,28 @@ export default function NewActions({ addNodes }: { addNodes: any }) {.insert({ ...data, investigation_id: investigation_id?.toString() }).select("*").single()- if (error) throw error+ if (error) return toast.error("Could not create new individual:" + JSON.stringify(error))addNodes({id: node.id,type: "individual",data: { ...node, label: data.full_name },position: { x: -100, y: -100 },})+ toast.success("New individual created.")setOpen(false)} catch (error) {- console.error("Error adding individual:", error)+ toast.error("Could not create new individual:" + JSON.stringify(error))}}return (<Popover open={open} onOpenChange={setOpen}><PopoverTrigger asChild>- { <Button variant="outline" size={"icon"} className="gap-2">+ {<Button variant="default" size={"icon"} className="gap-2"><Plus className="h-4 w-4" /></Button>}</PopoverTrigger>- <PopoverContent className="w-80">+ <PopoverContent align="start" className="w-80"><form onSubmit={onSubmit} className="flex items-start space-x-3"><Avatar><AvatarFallback>A</AvatarFallback>diff --git a/flowsint-web/src/components/login-form.tsx b/flowsint-web/src/components/login-form.tsxindex 21ae6d11..f93199d3 100644--- a/flowsint-web/src/components/login-form.tsx+++ b/flowsint-web/src/components/login-form.tsx@@ -1,61 +1,62 @@import Link from "next/link"+import { Github } from "lucide-react"import { Button } from "@/components/ui/button"-import { login, signup, signInWithGithub } from '@/lib/actions/auth'-import { Card } from "./ui/card"-import { Input } from "./ui/input"+import { login, signup, signInWithGithub } from "@/lib/actions/auth"+import { Card, CardHeader, CardContent, CardFooter } from "@/components/ui/card"+import { Input } from "@/components/ui/input"+import { Label } from "@/components/ui/label"export function LoginForm() {return (- <Card className="mx-auto w-full max-w-md !p-6">- <div className="flex flex-col gap-2">- <div>- Login- </div>- <div>- Login into your account or create a new one.- </div>- </div>- <div className="flex flex-col gap-3">- <form>- <div className="flex flex-col gap-2">- <label htmlFor="email">- <div>- </div>- <Input- id="email"- type="email"- name="email"- placeholder="[email protected]"- required- />- </label>- <label htmlFor="email">- Password- <Input id="password" name="password" placeholder="Your password" type="password" required />- </label>- <Link href="#" className="ml-auto inline-block text-sm underline">- Forgot your password?- </Link>- <Button formAction={login} type="submit" className="w-full mt-4">- Login- </Button>+ <Card className="mx-auto w-full max-w-md">+ <CardHeader className="space-y-1">+ <h2 className="text-2xl font-semibold tracking-tight">Login</h2>+ <p className="text-sm text-muted-foreground">Login into your account or create a new one.</p>+ </CardHeader>+ <CardContent className="space-y-4">+ <form className="space-y-4">+ <div className="space-y-2">+ <Label htmlFor="email">Email</Label>+ <Input id="email" type="email" name="email" placeholder="[email protected]" required />+ </div>+ <div className="space-y-2">+ <div className="flex items-center justify-between">+ <Label htmlFor="password">Password</Label>+ <Link href="#" className="text-xs text-muted-foreground underline-offset-4 hover:underline">+ Forgot password?+ </Link>+ </div>+ <Input id="password" name="password" type="password" placeholder="Your password" required />+ </div>+ <Button formAction={login} type="submit" className="w-full">+ Login+ </Button>+ <div className="relative">+ <div className="absolute inset-0 flex items-center">+ <span className="w-full border-t" />+ </div>+ <div className="relative flex justify-center text-xs uppercase">+ <span className="bg-background px-2 text-muted-foreground">Or continue with</span>+ </div></div></form><form>- <div className="flex flex-col gap-3">- <Button formAction={signInWithGithub} variant="outline" className="w-full">- Login with Github- </Button>- </div>+ <Button formAction={signInWithGithub} variant="outline" className="w-full">+ <Github className="mr-2 h-4 w-4" />+ Login with Github+ </Button></form>- </div>- <div className="mt-4 text-center text-sm">- Don't have an account?{" "}- <Button variant="ghost" formAction={signup}>- Sign up- </Button>- </div>- </Card >++ </CardContent>+ <CardFooter className="flex justify-center">+ <div className="text-sm text-muted-foreground">+ Don't have an account?{" "}+ <Button variant="link" formAction={signup} className="p-0">+ Sign up+ </Button>+ </div>+ </CardFooter>+ </Card>)-}\ No newline at end of file+}+diff --git a/flowsint-web/src/components/ui/button.tsx b/flowsint-web/src/components/ui/button.tsxindex 0988d45a..7df646ba 100644--- a/flowsint-web/src/components/ui/button.tsx+++ b/flowsint-web/src/components/ui/button.tsx@@ -10,7 +10,7 @@ const buttonVariants = cva(variants: {variant: {default:- "bg-primary text-primary-foreground hover:bg-primary/90",+ "text-primary-foreground bg-primary/70 hover:bg-primary/80 border border-primary",destructive:"bg-destructive text-destructive-foregroundhover:bg-destructive/90",outline:diff --git a/flowsint-web/styles/globals.css b/flowsint-web/styles/globals.cssindex 7981c517..a6237c50 100644--- a/flowsint-web/styles/globals.css+++ b/flowsint-web/styles/globals.css@@ -15,7 +15,7 @@--card-foreground: hsl(0 0% 3.9%);--popover: hsl(0 0% 100%);--popover-foreground: hsl(0 0% 3.9%);- --primary: hsl(160.1 84.1% 39.4%);+ --primary: hsl(221.2 83.2% 53.3%);--primary-foreground: hsl(0 0% 98%);--secondary: hsl(0 0% 96.1%);--secondary-foreground: hsl(0 0% 9%);@@ -28,7 +28,7 @@--border: hsla(0, 0%, 90%, 0.807);--input: hsl(0 0% 89.8%);--ring: hsl(0 0% 3.9%);- --chart-1: hsl(160.1 84.1% 39.4%);+ --chart-1: hsl(221.2 83.2% 53.3%);--chart-2: hsl(173 58% 39%);--chart-3: hsl(197 37% 24%);--chart-4: hsl(43 74% 66%);diff --git a/package.json b/package.jsonindex 2e99fc86..333dc44a 100644--- a/package.json+++ b/package.json@@ -8,5 +8,8 @@"license": "MIT","scripts": {"dev": "docker compose up -d"+ },+ "devDependencies": {+ "supabase": "^2.19.7"}-}\ No newline at end of file+}diff --git a/yarn.lock b/yarn.locknew file mode 100644index 00000000..7a358818--- /dev/null+++ b/yarn.lock@@ -0,0 +1,421 @@+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.+# yarn lockfile v1+++"@isaacs/cliui@^8.0.2":+ version "8.0.2"+ resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"+ integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==+ dependencies:+ string-width "^5.1.2"+ string-width-cjs "npm:string-width@^4.2.0"+ strip-ansi "^7.0.1"+ strip-ansi-cjs "npm:strip-ansi@^6.0.1"+ wrap-ansi "^8.1.0"+ wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"++"@isaacs/fs-minipass@^4.0.0":+ version "4.0.1"+ resolved "https://registry.yarnpkg.com/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz#2d59ae3ab4b38fb4270bfa23d30f8e2e86c7fe32"+ integrity sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==+ dependencies:+ minipass "^7.0.4"++"@pkgjs/parseargs@^0.11.0":+ version "0.11.0"+ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"+ integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==++agent-base@^7.1.2:+ version "7.1.3"+ resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.3.tgz#29435eb821bc4194633a5b89e5bc4703bafc25a1"+ integrity sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==++ansi-regex@^5.0.1:+ version "5.0.1"+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"+ integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==++ansi-regex@^6.0.1:+ version "6.1.0"+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654"+ integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==++ansi-styles@^4.0.0:+ version "4.3.0"+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"+ integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==+ dependencies:+ color-convert "^2.0.1"++ansi-styles@^6.1.0:+ version "6.2.1"+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5"+ integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==++balanced-match@^1.0.0:+ version "1.0.2"+ resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"+ integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==++bin-links@^5.0.0:+ version "5.0.0"+ resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-5.0.0.tgz#2b0605b62dd5e1ddab3b92a3c4e24221cae06cca"+ integrity sha512-sdleLVfCjBtgO5cNjA2HVRvWBJAHs4zwenaCPMNJAJU0yNxpzj80IpjOIimkpkr+mhlA+how5poQtt53PygbHA==+ dependencies:+ cmd-shim "^7.0.0"+ npm-normalize-package-bin "^4.0.0"+ proc-log "^5.0.0"+ read-cmd-shim "^5.0.0"+ write-file-atomic "^6.0.0"++brace-expansion@^2.0.1:+ version "2.0.1"+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"+ integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==+ dependencies:+ balanced-match "^1.0.0"++chownr@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/chownr/-/chownr-3.0.0.tgz#9855e64ecd240a9cc4267ce8a4aa5d24a1da15e4"+ integrity sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==++cmd-shim@^7.0.0:+ version "7.0.0"+ resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-7.0.0.tgz#23bcbf69fff52172f7e7c02374e18fb215826d95"+ integrity sha512-rtpaCbr164TPPh+zFdkWpCyZuKkjpAzODfaZCf/SVJZzJN+4bHQb/LP3Jzq5/+84um3XXY8r548XiWKSborwVw==++color-convert@^2.0.1:+ version "2.0.1"+ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"+ integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==+ dependencies:+ color-name "~1.1.4"++color-name@~1.1.4:+ version "1.1.4"+ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"+ integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==++cross-spawn@^7.0.6:+ version "7.0.6"+ resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"+ integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==+ dependencies:+ path-key "^3.1.0"+ shebang-command "^2.0.0"+ which "^2.0.1"++data-uri-to-buffer@^4.0.0:+ version "4.0.1"+ resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"+ integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==++debug@4:+ version "4.4.0"+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a"+ integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==+ dependencies:+ ms "^2.1.3"++eastasianwidth@^0.2.0:+ version "0.2.0"+ resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"+ integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==++emoji-regex@^8.0.0:+ version "8.0.0"+ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"+ integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==++emoji-regex@^9.2.2:+ version "9.2.2"+ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"+ integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==++fetch-blob@^3.1.2, fetch-blob@^3.1.4:+ version "3.2.0"+ resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"+ integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==+ dependencies:+ node-domexception "^1.0.0"+ web-streams-polyfill "^3.0.3"++foreground-child@^3.1.0:+ version "3.3.1"+ resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f"+ integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==+ dependencies:+ cross-spawn "^7.0.6"+ signal-exit "^4.0.1"++formdata-polyfill@^4.0.10:+ version "4.0.10"+ resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"+ integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==+ dependencies:+ fetch-blob "^3.1.2"++glob@^10.3.7:+ version "10.4.5"+ resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956"+ integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==+ dependencies:+ foreground-child "^3.1.0"+ jackspeak "^3.1.2"+ minimatch "^9.0.4"+ minipass "^7.1.2"+ package-json-from-dist "^1.0.0"+ path-scurry "^1.11.1"++https-proxy-agent@^7.0.2:+ version "7.0.6"+ resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9"+ integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==+ dependencies:+ agent-base "^7.1.2"+ debug "4"++imurmurhash@^0.1.4:+ version "0.1.4"+ resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"+ integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==++is-fullwidth-code-point@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"+ integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==++isexe@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"+ integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==++jackspeak@^3.1.2:+ version "3.4.3"+ resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a"+ integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==+ dependencies:+ "@isaacs/cliui" "^8.0.2"+ optionalDependencies:+ "@pkgjs/parseargs" "^0.11.0"++lru-cache@^10.2.0:+ version "10.4.3"+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"+ integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==++minimatch@^9.0.4:+ version "9.0.5"+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"+ integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==+ dependencies:+ brace-expansion "^2.0.1"++"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.0.4, minipass@^7.1.2:+ version "7.1.2"+ resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"+ integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==++minizlib@^3.0.1:+ version "3.0.1"+ resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-3.0.1.tgz#46d5329d1eb3c83924eff1d3b858ca0a31581012"+ integrity sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==+ dependencies:+ minipass "^7.0.4"+ rimraf "^5.0.5"++mkdirp@^3.0.1:+ version "3.0.1"+ resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50"+ integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==++ms@^2.1.3:+ version "2.1.3"+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"+ integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==++node-domexception@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"+ integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==++node-fetch@^3.3.2:+ version "3.3.2"+ resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"+ integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==+ dependencies:+ data-uri-to-buffer "^4.0.0"+ fetch-blob "^3.1.4"+ formdata-polyfill "^4.0.10"++npm-normalize-package-bin@^4.0.0:+ version "4.0.0"+ resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz#df79e70cd0a113b77c02d1fe243c96b8e618acb1"+ integrity sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==++package-json-from-dist@^1.0.0:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505"+ integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==++path-key@^3.1.0:+ version "3.1.1"+ resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"+ integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==++path-scurry@^1.11.1:+ version "1.11.1"+ resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2"+ integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==+ dependencies:+ lru-cache "^10.2.0"+ minipass "^5.0.0 || ^6.0.2 || ^7.0.0"++proc-log@^5.0.0:+ version "5.0.0"+ resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-5.0.0.tgz#e6c93cf37aef33f835c53485f314f50ea906a9d8"+ integrity sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==++read-cmd-shim@^5.0.0:+ version "5.0.0"+ resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-5.0.0.tgz#6e5450492187a0749f6c80dcbef0debc1117acca"+ integrity sha512-SEbJV7tohp3DAAILbEMPXavBjAnMN0tVnh4+9G8ihV4Pq3HYF9h8QNez9zkJ1ILkv9G2BjdzwctznGZXgu/HGw==++rimraf@^5.0.5:+ version "5.0.10"+ resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.10.tgz#23b9843d3dc92db71f96e1a2ce92e39fd2a8221c"+ integrity sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==+ dependencies:+ glob "^10.3.7"++shebang-command@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"+ integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==+ dependencies:+ shebang-regex "^3.0.0"++shebang-regex@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"+ integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==++signal-exit@^4.0.1:+ version "4.1.0"+ resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"+ integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==++"string-width-cjs@npm:string-width@^4.2.0":+ version "4.2.3"+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"+ integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==+ dependencies:+ emoji-regex "^8.0.0"+ is-fullwidth-code-point "^3.0.0"+ strip-ansi "^6.0.1"++string-width@^4.1.0:+ version "4.2.3"+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"+ integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==+ dependencies:+ emoji-regex "^8.0.0"+ is-fullwidth-code-point "^3.0.0"+ strip-ansi "^6.0.1"++string-width@^5.0.1, string-width@^5.1.2:+ version "5.1.2"+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"+ integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==+ dependencies:+ eastasianwidth "^0.2.0"+ emoji-regex "^9.2.2"+ strip-ansi "^7.0.1"++"strip-ansi-cjs@npm:strip-ansi@^6.0.1":+ version "6.0.1"+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"+ integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==+ dependencies:+ ansi-regex "^5.0.1"++strip-ansi@^6.0.0, strip-ansi@^6.0.1:+ version "6.0.1"+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"+ integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==+ dependencies:+ ansi-regex "^5.0.1"++strip-ansi@^7.0.1:+ version "7.1.0"+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"+ integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==+ dependencies:+ ansi-regex "^6.0.1"++supabase@^2.19.7:+ version "2.19.7"+ resolved "https://registry.yarnpkg.com/supabase/-/supabase-2.19.7.tgz#7a2b754fb548616745eca88ec9334a84514fa76d"+ integrity sha512-+Qu5xHvk/CnAHb5iDpCWCX0SdwFR5smpTG6VUSTw/T8WxCDDQsIb2mui2pu18wqKOZ0NLs/ZTDDb2+yPejTRBQ==+ dependencies:+ bin-links "^5.0.0"+ https-proxy-agent "^7.0.2"+ node-fetch "^3.3.2"+ tar "7.4.3"++ version "7.4.3"+ resolved "https://registry.yarnpkg.com/tar/-/tar-7.4.3.tgz#88bbe9286a3fcd900e94592cda7a22b192e80571"+ integrity sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==+ dependencies:+ "@isaacs/fs-minipass" "^4.0.0"+ chownr "^3.0.0"+ minipass "^7.1.2"+ minizlib "^3.0.1"+ mkdirp "^3.0.1"+ yallist "^5.0.0"++web-streams-polyfill@^3.0.3:+ version "3.3.3"+ resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"+ integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==++which@^2.0.1:+ version "2.0.2"+ resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"+ integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==+ dependencies:+ isexe "^2.0.0"++"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":+ version "7.0.0"+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"+ integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==+ dependencies:+ ansi-styles "^4.0.0"+ string-width "^4.1.0"+ strip-ansi "^6.0.0"++wrap-ansi@^8.1.0:+ version "8.1.0"+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"+ integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==+ dependencies:+ ansi-styles "^6.1.0"+ string-width "^5.0.1"+ strip-ansi "^7.0.1"++write-file-atomic@^6.0.0:+ version "6.0.0"+ resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-6.0.0.tgz#e9c89c8191b3ef0606bc79fb92681aa1aa16fa93"+ integrity sha512-GmqrO8WJ1NuzJ2DrziEI2o57jKAVIQNf8a18W3nCYU3H7PNWqCCVTeH6/NQE93CIllIgQS98rrmVkYgTX9fFJQ==+ dependencies:+ imurmurhash "^0.1.4"+ signal-exit "^4.0.1"++yallist@^5.0.0:+ version "5.0.0"+ resolved "https://registry.yarnpkg.com/yallist/-/yallist-5.0.0.tgz#00e2de443639ed0d78fd87de0d27469fbcffb533"+ integrity sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==