@orpc/vue-query 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -55,7 +55,9 @@ function createProcedureUtils(client, path) {
55
55
  const input = options.input;
56
56
  return {
57
57
  queryKey: computed(() => buildKey(path, { type: "infinite", input: deepUnref(input) })),
58
- queryFn: ({ pageParam, signal }) => client({ ...deepUnref(input), cursor: pageParam }, { signal, context: deepUnref(options.context) }),
58
+ queryFn: ({ pageParam, signal }) => {
59
+ return client({ ...deepUnref(input), cursor: pageParam }, { signal, context: deepUnref(options.context) });
60
+ },
59
61
  ...options
60
62
  };
61
63
  },
@@ -1,22 +1,22 @@
1
1
  import type { ProcedureClient } from '@orpc/server';
2
2
  import type { IsEqual } from '@orpc/shared';
3
- import type { QueryKey } from '@tanstack/vue-query';
3
+ import type { QueryFunctionContext, QueryKey } from '@tanstack/vue-query';
4
4
  import type { ComputedRef } from 'vue';
5
- import type { InfiniteOptions, MutationOptions, QueryOptions } from './types';
5
+ import type { InferCursor, InfiniteOptions, MutationOptions, QueryOptions } from './types';
6
6
  /**
7
7
  * Utils at procedure level
8
8
  */
9
9
  export interface ProcedureUtils<TInput, TOutput, TClientContext> {
10
10
  queryOptions: <U extends QueryOptions<TInput, TOutput, TClientContext, any>>(...opt: [options: U] | (undefined extends TInput & TClientContext ? [] : never)) => IsEqual<U, QueryOptions<TInput, TOutput, TClientContext, any>> extends true ? {
11
- queryKey: QueryKey;
12
- queryFn: () => Promise<TOutput>;
11
+ queryKey: ComputedRef<QueryKey>;
12
+ queryFn: (ctx: QueryFunctionContext) => Promise<TOutput>;
13
13
  } : Omit<{
14
14
  queryKey: ComputedRef<QueryKey>;
15
- queryFn: () => Promise<TOutput>;
15
+ queryFn: (ctx: QueryFunctionContext) => Promise<TOutput>;
16
16
  }, keyof U> & U;
17
17
  infiniteOptions: <U extends InfiniteOptions<TInput, TOutput, TClientContext, any>>(options: U) => Omit<{
18
18
  queryKey: ComputedRef<QueryKey>;
19
- queryFn: () => Promise<TOutput>;
19
+ queryFn: (ctx: QueryFunctionContext<QueryKey, InferCursor<TInput>>) => Promise<TOutput>;
20
20
  initialPageParam: undefined;
21
21
  }, keyof U> & U;
22
22
  mutationOptions: <U extends MutationOptions<TInput, TOutput, TClientContext>>(...opt: [options: U] | (undefined extends TClientContext ? [] : never)) => IsEqual<U, MutationOptions<TInput, TOutput, TClientContext>> extends true ? {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/vue-query",
3
3
  "type": "module",
4
- "version": "0.21.0",
4
+ "version": "0.22.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -34,9 +34,9 @@
34
34
  "peerDependencies": {
35
35
  "@tanstack/vue-query": ">=5.50.0",
36
36
  "vue": ">=3.3.0",
37
- "@orpc/contract": "0.21.0",
38
- "@orpc/server": "0.21.0",
39
- "@orpc/client": "0.21.0"
37
+ "@orpc/client": "0.22.0",
38
+ "@orpc/contract": "0.22.0",
39
+ "@orpc/server": "0.22.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",