@trpc/react-query 10.7.0 → 10.8.1
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-de11647d.mjs → createHooksInternal-9c1f8ad9.mjs} +18 -9
- package/dist/{createHooksInternal-9b01c277.js → createHooksInternal-d8e5577b.js} +19 -7
- package/dist/createTRPCReact.d.ts +18 -6
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internals/context.d.ts +35 -19
- package/dist/internals/context.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/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 +4 -1
- package/dist/shared/index.mjs +1 -1
- package/dist/shared/proxy/utilsProxy.d.ts +5 -4
- package/dist/shared/proxy/utilsProxy.d.ts.map +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 +64 -21
- package/src/internals/context.tsx +53 -45
- package/src/internals/getClientArgs.ts +7 -0
- 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/utilsProxy.ts +6 -3
- package/src/ssg/ssgProxy.ts +8 -4
- package/src/utils/inferReactQueryProcedure.ts +1 -1
|
@@ -2,7 +2,7 @@ import { createRecursiveProxy, createFlatProxy } from '@trpc/server/shared';
|
|
|
2
2
|
import { g as getArrayQueryKey } from './getArrayQueryKey-86134f8b.mjs';
|
|
3
3
|
import { createTRPCClientProxy, createTRPCClient } from '@trpc/client';
|
|
4
4
|
import { useQuery, useQueryClient, useMutation, hashQueryKey, useInfiniteQuery, useQueries } from '@tanstack/react-query';
|
|
5
|
-
import React, { createContext, useState, useEffect, useCallback, useMemo
|
|
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`
|
|
@@ -151,6 +151,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
151
151
|
opts?.trpc
|
|
152
152
|
];
|
|
153
153
|
}
|
|
154
|
+
|
|
154
155
|
/**
|
|
155
156
|
* Makes a stable reference of the `trpc` prop
|
|
156
157
|
*/ function useHookResult(value) {
|
|
@@ -158,10 +159,18 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
158
159
|
ref.current.path = value.path;
|
|
159
160
|
return ref.current;
|
|
160
161
|
}
|
|
162
|
+
|
|
161
163
|
/**
|
|
162
164
|
* Create strongly typed react hooks
|
|
163
165
|
* @internal
|
|
166
|
+
* @deprecated
|
|
164
167
|
*/ function createHooksInternal(config) {
|
|
168
|
+
return createRootHooks(config);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @internal
|
|
173
|
+
*/ function createRootHooks(config) {
|
|
165
174
|
const mutationSuccessOverride = config?.unstable_overrides?.useMutation?.onSuccess ?? ((options)=>options.originalFn());
|
|
166
175
|
const Context = config?.context ?? TRPCContext;
|
|
167
176
|
const ReactQueryContext = config?.reactQueryContext;
|
|
@@ -290,7 +299,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
290
299
|
...opts
|
|
291
300
|
} : opts;
|
|
292
301
|
}
|
|
293
|
-
function useQuery$1(
|
|
302
|
+
function useQuery$1(// FIXME path should be a tuple in next major
|
|
303
|
+
pathAndInput, opts) {
|
|
294
304
|
const { abortOnUnmount , client , ssrState , queryClient , prefetchQuery } = useContext();
|
|
295
305
|
if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && opts?.enabled !== false && !queryClient.getQueryCache().find(getArrayQueryKey(pathAndInput, 'query'))) {
|
|
296
306
|
void prefetchQuery(pathAndInput, opts);
|
|
@@ -318,7 +328,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
318
328
|
});
|
|
319
329
|
return hook;
|
|
320
330
|
}
|
|
321
|
-
function useMutation$1(path
|
|
331
|
+
function useMutation$1(// FIXME: this should only be a tuple path in next major
|
|
332
|
+
path, opts) {
|
|
322
333
|
const { client } = useContext();
|
|
323
334
|
const queryClient = useQueryClient({
|
|
324
335
|
context: ReactQueryContext
|
|
@@ -346,11 +357,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
346
357
|
});
|
|
347
358
|
return hook;
|
|
348
359
|
}
|
|
349
|
-
/* istanbul ignore next */
|
|
350
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
|
351
|
-
* **Experimental.** API might change without major version bump
|
|
352
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠
|
|
353
|
-
*/ function useSubscription(pathAndInput, opts) {
|
|
360
|
+
/* istanbul ignore next */ function useSubscription(pathAndInput, opts) {
|
|
354
361
|
const enabled = opts?.enabled ?? true;
|
|
355
362
|
const queryKey = hashQueryKey(pathAndInput);
|
|
356
363
|
const { client } = useContext();
|
|
@@ -368,6 +375,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
368
375
|
},
|
|
369
376
|
onData: (data)=>{
|
|
370
377
|
if (!isStopped) {
|
|
378
|
+
// FIXME this shouldn't be needed as both should be `unknown` in next major
|
|
371
379
|
opts.onData(data);
|
|
372
380
|
}
|
|
373
381
|
},
|
|
@@ -410,6 +418,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
410
418
|
...input ?? {},
|
|
411
419
|
cursor: queryFunctionContext.pageParam
|
|
412
420
|
};
|
|
421
|
+
// FIXME as any shouldn't be needed as client should be untyped too
|
|
413
422
|
return client.query(...getClientArgs([
|
|
414
423
|
path,
|
|
415
424
|
actualInput
|
|
@@ -468,4 +477,4 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
468
477
|
};
|
|
469
478
|
}
|
|
470
479
|
|
|
471
|
-
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 };
|
|
@@ -157,6 +157,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
157
157
|
opts?.trpc
|
|
158
158
|
];
|
|
159
159
|
}
|
|
160
|
+
|
|
160
161
|
/**
|
|
161
162
|
* Makes a stable reference of the `trpc` prop
|
|
162
163
|
*/ function useHookResult(value) {
|
|
@@ -164,10 +165,18 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
164
165
|
ref.current.path = value.path;
|
|
165
166
|
return ref.current;
|
|
166
167
|
}
|
|
168
|
+
|
|
167
169
|
/**
|
|
168
170
|
* Create strongly typed react hooks
|
|
169
171
|
* @internal
|
|
172
|
+
* @deprecated
|
|
170
173
|
*/ function createHooksInternal(config) {
|
|
174
|
+
return createRootHooks(config);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @internal
|
|
179
|
+
*/ function createRootHooks(config) {
|
|
171
180
|
const mutationSuccessOverride = config?.unstable_overrides?.useMutation?.onSuccess ?? ((options)=>options.originalFn());
|
|
172
181
|
const Context = config?.context ?? TRPCContext;
|
|
173
182
|
const ReactQueryContext = config?.reactQueryContext;
|
|
@@ -296,7 +305,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
296
305
|
...opts
|
|
297
306
|
} : opts;
|
|
298
307
|
}
|
|
299
|
-
function useQuery(
|
|
308
|
+
function useQuery(// FIXME path should be a tuple in next major
|
|
309
|
+
pathAndInput, opts) {
|
|
300
310
|
const { abortOnUnmount , client , ssrState , queryClient , prefetchQuery } = useContext();
|
|
301
311
|
if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && opts?.enabled !== false && !queryClient.getQueryCache().find(getArrayQueryKey.getArrayQueryKey(pathAndInput, 'query'))) {
|
|
302
312
|
void prefetchQuery(pathAndInput, opts);
|
|
@@ -324,7 +334,8 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
324
334
|
});
|
|
325
335
|
return hook;
|
|
326
336
|
}
|
|
327
|
-
function useMutation(path
|
|
337
|
+
function useMutation(// FIXME: this should only be a tuple path in next major
|
|
338
|
+
path, opts) {
|
|
328
339
|
const { client } = useContext();
|
|
329
340
|
const queryClient = reactQuery.useQueryClient({
|
|
330
341
|
context: ReactQueryContext
|
|
@@ -352,11 +363,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
352
363
|
});
|
|
353
364
|
return hook;
|
|
354
365
|
}
|
|
355
|
-
/* istanbul ignore next */
|
|
356
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
|
357
|
-
* **Experimental.** API might change without major version bump
|
|
358
|
-
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠
|
|
359
|
-
*/ function useSubscription(pathAndInput, opts) {
|
|
366
|
+
/* istanbul ignore next */ function useSubscription(pathAndInput, opts) {
|
|
360
367
|
const enabled = opts?.enabled ?? true;
|
|
361
368
|
const queryKey = reactQuery.hashQueryKey(pathAndInput);
|
|
362
369
|
const { client } = useContext();
|
|
@@ -374,6 +381,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
374
381
|
},
|
|
375
382
|
onData: (data)=>{
|
|
376
383
|
if (!isStopped) {
|
|
384
|
+
// FIXME this shouldn't be needed as both should be `unknown` in next major
|
|
377
385
|
opts.onData(data);
|
|
378
386
|
}
|
|
379
387
|
},
|
|
@@ -416,6 +424,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
416
424
|
...input ?? {},
|
|
417
425
|
cursor: queryFunctionContext.pageParam
|
|
418
426
|
};
|
|
427
|
+
// FIXME as any shouldn't be needed as client should be untyped too
|
|
419
428
|
return client.query(...getClientArgs([
|
|
420
429
|
path,
|
|
421
430
|
actualInput
|
|
@@ -474,8 +483,11 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
474
483
|
};
|
|
475
484
|
}
|
|
476
485
|
|
|
486
|
+
exports.TRPCContext = TRPCContext;
|
|
487
|
+
exports.contextProps = contextProps;
|
|
477
488
|
exports.createHooksInternal = createHooksInternal;
|
|
478
489
|
exports.createReactProxyDecoration = createReactProxyDecoration;
|
|
479
490
|
exports.createReactQueryUtilsProxy = createReactQueryUtilsProxy;
|
|
491
|
+
exports.createRootHooks = createRootHooks;
|
|
480
492
|
exports.createUseQueriesProxy = createUseQueriesProxy;
|
|
481
493
|
exports.getClientArgs = getClientArgs;
|
|
@@ -1,12 +1,20 @@
|
|
|
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
5
|
import { QueryKey, QueryType } from './internals/getArrayQueryKey';
|
|
6
6
|
import { TRPCUseQueries } from './internals/useQueries';
|
|
7
7
|
import { CreateReactUtilsProxy } from './shared';
|
|
8
|
-
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';
|
|
9
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
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* @internal
|
|
12
20
|
*/
|
|
@@ -17,7 +25,7 @@ export declare type DecorateProcedure<TProcedure extends AnyProcedure, TFlags, T
|
|
|
17
25
|
* @link https://trpc.io/docs/useContext#-the-function-i-want-isnt-here
|
|
18
26
|
*/
|
|
19
27
|
getQueryKey: (input: inferProcedureInput<TProcedure>, type?: QueryType) => QueryKey;
|
|
20
|
-
useQuery: <
|
|
28
|
+
useQuery: ProcedureUseQuery<TProcedure, TPath>;
|
|
21
29
|
} & (inferProcedureInput<TProcedure> extends {
|
|
22
30
|
cursor?: any;
|
|
23
31
|
} ? {
|
|
@@ -45,16 +53,20 @@ export declare type DecoratedProcedureRecord<TProcedures extends ProcedureRouter
|
|
|
45
53
|
getQueryKey: () => QueryKey;
|
|
46
54
|
} & DecoratedProcedureRecord<TProcedures[TKey]['_def']['record'], TFlags, `${TPath}${TKey & string}.`> : TProcedures[TKey] extends AnyProcedure ? DecorateProcedure<TProcedures[TKey], TFlags, `${TPath}${TKey & string}`> : never;
|
|
47
55
|
};
|
|
48
|
-
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
49
60
|
useContext(): CreateReactUtilsProxy<TRouter, TSSRContext>;
|
|
50
61
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
51
62
|
createClient: CreateClient<TRouter>;
|
|
52
63
|
useQueries: TRPCUseQueries<TRouter>;
|
|
53
64
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
54
|
-
}
|
|
65
|
+
};
|
|
66
|
+
export declare type CreateTRPCReact<TRouter extends AnyRouter, TSSRContext, TFlags> = ProtectedIntersection<CreateTRPCReactBase<TRouter, TSSRContext>, DecoratedProcedureRecord<TRouter['_def']['record'], TFlags>>;
|
|
55
67
|
/**
|
|
56
68
|
* @internal
|
|
57
69
|
*/
|
|
58
|
-
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, "">>;
|
|
59
71
|
export declare function createTRPCReact<TRouter extends AnyRouter, TSSRContext = unknown, TFlags = null>(opts?: CreateTRPCReactOptions<TRouter>): CreateTRPCReact<TRouter, TSSRContext, TFlags>;
|
|
60
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,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,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;A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AAED,wBAAgB,eAAe,CAC7B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,MAAM,GAAG,IAAI,EAEb,IAAI,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACrC,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAK/C"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ 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
10
|
require('./getArrayQueryKey-4bdb5cc2.js');
|
|
11
11
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
6
|
import './getArrayQueryKey-86134f8b.mjs';
|
|
7
7
|
|
|
@@ -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,35 +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)
|
|
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>;
|
|
69
88
|
/**
|
|
70
89
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientresetqueries
|
|
71
90
|
*/
|
|
72
|
-
resetQueries
|
|
73
|
-
/**
|
|
74
|
-
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientresetqueries
|
|
75
|
-
*/
|
|
76
|
-
resetQueries(filters?: ResetQueryFilters, options?: ResetOptions): Promise<void>;
|
|
91
|
+
resetQueries: TRPCContextResetQueries<TRouter>;
|
|
77
92
|
/**
|
|
78
93
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientrefetchqueries
|
|
79
94
|
*/
|
|
@@ -85,23 +100,24 @@ export interface TRPCContextState<TRouter extends AnyRouter, TSSRContext = undef
|
|
|
85
100
|
/**
|
|
86
101
|
* @link https://react-query.tanstack.com/guides/query-cancellation
|
|
87
102
|
*/
|
|
88
|
-
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>;
|
|
89
104
|
/**
|
|
90
105
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydata
|
|
91
106
|
*/
|
|
92
|
-
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;
|
|
93
108
|
/**
|
|
94
109
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
95
110
|
*/
|
|
96
|
-
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;
|
|
97
112
|
/**
|
|
98
113
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydata
|
|
99
114
|
*/
|
|
100
|
-
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;
|
|
101
116
|
/**
|
|
102
117
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
103
118
|
*/
|
|
104
|
-
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;
|
|
105
120
|
}
|
|
106
121
|
export declare const TRPCContext: import("react").Context<any>;
|
|
122
|
+
export {};
|
|
107
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":["../../src/internals/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,EAC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ot":"","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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface TRPCHookResult {
|
|
2
|
+
trpc: {
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Makes a stable reference of the `trpc` prop
|
|
8
|
+
*/
|
|
9
|
+
export declare function useHookResult(value: TRPCHookResult['trpc']): TRPCHookResult['trpc'];
|
|
10
|
+
//# sourceMappingURL=useHookResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHookResult.d.ts","sourceRoot":"","sources":["../../src/internals/useHookResult.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC5B,cAAc,CAAC,MAAM,CAAC,CAIxB"}
|
|
@@ -1,130 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { inferTransformedProcedureOutput } from '@trpc/server/shared';
|
|
6
|
-
import { ReactNode } from 'react';
|
|
7
|
-
import { TRPCContextProps, TRPCContextState } from '../../internals/context';
|
|
1
|
+
import { TRPCClientErrorLike } from '@trpc/client';
|
|
2
|
+
import type { AnyRouter } from '@trpc/server';
|
|
3
|
+
import { Observable } from '@trpc/server/observable';
|
|
4
|
+
import { TRPCContextState } from '../../internals/context';
|
|
8
5
|
import { TRPCUseQueries } from '../../internals/useQueries';
|
|
9
6
|
import { CreateTRPCReactOptions } from '../types';
|
|
10
|
-
|
|
11
|
-
cursor: TCursor | null;
|
|
12
|
-
data: TData;
|
|
13
|
-
};
|
|
14
|
-
export interface TRPCReactRequestOptions extends Omit<TRPCRequestOptions, 'signal'> {
|
|
15
|
-
/**
|
|
16
|
-
* Opt out of SSR for this query by passing `ssr: false`
|
|
17
|
-
*/
|
|
18
|
-
ssr?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Opt out or into aborting request on unmount
|
|
21
|
-
*/
|
|
22
|
-
abortOnUnmount?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface TRPCUseQueryBaseOptions {
|
|
25
|
-
/**
|
|
26
|
-
* tRPC-related options
|
|
27
|
-
*/
|
|
28
|
-
trpc?: TRPCReactRequestOptions;
|
|
29
|
-
}
|
|
30
|
-
export type { TRPCContext, TRPCContextState } from '../../internals/context';
|
|
31
|
-
export interface UseTRPCQueryOptions<TPath, TInput, TOutput, TData, TError> extends UseQueryOptions<TOutput, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
32
|
-
}
|
|
33
|
-
export interface TRPCQueryOptions<TPath, TInput, TData, TError> extends QueryOptions<TData, TError, TData, [TPath, TInput]>, TRPCUseQueryBaseOptions {
|
|
34
|
-
}
|
|
35
|
-
export interface UseTRPCInfiniteQueryOptions<TPath, TInput, TOutput, TError> extends UseInfiniteQueryOptions<TOutput, TError, TOutput, TOutput, [
|
|
36
|
-
TPath,
|
|
37
|
-
TInput
|
|
38
|
-
]>, TRPCUseQueryBaseOptions {
|
|
39
|
-
}
|
|
40
|
-
export interface UseTRPCMutationOptions<TInput, TError, TOutput, TContext = unknown> extends UseMutationOptions<TOutput, TError, TInput, TContext>, TRPCUseQueryBaseOptions {
|
|
41
|
-
}
|
|
42
|
-
export interface UseTRPCSubscriptionOptions<TOutput, TError> {
|
|
43
|
-
enabled?: boolean;
|
|
44
|
-
onStarted?: () => void;
|
|
45
|
-
onData: (data: TOutput) => void;
|
|
46
|
-
onError?: (err: TError) => void;
|
|
47
|
-
}
|
|
48
|
-
export declare function getClientArgs<TPathAndInput extends unknown[], TOptions>(pathAndInput: TPathAndInput, opts: TOptions): readonly [unknown, unknown, any];
|
|
49
|
-
declare type inferInfiniteQueryNames<TObj extends ProcedureRecord> = {
|
|
50
|
-
[TPath in keyof TObj]: inferProcedureInput<TObj[TPath]> extends {
|
|
51
|
-
cursor?: any;
|
|
52
|
-
} ? TPath : never;
|
|
53
|
-
}[keyof TObj];
|
|
54
|
-
declare type inferProcedures<TObj extends ProcedureRecord> = {
|
|
55
|
-
[TPath in keyof TObj]: {
|
|
56
|
-
input: inferProcedureInput<TObj[TPath]>;
|
|
57
|
-
output: inferTransformedProcedureOutput<TObj[TPath]>;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
export interface TRPCProviderProps<TRouter extends AnyRouter, TSSRContext> extends TRPCContextProps<TRouter, TSSRContext> {
|
|
61
|
-
children: ReactNode;
|
|
62
|
-
}
|
|
63
|
-
export declare type TRPCProvider<TRouter extends AnyRouter, TSSRContext> = (props: TRPCProviderProps<TRouter, TSSRContext>) => JSX.Element;
|
|
64
|
-
export declare type UseDehydratedState<TRouter extends AnyRouter> = (client: TRPCClient<TRouter>, trpcState: DehydratedState | undefined) => DehydratedState | undefined;
|
|
65
|
-
export declare type CreateClient<TRouter extends AnyRouter> = (opts: CreateTRPCClientOptions<TRouter>) => TRPCClient<TRouter>;
|
|
66
|
-
interface TRPCHookResult {
|
|
67
|
-
trpc: {
|
|
68
|
-
path: string;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
export declare type UseTRPCQueryResult<TData, TError> = UseQueryResult<TData, TError> & TRPCHookResult;
|
|
75
|
-
/**
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
export declare type UseTRPCQuerySuccessResult<TData, TError> = QueryObserverSuccessResult<TData, TError> & TRPCHookResult;
|
|
79
|
-
/**
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
export declare type UseTRPCInfiniteQueryResult<TData, TError> = UseInfiniteQueryResult<TData, TError> & TRPCHookResult;
|
|
83
|
-
/**
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
export declare type UseTRPCInfiniteQuerySuccessResult<TData, TError> = InfiniteQueryObserverSuccessResult<TData, TError> & TRPCHookResult;
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
export declare type UseTRPCMutationResult<TData, TError, TVariables, TContext> = UseMutationResult<TData, TError, TVariables, TContext> & TRPCHookResult;
|
|
7
|
+
import { CreateClient, TRPCProvider, UseDehydratedState, UseTRPCInfiniteQueryOptions, UseTRPCInfiniteQueryResult, UseTRPCMutationOptions, UseTRPCMutationResult, UseTRPCQueryOptions, UseTRPCQueryResult, UseTRPCSubscriptionOptions } from './types';
|
|
91
8
|
/**
|
|
92
|
-
* Create strongly typed react hooks
|
|
93
9
|
* @internal
|
|
94
10
|
*/
|
|
95
|
-
export declare function
|
|
11
|
+
export declare function createRootHooks<TRouter extends AnyRouter, TSSRContext = unknown>(config?: CreateTRPCReactOptions<TRouter>): {
|
|
96
12
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
97
13
|
createClient: CreateClient<TRouter>;
|
|
98
14
|
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
99
|
-
useQuery:
|
|
15
|
+
useQuery: (pathAndInput: [path: string, ...args: unknown[]], opts?: UseTRPCQueryOptions<unknown, unknown, unknown, unknown, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCQueryResult<unknown, TRPCClientErrorLike<TRouter>>;
|
|
100
16
|
useQueries: TRPCUseQueries<TRouter>;
|
|
101
|
-
useMutation:
|
|
102
|
-
useSubscription:
|
|
17
|
+
useMutation: (path: string | [string], opts?: UseTRPCMutationOptions<unknown, TRPCClientErrorLike<TRouter>, unknown, unknown> | undefined) => UseTRPCMutationResult<unknown, TRPCClientErrorLike<TRouter>, unknown, unknown>;
|
|
18
|
+
useSubscription: (pathAndInput: [
|
|
19
|
+
path: string,
|
|
20
|
+
...args: unknown[]
|
|
21
|
+
], opts: UseTRPCSubscriptionOptions<Observable<unknown, unknown>, TRPCClientErrorLike<TRouter>>) => void;
|
|
103
22
|
useDehydratedState: UseDehydratedState<TRouter>;
|
|
104
|
-
useInfiniteQuery:
|
|
23
|
+
useInfiniteQuery: (pathAndInput: [
|
|
24
|
+
path: string,
|
|
25
|
+
input: Record<any, unknown>
|
|
26
|
+
], opts?: UseTRPCInfiniteQueryOptions<unknown, unknown, unknown, TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<unknown, TRPCClientErrorLike<TRouter>>;
|
|
105
27
|
};
|
|
106
28
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*/
|
|
110
|
-
declare class GnClass<TRouter extends AnyRouter, TSSRContext = unknown> {
|
|
111
|
-
fn(): {
|
|
112
|
-
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
113
|
-
createClient: CreateClient<TRouter>;
|
|
114
|
-
useContext: () => TRPCContextState<TRouter, TSSRContext>;
|
|
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>;
|
|
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>;
|
|
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;
|
|
119
|
-
useDehydratedState: UseDehydratedState<TRouter>;
|
|
120
|
-
useInfiniteQuery: <TPath_3 extends inferInfiniteQueryNames<TRouter["_def"]["queries"]> & string>(pathAndInput: [path: TPath_3, input: Omit<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], "cursor">], opts?: UseTRPCInfiniteQueryOptions<TPath_3, Omit<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["input"], "cursor">, inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>> | undefined) => UseTRPCInfiniteQueryResult<inferProcedures<TRouter["_def"]["queries"]>[TPath_3]["output"], TRPCClientErrorLike<TRouter>>;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
declare type returnTypeInferer<TType> = TType extends (a: Record<string, string>) => infer U ? U : never;
|
|
124
|
-
declare type fooType<TRouter extends AnyRouter, TSSRContext = unknown> = GnClass<TRouter, TSSRContext>['fn'];
|
|
125
|
-
/**
|
|
126
|
-
* Infer the type of a `createReactQueryHooks` function
|
|
127
|
-
* @internal
|
|
29
|
+
* @deprecated
|
|
30
|
+
* DELETE ME
|
|
128
31
|
*/
|
|
129
|
-
export
|
|
32
|
+
export * from './deprecated/createHooksInternal';
|
|
130
33
|
//# sourceMappingURL=createHooksInternal.d.ts.map
|