react-query-kit 2.0.9-beta.0 → 2.0.10

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.
Files changed (54) hide show
  1. package/build/lib/createInfiniteQuery.esm.js +1 -1
  2. package/build/lib/createInfiniteQuery.esm.js.map +1 -1
  3. package/build/lib/createInfiniteQuery.js +2 -22
  4. package/build/lib/createInfiniteQuery.js.map +1 -1
  5. package/build/lib/createInfiniteQuery.mjs +1 -1
  6. package/build/lib/createInfiniteQuery.mjs.map +1 -1
  7. package/build/lib/createMutation.d.ts +1 -1
  8. package/build/lib/createMutation.esm.js +1 -2
  9. package/build/lib/createMutation.esm.js.map +1 -1
  10. package/build/lib/createMutation.js +1 -22
  11. package/build/lib/createMutation.js.map +1 -1
  12. package/build/lib/createMutation.mjs +1 -2
  13. package/build/lib/createMutation.mjs.map +1 -1
  14. package/build/lib/createQuery.esm.js +1 -1
  15. package/build/lib/createQuery.esm.js.map +1 -1
  16. package/build/lib/createQuery.js +2 -22
  17. package/build/lib/createQuery.js.map +1 -1
  18. package/build/lib/createQuery.mjs +1 -1
  19. package/build/lib/createQuery.mjs.map +1 -1
  20. package/build/lib/createSuspenseInfiniteQuery.esm.js +2 -3
  21. package/build/lib/createSuspenseInfiniteQuery.esm.js.map +1 -1
  22. package/build/lib/createSuspenseInfiniteQuery.js +1 -22
  23. package/build/lib/createSuspenseInfiniteQuery.js.map +1 -1
  24. package/build/lib/createSuspenseInfiniteQuery.mjs +2 -3
  25. package/build/lib/createSuspenseInfiniteQuery.mjs.map +1 -1
  26. package/build/lib/createSuspenseQuery.esm.js +2 -3
  27. package/build/lib/createSuspenseQuery.esm.js.map +1 -1
  28. package/build/lib/createSuspenseQuery.js +1 -22
  29. package/build/lib/createSuspenseQuery.js.map +1 -1
  30. package/build/lib/createSuspenseQuery.mjs +2 -3
  31. package/build/lib/createSuspenseQuery.mjs.map +1 -1
  32. package/build/lib/types.d.ts +5 -3
  33. package/build/lib/utils.d.ts +7 -5
  34. package/build/lib/utils.esm.js +5 -4
  35. package/build/lib/utils.esm.js.map +1 -1
  36. package/build/lib/utils.js +7 -5
  37. package/build/lib/utils.js.map +1 -1
  38. package/build/lib/utils.mjs +5 -4
  39. package/build/lib/utils.mjs.map +1 -1
  40. package/build/stats-html.html +1 -1
  41. package/build/stats.json +88 -106
  42. package/build/umd/index.development.js +11 -10
  43. package/build/umd/index.development.js.map +1 -1
  44. package/build/umd/index.production.js +1 -1
  45. package/build/umd/index.production.js.map +1 -1
  46. package/build/zip/zip.esm.js +1 -1
  47. package/package.json +1 -1
  48. package/src/createInfiniteQuery.ts +1 -2
  49. package/src/createMutation.ts +3 -5
  50. package/src/createQuery.tsx +1 -2
  51. package/src/createSuspenseInfiniteQuery.ts +2 -4
  52. package/src/createSuspenseQuery.ts +2 -4
  53. package/src/types.ts +6 -3
  54. package/src/utils.ts +10 -7
@@ -1,9 +1,11 @@
1
- import * as ReactQuery from '@tanstack/react-query';
1
+ import * as TanstackReactQuery from '@tanstack/react-query';
2
2
 
3
+ const ReactQuery = TanstackReactQuery;
4
+ const isV5 = !!ReactQuery.useSuspenseQuery;
3
5
  const withMiddleware = (hook, defaultOptions, type) => {
4
6
  return function useMiddleware(options, queryClient) {
5
7
  const [middleware, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
6
- isV5() ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
8
+ isV5 ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
7
9
  use: u2 = [],
8
10
  ...o2
9
11
  } = {}) => [[...u1, ...u2], { ...o1,
@@ -24,10 +26,9 @@ const suspenseOptions = {
24
26
  suspense: true,
25
27
  useErrorBoundary: (_error, query) => query.state.data === undefined
26
28
  };
27
- const isV5 = () => !!ReactQuery.useSuspenseQuery;
28
29
  const getKey = (primaryKey, variables) => {
29
30
  return variables === undefined ? [primaryKey] : [primaryKey, variables];
30
31
  };
31
32
 
32
- export { getKey, isV5, suspenseOptions, withMiddleware };
33
+ export { ReactQuery, getKey, isV5, suspenseOptions, withMiddleware };
33
34
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: ReactQuery.QueryClient; use?: Middleware[] },\n queryClient?: ReactQuery.QueryClient\n ) {\n const [middleware, opts] = [\n ReactQuery.useQueryClient(\n // @ts-ignore Compatible with ReactQuery v4\n isV5() ? queryClient : options\n ).getDefaultOptions()[type],\n defaultOptions,\n options,\n ].reduce(\n ([u1, o1], { use: u2 = [], ...o2 } = {}) => [\n [...u1, ...u2],\n { ...o1, ...o2 },\n ],\n [[]]\n )\n\n let next = hook\n for (let i = middleware.length; i--; ) {\n next = middleware[i](next)\n }\n\n return next(opts, queryClient)\n }\n}\n\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: ReactQuery.Query) =>\n query.state.data === undefined,\n}\n\nexport const isV5 = () => !!ReactQuery.useSuspenseQuery\n\nexport const getKey = <TVariables = void>(\n primaryKey: string,\n variables?: TVariables\n) => {\n return (\n variables === undefined ? [primaryKey] : [primaryKey, variables]\n ) as inferQueryKey<unknown, TVariables>\n}\n"],"names":["withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","ReactQuery","useQueryClient","isV5","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","useSuspenseQuery","getKey","primaryKey","variables"],"mappings":";;AAIO,MAAMA,cAAc,GAAG,CAC5BC,IAD4B,EAE5BC,cAF4B,EAG5BC,IAH4B,KAIzB;AACH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J,SAAd,GAA0B,CAACG,UAAD,CAA1B,GAAyC,CAACA,UAAD,EAAaC,SAAb,CAD3C,CAAA;AAGD;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient } from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: QueryClient; use?: Middleware[] },\n queryClient?: QueryClient\n ) {\n const [middleware, opts] = [\n ReactQuery.useQueryClient(\n // @ts-ignore Compatible with ReactQuery v4\n isV5 ? queryClient : options\n ).getDefaultOptions()[type],\n defaultOptions,\n options,\n ].reduce(\n ([u1, o1], { use: u2 = [], ...o2 } = {}) => [\n [...u1, ...u2],\n { ...o1, ...o2 },\n ],\n [[]]\n )\n\n let next = hook\n for (let i = middleware.length; i--; ) {\n next = middleware[i](next)\n }\n\n return next(opts, queryClient)\n }\n}\n\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\n\nexport const getKey = <TVariables = void>(\n primaryKey: string,\n variables?: TVariables\n) => {\n return (\n variables === undefined ? [primaryKey] : [primaryKey, variables]\n ) as inferQueryKey<unknown, TVariables>\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","getKey","primaryKey","variables"],"mappings":";;AAKO,MAAMA,UAAU,GAAGC,mBAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UA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;AACH,EAAA,OACEA,SAAS,KAAKH,SAAd,GAA0B,CAACE,UAAD,CAA1B,GAAyC,CAACA,UAAD,EAAaC,SAAb,CAD3C,CAAA;AAGD;;;;"}
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
4014
4014
  </script>
4015
4015
  <script>
4016
4016
  /*<!--*/
4017
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"zip.esm.js","children":[{"name":"src","children":[{"uid":"64d3-1","name":"utils.ts"},{"uid":"64d3-3","name":"createBaseQuery.ts"},{"uid":"64d3-5","name":"createQuery.tsx"},{"uid":"64d3-7","name":"createSuspenseQuery.ts"},{"uid":"64d3-9","name":"createInfiniteQuery.ts"},{"uid":"64d3-11","name":"createSuspenseInfiniteQuery.ts"},{"uid":"64d3-13","name":"createMutation.ts"},{"uid":"64d3-15","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"64d3-1":{"renderedLength":914,"gzipLength":458,"brotliLength":0,"mainUid":"64d3-0"},"64d3-3":{"renderedLength":1047,"gzipLength":368,"brotliLength":0,"mainUid":"64d3-2"},"64d3-5":{"renderedLength":91,"gzipLength":87,"brotliLength":0,"mainUid":"64d3-4"},"64d3-7":{"renderedLength":181,"gzipLength":120,"brotliLength":0,"mainUid":"64d3-6"},"64d3-9":{"renderedLength":107,"gzipLength":97,"brotliLength":0,"mainUid":"64d3-8"},"64d3-11":{"renderedLength":205,"gzipLength":130,"brotliLength":0,"mainUid":"64d3-10"},"64d3-13":{"renderedLength":251,"gzipLength":171,"brotliLength":0,"mainUid":"64d3-12"},"64d3-15":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"64d3-14"}},"nodeMetas":{"64d3-0":{"id":"/src/utils.ts","moduleParts":{"zip.esm.js":"64d3-1"},"imported":[{"uid":"64d3-17"}],"importedBy":[{"uid":"64d3-14"},{"uid":"64d3-6"},{"uid":"64d3-10"},{"uid":"64d3-12"},{"uid":"64d3-2"}]},"64d3-2":{"id":"/src/createBaseQuery.ts","moduleParts":{"zip.esm.js":"64d3-3"},"imported":[{"uid":"64d3-0"}],"importedBy":[{"uid":"64d3-4"},{"uid":"64d3-6"},{"uid":"64d3-8"},{"uid":"64d3-10"}]},"64d3-4":{"id":"/src/createQuery.tsx","moduleParts":{"zip.esm.js":"64d3-5"},"imported":[{"uid":"64d3-17"},{"uid":"64d3-2"}],"importedBy":[{"uid":"64d3-14"}]},"64d3-6":{"id":"/src/createSuspenseQuery.ts","moduleParts":{"zip.esm.js":"64d3-7"},"imported":[{"uid":"64d3-17"},{"uid":"64d3-2"},{"uid":"64d3-0"}],"importedBy":[{"uid":"64d3-14"}]},"64d3-8":{"id":"/src/createInfiniteQuery.ts","moduleParts":{"zip.esm.js":"64d3-9"},"imported":[{"uid":"64d3-17"},{"uid":"64d3-2"}],"importedBy":[{"uid":"64d3-14"}]},"64d3-10":{"id":"/src/createSuspenseInfiniteQuery.ts","moduleParts":{"zip.esm.js":"64d3-11"},"imported":[{"uid":"64d3-17"},{"uid":"64d3-2"},{"uid":"64d3-0"}],"importedBy":[{"uid":"64d3-14"}]},"64d3-12":{"id":"/src/createMutation.ts","moduleParts":{"zip.esm.js":"64d3-13"},"imported":[{"uid":"64d3-17"},{"uid":"64d3-0"}],"importedBy":[{"uid":"64d3-14"}]},"64d3-14":{"id":"/src/index.ts","moduleParts":{"zip.esm.js":"64d3-15"},"imported":[{"uid":"64d3-4"},{"uid":"64d3-6"},{"uid":"64d3-8"},{"uid":"64d3-10"},{"uid":"64d3-12"},{"uid":"64d3-16"},{"uid":"64d3-0"}],"importedBy":[],"isEntry":true},"64d3-16":{"id":"/src/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"64d3-14"}]},"64d3-17":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"64d3-4"},{"uid":"64d3-6"},{"uid":"64d3-8"},{"uid":"64d3-10"},{"uid":"64d3-12"},{"uid":"64d3-0"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4017
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"zip.esm.js","children":[{"name":"src","children":[{"uid":"4ef0-1","name":"utils.ts"},{"uid":"4ef0-3","name":"createBaseQuery.ts"},{"uid":"4ef0-5","name":"createQuery.tsx"},{"uid":"4ef0-7","name":"createSuspenseQuery.ts"},{"uid":"4ef0-9","name":"createInfiniteQuery.ts"},{"uid":"4ef0-11","name":"createSuspenseInfiniteQuery.ts"},{"uid":"4ef0-13","name":"createMutation.ts"},{"uid":"4ef0-15","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"4ef0-1":{"renderedLength":945,"gzipLength":466,"brotliLength":0,"mainUid":"4ef0-0"},"4ef0-3":{"renderedLength":1047,"gzipLength":368,"brotliLength":0,"mainUid":"4ef0-2"},"4ef0-5":{"renderedLength":91,"gzipLength":87,"brotliLength":0,"mainUid":"4ef0-4"},"4ef0-7":{"renderedLength":179,"gzipLength":118,"brotliLength":0,"mainUid":"4ef0-6"},"4ef0-9":{"renderedLength":107,"gzipLength":97,"brotliLength":0,"mainUid":"4ef0-8"},"4ef0-11":{"renderedLength":203,"gzipLength":128,"brotliLength":0,"mainUid":"4ef0-10"},"4ef0-13":{"renderedLength":251,"gzipLength":171,"brotliLength":0,"mainUid":"4ef0-12"},"4ef0-15":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"4ef0-14"}},"nodeMetas":{"4ef0-0":{"id":"/src/utils.ts","moduleParts":{"zip.esm.js":"4ef0-1"},"imported":[{"uid":"4ef0-17"}],"importedBy":[{"uid":"4ef0-14"},{"uid":"4ef0-4"},{"uid":"4ef0-6"},{"uid":"4ef0-8"},{"uid":"4ef0-10"},{"uid":"4ef0-12"},{"uid":"4ef0-2"}]},"4ef0-2":{"id":"/src/createBaseQuery.ts","moduleParts":{"zip.esm.js":"4ef0-3"},"imported":[{"uid":"4ef0-0"}],"importedBy":[{"uid":"4ef0-4"},{"uid":"4ef0-6"},{"uid":"4ef0-8"},{"uid":"4ef0-10"}]},"4ef0-4":{"id":"/src/createQuery.tsx","moduleParts":{"zip.esm.js":"4ef0-5"},"imported":[{"uid":"4ef0-2"},{"uid":"4ef0-0"}],"importedBy":[{"uid":"4ef0-14"}]},"4ef0-6":{"id":"/src/createSuspenseQuery.ts","moduleParts":{"zip.esm.js":"4ef0-7"},"imported":[{"uid":"4ef0-2"},{"uid":"4ef0-0"}],"importedBy":[{"uid":"4ef0-14"}]},"4ef0-8":{"id":"/src/createInfiniteQuery.ts","moduleParts":{"zip.esm.js":"4ef0-9"},"imported":[{"uid":"4ef0-2"},{"uid":"4ef0-0"}],"importedBy":[{"uid":"4ef0-14"}]},"4ef0-10":{"id":"/src/createSuspenseInfiniteQuery.ts","moduleParts":{"zip.esm.js":"4ef0-11"},"imported":[{"uid":"4ef0-2"},{"uid":"4ef0-0"}],"importedBy":[{"uid":"4ef0-14"}]},"4ef0-12":{"id":"/src/createMutation.ts","moduleParts":{"zip.esm.js":"4ef0-13"},"imported":[{"uid":"4ef0-0"}],"importedBy":[{"uid":"4ef0-14"}]},"4ef0-14":{"id":"/src/index.ts","moduleParts":{"zip.esm.js":"4ef0-15"},"imported":[{"uid":"4ef0-4"},{"uid":"4ef0-6"},{"uid":"4ef0-8"},{"uid":"4ef0-10"},{"uid":"4ef0-12"},{"uid":"4ef0-16"},{"uid":"4ef0-0"}],"importedBy":[],"isEntry":true},"4ef0-16":{"id":"/src/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"4ef0-14"}]},"4ef0-17":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"4ef0-0"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4018
4018
 
4019
4019
  const run = () => {
4020
4020
  const width = window.innerWidth;
package/build/stats.json CHANGED
@@ -10,35 +10,35 @@
10
10
  "name": "src",
11
11
  "children": [
12
12
  {
13
- "uid": "64d3-19",
13
+ "uid": "4ef0-19",
14
14
  "name": "utils.ts"
15
15
  },
16
16
  {
17
- "uid": "64d3-21",
17
+ "uid": "4ef0-21",
18
18
  "name": "createBaseQuery.ts"
19
19
  },
20
20
  {
21
- "uid": "64d3-23",
21
+ "uid": "4ef0-23",
22
22
  "name": "createQuery.tsx"
23
23
  },
24
24
  {
25
- "uid": "64d3-25",
25
+ "uid": "4ef0-25",
26
26
  "name": "createSuspenseQuery.ts"
27
27
  },
28
28
  {
29
- "uid": "64d3-27",
29
+ "uid": "4ef0-27",
30
30
  "name": "createInfiniteQuery.ts"
31
31
  },
32
32
  {
33
- "uid": "64d3-29",
33
+ "uid": "4ef0-29",
34
34
  "name": "createSuspenseInfiniteQuery.ts"
35
35
  },
36
36
  {
37
- "uid": "64d3-31",
37
+ "uid": "4ef0-31",
38
38
  "name": "createMutation.ts"
39
39
  },
40
40
  {
41
- "uid": "64d3-33",
41
+ "uid": "4ef0-33",
42
42
  "name": "index.ts"
43
43
  }
44
44
  ]
@@ -49,273 +49,255 @@
49
49
  "isRoot": true
50
50
  },
51
51
  "nodeParts": {
52
- "64d3-19": {
53
- "renderedLength": 914,
54
- "gzipLength": 458,
52
+ "4ef0-19": {
53
+ "renderedLength": 945,
54
+ "gzipLength": 466,
55
55
  "brotliLength": 0,
56
- "mainUid": "64d3-18"
56
+ "mainUid": "4ef0-18"
57
57
  },
58
- "64d3-21": {
58
+ "4ef0-21": {
59
59
  "renderedLength": 1047,
60
60
  "gzipLength": 368,
61
61
  "brotliLength": 0,
62
- "mainUid": "64d3-20"
62
+ "mainUid": "4ef0-20"
63
63
  },
64
- "64d3-23": {
64
+ "4ef0-23": {
65
65
  "renderedLength": 91,
66
66
  "gzipLength": 87,
67
67
  "brotliLength": 0,
68
- "mainUid": "64d3-22"
68
+ "mainUid": "4ef0-22"
69
69
  },
70
- "64d3-25": {
71
- "renderedLength": 181,
72
- "gzipLength": 120,
70
+ "4ef0-25": {
71
+ "renderedLength": 179,
72
+ "gzipLength": 118,
73
73
  "brotliLength": 0,
74
- "mainUid": "64d3-24"
74
+ "mainUid": "4ef0-24"
75
75
  },
76
- "64d3-27": {
76
+ "4ef0-27": {
77
77
  "renderedLength": 107,
78
78
  "gzipLength": 97,
79
79
  "brotliLength": 0,
80
- "mainUid": "64d3-26"
80
+ "mainUid": "4ef0-26"
81
81
  },
82
- "64d3-29": {
83
- "renderedLength": 205,
84
- "gzipLength": 130,
82
+ "4ef0-29": {
83
+ "renderedLength": 203,
84
+ "gzipLength": 128,
85
85
  "brotliLength": 0,
86
- "mainUid": "64d3-28"
86
+ "mainUid": "4ef0-28"
87
87
  },
88
- "64d3-31": {
88
+ "4ef0-31": {
89
89
  "renderedLength": 251,
90
90
  "gzipLength": 171,
91
91
  "brotliLength": 0,
92
- "mainUid": "64d3-30"
92
+ "mainUid": "4ef0-30"
93
93
  },
94
- "64d3-33": {
94
+ "4ef0-33": {
95
95
  "renderedLength": 0,
96
96
  "gzipLength": 0,
97
97
  "brotliLength": 0,
98
- "mainUid": "64d3-32"
98
+ "mainUid": "4ef0-32"
99
99
  }
100
100
  },
101
101
  "nodeMetas": {
102
- "64d3-18": {
102
+ "4ef0-18": {
103
103
  "id": "/src/utils.ts",
104
104
  "moduleParts": {
105
- "zip.esm.js": "64d3-19"
105
+ "zip.esm.js": "4ef0-19"
106
106
  },
107
107
  "imported": [
108
108
  {
109
- "uid": "64d3-35"
109
+ "uid": "4ef0-35"
110
110
  }
111
111
  ],
112
112
  "importedBy": [
113
113
  {
114
- "uid": "64d3-32"
114
+ "uid": "4ef0-32"
115
115
  },
116
116
  {
117
- "uid": "64d3-24"
117
+ "uid": "4ef0-22"
118
118
  },
119
119
  {
120
- "uid": "64d3-28"
120
+ "uid": "4ef0-24"
121
121
  },
122
122
  {
123
- "uid": "64d3-30"
123
+ "uid": "4ef0-26"
124
124
  },
125
125
  {
126
- "uid": "64d3-20"
126
+ "uid": "4ef0-28"
127
+ },
128
+ {
129
+ "uid": "4ef0-30"
130
+ },
131
+ {
132
+ "uid": "4ef0-20"
127
133
  }
128
134
  ]
129
135
  },
130
- "64d3-20": {
136
+ "4ef0-20": {
131
137
  "id": "/src/createBaseQuery.ts",
132
138
  "moduleParts": {
133
- "zip.esm.js": "64d3-21"
139
+ "zip.esm.js": "4ef0-21"
134
140
  },
135
141
  "imported": [
136
142
  {
137
- "uid": "64d3-18"
143
+ "uid": "4ef0-18"
138
144
  }
139
145
  ],
140
146
  "importedBy": [
141
147
  {
142
- "uid": "64d3-22"
148
+ "uid": "4ef0-22"
143
149
  },
144
150
  {
145
- "uid": "64d3-24"
151
+ "uid": "4ef0-24"
146
152
  },
147
153
  {
148
- "uid": "64d3-26"
154
+ "uid": "4ef0-26"
149
155
  },
150
156
  {
151
- "uid": "64d3-28"
157
+ "uid": "4ef0-28"
152
158
  }
153
159
  ]
154
160
  },
155
- "64d3-22": {
161
+ "4ef0-22": {
156
162
  "id": "/src/createQuery.tsx",
157
163
  "moduleParts": {
158
- "zip.esm.js": "64d3-23"
164
+ "zip.esm.js": "4ef0-23"
159
165
  },
160
166
  "imported": [
161
167
  {
162
- "uid": "64d3-35"
168
+ "uid": "4ef0-20"
163
169
  },
164
170
  {
165
- "uid": "64d3-20"
171
+ "uid": "4ef0-18"
166
172
  }
167
173
  ],
168
174
  "importedBy": [
169
175
  {
170
- "uid": "64d3-32"
176
+ "uid": "4ef0-32"
171
177
  }
172
178
  ]
173
179
  },
174
- "64d3-24": {
180
+ "4ef0-24": {
175
181
  "id": "/src/createSuspenseQuery.ts",
176
182
  "moduleParts": {
177
- "zip.esm.js": "64d3-25"
183
+ "zip.esm.js": "4ef0-25"
178
184
  },
179
185
  "imported": [
180
186
  {
181
- "uid": "64d3-35"
182
- },
183
- {
184
- "uid": "64d3-20"
187
+ "uid": "4ef0-20"
185
188
  },
186
189
  {
187
- "uid": "64d3-18"
190
+ "uid": "4ef0-18"
188
191
  }
189
192
  ],
190
193
  "importedBy": [
191
194
  {
192
- "uid": "64d3-32"
195
+ "uid": "4ef0-32"
193
196
  }
194
197
  ]
195
198
  },
196
- "64d3-26": {
199
+ "4ef0-26": {
197
200
  "id": "/src/createInfiniteQuery.ts",
198
201
  "moduleParts": {
199
- "zip.esm.js": "64d3-27"
202
+ "zip.esm.js": "4ef0-27"
200
203
  },
201
204
  "imported": [
202
205
  {
203
- "uid": "64d3-35"
206
+ "uid": "4ef0-20"
204
207
  },
205
208
  {
206
- "uid": "64d3-20"
209
+ "uid": "4ef0-18"
207
210
  }
208
211
  ],
209
212
  "importedBy": [
210
213
  {
211
- "uid": "64d3-32"
214
+ "uid": "4ef0-32"
212
215
  }
213
216
  ]
214
217
  },
215
- "64d3-28": {
218
+ "4ef0-28": {
216
219
  "id": "/src/createSuspenseInfiniteQuery.ts",
217
220
  "moduleParts": {
218
- "zip.esm.js": "64d3-29"
221
+ "zip.esm.js": "4ef0-29"
219
222
  },
220
223
  "imported": [
221
224
  {
222
- "uid": "64d3-35"
223
- },
224
- {
225
- "uid": "64d3-20"
225
+ "uid": "4ef0-20"
226
226
  },
227
227
  {
228
- "uid": "64d3-18"
228
+ "uid": "4ef0-18"
229
229
  }
230
230
  ],
231
231
  "importedBy": [
232
232
  {
233
- "uid": "64d3-32"
233
+ "uid": "4ef0-32"
234
234
  }
235
235
  ]
236
236
  },
237
- "64d3-30": {
237
+ "4ef0-30": {
238
238
  "id": "/src/createMutation.ts",
239
239
  "moduleParts": {
240
- "zip.esm.js": "64d3-31"
240
+ "zip.esm.js": "4ef0-31"
241
241
  },
242
242
  "imported": [
243
243
  {
244
- "uid": "64d3-35"
245
- },
246
- {
247
- "uid": "64d3-18"
244
+ "uid": "4ef0-18"
248
245
  }
249
246
  ],
250
247
  "importedBy": [
251
248
  {
252
- "uid": "64d3-32"
249
+ "uid": "4ef0-32"
253
250
  }
254
251
  ]
255
252
  },
256
- "64d3-32": {
253
+ "4ef0-32": {
257
254
  "id": "/src/index.ts",
258
255
  "moduleParts": {
259
- "zip.esm.js": "64d3-33"
256
+ "zip.esm.js": "4ef0-33"
260
257
  },
261
258
  "imported": [
262
259
  {
263
- "uid": "64d3-22"
260
+ "uid": "4ef0-22"
264
261
  },
265
262
  {
266
- "uid": "64d3-24"
263
+ "uid": "4ef0-24"
267
264
  },
268
265
  {
269
- "uid": "64d3-26"
266
+ "uid": "4ef0-26"
270
267
  },
271
268
  {
272
- "uid": "64d3-28"
269
+ "uid": "4ef0-28"
273
270
  },
274
271
  {
275
- "uid": "64d3-30"
272
+ "uid": "4ef0-30"
276
273
  },
277
274
  {
278
- "uid": "64d3-34"
275
+ "uid": "4ef0-34"
279
276
  },
280
277
  {
281
- "uid": "64d3-18"
278
+ "uid": "4ef0-18"
282
279
  }
283
280
  ],
284
281
  "importedBy": [],
285
282
  "isEntry": true
286
283
  },
287
- "64d3-34": {
284
+ "4ef0-34": {
288
285
  "id": "/src/types.ts",
289
286
  "moduleParts": {},
290
287
  "imported": [],
291
288
  "importedBy": [
292
289
  {
293
- "uid": "64d3-32"
290
+ "uid": "4ef0-32"
294
291
  }
295
292
  ]
296
293
  },
297
- "64d3-35": {
294
+ "4ef0-35": {
298
295
  "id": "@tanstack/react-query",
299
296
  "moduleParts": {},
300
297
  "imported": [],
301
298
  "importedBy": [
302
299
  {
303
- "uid": "64d3-22"
304
- },
305
- {
306
- "uid": "64d3-24"
307
- },
308
- {
309
- "uid": "64d3-26"
310
- },
311
- {
312
- "uid": "64d3-28"
313
- },
314
- {
315
- "uid": "64d3-30"
316
- },
317
- {
318
- "uid": "64d3-18"
300
+ "uid": "4ef0-18"
319
301
  }
320
302
  ],
321
303
  "isExternal": true
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tanstack/react-query')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', '@tanstack/react-query'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryKit = {}, global.ReactQuery));
5
- })(this, (function (exports, ReactQuery) { 'use strict';
5
+ })(this, (function (exports, TanstackReactQuery) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -22,12 +22,14 @@
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- var ReactQuery__namespace = /*#__PURE__*/_interopNamespace(ReactQuery);
25
+ var TanstackReactQuery__namespace = /*#__PURE__*/_interopNamespace(TanstackReactQuery);
26
26
 
27
+ const ReactQuery = TanstackReactQuery__namespace;
28
+ const isV5 = !!ReactQuery.useSuspenseQuery;
27
29
  const withMiddleware = (hook, defaultOptions, type) => {
28
30
  return function useMiddleware(options, queryClient) {
29
- const [middleware, opts] = [ReactQuery__namespace.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
30
- isV5() ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
31
+ const [middleware, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
32
+ isV5 ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
31
33
  use: u2 = [],
32
34
  ...o2
33
35
  } = {}) => [[...u1, ...u2], { ...o1,
@@ -48,7 +50,6 @@
48
50
  suspense: true,
49
51
  useErrorBoundary: (_error, query) => query.state.data === undefined
50
52
  };
51
- const isV5 = () => !!ReactQuery__namespace.useSuspenseQuery;
52
53
  const getKey = (primaryKey, variables) => {
53
54
  return variables === undefined ? [primaryKey] : [primaryKey, variables];
54
55
  };
@@ -109,25 +110,25 @@
109
110
  };
110
111
 
111
112
  const createQuery = options => {
112
- return createBaseQuery(options, ReactQuery__namespace.useQuery);
113
+ return createBaseQuery(options, ReactQuery.useQuery);
113
114
  };
114
115
 
115
116
  const createSuspenseQuery = options => {
116
- return isV5() ? createBaseQuery(options, ReactQuery__namespace.useSuspenseQuery) : createBaseQuery(options, ReactQuery__namespace.useQuery, suspenseOptions);
117
+ return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseQuery) : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions);
117
118
  };
118
119
 
119
120
  const createInfiniteQuery = options => {
120
- return createBaseQuery(options, ReactQuery__namespace.useInfiniteQuery);
121
+ return createBaseQuery(options, ReactQuery.useInfiniteQuery);
121
122
  };
122
123
 
123
124
  const createSuspenseInfiniteQuery = options => {
124
- return isV5() ? createBaseQuery(options, ReactQuery__namespace.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery__namespace.useInfiniteQuery, suspenseOptions);
125
+ return isV5 ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery) : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions);
125
126
  };
126
127
 
127
128
  const createMutation = defaultOptions => {
128
129
  const getKey = () => defaultOptions.mutationKey;
129
130
 
130
- return Object.assign(withMiddleware(ReactQuery__namespace.useMutation, defaultOptions, 'mutations'), {
131
+ return Object.assign(withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'), {
131
132
  getKey,
132
133
  mutationFn: defaultOptions.mutationFn
133
134
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.development.js","sources":["../../src/utils.ts","../../src/createBaseQuery.ts","../../src/createQuery.tsx","../../src/createSuspenseQuery.ts","../../src/createInfiniteQuery.ts","../../src/createSuspenseInfiniteQuery.ts","../../src/createMutation.ts"],"sourcesContent":["import * as ReactQuery from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: ReactQuery.QueryClient; use?: Middleware[] },\n queryClient?: ReactQuery.QueryClient\n ) {\n const [middleware, opts] = [\n ReactQuery.useQueryClient(\n // @ts-ignore Compatible with ReactQuery v4\n isV5() ? queryClient : options\n ).getDefaultOptions()[type],\n defaultOptions,\n options,\n ].reduce(\n ([u1, o1], { use: u2 = [], ...o2 } = {}) => [\n [...u1, ...u2],\n { ...o1, ...o2 },\n ],\n [[]]\n )\n\n let next = hook\n for (let i = middleware.length; i--; ) {\n next = middleware[i](next)\n }\n\n return next(opts, queryClient)\n }\n}\n\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: ReactQuery.Query) =>\n query.state.data === undefined,\n}\n\nexport const isV5 = () => !!ReactQuery.useSuspenseQuery\n\nexport const getKey = <TVariables = void>(\n primaryKey: string,\n variables?: TVariables\n) => {\n return (\n variables === undefined ? [primaryKey] : [primaryKey, variables]\n ) as inferQueryKey<unknown, TVariables>\n}\n","import type {\n QueryClient,\n UseBaseQueryOptions,\n UseInfiniteQueryOptions,\n} from '@tanstack/react-query'\n\nimport type { AdditionalQueryOptions, Middleware } from './types'\nimport { getKey as getQueryKey, withMiddleware } from './utils'\n\ninterface CreateBaseQueryOptions\n extends Omit<UseInfiniteQueryOptions, 'queryKey' | 'queryFn'>,\n AdditionalQueryOptions<any, any> {\n use?: Middleware[]\n variables?: any\n}\n\ntype QueryBaseHookOptions = Omit<\n UseBaseQueryOptions,\n 'queryKey' | 'queryFn'\n> & {\n variables?: any\n}\n\nexport const createBaseQuery = (\n defaultOptions: any,\n useRQHook: (options: any, queryClient?: any) => any,\n overrideOptions?: QueryBaseHookOptions\n): any => {\n if (process.env.NODE_ENV !== 'production') {\n // @ts-ignore\n if (defaultOptions.useDefaultOptions) {\n console.error(\n '[Bug] useDefaultOptions is not supported, please use middleware instead.'\n )\n }\n }\n\n const {\n primaryKey,\n queryFn,\n queryKeyHashFn,\n getPreviousPageParam,\n getNextPageParam,\n initialPageParam,\n } = defaultOptions as CreateBaseQueryOptions\n\n const getPrimaryKey = () => primaryKey\n\n const getKey = (variables?: any) => getQueryKey(primaryKey, variables)\n\n const getOptions = (variables: any) => {\n return {\n ...defaultOptions,\n queryKey: getKey(variables),\n }\n }\n\n const getFetchOptions = (variables: any) => {\n return {\n queryKey: getKey(variables),\n queryFn,\n queryKeyHashFn,\n getPreviousPageParam,\n getNextPageParam,\n initialPageParam,\n }\n }\n\n const useBaseHook = (\n options: QueryBaseHookOptions,\n queryClient?: QueryClient\n ) => {\n return useRQHook(\n {\n ...options,\n ...overrideOptions,\n queryKey: getKey(options.variables),\n },\n queryClient\n )\n }\n\n return Object.assign(withMiddleware(useBaseHook, defaultOptions, 'queries'), {\n getPrimaryKey,\n getKey,\n queryFn,\n queryKeyHashFn,\n getOptions,\n getFetchOptions,\n })\n}\n","import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\n\nexport const createQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateQueryOptions<TFnData, TVariables, TError>\n): QueryHook<TFnData, TVariables, TError> => {\n return createBaseQuery(options, ReactQuery.useQuery)\n}\n","import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateSuspenseQueryOptions<TFnData, TVariables, TError>\n): SuspenseQueryHook<TFnData, TVariables, TError> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseQuery)\n : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions)\n}\n","import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\n\nexport const createInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n): InfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return createBaseQuery(options, ReactQuery.useInfiniteQuery)\n}\n","import * as ReactQuery from '@tanstack/react-query'\n\nimport { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateSuspenseInfiniteQueryOptions<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n): SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return isV5()\n ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery)\n : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions)\n}\n","import * as ReactQuery from '@tanstack/react-query'\n\nimport type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { withMiddleware } from './utils'\n\nexport const createMutation = <\n TData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>\n): MutationHook<TData, TVariables, TError> => {\n const getKey = () => defaultOptions.mutationKey\n\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError>\n}\n"],"names":["withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","ReactQuery","useQueryClient","isV5","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","useSuspenseQuery","getKey","primaryKey","variables","createBaseQuery","useRQHook","overrideOptions","useDefaultOptions","console","error","queryFn","queryKeyHashFn","getPreviousPageParam","getNextPageParam","initialPageParam","getPrimaryKey","getQueryKey","getOptions","queryKey","getFetchOptions","useBaseHook","Object","assign","createQuery","useQuery","createSuspenseQuery","createInfiniteQuery","useInfiniteQuery","createSuspenseInfiniteQuery","useSuspenseInfiniteQuery","createMutation","mutationKey","useMutation","mutationFn"],"mappings":";;;;;;;;;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EAAyB7D,cAAzB,EAAyC,WAAzC,CADT,EAEL;MACE8B,MADF;MAEEgC,UAAU,EAAE9D,cAAc,CAAC8D,UAAAA;EAF7B,GAFK,CAAP,CAAA;EAOD;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.development.js","sources":["../../src/utils.ts","../../src/createBaseQuery.ts","../../src/createQuery.tsx","../../src/createSuspenseQuery.ts","../../src/createInfiniteQuery.ts","../../src/createSuspenseInfiniteQuery.ts","../../src/createMutation.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient } from '@tanstack/react-query'\n\nimport type { Middleware, inferQueryKey } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const withMiddleware = (\n hook: any,\n defaultOptions: any,\n type: 'queries' | 'mutations'\n) => {\n return function useMiddleware(\n options?: { client?: QueryClient; use?: Middleware[] },\n queryClient?: QueryClient\n ) {\n const [middleware, opts] = [\n ReactQuery.useQueryClient(\n // @ts-ignore Compatible with ReactQuery v4\n isV5 ? queryClient : options\n ).getDefaultOptions()[type],\n defaultOptions,\n options,\n ].reduce(\n ([u1, o1], { use: u2 = [], ...o2 } = {}) => [\n [...u1, ...u2],\n { ...o1, ...o2 },\n ],\n [[]]\n )\n\n let next = hook\n for (let i = middleware.length; i--; ) {\n next = middleware[i](next)\n }\n\n return next(opts, queryClient)\n }\n}\n\n// Compatible with ReactQuery v4\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\n\nexport const getKey = <TVariables = void>(\n primaryKey: string,\n variables?: TVariables\n) => {\n return (\n variables === undefined ? [primaryKey] : [primaryKey, variables]\n ) as inferQueryKey<unknown, TVariables>\n}\n","import type {\n QueryClient,\n UseBaseQueryOptions,\n UseInfiniteQueryOptions,\n} from '@tanstack/react-query'\n\nimport type { AdditionalQueryOptions, Middleware } from './types'\nimport { getKey as getQueryKey, withMiddleware } from './utils'\n\ninterface CreateBaseQueryOptions\n extends Omit<UseInfiniteQueryOptions, 'queryKey' | 'queryFn'>,\n AdditionalQueryOptions<any, any> {\n use?: Middleware[]\n variables?: any\n}\n\ntype QueryBaseHookOptions = Omit<\n UseBaseQueryOptions,\n 'queryKey' | 'queryFn'\n> & {\n variables?: any\n}\n\nexport const createBaseQuery = (\n defaultOptions: any,\n useRQHook: (options: any, queryClient?: any) => any,\n overrideOptions?: QueryBaseHookOptions\n): any => {\n if (process.env.NODE_ENV !== 'production') {\n // @ts-ignore\n if (defaultOptions.useDefaultOptions) {\n console.error(\n '[Bug] useDefaultOptions is not supported, please use middleware instead.'\n )\n }\n }\n\n const {\n primaryKey,\n queryFn,\n queryKeyHashFn,\n getPreviousPageParam,\n getNextPageParam,\n initialPageParam,\n } = defaultOptions as CreateBaseQueryOptions\n\n const getPrimaryKey = () => primaryKey\n\n const getKey = (variables?: any) => getQueryKey(primaryKey, variables)\n\n const getOptions = (variables: any) => {\n return {\n ...defaultOptions,\n queryKey: getKey(variables),\n }\n }\n\n const getFetchOptions = (variables: any) => {\n return {\n queryKey: getKey(variables),\n queryFn,\n queryKeyHashFn,\n getPreviousPageParam,\n getNextPageParam,\n initialPageParam,\n }\n }\n\n const useBaseHook = (\n options: QueryBaseHookOptions,\n queryClient?: QueryClient\n ) => {\n return useRQHook(\n {\n ...options,\n ...overrideOptions,\n queryKey: getKey(options.variables),\n },\n queryClient\n )\n }\n\n return Object.assign(withMiddleware(useBaseHook, defaultOptions, 'queries'), {\n getPrimaryKey,\n getKey,\n queryFn,\n queryKeyHashFn,\n getOptions,\n getFetchOptions,\n })\n}\n","import { createBaseQuery } from './createBaseQuery'\nimport type { CompatibleError, CreateQueryOptions, QueryHook } from './types'\nimport { ReactQuery } from './utils'\n\nexport const createQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateQueryOptions<TFnData, TVariables, TError>\n): QueryHook<TFnData, TVariables, TError> => {\n return createBaseQuery(options, ReactQuery.useQuery)\n}\n","import { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseQueryOptions,\n SuspenseQueryHook,\n} from './types'\nimport { ReactQuery, isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError\n>(\n options: CreateSuspenseQueryOptions<TFnData, TVariables, TError>\n): SuspenseQueryHook<TFnData, TVariables, TError> => {\n return isV5\n ? createBaseQuery(options, ReactQuery.useSuspenseQuery)\n : createBaseQuery(options, ReactQuery.useQuery, suspenseOptions)\n}\n","import { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateInfiniteQueryOptions,\n InfiniteQueryHook,\n} from './types'\nimport { ReactQuery } from './utils'\n\nexport const createInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>\n): InfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return createBaseQuery(options, ReactQuery.useInfiniteQuery)\n}\n","import { createBaseQuery } from './createBaseQuery'\nimport type {\n CompatibleError,\n CreateSuspenseInfiniteQueryOptions,\n SuspenseInfiniteQueryHook,\n} from './types'\nimport { ReactQuery, isV5, suspenseOptions } from './utils'\n\nexport const createSuspenseInfiniteQuery = <\n TFnData,\n TVariables = void,\n TError = CompatibleError,\n TPageParam = number\n>(\n options: CreateSuspenseInfiniteQueryOptions<\n TFnData,\n TVariables,\n TError,\n TPageParam\n >\n): SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {\n return isV5\n ? createBaseQuery(options, ReactQuery.useSuspenseInfiniteQuery)\n : createBaseQuery(options, ReactQuery.useInfiniteQuery, suspenseOptions)\n}\n","import type {\n CompatibleError,\n CreateMutationOptions,\n MutationHook,\n} from './types'\nimport { ReactQuery, withMiddleware } from './utils'\n\nexport const createMutation = <\n TData = unknown,\n TVariables = void,\n TError = CompatibleError,\n TContext = unknown\n>(\n defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>\n): MutationHook<TData, TVariables, TError, TContext> => {\n const getKey = () => defaultOptions.mutationKey\n\n return Object.assign(\n withMiddleware(ReactQuery.useMutation, defaultOptions, 'mutations'),\n {\n getKey,\n mutationFn: defaultOptions.mutationFn,\n }\n ) as MutationHook<TData, TVariables, TError, TContext>\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","middleware","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","next","i","length","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","undefined","getKey","primaryKey","variables","createBaseQuery","useRQHook","overrideOptions","useDefaultOptions","console","error","queryFn","queryKeyHashFn","getPreviousPageParam","getNextPageParam","initialPageParam","getPrimaryKey","getQueryKey","getOptions","queryKey","getFetchOptions","useBaseHook","Object","assign","createQuery","useQuery","createSuspenseQuery","createInfiniteQuery","useInfiniteQuery","createSuspenseInfiniteQuery","useSuspenseInfiniteQuery","createMutation","mutationKey","useMutation","mutationFn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAKO,MAAMA,UAAU,GAAGC,6BAAnB,CAAA;EAEA,MAAMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,gBAA1B,CAAA;EAEA,MAAMC,cAAc,GAAG,CAC5BC,IAD4B,EAE5BC,cAF4B,EAG5BC,IAH4B,KAIzB;EACH,EAAA,OAAO,SAASC,aAAT,CACLC,OADK,EAELC,WAFK,EAGL;MACA,MAAM,CAACC,UAAD,EAAaC,IAAb,IAAqB,CACzBZ,UAAU,CAACa,cAAX;MAEEX,IAAI,GAAGQ,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADyB,EAKzBD,cALyB,EAMzBG,OANyB,CAAA,CAOzBM,MAPyB,CAQzB,CAAC,CAACC,EAAD,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BAAmB,GAK9BhD,OALiC,IAMkB;IACnD,OAAOP,IAAI,GACPkC,eAAe,CAAC3B,OAAD,EAAUT,UAAU,CAACG,gBAArB,CADR,GAEPiC,eAAe,CAAC3B,OAAD,EAAUT,UAAU,CAACwD,QAArB,EAA+BhC,eAA/B,CAFnB,CAAA;EAGD;;ACVYkC,QAAAA,mBAAmB,GAM9BjD,OANiC,IAO8B;EAC/D,EAAA,OAAO2B,eAAe,CAAC3B,OAAD,EAAUT,UAAU,CAAC2D,gBAArB,CAAtB,CAAA;EACD;;ACTYC,QAAAA,2BAA2B,GAMtCnD,OANyC,IAY8B;IACvE,OAAOP,IAAI,GACPkC,eAAe,CAAC3B,OAAD,EAAUT,UAAU,CAAC6D,wBAArB,CADR,GAEPzB,eAAe,CAAC3B,OAAD,EAAUT,UAAU,CAAC2D,gBAArB,EAAuCnC,eAAvC,CAFnB,CAAA;EAGD;;ACjBYsC,QAAAA,cAAc,GAMzBxD,cAN4B,IAO0B;EACtD,EAAA,MAAM2B,MAAM,GAAG,MAAM3B,cAAc,CAACyD,WAApC,CAAA;;EAEA,EAAA,OAAOV,MAAM,CAACC,MAAP,CACLlD,cAAc,CAACJ,UAAU,CAACgE,WAAZ,EAAyB1D,cAAzB,EAAyC,WAAzC,CADT,EAEL;MACE2B,MADF;MAEEgC,UAAU,EAAE3D,cAAc,CAAC2D,UAAAA;EAF7B,GAFK,CAAP,CAAA;EAOD;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tanstack/react-query")):"function"==typeof define&&define.amd?define(["exports","@tanstack/react-query"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactQueryKit={},e.ReactQuery)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=r(t);const n=(e,t,r)=>function(n,a){const[s,y]=[u.useQueryClient(i()?a:n).getDefaultOptions()[r],t,n].reduce((([e,t],{use:r=[],...u}={})=>[[...e,...r],{...t,...u}]),[[]]);let o=e;for(let e=s.length;e--;)o=s[e](o);return o(y,a)},a={enabled:!0,suspense:!0,useErrorBoundary:(e,t)=>void 0===t.state.data},i=()=>!!u.useSuspenseQuery,s=(e,t)=>void 0===t?[e]:[e,t],y=(e,t,r)=>{const{primaryKey:u,queryFn:a,queryKeyHashFn:i,getPreviousPageParam:y,getNextPageParam:o,initialPageParam:c}=e,f=e=>s(u,e);return Object.assign(n(((e,u)=>t({...e,...r,queryKey:f(e.variables)},u)),e,"queries"),{getPrimaryKey:()=>u,getKey:f,queryFn:a,queryKeyHashFn:i,getOptions:t=>({...e,queryKey:f(t)}),getFetchOptions:e=>({queryKey:f(e),queryFn:a,queryKeyHashFn:i,getPreviousPageParam:y,getNextPageParam:o,initialPageParam:c})})};e.createInfiniteQuery=e=>y(e,u.useInfiniteQuery),e.createMutation=e=>Object.assign(n(u.useMutation,e,"mutations"),{getKey:()=>e.mutationKey,mutationFn:e.mutationFn}),e.createQuery=e=>y(e,u.useQuery),e.createSuspenseInfiniteQuery=e=>i()?y(e,u.useSuspenseInfiniteQuery):y(e,u.useInfiniteQuery,a),e.createSuspenseQuery=e=>i()?y(e,u.useSuspenseQuery):y(e,u.useQuery,a),e.getKey=s,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tanstack/react-query")):"function"==typeof define&&define.amd?define(["exports","@tanstack/react-query"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactQueryKit={},e.ReactQuery)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}const u=r(t),n=!!u.useSuspenseQuery,a=(e,t,r)=>function(a,i){const[s,y]=[u.useQueryClient(n?i:a).getDefaultOptions()[r],t,a].reduce((([e,t],{use:r=[],...u}={})=>[[...e,...r],{...t,...u}]),[[]]);let o=e;for(let e=s.length;e--;)o=s[e](o);return o(y,i)},i={enabled:!0,suspense:!0,useErrorBoundary:(e,t)=>void 0===t.state.data},s=(e,t)=>void 0===t?[e]:[e,t],y=(e,t,r)=>{const{primaryKey:u,queryFn:n,queryKeyHashFn:i,getPreviousPageParam:y,getNextPageParam:o,initialPageParam:c}=e,f=e=>s(u,e);return Object.assign(a(((e,u)=>t({...e,...r,queryKey:f(e.variables)},u)),e,"queries"),{getPrimaryKey:()=>u,getKey:f,queryFn:n,queryKeyHashFn:i,getOptions:t=>({...e,queryKey:f(t)}),getFetchOptions:e=>({queryKey:f(e),queryFn:n,queryKeyHashFn:i,getPreviousPageParam:y,getNextPageParam:o,initialPageParam:c})})};e.createInfiniteQuery=e=>y(e,u.useInfiniteQuery),e.createMutation=e=>Object.assign(a(u.useMutation,e,"mutations"),{getKey:()=>e.mutationKey,mutationFn:e.mutationFn}),e.createQuery=e=>y(e,u.useQuery),e.createSuspenseInfiniteQuery=e=>n?y(e,u.useSuspenseInfiniteQuery):y(e,u.useInfiniteQuery,i),e.createSuspenseQuery=e=>n?y(e,u.useSuspenseQuery):y(e,u.useQuery,i),e.getKey=s,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=index.production.js.map