@trpc/react-query 10.5.0 → 10.6.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/README.md +1 -1
- package/dist/{createHooksInternal-808efaa7.mjs → createHooksInternal-10b1b7ef.mjs} +43 -3
- package/dist/{createHooksInternal-d9b9c414.js → createHooksInternal-860b8183.js} +43 -1
- package/dist/createTRPCReact.d.ts +2 -0
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/{getArrayQueryKey-c6f6badf.mjs → getArrayQueryKey-30a7f2f6.mjs} +1 -1
- package/dist/{getArrayQueryKey-24927615.js → getArrayQueryKey-671d083c.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/internals/useQueries.d.ts +28 -0
- package/dist/internals/useQueries.d.ts.map +1 -0
- package/dist/shared/hooks/createHooksInternal.d.ts +7 -1
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +4 -2
- package/dist/shared/index.mjs +2 -2
- package/dist/shared/proxy/useQueriesProxy.d.ts +18 -0
- package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -0
- package/dist/shared/proxy/utilsProxy.d.ts +12 -12
- package/dist/ssg/index.js +1 -1
- package/dist/ssg/index.mjs +1 -1
- package/package.json +6 -6
- package/src/createTRPCReact.tsx +3 -1
- package/src/internals/getArrayQueryKey.ts +1 -1
- package/src/internals/useQueries.ts +84 -0
- package/src/shared/hooks/createHooksInternal.tsx +41 -1
- package/src/shared/index.ts +2 -0
- package/src/shared/proxy/useQueriesProxy.ts +83 -0
- package/src/shared/proxy/utilsProxy.ts +12 -12
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRecursiveProxy, createFlatProxy } from '@trpc/server/shared';
|
|
2
2
|
import { createTRPCClientProxy, createTRPCClient } from '@trpc/client';
|
|
3
|
-
import { useQuery, useQueryClient, useMutation, hashQueryKey, useInfiniteQuery } from '@tanstack/react-query';
|
|
3
|
+
import { useQuery, useQueryClient, useMutation, hashQueryKey, useInfiniteQuery, useQueries } from '@tanstack/react-query';
|
|
4
4
|
import React, { createContext, useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
5
|
-
import { g as getArrayQueryKey } from './getArrayQueryKey-
|
|
5
|
+
import { g as getArrayQueryKey } from './getArrayQueryKey-30a7f2f6.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* We treat `undefined` as an input the same as omitting an `input`
|
|
@@ -119,6 +119,25 @@ const TRPCContext = /*#__PURE__*/ createContext(null);
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Create proxy for `useQueries` options
|
|
124
|
+
* @internal
|
|
125
|
+
*/ function createUseQueriesProxy(client) {
|
|
126
|
+
return createRecursiveProxy((opts)=>{
|
|
127
|
+
const path = opts.path.join('.');
|
|
128
|
+
const [input, ...rest] = opts.args;
|
|
129
|
+
const queryKey = getQueryKey(path, input);
|
|
130
|
+
const options = {
|
|
131
|
+
queryKey,
|
|
132
|
+
queryFn: ()=>{
|
|
133
|
+
return client.query(path, input);
|
|
134
|
+
},
|
|
135
|
+
...rest[1]
|
|
136
|
+
};
|
|
137
|
+
return options;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
122
141
|
function getClientArgs(pathAndInput, opts) {
|
|
123
142
|
const [path, input] = pathAndInput;
|
|
124
143
|
return [
|
|
@@ -399,6 +418,26 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
399
418
|
});
|
|
400
419
|
return hook;
|
|
401
420
|
}
|
|
421
|
+
const useQueries$1 = (queriesCallback, context)=>{
|
|
422
|
+
const { ssrState , queryClient , prefetchQuery , client } = useContext();
|
|
423
|
+
const proxy = createUseQueriesProxy(client);
|
|
424
|
+
const queries = queriesCallback(proxy);
|
|
425
|
+
if (typeof window === 'undefined' && ssrState === 'prepass') {
|
|
426
|
+
for (const query of queries){
|
|
427
|
+
const queryOption = query;
|
|
428
|
+
if (queryOption.trpc?.ssr !== false && !queryClient.getQueryCache().find(getArrayQueryKey(queryOption.queryKey, 'query'))) {
|
|
429
|
+
void prefetchQuery(queryOption.queryKey, queryOption);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return useQueries({
|
|
434
|
+
queries: queries.map((query)=>({
|
|
435
|
+
...query,
|
|
436
|
+
queryKey: getArrayQueryKey(query.queryKey, 'query')
|
|
437
|
+
})),
|
|
438
|
+
context
|
|
439
|
+
});
|
|
440
|
+
};
|
|
402
441
|
const useDehydratedState = (client, trpcState)=>{
|
|
403
442
|
const transformed = useMemo(()=>{
|
|
404
443
|
if (!trpcState) {
|
|
@@ -416,6 +455,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
416
455
|
createClient,
|
|
417
456
|
useContext,
|
|
418
457
|
useQuery: useQuery$1,
|
|
458
|
+
useQueries: useQueries$1,
|
|
419
459
|
useMutation: useMutation$1,
|
|
420
460
|
useSubscription,
|
|
421
461
|
useDehydratedState,
|
|
@@ -423,4 +463,4 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
423
463
|
};
|
|
424
464
|
}
|
|
425
465
|
|
|
426
|
-
export { createReactQueryUtilsProxy as a, createReactProxyDecoration as b, createHooksInternal as c };
|
|
466
|
+
export { createReactQueryUtilsProxy as a, createReactProxyDecoration as b, createHooksInternal as c, createUseQueriesProxy as d, getClientArgs as g };
|
|
@@ -4,7 +4,7 @@ var shared = require('@trpc/server/shared');
|
|
|
4
4
|
var client = require('@trpc/client');
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var getArrayQueryKey = require('./getArrayQueryKey-
|
|
7
|
+
var getArrayQueryKey = require('./getArrayQueryKey-671d083c.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
@@ -125,6 +125,25 @@ const TRPCContext = /*#__PURE__*/ React.createContext(null);
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Create proxy for `useQueries` options
|
|
130
|
+
* @internal
|
|
131
|
+
*/ function createUseQueriesProxy(client) {
|
|
132
|
+
return shared.createRecursiveProxy((opts)=>{
|
|
133
|
+
const path = opts.path.join('.');
|
|
134
|
+
const [input, ...rest] = opts.args;
|
|
135
|
+
const queryKey = getQueryKey(path, input);
|
|
136
|
+
const options = {
|
|
137
|
+
queryKey,
|
|
138
|
+
queryFn: ()=>{
|
|
139
|
+
return client.query(path, input);
|
|
140
|
+
},
|
|
141
|
+
...rest[1]
|
|
142
|
+
};
|
|
143
|
+
return options;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
128
147
|
function getClientArgs(pathAndInput, opts) {
|
|
129
148
|
const [path, input] = pathAndInput;
|
|
130
149
|
return [
|
|
@@ -405,6 +424,26 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
405
424
|
});
|
|
406
425
|
return hook;
|
|
407
426
|
}
|
|
427
|
+
const useQueries = (queriesCallback, context)=>{
|
|
428
|
+
const { ssrState , queryClient , prefetchQuery , client } = useContext();
|
|
429
|
+
const proxy = createUseQueriesProxy(client);
|
|
430
|
+
const queries = queriesCallback(proxy);
|
|
431
|
+
if (typeof window === 'undefined' && ssrState === 'prepass') {
|
|
432
|
+
for (const query of queries){
|
|
433
|
+
const queryOption = query;
|
|
434
|
+
if (queryOption.trpc?.ssr !== false && !queryClient.getQueryCache().find(getArrayQueryKey.getArrayQueryKey(queryOption.queryKey, 'query'))) {
|
|
435
|
+
void prefetchQuery(queryOption.queryKey, queryOption);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return reactQuery.useQueries({
|
|
440
|
+
queries: queries.map((query)=>({
|
|
441
|
+
...query,
|
|
442
|
+
queryKey: getArrayQueryKey.getArrayQueryKey(query.queryKey, 'query')
|
|
443
|
+
})),
|
|
444
|
+
context
|
|
445
|
+
});
|
|
446
|
+
};
|
|
408
447
|
const useDehydratedState = (client, trpcState)=>{
|
|
409
448
|
const transformed = React.useMemo(()=>{
|
|
410
449
|
if (!trpcState) {
|
|
@@ -422,6 +461,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
422
461
|
createClient,
|
|
423
462
|
useContext,
|
|
424
463
|
useQuery,
|
|
464
|
+
useQueries,
|
|
425
465
|
useMutation,
|
|
426
466
|
useSubscription,
|
|
427
467
|
useDehydratedState,
|
|
@@ -432,3 +472,5 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
432
472
|
exports.createHooksInternal = createHooksInternal;
|
|
433
473
|
exports.createReactProxyDecoration = createReactProxyDecoration;
|
|
434
474
|
exports.createReactQueryUtilsProxy = createReactQueryUtilsProxy;
|
|
475
|
+
exports.createUseQueriesProxy = createUseQueriesProxy;
|
|
476
|
+
exports.getClientArgs = getClientArgs;
|
|
@@ -2,6 +2,7 @@ import { InfiniteData } from '@tanstack/react-query';
|
|
|
2
2
|
import { TRPCClientErrorLike } from '@trpc/client';
|
|
3
3
|
import { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRouter, AnySubscriptionProcedure, ProcedureRouterRecord, inferProcedureInput } from '@trpc/server';
|
|
4
4
|
import { inferTransformedProcedureOutput, inferTransformedSubscriptionOutput } from '@trpc/server/shared';
|
|
5
|
+
import { TRPCUseQueries } from './internals/useQueries';
|
|
5
6
|
import { CreateReactUtilsProxy } from './shared';
|
|
6
7
|
import { CreateClient, CreateReactQueryHooks, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCInfiniteQuerySuccessResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCQuerySuccessResult, UseTRPCSubscriptionOptions } from './shared/hooks/createHooksInternal';
|
|
7
8
|
import { CreateTRPCReactOptions } from './shared/types';
|
|
@@ -39,6 +40,7 @@ export declare type CreateTRPCReact<TRouter extends AnyRouter, TSSRContext, TFla
|
|
|
39
40
|
useContext(): CreateReactUtilsProxy<TRouter, TSSRContext>;
|
|
40
41
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
41
42
|
createClient: CreateClient<TRouter>;
|
|
43
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
42
44
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
43
45
|
} & DecoratedProcedureRecord<TRouter['_def']['record'], TFlags>;
|
|
44
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCReact.d.ts","sourceRoot":"","sources":["../src/createTRPCReact.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,+BAA+B,EAC/B,kCAAkC,EACnC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,iCAAiC,EACjC,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAE3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,oBAAY,iBAAiB,CAC3B,UAAU,SAAS,YAAY,EAC/B,MAAM,EAC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,CAAC,EACnC,MAAM,EACN,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,CAC5B,GACD,WAAW,CAAC,IAAI,CAAC,SAAS,YAAY,GACtC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,EAAE,CAAC,GACxE,KAAK;CACV,CAAC;AAEF,oBAAY,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI;IAC5E,UAAU,IAAI,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC1D,QAAQ,EAAE,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7C,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACpC,kBAAkB,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACjD,GAAG,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAEhE;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,MAAM,GAAG,IAAI,EACb,IAAI,EAAE,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,iDAoBlD;AAED,wBAAgB,eAAe,CAC7B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,MAAM,GAAG,IAAI,EACb,IAAI,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,iDAKvC"}
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var client = require('@trpc/client');
|
|
6
6
|
var shared = require('@trpc/server/shared');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var createHooksInternal = require('./createHooksInternal-
|
|
8
|
+
var createHooksInternal = require('./createHooksInternal-860b8183.js');
|
|
9
9
|
require('@tanstack/react-query');
|
|
10
|
-
require('./getArrayQueryKey-
|
|
10
|
+
require('./getArrayQueryKey-671d083c.js');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from '@trpc/client';
|
|
2
2
|
import { createFlatProxy } from '@trpc/server/shared';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { c as createHooksInternal, a as createReactQueryUtilsProxy, b as createReactProxyDecoration } from './createHooksInternal-
|
|
4
|
+
import { c as createHooksInternal, a as createReactQueryUtilsProxy, b as createReactProxyDecoration } from './createHooksInternal-10b1b7ef.mjs';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
|
-
import './getArrayQueryKey-
|
|
6
|
+
import './getArrayQueryKey-30a7f2f6.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { AnyRouter } from '@trpc/server';
|
|
3
|
+
import { UseQueriesProcedureRecord, UseTRPCQueryOptions, UseTRPCQueryResult } from '../shared';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'context'>;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare type TrpcQueryOptionsForUseQueries<TPath, TInput, TOutput, TData, TError> = Omit<UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError>, 'context'>;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare type QueriesResults<TQueriesOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[]> = {
|
|
16
|
+
[TKey in keyof TQueriesOptions]: TQueriesOptions[TKey] extends UseQueryOptionsForUseQueries<infer TQueryFnData, infer TError, infer TData, any> ? UseTRPCQueryResult<unknown extends TData ? TQueryFnData : TData, TError> : never;
|
|
17
|
+
};
|
|
18
|
+
declare type GetOptions<TQueryOptions> = TQueryOptions extends UseQueryOptionsForUseQueries<any, any, any, any> ? TQueryOptions : never;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare type QueriesOptions<TQueriesOptions extends any[], TResult extends any[] = []> = TQueriesOptions extends [] ? [] : TQueriesOptions extends [infer Head] ? [...TResult, GetOptions<Head>] : TQueriesOptions extends [infer Head, ...infer Tail] ? QueriesOptions<Tail, [...TResult, GetOptions<Head>]> : unknown[] extends TQueriesOptions ? TQueriesOptions : TQueriesOptions extends UseQueryOptionsForUseQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>[] ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData, TQueryKey>[] : UseQueryOptionsForUseQueries[];
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare type TRPCUseQueries<TRouter extends AnyRouter> = <TQueryOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[]>(queriesCallback: (t: UseQueriesProcedureRecord<TRouter>) => readonly [...QueriesOptions<TQueryOptions>], context?: UseQueryOptions['context']) => QueriesResults<TQueryOptions>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=useQueries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQueries.d.ts","sourceRoot":"","sources":["../../src/internals/useQueries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAA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AAC,GACpC,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,GAC9B,eAAe,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACnD,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,GACpD,OAAO,EAAE,SAAS,eAAe,GACjC,eAAe,GACf,eAAe,SAAS,4BAA4B,CAClD,MAAM,YAAY,EAClB,MAAM,MAAM,EACZ,MAAM,KAAK,EACX,MAAM,SAAS,CAChB,EAAE,GACH,4BAA4B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GACtE,4BAA4B,EAAE,CAAC;AAEnC;;GAEG;AACH,oBAAY,cAAc,CAAC,OAAO,SAAS,SAAS,IAAI,CACtD,aAAa,SAAS,4BAA4B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAExE,eAAe,EAAE,CACf,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,KAClC,SAAS,CAAC,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC,EAChD,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,KACjC,cAAc,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { DehydratedState, InfiniteQueryObserverSuccessResult, QueryObserverSuccessResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
1
|
+
import { DehydratedState, InfiniteQueryObserverSuccessResult, QueryObserverSuccessResult, QueryOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { CreateTRPCClientOptions, TRPCClient, TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
|
|
3
3
|
import type { AnyRouter, ProcedureRecord, inferHandlerInput, inferProcedureClientError, inferProcedureInput, inferProcedureOutput } from '@trpc/server';
|
|
4
4
|
import { inferObservableValue } from '@trpc/server/observable';
|
|
5
5
|
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
import { TRPCContextProps, TRPCContextState } from '../../internals/context';
|
|
8
|
+
import { TRPCUseQueries } from '../../internals/useQueries';
|
|
8
9
|
import { CreateTRPCReactOptions } from '../types';
|
|
9
10
|
export declare type OutputWithCursor<TData, TCursor = any> = {
|
|
10
11
|
cursor: TCursor | null;
|
|
@@ -29,6 +30,8 @@ export interface TRPCUseQueryBaseOptions {
|
|
|
29
30
|
export type { TRPCContext, TRPCContextState } from '../../internals/context';
|
|
30
31
|
export interface UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> extends UseQueryOptions<TOutput, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
31
32
|
}
|
|
33
|
+
export interface TRPCQueryOptions<TPath, TInput, TData, TError> extends QueryOptions<TData, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
34
|
+
}
|
|
32
35
|
export interface UseTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError> extends UseInfiniteQueryOptions<TOutput, TError, TOutput, TOutput, [
|
|
33
36
|
TPath,
|
|
34
37
|
TInput
|
|
@@ -42,6 +45,7 @@ export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
|
42
45
|
onData: (data: TOutput) => void;
|
|
43
46
|
onError?: (err: TError) => void;
|
|
44
47
|
}
|
|
48
|
+
export declare function getClientArgs<TPathAndInput extends unknown[], TOptions>(pathAndInput: TPathAndInput, opts: TOptions): readonly [unknown, unknown, any];
|
|
45
49
|
declare type inferInfiniteQueryNames<TObj extends ProcedureRecord> = {
|
|
46
50
|
[TPath in keyof TObj]: inferProcedureInput<TObj[TPath]> extends {
|
|
47
51
|
cursor?: any;
|
|
@@ -93,6 +97,7 @@ export declare function createHooksInternal<TRouter extends AnyRouter, TSSRConte
|
|
|
93
97
|
createClient: CreateClient<TRouter>;
|
|
94
98
|
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
95
99
|
useQuery: <TPath extends keyof TRouter["_def"]["queries"] & string, TQueryFnData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"], TData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"]>(pathAndInput: [path: TPath, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["queries"][TPath]>>], opts?: UseTRPCQueryOptions<TPath, inferProcedures<TRouter["_def"]["queries"]>[TPath]["input"], TQueryFnData, TData, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<TData, TRPCClientErrorLike<TRouter>>;
|
|
100
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
96
101
|
useMutation: <TPath_1 extends keyof TRouter["_def"]["mutations"] & string, TContext = unknown>(path: TPath_1 | [TPath_1], opts?: UseTRPCMutationOptions<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TContext> | undefined) => UseTRPCMutationResult<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TContext>;
|
|
97
102
|
useSubscription: <TPath_2 extends keyof TRouter["_def"]["subscriptions"] & string, TOutput extends inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>>(pathAndInput: [path: TPath_2, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["subscriptions"][TPath_2]>>], opts: UseTRPCSubscriptionOptions<inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>, inferProcedureClientError<TRouter["_def"]["subscriptions"][TPath_2]>>) => void;
|
|
98
103
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
@@ -108,6 +113,7 @@ declare class GnClass<TRouter extends AnyRouter, TSSRContext = unknown> {
|
|
|
108
113
|
createClient: CreateClient<TRouter>;
|
|
109
114
|
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
110
115
|
useQuery: <TPath extends keyof TRouter["_def"]["queries"] & string, TQueryFnData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"], TData = inferProcedures<TRouter["_def"]["queries"]>[TPath]["output"]>(pathAndInput: [path: TPath, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["queries"][TPath]>>], opts?: UseTRPCQueryOptions<TPath, inferProcedures<TRouter["_def"]["queries"]>[TPath]["input"], TQueryFnData, TData, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<TData, TRPCClientErrorLike<TRouter>>;
|
|
116
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
111
117
|
useMutation: <TPath_1 extends keyof TRouter["_def"]["mutations"] & string, TContext = unknown>(path: TPath_1 | [TPath_1], opts?: UseTRPCMutationOptions<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TContext> | undefined) => UseTRPCMutationResult<inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["output"], TRPCClientErrorLike<TRouter>, inferProcedures<TRouter["_def"]["mutations"]>[TPath_1]["input"], TContext>;
|
|
112
118
|
useSubscription: <TPath_2 extends keyof TRouter["_def"]["subscriptions"] & string, TOutput extends inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>>(pathAndInput: [path: TPath_2, ...args: import("@trpc/server").ProcedureArgs<import("@trpc/server").inferProcedureParams<TRouter["_def"]["subscriptions"][TPath_2]>>], opts: UseTRPCSubscriptionOptions<inferObservableValue<inferProcedureOutput<TRouter["_def"]["subscriptions"][TPath_2]>>, inferProcedureClientError<TRouter["_def"]["subscriptions"][TPath_2]>>) => void;
|
|
113
119
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,kCAAkC,EAElC,0BAA0B,EAC1B,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,
|
|
1
|
+
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,kCAAkC,EAElC,0BAA0B,EAC1B,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EAOf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EAErB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAc,EACZ,SAAS,EAMV,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAuB,MAAM,UAAU,CAAC;AAEvE,oBAAY,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,G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K,SAAS,CAC5C,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC,GACR,CAAC,GACD,KAAK,CAAC;AACV,aAAK,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO,IAAI,OAAO,CACtE,OAAO,EACP,WAAW,CACZ,CAAC,IAAI,CAAC,CAAC;AAER;;;GAGG;AACH,oBAAY,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,IACnB,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC"}
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './proxy/decorationProxy';
|
|
2
2
|
export * from './proxy/utilsProxy';
|
|
3
|
+
export * from './proxy/useQueriesProxy';
|
|
3
4
|
export type { DecoratedProcedureRecord, DecorateProcedure, } from '../createTRPCReact';
|
|
5
|
+
export type { TRPCUseQueries } from '../internals/useQueries';
|
|
4
6
|
export * from './hooks/createHooksInternal';
|
|
5
7
|
export * from './queryClient';
|
|
6
8
|
export * from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,YAAY,EACV,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,YAAY,EACV,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/dist/shared/index.js
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createHooksInternal = require('../createHooksInternal-
|
|
5
|
+
var createHooksInternal = require('../createHooksInternal-860b8183.js');
|
|
6
6
|
var queryClient = require('../queryClient-358a9a75.js');
|
|
7
7
|
require('@trpc/server/shared');
|
|
8
8
|
require('@trpc/client');
|
|
9
9
|
require('@tanstack/react-query');
|
|
10
10
|
require('react');
|
|
11
|
-
require('../getArrayQueryKey-
|
|
11
|
+
require('../getArrayQueryKey-671d083c.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
exports.createHooksInternal = createHooksInternal.createHooksInternal;
|
|
16
16
|
exports.createReactProxyDecoration = createHooksInternal.createReactProxyDecoration;
|
|
17
17
|
exports.createReactQueryUtilsProxy = createHooksInternal.createReactQueryUtilsProxy;
|
|
18
|
+
exports.createUseQueriesProxy = createHooksInternal.createUseQueriesProxy;
|
|
19
|
+
exports.getClientArgs = createHooksInternal.getClientArgs;
|
|
18
20
|
exports.getQueryClient = queryClient.getQueryClient;
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy } from '../createHooksInternal-
|
|
1
|
+
export { c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, d as createUseQueriesProxy, g as getClientArgs } from '../createHooksInternal-10b1b7ef.mjs';
|
|
2
2
|
export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
3
3
|
import '@trpc/server/shared';
|
|
4
4
|
import '@trpc/client';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
6
|
import 'react';
|
|
7
|
-
import '../getArrayQueryKey-
|
|
7
|
+
import '../getArrayQueryKey-30a7f2f6.mjs';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TRPCClient, TRPCClientError } from '@trpc/client';
|
|
2
|
+
import { AnyProcedure, AnyQueryProcedure, AnyRouter, Filter, inferProcedureInput } from '@trpc/server';
|
|
3
|
+
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
4
|
+
import { TrpcQueryOptionsForUseQueries } from '../../internals/useQueries';
|
|
5
|
+
declare type GetQueryOptions<TRouter extends AnyRouter, TProcedure extends AnyProcedure, TPath extends string> = <TData = inferTransformedProcedureOutput<TProcedure>>(input: inferProcedureInput<TProcedure>, opts?: TrpcQueryOptionsForUseQueries<TPath, inferProcedureInput<TProcedure>, inferTransformedProcedureOutput<TProcedure>, TData, TRPCClientError<TRouter>>) => TrpcQueryOptionsForUseQueries<TPath, inferProcedureInput<TProcedure>, inferTransformedProcedureOutput<TProcedure>, TData, TRPCClientError<TRouter>>;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare type UseQueriesProcedureRecord<TRouter extends AnyRouter, TPath extends string = ''> = {
|
|
10
|
+
[TKey in keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]: TRouter['_def']['record'][TKey] extends AnyRouter ? UseQueriesProcedureRecord<TRouter['_def']['record'][TKey], `${TPath}${TKey & string}.`> : GetQueryOptions<TRouter, TRouter['_def']['record'][TKey], `${TPath}${TKey & string}`>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Create proxy for `useQueries` options
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function createUseQueriesProxy<TRouter extends AnyRouter>(client: TRPCClient<TRouter>): UseQueriesProcedureRecord<TRouter, "">;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useQueriesProxy.d.ts.map
|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CAAC,IAAI,CAAC,EAC/B,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,CAC5B,GACD,eAAe,CACb,OAAO,EACP,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAC/B,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,EAAE,CAC3B;CACN,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,SAAS,EAC7D,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,0CAkB5B"}
|
|
@@ -5,39 +5,39 @@ import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
|
5
5
|
import { DecoratedProxyTRPCContextProps, TRPCContextState, TRPCFetchInfiniteQueryOptions, TRPCFetchQueryOptions } from '../../internals/context';
|
|
6
6
|
declare type DecorateProcedure<TRouter extends AnyRouter, TProcedure extends AnyQueryProcedure> = {
|
|
7
7
|
/**
|
|
8
|
-
* @link https://
|
|
8
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchquery
|
|
9
9
|
*/
|
|
10
10
|
fetch(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferProcedureInput<TProcedure>, TRPCClientError<TRouter>, inferTransformedProcedureOutput<TProcedure>>): Promise<inferTransformedProcedureOutput<TProcedure>>;
|
|
11
11
|
/**
|
|
12
|
-
* @link https://
|
|
12
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
13
13
|
*/
|
|
14
14
|
fetchInfinite(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchInfiniteQueryOptions<inferProcedureInput<TProcedure>, TRPCClientError<TRouter>, inferTransformedProcedureOutput<TProcedure>>): Promise<InfiniteData<inferTransformedProcedureOutput<TProcedure>>>;
|
|
15
15
|
/**
|
|
16
|
-
* @link https://
|
|
16
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientprefetchquery
|
|
17
17
|
*/
|
|
18
18
|
prefetch(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferProcedureInput<TProcedure>, TRPCClientError<TRouter>, inferTransformedProcedureOutput<TProcedure>>): Promise<void>;
|
|
19
19
|
/**
|
|
20
|
-
* @link https://
|
|
20
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
21
21
|
*/
|
|
22
22
|
prefetchInfinite(input: inferProcedureInput<TProcedure>, procedureOpts?: ProcedureOptions, opts?: TRPCFetchInfiniteQueryOptions<inferProcedureInput<TProcedure>, TRPCClientError<TRouter>, inferTransformedProcedureOutput<TProcedure>>): Promise<void>;
|
|
23
23
|
/**
|
|
24
|
-
* @link https://
|
|
24
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientinvalidatequeries
|
|
25
25
|
*/
|
|
26
26
|
invalidate(input?: inferProcedureInput<TProcedure>, filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise<void>;
|
|
27
27
|
/**
|
|
28
|
-
* @link https://
|
|
28
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientrefetchqueries
|
|
29
29
|
*/
|
|
30
30
|
refetch(input?: inferProcedureInput<TProcedure>, filters?: RefetchQueryFilters, options?: RefetchOptions): Promise<void>;
|
|
31
31
|
/**
|
|
32
|
-
* @link https://
|
|
32
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientcancelqueries
|
|
33
33
|
*/
|
|
34
34
|
cancel(input?: inferProcedureInput<TProcedure>, options?: CancelOptions): Promise<void>;
|
|
35
35
|
/**
|
|
36
|
-
* @link https://
|
|
36
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientresetqueries
|
|
37
37
|
*/
|
|
38
38
|
reset(input?: inferProcedureInput<TProcedure>, options?: ResetOptions): Promise<void>;
|
|
39
39
|
/**
|
|
40
|
-
* @link https://
|
|
40
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientsetquerydata
|
|
41
41
|
*/
|
|
42
42
|
setData(
|
|
43
43
|
/**
|
|
@@ -45,15 +45,15 @@ declare type DecorateProcedure<TRouter extends AnyRouter, TProcedure extends Any
|
|
|
45
45
|
*/
|
|
46
46
|
input: inferProcedureInput<TProcedure>, updater: Updater<inferTransformedProcedureOutput<TProcedure> | undefined, inferTransformedProcedureOutput<TProcedure> | undefined>, options?: SetDataOptions): void;
|
|
47
47
|
/**
|
|
48
|
-
* @link https://
|
|
48
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientsetquerydata
|
|
49
49
|
*/
|
|
50
50
|
setInfiniteData(input: inferProcedureInput<TProcedure>, updater: Updater<InfiniteData<inferTransformedProcedureOutput<TProcedure>> | undefined, InfiniteData<inferTransformedProcedureOutput<TProcedure>> | undefined>, options?: SetDataOptions): void;
|
|
51
51
|
/**
|
|
52
|
-
* @link https://
|
|
52
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientgetquerydata
|
|
53
53
|
*/
|
|
54
54
|
getData(input?: inferProcedureInput<TProcedure>): inferTransformedProcedureOutput<TProcedure> | undefined;
|
|
55
55
|
/**
|
|
56
|
-
* @link https://
|
|
56
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientgetquerydata
|
|
57
57
|
*/
|
|
58
58
|
getInfiniteData(input?: inferProcedureInput<TProcedure>): InfiniteData<inferTransformedProcedureOutput<TProcedure>> | undefined;
|
|
59
59
|
};
|
package/dist/ssg/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
6
|
var server = require('@trpc/server');
|
|
7
|
-
var getArrayQueryKey = require('../getArrayQueryKey-
|
|
7
|
+
var getArrayQueryKey = require('../getArrayQueryKey-671d083c.js');
|
|
8
8
|
var shared = require('@trpc/server/shared');
|
|
9
9
|
require('@trpc/client');
|
|
10
10
|
require('react');
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dehydrate } from '@tanstack/react-query';
|
|
2
2
|
import { callProcedure } from '@trpc/server';
|
|
3
|
-
import { g as getArrayQueryKey } from '../getArrayQueryKey-
|
|
3
|
+
import { g as getArrayQueryKey } from '../getArrayQueryKey-30a7f2f6.mjs';
|
|
4
4
|
import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared';
|
|
5
5
|
import '@trpc/client';
|
|
6
6
|
import 'react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.0",
|
|
4
4
|
"description": "tRPC React lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@tanstack/react-query": "^4.3.8",
|
|
57
|
-
"@trpc/client": "10.
|
|
58
|
-
"@trpc/server": "10.
|
|
57
|
+
"@trpc/client": "10.6.0",
|
|
58
|
+
"@trpc/server": "10.6.0",
|
|
59
59
|
"react": ">=16.8.0",
|
|
60
60
|
"react-dom": ">=16.8.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@tanstack/react-query": "^4.3.8",
|
|
64
|
-
"@trpc/client": "10.
|
|
65
|
-
"@trpc/server": "10.
|
|
64
|
+
"@trpc/client": "10.6.0",
|
|
65
|
+
"@trpc/server": "10.6.0",
|
|
66
66
|
"@types/express": "^4.17.12",
|
|
67
67
|
"@types/node": "^18.7.20",
|
|
68
68
|
"express": "^4.17.1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "96bf1570091557de433533d4cab5f37cb256de1c"
|
|
80
80
|
}
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
inferTransformedSubscriptionOutput,
|
|
16
16
|
} from '@trpc/server/shared';
|
|
17
17
|
import { useMemo } from 'react';
|
|
18
|
+
import { TRPCUseQueries } from './internals/useQueries';
|
|
18
19
|
import {
|
|
19
20
|
CreateReactUtilsProxy,
|
|
20
21
|
createReactProxyDecoration,
|
|
@@ -177,6 +178,7 @@ export type CreateTRPCReact<TRouter extends AnyRouter, TSSRContext, TFlags> = {
|
|
|
177
178
|
useContext(): CreateReactUtilsProxy<TRouter, TSSRContext>;
|
|
178
179
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
179
180
|
createClient: CreateClient<TRouter>;
|
|
181
|
+
useQueries: TRPCUseQueries<TRouter>;
|
|
180
182
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
181
183
|
} & DecoratedProcedureRecord<TRouter['_def']['record'], TFlags>;
|
|
182
184
|
|
|
@@ -196,7 +198,7 @@ export function createHooksInternalProxy<
|
|
|
196
198
|
const context = trpc.useContext();
|
|
197
199
|
// create a stable reference of the utils context
|
|
198
200
|
return useMemo(() => {
|
|
199
|
-
return (createReactQueryUtilsProxy as any)(context
|
|
201
|
+
return (createReactQueryUtilsProxy as any)(context);
|
|
200
202
|
}, [context]);
|
|
201
203
|
};
|
|
202
204
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { AnyRouter } from '@trpc/server';
|
|
3
|
+
import {
|
|
4
|
+
UseQueriesProcedureRecord,
|
|
5
|
+
UseTRPCQueryOptions,
|
|
6
|
+
UseTRPCQueryResult,
|
|
7
|
+
} from '../shared';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export type UseQueryOptionsForUseQueries<
|
|
13
|
+
TQueryFnData = unknown,
|
|
14
|
+
TError = unknown,
|
|
15
|
+
TData = TQueryFnData,
|
|
16
|
+
TQueryKey extends QueryKey = QueryKey,
|
|
17
|
+
> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'context'>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export type TrpcQueryOptionsForUseQueries<
|
|
23
|
+
TPath,
|
|
24
|
+
TInput,
|
|
25
|
+
TOutput,
|
|
26
|
+
TData,
|
|
27
|
+
TError,
|
|
28
|
+
> = Omit<UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError>, 'context'>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare type QueriesResults<
|
|
34
|
+
TQueriesOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[],
|
|
35
|
+
> = {
|
|
36
|
+
[TKey in keyof TQueriesOptions]: TQueriesOptions[TKey] extends UseQueryOptionsForUseQueries<
|
|
37
|
+
infer TQueryFnData,
|
|
38
|
+
infer TError,
|
|
39
|
+
infer TData,
|
|
40
|
+
any
|
|
41
|
+
>
|
|
42
|
+
? UseTRPCQueryResult<unknown extends TData ? TQueryFnData : TData, TError>
|
|
43
|
+
: never;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type GetOptions<TQueryOptions> =
|
|
47
|
+
TQueryOptions extends UseQueryOptionsForUseQueries<any, any, any, any>
|
|
48
|
+
? TQueryOptions
|
|
49
|
+
: never;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export type QueriesOptions<
|
|
55
|
+
TQueriesOptions extends any[],
|
|
56
|
+
TResult extends any[] = [],
|
|
57
|
+
> = TQueriesOptions extends []
|
|
58
|
+
? []
|
|
59
|
+
: TQueriesOptions extends [infer Head]
|
|
60
|
+
? [...TResult, GetOptions<Head>]
|
|
61
|
+
: TQueriesOptions extends [infer Head, ...infer Tail]
|
|
62
|
+
? QueriesOptions<Tail, [...TResult, GetOptions<Head>]>
|
|
63
|
+
: unknown[] extends TQueriesOptions
|
|
64
|
+
? TQueriesOptions
|
|
65
|
+
: TQueriesOptions extends UseQueryOptionsForUseQueries<
|
|
66
|
+
infer TQueryFnData,
|
|
67
|
+
infer TError,
|
|
68
|
+
infer TData,
|
|
69
|
+
infer TQueryKey
|
|
70
|
+
>[]
|
|
71
|
+
? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData, TQueryKey>[]
|
|
72
|
+
: UseQueryOptionsForUseQueries[];
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export type TRPCUseQueries<TRouter extends AnyRouter> = <
|
|
78
|
+
TQueryOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[],
|
|
79
|
+
>(
|
|
80
|
+
queriesCallback: (
|
|
81
|
+
t: UseQueriesProcedureRecord<TRouter>,
|
|
82
|
+
) => readonly [...QueriesOptions<TQueryOptions>],
|
|
83
|
+
context?: UseQueryOptions['context'],
|
|
84
|
+
) => QueriesResults<TQueryOptions>;
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
InfiniteQueryObserverSuccessResult,
|
|
5
5
|
QueryClient,
|
|
6
6
|
QueryObserverSuccessResult,
|
|
7
|
+
QueryOptions,
|
|
7
8
|
UseInfiniteQueryOptions,
|
|
8
9
|
UseInfiniteQueryResult,
|
|
9
10
|
UseMutationOptions,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
UseQueryResult,
|
|
13
14
|
useInfiniteQuery as __useInfiniteQuery,
|
|
14
15
|
useMutation as __useMutation,
|
|
16
|
+
useQueries as __useQueries,
|
|
15
17
|
useQuery as __useQuery,
|
|
16
18
|
hashQueryKey,
|
|
17
19
|
useQueryClient,
|
|
@@ -49,6 +51,8 @@ import {
|
|
|
49
51
|
TRPCContextState,
|
|
50
52
|
} from '../../internals/context';
|
|
51
53
|
import { QueryType, getArrayQueryKey } from '../../internals/getArrayQueryKey';
|
|
54
|
+
import { TRPCUseQueries } from '../../internals/useQueries';
|
|
55
|
+
import { createUseQueriesProxy } from '../proxy/useQueriesProxy';
|
|
52
56
|
import { CreateTRPCReactOptions, UseMutationOverride } from '../types';
|
|
53
57
|
|
|
54
58
|
export type OutputWithCursor<TData, TCursor = any> = {
|
|
@@ -82,6 +86,10 @@ export interface UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError>
|
|
|
82
86
|
extends UseQueryOptions<TOutput, TError, TData, [TPath, TInput]>,
|
|
83
87
|
TRPCUseQueryBaseOptions {}
|
|
84
88
|
|
|
89
|
+
export interface TRPCQueryOptions<TPath, TInput, TData, TError>
|
|
90
|
+
extends QueryOptions<TData, TError, TData, [TPath, TInput]>,
|
|
91
|
+
TRPCUseQueryBaseOptions {}
|
|
92
|
+
|
|
85
93
|
export interface UseTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError>
|
|
86
94
|
extends UseInfiniteQueryOptions<
|
|
87
95
|
TOutput,
|
|
@@ -107,7 +115,7 @@ export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
|
107
115
|
onError?: (err: TError) => void;
|
|
108
116
|
}
|
|
109
117
|
|
|
110
|
-
function getClientArgs<TPathAndInput extends unknown[], TOptions>(
|
|
118
|
+
export function getClientArgs<TPathAndInput extends unknown[], TOptions>(
|
|
111
119
|
pathAndInput: TPathAndInput,
|
|
112
120
|
opts: TOptions,
|
|
113
121
|
) {
|
|
@@ -654,6 +662,37 @@ export function createHooksInternal<
|
|
|
654
662
|
});
|
|
655
663
|
return hook;
|
|
656
664
|
}
|
|
665
|
+
|
|
666
|
+
const useQueries: TRPCUseQueries<TRouter> = (queriesCallback, context) => {
|
|
667
|
+
const { ssrState, queryClient, prefetchQuery, client } = useContext();
|
|
668
|
+
|
|
669
|
+
const proxy = createUseQueriesProxy(client);
|
|
670
|
+
|
|
671
|
+
const queries = queriesCallback(proxy);
|
|
672
|
+
|
|
673
|
+
if (typeof window === 'undefined' && ssrState === 'prepass') {
|
|
674
|
+
for (const query of queries) {
|
|
675
|
+
const queryOption = query as TRPCQueryOptions<any, any, any, any>;
|
|
676
|
+
if (
|
|
677
|
+
queryOption.trpc?.ssr !== false &&
|
|
678
|
+
!queryClient
|
|
679
|
+
.getQueryCache()
|
|
680
|
+
.find(getArrayQueryKey(queryOption.queryKey!, 'query'))
|
|
681
|
+
) {
|
|
682
|
+
void prefetchQuery(queryOption.queryKey as any, queryOption as any);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
return __useQueries({
|
|
688
|
+
queries: queries.map((query) => ({
|
|
689
|
+
...query,
|
|
690
|
+
queryKey: getArrayQueryKey(query.queryKey, 'query'),
|
|
691
|
+
})),
|
|
692
|
+
context,
|
|
693
|
+
}) as any;
|
|
694
|
+
};
|
|
695
|
+
|
|
657
696
|
const useDehydratedState: UseDehydratedState<TRouter> = (
|
|
658
697
|
client,
|
|
659
698
|
trpcState,
|
|
@@ -673,6 +712,7 @@ export function createHooksInternal<
|
|
|
673
712
|
createClient,
|
|
674
713
|
useContext,
|
|
675
714
|
useQuery,
|
|
715
|
+
useQueries,
|
|
676
716
|
useMutation,
|
|
677
717
|
useSubscription,
|
|
678
718
|
useDehydratedState,
|
package/src/shared/index.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './proxy/decorationProxy';
|
|
2
2
|
export * from './proxy/utilsProxy';
|
|
3
|
+
export * from './proxy/useQueriesProxy';
|
|
3
4
|
export type {
|
|
4
5
|
DecoratedProcedureRecord,
|
|
5
6
|
DecorateProcedure,
|
|
6
7
|
} from '../createTRPCReact';
|
|
8
|
+
export type { TRPCUseQueries } from '../internals/useQueries';
|
|
7
9
|
export * from './hooks/createHooksInternal';
|
|
8
10
|
export * from './queryClient';
|
|
9
11
|
export * from './types';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { QueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { TRPCClient, TRPCClientError } from '@trpc/client';
|
|
3
|
+
import {
|
|
4
|
+
AnyProcedure,
|
|
5
|
+
AnyQueryProcedure,
|
|
6
|
+
AnyRouter,
|
|
7
|
+
Filter,
|
|
8
|
+
inferProcedureInput,
|
|
9
|
+
} from '@trpc/server';
|
|
10
|
+
import {
|
|
11
|
+
createRecursiveProxy,
|
|
12
|
+
inferTransformedProcedureOutput,
|
|
13
|
+
} from '@trpc/server/shared';
|
|
14
|
+
import { getQueryKey } from '../../internals/getQueryKey';
|
|
15
|
+
import { TrpcQueryOptionsForUseQueries } from '../../internals/useQueries';
|
|
16
|
+
|
|
17
|
+
type GetQueryOptions<
|
|
18
|
+
TRouter extends AnyRouter,
|
|
19
|
+
TProcedure extends AnyProcedure,
|
|
20
|
+
TPath extends string,
|
|
21
|
+
> = <TData = inferTransformedProcedureOutput<TProcedure>>(
|
|
22
|
+
input: inferProcedureInput<TProcedure>,
|
|
23
|
+
opts?: TrpcQueryOptionsForUseQueries<
|
|
24
|
+
TPath,
|
|
25
|
+
inferProcedureInput<TProcedure>,
|
|
26
|
+
inferTransformedProcedureOutput<TProcedure>,
|
|
27
|
+
TData,
|
|
28
|
+
TRPCClientError<TRouter>
|
|
29
|
+
>,
|
|
30
|
+
) => TrpcQueryOptionsForUseQueries<
|
|
31
|
+
TPath,
|
|
32
|
+
inferProcedureInput<TProcedure>,
|
|
33
|
+
inferTransformedProcedureOutput<TProcedure>,
|
|
34
|
+
TData,
|
|
35
|
+
TRPCClientError<TRouter>
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export type UseQueriesProcedureRecord<
|
|
42
|
+
TRouter extends AnyRouter,
|
|
43
|
+
TPath extends string = '',
|
|
44
|
+
> = {
|
|
45
|
+
[TKey in keyof Filter<
|
|
46
|
+
TRouter['_def']['record'],
|
|
47
|
+
AnyRouter | AnyQueryProcedure
|
|
48
|
+
>]: TRouter['_def']['record'][TKey] extends AnyRouter
|
|
49
|
+
? UseQueriesProcedureRecord<
|
|
50
|
+
TRouter['_def']['record'][TKey],
|
|
51
|
+
`${TPath}${TKey & string}.`
|
|
52
|
+
>
|
|
53
|
+
: GetQueryOptions<
|
|
54
|
+
TRouter,
|
|
55
|
+
TRouter['_def']['record'][TKey],
|
|
56
|
+
`${TPath}${TKey & string}`
|
|
57
|
+
>;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create proxy for `useQueries` options
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export function createUseQueriesProxy<TRouter extends AnyRouter>(
|
|
65
|
+
client: TRPCClient<TRouter>,
|
|
66
|
+
) {
|
|
67
|
+
return createRecursiveProxy((opts) => {
|
|
68
|
+
const path = opts.path.join('.');
|
|
69
|
+
const [input, ...rest] = opts.args;
|
|
70
|
+
|
|
71
|
+
const queryKey = getQueryKey(path, input);
|
|
72
|
+
|
|
73
|
+
const options: QueryOptions = {
|
|
74
|
+
queryKey,
|
|
75
|
+
queryFn: () => {
|
|
76
|
+
return client.query(path, input);
|
|
77
|
+
},
|
|
78
|
+
...(rest[1] as any),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return options;
|
|
82
|
+
}) as UseQueriesProcedureRecord<TRouter>;
|
|
83
|
+
}
|
|
@@ -36,7 +36,7 @@ type DecorateProcedure<
|
|
|
36
36
|
TProcedure extends AnyQueryProcedure,
|
|
37
37
|
> = {
|
|
38
38
|
/**
|
|
39
|
-
* @link https://
|
|
39
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchquery
|
|
40
40
|
*/
|
|
41
41
|
fetch(
|
|
42
42
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -48,7 +48,7 @@ type DecorateProcedure<
|
|
|
48
48
|
): Promise<inferTransformedProcedureOutput<TProcedure>>;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* @link https://
|
|
51
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
52
52
|
*/
|
|
53
53
|
fetchInfinite(
|
|
54
54
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -60,7 +60,7 @@ type DecorateProcedure<
|
|
|
60
60
|
): Promise<InfiniteData<inferTransformedProcedureOutput<TProcedure>>>;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* @link https://
|
|
63
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientprefetchquery
|
|
64
64
|
*/
|
|
65
65
|
prefetch(
|
|
66
66
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -72,7 +72,7 @@ type DecorateProcedure<
|
|
|
72
72
|
): Promise<void>;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* @link https://
|
|
75
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
76
76
|
*/
|
|
77
77
|
prefetchInfinite(
|
|
78
78
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -85,7 +85,7 @@ type DecorateProcedure<
|
|
|
85
85
|
): Promise<void>;
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* @link https://
|
|
88
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientinvalidatequeries
|
|
89
89
|
*/
|
|
90
90
|
invalidate(
|
|
91
91
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -94,7 +94,7 @@ type DecorateProcedure<
|
|
|
94
94
|
): Promise<void>;
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* @link https://
|
|
97
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientrefetchqueries
|
|
98
98
|
*/
|
|
99
99
|
refetch(
|
|
100
100
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -103,7 +103,7 @@ type DecorateProcedure<
|
|
|
103
103
|
): Promise<void>;
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* @link https://
|
|
106
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientcancelqueries
|
|
107
107
|
*/
|
|
108
108
|
cancel(
|
|
109
109
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -111,7 +111,7 @@ type DecorateProcedure<
|
|
|
111
111
|
): Promise<void>;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
* @link https://
|
|
114
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientresetqueries
|
|
115
115
|
*/
|
|
116
116
|
reset(
|
|
117
117
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -119,7 +119,7 @@ type DecorateProcedure<
|
|
|
119
119
|
): Promise<void>;
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* @link https://
|
|
122
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientsetquerydata
|
|
123
123
|
*/
|
|
124
124
|
setData(
|
|
125
125
|
/**
|
|
@@ -134,7 +134,7 @@ type DecorateProcedure<
|
|
|
134
134
|
): void;
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
|
-
* @link https://
|
|
137
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientsetquerydata
|
|
138
138
|
*/
|
|
139
139
|
setInfiniteData(
|
|
140
140
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -146,14 +146,14 @@ type DecorateProcedure<
|
|
|
146
146
|
): void;
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* @link https://
|
|
149
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientgetquerydata
|
|
150
150
|
*/
|
|
151
151
|
getData(
|
|
152
152
|
input?: inferProcedureInput<TProcedure>,
|
|
153
153
|
): inferTransformedProcedureOutput<TProcedure> | undefined;
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* @link https://
|
|
156
|
+
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientgetquerydata
|
|
157
157
|
*/
|
|
158
158
|
getInfiniteData(
|
|
159
159
|
input?: inferProcedureInput<TProcedure>,
|