//native
type Supabase = {
key: string
}
/**
* Updates project's supavisor config
*
*/
export async function main(
auth: Supabase,
ref: string,
body: { default_pool_size?: number; pool_mode?: 'transaction' | 'session' }
) {
const url = new URL(`https://api.supabase.com/v1/projects/${ref}/config/database/pooler`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.key
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 207 days ago