ruvector/studio/data/integrations/integrations-vercel-projects-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

53 lines
1.7 KiB
TypeScript

import { useQuery } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
import { integrationKeys } from './keys'
import { UseCustomQueryOptions } from 'types'
export type VercelProjectsVariables = {
organization_integration_id: string | undefined
}
export async function getVercelProjects(
{ organization_integration_id }: VercelProjectsVariables,
signal?: AbortSignal
) {
if (!organization_integration_id) {
throw new Error('organization_integration_id is required')
}
const { data, error } = await get(
'/platform/integrations/vercel/projects/{organization_integration_id}',
{
params: {
path: { organization_integration_id },
query: {
// [Alaister]: setting a large limit here to avoid pagination
// until we have merged the new shadcn listbox which will support it
limit: 1000,
},
},
signal,
}
)
if (error) handleError(error)
return data.projects
}
export type VercelProjectsData = Awaited<ReturnType<typeof getVercelProjects>>
export type VercelProjectsResponse = VercelProjectsData[0]
export type VercelProjectsError = unknown
export const useVercelProjectsQuery = <TData = VercelProjectsData>(
{ organization_integration_id }: VercelProjectsVariables,
{
enabled = true,
...options
}: UseCustomQueryOptions<VercelProjectsData, VercelProjectsError, TData> = {}
) =>
useQuery<VercelProjectsData, VercelProjectsError, TData>({
queryKey: integrationKeys.vercelProjectList(organization_integration_id),
queryFn: ({ signal }) => getVercelProjects({ organization_integration_id }, signal),
enabled: enabled && typeof organization_integration_id !== 'undefined',
...options,
})