/** * Options Proxy Creation * * Creates a recursive proxy that decorates Eden routes with TanStack Query options. * Transforms Eden Treaty client paths into queryOptions/mutationOptions factories. */ import type { Treaty } from "@elysiajs/eden"; import type { QueryClient } from "@tanstack/react-query"; import type { AnyElysia } from "elysia"; import type { EdenOptionsProxy } from "../types/decorators"; /** Options for creating the proxy */ export interface CreateEdenOptionsProxyOptions { /** Eden Treaty client instance */ client: Treaty.Create; /** * QueryClient instance or getter function. * Reserved for future use (SSR prefetching, React context integration). * Use a getter when the client may not be available at proxy creation time. */ queryClient?: QueryClient | (() => QueryClient); } /** * Path parameter with its associated path index. * Records which path segment the param was applied to. */ export interface PositionedPathParam { /** The index in the path array where this param should be applied */ pathIndex: number; /** The actual parameter values */ params: Record; } /** * Creates a recursive proxy that decorates Eden routes with TanStack Query options. * * @example * ```typescript * const client = treaty('http://localhost:3000') * const queryClient = new QueryClient() * * const eden = createEdenOptionsProxy({ client, queryClient }) * * // Query options * const options = eden.api.users.get.queryOptions({ search: 'test' }) * const { data } = useQuery(options) * * // With path params * const userOptions = eden.api.users({ id: '1' }).get.queryOptions() * * // Mutation options * const createOptions = eden.api.users.post.mutationOptions({ * onSuccess: () => queryClient.invalidateQueries({ queryKey: eden.api.users.get.queryKey() }) * }) * ``` */ export declare function createEdenOptionsProxy(opts: CreateEdenOptionsProxyOptions, paths?: string[], pathParams?: PositionedPathParam[]): EdenOptionsProxy; //# sourceMappingURL=createOptionsProxy.d.ts.map