@ahoo-wang/fetcher-react 3.1.6 → 3.1.9
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 +35 -5
- package/dist/core/useDebouncedExecutePromise.d.ts.map +1 -1
- package/dist/core/useExecutePromise.d.ts +86 -20
- package/dist/core/useExecutePromise.d.ts.map +1 -1
- package/dist/fetcher/useDebouncedFetcher.d.ts.map +1 -1
- package/dist/fetcher/useFetcher.d.ts +12 -9
- package/dist/fetcher/useFetcher.d.ts.map +1 -1
- package/dist/index.es.js +302 -267
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/wow/debounce/useDebouncedQuery.d.ts.map +1 -1
- package/dist/wow/useCountQuery.d.ts.map +1 -1
- package/dist/wow/useListQuery.d.ts.map +1 -1
- package/dist/wow/useListStreamQuery.d.ts.map +1 -1
- package/dist/wow/usePagedQuery.d.ts.map +1 -1
- package/dist/wow/useQuery.d.ts +2 -2
- package/dist/wow/useQuery.d.ts.map +1 -1
- package/dist/wow/useSingleQuery.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,444 +1,479 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { nameGenerator as
|
|
5
|
-
import { fetcherRegistrar as
|
|
6
|
-
function
|
|
7
|
-
const e =
|
|
8
|
-
return
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var b = (e, t) => M(e, "name", { value: t, configurable: !0 });
|
|
3
|
+
import { useRef as v, useCallback as c, useEffect as F, useState as Q, useMemo as h, useReducer as O, useSyncExternalStore as k } from "react";
|
|
4
|
+
import { nameGenerator as q } from "@ahoo-wang/fetcher-eventbus";
|
|
5
|
+
import { fetcherRegistrar as U, getFetcher as z } from "@ahoo-wang/fetcher";
|
|
6
|
+
function D() {
|
|
7
|
+
const e = v(!1), t = c(() => e.current, []);
|
|
8
|
+
return F(() => (e.current = !0, () => {
|
|
9
9
|
e.current = !1;
|
|
10
10
|
}), []), t;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
const t =
|
|
12
|
+
b(D, "useMounted");
|
|
13
|
+
function C(e) {
|
|
14
|
+
const t = v(e);
|
|
15
15
|
return t.current = e, t;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
const [t,
|
|
17
|
+
b(C, "useLatest");
|
|
18
|
+
var G = /* @__PURE__ */ ((e) => (e.IDLE = "idle", e.LOADING = "loading", e.SUCCESS = "success", e.ERROR = "error", e))(G || {});
|
|
19
|
+
function K(e) {
|
|
20
|
+
const [t, n] = Q(
|
|
21
21
|
e?.initialStatus ?? "idle"
|
|
22
22
|
/* IDLE */
|
|
23
|
-
), [
|
|
24
|
-
|
|
23
|
+
), [o, i] = Q(void 0), [l, s] = Q(void 0), u = D(), d = C(e), a = c(() => {
|
|
24
|
+
u() && (n(
|
|
25
25
|
"loading"
|
|
26
26
|
/* LOADING */
|
|
27
|
-
),
|
|
28
|
-
}, [
|
|
29
|
-
async (
|
|
30
|
-
if (
|
|
31
|
-
|
|
27
|
+
), s(void 0));
|
|
28
|
+
}, [u]), f = c(
|
|
29
|
+
async (y) => {
|
|
30
|
+
if (u()) {
|
|
31
|
+
i(y), n(
|
|
32
32
|
"success"
|
|
33
33
|
/* SUCCESS */
|
|
34
|
-
),
|
|
34
|
+
), s(void 0);
|
|
35
35
|
try {
|
|
36
|
-
await
|
|
36
|
+
await d.current?.onSuccess?.(y);
|
|
37
37
|
} catch (E) {
|
|
38
38
|
console.warn("PromiseState onSuccess callback error:", E);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
[
|
|
43
|
-
),
|
|
44
|
-
async (
|
|
45
|
-
if (
|
|
46
|
-
|
|
42
|
+
[u, d]
|
|
43
|
+
), r = c(
|
|
44
|
+
async (y) => {
|
|
45
|
+
if (u()) {
|
|
46
|
+
s(y), n(
|
|
47
47
|
"error"
|
|
48
48
|
/* ERROR */
|
|
49
|
-
),
|
|
49
|
+
), i(void 0);
|
|
50
50
|
try {
|
|
51
|
-
await
|
|
51
|
+
await d.current?.onError?.(y);
|
|
52
52
|
} catch (E) {
|
|
53
53
|
console.warn("PromiseState onError callback error:", E);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
[
|
|
58
|
-
), g =
|
|
59
|
-
|
|
57
|
+
[u, d]
|
|
58
|
+
), g = c(() => {
|
|
59
|
+
u() && (n(
|
|
60
60
|
"idle"
|
|
61
61
|
/* IDLE */
|
|
62
|
-
),
|
|
63
|
-
}, [
|
|
62
|
+
), s(void 0), i(void 0));
|
|
63
|
+
}, [u]);
|
|
64
64
|
return h(
|
|
65
65
|
() => ({
|
|
66
66
|
status: t,
|
|
67
67
|
loading: t === "loading",
|
|
68
|
-
result:
|
|
69
|
-
error:
|
|
70
|
-
setLoading:
|
|
68
|
+
result: o,
|
|
69
|
+
error: l,
|
|
70
|
+
setLoading: a,
|
|
71
71
|
setSuccess: f,
|
|
72
|
-
setError:
|
|
72
|
+
setError: r,
|
|
73
73
|
setIdle: g
|
|
74
74
|
}),
|
|
75
|
-
[t,
|
|
75
|
+
[t, o, l, a, f, r, g]
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
function
|
|
80
|
-
const e =
|
|
78
|
+
b(K, "usePromiseState");
|
|
79
|
+
function T() {
|
|
80
|
+
const e = v(0), t = c(() => ++e.current, []), n = c(() => e.current, []), o = c((s) => s === e.current, []), i = c(() => {
|
|
81
81
|
e.current++;
|
|
82
|
-
}, []),
|
|
82
|
+
}, []), l = c(() => {
|
|
83
83
|
e.current = 0;
|
|
84
84
|
}, []);
|
|
85
85
|
return h(() => ({
|
|
86
86
|
generate: t,
|
|
87
|
-
current:
|
|
88
|
-
isLatest:
|
|
89
|
-
invalidate:
|
|
90
|
-
reset:
|
|
91
|
-
}), [t,
|
|
87
|
+
current: n,
|
|
88
|
+
isLatest: o,
|
|
89
|
+
invalidate: i,
|
|
90
|
+
reset: l
|
|
91
|
+
}), [t, n, o, i, l]);
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
function
|
|
93
|
+
b(T, "useRequestId");
|
|
94
|
+
function P(e) {
|
|
95
95
|
const {
|
|
96
96
|
loading: t,
|
|
97
|
-
result:
|
|
98
|
-
error:
|
|
99
|
-
status:
|
|
100
|
-
setLoading:
|
|
101
|
-
setSuccess:
|
|
102
|
-
setError:
|
|
103
|
-
setIdle:
|
|
104
|
-
} =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
result: n,
|
|
98
|
+
error: o,
|
|
99
|
+
status: i,
|
|
100
|
+
setLoading: l,
|
|
101
|
+
setSuccess: s,
|
|
102
|
+
setError: u,
|
|
103
|
+
setIdle: d
|
|
104
|
+
} = K(e), a = D(), f = T(), r = v(void 0), g = e?.propagateError, y = e?.onAbort, E = c(async () => {
|
|
105
|
+
try {
|
|
106
|
+
await y?.();
|
|
107
|
+
} catch (w) {
|
|
108
|
+
console.warn("useExecutePromise onAbort callback error:", w);
|
|
109
|
+
}
|
|
110
|
+
}, [y]), S = c(
|
|
111
|
+
async (w) => {
|
|
112
|
+
r.current && (r.current.abort(), await E());
|
|
113
|
+
const I = new AbortController();
|
|
114
|
+
r.current = I;
|
|
115
|
+
const A = f.generate();
|
|
116
|
+
l();
|
|
110
117
|
try {
|
|
111
|
-
const R = await (
|
|
112
|
-
|
|
113
|
-
} catch (
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
const R = await w(I);
|
|
119
|
+
a() && f.isLatest(A) && await s(R);
|
|
120
|
+
} catch (R) {
|
|
121
|
+
if (R instanceof Error && R.name === "AbortError") {
|
|
122
|
+
a() && d();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (a() && f.isLatest(A) && await u(R), g)
|
|
126
|
+
throw R;
|
|
127
|
+
} finally {
|
|
128
|
+
r.current === I && (r.current = void 0);
|
|
117
129
|
}
|
|
118
130
|
},
|
|
119
|
-
[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
[
|
|
132
|
+
l,
|
|
133
|
+
s,
|
|
134
|
+
u,
|
|
135
|
+
d,
|
|
136
|
+
a,
|
|
137
|
+
f,
|
|
138
|
+
g,
|
|
139
|
+
E
|
|
140
|
+
]
|
|
141
|
+
), m = c(() => {
|
|
142
|
+
a() && d();
|
|
143
|
+
}, [d, a]), x = c(async () => {
|
|
144
|
+
m(), r.current && (r.current.abort(), r.current = void 0, await E());
|
|
145
|
+
}, [m, E]);
|
|
146
|
+
return F(() => () => {
|
|
147
|
+
x();
|
|
148
|
+
}, [x]), h(
|
|
124
149
|
() => ({
|
|
125
150
|
loading: t,
|
|
126
|
-
result:
|
|
127
|
-
error:
|
|
128
|
-
status:
|
|
129
|
-
execute:
|
|
130
|
-
reset:
|
|
151
|
+
result: n,
|
|
152
|
+
error: o,
|
|
153
|
+
status: i,
|
|
154
|
+
execute: S,
|
|
155
|
+
reset: m,
|
|
156
|
+
abort: x
|
|
131
157
|
}),
|
|
132
|
-
[t,
|
|
158
|
+
[t, n, o, i, S, m, x]
|
|
133
159
|
);
|
|
134
160
|
}
|
|
135
|
-
|
|
161
|
+
b(P, "useExecutePromise");
|
|
136
162
|
function J() {
|
|
137
|
-
const e =
|
|
138
|
-
(
|
|
163
|
+
const e = v(/* @__PURE__ */ new Map()), t = c((r) => e.current.get(r), []), n = c(
|
|
164
|
+
(r, g) => e.current.set(r, g),
|
|
139
165
|
[]
|
|
140
|
-
),
|
|
141
|
-
g ? e.current.set(
|
|
166
|
+
), o = c((r) => e.current.has(r), []), i = c((r) => e.current.delete(r), []), l = c(() => e.current.clear(), []), s = c(() => e.current.keys(), []), u = c(() => e.current.values(), []), d = c(() => e.current.entries(), []), a = c(() => e.current[Symbol.iterator](), []), f = c((r) => (g) => {
|
|
167
|
+
g ? e.current.set(r, g) : e.current.delete(r);
|
|
142
168
|
}, []);
|
|
143
|
-
return
|
|
169
|
+
return F(() => () => {
|
|
144
170
|
e.current.clear();
|
|
145
171
|
}, []), h(
|
|
146
172
|
() => ({
|
|
147
173
|
register: f,
|
|
148
174
|
get: t,
|
|
149
|
-
set:
|
|
150
|
-
has:
|
|
151
|
-
delete:
|
|
152
|
-
clear:
|
|
153
|
-
keys:
|
|
154
|
-
values:
|
|
155
|
-
entries:
|
|
175
|
+
set: n,
|
|
176
|
+
has: o,
|
|
177
|
+
delete: i,
|
|
178
|
+
clear: l,
|
|
179
|
+
keys: s,
|
|
180
|
+
values: u,
|
|
181
|
+
entries: d,
|
|
156
182
|
get size() {
|
|
157
183
|
return e.current.size;
|
|
158
184
|
},
|
|
159
|
-
[Symbol.iterator]:
|
|
185
|
+
[Symbol.iterator]: a
|
|
160
186
|
}),
|
|
161
|
-
[f, t,
|
|
187
|
+
[f, t, n, o, i, l, s, u, d, a]
|
|
162
188
|
);
|
|
163
189
|
}
|
|
164
|
-
|
|
165
|
-
function
|
|
190
|
+
b(J, "useRefs");
|
|
191
|
+
function p(e, t) {
|
|
166
192
|
if (t.leading === !1 && t.trailing === !1)
|
|
167
193
|
throw new Error(
|
|
168
194
|
"useDebouncedCallback: at least one of leading or trailing must be true"
|
|
169
195
|
);
|
|
170
|
-
const
|
|
196
|
+
const n = v(
|
|
171
197
|
void 0
|
|
172
|
-
),
|
|
173
|
-
|
|
198
|
+
), o = v(!1), i = C(e), l = C(t), s = c(() => n.current !== void 0, []), u = c(() => {
|
|
199
|
+
n.current !== void 0 && (clearTimeout(n.current), n.current = void 0);
|
|
174
200
|
}, []);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}, [
|
|
178
|
-
const
|
|
179
|
-
(...
|
|
180
|
-
const { leading: f = !1, trailing:
|
|
181
|
-
|
|
182
|
-
|
|
201
|
+
F(() => () => {
|
|
202
|
+
u();
|
|
203
|
+
}, [u]);
|
|
204
|
+
const d = c(
|
|
205
|
+
(...a) => {
|
|
206
|
+
const { leading: f = !1, trailing: r = !0, delay: g } = l.current;
|
|
207
|
+
u(), f && !o.current && (i.current(...a), o.current = !0), r && (n.current = setTimeout(() => {
|
|
208
|
+
o.current || i.current(...a), o.current = !1, n.current = void 0;
|
|
183
209
|
}, g));
|
|
184
210
|
},
|
|
185
|
-
[
|
|
211
|
+
[i, l, u]
|
|
186
212
|
);
|
|
187
213
|
return h(
|
|
188
214
|
() => ({
|
|
189
|
-
run:
|
|
190
|
-
cancel:
|
|
191
|
-
isPending:
|
|
215
|
+
run: d,
|
|
216
|
+
cancel: u,
|
|
217
|
+
isPending: s
|
|
192
218
|
}),
|
|
193
|
-
[
|
|
219
|
+
[d, u, s]
|
|
194
220
|
);
|
|
195
221
|
}
|
|
196
|
-
|
|
222
|
+
b(p, "useDebouncedCallback");
|
|
197
223
|
function W(e) {
|
|
198
|
-
const { loading: t, result:
|
|
199
|
-
|
|
224
|
+
const { loading: t, result: n, error: o, execute: i, reset: l, abort: s, status: u } = P(e), { run: d, cancel: a, isPending: f } = p(
|
|
225
|
+
i,
|
|
200
226
|
e.debounce
|
|
201
227
|
);
|
|
202
228
|
return h(
|
|
203
229
|
() => ({
|
|
204
230
|
loading: t,
|
|
205
|
-
result:
|
|
206
|
-
error:
|
|
207
|
-
status:
|
|
208
|
-
|
|
231
|
+
result: n,
|
|
232
|
+
error: o,
|
|
233
|
+
status: u,
|
|
234
|
+
reset: l,
|
|
235
|
+
abort: s,
|
|
236
|
+
run: d,
|
|
209
237
|
cancel: a,
|
|
210
|
-
isPending:
|
|
211
|
-
reset: i
|
|
238
|
+
isPending: f
|
|
212
239
|
}),
|
|
213
|
-
[t,
|
|
240
|
+
[t, n, o, u, l, s, d, a, f]
|
|
214
241
|
);
|
|
215
242
|
}
|
|
216
|
-
|
|
243
|
+
b(W, "useDebouncedExecutePromise");
|
|
217
244
|
function X() {
|
|
218
|
-
const [, e] =
|
|
245
|
+
const [, e] = O((t) => t + 1, 0);
|
|
219
246
|
return e;
|
|
220
247
|
}
|
|
221
|
-
|
|
248
|
+
b(X, "useForceUpdate");
|
|
222
249
|
function Y(e, t) {
|
|
223
|
-
const
|
|
224
|
-
(
|
|
225
|
-
name:
|
|
250
|
+
const n = c(
|
|
251
|
+
(s) => e.addListener({
|
|
252
|
+
name: q.generate("useKeyStorage"),
|
|
226
253
|
// Generate unique listener name
|
|
227
|
-
handle:
|
|
254
|
+
handle: s
|
|
228
255
|
// Callback to trigger React re-render on storage changes
|
|
229
256
|
}),
|
|
230
257
|
[e]
|
|
231
258
|
// Recreate subscription only if keyStorage changes
|
|
232
|
-
),
|
|
233
|
-
const
|
|
234
|
-
return
|
|
235
|
-
}, [e, t]),
|
|
236
|
-
(
|
|
259
|
+
), o = c(() => {
|
|
260
|
+
const s = e.get();
|
|
261
|
+
return s !== null ? s : t ?? null;
|
|
262
|
+
}, [e, t]), i = k(n, o, o), l = c(
|
|
263
|
+
(s) => e.set(s),
|
|
237
264
|
[e]
|
|
238
265
|
// Recreate setter only if keyStorage changes
|
|
239
266
|
);
|
|
240
|
-
return [
|
|
267
|
+
return [i, l];
|
|
241
268
|
}
|
|
242
|
-
|
|
269
|
+
b(Y, "useKeyStorage");
|
|
243
270
|
function N(e) {
|
|
244
|
-
const { fetcher: t =
|
|
245
|
-
loading:
|
|
246
|
-
result:
|
|
247
|
-
error:
|
|
248
|
-
status:
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
} = D(e), [f, d] = Q(
|
|
271
|
+
const { fetcher: t = U.default } = e || {}, {
|
|
272
|
+
loading: n,
|
|
273
|
+
result: o,
|
|
274
|
+
error: i,
|
|
275
|
+
status: l,
|
|
276
|
+
execute: s,
|
|
277
|
+
reset: u,
|
|
278
|
+
abort: d
|
|
279
|
+
} = P(e), [a, f] = Q(
|
|
254
280
|
void 0
|
|
255
|
-
),
|
|
256
|
-
async (
|
|
257
|
-
b.current && b.current.abort(), b.current = I.abortController ?? new AbortController(), I.abortController = b.current;
|
|
258
|
-
const F = E.generate();
|
|
259
|
-
n();
|
|
281
|
+
), r = C(e), g = z(t), y = c(
|
|
282
|
+
async (m) => {
|
|
260
283
|
try {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
w.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
g() && E.isLatest(F) && await a(v);
|
|
274
|
-
} finally {
|
|
275
|
-
b.current === I.abortController && (b.current = void 0);
|
|
284
|
+
await s(async (x) => {
|
|
285
|
+
m.abortController = x;
|
|
286
|
+
const w = await g.exchange(
|
|
287
|
+
m,
|
|
288
|
+
r.current
|
|
289
|
+
);
|
|
290
|
+
return f(w), await w.extractResult();
|
|
291
|
+
});
|
|
292
|
+
} catch (x) {
|
|
293
|
+
throw f(void 0), x;
|
|
276
294
|
}
|
|
277
295
|
},
|
|
278
|
-
[
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
a,
|
|
286
|
-
E
|
|
287
|
-
]
|
|
288
|
-
);
|
|
289
|
-
return C(() => () => {
|
|
290
|
-
b.current?.abort(), b.current = void 0;
|
|
291
|
-
}, []), h(
|
|
296
|
+
[s, g, r]
|
|
297
|
+
), E = c(() => {
|
|
298
|
+
u(), f(void 0);
|
|
299
|
+
}, [u]), S = c(() => {
|
|
300
|
+
d(), f(void 0);
|
|
301
|
+
}, [d]);
|
|
302
|
+
return h(
|
|
292
303
|
() => ({
|
|
293
|
-
loading:
|
|
294
|
-
result:
|
|
295
|
-
error:
|
|
296
|
-
status:
|
|
297
|
-
exchange:
|
|
298
|
-
execute:
|
|
304
|
+
loading: n,
|
|
305
|
+
result: o,
|
|
306
|
+
error: i,
|
|
307
|
+
status: l,
|
|
308
|
+
exchange: a,
|
|
309
|
+
execute: y,
|
|
310
|
+
reset: E,
|
|
311
|
+
abort: S
|
|
299
312
|
}),
|
|
300
|
-
[
|
|
313
|
+
[n, o, i, l, a, y, E, S]
|
|
301
314
|
);
|
|
302
315
|
}
|
|
303
|
-
|
|
316
|
+
b(N, "useFetcher");
|
|
304
317
|
function Z(e) {
|
|
305
|
-
const { loading: t, result:
|
|
306
|
-
|
|
318
|
+
const { loading: t, result: n, error: o, status: i, exchange: l, execute: s, reset: u, abort: d } = N(e), { run: a, cancel: f, isPending: r } = p(
|
|
319
|
+
s,
|
|
307
320
|
e.debounce
|
|
308
321
|
);
|
|
309
322
|
return h(
|
|
310
323
|
() => ({
|
|
311
324
|
loading: t,
|
|
312
|
-
result:
|
|
313
|
-
error: s,
|
|
314
|
-
status: o,
|
|
315
|
-
exchange: i,
|
|
316
|
-
run: c,
|
|
317
|
-
cancel: a,
|
|
318
|
-
isPending: l
|
|
319
|
-
}),
|
|
320
|
-
[t, r, s, o, i, c, a, l]
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
y(Z, "useDebouncedFetcher");
|
|
324
|
-
function L(e) {
|
|
325
|
-
const t = S(e), {
|
|
326
|
-
loading: r,
|
|
327
|
-
result: s,
|
|
328
|
-
error: o,
|
|
329
|
-
status: i,
|
|
330
|
-
execute: n,
|
|
331
|
-
reset: c
|
|
332
|
-
} = O(t.current), a = m(e.initialQuery), l = u(async () => t.current.execute(
|
|
333
|
-
a.current,
|
|
334
|
-
t.current.attributes
|
|
335
|
-
), [a, t]), f = u(() => n(l), [n, l]), d = u(() => a.current, [a]), g = u(
|
|
336
|
-
(b) => {
|
|
337
|
-
a.current = b, t.current.autoExecute && f();
|
|
338
|
-
},
|
|
339
|
-
[a, t, f]
|
|
340
|
-
);
|
|
341
|
-
return C(() => {
|
|
342
|
-
t.current.autoExecute && f();
|
|
343
|
-
}, [t, f]), h(
|
|
344
|
-
() => ({
|
|
345
|
-
loading: r,
|
|
346
|
-
result: s,
|
|
325
|
+
result: n,
|
|
347
326
|
error: o,
|
|
348
327
|
status: i,
|
|
349
|
-
|
|
350
|
-
reset:
|
|
351
|
-
|
|
352
|
-
|
|
328
|
+
exchange: l,
|
|
329
|
+
reset: u,
|
|
330
|
+
abort: d,
|
|
331
|
+
run: a,
|
|
332
|
+
cancel: f,
|
|
333
|
+
isPending: r
|
|
353
334
|
}),
|
|
354
335
|
[
|
|
355
|
-
|
|
356
|
-
|
|
336
|
+
t,
|
|
337
|
+
n,
|
|
357
338
|
o,
|
|
358
339
|
i,
|
|
359
|
-
|
|
360
|
-
|
|
340
|
+
l,
|
|
341
|
+
u,
|
|
361
342
|
d,
|
|
362
|
-
|
|
343
|
+
a,
|
|
344
|
+
f,
|
|
345
|
+
r
|
|
363
346
|
]
|
|
364
347
|
);
|
|
365
348
|
}
|
|
366
|
-
|
|
349
|
+
b(Z, "useDebouncedFetcher");
|
|
350
|
+
function L(e) {
|
|
351
|
+
const t = C(e), {
|
|
352
|
+
loading: n,
|
|
353
|
+
result: o,
|
|
354
|
+
error: i,
|
|
355
|
+
status: l,
|
|
356
|
+
execute: s,
|
|
357
|
+
reset: u,
|
|
358
|
+
abort: d
|
|
359
|
+
} = P(t.current), a = v(e.initialQuery), f = c(
|
|
360
|
+
async (E) => t.current.execute(
|
|
361
|
+
a.current,
|
|
362
|
+
t.current.attributes,
|
|
363
|
+
E
|
|
364
|
+
),
|
|
365
|
+
[a, t]
|
|
366
|
+
), r = c(() => s(f), [s, f]), g = c(() => a.current, [a]), y = c(
|
|
367
|
+
(E) => {
|
|
368
|
+
a.current = E, t.current.autoExecute && r();
|
|
369
|
+
},
|
|
370
|
+
[a, t, r]
|
|
371
|
+
);
|
|
372
|
+
return F(() => {
|
|
373
|
+
t.current.autoExecute && r();
|
|
374
|
+
}, [t, r]), h(
|
|
375
|
+
() => ({
|
|
376
|
+
loading: n,
|
|
377
|
+
result: o,
|
|
378
|
+
error: i,
|
|
379
|
+
status: l,
|
|
380
|
+
execute: r,
|
|
381
|
+
reset: u,
|
|
382
|
+
abort: d,
|
|
383
|
+
getQuery: g,
|
|
384
|
+
setQuery: y
|
|
385
|
+
}),
|
|
386
|
+
[n, o, i, l, r, u, d, g, y]
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
b(L, "useQuery");
|
|
367
390
|
function _(e) {
|
|
368
391
|
return L(e);
|
|
369
392
|
}
|
|
370
|
-
|
|
393
|
+
b(_, "usePagedQuery");
|
|
371
394
|
function $(e) {
|
|
372
395
|
return L(e);
|
|
373
396
|
}
|
|
374
|
-
|
|
397
|
+
b($, "useSingleQuery");
|
|
375
398
|
function ee(e) {
|
|
376
399
|
return L(e);
|
|
377
400
|
}
|
|
378
|
-
|
|
401
|
+
b(ee, "useCountQuery");
|
|
379
402
|
function te(e) {
|
|
380
403
|
return L(e);
|
|
381
404
|
}
|
|
382
|
-
|
|
405
|
+
b(te, "useListQuery");
|
|
383
406
|
function re(e) {
|
|
384
407
|
return L(
|
|
385
408
|
e
|
|
386
409
|
);
|
|
387
410
|
}
|
|
388
|
-
|
|
411
|
+
b(re, "useListStreamQuery");
|
|
389
412
|
function ne(e) {
|
|
390
|
-
const {
|
|
391
|
-
|
|
413
|
+
const {
|
|
414
|
+
loading: t,
|
|
415
|
+
result: n,
|
|
416
|
+
error: o,
|
|
417
|
+
status: i,
|
|
418
|
+
execute: l,
|
|
419
|
+
reset: s,
|
|
420
|
+
abort: u,
|
|
421
|
+
getQuery: d,
|
|
422
|
+
setQuery: a
|
|
423
|
+
} = L(e), { run: f, cancel: r, isPending: g } = p(
|
|
424
|
+
l,
|
|
392
425
|
e.debounce
|
|
393
426
|
);
|
|
394
427
|
return h(
|
|
395
428
|
() => ({
|
|
396
429
|
loading: t,
|
|
397
|
-
result:
|
|
398
|
-
error:
|
|
399
|
-
status:
|
|
400
|
-
reset:
|
|
401
|
-
|
|
430
|
+
result: n,
|
|
431
|
+
error: o,
|
|
432
|
+
status: i,
|
|
433
|
+
reset: s,
|
|
434
|
+
abort: u,
|
|
435
|
+
getQuery: d,
|
|
402
436
|
setQuery: a,
|
|
403
|
-
run:
|
|
404
|
-
cancel:
|
|
405
|
-
isPending:
|
|
437
|
+
run: f,
|
|
438
|
+
cancel: r,
|
|
439
|
+
isPending: g
|
|
406
440
|
}),
|
|
407
441
|
[
|
|
408
442
|
t,
|
|
409
|
-
r,
|
|
410
|
-
s,
|
|
411
|
-
o,
|
|
412
443
|
n,
|
|
413
|
-
|
|
444
|
+
o,
|
|
445
|
+
i,
|
|
446
|
+
s,
|
|
447
|
+
u,
|
|
448
|
+
d,
|
|
414
449
|
a,
|
|
415
|
-
l,
|
|
416
450
|
f,
|
|
417
|
-
|
|
451
|
+
r,
|
|
452
|
+
g
|
|
418
453
|
]
|
|
419
454
|
);
|
|
420
455
|
}
|
|
421
|
-
|
|
456
|
+
b(ne, "useDebouncedQuery");
|
|
422
457
|
export {
|
|
423
|
-
|
|
458
|
+
G as PromiseStatus,
|
|
424
459
|
ee as useCountQuery,
|
|
425
|
-
|
|
460
|
+
p as useDebouncedCallback,
|
|
426
461
|
W as useDebouncedExecutePromise,
|
|
427
462
|
Z as useDebouncedFetcher,
|
|
428
463
|
ne as useDebouncedQuery,
|
|
429
|
-
|
|
464
|
+
P as useExecutePromise,
|
|
430
465
|
N as useFetcher,
|
|
431
466
|
X as useForceUpdate,
|
|
432
467
|
Y as useKeyStorage,
|
|
433
|
-
|
|
468
|
+
C as useLatest,
|
|
434
469
|
te as useListQuery,
|
|
435
470
|
re as useListStreamQuery,
|
|
436
|
-
|
|
471
|
+
D as useMounted,
|
|
437
472
|
_ as usePagedQuery,
|
|
438
|
-
|
|
473
|
+
K as usePromiseState,
|
|
439
474
|
L as useQuery,
|
|
440
475
|
J as useRefs,
|
|
441
|
-
|
|
476
|
+
T as useRequestId,
|
|
442
477
|
$ as useSingleQuery
|
|
443
478
|
};
|
|
444
479
|
//# sourceMappingURL=index.es.js.map
|