//native
type Supabase = {
key: string
}
/**
* Updates project's storage config
*
*/
export async function main(
auth: Supabase,
ref: string,
body: {
fileSizeLimit?: number
features?: {
imageTransformation: { enabled: false | true }
s3Protocol: { enabled: false | true }
}
}
) {
const url = new URL(`https://api.supabase.com/v1/projects/${ref}/config/storage`)
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.text()
}
Submitted by hugo697 151 days ago