@orpc/vue-query 0.0.0-next.fb0d07c → 0.0.0-next.fc23c8d

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
@@ -30,7 +30,7 @@
30
30
  - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
31
  - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
32
  - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
- - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
33
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
34
34
  - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
35
35
  - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
36
36
  - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
@@ -49,21 +49,19 @@ 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/).
63
61
 
64
62
  ## `@orpc/vue-query`
65
63
 
66
- Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview). Read the [documentation](https://orpc.unnoq.com/docs/tanstack-query/vue) for more information.
64
+ Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview). Read the [documentation](https://orpc.unnoq.com/docs/integrations/tanstack-query-old/vue) for more information.
67
65
 
68
66
  ```ts
69
67
  export function Setup() {
package/dist/index.d.mts CHANGED
@@ -1,22 +1,17 @@
1
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
3
+ export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
2
4
  import { QueryKey, SkipToken, QueryObserverOptions, QueryFunctionContext, experimental_streamedQuery, InfiniteQueryObserverOptions, MutationObserverOptions, InfiniteData } from '@tanstack/vue-query';
3
- import { PartialDeep, AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
5
+ import { AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
4
6
  import { MaybeRef, MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
5
7
 
6
- type KeyType = 'query' | 'streamed' | 'infinite' | 'mutation' | undefined;
7
- interface BuildKeyOptions<TType extends KeyType, TInput> {
8
- type?: TType;
9
- input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
10
- }
11
- declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
12
-
13
8
  interface GeneralUtils<TInput> {
14
9
  /**
15
10
  * Generate a query/mutation key for checking status, invalidate, set, get, etc.
16
11
  *
17
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
12
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
18
13
  */
19
- key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
14
+ key<UType extends OperationType>(options?: OperationKeyOptions<UType, TInput>): QueryKey;
20
15
  }
21
16
  declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
22
17
 
@@ -46,11 +41,14 @@ interface QueryOptionsBase<TOutput, TError> {
46
41
  queryKey: ComputedRef<QueryKey>;
47
42
  queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
48
43
  throwOnError?(error: TError): boolean;
44
+ retryDelay?: (count: number, error: TError) => number;
49
45
  enabled: ComputedRef<boolean>;
50
46
  }
51
47
  type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
52
48
  type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
53
- type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & experimental_StreamedQueryOptions;
49
+ type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
50
+ queryFnOptions?: experimental_StreamedQueryOptions;
51
+ };
54
52
  interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
55
53
  }
56
54
  type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = (Record<never, never> extends TClientContext ? {
@@ -58,17 +56,18 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
58
56
  } : {
59
57
  context: MaybeRefDeep<TClientContext>;
60
58
  }) & {
61
- [Property in keyof Omit<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey' | 'enabled'>]: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>[Property]>;
59
+ [Property in keyof Omit<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>, 'queryKey' | 'enabled'>]: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>[Property]>;
62
60
  } & {
63
61
  input: MaybeRef<((pageParam: TPageParam) => MaybeRefDeep<TInput>) | SkipToken>;
64
- enabled?: MaybeRefOrGetter<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['enabled']>;
65
- queryKey?: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['queryKey']>;
62
+ enabled?: MaybeRefOrGetter<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>['enabled']>;
63
+ queryKey?: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>['queryKey']>;
66
64
  shallow?: boolean;
67
65
  };
68
66
  interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
69
67
  queryKey: ComputedRef<QueryKey>;
70
68
  queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
71
69
  throwOnError?(error: TError): boolean;
70
+ retryDelay?: (count: number, error: TError) => number;
72
71
  enabled: ComputedRef<boolean>;
73
72
  }
74
73
  type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext> = (Record<never, never> extends TClientContext ? {
@@ -86,32 +85,32 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
86
85
  /**
87
86
  * Calling corresponding procedure client
88
87
  *
89
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
88
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
90
89
  */
91
90
  call: Client<TClientContext, TInput, TOutput, TError>;
92
91
  /**
93
92
  * Generate options used for useQuery/prefetchQuery/...
94
93
  *
95
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
94
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
96
95
  */
97
96
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
98
97
  /**
99
98
  * Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
100
99
  * Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
101
100
  *
102
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
101
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
103
102
  */
104
103
  experimental_streamedOptions<U, USelectData = experimental_InferStreamedOutput<TOutput>>(...rest: MaybeOptionalOptions<U & experimental_StreamedOptionsIn<TClientContext, TInput, experimental_InferStreamedOutput<TOutput>, TError, USelectData>>): NoInfer<U & Omit<experimental_StreamedOptionsBase<experimental_InferStreamedOutput<TOutput>, TError>, keyof U>>;
105
104
  /**
106
105
  * Generate options used for useInfiniteQuery/prefetchInfiniteQuery/...
107
106
  *
108
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
107
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
109
108
  */
110
109
  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>>;
111
110
  /**
112
111
  * Generate options used for useMutation/...
113
112
  *
114
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
113
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
115
114
  */
116
115
  mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
117
116
  }
@@ -130,7 +129,7 @@ interface CreateRouterUtilsOptions {
130
129
  * Create a router utils from a client.
131
130
  *
132
131
  * @info Both client-side and server-side clients are supported.
133
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/vue Tanstack Query Vue Docs}
132
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/vue Tanstack Query Vue Docs}
134
133
  */
135
134
  declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
136
135
 
@@ -139,5 +138,5 @@ type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunctio
139
138
  } : T;
140
139
  declare function unrefDeep<T>(value: T): UnrefDeep<T>;
141
140
 
142
- export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
143
- export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, KeyType, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
141
+ export { createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
142
+ export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,17 @@
1
1
  import { ClientContext, Client, NestedClient } from '@orpc/client';
2
+ import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
3
+ export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
2
4
  import { QueryKey, SkipToken, QueryObserverOptions, QueryFunctionContext, experimental_streamedQuery, InfiniteQueryObserverOptions, MutationObserverOptions, InfiniteData } from '@tanstack/vue-query';
3
- import { PartialDeep, AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
5
+ import { AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
4
6
  import { MaybeRef, MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
5
7
 
6
- type KeyType = 'query' | 'streamed' | 'infinite' | 'mutation' | undefined;
7
- interface BuildKeyOptions<TType extends KeyType, TInput> {
8
- type?: TType;
9
- input?: TType extends 'mutation' ? never : PartialDeep<TInput>;
10
- }
11
- declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
12
-
13
8
  interface GeneralUtils<TInput> {
14
9
  /**
15
10
  * Generate a query/mutation key for checking status, invalidate, set, get, etc.
16
11
  *
17
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
12
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
18
13
  */
19
- key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
14
+ key<UType extends OperationType>(options?: OperationKeyOptions<UType, TInput>): QueryKey;
20
15
  }
21
16
  declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
22
17
 
@@ -46,11 +41,14 @@ interface QueryOptionsBase<TOutput, TError> {
46
41
  queryKey: ComputedRef<QueryKey>;
47
42
  queryFn(ctx: QueryFunctionContext): Promise<TOutput>;
48
43
  throwOnError?(error: TError): boolean;
44
+ retryDelay?: (count: number, error: TError) => number;
49
45
  enabled: ComputedRef<boolean>;
50
46
  }
51
47
  type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
52
48
  type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
53
- type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & experimental_StreamedQueryOptions;
49
+ type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
50
+ queryFnOptions?: experimental_StreamedQueryOptions;
51
+ };
54
52
  interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
55
53
  }
56
54
  type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = (Record<never, never> extends TClientContext ? {
@@ -58,17 +56,18 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
58
56
  } : {
59
57
  context: MaybeRefDeep<TClientContext>;
60
58
  }) & {
61
- [Property in keyof Omit<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey' | 'enabled'>]: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>[Property]>;
59
+ [Property in keyof Omit<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>, 'queryKey' | 'enabled'>]: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>[Property]>;
62
60
  } & {
63
61
  input: MaybeRef<((pageParam: TPageParam) => MaybeRefDeep<TInput>) | SkipToken>;
64
- enabled?: MaybeRefOrGetter<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['enabled']>;
65
- queryKey?: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['queryKey']>;
62
+ enabled?: MaybeRefOrGetter<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>['enabled']>;
63
+ queryKey?: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, QueryKey, TPageParam>['queryKey']>;
66
64
  shallow?: boolean;
67
65
  };
68
66
  interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
69
67
  queryKey: ComputedRef<QueryKey>;
70
68
  queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
71
69
  throwOnError?(error: TError): boolean;
70
+ retryDelay?: (count: number, error: TError) => number;
72
71
  enabled: ComputedRef<boolean>;
73
72
  }
74
73
  type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TMutationContext> = (Record<never, never> extends TClientContext ? {
@@ -86,32 +85,32 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
86
85
  /**
87
86
  * Calling corresponding procedure client
88
87
  *
89
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
88
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
90
89
  */
91
90
  call: Client<TClientContext, TInput, TOutput, TError>;
92
91
  /**
93
92
  * Generate options used for useQuery/prefetchQuery/...
94
93
  *
95
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
94
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
96
95
  */
97
96
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
98
97
  /**
99
98
  * Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
100
99
  * Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
101
100
  *
102
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
101
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
103
102
  */
104
103
  experimental_streamedOptions<U, USelectData = experimental_InferStreamedOutput<TOutput>>(...rest: MaybeOptionalOptions<U & experimental_StreamedOptionsIn<TClientContext, TInput, experimental_InferStreamedOutput<TOutput>, TError, USelectData>>): NoInfer<U & Omit<experimental_StreamedOptionsBase<experimental_InferStreamedOutput<TOutput>, TError>, keyof U>>;
105
104
  /**
106
105
  * Generate options used for useInfiniteQuery/prefetchInfiniteQuery/...
107
106
  *
108
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
107
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
109
108
  */
110
109
  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>>;
111
110
  /**
112
111
  * Generate options used for useMutation/...
113
112
  *
114
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
113
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#mutation-options Tanstack Mutation Options Docs}
115
114
  */
116
115
  mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
117
116
  }
@@ -130,7 +129,7 @@ interface CreateRouterUtilsOptions {
130
129
  * Create a router utils from a client.
131
130
  *
132
131
  * @info Both client-side and server-side clients are supported.
133
- * @see {@link https://orpc.unnoq.com/docs/tanstack-query/vue Tanstack Query Vue Docs}
132
+ * @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/vue Tanstack Query Vue Docs}
134
133
  */
135
134
  declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
136
135
 
@@ -139,5 +138,5 @@ type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunctio
139
138
  } : T;
140
139
  declare function unrefDeep<T>(value: T): UnrefDeep<T>;
141
140
 
142
- export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
143
- export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, KeyType, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
141
+ export { createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
142
+ export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep, experimental_InferStreamedOutput, experimental_StreamedOptionsBase, experimental_StreamedOptionsIn };
package/dist/index.mjs CHANGED
@@ -1,20 +1,13 @@
1
+ import { generateOperationKey } from '@orpc/tanstack-query';
2
+ export { generateOperationKey as buildKey } from '@orpc/tanstack-query';
1
3
  import { isObject, isAsyncIteratorObject } from '@orpc/shared';
2
4
  import { skipToken, experimental_streamedQuery } from '@tanstack/vue-query';
3
5
  import { isRef, computed } from 'vue';
4
6
 
5
- function buildKey(path, options) {
6
- const withInput = options?.input !== void 0 ? { input: options?.input } : {};
7
- const withType = options?.type !== void 0 ? { type: options?.type } : {};
8
- return [path, {
9
- ...withInput,
10
- ...withType
11
- }];
12
- }
13
-
14
7
  function createGeneralUtils(path) {
15
8
  return {
16
9
  key(options) {
17
- return buildKey(path, options);
10
+ return generateOperationKey(path, options);
18
11
  }
19
12
  };
20
13
  }
@@ -40,7 +33,7 @@ function createProcedureUtils(client, options) {
40
33
  call: client,
41
34
  queryOptions(...[optionsIn = {}]) {
42
35
  return {
43
- queryKey: computed(() => buildKey(options.path, { type: "query", input: unrefDeep(optionsIn.input) })),
36
+ queryKey: computed(() => generateOperationKey(options.path, { type: "query", input: unrefDeep(optionsIn.input) })),
44
37
  queryFn: ({ signal }) => {
45
38
  const input = unrefDeep(optionsIn.input);
46
39
  if (input === skipToken) {
@@ -55,9 +48,8 @@ function createProcedureUtils(client, options) {
55
48
  experimental_streamedOptions(...[optionsIn = {}]) {
56
49
  return {
57
50
  enabled: computed(() => unrefDeep(optionsIn.input) !== skipToken),
58
- queryKey: computed(() => buildKey(options.path, { type: "streamed", input: unrefDeep(optionsIn.input) })),
51
+ queryKey: computed(() => generateOperationKey(options.path, { type: "streamed", input: unrefDeep(optionsIn.input), fnOptions: optionsIn.queryFnOptions })),
59
52
  queryFn: experimental_streamedQuery({
60
- ...optionsIn,
61
53
  queryFn: async ({ signal }) => {
62
54
  const input = unrefDeep(optionsIn.input);
63
55
  if (input === skipToken) {
@@ -68,7 +60,8 @@ function createProcedureUtils(client, options) {
68
60
  throw new Error("streamedQuery requires an event iterator output");
69
61
  }
70
62
  return output;
71
- }
63
+ },
64
+ ...optionsIn.queryFnOptions
72
65
  }),
73
66
  ...optionsIn
74
67
  };
@@ -77,7 +70,7 @@ function createProcedureUtils(client, options) {
77
70
  return {
78
71
  queryKey: computed(() => {
79
72
  const input = unrefDeep(optionsIn.input);
80
- return buildKey(options.path, {
73
+ return generateOperationKey(options.path, {
81
74
  type: "infinite",
82
75
  input: input === skipToken ? skipToken : unrefDeep(input(unrefDeep(optionsIn.initialPageParam)))
83
76
  });
@@ -95,7 +88,7 @@ function createProcedureUtils(client, options) {
95
88
  },
96
89
  mutationOptions(...[optionsIn = {}]) {
97
90
  return {
98
- mutationKey: buildKey(options.path, { type: "mutation" }),
91
+ mutationKey: generateOperationKey(options.path, { type: "mutation" }),
99
92
  mutationFn: (input) => client(input, { context: unrefDeep(optionsIn.context) }),
100
93
  ...optionsIn
101
94
  };
@@ -130,4 +123,4 @@ function createRouterUtils(client, options = {}) {
130
123
  return recursive;
131
124
  }
132
125
 
133
- export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
126
+ export { createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/vue-query",
3
3
  "type": "module",
4
- "version": "0.0.0-next.fb0d07c",
4
+ "version": "0.0.0-next.fc23c8d",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -27,15 +27,16 @@
27
27
  "dist"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@tanstack/vue-query": ">=5.55.0",
30
+ "@tanstack/vue-query": ">=5.80.2",
31
31
  "vue": ">=3.3.0",
32
- "@orpc/client": "0.0.0-next.fb0d07c"
32
+ "@orpc/client": "0.0.0-next.fc23c8d"
33
33
  },
34
34
  "dependencies": {
35
- "@orpc/shared": "0.0.0-next.fb0d07c"
35
+ "@orpc/shared": "0.0.0-next.fc23c8d",
36
+ "@orpc/tanstack-query": "0.0.0-next.fc23c8d"
36
37
  },
37
38
  "devDependencies": {
38
- "@tanstack/vue-query": "^5.72.3"
39
+ "@tanstack/vue-query": "^5.80.10"
39
40
  },
40
41
  "scripts": {
41
42
  "build": "unbuild",