@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.
- package/README.md +8 -8
- package/dist/ModuleCore-YCIFN_02.js +14973 -0
- package/dist/QueryClientProvider-Beog9TR7.js +437 -0
- package/dist/{_baseGet-Bh5zJ_C8.js → _baseGet-C6jMXSsQ.js} +448 -448
- package/dist/api-s6E2GJtu.js +458 -0
- package/dist/assets/ModuleCore.css +1 -0
- package/dist/chunk-QMGIS6GS-C4bgXQXY.js +9203 -0
- package/dist/components/ModuleBase.js +20 -681
- package/dist/components/ModuleCore.js +10 -0
- package/dist/hooks/useBreadcrumbTranslation.js +16 -13
- package/dist/hooks/useCustom.js +15 -15
- package/dist/hooks/useCustomMutation.js +23 -0
- package/dist/hooks/useEntity.js +53 -54
- package/dist/hooks/useOffline.js +45 -0
- package/dist/hooks/useOption.js +19 -17
- package/dist/hooks/useServiceBus.js +25 -0
- package/dist/hooks/useStores.js +11 -841
- package/dist/isRestoring-CLuxJVSA.js +281 -0
- 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}/useBreadcrumbTranslation.d.ts +1 -1
- package/dist/lib/hooks/useCustom.d.ts +8 -0
- package/dist/lib/hooks/useCustomMutation.d.ts +9 -0
- package/dist/{hooks → lib/hooks}/useEntity.d.ts +6 -30
- package/dist/lib/hooks/useOffline.d.ts +15 -0
- package/dist/{hooks → lib/hooks}/useOption.d.ts +1 -1
- package/dist/lib/hooks/useServiceBus.d.ts +19 -0
- package/dist/lib/hooks/useStores.d.ts +38 -0
- package/dist/lib/main.d.ts +27 -0
- package/dist/lib/module-router.d.ts +7 -0
- package/dist/{stores → lib/stores}/EnvironmentStore.d.ts +1 -1
- package/dist/lib/types/ActionStorage.d.ts +16 -0
- package/dist/{types → lib/types}/BaseProps.d.ts +14 -2
- package/dist/{types → lib/types}/Deprecated.d.ts +7 -1
- package/dist/lib/types/Entities.d.ts +22 -0
- package/dist/{types → lib/types}/Environment.d.ts +3 -2
- package/dist/lib/types/EnvironmentVariable.d.ts +6 -0
- package/dist/lib/types/ModuleApi.d.ts +163 -0
- package/dist/{types → lib/types}/Requests.d.ts +6 -11
- package/dist/lib/types/ServiceBus.d.ts +17 -0
- package/dist/{utils/fetches.d.ts → lib/utils/api.d.ts} +2 -8
- package/dist/lib/utils/baseFetches.d.ts +19 -0
- package/dist/lib/utils/fetches.d.ts +43 -0
- package/dist/lib/utils/helper.d.ts +29 -0
- package/dist/main.js +224 -17
- package/dist/module-router.js +137 -0
- package/dist/mutation-DSKlaYzY.js +192 -0
- package/dist/omit-C9Qe80rl.js +835 -0
- package/dist/stores/EnvironmentStore.js +9 -3
- package/dist/types/ActionStorage.js +4 -0
- package/dist/types/Entities.js +25 -0
- package/dist/types/EnvironmentVariable.js +1 -0
- package/dist/types/Requests.js +1 -4
- package/dist/types/ServiceBus.js +1 -0
- package/dist/useMutation-zu8uxBak.js +97 -0
- package/dist/{useQuery-znAyMQW1.js → useQuery-Bj9k9zik.js} +106 -108
- package/dist/utils/api.js +9 -0
- package/dist/utils/baseFetches.js +19 -0
- package/dist/utils/fetches.js +20 -14
- package/dist/utils/helper.js +55 -0
- package/dist/utils-DxRR_XLb.js +9 -0
- package/package.json +8 -3
- package/dist/QueryClientProvider-DQv4Y3Qu.js +0 -707
- package/dist/chunk-IR6S3I6Y-BvQXS3A3.js +0 -3908
- package/dist/components/ModuleBase.d.ts +0 -11
- package/dist/fetches-DUCQo_6B.js +0 -477
- package/dist/hooks/useCustom.d.ts +0 -6
- package/dist/hooks/useNavigate.d.ts +0 -5
- package/dist/hooks/useNavigate.js +0 -27
- package/dist/hooks/useStores.d.ts +0 -29
- package/dist/main.d.ts +0 -9
- package/dist/types/ModuleApi.d.ts +0 -80
- /package/dist/{hooks → lib/hooks}/useSignalRMessages.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/{types → lib/types}/AppInsights.d.ts +0 -0
- /package/dist/{types → lib/types}/CommonOptions.d.ts +0 -0
- /package/dist/{types → lib/types}/SystemMessage.d.ts +0 -0
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { useBasePropsStore as
|
|
3
|
-
const
|
|
4
|
-
const a =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useCallback as d } from "react";
|
|
2
|
+
import { useBasePropsStore as s } from "../stores/BasePropsStore.js";
|
|
3
|
+
const u = () => {
|
|
4
|
+
const o = s((a) => a.addBreadcrumbTranslation), t = s((a) => a.addTranslation);
|
|
5
|
+
return d(
|
|
6
|
+
(a, r) => {
|
|
7
|
+
const e = a, n = typeof r == "boolean" ? a : r;
|
|
8
|
+
if (o) {
|
|
9
|
+
o(
|
|
10
|
+
{ key: e, value: n },
|
|
11
|
+
//if boolean hide the translation in the breadcrumb
|
|
12
|
+
typeof r == "boolean"
|
|
13
|
+
);
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
|
-
t && t({ key:
|
|
16
|
+
t && t({ key: e, value: n }, typeof r == "boolean");
|
|
14
17
|
},
|
|
15
|
-
[
|
|
18
|
+
[o, t]
|
|
16
19
|
);
|
|
17
20
|
};
|
|
18
21
|
export {
|
|
19
|
-
|
|
22
|
+
u as useBreadcrumbTranslation
|
|
20
23
|
};
|
package/dist/hooks/useCustom.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import {
|
|
3
|
-
import { universalSelector as
|
|
4
|
-
import { d as n } from "../fetches-DUCQo_6B.js";
|
|
1
|
+
import { u as f } from "../useQuery-Bj9k9zik.js";
|
|
2
|
+
import { fetchFromCustomApi as i } from "../utils/fetches.js";
|
|
3
|
+
import { universalSelector as n } from "../utils/helper.js";
|
|
5
4
|
const y = ({
|
|
6
|
-
endpoint:
|
|
7
|
-
queryKey:
|
|
8
|
-
token:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
endpoint: o,
|
|
6
|
+
queryKey: t,
|
|
7
|
+
token: u,
|
|
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
|
+
});
|
|
17
17
|
export {
|
|
18
18
|
y as useCustom
|
|
19
19
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { u as n } from "../useMutation-zu8uxBak.js";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import "../provider/SignalR/SignalRProvider.js";
|
|
5
|
+
import "../stores/BasePropsStore.js";
|
|
6
|
+
import "../ModuleCore-YCIFN_02.js";
|
|
7
|
+
import { mutateOnCustomApi as s } from "../utils/fetches.js";
|
|
8
|
+
import "../api-s6E2GJtu.js";
|
|
9
|
+
import "../types/Entities.js";
|
|
10
|
+
import "../omit-C9Qe80rl.js";
|
|
11
|
+
import "../stores/EnvironmentStore.js";
|
|
12
|
+
const d = ({
|
|
13
|
+
endpoint: t,
|
|
14
|
+
method: o,
|
|
15
|
+
token: m,
|
|
16
|
+
headers: r,
|
|
17
|
+
noAuth: i
|
|
18
|
+
}) => n({
|
|
19
|
+
mutationFn: (p, u) => s(u ?? t, p, o, m, r, i)
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
d as useCustomMutation
|
|
23
|
+
};
|
package/dist/hooks/useEntity.js
CHANGED
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { useMemo as g } from "react";
|
|
3
|
-
import { useBasePropsStore as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useOption as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
import { u as l } from "../useQuery-Bj9k9zik.js";
|
|
2
|
+
import { useMemo as M, useCallback as g } from "react";
|
|
3
|
+
import { useBasePropsStore as p } from "../stores/BasePropsStore.js";
|
|
4
|
+
import { getModuleDependedEntitiesRaw as Q, getModuleDependedEntities as A, getFarmOrgEntities as D } from "../utils/fetches.js";
|
|
5
|
+
import { getModuleQueryKey as m, universalSelector as y } from "../utils/helper.js";
|
|
6
|
+
import { useOption as E, useModuleDependency as q } from "./useOption.js";
|
|
7
|
+
import { AllEntitiesTypeResultMap as k } from "../types/Entities.js";
|
|
8
|
+
const N = (t, e, u = !0, n = !1) => {
|
|
9
|
+
const a = p((i) => i.moduleId), o = p((i) => i.organizationId), s = t === "ModuleDepended", { getEntityId: d } = K(t), r = F(
|
|
10
|
+
a,
|
|
11
|
+
d(e),
|
|
12
|
+
o,
|
|
13
|
+
s,
|
|
14
|
+
n,
|
|
15
|
+
u
|
|
16
|
+
);
|
|
17
|
+
return M(() => {
|
|
18
|
+
const i = (r.data ?? []).map((c) => {
|
|
19
|
+
const f = k[e];
|
|
20
|
+
return s && n ? c : c[f];
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
...r,
|
|
24
|
+
data: i
|
|
25
|
+
};
|
|
26
|
+
}, [e, r, s, n]);
|
|
27
|
+
}, F = (t, e, u, n, a, o = !0) => {
|
|
28
|
+
const s = l({
|
|
29
|
+
queryKey: m([e]),
|
|
30
|
+
queryFn: () => a ? Q(t ?? "", e ?? "") : A(t ?? "", e ?? ""),
|
|
31
|
+
enabled: o && n && !!t && !!e && !!u,
|
|
32
|
+
select: (r) => y(r)
|
|
33
|
+
}), d = l({
|
|
34
|
+
queryKey: m([e]),
|
|
35
|
+
queryFn: () => D(t ?? "", e ?? ""),
|
|
36
|
+
enabled: o && !n && !!t && !!e && !!u,
|
|
37
|
+
select: (r) => y(r)
|
|
33
38
|
});
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
select: (n) => p(n)
|
|
49
|
-
});
|
|
50
|
-
return o ? i : u;
|
|
39
|
+
return n ? s : d;
|
|
40
|
+
}, K = (t) => {
|
|
41
|
+
const { data: e } = E("DataAreaGroup"), { data: u } = E("DataAreaEntity"), { data: n } = q(t === "ModuleDepended");
|
|
42
|
+
return { getEntityId: g(
|
|
43
|
+
(o) => {
|
|
44
|
+
if (t === "ModuleDepended")
|
|
45
|
+
return n ? n.find((r) => r.registeredEntityName === o)?.id : void 0;
|
|
46
|
+
if (!e || !u) return;
|
|
47
|
+
const d = e.find((r) => r.key === t)?.id;
|
|
48
|
+
if (d)
|
|
49
|
+
return u.find((r) => r.description === d && r.value === o)?.id;
|
|
50
|
+
},
|
|
51
|
+
[t, e, u, n]
|
|
52
|
+
) };
|
|
51
53
|
};
|
|
52
54
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
F as FarmOrgEntitiesTypeResultMap,
|
|
56
|
-
q as ModuleDependedEntityTypeResultMap,
|
|
57
|
-
B as useEntity
|
|
55
|
+
N as useEntity,
|
|
56
|
+
K as useEntityId
|
|
58
57
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { u as f } from "../QueryClientProvider-Beog9TR7.js";
|
|
2
|
+
import { fetchFromCustomApi as i, getFarmOrgEntities as c, getModuleDependedEntities as m } from "../utils/fetches.js";
|
|
3
|
+
import { getModuleQueryKey as o } from "../utils/helper.js";
|
|
4
|
+
import { useBasePropsStore as p } from "../stores/BasePropsStore.js";
|
|
5
|
+
import { useEntityId as d } from "./useEntity.js";
|
|
6
|
+
const I = () => {
|
|
7
|
+
const { moduleId: n } = p(), u = f();
|
|
8
|
+
return {
|
|
9
|
+
prefetchCustom: async ({
|
|
10
|
+
queryKey: e,
|
|
11
|
+
endpoint: t,
|
|
12
|
+
token: s,
|
|
13
|
+
noAuth: y = !1
|
|
14
|
+
}) => {
|
|
15
|
+
await u.prefetchQuery({
|
|
16
|
+
queryKey: o(e),
|
|
17
|
+
queryFn: () => i(t, s, y)
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
prefetch: ({
|
|
21
|
+
queryKey: e,
|
|
22
|
+
queryFn: t
|
|
23
|
+
}) => u.prefetchQuery({
|
|
24
|
+
queryKey: o(e),
|
|
25
|
+
queryFn: t
|
|
26
|
+
}),
|
|
27
|
+
usePrefetchEntity: (e, ...t) => {
|
|
28
|
+
const { getEntityId: s } = d(e);
|
|
29
|
+
if (!n) return "Prefetch failed: no moduleId";
|
|
30
|
+
t.forEach(async (y) => {
|
|
31
|
+
const r = s(y);
|
|
32
|
+
r && (e !== "ModuleDepended" ? await u.prefetchQuery({
|
|
33
|
+
queryKey: o([r]),
|
|
34
|
+
queryFn: () => c(n, r)
|
|
35
|
+
}) : await u.prefetchQuery({
|
|
36
|
+
queryKey: o([r]),
|
|
37
|
+
queryFn: () => m(n, r)
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
I as useOffline
|
|
45
|
+
};
|
package/dist/hooks/useOption.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import {
|
|
3
|
-
import { useBasePropsStore as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { u as m } from "../useQuery-Bj9k9zik.js";
|
|
2
|
+
import { g as u } from "../api-s6E2GJtu.js";
|
|
3
|
+
import { useBasePropsStore as n } from "../stores/BasePropsStore.js";
|
|
4
|
+
import { fetchFromModuleApi as c, fetchFromCommonApi as i } from "../utils/fetches.js";
|
|
5
|
+
import { getModuleQueryKey as p, universalSelector as s } from "../utils/helper.js";
|
|
6
|
+
const q = (o) => {
|
|
7
|
+
const r = n((t) => t.commonOptions), e = u(r, o);
|
|
8
|
+
return m({
|
|
8
9
|
queryKey: [o],
|
|
9
|
-
queryFn: () => e ? Promise.resolve(e) :
|
|
10
|
-
select: (
|
|
10
|
+
queryFn: () => e ? Promise.resolve(e) : i(`${o}/dropdown`),
|
|
11
|
+
select: (t) => s(t)
|
|
11
12
|
});
|
|
12
|
-
},
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
queryKey: [
|
|
16
|
-
queryFn: () =>
|
|
17
|
-
select: (e) =>
|
|
13
|
+
}, F = (o = !0) => {
|
|
14
|
+
const r = n((e) => e.moduleId);
|
|
15
|
+
return m({
|
|
16
|
+
queryKey: p([]),
|
|
17
|
+
queryFn: () => c(`ModuleDependencies/${r}`),
|
|
18
|
+
select: (e) => s(e),
|
|
19
|
+
enabled: o
|
|
18
20
|
});
|
|
19
21
|
};
|
|
20
22
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
F as useModuleDependency,
|
|
24
|
+
q as useOption
|
|
23
25
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { u as n } from "../useMutation-zu8uxBak.js";
|
|
2
|
+
import { useBasePropsStore as r } from "../stores/BasePropsStore.js";
|
|
3
|
+
const a = ({
|
|
4
|
+
authenticationKey: i,
|
|
5
|
+
queue: s,
|
|
6
|
+
topic: o
|
|
7
|
+
}) => {
|
|
8
|
+
const e = r((t) => t.serviceBusNotification), c = r((t) => t.throwError);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw c?.("serviceBusNotification is not defined", 400);
|
|
11
|
+
return n({
|
|
12
|
+
mutationFn: (t) => e(t, i, s, o)
|
|
13
|
+
});
|
|
14
|
+
}, N = () => {
|
|
15
|
+
const i = r((o) => o.riseNotification), s = r((o) => o.throwError);
|
|
16
|
+
if (!i)
|
|
17
|
+
throw s?.("riseNotification is not defined", 400);
|
|
18
|
+
return n({
|
|
19
|
+
mutationFn: (o) => i(o)
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
N as useNotification,
|
|
24
|
+
a as useServiceBus
|
|
25
|
+
};
|