@orpc/tanstack-query 0.0.0-next.bb23f2f → 0.0.0-next.bbe55b7
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/README.md +7 -2
- package/dist/index.d.mts +35 -10
- package/dist/index.d.ts +35 -10
- package/dist/index.mjs +67 -11
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/unnoq/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -30,7 +33,8 @@
|
|
|
30
33
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
|
31
34
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
32
35
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
33
|
-
-
|
|
36
|
+
- **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
|
|
37
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
|
|
34
38
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
35
39
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
36
40
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
|
@@ -38,7 +42,6 @@
|
|
|
38
42
|
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
|
|
39
43
|
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
|
|
40
44
|
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
|
|
41
|
-
- **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
|
|
42
45
|
|
|
43
46
|
## Documentation
|
|
44
47
|
|
|
@@ -50,9 +53,11 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
50
53
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
51
54
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
52
55
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
56
|
+
- [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
|
|
53
57
|
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
54
58
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
55
59
|
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
60
|
+
- [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
|
|
56
61
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
57
62
|
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
58
63
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
|
-
import { SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
-
import {
|
|
2
|
+
import { Promisable, SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
+
import { QueryKey, QueryFunctionContext, QueryFunction, SkipToken, QueryObserverOptions, DataTag, InfiniteQueryObserverOptions, InfiniteData, MutationObserverOptions } from '@tanstack/query-core';
|
|
4
|
+
|
|
5
|
+
interface experimental_SerializableStreamedQueryOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Determines how data is handled when the query is refetched.
|
|
8
|
+
*
|
|
9
|
+
* - `'reset'`: Clears existing data and sets the query back to a pending state.
|
|
10
|
+
* - `'append'`: Appends new data chunks to the existing data.
|
|
11
|
+
* - `'replace'`: Collects all streamed data and replaces the cache once the stream finishes.
|
|
12
|
+
*
|
|
13
|
+
* @default 'reset'
|
|
14
|
+
*/
|
|
15
|
+
refetchMode?: 'append' | 'reset' | 'replace';
|
|
16
|
+
/**
|
|
17
|
+
* Limits the number of data chunks stored in the query result.
|
|
18
|
+
* Older chunks are removed when the limit is reached.
|
|
19
|
+
*
|
|
20
|
+
* @default Number.POSITIVE_INFINITY (unlimited)
|
|
21
|
+
*/
|
|
22
|
+
maxChunks?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A variant of `streamedQuery` where:
|
|
26
|
+
* - Options are serializable
|
|
27
|
+
* - The output is predictable
|
|
28
|
+
*/
|
|
29
|
+
declare function experimental_serializableStreamedQuery<TQueryFnData = unknown, TQueryKey extends QueryKey = QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => Promisable<AsyncIterable<TQueryFnData>>, { refetchMode, maxChunks }?: experimental_SerializableStreamedQueryOptions): QueryFunction<Array<TQueryFnData>, TQueryKey>;
|
|
4
30
|
|
|
5
31
|
type experimental_StreamedQueryOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
|
|
6
32
|
type experimental_LiveQueryOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U : never;
|
|
7
|
-
type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
|
|
8
33
|
type OperationType = 'query' | 'streamed' | 'live' | 'infinite' | 'mutation';
|
|
9
34
|
type OperationKeyOptions<TType extends OperationType, TInput> = {
|
|
10
35
|
type?: TType;
|
|
11
36
|
input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
|
|
12
|
-
fnOptions?: TType extends 'streamed' ?
|
|
37
|
+
fnOptions?: TType extends 'streamed' ? experimental_SerializableStreamedQueryOptions : never;
|
|
13
38
|
};
|
|
14
39
|
type OperationKey<TType extends OperationType, TInput> = [path: readonly string[], options: OperationKeyOptions<TType, TInput>];
|
|
15
40
|
declare const OPERATION_CONTEXT_SYMBOL: unique symbol;
|
|
@@ -36,13 +61,13 @@ interface QueryOptionsBase<TOutput, TError> {
|
|
|
36
61
|
queryFn: QueryFunction<TOutput>;
|
|
37
62
|
throwOnError?: (error: TError) => boolean;
|
|
38
63
|
retryDelay?: (count: number, error: TError) => number;
|
|
39
|
-
enabled
|
|
64
|
+
enabled?: boolean;
|
|
40
65
|
}
|
|
41
66
|
type experimental_StreamedKeyOptions<TInput> = QueryKeyOptions<TInput> & {
|
|
42
|
-
queryFnOptions?:
|
|
67
|
+
queryFnOptions?: experimental_SerializableStreamedQueryOptions;
|
|
43
68
|
};
|
|
44
69
|
type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
|
|
45
|
-
queryFnOptions?:
|
|
70
|
+
queryFnOptions?: experimental_SerializableStreamedQueryOptions;
|
|
46
71
|
};
|
|
47
72
|
interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
|
|
48
73
|
}
|
|
@@ -59,7 +84,7 @@ interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
|
|
|
59
84
|
select?(): InfiniteData<TOutput, TPageParam>;
|
|
60
85
|
throwOnError?: (error: TError) => boolean;
|
|
61
86
|
retryDelay?: (count: number, error: TError) => number;
|
|
62
|
-
enabled
|
|
87
|
+
enabled?: boolean;
|
|
63
88
|
}
|
|
64
89
|
type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext> = (Record<never, never> extends TClientContext ? {
|
|
65
90
|
context?: TClientContext;
|
|
@@ -174,5 +199,5 @@ interface CreateRouterUtilsOptions {
|
|
|
174
199
|
*/
|
|
175
200
|
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
176
201
|
|
|
177
|
-
export { OPERATION_CONTEXT_SYMBOL, OPERATION_CONTEXT_SYMBOL as TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL, createGeneralUtils, createProcedureUtils, createRouterUtils, createRouterUtils as createTanstackQueryUtils, generateOperationKey };
|
|
178
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, OperationContext, OperationKey, OperationKeyOptions, OperationType, ProcedureUtils, QueryKeyOptions, QueryOptionsBase, QueryOptionsIn, RouterUtils, OperationContext as TanstackQueryOperationContext, experimental_LiveQueryOutput, experimental_StreamedKeyOptions, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn, experimental_StreamedQueryOutput };
|
|
202
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
|
-
import { SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
-
import {
|
|
2
|
+
import { Promisable, SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
|
|
3
|
+
import { QueryKey, QueryFunctionContext, QueryFunction, SkipToken, QueryObserverOptions, DataTag, InfiniteQueryObserverOptions, InfiniteData, MutationObserverOptions } from '@tanstack/query-core';
|
|
4
|
+
|
|
5
|
+
interface experimental_SerializableStreamedQueryOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Determines how data is handled when the query is refetched.
|
|
8
|
+
*
|
|
9
|
+
* - `'reset'`: Clears existing data and sets the query back to a pending state.
|
|
10
|
+
* - `'append'`: Appends new data chunks to the existing data.
|
|
11
|
+
* - `'replace'`: Collects all streamed data and replaces the cache once the stream finishes.
|
|
12
|
+
*
|
|
13
|
+
* @default 'reset'
|
|
14
|
+
*/
|
|
15
|
+
refetchMode?: 'append' | 'reset' | 'replace';
|
|
16
|
+
/**
|
|
17
|
+
* Limits the number of data chunks stored in the query result.
|
|
18
|
+
* Older chunks are removed when the limit is reached.
|
|
19
|
+
*
|
|
20
|
+
* @default Number.POSITIVE_INFINITY (unlimited)
|
|
21
|
+
*/
|
|
22
|
+
maxChunks?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A variant of `streamedQuery` where:
|
|
26
|
+
* - Options are serializable
|
|
27
|
+
* - The output is predictable
|
|
28
|
+
*/
|
|
29
|
+
declare function experimental_serializableStreamedQuery<TQueryFnData = unknown, TQueryKey extends QueryKey = QueryKey>(queryFn: (context: QueryFunctionContext<TQueryKey>) => Promisable<AsyncIterable<TQueryFnData>>, { refetchMode, maxChunks }?: experimental_SerializableStreamedQueryOptions): QueryFunction<Array<TQueryFnData>, TQueryKey>;
|
|
4
30
|
|
|
5
31
|
type experimental_StreamedQueryOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
|
|
6
32
|
type experimental_LiveQueryOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U : never;
|
|
7
|
-
type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
|
|
8
33
|
type OperationType = 'query' | 'streamed' | 'live' | 'infinite' | 'mutation';
|
|
9
34
|
type OperationKeyOptions<TType extends OperationType, TInput> = {
|
|
10
35
|
type?: TType;
|
|
11
36
|
input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
|
|
12
|
-
fnOptions?: TType extends 'streamed' ?
|
|
37
|
+
fnOptions?: TType extends 'streamed' ? experimental_SerializableStreamedQueryOptions : never;
|
|
13
38
|
};
|
|
14
39
|
type OperationKey<TType extends OperationType, TInput> = [path: readonly string[], options: OperationKeyOptions<TType, TInput>];
|
|
15
40
|
declare const OPERATION_CONTEXT_SYMBOL: unique symbol;
|
|
@@ -36,13 +61,13 @@ interface QueryOptionsBase<TOutput, TError> {
|
|
|
36
61
|
queryFn: QueryFunction<TOutput>;
|
|
37
62
|
throwOnError?: (error: TError) => boolean;
|
|
38
63
|
retryDelay?: (count: number, error: TError) => number;
|
|
39
|
-
enabled
|
|
64
|
+
enabled?: boolean;
|
|
40
65
|
}
|
|
41
66
|
type experimental_StreamedKeyOptions<TInput> = QueryKeyOptions<TInput> & {
|
|
42
|
-
queryFnOptions?:
|
|
67
|
+
queryFnOptions?: experimental_SerializableStreamedQueryOptions;
|
|
43
68
|
};
|
|
44
69
|
type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
|
|
45
|
-
queryFnOptions?:
|
|
70
|
+
queryFnOptions?: experimental_SerializableStreamedQueryOptions;
|
|
46
71
|
};
|
|
47
72
|
interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
|
|
48
73
|
}
|
|
@@ -59,7 +84,7 @@ interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
|
|
|
59
84
|
select?(): InfiniteData<TOutput, TPageParam>;
|
|
60
85
|
throwOnError?: (error: TError) => boolean;
|
|
61
86
|
retryDelay?: (count: number, error: TError) => number;
|
|
62
|
-
enabled
|
|
87
|
+
enabled?: boolean;
|
|
63
88
|
}
|
|
64
89
|
type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext> = (Record<never, never> extends TClientContext ? {
|
|
65
90
|
context?: TClientContext;
|
|
@@ -174,5 +199,5 @@ interface CreateRouterUtilsOptions {
|
|
|
174
199
|
*/
|
|
175
200
|
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
176
201
|
|
|
177
|
-
export { OPERATION_CONTEXT_SYMBOL, OPERATION_CONTEXT_SYMBOL as TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL, createGeneralUtils, createProcedureUtils, createRouterUtils, createRouterUtils as createTanstackQueryUtils, generateOperationKey };
|
|
178
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MutationOptions, MutationOptionsIn, OperationContext, OperationKey, OperationKeyOptions, OperationType, ProcedureUtils, QueryKeyOptions, QueryOptionsBase, QueryOptionsIn, RouterUtils, OperationContext as TanstackQueryOperationContext, experimental_LiveQueryOutput, experimental_StreamedKeyOptions, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn, experimental_StreamedQueryOutput };
|
|
202
|
+
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stringifyJSON, isAsyncIteratorObject, toArray } from '@orpc/shared';
|
|
2
|
-
import { skipToken
|
|
2
|
+
import { skipToken } from '@tanstack/query-core';
|
|
3
3
|
|
|
4
4
|
function generateOperationKey(path, state = {}) {
|
|
5
5
|
return [path, {
|
|
@@ -23,7 +23,7 @@ function experimental_liveQuery(queryFn) {
|
|
|
23
23
|
let last;
|
|
24
24
|
for await (const chunk of stream) {
|
|
25
25
|
if (context.signal.aborted) {
|
|
26
|
-
|
|
26
|
+
throw context.signal.reason;
|
|
27
27
|
}
|
|
28
28
|
last = { chunk };
|
|
29
29
|
context.client.setQueryData(context.queryKey, chunk);
|
|
@@ -37,6 +37,62 @@ function experimental_liveQuery(queryFn) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function experimental_serializableStreamedQuery(queryFn, { refetchMode = "reset", maxChunks = Number.POSITIVE_INFINITY } = {}) {
|
|
41
|
+
return async (context) => {
|
|
42
|
+
const query = context.client.getQueryCache().find({ queryKey: context.queryKey, exact: true });
|
|
43
|
+
const hasPreviousData = !!query && query.state.data !== void 0;
|
|
44
|
+
if (hasPreviousData) {
|
|
45
|
+
if (refetchMode === "reset") {
|
|
46
|
+
query.setState({
|
|
47
|
+
status: "pending",
|
|
48
|
+
data: void 0,
|
|
49
|
+
error: null,
|
|
50
|
+
fetchStatus: "fetching"
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
context.client.setQueryData(
|
|
54
|
+
context.queryKey,
|
|
55
|
+
(prev = []) => limitArraySize(prev, maxChunks)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let result = [];
|
|
60
|
+
const stream = await queryFn(context);
|
|
61
|
+
const shouldUpdateCacheDuringStream = !hasPreviousData || refetchMode !== "replace";
|
|
62
|
+
context.client.setQueryData(
|
|
63
|
+
context.queryKey,
|
|
64
|
+
(prev = []) => limitArraySize(prev, maxChunks)
|
|
65
|
+
);
|
|
66
|
+
for await (const chunk of stream) {
|
|
67
|
+
if (context.signal.aborted) {
|
|
68
|
+
throw context.signal.reason;
|
|
69
|
+
}
|
|
70
|
+
result.push(chunk);
|
|
71
|
+
result = limitArraySize(result, maxChunks);
|
|
72
|
+
if (shouldUpdateCacheDuringStream) {
|
|
73
|
+
context.client.setQueryData(
|
|
74
|
+
context.queryKey,
|
|
75
|
+
(prev = []) => limitArraySize([...prev, chunk], maxChunks)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!shouldUpdateCacheDuringStream) {
|
|
80
|
+
context.client.setQueryData(context.queryKey, result);
|
|
81
|
+
}
|
|
82
|
+
const cachedData = context.client.getQueryData(context.queryKey);
|
|
83
|
+
if (cachedData) {
|
|
84
|
+
return limitArraySize(cachedData, maxChunks);
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function limitArraySize(items, maxSize) {
|
|
90
|
+
if (items.length <= maxSize) {
|
|
91
|
+
return items;
|
|
92
|
+
}
|
|
93
|
+
return items.slice(items.length - maxSize);
|
|
94
|
+
}
|
|
95
|
+
|
|
40
96
|
const OPERATION_CONTEXT_SYMBOL = Symbol("ORPC_OPERATION_CONTEXT");
|
|
41
97
|
|
|
42
98
|
function createProcedureUtils(client, options) {
|
|
@@ -64,7 +120,7 @@ function createProcedureUtils(client, options) {
|
|
|
64
120
|
}
|
|
65
121
|
});
|
|
66
122
|
},
|
|
67
|
-
|
|
123
|
+
...optionsIn.input === skipToken ? { enabled: false } : {},
|
|
68
124
|
...optionsIn,
|
|
69
125
|
queryKey
|
|
70
126
|
};
|
|
@@ -76,9 +132,8 @@ function createProcedureUtils(client, options) {
|
|
|
76
132
|
experimental_streamedOptions(...[optionsIn = {}]) {
|
|
77
133
|
const queryKey = utils.experimental_streamedKey(optionsIn);
|
|
78
134
|
return {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
queryFn: async ({ signal }) => {
|
|
135
|
+
queryFn: experimental_serializableStreamedQuery(
|
|
136
|
+
async ({ signal }) => {
|
|
82
137
|
if (optionsIn.input === skipToken) {
|
|
83
138
|
throw new Error("queryFn should not be called with skipToken used as input");
|
|
84
139
|
}
|
|
@@ -97,8 +152,9 @@ function createProcedureUtils(client, options) {
|
|
|
97
152
|
}
|
|
98
153
|
return output;
|
|
99
154
|
},
|
|
100
|
-
|
|
101
|
-
|
|
155
|
+
optionsIn.queryFnOptions
|
|
156
|
+
),
|
|
157
|
+
...optionsIn.input === skipToken ? { enabled: false } : {},
|
|
102
158
|
...optionsIn,
|
|
103
159
|
queryKey
|
|
104
160
|
};
|
|
@@ -110,7 +166,6 @@ function createProcedureUtils(client, options) {
|
|
|
110
166
|
experimental_liveOptions(...[optionsIn = {}]) {
|
|
111
167
|
const queryKey = utils.experimental_liveKey(optionsIn);
|
|
112
168
|
return {
|
|
113
|
-
enabled: optionsIn.input !== skipToken,
|
|
114
169
|
queryFn: experimental_liveQuery(async ({ signal }) => {
|
|
115
170
|
if (optionsIn.input === skipToken) {
|
|
116
171
|
throw new Error("queryFn should not be called with skipToken used as input");
|
|
@@ -130,6 +185,7 @@ function createProcedureUtils(client, options) {
|
|
|
130
185
|
}
|
|
131
186
|
return output;
|
|
132
187
|
}),
|
|
188
|
+
...optionsIn.input === skipToken ? { enabled: false } : {},
|
|
133
189
|
...optionsIn,
|
|
134
190
|
queryKey
|
|
135
191
|
};
|
|
@@ -159,7 +215,7 @@ function createProcedureUtils(client, options) {
|
|
|
159
215
|
}
|
|
160
216
|
});
|
|
161
217
|
},
|
|
162
|
-
|
|
218
|
+
...optionsIn.input === skipToken ? { enabled: false } : {},
|
|
163
219
|
...optionsIn,
|
|
164
220
|
queryKey
|
|
165
221
|
};
|
|
@@ -215,4 +271,4 @@ function createRouterUtils(client, options = {}) {
|
|
|
215
271
|
return recursive;
|
|
216
272
|
}
|
|
217
273
|
|
|
218
|
-
export { OPERATION_CONTEXT_SYMBOL, OPERATION_CONTEXT_SYMBOL as TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL, createGeneralUtils, createProcedureUtils, createRouterUtils, createRouterUtils as createTanstackQueryUtils, generateOperationKey };
|
|
274
|
+
export { OPERATION_CONTEXT_SYMBOL, OPERATION_CONTEXT_SYMBOL as TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL, createGeneralUtils, createProcedureUtils, createRouterUtils, createRouterUtils as createTanstackQueryUtils, experimental_serializableStreamedQuery, generateOperationKey };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/tanstack-query",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.bbe55b7",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
],
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@tanstack/query-core": ">=5.80.2",
|
|
28
|
-
"@orpc/client": "0.0.0-next.
|
|
28
|
+
"@orpc/client": "0.0.0-next.bbe55b7"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@orpc/shared": "0.0.0-next.
|
|
31
|
+
"@orpc/shared": "0.0.0-next.bbe55b7"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@angular/core": "^20.
|
|
35
|
-
"@tanstack/angular-query-experimental": "^5.
|
|
36
|
-
"@tanstack/query-core": "^5.
|
|
37
|
-
"@tanstack/react-query": "^5.
|
|
38
|
-
"@tanstack/solid-query": "^5.
|
|
39
|
-
"@tanstack/svelte-query": "^
|
|
40
|
-
"@tanstack/vue-query": "^5.
|
|
41
|
-
"svelte": "^5.
|
|
42
|
-
"vue": "^3.5.
|
|
43
|
-
"zod": "^
|
|
34
|
+
"@angular/core": "^20.3.10",
|
|
35
|
+
"@tanstack/angular-query-experimental": "^5.90.9",
|
|
36
|
+
"@tanstack/query-core": "^5.90.7",
|
|
37
|
+
"@tanstack/react-query": "^5.90.7",
|
|
38
|
+
"@tanstack/solid-query": "^5.90.10",
|
|
39
|
+
"@tanstack/svelte-query": "^6.0.5",
|
|
40
|
+
"@tanstack/vue-query": "^5.90.7",
|
|
41
|
+
"svelte": "^5.43.5",
|
|
42
|
+
"vue": "^3.5.24",
|
|
43
|
+
"zod": "^4.1.12"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "unbuild",
|