diff --git a/.env.example b/.env.example index d82f2088..d2f15b68 100644 --- a/.env.example +++ b/.env.example @@ -1,23 +1,25 @@ -# Convex -CONVEX_DEPLOYMENT=dev:your-deployment-id # team: your-team, project: film-fanatic -VITE_CONVEX_URL=https://your-project.convex.cloud -VITE_CONVEX_SITE_URL=https://your-project.convex.site - # Clerk Auth -CONVEX_CLERK_ISSUER_URL=https://your-app.clerk.accounts.dev VITE_CLERK_ISSUER_URL=https://your-app.clerk.accounts.dev VITE_CLERK_PUBLISHABLE_KEY=pk_test_YOUR_CLERK_PUBLISHABLE_KEY # App URLs -VITE_PUBLIC_APP_URL=https://pebbly.vercel.app +VITE_PUBLIC_APP_URL=https://pebbly.swastik.workers.dev # TMDB API (read-only public API key — safe for client) VITE_PUBLIC_TMDB_ACCESS_TOKEN=your_tmdb_read_access_token VITE_PUBLIC_TMDB_API_URL=https://api.themoviedb.org/3 -# Convex Deploy -CONVEX_DEPLOY_KEY=prod:your-deployment|your-deploy-key - # AI Providers (server-only — never expose in client code) -OPENROUTER_API_KEY=sk-or-v1-your-key GEMINI_API_KEY=your_gemini_key + +# ---- Cloudflare Workers backend (post-Convex migration) ---- +# Local dev secrets live in .dev.vars (gitignored); production uses +# `wrangler secret put ` with the same names. + +# Clerk (server-side session token verification via @clerk/backend) +CLERK_SECRET_KEY=sk_test_YOUR_CLERK_SECRET_KEY +CLERK_ISSUER_URL=https://your-app.clerk.accounts.dev + +# Cloudflare (needed for `pnpm db:studio` remote dashboard + GitHub Actions) +CLOUDFLARE_API_TOKEN=your-api-token-with-d1-edit +CLOUDFLARE_ACCOUNT_ID=your-account-id diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..ae68d92b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,68 @@ +name: Bug report +description: Report a bug or unexpected behavior +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! Please search + existing issues first to avoid duplicates. + - type: textarea + id: what-happened + attributes: + label: What happened? + description: What did you expect to happen, and what actually happened? + placeholder: | + Describe the bug. Include the page/route and what you were doing when + it occurred (e.g. "On the TV series page, scrolling the season list..."). + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Steps to reproduce + description: How can we reproduce the issue? + placeholder: | + 1. Go to ... + 2. Click on ... + 3. Scroll to ... + 4. See error + validations: + required: true + - type: input + id: url + attributes: + label: Page / URL + description: The route where the bug occurs, if applicable + - type: dropdown + id: device + attributes: + label: Device + description: What device are you on? + options: + - Desktop + - Mobile / Tablet + validations: + required: true + - type: dropdown + id: browser + attributes: + label: Browser + options: + - Chrome + - Firefox + - Safari + - Edge + - Other + - type: textarea + id: console + attributes: + label: Console / network errors + description: Paste any relevant console errors, network failures, or warnings. + render: shell + - type: textarea + id: additional + attributes: + label: Anything else? + description: Screenshots, screen recordings, or additional context. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..b43224f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Questions & discussions + url: https://github.com/Swastikdan/Pebbly/discussions + about: Ask questions and discuss ideas that aren't bug reports or feature requests. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..730e1643 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,40 @@ +name: Feature request +description: Suggest an idea or improvement +title: "[Feature]: " +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for suggesting a feature! Please search existing issues first + to avoid duplicates. + - type: textarea + id: problem + attributes: + label: What problem does this solve? + description: Describe the pain point or missing capability you're experiencing. + placeholder: | + Example: "There's no way to filter my watchlist by genre, so it's hard + to find something to watch." + validations: + required: true + - type: textarea + id: solution + attributes: + label: Proposed solution + description: Describe the feature you'd like, and how it should behave. + placeholder: | + Example: "Add a genre filter dropdown to the watchlist page that + filters the list client-side." + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: Any workarounds or alternative approaches you've tried. + - type: textarea + id: additional + attributes: + label: Additional context + description: Screenshots, mockups, or links that help explain the request. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..b20199b8 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,25 @@ +## Summary + + + +## Changes + + + +- + +## Related issues + + + +## Screenshots / recordings + + + +## Checklist + +- [ ] `pnpm typecheck` passes +- [ ] `pnpm lint` passes +- [ ] `pnpm build` passes +- [ ] Docs updated if routes, server functions, DB schema, or the repository layer changed +- [ ] No new dependencies added without justification diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..152ce5e9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI Checks +on: + pull_request: + branches: + - cloudflare + types: [opened, synchronize, reopened, ready_for_review] + +# Cancel superseded runs for the same PR so CI doesn't queue stale checks. +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + checks: + runs-on: ubuntu-latest + # Read-only on purpose: PRs only run checks — they can never push, deploy, + # or touch Cloudflare. Only the build-time VITE_* env vars are provided; + # the Cloudflare deploy token/account are intentionally absent here. + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 (node24 runtime) + with: + persist-credentials: false + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6 (node24 runtime) + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 (node24 runtime) + with: { node-version: 22, cache: pnpm } + - run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm typecheck + + - name: Lint + run: pnpm lint + + - name: Build (Nitro cloudflare preset) + run: pnpm build + env: + # Public build-time values only — the same VITE_* vars the deploy + # job inlines into the client bundle. No Cloudflare secrets. + VITE_CLERK_PUBLISHABLE_KEY: ${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }} + VITE_PUBLIC_TMDB_ACCESS_TOKEN: ${{ secrets.VITE_PUBLIC_TMDB_ACCESS_TOKEN }} + VITE_PUBLIC_TMDB_API_URL: ${{ secrets.VITE_PUBLIC_TMDB_API_URL }} + VITE_PUBLIC_APP_URL: ${{ secrets.VITE_PUBLIC_APP_URL }} + VITE_PUBLIC_VIDEO_URL: ${{ secrets.VITE_PUBLIC_VIDEO_URL }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..68ec6754 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,54 @@ +name: Deploy Cloudflare +on: + # Deploy only when changes land on the `cloudflare` branch (i.e. a PR is + # merged into it). Feature-branch pushes and pull requests never deploy — + # they run checks in the separate `ci.yml` workflow instead. + push: + branches: + - cloudflare + workflow_dispatch: # Allows manual trigger from GitHub Actions UI + +# Serialize production deploys so migrations and Worker deployments targeting +# the same D1 database / Worker never run concurrently. +concurrency: + group: deploy-cloudflare-prod + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 (node24 runtime) + with: + persist-credentials: false + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6 (node24 runtime) + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 (node24 runtime) + with: { node-version: 22, cache: pnpm } + - run: pnpm install --frozen-lockfile + - run: pnpm typecheck + - run: pnpm lint + + - name: Apply D1 migrations (prod) + uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4 (node24 runtime) + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: d1 migrations apply pebbly --remote + + - name: Build (Nitro cloudflare preset) + run: pnpm build + env: + VITE_CLERK_PUBLISHABLE_KEY: ${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }} + VITE_PUBLIC_TMDB_ACCESS_TOKEN: ${{ secrets.VITE_PUBLIC_TMDB_ACCESS_TOKEN }} + VITE_PUBLIC_TMDB_API_URL: ${{ secrets.VITE_PUBLIC_TMDB_API_URL }} + VITE_PUBLIC_APP_URL: ${{ secrets.VITE_PUBLIC_APP_URL }} + VITE_PUBLIC_VIDEO_URL: ${{ secrets.VITE_PUBLIC_VIDEO_URL }} + + - name: Deploy Worker + uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4 (node24 runtime) + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: deploy diff --git a/.gitignore b/.gitignore index 0539a16c..59ec6335 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,15 @@ todos.json .gemini/* .pnpm-store .commandcode/taste/taste.md -docs implementation_plan.md .skills-lock.json .agents skills-lock.json + +# Cloudflare / wrangler +.dev.vars +.wrangler/ +convex-export/ + +TODO.md +REFACTOR_PLAN.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..f9412149 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,131 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances + of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for +moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement. All complaints +will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][mozilla]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][faq]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[mozilla]: https://github.com/mozilla/inclusion +[faq]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..e57991f5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,157 @@ +# Contributing to Pebbly + +First off, thanks for taking the time to contribute! 🎬 + +Pebbly is a full-stack movie & TV discovery app built with TanStack Start, +Cloudflare Workers, D1 (SQLite), Drizzle ORM, and TMDB metadata. This guide +covers how to set up the project, what to know before you start, and how to get +your changes merged. + +## Table of contents + +- [Code of conduct](#code-of-conduct) +- [Getting started](#getting-started) +- [Project structure](#project-structure) +- [Development workflow](#development-workflow) +- [Code style & checks](#code-style--checks) +- [Testing](#testing) +- [Documentation](#documentation) +- [Opening a pull request](#opening-a-pull-request) + +## Code of conduct + +This project and everyone participating in it is governed by the +[Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to +uphold this code. Please report unacceptable behavior to the maintainers. + +## Getting started + +### Prerequisites + +- **Node.js 22+** and **pnpm 10+** +- A **TMDB API Read Access Token** (free at [themoviedb.org](https://www.themoviedb.org/signup)) +- A **Clerk application** (for auth) +- A **Google Gemini API key** (for AI recommendations) +- (Optional) A **Cloudflare account** with a D1 database for local `wrangler` dev + +### Setup + +1. **Clone and install** + + ```bash + git clone https://github.com/Swastikdan/Pebbly.git + cd Pebbly + pnpm install + ``` + +2. **Configure environment variables** + + Copy the template and fill in your keys: + + ```bash + cp .env.example .env.local + ``` + + At minimum you need: + + ```env + VITE_PUBLIC_TMDB_ACCESS_TOKEN=your_tmdb_read_access_token + VITE_PUBLIC_TMDB_API_URL=https://api.themoviedb.org/3 + VITE_CLERK_PUBLISHABLE_KEY=pk_test_... + CLERK_SECRET_KEY=sk_test_... + CLERK_ISSUER_URL=https://your-app.clerk.accounts.dev + VITE_PUBLIC_APP_URL=http://localhost:3000 + GEMINI_API_KEY=your_gemini_key + ``` + +3. **Initialize the local database** + + ```bash + pnpm db:migrate:local + ``` + +4. **Run the dev server** + + ```bash + pnpm dev + ``` + + The app runs at `http://localhost:3000`. + +## Project structure + +A quick map of where things live: + +| Path | Purpose | +| :--- | :--- | +| `src/routes/` | TanStack Router file-based routes (movie/tv/person/search pages) | +| `src/server/` | Server functions, D1 schema, auth, RBAC, AI engine | +| `src/components/` | UI components & domain widgets (media cards, watchlist, player) | +| `src/hooks/` | Custom hooks (watchlist, watch progress, daily pick, recommendations) | +| `src/lib/` | Queries, schemas, repository pattern, utils, query keys | +| `drizzle/` | Generated SQL migrations for Cloudflare D1 | +| `server/` | Nitro server routes & scheduled tasks | + +See [docs/](docs/README.md) for in-depth architecture docs — especially +[`docs/architecture.md`](docs/architecture.md) and +[`docs/file-reference.md`](docs/file-reference.md). + +## Development workflow + +1. **Find or create an issue** and comment that you're working on it so others + don't duplicate your work. +2. **Create a feature branch** off `main`: + + ```bash + git checkout -b feat/my-change + ``` + + Use a descriptive prefix: `feat/`, `fix/`, `refactor/`, `docs/`, `chore/`. +3. **Make your changes**, keeping them focused and as small as possible. +4. **Run the checks** below before pushing. +5. **Open a pull request** — see [Opening a pull request](#opening-a-pull-request). + +## Code style & checks + +Always run these before pushing: + +```bash +pnpm typecheck # TypeScript strict type checking +pnpm lint # Biome lint +pnpm build # Production build +``` + +- The project uses **Biome** for linting and formatting. If your editor doesn't + pick it up automatically, run `pnpm format` before committing. +- Prefer **existing project conventions** over introducing new ones — match the + style of the code around your change. +- **Don't add new dependencies** unless they're clearly necessary. If you do, + explain why in the PR description. +- Keep server functions **type-safe and validated** with the existing Valibot + schemas in `src/server/schema/`. + +## Testing + +There is no formal test suite yet. If your change touches data fetching, state +management, or the repository layer, verify manually: + +- Run the app locally with `pnpm dev` and exercise the affected flows. +- If you changed DB behavior, run `pnpm db:migrate:local` to apply the latest + migrations and check with `pnpm db:studio`. + +## Documentation + +- The `docs/` folder is the source of truth for architecture. If you change + routes, server functions, the DB schema, or the repository layer, update the + relevant docs (see [`docs/contributing.md`](docs/contributing.md)). +- Keep README badges, tech-stack tables, and feature lists in sync with reality. + +## Opening a pull request + +1. Push your branch and open a PR against `main`. +2. Fill out the [pull request template](.github/pull_request_template.md). +3. Reference the issue(s) your PR closes (e.g. `Closes #123`). +4. Keep the PR focused: one logical change per PR. Split large changes. +5. CI runs typecheck, lint, and build on every PR — make sure they pass. + +Thanks again for contributing! 🚀 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..63c12174 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Swastikdan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index a5e6f7fc..64693a0a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,22 @@ # Pebbly (Film Fanatic) -Pebbly is a modern, full-stack movie and TV show discovery application built with TanStack Start, Convex, Clerk, Google Gemini AI, and TMDB metadata. It combines rich media browsing with persistent watchlists, granular episode progress tracking, custom user lists, and a personalized AI Recommendation Engine. +Pebbly is a modern, full-stack movie and TV show discovery application built with **TanStack Start**, **Cloudflare Workers**, **Cloudflare D1 (SQLite)**, **Drizzle ORM**, **Valibot**, **Clerk**, **Google Gemini AI**, and **TMDB metadata**. It combines rich media browsing with persistent watchlists, granular episode progress tracking, custom user lists, and a personalized AI Recommendation Engine. + +--- + +## Documentation + +In-depth architecture docs live in the [`docs/`](./docs/) folder: + +| Document | Covers | +| :--- | :--- | +| [Architecture](./docs/architecture.md) | Tech stack, layers, request flows, deployment & CI | +| [Server Layer](./docs/server-layer.md) | Nitro, server functions, auth, RBAC, AI engine | +| [Client Layer](./docs/client-layer.md) | Routing, data fetching, state, repository pattern, optimistic updates | +| [Data Model](./docs/data-model.md) | Every D1 table, index, constraint & migration | +| [Architecture Decisions](./docs/architecture-decisions.md) | ADRs — why the code is shaped the way it is | +| [File Reference](./docs/file-reference.md) | A per-file map of the entire repository | +| [Contributing](./docs/contributing.md) | How to keep the docs accurate as the code changes | --- @@ -10,11 +26,11 @@ Pebbly is a modern, full-stack movie and TV show discovery application built wit - **Comprehensive Browsing**: Explore trending, popular, top-rated, upcoming, and curated movie/TV collections. - **Advanced Search**: Instant cross-media search with genre, media type, and keyword filtering. - **Rich Details & Media Player**: Complete detail pages with cast/crew, trailers, season/episode browsers, and embedded video modal with responsive controls. -- **Smart Watchlist & Progress**: Track progress (`want-to-watch`, `watching`, `caught-up`, `finished`, `dropped`), per-episode watching status, and reaction tags (`loved`, `liked`, `mixed`, `not-for-me`). -- **Custom Lists & Management**: Create custom lists, export/import watchlists in JSON format, and sync seamlessly across devices via Convex. +- **Smart Watchlist & Progress**: Track progress (`watch-later`, `watching`, `done`, `dropped`), per-episode watching status, and reaction tags (`loved`, `liked`, `mixed`, `not-for-me`, `recommended`). +- **Custom Lists & Management**: Create custom lists, export/import watchlists in JSON format, and sync seamlessly across devices via Cloudflare D1. ### AI Recommendation Engine -- **Watchlist & Interaction-Aware AI**: Generates tailored movie and TV recommendations using Google Gemini models (`gemini-3.1-flash-lite-preview`, `gemini-2.5-flash`, etc.). +- **Watchlist & Interaction-Aware AI**: Generates tailored movie and TV recommendations using Google Gemini models (`gemini-3.1-flash-lite`, `gemini-2.5-flash`). - **Homepage "Picks For You"**: Dedicated homepage widget providing twice-daily refreshed recommendations with real-time watchlist exclusion. - **Interaction Feedback Loop**: User interactions (thumbs up / thumbs down) train future recommendations. Liked recommendations are automatically added to your **Pebbly Picks** list, and disliked titles are excluded. - **Advanced Filtering**: Generate recommendations by Watchlist, Custom List, Genre preferences, or Era presets (Classics, 80s, 90s, 2000s, 2010s, 2020s). @@ -27,43 +43,46 @@ Pebbly is a modern, full-stack movie and TV show discovery application built wit | Layer | Technology | | :--- | :--- | | **Framework** | [TanStack Start](https://tanstack.com/start) + [TanStack Router](https://tanstack.com/router) + React 19 | -| **Backend & Realtime** | [Convex](https://www.convex.dev/) | -| **AI Engine** | Google GenAI SDK (`@google/genai` - Gemini Flash models) | -| **Authentication** | [Clerk](https://clerk.com/) | +| **Host & Compute** | [Cloudflare Workers](https://workers.cloudflare.com/) (Nitro `cloudflare_module` preset) | +| **Database** | [Cloudflare D1](https://developers.cloudflare.com/d1/) (SQLite) via [Drizzle ORM](https://orm.drizzle.team/) | +| **Validation** | [Valibot](https://valibot.dev/) (Lightweight, modular schema validation) | +| **Authentication** | [Clerk](https://clerk.com/) (`@clerk/react` + `@clerk/backend` JWT verification) | +| **AI Engine** | Google Gemini REST API (`generativelanguage.googleapis.com` via `fetch` — `gemini-3.1-flash-lite` + `gemini-2.5-flash` fallback chain) | | **Styling** | Tailwind CSS 4, Radix UI, shadcn/ui | | **Data Fetching** | TanStack Query (React Query) | | **State Management** | Zustand | -| **Tooling & Linter** | Vite 7, Biome, TypeScript | +| **Tooling & Linter** | Vite 7, Biome, TypeScript, Wrangler | --- ## Project Structure -``` -├── convex/ # Convex backend schemas, queries, mutations, and actions -│ ├── schema.ts # Database tables (users, watch_items, ai_recommendations, lists, etc.) -│ ├── recommendations.ts # AI recommendation engine actions, prompts, and feedback handling -│ ├── watchlist.ts # Watchlist management, custom lists, and snapshots -│ ├── crons.ts # Scheduled background tasks (e.g. daily watchlist snapshots) -│ └── admin.ts # Feature flags & RBAC permission checks +```text +├── drizzle/ # Drizzle generated SQL migrations for Cloudflare D1 +├── server/ # Nitro server routes and scheduled tasks +│ ├── routes/api/health.ts # /api/health endpoint (D1 status check) +│ └── tasks/snapshots.ts # Daily watchlist snapshots cron task ├── src/ +│ ├── server/ # Co-located backend server functions & database layer +│ │ ├── db/ # D1 database schema & Drizzle client +│ │ ├── fns/ # Type-safe TanStack Start server functions (watchlist, lists, recs, admin) +│ │ ├── schema/ # Valibot schemas & typed API result contracts +│ │ ├── auth.ts # Clerk server-side JWT verification & user resolution +│ │ ├── ai.ts # Gemini AI client with model fallback chain +│ │ ├── prompts.ts # Context-aware prompts for AI recommendations +│ │ └── rbac.ts # Role-based access control & feature flags │ ├── components/ # UI components & domain-specific widgets │ │ ├── homepage-recommendations.tsx # Homepage "Picks For You" row with interaction buttons │ │ ├── video-player-modal.tsx # Fullscreen-capable responsive video player │ │ ├── media-card.tsx # Reusable media grid/carousel card -│ │ └── recommendations/ # Recommendation loading skeletons and UI elements +│ │ └── recommendations/ # Recommendation loading skeletons and UI elements │ ├── hooks/ # Custom hooks (watchlist, watch progress, recommendations, RBAC) -│ │ ├── use-recommendations.ts # Client-side hook for AI recommendation generation & history -│ │ └── use-permissions.ts # RBAC & feature flag access control hook -│ ├── lib/ # Core utility libraries & clients -│ │ ├── recommendation-engine.ts # Shared TMDB resolution engine, fuzzy matching & caching hooks -│ │ ├── queries.ts # TMDB API query functions -│ │ └── media-transform.ts # TMDB payload transformations +│ ├── lib/ # Core utility libraries, query keys, and TMDB queries │ ├── routes/ # TanStack file-based routes -│ │ ├── index.tsx # Homepage route -│ │ ├── recommendations.lazy.tsx # AI Recommendations management & generation page -│ │ └── search.lazy.tsx # Search & discovery page │ └── types.d.ts # TypeScript declarations & domain types +├── wrangler.toml # Cloudflare Workers & D1 configuration +├── drizzle.config.ts # Drizzle Kit migration generator config +└── drizzle.studio.config.ts # Drizzle Studio dashboard config ``` --- @@ -72,77 +91,139 @@ Pebbly is a modern, full-stack movie and TV show discovery application built wit ### Prerequisites -- Node.js 20+ -- `pnpm` (or `npm`/`yarn`) +- Node.js 22+ +- `pnpm` (v10+) - A TMDB API Read Access Token - A Clerk Application -- A Convex Deployment - A Google Gemini API Key +- A Cloudflare Account (with D1 database enabled) ### Environment Setup -1. Clone the repository: +1. **Clone the repository:** ```bash git clone https://github.com/Swastikdan/Pebbly.git cd Pebbly ``` -2. Install dependencies: +2. **Install dependencies:** ```bash pnpm install ``` -3. Create a `.env.local` file in the project root: +3. **Configure environment variables:** + Create a `.env` or `.env.local` file in the project root: ```env + # TMDB API (read-only public API key — safe for client) VITE_PUBLIC_TMDB_ACCESS_TOKEN=your_tmdb_read_access_token VITE_PUBLIC_TMDB_API_URL=https://api.themoviedb.org/3 - VITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key - CLERK_SECRET_KEY=your_clerk_secret_key - CONVEX_CLERK_ISSUER_URL=https://your-clerk-domain + # Clerk Auth + VITE_CLERK_PUBLISHABLE_KEY=pk_test_YOUR_CLERK_PUBLISHABLE_KEY + CLERK_SECRET_KEY=sk_test_YOUR_CLERK_SECRET_KEY + CLERK_ISSUER_URL=https://your-app.clerk.accounts.dev - VITE_CONVEX_URL=your_convex_url + # App URLs VITE_PUBLIC_APP_URL=http://localhost:3000 VITE_PUBLIC_VIDEO_URL=your_video_provider_base_url + + # AI Providers + GEMINI_API_KEY=your_gemini_key + + # Cloudflare (needed for `pnpm db:studio` dashboard & GitHub Actions) + CLOUDFLARE_API_TOKEN=your_cloudflare_api_token + CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id ``` -4. Set the Gemini API key in your Convex deployment environment variables: +4. **Initialize the local database:** ```bash - npx convex env set GEMINI_API_KEY your_gemini_api_key + pnpm db:migrate:local ``` -### Running Locally +--- + +## Running Locally -- Run frontend & Convex dev server concurrently: +- **Run frontend dev server (Vite + Node SSR):** ```bash pnpm dev ``` -- Run typecheck and Biome validation: +- **Run full Cloudflare Workers + Miniflare D1 emulator locally:** ```bash - pnpm check + pnpm preview:cf ``` -- Build for production: +- **Run TypeScript validation & Biome linting:** ```bash - pnpm build + pnpm typecheck + pnpm lint ``` --- +## Database & Migrations + +- **Generate new SQL migration after editing `src/server/db/schema.ts`:** + ```bash + pnpm db:generate + ``` + +- **Apply migrations to local database (`.wrangler` emulator):** + ```bash + pnpm db:migrate:local + ``` + +- **Apply migrations to remote Cloudflare D1 database (Production):** + ```bash + pnpm db:migrate:prod + ``` + +- **Open Drizzle Studio to view/edit database tables in your browser:** + ```bash + pnpm db:studio + ``` + +--- + +## Deploying to Cloudflare + +Deploying to Cloudflare Workers is automated via GitHub Actions CI/CD whenever you push to the deployment branch, or you can deploy manually: + +```bash +# 1. Apply any pending migrations to production D1 +pnpm db:migrate:prod + +# 2. Build and publish to Cloudflare Workers +pnpm deploy:cf +``` + +--- + ## Available Scripts -- `pnpm dev` — Run Vite frontend and Convex dev server in parallel -- `pnpm dev:vite` — Run frontend dev server only -- `pnpm dev:convex` — Run Convex local dev server only -- `pnpm build` — Type-check and build production bundle -- `pnpm check` — Biome linter check + TypeScript validation -- `pnpm format` — Format code with Biome +| Script | Description | +| :--- | :--- | +| `pnpm dev` | Run Vite development server | +| `pnpm preview:cf` | Build and run full app on local Cloudflare Worker & D1 emulator | +| `pnpm build` | Build production bundle (Nitro Cloudflare preset) | +| `pnpm db:generate` | Generate SQL migrations from `src/server/db/schema.ts` | +| `pnpm db:migrate:local` | Apply migrations to local Miniflare D1 database | +| `pnpm db:migrate:prod` | Apply migrations to Cloudflare production D1 database | +| `pnpm db:studio` | Launch Drizzle Studio database explorer | +| `pnpm deploy:cf` | Build and deploy directly to Cloudflare Workers | +| `pnpm typecheck` | Run TypeScript compiler type-checking | +| `pnpm lint` | Run Biome linter | +| `pnpm format` | Auto-format codebase with Biome | --- ## License & Acknowledgments +- Released under the [MIT License](./LICENSE). - Movie and TV metadata provided by [TMDB](https://www.themoviedb.org/). - AI Recommendations powered by [Google Gemini](https://ai.google.dev/). -- Built with TanStack, Convex, Clerk, and Tailwind CSS. +- Built with TanStack Start, Cloudflare Workers, D1, Drizzle ORM, Valibot, Clerk, and Tailwind CSS. + +Contributions are welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md) and the +[Code of Conduct](./CODE_OF_CONDUCT.md). diff --git a/biome.json b/biome.json index b1b17c19..818c2aee 100644 --- a/biome.json +++ b/biome.json @@ -34,9 +34,7 @@ "a11y": { "noSvgWithoutTitle": "off" }, - "suspicious": { - "noArrayIndexKey": "off" - }, + "suspicious": {}, "nursery": {} } }, @@ -46,20 +44,6 @@ } }, "overrides": [ - { - "includes": [ - "src/hooks/use-watchlist.ts", - "src/hooks/use-watch-progress.ts", - "src/hooks/use-custom-lists.ts" - ], - "linter": { - "rules": { - "suspicious": { - "noExplicitAny": "off" - } - } - } - }, { "includes": ["src/styles.css"], "linter": { diff --git a/convex/_generated/api.d.ts b/convex/_generated/api.d.ts deleted file mode 100644 index ad04ded7..00000000 --- a/convex/_generated/api.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable */ -/** - * Generated `api` utility. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import type * as admin from "../admin.js"; -import type * as ai from "../ai.js"; -import type * as crons from "../crons.js"; -import type * as custom_lists from "../custom_lists.js"; -import type * as episode_progress from "../episode_progress.js"; -import type * as helpers_watch_item from "../helpers/watch_item.js"; -import type * as import_export from "../import_export.js"; -import type * as prompts from "../prompts.js"; -import type * as recommendations from "../recommendations.js"; -import type * as users from "../users.js"; -import type * as watchlist from "../watchlist.js"; - -import type { - ApiFromModules, - FilterApi, - FunctionReference, -} from "convex/server"; - -declare const fullApi: ApiFromModules<{ - admin: typeof admin; - ai: typeof ai; - crons: typeof crons; - custom_lists: typeof custom_lists; - episode_progress: typeof episode_progress; - "helpers/watch_item": typeof helpers_watch_item; - import_export: typeof import_export; - prompts: typeof prompts; - recommendations: typeof recommendations; - users: typeof users; - watchlist: typeof watchlist; -}>; - -/** - * A utility for referencing Convex functions in your app's public API. - * - * Usage: - * ```js - * const myFunctionReference = api.myModule.myFunction; - * ``` - */ -export declare const api: FilterApi< - typeof fullApi, - FunctionReference ->; - -/** - * A utility for referencing Convex functions in your app's internal API. - * - * Usage: - * ```js - * const myFunctionReference = internal.myModule.myFunction; - * ``` - */ -export declare const internal: FilterApi< - typeof fullApi, - FunctionReference ->; - -export declare const components: {}; diff --git a/convex/_generated/api.js b/convex/_generated/api.js deleted file mode 100644 index 44bf9858..00000000 --- a/convex/_generated/api.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable */ -/** - * Generated `api` utility. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import { anyApi, componentsGeneric } from "convex/server"; - -/** - * A utility for referencing Convex functions in your app's API. - * - * Usage: - * ```js - * const myFunctionReference = api.myModule.myFunction; - * ``` - */ -export const api = anyApi; -export const internal = anyApi; -export const components = componentsGeneric(); diff --git a/convex/_generated/dataModel.d.ts b/convex/_generated/dataModel.d.ts deleted file mode 100644 index f97fd194..00000000 --- a/convex/_generated/dataModel.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* eslint-disable */ -/** - * Generated data model types. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import type { - DataModelFromSchemaDefinition, - DocumentByName, - TableNamesInDataModel, - SystemTableNames, -} from "convex/server"; -import type { GenericId } from "convex/values"; -import schema from "../schema.js"; - -/** - * The names of all of your Convex tables. - */ -export type TableNames = TableNamesInDataModel; - -/** - * The type of a document stored in Convex. - * - * @typeParam TableName - A string literal type of the table name (like "users"). - */ -export type Doc = DocumentByName< - DataModel, - TableName ->; - -/** - * An identifier for a document in Convex. - * - * Convex documents are uniquely identified by their `Id`, which is accessible - * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids). - * - * Documents can be loaded using `db.get(tableName, id)` in query and mutation functions. - * - * IDs are just strings at runtime, but this type can be used to distinguish them from other - * strings when type checking. - * - * @typeParam TableName - A string literal type of the table name (like "users"). - */ -export type Id = - GenericId; - -/** - * A type describing your Convex data model. - * - * This type includes information about what tables you have, the type of - * documents stored in those tables, and the indexes defined on them. - * - * This type is used to parameterize methods like `queryGeneric` and - * `mutationGeneric` to make them type-safe. - */ -export type DataModel = DataModelFromSchemaDefinition; diff --git a/convex/_generated/server.d.ts b/convex/_generated/server.d.ts deleted file mode 100644 index bec05e68..00000000 --- a/convex/_generated/server.d.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* eslint-disable */ -/** - * Generated utilities for implementing server-side Convex query and mutation functions. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import { - ActionBuilder, - HttpActionBuilder, - MutationBuilder, - QueryBuilder, - GenericActionCtx, - GenericMutationCtx, - GenericQueryCtx, - GenericDatabaseReader, - GenericDatabaseWriter, -} from "convex/server"; -import type { DataModel } from "./dataModel.js"; - -/** - * Define a query in this Convex app's public API. - * - * This function will be allowed to read your Convex database and will be accessible from the client. - * - * @param func - The query function. It receives a {@link QueryCtx} as its first argument. - * @returns The wrapped query. Include this as an `export` to name it and make it accessible. - */ -export declare const query: QueryBuilder; - -/** - * Define a query that is only accessible from other Convex functions (but not from the client). - * - * This function will be allowed to read from your Convex database. It will not be accessible from the client. - * - * @param func - The query function. It receives a {@link QueryCtx} as its first argument. - * @returns The wrapped query. Include this as an `export` to name it and make it accessible. - */ -export declare const internalQuery: QueryBuilder; - -/** - * Define a mutation in this Convex app's public API. - * - * This function will be allowed to modify your Convex database and will be accessible from the client. - * - * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. - * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. - */ -export declare const mutation: MutationBuilder; - -/** - * Define a mutation that is only accessible from other Convex functions (but not from the client). - * - * This function will be allowed to modify your Convex database. It will not be accessible from the client. - * - * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. - * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. - */ -export declare const internalMutation: MutationBuilder; - -/** - * Define an action in this Convex app's public API. - * - * An action is a function which can execute any JavaScript code, including non-deterministic - * code and code with side-effects, like calling third-party services. - * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive. - * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}. - * - * @param func - The action. It receives an {@link ActionCtx} as its first argument. - * @returns The wrapped action. Include this as an `export` to name it and make it accessible. - */ -export declare const action: ActionBuilder; - -/** - * Define an action that is only accessible from other Convex functions (but not from the client). - * - * @param func - The function. It receives an {@link ActionCtx} as its first argument. - * @returns The wrapped function. Include this as an `export` to name it and make it accessible. - */ -export declare const internalAction: ActionBuilder; - -/** - * Define an HTTP action. - * - * The wrapped function will be used to respond to HTTP requests received - * by a Convex deployment if the requests matches the path and method where - * this action is routed. Be sure to route your httpAction in `convex/http.js`. - * - * @param func - The function. It receives an {@link ActionCtx} as its first argument - * and a Fetch API `Request` object as its second. - * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up. - */ -export declare const httpAction: HttpActionBuilder; - -/** - * A set of services for use within Convex query functions. - * - * The query context is passed as the first argument to any Convex query - * function run on the server. - * - * This differs from the {@link MutationCtx} because all of the services are - * read-only. - */ -export type QueryCtx = GenericQueryCtx; - -/** - * A set of services for use within Convex mutation functions. - * - * The mutation context is passed as the first argument to any Convex mutation - * function run on the server. - */ -export type MutationCtx = GenericMutationCtx; - -/** - * A set of services for use within Convex action functions. - * - * The action context is passed as the first argument to any Convex action - * function run on the server. - */ -export type ActionCtx = GenericActionCtx; - -/** - * An interface to read from the database within Convex query functions. - * - * The two entry points are {@link DatabaseReader.get}, which fetches a single - * document by its {@link Id}, or {@link DatabaseReader.query}, which starts - * building a query. - */ -export type DatabaseReader = GenericDatabaseReader; - -/** - * An interface to read from and write to the database within Convex mutation - * functions. - * - * Convex guarantees that all writes within a single mutation are - * executed atomically, so you never have to worry about partial writes leaving - * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control) - * for the guarantees Convex provides your functions. - */ -export type DatabaseWriter = GenericDatabaseWriter; diff --git a/convex/_generated/server.js b/convex/_generated/server.js deleted file mode 100644 index bf3d25ad..00000000 --- a/convex/_generated/server.js +++ /dev/null @@ -1,93 +0,0 @@ -/* eslint-disable */ -/** - * Generated utilities for implementing server-side Convex query and mutation functions. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import { - actionGeneric, - httpActionGeneric, - queryGeneric, - mutationGeneric, - internalActionGeneric, - internalMutationGeneric, - internalQueryGeneric, -} from "convex/server"; - -/** - * Define a query in this Convex app's public API. - * - * This function will be allowed to read your Convex database and will be accessible from the client. - * - * @param func - The query function. It receives a {@link QueryCtx} as its first argument. - * @returns The wrapped query. Include this as an `export` to name it and make it accessible. - */ -export const query = queryGeneric; - -/** - * Define a query that is only accessible from other Convex functions (but not from the client). - * - * This function will be allowed to read from your Convex database. It will not be accessible from the client. - * - * @param func - The query function. It receives a {@link QueryCtx} as its first argument. - * @returns The wrapped query. Include this as an `export` to name it and make it accessible. - */ -export const internalQuery = internalQueryGeneric; - -/** - * Define a mutation in this Convex app's public API. - * - * This function will be allowed to modify your Convex database and will be accessible from the client. - * - * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. - * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. - */ -export const mutation = mutationGeneric; - -/** - * Define a mutation that is only accessible from other Convex functions (but not from the client). - * - * This function will be allowed to modify your Convex database. It will not be accessible from the client. - * - * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. - * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. - */ -export const internalMutation = internalMutationGeneric; - -/** - * Define an action in this Convex app's public API. - * - * An action is a function which can execute any JavaScript code, including non-deterministic - * code and code with side-effects, like calling third-party services. - * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive. - * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}. - * - * @param func - The action. It receives an {@link ActionCtx} as its first argument. - * @returns The wrapped action. Include this as an `export` to name it and make it accessible. - */ -export const action = actionGeneric; - -/** - * Define an action that is only accessible from other Convex functions (but not from the client). - * - * @param func - The function. It receives an {@link ActionCtx} as its first argument. - * @returns The wrapped function. Include this as an `export` to name it and make it accessible. - */ -export const internalAction = internalActionGeneric; - -/** - * Define an HTTP action. - * - * The wrapped function will be used to respond to HTTP requests received - * by a Convex deployment if the requests matches the path and method where - * this action is routed. Be sure to route your httpAction in `convex/http.js`. - * - * @param func - The function. It receives an {@link ActionCtx} as its first argument - * and a Fetch API `Request` object as its second. - * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up. - */ -export const httpAction = httpActionGeneric; diff --git a/convex/admin.ts b/convex/admin.ts deleted file mode 100644 index 60ac2857..00000000 --- a/convex/admin.ts +++ /dev/null @@ -1,405 +0,0 @@ -import { - mutation, - query, - type MutationCtx, - type QueryCtx, -} from "./_generated/server"; -import { v } from "convex/values"; - -const DYNAMIC_ROLES = ["video-player", "ai-integrations"] as const; -const VALID_FEATURES = ["video-player", "ai-recommendations"] as const; - -export type DynamicRbacRole = (typeof DYNAMIC_ROLES)[number]; -export type RbacFeature = (typeof VALID_FEATURES)[number]; - -const ADMIN_PERMISSIONS: Record = { - "video-player": true, - "ai-recommendations": true, -}; - -const DEFAULT_PERMISSIONS: Record< - DynamicRbacRole, - Record -> = { - "video-player": { - "video-player": true, - "ai-recommendations": false, - }, - "ai-integrations": { - "video-player": false, - "ai-recommendations": true, - }, -}; - -const ROLE_FEATURES: Record = { - "video-player": "video-player", - "ai-integrations": "ai-recommendations", -}; - -function isValidRoleFeaturePair(role: string, feature: string): boolean { - return ROLE_FEATURES[role as DynamicRbacRole] === feature; -} - -async function getUserByToken( - ctx: QueryCtx | MutationCtx, - tokenIdentifier: string, -) { - return ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", tokenIdentifier)) - .first(); -} - -function parseClerkPublicMeta( - identity: Record | null, -): Record | null { - if (!identity) return null; - - const candidates = [identity.public_meta, identity.publicMetadata, identity]; - - for (const candidate of candidates) { - if (!candidate) continue; - - if (typeof candidate === "string") { - try { - const parsed = JSON.parse(candidate) as unknown; - if (parsed && typeof parsed === "object") { - return parsed as Record; - } - } catch { - // Ignore malformed metadata claim payloads. - } - continue; - } - - if (typeof candidate === "object") { - return candidate as Record; - } - } - - return null; -} - -function isClerkAdmin( - identity: Record | null, - dbUser?: { isAdmin?: boolean } | null, -): boolean { - if (parseClerkPublicMeta(identity)?.isAdmin === true) return true; - if (dbUser?.isAdmin === true) return true; - return false; -} - -async function requireAdmin(ctx: MutationCtx) { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) throw new Error("Unauthorized"); - - const user = await getUserByToken(ctx, identity.subject); - if (!user) throw new Error("Unauthorized"); - if (!isClerkAdmin(identity, user)) { - throw new Error("Forbidden: admin access required"); - } - - return { identity, user }; -} - -async function computeRoleFeatures( - ctx: QueryCtx | MutationCtx, - roles: string[], -): Promise> { - const features: Record = {}; - - const allPermissions = await ctx.db - .query("role_permissions") - .take(100); - - const permissionMap = new Map(); - for (const p of allPermissions) { - permissionMap.set(`${p.role}:${p.feature}`, p.enabled); - } - - for (const feature of VALID_FEATURES) { - const globalEnabled = permissionMap.get(`global:${feature}`); - const isGloballyEnabled = globalEnabled !== undefined ? globalEnabled : true; - - let enabled = false; - if (isGloballyEnabled) { - for (const role of roles) { - if (!DYNAMIC_ROLES.includes(role as DynamicRbacRole)) continue; - - const existingEnabled = permissionMap.get(`${role}:${feature}`); - if (existingEnabled !== undefined) { - if (existingEnabled) enabled = true; - } else if ( - DEFAULT_PERMISSIONS[role as DynamicRbacRole]?.[feature] === true - ) { - enabled = true; - } - } - } - features[feature] = enabled; - } - - return features; -} - -export async function hasFeature( - ctx: QueryCtx | MutationCtx, - feature: RbacFeature, -): Promise { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) return false; - - const user = await getUserByToken(ctx, identity.subject); - if (user?.isBanned === true) return false; - if (isClerkAdmin(identity, user)) return true; - if (!user) return false; - - const globalSetting = await ctx.db - .query("role_permissions") - .withIndex("by_role_feature", (q) => - q.eq("role", "global").eq("feature", feature), - ) - .first(); - - const isGloballyEnabled = globalSetting ? globalSetting.enabled : true; - if (!isGloballyEnabled) return false; - - for (const role of user.roles ?? []) { - if (!DYNAMIC_ROLES.includes(role as DynamicRbacRole)) continue; - - const existing = await ctx.db - .query("role_permissions") - .withIndex("by_role_feature", (q) => - q.eq("role", role).eq("feature", feature), - ) - .first(); - - if (existing?.enabled === true) return true; - if (!existing && DEFAULT_PERMISSIONS[role as DynamicRbacRole]?.[feature]) { - return true; - } - } - - return false; -} - -export async function syncRolePermissions(ctx: MutationCtx, force = false) { - const existingPermissions = await ctx.db.query("role_permissions").take(100); - - if (!force && existingPermissions.length > 0) { - return; - } - - for (const permission of existingPermissions) { - const isValidRole = - DYNAMIC_ROLES.includes(permission.role as DynamicRbacRole) || - permission.role === "global"; - const isValidFeature = VALID_FEATURES.includes( - permission.feature as RbacFeature, - ); - - if ( - !isValidRole || - !isValidFeature || - (permission.role !== "global" && - !isValidRoleFeaturePair(permission.role, permission.feature)) - ) { - await ctx.db.delete(permission._id); - } - } - - for (const role of DYNAMIC_ROLES) { - const feature = ROLE_FEATURES[role]; - const existing = existingPermissions.find( - (permission) => - permission.role === role && permission.feature === feature, - ); - - if (!existing) { - await ctx.db.insert("role_permissions", { - role, - feature, - enabled: DEFAULT_PERMISSIONS[role][feature], - }); - } - } -} - -export const getUserFeatures = query({ - args: {}, - handler: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) return { roles: [] as string[], features: {}, isAdmin: false, isBanned: false }; - - const user = await getUserByToken(ctx, identity.subject); - if (user?.isBanned === true) { - return { - roles: [] as string[], - features: {}, - isAdmin: false, - isBanned: true, - }; - } - if (isClerkAdmin(identity, user)) { - return { - roles: [] as string[], - features: { ...ADMIN_PERMISSIONS }, - isAdmin: true, - isBanned: false, - }; - } - - if (!user) return { roles: [] as string[], features: {}, isAdmin: false, isBanned: false }; - - const roles = (user.roles ?? []).filter((role) => - DYNAMIC_ROLES.includes(role as DynamicRbacRole), - ); - const features = await computeRoleFeatures(ctx, roles); - - return { - roles, - features, - isAdmin: false, - isBanned: false, - }; - }, -}); - -export const getRolePermissions = query({ - args: {}, - handler: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) throw new Error("Unauthorized"); - - const caller = await getUserByToken(ctx, identity.subject); - if (!caller || !isClerkAdmin(identity, caller)) { - throw new Error("Forbidden: admin access required"); - } - - const perms = await ctx.db.query("role_permissions").take(100); - - const result: Record> = {}; - for (const role of DYNAMIC_ROLES) { - result[role] = {}; - const feature = ROLE_FEATURES[role]; - const perm = perms.find((p) => p.role === "global" && p.feature === feature); - result[role][feature] = perm ? perm.enabled : true; - } - - return result; - }, -}); - -export const setRolePermission = mutation({ - args: { - role: v.string(), - feature: v.string(), - enabled: v.boolean(), - }, - handler: async (ctx, args) => { - await requireAdmin(ctx); - - if (!VALID_FEATURES.includes(args.feature as RbacFeature)) { - throw new Error("Invalid feature"); - } - - await syncRolePermissions(ctx, true); - - const existing = await ctx.db - .query("role_permissions") - .withIndex("by_role_feature", (q) => - q.eq("role", "global").eq("feature", args.feature), - ) - .first(); - - if (existing) { - await ctx.db.patch(existing._id, { enabled: args.enabled }); - } else { - await ctx.db.insert("role_permissions", { - role: "global", - feature: args.feature, - enabled: args.enabled, - }); - } - }, -}); - -export const setUserRoles = mutation({ - args: { - tokenIdentifier: v.string(), - roles: v.array( - v.union(v.literal("video-player"), v.literal("ai-integrations")), - ), - }, - handler: async (ctx, args) => { - await requireAdmin(ctx); - - const target = await ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", args.tokenIdentifier)) - .first(); - - if (!target) throw new Error("User not found"); - - await ctx.db.patch(target._id, { - roles: args.roles.length > 0 ? args.roles : undefined, - }); - }, -}); - -export const setUserBanned = mutation({ - args: { - tokenIdentifier: v.string(), - banned: v.boolean(), - }, - handler: async (ctx, args) => { - await requireAdmin(ctx); - - const target = await ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", args.tokenIdentifier)) - .first(); - - if (!target) throw new Error("User not found"); - - const identity = await ctx.auth.getUserIdentity(); - if (identity && identity.subject === target.tokenIdentifier) { - throw new Error("Cannot ban yourself"); - } - - await ctx.db.patch(target._id, { - isBanned: args.banned, - }); - }, -}); - -export const listUsers = query({ - args: { - limit: v.optional(v.number()), - }, - handler: async (ctx, args) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) throw new Error("Unauthorized"); - - const caller = await getUserByToken(ctx, identity.subject); - if (!caller || !isClerkAdmin(identity, caller)) { - throw new Error("Forbidden: admin access required"); - } - - // Bound the query to prevent document read limit exceptions as user base grows. - const users = await ctx.db.query("users").take(args.limit ?? 200); - - return users.map((u) => ({ - _id: u._id, - tokenIdentifier: u.tokenIdentifier, - name: u.name ?? "Anonymous", - email: u.email ?? "No email", - image: u.image, - roles: (u.roles ?? []).filter((role) => - DYNAMIC_ROLES.includes(role as DynamicRbacRole), - ), - isBanned: u.isBanned ?? false, - isAdmin: isClerkAdmin(null, u), - })); - }, -}); diff --git a/convex/ai.ts b/convex/ai.ts deleted file mode 100644 index c8f45d5b..00000000 --- a/convex/ai.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { GoogleGenAI } from "@google/genai"; - -export interface Recommendation { - title: string; - tmdbId: number | null; - mediaType: "movie" | "tv"; - relevanceScore: number; - reasoning: string; -} - -export interface GeminiResult { - recommendations: Recommendation[]; -} - -export const MODELS_TO_TRY = [ - "gemini-3.1-flash-lite-preview", - "gemini-2.5-flash", - "gemini-2.0-flash", - "gemini-1.5-flash", -]; - -type GeminiErrorLike = { - status?: number; - message?: string; -}; - -export function getErrorMessage(error: unknown) { - return error instanceof Error ? error.message : String(error); -} - -export function isHighDemandError(error: unknown) { - const candidate = error as GeminiErrorLike; - const message = candidate.message?.toLowerCase() ?? ""; - - return ( - candidate.status === 503 || - message.includes("high demand") || - message.includes("503") - ); -} - -export async function delay(ms: number) { - await new Promise((resolve) => setTimeout(resolve, ms)); -} - -export async function generateRecommendationResponse( - ai: GoogleGenAI, - userPrompt: string, - systemInstruction: string, -) { - let highDemandError = false; - - for (const [index, model] of MODELS_TO_TRY.entries()) { - try { - const response = await ai.models.generateContent({ - model, - contents: userPrompt, - config: { - responseMimeType: "application/json", - systemInstruction, - }, - }); - - const responseText = response.text ?? ""; - if (responseText) { - return { responseText, usedModel: model, highDemandError }; - } - } catch (error) { - console.error(`Gemini model (${model}) error:`, getErrorMessage(error)); - highDemandError = highDemandError || isHighDemandError(error); - - if (index < MODELS_TO_TRY.length - 1) { - await delay(1000); - } - } - } - - return { responseText: "", usedModel: MODELS_TO_TRY[0], highDemandError }; -} - -export async function callGeminiAI( - prompt: string, - systemInstruction: string, - retries: number = 1 -): Promise<{ result?: GeminiResult; usedModel?: string; error?: string }> { - const apiKey = process.env.GEMINI_API_KEY; - if (!apiKey) { - console.error("GEMINI_API_KEY is not set in Convex environment variables"); - return { error: "api_unavailable" }; - } - - const ai = new GoogleGenAI({ apiKey }); - let responseText = ""; - let usedModel = MODELS_TO_TRY[0]; - let highDemandError = false; - let lastError = ""; - let success = false; - - for (let attempt = 1; attempt <= retries; attempt++) { - try { - const result = await generateRecommendationResponse(ai, prompt, systemInstruction); - if (result.responseText) { - responseText = result.responseText; - usedModel = result.usedModel; - highDemandError = result.highDemandError; - success = true; - break; - } else { - highDemandError = highDemandError || result.highDemandError; - } - } catch (error) { - lastError = getErrorMessage(error); - if (attempt < retries) { - await delay(1000); - } - } - } - - if (!success || !responseText) { - return { error: highDemandError ? "high_demand" : (lastError || "api_unavailable") }; - } - - try { - const parsed = JSON.parse(responseText); - if (!parsed || !Array.isArray(parsed.recommendations)) { - return { error: "invalid_response" }; - } - return { result: parsed, usedModel }; - } catch { - return { error: "invalid_response" }; - } -} diff --git a/convex/auth.config.ts b/convex/auth.config.ts deleted file mode 100644 index 17e6d016..00000000 --- a/convex/auth.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default { - providers: [ - { - domain: process.env.CONVEX_CLERK_ISSUER_URL, - applicationID: "convex", - }, - ], -}; diff --git a/convex/crons.ts b/convex/crons.ts deleted file mode 100644 index c9041e72..00000000 --- a/convex/crons.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { cronJobs } from "convex/server"; -import { internal } from "./_generated/api"; - -const crons = cronJobs(); - -// Snapshots record watchlist media state (TMDB IDs & media types) and only a new state is retained. -crons.daily( - "watchlist media snapshot", - { hourUTC: 3, minuteUTC: 0 }, - internal.watchlist.createDailySnapshots, - {}, -); - -export default crons; diff --git a/convex/custom_lists.ts b/convex/custom_lists.ts deleted file mode 100644 index 7ced4595..00000000 --- a/convex/custom_lists.ts +++ /dev/null @@ -1,326 +0,0 @@ -import { mutation, query, type MutationCtx } from "./_generated/server"; -import { v } from "convex/values"; -import type { Id } from "./_generated/dataModel"; -import { - requireCurrentUser, - getCurrentUser, - type WatchlistUser, - MEDIA_TYPE_VALIDATOR, -} from "./helpers/watch_item"; - -export const getCustomLists = query({ - args: {}, - handler: async (ctx) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - const lists = await ctx.db - .query("lists") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .collect(); - - const allUserListItems = await ctx.db - .query("list_items") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .collect(); - - const itemsByList = new Map(); - for (const item of allUserListItems) { - const listIdStr = item.listId; - const existing = itemsByList.get(listIdStr); - if (existing) { - existing.push(item); - } else { - itemsByList.set(listIdStr, [item]); - } - } - - const listsWithPreviews = lists.map((list) => { - const items = itemsByList.get(list._id) ?? []; - const previews = items - .map((item) => item.backdrop ?? item.image) - .filter((img): img is string => !!img) - .slice(0, 4); - - return { - ...list, - previews, - itemCount: items.length, - }; - }); - - return listsWithPreviews; - }, -}); - -export async function createCustomListInner( - ctx: MutationCtx, - userId: WatchlistUser["_id"], - args: { name: string; color?: string; visibility?: string; listType?: string } -) { - const existing = await ctx.db - .query("lists") - .withIndex("by_user_name", (q) => q.eq("userId", userId).eq("name", args.name)) - .first(); - if (existing) throw new Error("A list with this name already exists"); - - const highestList = await ctx.db - .query("lists") - .withIndex("by_user_sort", (q) => q.eq("userId", userId)) - .order("desc") - .first(); - const maxSort = highestList ? highestList.sortOrder : 0; - - const now = Date.now(); - return ctx.db.insert("lists", { - userId, - name: args.name, - color: args.color, - visibility: args.visibility, - listType: args.listType, - sortOrder: maxSort + 1, - createdAt: now, - updatedAt: now, - }); -} - -export const createCustomList = mutation({ - args: { - name: v.string(), - color: v.optional(v.string()), - visibility: v.optional(v.string()), - listType: v.optional(v.string()), - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - return createCustomListInner(ctx, user._id, args); - }, -}); - -export const updateCustomList = mutation({ - args: { - listId: v.id("lists"), - name: v.optional(v.string()), - color: v.optional(v.string()), - visibility: v.optional(v.string()), - listType: v.optional(v.string()), - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - - const list = await ctx.db.get(args.listId); - if (!list || list.userId !== user._id) throw new Error("List not found"); - - if (args.name !== undefined && args.name !== list.name) { - const nameToCheck = args.name; - const dup = await ctx.db - .query("lists") - .withIndex("by_user_name", (q) => q.eq("userId", user._id).eq("name", nameToCheck)) - .first(); - if (dup) throw new Error("A list with this name already exists"); - } - - await ctx.db.patch(args.listId, { - ...(args.name !== undefined ? { name: args.name } : {}), - ...(args.color !== undefined ? { color: args.color } : {}), - ...(args.visibility !== undefined ? { visibility: args.visibility } : {}), - ...(args.listType !== undefined ? { listType: args.listType } : {}), - updatedAt: Date.now(), - }); - }, -}); - -export const deleteCustomList = mutation({ - args: { listId: v.id("lists") }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - - const list = await ctx.db.get(args.listId); - if (!list || list.userId !== user._id) throw new Error("List not found"); - - while (true) { - const items = await ctx.db - .query("list_items") - .withIndex("by_list", (q) => q.eq("listId", args.listId)) - .take(200); - if (items.length === 0) break; - for (const item of items) { - await ctx.db.delete(item._id); - } - } - - await ctx.db.delete(args.listId); - }, -}); - -export const getListItems = query({ - args: { listId: v.id("lists") }, - handler: async (ctx, args) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - const list = await ctx.db.get(args.listId); - if (!list || list.userId !== user._id) return []; - - const items = await ctx.db - .query("list_items") - .withIndex("by_list", (q) => q.eq("listId", args.listId)) - .collect(); - - const watchItemPromises = items.map((item) => - ctx.db - .query("watch_items") - .withIndex("by_user_media", (q) => - q.eq("userId", user._id).eq("tmdbId", item.tmdbId).eq("mediaType", item.mediaType), - ) - .first(), - ); - const watchItems = await Promise.all(watchItemPromises); - - const watchItemMap = new Map(); - for (const w of watchItems) { - if (w) { - watchItemMap.set(`${w.tmdbId}_${w.mediaType}`, w); - } - } - - const enriched = items.map((item) => { - const watchItem = watchItemMap.get(`${item.tmdbId}_${item.mediaType}`); - - return { - ...item, - title: item.title ?? watchItem?.title, - image: item.image ?? watchItem?.image, - rating: item.rating ?? watchItem?.rating, - release_date: item.release_date ?? watchItem?.release_date, - overview: item.overview ?? watchItem?.overview, - progressStatus: watchItem?.progressStatus, - reaction: watchItem?.reaction, - }; - }); - - return enriched; - }, -}); - -export const getItemLists = query({ - args: { tmdbId: v.number(), mediaType: MEDIA_TYPE_VALIDATOR }, - handler: async (ctx, args) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - const items = await ctx.db - .query("list_items") - .withIndex("by_user_media", (q) => - q.eq("userId", user._id).eq("tmdbId", args.tmdbId).eq("mediaType", args.mediaType), - ) - .collect(); - - return items.map((i) => i.listId); - }, -}); - -export async function toggleListItemInner( - ctx: MutationCtx, - userId: WatchlistUser["_id"], - args: { - listId: Id<"lists">; - tmdbId: number; - mediaType: string; - title?: string; - image?: string; - backdrop?: string; - rating?: number; - release_date?: string; - overview?: string; - } -) { - const list = await ctx.db.get(args.listId); - if (!list || list.userId !== userId) throw new Error("List not found"); - - const existing = await ctx.db - .query("list_items") - .withIndex("by_list_media", (q) => - q.eq("listId", args.listId).eq("tmdbId", args.tmdbId).eq("mediaType", args.mediaType), - ) - .first(); - - if (existing) { - await ctx.db.delete(existing._id); - return false; - } - - await ctx.db.insert("list_items", { - userId, - listId: args.listId, - tmdbId: args.tmdbId, - mediaType: args.mediaType, - addedAt: Date.now(), - title: args.title, - image: args.image, - backdrop: args.backdrop, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - }); - return true; -} - -export const toggleListItem = mutation({ - args: { - listId: v.id("lists"), - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - title: v.optional(v.string()), - image: v.optional(v.string()), - backdrop: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - return toggleListItemInner(ctx, user._id, args); - }, -}); - -export const createCustomListAndAddItem = mutation({ - args: { - name: v.string(), - color: v.optional(v.string()), - visibility: v.optional(v.string()), - listType: v.optional(v.string()), - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - title: v.optional(v.string()), - image: v.optional(v.string()), - backdrop: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - - const listId = await createCustomListInner(ctx, user._id, { - name: args.name, - color: args.color, - visibility: args.visibility, - listType: args.listType, - }); - - await toggleListItemInner(ctx, user._id, { - listId, - tmdbId: args.tmdbId, - mediaType: args.mediaType, - title: args.title, - image: args.image, - backdrop: args.backdrop, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - }); - - return listId; - }, -}); diff --git a/convex/episode_progress.ts b/convex/episode_progress.ts deleted file mode 100644 index 0aa0d11f..00000000 --- a/convex/episode_progress.ts +++ /dev/null @@ -1,247 +0,0 @@ -import { mutation, query, type MutationCtx } from "./_generated/server"; -import { v } from "convex/values"; -import { - requireCurrentUser, - getCurrentUser, - type WatchlistContext, - type WatchlistUser, - getWatchItem, - buildMetadataPatch, - MEDIA_TYPE_VALIDATOR, - PROGRESS_STATUS_VALIDATOR, -} from "./helpers/watch_item"; - -export async function getEpisodeProgressEntry( - ctx: WatchlistContext, - userId: WatchlistUser["_id"], - tmdbId: number, - season: number, - episode: number, -) { - return ctx.db - .query("episode_progress") - .withIndex("by_user_episode", (q) => - q - .eq("userId", userId) - .eq("tmdbId", tmdbId) - .eq("season", season) - .eq("episode", episode), - ) - .first(); -} - -export async function getEpisodeProgressForShow( - ctx: WatchlistContext, - userId: WatchlistUser["_id"], - tmdbId: number, -) { - return ctx.db - .query("episode_progress") - .withIndex("by_user_media", (q) => q.eq("userId", userId).eq("tmdbId", tmdbId)) - .collect(); -} - -export async function syncEpisodeProgressRecord( - ctx: MutationCtx, - userId: WatchlistUser["_id"], - args: { - tmdbId: number; - season: number; - episode: number; - isWatched: boolean; - }, - now: number, -) { - const existing = await getEpisodeProgressEntry( - ctx, - userId, - args.tmdbId, - args.season, - args.episode, - ); - - if (existing) { - if (existing.isWatched !== args.isWatched) { - await ctx.db.patch(existing._id, { - isWatched: args.isWatched, - updatedAt: now, - }); - } - return; - } - - if (!args.isWatched) { - return; - } - - await ctx.db.insert("episode_progress", { - userId, - tmdbId: args.tmdbId, - season: args.season, - episode: args.episode, - isWatched: args.isWatched, - updatedAt: now, - }); -} - -export const markEpisodeWatched = mutation({ - args: { - tmdbId: v.number(), - season: v.number(), - episode: v.number(), - isWatched: v.boolean(), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - await syncEpisodeProgressRecord(ctx, user._id, args, Date.now()); - }, -}); - -export const getAllWatchedEpisodes = query({ - args: { - tmdbId: v.number(), - }, - - handler: async (ctx, args) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - return ctx.db - .query("episode_progress") - .withIndex("by_user_media", (q) => q.eq("userId", user._id).eq("tmdbId", args.tmdbId)) - .collect(); - }, -}); - -export const markShowEpisodesWatched = mutation({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - seasons: v.array( - v.object({ - season: v.number(), - episodes: v.array(v.number()), - }), - ), - isWatched: v.boolean(), - clearAllEpisodes: v.optional(v.boolean()), - progressStatus: v.optional(PROGRESS_STATUS_VALIDATOR), - progress: v.optional(v.number()), - title: v.optional(v.string()), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - const now = Date.now(); - - if (args.progressStatus !== undefined) { - const existing = await getWatchItem(ctx, user._id, args); - - if (existing) { - await ctx.db.patch(existing._id, { - inWatchlist: true, - progressStatus: args.progressStatus, - progress: args.progress ?? existing.progress, - updatedAt: now, - ...buildMetadataPatch(args, existing), - }); - } else { - await ctx.db.insert("watch_items", { - userId: user._id, - tmdbId: args.tmdbId, - mediaType: args.mediaType, - inWatchlist: true, - progressStatus: args.progressStatus, - progress: args.progress ?? 0, - updatedAt: now, - ...buildMetadataPatch(args), - }); - } - } - - const allExisting = await getEpisodeProgressForShow(ctx, user._id, args.tmdbId); - - if (args.clearAllEpisodes || (!args.isWatched && args.seasons.length > 0)) { - for (const ep of allExisting) { - if (ep.isWatched) { - await syncEpisodeProgressRecord( - ctx, - user._id, - { tmdbId: args.tmdbId, season: ep.season, episode: ep.episode, isWatched: false }, - now - ); - } - } - } else { - for (const seasonData of args.seasons) { - const uniqueEpisodes = Array.from(new Set(seasonData.episodes)); - for (const epNum of uniqueEpisodes) { - await syncEpisodeProgressRecord( - ctx, - user._id, - { tmdbId: args.tmdbId, season: seasonData.season, episode: epNum, isWatched: args.isWatched }, - now - ); - } - } - } - }, -}); - -// Alias for backwards compatibility -export const markShowEpisodesAndStatus = markShowEpisodesWatched; - -export const markSeasonEpisodesWatched = mutation({ - args: { - tmdbId: v.number(), - season: v.number(), - episodes: v.array(v.number()), - isWatched: v.boolean(), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - const now = Date.now(); - - const uniqueEpisodes = Array.from(new Set(args.episodes)); - for (const epNum of uniqueEpisodes) { - await syncEpisodeProgressRecord( - ctx, - user._id, - { tmdbId: args.tmdbId, season: args.season, episode: epNum, isWatched: args.isWatched }, - now - ); - } - }, -}); - -export const getAllEpisodeProgress = query({ - args: {}, - handler: async (ctx) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - return ctx.db - .query("episode_progress") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .collect(); - }, -}); - -export const syncEpisodeProgressItem = mutation({ - args: { - tmdbId: v.number(), - season: v.number(), - episode: v.number(), - isWatched: v.boolean(), - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - await syncEpisodeProgressRecord(ctx, user._id, args, Date.now()); - }, -}); diff --git a/convex/helpers/watch_item.ts b/convex/helpers/watch_item.ts deleted file mode 100644 index d9c16ad7..00000000 --- a/convex/helpers/watch_item.ts +++ /dev/null @@ -1,251 +0,0 @@ -import { type MutationCtx, type QueryCtx } from "../_generated/server"; -import type { Doc } from "../_generated/dataModel"; -import { v } from "convex/values"; - -export type WatchlistContext = QueryCtx | MutationCtx; -export type WatchlistUser = Doc<"users">; -export type WatchItem = Doc<"watch_items">; -export type EpisodeProgress = Doc<"episode_progress">; - -export type MediaType = "movie" | "tv"; - -export const MEDIA_TYPE_VALIDATOR = v.union(v.literal("movie"), v.literal("tv")); - -export type MediaIdentity = { - tmdbId: number; - mediaType: MediaType; -}; - -export type WatchItemMetadata = { - title?: string; - image?: string; - rating?: number; - release_date?: string; - overview?: string; -}; - -const VALID_PROGRESS_STATUSES: ReadonlySet = new Set([ - "watch-later", - "watching", - "done", - "dropped", -]); - -export const PROGRESS_STATUS_VALIDATOR = v.union( - v.literal("watch-later"), - v.literal("watching"), - v.literal("done"), - v.literal("dropped"), -); - -export const REACTION_VALIDATOR = v.union( - v.literal("loved"), - v.literal("liked"), - v.literal("mixed"), - v.literal("not-for-me"), - v.literal("recommended"), -); - -export const REACTION_OR_NULL_VALIDATOR = v.union(REACTION_VALIDATOR, v.null()); - -export function normalizeProgressStatus(status?: string): string | undefined { - if (!status) return undefined; - return VALID_PROGRESS_STATUSES.has(status) ? status : undefined; -} - -export async function getCurrentUser(ctx: WatchlistContext) { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) return null; - - const subject = identity.subject; - const tokenIdentifier = identity.tokenIdentifier; - - // 1. Fast path: check exact tokenIdentifier or subject index - if (tokenIdentifier) { - const user = await ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", tokenIdentifier)) - .first(); - if (user) return user; - } - - if (subject && subject !== tokenIdentifier) { - const user = await ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", subject)) - .first(); - if (user) return user; - } - - if (subject) { - const user = await ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", `clerk|${subject}`)) - .first(); - if (user) return user; - } - - // 2. Fallback search across all users to handle multi-format matching - const allUsers = await ctx.db.query("users").take(500); - const userMatches = allUsers.filter( - (u) => - u.tokenIdentifier === tokenIdentifier || - u.tokenIdentifier === subject || - u.tokenIdentifier === `clerk|${subject}` || - (subject && u.tokenIdentifier.endsWith(`|${subject}`)) || - (subject && u.tokenIdentifier.endsWith(subject)), - ); - - if (userMatches.length === 0) return null; - if (userMatches.length === 1) return userMatches[0]; - - // If multiple user docs exist, prefer the one that already has watch items - for (const candidate of userMatches) { - const hasItems = await ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", candidate._id)) - .first(); - if (hasItems) return candidate; - } - - return ( - userMatches.find((u) => u.tokenIdentifier === tokenIdentifier) ?? - userMatches[0] - ); -} - -export async function requireCurrentUser(ctx: WatchlistContext): Promise { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) { - throw new Error("Unauthorized"); - } - - let user = await getCurrentUser(ctx); - if (!user) { - if ("insert" in ctx.db || typeof (ctx.db as any).insert === "function") { - const meta = - (identity.public_meta as Record | undefined) ?? - (identity.publicMetadata as Record | undefined); - const isAdmin = meta && typeof meta === "object" && "isAdmin" in meta ? meta.isAdmin === true : false; - - const primaryToken = identity.tokenIdentifier ?? identity.subject; - const userId = await (ctx as MutationCtx).db.insert("users", { - tokenIdentifier: primaryToken, - name: identity.name ?? identity.nickname ?? "Anonymous", - email: identity.email, - image: identity.pictureUrl, - isAdmin, - }); - user = (await ctx.db.get(userId))!; - } else { - throw new Error("Unauthorized"); - } - } - - // Auto-consolidate orphaned watch items from duplicate user documents if any exist - if ("patch" in ctx.db || typeof (ctx.db as any).patch === "function") { - const subject = identity.subject; - const tokenIdentifier = identity.tokenIdentifier; - const allUsers = await ctx.db.query("users").take(500); - const userMatches = allUsers.filter( - (u) => - u.tokenIdentifier === tokenIdentifier || - u.tokenIdentifier === subject || - u.tokenIdentifier === `clerk|${subject}` || - (subject && u.tokenIdentifier.endsWith(`|${subject}`)) || - (subject && u.tokenIdentifier.endsWith(subject)), - ); - - if (userMatches.length > 1) { - for (const dup of userMatches) { - if (dup._id === user._id) continue; - const dupItems = await ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", dup._id)) - .take(500); - for (const item of dupItems) { - const existingInMain = await ctx.db - .query("watch_items") - .withIndex("by_user_media", (q) => - q - .eq("userId", user._id) - .eq("tmdbId", item.tmdbId) - .eq("mediaType", item.mediaType), - ) - .first(); - if (!existingInMain) { - await (ctx as MutationCtx).db.patch(item._id, { userId: user._id }); - } - } - } - } - } - - return user; -} - -export async function getWatchItem( - ctx: WatchlistContext, - userId: WatchlistUser["_id"], - media: MediaIdentity, -) { - return ctx.db - .query("watch_items") - .withIndex("by_user_media", (q) => - q - .eq("userId", userId) - .eq("tmdbId", media.tmdbId) - .eq("mediaType", media.mediaType), - ) - .first(); -} - -export function buildMetadataPatch( - metadata: WatchItemMetadata, - existing?: WatchItem, -): WatchItemMetadata { - return { - title: metadata.title ?? existing?.title, - image: metadata.image ?? existing?.image, - rating: metadata.rating ?? existing?.rating, - release_date: metadata.release_date ?? existing?.release_date, - overview: metadata.overview ?? existing?.overview, - }; -} - -export async function upsertWatchItem( - ctx: MutationCtx, - userId: WatchlistUser["_id"], - tmdbId: number, - mediaType: MediaType, - updates: Partial | ((existing: WatchItem | null) => Partial | null) -) { - const existing = await getWatchItem(ctx, userId, { tmdbId, mediaType }); - const finalUpdates = typeof updates === "function" ? updates(existing) : updates; - if (!finalUpdates) return; - - const now = Date.now(); - const metadataPatch = buildMetadataPatch(finalUpdates, existing ?? undefined); - - if (existing) { - const patch: any = { updatedAt: now, ...metadataPatch }; - if ("inWatchlist" in finalUpdates) patch.inWatchlist = finalUpdates.inWatchlist; - if ("progressStatus" in finalUpdates) patch.progressStatus = finalUpdates.progressStatus; - if ("progress" in finalUpdates) patch.progress = finalUpdates.progress; - if ("reaction" in finalUpdates) patch.reaction = finalUpdates.reaction; - - await ctx.db.patch(existing._id, patch); - } else { - await ctx.db.insert("watch_items", { - userId, - tmdbId, - mediaType, - inWatchlist: finalUpdates.inWatchlist ?? false, - progressStatus: finalUpdates.progressStatus, - progress: finalUpdates.progress ?? 0, - reaction: finalUpdates.reaction, - updatedAt: now, - ...metadataPatch, - }); - } -} diff --git a/convex/import_export.ts b/convex/import_export.ts deleted file mode 100644 index 392bd56b..00000000 --- a/convex/import_export.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { mutation } from "./_generated/server"; -import { v } from "convex/values"; -import { - requireCurrentUser, - type WatchItem, - buildMetadataPatch, - MEDIA_TYPE_VALIDATOR, - PROGRESS_STATUS_VALIDATOR, - REACTION_OR_NULL_VALIDATOR, - type MediaType, -} from "./helpers/watch_item"; -import { syncEpisodeProgressRecord } from "./episode_progress"; -import { createWatchlistSnapshot } from "./watchlist"; - -type ImportWatchlistItem = { - tmdbId: number; - mediaType: string; - title: string; - image?: string; - rating?: number; - release_date?: string; - overview?: string; - progressStatus?: string; - progress?: number; - reaction?: "loved" | "liked" | "mixed" | "not-for-me" | "recommended" | null; -}; - -const IMPORT_ITEM_VALIDATOR = v.object({ - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - title: v.string(), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - progressStatus: v.optional(PROGRESS_STATUS_VALIDATOR), - progress: v.optional(v.number()), - reaction: v.optional(REACTION_OR_NULL_VALIDATOR), -}); - -export const importWatchlist = mutation({ - args: { - items: v.array(IMPORT_ITEM_VALIDATOR), - watchedEpisodes: v.array( - v.object({ - tmdbId: v.number(), - season: v.number(), - episode: v.number(), - }), - ), - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - const now = Date.now(); - const importedItems = new Map(); - - for (const item of args.items) { - importedItems.set(`${item.mediaType}:${item.tmdbId}`, item); - } - - const userWatchItems = await ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .collect(); - - const existingMap = new Map(); - for (const item of userWatchItems) { - existingMap.set(`${item.mediaType}:${item.tmdbId}`, item); - } - - for (const item of importedItems.values()) { - const existing = existingMap.get(`${item.mediaType}:${item.tmdbId}`); - const progressStatus = item.progressStatus ?? "watch-later"; - const progress = - item.progress ?? - (progressStatus === "done" - ? 100 - : progressStatus === "watch-later" - ? 0 - : existing?.progress); - const metadata = buildMetadataPatch(item, existing ?? undefined); - - if (existing) { - await ctx.db.patch(existing._id, { - inWatchlist: true, - progressStatus, - progress, - reaction: item.reaction ?? existing.reaction ?? null, - updatedAt: now, - ...metadata, - }); - } else { - await ctx.db.insert("watch_items", { - userId: user._id, - tmdbId: item.tmdbId, - mediaType: item.mediaType as MediaType, - inWatchlist: true, - progressStatus, - progress, - reaction: item.reaction ?? null, - updatedAt: now, - ...metadata, - }); - } - } - - const importedTvIds = new Set( - [...importedItems.values()] - .filter((item) => item.mediaType === "tv") - .map((item) => item.tmdbId), - ); - const episodeKeys = new Set(); - for (const episode of args.watchedEpisodes) { - if (!importedTvIds.has(episode.tmdbId)) continue; - const key = `${episode.tmdbId}:${episode.season}:${episode.episode}`; - if (episodeKeys.has(key)) continue; - episodeKeys.add(key); - await syncEpisodeProgressRecord(ctx, user._id, { - ...episode, - isWatched: true, - }, now); - } - - await createWatchlistSnapshot(ctx, user._id); - return { imported: importedItems.size }; - }, -}); diff --git a/convex/prompts.ts b/convex/prompts.ts deleted file mode 100644 index 1f8a3b50..00000000 --- a/convex/prompts.ts +++ /dev/null @@ -1,367 +0,0 @@ -import type { WatchlistData, WatchItemSummary } from "./recommendations"; - -export interface FeedbackSignals { - likedTitles?: string[]; - dislikedTitles?: string[]; - dislikedTmdbIds?: number[]; - previousTitles?: string[]; -} - -export interface BasePromptConfig { - mediaTypePreference?: string; - yearFrom?: number; - yearTo?: number; - existingIds: number[]; - existingTitles: string[]; - feedback?: FeedbackSignals; - watchlistText?: string; - recommendationGoal?: string; - statsText?: string; -} - -export const RESPONSE_SCHEMA = `Respond with this exact JSON schema: -{ - "recommendations": [ - { - "title": "string - exact official title", - "tmdbId": "number or null if unknown", - "mediaType": "movie" or "tv", - "relevanceScore": "number 0-100", - "reasoning": "string - 1-2 sentence explanation" - } - ] -}`; - -export function formatItem(i: WatchItemSummary): string { - const parts = [`- ${i.title ?? "Unknown"} (TMDB ID: ${i.tmdbId}, ${i.mediaType})`]; - if (i.rating) parts.push(`Rating: ${i.rating}/10`); - if (i.reaction) parts.push(`Reaction: ${i.reaction}`); - return parts.join(" | "); -} - -export function buildWatchlistContext( - data: WatchlistData, - excludeTmdbIds: number[] = [], -): { - contextPrompt: string; - existingIds: number[]; - existingTitles: string[]; -} { - const { watchItems } = data; - - const loved = watchItems.filter( - (i) => i.reaction === "loved" || i.reaction === "liked", - ); - const watching = watchItems.filter( - (i) => i.progressStatus === "watching", - ); - const watchLater = watchItems.filter( - (i) => i.progressStatus === "watch-later", - ); - const disliked = watchItems.filter( - (i) => - i.reaction === "not-for-me" || - i.reaction === "mixed" || - i.progressStatus === "dropped", - ); - const done = watchItems.filter( - (i) => - i.progressStatus === "done" && - i.reaction !== "loved" && - i.reaction !== "liked", - ); - - const prioritized = new Set( - [...loved, ...watching, ...done, ...watchLater, ...disliked] - .slice(0, 50) - .map((i) => i.tmdbId), - ); - const existingIds = [...new Set([...watchItems.map((i) => i.tmdbId), ...excludeTmdbIds])]; - const existingTitles = watchItems - .map((i) => i.title) - .filter((title): title is string => !!title); - const inScope = (item: WatchItemSummary) => prioritized.has(item.tmdbId); - - let prompt = ""; - const scopedLoved = loved.filter(inScope); - const scopedWatching = watching.filter(inScope); - const scopedDone = done.filter(inScope); - const scopedWatchLater = watchLater.filter(inScope); - const scopedDisliked = disliked.filter(inScope); - - if (scopedLoved.length > 0) { - prompt += `## Content I loved/liked:\n${scopedLoved.map(formatItem).join("\n")}\n\n`; - } - if (scopedWatching.length > 0) { - prompt += `## Currently watching:\n${scopedWatching.map(formatItem).join("\n")}\n\n`; - } - if (scopedDone.length > 0) { - prompt += `## Completed (no strong reaction):\n${scopedDone.map(formatItem).join("\n")}\n\n`; - } - if (scopedWatchLater.length > 0) { - prompt += `## On my watch-later list:\n${scopedWatchLater.map(formatItem).join("\n")}\n\n`; - } - if (scopedDisliked.length > 0) { - prompt += `## Content I didn't enjoy (dropped/mixed/not-for-me):\n${scopedDisliked.map(formatItem).join("\n")}\n\n`; - } - - return { contextPrompt: prompt, existingIds, existingTitles }; -} - -export function appendFeedbackSignals(prompt: string, feedback?: FeedbackSignals): string { - let result = prompt; - if (feedback?.likedTitles && feedback.likedTitles.length > 0) { - result += `## Recommendations I explicitly liked and want more content similar to:\n${feedback.likedTitles.map((t) => `- ${t}`).join("\n")}\n\n`; - } - if (feedback?.dislikedTitles && feedback.dislikedTitles.length > 0) { - result += `## Recommendations I explicitly marked as "not interested" (avoid similar styles/genres):\n${feedback.dislikedTitles.map((t) => `- ${t}`).join("\n")}\n\n`; - } - if (feedback?.previousTitles && feedback.previousTitles.length > 0) { - result += `## Previously recommended titles (do NOT repeat these):\n${feedback.previousTitles.map((t) => `- ${t}`).join("\n")}\n\n`; - } - return result; -} - -export function buildBasePromptSections(config: BasePromptConfig): string { - let prompt = ""; - - prompt = appendFeedbackSignals(prompt, config.feedback); - - if (config.statsText) { - prompt += config.statsText; - } - - if (config.mediaTypePreference === "movie") { - prompt += `IMPORTANT: Only recommend MOVIES. Do not suggest any TV shows.\n\n`; - } else if (config.mediaTypePreference === "tv") { - prompt += `IMPORTANT: Only recommend TV SHOWS. Do not suggest any movies.\n\n`; - } - - if (config.recommendationGoal) { - prompt += config.recommendationGoal; - } - - if (config.existingIds.length > 0) { - const wlText = config.watchlistText ?? " (already in my watchlist)"; - prompt += `Do NOT recommend any title with these TMDB IDs${wlText}: ${config.existingIds.join(", ")}\n`; - } - if (config.existingTitles.length > 0) { - prompt += `Do NOT recommend any of these already tracked titles by name: ${config.existingTitles.join(", ")}\n`; - } - prompt += "\n"; - - if (config.yearFrom || config.yearTo) { - const from = config.yearFrom ?? 1900; - const to = config.yearTo ?? new Date().getFullYear(); - prompt += `IMPORTANT: Only recommend titles released between ${from} and ${to} (inclusive).\n\n`; - } - - return prompt; -} - -export function buildWatchlistPrompt( - data: WatchlistData, - mediaTypePreference?: string, - excludeTmdbIds: number[] = [], - yearFrom?: number, - yearTo?: number, - count?: number, - feedback?: FeedbackSignals, -): string { - const { lists, listItems, inputStats } = data; - const { contextPrompt, existingIds, existingTitles } = buildWatchlistContext( - data, - excludeTmdbIds, - ); - - let prompt = `Here is my watchlist data:\n\n` + contextPrompt; - - const listItemsByListId = new Map(); - for (const li of listItems) { - const listIdStr = String(li.listId); - let items = listItemsByListId.get(listIdStr); - if (!items) { - items = []; - listItemsByListId.set(listIdStr, items); - } - items.push(li); - } - - const watchItemByMediaKey = new Map(); - for (const w of data.watchItems) { - watchItemByMediaKey.set(`${w.tmdbId}_${w.mediaType}`, w); - } - - if (lists.length > 0) { - prompt += `## My custom lists:\n`; - for (const list of lists) { - const items = listItemsByListId.get(String(list._id)) ?? []; - const titles = items - .map((li) => { - const wi = watchItemByMediaKey.get(`${li.tmdbId}_${li.mediaType}`); - return wi?.title ?? `TMDB:${li.tmdbId}`; - }) - .join(", "); - prompt += `- "${list.name}": ${titles}\n`; - } - prompt += "\n"; - } - - const mediaLabel = - mediaTypePreference === "movie" - ? "movies" - : mediaTypePreference === "tv" - ? "TV shows" - : "movies and TV shows"; - const titleCount = Math.min(Math.max(count ?? 10, 1), 30); - - prompt += buildBasePromptSections({ - mediaTypePreference, - yearFrom, - yearTo, - existingIds, - existingTitles, - feedback, - watchlistText: " (already in my watchlist)", - recommendationGoal: `Based on this data, recommend exactly ${titleCount} ${mediaLabel} I would likely enjoy.\n`, - statsText: `## Stats:\n- ${inputStats.movieCount} movies, ${inputStats.tvCount} TV shows tracked\n- ${inputStats.episodesWatched} episodes watched\n\n`, - }); - - prompt += RESPONSE_SCHEMA; - - return prompt; -} - -export function buildGenrePrompt( - data: WatchlistData, - mediaTypePreference?: string, - genrePreference?: string, - excludeTmdbIds: number[] = [], - yearFrom?: number, - yearTo?: number, - count?: number, - feedback?: FeedbackSignals, -): string { - const { existingIds, existingTitles } = buildWatchlistContext(data, excludeTmdbIds); - - const mediaLabel = - mediaTypePreference === "movie" - ? "movies" - : mediaTypePreference === "tv" - ? "TV shows" - : "movies and TV shows"; - const titleCount = Math.min(Math.max(count ?? 10, 1), 30); - - let prompt = `Recommend me exactly ${titleCount} popular and highly-rated ${mediaLabel}`; - - if (genrePreference) { - prompt += ` in these genres: ${genrePreference}`; - } - prompt += `.\n\n`; - - prompt += `Focus on well-known, critically acclaimed titles that are widely loved. Include a mix of classic and recent titles.\n\n`; - - prompt += buildBasePromptSections({ - mediaTypePreference, - yearFrom, - yearTo, - existingIds, - existingTitles, - feedback, - watchlistText: " (already in my watchlist)", - }); - - prompt += RESPONSE_SCHEMA; - return prompt; -} - -export function buildCustomListPrompt( - data: WatchlistData, - listId: string, - mediaTypePreference?: string, - excludeTmdbIds: number[] = [], - yearFrom?: number, - yearTo?: number, - count?: number, - feedback?: FeedbackSignals, -): string { - const { existingIds, existingTitles } = buildWatchlistContext(data, excludeTmdbIds); - - const mediaLabel = - mediaTypePreference === "movie" - ? "movies" - : mediaTypePreference === "tv" - ? "TV shows" - : "movies and TV shows"; - const titleCount = Math.min(Math.max(count ?? 10, 1), 30); - - const list = data.lists.find((l) => l._id === listId); - const listName = list?.name ?? "this custom list"; - - const watchItemByMediaKey = new Map(); - for (const w of data.watchItems) { - watchItemByMediaKey.set(`${w.tmdbId}_${w.mediaType}`, w); - } - - const items = data.listItems.filter((li) => li.listId === listId); - const titles = items - .map((li) => { - const wi = watchItemByMediaKey.get(`${li.tmdbId}_${li.mediaType}`); - return wi?.title - ? `- ${wi.title} (${li.mediaType})` - : `- TMDB ID: ${li.tmdbId} (${li.mediaType})`; - }) - .join("\n"); - - let prompt = `Here are the movies and TV shows in my custom list "${listName}":\n\n${titles}\n\n`; - - prompt += buildBasePromptSections({ - mediaTypePreference, - yearFrom, - yearTo, - existingIds, - existingTitles, - feedback, - watchlistText: " (already in my overall watchlist)", - recommendationGoal: `Based on these titles, recommend exactly ${titleCount} ${mediaLabel} I would likely enjoy.\nFind movies/shows that share similar themes, genres, directors, actors, or vibe as the ones in the list.\n\n`, - }); - - prompt += RESPONSE_SCHEMA; - return prompt; -} - -export function buildHomepageRecommendationsPrompt( - data: WatchlistData, - likedFeedbackTitles: string[], - dislikedFeedbackTitles: string[], - excludeTmdbIds: number[], - previousTitles: string[], -): string { - const { inputStats } = data; - const { contextPrompt, existingIds, existingTitles } = buildWatchlistContext( - data, - excludeTmdbIds, - ); - - let prompt = - `You are generating personalized recommendations for the user's homepage.\n\n` + - `Here is the user's watchlist/viewing data:\n\n` + - contextPrompt; - - prompt += buildBasePromptSections({ - existingIds, - existingTitles, - feedback: { - likedTitles: likedFeedbackTitles, - dislikedTitles: dislikedFeedbackTitles, - previousTitles, - }, - watchlistText: "", - recommendationGoal: `Based on this data, recommend exactly 15 movies and 15 TV shows I would likely enjoy.\n`, - statsText: `## Stats:\n- ${inputStats.movieCount} movies, ${inputStats.tvCount} TV shows tracked\n- ${inputStats.episodesWatched} episodes watched\n\n`, - }); - - prompt += RESPONSE_SCHEMA; - - return prompt; -} diff --git a/convex/recommendations.ts b/convex/recommendations.ts deleted file mode 100644 index a0dec3d9..00000000 --- a/convex/recommendations.ts +++ /dev/null @@ -1,911 +0,0 @@ -import { - action, - internalMutation, - internalQuery, - mutation, - query, - type MutationCtx, - type QueryCtx, -} from "./_generated/server"; -import type { Doc, Id } from "./_generated/dataModel"; -import { internal } from "./_generated/api"; -import { v } from "convex/values"; -import { hasFeature } from "./admin"; -import { callGeminiAI, MODELS_TO_TRY, type Recommendation } from "./ai"; -import { - buildWatchlistPrompt, - buildCustomListPrompt, - buildGenrePrompt, - buildHomepageRecommendationsPrompt, - type FeedbackSignals, -} from "./prompts"; - -type RecommendationsContext = QueryCtx | MutationCtx; -type RecommendationUser = Doc<"users">; -type RecommendationEntry = Doc<"ai_recommendations">; -export type WatchItemSummary = Pick< - Doc<"watch_items">, - "tmdbId" | "mediaType" | "title" | "rating" | "progressStatus" | "reaction" | "progress" ->; -export type CustomListSummary = Pick, "_id" | "name">; -export type CustomListItemSummary = Pick< - Doc<"list_items">, - "listId" | "tmdbId" | "mediaType" ->; - -async function getUserByTokenIdentifier( - ctx: RecommendationsContext, - tokenIdentifier: string, -) { - return ctx.db - .query("users") - .withIndex("by_token", (q) => q.eq("tokenIdentifier", tokenIdentifier)) - .first(); -} - -async function requireAuthenticatedUser( - ctx: RecommendationsContext, -): Promise { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) { - throw new Error("Unauthorized"); - } - - const user = await getUserByTokenIdentifier(ctx, identity.subject); - if (!user) { - throw new Error("Unauthorized"); - } - - return user; -} - -async function requireOwnedRecommendationEntry( - ctx: MutationCtx, - id: Id<"ai_recommendations">, -): Promise { - const user = await requireAuthenticatedUser(ctx); - const entry = await ctx.db.get(id); - - if (!entry) { - throw new Error("Not found"); - } - - if (entry.userId !== user._id) { - throw new Error("Unauthorized"); - } - - return entry; -} - -export const getAuthorizedUser = internalQuery({ - args: {}, - handler: async (ctx) => { - const user = await requireAuthenticatedUser(ctx); - - if (!(await hasFeature(ctx, "ai-recommendations"))) { - throw new Error("Unauthorized: feature not enabled"); - } - - return user; - }, -}); - -export const gatherWatchlistData = internalQuery({ - args: {}, - handler: async (ctx) => { - const user = await requireAuthenticatedUser(ctx); - - const watchItems = await ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .order("desc") - .take(200); - - const lists = await ctx.db - .query("lists") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .take(50); - - const listItems = await ctx.db - .query("list_items") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .order("desc") - .take(200); - - const episodeProgress = await ctx.db - .query("episode_progress") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .order("desc") - .take(200); - - const watchedEpisodes = episodeProgress.filter((e) => e.isWatched).length; - - const movieCount = watchItems.filter( - (i) => i.mediaType === "movie", - ).length; - const tvCount = watchItems.filter((i) => i.mediaType === "tv").length; - - return { - watchItems, - lists, - listItems, - inputStats: { - movieCount, - tvCount, - episodesWatched: watchedEpisodes, - totalItems: watchItems.length, - }, - }; - }, -}); - -export const saveRecommendations = internalMutation({ - args: { - userId: v.id("users"), - recommendations: v.string(), - watchlistHash: v.string(), - inputStats: v.object({ - movieCount: v.number(), - tvCount: v.number(), - episodesWatched: v.number(), - totalItems: v.number(), - }), - model: v.string(), - mediaTypePreference: v.optional(v.string()), - genrePreference: v.optional(v.string()), - generationType: v.optional(v.string()), - }, - handler: async (ctx, args) => { - await ctx.db.insert("ai_recommendations", { - userId: args.userId, - recommendations: args.recommendations, - watchlistHash: args.watchlistHash, - inputStats: args.inputStats, - model: args.model, - mediaTypePreference: args.mediaTypePreference, - genrePreference: args.genrePreference, - generationType: args.generationType, - createdAt: Date.now(), - }); - }, -}); - -export const getUserRecommendationAccess = query({ - args: {}, - handler: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) { - return { hasAccess: false, reason: "not_authenticated" as const }; - } - - if (!(await hasFeature(ctx, "ai-recommendations"))) { - return { hasAccess: false, reason: "feature_disabled" as const }; - } - - return { hasAccess: true }; - }, -}); - -export const getRecommendationHistory = query({ - args: {}, - handler: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) return []; - - if (!(await hasFeature(ctx, "ai-recommendations"))) return []; - - const user = await getUserByTokenIdentifier(ctx, identity.subject); - if (!user) return []; - - return ctx.db - .query("ai_recommendations") - .withIndex("by_user_created", (q) => q.eq("userId", user._id)) - .order("desc") - .take(20); - }, -}); - -export const deleteRecommendation = mutation({ - args: { id: v.id("ai_recommendations") }, - handler: async (ctx, args) => { - await requireOwnedRecommendationEntry(ctx, args.id); - - await ctx.db.delete(args.id); - }, -}); - -export const updateVerifiedRecommendations = mutation({ - args: { - id: v.id("ai_recommendations"), - recommendations: v.string(), - }, - handler: async (ctx, args) => { - const entry = await requireOwnedRecommendationEntry(ctx, args.id); - - const patch: Record = { - recommendations: args.recommendations, - verified: true, - }; - if (!entry.originalRecommendations) { - patch.originalRecommendations = entry.recommendations; - } - - await ctx.db.patch(args.id, patch); - }, -}); - - -const RATE_LIMIT_MS = 2 * 60 * 1000; - -function computeHash( - items: Array<{ - tmdbId: number; - progressStatus?: string; - reaction?: string | null; - }>, - mediaTypePreference?: string, - genrePreference?: string, -): string { - const sorted = items - .map((i) => `${i.tmdbId}:${i.progressStatus ?? ""}:${i.reaction ?? ""}`) - .sort(); - let hash = 0; - const str = sorted.join("|") + `|mt:${mediaTypePreference ?? ""}|g:${genrePreference ?? ""}`; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash = ((hash << 5) - hash + char) | 0; - } - return hash.toString(36); -} - -function normalizeTitleKey(title?: string | null): string { - return (title ?? "").toLowerCase().replace(/[^a-z0-9]/g, ""); -} - -export type WatchlistData = { - watchItems: WatchItemSummary[]; - lists: CustomListSummary[]; - listItems: CustomListItemSummary[]; - inputStats: { - movieCount: number; - tvCount: number; - episodesWatched: number; - totalItems: number; - }; -}; - - - - - - - - - - - - - - - - - - - - - -export const checkAndSetRecommendationCooldown = internalMutation({ - args: { userId: v.id("users") }, - handler: async (ctx, args) => { - const mostRecent = await ctx.db - .query("ai_recommendations") - .withIndex("by_user_created", (q) => q.eq("userId", args.userId)) - .order("desc") - .first(); - - const now = Date.now(); - if (mostRecent && now - mostRecent.createdAt < RATE_LIMIT_MS) { - return false; - } - - await ctx.db.insert("ai_recommendations", { - userId: args.userId, - recommendations: "[]", - watchlistHash: "", - inputStats: { movieCount: 0, tvCount: 0, episodesWatched: 0, totalItems: 0 }, - model: "placeholder", - createdAt: now, - }); - - return true; - }, -}); - -export const getMostRecentEntry = internalQuery({ - args: { userId: v.id("users") }, - handler: async (ctx, args) => { - return ctx.db - .query("ai_recommendations") - .withIndex("by_user_created", (q) => q.eq("userId", args.userId)) - .order("desc") - .first(); - }, -}); - -export const getHomepageAttemptInfo = internalQuery({ - args: { userId: v.id("users") }, - handler: async (ctx, args) => { - const entry = await ctx.db - .query("homepage_recommendations") - .withIndex("by_user", (q) => q.eq("userId", args.userId)) - .first(); - return entry - ? { lastAttemptedAt: entry.lastAttemptedAt, status: entry.status } - : null; - }, -}); - -export const getHomepageRecommendationEntryInternal = internalQuery({ - args: { userId: v.id("users") }, - handler: async (ctx, args) => { - return ctx.db - .query("homepage_recommendations") - .withIndex("by_user", (q) => q.eq("userId", args.userId)) - .first(); - }, -}); - - - -interface InputStats { - movieCount: number; - tvCount: number; - episodesWatched: number; - totalItems: number; -} - -type GenerateResult = - | { - recommendations: Recommendation[]; - inputStats: InputStats; - generatedAt: number; - cached: boolean; - } - | { error: string }; - - - -export const generateRecommendations = action({ - args: { - generationType: v.optional(v.string()), - listId: v.optional(v.string()), - mediaTypePreference: v.optional(v.union(v.literal("movie"), v.literal("tv"))), - genrePreference: v.optional(v.string()), - excludeTmdbIds: v.optional(v.array(v.number())), - yearFrom: v.optional(v.number()), - yearTo: v.optional(v.number()), - count: v.optional(v.number()), - }, - handler: async (ctx, args): Promise => { - const genType = args.generationType ?? "watchlist"; - - const user = await ctx.runQuery( - internal.recommendations.getAuthorizedUser, - ); - - const data = await ctx.runQuery( - internal.recommendations.gatherWatchlistData, - ); - - if (genType === "watchlist" && data.watchItems.length === 0) { - return { error: "empty_watchlist" }; - } - if (genType === "list" && args.listId) { - if (data.listItems.filter((li) => li.listId === args.listId).length === 0) { - return { error: "empty_watchlist" }; - } - } - - const allowed = await ctx.runMutation( - internal.recommendations.checkAndSetRecommendationCooldown, - { userId: user._id }, - ); - - if (!allowed) { - return { error: "rate_limited" }; - } - - const feedbackList = await ctx.runQuery( - internal.recommendations.getRecommendationFeedbackInternal, - ); - - const likedTitles = feedbackList - .filter((f) => f.feedback === "like") - .map((f) => f.title); - const dislikedTitles = feedbackList - .filter((f) => f.feedback === "not_interested") - .map((f) => f.title); - const dislikedTmdbIds = feedbackList - .filter((f) => f.feedback === "not_interested") - .map((f) => f.tmdbId); - - const excludeTmdbIds = [ - ...new Set([...(args.excludeTmdbIds ?? []), ...dislikedTmdbIds]), - ]; - - const feedbackSignals: FeedbackSignals = { - likedTitles, - dislikedTitles, - dislikedTmdbIds, - }; - - const userPrompt = - genType === "watchlist" - ? buildWatchlistPrompt( - data, - args.mediaTypePreference, - excludeTmdbIds, - args.yearFrom, - args.yearTo, - args.count, - feedbackSignals, - ) - : genType === "list" && args.listId - ? buildCustomListPrompt( - data, - args.listId, - args.mediaTypePreference, - excludeTmdbIds, - args.yearFrom, - args.yearTo, - args.count, - feedbackSignals, - ) - : buildGenrePrompt( - data, - args.mediaTypePreference, - args.genrePreference, - excludeTmdbIds, - args.yearFrom, - args.yearTo, - args.count, - feedbackSignals, - ); - - const systemInstruction = - "You are a movie and TV show recommendation engine. You analyze a user's watchlist and viewing preferences to suggest titles they would enjoy. You MUST only recommend real, existing movies and TV shows. Never invent fictional titles. Return your response as a JSON object with the exact schema specified by the user."; - - const aiResult = await callGeminiAI(userPrompt, systemInstruction, 1); - if (aiResult.error || !aiResult.result) { - return { error: aiResult.error ?? "api_unavailable" }; - } - const parsed = aiResult.result; - const usedModel = aiResult.usedModel ?? MODELS_TO_TRY[0]; - - const existingIds = new Set([ - ...data.watchItems.map((item) => item.tmdbId), - ...excludeTmdbIds, - ]); - const existingTitles = new Set( - data.watchItems.map((item) => normalizeTitleKey(item.title)), - ); - parsed.recommendations = parsed.recommendations.filter( - (r) => - (r.tmdbId == null || !existingIds.has(r.tmdbId)) && - !existingTitles.has(normalizeTitleKey(r.title)), - ); - - const watchlistHash = computeHash( - data.watchItems, - args.mediaTypePreference, - args.genrePreference, - ); - await ctx.runMutation(internal.recommendations.saveRecommendations, { - userId: user._id, - recommendations: JSON.stringify(parsed.recommendations), - watchlistHash, - inputStats: data.inputStats, - model: usedModel, - mediaTypePreference: args.mediaTypePreference, - genrePreference: args.genrePreference, - generationType: genType, - }); - - return { - recommendations: parsed.recommendations, - inputStats: data.inputStats, - generatedAt: Date.now(), - cached: false, - }; - }, -}); - -export const getHomepageRecommendations = query({ - args: { - now: v.optional(v.number()), - }, - handler: async (ctx, args) => { - const user = await ctx.auth.getUserIdentity(); - if (!user) return null; - - const dbUser = await getUserByTokenIdentifier(ctx, user.subject); - if (!dbUser) return null; - - const entry = await ctx.db - .query("homepage_recommendations") - .withIndex("by_user", (q) => q.eq("userId", dbUser._id)) - .first(); - - const notInterestedFeedback = await ctx.db - .query("recommendation_feedback") - .withIndex("by_user_feedback", (q) => - q.eq("userId", dbUser._id).eq("feedback", "not_interested"), - ) - .collect(); - - const dislikeFeedback = await ctx.db - .query("recommendation_feedback") - .withIndex("by_user_feedback", (q) => - q.eq("userId", dbUser._id).eq("feedback", "dislike"), - ) - .collect(); - - const excludedFeedbackIds = new Set([ - ...notInterestedFeedback.map((f) => f.tmdbId), - ...dislikeFeedback.map((f) => f.tmdbId), - ]); - - let recs: Recommendation[] = []; - if (entry && entry.recommendations) { - try { - const parsed = JSON.parse(entry.recommendations) as Recommendation[]; - recs = parsed.filter( - (r) => r.tmdbId === null || !excludedFeedbackIds.has(r.tmdbId), - ); - } catch (e) { - console.error("Failed to parse homepage recommendations", e); - } - } - - const lastAttemptedAt = entry?.lastAttemptedAt ?? 0; - const lastUpdatedAt = entry?.lastUpdatedAt ?? 0; - const status = entry?.status ?? "none"; - - const currentTime = args.now ?? Date.now(); - const isOlderThan24Hours = currentTime > 0 && (currentTime - lastAttemptedAt > 24 * 60 * 60 * 1000); - const hasFailedRecently = status === "failed" && currentTime > 0 && (currentTime - lastAttemptedAt < 1 * 60 * 60 * 1000); - const needsRefresh = !entry || (isOlderThan24Hours && !hasFailedRecently); - - return { - recommendations: recs, - lastUpdatedAt, - lastAttemptedAt, - status, - needsRefresh, - }; - }, -}); - -export const setRecommendationFeedback = mutation({ - args: { - tmdbId: v.number(), - mediaType: v.string(), - title: v.string(), - feedback: v.union(v.literal("not_interested"), v.literal("like")), - image: v.optional(v.string()), - backdrop: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - handler: async (ctx, args) => { - const user = await requireAuthenticatedUser(ctx); - const now = Date.now(); - - // Save feedback - const existing = await ctx.db - .query("recommendation_feedback") - .withIndex("by_user_media", (q) => - q.eq("userId", user._id).eq("tmdbId", args.tmdbId).eq("mediaType", args.mediaType) - ) - .first(); - - if (existing) { - await ctx.db.patch(existing._id, { - feedback: args.feedback, - updatedAt: now, - }); - } else { - await ctx.db.insert("recommendation_feedback", { - userId: user._id, - tmdbId: args.tmdbId, - mediaType: args.mediaType, - title: args.title, - feedback: args.feedback, - updatedAt: now, - }); - } - - // When user likes a recommendation, auto-add to watchlist with "recommended" reaction & Pebbly Picks list - if (args.feedback === "like") { - // Add to user's main watchlist - const existingWatchItem = await ctx.db - .query("watch_items") - .withIndex("by_user_media", (q) => - q.eq("userId", user._id).eq("tmdbId", args.tmdbId).eq("mediaType", args.mediaType) - ) - .first(); - - if (existingWatchItem) { - await ctx.db.patch(existingWatchItem._id, { - inWatchlist: true, - reaction: existingWatchItem.reaction ?? "recommended", - updatedAt: now, - }); - } else { - await ctx.db.insert("watch_items", { - userId: user._id, - tmdbId: args.tmdbId, - mediaType: args.mediaType, - inWatchlist: true, - progressStatus: "watch-later", - reaction: "recommended", - title: args.title, - image: args.image, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - updatedAt: now, - }); - } - - // Find or create the Pebbly Picks list - let pebblyList = await ctx.db - .query("lists") - .withIndex("by_user_name", (q) => q.eq("userId", user._id).eq("name", "Pebbly Picks")) - .first(); - - if (!pebblyList) { - const listId = await ctx.db.insert("lists", { - userId: user._id, - name: "Pebbly Picks", - listType: "pebbly-picks", - sortOrder: 0, - createdAt: now, - updatedAt: now, - }); - pebblyList = await ctx.db.get(listId); - } - - if (pebblyList) { - const existingItem = await ctx.db - .query("list_items") - .withIndex("by_list_media", (q) => - q.eq("listId", pebblyList._id).eq("tmdbId", args.tmdbId).eq("mediaType", args.mediaType), - ) - .first(); - - if (!existingItem) { - await ctx.db.insert("list_items", { - userId: user._id, - listId: pebblyList._id, - tmdbId: args.tmdbId, - mediaType: args.mediaType, - addedAt: now, - title: args.title, - image: args.image, - backdrop: args.backdrop, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - }); - } - } - } - }, -}); - -export const removeRecommendationFeedback = mutation({ - args: { - tmdbId: v.number(), - mediaType: v.string(), - }, - handler: async (ctx, args) => { - const user = await requireAuthenticatedUser(ctx); - const existing = await ctx.db - .query("recommendation_feedback") - .withIndex("by_user_media", (q) => - q.eq("userId", user._id).eq("tmdbId", args.tmdbId).eq("mediaType", args.mediaType) - ) - .first(); - - if (existing) { - await ctx.db.delete(existing._id); - } - }, -}); - -export const getRecommendationFeedback = query({ - args: {}, - handler: async (ctx) => { - const user = await ctx.auth.getUserIdentity(); - if (!user) return []; - - const dbUser = await getUserByTokenIdentifier(ctx, user.subject); - if (!dbUser) return []; - - return ctx.db - .query("recommendation_feedback") - .withIndex("by_user", (q) => q.eq("userId", dbUser._id)) - .take(100); - }, -}); - -export const getRecommendationFeedbackInternal = internalQuery({ - args: {}, - handler: async (ctx) => { - const user = await requireAuthenticatedUser(ctx); - - return ctx.db - .query("recommendation_feedback") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .take(100); - }, -}); - -export const saveHomepageRecommendations = internalMutation({ - args: { - userId: v.id("users"), - recommendations: v.string(), - }, - handler: async (ctx, args) => { - const existing = await ctx.db - .query("homepage_recommendations") - .withIndex("by_user", (q) => q.eq("userId", args.userId)) - .first(); - - if (existing) { - await ctx.db.patch(existing._id, { - previousRecommendations: existing.recommendations, - recommendations: args.recommendations, - lastAttemptedAt: Date.now(), - lastUpdatedAt: Date.now(), - status: "success", - }); - } else { - await ctx.db.insert("homepage_recommendations", { - userId: args.userId, - recommendations: args.recommendations, - lastAttemptedAt: Date.now(), - lastUpdatedAt: Date.now(), - status: "success", - }); - } - }, -}); - -export const saveHomepageFailure = internalMutation({ - args: { - userId: v.id("users"), - }, - handler: async (ctx, args) => { - const existing = await ctx.db - .query("homepage_recommendations") - .withIndex("by_user", (q) => q.eq("userId", args.userId)) - .first(); - - if (existing) { - await ctx.db.patch(existing._id, { - lastAttemptedAt: Date.now(), - status: "failed", - }); - } else { - await ctx.db.insert("homepage_recommendations", { - userId: args.userId, - recommendations: "[]", - lastAttemptedAt: Date.now(), - lastUpdatedAt: 0, - status: "failed", - }); - } - }, -}); - - - -export const generateHomepageRecommendations = action({ - args: {}, - handler: async (ctx): Promise<{ success: boolean; error?: string }> => { - const user = await ctx.runQuery(internal.recommendations.getAuthorizedUser); - const data = await ctx.runQuery(internal.recommendations.gatherWatchlistData); - - const attemptInfo = await ctx.runQuery( - internal.recommendations.getHomepageAttemptInfo, - { userId: user._id }, - ); - if ( - attemptInfo && - Date.now() - attemptInfo.lastAttemptedAt < RATE_LIMIT_MS - ) { - return { success: false, error: "rate_limited" }; - } - - const feedbackList = await ctx.runQuery( - internal.recommendations.getRecommendationFeedbackInternal, - ); - - const likedFeedback = feedbackList - .filter((f) => f.feedback === "like") - .map((f) => f.title); - - const dislikedFeedbackTitles = feedbackList - .filter((f) => f.feedback === "not_interested" || f.feedback === "dislike") - .map((f) => f.title); - - const dislikedFeedbackIds = feedbackList - .filter((f) => f.feedback === "not_interested" || f.feedback === "dislike") - .map((f) => f.tmdbId); - - // Get previous recommendations to prevent repeating recommendations across refresh cycles - const homepageEntry = await ctx.runQuery( - internal.recommendations.getHomepageRecommendationEntryInternal, - { userId: user._id }, - ); - - let previousTitles: string[] = []; - let previousTmdbIds: number[] = []; - if (homepageEntry?.recommendations) { - try { - const prevRecs = JSON.parse(homepageEntry.recommendations) as Recommendation[]; - previousTitles = prevRecs.map((r) => r.title); - previousTmdbIds = prevRecs - .map((r) => r.tmdbId) - .filter((id): id is number => typeof id === "number"); - } catch { - // ignore parse error - } - } - - const systemInstruction = - "You are a movie and TV show recommendation engine. You analyze a user's watchlist and viewing preferences to suggest titles they would enjoy. You MUST only recommend real, existing movies and TV shows. Never invent fictional titles. Return your response as a JSON object with the exact schema specified by the user."; - - const prompt = buildHomepageRecommendationsPrompt( - data, - likedFeedback, - dislikedFeedbackTitles, - [...dislikedFeedbackIds, ...previousTmdbIds], - previousTitles, - ); - - const aiResult = await callGeminiAI(prompt, systemInstruction, 2); - if (aiResult.error || !aiResult.result) { - await ctx.runMutation(internal.recommendations.saveHomepageFailure, { - userId: user._id, - }); - return { success: false, error: aiResult.error ?? "api_unavailable" }; - } - const parsed = aiResult.result; - - // Filter out existing watchlist items (double check) - const existingIds = new Set([ - ...data.watchItems.map((item) => item.tmdbId), - ...dislikedFeedbackIds, - ]); - const existingTitles = new Set( - data.watchItems.map((item) => normalizeTitleKey(item.title)), - ); - - parsed.recommendations = parsed.recommendations.filter( - (r) => - (r.tmdbId == null || !existingIds.has(r.tmdbId)) && - !existingTitles.has(normalizeTitleKey(r.title)), - ); - - await ctx.runMutation(internal.recommendations.saveHomepageRecommendations, { - userId: user._id, - recommendations: JSON.stringify(parsed.recommendations), - }); - - return { success: true }; - }, -}); diff --git a/convex/schema.ts b/convex/schema.ts deleted file mode 100644 index 90316ed4..00000000 --- a/convex/schema.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { defineSchema, defineTable } from "convex/server"; -import { v } from "convex/values"; - -export default defineSchema({ - users: defineTable({ - tokenIdentifier: v.string(), - name: v.optional(v.string()), - image: v.optional(v.string()), - email: v.optional(v.string()), - roles: v.optional(v.array(v.string())), - isAdmin: v.optional(v.boolean()), - isBanned: v.optional(v.boolean()), - }).index("by_token", ["tokenIdentifier"]), - - watch_items: defineTable({ - userId: v.id("users"), - tmdbId: v.number(), - mediaType: v.string(), - inWatchlist: v.optional(v.boolean()), - progressStatus: v.optional(v.string()), - reaction: v.optional(v.union(v.string(), v.null())), - progress: v.optional(v.number()), - title: v.optional(v.string()), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - updatedAt: v.number(), - }) - .index("by_user_media", ["userId", "tmdbId", "mediaType"]) - .index("by_user_status", ["userId", "progressStatus"]) - .index("by_user", ["userId"]), - - // Deliberately small recovery points. The source watch-item documents retain - // the metadata; snapshots only record which saved items belonged together. - watchlist_snapshots: defineTable({ - userId: v.id("users"), - items: v.optional( - v.array( - v.object({ - tmdbId: v.number(), - mediaType: v.string(), - }), - ), - ), - itemIds: v.optional(v.array(v.any())), - createdAt: v.number(), - }).index("by_user_and_createdAt", ["userId", "createdAt"]), - - lists: defineTable({ - userId: v.id("users"), - name: v.string(), - color: v.optional(v.string()), - visibility: v.optional(v.string()), - listType: v.optional(v.string()), - sortOrder: v.number(), - createdAt: v.number(), - updatedAt: v.number(), - }) - .index("by_user", ["userId"]) - .index("by_user_name", ["userId", "name"]) - .index("by_user_sort", ["userId", "sortOrder"]), - - list_items: defineTable({ - userId: v.id("users"), - listId: v.id("lists"), - tmdbId: v.number(), - mediaType: v.string(), - addedAt: v.number(), - title: v.optional(v.string()), - image: v.optional(v.string()), - backdrop: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }) - .index("by_list", ["listId"]) - .index("by_list_media", ["listId", "tmdbId", "mediaType"]) - .index("by_user_media", ["userId", "tmdbId", "mediaType"]) - .index("by_user", ["userId"]), - - episode_progress: defineTable({ - userId: v.id("users"), - tmdbId: v.number(), - season: v.number(), - episode: v.number(), - isWatched: v.boolean(), - updatedAt: v.number(), - }) - .index("by_user_episode", ["userId", "tmdbId", "season", "episode"]) - .index("by_user_season", ["userId", "tmdbId", "season"]) - .index("by_user_media", ["userId", "tmdbId"]) - .index("by_user", ["userId"]), - - ai_recommendations: defineTable({ - userId: v.id("users"), - recommendations: v.string(), - originalRecommendations: v.optional(v.string()), - watchlistHash: v.string(), - inputStats: v.object({ - movieCount: v.number(), - tvCount: v.number(), - episodesWatched: v.number(), - totalItems: v.number(), - }), - model: v.string(), - mediaTypePreference: v.optional(v.string()), - genrePreference: v.optional(v.string()), - generationType: v.optional(v.string()), - verified: v.optional(v.boolean()), - createdAt: v.number(), - }).index("by_user", ["userId"]) - .index("by_user_created", ["userId", "createdAt"]), - - homepage_recommendations: defineTable({ - userId: v.id("users"), - recommendations: v.string(), - lastAttemptedAt: v.number(), - lastUpdatedAt: v.number(), - status: v.string(), - previousRecommendations: v.optional(v.string()), - }).index("by_user", ["userId"]), - - recommendation_feedback: defineTable({ - userId: v.id("users"), - tmdbId: v.number(), - mediaType: v.string(), - title: v.string(), - feedback: v.string(), - updatedAt: v.number(), - }) - .index("by_user", ["userId"]) - .index("by_user_media", ["userId", "tmdbId", "mediaType"]) - .index("by_user_feedback", ["userId", "feedback"]), - - role_permissions: defineTable({ - role: v.string(), - feature: v.string(), - enabled: v.boolean(), - }) - .index("by_role", ["role"]) - .index("by_role_feature", ["role", "feature"]), -}); diff --git a/convex/users.ts b/convex/users.ts deleted file mode 100644 index 4c0977ec..00000000 --- a/convex/users.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { query, mutation } from "./_generated/server"; -import { v } from "convex/values"; -import { syncRolePermissions } from "./admin"; -import { getCurrentUser } from "./helpers/watch_item"; - -/** - * Returns `true`/`false` when the JWT explicitly includes `isAdmin`, - * or `null` when the JWT doesn't carry the claim at all (stale token). - * - * Clerk puts public metadata in the JWT under `public_meta` (snake_case in token claims) - * or `publicMetadata` (camelCase in some SDK versions). - */ -function getAdminFromJwt( - identity: Record, -): boolean | null { - const meta = - (identity.public_meta as Record | undefined) ?? - (identity.publicMetadata as Record | undefined); - if (meta && typeof meta === "object" && "isAdmin" in meta) { - return meta.isAdmin === true; - } - return null; -} - -export const store = mutation({ - args: { - email: v.optional(v.string()), - name: v.optional(v.string()), - image: v.optional(v.string()), - isAdmin: v.optional(v.boolean()), - }, - handler: async (ctx, args) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) { - throw new Error("Called storeUser without authentication present"); - } - const userId = identity.tokenIdentifier; - await syncRolePermissions(ctx); - - const adminFromJwt = getAdminFromJwt(identity); - - const existing = await getCurrentUser(ctx); - - if (existing) { - const update: Record = { - name: args.name, - image: args.image, - email: args.email, - }; - // The signed JWT claim is the only source of truth for admin status. - // The client-supplied value is never trusted to elevate privileges; it - // is only used to downgrade when the JWT is stale and carries no claim. - if (adminFromJwt !== null) { - update.isAdmin = adminFromJwt; - } else if (args.isAdmin === false) { - update.isAdmin = false; - } - await ctx.db.patch(existing._id, update); - return existing._id; - } else { - const newUserId = await ctx.db.insert("users", { - tokenIdentifier: userId, - name: args.name, - image: args.image, - email: args.email, - isAdmin: adminFromJwt ?? false, - }); - return newUserId; - } - }, -}); - -export const getStatus = query({ - args: {}, - handler: async (ctx) => { - return getCurrentUser(ctx); - }, -}); diff --git a/convex/watchlist.ts b/convex/watchlist.ts deleted file mode 100644 index 89718700..00000000 --- a/convex/watchlist.ts +++ /dev/null @@ -1,328 +0,0 @@ -import { - internalMutation, - mutation, - query, - type MutationCtx, -} from "./_generated/server"; -import { internal } from "./_generated/api"; -import { v } from "convex/values"; -import { - requireCurrentUser, - getCurrentUser, - getWatchItem, - upsertWatchItem, - buildMetadataPatch, - normalizeProgressStatus, - type WatchlistUser, - type MediaType, - MEDIA_TYPE_VALIDATOR, - PROGRESS_STATUS_VALIDATOR, - REACTION_VALIDATOR, -} from "./helpers/watch_item"; - -// Re-export everything from the new modules to not break existing clients -export * from "./episode_progress"; -export * from "./custom_lists"; -export * from "./import_export"; - -export async function createWatchlistSnapshot( - ctx: MutationCtx, - userId: WatchlistUser["_id"], -) { - const items = await ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", userId)) - .take(500); - const watchlistItems = items - .filter((item) => item.inWatchlist) - .map((item) => ({ tmdbId: item.tmdbId, mediaType: item.mediaType })) - .sort((a, b) => a.tmdbId - b.tmdbId || a.mediaType.localeCompare(b.mediaType)); - const latest = await ctx.db - .query("watchlist_snapshots") - .withIndex("by_user_and_createdAt", (q) => q.eq("userId", userId)) - .order("desc") - .first(); - - if ( - latest && - latest.items && - latest.items.length === watchlistItems.length && - latest.items.every( - (item, index) => - item.tmdbId === watchlistItems[index].tmdbId && - item.mediaType === watchlistItems[index].mediaType, - ) - ) { - return; - } - - await ctx.db.insert("watchlist_snapshots", { - userId, - items: watchlistItems.slice(0, 8000), - createdAt: Date.now(), - }); -} - -export const updateProgress = mutation({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - progress: v.optional(v.number()), - isWatched: v.optional(v.boolean()), - title: v.optional(v.string()), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - const existing = await getWatchItem(ctx, user._id, args); - - const now = Date.now(); - const nextProgress = - args.isWatched === true ? 100 : (args.progress ?? existing?.progress ?? 0); - - const currentProgressStatus = - normalizeProgressStatus(existing?.progressStatus); - - const inferredProgressStatus = - args.isWatched === true - ? "done" - : (nextProgress >= 95 - ? "done" - : nextProgress > 0 - ? "watching" - : undefined); - - const nextProgressStatus = currentProgressStatus ?? inferredProgressStatus; - - if (existing) { - await ctx.db.patch(existing._id, { - progress: nextProgress, - progressStatus: nextProgressStatus, - inWatchlist: true, - updatedAt: now, - ...buildMetadataPatch(args, existing), - }); - return; - } - - await ctx.db.insert("watch_items", { - userId: user._id, - tmdbId: args.tmdbId, - mediaType: args.mediaType as MediaType, - inWatchlist: true, - progress: nextProgress, - progressStatus: nextProgressStatus, - updatedAt: now, - ...buildMetadataPatch(args), - }); - }, -}); - -export const removeFromContinueWatching = mutation({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - }, - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - const existing = await getWatchItem(ctx, user._id, args); - if (!existing) return; - - const now = Date.now(); - await ctx.db.patch(existing._id, { - progressStatus: existing.inWatchlist ? "watch-later" : undefined, - progress: 0, - updatedAt: now, - }); - }, -}); - -export const getWatchlist = query({ - args: { - limit: v.optional(v.number()), - statusFilter: v.optional(v.string()), - }, - - handler: async (ctx, args) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - const requestedLimit = args.limit !== undefined && args.limit > 0 ? Math.floor(args.limit) : 200; - const boundedLimit = Math.min(requestedLimit, 500); - - if (args.statusFilter) { - return ctx.db - .query("watch_items") - .withIndex("by_user_status", (q) => - q.eq("userId", user._id).eq("progressStatus", args.statusFilter), - ) - .take(boundedLimit); - } - - return ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .take(boundedLimit); - }, -}); - -export const getTrackedTmdbIds = query({ - args: {}, - - handler: async (ctx) => { - const user = await getCurrentUser(ctx); - if (!user) return []; - - const items = await ctx.db - .query("watch_items") - .withIndex("by_user", (q) => q.eq("userId", user._id)) - .take(500); - - return items.map((item) => item.tmdbId); - }, -}); - -export const getMediaState = query({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - }, - - handler: async (ctx, args) => { - const user = await getCurrentUser(ctx); - if (!user) return null; - - return getWatchItem(ctx, user._id, args); - }, -}); - -export const setWatchlistMembership = mutation({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - inWatchlist: v.boolean(), - title: v.optional(v.string()), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - await upsertWatchItem(ctx, user._id, args.tmdbId, args.mediaType as MediaType, (existing) => { - if (!existing && !args.inWatchlist) return null; - - const normalizedExisting = existing ? normalizeProgressStatus(existing.progressStatus) : undefined; - const progressStatus = existing - ? (normalizedExisting ?? (args.inWatchlist ? "watch-later" : undefined)) - : "watch-later"; - - return { - inWatchlist: args.inWatchlist, - progressStatus, - ...(existing ? {} : { progress: 0 }), - title: args.title, - image: args.image, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - }; - }); - }, -}); - -export const setProgressStatus = mutation({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - progressStatus: PROGRESS_STATUS_VALIDATOR, - progress: v.optional(v.number()), - title: v.optional(v.string()), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - await upsertWatchItem(ctx, user._id, args.tmdbId, args.mediaType as MediaType, (existing) => { - const normalized = normalizeProgressStatus(args.progressStatus) ?? args.progressStatus; - let nextProgress = args.progress; - if (nextProgress === undefined) { - if (normalized === "watch-later") nextProgress = 0; - else if (normalized === "done") nextProgress = 100; - else nextProgress = existing?.progress; - } - - return { - inWatchlist: true, - progressStatus: normalized, - progress: nextProgress, - title: args.title, - image: args.image, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - }; - }); - }, -}); - -export const setReaction = mutation({ - args: { - tmdbId: v.number(), - mediaType: MEDIA_TYPE_VALIDATOR, - reaction: v.optional(REACTION_VALIDATOR), - clearReaction: v.optional(v.boolean()), - title: v.optional(v.string()), - image: v.optional(v.string()), - rating: v.optional(v.number()), - release_date: v.optional(v.string()), - overview: v.optional(v.string()), - }, - - handler: async (ctx, args) => { - const user = await requireCurrentUser(ctx); - await upsertWatchItem(ctx, user._id, args.tmdbId, args.mediaType as MediaType, (existing) => { - const reaction = args.clearReaction ? null : (args.reaction !== undefined ? args.reaction : existing?.reaction); - - return { - reaction, - title: args.title, - image: args.image, - rating: args.rating, - release_date: args.release_date, - overview: args.overview, - }; - }); - }, -}); - -export const createDailySnapshots = internalMutation({ - args: { - cursor: v.optional(v.string()), - }, - handler: async (ctx, args) => { - const batch = await ctx.db - .query("users") - .paginate({ cursor: args.cursor ?? null, numItems: 50 }); - for (const user of batch.page) { - try { - await createWatchlistSnapshot(ctx, user._id); - } catch (error) { - console.error(`Failed to create snapshot for user ${user._id}:`, error); - } - } - if (!batch.isDone) { - await ctx.scheduler.runAfter(0, internal.watchlist.createDailySnapshots, { - cursor: batch.continueCursor, - }); - } - }, -}); diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..b9bb4627 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,55 @@ +# Pebbly — Documentation + +> **Pebbly (Film Fanatic)** is a full-stack movie & TV discovery app: TanStack +> Start (React 19) + Cloudflare Workers + Cloudflare D1 (SQLite) + Drizzle ORM +> + Valibot + Clerk + Google Gemini + TMDB. +> +> This documentation describes the overall architecture, every meaningful +> source file, and the architecture decisions that shaped the codebase. + +## How to use these docs + +| Document | What it covers | +| :--- | :--- | +| [architecture.md](./architecture.md) | The big picture: tech stack, layers, request/data flows, deployment, cron | +| [server-layer.md](./server-layer.md) | Everything server-side: Nitro, server functions, auth, RBAC, Gemini AI, watchlist snapshots | +| [client-layer.md](./client-layer.md) | Everything client-side: routing, TanStack Query, Zustand stores, the repository pattern, optimistic updates | +| [data-model.md](./data-model.md) | The D1 database: every table, index, constraint, and migration | +| [architecture-decisions.md](./architecture-decisions.md) | Architecture Decision Records (ADRs) — *why* the code is shaped this way | +| [file-reference.md](./file-reference.md) | A per-file map of the repository: what each file exists for | +| [contributing.md](./contributing.md) | How to keep these docs accurate when code changes | + +## Quick orientation (TL;DR) + +- **One backend.** Cloudflare D1 via Drizzle ORM is the *only* database. The + former Convex backend was fully removed (see + [ADR-001](./architecture-decisions.md)). +- **Server functions, not REST endpoints.** All authenticated reads/writes go + through TanStack Start `createServerFn` RPCs in `src/server/fns/` — type-safe, + Valibot-validated, co-located with the client. Nitro only owns the + `/api/health` endpoint and the cron task. +- **A repository pattern hides remote-vs-local.** `useRepository()` picks a + remote (server-fn + optimistic journal) or local (Zustand + localStorage) + implementation based on auth state, so mutation hooks never branch on + `isSignedIn`. +- **Optimistic UI with a replayable journal.** Every write is applied to the + query cache immediately through `pending-ops.ts`, then reconciled against + server snapshots so a stale refetch can never clobber in-flight state. +- **Clerk owns identity; the DB never stores admin status.** Admin/ban/feature + decisions come from the signed JWT claim or the live Clerk API — never a + stored flag that could go stale. +- **AI recommendations are gated and rate-limited.** Gemini is called over + REST with a model fallback chain, and every generation is verified/cleaned + before it is shown to the user. + +## Repo stats (as of 2026-08-16) + +- ~31,500 lines across `src/`, `server/`, `drizzle/`, and `.github/` +- ~150 source files: server fns, routes, hooks, components, lib utilities + +## Also see + +- [`REFACTOR_PLAN.md`](../REFACTOR_PLAN.md) — the original refactoring plan + (Convex → D1, god-hook decomposition) with its progress log. +- [`README.md`](../README.md) — setup, env vars, scripts, and deployment + instructions. diff --git a/docs/architecture-decisions.md b/docs/architecture-decisions.md new file mode 100644 index 00000000..be677b83 --- /dev/null +++ b/docs/architecture-decisions.md @@ -0,0 +1,354 @@ +# Architecture Decision Records (ADRs) + +Each ADR captures a significant architectural decision: the context that +motivated it, what was decided, and the consequences (including what it cost). +Statuses: **Accepted** (implemented), **Superseded**. + +--- + +## ADR-001 — Convex backend replaced by Cloudflare D1 + Drizzle ORM + +**Status:** Accepted (completed 2026-08-16) + +**Context:** The app originally ran on Convex (real-time backend) while a +parallel Drizzle/D1 layer was being built for Cloudflare. For a while the +codebase maintained **two complete backends** with duplicated schemas, +prompts, and AI logic — a split-brain risk: data written to one was invisible +to the other, and every change had to be made twice. + +**Decision:** D1 (SQLite on Cloudflare) via Drizzle ORM is the **single** +backend. The entire `convex/` directory was deleted, `convex` and +`@convex-dev/react-query` were removed from dependencies, and every Convex +action/query was ported to a TanStack Start server function. All Convex env +vars were dropped. + +**Consequences:** +- One schema (`src/server/db/schema.ts`), one set of server fns — no more + duplication. +- Loses Convex's realtime/subscriptions and reactive queries; the app uses + explicit TanStack Query invalidation instead (acceptable for this workload). +- D1 limits shape the code: bounded `db.batch` calls, 100-parameter cap, + 30 s execution budget (see ADR-010). +- Ports were made carefully (comments say "port of convex/...") so behavior + matched during the transition. + +--- + +## ADR-002 — Server functions (createServerFn) as the API layer + +**Status:** Accepted + +**Context:** The app needed a typed, authenticated API for watchlist, lists, +AI recommendations, and admin operations. Options: a separate REST/HTTP API, +Convex mutations (now gone), or TanStack Start server functions. + +**Decision:** Every backend operation is a TanStack Start +`createServerFn({ method: "POST" })` with a Valibot `.validator()` for input +and a typed `ApiResult` return (`{ ok: true, data } | { ok: false, code, message }`). +Client calls them through the generated RPC layer; `unwrap()` throws an +`ApiError` on non-ok so TanStack Query's error path fires. + +**Consequences:** +- End-to-end type safety: the client imports the same fns it calls; schemas + are shared, so a schema change is a compile error on both sides. +- No OpenAPI/REST surface to maintain; Nitro only owns `/api/health` and the + cron task. +- CSRF protection is needed (server fns accept cookies) and is provided by + `createCsrfMiddleware` scoped to server fns (`src/start.ts`), plus a fresh + Bearer token attached client-side. + +--- + +## ADR-003 — Repository pattern unifies remote and local mutations + +**Status:** Accepted + +**Context:** Every mutation previously branched on `if (isSignedIn)`, +duplicating ~20–30 lines per operation: one path called server fns with +optimistic ops, the other wrote to Zustand stores. This was error-prone and +hard to test. + +**Decision:** Introduce `src/lib/repository/` with two implementations of a +single `Repository` interface: +- `remote-repository.ts` — server fns + optimistic journal + request batcher, +- `local-repository.ts` — Zustand stores (guest/localStorage), +selected by `useRepository()` based on Clerk auth state. The shared +`resolveProgressStatusAction` keeps the TV-vs-movie progress semantics in one +place. + +**Consequences:** +- Mutation hooks are thin (e.g. `use-watchlist.ts` dropped from 868 → 239 + lines); the `isSignedIn` branches are gone. +- New mutation types are added once (interface + two implementations). +- The repository is hook-free and can be unit-tested with a fake QueryClient / + store. + +--- + +## ADR-004 — Admin status comes from Clerk, never from the database + +**Status:** Accepted + +**Context:** `users` originally had an `is_admin` boolean. It was written once +at account creation and never refreshed — a user demoted in Clerk kept admin +privileges in the DB **forever**. The code comments call this out as a +privilege-escalation hazard. + +**Decision:** Delete the `users.is_admin` column (migration `0003`). Admin +status is resolved from two live sources: the **signed JWT claim** +(`public_meta.isAdmin`, available when a custom session claim is configured) +first, then the **live Clerk API** (`isAdminFromClerkApi`, time-boxed, degrades +to `false`). The `users.roles` column only carries the two *dynamic* feature +roles (`video-player`, `ai-integrations`), not admin. `listUsers` derives +admin badges from one paginated Clerk user-list call (display-only). + +**Consequences:** +- A demotion in Clerk takes effect immediately. +- Every admin-gated request pays one extra Clerk API call when the JWT claim + is absent — mitigated by preferring the signed claim. +- The admin table display can briefly disagree with reality if the Clerk API + call fails (accepted; it never gates access). + +--- + +## ADR-005 — Optimistic updates via a replayable journal scoped to the QueryClient + +**Status:** Accepted + +**Context:** Naive optimistic updates had a "UI flicker" race: a full-list +refetch computed *before* a write committed could clobber newer optimistic +state. Rollbacks restored an all-or-nothing array snapshot, wiping concurrent +ops. And the original journal lived in module-level globals — shared across +all SSR requests (a cross-user data leak). + +**Decision:** `src/hooks/pending-ops.ts` implements a **replayable journal**: +- Every write registers a pure `apply(rows)` patch; the patch is applied + immediately to the cache. +- Server snapshots (refetches, write responses) are merged by replaying + still-pending ops **on top** of fresh server data. +- Failure removes only the failed op and rebuilds from base + remaining ops. +- Ops touching the same rows supersede each other (latest intent wins). +- Journal state is stored in a `WeakMap` — never + module-level — and `beginOp` **throws during SSR**. + +**Consequences:** +- No UI flicker, no lost concurrent writes, no cross-request leaks. +- Every mutation must be written as a replayable patch (a discipline that has + kept the op builders pure and idempotent). +- The journal must be cleared on sign-out (`clearPendingOps`). + +--- + +## ADR-006 — Coalesce writes with a generic request batcher + +**Status:** Accepted + +**Context:** Rapid UI actions (e.g. toggling several titles at once, or a +continue-watching strip of N cards each fetching season details) could fire +N requests to the server/TMDB. + +**Decision:** `src/lib/batcher.ts` provides a generic `RequestBatcher` +(debounce window, max-wait, max-batch-size, per-item dedupe where latest +state wins, and flush-on-page-hide so queued writes aren't lost on unload). +It is used for: +- watchlist membership writes → `setWatchlistMembership` / + `batchSetWatchlistMembership` (300 ms / 1.2 s / dedupe by `mediaType:tmdbId`), +- TV season-detail fetches in media cards (`use-season-details.ts`). + +**Consequences:** +- Fewer round trips, D1 batches stay small, TMDB rate limits are respected. +- Dedupe-by-key semantics match the server's own per-item deduplication, so + client and server agree on "latest intent wins". + +--- + +## ADR-007 — Valibot for every boundary; typed error contract everywhere + +**Status:** Accepted + +**Context:** The app passes untrusted data across three boundaries: browser → +server fn, TMDB → client, Gemini → server. Unvalidated data caused crashes +deep in call stacks and made errors unreadable. + +**Decision:** Use Valibot (lightweight, tree-shakeable, TS-first) at every +boundary: +- Every server fn has a `.validator(schema)` (input) and returns `ApiResult` + (output) with a finite error-code set (`UNAUTHORIZED`, `FORBIDDEN`, + `NOT_FOUND`, `RATE_LIMITED`, `CONFLICT`, `BAD_REQUEST`). +- TMDB responses are validated against `src/lib/tmdb-schemas.ts` (742 lines). +- Gemini output is validated **per element** — malformed entries are dropped, + never trusted. +- Domain enums (`progressStatus`, `reaction`, `feedback`, `mediaType`) are + defined once in `src/server/schema/common.ts`. + +**Consequences:** +- Malformed input fails fast at the boundary with a typed error, not a 500. +- Shared schemas mean client and server can't drift. +- Validation cost is negligible (Valibot is small and lazy by design). + +--- + +## ADR-008 — Gemini over REST with a model fallback chain + +**Status:** Accepted + +**Context:** AI recommendations need to be reliable on the Workers runtime. +The `@google/genai` SDK was suspected of misbehaving on Workers, and a single +model can be unavailable or "high demand". + +**Decision:** Call Gemini's REST API directly (`generateContent`) with: +- the API key in the `x-goog-api-key` header (never the URL), +- a 30 s per-attempt timeout, +- a model fallback chain: `gemini-3.1-flash-lite` → `gemini-2.5-flash` → + `gemini-2.0-flash` → `gemini-1.5-flash` (1 s backoff between models), +- JSON response mode + per-element Valibot validation, +- retries with 503/"high demand" detection surfaced as `high_demand` errors. + +**Consequences:** +- Recommendations survive transient Gemini outages. +- Cost/quality tradeoff: the cheapest fast model is tried first. +- Server-side only: the key never reaches the client. + +--- + +## ADR-009 — Denormalized metadata snapshots on user rows + +**Status:** Accepted + +**Context:** Rendering watchlists and list pages requires title, poster, +rating, release date, and overview for every entry. Joining TMDB for each row +would be slow, rate-limited, and failure-prone. + +**Decision:** `watch_items` and `list_items` carry denormalized metadata +(title, image, rating, release_date, overview, backdrop) written at mutation +time from the client payload (or the existing row). TMDB remains the +authoritative source; the snapshots are display copies refreshed on touch. + +**Consequences:** +- Watchlist/list pages render with zero TMDB calls. +- Metadata can go slightly stale if TMDB updates a title's poster; accepted + for this app. +- Import/export and Pebbly Picks re-use the same snapshots, keeping the + client payloads self-contained. + +--- + +## ADR-010 — Work within D1's hard constraints (batching, parameters, budget) + +**Status:** Accepted + +**Context:** D1 is serverless SQLite with real limits: ~100 bound parameters +per query, 30 s execution budget per call, no long transactions across +isolates. Violating them fails whole operations (e.g. a >100-item `IN` clause +or a >100-statement batch). + +**Decision:** Encode the limits in the code: +- `runBatch` + `MAX_STATEMENTS_PER_BATCH = 100` for all multi-statement writes. +- `IN` clauses chunked at 90 ids (`lists.ts`), episode INSERTs chunked at 14 + rows (`import-export.ts`). +- The daily cron processes at most 200 users per run and resumes via a + persisted keyset cursor (`snapshot_cursors`), so no single invocation + exceeds the budget while coverage stays eventual and complete. +- Reads are capped (`limit 500`) and ordered deterministically. + +**Consequences:** +- Large operations are safe by construction; no "magic number" failures. +- Import of a huge watchlist takes multiple round trips (bounded, atomic per + batch) instead of one giant transaction. + +--- + +## ADR-011 — Guest data is local-first, promoted on sign-in + +**Status:** Accepted + +**Context:** Signed-out users can still use the watchlist. Their data must +survive reloads and, when they sign in, must not be lost. + +**Decision:** Guest state lives in persisted Zustand stores backed by +localStorage with an LRU eviction wrapper (`createLRUStorage`, ~4 MB +threshold). The repository's local implementation writes to these stores. +`UserSync` (`src/components/user-sync.tsx`) exports the local watchlist into +the remote backend at sign-in; sign-out clears the pending-op journal and +switches the repository back to local. + +**Consequences:** +- Guests get the full watchlist UX with no backend account. +- localStorage quota is managed (LRU eviction across stores). +- Promotion is a bulk server-fn call (the same `importWatchlist` path), so it + inherits the batching/chunking guarantees. + +--- + +## ADR-012 — Env validation and fail-fast with actionable messages + +**Status:** Accepted + +**Context:** Missing env vars used to fail deep inside call stacks with +cryptic errors (or silently degrade — a missing `CLERK_SECRET_KEY` turned +everyone into a guest with no warning). + +**Decision:** `src/server/env.ts` validates the Worker env once per +isolate/process with a Valibot schema: +- missing `CLERK_SECRET_KEY` → `console.error` (loud; every user degrades to + guest), +- missing `GEMINI_API_KEY` → warning (feature-gated degradation), +- missing D1 binding → fail-fast in `getDb` with a message explaining that + `pnpm dev:web` is UI-only and `pnpm dev:cf` provides D1 + secrets. + +**Consequences:** +- Misconfiguration is reported at the surface with a fix hint. +- Validation runs once (memoized) so it costs nothing per request. + +--- + +## ADR-013 — Client-side TMDB verification of AI-suggested titles + +**Status:** Accepted + +**Context:** Gemini can hallucinate titles or return near-misses. Showing an +invented poster/title is worse than not showing the pick at all. + +**Decision:** AI suggestions are verified against TMDB before rendering +(`src/lib/recommendation-engine.ts`): first a direct fetch by the suggested +`tmdbId`; if that fails or is missing, a search fallback with normalized +title matching (`titlesMatch`). Verified results are cached (48 h staleTime) +and can be persisted back via `updateVerifiedRecommendations`. Unverifiable +titles render as text-only or are dropped. + +**Consequences:** +- The UI never fabricates media that doesn't exist. +- Extra TMDB calls on the recs pages — mitigated by 48 h caching and the fact + that only recs results (≤30 titles) are checked. + +--- + +## ADR-014 — GitHub Actions: immutable SHA pins + Node 24 runtimes + +**Status:** Accepted (updated 2026-08-16) + +**Context:** The deploy workflow pinned old action versions +(checkout v4, setup-node v4, pnpm/action-setup v4, wrangler-action v3) that +target the **Node 20** runner runtime. GitHub deprecated Node 20 on hosted +runners and now forces those actions onto Node 24 — producing deprecation +warnings and, eventually, breakage. + +**Decision:** Bump every action to the current major that runs on **node24** +and keep the repository's immutable-SHA pinning convention (full commit SHA + +`# vN` comment): +- `actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7` +- `actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7` + (keeps `node-version: 22` — the project runtime — with `cache: pnpm`) +- `pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6` +- `cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4` + (default wrangler version is now v4, matching the repo's wrangler v4) + +The newer checkout/setup-node majors contain breaking changes only around +`pull_request_target` / fork-PR checkout behavior, which this push-triggered +workflow never exercises. + +**Consequences:** +- No Node 20 deprecation warnings; the workflow is future-proof against the + Node 20 removal. +- SHA pinning keeps supply-chain integrity (no mutable tags in CI). +- Action updates now require a deliberate PR (as before). diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 00000000..903483b1 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,228 @@ +# Architecture Overview + +## 1. Tech stack + +| Layer | Technology | Where it lives | +| :--- | :--- | :--- | +| Framework | TanStack Start (file-based routing) + TanStack Router + React 19 | `src/router.tsx`, `src/start.ts`, `src/routes/` | +| Runtime / host | Cloudflare Workers (Nitro `cloudflare_module` preset) | `wrangler.toml`, `nitro.config.ts` | +| Database | Cloudflare D1 (SQLite) via Drizzle ORM | `src/server/db/`, `drizzle/` | +| Validation | Valibot (schemas shared between client and server fns) | `src/server/schema/`, `src/lib/tmdb-schemas.ts` | +| Auth | Clerk (`@clerk/react` client, `@clerk/backend` JWT verification) | `src/server/auth.ts`, `src/start.ts` | +| AI | Google Gemini over REST (`generativelanguage.googleapis.com`) | `src/server/ai.ts`, `src/lib/prompts/` | +| Media metadata | TMDB REST API (`@better-fetch/fetch` client) | `src/lib/tmdb.ts`, `src/lib/queries.ts` | +| Client data | TanStack Query (React Query) | `src/lib/query/` | +| Client state | Zustand (persisted to localStorage with LRU eviction) | `src/hooks/*-store.ts` | +| Styling | Tailwind CSS v4, Radix UI, shadcn-style components | `src/components/ui/`, `src/styles.css` | +| Tooling | Vite 7, Biome (lint+format), TypeScript strict, Wrangler | root config files | + +## 2. High-level diagram + +```text + ┌──────────────────────────────────────────────┐ + │ Browser (SPA + SSR) │ + │ React 19 · TanStack Router · TanStack Query │ + │ ClerkProvider · Zustand stores │ + └──────┬───────────────────────────┬───────────┘ + │ SSR (Node / Worker) │ client fetch + ▼ ▼ + ┌──────────────────────────────────────┐ ┌─────────────────────────┐ + │ Nitro (h3) — only 2 things │ │ TanStack Start RPCs │ + │ · /api/health (D1 ping) │ │ POST /_server-fn/* │ + │ · cron task "snapshots" (03:00) │ │ createServerFn handlers│ + └──────────────────────────────────────┘ └───────────┬─────────────┘ + │ + ┌────────────────────────▼────────────┐ + │ src/server/ (the backend) │ + │ auth.ts · rbac.ts · env.ts · ai.ts│ + │ fns/* (watchlist, lists, admin, │ + │ recommendations, import) │ + │ db/ (Drizzle client + schema) │ + └───────┬───────────────────┬─────────┘ + │ D1 (SQLite) │ Clerk API / Gemini REST / TMDB + ▼ ▼ + Cloudflare D1 External services +``` + +The same Worker serves both the static frontend (via the `ASSETS` binding, +`.output/public`) and the Nitro server (`.output/server/index.mjs`). + +## 3. The layers + +### 3.1 Routing & app shell (`src/router.tsx`, `src/start.ts`, `src/routes/`) + +- `src/router.tsx` builds the TanStack Router with a ClerkProvider wrapper, a + TanStack Query provider, SSR↔query integration, and default loader / + not-found / error components. +- `src/start.ts` creates the client start instance and — importantly — + customizes `serverFns.fetch` so every server-function RPC carries a fresh + Clerk session token in `Authorization: Bearer` (the server prefers this + header over cookies). It also installs a CSRF middleware scoped to server + functions. +- `src/routes/` holds file-based routes. Static shells (`search.tsx`, + `watchlist.tsx`, `recommendations.tsx`) only define metadata + search-param + validation; the actual UI lives in the `.lazy.tsx` variants + (`search.lazy.tsx`, `watchlist.lazy.tsx`, `recommendations.lazy.tsx`). +- `src/routeTree.gen.ts` is generated by the TanStack router plugin. + +### 3.2 Server functions (`src/server/fns/`) — the "API" + +Every mutating/authenticated operation is a TanStack Start server function: + +| Module | Responsibility | +| :--- | :--- | +| `watchlist.ts` | Read/watchlist queries, membership toggle (+batch), progress status, reactions, episode progress (single/season/show) | +| `lists.ts` | Custom-list CRUD + list-item toggling, enriched list reads | +| `import-export.ts` | Bulk JSON watchlist import (bounded D1 batches) | +| `recommendations.ts` | AI generation (watchlist/list/genre), homepage picks, history, feedback, rate limiting | +| `admin.ts` | Admin-only: user listing, roles, ban status, feature-flag permissions | +| `users.ts` | User upsert from Clerk identity + status | + +Server functions are: +- **Validated on input** — every fn uses a Valibot schema via `.validator()`, + so malformed payloads fail before touching the DB. +- **Typed on output** — every fn returns `ApiResult` (a + `{ ok: true, data } | { ok: false, code, message }` union from + `src/server/schema/common.ts`). The client unwraps with `unwrap()`. +- **Ownership-scoped** — reads filter by the resolved user id; writes require + `requireUser()`. + +### 3.3 Data access (`src/server/db/`) + +- `schema.ts` — the Drizzle SQLite schema (all 10 tables, indexes, checks; see + [data-model.md](./data-model.md)). +- `client.ts` — `getDb(env)` returns a cached Drizzle instance per D1 binding + (WeakMap keyed on the binding), plus `runBatch` for transactional round trips. +- `helpers/` — shared DB helpers: `watch-item.ts` (upsert/normalize) and + `snapshots.ts` (watchlist snapshot creation). + +### 3.4 Auth & authorization (`src/server/auth.ts`, `src/server/rbac.ts`) + +- `auth.ts` — extracts the Clerk token (Bearer header → cookie), verifies it + with `@clerk/backend`, resolves the `users` row (creating it on first + sign-in, race-safe via `onConflictDoNothing`), auto-consolidates duplicate + user rows, and exposes a short-lived in-memory user cache. +- `rbac.ts` — feature flags (`video-player`, `ai-recommendations`) evaluated + from a `role_permissions` table + dynamic user roles + a **global** kill + switch. Admin status is always read from Clerk (JWT claim or live API), + never from the DB. + +### 3.5 AI recommendation engine + +- `src/server/ai.ts` — `callGeminiAI()`: REST call with per-attempt timeout, + model fallback chain (`gemini-3.1-flash-lite` → `gemini-2.5-flash` → + `gemini-2.0-flash` → `gemini-1.5-flash`), retries, and per-element Valibot + validation of the JSON response. +- `src/lib/prompts/` — pure, dependency-free prompt builders (watchlist, + genre, custom list, homepage). +- `src/server/fns/recommendations.ts` — generation orchestration: auth + + feature gate, cooldown reservation (atomic insert), watchlist data + gathering, prompt building, Gemini call, de-duplication/filtering against + existing titles, and persistence. +- `src/lib/recommendation-engine.ts` — client-side TMDB verification: + resolves AI-suggested titles to real TMDB entries (direct fetch, then a + search fallback with title matching). + +### 3.6 Client state & mutations + +- **TanStack Query** owns server data. Query keys are centralized in + `src/lib/query/keys.ts` (user-scoped to avoid cross-account leaks). +- **Repository pattern** (`src/lib/repository/`) — the single entry point for + mutations. `useRepository()` returns `createRemoteRepository(...)` when + signed in (server fns + optimistic journal + request batching) or + `createLocalRepository(...)` when signed out (Zustand + localStorage). +- **Optimistic journal** (`src/hooks/pending-ops.ts`) — every write registers a + *replayable* op against the query cache; server snapshots are merged through + the journal so refetches can't clobber in-flight optimistic state. +- **Zustand stores** persist guest/local state: + `watchlist-store`, `local-lists-store`, `local-progress-store`, + `daily-pick-store`, `toast-store`. +- **Request batching** (`src/lib/batcher.ts`) — a generic debounce/max-wait + batcher used to coalesce watchlist membership writes and per-card season + detail fetches. + +### 3.7 UI components + +- `src/components/ui/` — shadcn-style primitives (button, dialog, dropdown, + tabs, select, sheet, toaster, image, etc.). +- `src/components/media/` — movie/TV detail-page blocks (cast, seasons, + episode browser, lightbox, watchlist status menu, player). +- `src/components/watchlist/`, `src/components/recommendations/`, + `src/components/admin/` — feature-specific surfaces. +- `src/components/media-card.tsx`, `homepage-media.tsx`, + `homepage-recommendations.tsx`, `daily-pick.tsx`, `video-player-modal.tsx` — + cross-cutting discovery widgets. + +## 4. Request flows + +### 4.1 Read a media detail page (SSR + client) + +1. Browser requests `/movie/123/some-slug`. The Worker (Nitro) streams the SSR + HTML; TanStack Start runs the route loader. +2. The route loader (`src/routes/movie/$id/{-$slug}/index.tsx`) calls + `getMovieDetails()` (TMDB, via `src/lib/queries.ts` + `tmdb.ts`) through + `context.queryClient.ensureQueryData`, so the query is serialized into the + HTML payload. +3. On the client, TanStack Query hydrates the cache; `useQuery` returns the + cached data with zero extra requests. +4. The watchlist button queries `getMediaState` (a server fn) per media id — + this returns the user's `watch_items` row for that title, or `null`. + +### 4.2 Mutate (toggle watchlist membership, signed in) + +1. User clicks the watchlist button → `useWatchlistToggle` → `repository.toggleMembership()`. +2. `createRemoteRepository` begins an optimistic op (`beginMembershipOp`), + which immediately patches `watchlist.list` and `watchlist.media-state` in + the query cache (instant UI). +3. The write is queued in `watchlistMembershipBatcher` (300 ms debounce / + 1.2 s max wait / dedupe by `mediaType:tmdbId`), then sent as + `setWatchlistMembership` (single) or `batchSetWatchlistMembership` (many) + server fn. +4. On success the server returns the authoritative row; `applyServerState` + merges it into the cache and the op is resolved (folded into the journal + base). On failure the op is removed and the cache is rebuilt from base + + remaining ops. +5. `scheduleSync` debounce-invalidates related keys so derived queries + (e.g. tracked TMDB ids) refresh once. + +### 4.3 Signed-out flow + +The same button calls the *local* repository: `useWatchlistStore` +(Zustand, persisted to localStorage with an LRU eviction wrapper). When the +user later signs in, `UserSync` (`src/components/user-sync.tsx`) exports the +local watchlist into the remote backend. + +## 5. Deployment & CI/CD + +- **Production build**: `vite build` → Nitro `cloudflare_module` preset → + `.output/server/index.mjs` + `.output/public`. +- **Deploy**: `wrangler deploy` (or GitHub Actions, see below). `wrangler.toml` + defines the `DB` D1 binding, the `ASSETS` binding, and the cron trigger. +- **GitHub Actions** (`.github/workflows/deploy.yml`): on push to + `cloudflare` / `feat/convex-to-traditional-backend` (or manual dispatch) — + checkout → pnpm setup → Node 22 → install → typecheck → apply D1 migrations + (prod) → build with `VITE_*` secrets → `wrangler deploy`. Actions are pinned + to node24-compatible versions (checkout v7, setup-node v7, pnpm/action-setup + v6, wrangler-action v4) so the workflow is not affected by the Node 20 + deprecation on GitHub runners. +- **Cron**: Cloudflare Cron Trigger `0 3 * * *` → Nitro task `snapshots` + (`server/tasks/snapshots.ts`) → `createDailySnapshots`, bounded per run and + resumable via a persisted cursor in `snapshot_cursors`. + +## 6. Key invariants / rules of the codebase + +1. **D1 is the single source of truth** for user data. No second database, no + Convex remnants. +2. **Admin status is never stored.** `users` has no `is_admin` column (it was + deliberately removed); admin comes from Clerk public metadata (JWT claim or + live API). +3. **Every server fn input is Valibot-validated**, every output is a typed + `ApiResult`. +4. **Every mutation is optimistic** and goes through the pending-op journal — + server snapshots are *replayed* through pending ops, never applied raw. +5. **Client and server share schema enums** (`mediaType`, `progressStatus`, + `reaction`, `feedback`) defined once in `src/server/schema/common.ts`. +6. **D1 batches are bounded** (≤100 statements) and chunked for large imports + so calls stay inside the Worker execution budget. +7. **Guest data is local-only** (Zustand + localStorage) and promoted to D1 on + sign-in. diff --git a/docs/client-layer.md b/docs/client-layer.md new file mode 100644 index 00000000..be28244d --- /dev/null +++ b/docs/client-layer.md @@ -0,0 +1,214 @@ +# Client Layer + +The client is a React 19 SPA rendered by TanStack Start (SSR on the Worker, +hydration in the browser). It combines TanStack Query (server data), +Zustand (local/guest state), and a repository pattern that hides whether a +mutation goes to the server or to local storage. + +## 1. App shell & bootstrapping + +- `src/start.ts` — client start instance. **Key behavior:** every server-fn + RPC is wrapped with a fresh Clerk session token + (`Authorization: Bearer `, minted/rotated by the Clerk SDK) and a 30 s + abort timeout. Also installs `createCsrfMiddleware` scoped to server fns so + cookie-derived sessions can't be abused cross-site. +- `src/router.tsx` — builds the router: `ClerkProvider` (shadcn theme) wraps + `QueryProvider`, which provides the TanStack Query client. Sets + `defaultStaleTime: 30s`, scroll restoration, case-sensitive routes, and the + default pending / not-found / error components. `setupRouterSsrQueryIntegration` + wires router loaders to the query cache with redirect handling. +- `src/routeTree.gen.ts` — generated route tree (do not edit). +- `src/routes/__root.tsx` — the root layout: meta tags, nav bar, footer, + mobile bottom nav, toaster, `UserSync`, skip-to-content link, and app CSS. + +## 2. Data fetching (TanStack Query) + +- `src/lib/query/query-client.ts` — `getContext()` creates a fresh QueryClient + per render/request with sane defaults (24 h staleTime, 30 min gcTime, retry 1, + no refetch on window focus). TMDB data is treated as fresh for a day to avoid + refetch churn, but `gcTime` (how long *unused* queries stay resident) is kept + short so visited page payloads are evicted from memory instead of + accumulating to hundreds of MB over a session. A fresh client per SSR + request keeps journal state (see pending-ops) from leaking between requests. +- `src/lib/query/root-provider.tsx` — React context provider for the client. +- `src/lib/query/devtools.ts` — dev-only React Query devtools toggle. +- `src/lib/query/keys.ts` — `queryKeys` factory: namespaced, user-scoped keys + (`watchlist.*`, `lists.*`, `permissions`, `admin.*`, + `recommendations.*`). User-scoping (`?? "anonymous"`) prevents cached data + from leaking across accounts. +- `src/lib/queries.ts` — TMDB query functions used by routes/components + (`getMediaList`, `getMovieDetails`, `getTvDetails`, `getCredits`, + `getSearchResult`, `getPersonDetails`, ...). `MEDIA_LIST_PATHS` is the single + source of truth for list endpoints; `safeFetch` logs rich errors in dev. +- `src/lib/tmdb.ts` — the `@better-fetch/fetch` client for TMDB: bearer + token, 15 s timeout, linear retry (2 attempts) on 408/429/5xx. +- `src/lib/tmdb-schemas.ts` — Valibot schemas for every TMDB response shape + (742 lines). Query functions validate responses against these. +- `src/lib/server-types.ts` — client-side aliases of D1 row types + (`WatchItemRow`, `EpisodeProgressRow`, `CustomListRow`, ...). + +## 3. State management (Zustand) + +| Store | File | Purpose | +| :--- | :--- | :--- | +| `useWatchlistStore` | `src/hooks/watchlist-store.ts` | Guest watchlist (`mediaState`), persisted to localStorage with LRU eviction; mutators `setWatchlistMembershipLocal`, `setProgressStatusLocal`, `setReactionLocal`, `setProgressLocal`, `importWatchlistLocal` | +| `useLocalListsStore` | `src/hooks/use-local-lists-store.ts` | Guest custom lists | +| `useLocalProgressStore` | `src/hooks/use-local-progress-store.ts` | Guest episode/progress state (`lastPlayed`, watched episodes) | +| `useDailyPickStore` | `src/hooks/use-daily-pick-store.ts` | Daily-pick seed/date bookkeeping | +| `useToastStore` | `src/hooks/use-toast-store.ts` | Toast notifications | + +- `src/lib/utils.ts` — `createLRUStorage()` wraps localStorage with LRU + eviction (~4 MB threshold) so several persisted stores can't blow the quota; + `createMemoryStorage()` is the SSR-safe fallback. Also: `cn` (clsx + + tailwind-merge), `normalizeProgressStatus`, `validateId` / + `parseAndValidateId` (strict TMDB id parsing), and `formatMediaTitle` + (slug encode/decode with diacritic stripping). + +## 4. The repository pattern (`src/lib/repository/`) + +The mutation layer that eliminated the old `if (isSignedIn)` branches: + +- `types.ts` — `WatchlistRepository` + `ListsRepository` interfaces and the + shared `resolveProgressStatusAction` decision tree (TV vs movie progress + writes: mark watched, leave completion, episode sync needed, progress value). +- `use-repository.ts` — `useRepository()` returns the remote implementation + when signed in, the local one otherwise (memoized per auth state). +- `remote-repository.ts` — server-backed implementation: + - watchlist membership writes go through a shared `RequestBatcher` + (300 ms debounce / 1.2 s max wait / dedupe by `mediaType:tmdbId` / + flush on page hide), then `setWatchlistMembership` or + `batchSetWatchlistMembership`; the authoritative rows are merged into the + cache with `applyServerState`. + - progress status / reactions / episode syncs run through + `runJournaledMutation` (begin op → run fn → resolve/rollback → schedule + sync). TV writes fetch show details first to build the season/episode + selection (`buildSeasonEpisodeSelections`). + - custom-list CRUD wraps each server fn with optimistic ops + id swapping + (optimistic temp id → real id) + cache sync. +- `local-repository.ts` — the same interface against the Zustand stores + (watchlist store + local lists/progress stores). TV progress uses the same + `resolveProgressStatusAction` and `buildSeasonEpisodeSelections`. + +## 5. Optimistic updates (`src/hooks/pending-ops.ts`) + +A replayable journal for array-shaped query caches (watchlist, lists): + +- `beginOp(queryClient, entries)` registers a set of pure `apply(rows)` patches + and applies them immediately. **Throws during SSR** — optimistic ops are + client-only by construction. +- Journal state is scoped to the QueryClient via a WeakMap (never module-level + globals), so concurrent SSR requests can't bleed into each other. +- Ops that touch the same rows supersede each other (latest intent wins), + matching the server batcher's dedupe. +- `reconcileListFetch` / `applyServerState` merge fresh server snapshots by + *replaying still-pending ops on top*, so a snapshot computed before a write + committed can never clobber newer optimistic state (kills the UI-flicker + race). +- `resolve` (success) folds the op into the journal base; `remove` (failure) + rebuilds the cache from base + remaining ops — a failed write rolls back + only its own rows, not the whole array. +- `scheduleSync` debounces cache invalidations (250 ms) so N rapid mutations + produce one refetch. +- `clearPendingOps` is called on sign-out. + +Optimistic op builders live in: +- `src/hooks/watchlist/watchlist-optimistic.ts` — membership/progress/reaction/ + mark-show op builders. +- `src/hooks/custom-lists/list-optimistic.ts` — list CRUD op builders + (`beginCreateListOp`, `beginToggleListItemOp`, `swapListId`, ...). +- `src/hooks/optimistic-helpers.ts` — small shared helpers. + +## 6. Feature hooks + +- `use-watchlist.ts` — read hook for the signed-in watchlist (list, tracked + ids, media state, episodes) via `watchlist-queries.ts`. +- `use-watchlist-import-export.ts` — export/import of watchlists (JSON), + including the local→remote promotion on sign-in. +- `use-custom-lists.ts` — custom-list reads + mutations (delegates to the + repository). +- `use-recommendations.ts` — AI recommendation queries/mutations (history, + generate, feedback, verified resolution). +- `use-daily-pick.ts` — daily-pick selection logic (seeded randomness, media + interleaving, scoring) extracted from the `daily-pick.tsx` component. +- `use-season-details.ts` — batched TV season-detail fetching (a shared + `RequestBatcher` so a continue-watching strip of N cards coalesces its TMDB + requests). +- `use-filtered-watchlist.ts` — filter/sort state for the watchlist page. +- `use-permissions.ts` — client-side RBAC summary (roles, features, admin, + banned) from `getUserFeaturesFn`. +- `use-watch-progress` (`src/hooks/watch-progress/`) — player progress + tracking: `use-watch-progress.ts` (677 lines), `use-player-listener.ts` + (postMessage listener that trusts sources by origin, with a DOM-scan + fallback), `progress-helpers.ts` (pure progress math + types). + +## 7. Routing & pages (`src/routes/`) + +- Static shells with head metadata + search-param validation: `search.tsx`, + `watchlist.tsx`, `recommendations.tsx`, `admin.tsx`, `disclaimer.tsx`. +- Lazy UI variants: `search.lazy.tsx`, `watchlist.lazy.tsx`, + `recommendations.lazy.tsx`. +- Discovery pages: `index.tsx` (homepage with trending rows, daily pick, AI + picks), `list.$type.$slug.tsx` (popular/top-rated/... lists with + pagination), `person.$id.tsx`, `keyword.$id.tsx`, + `collection.$id.{-$slug}.tsx`. +- Detail pages: `movie/$id/{-$slug}/index.tsx` (+ `media.tsx`, + `cast-crew.tsx`) and `tv/$id/{-$slug}/index.tsx` (+ `seasons.tsx`, + `season.$seasonNumber.tsx`, `media.tsx`, `cast-crew.tsx`). All use + `useCanonicalSlugRedirect` to normalize `/{id}/{slug}` URLs. +- `api.metaimage.ts` — OG-image redirect endpoint: resolves a title to its + TMDB poster/backdrop and 302-redirects to a cached image URL (with + placeholder fallback). + +## 8. Components (`src/components/`) + +- `ui/` — shadcn-style primitives + `media-grid.tsx`, `search-bar.tsx`, + `lazy-section.tsx`, `auto-scroll-title.tsx`, `toaster.tsx`, `image.tsx`. +- `media/` — detail-page blocks: `media-container.tsx` (layout), + `media-title-container.tsx`, `media-video-image-container.tsx`, + `media-poster-trailer-container.tsx`, `watchlist-status-menu.tsx`, + `reaction-selector.tsx`, `cast-section.tsx`, `media-credit-section.tsx`, + `season-container.tsx`, `current-season.tsx`, `inline-episode-browser.tsx`, + `collections.tsx`, `genre-container.tsx`, `media-keywords.tsx`, + `media-lightbox-dialog.tsx`, `rating-count.tsx`, `media-description.tsx`, + `media-recommendation.tsx`. +- `watchlist/` — `watchlist-grid.tsx`, `watchlist-card.tsx`, + `watchlist-filters.tsx`, `list-collage.tsx`, `custom-list-view.tsx`, + `custom-list-card.tsx`, `custom-list-media-card.tsx`, + `silent-error-boundary.tsx`. +- `recommendations/` — `recommendation-filters.tsx`, `recommendation-results.tsx`, + `recommendation-history.tsx`, `loading-skeletons.tsx`, `recommendation-utils.ts`. +- `admin/` — `admin-dashboard.tsx`, `admin-user-table.tsx` (orchestrator), + `admin-user-row.tsx`, `admin-role-dialog.tsx`, `admin-permission-toggles.tsx`, + `use-admin-users.ts` (data hook). +- Top-level widgets: `navbar.tsx`, `footer.tsx`, `mobile-bottom-nav.tsx`, + `desktop-nav-button.tsx`, `media-card.tsx`, `homepage-media.tsx`, + `homepage-recommendations.tsx`, `daily-pick.tsx`, `video-player-modal.tsx`, + `watchlist-button.tsx`, `custom-list-dialog.tsx`, `custom-list-picker.tsx`, + `filter-bar.tsx`, `share-button.tsx`, `scroll-container.tsx`, + `user-sync.tsx`, `banned-screen.tsx`, `go-back.tsx`, `default-loader.tsx`, + `default-not-found.tsx`, `default-empty-state.tsx`. + +## 9. Cross-cutting client libraries + +- `src/lib/batcher.ts` — generic `RequestBatcher` (debounce / max-wait / + max-batch-size / dedupe-by-key / flush-on-page-hide) used for watchlist + membership writes and season-detail fetches. +- `src/lib/media-transform.ts` — pure TMDB→UI transforms (genre mapping, + video splitting, cast/crew mapping, backdrop/poster URL building, + certifications, runtime formatting). +- `src/lib/media-page.ts` — `buildSharedMediaPageData` shared by movie/TV + detail pages (title, slug, images, cast, videos). +- `src/lib/canonical-slug-redirect.ts` — `useCanonicalSlugRedirect` hook that + redirects non-canonical `/{type}/{id}/{slug}` URLs to the canonical one. +- `src/lib/meta-image-tags.ts` — OpenGraph/Twitter meta-tag generator. +- `src/lib/media-dialog-helpers.ts` — dialog state stored in the URL search + params (video/backdrop/poster). +- `src/lib/search-history.ts` — localStorage-backed search history (max 8). +- `src/lib/recommendation-engine.ts` — client-side TMDB verification of + AI-suggested titles: `useTmdbData` (direct fetch) + `useTmdbSearchFallback` + (search with `titlesMatch` normalization). +- `src/constants.ts` — site config, nav items, genre list, image URL prefixes, + RBAC labels, placeholder image. +- `src/constants/watchlist.ts` — watchlist-specific constants. +- `src/types.d.ts` — Pebbly-specific domain types (`MediaType`, + `ProgressStatus`, `ReactionStatus`, `AIRecommendation`). diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 00000000..9025f950 --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,97 @@ +# Contributing to the Docs + +This guide explains **when** and **how** to keep `docs/` accurate so the +documentation never silently drifts from the code. + +## Why this exists + +The docs exist so anyone — including a future AI agent — can answer "what is +this code and why is it shaped this way?" without re-reading 30k lines. That +only works if docs are updated **in the same changeset** as the code they +describe. A stale doc is worse than no doc. + +## The docs map + +| File | Keep updated when... | +| :--- | :--- | +| `README.md` (this folder) | Adding/removing a doc file; the index table changes | +| `architecture.md` | The stack, layers, request flows, deployment, or invariants change (new service, new layer, new infra) | +| `server-layer.md` | Adding/renaming/removing a server fn, Nitro route/task, auth/RBAC logic, AI behavior | +| `client-layer.md` | Adding/renaming/removing hooks, stores, the repository layer, routing, key components/libraries | +| `data-model.md` | Any schema change (table, column, index, constraint) or new migration | +| `architecture-decisions.md` | A significant decision is made (see "Writing an ADR" below) | +| `file-reference.md` | **Any** file is added, renamed, moved, or deleted | + +`file-reference.md` is the safety net: it should always match the repository +exactly, so a change that touches code always touches at least that one doc. + +## When to update (checklist by change type) + +- **New or changed server function** → `server-layer.md` §6 (add a row to the + relevant module table or the per-fn bullet list) + `file-reference.md`. +- **Schema / migration change** → `data-model.md` (table/column/index row + + the migration table) + `file-reference.md` (if a migration file was added). +- **New hook, store, or query key** → `client-layer.md` (stores table, + hooks list, or query section) + `file-reference.md`. +- **New route or component** → `file-reference.md` (route table / component + section). Only touch `client-layer.md` if the route adds a new *pattern*. +- **New dependency or infra change** → `architecture.md` (stack table, + diagram, deployment section). +- **Behavioral decision** → write an ADR (below) *and* mention it in the + relevant layer doc. + +## Writing an ADR + +Add a new entry to `architecture-decisions.md`, keeping the numbering. Use the +same four-part format as existing entries: + +```markdown +## ADR-0XX — + +**Status:** Accepted | Superseded + +**Context:** What problem or tension motivated this? (2–4 sentences — include +the option that was rejected and why.) + +**Decision:** What was decided, concretely. Name the files/modules involved. + +**Consequences:** What it costs or enables. Include tradeoffs and anything a +future reader must know before reversing it. +``` + +Rules: +- One decision per ADR. Small implementation details do **not** warrant one. +- Reference the code (file paths, function names) so the ADR is verifiable. +- When an ADR is superseded, mark the old one `**Status:** Superseded` and + link to the new one instead of rewriting history. + +## Conventions + +- **Line counts are approximate** (as of a date). When a file's size changes + materially (a refactor, a split), update its figure — or drop the number if + it's churn-prone. Never treat them as authoritative. +- **Mark generated files.** Anything produced by a tool + (`src/routeTree.gen.ts`, `.output/`, `drizzle/meta/`, `pnpm-lock.yaml`) is + listed so people don't edit it, but never documented in depth. +- **Note legacy leftovers.** Stale/unused artifacts get a short "Legacy + leftovers" mention (see `file-reference.md`) so nobody assumes they're live. +- **Be concise.** One or two sentences per file/table row. If a row needs a + paragraph, the code probably needs a comment instead. +- **Prefer "why" over "what".** The file-reference tells you what a file is; + the ADRs and inline code comments tell you why it exists. +- **Keep relative links valid.** Every `[text](./file.md)` must resolve; run a + quick check after renaming a doc file. + +## Verification + +- Docs-only changes don't need `pnpm typecheck` / `pnpm lint` — but if your + changeset also touches code, run them as usual. +- Before finishing, re-read the section of `file-reference.md` you touched and + confirm it matches what you actually changed. +- Confirm the docs folder is **not** gitignored (`.gitignore` must not contain + a `docs` entry) — if it is, the documentation will silently never ship. + +## Process reminder + +Update the docs **in the same commit** as the code change. Docs written a week +later are written from memory and are usually wrong. diff --git a/docs/data-model.md b/docs/data-model.md new file mode 100644 index 00000000..6ff70ee7 --- /dev/null +++ b/docs/data-model.md @@ -0,0 +1,224 @@ +# Data Model (Cloudflare D1) + +Defined in `src/server/db/schema.ts` (Drizzle SQLite) and applied to D1 via +the SQL migrations in `drizzle/` (generated with `pnpm db:generate`, applied +with `wrangler d1 migrations apply pebbly [--local|--remote]`). + +Conventions: + +- **IDs**: `text` primary keys — `crypto.randomUUID()` at write time (or a + `clerk|` token identifier for users). +- **Timestamps**: integer **milliseconds since epoch** (`Date.now()`). +- **Enums**: `text` columns with a Drizzle `enum` type. The allowed values are + defined once in `src/server/schema/common.ts` and shared client/server. +- **Foreign keys**: `ON DELETE cascade` — child rows are removed with their + parent. +- **JSON-ish columns**: `text` with `{ mode: "json" }` (Drizzle serializes a + typed array/object to JSON text and back). + +## Tables + +### users + +Identity for signed-in users, mirrored from Clerk. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | uuid | +| `token_identifier` | text, **unique** | `clerk|` (legacy formats supported at lookup time) | +| `name` / `image` / `email` | text | profile snapshot from Clerk claims | +| `roles` | text (json) | dynamic RBAC roles: `video-player`, `ai-integrations` | +| `is_banned` | boolean | default `false` | + +> **No `is_admin` column.** Admin status lives in Clerk's public metadata +> (JWT claim or live API). The column existed in the initial migration +> (`0000`) and was dropped in `0003` — see ADR-004. + +### watch_items + +One row per (user, TMDB title). The heart of the watchlist. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `tmdb_id` | integer | | +| `media_type` | text enum | `movie` \| `tv` | +| `in_watchlist` | boolean | default `false` — a row can survive removal to keep progress/reactions | +| `progress_status` | text enum | `watch-later` \| `watching` \| `done` \| `dropped` | +| `reaction` | text enum | `loved` \| `liked` \| `mixed` \| `not-for-me` \| `recommended` | +| `progress` | integer 0–100 | check constraint | +| `title` / `image` / `overview` / `release_date` | text | denormalized metadata snapshot for list rendering | +| `rating` | real 0–10 | check constraint | +| `updated_at` | integer | ms epoch, drives "recently updated" ordering | + +Indexes: `(user_id, tmdb_id, media_type)` **unique** · `(user_id, progress_status)` · +`(user_id, updated_at)`. Checks: `progress between 0 and 100`, +`rating between 0 and 10`. + +### episode_progress + +Per-episode watched state for TV shows. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `tmdb_id` | integer | | +| `season` / `episode` | integer | | +| `is_watched` | boolean | default `false` | +| `updated_at` | integer | | + +Index: `(user_id, tmdb_id, season, episode)` **unique** — covers (user), +(user, show), and (user, show, season) lookups with leftmost-prefix rules +(replacing four Convex indexes). + +### watchlist_snapshots + +Immutable history of "what was in my watchlist" — the daily cron output and +the source of the "recently added" / account activity view. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `items` | text (json) | `[{ tmdbId, mediaType }]` | +| `created_at` | integer | | + +Index: `(user_id, created_at)`. Snapshots are only written when the current +watchlist differs from the latest snapshot (see `helpers/snapshots.ts`). + +### lists + +Custom user lists (including the auto-created **Pebbly Picks** list). + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `name` | text | unique per user | +| `color` / `visibility` / `list_type` | text | display + `pebbly-picks` type marker | +| `sort_order` | integer | default 0, drives ordering | +| `created_at` / `updated_at` | integer | | + +Indexes: `(user_id, name)` **unique** · `(user_id, sort_order)`. + +### list_items + +Membership of a title in a list. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `list_id` | text FK → lists | cascade (deleting a list deletes its items) | +| `tmdb_id` / `media_type` | integer / enum | | +| `added_at` | integer | | +| `title` / `image` / `backdrop` / `overview` / `release_date` | text | metadata snapshot | +| `rating` | real | | + +Indexes: `(list_id, tmdb_id, media_type)` **unique** · +`(user_id, tmdb_id, media_type)` (covers user-level lookups). + +### ai_recommendations + +One row per AI generation; doubles as the rate-limit/cooldown marker. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `recommendations` | text (json) | final (possibly verified) list | +| `original_recommendations` | text (json) | pre-verification snapshot | +| `watchlist_hash` | text | hash of the input watchlist at generation time | +| `input_stats` | text (json) | movie/tv/episode/total counts | +| `model` | text | Gemini model used | +| `media_type_preference` / `genre_preference` / `generation_type` | text | generation inputs | +| `verified` | boolean | TMDB verification completed | +| `created_at` | integer | | + +Index: `(user_id, created_at)`. A *pending* generation is inserted with +`model: "pending"` and `recommendations: []` to reserve the cooldown slot; +it is updated in place on success or deleted on failure. + +### homepage_recommendations + +The "Picks For You" widget state — one row per user. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users, **unique** | one row per user | +| `recommendations` | text (json) | current picks | +| `previous_recommendations` | text (json) | previous set (for rotation) | +| `last_attempted_at` / `last_updated_at` | integer | ms epoch | +| `status` | text | `none` \| `success` \| `failed` | + +The 24 h refresh + 1 h failure-retry logic is driven by +`last_attempted_at`/`status` (see `fns/recommendations.ts`). + +### recommendation_feedback + +Thumbs up/down on recommended titles — trains future generations. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `id` | text PK | | +| `user_id` | text FK → users | cascade | +| `tmdb_id` / `media_type` | integer / enum | | +| `title` | text | | +| `feedback` | text enum | `like` \| `not_interested` \| `dislike` | +| `updated_at` | integer | | + +Indexes: `(user_id, tmdb_id, media_type)` **unique** · +`(user_id, feedback)` (drives homepage/generation exclusion lookups). + +### role_permissions + +RBAC feature flags, including the `global` kill switch. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `role` | text | `global` \| `video-player` \| `ai-integrations` | +| `feature` | text | `video-player` \| `ai-recommendations` | +| `enabled` | boolean | default `true` | + +Primary key: `(role, feature)`. Seeded/defaulted by `syncRolePermissions` +(see [server-layer.md](./server-layer.md#5-rbac-srcserverrbacts)). + +### snapshot_cursors + +Keyset-pagination cursor for the daily cron task. + +| Column | Type | Notes | +| :--- | :--- | :--- | +| `key` | text PK | e.g. `watchlist_snapshot_cursor` | +| `value` | text | last processed user id | +| `updated_at` | integer | | + +## Migrations (`drizzle/`) + +| Migration | What changed | +| :--- | :--- | +| `0000_dear_warbound.sql` | Initial schema — all tables, indexes, checks. `users` still had `is_admin` | +| `0001_slippery_cammi.sql` | Table rebuilds: `role_permissions` gets a real composite PK; `list_items.rating` and `watch_items.rating` switch from `integer` to `real` | +| `0002_cute_bloodstrike.sql` | Adds `snapshot_cursors` | +| `0003_petite_sugar_man.sql` | Drops `users.is_admin` (admin now read from Clerk only) | + +> `drizzle-kit generate` (via `drizzle.config.ts`) produces these from the +> schema. They are applied to D1 with `wrangler d1 migrations apply`, so the +> config needs no live DB connection. + +## Data-integrity rules enforced in code (not just schema) + +- **Concurrent first sign-in** — `requireUser` inserts with + `onConflictDoNothing` and re-reads the canonical row, so two parallel + requests for a brand-new user can't 500 on the unique `token_identifier`. +- **Concurrent watch-item upsert** — `upsertWatchItem` uses + `onConflictDoUpdate` on `(user_id, tmdb_id, media_type)` so a write that + loses the race still applies its state to the winner's row. +- **Duplicate-name lists** — unique index + `onConflictDoNothing` turns a race + into a clean `CONFLICT`. +- **Bounded batches** — every multi-statement write uses `runBatch` (one D1 + round trip) and chunks at ≤100 statements; episode INSERTs chunk at 14 rows + (7 bound params each) to respect D1's 100-parameter cap. diff --git a/docs/file-reference.md b/docs/file-reference.md new file mode 100644 index 00000000..83823f8f --- /dev/null +++ b/docs/file-reference.md @@ -0,0 +1,238 @@ +# File Reference + +A per-file map of the repository: what each file is and why it exists. Line +counts are approximate (as of 2026-08-16). Entries are grouped by directory. + +--- + +## Root configuration + +| File | What it is | +| :--- | :--- | +| `package.json` | App metadata + scripts (`dev`, `build`, `db:*`, `deploy:cf`, `typecheck`, `lint`, `format`), deps (TanStack Start/Router/Query, React 19, Drizzle, Valibot, Clerk, h3, Nitro, Tailwind 4, Zustand, better-fetch, lucide) and dev deps (Vite 7, Wrangler, Biome, drizzle-kit, husky, lint-staged). `packageManager: pnpm@10.6.1`. | +| `pnpm-workspace.yaml` | Empty workspace config; declares dependency trust policies (allowlist of packages that may run install scripts, e.g. `esbuild`, `@clerk/shared`) and `minimumReleaseAge`. | +| `pnpm-lock.yaml` | Lockfile for reproducible installs. | +| `tsconfig.json` | Strict TS config (`strict`, `noUnusedLocals/Parameters`), bundler module resolution, `@/*` → `./src/*` path alias, `noEmit` (Vite builds). | +| `vite.config.ts` | Vite build: Nitro plugin, TanStack Start plugin, React plugin with the React Compiler Babel plugin, Tailwind v4, path aliases. Terser minification with `drop_console` in prod, manual vendor chunking (react, tanstack, clerk, radix, icons), `envPrefix: ["VITE_"]` (only `VITE_*` vars reach the client). | +| `nitro.config.ts` | Nitro server config: scans `server/`, enables the task system, maps cron `0 3 * * *` → task `snapshots`, adds cache-control (assets) + security headers, and switches to the `cloudflare_module` preset in production. | +| `wrangler.toml` | Cloudflare Worker definition: name `pebbly`, entry `.output/server/index.mjs`, `nodejs_compat` flag, `ASSETS` binding for static files, `DB` D1 binding (+migrations dir), cron trigger `[triggers] crons = ["0 3 * * *"]`, observability (logs + traces). | +| `drizzle.config.ts` | Drizzle Kit *generate-only* config: SQLite dialect, schema `src/server/db/schema.ts`, output `drizzle/`. No driver needed (migrations are applied by wrangler). | +| `drizzle.studio.config.ts` | Drizzle Studio dashboard config for the **remote** D1 DB via `d1-http` (needs `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID`). Parses the `database_id` out of `wrangler.toml` (top-level only, so `[env.*]` blocks can't shadow it). | +| `biome.json` | Biome lint/format config: tabs, double quotes, organize-imports assist; `routeTree.gen.ts` and `styles.css` excluded; a11y `noSvgWithoutTitle` off. | +| `postcss.config.ts` | PostCSS config for Tailwind v4. | +| `components.json` | shadcn/ui component registry config. | +| `.prettierrc` | Prettier fallback config (Biome is the primary formatter). | +| `.env.example` | Documented env template: Clerk, TMDB, Gemini, Cloudflare vars. | +| `.env` / `.env.local` / `.dev.vars` | Local secrets (gitignored); `.dev.vars` feeds `wrangler dev`. | +| `.gitignore` | Ignored paths (node_modules, .output, .wrangler, .vercel, env files, etc.). | +| `.husky/pre-commit` | Husky git hook running `lint-staged` (Biome check on staged files). | +| `README.md` | Project readme: features, stack, setup, scripts, deployment. | +| `REFACTOR_PLAN.md` | The Convex→D1 refactoring plan with issue catalog, phased execution plan, and progress log (valuable historical context). | +| `.cta.json`, `.commandcode/`, `.agents/` | Local agent/tooling metadata (not part of the app). | + +## `server/` — Nitro layer (framework-agnostic entry points) + +| File | What it is | +| :--- | :--- | +| `routes/api/health.ts` | `GET /api/health` — pings D1 (`select 1`), returns `{ ok, service, timestamp, checks, durationMs }`; `503` when the DB is unavailable; never leaks raw DB errors (public endpoint). Skips the DB check when there's no binding (plain `vite dev`). | +| `tasks/snapshots.ts` | Nitro task `snapshots` run by the `0 3 * * *` cron. Reads/persists the `watchlist_snapshot_cursor`, calls `createDailySnapshots` (≤200 users/run), returns a run summary. | + +## `drizzle/` — SQL migrations + +| File | What it is | +| :--- | :--- | +| `0000_dear_warbound.sql` | Initial schema: all 10 tables + indexes + check constraints (`users` still had `is_admin`). | +| `0001_slippery_cammi.sql` | Table rebuilds: `role_permissions` gains a real composite PK; `list_items.rating` / `watch_items.rating` become `real`. | +| `0002_cute_bloodstrike.sql` | Adds `snapshot_cursors`. | +| `0003_petite_sugar_man.sql` | Drops `users.is_admin` (admin now resolved from Clerk only). | +| `meta/` | Drizzle Kit journal metadata (which migrations are applied). | + +## `.github/workflows/` — CI/CD + +| File | What it is | +| :--- | :--- | +| `deploy.yml` | Deploy to Cloudflare on push to `cloudflare` / `feat/convex-to-traditional-backend` or manual dispatch. Steps: checkout → pnpm setup → Node 22 → `pnpm install --frozen-lockfile` → `pnpm typecheck` → D1 migrations (prod) → `pnpm build` with `VITE_*` secrets → `wrangler deploy`. `concurrency` serializes prod jobs. All actions pinned to node24 runtimes (checkout v7, setup-node v7, pnpm/action-setup v6, wrangler-action v4) — see ADR-014. | + +## `src/` — application root + +| File | What it is | +| :--- | :--- | +| `start.ts` | Client `createStart` instance: custom `serverFns.fetch` attaches a fresh Clerk Bearer token + 30 s abort timeout; `createCsrfMiddleware` protects server-fn RPCs from cross-site abuse. | +| `router.tsx` | `getRouter()` builds the TanStack Router: routeTree, ClerkProvider (shadcn theme) + QueryProvider wrappers, SSR↔query integration, defaults (staleTime 30 s, pending/not-found/error components, scroll restoration). | +| `routeTree.gen.ts` | **Generated** route tree (TanStack router plugin). Do not edit. | +| `styles.css` | Tailwind v4 global styles + design tokens. | +| `types.d.ts` | Pebbly domain types: `MediaType`, `MediaQuery`/`MediaListQuery`, `ProgressStatus`, `ReactionStatus`, `AIRecommendation`. | +| `constants.ts` | `SITE_CONFIG` (name, URL, nav), `MEDIA_PAGE_SLUGS`, `GENRE_LIST`, `IMAGE_PREFIX` (TMDB image size URLs), `MAX_PAGINATION_LIMIT`, RBAC labels, placeholder image. | +| `constants/watchlist.ts` | Watchlist-specific constants. | + +## `src/server/` — backend + +| File | What it is | +| :--- | :--- | +| `env.ts` | Worker env access: `getEnv()` reads `globalThis.__env__` (Nitro) with `process.env` fallback; `validateEnv()` (once per isolate) validates string vars with Valibot and logs actionable warnings (loud for missing `CLERK_SECRET_KEY`). | +| `auth.ts` | Clerk session handling: `getSessionToken` (Bearer → cookie), `getSessionClaims` (JWT verify), `requireUser` (resolve-or-create user, race-safe, consolidates duplicates), `getCurrentUser`, `findUserByClaims` (multi-format tokenIdentifier + 15 s cache), admin helpers (`isAdminFromClerkApi`, `getClerkAdminIds`). | +| `rbac.ts` | Feature-flag RBAC: `hasFeature`, `getUserFeatures`, `syncRolePermissions`; admin short-circuits from Clerk (never a stored flag); `global` kill switch + per-role permission rows + `DEFAULT_PERMISSIONS`. | +| `ai.ts` | `callGeminiAI` — Gemini REST client: model fallback chain, per-attempt timeout, per-element Valibot validation, high-demand/503 detection, retries. | +| `db/client.ts` | `getDb(env)` — cached Drizzle D1 instance per binding (WeakMap), fail-fast on a missing `DB` binding, `runBatch` for bounded transactional batches. | +| `db/schema.ts` | The Drizzle schema for all 10 tables (see [data-model.md](./data-model.md)). | +| `helpers/watch-item.ts` | Shared watch-item logic: `getWatchItem`, `normalizeProgressStatus`/`normalizeReaction`, `buildMetadataPatch` (rating clamped 0–10), `upsertWatchItem` (race-safe upsert on `(user, tmdb, mediaType)`). | +| `helpers/snapshots.ts` | `createWatchlistSnapshot` (dedupe against latest) and `createDailySnapshots` (keyset-paginated, bounded per run). | +| `fns/watchlist.ts` | Watchlist + episode server fns (see [server-layer.md](./server-layer.md#6-server-functions-srcserverfns)). | +| `fns/lists.ts` | Custom-list CRUD + item toggling + enriched reads. | +| `fns/import-export.ts` | Bulk watchlist import with bounded D1 batches. | +| `fns/recommendations.ts` | AI generation, homepage picks, history, feedback, cooldown/rate limiting. | +| `fns/admin.ts` | Admin-only user/role/permission management. | +| `fns/users.ts` | `storeUser` upsert + `getStatus`. | +| `schema/common.ts` | Shared enums (`mediaType`, `progressStatus`, `reaction`, `feedback`), `metadataSchema`, the `ApiResult` contract, `ok`/`fail`, `ApiError`, `unwrap`. | +| `schema/watchlist.ts` | Valibot schemas for every watchlist server-fn argument. | +| `schema/lists.ts` | Valibot schemas for list server fns. | +| `schema/recommendations.ts` | Valibot schemas for recommendation server fns + result shapes. | +| `schema/admin.ts` | Valibot schemas for admin server fns. | +| `schema/import.ts` | Valibot schema for watchlist import payloads. | + +## `src/lib/` — client/shared utilities + +| File | What it is | +| :--- | :--- | +| `tmdb.ts` | `tmdbFetch` — `@better-fetch/fetch` client for TMDB (Bearer token, 15 s timeout, linear retry on 408/429/5xx). | +| `tmdb-schemas.ts` | Valibot schemas for every TMDB response shape (742 lines). | +| `queries.ts` | Typed TMDB query functions (`getMediaList`, `getMovieDetails`, `getTvDetails`, `getCredits`, `getSearchResult`, `getPersonDetails`, ...) with `MEDIA_LIST_PATHS` as the endpoint map and dev-only error logging. | +| `batcher.ts` | Generic `RequestBatcher`: debounce/max-wait/max-batch-size/dedupe-by-key, optional flush-on-page-hide + dispose. | +| `utils.ts` | `cn`, `normalizeProgressStatus`, `createLRUStorage`/`createMemoryStorage` (localStorage quota management), `validateId`/`parseAndValidateId`, `formatMediaTitle` (slug encode/decode). | +| `media-transform.ts` | Pure TMDB→UI transforms: genre lookup, video split, cast/crew, backdrops/posters with size prefixes, certifications, runtime. | +| `media-page.ts` | `buildSharedMediaPageData` — shared data shape for movie/TV detail pages. | +| `media-dialog-helpers.ts` | Dialog state stored in URL search params (video/backdrop/poster lightbox). | +| `canonical-slug-redirect.ts` | `useCanonicalSlugRedirect` — 301-style client redirect to the canonical `/{type}/{id}/{slug}` URL. | +| `meta-image-tags.ts` | `MetaImageTagsGenerator` — OpenGraph/Twitter meta tags. | +| `search-history.ts` | localStorage search history (max 8 items). | +| `server-types.ts` | Client-side aliases of D1 row types. | +| `recommendation-engine.ts` | Client-side TMDB verification of AI titles: `normalizeTmdbData`, `titlesMatch`, `useTmdbData`, `useTmdbSearchFallback`. | +| `repository/types.ts` | `WatchlistRepository` + `ListsRepository` interfaces + `resolveProgressStatusAction`. | +| `repository/remote-repository.ts` | Server-backed repository: optimistic journal + membership batcher + journaled mutations + list ops with id swapping. | +| `repository/local-repository.ts` | Zustand-backed repository for signed-out users. | +| `repository/use-repository.ts` | `useRepository()` — picks remote vs local by auth state. | +| `prompts/index.ts` | Pure Gemini prompt builders (`buildWatchlistPrompt`, `buildGenrePrompt`, `buildCustomListPrompt`, `buildHomepageRecommendationsPrompt`) + shared context/feedback helpers. Dependency-free. | +| `query/query-client.ts` | `getContext()` — fresh QueryClient per render/request with 24 h defaults. | +| `query/root-provider.tsx` | React context provider for the QueryClient. | +| `query/devtools.ts` | Dev-only React Query devtools. | +| `query/keys.ts` | `queryKeys` — centralized, user-scoped query-key factory. | + +## `src/hooks/` — React hooks & state + +| File | What it is | +| :--- | :--- | +| `watchlist-store.ts` | Zustand guest watchlist store (persisted, LRU storage): `setWatchlistMembershipLocal`, `setProgressStatusLocal`, `setReactionLocal`, `setProgressLocal`, `importWatchlistLocal`. | +| `pending-ops.ts` | The optimistic journal: `beginOp`, `reconcileListFetch`, `applyServerState`, `scheduleSync`, `clearPendingOps`. Client-only; scoped per QueryClient. | +| `optimistic-helpers.ts` | Small shared helpers for optimistic cache patches. | +| `watchlist-queries.ts` | TanStack Query hooks for watchlist data (list, tracked ids, media state, episodes). | +| `use-watchlist.ts` | Thin read/mutation hook delegating to the repository (239 lines after refactor). | +| `watchlist/watchlist-optimistic.ts` | Pure optimistic op builders for watchlist mutations. | +| `custom-lists/list-optimistic.ts` | Pure optimistic op builders for custom-list CRUD. | +| `use-custom-lists.ts` | Custom-list hook (232 lines after refactor; delegates to the repository). | +| `use-local-lists-store.ts` | Zustand guest custom-lists store (persisted). | +| `use-local-progress-store.ts` | Zustand guest progress store (persisted; includes `lastPlayed` and per-episode watched state). | +| `watch-progress/use-watch-progress.ts` | Watch/player progress orchestration (677 lines): data fetching, progress calculations, mutations. | +| `watch-progress/use-player-listener.ts` | postMessage listener for player progress (origin-verified, DOM-scan fallback). | +| `watch-progress/progress-helpers.ts` | Pure progress math + types. | +| `use-watchlist-import-export.ts` | Watchlist export/import (JSON) including guest→remote promotion. | +| `use-recommendations.ts` | AI recommendation queries/mutations (history, generate, feedback, verified resolution). | +| `use-daily-pick.ts` | Daily-pick selection logic (seed generation, interleaving, scoring) — extracted from the component. | +| `use-daily-pick-store.ts` | Zustand daily-pick bookkeeping store. | +| `use-filtered-watchlist.ts` | Filter/sort logic for the watchlist page. | +| `use-permissions.ts` | Client RBAC summary from `getUserFeaturesFn`. | +| `use-season-details.ts` | Batched TV season-detail fetching via a shared `RequestBatcher` (fixes the N+1 in media cards). | +| `use-toast-store.ts` | Toast notification store. | + +## `src/components/` — UI + +### `ui/` — primitives +`button.tsx`, `badge.tsx`, `card.tsx`, `input.tsx`, `label.tsx`, `dialog.tsx`, +`sheet.tsx`, `dropdown-menu.tsx`, `select.tsx`, `tabs.tsx`, `accordion.tsx`, +`navigation-menu.tsx`, `hover-card.tsx`, `aspect-ratio.tsx`, `skeleton.tsx`, +`spinner.tsx`, `image.tsx`, `toaster.tsx`, `empty.tsx`, `pagination.tsx`, +`media-grid.tsx`, `media-skeleton-list.tsx`, `lazy-section.tsx`, +`auto-scroll-title.tsx`, `search-bar.tsx`, `icons.tsx` (lucide icon set) — +shadcn-style, Radix-based primitives used across the app. + +### `media/` — detail-page blocks +`media-container.tsx` (page layout), `media-title-container.tsx`, +`media-video-image-container.tsx`, `media-poster-trailer-container.tsx`, +`watchlist-status-menu.tsx`, `reaction-selector.tsx`, `cast-section.tsx`, +`media-credit-section.tsx`, `season-container.tsx`, `current-season.tsx`, +`inline-episode-browser.tsx`, `collections.tsx`, `genre-container.tsx`, +`media-keywords.tsx`, `media-lightbox-dialog.tsx`, `rating-count.tsx`, +`media-description.tsx`, `media-recommendation.tsx`. + +### `watchlist/` +`watchlist-grid.tsx`, `watchlist-card.tsx`, `watchlist-filters.tsx`, +`list-collage.tsx`, `custom-list-view.tsx`, `custom-list-card.tsx`, +`custom-list-media-card.tsx`, `silent-error-boundary.tsx`. + +### `recommendations/` +`recommendation-filters.tsx` (filters + era presets), `recommendation-results.tsx` +(result grid), `recommendation-history.tsx` (accordion history), +`loading-skeletons.tsx`, `recommendation-utils.ts`. + +### `admin/` +`admin-dashboard.tsx`, `admin-user-table.tsx` (orchestrator), +`admin-user-row.tsx`, `admin-role-dialog.tsx`, `admin-permission-toggles.tsx`, +`use-admin-users.ts` (data hook). + +### Top-level widgets +`navbar.tsx`, `footer.tsx`, `mobile-bottom-nav.tsx`, `desktop-nav-button.tsx`, +`media-card.tsx` (grid/carousel card), `homepage-media.tsx` (homepage rows), +`homepage-recommendations.tsx` ("Picks For You" row + feedback), +`daily-pick.tsx` (daily pick widget, thin UI over `useDailyPick`), +`video-player-modal.tsx` (fullscreen player), `watchlist-button.tsx`, +`custom-list-dialog.tsx`, `custom-list-picker.tsx`, `filter-bar.tsx`, +`share-button.tsx`, `scroll-container.tsx`, `user-sync.tsx` (local→remote +promotion), `banned-screen.tsx`, `go-back.tsx`, `default-loader.tsx`, +`default-not-found.tsx` (error + not-found), `default-empty-state.tsx`. + +## `src/routes/` — file-based routes + +| File | What it is | +| :--- | :--- | +| `__root.tsx` | Root layout: meta tags, nav/footer, toaster, `UserSync`, skip link, app CSS. | +| `index.tsx` | Homepage: search bar, trending/popular/top-rated rows, daily pick, "Picks For You". | +| `list.$type.$slug.tsx` | Curated list pages (`/list/movies/popular`, ...) with pagination. | +| `person.$id.tsx` | Person/actor page (biography + filmography). | +| `keyword.$id.tsx` | Keyword-tagged movies page (TMDB discover). | +| `collection.$id.{-$slug}.tsx` | Collection page with canonical slug redirect. | +| `search.tsx` + `search.lazy.tsx` | Search shell (param validation + head) and lazy search UI (cross-media results + history). | +| `watchlist.tsx` + `watchlist.lazy.tsx` | Watchlist shell and lazy UI (filters, grid, import/export, lists). | +| `recommendations.tsx` + `recommendations.lazy.tsx` | AI recommendations shell and lazy UI (filters → results → history). | +| `admin.tsx` | Admin dashboard gate (admin-only via `usePermissions`). | +| `disclaimer.tsx` | Static disclaimer/terms page. | +| `api.metaimage.ts` | OG-image endpoint: 302-redirects to the TMDB poster/backdrop (with placeholder fallback), immutable cache headers. | +| `movie/$id/{-$slug}/index.tsx` | Movie detail page (details, cast, media tabs, watchlist controls). | +| `movie/$id/{-$slug}/media.tsx` | Movie media gallery (backdrops/posters/videos). | +| `movie/$id/{-$slug}/cast-crew.tsx` | Movie cast & crew page. | +| `tv/$id/{-$slug}/index.tsx` | TV show detail page (overview, seasons, episodes, watchlist). | +| `tv/$id/{-$slug}/seasons.tsx` | TV seasons index. | +| `tv/$id/{-$slug}/season.$seasonNumber.tsx` | Single season page with per-episode watched state. | +| `tv/$id/{-$slug}/media.tsx` | TV media gallery. | +| `tv/$id/{-$slug}/cast-crew.tsx` | TV cast & crew page. | + +## `public/` — static assets + +Icons/favicons (apple-touch, android-chrome, mstile sets), `logo.svg`, +`favicon.svg`, `image_not_found.jpg`, `manifest.json`, `robots.txt`, +`offline.html` and `sw.js` (service worker), plus Vite/PWA metadata. + +--- + +## Maintenance notes + +- **Generated files** (never hand-edit): `src/routeTree.gen.ts`, + `.output/`, `.nitro/`, `.wrangler/`, `.tanstack/`, `pnpm-lock.yaml` (update + via pnpm), `drizzle/meta/`. +- **Legacy leftovers** to be aware of: `public/sw.js` + `offline.html` + (service worker assets). The stale `.vercel/` directory was removed + (2026-08-16); its preview env vars were preserved in the gitignored + `.env.vercel-preview.local` backup. +- **Where new backend code goes:** a new server fn in `src/server/fns/` + + a Valibot schema in `src/server/schema/`; wire the client through + `src/lib/repository/` (remote + local) so both auth states stay consistent. +- **Where new queries go:** TMDB fetch → `src/lib/queries.ts` (+ schema in + `tmdb-schemas.ts`), key in `src/lib/query/keys.ts`, hook in `src/hooks/`. diff --git a/docs/server-layer.md b/docs/server-layer.md new file mode 100644 index 00000000..b418b3e5 --- /dev/null +++ b/docs/server-layer.md @@ -0,0 +1,178 @@ +# Server Layer + +Everything that runs on the Worker (or in Node during `vite dev` SSR). The +server layer is split between **Nitro** (framework-agnostic entry points) and +**TanStack Start server functions** (the application "API"). + +## 1. Runtime bootstrap + +- `nitro.config.ts` — scans `server/` for Nitro routes/tasks, enables the + experimental task system (used by the Cloudflare cron), maps the `0 3 * * *` + cron to the `snapshots` task, sets cache-control + security headers via + `routeRules`, and selects the `cloudflare_module` preset for production + builds. +- `wrangler.toml` — the Worker definition: entry `.output/server/index.mjs`, + `ASSETS` binding for static files, `DB` binding for D1, cron trigger, and + observability config. Secrets are NOT in this file (they go through + `wrangler secret put`); only non-secret `VITE_*` build-time vars are inlined + by Vite. +- `server/routes/api/health.ts` — `GET /api/health`: pings D1 with `select 1`, + returns `{ ok, checks, durationMs }`, `503` when the DB is down. Never leaks + raw driver errors (public endpoint). +- `server/tasks/snapshots.ts` — Nitro task dispatched by the cron. Reads the + persisted cursor (`snapshot_cursors`), calls `createDailySnapshots` (max 200 + users/run, keyset pagination), persists the new cursor, and returns a + summary. + +## 2. Environment (`src/server/env.ts`) + +- `Env` interface mirrors the Worker bindings (`DB`, `ASSETS`, + `CLERK_SECRET_KEY`, `CLERK_ISSUER_URL`, `GEMINI_API_KEY`). +- `getEnv()` reads `globalThis.__env__` (set by Nitro on the Worker) with a + `process.env` fallback for Node dev. +- `validateEnv()` runs once per isolate/process and validates string vars with + Valibot — a missing `CLERK_SECRET_KEY` is a loud `console.error` (it silently + degrades everyone to guest), while `GEMINI_API_KEY` missing is a warning. +- The `DB` binding is validated separately in `getDb` with an actionable error + (explains that `pnpm dev:web` is UI-only and `pnpm dev:cf` is needed for D1). + +## 3. Database access (`src/server/db/`) + +- `client.ts` — `getDb(env)` lazily creates and caches a Drizzle D1 instance + per binding (WeakMap). D1 is serverless, so there is no pool; caching avoids + re-processing the schema on every request. `runBatch(db, statements)` guards + the empty case and casts the dynamic array for Drizzle's tuple-typed + `db.batch`. +- `schema.ts` — the complete Drizzle schema (see [data-model.md](./data-model.md)). +- `helpers/watch-item.ts` — shared watch-item logic: `getWatchItem`, + `normalizeProgressStatus` / `normalizeReaction` (safe guards against invalid + legacy values), `buildMetadataPatch` (clamps rating 0–10), and + `upsertWatchItem` (insert-or-patch on the `(user, tmdb, mediaType)` unique + key, with `onConflictDoUpdate` so a concurrent duplicate insert applies this + request's state to the winner's row instead of silently dropping it). +- `helpers/snapshots.ts` — `createWatchlistSnapshot` (records the current + watchlist media ids unless identical to the latest snapshot; deterministic + ordering before the 500-row limit) and `createDailySnapshots` (keyset + pagination over users, bounded per run, resumable via cursor). + +## 4. Auth (`src/server/auth.ts`) + +- `getSessionToken()` — prefers `Authorization: Bearer`, falls back to the + `__session` / `__clerk_db_jwt` cookies. +- `getSessionClaims()` — verifies the JWT with `@clerk/backend` (10 s clock + skew tolerance); malformed/expired → `null` (guest). +- `requireUser()` — the main auth gate. Verifies the session, resolves the + user, **creates the row on first sign-in** (race-safe: + `onConflictDoNothing` + re-read by canonical `tokenIdentifier`), and + auto-consolidates orphaned `watch_items` from duplicate legacy user rows + (batched rewrite). +- `getCurrentUser()` — resolves without creating (read paths). +- `findUserByClaims()` — multi-format `tokenIdentifier` matching (canonical + `clerk|` fast path via the unique index, then a LIKE fallback for + legacy `*|` formats), with a short-lived in-memory cache (15 s TTL, + 500-entry LRU) to avoid duplicate DB hits. +- Admin helpers — `getAdminFromClaims` (JWT claim), `isAdminFromClerkApi` + (live Clerk API, deliberately **uncached** and time-boxed to 5 s, degrades + to `false`), `getClerkAdminIds` (one paginated user-list call for admin + table display — display-only, never used for access decisions). + +## 5. RBAC (`src/server/rbac.ts`) + +- Two dynamic roles (`video-player`, `ai-integrations`) map 1:1 to two + features (`video-player`, `ai-recommendations`). +- `hasFeature(claims, user, feature)` — the decision function: + 1. no claims → false + 2. banned user → false + 3. admin (JWT claim or Clerk API) → true + 4. `global:` permission row must be enabled (default true) + 5. any of the user's roles grant the feature (permission row overrides + `DEFAULT_PERMISSIONS`) +- `getUserFeatures()` — shape used by the client (`usePermissions`). +- `syncRolePermissions(db, force)` — prunes invalid rows and seeds defaults in + a single batched round trip (idempotent, race-safe with + `onConflictDoNothing`). + +## 6. Server functions (`src/server/fns/`) + +All fns return `ApiResult` and validate input with Valibot. + +### watchlist.ts +- Reads: `getWatchlist` (status-filtered, max 500), `getTrackedTmdbIds`, + `getMediaState` (single row for a media id), `getAllWatchedEpisodes`, + `getAllEpisodeProgress`. +- Writes: `setWatchlistMembership` / `batchSetWatchlistMembership` (removing + from the watchlist keeps the row when it has a reaction or real progress, + else deletes it; batch path does one read + one `db.batch`), + `setProgressStatus`, `setReaction`, `updateProgress`, `removeFromContinueWatching`. +- Episode progress: `markEpisodeWatched`, `markSeasonEpisodesWatched`, + `markShowEpisodesAndStatus` — all build statements via + `buildEpisodeSyncStatements` against a preloaded `existingByKey` map so a + whole show sync is one read + one batch. + +### lists.ts +- Reads: `getCustomLists` (with preview images + item counts), + `getListItems` (enriched with watch-item metadata; TMDB-id `IN` clauses are + chunked at 90 ids because D1 caps bound parameters at 100), `getItemLists`. +- Writes: `createCustomList`, `createCustomListAndAddItem` (rolls back the + list if the item insert fails), `updateCustomList`, `deleteCustomList` + (FK cascade removes children), `toggleListItem`. Duplicate names are guarded + by the `(user_id, name)` unique index via `onConflictDoNothing`. + +### import-export.ts +- `importWatchlist` — bulk import of `watch_items` + `episode_progress`. + Dedupes by `(mediaType, tmdbId)`, normalizes statuses/reactions, and executes + in bounded batches (≤100 statements per `db.batch`, episode INSERTs chunked + at 14 rows to respect the 100-parameter limit). Ends with a watchlist + snapshot. + +### recommendations.ts +- Access/history: `getUserRecommendationAccess`, `getRecommendationHistory`, + `deleteRecommendation` (blocked inside the 2-minute rate window so users + can't erase the cooldown marker), `updateVerifiedRecommendations`. +- Feedback: `getRecommendationFeedback`, `setRecommendationFeedback` + (a `like` auto-adds the title to the watchlist with the `recommended` + reaction and to the "Pebbly Picks" list), `removeRecommendationFeedback`. +- Homepage: `getHomepageRecommendations` (filters out disliked feedback, + computes `needsRefresh` from server time — 24 h cadence, retry after 1 h on + failure), `generateHomepageRecommendations`. +- Generation: `generateRecommendations` — auth + feature gate, empty-input + guard, atomic cooldown reservation + (`checkAndSetRecommendationCooldown`, a reserved `ai_recommendations` row + that doubles as the rate-limit marker; released on failure), + `gatherWatchlistData` (4 batched pruned reads), prompt building, + `callGeminiAI`, filtering (dedupe against existing ids/titles, drop + disliked), and persistence (`saveRecommendations` updates the reservation + row in place so history never shows a placeholder). + +### admin.ts +- `requireAdmin()` — `requireUser` + JWT-claim/live-API admin check + (`FORBIDDEN` otherwise). Never consults a stored flag. +- `getUserFeaturesFn`, `getRolePermissions`, `setRolePermission` (global + feature toggle via atomic upsert), `setUserRoles`, `setUserBanned` + (cannot ban yourself), `listUsers` (admin badges derived from one paginated + Clerk call; display-only). + +### users.ts +- `storeUser` — upserts identity fields from the verified Clerk session + (admin is deliberately not part of the payload). `getStatus` — current user + row or null. + +## 7. Gemini AI (`src/server/ai.ts`) + +- `callGeminiAI(prompt, systemInstruction, retries)` — the single entry point. +- REST `fetch` to `generateContent` with the key in the `x-goog-api-key` + header (never the URL), 30 s per-attempt timeout, `responseMimeType: json`. +- Model fallback chain (`MODELS_TO_TRY`) with 1 s backoff between models; + "high demand" (503) errors are tracked and reported as `high_demand`. +- Response parsing is **validated per element** with Valibot — malformed + entries are dropped, never trusted as-is. +- `getErrorMessage` / `isHighDemandError` / `delay` are exported for reuse. + +## 8. Shared contracts (`src/server/schema/`) + +- `common.ts` — the shared enums (`mediaType`, `progressStatus`, `reaction`, + `feedback`), `metadataSchema`, the `ApiResult` error contract, `ok`/`fail` + helpers, `ApiError`, and the client-side `unwrap()`. +- `watchlist.ts`, `lists.ts`, `recommendations.ts`, `admin.ts`, `import.ts` — + Valibot schemas for every server-fn argument (also imported client-side by + the fns themselves, since TanStack Start bundles them). diff --git a/drizzle.config.ts b/drizzle.config.ts new file mode 100644 index 00000000..35a10da3 --- /dev/null +++ b/drizzle.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "drizzle-kit"; + +// generate-only config: `drizzle-kit generate` emits SQL migrations into ./drizzle. +// They are applied to D1 with `wrangler d1 migrations apply pebbly [--local|--remote]`, +// so no live DB connection (driver) is required here. +export default defineConfig({ + dialect: "sqlite", + schema: "./src/server/db/schema.ts", + out: "./drizzle", +}); diff --git a/drizzle.studio.config.ts b/drizzle.studio.config.ts new file mode 100644 index 00000000..3e8932cf --- /dev/null +++ b/drizzle.studio.config.ts @@ -0,0 +1,97 @@ +import { defineConfig } from "drizzle-kit"; +import { readFileSync } from "node:fs"; + +/** + * Drizzle Studio dashboard for the remote (production) D1 database. + * + * pnpm db:studio + * + * Uses the `d1-http` driver (Cloudflare API) — no local sqlite client needed. + * Credentials come from the environment: + * - CLOUDFLARE_API_TOKEN (API token with "D1 Edit" permission) + * - CLOUDFLARE_ACCOUNT_ID (Cloudflare account id) + * The database id is read from wrangler.toml. + * + * For the local D1 database use: + * wrangler d1 execute pebbly --local --command "SELECT * FROM watch_items;" + */ + +function fail(message: string): never { + console.error(`[drizzle.studio.config.ts] ${message}`); + console.error( + "Set the missing values (see .env.example) and re-run `pnpm db:studio`.", + ); + process.exit(1); +} + +/** + * Read the top-level `database_id` from wrangler.toml. + * + * wrangler.toml is TOML, so we parse the top-level `d1_databases` array and + * take the `database_id` of the entry named `pebbly` (falling back to the + * first entry). Regex extraction is deliberately avoided so environment + * blocks (`[env.production]`) cannot shadow the top-level database id. + */ +function readWranglerDatabaseId(): string { + const raw = readWranglerToml(); + + // wrangler.toml uses TOML array-of-tables syntax (`[[d1_databases]]`). + // Split the file on each `[[d1_databases]]` header and parse only the + // top-level section — `[env.*]` blocks are ignored entirely, so an + // environment-specific D1 cannot shadow the intended database id. + const sections = raw.split(/^\[\[d1_databases\]\]/m).slice(1); + if (sections.length === 0) { + fail("Could not find a top-level `[[d1_databases]]` table in wrangler.toml."); + } + + const parseSection = (section: string): Record => { + const values: Record = {}; + for (const line of section.split("\n")) { + // Stop at the next top-level table/array header. + if (/^\[|^\[\[/.test(line.trim())) break; + const kv = line.match(/^\s*(\w+)\s*=\s*"([^"]+)"/); + if (kv) values[kv[1]] = kv[2]; + } + return values; + }; + + // Take the first top-level `[[d1_databases]]` entry that binds `DB`. + const d1 = sections.map(parseSection).find((entry) => entry.binding === "DB"); + const databaseId = d1?.database_id; + if (!databaseId) { + fail("No `database_id` found in the top-level `[[d1_databases]]` table."); + } + return databaseId; +} + +function readWranglerToml(): string { + try { + return readFileSync(new URL("./wrangler.toml", import.meta.url), "utf8"); + } catch (error) { + fail( + `Could not read wrangler.toml (${error instanceof Error ? error.message : String(error)}). Run this from the project root.`, + ); + } +} + +const accountId = process.env.CLOUDFLARE_ACCOUNT_ID; +const apiToken = process.env.CLOUDFLARE_API_TOKEN; + +if (!accountId) { + fail("CLOUDFLARE_ACCOUNT_ID is not set."); +} +if (!apiToken) { + fail("CLOUDFLARE_API_TOKEN is not set."); +} + +export default defineConfig({ + dialect: "sqlite", + schema: "./src/server/db/schema.ts", + out: "./drizzle", + driver: "d1-http", + dbCredentials: { + accountId, + databaseId: readWranglerDatabaseId(), + token: apiToken, + }, +}); diff --git a/drizzle/0000_dear_warbound.sql b/drizzle/0000_dear_warbound.sql new file mode 100644 index 00000000..ea1fe7d4 --- /dev/null +++ b/drizzle/0000_dear_warbound.sql @@ -0,0 +1,139 @@ +CREATE TABLE `ai_recommendations` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `recommendations` text NOT NULL, + `original_recommendations` text, + `watchlist_hash` text DEFAULT '' NOT NULL, + `input_stats` text NOT NULL, + `model` text NOT NULL, + `media_type_preference` text, + `genre_preference` text, + `generation_type` text, + `verified` integer DEFAULT false, + `created_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `ai_recs_user_created_idx` ON `ai_recommendations` (`user_id`,`created_at`);--> statement-breakpoint +CREATE TABLE `episode_progress` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `tmdb_id` integer NOT NULL, + `season` integer NOT NULL, + `episode` integer NOT NULL, + `is_watched` integer DEFAULT false NOT NULL, + `updated_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `episode_user_season_ep_uq` ON `episode_progress` (`user_id`,`tmdb_id`,`season`,`episode`);--> statement-breakpoint +CREATE TABLE `homepage_recommendations` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `recommendations` text NOT NULL, + `previous_recommendations` text, + `last_attempted_at` integer DEFAULT 0 NOT NULL, + `last_updated_at` integer DEFAULT 0 NOT NULL, + `status` text DEFAULT 'none' NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `homepage_recommendations_user_id_unique` ON `homepage_recommendations` (`user_id`);--> statement-breakpoint +CREATE TABLE `list_items` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `list_id` text NOT NULL, + `tmdb_id` integer NOT NULL, + `media_type` text NOT NULL, + `added_at` integer NOT NULL, + `title` text, + `image` text, + `backdrop` text, + `rating` integer, + `release_date` text, + `overview` text, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`list_id`) REFERENCES `lists`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `list_items_list_media_uq` ON `list_items` (`list_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE INDEX `list_items_user_media_idx` ON `list_items` (`user_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE TABLE `lists` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `name` text NOT NULL, + `color` text, + `visibility` text, + `list_type` text, + `sort_order` integer DEFAULT 0 NOT NULL, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `lists_user_name_uq` ON `lists` (`user_id`,`name`);--> statement-breakpoint +CREATE INDEX `lists_user_sort_idx` ON `lists` (`user_id`,`sort_order`);--> statement-breakpoint +CREATE TABLE `recommendation_feedback` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `tmdb_id` integer NOT NULL, + `media_type` text NOT NULL, + `title` text NOT NULL, + `feedback` text NOT NULL, + `updated_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `feedback_user_media_uq` ON `recommendation_feedback` (`user_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE INDEX `feedback_user_feedback_idx` ON `recommendation_feedback` (`user_id`,`feedback`);--> statement-breakpoint +CREATE TABLE `role_permissions` ( + `role` text NOT NULL, + `feature` text NOT NULL, + `enabled` integer DEFAULT true NOT NULL +); +--> statement-breakpoint +CREATE INDEX `role_permissions_pk` ON `role_permissions` (`role`,`feature`);--> statement-breakpoint +CREATE TABLE `users` ( + `id` text PRIMARY KEY NOT NULL, + `token_identifier` text NOT NULL, + `name` text, + `image` text, + `email` text, + `roles` text DEFAULT '[]', + `is_admin` integer DEFAULT false, + `is_banned` integer DEFAULT false +); +--> statement-breakpoint +CREATE UNIQUE INDEX `users_token_identifier_unique` ON `users` (`token_identifier`);--> statement-breakpoint +CREATE TABLE `watch_items` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `tmdb_id` integer NOT NULL, + `media_type` text NOT NULL, + `in_watchlist` integer DEFAULT false, + `progress_status` text, + `reaction` text, + `progress` integer DEFAULT 0, + `title` text, + `image` text, + `rating` integer, + `release_date` text, + `overview` text, + `updated_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade, + CONSTRAINT "watch_items_progress_range" CHECK("watch_items"."progress" between 0 and 100), + CONSTRAINT "watch_items_rating_range" CHECK("watch_items"."rating" between 0 and 10) +); +--> statement-breakpoint +CREATE UNIQUE INDEX `watch_items_user_media_uq` ON `watch_items` (`user_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE INDEX `watch_items_user_status_idx` ON `watch_items` (`user_id`,`progress_status`);--> statement-breakpoint +CREATE INDEX `watch_items_user_updated_idx` ON `watch_items` (`user_id`,`updated_at`);--> statement-breakpoint +CREATE TABLE `watchlist_snapshots` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `items` text, + `created_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `snapshots_user_created_idx` ON `watchlist_snapshots` (`user_id`,`created_at`); \ No newline at end of file diff --git a/drizzle/0001_slippery_cammi.sql b/drizzle/0001_slippery_cammi.sql new file mode 100644 index 00000000..a38466f1 --- /dev/null +++ b/drizzle/0001_slippery_cammi.sql @@ -0,0 +1,60 @@ +PRAGMA foreign_keys=OFF;--> statement-breakpoint +CREATE TABLE `__new_role_permissions` ( + `role` text NOT NULL, + `feature` text NOT NULL, + `enabled` integer DEFAULT true NOT NULL, + PRIMARY KEY(`role`, `feature`) +); +--> statement-breakpoint +INSERT INTO `__new_role_permissions`("role", "feature", "enabled") SELECT "role", "feature", "enabled" FROM `role_permissions`;--> statement-breakpoint +DROP TABLE `role_permissions`;--> statement-breakpoint +ALTER TABLE `__new_role_permissions` RENAME TO `role_permissions`;--> statement-breakpoint +PRAGMA foreign_keys=ON;--> statement-breakpoint +CREATE TABLE `__new_list_items` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `list_id` text NOT NULL, + `tmdb_id` integer NOT NULL, + `media_type` text NOT NULL, + `added_at` integer NOT NULL, + `title` text, + `image` text, + `backdrop` text, + `rating` real, + `release_date` text, + `overview` text, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`list_id`) REFERENCES `lists`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +INSERT INTO `__new_list_items`("id", "user_id", "list_id", "tmdb_id", "media_type", "added_at", "title", "image", "backdrop", "rating", "release_date", "overview") SELECT "id", "user_id", "list_id", "tmdb_id", "media_type", "added_at", "title", "image", "backdrop", "rating", "release_date", "overview" FROM `list_items`;--> statement-breakpoint +DROP TABLE `list_items`;--> statement-breakpoint +ALTER TABLE `__new_list_items` RENAME TO `list_items`;--> statement-breakpoint +CREATE UNIQUE INDEX `list_items_list_media_uq` ON `list_items` (`list_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE INDEX `list_items_user_media_idx` ON `list_items` (`user_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE TABLE `__new_watch_items` ( + `id` text PRIMARY KEY NOT NULL, + `user_id` text NOT NULL, + `tmdb_id` integer NOT NULL, + `media_type` text NOT NULL, + `in_watchlist` integer DEFAULT false, + `progress_status` text, + `reaction` text, + `progress` integer DEFAULT 0, + `title` text, + `image` text, + `rating` real, + `release_date` text, + `overview` text, + `updated_at` integer NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade, + CONSTRAINT "watch_items_progress_range" CHECK("__new_watch_items"."progress" between 0 and 100), + CONSTRAINT "watch_items_rating_range" CHECK("__new_watch_items"."rating" between 0 and 10) +); +--> statement-breakpoint +INSERT INTO `__new_watch_items`("id", "user_id", "tmdb_id", "media_type", "in_watchlist", "progress_status", "reaction", "progress", "title", "image", "rating", "release_date", "overview", "updated_at") SELECT "id", "user_id", "tmdb_id", "media_type", "in_watchlist", "progress_status", "reaction", "progress", "title", "image", "rating", "release_date", "overview", "updated_at" FROM `watch_items`;--> statement-breakpoint +DROP TABLE `watch_items`;--> statement-breakpoint +ALTER TABLE `__new_watch_items` RENAME TO `watch_items`;--> statement-breakpoint +CREATE UNIQUE INDEX `watch_items_user_media_uq` ON `watch_items` (`user_id`,`tmdb_id`,`media_type`);--> statement-breakpoint +CREATE INDEX `watch_items_user_status_idx` ON `watch_items` (`user_id`,`progress_status`);--> statement-breakpoint +CREATE INDEX `watch_items_user_updated_idx` ON `watch_items` (`user_id`,`updated_at`); \ No newline at end of file diff --git a/drizzle/0002_cute_bloodstrike.sql b/drizzle/0002_cute_bloodstrike.sql new file mode 100644 index 00000000..5220e290 --- /dev/null +++ b/drizzle/0002_cute_bloodstrike.sql @@ -0,0 +1,5 @@ +CREATE TABLE `snapshot_cursors` ( + `key` text PRIMARY KEY NOT NULL, + `value` text, + `updated_at` integer NOT NULL +); diff --git a/drizzle/0003_petite_sugar_man.sql b/drizzle/0003_petite_sugar_man.sql new file mode 100644 index 00000000..d79b2278 --- /dev/null +++ b/drizzle/0003_petite_sugar_man.sql @@ -0,0 +1 @@ +ALTER TABLE `users` DROP COLUMN `is_admin`; \ No newline at end of file diff --git a/drizzle/meta/0000_snapshot.json b/drizzle/meta/0000_snapshot.json new file mode 100644 index 00000000..ef0c9cc2 --- /dev/null +++ b/drizzle/meta/0000_snapshot.json @@ -0,0 +1,980 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "28c96ef3-0b1e-4128-8d3d-a6f1a1b5c209", + "prevId": "00000000-0000-0000-0000-000000000000", + "tables": { + "ai_recommendations": { + "name": "ai_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_recommendations": { + "name": "original_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "watchlist_hash": { + "name": "watchlist_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "input_stats": { + "name": "input_stats", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type_preference": { + "name": "media_type_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "genre_preference": { + "name": "genre_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "generation_type": { + "name": "generation_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verified": { + "name": "verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "ai_recs_user_created_idx": { + "name": "ai_recs_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "ai_recommendations_user_id_users_id_fk": { + "name": "ai_recommendations_user_id_users_id_fk", + "tableFrom": "ai_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "episode_progress": { + "name": "episode_progress", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "season": { + "name": "season", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "episode": { + "name": "episode", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_watched": { + "name": "is_watched", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "episode_user_season_ep_uq": { + "name": "episode_user_season_ep_uq", + "columns": [ + "user_id", + "tmdb_id", + "season", + "episode" + ], + "isUnique": true + } + }, + "foreignKeys": { + "episode_progress_user_id_users_id_fk": { + "name": "episode_progress_user_id_users_id_fk", + "tableFrom": "episode_progress", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "homepage_recommendations": { + "name": "homepage_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "previous_recommendations": { + "name": "previous_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_attempted_at": { + "name": "last_attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + } + }, + "indexes": { + "homepage_recommendations_user_id_unique": { + "name": "homepage_recommendations_user_id_unique", + "columns": [ + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "homepage_recommendations_user_id_users_id_fk": { + "name": "homepage_recommendations_user_id_users_id_fk", + "tableFrom": "homepage_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "list_items": { + "name": "list_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_at": { + "name": "added_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "backdrop": { + "name": "backdrop", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "list_items_list_media_uq": { + "name": "list_items_list_media_uq", + "columns": [ + "list_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "list_items_user_media_idx": { + "name": "list_items_user_media_idx", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": false + } + }, + "foreignKeys": { + "list_items_user_id_users_id_fk": { + "name": "list_items_user_id_users_id_fk", + "tableFrom": "list_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "list_items_list_id_lists_id_fk": { + "name": "list_items_list_id_lists_id_fk", + "tableFrom": "list_items", + "tableTo": "lists", + "columnsFrom": [ + "list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lists": { + "name": "lists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "list_type": { + "name": "list_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "lists_user_name_uq": { + "name": "lists_user_name_uq", + "columns": [ + "user_id", + "name" + ], + "isUnique": true + }, + "lists_user_sort_idx": { + "name": "lists_user_sort_idx", + "columns": [ + "user_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": { + "lists_user_id_users_id_fk": { + "name": "lists_user_id_users_id_fk", + "tableFrom": "lists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "recommendation_feedback": { + "name": "recommendation_feedback", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "feedback_user_media_uq": { + "name": "feedback_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "feedback_user_feedback_idx": { + "name": "feedback_user_feedback_idx", + "columns": [ + "user_id", + "feedback" + ], + "isUnique": false + } + }, + "foreignKeys": { + "recommendation_feedback_user_id_users_id_fk": { + "name": "recommendation_feedback_user_id_users_id_fk", + "tableFrom": "recommendation_feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "role_permissions": { + "name": "role_permissions", + "columns": { + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feature": { + "name": "feature", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + } + }, + "indexes": { + "role_permissions_pk": { + "name": "role_permissions_pk", + "columns": [ + "role", + "feature" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "token_identifier": { + "name": "token_identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "roles": { + "name": "roles", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "is_admin": { + "name": "is_admin", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_banned": { + "name": "is_banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "users_token_identifier_unique": { + "name": "users_token_identifier_unique", + "columns": [ + "token_identifier" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "watch_items": { + "name": "watch_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "in_watchlist": { + "name": "in_watchlist", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "progress_status": { + "name": "progress_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reaction": { + "name": "reaction", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "progress": { + "name": "progress", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "watch_items_user_media_uq": { + "name": "watch_items_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "watch_items_user_status_idx": { + "name": "watch_items_user_status_idx", + "columns": [ + "user_id", + "progress_status" + ], + "isUnique": false + }, + "watch_items_user_updated_idx": { + "name": "watch_items_user_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watch_items_user_id_users_id_fk": { + "name": "watch_items_user_id_users_id_fk", + "tableFrom": "watch_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "watch_items_progress_range": { + "name": "watch_items_progress_range", + "value": "\"watch_items\".\"progress\" between 0 and 100" + }, + "watch_items_rating_range": { + "name": "watch_items_rating_range", + "value": "\"watch_items\".\"rating\" between 0 and 10" + } + } + }, + "watchlist_snapshots": { + "name": "watchlist_snapshots", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "snapshots_user_created_idx": { + "name": "snapshots_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watchlist_snapshots_user_id_users_id_fk": { + "name": "watchlist_snapshots_user_id_users_id_fk", + "tableFrom": "watchlist_snapshots", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json new file mode 100644 index 00000000..2c8d88c7 --- /dev/null +++ b/drizzle/meta/0001_snapshot.json @@ -0,0 +1,979 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "0ec3406a-5890-4507-8acd-7188c8f94a0c", + "prevId": "28c96ef3-0b1e-4128-8d3d-a6f1a1b5c209", + "tables": { + "ai_recommendations": { + "name": "ai_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_recommendations": { + "name": "original_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "watchlist_hash": { + "name": "watchlist_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "input_stats": { + "name": "input_stats", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type_preference": { + "name": "media_type_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "genre_preference": { + "name": "genre_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "generation_type": { + "name": "generation_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verified": { + "name": "verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "ai_recs_user_created_idx": { + "name": "ai_recs_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "ai_recommendations_user_id_users_id_fk": { + "name": "ai_recommendations_user_id_users_id_fk", + "tableFrom": "ai_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "episode_progress": { + "name": "episode_progress", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "season": { + "name": "season", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "episode": { + "name": "episode", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_watched": { + "name": "is_watched", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "episode_user_season_ep_uq": { + "name": "episode_user_season_ep_uq", + "columns": [ + "user_id", + "tmdb_id", + "season", + "episode" + ], + "isUnique": true + } + }, + "foreignKeys": { + "episode_progress_user_id_users_id_fk": { + "name": "episode_progress_user_id_users_id_fk", + "tableFrom": "episode_progress", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "homepage_recommendations": { + "name": "homepage_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "previous_recommendations": { + "name": "previous_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_attempted_at": { + "name": "last_attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + } + }, + "indexes": { + "homepage_recommendations_user_id_unique": { + "name": "homepage_recommendations_user_id_unique", + "columns": [ + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "homepage_recommendations_user_id_users_id_fk": { + "name": "homepage_recommendations_user_id_users_id_fk", + "tableFrom": "homepage_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "list_items": { + "name": "list_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_at": { + "name": "added_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "backdrop": { + "name": "backdrop", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "list_items_list_media_uq": { + "name": "list_items_list_media_uq", + "columns": [ + "list_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "list_items_user_media_idx": { + "name": "list_items_user_media_idx", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": false + } + }, + "foreignKeys": { + "list_items_user_id_users_id_fk": { + "name": "list_items_user_id_users_id_fk", + "tableFrom": "list_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "list_items_list_id_lists_id_fk": { + "name": "list_items_list_id_lists_id_fk", + "tableFrom": "list_items", + "tableTo": "lists", + "columnsFrom": [ + "list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lists": { + "name": "lists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "list_type": { + "name": "list_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "lists_user_name_uq": { + "name": "lists_user_name_uq", + "columns": [ + "user_id", + "name" + ], + "isUnique": true + }, + "lists_user_sort_idx": { + "name": "lists_user_sort_idx", + "columns": [ + "user_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": { + "lists_user_id_users_id_fk": { + "name": "lists_user_id_users_id_fk", + "tableFrom": "lists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "recommendation_feedback": { + "name": "recommendation_feedback", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "feedback_user_media_uq": { + "name": "feedback_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "feedback_user_feedback_idx": { + "name": "feedback_user_feedback_idx", + "columns": [ + "user_id", + "feedback" + ], + "isUnique": false + } + }, + "foreignKeys": { + "recommendation_feedback_user_id_users_id_fk": { + "name": "recommendation_feedback_user_id_users_id_fk", + "tableFrom": "recommendation_feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "role_permissions": { + "name": "role_permissions", + "columns": { + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feature": { + "name": "feature", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "role_permissions_role_feature_pk": { + "columns": [ + "role", + "feature" + ], + "name": "role_permissions_role_feature_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "token_identifier": { + "name": "token_identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "roles": { + "name": "roles", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "is_admin": { + "name": "is_admin", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_banned": { + "name": "is_banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "users_token_identifier_unique": { + "name": "users_token_identifier_unique", + "columns": [ + "token_identifier" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "watch_items": { + "name": "watch_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "in_watchlist": { + "name": "in_watchlist", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "progress_status": { + "name": "progress_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reaction": { + "name": "reaction", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "progress": { + "name": "progress", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "watch_items_user_media_uq": { + "name": "watch_items_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "watch_items_user_status_idx": { + "name": "watch_items_user_status_idx", + "columns": [ + "user_id", + "progress_status" + ], + "isUnique": false + }, + "watch_items_user_updated_idx": { + "name": "watch_items_user_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watch_items_user_id_users_id_fk": { + "name": "watch_items_user_id_users_id_fk", + "tableFrom": "watch_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "watch_items_progress_range": { + "name": "watch_items_progress_range", + "value": "\"watch_items\".\"progress\" between 0 and 100" + }, + "watch_items_rating_range": { + "name": "watch_items_rating_range", + "value": "\"watch_items\".\"rating\" between 0 and 10" + } + } + }, + "watchlist_snapshots": { + "name": "watchlist_snapshots", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "snapshots_user_created_idx": { + "name": "snapshots_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watchlist_snapshots_user_id_users_id_fk": { + "name": "watchlist_snapshots_user_id_users_id_fk", + "tableFrom": "watchlist_snapshots", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0002_snapshot.json b/drizzle/meta/0002_snapshot.json new file mode 100644 index 00000000..5463d906 --- /dev/null +++ b/drizzle/meta/0002_snapshot.json @@ -0,0 +1,1010 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "4f1071d8-52ee-4b21-8fe0-be2e23794be7", + "prevId": "0ec3406a-5890-4507-8acd-7188c8f94a0c", + "tables": { + "ai_recommendations": { + "name": "ai_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_recommendations": { + "name": "original_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "watchlist_hash": { + "name": "watchlist_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "input_stats": { + "name": "input_stats", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type_preference": { + "name": "media_type_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "genre_preference": { + "name": "genre_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "generation_type": { + "name": "generation_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verified": { + "name": "verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "ai_recs_user_created_idx": { + "name": "ai_recs_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "ai_recommendations_user_id_users_id_fk": { + "name": "ai_recommendations_user_id_users_id_fk", + "tableFrom": "ai_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "episode_progress": { + "name": "episode_progress", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "season": { + "name": "season", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "episode": { + "name": "episode", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_watched": { + "name": "is_watched", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "episode_user_season_ep_uq": { + "name": "episode_user_season_ep_uq", + "columns": [ + "user_id", + "tmdb_id", + "season", + "episode" + ], + "isUnique": true + } + }, + "foreignKeys": { + "episode_progress_user_id_users_id_fk": { + "name": "episode_progress_user_id_users_id_fk", + "tableFrom": "episode_progress", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "homepage_recommendations": { + "name": "homepage_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "previous_recommendations": { + "name": "previous_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_attempted_at": { + "name": "last_attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + } + }, + "indexes": { + "homepage_recommendations_user_id_unique": { + "name": "homepage_recommendations_user_id_unique", + "columns": [ + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "homepage_recommendations_user_id_users_id_fk": { + "name": "homepage_recommendations_user_id_users_id_fk", + "tableFrom": "homepage_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "list_items": { + "name": "list_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_at": { + "name": "added_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "backdrop": { + "name": "backdrop", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "list_items_list_media_uq": { + "name": "list_items_list_media_uq", + "columns": [ + "list_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "list_items_user_media_idx": { + "name": "list_items_user_media_idx", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": false + } + }, + "foreignKeys": { + "list_items_user_id_users_id_fk": { + "name": "list_items_user_id_users_id_fk", + "tableFrom": "list_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "list_items_list_id_lists_id_fk": { + "name": "list_items_list_id_lists_id_fk", + "tableFrom": "list_items", + "tableTo": "lists", + "columnsFrom": [ + "list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lists": { + "name": "lists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "list_type": { + "name": "list_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "lists_user_name_uq": { + "name": "lists_user_name_uq", + "columns": [ + "user_id", + "name" + ], + "isUnique": true + }, + "lists_user_sort_idx": { + "name": "lists_user_sort_idx", + "columns": [ + "user_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": { + "lists_user_id_users_id_fk": { + "name": "lists_user_id_users_id_fk", + "tableFrom": "lists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "recommendation_feedback": { + "name": "recommendation_feedback", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "feedback_user_media_uq": { + "name": "feedback_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "feedback_user_feedback_idx": { + "name": "feedback_user_feedback_idx", + "columns": [ + "user_id", + "feedback" + ], + "isUnique": false + } + }, + "foreignKeys": { + "recommendation_feedback_user_id_users_id_fk": { + "name": "recommendation_feedback_user_id_users_id_fk", + "tableFrom": "recommendation_feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "role_permissions": { + "name": "role_permissions", + "columns": { + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feature": { + "name": "feature", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "role_permissions_role_feature_pk": { + "columns": [ + "role", + "feature" + ], + "name": "role_permissions_role_feature_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "snapshot_cursors": { + "name": "snapshot_cursors", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "token_identifier": { + "name": "token_identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "roles": { + "name": "roles", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "is_admin": { + "name": "is_admin", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_banned": { + "name": "is_banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "users_token_identifier_unique": { + "name": "users_token_identifier_unique", + "columns": [ + "token_identifier" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "watch_items": { + "name": "watch_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "in_watchlist": { + "name": "in_watchlist", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "progress_status": { + "name": "progress_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reaction": { + "name": "reaction", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "progress": { + "name": "progress", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "watch_items_user_media_uq": { + "name": "watch_items_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "watch_items_user_status_idx": { + "name": "watch_items_user_status_idx", + "columns": [ + "user_id", + "progress_status" + ], + "isUnique": false + }, + "watch_items_user_updated_idx": { + "name": "watch_items_user_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watch_items_user_id_users_id_fk": { + "name": "watch_items_user_id_users_id_fk", + "tableFrom": "watch_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "watch_items_progress_range": { + "name": "watch_items_progress_range", + "value": "\"watch_items\".\"progress\" between 0 and 100" + }, + "watch_items_rating_range": { + "name": "watch_items_rating_range", + "value": "\"watch_items\".\"rating\" between 0 and 10" + } + } + }, + "watchlist_snapshots": { + "name": "watchlist_snapshots", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "snapshots_user_created_idx": { + "name": "snapshots_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watchlist_snapshots_user_id_users_id_fk": { + "name": "watchlist_snapshots_user_id_users_id_fk", + "tableFrom": "watchlist_snapshots", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0003_snapshot.json b/drizzle/meta/0003_snapshot.json new file mode 100644 index 00000000..69569d00 --- /dev/null +++ b/drizzle/meta/0003_snapshot.json @@ -0,0 +1,1002 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "251db9f8-0ce6-4ee9-bc2c-cf89ec8c0330", + "prevId": "4f1071d8-52ee-4b21-8fe0-be2e23794be7", + "tables": { + "ai_recommendations": { + "name": "ai_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_recommendations": { + "name": "original_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "watchlist_hash": { + "name": "watchlist_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "input_stats": { + "name": "input_stats", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type_preference": { + "name": "media_type_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "genre_preference": { + "name": "genre_preference", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "generation_type": { + "name": "generation_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verified": { + "name": "verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "ai_recs_user_created_idx": { + "name": "ai_recs_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "ai_recommendations_user_id_users_id_fk": { + "name": "ai_recommendations_user_id_users_id_fk", + "tableFrom": "ai_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "episode_progress": { + "name": "episode_progress", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "season": { + "name": "season", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "episode": { + "name": "episode", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_watched": { + "name": "is_watched", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "episode_user_season_ep_uq": { + "name": "episode_user_season_ep_uq", + "columns": [ + "user_id", + "tmdb_id", + "season", + "episode" + ], + "isUnique": true + } + }, + "foreignKeys": { + "episode_progress_user_id_users_id_fk": { + "name": "episode_progress_user_id_users_id_fk", + "tableFrom": "episode_progress", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "homepage_recommendations": { + "name": "homepage_recommendations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recommendations": { + "name": "recommendations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "previous_recommendations": { + "name": "previous_recommendations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_attempted_at": { + "name": "last_attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'none'" + } + }, + "indexes": { + "homepage_recommendations_user_id_unique": { + "name": "homepage_recommendations_user_id_unique", + "columns": [ + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "homepage_recommendations_user_id_users_id_fk": { + "name": "homepage_recommendations_user_id_users_id_fk", + "tableFrom": "homepage_recommendations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "list_items": { + "name": "list_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "added_at": { + "name": "added_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "backdrop": { + "name": "backdrop", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "list_items_list_media_uq": { + "name": "list_items_list_media_uq", + "columns": [ + "list_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "list_items_user_media_idx": { + "name": "list_items_user_media_idx", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": false + } + }, + "foreignKeys": { + "list_items_user_id_users_id_fk": { + "name": "list_items_user_id_users_id_fk", + "tableFrom": "list_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "list_items_list_id_lists_id_fk": { + "name": "list_items_list_id_lists_id_fk", + "tableFrom": "list_items", + "tableTo": "lists", + "columnsFrom": [ + "list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lists": { + "name": "lists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "list_type": { + "name": "list_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "lists_user_name_uq": { + "name": "lists_user_name_uq", + "columns": [ + "user_id", + "name" + ], + "isUnique": true + }, + "lists_user_sort_idx": { + "name": "lists_user_sort_idx", + "columns": [ + "user_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": { + "lists_user_id_users_id_fk": { + "name": "lists_user_id_users_id_fk", + "tableFrom": "lists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "recommendation_feedback": { + "name": "recommendation_feedback", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feedback": { + "name": "feedback", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "feedback_user_media_uq": { + "name": "feedback_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "feedback_user_feedback_idx": { + "name": "feedback_user_feedback_idx", + "columns": [ + "user_id", + "feedback" + ], + "isUnique": false + } + }, + "foreignKeys": { + "recommendation_feedback_user_id_users_id_fk": { + "name": "recommendation_feedback_user_id_users_id_fk", + "tableFrom": "recommendation_feedback", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "role_permissions": { + "name": "role_permissions", + "columns": { + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feature": { + "name": "feature", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "role_permissions_role_feature_pk": { + "columns": [ + "role", + "feature" + ], + "name": "role_permissions_role_feature_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "snapshot_cursors": { + "name": "snapshot_cursors", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "token_identifier": { + "name": "token_identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "roles": { + "name": "roles", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "is_banned": { + "name": "is_banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "users_token_identifier_unique": { + "name": "users_token_identifier_unique", + "columns": [ + "token_identifier" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "watch_items": { + "name": "watch_items", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tmdb_id": { + "name": "tmdb_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "in_watchlist": { + "name": "in_watchlist", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "progress_status": { + "name": "progress_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reaction": { + "name": "reaction", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "progress": { + "name": "progress", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "overview": { + "name": "overview", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "watch_items_user_media_uq": { + "name": "watch_items_user_media_uq", + "columns": [ + "user_id", + "tmdb_id", + "media_type" + ], + "isUnique": true + }, + "watch_items_user_status_idx": { + "name": "watch_items_user_status_idx", + "columns": [ + "user_id", + "progress_status" + ], + "isUnique": false + }, + "watch_items_user_updated_idx": { + "name": "watch_items_user_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watch_items_user_id_users_id_fk": { + "name": "watch_items_user_id_users_id_fk", + "tableFrom": "watch_items", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "watch_items_progress_range": { + "name": "watch_items_progress_range", + "value": "\"watch_items\".\"progress\" between 0 and 100" + }, + "watch_items_rating_range": { + "name": "watch_items_rating_range", + "value": "\"watch_items\".\"rating\" between 0 and 10" + } + } + }, + "watchlist_snapshots": { + "name": "watchlist_snapshots", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "items": { + "name": "items", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "snapshots_user_created_idx": { + "name": "snapshots_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watchlist_snapshots_user_id_users_id_fk": { + "name": "watchlist_snapshots_user_id_users_id_fk", + "tableFrom": "watchlist_snapshots", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json new file mode 100644 index 00000000..46c0bc1a --- /dev/null +++ b/drizzle/meta/_journal.json @@ -0,0 +1,34 @@ +{ + "version": "7", + "dialect": "sqlite", + "entries": [ + { + "idx": 0, + "version": "6", + "when": 1786817243575, + "tag": "0000_dear_warbound", + "breakpoints": true + }, + { + "idx": 1, + "version": "6", + "when": 1786857065846, + "tag": "0001_slippery_cammi", + "breakpoints": true + }, + { + "idx": 2, + "version": "6", + "when": 1786857611132, + "tag": "0002_cute_bloodstrike", + "breakpoints": true + }, + { + "idx": 3, + "version": "6", + "when": 1786863787987, + "tag": "0003_petite_sugar_man", + "breakpoints": true + } + ] +} \ No newline at end of file diff --git a/nitro.config.ts b/nitro.config.ts index 5393dd64..0320c14f 100644 --- a/nitro.config.ts +++ b/nitro.config.ts @@ -1,12 +1,42 @@ -// @ts-nocheck -import { defineNitroConfig } from "nitropack"; +import { defineNitroConfig } from "nitro/config"; export default defineNitroConfig({ + // Scan `server/` for Nitro routes/tasks/plugins (the tanstack app's own + // `src/server` code is bundled by the TanStack plugin, not scanned here). + scanDirs: ["./server"], + // Enable Nitro's experimental task system, which is what Cloudflare Cron + // Triggers dispatch to (the cloudflare-module preset's `scheduled()` handler + // calls `runCronTasks(controller.cron)` when tasks are enabled). + experimental: { + tasks: true, + }, + // Daily watchlist snapshot at 03:00 UTC — matches the `[triggers]` cron in + // wrangler.toml. The task itself lives in server/tasks/snapshots.ts. + scheduledTasks: { + "0 3 * * *": "snapshots", + }, routeRules: { "/assets/**": { headers: { - "Cache-Control": "public, max-age=31536000, immutable" - } - } - } + "Cache-Control": "public, max-age=31536000, immutable", + }, + }, + // Baseline security headers for every response. The /assets/** rule above + // is more specific and still wins for static assets. + "/**": { + headers: { + "Strict-Transport-Security": "max-age=63072000", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "Referrer-Policy": "strict-origin-when-cross-origin", + }, + }, + }, + // Cloudflare Workers is the deployment target for production builds only. + // In dev (`vite dev`), the default nitro-dev preset is used so the Vite SSR + // server runs as plain Node — full Worker emulation (D1, secrets, cron) is + // exercised via `wrangler dev` against the built output instead. + $production: { + preset: "cloudflare_module", + }, }); diff --git a/package.json b/package.json index fb8eb961..34687a66 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,22 @@ "name": "pebbly", "private": true, "type": "module", + "packageManager": "pnpm@10.6.1", "scripts": { - "dev": "concurrently -n web,convex -c blue,magenta \"vite dev --port 5296 --host\" \"pnpm dlx convex dev\"", + "dev": "vite dev --port 3000", "dev:web": "vite dev --port 3000", + "dev:cf": "pnpm build && wrangler dev", + "preview:cf": "pnpm build && wrangler dev", "build": "vite build", - "build:vercel": "pnpm dlx convex deploy --cmd 'pnpm run build' --cmd-url-env-var-name VITE_CONVEX_URL", "start": "vite preview --port 5296", + "db:generate": "drizzle-kit generate", + "db:migrate:local": "wrangler d1 migrations apply pebbly --local", + "db:migrate:prod": "wrangler d1 migrations apply pebbly --remote", + "db:studio": "drizzle-kit studio --config drizzle.studio.config.ts", + "deploy:cf": "pnpm build && wrangler deploy", "lint": "biome lint --max-diagnostics 20", "format": "biome format --write .", "typecheck": "tsc --noEmit", - "typecheck:convex": "pnpm dlx convex typecheck", "prepare": "husky" }, "lint-staged": { @@ -22,10 +28,11 @@ "dependencies": { "@better-fetch/fetch": "^1.3.1", "@better-fetch/logger": "^1.3.1", + "@clerk/backend": "^3.16.1", "@clerk/react": "^6.12.8", "@clerk/ui": "^1.26.0", - "@convex-dev/react-query": "^0.1.0", "@fontsource-variable/inter": "^5.3.0", + "@fontsource/ibm-plex-mono": "^5.3.0", "@google/genai": "^1.52.0", "@radix-ui/react-accordion": "^1.2.20", "@radix-ui/react-aspect-ratio": "^1.1.15", @@ -47,9 +54,12 @@ "@vercel/speed-insights": "^1.3.1", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", - "convex": "^1.42.3", + "drizzle-orm": "^0.45.2", + "h3": "2.0.1-rc.26", + "h3-rules": "0.1.0", "lucide-react": "^0.544.0", "nitro": "npm:nitro-nightly@latest", + "nitropack": "^2.13.4", "postcss": "^8.5.23", "radix-ui": "^1.6.7", "react": "^19.2.8", @@ -62,6 +72,7 @@ }, "devDependencies": { "@biomejs/biome": "2.4.13", + "@cloudflare/workers-types": "^5.20260808.1", "@fontsource-variable/bricolage-grotesque": "^5.3.0", "@tanstack/react-devtools": "^0.7.11", "@tanstack/react-query-devtools": "^5.101.4", @@ -73,6 +84,7 @@ "babel-plugin-react-compiler": "^1.0.0", "baseline-browser-mapping": "^2.11.3", "concurrently": "^9.2.4", + "drizzle-kit": "^0.31.10", "husky": "^9.1.7", "jsdom": "^27.4.0", "lint-staged": "^17.2.0", @@ -80,6 +92,7 @@ "terser": "^5.49.0", "tw-animate-css": "^1.4.0", "typescript": "^5.9.3", - "vite": "^7.3.6" + "vite": "^7.3.6", + "wrangler": "^4.120.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab645313..b1c65646 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,21 +14,24 @@ importers: '@better-fetch/logger': specifier: ^1.3.1 version: 1.3.1 + '@clerk/backend': + specifier: ^3.16.1 + version: 3.16.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@clerk/react': specifier: ^6.12.8 version: 6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@clerk/ui': specifier: ^1.26.0 - version: 1.26.0(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@types/react@19.2.17)(bs58@6.0.0)(bufferutil@4.1.0)(react-dom@19.2.8(react@19.2.8))(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(react@19.2.8)(supports-color@10.2.2)(typescript@5.9.3)(utf-8-validate@6.0.6) - '@convex-dev/react-query': - specifier: ^0.1.0 - version: 0.1.0(@tanstack/react-query@5.101.4(react@19.2.8))(convex@1.42.3(@clerk/react@6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6)) + version: 1.26.0(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@types/react@19.2.17)(bs58@6.0.0)(bufferutil@4.1.0)(react-dom@19.2.8(react@19.2.8))(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(react@19.2.8)(typescript@5.9.3)(utf-8-validate@6.0.6) '@fontsource-variable/inter': specifier: ^5.3.0 version: 5.3.0 + '@fontsource/ibm-plex-mono': + specifier: ^5.3.0 + version: 5.3.0 '@google/genai': specifier: ^1.52.0 - version: 1.52.0(@modelcontextprotocol/sdk@1.29.0(supports-color@10.2.2)(zod@3.25.76))(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) + version: 1.52.0(@modelcontextprotocol/sdk@1.29.0(zod@3.25.76))(bufferutil@4.1.0)(utf-8-validate@6.0.6) '@radix-ui/react-accordion': specifier: ^1.2.20 version: 1.2.20(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) @@ -55,10 +58,10 @@ importers: version: 4.3.3 '@tailwindcss/vite': specifier: ^4.3.3 - version: 4.3.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: 4.3.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) '@tanstack/nitro-v2-vite-plugin': specifier: ^1.155.0 - version: 1.155.0(srvx@0.8.16)(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: 1.155.0(@upstash/redis@1.38.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(rolldown@1.2.3)(srvx@0.11.22)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) '@tanstack/react-query': specifier: ^5.101.4 version: 5.101.4(react@19.2.8) @@ -73,10 +76,10 @@ importers: version: 1.130.17(@tanstack/react-query@5.101.4(react@19.2.8))(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(@tanstack/router-core@1.171.15)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@tanstack/react-start': specifier: ^1.168.32 - version: 1.168.32(crossws@0.4.5(srvx@0.8.16))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: 1.168.32(crossws@0.4.10(srvx@0.11.22))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) '@tanstack/router-plugin': specifier: ^1.168.23 - version: 1.168.23(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: 1.168.23(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) '@unpic/react': specifier: ^1.0.2 version: 1.0.2(react-dom@19.2.8(react@19.2.8))(react@19.2.8) @@ -89,15 +92,24 @@ importers: clsx: specifier: ^2.1.1 version: 2.1.1 - convex: - specifier: ^1.42.3 - version: 1.42.3(@clerk/react@6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6) + drizzle-orm: + specifier: ^0.45.2 + version: 0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2) + h3: + specifier: 2.0.1-rc.26 + version: 2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)) + h3-rules: + specifier: 0.1.0 + version: 0.1.0(h3@2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)))(ocache@0.2.0) lucide-react: specifier: ^0.544.0 version: 0.544.0(react@19.2.8) nitro: specifier: npm:nitro-nightly@latest - version: nitro-nightly@4.0.0-20251010-091516-7cafddba(ioredis@5.11.1(supports-color@10.2.2))(lru-cache@11.5.1)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: nitro-nightly@3.0.1-20260731-205209-52abde8a(@upstash/redis@1.38.2)(chokidar@5.0.0)(dotenv@17.4.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(giget@3.2.0)(ioredis@5.11.1)(jiti@2.7.0)(lru-cache@11.5.1)(rollup@4.61.1)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))(wrangler@4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6)) + nitropack: + specifier: ^2.13.4 + version: 2.13.4(@upstash/redis@1.38.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(rolldown@1.2.3)(srvx@0.11.22) postcss: specifier: ^8.5.23 version: 8.5.23 @@ -121,7 +133,7 @@ importers: version: 1.4.2(typescript@5.9.3) vite-tsconfig-paths: specifier: ^5.1.4 - version: 5.1.4(supports-color@10.2.2)(typescript@5.9.3)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: 5.1.4(typescript@5.9.3)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) zustand: specifier: ^5.0.14 version: 5.0.14(@types/react@19.2.17)(react@19.2.8)(use-sync-external-store@1.6.0(react@19.2.8)) @@ -129,6 +141,9 @@ importers: '@biomejs/biome': specifier: 2.4.13 version: 2.4.13 + '@cloudflare/workers-types': + specifier: ^5.20260808.1 + version: 5.20260808.1 '@fontsource-variable/bricolage-grotesque': specifier: ^5.3.0 version: 5.3.0 @@ -152,7 +167,7 @@ importers: version: 19.2.3(@types/react@19.2.17) '@vitejs/plugin-react': specifier: ^5.2.0 - version: 5.2.0(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + version: 5.2.0(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) babel-plugin-react-compiler: specifier: ^1.0.0 version: 1.0.0 @@ -162,18 +177,21 @@ importers: concurrently: specifier: ^9.2.4 version: 9.2.4 + drizzle-kit: + specifier: ^0.31.10 + version: 0.31.10 husky: specifier: ^9.1.7 version: 9.1.7 jsdom: specifier: ^27.4.0 - version: 27.4.0(@noble/hashes@1.8.0)(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) + version: 27.4.0(@noble/hashes@1.8.0)(bufferutil@4.1.0)(utf-8-validate@6.0.6) lint-staged: specifier: ^17.2.0 version: 17.2.0 shadcn: specifier: ^4.14.1 - version: 4.14.1(babel-plugin-macros@3.1.0)(supports-color@10.2.2)(typescript@5.9.3) + version: 4.14.1(babel-plugin-macros@3.1.0)(typescript@5.9.3) terser: specifier: ^5.49.0 version: 5.49.0 @@ -185,7 +203,10 @@ importers: version: 5.9.3 vite: specifier: ^7.3.6 - version: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + version: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) + wrangler: + specifier: ^4.120.0 + version: 4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6) packages: @@ -382,28 +403,24 @@ packages: engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - libc: [musl] '@biomejs/cli-linux-arm64@2.4.13': resolution: {integrity: sha512-NzkUDSqfvMBrPplKgVr3aXLHZ2NEELvvF4vZxXulEylKWIGqlvNEcwUcj9OLrn75TD3lJ/GIqCVlBwd1MZCuYQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - libc: [glibc] '@biomejs/cli-linux-x64-musl@2.4.13': resolution: {integrity: sha512-Z601MienRgTBDza/+u2CH3RSrWoXo9rtr8NK6A4KJzqGgfxx+H3VlyLgTJ4sRo40T3pIsqpTmiOQEvYzQvBRvQ==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - libc: [musl] '@biomejs/cli-linux-x64@2.4.13': resolution: {integrity: sha512-Az3ZZedYRBo9EQzNnD9SxFcR1G5QsGo6VEc2hIyVPZ1rdKwee/7E9oeBBZFpE8Z44ekxsDQBqbiWGW5ShOhUSQ==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - libc: [glibc] '@biomejs/cli-win32-arm64@2.4.13': resolution: {integrity: sha512-Px9PS2B5/Q183bUwy/5VHqp3J2lzdOCeVGzMpphYfl8oSa7VDCqenBdqWpy6DCy/en4Rbf/Y1RieZF6dJPcc9A==} @@ -417,6 +434,10 @@ packages: cpu: [x64] os: [win32] + '@clerk/backend@3.16.1': + resolution: {integrity: sha512-tbsrGqw45ar7PDnEV3gwkHE/HM1EwRcYPPLyL3Hw9H0Ms5fG7hZ8+EJegPJ4DpKdfvOw5M+hYMeCVKwv3NxahA==} + engines: {node: '>=20.9.0'} + '@clerk/localizations@4.13.8': resolution: {integrity: sha512-xM5XlvlvKEKpHwojsqGhrK023izLpnE5ExPdA8qOIQDTWzC3/2CIngliijYL1hyA485zkgew0yHOXwHTJRmoVw==} engines: {node: '>=20.9.0'} @@ -440,6 +461,18 @@ packages: react-dom: optional: true + '@clerk/shared@4.27.1': + resolution: {integrity: sha512-eAin1Iy42P3vkytTebD99BhxDm6Yh72Kf8xnpM401Yz/hPUe/Ut4jFqU64xzlhf/RTCPfoTkOHaNDWdMACwXjQ==} + engines: {node: '>=20.9.0'} + peerDependencies: + react: ^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0 + react-dom: ^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0 + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + '@clerk/ui@1.26.0': resolution: {integrity: sha512-wvJqM9vWvHNyznJmC5h2RpJ2YMeTfDOcFuPUD2e4vPkv42oqL4CPg84+2zjinCuYbRRf3F6lbVDO5Q3wOEHMYw==} engines: {node: '>=20.9.0'} @@ -451,11 +484,55 @@ packages: resolution: {integrity: sha512-SIOD2DxrRRwQ+jgzlXCqoEFiKOFqaPjhnNTGKXSRLvp1HiOvapLaFG2kEr9dYQTYe8rKrd9uvDUzmAITeNyaHQ==} engines: {node: '>=18.0.0'} - '@convex-dev/react-query@0.1.0': - resolution: {integrity: sha512-ULmBZCtAQDUePdBhUv7hj1Yy4QiCelhi6uEIOtMpjW8db6W9CFKvQwLt9heLngccFyMFfAZdOfSrT+cP4AH0Jw==} + '@cloudflare/kv-asset-handler@0.5.0': + resolution: {integrity: sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==} + engines: {node: '>=22.0.0'} + + '@cloudflare/unenv-preset@2.16.1': + resolution: {integrity: sha512-ECxObrMfyTl5bhQf/lZCXwo5G6xX9IAUo+nDMKK4SZ8m4Jvvxp52vilxyySSWh2YTZz8+HQ07qGH/2rEom1vDw==} peerDependencies: - '@tanstack/react-query': ^5.0.0 - convex: ^1.29.3 + unenv: 2.0.0-rc.24 + workerd: '>1.20260305.0 <2.0.0-0' + peerDependenciesMeta: + workerd: + optional: true + + '@cloudflare/workerd-darwin-64@1.20260801.1': + resolution: {integrity: sha512-wuJWbXpKvncJi1P0GKS+iYpN5tHdb7JPJJ/+6ZQe8zzovHHVMkLJPNBsgWpqeUhpM3g9qTwEKd2rglNKejuh5A==} + engines: {node: '>=16'} + cpu: [x64] + os: [darwin] + + '@cloudflare/workerd-darwin-arm64@1.20260801.1': + resolution: {integrity: sha512-kwoZiTpnhNrF3+APx84Q/oAqvJ3sU9yefGagwm/ASaH/2W19x0vghkW/r4qCoHCK0WW7EPugZ+aXjgPMRtlq1Q==} + engines: {node: '>=16'} + cpu: [arm64] + os: [darwin] + + '@cloudflare/workerd-linux-64@1.20260801.1': + resolution: {integrity: sha512-r0vAxCZH+Jih9Unm1yoyiByPNWNgawcKciOHDm5Q37ZVGOkKLsT9AtLe3yLSaul76WrKqtf+JP2n0WW32VBLJg==} + engines: {node: '>=16'} + cpu: [x64] + os: [linux] + + '@cloudflare/workerd-linux-arm64@1.20260801.1': + resolution: {integrity: sha512-zWgpdZtSozvIgzQNmQiDSF8yEOQJUkRAWNsDXXzAAoy+fCn8YUoSibj3mpFSbZRvbUldeBEaW6SCdC2VEMkhNQ==} + engines: {node: '>=16'} + cpu: [arm64] + os: [linux] + + '@cloudflare/workerd-windows-64@1.20260801.1': + resolution: {integrity: sha512-2oQz+Ksu4ji6e/+ZoYX+tWQEcxAii2p7l+iR8kx48W1llMalaufAsmVxTlk+3/vrM7D3/2c0iK448e0UQTcIMg==} + engines: {node: '>=16'} + cpu: [x64] + os: [win32] + + '@cloudflare/workers-types@5.20260808.1': + resolution: {integrity: sha512-DN7G9SMyeOq031YhQexoExFAK78ms74cFiFF1teDlTK4+LjHgIc5Z8VbvXQtcCIP//o38btxzxW0b9MGPA83CA==} + + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} '@csstools/color-helpers@6.0.2': resolution: {integrity: sha512-LMGQLS9EuADloEFkcTBR3BwV/CGHV7zyDxVRtVDTwdI2Ca4it0CCVTT9wCkxSgokjE5Ho41hEPgb8OEUwoXr6Q==} @@ -500,6 +577,12 @@ packages: '@dotenvx/primitives@0.8.0': resolution: {integrity: sha512-VYJy0uhFm9zTJ1TxBaW/pA8bjbOM/OttaNMwZ1RHG4JKyRG7DhSdiqD1ipQoAyoD22olUtxbP78W9xY3Wd11bg==} + '@drizzle-team/brocli@0.10.2': + resolution: {integrity: sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w==} + + '@emnapi/runtime@1.11.3': + resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==} + '@emotion/babel-plugin@11.13.5': resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==} @@ -544,308 +627,412 @@ packages: '@emotion/weak-memoize@0.3.1': resolution: {integrity: sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==} + '@esbuild-kit/core-utils@3.3.2': + resolution: {integrity: sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==} + deprecated: 'Merged into tsx: https://tsx.hirok.io' + + '@esbuild-kit/esm-loader@2.6.5': + resolution: {integrity: sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==} + deprecated: 'Merged into tsx: https://tsx.hirok.io' + '@esbuild/aix-ppc64@0.25.12': resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/aix-ppc64@0.27.0': - resolution: {integrity: sha512-KuZrd2hRjz01y5JK9mEBSD3Vj3mbCvemhT466rSuJYeE/hjuBrHfjjcjMdTm/sz7au+++sdbJZJmuBwQLuw68A==} + '@esbuild/aix-ppc64@0.28.0': + resolution: {integrity: sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/aix-ppc64@0.28.0': - resolution: {integrity: sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==} + '@esbuild/aix-ppc64@0.28.1': + resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] + '@esbuild/android-arm64@0.18.20': + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm64@0.25.12': resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm64@0.27.0': - resolution: {integrity: sha512-CC3vt4+1xZrs97/PKDkl0yN7w8edvU2vZvAFGD16n9F0Cvniy5qvzRXjfO1l94efczkkQE6g1x0i73Qf5uthOQ==} + '@esbuild/android-arm64@0.28.0': + resolution: {integrity: sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm64@0.28.0': - resolution: {integrity: sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==} + '@esbuild/android-arm64@0.28.1': + resolution: {integrity: sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==} engines: {node: '>=18'} cpu: [arm64] os: [android] + '@esbuild/android-arm@0.18.20': + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.25.12': resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-arm@0.27.0': - resolution: {integrity: sha512-j67aezrPNYWJEOHUNLPj9maeJte7uSMM6gMoxfPC9hOg8N02JuQi/T7ewumf4tNvJadFkvLZMlAq73b9uwdMyQ==} + '@esbuild/android-arm@0.28.0': + resolution: {integrity: sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-arm@0.28.0': - resolution: {integrity: sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==} + '@esbuild/android-arm@0.28.1': + resolution: {integrity: sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==} engines: {node: '>=18'} cpu: [arm] os: [android] + '@esbuild/android-x64@0.18.20': + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/android-x64@0.25.12': resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/android-x64@0.27.0': - resolution: {integrity: sha512-wurMkF1nmQajBO1+0CJmcN17U4BP6GqNSROP8t0X/Jiw2ltYGLHpEksp9MpoBqkrFR3kv2/te6Sha26k3+yZ9Q==} + '@esbuild/android-x64@0.28.0': + resolution: {integrity: sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/android-x64@0.28.0': - resolution: {integrity: sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==} + '@esbuild/android-x64@0.28.1': + resolution: {integrity: sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==} engines: {node: '>=18'} cpu: [x64] os: [android] + '@esbuild/darwin-arm64@0.18.20': + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-arm64@0.25.12': resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-arm64@0.27.0': - resolution: {integrity: sha512-uJOQKYCcHhg07DL7i8MzjvS2LaP7W7Pn/7uA0B5S1EnqAirJtbyw4yC5jQ5qcFjHK9l6o/MX9QisBg12kNkdHg==} + '@esbuild/darwin-arm64@0.28.0': + resolution: {integrity: sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-arm64@0.28.0': - resolution: {integrity: sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==} + '@esbuild/darwin-arm64@0.28.1': + resolution: {integrity: sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] + '@esbuild/darwin-x64@0.18.20': + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/darwin-x64@0.25.12': resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/darwin-x64@0.27.0': - resolution: {integrity: sha512-8mG6arH3yB/4ZXiEnXof5MK72dE6zM9cDvUcPtxhUZsDjESl9JipZYW60C3JGreKCEP+p8P/72r69m4AZGJd5g==} + '@esbuild/darwin-x64@0.28.0': + resolution: {integrity: sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/darwin-x64@0.28.0': - resolution: {integrity: sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==} + '@esbuild/darwin-x64@0.28.1': + resolution: {integrity: sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==} engines: {node: '>=18'} cpu: [x64] os: [darwin] + '@esbuild/freebsd-arm64@0.18.20': + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-arm64@0.25.12': resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-arm64@0.27.0': - resolution: {integrity: sha512-9FHtyO988CwNMMOE3YIeci+UV+x5Zy8fI2qHNpsEtSF83YPBmE8UWmfYAQg6Ux7Gsmd4FejZqnEUZCMGaNQHQw==} + '@esbuild/freebsd-arm64@0.28.0': + resolution: {integrity: sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-arm64@0.28.0': - resolution: {integrity: sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==} + '@esbuild/freebsd-arm64@0.28.1': + resolution: {integrity: sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-x64@0.18.20': + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/freebsd-x64@0.25.12': resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/freebsd-x64@0.27.0': - resolution: {integrity: sha512-zCMeMXI4HS/tXvJz8vWGexpZj2YVtRAihHLk1imZj4efx1BQzN76YFeKqlDr3bUWI26wHwLWPd3rwh6pe4EV7g==} + '@esbuild/freebsd-x64@0.28.0': + resolution: {integrity: sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/freebsd-x64@0.28.0': - resolution: {integrity: sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==} + '@esbuild/freebsd-x64@0.28.1': + resolution: {integrity: sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] + '@esbuild/linux-arm64@0.18.20': + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm64@0.25.12': resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm64@0.27.0': - resolution: {integrity: sha512-AS18v0V+vZiLJyi/4LphvBE+OIX682Pu7ZYNsdUHyUKSoRwdnOsMf6FDekwoAFKej14WAkOef3zAORJgAtXnlQ==} + '@esbuild/linux-arm64@0.28.0': + resolution: {integrity: sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm64@0.28.0': - resolution: {integrity: sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==} + '@esbuild/linux-arm64@0.28.1': + resolution: {integrity: sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==} engines: {node: '>=18'} cpu: [arm64] os: [linux] + '@esbuild/linux-arm@0.18.20': + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-arm@0.25.12': resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-arm@0.27.0': - resolution: {integrity: sha512-t76XLQDpxgmq2cNXKTVEB7O7YMb42atj2Re2Haf45HkaUpjM2J0UuJZDuaGbPbamzZ7bawyGFUkodL+zcE+jvQ==} + '@esbuild/linux-arm@0.28.0': + resolution: {integrity: sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-arm@0.28.0': - resolution: {integrity: sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==} + '@esbuild/linux-arm@0.28.1': + resolution: {integrity: sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==} engines: {node: '>=18'} cpu: [arm] os: [linux] + '@esbuild/linux-ia32@0.18.20': + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-ia32@0.25.12': resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-ia32@0.27.0': - resolution: {integrity: sha512-Mz1jxqm/kfgKkc/KLHC5qIujMvnnarD9ra1cEcrs7qshTUSksPihGrWHVG5+osAIQ68577Zpww7SGapmzSt4Nw==} + '@esbuild/linux-ia32@0.28.0': + resolution: {integrity: sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-ia32@0.28.0': - resolution: {integrity: sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==} + '@esbuild/linux-ia32@0.28.1': + resolution: {integrity: sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==} engines: {node: '>=18'} cpu: [ia32] os: [linux] + '@esbuild/linux-loong64@0.18.20': + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.25.12': resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-loong64@0.27.0': - resolution: {integrity: sha512-QbEREjdJeIreIAbdG2hLU1yXm1uu+LTdzoq1KCo4G4pFOLlvIspBm36QrQOar9LFduavoWX2msNFAAAY9j4BDg==} + '@esbuild/linux-loong64@0.28.0': + resolution: {integrity: sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-loong64@0.28.0': - resolution: {integrity: sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==} + '@esbuild/linux-loong64@0.28.1': + resolution: {integrity: sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==} engines: {node: '>=18'} cpu: [loong64] os: [linux] + '@esbuild/linux-mips64el@0.18.20': + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-mips64el@0.25.12': resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-mips64el@0.27.0': - resolution: {integrity: sha512-sJz3zRNe4tO2wxvDpH/HYJilb6+2YJxo/ZNbVdtFiKDufzWq4JmKAiHy9iGoLjAV7r/W32VgaHGkk35cUXlNOg==} + '@esbuild/linux-mips64el@0.28.0': + resolution: {integrity: sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-mips64el@0.28.0': - resolution: {integrity: sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==} + '@esbuild/linux-mips64el@0.28.1': + resolution: {integrity: sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] + '@esbuild/linux-ppc64@0.18.20': + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-ppc64@0.25.12': resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-ppc64@0.27.0': - resolution: {integrity: sha512-z9N10FBD0DCS2dmSABDBb5TLAyF1/ydVb+N4pi88T45efQ/w4ohr/F/QYCkxDPnkhkp6AIpIcQKQ8F0ANoA2JA==} + '@esbuild/linux-ppc64@0.28.0': + resolution: {integrity: sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-ppc64@0.28.0': - resolution: {integrity: sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==} + '@esbuild/linux-ppc64@0.28.1': + resolution: {integrity: sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] + '@esbuild/linux-riscv64@0.18.20': + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-riscv64@0.25.12': resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-riscv64@0.27.0': - resolution: {integrity: sha512-pQdyAIZ0BWIC5GyvVFn5awDiO14TkT/19FTmFcPdDec94KJ1uZcmFs21Fo8auMXzD4Tt+diXu1LW1gHus9fhFQ==} + '@esbuild/linux-riscv64@0.28.0': + resolution: {integrity: sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-riscv64@0.28.0': - resolution: {integrity: sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==} + '@esbuild/linux-riscv64@0.28.1': + resolution: {integrity: sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] + '@esbuild/linux-s390x@0.18.20': + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-s390x@0.25.12': resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-s390x@0.27.0': - resolution: {integrity: sha512-hPlRWR4eIDDEci953RI1BLZitgi5uqcsjKMxwYfmi4LcwyWo2IcRP+lThVnKjNtk90pLS8nKdroXYOqW+QQH+w==} + '@esbuild/linux-s390x@0.28.0': + resolution: {integrity: sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-s390x@0.28.0': - resolution: {integrity: sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==} + '@esbuild/linux-s390x@0.28.1': + resolution: {integrity: sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==} engines: {node: '>=18'} cpu: [s390x] os: [linux] + '@esbuild/linux-x64@0.18.20': + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/linux-x64@0.25.12': resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/linux-x64@0.27.0': - resolution: {integrity: sha512-1hBWx4OUJE2cab++aVZ7pObD6s+DK4mPGpemtnAORBvb5l/g5xFGk0vc0PjSkrDs0XaXj9yyob3d14XqvnQ4gw==} + '@esbuild/linux-x64@0.28.0': + resolution: {integrity: sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/linux-x64@0.28.0': - resolution: {integrity: sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==} + '@esbuild/linux-x64@0.28.1': + resolution: {integrity: sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==} engines: {node: '>=18'} cpu: [x64] os: [linux] @@ -856,32 +1043,38 @@ packages: cpu: [arm64] os: [netbsd] - '@esbuild/netbsd-arm64@0.27.0': - resolution: {integrity: sha512-6m0sfQfxfQfy1qRuecMkJlf1cIzTOgyaeXaiVaaki8/v+WB+U4hc6ik15ZW6TAllRlg/WuQXxWj1jx6C+dfy3w==} + '@esbuild/netbsd-arm64@0.28.0': + resolution: {integrity: sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] - '@esbuild/netbsd-arm64@0.28.0': - resolution: {integrity: sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==} + '@esbuild/netbsd-arm64@0.28.1': + resolution: {integrity: sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-x64@0.18.20': + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/netbsd-x64@0.25.12': resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/netbsd-x64@0.27.0': - resolution: {integrity: sha512-xbbOdfn06FtcJ9d0ShxxvSn2iUsGd/lgPIO2V3VZIPDbEaIj1/3nBBe1AwuEZKXVXkMmpr6LUAgMkLD/4D2PPA==} + '@esbuild/netbsd-x64@0.28.0': + resolution: {integrity: sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/netbsd-x64@0.28.0': - resolution: {integrity: sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==} + '@esbuild/netbsd-x64@0.28.1': + resolution: {integrity: sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] @@ -892,32 +1085,38 @@ packages: cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-arm64@0.27.0': - resolution: {integrity: sha512-fWgqR8uNbCQ/GGv0yhzttj6sU/9Z5/Sv/VGU3F5OuXK6J6SlriONKrQ7tNlwBrJZXRYk5jUhuWvF7GYzGguBZQ==} + '@esbuild/openbsd-arm64@0.28.0': + resolution: {integrity: sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-arm64@0.28.0': - resolution: {integrity: sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==} + '@esbuild/openbsd-arm64@0.28.1': + resolution: {integrity: sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-x64@0.18.20': + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/openbsd-x64@0.25.12': resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/openbsd-x64@0.27.0': - resolution: {integrity: sha512-aCwlRdSNMNxkGGqQajMUza6uXzR/U0dIl1QmLjPtRbLOx3Gy3otfFu/VjATy4yQzo9yFDGTxYDo1FfAD9oRD2A==} + '@esbuild/openbsd-x64@0.28.0': + resolution: {integrity: sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/openbsd-x64@0.28.0': - resolution: {integrity: sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==} + '@esbuild/openbsd-x64@0.28.1': + resolution: {integrity: sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] @@ -928,86 +1127,110 @@ packages: cpu: [arm64] os: [openharmony] - '@esbuild/openharmony-arm64@0.27.0': - resolution: {integrity: sha512-nyvsBccxNAsNYz2jVFYwEGuRRomqZ149A39SHWk4hV0jWxKM0hjBPm3AmdxcbHiFLbBSwG6SbpIcUbXjgyECfA==} + '@esbuild/openharmony-arm64@0.28.0': + resolution: {integrity: sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] - '@esbuild/openharmony-arm64@0.28.0': - resolution: {integrity: sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==} + '@esbuild/openharmony-arm64@0.28.1': + resolution: {integrity: sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] + '@esbuild/sunos-x64@0.18.20': + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/sunos-x64@0.25.12': resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/sunos-x64@0.27.0': - resolution: {integrity: sha512-Q1KY1iJafM+UX6CFEL+F4HRTgygmEW568YMqDA5UV97AuZSm21b7SXIrRJDwXWPzr8MGr75fUZPV67FdtMHlHA==} + '@esbuild/sunos-x64@0.28.0': + resolution: {integrity: sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/sunos-x64@0.28.0': - resolution: {integrity: sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==} + '@esbuild/sunos-x64@0.28.1': + resolution: {integrity: sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==} engines: {node: '>=18'} cpu: [x64] os: [sunos] + '@esbuild/win32-arm64@0.18.20': + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-arm64@0.25.12': resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-arm64@0.27.0': - resolution: {integrity: sha512-W1eyGNi6d+8kOmZIwi/EDjrL9nxQIQ0MiGqe/AWc6+IaHloxHSGoeRgDRKHFISThLmsewZ5nHFvGFWdBYlgKPg==} + '@esbuild/win32-arm64@0.28.0': + resolution: {integrity: sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-arm64@0.28.0': - resolution: {integrity: sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==} + '@esbuild/win32-arm64@0.28.1': + resolution: {integrity: sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==} engines: {node: '>=18'} cpu: [arm64] os: [win32] + '@esbuild/win32-ia32@0.18.20': + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-ia32@0.25.12': resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-ia32@0.27.0': - resolution: {integrity: sha512-30z1aKL9h22kQhilnYkORFYt+3wp7yZsHWus+wSKAJR8JtdfI76LJ4SBdMsCopTR3z/ORqVu5L1vtnHZWVj4cQ==} + '@esbuild/win32-ia32@0.28.0': + resolution: {integrity: sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-ia32@0.28.0': - resolution: {integrity: sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==} + '@esbuild/win32-ia32@0.28.1': + resolution: {integrity: sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==} engines: {node: '>=18'} cpu: [ia32] os: [win32] + '@esbuild/win32-x64@0.18.20': + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@esbuild/win32-x64@0.25.12': resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==} engines: {node: '>=18'} cpu: [x64] os: [win32] - '@esbuild/win32-x64@0.27.0': - resolution: {integrity: sha512-aIitBcjQeyOhMTImhLZmtxfdOcuNRpwlPNmlFKPcHQYPhEssw75Cl1TSXJXpMkzaua9FUetx/4OQKq7eJul5Cg==} + '@esbuild/win32-x64@0.28.0': + resolution: {integrity: sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==} engines: {node: '>=18'} cpu: [x64] os: [win32] - '@esbuild/win32-x64@0.28.0': - resolution: {integrity: sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==} + '@esbuild/win32-x64@0.28.1': + resolution: {integrity: sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==} engines: {node: '>=18'} cpu: [x64] os: [win32] @@ -1048,6 +1271,9 @@ packages: '@fontsource-variable/inter@5.3.0': resolution: {integrity: sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==} + '@fontsource/ibm-plex-mono@5.3.0': + resolution: {integrity: sha512-eTgnZjZEGk1QtD3ZstF+Vclo2HLAni8YMy34/DxllwZvyz1lR/1RF/xTiAquOBO7MvqBx8D2Ig2WCPMVfdZu7Q==} + '@formkit/auto-animate@0.8.4': resolution: {integrity: sha512-DHHC01EJ1p70Q0z/ZFRBIY8NDnmfKccQoyoM84Tgb6omLMat6jivCdf272Y8k3nf4Lzdin/Y4R9q8uFtU0GbnA==} @@ -1066,6 +1292,152 @@ packages: peerDependencies: hono: ^4 + '@img/colour@1.1.0': + resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} + engines: {node: '>=18'} + + '@img/sharp-darwin-arm64@0.35.2': + resolution: {integrity: sha512-eEieHsMksAW4IiO5NzauESRl2D2qz3J/kwUxUrSfV06A93eEaRfMpHXyUb1mAqrR7i8U9A0GRqE9pjn6u1Jjpg==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [darwin] + + '@img/sharp-darwin-x64@0.35.2': + resolution: {integrity: sha512-BaktuGPCeHJMARpodR8jK4uKiZrPAy9WrfQW0sdI37clracq8Bp01AYS3SZgi5FS/y5twa9t4+LIuuxQjqRrWw==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [darwin] + + '@img/sharp-freebsd-wasm32@0.35.2': + resolution: {integrity: sha512-YoAxdnd8hPUkvLHd3bWY+YA8nw3xM/RyRopYucNsWHVSan8NLVM3X2volsfoRDcXdUJPg6tXahSd7HXPK7lRnw==} + engines: {node: '>=20.9.0'} + os: [freebsd] + + '@img/sharp-libvips-darwin-arm64@1.3.1': + resolution: {integrity: sha512-4V/M3roRMTYjiwZY9IOVQOE8OyeCxFAkYmyZDrZl51uOKjibm3oeEJ4WAmLxutAfzFbC9jqUiPs2gbnGflH+7g==} + cpu: [arm64] + os: [darwin] + + '@img/sharp-libvips-darwin-x64@1.3.1': + resolution: {integrity: sha512-c0/DxItpJv2+dGhgycJBBgotdqruGYDvA79drdh0MD1dFpy7JzJ/PlXwi1H4rFf0eTy8tgbI91aHDnZIceY3jQ==} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-linux-arm64@1.3.1': + resolution: {integrity: sha512-JznefmcK9j1JKPz8AkQDh89kjojubyfOasWBPKfzMIhPwsgDy9evpE/naJTXXXmghS1iFwR8u/kTwh/I2/+GCw==} + cpu: [arm64] + os: [linux] + + '@img/sharp-libvips-linux-arm@1.3.1': + resolution: {integrity: sha512-aGGy9aWzXgHBG7HNyQPWorZthlp7+x6fDRoPAQbGO3ThcttuTyKIx3NuSHb6zb4gBNq6/yNn9f1cy9nFKS/Vmg==} + cpu: [arm] + os: [linux] + + '@img/sharp-libvips-linux-ppc64@1.3.1': + resolution: {integrity: sha512-1EkwGNCZk6iWNCMWqrvdJ+r1j0PT1zIz60CNPhYnJlK/zyeWqlsPZIe+ocBVqPF8k/Ssee/NCk+tE9Ryrko6ng==} + cpu: [ppc64] + os: [linux] + + '@img/sharp-libvips-linux-riscv64@1.3.1': + resolution: {integrity: sha512-Ilays+w2bXdnxzxtQdmXR62u8o8GYa3eL4+Gr+1KiE4xperMZUslRaVPJwwPkzlHEjGfXAfRVAa/7CYCtSqsBw==} + cpu: [riscv64] + os: [linux] + + '@img/sharp-libvips-linux-s390x@1.3.1': + resolution: {integrity: sha512-VfBwVHQTbRoj4XlpA/KLZ7ltgMpz+4WSejFzQ+GnoImjo1PtEJ59QB2qR1xQEeRPYIkNrPIm2L4cICMvz4C2ew==} + cpu: [s390x] + os: [linux] + + '@img/sharp-libvips-linux-x64@1.3.1': + resolution: {integrity: sha512-+c8ukgwU62DS54nCAjw7keOfHUkmr0B5QHEdcOqRnodF/MNXJbVI8Eopoj4B/0H8Asr65I+A4Amrn7a85/md6A==} + cpu: [x64] + os: [linux] + + '@img/sharp-libvips-linuxmusl-arm64@1.3.1': + resolution: {integrity: sha512-qlKb/pwbkAi1WMsJrYHk7CuDrd12s27U2QnRhFYUoJNrRCmkosMTttuRFat/DDB3IlDm5qE1TJgZ4JDnHX8Ldw==} + cpu: [arm64] + os: [linux] + + '@img/sharp-libvips-linuxmusl-x64@1.3.1': + resolution: {integrity: sha512-yO21HwoUVLN8Qa+/SBjQLMYwBWAVJjeGPNe+hc0OUeMeifEtJqu5a1c4HayE1nNpDih9y3/KkoltfkDodmKAlg==} + cpu: [x64] + os: [linux] + + '@img/sharp-linux-arm64@0.35.2': + resolution: {integrity: sha512-af12Pnd0ZGu2HfP8NayB0kk6eC/lrfbQE6HlR4jD+34wdJ1Vw9TF6TMn6ZvffT+WgqVsl0hRbmNvz2u/23VmwA==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [linux] + + '@img/sharp-linux-arm@0.35.2': + resolution: {integrity: sha512-SE4kzF2mepn6z+6E7L6lsV8FzuLL6IPQdyX8ZiwROAG/G8td+hP/m7FsFPwidtrF19gvajuC9l6TxAVcsA4S7A==} + engines: {node: '>=20.9.0'} + cpu: [arm] + os: [linux] + + '@img/sharp-linux-ppc64@0.35.2': + resolution: {integrity: sha512-hYSBm7zcNtDCozCxQHYZJiu63b/bXsgRZuOxCIBZsStMM9Vap47iFHdbX4kCvQsblPB/k+clhELpdQJHQLSHvg==} + engines: {node: '>=20.9.0'} + cpu: [ppc64] + os: [linux] + + '@img/sharp-linux-riscv64@0.35.2': + resolution: {integrity: sha512-qQt0Kc13+Hoan/Awq/qMSQw3L+RI1NCRPgD5cUJ/1WSSmIoysLOc72jlRM3E0OHN9Yr313jgeQ2T+zW+F03QFA==} + engines: {node: '>=20.9.0'} + cpu: [riscv64] + os: [linux] + + '@img/sharp-linux-s390x@0.35.2': + resolution: {integrity: sha512-E4fLLfRPzDLlEeDaTzI98OFLcv++WL5ChLLMwPoVd0CIoZQqupBSNbOisPL5am9XsbQ9T84+iiMpUvbFtkunbA==} + engines: {node: '>=20.9.0'} + cpu: [s390x] + os: [linux] + + '@img/sharp-linux-x64@0.35.2': + resolution: {integrity: sha512-gi0zFJJRLswfCZmHtJdikXPOc5u7qamSOS3NHedLqLd4W8Q0NqjdBr6TTRIgsfFjqfTsHFgdfvJ9LwqSgcHiAA==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [linux] + + '@img/sharp-linuxmusl-arm64@0.35.2': + resolution: {integrity: sha512-siWbOW1u6HFnFLrp0waKyW7VEf7jYvcDWdrXEFa8AkdAQgEvuu5Fz8/Y70w9EeqAdwDtfU012BhEHHaDqvQNzg==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [linux] + + '@img/sharp-linuxmusl-x64@0.35.2': + resolution: {integrity: sha512-YBqMMcjDi4QGYiSn4vNOYBhmlC4z5AXqkOUUqI2e0AFA4urNv4ESgOgwNl3K+4etQhha0twXlzeF20bbULm9Yg==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [linux] + + '@img/sharp-wasm32@0.35.2': + resolution: {integrity: sha512-Mrv4JQNYVQ94xH+jzZ9r+gowleN8mv2FTgKT+PI6bx5C0G8TdNYndu161pg2i7uoBwxy2ImPMHrJOM2LZef7Bw==} + engines: {node: '>=20.9.0'} + + '@img/sharp-webcontainers-wasm32@0.35.2': + resolution: {integrity: sha512-QNV27pxs9wpApEiCfvHM1RDoP1w1+2KrUWWDPEhEwg+latvOrfuhWrHWZKwdSFwU6jh3myjw/yOCRsUIuOft3g==} + engines: {node: '>=20.9.0'} + cpu: [wasm32] + + '@img/sharp-win32-arm64@0.35.2': + resolution: {integrity: sha512-BiVRYc/t6/Vl3e1hBx0hugG4oN9Pydf4fgMSpxTQJmwGUg/YoXTWHiFeRymHfCZzifxu4F4rpk/I67D0LQ20wQ==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [win32] + + '@img/sharp-win32-ia32@0.35.2': + resolution: {integrity: sha512-YYEhx9PImCC7T0tI8JDMi4DB9LwLCXCU5OWNYEXAxh5Q1ShKkyC6byxzoBJ3gEFDnH2lQckWuDe70G7mB2XJog==} + engines: {node: ^20.9.0} + cpu: [ia32] + os: [win32] + + '@img/sharp-win32-x64@0.35.2': + resolution: {integrity: sha512-imoOyBcoM/iiUr4J6VPpCNjPnjvP/Gks95898yB8YqoGGYmHYbOyCuNv9FMhFgtaiHFGbHW8bxKqRV6VjtXThQ==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [win32] + '@ioredis/commands@1.10.0': resolution: {integrity: sha512-UmeW7z4LfctwoQ5wkhVzgq8tXkreED2xZGpX+Bg+zA+WJFZCT6c062AfCK/Dfk81xZnnwdhJCUMkitihRaoC2Q==} @@ -1108,6 +1480,9 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + '@mapbox/node-pre-gyp@2.0.3': resolution: {integrity: sha512-uwPAhccfFJlsfCxMYTwOdVfOz3xqyj8xYL3zJj8f0pb30tLohnnFPhLuqp4/qoEz8sNxe4SESZedcBojRefIzg==} engines: {node: '>=18'} @@ -1159,6 +1534,9 @@ packages: resolution: {integrity: sha512-hAX0pT/73190NLqBPPWSdBVGtbY6VOhWYK3qqHqtXQ1gK7kS2yz4+ivsN07hpJ6I3aeMtKP6J6npsEKOAzuTLA==} engines: {node: '>=20.0'} + '@oxc-project/types@0.143.0': + resolution: {integrity: sha512-u6JZdLBTLotrNC9Vd6vPssINdzcCzleKAH6EJKImQb7GtYvX5keN2dxkoK44stCc4tffE6QQRtZTXVSzsLUlWA==} + '@parcel/watcher-android-arm64@2.5.6': resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==} engines: {node: '>= 10.0.0'} @@ -1188,42 +1566,36 @@ packages: engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm-musl@2.5.6': resolution: {integrity: sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [musl] '@parcel/watcher-linux-arm64-glibc@2.5.6': resolution: {integrity: sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-musl@2.5.6': resolution: {integrity: sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@parcel/watcher-linux-x64-glibc@2.5.6': resolution: {integrity: sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-x64-musl@2.5.6': resolution: {integrity: sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@parcel/watcher-wasm@2.5.6': resolution: {integrity: sha512-byAiBZ1t3tXQvc8dMD/eoyE7lTXYorhn+6uVW5AC+JGI1KtJC/LvDche5cfUE+qiefH+Ybq0bUCJU0aB1cSHUA==} @@ -1260,6 +1632,9 @@ packages: '@poppinss/colors@4.1.6': resolution: {integrity: sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==} + '@poppinss/dumper@0.6.5': + resolution: {integrity: sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==} + '@poppinss/dumper@0.7.0': resolution: {integrity: sha512-0UTYalzk2t6S4rA2uHOz5bSSW2CHdv4vggJI6Alg90yvl0UgXs6XSXpH96OH+bRkX4J/06djv29pqXJ0lq5Kag==} @@ -2047,9 +2422,96 @@ packages: '@types/react': optional: true + '@rolldown/binding-android-arm64@1.2.3': + resolution: {integrity: sha512-zrJtHDcaZJ1Fp7xf4hNl+7seH9Cn/N5TwLYkhgXREtBwAd/jaqW3uqeHxpDugJLVICWg4eW44kOQEGJ1r6jCGw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@rolldown/binding-darwin-arm64@1.2.3': + resolution: {integrity: sha512-ieIiibVCp0tX7TLu2cafoNPv8wJyYi01ekXpbf8q2j7F4rGAhhXb/eQh7ge9DRBY78GwmRQtvjZDux7EDbA8kA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@1.2.3': + resolution: {integrity: sha512-Zh9tCon19eDXJoihx0rqKhMUlMYqzwj3aPsSuHmI4RWZh62dWUL+DJN4C5YQya5TcQBJU/Fe8+rY0jhXTQITqA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@1.2.3': + resolution: {integrity: sha512-nGbJWewA1wrXXZiQhjAT5rhibGfns5ZNkDVqxsO6zJ3f3YvpoDNNmGMSbbhLuXKjNScaBJVOAboztAWVespQMg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@1.2.3': + resolution: {integrity: sha512-QNniJr5Kml0kDEB98jiDOJjXNroxIIi0IXIbdYzY26Xt1pVbeP62+KnoIZLwirOymX/0jDk/2gI/bNUv7A7OIw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@1.2.3': + resolution: {integrity: sha512-TkqEAcmmvH3I/q4114NB4RVt6241Dao48pF45uLcFGrwAaIn0iITgTAKP/dLjbN0R4buJjGb91+UHSoFmpgIWw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-arm64-musl@1.2.3': + resolution: {integrity: sha512-NHqjnxpsndf4MPymxteFAWHHfkTL8HjWh1KB7z23ofZ6QO2euONuxDXjat69dKZRALnGypg8k8SsK8vZJoXv1Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@rolldown/binding-linux-ppc64-gnu@1.2.3': + resolution: {integrity: sha512-6tbrbwfz5GB9DQ4Jwo6hy9v+vR31xZlvzZ6n5Xut6Hhx5PvrA9q/HsK8KMaYQp063iqZGXwNvZtYNLD7EM/x0w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@rolldown/binding-linux-s390x-gnu@1.2.3': + resolution: {integrity: sha512-oyuXxXmoZHjXC917IAPFAAv4wWAa0cM9afk8nx1+9/jNNOX1uPf8yDA6p7G0RypOfw/X0PQt5IfoquY1um+zSg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@rolldown/binding-linux-x64-gnu@1.2.3': + resolution: {integrity: sha512-TytMwF2KVGqP2tgd0I1OY0PAv78dZRAYcF5ssDzjM34SUXCED3uXvSd5+lHoC0bTD6eEdFz7LdQNCO1y0oVk9w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@rolldown/binding-linux-x64-musl@1.2.3': + resolution: {integrity: sha512-/E9m3qstrJFVPoULV25mVQblSNExY2+kBsYe4sy0Tn0yOOgJ8wZbZt3KnRbF/XeU2Gl1STKUQnDNTqhIE5MD4A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@rolldown/binding-openharmony-arm64@1.2.3': + resolution: {integrity: sha512-Kr0OcsoQI816i6HOl3vFHpd1K0eZyh76zgfj4c1nTyaTsd5r2Mj1lwM4R90y/qaCfmTn9eHy0SKwi98eitRxug==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-win32-arm64-msvc@1.2.3': + resolution: {integrity: sha512-hOtMwTqnME+/gJcH/PCZ0wn0zPUjiWOgkHpxbSJpfGKMezHltx1S7/k1SitzVa7Ww2cqrDDaFbZEhcJZO8o+Jw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@1.2.3': + resolution: {integrity: sha512-ekcqMMkI2PlhYnfzQnB/cEdYUVVJViWvoUyLrbzgDoi3Snfc1mVBwdnc306ufA5ejy8JSPjT2RlW1nQSjW7efg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@rolldown/pluginutils@1.0.0-rc.3': resolution: {integrity: sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==} + '@rolldown/pluginutils@1.0.1': + resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + '@rollup/plugin-alias@6.0.0': resolution: {integrity: sha512-tPCzJOtS7uuVZd+xPhoy5W4vThe6KWXNmsFCNktaAh5RTqcLiSfT4huPQIXkgJ6YCOjJHvecOAzQxLFhPxKr+g==} engines: {node: '>=20.19.0'} @@ -2156,79 +2618,66 @@ packages: resolution: {integrity: sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.61.1': resolution: {integrity: sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.61.1': resolution: {integrity: sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.61.1': resolution: {integrity: sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.61.1': resolution: {integrity: sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==} cpu: [loong64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.61.1': resolution: {integrity: sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==} cpu: [loong64] os: [linux] - libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.61.1': resolution: {integrity: sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.61.1': resolution: {integrity: sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==} cpu: [ppc64] os: [linux] - libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.61.1': resolution: {integrity: sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.61.1': resolution: {integrity: sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==} cpu: [riscv64] os: [linux] - libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.61.1': resolution: {integrity: sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.61.1': resolution: {integrity: sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.61.1': resolution: {integrity: sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-openbsd-x64@4.61.1': resolution: {integrity: sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==} @@ -2785,6 +3234,9 @@ packages: '@speed-highlight/core@1.2.15': resolution: {integrity: sha512-BMq1K3DsElxDWawkX6eLg9+CKJrTVGCBAWVuHXVUV2u0s2711qiChLSId6ikYPfxhdYocLNt3wWwSvDiTvFabw==} + '@stablelib/base64@1.0.1': + resolution: {integrity: sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==} + '@stylexjs/stylex@0.19.0': resolution: {integrity: sha512-CnUFp7YMaDLDeemsWOfJgoC/gKM5P/yBNMcpJaE6ChJmXr7s0DJwSeGTTlHJcqqwN9OW1qGtmARWLFhGZN1pTA==} @@ -2832,28 +3284,24 @@ packages: engines: {node: '>= 20'} cpu: [arm64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.3.3': resolution: {integrity: sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==} engines: {node: '>= 20'} cpu: [arm64] os: [linux] - libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.3.3': resolution: {integrity: sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==} engines: {node: '>= 20'} cpu: [x64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.3.3': resolution: {integrity: sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==} engines: {node: '>= 20'} cpu: [x64] os: [linux] - libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.3.3': resolution: {integrity: sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==} @@ -3216,6 +3664,9 @@ packages: next: optional: true + '@upstash/redis@1.38.2': + resolution: {integrity: sha512-RZ+JaRCVIS+ZTGnjOnDMr+/0aqDxsBb5rV6aW+Pys4SGELwr5lwE3UbLHRCHqMQ5Ulxj0b/CFBHfbmE175Otog==} + '@vercel/nft@1.10.2': resolution: {integrity: sha512-w+WyX5Ulmj4dtTZrxaulqrjaLZHSbnPzx75SJsTNYmotKsqn1JlLnDJa+lz5hn90HJofhl/2MAtw0mCrgM3qYw==} engines: {node: '>=20'} @@ -3488,6 +3939,9 @@ packages: bindings@1.5.0: resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + blake3-wasm@2.1.5: + resolution: {integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==} + bn.js@5.2.5: resolution: {integrity: sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg==} @@ -3730,25 +4184,6 @@ packages: convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - convex@1.42.3: - resolution: {integrity: sha512-7Tz/lH6UlZdiqzLPF/zrlH6Rlo/DOp836dL+GZkUMEQ2jaGGNnBIiIDcOOiEqtfSehuQ65r/rdNMnb4LupowaA==} - engines: {node: '>=18.0.0', npm: '>=7.0.0'} - hasBin: true - peerDependencies: - '@auth0/auth0-react': ^2.0.1 - '@clerk/clerk-react': ^4.12.8 || ^5.0.0 - '@clerk/react': ^6.4.3 - react: ^18.0.0 || ^19.0.0-0 || ^19.0.0 - peerDependenciesMeta: - '@auth0/auth0-react': - optional: true - '@clerk/clerk-react': - optional: true - '@clerk/react': - optional: true - react: - optional: true - cookie-es@1.2.3: resolution: {integrity: sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==} @@ -3766,6 +4201,10 @@ packages: resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} engines: {node: '>= 0.6'} + cookie@1.1.1: + resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==} + engines: {node: '>=18'} + copy-to-clipboard@3.3.3: resolution: {integrity: sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==} @@ -3812,8 +4251,8 @@ packages: crossws@0.3.5: resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==} - crossws@0.4.5: - resolution: {integrity: sha512-wUR89x/Rw7/8t+vn0CmGDYM9TD6VtARGb0LD5jq2wjtMy1vCP4M+sm6N6TigWeTYvnA8MoW29NqqXD0ep0rfBA==} + crossws@0.4.10: + resolution: {integrity: sha512-pz3oubH/dt12KjqsUB0IuXW4nwRDQ583iDsP4555Cpdqx0NoU7pGlWBcayyFI8f/l/idRpgjMEfwuOxSWJYlIA==} peerDependencies: srvx: '>=0.11.5' peerDependenciesMeta: @@ -3981,6 +4420,102 @@ packages: resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==} engines: {node: '>=12'} + drizzle-kit@0.31.10: + resolution: {integrity: sha512-7OZcmQUrdGI+DUNNsKBn1aW8qSoKuTH7d0mYgSP8bAzdFzKoovxEFnoGQp2dVs82EOJeYycqRtciopszwUf8bw==} + hasBin: true + + drizzle-orm@0.45.2: + resolution: {integrity: sha512-kY0BSaTNYWnoDMVoyY8uxmyHjpJW1geOmBMdSSicKo9CIIWkSxMIj2rkeSR51b8KAPB7m+qysjuHme5nKP+E5Q==} + peerDependencies: + '@aws-sdk/client-rds-data': '>=3' + '@cloudflare/workers-types': '>=4' + '@electric-sql/pglite': '>=0.2.0' + '@libsql/client': '>=0.10.0' + '@libsql/client-wasm': '>=0.10.0' + '@neondatabase/serverless': '>=0.10.0' + '@op-engineering/op-sqlite': '>=2' + '@opentelemetry/api': ^1.4.1 + '@planetscale/database': '>=1.13' + '@prisma/client': '*' + '@tidbcloud/serverless': '*' + '@types/better-sqlite3': '*' + '@types/pg': '*' + '@types/sql.js': '*' + '@upstash/redis': '>=1.34.7' + '@vercel/postgres': '>=0.8.0' + '@xata.io/client': '*' + better-sqlite3: '>=7' + bun-types: '*' + expo-sqlite: '>=14.0.0' + gel: '>=2' + knex: '*' + kysely: '*' + mysql2: '>=2' + pg: '>=8' + postgres: '>=3' + prisma: '*' + sql.js: '>=1' + sqlite3: '>=5' + peerDependenciesMeta: + '@aws-sdk/client-rds-data': + optional: true + '@cloudflare/workers-types': + optional: true + '@electric-sql/pglite': + optional: true + '@libsql/client': + optional: true + '@libsql/client-wasm': + optional: true + '@neondatabase/serverless': + optional: true + '@op-engineering/op-sqlite': + optional: true + '@opentelemetry/api': + optional: true + '@planetscale/database': + optional: true + '@prisma/client': + optional: true + '@tidbcloud/serverless': + optional: true + '@types/better-sqlite3': + optional: true + '@types/pg': + optional: true + '@types/sql.js': + optional: true + '@upstash/redis': + optional: true + '@vercel/postgres': + optional: true + '@xata.io/client': + optional: true + better-sqlite3: + optional: true + bun-types: + optional: true + expo-sqlite: + optional: true + gel: + optional: true + knex: + optional: true + kysely: + optional: true + mysql2: + optional: true + pg: + optional: true + postgres: + optional: true + prisma: + optional: true + sql.js: + optional: true + sqlite3: + optional: true + dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} @@ -4033,6 +4568,24 @@ packages: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} + env-runner@0.1.16: + resolution: {integrity: sha512-2LRJM4P2KLX6J83QZZrMqvgCDt/D5ea7wPcI3yYiy5cG/9rX5QwdwZFx0D7ktWnjdRyZxYjttGGorb5nFqb1CA==} + hasBin: true + peerDependencies: + '@netlify/runtime': ^4.1.23 + '@vercel/queue': '>=0.2.0' + miniflare: ^4.20260515.0 + wrangler: ^4.0.0 + peerDependenciesMeta: + '@netlify/runtime': + optional: true + '@vercel/queue': + optional: true + miniflare: + optional: true + wrangler: + optional: true + error-ex@1.3.4: resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==} @@ -4060,18 +4613,23 @@ packages: es6-promisify@5.0.0: resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + esbuild@0.25.12: resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} engines: {node: '>=18'} hasBin: true - esbuild@0.27.0: - resolution: {integrity: sha512-jd0f4NHbD6cALCyGElNpGAOtWxSq46l9X/sWB0Nzd5er4Kz2YTm+Vl0qKFT9KUJvD8+fiO8AvoHhFvEatfVixA==} + esbuild@0.28.0: + resolution: {integrity: sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==} engines: {node: '>=18'} hasBin: true - esbuild@0.28.0: - resolution: {integrity: sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==} + esbuild@0.28.1: + resolution: {integrity: sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==} engines: {node: '>=18'} hasBin: true @@ -4151,6 +4709,9 @@ packages: exsolve@1.0.8: resolution: {integrity: sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==} + exsolve@1.1.1: + resolution: {integrity: sha512-9U/jZUgjnSGyntRr6y5Muu1MJcwFl6kPu7k8qLF0IMNfLqvw0NZ4nnVDq0RVoZ0RvCyumib4Ez3KYrVfilrw+g==} + extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} @@ -4168,6 +4729,9 @@ packages: resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} engines: {node: '>=8.6.0'} + fast-sha256@1.3.0: + resolution: {integrity: sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==} + fast-stable-stringify@1.0.0: resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} @@ -4316,6 +4880,9 @@ packages: resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} engines: {node: '>=18'} + get-tsconfig@4.14.1: + resolution: {integrity: sha512-Dz/6HxkrxgNehhxLVeyv8sad9UzF2xBVeaKBQNDfJ5XiSXmp2gTR0eO0RWiT2NCKS5aGP9jjkOMggTN90qU50A==} + giget@3.2.0: resolution: {integrity: sha512-GvHTWcykIR/fP8cj8dMpuMMkvaeJfPvYnhq0oW+chSeIr+ldX21ifU2Ms6KBoyKZQZmVaUAAhQ2EZ68KJF8a7A==} hasBin: true @@ -4367,24 +4934,34 @@ packages: resolution: {integrity: sha512-O1Ld7Dr+nqPnmGpdhzLmMTQ4vAsD+rHwMm1NLUmoUFFymBOMKxCCrtDxqdBRYXdeEPEi3SyoR4TizJLQrnKBNA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + h3-rules@0.1.0: + resolution: {integrity: sha512-MrUUH1E/yoM7hvpKVbLs/CFeindwiTn7Fcfo+zXDpfuRYbcpJDPkYGGttCSiHNJmjUQNYQ5yn9veUIqFonYXuw==} + peerDependencies: + h3: ^2.0.1-rc.25 + ocache: '>=0.2.0' + peerDependenciesMeta: + ocache: + optional: true + h3@1.15.11: resolution: {integrity: sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==} - h3@2.0.1-rc.2: - resolution: {integrity: sha512-2vS7OETzPDzGQxmmcs6ttu7p0NW25zAdkPXYOr43dn4GZf81uUljJvupa158mcpUGpsQUqIy4O4THWUQT1yVeA==} + h3@2.0.1-rc.20: + resolution: {integrity: sha512-28ljodXuUp0fZovdiSRq4G9OgrxCztrJe5VdYzXAB7ueRvI7pIUqLU14Xi3XqdYJ/khXjfpUOOD2EQa6CmBgsg==} engines: {node: '>=20.11.1'} + hasBin: true peerDependencies: crossws: ^0.4.1 peerDependenciesMeta: crossws: optional: true - h3@2.0.1-rc.20: - resolution: {integrity: sha512-28ljodXuUp0fZovdiSRq4G9OgrxCztrJe5VdYzXAB7ueRvI7pIUqLU14Xi3XqdYJ/khXjfpUOOD2EQa6CmBgsg==} + h3@2.0.1-rc.26: + resolution: {integrity: sha512-GDxlvDsKxgjRvG5UBRJYyGJTMWLV30CJ4cV+e7QCTgftDHihrvio1fVPbNembhEr6J4WNm8IWy3fookgyTweLw==} engines: {node: '>=20.11.1'} hasBin: true peerDependencies: - crossws: ^0.4.1 + crossws: ^0.4.9 peerDependenciesMeta: crossws: optional: true @@ -4426,6 +5003,9 @@ packages: hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} + hookable@6.1.1: + resolution: {integrity: sha512-U9LYDy1CwhMCnprUfeAZWZGByVbhd54hwepegYTK7Pi5NvqEj63ifz5z+xukznehT7i6NIZRu89Ay1AZmRsLEQ==} + html-encoding-sniffer@6.0.0: resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==} engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} @@ -4446,8 +5026,8 @@ packages: resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} engines: {node: '>= 14'} - httpxy@0.5.3: - resolution: {integrity: sha512-SMS9V6Sn7VWaS11lYhoAr0ceoaiolTWf4jYdJn0NJhCdKMu9R2H9Fh0LBDWBHQF6HRLI1PmaePYsjanSpE5PEw==} + httpxy@0.5.5: + resolution: {integrity: sha512-uDjmnPyp1q4Sgzf3w+J/Fc6UqcCEj0x4Wjp7OqK5dGhNeDgpyrAmnS6ey8QWrX3SWDon2DMKf9sBa5X9+CVyMA==} human-signals@2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} @@ -4796,28 +5376,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.32.0: resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.32.0: resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.32.0: resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.32.0: resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} @@ -5024,6 +5600,10 @@ packages: resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} engines: {node: '>=18'} + miniflare@5.20260801.1-alpha: + resolution: {integrity: sha512-BHPVzIDA6mbx7LefxpvkXW7DHx9FKB9GorZatbnrrFTt3CVMU8zuUpbgyCuebwDKcTTOZos43ta8GQ0eMVEpxA==} + engines: {node: '>=22.0.0'} + minimatch@10.2.5: resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==} engines: {node: 18 || 20 || >=22} @@ -5075,24 +5655,39 @@ packages: resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==} engines: {node: '>= 0.6'} - nf3@0.1.12: - resolution: {integrity: sha512-qbMXT7RTGh74MYWPeqTIED8nDW70NXOULVHpdWcdZ7IVHVnAsMV9fNugSNnvooipDc1FMOzpis7T9nXJEbJhvQ==} + nf3@0.3.23: + resolution: {integrity: sha512-RWVLAWozmVD3AaDmaU3qMGB3v+yNlH5d9qqStI4e/WLlNQVnJ4YErGDbYCIrGFyrHdbF6I6Baf0Ae6c7tFYmSg==} - nitro-nightly@4.0.0-20251010-091516-7cafddba: - resolution: {integrity: sha512-biADkmoR/Nb9OmUURTfDI2BpGo2IMEt2RbsiMhjqdwz2w3tEm+tx0Hd28LXjBCwid+l8jpqyfmpwc8jzwdng3w==} + nitro-nightly@3.0.1-20260731-205209-52abde8a: + resolution: {integrity: sha512-KI1rwOJPgD0U57mE+1AefoEPjd+aJPJ4GCTLym0cXyfBBi8JtVsHmtB/4D3g1RaDwntjoz8H5nWnWGg7agYnuA==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: - rolldown: '*' - vite: ^7 + '@vercel/queue': ^0.4.0 + dotenv: '*' + giget: '*' + jiti: ^2.7.0 + rollup: ^4.62.2 + vite: ^7 || ^8 xml2js: ^0.6.2 + zephyr-agent: ^1.1.2 peerDependenciesMeta: - rolldown: + '@vercel/queue': + optional: true + dotenv: + optional: true + giget: + optional: true + jiti: + optional: true + rollup: optional: true vite: optional: true xml2js: optional: true + zephyr-agent: + optional: true nitropack@2.13.4: resolution: {integrity: sha512-tX7bT6zxNeMwkc6hxHiZeUoTOjVrcjoh1Z3cmxOlodIqjl4HISgqfGOmkWSayky3Nv9Z5+KQH52F8nmXJY5AAA==} @@ -5182,9 +5777,15 @@ packages: resolution: {integrity: sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A==} engines: {node: '>= 10'} + ocache@0.2.0: + resolution: {integrity: sha512-QE+SxXf/A8yR01rEOg2X5KwUe+mARHo1xQXl+iwLMzLIH06S5lBOZhhHQWp7T5etfFa8nOnRhvjGuo9YBCWwig==} + ofetch@1.5.1: resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==} + ofetch@2.0.0-alpha.3: + resolution: {integrity: sha512-zpYTCs2byOuft65vI3z43Dd6iSdFbOZZLb9/d21aCpx2rGastVU9dOCv0lu4ykc1Ur1anAYjDi3SUvR0vq50JA==} + ohash@2.0.11: resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==} @@ -5295,6 +5896,9 @@ packages: resolution: {integrity: sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==} engines: {node: 18 || 20 || >=22} + path-to-regexp@6.3.0: + resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==} + path-to-regexp@8.4.2: resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} @@ -5552,10 +6156,6 @@ packages: regenerator-runtime@0.13.11: resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} - rendu@0.0.6: - resolution: {integrity: sha512-nZ512Dw0MxKiIYfCVv8DPe6ig4m0Qt3FOYBJEXrammjIYBBPuHaudc0AGfYx+iyOw2q0itAtPywiVZXtTFCsig==} - hasBin: true - require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -5575,6 +6175,9 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve@1.22.12: resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==} engines: {node: '>= 0.4'} @@ -5592,6 +6195,11 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rolldown@1.2.3: + resolution: {integrity: sha512-rn9wpmxplLf7NLNyCk9FyWh3FM43DbY8jOzCdEPzH7uflhTftRbCEpqi6Ly2osgoU8OwObtmavMbWLaWy4LX7A==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + rollup-plugin-visualizer@7.0.1: resolution: {integrity: sha512-UJUT4+1Ho4OcWmPYU3sYXgUqI8B8Ayfe06MX7y0qCJ1K8aGoKtR/NDd/2nZqM7ADkrzny+I99Ul7GgyoiVNAgg==} engines: {node: '>=22'} @@ -5610,12 +6218,12 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - rou3@0.7.12: - resolution: {integrity: sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg==} - rou3@0.8.1: resolution: {integrity: sha512-ePa+XGk00/3HuCqrEnK3LxJW7I0SdNg6EFzKUJG73hMAdDcOUC/i/aSz7LSDwLrGr33kal/rqOGydzwl6U7zBA==} + rou3@0.9.1: + resolution: {integrity: sha512-z/sSmzvtwMDDnxsPVhfWMuG6F6mbmhFDXoVqLmMfbpDD9qfV3GDmSQpf0+W296/ZDIpW2wcMmBfpVFzcnOi/nA==} + router@2.2.0: resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} engines: {node: '>= 18'} @@ -5656,8 +6264,8 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - semver@7.8.2: - resolution: {integrity: sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==} + semver@7.8.5: + resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} engines: {node: '>=10'} hasBin: true @@ -5709,6 +6317,10 @@ packages: engines: {node: '>=20.18.1'} hasBin: true + sharp@0.35.2: + resolution: {integrity: sha512-FVtFjtBCMiJS6yb5CX7Sop45WFMpeGw6oRKuJnXYgf/f1ms/D7LE/ZUSNxnW7rZ/dbslQWYkoqFHGPaDBtaK4w==} + engines: {node: '>=20.9.0'} + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -5777,13 +6389,13 @@ packages: resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} engines: {node: '>= 12'} - srvx@0.11.16: - resolution: {integrity: sha512-bp07zRuycfTY43IjAvvTFnmnJi8ikW0VFiHwOhhYcVW/L4xQ1XY4PAd4Nuum1rsA17C39zL7x+CDhrn5AL32Rw==} + srvx@0.11.22: + resolution: {integrity: sha512-LqZxxBDMKuMAZzFzJnDCkFOrs9MZQZr0LvHiO/SuSZVdQaXD7xQ5UWTUxheJrQPve1qk9MG2B/yttUvJxw8egQ==} engines: {node: '>=20.16.0'} hasBin: true - srvx@0.8.16: - resolution: {integrity: sha512-hmcGW4CgroeSmzgF1Ihwgl+Ths0JqAJ7HwjP2X7e3JzY7u4IydLMcdnlqGQiQGUswz+PO9oh/KtCpOISIvs9QQ==} + srvx@0.12.5: + resolution: {integrity: sha512-IuvtDNQg5EIwv3c6dleyau7u8hCyGQ7D6+V/QM799Aud07z0wCUcurKLTRfyG33C8oUY+UWcVBFkfHMcbtmRLA==} engines: {node: '>=20.16.0'} hasBin: true @@ -5797,6 +6409,9 @@ packages: standard-as-callback@2.1.0: resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==} + standardwebhooks@1.0.0: + resolution: {integrity: sha512-BbHGOQK9olHPMvQNHWul6MYlrRTAOKn03rOe4A8O3CLWhNf4YHBqq2HJKKC+sfqpxiBY52pNeesD6jIiLDz8jg==} + statuses@1.5.0: resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} engines: {node: '>= 0.6'} @@ -5932,11 +6547,6 @@ packages: teex@1.0.1: resolution: {integrity: sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==} - terser@5.48.0: - resolution: {integrity: sha512-J/9An6vs9Us6wKRriSFXBWdRZapREHqFzdNUKk0pmu804EMR6dr6winwo7e5JDxN4xahxQsuysyYFwlwj4XN/Q==} - engines: {node: '>=10'} - hasBin: true - terser@5.49.0: resolution: {integrity: sha512-SNiDnXyHSrxVcIOtVbULzcTmniUiwcV7Nwdyj1twVubeTmbjoa8p69KKDpfkdoOavuM4/GRm1+ykI8qqnavHoA==} engines: {node: '>=10'} @@ -6023,6 +6633,11 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsx@4.23.11: + resolution: {integrity: sha512-Ry2oTEUnhBdeEdWIztY8kf3/nBGnPnjMLVGL0YfdRXMORuPER5NlKmayqxtxRxwB1xBN+RivRaJfe7PM1rtiyw==} + engines: {node: '>=18.0.0'} + hasBin: true + tw-animate-css@1.4.0: resolution: {integrity: sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==} @@ -6065,8 +6680,9 @@ packages: resolution: {integrity: sha512-uZsKNuzQxDMUY6M3pIMvy5tvlGmtq8XJ2oLAkfRKGNu+1VQAIvLy2xIVG5ATZl5wDXl/tddByAWCizRbOme+TA==} engines: {node: '>=20.18.1'} - unenv@2.0.0-rc.21: - resolution: {integrity: sha512-Wj7/AMtE9MRnAXa6Su3Lk0LNCfqDYgfwVjwRFVum9U7wsto1imuHqk4kTm7Jni+5A0Hn7dttL6O/zjvUvoo+8A==} + undici@7.29.0: + resolution: {integrity: sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==} + engines: {node: '>=20.18.1'} unenv@2.0.0-rc.24: resolution: {integrity: sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==} @@ -6176,32 +6792,32 @@ packages: uploadthing: optional: true - unstorage@2.0.0-alpha.3: - resolution: {integrity: sha512-BeoqISVh8jxqnPseHH7/92twe2VkQztrudXg8RFZVbXb4ckkFdpLk1LnNvsUndDltyodBMVxgI6V7JcbJYt2VQ==} + unstorage@2.0.0-alpha.7: + resolution: {integrity: sha512-ELPztchk2zgFJnakyodVY3vJWGW9jy//keJ32IOJVGUMyaPydwcA1FtVvWqT0TNRch9H+cMNEGllfVFfScImog==} peerDependencies: - '@azure/app-configuration': ^1.8.0 - '@azure/cosmos': ^4.2.0 - '@azure/data-tables': ^13.3.0 - '@azure/identity': ^4.6.0 - '@azure/keyvault-secrets': ^4.9.0 - '@azure/storage-blob': ^12.26.0 - '@capacitor/preferences': ^6.0.3 || ^7.0.0 - '@deno/kv': '>=0.9.0' + '@azure/app-configuration': ^1.11.0 + '@azure/cosmos': ^4.9.1 + '@azure/data-tables': ^13.3.2 + '@azure/identity': ^4.13.0 + '@azure/keyvault-secrets': ^4.10.0 + '@azure/storage-blob': ^12.31.0 + '@capacitor/preferences': ^6 || ^7 || ^8 + '@deno/kv': '>=0.13.0' '@netlify/blobs': ^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0 '@planetscale/database': ^1.19.0 - '@upstash/redis': ^1.34.3 - '@vercel/blob': '>=0.27.1' + '@upstash/redis': ^1.36.2 + '@vercel/blob': '>=0.27.3' '@vercel/functions': ^2.2.12 || ^3.0.0 '@vercel/kv': ^1.0.1 aws4fetch: ^1.0.20 - chokidar: ^4.0.3 - db0: '>=0.2.1' - idb-keyval: ^6.2.1 - ioredis: ^5.4.2 - lru-cache: ^11.2.2 - mongodb: ^6.20.0 - ofetch: ^1.4.1 - uploadthing: ^7.4.4 + chokidar: ^4 || ^5 + db0: '>=0.3.4' + idb-keyval: ^6.2.2 + ioredis: ^5.9.3 + lru-cache: ^11.2.6 + mongodb: ^6 || ^7 + ofetch: '*' + uploadthing: ^7.7.4 peerDependenciesMeta: '@azure/app-configuration': optional: true @@ -6442,6 +7058,21 @@ packages: engines: {node: ^16.13.0 || >=18.0.0} hasBin: true + workerd@1.20260801.1: + resolution: {integrity: sha512-/g9JGTyqnHtoIscpBHqKD8swE2V4StBs2i69PmLiOhH45OP95jCFICl4F1hKlgN57rqfni5LiCitttoX5OOkVA==} + engines: {node: '>=16'} + hasBin: true + + wrangler@4.120.0: + resolution: {integrity: sha512-cBmu/MeaB/fPacC0JpATs4duTOCagBxrZo+vBzuTX06tLzwSyAHE1drlHUZ8rP0VqVz1fy3ReGYTiHdKkoHltg==} + engines: {node: '>=22.0.0'} + hasBin: true + peerDependencies: + '@cloudflare/workers-types': ^5.20260801.1 + peerDependenciesMeta: + '@cloudflare/workers-types': + optional: true + wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} @@ -6558,6 +7189,9 @@ packages: youch-core@0.3.3: resolution: {integrity: sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==} + youch@4.1.0-beta.10: + resolution: {integrity: sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==} + youch@4.1.1: resolution: {integrity: sha512-mxW3qiSnl+GRxXsaUMzv2Mbada1Y8CDltET9UxejDQe6DBYlSekghl5U5K0ReAikcHDi0G1vKZEmmo/NWAGKLA==} @@ -6632,20 +7266,20 @@ snapshots: '@babel/compat-data@7.29.7': {} - '@babel/core@7.29.7(supports-color@10.2.2)': + '@babel/core@7.29.7': dependencies: '@babel/code-frame': 7.29.7 '@babel/generator': 7.29.7 '@babel/helper-compilation-targets': 7.29.7 - '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) '@babel/helpers': 7.29.7 '@babel/parser': 7.29.7 '@babel/template': 7.29.7 - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 '@jridgewell/remapping': 2.3.5 convert-source-map: 2.0.0 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -6672,41 +7306,41 @@ snapshots: lru-cache: 5.1.1 semver: 6.3.1 - '@babel/helper-create-class-features-plugin@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2)': + '@babel/helper-create-class-features-plugin@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-annotate-as-pure': 7.29.7 - '@babel/helper-member-expression-to-functions': 7.29.7(supports-color@10.2.2) + '@babel/helper-member-expression-to-functions': 7.29.7 '@babel/helper-optimise-call-expression': 7.29.7 - '@babel/helper-replace-supers': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) - '@babel/helper-skip-transparent-expression-wrappers': 7.29.7(supports-color@10.2.2) - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/helper-replace-supers': 7.29.7(@babel/core@7.29.7) + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + '@babel/traverse': 7.29.7 semver: 6.3.1 transitivePeerDependencies: - supports-color '@babel/helper-globals@7.29.7': {} - '@babel/helper-member-expression-to-functions@7.29.7(supports-color@10.2.2)': + '@babel/helper-member-expression-to-functions@7.29.7': dependencies: - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color - '@babel/helper-module-imports@7.29.7(supports-color@10.2.2)': + '@babel/helper-module-imports@7.29.7': dependencies: - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color - '@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2)': + '@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) - '@babel/helper-module-imports': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 + '@babel/helper-module-imports': 7.29.7 '@babel/helper-validator-identifier': 7.29.7 - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 transitivePeerDependencies: - supports-color @@ -6716,18 +7350,18 @@ snapshots: '@babel/helper-plugin-utils@7.29.7': {} - '@babel/helper-replace-supers@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2)': + '@babel/helper-replace-supers@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) - '@babel/helper-member-expression-to-functions': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 + '@babel/helper-member-expression-to-functions': 7.29.7 '@babel/helper-optimise-call-expression': 7.29.7 - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 transitivePeerDependencies: - supports-color - '@babel/helper-skip-transparent-expression-wrappers@7.29.7(supports-color@10.2.2)': + '@babel/helper-skip-transparent-expression-wrappers@7.29.7': dependencies: - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color @@ -6747,53 +7381,53 @@ snapshots: dependencies: '@babel/types': 7.29.7 - '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))': + '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))': + '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/plugin-transform-modules-commonjs@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2)': + '@babel/plugin-transform-modules-commonjs@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) - '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) + '@babel/core': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 transitivePeerDependencies: - supports-color - '@babel/plugin-transform-react-jsx-self@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))': + '@babel/plugin-transform-react-jsx-self@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/plugin-transform-react-jsx-source@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))': + '@babel/plugin-transform-react-jsx-source@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/plugin-transform-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2)': + '@babel/plugin-transform-typescript@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-annotate-as-pure': 7.29.7 - '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) + '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 - '@babel/helper-skip-transparent-expression-wrappers': 7.29.7(supports-color@10.2.2) - '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2)) + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7) transitivePeerDependencies: - supports-color - '@babel/preset-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2)': + '@babel/preset-typescript@7.29.7(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 '@babel/helper-validator-option': 7.29.7 - '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2)) - '@babel/plugin-transform-modules-commonjs': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) - '@babel/plugin-transform-typescript': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) + '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-transform-modules-commonjs': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-transform-typescript': 7.29.7(@babel/core@7.29.7) transitivePeerDependencies: - supports-color @@ -6805,7 +7439,7 @@ snapshots: '@babel/parser': 7.29.7 '@babel/types': 7.29.7 - '@babel/traverse@7.29.7(supports-color@10.2.2)': + '@babel/traverse@7.29.7': dependencies: '@babel/code-frame': 7.29.7 '@babel/generator': 7.29.7 @@ -6813,7 +7447,7 @@ snapshots: '@babel/parser': 7.29.7 '@babel/template': 7.29.7 '@babel/types': 7.29.7 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 transitivePeerDependencies: - supports-color @@ -6863,6 +7497,15 @@ snapshots: '@biomejs/cli-win32-x64@2.4.13': optional: true + '@clerk/backend@3.16.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + dependencies: + '@clerk/shared': 4.27.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + standardwebhooks: 1.0.0 + tslib: 2.8.1 + transitivePeerDependencies: + - react + - react-dom + '@clerk/localizations@4.13.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': dependencies: '@clerk/shared': 4.25.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) @@ -6887,16 +7530,26 @@ snapshots: react: 19.2.8 react-dom: 19.2.8(react@19.2.8) - '@clerk/ui@1.26.0(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@types/react@19.2.17)(bs58@6.0.0)(bufferutil@4.1.0)(react-dom@19.2.8(react@19.2.8))(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(react@19.2.8)(supports-color@10.2.2)(typescript@5.9.3)(utf-8-validate@6.0.6)': + '@clerk/shared@4.27.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + dependencies: + '@tanstack/query-core': 5.101.4 + dequal: 2.0.3 + glob-to-regexp: 0.4.1 + js-cookie: 3.0.7 + optionalDependencies: + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + + '@clerk/ui@1.26.0(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(@types/react@19.2.17)(bs58@6.0.0)(bufferutil@4.1.0)(react-dom@19.2.8(react@19.2.8))(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(react@19.2.8)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@clerk/localizations': 4.13.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@clerk/shared': 4.25.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@emotion/cache': 11.11.0 - '@emotion/react': 11.11.1(@types/react@19.2.17)(react@19.2.8)(supports-color@10.2.2) + '@emotion/react': 11.11.1(@types/react@19.2.17)(react@19.2.8) '@floating-ui/react': 0.27.12(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@formkit/auto-animate': 0.8.4 '@solana/wallet-adapter-base': 0.9.27(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)) - '@solana/wallet-adapter-react': 0.15.39(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bs58@6.0.0)(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(react@19.2.8)(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana/wallet-adapter-react': 0.15.39(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bs58@6.0.0)(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(react@19.2.8)(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/wallet-standard': 1.1.4(@solana/wallet-adapter-base@0.9.27(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)))(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bs58@6.0.0)(react@19.2.8) '@stylexjs/stylex': 0.19.0 '@swc/helpers': 0.5.21 @@ -6921,10 +7574,34 @@ snapshots: '@cloudflare/kv-asset-handler@0.4.2': {} - '@convex-dev/react-query@0.1.0(@tanstack/react-query@5.101.4(react@19.2.8))(convex@1.42.3(@clerk/react@6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))': + '@cloudflare/kv-asset-handler@0.5.0': {} + + '@cloudflare/unenv-preset@2.16.1(unenv@2.0.0-rc.24)(workerd@1.20260801.1)': dependencies: - '@tanstack/react-query': 5.101.4(react@19.2.8) - convex: 1.42.3(@clerk/react@6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6) + unenv: 2.0.0-rc.24 + optionalDependencies: + workerd: 1.20260801.1 + + '@cloudflare/workerd-darwin-64@1.20260801.1': + optional: true + + '@cloudflare/workerd-darwin-arm64@1.20260801.1': + optional: true + + '@cloudflare/workerd-linux-64@1.20260801.1': + optional: true + + '@cloudflare/workerd-linux-arm64@1.20260801.1': + optional: true + + '@cloudflare/workerd-windows-64@1.20260801.1': + optional: true + + '@cloudflare/workers-types@5.20260808.1': {} + + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 '@csstools/color-helpers@6.0.2': {} @@ -6971,9 +7648,16 @@ snapshots: '@dotenvx/primitives@0.8.0': {} - '@emotion/babel-plugin@11.13.5(supports-color@10.2.2)': + '@drizzle-team/brocli@0.10.2': {} + + '@emnapi/runtime@1.11.3': + dependencies: + tslib: 2.8.1 + optional: true + + '@emotion/babel-plugin@11.13.5': dependencies: - '@babel/helper-module-imports': 7.29.7(supports-color@10.2.2) + '@babel/helper-module-imports': 7.29.7 '@babel/runtime': 7.29.7 '@emotion/hash': 0.9.2 '@emotion/memoize': 0.9.0 @@ -7001,10 +7685,10 @@ snapshots: '@emotion/memoize@0.9.0': {} - '@emotion/react@11.11.1(@types/react@19.2.17)(react@19.2.8)(supports-color@10.2.2)': + '@emotion/react@11.11.1(@types/react@19.2.17)(react@19.2.8)': dependencies: '@babel/runtime': 7.29.7 - '@emotion/babel-plugin': 11.13.5(supports-color@10.2.2) + '@emotion/babel-plugin': 11.13.5 '@emotion/cache': 11.11.0 '@emotion/serialize': 1.3.3 '@emotion/use-insertion-effect-with-fallbacks': 1.2.0(react@19.2.8) @@ -7037,240 +7721,316 @@ snapshots: '@emotion/weak-memoize@0.3.1': {} + '@esbuild-kit/core-utils@3.3.2': + dependencies: + esbuild: 0.18.20 + source-map-support: 0.5.21 + + '@esbuild-kit/esm-loader@2.6.5': + dependencies: + '@esbuild-kit/core-utils': 3.3.2 + get-tsconfig: 4.14.1 + '@esbuild/aix-ppc64@0.25.12': optional: true - '@esbuild/aix-ppc64@0.27.0': + '@esbuild/aix-ppc64@0.28.0': optional: true - '@esbuild/aix-ppc64@0.28.0': + '@esbuild/aix-ppc64@0.28.1': optional: true - '@esbuild/android-arm64@0.25.12': + '@esbuild/android-arm64@0.18.20': optional: true - '@esbuild/android-arm64@0.27.0': + '@esbuild/android-arm64@0.25.12': optional: true '@esbuild/android-arm64@0.28.0': optional: true - '@esbuild/android-arm@0.25.12': + '@esbuild/android-arm64@0.28.1': + optional: true + + '@esbuild/android-arm@0.18.20': optional: true - '@esbuild/android-arm@0.27.0': + '@esbuild/android-arm@0.25.12': optional: true '@esbuild/android-arm@0.28.0': optional: true - '@esbuild/android-x64@0.25.12': + '@esbuild/android-arm@0.28.1': + optional: true + + '@esbuild/android-x64@0.18.20': optional: true - '@esbuild/android-x64@0.27.0': + '@esbuild/android-x64@0.25.12': optional: true '@esbuild/android-x64@0.28.0': optional: true - '@esbuild/darwin-arm64@0.25.12': + '@esbuild/android-x64@0.28.1': + optional: true + + '@esbuild/darwin-arm64@0.18.20': optional: true - '@esbuild/darwin-arm64@0.27.0': + '@esbuild/darwin-arm64@0.25.12': optional: true '@esbuild/darwin-arm64@0.28.0': optional: true - '@esbuild/darwin-x64@0.25.12': + '@esbuild/darwin-arm64@0.28.1': + optional: true + + '@esbuild/darwin-x64@0.18.20': optional: true - '@esbuild/darwin-x64@0.27.0': + '@esbuild/darwin-x64@0.25.12': optional: true '@esbuild/darwin-x64@0.28.0': optional: true - '@esbuild/freebsd-arm64@0.25.12': + '@esbuild/darwin-x64@0.28.1': + optional: true + + '@esbuild/freebsd-arm64@0.18.20': optional: true - '@esbuild/freebsd-arm64@0.27.0': + '@esbuild/freebsd-arm64@0.25.12': optional: true '@esbuild/freebsd-arm64@0.28.0': optional: true - '@esbuild/freebsd-x64@0.25.12': + '@esbuild/freebsd-arm64@0.28.1': + optional: true + + '@esbuild/freebsd-x64@0.18.20': optional: true - '@esbuild/freebsd-x64@0.27.0': + '@esbuild/freebsd-x64@0.25.12': optional: true '@esbuild/freebsd-x64@0.28.0': optional: true - '@esbuild/linux-arm64@0.25.12': + '@esbuild/freebsd-x64@0.28.1': + optional: true + + '@esbuild/linux-arm64@0.18.20': optional: true - '@esbuild/linux-arm64@0.27.0': + '@esbuild/linux-arm64@0.25.12': optional: true '@esbuild/linux-arm64@0.28.0': optional: true - '@esbuild/linux-arm@0.25.12': + '@esbuild/linux-arm64@0.28.1': + optional: true + + '@esbuild/linux-arm@0.18.20': optional: true - '@esbuild/linux-arm@0.27.0': + '@esbuild/linux-arm@0.25.12': optional: true '@esbuild/linux-arm@0.28.0': optional: true - '@esbuild/linux-ia32@0.25.12': + '@esbuild/linux-arm@0.28.1': + optional: true + + '@esbuild/linux-ia32@0.18.20': optional: true - '@esbuild/linux-ia32@0.27.0': + '@esbuild/linux-ia32@0.25.12': optional: true '@esbuild/linux-ia32@0.28.0': optional: true - '@esbuild/linux-loong64@0.25.12': + '@esbuild/linux-ia32@0.28.1': + optional: true + + '@esbuild/linux-loong64@0.18.20': optional: true - '@esbuild/linux-loong64@0.27.0': + '@esbuild/linux-loong64@0.25.12': optional: true '@esbuild/linux-loong64@0.28.0': optional: true - '@esbuild/linux-mips64el@0.25.12': + '@esbuild/linux-loong64@0.28.1': + optional: true + + '@esbuild/linux-mips64el@0.18.20': optional: true - '@esbuild/linux-mips64el@0.27.0': + '@esbuild/linux-mips64el@0.25.12': optional: true '@esbuild/linux-mips64el@0.28.0': optional: true - '@esbuild/linux-ppc64@0.25.12': + '@esbuild/linux-mips64el@0.28.1': + optional: true + + '@esbuild/linux-ppc64@0.18.20': optional: true - '@esbuild/linux-ppc64@0.27.0': + '@esbuild/linux-ppc64@0.25.12': optional: true '@esbuild/linux-ppc64@0.28.0': optional: true - '@esbuild/linux-riscv64@0.25.12': + '@esbuild/linux-ppc64@0.28.1': + optional: true + + '@esbuild/linux-riscv64@0.18.20': optional: true - '@esbuild/linux-riscv64@0.27.0': + '@esbuild/linux-riscv64@0.25.12': optional: true '@esbuild/linux-riscv64@0.28.0': optional: true - '@esbuild/linux-s390x@0.25.12': + '@esbuild/linux-riscv64@0.28.1': + optional: true + + '@esbuild/linux-s390x@0.18.20': optional: true - '@esbuild/linux-s390x@0.27.0': + '@esbuild/linux-s390x@0.25.12': optional: true '@esbuild/linux-s390x@0.28.0': optional: true - '@esbuild/linux-x64@0.25.12': + '@esbuild/linux-s390x@0.28.1': + optional: true + + '@esbuild/linux-x64@0.18.20': optional: true - '@esbuild/linux-x64@0.27.0': + '@esbuild/linux-x64@0.25.12': optional: true '@esbuild/linux-x64@0.28.0': optional: true - '@esbuild/netbsd-arm64@0.25.12': + '@esbuild/linux-x64@0.28.1': optional: true - '@esbuild/netbsd-arm64@0.27.0': + '@esbuild/netbsd-arm64@0.25.12': optional: true '@esbuild/netbsd-arm64@0.28.0': optional: true - '@esbuild/netbsd-x64@0.25.12': + '@esbuild/netbsd-arm64@0.28.1': optional: true - '@esbuild/netbsd-x64@0.27.0': + '@esbuild/netbsd-x64@0.18.20': + optional: true + + '@esbuild/netbsd-x64@0.25.12': optional: true '@esbuild/netbsd-x64@0.28.0': optional: true - '@esbuild/openbsd-arm64@0.25.12': + '@esbuild/netbsd-x64@0.28.1': optional: true - '@esbuild/openbsd-arm64@0.27.0': + '@esbuild/openbsd-arm64@0.25.12': optional: true '@esbuild/openbsd-arm64@0.28.0': optional: true - '@esbuild/openbsd-x64@0.25.12': + '@esbuild/openbsd-arm64@0.28.1': + optional: true + + '@esbuild/openbsd-x64@0.18.20': optional: true - '@esbuild/openbsd-x64@0.27.0': + '@esbuild/openbsd-x64@0.25.12': optional: true '@esbuild/openbsd-x64@0.28.0': optional: true - '@esbuild/openharmony-arm64@0.25.12': + '@esbuild/openbsd-x64@0.28.1': optional: true - '@esbuild/openharmony-arm64@0.27.0': + '@esbuild/openharmony-arm64@0.25.12': optional: true '@esbuild/openharmony-arm64@0.28.0': optional: true - '@esbuild/sunos-x64@0.25.12': + '@esbuild/openharmony-arm64@0.28.1': optional: true - '@esbuild/sunos-x64@0.27.0': + '@esbuild/sunos-x64@0.18.20': + optional: true + + '@esbuild/sunos-x64@0.25.12': optional: true '@esbuild/sunos-x64@0.28.0': optional: true - '@esbuild/win32-arm64@0.25.12': + '@esbuild/sunos-x64@0.28.1': optional: true - '@esbuild/win32-arm64@0.27.0': + '@esbuild/win32-arm64@0.18.20': + optional: true + + '@esbuild/win32-arm64@0.25.12': optional: true '@esbuild/win32-arm64@0.28.0': optional: true - '@esbuild/win32-ia32@0.25.12': + '@esbuild/win32-arm64@0.28.1': optional: true - '@esbuild/win32-ia32@0.27.0': + '@esbuild/win32-ia32@0.18.20': + optional: true + + '@esbuild/win32-ia32@0.25.12': optional: true '@esbuild/win32-ia32@0.28.0': optional: true - '@esbuild/win32-x64@0.25.12': + '@esbuild/win32-ia32@0.28.1': optional: true - '@esbuild/win32-x64@0.27.0': + '@esbuild/win32-x64@0.18.20': + optional: true + + '@esbuild/win32-x64@0.25.12': optional: true '@esbuild/win32-x64@0.28.0': optional: true + '@esbuild/win32-x64@0.28.1': + optional: true + '@exodus/bytes@1.15.1(@noble/hashes@1.8.0)': optionalDependencies: '@noble/hashes': 1.8.0 @@ -7290,38 +8050,146 @@ snapshots: react: 19.2.8 react-dom: 19.2.8(react@19.2.8) - '@floating-ui/react@0.27.12(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': - dependencies: - '@floating-ui/react-dom': 2.1.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) - '@floating-ui/utils': 0.2.11 - react: 19.2.8 - react-dom: 19.2.8(react@19.2.8) - tabbable: 6.5.0 + '@floating-ui/react@0.27.12(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + dependencies: + '@floating-ui/react-dom': 2.1.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + '@floating-ui/utils': 0.2.11 + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + tabbable: 6.5.0 + + '@floating-ui/utils@0.2.11': {} + + '@fontsource-variable/bricolage-grotesque@5.3.0': {} + + '@fontsource-variable/inter@5.3.0': {} + + '@fontsource/ibm-plex-mono@5.3.0': {} + + '@formkit/auto-animate@0.8.4': {} + + '@google/genai@1.52.0(@modelcontextprotocol/sdk@1.29.0(zod@3.25.76))(bufferutil@4.1.0)(utf-8-validate@6.0.6)': + dependencies: + google-auth-library: 10.7.0 + p-retry: 4.6.2 + protobufjs: 7.6.2 + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + optionalDependencies: + '@modelcontextprotocol/sdk': 1.29.0(zod@3.25.76) + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + '@hono/node-server@1.19.15(hono@4.12.32)': + dependencies: + hono: 4.12.32 + + '@img/colour@1.1.0': {} + + '@img/sharp-darwin-arm64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-darwin-arm64': 1.3.1 + optional: true + + '@img/sharp-darwin-x64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-darwin-x64': 1.3.1 + optional: true + + '@img/sharp-freebsd-wasm32@0.35.2': + dependencies: + '@img/sharp-wasm32': 0.35.2 + optional: true + + '@img/sharp-libvips-darwin-arm64@1.3.1': + optional: true + + '@img/sharp-libvips-darwin-x64@1.3.1': + optional: true + + '@img/sharp-libvips-linux-arm64@1.3.1': + optional: true + + '@img/sharp-libvips-linux-arm@1.3.1': + optional: true + + '@img/sharp-libvips-linux-ppc64@1.3.1': + optional: true + + '@img/sharp-libvips-linux-riscv64@1.3.1': + optional: true + + '@img/sharp-libvips-linux-s390x@1.3.1': + optional: true + + '@img/sharp-libvips-linux-x64@1.3.1': + optional: true + + '@img/sharp-libvips-linuxmusl-arm64@1.3.1': + optional: true + + '@img/sharp-libvips-linuxmusl-x64@1.3.1': + optional: true + + '@img/sharp-linux-arm64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linux-arm64': 1.3.1 + optional: true + + '@img/sharp-linux-arm@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linux-arm': 1.3.1 + optional: true + + '@img/sharp-linux-ppc64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linux-ppc64': 1.3.1 + optional: true - '@floating-ui/utils@0.2.11': {} + '@img/sharp-linux-riscv64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linux-riscv64': 1.3.1 + optional: true - '@fontsource-variable/bricolage-grotesque@5.3.0': {} + '@img/sharp-linux-s390x@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linux-s390x': 1.3.1 + optional: true - '@fontsource-variable/inter@5.3.0': {} + '@img/sharp-linux-x64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linux-x64': 1.3.1 + optional: true - '@formkit/auto-animate@0.8.4': {} + '@img/sharp-linuxmusl-arm64@0.35.2': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-arm64': 1.3.1 + optional: true - '@google/genai@1.52.0(@modelcontextprotocol/sdk@1.29.0(supports-color@10.2.2)(zod@3.25.76))(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6)': - dependencies: - google-auth-library: 10.7.0(supports-color@10.2.2) - p-retry: 4.6.2 - protobufjs: 7.6.2 - ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + '@img/sharp-linuxmusl-x64@0.35.2': optionalDependencies: - '@modelcontextprotocol/sdk': 1.29.0(supports-color@10.2.2)(zod@3.25.76) - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate + '@img/sharp-libvips-linuxmusl-x64': 1.3.1 + optional: true - '@hono/node-server@1.19.15(hono@4.12.32)': + '@img/sharp-wasm32@0.35.2': dependencies: - hono: 4.12.32 + '@emnapi/runtime': 1.11.3 + optional: true + + '@img/sharp-webcontainers-wasm32@0.35.2': + dependencies: + '@img/sharp-wasm32': 0.35.2 + optional: true + + '@img/sharp-win32-arm64@0.35.2': + optional: true + + '@img/sharp-win32-ia32@0.35.2': + optional: true + + '@img/sharp-win32-x64@0.35.2': + optional: true '@ioredis/commands@1.10.0': {} @@ -7377,20 +8245,25 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 - '@mapbox/node-pre-gyp@2.0.3(supports-color@10.2.2)': + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@mapbox/node-pre-gyp@2.0.3': dependencies: consola: 3.4.2 detect-libc: 2.1.2 - https-proxy-agent: 7.0.6(supports-color@10.2.2) + https-proxy-agent: 7.0.6 node-fetch: 2.7.0 nopt: 8.1.0 - semver: 7.8.2 + semver: 7.8.5 tar: 7.5.16 transitivePeerDependencies: - encoding - supports-color - '@modelcontextprotocol/sdk@1.29.0(supports-color@10.2.2)(zod@3.25.76)': + '@modelcontextprotocol/sdk@1.29.0(zod@3.25.76)': dependencies: '@hono/node-server': 1.19.15(hono@4.12.32) ajv: 8.20.0 @@ -7400,8 +8273,8 @@ snapshots: cross-spawn: 7.0.6 eventsource: 3.0.7 eventsource-parser: 3.1.0 - express: 5.2.1(supports-color@10.2.2) - express-rate-limit: 8.6.0(express@5.2.1(supports-color@10.2.2))(supports-color@10.2.2) + express: 5.2.1 + express-rate-limit: 8.6.0(express@5.2.1) hono: 4.12.32 jose: 6.2.4 json-schema-typed: 8.0.2 @@ -7447,6 +8320,8 @@ snapshots: '@oozcitak/util@10.0.0': {} + '@oxc-project/types@0.143.0': {} + '@parcel/watcher-android-arm64@2.5.6': optional: true @@ -7480,7 +8355,7 @@ snapshots: '@parcel/watcher-wasm@2.5.6': dependencies: is-glob: 4.0.3 - picomatch: 4.0.4 + picomatch: 4.0.5 '@parcel/watcher-win32-arm64@2.5.6': optional: true @@ -7496,7 +8371,7 @@ snapshots: detect-libc: 2.1.2 is-glob: 4.0.3 node-addon-api: 7.1.1 - picomatch: 4.0.4 + picomatch: 4.0.5 optionalDependencies: '@parcel/watcher-android-arm64': 2.5.6 '@parcel/watcher-darwin-arm64': 2.5.6 @@ -7519,6 +8394,12 @@ snapshots: dependencies: kleur: 4.1.5 + '@poppinss/dumper@0.6.5': + dependencies: + '@poppinss/colors': 4.1.6 + '@sindresorhus/is': 7.2.0 + supports-color: 10.2.2 + '@poppinss/dumper@0.7.0': dependencies: '@poppinss/colors': 4.1.6 @@ -8296,17 +9177,17 @@ snapshots: '@radix-ui/rect@1.1.3': {} - '@react-native-async-storage/async-storage@1.24.0(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))': + '@react-native-async-storage/async-storage@1.24.0(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))': dependencies: merge-options: 3.0.4 - react-native: 0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6) + react-native: 0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6) optional: true '@react-native/assets-registry@0.86.0': {} - '@react-native/codegen@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))': + '@react-native/codegen@0.86.0(@babel/core@7.29.7)': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/parser': 7.29.7 hermes-parser: 0.36.0 invariant: 2.2.4 @@ -8314,15 +9195,15 @@ snapshots: tinyglobby: 0.2.17 yargs: 17.7.2 - '@react-native/community-cli-plugin@0.86.0(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6)': + '@react-native/community-cli-plugin@0.86.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)': dependencies: - '@react-native/dev-middleware': 0.86.0(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) - debug: 4.4.3(supports-color@10.2.2) + '@react-native/dev-middleware': 0.86.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + debug: 4.4.3 invariant: 2.2.4 - metro: 0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) - metro-config: 0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) + metro: 0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) + metro-config: 0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) metro-core: 0.84.4 - semver: 7.8.2 + semver: 7.8.5 transitivePeerDependencies: - bufferutil - supports-color @@ -8330,27 +9211,27 @@ snapshots: '@react-native/debugger-frontend@0.86.0': {} - '@react-native/debugger-shell@0.86.0(supports-color@10.2.2)': + '@react-native/debugger-shell@0.86.0': dependencies: cross-spawn: 7.0.6 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 fb-dotslash: 0.5.8 transitivePeerDependencies: - supports-color - '@react-native/dev-middleware@0.86.0(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6)': + '@react-native/dev-middleware@0.86.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)': dependencies: '@isaacs/ttlcache': 1.4.1 '@react-native/debugger-frontend': 0.86.0 - '@react-native/debugger-shell': 0.86.0(supports-color@10.2.2) - chrome-launcher: 0.15.2(supports-color@10.2.2) - chromium-edge-launcher: 0.3.0(supports-color@10.2.2) - connect: 3.7.0(supports-color@10.2.2) - debug: 4.4.3(supports-color@10.2.2) + '@react-native/debugger-shell': 0.86.0 + chrome-launcher: 0.15.2 + chromium-edge-launcher: 0.3.0 + connect: 3.7.0 + debug: 4.4.3 invariant: 2.2.4 nullthrows: 1.1.1 open: 7.4.2 - serve-static: 1.16.3(supports-color@10.2.2) + serve-static: 1.16.3 ws: 7.5.11(bufferutil@4.1.0)(utf-8-validate@6.0.6) transitivePeerDependencies: - bufferutil @@ -8363,17 +9244,61 @@ snapshots: '@react-native/normalize-colors@0.86.0': {} - '@react-native/virtualized-lists@0.86.0(@types/react@19.2.17)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(react@19.2.8)': + '@react-native/virtualized-lists@0.86.0(@types/react@19.2.17)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(react@19.2.8)': dependencies: invariant: 2.2.4 nullthrows: 1.1.1 react: 19.2.8 - react-native: 0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6) + react-native: 0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6) optionalDependencies: '@types/react': 19.2.17 + '@rolldown/binding-android-arm64@1.2.3': + optional: true + + '@rolldown/binding-darwin-arm64@1.2.3': + optional: true + + '@rolldown/binding-darwin-x64@1.2.3': + optional: true + + '@rolldown/binding-freebsd-x64@1.2.3': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.2.3': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.2.3': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.2.3': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.2.3': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.2.3': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.2.3': + optional: true + + '@rolldown/binding-linux-x64-musl@1.2.3': + optional: true + + '@rolldown/binding-openharmony-arm64@1.2.3': + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.2.3': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.2.3': + optional: true + '@rolldown/pluginutils@1.0.0-rc.3': {} + '@rolldown/pluginutils@1.0.1': {} + '@rollup/plugin-alias@6.0.0(rollup@4.61.1)': optionalDependencies: rollup: 4.61.1 @@ -8383,10 +9308,10 @@ snapshots: '@rollup/pluginutils': 5.4.0(rollup@4.61.1) commondir: 1.0.1 estree-walker: 2.0.2 - fdir: 6.5.0(picomatch@4.0.4) + fdir: 6.5.0(picomatch@4.0.5) is-reference: 1.2.1 magic-string: 0.30.21 - picomatch: 4.0.4 + picomatch: 4.0.5 optionalDependencies: rollup: 4.61.1 @@ -8425,7 +9350,7 @@ snapshots: dependencies: serialize-javascript: 7.0.5 smob: 1.6.2 - terser: 5.48.0 + terser: 5.49.0 optionalDependencies: rollup: 4.61.1 @@ -8433,7 +9358,7 @@ snapshots: dependencies: '@types/estree': 1.0.9 estree-walker: 2.0.2 - picomatch: 4.0.4 + picomatch: 4.0.5 optionalDependencies: rollup: 4.61.1 @@ -8520,9 +9445,9 @@ snapshots: '@sindresorhus/merge-streams@4.0.0': {} - '@solana-mobile/mobile-wallet-adapter-protocol-web3js@2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': + '@solana-mobile/mobile-wallet-adapter-protocol-web3js@2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: - '@solana-mobile/mobile-wallet-adapter-protocol': 2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana-mobile/mobile-wallet-adapter-protocol': 2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) transitivePeerDependencies: - bufferutil @@ -8531,41 +9456,41 @@ snapshots: - typescript - utf-8-validate - '@solana-mobile/mobile-wallet-adapter-protocol@2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': + '@solana-mobile/mobile-wallet-adapter-protocol@2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: '@solana/kit': 6.10.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/wallet-standard-features': 1.4.0 '@solana/wallet-standard-util': 1.1.3 '@wallet-standard/core': 1.1.2 - react-native: 0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6) + react-native: 0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6) transitivePeerDependencies: - bufferutil - fastestsmallesttextencoderdecoder - typescript - utf-8-validate - '@solana-mobile/wallet-adapter-mobile@2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': + '@solana-mobile/wallet-adapter-mobile@2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: - '@solana-mobile/mobile-wallet-adapter-protocol': 2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) - '@solana-mobile/mobile-wallet-adapter-protocol-web3js': 2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) - '@solana-mobile/wallet-standard-mobile': 0.5.3(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana-mobile/mobile-wallet-adapter-protocol': 2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana-mobile/mobile-wallet-adapter-protocol-web3js': 2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana-mobile/wallet-standard-mobile': 0.5.3(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/wallet-adapter-base': 0.9.27(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)) '@solana/wallet-standard-features': 1.4.0 '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) '@wallet-standard/core': 1.1.2 - react-native: 0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6) + react-native: 0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6) tslib: 2.8.1 optionalDependencies: - '@react-native-async-storage/async-storage': 1.24.0(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6)) + '@react-native-async-storage/async-storage': 1.24.0(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6)) transitivePeerDependencies: - bufferutil - fastestsmallesttextencoderdecoder - typescript - utf-8-validate - '@solana-mobile/wallet-standard-mobile@0.5.3(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': + '@solana-mobile/wallet-standard-mobile@0.5.3(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: - '@solana-mobile/mobile-wallet-adapter-protocol': 2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana-mobile/mobile-wallet-adapter-protocol': 2.2.9(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/wallet-standard-chains': 1.1.2 '@solana/wallet-standard-features': 1.4.0 '@wallet-standard/base': 1.1.1 @@ -8574,7 +9499,7 @@ snapshots: qrcode: 1.5.4 tslib: 2.8.1 optionalDependencies: - '@react-native-async-storage/async-storage': 1.24.0(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6)) + '@react-native-async-storage/async-storage': 1.24.0(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6)) transitivePeerDependencies: - bufferutil - fastestsmallesttextencoderdecoder @@ -9082,9 +10007,9 @@ snapshots: '@wallet-standard/features': 1.1.1 eventemitter3: 5.0.4 - '@solana/wallet-adapter-react@0.15.39(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bs58@6.0.0)(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(react@19.2.8)(typescript@5.9.3)(utf-8-validate@6.0.6)': + '@solana/wallet-adapter-react@0.15.39(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bs58@6.0.0)(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(react@19.2.8)(typescript@5.9.3)(utf-8-validate@6.0.6)': dependencies: - '@solana-mobile/wallet-adapter-mobile': 2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) + '@solana-mobile/wallet-adapter-mobile': 2.2.9(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bufferutil@4.1.0)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(typescript@5.9.3)(utf-8-validate@6.0.6) '@solana/wallet-adapter-base': 0.9.27(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)) '@solana/wallet-standard-wallet-adapter-react': 1.1.5(@solana/wallet-adapter-base@0.9.27(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)))(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6))(bs58@6.0.0)(react@19.2.8) '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6) @@ -9221,6 +10146,8 @@ snapshots: '@speed-highlight/core@1.2.15': {} + '@stablelib/base64@1.0.1': {} + '@stylexjs/stylex@0.19.0': dependencies: css-mediaquery: 0.1.2 @@ -9304,12 +10231,12 @@ snapshots: postcss: 8.5.23 tailwindcss: 4.3.3 - '@tailwindcss/vite@4.3.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@tailwindcss/vite@4.3.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: '@tailwindcss/node': 4.3.3 '@tailwindcss/oxide': 4.3.3 tailwindcss: 4.3.3 - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) '@tanstack/devtools-client@0.0.3': dependencies: @@ -9350,11 +10277,11 @@ snapshots: '@tanstack/history@1.162.0': {} - '@tanstack/nitro-v2-vite-plugin@1.155.0(srvx@0.8.16)(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@tanstack/nitro-v2-vite-plugin@1.155.0(@upstash/redis@1.38.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(rolldown@1.2.3)(srvx@0.11.22)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: - nitropack: 2.13.4(srvx@0.8.16)(supports-color@10.2.2) + nitropack: 2.13.4(@upstash/redis@1.38.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(rolldown@1.2.3)(srvx@0.11.22) pathe: 2.0.3 - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -9464,15 +10391,15 @@ snapshots: react: 19.2.8 react-dom: 19.2.8(react@19.2.8) - '@tanstack/react-start-rsc@0.1.31(crossws@0.4.5(srvx@0.8.16))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@tanstack/react-start-rsc@0.1.31(crossws@0.4.10(srvx@0.11.22))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: '@tanstack/react-router': 1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@tanstack/router-core': 1.171.15 - '@tanstack/router-utils': 1.162.2(supports-color@10.2.2) + '@tanstack/router-utils': 1.162.2 '@tanstack/start-client-core': 1.170.14 '@tanstack/start-fn-stubs': 1.162.0 - '@tanstack/start-plugin-core': 1.171.24(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(crossws@0.4.5(srvx@0.8.16))(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) - '@tanstack/start-server-core': 1.169.17(crossws@0.4.5(srvx@0.8.16)) + '@tanstack/start-plugin-core': 1.171.24(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(crossws@0.4.10(srvx@0.11.22))(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) + '@tanstack/start-server-core': 1.169.17(crossws@0.4.10(srvx@0.11.22)) '@tanstack/start-storage-context': 1.167.17 pathe: 2.0.3 react: 19.2.8 @@ -9485,31 +10412,31 @@ snapshots: - vite-plugin-solid - webpack - '@tanstack/react-start-server@1.167.22(crossws@0.4.5(srvx@0.8.16))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': + '@tanstack/react-start-server@1.167.22(crossws@0.4.10(srvx@0.11.22))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)': dependencies: '@tanstack/react-router': 1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@tanstack/router-core': 1.171.15 - '@tanstack/start-server-core': 1.169.17(crossws@0.4.5(srvx@0.8.16)) + '@tanstack/start-server-core': 1.169.17(crossws@0.4.10(srvx@0.11.22)) react: 19.2.8 react-dom: 19.2.8(react@19.2.8) transitivePeerDependencies: - crossws - '@tanstack/react-start@1.168.32(crossws@0.4.5(srvx@0.8.16))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@tanstack/react-start@1.168.32(crossws@0.4.10(srvx@0.11.22))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: '@tanstack/react-router': 1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@tanstack/react-start-client': 1.168.16(react-dom@19.2.8(react@19.2.8))(react@19.2.8) - '@tanstack/react-start-rsc': 0.1.31(crossws@0.4.5(srvx@0.8.16))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) - '@tanstack/react-start-server': 1.167.22(crossws@0.4.5(srvx@0.8.16))(react-dom@19.2.8(react@19.2.8))(react@19.2.8) - '@tanstack/router-utils': 1.162.2(supports-color@10.2.2) + '@tanstack/react-start-rsc': 0.1.31(crossws@0.4.10(srvx@0.11.22))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) + '@tanstack/react-start-server': 1.167.22(crossws@0.4.10(srvx@0.11.22))(react-dom@19.2.8(react@19.2.8))(react@19.2.8) + '@tanstack/router-utils': 1.162.2 '@tanstack/start-client-core': 1.170.14 - '@tanstack/start-plugin-core': 1.171.24(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(crossws@0.4.5(srvx@0.8.16))(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) - '@tanstack/start-server-core': 1.169.17(crossws@0.4.5(srvx@0.8.16)) + '@tanstack/start-plugin-core': 1.171.24(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(crossws@0.4.10(srvx@0.11.22))(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) + '@tanstack/start-server-core': 1.169.17(crossws@0.4.10(srvx@0.11.22)) pathe: 2.0.3 react: 19.2.8 react-dom: 19.2.8(react@19.2.8) optionalDependencies: - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - '@rspack/core' - crossws @@ -9540,11 +10467,11 @@ snapshots: optionalDependencies: csstype: 3.2.3 - '@tanstack/router-generator@1.167.21(supports-color@10.2.2)': + '@tanstack/router-generator@1.167.21': dependencies: '@babel/types': 7.29.7 '@tanstack/router-core': 1.171.15 - '@tanstack/router-utils': 1.162.2(supports-color@10.2.2) + '@tanstack/router-utils': 1.162.2 '@tanstack/virtual-file-routes': 1.162.0 jiti: 2.7.0 magic-string: 0.30.21 @@ -9553,20 +10480,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@tanstack/router-plugin@1.168.23(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@tanstack/router-plugin@1.168.23(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/template': 7.29.7 '@babel/types': 7.29.7 '@tanstack/router-core': 1.171.15 - '@tanstack/router-generator': 1.167.21(supports-color@10.2.2) - '@tanstack/router-utils': 1.162.2(supports-color@10.2.2) + '@tanstack/router-generator': 1.167.21 + '@tanstack/router-utils': 1.162.2 chokidar: 5.0.0 unplugin: 3.0.0 zod: 4.4.3 optionalDependencies: '@tanstack/react-router': 1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8) - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - supports-color @@ -9575,13 +10502,13 @@ snapshots: '@tanstack/query-core': 5.101.4 '@tanstack/router-core': 1.171.15 - '@tanstack/router-utils@1.162.2(supports-color@10.2.2)': + '@tanstack/router-utils@1.162.2': dependencies: '@babel/generator': 7.29.7 '@babel/parser': 7.29.7 '@babel/types': 7.29.7 ansis: 4.3.1 - babel-dead-code-elimination: 1.0.12(supports-color@10.2.2) + babel-dead-code-elimination: 1.0.12 diff: 8.0.4 pathe: 2.0.3 tinyglobby: 0.2.17 @@ -9597,30 +10524,30 @@ snapshots: '@tanstack/start-fn-stubs@1.162.0': {} - '@tanstack/start-plugin-core@1.171.24(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(crossws@0.4.5(srvx@0.8.16))(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@tanstack/start-plugin-core@1.171.24(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(crossws@0.4.10(srvx@0.11.22))(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: '@babel/code-frame': 7.27.1 - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/types': 7.29.7 '@tanstack/router-core': 1.171.15 - '@tanstack/router-generator': 1.167.21(supports-color@10.2.2) - '@tanstack/router-plugin': 1.168.23(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) - '@tanstack/router-utils': 1.162.2(supports-color@10.2.2) - '@tanstack/start-server-core': 1.169.17(crossws@0.4.5(srvx@0.8.16)) + '@tanstack/router-generator': 1.167.21 + '@tanstack/router-plugin': 1.168.23(@tanstack/react-router@1.170.18(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) + '@tanstack/router-utils': 1.162.2 + '@tanstack/start-server-core': 1.169.17(crossws@0.4.10(srvx@0.11.22)) exsolve: 1.0.8 lightningcss: 1.32.0 pathe: 2.0.3 picomatch: 4.0.4 seroval: 1.5.4 source-map: 0.7.6 - srvx: 0.11.16 + srvx: 0.11.22 tinyglobby: 0.2.17 ufo: 1.6.4 - vitefu: 1.1.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)) + vitefu: 1.1.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)) xmlbuilder2: 4.0.3 zod: 4.4.3 optionalDependencies: - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - '@tanstack/react-router' - crossws @@ -9628,14 +10555,14 @@ snapshots: - vite-plugin-solid - webpack - '@tanstack/start-server-core@1.169.17(crossws@0.4.5(srvx@0.8.16))': + '@tanstack/start-server-core@1.169.17(crossws@0.4.10(srvx@0.11.22))': dependencies: '@tanstack/history': 1.162.0 '@tanstack/router-core': 1.171.15 '@tanstack/start-client-core': 1.170.14 '@tanstack/start-storage-context': 1.167.17 fetchdts: 0.1.7 - h3-v2: h3@2.0.1-rc.20(crossws@0.4.5(srvx@0.8.16)) + h3-v2: h3@2.0.1-rc.20(crossws@0.4.10(srvx@0.11.22)) seroval: 1.5.4 transitivePeerDependencies: - crossws @@ -9743,9 +10670,14 @@ snapshots: react: 19.2.8 react-dom: 19.2.8(react@19.2.8) - '@vercel/nft@1.10.2(rollup@4.61.1)(supports-color@10.2.2)': + '@upstash/redis@1.38.2': + dependencies: + uncrypto: 0.1.3 + optional: true + + '@vercel/nft@1.10.2(rollup@4.61.1)': dependencies: - '@mapbox/node-pre-gyp': 2.0.3(supports-color@10.2.2) + '@mapbox/node-pre-gyp': 2.0.3 '@rollup/pluginutils': 5.4.0(rollup@4.61.1) acorn: 8.16.0 acorn-import-attributes: 1.9.5(acorn@8.16.0) @@ -9755,7 +10687,7 @@ snapshots: glob: 13.0.6 graceful-fs: 4.2.11 node-gyp-build: 4.8.4 - picomatch: 4.0.4 + picomatch: 4.0.5 resolve-from: 5.0.0 transitivePeerDependencies: - encoding @@ -9766,15 +10698,15 @@ snapshots: optionalDependencies: react: 19.2.8 - '@vitejs/plugin-react@5.2.0(supports-color@10.2.2)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0))': + '@vitejs/plugin-react@5.2.0(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))': dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) - '@babel/plugin-transform-react-jsx-self': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2)) - '@babel/plugin-transform-react-jsx-source': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2)) + '@babel/core': 7.29.7 + '@babel/plugin-transform-react-jsx-self': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-transform-react-jsx-source': 7.29.7(@babel/core@7.29.7) '@rolldown/pluginutils': 1.0.0-rc.3 '@types/babel__core': 7.20.5 react-refresh: 0.18.0 - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - supports-color @@ -9910,11 +10842,11 @@ snapshots: b4a@1.8.1: {} - babel-dead-code-elimination@1.0.12(supports-color@10.2.2): + babel-dead-code-elimination@1.0.12: dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/parser': 7.29.7 - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 transitivePeerDependencies: - supports-color @@ -9991,13 +10923,15 @@ snapshots: dependencies: file-uri-to-path: 1.0.0 + blake3-wasm@2.1.5: {} + bn.js@5.2.5: {} - body-parser@2.3.0(supports-color@10.2.2): + body-parser@2.3.0: dependencies: bytes: 3.1.2 content-type: 2.0.0 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 http-errors: 2.0.1 iconv-lite: 0.7.3 on-finished: 2.4.1 @@ -10073,7 +11007,7 @@ snapshots: confbox: 0.2.4 defu: 6.1.7 dotenv: 17.4.2 - exsolve: 1.0.8 + exsolve: 1.1.1 giget: 3.2.0 jiti: 2.7.0 ohash: 2.0.11 @@ -10115,21 +11049,21 @@ snapshots: chownr@3.0.0: {} - chrome-launcher@0.15.2(supports-color@10.2.2): + chrome-launcher@0.15.2: dependencies: '@types/node': 22.20.1 escape-string-regexp: 4.0.0 is-wsl: 2.2.0 - lighthouse-logger: 1.4.2(supports-color@10.2.2) + lighthouse-logger: 1.4.2 transitivePeerDependencies: - supports-color - chromium-edge-launcher@0.3.0(supports-color@10.2.2): + chromium-edge-launcher@0.3.0: dependencies: '@types/node': 22.20.1 escape-string-regexp: 4.0.0 is-wsl: 2.2.0 - lighthouse-logger: 1.4.2(supports-color@10.2.2) + lighthouse-logger: 1.4.2 mkdirp: 1.0.4 transitivePeerDependencies: - supports-color @@ -10228,16 +11162,16 @@ snapshots: json-schema-typed: 7.0.3 onetime: 5.1.2 pkg-up: 3.1.0 - semver: 7.8.2 + semver: 7.8.5 confbox@0.1.8: {} confbox@0.2.4: {} - connect@3.7.0(supports-color@10.2.2): + connect@3.7.0: dependencies: - debug: 2.6.9(supports-color@10.2.2) - finalhandler: 1.1.2(supports-color@10.2.2) + debug: 2.6.9 + finalhandler: 1.1.2 parseurl: 1.3.3 utils-merge: 1.0.1 transitivePeerDependencies: @@ -10255,18 +11189,6 @@ snapshots: convert-source-map@2.0.0: {} - convex@1.42.3(@clerk/react@6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6): - dependencies: - esbuild: 0.27.0 - prettier: 3.8.3 - ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) - optionalDependencies: - '@clerk/react': 6.12.8(react-dom@19.2.8(react@19.2.8))(react@19.2.8) - react: 19.2.8 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - cookie-es@1.2.3: {} cookie-es@2.0.1: {} @@ -10277,6 +11199,8 @@ snapshots: cookie@0.7.2: {} + cookie@1.1.1: {} + copy-to-clipboard@3.3.3: dependencies: toggle-selection: 1.0.6 @@ -10326,9 +11250,9 @@ snapshots: dependencies: uncrypto: 0.1.3 - crossws@0.4.5(srvx@0.8.16): + crossws@0.4.10(srvx@0.11.22): optionalDependencies: - srvx: 0.8.16 + srvx: 0.11.22 css-mediaquery@0.1.2: {} @@ -10357,23 +11281,21 @@ snapshots: whatwg-mimetype: 5.0.0 whatwg-url: 15.1.0 - db0@0.3.4: {} + db0@0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)): + optionalDependencies: + drizzle-orm: 0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2) debounce-fn@4.0.0: dependencies: mimic-fn: 3.1.0 - debug@2.6.9(supports-color@10.2.2): + debug@2.6.9: dependencies: ms: 2.0.0 - optionalDependencies: - supports-color: 10.2.2 - debug@4.4.3(supports-color@10.2.2): + debug@4.4.3: dependencies: ms: 2.1.3 - optionalDependencies: - supports-color: 10.2.2 decamelize@1.2.0: {} @@ -10428,6 +11350,18 @@ snapshots: dotenv@17.4.2: {} + drizzle-kit@0.31.10: + dependencies: + '@drizzle-team/brocli': 0.10.2 + '@esbuild-kit/esm-loader': 2.6.5 + esbuild: 0.25.12 + tsx: 4.23.11 + + drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2): + optionalDependencies: + '@cloudflare/workers-types': 5.20260808.1 + '@upstash/redis': 1.38.2 + dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 @@ -10470,6 +11404,15 @@ snapshots: env-paths@2.2.1: {} + env-runner@0.1.16(wrangler@4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6)): + dependencies: + crossws: 0.4.10(srvx@0.11.22) + exsolve: 1.1.1 + httpxy: 0.5.5 + srvx: 0.11.22 + optionalDependencies: + wrangler: 4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6) + error-ex@1.3.4: dependencies: is-arrayish: 0.2.1 @@ -10494,6 +11437,31 @@ snapshots: dependencies: es6-promise: 4.2.8 + esbuild@0.18.20: + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + esbuild@0.25.12: optionalDependencies: '@esbuild/aix-ppc64': 0.25.12 @@ -10523,35 +11491,6 @@ snapshots: '@esbuild/win32-ia32': 0.25.12 '@esbuild/win32-x64': 0.25.12 - esbuild@0.27.0: - optionalDependencies: - '@esbuild/aix-ppc64': 0.27.0 - '@esbuild/android-arm': 0.27.0 - '@esbuild/android-arm64': 0.27.0 - '@esbuild/android-x64': 0.27.0 - '@esbuild/darwin-arm64': 0.27.0 - '@esbuild/darwin-x64': 0.27.0 - '@esbuild/freebsd-arm64': 0.27.0 - '@esbuild/freebsd-x64': 0.27.0 - '@esbuild/linux-arm': 0.27.0 - '@esbuild/linux-arm64': 0.27.0 - '@esbuild/linux-ia32': 0.27.0 - '@esbuild/linux-loong64': 0.27.0 - '@esbuild/linux-mips64el': 0.27.0 - '@esbuild/linux-ppc64': 0.27.0 - '@esbuild/linux-riscv64': 0.27.0 - '@esbuild/linux-s390x': 0.27.0 - '@esbuild/linux-x64': 0.27.0 - '@esbuild/netbsd-arm64': 0.27.0 - '@esbuild/netbsd-x64': 0.27.0 - '@esbuild/openbsd-arm64': 0.27.0 - '@esbuild/openbsd-x64': 0.27.0 - '@esbuild/openharmony-arm64': 0.27.0 - '@esbuild/sunos-x64': 0.27.0 - '@esbuild/win32-arm64': 0.27.0 - '@esbuild/win32-ia32': 0.27.0 - '@esbuild/win32-x64': 0.27.0 - esbuild@0.28.0: optionalDependencies: '@esbuild/aix-ppc64': 0.28.0 @@ -10581,6 +11520,35 @@ snapshots: '@esbuild/win32-ia32': 0.28.0 '@esbuild/win32-x64': 0.28.0 + esbuild@0.28.1: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.1 + '@esbuild/android-arm': 0.28.1 + '@esbuild/android-arm64': 0.28.1 + '@esbuild/android-x64': 0.28.1 + '@esbuild/darwin-arm64': 0.28.1 + '@esbuild/darwin-x64': 0.28.1 + '@esbuild/freebsd-arm64': 0.28.1 + '@esbuild/freebsd-x64': 0.28.1 + '@esbuild/linux-arm': 0.28.1 + '@esbuild/linux-arm64': 0.28.1 + '@esbuild/linux-ia32': 0.28.1 + '@esbuild/linux-loong64': 0.28.1 + '@esbuild/linux-mips64el': 0.28.1 + '@esbuild/linux-ppc64': 0.28.1 + '@esbuild/linux-riscv64': 0.28.1 + '@esbuild/linux-s390x': 0.28.1 + '@esbuild/linux-x64': 0.28.1 + '@esbuild/netbsd-arm64': 0.28.1 + '@esbuild/netbsd-x64': 0.28.1 + '@esbuild/openbsd-arm64': 0.28.1 + '@esbuild/openbsd-x64': 0.28.1 + '@esbuild/openharmony-arm64': 0.28.1 + '@esbuild/sunos-x64': 0.28.1 + '@esbuild/win32-arm64': 0.28.1 + '@esbuild/win32-ia32': 0.28.1 + '@esbuild/win32-x64': 0.28.1 + escalade@3.2.0: {} escape-html@1.0.3: {} @@ -10646,28 +11614,28 @@ snapshots: exponential-backoff@3.1.3: {} - express-rate-limit@8.6.0(express@5.2.1(supports-color@10.2.2))(supports-color@10.2.2): + express-rate-limit@8.6.0(express@5.2.1): dependencies: - debug: 4.4.3(supports-color@10.2.2) - express: 5.2.1(supports-color@10.2.2) + debug: 4.4.3 + express: 5.2.1 ip-address: 10.3.1 transitivePeerDependencies: - supports-color - express@5.2.1(supports-color@10.2.2): + express@5.2.1: dependencies: accepts: 2.0.0 - body-parser: 2.3.0(supports-color@10.2.2) + body-parser: 2.3.0 content-disposition: 1.1.0 content-type: 1.0.5 cookie: 0.7.2 cookie-signature: 1.2.2 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 depd: 2.0.0 encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 - finalhandler: 2.1.1(supports-color@10.2.2) + finalhandler: 2.1.1 fresh: 2.0.0 http-errors: 2.0.1 merge-descriptors: 2.0.0 @@ -10678,9 +11646,9 @@ snapshots: proxy-addr: 2.0.7 qs: 6.15.3 range-parser: 1.2.1 - router: 2.2.0(supports-color@10.2.2) - send: 1.2.1(supports-color@10.2.2) - serve-static: 2.2.1(supports-color@10.2.2) + router: 2.2.0 + send: 1.2.1 + serve-static: 2.2.1 statuses: 2.0.2 type-is: 2.1.0 vary: 1.1.2 @@ -10689,6 +11657,8 @@ snapshots: exsolve@1.0.8: {} + exsolve@1.1.1: {} + extend@3.0.2: {} eyes@0.1.8: {} @@ -10705,6 +11675,8 @@ snapshots: merge2: 1.4.1 micromatch: 4.0.8 + fast-sha256@1.3.0: {} + fast-stable-stringify@1.0.0: {} fast-uri@3.1.4: {} @@ -10744,9 +11716,9 @@ snapshots: dependencies: to-regex-range: 5.0.1 - finalhandler@1.1.2(supports-color@10.2.2): + finalhandler@1.1.2: dependencies: - debug: 2.6.9(supports-color@10.2.2) + debug: 2.6.9 encodeurl: 1.0.2 escape-html: 1.0.3 on-finished: 2.3.0 @@ -10756,9 +11728,9 @@ snapshots: transitivePeerDependencies: - supports-color - finalhandler@2.1.1(supports-color@10.2.2): + finalhandler@2.1.1: dependencies: - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 encodeurl: 2.0.0 escape-html: 1.0.3 on-finished: 2.4.1 @@ -10808,17 +11780,17 @@ snapshots: fuzzysort@3.1.0: {} - gaxios@7.1.5(supports-color@10.2.2): + gaxios@7.1.5: dependencies: extend: 3.0.2 - https-proxy-agent: 7.0.6(supports-color@10.2.2) + https-proxy-agent: 7.0.6 node-fetch: 3.3.2 transitivePeerDependencies: - supports-color - gcp-metadata@8.1.2(supports-color@10.2.2): + gcp-metadata@8.1.2: dependencies: - gaxios: 7.1.5(supports-color@10.2.2) + gaxios: 7.1.5 google-logging-utils: 1.1.3 json-bigint: 1.0.0 transitivePeerDependencies: @@ -10861,6 +11833,10 @@ snapshots: '@sec-ant/readable-stream': 0.4.1 is-stream: 4.0.1 + get-tsconfig@4.14.1: + dependencies: + resolve-pkg-maps: 1.0.0 + giget@3.2.0: {} glob-parent@5.1.2: @@ -10899,12 +11875,12 @@ snapshots: dependencies: csstype: 3.2.3 - google-auth-library@10.7.0(supports-color@10.2.2): + google-auth-library@10.7.0: dependencies: base64-js: 1.5.1 ecdsa-sig-formatter: 1.0.11 - gaxios: 7.1.5(supports-color@10.2.2) - gcp-metadata: 8.1.2(supports-color@10.2.2) + gaxios: 7.1.5 + gcp-metadata: 8.1.2 google-logging-utils: 1.1.3 jws: 4.0.1 transitivePeerDependencies: @@ -10920,6 +11896,14 @@ snapshots: dependencies: duplexer: 0.1.2 + h3-rules@0.1.0(h3@2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)))(ocache@0.2.0): + dependencies: + h3: 2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)) + rou3: 0.9.1 + ufo: 1.6.4 + optionalDependencies: + ocache: 0.2.0 + h3@1.15.11: dependencies: cookie-es: 1.2.3 @@ -10932,21 +11916,19 @@ snapshots: ufo: 1.6.4 uncrypto: 0.1.3 - h3@2.0.1-rc.2(crossws@0.4.5(srvx@0.8.16)): + h3@2.0.1-rc.20(crossws@0.4.10(srvx@0.11.22)): dependencies: - cookie-es: 2.0.1 - fetchdts: 0.1.7 - rou3: 0.7.12 - srvx: 0.8.16 + rou3: 0.8.1 + srvx: 0.11.22 optionalDependencies: - crossws: 0.4.5(srvx@0.8.16) + crossws: 0.4.10(srvx@0.11.22) - h3@2.0.1-rc.20(crossws@0.4.5(srvx@0.8.16)): + h3@2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)): dependencies: - rou3: 0.8.1 - srvx: 0.11.16 + rou3: 0.9.1 + srvx: 0.12.5 optionalDependencies: - crossws: 0.4.5(srvx@0.8.16) + crossws: 0.4.10(srvx@0.11.22) has-flag@4.0.0: {} @@ -10978,6 +11960,8 @@ snapshots: hookable@5.5.3: {} + hookable@6.1.1: {} + html-encoding-sniffer@6.0.0(@noble/hashes@1.8.0): dependencies: '@exodus/bytes': 1.15.1(@noble/hashes@1.8.0) @@ -10992,23 +11976,23 @@ snapshots: statuses: 2.0.2 toidentifier: 1.0.1 - http-proxy-agent@7.0.2(supports-color@10.2.2): + http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.4 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 transitivePeerDependencies: - supports-color http-shutdown@1.2.2: {} - https-proxy-agent@7.0.6(supports-color@10.2.2): + https-proxy-agent@7.0.6: dependencies: agent-base: 7.1.4 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 transitivePeerDependencies: - supports-color - httpxy@0.5.3: {} + httpxy@0.5.5: {} human-signals@2.1.0: {} @@ -11050,11 +12034,11 @@ snapshots: dependencies: loose-envify: 1.4.0 - ioredis@5.11.1(supports-color@10.2.2): + ioredis@5.11.1: dependencies: '@ioredis/commands': 1.10.0 cluster-key-slot: 1.1.1 - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 denque: 2.1.0 redis-errors: 1.2.0 redis-parser: 3.0.0 @@ -11214,7 +12198,7 @@ snapshots: jsc-safe-url@0.2.4: {} - jsdom@27.4.0(@noble/hashes@1.8.0)(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6): + jsdom@27.4.0(@noble/hashes@1.8.0)(bufferutil@4.1.0)(utf-8-validate@6.0.6): dependencies: '@acemir/cssom': 0.9.31 '@asamuzakjp/dom-selector': 6.8.1 @@ -11223,8 +12207,8 @@ snapshots: data-urls: 6.0.1 decimal.js: 10.6.0 html-encoding-sniffer: 6.0.0(@noble/hashes@1.8.0) - http-proxy-agent: 7.0.2(supports-color@10.2.2) - https-proxy-agent: 7.0.6(supports-color@10.2.2) + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 is-potential-custom-element-name: 1.0.1 parse5: 8.0.1 saxes: 6.0.0 @@ -11291,9 +12275,9 @@ snapshots: leven@3.1.0: {} - lighthouse-logger@1.4.2(supports-color@10.2.2): + lighthouse-logger@1.4.2: dependencies: - debug: 2.6.9(supports-color@10.2.2) + debug: 2.6.9 marky: 1.3.0 transitivePeerDependencies: - supports-color @@ -11357,13 +12341,13 @@ snapshots: optionalDependencies: yaml: 2.9.0 - listhen@1.10.0(srvx@0.8.16): + listhen@1.10.0(srvx@0.11.22): dependencies: '@parcel/watcher': 2.5.6 '@parcel/watcher-wasm': 2.5.6 citty: 0.2.2 consola: 3.4.2 - crossws: 0.4.5(srvx@0.8.16) + crossws: 0.4.10(srvx@0.11.22) defu: 6.1.7 get-port-please: 3.2.0 h3: 1.15.11 @@ -11457,9 +12441,9 @@ snapshots: merge2@1.4.1: {} - metro-babel-transformer@0.84.4(supports-color@10.2.2): + metro-babel-transformer@0.84.4: dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 flow-enums-runtime: 0.0.6 hermes-parser: 0.35.0 metro-cache-key: 0.84.4 @@ -11471,22 +12455,22 @@ snapshots: dependencies: flow-enums-runtime: 0.0.6 - metro-cache@0.84.4(supports-color@10.2.2): + metro-cache@0.84.4: dependencies: exponential-backoff: 3.1.3 flow-enums-runtime: 0.0.6 - https-proxy-agent: 7.0.6(supports-color@10.2.2) + https-proxy-agent: 7.0.6 metro-core: 0.84.4 transitivePeerDependencies: - supports-color - metro-config@0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6): + metro-config@0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6): dependencies: - connect: 3.7.0(supports-color@10.2.2) + connect: 3.7.0 flow-enums-runtime: 0.0.6 jest-validate: 29.7.0 - metro: 0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) - metro-cache: 0.84.4(supports-color@10.2.2) + metro: 0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) + metro-cache: 0.84.4 metro-core: 0.84.4 metro-runtime: 0.84.4 yaml: 2.9.0 @@ -11501,9 +12485,9 @@ snapshots: lodash.throttle: 4.1.1 metro-resolver: 0.84.4 - metro-file-map@0.84.4(supports-color@10.2.2): + metro-file-map@0.84.4: dependencies: - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 fb-watchman: 2.0.2 flow-enums-runtime: 0.0.6 graceful-fs: 4.2.11 @@ -11529,13 +12513,13 @@ snapshots: '@babel/runtime': 7.29.7 flow-enums-runtime: 0.0.6 - metro-source-map@0.84.4(supports-color@10.2.2): + metro-source-map@0.84.4: dependencies: - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 flow-enums-runtime: 0.0.6 invariant: 2.2.4 - metro-symbolicate: 0.84.4(supports-color@10.2.2) + metro-symbolicate: 0.84.4 nullthrows: 1.1.1 ob1: 0.84.4 source-map: 0.5.7 @@ -11543,61 +12527,61 @@ snapshots: transitivePeerDependencies: - supports-color - metro-symbolicate@0.84.4(supports-color@10.2.2): + metro-symbolicate@0.84.4: dependencies: flow-enums-runtime: 0.0.6 invariant: 2.2.4 - metro-source-map: 0.84.4(supports-color@10.2.2) + metro-source-map: 0.84.4 nullthrows: 1.1.1 source-map: 0.5.7 vlq: 1.0.1 transitivePeerDependencies: - supports-color - metro-transform-plugins@0.84.4(supports-color@10.2.2): + metro-transform-plugins@0.84.4: dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/generator': 7.29.7 '@babel/template': 7.29.7 - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 flow-enums-runtime: 0.0.6 nullthrows: 1.1.1 transitivePeerDependencies: - supports-color - metro-transform-worker@0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6): + metro-transform-worker@0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6): dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/generator': 7.29.7 '@babel/parser': 7.29.7 '@babel/types': 7.29.7 flow-enums-runtime: 0.0.6 - metro: 0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) - metro-babel-transformer: 0.84.4(supports-color@10.2.2) - metro-cache: 0.84.4(supports-color@10.2.2) + metro: 0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) + metro-babel-transformer: 0.84.4 + metro-cache: 0.84.4 metro-cache-key: 0.84.4 metro-minify-terser: 0.84.4 - metro-source-map: 0.84.4(supports-color@10.2.2) - metro-transform-plugins: 0.84.4(supports-color@10.2.2) + metro-source-map: 0.84.4 + metro-transform-plugins: 0.84.4 nullthrows: 1.1.1 transitivePeerDependencies: - bufferutil - supports-color - utf-8-validate - metro@0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6): + metro@0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6): dependencies: '@babel/code-frame': 7.29.7 - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/generator': 7.29.7 '@babel/parser': 7.29.7 '@babel/template': 7.29.7 - '@babel/traverse': 7.29.7(supports-color@10.2.2) + '@babel/traverse': 7.29.7 '@babel/types': 7.29.7 accepts: 2.0.0 ci-info: 2.0.0 - connect: 3.7.0(supports-color@10.2.2) - debug: 4.4.3(supports-color@10.2.2) + connect: 3.7.0 + debug: 4.4.3 error-stack-parser: 2.1.4 flow-enums-runtime: 0.0.6 graceful-fs: 4.2.11 @@ -11607,18 +12591,18 @@ snapshots: jest-worker: 29.7.0 jsc-safe-url: 0.2.4 lodash.throttle: 4.1.1 - metro-babel-transformer: 0.84.4(supports-color@10.2.2) - metro-cache: 0.84.4(supports-color@10.2.2) + metro-babel-transformer: 0.84.4 + metro-cache: 0.84.4 metro-cache-key: 0.84.4 - metro-config: 0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) + metro-config: 0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) metro-core: 0.84.4 - metro-file-map: 0.84.4(supports-color@10.2.2) + metro-file-map: 0.84.4 metro-resolver: 0.84.4 metro-runtime: 0.84.4 - metro-source-map: 0.84.4(supports-color@10.2.2) - metro-symbolicate: 0.84.4(supports-color@10.2.2) - metro-transform-plugins: 0.84.4(supports-color@10.2.2) - metro-transform-worker: 0.84.4(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) + metro-source-map: 0.84.4 + metro-symbolicate: 0.84.4 + metro-transform-plugins: 0.84.4 + metro-transform-worker: 0.84.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) mime-types: 3.0.2 nullthrows: 1.1.1 serialize-error: 2.1.0 @@ -11652,6 +12636,18 @@ snapshots: mimic-function@5.0.1: {} + miniflare@5.20260801.1-alpha(bufferutil@4.1.0)(utf-8-validate@6.0.6): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + sharp: 0.35.2 + undici: 7.29.0 + workerd: 1.20260801.1 + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + youch: 4.1.0-beta.10 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + minimatch@10.2.5: dependencies: brace-expansion: 5.0.6 @@ -11691,29 +12687,32 @@ snapshots: negotiator@1.0.0: {} - nf3@0.1.12: {} + nf3@0.3.23: {} - nitro-nightly@4.0.0-20251010-091516-7cafddba(ioredis@5.11.1(supports-color@10.2.2))(lru-cache@11.5.1)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)): + nitro-nightly@3.0.1-20260731-205209-52abde8a(@upstash/redis@1.38.2)(chokidar@5.0.0)(dotenv@17.4.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(giget@3.2.0)(ioredis@5.11.1)(jiti@2.7.0)(lru-cache@11.5.1)(rollup@4.61.1)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0))(wrangler@4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6)): dependencies: consola: 3.4.2 - cookie-es: 2.0.1 - crossws: 0.4.5(srvx@0.8.16) - db0: 0.3.4 - esbuild: 0.25.12 - fetchdts: 0.1.7 - h3: 2.0.1-rc.2(crossws@0.4.5(srvx@0.8.16)) - jiti: 2.7.0 - nf3: 0.1.12 - ofetch: 1.5.1 + crossws: 0.4.10(srvx@0.11.22) + db0: 0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)) + env-runner: 0.1.16(wrangler@4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6)) + h3: 2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)) + h3-rules: 0.1.0(h3@2.0.1-rc.26(crossws@0.4.10(srvx@0.11.22)))(ocache@0.2.0) + hookable: 6.1.1 + nf3: 0.3.23 + ocache: 0.2.0 + ofetch: 2.0.0-alpha.3 ohash: 2.0.11 - rendu: 0.0.6 - rollup: 4.61.1 - srvx: 0.8.16 - undici: 7.27.2 - unenv: 2.0.0-rc.21 - unstorage: 2.0.0-alpha.3(db0@0.3.4)(ioredis@5.11.1(supports-color@10.2.2))(lru-cache@11.5.1)(ofetch@1.5.1) + rolldown: 1.2.3 + rou3: 0.9.1 + srvx: 0.11.22 + unenv: 2.0.0-rc.24 + unstorage: 2.0.0-alpha.7(@upstash/redis@1.38.2)(chokidar@5.0.0)(db0@0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)))(ioredis@5.11.1)(lru-cache@11.5.1)(ofetch@2.0.0-alpha.3) optionalDependencies: - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + dotenv: 17.4.2 + giget: 3.2.0 + jiti: 2.7.0 + rollup: 4.61.1 + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -11726,6 +12725,7 @@ snapshots: - '@electric-sql/pglite' - '@libsql/client' - '@netlify/blobs' + - '@netlify/runtime' - '@planetscale/database' - '@upstash/redis' - '@vercel/blob' @@ -11738,12 +12738,14 @@ snapshots: - idb-keyval - ioredis - lru-cache + - miniflare - mongodb - mysql2 - sqlite3 - uploadthing + - wrangler - nitropack@2.13.4(srvx@0.8.16)(supports-color@10.2.2): + nitropack@2.13.4(@upstash/redis@1.38.2)(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2))(rolldown@1.2.3)(srvx@0.11.22): dependencies: '@cloudflare/kv-asset-handler': 0.4.2 '@rollup/plugin-alias': 6.0.0(rollup@4.61.1) @@ -11753,7 +12755,7 @@ snapshots: '@rollup/plugin-node-resolve': 16.0.3(rollup@4.61.1) '@rollup/plugin-replace': 6.0.3(rollup@4.61.1) '@rollup/plugin-terser': 1.0.0(rollup@4.61.1) - '@vercel/nft': 1.10.2(rollup@4.61.1)(supports-color@10.2.2) + '@vercel/nft': 1.10.2(rollup@4.61.1) archiver: 7.0.1 c12: 3.3.4(magicast@0.5.3) chokidar: 5.0.0 @@ -11764,24 +12766,24 @@ snapshots: cookie-es: 2.0.1 croner: 10.0.1 crossws: 0.3.5 - db0: 0.3.4 + db0: 0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)) defu: 6.1.7 destr: 2.0.5 dot-prop: 10.1.0 - esbuild: 0.28.0 + esbuild: 0.28.1 escape-string-regexp: 5.0.0 etag: 1.8.1 - exsolve: 1.0.8 + exsolve: 1.1.1 globby: 16.2.0 gzip-size: 7.0.0 h3: 1.15.11 hookable: 5.5.3 - httpxy: 0.5.3 - ioredis: 5.11.1(supports-color@10.2.2) + httpxy: 0.5.5 + ioredis: 5.11.1 jiti: 2.7.0 klona: 2.0.6 knitwork: 1.3.0 - listhen: 1.10.0(srvx@0.8.16) + listhen: 1.10.0(srvx@0.11.22) magic-string: 0.30.21 magicast: 0.5.3 mime: 4.1.0 @@ -11796,11 +12798,11 @@ snapshots: pretty-bytes: 7.1.0 radix3: 1.1.2 rollup: 4.61.1 - rollup-plugin-visualizer: 7.0.1(rollup@4.61.1) + rollup-plugin-visualizer: 7.0.1(rolldown@1.2.3)(rollup@4.61.1) scule: 1.3.0 - semver: 7.8.2 + semver: 7.8.5 serve-placeholder: 2.0.2 - serve-static: 2.2.1(supports-color@10.2.2) + serve-static: 2.2.1 source-map: 0.7.6 std-env: 4.1.0 ufo: 1.6.4 @@ -11808,9 +12810,9 @@ snapshots: uncrypto: 0.1.3 unctx: 2.5.0 unenv: 2.0.0-rc.24 - unimport: 6.3.0 + unimport: 6.3.0(rolldown@1.2.3) unplugin-utils: 0.3.1 - unstorage: 1.17.5(db0@0.3.4)(ioredis@5.11.1(supports-color@10.2.2)) + unstorage: 1.17.5(@upstash/redis@1.38.2)(db0@0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)))(ioredis@5.11.1) untyped: 2.0.0 unwasm: 0.5.3 youch: 4.1.1 @@ -11901,12 +12903,18 @@ snapshots: object-treeify@1.1.33: {} + ocache@0.2.0: + dependencies: + ohash: 2.0.11 + ofetch@1.5.1: dependencies: destr: 2.0.5 node-fetch-native: 1.6.7 ufo: 1.6.4 + ofetch@2.0.0-alpha.3: {} + ohash@2.0.11: {} on-finished@2.3.0: @@ -12023,6 +13031,8 @@ snapshots: lru-cache: 11.5.1 minipass: 7.1.3 + path-to-regexp@6.3.0: {} + path-to-regexp@8.4.2: {} path-type@4.0.0: {} @@ -12052,7 +13062,7 @@ snapshots: pkg-types@2.3.1: dependencies: confbox: 0.2.4 - exsolve: 1.0.8 + exsolve: 1.1.1 pathe: 2.0.3 pkg-up@3.1.0: @@ -12248,15 +13258,15 @@ snapshots: react-is@18.3.1: {} - react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6): + react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6): dependencies: '@react-native/assets-registry': 0.86.0 - '@react-native/codegen': 0.86.0(@babel/core@7.29.7(supports-color@10.2.2)) - '@react-native/community-cli-plugin': 0.86.0(bufferutil@4.1.0)(supports-color@10.2.2)(utf-8-validate@6.0.6) + '@react-native/codegen': 0.86.0(@babel/core@7.29.7) + '@react-native/community-cli-plugin': 0.86.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) '@react-native/gradle-plugin': 0.86.0 '@react-native/js-polyfills': 0.86.0 '@react-native/normalize-colors': 0.86.0 - '@react-native/virtualized-lists': 0.86.0(@types/react@19.2.17)(react-native@0.86.0(@babel/core@7.29.7(supports-color@10.2.2))(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(supports-color@10.2.2)(utf-8-validate@6.0.6))(react@19.2.8) + '@react-native/virtualized-lists': 0.86.0(@types/react@19.2.17)(react-native@0.86.0(@babel/core@7.29.7)(@types/react@19.2.17)(bufferutil@4.1.0)(react@19.2.8)(utf-8-validate@6.0.6))(react@19.2.8) abort-controller: 3.0.0 anser: 1.4.10 ansi-regex: 5.0.1 @@ -12268,7 +13278,7 @@ snapshots: invariant: 2.2.4 memoize-one: 5.2.1 metro-runtime: 0.84.4 - metro-source-map: 0.84.4(supports-color@10.2.2) + metro-source-map: 0.84.4 nullthrows: 1.1.1 pretty-format: 29.7.0 promise: 8.3.0 @@ -12277,7 +13287,7 @@ snapshots: react-refresh: 0.14.2 regenerator-runtime: 0.13.11 scheduler: 0.27.0 - semver: 7.8.2 + semver: 7.8.5 stacktrace-parser: 0.1.11 tinyglobby: 0.2.17 whatwg-fetch: 3.6.20 @@ -12366,11 +13376,6 @@ snapshots: regenerator-runtime@0.13.11: {} - rendu@0.0.6: - dependencies: - cookie-es: 2.0.1 - srvx: 0.8.16 - require-directory@2.1.1: {} require-from-string@2.0.2: {} @@ -12381,6 +13386,8 @@ snapshots: resolve-from@5.0.0: {} + resolve-pkg-maps@1.0.0: {} + resolve@1.22.12: dependencies: es-errors: 1.3.0 @@ -12397,13 +13404,34 @@ snapshots: reusify@1.1.0: {} - rollup-plugin-visualizer@7.0.1(rollup@4.61.1): + rolldown@1.2.3: + dependencies: + '@oxc-project/types': 0.143.0 + '@rolldown/pluginutils': 1.0.1 + optionalDependencies: + '@rolldown/binding-android-arm64': 1.2.3 + '@rolldown/binding-darwin-arm64': 1.2.3 + '@rolldown/binding-darwin-x64': 1.2.3 + '@rolldown/binding-freebsd-x64': 1.2.3 + '@rolldown/binding-linux-arm-gnueabihf': 1.2.3 + '@rolldown/binding-linux-arm64-gnu': 1.2.3 + '@rolldown/binding-linux-arm64-musl': 1.2.3 + '@rolldown/binding-linux-ppc64-gnu': 1.2.3 + '@rolldown/binding-linux-s390x-gnu': 1.2.3 + '@rolldown/binding-linux-x64-gnu': 1.2.3 + '@rolldown/binding-linux-x64-musl': 1.2.3 + '@rolldown/binding-openharmony-arm64': 1.2.3 + '@rolldown/binding-win32-arm64-msvc': 1.2.3 + '@rolldown/binding-win32-x64-msvc': 1.2.3 + + rollup-plugin-visualizer@7.0.1(rolldown@1.2.3)(rollup@4.61.1): dependencies: open: 11.0.0 - picomatch: 4.0.4 + picomatch: 4.0.5 source-map: 0.7.6 yargs: 18.0.0 optionalDependencies: + rolldown: 1.2.3 rollup: 4.61.1 rollup@4.61.1: @@ -12437,13 +13465,13 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.61.1 fsevents: 2.3.3 - rou3@0.7.12: {} - rou3@0.8.1: {} - router@2.2.0(supports-color@10.2.2): + rou3@0.9.1: {} + + router@2.2.0: dependencies: - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 depd: 2.0.0 is-promise: 4.0.0 parseurl: 1.3.3 @@ -12490,11 +13518,11 @@ snapshots: semver@6.3.1: {} - semver@7.8.2: {} + semver@7.8.5: {} - send@0.19.2(supports-color@10.2.2): + send@0.19.2: dependencies: - debug: 2.6.9(supports-color@10.2.2) + debug: 2.6.9 depd: 2.0.0 destroy: 1.2.0 encodeurl: 2.0.0 @@ -12510,9 +13538,9 @@ snapshots: transitivePeerDependencies: - supports-color - send@1.2.1(supports-color@10.2.2): + send@1.2.1: dependencies: - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 @@ -12540,21 +13568,21 @@ snapshots: dependencies: defu: 6.1.7 - serve-static@1.16.3(supports-color@10.2.2): + serve-static@1.16.3: dependencies: encodeurl: 2.0.0 escape-html: 1.0.3 parseurl: 1.3.3 - send: 0.19.2(supports-color@10.2.2) + send: 0.19.2 transitivePeerDependencies: - supports-color - serve-static@2.2.1(supports-color@10.2.2): + serve-static@2.2.1: dependencies: encodeurl: 2.0.0 escape-html: 1.0.3 parseurl: 1.3.3 - send: 1.2.1(supports-color@10.2.2) + send: 1.2.1 transitivePeerDependencies: - supports-color @@ -12562,14 +13590,14 @@ snapshots: setprototypeof@1.2.0: {} - shadcn@4.14.1(babel-plugin-macros@3.1.0)(supports-color@10.2.2)(typescript@5.9.3): + shadcn@4.14.1(babel-plugin-macros@3.1.0)(typescript@5.9.3): dependencies: - '@babel/core': 7.29.7(supports-color@10.2.2) + '@babel/core': 7.29.7 '@babel/parser': 7.29.7 - '@babel/plugin-transform-typescript': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) - '@babel/preset-typescript': 7.29.7(@babel/core@7.29.7(supports-color@10.2.2))(supports-color@10.2.2) + '@babel/plugin-transform-typescript': 7.29.7(@babel/core@7.29.7) + '@babel/preset-typescript': 7.29.7(@babel/core@7.29.7) '@dotenvx/dotenvx': 1.75.1 - '@modelcontextprotocol/sdk': 1.29.0(supports-color@10.2.2)(zod@3.25.76) + '@modelcontextprotocol/sdk': 1.29.0(zod@3.25.76) '@types/validate-npm-package-name': 4.0.2 browserslist: 4.28.2 commander: 14.0.3 @@ -12602,6 +13630,38 @@ snapshots: - supports-color - typescript + sharp@0.35.2: + dependencies: + '@img/colour': 1.1.0 + detect-libc: 2.1.2 + semver: 7.8.5 + optionalDependencies: + '@img/sharp-darwin-arm64': 0.35.2 + '@img/sharp-darwin-x64': 0.35.2 + '@img/sharp-freebsd-wasm32': 0.35.2 + '@img/sharp-libvips-darwin-arm64': 1.3.1 + '@img/sharp-libvips-darwin-x64': 1.3.1 + '@img/sharp-libvips-linux-arm': 1.3.1 + '@img/sharp-libvips-linux-arm64': 1.3.1 + '@img/sharp-libvips-linux-ppc64': 1.3.1 + '@img/sharp-libvips-linux-riscv64': 1.3.1 + '@img/sharp-libvips-linux-s390x': 1.3.1 + '@img/sharp-libvips-linux-x64': 1.3.1 + '@img/sharp-libvips-linuxmusl-arm64': 1.3.1 + '@img/sharp-libvips-linuxmusl-x64': 1.3.1 + '@img/sharp-linux-arm': 0.35.2 + '@img/sharp-linux-arm64': 0.35.2 + '@img/sharp-linux-ppc64': 0.35.2 + '@img/sharp-linux-riscv64': 0.35.2 + '@img/sharp-linux-s390x': 0.35.2 + '@img/sharp-linux-x64': 0.35.2 + '@img/sharp-linuxmusl-arm64': 0.35.2 + '@img/sharp-linuxmusl-x64': 0.35.2 + '@img/sharp-webcontainers-wasm32': 0.35.2 + '@img/sharp-win32-arm64': 0.35.2 + '@img/sharp-win32-ia32': 0.35.2 + '@img/sharp-win32-x64': 0.35.2 + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -12667,9 +13727,9 @@ snapshots: source-map@0.7.6: {} - srvx@0.11.16: {} + srvx@0.11.22: {} - srvx@0.8.16: {} + srvx@0.12.5: {} stackframe@1.3.4: {} @@ -12679,6 +13739,11 @@ snapshots: standard-as-callback@2.1.0: {} + standardwebhooks@1.0.0: + dependencies: + '@stablelib/base64': 1.0.1 + fast-sha256: 1.3.0 + statuses@1.5.0: {} statuses@2.0.2: {} @@ -12812,13 +13877,6 @@ snapshots: - bare-abort-controller - react-native-b4a - terser@5.48.0: - dependencies: - '@jridgewell/source-map': 0.3.11 - acorn: 8.16.0 - commander: 2.20.3 - source-map-support: 0.5.21 - terser@5.49.0: dependencies: '@jridgewell/source-map': 0.3.11 @@ -12892,6 +13950,12 @@ snapshots: tslib@2.8.1: {} + tsx@4.23.11: + dependencies: + esbuild: 0.28.1 + optionalDependencies: + fsevents: 2.3.3 + tw-animate-css@1.4.0: {} type-fest@0.7.1: {} @@ -12927,13 +13991,7 @@ snapshots: undici@7.27.2: {} - unenv@2.0.0-rc.21: - dependencies: - defu: 6.1.7 - exsolve: 1.0.8 - ohash: 2.0.11 - pathe: 2.0.3 - ufo: 1.6.4 + undici@7.29.0: {} unenv@2.0.0-rc.24: dependencies: @@ -12943,7 +14001,7 @@ snapshots: unicorn-magic@0.4.0: {} - unimport@6.3.0: + unimport@6.3.0(rolldown@1.2.3): dependencies: acorn: 8.16.0 escape-string-regexp: 5.0.0 @@ -12952,13 +14010,15 @@ snapshots: magic-string: 0.30.21 mlly: 1.8.2 pathe: 2.0.3 - picomatch: 4.0.4 + picomatch: 4.0.5 pkg-types: 2.3.1 scule: 1.3.0 strip-literal: 3.1.0 tinyglobby: 0.2.17 unplugin: 3.0.0 unplugin-utils: 0.3.1 + optionalDependencies: + rolldown: 1.2.3 universalify@2.0.1: {} @@ -12969,13 +14029,13 @@ snapshots: unplugin-utils@0.3.1: dependencies: pathe: 2.0.3 - picomatch: 4.0.4 + picomatch: 4.0.5 unplugin@2.3.11: dependencies: '@jridgewell/remapping': 2.3.5 acorn: 8.16.0 - picomatch: 4.0.4 + picomatch: 4.0.5 webpack-virtual-modules: 0.6.2 unplugin@3.0.0: @@ -12984,7 +14044,7 @@ snapshots: picomatch: 4.0.4 webpack-virtual-modules: 0.6.2 - unstorage@1.17.5(db0@0.3.4)(ioredis@5.11.1(supports-color@10.2.2)): + unstorage@1.17.5(@upstash/redis@1.38.2)(db0@0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)))(ioredis@5.11.1): dependencies: anymatch: 3.1.3 chokidar: 5.0.0 @@ -12995,15 +14055,18 @@ snapshots: ofetch: 1.5.1 ufo: 1.6.4 optionalDependencies: - db0: 0.3.4 - ioredis: 5.11.1(supports-color@10.2.2) + '@upstash/redis': 1.38.2 + db0: 0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)) + ioredis: 5.11.1 - unstorage@2.0.0-alpha.3(db0@0.3.4)(ioredis@5.11.1(supports-color@10.2.2))(lru-cache@11.5.1)(ofetch@1.5.1): + unstorage@2.0.0-alpha.7(@upstash/redis@1.38.2)(chokidar@5.0.0)(db0@0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)))(ioredis@5.11.1)(lru-cache@11.5.1)(ofetch@2.0.0-alpha.3): optionalDependencies: - db0: 0.3.4 - ioredis: 5.11.1(supports-color@10.2.2) + '@upstash/redis': 1.38.2 + chokidar: 5.0.0 + db0: 0.3.4(drizzle-orm@0.45.2(@cloudflare/workers-types@5.20260808.1)(@upstash/redis@1.38.2)) + ioredis: 5.11.1 lru-cache: 11.5.1 - ofetch: 1.5.1 + ofetch: 2.0.0-alpha.3 untun@0.1.3: dependencies: @@ -13021,7 +14084,7 @@ snapshots: unwasm@0.5.3: dependencies: - exsolve: 1.0.8 + exsolve: 1.1.1 knitwork: 1.3.0 magic-string: 0.30.21 mlly: 1.8.2 @@ -13076,18 +14139,18 @@ snapshots: vary@1.1.2: {} - vite-tsconfig-paths@5.1.4(supports-color@10.2.2)(typescript@5.9.3)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)): + vite-tsconfig-paths@5.1.4(typescript@5.9.3)(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)): dependencies: - debug: 4.4.3(supports-color@10.2.2) + debug: 4.4.3 globrex: 0.1.2 tsconfck: 3.1.6(typescript@5.9.3) optionalDependencies: - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) transitivePeerDependencies: - supports-color - typescript - vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0): + vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0): dependencies: esbuild: 0.28.0 fdir: 6.5.0(picomatch@4.0.4) @@ -13101,11 +14164,12 @@ snapshots: jiti: 2.7.0 lightningcss: 1.32.0 terser: 5.49.0 + tsx: 4.23.11 yaml: 2.9.0 - vitefu@1.1.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0)): + vitefu@1.1.3(vite@7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0)): optionalDependencies: - vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(yaml@2.9.0) + vite: 7.3.6(@types/node@22.20.1)(jiti@2.7.0)(lightningcss@1.32.0)(terser@5.49.0)(tsx@4.23.11)(yaml@2.9.0) vlq@1.0.1: {} @@ -13151,6 +14215,31 @@ snapshots: dependencies: isexe: 3.1.5 + workerd@1.20260801.1: + optionalDependencies: + '@cloudflare/workerd-darwin-64': 1.20260801.1 + '@cloudflare/workerd-darwin-arm64': 1.20260801.1 + '@cloudflare/workerd-linux-64': 1.20260801.1 + '@cloudflare/workerd-linux-arm64': 1.20260801.1 + '@cloudflare/workerd-windows-64': 1.20260801.1 + + wrangler@4.120.0(@cloudflare/workers-types@5.20260808.1)(bufferutil@4.1.0)(utf-8-validate@6.0.6): + dependencies: + '@cloudflare/kv-asset-handler': 0.5.0 + '@cloudflare/unenv-preset': 2.16.1(unenv@2.0.0-rc.24)(workerd@1.20260801.1) + blake3-wasm: 2.1.5 + esbuild: 0.28.1 + miniflare: 5.20260801.1-alpha(bufferutil@4.1.0)(utf-8-validate@6.0.6) + path-to-regexp: 6.3.0 + unenv: 2.0.0-rc.24 + workerd: 1.20260801.1 + optionalDependencies: + '@cloudflare/workers-types': 5.20260808.1 + fsevents: 2.3.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + wrap-ansi@6.2.0: dependencies: ansi-styles: 4.3.0 @@ -13268,6 +14357,14 @@ snapshots: '@poppinss/exception': 1.2.3 error-stack-parser-es: 1.0.5 + youch@4.1.0-beta.10: + dependencies: + '@poppinss/colors': 4.1.6 + '@poppinss/dumper': 0.6.5 + '@speed-highlight/core': 1.2.15 + cookie: 1.1.1 + youch-core: 0.3.3 + youch@4.1.1: dependencies: '@poppinss/colors': 4.1.6 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index afc881e4..86e7425b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -17,3 +17,4 @@ allowBuilds: esbuild: true protobufjs: true utf-8-validate: false + workerd: false diff --git a/public/offline.html b/public/offline.html index 61239983..834105a0 100644 --- a/public/offline.html +++ b/public/offline.html @@ -126,6 +126,12 @@ transform: scale(1); } } + + @media (prefers-reduced-motion: reduce) { + .error-container { + animation: none; + } + } diff --git a/public/sw.js b/public/sw.js index 779bfd1a..1e2f7298 100644 --- a/public/sw.js +++ b/public/sw.js @@ -38,13 +38,9 @@ if (workbox) { self.clients.claim(); }); - // Skip Clerk auth and Convex sync / admin endpoints + // Skip Clerk auth and admin endpoints const shouldSkipRequest = (url) => { - return ( - url.hostname.includes('clerk') || - url.pathname.includes('/api/convex') || - url.pathname.startsWith('/admin') - ); + return url.hostname.includes('clerk') || url.pathname.startsWith('/admin'); }; // 1. Hashed app assets (JS, CSS, static local assets) diff --git a/server/routes/api/health.ts b/server/routes/api/health.ts new file mode 100644 index 00000000..85bd31ac --- /dev/null +++ b/server/routes/api/health.ts @@ -0,0 +1,44 @@ +// GET /api/health — pings D1 (select 1) +import { sql } from "drizzle-orm"; +import { defineEventHandler, setResponseStatus } from "h3"; +import { getDb } from "../../../src/server/db/client"; +import { getEnv } from "../../../src/server/env"; + +type CheckResult = { ok: boolean; [key: string]: unknown }; + +export default defineEventHandler(async (event) => { + const env = getEnv(); + const started = Date.now(); + + const checks: Record = {}; + let ok = true; + + // D1 ping — skipped when there's no binding (plain Node `vite dev`); on the + // Worker (`wrangler dev` / deployed) the DB binding is always present. + if (!env.DB) { + checks.db = { ok: true, skipped: "no D1 binding (vite dev)" }; + } else { + try { + const db = getDb(env); + await db.run(sql`select 1`); + checks.db = { ok: true }; + } catch { + // Public endpoint — don't leak raw driver/DB error strings (they can + // expose internal details); a generic flag is enough for uptime checks. + ok = false; + checks.db = { ok: false, error: "database unavailable" }; + } + } + + if (!ok) { + setResponseStatus(event, 503); + } + + return { + ok, + service: "pebbly", + timestamp: new Date().toISOString(), + checks, + durationMs: Date.now() - started, + }; +}); diff --git a/server/tasks/snapshots.ts b/server/tasks/snapshots.ts new file mode 100644 index 00000000..74d8dc7b --- /dev/null +++ b/server/tasks/snapshots.ts @@ -0,0 +1,72 @@ +// Daily watchlist snapshot cron (03:00 UTC) — port of convex/crons.ts. +// +// Nitro's cloudflare-module preset wires the Worker `scheduled()` handler to +// Nitro's task system: the cron expression in wrangler.toml +// (`[triggers] crons = ["0 3 * * *"]`) is dispatched here via the +// `scheduledTasks` mapping in nitro.config.ts. +// +// Each invocation is bounded: createDailySnapshots processes at most +// MAX_USERS_PER_RUN users, resuming from the last-processed user id persisted +// in D1 (snapshot_cursors). Users skipped by one invocation are processed by +// the next cron run, so coverage is eventual and complete without exceeding +// the Worker execution budget. +import { eq } from "drizzle-orm"; +import { defineTask } from "nitro/task"; +import { getDb } from "../../src/server/db/client"; +import { snapshotCursors } from "../../src/server/db/schema"; +import { getEnv } from "../../src/server/env"; +import { createDailySnapshots } from "../../src/server/helpers/snapshots"; + +const CURSOR_KEY = "watchlist_snapshot_cursor"; +const MAX_USERS_PER_RUN = 200; + +async function readCursor(): Promise { + try { + const db = getDb(getEnv()); + const row = await db + .select({ value: snapshotCursors.value }) + .from(snapshotCursors) + .where(eq(snapshotCursors.key, CURSOR_KEY)) + .limit(1); + return row[0]?.value ?? ""; + } catch (error) { + console.error("Failed to read snapshot cursor:", error); + return ""; + } +} + +async function writeCursor(cursor: string) { + try { + const db = getDb(getEnv()); + await db + .insert(snapshotCursors) + .values({ key: CURSOR_KEY, value: cursor, updatedAt: Date.now() }) + .onConflictDoUpdate({ + target: snapshotCursors.key, + set: { value: cursor, updatedAt: Date.now() }, + }); + } catch (error) { + console.error("Failed to persist snapshot cursor:", error); + } +} + +export default defineTask({ + meta: { + name: "snapshots", + description: "Create daily watchlist snapshots for all users (bounded per run)", + }, + async run() { + const cursor = await readCursor(); + const { lastProcessedId, processed } = await createDailySnapshots( + cursor, + MAX_USERS_PER_RUN, + ); + await writeCursor(lastProcessedId); + + return { + result: `daily snapshots created (${processed} users)`, + processed, + lastProcessedId, + }; + }, +}); diff --git a/src/components/admin/admin-dashboard.tsx b/src/components/admin/admin-dashboard.tsx index 6d589679..f235d649 100644 --- a/src/components/admin/admin-dashboard.tsx +++ b/src/components/admin/admin-dashboard.tsx @@ -37,7 +37,7 @@ export function AdminDashboard() { key={t.id} type="button" onClick={() => setTab(t.id)} - className={`flex items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-semibold transition-all duration-200 ${ + className={`flex items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-semibold transition-colors duration-200 ${ tab === t.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground" diff --git a/src/components/admin/admin-permission-toggles.tsx b/src/components/admin/admin-permission-toggles.tsx index 76679429..d8d7757d 100644 --- a/src/components/admin/admin-permission-toggles.tsx +++ b/src/components/admin/admin-permission-toggles.tsx @@ -1,12 +1,14 @@ -import { useMutation, useQuery } from "convex/react"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { Activity, AlertTriangle, Zap } from "lucide-react"; +import { useState } from "react"; import { Skeleton } from "@/components/ui/skeleton"; import { type PermissionRole, RBAC_FEATURES, type RbacFeature, } from "@/constants"; -import { api } from "../../../convex/_generated/api"; +import { getRolePermissions, setRolePermission } from "@/server/fns/admin"; +import { unwrap } from "@/server/schema/common"; const FEATURE_ROLES: Record = { "video-player": "video-player", @@ -33,14 +35,14 @@ function ToggleSwitch({ onClick={() => { onChange(!enabled); }} - className={`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${ + className={`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${ enabled ? "bg-foreground shadow-sm" : "bg-muted-foreground/20 ring-1 ring-border" } cursor-pointer`} > @@ -56,6 +58,21 @@ function featurePermissions( return permissionsByRole[role]?.[feature] ?? false; } +function FeatureError({ onRetry }: { onRetry: () => void }) { + return ( +
+ Failed to load permission settings. + +
+ ); +} + function FeatureRow({ feature, featureLabel, @@ -100,10 +117,36 @@ function FeatureRow({ } export function AdminPermissionToggles() { - const rawPermissions = useQuery(api.admin.getRolePermissions, {}); - const setRolePermission = useMutation(api.admin.setRolePermission); + const queryClient = useQueryClient(); + const [toggleError, setToggleError] = useState(null); + const rawPermissions = useQuery({ + queryKey: ["admin", "role-permissions"], + queryFn: () => unwrap(getRolePermissions()), + }); + const setRolePermissionMutation = useMutation({ + mutationFn: (args: { feature: RbacFeature; enabled: boolean }) => + unwrap(setRolePermission({ data: args })), + onSuccess: () => { + setToggleError(null); + // Keep the table in sync with the persisted permission state. + queryClient.invalidateQueries({ + queryKey: ["admin", "role-permissions"], + }); + }, + onError: (error) => { + setToggleError( + error instanceof Error ? error.message : "Failed to update permission", + ); + }, + }); - if (rawPermissions === undefined) { + const rawPermissionsData = rawPermissions.data; + + if (rawPermissions.isError) { + return rawPermissions.refetch()} />; + } + + if (rawPermissionsData === undefined) { return (
@@ -112,13 +155,18 @@ export function AdminPermissionToggles() { ); } - const permissionsByRole = rawPermissions as Record< + const permissionsByRole = rawPermissionsData as Record< PermissionRole, Record >; return (
+ {toggleError && ( +
+ {toggleError} +
+ )}
{Object.entries(RBAC_FEATURES).map(([feature, config]) => ( - setRolePermission({ role, feature, enabled }) + onToggle={(_role, enabled) => + setRolePermissionMutation.mutate({ + feature: feature as RbacFeature, + enabled, + }) } /> ))} diff --git a/src/components/admin/admin-role-dialog.tsx b/src/components/admin/admin-role-dialog.tsx new file mode 100644 index 00000000..dd1d3a50 --- /dev/null +++ b/src/components/admin/admin-role-dialog.tsx @@ -0,0 +1,118 @@ +import { AlertCircle, Ban, Loader2, ShieldCheck } from "lucide-react"; +import type { UserTarget } from "@/components/admin/use-admin-users"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; + +export function AdminRoleDialog({ + selectedUser, + isSubmitting, + errorMessage, + onConfirm, + onOpenChange, +}: { + selectedUser: UserTarget | null; + isSubmitting: boolean; + errorMessage: string | null; + onConfirm: () => void; + onOpenChange: (open: boolean) => void; +}) { + return ( + + + +
+ {selectedUser?.isBanned ? ( +
+ +
+ ) : ( +
+ +
+ )} + + {selectedUser?.isBanned ? "Unban User" : "Ban User"} + +
+ + {selectedUser?.isBanned ? ( + <> + Are you sure you want to unban{" "} + + {selectedUser?.name} + {" "} + ({selectedUser?.email})? They will regain access to application + features according to their assigned roles. + + ) : ( + <> + Are you sure you want to ban{" "} + + {selectedUser?.name} + {" "} + ({selectedUser?.email})? They will be immediately blocked from + accessing application features. + + )} + +
+ + {errorMessage && ( +
+ + {errorMessage} +
+ )} + + + + + + + +
+
+ ); +} diff --git a/src/components/admin/admin-user-row.tsx b/src/components/admin/admin-user-row.tsx new file mode 100644 index 00000000..5dfc2608 --- /dev/null +++ b/src/components/admin/admin-user-row.tsx @@ -0,0 +1,286 @@ +import { Ban, Check, ShieldCheck, UserCog, UserX } from "lucide-react"; +import { + type AdminUser, + ROLE_CONFIGS, +} from "@/components/admin/use-admin-users"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; + +function RoleToggleButtons({ + user, + isBanned, + isRolePending, + onToggleRole, +}: { + user: AdminUser; + isBanned: boolean; + isRolePending: boolean; + onToggleRole: (role: (typeof ROLE_CONFIGS)[number]["value"]) => void; +}) { + const currentRoles = (user.roles ?? []).filter( + (role) => role === "video-player" || role === "ai-integrations", + ) as (typeof ROLE_CONFIGS)[number]["value"][]; + + return ( + <> + {ROLE_CONFIGS.map((config) => { + const isActive = currentRoles.includes(config.value); + return ( + + ); + })} + + ); +} + +function UserBadges({ user, isSelf }: { user: AdminUser; isSelf: boolean }) { + return ( + <> + {user.isAdmin && ( + + Admin + + )} + {isSelf && ( + + You + + )} + + ); +} + +function UserAvatar({ user, size }: { user: AdminUser; size: "sm" | "lg" }) { + const className = + size === "sm" + ? "size-8 rounded-full object-cover ring-1 ring-border" + : "size-11 rounded-full object-cover shrink-0 ring-1 ring-border/60"; + const fallbackClassName = + size === "sm" + ? "flex size-8 items-center justify-center rounded-full bg-secondary ring-1 ring-border" + : "flex size-11 items-center justify-center rounded-full bg-secondary shrink-0 ring-1 ring-border/60"; + const iconClassName = size === "sm" ? "size-4" : "size-5"; + + return user.image ? ( + {user.name} + ) : ( +
+ +
+ ); +} + +export function AdminUserRow({ + user, + isSelf, + isBanned, + canModify, + isRolePending, + onToggleRole, + onPromptBanToggle, + variant, +}: { + user: AdminUser; + isSelf: boolean; + isBanned: boolean; + canModify: boolean; + isRolePending: boolean; + onToggleRole: (role: (typeof ROLE_CONFIGS)[number]["value"]) => void; + onPromptBanToggle: (user: AdminUser) => void; + variant: "desktop" | "mobile"; +}) { + if (variant === "desktop") { + return ( + + +
+ +
+
+ {user.name} + +
+

{user.email}

+
+
+ + + {isBanned ? ( + + + Banned + + ) : ( + + + Active + + )} + + +
+ +
+ + + + + + ); + } + + return ( +
+
+
+ +
+
+ + {user.name} + + +
+

+ {user.email} +

+
+
+ + {isBanned ? ( + + + Banned + + ) : ( + + + Active + + )} +
+ +
+
+ + Roles: + + {ROLE_CONFIGS.map((config) => { + const isActive = (user.roles ?? []).includes(config.value); + return ( + + ); + })} +
+ + {canModify && ( + + )} +
+
+ ); +} diff --git a/src/components/admin/admin-user-table.tsx b/src/components/admin/admin-user-table.tsx index bc06088e..88ce6a1f 100644 --- a/src/components/admin/admin-user-table.tsx +++ b/src/components/admin/admin-user-table.tsx @@ -1,67 +1,43 @@ -import { useUser } from "@clerk/react"; -import { useMutation, useQuery } from "convex/react"; +import { AlertCircle, Search } from "lucide-react"; +import { AdminRoleDialog } from "@/components/admin/admin-role-dialog"; +import { AdminUserRow } from "@/components/admin/admin-user-row"; import { - AlertCircle, - Ban, - Check, - Loader2, - Search, - ShieldCheck, - UserCog, - UserX, -} from "lucide-react"; -import { useState } from "react"; -import { Badge } from "@/components/ui/badge"; + type DynamicRbacRole, + useAdminUsers, +} from "@/components/admin/use-admin-users"; import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Skeleton } from "@/components/ui/skeleton"; -import type { RbacRole } from "@/constants"; -import { api } from "../../../convex/_generated/api"; - -type DynamicRbacRole = Exclude; - -const ROLE_CONFIGS: { value: DynamicRbacRole; label: string; short: string }[] = - [ - { value: "video-player", label: "Video Player", short: "Video" }, - { value: "ai-integrations", label: "AI Integrations", short: "AI" }, - ]; - -interface UserTarget { - tokenIdentifier: string; - name: string; - email: string; - isBanned: boolean; -} - -type FilterTab = "all" | "active" | "banned"; export function AdminUserTable() { - const { user: currentUser } = useUser(); - const users = useQuery(api.admin.listUsers, {}); - const setUserRoles = useMutation(api.admin.setUserRoles); - const setUserBanned = useMutation(api.admin.setUserBanned); - - const [selectedUser, setSelectedUser] = useState(null); - const [isSubmitting, setIsSubmitting] = useState(false); - const [errorMessage, setErrorMessage] = useState(null); - const [roleError, setRoleError] = useState(null); - const [search, setSearch] = useState(""); - const [filterTab, setFilterTab] = useState("all"); - - if (users === undefined) { + const { + users, + loading, + filteredUsers, + filterTabs, + search, + setSearch, + filterTab, + setFilterTab, + roleError, + setRoleError, + selectedUser, + setSelectedUser, + isSubmitting, + errorMessage, + handleConfirmBanToggle, + isSelf, + toggleRole, + promptBanToggle, + setUserRolesMutation, + } = useAdminUsers(); + + if (loading || users === undefined) { return (
{Array.from({ length: 5 }).map((_, i) => ( @@ -70,56 +46,6 @@ export function AdminUserTable() { ); } - const handleConfirmBanToggle = async () => { - if (!selectedUser) return; - setIsSubmitting(true); - setErrorMessage(null); - - try { - await setUserBanned({ - tokenIdentifier: selectedUser.tokenIdentifier, - banned: !selectedUser.isBanned, - }); - setSelectedUser(null); - } catch (err) { - console.error("Ban user error:", err); - setErrorMessage( - err instanceof Error ? err.message : "Failed to update user status", - ); - } finally { - setIsSubmitting(false); - } - }; - - const lowerSearch = search.toLowerCase().trim(); - const filteredUsers = users.filter((user) => { - const matchesSearch = - !lowerSearch || - user.name.toLowerCase().includes(lowerSearch) || - user.email.toLowerCase().includes(lowerSearch); - - const matchesFilter = - filterTab === "all" || - (filterTab === "active" && !user.isBanned) || - (filterTab === "banned" && user.isBanned); - - return matchesSearch && matchesFilter; - }); - - const filterTabs: { id: FilterTab; label: string; count: number }[] = [ - { id: "all", label: "All", count: users.length }, - { - id: "active", - label: "Active", - count: users.filter((u) => !u.isBanned).length, - }, - { - id: "banned", - label: "Banned", - count: users.filter((u) => u.isBanned).length, - }, - ]; - return (
{roleError && ( @@ -162,7 +88,7 @@ export function AdminUserTable() { role="tab" aria-selected={filterTab === ft.id} onClick={() => setFilterTab(ft.id)} - className={`flex items-center justify-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition-all duration-200 ${ + className={`flex items-center justify-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition-colors duration-200 ${ filterTab === ft.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground" @@ -214,169 +140,21 @@ export function AdminUserTable() { ) : ( - filteredUsers.map((user) => { - const currentRoles = (user.roles ?? []).filter( - (role) => - role === "video-player" || role === "ai-integrations", - ) as DynamicRbacRole[]; - - const isSelf = - currentUser?.id === user.tokenIdentifier || - `clerk|${currentUser?.id}` === user.tokenIdentifier; - const isBanned = user.isBanned; - - return ( - - -
- {user.image ? ( - {user.name} - ) : ( -
- -
- )} -
-
- {user.name} - {user.isAdmin && ( - - Admin - - )} - {isSelf && ( - - You - - )} -
-

- {user.email} -

-
-
- - - {isBanned ? ( - - - Banned - - ) : ( - - - Active - - )} - - -
- {ROLE_CONFIGS.map((config) => { - const isActive = currentRoles.includes( - config.value, - ); - - const toggleRole = () => { - setRoleError(null); - const next = isActive - ? currentRoles.filter((r) => r !== config.value) - : [...currentRoles, config.value]; - setUserRoles({ - tokenIdentifier: user.tokenIdentifier, - roles: next, - }).catch((err) => { - setRoleError( - err instanceof Error - ? err.message - : String(err), - ); - }); - }; - - return ( - - ); - })} -
- - - - - - ); - }) + filteredUsers.map((user) => ( + + toggleRole(user, role) + } + onPromptBanToggle={promptBanToggle} + variant="desktop" + /> + )) )} @@ -390,159 +168,19 @@ export function AdminUserTable() { No users found
) : ( - filteredUsers.map((user) => { - const currentRoles = (user.roles ?? []).filter( - (role) => role === "video-player" || role === "ai-integrations", - ) as DynamicRbacRole[]; - - const isSelf = - currentUser?.id === user.tokenIdentifier || - `clerk|${currentUser?.id}` === user.tokenIdentifier; - const isBanned = user.isBanned; - - return ( -
- {/* Header Row: User Info + Status Badge */} -
-
- {user.image ? ( - {user.name} - ) : ( -
- -
- )} -
-
- - {user.name} - - {user.isAdmin && ( - - Admin - - )} - {isSelf && ( - - You - - )} -
-

- {user.email} -

-
-
- - {/* Status Badge */} - {isBanned ? ( - - - Banned - - ) : ( - - - Active - - )} -
- - {/* Bottom Section: Labeled Feature Roles + Quick Actions */} -
-
- - Roles: - - {ROLE_CONFIGS.map((config) => { - const isActive = currentRoles.includes(config.value); - const toggleRole = () => { - setRoleError(null); - const next = isActive - ? currentRoles.filter((r) => r !== config.value) - : [...currentRoles, config.value]; - setUserRoles({ - tokenIdentifier: user.tokenIdentifier, - roles: next, - }).catch((err) => { - setRoleError( - err instanceof Error ? err.message : String(err), - ); - }); - }; - - return ( - - ); - })} -
- - {!isSelf && !user.isAdmin && ( - - )} -
-
- ); - }) + filteredUsers.map((user) => ( + toggleRole(user, role)} + onPromptBanToggle={promptBanToggle} + variant="mobile" + /> + )) )}
@@ -553,103 +191,17 @@ export function AdminUserTable() { )} {/* Ban / Unban Confirmation Dialog */} - { if (!open && !isSubmitting) { setSelectedUser(null); - setErrorMessage(null); } }} - > - - -
- {selectedUser?.isBanned ? ( -
- -
- ) : ( -
- -
- )} - - {selectedUser?.isBanned ? "Unban User" : "Ban User"} - -
- - {selectedUser?.isBanned ? ( - <> - Are you sure you want to unban{" "} - - {selectedUser?.name} - {" "} - ({selectedUser?.email})? They will regain access to - application features according to their assigned roles. - - ) : ( - <> - Are you sure you want to ban{" "} - - {selectedUser?.name} - {" "} - ({selectedUser?.email})? They will be immediately blocked from - accessing application features. - - )} - -
- - {errorMessage && ( -
- - {errorMessage} -
- )} - - - - - - - -
-
+ />
); } diff --git a/src/components/admin/use-admin-users.ts b/src/components/admin/use-admin-users.ts new file mode 100644 index 00000000..7fe8394b --- /dev/null +++ b/src/components/admin/use-admin-users.ts @@ -0,0 +1,180 @@ +import { useUser } from "@clerk/react"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import { useState } from "react"; +import type { RbacRole } from "@/constants"; +import { queryKeys } from "@/lib/query/keys"; +import { listUsers, setUserBanned, setUserRoles } from "@/server/fns/admin"; +import { unwrap } from "@/server/schema/common"; + +export type DynamicRbacRole = Exclude; + +export const ROLE_CONFIGS: { + value: DynamicRbacRole; + label: string; + short: string; +}[] = [ + { value: "video-player", label: "Video Player", short: "Video" }, + { value: "ai-integrations", label: "AI Integrations", short: "AI" }, +]; + +export interface AdminUser { + _id: string; + tokenIdentifier: string; + name: string; + email: string; + image: string | null; + roles: string[]; + isBanned: boolean; + isAdmin: boolean; +} + +export interface UserTarget { + tokenIdentifier: string; + name: string; + email: string; + isBanned: boolean; +} + +export type FilterTab = "all" | "active" | "banned"; + +export function useAdminUsers() { + const { user: currentUser } = useUser(); + const queryClient = useQueryClient(); + const usersQuery = useQuery({ + queryKey: queryKeys.admin.users(currentUser?.id), + queryFn: () => unwrap(listUsers({ data: {} })), + }); + const refreshUsers = () => { + void queryClient.invalidateQueries({ + queryKey: queryKeys.admin.users(currentUser?.id), + }); + }; + const setUserRolesMutation = useMutation({ + mutationFn: (args: { tokenIdentifier: string; roles: DynamicRbacRole[] }) => + unwrap(setUserRoles({ data: args })), + onSuccess: refreshUsers, + }); + const setUserBannedMutation = useMutation({ + mutationFn: (args: { tokenIdentifier: string; banned: boolean }) => + unwrap(setUserBanned({ data: args })), + onSuccess: refreshUsers, + }); + + const [selectedUser, setSelectedUser] = useState(null); + const [isSubmitting, setIsSubmitting] = useState(false); + const [errorMessage, setErrorMessage] = useState(null); + const [roleError, setRoleError] = useState(null); + const [search, setSearch] = useState(""); + const [filterTab, setFilterTab] = useState("all"); + + const users = usersQuery.data; + + const handleConfirmBanToggle = async () => { + if (!selectedUser) return; + setIsSubmitting(true); + setErrorMessage(null); + + try { + await setUserBannedMutation.mutateAsync({ + tokenIdentifier: selectedUser.tokenIdentifier, + banned: !selectedUser.isBanned, + }); + setSelectedUser(null); + } catch (err) { + console.error("Ban user error:", err); + setErrorMessage( + err instanceof Error ? err.message : "Failed to update user status", + ); + } finally { + setIsSubmitting(false); + } + }; + + const lowerSearch = search.toLowerCase().trim(); + const filteredUsers = (users ?? []).filter((user) => { + const matchesSearch = + !lowerSearch || + user.name.toLowerCase().includes(lowerSearch) || + user.email.toLowerCase().includes(lowerSearch); + + const matchesFilter = + filterTab === "all" || + (filterTab === "active" && !user.isBanned) || + (filterTab === "banned" && user.isBanned); + + return matchesSearch && matchesFilter; + }); + + const filterTabs: { id: FilterTab; label: string; count: number }[] = [ + { id: "all", label: "All", count: users?.length ?? 0 }, + { + id: "active", + label: "Active", + count: (users ?? []).filter((u) => !u.isBanned).length, + }, + { + id: "banned", + label: "Banned", + count: (users ?? []).filter((u) => u.isBanned).length, + }, + ]; + + const getCurrentRoles = (user: AdminUser): DynamicRbacRole[] => + (user.roles ?? []).filter( + (role) => role === "video-player" || role === "ai-integrations", + ) as DynamicRbacRole[]; + + const isSelf = (user: AdminUser) => + currentUser?.id === user.tokenIdentifier || + `clerk|${currentUser?.id}` === user.tokenIdentifier; + + const toggleRole = (user: AdminUser, role: DynamicRbacRole) => { + setRoleError(null); + const currentRoles = getCurrentRoles(user); + const next = currentRoles.includes(role) + ? currentRoles.filter((r) => r !== role) + : [...currentRoles, role]; + setUserRolesMutation + .mutateAsync({ + tokenIdentifier: user.tokenIdentifier, + roles: next, + }) + .catch((err) => { + setRoleError(err instanceof Error ? err.message : String(err)); + }); + }; + + const promptBanToggle = (user: AdminUser) => { + setErrorMessage(null); + setSelectedUser({ + tokenIdentifier: user.tokenIdentifier, + name: user.name, + email: user.email, + isBanned: user.isBanned, + }); + }; + + return { + currentUser, + users, + loading: users === undefined, + filteredUsers, + filterTabs, + search, + setSearch, + filterTab, + setFilterTab, + roleError, + setRoleError, + selectedUser, + setSelectedUser, + isSubmitting, + errorMessage, + handleConfirmBanToggle, + getCurrentRoles, + isSelf, + toggleRole, + promptBanToggle, + setUserRolesMutation, + }; +} diff --git a/src/components/custom-list-dialog.tsx b/src/components/custom-list-dialog.tsx index 5281906b..3a6d08b0 100644 --- a/src/components/custom-list-dialog.tsx +++ b/src/components/custom-list-dialog.tsx @@ -108,14 +108,12 @@ export function CustomListDialog({ name: trimmed, color: color || undefined, visibility, - listType, }); } else if (autoAddMedia) { await createListAndAdd({ name: trimmed, color: color || undefined, visibility, - listType, tmdbId: autoAddMedia.tmdbId, mediaType: autoAddMedia.mediaType, title: autoAddMedia.title, @@ -130,7 +128,6 @@ export function CustomListDialog({ name: trimmed, color: color || undefined, visibility, - listType, }); } setName(""); diff --git a/src/components/custom-list-picker.tsx b/src/components/custom-list-picker.tsx index a4bfad89..8b1cf603 100644 --- a/src/components/custom-list-picker.tsx +++ b/src/components/custom-list-picker.tsx @@ -1,5 +1,5 @@ import { useUser } from "@clerk/react"; -import { useMutation, useQuery } from "convex/react"; +import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { Plus } from "lucide-react"; import { useState } from "react"; import { @@ -8,11 +8,15 @@ import { DropdownMenuItem, DropdownMenuLabel, } from "@/components/ui/dropdown-menu"; -import { api } from "../../convex/_generated/api"; +import { queryKeys } from "@/lib/query/keys"; +import { + getCustomLists, + getItemLists, + toggleListItem, +} from "@/server/fns/lists"; +import { unwrap } from "@/server/schema/common"; import { CustomListDialog } from "./custom-list-dialog"; -const QUERY_SKIP = "skip" as const; - export function CustomListPicker({ tmdbId, mediaType, @@ -20,20 +24,44 @@ export function CustomListPicker({ tmdbId: number; mediaType: "movie" | "tv"; }) { - const { isSignedIn } = useUser(); - const lists = useQuery( - api.watchlist.getCustomLists, - isSignedIn ? {} : QUERY_SKIP, - ); - const itemLists = useQuery( - api.watchlist.getItemLists, - isSignedIn ? { tmdbId, mediaType } : QUERY_SKIP, - ); - const toggleListItem = useMutation(api.watchlist.toggleListItem); + const { isSignedIn, user } = useUser(); + const queryClient = useQueryClient(); + const listsQuery = useQuery({ + queryKey: queryKeys.lists.all(user?.id), + queryFn: () => unwrap(getCustomLists()), + enabled: !!isSignedIn, + }); + const itemListsQuery = useQuery({ + queryKey: queryKeys.lists.itemLists(tmdbId, mediaType, user?.id), + queryFn: () => unwrap(getItemLists({ data: { tmdbId, mediaType } })), + enabled: !!isSignedIn, + }); + const toggleListItemMutation = useMutation({ + mutationFn: (args: { + listId: string; + tmdbId: number; + mediaType: "movie" | "tv"; + title?: string; + image?: string; + backdrop?: string; + rating?: number; + release_date?: string; + overview?: string; + }) => unwrap(toggleListItem({ data: args })), + onSuccess: () => { + // Refresh membership, itemCount, and previews with server state. + void queryClient.invalidateQueries({ + queryKey: queryKeys.lists.itemLists(tmdbId, mediaType, user?.id), + }); + void queryClient.invalidateQueries({ + queryKey: queryKeys.lists.all(user?.id), + }); + }, + }); const [showCreateDialog, setShowCreateDialog] = useState(false); - const safeList = lists ?? []; - const safeItemLists = itemLists ?? []; + const safeList = listsQuery.data ?? []; + const safeItemLists = itemListsQuery.data ?? []; return ( <> @@ -41,19 +69,20 @@ export function CustomListPicker({ Collections + {" "} {safeList .filter((list) => list.listType !== "pebbly-picks") .map((list) => { - const isInList = safeItemLists.includes(list._id); + const isInList = safeItemLists.includes(list.id); return ( e.preventDefault()} onCheckedChange={() => { - toggleListItem({ - listId: list._id, + toggleListItemMutation.mutate({ + listId: list.id, tmdbId, mediaType, }); diff --git a/src/components/daily-pick.tsx b/src/components/daily-pick.tsx index 189c4a9d..9ec17fab 100644 --- a/src/components/daily-pick.tsx +++ b/src/components/daily-pick.tsx @@ -1,7 +1,6 @@ -import { useQuery } from "@tanstack/react-query"; import { Link } from "@tanstack/react-router"; import { Eye, ThumbsDown } from "lucide-react"; -import { useEffect, useMemo, useState } from "react"; +import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; import { @@ -12,395 +11,20 @@ import { } from "@/components/ui/icons"; import { Image } from "@/components/ui/image"; import { WatchlistButton } from "@/components/watchlist-button"; -import { IMAGE_PREFIX } from "@/constants"; +import { useDailyPick } from "@/hooks/use-daily-pick"; import { usePermissions } from "@/hooks/use-permissions"; -import { - useAllMediaStates, - useSetReaction, - useWatchlist, -} from "@/hooks/use-watchlist"; -import { getMedia, getMovieDetails, getTvDetails } from "@/lib/queries"; -import { cn, formatMediaTitle } from "@/lib/utils"; import { Spinner } from "./ui/spinner"; - -interface PickItem { - id: number; - title: string; - overview?: string; - vote_average: number; - poster_path?: string; - backdrop_path?: string; - media_type: "movie" | "tv"; - release_date?: string; - first_air_date?: string; - isFromWatchlist?: boolean; - isCurrentlyWatching?: boolean; - watchProgress?: number; -} - -function getTodaySeedIndex(max: number): number { - if (max <= 0) return 0; - const todayStr = new Date().toISOString().slice(0, 10); - let hash = 0; - for (let i = 0; i < todayStr.length; i++) { - hash = (hash << 5) - hash + (todayStr.charCodeAt(i) || 0); - hash |= 0; - } - return Math.abs(hash) % max; -} - -function getPickKey(item: PickItem): string { - return `${item.media_type}:${item.id}`; -} - export function DailyPickButton() { const [isOpen, setIsOpen] = useState(false); - // Key of the currently shown pick ("movie:123"). Keeps the displayed tile - // stable when `candidateItems` reorders, e.g. adding the pick to the - // watchlist moves it from the discovery bucket into the watchlist bucket. - const [selectedKey, setSelectedKey] = useState(null); - const { hasFeature, loading: isPermissionsLoading } = usePermissions(); + const { + hasFeature, + loading: isPermissionsLoading, + isSignedIn, + } = usePermissions(); const isVideoPlaybackEnabled = hasFeature("video-player"); - const { watchlist } = useWatchlist(); - const { allMediaStates } = useAllMediaStates(); - const setReaction = useSetReaction(); - - const mediaStateMap = useMemo(() => { - const map = new Map< - string, - { - progressStatus?: string | null; - reaction?: string | null; - progress?: number; - } - >(); - for (const item of allMediaStates) { - const key = `${item.type}:${item.external_id}`; - map.set(key, { - progressStatus: item.progressStatus, - reaction: item.reaction, - progress: item.progress, - }); - } - return map; - }, [allMediaStates]); - - const { data: trendingMedia, isLoading: isLoadingTrending } = useQuery({ - queryKey: ["daily-pick-trending"], - queryFn: async () => { - const items = await getMedia({ type: "trending_day", page: 1 }); - return items; - }, - staleTime: 1000 * 60 * 60, // 1 hour - enabled: isOpen, - }); - - const { data: popularTv, isLoading: isLoadingTv } = useQuery({ - queryKey: ["daily-pick-popular-tv"], - queryFn: async () => { - const items = await getMedia({ type: "tv-shows_popular", page: 1 }); - return items; - }, - staleTime: 1000 * 60 * 60, // 1 hour - enabled: isOpen, - }); - - const tmdbInfoMap = useMemo(() => { - const map = new Map< - string, - { - title: string; - overview?: string; - poster_path?: string; - backdrop_path?: string; - vote_average: number; - release_date?: string; - first_air_date?: string; - } - >(); - if (trendingMedia) { - for (const item of trendingMedia) { - const title = item.title ?? item.name; - const media_type = - (item.media_type as "movie" | "tv") ?? (item.name ? "tv" : "movie"); - if (title && title !== "Unknown Title") { - map.set(`${media_type}:${item.id}`, { - title, - overview: item.overview, - poster_path: item.poster_path ?? undefined, - backdrop_path: item.backdrop_path ?? undefined, - vote_average: item.vote_average ?? 0, - release_date: item.release_date, - first_air_date: item.first_air_date, - }); - } - } - } - if (popularTv) { - for (const item of popularTv) { - const title = item.name ?? item.title; - if (title && title !== "Unknown Title") { - map.set(`tv:${item.id}`, { - title, - overview: item.overview, - poster_path: item.poster_path ?? undefined, - backdrop_path: item.backdrop_path ?? undefined, - vote_average: item.vote_average ?? 0, - first_air_date: item.first_air_date, - }); - } - } - } - return map; - }, [trendingMedia, popularTv]); - - // Prevent flashing: wait for trending/popularTv queries to settle if modal is opened - const isDataLoading = - isOpen && - (isLoadingTrending || isLoadingTv) && - (!trendingMedia || !popularTv); - - // Build combined candidate list giving 50/50 equal presentation to Watchlist & Discovery items - const candidateItems: PickItem[] = useMemo(() => { - const watchlistItems: PickItem[] = []; - const discoveryItems: PickItem[] = []; - const seenKeys = new Set(); - - const checkFilter = (id: string | number, mediaType: "movie" | "tv") => { - const key = `${mediaType}:${id}`; - const state = mediaStateMap.get(key); - if (state?.progressStatus === "done") return { exclude: true }; - if (state?.reaction === "not-for-me") return { exclude: true }; - return { - exclude: false, - isCurrentlyWatching: state?.progressStatus === "watching", - watchProgress: state?.progress ?? 0, - }; - }; - - // 1. Collect Watchlist items - if (watchlist && watchlist.length > 0) { - for (const item of watchlist) { - const key = `${item.type}:${item.external_id}`; - if (!seenKeys.has(key)) { - const filterResult = checkFilter(item.external_id, item.type); - if (filterResult.exclude) continue; - - const tmdbInfo = tmdbInfoMap.get(key); - const rawTitle = item.title?.trim(); - const validTitle = - rawTitle && rawTitle !== "Unknown Title" - ? rawTitle - : tmdbInfo?.title; - - seenKeys.add(key); - watchlistItems.push({ - id: Number(item.external_id), - title: validTitle || "Saved Item", - overview: item.overview || tmdbInfo?.overview, - vote_average: item.rating || tmdbInfo?.vote_average || 0, - poster_path: item.image || tmdbInfo?.poster_path, - backdrop_path: tmdbInfo?.backdrop_path, - media_type: item.type, - release_date: item.release_date || tmdbInfo?.release_date, - first_air_date: tmdbInfo?.first_air_date, - isFromWatchlist: true, - isCurrentlyWatching: filterResult.isCurrentlyWatching, - watchProgress: filterResult.watchProgress, - }); - } - } - } - - // 2. Collect Discovery Media (Trending & Popular TV) - if (trendingMedia) { - for (const item of trendingMedia) { - const title = item.title ?? item.name; - const media_type = - (item.media_type as "movie" | "tv") ?? (item.name ? "tv" : "movie"); - const key = `${media_type}:${item.id}`; - if ( - !seenKeys.has(key) && - title && - title !== "Unknown Title" && - item.overview && - item.vote_average >= 6.0 - ) { - const filterResult = checkFilter(item.id, media_type); - if (filterResult.exclude) continue; - - seenKeys.add(key); - discoveryItems.push({ - id: item.id, - title, - overview: item.overview, - vote_average: item.vote_average, - poster_path: item.poster_path ?? undefined, - backdrop_path: item.backdrop_path ?? undefined, - media_type, - release_date: item.release_date, - first_air_date: item.first_air_date, - isFromWatchlist: false, - isCurrentlyWatching: filterResult.isCurrentlyWatching, - watchProgress: filterResult.watchProgress, - }); - } - } - } - - if (popularTv) { - for (const item of popularTv) { - const title = item.name ?? item.title; - const key = `tv:${item.id}`; - if ( - !seenKeys.has(key) && - title && - title !== "Unknown Title" && - item.overview && - item.vote_average >= 6.0 - ) { - const filterResult = checkFilter(item.id, "tv"); - if (filterResult.exclude) continue; - - seenKeys.add(key); - discoveryItems.push({ - id: item.id, - title, - overview: item.overview, - vote_average: item.vote_average, - poster_path: item.poster_path ?? undefined, - backdrop_path: item.backdrop_path ?? undefined, - media_type: "tv", - first_air_date: item.first_air_date, - isFromWatchlist: false, - isCurrentlyWatching: filterResult.isCurrentlyWatching, - watchProgress: filterResult.watchProgress, - }); - } - } - } - - // Interleave 1 Watchlist item for every 1 Discovery item (50/50 balance) - const blended: PickItem[] = []; - let wIdx = 0; - let dIdx = 0; - - while (wIdx < watchlistItems.length || dIdx < discoveryItems.length) { - if (wIdx < watchlistItems.length) { - blended.push(watchlistItems[wIdx++]); - } - if (dIdx < discoveryItems.length) { - blended.push(discoveryItems[dIdx++]); - } - } - - return blended; - }, [watchlist, trendingMedia, popularTv, mediaStateMap, tmdbInfoMap]); - - const itemsCount = candidateItems.length; - - const selectedIndex = useMemo(() => { - if (itemsCount === 0) return 0; - // Prefer the tracked pick so list reorders (e.g. watchlist toggles) - // don't swap the currently displayed tile. - if (selectedKey) { - const stableIndex = candidateItems.findIndex( - (item) => getPickKey(item) === selectedKey, - ); - if (stableIndex !== -1) return stableIndex; - } - return getTodaySeedIndex(itemsCount); - }, [candidateItems, itemsCount, selectedKey]); - - const selectedItem: PickItem | null = useMemo(() => { - if (itemsCount === 0) return null; - return candidateItems[selectedIndex] ?? candidateItems[0]; - }, [candidateItems, selectedIndex, itemsCount]); - - // Sync the tracked key with whichever item is actually shown so the seed / - // shuffle selection stays stable across `candidateItems` reorders. - useEffect(() => { - if (!selectedItem) return; - const key = getPickKey(selectedItem); - if (key !== selectedKey) { - setSelectedKey(key); - } - }, [selectedItem, selectedKey]); - - const handleShuffle = () => { - if (itemsCount <= 1) return; - const currentKey = selectedItem ? getPickKey(selectedItem) : null; - let nextIdx = Math.floor(Math.random() * itemsCount); - if (getPickKey(candidateItems[nextIdx]) === currentKey) { - nextIdx = (nextIdx + 1) % itemsCount; - } - const next = candidateItems[nextIdx]; - if (next) { - setSelectedKey(getPickKey(next)); - } - }; - - const handleDislike = () => { - if (!selectedItem) return; - setReaction( - String(selectedItem.id), - selectedItem.media_type, - "not-for-me", - { - title: selectedItem.title, - image: selectedItem.poster_path, - rating: selectedItem.vote_average, - release_date: selectedItem.release_date ?? selectedItem.first_air_date, - overview: selectedItem.overview, - }, - ); - handleShuffle(); - }; - - const { data: selectedDetails } = useQuery({ - queryKey: [ - "daily-pick-details", - selectedItem?.media_type, - selectedItem?.id, - ], - queryFn: async () => { - if (!selectedItem) return null; - if (selectedItem.media_type === "movie") { - return getMovieDetails({ id: selectedItem.id }); - } - return getTvDetails({ id: selectedItem.id }); - }, - enabled: !!selectedItem && !selectedItem.backdrop_path && isOpen, - staleTime: 1000 * 60 * 60, - }); - - const effectiveBackdropPath = - selectedItem?.backdrop_path || selectedDetails?.backdrop_path; - const effectivePosterPath = - selectedItem?.poster_path || selectedDetails?.poster_path; - - const title = selectedItem?.title ?? "Daily Pick"; - const mediaType = selectedItem?.media_type ?? "movie"; - const formattedTitle = - title && title !== "Unknown Title" ? formatMediaTitle.encode(title) : ""; - const year = selectedItem?.release_date - ? new Date(selectedItem.release_date).getFullYear() - : selectedItem?.first_air_date - ? new Date(selectedItem.first_air_date).getFullYear() - : ""; - const rating = selectedItem?.vote_average ?? 0; - const backdropUrl = effectiveBackdropPath - ? `${IMAGE_PREFIX.HD_BACKDROP}${effectiveBackdropPath}` - : ""; - const posterUrl = effectivePosterPath - ? `${IMAGE_PREFIX.SD_POSTER}${effectivePosterPath}` - : ""; - - const targetPath = formattedTitle - ? `/${mediaType}/${selectedItem?.id}/${formattedTitle}` - : `/${mediaType}/${selectedItem?.id}`; + const pick = useDailyPick(isOpen); // Render placeholder while permissions load to prevent homepage layout shift if (isPermissionsLoading) { @@ -411,13 +35,16 @@ export function DailyPickButton() { disabled className="pressable opacity-70" > - + What to Watch Today ); } - if (!isVideoPlaybackEnabled) return null; + // Signed-in users need the video-player feature. Signed-out users get no + // RBAC features at all, but the pick is still useful to them (browse, + // shuffle, save locally), so keep the button visible. + if (!isVideoPlaybackEnabled && isSignedIn) return null; return ( { setIsOpen(open); if (!open) { - setSelectedKey(null); + pick.setSelectedKey(null); } }} > @@ -433,16 +60,8 @@ export function DailyPickButton() { + + + +
+ + {/* Secondary action grid */} +
+ + + - - ) : ( +
+ + ) : ( + /* 3 buttons inline when playback is disabled (e.g. signed out) */ +
+ + - )} - - -
- - {/* Secondary action grid */} -
- - -
+ +
+ )} diff --git a/src/components/default-loader.tsx b/src/components/default-loader.tsx index 8fd91706..062c8a4a 100644 --- a/src/components/default-loader.tsx +++ b/src/components/default-loader.tsx @@ -7,7 +7,7 @@ export function DefaultLoader(props: React.ComponentProps<"output">) { aria-label="Loading content" aria-busy="true" className={cn( - "grid min-h-[calc(100dvh-var(--navbar-height,4rem)-var(--mobile-nav-height,4.75rem))] md:min-h-[calc(100dvh-5rem)] min-w-[320px] w-full animate-fade-in place-items-center py-8", + "grid min-h-[100dvh] md:min-h-[calc(100dvh-5rem)] min-w-[320px] w-full animate-fade-in place-items-center py-8", props.className, )} {...props} diff --git a/src/components/homepage-media.tsx b/src/components/homepage-media.tsx index b05e1026..61276551 100644 --- a/src/components/homepage-media.tsx +++ b/src/components/homepage-media.tsx @@ -3,13 +3,17 @@ import { useQueries, useQuery } from "@tanstack/react-query"; import { memo } from "react"; import { MediaCard } from "@/components/media-card"; import { ScrollContainer } from "@/components/scroll-container"; -import { useContinueWatching } from "@/hooks/use-watch-progress"; +import { useContinueWatching } from "@/hooks/watch-progress/use-watch-progress"; import { getBasicMovieDetails, getBasicTvDetails, getMedia, } from "@/lib/queries"; -import type { BasicMovie, BasicTv, MediaListResultsEntity } from "@/types"; +import type { + BasicMovie, + BasicTv, + MediaListResultsEntity, +} from "@/lib/tmdb-schemas"; interface MediaListProps extends MediaListResultsEntity { is_on_watchlist_page?: boolean; diff --git a/src/components/homepage-recommendations.tsx b/src/components/homepage-recommendations.tsx index ee6b8ad4..1579e0f7 100644 --- a/src/components/homepage-recommendations.tsx +++ b/src/components/homepage-recommendations.tsx @@ -1,9 +1,5 @@ import { useUser } from "@clerk/react"; -import { - useAction, - useQuery as useConvexQuery, - useMutation, -} from "convex/react"; +import { keepPreviousData, useQuery } from "@tanstack/react-query"; import { Sparkles, ThumbsDown, ThumbsUp } from "lucide-react"; import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { MediaCard, MediaCardSkeleton } from "@/components/media-card"; @@ -14,6 +10,7 @@ import { useAllMediaStates, useToggleWatchlistItem, } from "@/hooks/use-watchlist"; +import { queryKeys } from "@/lib/query/keys"; import { type AIRecommendation, titlesMatch, @@ -21,7 +18,14 @@ import { useTmdbSearchFallback, } from "@/lib/recommendation-engine"; import { cn } from "@/lib/utils"; -import { api } from "../../convex/_generated/api"; +import { + generateHomepageRecommendations, + getHomepageRecommendations, + getRecommendationFeedback, + removeRecommendationFeedback, + setRecommendationFeedback, +} from "@/server/fns/recommendations"; +import { unwrap } from "@/server/schema/common"; const getDismissKey = (rec: AIRecommendation) => `${rec.mediaType}:${rec.tmdbId ?? ""}:${rec.title}`; @@ -106,12 +110,12 @@ const HomepageRecommendationCard = memo( /> {/* Top-right solid action buttons overlay */} -
+
@@ -199,18 +226,19 @@ const BaseMediaCard = memo((props: BaseMediaCardProps) => {
); }); - const HorizontalCard = memo((props: MediaCardSpecificProps) => { const { title, image, media_type, release_date, relevanceScore } = props; const formattedTitle = formatMediaTitle.encode(title); const imageUrl = `${IMAGE_PREFIX.SD_POSTER}${image}`; + const blurSrc = image ? `${IMAGE_PREFIX.LQ_POSTER}${image}` : undefined; const year = release_date ? new Date(release_date).getFullYear() : ""; return ( { imageHeight={450} imageSizes="(max-width: 640px) 160px, (max-width: 768px) 176px, 192px" mediaTypeLabel={media_type === "movie" ? "Movie" : "TV"} - linkClassName="block h-full w-full outline-none ring-offset-background transition-[color,background-color,box-shadow,transform] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 pressable" + linkClassName="block h-full w-full outline-none ring-offset-background transition-[color,background-color,transform] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 pressable" actionsClassName="transition-[transform,opacity] duration-200 ease-out" >
@@ -226,15 +254,17 @@ const HorizontalCard = memo((props: MediaCardSpecificProps) => { text={title} className="text-sm font-bold leading-tight tracking-tight text-foreground transition-colors duration-200 group-hover:text-primary" /> -
- {year && {year}} +
+ {year && ( + {year} + )} {year && relevanceScore && ( • )} {relevanceScore && ( = 80 ? "text-emerald-600 dark:text-emerald-400" : relevanceScore >= 60 @@ -267,28 +297,33 @@ const VerticalCard = memo((props: MediaCardSpecificProps) => { const season = progress?.context?.season; const episode = progress?.context?.episode; - const { data: seasonDetails } = useQuery({ - queryKey: ["tv-season", id, season], - queryFn: () => getTvSeasonDetails({ tvId: id, seasonNumber: season ?? 1 }), - enabled: !!isTVContinueWatching && !!season, - }); + // Season details are routed through the shared batcher (see + // use-season-details.ts) so the N cards in a continue-watching strip + // coalesce their requests instead of firing N parallel fetches. + const { data: seasonDetails } = useSeasonDetails( + id, + isTVContinueWatching ? season : undefined, + ); const episodeDetail = seasonDetails?.episodes?.find( (ep) => ep.episode_number === episode, ); - let imageUrl = `${IMAGE_PREFIX.SD_BACKDROP}${image}`; + let blurSrc = image ? `${IMAGE_PREFIX.LQ_BACKDROP}${image}` : undefined; if (isTVContinueWatching) { if (episodeDetail?.still_path) { imageUrl = `${IMAGE_PREFIX.SD_BACKDROP}${episodeDetail.still_path}`; + blurSrc = `${IMAGE_PREFIX.LQ_BACKDROP}${episodeDetail.still_path}`; } else if (seasonDetails?.poster_path) { imageUrl = `${IMAGE_PREFIX.SD_POSTER}${seasonDetails.poster_path}`; + blurSrc = `${IMAGE_PREFIX.LQ_POSTER}${seasonDetails.poster_path}`; } } return ( { imageSizes="(max-width: 640px) 256px, (max-width: 768px) 288px, 320px" mediaTypeLabel={media_type === "movie" ? "Movie" : "TV Series"} linkClassName="block h-full w-full outline-none ring-offset-background transition-[transform,opacity] duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 pressable" - actionsClassName="transition-[color,background-color,box-shadow,transform] duration-300 ease-out" + actionsClassName="transition-[color,background-color,transform] duration-300 ease-out" >
{isTVContinueWatching && season && episode && (
- + S{season} E{episode} {episodeDetail?.name && ( @@ -321,7 +356,7 @@ const VerticalCard = memo((props: MediaCardSpecificProps) => { /> {!isTVContinueWatching && ( - + {year} )} @@ -329,10 +364,12 @@ const VerticalCard = memo((props: MediaCardSpecificProps) => { ); }); - const PersonCard = memo((props: PersonCardSpecificProps) => { const { id, name, profile_path, known_for_department, priority } = props; const imageUrl = `${IMAGE_PREFIX.SD_PROFILE}${profile_path}`; + const blurSrc = profile_path + ? `${IMAGE_PREFIX.LQ_PROFILE}${profile_path}` + : undefined; return ( { params={{ id: String(id) }} className="group relative block w-24 md:w-28 lg:w-32 outline-none ring-offset-background transition-[transform,opacity] duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 pressable " > -
+
{name} { text={name} className="w-full truncate text-sm font-bold leading-tight text-foreground group-hover:text-primary transition-colors duration-200" /> - + {known_for_department}
diff --git a/src/components/media/cast-section.tsx b/src/components/media/cast-section.tsx index 9e7d46eb..1be29670 100644 --- a/src/components/media/cast-section.tsx +++ b/src/components/media/cast-section.tsx @@ -39,9 +39,9 @@ export const CastSection = (props: {
- {cast.map((cast, index) => ( + {cast.map((cast) => ( ))} - {crew.map((crew, index) => ( + {crew.map((crew) => ( {