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