@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.
- package/README.md +3 -2
- package/dist/IsRestoringProvider-CBSZo7ur.js +312 -0
- package/dist/ModuleCore-DuJVrj6v.js +11828 -0
- package/dist/QueryClientProvider-DyiNrPkn.js +514 -0
- package/dist/_commonjsHelpers-ByX85dGu.js +33 -0
- package/dist/api-COabZnyn.js +147 -0
- package/dist/assets/ModuleCore.css +1 -1
- package/dist/chunk-LFPYN7LY-D1ls8FXf.js +8643 -0
- package/dist/components/ModuleBase.js +9 -9
- package/dist/components/ModuleCore.js +9 -14698
- package/dist/constants.js +2 -3
- package/dist/enum/ActionStorage.js +4 -0
- package/dist/hooks/useCustom.js +15 -18
- package/dist/hooks/useCustomMutation.js +12 -11
- package/dist/hooks/useEntity.js +48 -60
- package/dist/hooks/useOffline.js +57 -0
- package/dist/hooks/useOption.js +19 -19
- package/dist/hooks/useServiceBus.js +1 -1
- package/dist/hooks/useStores.js +1 -1
- package/dist/{_baseGet-B7FwMMGI.js → isTypedArray-SkhznY1k.js} +496 -496
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/enum/ActionStorage.d.ts +7 -0
- package/dist/lib/hooks/useCustom.d.ts +6 -3
- package/dist/lib/hooks/useCustomMutation.d.ts +9 -3
- package/dist/lib/hooks/useEntity.d.ts +15 -23
- package/dist/lib/hooks/useOffline.d.ts +15 -0
- package/dist/lib/hooks/useStores.d.ts +10 -2
- package/dist/lib/main.d.ts +4 -0
- package/dist/lib/types/ActionStorage.d.ts +8 -0
- package/dist/lib/types/BaseProps.d.ts +10 -1
- package/dist/lib/types/Deprecated.d.ts +4 -0
- package/dist/lib/types/Entities.d.ts +22 -0
- package/dist/lib/types/Requests.d.ts +0 -17
- package/dist/lib/utils/IndexedDbService.d.ts +33 -0
- package/dist/lib/utils/api.d.ts +7 -14
- package/dist/lib/utils/baseFetches.d.ts +4 -3
- package/dist/lib/utils/fetches.d.ts +2 -2
- package/dist/lib/utils/helper.d.ts +1 -0
- package/dist/main.js +233 -144
- package/dist/module-router.js +2322 -121
- package/dist/{mutation-CnKIetRs.js → mutation-CmhiEgfA.js} +101 -56
- package/dist/{omit-B7MWDtHq.js → omit-Do6MFRwA.js} +240 -223
- package/dist/provider/SignalR/SignalRProvider.js +2389 -2824
- package/dist/react-c9FSfB30.js +27 -0
- package/dist/stores/BasePropsStore.js +1 -1
- package/dist/stores/EnvironmentStore.js +1 -1
- package/dist/types/ActionStorage.js +1 -0
- package/dist/types/Entities.js +25 -0
- package/dist/useMutation-Aoachkw_.js +139 -0
- package/dist/useQuery-DEU_AUtf.js +392 -0
- package/dist/utils/IndexedDbService.js +43 -0
- package/dist/utils/api.js +3 -4
- package/dist/utils/baseFetches.js +18 -14
- package/dist/utils/fetches.js +12 -13
- package/dist/utils/helper.js +30 -25
- package/package.json +19 -12
- package/dist/QueryClientProvider-VtJdNkDw.js +0 -435
- package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/api-D9Lmqe6S.js +0 -458
- package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +0 -8162
- package/dist/query-CFoO2uy7.js +0 -277
- package/dist/react-QiIgv49H.js +0 -27
- package/dist/useMutation-Num57Ulc.js +0 -97
- package/dist/useQuery-XBGd5Kep.js +0 -395
- package/dist/utils-DxRR_XLb.js +0 -9
package/dist/constants.js
CHANGED
|
@@ -5,7 +5,7 @@ const a = [
|
|
|
5
5
|
"organizationId",
|
|
6
6
|
"currentLanguageId",
|
|
7
7
|
"currentNavigationPath"
|
|
8
|
-
], e =
|
|
8
|
+
], e = {
|
|
9
9
|
/**
|
|
10
10
|
* The server timed out waiting for the request.
|
|
11
11
|
*/
|
|
@@ -29,6 +29,5 @@ const a = [
|
|
|
29
29
|
};
|
|
30
30
|
export {
|
|
31
31
|
a as REQUIRED_PROPS,
|
|
32
|
-
e as
|
|
33
|
-
t as RETRY_HTTP_STATUS_CODES
|
|
32
|
+
e as RETRY_HTTP_STATUS_CODES
|
|
34
33
|
};
|
package/dist/hooks/useCustom.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
endpoint: e,
|
|
1
|
+
import { u as f } from "../useQuery-DEU_AUtf.js";
|
|
2
|
+
import { fetchFromCustomApi as i } from "../utils/fetches.js";
|
|
3
|
+
import { universalSelector as n } from "../utils/helper.js";
|
|
4
|
+
const y = ({
|
|
5
|
+
endpoint: o,
|
|
7
6
|
queryKey: t,
|
|
8
7
|
token: u,
|
|
9
|
-
selector:
|
|
10
|
-
enabled: m = !0
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
};
|
|
8
|
+
selector: r,
|
|
9
|
+
enabled: m = !0,
|
|
10
|
+
noAuth: s = !1
|
|
11
|
+
}) => f({
|
|
12
|
+
queryKey: t,
|
|
13
|
+
queryFn: () => i(o, u, s),
|
|
14
|
+
select: (e) => r ? r(e) : n(e),
|
|
15
|
+
enabled: m
|
|
16
|
+
});
|
|
20
17
|
export {
|
|
21
|
-
|
|
18
|
+
y as useCustom
|
|
22
19
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { u } from "../useMutation-
|
|
1
|
+
import { u as n } from "../useMutation-Aoachkw_.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../provider/SignalR/SignalRProvider.js";
|
|
5
5
|
import "../stores/BasePropsStore.js";
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
6
|
+
import "../ModuleCore-DuJVrj6v.js";
|
|
7
|
+
import { mutateOnCustomApi as s } from "../utils/fetches.js";
|
|
8
|
+
import "../types/Entities.js";
|
|
9
|
+
import "../api-COabZnyn.js";
|
|
10
|
+
import "../omit-Do6MFRwA.js";
|
|
8
11
|
import "../stores/EnvironmentStore.js";
|
|
9
|
-
|
|
10
|
-
import "./useEntity.js";
|
|
11
|
-
import "../api-D9Lmqe6S.js";
|
|
12
|
-
const b = ({
|
|
12
|
+
const d = ({
|
|
13
13
|
endpoint: t,
|
|
14
14
|
method: o,
|
|
15
15
|
token: m,
|
|
16
|
-
headers: r
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
headers: r,
|
|
17
|
+
noAuth: i
|
|
18
|
+
}) => n({
|
|
19
|
+
mutationFn: ({ input: p, replaceEndpointWith: u }) => s(u ?? t, p, o, m, r, i)
|
|
19
20
|
});
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
d as useCustomMutation
|
|
22
23
|
};
|
package/dist/hooks/useEntity.js
CHANGED
|
@@ -1,70 +1,58 @@
|
|
|
1
|
-
import { u as p } from "../useQuery-
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useBasePropsStore as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
alert_rules: "farmAlertRule"
|
|
14
|
-
}, S = {
|
|
15
|
-
farm_members: "member"
|
|
16
|
-
}, q = {
|
|
17
|
-
Season: "season",
|
|
18
|
-
BlockPlantLayout: "blockPlantLayout",
|
|
19
|
-
Record: "recordLight",
|
|
20
|
-
Scouting: "scouting"
|
|
21
|
-
}, O = {
|
|
22
|
-
...Q,
|
|
23
|
-
...S,
|
|
24
|
-
...q
|
|
25
|
-
}, x = (r, e, u = !0, s = !1) => {
|
|
26
|
-
const l = E((n) => n.moduleId), d = E((n) => n.organizationId), { data: a } = g("DataAreaGroup"), { data: i } = g("DataAreaEntity"), { data: o } = F(r === "ModuleDepended"), c = r === "ModuleDepended", b = y(() => {
|
|
27
|
-
if (c)
|
|
28
|
-
return o ? o.find((t) => t.registeredEntityName === e)?.id : void 0;
|
|
29
|
-
if (!a || !i) return;
|
|
30
|
-
const n = a.find((t) => t.key === r)?.id;
|
|
31
|
-
return n ? i.find((t) => t.description === n && t.value === e)?.id : void 0;
|
|
32
|
-
}, [c, a, i, o, e, r]), m = T(
|
|
33
|
-
l,
|
|
34
|
-
b,
|
|
35
|
-
d,
|
|
36
|
-
c,
|
|
1
|
+
import { u as p } from "../useQuery-DEU_AUtf.js";
|
|
2
|
+
import { useMemo as g, useCallback as Q } from "react";
|
|
3
|
+
import { useBasePropsStore as m } from "../stores/BasePropsStore.js";
|
|
4
|
+
import { AllEntitiesTypeResultMap as v } from "../types/Entities.js";
|
|
5
|
+
import { getModuleDependedEntitiesRaw as A, getModuleDependedEntities as D, getFarmOrgEntities as q } from "../utils/fetches.js";
|
|
6
|
+
import { getModuleQueryKey as y, universalSelector as E } from "../utils/helper.js";
|
|
7
|
+
import { useOption as M, useModuleDependency as k } from "./useOption.js";
|
|
8
|
+
const P = (t, e, o = !0, n = !1) => {
|
|
9
|
+
const a = m((d) => d.moduleId), u = m((d) => d.organizationId), s = t === "ModuleDepended", r = K(t)(e), c = F(
|
|
10
|
+
a,
|
|
11
|
+
r,
|
|
12
|
+
u,
|
|
37
13
|
s,
|
|
38
|
-
|
|
14
|
+
n,
|
|
15
|
+
o
|
|
39
16
|
);
|
|
40
|
-
return
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
return g(() => {
|
|
18
|
+
const d = (c.data ?? []).map((l) => {
|
|
19
|
+
if (s && n) return l;
|
|
20
|
+
const f = v[e];
|
|
21
|
+
return l[f];
|
|
44
22
|
});
|
|
45
23
|
return {
|
|
46
|
-
...
|
|
47
|
-
data:
|
|
24
|
+
...c,
|
|
25
|
+
data: d
|
|
48
26
|
};
|
|
49
|
-
}, [e,
|
|
50
|
-
},
|
|
51
|
-
const
|
|
52
|
-
queryKey: [
|
|
53
|
-
queryFn: () =>
|
|
54
|
-
enabled:
|
|
55
|
-
select: (
|
|
27
|
+
}, [e, c, s, n]);
|
|
28
|
+
}, F = (t, e, o, n, a, u = !0) => {
|
|
29
|
+
const s = p({
|
|
30
|
+
queryKey: y([e]),
|
|
31
|
+
queryFn: () => a ? A(t ?? "", e ?? "") : D(t ?? "", e ?? ""),
|
|
32
|
+
enabled: u && n && !!t && !!e && !!o,
|
|
33
|
+
select: (r) => E(r)
|
|
56
34
|
}), i = p({
|
|
57
|
-
queryKey: [
|
|
58
|
-
queryFn: () =>
|
|
59
|
-
enabled:
|
|
60
|
-
select: (
|
|
35
|
+
queryKey: y([e]),
|
|
36
|
+
queryFn: () => q(t ?? "", e ?? ""),
|
|
37
|
+
enabled: u && !n && !!t && !!e && !!o,
|
|
38
|
+
select: (r) => E(r)
|
|
61
39
|
});
|
|
62
|
-
return
|
|
40
|
+
return n ? s : i;
|
|
41
|
+
}, K = (t) => {
|
|
42
|
+
const { data: e } = M("DataAreaGroup"), { data: o } = M("DataAreaEntity"), { data: n } = k(t === "ModuleDepended");
|
|
43
|
+
return Q(
|
|
44
|
+
(u) => {
|
|
45
|
+
if (t === "ModuleDepended")
|
|
46
|
+
return n ? n.find((r) => r.registeredEntityName === u)?.id : void 0;
|
|
47
|
+
if (!e || !o) return;
|
|
48
|
+
const i = e.find((r) => r.key === t)?.id;
|
|
49
|
+
if (i)
|
|
50
|
+
return o.find((r) => r.description === i && r.value === u)?.id;
|
|
51
|
+
},
|
|
52
|
+
[t, e, o, n]
|
|
53
|
+
);
|
|
63
54
|
};
|
|
64
55
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Q as FarmOrgEntitiesTypeResultMap,
|
|
68
|
-
q as ModuleDependedEntityTypeResultMap,
|
|
69
|
-
x as useEntity
|
|
56
|
+
P as useEntity,
|
|
57
|
+
K as useEntityId
|
|
70
58
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { u as y } from "../QueryClientProvider-DyiNrPkn.js";
|
|
2
|
+
import { useBasePropsStore as i } from "../stores/BasePropsStore.js";
|
|
3
|
+
import { fetchFromCustomApi as f, getFarmOrgEntities as m, getModuleDependedEntities as d } from "../utils/fetches.js";
|
|
4
|
+
import { getModuleQueryKey as o } from "../utils/helper.js";
|
|
5
|
+
import { useEntityId as p } from "./useEntity.js";
|
|
6
|
+
const I = () => {
|
|
7
|
+
const e = a(), t = h();
|
|
8
|
+
return {
|
|
9
|
+
prefetchCustom: e,
|
|
10
|
+
prefetch: t,
|
|
11
|
+
usePrefetchEntity: l
|
|
12
|
+
};
|
|
13
|
+
}, a = () => {
|
|
14
|
+
const e = y();
|
|
15
|
+
return async ({
|
|
16
|
+
queryKey: t,
|
|
17
|
+
endpoint: r,
|
|
18
|
+
token: u,
|
|
19
|
+
noAuth: s = !1
|
|
20
|
+
}) => {
|
|
21
|
+
await e.prefetchQuery({
|
|
22
|
+
queryKey: o(t),
|
|
23
|
+
queryFn: () => f(r, u, s)
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}, h = () => {
|
|
27
|
+
const e = y();
|
|
28
|
+
return ({
|
|
29
|
+
queryKey: t,
|
|
30
|
+
queryFn: r
|
|
31
|
+
}) => e.prefetchQuery({
|
|
32
|
+
queryKey: o(t),
|
|
33
|
+
queryFn: r
|
|
34
|
+
});
|
|
35
|
+
}, l = (e, ...t) => {
|
|
36
|
+
const { moduleId: r } = i(), u = y(), s = p(e);
|
|
37
|
+
if (!r) return "Prefetch failed: no moduleId";
|
|
38
|
+
t.forEach(async (c) => {
|
|
39
|
+
const n = s(c);
|
|
40
|
+
if (n) {
|
|
41
|
+
if (e !== "ModuleDepended") {
|
|
42
|
+
await u.prefetchQuery({
|
|
43
|
+
queryKey: o([n]),
|
|
44
|
+
queryFn: () => m(r, n)
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
await u.prefetchQuery({
|
|
49
|
+
queryKey: o([n]),
|
|
50
|
+
queryFn: () => d(r, n)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
I as useOffline
|
|
57
|
+
};
|
package/dist/hooks/useOption.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { g as c } from "../api-
|
|
3
|
-
import { useBasePropsStore as
|
|
1
|
+
import { u as m } from "../useQuery-DEU_AUtf.js";
|
|
2
|
+
import { g as c } from "../api-COabZnyn.js";
|
|
3
|
+
import { useBasePropsStore as n } from "../stores/BasePropsStore.js";
|
|
4
4
|
import { fetchFromCommonApi as i, fetchFromModuleApi as p } from "../utils/fetches.js";
|
|
5
|
-
import { universalSelector as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
queryKey: [
|
|
10
|
-
queryFn: () =>
|
|
11
|
-
select: (r) =>
|
|
5
|
+
import { getModuleQueryKey as l, universalSelector as s } from "../utils/helper.js";
|
|
6
|
+
const q = (e) => {
|
|
7
|
+
const t = n((r) => r.commonOptions), o = n((r) => r.currentLanguageId), u = c(t, e);
|
|
8
|
+
return m({
|
|
9
|
+
queryKey: [e, o],
|
|
10
|
+
queryFn: () => u ? Promise.resolve(u) : i(`${e}/dropdown`),
|
|
11
|
+
select: (r) => s(r)
|
|
12
12
|
});
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
queryKey: [
|
|
17
|
-
queryFn: () => p(`ModuleDependencies/${
|
|
18
|
-
select: (
|
|
19
|
-
enabled:
|
|
13
|
+
}, F = (e = !0) => {
|
|
14
|
+
const t = n((o) => o.moduleId);
|
|
15
|
+
return m({
|
|
16
|
+
queryKey: l([]),
|
|
17
|
+
queryFn: () => p(`ModuleDependencies/${t}`),
|
|
18
|
+
select: (o) => s(o),
|
|
19
|
+
enabled: e
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
F as useModuleDependency,
|
|
24
|
+
q as useOption
|
|
25
25
|
};
|
package/dist/hooks/useStores.js
CHANGED