lints.ts 647 B

123456789101112131415161718192021
  1. import { enrichLintsQuery, getLintsSQL } from '@supabase/pg-meta'
  2. import { paths } from 'api-types'
  3. import { executeQuery } from './query'
  4. import { DOCS_URL } from '@/lib/constants'
  5. interface GetLintsOptions {
  6. headers?: HeadersInit
  7. exposedSchemas?: string
  8. }
  9. export async function getLints({ headers, exposedSchemas }: GetLintsOptions) {
  10. const sql = getLintsSQL({ docsUrl: DOCS_URL })
  11. return await executeQuery<ResponseData[number]>({
  12. query: enrichLintsQuery(sql, exposedSchemas),
  13. headers,
  14. })
  15. }
  16. export type ResponseData =
  17. paths['/platform/projects/{ref}/run-lints']['get']['responses']['200']['content']['application/json']