@orpc/vue-query 0.0.0-next.93e6063 → 0.0.0-next.954e6e2

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 CHANGED
@@ -58,22 +58,18 @@ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
58
58
  context?: TClientContext;
59
59
  } : {
60
60
  context: TClientContext;
61
- }) & {
61
+ }) & MutationOptions<TInput, TOutput, TError, TMutationContext>;
62
+ type MutationOptions<TInput, TOutput, TError extends Error, TMutationContext> = {
62
63
  [P in keyof MutationObserverOptions<TOutput, TError, TInput, TMutationContext>]: MaybeRefDeep<MutationObserverOptions<TOutput, TError, TInput, TMutationContext>[P]>;
63
64
  } & {
64
65
  shallow?: MaybeRef<boolean>;
65
66
  };
66
- interface MutationOptionsBase<TInput, TOutput, TError extends Error> {
67
- mutationKey: QueryKey;
68
- mutationFn(input: TInput): Promise<TOutput>;
69
- retry?(failureCount: number, error: TError): boolean;
70
- }
71
67
 
72
68
  interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
73
69
  call: Client<TClientContext, TInput, TOutput, TError>;
74
70
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
75
71
  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>>;
76
- mutationOptions<U, UMutationContext>(...rest: MaybeOptionalOptions<U & MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<U & Omit<MutationOptionsBase<TInput, TOutput, TError>, keyof U>>;
72
+ mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
77
73
  }
78
74
  declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
79
75
 
@@ -88,4 +84,4 @@ declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?
88
84
 
89
85
  declare const createORPCVueQueryUtils: typeof createRouterUtils;
90
86
 
91
- export { type BuildKeyOptions, type GeneralUtils, type InfiniteOptionsBase, type InfiniteOptionsIn, type KeyType, type MaybeRefDeep, type MutationOptionsBase, type MutationOptionsIn, type ProcedureUtils, type QueryOptionsBase, type QueryOptionsIn, type RouterUtils, buildKey, createGeneralUtils, createORPCVueQueryUtils, createProcedureUtils, createRouterUtils };
87
+ export { type BuildKeyOptions, type GeneralUtils, type InfiniteOptionsBase, type InfiniteOptionsIn, type KeyType, type MaybeRefDeep, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptionsBase, type QueryOptionsIn, type RouterUtils, buildKey, createGeneralUtils, createORPCVueQueryUtils, createProcedureUtils, createRouterUtils };
package/dist/index.d.ts CHANGED
@@ -58,22 +58,18 @@ type MutationOptionsIn<TClientContext extends ClientContext, TInput, TOutput, TE
58
58
  context?: TClientContext;
59
59
  } : {
60
60
  context: TClientContext;
61
- }) & {
61
+ }) & MutationOptions<TInput, TOutput, TError, TMutationContext>;
62
+ type MutationOptions<TInput, TOutput, TError extends Error, TMutationContext> = {
62
63
  [P in keyof MutationObserverOptions<TOutput, TError, TInput, TMutationContext>]: MaybeRefDeep<MutationObserverOptions<TOutput, TError, TInput, TMutationContext>[P]>;
63
64
  } & {
64
65
  shallow?: MaybeRef<boolean>;
65
66
  };
66
- interface MutationOptionsBase<TInput, TOutput, TError extends Error> {
67
- mutationKey: QueryKey;
68
- mutationFn(input: TInput): Promise<TOutput>;
69
- retry?(failureCount: number, error: TError): boolean;
70
- }
71
67
 
72
68
  interface ProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error> {
73
69
  call: Client<TClientContext, TInput, TOutput, TError>;
74
70
  queryOptions<U, USelectData = TOutput>(...rest: MaybeOptionalOptions<U & QueryOptionsIn<TClientContext, TInput, TOutput, TError, USelectData>>): NoInfer<U & Omit<QueryOptionsBase<TOutput, TError>, keyof U>>;
75
71
  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>>;
76
- mutationOptions<U, UMutationContext>(...rest: MaybeOptionalOptions<U & MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): NoInfer<U & Omit<MutationOptionsBase<TInput, TOutput, TError>, keyof U>>;
72
+ mutationOptions<UMutationContext>(...rest: MaybeOptionalOptions<MutationOptionsIn<TClientContext, TInput, TOutput, TError, UMutationContext>>): MutationOptions<TInput, TOutput, TError, UMutationContext>;
77
73
  }
78
74
  declare function createProcedureUtils<TClientContext extends ClientContext, TInput, TOutput, TError extends Error>(client: Client<TClientContext, TInput, TOutput, TError>, path: string[]): ProcedureUtils<TClientContext, TInput, TOutput, TError>;
79
75
 
@@ -88,4 +84,4 @@ declare function createRouterUtils<T extends NestedClient<any>>(client: T, path?
88
84
 
89
85
  declare const createORPCVueQueryUtils: typeof createRouterUtils;
90
86
 
91
- export { type BuildKeyOptions, type GeneralUtils, type InfiniteOptionsBase, type InfiniteOptionsIn, type KeyType, type MaybeRefDeep, type MutationOptionsBase, type MutationOptionsIn, type ProcedureUtils, type QueryOptionsBase, type QueryOptionsIn, type RouterUtils, buildKey, createGeneralUtils, createORPCVueQueryUtils, createProcedureUtils, createRouterUtils };
87
+ export { type BuildKeyOptions, type GeneralUtils, type InfiniteOptionsBase, type InfiniteOptionsIn, type KeyType, type MaybeRefDeep, type MutationOptions, type MutationOptionsIn, type ProcedureUtils, type QueryOptionsBase, type QueryOptionsIn, type RouterUtils, buildKey, createGeneralUtils, createORPCVueQueryUtils, createProcedureUtils, createRouterUtils };
package/dist/index.mjs CHANGED
@@ -37,29 +37,29 @@ function unrefDeep(value) {
37
37
  function createProcedureUtils(client, path) {
38
38
  return {
39
39
  call: client,
40
- queryOptions(...[{ input, context, ...rest } = {}]) {
40
+ queryOptions(...[options = {}]) {
41
41
  return {
42
- queryKey: computed(() => buildKey(path, { type: "query", input: unrefDeep(input) })),
43
- queryFn: ({ signal }) => client(unrefDeep(input), { signal, context: unrefDeep(context) }),
44
- ...rest
42
+ queryKey: computed(() => buildKey(path, { type: "query", input: unrefDeep(options.input) })),
43
+ queryFn: ({ signal }) => client(unrefDeep(options.input), { signal, context: unrefDeep(options.context) }),
44
+ ...options
45
45
  };
46
46
  },
47
- infiniteOptions({ input, context, ...rest }) {
47
+ infiniteOptions(options) {
48
48
  return {
49
49
  queryKey: computed(() => {
50
- return buildKey(path, { type: "infinite", input: unrefDeep(input(unrefDeep(rest.initialPageParam))) });
50
+ return buildKey(path, { type: "infinite", input: unrefDeep(options.input(unrefDeep(options.initialPageParam))) });
51
51
  }),
52
52
  queryFn: ({ pageParam, signal }) => {
53
- return client(unrefDeep(input(pageParam)), { signal, context: unrefDeep(context) });
53
+ return client(unrefDeep(options.input(pageParam)), { signal, context: unrefDeep(options.context) });
54
54
  },
55
- ...rest
55
+ ...options
56
56
  };
57
57
  },
58
- mutationOptions(...[{ context, ...rest } = {}]) {
58
+ mutationOptions(...[options = {}]) {
59
59
  return {
60
60
  mutationKey: buildKey(path, { type: "mutation" }),
61
- mutationFn: (input) => client(input, { context: unrefDeep(context) }),
62
- ...rest
61
+ mutationFn: (input) => client(input, { context: unrefDeep(options.context) }),
62
+ ...options
63
63
  };
64
64
  }
65
65
  };
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.93e6063",
4
+ "version": "0.0.0-next.954e6e2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -29,10 +29,10 @@
29
29
  "peerDependencies": {
30
30
  "@tanstack/vue-query": ">=5.50.0",
31
31
  "vue": ">=3.3.0",
32
- "@orpc/client": "0.0.0-next.93e6063"
32
+ "@orpc/client": "0.0.0-next.954e6e2"
33
33
  },
34
34
  "dependencies": {
35
- "@orpc/shared": "0.0.0-next.93e6063"
35
+ "@orpc/shared": "0.0.0-next.954e6e2"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "unbuild",