@trpc/react-query 10.6.0 → 10.8.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/{createHooksInternal-10b1b7ef.mjs → createHooksInternal-9c1f8ad9.mjs} +25 -11
- package/dist/{createHooksInternal-860b8183.js → createHooksInternal-d8e5577b.js} +26 -9
- package/dist/createTRPCReact.d.ts +30 -9
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/{getArrayQueryKey-671d083c.js → getArrayQueryKey-4bdb5cc2.js} +6 -1
- package/dist/{getArrayQueryKey-30a7f2f6.mjs → getArrayQueryKey-86134f8b.mjs} +6 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/internals/context.d.ts +35 -23
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/internals/getArrayQueryKey.d.ts +9 -5
- package/dist/internals/getArrayQueryKey.d.ts.map +1 -1
- package/dist/internals/getClientArgs.d.ts +2 -0
- package/dist/internals/getClientArgs.d.ts.map +1 -0
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/useHookResult.d.ts +10 -0
- package/dist/internals/useHookResult.d.ts.map +1 -0
- package/dist/shared/hooks/createHooksInternal.d.ts +19 -116
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/deprecated/createHooksInternal.d.ts +61 -0
- package/dist/shared/hooks/deprecated/createHooksInternal.d.ts.map +1 -0
- package/dist/shared/hooks/types.d.ts +78 -0
- package/dist/shared/hooks/types.d.ts.map +1 -0
- package/dist/shared/index.d.ts +12 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +5 -2
- package/dist/shared/index.mjs +2 -2
- package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
- package/dist/shared/proxy/utilsProxy.d.ts +6 -5
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/dist/ssg/index.js +1 -1
- package/dist/ssg/index.mjs +1 -1
- package/dist/ssg/ssgProxy.d.ts +3 -3
- package/dist/ssg/ssgProxy.d.ts.map +1 -1
- package/dist/utils/inferReactQueryProcedure.d.ts +1 -1
- package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/createTRPCReact.tsx +79 -24
- package/src/internals/context.tsx +53 -52
- package/src/internals/getArrayQueryKey.test.ts +11 -0
- package/src/internals/getArrayQueryKey.ts +11 -2
- package/src/internals/getClientArgs.ts +7 -0
- package/src/internals/getQueryKey.ts +2 -1
- package/src/internals/useHookResult.ts +18 -0
- package/src/shared/hooks/createHooksInternal.tsx +71 -309
- package/src/shared/hooks/deprecated/createHooksInternal.tsx +628 -0
- package/src/shared/hooks/types.ts +151 -0
- package/src/shared/index.ts +17 -0
- package/src/shared/proxy/decorationProxy.ts +7 -0
- package/src/shared/proxy/utilsProxy.ts +7 -3
- package/src/ssg/ssgProxy.ts +8 -4
- package/src/utils/inferReactQueryProcedure.ts +1 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { createRecursiveProxy, createFlatProxy } from '@trpc/server/shared';
|
|
2
|
+
import { g as getArrayQueryKey } from './getArrayQueryKey-86134f8b.mjs';
|
|
2
3
|
import { createTRPCClientProxy, createTRPCClient } from '@trpc/client';
|
|
3
4
|
import { useQuery, useQueryClient, useMutation, hashQueryKey, useInfiniteQuery, useQueries } from '@tanstack/react-query';
|
|
4
|
-
import React, { createContext, useState, useEffect, useCallback, useMemo
|
|
5
|
-
import { g as getArrayQueryKey } from './getArrayQueryKey-30a7f2f6.mjs';
|
|
5
|
+
import React, { createContext, useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* We treat `undefined` as an input the same as omitting an `input`
|
|
9
9
|
* https://github.com/trpc/trpc/issues/2290
|
|
10
10
|
*/ function getQueryKey(path, input) {
|
|
11
|
-
return input === undefined ? [
|
|
11
|
+
if (path.length) return input === undefined ? [
|
|
12
12
|
path
|
|
13
13
|
] : [
|
|
14
14
|
path,
|
|
15
15
|
input
|
|
16
16
|
];
|
|
17
|
+
return [];
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -36,6 +37,10 @@ import { g as getArrayQueryKey } from './getArrayQueryKey-30a7f2f6.mjs';
|
|
|
36
37
|
}
|
|
37
38
|
const [input, ...rest] = args;
|
|
38
39
|
const queryKey = getQueryKey(path, input);
|
|
40
|
+
// Expose queryKey helper
|
|
41
|
+
if (lastArg === 'getQueryKey') {
|
|
42
|
+
return getArrayQueryKey(queryKey, rest[0] ?? 'any');
|
|
43
|
+
}
|
|
39
44
|
if (lastArg.startsWith('useSuspense')) {
|
|
40
45
|
const opts1 = rest[0] || {};
|
|
41
46
|
const fn = lastArg === 'useSuspenseQuery' ? 'useQuery' : 'useInfiniteQuery';
|
|
@@ -146,6 +151,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
146
151
|
opts?.trpc
|
|
147
152
|
];
|
|
148
153
|
}
|
|
154
|
+
|
|
149
155
|
/**
|
|
150
156
|
* Makes a stable reference of the `trpc` prop
|
|
151
157
|
*/ function useHookResult(value) {
|
|
@@ -153,10 +159,18 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
153
159
|
ref.current.path = value.path;
|
|
154
160
|
return ref.current;
|
|
155
161
|
}
|
|
162
|
+
|
|
156
163
|
/**
|
|
157
164
|
* Create strongly typed react hooks
|
|
158
165
|
* @internal
|
|
166
|
+
* @deprecated
|
|
159
167
|
*/ function createHooksInternal(config) {
|
|
168
|
+
return createRootHooks(config);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @internal
|
|
173
|
+
*/ function createRootHooks(config) {
|
|
160
174
|
const mutationSuccessOverride = config?.unstable_overrides?.useMutation?.onSuccess ?? ((options)=>options.originalFn());
|
|
161
175
|
const Context = config?.context ?? TRPCContext;
|
|
162
176
|
const ReactQueryContext = config?.reactQueryContext;
|
|
@@ -285,7 +299,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
285
299
|
...opts
|
|
286
300
|
} : opts;
|
|
287
301
|
}
|
|
288
|
-
function useQuery$1(
|
|
302
|
+
function useQuery$1(// FIXME path should be a tuple in next major
|
|
303
|
+
pathAndInput, opts) {
|
|
289
304
|
const { abortOnUnmount , client , ssrState , queryClient , prefetchQuery } = useContext();
|
|
290
305
|
if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && opts?.enabled !== false && !queryClient.getQueryCache().find(getArrayQueryKey(pathAndInput, 'query'))) {
|
|
291
306
|
void prefetchQuery(pathAndInput, opts);
|
|
@@ -313,7 +328,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
313
328
|
});
|
|
314
329
|
return hook;
|
|
315
330
|
}
|
|
316
|
-
function useMutation$1(path
|
|
331
|
+
function useMutation$1(// FIXME: this should only be a tuple path in next major
|
|
332
|
+
path, opts) {
|
|
317
333
|
const { client } = useContext();
|
|
318
334
|
const queryClient = useQueryClient({
|
|
319
335
|
context: ReactQueryContext
|
|
@@ -341,11 +357,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
341
357
|
});
|
|
342
358
|
return hook;
|
|
343
359
|
}
|
|
344
|
-
/* istanbul ignore next */
|
|
345
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
|
346
|
-
* **Experimental.** API might change without major version bump
|
|
347
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠
|
|
348
|
-
*/ function useSubscription(pathAndInput, opts) {
|
|
360
|
+
/* istanbul ignore next */ function useSubscription(pathAndInput, opts) {
|
|
349
361
|
const enabled = opts?.enabled ?? true;
|
|
350
362
|
const queryKey = hashQueryKey(pathAndInput);
|
|
351
363
|
const { client } = useContext();
|
|
@@ -363,6 +375,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
363
375
|
},
|
|
364
376
|
onData: (data)=>{
|
|
365
377
|
if (!isStopped) {
|
|
378
|
+
// FIXME this shouldn't be needed as both should be `unknown` in next major
|
|
366
379
|
opts.onData(data);
|
|
367
380
|
}
|
|
368
381
|
},
|
|
@@ -405,6 +418,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
405
418
|
...input ?? {},
|
|
406
419
|
cursor: queryFunctionContext.pageParam
|
|
407
420
|
};
|
|
421
|
+
// FIXME as any shouldn't be needed as client should be untyped too
|
|
408
422
|
return client.query(...getClientArgs([
|
|
409
423
|
path,
|
|
410
424
|
actualInput
|
|
@@ -463,4 +477,4 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
463
477
|
};
|
|
464
478
|
}
|
|
465
479
|
|
|
466
|
-
export { createReactQueryUtilsProxy as a, createReactProxyDecoration as b, createHooksInternal as c, createUseQueriesProxy as d, getClientArgs as g };
|
|
480
|
+
export { TRPCContext as T, createReactQueryUtilsProxy as a, createReactProxyDecoration as b, createHooksInternal as c, createUseQueriesProxy as d, createRootHooks as e, contextProps as f, getClientArgs as g };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var shared = require('@trpc/server/shared');
|
|
4
|
+
var getArrayQueryKey = require('./getArrayQueryKey-4bdb5cc2.js');
|
|
4
5
|
var client = require('@trpc/client');
|
|
5
6
|
var reactQuery = require('@tanstack/react-query');
|
|
6
7
|
var React = require('react');
|
|
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
|
|
|
@@ -14,12 +14,13 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
14
|
* We treat `undefined` as an input the same as omitting an `input`
|
|
15
15
|
* https://github.com/trpc/trpc/issues/2290
|
|
16
16
|
*/ function getQueryKey(path, input) {
|
|
17
|
-
return input === undefined ? [
|
|
17
|
+
if (path.length) return input === undefined ? [
|
|
18
18
|
path
|
|
19
19
|
] : [
|
|
20
20
|
path,
|
|
21
21
|
input
|
|
22
22
|
];
|
|
23
|
+
return [];
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -42,6 +43,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
42
43
|
}
|
|
43
44
|
const [input, ...rest] = args;
|
|
44
45
|
const queryKey = getQueryKey(path, input);
|
|
46
|
+
// Expose queryKey helper
|
|
47
|
+
if (lastArg === 'getQueryKey') {
|
|
48
|
+
return getArrayQueryKey.getArrayQueryKey(queryKey, rest[0] ?? 'any');
|
|
49
|
+
}
|
|
45
50
|
if (lastArg.startsWith('useSuspense')) {
|
|
46
51
|
const opts1 = rest[0] || {};
|
|
47
52
|
const fn = lastArg === 'useSuspenseQuery' ? 'useQuery' : 'useInfiniteQuery';
|
|
@@ -152,6 +157,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
152
157
|
opts?.trpc
|
|
153
158
|
];
|
|
154
159
|
}
|
|
160
|
+
|
|
155
161
|
/**
|
|
156
162
|
* Makes a stable reference of the `trpc` prop
|
|
157
163
|
*/ function useHookResult(value) {
|
|
@@ -159,10 +165,18 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
159
165
|
ref.current.path = value.path;
|
|
160
166
|
return ref.current;
|
|
161
167
|
}
|
|
168
|
+
|
|
162
169
|
/**
|
|
163
170
|
* Create strongly typed react hooks
|
|
164
171
|
* @internal
|
|
172
|
+
* @deprecated
|
|
165
173
|
*/ function createHooksInternal(config) {
|
|
174
|
+
return createRootHooks(config);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @internal
|
|
179
|
+
*/ function createRootHooks(config) {
|
|
166
180
|
const mutationSuccessOverride = config?.unstable_overrides?.useMutation?.onSuccess ?? ((options)=>options.originalFn());
|
|
167
181
|
const Context = config?.context ?? TRPCContext;
|
|
168
182
|
const ReactQueryContext = config?.reactQueryContext;
|
|
@@ -291,7 +305,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
291
305
|
...opts
|
|
292
306
|
} : opts;
|
|
293
307
|
}
|
|
294
|
-
function useQuery(
|
|
308
|
+
function useQuery(// FIXME path should be a tuple in next major
|
|
309
|
+
pathAndInput, opts) {
|
|
295
310
|
const { abortOnUnmount , client , ssrState , queryClient , prefetchQuery } = useContext();
|
|
296
311
|
if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && opts?.enabled !== false && !queryClient.getQueryCache().find(getArrayQueryKey.getArrayQueryKey(pathAndInput, 'query'))) {
|
|
297
312
|
void prefetchQuery(pathAndInput, opts);
|
|
@@ -319,7 +334,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
319
334
|
});
|
|
320
335
|
return hook;
|
|
321
336
|
}
|
|
322
|
-
function useMutation(path
|
|
337
|
+
function useMutation(// FIXME: this should only be a tuple path in next major
|
|
338
|
+
path, opts) {
|
|
323
339
|
const { client } = useContext();
|
|
324
340
|
const queryClient = reactQuery.useQueryClient({
|
|
325
341
|
context: ReactQueryContext
|
|
@@ -347,11 +363,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
347
363
|
});
|
|
348
364
|
return hook;
|
|
349
365
|
}
|
|
350
|
-
/* istanbul ignore next */
|
|
351
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
|
352
|
-
* **Experimental.** API might change without major version bump
|
|
353
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠
|
|
354
|
-
*/ function useSubscription(pathAndInput, opts) {
|
|
366
|
+
/* istanbul ignore next */ function useSubscription(pathAndInput, opts) {
|
|
355
367
|
const enabled = opts?.enabled ?? true;
|
|
356
368
|
const queryKey = reactQuery.hashQueryKey(pathAndInput);
|
|
357
369
|
const { client } = useContext();
|
|
@@ -369,6 +381,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
369
381
|
},
|
|
370
382
|
onData: (data)=>{
|
|
371
383
|
if (!isStopped) {
|
|
384
|
+
// FIXME this shouldn't be needed as both should be `unknown` in next major
|
|
372
385
|
opts.onData(data);
|
|
373
386
|
}
|
|
374
387
|
},
|
|
@@ -411,6 +424,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
411
424
|
...input ?? {},
|
|
412
425
|
cursor: queryFunctionContext.pageParam
|
|
413
426
|
};
|
|
427
|
+
// FIXME as any shouldn't be needed as client should be untyped too
|
|
414
428
|
return client.query(...getClientArgs([
|
|
415
429
|
path,
|
|
416
430
|
actualInput
|
|
@@ -469,8 +483,11 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
469
483
|
};
|
|
470
484
|
}
|
|
471
485
|
|
|
486
|
+
exports.TRPCContext = TRPCContext;
|
|
487
|
+
exports.contextProps = contextProps;
|
|
472
488
|
exports.createHooksInternal = createHooksInternal;
|
|
473
489
|
exports.createReactProxyDecoration = createReactProxyDecoration;
|
|
474
490
|
exports.createReactQueryUtilsProxy = createReactQueryUtilsProxy;
|
|
491
|
+
exports.createRootHooks = createRootHooks;
|
|
475
492
|
exports.createUseQueriesProxy = createUseQueriesProxy;
|
|
476
493
|
exports.getClientArgs = getClientArgs;
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import { InfiniteData } from '@tanstack/react-query';
|
|
2
2
|
import { TRPCClientErrorLike } from '@trpc/client';
|
|
3
|
-
import { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRouter, AnySubscriptionProcedure, ProcedureRouterRecord, inferProcedureInput } from '@trpc/server';
|
|
3
|
+
import { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnyRouter, AnySubscriptionProcedure, ProcedureRouterRecord, ProtectedIntersection, inferProcedureInput } from '@trpc/server';
|
|
4
4
|
import { inferTransformedProcedureOutput, inferTransformedSubscriptionOutput } from '@trpc/server/shared';
|
|
5
|
+
import { QueryKey, QueryType } from './internals/getArrayQueryKey';
|
|
5
6
|
import { TRPCUseQueries } from './internals/useQueries';
|
|
6
7
|
import { CreateReactUtilsProxy } from './shared';
|
|
7
|
-
import {
|
|
8
|
+
import { CreateReactQueryHooks } from './shared/hooks/createHooksInternal';
|
|
9
|
+
import { CreateClient, DefinedUseTRPCQueryOptions, DefinedUseTRPCQueryResult, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCInfiniteQuerySuccessResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCQuerySuccessResult, UseTRPCSubscriptionOptions } from './shared/hooks/types';
|
|
8
10
|
import { CreateTRPCReactOptions } from './shared/types';
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export interface ProcedureUseQuery<TProcedure extends AnyProcedure, TPath extends string> {
|
|
15
|
+
<TQueryFnData = inferTransformedProcedureOutput<TProcedure>, TData = inferTransformedProcedureOutput<TProcedure>>(input: inferProcedureInput<TProcedure>, opts: DefinedUseTRPCQueryOptions<TPath, inferProcedureInput<TProcedure>, TQueryFnData, TData, TRPCClientErrorLike<TProcedure>>): DefinedUseTRPCQueryResult<TData, TRPCClientErrorLike<TProcedure>>;
|
|
16
|
+
<TQueryFnData = inferTransformedProcedureOutput<TProcedure>, TData = inferTransformedProcedureOutput<TProcedure>>(input: inferProcedureInput<TProcedure>, opts?: UseTRPCQueryOptions<TPath, inferProcedureInput<TProcedure>, TQueryFnData, TData, TRPCClientErrorLike<TProcedure>>): UseTRPCQueryResult<TData, TRPCClientErrorLike<TProcedure>>;
|
|
17
|
+
}
|
|
9
18
|
/**
|
|
10
19
|
* @internal
|
|
11
20
|
*/
|
|
12
21
|
export declare type DecorateProcedure<TProcedure extends AnyProcedure, TFlags, TPath extends string> = TProcedure extends AnyQueryProcedure ? {
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Method to extract the query key for a procedure
|
|
24
|
+
* @param type - defaults to `any`
|
|
25
|
+
* @link https://trpc.io/docs/useContext#-the-function-i-want-isnt-here
|
|
26
|
+
*/
|
|
27
|
+
getQueryKey: (input: inferProcedureInput<TProcedure>, type?: QueryType) => QueryKey;
|
|
28
|
+
useQuery: ProcedureUseQuery<TProcedure, TPath>;
|
|
14
29
|
} & (inferProcedureInput<TProcedure> extends {
|
|
15
30
|
cursor?: any;
|
|
16
31
|
} ? {
|
|
@@ -20,12 +35,12 @@ export declare type DecorateProcedure<TProcedure extends AnyProcedure, TFlags, T
|
|
|
20
35
|
InfiniteData<TData>,
|
|
21
36
|
UseTRPCInfiniteQuerySuccessResult<TData, TRPCClientErrorLike<TProcedure>>
|
|
22
37
|
];
|
|
23
|
-
} :
|
|
38
|
+
} : object) : object) & (TFlags extends 'ExperimentalSuspense' ? {
|
|
24
39
|
useSuspenseQuery: <TQueryFnData = inferTransformedProcedureOutput<TProcedure>, TData = inferTransformedProcedureOutput<TProcedure>>(input: inferProcedureInput<TProcedure>, opts?: Omit<UseTRPCQueryOptions<TPath, inferProcedureInput<TProcedure>, TQueryFnData, TData, TRPCClientErrorLike<TProcedure>>, 'enabled' | 'suspense'>) => [
|
|
25
40
|
TData,
|
|
26
41
|
UseTRPCQuerySuccessResult<TData, TRPCClientErrorLike<TProcedure>>
|
|
27
42
|
];
|
|
28
|
-
} :
|
|
43
|
+
} : object) : TProcedure extends AnyMutationProcedure ? {
|
|
29
44
|
useMutation: <TContext = unknown>(opts?: UseTRPCMutationOptions<inferProcedureInput<TProcedure>, TRPCClientErrorLike<TProcedure>, inferTransformedProcedureOutput<TProcedure>, TContext>) => UseTRPCMutationResult<inferTransformedProcedureOutput<TProcedure>, TRPCClientErrorLike<TProcedure>, inferProcedureInput<TProcedure>, TContext>;
|
|
30
45
|
} : TProcedure extends AnySubscriptionProcedure ? {
|
|
31
46
|
useSubscription: (input: inferProcedureInput<TProcedure>, opts?: UseTRPCSubscriptionOptions<inferTransformedSubscriptionOutput<TProcedure>, TRPCClientErrorLike<TProcedure>>) => void;
|
|
@@ -34,18 +49,24 @@ export declare type DecorateProcedure<TProcedure extends AnyProcedure, TFlags, T
|
|
|
34
49
|
* @internal
|
|
35
50
|
*/
|
|
36
51
|
export declare type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord, TFlags, TPath extends string = ''> = {
|
|
37
|
-
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ?
|
|
52
|
+
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ? {
|
|
53
|
+
getQueryKey: () => QueryKey;
|
|
54
|
+
} & DecoratedProcedureRecord<TProcedures[TKey]['_def']['record'], TFlags, `${TPath}${TKey & string}.`> : TProcedures[TKey] extends AnyProcedure ? DecorateProcedure<TProcedures[TKey], TFlags, `${TPath}${TKey & string}`> : never;
|
|
38
55
|
};
|
|
39
|
-
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
40
60
|
useContext(): CreateReactUtilsProxy<TRouter, TSSRContext>;
|
|
41
61
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
42
62
|
createClient: CreateClient<TRouter>;
|
|
43
63
|
useQueries: TRPCUseQueries<TRouter>;
|
|
44
64
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
45
|
-
}
|
|
65
|
+
};
|
|
66
|
+
export declare type CreateTRPCReact<TRouter extends AnyRouter, TSSRContext, TFlags> = ProtectedIntersection<CreateTRPCReactBase<TRouter, TSSRContext>, DecoratedProcedureRecord<TRouter['_def']['record'], TFlags>>;
|
|
46
67
|
/**
|
|
47
68
|
* @internal
|
|
48
69
|
*/
|
|
49
|
-
export declare function createHooksInternalProxy<TRouter extends AnyRouter, TSSRContext = unknown, TFlags = null>(trpc: CreateReactQueryHooks<TRouter, TSSRContext>):
|
|
70
|
+
export declare function createHooksInternalProxy<TRouter extends AnyRouter, TSSRContext = unknown, TFlags = null>(trpc: CreateReactQueryHooks<TRouter, TSSRContext>): ProtectedIntersection<CreateTRPCReactBase<TRouter, TSSRContext>, DecoratedProcedureRecord<TRouter["_def"]["record"], TFlags, "">>;
|
|
50
71
|
export declare function createTRPCReact<TRouter extends AnyRouter, TSSRContext = unknown, TFlags = null>(opts?: CreateTRPCReactOptions<TRouter>): CreateTRPCReact<TRouter, TSSRContext, TFlags>;
|
|
51
72
|
//# sourceMappingURL=createTRPCReact.d.ts.map
|
|
@@ -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,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,
|
|
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,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,+BAA+B,EAC/B,kCAAkC,EACnC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,qBAAqB,EAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,0BAA0B,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C,GACrC,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAK/C"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* storing in tanstack query. This function converts from the `.` separated
|
|
7
7
|
* path passed around internally by both the legacy and proxy implementation.
|
|
8
8
|
* https://github.com/trpc/trpc/issues/2611
|
|
9
|
-
|
|
9
|
+
**/ function getArrayQueryKey(queryKey, type) {
|
|
10
10
|
const queryKeyArrayed = Array.isArray(queryKey) ? queryKey : [
|
|
11
11
|
queryKey
|
|
12
12
|
];
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
// Construct a query key that is easy to destructure and flexible for
|
|
16
16
|
// partial selecting etc.
|
|
17
17
|
// https://github.com/trpc/trpc/issues/3128
|
|
18
|
+
if (!input && (!type || type === 'any')) // for `utils.invalidate()` to match all queries (including vanilla react-query)
|
|
19
|
+
// we don't want nested array if path is empty, i.e. `[]` instead of `[[]]`
|
|
20
|
+
return arrayPath.length ? [
|
|
21
|
+
arrayPath
|
|
22
|
+
] : [];
|
|
18
23
|
return [
|
|
19
24
|
arrayPath,
|
|
20
25
|
{
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* storing in tanstack query. This function converts from the `.` separated
|
|
5
5
|
* path passed around internally by both the legacy and proxy implementation.
|
|
6
6
|
* https://github.com/trpc/trpc/issues/2611
|
|
7
|
-
|
|
7
|
+
**/ function getArrayQueryKey(queryKey, type) {
|
|
8
8
|
const queryKeyArrayed = Array.isArray(queryKey) ? queryKey : [
|
|
9
9
|
queryKey
|
|
10
10
|
];
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
// Construct a query key that is easy to destructure and flexible for
|
|
14
14
|
// partial selecting etc.
|
|
15
15
|
// https://github.com/trpc/trpc/issues/3128
|
|
16
|
+
if (!input && (!type || type === 'any')) // for `utils.invalidate()` to match all queries (including vanilla react-query)
|
|
17
|
+
// we don't want nested array if path is empty, i.e. `[]` instead of `[[]]`
|
|
18
|
+
return arrayPath.length ? [
|
|
19
|
+
arrayPath
|
|
20
|
+
] : [];
|
|
16
21
|
return [
|
|
17
22
|
arrayPath,
|
|
18
23
|
{
|
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-d8e5577b.js');
|
|
9
9
|
require('@tanstack/react-query');
|
|
10
|
-
require('./getArrayQueryKey-
|
|
10
|
+
require('./getArrayQueryKey-4bdb5cc2.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-9c1f8ad9.mjs';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
|
-
import './getArrayQueryKey-
|
|
6
|
+
import './getArrayQueryKey-86134f8b.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { FetchInfiniteQueryOptions, FetchQueryOptions, QueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { CancelOptions, InfiniteData, InvalidateOptions, InvalidateQueryFilters, RefetchOptions, RefetchQueryFilters, ResetOptions, ResetQueryFilters, SetDataOptions, Updater } from '@tanstack/react-query';
|
|
4
|
+
import { TRPCClient, TRPCRequestOptions, inferRouterProxyClient } from '@trpc/client';
|
|
5
|
+
import { TRPCClientError } from '@trpc/client';
|
|
6
|
+
import type { AnyRouter } from '@trpc/server';
|
|
7
|
+
import { inferHandlerInput, inferProcedureInput } from '@trpc/server';
|
|
8
|
+
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
6
9
|
export interface TRPCFetchQueryOptions<TInput, TError, TOutput> extends FetchQueryOptions<TInput, TError, TOutput>, TRPCRequestOptions {
|
|
7
10
|
}
|
|
8
11
|
export interface TRPCFetchInfiniteQueryOptions<TInput, TError, TOutput> extends FetchInfiniteQueryOptions<TInput, TError, TOutput>, TRPCRequestOptions {
|
|
@@ -34,6 +37,9 @@ export interface ProxyTRPCContextProps<TRouter extends AnyRouter, TSSRContext> {
|
|
|
34
37
|
*/
|
|
35
38
|
abortOnUnmount?: boolean;
|
|
36
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
37
43
|
export declare type DecoratedProxyTRPCContextProps<TRouter extends AnyRouter, TSSRContext> = ProxyTRPCContextProps<TRouter, TSSRContext> & {
|
|
38
44
|
client: inferRouterProxyClient<TRouter>;
|
|
39
45
|
};
|
|
@@ -45,39 +51,44 @@ export interface TRPCContextProps<TRouter extends AnyRouter, TSSRContext> extend
|
|
|
45
51
|
}
|
|
46
52
|
export declare const contextProps: (keyof ProxyTRPCContextProps<any, any>)[];
|
|
47
53
|
/** @internal */
|
|
54
|
+
declare type TRPCContextResetQueries<TRouter extends AnyRouter> =
|
|
55
|
+
/**
|
|
56
|
+
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientresetqueries
|
|
57
|
+
*/
|
|
58
|
+
(<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>>(pathAndInput?: [TPath, TInput?] | TPath, filters?: ResetQueryFilters, options?: ResetOptions) => Promise<void>) &
|
|
59
|
+
/**
|
|
60
|
+
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientresetqueries
|
|
61
|
+
*/
|
|
62
|
+
((filters?: ResetQueryFilters, options?: ResetOptions) => Promise<void>);
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated
|
|
65
|
+
* @internal
|
|
66
|
+
**/
|
|
48
67
|
export interface TRPCContextState<TRouter extends AnyRouter, TSSRContext = undefined> extends Required<TRPCContextProps<TRouter, TSSRContext>> {
|
|
49
68
|
/**
|
|
50
69
|
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchquery
|
|
51
70
|
*/
|
|
52
|
-
fetchQuery<TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>)
|
|
71
|
+
fetchQuery: <TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>) => Promise<TOutput>;
|
|
53
72
|
/**
|
|
54
73
|
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
55
74
|
*/
|
|
56
|
-
fetchInfiniteQuery<TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchInfiniteQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>)
|
|
75
|
+
fetchInfiniteQuery: <TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchInfiniteQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>) => Promise<InfiniteData<TOutput>>;
|
|
57
76
|
/**
|
|
58
77
|
* @link https://react-query.tanstack.com/guides/prefetching
|
|
59
78
|
*/
|
|
60
|
-
prefetchQuery<TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>)
|
|
79
|
+
prefetchQuery: <TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>) => Promise<void>;
|
|
61
80
|
/**
|
|
62
81
|
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
63
82
|
*/
|
|
64
|
-
prefetchInfiniteQuery<TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchInfiniteQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>)
|
|
83
|
+
prefetchInfiniteQuery: <TPath extends keyof TRouter['_def']['queries'] & string, TProcedure extends TRouter['_def']['queries'][TPath], TOutput extends inferTransformedProcedureOutput<TProcedure>, TInput extends inferProcedureInput<TProcedure>>(pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>], opts?: TRPCFetchInfiniteQueryOptions<TInput, TRPCClientError<TRouter>, TOutput>) => Promise<void>;
|
|
65
84
|
/**
|
|
66
85
|
* @link https://react-query.tanstack.com/guides/query-invalidation
|
|
67
86
|
*/
|
|
68
|
-
invalidateQueries<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>>(pathAndInput?: [TPath, TInput?] | TPath, filters?: InvalidateQueryFilters, options?: InvalidateOptions)
|
|
69
|
-
/**
|
|
70
|
-
* @link https://react-query.tanstack.com/guides/query-invalidation
|
|
71
|
-
*/
|
|
72
|
-
invalidateQueries(filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientresetqueries
|
|
75
|
-
*/
|
|
76
|
-
resetQueries<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>>(pathAndInput?: [TPath, TInput?] | TPath, filters?: ResetQueryFilters, options?: ResetOptions): Promise<void>;
|
|
87
|
+
invalidateQueries: <TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>>(pathAndInput?: [TPath, TInput?] | TPath, filters?: InvalidateQueryFilters, options?: InvalidateOptions) => Promise<void>;
|
|
77
88
|
/**
|
|
78
89
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientresetqueries
|
|
79
90
|
*/
|
|
80
|
-
resetQueries
|
|
91
|
+
resetQueries: TRPCContextResetQueries<TRouter>;
|
|
81
92
|
/**
|
|
82
93
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientrefetchqueries
|
|
83
94
|
*/
|
|
@@ -89,23 +100,24 @@ export interface TRPCContextState<TRouter extends AnyRouter, TSSRContext = undef
|
|
|
89
100
|
/**
|
|
90
101
|
* @link https://react-query.tanstack.com/guides/query-cancellation
|
|
91
102
|
*/
|
|
92
|
-
cancelQuery<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?], options?: CancelOptions)
|
|
103
|
+
cancelQuery: <TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?], options?: CancelOptions) => Promise<void>;
|
|
93
104
|
/**
|
|
94
105
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydata
|
|
95
106
|
*/
|
|
96
|
-
setQueryData<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?], updater: Updater<TOutput | undefined, TOutput | undefined>, options?: SetDataOptions)
|
|
107
|
+
setQueryData: <TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?], updater: Updater<TOutput | undefined, TOutput | undefined>, options?: SetDataOptions) => void;
|
|
97
108
|
/**
|
|
98
109
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
99
110
|
*/
|
|
100
|
-
getQueryData<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?])
|
|
111
|
+
getQueryData: <TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?]) => TOutput | undefined;
|
|
101
112
|
/**
|
|
102
113
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydata
|
|
103
114
|
*/
|
|
104
|
-
setInfiniteQueryData<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?], updater: Updater<InfiniteData<TOutput> | undefined, InfiniteData<TOutput> | undefined>, options?: SetDataOptions)
|
|
115
|
+
setInfiniteQueryData: <TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?], updater: Updater<InfiniteData<TOutput> | undefined, InfiniteData<TOutput> | undefined>, options?: SetDataOptions) => void;
|
|
105
116
|
/**
|
|
106
117
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
107
118
|
*/
|
|
108
|
-
getInfiniteQueryData<TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?])
|
|
119
|
+
getInfiniteQueryData: <TPath extends keyof TRouter['_def']['queries'] & string, TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>, TOutput extends inferTransformedProcedureOutput<TRouter['_def']['queries'][TPath]>>(pathAndInput: [TPath, TInput?]) => InfiniteData<TOutput> | undefined;
|
|
109
120
|
}
|
|
110
121
|
export declare const TRPCContext: import("react").Context<any>;
|
|
122
|
+
export {};
|
|
111
123
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/internals/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["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S,CAAC,CAAC,KAAK,CAAC,CAClC,EAED,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAC3B,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACxC;AAED,eAAO,MAAM,WAAW,8BAA6B,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export declare type QueryType = 'query' | 'infinite' | 'any';
|
|
2
|
+
export declare type QueryKey = [
|
|
3
|
+
string[],
|
|
4
|
+
{
|
|
5
|
+
input?: unknown;
|
|
6
|
+
type?: Exclude<QueryType, 'any'>;
|
|
7
|
+
}?
|
|
8
|
+
];
|
|
2
9
|
/**
|
|
3
10
|
* To allow easy interactions with groups of related queries, such as
|
|
4
11
|
* invalidating all queries of a router, we use an array as the path when
|
|
5
12
|
* storing in tanstack query. This function converts from the `.` separated
|
|
6
13
|
* path passed around internally by both the legacy and proxy implementation.
|
|
7
14
|
* https://github.com/trpc/trpc/issues/2611
|
|
8
|
-
|
|
9
|
-
export declare function getArrayQueryKey(queryKey: string | [string] | [string, ...unknown[]] | unknown[], type: QueryType):
|
|
10
|
-
input?: unknown;
|
|
11
|
-
type?: Exclude<QueryType, 'any'>;
|
|
12
|
-
}];
|
|
15
|
+
**/
|
|
16
|
+
export declare function getArrayQueryKey(queryKey: string | [string] | [string, ...unknown[]] | unknown[], type: QueryType): QueryKey;
|
|
13
17
|
//# sourceMappingURL=getArrayQueryKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getArrayQueryKey.d.ts","sourceRoot":"","sources":["../../src/internals/getArrayQueryKey.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"getArrayQueryKey.d.ts","sourceRoot":"","sources":["../../src/internals/getArrayQueryKey.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC;AAErD,oBAAY,QAAQ,GAAG;IACrB,MAAM,EAAE;IACR;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;KAAE,CAAC;CACvD,CAAC;AAEF;;;;;;IAMI;AACJ,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,EAChE,IAAI,EAAE,SAAS,GACd,QAAQ,CAqBV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getClientArgs.d.ts","sourceRoot":"","sources":["../../src/internals/getClientArgs.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,aAAa,SAAS,OAAO,EAAE,EAAE,QAAQ,EACrE,YAAY,EAAE,aAAa,EAC3B,IAAI,EAAE,QAAQ,oCAIf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryKey.d.ts","sourceRoot":"","sources":["../../src/internals/getQueryKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"getQueryKey.d.ts","sourceRoot":"","sources":["../../src/internals/getQueryKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAG9B"}
|