@hortiview/modulebase 0.0.16348 → 0.0.20524

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.
Files changed (65) hide show
  1. package/README.md +3 -2
  2. package/dist/IsRestoringProvider-CBSZo7ur.js +312 -0
  3. package/dist/ModuleCore-DuJVrj6v.js +11828 -0
  4. package/dist/QueryClientProvider-DyiNrPkn.js +514 -0
  5. package/dist/_commonjsHelpers-ByX85dGu.js +33 -0
  6. package/dist/api-COabZnyn.js +147 -0
  7. package/dist/assets/ModuleCore.css +1 -1
  8. package/dist/chunk-LFPYN7LY-D1ls8FXf.js +8643 -0
  9. package/dist/components/ModuleBase.js +9 -9
  10. package/dist/components/ModuleCore.js +9 -14698
  11. package/dist/constants.js +2 -3
  12. package/dist/enum/ActionStorage.js +4 -0
  13. package/dist/hooks/useCustom.js +15 -18
  14. package/dist/hooks/useCustomMutation.js +12 -11
  15. package/dist/hooks/useEntity.js +48 -60
  16. package/dist/hooks/useOffline.js +57 -0
  17. package/dist/hooks/useOption.js +19 -19
  18. package/dist/hooks/useServiceBus.js +1 -1
  19. package/dist/hooks/useStores.js +1 -1
  20. package/dist/{_baseGet-B7FwMMGI.js → isTypedArray-SkhznY1k.js} +496 -496
  21. package/dist/lib/constants.d.ts +0 -1
  22. package/dist/lib/enum/ActionStorage.d.ts +7 -0
  23. package/dist/lib/hooks/useCustom.d.ts +6 -3
  24. package/dist/lib/hooks/useCustomMutation.d.ts +9 -3
  25. package/dist/lib/hooks/useEntity.d.ts +15 -23
  26. package/dist/lib/hooks/useOffline.d.ts +15 -0
  27. package/dist/lib/hooks/useStores.d.ts +10 -2
  28. package/dist/lib/main.d.ts +4 -0
  29. package/dist/lib/types/ActionStorage.d.ts +8 -0
  30. package/dist/lib/types/BaseProps.d.ts +10 -1
  31. package/dist/lib/types/Deprecated.d.ts +4 -0
  32. package/dist/lib/types/Entities.d.ts +22 -0
  33. package/dist/lib/types/Requests.d.ts +0 -17
  34. package/dist/lib/utils/IndexedDbService.d.ts +33 -0
  35. package/dist/lib/utils/api.d.ts +7 -14
  36. package/dist/lib/utils/baseFetches.d.ts +4 -3
  37. package/dist/lib/utils/fetches.d.ts +2 -2
  38. package/dist/lib/utils/helper.d.ts +1 -0
  39. package/dist/main.js +233 -144
  40. package/dist/module-router.js +2322 -121
  41. package/dist/{mutation-CnKIetRs.js → mutation-CmhiEgfA.js} +101 -56
  42. package/dist/{omit-B7MWDtHq.js → omit-Do6MFRwA.js} +240 -223
  43. package/dist/provider/SignalR/SignalRProvider.js +2389 -2824
  44. package/dist/react-c9FSfB30.js +27 -0
  45. package/dist/stores/BasePropsStore.js +1 -1
  46. package/dist/stores/EnvironmentStore.js +1 -1
  47. package/dist/types/ActionStorage.js +1 -0
  48. package/dist/types/Entities.js +25 -0
  49. package/dist/useMutation-Aoachkw_.js +139 -0
  50. package/dist/useQuery-DEU_AUtf.js +392 -0
  51. package/dist/utils/IndexedDbService.js +43 -0
  52. package/dist/utils/api.js +3 -4
  53. package/dist/utils/baseFetches.js +18 -14
  54. package/dist/utils/fetches.js +12 -13
  55. package/dist/utils/helper.js +30 -25
  56. package/package.json +19 -12
  57. package/dist/QueryClientProvider-VtJdNkDw.js +0 -435
  58. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  59. package/dist/api-D9Lmqe6S.js +0 -458
  60. package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +0 -8162
  61. package/dist/query-CFoO2uy7.js +0 -277
  62. package/dist/react-QiIgv49H.js +0 -27
  63. package/dist/useMutation-Num57Ulc.js +0 -97
  64. package/dist/useQuery-XBGd5Kep.js +0 -395
  65. package/dist/utils-DxRR_XLb.js +0 -9
@@ -1,22 +1,21 @@
1
- import { useBasePropsStore as u } from "../stores/BasePropsStore.js";
1
+ import { useBasePropsStore as a } from "../stores/BasePropsStore.js";
2
2
  import { useEnvironmentStore as i } from "../stores/EnvironmentStore.js";
3
3
  import { baseMutation as d, baseFetch as o } from "./baseFetches.js";
4
- const p = (e, t, n = "POST", s, m) => d(e, t, n, s, m), I = (e, t) => r(`FarmOrgEntities/${e}/byId/${t}`), g = (e, t) => r(`ModuleDependentEntities/${e}/byId/${t}`), E = (e, t) => r(`ModuleDependentEntitiesRaw/${e}/byId/${t}`), A = (e, t) => o(`${e}`, {}, t), r = (e) => {
5
- const t = i.getState().environment, n = u.getState().organizationId;
4
+ const I = (e, t, n = "POST", s, m, u = !1) => d(e, t, n, s, m, u), g = (e, t) => r(`FarmOrgEntities/${e}/byId/${t}`), E = (e, t) => r(`ModuleDependentEntities/${e}/byId/${t}`), A = (e, t) => r(`ModuleDependentEntitiesRaw/${e}/byId/${t}`), M = (e, t, n = !1) => o(`${e}`, t, n), r = (e) => {
5
+ const t = i.getState().environment, n = a.getState().organizationId;
6
6
  return o(
7
- `${t?.MODULE_AUTH_API}${t?.API_PREFIX}/${n}/${e}`,
8
- {}
7
+ `${t?.MODULE_AUTH_API}${t?.API_PREFIX}/${n}/${e}`
9
8
  );
10
- }, M = (e) => {
9
+ }, f = (e) => {
11
10
  const t = i.getState().environment;
12
- return o(`${t?.COMMON_API}${t?.API_PREFIX}/${e}`, {});
11
+ return o(`${t?.COMMON_API}${t?.API_PREFIX}/${e}`);
13
12
  };
14
13
  export {
15
- M as fetchFromCommonApi,
16
- A as fetchFromCustomApi,
14
+ f as fetchFromCommonApi,
15
+ M as fetchFromCustomApi,
17
16
  r as fetchFromModuleApi,
18
- I as getFarmOrgEntities,
19
- g as getModuleDependedEntities,
20
- E as getModuleDependedEntitiesRaw,
21
- p as mutateOnCustomApi
17
+ g as getFarmOrgEntities,
18
+ E as getModuleDependedEntities,
19
+ A as getModuleDependedEntitiesRaw,
20
+ I as mutateOnCustomApi
22
21
  };
@@ -1,50 +1,55 @@
1
- import { REQUIRED_PROPS as d } from "../constants.js";
2
- const h = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, u = (r) => {
1
+ import { REQUIRED_PROPS as m } from "../constants.js";
2
+ import { useBasePropsStore as u } from "../stores/BasePropsStore.js";
3
+ const g = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, c = (r) => {
3
4
  if (typeof r != "string")
4
5
  throw new TypeError("Invalid argument expected string");
5
- const e = r.match(h);
6
+ const e = r.match(g);
6
7
  if (!e)
7
8
  throw new Error(`Invalid argument not valid semver ('${r}' received)`);
8
9
  return e.shift(), e;
9
- }, c = (r) => r === "*" || r === "x" || r === "X", f = (r) => {
10
+ }, f = (r) => r === "*" || r === "x" || r === "X", l = (r) => {
10
11
  const e = parseInt(r, 10);
11
12
  return isNaN(e) ? r : e;
12
- }, m = (r, e) => typeof r != typeof e ? [String(r), String(e)] : [r, e], E = (r, e) => {
13
- if (c(r) || c(e))
13
+ }, v = (r, e) => typeof r != typeof e ? [String(r), String(e)] : [r, e], h = (r, e) => {
14
+ if (f(r) || f(e))
14
15
  return 0;
15
- const [n, t] = m(f(r), f(e));
16
- return n > t ? 1 : n < t ? -1 : 0;
17
- }, l = (r, e) => {
18
- for (let n = 0; n < Math.max(r.length, e.length); n++) {
19
- const t = E(r[n] || "0", e[n] || "0");
20
- if (t !== 0)
21
- return t;
16
+ const [t, n] = v(l(r), l(e));
17
+ return t > n ? 1 : t < n ? -1 : 0;
18
+ }, p = (r, e) => {
19
+ for (let t = 0; t < Math.max(r.length, e.length); t++) {
20
+ const n = h(r[t] || "0", e[t] || "0");
21
+ if (n !== 0)
22
+ return n;
22
23
  }
23
24
  return 0;
24
- }, g = (r, e) => {
25
- const n = u(r), t = u(e), i = n.pop(), o = t.pop(), s = l(n, t);
26
- return s !== 0 ? s : i && o ? l(i.split("."), o.split(".")) : i || o ? i ? -1 : 1 : 0;
27
- }, p = "0.0.16348", w = (r) => d.every((e) => v(e, r)), v = (r, e) => {
25
+ }, E = (r, e) => {
26
+ const t = c(r), n = c(e), o = t.pop(), i = n.pop(), s = p(t, n);
27
+ return s !== 0 ? s : o && i ? p(o.split("."), i.split(".")) : o || i ? o ? -1 : 1 : 0;
28
+ }, d = "0.0.20524", w = (r) => m.every((e) => y(e, r)), y = (r, e) => {
28
29
  if (!e[r]) {
29
30
  if (e.throwError)
30
31
  return e.throwError(`Missing required prop: ${r}`, 404), !1;
31
32
  throw new Error(`Missing required prop: ${r}`);
32
33
  }
33
34
  return !0;
34
- }, I = () => {
35
+ }, P = () => {
35
36
  const r = window.__env__;
36
37
  if (r && r.COMMON_API && r.MODULE_AUTH_API && r.API_PREFIX && r.ENVIRONMENT)
37
38
  return r;
38
- }, P = (r) => {
39
+ }, S = (r) => {
39
40
  if (!r?.REQ_VERSION) return null;
40
41
  const e = r.REQ_VERSION;
41
- return g(p, e) < 0 ? `ModuleBase version ${p} is probably not compatible with the current HortiView version ${e}. Please update the modulebase to be at least ${e}` : null;
42
- }, _ = (r) => typeof r == "string" || typeof r == "boolean" || typeof r == "number" ? r : typeof r == "object" && "value" in r ? r.value : typeof r == "object" && "items" in r ? r.items : (Array.isArray(r), r), a = (r) => r;
42
+ return E(d, e) < 0 ? `ModuleBase version ${d} is probably not compatible with the current HortiView version ${e}. Please update the modulebase to be at least ${e}` : null;
43
+ }, _ = (r) => typeof r == "string" || typeof r == "boolean" || typeof r == "number" ? r : typeof r == "object" && "value" in r ? r.value : typeof r == "object" && "items" in r ? r.items : (Array.isArray(r), r), M = (r) => r, R = (r) => {
44
+ const e = u.getState().organizationId, t = u.getState().moduleId;
45
+ return [...r, e, t];
46
+ };
43
47
  export {
44
48
  w as arePropsValid,
45
- a as checkConfig,
46
- v as checkIfPropExists,
47
- P as checkVersion,
48
- I as getEnvironmentVariables,
49
+ M as checkConfig,
50
+ y as checkIfPropExists,
51
+ S as checkVersion,
52
+ P as getEnvironmentVariables,
53
+ R as getModuleQueryKey,
49
54
  _ as universalSelector
50
55
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/modulebase",
3
3
  "description": "This is a base module for hortiview",
4
- "version": "0.0.16348",
4
+ "version": "0.0.20524",
5
5
  "type": "module",
6
6
  "author": "Falk Menge <falk.menge.ext@bayer.com>",
7
7
  "contributors": [
@@ -20,16 +20,20 @@
20
20
  "dev": "vite",
21
21
  "build": "tsc -b && vite build",
22
22
  "lint": "eslint .",
23
- "preview": "vite preview"
23
+ "preview": "vite preview",
24
+ "release": "npx -p semantic-release -p semantic-release-ado semantic-release",
25
+ "tsCheck": "tsc --build --pretty --watch"
24
26
  },
25
27
  "dependencies": {
26
28
  "@hortiview/default-components": "^1.2.1",
27
29
  "@hortiview/shared-components": "^2.0.0",
28
30
  "@microsoft/signalr": "^8.0.7",
31
+ "@tanstack/query-async-storage-persister": "^5.85.5",
29
32
  "@tanstack/react-query": "^5.67.3",
33
+ "@tanstack/react-query-persist-client": "^5.85.5",
30
34
  "compare-versions": "^6.1.1",
35
+ "idb-keyval": "^6.2.2",
31
36
  "lodash": "^4.17.21",
32
- "odata-query": "^7.0.9",
33
37
  "react": "^18.3.1",
34
38
  "react-dom": "^18.3.1",
35
39
  "react-router": "^7.1.5",
@@ -40,19 +44,22 @@
40
44
  "zustand": "^5.0.3"
41
45
  },
42
46
  "devDependencies": {
43
- "@eslint/js": "^9.17.0",
47
+ "@eslint/js": "^10.0.1",
48
+ "@semantic-release/changelog": "^6.0.3",
49
+ "@semantic-release/exec": "^7.1.0",
50
+ "@semantic-release/git": "^10.0.1",
44
51
  "@types/lodash": "^4.17.15",
45
52
  "@types/node": "^22.10.7",
46
53
  "@types/react": "^18.3.18",
47
54
  "@types/react-dom": "^18.3.5",
48
- "@vitejs/plugin-react": "^4.3.4",
49
- "eslint": "^9.17.0",
50
- "eslint-plugin-react-hooks": "^5.0.0",
51
- "eslint-plugin-react-refresh": "^0.4.16",
52
- "glob": "^11.0.1",
53
- "globals": "^15.14.0",
54
- "typescript": "~5.6.2",
55
+ "@vitejs/plugin-react": "^5.1.4",
56
+ "eslint": "^10.0.3",
57
+ "eslint-plugin-react-hooks": "^7.0.1",
58
+ "eslint-plugin-react-refresh": "^0.5.2",
59
+ "glob": "^13.0.6",
60
+ "globals": "^17.4.0",
61
+ "typescript": "~5.9.3",
55
62
  "typescript-eslint": "^8.18.2",
56
- "vite": "^6.0.5"
63
+ "vite": "^7.3.1"
57
64
  }
58
65
  }
@@ -1,435 +0,0 @@
1
- import * as F from "react";
2
- import { jsx as R } from "react/jsx-runtime";
3
- var C = class {
4
- constructor() {
5
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
- }
7
- subscribe(e) {
8
- return this.listeners.add(e), this.onSubscribe(), () => {
9
- this.listeners.delete(e), this.onUnsubscribe();
10
- };
11
- }
12
- hasListeners() {
13
- return this.listeners.size > 0;
14
- }
15
- onSubscribe() {
16
- }
17
- onUnsubscribe() {
18
- }
19
- }, d = typeof window > "u" || "Deno" in globalThis;
20
- function J() {
21
- }
22
- function _(e, t) {
23
- return typeof e == "function" ? e(t) : e;
24
- }
25
- function Q(e) {
26
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
27
- }
28
- function B(e, t) {
29
- return Math.max(e + (t || 0) - Date.now(), 0);
30
- }
31
- function W(e, t) {
32
- return typeof e == "function" ? e(t) : e;
33
- }
34
- function X(e, t) {
35
- return typeof e == "function" ? e(t) : e;
36
- }
37
- function Y(e, t) {
38
- const {
39
- type: n = "all",
40
- exact: r,
41
- fetchStatus: s,
42
- predicate: o,
43
- queryKey: l,
44
- stale: i
45
- } = e;
46
- if (l) {
47
- if (r) {
48
- if (t.queryHash !== K(l, t.options))
49
- return !1;
50
- } else if (!S(t.queryKey, l))
51
- return !1;
52
- }
53
- if (n !== "all") {
54
- const u = t.isActive();
55
- if (n === "active" && !u || n === "inactive" && u)
56
- return !1;
57
- }
58
- return !(typeof i == "boolean" && t.isStale() !== i || s && s !== t.state.fetchStatus || o && !o(t));
59
- }
60
- function Z(e, t) {
61
- const { exact: n, status: r, predicate: s, mutationKey: o } = e;
62
- if (o) {
63
- if (!t.options.mutationKey)
64
- return !1;
65
- if (n) {
66
- if (w(t.options.mutationKey) !== w(o))
67
- return !1;
68
- } else if (!S(t.options.mutationKey, o))
69
- return !1;
70
- }
71
- return !(r && t.state.status !== r || s && !s(t));
72
- }
73
- function K(e, t) {
74
- return (t?.queryKeyHashFn || w)(e);
75
- }
76
- function w(e) {
77
- return JSON.stringify(
78
- e,
79
- (t, n) => g(n) ? Object.keys(n).sort().reduce((r, s) => (r[s] = n[s], r), {}) : n
80
- );
81
- }
82
- function S(e, t) {
83
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((n) => !S(e[n], t[n])) : !1;
84
- }
85
- function E(e, t) {
86
- if (e === t)
87
- return e;
88
- const n = j(e) && j(t);
89
- if (n || g(e) && g(t)) {
90
- const r = n ? e : Object.keys(e), s = r.length, o = n ? t : Object.keys(t), l = o.length, i = n ? [] : {};
91
- let u = 0;
92
- for (let f = 0; f < l; f++) {
93
- const c = n ? f : o[f];
94
- (!n && r.includes(c) || n) && e[c] === void 0 && t[c] === void 0 ? (i[c] = void 0, u++) : (i[c] = E(e[c], t[c]), i[c] === e[c] && e[c] !== void 0 && u++);
95
- }
96
- return s === l && u === s ? e : i;
97
- }
98
- return t;
99
- }
100
- function ee(e, t) {
101
- if (!t || Object.keys(e).length !== Object.keys(t).length)
102
- return !1;
103
- for (const n in e)
104
- if (e[n] !== t[n])
105
- return !1;
106
- return !0;
107
- }
108
- function j(e) {
109
- return Array.isArray(e) && e.length === Object.keys(e).length;
110
- }
111
- function g(e) {
112
- if (!T(e))
113
- return !1;
114
- const t = e.constructor;
115
- if (t === void 0)
116
- return !0;
117
- const n = t.prototype;
118
- return !(!T(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
119
- }
120
- function T(e) {
121
- return Object.prototype.toString.call(e) === "[object Object]";
122
- }
123
- function z(e) {
124
- return new Promise((t) => {
125
- setTimeout(t, e);
126
- });
127
- }
128
- function te(e, t, n) {
129
- if (typeof n.structuralSharing == "function")
130
- return n.structuralSharing(e, t);
131
- if (n.structuralSharing !== !1) {
132
- if (process.env.NODE_ENV !== "production")
133
- try {
134
- return E(e, t);
135
- } catch (r) {
136
- console.error(
137
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`
138
- );
139
- }
140
- return E(e, t);
141
- }
142
- return t;
143
- }
144
- function ne(e, t, n = 0) {
145
- const r = [...e, t];
146
- return n && r.length > n ? r.slice(1) : r;
147
- }
148
- function re(e, t, n = 0) {
149
- const r = [t, ...e];
150
- return n && r.length > n ? r.slice(0, -1) : r;
151
- }
152
- var P = Symbol();
153
- function se(e, t) {
154
- return process.env.NODE_ENV !== "production" && e.queryFn === P && console.error(
155
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
156
- ), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === P ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
157
- }
158
- var D = class extends C {
159
- #e;
160
- #t;
161
- #n;
162
- constructor() {
163
- super(), this.#n = (e) => {
164
- if (!d && window.addEventListener) {
165
- const t = () => e();
166
- return window.addEventListener("visibilitychange", t, !1), () => {
167
- window.removeEventListener("visibilitychange", t);
168
- };
169
- }
170
- };
171
- }
172
- onSubscribe() {
173
- this.#t || this.setEventListener(this.#n);
174
- }
175
- onUnsubscribe() {
176
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
177
- }
178
- setEventListener(e) {
179
- this.#n = e, this.#t?.(), this.#t = e((t) => {
180
- typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
181
- });
182
- }
183
- setFocused(e) {
184
- this.#e !== e && (this.#e = e, this.onFocus());
185
- }
186
- onFocus() {
187
- const e = this.isFocused();
188
- this.listeners.forEach((t) => {
189
- t(e);
190
- });
191
- }
192
- isFocused() {
193
- return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
194
- }
195
- }, I = new D(), A = class extends C {
196
- #e = !0;
197
- #t;
198
- #n;
199
- constructor() {
200
- super(), this.#n = (e) => {
201
- if (!d && window.addEventListener) {
202
- const t = () => e(!0), n = () => e(!1);
203
- return window.addEventListener("online", t, !1), window.addEventListener("offline", n, !1), () => {
204
- window.removeEventListener("online", t), window.removeEventListener("offline", n);
205
- };
206
- }
207
- };
208
- }
209
- onSubscribe() {
210
- this.#t || this.setEventListener(this.#n);
211
- }
212
- onUnsubscribe() {
213
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
214
- }
215
- setEventListener(e) {
216
- this.#n = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
217
- }
218
- setOnline(e) {
219
- this.#e !== e && (this.#e = e, this.listeners.forEach((n) => {
220
- n(e);
221
- }));
222
- }
223
- isOnline() {
224
- return this.#e;
225
- }
226
- }, L = new A();
227
- function U() {
228
- let e, t;
229
- const n = new Promise((s, o) => {
230
- e = s, t = o;
231
- });
232
- n.status = "pending", n.catch(() => {
233
- });
234
- function r(s) {
235
- Object.assign(n, s), delete n.resolve, delete n.reject;
236
- }
237
- return n.resolve = (s) => {
238
- r({
239
- status: "fulfilled",
240
- value: s
241
- }), e(s);
242
- }, n.reject = (s) => {
243
- r({
244
- status: "rejected",
245
- reason: s
246
- }), t(s);
247
- }, n;
248
- }
249
- function G(e) {
250
- return Math.min(1e3 * 2 ** e, 3e4);
251
- }
252
- function H(e) {
253
- return (e ?? "online") === "online" ? L.isOnline() : !0;
254
- }
255
- var q = class extends Error {
256
- constructor(e) {
257
- super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
258
- }
259
- };
260
- function ie(e) {
261
- return e instanceof q;
262
- }
263
- function oe(e) {
264
- let t = !1, n = 0, r = !1, s;
265
- const o = U(), l = (a) => {
266
- r || (b(new q(a)), e.abort?.());
267
- }, i = () => {
268
- t = !0;
269
- }, u = () => {
270
- t = !1;
271
- }, f = () => I.isFocused() && (e.networkMode === "always" || L.isOnline()) && e.canRun(), c = () => H(e.networkMode) && e.canRun(), M = (a) => {
272
- r || (r = !0, e.onSuccess?.(a), s?.(), o.resolve(a));
273
- }, b = (a) => {
274
- r || (r = !0, e.onError?.(a), s?.(), o.reject(a));
275
- }, O = () => new Promise((a) => {
276
- s = (p) => {
277
- (r || f()) && a(p);
278
- }, e.onPause?.();
279
- }).then(() => {
280
- s = void 0, r || e.onContinue?.();
281
- }), m = () => {
282
- if (r)
283
- return;
284
- let a;
285
- const p = n === 0 ? e.initialPromise : void 0;
286
- try {
287
- a = p ?? e.fn();
288
- } catch (h) {
289
- a = Promise.reject(h);
290
- }
291
- Promise.resolve(a).then(M).catch((h) => {
292
- if (r)
293
- return;
294
- const y = e.retry ?? (d ? 0 : 3), v = e.retryDelay ?? G, x = typeof v == "function" ? v(n, h) : v, N = y === !0 || typeof y == "number" && n < y || typeof y == "function" && y(n, h);
295
- if (t || !N) {
296
- b(h);
297
- return;
298
- }
299
- n++, e.onFail?.(n, h), z(x).then(() => f() ? void 0 : O()).then(() => {
300
- t ? b(h) : m();
301
- });
302
- });
303
- };
304
- return {
305
- promise: o,
306
- cancel: l,
307
- continue: () => (s?.(), o),
308
- cancelRetry: i,
309
- continueRetry: u,
310
- canStart: c,
311
- start: () => (c() ? m() : O().then(m), o)
312
- };
313
- }
314
- function V() {
315
- let e = [], t = 0, n = (i) => {
316
- i();
317
- }, r = (i) => {
318
- i();
319
- }, s = (i) => setTimeout(i, 0);
320
- const o = (i) => {
321
- t ? e.push(i) : s(() => {
322
- n(i);
323
- });
324
- }, l = () => {
325
- const i = e;
326
- e = [], i.length && s(() => {
327
- r(() => {
328
- i.forEach((u) => {
329
- n(u);
330
- });
331
- });
332
- });
333
- };
334
- return {
335
- batch: (i) => {
336
- let u;
337
- t++;
338
- try {
339
- u = i();
340
- } finally {
341
- t--, t || l();
342
- }
343
- return u;
344
- },
345
- /**
346
- * All calls to the wrapped function will be batched.
347
- */
348
- batchCalls: (i) => (...u) => {
349
- o(() => {
350
- i(...u);
351
- });
352
- },
353
- schedule: o,
354
- /**
355
- * Use this method to set a custom notify function.
356
- * This can be used to for example wrap notifications with `React.act` while running tests.
357
- */
358
- setNotifyFunction: (i) => {
359
- n = i;
360
- },
361
- /**
362
- * Use this method to set a custom function to batch notifications together into a single tick.
363
- * By default React Query will use the batch function provided by ReactDOM or React Native.
364
- */
365
- setBatchNotifyFunction: (i) => {
366
- r = i;
367
- },
368
- setScheduler: (i) => {
369
- s = i;
370
- }
371
- };
372
- }
373
- var ue = V(), ce = class {
374
- #e;
375
- destroy() {
376
- this.clearGcTimeout();
377
- }
378
- scheduleGc() {
379
- this.clearGcTimeout(), Q(this.gcTime) && (this.#e = setTimeout(() => {
380
- this.optionalRemove();
381
- }, this.gcTime));
382
- }
383
- updateGcTime(e) {
384
- this.gcTime = Math.max(
385
- this.gcTime || 0,
386
- e ?? (d ? 1 / 0 : 5 * 60 * 1e3)
387
- );
388
- }
389
- clearGcTimeout() {
390
- this.#e && (clearTimeout(this.#e), this.#e = void 0);
391
- }
392
- }, k = F.createContext(
393
- void 0
394
- ), ae = (e) => {
395
- const t = F.useContext(k);
396
- if (!t)
397
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
398
- return t;
399
- }, le = ({
400
- client: e,
401
- children: t
402
- }) => (F.useEffect(() => (e.mount(), () => {
403
- e.unmount();
404
- }), [e]), /* @__PURE__ */ R(k.Provider, { value: e, children: t }));
405
- export {
406
- le as Q,
407
- ce as R,
408
- C as S,
409
- J as a,
410
- X as b,
411
- oe as c,
412
- H as d,
413
- se as e,
414
- ee as f,
415
- W as g,
416
- w as h,
417
- ie as i,
418
- d as j,
419
- Q as k,
420
- I as l,
421
- K as m,
422
- ue as n,
423
- Y as o,
424
- U as p,
425
- Z as q,
426
- te as r,
427
- P as s,
428
- B as t,
429
- ae as u,
430
- re as v,
431
- ne as w,
432
- L as x,
433
- _ as y,
434
- S as z
435
- };
@@ -1,28 +0,0 @@
1
- var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
- function f(e) {
3
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
4
- }
5
- function l(e) {
6
- if (e.__esModule) return e;
7
- var r = e.default;
8
- if (typeof r == "function") {
9
- var t = function o() {
10
- return this instanceof o ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
11
- };
12
- t.prototype = r.prototype;
13
- } else t = {};
14
- return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
15
- var n = Object.getOwnPropertyDescriptor(e, o);
16
- Object.defineProperty(t, o, n.get ? n : {
17
- enumerable: !0,
18
- get: function() {
19
- return e[o];
20
- }
21
- });
22
- }), t;
23
- }
24
- export {
25
- l as a,
26
- u as c,
27
- f as g
28
- };