@orpc/tanstack-query 2.0.0-beta.49 → 2.0.0-beta.50
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/contract-utils.d.ts +9 -11
- package/dist/contract-utils.js +38 -38
- package/dist/index.d.ts +14 -16
- package/dist/index.js +8 -10
- package/dist/key.d.ts +32 -41
- package/dist/key.js +38 -42
- package/dist/live-query.js +29 -35
- package/dist/meta.d.ts +15 -15
- package/dist/meta.js +49 -51
- package/dist/plugin.d.ts +38 -45
- package/dist/plugin.js +19 -25
- package/dist/procedure-utils.d.ts +138 -141
- package/dist/procedure-utils.js +362 -402
- package/dist/router-utils.d.ts +45 -50
- package/dist/router-utils.js +50 -65
- package/dist/shared-utils.d.ts +10 -10
- package/dist/shared-utils.js +21 -19
- package/dist/ssr.d.ts +20 -21
- package/dist/ssr.js +44 -42
- package/dist/stream-query.d.ts +29 -35
- package/dist/stream-query.js +36 -50
- package/dist/structural-sharing.d.ts +3 -3
- package/dist/structural-sharing.js +83 -138
- package/dist/types.d.ts +41 -41
- package/dist/types.js +8 -6
- package/package.json +5 -5
- package/dist/live-query.d.ts +0 -4
package/dist/plugin.d.ts
CHANGED
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { ProcedureUtilsOptions } from "./procedure-utils.js";
|
|
2
|
+
import { RouterUtilsOptions } from "./router-utils.js";
|
|
3
|
+
import { OrderablePlugin } from "@orpc/shared";
|
|
4
|
+
import { AnyNestedClient, InferClientContext, InferClientError } from "@orpc/client";
|
|
5
5
|
/**
|
|
6
6
|
* Plugin that packages reusable defaults and interceptors for router utils.
|
|
7
7
|
*
|
|
8
8
|
* @see {@link https://orpc.dev/docs/integrations/tanstack-query#plugins | TanStack Query Integration - Plugins}
|
|
9
9
|
*/
|
|
10
10
|
export interface RouterUtilsPlugin<T extends AnyNestedClient> extends OrderablePlugin {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
export declare class CompositeRouterUtilsPlugin<T extends AnyNestedClient> implements RouterUtilsPlugin<T> {
|
|
46
|
-
protected readonly plugins: RouterUtilsPlugin<T>[];
|
|
47
|
-
readonly name = "~composite";
|
|
48
|
-
constructor(plugins?: RouterUtilsPlugin<T>[]);
|
|
49
|
-
init(options: RouterUtilsOptions<T>): RouterUtilsOptions<T>;
|
|
50
|
-
initProcedureOptions(path: string[], options: ProcedureUtilsOptions<InferClientContext<T>, any, any, InferClientError<T>>): ProcedureUtilsOptions<InferClientContext<T>, any, any, InferClientError<T>>;
|
|
51
|
-
}
|
|
11
|
+
/**
|
|
12
|
+
* Initializes the router utils plugin and returns updated router utils options.
|
|
13
|
+
* Called once per plugin instance during composition.
|
|
14
|
+
*
|
|
15
|
+
* This method allows plugins to wrap, extend, or transform router utils options,
|
|
16
|
+
* such as interceptors or configuration.
|
|
17
|
+
*
|
|
18
|
+
* @param options - The current router utils options from previous plugins or base configuration
|
|
19
|
+
* @returns Transformed router utils options with this plugin's modifications applied
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* init(options) {
|
|
24
|
+
* return {
|
|
25
|
+
* ...options,
|
|
26
|
+
* mutationInterceptors: [...(options.mutationInterceptors ?? []), myInterceptor]
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
init?(options: RouterUtilsOptions<T>): RouterUtilsOptions<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Initializes per-procedure router utils options and returns updated options.
|
|
34
|
+
* Called once per procedure utils instance during composition.
|
|
35
|
+
*
|
|
36
|
+
* This method allows plugins to customize merged procedure-specific defaults,
|
|
37
|
+
* such as query or mutation options, for the current path.
|
|
38
|
+
*
|
|
39
|
+
* @param path - The current procedure path
|
|
40
|
+
* @param options - The merged procedure utils options for the current procedure
|
|
41
|
+
* @returns Transformed procedure utils options with this plugin's modifications applied
|
|
42
|
+
*/
|
|
43
|
+
initProcedureOptions?(path: string[], options: ProcedureUtilsOptions<InferClientContext<T>, any, any, InferClientError<T>>): ProcedureUtilsOptions<InferClientContext<T>, any, any, InferClientError<T>>;
|
|
44
|
+
}
|
package/dist/plugin.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { sortPlugins } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
options = plugin.initProcedureOptions(path, options);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return options;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { sortPlugins } from "@orpc/shared";
|
|
2
|
+
// src/plugin.ts
|
|
3
|
+
var CompositeRouterUtilsPlugin = class {
|
|
4
|
+
plugins;
|
|
5
|
+
name = "~composite";
|
|
6
|
+
constructor(plugins = []) {
|
|
7
|
+
this.plugins = plugins;
|
|
8
|
+
this.plugins = sortPlugins(plugins);
|
|
9
|
+
}
|
|
10
|
+
init(options) {
|
|
11
|
+
for (const plugin of this.plugins) if (plugin.init) options = plugin.init(options);
|
|
12
|
+
return options;
|
|
13
|
+
}
|
|
14
|
+
initProcedureOptions(path, options) {
|
|
15
|
+
for (const plugin of this.plugins) if (plugin.initProcedureOptions) options = plugin.initProcedureOptions(path, options);
|
|
16
|
+
return options;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export { CompositeRouterUtilsPlugin };
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { OperationKeyBaseOptions } from "./key.js";
|
|
2
|
+
import { SharedUtils } from "./shared-utils.js";
|
|
3
|
+
import { InferLiveQueryOutput, InferStreamedQueryOutput, InfiniteKeyOptions, InfiniteOptionsIn, InfiniteOptionsOut, LiveOptionsIn, MutationKeyOptions, MutationOptionsIn, MutationOptionsOut, OperationContext, QueryKeyOptions, QueryOptionsIn, QueryOptionsOut, StreamedKeyOptions, StreamedOptionsIn, StreamedOptionsOut } from "./types.js";
|
|
4
|
+
import { Interceptor, MaybeOptionalOptions, PromiseWithError } from "@orpc/shared";
|
|
5
|
+
import { Client, ClientContext } from "@orpc/client";
|
|
6
|
+
import { DataTag, InfiniteData, MutationFunctionContext, QueryFunctionContext, QueryKey, SkipToken } from "@tanstack/query-core";
|
|
7
7
|
export interface ProcedureUtilsQueryInterceptorOptions<TClientContext extends ClientContext, TInput> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
path: string[];
|
|
9
|
+
context: TClientContext & OperationContext;
|
|
10
|
+
input: TInput | SkipToken;
|
|
11
|
+
fnContext: QueryFunctionContext;
|
|
12
12
|
}
|
|
13
13
|
export type ProcedureUtilsQueryInterceptor<TClientContext extends ClientContext, TInput, TOutput, TError> = Interceptor<ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput>, PromiseWithError<TOutput, TError>>;
|
|
14
|
-
export interface ProcedureUtilsStreamedInterceptorOptions<TClientContext extends ClientContext, TInput> extends ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput> {
|
|
15
|
-
}
|
|
14
|
+
export interface ProcedureUtilsStreamedInterceptorOptions<TClientContext extends ClientContext, TInput> extends ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput> {}
|
|
16
15
|
export type ProcedureUtilsStreamedInterceptor<TClientContext extends ClientContext, TInput, TOutput, TError> = Interceptor<ProcedureUtilsStreamedInterceptorOptions<TClientContext, TInput>, PromiseWithError<InferStreamedQueryOutput<TOutput>, TError>>;
|
|
17
|
-
export interface ProcedureUtilsLiveInterceptorOptions<TClientContext extends ClientContext, TInput> extends ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput> {
|
|
18
|
-
}
|
|
16
|
+
export interface ProcedureUtilsLiveInterceptorOptions<TClientContext extends ClientContext, TInput> extends ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput> {}
|
|
19
17
|
export type ProcedureUtilsLiveInterceptor<TClientContext extends ClientContext, TInput, TOutput, TError> = Interceptor<ProcedureUtilsLiveInterceptorOptions<TClientContext, TInput>, PromiseWithError<InferLiveQueryOutput<TOutput>, TError>>;
|
|
20
18
|
export interface ProcedureUtilsInfiniteInterceptorOptions<TClientContext extends ClientContext, TInput> extends ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput> {
|
|
21
|
-
|
|
19
|
+
fnContext: QueryFunctionContext<QueryKey, any>;
|
|
22
20
|
}
|
|
23
21
|
export type ProcedureUtilsInfiniteInterceptor<TClientContext extends ClientContext, TInput, TOutput, TError> = Interceptor<ProcedureUtilsInfiniteInterceptorOptions<TClientContext, TInput>, PromiseWithError<TOutput, TError>>;
|
|
24
|
-
export interface ProcedureUtilsMutationInterceptorOptions<TClientContext extends ClientContext, TInput> extends Omit<ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput>,
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
export interface ProcedureUtilsMutationInterceptorOptions<TClientContext extends ClientContext, TInput> extends Omit<ProcedureUtilsQueryInterceptorOptions<TClientContext, TInput>, "input" | "fnContext"> {
|
|
23
|
+
input: TInput;
|
|
24
|
+
fnContext: MutationFunctionContext;
|
|
27
25
|
}
|
|
28
26
|
export type ProcedureUtilsMutationInterceptor<TClientContext extends ClientContext, TInput, TOutput, TError> = Interceptor<ProcedureUtilsMutationInterceptorOptions<TClientContext, TInput>, PromiseWithError<TOutput, TError>>;
|
|
29
27
|
/**
|
|
@@ -32,78 +30,77 @@ export type ProcedureUtilsMutationInterceptor<TClientContext extends ClientConte
|
|
|
32
30
|
*/
|
|
33
31
|
export type ProcedureUtilsModifier<T extends object> = Partial<T> | ((options: T) => T);
|
|
34
32
|
export interface ProcedureUtilsOptions<TClientContext extends ClientContext, TInput, TOutput, TError> extends OperationKeyBaseOptions {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Key options modifier for .queryKey and .queryOptions
|
|
35
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
36
|
+
*/
|
|
37
|
+
queryKey?: ProcedureUtilsModifier<QueryKeyOptions<TInput>> | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Interceptors that intercept queryFn inside .queryOptions, guaranteed to be executed.
|
|
40
|
+
*/
|
|
41
|
+
queryInterceptors?: ProcedureUtilsQueryInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Options modifier for .queryOptions
|
|
44
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
45
|
+
*/
|
|
46
|
+
queryOptions?: ProcedureUtilsModifier<QueryOptionsIn<TClientContext, TInput, TOutput, TError, unknown, unknown>> | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Key options modifier for .streamedKey and .streamedOptions
|
|
49
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
50
|
+
*/
|
|
51
|
+
streamedKey?: ProcedureUtilsModifier<StreamedKeyOptions<TInput>> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Interceptors that intercept queryFn inside .streamedOptions, guaranteed to be executed.
|
|
54
|
+
*/
|
|
55
|
+
streamedInterceptors?: ProcedureUtilsStreamedInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Options modifier for .streamedOptions
|
|
58
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
59
|
+
*/
|
|
60
|
+
streamedOptions?: ProcedureUtilsModifier<StreamedOptionsIn<TClientContext, TInput, InferStreamedQueryOutput<TOutput>, TError, unknown, unknown>> | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Key options modifier for .liveKey and .liveOptions
|
|
63
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
64
|
+
*/
|
|
65
|
+
liveKey?: ProcedureUtilsModifier<QueryKeyOptions<TInput>> | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Interceptors that intercept queryFn inside .liveOptions, guaranteed to be executed.
|
|
68
|
+
*/
|
|
69
|
+
liveInterceptors?: ProcedureUtilsLiveInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Options modifier for .liveOptions
|
|
72
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
73
|
+
*/
|
|
74
|
+
liveOptions?: ProcedureUtilsModifier<LiveOptionsIn<TClientContext, TInput, InferLiveQueryOutput<TOutput>, TError, unknown, unknown>> | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Key options modifier for .infiniteKey and .infiniteOptions
|
|
77
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
78
|
+
*/
|
|
79
|
+
infiniteKey?: ProcedureUtilsModifier<InfiniteKeyOptions<TInput, unknown>> | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Interceptors that intercept queryFn inside .infiniteOptions, guaranteed to be executed.
|
|
82
|
+
*/
|
|
83
|
+
infiniteInterceptors?: ProcedureUtilsInfiniteInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Options modifier for .infiniteOptions
|
|
86
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
87
|
+
*/
|
|
88
|
+
infiniteOptions?: ProcedureUtilsModifier<InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, unknown, unknown, unknown>> | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Key options modifier for .mutationKey and .mutationOptions
|
|
91
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
92
|
+
*/
|
|
93
|
+
mutationKey?: ProcedureUtilsModifier<MutationKeyOptions> | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Interceptors that intercept mutationFn inside .mutationOptions, guaranteed to be executed.
|
|
96
|
+
*/
|
|
97
|
+
mutationInterceptors?: ProcedureUtilsMutationInterceptor<TClientContext, TInput, TOutput, TError>[] | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Options modifier for .mutationOptions
|
|
100
|
+
* Can be partial options or a function that receives per-call options and returns override this.options.
|
|
101
|
+
*/
|
|
102
|
+
mutationOptions?: ProcedureUtilsModifier<MutationOptionsIn<TClientContext, TInput, TOutput, TError, unknown>> | undefined;
|
|
105
103
|
}
|
|
106
|
-
export declare function isProcedureUtilsOptions(value: unknown): value is ProcedureUtilsOptions<any, any, any, any>;
|
|
107
104
|
/**
|
|
108
105
|
* Merge two procedure utils options where `override` takes priority.
|
|
109
106
|
* A key explicitly set to `undefined` in `override` resets the base value.
|
|
@@ -113,55 +110,55 @@ export declare function isProcedureUtilsOptions(value: unknown): value is Proced
|
|
|
113
110
|
*/
|
|
114
111
|
export declare function mergeProcedureUtilsOptions<TClientContext extends ClientContext, TInput, TOutput, TError>(base: ProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>, override: ProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>): ProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>;
|
|
115
112
|
export declare class ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> extends SharedUtils<TInput> {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
113
|
+
protected readonly options: ProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>;
|
|
114
|
+
/**
|
|
115
|
+
* Calling corresponding procedure client
|
|
116
|
+
*/
|
|
117
|
+
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
118
|
+
constructor(path: string[], client: Client<TClientContext, TInput, TOutput, TError>, options?: ProcedureUtilsOptions<TClientContext, TInput, TOutput, TError>);
|
|
119
|
+
/**
|
|
120
|
+
* Generate a **full matching** key for [Query Options](https://orpc.dev/docs/integrations/tanstack-query#query-options).
|
|
121
|
+
*/
|
|
122
|
+
queryKey(...rest: MaybeOptionalOptions<QueryKeyOptions<TInput>>): DataTag<QueryKey, TOutput, TError>;
|
|
123
|
+
/**
|
|
124
|
+
* Generate options used for useQuery/useSuspenseQuery/prefetchQuery/...
|
|
125
|
+
*/
|
|
126
|
+
queryOptions<USelectData = TOutput, UInitialData = undefined>(...rest: MaybeOptionalOptions<QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UInitialData>>): NoInfer<QueryOptionsOut<TOutput, TError, USelectData, UInitialData>>;
|
|
127
|
+
/**
|
|
128
|
+
* Generate a **full matching** key for [Streamed Query Options](https://orpc.dev/docs/integrations/tanstack-query#streamed-query-options).
|
|
129
|
+
*/
|
|
130
|
+
streamedKey(...rest: MaybeOptionalOptions<StreamedKeyOptions<TInput>>): DataTag<QueryKey, InferStreamedQueryOutput<TOutput>, TError>;
|
|
131
|
+
/**
|
|
132
|
+
* Configure queries for [AsyncIteratorObject](https://orpc.dev/docs/async-iterator-object).
|
|
133
|
+
* This is built on [TanStack Query streamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
|
|
134
|
+
* and works with hooks like `useQuery`, `useSuspenseQuery`, or `prefetchQuery`.
|
|
135
|
+
* The query never returns to pending once it has data.
|
|
136
|
+
*/
|
|
137
|
+
streamedOptions<USelectData = InferStreamedQueryOutput<TOutput>, UInitialData = undefined>(...rest: MaybeOptionalOptions<StreamedOptionsIn<TClientContext, TInput, InferStreamedQueryOutput<TOutput>, TError, USelectData, UInitialData>>): NoInfer<StreamedOptionsOut<InferStreamedQueryOutput<TOutput>, TError, USelectData, UInitialData>>;
|
|
138
|
+
/**
|
|
139
|
+
* Generate a **full matching** key for [Live Query Options](https://orpc.dev/docs/integrations/tanstack-query#live-query-options).
|
|
140
|
+
*/
|
|
141
|
+
liveKey(...rest: MaybeOptionalOptions<QueryKeyOptions<TInput>>): DataTag<QueryKey, InferLiveQueryOutput<TOutput>, TError>;
|
|
142
|
+
/**
|
|
143
|
+
* Configure live queries for [AsyncIteratorObject](https://orpc.dev/docs/async-iterator-object).
|
|
144
|
+
* Unlike `.streamedOptions` which accumulates chunks, live queries replace the entire result with each new chunk received.
|
|
145
|
+
* Works with hooks like `useQuery`, `useSuspenseQuery`, or `prefetchQuery`.
|
|
146
|
+
*/
|
|
147
|
+
liveOptions<USelectData = InferLiveQueryOutput<TOutput>, UInitialData = undefined>(...rest: MaybeOptionalOptions<LiveOptionsIn<TClientContext, TInput, InferLiveQueryOutput<TOutput>, TError, USelectData, UInitialData>>): NoInfer<QueryOptionsOut<InferLiveQueryOutput<TOutput>, TError, USelectData, UInitialData>>;
|
|
148
|
+
/**
|
|
149
|
+
* Generate a **full matching** key for [Infinite Query Options](https://orpc.dev/docs/integrations/tanstack-query#infinite-query-options).
|
|
150
|
+
*/
|
|
151
|
+
infiniteKey<UPageParam>(optionsIn: InfiniteKeyOptions<TInput, UPageParam>): DataTag<QueryKey, InfiniteData<TOutput, UPageParam>, TError>;
|
|
152
|
+
/**
|
|
153
|
+
* Generate options used for useInfiniteQuery/useSuspenseInfiniteQuery/prefetchInfiniteQuery/...
|
|
154
|
+
*/
|
|
155
|
+
infiniteOptions<UPageParam, USelectData = InfiniteData<TOutput, UPageParam>, UInitialData = undefined>(optionsIn: InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam, UInitialData>): NoInfer<InfiniteOptionsOut<TOutput, TError, USelectData, UPageParam, UInitialData>>;
|
|
156
|
+
/**
|
|
157
|
+
* Generate a **full matching** key for [Mutation Options](https://orpc.dev/docs/integrations/tanstack-query#mutation-options).
|
|
158
|
+
*/
|
|
159
|
+
mutationKey(optionsIn?: MutationKeyOptions): DataTag<QueryKey, TOutput, TError>;
|
|
160
|
+
/**
|
|
161
|
+
* Generate options used for useMutation/...
|
|
162
|
+
*/
|
|
163
|
+
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptionsOut<TInput, TOutput, TError, UMutationContext>>;
|
|
164
|
+
}
|