Entity() — supabase Function Reference
Architecture documentation for the Entity() function in Entity.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 0cad11b0_e11b_7da1_23d3_9a7ebdfd9e02["Entity()"] d4cf57d2_f3f5_0351_d67d_71073e4beb5a["getColumnType()"] 0cad11b0_e11b_7da1_23d3_9a7ebdfd9e02 -->|calls| d4cf57d2_f3f5_0351_d67d_71073e4beb5a 21656d1d_8b9b_9132_c927_0dfa1c2672b3["tempRemovePostgrestText()"] 0cad11b0_e11b_7da1_23d3_9a7ebdfd9e02 -->|calls| 21656d1d_8b9b_9132_c927_0dfa1c2672b3 style 0cad11b0_e11b_7da1_23d3_9a7ebdfd9e02 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/studio/components/interfaces/ProjectAPIDocs/Content/Entity.tsx lines 33–146
export const Entity = ({ language, apikey = '', endpoint = '' }: ContentProps) => {
const { ref } = useParams()
const snap = useAppStateSnapshot()
const resource = snap.activeDocsSection[1]
const { data: jsonSchema, refetch } = useProjectJsonSchemaQuery({ projectRef: ref })
const definition = jsonSchema?.definitions?.[resource]
const columns =
definition !== undefined
? Object.entries(definition.properties).map(([id, val]: any) => ({
...val,
id,
required: (definition?.required ?? []).includes(id),
}))
: []
useEffect(() => {
if (resource !== undefined) refetch()
}, [resource])
if (resource === undefined) return null
return (
<div className="divide-y relative">
<div className="flex items-center justify-between px-4 py-4 sticky top-0 bg-surface-100 z-10 border-b shadow-md">
<div className="flex flex-col gap-y-1">
<h2>{resource}</h2>
<p className="text-sm text-foreground-light">
{definition?.description ?? 'No description available'}
</p>
</div>
<LanguageSelector />
</div>
<div className="space-y-2 px-4 py-4 !border-t-0">
<p className="text-sm text-foreground-light">Columns</p>
<Table
head={[
<Table.th key="name">Name</Table.th>,
<Table.th key="format">Format</Table.th>,
<Table.th key="type">Type</Table.th>,
<Table.th key="description">Description</Table.th>,
]}
body={columns.map((column) => {
const formattedColumnType = getColumnType(column.type, column.format)
return (
<Table.tr key={column.id}>
<Table.td title={column.id}>{column.id}</Table.td>
<Table.td title={column.format}>
<p className="truncate">{column.format}</p>
</Table.td>
<Table.td title={formattedColumnType}>{formattedColumnType}</Table.td>
<Table.td title={column.description}>
{tempRemovePostgrestText(column.description ?? '').trim()}
</Table.td>
</Table.tr>
)
})}
/>
</div>
<ResourceContent
selectedLanguage={language}
snippet={DOCS_RESOURCE_CONTENT.readRows}
codeSnippets={DOCS_RESOURCE_CONTENT.readRows.code({
resourceId: resource,
endpoint,
apikey,
})}
/>
<ResourceContent
selectedLanguage={language}
snippet={DOCS_RESOURCE_CONTENT.filtering}
codeSnippets={DOCS_RESOURCE_CONTENT.filtering.code({
resourceId: resource,
endpoint,
apikey,
})}
/>
<ResourceContent
selectedLanguage={language}
snippet={DOCS_RESOURCE_CONTENT.insertRows}
codeSnippets={DOCS_RESOURCE_CONTENT.insertRows.code({
resourceId: resource,
endpoint,
apikey,
})}
/>
<ResourceContent
selectedLanguage={language}
snippet={DOCS_RESOURCE_CONTENT.updateRows}
codeSnippets={DOCS_RESOURCE_CONTENT.updateRows.code({
resourceId: resource,
endpoint,
apikey,
})}
/>
<ResourceContent
selectedLanguage={language}
snippet={DOCS_RESOURCE_CONTENT.deleteRows}
codeSnippets={DOCS_RESOURCE_CONTENT.deleteRows.code({
resourceId: resource,
endpoint,
apikey,
})}
/>
<ResourceContent
selectedLanguage={language}
snippet={DOCS_RESOURCE_CONTENT.subscribeChanges}
codeSnippets={DOCS_RESOURCE_CONTENT.subscribeChanges.code({ resourceId: resource })}
/>
</div>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Entity() do?
Entity() is a function in the supabase codebase.
What does Entity() call?
Entity() calls 2 function(s): getColumnType, tempRemovePostgrestText.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free