mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 15:19:08 +03:00
* extend integration test suite and move to v2 * update workflow * change tests to run against cli setup
26 lines
592 B
TypeScript
26 lines
592 B
TypeScript
import { createClient, User, UserResponse } from '@supabase/supabase-js'
|
|
|
|
const removeAllUsers = async () => {
|
|
const sb = createClient(
|
|
process.env.SUPABASE_URL as string,
|
|
process.env.SUPABASE_KEY_ADMIN as string
|
|
)
|
|
|
|
const {
|
|
data: { users },
|
|
} = await sb.auth.admin.listUsers()
|
|
|
|
const promises: Promise<UserResponse>[] = []
|
|
users.map((u) => {
|
|
sb.from('profiles')
|
|
.delete()
|
|
.match({ id: u.id })
|
|
.then(() => promises.push(sb.auth.admin.deleteUser(u.id)))
|
|
})
|
|
await Promise.all(promises)
|
|
}
|
|
|
|
export default async () => {
|
|
await removeAllUsers()
|
|
}
|