soda-tanstack-query 0.0.7 → 0.0.8

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.
@@ -29,7 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const react_query_namespaceObject = require("@tanstack/react-query");
30
30
  function createUseQuery(params, client) {
31
31
  const { queryFn, queryKey, ...rest } = params;
32
- const useRequest = function(params2, options, client2 = client) {
32
+ const useQuery = function(params2, options, client2 = client) {
33
33
  return (0, react_query_namespaceObject.useQuery)({
34
34
  queryKey: [
35
35
  queryKey,
@@ -40,7 +40,7 @@ function createUseQuery(params, client) {
40
40
  ...options
41
41
  }, client2);
42
42
  };
43
- useRequest.refine = function(params2, client2) {
43
+ useQuery.refine = function(params2, client2) {
44
44
  params2 = "function" == typeof params2 ? params2(params, client) : params2;
45
45
  client2 = "function" == typeof client2 ? client2(params, client) : client2;
46
46
  return createUseQuery({
@@ -48,6 +48,7 @@ function createUseQuery(params, client) {
48
48
  ...params2
49
49
  }, client2 ?? client);
50
50
  };
51
+ return useQuery;
51
52
  }
52
53
  exports.createUseQuery = __webpack_exports__.createUseQuery;
53
54
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
@@ -1,8 +1,8 @@
1
- import { useQuery } from "@tanstack/react-query";
1
+ import { useQuery as react_query_useQuery } from "@tanstack/react-query";
2
2
  function createUseQuery(params, client) {
3
3
  const { queryFn, queryKey, ...rest } = params;
4
- const useRequest = function(params2, options, client2 = client) {
5
- return useQuery({
4
+ const useQuery = function(params2, options, client2 = client) {
5
+ return react_query_useQuery({
6
6
  queryKey: [
7
7
  queryKey,
8
8
  params2
@@ -12,7 +12,7 @@ function createUseQuery(params, client) {
12
12
  ...options
13
13
  }, client2);
14
14
  };
15
- useRequest.refine = function(params2, client2) {
15
+ useQuery.refine = function(params2, client2) {
16
16
  params2 = "function" == typeof params2 ? params2(params, client) : params2;
17
17
  client2 = "function" == typeof client2 ? client2(params, client) : client2;
18
18
  return createUseQuery({
@@ -20,5 +20,6 @@ function createUseQuery(params, client) {
20
20
  ...params2
21
21
  }, client2 ?? client);
22
22
  };
23
+ return useQuery;
23
24
  }
24
25
  export { createUseQuery };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-tanstack-query",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -3,7 +3,7 @@ import {
3
3
  DefinedUseQueryResult,
4
4
  QueryClient,
5
5
  UndefinedInitialDataOptions,
6
- useQuery,
6
+ useQuery as _useQuery,
7
7
  UseQueryOptions,
8
8
  UseQueryResult,
9
9
  } from "@tanstack/react-query"
@@ -281,8 +281,8 @@ export function createUseQuery<TFn extends (param: any) => any, TInitSelectData
281
281
  ): any {
282
282
  const { queryFn, queryKey, ...rest } = params
283
283
 
284
- const useRequest: any = function useRequest(params2: any, options?: any, client2: QueryClient | undefined = client) {
285
- return useQuery(
284
+ const useQuery: any = function useRequest(params2: any, options?: any, client2: QueryClient | undefined = client) {
285
+ return _useQuery(
286
286
  {
287
287
  queryKey: [queryKey, params2],
288
288
  queryFn: () => queryFn(params2),
@@ -293,11 +293,13 @@ export function createUseQuery<TFn extends (param: any) => any, TInitSelectData
293
293
  )
294
294
  }
295
295
 
296
- useRequest.refine = function refine(params2: any, client2?: any) {
296
+ useQuery.refine = function refine(params2: any, client2?: any) {
297
297
  params2 = typeof params2 === "function" ? params2(params, client) : params2
298
298
  client2 = typeof client2 === "function" ? client2(params, client) : client2
299
299
  return createUseQuery({ ...params, ...params2 }, client2 ?? client)
300
300
  }
301
+
302
+ return useQuery
301
303
  }
302
304
 
303
305
  export type GetHookFromParams<Params> =