import { useParams } from 'common' import { Table2 } from 'lucide-react' import { DocSection } from './DocSection' import CodeSnippet from '@/components/interfaces/Docs/CodeSnippet' import Description from '@/components/interfaces/Docs/Description' import Param from '@/components/interfaces/Docs/Param' import Snippets from '@/components/interfaces/Docs/Snippets' import { InlineLink } from '@/components/ui/InlineLink' import { useProjectApiUrl } from '@/data/config/project-endpoint-query' import { useProjectJsonSchemaQuery } from '@/data/docs/project-json-schema-query' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' import { DOCS_URL } from '@/lib/constants' interface ResourceContentProps { resourceId: string resources: { [key: string]: { id: string; displayName: string; camelCase: string } } selectedLang: 'bash' | 'js' showApiKey: string refreshDocs: () => void } export const ResourceContent = ({ resourceId, resources, selectedLang, showApiKey, refreshDocs, }: ResourceContentProps) => { const { ref } = useParams() const { realtimeAll: realtimeEnabled } = useIsFeatureEnabled(['realtime:all']) const { data: jsonSchema } = useProjectJsonSchemaQuery({ projectRef: ref }) const { paths, definitions } = jsonSchema || {} const { data: endpoint = '' } = useProjectApiUrl({ projectRef: ref }) const keyToShow = !!showApiKey ? showApiKey : 'SUPABASE_KEY' const resourcePaths = paths?.[`/${resourceId}`] const resourceDefinition = definitions?.[resourceId] const resourceMeta = resources[resourceId] const description = resourceDefinition?.description || '' const methods = Object.keys(resourcePaths ?? {}).map((x) => x.toUpperCase()) const properties = Object.entries(resourceDefinition?.properties ?? []).map(([id, val]: any) => ({ ...val, id, required: resourceDefinition?.required?.includes(id), })) if (!paths || !definitions) return null return (
To read rows in {resourceId}, use the select method.
Supabase provides a wide range of filters.
insert lets you insert into your tables. You can also insert in bulk
and do UPSERT.
insert will also return the replaced values for UPSERT.
update lets you update rows. update will match all rows by
default. You can update specific rows using horizontal filters, e.g. eq
, lt, and is.
update will also return the replaced values for UPDATE.
delete lets you delete rows. delete will match all rows by
default, so remember to specify your filters!
Supabase provides realtime functionality and broadcasts database changes to authorized users depending on Row Level Security (RLS) policies.