mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
Update the API types by running `api:codegen`. Some of the changes are fixed in code, some of the type changes had to be reverted (JIT Access, SSO features). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Billing** * Updated subscription messaging to reflect AWS Marketplace billing. * Removed outdated partner-billing downgrade notices. * **Bug Fixes** * Improved request handling for API keys, custom domains, SQL snippets, branches, and storage operations. * Improved legacy signing-key compatibility. * Refined temporary database access availability messaging. * **Updates** * Removed Fly as an available cloud provider for region selection. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
79 lines
2.0 KiB
TypeScript
79 lines
2.0 KiB
TypeScript
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
import { toast } from 'sonner'
|
|
|
|
import { storageKeys } from './keys'
|
|
import { del, handleError } from '@/data/fetchers'
|
|
import type { ResponseError, UseCustomMutationOptions } from '@/types'
|
|
|
|
type DeleteIcebergNamespaceTableVariables = {
|
|
warehouse: string
|
|
namespace: string
|
|
table: string
|
|
projectRef?: string
|
|
}
|
|
|
|
async function deleteIcebergNamespaceTable({
|
|
projectRef,
|
|
warehouse,
|
|
namespace,
|
|
table,
|
|
}: DeleteIcebergNamespaceTableVariables) {
|
|
if (!projectRef) throw new Error('projectRef is required')
|
|
|
|
const { error } = await del(
|
|
'/platform/storage/{ref}/analytics-buckets/{id}/namespaces/{namespace}/tables/{table}',
|
|
{
|
|
params: {
|
|
path: { ref: projectRef, id: warehouse, namespace, table },
|
|
query: { purge: 'true' },
|
|
},
|
|
}
|
|
)
|
|
|
|
if (error) handleError(error)
|
|
return true
|
|
}
|
|
|
|
type IcebergNamespaceTableDeleteData = Awaited<ReturnType<typeof deleteIcebergNamespaceTable>>
|
|
|
|
export const useIcebergNamespaceTableDeleteMutation = ({
|
|
onSuccess,
|
|
onError,
|
|
...options
|
|
}: Omit<
|
|
UseCustomMutationOptions<
|
|
IcebergNamespaceTableDeleteData,
|
|
ResponseError,
|
|
DeleteIcebergNamespaceTableVariables
|
|
>,
|
|
'mutationFn'
|
|
> = {}) => {
|
|
const queryClient = useQueryClient()
|
|
|
|
return useMutation<
|
|
IcebergNamespaceTableDeleteData,
|
|
ResponseError,
|
|
DeleteIcebergNamespaceTableVariables
|
|
>({
|
|
mutationFn: (vars) => deleteIcebergNamespaceTable({ ...vars }),
|
|
async onSuccess(data, variables, context) {
|
|
await queryClient.invalidateQueries({
|
|
queryKey: storageKeys.icebergNamespace({
|
|
projectRef: variables.projectRef,
|
|
warehouse: variables.warehouse,
|
|
namespace: variables.namespace,
|
|
}),
|
|
})
|
|
await onSuccess?.(data, variables, context)
|
|
},
|
|
async onError(data, variables, context) {
|
|
if (onError === undefined) {
|
|
toast.error(`Failed to delete Iceberg namespace table: ${data.message}`)
|
|
} else {
|
|
onError(data, variables, context)
|
|
}
|
|
},
|
|
...options,
|
|
})
|
|
}
|