@hortiview/modulebase 0.0.1-7.1-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 (85) hide show
  1. package/README.md +8 -0
  2. package/dist/ModuleCore-YCIFN_02.js +14973 -0
  3. package/dist/QueryClientProvider-Beog9TR7.js +437 -0
  4. package/dist/_baseGet-C6jMXSsQ.js +805 -0
  5. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  6. package/dist/api-s6E2GJtu.js +458 -0
  7. package/dist/assets/ModuleCore.css +1 -0
  8. package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +8162 -0
  9. package/dist/components/ModuleBase.js +30 -0
  10. package/dist/components/ModuleCore.js +10 -0
  11. package/dist/constants.js +34 -0
  12. package/dist/hooks/useBreadcrumbTranslation.js +23 -0
  13. package/dist/hooks/useCustom.js +19 -0
  14. package/dist/hooks/useCustomMutation.js +23 -0
  15. package/dist/hooks/useEntity.js +57 -0
  16. package/dist/hooks/useOffline.js +45 -0
  17. package/dist/hooks/useOption.js +25 -0
  18. package/dist/hooks/useServiceBus.js +25 -0
  19. package/dist/hooks/useSignalRMessages.js +13 -0
  20. package/dist/hooks/useStores.js +14 -0
  21. package/dist/isRestoring-CLuxJVSA.js +281 -0
  22. package/dist/lib/components/ModuleBase.d.ts +36 -0
  23. package/dist/lib/components/ModuleCore.d.ts +32 -0
  24. package/dist/lib/constants.d.ts +25 -0
  25. package/dist/lib/hooks/useBreadcrumbTranslation.d.ts +1 -0
  26. package/dist/lib/hooks/useCustom.d.ts +8 -0
  27. package/dist/lib/hooks/useCustomMutation.d.ts +9 -0
  28. package/dist/lib/hooks/useEntity.d.ts +162 -0
  29. package/dist/lib/hooks/useOffline.d.ts +15 -0
  30. package/dist/lib/hooks/useOption.d.ts +17 -0
  31. package/dist/lib/hooks/useServiceBus.d.ts +19 -0
  32. package/dist/lib/hooks/useSignalRMessages.d.ts +6 -0
  33. package/dist/lib/hooks/useStores.d.ts +37 -0
  34. package/dist/lib/main.d.ts +27 -0
  35. package/dist/lib/module-router.d.ts +7 -0
  36. package/dist/lib/provider/SignalR/SignalRProvider.d.ts +13 -0
  37. package/dist/lib/provider/SignalR/signalR.d.ts +53 -0
  38. package/dist/lib/stores/BasePropsStore.d.ts +6 -0
  39. package/dist/lib/stores/EnvironmentStore.d.ts +8 -0
  40. package/dist/lib/types/ActionStorage.d.ts +12 -0
  41. package/dist/lib/types/AppInsights.d.ts +12 -0
  42. package/dist/lib/types/BaseProps.d.ts +49 -0
  43. package/dist/lib/types/CommonOptions.d.ts +61 -0
  44. package/dist/lib/types/Deprecated.d.ts +99 -0
  45. package/dist/lib/types/Entities.d.ts +22 -0
  46. package/dist/lib/types/Environment.d.ts +18 -0
  47. package/dist/lib/types/EnvironmentVariable.d.ts +6 -0
  48. package/dist/lib/types/ModuleApi.d.ts +163 -0
  49. package/dist/lib/types/Requests.d.ts +44 -0
  50. package/dist/lib/types/ServiceBus.d.ts +17 -0
  51. package/dist/lib/types/SystemMessage.d.ts +14 -0
  52. package/dist/lib/utils/api.d.ts +20 -0
  53. package/dist/lib/utils/baseFetches.d.ts +19 -0
  54. package/dist/lib/utils/fetches.d.ts +43 -0
  55. package/dist/lib/utils/helper.d.ts +29 -0
  56. package/dist/main.js +218 -0
  57. package/dist/module-router.js +129 -0
  58. package/dist/mutation-DSKlaYzY.js +192 -0
  59. package/dist/omit-C9Qe80rl.js +835 -0
  60. package/dist/provider/SignalR/SignalRProvider.js +6408 -0
  61. package/dist/provider/SignalR/signalR.js +11 -0
  62. package/dist/react-QiIgv49H.js +27 -0
  63. package/dist/stores/BasePropsStore.js +7 -0
  64. package/dist/stores/EnvironmentStore.js +15 -0
  65. package/dist/types/ActionStorage.js +4 -0
  66. package/dist/types/AppInsights.js +1 -0
  67. package/dist/types/BaseProps.js +1 -0
  68. package/dist/types/CommonOptions.js +4 -0
  69. package/dist/types/Deprecated.js +1 -0
  70. package/dist/types/Entities.js +25 -0
  71. package/dist/types/Environment.js +1 -0
  72. package/dist/types/EnvironmentVariable.js +1 -0
  73. package/dist/types/ModuleApi.js +1 -0
  74. package/dist/types/Requests.js +1 -0
  75. package/dist/types/ServiceBus.js +1 -0
  76. package/dist/types/SystemMessage.js +1 -0
  77. package/dist/useMutation-zu8uxBak.js +97 -0
  78. package/dist/useQuery-Bj9k9zik.js +395 -0
  79. package/dist/utils/api.js +9 -0
  80. package/dist/utils/baseFetches.js +19 -0
  81. package/dist/utils/fetches.js +22 -0
  82. package/dist/utils/helper.js +55 -0
  83. package/dist/utils-DxRR_XLb.js +9 -0
  84. package/dist/vite-env.d.js +1 -0
  85. package/package.json +60 -0
@@ -0,0 +1,11 @@
1
+ var r = /* @__PURE__ */ ((e) => (e.Create = "Create", e.Read = "Read", e.Update = "Update", e.Delete = "Delete", e))(r || {}), t = /* @__PURE__ */ ((e) => (e.Notification = "Notification", e.Alert = "Alert", e))(t || {}), l = /* @__PURE__ */ ((e) => (e.Block = "Block", e.Field = "Field", e))(l || {});
2
+ const a = {
3
+ Block: "border_clear",
4
+ Field: "grass"
5
+ };
6
+ export {
7
+ l as EntityType,
8
+ t as MessageType,
9
+ a as NotificationIcons,
10
+ r as OperationType
11
+ };
@@ -0,0 +1,27 @@
1
+ import a from "react";
2
+ const S = (t) => {
3
+ let e;
4
+ const n = /* @__PURE__ */ new Set(), c = (s, u) => {
5
+ const o = typeof s == "function" ? s(e) : s;
6
+ if (!Object.is(o, e)) {
7
+ const f = e;
8
+ e = u ?? (typeof o != "object" || o === null) ? o : Object.assign({}, e, o), n.forEach((g) => g(e, f));
9
+ }
10
+ }, i = () => e, r = { setState: c, getState: i, getInitialState: () => b, subscribe: (s) => (n.add(s), () => n.delete(s)) }, b = e = t(c, i, r);
11
+ return r;
12
+ }, d = (t) => t ? S(t) : S, I = (t) => t;
13
+ function j(t, e = I) {
14
+ const n = a.useSyncExternalStore(
15
+ t.subscribe,
16
+ () => e(t.getState()),
17
+ () => e(t.getInitialState())
18
+ );
19
+ return a.useDebugValue(n), n;
20
+ }
21
+ const l = (t) => {
22
+ const e = d(t), n = (c) => j(e, c);
23
+ return Object.assign(n, e), n;
24
+ }, x = (t) => t ? l(t) : l;
25
+ export {
26
+ x as c
27
+ };
@@ -0,0 +1,7 @@
1
+ import { c as o } from "../react-QiIgv49H.js";
2
+ const t = o((e) => ({
3
+ setBaseProps: (s) => e({ ...s })
4
+ }));
5
+ export {
6
+ t as useBasePropsStore
7
+ };
@@ -0,0 +1,15 @@
1
+ import { c as r } from "../react-QiIgv49H.js";
2
+ const E = r((e) => ({
3
+ environment: {
4
+ ENVIRONMENT: "DEV",
5
+ COMMON_API: "",
6
+ REQ_VERSION: "",
7
+ MODULE_AUTH_API: "",
8
+ API_PREFIX: ""
9
+ },
10
+ setEnvironment: (n) => e({ environment: n }),
11
+ addEnvironment: (n) => e((o) => ({ environment: { ...n, ...o.environment } }))
12
+ }));
13
+ export {
14
+ E as useEnvironmentStore
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 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,4 @@
1
+ var e = /* @__PURE__ */ ((a) => (a[a.Category = 0] = "Category", a[a.Requirement = 1] = "Requirement", a[a.Country = 2] = "Country", a[a.CountryCode = 3] = "CountryCode", a[a.Crop = 4] = "Crop", a[a.CropType = 5] = "CropType", a[a.CropVariety = 6] = "CropVariety", a[a.Currency = 7] = "Currency", a[a.DataAreaEntity = 8] = "DataAreaEntity", a[a.DataAreaGroup = 9] = "DataAreaGroup", a[a.FieldAutomationLevelType = 10] = "FieldAutomationLevelType", a[a.FieldCoverageType = 11] = "FieldCoverageType", a[a.FieldSecurityLevelType = 12] = "FieldSecurityLevelType", a[a.FieldShadingType = 13] = "FieldShadingType", a[a.FieldSowingType = 14] = "FieldSowingType", a[a.FieldSubstrateType = 15] = "FieldSubstrateType", a[a.FieldTechnologyType = 16] = "FieldTechnologyType", a[a.Gender = 17] = "Gender", a[a.GrowingEnvironment = 18] = "GrowingEnvironment", a[a.Language = 19] = "Language", a[a.ModuleHostingType = 20] = "ModuleHostingType", a[a.ModuleType = 21] = "ModuleType", a[a.ModuleState = 22] = "ModuleState", a[a.Region = 23] = "Region", a[a.Rootstock = 24] = "Rootstock", a[a.Salutation = 25] = "Salutation", a[a.SeasonState = 26] = "SeasonState", a[a.SensorName = 27] = "SensorName", a[a.SensorState = 28] = "SensorState", a[a.TermAndCondition = 29] = "TermAndCondition", a[a.PackageState = 30] = "PackageState", a[a.DocumentType = 31] = "DocumentType", a[a.ModuleFederationType = 32] = "ModuleFederationType", a[a.PaymentCycle = 33] = "PaymentCycle", a[a.PaymentMethod = 34] = "PaymentMethod", a[a.PlantFamily = 35] = "PlantFamily", a[a.AlertCriteriaName = 36] = "AlertCriteriaName", a))(e || {});
2
+ export {
3
+ e as CommonOptionType
4
+ };
@@ -0,0 +1 @@
1
+
@@ -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
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
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
+ };
@@ -0,0 +1,395 @@
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";
4
+ import "react/jsx-runtime";
5
+ import { s as K, n as _ } from "./utils-DxRR_XLb.js";
6
+ var G = class extends B {
7
+ constructor(e, t) {
8
+ super(), this.options = t, this.#s = e, this.#r = null, this.#i = U(), this.options.experimental_prefetchInRender || this.#i.reject(
9
+ new Error("experimental_prefetchInRender feature flag is not enabled")
10
+ ), this.bindMethods(), this.setOptions(t);
11
+ }
12
+ #s;
13
+ #e = void 0;
14
+ #p = void 0;
15
+ #t = void 0;
16
+ #a;
17
+ #c;
18
+ #i;
19
+ #r;
20
+ #y;
21
+ #l;
22
+ // This property keeps track of the last query with defined data.
23
+ // It will be used to pass the previous data and query to the placeholder function between renders.
24
+ #d;
25
+ #o;
26
+ #h;
27
+ #n;
28
+ #f = /* @__PURE__ */ new Set();
29
+ bindMethods() {
30
+ this.refetch = this.refetch.bind(this);
31
+ }
32
+ onSubscribe() {
33
+ this.listeners.size === 1 && (this.#e.addObserver(this), j(this.#e, this.options) ? this.#u() : this.updateResult(), this.#R());
34
+ }
35
+ onUnsubscribe() {
36
+ this.hasListeners() || this.destroy();
37
+ }
38
+ shouldFetchOnReconnect() {
39
+ return T(
40
+ this.#e,
41
+ this.options,
42
+ this.options.refetchOnReconnect
43
+ );
44
+ }
45
+ shouldFetchOnWindowFocus() {
46
+ return T(
47
+ this.#e,
48
+ this.options,
49
+ this.options.refetchOnWindowFocus
50
+ );
51
+ }
52
+ destroy() {
53
+ this.listeners = /* @__PURE__ */ new Set(), this.#v(), this.#O(), this.#e.removeObserver(this);
54
+ }
55
+ setOptions(e, t) {
56
+ const s = this.options, r = this.#e;
57
+ if (this.options = this.#s.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof f(this.options.enabled, this.#e) != "boolean")
58
+ throw new Error(
59
+ "Expected enabled to be a boolean or a callback that returns a boolean"
60
+ );
61
+ this.#C(), this.#e.setOptions(this.options), s._defaulted && !w(this.options, s) && this.#s.getQueryCache().notify({
62
+ type: "observerOptionsUpdated",
63
+ query: this.#e,
64
+ observer: this
65
+ });
66
+ const a = this.hasListeners();
67
+ a && L(
68
+ this.#e,
69
+ r,
70
+ this.options,
71
+ s
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();
74
+ a && (this.#e !== r || f(this.options.enabled, this.#e) !== f(s.enabled, this.#e) || u !== this.#n) && this.#g(u);
75
+ }
76
+ getOptimisticResult(e) {
77
+ const t = this.#s.getQueryCache().build(this.#s, e), s = this.createResult(t, e);
78
+ return X(this, s) && (this.#t = s, this.#c = this.options, this.#a = this.#e.state), s;
79
+ }
80
+ getCurrentResult() {
81
+ return this.#t;
82
+ }
83
+ trackResult(e, t) {
84
+ const s = {};
85
+ return Object.keys(e).forEach((r) => {
86
+ Object.defineProperty(s, r, {
87
+ configurable: !1,
88
+ enumerable: !0,
89
+ get: () => (this.trackProp(r), t?.(r), e[r])
90
+ });
91
+ }), s;
92
+ }
93
+ trackProp(e) {
94
+ this.#f.add(e);
95
+ }
96
+ getCurrentQuery() {
97
+ return this.#e;
98
+ }
99
+ refetch({ ...e } = {}) {
100
+ return this.fetch({
101
+ ...e
102
+ });
103
+ }
104
+ fetchOptimistic(e) {
105
+ const t = this.#s.defaultQueryOptions(e), s = this.#s.getQueryCache().build(this.#s, t);
106
+ return s.fetch().then(() => this.createResult(s, t));
107
+ }
108
+ fetch(e) {
109
+ return this.#u({
110
+ ...e,
111
+ cancelRefetch: e.cancelRefetch ?? !0
112
+ }).then(() => (this.updateResult(), this.#t));
113
+ }
114
+ #u(e) {
115
+ this.#C();
116
+ let t = this.#e.fetch(
117
+ this.options,
118
+ e
119
+ );
120
+ return e?.throwOnError || (t = t.catch(N)), t;
121
+ }
122
+ #b() {
123
+ this.#v();
124
+ const e = O(
125
+ this.options.staleTime,
126
+ this.#e
127
+ );
128
+ if (Q || this.#t.isStale || !k(e))
129
+ return;
130
+ const s = H(this.#t.dataUpdatedAt, e) + 1;
131
+ this.#o = setTimeout(() => {
132
+ this.#t.isStale || this.updateResult();
133
+ }, s);
134
+ }
135
+ #m() {
136
+ return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#e) : this.options.refetchInterval) ?? !1;
137
+ }
138
+ #g(e) {
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();
141
+ }, this.#n));
142
+ }
143
+ #R() {
144
+ this.#b(), this.#g(this.#m());
145
+ }
146
+ #v() {
147
+ this.#o && (clearTimeout(this.#o), this.#o = void 0);
148
+ }
149
+ #O() {
150
+ this.#h && (clearInterval(this.#h), this.#h = void 0);
151
+ }
152
+ createResult(e, t) {
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;
155
+ if (t._optimisticResults) {
156
+ const h = this.hasListeners(), b = !h && j(e, t), m = h && L(e, s, t, r);
157
+ (b || m) && (n = {
158
+ ...n,
159
+ ...W(c.data, e.options)
160
+ }), t._optimisticResults === "isRestoring" && (n.fetchStatus = "idle");
161
+ }
162
+ let { error: F, errorUpdatedAt: x, status: p } = n;
163
+ if (t.select && n.data !== void 0)
164
+ if (a && n.data === u?.data && t.select === this.#y)
165
+ l = this.#l;
166
+ else
167
+ try {
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;
171
+ }
172
+ else
173
+ l = n.data;
174
+ if (t.placeholderData !== void 0 && l === void 0 && p === "pending") {
175
+ let h;
176
+ if (a?.isPlaceholderData && t.placeholderData === i?.placeholderData)
177
+ h = a.data;
178
+ else if (h = typeof t.placeholderData == "function" ? t.placeholderData(
179
+ this.#d?.state.data,
180
+ this.#d
181
+ ) : t.placeholderData, t.select && h !== void 0)
182
+ try {
183
+ h = t.select(h), this.#r = null;
184
+ } catch (b) {
185
+ this.#r = b;
186
+ }
187
+ h !== void 0 && (p = "success", l = M(
188
+ a?.data,
189
+ h,
190
+ t
191
+ ), R = !0);
192
+ }
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,
196
+ fetchStatus: n.fetchStatus,
197
+ isPending: S,
198
+ isSuccess: p === "success",
199
+ isError: E,
200
+ isInitialLoading: D,
201
+ isLoading: D,
202
+ data: l,
203
+ dataUpdatedAt: n.dataUpdatedAt,
204
+ error: F,
205
+ errorUpdatedAt: x,
206
+ failureCount: n.fetchFailureCount,
207
+ failureReason: n.fetchFailureReason,
208
+ errorUpdateCount: n.errorUpdateCount,
209
+ isFetched: n.dataUpdateCount > 0 || n.errorUpdateCount > 0,
210
+ isFetchedAfterMount: n.dataUpdateCount > o.dataUpdateCount || n.errorUpdateCount > o.errorUpdateCount,
211
+ isFetching: C,
212
+ isRefetching: C && !S,
213
+ isLoadingError: E && !P,
214
+ isPaused: n.fetchStatus === "paused",
215
+ isPlaceholderData: R,
216
+ isRefetchError: E && P,
217
+ isStale: I(e, t),
218
+ refetch: this.refetch,
219
+ promise: this.#i
220
+ };
221
+ if (this.options.experimental_prefetchInRender) {
222
+ const h = (v) => {
223
+ d.status === "error" ? v.reject(d.error) : d.data !== void 0 && v.resolve(d.data);
224
+ }, b = () => {
225
+ const v = this.#i = d.promise = U();
226
+ h(v);
227
+ }, m = this.#i;
228
+ switch (m.status) {
229
+ case "pending":
230
+ e.queryHash === s.queryHash && h(m);
231
+ break;
232
+ case "fulfilled":
233
+ (d.status === "error" || d.data !== m.value) && b();
234
+ break;
235
+ case "rejected":
236
+ (d.status !== "error" || d.error !== m.reason) && b();
237
+ break;
238
+ }
239
+ }
240
+ return d;
241
+ }
242
+ updateResult(e) {
243
+ const t = this.#t, s = this.createResult(this.#e, this.options);
244
+ if (this.#a = this.#e.state, this.#c = this.options, this.#a.data !== void 0 && (this.#d = this.#e), w(s, t))
245
+ return;
246
+ this.#t = s;
247
+ const r = {}, a = () => {
248
+ if (!t)
249
+ return !0;
250
+ const { notifyOnChangeProps: u } = this.options, i = typeof u == "function" ? u() : u;
251
+ if (i === "all" || !i && !this.#f.size)
252
+ return !0;
253
+ const g = new Set(
254
+ i ?? this.#f
255
+ );
256
+ return this.options.throwOnError && g.add("error"), Object.keys(this.#t).some((o) => {
257
+ const c = o;
258
+ return this.#t[c] !== t[c] && g.has(c);
259
+ });
260
+ };
261
+ e?.listeners !== !1 && a() && (r.listeners = !0), this.#S({ ...r, ...e });
262
+ }
263
+ #C() {
264
+ const e = this.#s.getQueryCache().build(this.#s, this.options);
265
+ if (e === this.#e)
266
+ return;
267
+ const t = this.#e;
268
+ this.#e = e, this.#p = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
269
+ }
270
+ onQueryUpdate() {
271
+ this.updateResult(), this.hasListeners() && this.#R();
272
+ }
273
+ #S(e) {
274
+ A.batch(() => {
275
+ e.listeners && this.listeners.forEach((t) => {
276
+ t(this.#t);
277
+ }), this.#s.getQueryCache().notify({
278
+ query: this.#e,
279
+ type: "observerResultsUpdated"
280
+ });
281
+ });
282
+ }
283
+ };
284
+ function J(e, t) {
285
+ return f(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
286
+ }
287
+ function j(e, t) {
288
+ return J(e, t) || e.state.data !== void 0 && T(e, t, t.refetchOnMount);
289
+ }
290
+ function T(e, t, s) {
291
+ if (f(t.enabled, e) !== !1) {
292
+ const r = typeof s == "function" ? s(e) : s;
293
+ return r === "always" || r !== !1 && I(e, t);
294
+ }
295
+ return !1;
296
+ }
297
+ function L(e, t, s, r) {
298
+ return (e !== t || f(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && I(e, s);
299
+ }
300
+ function I(e, t) {
301
+ return f(t.enabled, e) !== !1 && e.isStaleByTime(O(t.staleTime, e));
302
+ }
303
+ function X(e, t) {
304
+ return !w(e.getCurrentResult(), t);
305
+ }
306
+ function Y() {
307
+ let e = !1;
308
+ return {
309
+ clearReset: () => {
310
+ e = !1;
311
+ },
312
+ reset: () => {
313
+ e = !0;
314
+ },
315
+ isReset: () => e
316
+ };
317
+ }
318
+ var Z = y.createContext(Y()), ee = () => y.useContext(Z), te = (e, t) => {
319
+ (e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
320
+ }, se = (e) => {
321
+ y.useEffect(() => {
322
+ e.clearReset();
323
+ }, [e]);
324
+ }, re = ({
325
+ result: e,
326
+ errorResetBoundary: t,
327
+ throwOnError: s,
328
+ query: r,
329
+ suspense: a
330
+ }) => e.isError && !t.isReset() && !e.isFetching && r && (a && e.data === void 0 || K(s, [e.error, r])), ie = (e) => {
331
+ const t = e.staleTime;
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)));
333
+ }, ne = (e, t) => e.isLoading && e.isFetching && !t, ae = (e, t) => e?.suspense && t.isPending, q = (e, t, s) => t.fetchOptimistic(e).catch(() => {
334
+ s.clearReset();
335
+ });
336
+ function oe(e, t, s) {
337
+ if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
338
+ throw new Error(
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'
340
+ );
341
+ const r = z(s), a = $(), u = ee(), i = r.defaultQueryOptions(e);
342
+ r.getDefaultOptions().queries?._experimental_beforeQuery?.(
343
+ i
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(
348
+ () => new t(
349
+ r,
350
+ i
351
+ )
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;
358
+ },
359
+ [o, n]
360
+ ),
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({
368
+ result: c,
369
+ errorResetBoundary: u,
370
+ throwOnError: i.throwOnError,
371
+ query: r.getQueryCache().get(i.queryHash),
372
+ suspense: i.suspense
373
+ }))
374
+ throw c.error;
375
+ return r.getDefaultOptions().queries?._experimental_afterQuery?.(
376
+ i,
377
+ c
378
+ ), i.experimental_prefetchInRender && !Q && ne(c, a) && (g ? (
379
+ // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
380
+ q(i, o, u)
381
+ ) : (
382
+ // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
383
+ r.getQueryCache().get(i.queryHash)?.promise
384
+ ))?.catch(_).finally(() => {
385
+ o.updateResult();
386
+ }), i.notifyOnChangeProps ? c : o.trackResult(c);
387
+ }
388
+ function fe(e, t) {
389
+ return oe(e, G, t);
390
+ }
391
+ export {
392
+ G as Q,
393
+ oe as a,
394
+ fe as u
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
+ };
@@ -0,0 +1,22 @@
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
+ };
14
+ export {
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
22
+ };