@eleven-am/xquery
Version:
XQuery is a sophisticated TypeScript wrapper for TanStack React Query, designed to enhance developer productivity with OpenAPI-generated clients. It enables developers to build and execute queries using fully type-safe factories instead of managing query
12 lines (11 loc) • 2.64 kB
TypeScript
import { BaseActionOptions, BaseInfiniteOptions, DefinedActionDef, DefinedQueryDef, ErrorMapperFn, GetClientInstance, InferMutationOptions, InferQueryResult, MapQueryKeyFn, MutationDef, QueryClientGetter, QueryResponse, UndefinedQueryDef, UseInfiniteScrollOptions } from "./types";
import type { DefinedInitialDataOptions, UseMutationOptions } from "@tanstack/react-query";
import type { QueryKey } from "@tanstack/query-core";
export declare function buildQueryFn<TData, TError, TClient>(toastError: boolean, clientGetter: GetClientInstance<TClient>, errorMapper: ErrorMapperFn<TError>, queryFn: (client: TClient) => Promise<QueryResponse<TData, TError>>): ({ signal }: {
signal: AbortSignal;
}) => Promise<TData>;
export declare function buildMutationFn<TData, TError, TVariables, TClient>(toastError: boolean, clientGetter: GetClientInstance<TClient>, errorMapper: ErrorMapperFn<TError>, mutationFn: (client: TClient, variables: TVariables) => Promise<QueryResponse<TData, TError>>): (variables: TVariables) => Promise<TData>;
export declare function buildQueryKey<TNamespace, TError, TKey, Result, TClient>(namespace: TNamespace, key: TKey, mapQueryKey: MapQueryKeyFn, clientGetter: GetClientInstance<TClient>, errorMapper: ErrorMapperFn<TError>, options: (DefinedQueryDef<Result, TError, TClient> | UndefinedQueryDef<Result, TError, TClient>)): InferQueryResult<typeof options, TClient, TError, [TNamespace, TKey]>;
export declare function buildMutationOptions<TData, TError, TVariables, TClient>(queryClient: QueryClientGetter, clientGetter: GetClientInstance<TClient>, errorMapper: ErrorMapperFn<TError>, options: MutationDef<TData, TError, TVariables, TClient>): InferMutationOptions<typeof options, TClient, TError>;
export declare function buildActionOptions<TNamespace, TKey, Result, TError, Variables, TClient>(namespace: TNamespace, key: TKey, mapQueryKey: MapQueryKeyFn, queryClient: QueryClientGetter, clientGetter: GetClientInstance<TClient>, errorMapper: ErrorMapperFn<TError>, options: DefinedActionDef<Result, Variables, TClient, TError>): BaseActionOptions<Result, Variables, DefinedInitialDataOptions<Result, TError, Result, [TNamespace, TKey]> | UseMutationOptions<Result, TError, Variables>, TError>;
export declare function buildInfiniteOptions<DataType, TClient, TError, TQueryKey extends QueryKey>(namespace: string, propertyNamespace: string, mapQueryKey: MapQueryKeyFn<TQueryKey>, queryClient: QueryClientGetter, clientGetter: GetClientInstance<TClient>, mapResponse: ErrorMapperFn<TError>, property: BaseInfiniteOptions<DataType, TQueryKey, TClient, TError>): UseInfiniteScrollOptions<DataType, TQueryKey>;