@hortiview/modulebase 0.0.12628 → 0.0.13100-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.
- package/dist/ModuleCore-YCIFN_02.js +14973 -0
- package/dist/{QueryClientProvider-Q_mWQTzQ.js → QueryClientProvider-Beog9TR7.js} +39 -37
- package/dist/{_baseGet-B7FwMMGI.js → _baseGet-C6jMXSsQ.js} +447 -447
- package/dist/{api-D9Lmqe6S.js → api-s6E2GJtu.js} +48 -48
- package/dist/assets/ModuleCore.css +1 -0
- package/dist/components/ModuleBase.js +17 -498
- package/dist/components/ModuleCore.js +10 -0
- package/dist/hooks/useCustom.js +15 -18
- package/dist/hooks/useCustomMutation.js +14 -12
- package/dist/hooks/useEntity.js +51 -58
- package/dist/hooks/useOffline.js +45 -0
- package/dist/hooks/useOption.js +16 -16
- package/dist/hooks/useServiceBus.js +19 -11
- package/dist/hooks/useStores.js +1 -1
- package/dist/{query-CRIVoEP7.js → isRestoring-CLuxJVSA.js} +21 -17
- package/dist/lib/components/ModuleBase.d.ts +36 -0
- package/dist/lib/components/ModuleCore.d.ts +32 -0
- package/dist/{constants.d.ts → lib/constants.d.ts} +1 -1
- package/dist/{hooks → lib/hooks}/useCustom.d.ts +2 -1
- package/dist/{hooks → lib/hooks}/useCustomMutation.d.ts +2 -1
- package/dist/{hooks → lib/hooks}/useEntity.d.ts +6 -24
- package/dist/lib/hooks/useOffline.d.ts +15 -0
- package/dist/{hooks → lib/hooks}/useServiceBus.d.ts +6 -2
- package/dist/lib/hooks/useStores.d.ts +37 -0
- package/dist/lib/main.d.ts +27 -0
- package/dist/lib/types/ActionStorage.d.ts +13 -0
- package/dist/{types → lib/types}/BaseProps.d.ts +10 -2
- package/dist/{types → lib/types}/Deprecated.d.ts +6 -0
- package/dist/lib/types/Entities.d.ts +22 -0
- package/dist/{types → lib/types}/Environment.d.ts +1 -1
- package/dist/lib/types/EnvironmentVariable.d.ts +6 -0
- package/dist/{types → lib/types}/ModuleApi.d.ts +5 -5
- package/dist/{types → lib/types}/Requests.d.ts +4 -10
- package/dist/{utils → lib/utils}/api.d.ts +1 -1
- package/dist/{utils → lib/utils}/baseFetches.d.ts +2 -2
- package/dist/{utils → lib/utils}/fetches.d.ts +14 -6
- package/dist/lib/utils/helper.d.ts +29 -0
- package/dist/main.js +215 -133
- package/dist/{mutation-X73nm7Df.js → mutation-DSKlaYzY.js} +1 -1
- package/dist/{omit-B7MWDtHq.js → omit-C9Qe80rl.js} +1 -1
- package/dist/stores/EnvironmentStore.js +3 -2
- package/dist/types/ActionStorage.js +4 -0
- package/dist/types/Entities.js +25 -0
- package/dist/types/Environment.js +1 -4
- package/dist/types/EnvironmentVariable.js +1 -0
- package/dist/types/Requests.js +1 -4
- package/dist/{useMutation-3rykrmeD.js → useMutation-zu8uxBak.js} +16 -16
- package/dist/{useQuery-CwwWze9O.js → useQuery-Bj9k9zik.js} +47 -47
- package/dist/utils/api.js +1 -1
- package/dist/utils/baseFetches.js +15 -15
- package/dist/utils/fetches.js +14 -13
- package/dist/utils/helper.js +55 -0
- package/package.json +7 -2
- package/dist/components/ModuleBase.d.ts +0 -11
- package/dist/hooks/useStores.d.ts +0 -30
- package/dist/main.d.ts +0 -13
- /package/dist/{hooks → lib/hooks}/useBreadcrumbTranslation.d.ts +0 -0
- /package/dist/{hooks → lib/hooks}/useOption.d.ts +0 -0
- /package/dist/{hooks → lib/hooks}/useSignalRMessages.d.ts +0 -0
- /package/dist/{module-router.d.ts → lib/module-router.d.ts} +0 -0
- /package/dist/{provider → lib/provider}/SignalR/SignalRProvider.d.ts +0 -0
- /package/dist/{provider → lib/provider}/SignalR/signalR.d.ts +0 -0
- /package/dist/{stores → lib/stores}/BasePropsStore.d.ts +0 -0
- /package/dist/{stores → lib/stores}/EnvironmentStore.d.ts +0 -0
- /package/dist/{types → lib/types}/AppInsights.d.ts +0 -0
- /package/dist/{types → lib/types}/CommonOptions.d.ts +0 -0
- /package/dist/{types → lib/types}/ServiceBus.d.ts +0 -0
- /package/dist/{types → lib/types}/SystemMessage.d.ts +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { c as r } from "../react-QiIgv49H.js";
|
|
2
|
-
const
|
|
2
|
+
const E = r((e) => ({
|
|
3
3
|
environment: {
|
|
4
4
|
ENVIRONMENT: "DEV",
|
|
5
5
|
COMMON_API: "",
|
|
6
|
+
REQ_VERSION: "",
|
|
6
7
|
MODULE_AUTH_API: "",
|
|
7
8
|
API_PREFIX: ""
|
|
8
9
|
},
|
|
@@ -10,5 +11,5 @@ const m = r((e) => ({
|
|
|
10
11
|
addEnvironment: (n) => e((o) => ({ environment: { ...n, ...o.environment } }))
|
|
11
12
|
}));
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
E as useEnvironmentStore
|
|
14
15
|
};
|
|
@@ -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
|
+
|
package/dist/types/Requests.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { g as l } from "./mutation-
|
|
3
|
-
import { S as d,
|
|
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
4
|
import { n as m, s as f } from "./utils-DxRR_XLb.js";
|
|
5
5
|
var v = class extends d {
|
|
6
6
|
#e;
|
|
@@ -25,13 +25,13 @@ var v = class extends d {
|
|
|
25
25
|
this.hasListeners() || this.#t?.removeObserver(this);
|
|
26
26
|
}
|
|
27
27
|
onMutationUpdate(t) {
|
|
28
|
-
this.#r(), this.#
|
|
28
|
+
this.#r(), this.#o(t);
|
|
29
29
|
}
|
|
30
30
|
getCurrentResult() {
|
|
31
31
|
return this.#i;
|
|
32
32
|
}
|
|
33
33
|
reset() {
|
|
34
|
-
this.#t?.removeObserver(this), this.#t = void 0, this.#r(), this.#
|
|
34
|
+
this.#t?.removeObserver(this), this.#t = void 0, this.#r(), this.#o();
|
|
35
35
|
}
|
|
36
36
|
mutate(t, s) {
|
|
37
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);
|
|
@@ -48,7 +48,7 @@ var v = class extends d {
|
|
|
48
48
|
reset: this.reset
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
#
|
|
51
|
+
#o(t) {
|
|
52
52
|
a.batch(() => {
|
|
53
53
|
if (this.#s && this.hasListeners()) {
|
|
54
54
|
const s = this.#i.variables, i = this.#i.context;
|
|
@@ -65,26 +65,26 @@ var v = class extends d {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
function
|
|
69
|
-
const i = b(), [e] =
|
|
68
|
+
function M(t, s) {
|
|
69
|
+
const i = b(s), [e] = o.useState(
|
|
70
70
|
() => new v(
|
|
71
71
|
i,
|
|
72
72
|
t
|
|
73
73
|
)
|
|
74
74
|
);
|
|
75
|
-
|
|
75
|
+
o.useEffect(() => {
|
|
76
76
|
e.setOptions(t);
|
|
77
77
|
}, [e, t]);
|
|
78
|
-
const r =
|
|
79
|
-
|
|
80
|
-
(
|
|
78
|
+
const r = o.useSyncExternalStore(
|
|
79
|
+
o.useCallback(
|
|
80
|
+
(n) => e.subscribe(a.batchCalls(n)),
|
|
81
81
|
[e]
|
|
82
82
|
),
|
|
83
83
|
() => e.getCurrentResult(),
|
|
84
84
|
() => e.getCurrentResult()
|
|
85
|
-
), u =
|
|
86
|
-
(
|
|
87
|
-
e.mutate(
|
|
85
|
+
), u = o.useCallback(
|
|
86
|
+
(n, c) => {
|
|
87
|
+
e.mutate(n, c).catch(m);
|
|
88
88
|
},
|
|
89
89
|
[e]
|
|
90
90
|
);
|
|
@@ -93,5 +93,5 @@ function C(t, s) {
|
|
|
93
93
|
return { ...r, mutate: u, mutateAsync: r.mutate };
|
|
94
94
|
}
|
|
95
95
|
export {
|
|
96
|
-
|
|
96
|
+
M as u
|
|
97
97
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import { f as $ } from "./
|
|
3
|
-
import * as
|
|
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
4
|
import "react/jsx-runtime";
|
|
5
5
|
import { s as K, n as _ } from "./utils-DxRR_XLb.js";
|
|
6
|
-
var G = class extends
|
|
6
|
+
var G = class extends B {
|
|
7
7
|
constructor(e, t) {
|
|
8
8
|
super(), this.options = t, this.#s = e, this.#r = null, this.#i = U(), this.options.experimental_prefetchInRender || this.#i.reject(
|
|
9
9
|
new Error("experimental_prefetchInRender feature flag is not enabled")
|
|
@@ -30,7 +30,7 @@ var G = class extends N {
|
|
|
30
30
|
this.refetch = this.refetch.bind(this);
|
|
31
31
|
}
|
|
32
32
|
onSubscribe() {
|
|
33
|
-
this.listeners.size === 1 && (this.#e.addObserver(this),
|
|
33
|
+
this.listeners.size === 1 && (this.#e.addObserver(this), j(this.#e, this.options) ? this.#u() : this.updateResult(), this.#R());
|
|
34
34
|
}
|
|
35
35
|
onUnsubscribe() {
|
|
36
36
|
this.hasListeners() || this.destroy();
|
|
@@ -117,7 +117,7 @@ var G = class extends N {
|
|
|
117
117
|
this.options,
|
|
118
118
|
e
|
|
119
119
|
);
|
|
120
|
-
return e?.throwOnError || (t = t.catch(
|
|
120
|
+
return e?.throwOnError || (t = t.catch(N)), t;
|
|
121
121
|
}
|
|
122
122
|
#b() {
|
|
123
123
|
this.#v();
|
|
@@ -125,9 +125,9 @@ var G = class extends N {
|
|
|
125
125
|
this.options.staleTime,
|
|
126
126
|
this.#e
|
|
127
127
|
);
|
|
128
|
-
if (Q || this.#t.isStale || !
|
|
128
|
+
if (Q || this.#t.isStale || !k(e))
|
|
129
129
|
return;
|
|
130
|
-
const s =
|
|
130
|
+
const s = H(this.#t.dataUpdatedAt, e) + 1;
|
|
131
131
|
this.#o = setTimeout(() => {
|
|
132
132
|
this.#t.isStale || this.updateResult();
|
|
133
133
|
}, s);
|
|
@@ -136,8 +136,8 @@ var G = class extends N {
|
|
|
136
136
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#e) : this.options.refetchInterval) ?? !1;
|
|
137
137
|
}
|
|
138
138
|
#g(e) {
|
|
139
|
-
this.#O(), this.#n = e, !(Q || f(this.options.enabled, this.#e) === !1 || !
|
|
140
|
-
(this.options.refetchIntervalInBackground ||
|
|
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
141
|
}, this.#n));
|
|
142
142
|
}
|
|
143
143
|
#R() {
|
|
@@ -153,25 +153,25 @@ var G = class extends N {
|
|
|
153
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
154
|
let n = { ...c }, R = !1, l;
|
|
155
155
|
if (t._optimisticResults) {
|
|
156
|
-
const h = this.hasListeners(), b = !h &&
|
|
156
|
+
const h = this.hasListeners(), b = !h && j(e, t), m = h && L(e, s, t, r);
|
|
157
157
|
(b || m) && (n = {
|
|
158
158
|
...n,
|
|
159
|
-
|
|
159
|
+
...W(c.data, e.options)
|
|
160
160
|
}), t._optimisticResults === "isRestoring" && (n.fetchStatus = "idle");
|
|
161
161
|
}
|
|
162
|
-
let { error:
|
|
162
|
+
let { error: F, errorUpdatedAt: x, status: p } = n;
|
|
163
163
|
if (t.select && n.data !== void 0)
|
|
164
164
|
if (a && n.data === u?.data && t.select === this.#y)
|
|
165
165
|
l = this.#l;
|
|
166
166
|
else
|
|
167
167
|
try {
|
|
168
|
-
this.#y = t.select, l = t.select(n.data), l =
|
|
168
|
+
this.#y = t.select, l = t.select(n.data), l = M(a?.data, l, t), this.#l = l, this.#r = null;
|
|
169
169
|
} catch (h) {
|
|
170
170
|
this.#r = h;
|
|
171
171
|
}
|
|
172
172
|
else
|
|
173
173
|
l = n.data;
|
|
174
|
-
if (t.placeholderData !== void 0 && l === void 0 &&
|
|
174
|
+
if (t.placeholderData !== void 0 && l === void 0 && p === "pending") {
|
|
175
175
|
let h;
|
|
176
176
|
if (a?.isPlaceholderData && t.placeholderData === i?.placeholderData)
|
|
177
177
|
h = a.data;
|
|
@@ -184,25 +184,25 @@ var G = class extends N {
|
|
|
184
184
|
} catch (b) {
|
|
185
185
|
this.#r = b;
|
|
186
186
|
}
|
|
187
|
-
h !== void 0 && (
|
|
187
|
+
h !== void 0 && (p = "success", l = M(
|
|
188
188
|
a?.data,
|
|
189
189
|
h,
|
|
190
190
|
t
|
|
191
191
|
), R = !0);
|
|
192
192
|
}
|
|
193
|
-
this.#r && (
|
|
194
|
-
const C = n.fetchStatus === "fetching", S =
|
|
195
|
-
status:
|
|
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
196
|
fetchStatus: n.fetchStatus,
|
|
197
197
|
isPending: S,
|
|
198
|
-
isSuccess:
|
|
198
|
+
isSuccess: p === "success",
|
|
199
199
|
isError: E,
|
|
200
200
|
isInitialLoading: D,
|
|
201
201
|
isLoading: D,
|
|
202
202
|
data: l,
|
|
203
203
|
dataUpdatedAt: n.dataUpdatedAt,
|
|
204
|
-
error:
|
|
205
|
-
errorUpdatedAt:
|
|
204
|
+
error: F,
|
|
205
|
+
errorUpdatedAt: x,
|
|
206
206
|
failureCount: n.fetchFailureCount,
|
|
207
207
|
failureReason: n.fetchFailureReason,
|
|
208
208
|
errorUpdateCount: n.errorUpdateCount,
|
|
@@ -284,7 +284,7 @@ var G = class extends N {
|
|
|
284
284
|
function J(e, t) {
|
|
285
285
|
return f(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function j(e, t) {
|
|
288
288
|
return J(e, t) || e.state.data !== void 0 && T(e, t, t.refetchOnMount);
|
|
289
289
|
}
|
|
290
290
|
function T(e, t, s) {
|
|
@@ -303,9 +303,7 @@ function I(e, t) {
|
|
|
303
303
|
function X(e, t) {
|
|
304
304
|
return !w(e.getCurrentResult(), t);
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
B.Provider;
|
|
308
|
-
function Z() {
|
|
306
|
+
function Y() {
|
|
309
307
|
let e = !1;
|
|
310
308
|
return {
|
|
311
309
|
clearReset: () => {
|
|
@@ -317,43 +315,43 @@ function Z() {
|
|
|
317
315
|
isReset: () => e
|
|
318
316
|
};
|
|
319
317
|
}
|
|
320
|
-
var
|
|
318
|
+
var Z = y.createContext(Y()), ee = () => y.useContext(Z), te = (e, t) => {
|
|
321
319
|
(e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
|
|
322
|
-
},
|
|
323
|
-
|
|
320
|
+
}, se = (e) => {
|
|
321
|
+
y.useEffect(() => {
|
|
324
322
|
e.clearReset();
|
|
325
323
|
}, [e]);
|
|
326
|
-
},
|
|
324
|
+
}, re = ({
|
|
327
325
|
result: e,
|
|
328
326
|
errorResetBoundary: t,
|
|
329
327
|
throwOnError: s,
|
|
330
328
|
query: r,
|
|
331
329
|
suspense: a
|
|
332
|
-
}) => e.isError && !t.isReset() && !e.isFetching && r && (a && e.data === void 0 || K(s, [e.error, r])),
|
|
330
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (a && e.data === void 0 || K(s, [e.error, r])), ie = (e) => {
|
|
333
331
|
const t = e.staleTime;
|
|
334
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)));
|
|
335
|
-
},
|
|
333
|
+
}, ne = (e, t) => e.isLoading && e.isFetching && !t, ae = (e, t) => e?.suspense && t.isPending, q = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
336
334
|
s.clearReset();
|
|
337
335
|
});
|
|
338
|
-
function
|
|
336
|
+
function oe(e, t, s) {
|
|
339
337
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
340
338
|
throw new Error(
|
|
341
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'
|
|
342
340
|
);
|
|
343
|
-
const r =
|
|
341
|
+
const r = z(s), a = $(), u = ee(), i = r.defaultQueryOptions(e);
|
|
344
342
|
r.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
345
343
|
i
|
|
346
344
|
), process.env.NODE_ENV !== "production" && (i.queryFn || console.error(
|
|
347
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`
|
|
348
|
-
)), i._optimisticResults = a ? "isRestoring" : "optimistic",
|
|
349
|
-
const g = !r.getQueryCache().get(i.queryHash), [o] =
|
|
346
|
+
)), i._optimisticResults = a ? "isRestoring" : "optimistic", ie(i), te(i, u), se(u);
|
|
347
|
+
const g = !r.getQueryCache().get(i.queryHash), [o] = y.useState(
|
|
350
348
|
() => new t(
|
|
351
349
|
r,
|
|
352
350
|
i
|
|
353
351
|
)
|
|
354
352
|
), c = o.getOptimisticResult(i), n = !a && e.subscribed !== !1;
|
|
355
|
-
if (
|
|
356
|
-
|
|
353
|
+
if (y.useSyncExternalStore(
|
|
354
|
+
y.useCallback(
|
|
357
355
|
(R) => {
|
|
358
356
|
const l = n ? o.subscribe(A.batchCalls(R)) : _;
|
|
359
357
|
return o.updateResult(), l;
|
|
@@ -362,11 +360,11 @@ function he(e, t, s) {
|
|
|
362
360
|
),
|
|
363
361
|
() => o.getCurrentResult(),
|
|
364
362
|
() => o.getCurrentResult()
|
|
365
|
-
),
|
|
363
|
+
), y.useEffect(() => {
|
|
366
364
|
o.setOptions(i, { listeners: !1 });
|
|
367
|
-
}, [i, o]),
|
|
368
|
-
throw
|
|
369
|
-
if (
|
|
365
|
+
}, [i, o]), ae(i, c))
|
|
366
|
+
throw q(i, o, u);
|
|
367
|
+
if (re({
|
|
370
368
|
result: c,
|
|
371
369
|
errorResetBoundary: u,
|
|
372
370
|
throwOnError: i.throwOnError,
|
|
@@ -377,9 +375,9 @@ function he(e, t, s) {
|
|
|
377
375
|
return r.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
378
376
|
i,
|
|
379
377
|
c
|
|
380
|
-
), i.experimental_prefetchInRender && !Q &&
|
|
378
|
+
), i.experimental_prefetchInRender && !Q && ne(c, a) && (g ? (
|
|
381
379
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
382
|
-
|
|
380
|
+
q(i, o, u)
|
|
383
381
|
) : (
|
|
384
382
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
385
383
|
r.getQueryCache().get(i.queryHash)?.promise
|
|
@@ -387,9 +385,11 @@ function he(e, t, s) {
|
|
|
387
385
|
o.updateResult();
|
|
388
386
|
}), i.notifyOnChangeProps ? c : o.trackResult(c);
|
|
389
387
|
}
|
|
390
|
-
function
|
|
391
|
-
return
|
|
388
|
+
function fe(e, t) {
|
|
389
|
+
return oe(e, G, t);
|
|
392
390
|
}
|
|
393
391
|
export {
|
|
394
|
-
|
|
392
|
+
G as Q,
|
|
393
|
+
oe as a,
|
|
394
|
+
fe as u
|
|
395
395
|
};
|
package/dist/utils/api.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as u, f as m, i as S, b as I } from "../api-s6E2GJtu.js";
|
|
2
2
|
import { useBasePropsStore as t } from "../stores/BasePropsStore.js";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
6
|
-
return
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
12
|
-
return
|
|
13
|
-
const
|
|
14
|
-
return
|
|
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
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
h as baseFetch,
|
|
18
|
+
E as baseMutation
|
|
19
19
|
};
|
package/dist/utils/fetches.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { useBasePropsStore as
|
|
2
|
-
import { useEnvironmentStore as
|
|
3
|
-
import { baseMutation as
|
|
4
|
-
const
|
|
5
|
-
const t =
|
|
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
6
|
return o(
|
|
7
7
|
`${t?.MODULE_AUTH_API}${t?.API_PREFIX}/${n}/${e}`,
|
|
8
8
|
{}
|
|
9
9
|
);
|
|
10
|
-
},
|
|
11
|
-
const t =
|
|
10
|
+
}, f = (e) => {
|
|
11
|
+
const t = i.getState().environment;
|
|
12
12
|
return o(`${t?.COMMON_API}${t?.API_PREFIX}/${e}`, {});
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
21
22
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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) => {
|
|
4
|
+
if (typeof r != "string")
|
|
5
|
+
throw new TypeError("Invalid argument expected string");
|
|
6
|
+
const e = r.match(g);
|
|
7
|
+
if (!e)
|
|
8
|
+
throw new Error(`Invalid argument not valid semver ('${r}' received)`);
|
|
9
|
+
return e.shift(), e;
|
|
10
|
+
}, f = (r) => r === "*" || r === "x" || r === "X", l = (r) => {
|
|
11
|
+
const e = parseInt(r, 10);
|
|
12
|
+
return isNaN(e) ? r : e;
|
|
13
|
+
}, h = (r, e) => typeof r != typeof e ? [String(r), String(e)] : [r, e], E = (r, e) => {
|
|
14
|
+
if (f(r) || f(e))
|
|
15
|
+
return 0;
|
|
16
|
+
const [t, n] = h(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 = E(r[t] || "0", e[t] || "0");
|
|
21
|
+
if (n !== 0)
|
|
22
|
+
return n;
|
|
23
|
+
}
|
|
24
|
+
return 0;
|
|
25
|
+
}, a = (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.13100-beta", w = (r) => m.every((e) => y(e, r)), y = (r, e) => {
|
|
29
|
+
if (!e[r]) {
|
|
30
|
+
if (e.throwError)
|
|
31
|
+
return e.throwError(`Missing required prop: ${r}`, 404), !1;
|
|
32
|
+
throw new Error(`Missing required prop: ${r}`);
|
|
33
|
+
}
|
|
34
|
+
return !0;
|
|
35
|
+
}, P = () => {
|
|
36
|
+
const r = window.__env__;
|
|
37
|
+
if (r && r.COMMON_API && r.MODULE_AUTH_API && r.API_PREFIX && r.ENVIRONMENT)
|
|
38
|
+
return r;
|
|
39
|
+
}, S = (r) => {
|
|
40
|
+
if (!r?.REQ_VERSION) return null;
|
|
41
|
+
const e = r.REQ_VERSION;
|
|
42
|
+
return a(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
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
w as arePropsValid,
|
|
49
|
+
M as checkConfig,
|
|
50
|
+
y as checkIfPropExists,
|
|
51
|
+
S as checkVersion,
|
|
52
|
+
P as getEnvironmentVariables,
|
|
53
|
+
R as getModuleQueryKey,
|
|
54
|
+
_ as universalSelector
|
|
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.
|
|
4
|
+
"version": "0.0.13100-beta",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|
|
7
7
|
"contributors": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"license": "GPL-3.0",
|
|
11
11
|
"main": "dist/main.js",
|
|
12
|
-
"types": "dist/main.d.ts",
|
|
12
|
+
"types": "dist/lib/main.d.ts",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
@@ -23,8 +23,13 @@
|
|
|
23
23
|
"preview": "vite preview"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@hortiview/default-components": "^1.2.1",
|
|
27
|
+
"@hortiview/shared-components": "^2.0.0",
|
|
26
28
|
"@microsoft/signalr": "^8.0.7",
|
|
29
|
+
"@tanstack/query-async-storage-persister": "^5.85.5",
|
|
27
30
|
"@tanstack/react-query": "^5.67.3",
|
|
31
|
+
"@tanstack/react-query-persist-client": "^5.85.5",
|
|
32
|
+
"compare-versions": "^6.1.1",
|
|
28
33
|
"lodash": "^4.17.21",
|
|
29
34
|
"odata-query": "^7.0.9",
|
|
30
35
|
"react": "^18.3.1",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { RouteObject } from 'react-router';
|
|
3
|
-
import { BaseProps } from '../types/BaseProps';
|
|
4
|
-
import { EnvConfig } from '../types/Environment';
|
|
5
|
-
export declare const ModuleBase: ({ props, routes, env, useSignalR, queryClient, }: {
|
|
6
|
-
props: BaseProps;
|
|
7
|
-
routes: RouteObject[];
|
|
8
|
-
env?: EnvConfig;
|
|
9
|
-
useSignalR?: boolean;
|
|
10
|
-
queryClient?: QueryClient;
|
|
11
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare const useBaseProps: () => Pick<import('../types/Deprecated').DeprecatedBaseProps & {
|
|
2
|
-
modulePermissionToken?: string;
|
|
3
|
-
moduleId?: string;
|
|
4
|
-
organizationId?: string;
|
|
5
|
-
basePath?: string;
|
|
6
|
-
currentNavigationPath?: string;
|
|
7
|
-
sourcePath?: string | null;
|
|
8
|
-
currentLanguage?: string;
|
|
9
|
-
currentLanguageId?: string;
|
|
10
|
-
alertRules?: string;
|
|
11
|
-
commonOptions?: import('../types/CommonOptions').AllDropdownsData<import('../types/CommonOptions').CommonOption>["items"];
|
|
12
|
-
serviceBusNotification?: (message: import('../types/ServiceBus').AlertServiceBusMessage, apiKey: string, queue: string, topic: string) => Promise<unknown>;
|
|
13
|
-
navigateInHortiview?: (path: string) => void;
|
|
14
|
-
addBreadcrumbTranslation?: (translation: {
|
|
15
|
-
key: string;
|
|
16
|
-
value: string;
|
|
17
|
-
}, hide?: boolean) => void;
|
|
18
|
-
showSnackbar?: (message: string, icon?: string) => void;
|
|
19
|
-
showMessage?: (message: import('../types/SystemMessage').SystemMessage) => void;
|
|
20
|
-
logEvent?: (event: import('../types/AppInsights').AppInsightsEvent, customProperties?: import('../types/AppInsights').AppInsightsProperties) => void;
|
|
21
|
-
logError?: (exception: import('../types/AppInsights').AppInsightsException) => void;
|
|
22
|
-
throwError?: (message: string, code: number) => void;
|
|
23
|
-
} & {
|
|
24
|
-
setBaseProps: (props: import('../main').BaseProps) => void;
|
|
25
|
-
}, keyof import('../types/Deprecated').DeprecatedBaseProps | "modulePermissionToken" | "moduleId" | "organizationId" | "basePath" | "currentNavigationPath" | "sourcePath" | "currentLanguage" | "currentLanguageId" | "alertRules" | "commonOptions" | "serviceBusNotification" | "navigateInHortiview" | "addBreadcrumbTranslation" | "showSnackbar" | "showMessage" | "logEvent" | "logError" | "throwError">;
|
|
26
|
-
export declare const useConfig: () => Pick<{
|
|
27
|
-
environment: import('../types/Environment').HortiViewEnvironments;
|
|
28
|
-
setEnvironment: (environment: import('../types/Environment').HortiViewEnvironments) => void;
|
|
29
|
-
addEnvironment: (customEnv: import('../types/Environment').CustomEnv) => void;
|
|
30
|
-
}, "environment">;
|
package/dist/main.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { ModuleBase } from './components/ModuleBase';
|
|
2
|
-
export type { BaseProps } from './types/BaseProps';
|
|
3
|
-
export { useBreadcrumbTranslation } from './hooks/useBreadcrumbTranslation';
|
|
4
|
-
export { useSignalRMessages } from './hooks/useSignalRMessages';
|
|
5
|
-
export * from './module-router';
|
|
6
|
-
export { useNavigate } from './module-router';
|
|
7
|
-
export { useBaseProps, useConfig } from './hooks/useStores';
|
|
8
|
-
export { useCustom } from './hooks/useCustom';
|
|
9
|
-
export { useEntity } from './hooks/useEntity';
|
|
10
|
-
export { useOption } from './hooks/useOption';
|
|
11
|
-
export { useCustomMutation } from './hooks/useCustomMutation';
|
|
12
|
-
export { useServiceBus } from './hooks/useServiceBus';
|
|
13
|
-
export { mutateOnCustomApi } from './utils/fetches';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|