The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): remove unused files (#32623)
Alaister Youngc26a1a7e634d
diff --git a/apps/studio/__mocks__/@monaco-editor/react.js b/apps/studio/__mocks__/@monaco-editor/react.jsdeleted file mode 100644index aa694a45fa9..00000000000--- a/apps/studio/__mocks__/@monaco-editor/react.js+++ /dev/null@@ -1,8 +0,0 @@-let Editor = jest.fn().mockImplementation((props) => {- return (- <textarea className="monaco-editor" onChange={(e) => props.onChange(e.target.value)}></textarea>- )-})--export const useMonaco = jest.fn().mockImplementation((v) => v)-export default Editordiff --git a/apps/studio/__mocks__/components/layouts.js b/apps/studio/__mocks__/components/layouts.jsdeleted file mode 100644index 3fd60166088..00000000000--- a/apps/studio/__mocks__/components/layouts.js+++ /dev/null@@ -1,3 +0,0 @@-const MockLayout = jest.fn().mockImplementation(({ children }) => <>{children}</>)-export const LogsLayout = MockLayout-export default MockLayoutdiff --git a/apps/studio/__mocks__/data/fetchers.js b/apps/studio/__mocks__/data/fetchers.jsdeleted file mode 100644index 2331502c3d9..00000000000--- a/apps/studio/__mocks__/data/fetchers.js+++ /dev/null@@ -1,8 +0,0 @@-export const get = jest.fn()-export const post = jest.fn()-export const patch = jest.fn()-export const del = jest.fn()-export const put = jest.fn()-export const head = jest.fn()-export const trace = jest.fn()-export const options = jest.fn()diff --git a/apps/studio/__mocks__/data/subscriptions/org-subscription-query.js b/apps/studio/__mocks__/data/subscriptions/org-subscription-query.jsdeleted file mode 100644index 642cebdd0aa..00000000000--- a/apps/studio/__mocks__/data/subscriptions/org-subscription-query.js+++ /dev/null@@ -1,7 +0,0 @@-export const useOrgSubscriptionQuery = jest.fn().mockReturnValue({- data: {- plan: {- id: 'free',- },- },-})diff --git a/apps/studio/__mocks__/hooks.js b/apps/studio/__mocks__/hooks.jsdeleted file mode 100644index b08fa101e3f..00000000000--- a/apps/studio/__mocks__/hooks.js+++ /dev/null@@ -1,31 +0,0 @@-export const useFlag = jest.fn().mockReturnValue(true)-export const useCheckPermissions = jest.fn().mockReturnValue(true)--const { useStore: _useStore, StoreProvider: _StoreProvider } = jest.requireActual('hooks')-export const useStore = _useStore--export const useParams = jest.fn().mockImplementation(() => ({ ref: '123' }))--export const useLocalStorage = jest.fn().mockImplementation(() => [[], jest.fn()])--export const useIsFeatureEnabled = jest.fn().mockImplementation((arg) =>- typeof arg === 'string'- ? true- : new Proxy(- {},- {- get() {- // Always return true, regardless of the property name- return true- },- }- )-)--// mocks browser event listener adding/removing-window.matchMedia = jest.fn().mockReturnValue({- removeEventListener: jest.fn(),-})-export const StoreProvider = _StoreProvider--export const withAuth = jest.fn()diff --git a/apps/studio/__mocks__/lib/common/fetch.js b/apps/studio/__mocks__/lib/common/fetch.jsdeleted file mode 100644index 38a2018872d..00000000000--- a/apps/studio/__mocks__/lib/common/fetch.js+++ /dev/null@@ -1,3 +0,0 @@-export const get = jest.fn()-export const post = jest.fn()-export const isResponseOk = jest.fn().mockImplementation((v) => Boolean(v))diff --git a/apps/studio/__mocks__/mobx-react-lite.js b/apps/studio/__mocks__/mobx-react-lite.jsdeleted file mode 100644index 1d19f03c4de..00000000000--- a/apps/studio/__mocks__/mobx-react-lite.js+++ /dev/null@@ -1 +0,0 @@-export const observer = jest.fn().mockImplementation((v) => v)diff --git a/apps/studio/__mocks__/next/router.js b/apps/studio/__mocks__/next/router.jsdeleted file mode 100644index 6d616d90094..00000000000--- a/apps/studio/__mocks__/next/router.js+++ /dev/null@@ -1,5 +0,0 @@-export const useRouter = jest.fn().mockImplementation(() => ({- query: { ref: '123' },- push: jest.fn(),- pathname: 'logs/path',-}))diff --git a/apps/studio/__mocks__/react-dnd.js b/apps/studio/__mocks__/react-dnd.jsdeleted file mode 100644index 4c5c46e74c9..00000000000--- a/apps/studio/__mocks__/react-dnd.js+++ /dev/null@@ -1 +0,0 @@-export const reactDnd = {}diff --git a/apps/studio/__mocks__/react-markdown.js b/apps/studio/__mocks__/react-markdown.jsdeleted file mode 100644index f9273676a6f..00000000000--- a/apps/studio/__mocks__/react-markdown.js+++ /dev/null@@ -1,9 +0,0 @@-/**- * Opting for option 1 as described here:- * https://github.com/remarkjs/react-markdown/issues/635#issuecomment-956158474- */-function ReactMarkdown({ children }) {- return <>{children}</>-}--export default ReactMarkdowndiff --git a/apps/studio/__mocks__/remark-gfm.js b/apps/studio/__mocks__/remark-gfm.jsdeleted file mode 100644index 854e99c20ff..00000000000--- a/apps/studio/__mocks__/remark-gfm.js+++ /dev/null@@ -1 +0,0 @@-export default function remarkGfm() {}diff --git a/apps/studio/__mocks__/sse.js b/apps/studio/__mocks__/sse.jsdeleted file mode 100644index 3b47537d1f5..00000000000--- a/apps/studio/__mocks__/sse.js+++ /dev/null@@ -1 +0,0 @@-export const SSE = {}diff --git a/apps/studio/__mocks__/styleMock.js b/apps/studio/__mocks__/styleMock.jsdeleted file mode 100644index 4ba52ba2c8d..00000000000--- a/apps/studio/__mocks__/styleMock.js+++ /dev/null@@ -1 +0,0 @@-module.exports = {}diff --git a/apps/studio/components/interfaces/Auth/Users/UserDropdown.tsx b/apps/studio/components/interfaces/Auth/Users/UserDropdown.tsxdeleted file mode 100644index b0c912a41a6..00000000000--- a/apps/studio/components/interfaces/Auth/Users/UserDropdown.tsx+++ /dev/null@@ -1,269 +0,0 @@-import { Mail, MoreHorizontal, ShieldOff, Trash, User as UserIcon } from 'lucide-react'-import { useState } from 'react'-import { toast } from 'sonner'--import { useParams } from 'common'-import { useUserDeleteMFAFactorsMutation } from 'data/auth/user-delete-mfa-factors-mutation'-import { useUserDeleteMutation } from 'data/auth/user-delete-mutation'-import { useUserResetPasswordMutation } from 'data/auth/user-reset-password-mutation'-import { useUserSendMagicLinkMutation } from 'data/auth/user-send-magic-link-mutation'-import { useUserSendOTPMutation } from 'data/auth/user-send-otp-mutation'-import type { User } from 'data/auth/users-infinite-query'-import { timeout } from 'lib/helpers'-import {- Button,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuSeparator,- DropdownMenuTrigger,- Tooltip_Shadcn_,- TooltipContent_Shadcn_,- TooltipTrigger_Shadcn_,-} from 'ui'-import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'--interface UserDropdownProps {- user: User- permissions: {- canRemoveUser: boolean- canRemoveMFAFactors: boolean- canSendMagicLink: boolean- canSendRecovery: boolean- canSendOtp: boolean- }- setSelectedUser: (user: User) => void- setUserSidePanelOpen: (open: boolean) => void-}--const UserDropdown = ({- user,- permissions,- setSelectedUser,- setUserSidePanelOpen,-}: UserDropdownProps) => {- const { ref } = useParams()- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)- const [isDeleteFactorsModalOpen, setIsDeleteFactorsModalOpen] = useState(false)-- const { canRemoveUser, canRemoveMFAFactors, canSendMagicLink, canSendRecovery, canSendOtp } =- permissions-- const { mutate: resetPassword, isLoading: isResetting } = useUserResetPasswordMutation({- onSuccess: () => {- toast.success(`Sent password recovery to ${user.email}`)- },- })- const { mutate: sendMagicLink, isLoading: isSendingLink } = useUserSendMagicLinkMutation({- onSuccess: () => {- toast.success(`Sent magic link to ${user.email}`)- },- })- const { mutate: sendOTP, isLoading: isSendingOTP } = useUserSendOTPMutation({- onSuccess: () => {- toast.success(`Sent OTP to ${user.phone}`)- },- })- const { mutate: deleteUser, isLoading: isDeleting } = useUserDeleteMutation({- onSuccess: () => {- toast.success(`Successfully deleted ${user.email}`)- setIsDeleteModalOpen(false)- },- })- const { mutate: deleteUserMFAFactors, isLoading: isDeletingFactors } =- useUserDeleteMFAFactorsMutation({- onSuccess: () => {- toast.success("Successfully deleted the user's factors")- setIsDeleteFactorsModalOpen(false)- },- })-- const isLoading = isResetting || isSendingLink || isSendingOTP || isDeleting || isDeletingFactors-- const handleResetPassword = async () => {- if (!ref) return console.error('Project ref is required')- resetPassword({ projectRef: ref, user })- }-- async function handleSendMagicLink() {- if (!ref) return console.error('Project ref is required')- sendMagicLink({ projectRef: ref, user })- }-- async function handleSendOtp() {- if (!ref) return console.error('Project ref is required')- sendOTP({ projectRef: ref, user })- }-- async function handleDelete() {- await timeout(200)- if (!ref) return console.error('Project ref is required')- if (!user.id) return console.error('User id is required')- deleteUser({ projectRef: ref, userId: user.id })- }-- async function handleDeleteFactors() {- await timeout(200)- if (!ref) return console.error('Project ref is required')- if (!user.id) return console.error('User id is required')- deleteUserMFAFactors({ projectRef: ref, userId: user.id })- }-- const handleViewUserInfo = () => {- setSelectedUser(user)- setUserSidePanelOpen(true)- }-- return (- <>- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button type="text" loading={isLoading} className="px-1.5" icon={<MoreHorizontal />} />- </DropdownMenuTrigger>- <DropdownMenuContent>- <>- <DropdownMenuItem className="space-x-2" onClick={handleViewUserInfo}>- <UserIcon size={14} />- <p>View user info</p>- </DropdownMenuItem>- <DropdownMenuSeparator />- {user.email !== null ? (- <>- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <DropdownMenuItem- className="space-x-2 !pointer-events-auto"- disabled={!canSendRecovery}- onClick={() => {- if (canSendRecovery) handleResetPassword()- }}- >- <Mail size={14} />- <p>Send password recovery</p>- </DropdownMenuItem>- </TooltipTrigger_Shadcn_>- {!canSendRecovery && (- <TooltipContent_Shadcn_ side="left">- You need additional permissions to send password recovery.- </TooltipContent_Shadcn_>- )}- </Tooltip_Shadcn_>- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <DropdownMenuItem- disabled={!canSendMagicLink}- className="space-x-2 !pointer-events-auto"- onClick={() => {- if (canSendMagicLink) handleSendMagicLink()- }}- >- <Mail size={14} />- <p>Send magic link</p>- </DropdownMenuItem>- </TooltipTrigger_Shadcn_>- {!canSendMagicLink && (- <TooltipContent_Shadcn_ side="left">- You need additional permissions to send magic link- </TooltipContent_Shadcn_>- )}- </Tooltip_Shadcn_>- </>- ) : null}- {user.phone !== null ? (- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <DropdownMenuItem- disabled={!canSendOtp}- className="space-x-2 !pointer-events-auto"- onClick={() => {- if (canSendOtp) handleSendOtp()- }}- >- <Mail size={14} />- <p>Send OTP</p>- </DropdownMenuItem>- </TooltipTrigger_Shadcn_>- {!canSendOtp && (- <TooltipContent_Shadcn_ side="left">- You need additional permissions to send OTP- </TooltipContent_Shadcn_>- )}- </Tooltip_Shadcn_>- ) : null}- <DropdownMenuSeparator />-- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <DropdownMenuItem- onClick={() => {- if (canRemoveMFAFactors) setIsDeleteFactorsModalOpen(true)- }}- disabled={!canRemoveMFAFactors}- className="space-x-2 !pointer-events-auto"- >- <ShieldOff size={14} />- <p>Remove MFA factors</p>- </DropdownMenuItem>- </TooltipTrigger_Shadcn_>- {!canRemoveMFAFactors && (- <TooltipContent_Shadcn_ side="left">- You need additional permissions to remove a user's authentication factors- </TooltipContent_Shadcn_>- )}- </Tooltip_Shadcn_>-- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <DropdownMenuItem- disabled={!canRemoveUser}- onClick={() => {- if (canRemoveUser) setIsDeleteModalOpen(true)- }}- className="space-x-2 !pointer-events-auto"- >- <Trash size={14} />- <p>Delete user</p>- </DropdownMenuItem>- </TooltipTrigger_Shadcn_>- {!canRemoveUser && (- <TooltipContent_Shadcn_ side="left">- You need additional permissions to delete users- </TooltipContent_Shadcn_>- )}- </Tooltip_Shadcn_>- </>- </DropdownMenuContent>- </DropdownMenu>-- <ConfirmationModal- visible={isDeleteModalOpen}- title="Confirm to delete"- confirmLabel="Delete"- onCancel={() => setIsDeleteModalOpen(false)}- onConfirm={() => {- handleDelete()- }}- >- <p className="text-sm text-foreground-light">- This is permanent! Are you sure you want to delete user {user.email}?- </p>- </ConfirmationModal>-- <ConfirmationModal- visible={isDeleteFactorsModalOpen}- title="Confirm to delete"- confirmLabel="Delete"- onCancel={() => setIsDeleteFactorsModalOpen(false)}- onConfirm={() => {- handleDeleteFactors()- }}- >- <p className="text-sm text-foreground-light">- This is permanent! Are you sure you want to delete the user's MFA factors?- </p>- </ConfirmationModal>- </>- )-}--export default UserDropdowndiff --git a/apps/studio/components/interfaces/Auth/Users/UserSidePanel.tsx b/apps/studio/components/interfaces/Auth/Users/UserSidePanel.tsxdeleted file mode 100644index fd4d1330b79..00000000000--- a/apps/studio/components/interfaces/Auth/Users/UserSidePanel.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { SimpleCodeBlock } from '@ui/components/SimpleCodeBlock'-import type { User } from 'data/auth/users-infinite-query'-import { SidePanel } from 'ui'--interface UsersSidePanelProps {- userSidePanelOpen: boolean- selectedUser: User | undefined- setUserSidePanelOpen: (open: boolean) => void-}-const UsersSidePanel = ({- selectedUser,- userSidePanelOpen,- setUserSidePanelOpen,-}: UsersSidePanelProps) => {- return (- <SidePanel- size="large"- header="View user info"- visible={userSidePanelOpen}- onCancel={() => setUserSidePanelOpen(false)}- cancelText="Close"- >- <SidePanel.Content className="space-y-10 py-6">- <SimpleCodeBlock className="javascript">- {JSON.stringify(selectedUser, null, 2)}- </SimpleCodeBlock>- </SidePanel.Content>- </SidePanel>- )-}--export default UsersSidePaneldiff --git a/apps/studio/components/interfaces/DataWarehouse/CreateWarehouseAccessToken.tsx b/apps/studio/components/interfaces/DataWarehouse/CreateWarehouseAccessToken.tsxdeleted file mode 100644index cbb8960f1fa..00000000000--- a/apps/studio/components/interfaces/DataWarehouse/CreateWarehouseAccessToken.tsx+++ /dev/null@@ -1,103 +0,0 @@-import { z } from 'zod'-import { zodResolver } from '@hookform/resolvers/zod'-import { useForm } from 'react-hook-form'--import { PermissionAction } from '@supabase/shared-types/out/constants'-import { ButtonTooltip } from 'components/ui/ButtonTooltip'-import { FormControl_Shadcn_, FormField_Shadcn_, FormItem_Shadcn_, Form_Shadcn_, Modal } from 'ui'-import { Input } from '@ui/components/shadcn/ui/input'-import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'--type CreateWarehouseProps = {- onSubmit: (values: { description: string }) => void- loading: boolean- open: boolean- setOpen: (open: boolean) => void-}--const CreateWarehouseAccessToken = ({ onSubmit, loading, open, setOpen }: CreateWarehouseProps) => {- const FormSchema = z.object({- description: z.string().min(1, {- message: 'Description is required',- }),- })-- const form = useForm<z.infer<typeof FormSchema>>({- resolver: zodResolver(FormSchema),- defaultValues: {- description: '',- },- })-- const canCreateAccessTokens = useCheckPermissions(PermissionAction.ANALYTICS_READ, 'logflare')-- return (- <>- <ButtonTooltip- disabled={!canCreateAccessTokens}- type="outline"- onClick={() => setOpen(true)}- tooltip={{- content: {- side: 'bottom',- text: !canCreateAccessTokens- ? 'You need additional permissions to create access tokens'- : undefined,- },- }}- >- Create access token- </ButtonTooltip>- <Modal- size="medium"- onCancel={() => {- setOpen(false)- }}- header="Create access token"- visible={open}- alignFooter="right"- loading={loading}- onConfirm={() => {- form.handleSubmit((data) => {- onSubmit(data)- })()-- form.reset()- }}- >- <Form_Shadcn_ {...form}>- <form- onSubmit={(e) => {- e.preventDefault()- form.handleSubmit((data) => {- onSubmit(data)- })()-- form.reset()- }}- id="create-access-token-form"- >- <Modal.Content className="py-4">- <p className="pb-5 text-foreground-light text-sm">- Enter a unique description to identify this token.- </p>- <FormField_Shadcn_- control={form.control}- name="description"- render={({ field }) => (- <FormItem_Shadcn_>- <FormControl_Shadcn_>- <Input placeholder="Token" type="text" {...field} />- </FormControl_Shadcn_>- </FormItem_Shadcn_>- )}- />- </Modal.Content>- </form>- </Form_Shadcn_>- </Modal>- </>- )-}--export default CreateWarehouseAccessTokendiff --git a/apps/studio/components/interfaces/DataWarehouse/WarehouseAccessTokens.tsx b/apps/studio/components/interfaces/DataWarehouse/WarehouseAccessTokens.tsxdeleted file mode 100644index 935196723bb..00000000000--- a/apps/studio/components/interfaces/DataWarehouse/WarehouseAccessTokens.tsx+++ /dev/null@@ -1,261 +0,0 @@-import { TooltipContent } from '@radix-ui/react-tooltip'-import { PermissionAction } from '@supabase/shared-types/out/constants'-import { MoreVertical, TrashIcon } from 'lucide-react'-import { useState } from 'react'-import { toast } from 'sonner'--import { useParams } from 'common'-import { useIsProjectActive } from 'components/layouts/ProjectLayout/ProjectContext'-import Table from 'components/to-be-cleaned/Table'-import CopyButton from 'components/ui/CopyButton'-import { FormHeader } from 'components/ui/Forms/FormHeader'-import NoPermission from 'components/ui/NoPermission'-import { ProjectPausedAlert } from 'components/ui/ProjectPausedAlert'-import { useCreateWarehouseAccessToken } from 'data/analytics/warehouse-access-tokens-create-mutation'-import { useDeleteWarehouseAccessToken } from 'data/analytics/warehouse-access-tokens-delete-mutation'-import { useWarehouseAccessTokensQuery } from 'data/analytics/warehouse-access-tokens-query'-import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'-import {- Button,- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- Input,- TooltipTrigger_Shadcn_,- Tooltip_Shadcn_,- cn,-} from 'ui'-import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'-import CreateWarehouseAccessToken from './CreateWarehouseAccessToken'--const AccessTokenItem = ({- token,- id,- description,- onDeleteClick,- inserted_at,-}: {- token: string- id: number- description: string- inserted_at: string- onDeleteClick: (id: number) => void-}) => {- const formattedInsertedAt = new Date(inserted_at).toLocaleString()- const canDeleteAccessTokens = useCheckPermissions(PermissionAction.ANALYTICS_WRITE, 'logflare')-- return (- <Table.tr className="group">- <Table.td className="max-w-[240px]">{description}</Table.td>- <Table.td>{formattedInsertedAt}</Table.td>- <Table.td>- <div className="flex gap-1 relative">- <Input disabled defaultValue={token} type="password" size="tiny" className="flex-grow" />- <div className="w-[88px]">- <CopyButton- type="outline"- text={token}- className="group-hover:opacity-100 opacity-0 transition-opacity absolute right-0"- />- </div>- </div>- </Table.td>- <Table.td className="!p-1.5 text-right">- <DropdownMenu>- <DropdownMenuTrigger className="h-8 w-8 p-2 focus-visible:outline-none">- <MoreVertical size="14" />- </DropdownMenuTrigger>- <DropdownMenuContent className="max-w-40" align="end">- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <DropdownMenuItem- disabled={!canDeleteAccessTokens}- className="flex gap-1.5 !pointer-events-auto"- onClick={(e) => {- if (canDeleteAccessTokens) {- e.preventDefault()- onDeleteClick(id)- }- }}- >- <TrashIcon size="14" />- Revoke token- </DropdownMenuItem>- </TooltipTrigger_Shadcn_>- {!canDeleteAccessTokens && (- <TooltipContent side="left">- You need additional permissions to delete access tokens- </TooltipContent>- )}- </Tooltip_Shadcn_>- </DropdownMenuContent>- </DropdownMenu>- </Table.td>- </Table.tr>- )-}--export const WarehouseAccessTokens = () => {- const isProjectActive = useIsProjectActive()- const params = useParams()- const projectRef = params.ref as string- const [open, setOpen] = useState(false)-- const canReadAccessTokens = useCheckPermissions(PermissionAction.ANALYTICS_WRITE, 'logflare')- const accessTokensQuery = useWarehouseAccessTokensQuery(- { projectRef },- { enabled: canReadAccessTokens }- )- const hasAccessTokens = accessTokensQuery.isSuccess && accessTokensQuery.data.data.length > 0-- const [tokenToDelete, setTokenToDelete] = useState<string | null>(null)- const [showDeleteDialog, setShowDeleteDialog] = useState(false)-- const { mutate: deleteWarehouseAccessToken, isLoading: deleteLoading } =- useDeleteWarehouseAccessToken({- onSuccess: () => {- toast.success('Access token revoked')- },- onError: () => {- toast.error('Failed to revoke access token')- },- })-- const { mutate: createWarehouseAccessToken, isLoading: createLoading } =- useCreateWarehouseAccessToken({- onSuccess: () => {- toast.success('Access token created')- setOpen(false)- },- })-- const isLoading = deleteLoading || createLoading-- return (- <section className="flex flex-col gap-y-10 py-6 pb-32">- <FormHeader- className="!mb-0"- title="Access tokens"- description="Manage your analytics access tokens for this project."- actions={- <CreateWarehouseAccessToken- open={open}- setOpen={setOpen}- loading={createLoading}- onSubmit={({ description }) => {- createWarehouseAccessToken({- ref: projectRef,- description: description,- })- }}- />- }- />-- {!canReadAccessTokens ? (- <NoPermission resourceText="view analytics access tokens" />- ) : (- <div className={cn(['bg-surface-100', 'overflow-hidden', 'rounded-md shadow'])}>- {!isProjectActive ? (- <ProjectPausedAlert- projectRef={projectRef}- description="Restore your project to manage your analytics access tokens"- />- ) : (- <>- {accessTokensQuery.isLoading ? (- <div className="p-4">- <GenericSkeletonLoader />- </div>- ) : (- <div className="overflow-x-auto">- <Table- head={[- <Table.th key="description">Description</Table.th>,- <Table.th key="created_at">Created at</Table.th>,- <Table.th key="token">Token</Table.th>,- <Table.th key="actions" />,- ]}- body={- hasAccessTokens ? (- accessTokensQuery.data.data.map((accessToken) => (- <AccessTokenItem- key={accessToken.id + '-wh-access-token'}- token={accessToken.token}- id={accessToken.id}- inserted_at={accessToken.inserted_at}- description={accessToken.description || 'No description'}- onDeleteClick={() => {- setShowDeleteDialog(true)- setTokenToDelete(accessToken.token)- }}- />- ))- ) : (- <Table.tr>- <Table.td colSpan={4}>- <p className="text-sm text-foreground">No access tokens created</p>- <p className="text-sm text-foreground-light">- There are no access tokens associated with your project yet- </p>- </Table.td>- </Table.tr>- )- }- />- </div>- )}- </>- )}- </div>- )}-- <Dialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>- <DialogContent>- <DialogHeader>- <DialogTitle>Revoke warehouse access token</DialogTitle>- <DialogDescription>- This action is irreversible and requests made with these access tokens will stop- working.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- type="outline"- onClick={() => {- setShowDeleteDialog(false)- setTokenToDelete(null)- }}- >- Cancel- </Button>- <Button- type="danger"- loading={isLoading}- onClick={async () => {- if (!tokenToDelete) return- deleteWarehouseAccessToken({- projectRef,- token: tokenToDelete,- })- setShowDeleteDialog(false)- setTokenToDelete(null)- }}- >- Yes, revoke access token- </Button>- </DialogFooter>- </DialogContent>- </Dialog>- </section>- )-}--export default WarehouseAccessTokensdiff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelSchema.ts b/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelSchema.tsdeleted file mode 100644index 08ce44c51a1..00000000000--- a/apps/studio/components/interfaces/DiskManagement/DiskManagementPanelSchema.ts+++ /dev/null@@ -1,108 +0,0 @@-import { z } from 'zod'-import { DISK_LIMITS, DiskType } from './ui/DiskManagement.constants'--const baseSchema = z.object({- storageType: z.enum(['io2', 'gp3']).describe('Type of storage: io2 or gp3'),- totalSize: z- .number()- .min(8, { message: 'Allocated disk size must be at least 8 GB.' })- .describe('Allocated disk size in GB'),- provisionedIOPS: z.number().describe('Provisioned IOPS for storage type'),- throughput: z.number().optional().describe('Throughput in MB/s for gp3'),-})--export const getDiskStorageSchema = (currentDiskSize: number) =>- baseSchema.superRefine((data, ctx) => {- const { storageType, totalSize, provisionedIOPS, throughput } = data-- if (totalSize < currentDiskSize) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: 'Disk size cannot be reduced from current configuration',- path: ['totalSize'],- })- }-- if (storageType === 'io2') {- // Validation rules for io2- const maxIOPS = Math.min(1000 * totalSize, 256000)- if (provisionedIOPS < 100) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: 'Provisioned IOPS must be at least 100',- path: ['provisionedIOPS'],- })- } else if (provisionedIOPS > maxIOPS) {- if (totalSize >= 8) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: `Provisioned IOPS must be at most ${maxIOPS}.`,- path: ['provisionedIOPS'],- })- } else {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: `Invalid IOPS value due to invalid disk size`,- path: ['provisionedIOPS'],- })- }- }- if (throughput !== undefined) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: 'Throughput is not configurable for io2.',- path: ['throughput'],- })- }- if (totalSize > DISK_LIMITS[DiskType.IO2].maxStorage) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: 'Allocated disk size must not exceed 61,440 GB',- path: ['totalSize'],- })- }- } else if (storageType === 'gp3') {- // Validation rules for gp3- const maxIOPS = Math.min(500 * totalSize, 16000)- const maxThroughput = Math.min(0.25 * provisionedIOPS, 1000)-- if (provisionedIOPS < 3000) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: `Provisioned IOPS must be at least 3000`,- path: ['provisionedIOPS'],- })- } else if (provisionedIOPS > maxIOPS) {- if (totalSize >= 8) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: `Provisioned IOPS must be at most ${maxIOPS}`,- path: ['provisionedIOPS'],- })- } else {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: `Invalid IOPS value due to invalid disk size`,- path: ['provisionedIOPS'],- })- }- }-- if (throughput !== undefined && (throughput < 125 || throughput > maxThroughput)) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: `Throughput must be set between 125 and ${maxThroughput?.toLocaleString()} MB/s.`,- path: ['throughput'],- })- }- if (totalSize > DISK_LIMITS[DiskType.GP3].maxStorage) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: 'Allocated disk size must not exceed 16,384 GB',- path: ['totalSize'],- })- }- }- })--export type DiskStorageSchemaType = z.infer<ReturnType<typeof getDiskStorageSchema>>diff --git a/apps/studio/components/interfaces/QueryPerformance/IndexEfficiencyNotice.tsx b/apps/studio/components/interfaces/QueryPerformance/IndexEfficiencyNotice.tsxdeleted file mode 100644index e512a2019c7..00000000000--- a/apps/studio/components/interfaces/QueryPerformance/IndexEfficiencyNotice.tsx+++ /dev/null@@ -1,88 +0,0 @@-import { AlertCircle, CheckCircle } from 'lucide-react'--import { AccordionTrigger } from '@ui/components/shadcn/ui/accordion'-import { useParams } from 'common'-import { AccordionContent_Shadcn_, AccordionItem_Shadcn_, Accordion_Shadcn_ } from 'ui'-import { PRESET_CONFIG } from '../Reports/Reports.constants'-import { Presets } from '../Reports/Reports.types'-import { queriesFactory } from '../Reports/Reports.utils'--interface IndexEfficiencyNoticeProps {- isLoading: boolean-}--// [Joshen] Currently not used, might be deprecated - just double checking first-export const IndexEfficiencyNotice = ({ isLoading }: IndexEfficiencyNoticeProps) => {- const { ref: projectRef } = useParams()- const config = PRESET_CONFIG[Presets.QUERY_PERFORMANCE]- const hooks = queriesFactory(config.queries, projectRef ?? 'default')-- const queryHitRate = hooks.queryHitRate()- const indexHitRate = queryHitRate.data?.[0]?.ratio- const tableHitRate = queryHitRate.data?.[1]?.ratio- const showIndexWarning =- indexHitRate && tableHitRate && (indexHitRate <= 0.99 || tableHitRate <= 0.99)-- const checkAlert = <CheckCircle strokeWidth={2} size={16} className="text-brand" />- const warnAlert = <AlertCircle strokeWidth={2} size={16} className="text-warning" />- const dangerAlert = <AlertCircle strokeWidth={2} size={16} className="text-destructive" />-- return (- <Accordion_Shadcn_ type="single" collapsible>- <AccordionItem_Shadcn_ value="1" className="border-none">- <AccordionTrigger className="p-4 bg-surface-100 rounded border [&[data-state=open]]:rounded-b-none hover:no-underline">- <div className="flex flex-row gap-x-2 items-center">- <span className="text-sm">Index Efficiency</span>- {showIndexWarning ? warnAlert : checkAlert}- </div>- </AccordionTrigger>- <AccordionContent_Shadcn_ className="p-4 bg-surface-100 rounded-b border border-t-0 [&>div]:pb-0">- {!isLoading && queryHitRate && (- <div className="flex flex-col gap-y-4">- <div className="flex flex-row gap-4">- <div className="w-1/2 bg-slate-200 rounded-md p-4">- <p>Index Hit Rate</p>- <div className="flex items-center gap-x-3">- {indexHitRate >= 0.99- ? checkAlert- : indexHitRate >= 0.95- ? warnAlert- : dangerAlert}- <div className="flex items-baseline">- <span className="text-3xl">- {queryHitRate?.data && (queryHitRate?.data[0]?.ratio * 100).toFixed(2)}- </span>- <span className="text-xl">%</span>- </div>- </div>- </div>-- <div className="w-1/2 bg-slate-200 rounded-md p-4">- {queryHitRate?.data![1]?.name == 'table hit rate' && 'Table Hit Rate'}- <div className="flex items-center gap-2">- {tableHitRate >= 0.99- ? checkAlert- : tableHitRate >= 0.95- ? warnAlert- : dangerAlert}- <div className="flex items-baseline">- <span className="text-3xl">- {queryHitRate?.data && (queryHitRate?.data[1]?.ratio * 100).toFixed(2)}- </span>- <span className="text-xl">%</span>- </div>- </div>- </div>- </div>-- <p className="text-foreground-light text-sm max-w-2xl">- For best performance, ensure that the cache hit rate ratios above 99%. <br />{' '}- Consider upgrading to an instance with more memory if the ratios dip below 95%.- </p>- </div>- )}- </AccordionContent_Shadcn_>- </AccordionItem_Shadcn_>- </Accordion_Shadcn_>- )-}diff --git a/apps/studio/components/interfaces/SQLEditor/DiffActionBar.tsx b/apps/studio/components/interfaces/SQLEditor/DiffActionBar.tsxdeleted file mode 100644index 62622d183a3..00000000000--- a/apps/studio/components/interfaces/SQLEditor/DiffActionBar.tsx+++ /dev/null@@ -1,71 +0,0 @@-import {- Button,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from 'ui'--import { ChevronDown, CornerDownLeft, Loader2 } from 'lucide-react'-import { DiffType } from './SQLEditor.types'-import { getDiffTypeButtonLabel, getDiffTypeDropdownLabel } from './SQLEditor.utils'--type DiffActionBarProps = {- loading: boolean- selectedDiffType: DiffType- onChangeDiffType: (type: DiffType) => void- onAccept: () => void- onCancel: () => void-}--export const DiffActionBar = ({- loading,- selectedDiffType,- onChangeDiffType,- onAccept,- onCancel,-}: DiffActionBarProps) => {- return (- <>- <div className="flex items-center">- <Button- className="rounded-r-none"- type="primary"- size="tiny"- icon={loading && <Loader2 className="animate-spin" />}- iconRight={<CornerDownLeft size={12} strokeWidth={1.5} />}- onClick={onAccept}- >- {getDiffTypeButtonLabel(selectedDiffType)}- </Button>- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button- type="primary"- className="rounded-l-none border-l-0 px-[4px] py-[5px] flex"- icon={<ChevronDown />}- />- </DropdownMenuTrigger>- <DropdownMenuContent align="end" side="bottom">- {Object.values(DiffType)- .filter((diffType) => diffType !== selectedDiffType)- .map((diffType) => (- <DropdownMenuItem key={diffType} onClick={() => onChangeDiffType(diffType)}>- <p>{getDiffTypeDropdownLabel(diffType)}</p>- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- </div>- <Button- type="alternative"- size="tiny"- className="bg-brand-300 hover:bg-brand-400 dark:bg-brand-400 dark:hover:bg-brand-500 text-brand-600 group"- iconRight={<span className="dark:text-brand-500 group-hover:text-brand-600">ESC</span>}- onClick={onCancel}- >- Discard- </Button>- </>- )-}diff --git a/apps/studio/components/interfaces/Settings/Database/DatabaseConnectionNotices.tsx b/apps/studio/components/interfaces/Settings/Database/DatabaseConnectionNotices.tsxdeleted file mode 100644index 0bd005cebb1..00000000000--- a/apps/studio/components/interfaces/Settings/Database/DatabaseConnectionNotices.tsx+++ /dev/null@@ -1,82 +0,0 @@-import { ExternalLink } from 'lucide-react'--import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'-import { WarningIcon } from 'ui'--export const IPv4DeprecationNotice = () => {- return (- <Alert_Shadcn_ variant="warning">- <WarningIcon />- <AlertTitle_Shadcn_>- Direct database access is only available via IPv6-compatible networks.- </AlertTitle_Shadcn_>- <AlertDescription_Shadcn_ className="space-y-3">- <p>- We strongly recommend using connection pooling to connect to your database because it's- compatible with both IPv4 and IPv6 networks. You'll only need to change the connection- credentials that you're using in your application to the pooler's connection credentials.- </p>- <Button asChild type="default" icon={<ExternalLink />}>- <a- href="https://github.com/orgs/supabase/discussions/17817"- target="_blank"- rel="noreferrer"- >- Learn more- </a>- </Button>- </AlertDescription_Shadcn_>- </Alert_Shadcn_>- )-}--export const IPv4AddonDirectConnectionNotice = () => {- return (- <Alert_Shadcn_ variant="default">- <AlertTitle_Shadcn_>- Direct database connections are recommended if you're connecting with session mode.- </AlertTitle_Shadcn_>- <AlertDescription_Shadcn_ className="space-y-3">- <p>- If you are not connecting to the database from serverless environments, we strongly- recommend you connect to the database directly instead of using connection pooling for- lower latency.- </p>- <p>- Since your project has the IPv4 add on, you are not required to use the connection pooler- even if your network only supports IPv4.- </p>- <Button asChild type="default" icon={<ExternalLink />}>- <a- href="https://supabase.com/docs/guides/database/connecting-to-postgres#connection-pooler"- target="_blank"- rel="noreferrer"- >- Learn more- </a>- </Button>- </AlertDescription_Shadcn_>- </Alert_Shadcn_>- )-}--export const DefaultSessionModeNotice = () => {- return (- <Alert_Shadcn_ variant="warning">- <WarningIcon />- <AlertTitle_Shadcn_>You are not yet in Transaction mode.</AlertTitle_Shadcn_>- <AlertDescription_Shadcn_ className="space-y-3">- <p>- You need to set your <span className="text-foreground">Pool Mode</span> to{' '}- <span className="text-foreground">Transaction</span> in the{' '}- <span className="text-foreground">Connection pooling configuration</span> section below in- order to use transaction mode on port 6543.- </p>- <p>- Otherwise, port 6543 will continue to connect in{' '}- <span className="text-foreground">Session</span> mode.- </p>- </AlertDescription_Shadcn_>- </Alert_Shadcn_>- )-}diff --git a/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsx b/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsxdeleted file mode 100644index 6990f9f60d0..00000000000--- a/apps/studio/components/interfaces/Settings/Database/UsePoolerCheckbox.tsx+++ /dev/null@@ -1,192 +0,0 @@-import { ChevronDown } from 'lucide-react'-import Link from 'next/link'-import { useRouter } from 'next/router'-import { useState } from 'react'--import { useParams } from 'common'-import ShimmeringLoader from 'components/ui/ShimmeringLoader'-import { usePgBouncerStatus } from 'data/config/pgbouncer-enabled-query'-import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'-import { usePoolingConfigurationQuery } from 'data/database/pooling-configuration-query'-import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'-import { useDatabaseSettingsStateSnapshot } from 'state/database-settings'-import {- Badge,- Button,- Checkbox_Shadcn_,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuSeparator,- DropdownMenuTrigger,- Label_Shadcn_,- Separator,-} from 'ui'-import {- DropdownMenuRadioGroup,- DropdownMenuRadioItem,-} from 'ui/src/components/shadcn/ui/dropdown-menu'--interface UsePoolerCheckboxInterface {- id: string- checked: boolean- poolingMode: 'transaction' | 'session'- ipv4AddonAdded: boolean- onCheckedChange: (value: boolean) => void- onSelectPoolingMode: (mode: 'transaction' | 'session') => void-}--export const UsePoolerCheckbox = ({- id,- checked,- poolingMode = 'transaction',- ipv4AddonAdded,- onCheckedChange,- onSelectPoolingMode,-}: UsePoolerCheckboxInterface) => {- const router = useRouter()- const [open, setOpen] = useState(false)- const { ref: projectRef } = useParams()- const snap = useDatabaseSettingsStateSnapshot()- const state = useDatabaseSelectorStateSnapshot()-- const { data, isLoading, isSuccess } = usePoolingConfigurationQuery({ projectRef })- const { data: settings, isSuccess: isSuccessSettings } = useProjectSettingsV2Query({ projectRef })- const { data: pgBouncerStatus } = usePgBouncerStatus({ projectRef: projectRef })-- const isDatabaseSettingsPage = router.pathname.endsWith('/settings/database')- const poolingConfiguration = data?.find((x) => x.identifier === state.selectedDatabaseId)- const resolvesToIpV6 = settings?.db_ip_addr_config === 'ipv6'-- const onSelectOption = (value: 'session' | 'transaction') => {- onSelectPoolingMode(value)- setOpen(false)- }-- return (- <div className="flex flex-col gap-y-1">- <div className="flex gap-x-3 items-center">- <Checkbox_Shadcn_- id={`use-pooler-${id}`}- checked={checked}- onCheckedChange={() => onCheckedChange(!checked)}- />- <div className="-mt-[2px] flex flex-col gap-y-1 w-full">- <div className="flex items-center gap-x-4">- <div className="flex items-center gap-x-2">- <Label_Shadcn_ htmlFor={`use-pooler-${id}`} className="text-sm cursor-pointer">- Display connection pooler- </Label_Shadcn_>- {checked && (- <>- <div className="flex items-center gap-x-2">- {isLoading && <ShimmeringLoader className="w-[100px] py-2.5" />}- {isSuccess && (- <div className="flex items-center gap-x-1">- <DropdownMenu open={open} onOpenChange={setOpen}>- <DropdownMenuTrigger asChild>- <Button- type="outline"- className="py-0.5 pr-1.5 capitalize"- iconRight={<ChevronDown strokeWidth={1} />}- >- Mode: {poolingMode}- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent side="bottom" align="start" className="w-[280px]">- <DropdownMenuRadioGroup- value={poolingMode}- onValueChange={(value) =>- onSelectOption(value as 'session' | 'transaction')- }- >- <DropdownMenuRadioItem value="session">- Session mode- </DropdownMenuRadioItem>- {poolingConfiguration?.pool_mode === 'transaction' && (- <DropdownMenuRadioItem value="transaction">- Transaction mode- </DropdownMenuRadioItem>- )}- </DropdownMenuRadioGroup>-- {poolingConfiguration?.pool_mode === 'session' && (- <>- <DropdownMenuSeparator className="my-1" />- <div className="px-2 text-xs flex flex-col gap-y-2">- <p>- To use transaction mode, change the pool mode in the{' '}- {isDatabaseSettingsPage ? (- <span- tabIndex={0}- className="underline hover:text-foreground cursor-pointer transition"- onClick={() => {- const el = document.getElementById('connection-pooler')- if (el) {- setOpen(false)- el.scrollIntoView({- behavior: 'smooth',- block: 'center',- })- }- }}- >- pooling configuration settings- </span>- ) : (- <Link- href={`/project/${projectRef}/settings/database#connection-pooler`}- className="underline hover:text-foreground"- >- pooling configuration settings- </Link>- )}{' '}- to use transaction mode first.- </p>- <p>- You can then connect to session mode on port 5432 and- transaction mode on port 6543.- </p>- </div>- </>- )}-- <Separator className="my-1" />- <DropdownMenuItem- key="more-info"- onClick={() => {- setOpen(false)- snap.setShowPoolingModeHelper(true)- }}- >- How to choose pooling modes?- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- </div>- )}- </div>- </>- )}- </div>- <div className="flex items-center gap-x-1">- {isSuccess && checked && <Badge>Supavisor</Badge>}- {isSuccessSettings && (- <Badge>- {checked || ipv4AddonAdded- ? 'Resolves to IPv4'- : resolvesToIpV6- ? 'Resolves to IPv6'- : 'Will resolve to IPv6'}- </Badge>- )}- {pgBouncerStatus?.active && (- <Badge variant="warning">PgBouncer pending removal</Badge>- )}- </div>- </div>- </div>- </div>- </div>- )-}diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/EnablePhysicalBackupsModal.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/EnablePhysicalBackupsModal.tsxdeleted file mode 100644index 8d991bdf912..00000000000--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/EnablePhysicalBackupsModal.tsx+++ /dev/null@@ -1,142 +0,0 @@-import { ExternalLink, Loader2 } from 'lucide-react'-import { useState } from 'react'-import { toast } from 'sonner'--import { useParams } from 'common'-import { Markdown } from 'components/interfaces/Markdown'-import { useEnablePhysicalBackupsMutation } from 'data/database/enable-physical-backups-mutation'-import { useProjectDetailQuery } from 'data/projects/project-detail-query'-import { Region, useReadReplicaSetUpMutation } from 'data/read-replicas/replica-setup-mutation'-import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'-import type { AWS_REGIONS_KEYS } from 'shared-data'-import { AWS_REGIONS } from 'shared-data'-import {- Button,- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogSection,- DialogSectionSeparator,- DialogTitle,- DialogTrigger,-} from 'ui'-import { AVAILABLE_REPLICA_REGIONS } from './InstanceConfiguration.constants'-import { DocsButton } from 'components/ui/DocsButton'--interface EnablePhysicalBackupsModalProps {- selectedRegion: string-}--// [Joshen] Just FYI while this is not being used, i'm opting to leave this in as this is IMO an ideal UX-// Problem right now is that we can't immediately initiate a new replica request once the physical backups-// flag is flipped to true as RRs still need a physical backup to be completed before setting an RR up-// i.e This UX will immediately show an error when the create replica request is triggered.-export const EnablePhysicalBackupsModal = ({ selectedRegion }: EnablePhysicalBackupsModalProps) => {- const { ref } = useParams()- const [open, setOpen] = useState(false)- const [enabling, setEnabling] = useState(false)- const [refetchInterval, setRefetchInterval] = useState<number | false>(false)-- const { data: databases } = useReadReplicasQuery({ projectRef: ref })-- useProjectDetailQuery(- { ref },- {- refetchInterval,- refetchOnWindowFocus: false,- onSuccess: (data) => {- if (data.is_physical_backups_enabled) {- setRefetchInterval(false)- const regionKey = AWS_REGIONS[selectedRegion as AWS_REGIONS_KEYS].code-- if (ref === undefined) return toast.error('Project ref is required')- if (!regionKey)- return toast.error('Unable to deploy replica: Unsupported region selected')- const primary = databases?.find((db) => db.identifier === ref)- setUpReplica({- projectRef: ref,- region: regionKey as Region,- size: primary?.size ?? 't4g.small',- })- }- },- }- )-- const { mutate: enablePhysicalBackups, isLoading: isEnabling } = useEnablePhysicalBackupsMutation(- {- onSuccess: () => {- setEnabling(true)- setRefetchInterval(5000)- },- }- )-- const { mutate: setUpReplica } = useReadReplicaSetUpMutation({- onSuccess: () => {- const region = AVAILABLE_REPLICA_REGIONS.find((r) => r.key === selectedRegion)?.name- toast.success(`Spinning up new replica in ${region ?? ' Unknown'}...`)- setOpen(false)- },- onError: (error) => {- setEnabling(false)- toast.error(`Failed to deploy relica: ${error.message}`)- },- })-- return (- <Dialog open={open} onOpenChange={setOpen}>- <DialogTrigger asChild>- <Button type="primary">Deploy replica</Button>- </DialogTrigger>- <DialogContent>- <DialogHeader>- <DialogTitle>Physical backups are required to deploy replicas</DialogTitle>- <DialogDescription>- They are used under the hood to spin up read replicas for your project- </DialogDescription>- </DialogHeader>- <DialogSectionSeparator />- <DialogSection className="flex flex-col gap-y-2">- {enabling ? (- <>- <div className="flex items-center gap-x-3">- <Loader2 className="animate-spin" size={16} />- <p className="text-sm">Enabling physical backups</p>- </div>- <Markdown- content={`Please do not close the browser until this is completed. This will take a few minutes and your read replica will be deployed thereafter.`}- />- </>- ) : (- <>- <p className="text-sm">- Enabling physical backups will take a few minutes, after which your replica will be- deployed once completed.- </p>- <Markdown- content={`Do note that you will no longer be able to download your [scheduled backups](/projects/${ref}/database/backups/scheduled) once physical backups have been enabled for your project.`}- />- </>- )}- </DialogSection>- {!enabling && (- <DialogFooter>- <DocsButton href="https://supabase.com/docs/guides/platform/read-replicas#how-are-read-replicas-made" />- <Button- type="primary"- loading={isEnabling}- onClick={() => {- if (ref) enablePhysicalBackups({ ref })- }}- >- Enable physical backups- </Button>- </DialogFooter>- )}- </DialogContent>- </Dialog>- )-}diff --git a/apps/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/DefaultExplorerSelectionRenderer.tsx b/apps/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/DefaultExplorerSelectionRenderer.tsxdeleted file mode 100644index 739a5e559bb..00000000000--- a/apps/studio/components/interfaces/Settings/Logs/LogSelectionRenderers/DefaultExplorerSelectionRenderer.tsx+++ /dev/null@@ -1,49 +0,0 @@-import { LOGS_TAILWIND_CLASSES } from '../Logs.constants'-import { jsonSyntaxHighlight, SelectionDetailedRow } from '../LogsFormatters'--const DefaultExplorerSelectionRenderer = ({ log }: any) => {- const DetailedJsonRow = ({- label,- value,- code,- }: {- label: string- value: Object- code?: boolean- }) => {- return (- <div className="flex gap-2 flex-wrap">- <span className="text-foreground-lighter text-sm col-span-3">{label}</span>- <span- className={`text-foreground text-sm col-span-9 overflow-x-auto ${- code && 'text-xs font-mono'- }`}- >- <pre- dangerouslySetInnerHTML={{- __html: jsonSyntaxHighlight(value),- }}- />- </span>- </div>- )- }-- return (- <div className="overflow-hidden overflow-x-auto space-y-6">- {Object.entries(log).map(([key, value], index) => {- return (- <div key={`${key}-${index}`} className="px-4 pb-4">- {value && typeof value === 'object' ? (- <DetailedJsonRow label={key} value={value} />- ) : (- <SelectionDetailedRow label={key} value={value === null ? 'NULL ' : String(value)} />- )}- </div>- )- })}- </div>- )-}--export default DefaultExplorerSelectionRendererdiff --git a/apps/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx b/apps/studio/components/interfaces/Support/DisabledStateForFreeTier.tsxdeleted file mode 100644index bab90c347e0..00000000000--- a/apps/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { AlertCircle, ExternalLink } from 'lucide-react'-import Link from 'next/link'-import { Button } from 'ui'--import InformationBox from 'components/ui/InformationBox'--interface DisabledStateForFreeTierProps {- organizationSlug: string- category: string-}--const DisabledStateForFreeTier = ({- organizationSlug,- category,-}: DisabledStateForFreeTierProps) => {- return (- <div className="px-6">- <InformationBox- hideCollapse- defaultVisibility- icon={<AlertCircle className="text-foreground" size={20} strokeWidth={1.5} />}- title={`Support for ${category} is only available on the Pro Plan`}- description={- <div className="space-y-4 mb-1">- <p>Upgrade your organization to the Pro Plan for support in this area</p>- <div className="flex items-center space-x-2">- <Button asChild>- <Link href={`/org/${organizationSlug}/billing?panel=subscriptionPlan`}>- Upgrade plan- </Link>- </Button>- <Button asChild type="default" icon={<ExternalLink />}>- <Link href="https://supabase.com/pricing" target="_blank" rel="noreferrer">- About the Pro Plan- </Link>- </Button>- </div>- </div>- }- />- </div>- )-}--export default DisabledStateForFreeTierdiff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/index.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/index.tsdeleted file mode 100644index 910937bb1c7..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export { default as SidePanelEditor } from './SidePanelEditor'-export { default as RowEditor } from './RowEditor/RowEditor'-export { default as ColumnEditor } from './ColumnEditor/ColumnEditor'-export { default as TableEditor } from './TableEditor/TableEditor'-export { default as SpreadsheetImport } from './SpreadsheetImport/SpreadsheetImport'diff --git a/apps/studio/components/layouts/AppLayout/UserSettingsDropdown.tsx b/apps/studio/components/layouts/AppLayout/UserSettingsDropdown.tsxdeleted file mode 100644index 410b3c7504d..00000000000--- a/apps/studio/components/layouts/AppLayout/UserSettingsDropdown.tsx+++ /dev/null@@ -1,111 +0,0 @@-import { User } from 'lucide-react'-import Link from 'next/link'-import { useTheme } from 'next-themes'-import { useRouter } from 'next/router'-import { useState } from 'react'--import { useSignOut } from 'lib/auth'-import { useProfile } from 'lib/profile'-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuGroup,- DropdownMenuItem,- DropdownMenuLabel,- DropdownMenuRadioGroup,- DropdownMenuRadioItem,- DropdownMenuSeparator,- DropdownMenuShortcut,- DropdownMenuTrigger,- singleThemes,- Theme,-} from 'ui'-import { useSetCommandMenuOpen } from 'ui-patterns/CommandMenu'--const UserSettingsDropdown = () => {- const signOut = useSignOut()- const router = useRouter()- const [open, setOpen] = useState(false)- const { profile } = useProfile()- const setCommandMenuOpen = useSetCommandMenuOpen()- const { theme, setTheme } = useTheme()-- const onClickLogout = async () => {- await signOut()- await router.push('/sign-in')- }-- return (- <DropdownMenu open={open} onOpenChange={() => setOpen(!open)} modal={false}>- <DropdownMenuTrigger asChild>- <button- id="user-settings-dropdown"- className="flex items-center justify-center border font-bold rounded-full h-7 w-7 text-foreground-light bg-surface-100"- >- {profile?.first_name ? profile?.first_name?.[0] : <User size={14} strokeWidth={2} />}- </button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-60">- <DropdownMenuGroup>- <div key="profile" className="px-2 py-1.5">- <p className="text-sm text-foreground">- {profile?.first_name} {profile?.last_name}- </p>- <p className="text-sm text-foreground-light truncate">{profile?.primary_email}</p>- </div>-- <DropdownMenuSeparator />- <DropdownMenuItem className="cursor-pointer" onClick={() => setOpen(false)} asChild>- <Link href="/account/me">Preferences</Link>- </DropdownMenuItem>- <DropdownMenuItem className="cursor-pointer" onClick={() => setOpen(false)} asChild>- <Link href="/account/tokens">Access tokens</Link>- </DropdownMenuItem>-- <DropdownMenuItem className="cursor-pointer" onClick={() => setOpen(false)} asChild>- <Link href="/account/audit">Audit logs</Link>- </DropdownMenuItem>-- <DropdownMenuSeparator />- <DropdownMenuItem- className="cursor-pointer"- onSelect={() => {- setOpen(false)- setCommandMenuOpen(true)- }}- >- <span>Command menu</span>- <DropdownMenuShortcut>⌘K</DropdownMenuShortcut>- </DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuLabel>Theme</DropdownMenuLabel>- <DropdownMenuRadioGroup- value={theme}- onValueChange={(x) => {- setTheme(x)- }}- >- {singleThemes.map((theme: Theme) => (- <DropdownMenuRadioItem key={theme.value} value={theme.value}>- {theme.name}- </DropdownMenuRadioItem>- ))}- </DropdownMenuRadioGroup>-- <DropdownMenuSeparator />- <DropdownMenuItem- className="cursor-pointer"- onClick={() => {- onClickLogout()- setOpen(false)- }}- >- <span>Log out</span>- </DropdownMenuItem>- </DropdownMenuGroup>- </DropdownMenuContent>- </DropdownMenu>- )-}--export default UserSettingsDropdowndiff --git a/apps/studio/components/layouts/BillingLayout.tsx b/apps/studio/components/layouts/BillingLayout.tsxdeleted file mode 100644index 7ec010c7bfa..00000000000--- a/apps/studio/components/layouts/BillingLayout.tsx+++ /dev/null@@ -1,59 +0,0 @@-import Link from 'next/link'-import type { PropsWithChildren } from 'react'--import ProjectLayout from 'components/layouts/ProjectLayout/ProjectLayout'-import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'-import { useSelectedProject } from 'hooks/misc/useSelectedProject'-import { withAuth } from 'hooks/misc/withAuth'-import { X } from 'lucide-react'--export interface BillingLayoutProps {}--const BillingLayout = ({ children }: PropsWithChildren<BillingLayoutProps>) => {- const selectedOrganization = useSelectedOrganization()- const selectedProject = useSelectedProject()-- return (- <ProjectLayout hideHeader hideIconBar>- <div className="flex h-full w-full flex-col">- {/* Header */}- <div className="flex items-center space-x-4 border-b py-4 px-5 border-default">- <Link- href={`/org/${selectedOrganization?.slug}/billing`}- className="text-foreground-lighter transition-colors hover:text-foreground"- >- <X size={16} strokeWidth={1.5} />- </Link>- <div className="flex items-center space-x-6">- <h1 className="text-sm text-foreground">Customize your plan</h1>- <div className="h-6 w-px bg-selection"></div>- <div className="flex items-center space-x-3">- <p className="text-sm text-foreground-light">{selectedOrganization?.name}</p>- <span className="text-border-stronger">- <svg- viewBox="0 0 24 24"- width="16"- height="16"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- fill="none"- shapeRendering="geometricPrecision"- >- <path d="M16 3.549L7.12 20.600"></path>- </svg>- </span>- <p className="text-sm text-foreground-light">{selectedProject?.name}</p>- </div>- </div>- </div>- <div className="overflow-auto">- <section className="relative">{children}</section>- </div>- </div>- </ProjectLayout>- )-}--export default withAuth(BillingLayout)diff --git a/apps/studio/components/layouts/LogsLayout/LogsMenu.utils.ts b/apps/studio/components/layouts/LogsLayout/LogsMenu.utils.tsdeleted file mode 100644index 80d84450fb0..00000000000--- a/apps/studio/components/layouts/LogsLayout/LogsMenu.utils.ts+++ /dev/null@@ -1,92 +0,0 @@-import type {- ProductMenuGroup,- ProductMenuGroupItem,-} from 'components/ui/ProductMenu/ProductMenu.types'-import type { Project } from 'data/projects/project-detail-query'-import { IS_PLATFORM } from 'lib/constants'--export const generateLogsMenu = (- project?: Project,- features?: { auth?: boolean; storage?: boolean; realtime?: boolean }-): ProductMenuGroup[] => {- const ref = project?.ref ?? 'default'-- const authEnabled = features?.auth ?? true- const storageEnabled = features?.storage ?? true- const realtimeEnabled = features?.realtime ?? true-- return [- {- title: 'Explorer',- items: (- [- { key: 'explorer', name: 'Query', root: true },- IS_PLATFORM ? { key: 'saved', name: 'Saved Queries' } : null,- { key: 'recent', name: 'Recent Queries' },- IS_PLATFORM ? { key: 'templates', name: 'Templates' } : null,- ].filter((item) => item) as { name: string; key: string; root: boolean }[]- ).map(({ key, name, root }) => ({- name,- key,- url: `/project/${ref}/logs/explorer${root ? '' : '/' + key}`,- items: [],- })),- },- {- title: 'Infrastructure Logs',- items: [- {- name: 'API Gateway',- key: 'edge-logs',- url: `/project/${ref}/logs/edge-logs`,- items: [],- },- {- name: 'Postgres',- key: 'postgres-logs',- url: `/project/${ref}/logs/postgres-logs`,- items: [],- },- {- name: 'PostgREST',- key: 'postgrest-logs',- url: `/project/${ref}/logs/postgrest-logs`,- items: [],- },- IS_PLATFORM- ? {- name: 'Pooler',- key: 'pooler-logs',- url: `/project/${ref}/logs/pooler-logs`,- items: [],- }- : null,- ,- authEnabled- ? {- name: 'Auth',- key: 'auth-logs',- url: `/project/${ref}/logs/auth-logs`,- items: [],- }- : null,- storageEnabled- ? {- name: 'Storage',- key: 'storage-logs',- url: `/project/${ref}/logs/storage-logs`,- items: [],- }- : null,- realtimeEnabled- ? {- name: 'Realtime',- key: 'realtime-logs',- url: `/project/${ref}/logs/realtime-logs`,- items: [],- }- : null,- ].filter((item) => item) as ProductMenuGroupItem[],- },- ]-}diff --git a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.utils.ts b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.utils.tsdeleted file mode 100644index f11d4973e29..00000000000--- a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.utils.ts+++ /dev/null@@ -1,23 +0,0 @@-import { uniq } from 'lodash'--export const selectItemsInRange = (id: string, snippets: any[], selectedSnippets: string[]) => {- const lastSelectedItemIndex = snippets.findIndex(- (x) => x.id === selectedSnippets[selectedSnippets.length - 1]- )- const selectedItemIndex = snippets.findIndex((x) => x.id === id)-- // Get the start and end index of the range to select- const start = Math.min(selectedItemIndex, lastSelectedItemIndex)- const end = Math.max(selectedItemIndex, lastSelectedItemIndex)-- // Get the range to select and reverse the order if necessary- const rangeToSelect = snippets.slice(start, end + 1)- if (selectedItemIndex < lastSelectedItemIndex) rangeToSelect.reverse()-- if (selectedSnippets.includes(id)) {- const rangeToDeselectIds = rangeToSelect.map((item) => item.id)- return selectedSnippets.filter((x) => x === id || !rangeToDeselectIds.includes(x))- } else {- return uniq(selectedSnippets.concat(rangeToSelect.map((x) => x.id) as string[]))- }-}diff --git a/apps/studio/components/layouts/SettingsLayout/AccountSettingsMenu.tsx b/apps/studio/components/layouts/SettingsLayout/AccountSettingsMenu.tsxdeleted file mode 100644index 7cdccd89f38..00000000000--- a/apps/studio/components/layouts/SettingsLayout/AccountSettingsMenu.tsx+++ /dev/null@@ -1,31 +0,0 @@-import { compact } from 'lodash'-import { useRouter } from 'next/router'-import SettingsMenuItem from './SettingsMenuItem'--const AccountSettingsMenu = () => {- const router = useRouter()- const accountSettings = compact([- { label: 'Preferences', pathname: `/account/me` },- { label: 'Access Tokens', pathname: `/account/tokens` },- { label: 'Security', pathname: `/account/security` },- { label: 'Audit logs', pathname: `/account/audit` },- ])-- return (- <div className="space-y-10">- <div className="space-y-2">- <p className="text-sm font-medium">Account Settings</p>- {accountSettings.map((link) => (- <SettingsMenuItem- key={link.label}- label={link.label}- href={link.pathname}- isActive={link.pathname === router.pathname}- />- ))}- </div>- </div>- )-}--export default AccountSettingsMenudiff --git a/apps/studio/components/layouts/SettingsLayout/OrganizationSettingsMenu.tsx b/apps/studio/components/layouts/SettingsLayout/OrganizationSettingsMenu.tsxdeleted file mode 100644index fa763de6201..00000000000--- a/apps/studio/components/layouts/SettingsLayout/OrganizationSettingsMenu.tsx+++ /dev/null@@ -1,40 +0,0 @@-import { useRouter } from 'next/router'--import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'-import SettingsMenuItem from './SettingsMenuItem'--const OrganizationSettingsMenu = () => {- const router = useRouter()- const organization = useSelectedOrganization()- const organizationSettings = [- { label: 'General', pathname: `/org/[slug]/general` },- { label: 'Members', pathname: `/org/[slug]/team` },- { label: 'Integrations', pathname: `/org/[slug]/integrations` },- { label: 'Billing', pathname: `/org/[slug]/billing` },- { label: 'Usage', pathname: `/org/[slug]/usage` },- { label: 'Invoices', pathname: `/org/[slug]/invoices` },- { label: 'OAuth Apps', pathname: `/org/[slug]/apps` },- { label: 'Audit Logs', pathname: `/org/[slug]/audit` },- { label: 'Legal Documents', pathname: `/org/[slug]/documents` },- ]-- return (- <div className="space-y-10">- <div className="space-y-2">- <p className="text-sm font-medium">Organization</p>- {organizationSettings.map((link) => (- <SettingsMenuItem- key={link.label}- label={link.label}- href={- organization !== undefined ? link.pathname.replace('[slug]', organization.slug) : '/'- }- isActive={link.pathname === router.pathname}- />- ))}- </div>- </div>- )-}--export default OrganizationSettingsMenudiff --git a/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsx b/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsxdeleted file mode 100644index a0c483203da..00000000000--- a/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsx+++ /dev/null@@ -1,31 +0,0 @@-import { useParams } from 'common'-import { useRouter } from 'next/router'-import { PropsWithChildren } from 'react'--import AppLayout from '../AppLayout/AppLayout'-import AccountSettingsMenu from './AccountSettingsMenu'-import OrganizationSettingsMenu from './OrganizationSettingsMenu'--const SettingsLayout = ({ children }: PropsWithChildren<{}>) => {- const router = useRouter()- const { ref, slug } = useParams()-- return (- <AppLayout>- <div className="flex h-full">- {router.pathname !== '/projects' && (- <div className="h-full overflow-y-auto min-w-[280px] border-r px-8 py-8">- {slug === undefined && ref === undefined ? (- <AccountSettingsMenu />- ) : (- <OrganizationSettingsMenu />- )}- </div>- )}- <div className="h-full overflow-y-auto flex-grow">{children}</div>- </div>- </AppLayout>- )-}--export default SettingsLayoutdiff --git a/apps/studio/components/layouts/SettingsLayout/SettingsMenuItem.tsx b/apps/studio/components/layouts/SettingsLayout/SettingsMenuItem.tsxdeleted file mode 100644index ce68295607d..00000000000--- a/apps/studio/components/layouts/SettingsLayout/SettingsMenuItem.tsx+++ /dev/null@@ -1,27 +0,0 @@-import Link from 'next/link'--import { cn } from 'ui'--interface SettingsMenuItemProps {- href: string- label: string- isActive: boolean-}--const SettingsMenuItem = ({ href, label, isActive }: SettingsMenuItemProps) => {- return (- <div>- <Link- href={href}- className={cn(- 'text-sm',- isActive ? 'text-foreground' : 'text-foreground-light hover:text-foreground transition'- )}- >- {label}- </Link>- </div>- )-}--export default SettingsMenuItemdiff --git a/apps/studio/components/ui/AIAssistantPanel/ContextBadge.tsx b/apps/studio/components/ui/AIAssistantPanel/ContextBadge.tsxdeleted file mode 100644index ba205b176e0..00000000000--- a/apps/studio/components/ui/AIAssistantPanel/ContextBadge.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { X } from 'lucide-react'-import { ReactNode } from 'react'-import { Tooltip_Shadcn_, TooltipContent_Shadcn_, TooltipTrigger_Shadcn_ } from 'ui'--interface ContextBadgeProps {- label: string- value: string- tooltip?: ReactNode- onRemove?: () => void-}--export const ContextBadge = ({ label, value, tooltip, onRemove }: ContextBadgeProps) => {- return (- <Tooltip_Shadcn_>- <TooltipTrigger_Shadcn_ asChild>- <div className="border bg-surface-200 rounded px-2 py-1 flex items-center justify-between gap-x-2">- <div className="flex items-center gap-x-1">- <span className="text-foreground-lighter text-xs">{label}</span>- <span className="text-xs">{value}</span>- </div>- {onRemove !== undefined && (- <X- size={12}- className="text-foreground-light hover:text-foreground transition cursor-pointer"- onClick={() => onRemove()}- />- )}- </div>- </TooltipTrigger_Shadcn_>- {tooltip !== undefined && <TooltipContent_Shadcn_>{tooltip}</TooltipContent_Shadcn_>}- </Tooltip_Shadcn_>- )-}diff --git a/apps/studio/components/ui/AIAssistantPanel/DropdownScrollArea.tsx b/apps/studio/components/ui/AIAssistantPanel/DropdownScrollArea.tsxdeleted file mode 100644index 1bbe09c0190..00000000000--- a/apps/studio/components/ui/AIAssistantPanel/DropdownScrollArea.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { PropsWithChildren, useEffect } from 'react'-import { ScrollArea } from 'ui'--interface DropdownScrollAreaProps {- id?: string- className?: string-}--// [Joshen] This is a temporary solution to a really odd behavior i've observed with the components in Shadcn-// Specifically if we're using a ScrollArea (or even just anything with overflow) within a DropdownMenu, within a Sheet-// The mouse wheel event to scroll in the ScrollArea is somehow getting ignored in this specific context, hence the fix here--export const DropdownScrollArea = ({- id,- className,- children,-}: PropsWithChildren<DropdownScrollAreaProps>) => {- useEffect(() => {- const scrollFix = (e: WheelEvent) => e.stopPropagation()-- if (id) {- const el = document.getElementById(id)- if (el) {- el.addEventListener('wheel', scrollFix, { passive: false })- return () => el.removeEventListener('wheel', scrollFix)- }- }- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [])-- return (- <ScrollArea id={id} className={className}>- {children}- </ScrollArea>- )-}diff --git a/apps/studio/components/ui/AIAssistantPanel/EntitiesDropdownMenu.tsx b/apps/studio/components/ui/AIAssistantPanel/EntitiesDropdownMenu.tsxdeleted file mode 100644index f2120c27ca3..00000000000--- a/apps/studio/components/ui/AIAssistantPanel/EntitiesDropdownMenu.tsx+++ /dev/null@@ -1,110 +0,0 @@-import { debounce } from 'lodash'-import { Check, Loader2, Search } from 'lucide-react'-import { useCallback, useState } from 'react'--import { useEntityTypesQuery } from 'data/entity-types/entity-types-infinite-query'-import { useSelectedProject } from 'hooks/misc/useSelectedProject'-import {- Command_Shadcn_,- CommandEmpty_Shadcn_,- CommandGroup_Shadcn_,- CommandItem_Shadcn_,- CommandList_Shadcn_,-} from 'ui'-import { Admonition } from 'ui-patterns'-import { Input } from 'ui-patterns/DataInputs/Input'-import { DropdownScrollArea } from './DropdownScrollArea'--interface EntitiesDropdownMenuProps {- selectedSchemas: string[]- selectedEntities: readonly { schema: string; name: string }[]- onToggleEntity: (value: { schema: string; name: string }) => void-}--export const EntitiesDropdownMenu = ({- selectedSchemas,- selectedEntities,- onToggleEntity,-}: EntitiesDropdownMenuProps) => {- const project = useSelectedProject()- const [search, setSearch] = useState('')-- // [Joshen] Not gonna do infinite loading here, but rather just try to load sufficient tables- // I reckon users will opt to just search if there's many tables here given the small real estate- const {- data: entitiesData,- error,- isLoading,- isFetching,- isError,- } = useEntityTypesQuery({- projectRef: project?.ref,- connectionString: project?.connectionString,- schemas: selectedSchemas,- limit: 100,- search: search.length === 0 ? undefined : search,- })- const entities = (- entitiesData?.pages[0].data.entities ? [...entitiesData?.pages[0].data.entities] : []- ).sort((a, b) => (a.name > b.name ? 0 : -1))-- // eslint-disable-next-line react-hooks/exhaustive-deps- const searchInputHandler = useCallback(debounce(setSearch, 1000), [])-- if (isError) {- return (- <Admonition- type="default"- className="m-0 rounded-none border-0 [&>h5]:text-xs [&>div]:text-xs"- showIcon={false}- title="Failed to retrieve tables"- description={`Error: ${(error as any)?.message ?? 'Unknown'}`}- />- )- }-- return (- <Command_Shadcn_>- <CommandList_Shadcn_>- {/* Separate input for async searching */}- <Input- autoFocus- placeholder="Find table..."- icon={<Search size={14} />}- className="text-xs outline-none rounded-b-none border-0 border-b pl-9 pr-7"- onChange={(e) => searchInputHandler(e.target.value)}- actions={- (isLoading || isFetching) && (- <Loader2 key="hint" size={14} className="mr-1 animate-spin" />- )- }- />- <CommandEmpty_Shadcn_>No tables found</CommandEmpty_Shadcn_>- <CommandGroup_Shadcn_>- <DropdownScrollArea- id="tables-scroll"- className={(entities || []).length > 7 ? 'h-[210px]' : ''}- >- {entities?.map((entity) => (- <CommandItem_Shadcn_- key={entity.id}- value={entity.id.toString()}- className="justify-between"- onSelect={() => onToggleEntity({ schema: entity.schema, name: entity.name })}- onClick={() => onToggleEntity({ schema: entity.schema, name: entity.name })}- >- <span className="flex gap-x-1">- <span className="text-foreground-lighter">{entity.schema}</span>- <span>{entity.name}</span>- </span>- {selectedEntities.find(- (x) => x.name === entity.name && x.schema === entity.schema- ) && <Check className="text-brand" strokeWidth={2} size={16} />}- </CommandItem_Shadcn_>- ))}- </DropdownScrollArea>- </CommandGroup_Shadcn_>- </CommandList_Shadcn_>- </Command_Shadcn_>- )-}diff --git a/apps/studio/components/ui/AIAssistantPanel/SchemasDropdownMenu.tsx b/apps/studio/components/ui/AIAssistantPanel/SchemasDropdownMenu.tsxdeleted file mode 100644index 6db2472077c..00000000000--- a/apps/studio/components/ui/AIAssistantPanel/SchemasDropdownMenu.tsx+++ /dev/null@@ -1,61 +0,0 @@-import {- cn,- Command_Shadcn_,- CommandEmpty_Shadcn_,- CommandGroup_Shadcn_,- CommandInput_Shadcn_,- CommandItem_Shadcn_,- CommandList_Shadcn_,-} from 'ui'-import { DropdownScrollArea } from './DropdownScrollArea'-import { Check } from 'lucide-react'-import { useSchemasQuery } from 'data/database/schemas-query'-import { useSelectedProject } from 'hooks/misc/useSelectedProject'--interface SchemasDropdownMenuProps {- selectedSchemas: string[]- onToggleSchema: (schema: string) => void-}--export const SchemasDropdownMenu = ({- selectedSchemas,- onToggleSchema,-}: SchemasDropdownMenuProps) => {- const project = useSelectedProject()-- const { data: schemaDatas } = useSchemasQuery({- projectRef: project?.ref,- connectionString: project?.connectionString,- })- const schemas = (schemaDatas || []).sort((a, b) => a.name.localeCompare(b.name))-- return (- <Command_Shadcn_>- <CommandInput_Shadcn_ autoFocus placeholder="Find schema..." />- <CommandList_Shadcn_>- <CommandEmpty_Shadcn_>No schemas found</CommandEmpty_Shadcn_>- <CommandGroup_Shadcn_>- <DropdownScrollArea- id="schema-scroll"- className={cn((schemas || []).length > 7 ? 'h-[210px]' : '')}- >- {schemas?.map((schema) => (- <CommandItem_Shadcn_- key={schema.id}- value={schema.id.toString()}- className="justify-between"- onSelect={() => onToggleSchema(schema.name)}- onClick={() => onToggleSchema(schema.name)}- >- {schema.name}- {selectedSchemas.includes(schema.name) && (- <Check className="text-brand" strokeWidth={2} size={16} />- )}- </CommandItem_Shadcn_>- ))}- </DropdownScrollArea>- </CommandGroup_Shadcn_>- </CommandList_Shadcn_>- </Command_Shadcn_>- )-}diff --git a/apps/studio/components/ui/Charts/EmptyState.tsx b/apps/studio/components/ui/Charts/EmptyState.tsxdeleted file mode 100644index 39888e06666..00000000000--- a/apps/studio/components/ui/Charts/EmptyState.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { BarChart2 } from 'lucide-react'--interface EmptyStateProps {- title?: string- message?: string-}--const EmptyState = ({- title = 'No data to show',- message = 'May take 24 hours for data to show',-}: EmptyStateProps) => (- <div- className="- flex h-full- w-full flex-col items-center- justify-center space-y-2 border- border-dashed border-control py-4 text-center- "- >- <BarChart2 size={20} className="text-foreground-light" />- <div>- <p className="text-xs text-foreground-light">{title}</p>- <p className="text-xs text-foreground-light">{message}</p>- </div>- </div>-)--export default EmptyStatediff --git a/apps/studio/components/ui/ProjectPausedAlert.tsx b/apps/studio/components/ui/ProjectPausedAlert.tsxdeleted file mode 100644index 4a51e510a73..00000000000--- a/apps/studio/components/ui/ProjectPausedAlert.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { AlertCircle } from 'lucide-react'-import Link from 'next/link'-import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'--export const ProjectPausedAlert = ({- title = 'Project is paused',- description = 'Restore this project to continue',- projectRef,-}: {- title?: string- description?: string- projectRef?: string-}) => {- return (- <Alert_Shadcn_ variant="warning">- <AlertCircle />- <AlertTitle_Shadcn_>{title}</AlertTitle_Shadcn_>- <AlertDescription_Shadcn_>{description}</AlertDescription_Shadcn_>- {projectRef && (- <div>- <Button asChild type="default" className="mt-3">- <Link href={`/project/${projectRef}`}>Restore project</Link>- </Button>- </div>- )}- </Alert_Shadcn_>- )-}diff --git a/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.ts b/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.tsdeleted file mode 100644index adf6e022c8d..00000000000--- a/apps/studio/data/analytics/warehouse-access-tokens-create-mutation.ts+++ /dev/null@@ -1,65 +0,0 @@-import { UseMutationOptions, useMutation, useQueryClient } from '@tanstack/react-query'-import { handleError, post } from 'data/fetchers'-import { toast } from 'sonner'-import { ResponseError } from 'types'-import { analyticsKeys } from './keys'--type WarehouseAccessTokenCreateVariables = {- ref: string- description: string-}--/**- * This will be deprecated or rewritten in favor of the new project API keys- */-async function createWarehouseAccessToken({- ref,- description,-}: WarehouseAccessTokenCreateVariables) {- // TODO: remove type cast when fetcher fn params are typed- const { data, error } = await post(`/platform/projects/{ref}/analytics/warehouse/access-tokens`, {- params: {- path: { ref },- },- body: { description },- } as any)-- if (error) handleError(error)-- return data-}--type WarehouseAccessTokenUpdateData = Awaited<ReturnType<typeof createWarehouseAccessToken>>--export function useCreateWarehouseAccessToken({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<- WarehouseAccessTokenUpdateData,- ResponseError,- WarehouseAccessTokenCreateVariables- >,- 'mutationFn'-> = {}) {- const queryClient = useQueryClient()-- return useMutation(- (payload: WarehouseAccessTokenCreateVariables) => createWarehouseAccessToken(payload),- {- async onSuccess(data, vars, context) {- await queryClient.invalidateQueries(analyticsKeys.warehouseAccessTokens(vars.ref))- await onSuccess?.(data, vars, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to create token: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- }- )-}diff --git a/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.ts b/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.tsdeleted file mode 100644index bbecb6d4855..00000000000--- a/apps/studio/data/analytics/warehouse-access-tokens-delete-mutation.ts+++ /dev/null@@ -1,58 +0,0 @@-import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { del, handleError } from 'data/fetchers'-import { toast } from 'sonner'-import type { ResponseError } from 'types'-import { analyticsKeys } from './keys'--export type DeleteAccessTokenArgs = {- projectRef: string- token: string-}-/**- * This will be deprecated or rewritten in favor of the new project API keys- */-export async function deleteWarehouseAccessToken({ projectRef, token }: DeleteAccessTokenArgs) {- const { data, error } = await del(- '/platform/projects/{ref}/analytics/warehouse/access-tokens/{token}',- {- params: { path: { ref: projectRef, token } } as any,- }- )-- if (error) handleError(error)- return data-}--type DeleteAccessTokenData = Awaited<ReturnType<typeof deleteWarehouseAccessToken>>--export const useDeleteWarehouseAccessToken = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<DeleteAccessTokenData, ResponseError, DeleteAccessTokenArgs>,- 'mutationFn'-> = {}) => {- const queryClient = useQueryClient()-- return useMutation<DeleteAccessTokenData, ResponseError, DeleteAccessTokenArgs>(- (vars) => deleteWarehouseAccessToken(vars),- {- async onSuccess(data, variables, context) {- const { projectRef } = variables-- await queryClient.invalidateQueries(analyticsKeys.warehouseAccessTokens(projectRef))-- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to delete access token: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- }- )-}diff --git a/apps/studio/data/analytics/warehouse-backends-query.ts b/apps/studio/data/analytics/warehouse-backends-query.tsdeleted file mode 100644index f8dd9a2f9ab..00000000000--- a/apps/studio/data/analytics/warehouse-backends-query.ts+++ /dev/null@@ -1,49 +0,0 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'-import { analyticsKeys } from './keys'-import { get } from 'data/fetchers'-import { ResponseError } from 'types'--export type WarehouseBackendsVariables = {- projectRef: string-}--export async function getWarehouseBackends(- { projectRef }: WarehouseBackendsVariables,- signal?: AbortSignal-) {- if (!projectRef) {- throw new Error('projectRef is required')- }-- // [Jordi] Commented out since its not needed for now and it will throw an error-- // const response = await get(`/platform/projects/{ref}/analytics/warehouse/backends`, {- // params: { path: { ref: projectRef } },- // signal,- // })-- // if (response.error) {- // throw response.error- // }-- // return response-}--export type WarehouseBackendsData = Awaited<ReturnType<typeof getWarehouseBackends>>-export type WarehouseBackendsError = ResponseError--export const useWarehouseBackendsQuery = <TData = WarehouseBackendsData>(- { projectRef }: WarehouseBackendsVariables,- {- enabled = true,- ...options- }: UseQueryOptions<WarehouseBackendsData, WarehouseBackendsError, TData> = {}-) =>- useQuery<WarehouseBackendsData, WarehouseBackendsError, TData>(- analyticsKeys.warehouseBackends(projectRef),- ({ signal }) => getWarehouseBackends({ projectRef }, signal),- {- enabled: enabled && typeof projectRef !== 'undefined',- ...options,- }- )diff --git a/apps/studio/data/analytics/warehouse-endpoints-query.ts b/apps/studio/data/analytics/warehouse-endpoints-query.tsdeleted file mode 100644index 562c4d9fe3b..00000000000--- a/apps/studio/data/analytics/warehouse-endpoints-query.ts+++ /dev/null@@ -1,51 +0,0 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'-import { analyticsKeys } from './keys'-import { get } from 'data/fetchers'--export type WarehouseEndpointsVariables = {- projectRef: string-}--export type WarehouseEndpointsResponse = any--export async function getWarehouseEndpoints(- { projectRef }: WarehouseEndpointsResponse,- signal?: AbortSignal-) {- if (!projectRef) {- throw new Error('projectRef is required')- }-- // [Jordi]: commented out because it's not used yet and will throw an error-- // const response = await get<WarehouseEndpointsResponse>(- // '/projects/{ref}/analytics/warehouse/endpoints',- // {- // params: { path: { ref: projectRef } },- // }- // )- // if (response.error) {- // throw response.error- // }-- // return response-}--export type WarehouseEndpointsData = Awaited<ReturnType<typeof getWarehouseEndpoints>>-export type WarehouseEndpointsError = unknown--export const useWarehouseEndpointsQuery = <TData = WarehouseEndpointsData>(- { projectRef }: WarehouseEndpointsVariables,- {- enabled = true,- ...options- }: UseQueryOptions<WarehouseEndpointsData, WarehouseEndpointsError, TData> = {}-) =>- useQuery<WarehouseEndpointsData, WarehouseEndpointsError, TData>(- analyticsKeys.warehouseEndpoints(projectRef),- ({ signal }) => getWarehouseEndpoints({ projectRef }, signal),- {- enabled: enabled && typeof projectRef !== 'undefined',- ...options,- }- )diff --git a/apps/studio/data/api-settings/remove-public-schema-from-expose-and-disable-pg_graphql-mutation.ts b/apps/studio/data/api-settings/remove-public-schema-from-expose-and-disable-pg_graphql-mutation.tsdeleted file mode 100644index 6644e2f4f5e..00000000000--- a/apps/studio/data/api-settings/remove-public-schema-from-expose-and-disable-pg_graphql-mutation.ts+++ /dev/null@@ -1,105 +0,0 @@-import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { toast } from 'sonner'--import { configKeys } from 'data/config/keys'-import { databaseExtensionsKeys } from 'data/database-extensions/keys'-import { del, handleError, patch } from 'data/fetchers'-import type { ResponseError } from 'types'--export type RemovePublicSchemaAndDisablePgGraphqlVariables = {- projectRef: string- connectionString?: string- existingPostgrestConfig: {- db_pool: any- max_rows: number- db_extra_search_path: string- db_schema: string- }-}--export async function removePublicFromExposedSchemasAndDisablePgGraphql({- projectRef,- connectionString,- existingPostgrestConfig,-}: RemovePublicSchemaAndDisablePgGraphqlVariables) {- const { db_extra_search_path, db_pool, db_schema, max_rows } = existingPostgrestConfig- const updatedDbExtraSearchPath = db_extra_search_path- .split(', ')- .filter((x) => x !== 'public')- .join(', ')- const updatedDbSchema = db_schema- .split(', ')- .filter((x) => x !== 'public')- .join(', ')-- const { error: configError } = await patch('/platform/projects/{ref}/config/postgrest', {- params: { path: { ref: projectRef } },- body: {- db_pool,- max_rows,- db_extra_search_path: updatedDbExtraSearchPath,- db_schema: updatedDbSchema,- },- })-- if (configError) handleError(configError)-- let headers = new Headers()- if (connectionString) headers.set('x-connection-encrypted', connectionString)- const { error: extensionsError } = await del('/platform/pg-meta/{ref}/extensions', {- params: {- header: { 'x-connection-encrypted': connectionString! },- path: { ref: projectRef },- query: { id: 'pg_graphql' },- },- headers,- })-- if (extensionsError) handleError(extensionsError)-- return true-}--type RemovePublicSchemaAndDisablePgGraphqlData = Awaited<- ReturnType<typeof removePublicFromExposedSchemasAndDisablePgGraphql>->--export const useRemovePublicSchemaAndDisablePgGraphqlMutation = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<- RemovePublicSchemaAndDisablePgGraphqlData,- ResponseError,- RemovePublicSchemaAndDisablePgGraphqlVariables- >,- 'mutationFn'-> = {}) => {- const queryClient = useQueryClient()-- return useMutation<- RemovePublicSchemaAndDisablePgGraphqlData,- ResponseError,- RemovePublicSchemaAndDisablePgGraphqlVariables- >((vars) => removePublicFromExposedSchemasAndDisablePgGraphql(vars), {- async onSuccess(data, variables, context) {- const { projectRef } = variables- await Promise.all([- queryClient.invalidateQueries(configKeys.postgrest(projectRef)),- queryClient.invalidateQueries(databaseExtensionsKeys.list(projectRef)),- ])- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(- `Failed to remove public schema and disable pg_graphql extension: ${data.message}`- )- } else {- onError(data, variables, context)- }- },- ...options,- })-}diff --git a/apps/studio/data/config/pgbouncer-enabled-query.ts b/apps/studio/data/config/pgbouncer-enabled-query.tsdeleted file mode 100644index 74606a2eace..00000000000--- a/apps/studio/data/config/pgbouncer-enabled-query.ts+++ /dev/null@@ -1,41 +0,0 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'--import { get, handleError } from 'data/fetchers'-import { IS_PLATFORM } from 'lib/constants'-import type { ResponseError } from 'types'-import { configKeys } from './keys'--type PgBouncerVariables = {- projectRef?: string-}--// This API call describes whether PgBouncer is still present on the instance. Eventually PgBouncer will be removed.-export async function getPgBouncerStatus({ projectRef }: PgBouncerVariables, signal?: AbortSignal) {- if (projectRef === undefined) throw new Error('Project ref is required')-- const { data, error } = await get('/platform/projects/{ref}/config/pgbouncer/status', {- params: { path: { ref: projectRef } },- })-- if (error) handleError(error)- return data-}--export type PgBouncerStatusData = Awaited<ReturnType<typeof getPgBouncerStatus>>-export type PgBouncerStatusError = ResponseError--export const usePgBouncerStatus = <TData = PgBouncerStatusData>(- { projectRef }: PgBouncerVariables,- {- enabled = true,- ...options- }: UseQueryOptions<PgBouncerStatusData, PgBouncerStatusError, TData> = {}-) =>- useQuery<PgBouncerStatusData, PgBouncerStatusError, TData>(- configKeys.pgBouncerStatus(projectRef),- ({ signal }) => getPgBouncerStatus({ projectRef }, signal),- {- enabled: enabled && IS_PLATFORM && typeof projectRef !== 'undefined',- ...options,- }- )diff --git a/apps/studio/data/database/entity-definition-query.ts b/apps/studio/data/database/entity-definition-query.tsdeleted file mode 100644index ad960f55f1b..00000000000--- a/apps/studio/data/database/entity-definition-query.ts+++ /dev/null@@ -1,137 +0,0 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'--import { SupportedAssistantEntities } from 'components/ui/AIAssistantPanel/AIAssistant.types'-import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query'-import { databaseKeys } from './keys'--const generatePolicyDefinition = (policy: {- command: string- name: string- permissive: string- roles: string- schema: string- table: string- qual: string | null- with_check: string | null-}) => {- const roles = policy.roles.replace('{', '').replace('}', '').split(',')-- return `-CREATE POLICY "${policy.name}" on "${policy.schema}"."${policy.table}" AS ${policy.permissive} FOR ${policy.command} TO ${roles.join(', ')} ${policy.qual ? `USING (${policy.qual})` : ''} ${policy.with_check ? `WITH CHECK (${policy.with_check})` : ''};`.trim()-}--// [Joshen] Eventually should support table definition and view definition as well if possible-export const getEntityDefinitionSql = ({- id,- type,-}: {- id?: number- type?: SupportedAssistantEntities | 'table' | 'view' | null-}) => {- if (!id) {- throw new Error('id is required')- }- if (!type) {- throw new Error('type is required')- }-- switch (type) {- case 'functions':- return /* SQL */ `- select pg_get_functiondef(${id})- `.trim()- case 'rls-policies':- return /* SQL */ `- SELECT- n.nspname AS schema,- c.relname AS table,- pol.polname AS name,- CASE- WHEN pol.polpermissive THEN 'PERMISSIVE'::text- ELSE 'RESTRICTIVE'::text- END AS permissive,- CASE- WHEN pol.polroles = '{0}'::oid[] THEN string_to_array('public'::text, ''::text)::name[]- ELSE ARRAY( SELECT pg_authid.rolname- FROM pg_authid- WHERE pg_authid.oid = ANY (pol.polroles)- ORDER BY pg_authid.rolname)- END AS roles,- CASE pol.polcmd- WHEN 'r'::"char" THEN 'SELECT'::text- WHEN 'a'::"char" THEN 'INSERT'::text- WHEN 'w'::"char" THEN 'UPDATE'::text- WHEN 'd'::"char" THEN 'DELETE'::text- WHEN '*'::"char" THEN 'ALL'::text- ELSE NULL::text- END AS command,- pg_get_expr(pol.polqual, pol.polrelid) AS qual,- pg_get_expr(pol.polwithcheck, pol.polrelid) AS with_check- FROM pg_policy pol- JOIN pg_class c ON c.oid = pol.polrelid- LEFT JOIN pg_namespace n ON n.oid = c.relnamespace- WHERE pol.oid = ${id};- `.trim()- }-- return ''-}--export type EntityDefinitionVariables = {- id?: number- type?: SupportedAssistantEntities | null- projectRef?: string- connectionString?: string-}--export async function getEntityDefinition(- { projectRef, connectionString, id, type }: EntityDefinitionVariables,- signal?: AbortSignal-) {- if (!id) {- throw new Error('id is required')- }-- const sql = getEntityDefinitionSql({ id, type })- const { result } = await executeSql(- {- projectRef,- connectionString,- sql,- queryKey: ['entity-definition', id],- },- signal- )-- if (type === 'functions') {- return result[0].pg_get_functiondef- } else if (type === 'rls-policies') {- return generatePolicyDefinition(result[0])- } else {- return result[0]- }-}--export type EntityDefinitionData = string-export type EntityDefinitionError = ExecuteSqlError--export const useEntityDefinitionQuery = <TData = EntityDefinitionData>(- { projectRef, connectionString, id, type }: EntityDefinitionVariables,- {- enabled = true,- ...options- }: UseQueryOptions<EntityDefinitionData, EntityDefinitionError, TData> = {}-) =>- useQuery<EntityDefinitionData, EntityDefinitionError, TData>(- databaseKeys.entityDefinition(projectRef, id),- ({ signal }) => getEntityDefinition({ projectRef, connectionString, id, type }, signal),- {- enabled:- enabled &&- typeof projectRef !== 'undefined' &&- typeof id !== 'undefined' &&- !isNaN(id) &&- typeof type !== 'undefined',- ...options,- }- )diff --git a/apps/studio/data/notifications/notifications-dismiss-mutation.ts b/apps/studio/data/notifications/notifications-dismiss-mutation.tsdeleted file mode 100644index b2238844670..00000000000--- a/apps/studio/data/notifications/notifications-dismiss-mutation.ts+++ /dev/null@@ -1,47 +0,0 @@-import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { toast } from 'sonner'--import { del, handleError } from 'data/fetchers'-import type { ResponseError } from 'types'-import { notificationKeys } from './keys'--export type NotificationsDismissVariables = {- ids: string[]-}--export async function dismissNotifications({ ids }: NotificationsDismissVariables) {- const { data, error } = await del('/platform/notifications', { body: { ids } })-- if (error) handleError(error)- return data-}--type NotificationsDismissData = Awaited<ReturnType<typeof dismissNotifications>>--export const useNotificationsDismissMutation = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<NotificationsDismissData, ResponseError, NotificationsDismissVariables>,- 'mutationFn'-> = {}) => {- const queryClient = useQueryClient()- return useMutation<NotificationsDismissData, ResponseError, NotificationsDismissVariables>(- (vars) => dismissNotifications(vars),- {- async onSuccess(data, variables, context) {- await queryClient.invalidateQueries(notificationKeys.list())- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to dismiss notifications: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- }- )-}diff --git a/apps/studio/data/notifications/notifications-query.ts b/apps/studio/data/notifications/notifications-query.tsdeleted file mode 100644index 052cd4ae473..00000000000--- a/apps/studio/data/notifications/notifications-query.ts+++ /dev/null@@ -1,30 +0,0 @@-import type { Notification } from '@supabase/shared-types/out/notifications'-import { useQuery, UseQueryOptions } from '@tanstack/react-query'-import { get } from 'lib/common/fetch'-import { API_URL } from 'lib/constants'-import { notificationKeys } from './keys'--export type NotificationsResponse = Notification[]--export async function getNotifications(signal?: AbortSignal) {- const response = await get(`${API_URL}/notifications`, {- signal,- })- if (response.error) {- throw response.error- }-- return response as NotificationsResponse-}--export type NotificationsData = Awaited<ReturnType<typeof getNotifications>>-export type NotificationsError = unknown--export const useNotificationsQuery = <TData = NotificationsData>(- options: UseQueryOptions<NotificationsData, NotificationsError, TData> = {}-) =>- useQuery<NotificationsData, NotificationsError, TData>(- notificationKeys.list(),- ({ signal }) => getNotifications(signal),- options- )diff --git a/apps/studio/data/notifications/notifications-update-mutation.ts b/apps/studio/data/notifications/notifications-update-mutation.tsdeleted file mode 100644index 74d3e9bc7e4..00000000000--- a/apps/studio/data/notifications/notifications-update-mutation.ts+++ /dev/null@@ -1,48 +0,0 @@-import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { toast } from 'sonner'--import { handleError, patch } from 'data/fetchers'-import type { ResponseError } from 'types'-import { notificationKeys } from './keys'--export type NotificationsUpdateVariables = {- ids: string[]-}--export async function updateNotifications({ ids }: NotificationsUpdateVariables) {- // @ts-ignore- const { data, error } = await patch('/platform/notifications', { body: { ids } })-- if (error) handleError(error)- return data-}--type NotificationsUpdateData = Awaited<ReturnType<typeof updateNotifications>>--export const useNotificationsUpdateMutation = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<NotificationsUpdateData, ResponseError, NotificationsUpdateVariables>,- 'mutationFn'-> = {}) => {- const queryClient = useQueryClient()- return useMutation<NotificationsUpdateData, ResponseError, NotificationsUpdateVariables>(- (vars) => updateNotifications(vars),- {- async onSuccess(data, variables, context) {- await queryClient.invalidateQueries(notificationKeys.list())- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to update notifications: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- }- )-}diff --git a/apps/studio/data/organizations/organization-join-decline-mutation.ts b/apps/studio/data/organizations/organization-join-decline-mutation.tsdeleted file mode 100644index 1e06d29776c..00000000000--- a/apps/studio/data/organizations/organization-join-decline-mutation.ts+++ /dev/null@@ -1,52 +0,0 @@-import { useMutation, UseMutationOptions } from '@tanstack/react-query'-import { toast } from 'sonner'--import { del, handleError } from 'data/fetchers'-import type { ResponseError } from 'types'--// [Joshen] This is a duplicate of organization-member-invite-delete-mutation, to remove one of them--export type OrganizationJoinDeclineVariables = {- slug: string- invited_id: string-}--export async function declineJoinOrganization({- slug,- invited_id,-}: OrganizationJoinDeclineVariables) {- const { data, error } = await del('/platform/organizations/{slug}/members/invite', {- // @ts-ignore [Joshen] API spec might be wrong here- params: { path: { slug }, query: { invited_id } },- })- if (error) handleError(error)- return data-}--type OrganizationJoinDeclineData = Awaited<ReturnType<typeof declineJoinOrganization>>--export const useOrganizationJoinDeclineMutation = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<OrganizationJoinDeclineData, ResponseError, OrganizationJoinDeclineVariables>,- 'mutationFn'-> = {}) => {- return useMutation<OrganizationJoinDeclineData, ResponseError, OrganizationJoinDeclineVariables>(- (vars) => declineJoinOrganization(vars),- {- async onSuccess(data, variables, context) {- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to decline organization invite: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- }- )-}diff --git a/apps/studio/data/organizations/organization-join-mutation.ts b/apps/studio/data/organizations/organization-join-mutation.tsdeleted file mode 100644index d59eb254064..00000000000--- a/apps/studio/data/organizations/organization-join-mutation.ts+++ /dev/null@@ -1,52 +0,0 @@-import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { toast } from 'sonner'--import { handleError, post } from 'data/fetchers'-import type { ResponseError } from 'types'-import { organizationKeys } from './keys'--export type OrganizationJoinVariables = {- slug: string- token: string-}--// [Joshen TODO] Should be deprecated now - double check before deleting--export async function joinOrganization({ slug, token }: OrganizationJoinVariables) {- const { data, error } = await post('/platform/organizations/{slug}/members/join', {- params: { path: { slug }, query: { token } },- })- if (error) handleError(error)- return data-}--type OrganizationJoinData = Awaited<ReturnType<typeof joinOrganization>>--export const useOrganizationJoinMutation = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<OrganizationJoinData, ResponseError, OrganizationJoinVariables>,- 'mutationFn'-> = {}) => {- const queryClient = useQueryClient()-- return useMutation<OrganizationJoinData, ResponseError, OrganizationJoinVariables>(- (vars) => joinOrganization(vars),- {- async onSuccess(data, variables, context) {- await queryClient.invalidateQueries(organizationKeys.list())- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to join organization: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- }- )-}diff --git a/apps/studio/data/organizations/organization-join-token-validation-query.ts b/apps/studio/data/organizations/organization-join-token-validation-query.tsdeleted file mode 100644index a80ba45b0b5..00000000000--- a/apps/studio/data/organizations/organization-join-token-validation-query.ts+++ /dev/null@@ -1,54 +0,0 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'-import type { components } from 'data/api'-import { get, handleError } from 'data/fetchers'-import type { ResponseError } from 'types'-import { organizationKeys } from './keys'--export type OrganizationJoinTokenValidationVariables = {- slug: string- token: string-}--export type TokenInfo = components['schemas']['InviteResponse'] | undefined--// [Joshen TODO] Should be deprecated now - double check before deleting--export async function validateTokenInformation(- { slug, token }: OrganizationJoinTokenValidationVariables,- signal?: AbortSignal-) {- const { data, error } = await get(`/platform/organizations/{slug}/members/join`, {- params: { path: { slug }, query: { token } },- signal,- })-- if (error) handleError(error)- return data-}--export type OrganizationJoinTokenValidationData = Awaited<- ReturnType<typeof validateTokenInformation>->-export type OrganizationJoinTokenValidationError = ResponseError--export const useOrganizationJoinTokenValidationQuery = <- TData = OrganizationJoinTokenValidationData,->(- { slug, token }: OrganizationJoinTokenValidationVariables,- {- enabled = true,- ...options- }: UseQueryOptions<- OrganizationJoinTokenValidationData,- OrganizationJoinTokenValidationError,- TData- > = {}-) =>- useQuery<OrganizationJoinTokenValidationData, OrganizationJoinTokenValidationError, TData>(- organizationKeys.tokenValidation(slug, token),- ({ signal }) => validateTokenInformation({ slug, token }, signal),- {- enabled: enabled && typeof slug !== 'undefined',- ...options,- }- )diff --git a/apps/studio/data/organizations/organization-member-update-mutation.ts b/apps/studio/data/organizations/organization-member-update-mutation.tsdeleted file mode 100644index 9d71c7ca53d..00000000000--- a/apps/studio/data/organizations/organization-member-update-mutation.ts+++ /dev/null@@ -1,69 +0,0 @@-import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'-import { patch } from 'lib/common/fetch'-import { API_URL } from 'lib/constants'-import { toast } from 'sonner'-import type { ResponseError } from 'types'-import { organizationKeys } from './keys'--export type OrganizationMemberUpdateVariables = {- slug: string- gotrueId: string- roleId: number-}--export async function updateOrganizationMember({- slug,- gotrueId,- roleId,-}: OrganizationMemberUpdateVariables) {- const response = await patch(`${API_URL}/organizations/${slug}/members/${gotrueId}`, {- role_id: roleId,- })- if (response.error) {- throw response.error- }-- return response-}--type OrganizationMemberUpdateData = Awaited<ReturnType<typeof updateOrganizationMember>>--export const useOrganizationMemberUpdateMutation = ({- onSuccess,- onError,- ...options-}: Omit<- UseMutationOptions<- OrganizationMemberUpdateData,- ResponseError,- OrganizationMemberUpdateVariables- >,- 'mutationFn'-> = {}) => {- const queryClient = useQueryClient()-- return useMutation<- OrganizationMemberUpdateData,- ResponseError,- OrganizationMemberUpdateVariables- >((vars) => updateOrganizationMember(vars), {- async onSuccess(data, variables, context) {- const { slug } = variables-- await Promise.all([- queryClient.invalidateQueries(organizationKeys.members(slug)),- queryClient.invalidateQueries(organizationKeys.roles(slug)),- ])-- await onSuccess?.(data, variables, context)- },- async onError(data, variables, context) {- if (onError === undefined) {- toast.error(`Failed to update member: ${data.message}`)- } else {- onError(data, variables, context)- }- },- ...options,- })-}diff --git a/apps/studio/hooks/misc/useImmutableValue.tsx b/apps/studio/hooks/misc/useImmutableValue.tsxdeleted file mode 100644index 433e0099fef..00000000000--- a/apps/studio/hooks/misc/useImmutableValue.tsx+++ /dev/null@@ -1,14 +0,0 @@-import { useRef } from 'react'--/**- * Once a non-undefined value is passed, it will never change.- */-export function useImmutableValue<T>(value: T | undefined): T | undefined {- const ref = useRef<T | undefined>(value)-- if (!ref.current && value) {- ref.current = value- }-- return ref.current-}diff --git a/apps/studio/tests/setup/fetch-mock.js b/apps/studio/tests/setup/fetch-mock.jsdeleted file mode 100644index 8d3088b21ad..00000000000--- a/apps/studio/tests/setup/fetch-mock.js+++ /dev/null@@ -1,22 +0,0 @@-import { enableFetchMocks } from 'jest-fetch-mock'-import { readFile } from 'fs/promises'-import { fileURLToPath } from 'url'--enableFetchMocks()--fetch.mockResponse(async (request) => {- // Support loading .wasm files in Jest jsdom environment- if (request.url.endsWith('.wasm')) {- const filePath = fileURLToPath(request.url)- const file = await readFile(filePath)- return {- status: 200,- body: file,- }- } else {- return {- status: 404,- body: 'Not Found',- }- }-})