@orpc/react 0.0.5 → 0.0.6
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/index.js.map +1 -1
- package/dist/src/general-hooks.d.ts +4 -4
- package/dist/src/general-hooks.d.ts.map +1 -1
- package/dist/src/general-utils.d.ts +13 -13
- package/dist/src/general-utils.d.ts.map +1 -1
- package/dist/src/procedure-hooks.d.ts +9 -9
- package/dist/src/procedure-hooks.d.ts.map +1 -1
- package/dist/src/procedure-utils.d.ts +18 -18
- package/dist/src/procedure-utils.d.ts.map +1 -1
- package/dist/src/react-hooks.d.ts +1 -1
- package/dist/src/react-hooks.d.ts.map +1 -1
- package/dist/src/react-utils.d.ts +1 -1
- package/dist/src/react-utils.d.ts.map +1 -1
- package/dist/src/use-queries/builder.d.ts +5 -5
- package/dist/src/use-queries/builder.d.ts.map +1 -1
- package/dist/src/use-queries/builders.d.ts +1 -1
- package/dist/src/use-queries/builders.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/general-hooks.ts +5 -5
- package/src/general-utils.ts +21 -21
- package/src/procedure-hooks.ts +18 -18
- package/src/procedure-utils.ts +29 -29
- package/src/react-hooks.ts +2 -2
- package/src/react-utils.ts +2 -2
- package/src/use-queries/builder.ts +8 -8
- package/src/use-queries/builders.ts +2 -2
package/src/general-utils.ts
CHANGED
@@ -26,14 +26,14 @@ import { getMutationKeyFromPath, getQueryKeyFromPath } from './tanstack-key'
|
|
26
26
|
export interface GeneralUtils<
|
27
27
|
TInputSchema extends Schema,
|
28
28
|
TOutputSchema extends Schema,
|
29
|
-
|
29
|
+
TFuncOutput extends SchemaOutput<TOutputSchema>,
|
30
30
|
> {
|
31
31
|
getQueriesData: (
|
32
32
|
filters?: OmitKeyof<
|
33
33
|
ORPCQueryFilters<PartialDeep<SchemaInput<TInputSchema>>>,
|
34
34
|
'queryType'
|
35
35
|
>,
|
36
|
-
) => [QueryKey, SchemaOutput<TOutputSchema,
|
36
|
+
) => [QueryKey, SchemaOutput<TOutputSchema, TFuncOutput> | undefined][]
|
37
37
|
getInfiniteQueriesData: (
|
38
38
|
filters?: OmitKeyof<
|
39
39
|
ORPCQueryFilters<PartialDeep<SchemaInputForInfiniteQuery<TInputSchema>>>,
|
@@ -43,7 +43,7 @@ export interface GeneralUtils<
|
|
43
43
|
QueryKey,
|
44
44
|
| undefined
|
45
45
|
| InfiniteData<
|
46
|
-
SchemaOutput<TOutputSchema,
|
46
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
47
47
|
SchemaInput<TInputSchema>['cursor']
|
48
48
|
>,
|
49
49
|
][]
|
@@ -54,11 +54,11 @@ export interface GeneralUtils<
|
|
54
54
|
'queryType'
|
55
55
|
>,
|
56
56
|
updater: Updater<
|
57
|
-
SchemaOutput<TOutputSchema,
|
58
|
-
SchemaOutput<TOutputSchema,
|
57
|
+
SchemaOutput<TOutputSchema, TFuncOutput> | undefined,
|
58
|
+
SchemaOutput<TOutputSchema, TFuncOutput> | undefined
|
59
59
|
>,
|
60
60
|
options?: SetDataOptions,
|
61
|
-
) => [QueryKey, SchemaOutput<TOutputSchema,
|
61
|
+
) => [QueryKey, SchemaOutput<TOutputSchema, TFuncOutput> | undefined][]
|
62
62
|
setInfiniteQueriesData: (
|
63
63
|
filters: OmitKeyof<
|
64
64
|
ORPCQueryFilters<PartialDeep<SchemaInputForInfiniteQuery<TInputSchema>>>,
|
@@ -66,12 +66,12 @@ export interface GeneralUtils<
|
|
66
66
|
>,
|
67
67
|
updater: Updater<
|
68
68
|
| InfiniteData<
|
69
|
-
SchemaOutput<TOutputSchema,
|
69
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
70
70
|
SchemaInput<TInputSchema>['cursor']
|
71
71
|
>
|
72
72
|
| undefined,
|
73
73
|
| InfiniteData<
|
74
|
-
SchemaOutput<TOutputSchema,
|
74
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
75
75
|
SchemaInput<TInputSchema>['cursor']
|
76
76
|
>
|
77
77
|
| undefined
|
@@ -81,7 +81,7 @@ export interface GeneralUtils<
|
|
81
81
|
QueryKey,
|
82
82
|
| undefined
|
83
83
|
| InfiniteData<
|
84
|
-
SchemaOutput<TOutputSchema,
|
84
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
85
85
|
SchemaInput<TInputSchema>['cursor']
|
86
86
|
>,
|
87
87
|
][]
|
@@ -119,7 +119,7 @@ export interface GeneralUtils<
|
|
119
119
|
'input' | 'queryKey'
|
120
120
|
>,
|
121
121
|
) => OmitKeyof<
|
122
|
-
QueryObserverOptions<SchemaOutput<TOutputSchema,
|
122
|
+
QueryObserverOptions<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
123
123
|
'queryKey'
|
124
124
|
>
|
125
125
|
getInfiniteQueryDefaults: (
|
@@ -129,10 +129,10 @@ export interface GeneralUtils<
|
|
129
129
|
>,
|
130
130
|
) => OmitKeyof<
|
131
131
|
QueryObserverOptions<
|
132
|
-
SchemaOutput<TOutputSchema,
|
132
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
133
133
|
DefaultError,
|
134
|
-
SchemaOutput<TOutputSchema,
|
135
|
-
InfiniteData<SchemaOutput<TOutputSchema,
|
134
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
135
|
+
InfiniteData<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
136
136
|
QueryKey,
|
137
137
|
SchemaInput<TInputSchema>['cursor']
|
138
138
|
>,
|
@@ -142,7 +142,7 @@ export interface GeneralUtils<
|
|
142
142
|
setQueryDefaults: (
|
143
143
|
options: Partial<
|
144
144
|
OmitKeyof<
|
145
|
-
QueryObserverOptions<SchemaOutput<TOutputSchema,
|
145
|
+
QueryObserverOptions<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
146
146
|
'queryKey'
|
147
147
|
>
|
148
148
|
>,
|
@@ -155,10 +155,10 @@ export interface GeneralUtils<
|
|
155
155
|
options: Partial<
|
156
156
|
OmitKeyof<
|
157
157
|
QueryObserverOptions<
|
158
|
-
SchemaOutput<TOutputSchema,
|
158
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
159
159
|
DefaultError,
|
160
|
-
SchemaOutput<TOutputSchema,
|
161
|
-
InfiniteData<SchemaOutput<TOutputSchema,
|
160
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
161
|
+
InfiniteData<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
162
162
|
QueryKey,
|
163
163
|
SchemaInput<TInputSchema>['cursor']
|
164
164
|
>,
|
@@ -174,14 +174,14 @@ export interface GeneralUtils<
|
|
174
174
|
getMutationDefaults: (
|
175
175
|
filters?: Pick<MutationFilters, 'mutationKey'>,
|
176
176
|
) => MutationObserverOptions<
|
177
|
-
SchemaOutput<TOutputSchema,
|
177
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
178
178
|
DefaultError,
|
179
179
|
SchemaInput<TInputSchema>
|
180
180
|
>
|
181
181
|
setMutationDefaults: (
|
182
182
|
options: OmitKeyof<
|
183
183
|
MutationObserverOptions<
|
184
|
-
SchemaOutput<TOutputSchema,
|
184
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
185
185
|
DefaultError,
|
186
186
|
SchemaInput<TInputSchema>
|
187
187
|
>,
|
@@ -205,11 +205,11 @@ export interface CreateGeneralUtilsOptions {
|
|
205
205
|
export function createGeneralUtils<
|
206
206
|
TInputSchema extends Schema = undefined,
|
207
207
|
TOutputSchema extends Schema = undefined,
|
208
|
-
|
208
|
+
TFuncOutput extends
|
209
209
|
SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,
|
210
210
|
>(
|
211
211
|
options: CreateGeneralUtilsOptions,
|
212
|
-
): GeneralUtils<TInputSchema, TOutputSchema,
|
212
|
+
): GeneralUtils<TInputSchema, TOutputSchema, TFuncOutput> {
|
213
213
|
return {
|
214
214
|
getQueriesData(filters) {
|
215
215
|
const { input, ...rest } = filters ?? {}
|
package/src/procedure-hooks.ts
CHANGED
@@ -36,13 +36,13 @@ import { getMutationKeyFromPath, getQueryKeyFromPath } from './tanstack-key'
|
|
36
36
|
export interface ProcedureHooks<
|
37
37
|
TInputSchema extends Schema,
|
38
38
|
TOutputSchema extends Schema,
|
39
|
-
|
39
|
+
TFuncOutput extends SchemaOutput<TOutputSchema>,
|
40
40
|
> {
|
41
|
-
useQuery: <USelectData = SchemaOutput<TOutputSchema,
|
41
|
+
useQuery: <USelectData = SchemaOutput<TOutputSchema, TFuncOutput>>(
|
42
42
|
input: SchemaInput<TInputSchema>,
|
43
43
|
options?: SetOptional<
|
44
44
|
UseQueryOptions<
|
45
|
-
SchemaOutput<TOutputSchema,
|
45
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
46
46
|
DefaultError,
|
47
47
|
USelectData
|
48
48
|
>,
|
@@ -51,17 +51,17 @@ export interface ProcedureHooks<
|
|
51
51
|
) => UseQueryResult<USelectData>
|
52
52
|
useInfiniteQuery: <
|
53
53
|
USelectData = InfiniteData<
|
54
|
-
SchemaOutput<TOutputSchema,
|
54
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
55
55
|
SchemaInput<TInputSchema>['cursor']
|
56
56
|
>,
|
57
57
|
>(
|
58
58
|
options: PartialOnUndefinedDeep<
|
59
59
|
SetOptional<
|
60
60
|
UseInfiniteQueryOptions<
|
61
|
-
SchemaOutput<TOutputSchema,
|
61
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
62
62
|
DefaultError,
|
63
63
|
USelectData,
|
64
|
-
SchemaOutput<TOutputSchema,
|
64
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
65
65
|
QueryKey,
|
66
66
|
SchemaInput<TInputSchema>['cursor']
|
67
67
|
>,
|
@@ -72,11 +72,11 @@ export interface ProcedureHooks<
|
|
72
72
|
>,
|
73
73
|
) => UseInfiniteQueryResult<USelectData>
|
74
74
|
|
75
|
-
useSuspenseQuery: <USelectData = SchemaOutput<TOutputSchema,
|
75
|
+
useSuspenseQuery: <USelectData = SchemaOutput<TOutputSchema, TFuncOutput>>(
|
76
76
|
input: SchemaInput<TInputSchema>,
|
77
77
|
options?: SetOptional<
|
78
78
|
UseSuspenseQueryOptions<
|
79
|
-
SchemaOutput<TOutputSchema,
|
79
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
80
80
|
DefaultError,
|
81
81
|
USelectData
|
82
82
|
>,
|
@@ -85,17 +85,17 @@ export interface ProcedureHooks<
|
|
85
85
|
) => UseSuspenseQueryResult<USelectData>
|
86
86
|
useSuspenseInfiniteQuery: <
|
87
87
|
USelectData = InfiniteData<
|
88
|
-
SchemaOutput<TOutputSchema,
|
88
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
89
89
|
SchemaInput<TInputSchema>['cursor']
|
90
90
|
>,
|
91
91
|
>(
|
92
92
|
options: PartialOnUndefinedDeep<
|
93
93
|
SetOptional<
|
94
94
|
UseSuspenseInfiniteQueryOptions<
|
95
|
-
SchemaOutput<TOutputSchema,
|
95
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
96
96
|
DefaultError,
|
97
97
|
USelectData,
|
98
|
-
SchemaOutput<TOutputSchema,
|
98
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
99
99
|
QueryKey,
|
100
100
|
SchemaInput<TInputSchema>['cursor']
|
101
101
|
>,
|
@@ -108,15 +108,15 @@ export interface ProcedureHooks<
|
|
108
108
|
|
109
109
|
usePrefetchQuery: (
|
110
110
|
input: SchemaInput<TInputSchema>,
|
111
|
-
options?: FetchQueryOptions<SchemaOutput<TOutputSchema,
|
111
|
+
options?: FetchQueryOptions<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
112
112
|
) => void
|
113
113
|
usePrefetchInfiniteQuery: (
|
114
114
|
options: PartialOnUndefinedDeep<
|
115
115
|
SetOptional<
|
116
116
|
FetchInfiniteQueryOptions<
|
117
|
-
SchemaOutput<TOutputSchema,
|
117
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
118
118
|
DefaultError,
|
119
|
-
SchemaOutput<TOutputSchema,
|
119
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
120
120
|
QueryKey,
|
121
121
|
SchemaInput<TInputSchema>['cursor']
|
122
122
|
>,
|
@@ -130,14 +130,14 @@ export interface ProcedureHooks<
|
|
130
130
|
useMutation: (
|
131
131
|
options?: SetOptional<
|
132
132
|
UseMutationOptions<
|
133
|
-
SchemaOutput<TOutputSchema,
|
133
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
134
134
|
DefaultError,
|
135
135
|
SchemaInput<TInputSchema>
|
136
136
|
>,
|
137
137
|
'mutationFn' | 'mutationKey'
|
138
138
|
>,
|
139
139
|
) => UseMutationResult<
|
140
|
-
SchemaOutput<TOutputSchema,
|
140
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
141
141
|
DefaultError,
|
142
142
|
SchemaInput<TInputSchema>
|
143
143
|
>
|
@@ -157,11 +157,11 @@ export interface CreateProcedureHooksOptions {
|
|
157
157
|
export function createProcedureHooks<
|
158
158
|
TInputSchema extends Schema = undefined,
|
159
159
|
TOutputSchema extends Schema = undefined,
|
160
|
-
|
160
|
+
TFuncOutput extends
|
161
161
|
SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,
|
162
162
|
>(
|
163
163
|
options: CreateProcedureHooksOptions,
|
164
|
-
): ProcedureHooks<TInputSchema, TOutputSchema,
|
164
|
+
): ProcedureHooks<TInputSchema, TOutputSchema, TFuncOutput> {
|
165
165
|
return {
|
166
166
|
[orpcPathSymbol as any]: options.path,
|
167
167
|
|
package/src/procedure-utils.ts
CHANGED
@@ -20,22 +20,22 @@ import { getQueryKeyFromPath } from './tanstack-key'
|
|
20
20
|
export interface ProcedureUtils<
|
21
21
|
TInputSchema extends Schema,
|
22
22
|
TOutputSchema extends Schema,
|
23
|
-
|
23
|
+
TFuncOutput extends SchemaOutput<TOutputSchema>,
|
24
24
|
> {
|
25
25
|
fetchQuery: (
|
26
26
|
input: SchemaInput<TInputSchema>,
|
27
27
|
options?: SetOptional<
|
28
|
-
FetchQueryOptions<SchemaOutput<TOutputSchema,
|
28
|
+
FetchQueryOptions<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
29
29
|
'queryKey' | 'queryFn'
|
30
30
|
>,
|
31
|
-
) => Promise<SchemaOutput<TOutputSchema,
|
31
|
+
) => Promise<SchemaOutput<TOutputSchema, TFuncOutput>>
|
32
32
|
fetchInfiniteQuery: (
|
33
33
|
options: PartialOnUndefinedDeep<
|
34
34
|
SetOptional<
|
35
35
|
FetchInfiniteQueryOptions<
|
36
|
-
SchemaOutput<TOutputSchema,
|
36
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
37
37
|
DefaultError,
|
38
|
-
SchemaOutput<TOutputSchema,
|
38
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
39
39
|
QueryKey,
|
40
40
|
SchemaInput<TInputSchema>['cursor']
|
41
41
|
>,
|
@@ -46,7 +46,7 @@ export interface ProcedureUtils<
|
|
46
46
|
>,
|
47
47
|
) => Promise<
|
48
48
|
InfiniteData<
|
49
|
-
SchemaOutput<TOutputSchema,
|
49
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
50
50
|
SchemaInput<TInputSchema>['cursor']
|
51
51
|
>
|
52
52
|
>
|
@@ -54,7 +54,7 @@ export interface ProcedureUtils<
|
|
54
54
|
prefetchQuery: (
|
55
55
|
input: SchemaInput<TInputSchema>,
|
56
56
|
options?: SetOptional<
|
57
|
-
FetchQueryOptions<SchemaOutput<TOutputSchema,
|
57
|
+
FetchQueryOptions<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
58
58
|
'queryKey' | 'queryFn'
|
59
59
|
>,
|
60
60
|
) => Promise<void>
|
@@ -62,9 +62,9 @@ export interface ProcedureUtils<
|
|
62
62
|
options: PartialOnUndefinedDeep<
|
63
63
|
SetOptional<
|
64
64
|
FetchInfiniteQueryOptions<
|
65
|
-
SchemaOutput<TOutputSchema,
|
65
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
66
66
|
DefaultError,
|
67
|
-
SchemaOutput<TOutputSchema,
|
67
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
68
68
|
QueryKey,
|
69
69
|
SchemaInput<TInputSchema>['cursor']
|
70
70
|
>,
|
@@ -77,11 +77,11 @@ export interface ProcedureUtils<
|
|
77
77
|
|
78
78
|
getQueryData: (
|
79
79
|
input: SchemaInput<TInputSchema>,
|
80
|
-
) => SchemaOutput<TOutputSchema,
|
80
|
+
) => SchemaOutput<TOutputSchema, TFuncOutput> | undefined
|
81
81
|
getInfiniteQueryData: (
|
82
82
|
input: SchemaInputForInfiniteQuery<TInputSchema>,
|
83
83
|
) => | InfiniteData<
|
84
|
-
SchemaOutput<TOutputSchema,
|
84
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
85
85
|
SchemaInput<TInputSchema>['cursor']
|
86
86
|
>
|
87
87
|
| undefined
|
@@ -89,17 +89,17 @@ export interface ProcedureUtils<
|
|
89
89
|
ensureQueryData: (
|
90
90
|
input: SchemaInput<TInputSchema>,
|
91
91
|
options?: SetOptional<
|
92
|
-
EnsureQueryDataOptions<SchemaOutput<TOutputSchema,
|
92
|
+
EnsureQueryDataOptions<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
93
93
|
'queryFn' | 'queryKey'
|
94
94
|
>,
|
95
|
-
) => Promise<SchemaOutput<TOutputSchema,
|
95
|
+
) => Promise<SchemaOutput<TOutputSchema, TFuncOutput>>
|
96
96
|
ensureInfiniteQueryData: (
|
97
97
|
options: PartialOnUndefinedDeep<
|
98
98
|
SetOptional<
|
99
99
|
EnsureInfiniteQueryDataOptions<
|
100
|
-
SchemaOutput<TOutputSchema,
|
100
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
101
101
|
DefaultError,
|
102
|
-
SchemaOutput<TOutputSchema,
|
102
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
103
103
|
QueryKey,
|
104
104
|
SchemaInput<TInputSchema>['cursor']
|
105
105
|
>,
|
@@ -110,19 +110,19 @@ export interface ProcedureUtils<
|
|
110
110
|
>,
|
111
111
|
) => Promise<
|
112
112
|
InfiniteData<
|
113
|
-
SchemaOutput<TOutputSchema,
|
113
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
114
114
|
SchemaInput<TInputSchema>['cursor']
|
115
115
|
>
|
116
116
|
>
|
117
117
|
|
118
118
|
getQueryState: (
|
119
119
|
input: SchemaInput<TInputSchema>,
|
120
|
-
) => QueryState<SchemaOutput<TOutputSchema,
|
120
|
+
) => QueryState<SchemaOutput<TOutputSchema, TFuncOutput>> | undefined
|
121
121
|
getInfiniteQueryState: (
|
122
122
|
input: SchemaInputForInfiniteQuery<TInputSchema>,
|
123
123
|
) => | QueryState<
|
124
124
|
InfiniteData<
|
125
|
-
SchemaOutput<TOutputSchema,
|
125
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
126
126
|
SchemaInput<TInputSchema>['cursor']
|
127
127
|
>
|
128
128
|
>
|
@@ -131,28 +131,28 @@ export interface ProcedureUtils<
|
|
131
131
|
setQueryData: (
|
132
132
|
input: SchemaInput<TInputSchema>,
|
133
133
|
updater: Updater<
|
134
|
-
SchemaOutput<TOutputSchema,
|
135
|
-
SchemaOutput<TOutputSchema,
|
134
|
+
SchemaOutput<TOutputSchema, TFuncOutput> | undefined,
|
135
|
+
SchemaOutput<TOutputSchema, TFuncOutput> | undefined
|
136
136
|
>,
|
137
137
|
options?: SetDataOptions,
|
138
|
-
) => SchemaOutput<TOutputSchema,
|
138
|
+
) => SchemaOutput<TOutputSchema, TFuncOutput> | undefined
|
139
139
|
setInfiniteQueryData: (
|
140
140
|
input: SchemaInputForInfiniteQuery<TInputSchema>,
|
141
141
|
updater: Updater<
|
142
142
|
| InfiniteData<
|
143
|
-
SchemaOutput<TOutputSchema,
|
143
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
144
144
|
SchemaInput<TInputSchema>['cursor']
|
145
145
|
>
|
146
146
|
| undefined,
|
147
147
|
| InfiniteData<
|
148
|
-
SchemaOutput<TOutputSchema,
|
148
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
149
149
|
SchemaInput<TInputSchema>['cursor']
|
150
150
|
>
|
151
151
|
| undefined
|
152
152
|
>,
|
153
153
|
options?: SetDataOptions,
|
154
154
|
) => | InfiniteData<
|
155
|
-
SchemaOutput<TOutputSchema,
|
155
|
+
SchemaOutput<TOutputSchema, TFuncOutput>,
|
156
156
|
SchemaInput<TInputSchema>['cursor']
|
157
157
|
>
|
158
158
|
| undefined
|
@@ -161,10 +161,10 @@ export interface ProcedureUtils<
|
|
161
161
|
export interface CreateProcedureUtilsOptions<
|
162
162
|
TInputSchema extends Schema = undefined,
|
163
163
|
TOutputSchema extends Schema = undefined,
|
164
|
-
|
164
|
+
TFuncOutput extends
|
165
165
|
SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,
|
166
166
|
> {
|
167
|
-
client: ProcedureClient<TInputSchema, TOutputSchema,
|
167
|
+
client: ProcedureClient<TInputSchema, TOutputSchema, TFuncOutput>
|
168
168
|
queryClient: QueryClient
|
169
169
|
|
170
170
|
/**
|
@@ -176,14 +176,14 @@ export interface CreateProcedureUtilsOptions<
|
|
176
176
|
export function createProcedureUtils<
|
177
177
|
TInputSchema extends Schema,
|
178
178
|
TOutputSchema extends Schema,
|
179
|
-
|
179
|
+
TFuncOutput extends SchemaOutput<TOutputSchema>,
|
180
180
|
>(
|
181
181
|
options: CreateProcedureUtilsOptions<
|
182
182
|
TInputSchema,
|
183
183
|
TOutputSchema,
|
184
|
-
|
184
|
+
TFuncOutput
|
185
185
|
>,
|
186
|
-
): ProcedureUtils<TInputSchema, TOutputSchema,
|
186
|
+
): ProcedureUtils<TInputSchema, TOutputSchema, TFuncOutput> {
|
187
187
|
return {
|
188
188
|
fetchQuery(input, options_) {
|
189
189
|
return options.queryClient.fetchQuery({
|
package/src/react-hooks.ts
CHANGED
@@ -21,8 +21,8 @@ export type ORPCHooksWithContractRouter<TRouter extends ContractRouter> = {
|
|
21
21
|
} & GeneralHooks<undefined, undefined, unknown>
|
22
22
|
|
23
23
|
export type ORPCHooksWithRouter<TRouter extends Router<any>> = {
|
24
|
-
[K in keyof TRouter]: TRouter[K] extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer
|
25
|
-
? ProcedureHooks<UInputSchema, UOutputSchema,
|
24
|
+
[K in keyof TRouter]: TRouter[K] extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput>
|
25
|
+
? ProcedureHooks<UInputSchema, UOutputSchema, UFuncOutput> & GeneralHooks<UInputSchema, UOutputSchema, UFuncOutput>
|
26
26
|
: TRouter[K] extends Router<any>
|
27
27
|
? ORPCHooksWithRouter<TRouter[K]>
|
28
28
|
: never
|
package/src/react-utils.ts
CHANGED
@@ -18,8 +18,8 @@ export type ORPCUtilsWithContractRouter<TRouter extends ContractRouter> = {
|
|
18
18
|
} & GeneralUtils<undefined, undefined, unknown>
|
19
19
|
|
20
20
|
export type ORPCUtilsWithRouter<TRouter extends Router<any>> = {
|
21
|
-
[K in keyof TRouter]: TRouter[K] extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer
|
22
|
-
? ProcedureUtils<UInputSchema, UOutputSchema,
|
21
|
+
[K in keyof TRouter]: TRouter[K] extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput>
|
22
|
+
? ProcedureUtils<UInputSchema, UOutputSchema, UFuncOutput> & GeneralUtils<UInputSchema, UOutputSchema, UFuncOutput>
|
23
23
|
: TRouter[K] extends Router<any>
|
24
24
|
? ORPCUtilsWithRouter<TRouter[K]>
|
25
25
|
: never
|
@@ -25,23 +25,23 @@ type UseQueryOptionsForUseQueries<
|
|
25
25
|
export interface UseQueriesBuilder<
|
26
26
|
TInputSchema extends Schema,
|
27
27
|
TOutputSchema extends Schema,
|
28
|
-
|
28
|
+
TFuncOutput extends SchemaOutput<TOutputSchema>,
|
29
29
|
> {
|
30
30
|
(
|
31
31
|
input: SchemaInput<TInputSchema>,
|
32
32
|
options?: SetOptional<
|
33
|
-
UseQueryOptionsForUseQueries<SchemaOutput<TOutputSchema,
|
33
|
+
UseQueryOptionsForUseQueries<SchemaOutput<TOutputSchema, TFuncOutput>>,
|
34
34
|
'queryFn' | 'queryKey'
|
35
35
|
>,
|
36
|
-
): UseQueryOptionsForUseQueries<SchemaOutput<TOutputSchema,
|
36
|
+
): UseQueryOptionsForUseQueries<SchemaOutput<TOutputSchema, TFuncOutput>>
|
37
37
|
}
|
38
38
|
|
39
39
|
export interface CreateUseQueriesBuilderOptions<
|
40
40
|
TInputSchema extends Schema,
|
41
41
|
TOutputSchema extends Schema,
|
42
|
-
|
42
|
+
TFuncOutput extends SchemaOutput<TOutputSchema>,
|
43
43
|
> {
|
44
|
-
client: ProcedureClient<TInputSchema, TOutputSchema,
|
44
|
+
client: ProcedureClient<TInputSchema, TOutputSchema, TFuncOutput>
|
45
45
|
|
46
46
|
/**
|
47
47
|
* The path of procedure on server
|
@@ -52,15 +52,15 @@ export interface CreateUseQueriesBuilderOptions<
|
|
52
52
|
export function createUseQueriesBuilder<
|
53
53
|
TInputSchema extends Schema = undefined,
|
54
54
|
TOutputSchema extends Schema = undefined,
|
55
|
-
|
55
|
+
TFuncOutput extends
|
56
56
|
SchemaOutput<TOutputSchema> = SchemaOutput<TOutputSchema>,
|
57
57
|
>(
|
58
58
|
options: CreateUseQueriesBuilderOptions<
|
59
59
|
TInputSchema,
|
60
60
|
TOutputSchema,
|
61
|
-
|
61
|
+
TFuncOutput
|
62
62
|
>,
|
63
|
-
): UseQueriesBuilder<TInputSchema, TOutputSchema,
|
63
|
+
): UseQueriesBuilder<TInputSchema, TOutputSchema, TFuncOutput> {
|
64
64
|
return (input, options_) => {
|
65
65
|
return {
|
66
66
|
queryKey: getQueryKeyFromPath(options.path, { input, type: 'query' }),
|
@@ -34,9 +34,9 @@ export type UseQueriesBuildersWithRouter<TRouter extends Router<any>> = {
|
|
34
34
|
any,
|
35
35
|
infer UInputSchema,
|
36
36
|
infer UOutputSchema,
|
37
|
-
infer
|
37
|
+
infer UFuncOutput
|
38
38
|
>
|
39
|
-
? UseQueriesBuilder<UInputSchema, UOutputSchema,
|
39
|
+
? UseQueriesBuilder<UInputSchema, UOutputSchema, UFuncOutput>
|
40
40
|
: TRouter[K] extends Router<any>
|
41
41
|
? UseQueriesBuildersWithRouter<TRouter[K]>
|
42
42
|
: never
|