Commit Graph
104 Commits
Author SHA1 Message Date
Etienne Stalmans 914876070d fix: edgeFunctions test should not follow redirects (#35690)
Return the edge function response without following any redirects.
2025-05-15 12:50:16 +02:00
Jordi EnricandJoshen Lim 9e72050658 Add regex guard for edge functions test endpoint (#35688)
* Add regex guard for edge functions test endpoint

* Remove conosle log

* add tests

* empty

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-15 08:57:06 +00:00
Alaister Young 6c83f97478 fix: local api route fixes (#35642)
* fix: local api route fixes

* fix build

* fix tests

* address feedback

* remove unused debug
2025-05-14 15:26:50 +00:00
Joshen Lim bc4ca2e275 Remove unnecessary includeSystemSchemas, stay consistent with hosted (#35670)
* Remove unnecessary includeSystemSchemas, stay consistent with hosted

* Fix space

* Add error hanlding for function_name in trigger sheet

* Refactor
2025-05-14 22:35:23 +08:00
Joshen Lim 5e0629cc09 Fix local version popover version (#35375) 2025-04-30 18:06:20 +08:00
Ivan Vasilov 21f6f1bb16 fix: Disable the convertSqlToSupabaseJs AI tool (#35280)
* Disable the convertSqlToSupabaseJs tool because it relies on sql-to-rest which expects binaries of libpg-query.

* Comment out the code instead of deleting it.
2025-04-25 22:30:39 +07:00
Joshen Lim fd10704cc1 Make feature preview available + Fix up Connect UI for local self-host (#35060)
* Make feature preview available for local self-host

* Fix up Connect UI for local / self-host

* Fix

* Fix

* Fix
2025-04-16 19:35:09 +08:00
Kevin Grüneberg d05bbb669f perf: use subscription plan from org response (#34993) 2025-04-14 20:37:19 +08:00
Han QiaoandJoshen Lim 698e585a65 feat: fetch beta cli release version (#34923)
* feat: fetch beta cli release version

* Small refactors

* Fix

* Fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-04-14 16:20:03 +08:00
Joshen Lim ec7e80bbef Add studio version in header for local self host (#34018)
* Add studio version in header for local self host

* Fix

* Address feedback

* Fix

* Remove Docker Hub context, everything is CLI

* Update to use CLI version as the comparator instead of docker image version

* Fix
2025-04-08 18:06:48 +08:00
Joshen LimandAlaister Young 8239e2f27b Cache results in assistant panel (#34509)
* Cache results in assistant panel

* Small fixes

* fix

* disable switching chats while new messages are streaming in

* small comment

* Fix Create new snippet CTA in query block

* Add useCallbacks

* Update

* Remove console log

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-03-31 19:24:21 +08:00
143f49414b Feat/tabs (#31071)
* init

* Update inner-side-menu.mdx

* chore: update SQL sidebar to use ui pattern components

* mor

* Update

* Update index.tsx

* init: merge table editor and sql editor and schema visualization together

* more

* move to valtio

* fix issue with Command+B shortcut

* now shows in treeviews if item is opened in tab

* Update ProjectLayout.tsx

* fix sidebar

* fix schema selector for non explorer version

* show schema name in tabs

* added schema names to tabs

* tabs have been updated to support preview tabs

* fix URL issue

* add empty state stuff

* Update SQLEditorNav.tsx

* preview tab works now

* more tabs stuff. 'new' tab also added

* new tab concept

* updates

* fix type errors

* remove unused files

* update test

* move back button, fix width issues on sidebar

* update sidebar logic

* Update ProjectLayout.tsx

* lots of updates. layouts now streamlined. localstorage for tabs in use

* moar

* bunch of new tab logic

* fix empty tab issue

* Update tabs.ts

* layouts switched

* new pages now have fixed layouts

* fix tabs

* fix code bg

* add tabs support for multiple project refs

* intialization issue

* update ID handling

* fixed isOpened state for SQL snippets

* remove old assistant because its bugging up panels

* preview style works in sql editor

* fix border

* removes preview tab if there is one

* fix background of loading skeleton

* lots of issues with types/icons/redirect

* new tab cards

* snippets in empty state now work

* moar stuff

* tabs now in feature flags

* Update tabs.ts

* Update tabs.ts

* moar

* add feature previews

* remove code not needed

* Update next-env.d.ts

* Delete FeaturePreviewModal.tsx

* fix typescript errors. remove more explorer stuff

* remove explorer files

* fixed issues with templates and quickstarts tab

* fixed active state when tabs are not opted in

* logic error

* fix open/highlight issue when opted out of tabs

* templates/quickstarts now displayed with new cards

* Update recent-items.tsx

* Update new-tab.tsx

* add icon back in

* add old empty state back in

* recent items updated to respect project ref

* localstorage cleanup on deletion

* moar

* overflow tabs now working

* correct tab names used for new sql templates/quickstarts

* ongoing queries fix

* cleanup

* update images

* Update RouteValidationWrapper.tsx

* Update AppLayout.tsx

* Update NavigationBar.tsx

* add headers back into side panels

* improve writing

* tabs now drag and drop a billion times better

* Update tabs.tsx

* Update tabs.tsx

* init issues on stores, which caused a race condition.

* fix hydration error

* fix new tab issue in sql

* Update ProjectLayout.tsx

* Update pnpm-lock.yaml

* Update new-tab.tsx

* move EditorMenuListSkeleton

* Fix type issues

* fixes: DESIGN-87

fixes: DESIGN-87

* refactor sort/filter components

* Update rules-set-button-text.tsx

* remove discussions for now

* small styling fixes

* Update FeaturePreviewModal.tsx

* Update FeaturePreviewModal.tsx

* Update RouteValidationWrapper.tsx

* revert

* revert

* revert

* revert

* revert

* more revert

* Update collapse-button.tsx

* Update SQLEditorTreeViewItem.tsx

* revert

* Update SchemaGraph.tsx

* Delete new-upcoming.tsx

* revert

* Update ProjectLayout.tsx

* fix home link

* Update table-editor.spec.ts

* test update

* Update table-editor.spec.ts

* Fix the playwright tests.

* layout fixes

* layout fix

* revert sort/filter

* Update LastSignInWrapper.tsx

* revert

* revert

* remove

* update file names

* revert

* revert

* revert

* Fix TreeView console error props

* Add guards in SQL Editor to ensure that feature preview tabs changes do not affect existing UI when flag is off

* Fix missing DefaultLayout in SQL editor templates + fix New tab

* Remove console log

* Remove DatabaseSelector for SQL editor on local

* Fix SQL editor shared favorites for local

* Fix test

* Ensure NewTab doesn't show up if flag is not toggled for SQL editor

* Decouple UI state changes from content-query and entity-types-infinite-query

* Fix tab closing unnecessary rerouting

* Beef up feature previews

* Fix create new table from table editor new tab

* Fix tabs getting incorrectly reset when going between table and SQL editors

* Fix last visited SQL snippet for both tabs and not tabs

* Fix last visited table for table editor tabs

* Clear dashboard history when closing last tab

* Fix loading dashboard history

* Add comment to refactor stores

* Ensure we only save up to 8 items for recent items for each type

* Remove unneccesary logic in tabs

* Smol style fix for DeleteAccountButton

* Smol fix

* Fix inability to close New tab

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-03-27 17:46:57 +08:00
Saxon Fletcher 77dfe11248 Edit edge functions (#33727) 2025-03-26 19:54:12 +10:00
Kevin Grüneberg 2b94dd7430 feat: Dedicated Pooler rollout (#34240) 2025-03-21 14:46:58 +01:00
Joshen Lim 497ef6159b Just to trigger redeploy (#34326) 2025-03-21 21:19:16 +08:00
Kevin Grüneberg 5b7ffb586a chore: remove nano_enabled flag usage (#34286) 2025-03-19 18:54:57 +01:00
Joshen Lim 6f765da829 Fix openai api key empty state not showing in local (#34120) 2025-03-13 15:15:35 +01:00
Saxon FletcherandJoshen Lim 5508d2cd9d Test edge functions (#33728)
* 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

* single function layout

* invocation cleanup

* remove vars

* Clean up

* Spelling

* Clean up FormFieldWrappers

* One last clean up

* test edge function

* sheet flag

* remove prop

* fix merge errors

* fix merge errors

* update sheet

* rmeove import

* fix ts

* Some clean ups

* Fix

* Make test response area resizeable

* Final clean up

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-28 16:07:30 +08:00
Saxon FletcherandJoshen Lim 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
Saxon FletcherandJoshen Lim 28fe5811de Inline editor feature preview (#33541)
* add edge function knowledge

* deploy edge function mutaton

* add edge function block with deploy

* update function url

* update tools

* editor sql

* add templates

* use monaco editor

* hook up templates

* fixes

* add behind feature flag

* preview docs

* move editor

* initialPrompt

* consolidate widgets

* remove generic editor

* move logic

* fix ts

* include schema metadata

* Fix width of save snippet button

* Set tooltip position

* Use inlineLink component

* Remove unnecessary z index

* Lint

* Lint import statements in EditorPanel

* fixes

* fix keyboard shortcut

* show/hide results and invalidation

* fix focus issues in widget

* fixes

* fix ts

* Support cmd enter shortcut to run query in InlineEditor

* Update InlineEditorPreview to use admonition

* prompt updates

* add discussion url to preview

* schemas array

* One last clean up

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-19 14:58:58 +10:00
dff6c817ae Chore/assistant in self hosted (#33422)
* Add layoutheader to self-hosted to allow showing assistant

* Fix layout

* Remove debug checks

* Check for key

* Dont load tables

* Fix assistant error handling

* Yeet

* Update turbo.json

* Another one

* god

* Fix

* Add fallback

* last attempt to fix

* Clean up

* take the wheel

* Tiny fix

* Skip enrich query for local, to match prod

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-18 17:37:53 +08:00
f58b594ee8 Deploy edge function from Assistant (#33293)
* add edge function knowledge

* deploy edge function mutaton

* add edge function block with deploy

* update function url

* update tools

* Update apps/studio/pages/api/ai/sql/tools.ts

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

* edge function tool fixes

* copy

* prompt changes and verify jwt

* Very minor refactors

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
2025-02-07 14:11:23 +10:00
Greg Richardson 1106bfea32 fix: ai prompt to discourage security_invoker=on for table creations (#33207) 2025-01-30 17:08:15 -07:00
Ivan Vasilov 6f3c46f5da fix: Change the healthcheck route for docker Studio (#33180)
* Fix the healthcheck for the docker image for studio.

* Various fixes related to the self-hosted environment.
2025-01-30 00:31:52 +01:00
Joshen Lim c635d46b53 Add missing users delete endpoint for local/self-host (#32945)
* Add missing users delete endpoint for local/self-host

* Update
2025-01-22 16:22:45 +08:00
Ivan Vasilov b5437c630e feat: Add a banner for clock skew in studio (#32866)
* Add a ClockSkewBanner on top of studio.

* Fix the color of the RestrictionBanner.

* Add an API endpoint which return the current UTC time on the server.

* Fix the glob pattern for docs in turbo.json.

* Force docs to build.

* Revert unneeded changes.

* Add feature flag for clock skew banner.

* Add a comment.
2025-01-21 17:45:06 +01:00
9d534c9f5a fix: response error codes (#30581)
* fix: response error codes

* upgrade docs

* remove request url modification middleware

* move api routes for self-hosted to platform folder

* remove some lib/common/fetch usage

* docs: use middleware for openapi-fetch (#30600)

Get rid of the unauthedAllowedPost function (I don't think there's any harm in letting any requests that require authentication to just 403, they should be disabled at the React Query level and if not they will fail gracefully enough...)

* fix local count query

* add default values for clone mutation

* fix ts and codegen

* add missing lodash dep to playwright tests

* Fix the playwright tests to match the new folder structure for selfhosted variant.

* remove unused import

* Remove unused state

* remove unused sql debug mutation

* remove unused export

* fix notifications query

* fix jwt updating status

* fix typescript

* save sql snippet after renaming

* update codegen & fix ts error

* override array querySerializer

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-01-20 11:27:38 +08:00
d633ced97d Feat/new project creation experiment (#31237)
* some early ideas

* better approach

* fix globe stuff

* add initial step

* reset and submit button for chat

* cleanup

* remove www

* more clean up

* mobile and more cleanup

* fixes

* update advanced and security

* fix project checks

* connect form

* fix reset and tidied up other things

* add layout options

* a/b test

* add offset

* add ab test

* remove www packages

* remove www

* package

* update coordinates

* feat: create ProjectCreationInitialStepSubmittedEvent

* feat: add event for capturing intention of prompting

* fix: bring pnpm-lock up to date

* fix ts errors

* fix globe

* fix globe animation

* fix ts

* remove imports and tools

* update module resolution

* global redirect

* delay rendering

* Update apps/studio/pages/new/[slug].tsx

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

* take directly to v2 via project create dropdown

* move redirect to useEffect

* feat: distinguish events between initial and second step

* feat: emit an event when create project is clicked on new/v2

* fix: correct event type defs

* remove unused imports

* Various clean ups

* improvements

* Minor refactors

* clean up

* ts fixes

---------

Co-authored-by: Long Hoang <1732217+loong@users.noreply.github.com>
Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-01-17 09:59:21 +10:00
Joshen LimandAlaister Young c388cbe9d2 Add disk autoscale configuration parameters in compute and disk settings (#32628)
* Add disk autoscale configuration parameters in compute and disk settings

* TS fix

* Fix

* Fixes based on comments

* Address all feedbacks

* Small tweak

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-01-14 10:32:22 +08:00
Alaister Young 4577389177 chore: send feature flags for page events (#32590) 2025-01-13 13:08:50 +08:00
8b90d416ec Add inline completions to SQL Editor (#30706)
* monaco complete

* progress

* just add panel to sqleditor

* update panel and prompt

* adjust prompt

* clean up

* clean up and improve prompt

* update prompt

* refine prompt

* remove package

* use constants file

* revert v3 prompt

* combine diff action bars

* use widget

* refactor

* Some updates

* fix: useCompletion base path

* fix: typo on monaco action label

* feat: use entire selected line(s) for inline completions

* fix widget consistency

* widget styling

* Fix TS

* feat: lock llm model version

* fix enter key issue

* move complete endpoint

* update complete prompt

* remove file

* placeholder text

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
2024-12-17 15:02:06 +10:00
Joshen Lim 464f9aa5dd Chore/update rules in generate v3 (#31113)
* Add rules for RLS policies when using functions from auth schema

* Add rules to never expose auth.users through a public view

* Add rule for ensuring all tables have a PK

* Add rule to create a DB index when a foreign key is created

* Add rule to enable RLS on tables by default

* Add rule to use security invoker for views

* Add rules for materialized view, foreign table, and extensions
2024-12-13 17:15:11 +08:00
Saxon Fletcher 9f718e904f Feat/assistant scroll (#31042) 2024-12-11 07:00:29 +10:00
Saxon Fletcher ba372c349d Feat/assistant refinements 3 (#31015)
* limit local storage messages

* add tool for getting database functions

* reduce loading jitter in assistant
2024-12-09 17:02:39 +10:00
Bobbie Soedirgo f5c0a4c899 fix: only use MAINTAIN for table privileges if PG17+ (#30998)
* chore: use @supabase/pg-meta for table privileges queries

* fix: only use MAINTAIN for table privileges if PG17+

* chore: run prettier
2024-12-08 18:58:29 +01:00
Joshen Lim 7ca43d8919 Chore/fix error handling in generate v3 (#30913)
* Fix error handling in generate-v3 endpoint

* Lint
2024-12-05 15:40:23 +08:00
Saxon Fletcher a92e34d7a4 dont send current table or schema if not opted in (#30793) 2024-12-02 20:51:29 +08:00
Saxon Fletcher ccb26246f4 let the assistant decide when to run (#30789)
* let the assistant decide when to run

* remove log
2024-12-02 21:47:46 +10:00
Saxon FletcherandJoshen Lim fcfc1cf38f Assistant refinements (#30759)
* message enter

* auth prompt

* style changes to message

* header assistant button

* more auth prompt

* prompt

* prompt user refine

* iteration of read only

* Add basic tests for AIAssistant.utils

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-12-02 14:46:11 +08:00
Saxon FletcherandJoshen Lim 8c3da2ed95 More assistant refinements (#30730)
* ai refinements

* ui fixes

* space

* reduce dot height

* Fix prop type issue

* Assign allowHoverEffect to ai assistant button and panel

* Lint

* Some lints

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-29 20:31:02 +10:00
Saxon FletcherandJoshen Lim aea64c9a07 Assistant refinements (#30685)
* empty state refinements

* specify js conversion prompt

* placeholder state

* update dot color

* Lint

* ADjust padding

* Lint imports

* adjust prompt

* revert padding

* wrap line prop in code block

* fix margin

* use sql icon

* margin

* add chart prompt

* Add prevent default behaviour

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-28 16:37:54 +08:00
Saxon FletcherandJoshen Lim 2bcc17d514 Feat/assistant convert supabasejs (#30648)
* add ability to convert sql to js

* remove console

* Merge master + small style fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-27 09:56:46 +10:00
Saxon FletcherandJoshen Lim 72910fc30f Feat/assistant additions (#30647)
* show thinking if last message is empty

* sql toggle copy and border fix

* add table and schema context

* add suggestions for policy

* Add snippet content to ai assistant if on sql editor and assistant is open

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-26 20:17:54 +08:00
Joshen LimandSaxon Fletcher 12d92aed99 Assistant V2 (#30523)
* start

* added panels

* remove stuff

* fixes and refinements

* clean up

* remove old assistant panel

* resizable assistant kinda

* use icon

* Add missing package

* remove canvas

* add suggestions

* updated empty state if no tables exist

* fix table condition

* Implement diffing if using assistant in sql editor

* Reinstate old assistant in SQL editor if feature preview is off

* pane size adjustment

* assistant button corners

* Add SQL snippet content to assistant if opening assistant in sql editor

* Add the necessary checks for opt in and hipaa

* revert adding snippet to assistant when opening assistant in sql editor

* Add cmd i shortcut

* Add admonitions for when disablePrompt is toggled on, and if no api key is set. Add footer note RE rate limitation

* Bump ai package in packages

* some fixes for backwards compability depending on feature preview toggled

* Rename feature preview property for new assistant

* Smol fix

* Prevent SQL snippet from running until message is finished

* only loading last message

* fix z-index

* save chat state to global state

* add debug to failed ai queries

* Add basic contextual invalidation

* Add explain code action to SQL editor

* Add link to abort ongoing queries from SqlSnippet

* Update feature preview content

* Fix

* Fix

* Fix

* Te4st

* Fix tests

* ONly show ai button within a project

* Fix PH tracking

* Beef up a bit more event tracking

* Rough fix to padding when assistant is open

* A bit more telemetry stuff

* Update prompts

* fix rls editing via assistant

* Update generate-v3.ts

prompt to get auth schema too

* Add policy satement to assistant when editing

* Address all comments

* fixc

* Fix SqlSnippet not taking full width on larger viewports

* Adjust max width

---------

Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
2024-11-25 18:50:56 +08:00
Joshen Lim 55c4dffda7 Chore/update create and update user to use platform endpoints (#30379)
* Refactor create and update user to use platform endpoints

* Update perms

* Fix self host endpoints

* Fix
2024-11-13 09:19:37 +08:00
Terry SuttonandJoshen Lim 95219d3e2a Chore/cron nl (#30345)
* Add NL input

* Add chart to sidebar

* Better loading animation

* Redo api route to not use edge

* Remove edge stuff

* Allow sheet to close

* Cleanup

* Adjust loading state

* Add timezone

* CR comments

* Replace query with useCompletion

* Set the form value

* Tiny clean up

* Tinyyyyy tweaks

* Fix missing syntax

* Smol refactor

* Fixy

* Remove console log

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-12 11:55:01 -03:30
Joshen Lim 225d461381 Hook up RLS to new assistant if feature flag is enabled (#30357)
* Hook up RLS to new assistant if feature flag is enabled

* Reset conversation if opening a different entity

* Add prompt to use alter policy if policy definition is provided

* Remove console log
2024-11-08 18:03:30 +08:00
Alaister Young 12cc4e5fbc chore: use service versions endpoint (#30352)
* chore: use service versions endpoint

* update types

* fix types

* fallback postgres version for unknown images
2024-11-08 11:17:16 +08:00
Kevin Grüneberg e5c87ea560 chore: remove kpsVersion property (#30350)
KPS has long been removed and the property is never set for projects
2024-11-07 16:28:21 +08:00
Ivan VasilovandJoshen Lim f29003e0e7 fix: Use protocol property when building API url (#30332)
* Fix the types for API settings to include protocol.

* Use the protocol property in all usages of endpoints.

* Update

* Lint

* Revert changes to retrieving protocol

* Remove console.logs

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-06 22:22:24 +01:00