@trpc/react-query 11.23.0 → 11.23.1-canary.10.8a0997add
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-BqoKYDMR.d.cts → getQueryKey-BI6_waNM.d.mts} +256 -19
- package/dist/getQueryKey-BI6_waNM.d.mts.map +1 -0
- package/dist/{getQueryKey-CMt5tN9-.d.mts → getQueryKey-CSENlbGR.d.cts} +256 -19
- package/dist/getQueryKey-CSENlbGR.d.cts.map +1 -0
- package/dist/{getQueryKey-D3tJ34z0.mjs → getQueryKey-CWSorJjT.mjs} +25 -9
- package/dist/getQueryKey-CWSorJjT.mjs.map +1 -0
- package/dist/{getQueryKey-Db_3VDGo.cjs → getQueryKey-DASF3nl1.cjs} +24 -8
- package/dist/index.cjs +24 -2
- package/dist/index.d.cts +10 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/index.mjs.map +1 -1
- package/dist/rsc.cjs +9 -1
- package/dist/rsc.d.cts +9 -1
- package/dist/rsc.d.cts.map +1 -1
- package/dist/rsc.d.mts +9 -1
- package/dist/rsc.d.mts.map +1 -1
- package/dist/rsc.mjs +9 -1
- package/dist/rsc.mjs.map +1 -1
- package/dist/server/index.cjs +9 -4
- package/dist/server/index.d.cts +17 -3
- package/dist/server/index.d.cts.map +1 -1
- package/dist/server/index.d.mts +17 -3
- package/dist/server/index.d.mts.map +1 -1
- package/dist/server/index.mjs +9 -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 -1
- package/dist/{shared-Bw5jcbcM.mjs → shared-DyU-Vz6d.mjs} +11 -2
- package/dist/shared-DyU-Vz6d.mjs.map +1 -0
- package/dist/{shared-ByAY3gMr.cjs → shared-v3jJm-s7.cjs} +10 -1
- package/package.json +6 -6
- package/src/createTRPCQueryUtils.tsx +9 -0
- package/src/createTRPCReact.tsx +40 -7
- package/src/internals/context.tsx +21 -0
- package/src/internals/getQueryKey.ts +24 -8
- package/src/rsc.tsx +8 -0
- package/src/server/ssgProxy.ts +16 -2
- package/src/shared/hooks/types.ts +93 -0
- package/src/shared/polymorphism/routerLike.ts +3 -0
- package/src/shared/proxy/utilsProxy.ts +15 -0
- package/src/shared/types.ts +50 -2
- package/src/utils/inferReactQueryProcedure.ts +8 -0
- package/dist/getQueryKey-BqoKYDMR.d.cts.map +0 -1
- package/dist/getQueryKey-CMt5tN9-.d.mts.map +0 -1
- package/dist/getQueryKey-D3tJ34z0.mjs.map +0 -1
- package/dist/shared-Bw5jcbcM.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/server/ssgProxy.ts"],"sourcesContent":["import type {\n DehydratedState,\n DehydrateOptions,\n QueryClient,\n} from '@tanstack/react-query';\nimport { dehydrate } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { CoercedTransformerParameters } from '@trpc/client/unstable-internals';\nimport {\n getTransformer,\n type TransformerOptions,\n} from '@trpc/client/unstable-internals';\nimport type {\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferClientTypes,\n inferRouterContext,\n Maybe,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n callProcedure,\n createFlatProxy,\n createRecursiveProxy,\n run,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { getQueryKeyInternal } from '../internals/getQueryKey';\nimport type {\n CreateTRPCReactQueryClientConfig,\n DecorateQueryProcedure,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n} from '../shared';\nimport { getQueryClient, getQueryType } from '../shared';\n\ntype CreateSSGHelpersInternal<TRouter extends AnyRouter> = {\n router: TRouter;\n ctx: inferRouterContext<TRouter>;\n} & TransformerOptions<inferClientTypes<TRouter>>;\n\ninterface CreateSSGHelpersExternal<TRouter extends AnyRouter> {\n client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;\n}\n\ntype CreateServerSideHelpersOptions<TRouter extends AnyRouter> =\n CreateTRPCReactQueryClientConfig &\n (CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);\n\ntype SSGFns =\n | 'queryOptions'\n | 'infiniteQueryOptions'\n | 'fetch'\n | 'fetchInfinite'\n | 'prefetch'\n | 'prefetchInfinite';\n\n/**\n * @internal\n */\ntype DecoratedProcedureSSGRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? Pick<DecorateQueryProcedure<TRoot, $Value>, SSGFns>\n : $Value extends RouterRecord\n ? DecoratedProcedureSSGRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype AnyDecoratedProcedure = Pick<DecorateQueryProcedure<any, any>, SSGFns>;\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/server/ssgProxy.ts"],"sourcesContent":["import type {\n DehydratedState,\n DehydrateOptions,\n QueryClient,\n} from '@tanstack/react-query';\nimport { dehydrate } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { CoercedTransformerParameters } from '@trpc/client/unstable-internals';\nimport {\n getTransformer,\n type TransformerOptions,\n} from '@trpc/client/unstable-internals';\nimport type {\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferClientTypes,\n inferRouterContext,\n Maybe,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n callProcedure,\n createFlatProxy,\n createRecursiveProxy,\n run,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { getQueryKeyInternal } from '../internals/getQueryKey';\nimport type {\n CreateTRPCReactQueryClientConfig,\n DecorateQueryProcedure,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n} from '../shared';\nimport { getQueryClient, getQueryType } from '../shared';\n\ntype CreateSSGHelpersInternal<TRouter extends AnyRouter> = {\n /**\n * Call this router directly, without HTTP.\n */\n router: TRouter;\n /**\n * The context to call procedures with.\n */\n ctx: inferRouterContext<TRouter>;\n} & TransformerOptions<inferClientTypes<TRouter>>;\n\ninterface CreateSSGHelpersExternal<TRouter extends AnyRouter> {\n /**\n * Call procedures through this tRPC client.\n */\n client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;\n}\n\ntype CreateServerSideHelpersOptions<TRouter extends AnyRouter> =\n CreateTRPCReactQueryClientConfig &\n (CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);\n\ntype SSGFns =\n | 'queryOptions'\n | 'infiniteQueryOptions'\n | 'fetch'\n | 'fetchInfinite'\n | 'prefetch'\n | 'prefetchInfinite';\n\n/**\n * @internal\n */\ntype DecoratedProcedureSSGRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? Pick<DecorateQueryProcedure<TRoot, $Value>, SSGFns>\n : $Value extends RouterRecord\n ? DecoratedProcedureSSGRecord<TRoot, $Value>\n : never\n : never;\n};\n\ntype AnyDecoratedProcedure = Pick<DecorateQueryProcedure<any, any>, SSGFns>;\n\n/**\n * Creates helpers that fetch or prefetch queries on the server, for\n * server-side rendering and static generation.\n *\n * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in\n * the next major version. Use `@trpc/tanstack-react-query` instead.\n * @see https://trpc.io/docs/client/tanstack-react-query/migrating\n * @see https://trpc.io/docs/client/nextjs/pages-router/server-side-helpers\n */\nexport function createServerSideHelpers<TRouter extends AnyRouter>(\n opts: CreateServerSideHelpersOptions<TRouter>,\n) {\n const queryClient = getQueryClient(opts);\n const transformer = getTransformer(\n (opts as CoercedTransformerParameters).transformer,\n );\n\n const resolvedOpts: {\n serialize: (obj: unknown) => any;\n query: (queryOpts: { path: string; input: unknown }) => Promise<unknown>;\n } = (() => {\n if ('router' in opts) {\n const { ctx, router } = opts;\n return {\n serialize: (obj) => transformer.output.serialize(obj),\n query: (queryOpts) => {\n return callProcedure({\n router,\n path: queryOpts.path,\n getRawInput: async () => queryOpts.input,\n ctx,\n type: 'query',\n signal: undefined,\n batchIndex: 0,\n });\n },\n };\n }\n\n const { client } = opts;\n const untypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return {\n query: (queryOpts) =>\n untypedClient.query(queryOpts.path, queryOpts.input),\n serialize: (obj) => transformer.output.serialize(obj),\n };\n })();\n\n function _dehydrate(\n opts: DehydrateOptions = {\n shouldDehydrateQuery(query) {\n if (query.state.status === 'pending') {\n return false;\n }\n // makes sure to serialize errors\n return true;\n },\n },\n ): DehydratedState {\n const before = run(() => {\n const dehydrated = dehydrate(queryClient, opts);\n\n return {\n ...dehydrated,\n queries: dehydrated.queries.map((query) => {\n if (query.promise) {\n const { promise: _, ...rest } = query;\n return rest;\n }\n return query;\n }),\n };\n });\n const after = resolvedOpts.serialize(before);\n return after;\n }\n\n type CreateSSGHelpers = ProtectedIntersection<\n {\n queryClient: QueryClient;\n dehydrate: (opts?: DehydrateOptions) => DehydratedState;\n },\n DecoratedProcedureSSGRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >;\n const proxy = createRecursiveProxy<CreateSSGHelpers>((opts) => {\n const args = opts.args;\n const input = args[0];\n const arrayPath = [...opts.path];\n const utilName = arrayPath.pop() as keyof AnyDecoratedProcedure;\n\n const queryFn = () =>\n resolvedOpts.query({ path: arrayPath.join('.'), input });\n\n const queryKey = getQueryKeyInternal(\n arrayPath,\n input,\n getQueryType(utilName),\n );\n\n const helperMap: Record<keyof AnyDecoratedProcedure, () => unknown> = {\n queryOptions: () => {\n const args1 = args[1] as Maybe<any>;\n return { ...args1, queryKey, queryFn };\n },\n infiniteQueryOptions: () => {\n const args1 = args[1] as Maybe<any>;\n return { ...args1, queryKey, queryFn };\n },\n fetch: () => {\n const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;\n return queryClient.fetchQuery({ ...args1, queryKey, queryFn });\n },\n fetchInfinite: () => {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n return queryClient.fetchInfiniteQuery({\n ...args1,\n queryKey,\n queryFn,\n initialPageParam: args1?.initialCursor ?? null,\n });\n },\n prefetch: () => {\n const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;\n return queryClient.prefetchQuery({ ...args1, queryKey, queryFn });\n },\n prefetchInfinite: () => {\n const args1 = args[1] as Maybe<\n TRPCFetchInfiniteQueryOptions<any, any, any>\n >;\n return queryClient.prefetchInfiniteQuery({\n ...args1,\n queryKey,\n queryFn,\n initialPageParam: args1?.initialCursor ?? null,\n });\n },\n };\n\n return helperMap[utilName]();\n });\n return createFlatProxy<CreateSSGHelpers>((key) => {\n if (key === 'queryClient') return queryClient;\n if (key === 'dehydrate') return _dehydrate;\n return proxy[key];\n });\n}\n"],"mappings":";;;;;;;AA0JoB,MAAA,YAAA,CAAA,SAAA;;;;;;;;;;AA3DpB,SAAgB,wBACd,MACA;CACA,MAAM,cAAc,eAAe,IAAI;CACvC,MAAM,cAAc,eACjB,KAAsC,WACzC;CAEA,MAAM,sBAGK;EACT,IAAI,YAAY,MAAM;GACpB,MAAM,EAAE,KAAK,WAAW;GACxB,OAAO;IACL,YAAY,QAAQ,YAAY,OAAO,UAAU,GAAG;IACpD,QAAQ,cAAc;KACpB,OAAO,cAAc;MACnB;MACA,MAAM,UAAU;MAChB,aAAa,YAAY,UAAU;MACnC;MACA,MAAM;MACN,QAAQ,KAAA;MACR,YAAY;KACd,CAAC;IACH;GACF;EACF;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IACX,MAAM,QAAQ,KAAK;IACnB,OAAO,YAAY,WAAA,eAAA,eAAA,CAAA,GAAgB,KAAA,GAAA,CAAA,GAAA;KAAO;KAAU;IAAQ,CAAA,CAAC;GAC/D;GACA,qBAAqB;;IACnB,MAAM,QAAQ,KAAK;IAGnB,OAAO,YAAY,mBAAA,eAAA,eAAA,CAAA,GACd,KAAA,GAAA,CAAA,GAAA;KACH;KACA;KACA,mBAAA,uBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IAAkB,MAAO,mBAAA,QAAA,yBAAA,KAAA,IAAA,uBAAiB;IAC5C,CAAA,CAAC;GACH;GACA,gBAAgB;IACd,MAAM,QAAQ,KAAK;IACnB,OAAO,YAAY,cAAA,eAAA,eAAA,CAAA,GAAmB,KAAA,GAAA,CAAA,GAAA;KAAO;KAAU;IAAQ,CAAA,CAAC;GAClE;GACA,wBAAwB;;IACtB,MAAM,QAAQ,KAAK;IAGnB,OAAO,YAAY,sBAAA,eAAA,eAAA,CAAA,GACd,KAAA,GAAA,CAAA,GAAA;KACH;KACA;KACA,mBAAA,wBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IAAkB,MAAO,mBAAA,QAAA,0BAAA,KAAA,IAAA,wBAAiB;IAC5C,CAAA,CAAC;GACH;EAGa,EAAE,SAAS,CAAC;CAC7B,CAAC;CACD,OAAO,iBAAmC,QAAQ;EAChD,IAAI,QAAQ,eAAe,OAAO;EAClC,IAAI,QAAQ,aAAa,OAAO;EAChC,OAAO,MAAM;CACf,CAAC;AACH"}
|
package/dist/shared/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_shared = require("../shared-
|
|
2
|
+
const require_shared = require("../shared-v3jJm-s7.cjs");
|
|
3
3
|
exports.TRPCContext = require_shared.TRPCContext;
|
|
4
4
|
exports.contextProps = require_shared.contextProps;
|
|
5
5
|
exports.createQueryUtilsProxy = require_shared.createQueryUtilsProxy;
|
package/dist/shared/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-
|
|
1
|
+
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-CSENlbGR.cjs";
|
|
2
2
|
export { CreateClient, CreateQueryUtils, CreateReactUtils, CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig, type DecorateProcedure, DecorateQueryProcedure, type DecorateRouterRecord, DecoratedProcedureUtilsRecord, DecoratedTRPCContextProps, DefinedTRPCInfiniteQueryOptionsIn, DefinedTRPCInfiniteQueryOptionsOut, DefinedTRPCQueryOptionsIn, DefinedTRPCQueryOptionsOut, DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, ExtractCursorType, InferMutationLikeData, InferMutationLikeInput, InferQueryLikeData, InferQueryLikeInput, MutationLike, OutputWithCursor, QueryLike, RouterLike, RouterLikeInner, SSRState, TRPCContext, TRPCContextProps, TRPCContextPropsBase, TRPCContextState, TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions, TRPCHookResult, TRPCProvider, TRPCProviderProps, TRPCQueryBaseOptions, TRPCQueryOptions, TRPCQueryOptionsResult, TRPCQueryUtils, TRPCReactRequestOptions, TRPCSubscriptionBaseResult, TRPCSubscriptionConnectingResult, TRPCSubscriptionErrorResult, TRPCSubscriptionIdleResult, TRPCSubscriptionPendingResult, TRPCSubscriptionResult, type TRPCUseQueries, TRPCUseQueryBaseOptions, type TRPCUseSuspenseQueries, UndefinedTRPCInfiniteQueryOptionsIn, UndefinedTRPCInfiniteQueryOptionsOut, UndefinedTRPCQueryOptionsIn, UndefinedTRPCQueryOptionsOut, UnusedSkipTokenTRPCInfiniteQueryOptionsIn, UnusedSkipTokenTRPCInfiniteQueryOptionsOut, UnusedSkipTokenTRPCQueryOptionsIn, UnusedSkipTokenTRPCQueryOptionsOut, UseMutationOverride, UseQueriesProcedureRecord, UseSuspenseQueriesProcedureRecord, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCInfiniteQuerySuccessResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCPrefetchInfiniteQueryOptions, UseTRPCPrefetchQueryOptions, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCQuerySuccessResult, UseTRPCSubscriptionOptions, UseTRPCSuspenseInfiniteQueryOptions, UseTRPCSuspenseInfiniteQueryResult, UseTRPCSuspenseQueryOptions, UseTRPCSuspenseQueryResult, UtilsLike, contextProps, createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUseQueries, getClientArgs, getQueryClient, getQueryType };
|
package/dist/shared/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-
|
|
1
|
+
import { $ as DefinedUseTRPCQueryResult, A as createReactQueryUtils, At as SSRState, B as TRPCQueryBaseOptions, C as UseSuspenseQueriesProcedureRecord, Ct as UseTRPCQuerySuccessResult, D as DecorateQueryProcedure, Dt as UseTRPCSuspenseQueryOptions, E as CreateReactUtils, Et as UseTRPCSuspenseInfiniteQueryResult, F as CreateTRPCReactOptions, Ft as TRPCFetchInfiniteQueryOptions, G as UndefinedTRPCQueryOptionsOut, H as UndefinedTRPCInfiniteQueryOptionsIn, I as DefinedTRPCInfiniteQueryOptionsIn, It as TRPCFetchQueryOptions, J as UnusedSkipTokenTRPCQueryOptionsIn, K as UnusedSkipTokenTRPCInfiniteQueryOptionsIn, L as DefinedTRPCInfiniteQueryOptionsOut, Lt as TRPCQueryUtils, Mt as TRPCContextProps, N as createReactDecoration, Nt as TRPCContextPropsBase, O as DecoratedProcedureUtilsRecord, Ot as UseTRPCSuspenseQueryResult, P as createRootHooks, Pt as TRPCContextState, Q as DefinedUseTRPCQueryOptions, R as DefinedTRPCQueryOptionsIn, Rt as contextProps, S as UseQueriesProcedureRecord, St as UseTRPCQueryResult, T as CreateQueryUtils, Tt as UseTRPCSuspenseInfiniteQueryOptions, U as UndefinedTRPCInfiniteQueryOptionsOut, V as TRPCQueryOptionsResult, W as UndefinedTRPCQueryOptionsIn, X as UseMutationOverride, Y as UnusedSkipTokenTRPCQueryOptionsOut, Z as CreateClient, _ as InferMutationLikeData, _t as UseTRPCMutationOptions, a as DecorateProcedure, at as TRPCQueryOptions, b as CreateTRPCReactQueryClientConfig, bt as UseTRPCPrefetchQueryOptions, c as TRPCUseQueries, ct as TRPCSubscriptionConnectingResult, d as UtilsLike, dt as TRPCSubscriptionPendingResult, et as ExtractCursorType, f as RouterLike, ft as TRPCSubscriptionResult, g as QueryLike, gt as UseTRPCInfiniteQuerySuccessResult, h as InferQueryLikeInput, ht as UseTRPCInfiniteQueryResult, it as TRPCProviderProps, j as getQueryType, jt as TRPCContext, k as createQueryUtilsProxy, kt as DecoratedTRPCContextProps, l as TRPCUseSuspenseQueries, lt as TRPCSubscriptionErrorResult, m as InferQueryLikeData, mt as UseTRPCInfiniteQueryOptions, nt as TRPCHookResult, o as DecorateRouterRecord, ot as TRPCReactRequestOptions, p as RouterLikeInner, pt as TRPCUseQueryBaseOptions, q as UnusedSkipTokenTRPCInfiniteQueryOptionsOut, rt as TRPCProvider, st as TRPCSubscriptionBaseResult, tt as OutputWithCursor, u as getClientArgs, ut as TRPCSubscriptionIdleResult, v as InferMutationLikeInput, vt as UseTRPCMutationResult, w as createUseQueries, wt as UseTRPCSubscriptionOptions, x as getQueryClient, xt as UseTRPCQueryOptions, y as MutationLike, yt as UseTRPCPrefetchInfiniteQueryOptions, z as DefinedTRPCQueryOptionsOut } from "../getQueryKey-BI6_waNM.mjs";
|
|
2
2
|
export { CreateClient, CreateQueryUtils, CreateReactUtils, CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig, type DecorateProcedure, DecorateQueryProcedure, type DecorateRouterRecord, DecoratedProcedureUtilsRecord, DecoratedTRPCContextProps, DefinedTRPCInfiniteQueryOptionsIn, DefinedTRPCInfiniteQueryOptionsOut, DefinedTRPCQueryOptionsIn, DefinedTRPCQueryOptionsOut, DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, ExtractCursorType, InferMutationLikeData, InferMutationLikeInput, InferQueryLikeData, InferQueryLikeInput, MutationLike, OutputWithCursor, QueryLike, RouterLike, RouterLikeInner, SSRState, TRPCContext, TRPCContextProps, TRPCContextPropsBase, TRPCContextState, TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions, TRPCHookResult, TRPCProvider, TRPCProviderProps, TRPCQueryBaseOptions, TRPCQueryOptions, TRPCQueryOptionsResult, TRPCQueryUtils, TRPCReactRequestOptions, TRPCSubscriptionBaseResult, TRPCSubscriptionConnectingResult, TRPCSubscriptionErrorResult, TRPCSubscriptionIdleResult, TRPCSubscriptionPendingResult, TRPCSubscriptionResult, type TRPCUseQueries, TRPCUseQueryBaseOptions, type TRPCUseSuspenseQueries, UndefinedTRPCInfiniteQueryOptionsIn, UndefinedTRPCInfiniteQueryOptionsOut, UndefinedTRPCQueryOptionsIn, UndefinedTRPCQueryOptionsOut, UnusedSkipTokenTRPCInfiniteQueryOptionsIn, UnusedSkipTokenTRPCInfiniteQueryOptionsOut, UnusedSkipTokenTRPCQueryOptionsIn, UnusedSkipTokenTRPCQueryOptionsOut, UseMutationOverride, UseQueriesProcedureRecord, UseSuspenseQueriesProcedureRecord, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCInfiniteQuerySuccessResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCPrefetchInfiniteQueryOptions, UseTRPCPrefetchQueryOptions, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCQuerySuccessResult, UseTRPCSubscriptionOptions, UseTRPCSuspenseInfiniteQueryOptions, UseTRPCSuspenseInfiniteQueryResult, UseTRPCSuspenseQueryOptions, UseTRPCSuspenseQueryResult, UtilsLike, contextProps, createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUseQueries, getClientArgs, getQueryClient, getQueryType };
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createUseQueries, c as getQueryType, d as createReactDecoration, i as getClientArgs, l as TRPCContext, n as createRootHooks, o as createQueryUtilsProxy, s as createReactQueryUtils, t as getQueryClient, u as contextProps } from "../shared-
|
|
1
|
+
import { a as createUseQueries, c as getQueryType, d as createReactDecoration, i as getClientArgs, l as TRPCContext, n as createRootHooks, o as createQueryUtilsProxy, s as createReactQueryUtils, t as getQueryClient, u as contextProps } from "../shared-DyU-Vz6d.mjs";
|
|
2
2
|
export { TRPCContext, contextProps, createQueryUtilsProxy, createReactDecoration, createReactQueryUtils, createRootHooks, createUseQueries, getClientArgs, getQueryClient, getQueryType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as _objectSpread2, i as getQueryKeyInternal, n as getMutationKeyInternal } from "./getQueryKey-
|
|
1
|
+
import { a as _objectSpread2, i as getQueryKeyInternal, n as getMutationKeyInternal } from "./getQueryKey-CWSorJjT.mjs";
|
|
2
2
|
import { TRPCUntypedClient, createTRPCClient, createTRPCClientProxy, getUntypedClient } from "@trpc/client";
|
|
3
3
|
import { QueryClient, hashKey, infiniteQueryOptions, queryOptions, skipToken, useInfiniteQuery, useMutation, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useSuspenseInfiniteQuery, useSuspenseQueries, useSuspenseQuery } from "@tanstack/react-query";
|
|
4
4
|
import { createFlatProxy, createRecursiveProxy, isAsyncIterable } from "@trpc/server/unstable-core-do-not-import";
|
|
@@ -23,15 +23,24 @@ function createReactDecoration(hooks) {
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/internals/context.tsx
|
|
25
25
|
var _React$createContext;
|
|
26
|
+
/**
|
|
27
|
+
* The keys of {@link TRPCContextPropsBase}.
|
|
28
|
+
*/
|
|
26
29
|
const contextProps = [
|
|
27
30
|
"client",
|
|
28
31
|
"ssrContext",
|
|
29
32
|
"ssrState",
|
|
30
33
|
"abortOnUnmount"
|
|
31
34
|
];
|
|
35
|
+
/**
|
|
36
|
+
* The React context that holds the tRPC client and `QueryClient`.
|
|
37
|
+
*/
|
|
32
38
|
const TRPCContext = (_React$createContext = React.createContext) === null || _React$createContext === void 0 ? void 0 : _React$createContext.call(React, null);
|
|
33
39
|
//#endregion
|
|
34
40
|
//#region src/shared/proxy/utilsProxy.ts
|
|
41
|
+
/**
|
|
42
|
+
* Maps a `useUtils` helper name to the kind of query it works on.
|
|
43
|
+
*/
|
|
35
44
|
const getQueryType = (utilName) => {
|
|
36
45
|
switch (utilName) {
|
|
37
46
|
case "queryOptions":
|
|
@@ -742,4 +751,4 @@ const getQueryClient = (config) => {
|
|
|
742
751
|
//#endregion
|
|
743
752
|
export { createUseQueries as a, getQueryType as c, createReactDecoration as d, getClientArgs as i, TRPCContext as l, createRootHooks as n, createQueryUtilsProxy as o, createUtilityFunctions as r, createReactQueryUtils as s, getQueryClient as t, contextProps as u };
|
|
744
753
|
|
|
745
|
-
//# sourceMappingURL=shared-
|
|
754
|
+
//# sourceMappingURL=shared-DyU-Vz6d.mjs.map
|
|
@@ -0,0 +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 TRPCUseQueries,\n TRPCUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport { createUtilityFunctions } from '../../utils/createUtilityFunctions';\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> = (queriesCallback, options) => {\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 ) => {\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,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A,KAAA,IAAA,sBAAe,IAAI,YAAY,OAAO,iBAAiB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_getQueryKey = require("./getQueryKey-
|
|
1
|
+
const require_getQueryKey = require("./getQueryKey-DASF3nl1.cjs");
|
|
2
2
|
let _trpc_client = require("@trpc/client");
|
|
3
3
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
4
|
let _trpc_server_unstable_core_do_not_import = require("@trpc/server/unstable-core-do-not-import");
|
|
@@ -24,15 +24,24 @@ function createReactDecoration(hooks) {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/internals/context.tsx
|
|
26
26
|
var _React$createContext;
|
|
27
|
+
/**
|
|
28
|
+
* The keys of {@link TRPCContextPropsBase}.
|
|
29
|
+
*/
|
|
27
30
|
const contextProps = [
|
|
28
31
|
"client",
|
|
29
32
|
"ssrContext",
|
|
30
33
|
"ssrState",
|
|
31
34
|
"abortOnUnmount"
|
|
32
35
|
];
|
|
36
|
+
/**
|
|
37
|
+
* The React context that holds the tRPC client and `QueryClient`.
|
|
38
|
+
*/
|
|
33
39
|
const TRPCContext = (_React$createContext = react.createContext) === null || _React$createContext === void 0 ? void 0 : _React$createContext.call(react, null);
|
|
34
40
|
//#endregion
|
|
35
41
|
//#region src/shared/proxy/utilsProxy.ts
|
|
42
|
+
/**
|
|
43
|
+
* Maps a `useUtils` helper name to the kind of query it works on.
|
|
44
|
+
*/
|
|
36
45
|
const getQueryType = (utilName) => {
|
|
37
46
|
switch (utilName) {
|
|
38
47
|
case "queryOptions":
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.23.
|
|
4
|
+
"version": "11.23.1-canary.10.8a0997add",
|
|
5
5
|
"description": "The tRPC React library",
|
|
6
6
|
"author": "KATT",
|
|
7
7
|
"license": "MIT",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
],
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@tanstack/react-query": "^5.80.3",
|
|
79
|
-
"@trpc/client": "11.23.
|
|
80
|
-
"@trpc/server": "11.23.
|
|
79
|
+
"@trpc/client": "11.23.1-canary.10.8a0997add",
|
|
80
|
+
"@trpc/server": "11.23.1-canary.10.8a0997add",
|
|
81
81
|
"react": ">=18.2.0",
|
|
82
82
|
"typescript": ">=5.7.2"
|
|
83
83
|
},
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"@testing-library/jest-dom": "^6.9.1",
|
|
90
90
|
"@testing-library/react": "^16.1.0",
|
|
91
91
|
"@testing-library/user-event": "^14.4.3",
|
|
92
|
-
"@trpc/client": "11.23.
|
|
93
|
-
"@trpc/server": "11.23.
|
|
92
|
+
"@trpc/client": "11.23.1-canary.10.8a0997add",
|
|
93
|
+
"@trpc/server": "11.23.1-canary.10.8a0997add",
|
|
94
94
|
"@types/express": "^5.0.0",
|
|
95
95
|
"@types/node": "^24.13.4",
|
|
96
96
|
"@types/react": "^19.1.0",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"funding": [
|
|
113
113
|
"https://trpc.io/sponsor"
|
|
114
114
|
],
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "8a0997add7ad974cb1982981abd69d335962aaad"
|
|
116
116
|
}
|
|
@@ -3,6 +3,15 @@ import { createQueryUtilsProxy } from './shared';
|
|
|
3
3
|
import type { CreateQueryUtilsOptions } from './utils/createUtilityFunctions';
|
|
4
4
|
import { createUtilityFunctions } from './utils/createUtilityFunctions';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Creates the `useUtils` helpers outside of React, from a tRPC client and a
|
|
8
|
+
* `QueryClient`.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
|
|
11
|
+
* the next major version. Use `@trpc/tanstack-react-query` instead.
|
|
12
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/migrating
|
|
13
|
+
* @see https://trpc.io/docs/client/react/createTRPCQueryUtils
|
|
14
|
+
*/
|
|
6
15
|
export function createTRPCQueryUtils<TRouter extends AnyRouter>(
|
|
7
16
|
opts: CreateQueryUtilsOptions<TRouter>,
|
|
8
17
|
) {
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -297,7 +297,7 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
|
|
|
297
297
|
TDef['input'] extends CursorInput
|
|
298
298
|
? {
|
|
299
299
|
/**
|
|
300
|
-
* @see https://trpc.io/docs/
|
|
300
|
+
* @see https://trpc.io/docs/client/react/useInfiniteQuery
|
|
301
301
|
*/
|
|
302
302
|
useInfiniteQuery: useTRPCInfiniteQuery<TDef>;
|
|
303
303
|
/**
|
|
@@ -321,12 +321,12 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
|
|
|
321
321
|
*/
|
|
322
322
|
export type DecoratedQueryMethods<TDef extends ResolverDef> = {
|
|
323
323
|
/**
|
|
324
|
-
* @see https://trpc.io/docs/
|
|
324
|
+
* @see https://trpc.io/docs/client/react/useQuery
|
|
325
325
|
*/
|
|
326
326
|
useQuery: ProcedureUseQuery<TDef>;
|
|
327
327
|
usePrefetchQuery: ProcedureUsePrefetchQuery<TDef>;
|
|
328
328
|
/**
|
|
329
|
-
* @see https://trpc.io/docs/
|
|
329
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspensequery
|
|
330
330
|
*/
|
|
331
331
|
useSuspenseQuery: <
|
|
332
332
|
TQueryFnData extends TDef['output'] = TDef['output'],
|
|
@@ -352,7 +352,7 @@ export type DecoratedQuery<TDef extends ResolverDef> =
|
|
|
352
352
|
|
|
353
353
|
export type DecoratedMutation<TDef extends ResolverDef> = {
|
|
354
354
|
/**
|
|
355
|
-
* @see https://trpc.io/docs/
|
|
355
|
+
* @see https://trpc.io/docs/client/react/useMutation
|
|
356
356
|
*/
|
|
357
357
|
useMutation: <TContext = unknown>(
|
|
358
358
|
opts?: UseTRPCMutationOptions<
|
|
@@ -410,7 +410,7 @@ export type DecorateProcedure<
|
|
|
410
410
|
: TType extends 'subscription'
|
|
411
411
|
? {
|
|
412
412
|
/**
|
|
413
|
-
* @see https://trpc.io/docs/
|
|
413
|
+
* @see https://trpc.io/docs/client/react/useSubscription
|
|
414
414
|
*/
|
|
415
415
|
useSubscription: ProcedureUseSubscription<TDef>;
|
|
416
416
|
}
|
|
@@ -447,19 +447,39 @@ export type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
|
447
447
|
/**
|
|
448
448
|
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
449
449
|
*
|
|
450
|
-
* @see https://trpc.io/docs/
|
|
450
|
+
* @see https://trpc.io/docs/client/react/useUtils
|
|
451
451
|
*/
|
|
452
452
|
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
453
453
|
/**
|
|
454
|
-
* @see https://trpc.io/docs/
|
|
454
|
+
* @see https://trpc.io/docs/client/react/useUtils
|
|
455
455
|
*/
|
|
456
456
|
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
457
|
+
/**
|
|
458
|
+
* Provides the tRPC client and `QueryClient` to the hooks.
|
|
459
|
+
* @see https://trpc.io/docs/client/react/setup#4-add-trpc-providers
|
|
460
|
+
*/
|
|
457
461
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
462
|
+
/**
|
|
463
|
+
* Same as `createTRPCClient`, typed for this router.
|
|
464
|
+
*/
|
|
458
465
|
createClient: typeof createTRPCClient<TRouter>;
|
|
466
|
+
/**
|
|
467
|
+
* @see https://trpc.io/docs/client/react/useQueries
|
|
468
|
+
*/
|
|
459
469
|
useQueries: TRPCUseQueries<TRouter>;
|
|
470
|
+
/**
|
|
471
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspensequeries
|
|
472
|
+
*/
|
|
460
473
|
useSuspenseQueries: TRPCUseSuspenseQueries<TRouter>;
|
|
461
474
|
};
|
|
462
475
|
|
|
476
|
+
/**
|
|
477
|
+
* The hooks object returned by {@link createTRPCReact}.
|
|
478
|
+
*
|
|
479
|
+
* @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
|
|
480
|
+
* the next major version. Use `@trpc/tanstack-react-query` instead.
|
|
481
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/migrating
|
|
482
|
+
*/
|
|
463
483
|
export type CreateTRPCReact<
|
|
464
484
|
TRouter extends AnyRouter,
|
|
465
485
|
TSSRContext,
|
|
@@ -505,6 +525,19 @@ export function createHooksInternal<
|
|
|
505
525
|
});
|
|
506
526
|
}
|
|
507
527
|
|
|
528
|
+
/**
|
|
529
|
+
* Creates typed React hooks for your router, built on TanStack React Query.
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```ts
|
|
533
|
+
* export const trpc = createTRPCReact<AppRouter>();
|
|
534
|
+
* ```
|
|
535
|
+
*
|
|
536
|
+
* @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
|
|
537
|
+
* the next major version. Use `@trpc/tanstack-react-query` instead.
|
|
538
|
+
* @see https://trpc.io/docs/client/tanstack-react-query/migrating
|
|
539
|
+
* @see https://trpc.io/docs/client/react/setup
|
|
540
|
+
*/
|
|
508
541
|
export function createTRPCReact<
|
|
509
542
|
TRouter extends AnyRouter,
|
|
510
543
|
TSSRContext = unknown,
|
|
@@ -46,6 +46,9 @@ interface TRPCUseUtilsOptions {
|
|
|
46
46
|
*/
|
|
47
47
|
trpc?: TRPCRequestOptions;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Options for the `fetch` and `prefetch` helpers.
|
|
51
|
+
*/
|
|
49
52
|
export interface TRPCFetchQueryOptions<TOutput, TError>
|
|
50
53
|
extends
|
|
51
54
|
DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'>,
|
|
@@ -53,6 +56,9 @@ export interface TRPCFetchQueryOptions<TOutput, TError>
|
|
|
53
56
|
//
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Options for the `fetchInfinite` and `prefetchInfinite` helpers.
|
|
61
|
+
*/
|
|
56
62
|
export type TRPCFetchInfiniteQueryOptions<TInput, TOutput, TError> =
|
|
57
63
|
DistributiveOmit<
|
|
58
64
|
FetchInfiniteQueryOptions<
|
|
@@ -65,12 +71,18 @@ export type TRPCFetchInfiniteQueryOptions<TInput, TOutput, TError> =
|
|
|
65
71
|
'queryKey' | 'initialPageParam'
|
|
66
72
|
> &
|
|
67
73
|
TRPCUseUtilsOptions & {
|
|
74
|
+
/**
|
|
75
|
+
* The cursor for the first page.
|
|
76
|
+
*/
|
|
68
77
|
initialCursor?: ExtractCursorType<TInput>;
|
|
69
78
|
};
|
|
70
79
|
|
|
71
80
|
/** @internal */
|
|
72
81
|
export type SSRState = 'mounted' | 'mounting' | 'prepass' | false;
|
|
73
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Props shared by the tRPC React context and its `Provider`.
|
|
85
|
+
*/
|
|
74
86
|
export interface TRPCContextPropsBase<TRouter extends AnyRouter, TSSRContext> {
|
|
75
87
|
/**
|
|
76
88
|
* The `TRPCClient`
|
|
@@ -108,6 +120,9 @@ export type DecoratedTRPCContextProps<
|
|
|
108
120
|
client: TRPCClient<TRouter>;
|
|
109
121
|
};
|
|
110
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Props for the tRPC React context: the base props plus a `QueryClient`.
|
|
125
|
+
*/
|
|
111
126
|
export interface TRPCContextProps<
|
|
112
127
|
TRouter extends AnyRouter,
|
|
113
128
|
TSSRContext,
|
|
@@ -118,6 +133,9 @@ export interface TRPCContextProps<
|
|
|
118
133
|
queryClient: QueryClient;
|
|
119
134
|
}
|
|
120
135
|
|
|
136
|
+
/**
|
|
137
|
+
* The keys of {@link TRPCContextPropsBase}.
|
|
138
|
+
*/
|
|
121
139
|
export const contextProps: (keyof TRPCContextPropsBase<any, any>)[] = [
|
|
122
140
|
'client',
|
|
123
141
|
'ssrContext',
|
|
@@ -353,4 +371,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
353
371
|
*/
|
|
354
372
|
isMutating: (filters: { mutationKey: TRPCMutationKey }) => number;
|
|
355
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* The React context that holds the tRPC client and `QueryClient`.
|
|
376
|
+
*/
|
|
356
377
|
export const TRPCContext = React.createContext?.(null as any);
|