mirror of
https://github.com/supabase/supabase.git
synced 2026-12-05 07:59:03 +00:00
## Problem Retire the deprecated Iceberg (Analytics Bucket) destination from Pipelines. ## Solution - Remove the destination UI, configuration mappings, feature-flag usage, and generated API variants. - Remove the legacy Pipelines integration from Storage while preserving standalone Analytics Buckets. - Remove unused components and sheet-layout support, and add regression coverage for retained Storage operations. - Remove the stale Pipelines claim from the Storage docs overview. ## Validation - Pipelines, Storage, and replication data tests - After the final cleanup: Studio typecheck and all 3 Analytics Bucket regression tests passed. - Formatting, scoped ESLint, Knip, and whitespace checks passed; lint warnings are pre-existing. - Storage overview: Prettier, ESLint with zero warnings, content-listing schema validation, and Markdown rendering passed. Production API-type verification remains pending the coordinated API deployment. Legacy Iceberg pipelines, destinations, and slots must be cleaned up before rollout. ## Review instructions 1. Verify that Pipelines offers BigQuery, DuckLake, Snowflake, and ClickHouse, with no Analytics Bucket option. 2. Verify that Storage Analytics Bucket creation, namespace/table operations, and wrapper/key cleanup remain available without Pipelines controls. ## Checklist - [x] Read CONTRIBUTING.md. - [x] Updated the Storage overview copy and checked the docs authoring guidance. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
112 lines
3.1 KiB
TypeScript
112 lines
3.1 KiB
TypeScript
import { safeSql } from '@supabase/pg-meta'
|
|
import { Query } from '@supabase/pg-meta/src/query'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { vaultSecretsKeys } from './keys'
|
|
import { unguarded } from '@/data/fetchers'
|
|
import { executeSql } from '@/data/sql/execute-sql-mutation'
|
|
import { UseCustomQueryOptions } from '@/types'
|
|
|
|
const vaultSecretDecryptedValueQuery = (id: string) => {
|
|
const sql = new Query()
|
|
.from('decrypted_secrets', 'vault')
|
|
.select(safeSql`decrypted_secret`)
|
|
.match({ id })
|
|
.toSql()
|
|
|
|
return sql
|
|
}
|
|
|
|
const vaultSecretDecryptedValuesQuery = (ids: string[]) => {
|
|
const sql = new Query()
|
|
.from('decrypted_secrets', 'vault')
|
|
.select(safeSql`id,decrypted_secret`)
|
|
.filter('id', 'in', ids)
|
|
.toSql()
|
|
|
|
return sql
|
|
}
|
|
|
|
export type VaultSecretsDecryptedValueVariables = {
|
|
projectRef?: string
|
|
connectionString?: string | null
|
|
id?: string
|
|
}
|
|
|
|
export const getDecryptedValue = async (
|
|
{ projectRef, connectionString, id }: VaultSecretsDecryptedValueVariables,
|
|
signal?: AbortSignal
|
|
) => {
|
|
if (!id) throw new Error('ID is required')
|
|
|
|
const sql = vaultSecretDecryptedValueQuery(id)
|
|
const { result } = await executeSql(
|
|
{
|
|
projectRef,
|
|
connectionString,
|
|
sqlOrigin: 'studio',
|
|
queryName: 'vault-secret-decrypted-value',
|
|
sql,
|
|
queryKey: vaultSecretsKeys.getDecryptedValue(projectRef, id),
|
|
grant: unguarded.migrating,
|
|
},
|
|
signal
|
|
)
|
|
return result as { decrypted_secret: string }[]
|
|
}
|
|
|
|
type getDecryptedValueResult = Awaited<ReturnType<typeof getDecryptedValue>>
|
|
export type VaultSecretsDecryptedValueData = string
|
|
export type VaultSecretsDecryptedValueError = unknown
|
|
|
|
export const useVaultSecretDecryptedValueQuery = <TData = string>(
|
|
{ projectRef, connectionString, id }: VaultSecretsDecryptedValueVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<getDecryptedValueResult, VaultSecretsDecryptedValueError, TData> = {}
|
|
) =>
|
|
useQuery<getDecryptedValueResult, VaultSecretsDecryptedValueError, TData>({
|
|
queryKey: vaultSecretsKeys.getDecryptedValue(projectRef, id),
|
|
queryFn: ({ signal }) => getDecryptedValue({ projectRef, connectionString, id }, signal),
|
|
select(data) {
|
|
return (data[0]?.decrypted_secret ?? '') as TData
|
|
},
|
|
enabled: enabled && typeof projectRef !== 'undefined' && typeof id !== 'undefined',
|
|
...options,
|
|
})
|
|
|
|
// [Joshen] Considering to consolidate fetching single and multiple decrypted values by just passing in a string array
|
|
export const getDecryptedValues = async (
|
|
{
|
|
projectRef,
|
|
connectionString,
|
|
ids,
|
|
}: {
|
|
projectRef?: string
|
|
connectionString?: string | null
|
|
ids: string[]
|
|
},
|
|
signal?: AbortSignal
|
|
) => {
|
|
const sql = vaultSecretDecryptedValuesQuery(ids)
|
|
const { result } = await executeSql<{ id: string; decrypted_secret: string }[]>(
|
|
{
|
|
projectRef,
|
|
connectionString,
|
|
sql,
|
|
sqlOrigin: 'studio',
|
|
queryName: 'decrypt-secret',
|
|
queryKey: ['decrypt-secret'],
|
|
grant: unguarded.migrating,
|
|
},
|
|
signal
|
|
)
|
|
return result.reduce(
|
|
(a, b) => {
|
|
return { ...a, [b.id]: b.decrypted_secret }
|
|
},
|
|
{} as Record<string, string>
|
|
)
|
|
}
|