Files
supabase/apps/studio/lib/self-hosted.ts
T
Alaister Young c0c3710bde fix(studio): bypass pg meta route on self-hosted for ai endpoints (#35812)
* fix(studio): bypass pg meta route on self-hosted for ai endpoints

* fix hosted

* wrong way round
2025-05-29 20:16:49 +08:00

16 lines
548 B
TypeScript

import { constructHeaders } from 'lib/api/apiHelpers'
import { post } from 'lib/common/fetch'
import { PG_META_URL } from 'lib/constants'
import type { ResponseError } from 'types'
export async function queryPgMetaSelfHosted(sql: string, headersInit?: { [prop: string]: any }) {
const headers = constructHeaders(headersInit ?? {})
const response = await post(`${PG_META_URL}/query`, { query: sql }, { headers })
if (response.error) {
return { error: response.error as ResponseError }
} else {
return { data: response.data }
}
}