import { type EdenClient, type EdenClientError } from '@aydee-app/eden'; import type { CancelOptions, InfiniteData, InvalidateOptions, InvalidateQueryFilters, MutationOptions, QueryClient, QueryFilters, QueryKey, RefetchOptions, RefetchQueryFilters, ResetOptions, SetDataOptions, Updater } from '@tanstack/svelte-query'; import type { AnyElysia } from 'elysia'; import type { EdenQueryConfig } from './config'; import type { EdenFetchInfiniteQueryOptions } from './integration/hooks/fetch-infinite'; import type { EdenFetchQueryOptions } from './integration/hooks/fetch-query'; import type { EdenMutationKey, EdenQueryKey, EdenQueryType } from './integration/internal/query-key'; export declare const EDEN_CONTEXT_KEY: unique symbol; export type EdenContextPropsBase = { /** * Untyped client for making requests. */ client: EdenClient; /** * Whether to forward the `signal` from svelte-query to fetch call. * * @default false * * @deprecated pass abortOnUnmount to `createTRPCReact` instead */ abortOnUnmount?: boolean; }; export type EdenContextProps = EdenContextPropsBase & { /** * The svelte-query `QueryClient` */ queryClient: QueryClient; }; export type EdenContextState = Required> & EdenQueryUtils; export type EdenQueryUtils = { /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery */ fetchQuery: (queryKey: EdenQueryKey, opts?: EdenFetchQueryOptions>) => Promise; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery */ fetchInfiniteQuery: (queryKey: EdenQueryKey, opts?: EdenFetchInfiniteQueryOptions>) => Promise>; /** * @link https://tanstack.com/query/v5/docs/framework/react/guides/prefetching */ prefetchQuery: (queryKey: EdenQueryKey, opts?: EdenFetchQueryOptions>) => Promise; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery */ prefetchInfiniteQuery: (queryKey: EdenQueryKey, opts?: EdenFetchInfiniteQueryOptions>) => Promise; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata */ ensureQueryData: (queryKey: EdenQueryKey, opts?: EdenFetchQueryOptions>) => Promise; /** * @link https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation */ invalidateQueries: (queryKey: EdenQueryKey, filters?: InvalidateQueryFilters, options?: InvalidateOptions) => Promise; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries */ resetQueries: (queryKey: EdenQueryKey, filters?: QueryFilters, options?: ResetOptions) => Promise; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries */ refetchQueries: (queryKey: EdenQueryKey, filters?: RefetchQueryFilters, options?: RefetchOptions) => Promise; /** * @link https://tanstack.com/query/v5/docs/framework/react/guides/query-cancellation */ cancelQuery: (queryKey: EdenQueryKey, options?: CancelOptions) => Promise; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata */ setQueryData: (queryKey: EdenQueryKey, updater: Updater, options?: SetDataOptions) => void; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata */ setQueriesData: (queryKey: EdenQueryKey, filters: QueryFilters, updater: Updater, options?: SetDataOptions) => [QueryKey, unknown][]; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata */ getQueryData: (queryKey: EdenQueryKey) => unknown; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata */ setInfiniteQueryData: (queryKey: EdenQueryKey, updater: Updater | undefined, InfiniteData | undefined>, options?: SetDataOptions) => void; /** * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata */ getInfiniteQueryData: (queryKey: EdenQueryKey) => InfiniteData | undefined; /** * @link https://tanstack.com/query/latest/docs/reference/QueryClient/#queryclientsetmutationdefaults */ setMutationDefaults: (mutationKey: EdenMutationKey, options: MutationOptions | ((args: { canonicalMutationFn: (input: unknown) => Promise; }) => MutationOptions)) => void; /** * @link https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientgetmutationdefaults */ getMutationDefaults: (mutationKey: EdenMutationKey) => MutationOptions | undefined; /** * @link https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientismutating */ isMutating: (filters: { mutationKey: EdenMutationKey; }) => number; }; export declare const contextProps: (keyof EdenContextPropsBase)[]; export declare function getQueryType(utilName: string): EdenQueryType; /** * Creates a set of utility functions that can be used to interact with `react-query` * @param options the `TRPCClient` and `QueryClient` to use * @returns a set of utility functions that can be used to interact with `react-query` * @internal */ export declare function createUtilityFunctions(options: EdenContextProps, config?: EdenQueryConfig): EdenQueryUtils; //# sourceMappingURL=context.d.ts.map