@ram_28/kf-ai-sdk 1.0.11 → 1.0.13
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 +55 -48
- package/dist/api/client.d.ts +14 -14
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/datetime.d.ts +5 -5
- package/dist/api/datetime.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +2 -2
- package/dist/api/metadata.d.ts.map +1 -1
- package/dist/api.cjs +1 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.mjs +27 -0
- package/dist/api.types.cjs +1 -0
- package/dist/api.types.d.ts +4 -0
- package/dist/api.types.d.ts.map +1 -0
- package/dist/api.types.mjs +1 -0
- package/dist/auth/AuthProvider.d.ts +3 -3
- package/dist/auth/AuthProvider.d.ts.map +1 -1
- package/dist/auth/authClient.d.ts +4 -4
- package/dist/auth/authClient.d.ts.map +1 -1
- package/dist/auth/authConfig.d.ts +5 -5
- package/dist/auth/authConfig.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/types.d.ts +21 -21
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/useAuth.d.ts +2 -2
- package/dist/auth/useAuth.d.ts.map +1 -1
- package/dist/auth.cjs +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.mjs +280 -0
- package/dist/auth.types.cjs +1 -0
- package/dist/auth.types.d.ts +2 -0
- package/dist/auth.types.d.ts.map +1 -0
- package/dist/auth.types.mjs +1 -0
- package/dist/base-types.d.ts +2 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/client-C15j4O5B.cjs +1 -0
- package/dist/client-CfvLiGfP.js +233 -0
- package/dist/cn-Dr87sK3i.js +2775 -0
- package/dist/cn-mXUIg4vp.cjs +1 -0
- package/dist/components/hooks/index.d.ts +3 -3
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/index.d.ts +2 -2
- package/dist/components/hooks/useFilter/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/types.d.ts +19 -31
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +2 -2
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts +6 -6
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +5 -5
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +10 -10
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -12
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +67 -76
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +2 -2
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/apiClient.d.ts +16 -16
- package/dist/components/hooks/useKanban/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +3 -3
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/dragDropManager.d.ts +7 -7
- package/dist/components/hooks/useKanban/dragDropManager.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/index.d.ts +1 -1
- package/dist/components/hooks/useKanban/index.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +65 -67
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts +2 -2
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/index.d.ts +1 -1
- package/dist/components/hooks/useTable/index.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +10 -10
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts +2 -2
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/filter.cjs +1 -0
- package/dist/filter.d.ts +3 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.mjs +6 -0
- package/dist/filter.types.cjs +1 -0
- package/dist/filter.types.d.ts +2 -0
- package/dist/filter.types.d.ts.map +1 -0
- package/dist/filter.types.mjs +1 -0
- package/dist/form.cjs +1 -0
- package/dist/form.d.ts +3 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.mjs +2355 -0
- package/dist/form.types.cjs +1 -0
- package/dist/form.types.d.ts +2 -0
- package/dist/form.types.d.ts.map +1 -0
- package/dist/form.types.mjs +1 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/kanban.cjs +13 -0
- package/dist/kanban.d.ts +5 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.mjs +1060 -0
- package/dist/kanban.types.cjs +1 -0
- package/dist/kanban.types.d.ts +2 -0
- package/dist/kanban.types.d.ts.map +1 -0
- package/dist/kanban.types.mjs +1 -0
- package/dist/kanban.ui.cjs +1 -0
- package/dist/kanban.ui.d.ts +2 -0
- package/dist/kanban.ui.d.ts.map +1 -0
- package/dist/kanban.ui.mjs +104 -0
- package/dist/metadata-2FLBsFcf.cjs +1 -0
- package/dist/metadata-DBcoDth-.js +43 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.mjs +148 -0
- package/dist/table.types.cjs +1 -0
- package/dist/table.types.d.ts +2 -0
- package/dist/table.types.d.ts.map +1 -0
- package/dist/table.types.mjs +1 -0
- package/dist/types/base-fields.d.ts +45 -45
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/common.d.ts +45 -61
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.mjs +1 -0
- package/dist/useFilter-CXFqEHyI.js +129 -0
- package/dist/useFilter-D-bCDo6Z.cjs +1 -0
- package/dist/useQuery-BScHEo7x.cjs +1 -0
- package/dist/useQuery-KpZFg80c.js +748 -0
- package/dist/utils/formatting.d.ts +4 -4
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.mjs +105 -0
- package/package.json +147 -9
- package/sdk/api/client.ts +51 -51
- package/sdk/api/datetime.ts +5 -5
- package/sdk/api/index.ts +28 -33
- package/sdk/api/metadata.ts +4 -4
- package/sdk/api.ts +24 -0
- package/sdk/api.types.ts +58 -0
- package/sdk/auth/AuthProvider.tsx +18 -18
- package/sdk/auth/authClient.ts +9 -9
- package/sdk/auth/authConfig.ts +9 -9
- package/sdk/auth/index.ts +5 -5
- package/sdk/auth/types.ts +21 -21
- package/sdk/auth/useAuth.ts +2 -2
- package/sdk/auth.ts +22 -0
- package/sdk/auth.types.ts +28 -0
- package/sdk/base-types.ts +45 -0
- package/sdk/components/hooks/index.ts +22 -22
- package/sdk/components/hooks/useFilter/index.ts +8 -14
- package/sdk/components/hooks/useFilter/types.ts +29 -58
- package/sdk/components/hooks/useFilter/useFilter.ts +41 -44
- package/sdk/components/hooks/useForm/apiClient.ts +8 -8
- package/sdk/components/hooks/useForm/expressionValidator.utils.ts +18 -18
- package/sdk/components/hooks/useForm/index.ts +24 -24
- package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +22 -22
- package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +26 -62
- package/sdk/components/hooks/useForm/schemaParser.utils.ts +24 -24
- package/sdk/components/hooks/useForm/types.ts +66 -82
- package/sdk/components/hooks/useForm/useForm.ts +15 -21
- package/sdk/components/hooks/useKanban/apiClient.ts +54 -54
- package/sdk/components/hooks/useKanban/context.ts +3 -3
- package/sdk/components/hooks/useKanban/dragDropManager.ts +19 -19
- package/sdk/components/hooks/useKanban/index.ts +26 -26
- package/sdk/components/hooks/useKanban/types.ts +69 -71
- package/sdk/components/hooks/useKanban/useKanban.ts +43 -51
- package/sdk/components/hooks/useKanban/useKanbanSimple.ts +4 -4
- package/sdk/components/hooks/useTable/index.ts +5 -1
- package/sdk/components/hooks/useTable/types.ts +10 -10
- package/sdk/components/hooks/useTable/useTable.ts +10 -10
- package/sdk/filter.ts +13 -0
- package/sdk/filter.types.ts +17 -0
- package/sdk/form.ts +15 -0
- package/sdk/form.types.ts +46 -0
- package/sdk/kanban.ts +23 -0
- package/sdk/kanban.types.ts +50 -0
- package/sdk/kanban.ui.ts +16 -0
- package/sdk/table.ts +7 -0
- package/sdk/table.types.ts +13 -0
- package/sdk/types/base-fields.ts +47 -47
- package/sdk/types/common.ts +47 -71
- package/sdk/types/index.ts +1 -1
- package/sdk/utils/formatting.ts +4 -4
- package/sdk/utils.ts +10 -0
- package/dist/index.cjs +0 -45
- package/dist/index.mjs +0 -6387
|
@@ -0,0 +1,748 @@
|
|
|
1
|
+
var Re = (t) => {
|
|
2
|
+
throw TypeError(t);
|
|
3
|
+
};
|
|
4
|
+
var oe = (t, e, s) => e.has(t) || Re("Cannot " + s);
|
|
5
|
+
var r = (t, e, s) => (oe(t, e, "read from private field"), s ? s.call(t) : e.get(t)), d = (t, e, s) => e.has(t) ? Re("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), o = (t, e, s, i) => (oe(t, e, "write to private field"), i ? i.call(t, s) : e.set(t, s), s), y = (t, e, s) => (oe(t, e, "access private method"), s);
|
|
6
|
+
import * as C from "react";
|
|
7
|
+
import "./jsx-runtime-DGlMoOmv.js";
|
|
8
|
+
var me = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
11
|
+
}
|
|
12
|
+
subscribe(t) {
|
|
13
|
+
return this.listeners.add(t), this.onSubscribe(), () => {
|
|
14
|
+
this.listeners.delete(t), this.onUnsubscribe();
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
hasListeners() {
|
|
18
|
+
return this.listeners.size > 0;
|
|
19
|
+
}
|
|
20
|
+
onSubscribe() {
|
|
21
|
+
}
|
|
22
|
+
onUnsubscribe() {
|
|
23
|
+
}
|
|
24
|
+
}, Ve = {
|
|
25
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
26
|
+
// global setTimeout etc.
|
|
27
|
+
//
|
|
28
|
+
// BAD: `setTimeout: setTimeout`
|
|
29
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
30
|
+
//
|
|
31
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
32
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
33
|
+
// have a hard reference to the original implementation at the time when this
|
|
34
|
+
// file was imported.
|
|
35
|
+
setTimeout: (t, e) => setTimeout(t, e),
|
|
36
|
+
clearTimeout: (t) => clearTimeout(t),
|
|
37
|
+
setInterval: (t, e) => setInterval(t, e),
|
|
38
|
+
clearInterval: (t) => clearInterval(t)
|
|
39
|
+
}, T, j, Pe, ze = (Pe = class {
|
|
40
|
+
constructor() {
|
|
41
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
42
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
43
|
+
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
44
|
+
//
|
|
45
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
46
|
+
// this class is unsafe internally to allow for extension.
|
|
47
|
+
d(this, T, Ve);
|
|
48
|
+
d(this, j, !1);
|
|
49
|
+
}
|
|
50
|
+
setTimeoutProvider(t) {
|
|
51
|
+
process.env.NODE_ENV !== "production" && r(this, j) && t !== r(this, T) && console.error(
|
|
52
|
+
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
53
|
+
{ previous: r(this, T), provider: t }
|
|
54
|
+
), o(this, T, t), process.env.NODE_ENV !== "production" && o(this, j, !1);
|
|
55
|
+
}
|
|
56
|
+
setTimeout(t, e) {
|
|
57
|
+
return process.env.NODE_ENV !== "production" && o(this, j, !0), r(this, T).setTimeout(t, e);
|
|
58
|
+
}
|
|
59
|
+
clearTimeout(t) {
|
|
60
|
+
r(this, T).clearTimeout(t);
|
|
61
|
+
}
|
|
62
|
+
setInterval(t, e) {
|
|
63
|
+
return process.env.NODE_ENV !== "production" && o(this, j, !0), r(this, T).setInterval(t, e);
|
|
64
|
+
}
|
|
65
|
+
clearInterval(t) {
|
|
66
|
+
r(this, T).clearInterval(t);
|
|
67
|
+
}
|
|
68
|
+
}, T = new WeakMap(), j = new WeakMap(), Pe), se = new ze();
|
|
69
|
+
function Be(t) {
|
|
70
|
+
setTimeout(t, 0);
|
|
71
|
+
}
|
|
72
|
+
var Z = typeof window > "u" || "Deno" in globalThis;
|
|
73
|
+
function ae() {
|
|
74
|
+
}
|
|
75
|
+
function Ce(t) {
|
|
76
|
+
return typeof t == "number" && t >= 0 && t !== 1 / 0;
|
|
77
|
+
}
|
|
78
|
+
function He(t, e) {
|
|
79
|
+
return Math.max(t + (e || 0) - Date.now(), 0);
|
|
80
|
+
}
|
|
81
|
+
function K(t, e) {
|
|
82
|
+
return typeof t == "function" ? t(e) : t;
|
|
83
|
+
}
|
|
84
|
+
function R(t, e) {
|
|
85
|
+
return typeof t == "function" ? t(e) : t;
|
|
86
|
+
}
|
|
87
|
+
function mt(t) {
|
|
88
|
+
return JSON.stringify(
|
|
89
|
+
t,
|
|
90
|
+
(e, s) => he(s) ? Object.keys(s).sort().reduce((i, n) => (i[n] = s[n], i), {}) : s
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
var qe = Object.prototype.hasOwnProperty;
|
|
94
|
+
function ce(t, e) {
|
|
95
|
+
if (t === e)
|
|
96
|
+
return t;
|
|
97
|
+
const s = Ie(t) && Ie(e);
|
|
98
|
+
if (!s && !(he(t) && he(e))) return e;
|
|
99
|
+
const n = (s ? t : Object.keys(t)).length, u = s ? e : Object.keys(e), h = u.length, a = s ? new Array(h) : {};
|
|
100
|
+
let v = 0;
|
|
101
|
+
for (let p = 0; p < h; p++) {
|
|
102
|
+
const g = s ? p : u[p], f = t[g], S = e[g];
|
|
103
|
+
if (f === S) {
|
|
104
|
+
a[g] = f, (s ? p < n : qe.call(t, g)) && v++;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (f === null || S === null || typeof f != "object" || typeof S != "object") {
|
|
108
|
+
a[g] = S;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const b = ce(f, S);
|
|
112
|
+
a[g] = b, b === f && v++;
|
|
113
|
+
}
|
|
114
|
+
return n === h && v === n ? t : a;
|
|
115
|
+
}
|
|
116
|
+
function ue(t, e) {
|
|
117
|
+
if (!e || Object.keys(t).length !== Object.keys(e).length)
|
|
118
|
+
return !1;
|
|
119
|
+
for (const s in t)
|
|
120
|
+
if (t[s] !== e[s])
|
|
121
|
+
return !1;
|
|
122
|
+
return !0;
|
|
123
|
+
}
|
|
124
|
+
function Ie(t) {
|
|
125
|
+
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
126
|
+
}
|
|
127
|
+
function he(t) {
|
|
128
|
+
if (!Te(t))
|
|
129
|
+
return !1;
|
|
130
|
+
const e = t.constructor;
|
|
131
|
+
if (e === void 0)
|
|
132
|
+
return !0;
|
|
133
|
+
const s = e.prototype;
|
|
134
|
+
return !(!Te(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
|
|
135
|
+
}
|
|
136
|
+
function Te(t) {
|
|
137
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
138
|
+
}
|
|
139
|
+
function Fe(t, e, s) {
|
|
140
|
+
if (typeof s.structuralSharing == "function")
|
|
141
|
+
return s.structuralSharing(t, e);
|
|
142
|
+
if (s.structuralSharing !== !1) {
|
|
143
|
+
if (process.env.NODE_ENV !== "production")
|
|
144
|
+
try {
|
|
145
|
+
return ce(t, e);
|
|
146
|
+
} catch (i) {
|
|
147
|
+
throw console.error(
|
|
148
|
+
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${i}`
|
|
149
|
+
), i;
|
|
150
|
+
}
|
|
151
|
+
return ce(t, e);
|
|
152
|
+
}
|
|
153
|
+
return e;
|
|
154
|
+
}
|
|
155
|
+
function Et(t) {
|
|
156
|
+
return t;
|
|
157
|
+
}
|
|
158
|
+
function De(t, e) {
|
|
159
|
+
return typeof t == "function" ? t(...e) : !!t;
|
|
160
|
+
}
|
|
161
|
+
var Q, M, A, je, Je = (je = class extends me {
|
|
162
|
+
constructor() {
|
|
163
|
+
super();
|
|
164
|
+
d(this, Q);
|
|
165
|
+
d(this, M);
|
|
166
|
+
d(this, A);
|
|
167
|
+
o(this, A, (e) => {
|
|
168
|
+
if (!Z && window.addEventListener) {
|
|
169
|
+
const s = () => e();
|
|
170
|
+
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
171
|
+
window.removeEventListener("visibilitychange", s);
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
onSubscribe() {
|
|
177
|
+
r(this, M) || this.setEventListener(r(this, A));
|
|
178
|
+
}
|
|
179
|
+
onUnsubscribe() {
|
|
180
|
+
var e;
|
|
181
|
+
this.hasListeners() || ((e = r(this, M)) == null || e.call(this), o(this, M, void 0));
|
|
182
|
+
}
|
|
183
|
+
setEventListener(e) {
|
|
184
|
+
var s;
|
|
185
|
+
o(this, A, e), (s = r(this, M)) == null || s.call(this), o(this, M, e((i) => {
|
|
186
|
+
typeof i == "boolean" ? this.setFocused(i) : this.onFocus();
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
setFocused(e) {
|
|
190
|
+
r(this, Q) !== e && (o(this, Q, e), this.onFocus());
|
|
191
|
+
}
|
|
192
|
+
onFocus() {
|
|
193
|
+
const e = this.isFocused();
|
|
194
|
+
this.listeners.forEach((s) => {
|
|
195
|
+
s(e);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
isFocused() {
|
|
199
|
+
var e;
|
|
200
|
+
return typeof r(this, Q) == "boolean" ? r(this, Q) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
|
|
201
|
+
}
|
|
202
|
+
}, Q = new WeakMap(), M = new WeakMap(), A = new WeakMap(), je), We = new Je();
|
|
203
|
+
function Me() {
|
|
204
|
+
let t, e;
|
|
205
|
+
const s = new Promise((n, u) => {
|
|
206
|
+
t = n, e = u;
|
|
207
|
+
});
|
|
208
|
+
s.status = "pending", s.catch(() => {
|
|
209
|
+
});
|
|
210
|
+
function i(n) {
|
|
211
|
+
Object.assign(s, n), delete s.resolve, delete s.reject;
|
|
212
|
+
}
|
|
213
|
+
return s.resolve = (n) => {
|
|
214
|
+
i({
|
|
215
|
+
status: "fulfilled",
|
|
216
|
+
value: n
|
|
217
|
+
}), t(n);
|
|
218
|
+
}, s.reject = (n) => {
|
|
219
|
+
i({
|
|
220
|
+
status: "rejected",
|
|
221
|
+
reason: n
|
|
222
|
+
}), e(n);
|
|
223
|
+
}, s;
|
|
224
|
+
}
|
|
225
|
+
var $e = Be;
|
|
226
|
+
function Ke() {
|
|
227
|
+
let t = [], e = 0, s = (a) => {
|
|
228
|
+
a();
|
|
229
|
+
}, i = (a) => {
|
|
230
|
+
a();
|
|
231
|
+
}, n = $e;
|
|
232
|
+
const u = (a) => {
|
|
233
|
+
e ? t.push(a) : n(() => {
|
|
234
|
+
s(a);
|
|
235
|
+
});
|
|
236
|
+
}, h = () => {
|
|
237
|
+
const a = t;
|
|
238
|
+
t = [], a.length && n(() => {
|
|
239
|
+
i(() => {
|
|
240
|
+
a.forEach((v) => {
|
|
241
|
+
s(v);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
return {
|
|
247
|
+
batch: (a) => {
|
|
248
|
+
let v;
|
|
249
|
+
e++;
|
|
250
|
+
try {
|
|
251
|
+
v = a();
|
|
252
|
+
} finally {
|
|
253
|
+
e--, e || h();
|
|
254
|
+
}
|
|
255
|
+
return v;
|
|
256
|
+
},
|
|
257
|
+
/**
|
|
258
|
+
* All calls to the wrapped function will be batched.
|
|
259
|
+
*/
|
|
260
|
+
batchCalls: (a) => (...v) => {
|
|
261
|
+
u(() => {
|
|
262
|
+
a(...v);
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
schedule: u,
|
|
266
|
+
/**
|
|
267
|
+
* Use this method to set a custom notify function.
|
|
268
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
269
|
+
*/
|
|
270
|
+
setNotifyFunction: (a) => {
|
|
271
|
+
s = a;
|
|
272
|
+
},
|
|
273
|
+
/**
|
|
274
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
275
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
276
|
+
*/
|
|
277
|
+
setBatchNotifyFunction: (a) => {
|
|
278
|
+
i = a;
|
|
279
|
+
},
|
|
280
|
+
setScheduler: (a) => {
|
|
281
|
+
n = a;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
var Ue = Ke(), V, N, z, Qe, Ze = (Qe = class extends me {
|
|
286
|
+
constructor() {
|
|
287
|
+
super();
|
|
288
|
+
d(this, V, !0);
|
|
289
|
+
d(this, N);
|
|
290
|
+
d(this, z);
|
|
291
|
+
o(this, z, (e) => {
|
|
292
|
+
if (!Z && window.addEventListener) {
|
|
293
|
+
const s = () => e(!0), i = () => e(!1);
|
|
294
|
+
return window.addEventListener("online", s, !1), window.addEventListener("offline", i, !1), () => {
|
|
295
|
+
window.removeEventListener("online", s), window.removeEventListener("offline", i);
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
onSubscribe() {
|
|
301
|
+
r(this, N) || this.setEventListener(r(this, z));
|
|
302
|
+
}
|
|
303
|
+
onUnsubscribe() {
|
|
304
|
+
var e;
|
|
305
|
+
this.hasListeners() || ((e = r(this, N)) == null || e.call(this), o(this, N, void 0));
|
|
306
|
+
}
|
|
307
|
+
setEventListener(e) {
|
|
308
|
+
var s;
|
|
309
|
+
o(this, z, e), (s = r(this, N)) == null || s.call(this), o(this, N, e(this.setOnline.bind(this)));
|
|
310
|
+
}
|
|
311
|
+
setOnline(e) {
|
|
312
|
+
r(this, V) !== e && (o(this, V, e), this.listeners.forEach((i) => {
|
|
313
|
+
i(e);
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
isOnline() {
|
|
317
|
+
return r(this, V);
|
|
318
|
+
}
|
|
319
|
+
}, V = new WeakMap(), N = new WeakMap(), z = new WeakMap(), Qe), Ge = new Ze();
|
|
320
|
+
function Xe(t) {
|
|
321
|
+
return (t ?? "online") === "online" ? Ge.isOnline() : !0;
|
|
322
|
+
}
|
|
323
|
+
function Ye(t, e) {
|
|
324
|
+
return {
|
|
325
|
+
fetchFailureCount: 0,
|
|
326
|
+
fetchFailureReason: null,
|
|
327
|
+
fetchStatus: Xe(e.networkMode) ? "fetching" : "paused",
|
|
328
|
+
...t === void 0 && {
|
|
329
|
+
error: null,
|
|
330
|
+
status: "pending"
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
var E, c, G, m, L, B, F, _, X, H, q, D, U, x, J, l, $, le, fe, de, pe, be, ye, ve, ke, Le, et = (Le = class extends me {
|
|
335
|
+
constructor(e, s) {
|
|
336
|
+
super();
|
|
337
|
+
d(this, l);
|
|
338
|
+
d(this, E);
|
|
339
|
+
d(this, c);
|
|
340
|
+
d(this, G);
|
|
341
|
+
d(this, m);
|
|
342
|
+
d(this, L);
|
|
343
|
+
d(this, B);
|
|
344
|
+
d(this, F);
|
|
345
|
+
d(this, _);
|
|
346
|
+
d(this, X);
|
|
347
|
+
d(this, H);
|
|
348
|
+
// This property keeps track of the last query with defined data.
|
|
349
|
+
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
350
|
+
d(this, q);
|
|
351
|
+
d(this, D);
|
|
352
|
+
d(this, U);
|
|
353
|
+
d(this, x);
|
|
354
|
+
d(this, J, /* @__PURE__ */ new Set());
|
|
355
|
+
this.options = s, o(this, E, e), o(this, _, null), o(this, F, Me()), this.bindMethods(), this.setOptions(s);
|
|
356
|
+
}
|
|
357
|
+
bindMethods() {
|
|
358
|
+
this.refetch = this.refetch.bind(this);
|
|
359
|
+
}
|
|
360
|
+
onSubscribe() {
|
|
361
|
+
this.listeners.size === 1 && (r(this, c).addObserver(this), Ne(r(this, c), this.options) ? y(this, l, $).call(this) : this.updateResult(), y(this, l, pe).call(this));
|
|
362
|
+
}
|
|
363
|
+
onUnsubscribe() {
|
|
364
|
+
this.hasListeners() || this.destroy();
|
|
365
|
+
}
|
|
366
|
+
shouldFetchOnReconnect() {
|
|
367
|
+
return ge(
|
|
368
|
+
r(this, c),
|
|
369
|
+
this.options,
|
|
370
|
+
this.options.refetchOnReconnect
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
shouldFetchOnWindowFocus() {
|
|
374
|
+
return ge(
|
|
375
|
+
r(this, c),
|
|
376
|
+
this.options,
|
|
377
|
+
this.options.refetchOnWindowFocus
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
destroy() {
|
|
381
|
+
this.listeners = /* @__PURE__ */ new Set(), y(this, l, be).call(this), y(this, l, ye).call(this), r(this, c).removeObserver(this);
|
|
382
|
+
}
|
|
383
|
+
setOptions(e) {
|
|
384
|
+
const s = this.options, i = r(this, c);
|
|
385
|
+
if (this.options = r(this, E).defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof R(this.options.enabled, r(this, c)) != "boolean")
|
|
386
|
+
throw new Error(
|
|
387
|
+
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
388
|
+
);
|
|
389
|
+
y(this, l, ve).call(this), r(this, c).setOptions(this.options), s._defaulted && !ue(this.options, s) && r(this, E).getQueryCache().notify({
|
|
390
|
+
type: "observerOptionsUpdated",
|
|
391
|
+
query: r(this, c),
|
|
392
|
+
observer: this
|
|
393
|
+
});
|
|
394
|
+
const n = this.hasListeners();
|
|
395
|
+
n && _e(
|
|
396
|
+
r(this, c),
|
|
397
|
+
i,
|
|
398
|
+
this.options,
|
|
399
|
+
s
|
|
400
|
+
) && y(this, l, $).call(this), this.updateResult(), n && (r(this, c) !== i || R(this.options.enabled, r(this, c)) !== R(s.enabled, r(this, c)) || K(this.options.staleTime, r(this, c)) !== K(s.staleTime, r(this, c))) && y(this, l, le).call(this);
|
|
401
|
+
const u = y(this, l, fe).call(this);
|
|
402
|
+
n && (r(this, c) !== i || R(this.options.enabled, r(this, c)) !== R(s.enabled, r(this, c)) || u !== r(this, x)) && y(this, l, de).call(this, u);
|
|
403
|
+
}
|
|
404
|
+
getOptimisticResult(e) {
|
|
405
|
+
const s = r(this, E).getQueryCache().build(r(this, E), e), i = this.createResult(s, e);
|
|
406
|
+
return st(this, i) && (o(this, m, i), o(this, B, this.options), o(this, L, r(this, c).state)), i;
|
|
407
|
+
}
|
|
408
|
+
getCurrentResult() {
|
|
409
|
+
return r(this, m);
|
|
410
|
+
}
|
|
411
|
+
trackResult(e, s) {
|
|
412
|
+
return new Proxy(e, {
|
|
413
|
+
get: (i, n) => (this.trackProp(n), s == null || s(n), n === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && r(this, F).status === "pending" && r(this, F).reject(
|
|
414
|
+
new Error(
|
|
415
|
+
"experimental_prefetchInRender feature flag is not enabled"
|
|
416
|
+
)
|
|
417
|
+
)), Reflect.get(i, n))
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
trackProp(e) {
|
|
421
|
+
r(this, J).add(e);
|
|
422
|
+
}
|
|
423
|
+
getCurrentQuery() {
|
|
424
|
+
return r(this, c);
|
|
425
|
+
}
|
|
426
|
+
refetch({ ...e } = {}) {
|
|
427
|
+
return this.fetch({
|
|
428
|
+
...e
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
fetchOptimistic(e) {
|
|
432
|
+
const s = r(this, E).defaultQueryOptions(e), i = r(this, E).getQueryCache().build(r(this, E), s);
|
|
433
|
+
return i.fetch().then(() => this.createResult(i, s));
|
|
434
|
+
}
|
|
435
|
+
fetch(e) {
|
|
436
|
+
return y(this, l, $).call(this, {
|
|
437
|
+
...e,
|
|
438
|
+
cancelRefetch: e.cancelRefetch ?? !0
|
|
439
|
+
}).then(() => (this.updateResult(), r(this, m)));
|
|
440
|
+
}
|
|
441
|
+
createResult(e, s) {
|
|
442
|
+
var Oe;
|
|
443
|
+
const i = r(this, c), n = this.options, u = r(this, m), h = r(this, L), a = r(this, B), p = e !== i ? e.state : r(this, G), { state: g } = e;
|
|
444
|
+
let f = { ...g }, S = !1, b;
|
|
445
|
+
if (s._optimisticResults) {
|
|
446
|
+
const O = this.hasListeners(), ee = !O && Ne(e, s), k = O && _e(e, i, s, n);
|
|
447
|
+
(ee || k) && (f = {
|
|
448
|
+
...f,
|
|
449
|
+
...Ye(g.data, e.options)
|
|
450
|
+
}), s._optimisticResults === "isRestoring" && (f.fetchStatus = "idle");
|
|
451
|
+
}
|
|
452
|
+
let { error: P, errorUpdatedAt: W, status: w } = f;
|
|
453
|
+
b = f.data;
|
|
454
|
+
let Y = !1;
|
|
455
|
+
if (s.placeholderData !== void 0 && b === void 0 && w === "pending") {
|
|
456
|
+
let O;
|
|
457
|
+
u != null && u.isPlaceholderData && s.placeholderData === (a == null ? void 0 : a.placeholderData) ? (O = u.data, Y = !0) : O = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
458
|
+
(Oe = r(this, q)) == null ? void 0 : Oe.state.data,
|
|
459
|
+
r(this, q)
|
|
460
|
+
) : s.placeholderData, O !== void 0 && (w = "success", b = Fe(
|
|
461
|
+
u == null ? void 0 : u.data,
|
|
462
|
+
O,
|
|
463
|
+
s
|
|
464
|
+
), S = !0);
|
|
465
|
+
}
|
|
466
|
+
if (s.select && b !== void 0 && !Y)
|
|
467
|
+
if (u && b === (h == null ? void 0 : h.data) && s.select === r(this, X))
|
|
468
|
+
b = r(this, H);
|
|
469
|
+
else
|
|
470
|
+
try {
|
|
471
|
+
o(this, X, s.select), b = s.select(b), b = Fe(u == null ? void 0 : u.data, b, s), o(this, H, b), o(this, _, null);
|
|
472
|
+
} catch (O) {
|
|
473
|
+
o(this, _, O);
|
|
474
|
+
}
|
|
475
|
+
r(this, _) && (P = r(this, _), b = r(this, H), W = Date.now(), w = "error");
|
|
476
|
+
const re = f.fetchStatus === "fetching", ie = w === "pending", ne = w === "error", Se = ie && re, we = b !== void 0, I = {
|
|
477
|
+
status: w,
|
|
478
|
+
fetchStatus: f.fetchStatus,
|
|
479
|
+
isPending: ie,
|
|
480
|
+
isSuccess: w === "success",
|
|
481
|
+
isError: ne,
|
|
482
|
+
isInitialLoading: Se,
|
|
483
|
+
isLoading: Se,
|
|
484
|
+
data: b,
|
|
485
|
+
dataUpdatedAt: f.dataUpdatedAt,
|
|
486
|
+
error: P,
|
|
487
|
+
errorUpdatedAt: W,
|
|
488
|
+
failureCount: f.fetchFailureCount,
|
|
489
|
+
failureReason: f.fetchFailureReason,
|
|
490
|
+
errorUpdateCount: f.errorUpdateCount,
|
|
491
|
+
isFetched: f.dataUpdateCount > 0 || f.errorUpdateCount > 0,
|
|
492
|
+
isFetchedAfterMount: f.dataUpdateCount > p.dataUpdateCount || f.errorUpdateCount > p.errorUpdateCount,
|
|
493
|
+
isFetching: re,
|
|
494
|
+
isRefetching: re && !ie,
|
|
495
|
+
isLoadingError: ne && !we,
|
|
496
|
+
isPaused: f.fetchStatus === "paused",
|
|
497
|
+
isPlaceholderData: S,
|
|
498
|
+
isRefetchError: ne && we,
|
|
499
|
+
isStale: Ee(e, s),
|
|
500
|
+
refetch: this.refetch,
|
|
501
|
+
promise: r(this, F),
|
|
502
|
+
isEnabled: R(s.enabled, e) !== !1
|
|
503
|
+
};
|
|
504
|
+
if (this.options.experimental_prefetchInRender) {
|
|
505
|
+
const O = (te) => {
|
|
506
|
+
I.status === "error" ? te.reject(I.error) : I.data !== void 0 && te.resolve(I.data);
|
|
507
|
+
}, ee = () => {
|
|
508
|
+
const te = o(this, F, I.promise = Me());
|
|
509
|
+
O(te);
|
|
510
|
+
}, k = r(this, F);
|
|
511
|
+
switch (k.status) {
|
|
512
|
+
case "pending":
|
|
513
|
+
e.queryHash === i.queryHash && O(k);
|
|
514
|
+
break;
|
|
515
|
+
case "fulfilled":
|
|
516
|
+
(I.status === "error" || I.data !== k.value) && ee();
|
|
517
|
+
break;
|
|
518
|
+
case "rejected":
|
|
519
|
+
(I.status !== "error" || I.error !== k.reason) && ee();
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return I;
|
|
524
|
+
}
|
|
525
|
+
updateResult() {
|
|
526
|
+
const e = r(this, m), s = this.createResult(r(this, c), this.options);
|
|
527
|
+
if (o(this, L, r(this, c).state), o(this, B, this.options), r(this, L).data !== void 0 && o(this, q, r(this, c)), ue(s, e))
|
|
528
|
+
return;
|
|
529
|
+
o(this, m, s);
|
|
530
|
+
const i = () => {
|
|
531
|
+
if (!e)
|
|
532
|
+
return !0;
|
|
533
|
+
const { notifyOnChangeProps: n } = this.options, u = typeof n == "function" ? n() : n;
|
|
534
|
+
if (u === "all" || !u && !r(this, J).size)
|
|
535
|
+
return !0;
|
|
536
|
+
const h = new Set(
|
|
537
|
+
u ?? r(this, J)
|
|
538
|
+
);
|
|
539
|
+
return this.options.throwOnError && h.add("error"), Object.keys(r(this, m)).some((a) => {
|
|
540
|
+
const v = a;
|
|
541
|
+
return r(this, m)[v] !== e[v] && h.has(v);
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
y(this, l, ke).call(this, { listeners: i() });
|
|
545
|
+
}
|
|
546
|
+
onQueryUpdate() {
|
|
547
|
+
this.updateResult(), this.hasListeners() && y(this, l, pe).call(this);
|
|
548
|
+
}
|
|
549
|
+
}, E = new WeakMap(), c = new WeakMap(), G = new WeakMap(), m = new WeakMap(), L = new WeakMap(), B = new WeakMap(), F = new WeakMap(), _ = new WeakMap(), X = new WeakMap(), H = new WeakMap(), q = new WeakMap(), D = new WeakMap(), U = new WeakMap(), x = new WeakMap(), J = new WeakMap(), l = new WeakSet(), $ = function(e) {
|
|
550
|
+
y(this, l, ve).call(this);
|
|
551
|
+
let s = r(this, c).fetch(
|
|
552
|
+
this.options,
|
|
553
|
+
e
|
|
554
|
+
);
|
|
555
|
+
return e != null && e.throwOnError || (s = s.catch(ae)), s;
|
|
556
|
+
}, le = function() {
|
|
557
|
+
y(this, l, be).call(this);
|
|
558
|
+
const e = K(
|
|
559
|
+
this.options.staleTime,
|
|
560
|
+
r(this, c)
|
|
561
|
+
);
|
|
562
|
+
if (Z || r(this, m).isStale || !Ce(e))
|
|
563
|
+
return;
|
|
564
|
+
const i = He(r(this, m).dataUpdatedAt, e) + 1;
|
|
565
|
+
o(this, D, se.setTimeout(() => {
|
|
566
|
+
r(this, m).isStale || this.updateResult();
|
|
567
|
+
}, i));
|
|
568
|
+
}, fe = function() {
|
|
569
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(r(this, c)) : this.options.refetchInterval) ?? !1;
|
|
570
|
+
}, de = function(e) {
|
|
571
|
+
y(this, l, ye).call(this), o(this, x, e), !(Z || R(this.options.enabled, r(this, c)) === !1 || !Ce(r(this, x)) || r(this, x) === 0) && o(this, U, se.setInterval(() => {
|
|
572
|
+
(this.options.refetchIntervalInBackground || We.isFocused()) && y(this, l, $).call(this);
|
|
573
|
+
}, r(this, x)));
|
|
574
|
+
}, pe = function() {
|
|
575
|
+
y(this, l, le).call(this), y(this, l, de).call(this, y(this, l, fe).call(this));
|
|
576
|
+
}, be = function() {
|
|
577
|
+
r(this, D) && (se.clearTimeout(r(this, D)), o(this, D, void 0));
|
|
578
|
+
}, ye = function() {
|
|
579
|
+
r(this, U) && (se.clearInterval(r(this, U)), o(this, U, void 0));
|
|
580
|
+
}, ve = function() {
|
|
581
|
+
const e = r(this, E).getQueryCache().build(r(this, E), this.options);
|
|
582
|
+
if (e === r(this, c))
|
|
583
|
+
return;
|
|
584
|
+
const s = r(this, c);
|
|
585
|
+
o(this, c, e), o(this, G, e.state), this.hasListeners() && (s == null || s.removeObserver(this), e.addObserver(this));
|
|
586
|
+
}, ke = function(e) {
|
|
587
|
+
Ue.batch(() => {
|
|
588
|
+
e.listeners && this.listeners.forEach((s) => {
|
|
589
|
+
s(r(this, m));
|
|
590
|
+
}), r(this, E).getQueryCache().notify({
|
|
591
|
+
query: r(this, c),
|
|
592
|
+
type: "observerResultsUpdated"
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
}, Le);
|
|
596
|
+
function tt(t, e) {
|
|
597
|
+
return R(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
|
|
598
|
+
}
|
|
599
|
+
function Ne(t, e) {
|
|
600
|
+
return tt(t, e) || t.state.data !== void 0 && ge(t, e, e.refetchOnMount);
|
|
601
|
+
}
|
|
602
|
+
function ge(t, e, s) {
|
|
603
|
+
if (R(e.enabled, t) !== !1 && K(e.staleTime, t) !== "static") {
|
|
604
|
+
const i = typeof s == "function" ? s(t) : s;
|
|
605
|
+
return i === "always" || i !== !1 && Ee(t, e);
|
|
606
|
+
}
|
|
607
|
+
return !1;
|
|
608
|
+
}
|
|
609
|
+
function _e(t, e, s, i) {
|
|
610
|
+
return (t !== e || R(i.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && Ee(t, s);
|
|
611
|
+
}
|
|
612
|
+
function Ee(t, e) {
|
|
613
|
+
return R(e.enabled, t) !== !1 && t.isStaleByTime(K(e.staleTime, t));
|
|
614
|
+
}
|
|
615
|
+
function st(t, e) {
|
|
616
|
+
return !ue(t.getCurrentResult(), e);
|
|
617
|
+
}
|
|
618
|
+
var rt = C.createContext(
|
|
619
|
+
void 0
|
|
620
|
+
), it = (t) => {
|
|
621
|
+
const e = C.useContext(rt);
|
|
622
|
+
if (!e)
|
|
623
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
624
|
+
return e;
|
|
625
|
+
}, Ae = C.createContext(!1), nt = () => C.useContext(Ae);
|
|
626
|
+
Ae.Provider;
|
|
627
|
+
function ot() {
|
|
628
|
+
let t = !1;
|
|
629
|
+
return {
|
|
630
|
+
clearReset: () => {
|
|
631
|
+
t = !1;
|
|
632
|
+
},
|
|
633
|
+
reset: () => {
|
|
634
|
+
t = !0;
|
|
635
|
+
},
|
|
636
|
+
isReset: () => t
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
var at = C.createContext(ot()), ct = () => C.useContext(at), ut = (t, e, s) => {
|
|
640
|
+
const i = s != null && s.state.error && typeof t.throwOnError == "function" ? De(t.throwOnError, [s.state.error, s]) : t.throwOnError;
|
|
641
|
+
(t.suspense || t.experimental_prefetchInRender || i) && (e.isReset() || (t.retryOnMount = !1));
|
|
642
|
+
}, ht = (t) => {
|
|
643
|
+
C.useEffect(() => {
|
|
644
|
+
t.clearReset();
|
|
645
|
+
}, [t]);
|
|
646
|
+
}, lt = ({
|
|
647
|
+
result: t,
|
|
648
|
+
errorResetBoundary: e,
|
|
649
|
+
throwOnError: s,
|
|
650
|
+
query: i,
|
|
651
|
+
suspense: n
|
|
652
|
+
}) => t.isError && !e.isReset() && !t.isFetching && i && (n && t.data === void 0 || De(s, [t.error, i])), ft = (t) => {
|
|
653
|
+
if (t.suspense) {
|
|
654
|
+
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), i = t.staleTime;
|
|
655
|
+
t.staleTime = typeof i == "function" ? (...n) => s(i(...n)) : s(i), typeof t.gcTime == "number" && (t.gcTime = Math.max(
|
|
656
|
+
t.gcTime,
|
|
657
|
+
1e3
|
|
658
|
+
));
|
|
659
|
+
}
|
|
660
|
+
}, dt = (t, e) => t.isLoading && t.isFetching && !e, pt = (t, e) => (t == null ? void 0 : t.suspense) && e.isPending, xe = (t, e, s) => e.fetchOptimistic(t).catch(() => {
|
|
661
|
+
s.clearReset();
|
|
662
|
+
});
|
|
663
|
+
function bt(t, e, s) {
|
|
664
|
+
var S, b, P, W;
|
|
665
|
+
if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
|
|
666
|
+
throw new Error(
|
|
667
|
+
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
668
|
+
);
|
|
669
|
+
const i = nt(), n = ct(), u = it(), h = u.defaultQueryOptions(t);
|
|
670
|
+
(b = (S = u.getDefaultOptions().queries) == null ? void 0 : S._experimental_beforeQuery) == null || b.call(
|
|
671
|
+
S,
|
|
672
|
+
h
|
|
673
|
+
);
|
|
674
|
+
const a = u.getQueryCache().get(h.queryHash);
|
|
675
|
+
process.env.NODE_ENV !== "production" && (h.queryFn || console.error(
|
|
676
|
+
`[${h.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
677
|
+
)), h._optimisticResults = i ? "isRestoring" : "optimistic", ft(h), ut(h, n, a), ht(n);
|
|
678
|
+
const v = !u.getQueryCache().get(h.queryHash), [p] = C.useState(
|
|
679
|
+
() => new e(
|
|
680
|
+
u,
|
|
681
|
+
h
|
|
682
|
+
)
|
|
683
|
+
), g = p.getOptimisticResult(h), f = !i && t.subscribed !== !1;
|
|
684
|
+
if (C.useSyncExternalStore(
|
|
685
|
+
C.useCallback(
|
|
686
|
+
(w) => {
|
|
687
|
+
const Y = f ? p.subscribe(Ue.batchCalls(w)) : ae;
|
|
688
|
+
return p.updateResult(), Y;
|
|
689
|
+
},
|
|
690
|
+
[p, f]
|
|
691
|
+
),
|
|
692
|
+
() => p.getCurrentResult(),
|
|
693
|
+
() => p.getCurrentResult()
|
|
694
|
+
), C.useEffect(() => {
|
|
695
|
+
p.setOptions(h);
|
|
696
|
+
}, [h, p]), pt(h, g))
|
|
697
|
+
throw xe(h, p, n);
|
|
698
|
+
if (lt({
|
|
699
|
+
result: g,
|
|
700
|
+
errorResetBoundary: n,
|
|
701
|
+
throwOnError: h.throwOnError,
|
|
702
|
+
query: a,
|
|
703
|
+
suspense: h.suspense
|
|
704
|
+
}))
|
|
705
|
+
throw g.error;
|
|
706
|
+
if ((W = (P = u.getDefaultOptions().queries) == null ? void 0 : P._experimental_afterQuery) == null || W.call(
|
|
707
|
+
P,
|
|
708
|
+
h,
|
|
709
|
+
g
|
|
710
|
+
), h.experimental_prefetchInRender && !Z && dt(g, i)) {
|
|
711
|
+
const w = v ? (
|
|
712
|
+
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
713
|
+
xe(h, p, n)
|
|
714
|
+
) : (
|
|
715
|
+
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
716
|
+
a == null ? void 0 : a.promise
|
|
717
|
+
);
|
|
718
|
+
w == null || w.catch(ae).finally(() => {
|
|
719
|
+
p.updateResult();
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
return h.notifyOnChangeProps ? g : p.trackResult(g);
|
|
723
|
+
}
|
|
724
|
+
function St(t, e) {
|
|
725
|
+
return bt(t, et);
|
|
726
|
+
}
|
|
727
|
+
export {
|
|
728
|
+
et as Q,
|
|
729
|
+
me as S,
|
|
730
|
+
it as a,
|
|
731
|
+
nt as b,
|
|
732
|
+
ct as c,
|
|
733
|
+
ut as d,
|
|
734
|
+
ft as e,
|
|
735
|
+
ht as f,
|
|
736
|
+
ae as g,
|
|
737
|
+
mt as h,
|
|
738
|
+
pt as i,
|
|
739
|
+
xe as j,
|
|
740
|
+
lt as k,
|
|
741
|
+
De as l,
|
|
742
|
+
Et as m,
|
|
743
|
+
Ue as n,
|
|
744
|
+
ce as r,
|
|
745
|
+
ue as s,
|
|
746
|
+
St as u,
|
|
747
|
+
dt as w
|
|
748
|
+
};
|