@hortiview/modulebase 0.0.1 → 0.0.17-beta

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 (80) hide show
  1. package/README.md +8 -8
  2. package/dist/ModuleCore-YCIFN_02.js +14973 -0
  3. package/dist/QueryClientProvider-Beog9TR7.js +437 -0
  4. package/dist/{_baseGet-Bh5zJ_C8.js → _baseGet-C6jMXSsQ.js} +448 -448
  5. package/dist/api-s6E2GJtu.js +458 -0
  6. package/dist/assets/ModuleCore.css +1 -0
  7. package/dist/chunk-QMGIS6GS-C4bgXQXY.js +9203 -0
  8. package/dist/components/ModuleBase.js +20 -681
  9. package/dist/components/ModuleCore.js +10 -0
  10. package/dist/hooks/useBreadcrumbTranslation.js +16 -13
  11. package/dist/hooks/useCustom.js +15 -15
  12. package/dist/hooks/useCustomMutation.js +23 -0
  13. package/dist/hooks/useEntity.js +53 -54
  14. package/dist/hooks/useOffline.js +45 -0
  15. package/dist/hooks/useOption.js +19 -17
  16. package/dist/hooks/useServiceBus.js +25 -0
  17. package/dist/hooks/useStores.js +11 -841
  18. package/dist/isRestoring-CLuxJVSA.js +281 -0
  19. package/dist/lib/components/ModuleBase.d.ts +36 -0
  20. package/dist/lib/components/ModuleCore.d.ts +32 -0
  21. package/dist/{constants.d.ts → lib/constants.d.ts} +1 -1
  22. package/dist/{hooks → lib/hooks}/useBreadcrumbTranslation.d.ts +1 -1
  23. package/dist/lib/hooks/useCustom.d.ts +8 -0
  24. package/dist/lib/hooks/useCustomMutation.d.ts +9 -0
  25. package/dist/{hooks → lib/hooks}/useEntity.d.ts +6 -30
  26. package/dist/lib/hooks/useOffline.d.ts +15 -0
  27. package/dist/{hooks → lib/hooks}/useOption.d.ts +1 -1
  28. package/dist/lib/hooks/useServiceBus.d.ts +19 -0
  29. package/dist/lib/hooks/useStores.d.ts +38 -0
  30. package/dist/lib/main.d.ts +27 -0
  31. package/dist/lib/module-router.d.ts +7 -0
  32. package/dist/{stores → lib/stores}/EnvironmentStore.d.ts +1 -1
  33. package/dist/lib/types/ActionStorage.d.ts +16 -0
  34. package/dist/{types → lib/types}/BaseProps.d.ts +14 -2
  35. package/dist/{types → lib/types}/Deprecated.d.ts +7 -1
  36. package/dist/lib/types/Entities.d.ts +22 -0
  37. package/dist/{types → lib/types}/Environment.d.ts +3 -2
  38. package/dist/lib/types/EnvironmentVariable.d.ts +6 -0
  39. package/dist/lib/types/ModuleApi.d.ts +163 -0
  40. package/dist/{types → lib/types}/Requests.d.ts +6 -11
  41. package/dist/lib/types/ServiceBus.d.ts +17 -0
  42. package/dist/{utils/fetches.d.ts → lib/utils/api.d.ts} +2 -8
  43. package/dist/lib/utils/baseFetches.d.ts +19 -0
  44. package/dist/lib/utils/fetches.d.ts +43 -0
  45. package/dist/lib/utils/helper.d.ts +29 -0
  46. package/dist/main.js +224 -17
  47. package/dist/module-router.js +137 -0
  48. package/dist/mutation-DSKlaYzY.js +192 -0
  49. package/dist/omit-C9Qe80rl.js +835 -0
  50. package/dist/stores/EnvironmentStore.js +9 -3
  51. package/dist/types/ActionStorage.js +4 -0
  52. package/dist/types/Entities.js +25 -0
  53. package/dist/types/EnvironmentVariable.js +1 -0
  54. package/dist/types/Requests.js +1 -4
  55. package/dist/types/ServiceBus.js +1 -0
  56. package/dist/useMutation-zu8uxBak.js +97 -0
  57. package/dist/{useQuery-znAyMQW1.js → useQuery-Bj9k9zik.js} +106 -108
  58. package/dist/utils/api.js +9 -0
  59. package/dist/utils/baseFetches.js +19 -0
  60. package/dist/utils/fetches.js +20 -14
  61. package/dist/utils/helper.js +55 -0
  62. package/dist/utils-DxRR_XLb.js +9 -0
  63. package/package.json +8 -3
  64. package/dist/QueryClientProvider-DQv4Y3Qu.js +0 -707
  65. package/dist/chunk-IR6S3I6Y-BvQXS3A3.js +0 -3908
  66. package/dist/components/ModuleBase.d.ts +0 -11
  67. package/dist/fetches-DUCQo_6B.js +0 -477
  68. package/dist/hooks/useCustom.d.ts +0 -6
  69. package/dist/hooks/useNavigate.d.ts +0 -5
  70. package/dist/hooks/useNavigate.js +0 -27
  71. package/dist/hooks/useStores.d.ts +0 -29
  72. package/dist/main.d.ts +0 -9
  73. package/dist/types/ModuleApi.d.ts +0 -80
  74. /package/dist/{hooks → lib/hooks}/useSignalRMessages.d.ts +0 -0
  75. /package/dist/{provider → lib/provider}/SignalR/SignalRProvider.d.ts +0 -0
  76. /package/dist/{provider → lib/provider}/SignalR/signalR.d.ts +0 -0
  77. /package/dist/{stores → lib/stores}/BasePropsStore.d.ts +0 -0
  78. /package/dist/{types → lib/types}/AppInsights.d.ts +0 -0
  79. /package/dist/{types → lib/types}/CommonOptions.d.ts +0 -0
  80. /package/dist/{types → lib/types}/SystemMessage.d.ts +0 -0
@@ -1,9 +1,15 @@
1
1
  import { c as r } from "../react-QiIgv49H.js";
2
- const i = r((e) => ({
3
- environment: void 0,
2
+ const E = r((e) => ({
3
+ environment: {
4
+ ENVIRONMENT: "DEV",
5
+ COMMON_API: "",
6
+ REQ_VERSION: "",
7
+ MODULE_AUTH_API: "",
8
+ API_PREFIX: ""
9
+ },
4
10
  setEnvironment: (n) => e({ environment: n }),
5
11
  addEnvironment: (n) => e((o) => ({ environment: { ...n, ...o.environment } }))
6
12
  }));
7
13
  export {
8
- i as useEnvironmentStore
14
+ E as useEnvironmentStore
9
15
  };
@@ -0,0 +1,4 @@
1
+ var R = /* @__PURE__ */ ((E) => (E.PENDING = "PENDING", E.SUCCESS = "RESOLVED", E.ERROR = "REJECTED", E))(R || {});
2
+ export {
3
+ R as ActionState
4
+ };
@@ -0,0 +1,25 @@
1
+ const e = {
2
+ farms: "farm",
3
+ fields: "field",
4
+ zones: "block",
5
+ irrigation_stations: "irrigationStation",
6
+ farm_organizations: "farmOrg",
7
+ alert_rules: "farmAlertRule"
8
+ }, t = {
9
+ farm_members: "member"
10
+ }, a = {
11
+ Season: "season",
12
+ BlockPlantLayout: "blockPlantLayout",
13
+ Record: "recordLight",
14
+ Scouting: "scouting"
15
+ }, r = {
16
+ ...e,
17
+ ...t,
18
+ ...a
19
+ };
20
+ export {
21
+ r as AllEntitiesTypeResultMap,
22
+ t as FarmMemberEntitiesTypeResultMap,
23
+ e as FarmOrgEntitiesTypeResultMap,
24
+ a as ModuleDependedEntityTypeResultMap
25
+ };
@@ -0,0 +1 @@
1
+
@@ -1,4 +1 @@
1
- const r = (e) => typeof e == "string" || typeof e == "boolean" || typeof e == "number" ? e : typeof e == "object" && "value" in e ? e.value : typeof e == "object" && "items" in e ? e.items : (Array.isArray(e), e);
2
- export {
3
- r as universalSelector
4
- };
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,97 @@
1
+ import * as o from "react";
2
+ import { g as l } from "./mutation-DSKlaYzY.js";
3
+ import { S as d, s as p, h, n as a, u as b } from "./QueryClientProvider-Beog9TR7.js";
4
+ import { n as m, s as f } from "./utils-DxRR_XLb.js";
5
+ var v = class extends d {
6
+ #e;
7
+ #i = void 0;
8
+ #t;
9
+ #s;
10
+ constructor(t, s) {
11
+ super(), this.#e = t, this.setOptions(s), this.bindMethods(), this.#r();
12
+ }
13
+ bindMethods() {
14
+ this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
15
+ }
16
+ setOptions(t) {
17
+ const s = this.options;
18
+ this.options = this.#e.defaultMutationOptions(t), p(this.options, s) || this.#e.getMutationCache().notify({
19
+ type: "observerOptionsUpdated",
20
+ mutation: this.#t,
21
+ observer: this
22
+ }), s?.mutationKey && this.options.mutationKey && h(s.mutationKey) !== h(this.options.mutationKey) ? this.reset() : this.#t?.state.status === "pending" && this.#t.setOptions(this.options);
23
+ }
24
+ onUnsubscribe() {
25
+ this.hasListeners() || this.#t?.removeObserver(this);
26
+ }
27
+ onMutationUpdate(t) {
28
+ this.#r(), this.#o(t);
29
+ }
30
+ getCurrentResult() {
31
+ return this.#i;
32
+ }
33
+ reset() {
34
+ this.#t?.removeObserver(this), this.#t = void 0, this.#r(), this.#o();
35
+ }
36
+ mutate(t, s) {
37
+ return this.#s = s, this.#t?.removeObserver(this), this.#t = this.#e.getMutationCache().build(this.#e, this.options), this.#t.addObserver(this), this.#t.execute(t);
38
+ }
39
+ #r() {
40
+ const t = this.#t?.state ?? l();
41
+ this.#i = {
42
+ ...t,
43
+ isPending: t.status === "pending",
44
+ isSuccess: t.status === "success",
45
+ isError: t.status === "error",
46
+ isIdle: t.status === "idle",
47
+ mutate: this.mutate,
48
+ reset: this.reset
49
+ };
50
+ }
51
+ #o(t) {
52
+ a.batch(() => {
53
+ if (this.#s && this.hasListeners()) {
54
+ const s = this.#i.variables, i = this.#i.context;
55
+ t?.type === "success" ? (this.#s.onSuccess?.(t.data, s, i), this.#s.onSettled?.(t.data, null, s, i)) : t?.type === "error" && (this.#s.onError?.(t.error, s, i), this.#s.onSettled?.(
56
+ void 0,
57
+ t.error,
58
+ s,
59
+ i
60
+ ));
61
+ }
62
+ this.listeners.forEach((s) => {
63
+ s(this.#i);
64
+ });
65
+ });
66
+ }
67
+ };
68
+ function M(t, s) {
69
+ const i = b(s), [e] = o.useState(
70
+ () => new v(
71
+ i,
72
+ t
73
+ )
74
+ );
75
+ o.useEffect(() => {
76
+ e.setOptions(t);
77
+ }, [e, t]);
78
+ const r = o.useSyncExternalStore(
79
+ o.useCallback(
80
+ (n) => e.subscribe(a.batchCalls(n)),
81
+ [e]
82
+ ),
83
+ () => e.getCurrentResult(),
84
+ () => e.getCurrentResult()
85
+ ), u = o.useCallback(
86
+ (n, c) => {
87
+ e.mutate(n, c).catch(m);
88
+ },
89
+ [e]
90
+ );
91
+ if (r.error && f(e.options.throwOnError, [r.error]))
92
+ throw r.error;
93
+ return { ...r, mutate: u, mutateAsync: r.mutate };
94
+ }
95
+ export {
96
+ M as u
97
+ };
@@ -1,7 +1,9 @@
1
- import { S as N, l as U, q as f, t as w, r as O, b as z, u as Q, v as M, w as V, g as q, x as W, y as _, n as B, z as K } from "./QueryClientProvider-DQv4Y3Qu.js";
2
- import * as p from "react";
1
+ import { S as B, p as U, b as f, s as w, g as O, a as N, j as Q, k, t as H, l as V, r as M, n as A, u as z } from "./QueryClientProvider-Beog9TR7.js";
2
+ import { f as W, u as $ } from "./isRestoring-CLuxJVSA.js";
3
+ import * as y from "react";
3
4
  import "react/jsx-runtime";
4
- var $ = class extends N {
5
+ import { s as K, n as _ } from "./utils-DxRR_XLb.js";
6
+ var G = class extends B {
5
7
  constructor(e, t) {
6
8
  super(), this.options = t, this.#s = e, this.#r = null, this.#i = U(), this.options.experimental_prefetchInRender || this.#i.reject(
7
9
  new Error("experimental_prefetchInRender feature flag is not enabled")
@@ -15,20 +17,20 @@ var $ = class extends N {
15
17
  #c;
16
18
  #i;
17
19
  #r;
18
- #b;
20
+ #y;
19
21
  #l;
20
22
  // This property keeps track of the last query with defined data.
21
23
  // It will be used to pass the previous data and query to the placeholder function between renders.
22
24
  #d;
23
- #h;
24
25
  #o;
26
+ #h;
25
27
  #n;
26
28
  #f = /* @__PURE__ */ new Set();
27
29
  bindMethods() {
28
30
  this.refetch = this.refetch.bind(this);
29
31
  }
30
32
  onSubscribe() {
31
- this.listeners.size === 1 && (this.#e.addObserver(this), k(this.#e, this.options) ? this.#u() : this.updateResult(), this.#m());
33
+ this.listeners.size === 1 && (this.#e.addObserver(this), j(this.#e, this.options) ? this.#u() : this.updateResult(), this.#R());
32
34
  }
33
35
  onUnsubscribe() {
34
36
  this.hasListeners() || this.destroy();
@@ -67,13 +69,13 @@ var $ = class extends N {
67
69
  r,
68
70
  this.options,
69
71
  s
70
- ) && this.#u(), this.updateResult(t), a && (this.#e !== r || f(this.options.enabled, this.#e) !== f(s.enabled, this.#e) || O(this.options.staleTime, this.#e) !== O(s.staleTime, this.#e)) && this.#y();
71
- const u = this.#R();
72
+ ) && this.#u(), this.updateResult(t), a && (this.#e !== r || f(this.options.enabled, this.#e) !== f(s.enabled, this.#e) || O(this.options.staleTime, this.#e) !== O(s.staleTime, this.#e)) && this.#b();
73
+ const u = this.#m();
72
74
  a && (this.#e !== r || f(this.options.enabled, this.#e) !== f(s.enabled, this.#e) || u !== this.#n) && this.#g(u);
73
75
  }
74
76
  getOptimisticResult(e) {
75
77
  const t = this.#s.getQueryCache().build(this.#s, e), s = this.createResult(t, e);
76
- return J(this, s) && (this.#t = s, this.#c = this.options, this.#a = this.#e.state), s;
78
+ return X(this, s) && (this.#t = s, this.#c = this.options, this.#a = this.#e.state), s;
77
79
  }
78
80
  getCurrentResult() {
79
81
  return this.#t;
@@ -115,123 +117,123 @@ var $ = class extends N {
115
117
  this.options,
116
118
  e
117
119
  );
118
- return e?.throwOnError || (t = t.catch(z)), t;
120
+ return e?.throwOnError || (t = t.catch(N)), t;
119
121
  }
120
- #y() {
122
+ #b() {
121
123
  this.#v();
122
124
  const e = O(
123
125
  this.options.staleTime,
124
126
  this.#e
125
127
  );
126
- if (Q || this.#t.isStale || !M(e))
128
+ if (Q || this.#t.isStale || !k(e))
127
129
  return;
128
- const s = V(this.#t.dataUpdatedAt, e) + 1;
129
- this.#h = setTimeout(() => {
130
+ const s = H(this.#t.dataUpdatedAt, e) + 1;
131
+ this.#o = setTimeout(() => {
130
132
  this.#t.isStale || this.updateResult();
131
133
  }, s);
132
134
  }
133
- #R() {
135
+ #m() {
134
136
  return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#e) : this.options.refetchInterval) ?? !1;
135
137
  }
136
138
  #g(e) {
137
- this.#O(), this.#n = e, !(Q || f(this.options.enabled, this.#e) === !1 || !M(this.#n) || this.#n === 0) && (this.#o = setInterval(() => {
138
- (this.options.refetchIntervalInBackground || q.isFocused()) && this.#u();
139
+ this.#O(), this.#n = e, !(Q || f(this.options.enabled, this.#e) === !1 || !k(this.#n) || this.#n === 0) && (this.#h = setInterval(() => {
140
+ (this.options.refetchIntervalInBackground || V.isFocused()) && this.#u();
139
141
  }, this.#n));
140
142
  }
141
- #m() {
142
- this.#y(), this.#g(this.#R());
143
+ #R() {
144
+ this.#b(), this.#g(this.#m());
143
145
  }
144
146
  #v() {
145
- this.#h && (clearTimeout(this.#h), this.#h = void 0);
147
+ this.#o && (clearTimeout(this.#o), this.#o = void 0);
146
148
  }
147
149
  #O() {
148
- this.#o && (clearInterval(this.#o), this.#o = void 0);
150
+ this.#h && (clearInterval(this.#h), this.#h = void 0);
149
151
  }
150
152
  createResult(e, t) {
151
- const s = this.#e, r = this.options, a = this.#t, u = this.#a, i = this.#c, h = e !== s ? e.state : this.#p, { state: c } = e;
152
- let n = { ...c }, m = !1, l;
153
+ const s = this.#e, r = this.options, a = this.#t, u = this.#a, i = this.#c, o = e !== s ? e.state : this.#p, { state: c } = e;
154
+ let n = { ...c }, R = !1, l;
153
155
  if (t._optimisticResults) {
154
- const o = this.hasListeners(), y = !o && k(e, t), R = o && L(e, s, t, r);
155
- (y || R) && (n = {
156
+ const h = this.hasListeners(), b = !h && j(e, t), m = h && L(e, s, t, r);
157
+ (b || m) && (n = {
156
158
  ...n,
157
159
  ...W(c.data, e.options)
158
160
  }), t._optimisticResults === "isRestoring" && (n.fetchStatus = "idle");
159
161
  }
160
- let { error: x, errorUpdatedAt: F, status: b } = n;
162
+ let { error: F, errorUpdatedAt: x, status: p } = n;
161
163
  if (t.select && n.data !== void 0)
162
- if (a && n.data === u?.data && t.select === this.#b)
164
+ if (a && n.data === u?.data && t.select === this.#y)
163
165
  l = this.#l;
164
166
  else
165
167
  try {
166
- this.#b = t.select, l = t.select(n.data), l = _(a?.data, l, t), this.#l = l, this.#r = null;
167
- } catch (o) {
168
- this.#r = o;
168
+ this.#y = t.select, l = t.select(n.data), l = M(a?.data, l, t), this.#l = l, this.#r = null;
169
+ } catch (h) {
170
+ this.#r = h;
169
171
  }
170
172
  else
171
173
  l = n.data;
172
- if (t.placeholderData !== void 0 && l === void 0 && b === "pending") {
173
- let o;
174
+ if (t.placeholderData !== void 0 && l === void 0 && p === "pending") {
175
+ let h;
174
176
  if (a?.isPlaceholderData && t.placeholderData === i?.placeholderData)
175
- o = a.data;
176
- else if (o = typeof t.placeholderData == "function" ? t.placeholderData(
177
+ h = a.data;
178
+ else if (h = typeof t.placeholderData == "function" ? t.placeholderData(
177
179
  this.#d?.state.data,
178
180
  this.#d
179
- ) : t.placeholderData, t.select && o !== void 0)
181
+ ) : t.placeholderData, t.select && h !== void 0)
180
182
  try {
181
- o = t.select(o), this.#r = null;
182
- } catch (y) {
183
- this.#r = y;
183
+ h = t.select(h), this.#r = null;
184
+ } catch (b) {
185
+ this.#r = b;
184
186
  }
185
- o !== void 0 && (b = "success", l = _(
187
+ h !== void 0 && (p = "success", l = M(
186
188
  a?.data,
187
- o,
189
+ h,
188
190
  t
189
- ), m = !0);
191
+ ), R = !0);
190
192
  }
191
- this.#r && (x = this.#r, l = this.#l, F = Date.now(), b = "error");
192
- const C = n.fetchStatus === "fetching", S = b === "pending", E = b === "error", P = S && C, D = l !== void 0, d = {
193
- status: b,
193
+ this.#r && (F = this.#r, l = this.#l, x = Date.now(), p = "error");
194
+ const C = n.fetchStatus === "fetching", S = p === "pending", E = p === "error", D = S && C, P = l !== void 0, d = {
195
+ status: p,
194
196
  fetchStatus: n.fetchStatus,
195
197
  isPending: S,
196
- isSuccess: b === "success",
198
+ isSuccess: p === "success",
197
199
  isError: E,
198
- isInitialLoading: P,
199
- isLoading: P,
200
+ isInitialLoading: D,
201
+ isLoading: D,
200
202
  data: l,
201
203
  dataUpdatedAt: n.dataUpdatedAt,
202
- error: x,
203
- errorUpdatedAt: F,
204
+ error: F,
205
+ errorUpdatedAt: x,
204
206
  failureCount: n.fetchFailureCount,
205
207
  failureReason: n.fetchFailureReason,
206
208
  errorUpdateCount: n.errorUpdateCount,
207
209
  isFetched: n.dataUpdateCount > 0 || n.errorUpdateCount > 0,
208
- isFetchedAfterMount: n.dataUpdateCount > h.dataUpdateCount || n.errorUpdateCount > h.errorUpdateCount,
210
+ isFetchedAfterMount: n.dataUpdateCount > o.dataUpdateCount || n.errorUpdateCount > o.errorUpdateCount,
209
211
  isFetching: C,
210
212
  isRefetching: C && !S,
211
- isLoadingError: E && !D,
213
+ isLoadingError: E && !P,
212
214
  isPaused: n.fetchStatus === "paused",
213
- isPlaceholderData: m,
214
- isRefetchError: E && D,
215
+ isPlaceholderData: R,
216
+ isRefetchError: E && P,
215
217
  isStale: I(e, t),
216
218
  refetch: this.refetch,
217
219
  promise: this.#i
218
220
  };
219
221
  if (this.options.experimental_prefetchInRender) {
220
- const o = (v) => {
222
+ const h = (v) => {
221
223
  d.status === "error" ? v.reject(d.error) : d.data !== void 0 && v.resolve(d.data);
222
- }, y = () => {
224
+ }, b = () => {
223
225
  const v = this.#i = d.promise = U();
224
- o(v);
225
- }, R = this.#i;
226
- switch (R.status) {
226
+ h(v);
227
+ }, m = this.#i;
228
+ switch (m.status) {
227
229
  case "pending":
228
- e.queryHash === s.queryHash && o(R);
230
+ e.queryHash === s.queryHash && h(m);
229
231
  break;
230
232
  case "fulfilled":
231
- (d.status === "error" || d.data !== R.value) && y();
233
+ (d.status === "error" || d.data !== m.value) && b();
232
234
  break;
233
235
  case "rejected":
234
- (d.status !== "error" || d.error !== R.reason) && y();
236
+ (d.status !== "error" || d.error !== m.reason) && b();
235
237
  break;
236
238
  }
237
239
  }
@@ -251,8 +253,8 @@ var $ = class extends N {
251
253
  const g = new Set(
252
254
  i ?? this.#f
253
255
  );
254
- return this.options.throwOnError && g.add("error"), Object.keys(this.#t).some((h) => {
255
- const c = h;
256
+ return this.options.throwOnError && g.add("error"), Object.keys(this.#t).some((o) => {
257
+ const c = o;
256
258
  return this.#t[c] !== t[c] && g.has(c);
257
259
  });
258
260
  };
@@ -266,10 +268,10 @@ var $ = class extends N {
266
268
  this.#e = e, this.#p = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
267
269
  }
268
270
  onQueryUpdate() {
269
- this.updateResult(), this.hasListeners() && this.#m();
271
+ this.updateResult(), this.hasListeners() && this.#R();
270
272
  }
271
273
  #S(e) {
272
- B.batch(() => {
274
+ A.batch(() => {
273
275
  e.listeners && this.listeners.forEach((t) => {
274
276
  t(this.#t);
275
277
  }), this.#s.getQueryCache().notify({
@@ -279,11 +281,11 @@ var $ = class extends N {
279
281
  });
280
282
  }
281
283
  };
282
- function G(e, t) {
284
+ function J(e, t) {
283
285
  return f(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
284
286
  }
285
- function k(e, t) {
286
- return G(e, t) || e.state.data !== void 0 && T(e, t, t.refetchOnMount);
287
+ function j(e, t) {
288
+ return J(e, t) || e.state.data !== void 0 && T(e, t, t.refetchOnMount);
287
289
  }
288
290
  function T(e, t, s) {
289
291
  if (f(t.enabled, e) !== !1) {
@@ -298,11 +300,9 @@ function L(e, t, s, r) {
298
300
  function I(e, t) {
299
301
  return f(t.enabled, e) !== !1 && e.isStaleByTime(O(t.staleTime, e));
300
302
  }
301
- function J(e, t) {
303
+ function X(e, t) {
302
304
  return !w(e.getCurrentResult(), t);
303
305
  }
304
- var H = p.createContext(!1), X = () => p.useContext(H);
305
- H.Provider;
306
306
  function Y() {
307
307
  let e = !1;
308
308
  return {
@@ -315,28 +315,22 @@ function Y() {
315
315
  isReset: () => e
316
316
  };
317
317
  }
318
- var Z = p.createContext(Y()), ee = () => p.useContext(Z);
319
- function te(e, t) {
320
- return typeof e == "function" ? e(...t) : !!e;
321
- }
322
- function j() {
323
- }
324
- var se = (e, t) => {
318
+ var Z = y.createContext(Y()), ee = () => y.useContext(Z), te = (e, t) => {
325
319
  (e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
326
- }, re = (e) => {
327
- p.useEffect(() => {
320
+ }, se = (e) => {
321
+ y.useEffect(() => {
328
322
  e.clearReset();
329
323
  }, [e]);
330
- }, ie = ({
324
+ }, re = ({
331
325
  result: e,
332
326
  errorResetBoundary: t,
333
327
  throwOnError: s,
334
328
  query: r,
335
329
  suspense: a
336
- }) => e.isError && !t.isReset() && !e.isFetching && r && (a && e.data === void 0 || te(s, [e.error, r])), ne = (e) => {
330
+ }) => e.isError && !t.isReset() && !e.isFetching && r && (a && e.data === void 0 || K(s, [e.error, r])), ie = (e) => {
337
331
  const t = e.staleTime;
338
332
  e.suspense && (e.staleTime = typeof t == "function" ? (...s) => Math.max(t(...s), 1e3) : Math.max(t ?? 1e3, 1e3), typeof e.gcTime == "number" && (e.gcTime = Math.max(e.gcTime, 1e3)));
339
- }, ae = (e, t) => e.isLoading && e.isFetching && !t, he = (e, t) => e?.suspense && t.isPending, A = (e, t, s) => t.fetchOptimistic(e).catch(() => {
333
+ }, ne = (e, t) => e.isLoading && e.isFetching && !t, ae = (e, t) => e?.suspense && t.isPending, q = (e, t, s) => t.fetchOptimistic(e).catch(() => {
340
334
  s.clearReset();
341
335
  });
342
336
  function oe(e, t, s) {
@@ -344,31 +338,33 @@ function oe(e, t, s) {
344
338
  throw new Error(
345
339
  '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'
346
340
  );
347
- const r = K(), a = X(), u = ee(), i = r.defaultQueryOptions(e);
341
+ const r = z(s), a = $(), u = ee(), i = r.defaultQueryOptions(e);
348
342
  r.getDefaultOptions().queries?._experimental_beforeQuery?.(
349
343
  i
350
- ), i._optimisticResults = a ? "isRestoring" : "optimistic", ne(i), se(i, u), re(u);
351
- const g = !r.getQueryCache().get(i.queryHash), [h] = p.useState(
344
+ ), process.env.NODE_ENV !== "production" && (i.queryFn || console.error(
345
+ `[${i.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`
346
+ )), i._optimisticResults = a ? "isRestoring" : "optimistic", ie(i), te(i, u), se(u);
347
+ const g = !r.getQueryCache().get(i.queryHash), [o] = y.useState(
352
348
  () => new t(
353
349
  r,
354
350
  i
355
351
  )
356
- ), c = h.getOptimisticResult(i), n = !a && e.subscribed !== !1;
357
- if (p.useSyncExternalStore(
358
- p.useCallback(
359
- (m) => {
360
- const l = n ? h.subscribe(B.batchCalls(m)) : j;
361
- return h.updateResult(), l;
352
+ ), c = o.getOptimisticResult(i), n = !a && e.subscribed !== !1;
353
+ if (y.useSyncExternalStore(
354
+ y.useCallback(
355
+ (R) => {
356
+ const l = n ? o.subscribe(A.batchCalls(R)) : _;
357
+ return o.updateResult(), l;
362
358
  },
363
- [h, n]
359
+ [o, n]
364
360
  ),
365
- () => h.getCurrentResult(),
366
- () => h.getCurrentResult()
367
- ), p.useEffect(() => {
368
- h.setOptions(i, { listeners: !1 });
369
- }, [i, h]), he(i, c))
370
- throw A(i, h, u);
371
- if (ie({
361
+ () => o.getCurrentResult(),
362
+ () => o.getCurrentResult()
363
+ ), y.useEffect(() => {
364
+ o.setOptions(i, { listeners: !1 });
365
+ }, [i, o]), ae(i, c))
366
+ throw q(i, o, u);
367
+ if (re({
372
368
  result: c,
373
369
  errorResetBoundary: u,
374
370
  throwOnError: i.throwOnError,
@@ -379,19 +375,21 @@ function oe(e, t, s) {
379
375
  return r.getDefaultOptions().queries?._experimental_afterQuery?.(
380
376
  i,
381
377
  c
382
- ), i.experimental_prefetchInRender && !Q && ae(c, a) && (g ? (
378
+ ), i.experimental_prefetchInRender && !Q && ne(c, a) && (g ? (
383
379
  // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
384
- A(i, h, u)
380
+ q(i, o, u)
385
381
  ) : (
386
382
  // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
387
383
  r.getQueryCache().get(i.queryHash)?.promise
388
- ))?.catch(j).finally(() => {
389
- h.updateResult();
390
- }), i.notifyOnChangeProps ? c : h.trackResult(c);
384
+ ))?.catch(_).finally(() => {
385
+ o.updateResult();
386
+ }), i.notifyOnChangeProps ? c : o.trackResult(c);
391
387
  }
392
- function de(e, t) {
393
- return oe(e, $);
388
+ function fe(e, t) {
389
+ return oe(e, G, t);
394
390
  }
395
391
  export {
396
- de as u
392
+ G as Q,
393
+ oe as a,
394
+ fe as u
397
395
  };
@@ -0,0 +1,9 @@
1
+ import { f as t, b as s, a as f, h as i } from "../api-s6E2GJtu.js";
2
+ import "../constants.js";
3
+ import "../stores/BasePropsStore.js";
4
+ export {
5
+ t as fetchWithErrorHandling,
6
+ s as formatQuery,
7
+ f as getConfig,
8
+ i as handleResponse
9
+ };
@@ -0,0 +1,19 @@
1
+ import { a as u, f as m, i as S, b as I } from "../api-s6E2GJtu.js";
2
+ import { useBasePropsStore as t } from "../stores/BasePropsStore.js";
3
+ const E = (s, e, g, o, r, n = !1) => {
4
+ const a = n ? void 0 : o ?? t.getState().modulePermissionToken, i = t.getState().organizationId, c = t.getState().currentLanguageId, d = t.getState().throwError;
5
+ if (!n && !a)
6
+ return d?.("No token found", 404), Promise.reject();
7
+ const f = u(a, i, c, g, r);
8
+ return f.body = JSON.stringify(e), m(s, f);
9
+ }, h = (s, e, g, o = !1) => {
10
+ const r = o ? void 0 : g ?? t.getState().modulePermissionToken, n = t.getState().organizationId, a = t.getState().currentLanguageId, i = t.getState().throwError;
11
+ if (!o && !r)
12
+ return i?.("No token found", 404), Promise.reject();
13
+ const c = u(r, n, a), d = S(e) ? "" : I(e);
14
+ return m(`${s}${d}`, c);
15
+ };
16
+ export {
17
+ h as baseFetch,
18
+ E as baseMutation
19
+ };
@@ -1,16 +1,22 @@
1
- import { e as r, f as i, d as m, c as n, i as p, k as f, h, a as d, g, j as c } from "../fetches-DUCQo_6B.js";
2
- import "../constants.js";
3
- import "../stores/BasePropsStore.js";
4
- import "../stores/EnvironmentStore.js";
1
+ import { useBasePropsStore as a } from "../stores/BasePropsStore.js";
2
+ import { useEnvironmentStore as i } from "../stores/EnvironmentStore.js";
3
+ import { baseMutation as d, baseFetch as o } from "./baseFetches.js";
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
+ return o(
7
+ `${t?.MODULE_AUTH_API}${t?.API_PREFIX}/${n}/${e}`,
8
+ {}
9
+ );
10
+ }, f = (e) => {
11
+ const t = i.getState().environment;
12
+ return o(`${t?.COMMON_API}${t?.API_PREFIX}/${e}`, {});
13
+ };
5
14
  export {
6
- r as baseFetch,
7
- i as fetchFromCommonApi,
8
- m as fetchFromCustomApi,
9
- n as fetchFromModuleApi,
10
- p as fetchWithErrorHandling,
11
- f as formatQuery,
12
- h as getConfig,
13
- d as getFarmOrgEntities,
14
- g as getModuleDependedEntities,
15
- c as handleResponse
15
+ f as fetchFromCommonApi,
16
+ M as fetchFromCustomApi,
17
+ r as fetchFromModuleApi,
18
+ g as getFarmOrgEntities,
19
+ E as getModuleDependedEntities,
20
+ A as getModuleDependedEntitiesRaw,
21
+ I as mutateOnCustomApi
16
22
  };