Commit Graph

18 Commits

Author SHA1 Message Date
Ivan Vasilov 308cd791a2 chore: Prep work for migrating to Tailwind v4 (#45285)
This PR preps the monorepo for a migration to Tailwind v4:
- Bump all Tailwind dependencies and libraries to the latest possible
version, while still compatible with Tailwind 3.
- Cleans up obsolete Tailwind 3 specific options and configs.
- Cleans up unused CSS files and fixes the CSS imports.
- Migrates all `important` uses in `@apply` lines to using the `!`
prefix.
- Move `typography.css` to the `config` package and import it from the
apps.
- Migrated all occurrences of `flex-grow`, `flex-shrink`,
`overflow-clip` and `overflow-ellipsis` since they're deprecated and
will be removed in Tailwind 4.
- Make the default theme object typesafe in the `ui` package.
- Migrate all `bg-opacity`, `border-opacity`, `ring-opacity` and
`divider-opacity` to the new format where they're declared as part of
the property color.
- Bump and unify all imports of `postcss` dependency.
2026-04-28 11:33:53 +02:00
Charis 4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Joshen Lim 434fd4687c Joshen/fe 2852 edge functions editor clips horizontal overflow on resize (#44063)
## Context

Edge functions code editor which uses the FileExplorerAndEditor
component doesn't resize when the viewport shrinks

This PR fixes that + also refactors the FileExplorerAndEditor a bit to
resolve the lint issue with `nodeRenderer` by refactoring the prop into
a renderer that uses `useCallback`
2026-03-24 15:59:00 +08:00
Kalleby Santos 997203cd64 feat(studio-local): functions management api - function blob artifacts (#42349)
## What kind of change does this PR introduce?

Feature

## What is the current behavior?

Functions page on self-hosted differs from Platform

## What is the new behavior?

> [!NOTE]  
> This PR only add readonly operations. Function edit and deploy should
be implemented in a future one.

Adds the possibility to download and see function code in Self-Host
version.

<details>

<img width="1465" height="944" alt="image"
src="https://github.com/user-attachments/assets/4bbf8f5c-3390-4de6-9e8b-8ec9cd59ebad"
/>

</details>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* API endpoint to stream function files/artifacts as
multipart/form-data.
* New function file entry type and server-side file listing for
functions.

* **Improvements**
  * Edge Functions "Code" navigation item always visible.
* Download popover reworked: ZIP download always available; CLI section
shown only on supported platforms.
* Editor set to read-only and file actions disabled on unsupported
environments.

* **Editor**
* Added JavaScript, TypeScript, and Markdown language modules for the
embedded editor.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2026-02-06 20:06:37 +00:00
Saxon Fletcher 0e60c5f341 Chore/connect sheet/button (#42367)
This is the first smaller PR in the broader change of updating our
Connect dialog (see
[here](https://github.com/supabase/supabase/pull/42276)).

This PR focuses on decoupling the ConnectButton our of the Connect
dialog and into its own component . The button includes a flag to render
the new sheet. The new sheet is empty for the time being as the flag is
at 0%.

To test:
- Enable flag and click button, see new Sheet
- Disable and see old dialog
- Create a new project -> in getting started section see "connect to
app" step -> Click connect button and make sure it works


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  - Added a Connect button component and an alternative Connect sheet.
  - Added curl syntax highlighting for code blocks.

* **Changes**
- Connection dialog moved to a controlled open-state pattern; Connect
replaced legacy entry points across the UI and can be feature-flagged.
- Connection actions simplified and no longer depend on framework
selection.

* **Removals**
- Removed legacy framework selector, default framework constant, and
related tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-02-04 11:53:32 +11:00
Joshen Lim f293036ec7 Add UX guardrails for edge functions RE unsaved and unimported files (#41921)
* Add UX guardrails for edge functions RE unsaved and unimported files

* useLatest on hasUnsavedChanges

* Remove checking of unimported files + add VS code like indicator for modified and unsaved files

* Nit

* Fix TS

* Fix

* nit

* Fixes

* Nit

* move hasUnsavedChanges on demand

* code rabbit nit

* code rabbit nit 2

* prettier

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
2026-01-22 13:31:28 +08:00
Lakshan Perera c3dfbc5956 feat: add support for dropping and auto-extracting zip files in Edge Functions editor (#41801)
* feat: add support for dropping and auto-extracting zip files in Edge Functions editor

* fix: add type assertions for readonly array includes checks in zip extraction

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: add support for PDF and image files in zip extraction

- Moved wasm from ALLOWED_EXTENSIONS to ALLOWED_BINARY_EXTENSIONS
- Added PDF support for document files
- Added common image formats: jpg, jpeg, png, gif, svg, bmp, ico, webp
- Binary files are extracted and preserved but show "Cannot Edit" message in editor

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: remove file extension validation from zip extraction

Makes zip extraction behavior consistent with regular file drops.
Now all file types are accepted in both cases, matching the
permissive behavior users expect.

Removed:
- ALLOWED_EXTENSIONS and ALLOWED_BINARY_EXTENSIONS arrays
- isAllowedExtension() and isAllowedBinaryFile() validation functions
- getFileExtension() helper (no longer needed)
- Extension-based rejection logic from extractZipFile()

Kept:
- File size validation (individual and total limits)
- Hidden file filtering (.DS_Store, __MACOSX, etc.)
- Binary file detection for proper content reading

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: correct file replacement detection in addDroppedFiles

Bug: The condition `updatedFiles !== files` always evaluated to true
because updatedFiles is created via files.map() which always returns
a new array reference, even when no files were actually modified.

This caused onFilesChange to be called unnecessarily when dropping
zip files that only contained files with names not matching any
existing files.

Fix: Track whether any existing files were actually replaced using
a hasReplacedFiles flag that is set to true only when we modify
files in the updatedFiles array during zip extraction.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: add graceful error handling for zip file extraction

Replaced dangerous non-null assertion operator (!) with proper error
handling for entry.getData() calls.

Changes:
- Check entry.directory and entry.getData before extraction
- Wrap getData calls in try-catch to handle extraction failures
- Track failed files and include them in error reporting
- Skip files that can't be extracted instead of crashing

This prevents runtime errors when:
- Zip entries are directories (defensive check)
- Zip entries don't have getData method (corrupted/unusual entries)
- File extraction fails for any reason (encoding issues, etc.)
- Binary/text file reading encounters errors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: improve file processing logic with enum and switch statement

Replaced if-else chain with cleaner enum-based approach per PR feedback.

Changes:
- Added FileAction enum (CREATE_NEW, REPLACE_EXISTING, REPLACE_NEW)
- Created getFileAction() helper function that returns action + index
- Refactored file processing loop to use switch statement
- Eliminated duplicate findIndex() calls (was calling it twice)
- Reduced variable count from 2 (existingFileIndex, newFileIndex) to 1 (actionResult)

Benefits:
- More readable and maintainable code
- Single source of truth for file lookup logic
- Better type safety with discriminated union
- Easier to extend with new file actions in the future

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* prettier

* fix: add guard for undefined entry.uncompressedSize in zip extraction

Prevents NaN from bypassing size validation when entry.uncompressedSize
is undefined.

Issue:
- entry.uncompressedSize can be undefined in malformed/corrupted zips
- Without guard: totalExtractedSize + undefined = NaN
- NaN comparisons always return false, bypassing MAX_TOTAL_EXTRACTED_SIZE
- Security risk: allows extraction of files with unknown sizes

Fix:
- Check if uncompressedSize is undefined or NaN before any arithmetic
- Skip files with unknown sizes and add to oversizedFiles array
- Provide descriptive error message: "unknown size - metadata unavailable"
- Ensures size validation always runs safely

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Refactor to streamline handling of regular and zip files in FileExplorerAndEditor

* Address rabbit feedback

* Nit

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-01-20 20:09:01 +08:00
Ivan Vasilov f346518fe3 [FE-2227] chore: Refactor the Deno libraries to be bundled loaded as dynamic ES modules (#41595)
* Load the TS lib files dynamically in the editor and set them on the Monaco instance only if the language is TS or JS.

* Change the AIEditor to use named export.

* Add catches for the dynamic loads.
2026-01-09 09:46:12 +01:00
Lakshan Perera 9cca04f1ec Fix Function editor file renaming annoynances (#40996)
* fix: don't allow duplicate file names

* fix: handle edit mode correctly

* Fix API codegen

* Add toasts

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-03 11:28:57 +08:00
Ali Waseem e42288156f Fix: overflow warnings were being cut off in the editor for edge functions (#40054)
added overflow warnings
2025-11-03 07:27:21 -07:00
Lakshan Perera 95eedb927e Updates to Edge Functions dashboard code editor (#39991)
* feat: use mgmt-api's function body endpoint

* skip json files from static patterns

* set the default content for deno.json

* feat: add drag and drop file support to FileExplorerAndEditor

- Add drag and drop functionality to accept files
- Dropped files are automatically read and added to the files list
- Visual feedback with drag overlay during drag operations
- Files maintain existing data format with id, name, content, and selected state
- Last dropped file is automatically selected for editing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add binary file handling to FileExplorerAndEditor

- Add binary file detection for common file extensions (.wasm, images, executables, etc.)
- Show "Cannot Edit Selected File" error message when trying to edit binary files
- Binary files dropped via drag-and-drop retain their original binary content
- Only show error in editor view, files remain accessible in file list
- Text files continue to work normally with full editing capabilities

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* do not ignore empty files

* exclude wasm files from static patterns

* Remove eszip parser test as dependency has been removed

* Fix TS issues

* Fix TS issues

* Fix pnpm-lock

* Fix

* Fix

* Nit

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-30 14:30:54 +08:00
Saxon Fletcher d60aceb562 Prompt and tool refactoring (#37500)
* try a really long context window to maximize caching

* update examples

* attempt to update packages and useChat

* update endpoints

* update zod

* zod

* update to v5

* message update

* Revert "zod"

This reverts commit ec39bac6b6.

* revert zod

* zod i

* fix complete endpoints

* remove async

* change to content

* type cleanup

* Revert the package bumps to rebuild them.

* Bump zod to 2.25.76 in all packages.

* Bump openai in all packages.

* Bump ai and ai-related packages.

* Remove unneeded files.

* Fix the rest of the migration stuff.

* Prettier fixes.

* add policy list tool

* refactor

* ai sdk 5 fixes

* refactor complete endpoint

* edge function prompt

* remove example

* slight prompt change

* Minor clean up

* More clean up

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-08 15:25:57 +07:00
Terry Sutton 4eccdc182a Fix EF editor font size (#35839) 2025-05-22 09:26:42 -02:30
Andrew Valleteau 31aad403de fix(studio): early fail query when x-connection-encrypted is invalid (#35331)
* fix(studio): early fail query when x-connection-encrypted is invalid

* fix(studio): uniformize readDatabase and projectDetails connString handling

* chore: update api types

* chore: add connectionString null option

* fix: only enforce x-connection-encrypted on platform

* chore: refactor connString check in a single point

* chore: fix guard logic

* chore: fix pgMetaGuard

* chore: fix types
2025-05-08 12:11:03 +02:00
Saxon Fletcher 61a18cdcb6 set default value if empty array (#34828) 2025-04-08 21:30:35 +10:00
Saxon Fletcher 77dfe11248 Edit edge functions (#33727) 2025-03-26 19:54:12 +10:00
Saxon Fletcher 593625c574 Edge functions empty state (#33802)
* page components

* page component changes

* settings but broken saving

* rvert

* use sheet for provider

* styling

* remove things

* Some refactoring and fixing, added JSDocs to layouts

* Smol refactor

* Fix

* Update JSDocs

* updated scaffolding

* update edge functions layout

* remove params

* Clean up

* Spelling

* Clean up FormFieldWrappers

* One last clean up

* create edge functon

* use component

* flag

* fix merge errors

* fix imports

* fix merge issues

* fix import

* fix flag

* remove unused

* simple empty

* empty state improvements

* move templates

* re-add flag

* use templates

* flag

* copy functions

* feature flag it

* Fix issues and clean up

* Smol fix

* Add comment

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-28 01:15:59 +08:00
Saxon Fletcher 1cefb95a73 Create edge function (#33726)
* page components

* page component changes

* settings but broken saving

* rvert

* use sheet for provider

* styling

* remove things

* Some refactoring and fixing, added JSDocs to layouts

* Smol refactor

* Fix

* Update JSDocs

* updated scaffolding

* update edge functions layout

* remove params

* Clean up

* Spelling

* Clean up FormFieldWrappers

* One last clean up

* create edge functon

* use component

* flag

* fix merge errors

* fix imports

* fix merge issues

* fix import

* fix flag

* remove unused

* move templates

* re-add flag

* Small refactors

* Smol refactors

* Refactor

* add rename and delete via context

* create function fixes

* moved function name

* Smol update

* Small fix for selected state in edge functions side menu when on /new

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-27 20:04:46 +08:00