@trpc/react-query 11.25.2 → 11.25.3-canary.13.g1341462e1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{getQueryKey-CWSorJjT.mjs → getQueryKey-BNW1XTCT.mjs} +17 -25
- package/dist/{getQueryKey-CWSorJjT.mjs.map → getQueryKey-BNW1XTCT.mjs.map} +1 -1
- package/dist/{getQueryKey-B3wY6Hsc.d.mts → getQueryKey-BOSmwokO.d.mts} +9 -43
- package/dist/getQueryKey-BOSmwokO.d.mts.map +1 -0
- package/dist/{getQueryKey-DASF3nl1.cjs → getQueryKey-CypUmkSM.cjs} +17 -26
- package/dist/{getQueryKey-CkLbRjaS.d.cts → getQueryKey-Hao5B9db.d.cts} +9 -43
- package/dist/getQueryKey-Hao5B9db.d.cts.map +1 -0
- package/dist/index.cjs +4 -6
- package/dist/index.d.cts +1 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -6
- package/dist/index.mjs.map +1 -1
- package/dist/rsc.cjs +2 -3
- package/dist/rsc.d.cts +4 -6
- package/dist/rsc.d.cts.map +1 -1
- package/dist/rsc.d.mts +4 -6
- package/dist/rsc.d.mts.map +1 -1
- package/dist/rsc.mjs +2 -3
- package/dist/rsc.mjs.map +1 -1
- package/dist/server/index.cjs +3 -4
- package/dist/server/index.d.cts +2 -3
- package/dist/server/index.d.cts.map +1 -1
- package/dist/server/index.d.mts +2 -3
- package/dist/server/index.d.mts.map +1 -1
- package/dist/server/index.mjs +3 -4
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.d.cts +1 -1
- package/dist/shared/index.d.mts +1 -1
- package/dist/shared/index.mjs +1 -2
- package/dist/{shared-v3jJm-s7.cjs → shared-B3bWC0Fi.cjs} +12 -22
- package/dist/{shared-DyU-Vz6d.mjs → shared-joRrXBzs.mjs} +13 -23
- package/dist/{shared-DyU-Vz6d.mjs.map → shared-joRrXBzs.mjs.map} +1 -1
- package/package.json +23 -23
- package/src/rsc.tsx +3 -3
- package/src/server/index.ts +7 -0
- package/src/server/ssgProxy.ts +5 -5
- package/dist/getQueryKey-B3wY6Hsc.d.mts.map +0 -1
- package/dist/getQueryKey-CkLbRjaS.d.cts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-DyU-Vz6d.mjs","names":["useQuery","__useQuery","usePrefetchQuery","useSuspenseQuery","__useSuspenseQuery","useMutation","__useMutation","useInfiniteQuery","__useInfiniteQuery","usePrefetchInfiniteQuery","useSuspenseInfiniteQuery","__useSuspenseInfiniteQuery","useQueries","__useQueries","useSuspenseQueries","__useSuspenseQueries"],"sources":["../src/shared/proxy/decorationProxy.ts","../src/internals/context.tsx","../src/shared/proxy/utilsProxy.ts","../src/shared/proxy/useQueriesProxy.ts","../src/internals/getClientArgs.ts","../src/internals/trpcResult.ts","../src/utils/createUtilityFunctions.ts","../src/shared/hooks/createHooksInternal.tsx","../src/shared/queryClient.ts"],"sourcesContent":["import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\nimport type { CreateReactQueryHooks } from '../hooks/createHooksInternal';\n\n/**\n * Create proxy for decorating procedures\n * @internal\n */\nexport function createReactDecoration<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n>(hooks: CreateReactQueryHooks<TRouter, TSSRContext>) {\n return createRecursiveProxy(({ path, args }) => {\n const pathCopy = [...path];\n\n // The last arg is for instance `.useMutation` or `.useQuery()`\n // oxlint-disable-next-line typescript/no-non-null-assertion\n const lastArg = pathCopy.pop()!;\n\n if (lastArg === 'useMutation') {\n return (hooks as any)[lastArg](pathCopy, ...args);\n }\n\n if (lastArg === '_def') {\n return {\n path: pathCopy,\n };\n }\n\n const [input, ...rest] = args;\n const opts = rest[0] ?? {};\n\n return (hooks as any)[lastArg](pathCopy, input, opts);\n });\n}\n","import type {\n CancelOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InfiniteData,\n InvalidateOptions,\n InvalidateQueryFilters,\n MutationOptions,\n QueryClient,\n QueryFilters,\n QueryKey,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n Updater,\n} from '@tanstack/react-query';\nimport type {\n TRPCClient,\n TRPCClientError,\n TRPCRequestOptions,\n TRPCUntypedClient,\n} from '@trpc/client';\nimport type {\n AnyClientTypes,\n AnyRouter,\n DistributiveOmit,\n} from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport type {\n DefinedTRPCInfiniteQueryOptionsIn,\n DefinedTRPCInfiniteQueryOptionsOut,\n DefinedTRPCQueryOptionsIn,\n DefinedTRPCQueryOptionsOut,\n ExtractCursorType,\n UndefinedTRPCInfiniteQueryOptionsIn,\n UndefinedTRPCInfiniteQueryOptionsOut,\n UndefinedTRPCQueryOptionsIn,\n UndefinedTRPCQueryOptionsOut,\n} from '../shared';\nimport type { TRPCMutationKey, TRPCQueryKey } from './getQueryKey';\n\ninterface TRPCUseUtilsOptions {\n /**\n * tRPC-related options\n */\n trpc?: TRPCRequestOptions;\n}\n/**\n * Options for the `fetch` and `prefetch` helpers.\n */\nexport interface TRPCFetchQueryOptions<TOutput, TError>\n extends\n DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'>,\n TRPCUseUtilsOptions {\n //\n}\n\n/**\n * Options for the `fetchInfinite` and `prefetchInfinite` helpers.\n */\nexport type TRPCFetchInfiniteQueryOptions<TInput, TOutput, TError> =\n DistributiveOmit<\n FetchInfiniteQueryOptions<\n TOutput,\n TError,\n TOutput,\n TRPCQueryKey,\n ExtractCursorType<TInput>\n >,\n 'queryKey' | 'initialPageParam'\n > &\n TRPCUseUtilsOptions & {\n /**\n * The cursor for the first page.\n */\n initialCursor?: ExtractCursorType<TInput>;\n };\n\n/** @internal */\nexport type SSRState = 'mounted' | 'mounting' | 'prepass' | false;\n\n/**\n * Props shared by the tRPC React context and its `Provider`.\n */\nexport interface TRPCContextPropsBase<TRouter extends AnyRouter, TSSRContext> {\n /**\n * The `TRPCClient`\n */\n client: TRPCUntypedClient<TRouter>;\n /**\n * The SSR context when server-side rendering\n * @default null\n */\n ssrContext?: TSSRContext | null;\n /**\n * State of SSR hydration.\n * - `false` if not using SSR.\n * - `prepass` when doing a prepass to fetch queries' data\n * - `mounting` before TRPCProvider has been rendered on the client\n * - `mounted` when the TRPCProvider has been rendered on the client\n * @default false\n */\n ssrState?: SSRState;\n /**\n * @deprecated pass abortOnUnmount to `createTRPCReact` instead\n * Abort loading query calls when unmounting a component - usually when navigating to a new page\n * @default false\n */\n abortOnUnmount?: boolean;\n}\n\n/**\n * @internal\n */\nexport type DecoratedTRPCContextProps<\n TRouter extends AnyRouter,\n TSSRContext,\n> = TRPCContextPropsBase<TRouter, TSSRContext> & {\n client: TRPCClient<TRouter>;\n};\n\n/**\n * Props for the tRPC React context: the base props plus a `QueryClient`.\n */\nexport interface TRPCContextProps<\n TRouter extends AnyRouter,\n TSSRContext,\n> extends TRPCContextPropsBase<TRouter, TSSRContext> {\n /**\n * The react-query `QueryClient`\n */\n queryClient: QueryClient;\n}\n\n/**\n * The keys of {@link TRPCContextPropsBase}.\n */\nexport const contextProps: (keyof TRPCContextPropsBase<any, any>)[] = [\n 'client',\n 'ssrContext',\n 'ssrState',\n 'abortOnUnmount',\n];\n\n/**\n * @internal\n */\nexport interface TRPCContextState<\n TRouter extends AnyRouter,\n TSSRContext = undefined,\n>\n extends\n Required<TRPCContextProps<TRouter, TSSRContext>>,\n TRPCQueryUtils<TRouter> {}\n\n/**\n * @internal\n */\nexport interface TRPCQueryUtils<TRouter extends AnyRouter> {\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts?: UndefinedTRPCQueryOptionsIn<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): UndefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n queryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: DefinedTRPCQueryOptionsIn<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): DefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: UndefinedTRPCInfiniteQueryOptionsIn<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): UndefinedTRPCInfiniteQueryOptionsOut<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n infiniteQueryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: DefinedTRPCInfiniteQueryOptionsIn<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): DefinedTRPCInfiniteQueryOptionsOut<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery\n */\n fetchQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,\n ) => Promise<unknown>;\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery\n */\n fetchInfiniteQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchInfiniteQueryOptions<\n unknown,\n unknown,\n TRPCClientError<TRouter>\n >,\n ) => Promise<InfiniteData<unknown, unknown>>;\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching\n */\n prefetchQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery\n */\n prefetchInfiniteQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchInfiniteQueryOptions<\n unknown,\n unknown,\n TRPCClientError<TRouter>\n >,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata\n */\n ensureQueryData: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,\n ) => Promise<unknown>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation\n */\n invalidateQueries: (\n queryKey: TRPCQueryKey,\n filters?: InvalidateQueryFilters<TRPCQueryKey>,\n options?: InvalidateOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries\n */\n resetQueries: (\n queryKey: TRPCQueryKey,\n filters?: QueryFilters<TRPCQueryKey>,\n options?: ResetOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries\n */\n refetchQueries: (\n queryKey: TRPCQueryKey,\n filters?: RefetchQueryFilters<TRPCQueryKey>,\n options?: RefetchOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-cancellation\n */\n cancelQuery: (\n queryKey: TRPCQueryKey,\n options?: CancelOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setQueryData: (\n queryKey: TRPCQueryKey,\n updater: Updater<unknown, unknown>,\n options?: SetDataOptions,\n ) => void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata\n */\n // oxlint-disable-next-line max-params -- mirrors TanStack Query's own signature\n setQueriesData: (\n queryKey: TRPCQueryKey,\n filters: QueryFilters,\n updater: Updater<unknown, unknown>,\n options?: SetDataOptions,\n ) => [QueryKey, unknown][];\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getQueryData: (queryKey: TRPCQueryKey) => unknown;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setInfiniteQueryData: (\n queryKey: TRPCQueryKey,\n updater: Updater<\n InfiniteData<unknown> | undefined,\n InfiniteData<unknown> | undefined\n >,\n options?: SetDataOptions,\n ) => void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getInfiniteQueryData: (\n queryKey: TRPCQueryKey,\n ) => InfiniteData<unknown> | undefined;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient/#queryclientsetmutationdefaults\n */\n setMutationDefaults: (\n mutationKey: TRPCMutationKey,\n options:\n | MutationOptions\n | ((args: {\n canonicalMutationFn: (input: unknown) => Promise<unknown>;\n }) => MutationOptions),\n ) => void;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientgetmutationdefaults\n */\n getMutationDefaults: (\n mutationKey: TRPCMutationKey,\n ) => MutationOptions | undefined;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientismutating\n */\n isMutating: (filters: { mutationKey: TRPCMutationKey }) => number;\n}\n/**\n * The React context that holds the tRPC client and `QueryClient`.\n */\nexport const TRPCContext = React.createContext?.(null as any);\n","import type {\n CancelOptions,\n InfiniteData,\n InvalidateOptions,\n InvalidateQueryFilters,\n Query,\n QueryFilters,\n QueryKey,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n SkipToken,\n Updater,\n} from '@tanstack/react-query';\nimport { skipToken } from '@tanstack/react-query';\nimport type { TRPCClientError } from '@trpc/client';\nimport { createTRPCClientProxy } from '@trpc/client';\nimport type {\n AnyMutationProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n DeepPartial,\n inferProcedureInput,\n inferProcedureOutput,\n inferTransformedProcedureOutput,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n createFlatProxy,\n createRecursiveProxy,\n} from '@trpc/server/unstable-core-do-not-import';\nimport type {\n DecoratedTRPCContextProps,\n TRPCContextState,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n TRPCQueryUtils,\n} from '../../internals/context';\nimport { contextProps } from '../../internals/context';\nimport type { QueryKeyKnown, QueryType } from '../../internals/getQueryKey';\nimport {\n getMutationKeyInternal,\n getQueryKeyInternal,\n} from '../../internals/getQueryKey';\nimport type { InferMutationOptions } from '../../utils/inferReactQueryProcedure';\nimport type { ExtractCursorType } from '../hooks/types';\nimport type {\n DefinedTRPCInfiniteQueryOptionsIn,\n DefinedTRPCInfiniteQueryOptionsOut,\n DefinedTRPCQueryOptionsIn,\n DefinedTRPCQueryOptionsOut,\n UndefinedTRPCInfiniteQueryOptionsIn,\n UndefinedTRPCInfiniteQueryOptionsOut,\n UndefinedTRPCQueryOptionsIn,\n UndefinedTRPCQueryOptionsOut,\n UnusedSkipTokenTRPCInfiniteQueryOptionsIn,\n UnusedSkipTokenTRPCInfiniteQueryOptionsOut,\n UnusedSkipTokenTRPCQueryOptionsIn,\n UnusedSkipTokenTRPCQueryOptionsOut,\n} from '../types';\n\n/**\n * The `useUtils` helpers for one query procedure.\n * @see https://trpc.io/docs/client/react/useUtils#helpers\n */\nexport type DecorateQueryProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyQueryProcedure,\n> = {\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts: DefinedTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): DefinedTRPCQueryOptionsOut<TQueryFnData, TData, TRPCClientError<TRoot>>;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts?: UnusedSkipTokenTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UnusedSkipTokenTRPCQueryOptionsOut<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts?: UndefinedTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UndefinedTRPCQueryOptionsOut<TQueryFnData, TData, TRPCClientError<TRoot>>;\n\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts: DefinedTRPCInfiniteQueryOptionsIn<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): DefinedTRPCInfiniteQueryOptionsOut<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure>,\n opts: UnusedSkipTokenTRPCInfiniteQueryOptionsIn<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UnusedSkipTokenTRPCInfiniteQueryOptionsOut<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts?: UndefinedTRPCInfiniteQueryOptionsIn<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UndefinedTRPCInfiniteQueryOptionsOut<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery\n */\n fetch(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery\n */\n fetchInfinite(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput<TProcedure>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<\n InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchquery\n */\n prefetch(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery\n */\n prefetchInfinite(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput<TProcedure>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata\n */\n ensureData(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientinvalidatequeries\n */\n invalidate(\n input?: DeepPartial<inferProcedureInput<TProcedure>>,\n filters?: Omit<InvalidateQueryFilters, 'predicate'> & {\n predicate?: (\n query: Query<\n inferProcedureOutput<TProcedure>,\n TRPCClientError<TRoot>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n QueryKeyKnown<\n inferProcedureInput<TProcedure>,\n inferProcedureInput<TProcedure> extends { cursor?: any } | void\n ? 'infinite'\n : 'query'\n >\n >,\n ) => boolean;\n },\n options?: InvalidateOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries\n */\n refetch(\n input?: inferProcedureInput<TProcedure>,\n filters?: RefetchQueryFilters,\n options?: RefetchOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientcancelqueries\n */\n cancel(\n input?: inferProcedureInput<TProcedure>,\n options?: CancelOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries\n */\n reset(\n input?: inferProcedureInput<TProcedure>,\n options?: ResetOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setData(\n /**\n * The input of the procedure\n */\n input: inferProcedureInput<TProcedure>,\n updater: Updater<\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined,\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined\n >,\n options?: SetDataOptions,\n ): void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setQueriesData(\n /**\n * The input of the procedure\n */\n input: inferProcedureInput<TProcedure>,\n filters: QueryFilters,\n updater: Updater<\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined,\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined\n >,\n options?: SetDataOptions,\n ): [QueryKey, inferTransformedProcedureOutput<TRoot, TProcedure>];\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setInfiniteData(\n input: inferProcedureInput<TProcedure>,\n updater: Updater<\n | InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n | undefined,\n | InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n | undefined\n >,\n options?: SetDataOptions,\n ): void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getData(\n input?: inferProcedureInput<TProcedure>,\n ): inferTransformedProcedureOutput<TRoot, TProcedure> | undefined;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getInfiniteData(\n input?: inferProcedureInput<TProcedure>,\n ):\n | InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n | undefined;\n};\n\ntype DecorateMutationProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyMutationProcedure,\n> = {\n setMutationDefaults<TMeta = unknown>(\n options:\n | InferMutationOptions<TRoot, TProcedure, TMeta>\n | ((args: {\n canonicalMutationFn: NonNullable<\n InferMutationOptions<TRoot, TProcedure>['mutationFn']\n >;\n }) => InferMutationOptions<TRoot, TProcedure, TMeta>),\n ): void;\n\n getMutationDefaults(): InferMutationOptions<TRoot, TProcedure> | undefined;\n\n isMutating(): number;\n};\n\n/**\n * this is the type that is used to add in procedures that can be used on\n * an entire router\n */\ntype DecorateRouter = {\n /**\n * Invalidate the full router\n * @see https://trpc.io/docs/client/react/useUtils#invalidating-across-whole-routers\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation\n */\n invalidate(\n input?: undefined,\n filters?: InvalidateQueryFilters,\n options?: InvalidateOptions,\n ): Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type DecoratedProcedureUtilsRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = DecorateRouter & {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? DecorateQueryProcedure<TRoot, $Value>\n : $Value extends AnyMutationProcedure\n ? DecorateMutationProcedure<TRoot, $Value>\n : $Value extends RouterRecord\n ? DecoratedProcedureUtilsRecord<TRoot, $Value> & DecorateRouter\n : never\n : never;\n}; // Add functions that should be available at utils root\n\ntype AnyDecoratedProcedure = DecorateQueryProcedure<any, any> &\n DecorateMutationProcedure<any, any>;\n\n/**\n * What `useUtils()` returns: the context props plus helpers for every procedure.\n * @see https://trpc.io/docs/client/react/useUtils\n */\nexport type CreateReactUtils<\n TRouter extends AnyRouter,\n TSSRContext,\n> = ProtectedIntersection<\n DecoratedTRPCContextProps<TRouter, TSSRContext>,\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n>;\n\n/**\n * What `createTRPCQueryUtils` returns.\n * @see https://trpc.io/docs/client/react/createTRPCQueryUtils\n */\nexport type CreateQueryUtils<TRouter extends AnyRouter> =\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >;\n\n/**\n * Maps a `useUtils` helper name to the kind of query it works on.\n */\nexport const getQueryType = (\n utilName: keyof AnyDecoratedProcedure,\n): QueryType => {\n switch (utilName) {\n case 'queryOptions':\n case 'fetch':\n case 'ensureData':\n case 'prefetch':\n case 'getData':\n case 'setData':\n case 'setQueriesData':\n return 'query';\n\n case 'infiniteQueryOptions':\n case 'fetchInfinite':\n case 'prefetchInfinite':\n case 'getInfiniteData':\n case 'setInfiniteData':\n return 'infinite';\n\n case 'setMutationDefaults':\n case 'getMutationDefaults':\n case 'isMutating':\n case 'cancel':\n case 'invalidate':\n case 'refetch':\n case 'reset':\n return 'any';\n }\n};\n\n/**\n * @internal\n */\nfunction createRecursiveUtilsProxy<TRouter extends AnyRouter>(\n context: TRPCQueryUtils<TRouter>,\n) {\n return createRecursiveProxy<CreateQueryUtils<TRouter>>((opts) => {\n const path = [...opts.path];\n const utilName = path.pop() as keyof AnyDecoratedProcedure;\n const args = [...opts.args] as Parameters<\n AnyDecoratedProcedure[typeof utilName]\n >;\n const input = args.shift(); // args can now be spread when input removed\n const queryType = getQueryType(utilName);\n const queryKey = getQueryKeyInternal(path, input, queryType);\n\n // `getQueryKeyInternal` strips `skipToken` from the query key, so the\n // options helpers can't detect it and would return a real `queryFn`\n const withSkipToken = <TOptions extends object>(options: TOptions) =>\n input === skipToken ? { ...options, queryFn: skipToken } : options;\n\n const contextMap: Record<keyof AnyDecoratedProcedure, () => unknown> = {\n infiniteQueryOptions: () =>\n withSkipToken(context.infiniteQueryOptions(path, queryKey, args[0])),\n queryOptions: () =>\n withSkipToken(context.queryOptions(path, queryKey, ...args)),\n /**\n * DecorateQueryProcedure\n */\n fetch: () => context.fetchQuery(queryKey, ...args),\n fetchInfinite: () => context.fetchInfiniteQuery(queryKey, args[0]),\n prefetch: () => context.prefetchQuery(queryKey, ...args),\n prefetchInfinite: () => context.prefetchInfiniteQuery(queryKey, args[0]),\n ensureData: () => context.ensureQueryData(queryKey, ...args),\n invalidate: () => context.invalidateQueries(queryKey, ...args),\n reset: () => context.resetQueries(queryKey, ...args),\n refetch: () => context.refetchQueries(queryKey, ...args),\n cancel: () => context.cancelQuery(queryKey, ...args),\n setData: () => {\n context.setQueryData(queryKey, args[0], args[1]);\n },\n setQueriesData: () =>\n context.setQueriesData(queryKey, args[0], args[1], args[2]),\n setInfiniteData: () => {\n context.setInfiniteQueryData(queryKey, args[0], args[1]);\n },\n getData: () => context.getQueryData(queryKey),\n getInfiniteData: () => context.getInfiniteQueryData(queryKey),\n /**\n * DecorateMutationProcedure\n */\n setMutationDefaults: () =>\n context.setMutationDefaults(getMutationKeyInternal(path), input),\n getMutationDefaults: () =>\n context.getMutationDefaults(getMutationKeyInternal(path)),\n isMutating: () =>\n context.isMutating({ mutationKey: getMutationKeyInternal(path) }),\n };\n\n return contextMap[utilName]();\n });\n}\n\n/**\n * @internal\n */\nexport function createReactQueryUtils<TRouter extends AnyRouter, TSSRContext>(\n context: TRPCContextState<AnyRouter, TSSRContext>,\n) {\n type CreateReactUtilsReturnType = CreateReactUtils<TRouter, TSSRContext>;\n\n const clientProxy = createTRPCClientProxy(context.client);\n\n const proxy = createRecursiveUtilsProxy(\n context,\n ) as CreateReactUtilsReturnType;\n\n return createFlatProxy<CreateReactUtilsReturnType>((key) => {\n const contextName = key as (typeof contextProps)[number];\n if (contextName === 'client') {\n return clientProxy;\n }\n if (contextProps.includes(contextName)) {\n return context[contextName];\n }\n\n return proxy[key];\n });\n}\n\n/**\n * @internal\n */\nexport function createQueryUtilsProxy<TRouter extends AnyRouter>(\n context: TRPCQueryUtils<TRouter>,\n): CreateQueryUtils<TRouter> {\n return createRecursiveUtilsProxy(context);\n}\n","import type { QueryOptions } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport {\n getUntypedClient,\n TRPCUntypedClient,\n type TRPCClientError,\n} from '@trpc/client';\nimport type {\n AnyProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferProcedureInput,\n inferTransformedProcedureOutput,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\nimport { getQueryKeyInternal } from '../../internals/getQueryKey';\nimport type {\n TrpcQueryOptionsForUseQueries,\n TrpcQueryOptionsForUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport type { TRPCUseQueryBaseOptions } from '../hooks/types';\n\ntype GetQueryOptions<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyProcedure,\n> = <TData = inferTransformedProcedureOutput<TRoot, TProcedure>>(\n input: inferProcedureInput<TProcedure>,\n opts?: TrpcQueryOptionsForUseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n >,\n) => TrpcQueryOptionsForUseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n>;\n\n/**\n * @internal\n */\nexport type UseQueriesProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? GetQueryOptions<TRoot, $Value>\n : $Value extends RouterRecord\n ? UseQueriesProcedureRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype GetSuspenseQueryOptions<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyQueryProcedure,\n> = <TData = inferTransformedProcedureOutput<TRoot, TProcedure>>(\n input: inferProcedureInput<TProcedure>,\n opts?: TrpcQueryOptionsForUseSuspenseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n >,\n) => TrpcQueryOptionsForUseSuspenseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n>;\n\n/**\n * @internal\n */\nexport type UseSuspenseQueriesProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? GetSuspenseQueryOptions<TRoot, $Value>\n : $Value extends RouterRecord\n ? UseSuspenseQueriesProcedureRecord<TRoot, $Value>\n : never\n : never;\n};\n\n/**\n * Create proxy for `useQueries` options\n * @internal\n */\nexport function createUseQueries<TRouter extends AnyRouter>(\n client: TRPCUntypedClient<TRouter> | TRPCClient<TRouter>,\n) {\n const untypedClient: TRPCUntypedClient<TRouter> =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return createRecursiveProxy<\n UseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >((opts) => {\n const arrayPath = opts.path;\n const dotPath = arrayPath.join('.');\n const [input, _opts] = opts.args as [\n unknown,\n Partial<QueryOptions> & TRPCUseQueryBaseOptions,\n ];\n\n const options: QueryOptions = {\n queryKey: getQueryKeyInternal(arrayPath, input, 'query'),\n queryFn: () => {\n return untypedClient.query(dotPath, input, _opts?.trpc);\n },\n ..._opts,\n };\n\n return options;\n });\n}\n","import type { TRPCQueryKey } from './getQueryKey';\n\n/**\n * @internal\n */\nexport function getClientArgs<TOptions>(\n queryKey: TRPCQueryKey,\n opts: TOptions,\n infiniteParams?: {\n pageParam: any;\n direction: 'forward' | 'backward';\n },\n) {\n const path = queryKey[0];\n let input = queryKey[1]?.input;\n if (infiniteParams) {\n input = {\n ...(input ?? {}),\n ...(infiniteParams.pageParam !== undefined\n ? { cursor: infiniteParams.pageParam }\n : {}),\n direction: infiniteParams.direction,\n };\n }\n return [path.join('.'), input, (opts as any)?.trpc] as const;\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport * as React from 'react';\nimport type { TRPCQueryOptionsResult } from '../shared';\nimport type { TRPCHookResult } from '../shared/hooks/types';\nimport type { TRPCQueryKey } from './getQueryKey';\n\nexport function createTRPCOptionsResult(value: {\n path: readonly string[];\n}): TRPCQueryOptionsResult['trpc'] {\n const path = value.path.join('.');\n\n return {\n path,\n };\n}\n\n/**\n * Makes a stable reference of the `trpc` prop\n */\nexport function useHookResult(value: {\n path: readonly string[];\n}): TRPCHookResult['trpc'] {\n const result = createTRPCOptionsResult(value);\n return React.useMemo(() => result, [result]);\n}\n\n/**\n * @internal\n */\nexport async function buildQueryFromAsyncIterable(\n asyncIterable: AsyncIterable<unknown>,\n queryClient: QueryClient,\n queryKey: TRPCQueryKey,\n) {\n const queryCache = queryClient.getQueryCache();\n\n const query = queryCache.build(queryClient, {\n queryKey,\n });\n\n query.setState({\n data: [],\n status: 'success',\n });\n\n const aggregate: unknown[] = [];\n for await (const value of asyncIterable) {\n aggregate.push(value);\n\n query.setState({\n data: [...aggregate],\n });\n }\n return aggregate;\n}\n","import type { QueryFunctionContext } from '@tanstack/react-query';\nimport {\n infiniteQueryOptions,\n queryOptions,\n skipToken,\n type QueryClient,\n} from '@tanstack/react-query';\nimport type { TRPCClient, TRPCClientError } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';\nimport type { AnyClientTypes } from '@trpc/server/unstable-core-do-not-import/clientish/inferrable';\nimport { getClientArgs } from '../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../internals/getQueryKey';\nimport {\n buildQueryFromAsyncIterable,\n createTRPCOptionsResult,\n} from '../internals/trpcResult';\nimport type { DefinedTRPCQueryOptionsOut } from '../shared';\nimport { type TRPCQueryUtils } from '../shared';\n\nexport interface CreateQueryUtilsOptions<TRouter extends AnyRouter> {\n /**\n * The `TRPCClient`\n */\n client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;\n /**\n * The `QueryClient` from `react-query`\n */\n queryClient: QueryClient;\n}\n\n/**\n * Creates a set of utility functions that can be used to interact with `react-query`\n * @param opts the `TRPCClient` and `QueryClient` to use\n * @returns a set of utility functions that can be used to interact with `react-query`\n * @internal\n */\nexport function createUtilityFunctions<TRouter extends AnyRouter>(\n opts: CreateQueryUtilsOptions<TRouter>,\n): TRPCQueryUtils<TRouter> {\n const { client, queryClient } = opts;\n const untypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return {\n infiniteQueryOptions: (path, queryKey, opts) => {\n const inputIsSkipToken = queryKey[1]?.input === skipToken;\n\n const queryFn = async (\n queryFnContext: QueryFunctionContext<TRPCQueryKey, unknown>,\n ): Promise<unknown> => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(opts?.trpc?.abortOnUnmount\n ? { signal: queryFnContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await untypedClient.query(\n ...getClientArgs(queryKey, actualOpts, {\n direction: queryFnContext.direction,\n pageParam: queryFnContext.pageParam ?? opts?.initialCursor,\n }),\n );\n\n return result;\n };\n\n return Object.assign(\n infiniteQueryOptions({\n ...opts,\n initialData: opts?.initialData as any,\n queryKey,\n queryFn: inputIsSkipToken ? skipToken : queryFn,\n initialPageParam: (opts?.initialCursor as any) ?? null,\n }),\n { trpc: createTRPCOptionsResult({ path }) },\n );\n },\n\n queryOptions: (path, queryKey, opts) => {\n const inputIsSkipToken = queryKey[1]?.input === skipToken;\n\n const queryFn = async (\n queryFnContext: QueryFunctionContext<TRPCQueryKey>,\n ): Promise<unknown> => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(opts?.trpc?.abortOnUnmount\n ? { signal: queryFnContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await untypedClient.query(\n ...getClientArgs(queryKey, actualOpts),\n );\n\n if (isAsyncIterable(result)) {\n return buildQueryFromAsyncIterable(result, queryClient, queryKey);\n }\n\n return result;\n };\n\n return Object.assign(\n queryOptions({\n ...opts,\n initialData: opts?.initialData,\n queryKey,\n queryFn: inputIsSkipToken ? skipToken : queryFn,\n }),\n { trpc: createTRPCOptionsResult({ path }) },\n ) as DefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n },\n\n fetchQuery: (queryKey, opts) => {\n return queryClient.fetchQuery({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n fetchInfiniteQuery: (queryKey, opts) => {\n return queryClient.fetchInfiniteQuery({\n ...opts,\n queryKey,\n queryFn: ({ pageParam, direction }) => {\n return untypedClient.query(\n ...getClientArgs(queryKey, opts, {\n pageParam: pageParam ?? opts?.initialCursor,\n direction,\n }),\n );\n },\n initialPageParam: opts?.initialCursor ?? null,\n });\n },\n\n prefetchQuery: (queryKey, opts) => {\n return queryClient.prefetchQuery({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n prefetchInfiniteQuery: (queryKey, opts) => {\n return queryClient.prefetchInfiniteQuery({\n ...opts,\n queryKey,\n queryFn: ({ pageParam, direction }) => {\n return untypedClient.query(\n ...getClientArgs(queryKey, opts, {\n pageParam: pageParam ?? opts?.initialCursor,\n direction,\n }),\n );\n },\n initialPageParam: opts?.initialCursor ?? null,\n });\n },\n\n ensureQueryData: (queryKey, opts) => {\n return queryClient.ensureQueryData({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n invalidateQueries: (queryKey, filters, options) => {\n return queryClient.invalidateQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n resetQueries: (queryKey, filters, options) => {\n return queryClient.resetQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n\n refetchQueries: (queryKey, filters, options) => {\n return queryClient.refetchQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n\n cancelQuery: (queryKey, options) => {\n return queryClient.cancelQueries(\n {\n queryKey,\n },\n options,\n );\n },\n\n setQueryData: (queryKey, updater, options) => {\n return queryClient.setQueryData(queryKey, updater, options);\n },\n\n // oxlint-disable-next-line max-params\n setQueriesData: (queryKey, filters, updater, options) => {\n return queryClient.setQueriesData(\n {\n ...filters,\n queryKey,\n },\n updater,\n options,\n );\n },\n\n getQueryData: (queryKey) => {\n return queryClient.getQueryData(queryKey);\n },\n\n setInfiniteQueryData: (queryKey, updater, options) => {\n return queryClient.setQueryData(queryKey, updater, options);\n },\n\n getInfiniteQueryData: (queryKey) => {\n return queryClient.getQueryData(queryKey);\n },\n\n setMutationDefaults: (mutationKey, options) => {\n const path = mutationKey[0];\n const canonicalMutationFn = (input: unknown) => {\n return untypedClient.mutation(\n ...getClientArgs([path, { input }], opts),\n );\n };\n return queryClient.setMutationDefaults(\n mutationKey,\n typeof options === 'function'\n ? options({ canonicalMutationFn })\n : options,\n );\n },\n\n getMutationDefaults: (mutationKey) => {\n return queryClient.getMutationDefaults(mutationKey);\n },\n\n isMutating: (filters) => {\n return queryClient.isMutating({\n ...filters,\n exact: true,\n });\n },\n };\n}\n","// TODO: Look into fixing react-compiler support\nimport {\n useInfiniteQuery as __useInfiniteQuery,\n useMutation as __useMutation,\n usePrefetchInfiniteQuery as __usePrefetchInfiniteQuery,\n useQueries as __useQueries,\n useQuery as __useQuery,\n useSuspenseInfiniteQuery as __useSuspenseInfiniteQuery,\n useSuspenseQueries as __useSuspenseQueries,\n useSuspenseQuery as __useSuspenseQuery,\n usePrefetchQuery as _usePrefetchQuery,\n hashKey,\n skipToken,\n} from '@tanstack/react-query';\nimport type { TRPCClientErrorLike } from '@trpc/client';\nimport {\n createTRPCClient,\n getUntypedClient,\n TRPCUntypedClient,\n} from '@trpc/client';\nimport type { Unsubscribable } from '@trpc/server/observable';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport type { SSRState, TRPCContextState } from '../../internals/context';\nimport { TRPCContext } from '../../internals/context';\nimport { getClientArgs } from '../../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../../internals/getQueryKey';\nimport {\n getMutationKeyInternal,\n getQueryKeyInternal,\n} from '../../internals/getQueryKey';\nimport {\n buildQueryFromAsyncIterable,\n useHookResult,\n} from '../../internals/trpcResult';\nimport type {\n QueriesResults,\n TRPCUseQueries,\n TRPCUseSuspenseQueries,\n UseQueryOptionsForUseQueries,\n UseQueryOptionsForUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport { createUtilityFunctions } from '../../utils/createUtilityFunctions';\nimport type {\n UseQueriesProcedureRecord,\n UseSuspenseQueriesProcedureRecord,\n} from '../proxy/useQueriesProxy';\nimport { createUseQueries } from '../proxy/useQueriesProxy';\nimport type { CreateTRPCReactOptions, UseMutationOverride } from '../types';\nimport type {\n TRPCProvider,\n TRPCQueryOptions,\n TRPCSubscriptionConnectingResult,\n TRPCSubscriptionIdleResult,\n TRPCSubscriptionResult,\n UseTRPCInfiniteQueryOptions,\n UseTRPCInfiniteQueryResult,\n UseTRPCMutationOptions,\n UseTRPCMutationResult,\n UseTRPCPrefetchInfiniteQueryOptions,\n UseTRPCPrefetchQueryOptions,\n UseTRPCQueryOptions,\n UseTRPCQueryResult,\n UseTRPCSubscriptionOptions,\n UseTRPCSuspenseInfiniteQueryOptions,\n UseTRPCSuspenseInfiniteQueryResult,\n UseTRPCSuspenseQueryOptions,\n UseTRPCSuspenseQueryResult,\n} from './types';\n\nconst trackResult = <T extends object>(\n result: T,\n onTrackResult: (key: keyof T) => void,\n): T => {\n const trackedResult = new Proxy(result, {\n get(target, prop) {\n onTrackResult(prop as keyof T);\n return target[prop as keyof T];\n },\n });\n\n return trackedResult;\n};\n\n/**\n * @internal\n */\nexport function createRootHooks<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n>(config?: CreateTRPCReactOptions<TRouter>) {\n const mutationSuccessOverride: UseMutationOverride['onSuccess'] =\n config?.overrides?.useMutation?.onSuccess ??\n ((options) => options.originalFn());\n\n type TError = TRPCClientErrorLike<TRouter>;\n\n type ProviderContext = TRPCContextState<TRouter, TSSRContext>;\n\n const Context = (config?.context ??\n TRPCContext) as React.Context<ProviderContext>;\n\n const createClient = createTRPCClient<TRouter>;\n\n const TRPCProvider: TRPCProvider<TRouter, TSSRContext> = (props) => {\n const { abortOnUnmount = false, queryClient, ssrContext } = props;\n const [ssrState, setSSRState] = React.useState<SSRState>(\n props.ssrState ?? false,\n );\n\n const client: TRPCUntypedClient<TRouter> =\n props.client instanceof TRPCUntypedClient\n ? props.client\n : getUntypedClient(props.client);\n\n const fns = React.useMemo(\n () =>\n createUtilityFunctions({\n client,\n queryClient,\n }),\n [client, queryClient],\n );\n\n const contextValue = React.useMemo<ProviderContext>(\n () => ({\n abortOnUnmount,\n queryClient,\n client,\n ssrContext: ssrContext ?? null,\n ssrState,\n ...fns,\n }),\n [abortOnUnmount, client, fns, queryClient, ssrContext, ssrState],\n );\n\n React.useEffect(() => {\n // Only updating state to `mounted` if we are using SSR.\n // This makes it so we don't have an unnecessary re-render when opting out of SSR.\n setSSRState((state) => (state ? 'mounted' : false));\n }, []);\n return (\n <Context.Provider value={contextValue}>{props.children}</Context.Provider>\n );\n };\n\n function useContext() {\n const context = React.useContext(Context);\n\n if (!context) {\n throw new Error(\n 'Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?',\n );\n }\n return context;\n }\n\n /**\n * Hack to make sure errors return `status`='error` when doing SSR\n * @see https://github.com/trpc/trpc/pull/1645\n */\n function useSSRQueryOptionsIfNeeded<\n TOptions extends { retryOnMount?: unknown } | undefined,\n >(queryKey: TRPCQueryKey, opts: TOptions): TOptions {\n const { queryClient, ssrState } = useContext();\n return ssrState &&\n ssrState !== 'mounted' &&\n queryClient.getQueryCache().find({ queryKey })?.state.status === 'error'\n ? {\n retryOnMount: false,\n ...opts,\n }\n : opts;\n }\n\n function useQuery(\n path: readonly string[],\n input: unknown,\n opts?: UseTRPCQueryOptions<unknown, unknown, TError>,\n ): UseTRPCQueryResult<unknown, TError> {\n const context = useContext();\n const { abortOnUnmount, client, ssrState, queryClient, prefetchQuery } =\n context;\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const defaultOpts = queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n if (\n typeof window === 'undefined' &&\n ssrState === 'prepass' &&\n opts?.trpc?.ssr !== false &&\n (opts?.enabled ?? defaultOpts?.enabled) !== false &&\n !isInputSkipToken &&\n !queryClient.getQueryCache().find({ queryKey })\n ) {\n void prefetchQuery(queryKey, opts as any);\n }\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? config?.abortOnUnmount ?? abortOnUnmount;\n\n const hook = __useQuery(\n {\n ...ssrOpts,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : async (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await client.query(\n ...getClientArgs(queryKey, actualOpts),\n );\n\n if (isAsyncIterable(result)) {\n return buildQueryFromAsyncIterable(\n result,\n queryClient,\n queryKey,\n );\n }\n return result;\n },\n },\n queryClient,\n ) as UseTRPCQueryResult<unknown, TError>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return hook;\n }\n\n function usePrefetchQuery(\n path: string[],\n input: unknown,\n opts?: UseTRPCPrefetchQueryOptions<unknown, unknown, TError>,\n ): void {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const isInputSkipToken = input === skipToken;\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ??\n config?.abortOnUnmount ??\n context.abortOnUnmount;\n\n _usePrefetchQuery({\n ...opts,\n queryKey: queryKey as any,\n // usePrefetchQuery's types exclude skipToken, but query-core handles it at runtime\n queryFn: isInputSkipToken\n ? (input as never)\n : (queryFunctionContext) => {\n const actualOpts = {\n trpc: {\n ...opts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(...getClientArgs(queryKey, actualOpts));\n },\n });\n }\n\n function useSuspenseQuery(\n path: readonly string[],\n input: unknown,\n opts?: UseTRPCSuspenseQueryOptions<unknown, unknown, TError>,\n ): UseTRPCSuspenseQueryResult<unknown, TError> {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ??\n config?.abortOnUnmount ??\n context.abortOnUnmount;\n\n const hook = __useSuspenseQuery(\n {\n ...opts,\n queryKey: queryKey as any,\n queryFn: (queryFunctionContext) => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n return context.client.query(...getClientArgs(queryKey, actualOpts));\n },\n },\n context.queryClient,\n ) as UseTRPCQueryResult<unknown, TError>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return [hook.data, hook as any];\n }\n\n function useMutation(\n path: readonly string[],\n opts?: UseTRPCMutationOptions<unknown, TError, unknown, unknown>,\n ): UseTRPCMutationResult<unknown, TError, unknown, unknown> {\n const { client, queryClient } = useContext();\n\n const mutationKey = getMutationKeyInternal(path);\n\n const defaultOpts = queryClient.defaultMutationOptions(\n queryClient.getMutationDefaults(mutationKey),\n );\n\n const hook = __useMutation(\n {\n ...opts,\n mutationKey: mutationKey,\n mutationFn: (input) => {\n return client.mutation(...getClientArgs([path, { input }], opts));\n },\n onSuccess(...args) {\n const originalFn = () =>\n opts?.onSuccess?.(...args) ?? defaultOpts?.onSuccess?.(...args);\n\n return mutationSuccessOverride({\n originalFn,\n queryClient,\n meta: opts?.meta ?? defaultOpts?.meta ?? {},\n });\n },\n },\n queryClient,\n ) as UseTRPCMutationResult<unknown, TError, unknown, unknown>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return hook;\n }\n const initialStateIdle: Omit<TRPCSubscriptionIdleResult<unknown>, 'reset'> = {\n data: undefined,\n error: null,\n status: 'idle',\n };\n\n const initialStateConnecting: Omit<\n TRPCSubscriptionConnectingResult<unknown, TError>,\n 'reset'\n > = {\n data: undefined,\n error: null,\n status: 'connecting',\n };\n\n /* istanbul ignore next -- @preserve */\n function useSubscription(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCSubscriptionOptions<unknown, TError>,\n ) {\n const enabled = opts?.enabled ?? input !== skipToken;\n const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));\n const { client } = useContext();\n\n const optsRef = React.useRef<typeof opts>(opts);\n React.useEffect(() => {\n optsRef.current = opts;\n });\n\n type $Result = TRPCSubscriptionResult<unknown, TError>;\n\n const [trackedProps] = React.useState(new Set<keyof $Result>([]));\n\n const addTrackedProp = React.useCallback(\n (key: keyof $Result) => {\n trackedProps.add(key);\n },\n [trackedProps],\n );\n\n const currentSubscriptionRef = React.useRef<Unsubscribable>(null);\n\n const updateState = React.useCallback(\n (callback: (prevState: $Result) => $Result) => {\n const prev = resultRef.current;\n const next = (resultRef.current = callback(prev));\n\n let shouldUpdate = false;\n for (const key of trackedProps) {\n if (prev[key] !== next[key]) {\n shouldUpdate = true;\n break;\n }\n }\n if (shouldUpdate) {\n setState(trackResult(next, addTrackedProp));\n }\n },\n [addTrackedProp, trackedProps],\n );\n\n const reset = React.useCallback((): void => {\n // unsubscribe from the previous subscription\n currentSubscriptionRef.current?.unsubscribe();\n\n if (!enabled) {\n updateState(() => ({ ...initialStateIdle, reset }));\n return;\n }\n updateState(() => ({ ...initialStateConnecting, reset }));\n const subscription = client.subscription(\n path.join('.'),\n input ?? undefined,\n {\n context: optsRef.current?.trpc?.context,\n onStarted: () => {\n optsRef.current.onStarted?.();\n updateState((prev) => ({\n ...prev,\n status: 'pending',\n error: null,\n }));\n },\n onData: (data) => {\n optsRef.current.onData?.(data);\n updateState((prev) => ({\n ...prev,\n status: 'pending',\n data,\n error: null,\n }));\n },\n onError: (error) => {\n optsRef.current.onError?.(error);\n updateState((prev) => ({\n ...prev,\n status: 'error',\n error,\n }));\n },\n onConnectionStateChange: (result) => {\n updateState((prev) => {\n switch (result.state) {\n case 'idle':\n return {\n ...prev,\n status: result.state,\n error: null,\n data: undefined,\n };\n case 'connecting':\n return {\n ...prev,\n error: result.error,\n status: result.state,\n };\n\n case 'pending':\n // handled when data is / onStarted\n return prev;\n }\n });\n },\n onComplete: () => {\n optsRef.current.onComplete?.();\n\n // In the case of WebSockets, the connection might not be idle so `onConnectionStateChange` will not be called until the connection is closed.\n // In this case, we need to set the state to idle manually.\n updateState((prev) => ({\n ...prev,\n status: 'idle',\n error: null,\n data: undefined,\n }));\n\n // (We might want to add a `connectionState` to the state to track the connection state separately)\n },\n },\n );\n\n currentSubscriptionRef.current = subscription;\n\n // oxlint-disable-next-line react/exhaustive-deps\n }, [client, queryKey, enabled, updateState]);\n React.useEffect(() => {\n reset();\n\n return () => {\n currentSubscriptionRef.current?.unsubscribe();\n };\n }, [reset]);\n\n const resultRef = React.useRef<$Result>(\n enabled\n ? { ...initialStateConnecting, reset }\n : { ...initialStateIdle, reset },\n );\n\n const [state, setState] = React.useState<$Result>(\n trackResult(resultRef.current, addTrackedProp),\n );\n\n return state;\n }\n\n function useInfiniteQuery(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCInfiniteQueryOptions<unknown, unknown, TError>,\n ): UseTRPCInfiniteQueryResult<unknown, TError, unknown> {\n const {\n client,\n ssrState,\n prefetchInfiniteQuery,\n queryClient,\n abortOnUnmount,\n } = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n if (\n typeof window === 'undefined' &&\n ssrState === 'prepass' &&\n opts?.trpc?.ssr !== false &&\n (opts?.enabled ?? defaultOpts?.enabled) !== false &&\n !isInputSkipToken &&\n !queryClient.getQueryCache().find({ queryKey })\n ) {\n void prefetchInfiniteQuery(queryKey, { ...defaultOpts, ...opts } as any);\n }\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount = opts?.trpc?.abortOnUnmount ?? abortOnUnmount;\n\n const hook = __useInfiniteQuery(\n {\n ...ssrOpts,\n initialPageParam: opts.initialCursor ?? null,\n persister: opts.persister,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n return client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam:\n queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n },\n queryClient,\n ) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;\n\n hook.trpc = useHookResult({\n path,\n });\n return hook;\n }\n\n function usePrefetchInfiniteQuery(\n path: string[],\n input: unknown,\n opts: UseTRPCPrefetchInfiniteQueryOptions<unknown, unknown, TError>,\n ): void {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = context.queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? context.abortOnUnmount;\n\n __usePrefetchInfiniteQuery({\n ...opts,\n initialPageParam: opts.initialCursor ?? null,\n queryKey,\n queryFn: isInputSkipToken\n ? (input as never)\n : (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n });\n }\n\n function useSuspenseInfiniteQuery(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCSuspenseInfiniteQueryOptions<unknown, unknown, TError>,\n ): UseTRPCSuspenseInfiniteQueryResult<unknown, TError, unknown> {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = context.queryClient.getQueryDefaults(queryKey);\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? context.abortOnUnmount;\n\n const hook = __useSuspenseInfiniteQuery(\n {\n ...opts,\n initialPageParam: opts.initialCursor ?? null,\n queryKey,\n queryFn: (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n },\n context.queryClient,\n ) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n // oxlint-disable-next-line typescript/no-non-null-assertion\n return [hook.data!, hook as any];\n }\n\n const useQueries: TRPCUseQueries<TRouter> = (\n queriesCallback: (\n t: UseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >,\n ) => readonly UseQueryOptionsForUseQueries<any, any, any, any>[],\n options?: {\n combine?: (\n results: QueriesResults<\n UseQueryOptionsForUseQueries<any, any, any, any>[]\n >,\n ) => unknown;\n },\n ) => {\n const { ssrState, queryClient, prefetchQuery, client } = useContext();\n\n const proxy = createUseQueries(client);\n\n const queries = queriesCallback(proxy);\n\n if (typeof window === 'undefined' && ssrState === 'prepass') {\n for (const query of queries) {\n const queryOption = query as TRPCQueryOptions<any, any>;\n if (\n queryOption.trpc?.ssr !== false &&\n !queryClient.getQueryCache().find({ queryKey: queryOption.queryKey })\n ) {\n void prefetchQuery(queryOption.queryKey, queryOption as any);\n }\n }\n }\n\n return __useQueries(\n {\n queries: queries.map((query) => ({\n ...query,\n queryKey: (query as TRPCQueryOptions<any, any>).queryKey,\n })),\n combine: options?.combine as any,\n },\n queryClient,\n );\n };\n\n const useSuspenseQueries: TRPCUseSuspenseQueries<TRouter> = (\n queriesCallback: (\n t: UseSuspenseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >,\n ) => readonly UseQueryOptionsForUseSuspenseQueries<any, any, any, any>[],\n ) => {\n const { queryClient, client } = useContext();\n\n const proxy = createUseQueries(client);\n\n const queries = queriesCallback(proxy);\n\n const hook = __useSuspenseQueries(\n {\n queries: queries.map((query) => ({\n ...query,\n queryFn: query.queryFn,\n queryKey: (query as TRPCQueryOptions<any, any>).queryKey,\n })),\n },\n queryClient,\n );\n\n return [hook.map((h) => h.data), hook] as any;\n };\n\n return {\n Provider: TRPCProvider,\n createClient,\n useContext,\n useUtils: useContext,\n useQuery,\n usePrefetchQuery,\n useSuspenseQuery,\n useQueries,\n useSuspenseQueries,\n useMutation,\n useSubscription,\n useInfiniteQuery,\n usePrefetchInfiniteQuery,\n useSuspenseInfiniteQuery,\n };\n}\n\n/**\n * Infer the type of a `createReactQueryHooks` function\n * @internal\n */\nexport type CreateReactQueryHooks<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n> = ReturnType<typeof createRootHooks<TRouter, TSSRContext>>;\n","import type { QueryClientConfig } from '@tanstack/react-query';\nimport { QueryClient } from '@tanstack/react-query';\n\n/**\n * @internal\n */\nexport type CreateTRPCReactQueryClientConfig =\n | {\n queryClient?: QueryClient;\n queryClientConfig?: never;\n }\n | {\n queryClientConfig?: QueryClientConfig;\n queryClient?: never;\n };\n\n/**\n * @internal\n */\nexport const getQueryClient = (config: CreateTRPCReactQueryClientConfig) =>\n config.queryClient ?? new QueryClient(config.queryClientConfig);\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,sBAGd,OAAoD;CACpD,OAAO,sBAAsB,EAAE,MAAM,WAAW;;EAC9C,MAAM,WAAW,CAAC,GAAG,IAAI;EAIzB,MAAM,UAAU,SAAS,IAAI;EAE7B,IAAI,YAAY,eACd,OAAQ,MAAc,QAAQ,CAAC,UAAU,GAAG,IAAI;EAGlD,IAAI,YAAY,QACd,OAAO,EACL,MAAM,SACR;EAGF,MAAM,CAAC,OAAO,GAAG,QAAQ;EACzB,MAAM,QAAA,SAAO,KAAK,QAAA,QAAA,WAAA,KAAA,IAAA,SAAM,CAAC;EAEzB,OAAQ,MAAc,QAAQ,CAAC,UAAU,OAAO,IAAI;CACtD,CAAC;AACH;;;;;;;ACwGA,MAAa,eAAyD;CACpE;CACA;CACA;CACA;AACF;;;;AAyOA,MAAa,eAAA,uBAAc,MAAM,mBAAA,QAAA,yBAAA,KAAA,IAAA,KAAA,IAAA,qBAAA,KAAA,OAAgB,IAAW;;;;;;ACsE5D,MAAa,gBACX,aACc;CACd,QAAQ,UAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,kBACH,OAAO;EAET,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,mBACH,OAAO;EAET,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO;CACX;AACF;;;;AAKA,SAAS,0BACP,SACA;CACA,OAAO,sBAAiD,SAAS;EAC/D,MAAM,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useQuery","usePrefetchQuery","useSuspenseQuery","__useSuspenseQuery","useMutation","__useMutation","useInfiniteQuery","__useInfiniteQuery","usePrefetchInfiniteQuery","useSuspenseInfiniteQuery","__useSuspenseInfiniteQuery","useQueries","__useQueries","useSuspenseQueries","__useSuspenseQueries"],"sources":["../src/shared/proxy/decorationProxy.ts","../src/internals/context.tsx","../src/shared/proxy/utilsProxy.ts","../src/shared/proxy/useQueriesProxy.ts","../src/internals/getClientArgs.ts","../src/internals/trpcResult.ts","../src/utils/createUtilityFunctions.ts","../src/shared/hooks/createHooksInternal.tsx","../src/shared/queryClient.ts"],"sourcesContent":["import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\nimport type { CreateReactQueryHooks } from '../hooks/createHooksInternal';\n\n/**\n * Create proxy for decorating procedures\n * @internal\n */\nexport function createReactDecoration<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n>(hooks: CreateReactQueryHooks<TRouter, TSSRContext>) {\n return createRecursiveProxy(({ path, args }) => {\n const pathCopy = [...path];\n\n // The last arg is for instance `.useMutation` or `.useQuery()`\n // oxlint-disable-next-line typescript/no-non-null-assertion\n const lastArg = pathCopy.pop()!;\n\n if (lastArg === 'useMutation') {\n return (hooks as any)[lastArg](pathCopy, ...args);\n }\n\n if (lastArg === '_def') {\n return {\n path: pathCopy,\n };\n }\n\n const [input, ...rest] = args;\n const opts = rest[0] ?? {};\n\n return (hooks as any)[lastArg](pathCopy, input, opts);\n });\n}\n","import type {\n CancelOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InfiniteData,\n InvalidateOptions,\n InvalidateQueryFilters,\n MutationOptions,\n QueryClient,\n QueryFilters,\n QueryKey,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n Updater,\n} from '@tanstack/react-query';\nimport type {\n TRPCClient,\n TRPCClientError,\n TRPCRequestOptions,\n TRPCUntypedClient,\n} from '@trpc/client';\nimport type {\n AnyClientTypes,\n AnyRouter,\n DistributiveOmit,\n} from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport type {\n DefinedTRPCInfiniteQueryOptionsIn,\n DefinedTRPCInfiniteQueryOptionsOut,\n DefinedTRPCQueryOptionsIn,\n DefinedTRPCQueryOptionsOut,\n ExtractCursorType,\n UndefinedTRPCInfiniteQueryOptionsIn,\n UndefinedTRPCInfiniteQueryOptionsOut,\n UndefinedTRPCQueryOptionsIn,\n UndefinedTRPCQueryOptionsOut,\n} from '../shared';\nimport type { TRPCMutationKey, TRPCQueryKey } from './getQueryKey';\n\ninterface TRPCUseUtilsOptions {\n /**\n * tRPC-related options\n */\n trpc?: TRPCRequestOptions;\n}\n/**\n * Options for the `fetch` and `prefetch` helpers.\n */\nexport interface TRPCFetchQueryOptions<TOutput, TError>\n extends\n DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'>,\n TRPCUseUtilsOptions {\n //\n}\n\n/**\n * Options for the `fetchInfinite` and `prefetchInfinite` helpers.\n */\nexport type TRPCFetchInfiniteQueryOptions<TInput, TOutput, TError> =\n DistributiveOmit<\n FetchInfiniteQueryOptions<\n TOutput,\n TError,\n TOutput,\n TRPCQueryKey,\n ExtractCursorType<TInput>\n >,\n 'queryKey' | 'initialPageParam'\n > &\n TRPCUseUtilsOptions & {\n /**\n * The cursor for the first page.\n */\n initialCursor?: ExtractCursorType<TInput>;\n };\n\n/** @internal */\nexport type SSRState = 'mounted' | 'mounting' | 'prepass' | false;\n\n/**\n * Props shared by the tRPC React context and its `Provider`.\n */\nexport interface TRPCContextPropsBase<TRouter extends AnyRouter, TSSRContext> {\n /**\n * The `TRPCClient`\n */\n client: TRPCUntypedClient<TRouter>;\n /**\n * The SSR context when server-side rendering\n * @default null\n */\n ssrContext?: TSSRContext | null;\n /**\n * State of SSR hydration.\n * - `false` if not using SSR.\n * - `prepass` when doing a prepass to fetch queries' data\n * - `mounting` before TRPCProvider has been rendered on the client\n * - `mounted` when the TRPCProvider has been rendered on the client\n * @default false\n */\n ssrState?: SSRState;\n /**\n * @deprecated pass abortOnUnmount to `createTRPCReact` instead\n * Abort loading query calls when unmounting a component - usually when navigating to a new page\n * @default false\n */\n abortOnUnmount?: boolean;\n}\n\n/**\n * @internal\n */\nexport type DecoratedTRPCContextProps<\n TRouter extends AnyRouter,\n TSSRContext,\n> = TRPCContextPropsBase<TRouter, TSSRContext> & {\n client: TRPCClient<TRouter>;\n};\n\n/**\n * Props for the tRPC React context: the base props plus a `QueryClient`.\n */\nexport interface TRPCContextProps<\n TRouter extends AnyRouter,\n TSSRContext,\n> extends TRPCContextPropsBase<TRouter, TSSRContext> {\n /**\n * The react-query `QueryClient`\n */\n queryClient: QueryClient;\n}\n\n/**\n * The keys of {@link TRPCContextPropsBase}.\n */\nexport const contextProps: (keyof TRPCContextPropsBase<any, any>)[] = [\n 'client',\n 'ssrContext',\n 'ssrState',\n 'abortOnUnmount',\n];\n\n/**\n * @internal\n */\nexport interface TRPCContextState<\n TRouter extends AnyRouter,\n TSSRContext = undefined,\n>\n extends\n Required<TRPCContextProps<TRouter, TSSRContext>>,\n TRPCQueryUtils<TRouter> {}\n\n/**\n * @internal\n */\nexport interface TRPCQueryUtils<TRouter extends AnyRouter> {\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts?: UndefinedTRPCQueryOptionsIn<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): UndefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n queryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: DefinedTRPCQueryOptionsIn<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): DefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: UndefinedTRPCInfiniteQueryOptionsIn<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): UndefinedTRPCInfiniteQueryOptionsOut<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n infiniteQueryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: DefinedTRPCInfiniteQueryOptionsIn<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >,\n ): DefinedTRPCInfiniteQueryOptionsOut<\n unknown,\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery\n */\n fetchQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,\n ) => Promise<unknown>;\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery\n */\n fetchInfiniteQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchInfiniteQueryOptions<\n unknown,\n unknown,\n TRPCClientError<TRouter>\n >,\n ) => Promise<InfiniteData<unknown, unknown>>;\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching\n */\n prefetchQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery\n */\n prefetchInfiniteQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchInfiniteQueryOptions<\n unknown,\n unknown,\n TRPCClientError<TRouter>\n >,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata\n */\n ensureQueryData: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,\n ) => Promise<unknown>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation\n */\n invalidateQueries: (\n queryKey: TRPCQueryKey,\n filters?: InvalidateQueryFilters<TRPCQueryKey>,\n options?: InvalidateOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries\n */\n resetQueries: (\n queryKey: TRPCQueryKey,\n filters?: QueryFilters<TRPCQueryKey>,\n options?: ResetOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries\n */\n refetchQueries: (\n queryKey: TRPCQueryKey,\n filters?: RefetchQueryFilters<TRPCQueryKey>,\n options?: RefetchOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-cancellation\n */\n cancelQuery: (\n queryKey: TRPCQueryKey,\n options?: CancelOptions,\n ) => Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setQueryData: (\n queryKey: TRPCQueryKey,\n updater: Updater<unknown, unknown>,\n options?: SetDataOptions,\n ) => void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata\n */\n // oxlint-disable-next-line max-params -- mirrors TanStack Query's own signature\n setQueriesData: (\n queryKey: TRPCQueryKey,\n filters: QueryFilters,\n updater: Updater<unknown, unknown>,\n options?: SetDataOptions,\n ) => [QueryKey, unknown][];\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getQueryData: (queryKey: TRPCQueryKey) => unknown;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setInfiniteQueryData: (\n queryKey: TRPCQueryKey,\n updater: Updater<\n InfiniteData<unknown> | undefined,\n InfiniteData<unknown> | undefined\n >,\n options?: SetDataOptions,\n ) => void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getInfiniteQueryData: (\n queryKey: TRPCQueryKey,\n ) => InfiniteData<unknown> | undefined;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient/#queryclientsetmutationdefaults\n */\n setMutationDefaults: (\n mutationKey: TRPCMutationKey,\n options:\n | MutationOptions\n | ((args: {\n canonicalMutationFn: (input: unknown) => Promise<unknown>;\n }) => MutationOptions),\n ) => void;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientgetmutationdefaults\n */\n getMutationDefaults: (\n mutationKey: TRPCMutationKey,\n ) => MutationOptions | undefined;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientismutating\n */\n isMutating: (filters: { mutationKey: TRPCMutationKey }) => number;\n}\n/**\n * The React context that holds the tRPC client and `QueryClient`.\n */\nexport const TRPCContext = React.createContext?.(null as any);\n","import type {\n CancelOptions,\n InfiniteData,\n InvalidateOptions,\n InvalidateQueryFilters,\n Query,\n QueryFilters,\n QueryKey,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n SkipToken,\n Updater,\n} from '@tanstack/react-query';\nimport { skipToken } from '@tanstack/react-query';\nimport type { TRPCClientError } from '@trpc/client';\nimport { createTRPCClientProxy } from '@trpc/client';\nimport type {\n AnyMutationProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n DeepPartial,\n inferProcedureInput,\n inferProcedureOutput,\n inferTransformedProcedureOutput,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n createFlatProxy,\n createRecursiveProxy,\n} from '@trpc/server/unstable-core-do-not-import';\nimport type {\n DecoratedTRPCContextProps,\n TRPCContextState,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n TRPCQueryUtils,\n} from '../../internals/context';\nimport { contextProps } from '../../internals/context';\nimport type { QueryKeyKnown, QueryType } from '../../internals/getQueryKey';\nimport {\n getMutationKeyInternal,\n getQueryKeyInternal,\n} from '../../internals/getQueryKey';\nimport type { InferMutationOptions } from '../../utils/inferReactQueryProcedure';\nimport type { ExtractCursorType } from '../hooks/types';\nimport type {\n DefinedTRPCInfiniteQueryOptionsIn,\n DefinedTRPCInfiniteQueryOptionsOut,\n DefinedTRPCQueryOptionsIn,\n DefinedTRPCQueryOptionsOut,\n UndefinedTRPCInfiniteQueryOptionsIn,\n UndefinedTRPCInfiniteQueryOptionsOut,\n UndefinedTRPCQueryOptionsIn,\n UndefinedTRPCQueryOptionsOut,\n UnusedSkipTokenTRPCInfiniteQueryOptionsIn,\n UnusedSkipTokenTRPCInfiniteQueryOptionsOut,\n UnusedSkipTokenTRPCQueryOptionsIn,\n UnusedSkipTokenTRPCQueryOptionsOut,\n} from '../types';\n\n/**\n * The `useUtils` helpers for one query procedure.\n * @see https://trpc.io/docs/client/react/useUtils#helpers\n */\nexport type DecorateQueryProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyQueryProcedure,\n> = {\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts: DefinedTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): DefinedTRPCQueryOptionsOut<TQueryFnData, TData, TRPCClientError<TRoot>>;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts?: UnusedSkipTokenTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UnusedSkipTokenTRPCQueryOptionsOut<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts?: UndefinedTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UndefinedTRPCQueryOptionsOut<TQueryFnData, TData, TRPCClientError<TRoot>>;\n\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts: DefinedTRPCInfiniteQueryOptionsIn<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): DefinedTRPCInfiniteQueryOptionsOut<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure>,\n opts: UnusedSkipTokenTRPCInfiniteQueryOptionsIn<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UnusedSkipTokenTRPCInfiniteQueryOptionsOut<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput<TProcedure> | SkipToken,\n opts?: UndefinedTRPCInfiniteQueryOptionsIn<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >,\n ): UndefinedTRPCInfiniteQueryOptionsOut<\n inferProcedureInput<TProcedure>,\n TQueryFnData,\n TData,\n TRPCClientError<TRoot>\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery\n */\n fetch(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery\n */\n fetchInfinite(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput<TProcedure>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<\n InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchquery\n */\n prefetch(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery\n */\n prefetchInfinite(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput<TProcedure>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata\n */\n ensureData(\n input: inferProcedureInput<TProcedure>,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TRPCClientError<TRoot>\n >,\n ): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientinvalidatequeries\n */\n invalidate(\n input?: DeepPartial<inferProcedureInput<TProcedure>>,\n filters?: Omit<InvalidateQueryFilters, 'predicate'> & {\n predicate?: (\n query: Query<\n inferProcedureOutput<TProcedure>,\n TRPCClientError<TRoot>,\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n QueryKeyKnown<\n inferProcedureInput<TProcedure>,\n inferProcedureInput<TProcedure> extends { cursor?: any } | void\n ? 'infinite'\n : 'query'\n >\n >,\n ) => boolean;\n },\n options?: InvalidateOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries\n */\n refetch(\n input?: inferProcedureInput<TProcedure>,\n filters?: RefetchQueryFilters,\n options?: RefetchOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientcancelqueries\n */\n cancel(\n input?: inferProcedureInput<TProcedure>,\n options?: CancelOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries\n */\n reset(\n input?: inferProcedureInput<TProcedure>,\n options?: ResetOptions,\n ): Promise<void>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setData(\n /**\n * The input of the procedure\n */\n input: inferProcedureInput<TProcedure>,\n updater: Updater<\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined,\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined\n >,\n options?: SetDataOptions,\n ): void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setQueriesData(\n /**\n * The input of the procedure\n */\n input: inferProcedureInput<TProcedure>,\n filters: QueryFilters,\n updater: Updater<\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined,\n inferTransformedProcedureOutput<TRoot, TProcedure> | undefined\n >,\n options?: SetDataOptions,\n ): [QueryKey, inferTransformedProcedureOutput<TRoot, TProcedure>];\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setInfiniteData(\n input: inferProcedureInput<TProcedure>,\n updater: Updater<\n | InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n | undefined,\n | InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n | undefined\n >,\n options?: SetDataOptions,\n ): void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getData(\n input?: inferProcedureInput<TProcedure>,\n ): inferTransformedProcedureOutput<TRoot, TProcedure> | undefined;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getInfiniteData(\n input?: inferProcedureInput<TProcedure>,\n ):\n | InfiniteData<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null\n >\n | undefined;\n};\n\ntype DecorateMutationProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyMutationProcedure,\n> = {\n setMutationDefaults<TMeta = unknown>(\n options:\n | InferMutationOptions<TRoot, TProcedure, TMeta>\n | ((args: {\n canonicalMutationFn: NonNullable<\n InferMutationOptions<TRoot, TProcedure>['mutationFn']\n >;\n }) => InferMutationOptions<TRoot, TProcedure, TMeta>),\n ): void;\n\n getMutationDefaults(): InferMutationOptions<TRoot, TProcedure> | undefined;\n\n isMutating(): number;\n};\n\n/**\n * this is the type that is used to add in procedures that can be used on\n * an entire router\n */\ntype DecorateRouter = {\n /**\n * Invalidate the full router\n * @see https://trpc.io/docs/client/react/useUtils#invalidating-across-whole-routers\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation\n */\n invalidate(\n input?: undefined,\n filters?: InvalidateQueryFilters,\n options?: InvalidateOptions,\n ): Promise<void>;\n};\n\n/**\n * @internal\n */\nexport type DecoratedProcedureUtilsRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = DecorateRouter & {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? DecorateQueryProcedure<TRoot, $Value>\n : $Value extends AnyMutationProcedure\n ? DecorateMutationProcedure<TRoot, $Value>\n : $Value extends RouterRecord\n ? DecoratedProcedureUtilsRecord<TRoot, $Value> & DecorateRouter\n : never\n : never;\n}; // Add functions that should be available at utils root\n\ntype AnyDecoratedProcedure = DecorateQueryProcedure<any, any> &\n DecorateMutationProcedure<any, any>;\n\n/**\n * What `useUtils()` returns: the context props plus helpers for every procedure.\n * @see https://trpc.io/docs/client/react/useUtils\n */\nexport type CreateReactUtils<\n TRouter extends AnyRouter,\n TSSRContext,\n> = ProtectedIntersection<\n DecoratedTRPCContextProps<TRouter, TSSRContext>,\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n>;\n\n/**\n * What `createTRPCQueryUtils` returns.\n * @see https://trpc.io/docs/client/react/createTRPCQueryUtils\n */\nexport type CreateQueryUtils<TRouter extends AnyRouter> =\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >;\n\n/**\n * Maps a `useUtils` helper name to the kind of query it works on.\n */\nexport const getQueryType = (\n utilName: keyof AnyDecoratedProcedure,\n): QueryType => {\n switch (utilName) {\n case 'queryOptions':\n case 'fetch':\n case 'ensureData':\n case 'prefetch':\n case 'getData':\n case 'setData':\n case 'setQueriesData':\n return 'query';\n\n case 'infiniteQueryOptions':\n case 'fetchInfinite':\n case 'prefetchInfinite':\n case 'getInfiniteData':\n case 'setInfiniteData':\n return 'infinite';\n\n case 'setMutationDefaults':\n case 'getMutationDefaults':\n case 'isMutating':\n case 'cancel':\n case 'invalidate':\n case 'refetch':\n case 'reset':\n return 'any';\n }\n};\n\n/**\n * @internal\n */\nfunction createRecursiveUtilsProxy<TRouter extends AnyRouter>(\n context: TRPCQueryUtils<TRouter>,\n) {\n return createRecursiveProxy<CreateQueryUtils<TRouter>>((opts) => {\n const path = [...opts.path];\n const utilName = path.pop() as keyof AnyDecoratedProcedure;\n const args = [...opts.args] as Parameters<\n AnyDecoratedProcedure[typeof utilName]\n >;\n const input = args.shift(); // args can now be spread when input removed\n const queryType = getQueryType(utilName);\n const queryKey = getQueryKeyInternal(path, input, queryType);\n\n // `getQueryKeyInternal` strips `skipToken` from the query key, so the\n // options helpers can't detect it and would return a real `queryFn`\n const withSkipToken = <TOptions extends object>(options: TOptions) =>\n input === skipToken ? { ...options, queryFn: skipToken } : options;\n\n const contextMap: Record<keyof AnyDecoratedProcedure, () => unknown> = {\n infiniteQueryOptions: () =>\n withSkipToken(context.infiniteQueryOptions(path, queryKey, args[0])),\n queryOptions: () =>\n withSkipToken(context.queryOptions(path, queryKey, ...args)),\n /**\n * DecorateQueryProcedure\n */\n fetch: () => context.fetchQuery(queryKey, ...args),\n fetchInfinite: () => context.fetchInfiniteQuery(queryKey, args[0]),\n prefetch: () => context.prefetchQuery(queryKey, ...args),\n prefetchInfinite: () => context.prefetchInfiniteQuery(queryKey, args[0]),\n ensureData: () => context.ensureQueryData(queryKey, ...args),\n invalidate: () => context.invalidateQueries(queryKey, ...args),\n reset: () => context.resetQueries(queryKey, ...args),\n refetch: () => context.refetchQueries(queryKey, ...args),\n cancel: () => context.cancelQuery(queryKey, ...args),\n setData: () => {\n context.setQueryData(queryKey, args[0], args[1]);\n },\n setQueriesData: () =>\n context.setQueriesData(queryKey, args[0], args[1], args[2]),\n setInfiniteData: () => {\n context.setInfiniteQueryData(queryKey, args[0], args[1]);\n },\n getData: () => context.getQueryData(queryKey),\n getInfiniteData: () => context.getInfiniteQueryData(queryKey),\n /**\n * DecorateMutationProcedure\n */\n setMutationDefaults: () =>\n context.setMutationDefaults(getMutationKeyInternal(path), input),\n getMutationDefaults: () =>\n context.getMutationDefaults(getMutationKeyInternal(path)),\n isMutating: () =>\n context.isMutating({ mutationKey: getMutationKeyInternal(path) }),\n };\n\n return contextMap[utilName]();\n });\n}\n\n/**\n * @internal\n */\nexport function createReactQueryUtils<TRouter extends AnyRouter, TSSRContext>(\n context: TRPCContextState<AnyRouter, TSSRContext>,\n) {\n type CreateReactUtilsReturnType = CreateReactUtils<TRouter, TSSRContext>;\n\n const clientProxy = createTRPCClientProxy(context.client);\n\n const proxy = createRecursiveUtilsProxy(\n context,\n ) as CreateReactUtilsReturnType;\n\n return createFlatProxy<CreateReactUtilsReturnType>((key) => {\n const contextName = key as (typeof contextProps)[number];\n if (contextName === 'client') {\n return clientProxy;\n }\n if (contextProps.includes(contextName)) {\n return context[contextName];\n }\n\n return proxy[key];\n });\n}\n\n/**\n * @internal\n */\nexport function createQueryUtilsProxy<TRouter extends AnyRouter>(\n context: TRPCQueryUtils<TRouter>,\n): CreateQueryUtils<TRouter> {\n return createRecursiveUtilsProxy(context);\n}\n","import type { QueryOptions } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport {\n getUntypedClient,\n TRPCUntypedClient,\n type TRPCClientError,\n} from '@trpc/client';\nimport type {\n AnyProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferProcedureInput,\n inferTransformedProcedureOutput,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\nimport { getQueryKeyInternal } from '../../internals/getQueryKey';\nimport type {\n TrpcQueryOptionsForUseQueries,\n TrpcQueryOptionsForUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport type { TRPCUseQueryBaseOptions } from '../hooks/types';\n\ntype GetQueryOptions<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyProcedure,\n> = <TData = inferTransformedProcedureOutput<TRoot, TProcedure>>(\n input: inferProcedureInput<TProcedure>,\n opts?: TrpcQueryOptionsForUseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n >,\n) => TrpcQueryOptionsForUseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n>;\n\n/**\n * @internal\n */\nexport type UseQueriesProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? GetQueryOptions<TRoot, $Value>\n : $Value extends RouterRecord\n ? UseQueriesProcedureRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype GetSuspenseQueryOptions<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyQueryProcedure,\n> = <TData = inferTransformedProcedureOutput<TRoot, TProcedure>>(\n input: inferProcedureInput<TProcedure>,\n opts?: TrpcQueryOptionsForUseSuspenseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n >,\n) => TrpcQueryOptionsForUseSuspenseQueries<\n inferTransformedProcedureOutput<TRoot, TProcedure>,\n TData,\n TRPCClientError<TRoot>\n>;\n\n/**\n * @internal\n */\nexport type UseSuspenseQueriesProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? GetSuspenseQueryOptions<TRoot, $Value>\n : $Value extends RouterRecord\n ? UseSuspenseQueriesProcedureRecord<TRoot, $Value>\n : never\n : never;\n};\n\n/**\n * Create proxy for `useQueries` options\n * @internal\n */\nexport function createUseQueries<TRouter extends AnyRouter>(\n client: TRPCUntypedClient<TRouter> | TRPCClient<TRouter>,\n) {\n const untypedClient: TRPCUntypedClient<TRouter> =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return createRecursiveProxy<\n UseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >((opts) => {\n const arrayPath = opts.path;\n const dotPath = arrayPath.join('.');\n const [input, _opts] = opts.args as [\n unknown,\n Partial<QueryOptions> & TRPCUseQueryBaseOptions,\n ];\n\n const options: QueryOptions = {\n queryKey: getQueryKeyInternal(arrayPath, input, 'query'),\n queryFn: () => {\n return untypedClient.query(dotPath, input, _opts?.trpc);\n },\n ..._opts,\n };\n\n return options;\n });\n}\n","import type { TRPCQueryKey } from './getQueryKey';\n\n/**\n * @internal\n */\nexport function getClientArgs<TOptions>(\n queryKey: TRPCQueryKey,\n opts: TOptions,\n infiniteParams?: {\n pageParam: any;\n direction: 'forward' | 'backward';\n },\n) {\n const path = queryKey[0];\n let input = queryKey[1]?.input;\n if (infiniteParams) {\n input = {\n ...(input ?? {}),\n ...(infiniteParams.pageParam !== undefined\n ? { cursor: infiniteParams.pageParam }\n : {}),\n direction: infiniteParams.direction,\n };\n }\n return [path.join('.'), input, (opts as any)?.trpc] as const;\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport * as React from 'react';\nimport type { TRPCQueryOptionsResult } from '../shared';\nimport type { TRPCHookResult } from '../shared/hooks/types';\nimport type { TRPCQueryKey } from './getQueryKey';\n\nexport function createTRPCOptionsResult(value: {\n path: readonly string[];\n}): TRPCQueryOptionsResult['trpc'] {\n const path = value.path.join('.');\n\n return {\n path,\n };\n}\n\n/**\n * Makes a stable reference of the `trpc` prop\n */\nexport function useHookResult(value: {\n path: readonly string[];\n}): TRPCHookResult['trpc'] {\n const result = createTRPCOptionsResult(value);\n return React.useMemo(() => result, [result]);\n}\n\n/**\n * @internal\n */\nexport async function buildQueryFromAsyncIterable(\n asyncIterable: AsyncIterable<unknown>,\n queryClient: QueryClient,\n queryKey: TRPCQueryKey,\n) {\n const queryCache = queryClient.getQueryCache();\n\n const query = queryCache.build(queryClient, {\n queryKey,\n });\n\n query.setState({\n data: [],\n status: 'success',\n });\n\n const aggregate: unknown[] = [];\n for await (const value of asyncIterable) {\n aggregate.push(value);\n\n query.setState({\n data: [...aggregate],\n });\n }\n return aggregate;\n}\n","import type { QueryFunctionContext } from '@tanstack/react-query';\nimport {\n infiniteQueryOptions,\n queryOptions,\n skipToken,\n type QueryClient,\n} from '@tanstack/react-query';\nimport type { TRPCClient, TRPCClientError } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';\nimport type { AnyClientTypes } from '@trpc/server/unstable-core-do-not-import/clientish/inferrable';\nimport { getClientArgs } from '../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../internals/getQueryKey';\nimport {\n buildQueryFromAsyncIterable,\n createTRPCOptionsResult,\n} from '../internals/trpcResult';\nimport type { DefinedTRPCQueryOptionsOut } from '../shared';\nimport { type TRPCQueryUtils } from '../shared';\n\nexport interface CreateQueryUtilsOptions<TRouter extends AnyRouter> {\n /**\n * The `TRPCClient`\n */\n client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;\n /**\n * The `QueryClient` from `react-query`\n */\n queryClient: QueryClient;\n}\n\n/**\n * Creates a set of utility functions that can be used to interact with `react-query`\n * @param opts the `TRPCClient` and `QueryClient` to use\n * @returns a set of utility functions that can be used to interact with `react-query`\n * @internal\n */\nexport function createUtilityFunctions<TRouter extends AnyRouter>(\n opts: CreateQueryUtilsOptions<TRouter>,\n): TRPCQueryUtils<TRouter> {\n const { client, queryClient } = opts;\n const untypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return {\n infiniteQueryOptions: (path, queryKey, opts) => {\n const inputIsSkipToken = queryKey[1]?.input === skipToken;\n\n const queryFn = async (\n queryFnContext: QueryFunctionContext<TRPCQueryKey, unknown>,\n ): Promise<unknown> => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(opts?.trpc?.abortOnUnmount\n ? { signal: queryFnContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await untypedClient.query(\n ...getClientArgs(queryKey, actualOpts, {\n direction: queryFnContext.direction,\n pageParam: queryFnContext.pageParam ?? opts?.initialCursor,\n }),\n );\n\n return result;\n };\n\n return Object.assign(\n infiniteQueryOptions({\n ...opts,\n initialData: opts?.initialData as any,\n queryKey,\n queryFn: inputIsSkipToken ? skipToken : queryFn,\n initialPageParam: (opts?.initialCursor as any) ?? null,\n }),\n { trpc: createTRPCOptionsResult({ path }) },\n );\n },\n\n queryOptions: (path, queryKey, opts) => {\n const inputIsSkipToken = queryKey[1]?.input === skipToken;\n\n const queryFn = async (\n queryFnContext: QueryFunctionContext<TRPCQueryKey>,\n ): Promise<unknown> => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(opts?.trpc?.abortOnUnmount\n ? { signal: queryFnContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await untypedClient.query(\n ...getClientArgs(queryKey, actualOpts),\n );\n\n if (isAsyncIterable(result)) {\n return buildQueryFromAsyncIterable(result, queryClient, queryKey);\n }\n\n return result;\n };\n\n return Object.assign(\n queryOptions({\n ...opts,\n initialData: opts?.initialData,\n queryKey,\n queryFn: inputIsSkipToken ? skipToken : queryFn,\n }),\n { trpc: createTRPCOptionsResult({ path }) },\n ) as DefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError<AnyClientTypes>\n >;\n },\n\n fetchQuery: (queryKey, opts) => {\n return queryClient.fetchQuery({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n fetchInfiniteQuery: (queryKey, opts) => {\n return queryClient.fetchInfiniteQuery({\n ...opts,\n queryKey,\n queryFn: ({ pageParam, direction }) => {\n return untypedClient.query(\n ...getClientArgs(queryKey, opts, {\n pageParam: pageParam ?? opts?.initialCursor,\n direction,\n }),\n );\n },\n initialPageParam: opts?.initialCursor ?? null,\n });\n },\n\n prefetchQuery: (queryKey, opts) => {\n return queryClient.prefetchQuery({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n prefetchInfiniteQuery: (queryKey, opts) => {\n return queryClient.prefetchInfiniteQuery({\n ...opts,\n queryKey,\n queryFn: ({ pageParam, direction }) => {\n return untypedClient.query(\n ...getClientArgs(queryKey, opts, {\n pageParam: pageParam ?? opts?.initialCursor,\n direction,\n }),\n );\n },\n initialPageParam: opts?.initialCursor ?? null,\n });\n },\n\n ensureQueryData: (queryKey, opts) => {\n return queryClient.ensureQueryData({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n invalidateQueries: (queryKey, filters, options) => {\n return queryClient.invalidateQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n resetQueries: (queryKey, filters, options) => {\n return queryClient.resetQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n\n refetchQueries: (queryKey, filters, options) => {\n return queryClient.refetchQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n\n cancelQuery: (queryKey, options) => {\n return queryClient.cancelQueries(\n {\n queryKey,\n },\n options,\n );\n },\n\n setQueryData: (queryKey, updater, options) => {\n return queryClient.setQueryData(queryKey, updater, options);\n },\n\n // oxlint-disable-next-line max-params\n setQueriesData: (queryKey, filters, updater, options) => {\n return queryClient.setQueriesData(\n {\n ...filters,\n queryKey,\n },\n updater,\n options,\n );\n },\n\n getQueryData: (queryKey) => {\n return queryClient.getQueryData(queryKey);\n },\n\n setInfiniteQueryData: (queryKey, updater, options) => {\n return queryClient.setQueryData(queryKey, updater, options);\n },\n\n getInfiniteQueryData: (queryKey) => {\n return queryClient.getQueryData(queryKey);\n },\n\n setMutationDefaults: (mutationKey, options) => {\n const path = mutationKey[0];\n const canonicalMutationFn = (input: unknown) => {\n return untypedClient.mutation(\n ...getClientArgs([path, { input }], opts),\n );\n };\n return queryClient.setMutationDefaults(\n mutationKey,\n typeof options === 'function'\n ? options({ canonicalMutationFn })\n : options,\n );\n },\n\n getMutationDefaults: (mutationKey) => {\n return queryClient.getMutationDefaults(mutationKey);\n },\n\n isMutating: (filters) => {\n return queryClient.isMutating({\n ...filters,\n exact: true,\n });\n },\n };\n}\n","// TODO: Look into fixing react-compiler support\nimport {\n useInfiniteQuery as __useInfiniteQuery,\n useMutation as __useMutation,\n usePrefetchInfiniteQuery as __usePrefetchInfiniteQuery,\n useQueries as __useQueries,\n useQuery as __useQuery,\n useSuspenseInfiniteQuery as __useSuspenseInfiniteQuery,\n useSuspenseQueries as __useSuspenseQueries,\n useSuspenseQuery as __useSuspenseQuery,\n usePrefetchQuery as _usePrefetchQuery,\n hashKey,\n skipToken,\n} from '@tanstack/react-query';\nimport type { TRPCClientErrorLike } from '@trpc/client';\nimport {\n createTRPCClient,\n getUntypedClient,\n TRPCUntypedClient,\n} from '@trpc/client';\nimport type { Unsubscribable } from '@trpc/server/observable';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport type { SSRState, TRPCContextState } from '../../internals/context';\nimport { TRPCContext } from '../../internals/context';\nimport { getClientArgs } from '../../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../../internals/getQueryKey';\nimport {\n getMutationKeyInternal,\n getQueryKeyInternal,\n} from '../../internals/getQueryKey';\nimport {\n buildQueryFromAsyncIterable,\n useHookResult,\n} from '../../internals/trpcResult';\nimport type {\n QueriesResults,\n TRPCUseQueries,\n TRPCUseSuspenseQueries,\n UseQueryOptionsForUseQueries,\n UseQueryOptionsForUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport { createUtilityFunctions } from '../../utils/createUtilityFunctions';\nimport type {\n UseQueriesProcedureRecord,\n UseSuspenseQueriesProcedureRecord,\n} from '../proxy/useQueriesProxy';\nimport { createUseQueries } from '../proxy/useQueriesProxy';\nimport type { CreateTRPCReactOptions, UseMutationOverride } from '../types';\nimport type {\n TRPCProvider,\n TRPCQueryOptions,\n TRPCSubscriptionConnectingResult,\n TRPCSubscriptionIdleResult,\n TRPCSubscriptionResult,\n UseTRPCInfiniteQueryOptions,\n UseTRPCInfiniteQueryResult,\n UseTRPCMutationOptions,\n UseTRPCMutationResult,\n UseTRPCPrefetchInfiniteQueryOptions,\n UseTRPCPrefetchQueryOptions,\n UseTRPCQueryOptions,\n UseTRPCQueryResult,\n UseTRPCSubscriptionOptions,\n UseTRPCSuspenseInfiniteQueryOptions,\n UseTRPCSuspenseInfiniteQueryResult,\n UseTRPCSuspenseQueryOptions,\n UseTRPCSuspenseQueryResult,\n} from './types';\n\nconst trackResult = <T extends object>(\n result: T,\n onTrackResult: (key: keyof T) => void,\n): T => {\n const trackedResult = new Proxy(result, {\n get(target, prop) {\n onTrackResult(prop as keyof T);\n return target[prop as keyof T];\n },\n });\n\n return trackedResult;\n};\n\n/**\n * @internal\n */\nexport function createRootHooks<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n>(config?: CreateTRPCReactOptions<TRouter>) {\n const mutationSuccessOverride: UseMutationOverride['onSuccess'] =\n config?.overrides?.useMutation?.onSuccess ??\n ((options) => options.originalFn());\n\n type TError = TRPCClientErrorLike<TRouter>;\n\n type ProviderContext = TRPCContextState<TRouter, TSSRContext>;\n\n const Context = (config?.context ??\n TRPCContext) as React.Context<ProviderContext>;\n\n const createClient = createTRPCClient<TRouter>;\n\n const TRPCProvider: TRPCProvider<TRouter, TSSRContext> = (props) => {\n const { abortOnUnmount = false, queryClient, ssrContext } = props;\n const [ssrState, setSSRState] = React.useState<SSRState>(\n props.ssrState ?? false,\n );\n\n const client: TRPCUntypedClient<TRouter> =\n props.client instanceof TRPCUntypedClient\n ? props.client\n : getUntypedClient(props.client);\n\n const fns = React.useMemo(\n () =>\n createUtilityFunctions({\n client,\n queryClient,\n }),\n [client, queryClient],\n );\n\n const contextValue = React.useMemo<ProviderContext>(\n () => ({\n abortOnUnmount,\n queryClient,\n client,\n ssrContext: ssrContext ?? null,\n ssrState,\n ...fns,\n }),\n [abortOnUnmount, client, fns, queryClient, ssrContext, ssrState],\n );\n\n React.useEffect(() => {\n // Only updating state to `mounted` if we are using SSR.\n // This makes it so we don't have an unnecessary re-render when opting out of SSR.\n setSSRState((state) => (state ? 'mounted' : false));\n }, []);\n return (\n <Context.Provider value={contextValue}>{props.children}</Context.Provider>\n );\n };\n\n function useContext() {\n const context = React.useContext(Context);\n\n if (!context) {\n throw new Error(\n 'Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?',\n );\n }\n return context;\n }\n\n /**\n * Hack to make sure errors return `status`='error` when doing SSR\n * @see https://github.com/trpc/trpc/pull/1645\n */\n function useSSRQueryOptionsIfNeeded<\n TOptions extends { retryOnMount?: unknown } | undefined,\n >(queryKey: TRPCQueryKey, opts: TOptions): TOptions {\n const { queryClient, ssrState } = useContext();\n return ssrState &&\n ssrState !== 'mounted' &&\n queryClient.getQueryCache().find({ queryKey })?.state.status === 'error'\n ? {\n retryOnMount: false,\n ...opts,\n }\n : opts;\n }\n\n function useQuery(\n path: readonly string[],\n input: unknown,\n opts?: UseTRPCQueryOptions<unknown, unknown, TError>,\n ): UseTRPCQueryResult<unknown, TError> {\n const context = useContext();\n const { abortOnUnmount, client, ssrState, queryClient, prefetchQuery } =\n context;\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const defaultOpts = queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n if (\n typeof window === 'undefined' &&\n ssrState === 'prepass' &&\n opts?.trpc?.ssr !== false &&\n (opts?.enabled ?? defaultOpts?.enabled) !== false &&\n !isInputSkipToken &&\n !queryClient.getQueryCache().find({ queryKey })\n ) {\n void prefetchQuery(queryKey, opts as any);\n }\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? config?.abortOnUnmount ?? abortOnUnmount;\n\n const hook = __useQuery(\n {\n ...ssrOpts,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : async (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await client.query(\n ...getClientArgs(queryKey, actualOpts),\n );\n\n if (isAsyncIterable(result)) {\n return buildQueryFromAsyncIterable(\n result,\n queryClient,\n queryKey,\n );\n }\n return result;\n },\n },\n queryClient,\n ) as UseTRPCQueryResult<unknown, TError>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return hook;\n }\n\n function usePrefetchQuery(\n path: string[],\n input: unknown,\n opts?: UseTRPCPrefetchQueryOptions<unknown, unknown, TError>,\n ): void {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const isInputSkipToken = input === skipToken;\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ??\n config?.abortOnUnmount ??\n context.abortOnUnmount;\n\n _usePrefetchQuery({\n ...opts,\n queryKey: queryKey as any,\n // usePrefetchQuery's types exclude skipToken, but query-core handles it at runtime\n queryFn: isInputSkipToken\n ? (input as never)\n : (queryFunctionContext) => {\n const actualOpts = {\n trpc: {\n ...opts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(...getClientArgs(queryKey, actualOpts));\n },\n });\n }\n\n function useSuspenseQuery(\n path: readonly string[],\n input: unknown,\n opts?: UseTRPCSuspenseQueryOptions<unknown, unknown, TError>,\n ): UseTRPCSuspenseQueryResult<unknown, TError> {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ??\n config?.abortOnUnmount ??\n context.abortOnUnmount;\n\n const hook = __useSuspenseQuery(\n {\n ...opts,\n queryKey: queryKey as any,\n queryFn: (queryFunctionContext) => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n return context.client.query(...getClientArgs(queryKey, actualOpts));\n },\n },\n context.queryClient,\n ) as UseTRPCQueryResult<unknown, TError>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return [hook.data, hook as any];\n }\n\n function useMutation(\n path: readonly string[],\n opts?: UseTRPCMutationOptions<unknown, TError, unknown, unknown>,\n ): UseTRPCMutationResult<unknown, TError, unknown, unknown> {\n const { client, queryClient } = useContext();\n\n const mutationKey = getMutationKeyInternal(path);\n\n const defaultOpts = queryClient.defaultMutationOptions(\n queryClient.getMutationDefaults(mutationKey),\n );\n\n const hook = __useMutation(\n {\n ...opts,\n mutationKey: mutationKey,\n mutationFn: (input) => {\n return client.mutation(...getClientArgs([path, { input }], opts));\n },\n onSuccess(...args) {\n const originalFn = () =>\n opts?.onSuccess?.(...args) ?? defaultOpts?.onSuccess?.(...args);\n\n return mutationSuccessOverride({\n originalFn,\n queryClient,\n meta: opts?.meta ?? defaultOpts?.meta ?? {},\n });\n },\n },\n queryClient,\n ) as UseTRPCMutationResult<unknown, TError, unknown, unknown>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return hook;\n }\n const initialStateIdle: Omit<TRPCSubscriptionIdleResult<unknown>, 'reset'> = {\n data: undefined,\n error: null,\n status: 'idle',\n };\n\n const initialStateConnecting: Omit<\n TRPCSubscriptionConnectingResult<unknown, TError>,\n 'reset'\n > = {\n data: undefined,\n error: null,\n status: 'connecting',\n };\n\n /* istanbul ignore next -- @preserve */\n function useSubscription(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCSubscriptionOptions<unknown, TError>,\n ) {\n const enabled = opts?.enabled ?? input !== skipToken;\n const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));\n const { client } = useContext();\n\n const optsRef = React.useRef<typeof opts>(opts);\n React.useEffect(() => {\n optsRef.current = opts;\n });\n\n type $Result = TRPCSubscriptionResult<unknown, TError>;\n\n const [trackedProps] = React.useState(new Set<keyof $Result>([]));\n\n const addTrackedProp = React.useCallback(\n (key: keyof $Result) => {\n trackedProps.add(key);\n },\n [trackedProps],\n );\n\n const currentSubscriptionRef = React.useRef<Unsubscribable>(null);\n\n const updateState = React.useCallback(\n (callback: (prevState: $Result) => $Result) => {\n const prev = resultRef.current;\n const next = (resultRef.current = callback(prev));\n\n let shouldUpdate = false;\n for (const key of trackedProps) {\n if (prev[key] !== next[key]) {\n shouldUpdate = true;\n break;\n }\n }\n if (shouldUpdate) {\n setState(trackResult(next, addTrackedProp));\n }\n },\n [addTrackedProp, trackedProps],\n );\n\n const reset = React.useCallback((): void => {\n // unsubscribe from the previous subscription\n currentSubscriptionRef.current?.unsubscribe();\n\n if (!enabled) {\n updateState(() => ({ ...initialStateIdle, reset }));\n return;\n }\n updateState(() => ({ ...initialStateConnecting, reset }));\n const subscription = client.subscription(\n path.join('.'),\n input ?? undefined,\n {\n context: optsRef.current?.trpc?.context,\n onStarted: () => {\n optsRef.current.onStarted?.();\n updateState((prev) => ({\n ...prev,\n status: 'pending',\n error: null,\n }));\n },\n onData: (data) => {\n optsRef.current.onData?.(data);\n updateState((prev) => ({\n ...prev,\n status: 'pending',\n data,\n error: null,\n }));\n },\n onError: (error) => {\n optsRef.current.onError?.(error);\n updateState((prev) => ({\n ...prev,\n status: 'error',\n error,\n }));\n },\n onConnectionStateChange: (result) => {\n updateState((prev) => {\n switch (result.state) {\n case 'idle':\n return {\n ...prev,\n status: result.state,\n error: null,\n data: undefined,\n };\n case 'connecting':\n return {\n ...prev,\n error: result.error,\n status: result.state,\n };\n\n case 'pending':\n // handled when data is / onStarted\n return prev;\n }\n });\n },\n onComplete: () => {\n optsRef.current.onComplete?.();\n\n // In the case of WebSockets, the connection might not be idle so `onConnectionStateChange` will not be called until the connection is closed.\n // In this case, we need to set the state to idle manually.\n updateState((prev) => ({\n ...prev,\n status: 'idle',\n error: null,\n data: undefined,\n }));\n\n // (We might want to add a `connectionState` to the state to track the connection state separately)\n },\n },\n );\n\n currentSubscriptionRef.current = subscription;\n\n // oxlint-disable-next-line react/exhaustive-deps\n }, [client, queryKey, enabled, updateState]);\n React.useEffect(() => {\n reset();\n\n return () => {\n currentSubscriptionRef.current?.unsubscribe();\n };\n }, [reset]);\n\n const resultRef = React.useRef<$Result>(\n enabled\n ? { ...initialStateConnecting, reset }\n : { ...initialStateIdle, reset },\n );\n\n const [state, setState] = React.useState<$Result>(\n trackResult(resultRef.current, addTrackedProp),\n );\n\n return state;\n }\n\n function useInfiniteQuery(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCInfiniteQueryOptions<unknown, unknown, TError>,\n ): UseTRPCInfiniteQueryResult<unknown, TError, unknown> {\n const {\n client,\n ssrState,\n prefetchInfiniteQuery,\n queryClient,\n abortOnUnmount,\n } = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n if (\n typeof window === 'undefined' &&\n ssrState === 'prepass' &&\n opts?.trpc?.ssr !== false &&\n (opts?.enabled ?? defaultOpts?.enabled) !== false &&\n !isInputSkipToken &&\n !queryClient.getQueryCache().find({ queryKey })\n ) {\n void prefetchInfiniteQuery(queryKey, { ...defaultOpts, ...opts } as any);\n }\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount = opts?.trpc?.abortOnUnmount ?? abortOnUnmount;\n\n const hook = __useInfiniteQuery(\n {\n ...ssrOpts,\n initialPageParam: opts.initialCursor ?? null,\n persister: opts.persister,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n return client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam:\n queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n },\n queryClient,\n ) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;\n\n hook.trpc = useHookResult({\n path,\n });\n return hook;\n }\n\n function usePrefetchInfiniteQuery(\n path: string[],\n input: unknown,\n opts: UseTRPCPrefetchInfiniteQueryOptions<unknown, unknown, TError>,\n ): void {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = context.queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? context.abortOnUnmount;\n\n __usePrefetchInfiniteQuery({\n ...opts,\n initialPageParam: opts.initialCursor ?? null,\n queryKey,\n queryFn: isInputSkipToken\n ? (input as never)\n : (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n });\n }\n\n function useSuspenseInfiniteQuery(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCSuspenseInfiniteQueryOptions<unknown, unknown, TError>,\n ): UseTRPCSuspenseInfiniteQueryResult<unknown, TError, unknown> {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = context.queryClient.getQueryDefaults(queryKey);\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? context.abortOnUnmount;\n\n const hook = __useSuspenseInfiniteQuery(\n {\n ...opts,\n initialPageParam: opts.initialCursor ?? null,\n queryKey,\n queryFn: (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n },\n context.queryClient,\n ) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;\n\n hook.trpc = useHookResult({\n path,\n });\n\n // oxlint-disable-next-line typescript/no-non-null-assertion\n return [hook.data!, hook as any];\n }\n\n const useQueries: TRPCUseQueries<TRouter> = (\n queriesCallback: (\n t: UseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >,\n ) => readonly UseQueryOptionsForUseQueries<any, any, any, any>[],\n options?: {\n combine?: (\n results: QueriesResults<\n UseQueryOptionsForUseQueries<any, any, any, any>[]\n >,\n ) => unknown;\n },\n ) => {\n const { ssrState, queryClient, prefetchQuery, client } = useContext();\n\n const proxy = createUseQueries(client);\n\n const queries = queriesCallback(proxy);\n\n if (typeof window === 'undefined' && ssrState === 'prepass') {\n for (const query of queries) {\n const queryOption = query as TRPCQueryOptions<any, any>;\n if (\n queryOption.trpc?.ssr !== false &&\n !queryClient.getQueryCache().find({ queryKey: queryOption.queryKey })\n ) {\n void prefetchQuery(queryOption.queryKey, queryOption as any);\n }\n }\n }\n\n return __useQueries(\n {\n queries: queries.map((query) => ({\n ...query,\n queryKey: (query as TRPCQueryOptions<any, any>).queryKey,\n })),\n combine: options?.combine as any,\n },\n queryClient,\n );\n };\n\n const useSuspenseQueries: TRPCUseSuspenseQueries<TRouter> = (\n queriesCallback: (\n t: UseSuspenseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >,\n ) => readonly UseQueryOptionsForUseSuspenseQueries<any, any, any, any>[],\n ) => {\n const { queryClient, client } = useContext();\n\n const proxy = createUseQueries(client);\n\n const queries = queriesCallback(proxy);\n\n const hook = __useSuspenseQueries(\n {\n queries: queries.map((query) => ({\n ...query,\n queryFn: query.queryFn,\n queryKey: (query as TRPCQueryOptions<any, any>).queryKey,\n })),\n },\n queryClient,\n );\n\n return [hook.map((h) => h.data), hook] as any;\n };\n\n return {\n Provider: TRPCProvider,\n createClient,\n useContext,\n useUtils: useContext,\n useQuery,\n usePrefetchQuery,\n useSuspenseQuery,\n useQueries,\n useSuspenseQueries,\n useMutation,\n useSubscription,\n useInfiniteQuery,\n usePrefetchInfiniteQuery,\n useSuspenseInfiniteQuery,\n };\n}\n\n/**\n * Infer the type of a `createReactQueryHooks` function\n * @internal\n */\nexport type CreateReactQueryHooks<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n> = ReturnType<typeof createRootHooks<TRouter, TSSRContext>>;\n","import type { QueryClientConfig } from '@tanstack/react-query';\nimport { QueryClient } from '@tanstack/react-query';\n\n/**\n * @internal\n */\nexport type CreateTRPCReactQueryClientConfig =\n | {\n queryClient?: QueryClient;\n queryClientConfig?: never;\n }\n | {\n queryClientConfig?: QueryClientConfig;\n queryClient?: never;\n };\n\n/**\n * @internal\n */\nexport const getQueryClient = (config: CreateTRPCReactQueryClientConfig) =>\n config.queryClient ?? new QueryClient(config.queryClientConfig);\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,sBAGd,OA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WAAkB;EAE/D;EAGF,OAAOC,WACL;GACE,SAAS,QAAQ,KAAK,UAAA,eAAA,eAAA,CAAA,GACjB,KAAA,GAAA,CAAA,GAAA,EACH,UAAW,MAAqC,SAAA,CAClD,CAAE;GACF,SAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAS,QAAS;EACpB,GACA,WACF;CACF;CAEA,MAAMC,wBACJ,oBAMG;EACH,MAAM,EAAE,aAAa,WAAW,WAAW;EAI3C,MAAM,UAAU,gBAFF,iBAAiB,MAEK,CAAC;EAErC,MAAM,OAAOC,mBACX,EACE,SAAS,QAAQ,KAAK,UAAA,eAAA,eAAA,CAAA,GACjB,KAAA,GAAA,CAAA,GAAA;GACH,SAAS,MAAM;GACf,UAAW,MAAqC;EAClD,CAAA,CAAE,EACJ,GACA,WACF;EAEA,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,IAAI,GAAG,IAAI;CACvC;CAEA,OAAO;EACL,UAAU;EACV;EACA;EACA,UAAU;EACV,UAAA;EACA,kBAAA;EACA,kBAAA;EACA,YAAA;EACA,oBAAA;EACA,aAAA;EACA;EACA,kBAAA;EACA,0BAAA;EACA,0BAAA;CACF;AACF;;;;;ACzwBA,MAAa,kBAAkB,WAC7B;;CAAO,QAAA,sBAAA,OAAA,iBAAA,QAAA,wBAAA,KAAA,IAAA,sBAAe,IAAI,YAAY,OAAO,iBAAiB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.25.
|
|
4
|
+
"version": "11.25.3-canary.13.g1341462e1",
|
|
5
5
|
"description": "The tRPC React library",
|
|
6
6
|
"author": "KATT",
|
|
7
7
|
"license": "MIT",
|
|
@@ -70,32 +70,32 @@
|
|
|
70
70
|
],
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@tanstack/react-query": "^5.80.3",
|
|
73
|
-
"@trpc/client": "11.25.
|
|
74
|
-
"@trpc/server": "11.25.
|
|
73
|
+
"@trpc/client": "11.25.3-canary.13.g1341462e1",
|
|
74
|
+
"@trpc/server": "11.25.3-canary.13.g1341462e1",
|
|
75
75
|
"react": ">=18.2.0",
|
|
76
76
|
"typescript": ">=5.7.2"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@tanstack/query-sync-storage-persister": "^5.
|
|
80
|
-
"@tanstack/react-query": "^5.
|
|
81
|
-
"@tanstack/react-query-persist-client": "^5.
|
|
82
|
-
"@testing-library/dom": "^10.
|
|
83
|
-
"@testing-library/jest-dom": "^
|
|
84
|
-
"@testing-library/react": "^16.
|
|
85
|
-
"@testing-library/user-event": "^14.
|
|
86
|
-
"@trpc/client": "11.25.
|
|
87
|
-
"@trpc/server": "11.25.
|
|
88
|
-
"@types/express": "^5.0.
|
|
89
|
-
"@types/node": "^24.
|
|
90
|
-
"@types/react": "^19.
|
|
91
|
-
"express": "^5.
|
|
92
|
-
"next": "^
|
|
93
|
-
"oxlint": "^1.
|
|
94
|
-
"oxlint-tsgolint": "^7.0.
|
|
95
|
-
"react": "^19.1
|
|
96
|
-
"react-dom": "^19.1
|
|
97
|
-
"tsdown": "0.23.
|
|
98
|
-
"tslib": "^2.
|
|
79
|
+
"@tanstack/query-sync-storage-persister": "^5.107.1",
|
|
80
|
+
"@tanstack/react-query": "^5.107.1",
|
|
81
|
+
"@tanstack/react-query-persist-client": "^5.107.1",
|
|
82
|
+
"@testing-library/dom": "^10.4.2",
|
|
83
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
84
|
+
"@testing-library/react": "^16.3.3",
|
|
85
|
+
"@testing-library/user-event": "^14.6.8",
|
|
86
|
+
"@trpc/client": "11.25.3-canary.13.g1341462e1",
|
|
87
|
+
"@trpc/server": "11.25.3-canary.13.g1341462e1",
|
|
88
|
+
"@types/express": "^5.0.6",
|
|
89
|
+
"@types/node": "^24.19.2",
|
|
90
|
+
"@types/react": "^19.3.0",
|
|
91
|
+
"express": "^5.3.0",
|
|
92
|
+
"next": "^16.4.5",
|
|
93
|
+
"oxlint": "^1.92.0",
|
|
94
|
+
"oxlint-tsgolint": "^7.0.2006",
|
|
95
|
+
"react": "^19.3.1",
|
|
96
|
+
"react-dom": "^19.3.1",
|
|
97
|
+
"tsdown": "0.23.7",
|
|
98
|
+
"tslib": "^2.9.1",
|
|
99
99
|
"typescript": "^7.0.2",
|
|
100
100
|
"zod": "npm:zod@^3.0.0",
|
|
101
101
|
"zod-form-data": "npm:zod-form-data@^2.0.1"
|
package/src/rsc.tsx
CHANGED
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
|
|
32
32
|
const HELPERS = ['prefetch', 'prefetchInfinite'];
|
|
33
33
|
|
|
34
|
-
type DecorateProcedure<
|
|
34
|
+
export type DecorateProcedure<
|
|
35
35
|
TRoot extends AnyRootTypes,
|
|
36
36
|
TProcedure extends AnyProcedure,
|
|
37
37
|
> = {
|
|
@@ -55,7 +55,7 @@ type DecorateProcedure<
|
|
|
55
55
|
) => Promise<void>;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
type DecorateRouterRecord<
|
|
58
|
+
export type DecorateRouterRecord<
|
|
59
59
|
TRoot extends AnyRootTypes,
|
|
60
60
|
TRecord extends RouterRecord,
|
|
61
61
|
> = {
|
|
@@ -68,7 +68,7 @@ type DecorateRouterRecord<
|
|
|
68
68
|
: never;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
type Caller<TRouter extends AnyRouter> = ReturnType<
|
|
71
|
+
export type Caller<TRouter extends AnyRouter> = ReturnType<
|
|
72
72
|
RouterCaller<inferRouterRootTypes<TRouter>, TRouter['_def']['record']>
|
|
73
73
|
>;
|
|
74
74
|
|
package/src/server/index.ts
CHANGED
package/src/server/ssgProxy.ts
CHANGED
|
@@ -39,7 +39,7 @@ import type {
|
|
|
39
39
|
} from '../shared';
|
|
40
40
|
import { getQueryClient, getQueryType } from '../shared';
|
|
41
41
|
|
|
42
|
-
type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
|
|
42
|
+
export type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
|
|
43
43
|
/**
|
|
44
44
|
* Call this router directly, without HTTP.
|
|
45
45
|
*/
|
|
@@ -50,18 +50,18 @@ type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
|
|
|
50
50
|
ctx: inferRouterContext<TRouter>;
|
|
51
51
|
} & TransformerOptions<inferClientTypes<TRouter>>;
|
|
52
52
|
|
|
53
|
-
interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
|
|
53
|
+
export interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
|
|
54
54
|
/**
|
|
55
55
|
* Call procedures through this tRPC client.
|
|
56
56
|
*/
|
|
57
57
|
client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
type CreateServerSideHelpersOptions<TRouter extends AnyRouter> =
|
|
60
|
+
export type CreateServerSideHelpersOptions<TRouter extends AnyRouter> =
|
|
61
61
|
CreateTRPCReactQueryClientConfig &
|
|
62
62
|
(CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);
|
|
63
63
|
|
|
64
|
-
type SSGFns =
|
|
64
|
+
export type SSGFns =
|
|
65
65
|
| 'queryOptions'
|
|
66
66
|
| 'infiniteQueryOptions'
|
|
67
67
|
| 'fetch'
|
|
@@ -72,7 +72,7 @@ type SSGFns =
|
|
|
72
72
|
/**
|
|
73
73
|
* @internal
|
|
74
74
|
*/
|
|
75
|
-
type DecoratedProcedureSSGRecord<
|
|
75
|
+
export type DecoratedProcedureSSGRecord<
|
|
76
76
|
TRoot extends AnyRootTypes,
|
|
77
77
|
TRecord extends RouterRecord,
|
|
78
78
|
> = {
|