diff --git a/apps/database-new/.env.local.example b/apps/database-new/.env.local.example
deleted file mode 100644
index 70bad2e561..0000000000
--- a/apps/database-new/.env.local.example
+++ /dev/null
@@ -1,5 +0,0 @@
-# Update these with your Supabase details from your project settings > API
-# https://app.supabase.com/project/_/settings/api
-NEXT_PUBLIC_SUPABASE_URL=your-project-url
-NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
-OPENAI_API_KEY=your-openai-api-key
diff --git a/apps/database-new/.eslintrc.js b/apps/database-new/.eslintrc.js
deleted file mode 100644
index 4f1d845f8c..0000000000
--- a/apps/database-new/.eslintrc.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- extends: ['eslint-config-supabase/next'],
-}
diff --git a/apps/database-new/.gitignore b/apps/database-new/.gitignore
deleted file mode 100644
index 8f322f0d8f..0000000000
--- a/apps/database-new/.gitignore
+++ /dev/null
@@ -1,35 +0,0 @@
-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
-# dependencies
-/node_modules
-/.pnp
-.pnp.js
-
-# testing
-/coverage
-
-# next.js
-/.next/
-/out/
-
-# production
-/build
-
-# misc
-.DS_Store
-*.pem
-
-# debug
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-# local env files
-.env*.local
-
-# vercel
-.vercel
-
-# typescript
-*.tsbuildinfo
-next-env.d.ts
diff --git a/apps/database-new/README.md b/apps/database-new/README.md
deleted file mode 100644
index 168d7a8dd5..0000000000
--- a/apps/database-new/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# database.design
-
-## Overview
-
-This site will host a tool for designing SQL schemas.
diff --git a/apps/database-new/app/LoadingLine.tsx b/apps/database-new/app/LoadingLine.tsx
deleted file mode 100644
index 3f19ddc1a5..0000000000
--- a/apps/database-new/app/LoadingLine.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-'use client'
-
-import { useAppStateSnapshot } from '@/lib/state'
-import { usePathname, useParams } from 'next/navigation'
-import { LoadingLine as LoadingLineComponent } from 'ui'
-
-function LoadingLine() {
- const snap = useAppStateSnapshot()
- const params = useParams()
- const pathName = usePathname()
-
- const runId = params.runId as string
-
- const loading =
- runId && snap.runsLoading.includes(runId) && pathName.includes(runId) ? true : false
-
- return
-}
-
-export { LoadingLine }
diff --git a/apps/database-new/app/LoginDialog.tsx b/apps/database-new/app/LoginDialog.tsx
deleted file mode 100644
index 21f14041d2..0000000000
--- a/apps/database-new/app/LoginDialog.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-'use client'
-
-import { useAppStateSnapshot } from '@/lib/state'
-import { DialogContent, Dialog } from 'ui'
-
-const LoginDialog = ({ children }: { children: React.ReactNode }) => {
- const snap = useAppStateSnapshot()
-
- return (
- snap.setLoginDialogOpen(!snap.loginDialogOpen)}
- >
- {children}
-
- )
-}
-
-export { LoginDialog }
diff --git a/apps/database-new/app/NewThreadInput.tsx b/apps/database-new/app/NewThreadInput.tsx
deleted file mode 100644
index e0183639aa..0000000000
--- a/apps/database-new/app/NewThreadInput.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-'use client'
-
-import { AssistantChatForm } from '@/components/AssistantChatForm'
-import { useAppStateSnapshot } from '@/lib/state'
-import { createClient } from '@/lib/supabase/client'
-
-const NewThreadInput = () => {
- const supabase = createClient()
- const snap = useAppStateSnapshot()
-
- return (
- <>
-
-
{
- const {
- data: { user },
- } = await supabase.auth.getUser()
- if (!user) {
- snap.setLoginDialogOpen(true)
- return false
- }
- return true
- }}
- placeholder="e.g Create a Telegram-like chat application"
- />
-
- >
- )
-}
-
-export default NewThreadInput
diff --git a/apps/database-new/app/[thread_id]/[message_id]/BottomMarker.tsx b/apps/database-new/app/[thread_id]/[message_id]/BottomMarker.tsx
deleted file mode 100644
index 1231218a54..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/BottomMarker.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-'use client'
-
-import { createRef, useEffect } from 'react'
-
-const BottomMarker = () => {
- const ref = createRef()
-
- useEffect(() => {
- if (ref.current) {
- setTimeout(() => {
- if (ref.current) ref.current.scrollIntoView({ behavior: 'smooth' })
- }, 700)
- }
- }, [ref])
-
- return
-}
-
-export { BottomMarker }
diff --git a/apps/database-new/app/[thread_id]/[message_id]/CodeEditor.tsx b/apps/database-new/app/[thread_id]/[message_id]/CodeEditor.tsx
deleted file mode 100644
index 8197c3ab6a..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/CodeEditor.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { format } from 'sql-formatter'
-
-import { MonacoEditor } from '@/components/MonacoEditor'
-import { CodeEditorContainer } from './CodeEditorContainer'
-
-export async function CodeEditor({ promisedMessage }: { promisedMessage: Promise }) {
- const code = await promisedMessage
-
- // strip the ```sql ``` from the code
- // not sure why we need this & can't get openai to stop returning it
- const strippedCode = code.replace('```sql\n', '').replace('\n```', '')
- const formattedCode = format(strippedCode, { language: 'postgresql' })
-
- /**
- * - CodeEditorContainer is a client component, which uses valtio state
- * - MonacoEditor is a server component injected into it
- */
- return (
-
-
-
- )
-}
diff --git a/apps/database-new/app/[thread_id]/[message_id]/CodeEditorContainer.tsx b/apps/database-new/app/[thread_id]/[message_id]/CodeEditorContainer.tsx
deleted file mode 100644
index 7a65631a58..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/CodeEditorContainer.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-'use client'
-
-import { cn } from 'ui'
-
-import { useAppStateSnapshot } from '@/lib/state'
-import { ReactNode } from 'react'
-
-function CodeEditorContainer({ children }: { children: ReactNode }) {
- const snap = useAppStateSnapshot()
-
- return (
-
- {children}
-
- )
-}
-
-export { CodeEditorContainer }
diff --git a/apps/database-new/app/[thread_id]/[message_id]/MessageItem.tsx b/apps/database-new/app/[thread_id]/[message_id]/MessageItem.tsx
deleted file mode 100644
index 18291f0446..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/MessageItem.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-'use client'
-
-import type { Message as MessageItem } from 'ai/react'
-import Link from 'next/link'
-import { useParams, usePathname } from 'next/navigation'
-import { cn } from 'ui'
-
-interface MessageItemProps {
- message: MessageItem
- isLatest: boolean
- times: {
- hoursFromNow: number
- formattedTimeFromNow: string
- formattedCreatedAt: string
- }
-}
-
-const MessageItem = ({ message, isLatest, times }: MessageItemProps) => {
- const { thread_id } = useParams()
- // using the local state for run loading
- const isLoading = false
-
- const { hoursFromNow, formattedTimeFromNow, formattedCreatedAt } = times
-
- // chat shown as selected when url matches
- const isSelected = usePathname().includes(message.id)
-
- return (
-
-
-
-
- {isLoading && (
-
-
-
- )}
-
- {/* Node line*/}
- {!isLatest &&
}
-
-
-
-
-
-
-
-
-
-
-
- {message.content}
-
- {isLoading &&
}
-
-
- {isSelected && (
-
- Sent {hoursFromNow > 6 ? `on ${formattedCreatedAt}` : formattedTimeFromNow}
-
- )}
-
-
- )
-}
-
-export default MessageItem
diff --git a/apps/database-new/app/[thread_id]/[message_id]/Messages.tsx b/apps/database-new/app/[thread_id]/[message_id]/Messages.tsx
deleted file mode 100644
index 6954b2b195..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/Messages.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import { ScrollArea } from 'ui'
-
-import dayjs from 'dayjs'
-import relativeTime from 'dayjs/plugin/relativeTime'
-import { BottomMarker } from './BottomMarker'
-import { getMessages } from './getMessages'
-
-import MessageItem from './MessageItem'
-
-dayjs.extend(relativeTime)
-
-export const Messages = async ({ threadId }: { threadId: string }) => {
- const { data: messages, error } = await getMessages(threadId)
-
- if (error) {
- return <>Error happened>
- }
-
- const initialMessages = messages.flatMap((m) => [
- {
- id: m.message_id,
- content: m.message_input,
- role: 'user' as const,
- createdAt: new Date(m.created_at),
- },
- {
- id: m.message_id,
- content: m.message_content,
- role: 'assistant' as const,
- createdAt: new Date(m.created_at),
- },
- ])
-
- const userMessages = initialMessages.filter((m) => m.role === 'user')
-
- return (
-
-
- {userMessages.map((message, idx) => {
- const createdAtTimestamp = dayjs(message.createdAt)
- const isLatest = Array.isArray(messages) && idx === messages.length - 1
-
- const hoursFromNow = dayjs().diff(createdAtTimestamp, 'hour')
- const formattedTimeFromNow = dayjs(createdAtTimestamp).fromNow()
-
- const formattedCreatedAt = dayjs(createdAtTimestamp).format('DD MMM YYYY, HH:mm')
-
- const times = {
- hoursFromNow,
- formattedTimeFromNow,
- formattedCreatedAt,
- }
-
- return (
-
- )
- })}
-
-
-
- )
-}
diff --git a/apps/database-new/app/[thread_id]/[message_id]/SchemaFlow.tsx b/apps/database-new/app/[thread_id]/[message_id]/SchemaFlow.tsx
deleted file mode 100644
index e53a476920..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/SchemaFlow.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import SchemaFlowHandler from '@/components/SchemaFlowHandler'
-
-export async function SchemaFlow({ promisedMessage }: { promisedMessage: Promise }) {
- const code = await promisedMessage
- const strippedCode = code.replace('```sql\n', '').replace('\n```', '')
-
- return
-}
diff --git a/apps/database-new/app/[thread_id]/[message_id]/getAssistantMessage.ts b/apps/database-new/app/[thread_id]/[message_id]/getAssistantMessage.ts
deleted file mode 100644
index 5d5de4d165..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/getAssistantMessage.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import { stripIndent } from 'common-tags'
-import { cookies } from 'next/headers'
-import OpenAI from 'openai'
-
-// import is weird, what's up with this?
-import { createClient } from '@/lib/supabase/server'
-import { ContextLengthError } from '../../../../../packages/ai-commands/src/errors'
-import { getMessages } from './getMessages'
-
-// Create an OpenAI API client (that's edge friendly!)
-const openai = new OpenAI({
- apiKey: process.env.OPENAI_API_KEY,
-})
-
-// Set the runtime to edge for best performance
-export const runtime = 'edge'
-
-export type AiAssistantMessage = {
- content: string
- role: 'user' | 'assistant'
-}
-
-/**
- * Get the latest AI generated message. In the DB, there's a pair of user prompt and AI response, so if the
- * user sent a message but that message lacks the corresponding AI response, a call will be made to OpenAI to generate
- * it.
- */
-export const getAssistantResponse = async (threadId: string, messageId: string) => {
- const supabase = createClient()
-
- const { data: message, error } = await supabase
- .from('messages')
- .select()
- .eq('message_id', messageId)
- .single()
-
- if (!message || error) {
- throw new Error('A message with that id does not exist.')
- }
-
- // if the message lacks the AI response, fetch it from OpenAI
- if (!message.message_content) {
- const { data: messages, error } = await getMessages(threadId)
-
- if (error) {
- throw new Error('Error while trying to fetch the existing messages.')
- }
-
- // transform the DB messages into a format that OpenAI understands
- const existingMessages = messages.flatMap((m) => [
- {
- content: m.message_input,
- role: 'user' as const,
- },
- {
- content: m.message_content,
- role: 'assistant' as const,
- },
- ])
-
- const initMessages: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = [
- {
- role: 'system',
- content: stripIndent`
- Your purpose is to generate a SQL schema where the user will give commands to you via a chat.
- The output should use the following instructions:
- - The generated SQL must be valid SQL.
- - For primary keys, always use "id bigint primary key generated always as identity" (not serial)
- - Always create foreign key references in the create statement
- - Prefer 'text' over 'varchar'
- - Prefer 'timestamp with time zone' over 'date'
- - Use vector(384) data type for any embedding/vector related query
- - Always use double apostrophe in SQL strings (eg. 'Night''s watch')
- - Always omit \`\`\`sql from your reply
- - You can use only CREATE TABLE queries, no other queries are allowed under no circumstances (ALTER TABLE etc).
- - On each subsequent message from the user, rewrite the original response to include the new requirement.
- - Don't add any SQL comments in the code
- - Never put a comma before a round bracket
-
- The output should look like this: "CREATE TABLE users (id bigint primary key generated always as identity)"
-
- DO NOT RESPOND WITH ANYTHING ELSE.
- YOU MUST NOT ANSWER WITH ANY PLAIN TEXT
- ONLY RESPOND WITH 1 CODE BLOCK
- YOU MUST NOT FOLLOW UP ANY CODE BLOCKS WITH ANY EXPLANATION
- `,
- },
- ]
-
- initMessages.push(...existingMessages)
-
- try {
- const response = await openai.chat.completions.create({
- model: 'gpt-3.5-turbo-16k-0613',
- messages: initMessages,
- max_tokens: 1024,
- temperature: 0,
- stream: false,
- })
-
- const newMessage = response.choices[0].message.content || ''
-
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser()
-
- if (userError || !user) {
- throw new Error('Failed to get user')
- }
-
- // Insert the message from the completion
- const { data, error } = await supabase
- .from('messages')
- .update({ message_content: newMessage })
- .eq('id', message.id)
- .select()
- .single()
-
- if (error || !data) {
- throw new Error('Error while updating the existing message with the completion data.')
- }
-
- return data.message_content
- } catch (error) {
- if (error instanceof Error && 'code' in error && error.code === 'context_length_exceeded') {
- throw new ContextLengthError()
- }
- throw error
- }
- }
-
- return message.message_content
-}
diff --git a/apps/database-new/app/[thread_id]/[message_id]/getMessages.ts b/apps/database-new/app/[thread_id]/[message_id]/getMessages.ts
deleted file mode 100644
index 3909a2551c..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/getMessages.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { createClient } from '@/lib/supabase/server'
-import { cookies } from 'next/headers'
-import { cache } from 'react'
-
-export const getMessages = cache(async (thread_id: string) => {
- const supabase = createClient()
-
- return await supabase.from('messages').select().eq('thread_id', thread_id).order('created_at')
-})
diff --git a/apps/database-new/app/[thread_id]/[message_id]/page.tsx b/apps/database-new/app/[thread_id]/[message_id]/page.tsx
deleted file mode 100644
index 4ff81c18eb..0000000000
--- a/apps/database-new/app/[thread_id]/[message_id]/page.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { AssistantChatForm } from '@/components/AssistantChatForm'
-import SaveSchemaDropdown from '@/components/Header/SaveSchemaDropdown'
-import ToggleCodeEditorButton from '@/components/Header/ToggleCodeEditorButton'
-import GraphLoader from '@/components/Loaders/GraphLoader'
-import SchemaLoader from '@/components/Loaders/SchemaLoader'
-import { cn } from '@ui/lib/utils/cn'
-import { Suspense } from 'react'
-import { CodeEditor } from './CodeEditor'
-import { Messages } from './Messages'
-import { SchemaFlow } from './SchemaFlow'
-import { getAssistantResponse } from './getAssistantMessage'
-
-export interface ThreadPageProps {
- params: {
- thread_id: string
- message_id: string
- }
-}
-
-export default async function ThreadPage({ params }: ThreadPageProps) {
- const promise = getAssistantResponse(params.thread_id, params.message_id)
-
- return (
-
-
-
-
-
-
-
-
- }>
-
-
- }>
-
-
-
-
- )
-}
diff --git a/apps/database-new/app/actions.ts b/apps/database-new/app/actions.ts
deleted file mode 100644
index d680c2f6a6..0000000000
--- a/apps/database-new/app/actions.ts
+++ /dev/null
@@ -1,234 +0,0 @@
-'use server'
-
-import { createClient } from '@/lib/supabase/server'
-import { Message } from 'ai'
-import { revalidatePath } from 'next/cache'
-import { cookies } from 'next/headers'
-import { redirect } from 'next/navigation'
-
-import { z } from 'zod'
-
-export async function logout() {
- const supabase = createClient()
-
- const { error } = await supabase.auth.signOut()
-
- if (error) {
- console.log('Error logging out:', error.message)
- return
- }
-
- revalidatePath('/', 'layout')
- redirect('/')
-}
-
-//export async function createThread(prevState: any, formData: FormData) {
-export async function createThread(input: string, message: Message, currentThread?: string) {
- const supabase = createClient()
-
- let thread_id = currentThread ?? ''
- let message_id = ''
-
- try {
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser()
-
- if (userError || !user) {
- return {
- success: false,
- message: 'Failed to get user',
- data: undefined,
- }
- }
-
- // create a new thread
- if (!thread_id) {
- try {
- const { data, error } = await supabase
- .from('threads')
- .insert({ user_id: user.id, thread_title: input })
- .select()
-
- if (error) throw error
-
- if (data) {
- console.log({ data })
- thread_id = data[0].id
- // message_id = data[0].message_id
- }
- } catch (error) {
- console.error(error)
- }
- }
-
- //insert the message from the completion
- try {
- const { data, error } = await supabase
- .from('messages')
- .insert({
- thread_id,
- message_content: message.content,
- message_input: input,
- message_role: 'assistant',
- user_id: user.id,
- })
- .select()
-
- if (error) throw error
- if (data) {
- message_id = data[0].message_id
- }
- } catch (error) {
- console.error(error)
- }
- } catch (error: any) {
- console.error(error)
- return {
- success: false,
- message: 'Failed to update title to update title',
- data: undefined,
- }
- }
- redirect(`/${thread_id}/${message_id}`)
-}
-
-export async function upsertThreadMessage(input: string, currentThread?: string) {
- const supabase = createClient()
-
- let thread_id = currentThread ?? ''
- let message_id = ''
-
- try {
- const {
- data: { user },
- error: userError,
- } = await supabase.auth.getUser()
-
- if (userError || !user) {
- return {
- success: false,
- message: 'Failed to get user',
- data: undefined,
- }
- }
-
- // create a new thread
- if (!thread_id) {
- try {
- const { data, error } = await supabase
- .from('threads')
- .insert({ user_id: user.id, thread_title: input })
- .select()
-
- if (error) throw error
-
- if (data) {
- console.log({ data })
- thread_id = data[0].id
- // message_id = data[0].message_id
- }
- } catch (error) {
- console.error(error)
- }
- }
-
- //insert the message from the completion
- try {
- const { data, error } = await supabase
- .from('messages')
- .insert({
- thread_id,
- message_content: '',
- message_input: input,
- message_role: 'assistant',
- user_id: user.id,
- })
- .select()
-
- if (error) throw error
- if (data) {
- message_id = data[0].message_id
- }
- } catch (error) {
- console.error(error)
- }
- } catch (error: any) {
- console.error(error)
- return {
- success: false,
- message: 'Failed to update title to update title',
- data: undefined,
- }
- }
- redirect(`/${thread_id}/${message_id}`)
-}
-
-export async function deleteThread(prevState: any, formData: FormData) {
- const supabase = createClient()
-
- try {
- const schema = z.object({
- thread_id: z.string(),
- })
-
- const data = schema.parse({
- thread_id: formData.get('thread_id'),
- })
-
- await supabase.from('threads').delete().eq('id', data.thread_id)
-
- revalidatePath('/profile')
-
- return {
- success: true,
- data,
- }
- } catch (error: any) {
- console.error(error)
- return {
- success: false,
- message: 'Failed to delete the thread',
- data: undefined,
- }
- }
-}
-
-export async function updateThreadName(prevState: any, formData: FormData) {
- const supabase = createClient()
-
- try {
- const schema = z.object({
- thread_title: z.string(),
- thread_id: z.string(),
- })
-
- const data = schema.parse({
- thread_title: formData.get('thread_title'),
- thread_id: formData.get('thread_id'),
- })
-
- const { error } = await supabase
- .from('threads')
- .update({ thread_title: data.thread_title })
- .eq('id', data.thread_id)
- if (error) {
- throw error
- }
- revalidatePath('/profile')
-
- return {
- message: 'Thread name updated to ' + data.thread_title,
- success: true,
- data,
- }
- } catch (error: any) {
- console.error(error)
- return {
- success: false,
- message: 'Failed to update title to update title',
- data: undefined,
- }
- }
-}
diff --git a/apps/database-new/app/auth/callback/route.ts b/apps/database-new/app/auth/callback/route.ts
deleted file mode 100644
index 6790b4af71..0000000000
--- a/apps/database-new/app/auth/callback/route.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-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 supabase = createClient()
- 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/faq/page.tsx b/apps/database-new/app/faq/page.tsx
deleted file mode 100644
index ae38bd7cba..0000000000
--- a/apps/database-new/app/faq/page.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { FAQS, faq } from '@/data/faqs'
-import { slugify } from '@/lib/utils'
-import type { Metadata } from 'next'
-
-export const metadata: Metadata = {
- title: 'database.design | Faq',
-}
-
-const FAQ = async () => {
- return (
-
-
-
-
- Frequently Asked Questions
-
-
- Everything you have ever wondered about database.design
-
-
-
-
-
- )
-}
-
-export default FAQ
diff --git a/apps/database-new/app/favicon.ico b/apps/database-new/app/favicon.ico
deleted file mode 100644
index 718d6fea48..0000000000
Binary files a/apps/database-new/app/favicon.ico and /dev/null differ
diff --git a/apps/database-new/app/globals.css b/apps/database-new/app/globals.css
deleted file mode 100644
index 11c393d6b2..0000000000
--- a/apps/database-new/app/globals.css
+++ /dev/null
@@ -1,199 +0,0 @@
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
-
-@import '~ui/build/css/source/global.css';
-@import '~ui/build/css/themes/dark.css';
-@import '~ui/build/css/themes/light.css';
-
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-Book.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-Book.woff) format('woff');
- font-weight: 400;
- font-style: normal;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-BookItalic.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-BookItalic.woff) format('woff');
- font-weight: 400;
- font-style: italic;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-Medium.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-Medium.woff) format('woff');
- font-weight: 500;
- font-style: normal;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-MediumItalic.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-MediumItalic.woff) format('woff');
- font-weight: 500;
- font-style: italic;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-Bold.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-Bold.woff) format('woff');
- font-weight: 700;
- font-style: 600;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-BoldItalic.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-BoldItalic.woff) format('woff');
- font-style: 600;
- font-style: italic;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-Black.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-Black.woff) format('woff');
- font-weight: 800;
- font-style: normal;
-}
-@font-face {
- font-family: 'circular';
- src:
- url(/fonts/custom/CustomFont-BlackItalic.woff2) format('woff2'),
- url(/fonts/custom/CustomFont-BlackItalic.woff) format('woff');
- font-weight: 800;
- font-style: italic;
-}
-
-@font-face {
- font-family: 'source code pro';
- src: url('/fonts/source-code-pro/SourceCodePro-Regular.eot');
- src:
- url('/fonts/source-code-pro/SourceCodePro-Regular.woff2') format('woff2'),
- url('/fonts/source-code-pro/SourceCodePro-Regular.woff') format('woff'),
- url('/fonts/source-code-pro/SourceCodePro-Regular.ttf') format('truetype'),
- url('/fonts/source-code-pro/SourceCodePro-Regular.svg#SourceCodePro-Regular') format('svg');
- font-weight: normal;
- font-style: normal;
- font-display: swap;
-}
-
-html,
-body,
-main {
- /* @apply bg-background;
- @apply text-foreground;
- height: 100%;
- width: 100%; */
- padding: 0;
- margin: 0;
- -moz-osx-font-smoothing: grayscale;
- -webkit-font-smoothing: antialiased;
-}
-
-.chat-shimmering-loader {
- animation: shimmer 1.5s infinite linear;
- background: linear-gradient(
- to right,
- hsl(var(--background-default)) 0%,
- hsl(var(--brand-default)) 25%,
- hsl(var(--brand-300)) 35%,
- hsl(var(--background-default)) 45%,
- hsl(var(--background-surface-100)) 75%
- );
- background-size: 3000px 100%;
-}
-
-.shimmering-loader {
- animation: shimmer 2s infinite linear;
- background: linear-gradient(
- to right,
- hsl(var(--border-default)) 4%,
- hsl(var(--background-surface-200)) 25%,
- hsl(var(--border-default)) 36%
- );
- background-size: 1000px 100%;
-}
-
-.dark .shimmering-loader {
- animation: shimmer 2s infinite linear;
- background: linear-gradient(
- to right,
- hsl(var(--border-default)) 4%,
- hsl(var(--border-control)) 25%,
- hsl(var(--border-default)) 36%
- );
- background-size: 1000px 100%;
-}
-
-@keyframes shimmer {
- 0% {
- background-position: -1000px 0;
- }
- 100% {
- background-position: 1000px 0;
- }
-}
-
-.monaco-editor,
-.monaco-diff-editor {
- --vscode-editor-background: hsl(var(--background-alternative)) !important;
- --vscode-editorGutter-background: hsl(var(--background-alternative)) !important;
- padding-top: 12px;
-}
-
-/* .monaco-editor .overflow-guard */
-
-.shimmering-loader {
- animation: shimmer 2s infinite linear;
- background: linear-gradient(
- to right,
- hsl(var(--border-default)) 4%,
- hsl(var(--background-surface-100)) 25%,
- hsl(var(--border-default)) 36%
- );
- background-size: 1000px 100%;
-}
-
-.dark .shimmering-loader {
- animation: shimmer 2s infinite linear;
- background: linear-gradient(
- to right,
- hsl(var(--background-surface-100)) 4%,
- hsl(var(--border-default)) 25%,
- hsl(var(--background-surface-100)) 36%
- );
- background-size: 1000px 100%;
-}
-
-@keyframes shimmer {
- 0% {
- background-position: -1000px 0;
- }
- 100% {
- background-position: 1000px 0;
- }
-}
-
-.fade-in {
- opacity: 0;
- animation-name: fadeIn;
- animation-duration: 500ms;
- animation-timing-function: ease-in-out;
- animation-fill-mode: forwards;
-}
-
-@keyframes fadeIn {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-}
diff --git a/apps/database-new/app/layout.tsx b/apps/database-new/app/layout.tsx
deleted file mode 100644
index 2935c8b68e..0000000000
--- a/apps/database-new/app/layout.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import '@ui/layout/ai-icon-animation/ai-icon-animation-style.module.css'
-import './globals.css'
-
-import Footer from '@/components/Footer'
-import Header from '@/components/Header/Header'
-import { ThemeProvider } from '@/components/providers'
-import type { Metadata } from 'next'
-import { LoadingLine } from './LoadingLine'
-
-const defaultUrl = process.env.VERCEL_URL
- ? `https://${process.env.VERCEL_URL}`
- : 'http://localhost:3000'
-
-export const metadata: Metadata = {
- metadataBase: new URL(defaultUrl),
- title: 'database.design',
- description: 'Generate schemas from your ideas',
-}
-
-// suppressHydrationWarning:
-// https://github.com/pacocoursey/next-themes#with-app
-export default function RootLayout({ children }: { children: React.ReactNode }) {
- return (
-
-
-
-
-
-
- {children}
-
-
-
-
-
- )
-}
diff --git a/apps/database-new/app/login/page.tsx b/apps/database-new/app/login/page.tsx
deleted file mode 100644
index 6e533b40da..0000000000
--- a/apps/database-new/app/login/page.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import LoginForm from '@/components/Auth/LoginForm'
-
-export default function Login({ searchParams }: { searchParams: { message: string } }) {
- return
-}
diff --git a/apps/database-new/app/page.tsx b/apps/database-new/app/page.tsx
deleted file mode 100644
index 68c3f25db3..0000000000
--- a/apps/database-new/app/page.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-// import LoginForm from '@/components/Auth/LoginForm'
-import type { Metadata } from 'next'
-import { LoginDialog } from './LoginDialog'
-import NewThreadInput from './NewThreadInput'
-import LoginForm from '@/components/Auth/LoginForm'
-
-export const metadata: Metadata = {
- title: 'database.design | Create',
-}
-
-const NewThread = async ({
- searchParams,
-}: {
- searchParams: { prompt: string; message: string }
-}) => {
- return (
- <>
-
-
-
-
-
-
- >
- )
-}
-
-export default NewThread
diff --git a/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx b/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx
deleted file mode 100644
index ddfc7c8e93..0000000000
--- a/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-'use client'
-
-import { deleteThread } from '@/app/actions'
-import { createRef, useEffect } from 'react'
-import { useFormState, useFormStatus } from 'react-dom'
-import { Button, Input_Shadcn_, Modal } from 'ui'
-import { ThreadType } from './Threads'
-
-const ConfirmDeleteThreadModal = ({
- thread,
- onClose,
- visible,
-}: {
- thread: ThreadType
- onClose: () => void
- visible: boolean
-}) => {
- const formRef = createRef()
-
- const initialState = {
- message: '',
- success: false,
- data: {
- thread_id: thread.thread_id,
- },
- }
-
- const [state, formAction] = useFormState(deleteThread, initialState)
-
- useEffect(() => {
- if (state?.success === true) {
- onClose()
- formRef.current?.reset()
- state.success = false
- }
- }, [state, onClose, formRef])
-
- useEffect(() => {
- if (state?.success === true) {
- onClose()
- formRef.current?.reset()
- state.success = false
- }
- }, [state, onClose, formRef])
-
- function SubmitButton() {
- const { pending } = useFormStatus()
-
- return (
-
- Delete thread
-
- )
- }
-
- return (
-
-
-
- )
-}
-
-export default ConfirmDeleteThreadModal
diff --git a/apps/database-new/app/profile/EditThreadModal.tsx b/apps/database-new/app/profile/EditThreadModal.tsx
deleted file mode 100644
index 8563ea7c14..0000000000
--- a/apps/database-new/app/profile/EditThreadModal.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-'use client'
-
-import { updateThreadName } from '@/app/actions'
-import { createRef, useEffect } from 'react'
-import { useFormState, useFormStatus } from 'react-dom'
-import { Button, Input_Shadcn_, Label_Shadcn_, Modal } from 'ui'
-import { ThreadType } from './Threads'
-
-const EditThreadModal = ({
- thread,
- onClose,
- visible,
-}: {
- thread: ThreadType
- onClose: () => void
- visible: boolean
-}) => {
- const formRef = createRef()
-
- const initialState = {
- message: undefined,
- success: undefined,
- data: {
- thread_id: thread.thread_id,
- thread_title: thread.thread_title,
- },
- }
-
- const [state, formAction] = useFormState(updateThreadName, initialState)
-
- useEffect(() => {
- if (state?.success === true) {
- onClose()
- formRef.current?.reset()
- state.success = undefined
- }
- }, [state, onClose, formRef])
-
- function SubmitButton() {
- const { pending } = useFormStatus()
-
- return (
-
- Update thread name
-
- )
- }
-
- return (
-
-
-
- )
-}
-
-export default EditThreadModal
diff --git a/apps/database-new/app/profile/EmptyState.tsx b/apps/database-new/app/profile/EmptyState.tsx
deleted file mode 100644
index 489bc7a636..0000000000
--- a/apps/database-new/app/profile/EmptyState.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-'use client'
-
-import Link from 'next/link'
-import { Button } from 'ui'
-
-const EmptyState = () => {
- return (
-
-
No conversations created yet
-
- Start a conversation
-
-
- )
-}
-
-export default EmptyState
diff --git a/apps/database-new/app/profile/Thread.tsx b/apps/database-new/app/profile/Thread.tsx
deleted file mode 100644
index d876d11bb7..0000000000
--- a/apps/database-new/app/profile/Thread.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-'use client'
-
-import { timeAgo } from '@/lib/utils'
-import Link from 'next/link'
-import { useState } from 'react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- IconEdit2,
- IconMoreVertical,
- IconTrash2,
-} from 'ui'
-import ConfirmDeleteThreadModal from './ConfirmDeleteThreadModal'
-import EditThreadModal from './EditThreadModal'
-import { ThreadType } from './Threads'
-
-const Thread = ({ thread }: { thread: ThreadType }) => {
- const { created_at, thread_id, thread_title } = thread
- const formattedTimeAgo = timeAgo(created_at!)
-
- const [editOpen, setEditOpen] = useState(false)
- const [deleteOpen, setDeleteOpen] = useState(false)
-
- return (
- <>
-
-
-
- {thread_title}
-
-
- Last updated {formattedTimeAgo}
-
-
-
-
-
-
-
-
-
-
- {
- console.log('trying to edit thread')
- setEditOpen(true)
- }}
- >
-
- Edit name
-
- setDeleteOpen(true)}>
-
- Delete thread
-
-
-
-
-
- setDeleteOpen(false)}
- />
- setEditOpen(false)}
- />
- >
- )
-}
-
-export default Thread
diff --git a/apps/database-new/app/profile/Threads.tsx b/apps/database-new/app/profile/Threads.tsx
deleted file mode 100644
index ad2c8b0ea6..0000000000
--- a/apps/database-new/app/profile/Threads.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { createClient } from '@/lib/supabase/server'
-import { Database } from '@/types/supabase'
-import { cookies } from 'next/headers'
-import EmptyState from './EmptyState'
-import Thread from './Thread'
-
-export type ThreadType = Database['public']['Views']['profile_threads']['Row']
-
-async function Threads() {
- const supabase = createClient()
-
- const {
- data: { user },
- } = await supabase.auth.getUser()
-
- if (!user) return Error fetching user details
-
- const { data } = await supabase
- .from('profile_threads')
- .select()
- .eq('user_id', user.id)
- .order('created_at', { ascending: false })
- const threads = data ?? []
-
- return (
-
- {threads.length > 0 ? (
- threads
- .sort()
- .map((thread) => )
- ) : (
-
- )}
-
- )
-}
-
-export default Threads
diff --git a/apps/database-new/app/profile/layout.tsx b/apps/database-new/app/profile/layout.tsx
deleted file mode 100644
index 89d3d8e605..0000000000
--- a/apps/database-new/app/profile/layout.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function Layout({ children }: { children: React.ReactNode }) {
- return {children}
-}
diff --git a/apps/database-new/app/profile/page.tsx b/apps/database-new/app/profile/page.tsx
deleted file mode 100644
index 96046ff681..0000000000
--- a/apps/database-new/app/profile/page.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { createClient } from '@/lib/supabase/server'
-import { default as dayjs, default as relativeTime } from 'dayjs'
-import { cookies } from 'next/headers'
-import { redirect } from 'next/navigation'
-import Threads from './Threads'
-import { Suspense } from 'react'
-import ShimmeringLoader from '@/components/Shimmer'
-import type { Metadata } from 'next'
-
-dayjs.extend(relativeTime)
-export const metadata: Metadata = {
- title: 'database.design | Profile',
-}
-
-// revalidatePath not working in the create route handler
-// force-dynamic to refetch every time if needed
-// just a hack for now
-// export const dynamic = 'force-dynamic'
-
-const Profile = async () => {
- return (
-
-
-
-
Loading user...}>
-
-
-
-
-
-
-
Past conversations
-
-
-
-
-
-
-
-
-
-
-
- }
- >
-
-
-
-
- )
-}
-
-async function ProfileDetails() {
- const supabase = createClient()
-
- const {
- data: { user },
- } = await supabase.auth.getUser()
-
- if (!user) redirect('/')
-
- return !user ? (
- // make this better!
- No user found
- ) : (
- <>
-
-
-
{user.user_metadata.full_name}
-
@{user.user_metadata.user_name}
-
- >
- )
-}
-
-export default Profile
diff --git a/apps/database-new/components/AllThreadsModal/AllThreadsModal.constants.ts b/apps/database-new/components/AllThreadsModal/AllThreadsModal.constants.ts
deleted file mode 100644
index f194beb54a..0000000000
--- a/apps/database-new/components/AllThreadsModal/AllThreadsModal.constants.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export const NODE_WIDTH = 700
-export const NODE_HEIGHT = 200
diff --git a/apps/database-new/components/AllThreadsModal/AllThreadsModal.tsx b/apps/database-new/components/AllThreadsModal/AllThreadsModal.tsx
deleted file mode 100644
index ad988bf416..0000000000
--- a/apps/database-new/components/AllThreadsModal/AllThreadsModal.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-// 'use client'
-
-// import { useQuery } from '@tanstack/react-query'
-// import { Modal } from 'ui'
-// import { useParams } from 'next/navigation'
-// import { AssistantMessage, ReadThreadAPIResult, UserMessage } from '@/lib/types'
-// import { useEffect, useMemo } from 'react'
-// import { sortBy } from 'lodash'
-// import ReactFlow, {
-// Background,
-// BackgroundVariant,
-// ReactFlowProvider,
-// useReactFlow,
-// MiniMap,
-// } from 'reactflow'
-// import { getGraphDataFromMessages } from './AllThreadsModal.utils'
-// import MessageNode from './MessageNode'
-
-// interface AllThreadsProps {
-// visible: boolean
-// onClose: () => void
-// onSelectMessage: (messageId: string, replyId: string) => void
-// }
-
-// // [Joshen] POC idea for forking/branching - not for phase 1
-
-// const AllThreads = ({ visible, onClose, onSelectMessage }: AllThreadsProps) => {
-// const params = useParams()
-// const reactFlowInstance = useReactFlow()
-// const nodeTypes = useMemo(() => ({ message: MessageNode }), [])
-
-// // [Joshen] Scaffolding a query cause im presuming we need a different endpoint to retrieve _all_ threads
-// const { data, isSuccess } = useQuery({
-// queryFn: async () => {
-// const response = await fetch(`/api/ai/sql/threads/${params.threadId}/read/${params.runId}`, {
-// method: 'GET',
-// })
-
-// const result = await response.json()
-// return result
-// },
-// queryKey: [params.threadId, params.runId],
-// refetchInterval: (options) => {
-// const data = options.state.data
-// if (data && data.status === 'completed') {
-// return Infinity
-// }
-// return 5000
-// },
-// enabled: !!(params.threadId && params.runId),
-// })
-
-// const messages = useMemo(() => {
-// if (isSuccess) return sortBy(data.messages, (m) => m.created_at)
-// return []
-// }, [data?.messages, isSuccess])
-
-// const userMessages = messages.filter((m) => m.role === 'user') as UserMessage[]
-
-// useEffect(() => {
-// if (reactFlowInstance !== undefined && userMessages.length > 0) {
-// const { nodes, edges } = getGraphDataFromMessages({
-// messages: userMessages,
-// onSelectMessage: (message: UserMessage) => {
-// const index = messages.indexOf(message)
-// const reply = messages[index + 1] as AssistantMessage
-// onSelectMessage(message.id, reply.id)
-// },
-// })
-// reactFlowInstance.setNodes(nodes)
-// reactFlowInstance.setEdges(edges)
-// setTimeout(() => {
-// reactFlowInstance.fitView({})
-// const viewport = reactFlowInstance.getViewport()
-// reactFlowInstance.setViewport({ x: viewport.x - 70, y: 150, zoom: 1 })
-// })
-// }
-// }, [reactFlowInstance, userMessages, messages, onSelectMessage])
-
-// useEffect(() => {
-// if (reactFlowInstance !== undefined && visible) {
-// reactFlowInstance.fitView({})
-// }
-// }, [reactFlowInstance, visible])
-
-// return (
-//
-//
-//
-//
-//
-//
-//
-//
-// )
-// }
-
-// const AllThreadsModal = ({ visible, onClose, onSelectMessage }: AllThreadsProps) => {
-// return (
-//
-//
-//
-// )
-// }
-
-// export default AllThreadsModal
diff --git a/apps/database-new/components/AllThreadsModal/AllThreadsModal.utils.ts b/apps/database-new/components/AllThreadsModal/AllThreadsModal.utils.ts
deleted file mode 100644
index 7186a53d94..0000000000
--- a/apps/database-new/components/AllThreadsModal/AllThreadsModal.utils.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-// import { UserMessage } from '@/lib/types'
-// import dagre from '@dagrejs/dagre'
-// import { Edge, Node, Position } from 'reactflow'
-// import { NODE_HEIGHT, NODE_WIDTH } from './AllThreadsModal.constants'
-// import { MessageNodeData } from './MessageNode'
-
-// export const getGraphDataFromMessages = ({
-// messages,
-// onSelectMessage,
-// }: {
-// messages: UserMessage[]
-// onSelectMessage: (message: UserMessage) => void
-// }): { nodes: Node[]; edges: Edge[] } => {
-// const nodes: Node[] = messages.map((message, idx) => {
-// return {
-// id: message.id,
-// type: 'message',
-// data: {
-// id: message.id,
-// text: message.text,
-// isStart: idx === 0,
-// isEnd: idx === messages.length - 1,
-// onSelectMessage: () => onSelectMessage(message),
-// },
-// position: { x: 0, y: 0 },
-// }
-// })
-
-// const edges: Edge[] = []
-// messages.forEach((message, idx) => {
-// if (idx > 0) {
-// edges.push({
-// id: `edge-${idx}`,
-// source: messages[idx - 1].id,
-// target: message.id,
-// type: 'smoothstep',
-// animated: true,
-// })
-// }
-// })
-
-// const dagreGraph = new dagre.graphlib.Graph()
-// dagreGraph.setDefaultEdgeLabel(() => ({}))
-// dagreGraph.setGraph({ rankdir: 'TB', ranksep: 50, nodesep: 20 })
-
-// nodes.forEach((node) =>
-// dagreGraph.setNode(node.id, { width: NODE_WIDTH / 2, height: NODE_HEIGHT / 2 })
-// )
-// edges.forEach((edge) => dagreGraph.setEdge(edge.source, edge.target))
-// dagre.layout(dagreGraph)
-
-// nodes.forEach((node) => {
-// const nodeWithPosition = dagreGraph.node(node.id)
-// node.targetPosition = Position.Top
-// node.sourcePosition = Position.Bottom
-// node.position = {
-// x: nodeWithPosition.x - nodeWithPosition.width / 2,
-// y: nodeWithPosition.y - nodeWithPosition.height / 2,
-// }
-
-// return node
-// })
-
-// return { nodes, edges }
-// }
diff --git a/apps/database-new/components/AllThreadsModal/MessageNode.tsx b/apps/database-new/components/AllThreadsModal/MessageNode.tsx
deleted file mode 100644
index 4336aac394..0000000000
--- a/apps/database-new/components/AllThreadsModal/MessageNode.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-// import { Handle, NodeProps, Position } from 'reactflow'
-// import { NODE_HEIGHT, NODE_WIDTH } from './AllThreadsModal.constants'
-
-// export interface MessageNodeData {
-// id: string
-// text: string
-// isStart: boolean
-// isEnd: boolean
-// onSelectMessage: () => void
-// }
-
-// const MessageNode = ({ data }: NodeProps) => {
-// const { id, text, isStart, isEnd, onSelectMessage } = data
-// return (
-// <>
-// {!isStart && (
-//
-// )}
-// onSelectMessage()}
-// >
-//
{id}
-//
{text}
-//
-// {!isEnd && (
-//
-// )}
-// >
-// )
-// }
-
-// export default MessageNode
diff --git a/apps/database-new/components/AssistantChatForm/ChatLoadingAnimation.tsx b/apps/database-new/components/AssistantChatForm/ChatLoadingAnimation.tsx
deleted file mode 100644
index c59f22d5ab..0000000000
--- a/apps/database-new/components/AssistantChatForm/ChatLoadingAnimation.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { useState, useEffect } from 'react'
-
-// something a little funny here maybe?
-const textArray = [
- "We're working hard to compute your results",
- 'Installing a new flux capacitor',
- 'Reconfiguring the warp drive',
- 'Analyzing the space modulator',
- 'etc....',
-]
-
-// this is just an idea.
-// maybe a bad one
-// needs better animation if we're keeping it
-const ChatLoadingAnimation = () => {
- const [currentTextIndex, setCurrentTextIndex] = useState(0)
- const [currentText, setCurrentText] = useState(textArray[0])
-
- useEffect(() => {
- const interval = setInterval(() => {
- setCurrentTextIndex((prevIndex) => (prevIndex + 1) % textArray.length)
- setCurrentText(textArray[currentTextIndex])
- }, 2000)
-
- return () => {
- clearInterval(interval)
- }
- }, [currentTextIndex, textArray])
-
- return (
-
-
{currentText}
-
- )
-}
-
-export default ChatLoadingAnimation
diff --git a/apps/database-new/components/AssistantChatForm/ChatSuggestions.tsx b/apps/database-new/components/AssistantChatForm/ChatSuggestions.tsx
deleted file mode 100644
index d38d09f5fb..0000000000
--- a/apps/database-new/components/AssistantChatForm/ChatSuggestions.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { CHAT_EXAMPLES } from '@/data/chat-examples'
-import { cn } from '@ui/lib/utils/cn'
-import { ExternalLink } from 'lucide-react'
-
-export const ChatSuggestions = ({ setInput }: { setInput: (s: string) => void }) => {
- const suggestions = CHAT_EXAMPLES
- return (
-
- {suggestions.map((suggestion, idx) => (
- {
- setInput(suggestion.prompt)
- event.preventDefault()
- }}
- >
- {suggestion.label}
-
-
- ))}
-
- )
-}
diff --git a/apps/database-new/components/AssistantChatForm/action.ts b/apps/database-new/components/AssistantChatForm/action.ts
deleted file mode 100644
index 546532e2e4..0000000000
--- a/apps/database-new/components/AssistantChatForm/action.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-'use server'
-
-import { upsertThreadMessage } from '@/app/actions'
-
-export async function upsertMessageFormAction(formData: FormData) {
- const threadId = formData.get('threadId') as string | undefined
- const prompt = formData.get('prompt') as string
-
- return upsertThreadMessage(prompt, threadId)
-}
diff --git a/apps/database-new/components/AssistantChatForm/index.tsx b/apps/database-new/components/AssistantChatForm/index.tsx
deleted file mode 100644
index df77176b4c..0000000000
--- a/apps/database-new/components/AssistantChatForm/index.tsx
+++ /dev/null
@@ -1,148 +0,0 @@
-'use client'
-
-import { Loader2 } from 'lucide-react'
-import { useParams } from 'next/navigation'
-import { ChangeEvent, FormHTMLAttributes, ReactNode, forwardRef, useRef } from 'react'
-import { useFormStatus } from 'react-dom'
-import { TextArea_Shadcn_, cn } from 'ui'
-
-import { ChatSuggestions } from './ChatSuggestions'
-import { upsertMessageFormAction } from './action'
-
-export interface FormProps extends FormHTMLAttributes {
- loading?: boolean
- disabled?: boolean
- message?: string
- children?: ReactNode
- chatContext: 'new' | 'edit'
-}
-
-const SubmitButton = forwardRef(
- ({ canSubmit }, ref) => {
- const { pending } = useFormStatus()
-
- return (
-
- {pending && (
-
- )}
-
-
-
-
-
-
-
- )
- }
-)
-
-SubmitButton.displayName = 'SubmitButton'
-
-interface AssistantChatFormProps {
- chatContext: string
- placeholder: string
- canSubmit?: () => Promise
-}
-
-const AssistantChatForm = ({
- chatContext,
- placeholder,
- canSubmit = () => Promise.resolve(true),
-}: AssistantChatFormProps) => {
- const { thread_id } = useParams()
- const textAreaRef = useRef(null)
-
- const disabled = false
-
- const handleKeyDown = (e: React.KeyboardEvent) => {
- if (!e.shiftKey && (e.key === 'Enter' || e.key === 'NumpadEnter')) {
- e.preventDefault()
- e.currentTarget.form?.requestSubmit()
- }
- }
-
- const handleChange = (e: ChangeEvent) => {
- const target = e.target
- let newHeight = target.scrollHeight + 'px'
- const input = target.value
- if (!input) {
- newHeight = '40px'
- }
- if (target.style.height !== newHeight) {
- target.style.height = newHeight
- }
- }
-
- return (
- <>
-
- {chatContext === 'new' && (
- {
- if (textAreaRef?.current) textAreaRef.current.value = v
- }}
- />
- )}
- >
- )
-}
-
-AssistantChatForm.displayName = 'AssistantChatForm'
-
-export { AssistantChatForm }
diff --git a/apps/database-new/components/Auth/LoginForm.tsx b/apps/database-new/components/Auth/LoginForm.tsx
deleted file mode 100644
index bb008ad1cb..0000000000
--- a/apps/database-new/components/Auth/LoginForm.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { Button } from '@ui/components/Button'
-import { Github } from 'lucide-react'
-import { cookies, headers } from 'next/headers'
-import { redirect } from 'next/navigation'
-
-import { createClient } from '@/lib/supabase/server'
-
-export default function LoginForm({ searchParams }: { searchParams?: { message?: string } }) {
- const signUp = async () => {
- 'use server'
-
- const origin = headers().get('origin')
-
- const supabase = createClient()
-
- 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 (
-
- )
-}
diff --git a/apps/database-new/components/Footer.tsx b/apps/database-new/components/Footer.tsx
deleted file mode 100644
index c6d8cdb866..0000000000
--- a/apps/database-new/components/Footer.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import Link from 'next/link'
-import ThemeSwitcher from './Header/ThemeSwitcher'
-
-export const links = [
- { title: ` © Supabase`, url: 'https://supabase.com/' },
- { title: 'FAQs', url: '/faq' },
- { title: 'Open Source', url: 'https://supabase.com/open-source' },
- { title: 'Privacy Settings', url: 'https://supabase.com/privacy' },
-]
-
-const Footer = () => (
-
-
- {links.map((link, index) => (
-
- {link.title}
-
- ))}
-
-
-
-)
-
-export default Footer
diff --git a/apps/database-new/components/Header/AvatarDropdown.tsx b/apps/database-new/components/Header/AvatarDropdown.tsx
deleted file mode 100644
index 93ac5737b5..0000000000
--- a/apps/database-new/components/Header/AvatarDropdown.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-'use client'
-
-import { logout } from '@/app/actions'
-import { User } from '@supabase/supabase-js'
-import { HelpCircle, LogOut } from 'lucide-react'
-import Image from 'next/image'
-import Link from 'next/link'
-import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, IconUser } from 'ui'
-
-interface AvatarDropdownProps {
- user: User
-}
-
-export default function AvatarDropdown({ user }: AvatarDropdownProps) {
- return (
- <>
-
-
{user.user_metadata.full_name}
-
{user.user_metadata.email}
-
-
-
-
- {}}>
-
- Profile
-
-
-
- {}}>
-
- FAQs
-
-
-
-
-
-
-
-
- Supabase
-
-
-
-
- >
- )
-}
diff --git a/apps/database-new/components/Header/Header.tsx b/apps/database-new/components/Header/Header.tsx
deleted file mode 100644
index 6ac40783ce..0000000000
--- a/apps/database-new/components/Header/Header.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import Link from 'next/link'
-
-import HeaderActions from './HeaderActions'
-import UserDropdown from './UserDropdown'
-
-const Header = async () => {
- return (
-
-
-
-
-
-
-
- )
-}
-
-export default Header
diff --git a/apps/database-new/components/Header/HeaderActions.tsx b/apps/database-new/components/Header/HeaderActions.tsx
deleted file mode 100644
index 27bf0e7c29..0000000000
--- a/apps/database-new/components/Header/HeaderActions.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-'use client'
-import Link from 'next/link'
-import { useSelectedLayoutSegment } from 'next/navigation'
-import { Button } from 'ui'
-
-import SaveSchemaDropdown from './SaveSchemaDropdown'
-import ToggleCodeEditorButton from './ToggleCodeEditorButton'
-
-const HeaderActions = () => {
- const segment = useSelectedLayoutSegment()
-
- return (
-
- {segment && segment.includes('thread') && (
-
- )}
-
-
- New conversation
-
-
- )
-}
-
-export default HeaderActions
diff --git a/apps/database-new/components/Header/NoUserDropdown.tsx b/apps/database-new/components/Header/NoUserDropdown.tsx
deleted file mode 100644
index b7e5c3b672..0000000000
--- a/apps/database-new/components/Header/NoUserDropdown.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { LogIn } from 'lucide-react'
-import Image from 'next/image'
-import Link from 'next/link'
-import { DropdownMenuItem, DropdownMenuSeparator } from 'ui'
-
-const NoUserDropdown = () => {
- return (
- <>
-
-
- Sign in to database.design to save your database
- designs!
-
-
-
-
-
- Sign in
-
-
-
-
-
-
- Supabase
-
-
- >
- )
-}
-
-export default NoUserDropdown
diff --git a/apps/database-new/components/Header/SaveSchemaDropdown.tsx b/apps/database-new/components/Header/SaveSchemaDropdown.tsx
deleted file mode 100644
index 24a2b4121a..0000000000
--- a/apps/database-new/components/Header/SaveSchemaDropdown.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-'use client'
-
-import { getAppStateSnapshot } from '@/lib/state'
-import Image from 'next/image'
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- IconChevronDown,
- IconClipboard,
- IconDownload,
-} from 'ui'
-
-const SaveSchemaDropdown = () => {
- const copyToClipboard = () => {
- const snap = getAppStateSnapshot()
- const focused = window.document.hasFocus()
- if (focused) {
- window.navigator?.clipboard?.writeText(snap.selectedCode)
- } else {
- console.warn('Unable to copy to clipboard')
- }
- }
-
- const downloadSQL = () => {
- const snap = getAppStateSnapshot()
- const blob = new Blob([snap.selectedCode], { type: 'text/plain' })
- const url = URL.createObjectURL(blob)
- const link = document.createElement('a')
- link.download = 'migration.sql'
- link.href = url
- link.click()
- }
-
- const loadSQLInSupabase = () => {
- const snap = getAppStateSnapshot()
- window.open(
- `https://supabase.com/dashboard/project/_/sql?content=${encodeURIComponent(
- snap.selectedCode
- )}`,
- '_blank'
- )
- }
-
- return (
-
-
- }>
- Save schema
-
-
-
- copyToClipboard()}>
-
- Copy SQL
-
- downloadSQL()}>
-
- Download SQL
-
- loadSQLInSupabase()}>
-
- Load SQL in Supabase
-
-
-
- )
-}
-
-export default SaveSchemaDropdown
diff --git a/apps/database-new/components/Header/ThemeSwitcher.tsx b/apps/database-new/components/Header/ThemeSwitcher.tsx
deleted file mode 100644
index 02f72e4775..0000000000
--- a/apps/database-new/components/Header/ThemeSwitcher.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-'use client'
-import { ThemeToggle } from 'ui-patterns/ThemeToggle'
-
-export default function ThemeSwitcher() {
- return
-}
diff --git a/apps/database-new/components/Header/ToggleCodeEditorButton.tsx b/apps/database-new/components/Header/ToggleCodeEditorButton.tsx
deleted file mode 100644
index f9b1b986ef..0000000000
--- a/apps/database-new/components/Header/ToggleCodeEditorButton.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-'use client'
-
-import { useAppStateSnapshot } from '@/lib/state'
-import { Button } from 'ui'
-
-const ToggleCodeEditorButton = () => {
- const snap = useAppStateSnapshot()
- return (
- snap.setHideCode(!snap.hideCode)}>
- {snap.hideCode ? 'Show code' : 'Hide code'}
-
- )
-}
-
-export default ToggleCodeEditorButton
diff --git a/apps/database-new/components/Header/UserDropdown.tsx b/apps/database-new/components/Header/UserDropdown.tsx
deleted file mode 100644
index 58b3fc2d8a..0000000000
--- a/apps/database-new/components/Header/UserDropdown.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { createClient } from '@/lib/supabase/server'
-import { User2 } from 'lucide-react'
-import { cookies } from 'next/headers'
-import { Suspense } from 'react'
-import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from 'ui'
-import AvatarDropdown from './AvatarDropdown'
-import NoUserDropdown from './NoUserDropdown'
-
-const EmptyUserButton = () => (
- } />
-)
-
-export function UserDropdown() {
- return (
- }>
-
-
- )
-}
-
-async function Dropdowns() {
- const supabase = createClient()
-
- const {
- data: { user },
- } = await supabase.auth.getUser()
-
- return (
-
-
- {user ? (
-
- ) : (
-
- )}
-
-
- {user ? : }
-
-
- )
-}
-
-export default UserDropdown
diff --git a/apps/database-new/components/Loaders/GraphLoader.tsx b/apps/database-new/components/Loaders/GraphLoader.tsx
deleted file mode 100644
index 47c372ffcb..0000000000
--- a/apps/database-new/components/Loaders/GraphLoader.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Loader2 } from 'lucide-react'
-
-const GraphLoader = () => {
- return (
-
- )
-}
-
-export default GraphLoader
-
-const LineNumbers = () => {
- const lines = [1, 2, 3, 4, 5, 6]
- return (
-
- {lines.map((line) => (
- {line}
- ))}
-
- )
-}
diff --git a/apps/database-new/components/Loaders/SchemaLoader.tsx b/apps/database-new/components/Loaders/SchemaLoader.tsx
deleted file mode 100644
index c8abf5ae79..0000000000
--- a/apps/database-new/components/Loaders/SchemaLoader.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Loader2 } from 'lucide-react'
-
-const SchemaLoader = () => {
- return (
-
- )
-}
-
-export default SchemaLoader
diff --git a/apps/database-new/components/MonacoEditor/CodeEditor.utils.ts b/apps/database-new/components/MonacoEditor/CodeEditor.utils.ts
deleted file mode 100644
index 493ae713ea..0000000000
--- a/apps/database-new/components/MonacoEditor/CodeEditor.utils.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-export const getTheme = (theme: string) => {
- const isDarkMode = theme.includes('dark')
-
- return {
- base: isDarkMode ? 'vs-dark' : 'vs', // can also be vs-dark or hc-black
- inherit: true, // can also be false to completely replace the builtin rules
- rules: [
- { token: '', background: isDarkMode ? '1f1f1f' : 'f0f0f0' },
- {
- token: '',
- background: isDarkMode ? '1f1f1f' : 'f0f0f0',
- foreground: isDarkMode ? 'd4d4d4' : '444444',
- },
- { token: 'string.sql', foreground: '24b47e' },
- { token: 'comment', foreground: '666666' },
- { token: 'predefined.sql', foreground: isDarkMode ? 'D4D4D4' : '444444' },
- ],
- colors: { 'editor.background': isDarkMode ? '#1f1f1f' : '#f0f0f0' },
- }
-}
diff --git a/apps/database-new/components/MonacoEditor/index.tsx b/apps/database-new/components/MonacoEditor/index.tsx
deleted file mode 100644
index f7cf4421cc..0000000000
--- a/apps/database-new/components/MonacoEditor/index.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-'use client'
-
-import Editor, { BeforeMount, EditorProps } from '@monaco-editor/react'
-import { merge } from 'lodash'
-
-interface MonacoEditorProps {
- id: string
- language: 'pgsql' | 'json' | 'html'
- autofocus?: boolean
- defaultValue?: string
- isReadOnly?: boolean
- onInputChange?: (value?: string) => void
- onInputRun?: (value: string) => void
- hideLineNumbers?: boolean
- loading?: boolean
- options?: EditorProps['options']
- value?: string
-}
-
-const MonacoEditor = ({
- id,
- language,
- defaultValue,
- hideLineNumbers = false,
- options,
- value,
-}: MonacoEditorProps) => {
- // const monacoRef = useRef()
- // const { resolvedTheme } = useTheme()
-
- const beforeMount: BeforeMount = (monaco) => {
- // monacoRef.current = monaco
- monaco.editor.defineTheme('supabase', {
- base: 'vs-dark',
- inherit: true,
- rules: [
- { token: '', background: '1f1f1f' },
- { token: '', background: '1f1f1f', foreground: 'd4d4d4' },
- { token: 'string.sql', foreground: '24b47e' },
- { token: 'comment', foreground: '666666' },
- { token: 'predefined.sql', foreground: 'D4D4D4' },
- ],
- colors: { 'editor.background': '#1f1f1f' },
- })
- }
-
- // const onMount: OnMount = async (editor) => {
- // // Add margin above first line
- // editor.changeViewZones((accessor) => {
- // accessor.addZone({
- // afterLineNumber: 0,
- // heightInPx: 4,
- // domNode: document.createElement('div'),
- // })
- // })
-
- // if (resolvedTheme) {
- // const mode: any = getTheme(resolvedTheme)
- // monacoRef.current.editor.defineTheme('supabase', mode)
- // }
- // }
-
- const optionsMerged = merge(
- {
- tabSize: 2,
- fontSize: 13,
- readOnly: true,
- minimap: { enabled: false },
- wordWrap: 'on',
- fixedOverflowWidgets: true,
- contextmenu: true,
- lineNumbers: hideLineNumbers ? 'off' : undefined,
- glyphMargin: hideLineNumbers ? false : undefined,
- lineNumbersMinChars: hideLineNumbers ? 0 : undefined,
- occurrencesHighlight: false,
- folding: hideLineNumbers ? false : undefined,
- renderLineHighlight: 'none',
- selectionHighlight: false,
- },
- options
- )
-
- merge({ cpp: '12' }, { java: '23' }, { python: '35' })
-
- return (
- div]:p-0'}
- value={value ?? undefined}
- defaultLanguage={language}
- defaultValue={defaultValue ?? undefined}
- loading={false}
- options={optionsMerged}
- beforeMount={beforeMount}
- // onMount={onMount}
- />
- )
-}
-
-export { MonacoEditor }
diff --git a/apps/database-new/components/SchemaFlowHandler/SchemaFlow.constants.ts b/apps/database-new/components/SchemaFlowHandler/SchemaFlow.constants.ts
deleted file mode 100644
index e7763a40f4..0000000000
--- a/apps/database-new/components/SchemaFlowHandler/SchemaFlow.constants.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-// ReactFlow is scaling everything by the factor of 2
-export const NODE_WIDTH = 320
-export const NODE_ROW_HEIGHT = 40
diff --git a/apps/database-new/components/SchemaFlowHandler/SchemaFlow.utils.ts b/apps/database-new/components/SchemaFlowHandler/SchemaFlow.utils.ts
deleted file mode 100644
index ae276cfe01..0000000000
--- a/apps/database-new/components/SchemaFlowHandler/SchemaFlow.utils.ts
+++ /dev/null
@@ -1,169 +0,0 @@
-import { PostgresTable } from '@/lib/types'
-import dagre from '@dagrejs/dagre'
-import { uniqBy } from 'lodash'
-import { Edge, Node, Position } from 'reactflow'
-import { TableNodeData } from 'ui-patterns/SchemaTableNode'
-
-import { NODE_ROW_HEIGHT, NODE_WIDTH } from './SchemaFlow.constants'
-
-export async function getGraphDataFromTables(tables: PostgresTable[]): Promise<{
- nodes: Node[]
- edges: Edge[]
-}> {
- if (!tables.length) {
- return { nodes: [], edges: [] }
- }
-
- const nodes = tables.map((table) => {
- const columns = (table.columns || []).map((column) => {
- return {
- id: column.id,
- isPrimary: table.primary_keys.some((pk) => pk.name === column.name),
- name: column.name,
- format: column.format,
- isNullable: column.is_nullable,
- isUnique: column.is_unique,
- isIdentity: column.is_identity,
- }
- })
-
- return {
- id: `${table.id}`,
- type: 'table',
- data: {
- name: table.name,
- isForeign: false,
- columns,
- },
- position: { x: 0, y: 0 },
- }
- })
-
- const edges: Edge[] = []
- // const currentSchema = tables[0].schema
- const uniqueRelationships = uniqBy(
- tables.flatMap((t) => t.relationships),
- 'id'
- )
-
- for (const rel of uniqueRelationships) {
- // TODO: Support [external->this] relationship?
- // if (rel.source_schema !== currentSchema) {
- // continue
- // }
-
- // Create additional [this->foreign] node that we can point to on the graph.
- // if (rel.target_table_schema !== currentSchema) {
- // nodes.push({
- // id: rel.constraint_name,
- // type: 'table',
- // data: {
- // name: `${rel.target_table_schema}.${rel.target_table_name}.${rel.target_column_name}`,
- // isForeign: true,
- // columns: [],
- // },
- // position: { x: 0, y: 0 },
- // })
-
- // const [source, sourceHandle] = findTablesHandleIds(
- // tables,
- // rel.source_table_name,
- // rel.source_column_name
- // )
-
- // if (source) {
- // edges.push({
- // id: String(rel.id),
- // source,
- // sourceHandle,
- // target: rel.constraint_name,
- // targetHandle: rel.constraint_name,
- // })
- // }
-
- // continue
- // }
-
- const [source, sourceHandle] = findTablesHandleIds(
- tables,
- rel.source_table_name,
- rel.source_column_name
- )
- const [target, targetHandle] = findTablesHandleIds(
- tables,
- rel.target_table_name,
- rel.target_column_name
- )
-
- // We do not support [external->this] flow currently.
- if (source && target) {
- edges.push({
- id: String(rel.id),
- source,
- sourceHandle,
- target,
- targetHandle,
- })
- }
- }
-
- return getLayoutedElements(nodes, edges)
-}
-
-function findTablesHandleIds(
- tables: PostgresTable[],
- table_name: string,
- column_name: string
-): [string?, string?] {
- for (const table of tables) {
- if (table_name !== table.name) continue
-
- for (const column of table.columns || []) {
- if (column_name !== column.name) continue
-
- return [String(table.id), column.id]
- }
- }
-
- return []
-}
-
-const getLayoutedElements = (nodes: Node[], edges: Edge[]) => {
- const dagreGraph = new dagre.graphlib.Graph()
- dagreGraph.setDefaultEdgeLabel(() => ({}))
- dagreGraph.setGraph({
- rankdir: 'TB',
- align: 'UR',
- nodesep: 25,
- ranksep: 50,
- })
-
- nodes.forEach((node) => {
- dagreGraph.setNode(node.id, {
- width: NODE_WIDTH / 2,
- height: (NODE_ROW_HEIGHT / 2) * (node.data.columns.length + 1), // columns + header
- })
- })
-
- edges.forEach((edge) => {
- dagreGraph.setEdge(edge.source, edge.target)
- })
-
- dagre.layout(dagreGraph)
-
- nodes.forEach((node) => {
- const nodeWithPosition = dagreGraph.node(node.id)
- node.targetPosition = Position.Left
- node.sourcePosition = Position.Right
- // We are shifting the dagre node position (anchor=center center) to the top left
- // so it matches the React Flow node anchor point (top left).
- node.position = {
- x: nodeWithPosition.x - nodeWithPosition.width / 2,
- y: nodeWithPosition.y - nodeWithPosition.height / 2,
- }
-
- return node
- })
-
- return { nodes, edges }
-}
diff --git a/apps/database-new/components/SchemaFlowHandler/index.tsx b/apps/database-new/components/SchemaFlowHandler/index.tsx
deleted file mode 100644
index 04c013eeec..0000000000
--- a/apps/database-new/components/SchemaFlowHandler/index.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-'use client'
-
-import { useTheme } from 'next-themes'
-import { useEffect, useMemo, useState } from 'react'
-import ReactFlow, {
- Background,
- BackgroundVariant,
- ReactFlowProvider,
- useReactFlow,
-} from 'reactflow'
-import 'reactflow/dist/style.css'
-
-import { PostgresTable } from '@/lib/types'
-import { parseTables } from '@/lib/utils'
-import { getGraphDataFromTables } from './SchemaFlow.utils'
-import { TableNode } from 'ui-patterns'
-
-interface SchemaGraphProps {
- tables?: PostgresTable[]
- content: string
-}
-
-const SchemaFlowHandler = ({ content }: SchemaGraphProps) => {
- const { resolvedTheme } = useTheme()
- const [mounted, setMounted] = useState(false)
- const [tables, setTables] = useState([])
- const reactFlowInstance = useReactFlow()
- const nodeTypes = useMemo(() => ({ table: TableNode }), [])
-
- useEffect(() => {
- setMounted(true)
-
- const parseTableData = async () => {
- try {
- const tables = await parseTables(content)
- setTables(tables)
- } catch (error) {
- console.log('error', error)
- }
- }
-
- parseTableData()
- }, [])
-
- useEffect(() => {
- getGraphDataFromTables(tables).then(({ nodes, edges }) => {
- reactFlowInstance.setNodes(nodes)
- reactFlowInstance.setEdges(edges)
- setTimeout(() => reactFlowInstance.fitView({ minZoom: 1 }), 50)
- })
- }, [tables, resolvedTheme, reactFlowInstance])
-
- return (
- <>
-
- {
- instance.fitView()
- }}
- >
- {mounted && (
-
- )}
-
-
- >
- )
-}
-
-const ExportedSchemaGraph = ({ content }: SchemaGraphProps) => {
- return (
-
-
-
- )
-}
-
-export default ExportedSchemaGraph
diff --git a/apps/database-new/components/Shimmer.tsx b/apps/database-new/components/Shimmer.tsx
deleted file mode 100644
index 04262b7a29..0000000000
--- a/apps/database-new/components/Shimmer.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-const ANIMATION_DELAY = 150
-
-const ShimmeringLoader = ({ className = '', delayIndex = 0, animationDelay = ANIMATION_DELAY }) => {
- return (
-
- )
-}
-
-const GenericSkeletonLoader = () => (
-
-
-
-
-
-)
-
-export { GenericSkeletonLoader }
-export default ShimmeringLoader
diff --git a/apps/database-new/components/providers.tsx b/apps/database-new/components/providers.tsx
deleted file mode 100644
index e87743ca16..0000000000
--- a/apps/database-new/components/providers.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-'use client'
-import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
-import { PropsWithChildren } from 'react'
-
-const queryClient = new QueryClient()
-
-export function ReactQueryProvider({ children }: PropsWithChildren) {
- return {children}
-}
-
-export { ThemeProvider } from 'common'
diff --git a/apps/database-new/data/chat-examples.ts b/apps/database-new/data/chat-examples.ts
deleted file mode 100644
index c664fbf028..0000000000
--- a/apps/database-new/data/chat-examples.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-const CHAT_EXAMPLES = [
- { label: 'Twitter clone', prompt: 'Create a twitter clone' },
- {
- label: 'Chat application',
- prompt:
- 'Create a chat application that supports sending messages either through channels or directly between users',
- },
- {
- label: 'User management',
- prompt: 'Create a simple user management schema that supports role based access control',
- },
- { label: 'To do list', prompt: 'Create a simple schema for me to track a to do list' },
-]
-
-export { CHAT_EXAMPLES }
diff --git a/apps/database-new/data/faqs.ts b/apps/database-new/data/faqs.ts
deleted file mode 100644
index 1628a0e326..0000000000
--- a/apps/database-new/data/faqs.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-export type faq = {
- question: string
- answer: string
-}
-
-export const FAQS = [
- {
- question: 'What is database.design?',
- answer:
- 'database.design is a new way to get ideas out of your head and into code as fast as possible. Supabase provides you tools to making building incredibly fast. This tool focuses on the very first step: turning your idea into a database schema.',
- },
- {
- question: 'How does it work?',
- answer: `We use OpenAI under the hood to provide responses to your prompts. Just like ChatGPT, you can fine-tune your responses until you're happy with the schema. We're using React Flow to visualize the schemas.`,
- },
- {
- question: 'Can I see the code?',
- answer: 'You sure can. All of the source code is open source and available on Github. ',
- },
- {
- question: 'Can I contribute to this project?',
- answer: 'You sure can. All of the source code is open source and available on Github. ',
- },
- {
- question: `What's the license? Can we fork this project and build our own?`,
- answer: 'Yes. We release software under the Apache License 2.0.',
- },
- {
- question: 'Can I use this for non-Postgres databases?',
- answer: `Not at the moment. We've tailored the responses to try and do a great job returning Postgres-flavored SQL`,
- },
-]
diff --git a/apps/database-new/lib/state.ts b/apps/database-new/lib/state.ts
deleted file mode 100644
index 71d1fc823e..0000000000
--- a/apps/database-new/lib/state.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { proxy, snapshot, useSnapshot } from 'valtio'
-
-export const appState = proxy({
- hideCode: false,
- setHideCode: (value: boolean) => {
- appState.hideCode = value
- },
-
- selectedCode: '',
- setSelectedCode: (value: string) => {
- appState.selectedCode = value
- },
-
- loginDialogOpen: false,
- setLoginDialogOpen: (value: boolean) => {
- appState.loginDialogOpen = value
- },
-
- runsLoading: [] as string[],
- setRunsLoading: (value: string[]) => {
- appState.runsLoading = value
- },
-})
-
-export const getAppStateSnapshot = () => snapshot(appState)
-export const useAppStateSnapshot = (options?: Parameters[1]) =>
- useSnapshot(appState, options)
diff --git a/apps/database-new/lib/supabase/client.ts b/apps/database-new/lib/supabase/client.ts
deleted file mode 100644
index b39d2aeb89..0000000000
--- a/apps/database-new/lib/supabase/client.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { Database } from '@/types/supabase'
-import { createBrowserClient } from '@supabase/ssr'
-
-export const createClient = () =>
- createBrowserClient(
- 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.ts
deleted file mode 100644
index e6317f9c0d..0000000000
--- a/apps/database-new/lib/supabase/server.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { Database } from '@/types/supabase'
-import { createServerClient, type CookieOptions } from '@supabase/ssr'
-import { cookies } from 'next/headers'
-
-export const createClient = () => {
- const cookieStore = cookies()
-
- return createServerClient(
- 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/types.ts b/apps/database-new/lib/types.ts
deleted file mode 100644
index 9751b1495e..0000000000
--- a/apps/database-new/lib/types.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-export type GeneratedTable = Partial
-
-export type AssistantMessage = {
- id: string
- role: 'assistant'
- created_at: number
- sql: string
- json: GeneratedTable[]
-}
-
-export type UserMessage = {
- id: string
- role: 'user'
- created_at: number
- text: string
-}
-export type Message = AssistantMessage | UserMessage
-
-export type ReadThreadAPIResult = {
- id: string
- status: 'loading' | 'completed'
- messages: Message[]
-}
-
-export type PostgresColumn = {
- id: string
- name: string
- format: string
- is_nullable: boolean
- is_unique: boolean
- is_identity: boolean
-}
-export type PostgresTable = {
- id: string
- name: string
- primary_keys: { name: string }[]
- relationships: {
- id: string
- target_table_name: string
- target_column_name: string
- source_table_name: string
- source_column_name: string
- }[]
- columns: PostgresColumn[]
-}
diff --git a/apps/database-new/lib/utils.ts b/apps/database-new/lib/utils.ts
deleted file mode 100644
index 3d03cc0c58..0000000000
--- a/apps/database-new/lib/utils.ts
+++ /dev/null
@@ -1,291 +0,0 @@
-import dayjs from 'dayjs'
-import { parseQuery } from 'libpg-query'
-import { compact } from 'lodash'
-import { z } from 'zod'
-import { PostgresColumn, PostgresTable } from './types'
-
-const NameDefinition = z.union([
- z.object({
- sval: z.string(),
- }),
- z.object({
- str: z.string(),
- }),
-])
-
-const constraintDefinitionSchema = z.object({
- Constraint: z.discriminatedUnion('contype', [
- z
- .object({
- contype: z.literal('CONSTR_PRIMARY'),
- keys: z
- .array(
- z.object({
- String: z.object({
- sval: z.string(),
- }),
- })
- )
- .optional(),
- })
- .passthrough(),
- z.object({
- contype: z.literal('CONSTR_IDENTITY'),
- }),
- z.object({
- contype: z.literal('CONSTR_NOTNULL'),
- }),
- z.object({
- contype: z.literal('CONSTR_UNIQUE'),
- }),
- z.object({
- contype: z.literal('CONSTR_DEFAULT'),
- }),
- z.object({
- contype: z.literal('CONSTR_FOREIGN'),
- pktable: z.object({
- relname: z.string(),
- }),
- fk_attrs: z
- .array(
- z.object({
- String: NameDefinition,
- })
- )
- .optional(),
- pk_attrs: z.array(
- z.object({
- String: NameDefinition,
- })
- ),
- }),
- ]),
-})
-
-const columnDefinitionSchema = z.object({
- ColumnDef: z.object({
- colname: z.string(),
- typeName: z.object({
- names: z.array(z.object({ String: NameDefinition })),
- }),
- constraints: z.array(constraintDefinitionSchema).optional(),
- }),
-})
-
-const tableDefinitionSchema = z.object({
- CreateStmt: z
- .object({
- relation: z.object({
- relname: z.string(),
- }),
- tableElts: z.array(z.union([columnDefinitionSchema, constraintDefinitionSchema])),
- })
- // the optional() allows other types of statements, but only CreateStmt will be type-safe, we
- // don't care for the other ones.
- .optional(),
-})
-
-const parseQueryResultSchema = z.object({
- stmts: z.array(
- z.object({
- stmt: tableDefinitionSchema,
- })
- ),
-})
-
-const extractNameDefinition = (obj: z.infer) => {
- if ('sval' in obj) {
- return obj?.sval
- }
- if ('str' in obj) {
- return obj?.str
- }
- return null
-}
-
-/**
- * Parses SQL into tables compatible with the existing schema visualizer.
- *
- * TODO: consider running in WebWorker
- */
-export async function parseTables(sql: string) {
- // Parse SQL using the real Postgres parser (compiled to WASM)
-
- const result = await parseQuery(sql)
- const parsedSql = parseQueryResultSchema.safeParse(result)
-
- if (!parsedSql.success) {
- console.log(parsedSql.error)
- return []
- }
-
- // This code generates all columns with their constraints
- const pgTables: PostgresTable[] = compact(
- parsedSql.data.stmts.map(({ stmt }) => {
- if (!stmt.CreateStmt) {
- return
- }
-
- const statement = stmt.CreateStmt
-
- const columns = compact(
- statement.tableElts.map((column) => {
- if ('ColumnDef' in column) {
- const format = compact(
- column.ColumnDef.typeName.names
- .map((name) => extractNameDefinition(name.String))
- .filter((str) => str !== 'pg_catalog' || !!str)
- )[0]
-
- if (!format) {
- return undefined
- }
- const constraints = (column.ColumnDef.constraints || []).map(
- (c) => c.Constraint.contype
- )
-
- const result: PostgresColumn = {
- name: column.ColumnDef.colname,
- format: format,
- id: column.ColumnDef.colname,
- is_nullable: !constraints.includes('CONSTR_NOTNULL'),
- is_unique: constraints.includes('CONSTR_UNIQUE'),
- is_identity: constraints.includes('CONSTR_IDENTITY'),
- }
-
- return result
- }
- })
- )
-
- // This code processes user_id bigint references users (id) SQL.
- const columnRelationships = compact(
- statement.tableElts.map((column) => {
- if ('ColumnDef' in column) {
- const found = (column.ColumnDef.constraints || []).find(
- (c) => c.Constraint.contype === 'CONSTR_FOREIGN'
- )
-
- if (found && found.Constraint.contype === 'CONSTR_FOREIGN') {
- const targetColumn = compact(
- found.Constraint.pk_attrs.map((name) => extractNameDefinition(name.String))
- )[0]
-
- if (!targetColumn) {
- return null
- }
-
- return {
- id: `${statement.relation.relname}_${column.ColumnDef.colname}_${found.Constraint.pktable.relname}_${targetColumn}`,
- source_table_name: statement.relation.relname,
- source_column_name: column.ColumnDef.colname,
- target_table_name: found.Constraint.pktable.relname,
- target_column_name: targetColumn,
- }
- }
- }
- })
- )
-
- // This code processes foreign key (tweet_user_username, tweet_content) references tweets (user_username, content) SQL. It supports composite keys between two tables
- const tableRelationships = compact(
- statement.tableElts.flatMap((constraint) => {
- if ('Constraint' in constraint) {
- if (
- constraint.Constraint.contype === 'CONSTR_FOREIGN' &&
- constraint.Constraint.fk_attrs &&
- constraint.Constraint.pk_attrs.length === constraint.Constraint.fk_attrs.length
- ) {
- const pkTable = constraint.Constraint.pktable
- const pgAttrs = constraint.Constraint.pk_attrs
- return compact(
- constraint.Constraint.fk_attrs.map((attr, index) => {
- const attrString = extractNameDefinition(attr.String)
-
- const pgAttrString = extractNameDefinition(pgAttrs[index].String)
-
- if (!attrString || !pgAttrString) {
- return null
- }
-
- return {
- id: `${statement.relation.relname}_${attrString}_${pkTable.relname}_${pgAttrString}`,
- source_table_name: statement.relation.relname,
- source_column_name: attrString,
- target_table_name: pkTable.relname,
- target_column_name: pgAttrString,
- }
- })
- )
- }
- }
- })
- )
-
- const columnPrimaryKeys = compact(
- statement.tableElts.map((column) => {
- if ('ColumnDef' in column) {
- const constraint = (column.ColumnDef.constraints || []).find(
- (c) => c.Constraint.contype === 'CONSTR_PRIMARY'
- )
- if (constraint) {
- return { name: column.ColumnDef.colname }
- }
- }
- })
- )
-
- // This code processes primary key (user_username, tweet_user_username, tweet_content) SQL.
- const tablePrimaryKeys = compact(
- statement.tableElts.flatMap((constraint) => {
- if ('Constraint' in constraint) {
- if (constraint.Constraint.contype === 'CONSTR_PRIMARY' && constraint.Constraint.keys) {
- return constraint.Constraint.keys.map((key) => ({ name: key.String.sval }))
- }
- return undefined
- }
- })
- )
- const table: PostgresTable = {
- name: statement.relation.relname,
- columns,
- id: statement.relation.relname,
- primary_keys: [...columnPrimaryKeys, ...tablePrimaryKeys],
- relationships: [...columnRelationships, ...tableRelationships],
- }
-
- return table
- })
- )
-
- 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')
- }
-}
-
-export function slugify(str: string) {
- return str
- .toLowerCase() // Convert to lowercase
- .replace(/\s+/g, '-') // Replace spaces with hyphens
- .replace(/[^\w-]+/g, '') // Remove non-word characters except hyphens
- .replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen
- .replace(/^-+|-+$/g, '') // Remove leading and trailing hyphens
-}
diff --git a/apps/database-new/middleware.ts b/apps/database-new/middleware.ts
deleted file mode 100644
index a1dd8cb4e3..0000000000
--- a/apps/database-new/middleware.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { NextResponse } from 'next/server'
-import type { NextRequest } from 'next/server'
-
-// Redirect to supabase.com until this site is live
-// when ready, remove the VERCEL env var at
-// https://vercel.com/supabase/database-new/settings/environment-variables
-export function middleware(request: NextRequest) {
- if (process.env.VERCEL === '1') {
- return NextResponse.redirect(new URL('https://supabase.com', request.url))
- }
-}
diff --git a/apps/database-new/next.config.js b/apps/database-new/next.config.js
deleted file mode 100644
index 9de7ef8a94..0000000000
--- a/apps/database-new/next.config.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/** @type {import('next').NextConfig} */
-const nextConfig = {
- transpilePackages: ['ui', 'ui-patterns'],
- webpack: (config, { dev, isServer, webpack, nextRuntime }) => {
- config.module.rules.push({
- test: /\.node$/,
- use: [
- {
- loader: 'nextjs-node-loader',
- options: {
- includeWebpackPublicPath: false,
- outputPath: config.output.path,
- },
- },
- ],
- })
- return config
- },
-}
-
-module.exports = nextConfig
diff --git a/apps/database-new/package.json b/apps/database-new/package.json
deleted file mode 100644
index e1d6f6a9e2..0000000000
--- a/apps/database-new/package.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "name": "database-design",
- "version": "0.0.0",
- "private": true,
- "scripts": {
- "dev": "next dev --port 3002",
- "build": "next build",
- "start": "next start",
- "lint": "next lint",
- "typecheck": "tsc --noEmit"
- },
- "dependencies": {
- "@dagrejs/dagre": "^1.0.4",
- "@monaco-editor/react": "^4.6.0",
- "@supabase/ssr": "^0.1.0",
- "@tanstack/react-query": "^5.13.4",
- "ai": "^2.2.31",
- "common": "*",
- "config": "*",
- "dayjs": "^1.11.10",
- "eslint-config-supabase": "*",
- "libpg-query": "^15.1.0",
- "lodash": "^4.17.21",
- "lucide-react": "^0.338.0",
- "next": "^14.2.3",
- "openai": "^4.20.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "react-flow": "^1.0.3",
- "sql-formatter": "^13.1.0",
- "ui": "*",
- "ui-patterns": "*",
- "valtio": "^1.12.0",
- "zod": "^3.22.4"
- },
- "devDependencies": {
- "@types/node": "^20.11.16",
- "@types/react": "^18.2.24",
- "@types/react-dom": "^18.2.8",
- "autoprefixer": "^10.4.14",
- "nextjs-node-loader": "^1.1.5",
- "postcss": "^8.4.31",
- "typescript": "^5.5.0"
- }
-}
diff --git a/apps/database-new/postcss.config.js b/apps/database-new/postcss.config.js
deleted file mode 100644
index 33ad091d26..0000000000
--- a/apps/database-new/postcss.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- plugins: {
- tailwindcss: {},
- autoprefixer: {},
- },
-}
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Black.woff b/apps/database-new/public/fonts/custom/CustomFont-Black.woff
deleted file mode 100644
index 091f927ea1..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Black.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Black.woff2 b/apps/database-new/public/fonts/custom/CustomFont-Black.woff2
deleted file mode 100644
index e3c834e57f..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Black.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-BlackItalic.woff b/apps/database-new/public/fonts/custom/CustomFont-BlackItalic.woff
deleted file mode 100644
index b5f6a877dc..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-BlackItalic.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-BlackItalic.woff2 b/apps/database-new/public/fonts/custom/CustomFont-BlackItalic.woff2
deleted file mode 100644
index f84036283e..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-BlackItalic.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Bold.woff b/apps/database-new/public/fonts/custom/CustomFont-Bold.woff
deleted file mode 100644
index f8d3f551df..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Bold.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Bold.woff2 b/apps/database-new/public/fonts/custom/CustomFont-Bold.woff2
deleted file mode 100644
index 5e7af45948..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Bold.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-BoldItalic.woff b/apps/database-new/public/fonts/custom/CustomFont-BoldItalic.woff
deleted file mode 100644
index 07e8a35074..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-BoldItalic.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-BoldItalic.woff2 b/apps/database-new/public/fonts/custom/CustomFont-BoldItalic.woff2
deleted file mode 100644
index ac0edd55fd..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-BoldItalic.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Book.woff b/apps/database-new/public/fonts/custom/CustomFont-Book.woff
deleted file mode 100644
index 7d53d032fc..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Book.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Book.woff2 b/apps/database-new/public/fonts/custom/CustomFont-Book.woff2
deleted file mode 100644
index abd31f7ec2..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Book.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-BookItalic.woff b/apps/database-new/public/fonts/custom/CustomFont-BookItalic.woff
deleted file mode 100644
index 427cda8756..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-BookItalic.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-BookItalic.woff2 b/apps/database-new/public/fonts/custom/CustomFont-BookItalic.woff2
deleted file mode 100644
index d326c8672c..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-BookItalic.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Medium.woff b/apps/database-new/public/fonts/custom/CustomFont-Medium.woff
deleted file mode 100644
index 3707cb45dc..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Medium.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/custom/CustomFont-Medium.woff2 b/apps/database-new/public/fonts/custom/CustomFont-Medium.woff2
deleted file mode 100644
index c07131ddec..0000000000
Binary files a/apps/database-new/public/fonts/custom/CustomFont-Medium.woff2 and /dev/null differ
diff --git a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.eot b/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.eot
deleted file mode 100644
index e815e2cc67..0000000000
Binary files a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.eot and /dev/null differ
diff --git a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.svg b/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.svg
deleted file mode 100644
index 45766eb08c..0000000000
--- a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.svg
+++ /dev/null
@@ -1,4016 +0,0 @@
-
-
-
-
-Created by FontForge 20170731 at Thu Jun 9 00:20:48 2016
- By Aleksey,,,
-Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name `Source'.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.ttf b/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.ttf
deleted file mode 100644
index 2d08f66a44..0000000000
Binary files a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.ttf and /dev/null differ
diff --git a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.woff b/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.woff
deleted file mode 100644
index eacf83e537..0000000000
Binary files a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.woff and /dev/null differ
diff --git a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.woff2 b/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.woff2
deleted file mode 100644
index 21411ef400..0000000000
Binary files a/apps/database-new/public/fonts/source-code-pro/SourceCodePro-Regular.woff2 and /dev/null differ
diff --git a/apps/database-new/public/next.svg b/apps/database-new/public/next.svg
deleted file mode 100644
index 5174b28c56..0000000000
--- a/apps/database-new/public/next.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/apps/database-new/public/supabase.png b/apps/database-new/public/supabase.png
deleted file mode 100644
index a3b7b36f92..0000000000
Binary files a/apps/database-new/public/supabase.png and /dev/null differ
diff --git a/apps/database-new/public/vercel.svg b/apps/database-new/public/vercel.svg
deleted file mode 100644
index d2f8422273..0000000000
--- a/apps/database-new/public/vercel.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/apps/database-new/react.d.ts b/apps/database-new/react.d.ts
deleted file mode 100644
index 61ba1013dc..0000000000
--- a/apps/database-new/react.d.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import 'react-dom'
-
-declare module 'react-dom' {
- function useFormState(
- action: (state: State) => Promise,
- initialState: State,
- permalink?: string
- ): [state: State, dispatch: () => void]
- function useFormState(
- action: (state: State, payload: Payload) => Promise,
- initialState: State,
- permalink?: string
- ): [state: State, dispatch: (payload: Payload) => void]
-}
diff --git a/apps/database-new/supabase/.gitignore b/apps/database-new/supabase/.gitignore
deleted file mode 100644
index a3ad88055b..0000000000
--- a/apps/database-new/supabase/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-# Supabase
-.branches
-.temp
-.env
diff --git a/apps/database-new/supabase/config.toml b/apps/database-new/supabase/config.toml
deleted file mode 100644
index 0d1a103efd..0000000000
--- a/apps/database-new/supabase/config.toml
+++ /dev/null
@@ -1,136 +0,0 @@
-# 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-design"
-
-[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"
-# OpenAI API Key to use for Supabase AI in the Supabase Studio.
-openai_api_key = "env(OPENAI_API_KEY)"
-
-# 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 file
diff --git a/apps/database-new/supabase/migrations/20231122191507_get_started.sql b/apps/database-new/supabase/migrations/20231122191507_get_started.sql
deleted file mode 100644
index 3cbc13003f..0000000000
--- a/apps/database-new/supabase/migrations/20231122191507_get_started.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-create table if not exists public.threads (
- id uuid default gen_random_uuid(),
- created_at timestamp with time zone not null default now(),
- user_id uuid null,
- thread_title text not 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
-);
-
-create table if not exists public.messages (
- id uuid default gen_random_uuid(),
- created_at timestamp with time zone not null default now(),
- thread_id uuid not null default gen_random_uuid(),
- message_id uuid not null default gen_random_uuid(),
- message_role text not null,
- message_input text not null,
- message_content text not null,
- user_id uuid null,
- constraint messages_pkey primary key (id),
- constraint messages_thread_id_fkey foreign key (thread_id) references threads (id) on update cascade on delete cascade,
- constraint messages_user_id_fkey foreign key (user_id) references auth.users (id) on update cascade on delete cascade
-);
-
-CREATE
-OR REPLACE VIEW profile_threads AS
-SELECT
- DISTINCT ON (m.thread_id) m.thread_id,
- m.message_id,
- m.user_id,
- m.created_at,
- t.thread_title
-FROM
- public.messages m
- JOIN public.threads t ON m.thread_id = t.id
-ORDER BY
- m.thread_id,
- m.created_at ASC;
\ No newline at end of file
diff --git a/apps/database-new/supabase/seed.sql b/apps/database-new/supabase/seed.sql
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/apps/database-new/tailwind.config.js b/apps/database-new/tailwind.config.js
deleted file mode 100644
index f64d449ed9..0000000000
--- a/apps/database-new/tailwind.config.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const config = require('config/tailwind.config')
-
-export default config({
- content: [
- './pages/**/*.{ts,tsx}',
- './components/**/*.{ts,tsx}',
- './app/**/*.{ts,tsx}',
- '../../packages/ui/src/**/*.{tsx,ts,js}',
- '../../packages/ui-patterns/**/*.{tsx,ts,js}',
- ],
- theme: {
- extend: {
- colors: {
- dbnew: '#6046FA',
- },
- },
- },
-})
diff --git a/apps/database-new/tsconfig.json b/apps/database-new/tsconfig.json
deleted file mode 100644
index ffdc7da31d..0000000000
--- a/apps/database-new/tsconfig.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2021",
- "lib": ["dom", "dom.iterable", "esnext"],
- "allowJs": true,
- "skipLibCheck": true,
- "strict": true,
- "noEmit": true,
- "esModuleInterop": true,
- "module": "esnext",
- "moduleResolution": "bundler",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "jsx": "preserve",
- "incremental": true,
- "plugins": [
- {
- "name": "next"
- }
- ],
- "paths": {
- "@/*": ["./*"],
- // handle ui package paths
- "@ui/*": ["./../../packages/ui/src/*"]
- }
- },
- "include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
- ".next/types/**/*.ts",
- "./../../packages/ui/src/**/*.d.ts"
- ],
- "exclude": ["node_modules"]
-}
diff --git a/apps/database-new/types/supabase.ts b/apps/database-new/types/supabase.ts
deleted file mode 100644
index b87b06631d..0000000000
--- a/apps/database-new/types/supabase.ts
+++ /dev/null
@@ -1,195 +0,0 @@
-export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]
-
-export interface Database {
- public: {
- Tables: {
- messages: {
- Row: {
- created_at: string
- id: string
- message_content: string
- message_id: string
- message_input: string
- message_role: string
- thread_id: string
- user_id: string | null
- }
- Insert: {
- created_at?: string
- id?: string
- message_content: string
- message_id?: string
- message_input: string
- message_role: string
- thread_id?: string
- user_id?: string | null
- }
- Update: {
- created_at?: string
- id?: string
- message_content?: string
- message_id?: string
- message_input?: string
- message_role?: string
- thread_id?: string
- user_id?: string | null
- }
- Relationships: [
- {
- foreignKeyName: 'messages_thread_id_fkey'
- columns: ['thread_id']
- isOneToOne: false
- referencedRelation: 'threads'
- referencedColumns: ['id']
- },
- {
- foreignKeyName: 'messages_user_id_fkey'
- columns: ['user_id']
- isOneToOne: false
- referencedRelation: 'users'
- referencedColumns: ['id']
- },
- ]
- }
- threads: {
- Row: {
- created_at: string
- id: string
- thread_title: string
- user_id: string | null
- }
- Insert: {
- created_at?: string
- id?: string
- thread_title: string
- user_id?: string | null
- }
- Update: {
- created_at?: string
- id?: string
- thread_title?: string
- user_id?: string | null
- }
- Relationships: [
- {
- foreignKeyName: 'threads_user_id_fkey'
- columns: ['user_id']
- isOneToOne: false
- referencedRelation: 'users'
- referencedColumns: ['id']
- },
- ]
- }
- }
- Views: {
- profile_threads: {
- Row: {
- created_at: string | null
- message_id: string | null
- thread_id: string | null
- thread_title: string | null
- user_id: string | null
- }
- Relationships: [
- {
- foreignKeyName: 'messages_thread_id_fkey'
- columns: ['thread_id']
- isOneToOne: false
- referencedRelation: 'threads'
- referencedColumns: ['id']
- },
- {
- foreignKeyName: 'messages_user_id_fkey'
- columns: ['user_id']
- isOneToOne: false
- referencedRelation: 'users'
- referencedColumns: ['id']
- },
- ]
- }
- }
- Functions: {
- [_ in never]: never
- }
- Enums: {
- [_ in never]: never
- }
- CompositeTypes: {
- [_ in never]: never
- }
- }
-}
-
-export type Tables<
- PublicTableNameOrOptions extends
- | keyof (Database['public']['Tables'] & Database['public']['Views'])
- | { schema: keyof Database },
- TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] &
- Database[PublicTableNameOrOptions['schema']]['Views'])
- : never = never,
-> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? (Database[PublicTableNameOrOptions['schema']]['Tables'] &
- Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
- Row: infer R
- }
- ? R
- : never
- : PublicTableNameOrOptions extends keyof (Database['public']['Tables'] &
- Database['public']['Views'])
- ? (Database['public']['Tables'] &
- Database['public']['Views'])[PublicTableNameOrOptions] extends {
- Row: infer R
- }
- ? R
- : never
- : never
-
-export type TablesInsert<
- PublicTableNameOrOptions extends keyof Database['public']['Tables'] | { schema: keyof Database },
- TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
- : never = never,
-> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
- Insert: infer I
- }
- ? I
- : never
- : PublicTableNameOrOptions extends keyof Database['public']['Tables']
- ? Database['public']['Tables'][PublicTableNameOrOptions] extends {
- Insert: infer I
- }
- ? I
- : never
- : never
-
-export type TablesUpdate<
- PublicTableNameOrOptions extends keyof Database['public']['Tables'] | { schema: keyof Database },
- TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
- : never = never,
-> = PublicTableNameOrOptions extends { schema: keyof Database }
- ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
- Update: infer U
- }
- ? U
- : never
- : PublicTableNameOrOptions extends keyof Database['public']['Tables']
- ? Database['public']['Tables'][PublicTableNameOrOptions] extends {
- Update: infer U
- }
- ? U
- : never
- : never
-
-export type Enums<
- PublicEnumNameOrOptions extends keyof Database['public']['Enums'] | { schema: keyof Database },
- EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
- ? keyof Database[PublicEnumNameOrOptions['schema']]['Enums']
- : never = never,
-> = PublicEnumNameOrOptions extends { schema: keyof Database }
- ? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName]
- : PublicEnumNameOrOptions extends keyof Database['public']['Enums']
- ? Database['public']['Enums'][PublicEnumNameOrOptions]
- : never
diff --git a/package-lock.json b/package-lock.json
index ea2e2b3ace..0f45f27c3c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,93 +28,6 @@
"npm": "^10.0.0"
}
},
- "apps/database-new": {
- "name": "database-design",
- "version": "0.0.0",
- "dependencies": {
- "@dagrejs/dagre": "^1.0.4",
- "@monaco-editor/react": "^4.6.0",
- "@supabase/ssr": "^0.1.0",
- "@tanstack/react-query": "^5.13.4",
- "ai": "^2.2.31",
- "common": "*",
- "config": "*",
- "dayjs": "^1.11.10",
- "eslint-config-supabase": "*",
- "libpg-query": "^15.1.0",
- "lodash": "^4.17.21",
- "lucide-react": "^0.338.0",
- "next": "^14.2.3",
- "openai": "^4.20.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "react-flow": "^1.0.3",
- "sql-formatter": "^13.1.0",
- "ui": "*",
- "ui-patterns": "*",
- "valtio": "^1.12.0",
- "zod": "^3.22.4"
- },
- "devDependencies": {
- "@types/node": "^20.11.16",
- "@types/react": "^18.2.24",
- "@types/react-dom": "^18.2.8",
- "autoprefixer": "^10.4.14",
- "nextjs-node-loader": "^1.1.5",
- "postcss": "^8.4.31",
- "typescript": "^5.5.0"
- }
- },
- "apps/database-new/node_modules/@tanstack/query-core": {
- "version": "5.28.8",
- "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.28.8.tgz",
- "integrity": "sha512-cx64XHeB0kvKxFt22ibvegPeOxnaWVFUbAuhXoIrb7+XePEexHWoB9Kq5n9qroNPkRwQZwgFAP9HNbQz5ohoIg==",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/tannerlinsley"
- }
- },
- "apps/database-new/node_modules/@tanstack/react-query": {
- "version": "5.28.8",
- "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.28.8.tgz",
- "integrity": "sha512-4XYhoRmcThqziB32HsyiBLNXJcukaeGfYwAQ+fZqUUE3ZP4oB/Zy41UJdql+TUg98+vsezfbixxAwAbGHfc5Hg==",
- "dependencies": {
- "@tanstack/query-core": "5.28.8"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/tannerlinsley"
- },
- "peerDependencies": {
- "react": "^18.0.0"
- }
- },
- "apps/database-new/node_modules/argparse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
- },
- "apps/database-new/node_modules/lucide-react": {
- "version": "0.338.0",
- "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.338.0.tgz",
- "integrity": "sha512-Uq+vcn/gp6l01GpDH8SxY6eAvO6Ur2bSU39NxEEJt35OotnVCH5q26TZEVPtJf23gTAncXd3DJQqcezIm6HA7w==",
- "peerDependencies": {
- "react": "^16.5.1 || ^17.0.0 || ^18.0.0"
- }
- },
- "apps/database-new/node_modules/sql-formatter": {
- "version": "13.1.0",
- "resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-13.1.0.tgz",
- "integrity": "sha512-/nZQXuN7KzipFNM20ko+dHY4kOr9rymSfZLUDED8rhx3m8OK5y74jcyN+y1L51ZqHqiB0kp40VdpZP99uWvQdA==",
- "dependencies": {
- "argparse": "^2.0.1",
- "get-stdin": "=8.0.0",
- "nearley": "^2.20.1"
- },
- "bin": {
- "sql-formatter": "bin/sql-formatter-cli.cjs"
- }
- },
"apps/design-system": {
"version": "0.1.0",
"dependencies": {
@@ -1599,30 +1512,6 @@
"tsx": "^4.7.0"
}
},
- "apps/storybook": {
- "version": "1.0.0",
- "extraneous": true,
- "license": "ISC",
- "dependencies": {
- "@storybook/node-logger": "^8.0.0-rc.1"
- },
- "devDependencies": {
- "@storybook/addon-essentials": "^8.0.0-rc.1",
- "@storybook/addon-interactions": "^8.0.0-rc.1",
- "@storybook/addon-links": "^8.0.0-rc.1",
- "@storybook/addon-mdx-gfm": "^8.0.0-rc.1",
- "@storybook/addon-onboarding": "^8.0.0-rc.1",
- "@storybook/addon-styling-webpack": "^0.0.6",
- "@storybook/addon-themes": "^8.0.0-rc.1",
- "@storybook/blocks": "^8.0.0-rc.1",
- "@storybook/nextjs": "^8.0.0-rc.1",
- "@storybook/react": "^8.0.0-rc.1",
- "@storybook/test": "^8.0.0-rc.1",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "storybook": "^8.0.4"
- }
- },
"apps/studio": {
"version": "0.0.9",
"dependencies": {
@@ -14521,18 +14410,6 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
- "node_modules/@supabase/ssr": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/@supabase/ssr/-/ssr-0.1.0.tgz",
- "integrity": "sha512-bIVrkqjAK5G3KjkIMKYKtAOlCgRRplEWjrlyRyXSOYtgDieiOhk2ZyNAPsEOa1By9OZVxuX5eAW1fitdnuxayw==",
- "dependencies": {
- "cookie": "^0.5.0",
- "ramda": "^0.29.0"
- },
- "peerDependencies": {
- "@supabase/supabase-js": "^2.33.1"
- }
- },
"node_modules/@supabase/storage-js": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.6.0.tgz",
@@ -18625,6 +18502,7 @@
},
"node_modules/cookie": {
"version": "0.5.0",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
@@ -19267,10 +19145,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/database-design": {
- "resolved": "apps/database-new",
- "link": true
- },
"node_modules/date-fns": {
"version": "2.30.0",
"license": "MIT",
@@ -34500,6 +34374,7 @@
},
"node_modules/ramda": {
"version": "0.29.0",
+ "dev": true,
"license": "MIT",
"funding": {
"type": "opencollective",
@@ -34809,11 +34684,6 @@
"react": ">=16.8.6"
}
},
- "node_modules/react-flow": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/react-flow/-/react-flow-1.0.3.tgz",
- "integrity": "sha512-Rx4Oqqbe9y7NyrUGzCrmtNvuGuMJBVjfIeMFuwbtbMc9f22sUSmxMjIA0c8r6Z7iMtB1zOWoGkTgfpmmpH9ReQ=="
- },
"node_modules/react-from-dom": {
"version": "0.6.2",
"license": "MIT",
diff --git a/package.json b/package.json
index 023c32b5c4..479c31a951 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,6 @@
"dev:studio": "turbo run dev --filter=studio --parallel",
"dev:docs": "turbo run dev --filter=docs --parallel",
"dev:www": "turbo run dev --filter=www --parallel",
- "dev:database-design": "turbo run dev --filter=database-design --parallel",
"dev:design-system": "turbo run dev --filter=design-system --parallel",
"lint": "turbo run lint",
"typecheck": "turbo --continue typecheck",
diff --git a/turbo.json b/turbo.json
index 89d5b71502..45bd87f524 100644
--- a/turbo.json
+++ b/turbo.json
@@ -6,12 +6,6 @@
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
- "database-design#build": {
- "dependsOn": ["^build"],
- "env": ["NEXT_PUBLIC_*", "OPENAI_API_KEY", "VERCEL_URL"],
- "inputs": ["$TURBO_DEFAULT$", ".env", ".env.local"],
- "outputs": [".next/**", "!.next/cache/**"]
- },
"design-system#build": {
"dependsOn": ["^build"],
"env": ["NEXT_PUBLIC_*"],