@orpc/tanstack-query 1.11.2 → 1.12.0
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.d.mts +79 -6
- package/dist/index.d.ts +79 -6
- package/dist/index.mjs +20 -3
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
2
|
import { Promisable, SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
-
import { QueryKey, QueryFunctionContext, QueryFunction, SkipToken, QueryObserverOptions,
|
|
3
|
+
import { QueryKey, QueryFunctionContext, QueryFunction, SkipToken, QueryObserverOptions, InfiniteQueryObserverOptions, MutationObserverOptions, DataTag, InfiniteData } from '@tanstack/query-core';
|
|
4
4
|
|
|
5
5
|
interface experimental_SerializableStreamedQueryOptions {
|
|
6
6
|
/**
|
|
@@ -180,16 +180,89 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
|
|
|
180
180
|
*/
|
|
181
181
|
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptions<TInput, TOutput, TError, UMutationContext>>;
|
|
182
182
|
}
|
|
183
|
-
interface
|
|
183
|
+
interface experimental_ProcedureUtilsDefaults<TClientContext extends ClientContext, TInput, TOutput, TError> {
|
|
184
|
+
/**
|
|
185
|
+
* Default options for queryKey utility
|
|
186
|
+
*
|
|
187
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
188
|
+
*/
|
|
189
|
+
queryKey?: Partial<QueryKeyOptions<TInput>>;
|
|
190
|
+
/**
|
|
191
|
+
* Default options for queryOptions utility
|
|
192
|
+
*
|
|
193
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-options Tanstack Query Options Utility Docs}
|
|
194
|
+
*/
|
|
195
|
+
queryOptions?: Partial<QueryOptionsIn<TClientContext, TInput, TOutput, TError, unknown>>;
|
|
196
|
+
/**
|
|
197
|
+
* Default options for experimental_streamedKey utility
|
|
198
|
+
*
|
|
199
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
200
|
+
*/
|
|
201
|
+
experimental_streamedKey?: Partial<experimental_StreamedKeyOptions<TInput>>;
|
|
202
|
+
/**
|
|
203
|
+
* Default options for experimental_streamedOptions utility
|
|
204
|
+
*
|
|
205
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#streamed-query-options Tanstack Streamed Query Options Utility Docs}
|
|
206
|
+
*/
|
|
207
|
+
experimental_streamedOptions?: Partial<experimental_StreamedOptionsIn<TClientContext, TInput, experimental_StreamedQueryOutput<TOutput>, TError, unknown>>;
|
|
208
|
+
/**
|
|
209
|
+
* Default options for experimental_liveKey utility
|
|
210
|
+
*
|
|
211
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
212
|
+
*/
|
|
213
|
+
experimental_liveKey?: Partial<QueryKeyOptions<TInput>>;
|
|
214
|
+
/**
|
|
215
|
+
* Default options for experimental_liveOptions utility
|
|
216
|
+
*
|
|
217
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#live-query-options Tanstack Live Query Options Utility Docs}
|
|
218
|
+
*/
|
|
219
|
+
experimental_liveOptions?: Partial<experimental_StreamedOptionsIn<TClientContext, TInput, experimental_LiveQueryOutput<TOutput>, TError, unknown>>;
|
|
220
|
+
/**
|
|
221
|
+
* Default options for infiniteKey utility
|
|
222
|
+
*
|
|
223
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
224
|
+
*/
|
|
225
|
+
infiniteKey?: Partial<Pick<InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, InfiniteData<TOutput, unknown>, unknown>, 'input' | 'initialPageParam' | 'queryKey'>>;
|
|
226
|
+
/**
|
|
227
|
+
* Default options for infiniteOptions utility
|
|
228
|
+
*
|
|
229
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#infinite-query-options Tanstack Infinite Query Options Utility Docs}
|
|
230
|
+
*/
|
|
231
|
+
infiniteOptions?: Partial<InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, unknown, unknown>>;
|
|
232
|
+
/**
|
|
233
|
+
* Default options for mutationKey utility
|
|
234
|
+
*
|
|
235
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
236
|
+
*/
|
|
237
|
+
mutationKey?: Partial<Pick<MutationOptionsIn<TClientContext, TInput, TOutput, TError, any>, 'mutationKey'>>;
|
|
238
|
+
/**
|
|
239
|
+
* Default options for mutationOptions utility
|
|
240
|
+
*
|
|
241
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#mutation-options Tanstack Mutation Options Docs}
|
|
242
|
+
*/
|
|
243
|
+
mutationOptions?: Partial<MutationOptionsIn<TClientContext, TInput, TOutput, TError, unknown>>;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @todo remove default generic types on v2
|
|
247
|
+
*/
|
|
248
|
+
interface CreateProcedureUtilsOptions<TClientContext extends ClientContext = ClientContext, TInput = unknown, TOutput = unknown, TError = unknown> {
|
|
184
249
|
path: readonly string[];
|
|
250
|
+
experimental_defaults?: experimental_ProcedureUtilsDefaults<TClientContext, TInput, TOutput, TError>;
|
|
185
251
|
}
|
|
186
|
-
declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
252
|
+
declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
187
253
|
|
|
188
254
|
type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
|
|
189
255
|
[K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
|
|
190
256
|
} & GeneralUtils<unknown>;
|
|
191
|
-
|
|
257
|
+
type experimental_RouterUtilsDefaults<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? experimental_ProcedureUtilsDefaults<UClientContext, UInput, UOutput, UError> : {
|
|
258
|
+
[K in keyof T]?: T[K] extends NestedClient<any> ? experimental_RouterUtilsDefaults<T[K]> : never;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* @todo remove default generic types on v2
|
|
262
|
+
*/
|
|
263
|
+
interface CreateRouterUtilsOptions<T extends NestedClient<any> = NestedClient<any>> {
|
|
192
264
|
path?: readonly string[];
|
|
265
|
+
experimental_defaults?: experimental_RouterUtilsDefaults<T>;
|
|
193
266
|
}
|
|
194
267
|
/**
|
|
195
268
|
* Create a router utils from a client.
|
|
@@ -197,7 +270,7 @@ interface CreateRouterUtilsOptions {
|
|
|
197
270
|
* @info Both client-side and server-side clients are supported.
|
|
198
271
|
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query Tanstack Query Integration}
|
|
199
272
|
*/
|
|
200
|
-
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
273
|
+
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions<T>): RouterUtils<T>;
|
|
201
274
|
|
|
202
275
|
export { OPERATION_CONTEXT_SYMBOL, OPERATION_CONTEXT_SYMBOL as TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL, createGeneralUtils, createProcedureUtils, createRouterUtils, createRouterUtils as createTanstackQueryUtils, experimental_serializableStreamedQuery, generateOperationKey };
|
|
203
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, OperationContext, OperationKey, OperationKeyOptions, OperationType, ProcedureUtils, QueryKeyOptions, QueryOptionsBase, QueryOptionsIn, RouterUtils, OperationContext as TanstackQueryOperationContext, experimental_LiveQueryOutput, experimental_SerializableStreamedQueryOptions, experimental_StreamedKeyOptions, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn, experimental_StreamedQueryOutput };
|
|
276
|
+
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, OperationContext, OperationKey, OperationKeyOptions, OperationType, ProcedureUtils, QueryKeyOptions, QueryOptionsBase, QueryOptionsIn, RouterUtils, OperationContext as TanstackQueryOperationContext, experimental_LiveQueryOutput, experimental_ProcedureUtilsDefaults, experimental_RouterUtilsDefaults, experimental_SerializableStreamedQueryOptions, experimental_StreamedKeyOptions, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn, experimental_StreamedQueryOutput };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
2
|
import { Promisable, SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
-
import { QueryKey, QueryFunctionContext, QueryFunction, SkipToken, QueryObserverOptions,
|
|
3
|
+
import { QueryKey, QueryFunctionContext, QueryFunction, SkipToken, QueryObserverOptions, InfiniteQueryObserverOptions, MutationObserverOptions, DataTag, InfiniteData } from '@tanstack/query-core';
|
|
4
4
|
|
|
5
5
|
interface experimental_SerializableStreamedQueryOptions {
|
|
6
6
|
/**
|
|
@@ -180,16 +180,89 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
|
|
|
180
180
|
*/
|
|
181
181
|
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptions<TInput, TOutput, TError, UMutationContext>>;
|
|
182
182
|
}
|
|
183
|
-
interface
|
|
183
|
+
interface experimental_ProcedureUtilsDefaults<TClientContext extends ClientContext, TInput, TOutput, TError> {
|
|
184
|
+
/**
|
|
185
|
+
* Default options for queryKey utility
|
|
186
|
+
*
|
|
187
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
188
|
+
*/
|
|
189
|
+
queryKey?: Partial<QueryKeyOptions<TInput>>;
|
|
190
|
+
/**
|
|
191
|
+
* Default options for queryOptions utility
|
|
192
|
+
*
|
|
193
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-options Tanstack Query Options Utility Docs}
|
|
194
|
+
*/
|
|
195
|
+
queryOptions?: Partial<QueryOptionsIn<TClientContext, TInput, TOutput, TError, unknown>>;
|
|
196
|
+
/**
|
|
197
|
+
* Default options for experimental_streamedKey utility
|
|
198
|
+
*
|
|
199
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
200
|
+
*/
|
|
201
|
+
experimental_streamedKey?: Partial<experimental_StreamedKeyOptions<TInput>>;
|
|
202
|
+
/**
|
|
203
|
+
* Default options for experimental_streamedOptions utility
|
|
204
|
+
*
|
|
205
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#streamed-query-options Tanstack Streamed Query Options Utility Docs}
|
|
206
|
+
*/
|
|
207
|
+
experimental_streamedOptions?: Partial<experimental_StreamedOptionsIn<TClientContext, TInput, experimental_StreamedQueryOutput<TOutput>, TError, unknown>>;
|
|
208
|
+
/**
|
|
209
|
+
* Default options for experimental_liveKey utility
|
|
210
|
+
*
|
|
211
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
212
|
+
*/
|
|
213
|
+
experimental_liveKey?: Partial<QueryKeyOptions<TInput>>;
|
|
214
|
+
/**
|
|
215
|
+
* Default options for experimental_liveOptions utility
|
|
216
|
+
*
|
|
217
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#live-query-options Tanstack Live Query Options Utility Docs}
|
|
218
|
+
*/
|
|
219
|
+
experimental_liveOptions?: Partial<experimental_StreamedOptionsIn<TClientContext, TInput, experimental_LiveQueryOutput<TOutput>, TError, unknown>>;
|
|
220
|
+
/**
|
|
221
|
+
* Default options for infiniteKey utility
|
|
222
|
+
*
|
|
223
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
224
|
+
*/
|
|
225
|
+
infiniteKey?: Partial<Pick<InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, InfiniteData<TOutput, unknown>, unknown>, 'input' | 'initialPageParam' | 'queryKey'>>;
|
|
226
|
+
/**
|
|
227
|
+
* Default options for infiniteOptions utility
|
|
228
|
+
*
|
|
229
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#infinite-query-options Tanstack Infinite Query Options Utility Docs}
|
|
230
|
+
*/
|
|
231
|
+
infiniteOptions?: Partial<InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, unknown, unknown>>;
|
|
232
|
+
/**
|
|
233
|
+
* Default options for mutationKey utility
|
|
234
|
+
*
|
|
235
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
236
|
+
*/
|
|
237
|
+
mutationKey?: Partial<Pick<MutationOptionsIn<TClientContext, TInput, TOutput, TError, any>, 'mutationKey'>>;
|
|
238
|
+
/**
|
|
239
|
+
* Default options for mutationOptions utility
|
|
240
|
+
*
|
|
241
|
+
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query#mutation-options Tanstack Mutation Options Docs}
|
|
242
|
+
*/
|
|
243
|
+
mutationOptions?: Partial<MutationOptionsIn<TClientContext, TInput, TOutput, TError, unknown>>;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @todo remove default generic types on v2
|
|
247
|
+
*/
|
|
248
|
+
interface CreateProcedureUtilsOptions<TClientContext extends ClientContext = ClientContext, TInput = unknown, TOutput = unknown, TError = unknown> {
|
|
184
249
|
path: readonly string[];
|
|
250
|
+
experimental_defaults?: experimental_ProcedureUtilsDefaults<TClientContext, TInput, TOutput, TError>;
|
|
185
251
|
}
|
|
186
|
-
declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
252
|
+
declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError>(client: Client<TClientContext, TInput, TOutput, TError>, options: CreateProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
|
|
187
253
|
|
|
188
254
|
type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? ProcedureUtils<UClientContext, UInput, UOutput, UError> & GeneralUtils<UInput> : {
|
|
189
255
|
[K in keyof T]: T[K] extends NestedClient<any> ? RouterUtils<T[K]> : never;
|
|
190
256
|
} & GeneralUtils<unknown>;
|
|
191
|
-
|
|
257
|
+
type experimental_RouterUtilsDefaults<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? experimental_ProcedureUtilsDefaults<UClientContext, UInput, UOutput, UError> : {
|
|
258
|
+
[K in keyof T]?: T[K] extends NestedClient<any> ? experimental_RouterUtilsDefaults<T[K]> : never;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* @todo remove default generic types on v2
|
|
262
|
+
*/
|
|
263
|
+
interface CreateRouterUtilsOptions<T extends NestedClient<any> = NestedClient<any>> {
|
|
192
264
|
path?: readonly string[];
|
|
265
|
+
experimental_defaults?: experimental_RouterUtilsDefaults<T>;
|
|
193
266
|
}
|
|
194
267
|
/**
|
|
195
268
|
* Create a router utils from a client.
|
|
@@ -197,7 +270,7 @@ interface CreateRouterUtilsOptions {
|
|
|
197
270
|
* @info Both client-side and server-side clients are supported.
|
|
198
271
|
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query Tanstack Query Integration}
|
|
199
272
|
*/
|
|
200
|
-
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
273
|
+
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions<T>): RouterUtils<T>;
|
|
201
274
|
|
|
202
275
|
export { OPERATION_CONTEXT_SYMBOL, OPERATION_CONTEXT_SYMBOL as TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL, createGeneralUtils, createProcedureUtils, createRouterUtils, createRouterUtils as createTanstackQueryUtils, experimental_serializableStreamedQuery, generateOperationKey };
|
|
203
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, OperationContext, OperationKey, OperationKeyOptions, OperationType, ProcedureUtils, QueryKeyOptions, QueryOptionsBase, QueryOptionsIn, RouterUtils, OperationContext as TanstackQueryOperationContext, experimental_LiveQueryOutput, experimental_SerializableStreamedQueryOptions, experimental_StreamedKeyOptions, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn, experimental_StreamedQueryOutput };
|
|
276
|
+
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, OperationContext, OperationKey, OperationKeyOptions, OperationType, ProcedureUtils, QueryKeyOptions, QueryOptionsBase, QueryOptionsIn, RouterUtils, OperationContext as TanstackQueryOperationContext, experimental_LiveQueryOutput, experimental_ProcedureUtilsDefaults, experimental_RouterUtilsDefaults, experimental_SerializableStreamedQueryOptions, experimental_StreamedKeyOptions, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn, experimental_StreamedQueryOutput };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringifyJSON, isAsyncIteratorObject, toArray } from '@orpc/shared';
|
|
1
|
+
import { stringifyJSON, isAsyncIteratorObject, toArray, get } from '@orpc/shared';
|
|
2
2
|
import { skipToken } from '@tanstack/query-core';
|
|
3
3
|
|
|
4
4
|
function generateOperationKey(path, state = {}) {
|
|
@@ -99,10 +99,12 @@ function createProcedureUtils(client, options) {
|
|
|
99
99
|
const utils = {
|
|
100
100
|
call: client,
|
|
101
101
|
queryKey(...[optionsIn = {}]) {
|
|
102
|
+
optionsIn = { ...options.experimental_defaults?.queryKey, ...optionsIn };
|
|
102
103
|
const queryKey = optionsIn.queryKey ?? generateOperationKey(options.path, { type: "query", input: optionsIn.input });
|
|
103
104
|
return queryKey;
|
|
104
105
|
},
|
|
105
106
|
queryOptions(...[optionsIn = {}]) {
|
|
107
|
+
optionsIn = { ...options.experimental_defaults?.queryOptions, ...optionsIn };
|
|
106
108
|
const queryKey = utils.queryKey(optionsIn);
|
|
107
109
|
return {
|
|
108
110
|
queryFn: ({ signal }) => {
|
|
@@ -126,10 +128,12 @@ function createProcedureUtils(client, options) {
|
|
|
126
128
|
};
|
|
127
129
|
},
|
|
128
130
|
experimental_streamedKey(...[optionsIn = {}]) {
|
|
131
|
+
optionsIn = { ...options.experimental_defaults?.experimental_streamedKey, ...optionsIn };
|
|
129
132
|
const queryKey = optionsIn.queryKey ?? generateOperationKey(options.path, { type: "streamed", input: optionsIn.input, fnOptions: optionsIn.queryFnOptions });
|
|
130
133
|
return queryKey;
|
|
131
134
|
},
|
|
132
135
|
experimental_streamedOptions(...[optionsIn = {}]) {
|
|
136
|
+
optionsIn = { ...options.experimental_defaults?.experimental_streamedOptions, ...optionsIn };
|
|
133
137
|
const queryKey = utils.experimental_streamedKey(optionsIn);
|
|
134
138
|
return {
|
|
135
139
|
queryFn: experimental_serializableStreamedQuery(
|
|
@@ -160,10 +164,12 @@ function createProcedureUtils(client, options) {
|
|
|
160
164
|
};
|
|
161
165
|
},
|
|
162
166
|
experimental_liveKey(...[optionsIn = {}]) {
|
|
167
|
+
optionsIn = { ...options.experimental_defaults?.experimental_liveKey, ...optionsIn };
|
|
163
168
|
const queryKey = optionsIn.queryKey ?? generateOperationKey(options.path, { type: "live", input: optionsIn.input });
|
|
164
169
|
return queryKey;
|
|
165
170
|
},
|
|
166
171
|
experimental_liveOptions(...[optionsIn = {}]) {
|
|
172
|
+
optionsIn = { ...options.experimental_defaults?.experimental_liveOptions, ...optionsIn };
|
|
167
173
|
const queryKey = utils.experimental_liveKey(optionsIn);
|
|
168
174
|
return {
|
|
169
175
|
queryFn: experimental_liveQuery(async ({ signal }) => {
|
|
@@ -191,6 +197,7 @@ function createProcedureUtils(client, options) {
|
|
|
191
197
|
};
|
|
192
198
|
},
|
|
193
199
|
infiniteKey(optionsIn) {
|
|
200
|
+
optionsIn = { ...options.experimental_defaults?.infiniteKey, ...optionsIn };
|
|
194
201
|
const queryKey = optionsIn.queryKey ?? generateOperationKey(options.path, {
|
|
195
202
|
type: "infinite",
|
|
196
203
|
input: optionsIn.input === skipToken ? skipToken : optionsIn.input(optionsIn.initialPageParam)
|
|
@@ -198,6 +205,7 @@ function createProcedureUtils(client, options) {
|
|
|
198
205
|
return queryKey;
|
|
199
206
|
},
|
|
200
207
|
infiniteOptions(optionsIn) {
|
|
208
|
+
optionsIn = { ...options.experimental_defaults?.infiniteOptions, ...optionsIn };
|
|
201
209
|
const queryKey = utils.infiniteKey(optionsIn);
|
|
202
210
|
return {
|
|
203
211
|
queryFn: ({ pageParam, signal }) => {
|
|
@@ -221,10 +229,12 @@ function createProcedureUtils(client, options) {
|
|
|
221
229
|
};
|
|
222
230
|
},
|
|
223
231
|
mutationKey(...[optionsIn = {}]) {
|
|
232
|
+
optionsIn = { ...options.experimental_defaults?.mutationKey, ...optionsIn };
|
|
224
233
|
const mutationKey = optionsIn.mutationKey ?? generateOperationKey(options.path, { type: "mutation" });
|
|
225
234
|
return mutationKey;
|
|
226
235
|
},
|
|
227
236
|
mutationOptions(...[optionsIn = {}]) {
|
|
237
|
+
optionsIn = { ...options.experimental_defaults?.mutationOptions, ...optionsIn };
|
|
228
238
|
const mutationKey = utils.mutationKey(optionsIn);
|
|
229
239
|
return {
|
|
230
240
|
mutationFn: (input) => client(input, {
|
|
@@ -247,7 +257,10 @@ function createProcedureUtils(client, options) {
|
|
|
247
257
|
function createRouterUtils(client, options = {}) {
|
|
248
258
|
const path = toArray(options.path);
|
|
249
259
|
const generalUtils = createGeneralUtils(path);
|
|
250
|
-
const procedureUtils = createProcedureUtils(client, {
|
|
260
|
+
const procedureUtils = createProcedureUtils(client, {
|
|
261
|
+
path,
|
|
262
|
+
experimental_defaults: options.experimental_defaults
|
|
263
|
+
});
|
|
251
264
|
const recursive = new Proxy({
|
|
252
265
|
...generalUtils,
|
|
253
266
|
...procedureUtils
|
|
@@ -257,7 +270,11 @@ function createRouterUtils(client, options = {}) {
|
|
|
257
270
|
if (typeof prop !== "string") {
|
|
258
271
|
return value;
|
|
259
272
|
}
|
|
260
|
-
const nextUtils = createRouterUtils(client[prop], {
|
|
273
|
+
const nextUtils = createRouterUtils(client[prop], {
|
|
274
|
+
...options,
|
|
275
|
+
path: [...path, prop],
|
|
276
|
+
experimental_defaults: get(options.experimental_defaults, [prop])
|
|
277
|
+
});
|
|
261
278
|
if (typeof value !== "function") {
|
|
262
279
|
return nextUtils;
|
|
263
280
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/tanstack-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
],
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@tanstack/query-core": ">=5.80.2",
|
|
28
|
-
"@orpc/client": "1.
|
|
28
|
+
"@orpc/client": "1.12.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@orpc/shared": "1.
|
|
31
|
+
"@orpc/shared": "1.12.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@angular/core": "^20.3.
|
|
35
|
-
"@tanstack/angular-query-experimental": "^5.90.
|
|
36
|
-
"@tanstack/query-core": "^5.90.
|
|
37
|
-
"@tanstack/react-query": "^5.90.
|
|
38
|
-
"@tanstack/solid-query": "^5.90.
|
|
39
|
-
"@tanstack/svelte-query": "^6.0.
|
|
40
|
-
"@tanstack/vue-query": "^5.
|
|
41
|
-
"svelte": "^5.43.
|
|
34
|
+
"@angular/core": "^20.3.12",
|
|
35
|
+
"@tanstack/angular-query-experimental": "^5.90.12",
|
|
36
|
+
"@tanstack/query-core": "^5.90.10",
|
|
37
|
+
"@tanstack/react-query": "^5.90.10",
|
|
38
|
+
"@tanstack/solid-query": "^5.90.13",
|
|
39
|
+
"@tanstack/svelte-query": "^6.0.8",
|
|
40
|
+
"@tanstack/vue-query": "^5.91.2",
|
|
41
|
+
"svelte": "^5.43.14",
|
|
42
42
|
"vue": "^3.5.24",
|
|
43
43
|
"zod": "^4.1.12"
|
|
44
44
|
},
|