The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Feat/db new login 2 (#19153)
Terry Sutton9af8f5cd54c7
diff --git a/apps/database-new/app/api/ai/sql/threads/create/route.ts b/apps/database-new/app/api/ai/sql/threads/create/route.tsindex cc6869aeff8..5ad61c37675 100644--- a/apps/database-new/app/api/ai/sql/threads/create/route.ts+++ b/apps/database-new/app/api/ai/sql/threads/create/route.ts@@ -1,13 +1,18 @@+import { cookies } from 'next/headers'+import { createClient } from '@/lib/supabase/server'import OpenAI from 'openai'const openai = new OpenAI()export async function POST(req: Request) {+ const cookieStore = cookies()+ const supabase = createClient(cookieStore)+if (!req.body) {return Response.error()}- const { prompt } = await req.json()+ const { prompt, userID } = await req.json()const thread = await openai.beta.threads.create()@@ -16,9 +21,36 @@ export async function POST(req: Request) {content: prompt,})- const run = await openai.beta.threads.runs.create(thread.id, {+ const createRun = await openai.beta.threads.runs.create(thread.id, {assistant_id: 'asst_oLWrK8lScZVNEpfjwUIvBAnq',})+ const [run, { data: messages }] = await Promise.all([+ openai.beta.threads.runs.retrieve(thread.id, createRun.id),+ openai.beta.threads.messages.list(thread.id),+ ])++ const threadTitle = messages+ .filter((m) => m.role === 'user' && m.content[0]?.type === 'text')+ .map((m) => {+ if (m.content[0]?.type === 'text') {+ return m.content[0]?.text?.value+ }+ return undefined+ })+ .find((text) => text !== undefined)++ try {+ const { error } = await supabase.from('threads').insert({+ thread_id: thread.id,+ run_id: run.id,+ user_id: userID,+ thread_title: threadTitle as string,+ })+ if (error) throw error+ } catch (error) {+ console.error(error)+ }+return Response.json({ threadId: thread.id, runId: run.id })}diff --git a/apps/database-new/app/auth/callback/route.ts b/apps/database-new/app/auth/callback/route.tsnew file mode 100644index 00000000000..9927c7a79a7--- /dev/null+++ b/apps/database-new/app/auth/callback/route.ts@@ -0,0 +1,20 @@+import { NextResponse } from 'next/server'+import { cookies } from 'next/headers'+import { createClient } from '@/lib/supabase/server'++export async function GET(request: Request) {+ // The `/auth/callback` route is required for the server-side auth flow implemented+ // by the Auth Helpers package. It exchanges an auth code for the user's session.+ // https://supabase.com/docs/guides/auth/auth-helpers/nextjs#managing-sign-in-with-code-exchange+ const requestUrl = new URL(request.url)+ const code = requestUrl.searchParams.get('code')++ if (code) {+ const cookieStore = cookies()+ const supabase = createClient(cookieStore)+ await supabase.auth.exchangeCodeForSession(code)+ }++ // URL to redirect to after sign in process completes+ return NextResponse.redirect(requestUrl.origin)+}diff --git a/apps/database-new/app/login/page.tsx b/apps/database-new/app/login/page.tsxnew file mode 100644index 00000000000..7e5551a48fb--- /dev/null+++ b/apps/database-new/app/login/page.tsx@@ -0,0 +1,56 @@+import Link from 'next/link'+import { headers, cookies } from 'next/headers'+import { redirect } from 'next/navigation'+import { createClient } from '@/lib/supabase/server'+import { ArrowLeft } from 'lucide-react'++export default function Login({ searchParams }: { searchParams: { message: string } }) {+ const signUp = async (formData: FormData) => {+ 'use server'++ const origin = headers().get('origin')+ const cookieStore = cookies()+ const supabase = createClient(cookieStore)++ const { data, error } = await supabase.auth.signInWithOAuth({+ provider: 'github',+ options: {+ redirectTo: `${origin}/auth/callback`,+ },+ })++ if (error) {+ console.log(error.message)+ return redirect(`/login?message=${error.message}`)+ } else {+ return redirect(data.url)+ }+ }++ return (+ <div className="flex-1 flex flex-col w-full px-8 sm:max-w-md justify-center gap-2 mx-auto mt-24">+ <Link+ href="/"+ className="absolute left-8 top-8 py-2 px-4 rounded-md no-underline text-foreground bg-btn-background hover:bg-btn-background-hover flex items-center gap-2 text-sm"+ >+ <ArrowLeft size={14} />+ Back+ </Link>++ <form+ className="animate-in flex-1 flex flex-col w-full justify-center gap-2 text-foreground"+ action={signUp}+ >+ <button className="border border-foreground/20 rounded-md px-4 py-2 text-foreground mb-2">+ Sign up with Github+ </button>++ {searchParams?.message && (+ <p className="mt-4 p-4 bg-foreground/10 text-foreground text-center">+ {searchParams.message}+ </p>+ )}+ </form>+ </div>+ )+}diff --git a/apps/database-new/app/new/page.tsx b/apps/database-new/app/new/page.tsxindex 95b8a95f88f..e6f6b915c67 100644--- a/apps/database-new/app/new/page.tsx+++ b/apps/database-new/app/new/page.tsx@@ -1,58 +1,20 @@-'use client'-import { useMutation } from '@tanstack/react-query'-import { Loader2 } from 'lucide-react'-import { useRouter } from 'next/navigation'+import ChatInput from '@/components/Chat/ChatInput'+import { createClient } from '@/lib/supabase/server'+import { cookies } from 'next/headers'-import { Input } from 'ui'+const NewThread = async () => {+ const cookieStore = cookies()+ const supabase = createClient(cookieStore)-export default function NewThread() {- const router = useRouter()-- const { mutate, isPending, isSuccess } = useMutation({- mutationFn: async (prompt: string) => {- const body = { prompt }- const response = await fetch('/api/ai/sql/threads/create', {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify(body),- })- const result = await response.json()- return result- },- onSuccess(data) {- const url = `/${data.threadId}/${data.runId}`- router.push(url)- },- })+ const {+ data: { user },+ } = await supabase.auth.getUser()return (<div className="h-full flex items-center justify-center w-full flex-col gap-y-4">- <div className="flex items-center gap-x-1.5 font-mono text-xl">- <span>database</span>- <div className="w-1.5 h-1.5 rounded-full bg-purple-900"></div>- <span>new</span>- </div>- <Input- autoFocus- size="xlarge"- className="w-11/12 max-w-xl shadow"- inputClassName="rounded-full"- placeholder="e.g Create a Telegram-like chat application"- disabled={isPending || isSuccess}- onKeyDown={(e) => {- if (e.code === 'Enter') {- const value = (e.target as any).value- if (value.length > 0) mutate(value)- }- }}- actions={- isPending || isSuccess ? (- <div className="mr-3">- <Loader2 size={18} className="animate-spin" />- </div>- ) : null- }- />+ <ChatInput userID={user?.id} /></div>)}++export default NewThreaddiff --git a/apps/database-new/app/profile/page--old.tsx b/apps/database-new/app/profile/page--old.tsxnew file mode 100644index 00000000000..38cc3daed3f--- /dev/null+++ b/apps/database-new/app/profile/page--old.tsx@@ -0,0 +1,100 @@+'use client'++import { useConversationsQuery } from '@/data/conversations-query'+import dayjs from 'dayjs'+import Link from 'next/link'+import { Button, IconChevronRight, Input } from 'ui'++export default function Profile() {+ const MOCK_PROFILE = {+ name: 'J-Dog',+ username: 'joshenlim',+ email: '[email protected]',+ avatar: 'https://i.pinimg.com/564x/d1/0d/89/d10d890537309f146f92f9af9d70cf83.jpg',+ }++ const { data, isLoading, isSuccess } = useConversationsQuery({ userId: '' })+ const conversations = data ?? []++ return (+ <div className="grid grid-cols-4 gap-x-8 py-12">+ <div className="col-span-1 flex flex-col gap-y-6">+ <div className="flex items-center gap-x-4">+ <div+ className="w-14 h-14 rounded-full border bg-no-repeat bg-center bg-cover"+ style={{ backgroundImage: `url('${MOCK_PROFILE.avatar}')` }}+ />+ <div className="flex flex-col">+ <p className="text-xl">{MOCK_PROFILE.name}</p>+ <p className="text-foreground-light">@{MOCK_PROFILE.username}</p>+ </div>+ </div>++ {/* [Joshen] If we want some form action here */}+ <div className="flex flex-col gap-y-2">+ <Input size="tiny" label="Name" value={MOCK_PROFILE.name} />+ <Input size="tiny" label="Username" value={MOCK_PROFILE.username} />+ <Input size="tiny" label="Email" value={MOCK_PROFILE.email} />+ </div>++ <div className="flex items-center justify-end gap-x-2">+ <Button type="default">Cancel</Button>+ <Button type="primary">Save changes</Button>+ </div>+ </div>++ <div className="col-span-3 flex flex-col gap-y-4">+ <p>Past conversations</p>++ <div className="w-full h-px border-t" />++ <div className="flex flex-col gap-y-3">+ {isLoading && (+ <div className="flex flex-col gap-y-3">+ <div className="rounded w-full shimmering-loader py-7" />+ <div className="rounded w-full shimmering-loader py-7" />+ </div>+ )}++ {!isLoading && conversations.length === 0 && (+ <div className="border rounded py-6 flex flex-col items-center justify-center gap-y-2">+ <p className="text-sm text-foreground-light">No conversations created yet</p>+ <Button type="default">+ <Link href="/new">Start a conversation</Link>+ </Button>+ </div>+ )}++ {isSuccess &&+ conversations.map((conversation) => {+ const hoursFromNow = dayjs().diff(dayjs(conversation.updatedAt), 'hours')+ const formattedTimeFromNow = dayjs(conversation.updatedAt).fromNow()+ const formattedUpdatedAt = dayjs(conversation.updatedAt).format('DD MMM YYYY, HH:mm')++ return (+ <Link+ key={conversation.id}+ href={`/${conversation.threadId}/${conversation.runId}`}+ >+ <div className="group flex items-center justify-between border rounded w-full px-4 py-2 transition bg-surface-100 hover:bg-surface-200">+ <div className="flex flex-col gap-y-1">+ <p className="text-sm">{conversation.name}</p>+ <p className="text-xs text-foreground-light">+ Last updated at{' '}+ {hoursFromNow > 6 ? `on ${formattedUpdatedAt}` : formattedTimeFromNow}+ </p>+ </div>+ <Button+ type="text"+ icon={<IconChevronRight size={16} strokeWidth={2} />}+ className="transition opacity-0 group-hover:opacity-100 px-1"+ />+ </div>+ </Link>+ )+ })}+ </div>+ </div>+ </div>+ )+}diff --git a/apps/database-new/app/profile/page.tsx b/apps/database-new/app/profile/page.tsxindex 38cc3daed3f..db62a7802d8 100644--- a/apps/database-new/app/profile/page.tsx+++ b/apps/database-new/app/profile/page.tsx@@ -1,46 +1,39 @@-'use client'--import { useConversationsQuery } from '@/data/conversations-query'import dayjs from 'dayjs'+import relativeTime from 'dayjs'+import { redirect } from 'next/navigation'+import { createClient } from '@/lib/supabase/server'+import { cookies } from 'next/headers'import Link from 'next/link'-import { Button, IconChevronRight, Input } from 'ui'+import { ChevronRight } from 'lucide-react'+import { timeAgo } from '@/lib/utils'++dayjs.extend(relativeTime)++const Profile = async () => {+ const cookieStore = cookies()+ const supabase = createClient(cookieStore)-export default function Profile() {- const MOCK_PROFILE = {- name: 'J-Dog',- username: 'joshenlim',- email: '[email protected]',- avatar: 'https://i.pinimg.com/564x/d1/0d/89/d10d890537309f146f92f9af9d70cf83.jpg',- }+ const {+ data: { user },+ } = await supabase.auth.getUser()- const { data, isLoading, isSuccess } = useConversationsQuery({ userId: '' })- const conversations = data ?? []+ if (!user) redirect('/')++ const { data: threads } = await supabase.from('threads').select().eq('user_id', user.id)return (<div className="grid grid-cols-4 gap-x-8 py-12"><div className="col-span-1 flex flex-col gap-y-6"><div className="flex items-center gap-x-4"><div- className="w-14 h-14 rounded-full border bg-no-repeat bg-center bg-cover"- style={{ backgroundImage: `url('${MOCK_PROFILE.avatar}')` }}+ className="border border-foreground-lighter rounded-full w-[30px] h-[30px] bg-no-repeat bg-center bg-cover"+ style={{ backgroundImage: `url('${user.user_metadata.avatar_url}')` }}/><div className="flex flex-col">- <p className="text-xl">{MOCK_PROFILE.name}</p>- <p className="text-foreground-light">@{MOCK_PROFILE.username}</p>+ <p className="text-xl">{user.user_metadata.full_name}</p>+ <p className="text-foreground-light">@{user.user_metadata.user_name}</p></div></div>-- {/* [Joshen] If we want some form action here */}- <div className="flex flex-col gap-y-2">- <Input size="tiny" label="Name" value={MOCK_PROFILE.name} />- <Input size="tiny" label="Username" value={MOCK_PROFILE.username} />- <Input size="tiny" label="Email" value={MOCK_PROFILE.email} />- </div>-- <div className="flex items-center justify-end gap-x-2">- <Button type="default">Cancel</Button>- <Button type="primary">Save changes</Button>- </div></div><div className="col-span-3 flex flex-col gap-y-4">@@ -49,52 +42,28 @@ export default function Profile() {<div className="w-full h-px border-t" /><div className="flex flex-col gap-y-3">- {isLoading && (- <div className="flex flex-col gap-y-3">- <div className="rounded w-full shimmering-loader py-7" />- <div className="rounded w-full shimmering-loader py-7" />- </div>- )}-- {!isLoading && conversations.length === 0 && (- <div className="border rounded py-6 flex flex-col items-center justify-center gap-y-2">- <p className="text-sm text-foreground-light">No conversations created yet</p>- <Button type="default">- <Link href="/new">Start a conversation</Link>- </Button>- </div>- )}-- {isSuccess &&- conversations.map((conversation) => {- const hoursFromNow = dayjs().diff(dayjs(conversation.updatedAt), 'hours')- const formattedTimeFromNow = dayjs(conversation.updatedAt).fromNow()- const formattedUpdatedAt = dayjs(conversation.updatedAt).format('DD MMM YYYY, HH:mm')+ {threads+ ? threads.map((thread) => {+ const formattedTimeAgo = timeAgo(thread.created_at)- return (- <Link- key={conversation.id}- href={`/${conversation.threadId}/${conversation.runId}`}- >- <div className="group flex items-center justify-between border rounded w-full px-4 py-2 transition bg-surface-100 hover:bg-surface-200">- <div className="flex flex-col gap-y-1">- <p className="text-sm">{conversation.name}</p>- <p className="text-xs text-foreground-light">- Last updated at{' '}- {hoursFromNow > 6 ? `on ${formattedUpdatedAt}` : formattedTimeFromNow}- </p>+ return (+ <Link key={thread.id} href={`/${thread.thread_id}/${thread.run_id}`}>+ <div className="group flex items-center justify-between border rounded w-full px-4 py-2 transition bg-surface-100 hover:bg-surface-200">+ <div className="flex flex-col gap-y-1">+ <p className="text-sm">{thread.thread_title}</p>+ <p className="text-xs text-foreground-light">+ Last updated {formattedTimeAgo}+ </p>+ </div>+ <ChevronRight size={16} strokeWidth={2} /></div>- <Button- type="text"- icon={<IconChevronRight size={16} strokeWidth={2} />}- className="transition opacity-0 group-hover:opacity-100 px-1"- />- </div>- </Link>- )- })}+ </Link>+ )+ })+ : 'no threads yet'}</div></div></div>)}+export default Profilediff --git a/apps/database-new/components/Chat/ChatInput.tsx b/apps/database-new/components/Chat/ChatInput.tsxnew file mode 100644index 00000000000..07d9aa3f7e0--- /dev/null+++ b/apps/database-new/components/Chat/ChatInput.tsx@@ -0,0 +1,64 @@+'use client'+import { useMutation } from '@tanstack/react-query'+import { Loader2 } from 'lucide-react'+import { useRouter } from 'next/navigation'++import { Input } from 'ui'++interface ChatInputParams {+ userID: string | undefined+}++const ChatInput = ({ userID }: ChatInputParams) => {+ const router = useRouter()+ const { mutate, isPending, isSuccess } = useMutation({+ mutationFn: async (prompt: string) => {+ const body = { prompt, userID } // Include userID in the body object++ const response = await fetch('/api/ai/sql/threads/create', {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify(body),+ })+ const result = await response.json()+ return result+ },+ onSuccess(data) {+ const url = `/${data.threadId}/${data.runId}`+ router.push(url)+ },+ })++ return (+ <>+ <div className="flex items-center gap-x-1.5 font-mono text-xl">+ <span>database</span>+ <div className="w-1.5 h-1.5 rounded-full bg-purple-900"></div>+ <span>new</span>+ </div>+ <Input+ autoFocus+ size="xlarge"+ className="w-11/12 max-w-xl shadow"+ inputClassName="rounded-full"+ placeholder="e.g Create a Telegram-like chat application"+ disabled={isPending || isSuccess}+ onKeyDown={(e) => {+ if (e.code === 'Enter') {+ const value = (e.target as any).value+ if (value.length > 0) mutate(value)+ }+ }}+ actions={+ isPending || isSuccess ? (+ <div className="mr-3">+ <Loader2 size={18} className="animate-spin" />+ </div>+ ) : null+ }+ />+ </>+ )+}++export default ChatInputdiff --git a/apps/database-new/components/Header--old.tsx b/apps/database-new/components/Header--old.tsxnew file mode 100644index 00000000000..58070e53a15--- /dev/null+++ b/apps/database-new/components/Header--old.tsx@@ -0,0 +1,144 @@+/* eslint-disable @next/next/no-img-element */+'use client'++import { LogIn, LogOut, Moon, Sun } from 'lucide-react'+import { useTheme } from 'next-themes'+import Link from 'next/link'+import { useParams } from 'next/navigation'+import { useEffect, useState } from 'react'+import {+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ IconUser,+} from 'ui'++import { useMessagesQuery } from '@/data/messages-query'+import { useAppStateSnapshot } from '@/lib/state'+import { UserMessage } from '@/lib/types'+import { Separator } from '@ui/components/Modal/Modal'++const Header = () => {+ const snap = useAppStateSnapshot()+ const { threadId, runId, messageId }: { threadId: string; runId: string; messageId: string } =+ useParams()+ const [mounted, setMounted] = useState(false)+ const { setTheme, resolvedTheme } = useTheme()++ const isConversation = threadId !== undefined && runId !== undefined++ useEffect(() => {+ setMounted(true)+ }, [])++ const { data } = useMessagesQuery({ threadId, runId, enabled: isConversation })+ const selectedMessage = data?.messages.find((m) => m.id === messageId) as UserMessage++ // [Joshen] Fetch user profile here+ const isLoggedIn = true+ const MOCK_PROFILE = {+ name: 'J-Dog',+ username: 'joshenlim',+ email: '[email protected]',+ avatar: 'https://i.pinimg.com/564x/d1/0d/89/d10d890537309f146f92f9af9d70cf83.jpg',+ }++ return (+ <nav+ role="navigation"+ className="bg-background border flex items-center justify-between px-4 min-h-[50px]"+ >+ <div className="flex items-center gap-x-4">+ <div className="flex items-center gap-x-1.5 font-mono">+ <span>database</span>+ <div className="w-1.5 h-1.5 rounded-full bg-purple-900"></div>+ <span>new</span>+ </div>+ {selectedMessage !== undefined && (+ <p title={selectedMessage.text} className="truncate border-l text-sm px-4">+ {selectedMessage.text}+ </p>+ )}+ </div>+ <div className="flex items-center gap-x-2">+ {isConversation && (+ <>+ (+ <Button type="default" onClick={() => snap.setHideCode(!snap.hideCode)}>+ {snap.hideCode ? 'Show code' : 'Hide code'}+ </Button>+ <div className="border-r py-3" />)+ </>+ )}++ <Button type="default">+ <Link href="/new">New conversation</Link>+ </Button>+ <Button type="default">+ <Link href="/login">Login</Link>+ </Button>++ <Button+ type="outline"+ className="px-1"+ icon={mounted && resolvedTheme === 'dark' ? <Moon size={16} /> : <Sun size={16} />}+ onClick={() => (resolvedTheme === 'dark' ? setTheme('light') : setTheme('dark'))}+ />++ <DropdownMenu>+ <DropdownMenuTrigger asChild className="flex">+ {isLoggedIn ? (+ <button+ className="border border-foreground-lighter rounded-full w-[30px] h-[30px] bg-no-repeat bg-center bg-cover"+ style={{ backgroundImage: `url('${MOCK_PROFILE.avatar}')` }}+ />+ ) : (+ <Button type="outline" className="p-1.5 rounded-full" icon={<IconUser size={16} />} />+ )}+ </DropdownMenuTrigger>+ <DropdownMenuContent side="bottom" align="end" className="w-48">+ {isLoggedIn ? (+ <>+ <div className="px-2 py-2">+ <p className="text-xs text-foreground">{MOCK_PROFILE.name}</p>+ <p className="text-xs text-foreground-light">{MOCK_PROFILE.email}</p>+ </div>+ <Link href="/profile">+ <DropdownMenuItem className="space-x-2" onClick={() => {}}>+ <IconUser size={14} />+ <p>Profile</p>+ </DropdownMenuItem>+ </Link>+ <Separator />+ <a href="https://supabase.com" target="_blank" rel="noreferrer">+ <DropdownMenuItem className="space-x-2">+ <img alt="supabase" src="/supabase.png" className="w-[14px]" />+ <p>Supabase</p>+ </DropdownMenuItem>+ </a>+ <DropdownMenuItem className="space-x-2" onClick={() => {}}>+ <LogOut size={14} />+ <p>Sign out</p>+ </DropdownMenuItem>+ </>+ ) : (+ <div className="flex flex-col gap-y-2 p-2">+ <div className="text-xs">+ Sign in to <span className="text-foreground">database.new</span> to save your+ conversations!+ </div>+ <Button type="default" icon={<LogIn size={14} />}>+ Sign in+ </Button>+ </div>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </nav>+ )+}++export default Headerdiff --git a/apps/database-new/components/Header.tsx b/apps/database-new/components/Header.tsxindex 05b9cf40118..c06d9907b45 100644--- a/apps/database-new/components/Header.tsx+++ b/apps/database-new/components/Header.tsx@@ -1,49 +1,16 @@-/* eslint-disable @next/next/no-img-element */-'use client'--import { LogIn, LogOut, Moon, Sun } from 'lucide-react'-import { useTheme } from 'next-themes'+import HeaderActions from './Header/HeaderActions'+import { createClient } from '@/lib/supabase/server'+import { cookies } from 'next/headers'+import CurrentThreadName from './Header/CurrentThreadName'import Link from 'next/link'-import { useParams } from 'next/navigation'-import { useEffect, useState } from 'react'-import {- Button,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- IconUser,-} from 'ui'--import { useMessagesQuery } from '@/data/messages-query'-import { useAppStateSnapshot } from '@/lib/state'-import { UserMessage } from '@/lib/types'-import { Separator } from '@ui/components/Modal/Modal'--const Header = () => {- const snap = useAppStateSnapshot()- const { threadId, runId, messageId }: { threadId: string; runId: string; messageId: string } =- useParams()- const [mounted, setMounted] = useState(false)- const { setTheme, resolvedTheme } = useTheme()-- const isConversation = threadId !== undefined && runId !== undefined- useEffect(() => {- setMounted(true)- }, [])+const Header = async () => {+ const cookieStore = cookies()+ const supabase = createClient(cookieStore)- const { data } = useMessagesQuery({ threadId, runId, enabled: isConversation })- const selectedMessage = data?.messages.find((m) => m.id === messageId) as UserMessage-- // [Joshen] Fetch user profile here- const isLoggedIn = true- const MOCK_PROFILE = {- name: 'J-Dog',- username: 'joshenlim',- email: '[email protected]',- avatar: 'https://i.pinimg.com/564x/d1/0d/89/d10d890537309f146f92f9af9d70cf83.jpg',- }+ const {+ data: { user },+ } = await supabase.auth.getUser()return (<nav@@ -51,89 +18,17 @@ const Header = () => {className="bg-background border flex items-center justify-between px-4 min-h-[50px]"><div className="flex items-center gap-x-4">- <div className="flex items-center gap-x-1.5 font-mono">- <span>database</span>- <div className="w-1.5 h-1.5 rounded-full bg-purple-900"></div>- <span>new</span>- </div>- {selectedMessage !== undefined && (- <p title={selectedMessage.text} className="truncate border-l text-sm px-4">- {selectedMessage.text}- </p>- )}+ <Link href="/">+ <div className="flex items-center gap-x-1.5 font-mono">+ <span>database</span>+ <div className="w-1.5 h-1.5 rounded-full bg-purple-900"></div>+ <span>new</span>+ </div>+ </Link>+ <CurrentThreadName /></div>- <div className="flex items-center gap-x-2">- {isConversation && (- <>- (- <Button type="default" onClick={() => snap.setHideCode(!snap.hideCode)}>- {snap.hideCode ? 'Show code' : 'Hide code'}- </Button>- <div className="border-r py-3" />)- </>- )}-- <Button type="default">- <Link href="/new">New conversation</Link>- </Button>- <Button- type="outline"- className="px-1"- icon={mounted && resolvedTheme === 'dark' ? <Moon size={16} /> : <Sun size={16} />}- onClick={() => (resolvedTheme === 'dark' ? setTheme('light') : setTheme('dark'))}- />-- <DropdownMenu>- <DropdownMenuTrigger asChild className="flex">- {isLoggedIn ? (- <button- className="border border-foreground-lighter rounded-full w-[30px] h-[30px] bg-no-repeat bg-center bg-cover"- style={{ backgroundImage: `url('${MOCK_PROFILE.avatar}')` }}- />- ) : (- <Button type="outline" className="p-1.5 rounded-full" icon={<IconUser size={16} />} />- )}- </DropdownMenuTrigger>- <DropdownMenuContent side="bottom" align="end" className="w-48">- {isLoggedIn ? (- <>- <div className="px-2 py-2">- <p className="text-xs text-foreground">{MOCK_PROFILE.name}</p>- <p className="text-xs text-foreground-light">{MOCK_PROFILE.email}</p>- </div>- <Link href="/profile">- <DropdownMenuItem className="space-x-2" onClick={() => {}}>- <IconUser size={14} />- <p>Profile</p>- </DropdownMenuItem>- </Link>- <Separator />- <a href="https://supabase.com" target="_blank" rel="noreferrer">- <DropdownMenuItem className="space-x-2">- <img alt="supabase" src="/supabase.png" className="w-[14px]" />- <p>Supabase</p>- </DropdownMenuItem>- </a>- <DropdownMenuItem className="space-x-2" onClick={() => {}}>- <LogOut size={14} />- <p>Sign out</p>- </DropdownMenuItem>- </>- ) : (- <div className="flex flex-col gap-y-2 p-2">- <div className="text-xs">- Sign in to <span className="text-foreground">database.new</span> to save your- conversations!- </div>- <Button type="default" icon={<LogIn size={14} />}>- Sign in- </Button>- </div>- )}- </DropdownMenuContent>- </DropdownMenu>- </div>+ <HeaderActions user={user} /></nav>)}diff --git a/apps/database-new/components/Header/AvatarDropdown.tsx b/apps/database-new/components/Header/AvatarDropdown.tsxnew file mode 100644index 00000000000..39aea6e887b--- /dev/null+++ b/apps/database-new/components/Header/AvatarDropdown.tsx@@ -0,0 +1,73 @@+'use client'+import { LogIn, LogOut } from 'lucide-react'+import { User } from '@supabase/supabase-js'+import Link from 'next/link'+import Image from 'next/image'+import {+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ IconUser,+ Separator,+} from 'ui'++interface AvatarDropdownProps {+ currentUser: User | null+ signout: () => void+}++export default function AvatarDropdown({ currentUser, signout }: AvatarDropdownProps) {+ return (+ <DropdownMenu>+ <DropdownMenuTrigger asChild className="flex">+ {currentUser ? (+ <button+ className="border border-foreground-lighter rounded-full w-[30px] h-[30px] bg-no-repeat bg-center bg-cover"+ style={{ backgroundImage: `url('${currentUser.user_metadata.avatar_url}')` }}+ />+ ) : (+ <Button type="outline" className="p-1.5 rounded-full" icon={<IconUser size={16} />} />+ )}+ </DropdownMenuTrigger>+ <DropdownMenuContent side="bottom" align="end" className="w-48">+ {currentUser ? (+ <>+ <div className="px-2 py-2">+ <p className="text-xs text-foreground">{currentUser.user_metadata.full_name}</p>+ <p className="text-xs text-foreground-light">{currentUser.user_metadata.email}</p>+ </div>+ <Link href="/profile">+ <DropdownMenuItem className="space-x-2" onClick={() => {}}>+ <IconUser size={14} />+ <p>Profile</p>+ </DropdownMenuItem>+ </Link>+ <Separator />+ <a href="https://supabase.com" target="_blank" rel="noreferrer">+ <DropdownMenuItem className="space-x-2">+ <Image alt="supabase" src="/supabase.png" width={14} height={14} />+ <p>Supabase</p>+ </DropdownMenuItem>+ </a>+ <DropdownMenuItem className="space-x-2" onClick={signout}>+ <LogOut size={14} />+ <p>Sign out</p>+ </DropdownMenuItem>+ </>+ ) : (+ <div className="flex flex-col gap-y-2 p-2">+ <div className="text-xs">+ Sign in to <span className="text-foreground">database.new</span> to save your+ conversations!+ </div>+ <Button type="default" icon={<LogIn size={14} />}>+ <Link href="/login">Sign in</Link>+ </Button>+ </div>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ )+}diff --git a/apps/database-new/components/Header/CurrentThreadName.tsx b/apps/database-new/components/Header/CurrentThreadName.tsxnew file mode 100644index 00000000000..fb5000bb479--- /dev/null+++ b/apps/database-new/components/Header/CurrentThreadName.tsx@@ -0,0 +1,27 @@+'use client'++import { useParams } from 'next/navigation'+import { useMessagesQuery } from '@/data/messages-query'+import { UserMessage } from '@/lib/types'++const CurrentThreadName = () => {+ const { threadId, runId, messageId }: { threadId: string; runId: string; messageId: string } =+ useParams()++ const isConversation = threadId !== undefined && runId !== undefined++ const { data } = useMessagesQuery({ threadId, runId, enabled: isConversation })+ const selectedMessage = data?.messages.find((m) => m.id === messageId) as UserMessage++ return (+ <div className="flex items-center gap-x-4">+ {selectedMessage !== undefined && (+ <p title={selectedMessage.text} className="truncate border-l text-sm px-4">+ {selectedMessage.text}+ </p>+ )}+ </div>+ )+}++export default CurrentThreadNamediff --git a/apps/database-new/components/Header/HeaderActions.tsx b/apps/database-new/components/Header/HeaderActions.tsxnew file mode 100644index 00000000000..3d8ccd57e9d--- /dev/null+++ b/apps/database-new/components/Header/HeaderActions.tsx@@ -0,0 +1,62 @@+'use client'+import { User } from '@supabase/supabase-js'+import { Button } from 'ui'+import ThemeSwitcherButton from './ThemeSwitcherButton'+import AvatarDropdown from './AvatarDropdown'+import Link from 'next/link'+import { useState } from 'react'+import { createClient } from '@/lib/supabase/client'+import { useRouter } from 'next/navigation'+import { useSelectedLayoutSegment } from 'next/navigation'+import { useAppStateSnapshot } from '@/lib/state'++interface HeaderActionsProps {+ user: User | null+}+const HeaderActions = ({ user }: HeaderActionsProps) => {+ const supabase = createClient()+ const router = useRouter()+ const segment = useSelectedLayoutSegment()+ const snap = useAppStateSnapshot()++ const [currentUser, setCurrentUser] = useState<User | null>(user)++ async function signout() {+ const { error } = await supabase.auth.signOut()+ if (error) {+ console.log('Error logging out:', error.message)+ return+ }++ router.push('/')+ setCurrentUser(null)+ }++ return (+ <div className="flex items-center gap-x-2">+ <Button type="default">+ <Link href="/new">New conversation</Link>+ </Button>+ {segment && segment.includes('thread') && (+ <>+ <Button type="default" onClick={() => snap.setHideCode(!snap.hideCode)}>+ {snap.hideCode ? 'Show code' : 'Hide code'}+ </Button>+ <div className="border-r py-3" />+ </>+ )}++ <ThemeSwitcherButton />++ {currentUser ? (+ <AvatarDropdown currentUser={currentUser} signout={signout} />+ ) : (+ <Button type="default">+ <Link href="/login">Login</Link>+ </Button>+ )}+ </div>+ )+}++export default HeaderActionsdiff --git a/apps/database-new/components/Header/ThemeSwitcherButton.tsx b/apps/database-new/components/Header/ThemeSwitcherButton.tsxnew file mode 100644index 00000000000..2ad85a3c706--- /dev/null+++ b/apps/database-new/components/Header/ThemeSwitcherButton.tsx@@ -0,0 +1,16 @@+'use client'+import { Button } from 'ui'+import { useTheme } from 'next-themes'+import { Moon, Sun } from 'lucide-react'++export default function ThemeSwitcherButton() {+ const { setTheme, resolvedTheme } = useTheme()+ return (+ <Button+ type="outline"+ className="px-1"+ icon={resolvedTheme === 'dark' ? <Moon size={16} /> : <Sun size={16} />}+ onClick={() => (resolvedTheme === 'dark' ? setTheme('light') : setTheme('dark'))}+ />+ )+}diff --git a/apps/database-new/lib/supabase/client.ts b/apps/database-new/lib/supabase/client.tsnew file mode 100644index 00000000000..b39d2aeb898--- /dev/null+++ b/apps/database-new/lib/supabase/client.ts@@ -0,0 +1,8 @@+import { Database } from '@/types/supabase'+import { createBrowserClient } from '@supabase/ssr'++export const createClient = () =>+ createBrowserClient<Database>(+ process.env.NEXT_PUBLIC_SUPABASE_URL!,+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!+ )diff --git a/apps/database-new/lib/supabase/server.ts b/apps/database-new/lib/supabase/server.tsnew file mode 100644index 00000000000..4d9ce96ea49--- /dev/null+++ b/apps/database-new/lib/supabase/server.ts@@ -0,0 +1,35 @@+import { Database } from '@/types/supabase'+import { createServerClient, type CookieOptions } from '@supabase/ssr'+import { cookies } from 'next/headers'++export const createClient = (cookieStore: ReturnType<typeof cookies>) => {+ return createServerClient<Database>(+ process.env.NEXT_PUBLIC_SUPABASE_URL!,+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,+ {+ cookies: {+ get(name: string) {+ return cookieStore.get(name)?.value+ },+ set(name: string, value: string, options: CookieOptions) {+ try {+ cookieStore.set({ name, value, ...options })+ } catch (error) {+ // The `set` method was called from a Server Component.+ // This can be ignored if you have middleware refreshing+ // user sessions.+ }+ },+ remove(name: string, options: CookieOptions) {+ try {+ cookieStore.set({ name, value: '', ...options })+ } catch (error) {+ // The `delete` method was called from a Server Component.+ // This can be ignored if you have middleware refreshing+ // user sessions.+ }+ },+ },+ }+ )+}diff --git a/apps/database-new/lib/utils.ts b/apps/database-new/lib/utils.tsindex 64747236f1b..6de712e0084 100644--- a/apps/database-new/lib/utils.ts+++ b/apps/database-new/lib/utils.ts@@ -3,6 +3,7 @@ import { compact } from 'lodash'import { z } from 'zod'import { PostgresColumn, PostgresTable } from './types'+import dayjs from 'dayjs'const constraintDefinitionSchema = z.object({Constraint: z.discriminatedUnion('contype', [@@ -224,3 +225,23 @@ export async function parseTables(sql: string) {return pgTables}++export function timeAgo(date: string) {+ const createdAt = dayjs(date)+ const currentTime = dayjs()+ const timeDifference = currentTime.diff(createdAt, 'seconds') // Time difference in seconds++ if (timeDifference < 60) {+ // Less than 1 minute+ return 'just now'+ } else if (timeDifference < 3600) {+ // Less than 1 hour+ return `${Math.floor(timeDifference / 60)} minutes ago`+ } else if (timeDifference < 86400) {+ // Less than 1 day (24 hours)+ return `${Math.floor(timeDifference / 3600)} hours ago`+ } else {+ // More than 1 day+ return createdAt.format('MMM DD, YYYY')+ }+}diff --git a/apps/database-new/next.config.js b/apps/database-new/next.config.jsindex 8937b9b402d..f45d966e2c4 100644--- a/apps/database-new/next.config.js+++ b/apps/database-new/next.config.js@@ -1,5 +1,8 @@/** @type {import('next').NextConfig} */const nextConfig = {+ experimental: {+ serverActions: true,+ },transpilePackages: ['ui'],webpack: (config, { dev, isServer, webpack, nextRuntime }) => {config.module.rules.push({diff --git a/apps/database-new/package.json b/apps/database-new/package.jsonindex a81aedda710..f8fccbdc856 100644--- a/apps/database-new/package.json+++ b/apps/database-new/package.json@@ -12,6 +12,7 @@"@dagrejs/dagre": "^1.0.4","@gregnr/libpg-query": "13.4.0-dev.12","@monaco-editor/react": "^4.6.0",+ "@supabase/ssr": "^0.0.10","@tanstack/react-query": "^5.7.2","common": "*","config": "*",diff --git a/apps/database-new/supabase/.gitignore b/apps/database-new/supabase/.gitignorenew file mode 100644index 00000000000..a3ad88055b7--- /dev/null+++ b/apps/database-new/supabase/.gitignore@@ -0,0 +1,4 @@+# Supabase+.branches+.temp+.envdiff --git a/apps/database-new/supabase/config.toml b/apps/database-new/supabase/config.tomlnew file mode 100644index 00000000000..649123adb3e--- /dev/null+++ b/apps/database-new/supabase/config.toml@@ -0,0 +1,134 @@+# A string used to distinguish different Supabase projects on the same host. Defaults to the+# working directory name when running `supabase init`.+project_id = "database-new"++[api]+enabled = true+# Port to use for the API URL.+port = 54321+# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API+# endpoints. public and storage are always included.+schemas = ["public", "storage", "graphql_public"]+# Extra schemas to add to the search_path of every request. public is always included.+extra_search_path = ["public", "extensions"]+# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size+# for accidental or malicious requests.+max_rows = 1000++[db]+# Port to use for the local database URL.+port = 54322+# Port used by db diff command to initialise the shadow database.+shadow_port = 54320+# The database major version to use. This has to be the same as your remote database's. Run `SHOW+# server_version;` on the remote database to check.+major_version = 15++[db.pooler]+enabled = false+# Port to use for the local connection pooler.+port = 54329+# Specifies when a server connection can be reused by other clients.+# Configure one of the supported pooler modes: `transaction`, `session`.+pool_mode = "transaction"+# How many server connections to allow per user/database pair.+default_pool_size = 20+# Maximum number of client connections allowed.+max_client_conn = 100++[realtime]+enabled = true+# Bind realtime via either IPv4 or IPv6. (default: IPv6)+# ip_version = "IPv6"++[studio]+enabled = true+# Port to use for Supabase Studio.+port = 54323+# External URL of the API server that frontend connects to.+api_url = "http://localhost"++# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they+# are monitored, and you can view the emails that would have been sent from the web interface.+[inbucket]+enabled = true+# Port to use for the email testing server web interface.+port = 54324+# Uncomment to expose additional ports for testing user applications that send emails.+# smtp_port = 54325+# pop3_port = 54326++[storage]+enabled = true+# The maximum file size allowed (e.g. "5MB", "500KB").+file_size_limit = "50MiB"++[auth]+enabled = true+# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used+# in emails.+site_url = "http://localhost:3002"+# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.+additional_redirect_urls = ["https://localhost:3002"]+# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).+jwt_expiry = 3600+# If disabled, the refresh token will never expire.+enable_refresh_token_rotation = true+# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.+# Requires enable_refresh_token_rotation = true.+refresh_token_reuse_interval = 10+# Allow/disallow new user signups to your project.+enable_signup = true++[auth.email]+# Allow/disallow new user signups via email to your project.+enable_signup = true+# If enabled, a user will be required to confirm any email change on both the old, and new email+# addresses. If disabled, only the new email is required to confirm.+double_confirm_changes = true+# If enabled, users need to confirm their email address before signing in.+enable_confirmations = false++# Uncomment to customize email template+# [auth.email.template.invite]+# subject = "You have been invited"+# content_path = "./supabase/templates/invite.html"++[auth.sms]+# Allow/disallow new user signups via SMS to your project.+enable_signup = true+# If enabled, users need to confirm their phone number before signing in.+enable_confirmations = false++# Use pre-defined map of phone number to OTP for testing.+[auth.sms.test_otp]+# 4152127777 = "123456"++# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.+[auth.sms.twilio]+enabled = false+account_sid = ""+message_service_sid = ""+# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:+auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"++# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,+# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `notion`, `twitch`,+# `twitter`, `slack`, `spotify`, `workos`, `zoom`.+[auth.external.github]+enabled = true+client_id = "env(GITHUB_CLIENT_ID)"+# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:+secret = "env(GITHUB_CLIENT_SECRET)"+# Overrides the Github Authorization callback URL. Leave this empty if you've set the url in the Github oath app.+redirect_uri = ""+# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,+# or any other third-party OIDC providers.+url = ""++[analytics]+enabled = false+port = 54327+vector_port = 54328+# Configure one of the supported backends: `postgres`, `bigquery`.+backend = "postgres"\ No newline at end of filediff --git a/apps/database-new/supabase/migrations/20231122191507_get_started.sql b/apps/database-new/supabase/migrations/20231122191507_get_started.sqlnew file mode 100644index 00000000000..f34d271efeb--- /dev/null+++ b/apps/database-new/supabase/migrations/20231122191507_get_started.sql@@ -0,0 +1,11 @@+create table if not exists public.threads (+ id bigint generated by default as identity,+ created_at timestamp with time zone not null default now(),+ modified_at timestamp with time zone not null default now(),+ thread_id text not null,+ run_id text not null,+ thread_title text not null,+ user_id uuid null,+ constraint threads_pkey primary key (id),+ constraint threads_user_id_fkey foreign key (user_id) references auth.users (id) on update cascade on delete cascade+)\ No newline at end of filediff --git a/apps/database-new/supabase/seed.sql b/apps/database-new/supabase/seed.sqlnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/apps/database-new/types/supabase.ts b/apps/database-new/types/supabase.tsnew file mode 100644index 00000000000..7ee0a14e61c--- /dev/null+++ b/apps/database-new/types/supabase.ts@@ -0,0 +1,261 @@+export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]++export interface Database {+ graphql_public: {+ Tables: {+ [_ in never]: never+ }+ Views: {+ [_ in never]: never+ }+ Functions: {+ graphql: {+ Args: {+ operationName?: string+ query?: string+ variables?: Json+ extensions?: Json+ }+ Returns: Json+ }+ }+ Enums: {+ [_ in never]: never+ }+ CompositeTypes: {+ [_ in never]: never+ }+ }+ public: {+ Tables: {+ threads: {+ Row: {+ created_at: string+ id: number+ modified_at: string+ run_id: string+ thread_id: string+ thread_title: string+ user_id: string | null+ }+ Insert: {+ created_at?: string+ id?: number+ modified_at?: string+ run_id: string+ thread_id: string+ thread_title: string+ user_id?: string | null+ }+ Update: {+ created_at?: string+ id?: number+ modified_at?: string+ run_id?: string+ thread_id?: string+ thread_title?: string+ user_id?: string | null+ }+ Relationships: [+ {+ foreignKeyName: 'threads_user_id_fkey'+ columns: ['user_id']+ referencedRelation: 'users'+ referencedColumns: ['id']+ }+ ]+ }+ }+ Views: {+ [_ in never]: never+ }+ Functions: {+ [_ in never]: never+ }+ Enums: {+ [_ in never]: never+ }+ CompositeTypes: {+ [_ in never]: never+ }+ }+ storage: {+ Tables: {+ buckets: {+ Row: {+ allowed_mime_types: string[] | null+ avif_autodetection: boolean | null+ created_at: string | null+ file_size_limit: number | null+ id: string+ name: string+ owner: string | null+ public: boolean | null+ updated_at: string | null+ }+ Insert: {+ allowed_mime_types?: string[] | null+ avif_autodetection?: boolean | null+ created_at?: string | null+ file_size_limit?: number | null+ id: string+ name: string+ owner?: string | null+ public?: boolean | null+ updated_at?: string | null+ }+ Update: {+ allowed_mime_types?: string[] | null+ avif_autodetection?: boolean | null+ created_at?: string | null+ file_size_limit?: number | null+ id?: string+ name?: string+ owner?: string | null+ public?: boolean | null+ updated_at?: string | null+ }+ Relationships: [+ {+ foreignKeyName: 'buckets_owner_fkey'+ columns: ['owner']+ referencedRelation: 'users'+ referencedColumns: ['id']+ }+ ]+ }+ migrations: {+ Row: {+ executed_at: string | null+ hash: string+ id: number+ name: string+ }+ Insert: {+ executed_at?: string | null+ hash: string+ id: number+ name: string+ }+ Update: {+ executed_at?: string | null+ hash?: string+ id?: number+ name?: string+ }+ Relationships: []+ }+ objects: {+ Row: {+ bucket_id: string | null+ created_at: string | null+ id: string+ last_accessed_at: string | null+ metadata: Json | null+ name: string | null+ owner: string | null+ path_tokens: string[] | null+ updated_at: string | null+ version: string | null+ }+ Insert: {+ bucket_id?: string | null+ created_at?: string | null+ id?: string+ last_accessed_at?: string | null+ metadata?: Json | null+ name?: string | null+ owner?: string | null+ path_tokens?: string[] | null+ updated_at?: string | null+ version?: string | null+ }+ Update: {+ bucket_id?: string | null+ created_at?: string | null+ id?: string+ last_accessed_at?: string | null+ metadata?: Json | null+ name?: string | null+ owner?: string | null+ path_tokens?: string[] | null+ updated_at?: string | null+ version?: string | null+ }+ Relationships: [+ {+ foreignKeyName: 'objects_bucketId_fkey'+ columns: ['bucket_id']+ referencedRelation: 'buckets'+ referencedColumns: ['id']+ }+ ]+ }+ }+ Views: {+ [_ in never]: never+ }+ Functions: {+ can_insert_object: {+ Args: {+ bucketid: string+ name: string+ owner: string+ metadata: Json+ }+ Returns: undefined+ }+ extension: {+ Args: {+ name: string+ }+ Returns: string+ }+ filename: {+ Args: {+ name: string+ }+ Returns: string+ }+ foldername: {+ Args: {+ name: string+ }+ Returns: unknown+ }+ get_size_by_bucket: {+ Args: Record<PropertyKey, never>+ Returns: {+ size: number+ bucket_id: string+ }[]+ }+ search: {+ Args: {+ prefix: string+ bucketname: string+ limits?: number+ levels?: number+ offsets?: number+ search?: string+ sortcolumn?: string+ sortorder?: string+ }+ Returns: {+ name: string+ id: string+ updated_at: string+ created_at: string+ last_accessed_at: string+ metadata: Json+ }[]+ }+ }+ Enums: {+ [_ in never]: never+ }+ CompositeTypes: {+ [_ in never]: never+ }+ }+}diff --git a/package-lock.json b/package-lock.jsonindex e08e8642636..aca469225d1 100644--- a/package-lock.json+++ b/package-lock.json@@ -33,6 +33,7 @@"@dagrejs/dagre": "^1.0.4","@gregnr/libpg-query": "13.4.0-dev.12","@monaco-editor/react": "^4.6.0",+ "@supabase/ssr": "^0.0.10","@tanstack/react-query": "^5.7.2","common": "*","config": "*",@@ -9752,6 +9753,18 @@"version": "0.1.51","license": "Copyright Supabase"},+ "node_modules/@supabase/ssr": {+ "version": "0.0.10",+ "resolved": "https://registry.npmjs.org/@supabase/ssr/-/ssr-0.0.10.tgz",+ "integrity": "sha512-eVs7+bNlff8Fd79x8K3Jbfpmf8P8QRA1Z6rUDN+fi4ReWvRBZyWOFfR6eqlsX6vTjvGgTiEqujFSkv2PYW5kbQ==",+ "dependencies": {+ "cookie": "^0.5.0",+ "ramda": "^0.29.0"+ },+ "peerDependencies": {+ "@supabase/supabase-js": "^2.33.1"+ }+ },"node_modules/@supabase/storage-js": {"version": "2.5.4","license": "MIT",@@ -14054,7 +14067,6 @@},"node_modules/cookie": {"version": "0.5.0",- "dev": true,"license": "MIT","engines": {"node": ">= 0.6"@@ -28782,7 +28794,6 @@},"node_modules/ramda": {"version": "0.29.0",- "dev": true,"license": "MIT","funding": {"type": "opencollective",