diff --git a/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/CPUWarnings.tsx b/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/CPUWarnings.tsx deleted file mode 100644 index 55355b89259..00000000000 --- a/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/CPUWarnings.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { AlertTitle } from '@ui/components/shadcn/ui/alert' -import { AlertCircle } from 'lucide-react' -import Link from 'next/link' -import { Alert, AlertDescription, Button } from 'ui' - -import { DOCS_URL } from '@/lib/constants' - -interface CPUWarningsProps { - hasAccessToComputeSizes: boolean - upgradeUrl: string - severity?: 'warning' | 'critical' | null -} - -export const CPUWarnings = ({ - hasAccessToComputeSizes, - upgradeUrl, - severity, -}: CPUWarningsProps) => { - if (severity === 'warning') { - return ( - - - Your max CPU usage has exceeded 80% - - High CPU usage could result in slower queries, disruption of daily back up routines, and - in rare cases, your instance may become unresponsive. If you need more resources, consider - upgrading to a larger compute add-on. - -
- - -
-
- ) - } - - if (severity === 'critical') { - return ( - - - Your max CPU usage has reached 100% - - High CPU usage could result in slower queries, disruption of daily back up routines, and - in rare cases, your instance may become unresponsive. If you need more resources, consider - upgrading to a larger compute add-on. - -
- - -
-
- ) - } - - return null -} diff --git a/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/DiskIOBandwidthWarnings.tsx b/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/DiskIOBandwidthWarnings.tsx deleted file mode 100644 index 21a1d5428c3..00000000000 --- a/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/DiskIOBandwidthWarnings.tsx +++ /dev/null @@ -1,118 +0,0 @@ -import Link from 'next/link' -import { Button } from 'ui' -import { Admonition } from 'ui-patterns/Admonition' - -// [Joshen] In the future, conditionals should be from resource exhaustion endpoint as single source of truth -interface DiskIOBandwidthWarningsProps { - hasAccessToComputeSizes: boolean - hasLatest: boolean - upgradeUrl: string - currentBillingCycleSelected: boolean - latestIoBudgetConsumption: number - highestIoBudgetConsumption: number -} - -export const DiskIOBandwidthWarnings = ({ - hasAccessToComputeSizes, - hasLatest, - currentBillingCycleSelected, - upgradeUrl, - latestIoBudgetConsumption, - highestIoBudgetConsumption, -}: DiskIOBandwidthWarningsProps) => { - if (hasLatest && latestIoBudgetConsumption >= 100) { - return ( - -

- Your workload has used up all your Disk IO Budget and is now running at the baseline - performance. If you need consistent disk performance, consider upgrading to a larger - compute add-on. -

- - - } - /> - ) - } - - if (hasLatest && latestIoBudgetConsumption >= 80) { - return ( - -

- Your workload has consumed {latestIoBudgetConsumption}% of your Disk IO Budget. If you - use up all your Disk IO Budget, your instance will reverted to baseline performance. - If you need consistent disk performance, consider upgrading to a larger compute - add-on. -

- - - } - /> - ) - } - - if (currentBillingCycleSelected && highestIoBudgetConsumption >= 100) { - return ( - -

- Your workload has used up all your Disk IO Budget and reverted to baseline performance - at least once during this billing cycle. If you need consistent disk performance, - consider upgrading to a larger compute add-on. -

- - - } - /> - ) - } - - if (currentBillingCycleSelected && highestIoBudgetConsumption >= 80) { - return ( - -

- Your workload has consumed {highestIoBudgetConsumption}% of your Disk IO budget during - this billing cycle. If you use up all your Disk IO Budget, your instance will reverted - to baseline performance. If you need consistent disk performance, consider upgrading - to a larger compute add-on. -

- - - } - /> - ) - } - - return null -} diff --git a/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/RAMWarnings.tsx b/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/RAMWarnings.tsx deleted file mode 100644 index 4fc8c9b5e35..00000000000 --- a/apps/studio/components/interfaces/Billing/Usage/UsageWarningAlerts/RAMWarnings.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { AlertTitle } from '@ui/components/shadcn/ui/alert' -import { AlertCircle } from 'lucide-react' -import Link from 'next/link' -import { Alert, AlertDescription, Button } from 'ui' - -import { DOCS_URL } from '@/lib/constants' - -interface RAMWarningsProps { - hasAccessToComputeSizes: boolean - upgradeUrl: string - severity?: 'warning' | 'critical' | null -} - -export const RAMWarnings = ({ - hasAccessToComputeSizes, - upgradeUrl, - severity, -}: RAMWarningsProps) => { - if (severity === 'warning') { - return ( - - - Your memory usage has exceeded 80% - - High memory usage could result in overall degraded performance, and in rare cases, your - instance may become unresponsive. If you need more resources, consider upgrading to a - larger compute add-on. - -
- - -
-
- ) - } - - if (severity === 'critical') { - return ( - - - Your memory usage has reached 100% - - High memory usage could result in overall degraded performance, and in rare cases, your - instance may become unresponsive. If you need more resources, consider upgrading to a - larger compute add-on. - -
- - -
-
- ) - } - - return null -} diff --git a/apps/studio/components/interfaces/DataWarehouse/FormFooterChangeBadge.tsx b/apps/studio/components/interfaces/DataWarehouse/FormFooterChangeBadge.tsx deleted file mode 100644 index f06491437be..00000000000 --- a/apps/studio/components/interfaces/DataWarehouse/FormFooterChangeBadge.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { AnimatePresence, motion } from 'framer-motion' - -interface FormFooterChangeBadgeProps { - formState: { - dirtyFields: Record - } -} -export const FormFooterChangeBadge = ({ formState }: FormFooterChangeBadgeProps) => { - return ( - - {Object.keys(formState.dirtyFields).length > 0 && ( - - -

- - {Object.keys(formState.dirtyFields).length === 1 - ? '1 change to review' - : `${Object.keys(formState.dirtyFields).length} changes to review`} - -

-
-
- )} -
- ) -} diff --git a/apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/EmptyReplicationDiagram.tsx b/apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/EmptyReplicationDiagram.tsx deleted file mode 100644 index 5f975647b03..00000000000 --- a/apps/studio/components/interfaces/Database/Replication/ReplicationDiagram/EmptyReplicationDiagram.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Background, ColorMode, ReactFlow, ReactFlowProvider } from '@xyflow/react' -import { useTheme } from 'next-themes' - -import { PrimaryDatabaseNode, ReplicationNode } from './Nodes' - -import '@xyflow/react/dist/style.css' - -import { SmoothstepEdge } from './Edges' - -export const EmptyReplicationDiagram = () => { - return ( - - - - ) -} - -const nodeTypes = { - primary: PrimaryDatabaseNode, - replication: ReplicationNode, -} - -const edgeTypes = { smoothstep: SmoothstepEdge } - -const ReplicationDiagramContent = () => { - const { resolvedTheme } = useTheme() - - const backgroundPatternColor = - resolvedTheme === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.4)' - - return ( -
- - - -
- ) -} diff --git a/apps/studio/components/interfaces/Integrations/Vercel/OrganizationPicker.tsx b/apps/studio/components/interfaces/Integrations/Vercel/OrganizationPicker.tsx deleted file mode 100644 index 17b7f82623c..00000000000 --- a/apps/studio/components/interfaces/Integrations/Vercel/OrganizationPicker.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { ChevronDown } from 'lucide-react' -import { useMemo, useRef, useState } from 'react' -import { - Badge, - Button, - cn, - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, - Popover, - PopoverContent, - PopoverTrigger, -} from 'ui' - -import { getHasInstalledObject } from '@/components/layouts/IntegrationsLayout/Integrations.utils' -import PartnerIcon from '@/components/ui/PartnerIcon' -import { useIntegrationsQuery } from '@/data/integrations/integrations-query' -import type { IntegrationName } from '@/data/integrations/integrations.types' -import { useOrganizationsQuery } from '@/data/organizations/organizations-query' -import type { Organization } from '@/types' - -export interface OrganizationPickerProps { - integrationName: IntegrationName - configurationId?: string - selectedOrg: Organization | null - onSelectedOrgChange: (organization: Organization) => void - disabled?: boolean -} - -const OrganizationPicker = ({ - integrationName, - configurationId, - selectedOrg, - onSelectedOrgChange, - disabled, -}: OrganizationPickerProps) => { - const [open, setOpen] = useState(false) - const ref = useRef(null) - - const { data: integrationData } = useIntegrationsQuery() - const { data: organizationsData, isPending: isLoadingOrganization } = useOrganizationsQuery() - - const installed = useMemo( - () => - integrationData && organizationsData - ? getHasInstalledObject({ - integrationName, - integrationData, - organizationsData, - installationId: configurationId, - }) - : {}, - [configurationId, integrationData, integrationName, organizationsData] - ) - - return ( - <> - - - - - - - - - No results found. - - {organizationsData?.map((org) => { - return ( - { - const org = organizationsData?.find( - (org) => org.slug.toLowerCase() === slug.toLowerCase() - ) - if (org) { - onSelectedOrgChange(org) - } - - setOpen(false) - }} - > - - {org.name}{' '} - {configurationId && installed[org.slug] && ( - Integration Installed - )} - - ) - })} - - - - - - - ) -} - -export default OrganizationPicker diff --git a/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx b/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx index 393734b706c..c22ec181f5c 100644 --- a/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx +++ b/apps/studio/components/interfaces/Observability/ObservabilityOverview.tsx @@ -14,7 +14,7 @@ import { ObservabilityOverviewFooter } from './ObservabilityOverviewFooter' import { ServiceHealthTable } from './ServiceHealthTable' import { useSlowQueriesCount } from './useSlowQueriesCount' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { buildUnifiedLogsUrl, type UnifiedLogType, diff --git a/apps/studio/components/interfaces/QueryInsights/QueryInsightsTable/QueryInsightsTableRow.tsx b/apps/studio/components/interfaces/QueryInsights/QueryInsightsTable/QueryInsightsTableRow.tsx deleted file mode 100644 index c74d0ec4ec0..00000000000 --- a/apps/studio/components/interfaces/QueryInsights/QueryInsightsTable/QueryInsightsTableRow.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import { Loader2 } from 'lucide-react' -import { AiIconAnimation, Button, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui' - -import type { ClassifiedQuery } from '../QueryInsightsHealth/QueryInsightsHealth.types' -import { ISSUE_DOT_COLORS, ISSUE_ICONS } from './QueryInsightsTable.constants' -import { formatDuration, getColumnName, getTableName } from './QueryInsightsTable.utils' - -interface QueryInsightsTableRowProps { - item: ClassifiedQuery - onRowClick?: () => void - onGoToLogs?: () => void - onCreateIndex?: () => void - onExplain?: () => void - onAiSuggestedFix?: () => void - isExplainLoading?: boolean -} - -export const QueryInsightsTableRow = ({ - item, - onRowClick, - onGoToLogs, - onCreateIndex, - onExplain, - onAiSuggestedFix, - isExplainLoading, -}: QueryInsightsTableRowProps) => { - const IssueIcon = item.issueType ? ISSUE_ICONS[item.issueType] : null - - return ( -
- {item.issueType && IssueIcon && ( -
- -
- )} - -
-

- {item.queryType ?? '–'} - {getTableName(item.query) && ( - <> - {' '} - in {getTableName(item.query)} - - )} - {getColumnName(item.query) && ( - <> - , {getColumnName(item.query)} - - )} -

-

- {item.hint} -

-
- -
- - -
- = 1000 && 'text-destructive-600' - )} - > - {formatDuration(item.mean_time)} - - - avg - -
-
- - Average execution time per call. High mean time means individual runs are slow — - directly felt by users. - -
- - - -
- - {item.prop_total_time.toFixed(1)}% - - - of db - -
-
- - Percentage of total database execution time. Fixing high-impact queries has the biggest - overall effect on your database. - -
- - - -
- {item.calls.toLocaleString()} - - calls - -
-
- - Number of times this query ran in the selected time window. - -
-
- -
- - - {(item.issueType === 'index' || item.issueType === 'slow') && ( - - )} - - {item.issueType === 'index' && ( - - )} - - {(item.issueType === 'error' || item.issueType === 'slow') && ( - - )} -
-
- ) -} diff --git a/apps/studio/components/interfaces/Reports/ReportPadding.tsx b/apps/studio/components/interfaces/Reports/ReportPadding.tsx index 3a483ce86c6..9269f98be42 100644 --- a/apps/studio/components/interfaces/Reports/ReportPadding.tsx +++ b/apps/studio/components/interfaces/Reports/ReportPadding.tsx @@ -19,4 +19,3 @@ export const ReportPadding = ({ ) } -export default ReportPadding diff --git a/apps/studio/components/ui/Charts/Charts.constants.ts b/apps/studio/components/ui/Charts/Charts.constants.ts index 53441ca068c..8abe3c3b32c 100644 --- a/apps/studio/components/ui/Charts/Charts.constants.ts +++ b/apps/studio/components/ui/Charts/Charts.constants.ts @@ -102,5 +102,4 @@ export const DEFAULT_STACK_COLORS: ValidStackColor[] = [ export enum DateTimeFormats { FULL = 'MMM D, YYYY, hh:mma', FULL_SECONDS = 'MMM D, hh:mm:ssa', - DATE_ONLY = 'MMM D, YYYY', } diff --git a/apps/studio/data/ai/parse-client-code-mutation.ts b/apps/studio/data/ai/parse-client-code-mutation.ts deleted file mode 100644 index 70bd6e4f0e4..00000000000 --- a/apps/studio/data/ai/parse-client-code-mutation.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { untrustedSql, type UntrustedSqlFragment } from '@supabase/pg-meta' -import { useMutation } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { constructHeaders, fetchHandler } from '@/data/fetchers' -import { BASE_PATH } from '@/lib/constants' -import { ResponseError, UseCustomMutationOptions } from '@/types' - -export type ParseClientCodeResponse = { - // Named unchecked_sql to highlight that this SQL must never be run - // automatically without user confirmation — it is AI-generated and may not - // be correct. - unchecked_sql: UntrustedSqlFragment | undefined - valid: boolean -} - -export type ParseClientCodeVariables = { - code: string -} - -export async function generateSqlTitle({ code }: ParseClientCodeVariables) { - try { - const url = `${BASE_PATH}/api/ai/sql/parse-client-code` - const headers = await constructHeaders({ 'Content-Type': 'application/json' }) - const response = await fetchHandler(url, { - headers, - method: 'POST', - body: JSON.stringify({ code }), - }).then((res) => res.json()) - - if (response.error) throw new Error(response.error) - return { - valid: response.valid as boolean, - unchecked_sql: response.sql != null ? untrustedSql(response.sql as string) : undefined, - } satisfies ParseClientCodeResponse - } catch (error) { - throw error - } -} - -type ParseClientCodeData = Awaited> - -export const useParseClientCodeMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions, - 'mutationFn' -> = {}) => { - return useMutation({ - mutationFn: (vars) => generateSqlTitle(vars), - async onSuccess(data, variables, context) { - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to parse client code: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/data/ai/sql-policy-mutation.ts b/apps/studio/data/ai/sql-policy-mutation.ts deleted file mode 100644 index fd64608a740..00000000000 --- a/apps/studio/data/ai/sql-policy-mutation.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { untrustedSql, type UntrustedSqlFragment } from '@supabase/pg-meta' -import { useMutation } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { fetchPost } from '@/data/fetchers' -import { BASE_PATH } from '@/lib/constants' -import { ResponseError, UseCustomMutationOptions } from '@/types' - -export type SqlPolicyGenerateVariables = { - tableName: string - schema?: string - columns?: string[] - projectRef: string - connectionString: string - orgSlug?: string - message?: string -} - -type RawSqlPolicy = { - name: string - table: string - schema: string - action: 'PERMISSIVE' | 'RESTRICTIVE' - roles: string[] - command?: 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE' | 'ALL' - definition?: string - check?: string - sql: string -} - -/** - * AI-generated policy. `definition` and `check` are branded `UntrustedSqlFragment` at the - * boundary — they originate from third-party AI output and must be promoted via - * `acceptUntrustedSql` at a user gesture before executing. - */ -export type SqlPolicyGenerateResponse = Array< - Omit & { - definition?: UntrustedSqlFragment - check?: UntrustedSqlFragment - } -> - -export async function generateSqlPolicy({ - tableName, - schema, - columns, - projectRef, - connectionString, - orgSlug, - message, -}: SqlPolicyGenerateVariables): Promise { - const result = await fetchPost>(`${BASE_PATH}/api/ai/sql/policy`, { - tableName, - schema, - columns, - projectRef, - connectionString, - orgSlug, - message, - }) - - if ('error' in result) throw new ResponseError((result.error as any).message, 400) - return (result as Array).map((policy) => ({ - ...policy, - definition: policy.definition === undefined ? undefined : untrustedSql(policy.definition), - check: policy.check === undefined ? undefined : untrustedSql(policy.check), - })) -} - -type SqlPolicyGenerateData = Awaited> - -export const useSqlPolicyGenerateMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions, - 'mutationFn' -> = {}) => { - return useMutation({ - mutationFn: (vars) => generateSqlPolicy(vars), - async onSuccess(data, variables, context) { - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to generate policy: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/data/database/table-check-rls-mutation.ts b/apps/studio/data/database/table-check-rls-mutation.ts deleted file mode 100644 index d94efd26a02..00000000000 --- a/apps/studio/data/database/table-check-rls-mutation.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { getTablesRlsEnabledStatusSQL } from '@supabase/pg-meta' -import { useMutation } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { executeSql } from '../sql/execute-sql-mutation' -import { ResponseError, UseCustomMutationOptions } from '@/types' - -type CheckTableRLSStatusVariables = { - projectRef?: string - connectionString?: string | null - tables: { schema: string; table: string }[] -} - -export type CheckTableRLSStatusResponse = { - schema: string - table: string - rls_enabled: boolean -} - -export async function checkTableRLSStatus({ - projectRef, - connectionString, - tables, -}: CheckTableRLSStatusVariables) { - const sql = getTablesRlsEnabledStatusSQL({ tables }) - const { result } = await executeSql({ - projectRef, - connectionString, - sql, - queryKey: ['table-rls-status'], - }) - return result as CheckTableRLSStatusResponse[] -} - -type CheckTableRLSStatusData = Awaited> - -export const useCheckTableRLSStatusMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions, - 'mutationFn' -> = {}) => { - return useMutation({ - mutationFn: (vars) => checkTableRLSStatus(vars), - async onSuccess(data, variables, context) { - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to retrieve table RLS statuses: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/data/misc/parse-query-mutation.ts b/apps/studio/data/misc/parse-query-mutation.ts deleted file mode 100644 index a30e4eb930d..00000000000 --- a/apps/studio/data/misc/parse-query-mutation.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { useMutation } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { constructHeaders, fetchHandler } from '@/data/fetchers' -import { BASE_PATH } from '@/lib/constants' -import { ResponseError, UseCustomMutationOptions } from '@/types' - -type ParseSQLQueryVariables = { sql: string } -export type ParseSQLQueryOperations = 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE' | undefined -export type ParseSQLQueryResponse = { - tables: string[] - operation: ParseSQLQueryOperations - whereClause: string | null - statementCount: number -} - -export async function parseSQLQuery({ sql }: ParseSQLQueryVariables) { - try { - const url = `${BASE_PATH}/api/parse-query` - - const headers = await constructHeaders({ 'Content-Type': 'application/json' }) - const response = await fetchHandler(url, { - headers, - method: 'POST', - body: JSON.stringify({ sql }), - }).then((res) => res.json()) - - if (response.error) throw new Error(response.error) - return response as ParseSQLQueryResponse - } catch (error) { - throw error - } -} - -type ParseSQLQueryData = Awaited> - -export const useParseSQLQueryMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions, - 'mutationFn' -> = {}) => { - return useMutation({ - mutationFn: (vars) => parseSQLQuery(vars), - async onSuccess(data, variables, context) { - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to parse query: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/data/notifications/keys.ts b/apps/studio/data/notifications/keys.ts index 29945c796f3..cd2fa998b6d 100644 --- a/apps/studio/data/notifications/keys.ts +++ b/apps/studio/data/notifications/keys.ts @@ -1,6 +1,4 @@ export const notificationKeys = { - list: () => ['notifications'] as const, listV2: (options?: { status?: string; limit: number; filters: any }) => ['notifications', options] as const, - summary: () => ['notifications', 'summary'] as const, } diff --git a/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts b/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts deleted file mode 100644 index 5a69b77fc0f..00000000000 --- a/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { useMutation, useQueryClient } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { notificationKeys } from './keys' -import { handleError, patch } from '@/data/fetchers' -import type { ResponseError, UseCustomMutationOptions } from '@/types' - -export async function archiveAllNotifications() { - const { data, error } = await patch('/platform/notifications/archive-all', { - headers: { Version: '2' }, - }) - - if (error) handleError(error) - return data -} - -type NotificationsArchiveAllData = Awaited> - -export const useNotificationsArchiveAllMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions, - 'mutationFn' -> = {}) => { - const queryClient = useQueryClient() - return useMutation({ - mutationFn: () => archiveAllNotifications(), - async onSuccess(data, variables, context) { - await queryClient.invalidateQueries({ queryKey: notificationKeys.list() }) - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to archive all notifications: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/data/notifications/notifications-v2-summary-query.ts b/apps/studio/data/notifications/notifications-v2-summary-query.ts deleted file mode 100644 index c66e9fa7092..00000000000 --- a/apps/studio/data/notifications/notifications-v2-summary-query.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Notification } from '@supabase/shared-types/out/notifications' -import { useQuery } from '@tanstack/react-query' - -import { notificationKeys } from './keys' -import { get, handleError } from '@/data/fetchers' -import type { ResponseError, UseCustomQueryOptions } from '@/types' - -export type NotificationsResponse = Notification[] - -export async function getNotificationsSummary(signal?: AbortSignal) { - const { data, error } = await get('/platform/notifications/summary', { - signal, - }) - if (error) handleError(error) - return data -} - -export type NotificationsData = Awaited> -export type NotificationsError = ResponseError - -export const useNotificationsSummaryQuery = ( - options: UseCustomQueryOptions = {} -) => - useQuery({ - queryKey: notificationKeys.summary(), - queryFn: ({ signal }) => getNotificationsSummary(signal), - ...options, - }) diff --git a/apps/studio/data/platform-apps/platform-app-signing-key-delete-mutation.ts b/apps/studio/data/platform-apps/platform-app-signing-key-delete-mutation.ts deleted file mode 100644 index 73287f7b625..00000000000 --- a/apps/studio/data/platform-apps/platform-app-signing-key-delete-mutation.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { useMutation, useQueryClient } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { platformAppKeys } from './keys' -import { del, handleError } from '@/data/fetchers' -import type { ResponseError, UseCustomMutationOptions } from '@/types' - -export type PlatformAppSigningKeyDeleteVariables = { - slug: string - appId: string - keyId: string -} - -export async function deletePlatformAppSigningKey({ - slug, - appId, - keyId, -}: PlatformAppSigningKeyDeleteVariables) { - const { data, error } = await del( - '/platform/organizations/{slug}/apps/{app_id}/signing-keys/{key_id}', - { - params: { path: { slug, app_id: appId, key_id: keyId } }, - } - ) - - if (error) handleError(error) - return data -} - -export type PlatformAppSigningKeyDeleteData = Awaited< - ReturnType -> - -export const usePlatformAppSigningKeyDeleteMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions< - PlatformAppSigningKeyDeleteData, - ResponseError, - PlatformAppSigningKeyDeleteVariables - >, - 'mutationFn' -> = {}) => { - const queryClient = useQueryClient() - - return useMutation< - PlatformAppSigningKeyDeleteData, - ResponseError, - PlatformAppSigningKeyDeleteVariables - >({ - mutationFn: (vars) => deletePlatformAppSigningKey(vars), - async onSuccess(data, variables, context) { - await queryClient.invalidateQueries({ - queryKey: platformAppKeys.signingKeys(variables.slug, variables.appId), - }) - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to delete signing key: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/data/platform-apps/platform-app-update-mutation.ts b/apps/studio/data/platform-apps/platform-app-update-mutation.ts deleted file mode 100644 index d86991d3d97..00000000000 --- a/apps/studio/data/platform-apps/platform-app-update-mutation.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { useMutation, useQueryClient } from '@tanstack/react-query' -import type { components } from 'api-types' -import { toast } from 'sonner' - -import { platformAppKeys } from './keys' -import { handleError, patch } from '@/data/fetchers' -import type { ResponseError, UseCustomMutationOptions } from '@/types' - -export type PlatformAppUpdateVariables = { - slug: string - appId: string -} & components['schemas']['UpdatePlatformAppBody'] - -export async function updatePlatformApp({ slug, appId, ...body }: PlatformAppUpdateVariables) { - const { data, error } = await patch('/platform/organizations/{slug}/apps/{app_id}', { - params: { path: { slug, app_id: appId } }, - body, - }) - - if (error) handleError(error) - return data -} - -export type PlatformAppUpdateData = Awaited> - -export const usePlatformAppUpdateMutation = ({ - onSuccess, - onError, - ...options -}: Omit< - UseCustomMutationOptions, - 'mutationFn' -> = {}) => { - const queryClient = useQueryClient() - - return useMutation({ - mutationFn: (vars) => updatePlatformApp(vars), - async onSuccess(data, variables, context) { - await Promise.all([ - queryClient.invalidateQueries({ queryKey: platformAppKeys.list(variables.slug) }), - queryClient.invalidateQueries({ - queryKey: platformAppKeys.detail(variables.slug, variables.appId), - }), - ]) - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to update app: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - }) -} diff --git a/apps/studio/hooks/misc/useTrackExperimentExposure.ts b/apps/studio/hooks/misc/useTrackExperimentExposure.ts deleted file mode 100644 index 5b1f491137d..00000000000 --- a/apps/studio/hooks/misc/useTrackExperimentExposure.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { hasConsented, posthogClient } from 'common' -import { useEffect } from 'react' - -export function useTrackExperimentExposure( - experimentId: string, - variant: string | undefined, - extraProperties?: Record -) { - useEffect(() => { - if (!variant) return - - posthogClient.captureExperimentExposure( - experimentId, - { variant, ...extraProperties }, - hasConsented() - ) - }, [experimentId, variant]) -} diff --git a/apps/studio/pages/project/[ref]/observability/[id].tsx b/apps/studio/pages/project/[ref]/observability/[id].tsx index 98b07c40bea..fcb3f97fb05 100644 --- a/apps/studio/pages/project/[ref]/observability/[id].tsx +++ b/apps/studio/pages/project/[ref]/observability/[id].tsx @@ -1,4 +1,4 @@ -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import Reports from '@/components/interfaces/Reports/Reports' import { DefaultLayout } from '@/components/layouts/DefaultLayout' import ObservabilityLayout from '@/components/layouts/ObservabilityLayout/ObservabilityLayout' diff --git a/apps/studio/pages/project/[ref]/observability/api-overview.tsx b/apps/studio/pages/project/[ref]/observability/api-overview.tsx index 07f7ee7fb81..4f4ef2d7b47 100644 --- a/apps/studio/pages/project/[ref]/observability/api-overview.tsx +++ b/apps/studio/pages/project/[ref]/observability/api-overview.tsx @@ -11,7 +11,7 @@ import { } from '@/components/interfaces/Reports/renderers/ApiRenderers' import ReportFilterBar from '@/components/interfaces/Reports/ReportFilterBar' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { REPORT_DATERANGE_HELPER_LABELS } from '@/components/interfaces/Reports/Reports.constants' import ReportStickyNav from '@/components/interfaces/Reports/ReportStickyNav' import ReportWidget from '@/components/interfaces/Reports/ReportWidget' diff --git a/apps/studio/pages/project/[ref]/observability/auth.tsx b/apps/studio/pages/project/[ref]/observability/auth.tsx index 3497dc67c99..92f0e5ff38f 100644 --- a/apps/studio/pages/project/[ref]/observability/auth.tsx +++ b/apps/studio/pages/project/[ref]/observability/auth.tsx @@ -9,7 +9,7 @@ import { Button } from 'ui' import { OBSERVABILITY_DOCS_HREFS } from '@/components/interfaces/Observability/Observability.constants' import ReportFilterBar from '@/components/interfaces/Reports/ReportFilterBar' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { REPORT_DATERANGE_HELPER_LABELS } from '@/components/interfaces/Reports/Reports.constants' import ReportStickyNav from '@/components/interfaces/Reports/ReportStickyNav' import { SharedAPIReport } from '@/components/interfaces/Reports/SharedAPIReport/SharedAPIReport' diff --git a/apps/studio/pages/project/[ref]/observability/database.tsx b/apps/studio/pages/project/[ref]/observability/database.tsx index 20b18cedcd9..76a8973e216 100644 --- a/apps/studio/pages/project/[ref]/observability/database.tsx +++ b/apps/studio/pages/project/[ref]/observability/database.tsx @@ -10,7 +10,7 @@ import { Alert, AlertDescription, Button } from 'ui' import { OBSERVABILITY_DOCS_HREFS } from '@/components/interfaces/Observability/Observability.constants' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { REPORT_DATERANGE_HELPER_LABELS } from '@/components/interfaces/Reports/Reports.constants' import ReportStickyNav from '@/components/interfaces/Reports/ReportStickyNav' import ReportWidget from '@/components/interfaces/Reports/ReportWidget' diff --git a/apps/studio/pages/project/[ref]/observability/edge-functions.tsx b/apps/studio/pages/project/[ref]/observability/edge-functions.tsx index ac4ba8c75ca..f4080121270 100644 --- a/apps/studio/pages/project/[ref]/observability/edge-functions.tsx +++ b/apps/studio/pages/project/[ref]/observability/edge-functions.tsx @@ -8,7 +8,7 @@ import { Button } from 'ui' import { OBSERVABILITY_DOCS_HREFS } from '@/components/interfaces/Observability/Observability.constants' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { EDGE_FUNCTION_REGIONS, REPORT_DATERANGE_HELPER_LABELS, diff --git a/apps/studio/pages/project/[ref]/observability/postgrest.tsx b/apps/studio/pages/project/[ref]/observability/postgrest.tsx index 5b837132779..963799eb0fe 100644 --- a/apps/studio/pages/project/[ref]/observability/postgrest.tsx +++ b/apps/studio/pages/project/[ref]/observability/postgrest.tsx @@ -7,7 +7,7 @@ import { Button } from 'ui' import { OBSERVABILITY_DOCS_HREFS } from '@/components/interfaces/Observability/Observability.constants' import ReportFilterBar from '@/components/interfaces/Reports/ReportFilterBar' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { REPORT_DATERANGE_HELPER_LABELS } from '@/components/interfaces/Reports/Reports.constants' import ReportStickyNav from '@/components/interfaces/Reports/ReportStickyNav' import { SharedAPIReport } from '@/components/interfaces/Reports/SharedAPIReport/SharedAPIReport' diff --git a/apps/studio/pages/project/[ref]/observability/realtime.tsx b/apps/studio/pages/project/[ref]/observability/realtime.tsx index de1103bd03e..dc07655c4a3 100644 --- a/apps/studio/pages/project/[ref]/observability/realtime.tsx +++ b/apps/studio/pages/project/[ref]/observability/realtime.tsx @@ -8,7 +8,7 @@ import { Button } from 'ui' import { OBSERVABILITY_DOCS_HREFS } from '@/components/interfaces/Observability/Observability.constants' import ReportFilterBar from '@/components/interfaces/Reports/ReportFilterBar' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { REPORT_DATERANGE_HELPER_LABELS } from '@/components/interfaces/Reports/Reports.constants' import ReportStickyNav from '@/components/interfaces/Reports/ReportStickyNav' import { SharedAPIReport } from '@/components/interfaces/Reports/SharedAPIReport/SharedAPIReport' diff --git a/apps/studio/pages/project/[ref]/observability/storage.tsx b/apps/studio/pages/project/[ref]/observability/storage.tsx index fc08c192141..1ba7eba2144 100644 --- a/apps/studio/pages/project/[ref]/observability/storage.tsx +++ b/apps/studio/pages/project/[ref]/observability/storage.tsx @@ -17,7 +17,7 @@ import { } from '@/components/interfaces/Reports/renderers/StorageRenderers' import ReportFilterBar from '@/components/interfaces/Reports/ReportFilterBar' import ReportHeader from '@/components/interfaces/Reports/ReportHeader' -import ReportPadding from '@/components/interfaces/Reports/ReportPadding' +import { ReportPadding } from '@/components/interfaces/Reports/ReportPadding' import { REPORT_DATERANGE_HELPER_LABELS } from '@/components/interfaces/Reports/Reports.constants' import ReportStickyNav from '@/components/interfaces/Reports/ReportStickyNav' import ReportWidget from '@/components/interfaces/Reports/ReportWidget' diff --git a/apps/studio/types/userContent.ts b/apps/studio/types/userContent.ts index e1206a77739..40e7af2c335 100644 --- a/apps/studio/types/userContent.ts +++ b/apps/studio/types/userContent.ts @@ -7,11 +7,8 @@ import type { UntrustedLogSqlFragment } from '@/data/logs/safe-analytics-sql' export namespace Notebooks { export type Content = NotebookSchema.NotebookContent export type Cell = NotebookSchema.Cell - export type MarkdownCell = NotebookSchema.MarkdownCell export type DatabaseCell = NotebookSchema.DatabaseCell - export type LogCell = NotebookSchema.LogCell export type TimeRange = NotebookSchema.TimeRange - export type ChartConfig = NotebookSchema.ChartConfig } export interface UserContent<