@trpc/react-query 10.0.0-rc.4 → 10.0.0-rc.5
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-e7622f1b.mjs → createHooksInternal-026e76a9.mjs} +1 -1
- package/dist/{createHooksInternal-63a943bf.js → createHooksInternal-62a3b7fb.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.mjs +1 -1
- package/dist/shared/proxy/utilsProxy.d.ts +12 -13
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/shared/proxy/utilsProxy.ts +11 -20
|
@@ -71,7 +71,7 @@ const TRPCContext = /*#__PURE__*/ createContext(null);
|
|
|
71
71
|
'setData',
|
|
72
72
|
'setInfiniteData'
|
|
73
73
|
].includes(name)) {
|
|
74
|
-
const [
|
|
74
|
+
const [input, updater, ...rest] = args;
|
|
75
75
|
const queryKey = getQueryKey(fullPath, input);
|
|
76
76
|
return {
|
|
77
77
|
queryKey,
|
|
@@ -77,7 +77,7 @@ const TRPCContext = /*#__PURE__*/ React.createContext(null);
|
|
|
77
77
|
'setData',
|
|
78
78
|
'setInfiniteData'
|
|
79
79
|
].includes(name)) {
|
|
80
|
-
const [
|
|
80
|
+
const [input, updater, ...rest] = args;
|
|
81
81
|
const queryKey = getQueryKey(fullPath, input);
|
|
82
82
|
return {
|
|
83
83
|
queryKey,
|
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-62a3b7fb.js');
|
|
9
9
|
require('@tanstack/react-query');
|
|
10
10
|
require('./getArrayQueryKey-5ab807a3.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-026e76a9.mjs';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
6
|
import './getArrayQueryKey-e56d8d64.mjs';
|
|
7
7
|
|
package/dist/shared/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createHooksInternal = require('../createHooksInternal-
|
|
5
|
+
var createHooksInternal = require('../createHooksInternal-62a3b7fb.js');
|
|
6
6
|
var queryClient = require('../queryClient-358a9a75.js');
|
|
7
7
|
require('@trpc/server/shared');
|
|
8
8
|
require('@trpc/client');
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy } from '../createHooksInternal-
|
|
1
|
+
export { c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy } from '../createHooksInternal-026e76a9.mjs';
|
|
2
2
|
export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
3
3
|
import '@trpc/server/shared';
|
|
4
4
|
import '@trpc/client';
|
|
@@ -34,11 +34,15 @@ declare type DecorateProcedure<TRouter extends AnyRouter, TProcedure extends Any
|
|
|
34
34
|
/**
|
|
35
35
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydata
|
|
36
36
|
*/
|
|
37
|
-
setData(
|
|
37
|
+
setData(
|
|
38
|
+
/**
|
|
39
|
+
* The input of the procedure
|
|
40
|
+
*/
|
|
41
|
+
input: inferProcedureInput<TProcedure>, updater: Updater<inferProcedureOutput<TProcedure> | undefined, inferProcedureOutput<TProcedure> | undefined>, options?: SetDataOptions): void;
|
|
38
42
|
/**
|
|
39
43
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
40
44
|
*/
|
|
41
|
-
setInfiniteData(updater: Updater<InfiniteData<inferProcedureOutput<TProcedure>> | undefined, InfiniteData<inferProcedureOutput<TProcedure>> | undefined>,
|
|
45
|
+
setInfiniteData(input: inferProcedureInput<TProcedure>, updater: Updater<InfiniteData<inferProcedureOutput<TProcedure>> | undefined, InfiniteData<inferProcedureOutput<TProcedure>> | undefined>, options?: SetDataOptions): void;
|
|
42
46
|
/**
|
|
43
47
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
44
48
|
*/
|
|
@@ -48,29 +52,24 @@ declare type DecorateProcedure<TRouter extends AnyRouter, TProcedure extends Any
|
|
|
48
52
|
*/
|
|
49
53
|
getInfiniteData(input?: inferProcedureInput<TProcedure>): InfiniteData<inferProcedureOutput<TProcedure>> | undefined;
|
|
50
54
|
};
|
|
51
|
-
/**
|
|
52
|
-
* A type that will traverse all procedures and sub routers of a given router to create a union of
|
|
53
|
-
* their possible input types
|
|
54
|
-
*/
|
|
55
|
-
declare type InferAllRouterQueryInputTypes<TRouter extends AnyRouter> = {
|
|
56
|
-
[TKey in keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]: TRouter['_def']['record'][TKey] extends AnyQueryProcedure ? inferProcedureInput<TRouter['_def']['record'][TKey]> : InferAllRouterQueryInputTypes<TRouter['_def']['record'][TKey]>;
|
|
57
|
-
}[keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>];
|
|
58
55
|
/**
|
|
59
56
|
* this is the type that is used to add in procedures that can be used on
|
|
60
57
|
* an entire router
|
|
61
58
|
*/
|
|
62
|
-
declare type
|
|
59
|
+
declare type DecorateRouter = {
|
|
63
60
|
/**
|
|
61
|
+
* Invalidate the full router
|
|
62
|
+
* @link https://trpc.io/docs/v10/useContext#query-invalidation
|
|
64
63
|
* @link https://react-query.tanstack.com/guides/query-invalidation
|
|
65
64
|
*/
|
|
66
|
-
invalidate(
|
|
65
|
+
invalidate(filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise<void>;
|
|
67
66
|
};
|
|
68
67
|
/**
|
|
69
68
|
* @internal
|
|
70
69
|
*/
|
|
71
70
|
export declare type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> = {
|
|
72
|
-
[TKey in keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]: TRouter['_def']['record'][TKey] extends AnyRouter ? DecoratedProcedureUtilsRecord<TRouter['_def']['record'][TKey]> &
|
|
73
|
-
} &
|
|
71
|
+
[TKey in keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]: TRouter['_def']['record'][TKey] extends AnyRouter ? DecoratedProcedureUtilsRecord<TRouter['_def']['record'][TKey]> & DecorateRouter : DecorateProcedure<TRouter, TRouter['_def']['record'][TKey]>;
|
|
72
|
+
} & DecorateRouter;
|
|
74
73
|
export declare type CreateReactUtilsProxy<TRouter extends AnyRouter, TSSRContext> = DecoratedProcedureUtilsRecord<TRouter> & DecoratedProxyTRPCContextProps<TRouter, TSSRContext>;
|
|
75
74
|
/**
|
|
76
75
|
* @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,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,OAAO,EACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAyB,MAAM,cAAc,CAAC;AACtE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,E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A6B,CAAC,OAAO,SAAS,SAAS,IAAI;KACpE,IAAI,IAAI,MAAM,MAAM,CACnB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACzB,SAAS,GAAG,iBAAiB,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,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;CAChE,GAAG,cAAc,CAAC;AAInB,oBAAY,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,WAAW,IACT,6BAA6B,CAAC,OAAO,CAAC,GACxC,8BAA8B,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAEvD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,SAAS,SAAS,EACzB,WAAW,EACX,OAAO,EAAE,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,+CAiE9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "10.0.0-rc.
|
|
3
|
+
"version": "10.0.0-rc.5",
|
|
4
4
|
"description": "tRPC React lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@tanstack/react-query": "^4.3.8",
|
|
57
|
-
"@trpc/client": "10.0.0-rc.
|
|
58
|
-
"@trpc/server": "10.0.0-rc.
|
|
57
|
+
"@trpc/client": "10.0.0-rc.5",
|
|
58
|
+
"@trpc/server": "10.0.0-rc.5",
|
|
59
59
|
"react": ">=16.8.0",
|
|
60
60
|
"react-dom": ">=16.8.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@tanstack/react-query": "^4.3.8",
|
|
64
|
-
"@trpc/client": "10.0.0-rc.
|
|
65
|
-
"@trpc/server": "10.0.0-rc.
|
|
64
|
+
"@trpc/client": "10.0.0-rc.5",
|
|
65
|
+
"@trpc/server": "10.0.0-rc.5",
|
|
66
66
|
"@types/express": "^4.17.12",
|
|
67
67
|
"@types/node": "^18.7.20",
|
|
68
68
|
"express": "^4.17.1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "9054b0a7c5b025e2daa44fa4c612176d045b1493"
|
|
80
80
|
}
|
|
@@ -110,11 +110,14 @@ type DecorateProcedure<
|
|
|
110
110
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydata
|
|
111
111
|
*/
|
|
112
112
|
setData(
|
|
113
|
+
/**
|
|
114
|
+
* The input of the procedure
|
|
115
|
+
*/
|
|
116
|
+
input: inferProcedureInput<TProcedure>,
|
|
113
117
|
updater: Updater<
|
|
114
118
|
inferProcedureOutput<TProcedure> | undefined,
|
|
115
119
|
inferProcedureOutput<TProcedure> | undefined
|
|
116
120
|
>,
|
|
117
|
-
input?: inferProcedureInput<TProcedure>,
|
|
118
121
|
options?: SetDataOptions,
|
|
119
122
|
): void;
|
|
120
123
|
|
|
@@ -122,11 +125,11 @@ type DecorateProcedure<
|
|
|
122
125
|
* @link https://react-query.tanstack.com/reference/QueryClient#queryclientgetquerydata
|
|
123
126
|
*/
|
|
124
127
|
setInfiniteData(
|
|
128
|
+
input: inferProcedureInput<TProcedure>,
|
|
125
129
|
updater: Updater<
|
|
126
130
|
InfiniteData<inferProcedureOutput<TProcedure>> | undefined,
|
|
127
131
|
InfiniteData<inferProcedureOutput<TProcedure>> | undefined
|
|
128
132
|
>,
|
|
129
|
-
input?: inferProcedureInput<TProcedure>,
|
|
130
133
|
options?: SetDataOptions,
|
|
131
134
|
): void;
|
|
132
135
|
|
|
@@ -145,29 +148,17 @@ type DecorateProcedure<
|
|
|
145
148
|
): InfiniteData<inferProcedureOutput<TProcedure>> | undefined;
|
|
146
149
|
};
|
|
147
150
|
|
|
148
|
-
/**
|
|
149
|
-
* A type that will traverse all procedures and sub routers of a given router to create a union of
|
|
150
|
-
* their possible input types
|
|
151
|
-
*/
|
|
152
|
-
type InferAllRouterQueryInputTypes<TRouter extends AnyRouter> = {
|
|
153
|
-
[TKey in keyof Filter<
|
|
154
|
-
TRouter['_def']['record'],
|
|
155
|
-
AnyRouter | AnyQueryProcedure
|
|
156
|
-
>]: TRouter['_def']['record'][TKey] extends AnyQueryProcedure
|
|
157
|
-
? inferProcedureInput<TRouter['_def']['record'][TKey]>
|
|
158
|
-
: InferAllRouterQueryInputTypes<TRouter['_def']['record'][TKey]>; // Recurse as we have a sub router!
|
|
159
|
-
}[keyof Filter<TRouter['_def']['record'], AnyRouter | AnyQueryProcedure>]; // This flattens results into a big union
|
|
160
|
-
|
|
161
151
|
/**
|
|
162
152
|
* this is the type that is used to add in procedures that can be used on
|
|
163
153
|
* an entire router
|
|
164
154
|
*/
|
|
165
|
-
type
|
|
155
|
+
type DecorateRouter = {
|
|
166
156
|
/**
|
|
157
|
+
* Invalidate the full router
|
|
158
|
+
* @link https://trpc.io/docs/v10/useContext#query-invalidation
|
|
167
159
|
* @link https://react-query.tanstack.com/guides/query-invalidation
|
|
168
160
|
*/
|
|
169
161
|
invalidate(
|
|
170
|
-
input?: Partial<InferAllRouterQueryInputTypes<TRouter>>,
|
|
171
162
|
filters?: InvalidateQueryFilters,
|
|
172
163
|
options?: InvalidateOptions,
|
|
173
164
|
): Promise<void>;
|
|
@@ -182,10 +173,10 @@ export type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> = {
|
|
|
182
173
|
AnyRouter | AnyQueryProcedure
|
|
183
174
|
>]: TRouter['_def']['record'][TKey] extends AnyRouter
|
|
184
175
|
? DecoratedProcedureUtilsRecord<TRouter['_def']['record'][TKey]> &
|
|
185
|
-
|
|
176
|
+
DecorateRouter
|
|
186
177
|
: // utils only apply to queries
|
|
187
178
|
DecorateProcedure<TRouter, TRouter['_def']['record'][TKey]>;
|
|
188
|
-
} &
|
|
179
|
+
} & DecorateRouter; // Add functions that should be available at utils root
|
|
189
180
|
|
|
190
181
|
type AnyDecoratedProcedure = DecorateProcedure<any, any>;
|
|
191
182
|
|
|
@@ -224,7 +215,7 @@ export function createReactQueryUtilsProxy<
|
|
|
224
215
|
|
|
225
216
|
const getOpts = (name: typeof utilName) => {
|
|
226
217
|
if (['setData', 'setInfiniteData'].includes(name)) {
|
|
227
|
-
const [
|
|
218
|
+
const [input, updater, ...rest] = args as Parameters<
|
|
228
219
|
AnyDecoratedProcedure[typeof utilName]
|
|
229
220
|
>;
|
|
230
221
|
const queryKey = getQueryKey(fullPath, input);
|