@orpc/tanstack-query 0.0.0-next.19c2a69 → 0.0.0-next.2147e3f

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 CHANGED
@@ -49,14 +49,12 @@ You can find the full documentation [here](https://orpc.unnoq.com).
49
49
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
50
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
51
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
- - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
52
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
53
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
53
54
  - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
54
- - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
55
- - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
56
- - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
57
- - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
55
+ - [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
58
56
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
- - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
57
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
60
58
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
59
  - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
62
60
  - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
package/dist/index.d.mts CHANGED
@@ -1,21 +1,7 @@
1
- import { OperationType as OperationType$1, OperationKeyOptions as OperationKeyOptions$1, OperationKey as OperationKey$1 } from '@orpc/tanstack-query';
2
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
3
2
  import { SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
4
3
  import { SkipToken, QueryObserverOptions, QueryKey, QueryFunction, experimental_streamedQuery, InfiniteQueryObserverOptions, InfiniteData, MutationObserverOptions } from '@tanstack/query-core';
5
4
 
6
- /**
7
- * Utils at any level (procedure or router)
8
- */
9
- interface GeneralUtils<TInput> {
10
- /**
11
- * Generate a query/mutation key for checking status, invalidate, set, get, etc.
12
- *
13
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
14
- */
15
- key<TType extends OperationType$1>(options?: OperationKeyOptions$1<TType, TInput>): OperationKey$1<TType, TInput>;
16
- }
17
- declare function createGeneralUtils<TInput>(path: readonly string[]): GeneralUtils<TInput>;
18
-
19
5
  type experimental_StreamedQueryOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
20
6
  type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
21
7
  type OperationType = 'query' | 'streamed' | 'infinite' | 'mutation';
@@ -59,7 +45,7 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
59
45
  context?: TClientContext;
60
46
  } : {
61
47
  context: TClientContext;
62
- }) & SetOptional<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
48
+ }) & SetOptional<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>, 'queryKey'>;
63
49
  interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
64
50
  queryKey: QueryKey;
65
51
  queryFn: QueryFunction<TOutput, QueryKey, TPageParam>;
@@ -75,38 +61,51 @@ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
75
61
  }) & MutationOptions<TInput, TOutput, TError, TMutationContext>;
76
62
  type MutationOptions<TInput, TOutput, TError, TMutationContext> = MutationObserverOptions<TOutput, TError, TInput, TMutationContext>;
77
63
 
64
+ /**
65
+ * Utils at any level (procedure or router)
66
+ */
67
+ interface GeneralUtils<TInput> {
68
+ /**
69
+ * Generate a query/mutation key for checking status, invalidate, set, get, etc.
70
+ *
71
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
72
+ */
73
+ key<TType extends OperationType>(options?: OperationKeyOptions<TType, TInput>): OperationKey<TType, TInput>;
74
+ }
75
+ declare function createGeneralUtils<TInput>(path: readonly string[]): GeneralUtils<TInput>;
76
+
78
77
  declare function generateOperationKey<TType extends OperationType, TInput>(path: readonly string[], state?: OperationKeyOptions<TType, TInput>): OperationKey<TType, TInput>;
79
78
 
80
79
  interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
81
80
  /**
82
81
  * Calling corresponding procedure client
83
82
  *
84
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
83
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
85
84
  */
86
85
  call: Client<TClientContext, TInput, TOutput, TError>;
87
86
  /**
88
87
  * Generate options used for useQuery/useSuspenseQuery/prefetchQuery/...
89
88
  *
90
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
89
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
91
90
  */
92
91
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
93
92
  /**
94
93
  * Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/useSuspenseQuery/prefetchQuery/...
95
94
  * Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
96
95
  *
97
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
96
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
98
97
  */
99
98
  experimental_streamedOptions<U, USelectData = experimental_StreamedQueryOutput<TOutput>>(...rest: MaybeOptionalOptions<U & experimental_StreamedOptionsIn<TClientContext, TInput, experimental_StreamedQueryOutput<TOutput>, TError, USelectData>>): NoInfer<U & Omit<experimental_StreamedOptionsBase<experimental_StreamedQueryOutput<TOutput>, TError>, keyof U>>;
100
99
  /**
101
100
  * Generate options used for useInfiniteQuery/useSuspenseInfiniteQuery/prefetchInfiniteQuery/...
102
101
  *
103
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
102
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
104
103
  */
105
104
  infiniteOptions<U, UPageParam, USelectData = InfiniteData<TOutput, UPageParam>>(options: U & InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam>): NoInfer<U & Omit<InfiniteOptionsBase<TOutput, TError, UPageParam>, keyof U>>;
106
105
  /**
107
106
  * Generate options used for useMutation/...
108
107
  *
109
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
108
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
110
109
  */
111
110
  mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptions<TInput, TOutput, TError, UMutationContext>>;
112
111
  }
package/dist/index.d.ts CHANGED
@@ -1,21 +1,7 @@
1
- import { OperationType as OperationType$1, OperationKeyOptions as OperationKeyOptions$1, OperationKey as OperationKey$1 } from '@orpc/tanstack-query';
2
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
3
2
  import { SetOptional, PartialDeep, MaybeOptionalOptions } from '@orpc/shared';
4
3
  import { SkipToken, QueryObserverOptions, QueryKey, QueryFunction, experimental_streamedQuery, InfiniteQueryObserverOptions, InfiniteData, MutationObserverOptions } from '@tanstack/query-core';
5
4
 
6
- /**
7
- * Utils at any level (procedure or router)
8
- */
9
- interface GeneralUtils<TInput> {
10
- /**
11
- * Generate a query/mutation key for checking status, invalidate, set, get, etc.
12
- *
13
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
14
- */
15
- key<TType extends OperationType$1>(options?: OperationKeyOptions$1<TType, TInput>): OperationKey$1<TType, TInput>;
16
- }
17
- declare function createGeneralUtils<TInput>(path: readonly string[]): GeneralUtils<TInput>;
18
-
19
5
  type experimental_StreamedQueryOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
20
6
  type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
21
7
  type OperationType = 'query' | 'streamed' | 'infinite' | 'mutation';
@@ -59,7 +45,7 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
59
45
  context?: TClientContext;
60
46
  } : {
61
47
  context: TClientContext;
62
- }) & SetOptional<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey'>;
48
+ }) & SetOptional<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>, 'queryKey'>;
63
49
  interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
64
50
  queryKey: QueryKey;
65
51
  queryFn: QueryFunction<TOutput, QueryKey, TPageParam>;
@@ -75,38 +61,51 @@ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
75
61
  }) & MutationOptions<TInput, TOutput, TError, TMutationContext>;
76
62
  type MutationOptions<TInput, TOutput, TError, TMutationContext> = MutationObserverOptions<TOutput, TError, TInput, TMutationContext>;
77
63
 
64
+ /**
65
+ * Utils at any level (procedure or router)
66
+ */
67
+ interface GeneralUtils<TInput> {
68
+ /**
69
+ * Generate a query/mutation key for checking status, invalidate, set, get, etc.
70
+ *
71
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
72
+ */
73
+ key<TType extends OperationType>(options?: OperationKeyOptions<TType, TInput>): OperationKey<TType, TInput>;
74
+ }
75
+ declare function createGeneralUtils<TInput>(path: readonly string[]): GeneralUtils<TInput>;
76
+
78
77
  declare function generateOperationKey<TType extends OperationType, TInput>(path: readonly string[], state?: OperationKeyOptions<TType, TInput>): OperationKey<TType, TInput>;
79
78
 
80
79
  interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
81
80
  /**
82
81
  * Calling corresponding procedure client
83
82
  *
84
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
83
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
85
84
  */
86
85
  call: Client<TClientContext, TInput, TOutput, TError>;
87
86
  /**
88
87
  * Generate options used for useQuery/useSuspenseQuery/prefetchQuery/...
89
88
  *
90
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
89
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
91
90
  */
92
91
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
93
92
  /**
94
93
  * Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/useSuspenseQuery/prefetchQuery/...
95
94
  * Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
96
95
  *
97
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
96
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
98
97
  */
99
98
  experimental_streamedOptions<U, USelectData = experimental_StreamedQueryOutput<TOutput>>(...rest: MaybeOptionalOptions<U & experimental_StreamedOptionsIn<TClientContext, TInput, experimental_StreamedQueryOutput<TOutput>, TError, USelectData>>): NoInfer<U & Omit<experimental_StreamedOptionsBase<experimental_StreamedQueryOutput<TOutput>, TError>, keyof U>>;
100
99
  /**
101
100
  * Generate options used for useInfiniteQuery/useSuspenseInfiniteQuery/prefetchInfiniteQuery/...
102
101
  *
103
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
102
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
104
103
  */
105
104
  infiniteOptions<U, UPageParam, USelectData = InfiniteData<TOutput, UPageParam>>(options: U & InfiniteOptionsIn<TClientContext, TInput, TOutput, TError, USelectData, UPageParam>): NoInfer<U & Omit<InfiniteOptionsBase<TOutput, TError, UPageParam>, keyof U>>;
106
105
  /**
107
106
  * Generate options used for useMutation/...
108
107
  *
109
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
108
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
110
109
  */
111
110
  mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<MutationOptions<TInput, TOutput, TError, UMutationContext>>;
112
111
  }
package/dist/index.mjs CHANGED
@@ -1,15 +1,6 @@
1
- import { generateOperationKey as generateOperationKey$1 } from '@orpc/tanstack-query';
2
1
  import { isAsyncIteratorObject, toArray } from '@orpc/shared';
3
2
  import { skipToken, experimental_streamedQuery } from '@tanstack/query-core';
4
3
 
5
- function createGeneralUtils(path) {
6
- return {
7
- key(options) {
8
- return generateOperationKey$1(path, options);
9
- }
10
- };
11
- }
12
-
13
4
  function generateOperationKey(path, state = {}) {
14
5
  return [path, {
15
6
  ...state.input !== void 0 ? { input: state.input } : {},
@@ -18,6 +9,14 @@ function generateOperationKey(path, state = {}) {
18
9
  }];
19
10
  }
20
11
 
12
+ function createGeneralUtils(path) {
13
+ return {
14
+ key(options) {
15
+ return generateOperationKey(path, options);
16
+ }
17
+ };
18
+ }
19
+
21
20
  const OPERATION_CONTEXT_SYMBOL = Symbol("ORPC_OPERATION_CONTEXT");
22
21
 
23
22
  function createProcedureUtils(client, options) {
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.19c2a69",
4
+ "version": "0.0.0-next.2147e3f",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -24,23 +24,23 @@
24
24
  "dist"
25
25
  ],
26
26
  "peerDependencies": {
27
- "@tanstack/query-core": ">=5.55.0",
28
- "@orpc/client": "0.0.0-next.19c2a69"
27
+ "@tanstack/query-core": ">=5.80.2",
28
+ "@orpc/client": "0.0.0-next.2147e3f"
29
29
  },
30
30
  "dependencies": {
31
- "@orpc/shared": "0.0.0-next.19c2a69"
31
+ "@orpc/shared": "0.0.0-next.2147e3f"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@angular/core": "^20.0.0",
35
- "@tanstack/angular-query-experimental": "^5.77.2",
36
- "@tanstack/query-core": "^5.77.2",
37
- "@tanstack/react-query": "^5.77.2",
38
- "@tanstack/solid-query": "^5.77.2",
39
- "@tanstack/svelte-query": "^5.77.2",
40
- "@tanstack/vue-query": "^5.77.2",
35
+ "@tanstack/angular-query-experimental": "^5.80.2",
36
+ "@tanstack/query-core": "^5.80.2",
37
+ "@tanstack/react-query": "^5.80.5",
38
+ "@tanstack/solid-query": "^5.80.2",
39
+ "@tanstack/svelte-query": "^5.80.2",
40
+ "@tanstack/vue-query": "^5.80.2",
41
41
  "svelte": "^5.26.2",
42
42
  "vue": "^3.5.16",
43
- "zod": "^3.25.11"
43
+ "zod": "^3.25.49"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "unbuild",