@orpc/vue-query 1.8.8 → 1.9.0
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 +2 -16
- package/dist/index.d.ts +2 -16
- package/dist/index.mjs +2 -23
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
2
2
|
import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
|
3
3
|
export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
|
4
|
-
import { QueryKey, SkipToken, QueryObserverOptions, QueryFunctionContext,
|
4
|
+
import { QueryKey, SkipToken, QueryObserverOptions, QueryFunctionContext, InfiniteQueryObserverOptions, MutationObserverOptions, InfiniteData } from '@tanstack/vue-query';
|
5
5
|
import { AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
|
6
6
|
import { MaybeRef, MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
|
7
7
|
|
@@ -44,13 +44,6 @@ interface QueryOptionsBase<TOutput, TError> {
|
|
44
44
|
retryDelay?: (count: number, error: TError) => number;
|
45
45
|
enabled: ComputedRef<boolean | undefined>;
|
46
46
|
}
|
47
|
-
type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
|
48
|
-
type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
|
49
|
-
type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
|
50
|
-
queryFnOptions?: experimental_StreamedQueryOptions;
|
51
|
-
};
|
52
|
-
interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
|
53
|
-
}
|
54
47
|
type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = (Record<never, never> extends TClientContext ? {
|
55
48
|
context?: MaybeRefDeep<TClientContext>;
|
56
49
|
} : {
|
@@ -94,13 +87,6 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
|
|
94
87
|
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
|
95
88
|
*/
|
96
89
|
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
97
|
-
/**
|
98
|
-
* Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
|
99
|
-
* Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
|
100
|
-
*
|
101
|
-
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
|
102
|
-
*/
|
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>>;
|
104
90
|
/**
|
105
91
|
* Generate options used for useInfiniteQuery/prefetchInfiniteQuery/...
|
106
92
|
*
|
@@ -139,4 +125,4 @@ type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunctio
|
|
139
125
|
declare function unrefDeep<T>(value: T): UnrefDeep<T>;
|
140
126
|
|
141
127
|
export { createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
|
142
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep
|
128
|
+
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep };
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ClientContext, Client, NestedClient } from '@orpc/client';
|
2
2
|
import { OperationType, OperationKeyOptions } from '@orpc/tanstack-query';
|
3
3
|
export { OperationKeyOptions as BuildKeyOptions, OperationType as KeyType, generateOperationKey as buildKey } from '@orpc/tanstack-query';
|
4
|
-
import { QueryKey, SkipToken, QueryObserverOptions, QueryFunctionContext,
|
4
|
+
import { QueryKey, SkipToken, QueryObserverOptions, QueryFunctionContext, InfiniteQueryObserverOptions, MutationObserverOptions, InfiniteData } from '@tanstack/vue-query';
|
5
5
|
import { AnyFunction, MaybeOptionalOptions } from '@orpc/shared';
|
6
6
|
import { MaybeRef, MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
|
7
7
|
|
@@ -44,13 +44,6 @@ interface QueryOptionsBase<TOutput, TError> {
|
|
44
44
|
retryDelay?: (count: number, error: TError) => number;
|
45
45
|
enabled: ComputedRef<boolean | undefined>;
|
46
46
|
}
|
47
|
-
type experimental_StreamedQueryOptions = Omit<Parameters<typeof experimental_streamedQuery>[0], 'queryFn'>;
|
48
|
-
type experimental_InferStreamedOutput<TOutput> = TOutput extends AsyncIterable<infer U> ? U[] : never;
|
49
|
-
type experimental_StreamedOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData> = QueryOptionsIn<TClientContext, TInput, TOutput, TError, TSelectData> & {
|
50
|
-
queryFnOptions?: experimental_StreamedQueryOptions;
|
51
|
-
};
|
52
|
-
interface experimental_StreamedOptionsBase<TOutput, TError> extends QueryOptionsBase<TOutput, TError> {
|
53
|
-
}
|
54
47
|
type InfiniteOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TError, TSelectData, TPageParam> = (Record<never, never> extends TClientContext ? {
|
55
48
|
context?: MaybeRefDeep<TClientContext>;
|
56
49
|
} : {
|
@@ -94,13 +87,6 @@ interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput,
|
|
94
87
|
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#query-options-utility Tanstack Query Options Utility Docs}
|
95
88
|
*/
|
96
89
|
queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
|
97
|
-
/**
|
98
|
-
* Generate [Event Iterator](https://orpc.unnoq.com/docs/event-iterator) options used for useQuery/prefetchQuery/...
|
99
|
-
* Built on top of [steamedQuery](https://tanstack.com/query/latest/docs/reference/streamedQuery)
|
100
|
-
*
|
101
|
-
* @see {@link https://orpc.unnoq.com/docs/integrations/tanstack-query-old/basic#streamed-query-options-utility Tanstack Streamed Query Options Utility Docs}
|
102
|
-
*/
|
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>>;
|
104
90
|
/**
|
105
91
|
* Generate options used for useInfiniteQuery/prefetchInfiniteQuery/...
|
106
92
|
*
|
@@ -139,4 +125,4 @@ type UnrefDeep<T> = T extends Ref<infer U> ? UnrefDeep<U> : T extends AnyFunctio
|
|
139
125
|
declare function unrefDeep<T>(value: T): UnrefDeep<T>;
|
140
126
|
|
141
127
|
export { createGeneralUtils, createRouterUtils as createORPCVueQueryUtils, createProcedureUtils, createRouterUtils, unrefDeep };
|
142
|
-
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep
|
128
|
+
export type { CreateProcedureUtilsOptions, CreateRouterUtilsOptions, GeneralUtils, InfiniteOptionsBase, InfiniteOptionsIn, MaybeRefDeep, MutationOptions, MutationOptionsIn, ProcedureUtils, QueryOptionsBase, QueryOptionsIn, RouterUtils, UnrefDeep };
|
package/dist/index.mjs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { generateOperationKey } from '@orpc/tanstack-query';
|
2
2
|
export { generateOperationKey as buildKey } from '@orpc/tanstack-query';
|
3
|
-
import {
|
4
|
-
import { skipToken, experimental_streamedQuery } from '@tanstack/vue-query';
|
3
|
+
import { skipToken } from '@tanstack/vue-query';
|
5
4
|
import { isRef, computed } from 'vue';
|
5
|
+
import { isObject } from '@orpc/shared';
|
6
6
|
|
7
7
|
function createGeneralUtils(path) {
|
8
8
|
return {
|
@@ -45,27 +45,6 @@ function createProcedureUtils(client, options) {
|
|
45
45
|
...optionsIn
|
46
46
|
};
|
47
47
|
},
|
48
|
-
experimental_streamedOptions(...[optionsIn = {}]) {
|
49
|
-
return {
|
50
|
-
enabled: computed(() => unrefDeep(optionsIn.input) === skipToken ? false : void 0),
|
51
|
-
queryKey: computed(() => generateOperationKey(options.path, { type: "streamed", input: unrefDeep(optionsIn.input), fnOptions: optionsIn.queryFnOptions })),
|
52
|
-
queryFn: experimental_streamedQuery({
|
53
|
-
queryFn: async ({ signal }) => {
|
54
|
-
const input = unrefDeep(optionsIn.input);
|
55
|
-
if (input === skipToken) {
|
56
|
-
throw new Error("queryFn should not be called with skipToken used as input");
|
57
|
-
}
|
58
|
-
const output = await client(input, { signal, context: unrefDeep(optionsIn.context) });
|
59
|
-
if (!isAsyncIteratorObject(output)) {
|
60
|
-
throw new Error("streamedQuery requires an event iterator output");
|
61
|
-
}
|
62
|
-
return output;
|
63
|
-
},
|
64
|
-
...optionsIn.queryFnOptions
|
65
|
-
}),
|
66
|
-
...optionsIn
|
67
|
-
};
|
68
|
-
},
|
69
48
|
infiniteOptions(optionsIn) {
|
70
49
|
return {
|
71
50
|
queryKey: computed(() => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/vue-query",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.9.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -29,14 +29,14 @@
|
|
29
29
|
"peerDependencies": {
|
30
30
|
"@tanstack/vue-query": ">=5.80.2",
|
31
31
|
"vue": ">=3.3.0",
|
32
|
-
"@orpc/client": "1.
|
32
|
+
"@orpc/client": "1.9.0"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@orpc/
|
36
|
-
"@orpc/
|
35
|
+
"@orpc/tanstack-query": "1.9.0",
|
36
|
+
"@orpc/shared": "1.9.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@tanstack/vue-query": "^5.
|
39
|
+
"@tanstack/vue-query": "^5.90.1"
|
40
40
|
},
|
41
41
|
"scripts": {
|
42
42
|
"build": "unbuild",
|