@trpc/react-query 10.32.0 → 10.33.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-03506f75.js → createHooksInternal-0346bd2b.js} +8 -4
- package/dist/{createHooksInternal-466f5861.js → createHooksInternal-201f0ad5.js} +8 -4
- package/dist/{createHooksInternal-a6562110.mjs → createHooksInternal-7ba6fd69.mjs} +8 -4
- package/dist/createTRPCReact.d.ts +18 -18
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internals/context.d.ts +14 -18
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/internals/getArrayQueryKey.d.ts +2 -2
- package/dist/internals/getArrayQueryKey.d.ts.map +1 -1
- package/dist/internals/getQueryKey.d.ts +4 -4
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/server/ssgProxy.d.ts +1 -1
- package/dist/server/ssgProxy.d.ts.map +1 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/deprecated/createHooksInternal.d.ts +6 -6
- package/dist/shared/hooks/deprecated/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/types.d.ts +4 -4
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.mjs +1 -1
- package/dist/shared/proxy/useQueriesProxy.d.ts +1 -1
- package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
- package/dist/shared/proxy/utilsProxy.d.ts +3 -3
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/dist/ssg/ssg.d.ts +4 -4
- package/package.json +7 -7
- package/src/createTRPCReact.tsx +45 -45
- package/src/internals/context.tsx +23 -26
- package/src/internals/getArrayQueryKey.ts +2 -2
- package/src/internals/getQueryKey.ts +4 -4
- package/src/server/ssgProxy.ts +1 -1
- package/src/server/types.ts +3 -5
- package/src/shared/hooks/createHooksInternal.tsx +3 -6
- package/src/shared/hooks/deprecated/createHooksInternal.tsx +6 -9
- package/src/shared/hooks/types.ts +6 -9
- package/src/shared/proxy/useQueriesProxy.ts +1 -1
- package/src/shared/proxy/utilsProxy.ts +17 -13
- package/src/ssg/ssg.ts +4 -4
package/dist/shared/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as TRPCContext, h as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, f as createRootHooks, e as createUseQueriesProxy, d as getClientArgs } from '../createHooksInternal-
|
|
1
|
+
export { T as TRPCContext, h as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, f as createRootHooks, e as createUseQueriesProxy, d as getClientArgs } from '../createHooksInternal-7ba6fd69.mjs';
|
|
2
2
|
export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
3
3
|
import '@trpc/server/shared';
|
|
4
4
|
import '../getArrayQueryKey-86134f8b.mjs';
|
|
@@ -7,7 +7,7 @@ type GetQueryOptions<TProcedure extends AnyProcedure, TPath extends string> = <T
|
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export type UseQueriesProcedureRecord<TRouter extends AnyRouter, TPath extends string = ''> = {
|
|
10
|
-
[TKey in keyof Filter<TRouter['_def']['record'],
|
|
10
|
+
[TKey in keyof Filter<TRouter['_def']['record'], AnyQueryProcedure | AnyRouter>]: TRouter['_def']['record'][TKey] extends AnyRouter ? UseQueriesProcedureRecord<TRouter['_def']['record'][TKey], `${TPath}${TKey & string}.`> : GetQueryOptions<TRouter['_def']['record'][TKey], `${TPath}${TKey & string}`>;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Create proxy for `useQueries` options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQueriesProxy.d.ts","sourceRoot":"","sources":["../../../src/shared/proxy/useQueriesProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,+BAA+B,EAChC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE3E,KAAK,eAAe,CAAC,UAAU,SAAS,YAAY,EAAE,KAAK,SAAS,MAAM,IAAI,CAC5E,KAAK,GAAG,+BAA+B,CAAC,UAAU,CAAC,EAEnD,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACtC,IAAI,CAAC,EAAE,6BAA6B,CAClC,KAAK,EACL,mBAAmB,CAAC,UAAU,CAAC,EAC/B,+BAA+B,CAAC,UAAU,CAAC,EAC3C,KAAK,EACL,eAAe,CAAC,UAAU,CAAC,CAC5B,KACE,6BAA6B,CAChC,KAAK,EACL,mBAAmB,CAAC,UAAU,CAAC,EAC/B,+BAA+B,CAAC,UAAU,CAAC,EAC3C,KAAK,EACL,eAAe,CAAC,UAAU,CAAC,CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,CACnC,OAAO,SAAS,SAAS,EACzB,KAAK,SAAS,MAAM,GAAG,EAAE,IACvB;KACD,IAAI,IAAI,MAAM,MAAM,CACnB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,
|
|
1
|
+
{"version":3,"file":"useQueriesProxy.d.ts","sourceRoot":"","sources":["../../../src/shared/proxy/useQueriesProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO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AC,OAAO,CAAC,0CAkB5B"}
|
|
@@ -81,9 +81,9 @@ type DecorateRouter = {
|
|
|
81
81
|
/**
|
|
82
82
|
* @internal
|
|
83
83
|
*/
|
|
84
|
-
export type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> = {
|
|
85
|
-
[TKey in keyof Filter<TRouter['_def']['record'],
|
|
86
|
-
}
|
|
84
|
+
export type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> = DecorateRouter & {
|
|
85
|
+
[TKey in keyof Filter<TRouter['_def']['record'], AnyQueryProcedure | AnyRouter>]: TRouter['_def']['record'][TKey] extends AnyRouter ? DecoratedProcedureUtilsRecord<TRouter['_def']['record'][TKey]> & DecorateRouter : DecorateProcedure<TRouter['_def']['record'][TKey]>;
|
|
86
|
+
};
|
|
87
87
|
export type CreateReactUtilsProxy<TRouter extends AnyRouter, TSSRContext> = ProtectedIntersection<DecoratedProxyTRPCContextProps<TRouter, TSSRContext>, DecoratedProcedureUtilsRecord<TRouter>>;
|
|
88
88
|
/**
|
|
89
89
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilsProxy.d.ts","sourceRoot":"","sources":["../../../src/shared/proxy/utilsProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAyB,eAAe,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,MAAM,EACN,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,+BAA+B,EAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,8BAA8B,EAC9B,gBAAgB,EAChB,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,yB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,EAChC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,CAAC,OAAO,SAAS,SAAS,IACjE,cAAc,GAAG;KACd,IAAI,IAAI,MAAM,MAAM,CACnB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,iBAAiB,GAAG,SAAS,CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GACjD,6BAA6B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAC5D,cAAc,GAEhB,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAIJ,MAAM,MAAM,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,WAAW,IACT,qBAAqB,CACvB,8BAA8B,CAAC,OAAO,EAAE,WAAW,CAAC,EACpD,6BAA6B,CAAC,OAAO,CAAC,CACvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,SAAS,SAAS,EACzB,WAAW,EACX,OAAO,EAAE,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,uHAsE9C"}
|
package/dist/ssg/ssg.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { CreateServerSideHelpersOptions } from '../server/types';
|
|
|
6
6
|
* @deprecated use `createServerSideHelpers` instead
|
|
7
7
|
*/
|
|
8
8
|
export declare function createSSGHelpers<TRouter extends AnyRouter>(opts: CreateServerSideHelpersOptions<TRouter>): {
|
|
9
|
-
prefetchQuery: <TPath extends keyof TRouter["_def"]["queries"]
|
|
10
|
-
prefetchInfiniteQuery: <TPath_1 extends keyof TRouter["_def"]["queries"]
|
|
11
|
-
fetchQuery: <TPath_2 extends keyof TRouter["_def"]["queries"]
|
|
12
|
-
fetchInfiniteQuery: <TPath_3 extends keyof TRouter["_def"]["queries"]
|
|
9
|
+
prefetchQuery: <TPath extends string & keyof TRouter["_def"]["queries"], TProcedure extends TRouter["_def"]["queries"][TPath]>(path: TPath, ...args: inferHandlerInput<TProcedure>) => Promise<void>;
|
|
10
|
+
prefetchInfiniteQuery: <TPath_1 extends string & keyof TRouter["_def"]["queries"], TProcedure_1 extends TRouter["_def"]["queries"][TPath_1]>(path: TPath_1, ...args: inferHandlerInput<TProcedure_1>) => Promise<void>;
|
|
11
|
+
fetchQuery: <TPath_2 extends string & keyof TRouter["_def"]["queries"], TProcedure_2 extends TRouter["_def"]["queries"][TPath_2], TOutput extends inferProcedureOutput<TProcedure_2>>(path: TPath_2, ...args: inferHandlerInput<TProcedure_2>) => Promise<TOutput>;
|
|
12
|
+
fetchInfiniteQuery: <TPath_3 extends string & keyof TRouter["_def"]["queries"], TProcedure_3 extends TRouter["_def"]["queries"][TPath_3], TOutput_1 extends inferProcedureOutput<TProcedure_3>>(path: TPath_3, ...args: inferHandlerInput<TProcedure_3>) => Promise<InfiniteData<TOutput_1>>;
|
|
13
13
|
dehydrate: (opts?: DehydrateOptions) => DehydratedState;
|
|
14
14
|
queryClient: import("@tanstack/react-query").QueryClient;
|
|
15
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.33.1",
|
|
4
4
|
"description": "The tRPC React library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,21 +64,21 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@tanstack/react-query": "^4.18.0",
|
|
67
|
-
"@trpc/client": "10.
|
|
68
|
-
"@trpc/server": "10.
|
|
67
|
+
"@trpc/client": "10.33.1",
|
|
68
|
+
"@trpc/server": "10.33.1",
|
|
69
69
|
"react": ">=16.8.0",
|
|
70
70
|
"react-dom": ">=16.8.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@tanstack/react-query": "^4.18.0",
|
|
74
|
-
"@trpc/client": "10.
|
|
75
|
-
"@trpc/server": "10.
|
|
74
|
+
"@trpc/client": "10.33.1",
|
|
75
|
+
"@trpc/server": "10.33.1",
|
|
76
76
|
"@types/express": "^4.17.17",
|
|
77
77
|
"@types/node": "^18.16.16",
|
|
78
78
|
"@types/react": "^18.2.8",
|
|
79
79
|
"eslint": "^8.40.0",
|
|
80
80
|
"express": "^4.17.1",
|
|
81
|
-
"next": "^13.4.
|
|
81
|
+
"next": "^13.4.8",
|
|
82
82
|
"react": "^18.2.0",
|
|
83
83
|
"react-dom": "^18.2.0",
|
|
84
84
|
"rollup": "^2.79.1",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"funding": [
|
|
92
92
|
"https://trpc.io/sponsor"
|
|
93
93
|
],
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "403be02df05c29a9c3a77256805674baf6b6b125"
|
|
95
95
|
}
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -91,44 +91,7 @@ export type DecorateProcedure<
|
|
|
91
91
|
_TFlags,
|
|
92
92
|
TPath extends string,
|
|
93
93
|
> = TProcedure extends AnyQueryProcedure
|
|
94
|
-
? {
|
|
95
|
-
/**
|
|
96
|
-
* Method to extract the query key for a procedure
|
|
97
|
-
* @param type - defaults to `any`
|
|
98
|
-
* @see https://trpc.io/docs/client/react/getQueryKey
|
|
99
|
-
* @deprecated - import `getQueryKey` from `@trpc/react-query` instead
|
|
100
|
-
*/
|
|
101
|
-
getQueryKey: (
|
|
102
|
-
input: inferProcedureInput<TProcedure>,
|
|
103
|
-
type?: QueryType,
|
|
104
|
-
) => QueryKey;
|
|
105
|
-
/**
|
|
106
|
-
* @see https://trpc.io/docs/client/react/useQuery
|
|
107
|
-
*/
|
|
108
|
-
useQuery: ProcedureUseQuery<TProcedure, TPath>;
|
|
109
|
-
/**
|
|
110
|
-
* @see https://trpc.io/docs/client/react/suspense#usesuspensequery
|
|
111
|
-
*/
|
|
112
|
-
useSuspenseQuery: <
|
|
113
|
-
TQueryFnData extends inferTransformedProcedureOutput<TProcedure> = inferTransformedProcedureOutput<TProcedure>,
|
|
114
|
-
TData = TQueryFnData,
|
|
115
|
-
>(
|
|
116
|
-
input: inferProcedureInput<TProcedure>,
|
|
117
|
-
opts?: Omit<
|
|
118
|
-
UseTRPCQueryOptions<
|
|
119
|
-
TPath,
|
|
120
|
-
inferProcedureInput<TProcedure>,
|
|
121
|
-
TQueryFnData,
|
|
122
|
-
TData,
|
|
123
|
-
TRPCClientErrorLike<TProcedure>
|
|
124
|
-
>,
|
|
125
|
-
'enabled' | 'suspense'
|
|
126
|
-
>,
|
|
127
|
-
) => [
|
|
128
|
-
TData,
|
|
129
|
-
UseTRPCQuerySuccessResult<TData, TRPCClientErrorLike<TProcedure>>,
|
|
130
|
-
];
|
|
131
|
-
} & (inferProcedureInput<TProcedure> extends { cursor?: any } | void
|
|
94
|
+
? (inferProcedureInput<TProcedure> extends { cursor?: any } | void
|
|
132
95
|
? {
|
|
133
96
|
/**
|
|
134
97
|
* @see https://trpc.io/docs/client/react/suspense#useinfinitesuspensequery
|
|
@@ -167,7 +130,44 @@ export type DecorateProcedure<
|
|
|
167
130
|
>,
|
|
168
131
|
];
|
|
169
132
|
}
|
|
170
|
-
: object)
|
|
133
|
+
: object) & {
|
|
134
|
+
/**
|
|
135
|
+
* Method to extract the query key for a procedure
|
|
136
|
+
* @param type - defaults to `any`
|
|
137
|
+
* @see https://trpc.io/docs/client/react/getQueryKey
|
|
138
|
+
* @deprecated - import `getQueryKey` from `@trpc/react-query` instead
|
|
139
|
+
*/
|
|
140
|
+
getQueryKey: (
|
|
141
|
+
input: inferProcedureInput<TProcedure>,
|
|
142
|
+
type?: QueryType,
|
|
143
|
+
) => QueryKey;
|
|
144
|
+
/**
|
|
145
|
+
* @see https://trpc.io/docs/client/react/useQuery
|
|
146
|
+
*/
|
|
147
|
+
useQuery: ProcedureUseQuery<TProcedure, TPath>;
|
|
148
|
+
/**
|
|
149
|
+
* @see https://trpc.io/docs/client/react/suspense#usesuspensequery
|
|
150
|
+
*/
|
|
151
|
+
useSuspenseQuery: <
|
|
152
|
+
TQueryFnData extends inferTransformedProcedureOutput<TProcedure> = inferTransformedProcedureOutput<TProcedure>,
|
|
153
|
+
TData = TQueryFnData,
|
|
154
|
+
>(
|
|
155
|
+
input: inferProcedureInput<TProcedure>,
|
|
156
|
+
opts?: Omit<
|
|
157
|
+
UseTRPCQueryOptions<
|
|
158
|
+
TPath,
|
|
159
|
+
inferProcedureInput<TProcedure>,
|
|
160
|
+
TQueryFnData,
|
|
161
|
+
TData,
|
|
162
|
+
TRPCClientErrorLike<TProcedure>
|
|
163
|
+
>,
|
|
164
|
+
'enabled' | 'suspense'
|
|
165
|
+
>,
|
|
166
|
+
) => [
|
|
167
|
+
TData,
|
|
168
|
+
UseTRPCQuerySuccessResult<TData, TRPCClientErrorLike<TProcedure>>,
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
171
|
: TProcedure extends AnyMutationProcedure
|
|
172
172
|
? {
|
|
173
173
|
/**
|
|
@@ -211,16 +211,16 @@ export type DecoratedProcedureRecord<
|
|
|
211
211
|
TPath extends string = '',
|
|
212
212
|
> = {
|
|
213
213
|
[TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter
|
|
214
|
-
?
|
|
214
|
+
? DecoratedProcedureRecord<
|
|
215
|
+
TProcedures[TKey]['_def']['record'],
|
|
216
|
+
TFlags,
|
|
217
|
+
`${TPath}${TKey & string}.`
|
|
218
|
+
> & {
|
|
215
219
|
/**
|
|
216
220
|
* @deprecated - import `getQueryKey` from `@trpc/react-query` instead
|
|
217
221
|
*/
|
|
218
222
|
getQueryKey: () => QueryKey;
|
|
219
|
-
}
|
|
220
|
-
TProcedures[TKey]['_def']['record'],
|
|
221
|
-
TFlags,
|
|
222
|
-
`${TPath}${TKey & string}.`
|
|
223
|
-
>
|
|
223
|
+
}
|
|
224
224
|
: TProcedures[TKey] extends AnyProcedure
|
|
225
225
|
? DecorateProcedure<TProcedures[TKey], TFlags, `${TPath}${TKey & string}`>
|
|
226
226
|
: never;
|
|
@@ -33,7 +33,7 @@ export interface TRPCFetchInfiniteQueryOptions<TInput, TError, TOutput>
|
|
|
33
33
|
TRPCRequestOptions {}
|
|
34
34
|
|
|
35
35
|
/** @internal */
|
|
36
|
-
export type SSRState =
|
|
36
|
+
export type SSRState = 'mounted' | 'mounting' | 'prepass' | false;
|
|
37
37
|
|
|
38
38
|
export interface ProxyTRPCContextProps<TRouter extends AnyRouter, TSSRContext> {
|
|
39
39
|
/**
|
|
@@ -92,18 +92,15 @@ type TRPCContextResetQueries<TRouter extends AnyRouter> =
|
|
|
92
92
|
/**
|
|
93
93
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientresetqueries
|
|
94
94
|
*/
|
|
95
|
-
(<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientresetqueries
|
|
105
|
-
*/
|
|
106
|
-
((filters?: ResetQueryFilters, options?: ResetOptions) => Promise<void>);
|
|
95
|
+
((filters?: ResetQueryFilters, options?: ResetOptions) => Promise<void>) &
|
|
96
|
+
(<
|
|
97
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
98
|
+
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
99
|
+
>(
|
|
100
|
+
pathAndInput?: TPath | [TPath, TInput?],
|
|
101
|
+
filters?: ResetQueryFilters,
|
|
102
|
+
options?: ResetOptions,
|
|
103
|
+
) => Promise<void>);
|
|
107
104
|
|
|
108
105
|
/**
|
|
109
106
|
* @deprecated
|
|
@@ -117,7 +114,7 @@ export interface TRPCContextState<
|
|
|
117
114
|
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchquery
|
|
118
115
|
*/
|
|
119
116
|
fetchQuery: <
|
|
120
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
117
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
121
118
|
TProcedure extends TRouter['_def']['queries'][TPath],
|
|
122
119
|
TOutput extends inferTransformedProcedureOutput<TProcedure>,
|
|
123
120
|
TInput extends inferProcedureInput<TProcedure>,
|
|
@@ -130,7 +127,7 @@ export interface TRPCContextState<
|
|
|
130
127
|
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientfetchinfinitequery
|
|
131
128
|
*/
|
|
132
129
|
fetchInfiniteQuery: <
|
|
133
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
130
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
134
131
|
TProcedure extends TRouter['_def']['queries'][TPath],
|
|
135
132
|
TOutput extends inferTransformedProcedureOutput<TProcedure>,
|
|
136
133
|
TInput extends inferProcedureInput<TProcedure>,
|
|
@@ -147,7 +144,7 @@ export interface TRPCContextState<
|
|
|
147
144
|
* @link https://tanstack.com/query/v4/docs/react/guides/prefetching
|
|
148
145
|
*/
|
|
149
146
|
prefetchQuery: <
|
|
150
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
147
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
151
148
|
TProcedure extends TRouter['_def']['queries'][TPath],
|
|
152
149
|
TOutput extends inferTransformedProcedureOutput<TProcedure>,
|
|
153
150
|
TInput extends inferProcedureInput<TProcedure>,
|
|
@@ -160,7 +157,7 @@ export interface TRPCContextState<
|
|
|
160
157
|
* @link https://tanstack.com/query/v4/docs/reference/QueryClient#queryclientprefetchinfinitequery
|
|
161
158
|
*/
|
|
162
159
|
prefetchInfiniteQuery: <
|
|
163
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
160
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
164
161
|
TProcedure extends TRouter['_def']['queries'][TPath],
|
|
165
162
|
TOutput extends inferTransformedProcedureOutput<TProcedure>,
|
|
166
163
|
TInput extends inferProcedureInput<TProcedure>,
|
|
@@ -177,7 +174,7 @@ export interface TRPCContextState<
|
|
|
177
174
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientensurequerydata
|
|
178
175
|
*/
|
|
179
176
|
ensureQueryData: <
|
|
180
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
177
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
181
178
|
TProcedure extends TRouter['_def']['queries'][TPath],
|
|
182
179
|
TOutput extends inferTransformedProcedureOutput<TProcedure>,
|
|
183
180
|
TInput extends inferProcedureInput<TProcedure>,
|
|
@@ -190,10 +187,10 @@ export interface TRPCContextState<
|
|
|
190
187
|
* @link https://tanstack.com/query/v4/docs/react/guides/query-invalidation
|
|
191
188
|
*/
|
|
192
189
|
invalidateQueries: <
|
|
193
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
190
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
194
191
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
195
192
|
>(
|
|
196
|
-
pathAndInput?: [TPath, TInput?]
|
|
193
|
+
pathAndInput?: TPath | [TPath, TInput?],
|
|
197
194
|
filters?: InvalidateQueryFilters,
|
|
198
195
|
options?: InvalidateOptions,
|
|
199
196
|
) => Promise<void>;
|
|
@@ -207,7 +204,7 @@ export interface TRPCContextState<
|
|
|
207
204
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientrefetchqueries
|
|
208
205
|
*/
|
|
209
206
|
refetchQueries<
|
|
210
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
207
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
211
208
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
212
209
|
>(
|
|
213
210
|
pathAndInput: [TPath, TInput?],
|
|
@@ -227,7 +224,7 @@ export interface TRPCContextState<
|
|
|
227
224
|
* @link https://tanstack.com/query/v4/docs/react/guides/query-cancellation
|
|
228
225
|
*/
|
|
229
226
|
cancelQuery: <
|
|
230
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
227
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
231
228
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
232
229
|
>(
|
|
233
230
|
pathAndInput: [TPath, TInput?],
|
|
@@ -238,7 +235,7 @@ export interface TRPCContextState<
|
|
|
238
235
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientsetquerydata
|
|
239
236
|
*/
|
|
240
237
|
setQueryData: <
|
|
241
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
238
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
242
239
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
243
240
|
TOutput extends inferTransformedProcedureOutput<
|
|
244
241
|
TRouter['_def']['queries'][TPath]
|
|
@@ -253,7 +250,7 @@ export interface TRPCContextState<
|
|
|
253
250
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientgetquerydata
|
|
254
251
|
*/
|
|
255
252
|
getQueryData: <
|
|
256
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
253
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
257
254
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
258
255
|
TOutput extends inferTransformedProcedureOutput<
|
|
259
256
|
TRouter['_def']['queries'][TPath]
|
|
@@ -266,7 +263,7 @@ export interface TRPCContextState<
|
|
|
266
263
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientsetquerydata
|
|
267
264
|
*/
|
|
268
265
|
setInfiniteQueryData: <
|
|
269
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
266
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
270
267
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
271
268
|
TOutput extends inferTransformedProcedureOutput<
|
|
272
269
|
TRouter['_def']['queries'][TPath]
|
|
@@ -284,7 +281,7 @@ export interface TRPCContextState<
|
|
|
284
281
|
* @link https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientgetquerydata
|
|
285
282
|
*/
|
|
286
283
|
getInfiniteQueryData: <
|
|
287
|
-
TPath extends keyof TRouter['_def']['queries']
|
|
284
|
+
TPath extends string & keyof TRouter['_def']['queries'],
|
|
288
285
|
TInput extends inferProcedureInput<TRouter['_def']['queries'][TPath]>,
|
|
289
286
|
TOutput extends inferTransformedProcedureOutput<
|
|
290
287
|
TRouter['_def']['queries'][TPath]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetQueryProcedureInput } from './getQueryKey';
|
|
2
2
|
|
|
3
|
-
export type QueryType = '
|
|
3
|
+
export type QueryType = 'any' | 'infinite' | 'query';
|
|
4
4
|
|
|
5
5
|
export type QueryKey = [
|
|
6
6
|
string[],
|
|
@@ -20,7 +20,7 @@ export type QueryKeyKnown<TInput, TType extends Exclude<QueryType, 'any'>> = [
|
|
|
20
20
|
* https://github.com/trpc/trpc/issues/2611
|
|
21
21
|
**/
|
|
22
22
|
export function getArrayQueryKey(
|
|
23
|
-
queryKey:
|
|
23
|
+
queryKey: unknown[] | string | [string, ...unknown[]] | [string],
|
|
24
24
|
type: QueryType,
|
|
25
25
|
): QueryKey {
|
|
26
26
|
const queryKeyArrayed = Array.isArray(queryKey) ? queryKey : [queryKey];
|
|
@@ -15,7 +15,7 @@ import { DecoratedProcedureRecord, DecorateProcedure } from '../shared';
|
|
|
15
15
|
export function getQueryKeyInternal(
|
|
16
16
|
path: string,
|
|
17
17
|
input: unknown,
|
|
18
|
-
): [string] | [string
|
|
18
|
+
): [string, unknown] | [string] {
|
|
19
19
|
if (path.length) return input === undefined ? [path] : [path, input];
|
|
20
20
|
return [] as unknown as [string];
|
|
21
21
|
}
|
|
@@ -43,8 +43,8 @@ type GetQueryParams<
|
|
|
43
43
|
|
|
44
44
|
type GetParams<
|
|
45
45
|
TProcedureOrRouter extends
|
|
46
|
-
| AnyQueryProcedure
|
|
47
46
|
| AnyMutationProcedure
|
|
47
|
+
| AnyQueryProcedure
|
|
48
48
|
| AnyRouter,
|
|
49
49
|
TPath extends string,
|
|
50
50
|
TFlags,
|
|
@@ -65,8 +65,8 @@ type GetParams<
|
|
|
65
65
|
|
|
66
66
|
type GetQueryKeyParams<
|
|
67
67
|
TProcedureOrRouter extends
|
|
68
|
-
| AnyQueryProcedure
|
|
69
68
|
| AnyMutationProcedure
|
|
69
|
+
| AnyQueryProcedure
|
|
70
70
|
| AnyRouter,
|
|
71
71
|
TPath extends string,
|
|
72
72
|
TFlags,
|
|
@@ -81,8 +81,8 @@ type GetQueryKeyParams<
|
|
|
81
81
|
*/
|
|
82
82
|
export function getQueryKey<
|
|
83
83
|
TProcedureOrRouter extends
|
|
84
|
-
| AnyQueryProcedure
|
|
85
84
|
| AnyMutationProcedure
|
|
85
|
+
| AnyQueryProcedure
|
|
86
86
|
| AnyRouter,
|
|
87
87
|
TPath extends string,
|
|
88
88
|
TFlags,
|
package/src/server/ssgProxy.ts
CHANGED
|
@@ -52,7 +52,7 @@ type DecorateProcedure<TProcedure extends AnyProcedure> = {
|
|
|
52
52
|
export type DecoratedProcedureSSGRecord<TRouter extends AnyRouter> = {
|
|
53
53
|
[TKey in keyof Filter<
|
|
54
54
|
TRouter['_def']['record'],
|
|
55
|
-
|
|
55
|
+
AnyQueryProcedure | AnyRouter
|
|
56
56
|
>]: TRouter['_def']['record'][TKey] extends AnyRouter
|
|
57
57
|
? DecoratedProcedureSSGRecord<TRouter['_def']['record'][TKey]>
|
|
58
58
|
: // utils only apply to queries
|
package/src/server/types.ts
CHANGED
|
@@ -16,8 +16,6 @@ interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
|
|
|
16
16
|
client: inferRouterProxyClient<TRouter>;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export type CreateServerSideHelpersOptions<TRouter extends AnyRouter> =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
) &
|
|
23
|
-
CreateTRPCReactQueryClientConfig;
|
|
19
|
+
export type CreateServerSideHelpersOptions<TRouter extends AnyRouter> =
|
|
20
|
+
CreateTRPCReactQueryClientConfig &
|
|
21
|
+
(CreateSSGHelpersExternal<TRouter> | CreateSSGHelpersInternal<TRouter>);
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
useQuery as __useQuery,
|
|
7
7
|
DehydratedState,
|
|
8
8
|
hashQueryKey,
|
|
9
|
-
QueryClient,
|
|
10
9
|
useQueryClient,
|
|
11
10
|
} from '@tanstack/react-query';
|
|
12
11
|
import { createTRPCClient, TRPCClientErrorLike } from '@trpc/client';
|
|
@@ -61,9 +60,7 @@ export function createRootHooks<
|
|
|
61
60
|
|
|
62
61
|
const Context = (config?.context ??
|
|
63
62
|
TRPCContext) as React.Context<ProviderContext>;
|
|
64
|
-
const ReactQueryContext = config?.reactQueryContext
|
|
65
|
-
QueryClient | undefined
|
|
66
|
-
>;
|
|
63
|
+
const ReactQueryContext = config?.reactQueryContext;
|
|
67
64
|
|
|
68
65
|
const createClient: CreateClient<TRouter> = (opts) => {
|
|
69
66
|
return createTRPCClient(opts);
|
|
@@ -83,7 +80,7 @@ export function createRootHooks<
|
|
|
83
80
|
abortOnUnmount,
|
|
84
81
|
queryClient,
|
|
85
82
|
client,
|
|
86
|
-
ssrContext: ssrContext
|
|
83
|
+
ssrContext: ssrContext ?? null,
|
|
87
84
|
ssrState,
|
|
88
85
|
fetchQuery: useCallback(
|
|
89
86
|
(pathAndInput, opts) => {
|
|
@@ -395,7 +392,7 @@ export function createRootHooks<
|
|
|
395
392
|
const optsRef = useRef<typeof opts>(opts);
|
|
396
393
|
optsRef.current = opts;
|
|
397
394
|
|
|
398
|
-
|
|
395
|
+
useEffect(() => {
|
|
399
396
|
if (!enabled) {
|
|
400
397
|
return;
|
|
401
398
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
useQuery as __useQuery,
|
|
7
7
|
DehydratedState,
|
|
8
8
|
hashQueryKey,
|
|
9
|
-
QueryClient,
|
|
10
9
|
useQueryClient,
|
|
11
10
|
} from '@tanstack/react-query';
|
|
12
11
|
import { createTRPCClient, TRPCClientErrorLike } from '@trpc/client';
|
|
@@ -95,9 +94,7 @@ function __createHooksInternal<
|
|
|
95
94
|
|
|
96
95
|
const Context = (config?.context ??
|
|
97
96
|
TRPCContext) as React.Context<ProviderContext>;
|
|
98
|
-
const ReactQueryContext = config?.reactQueryContext
|
|
99
|
-
QueryClient | undefined
|
|
100
|
-
>;
|
|
97
|
+
const ReactQueryContext = config?.reactQueryContext;
|
|
101
98
|
|
|
102
99
|
const createClient: CreateClient<TRouter> = (opts) => {
|
|
103
100
|
return createTRPCClient(opts);
|
|
@@ -117,7 +114,7 @@ function __createHooksInternal<
|
|
|
117
114
|
abortOnUnmount,
|
|
118
115
|
queryClient,
|
|
119
116
|
client,
|
|
120
|
-
ssrContext: ssrContext
|
|
117
|
+
ssrContext: ssrContext ?? null,
|
|
121
118
|
ssrState,
|
|
122
119
|
fetchQuery: useCallback(
|
|
123
120
|
(pathAndInput, opts) => {
|
|
@@ -303,7 +300,7 @@ function __createHooksInternal<
|
|
|
303
300
|
}
|
|
304
301
|
|
|
305
302
|
function useQuery<
|
|
306
|
-
TPath extends keyof TQueryValues
|
|
303
|
+
TPath extends string & keyof TQueryValues,
|
|
307
304
|
TQueryFnData = TQueryValues[TPath]['output'],
|
|
308
305
|
TData = TQueryValues[TPath]['output'],
|
|
309
306
|
>(
|
|
@@ -359,7 +356,7 @@ function __createHooksInternal<
|
|
|
359
356
|
}
|
|
360
357
|
|
|
361
358
|
function useMutation<
|
|
362
|
-
TPath extends keyof TMutationValues
|
|
359
|
+
TPath extends string & keyof TMutationValues,
|
|
363
360
|
TContext = unknown,
|
|
364
361
|
>(
|
|
365
362
|
path: TPath | [TPath],
|
|
@@ -420,7 +417,7 @@ function __createHooksInternal<
|
|
|
420
417
|
* ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠
|
|
421
418
|
*/
|
|
422
419
|
function useSubscription<
|
|
423
|
-
TPath extends keyof TSubscriptions
|
|
420
|
+
TPath extends string & keyof TSubscriptions,
|
|
424
421
|
TOutput extends inferSubscriptionOutput<TRouter, TPath>,
|
|
425
422
|
>(
|
|
426
423
|
pathAndInput: [
|
|
@@ -436,7 +433,7 @@ function __createHooksInternal<
|
|
|
436
433
|
const queryKey = hashQueryKey(pathAndInput);
|
|
437
434
|
const { client } = useContext();
|
|
438
435
|
|
|
439
|
-
|
|
436
|
+
useEffect(() => {
|
|
440
437
|
if (!enabled) {
|
|
441
438
|
return;
|
|
442
439
|
}
|
|
@@ -79,7 +79,7 @@ export interface DefinedUseTRPCQueryOptions<
|
|
|
79
79
|
TError,
|
|
80
80
|
TQueryOptsData
|
|
81
81
|
> {
|
|
82
|
-
initialData: TQueryOptsData |
|
|
82
|
+
initialData: InitialDataFunction<TQueryOptsData> | TQueryOptsData;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export interface TRPCQueryOptions<TPath, TInput, TData, TError>
|
|
@@ -137,8 +137,8 @@ export type CreateClient<TRouter extends AnyRouter> = (
|
|
|
137
137
|
/**
|
|
138
138
|
* @internal
|
|
139
139
|
*/
|
|
140
|
-
export type UseTRPCQueryResult<TData, TError> =
|
|
141
|
-
|
|
140
|
+
export type UseTRPCQueryResult<TData, TError> = TRPCHookResult &
|
|
141
|
+
UseQueryResult<TData, TError>;
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* @internal
|
|
@@ -158,11 +158,8 @@ export type UseTRPCQuerySuccessResult<TData, TError> =
|
|
|
158
158
|
/**
|
|
159
159
|
* @internal
|
|
160
160
|
*/
|
|
161
|
-
export type UseTRPCInfiniteQueryResult<TData, TError> =
|
|
162
|
-
TData,
|
|
163
|
-
TError
|
|
164
|
-
> &
|
|
165
|
-
TRPCHookResult;
|
|
161
|
+
export type UseTRPCInfiniteQueryResult<TData, TError> = TRPCHookResult &
|
|
162
|
+
UseInfiniteQueryResult<TData, TError>;
|
|
166
163
|
|
|
167
164
|
/**
|
|
168
165
|
* @internal
|
|
@@ -174,4 +171,4 @@ export type UseTRPCInfiniteQuerySuccessResult<TData, TError> =
|
|
|
174
171
|
* @internal
|
|
175
172
|
*/
|
|
176
173
|
export type UseTRPCMutationResult<TData, TError, TVariables, TContext> =
|
|
177
|
-
UseMutationResult<TData, TError, TVariables, TContext
|
|
174
|
+
TRPCHookResult & UseMutationResult<TData, TError, TVariables, TContext>;
|
|
@@ -42,7 +42,7 @@ export type UseQueriesProcedureRecord<
|
|
|
42
42
|
> = {
|
|
43
43
|
[TKey in keyof Filter<
|
|
44
44
|
TRouter['_def']['record'],
|
|
45
|
-
|
|
45
|
+
AnyQueryProcedure | AnyRouter
|
|
46
46
|
>]: TRouter['_def']['record'][TKey] extends AnyRouter
|
|
47
47
|
? UseQueriesProcedureRecord<
|
|
48
48
|
TRouter['_def']['record'][TKey],
|