zudoku 0.0.0-z6e949a6d → 0.0.0-z8ac421f0
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/app/main.js +1 -1
- package/dist/app/main.js.map +1 -1
- package/dist/config/create-plugin.d.ts +2 -0
- package/dist/config/create-plugin.js +55 -0
- package/dist/config/create-plugin.js.map +1 -0
- package/dist/config/loader.js +2 -2
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.d.ts +67 -67
- package/dist/config/validators/NavigationSchema.js +1 -0
- package/dist/config/validators/NavigationSchema.js.map +1 -1
- package/dist/config/validators/validate.d.ts +5 -4
- package/dist/config/validators/validate.js +2 -0
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/components/Bootstrap.js +1 -2
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/Slot.test.js +1 -1
- package/dist/lib/components/Slot.test.js.map +1 -1
- package/dist/lib/components/Zudoku.d.ts +4 -1
- package/dist/lib/components/Zudoku.js +4 -7
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +2 -4
- package/dist/lib/components/context/ZudokuContext.js +2 -2
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/context/ZudokuProvider.js +1 -1
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
- package/dist/lib/components/context/ZudokuReactContext.d.ts +11 -0
- package/dist/lib/components/context/ZudokuReactContext.js +4 -0
- package/dist/lib/components/context/ZudokuReactContext.js.map +1 -0
- package/dist/lib/core/ZudokuContext.d.ts +2 -1
- package/dist/lib/core/ZudokuContext.js +3 -1
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/core/__internal.d.ts +1 -0
- package/dist/lib/core/__internal.js +2 -0
- package/dist/lib/core/__internal.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +5 -1
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/core/transform-config.d.ts +4 -2
- package/dist/lib/core/transform-config.js +33 -13
- package/dist/lib/core/transform-config.js.map +1 -1
- package/dist/lib/core/transform-config.test.d.ts +1 -0
- package/dist/lib/core/transform-config.test.js +83 -0
- package/dist/lib/core/transform-config.test.js.map +1 -0
- package/dist/lib/errors/ErrorAlert.js +1 -2
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/hooks/useEvent.test.js +1 -1
- package/dist/lib/hooks/useEvent.test.js.map +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.js +8 -5
- package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +2 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/ui/Alert.d.ts +3 -2
- package/dist/lib/ui/Alert.js +9 -5
- package/dist/lib/ui/Alert.js.map +1 -1
- package/dist/lib/ui/Secret.js +2 -2
- package/dist/lib/ui/Secret.js.map +1 -1
- package/dist/lib/util/flattenAllOf.js +6 -0
- package/dist/lib/util/flattenAllOf.js.map +1 -1
- package/dist/lib/util/flattenAllOf.test.js +26 -0
- package/dist/lib/util/flattenAllOf.test.js.map +1 -1
- package/dist/vite/config.js +5 -2
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-config.js +16 -4
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-theme.js +2 -1
- package/dist/vite/plugin-theme.js.map +1 -1
- package/dist/vite/prerender/prerender.js +3 -1
- package/dist/vite/prerender/prerender.js.map +1 -1
- package/dist/vite/prerender/worker.js +3 -1
- package/dist/vite/prerender/worker.js.map +1 -1
- package/lib/{ClaudeLogo-OpUSMQJe.js → ClaudeLogo-Br8C_vTq.js} +3 -3
- package/lib/{ClaudeLogo-OpUSMQJe.js.map → ClaudeLogo-Br8C_vTq.js.map} +1 -1
- package/lib/Drawer-Ch7927PF.js.map +1 -1
- package/lib/{HydrationBoundary-CNF2ZV3E.js → HydrationBoundary-CJu4vUlG.js} +6 -6
- package/lib/{HydrationBoundary-CNF2ZV3E.js.map → HydrationBoundary-CJu4vUlG.js.map} +1 -1
- package/lib/{MdxPage-dzCPGdvD.js → MdxPage-C0QFAsgv.js} +6 -6
- package/lib/{MdxPage-dzCPGdvD.js.map → MdxPage-C0QFAsgv.js.map} +1 -1
- package/lib/Mermaid-Chx5BPHn.js +104 -0
- package/lib/Mermaid-Chx5BPHn.js.map +1 -0
- package/lib/{OAuthErrorPage-D7n-_cqN.js → OAuthErrorPage-CFz_gBFx.js} +11 -10
- package/lib/{OAuthErrorPage-D7n-_cqN.js.map → OAuthErrorPage-CFz_gBFx.js.map} +1 -1
- package/lib/{OasProvider-DPPdikt_.js → OasProvider-BwIOIlky.js} +3 -3
- package/lib/{OasProvider-DPPdikt_.js.map → OasProvider-BwIOIlky.js.map} +1 -1
- package/lib/OperationList-DYRzbPJu.js +5908 -0
- package/lib/OperationList-DYRzbPJu.js.map +1 -0
- package/lib/{RouteGuard-BMbu_Yb7.js → RouteGuard-CVs3yvEs.js} +3 -3
- package/lib/{RouteGuard-BMbu_Yb7.js.map → RouteGuard-CVs3yvEs.js.map} +1 -1
- package/lib/{SchemaList-CRC8n5co.js → SchemaList-D4FEyoDV.js} +7 -7
- package/lib/{SchemaList-CRC8n5co.js.map → SchemaList-D4FEyoDV.js.map} +1 -1
- package/lib/{SchemaView-BR6dtnPg.js → SchemaView-ScvkhsYE.js} +116 -110
- package/lib/SchemaView-ScvkhsYE.js.map +1 -0
- package/lib/{Secret-BDBqq4p3.js → Secret-DUpgv4V3.js} +92 -72
- package/lib/Secret-DUpgv4V3.js.map +1 -0
- package/lib/{SignUp-ChqXj9vd.js → SignUp-Dug1jAGC.js} +4 -4
- package/lib/{SignUp-ChqXj9vd.js.map → SignUp-Dug1jAGC.js.map} +1 -1
- package/lib/{SyntaxHighlight-O-IZOPLg.js → SyntaxHighlight-BMu0b_hF.js} +8 -8
- package/lib/{SyntaxHighlight-O-IZOPLg.js.map → SyntaxHighlight-BMu0b_hF.js.map} +1 -1
- package/lib/{Toc-DQF7trHT.js → Toc-BiJ2YL0O.js} +2 -2
- package/lib/{Toc-DQF7trHT.js.map → Toc-BiJ2YL0O.js.map} +1 -1
- package/lib/{Zudoku-DA1yA-te.js → Zudoku-iyiXgWFY.js} +2101 -2121
- package/lib/Zudoku-iyiXgWFY.js.map +1 -0
- package/lib/ZudokuContext-CYyb_PB_.js +175 -0
- package/lib/ZudokuContext-CYyb_PB_.js.map +1 -0
- package/lib/ZudokuReactContext-DGJAP1sN.js +222 -0
- package/lib/ZudokuReactContext-DGJAP1sN.js.map +1 -0
- package/lib/chunk-EPOLDU6W-C6C8jAwd.js.map +1 -1
- package/lib/{circular-C4l1Kj1N.js → circular-BOpxmAie.js} +2 -2
- package/lib/{circular-C4l1Kj1N.js.map → circular-BOpxmAie.js.map} +1 -1
- package/lib/{createServer-DoRZ6tMa.js → createServer-BunbJzB5.js} +6 -4
- package/lib/{createServer-DoRZ6tMa.js.map → createServer-BunbJzB5.js.map} +1 -1
- package/lib/{errors-CYLN8SNc.js → errors-B77S9iOc.js} +2 -2
- package/lib/{errors-CYLN8SNc.js.map → errors-B77S9iOc.js.map} +1 -1
- package/lib/{firebase-DF-VVKB7.js → firebase-C7XKRGLf.js} +25 -24
- package/lib/{firebase-DF-VVKB7.js.map → firebase-C7XKRGLf.js.map} +1 -1
- package/lib/{hook-C35h0YhF.js → hook-Dz_n9SoE.js} +16 -15
- package/lib/{hook-C35h0YhF.js.map → hook-Dz_n9SoE.js.map} +1 -1
- package/lib/{index-DrAVvbXa.js → index-BDp2MTiq.js} +2 -2
- package/lib/{index-DrAVvbXa.js.map → index-BDp2MTiq.js.map} +1 -1
- package/lib/{index-Ck4TmzTO.js → index-Bx29qHVi.js} +52 -50
- package/lib/{index-Ck4TmzTO.js.map → index-Bx29qHVi.js.map} +1 -1
- package/lib/index-CrcNWbel.js.map +1 -1
- package/lib/index-DAWHN3cH.js.map +1 -1
- package/lib/index.esm-BYObtETB.js.map +1 -1
- package/lib/index.esm-Ca5zvoff.js.map +1 -1
- package/lib/{index.esm-B2cLXwjS.js → index.esm-Cth49JBv.js} +2 -2
- package/lib/index.esm-Cth49JBv.js.map +1 -0
- package/lib/jsx-runtime-BzflLqGi.js.map +1 -1
- package/lib/{mutation-BISOc7OM.js → mutation-B7eFBLZY.js} +2 -2
- package/lib/{mutation-BISOc7OM.js.map → mutation-B7eFBLZY.js.map} +1 -1
- package/lib/ui/Alert.js +32 -20
- package/lib/ui/Alert.js.map +1 -1
- package/lib/ui/Carousel.js.map +1 -1
- package/lib/ui/Secret.js +2 -2
- package/lib/ui/Secret.js.map +1 -1
- package/lib/ui/SyntaxHighlight.js +2 -2
- package/lib/useExposedProps-CzTDfXfq.js.map +1 -1
- package/lib/{useMutation-CFMGlAMW.js → useMutation-CErliDZ9.js} +5 -5
- package/lib/{useMutation-CFMGlAMW.js.map → useMutation-CErliDZ9.js.map} +1 -1
- package/lib/{useSuspenseQuery-CSB_rVek.js → useQuery-ht7aWJ3S.js} +432 -446
- package/lib/useQuery-ht7aWJ3S.js.map +1 -0
- package/lib/useSuspenseQuery-DQH4Bmc2.js +18 -0
- package/lib/useSuspenseQuery-DQH4Bmc2.js.map +1 -0
- package/lib/zudoku.__internal.js +520 -496
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +6 -5
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-azureb2c.js +14 -13
- package/lib/zudoku.auth-azureb2c.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-firebase.js +4 -4
- package/lib/zudoku.auth-openid.js +7 -6
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.auth-supabase.js +4 -4
- package/lib/zudoku.components.js +3 -3
- package/lib/zudoku.hooks.js +3 -3
- package/lib/zudoku.mermaid.js +3 -3
- package/lib/zudoku.plugin-api-catalog.js +28 -27
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +98 -96
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/lib/zudoku.plugin-search-pagefind.js +19 -18
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js.map +1 -1
- package/lib/zudoku.react-query.js +26 -25
- package/lib/zudoku.react-query.js.map +1 -1
- package/lib/zudoku.router.js.map +1 -1
- package/package.json +13 -7
- package/src/app/defaultTheme.css +4 -0
- package/src/app/main.css +2 -0
- package/src/app/main.tsx +1 -1
- package/src/lib/components/Bootstrap.tsx +1 -4
- package/src/lib/components/Slot.test.tsx +1 -1
- package/src/lib/components/Zudoku.tsx +18 -14
- package/src/lib/components/context/ZudokuContext.ts +2 -6
- package/src/lib/components/context/ZudokuProvider.tsx +1 -1
- package/src/lib/components/context/ZudokuReactContext.tsx +17 -0
- package/src/lib/core/ZudokuContext.ts +7 -1
- package/src/lib/core/__internal.tsx +2 -0
- package/src/lib/core/plugins.ts +7 -3
- package/src/lib/core/transform-config.test.tsx +99 -0
- package/src/lib/core/transform-config.ts +57 -19
- package/src/lib/errors/ErrorAlert.tsx +1 -6
- package/src/lib/hooks/useEvent.test.tsx +1 -1
- package/src/lib/plugins/openapi/ParamInfos.tsx +10 -5
- package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +2 -0
- package/src/lib/ui/Alert.tsx +17 -5
- package/src/lib/ui/Secret.tsx +2 -2
- package/src/lib/util/flattenAllOf.test.ts +32 -0
- package/src/lib/util/flattenAllOf.ts +7 -0
- package/lib/Mermaid-JEnWyK0s.js +0 -103
- package/lib/Mermaid-JEnWyK0s.js.map +0 -1
- package/lib/OperationList-cEveQ_l5.js +0 -5822
- package/lib/OperationList-cEveQ_l5.js.map +0 -1
- package/lib/SchemaView-BR6dtnPg.js.map +0 -1
- package/lib/Secret-BDBqq4p3.js.map +0 -1
- package/lib/Zudoku-DA1yA-te.js.map +0 -1
- package/lib/ZudokuContext-C6wlLMUH.js +0 -389
- package/lib/ZudokuContext-C6wlLMUH.js.map +0 -1
- package/lib/index.esm-B2cLXwjS.js.map +0 -1
- package/lib/useSuspenseQuery-CSB_rVek.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as p from "react";
|
|
2
|
-
import { j as
|
|
2
|
+
import { j as tt } from "./jsx-runtime-BzflLqGi.js";
|
|
3
3
|
var H = class {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
6
6
|
}
|
|
7
|
-
subscribe(
|
|
8
|
-
return this.listeners.add(
|
|
9
|
-
this.listeners.delete(
|
|
7
|
+
subscribe(t) {
|
|
8
|
+
return this.listeners.add(t), this.onSubscribe(), () => {
|
|
9
|
+
this.listeners.delete(t), this.onUnsubscribe();
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
hasListeners() {
|
|
@@ -16,7 +16,7 @@ var H = class {
|
|
|
16
16
|
}
|
|
17
17
|
onUnsubscribe() {
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, ht = {
|
|
20
20
|
// We need the wrapper function syntax below instead of direct references to
|
|
21
21
|
// global setTimeout etc.
|
|
22
22
|
//
|
|
@@ -27,60 +27,60 @@ var H = class {
|
|
|
27
27
|
// replace the global setTimeout (like tests) won't work since we'll already
|
|
28
28
|
// have a hard reference to the original implementation at the time when this
|
|
29
29
|
// file was imported.
|
|
30
|
-
setTimeout: (
|
|
31
|
-
clearTimeout: (
|
|
32
|
-
setInterval: (
|
|
33
|
-
clearInterval: (
|
|
34
|
-
},
|
|
30
|
+
setTimeout: (t, e) => setTimeout(t, e),
|
|
31
|
+
clearTimeout: (t) => clearTimeout(t),
|
|
32
|
+
setInterval: (t, e) => setInterval(t, e),
|
|
33
|
+
clearInterval: (t) => clearInterval(t)
|
|
34
|
+
}, lt = class {
|
|
35
35
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
36
36
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
37
37
|
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
38
38
|
//
|
|
39
39
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
40
40
|
// this class is unsafe internally to allow for extension.
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
setTimeoutProvider(
|
|
44
|
-
process.env.NODE_ENV !== "production" && this.#
|
|
41
|
+
#e = ht;
|
|
42
|
+
#t = !1;
|
|
43
|
+
setTimeoutProvider(t) {
|
|
44
|
+
process.env.NODE_ENV !== "production" && this.#t && t !== this.#e && console.error(
|
|
45
45
|
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
46
|
-
{ previous: this.#
|
|
47
|
-
), this.#
|
|
46
|
+
{ previous: this.#e, provider: t }
|
|
47
|
+
), this.#e = t, process.env.NODE_ENV !== "production" && (this.#t = !1);
|
|
48
48
|
}
|
|
49
|
-
setTimeout(
|
|
50
|
-
return process.env.NODE_ENV !== "production" && (this.#
|
|
49
|
+
setTimeout(t, e) {
|
|
50
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(t, e);
|
|
51
51
|
}
|
|
52
|
-
clearTimeout(
|
|
53
|
-
this.#
|
|
52
|
+
clearTimeout(t) {
|
|
53
|
+
this.#e.clearTimeout(t);
|
|
54
54
|
}
|
|
55
|
-
setInterval(
|
|
56
|
-
return process.env.NODE_ENV !== "production" && (this.#
|
|
55
|
+
setInterval(t, e) {
|
|
56
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(t, e);
|
|
57
57
|
}
|
|
58
|
-
clearInterval(
|
|
59
|
-
this.#
|
|
58
|
+
clearInterval(t) {
|
|
59
|
+
this.#e.clearInterval(t);
|
|
60
60
|
}
|
|
61
|
-
}, w = new
|
|
62
|
-
function
|
|
63
|
-
setTimeout(
|
|
61
|
+
}, w = new lt();
|
|
62
|
+
function ft(t) {
|
|
63
|
+
setTimeout(t, 0);
|
|
64
64
|
}
|
|
65
65
|
var E = typeof window > "u" || "Deno" in globalThis;
|
|
66
66
|
function C() {
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
return typeof
|
|
68
|
+
function _t(t, e) {
|
|
69
|
+
return typeof t == "function" ? t(e) : t;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
return typeof
|
|
71
|
+
function Q(t) {
|
|
72
|
+
return typeof t == "number" && t >= 0 && t !== 1 / 0;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return Math.max(
|
|
74
|
+
function et(t, e) {
|
|
75
|
+
return Math.max(t + (e || 0) - Date.now(), 0);
|
|
76
76
|
}
|
|
77
|
-
function I(
|
|
78
|
-
return typeof
|
|
77
|
+
function I(t, e) {
|
|
78
|
+
return typeof t == "function" ? t(e) : t;
|
|
79
79
|
}
|
|
80
|
-
function v(
|
|
81
|
-
return typeof
|
|
80
|
+
function v(t, e) {
|
|
81
|
+
return typeof t == "function" ? t(e) : t;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Lt(t, e) {
|
|
84
84
|
const {
|
|
85
85
|
type: s = "all",
|
|
86
86
|
exact: r,
|
|
@@ -88,175 +88,175 @@ function Ke(e, t) {
|
|
|
88
88
|
predicate: u,
|
|
89
89
|
queryKey: a,
|
|
90
90
|
stale: i
|
|
91
|
-
} =
|
|
91
|
+
} = t;
|
|
92
92
|
if (a) {
|
|
93
93
|
if (r) {
|
|
94
|
-
if (
|
|
94
|
+
if (e.queryHash !== dt(a, e.options))
|
|
95
95
|
return !1;
|
|
96
|
-
} else if (!V(
|
|
96
|
+
} else if (!V(e.queryKey, a))
|
|
97
97
|
return !1;
|
|
98
98
|
}
|
|
99
99
|
if (s !== "all") {
|
|
100
|
-
const o =
|
|
100
|
+
const o = e.isActive();
|
|
101
101
|
if (s === "active" && !o || s === "inactive" && o)
|
|
102
102
|
return !1;
|
|
103
103
|
}
|
|
104
|
-
return !(typeof i == "boolean" &&
|
|
104
|
+
return !(typeof i == "boolean" && e.isStale() !== i || n && n !== e.state.fetchStatus || u && !u(e));
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const { exact: s, status: r, predicate: n, mutationKey: u } =
|
|
106
|
+
function Kt(t, e) {
|
|
107
|
+
const { exact: s, status: r, predicate: n, mutationKey: u } = t;
|
|
108
108
|
if (u) {
|
|
109
|
-
if (!
|
|
109
|
+
if (!e.options.mutationKey)
|
|
110
110
|
return !1;
|
|
111
111
|
if (s) {
|
|
112
|
-
if (
|
|
112
|
+
if (j(e.options.mutationKey) !== j(u))
|
|
113
113
|
return !1;
|
|
114
|
-
} else if (!V(
|
|
114
|
+
} else if (!V(e.options.mutationKey, u))
|
|
115
115
|
return !1;
|
|
116
116
|
}
|
|
117
|
-
return !(r &&
|
|
117
|
+
return !(r && e.state.status !== r || n && !n(e));
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
return (
|
|
119
|
+
function dt(t, e) {
|
|
120
|
+
return (e?.queryKeyHashFn || j)(t);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function j(t) {
|
|
123
123
|
return JSON.stringify(
|
|
124
|
-
|
|
125
|
-
(
|
|
124
|
+
t,
|
|
125
|
+
(e, s) => A(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
|
-
function V(
|
|
129
|
-
return
|
|
128
|
+
function V(t, e) {
|
|
129
|
+
return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? Object.keys(e).every((s) => V(t[s], e[s])) : !1;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
132
|
-
function
|
|
133
|
-
if (
|
|
134
|
-
return
|
|
135
|
-
const s = z(
|
|
136
|
-
if (!s && !(A(
|
|
137
|
-
const n = (s ?
|
|
131
|
+
var pt = Object.prototype.hasOwnProperty;
|
|
132
|
+
function q(t, e) {
|
|
133
|
+
if (t === e)
|
|
134
|
+
return t;
|
|
135
|
+
const s = z(t) && z(e);
|
|
136
|
+
if (!s && !(A(t) && A(e))) return e;
|
|
137
|
+
const n = (s ? t : Object.keys(t)).length, u = s ? e : Object.keys(e), a = u.length, i = s ? new Array(a) : {};
|
|
138
138
|
let o = 0;
|
|
139
139
|
for (let l = 0; l < a; l++) {
|
|
140
|
-
const c = s ? l : u[l], d =
|
|
140
|
+
const c = s ? l : u[l], d = t[c], h = e[c];
|
|
141
141
|
if (d === h) {
|
|
142
|
-
i[c] = d, (s ? l < n :
|
|
142
|
+
i[c] = d, (s ? l < n : pt.call(t, c)) && o++;
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
145
|
if (d === null || h === null || typeof d != "object" || typeof h != "object") {
|
|
146
146
|
i[c] = h;
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
|
-
const R =
|
|
149
|
+
const R = q(d, h);
|
|
150
150
|
i[c] = R, R === d && o++;
|
|
151
151
|
}
|
|
152
|
-
return n === a && o === n ?
|
|
152
|
+
return n === a && o === n ? t : i;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
if (!
|
|
154
|
+
function N(t, e) {
|
|
155
|
+
if (!e || Object.keys(t).length !== Object.keys(e).length)
|
|
156
156
|
return !1;
|
|
157
|
-
for (const s in
|
|
158
|
-
if (
|
|
157
|
+
for (const s in t)
|
|
158
|
+
if (t[s] !== e[s])
|
|
159
159
|
return !1;
|
|
160
160
|
return !0;
|
|
161
161
|
}
|
|
162
|
-
function z(
|
|
163
|
-
return Array.isArray(
|
|
162
|
+
function z(t) {
|
|
163
|
+
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
164
164
|
}
|
|
165
|
-
function A(
|
|
166
|
-
if (!$(
|
|
165
|
+
function A(t) {
|
|
166
|
+
if (!$(t))
|
|
167
167
|
return !1;
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
168
|
+
const e = t.constructor;
|
|
169
|
+
if (e === void 0)
|
|
170
170
|
return !0;
|
|
171
|
-
const s =
|
|
172
|
-
return !(!$(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(
|
|
171
|
+
const s = e.prototype;
|
|
172
|
+
return !(!$(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
|
|
173
173
|
}
|
|
174
|
-
function $(
|
|
175
|
-
return Object.prototype.toString.call(
|
|
174
|
+
function $(t) {
|
|
175
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
return new Promise((
|
|
179
|
-
w.setTimeout(
|
|
177
|
+
function yt(t) {
|
|
178
|
+
return new Promise((e) => {
|
|
179
|
+
w.setTimeout(e, t);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function k(t, e, s) {
|
|
183
183
|
if (typeof s.structuralSharing == "function")
|
|
184
|
-
return s.structuralSharing(
|
|
184
|
+
return s.structuralSharing(t, e);
|
|
185
185
|
if (s.structuralSharing !== !1) {
|
|
186
186
|
if (process.env.NODE_ENV !== "production")
|
|
187
187
|
try {
|
|
188
|
-
return
|
|
188
|
+
return q(t, e);
|
|
189
189
|
} catch (r) {
|
|
190
190
|
throw console.error(
|
|
191
191
|
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
|
|
192
192
|
), r;
|
|
193
193
|
}
|
|
194
|
-
return
|
|
194
|
+
return q(t, e);
|
|
195
195
|
}
|
|
196
|
-
return t;
|
|
197
|
-
}
|
|
198
|
-
function Ve(e) {
|
|
199
196
|
return e;
|
|
200
197
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
198
|
+
function Ht(t) {
|
|
199
|
+
return t;
|
|
200
|
+
}
|
|
201
|
+
function Vt(t, e, s = 0) {
|
|
202
|
+
const r = [...t, e];
|
|
203
203
|
return s && r.length > s ? r.slice(1) : r;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const r = [
|
|
205
|
+
function Bt(t, e, s = 0) {
|
|
206
|
+
const r = [e, ...t];
|
|
207
207
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
208
208
|
}
|
|
209
|
-
var
|
|
210
|
-
function
|
|
211
|
-
return process.env.NODE_ENV !== "production" &&
|
|
212
|
-
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${
|
|
213
|
-
), !
|
|
209
|
+
var _ = Symbol();
|
|
210
|
+
function vt(t, e) {
|
|
211
|
+
return process.env.NODE_ENV !== "production" && t.queryFn === _ && console.error(
|
|
212
|
+
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
|
|
213
|
+
), !t.queryFn && e?.initialPromise ? () => e.initialPromise : !t.queryFn || t.queryFn === _ ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return typeof
|
|
215
|
+
function mt(t, e) {
|
|
216
|
+
return typeof t == "function" ? t(...e) : !!t;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
219
|
-
#t;
|
|
218
|
+
var bt = class extends H {
|
|
220
219
|
#e;
|
|
220
|
+
#t;
|
|
221
221
|
#s;
|
|
222
222
|
constructor() {
|
|
223
|
-
super(), this.#s = (
|
|
223
|
+
super(), this.#s = (t) => {
|
|
224
224
|
if (!E && window.addEventListener) {
|
|
225
|
-
const
|
|
226
|
-
return window.addEventListener("visibilitychange",
|
|
227
|
-
window.removeEventListener("visibilitychange",
|
|
225
|
+
const e = () => t();
|
|
226
|
+
return window.addEventListener("visibilitychange", e, !1), () => {
|
|
227
|
+
window.removeEventListener("visibilitychange", e);
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
232
|
onSubscribe() {
|
|
233
|
-
this.#
|
|
233
|
+
this.#t || this.setEventListener(this.#s);
|
|
234
234
|
}
|
|
235
235
|
onUnsubscribe() {
|
|
236
|
-
this.hasListeners() || (this.#
|
|
236
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
237
237
|
}
|
|
238
|
-
setEventListener(
|
|
239
|
-
this.#s =
|
|
240
|
-
typeof
|
|
238
|
+
setEventListener(t) {
|
|
239
|
+
this.#s = t, this.#t?.(), this.#t = t((e) => {
|
|
240
|
+
typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
|
-
setFocused(
|
|
244
|
-
this.#
|
|
243
|
+
setFocused(t) {
|
|
244
|
+
this.#e !== t && (this.#e = t, this.onFocus());
|
|
245
245
|
}
|
|
246
246
|
onFocus() {
|
|
247
|
-
const
|
|
248
|
-
this.listeners.forEach((
|
|
249
|
-
t
|
|
247
|
+
const t = this.isFocused();
|
|
248
|
+
this.listeners.forEach((e) => {
|
|
249
|
+
e(t);
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
isFocused() {
|
|
253
|
-
return typeof this.#
|
|
253
|
+
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
254
254
|
}
|
|
255
|
-
},
|
|
255
|
+
}, st = new bt();
|
|
256
256
|
function L() {
|
|
257
|
-
let
|
|
257
|
+
let t, e;
|
|
258
258
|
const s = new Promise((n, u) => {
|
|
259
|
-
|
|
259
|
+
t = n, e = u;
|
|
260
260
|
});
|
|
261
261
|
s.status = "pending", s.catch(() => {
|
|
262
262
|
});
|
|
@@ -267,33 +267,33 @@ function L() {
|
|
|
267
267
|
r({
|
|
268
268
|
status: "fulfilled",
|
|
269
269
|
value: n
|
|
270
|
-
}),
|
|
270
|
+
}), t(n);
|
|
271
271
|
}, s.reject = (n) => {
|
|
272
272
|
r({
|
|
273
273
|
status: "rejected",
|
|
274
274
|
reason: n
|
|
275
|
-
}),
|
|
275
|
+
}), e(n);
|
|
276
276
|
}, s;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
let
|
|
280
|
-
if (
|
|
281
|
-
return { data:
|
|
278
|
+
function Gt(t) {
|
|
279
|
+
let e;
|
|
280
|
+
if (t.then((s) => (e = s, s), C)?.catch(C), e !== void 0)
|
|
281
|
+
return { data: e };
|
|
282
282
|
}
|
|
283
|
-
var
|
|
284
|
-
function
|
|
285
|
-
let
|
|
283
|
+
var gt = ft;
|
|
284
|
+
function St() {
|
|
285
|
+
let t = [], e = 0, s = (i) => {
|
|
286
286
|
i();
|
|
287
287
|
}, r = (i) => {
|
|
288
288
|
i();
|
|
289
|
-
}, n =
|
|
289
|
+
}, n = gt;
|
|
290
290
|
const u = (i) => {
|
|
291
|
-
|
|
291
|
+
e ? t.push(i) : n(() => {
|
|
292
292
|
s(i);
|
|
293
293
|
});
|
|
294
294
|
}, a = () => {
|
|
295
|
-
const i =
|
|
296
|
-
|
|
295
|
+
const i = t;
|
|
296
|
+
t = [], i.length && n(() => {
|
|
297
297
|
r(() => {
|
|
298
298
|
i.forEach((o) => {
|
|
299
299
|
s(o);
|
|
@@ -304,11 +304,11 @@ function Oe() {
|
|
|
304
304
|
return {
|
|
305
305
|
batch: (i) => {
|
|
306
306
|
let o;
|
|
307
|
-
|
|
307
|
+
e++;
|
|
308
308
|
try {
|
|
309
309
|
o = i();
|
|
310
310
|
} finally {
|
|
311
|
-
|
|
311
|
+
e--, e || a();
|
|
312
312
|
}
|
|
313
313
|
return o;
|
|
314
314
|
},
|
|
@@ -340,93 +340,93 @@ function Oe() {
|
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
|
-
var B =
|
|
344
|
-
#
|
|
345
|
-
#
|
|
343
|
+
var B = St(), Rt = class extends H {
|
|
344
|
+
#e = !0;
|
|
345
|
+
#t;
|
|
346
346
|
#s;
|
|
347
347
|
constructor() {
|
|
348
|
-
super(), this.#s = (
|
|
348
|
+
super(), this.#s = (t) => {
|
|
349
349
|
if (!E && window.addEventListener) {
|
|
350
|
-
const
|
|
351
|
-
return window.addEventListener("online",
|
|
352
|
-
window.removeEventListener("online",
|
|
350
|
+
const e = () => t(!0), s = () => t(!1);
|
|
351
|
+
return window.addEventListener("online", e, !1), window.addEventListener("offline", s, !1), () => {
|
|
352
|
+
window.removeEventListener("online", e), window.removeEventListener("offline", s);
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
357
|
onSubscribe() {
|
|
358
|
-
this.#
|
|
358
|
+
this.#t || this.setEventListener(this.#s);
|
|
359
359
|
}
|
|
360
360
|
onUnsubscribe() {
|
|
361
|
-
this.hasListeners() || (this.#
|
|
361
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
362
362
|
}
|
|
363
|
-
setEventListener(
|
|
364
|
-
this.#s =
|
|
363
|
+
setEventListener(t) {
|
|
364
|
+
this.#s = t, this.#t?.(), this.#t = t(this.setOnline.bind(this));
|
|
365
365
|
}
|
|
366
|
-
setOnline(
|
|
367
|
-
this.#
|
|
368
|
-
s(
|
|
366
|
+
setOnline(t) {
|
|
367
|
+
this.#e !== t && (this.#e = t, this.listeners.forEach((s) => {
|
|
368
|
+
s(t);
|
|
369
369
|
}));
|
|
370
370
|
}
|
|
371
371
|
isOnline() {
|
|
372
|
-
return this.#
|
|
372
|
+
return this.#e;
|
|
373
373
|
}
|
|
374
|
-
},
|
|
375
|
-
function
|
|
376
|
-
return Math.min(1e3 * 2 **
|
|
374
|
+
}, rt = new Rt();
|
|
375
|
+
function Ot(t) {
|
|
376
|
+
return Math.min(1e3 * 2 ** t, 3e4);
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
return (
|
|
378
|
+
function it(t) {
|
|
379
|
+
return (t ?? "online") === "online" ? rt.isOnline() : !0;
|
|
380
380
|
}
|
|
381
|
-
var
|
|
382
|
-
constructor(
|
|
383
|
-
super("CancelledError"), this.revert =
|
|
381
|
+
var U = class extends Error {
|
|
382
|
+
constructor(t) {
|
|
383
|
+
super("CancelledError"), this.revert = t?.revert, this.silent = t?.silent;
|
|
384
384
|
}
|
|
385
385
|
};
|
|
386
|
-
function
|
|
387
|
-
return
|
|
386
|
+
function zt(t) {
|
|
387
|
+
return t instanceof U;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
let
|
|
389
|
+
function wt(t) {
|
|
390
|
+
let e = !1, s = 0, r;
|
|
391
391
|
const n = L(), u = () => n.status !== "pending", a = (f) => {
|
|
392
392
|
if (!u()) {
|
|
393
|
-
const g = new
|
|
394
|
-
h(g),
|
|
393
|
+
const g = new U(f);
|
|
394
|
+
h(g), t.onCancel?.(g);
|
|
395
395
|
}
|
|
396
396
|
}, i = () => {
|
|
397
|
-
|
|
397
|
+
e = !0;
|
|
398
398
|
}, o = () => {
|
|
399
|
-
|
|
400
|
-
}, l = () =>
|
|
399
|
+
e = !1;
|
|
400
|
+
}, l = () => st.isFocused() && (t.networkMode === "always" || rt.isOnline()) && t.canRun(), c = () => it(t.networkMode) && t.canRun(), d = (f) => {
|
|
401
401
|
u() || (r?.(), n.resolve(f));
|
|
402
402
|
}, h = (f) => {
|
|
403
403
|
u() || (r?.(), n.reject(f));
|
|
404
404
|
}, R = () => new Promise((f) => {
|
|
405
405
|
r = (g) => {
|
|
406
406
|
(u() || l()) && f(g);
|
|
407
|
-
},
|
|
407
|
+
}, t.onPause?.();
|
|
408
408
|
}).then(() => {
|
|
409
|
-
r = void 0, u() ||
|
|
409
|
+
r = void 0, u() || t.onContinue?.();
|
|
410
410
|
}), F = () => {
|
|
411
411
|
if (u())
|
|
412
412
|
return;
|
|
413
413
|
let f;
|
|
414
|
-
const g = s === 0 ?
|
|
414
|
+
const g = s === 0 ? t.initialPromise : void 0;
|
|
415
415
|
try {
|
|
416
|
-
f = g ??
|
|
416
|
+
f = g ?? t.fn();
|
|
417
417
|
} catch (m) {
|
|
418
418
|
f = Promise.reject(m);
|
|
419
419
|
}
|
|
420
420
|
Promise.resolve(f).then(d).catch((m) => {
|
|
421
421
|
if (u())
|
|
422
422
|
return;
|
|
423
|
-
const S =
|
|
424
|
-
if (
|
|
423
|
+
const S = t.retry ?? (E ? 0 : 3), O = t.retryDelay ?? Ot, P = typeof O == "function" ? O(s, m) : O, D = S === !0 || typeof S == "number" && s < S || typeof S == "function" && S(s, m);
|
|
424
|
+
if (e || !D) {
|
|
425
425
|
h(m);
|
|
426
426
|
return;
|
|
427
427
|
}
|
|
428
|
-
s++,
|
|
429
|
-
|
|
428
|
+
s++, t.onFail?.(s, m), yt(P).then(() => l() ? void 0 : R()).then(() => {
|
|
429
|
+
e ? h(m) : F();
|
|
430
430
|
});
|
|
431
431
|
});
|
|
432
432
|
};
|
|
@@ -441,35 +441,35 @@ function Ce(e) {
|
|
|
441
441
|
start: () => (c() ? F() : R().then(F), n)
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
|
-
var
|
|
445
|
-
#
|
|
444
|
+
var Et = class {
|
|
445
|
+
#e;
|
|
446
446
|
destroy() {
|
|
447
447
|
this.clearGcTimeout();
|
|
448
448
|
}
|
|
449
449
|
scheduleGc() {
|
|
450
|
-
this.clearGcTimeout(),
|
|
450
|
+
this.clearGcTimeout(), Q(this.gcTime) && (this.#e = w.setTimeout(() => {
|
|
451
451
|
this.optionalRemove();
|
|
452
452
|
}, this.gcTime));
|
|
453
453
|
}
|
|
454
|
-
updateGcTime(
|
|
454
|
+
updateGcTime(t) {
|
|
455
455
|
this.gcTime = Math.max(
|
|
456
456
|
this.gcTime || 0,
|
|
457
|
-
|
|
457
|
+
t ?? (E ? 1 / 0 : 300 * 1e3)
|
|
458
458
|
);
|
|
459
459
|
}
|
|
460
460
|
clearGcTimeout() {
|
|
461
|
-
this.#
|
|
461
|
+
this.#e && (w.clearTimeout(this.#e), this.#e = void 0);
|
|
462
462
|
}
|
|
463
|
-
},
|
|
464
|
-
#t;
|
|
463
|
+
}, $t = class extends Et {
|
|
465
464
|
#e;
|
|
465
|
+
#t;
|
|
466
466
|
#s;
|
|
467
467
|
#i;
|
|
468
468
|
#r;
|
|
469
469
|
#o;
|
|
470
470
|
#a;
|
|
471
|
-
constructor(
|
|
472
|
-
super(), this.#a = !1, this.#o =
|
|
471
|
+
constructor(t) {
|
|
472
|
+
super(), this.#a = !1, this.#o = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.#i = t.client, this.#s = this.#i.getQueryCache(), this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#e = W(this.options), this.state = t.state ?? this.#e, this.scheduleGc();
|
|
473
473
|
}
|
|
474
474
|
get meta() {
|
|
475
475
|
return this.options.meta;
|
|
@@ -477,71 +477,71 @@ var Fe = class {
|
|
|
477
477
|
get promise() {
|
|
478
478
|
return this.#r?.promise;
|
|
479
479
|
}
|
|
480
|
-
setOptions(
|
|
481
|
-
if (this.options = { ...this.#o, ...
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
J(
|
|
485
|
-
), this.#
|
|
480
|
+
setOptions(t) {
|
|
481
|
+
if (this.options = { ...this.#o, ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
482
|
+
const e = W(this.options);
|
|
483
|
+
e.data !== void 0 && (this.setState(
|
|
484
|
+
J(e.data, e.dataUpdatedAt)
|
|
485
|
+
), this.#e = e);
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
optionalRemove() {
|
|
489
489
|
!this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
|
|
490
490
|
}
|
|
491
|
-
setData(
|
|
492
|
-
const s =
|
|
491
|
+
setData(t, e) {
|
|
492
|
+
const s = k(this.state.data, t, this.options);
|
|
493
493
|
return this.#n({
|
|
494
494
|
data: s,
|
|
495
495
|
type: "success",
|
|
496
|
-
dataUpdatedAt:
|
|
497
|
-
manual:
|
|
496
|
+
dataUpdatedAt: e?.updatedAt,
|
|
497
|
+
manual: e?.manual
|
|
498
498
|
}), s;
|
|
499
499
|
}
|
|
500
|
-
setState(
|
|
501
|
-
this.#n({ type: "setState", state:
|
|
500
|
+
setState(t, e) {
|
|
501
|
+
this.#n({ type: "setState", state: t, setStateOptions: e });
|
|
502
502
|
}
|
|
503
|
-
cancel(
|
|
504
|
-
const
|
|
505
|
-
return this.#r?.cancel(
|
|
503
|
+
cancel(t) {
|
|
504
|
+
const e = this.#r?.promise;
|
|
505
|
+
return this.#r?.cancel(t), e ? e.then(C).catch(C) : Promise.resolve();
|
|
506
506
|
}
|
|
507
507
|
destroy() {
|
|
508
508
|
super.destroy(), this.cancel({ silent: !0 });
|
|
509
509
|
}
|
|
510
510
|
reset() {
|
|
511
|
-
this.destroy(), this.setState(this.#
|
|
511
|
+
this.destroy(), this.setState(this.#e);
|
|
512
512
|
}
|
|
513
513
|
isActive() {
|
|
514
514
|
return this.observers.some(
|
|
515
|
-
(
|
|
515
|
+
(t) => v(t.options.enabled, this) !== !1
|
|
516
516
|
);
|
|
517
517
|
}
|
|
518
518
|
isDisabled() {
|
|
519
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
519
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === _ || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
520
520
|
}
|
|
521
521
|
isStatic() {
|
|
522
522
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
523
|
-
(
|
|
523
|
+
(t) => I(t.options.staleTime, this) === "static"
|
|
524
524
|
) : !1;
|
|
525
525
|
}
|
|
526
526
|
isStale() {
|
|
527
527
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
528
|
-
(
|
|
528
|
+
(t) => t.getCurrentResult().isStale
|
|
529
529
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
530
530
|
}
|
|
531
|
-
isStaleByTime(
|
|
532
|
-
return this.state.data === void 0 ? !0 :
|
|
531
|
+
isStaleByTime(t = 0) {
|
|
532
|
+
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !et(this.state.dataUpdatedAt, t);
|
|
533
533
|
}
|
|
534
534
|
onFocus() {
|
|
535
|
-
this.observers.find((
|
|
535
|
+
this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
|
|
536
536
|
}
|
|
537
537
|
onOnline() {
|
|
538
|
-
this.observers.find((
|
|
538
|
+
this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
|
|
539
539
|
}
|
|
540
|
-
addObserver(
|
|
541
|
-
this.observers.includes(
|
|
540
|
+
addObserver(t) {
|
|
541
|
+
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.#s.notify({ type: "observerAdded", query: this, observer: t }));
|
|
542
542
|
}
|
|
543
|
-
removeObserver(
|
|
544
|
-
this.observers.includes(
|
|
543
|
+
removeObserver(t) {
|
|
544
|
+
this.observers.includes(t) && (this.observers = this.observers.filter((e) => e !== t), this.observers.length || (this.#r && (this.#a ? this.#r.cancel({ revert: !0 }) : this.#r.cancelRetry()), this.scheduleGc()), this.#s.notify({ type: "observerRemoved", query: this, observer: t }));
|
|
545
545
|
}
|
|
546
546
|
getObserversCount() {
|
|
547
547
|
return this.observers.length;
|
|
@@ -549,17 +549,17 @@ var Fe = class {
|
|
|
549
549
|
invalidate() {
|
|
550
550
|
this.state.isInvalidated || this.#n({ type: "invalidate" });
|
|
551
551
|
}
|
|
552
|
-
async fetch(
|
|
552
|
+
async fetch(t, e) {
|
|
553
553
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
554
554
|
// re-start the fetch; there is a chance that the query is still in a
|
|
555
555
|
// pending state when that happens
|
|
556
556
|
this.#r?.status() !== "rejected") {
|
|
557
|
-
if (this.state.data !== void 0 &&
|
|
557
|
+
if (this.state.data !== void 0 && e?.cancelRefetch)
|
|
558
558
|
this.cancel({ silent: !0 });
|
|
559
559
|
else if (this.#r)
|
|
560
560
|
return this.#r.continueRetry(), this.#r.promise;
|
|
561
561
|
}
|
|
562
|
-
if (
|
|
562
|
+
if (t && this.setOptions(t), !this.options.queryFn) {
|
|
563
563
|
const i = this.observers.find((o) => o.options.queryFn);
|
|
564
564
|
i && this.setOptions(i.options);
|
|
565
565
|
}
|
|
@@ -572,7 +572,7 @@ var Fe = class {
|
|
|
572
572
|
get: () => (this.#a = !0, s.signal)
|
|
573
573
|
});
|
|
574
574
|
}, n = () => {
|
|
575
|
-
const i =
|
|
575
|
+
const i = vt(this.options, e), l = (() => {
|
|
576
576
|
const c = {
|
|
577
577
|
client: this.#i,
|
|
578
578
|
queryKey: this.queryKey,
|
|
@@ -587,7 +587,7 @@ var Fe = class {
|
|
|
587
587
|
) : i(l);
|
|
588
588
|
}, a = (() => {
|
|
589
589
|
const i = {
|
|
590
|
-
fetchOptions:
|
|
590
|
+
fetchOptions: e,
|
|
591
591
|
options: this.options,
|
|
592
592
|
queryKey: this.queryKey,
|
|
593
593
|
client: this.#i,
|
|
@@ -596,12 +596,12 @@ var Fe = class {
|
|
|
596
596
|
};
|
|
597
597
|
return r(i), i;
|
|
598
598
|
})();
|
|
599
|
-
this.options.behavior?.onFetch(a, this), this.#
|
|
600
|
-
initialPromise:
|
|
599
|
+
this.options.behavior?.onFetch(a, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#n({ type: "fetch", meta: a.fetchOptions?.meta }), this.#r = wt({
|
|
600
|
+
initialPromise: e?.initialPromise,
|
|
601
601
|
fn: a.fetchFn,
|
|
602
602
|
onCancel: (i) => {
|
|
603
|
-
i instanceof
|
|
604
|
-
...this.#
|
|
603
|
+
i instanceof U && i.revert && this.setState({
|
|
604
|
+
...this.#t,
|
|
605
605
|
fetchStatus: "idle"
|
|
606
606
|
}), s.abort();
|
|
607
607
|
},
|
|
@@ -631,7 +631,7 @@ var Fe = class {
|
|
|
631
631
|
this
|
|
632
632
|
), i;
|
|
633
633
|
} catch (i) {
|
|
634
|
-
if (i instanceof
|
|
634
|
+
if (i instanceof U) {
|
|
635
635
|
if (i.silent)
|
|
636
636
|
return this.#r.promise;
|
|
637
637
|
if (i.revert) {
|
|
@@ -655,14 +655,14 @@ var Fe = class {
|
|
|
655
655
|
this.scheduleGc();
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
#n(
|
|
659
|
-
const
|
|
660
|
-
switch (
|
|
658
|
+
#n(t) {
|
|
659
|
+
const e = (s) => {
|
|
660
|
+
switch (t.type) {
|
|
661
661
|
case "failed":
|
|
662
662
|
return {
|
|
663
663
|
...s,
|
|
664
|
-
fetchFailureCount:
|
|
665
|
-
fetchFailureReason:
|
|
664
|
+
fetchFailureCount: t.failureCount,
|
|
665
|
+
fetchFailureReason: t.error
|
|
666
666
|
};
|
|
667
667
|
case "pause":
|
|
668
668
|
return {
|
|
@@ -677,23 +677,23 @@ var Fe = class {
|
|
|
677
677
|
case "fetch":
|
|
678
678
|
return {
|
|
679
679
|
...s,
|
|
680
|
-
...
|
|
681
|
-
fetchMeta:
|
|
680
|
+
...nt(s.data, this.options),
|
|
681
|
+
fetchMeta: t.meta ?? null
|
|
682
682
|
};
|
|
683
683
|
case "success":
|
|
684
684
|
const r = {
|
|
685
685
|
...s,
|
|
686
|
-
...J(
|
|
686
|
+
...J(t.data, t.dataUpdatedAt),
|
|
687
687
|
dataUpdateCount: s.dataUpdateCount + 1,
|
|
688
|
-
...!
|
|
688
|
+
...!t.manual && {
|
|
689
689
|
fetchStatus: "idle",
|
|
690
690
|
fetchFailureCount: 0,
|
|
691
691
|
fetchFailureReason: null
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
|
-
return this.#
|
|
694
|
+
return this.#t = t.manual ? r : void 0, r;
|
|
695
695
|
case "error":
|
|
696
|
-
const n =
|
|
696
|
+
const n = t.error;
|
|
697
697
|
return {
|
|
698
698
|
...s,
|
|
699
699
|
error: n,
|
|
@@ -712,41 +712,41 @@ var Fe = class {
|
|
|
712
712
|
case "setState":
|
|
713
713
|
return {
|
|
714
714
|
...s,
|
|
715
|
-
...
|
|
715
|
+
...t.state
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
718
|
};
|
|
719
|
-
this.state =
|
|
719
|
+
this.state = e(this.state), B.batch(() => {
|
|
720
720
|
this.observers.forEach((s) => {
|
|
721
721
|
s.onQueryUpdate();
|
|
722
|
-
}), this.#s.notify({ query: this, type: "updated", action:
|
|
722
|
+
}), this.#s.notify({ query: this, type: "updated", action: t });
|
|
723
723
|
});
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
|
-
function
|
|
726
|
+
function nt(t, e) {
|
|
727
727
|
return {
|
|
728
728
|
fetchFailureCount: 0,
|
|
729
729
|
fetchFailureReason: null,
|
|
730
|
-
fetchStatus:
|
|
731
|
-
...
|
|
730
|
+
fetchStatus: it(e.networkMode) ? "fetching" : "paused",
|
|
731
|
+
...t === void 0 && {
|
|
732
732
|
error: null,
|
|
733
733
|
status: "pending"
|
|
734
734
|
}
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
|
-
function J(
|
|
737
|
+
function J(t, e) {
|
|
738
738
|
return {
|
|
739
|
-
data:
|
|
740
|
-
dataUpdatedAt:
|
|
739
|
+
data: t,
|
|
740
|
+
dataUpdatedAt: e ?? Date.now(),
|
|
741
741
|
error: null,
|
|
742
742
|
isInvalidated: !1,
|
|
743
743
|
status: "success"
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
|
-
function W(
|
|
747
|
-
const
|
|
746
|
+
function W(t) {
|
|
747
|
+
const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, r = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
|
|
748
748
|
return {
|
|
749
|
-
data:
|
|
749
|
+
data: e,
|
|
750
750
|
dataUpdateCount: 0,
|
|
751
751
|
dataUpdatedAt: s ? r ?? Date.now() : 0,
|
|
752
752
|
error: null,
|
|
@@ -760,12 +760,12 @@ function W(e) {
|
|
|
760
760
|
fetchStatus: "idle"
|
|
761
761
|
};
|
|
762
762
|
}
|
|
763
|
-
var
|
|
764
|
-
constructor(
|
|
765
|
-
super(), this.options =
|
|
763
|
+
var Ct = class extends H {
|
|
764
|
+
constructor(t, e) {
|
|
765
|
+
super(), this.options = e, this.#e = t, this.#n = null, this.#a = L(), this.bindMethods(), this.setOptions(e);
|
|
766
766
|
}
|
|
767
|
-
#
|
|
768
|
-
#
|
|
767
|
+
#e;
|
|
768
|
+
#t = void 0;
|
|
769
769
|
#s = void 0;
|
|
770
770
|
#i = void 0;
|
|
771
771
|
#r;
|
|
@@ -785,113 +785,113 @@ var ae = class extends H {
|
|
|
785
785
|
this.refetch = this.refetch.bind(this);
|
|
786
786
|
}
|
|
787
787
|
onSubscribe() {
|
|
788
|
-
this.listeners.size === 1 && (this.#
|
|
788
|
+
this.listeners.size === 1 && (this.#t.addObserver(this), Z(this.#t, this.options) ? this.#l() : this.updateResult(), this.#g());
|
|
789
789
|
}
|
|
790
790
|
onUnsubscribe() {
|
|
791
791
|
this.hasListeners() || this.destroy();
|
|
792
792
|
}
|
|
793
793
|
shouldFetchOnReconnect() {
|
|
794
794
|
return K(
|
|
795
|
-
this.#
|
|
795
|
+
this.#t,
|
|
796
796
|
this.options,
|
|
797
797
|
this.options.refetchOnReconnect
|
|
798
798
|
);
|
|
799
799
|
}
|
|
800
800
|
shouldFetchOnWindowFocus() {
|
|
801
801
|
return K(
|
|
802
|
-
this.#
|
|
802
|
+
this.#t,
|
|
803
803
|
this.options,
|
|
804
804
|
this.options.refetchOnWindowFocus
|
|
805
805
|
);
|
|
806
806
|
}
|
|
807
807
|
destroy() {
|
|
808
|
-
this.listeners = /* @__PURE__ */ new Set(), this.#S(), this.#R(), this.#
|
|
808
|
+
this.listeners = /* @__PURE__ */ new Set(), this.#S(), this.#R(), this.#t.removeObserver(this);
|
|
809
809
|
}
|
|
810
|
-
setOptions(
|
|
811
|
-
const
|
|
812
|
-
if (this.options = this.#
|
|
810
|
+
setOptions(t) {
|
|
811
|
+
const e = this.options, s = this.#t;
|
|
812
|
+
if (this.options = this.#e.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof v(this.options.enabled, this.#t) != "boolean")
|
|
813
813
|
throw new Error(
|
|
814
814
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
815
815
|
);
|
|
816
|
-
this.#O(), this.#
|
|
816
|
+
this.#O(), this.#t.setOptions(this.options), e._defaulted && !N(this.options, e) && this.#e.getQueryCache().notify({
|
|
817
817
|
type: "observerOptionsUpdated",
|
|
818
|
-
query: this.#
|
|
818
|
+
query: this.#t,
|
|
819
819
|
observer: this
|
|
820
820
|
});
|
|
821
821
|
const r = this.hasListeners();
|
|
822
822
|
r && X(
|
|
823
|
-
this.#
|
|
823
|
+
this.#t,
|
|
824
824
|
s,
|
|
825
825
|
this.options,
|
|
826
|
-
|
|
827
|
-
) && this.#l(), this.updateResult(), r && (this.#
|
|
826
|
+
e
|
|
827
|
+
) && this.#l(), this.updateResult(), r && (this.#t !== s || v(this.options.enabled, this.#t) !== v(e.enabled, this.#t) || I(this.options.staleTime, this.#t) !== I(e.staleTime, this.#t)) && this.#v();
|
|
828
828
|
const n = this.#m();
|
|
829
|
-
r && (this.#
|
|
829
|
+
r && (this.#t !== s || v(this.options.enabled, this.#t) !== v(e.enabled, this.#t) || n !== this.#u) && this.#b(n);
|
|
830
830
|
}
|
|
831
|
-
getOptimisticResult(
|
|
832
|
-
const
|
|
833
|
-
return
|
|
831
|
+
getOptimisticResult(t) {
|
|
832
|
+
const e = this.#e.getQueryCache().build(this.#e, t), s = this.createResult(e, t);
|
|
833
|
+
return Tt(this, s) && (this.#i = s, this.#o = this.options, this.#r = this.#t.state), s;
|
|
834
834
|
}
|
|
835
835
|
getCurrentResult() {
|
|
836
836
|
return this.#i;
|
|
837
837
|
}
|
|
838
|
-
trackResult(
|
|
839
|
-
return new Proxy(
|
|
840
|
-
get: (s, r) => (this.trackProp(r),
|
|
838
|
+
trackResult(t, e) {
|
|
839
|
+
return new Proxy(t, {
|
|
840
|
+
get: (s, r) => (this.trackProp(r), e?.(r), r === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#a.status === "pending" && this.#a.reject(
|
|
841
841
|
new Error(
|
|
842
842
|
"experimental_prefetchInRender feature flag is not enabled"
|
|
843
843
|
)
|
|
844
844
|
)), Reflect.get(s, r))
|
|
845
845
|
});
|
|
846
846
|
}
|
|
847
|
-
trackProp(
|
|
848
|
-
this.#p.add(
|
|
847
|
+
trackProp(t) {
|
|
848
|
+
this.#p.add(t);
|
|
849
849
|
}
|
|
850
850
|
getCurrentQuery() {
|
|
851
|
-
return this.#
|
|
851
|
+
return this.#t;
|
|
852
852
|
}
|
|
853
|
-
refetch({ ...
|
|
853
|
+
refetch({ ...t } = {}) {
|
|
854
854
|
return this.fetch({
|
|
855
|
-
...
|
|
855
|
+
...t
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
|
-
fetchOptimistic(
|
|
859
|
-
const
|
|
860
|
-
return s.fetch().then(() => this.createResult(s,
|
|
858
|
+
fetchOptimistic(t) {
|
|
859
|
+
const e = this.#e.defaultQueryOptions(t), s = this.#e.getQueryCache().build(this.#e, e);
|
|
860
|
+
return s.fetch().then(() => this.createResult(s, e));
|
|
861
861
|
}
|
|
862
|
-
fetch(
|
|
862
|
+
fetch(t) {
|
|
863
863
|
return this.#l({
|
|
864
|
-
...
|
|
865
|
-
cancelRefetch:
|
|
864
|
+
...t,
|
|
865
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
866
866
|
}).then(() => (this.updateResult(), this.#i));
|
|
867
867
|
}
|
|
868
|
-
#l(
|
|
868
|
+
#l(t) {
|
|
869
869
|
this.#O();
|
|
870
|
-
let
|
|
870
|
+
let e = this.#t.fetch(
|
|
871
871
|
this.options,
|
|
872
|
-
|
|
872
|
+
t
|
|
873
873
|
);
|
|
874
|
-
return
|
|
874
|
+
return t?.throwOnError || (e = e.catch(C)), e;
|
|
875
875
|
}
|
|
876
876
|
#v() {
|
|
877
877
|
this.#S();
|
|
878
|
-
const
|
|
878
|
+
const t = I(
|
|
879
879
|
this.options.staleTime,
|
|
880
|
-
this.#
|
|
880
|
+
this.#t
|
|
881
881
|
);
|
|
882
|
-
if (E || this.#i.isStale || !
|
|
882
|
+
if (E || this.#i.isStale || !Q(t))
|
|
883
883
|
return;
|
|
884
|
-
const s =
|
|
884
|
+
const s = et(this.#i.dataUpdatedAt, t) + 1;
|
|
885
885
|
this.#c = w.setTimeout(() => {
|
|
886
886
|
this.#i.isStale || this.updateResult();
|
|
887
887
|
}, s);
|
|
888
888
|
}
|
|
889
889
|
#m() {
|
|
890
|
-
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#
|
|
890
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
891
891
|
}
|
|
892
|
-
#b(
|
|
893
|
-
this.#R(), this.#u =
|
|
894
|
-
(this.options.refetchIntervalInBackground ||
|
|
892
|
+
#b(t) {
|
|
893
|
+
this.#R(), this.#u = t, !(E || v(this.options.enabled, this.#t) === !1 || !Q(this.#u) || this.#u === 0) && (this.#h = w.setInterval(() => {
|
|
894
|
+
(this.options.refetchIntervalInBackground || st.isFocused()) && this.#l();
|
|
895
895
|
}, this.#u));
|
|
896
896
|
}
|
|
897
897
|
#g() {
|
|
@@ -903,36 +903,36 @@ var ae = class extends H {
|
|
|
903
903
|
#R() {
|
|
904
904
|
this.#h && (w.clearInterval(this.#h), this.#h = void 0);
|
|
905
905
|
}
|
|
906
|
-
createResult(
|
|
907
|
-
const s = this.#
|
|
906
|
+
createResult(t, e) {
|
|
907
|
+
const s = this.#t, r = this.options, n = this.#i, u = this.#r, a = this.#o, o = t !== s ? t.state : this.#s, { state: l } = t;
|
|
908
908
|
let c = { ...l }, d = !1, h;
|
|
909
|
-
if (
|
|
910
|
-
const y = this.hasListeners(), M = !y && Z(
|
|
909
|
+
if (e._optimisticResults) {
|
|
910
|
+
const y = this.hasListeners(), M = !y && Z(t, e), T = y && X(t, s, e, r);
|
|
911
911
|
(M || T) && (c = {
|
|
912
912
|
...c,
|
|
913
|
-
...
|
|
914
|
-
}),
|
|
913
|
+
...nt(l.data, t.options)
|
|
914
|
+
}), e._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
|
|
915
915
|
}
|
|
916
916
|
let { error: R, errorUpdatedAt: F, status: f } = c;
|
|
917
917
|
h = c.data;
|
|
918
918
|
let g = !1;
|
|
919
|
-
if (
|
|
919
|
+
if (e.placeholderData !== void 0 && h === void 0 && f === "pending") {
|
|
920
920
|
let y;
|
|
921
|
-
n?.isPlaceholderData &&
|
|
921
|
+
n?.isPlaceholderData && e.placeholderData === a?.placeholderData ? (y = n.data, g = !0) : y = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
922
922
|
this.#d?.state.data,
|
|
923
923
|
this.#d
|
|
924
|
-
) :
|
|
924
|
+
) : e.placeholderData, y !== void 0 && (f = "success", h = k(
|
|
925
925
|
n?.data,
|
|
926
926
|
y,
|
|
927
|
-
|
|
927
|
+
e
|
|
928
928
|
), d = !0);
|
|
929
929
|
}
|
|
930
|
-
if (
|
|
931
|
-
if (n && h === u?.data &&
|
|
930
|
+
if (e.select && h !== void 0 && !g)
|
|
931
|
+
if (n && h === u?.data && e.select === this.#y)
|
|
932
932
|
h = this.#f;
|
|
933
933
|
else
|
|
934
934
|
try {
|
|
935
|
-
this.#y =
|
|
935
|
+
this.#y = e.select, h = e.select(h), h = k(n?.data, h, e), this.#f = h, this.#n = null;
|
|
936
936
|
} catch (y) {
|
|
937
937
|
this.#n = y;
|
|
938
938
|
}
|
|
@@ -960,10 +960,10 @@ var ae = class extends H {
|
|
|
960
960
|
isPaused: c.fetchStatus === "paused",
|
|
961
961
|
isPlaceholderData: d,
|
|
962
962
|
isRefetchError: O && D,
|
|
963
|
-
isStale: G(
|
|
963
|
+
isStale: G(t, e),
|
|
964
964
|
refetch: this.refetch,
|
|
965
965
|
promise: this.#a,
|
|
966
|
-
isEnabled: v(
|
|
966
|
+
isEnabled: v(e.enabled, t) !== !1
|
|
967
967
|
};
|
|
968
968
|
if (this.options.experimental_prefetchInRender) {
|
|
969
969
|
const y = (x) => {
|
|
@@ -974,7 +974,7 @@ var ae = class extends H {
|
|
|
974
974
|
}, T = this.#a;
|
|
975
975
|
switch (T.status) {
|
|
976
976
|
case "pending":
|
|
977
|
-
|
|
977
|
+
t.queryHash === s.queryHash && y(T);
|
|
978
978
|
break;
|
|
979
979
|
case "fulfilled":
|
|
980
980
|
(b.status === "error" || b.data !== T.value) && M();
|
|
@@ -987,12 +987,12 @@ var ae = class extends H {
|
|
|
987
987
|
return b;
|
|
988
988
|
}
|
|
989
989
|
updateResult() {
|
|
990
|
-
const
|
|
991
|
-
if (this.#r = this.#
|
|
990
|
+
const t = this.#i, e = this.createResult(this.#t, this.options);
|
|
991
|
+
if (this.#r = this.#t.state, this.#o = this.options, this.#r.data !== void 0 && (this.#d = this.#t), N(e, t))
|
|
992
992
|
return;
|
|
993
|
-
this.#i =
|
|
993
|
+
this.#i = e;
|
|
994
994
|
const s = () => {
|
|
995
|
-
if (!
|
|
995
|
+
if (!t)
|
|
996
996
|
return !0;
|
|
997
997
|
const { notifyOnChangeProps: r } = this.options, n = typeof r == "function" ? r() : r;
|
|
998
998
|
if (n === "all" || !n && !this.#p.size)
|
|
@@ -1002,126 +1002,126 @@ var ae = class extends H {
|
|
|
1002
1002
|
);
|
|
1003
1003
|
return this.options.throwOnError && u.add("error"), Object.keys(this.#i).some((a) => {
|
|
1004
1004
|
const i = a;
|
|
1005
|
-
return this.#i[i] !==
|
|
1005
|
+
return this.#i[i] !== t[i] && u.has(i);
|
|
1006
1006
|
});
|
|
1007
1007
|
};
|
|
1008
1008
|
this.#w({ listeners: s() });
|
|
1009
1009
|
}
|
|
1010
1010
|
#O() {
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1011
|
+
const t = this.#e.getQueryCache().build(this.#e, this.options);
|
|
1012
|
+
if (t === this.#t)
|
|
1013
1013
|
return;
|
|
1014
|
-
const
|
|
1015
|
-
this.#
|
|
1014
|
+
const e = this.#t;
|
|
1015
|
+
this.#t = t, this.#s = t.state, this.hasListeners() && (e?.removeObserver(this), t.addObserver(this));
|
|
1016
1016
|
}
|
|
1017
1017
|
onQueryUpdate() {
|
|
1018
1018
|
this.updateResult(), this.hasListeners() && this.#g();
|
|
1019
1019
|
}
|
|
1020
|
-
#w(
|
|
1020
|
+
#w(t) {
|
|
1021
1021
|
B.batch(() => {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
}), this.#
|
|
1025
|
-
query: this.#
|
|
1022
|
+
t.listeners && this.listeners.forEach((e) => {
|
|
1023
|
+
e(this.#i);
|
|
1024
|
+
}), this.#e.getQueryCache().notify({
|
|
1025
|
+
query: this.#t,
|
|
1026
1026
|
type: "observerResultsUpdated"
|
|
1027
1027
|
});
|
|
1028
1028
|
});
|
|
1029
1029
|
}
|
|
1030
1030
|
};
|
|
1031
|
-
function
|
|
1032
|
-
return v(
|
|
1031
|
+
function Ft(t, e) {
|
|
1032
|
+
return v(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
|
|
1033
1033
|
}
|
|
1034
|
-
function Z(
|
|
1035
|
-
return
|
|
1034
|
+
function Z(t, e) {
|
|
1035
|
+
return Ft(t, e) || t.state.data !== void 0 && K(t, e, e.refetchOnMount);
|
|
1036
1036
|
}
|
|
1037
|
-
function K(
|
|
1038
|
-
if (v(
|
|
1039
|
-
const r = typeof s == "function" ? s(
|
|
1040
|
-
return r === "always" || r !== !1 && G(
|
|
1037
|
+
function K(t, e, s) {
|
|
1038
|
+
if (v(e.enabled, t) !== !1 && I(e.staleTime, t) !== "static") {
|
|
1039
|
+
const r = typeof s == "function" ? s(t) : s;
|
|
1040
|
+
return r === "always" || r !== !1 && G(t, e);
|
|
1041
1041
|
}
|
|
1042
1042
|
return !1;
|
|
1043
1043
|
}
|
|
1044
|
-
function X(
|
|
1045
|
-
return (
|
|
1044
|
+
function X(t, e, s, r) {
|
|
1045
|
+
return (t !== e || v(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && G(t, s);
|
|
1046
1046
|
}
|
|
1047
|
-
function G(
|
|
1048
|
-
return v(
|
|
1047
|
+
function G(t, e) {
|
|
1048
|
+
return v(e.enabled, t) !== !1 && t.isStaleByTime(I(e.staleTime, t));
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1051
|
-
return !
|
|
1050
|
+
function Tt(t, e) {
|
|
1051
|
+
return !N(t.getCurrentResult(), e);
|
|
1052
1052
|
}
|
|
1053
|
-
var
|
|
1053
|
+
var at = p.createContext(
|
|
1054
1054
|
void 0
|
|
1055
|
-
),
|
|
1056
|
-
const
|
|
1057
|
-
if (
|
|
1058
|
-
return
|
|
1059
|
-
if (!
|
|
1055
|
+
), It = (t) => {
|
|
1056
|
+
const e = p.useContext(at);
|
|
1057
|
+
if (t)
|
|
1058
|
+
return t;
|
|
1059
|
+
if (!e)
|
|
1060
1060
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1061
|
-
return
|
|
1062
|
-
},
|
|
1063
|
-
client:
|
|
1064
|
-
children:
|
|
1065
|
-
}) => (p.useEffect(() => (
|
|
1066
|
-
|
|
1067
|
-
}), [
|
|
1068
|
-
function
|
|
1069
|
-
let
|
|
1061
|
+
return e;
|
|
1062
|
+
}, Jt = ({
|
|
1063
|
+
client: t,
|
|
1064
|
+
children: e
|
|
1065
|
+
}) => (p.useEffect(() => (t.mount(), () => {
|
|
1066
|
+
t.unmount();
|
|
1067
|
+
}), [t]), /* @__PURE__ */ tt.jsx(at.Provider, { value: t, children: e })), ot = p.createContext(!1), Pt = () => p.useContext(ot), Wt = ot.Provider;
|
|
1068
|
+
function ut() {
|
|
1069
|
+
let t = !1;
|
|
1070
1070
|
return {
|
|
1071
1071
|
clearReset: () => {
|
|
1072
|
-
|
|
1072
|
+
t = !1;
|
|
1073
1073
|
},
|
|
1074
1074
|
reset: () => {
|
|
1075
|
-
|
|
1075
|
+
t = !0;
|
|
1076
1076
|
},
|
|
1077
|
-
isReset: () =>
|
|
1077
|
+
isReset: () => t
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
var
|
|
1081
|
-
children:
|
|
1080
|
+
var ct = p.createContext(ut()), Dt = () => p.useContext(ct), Zt = ({
|
|
1081
|
+
children: t
|
|
1082
1082
|
}) => {
|
|
1083
|
-
const [
|
|
1084
|
-
return /* @__PURE__ */
|
|
1085
|
-
},
|
|
1086
|
-
(
|
|
1087
|
-
},
|
|
1083
|
+
const [e] = p.useState(() => ut());
|
|
1084
|
+
return /* @__PURE__ */ tt.jsx(ct.Provider, { value: e, children: typeof t == "function" ? t(e) : t });
|
|
1085
|
+
}, Mt = (t, e) => {
|
|
1086
|
+
(t.suspense || t.throwOnError || t.experimental_prefetchInRender) && (e.isReset() || (t.retryOnMount = !1));
|
|
1087
|
+
}, xt = (t) => {
|
|
1088
1088
|
p.useEffect(() => {
|
|
1089
|
-
|
|
1090
|
-
}, [
|
|
1091
|
-
},
|
|
1092
|
-
result:
|
|
1093
|
-
errorResetBoundary:
|
|
1089
|
+
t.clearReset();
|
|
1090
|
+
}, [t]);
|
|
1091
|
+
}, Ut = ({
|
|
1092
|
+
result: t,
|
|
1093
|
+
errorResetBoundary: e,
|
|
1094
1094
|
throwOnError: s,
|
|
1095
1095
|
query: r,
|
|
1096
1096
|
suspense: n
|
|
1097
|
-
}) =>
|
|
1098
|
-
if (
|
|
1099
|
-
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), r =
|
|
1100
|
-
|
|
1101
|
-
|
|
1097
|
+
}) => t.isError && !e.isReset() && !t.isFetching && r && (n && t.data === void 0 || mt(s, [t.error, r])), Xt = (t, e) => e.state.data === void 0, Qt = (t) => {
|
|
1098
|
+
if (t.suspense) {
|
|
1099
|
+
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), r = t.staleTime;
|
|
1100
|
+
t.staleTime = typeof r == "function" ? (...n) => s(r(...n)) : s(r), typeof t.gcTime == "number" && (t.gcTime = Math.max(
|
|
1101
|
+
t.gcTime,
|
|
1102
1102
|
1e3
|
|
1103
1103
|
));
|
|
1104
1104
|
}
|
|
1105
|
-
},
|
|
1105
|
+
}, jt = (t, e) => t.isLoading && t.isFetching && !e, qt = (t, e) => t?.suspense && e.isPending, Y = (t, e, s) => e.fetchOptimistic(t).catch(() => {
|
|
1106
1106
|
s.clearReset();
|
|
1107
1107
|
});
|
|
1108
|
-
function
|
|
1109
|
-
if (process.env.NODE_ENV !== "production" && (typeof
|
|
1108
|
+
function Nt(t, e, s) {
|
|
1109
|
+
if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
|
|
1110
1110
|
throw new Error(
|
|
1111
1111
|
'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'
|
|
1112
1112
|
);
|
|
1113
|
-
const r =
|
|
1113
|
+
const r = Pt(), n = Dt(), u = It(s), a = u.defaultQueryOptions(t);
|
|
1114
1114
|
u.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
1115
1115
|
a
|
|
1116
1116
|
), process.env.NODE_ENV !== "production" && (a.queryFn || console.error(
|
|
1117
1117
|
`[${a.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`
|
|
1118
|
-
)), a._optimisticResults = r ? "isRestoring" : "optimistic",
|
|
1118
|
+
)), a._optimisticResults = r ? "isRestoring" : "optimistic", Qt(a), Mt(a, n), xt(n);
|
|
1119
1119
|
const i = !u.getQueryCache().get(a.queryHash), [o] = p.useState(
|
|
1120
|
-
() => new
|
|
1120
|
+
() => new e(
|
|
1121
1121
|
u,
|
|
1122
1122
|
a
|
|
1123
1123
|
)
|
|
1124
|
-
), l = o.getOptimisticResult(a), c = !r &&
|
|
1124
|
+
), l = o.getOptimisticResult(a), c = !r && t.subscribed !== !1;
|
|
1125
1125
|
if (p.useSyncExternalStore(
|
|
1126
1126
|
p.useCallback(
|
|
1127
1127
|
(d) => {
|
|
@@ -1134,9 +1134,9 @@ function le(e, t, s) {
|
|
|
1134
1134
|
() => o.getCurrentResult()
|
|
1135
1135
|
), p.useEffect(() => {
|
|
1136
1136
|
o.setOptions(a);
|
|
1137
|
-
}, [a, o]),
|
|
1137
|
+
}, [a, o]), qt(a, l))
|
|
1138
1138
|
throw Y(a, o, n);
|
|
1139
|
-
if (
|
|
1139
|
+
if (Ut({
|
|
1140
1140
|
result: l,
|
|
1141
1141
|
errorResetBoundary: n,
|
|
1142
1142
|
throwOnError: a.throwOnError,
|
|
@@ -1147,7 +1147,7 @@ function le(e, t, s) {
|
|
|
1147
1147
|
return u.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
1148
1148
|
a,
|
|
1149
1149
|
l
|
|
1150
|
-
), a.experimental_prefetchInRender && !E &&
|
|
1150
|
+
), a.experimental_prefetchInRender && !E && jt(l, r) && (i ? (
|
|
1151
1151
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1152
1152
|
Y(a, o, n)
|
|
1153
1153
|
) : (
|
|
@@ -1157,70 +1157,56 @@ function le(e, t, s) {
|
|
|
1157
1157
|
o.updateResult();
|
|
1158
1158
|
}), a.notifyOnChangeProps ? l : o.trackResult(l);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1162
|
-
}
|
|
1163
|
-
function et(e, t) {
|
|
1164
|
-
return process.env.NODE_ENV !== "production" && e.queryFn === U && console.error("skipToken is not allowed for useSuspenseQuery"), le(
|
|
1165
|
-
{
|
|
1166
|
-
...e,
|
|
1167
|
-
enabled: !0,
|
|
1168
|
-
suspense: !0,
|
|
1169
|
-
throwOnError: je,
|
|
1170
|
-
placeholderData: void 0
|
|
1171
|
-
},
|
|
1172
|
-
ae,
|
|
1173
|
-
t
|
|
1174
|
-
);
|
|
1160
|
+
function Yt(t, e) {
|
|
1161
|
+
return Nt(t, Ct, e);
|
|
1175
1162
|
}
|
|
1176
1163
|
export {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1164
|
+
Pt as A,
|
|
1165
|
+
Dt as B,
|
|
1166
|
+
Qt as C,
|
|
1167
|
+
Mt as D,
|
|
1168
|
+
xt as E,
|
|
1169
|
+
qt as F,
|
|
1170
|
+
Y as G,
|
|
1171
|
+
jt as H,
|
|
1172
|
+
Ut as I,
|
|
1173
|
+
Wt as J,
|
|
1174
|
+
at as K,
|
|
1175
|
+
Jt as L,
|
|
1176
|
+
Zt as M,
|
|
1177
|
+
U as N,
|
|
1178
|
+
gt as O,
|
|
1179
|
+
zt as P,
|
|
1180
|
+
Ct as Q,
|
|
1181
|
+
Et as R,
|
|
1195
1182
|
H as S,
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
He as m,
|
|
1183
|
+
E as T,
|
|
1184
|
+
w as U,
|
|
1185
|
+
N as a,
|
|
1186
|
+
It as b,
|
|
1187
|
+
wt as c,
|
|
1188
|
+
Xt as d,
|
|
1189
|
+
C as e,
|
|
1190
|
+
mt as f,
|
|
1191
|
+
Yt as g,
|
|
1192
|
+
j as h,
|
|
1193
|
+
vt as i,
|
|
1194
|
+
Bt as j,
|
|
1195
|
+
Ht as k,
|
|
1196
|
+
Vt as l,
|
|
1197
|
+
Kt as m,
|
|
1212
1198
|
B as n,
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1199
|
+
dt as o,
|
|
1200
|
+
$t as p,
|
|
1201
|
+
Lt as q,
|
|
1202
|
+
st as r,
|
|
1203
|
+
_ as s,
|
|
1204
|
+
Gt as t,
|
|
1205
|
+
Nt as u,
|
|
1206
|
+
rt as v,
|
|
1207
|
+
I as w,
|
|
1208
|
+
_t as x,
|
|
1209
|
+
V as y,
|
|
1210
|
+
q as z
|
|
1225
1211
|
};
|
|
1226
|
-
//# sourceMappingURL=
|
|
1212
|
+
//# sourceMappingURL=useQuery-ht7aWJ3S.js.map
|