react-query-kit 3.0.0-rc.2 → 3.1.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/README.md +48 -44
- package/build/lib/router.esm.js +26 -17
- package/build/lib/router.esm.js.map +1 -1
- package/build/lib/router.js +26 -17
- package/build/lib/router.js.map +1 -1
- package/build/lib/router.mjs +26 -17
- package/build/lib/router.mjs.map +1 -1
- package/build/lib/types.d.ts +6 -8
- package/build/lib/utils.esm.js +5 -10
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +5 -10
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +5 -10
- package/build/lib/utils.mjs.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats.json +99 -99
- package/build/umd/index.development.js +31 -27
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/build/zip/zip.esm.js +1 -1
- package/package.json +1 -1
- package/src/router.ts +34 -26
- package/src/types.ts +38 -6
- package/src/utils.ts +5 -9
package/build/lib/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient, QueryKey } from '@tanstack/react-query'\n\nimport type { Middleware } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n query.state.data === undefined,\n}\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 [
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as TanstackReactQuery from '@tanstack/react-query'\nimport type { Query, QueryClient, QueryKey } from '@tanstack/react-query'\n\nimport type { Middleware } from './types'\n\nexport const ReactQuery = TanstackReactQuery\n\nexport const isV5 = !!ReactQuery.useSuspenseQuery\n\nexport const suspenseOptions = {\n enabled: true,\n suspense: true,\n useErrorBoundary: (_error: unknown, query: Query) =>\n typeof query.state.data === 'undefined',\n}\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 [uses, opts]: [Middleware[], any] = [\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 const composedHook = uses.reduceRight((next, use) => use(next), hook)\n\n return composedHook(opts, queryClient)\n }\n}\n\nexport const getKey = (queryKey: QueryKey, variables?: any): QueryKey => {\n return typeof variables === 'undefined' ? queryKey : [...queryKey, variables]\n}\n"],"names":["ReactQuery","TanstackReactQuery","isV5","useSuspenseQuery","suspenseOptions","enabled","suspense","useErrorBoundary","_error","query","state","data","withMiddleware","hook","defaultOptions","type","useMiddleware","options","queryClient","uses","opts","useQueryClient","getDefaultOptions","reduce","u1","o1","use","u2","o2","composedHook","reduceRight","next","getKey","queryKey","variables"],"mappings":";;AAKO,MAAMA,UAAU,GAAGC,mBAAnB;MAEMC,IAAI,GAAG,CAAC,CAACF,UAAU,CAACG,iBAA1B;AAEA,MAAMC,eAAe,GAAG;AAC7BC,EAAAA,OAAO,EAAE,IADoB;AAE7BC,EAAAA,QAAQ,EAAE,IAFmB;AAG7BC,EAAAA,gBAAgB,EAAE,CAACC,MAAD,EAAkBC,KAAlB,KAChB,OAAOA,KAAK,CAACC,KAAN,CAAYC,IAAnB,KAA4B,WAAA;AAJD,EAAxB;AAOA,MAAMC,cAAc,GAAG,CAC5BC,IAD4B,EAE5BC,cAF4B,EAG5BC,IAH4B,KAIzB;AACH,EAAA,OAAO,SAASC,aAAT,CACLC,OADK,EAELC,WAFK,EAGL;IACA,MAAM,CAACC,IAAD,EAAOC,IAAP,IAAoC,CACxCpB,UAAU,CAACqB,cAAX;IAEEnB,IAAI,GAAGgB,WAAH,GAAiBD,OAFvB,EAGEK,iBAHF,EAAA,CAGsBP,IAHtB,CADwC,EAKxCD,cALwC,EAMxCG,OANwC,CAAA,CAOxCM,MAPwC,CAQxC,CAAC,CAACC,EAAD,EAAKC,EAAL,CAAD,EAAW;MAAEC,GAAG,EAAEC,EAAE,GAAG,EAAZ;MAAgB,GAAGC,EAAAA;AAAnB,KAAA,GAA0B,EAArC,KAA4C,CAC1C,CAAC,GAAGJ,EAAJ,EAAQ,GAAGG,EAAX,CAD0C,EAE1C,EAAE,GAAGF,EAAL;MAAS,GAAGG,EAAAA;AAAZ,KAF0C,CARJ,EAYxC,CAAC,EAAD,CAZwC,CAA1C,CAAA;AAcA,IAAA,MAAMC,YAAY,GAAGV,IAAI,CAACW,WAAL,CAAiB,CAACC,IAAD,EAAOL,GAAP,KAAeA,GAAG,CAACK,IAAD,CAAnC,EAA2ClB,IAA3C,CAArB,CAAA;AAEA,IAAA,OAAOgB,YAAY,CAACT,IAAD,EAAOF,WAAP,CAAnB,CAAA;GApBF,CAAA;AAsBD,EA3BM;MA6BMc,MAAM,GAAG,CAACC,QAAD,EAAqBC,SAArB,KAAmD;AACvE,EAAA,OAAO,OAAOA,SAAP,KAAqB,WAArB,GAAmCD,QAAnC,GAA8C,CAAC,GAAGA,QAAJ,EAAcC,SAAd,CAArD,CAAA;AACD;;;;"}
|
package/build/stats-html.html
CHANGED
|
@@ -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":"
|
|
4017
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"zip.esm.js","children":[{"name":"src","children":[{"uid":"4094-1","name":"utils.ts"},{"uid":"4094-3","name":"createBaseQuery.ts"},{"uid":"4094-5","name":"createQuery.ts"},{"uid":"4094-7","name":"createSuspenseQuery.ts"},{"uid":"4094-9","name":"createInfiniteQuery.ts"},{"uid":"4094-11","name":"createSuspenseInfiniteQuery.ts"},{"uid":"4094-13","name":"createMutation.ts"},{"uid":"4094-15","name":"router.ts"},{"uid":"4094-17","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"4094-1":{"renderedLength":894,"gzipLength":449,"brotliLength":0,"mainUid":"4094-0"},"4094-3":{"renderedLength":1162,"gzipLength":397,"brotliLength":0,"mainUid":"4094-2"},"4094-5":{"renderedLength":91,"gzipLength":87,"brotliLength":0,"mainUid":"4094-4"},"4094-7":{"renderedLength":179,"gzipLength":118,"brotliLength":0,"mainUid":"4094-6"},"4094-9":{"renderedLength":107,"gzipLength":97,"brotliLength":0,"mainUid":"4094-8"},"4094-11":{"renderedLength":203,"gzipLength":128,"brotliLength":0,"mainUid":"4094-10"},"4094-13":{"renderedLength":271,"gzipLength":168,"brotliLength":0,"mainUid":"4094-12"},"4094-15":{"renderedLength":1156,"gzipLength":389,"brotliLength":0,"mainUid":"4094-14"},"4094-17":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"4094-16"}},"nodeMetas":{"4094-0":{"id":"/src/utils.ts","moduleParts":{"zip.esm.js":"4094-1"},"imported":[{"uid":"4094-19"}],"importedBy":[{"uid":"4094-16"},{"uid":"4094-4"},{"uid":"4094-6"},{"uid":"4094-8"},{"uid":"4094-10"},{"uid":"4094-12"},{"uid":"4094-2"}]},"4094-2":{"id":"/src/createBaseQuery.ts","moduleParts":{"zip.esm.js":"4094-3"},"imported":[{"uid":"4094-0"}],"importedBy":[{"uid":"4094-4"},{"uid":"4094-6"},{"uid":"4094-8"},{"uid":"4094-10"}]},"4094-4":{"id":"/src/createQuery.ts","moduleParts":{"zip.esm.js":"4094-5"},"imported":[{"uid":"4094-2"},{"uid":"4094-0"}],"importedBy":[{"uid":"4094-16"},{"uid":"4094-14"}]},"4094-6":{"id":"/src/createSuspenseQuery.ts","moduleParts":{"zip.esm.js":"4094-7"},"imported":[{"uid":"4094-2"},{"uid":"4094-0"}],"importedBy":[{"uid":"4094-16"},{"uid":"4094-14"}]},"4094-8":{"id":"/src/createInfiniteQuery.ts","moduleParts":{"zip.esm.js":"4094-9"},"imported":[{"uid":"4094-2"},{"uid":"4094-0"}],"importedBy":[{"uid":"4094-16"},{"uid":"4094-14"}]},"4094-10":{"id":"/src/createSuspenseInfiniteQuery.ts","moduleParts":{"zip.esm.js":"4094-11"},"imported":[{"uid":"4094-2"},{"uid":"4094-0"}],"importedBy":[{"uid":"4094-16"},{"uid":"4094-14"}]},"4094-12":{"id":"/src/createMutation.ts","moduleParts":{"zip.esm.js":"4094-13"},"imported":[{"uid":"4094-0"}],"importedBy":[{"uid":"4094-16"},{"uid":"4094-14"}]},"4094-14":{"id":"/src/router.ts","moduleParts":{"zip.esm.js":"4094-15"},"imported":[{"uid":"4094-8"},{"uid":"4094-12"},{"uid":"4094-4"},{"uid":"4094-10"},{"uid":"4094-6"}],"importedBy":[{"uid":"4094-16"}]},"4094-16":{"id":"/src/index.ts","moduleParts":{"zip.esm.js":"4094-17"},"imported":[{"uid":"4094-4"},{"uid":"4094-6"},{"uid":"4094-8"},{"uid":"4094-10"},{"uid":"4094-12"},{"uid":"4094-18"},{"uid":"4094-14"},{"uid":"4094-0"}],"importedBy":[],"isEntry":true},"4094-18":{"id":"/src/types.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"4094-16"}]},"4094-19":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"4094-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,39 +10,39 @@
|
|
|
10
10
|
"name": "src",
|
|
11
11
|
"children": [
|
|
12
12
|
{
|
|
13
|
-
"uid": "
|
|
13
|
+
"uid": "4094-21",
|
|
14
14
|
"name": "utils.ts"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
"uid": "
|
|
17
|
+
"uid": "4094-23",
|
|
18
18
|
"name": "createBaseQuery.ts"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
"uid": "
|
|
21
|
+
"uid": "4094-25",
|
|
22
22
|
"name": "createQuery.ts"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
"uid": "
|
|
25
|
+
"uid": "4094-27",
|
|
26
26
|
"name": "createSuspenseQuery.ts"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"uid": "
|
|
29
|
+
"uid": "4094-29",
|
|
30
30
|
"name": "createInfiniteQuery.ts"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
"uid": "
|
|
33
|
+
"uid": "4094-31",
|
|
34
34
|
"name": "createSuspenseInfiniteQuery.ts"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
"uid": "
|
|
37
|
+
"uid": "4094-33",
|
|
38
38
|
"name": "createMutation.ts"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
"uid": "
|
|
41
|
+
"uid": "4094-35",
|
|
42
42
|
"name": "router.ts"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
"uid": "
|
|
45
|
+
"uid": "4094-37",
|
|
46
46
|
"name": "index.ts"
|
|
47
47
|
}
|
|
48
48
|
]
|
|
@@ -53,307 +53,307 @@
|
|
|
53
53
|
"isRoot": true
|
|
54
54
|
},
|
|
55
55
|
"nodeParts": {
|
|
56
|
-
"
|
|
57
|
-
"renderedLength":
|
|
58
|
-
"gzipLength":
|
|
56
|
+
"4094-21": {
|
|
57
|
+
"renderedLength": 894,
|
|
58
|
+
"gzipLength": 449,
|
|
59
59
|
"brotliLength": 0,
|
|
60
|
-
"mainUid": "
|
|
60
|
+
"mainUid": "4094-20"
|
|
61
61
|
},
|
|
62
|
-
"
|
|
62
|
+
"4094-23": {
|
|
63
63
|
"renderedLength": 1162,
|
|
64
64
|
"gzipLength": 397,
|
|
65
65
|
"brotliLength": 0,
|
|
66
|
-
"mainUid": "
|
|
66
|
+
"mainUid": "4094-22"
|
|
67
67
|
},
|
|
68
|
-
"
|
|
68
|
+
"4094-25": {
|
|
69
69
|
"renderedLength": 91,
|
|
70
70
|
"gzipLength": 87,
|
|
71
71
|
"brotliLength": 0,
|
|
72
|
-
"mainUid": "
|
|
72
|
+
"mainUid": "4094-24"
|
|
73
73
|
},
|
|
74
|
-
"
|
|
74
|
+
"4094-27": {
|
|
75
75
|
"renderedLength": 179,
|
|
76
76
|
"gzipLength": 118,
|
|
77
77
|
"brotliLength": 0,
|
|
78
|
-
"mainUid": "
|
|
78
|
+
"mainUid": "4094-26"
|
|
79
79
|
},
|
|
80
|
-
"
|
|
80
|
+
"4094-29": {
|
|
81
81
|
"renderedLength": 107,
|
|
82
82
|
"gzipLength": 97,
|
|
83
83
|
"brotliLength": 0,
|
|
84
|
-
"mainUid": "
|
|
84
|
+
"mainUid": "4094-28"
|
|
85
85
|
},
|
|
86
|
-
"
|
|
86
|
+
"4094-31": {
|
|
87
87
|
"renderedLength": 203,
|
|
88
88
|
"gzipLength": 128,
|
|
89
89
|
"brotliLength": 0,
|
|
90
|
-
"mainUid": "
|
|
90
|
+
"mainUid": "4094-30"
|
|
91
91
|
},
|
|
92
|
-
"
|
|
92
|
+
"4094-33": {
|
|
93
93
|
"renderedLength": 271,
|
|
94
94
|
"gzipLength": 168,
|
|
95
95
|
"brotliLength": 0,
|
|
96
|
-
"mainUid": "
|
|
96
|
+
"mainUid": "4094-32"
|
|
97
97
|
},
|
|
98
|
-
"
|
|
99
|
-
"renderedLength":
|
|
100
|
-
"gzipLength":
|
|
98
|
+
"4094-35": {
|
|
99
|
+
"renderedLength": 1156,
|
|
100
|
+
"gzipLength": 389,
|
|
101
101
|
"brotliLength": 0,
|
|
102
|
-
"mainUid": "
|
|
102
|
+
"mainUid": "4094-34"
|
|
103
103
|
},
|
|
104
|
-
"
|
|
104
|
+
"4094-37": {
|
|
105
105
|
"renderedLength": 0,
|
|
106
106
|
"gzipLength": 0,
|
|
107
107
|
"brotliLength": 0,
|
|
108
|
-
"mainUid": "
|
|
108
|
+
"mainUid": "4094-36"
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"nodeMetas": {
|
|
112
|
-
"
|
|
112
|
+
"4094-20": {
|
|
113
113
|
"id": "/src/utils.ts",
|
|
114
114
|
"moduleParts": {
|
|
115
|
-
"zip.esm.js": "
|
|
115
|
+
"zip.esm.js": "4094-21"
|
|
116
116
|
},
|
|
117
117
|
"imported": [
|
|
118
118
|
{
|
|
119
|
-
"uid": "
|
|
119
|
+
"uid": "4094-39"
|
|
120
120
|
}
|
|
121
121
|
],
|
|
122
122
|
"importedBy": [
|
|
123
123
|
{
|
|
124
|
-
"uid": "
|
|
124
|
+
"uid": "4094-36"
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
|
-
"uid": "
|
|
127
|
+
"uid": "4094-24"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
"uid": "
|
|
130
|
+
"uid": "4094-26"
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
|
-
"uid": "
|
|
133
|
+
"uid": "4094-28"
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
|
-
"uid": "
|
|
136
|
+
"uid": "4094-30"
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
|
-
"uid": "
|
|
139
|
+
"uid": "4094-32"
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
|
-
"uid": "
|
|
142
|
+
"uid": "4094-22"
|
|
143
143
|
}
|
|
144
144
|
]
|
|
145
145
|
},
|
|
146
|
-
"
|
|
146
|
+
"4094-22": {
|
|
147
147
|
"id": "/src/createBaseQuery.ts",
|
|
148
148
|
"moduleParts": {
|
|
149
|
-
"zip.esm.js": "
|
|
149
|
+
"zip.esm.js": "4094-23"
|
|
150
150
|
},
|
|
151
151
|
"imported": [
|
|
152
152
|
{
|
|
153
|
-
"uid": "
|
|
153
|
+
"uid": "4094-20"
|
|
154
154
|
}
|
|
155
155
|
],
|
|
156
156
|
"importedBy": [
|
|
157
157
|
{
|
|
158
|
-
"uid": "
|
|
158
|
+
"uid": "4094-24"
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
|
-
"uid": "
|
|
161
|
+
"uid": "4094-26"
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
|
-
"uid": "
|
|
164
|
+
"uid": "4094-28"
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
|
-
"uid": "
|
|
167
|
+
"uid": "4094-30"
|
|
168
168
|
}
|
|
169
169
|
]
|
|
170
170
|
},
|
|
171
|
-
"
|
|
171
|
+
"4094-24": {
|
|
172
172
|
"id": "/src/createQuery.ts",
|
|
173
173
|
"moduleParts": {
|
|
174
|
-
"zip.esm.js": "
|
|
174
|
+
"zip.esm.js": "4094-25"
|
|
175
175
|
},
|
|
176
176
|
"imported": [
|
|
177
177
|
{
|
|
178
|
-
"uid": "
|
|
178
|
+
"uid": "4094-22"
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
|
-
"uid": "
|
|
181
|
+
"uid": "4094-20"
|
|
182
182
|
}
|
|
183
183
|
],
|
|
184
184
|
"importedBy": [
|
|
185
185
|
{
|
|
186
|
-
"uid": "
|
|
186
|
+
"uid": "4094-36"
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
"uid": "
|
|
189
|
+
"uid": "4094-34"
|
|
190
190
|
}
|
|
191
191
|
]
|
|
192
192
|
},
|
|
193
|
-
"
|
|
193
|
+
"4094-26": {
|
|
194
194
|
"id": "/src/createSuspenseQuery.ts",
|
|
195
195
|
"moduleParts": {
|
|
196
|
-
"zip.esm.js": "
|
|
196
|
+
"zip.esm.js": "4094-27"
|
|
197
197
|
},
|
|
198
198
|
"imported": [
|
|
199
199
|
{
|
|
200
|
-
"uid": "
|
|
200
|
+
"uid": "4094-22"
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
|
-
"uid": "
|
|
203
|
+
"uid": "4094-20"
|
|
204
204
|
}
|
|
205
205
|
],
|
|
206
206
|
"importedBy": [
|
|
207
207
|
{
|
|
208
|
-
"uid": "
|
|
208
|
+
"uid": "4094-36"
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
|
-
"uid": "
|
|
211
|
+
"uid": "4094-34"
|
|
212
212
|
}
|
|
213
213
|
]
|
|
214
214
|
},
|
|
215
|
-
"
|
|
215
|
+
"4094-28": {
|
|
216
216
|
"id": "/src/createInfiniteQuery.ts",
|
|
217
217
|
"moduleParts": {
|
|
218
|
-
"zip.esm.js": "
|
|
218
|
+
"zip.esm.js": "4094-29"
|
|
219
219
|
},
|
|
220
220
|
"imported": [
|
|
221
221
|
{
|
|
222
|
-
"uid": "
|
|
222
|
+
"uid": "4094-22"
|
|
223
223
|
},
|
|
224
224
|
{
|
|
225
|
-
"uid": "
|
|
225
|
+
"uid": "4094-20"
|
|
226
226
|
}
|
|
227
227
|
],
|
|
228
228
|
"importedBy": [
|
|
229
229
|
{
|
|
230
|
-
"uid": "
|
|
230
|
+
"uid": "4094-36"
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
|
-
"uid": "
|
|
233
|
+
"uid": "4094-34"
|
|
234
234
|
}
|
|
235
235
|
]
|
|
236
236
|
},
|
|
237
|
-
"
|
|
237
|
+
"4094-30": {
|
|
238
238
|
"id": "/src/createSuspenseInfiniteQuery.ts",
|
|
239
239
|
"moduleParts": {
|
|
240
|
-
"zip.esm.js": "
|
|
240
|
+
"zip.esm.js": "4094-31"
|
|
241
241
|
},
|
|
242
242
|
"imported": [
|
|
243
243
|
{
|
|
244
|
-
"uid": "
|
|
244
|
+
"uid": "4094-22"
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
|
-
"uid": "
|
|
247
|
+
"uid": "4094-20"
|
|
248
248
|
}
|
|
249
249
|
],
|
|
250
250
|
"importedBy": [
|
|
251
251
|
{
|
|
252
|
-
"uid": "
|
|
252
|
+
"uid": "4094-36"
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
|
-
"uid": "
|
|
255
|
+
"uid": "4094-34"
|
|
256
256
|
}
|
|
257
257
|
]
|
|
258
258
|
},
|
|
259
|
-
"
|
|
259
|
+
"4094-32": {
|
|
260
260
|
"id": "/src/createMutation.ts",
|
|
261
261
|
"moduleParts": {
|
|
262
|
-
"zip.esm.js": "
|
|
262
|
+
"zip.esm.js": "4094-33"
|
|
263
263
|
},
|
|
264
264
|
"imported": [
|
|
265
265
|
{
|
|
266
|
-
"uid": "
|
|
266
|
+
"uid": "4094-20"
|
|
267
267
|
}
|
|
268
268
|
],
|
|
269
269
|
"importedBy": [
|
|
270
270
|
{
|
|
271
|
-
"uid": "
|
|
271
|
+
"uid": "4094-36"
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
|
-
"uid": "
|
|
274
|
+
"uid": "4094-34"
|
|
275
275
|
}
|
|
276
276
|
]
|
|
277
277
|
},
|
|
278
|
-
"
|
|
278
|
+
"4094-34": {
|
|
279
279
|
"id": "/src/router.ts",
|
|
280
280
|
"moduleParts": {
|
|
281
|
-
"zip.esm.js": "
|
|
281
|
+
"zip.esm.js": "4094-35"
|
|
282
282
|
},
|
|
283
283
|
"imported": [
|
|
284
284
|
{
|
|
285
|
-
"uid": "
|
|
285
|
+
"uid": "4094-28"
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
|
-
"uid": "
|
|
288
|
+
"uid": "4094-32"
|
|
289
289
|
},
|
|
290
290
|
{
|
|
291
|
-
"uid": "
|
|
291
|
+
"uid": "4094-24"
|
|
292
292
|
},
|
|
293
293
|
{
|
|
294
|
-
"uid": "
|
|
294
|
+
"uid": "4094-30"
|
|
295
295
|
},
|
|
296
296
|
{
|
|
297
|
-
"uid": "
|
|
297
|
+
"uid": "4094-26"
|
|
298
298
|
}
|
|
299
299
|
],
|
|
300
300
|
"importedBy": [
|
|
301
301
|
{
|
|
302
|
-
"uid": "
|
|
302
|
+
"uid": "4094-36"
|
|
303
303
|
}
|
|
304
304
|
]
|
|
305
305
|
},
|
|
306
|
-
"
|
|
306
|
+
"4094-36": {
|
|
307
307
|
"id": "/src/index.ts",
|
|
308
308
|
"moduleParts": {
|
|
309
|
-
"zip.esm.js": "
|
|
309
|
+
"zip.esm.js": "4094-37"
|
|
310
310
|
},
|
|
311
311
|
"imported": [
|
|
312
312
|
{
|
|
313
|
-
"uid": "
|
|
313
|
+
"uid": "4094-24"
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
|
-
"uid": "
|
|
316
|
+
"uid": "4094-26"
|
|
317
317
|
},
|
|
318
318
|
{
|
|
319
|
-
"uid": "
|
|
319
|
+
"uid": "4094-28"
|
|
320
320
|
},
|
|
321
321
|
{
|
|
322
|
-
"uid": "
|
|
322
|
+
"uid": "4094-30"
|
|
323
323
|
},
|
|
324
324
|
{
|
|
325
|
-
"uid": "
|
|
325
|
+
"uid": "4094-32"
|
|
326
326
|
},
|
|
327
327
|
{
|
|
328
|
-
"uid": "
|
|
328
|
+
"uid": "4094-38"
|
|
329
329
|
},
|
|
330
330
|
{
|
|
331
|
-
"uid": "
|
|
331
|
+
"uid": "4094-34"
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
|
-
"uid": "
|
|
334
|
+
"uid": "4094-20"
|
|
335
335
|
}
|
|
336
336
|
],
|
|
337
337
|
"importedBy": [],
|
|
338
338
|
"isEntry": true
|
|
339
339
|
},
|
|
340
|
-
"
|
|
340
|
+
"4094-38": {
|
|
341
341
|
"id": "/src/types.ts",
|
|
342
342
|
"moduleParts": {},
|
|
343
343
|
"imported": [],
|
|
344
344
|
"importedBy": [
|
|
345
345
|
{
|
|
346
|
-
"uid": "
|
|
346
|
+
"uid": "4094-36"
|
|
347
347
|
}
|
|
348
348
|
]
|
|
349
349
|
},
|
|
350
|
-
"
|
|
350
|
+
"4094-39": {
|
|
351
351
|
"id": "@tanstack/react-query",
|
|
352
352
|
"moduleParts": {},
|
|
353
353
|
"imported": [],
|
|
354
354
|
"importedBy": [
|
|
355
355
|
{
|
|
356
|
-
"uid": "
|
|
356
|
+
"uid": "4094-20"
|
|
357
357
|
}
|
|
358
358
|
],
|
|
359
359
|
"isExternal": true
|
|
@@ -29,28 +29,23 @@
|
|
|
29
29
|
const suspenseOptions = {
|
|
30
30
|
enabled: true,
|
|
31
31
|
suspense: true,
|
|
32
|
-
useErrorBoundary: (_error, query) => query.state.data === undefined
|
|
32
|
+
useErrorBoundary: (_error, query) => typeof query.state.data === 'undefined'
|
|
33
33
|
};
|
|
34
34
|
const withMiddleware = (hook, defaultOptions, type) => {
|
|
35
35
|
return function useMiddleware(options, queryClient) {
|
|
36
|
-
const [
|
|
36
|
+
const [uses, opts] = [ReactQuery.useQueryClient( // @ts-ignore Compatible with ReactQuery v4
|
|
37
37
|
isV5 ? queryClient : options).getDefaultOptions()[type], defaultOptions, options].reduce(([u1, o1], {
|
|
38
38
|
use: u2 = [],
|
|
39
39
|
...o2
|
|
40
40
|
} = {}) => [[...u1, ...u2], { ...o1,
|
|
41
41
|
...o2
|
|
42
42
|
}], [[]]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
for (let i = middleware.length; i--;) {
|
|
46
|
-
next = middleware[i](next);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return next(opts, queryClient);
|
|
43
|
+
const composedHook = uses.reduceRight((next, use) => use(next), hook);
|
|
44
|
+
return composedHook(opts, queryClient);
|
|
50
45
|
};
|
|
51
46
|
};
|
|
52
47
|
const getKey = (queryKey, variables) => {
|
|
53
|
-
return variables === undefined ?
|
|
48
|
+
return typeof variables === 'undefined' ? queryKey : [...queryKey, variables];
|
|
54
49
|
};
|
|
55
50
|
|
|
56
51
|
const createBaseQuery = (defaultOptions, useRQHook, overrideOptions) => {
|
|
@@ -139,29 +134,38 @@
|
|
|
139
134
|
});
|
|
140
135
|
};
|
|
141
136
|
|
|
142
|
-
const
|
|
137
|
+
const buildRouter = (keys, config) => {
|
|
143
138
|
return Object.entries(config).reduce((acc, [key, opts]) => {
|
|
144
|
-
|
|
145
|
-
[
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
139
|
+
if (!opts._type) {
|
|
140
|
+
acc[key] = buildRouter([...keys, key], opts);
|
|
141
|
+
} else {
|
|
142
|
+
const options = { ...opts,
|
|
143
|
+
[opts._type === "m" ? "mutationKey" : "queryKey"]: [...keys, key]
|
|
144
|
+
};
|
|
145
|
+
acc[key] = opts._type === "m" ? {
|
|
146
|
+
useMutation: createMutation(options),
|
|
147
|
+
...createMutation(options)
|
|
148
|
+
} : opts._type === "q" ? {
|
|
149
|
+
useQuery: createQuery(options),
|
|
150
|
+
useSuspenseQuery: createSuspenseQuery(options),
|
|
151
|
+
...createQuery(options)
|
|
152
|
+
} : {
|
|
153
|
+
useInfiniteQuery: createInfiniteQuery(options),
|
|
154
|
+
useSuspenseInfiniteQuery: createSuspenseInfiniteQuery(options),
|
|
155
|
+
...createInfiniteQuery(options)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
159
|
return acc;
|
|
160
160
|
}, {
|
|
161
|
-
getKey: () =>
|
|
161
|
+
getKey: () => keys
|
|
162
162
|
});
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
+
const router = (scope, config) => {
|
|
166
|
+
return buildRouter([scope], config);
|
|
167
|
+
};
|
|
168
|
+
|
|
165
169
|
router.query = options => {
|
|
166
170
|
return { ...options,
|
|
167
171
|
_type: 'q'
|