ruvector/studio/data/config/project-creation-postgres-versions-query.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

72 lines
2.3 KiB
TypeScript

import { useQuery } from '@tanstack/react-query'
import { handleError, post } from 'data/fetchers'
import { CloudProvider } from 'shared-data'
import type { ResponseError, UseCustomQueryOptions } from 'types'
import { configKeys } from './keys'
export type ProjectCreationPostgresVersionsVariables = {
cloudProvider: CloudProvider
dbRegion: string
organizationSlug: string | undefined
}
export async function getPostgresCreationVersions(
{ cloudProvider, dbRegion, organizationSlug }: ProjectCreationPostgresVersionsVariables,
signal?: AbortSignal
) {
if (!organizationSlug) throw new Error('organizationSlug is required')
const { data, error } = await post('/platform/organizations/{slug}/available-versions', {
params: { path: { slug: organizationSlug } },
body: { provider: cloudProvider, region: dbRegion },
signal,
})
if (error) handleError(error)
return data
}
export type ProjectCreationPostgresVersionData = Awaited<
ReturnType<typeof getPostgresCreationVersions>
>
export type ProjectCreationPostgresVersionError = ResponseError
export const useProjectCreationPostgresVersionsQuery = <TData = ProjectCreationPostgresVersionData>(
{ cloudProvider, dbRegion, organizationSlug }: ProjectCreationPostgresVersionsVariables,
{
enabled = true,
...options
}: UseCustomQueryOptions<
ProjectCreationPostgresVersionData,
ProjectCreationPostgresVersionError,
TData
> = {}
) => {
return useQuery<ProjectCreationPostgresVersionData, ProjectCreationPostgresVersionError, TData>({
queryKey: configKeys.projectCreationPostgresVersions(organizationSlug, cloudProvider, dbRegion),
queryFn: ({ signal }) =>
getPostgresCreationVersions({ organizationSlug, cloudProvider, dbRegion }, signal),
enabled:
enabled &&
typeof organizationSlug !== 'undefined' &&
organizationSlug !== '_' &&
typeof dbRegion !== 'undefined',
...options,
})
}
export const useAvailableOrioleImageVersion = (
{ cloudProvider, dbRegion, organizationSlug }: ProjectCreationPostgresVersionsVariables,
{ enabled }: { enabled?: boolean }
) => {
const { data } = useProjectCreationPostgresVersionsQuery(
{
cloudProvider,
dbRegion,
organizationSlug,
},
{ enabled }
)
return (data?.available_versions ?? []).find((x) => x.postgres_engine === '17-oriole')
}