mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-25 23:24:03 +00:00
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>
103 lines
2.5 KiB
TypeScript
103 lines
2.5 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { get, handleError } from 'data/fetchers'
|
|
import type { ResponseError, UseCustomQueryOptions } from 'types'
|
|
import { docsKeys } from './keys'
|
|
|
|
export type ProjectJsonSchemaVariables = {
|
|
projectRef?: string
|
|
}
|
|
|
|
type ProjectJsonSchemaMethod = {
|
|
tags: string[]
|
|
summary: string
|
|
responses: {
|
|
[key: string]: any
|
|
}
|
|
parameters: { [key: string]: string }[]
|
|
}
|
|
|
|
export type ProjectJsonSchemaDefinitions = {
|
|
[key: string]: {
|
|
type: string
|
|
description: string
|
|
required: string[]
|
|
properties: {
|
|
[key: string]: {
|
|
type: string
|
|
format: string
|
|
description?: string
|
|
enum?: string[]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export type ProjectJsonSchemaPaths = {
|
|
[key: string]: {
|
|
get?: ProjectJsonSchemaMethod
|
|
post?: ProjectJsonSchemaMethod
|
|
patch?: ProjectJsonSchemaMethod
|
|
delete?: ProjectJsonSchemaMethod
|
|
}
|
|
}
|
|
|
|
export type ProjectJsonSchemaResponse = {
|
|
basePath: string
|
|
consumes: string[]
|
|
definitions: ProjectJsonSchemaDefinitions
|
|
externalDocs: { description: string; url: string }
|
|
host: string
|
|
info: {
|
|
title: string
|
|
description: string
|
|
version: string
|
|
}
|
|
parameters: {
|
|
[key: string]: {
|
|
default?: string
|
|
description: string
|
|
in: string
|
|
name: string
|
|
required: boolean
|
|
type?: string
|
|
schema?: { [key: string]: string }
|
|
}
|
|
}
|
|
paths: ProjectJsonSchemaPaths
|
|
produces: string[]
|
|
schemes: string[]
|
|
swagger: string
|
|
}
|
|
|
|
export async function getProjectJsonSchema(
|
|
{ projectRef }: ProjectJsonSchemaVariables,
|
|
signal?: AbortSignal
|
|
) {
|
|
if (!projectRef) throw new Error('projectRef is required')
|
|
|
|
const { data, error } = await get('/platform/projects/{ref}/api/rest', {
|
|
params: { path: { ref: projectRef } },
|
|
signal,
|
|
})
|
|
|
|
if (error) handleError(error)
|
|
return data as unknown as ProjectJsonSchemaResponse
|
|
}
|
|
|
|
export type ProjectJsonSchemaData = Awaited<ReturnType<typeof getProjectJsonSchema>>
|
|
export type ProjectJsonSchemaError = ResponseError
|
|
|
|
export const useProjectJsonSchemaQuery = <TData = ProjectJsonSchemaData>(
|
|
{ projectRef }: ProjectJsonSchemaVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<ProjectJsonSchemaData, ProjectJsonSchemaError, TData> = {}
|
|
) =>
|
|
useQuery<ProjectJsonSchemaData, ProjectJsonSchemaError, TData>({
|
|
queryKey: docsKeys.jsonSchema(projectRef),
|
|
queryFn: ({ signal }) => getProjectJsonSchema({ projectRef }, signal),
|
|
enabled: enabled && typeof projectRef !== 'undefined',
|
|
...options,
|
|
})
|