@trpc/react-query 11.0.0-rc.532 → 11.0.0-rc.551
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/bundle-analysis.json +19 -19
- package/dist/createTRPCReact.d.ts +8 -8
- package/dist/internals/context.d.ts +17 -17
- package/dist/internals/getQueryKey.d.ts +2 -2
- package/dist/internals/getQueryKey.js +2 -2
- package/dist/internals/getQueryKey.mjs +2 -2
- package/dist/server/ssgProxy.d.ts +5 -5
- package/dist/server/ssgProxy.js +1 -1
- package/dist/server/ssgProxy.mjs +1 -1
- package/dist/shared/hooks/createHooksInternal.js +1 -1
- package/dist/shared/hooks/createHooksInternal.mjs +1 -1
- package/dist/shared/proxy/utilsProxy.d.ts +16 -16
- package/package.json +6 -6
- package/src/createTRPCReact.tsx +8 -8
- package/src/internals/context.tsx +17 -17
- package/src/internals/getQueryKey.ts +2 -2
- package/src/server/ssgProxy.ts +5 -5
- package/src/shared/hooks/createHooksInternal.tsx +1 -1
- package/src/shared/proxy/utilsProxy.ts +16 -16
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 54.
|
|
2
|
+
"bundleSize": 36970,
|
|
3
|
+
"bundleOrigSize": 80417,
|
|
4
|
+
"bundleReduction": 54.03,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/shared/hooks/createHooksInternal.tsx",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 16336,
|
|
9
|
+
"origSize": 18423,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createRootHooks"
|
|
12
12
|
],
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"id": "/src/server/ssgProxy.ts",
|
|
37
|
-
"size":
|
|
38
|
-
"origSize":
|
|
37
|
+
"size": 3528,
|
|
38
|
+
"origSize": 7378,
|
|
39
39
|
"renderedExports": [
|
|
40
40
|
"createServerSideHelpers"
|
|
41
41
|
],
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"/src/server/index.ts"
|
|
45
45
|
],
|
|
46
46
|
"percent": 9.54,
|
|
47
|
-
"reduction": 52.
|
|
47
|
+
"reduction": 52.18
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"id": "/src/shared/proxy/utilsProxy.ts",
|
|
51
51
|
"size": 3392,
|
|
52
|
-
"origSize":
|
|
52
|
+
"origSize": 12526,
|
|
53
53
|
"renderedExports": [
|
|
54
54
|
"getQueryType",
|
|
55
55
|
"createReactQueryUtils",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"dependents": [
|
|
60
60
|
"/src/shared/index.ts"
|
|
61
61
|
],
|
|
62
|
-
"percent": 9.
|
|
63
|
-
"reduction": 72.
|
|
62
|
+
"percent": 9.18,
|
|
63
|
+
"reduction": 72.92
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"id": "/src/rsc.tsx",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"id": "/src/internals/getQueryKey.ts",
|
|
79
|
-
"size":
|
|
80
|
-
"origSize":
|
|
79
|
+
"size": 2504,
|
|
80
|
+
"origSize": 4189,
|
|
81
81
|
"renderedExports": [
|
|
82
82
|
"getQueryKeyInternal",
|
|
83
83
|
"getMutationKeyInternal",
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
"/src/shared/proxy/useQueriesProxy.ts",
|
|
94
94
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
95
95
|
],
|
|
96
|
-
"percent": 6.
|
|
97
|
-
"reduction": 40.
|
|
96
|
+
"percent": 6.77,
|
|
97
|
+
"reduction": 40.22
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"id": "/src/createTRPCReact.tsx",
|
|
101
101
|
"size": 875,
|
|
102
|
-
"origSize":
|
|
102
|
+
"origSize": 13307,
|
|
103
103
|
"renderedExports": [
|
|
104
104
|
"createHooksInternal",
|
|
105
105
|
"createTRPCReact"
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"/src/index.ts"
|
|
110
110
|
],
|
|
111
111
|
"percent": 2.37,
|
|
112
|
-
"reduction": 93.
|
|
112
|
+
"reduction": 93.42
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"id": "/src/shared/proxy/decorationProxy.ts",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"dependents": [
|
|
123
123
|
"/src/shared/index.ts"
|
|
124
124
|
],
|
|
125
|
-
"percent": 2.
|
|
125
|
+
"percent": 2.12,
|
|
126
126
|
"reduction": 24
|
|
127
127
|
},
|
|
128
128
|
{
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
{
|
|
188
188
|
"id": "/src/internals/context.tsx",
|
|
189
189
|
"size": 154,
|
|
190
|
-
"origSize":
|
|
190
|
+
"origSize": 7259,
|
|
191
191
|
"renderedExports": [
|
|
192
192
|
"contextProps",
|
|
193
193
|
"TRPCContext"
|
|
@@ -58,11 +58,11 @@ export type useTRPCSuspenseInfiniteQuery<TDef extends ResolverDef> = (input: Inf
|
|
|
58
58
|
*/
|
|
59
59
|
export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> = TDef['input'] extends CursorInput ? {
|
|
60
60
|
/**
|
|
61
|
-
* @
|
|
61
|
+
* @see https://trpc.io/docs/v11/client/react/useInfiniteQuery
|
|
62
62
|
*/
|
|
63
63
|
useInfiniteQuery: useTRPCInfiniteQuery<TDef>;
|
|
64
64
|
/**
|
|
65
|
-
* @
|
|
65
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspenseinfinitequery
|
|
66
66
|
*/
|
|
67
67
|
useSuspenseInfiniteQuery: useTRPCSuspenseInfiniteQuery<TDef>;
|
|
68
68
|
usePrefetchInfiniteQuery: (input: Omit<TDef['input'], ReservedInfiniteQueryKeys> | SkipToken, opts: TRPCFetchInfiniteQueryOptions<TDef['input'], TDef['output'], TRPCClientErrorLike<TDef>>) => void;
|
|
@@ -72,12 +72,12 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> = TDef['input'
|
|
|
72
72
|
*/
|
|
73
73
|
export type DecoratedQueryMethods<TDef extends ResolverDef> = {
|
|
74
74
|
/**
|
|
75
|
-
* @
|
|
75
|
+
* @see https://trpc.io/docs/v11/client/react/useQuery
|
|
76
76
|
*/
|
|
77
77
|
useQuery: ProcedureUseQuery<TDef>;
|
|
78
78
|
usePrefetchQuery: ProcedureUsePrefetchQuery<TDef>;
|
|
79
79
|
/**
|
|
80
|
-
* @
|
|
80
|
+
* @see https://trpc.io/docs/v11/client/react/suspense#usesuspensequery
|
|
81
81
|
*/
|
|
82
82
|
useSuspenseQuery: <TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(input: TDef['input'], opts?: UseTRPCSuspenseQueryOptions<TQueryFnData, TData, TRPCClientErrorLike<TDef>>) => [
|
|
83
83
|
TData,
|
|
@@ -90,7 +90,7 @@ export type DecoratedQueryMethods<TDef extends ResolverDef> = {
|
|
|
90
90
|
export type DecoratedQuery<TDef extends ResolverDef> = MaybeDecoratedInfiniteQuery<TDef> & DecoratedQueryMethods<TDef>;
|
|
91
91
|
export type DecoratedMutation<TDef extends ResolverDef> = {
|
|
92
92
|
/**
|
|
93
|
-
* @
|
|
93
|
+
* @see https://trpc.io/docs/v11/client/react/useMutation
|
|
94
94
|
*/
|
|
95
95
|
useMutation: <TContext = unknown>(opts?: UseTRPCMutationOptions<TDef['input'], TRPCClientErrorLike<TDef>, TDef['output'], TContext>) => UseTRPCMutationResult<TDef['output'], TRPCClientErrorLike<TDef>, TDef['input'], TContext>;
|
|
96
96
|
};
|
|
@@ -103,7 +103,7 @@ interface ProcedureUseSubscription<TDef extends ResolverDef> {
|
|
|
103
103
|
*/
|
|
104
104
|
export type DecorateProcedure<TType extends ProcedureType, TDef extends ResolverDef> = TType extends 'query' ? DecoratedQuery<TDef> : TType extends 'mutation' ? DecoratedMutation<TDef> : TType extends 'subscription' ? {
|
|
105
105
|
/**
|
|
106
|
-
* @
|
|
106
|
+
* @see https://trpc.io/docs/v11/subscriptions
|
|
107
107
|
*/
|
|
108
108
|
useSubscription: ProcedureUseSubscription<TDef>;
|
|
109
109
|
} : never;
|
|
@@ -125,11 +125,11 @@ export type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
|
125
125
|
/**
|
|
126
126
|
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
127
127
|
*
|
|
128
|
-
* @
|
|
128
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
129
129
|
*/
|
|
130
130
|
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
131
131
|
/**
|
|
132
|
-
* @
|
|
132
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
133
133
|
*/
|
|
134
134
|
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
135
135
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
@@ -66,73 +66,73 @@ export interface TRPCContextState<TRouter extends AnyRouter, TSSRContext = undef
|
|
|
66
66
|
*/
|
|
67
67
|
export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
68
68
|
/**
|
|
69
|
-
* @
|
|
69
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery
|
|
70
70
|
*/
|
|
71
71
|
fetchQuery: (queryKey: TRPCQueryKey, opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>) => Promise<unknown>;
|
|
72
72
|
/**
|
|
73
|
-
* @
|
|
73
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
74
74
|
*/
|
|
75
75
|
fetchInfiniteQuery: (queryKey: TRPCQueryKey, opts?: TRPCFetchInfiniteQueryOptions<unknown, unknown, TRPCClientError<TRouter>>) => Promise<InfiniteData<unknown, unknown>>;
|
|
76
76
|
/**
|
|
77
|
-
* @
|
|
77
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
78
78
|
*/
|
|
79
79
|
prefetchQuery: (queryKey: TRPCQueryKey, opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>) => Promise<void>;
|
|
80
80
|
/**
|
|
81
|
-
* @
|
|
81
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
82
82
|
*/
|
|
83
83
|
prefetchInfiniteQuery: (queryKey: TRPCQueryKey, opts?: TRPCFetchInfiniteQueryOptions<unknown, unknown, TRPCClientError<TRouter>>) => Promise<void>;
|
|
84
84
|
/**
|
|
85
|
-
* @
|
|
85
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata
|
|
86
86
|
*/
|
|
87
87
|
ensureQueryData: (queryKey: TRPCQueryKey, opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>) => Promise<unknown>;
|
|
88
88
|
/**
|
|
89
|
-
* @
|
|
89
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation
|
|
90
90
|
*/
|
|
91
91
|
invalidateQueries: (queryKey: TRPCQueryKey, filters?: InvalidateQueryFilters, options?: InvalidateOptions) => Promise<void>;
|
|
92
92
|
/**
|
|
93
|
-
* @
|
|
93
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries
|
|
94
94
|
*/
|
|
95
95
|
resetQueries: (queryKey: TRPCQueryKey, filters?: QueryFilters, options?: ResetOptions) => Promise<void>;
|
|
96
96
|
/**
|
|
97
|
-
* @
|
|
97
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries
|
|
98
98
|
*/
|
|
99
99
|
refetchQueries: (queryKey: TRPCQueryKey, filters?: RefetchQueryFilters, options?: RefetchOptions) => Promise<void>;
|
|
100
100
|
/**
|
|
101
|
-
* @
|
|
101
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/query-cancellation
|
|
102
102
|
*/
|
|
103
103
|
cancelQuery: (queryKey: TRPCQueryKey, options?: CancelOptions) => Promise<void>;
|
|
104
104
|
/**
|
|
105
|
-
* @
|
|
105
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
106
106
|
*/
|
|
107
107
|
setQueryData: (queryKey: TRPCQueryKey, updater: Updater<unknown, unknown>, options?: SetDataOptions) => void;
|
|
108
108
|
/**
|
|
109
|
-
* @
|
|
109
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata
|
|
110
110
|
*/
|
|
111
111
|
setQueriesData: (queryKey: TRPCQueryKey, filters: QueryFilters, updater: Updater<unknown, unknown>, options?: SetDataOptions) => [QueryKey, unknown][];
|
|
112
112
|
/**
|
|
113
|
-
* @
|
|
113
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
114
114
|
*/
|
|
115
115
|
getQueryData: (queryKey: TRPCQueryKey) => unknown;
|
|
116
116
|
/**
|
|
117
|
-
* @
|
|
117
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
118
118
|
*/
|
|
119
119
|
setInfiniteQueryData: (queryKey: TRPCQueryKey, updater: Updater<InfiniteData<unknown> | undefined, InfiniteData<unknown> | undefined>, options?: SetDataOptions) => void;
|
|
120
120
|
/**
|
|
121
|
-
* @
|
|
121
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
122
122
|
*/
|
|
123
123
|
getInfiniteQueryData: (queryKey: TRPCQueryKey) => InfiniteData<unknown> | undefined;
|
|
124
124
|
/**
|
|
125
|
-
* @
|
|
125
|
+
* @see https://tanstack.com/query/latest/docs/reference/QueryClient/#queryclientsetmutationdefaults
|
|
126
126
|
*/
|
|
127
127
|
setMutationDefaults: (mutationKey: TRPCMutationKey, options: MutationOptions | ((args: {
|
|
128
128
|
canonicalMutationFn: (input: unknown) => Promise<unknown>;
|
|
129
129
|
}) => MutationOptions)) => void;
|
|
130
130
|
/**
|
|
131
|
-
* @
|
|
131
|
+
* @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientgetmutationdefaults
|
|
132
132
|
*/
|
|
133
133
|
getMutationDefaults: (mutationKey: TRPCMutationKey) => MutationOptions | undefined;
|
|
134
134
|
/**
|
|
135
|
-
* @
|
|
135
|
+
* @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientismutating
|
|
136
136
|
*/
|
|
137
137
|
isMutating: (filters: {
|
|
138
138
|
mutationKey: TRPCMutationKey;
|
|
@@ -29,7 +29,7 @@ type GetParams<TProcedureOrRouter extends ProcedureOrRouter> = TProcedureOrRoute
|
|
|
29
29
|
* @param procedureOrRouter - procedure or AnyRouter
|
|
30
30
|
* @param input - input to procedureOrRouter
|
|
31
31
|
* @param type - defaults to `any`
|
|
32
|
-
* @
|
|
32
|
+
* @see https://trpc.io/docs/v11/getQueryKey
|
|
33
33
|
*/
|
|
34
34
|
export declare function getQueryKey<TProcedureOrRouter extends ProcedureOrRouter>(procedureOrRouter: TProcedureOrRouter, ..._params: GetParams<TProcedureOrRouter>): TRPCQueryKey;
|
|
35
35
|
export type QueryKeyKnown<TInput, TType extends Exclude<QueryType, 'any'>> = [
|
|
@@ -42,7 +42,7 @@ export type QueryKeyKnown<TInput, TType extends Exclude<QueryType, 'any'>> = [
|
|
|
42
42
|
/**
|
|
43
43
|
* Method to extract the mutation key for a procedure
|
|
44
44
|
* @param procedure - procedure
|
|
45
|
-
* @
|
|
45
|
+
* @see https://trpc.io/docs/v11/getQueryKey#mutations
|
|
46
46
|
*/
|
|
47
47
|
export declare function getMutationKey<TProcedure extends DecoratedMutation<any>>(procedure: TProcedure): TRPCMutationKey;
|
|
48
48
|
export {};
|
|
@@ -51,7 +51,7 @@ function getMutationKeyInternal(path) {
|
|
|
51
51
|
* @param procedureOrRouter - procedure or AnyRouter
|
|
52
52
|
* @param input - input to procedureOrRouter
|
|
53
53
|
* @param type - defaults to `any`
|
|
54
|
-
* @
|
|
54
|
+
* @see https://trpc.io/docs/v11/getQueryKey
|
|
55
55
|
*/ function getQueryKey(procedureOrRouter, ..._params) {
|
|
56
56
|
const [input, type] = _params;
|
|
57
57
|
// @ts-expect-error - we don't expose _def on the type layer
|
|
@@ -62,7 +62,7 @@ function getMutationKeyInternal(path) {
|
|
|
62
62
|
/**
|
|
63
63
|
* Method to extract the mutation key for a procedure
|
|
64
64
|
* @param procedure - procedure
|
|
65
|
-
* @
|
|
65
|
+
* @see https://trpc.io/docs/v11/getQueryKey#mutations
|
|
66
66
|
*/ function getMutationKey(procedure) {
|
|
67
67
|
// @ts-expect-error - we don't expose _def on the type layer
|
|
68
68
|
const path = procedure._def().path;
|
|
@@ -49,7 +49,7 @@ function getMutationKeyInternal(path) {
|
|
|
49
49
|
* @param procedureOrRouter - procedure or AnyRouter
|
|
50
50
|
* @param input - input to procedureOrRouter
|
|
51
51
|
* @param type - defaults to `any`
|
|
52
|
-
* @
|
|
52
|
+
* @see https://trpc.io/docs/v11/getQueryKey
|
|
53
53
|
*/ function getQueryKey(procedureOrRouter, ..._params) {
|
|
54
54
|
const [input, type] = _params;
|
|
55
55
|
// @ts-expect-error - we don't expose _def on the type layer
|
|
@@ -60,7 +60,7 @@ function getMutationKeyInternal(path) {
|
|
|
60
60
|
/**
|
|
61
61
|
* Method to extract the mutation key for a procedure
|
|
62
62
|
* @param procedure - procedure
|
|
63
|
-
* @
|
|
63
|
+
* @see https://trpc.io/docs/v11/getQueryKey#mutations
|
|
64
64
|
*/ function getMutationKey(procedure) {
|
|
65
65
|
// @ts-expect-error - we don't expose _def on the type layer
|
|
66
66
|
const path = procedure._def().path;
|
|
@@ -14,19 +14,19 @@ interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
|
|
|
14
14
|
type CreateServerSideHelpersOptions<TRouter extends AnyRouter> = CreateTRPCReactQueryClientConfig & (CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);
|
|
15
15
|
type DecorateProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyProcedure> = {
|
|
16
16
|
/**
|
|
17
|
-
* @
|
|
17
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
18
18
|
*/
|
|
19
19
|
fetch(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
|
|
20
20
|
/**
|
|
21
|
-
* @
|
|
21
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
22
22
|
*/
|
|
23
23
|
fetchInfinite(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchInfiniteQueryOptions<inferProcedureInput<TProcedure>, inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<InfiniteData<inferTransformedProcedureOutput<TRoot, TProcedure>, NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null>>;
|
|
24
24
|
/**
|
|
25
|
-
* @
|
|
25
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
26
26
|
*/
|
|
27
27
|
prefetch(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<void>;
|
|
28
28
|
/**
|
|
29
|
-
* @
|
|
29
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
30
30
|
*/
|
|
31
31
|
prefetchInfinite(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchInfiniteQueryOptions<inferProcedureInput<TProcedure>, inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<void>;
|
|
32
32
|
};
|
|
@@ -38,7 +38,7 @@ type DecoratedProcedureSSGRecord<TRoot extends AnyRootTypes, TRecord extends Rou
|
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Create functions you can use for server-side rendering / static generation
|
|
41
|
-
* @
|
|
41
|
+
* @see https://trpc.io/docs/v11/client/nextjs/server-side-helpers
|
|
42
42
|
*/
|
|
43
43
|
export declare function createServerSideHelpers<TRouter extends AnyRouter>(opts: CreateServerSideHelpersOptions<TRouter>): ProtectedIntersection<{
|
|
44
44
|
queryClient: QueryClient;
|
package/dist/server/ssgProxy.js
CHANGED
|
@@ -12,7 +12,7 @@ var queryClient = require('../shared/queryClient.js');
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Create functions you can use for server-side rendering / static generation
|
|
15
|
-
* @
|
|
15
|
+
* @see https://trpc.io/docs/v11/client/nextjs/server-side-helpers
|
|
16
16
|
*/ function createServerSideHelpers(opts) {
|
|
17
17
|
const queryClient$1 = queryClient.getQueryClient(opts);
|
|
18
18
|
const transformer = unstableInternals.getTransformer(opts.transformer);
|
package/dist/server/ssgProxy.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { getQueryClient } from '../shared/queryClient.mjs';
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Create functions you can use for server-side rendering / static generation
|
|
13
|
-
* @
|
|
13
|
+
* @see https://trpc.io/docs/v11/client/nextjs/server-side-helpers
|
|
14
14
|
*/ function createServerSideHelpers(opts) {
|
|
15
15
|
const queryClient = getQueryClient(opts);
|
|
16
16
|
const transformer = getTransformer(opts.transformer);
|
|
@@ -81,7 +81,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Hack to make sure errors return `status`='error` when doing SSR
|
|
84
|
-
* @
|
|
84
|
+
* @see https://github.com/trpc/trpc/pull/1645
|
|
85
85
|
*/ function useSSRQueryOptionsIfNeeded(queryKey, opts) {
|
|
86
86
|
const { queryClient , ssrState } = useContext();
|
|
87
87
|
return ssrState && ssrState !== 'mounted' && queryClient.getQueryCache().find({
|
|
@@ -60,7 +60,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Hack to make sure errors return `status`='error` when doing SSR
|
|
63
|
-
* @
|
|
63
|
+
* @see https://github.com/trpc/trpc/pull/1645
|
|
64
64
|
*/ function useSSRQueryOptionsIfNeeded(queryKey, opts) {
|
|
65
65
|
const { queryClient , ssrState } = useContext();
|
|
66
66
|
return ssrState && ssrState !== 'mounted' && queryClient.getQueryCache().find({
|
|
@@ -7,27 +7,27 @@ import type { InferMutationOptions } from '../../utils/inferReactQueryProcedure'
|
|
|
7
7
|
import type { ExtractCursorType } from '../hooks/types';
|
|
8
8
|
type DecorateQueryProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyQueryProcedure> = {
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery
|
|
11
11
|
*/
|
|
12
12
|
fetch(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
|
|
13
13
|
/**
|
|
14
|
-
* @
|
|
14
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
15
15
|
*/
|
|
16
16
|
fetchInfinite(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchInfiniteQueryOptions<inferProcedureInput<TProcedure>, inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<InfiniteData<inferTransformedProcedureOutput<TRoot, TProcedure>, NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null>>;
|
|
17
17
|
/**
|
|
18
|
-
* @
|
|
18
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchquery
|
|
19
19
|
*/
|
|
20
20
|
prefetch(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<void>;
|
|
21
21
|
/**
|
|
22
|
-
* @
|
|
22
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
23
23
|
*/
|
|
24
24
|
prefetchInfinite(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchInfiniteQueryOptions<inferProcedureInput<TProcedure>, inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<void>;
|
|
25
25
|
/**
|
|
26
|
-
* @
|
|
26
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata
|
|
27
27
|
*/
|
|
28
28
|
ensureData(input: inferProcedureInput<TProcedure>, opts?: TRPCFetchQueryOptions<inferTransformedProcedureOutput<TRoot, TProcedure>, TRPCClientError<TRoot>>): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
|
|
29
29
|
/**
|
|
30
|
-
* @
|
|
30
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientinvalidatequeries
|
|
31
31
|
*/
|
|
32
32
|
invalidate(input?: DeepPartial<inferProcedureInput<TProcedure>>, filters?: Omit<InvalidateQueryFilters, 'predicate'> & {
|
|
33
33
|
predicate?: (query: Query<inferProcedureInput<TProcedure>, TRPCClientError<TRoot>, inferProcedureInput<TProcedure>, QueryKeyKnown<inferProcedureInput<TProcedure>, inferProcedureInput<TProcedure> extends {
|
|
@@ -35,19 +35,19 @@ type DecorateQueryProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyQu
|
|
|
35
35
|
} | void ? 'infinite' : 'query'>>) => boolean;
|
|
36
36
|
}, options?: InvalidateOptions): Promise<void>;
|
|
37
37
|
/**
|
|
38
|
-
* @
|
|
38
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries
|
|
39
39
|
*/
|
|
40
40
|
refetch(input?: inferProcedureInput<TProcedure>, filters?: RefetchQueryFilters, options?: RefetchOptions): Promise<void>;
|
|
41
41
|
/**
|
|
42
|
-
* @
|
|
42
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientcancelqueries
|
|
43
43
|
*/
|
|
44
44
|
cancel(input?: inferProcedureInput<TProcedure>, options?: CancelOptions): Promise<void>;
|
|
45
45
|
/**
|
|
46
|
-
* @
|
|
46
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries
|
|
47
47
|
*/
|
|
48
48
|
reset(input?: inferProcedureInput<TProcedure>, options?: ResetOptions): Promise<void>;
|
|
49
49
|
/**
|
|
50
|
-
* @
|
|
50
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
51
51
|
*/
|
|
52
52
|
setData(
|
|
53
53
|
/**
|
|
@@ -55,7 +55,7 @@ type DecorateQueryProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyQu
|
|
|
55
55
|
*/
|
|
56
56
|
input: inferProcedureInput<TProcedure>, updater: Updater<inferTransformedProcedureOutput<TRoot, TProcedure> | undefined, inferTransformedProcedureOutput<TRoot, TProcedure> | undefined>, options?: SetDataOptions): void;
|
|
57
57
|
/**
|
|
58
|
-
* @
|
|
58
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
59
59
|
*/
|
|
60
60
|
setQueriesData(
|
|
61
61
|
/**
|
|
@@ -63,15 +63,15 @@ type DecorateQueryProcedure<TRoot extends AnyRootTypes, TProcedure extends AnyQu
|
|
|
63
63
|
*/
|
|
64
64
|
input: inferProcedureInput<TProcedure>, filters: QueryFilters, updater: Updater<inferTransformedProcedureOutput<TRoot, TProcedure> | undefined, inferTransformedProcedureOutput<TRoot, TProcedure> | undefined>, options?: SetDataOptions): [QueryKey, inferTransformedProcedureOutput<TRoot, TProcedure>];
|
|
65
65
|
/**
|
|
66
|
-
* @
|
|
66
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
67
67
|
*/
|
|
68
68
|
setInfiniteData(input: inferProcedureInput<TProcedure>, updater: Updater<InfiniteData<inferTransformedProcedureOutput<TRoot, TProcedure>, NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null> | undefined, InfiniteData<inferTransformedProcedureOutput<TRoot, TProcedure>, NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null> | undefined>, options?: SetDataOptions): void;
|
|
69
69
|
/**
|
|
70
|
-
* @
|
|
70
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
71
71
|
*/
|
|
72
72
|
getData(input?: inferProcedureInput<TProcedure>): inferTransformedProcedureOutput<TRoot, TProcedure> | undefined;
|
|
73
73
|
/**
|
|
74
|
-
* @
|
|
74
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
75
75
|
*/
|
|
76
76
|
getInfiniteData(input?: inferProcedureInput<TProcedure>): InfiniteData<inferTransformedProcedureOutput<TRoot, TProcedure>, NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null> | undefined;
|
|
77
77
|
};
|
|
@@ -89,8 +89,8 @@ type DecorateMutationProcedure<TRoot extends AnyRootTypes, TProcedure extends An
|
|
|
89
89
|
type DecorateRouter = {
|
|
90
90
|
/**
|
|
91
91
|
* Invalidate the full router
|
|
92
|
-
* @
|
|
93
|
-
* @
|
|
92
|
+
* @see https://trpc.io/docs/v10/useContext#query-invalidation
|
|
93
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation
|
|
94
94
|
*/
|
|
95
95
|
invalidate(input?: undefined, filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise<void>;
|
|
96
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.551+33a3515c1",
|
|
4
4
|
"description": "The tRPC React library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@tanstack/react-query": "^5.54.1",
|
|
67
|
-
"@trpc/client": "11.0.0-rc.
|
|
68
|
-
"@trpc/server": "11.0.0-rc.
|
|
67
|
+
"@trpc/client": "11.0.0-rc.551+33a3515c1",
|
|
68
|
+
"@trpc/server": "11.0.0-rc.551+33a3515c1",
|
|
69
69
|
"react": ">=18.2.0",
|
|
70
70
|
"react-dom": ">=18.2.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@tanstack/react-query": "^5.54.1",
|
|
74
|
-
"@trpc/client": "11.0.0-rc.
|
|
75
|
-
"@trpc/server": "11.0.0-rc.
|
|
74
|
+
"@trpc/client": "11.0.0-rc.551+33a3515c1",
|
|
75
|
+
"@trpc/server": "11.0.0-rc.551+33a3515c1",
|
|
76
76
|
"@types/express": "^4.17.17",
|
|
77
77
|
"@types/node": "^20.10.0",
|
|
78
78
|
"@types/react": "^18.3.1",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"funding": [
|
|
93
93
|
"https://trpc.io/sponsor"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "33a3515c12fbf14105362278d42d32f92ef22740"
|
|
96
96
|
}
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -300,11 +300,11 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
|
|
|
300
300
|
TDef['input'] extends CursorInput
|
|
301
301
|
? {
|
|
302
302
|
/**
|
|
303
|
-
* @
|
|
303
|
+
* @see https://trpc.io/docs/v11/client/react/useInfiniteQuery
|
|
304
304
|
*/
|
|
305
305
|
useInfiniteQuery: useTRPCInfiniteQuery<TDef>;
|
|
306
306
|
/**
|
|
307
|
-
* @
|
|
307
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspenseinfinitequery
|
|
308
308
|
*/
|
|
309
309
|
useSuspenseInfiniteQuery: useTRPCSuspenseInfiniteQuery<TDef>;
|
|
310
310
|
|
|
@@ -324,12 +324,12 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
|
|
|
324
324
|
*/
|
|
325
325
|
export type DecoratedQueryMethods<TDef extends ResolverDef> = {
|
|
326
326
|
/**
|
|
327
|
-
* @
|
|
327
|
+
* @see https://trpc.io/docs/v11/client/react/useQuery
|
|
328
328
|
*/
|
|
329
329
|
useQuery: ProcedureUseQuery<TDef>;
|
|
330
330
|
usePrefetchQuery: ProcedureUsePrefetchQuery<TDef>;
|
|
331
331
|
/**
|
|
332
|
-
* @
|
|
332
|
+
* @see https://trpc.io/docs/v11/client/react/suspense#usesuspensequery
|
|
333
333
|
*/
|
|
334
334
|
useSuspenseQuery: <
|
|
335
335
|
TQueryFnData extends TDef['output'] = TDef['output'],
|
|
@@ -355,7 +355,7 @@ export type DecoratedQuery<TDef extends ResolverDef> =
|
|
|
355
355
|
|
|
356
356
|
export type DecoratedMutation<TDef extends ResolverDef> = {
|
|
357
357
|
/**
|
|
358
|
-
* @
|
|
358
|
+
* @see https://trpc.io/docs/v11/client/react/useMutation
|
|
359
359
|
*/
|
|
360
360
|
useMutation: <TContext = unknown>(
|
|
361
361
|
opts?: UseTRPCMutationOptions<
|
|
@@ -401,7 +401,7 @@ export type DecorateProcedure<
|
|
|
401
401
|
: TType extends 'subscription'
|
|
402
402
|
? {
|
|
403
403
|
/**
|
|
404
|
-
* @
|
|
404
|
+
* @see https://trpc.io/docs/v11/subscriptions
|
|
405
405
|
*/
|
|
406
406
|
useSubscription: ProcedureUseSubscription<TDef>;
|
|
407
407
|
}
|
|
@@ -438,11 +438,11 @@ export type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
|
|
|
438
438
|
/**
|
|
439
439
|
* @deprecated renamed to `useUtils` and will be removed in a future tRPC version
|
|
440
440
|
*
|
|
441
|
-
* @
|
|
441
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
442
442
|
*/
|
|
443
443
|
useContext(): CreateReactUtils<TRouter, TSSRContext>;
|
|
444
444
|
/**
|
|
445
|
-
* @
|
|
445
|
+
* @see https://trpc.io/docs/v11/client/react/useUtils
|
|
446
446
|
*/
|
|
447
447
|
useUtils(): CreateReactUtils<TRouter, TSSRContext>;
|
|
448
448
|
Provider: TRPCProvider<TRouter, TSSRContext>;
|
|
@@ -125,14 +125,14 @@ export interface TRPCContextState<
|
|
|
125
125
|
*/
|
|
126
126
|
export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
127
127
|
/**
|
|
128
|
-
* @
|
|
128
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery
|
|
129
129
|
*/
|
|
130
130
|
fetchQuery: (
|
|
131
131
|
queryKey: TRPCQueryKey,
|
|
132
132
|
opts?: TRPCFetchQueryOptions<unknown, TRPCClientError<TRouter>>,
|
|
133
133
|
) => Promise<unknown>;
|
|
134
134
|
/**
|
|
135
|
-
* @
|
|
135
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
136
136
|
*/
|
|
137
137
|
fetchInfiniteQuery: (
|
|
138
138
|
queryKey: TRPCQueryKey,
|
|
@@ -143,7 +143,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
143
143
|
>,
|
|
144
144
|
) => Promise<InfiniteData<unknown, unknown>>;
|
|
145
145
|
/**
|
|
146
|
-
* @
|
|
146
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
147
147
|
*/
|
|
148
148
|
prefetchQuery: (
|
|
149
149
|
queryKey: TRPCQueryKey,
|
|
@@ -151,7 +151,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
151
151
|
) => Promise<void>;
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* @
|
|
154
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
155
155
|
*/
|
|
156
156
|
prefetchInfiniteQuery: (
|
|
157
157
|
queryKey: TRPCQueryKey,
|
|
@@ -163,7 +163,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
163
163
|
) => Promise<void>;
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
|
-
* @
|
|
166
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata
|
|
167
167
|
*/
|
|
168
168
|
ensureQueryData: (
|
|
169
169
|
queryKey: TRPCQueryKey,
|
|
@@ -171,7 +171,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
171
171
|
) => Promise<unknown>;
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
* @
|
|
174
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation
|
|
175
175
|
*/
|
|
176
176
|
invalidateQueries: (
|
|
177
177
|
queryKey: TRPCQueryKey,
|
|
@@ -180,7 +180,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
180
180
|
) => Promise<void>;
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
* @
|
|
183
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries
|
|
184
184
|
*/
|
|
185
185
|
resetQueries: (
|
|
186
186
|
queryKey: TRPCQueryKey,
|
|
@@ -189,7 +189,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
189
189
|
) => Promise<void>;
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* @
|
|
192
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries
|
|
193
193
|
*/
|
|
194
194
|
refetchQueries: (
|
|
195
195
|
queryKey: TRPCQueryKey,
|
|
@@ -198,7 +198,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
198
198
|
) => Promise<void>;
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
|
-
* @
|
|
201
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/query-cancellation
|
|
202
202
|
*/
|
|
203
203
|
cancelQuery: (
|
|
204
204
|
queryKey: TRPCQueryKey,
|
|
@@ -206,7 +206,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
206
206
|
) => Promise<void>;
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
|
-
* @
|
|
209
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
210
210
|
*/
|
|
211
211
|
setQueryData: (
|
|
212
212
|
queryKey: TRPCQueryKey,
|
|
@@ -215,7 +215,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
215
215
|
) => void;
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
* @
|
|
218
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata
|
|
219
219
|
*/
|
|
220
220
|
setQueriesData: (
|
|
221
221
|
queryKey: TRPCQueryKey,
|
|
@@ -225,12 +225,12 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
225
225
|
) => [QueryKey, unknown][];
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
|
-
* @
|
|
228
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
229
229
|
*/
|
|
230
230
|
getQueryData: (queryKey: TRPCQueryKey) => unknown;
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* @
|
|
233
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
234
234
|
*/
|
|
235
235
|
setInfiniteQueryData: (
|
|
236
236
|
queryKey: TRPCQueryKey,
|
|
@@ -242,14 +242,14 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
242
242
|
) => void;
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
|
-
* @
|
|
245
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
246
246
|
*/
|
|
247
247
|
getInfiniteQueryData: (
|
|
248
248
|
queryKey: TRPCQueryKey,
|
|
249
249
|
) => InfiniteData<unknown> | undefined;
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
|
-
* @
|
|
252
|
+
* @see https://tanstack.com/query/latest/docs/reference/QueryClient/#queryclientsetmutationdefaults
|
|
253
253
|
*/
|
|
254
254
|
setMutationDefaults: (
|
|
255
255
|
mutationKey: TRPCMutationKey,
|
|
@@ -261,14 +261,14 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
261
261
|
) => void;
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
|
-
* @
|
|
264
|
+
* @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientgetmutationdefaults
|
|
265
265
|
*/
|
|
266
266
|
getMutationDefaults: (
|
|
267
267
|
mutationKey: TRPCMutationKey,
|
|
268
268
|
) => MutationOptions | undefined;
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
|
-
* @
|
|
271
|
+
* @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientismutating
|
|
272
272
|
*/
|
|
273
273
|
isMutating: (filters: { mutationKey: TRPCMutationKey }) => number;
|
|
274
274
|
}
|
|
@@ -104,7 +104,7 @@ type GetParams<TProcedureOrRouter extends ProcedureOrRouter> =
|
|
|
104
104
|
* @param procedureOrRouter - procedure or AnyRouter
|
|
105
105
|
* @param input - input to procedureOrRouter
|
|
106
106
|
* @param type - defaults to `any`
|
|
107
|
-
* @
|
|
107
|
+
* @see https://trpc.io/docs/v11/getQueryKey
|
|
108
108
|
*/
|
|
109
109
|
export function getQueryKey<TProcedureOrRouter extends ProcedureOrRouter>(
|
|
110
110
|
procedureOrRouter: TProcedureOrRouter,
|
|
@@ -127,7 +127,7 @@ export type QueryKeyKnown<TInput, TType extends Exclude<QueryType, 'any'>> = [
|
|
|
127
127
|
/**
|
|
128
128
|
* Method to extract the mutation key for a procedure
|
|
129
129
|
* @param procedure - procedure
|
|
130
|
-
* @
|
|
130
|
+
* @see https://trpc.io/docs/v11/getQueryKey#mutations
|
|
131
131
|
*/
|
|
132
132
|
export function getMutationKey<TProcedure extends DecoratedMutation<any>>(
|
|
133
133
|
procedure: TProcedure,
|
package/src/server/ssgProxy.ts
CHANGED
|
@@ -57,7 +57,7 @@ type DecorateProcedure<
|
|
|
57
57
|
TProcedure extends AnyProcedure,
|
|
58
58
|
> = {
|
|
59
59
|
/**
|
|
60
|
-
* @
|
|
60
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
61
61
|
*/
|
|
62
62
|
fetch(
|
|
63
63
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -68,7 +68,7 @@ type DecorateProcedure<
|
|
|
68
68
|
): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* @
|
|
71
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
72
72
|
*/
|
|
73
73
|
fetchInfinite(
|
|
74
74
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -85,7 +85,7 @@ type DecorateProcedure<
|
|
|
85
85
|
>;
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* @
|
|
88
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
89
89
|
*/
|
|
90
90
|
prefetch(
|
|
91
91
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -96,7 +96,7 @@ type DecorateProcedure<
|
|
|
96
96
|
): Promise<void>;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* @
|
|
99
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching
|
|
100
100
|
*/
|
|
101
101
|
prefetchInfinite(
|
|
102
102
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -129,7 +129,7 @@ type AnyDecoratedProcedure = DecorateProcedure<any, any>;
|
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Create functions you can use for server-side rendering / static generation
|
|
132
|
-
* @
|
|
132
|
+
* @see https://trpc.io/docs/v11/client/nextjs/server-side-helpers
|
|
133
133
|
*/
|
|
134
134
|
export function createServerSideHelpers<TRouter extends AnyRouter>(
|
|
135
135
|
opts: CreateServerSideHelpersOptions<TRouter>,
|
|
@@ -123,7 +123,7 @@ export function createRootHooks<
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Hack to make sure errors return `status`='error` when doing SSR
|
|
126
|
-
* @
|
|
126
|
+
* @see https://github.com/trpc/trpc/pull/1645
|
|
127
127
|
*/
|
|
128
128
|
function useSSRQueryOptionsIfNeeded<
|
|
129
129
|
TOptions extends { retryOnMount?: boolean } | undefined,
|
|
@@ -50,7 +50,7 @@ type DecorateQueryProcedure<
|
|
|
50
50
|
TProcedure extends AnyQueryProcedure,
|
|
51
51
|
> = {
|
|
52
52
|
/**
|
|
53
|
-
* @
|
|
53
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery
|
|
54
54
|
*/
|
|
55
55
|
fetch(
|
|
56
56
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -61,7 +61,7 @@ type DecorateQueryProcedure<
|
|
|
61
61
|
): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* @
|
|
64
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
65
65
|
*/
|
|
66
66
|
fetchInfinite(
|
|
67
67
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -78,7 +78,7 @@ type DecorateQueryProcedure<
|
|
|
78
78
|
>;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* @
|
|
81
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchquery
|
|
82
82
|
*/
|
|
83
83
|
prefetch(
|
|
84
84
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -89,7 +89,7 @@ type DecorateQueryProcedure<
|
|
|
89
89
|
): Promise<void>;
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* @
|
|
92
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
93
93
|
*/
|
|
94
94
|
prefetchInfinite(
|
|
95
95
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -101,7 +101,7 @@ type DecorateQueryProcedure<
|
|
|
101
101
|
): Promise<void>;
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* @
|
|
104
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata
|
|
105
105
|
*/
|
|
106
106
|
ensureData(
|
|
107
107
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -112,7 +112,7 @@ type DecorateQueryProcedure<
|
|
|
112
112
|
): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
* @
|
|
115
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientinvalidatequeries
|
|
116
116
|
*/
|
|
117
117
|
invalidate(
|
|
118
118
|
input?: DeepPartial<inferProcedureInput<TProcedure>>,
|
|
@@ -135,7 +135,7 @@ type DecorateQueryProcedure<
|
|
|
135
135
|
): Promise<void>;
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* @
|
|
138
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries
|
|
139
139
|
*/
|
|
140
140
|
refetch(
|
|
141
141
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -144,7 +144,7 @@ type DecorateQueryProcedure<
|
|
|
144
144
|
): Promise<void>;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* @
|
|
147
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientcancelqueries
|
|
148
148
|
*/
|
|
149
149
|
cancel(
|
|
150
150
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -152,7 +152,7 @@ type DecorateQueryProcedure<
|
|
|
152
152
|
): Promise<void>;
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* @
|
|
155
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries
|
|
156
156
|
*/
|
|
157
157
|
reset(
|
|
158
158
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -160,7 +160,7 @@ type DecorateQueryProcedure<
|
|
|
160
160
|
): Promise<void>;
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
* @
|
|
163
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
164
164
|
*/
|
|
165
165
|
setData(
|
|
166
166
|
/**
|
|
@@ -175,7 +175,7 @@ type DecorateQueryProcedure<
|
|
|
175
175
|
): void;
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
|
-
* @
|
|
178
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
179
179
|
*/
|
|
180
180
|
setQueriesData(
|
|
181
181
|
/**
|
|
@@ -191,7 +191,7 @@ type DecorateQueryProcedure<
|
|
|
191
191
|
): [QueryKey, inferTransformedProcedureOutput<TRoot, TProcedure>];
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
|
-
* @
|
|
194
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata
|
|
195
195
|
*/
|
|
196
196
|
setInfiniteData(
|
|
197
197
|
input: inferProcedureInput<TProcedure>,
|
|
@@ -211,14 +211,14 @@ type DecorateQueryProcedure<
|
|
|
211
211
|
): void;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
* @
|
|
214
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
215
215
|
*/
|
|
216
216
|
getData(
|
|
217
217
|
input?: inferProcedureInput<TProcedure>,
|
|
218
218
|
): inferTransformedProcedureOutput<TRoot, TProcedure> | undefined;
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
|
-
* @
|
|
221
|
+
* @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
|
|
222
222
|
*/
|
|
223
223
|
getInfiniteData(
|
|
224
224
|
input?: inferProcedureInput<TProcedure>,
|
|
@@ -256,8 +256,8 @@ type DecorateMutationProcedure<
|
|
|
256
256
|
type DecorateRouter = {
|
|
257
257
|
/**
|
|
258
258
|
* Invalidate the full router
|
|
259
|
-
* @
|
|
260
|
-
* @
|
|
259
|
+
* @see https://trpc.io/docs/v10/useContext#query-invalidation
|
|
260
|
+
* @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation
|
|
261
261
|
*/
|
|
262
262
|
invalidate(
|
|
263
263
|
input?: undefined,
|