@trpc/react-query 11.0.0-alpha-tmp-workflow-merge.250 → 11.0.0-alpha-tmp-01-26-rootconfigtypes.261

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.
Files changed (68) hide show
  1. package/dist/bundle-analysis.json +36 -36
  2. package/dist/createTRPCQueryUtils.d.ts +1 -1
  3. package/dist/createTRPCQueryUtils.d.ts.map +1 -1
  4. package/dist/createTRPCQueryUtils.js +1 -1
  5. package/dist/createTRPCQueryUtils.mjs +1 -1
  6. package/dist/createTRPCReact.d.ts +19 -19
  7. package/dist/createTRPCReact.d.ts.map +1 -1
  8. package/dist/createTRPCReact.js +2 -2
  9. package/dist/createTRPCReact.mjs +1 -1
  10. package/dist/internals/context.d.ts +1 -1
  11. package/dist/internals/context.d.ts.map +1 -1
  12. package/dist/internals/getQueryKey.d.ts +7 -7
  13. package/dist/internals/getQueryKey.d.ts.map +1 -1
  14. package/dist/internals/useQueries.d.ts +1 -1
  15. package/dist/internals/useQueries.d.ts.map +1 -1
  16. package/dist/server/ssgProxy.d.ts +7 -7
  17. package/dist/server/ssgProxy.d.ts.map +1 -1
  18. package/dist/server/ssgProxy.js +4 -4
  19. package/dist/server/ssgProxy.mjs +1 -1
  20. package/dist/shared/hooks/createHooksInternal.d.ts +1 -1
  21. package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
  22. package/dist/shared/hooks/types.d.ts +1 -1
  23. package/dist/shared/hooks/types.d.ts.map +1 -1
  24. package/dist/shared/polymorphism/mutationLike.d.ts +4 -4
  25. package/dist/shared/polymorphism/mutationLike.d.ts.map +1 -1
  26. package/dist/shared/polymorphism/queryLike.d.ts +5 -5
  27. package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
  28. package/dist/shared/polymorphism/routerLike.d.ts +4 -4
  29. package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
  30. package/dist/shared/polymorphism/utilsLike.d.ts +1 -1
  31. package/dist/shared/polymorphism/utilsLike.d.ts.map +1 -1
  32. package/dist/shared/proxy/decorationProxy.d.ts +1 -1
  33. package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
  34. package/dist/shared/proxy/decorationProxy.js +2 -2
  35. package/dist/shared/proxy/decorationProxy.mjs +1 -1
  36. package/dist/shared/proxy/useQueriesProxy.d.ts +5 -5
  37. package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
  38. package/dist/shared/proxy/useQueriesProxy.js +2 -2
  39. package/dist/shared/proxy/useQueriesProxy.mjs +1 -1
  40. package/dist/shared/proxy/utilsProxy.d.ts +13 -13
  41. package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
  42. package/dist/shared/proxy/utilsProxy.js +4 -4
  43. package/dist/shared/proxy/utilsProxy.mjs +1 -1
  44. package/dist/shared/types.d.ts +1 -1
  45. package/dist/shared/types.d.ts.map +1 -1
  46. package/dist/utils/createUtilityFunctions.d.ts +1 -1
  47. package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
  48. package/dist/utils/inferReactQueryProcedure.d.ts +6 -6
  49. package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
  50. package/package.json +6 -7
  51. package/src/createTRPCQueryUtils.tsx +1 -1
  52. package/src/createTRPCReact.tsx +46 -46
  53. package/src/internals/context.tsx +4 -1
  54. package/src/internals/getQueryKey.ts +10 -10
  55. package/src/internals/useQueries.ts +4 -1
  56. package/src/server/ssgProxy.ts +15 -15
  57. package/src/shared/hooks/createHooksInternal.tsx +1 -1
  58. package/src/shared/hooks/types.ts +4 -1
  59. package/src/shared/polymorphism/mutationLike.ts +7 -7
  60. package/src/shared/polymorphism/queryLike.ts +9 -9
  61. package/src/shared/polymorphism/routerLike.ts +7 -7
  62. package/src/shared/polymorphism/utilsLike.ts +1 -1
  63. package/src/shared/proxy/decorationProxy.ts +2 -2
  64. package/src/shared/proxy/useQueriesProxy.ts +17 -17
  65. package/src/shared/proxy/utilsProxy.ts +28 -25
  66. package/src/shared/types.ts +4 -1
  67. package/src/utils/createUtilityFunctions.ts +1 -1
  68. package/src/utils/inferReactQueryProcedure.ts +24 -18
@@ -3,13 +3,13 @@ import type { TRPCClientError, TRPCUntypedClient } from '@trpc/client';
3
3
  import type {
4
4
  AnyProcedure,
5
5
  AnyQueryProcedure,
6
- AnyRootConfig,
6
+ AnyRootTypes,
7
7
  AnyRouter,
8
8
  Filter,
9
9
  inferProcedureInput,
10
10
  inferTransformedProcedureOutput,
11
- } from '@trpc/core';
12
- import { createRecursiveProxy } from '@trpc/core';
11
+ } from '@trpc/server/unstable-core-do-not-import';
12
+ import { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';
13
13
  import { getQueryKeyInternal } from '../../internals/getQueryKey';
14
14
  import type {
15
15
  TrpcQueryOptionsForUseQueries,
@@ -18,19 +18,19 @@ import type {
18
18
  import type { TRPCUseQueryBaseOptions } from '../hooks/types';
19
19
 
20
20
  type GetQueryOptions<
21
- TConfig extends AnyRootConfig,
21
+ TRoot extends AnyRootTypes,
22
22
  TProcedure extends AnyProcedure,
23
- > = <TData = inferTransformedProcedureOutput<TConfig, TProcedure>>(
23
+ > = <TData = inferTransformedProcedureOutput<TRoot, TProcedure>>(
24
24
  input: inferProcedureInput<TProcedure>,
25
25
  opts?: TrpcQueryOptionsForUseQueries<
26
- inferTransformedProcedureOutput<TConfig, TProcedure>,
26
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
27
27
  TData,
28
- TRPCClientError<TConfig>
28
+ TRPCClientError<TRoot>
29
29
  >,
30
30
  ) => TrpcQueryOptionsForUseQueries<
31
- inferTransformedProcedureOutput<TConfig, TProcedure>,
31
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
32
32
  TData,
33
- TRPCClientError<TConfig>
33
+ TRPCClientError<TRoot>
34
34
  >;
35
35
 
36
36
  /**
@@ -43,25 +43,25 @@ export type UseQueriesProcedureRecord<TRouter extends AnyRouter> = {
43
43
  >]: TRouter['_def']['record'][TKey] extends AnyRouter
44
44
  ? UseQueriesProcedureRecord<TRouter['_def']['record'][TKey]>
45
45
  : GetQueryOptions<
46
- TRouter['_def']['_config'],
46
+ TRouter['_def']['_config']['$types'],
47
47
  TRouter['_def']['record'][TKey]
48
48
  >;
49
49
  };
50
50
 
51
51
  type GetSuspenseQueryOptions<
52
- TConfig extends AnyRootConfig,
52
+ TRoot extends AnyRootTypes,
53
53
  TProcedure extends AnyProcedure,
54
- > = <TData = inferTransformedProcedureOutput<TConfig, TProcedure>>(
54
+ > = <TData = inferTransformedProcedureOutput<TRoot, TProcedure>>(
55
55
  input: inferProcedureInput<TProcedure>,
56
56
  opts?: TrpcQueryOptionsForUseSuspenseQueries<
57
- inferTransformedProcedureOutput<TConfig, TProcedure>,
57
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
58
58
  TData,
59
- TRPCClientError<TConfig>
59
+ TRPCClientError<TRoot>
60
60
  >,
61
61
  ) => TrpcQueryOptionsForUseSuspenseQueries<
62
- inferTransformedProcedureOutput<TConfig, TProcedure>,
62
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
63
63
  TData,
64
- TRPCClientError<TConfig>
64
+ TRPCClientError<TRoot>
65
65
  >;
66
66
 
67
67
  /**
@@ -74,7 +74,7 @@ export type UseSuspenseQueriesProcedureRecord<TRouter extends AnyRouter> = {
74
74
  >]: TRouter['_def']['record'][TKey] extends AnyRouter
75
75
  ? UseSuspenseQueriesProcedureRecord<TRouter['_def']['record'][TKey]>
76
76
  : GetSuspenseQueryOptions<
77
- TRouter['_def']['_config'],
77
+ TRouter['_def']['_config']['$types'],
78
78
  TRouter['_def']['record'][TKey]
79
79
  >;
80
80
  };
@@ -14,15 +14,18 @@ import type { TRPCClientError } from '@trpc/client';
14
14
  import { createTRPCClientProxy } from '@trpc/client';
15
15
  import type {
16
16
  AnyQueryProcedure,
17
- AnyRootConfig,
17
+ AnyRootTypes,
18
18
  AnyRouter,
19
19
  DeepPartial,
20
20
  Filter,
21
21
  inferProcedureInput,
22
22
  inferTransformedProcedureOutput,
23
23
  ProtectedIntersection,
24
- } from '@trpc/core';
25
- import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
24
+ } from '@trpc/server/unstable-core-do-not-import';
25
+ import {
26
+ createFlatProxy,
27
+ createRecursiveProxy,
28
+ } from '@trpc/server/unstable-core-do-not-import';
26
29
  import type {
27
30
  DecoratedTRPCContextProps,
28
31
  TRPCContextState,
@@ -36,7 +39,7 @@ import { getQueryKeyInternal } from '../../internals/getQueryKey';
36
39
  import type { ExtractCursorType } from '../hooks/types';
37
40
 
38
41
  type DecorateProcedure<
39
- TConfig extends AnyRootConfig,
42
+ TRoot extends AnyRootTypes,
40
43
  TProcedure extends AnyQueryProcedure,
41
44
  > = {
42
45
  /**
@@ -45,10 +48,10 @@ type DecorateProcedure<
45
48
  fetch(
46
49
  input: inferProcedureInput<TProcedure>,
47
50
  opts?: TRPCFetchQueryOptions<
48
- inferTransformedProcedureOutput<TConfig, TProcedure>,
49
- TRPCClientError<TConfig>
51
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
52
+ TRPCClientError<TRoot>
50
53
  >,
51
- ): Promise<inferTransformedProcedureOutput<TConfig, TProcedure>>;
54
+ ): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
52
55
 
53
56
  /**
54
57
  * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery
@@ -57,12 +60,12 @@ type DecorateProcedure<
57
60
  input: inferProcedureInput<TProcedure>,
58
61
  opts?: TRPCFetchInfiniteQueryOptions<
59
62
  inferProcedureInput<TProcedure>,
60
- inferTransformedProcedureOutput<TConfig, TProcedure>,
61
- TRPCClientError<TConfig>
63
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
64
+ TRPCClientError<TRoot>
62
65
  >,
63
66
  ): Promise<
64
67
  InfiniteData<
65
- inferTransformedProcedureOutput<TConfig, TProcedure>,
68
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
66
69
  NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null
67
70
  >
68
71
  >;
@@ -73,8 +76,8 @@ type DecorateProcedure<
73
76
  prefetch(
74
77
  input: inferProcedureInput<TProcedure>,
75
78
  opts?: TRPCFetchQueryOptions<
76
- inferTransformedProcedureOutput<TConfig, TProcedure>,
77
- TRPCClientError<TConfig>
79
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
80
+ TRPCClientError<TRoot>
78
81
  >,
79
82
  ): Promise<void>;
80
83
 
@@ -85,8 +88,8 @@ type DecorateProcedure<
85
88
  input: inferProcedureInput<TProcedure>,
86
89
  opts?: TRPCFetchInfiniteQueryOptions<
87
90
  inferProcedureInput<TProcedure>,
88
- inferTransformedProcedureOutput<TConfig, TProcedure>,
89
- TRPCClientError<TConfig>
91
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
92
+ TRPCClientError<TRoot>
90
93
  >,
91
94
  ): Promise<void>;
92
95
 
@@ -96,10 +99,10 @@ type DecorateProcedure<
96
99
  ensureData(
97
100
  input: inferProcedureInput<TProcedure>,
98
101
  opts?: TRPCFetchQueryOptions<
99
- inferTransformedProcedureOutput<TConfig, TProcedure>,
100
- TRPCClientError<TConfig>
102
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
103
+ TRPCClientError<TRoot>
101
104
  >,
102
- ): Promise<inferTransformedProcedureOutput<TConfig, TProcedure>>;
105
+ ): Promise<inferTransformedProcedureOutput<TRoot, TProcedure>>;
103
106
 
104
107
  /**
105
108
  * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientinvalidatequeries
@@ -110,7 +113,7 @@ type DecorateProcedure<
110
113
  predicate?: (
111
114
  query: Query<
112
115
  inferProcedureInput<TProcedure>,
113
- TRPCClientError<TConfig>,
116
+ TRPCClientError<TRoot>,
114
117
  inferProcedureInput<TProcedure>,
115
118
  QueryKeyKnown<
116
119
  inferProcedureInput<TProcedure>,
@@ -158,8 +161,8 @@ type DecorateProcedure<
158
161
  */
159
162
  input: inferProcedureInput<TProcedure>,
160
163
  updater: Updater<
161
- inferTransformedProcedureOutput<TConfig, TProcedure> | undefined,
162
- inferTransformedProcedureOutput<TConfig, TProcedure> | undefined
164
+ inferTransformedProcedureOutput<TRoot, TProcedure> | undefined,
165
+ inferTransformedProcedureOutput<TRoot, TProcedure> | undefined
163
166
  >,
164
167
  options?: SetDataOptions,
165
168
  ): void;
@@ -171,12 +174,12 @@ type DecorateProcedure<
171
174
  input: inferProcedureInput<TProcedure>,
172
175
  updater: Updater<
173
176
  | InfiniteData<
174
- inferTransformedProcedureOutput<TConfig, TProcedure>,
177
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
175
178
  NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null
176
179
  >
177
180
  | undefined,
178
181
  | InfiniteData<
179
- inferTransformedProcedureOutput<TConfig, TProcedure>,
182
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
180
183
  NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null
181
184
  >
182
185
  | undefined
@@ -189,7 +192,7 @@ type DecorateProcedure<
189
192
  */
190
193
  getData(
191
194
  input?: inferProcedureInput<TProcedure>,
192
- ): inferTransformedProcedureOutput<TConfig, TProcedure> | undefined;
195
+ ): inferTransformedProcedureOutput<TRoot, TProcedure> | undefined;
193
196
 
194
197
  /**
195
198
  * @link https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata
@@ -198,7 +201,7 @@ type DecorateProcedure<
198
201
  input?: inferProcedureInput<TProcedure>,
199
202
  ):
200
203
  | InfiniteData<
201
- inferTransformedProcedureOutput<TConfig, TProcedure>,
204
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
202
205
  NonNullable<ExtractCursorType<inferProcedureInput<TProcedure>>> | null
203
206
  >
204
207
  | undefined;
@@ -234,7 +237,7 @@ export type DecoratedProcedureUtilsRecord<TRouter extends AnyRouter> =
234
237
  DecorateRouter
235
238
  : // utils only apply to queries
236
239
  DecorateProcedure<
237
- TRouter['_def']['_config'],
240
+ TRouter['_def']['_config']['$types'],
238
241
  TRouter['_def']['record'][TKey]
239
242
  >;
240
243
  }; // Add functions that should be available at utils root
@@ -1,5 +1,8 @@
1
1
  import type { QueryClient } from '@tanstack/react-query';
2
- import type { AnyRouter, MaybePromise } from '@trpc/core';
2
+ import type {
3
+ AnyRouter,
4
+ MaybePromise,
5
+ } from '@trpc/server/unstable-core-do-not-import';
3
6
 
4
7
  /**
5
8
  * @internal
@@ -1,7 +1,7 @@
1
1
  import type { QueryClient } from '@tanstack/react-query';
2
2
  import type { CreateTRPCClient } from '@trpc/client';
3
3
  import { getUntypedClient, TRPCUntypedClient } from '@trpc/client';
4
- import type { AnyRouter } from '@trpc/core';
4
+ import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
5
5
  import { getClientArgs } from '../internals/getClientArgs';
6
6
  import type { TRPCQueryUtils } from '../shared';
7
7
 
@@ -3,11 +3,11 @@ import type {
3
3
  AnyMutationProcedure,
4
4
  AnyProcedure,
5
5
  AnyQueryProcedure,
6
- AnyRootConfig,
6
+ AnyRootTypes,
7
7
  AnyRouter,
8
8
  inferProcedureInput,
9
9
  inferTransformedProcedureOutput,
10
- } from '@trpc/core';
10
+ } from '@trpc/server/unstable-core-do-not-import';
11
11
  import type {
12
12
  UseTRPCMutationOptions,
13
13
  UseTRPCMutationResult,
@@ -19,14 +19,14 @@ import type {
19
19
  * @internal
20
20
  */
21
21
  export type InferQueryOptions<
22
- TConfig extends AnyRootConfig,
22
+ TRoot extends AnyRootTypes,
23
23
  TProcedure extends AnyProcedure,
24
- TData = inferTransformedProcedureOutput<TConfig, TProcedure>,
24
+ TData = inferTransformedProcedureOutput<TRoot, TProcedure>,
25
25
  > = Omit<
26
26
  UseTRPCQueryOptions<
27
- inferTransformedProcedureOutput<TConfig, TProcedure>,
28
- inferTransformedProcedureOutput<TConfig, TProcedure>,
29
- TRPCClientErrorLike<TConfig>,
27
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
28
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
29
+ TRPCClientErrorLike<TRoot>,
30
30
  TData
31
31
  >,
32
32
  'select'
@@ -36,35 +36,35 @@ export type InferQueryOptions<
36
36
  * @internal
37
37
  */
38
38
  export type InferMutationOptions<
39
- TConfig extends AnyRootConfig,
39
+ TRoot extends AnyRootTypes,
40
40
  TProcedure extends AnyProcedure,
41
41
  > = UseTRPCMutationOptions<
42
42
  inferProcedureInput<TProcedure>,
43
- TRPCClientErrorLike<TConfig>,
44
- inferTransformedProcedureOutput<TConfig, TProcedure>
43
+ TRPCClientErrorLike<TRoot>,
44
+ inferTransformedProcedureOutput<TRoot, TProcedure>
45
45
  >;
46
46
 
47
47
  /**
48
48
  * @internal
49
49
  */
50
50
  export type InferQueryResult<
51
- TConfig extends AnyRootConfig,
51
+ TRoot extends AnyRootTypes,
52
52
  TProcedure extends AnyProcedure,
53
53
  > = UseTRPCQueryResult<
54
- inferTransformedProcedureOutput<TConfig, TProcedure>,
55
- TRPCClientErrorLike<TConfig>
54
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
55
+ TRPCClientErrorLike<TRoot>
56
56
  >;
57
57
 
58
58
  /**
59
59
  * @internal
60
60
  */
61
61
  export type InferMutationResult<
62
- TConfig extends AnyRootConfig,
62
+ TRoot extends AnyRootTypes,
63
63
  TProcedure extends AnyProcedure,
64
64
  TContext = unknown,
65
65
  > = UseTRPCMutationResult<
66
- inferTransformedProcedureOutput<TConfig, TProcedure>,
67
- TRPCClientErrorLike<TConfig>,
66
+ inferTransformedProcedureOutput<TRoot, TProcedure>,
67
+ TRPCClientErrorLike<TRoot>,
68
68
  inferProcedureInput<TProcedure>,
69
69
  TContext
70
70
  >;
@@ -74,9 +74,15 @@ export type inferReactQueryProcedureOptions<TRouter extends AnyRouter> = {
74
74
  ? TRouterOrProcedure extends AnyRouter
75
75
  ? inferReactQueryProcedureOptions<TRouterOrProcedure>
76
76
  : TRouterOrProcedure extends AnyMutationProcedure
77
- ? InferMutationOptions<TRouter['_def']['_config'], TRouterOrProcedure>
77
+ ? InferMutationOptions<
78
+ TRouter['_def']['_config']['$types'],
79
+ TRouterOrProcedure
80
+ >
78
81
  : TRouterOrProcedure extends AnyQueryProcedure
79
- ? InferQueryOptions<TRouter['_def']['_config'], TRouterOrProcedure>
82
+ ? InferQueryOptions<
83
+ TRouter['_def']['_config']['$types'],
84
+ TRouterOrProcedure
85
+ >
80
86
  : never
81
87
  : never;
82
88
  };