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