@orpc/vue-query 0.0.0-next.f538070 → 0.0.0-next.f81b4a2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +43 -5
- package/dist/index.d.ts +43 -5
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
|
-
import { QueryKey, QueryObserverOptions, QueryFunctionContext,
|
|
3
|
-
import { PartialDeep, AnyFunction,
|
|
2
|
+
import { QueryKey, QueryObserverOptions, QueryFunctionContext, InfiniteQueryObserverOptions, MutationObserverOptions, InfiniteData } from '@tanstack/vue-query';
|
|
3
|
+
import { PartialDeep, AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
|
|
4
4
|
import { MaybeRef, MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
|
|
5
5
|
|
|
6
6
|
type KeyType = 'query' | 'infinite' | 'mutation' | undefined;
|
|
@@ -11,6 +11,11 @@ interface BuildKeyOptions<TType extends KeyType, TInput> {
|
|
|
11
11
|
declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
|
|
12
12
|
|
|
13
13
|
interface GeneralUtils<TInput> {
|
|
14
|
+
/**
|
|
15
|
+
* Generate a query/mutation key for checking status, invalidate, set, get, etc.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
18
|
+
*/
|
|
14
19
|
key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
|
|
15
20
|
}
|
|
16
21
|
declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
|
@@ -35,7 +40,7 @@ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TErro
|
|
|
35
40
|
} & {
|
|
36
41
|
enabled?: MaybeRefOrGetter<QueryObserverOptions<TOutput, TError, TSelectData, TOutput>['enabled']>;
|
|
37
42
|
queryKey?: MaybeRefDeep<QueryObserverOptions<TOutput, TError, TSelectData, TOutput>['queryKey']>;
|
|
38
|
-
shallow?:
|
|
43
|
+
shallow?: boolean;
|
|
39
44
|
};
|
|
40
45
|
interface QueryOptionsBase<TOutput, TError> {
|
|
41
46
|
queryKey: ComputedRef<QueryKey>;
|
|
@@ -48,7 +53,13 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
|
|
|
48
53
|
context?: MaybeRefDeep<TClientContext>;
|
|
49
54
|
} : {
|
|
50
55
|
context: MaybeRefDeep<TClientContext>;
|
|
51
|
-
}) &
|
|
56
|
+
}) & {
|
|
57
|
+
[Property in keyof Omit<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey' | 'enabled'>]: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>[Property]>;
|
|
58
|
+
} & {
|
|
59
|
+
enabled?: MaybeRefOrGetter<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['enabled']>;
|
|
60
|
+
queryKey?: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['queryKey']>;
|
|
61
|
+
shallow?: boolean;
|
|
62
|
+
};
|
|
52
63
|
interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
|
|
53
64
|
queryKey: ComputedRef<QueryKey>;
|
|
54
65
|
queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
|
|
@@ -66,9 +77,29 @@ type MutationOptions<TInput, TOutput, TError, TMutationContext> = {
|
|
|
66
77
|
};
|
|
67
78
|
|
|
68
79
|
interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
|
|
80
|
+
/**
|
|
81
|
+
* Calling corresponding procedure client
|
|
82
|
+
*
|
|
83
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
|
|
84
|
+
*/
|
|
69
85
|
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
86
|
+
/**
|
|
87
|
+
* Generate options used for useQuery/prefetchQuery/...
|
|
88
|
+
*
|
|
89
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
|
|
90
|
+
*/
|
|
70
91
|
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
|
92
|
+
/**
|
|
93
|
+
* Generate options used for useInfiniteQuery/prefetchInfiniteQuery/...
|
|
94
|
+
*
|
|
95
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
|
|
96
|
+
*/
|
|
71
97
|
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>>;
|
|
98
|
+
/**
|
|
99
|
+
* Generate options used for useMutation/...
|
|
100
|
+
*
|
|
101
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
|
|
102
|
+
*/
|
|
72
103
|
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
|
|
73
104
|
}
|
|
74
105
|
interface CreateProcedureUtilsOptions {
|
|
@@ -82,6 +113,12 @@ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientCo
|
|
|
82
113
|
interface CreateRouterUtilsOptions {
|
|
83
114
|
path?: string[];
|
|
84
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Create a router utils from a client.
|
|
118
|
+
*
|
|
119
|
+
* @info Both client-side and server-side clients are supported.
|
|
120
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/vue Tanstack Query Vue Docs}
|
|
121
|
+
*/
|
|
85
122
|
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
86
123
|
|
|
87
124
|
type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunction ? T : T extends object ? {
|
|
@@ -89,4 +126,5 @@ type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunctio
|
|
|
89
126
|
} : T;
|
|
90
127
|
declare function unrefDeep<T>(value: T): UnrefDeep<T>;
|
|
91
128
|
|
|
92
|
-
export {
|
|
129
|
+
export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
|
|
130
|
+
export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, KeyType, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
|
2
|
-
import { QueryKey, QueryObserverOptions, QueryFunctionContext,
|
|
3
|
-
import { PartialDeep, AnyFunction,
|
|
2
|
+
import { QueryKey, QueryObserverOptions, QueryFunctionContext, InfiniteQueryObserverOptions, MutationObserverOptions, InfiniteData } from '@tanstack/vue-query';
|
|
3
|
+
import { PartialDeep, AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
|
|
4
4
|
import { MaybeRef, MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
|
|
5
5
|
|
|
6
6
|
type KeyType = 'query' | 'infinite' | 'mutation' | undefined;
|
|
@@ -11,6 +11,11 @@ interface BuildKeyOptions<TType extends KeyType, TInput> {
|
|
|
11
11
|
declare function buildKey<TType extends KeyType, TInput>(path: string[], options?: BuildKeyOptions<TType, TInput>): QueryKey;
|
|
12
12
|
|
|
13
13
|
interface GeneralUtils<TInput> {
|
|
14
|
+
/**
|
|
15
|
+
* Generate a query/mutation key for checking status, invalidate, set, get, etc.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-mutation-key Tanstack Query/Mutation Key Docs}
|
|
18
|
+
*/
|
|
14
19
|
key<UType extends KeyType = undefined>(options?: BuildKeyOptions<UType, TInput>): QueryKey;
|
|
15
20
|
}
|
|
16
21
|
declare function createGeneralUtils<TInput>(path: string[]): GeneralUtils<TInput>;
|
|
@@ -35,7 +40,7 @@ type QueryOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TErro
|
|
|
35
40
|
} & {
|
|
36
41
|
enabled?: MaybeRefOrGetter<QueryObserverOptions<TOutput, TError, TSelectData, TOutput>['enabled']>;
|
|
37
42
|
queryKey?: MaybeRefDeep<QueryObserverOptions<TOutput, TError, TSelectData, TOutput>['queryKey']>;
|
|
38
|
-
shallow?:
|
|
43
|
+
shallow?: boolean;
|
|
39
44
|
};
|
|
40
45
|
interface QueryOptionsBase<TOutput, TError> {
|
|
41
46
|
queryKey: ComputedRef<QueryKey>;
|
|
@@ -48,7 +53,13 @@ type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
|
|
|
48
53
|
context?: MaybeRefDeep<TClientContext>;
|
|
49
54
|
} : {
|
|
50
55
|
context: MaybeRefDeep<TClientContext>;
|
|
51
|
-
}) &
|
|
56
|
+
}) & {
|
|
57
|
+
[Property in keyof Omit<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>, 'queryKey' | 'enabled'>]: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>[Property]>;
|
|
58
|
+
} & {
|
|
59
|
+
enabled?: MaybeRefOrGetter<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['enabled']>;
|
|
60
|
+
queryKey?: MaybeRefDeep<InfiniteQueryObserverOptions<TOutput, TError, TSelectData, TOutput, QueryKey, TPageParam>['queryKey']>;
|
|
61
|
+
shallow?: boolean;
|
|
62
|
+
};
|
|
52
63
|
interface InfiniteOptionsBase<TOutput, TError, TPageParam> {
|
|
53
64
|
queryKey: ComputedRef<QueryKey>;
|
|
54
65
|
queryFn(ctx: QueryFunctionContext<QueryKey, TPageParam>): Promise<TOutput>;
|
|
@@ -66,9 +77,29 @@ type MutationOptions<TInput, TOutput, TError, TMutationContext> = {
|
|
|
66
77
|
};
|
|
67
78
|
|
|
68
79
|
interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError> {
|
|
80
|
+
/**
|
|
81
|
+
* Calling corresponding procedure client
|
|
82
|
+
*
|
|
83
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#calling-procedure-clients Tanstack Calling Procedure Client Docs}
|
|
84
|
+
*/
|
|
69
85
|
call: Client<TClientContext, TInput, TOutput, TError>;
|
|
86
|
+
/**
|
|
87
|
+
* Generate options used for useQuery/prefetchQuery/...
|
|
88
|
+
*
|
|
89
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#query-options-utility Tanstack Query Options Utility Docs}
|
|
90
|
+
*/
|
|
70
91
|
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
|
92
|
+
/**
|
|
93
|
+
* Generate options used for useInfiniteQuery/prefetchInfiniteQuery/...
|
|
94
|
+
*
|
|
95
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#infinite-query-options-utility Tanstack Infinite Query Options Utility Docs}
|
|
96
|
+
*/
|
|
71
97
|
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>>;
|
|
98
|
+
/**
|
|
99
|
+
* Generate options used for useMutation/...
|
|
100
|
+
*
|
|
101
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/basic#mutation-options Tanstack Mutation Options Docs}
|
|
102
|
+
*/
|
|
72
103
|
mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
|
|
73
104
|
}
|
|
74
105
|
interface CreateProcedureUtilsOptions {
|
|
@@ -82,6 +113,12 @@ type RouterUtils<T extends NestedClient<any>> = T extends Client<infer UClientCo
|
|
|
82
113
|
interface CreateRouterUtilsOptions {
|
|
83
114
|
path?: string[];
|
|
84
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Create a router utils from a client.
|
|
118
|
+
*
|
|
119
|
+
* @info Both client-side and server-side clients are supported.
|
|
120
|
+
* @see {@link https://orpc.unnoq.com/docs/tanstack-query/vue Tanstack Query Vue Docs}
|
|
121
|
+
*/
|
|
85
122
|
declare function createRouterUtils<T extends NestedClient<any>>(client: T, options?: CreateRouterUtilsOptions): RouterUtils<T>;
|
|
86
123
|
|
|
87
124
|
type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunction ? T : T extends object ? {
|
|
@@ -89,4 +126,5 @@ type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunctio
|
|
|
89
126
|
} : T;
|
|
90
127
|
declare function unrefDeep<T>(value: T): UnrefDeep<T>;
|
|
91
128
|
|
|
92
|
-
export {
|
|
129
|
+
export { buildKey, createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
|
|
130
|
+
export type { BuildKeyOptions, CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, KeyType, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, 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.
|
|
4
|
+
"version": "0.0.0-next.f81b4a2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@tanstack/vue-query": ">=5.
|
|
30
|
+
"@tanstack/vue-query": ">=5.55.0",
|
|
31
31
|
"vue": ">=3.3.0",
|
|
32
|
-
"@orpc/client": "0.0.0-next.
|
|
32
|
+
"@orpc/client": "0.0.0-next.f81b4a2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@
|
|
35
|
+
"@tanstack/vue-query": "^5.72.2",
|
|
36
|
+
"@orpc/shared": "0.0.0-next.f81b4a2"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "unbuild",
|