ruvector/studio/components/interfaces/Database/Tables/Tables.utils.ts
rUv 814f595995 feat(studio): Add complete RuVector Studio application
Major additions:
- Complete Next.js studio application with 1600+ components
- Docker support (Dockerfile.combined, docker-compose.yml)
- GCP deployment documentation and benchmarks
- SQL benchmark scripts for performance testing
- Sentry integration for monitoring
- Comprehensive test suite and mocks

Studio features:
- Dashboard and admin interfaces
- Data visualization components
- Authentication and user management
- API integration with RuVector backend
- Static data and public assets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:04:48 +00:00

69 lines
1.8 KiB
TypeScript

import { PostgresMaterializedView, PostgresTable, PostgresView } from '@supabase/postgres-meta'
import { PostgresForeignTable } from '@supabase/postgres-meta/dist/lib/types'
import { ENTITY_TYPE } from 'data/entity-types/entity-type-constants'
// [Joshen] We just need name, description, rows, size, and the number of columns
// Just missing partitioned tables as missing pg-meta support
export const formatAllEntities = ({
tables = [],
views = [],
materializedViews = [],
foreignTables = [],
}: {
tables?: PostgresTable[]
views?: PostgresView[]
materializedViews?: PostgresMaterializedView[]
foreignTables?: PostgresForeignTable[]
}) => {
const formattedTables = tables.map((x) => {
return {
...x,
type: ENTITY_TYPE.TABLE as const,
rows: x.live_rows_estimate,
columns: x.columns ?? [],
}
})
const formattedViews = views.map((x) => {
return {
type: ENTITY_TYPE.VIEW as const,
id: x.id,
name: x.name,
comment: x.comment,
rows: undefined,
size: undefined,
columns: x.columns ?? [],
}
})
const formattedMaterializedViews = materializedViews.map((x) => {
return {
type: ENTITY_TYPE.MATERIALIZED_VIEW as const,
id: x.id,
name: x.name,
comment: x.comment,
rows: undefined,
size: undefined,
columns: x.columns ?? [],
}
})
const formattedForeignTables = foreignTables.map((x) => {
return {
type: ENTITY_TYPE.FOREIGN_TABLE as const,
id: x.id,
name: x.name,
comment: x.comment,
rows: undefined,
size: undefined,
columns: x.columns ?? [],
}
})
return [
...formattedTables,
...formattedViews,
...formattedMaterializedViews,
...formattedForeignTables,
].sort((a, b) => a.name.localeCompare(b.name))
}