@trpc/react-query 11.18.1-canary.9 → 11.19.0
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-4D2iXfB-.cjs +193 -0
- package/dist/getQueryKey-B1x5Ak4F.mjs +132 -0
- package/dist/getQueryKey-B1x5Ak4F.mjs.map +1 -0
- package/dist/{getQueryKey.d-CruH3ncI.d.mts → getQueryKey-Bw7DtJ4y.d.cts} +21 -46
- package/dist/getQueryKey-Bw7DtJ4y.d.cts.map +1 -0
- package/dist/{getQueryKey.d-C_PnqPni.d.cts → getQueryKey-Cgg9jecL.d.mts} +21 -46
- package/dist/getQueryKey-Cgg9jecL.d.mts.map +1 -0
- package/dist/index.cjs +16 -17
- package/dist/index.d.cts +3 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -10
- package/dist/index.mjs.map +1 -1
- package/dist/rsc.cjs +49 -17
- package/dist/rsc.d.cts +3 -5
- package/dist/rsc.d.cts.map +1 -1
- package/dist/rsc.d.mts +3 -5
- package/dist/rsc.d.mts.map +1 -1
- package/dist/rsc.mjs +43 -12
- package/dist/rsc.mjs.map +1 -1
- package/dist/server/index.cjs +30 -35
- package/dist/server/index.d.cts +3 -5
- package/dist/server/index.d.cts.map +1 -1
- package/dist/server/index.d.mts +3 -5
- package/dist/server/index.d.mts.map +1 -1
- package/dist/server/index.mjs +20 -25
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.cjs +3 -4
- package/dist/shared/index.d.cts +2 -2
- package/dist/shared/index.d.mts +2 -2
- package/dist/shared/index.mjs +2 -4
- package/dist/{shared-Dt4RsQVp.cjs → shared-BhNi4Oqs.cjs} +210 -237
- package/dist/{shared-JtnEvJvB.mjs → shared-DhkLzxq7.mjs} +131 -160
- package/dist/shared-DhkLzxq7.mjs.map +1 -0
- package/package.json +11 -11
- package/src/createTRPCReact.tsx +1 -2
- package/src/index.ts +1 -0
- package/src/internals/context.tsx +10 -4
- package/src/internals/getQueryKey.ts +1 -3
- package/src/internals/useQueries.ts +9 -3
- package/src/shared/hooks/createHooksInternal.tsx +0 -1
- package/src/shared/hooks/types.ts +37 -20
- package/src/shared/types.ts +31 -12
- package/src/utils/createUtilityFunctions.ts +2 -2
- package/dist/getQueryKey-BY58RNzP.mjs +0 -196
- package/dist/getQueryKey-BY58RNzP.mjs.map +0 -1
- package/dist/getQueryKey-PyKLS56S.cjs +0 -242
- package/dist/getQueryKey.d-C_PnqPni.d.cts.map +0 -1
- package/dist/getQueryKey.d-CruH3ncI.d.mts.map +0 -1
- package/dist/shared-JtnEvJvB.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-DhkLzxq7.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 // eslint-disable-next-line @typescript-eslint/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}\nexport interface TRPCFetchQueryOptions<TOutput, TError>\n extends\n DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'>,\n TRPCUseUtilsOptions {\n //\n}\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 initialCursor?: ExtractCursorType<TInput>;\n };\n\n/** @internal */\nexport type SSRState = 'mounted' | 'mounting' | 'prepass' | false;\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\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\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 // eslint-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}\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 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\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/v10/useContext#query-invalidation\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\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\nexport type CreateQueryUtils<TRouter extends AnyRouter> =\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >;\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 const contextMap: Record<keyof AnyDecoratedProcedure, () => unknown> = {\n infiniteQueryOptions: () =>\n context.infiniteQueryOptions(path, queryKey, args[0]),\n queryOptions: () => 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 ? { cursor: infiniteParams.pageParam } : {}),\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,\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, { pageParam, direction }),\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, { pageParam, direction }),\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 // eslint-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?: boolean } | 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 queryFn: isInputSkipToken\n ? input\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 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 // eslint-disable-next-line react-hooks/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\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 // eslint-disable-next-line @typescript-eslint/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;;;;ACsFA,MAAa,eAAyD;CACpE;CACA;CACA;CACA;AACF;AAsOA,MAAa,eAAA,uBAAc,MAAM,mBAAA,QAAA,yBAAA,KAAA,IAAA,KAAA,IAAA,qBAAA,KAAA,OAAgB,IAAW;;;AC2E5D,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,KAA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jB,KAAA,GAAA,CAAA,GAAA,EACH,UAAW,MAAqC,SAAA,CAClD,CAAE;GACF,SAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAS,QAAS;EACpB,GACA,WACF;CACF;CAEA,MAAMC,wBACJ,oBACG;EACH,MAAM,EAAE,aAAa,WAAW,WAAW;EAI3C,MAAM,UAAU,gBAFF,iBAAiB,MAEK,CAAC;EAErC,MAAM,OAAOC,mBACX,EACE,SAAS,QAAQ,KAAK,UAAA,eAAA,eAAA,CAAA,GACjB,KAAA,GAAA,CAAA,GAAA;GACH,SAAS,MAAM;GACf,UAAW,MAAqC;EAClD,CAAA,CAAE,EACJ,GACA,WACF;EAEA,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,IAAI,GAAG,IAAI;CACvC;CAEA,OAAO;EACL,UAAU;EACV;EACA;EACA,UAAU;EACV,UAAA;EACA,kBAAA;EACA,kBAAA;EACA,YAAA;EACA,oBAAA;EACA,aAAA;EACA;EACA,kBAAA;EACA,0BAAA;EACA,0BAAA;CACF;AACF;;;;;;AC7uBA,MAAa,kBAAkB,WAC7B;;CAAO,QAAA,sBAAA,OAAA,iBAAA,QAAA,wBAAA,KAAA,IAAA,sBAAe,IAAI,YAAY,OAAO,iBAAiB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.19.0",
|
|
5
5
|
"description": "The tRPC React library",
|
|
6
6
|
"author": "KATT",
|
|
7
7
|
"license": "MIT",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@tanstack/react-query": "^5.80.3",
|
|
88
|
-
"@trpc/client": "11.
|
|
89
|
-
"@trpc/server": "11.
|
|
88
|
+
"@trpc/client": "11.19.0",
|
|
89
|
+
"@trpc/server": "11.19.0",
|
|
90
90
|
"react": ">=18.2.0",
|
|
91
91
|
"typescript": ">=5.7.2"
|
|
92
92
|
},
|
|
@@ -98,19 +98,19 @@
|
|
|
98
98
|
"@testing-library/jest-dom": "^6.9.1",
|
|
99
99
|
"@testing-library/react": "^16.1.0",
|
|
100
100
|
"@testing-library/user-event": "^14.4.3",
|
|
101
|
-
"@trpc/client": "11.
|
|
102
|
-
"@trpc/server": "11.
|
|
101
|
+
"@trpc/client": "11.19.0",
|
|
102
|
+
"@trpc/server": "11.19.0",
|
|
103
103
|
"@types/express": "^5.0.0",
|
|
104
|
-
"@types/node": "
|
|
104
|
+
"@types/node": "catalog:",
|
|
105
105
|
"@types/react": "^19.1.0",
|
|
106
|
-
"eslint": "
|
|
106
|
+
"eslint": "catalog:",
|
|
107
107
|
"express": "^5.0.0",
|
|
108
|
-
"next": "
|
|
108
|
+
"next": "catalog:",
|
|
109
109
|
"react": "^19.1.0",
|
|
110
110
|
"react-dom": "^19.1.0",
|
|
111
|
-
"tsdown": "
|
|
111
|
+
"tsdown": "catalog:",
|
|
112
112
|
"tslib": "^2.8.1",
|
|
113
|
-
"typescript": "
|
|
113
|
+
"typescript": "catalog:",
|
|
114
114
|
"zod": "npm:zod@^3.0.0",
|
|
115
115
|
"zod-form-data": "npm:zod-form-data@^2.0.1"
|
|
116
116
|
},
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"funding": [
|
|
121
121
|
"https://trpc.io/sponsor"
|
|
122
122
|
],
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "fcc6bca0ece2762e393e6d8c8527bbaa17a878d2"
|
|
124
124
|
}
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -110,8 +110,7 @@ type CursorInput = {
|
|
|
110
110
|
|
|
111
111
|
type ReservedInfiniteQueryKeys = 'cursor' | 'direction';
|
|
112
112
|
type InfiniteInput<TInput> =
|
|
113
|
-
|
|
114
|
-
| SkipToken;
|
|
113
|
+
Omit<TInput, ReservedInfiniteQueryKeys> | SkipToken;
|
|
115
114
|
|
|
116
115
|
type inferCursorType<TInput> = TInput extends { cursor?: any }
|
|
117
116
|
? TInput['cursor']
|
package/src/index.ts
CHANGED
|
@@ -7,4 +7,5 @@ export {
|
|
|
7
7
|
type CreateTRPCReactBase,
|
|
8
8
|
} from './createTRPCReact';
|
|
9
9
|
export type { inferReactQueryProcedureOptions } from './utils/inferReactQueryProcedure';
|
|
10
|
+
export type { DecorateRouterRecord } from './shared';
|
|
10
11
|
export { createTRPCQueryUtils } from './createTRPCQueryUtils';
|
|
@@ -47,7 +47,8 @@ interface TRPCUseUtilsOptions {
|
|
|
47
47
|
trpc?: TRPCRequestOptions;
|
|
48
48
|
}
|
|
49
49
|
export interface TRPCFetchQueryOptions<TOutput, TError>
|
|
50
|
-
extends
|
|
50
|
+
extends
|
|
51
|
+
DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'>,
|
|
51
52
|
TRPCUseUtilsOptions {
|
|
52
53
|
//
|
|
53
54
|
}
|
|
@@ -107,8 +108,10 @@ export type DecoratedTRPCContextProps<
|
|
|
107
108
|
client: TRPCClient<TRouter>;
|
|
108
109
|
};
|
|
109
110
|
|
|
110
|
-
export interface TRPCContextProps<
|
|
111
|
-
extends
|
|
111
|
+
export interface TRPCContextProps<
|
|
112
|
+
TRouter extends AnyRouter,
|
|
113
|
+
TSSRContext,
|
|
114
|
+
> extends TRPCContextPropsBase<TRouter, TSSRContext> {
|
|
112
115
|
/**
|
|
113
116
|
* The react-query `QueryClient`
|
|
114
117
|
*/
|
|
@@ -128,7 +131,9 @@ export const contextProps: (keyof TRPCContextPropsBase<any, any>)[] = [
|
|
|
128
131
|
export interface TRPCContextState<
|
|
129
132
|
TRouter extends AnyRouter,
|
|
130
133
|
TSSRContext = undefined,
|
|
131
|
-
>
|
|
134
|
+
>
|
|
135
|
+
extends
|
|
136
|
+
Required<TRPCContextProps<TRouter, TSSRContext>>,
|
|
132
137
|
TRPCQueryUtils<TRouter> {}
|
|
133
138
|
|
|
134
139
|
/**
|
|
@@ -292,6 +297,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
292
297
|
/**
|
|
293
298
|
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata
|
|
294
299
|
*/
|
|
300
|
+
// eslint-disable-next-line max-params -- mirrors TanStack Query's own signature
|
|
295
301
|
setQueriesData: (
|
|
296
302
|
queryKey: TRPCQueryKey,
|
|
297
303
|
filters: QueryFilters,
|
|
@@ -16,9 +16,7 @@ export type TRPCQueryKey = [
|
|
|
16
16
|
export type TRPCMutationKey = [readonly string[]]; // = [TRPCQueryKey[0]]
|
|
17
17
|
|
|
18
18
|
type ProcedureOrRouter =
|
|
19
|
-
|
|
|
20
|
-
| DecoratedQuery<any>
|
|
21
|
-
| DecorateRouterRecord<any, any>;
|
|
19
|
+
DecoratedMutation<any> | DecoratedQuery<any> | DecorateRouterRecord<any, any>;
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* To allow easy interactions with groups of related queries, such as
|
|
@@ -63,7 +63,9 @@ export type TrpcQueryOptionsForUseSuspenseQueries<TOutput, TData, TError> =
|
|
|
63
63
|
export declare type QueriesResults<
|
|
64
64
|
TQueriesOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[],
|
|
65
65
|
> = {
|
|
66
|
-
[
|
|
66
|
+
[
|
|
67
|
+
TKey in keyof TQueriesOptions
|
|
68
|
+
]: TQueriesOptions[TKey] extends UseQueryOptionsForUseQueries<
|
|
67
69
|
infer TQueryFnData,
|
|
68
70
|
infer TError,
|
|
69
71
|
infer TData,
|
|
@@ -85,7 +87,9 @@ export declare type SuspenseQueriesResults<
|
|
|
85
87
|
>[],
|
|
86
88
|
> = [
|
|
87
89
|
{
|
|
88
|
-
[
|
|
90
|
+
[
|
|
91
|
+
TKey in keyof TQueriesOptions
|
|
92
|
+
]: TQueriesOptions[TKey] extends UseQueryOptionsForUseSuspenseQueries<
|
|
89
93
|
infer TQueryFnData,
|
|
90
94
|
any,
|
|
91
95
|
infer TData,
|
|
@@ -97,7 +101,9 @@ export declare type SuspenseQueriesResults<
|
|
|
97
101
|
: never;
|
|
98
102
|
},
|
|
99
103
|
{
|
|
100
|
-
[
|
|
104
|
+
[
|
|
105
|
+
TKey in keyof TQueriesOptions
|
|
106
|
+
]: TQueriesOptions[TKey] extends UseQueryOptionsForUseSuspenseQueries<
|
|
101
107
|
infer TQueryFnData,
|
|
102
108
|
infer TError,
|
|
103
109
|
infer TData,
|
|
@@ -63,21 +63,25 @@ export interface UseTRPCQueryOptions<
|
|
|
63
63
|
TData,
|
|
64
64
|
TError,
|
|
65
65
|
TQueryOptsData = TOutput,
|
|
66
|
-
>
|
|
66
|
+
>
|
|
67
|
+
extends
|
|
68
|
+
DistributiveOmit<
|
|
67
69
|
UseBaseQueryOptions<TOutput, TError, TData, TQueryOptsData, any>,
|
|
68
70
|
'queryKey'
|
|
69
71
|
>,
|
|
70
72
|
TRPCUseQueryBaseOptions {}
|
|
71
73
|
|
|
72
74
|
export interface UseTRPCSuspenseQueryOptions<TOutput, TData, TError>
|
|
73
|
-
extends
|
|
75
|
+
extends
|
|
76
|
+
DistributiveOmit<
|
|
74
77
|
UseSuspenseQueryOptions<TOutput, TError, TData, any>,
|
|
75
78
|
'queryKey'
|
|
76
79
|
>,
|
|
77
80
|
TRPCUseQueryBaseOptions {}
|
|
78
81
|
|
|
79
82
|
export interface UseTRPCPrefetchQueryOptions<TOutput, TData, TError>
|
|
80
|
-
extends
|
|
83
|
+
extends
|
|
84
|
+
DistributiveOmit<
|
|
81
85
|
FetchQueryOptions<TOutput, TError, TData, any>,
|
|
82
86
|
'queryKey'
|
|
83
87
|
>,
|
|
@@ -90,14 +94,15 @@ export interface DefinedUseTRPCQueryOptions<
|
|
|
90
94
|
TError,
|
|
91
95
|
TQueryOptsData = TOutput,
|
|
92
96
|
> extends DistributiveOmit<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
UseTRPCQueryOptions<TOutput, TData, TError, TQueryOptsData>,
|
|
98
|
+
'queryKey'
|
|
99
|
+
> {
|
|
96
100
|
initialData: InitialDataFunction<TQueryOptsData> | TQueryOptsData;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
export interface TRPCQueryOptions<TData, TError>
|
|
100
|
-
extends
|
|
104
|
+
extends
|
|
105
|
+
DistributiveOmit<QueryOptions<TData, TError, TData, any>, 'queryKey'>,
|
|
101
106
|
TRPCUseQueryBaseOptions {
|
|
102
107
|
queryKey: TRPCQueryKey;
|
|
103
108
|
}
|
|
@@ -107,7 +112,8 @@ export type ExtractCursorType<TInput> = TInput extends { cursor?: any }
|
|
|
107
112
|
: unknown;
|
|
108
113
|
|
|
109
114
|
export interface UseTRPCInfiniteQueryOptions<TInput, TOutput, TError>
|
|
110
|
-
extends
|
|
115
|
+
extends
|
|
116
|
+
DistributiveOmit<
|
|
111
117
|
UseInfiniteQueryOptions<
|
|
112
118
|
TOutput,
|
|
113
119
|
TError,
|
|
@@ -137,7 +143,8 @@ export type UseTRPCPrefetchInfiniteQueryOptions<TInput, TOutput, TError> =
|
|
|
137
143
|
};
|
|
138
144
|
|
|
139
145
|
export interface UseTRPCSuspenseInfiniteQueryOptions<TInput, TOutput, TError>
|
|
140
|
-
extends
|
|
146
|
+
extends
|
|
147
|
+
DistributiveOmit<
|
|
141
148
|
UseSuspenseInfiniteQueryOptions<
|
|
142
149
|
TOutput,
|
|
143
150
|
TError,
|
|
@@ -156,7 +163,9 @@ export interface UseTRPCMutationOptions<
|
|
|
156
163
|
TError,
|
|
157
164
|
TOutput,
|
|
158
165
|
TContext = unknown,
|
|
159
|
-
>
|
|
166
|
+
>
|
|
167
|
+
extends
|
|
168
|
+
UseMutationOptions<TOutput, TError, TInput, TContext>,
|
|
160
169
|
TRPCUseQueryBaseOptions {}
|
|
161
170
|
|
|
162
171
|
export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
@@ -194,29 +203,35 @@ export interface TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
|
194
203
|
reset: () => void;
|
|
195
204
|
}
|
|
196
205
|
|
|
197
|
-
export interface TRPCSubscriptionIdleResult<
|
|
198
|
-
|
|
206
|
+
export interface TRPCSubscriptionIdleResult<
|
|
207
|
+
TOutput,
|
|
208
|
+
> extends TRPCSubscriptionBaseResult<TOutput, null> {
|
|
199
209
|
status: 'idle';
|
|
200
210
|
data: undefined;
|
|
201
211
|
error: null;
|
|
202
212
|
}
|
|
203
213
|
|
|
204
|
-
export interface TRPCSubscriptionConnectingResult<
|
|
205
|
-
|
|
214
|
+
export interface TRPCSubscriptionConnectingResult<
|
|
215
|
+
TOutput,
|
|
216
|
+
TError,
|
|
217
|
+
> extends TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
206
218
|
status: 'connecting';
|
|
207
219
|
data: undefined | TOutput;
|
|
208
220
|
error: TError | null;
|
|
209
221
|
}
|
|
210
222
|
|
|
211
|
-
export interface TRPCSubscriptionPendingResult<
|
|
212
|
-
|
|
223
|
+
export interface TRPCSubscriptionPendingResult<
|
|
224
|
+
TOutput,
|
|
225
|
+
> extends TRPCSubscriptionBaseResult<TOutput, undefined> {
|
|
213
226
|
status: 'pending';
|
|
214
227
|
data: TOutput | undefined;
|
|
215
228
|
error: null;
|
|
216
229
|
}
|
|
217
230
|
|
|
218
|
-
export interface TRPCSubscriptionErrorResult<
|
|
219
|
-
|
|
231
|
+
export interface TRPCSubscriptionErrorResult<
|
|
232
|
+
TOutput,
|
|
233
|
+
TError,
|
|
234
|
+
> extends TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
220
235
|
status: 'error';
|
|
221
236
|
data: TOutput | undefined;
|
|
222
237
|
error: TError;
|
|
@@ -228,8 +243,10 @@ export type TRPCSubscriptionResult<TOutput, TError> =
|
|
|
228
243
|
| TRPCSubscriptionErrorResult<TOutput, TError>
|
|
229
244
|
| TRPCSubscriptionPendingResult<TOutput>;
|
|
230
245
|
|
|
231
|
-
export interface TRPCProviderProps<
|
|
232
|
-
extends
|
|
246
|
+
export interface TRPCProviderProps<
|
|
247
|
+
TRouter extends AnyRouter,
|
|
248
|
+
TSSRContext,
|
|
249
|
+
> extends Omit<TRPCContextProps<TRouter, TSSRContext>, 'client'> {
|
|
233
250
|
children: ReactNode;
|
|
234
251
|
client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;
|
|
235
252
|
}
|
package/src/shared/types.ts
CHANGED
|
@@ -38,7 +38,8 @@ type TRPCInfiniteOptionOverrides = TRPCOptionOverrides | 'initialPageParam';
|
|
|
38
38
|
* QueryOptions API helpers
|
|
39
39
|
*/
|
|
40
40
|
export interface UndefinedTRPCQueryOptionsIn<TQueryFnData, TData, TError>
|
|
41
|
-
extends
|
|
41
|
+
extends
|
|
42
|
+
DistributiveOmit<
|
|
42
43
|
UndefinedInitialDataOptions<
|
|
43
44
|
coerceAsyncIterableToArray<TQueryFnData>,
|
|
44
45
|
TError,
|
|
@@ -50,7 +51,8 @@ export interface UndefinedTRPCQueryOptionsIn<TQueryFnData, TData, TError>
|
|
|
50
51
|
TRPCQueryBaseOptions {}
|
|
51
52
|
|
|
52
53
|
export interface UndefinedTRPCQueryOptionsOut<TQueryFnData, TOutput, TError>
|
|
53
|
-
extends
|
|
54
|
+
extends
|
|
55
|
+
UndefinedInitialDataOptions<
|
|
54
56
|
coerceAsyncIterableToArray<TQueryFnData>,
|
|
55
57
|
TError,
|
|
56
58
|
coerceAsyncIterableToArray<TOutput>,
|
|
@@ -61,7 +63,8 @@ export interface UndefinedTRPCQueryOptionsOut<TQueryFnData, TOutput, TError>
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export interface DefinedTRPCQueryOptionsIn<TQueryFnData, TData, TError>
|
|
64
|
-
extends
|
|
66
|
+
extends
|
|
67
|
+
DistributiveOmit<
|
|
65
68
|
DefinedInitialDataOptions<
|
|
66
69
|
coerceAsyncIterableToArray<TQueryFnData>,
|
|
67
70
|
TError,
|
|
@@ -73,7 +76,8 @@ export interface DefinedTRPCQueryOptionsIn<TQueryFnData, TData, TError>
|
|
|
73
76
|
TRPCQueryBaseOptions {}
|
|
74
77
|
|
|
75
78
|
export interface DefinedTRPCQueryOptionsOut<TQueryFnData, TData, TError>
|
|
76
|
-
extends
|
|
79
|
+
extends
|
|
80
|
+
DefinedInitialDataOptions<
|
|
77
81
|
coerceAsyncIterableToArray<TQueryFnData>,
|
|
78
82
|
TError,
|
|
79
83
|
coerceAsyncIterableToArray<TData>,
|
|
@@ -84,7 +88,8 @@ export interface DefinedTRPCQueryOptionsOut<TQueryFnData, TData, TError>
|
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
export interface UnusedSkipTokenTRPCQueryOptionsIn<TQueryFnData, TData, TError>
|
|
87
|
-
extends
|
|
91
|
+
extends
|
|
92
|
+
DistributiveOmit<
|
|
88
93
|
UnusedSkipTokenOptions<
|
|
89
94
|
coerceAsyncIterableToArray<TQueryFnData>,
|
|
90
95
|
TError,
|
|
@@ -99,7 +104,9 @@ export interface UnusedSkipTokenTRPCQueryOptionsOut<
|
|
|
99
104
|
TQueryFnData,
|
|
100
105
|
TOutput,
|
|
101
106
|
TError,
|
|
102
|
-
>
|
|
107
|
+
>
|
|
108
|
+
extends
|
|
109
|
+
UnusedSkipTokenOptions<
|
|
103
110
|
coerceAsyncIterableToArray<TQueryFnData>,
|
|
104
111
|
TError,
|
|
105
112
|
coerceAsyncIterableToArray<TOutput>,
|
|
@@ -117,7 +124,9 @@ export interface UndefinedTRPCInfiniteQueryOptionsIn<
|
|
|
117
124
|
TQueryFnData,
|
|
118
125
|
TData,
|
|
119
126
|
TError,
|
|
120
|
-
>
|
|
127
|
+
>
|
|
128
|
+
extends
|
|
129
|
+
DistributiveOmit<
|
|
121
130
|
UndefinedInitialDataInfiniteOptions<
|
|
122
131
|
TQueryFnData,
|
|
123
132
|
TError,
|
|
@@ -136,7 +145,9 @@ export interface UndefinedTRPCInfiniteQueryOptionsOut<
|
|
|
136
145
|
TQueryFnData,
|
|
137
146
|
TData,
|
|
138
147
|
TError,
|
|
139
|
-
>
|
|
148
|
+
>
|
|
149
|
+
extends
|
|
150
|
+
DistributiveOmit<
|
|
140
151
|
UndefinedInitialDataInfiniteOptions<
|
|
141
152
|
TQueryFnData,
|
|
142
153
|
TError,
|
|
@@ -156,7 +167,9 @@ export interface DefinedTRPCInfiniteQueryOptionsIn<
|
|
|
156
167
|
TQueryFnData,
|
|
157
168
|
TData,
|
|
158
169
|
TError,
|
|
159
|
-
>
|
|
170
|
+
>
|
|
171
|
+
extends
|
|
172
|
+
DistributiveOmit<
|
|
160
173
|
DefinedInitialDataInfiniteOptions<
|
|
161
174
|
TQueryFnData,
|
|
162
175
|
TError,
|
|
@@ -175,7 +188,9 @@ export interface DefinedTRPCInfiniteQueryOptionsOut<
|
|
|
175
188
|
TQueryFnData,
|
|
176
189
|
TData,
|
|
177
190
|
TError,
|
|
178
|
-
>
|
|
191
|
+
>
|
|
192
|
+
extends
|
|
193
|
+
DistributiveOmit<
|
|
179
194
|
DefinedInitialDataInfiniteOptions<
|
|
180
195
|
TQueryFnData,
|
|
181
196
|
TError,
|
|
@@ -195,7 +210,9 @@ export interface UnusedSkipTokenTRPCInfiniteQueryOptionsIn<
|
|
|
195
210
|
TQueryFnData,
|
|
196
211
|
TData,
|
|
197
212
|
TError,
|
|
198
|
-
>
|
|
213
|
+
>
|
|
214
|
+
extends
|
|
215
|
+
DistributiveOmit<
|
|
199
216
|
UnusedSkipTokenInfiniteOptions<
|
|
200
217
|
TQueryFnData,
|
|
201
218
|
TError,
|
|
@@ -214,7 +231,9 @@ export interface UnusedSkipTokenTRPCInfiniteQueryOptionsOut<
|
|
|
214
231
|
TQueryFnData,
|
|
215
232
|
TData,
|
|
216
233
|
TError,
|
|
217
|
-
>
|
|
234
|
+
>
|
|
235
|
+
extends
|
|
236
|
+
DistributiveOmit<
|
|
218
237
|
UnusedSkipTokenInfiniteOptions<
|
|
219
238
|
TQueryFnData,
|
|
220
239
|
TError,
|