mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-26 16:04:02 +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>
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { operations } from 'api-types'
|
|
import { get, handleError } from 'data/fetchers'
|
|
import { analyticsKeys } from './keys'
|
|
import { UseCustomQueryOptions } from 'types'
|
|
|
|
export type FunctionsReqStatsVariables = {
|
|
projectRef?: string
|
|
functionId?: string
|
|
interval?: operations['FunctionsLogsController_getRequestStats']['parameters']['query']['interval']
|
|
}
|
|
|
|
export type FunctionsReqStatsResponse = any
|
|
|
|
export async function getFunctionsReqStats(
|
|
{ projectRef, functionId, interval }: FunctionsReqStatsVariables,
|
|
signal?: AbortSignal
|
|
) {
|
|
if (!projectRef) {
|
|
throw new Error('projectRef is required')
|
|
}
|
|
if (!functionId) {
|
|
throw new Error('functionId is required')
|
|
}
|
|
if (!interval) {
|
|
throw new Error('interval is required')
|
|
}
|
|
|
|
const { data, error } = await get(
|
|
'/platform/projects/{ref}/analytics/endpoints/functions.req-stats',
|
|
{
|
|
params: {
|
|
path: {
|
|
ref: projectRef,
|
|
},
|
|
query: {
|
|
function_id: functionId,
|
|
interval,
|
|
},
|
|
},
|
|
signal,
|
|
}
|
|
)
|
|
|
|
if (error) handleError(error)
|
|
|
|
return data
|
|
}
|
|
|
|
export type FunctionsReqStatsData = Awaited<ReturnType<typeof getFunctionsReqStats>>
|
|
export type FunctionsReqStatsError = unknown
|
|
|
|
export const useFunctionsReqStatsQuery = <TData = FunctionsReqStatsData>(
|
|
{ projectRef, functionId, interval }: FunctionsReqStatsVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<FunctionsReqStatsData, FunctionsReqStatsError, TData> = {}
|
|
) =>
|
|
useQuery<FunctionsReqStatsData, FunctionsReqStatsError, TData>({
|
|
queryKey: analyticsKeys.functionsReqStats(projectRef, { functionId, interval }),
|
|
queryFn: ({ signal }) => getFunctionsReqStats({ projectRef, functionId, interval }, signal),
|
|
enabled:
|
|
enabled &&
|
|
typeof projectRef !== 'undefined' &&
|
|
typeof functionId !== 'undefined' &&
|
|
typeof interval !== 'undefined',
|
|
...options,
|
|
})
|