mirror of
https://github.com/supabase/supabase.git
synced 2026-05-29 17:01:12 +08:00
* refactor: reading markdown docs files
Refactor how Markdown docs files are read:
- Reuses the same logic across search index generation & page generation
- Improves the indexed content for search:
- Stops removing MDX components, which often contain useful
information like Admonitions
- Denormalizes Partials and CodeSamples for more complete content
This is a prerequisite step for implementing the "Copy docs as Markdown"
functionality.
Only touches regular guides for now, not federated ones.
* fix: tailwind build error (#37728)
We changed to default to ESM imports a while ago, which means local
builds are now breaking because the Tailwind uses a require. Changed to
CJS for Tailwind config file. (I have no idea how this has been working
on Vercel all this time.)
* style: prettier
96 lines
2.9 KiB
TypeScript
96 lines
2.9 KiB
TypeScript
import { createClient, type SupabaseClient } from '@supabase/supabase-js'
|
|
import { type Database as DatabaseGenerated } from 'common'
|
|
|
|
export type Database = {
|
|
content: DatabaseGenerated['content']
|
|
graphql_public: DatabaseGenerated['graphql_public']
|
|
public: {
|
|
Tables: Omit<DatabaseGenerated['public']['Tables'], 'page_section'> & {
|
|
page_section: Omit<
|
|
DatabaseGenerated['public']['Tables']['page_section'],
|
|
'Row' | 'Insert' | 'Update'
|
|
> & {
|
|
Row: Omit<DatabaseGenerated['public']['Tables']['page_section']['Row'], 'embedding'> & {
|
|
embedding: Array<number> | null
|
|
}
|
|
Insert: Omit<
|
|
DatabaseGenerated['public']['Tables']['page_section']['Insert'],
|
|
'embedding'
|
|
> & {
|
|
embedding?: Array<number> | null
|
|
}
|
|
Update: Omit<
|
|
DatabaseGenerated['public']['Tables']['page_section']['Update'],
|
|
'embedding'
|
|
> & {
|
|
embedding?: Array<number> | null
|
|
}
|
|
}
|
|
}
|
|
Views: DatabaseGenerated['public']['Views']
|
|
Functions: Omit<
|
|
DatabaseGenerated['public']['Functions'],
|
|
'search_content' | 'search_content_hybrid'
|
|
> & {
|
|
search_content: {
|
|
Args: Omit<
|
|
DatabaseGenerated['public']['Functions']['search_content']['Args'],
|
|
'embedding'
|
|
> & { embedding: Array<number> }
|
|
Returns: Array<
|
|
Omit<
|
|
DatabaseGenerated['public']['Functions']['search_content']['Returns'][number],
|
|
'subsections' | 'metadata'
|
|
> & {
|
|
metadata: {
|
|
subtitle?: string
|
|
language?: string
|
|
methodName?: string
|
|
platform?: string
|
|
}
|
|
subsections: Array<{ title?: string; href?: string; content?: string }>
|
|
}
|
|
>
|
|
}
|
|
search_content_hybrid: {
|
|
Args: Omit<
|
|
DatabaseGenerated['public']['Functions']['search_content_hybrid']['Args'],
|
|
'query_embedding'
|
|
> & { query_embedding: Array<number> }
|
|
Returns: Array<
|
|
Omit<
|
|
DatabaseGenerated['public']['Functions']['search_content_hybrid']['Returns'][number],
|
|
'subsections' | 'metadata'
|
|
> & {
|
|
metadata: {
|
|
subtitle?: string
|
|
language?: string
|
|
methodName?: string
|
|
platform?: string
|
|
}
|
|
subsections: Array<{ title?: string; href?: string; content?: string }>
|
|
}
|
|
>
|
|
}
|
|
}
|
|
Enums: DatabaseGenerated['public']['Enums']
|
|
CompositeTypes: DatabaseGenerated['public']['CompositeTypes']
|
|
}
|
|
storage: DatabaseGenerated['storage']
|
|
}
|
|
|
|
let _supabase: SupabaseClient<Database>
|
|
|
|
export function supabase() {
|
|
if (!_supabase) {
|
|
_supabase = createClient(
|
|
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
|
)
|
|
}
|
|
|
|
return _supabase
|
|
}
|
|
|
|
export type { Database as DatabaseCorrected }
|