ruvector/studio/data/replication/pipeline-version-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

48 lines
1.8 KiB
TypeScript

import { useQuery } from '@tanstack/react-query'
import { components } from 'api-types'
import { get, handleError } from 'data/fetchers'
import type { ResponseError, UseCustomQueryOptions } from 'types'
import { replicationKeys } from './keys'
type ReplicationPipelineVersionParams = { projectRef?: string; pipelineId?: number }
type ReplicationPipelineVersionResponse =
components['schemas']['ReplicationPipelineVersionResponse']
export async function fetchReplicationPipelineVersion(
{ projectRef, pipelineId }: ReplicationPipelineVersionParams,
signal?: AbortSignal
) {
if (!projectRef) throw new Error('projectRef is required')
if (!pipelineId) throw new Error('pipelineId is required')
const { data, error } = await get('/platform/replication/{ref}/pipelines/{pipeline_id}/version', {
params: { path: { ref: projectRef, pipeline_id: pipelineId } },
signal,
})
if (error) handleError(error)
return data
}
type ReplicationPipelineVersionData = ReplicationPipelineVersionResponse
export const useReplicationPipelineVersionQuery = <TData = ReplicationPipelineVersionData>(
{ projectRef, pipelineId }: ReplicationPipelineVersionParams,
{
enabled = true,
staleTime = Infinity,
refetchOnMount = false,
refetchOnWindowFocus = false,
...options
}: UseCustomQueryOptions<ReplicationPipelineVersionData, ResponseError, TData> = {}
) =>
useQuery<ReplicationPipelineVersionData, ResponseError, TData>({
queryKey: replicationKeys.pipelinesVersion(projectRef, pipelineId),
queryFn: ({ signal }) => fetchReplicationPipelineVersion({ projectRef, pipelineId }, signal),
enabled: enabled && typeof projectRef !== 'undefined' && typeof pipelineId !== 'undefined',
staleTime,
refetchOnMount,
refetchOnWindowFocus,
...options,
})