@hortiview/modulebase 1.1.2-alpha.870da389.1 → 1.1.2-alpha.a87fc893.1
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-DRMqZO8r.js → ModuleCore-C4Z4zObE.js} +3030 -3110
- package/{dist/api-COabZnyn.js → api-CikhPcJj.js} +10 -10
- package/{dist/chunk-EVOBXE3Y-B43QN6RE.js → chunk-KS7C4IRE-CT7Z8Xx_.js} +3866 -3585
- package/components/ModuleBase.js +30 -0
- package/{dist/components → components}/ModuleCore.js +2 -3
- package/{dist/constants.js → constants.js} +8 -8
- package/{dist/hooks → hooks}/useCustom.js +9 -9
- package/{dist/hooks → hooks}/useCustomMutation.js +6 -6
- package/{dist/hooks → hooks}/useEntity.js +5 -5
- package/hooks/useOffline.js +57 -0
- package/{dist/hooks → hooks}/useOption.js +6 -6
- package/{dist/hooks → hooks}/useSignalRMessages.js +1 -1
- package/{dist/hooks → hooks}/useStores.js +1 -1
- package/{dist/isTypedArray-SkhznY1k.js → isTypedArray-T1_r8YHg.js} +33 -33
- package/{dist/lib → lib}/components/ModuleBase.d.ts +1 -1
- package/{dist/lib → lib}/components/ModuleCore.d.ts +1 -2
- package/{dist/lib → lib}/hooks/useCustom.d.ts +1 -1
- package/{dist/lib → lib}/hooks/useCustomMutation.d.ts +1 -1
- package/{dist/lib → lib}/hooks/useOffline.d.ts +5 -5
- package/lib/provider/SignalR/SignalRModuleContext.d.ts +4 -0
- package/lib/provider/SignalR/SignalRProvider.d.ts +9 -0
- package/lib/types/BaseProps.d.ts +98 -0
- package/lib/utils/IndexedDbService.d.ts +6 -0
- package/main.js +228 -0
- package/{dist/module-router.js → module-router.js} +813 -847
- package/{dist/omit-DYPaIq41.js → omit-CiJPWayj.js} +66 -66
- package/package.json +22 -56
- package/provider/SignalR/SignalRModuleContext.js +6205 -0
- package/provider/SignalR/SignalRProvider.js +35 -0
- package/{dist/stores → stores}/BasePropsStore.js +1 -0
- package/{dist/stores → stores}/EnvironmentStore.js +5 -5
- package/{dist/types → types}/Entities.js +5 -5
- package/{dist/useCustomMutation-9VUQ7NbQ.js → useCustomMutation-BX8lKAYe.js} +10 -10
- package/{dist/useQuery-DUDyh33-.js → useQuery-URJEw3ly.js} +128 -126
- package/utils/IndexedDbService.js +43 -0
- package/{dist/utils → utils}/api.js +1 -1
- package/{dist/utils → utils}/baseFetches.js +1 -1
- package/README.md +0 -9
- package/dist/components/ModuleBase.js +0 -21
- package/dist/hooks/useOffline.js +0 -57
- package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -13
- package/dist/lib/types/BaseProps.d.ts +0 -48
- package/dist/lib/utils/IndexedDbService.d.ts +0 -33
- package/dist/main.js +0 -228
- package/dist/provider/SignalR/SignalRProvider.js +0 -5979
- package/dist/utils/IndexedDbService.js +0 -43
- package/{dist/IsRestoringProvider-SzKJZczp.js → IsRestoringProvider-SzKJZczp.js} +0 -0
- package/{dist/_commonjsHelpers-ByX85dGu.js → _commonjsHelpers-ByX85dGu.js} +0 -0
- package/{dist/assets → assets}/ModuleCore.css +0 -0
- package/{dist/enum → enum}/ActionStorage.js +0 -0
- package/{dist/hooks → hooks}/useBreadcrumbTranslation.js +0 -0
- package/{dist/lib → lib}/constants.d.ts +8 -8
- /package/{dist/lib → lib}/enum/ActionStorage.d.ts +0 -0
- /package/{dist/lib → lib}/hooks/useBreadcrumbTranslation.d.ts +0 -0
- /package/{dist/lib → lib}/hooks/useEntity.d.ts +0 -0
- /package/{dist/lib → lib}/hooks/useOption.d.ts +0 -0
- /package/{dist/lib → lib}/hooks/useSignalRMessages.d.ts +0 -0
- /package/{dist/lib → lib}/hooks/useStores.d.ts +0 -0
- /package/{dist/lib → lib}/main.d.ts +0 -0
- /package/{dist/lib → lib}/module-router.d.ts +0 -0
- /package/{dist/lib → lib}/provider/SignalR/signalR.d.ts +0 -0
- /package/{dist/lib → lib}/stores/BasePropsStore.d.ts +0 -0
- /package/{dist/lib → lib}/stores/EnvironmentStore.d.ts +0 -0
- /package/{dist/lib → lib}/types/ActionStorage.d.ts +0 -0
- /package/{dist/lib → lib}/types/AppInsights.d.ts +0 -0
- /package/{dist/lib → lib}/types/CommonOptions.d.ts +0 -0
- /package/{dist/lib → lib}/types/Entities.d.ts +0 -0
- /package/{dist/lib → lib}/types/Environment.d.ts +0 -0
- /package/{dist/lib → lib}/types/EnvironmentVariable.d.ts +0 -0
- /package/{dist/lib → lib}/types/ModuleApi.d.ts +0 -0
- /package/{dist/lib → lib}/types/Requests.d.ts +0 -0
- /package/{dist/lib → lib}/types/ServiceBus.d.ts +0 -0
- /package/{dist/lib → lib}/types/SystemMessage.d.ts +0 -0
- /package/{dist/lib → lib}/utils/api.d.ts +0 -0
- /package/{dist/lib → lib}/utils/baseFetches.d.ts +0 -0
- /package/{dist/lib → lib}/utils/fetches.d.ts +0 -0
- /package/{dist/lib → lib}/utils/helper.d.ts +0 -0
- /package/{dist/provider → provider}/SignalR/signalR.js +0 -0
- /package/{dist/react-c9FSfB30.js → react-c9FSfB30.js} +0 -0
- /package/{dist/types → types}/ActionStorage.js +0 -0
- /package/{dist/types → types}/AppInsights.js +0 -0
- /package/{dist/types → types}/BaseProps.js +0 -0
- /package/{dist/types → types}/CommonOptions.js +0 -0
- /package/{dist/types → types}/Environment.js +0 -0
- /package/{dist/types → types}/EnvironmentVariable.js +0 -0
- /package/{dist/types → types}/ModuleApi.js +0 -0
- /package/{dist/types → types}/Requests.js +0 -0
- /package/{dist/types → types}/ServiceBus.js +0 -0
- /package/{dist/types → types}/SystemMessage.js +0 -0
- /package/{dist/utils → utils}/fetches.js +0 -0
- /package/{dist/utils → utils}/helper.js +0 -0
- /package/{dist/vite-env.d.js → vite-env.d.js} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as m, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import { useBasePropsStore as t } from "../../stores/BasePropsStore.js";
|
|
4
|
+
import { useEnvironmentStore as p } from "../../stores/EnvironmentStore.js";
|
|
5
|
+
import { SignalRModuleContext as l } from "./SignalRModuleContext.js";
|
|
6
|
+
const A = ({
|
|
7
|
+
children: i,
|
|
8
|
+
enabled: c
|
|
9
|
+
}) => {
|
|
10
|
+
const e = t((o) => o.modulePermissionToken), r = t((o) => o.moduleId), n = t((o) => o.organizationId), s = p((o) => o.environment), a = u(
|
|
11
|
+
() => ({
|
|
12
|
+
accessTokenFactory: () => e ?? "",
|
|
13
|
+
automaticReconnect: [1e4, 2e4, 3e4, 6e4],
|
|
14
|
+
// 10s, 20s, 30s, 60s four retries
|
|
15
|
+
headers: {
|
|
16
|
+
Authorization: `Bearer ${e}`
|
|
17
|
+
},
|
|
18
|
+
onError: async (o) => console.error("SignalR connection error", o)
|
|
19
|
+
}),
|
|
20
|
+
[e]
|
|
21
|
+
);
|
|
22
|
+
return c ? /* @__PURE__ */ m(
|
|
23
|
+
l.Provider,
|
|
24
|
+
{
|
|
25
|
+
...a,
|
|
26
|
+
connectEnabled: !!e && !!r && !!n,
|
|
27
|
+
dependencies: [e, r, s?.MODULE_AUTH_API, n],
|
|
28
|
+
url: `${s?.MODULE_AUTH_API}/api/${n}/${r}/pushNotifications`,
|
|
29
|
+
children: i
|
|
30
|
+
}
|
|
31
|
+
) : /* @__PURE__ */ m(d, { children: i });
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
A as SignalRProvider
|
|
35
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { c as r } from "../react-c9FSfB30.js";
|
|
2
2
|
const E = r((e) => ({
|
|
3
|
+
addEnvironment: (n) => e((o) => ({ environment: { ...n, ...o.environment } })),
|
|
3
4
|
environment: {
|
|
4
|
-
|
|
5
|
+
API_PREFIX: "",
|
|
5
6
|
COMMON_API: "",
|
|
6
|
-
|
|
7
|
+
ENVIRONMENT: "DEV",
|
|
7
8
|
MODULE_AUTH_API: "",
|
|
8
|
-
|
|
9
|
+
REQ_VERSION: ""
|
|
9
10
|
},
|
|
10
|
-
setEnvironment: (n) => e({ environment: n })
|
|
11
|
-
addEnvironment: (n) => e((o) => ({ environment: { ...n, ...o.environment } }))
|
|
11
|
+
setEnvironment: (n) => e({ environment: n })
|
|
12
12
|
}));
|
|
13
13
|
export {
|
|
14
14
|
E as useEnvironmentStore
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const e = {
|
|
2
|
+
alert_rules: "farmAlertRule",
|
|
3
|
+
farm_organizations: "farmOrg",
|
|
2
4
|
farms: "farm",
|
|
3
5
|
fields: "field",
|
|
4
|
-
zones: "block",
|
|
5
6
|
irrigation_stations: "irrigationStation",
|
|
6
|
-
|
|
7
|
-
alert_rules: "farmAlertRule"
|
|
7
|
+
zones: "block"
|
|
8
8
|
}, t = {
|
|
9
9
|
farm_members: "member"
|
|
10
10
|
}, a = {
|
|
11
|
-
Season: "season",
|
|
12
11
|
BlockPlantLayout: "blockPlantLayout",
|
|
13
12
|
Record: "recordLight",
|
|
14
|
-
Scouting: "scouting"
|
|
13
|
+
Scouting: "scouting",
|
|
14
|
+
Season: "season"
|
|
15
15
|
}, r = {
|
|
16
16
|
...e,
|
|
17
17
|
...t,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as n from "react";
|
|
2
|
-
import { g as m } from "./ModuleCore-
|
|
2
|
+
import { g as m } from "./ModuleCore-C4Z4zObE.js";
|
|
3
3
|
import { S as p, s as l, b as u, n as c, u as d, c as b, d as v } from "./IsRestoringProvider-SzKJZczp.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
|
-
import "./provider/SignalR/SignalRProvider.js";
|
|
6
5
|
import "./stores/BasePropsStore.js";
|
|
6
|
+
import "./stores/EnvironmentStore.js";
|
|
7
|
+
import "./provider/SignalR/SignalRModuleContext.js";
|
|
7
8
|
import { mutateOnCustomApi as f } from "./utils/fetches.js";
|
|
8
9
|
import "./types/Entities.js";
|
|
9
|
-
import "./api-
|
|
10
|
-
import "./omit-
|
|
11
|
-
import "./stores/EnvironmentStore.js";
|
|
10
|
+
import "./api-CikhPcJj.js";
|
|
11
|
+
import "./omit-CiJPWayj.js";
|
|
12
12
|
var y = class extends p {
|
|
13
13
|
#s;
|
|
14
14
|
#i = void 0;
|
|
@@ -144,13 +144,13 @@ function O(t, s) {
|
|
|
144
144
|
}
|
|
145
145
|
const P = ({
|
|
146
146
|
endpoint: t,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
headers: s,
|
|
148
|
+
method: r,
|
|
149
|
+
noAuth: e,
|
|
150
|
+
token: i,
|
|
151
151
|
...a
|
|
152
152
|
}) => O({
|
|
153
|
-
mutationFn: ({ input: o, replaceEndpointWith: h }) => f(h ?? t, o,
|
|
153
|
+
mutationFn: ({ input: o, replaceEndpointWith: h }) => f(h ?? t, o, r, i, s, e),
|
|
154
154
|
...a
|
|
155
155
|
});
|
|
156
156
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as q, p as L, r as
|
|
2
|
-
import * as
|
|
1
|
+
import { S as q, p as L, r as c, s as Q, e as y, c as _, f as F, i as j, t as K, g as C, j as $, k as G, l as B, n as W, d as z, m as J, u as X } from "./IsRestoringProvider-SzKJZczp.js";
|
|
2
|
+
import * as v from "react";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
var Y = class extends q {
|
|
5
5
|
constructor(t, e) {
|
|
@@ -13,7 +13,7 @@ var Y = class extends q {
|
|
|
13
13
|
#u;
|
|
14
14
|
#r;
|
|
15
15
|
#i;
|
|
16
|
-
#
|
|
16
|
+
#v;
|
|
17
17
|
#l;
|
|
18
18
|
// This property keeps track of the last query with defined data.
|
|
19
19
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
@@ -32,14 +32,14 @@ var Y = class extends q {
|
|
|
32
32
|
this.hasListeners() || this.destroy();
|
|
33
33
|
}
|
|
34
34
|
shouldFetchOnReconnect() {
|
|
35
|
-
return
|
|
35
|
+
return P(
|
|
36
36
|
this.#t,
|
|
37
37
|
this.options,
|
|
38
38
|
this.options.refetchOnReconnect
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
shouldFetchOnWindowFocus() {
|
|
42
|
-
return
|
|
42
|
+
return P(
|
|
43
43
|
this.#t,
|
|
44
44
|
this.options,
|
|
45
45
|
this.options.refetchOnWindowFocus
|
|
@@ -50,11 +50,11 @@ var Y = class extends q {
|
|
|
50
50
|
}
|
|
51
51
|
setOptions(t) {
|
|
52
52
|
const e = this.options, s = this.#t;
|
|
53
|
-
if (this.options = this.#s.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof
|
|
53
|
+
if (this.options = this.#s.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof c(this.options.enabled, this.#t) != "boolean")
|
|
54
54
|
throw new Error(
|
|
55
55
|
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
56
56
|
);
|
|
57
|
-
this.#O(), this.#t.setOptions(this.options), e._defaulted && !
|
|
57
|
+
this.#O(), this.#t.setOptions(this.options), e._defaulted && !Q(this.options, e) && this.#s.getQueryCache().notify({
|
|
58
58
|
type: "observerOptionsUpdated",
|
|
59
59
|
query: this.#t,
|
|
60
60
|
observer: this
|
|
@@ -65,9 +65,9 @@ var Y = class extends q {
|
|
|
65
65
|
s,
|
|
66
66
|
this.options,
|
|
67
67
|
e
|
|
68
|
-
) && this.#c(), this.updateResult(), r && (this.#t !== s ||
|
|
69
|
-
const
|
|
70
|
-
r && (this.#t !== s ||
|
|
68
|
+
) && this.#c(), this.updateResult(), r && (this.#t !== s || c(this.options.enabled, this.#t) !== c(e.enabled, this.#t) || y(this.options.staleTime, this.#t) !== y(e.staleTime, this.#t)) && this.#b();
|
|
69
|
+
const n = this.#m();
|
|
70
|
+
r && (this.#t !== s || c(this.options.enabled, this.#t) !== c(e.enabled, this.#t) || n !== this.#n) && this.#g(n);
|
|
71
71
|
}
|
|
72
72
|
getOptimisticResult(t) {
|
|
73
73
|
const e = this.#s.getQueryCache().build(this.#s, t), s = this.createResult(e, t);
|
|
@@ -112,116 +112,116 @@ var Y = class extends q {
|
|
|
112
112
|
this.options,
|
|
113
113
|
t
|
|
114
114
|
);
|
|
115
|
-
return t?.throwOnError || (e = e.catch(
|
|
115
|
+
return t?.throwOnError || (e = e.catch(_)), e;
|
|
116
116
|
}
|
|
117
|
-
#
|
|
117
|
+
#b() {
|
|
118
118
|
this.#R();
|
|
119
119
|
const t = y(
|
|
120
120
|
this.options.staleTime,
|
|
121
121
|
this.#t
|
|
122
122
|
);
|
|
123
|
-
if (
|
|
123
|
+
if (F.isServer() || this.#e.isStale || !j(t))
|
|
124
124
|
return;
|
|
125
125
|
const s = K(this.#e.dataUpdatedAt, t) + 1;
|
|
126
|
-
this.#o =
|
|
126
|
+
this.#o = C.setTimeout(() => {
|
|
127
127
|
this.#e.isStale || this.updateResult();
|
|
128
128
|
}, s);
|
|
129
129
|
}
|
|
130
|
-
#
|
|
130
|
+
#m() {
|
|
131
131
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
132
132
|
}
|
|
133
133
|
#g(t) {
|
|
134
|
-
this.#S(), this.#n = t, !(
|
|
134
|
+
this.#S(), this.#n = t, !(F.isServer() || c(this.options.enabled, this.#t) === !1 || !j(this.#n) || this.#n === 0) && (this.#h = C.setInterval(() => {
|
|
135
135
|
(this.options.refetchIntervalInBackground || $.isFocused()) && this.#c();
|
|
136
136
|
}, this.#n));
|
|
137
137
|
}
|
|
138
138
|
#y() {
|
|
139
|
-
this.#
|
|
139
|
+
this.#b(), this.#g(this.#m());
|
|
140
140
|
}
|
|
141
141
|
#R() {
|
|
142
|
-
this.#o !== void 0 && (
|
|
142
|
+
this.#o !== void 0 && (C.clearTimeout(this.#o), this.#o = void 0);
|
|
143
143
|
}
|
|
144
144
|
#S() {
|
|
145
|
-
this.#h !== void 0 && (
|
|
145
|
+
this.#h !== void 0 && (C.clearInterval(this.#h), this.#h = void 0);
|
|
146
146
|
}
|
|
147
147
|
createResult(t, e) {
|
|
148
|
-
const s = this.#t, r = this.options,
|
|
149
|
-
let
|
|
148
|
+
const s = this.#t, r = this.options, n = this.#e, u = this.#a, a = this.#u, b = t !== s ? t.state : this.#p, { state: R } = t;
|
|
149
|
+
let i = { ...R }, l = !1, o;
|
|
150
150
|
if (e._optimisticResults) {
|
|
151
|
-
const
|
|
152
|
-
(g ||
|
|
153
|
-
...
|
|
154
|
-
...G(
|
|
155
|
-
}), e._optimisticResults === "isRestoring" && (
|
|
151
|
+
const h = this.hasListeners(), g = !h && A(t, e), O = h && H(t, s, e, r);
|
|
152
|
+
(g || O) && (i = {
|
|
153
|
+
...i,
|
|
154
|
+
...G(R.data, t.options)
|
|
155
|
+
}), e._optimisticResults === "isRestoring" && (i.fetchStatus = "idle");
|
|
156
156
|
}
|
|
157
|
-
let { error:
|
|
158
|
-
o =
|
|
157
|
+
let { error: m, errorUpdatedAt: S, status: p } = i;
|
|
158
|
+
o = i.data;
|
|
159
159
|
let D = !1;
|
|
160
160
|
if (e.placeholderData !== void 0 && o === void 0 && p === "pending") {
|
|
161
|
-
let
|
|
162
|
-
|
|
161
|
+
let h;
|
|
162
|
+
n?.isPlaceholderData && e.placeholderData === a?.placeholderData ? (h = n.data, D = !0) : h = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
163
163
|
this.#d?.state.data,
|
|
164
164
|
this.#d
|
|
165
|
-
) : e.placeholderData,
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
) : e.placeholderData, h !== void 0 && (p = "success", o = B(
|
|
166
|
+
n?.data,
|
|
167
|
+
h,
|
|
168
168
|
e
|
|
169
|
-
),
|
|
169
|
+
), l = !0);
|
|
170
170
|
}
|
|
171
171
|
if (e.select && o !== void 0 && !D)
|
|
172
|
-
if (
|
|
172
|
+
if (n && o === u?.data && e.select === this.#v)
|
|
173
173
|
o = this.#l;
|
|
174
174
|
else
|
|
175
175
|
try {
|
|
176
|
-
this.#
|
|
177
|
-
} catch (
|
|
178
|
-
this.#i =
|
|
176
|
+
this.#v = e.select, o = e.select(o), o = B(n?.data, o, e), this.#l = o, this.#i = null;
|
|
177
|
+
} catch (h) {
|
|
178
|
+
this.#i = h;
|
|
179
179
|
}
|
|
180
|
-
this.#i && (
|
|
181
|
-
const
|
|
180
|
+
this.#i && (m = this.#i, o = this.#l, S = Date.now(), p = "error");
|
|
181
|
+
const I = i.fetchStatus === "fetching", T = p === "pending", M = p === "error", U = T && I, k = o !== void 0, f = {
|
|
182
182
|
status: p,
|
|
183
|
-
fetchStatus:
|
|
184
|
-
isPending:
|
|
183
|
+
fetchStatus: i.fetchStatus,
|
|
184
|
+
isPending: T,
|
|
185
185
|
isSuccess: p === "success",
|
|
186
|
-
isError:
|
|
186
|
+
isError: M,
|
|
187
187
|
isInitialLoading: U,
|
|
188
188
|
isLoading: U,
|
|
189
189
|
data: o,
|
|
190
|
-
dataUpdatedAt:
|
|
191
|
-
error:
|
|
192
|
-
errorUpdatedAt:
|
|
193
|
-
failureCount:
|
|
194
|
-
failureReason:
|
|
195
|
-
errorUpdateCount:
|
|
190
|
+
dataUpdatedAt: i.dataUpdatedAt,
|
|
191
|
+
error: m,
|
|
192
|
+
errorUpdatedAt: S,
|
|
193
|
+
failureCount: i.fetchFailureCount,
|
|
194
|
+
failureReason: i.fetchFailureReason,
|
|
195
|
+
errorUpdateCount: i.errorUpdateCount,
|
|
196
196
|
isFetched: t.isFetched(),
|
|
197
|
-
isFetchedAfterMount:
|
|
198
|
-
isFetching:
|
|
199
|
-
isRefetching:
|
|
200
|
-
isLoadingError:
|
|
201
|
-
isPaused:
|
|
202
|
-
isPlaceholderData:
|
|
203
|
-
isRefetchError:
|
|
204
|
-
isStale:
|
|
197
|
+
isFetchedAfterMount: i.dataUpdateCount > b.dataUpdateCount || i.errorUpdateCount > b.errorUpdateCount,
|
|
198
|
+
isFetching: I,
|
|
199
|
+
isRefetching: I && !T,
|
|
200
|
+
isLoadingError: M && !k,
|
|
201
|
+
isPaused: i.fetchStatus === "paused",
|
|
202
|
+
isPlaceholderData: l,
|
|
203
|
+
isRefetchError: M && k,
|
|
204
|
+
isStale: x(t, e),
|
|
205
205
|
refetch: this.refetch,
|
|
206
206
|
promise: this.#r,
|
|
207
|
-
isEnabled:
|
|
207
|
+
isEnabled: c(e.enabled, t) !== !1
|
|
208
208
|
};
|
|
209
209
|
if (this.options.experimental_prefetchInRender) {
|
|
210
|
-
const
|
|
211
|
-
g ?
|
|
210
|
+
const h = f.data !== void 0, g = f.status === "error" && !h, O = (w) => {
|
|
211
|
+
g ? w.reject(f.error) : h && w.resolve(f.data);
|
|
212
212
|
}, N = () => {
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
-
switch (
|
|
213
|
+
const w = this.#r = f.promise = L();
|
|
214
|
+
O(w);
|
|
215
|
+
}, E = this.#r;
|
|
216
|
+
switch (E.status) {
|
|
217
217
|
case "pending":
|
|
218
|
-
t.queryHash === s.queryHash &&
|
|
218
|
+
t.queryHash === s.queryHash && O(E);
|
|
219
219
|
break;
|
|
220
220
|
case "fulfilled":
|
|
221
|
-
(g || f.data !==
|
|
221
|
+
(g || f.data !== E.value) && N();
|
|
222
222
|
break;
|
|
223
223
|
case "rejected":
|
|
224
|
-
(!g || f.error !==
|
|
224
|
+
(!g || f.error !== E.reason) && N();
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -229,21 +229,21 @@ var Y = class extends q {
|
|
|
229
229
|
}
|
|
230
230
|
updateResult() {
|
|
231
231
|
const t = this.#e, e = this.createResult(this.#t, this.options);
|
|
232
|
-
if (this.#a = this.#t.state, this.#u = this.options, this.#a.data !== void 0 && (this.#d = this.#t),
|
|
232
|
+
if (this.#a = this.#t.state, this.#u = this.options, this.#a.data !== void 0 && (this.#d = this.#t), Q(e, t))
|
|
233
233
|
return;
|
|
234
234
|
this.#e = e;
|
|
235
235
|
const s = () => {
|
|
236
236
|
if (!t)
|
|
237
237
|
return !0;
|
|
238
|
-
const { notifyOnChangeProps: r } = this.options,
|
|
239
|
-
if (
|
|
238
|
+
const { notifyOnChangeProps: r } = this.options, n = typeof r == "function" ? r() : r;
|
|
239
|
+
if (n === "all" || !n && !this.#f.size)
|
|
240
240
|
return !0;
|
|
241
|
-
const
|
|
242
|
-
|
|
241
|
+
const u = new Set(
|
|
242
|
+
n ?? this.#f
|
|
243
243
|
);
|
|
244
|
-
return this.options.throwOnError &&
|
|
245
|
-
const d =
|
|
246
|
-
return this.#e[d] !== t[d] &&
|
|
244
|
+
return this.options.throwOnError && u.add("error"), Object.keys(this.#e).some((a) => {
|
|
245
|
+
const d = a;
|
|
246
|
+
return this.#e[d] !== t[d] && u.has(d);
|
|
247
247
|
});
|
|
248
248
|
};
|
|
249
249
|
this.#E({ listeners: s() });
|
|
@@ -270,26 +270,26 @@ var Y = class extends q {
|
|
|
270
270
|
}
|
|
271
271
|
};
|
|
272
272
|
function Z(t, e) {
|
|
273
|
-
return
|
|
273
|
+
return c(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && c(e.retryOnMount, t) === !1);
|
|
274
274
|
}
|
|
275
275
|
function A(t, e) {
|
|
276
|
-
return Z(t, e) || t.state.data !== void 0 &&
|
|
276
|
+
return Z(t, e) || t.state.data !== void 0 && P(t, e, e.refetchOnMount);
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
if (
|
|
278
|
+
function P(t, e, s) {
|
|
279
|
+
if (c(e.enabled, t) !== !1 && y(e.staleTime, t) !== "static") {
|
|
280
280
|
const r = typeof s == "function" ? s(t) : s;
|
|
281
|
-
return r === "always" || r !== !1 &&
|
|
281
|
+
return r === "always" || r !== !1 && x(t, e);
|
|
282
282
|
}
|
|
283
283
|
return !1;
|
|
284
284
|
}
|
|
285
285
|
function H(t, e, s, r) {
|
|
286
|
-
return (t !== e ||
|
|
286
|
+
return (t !== e || c(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && x(t, s);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
return
|
|
288
|
+
function x(t, e) {
|
|
289
|
+
return c(e.enabled, t) !== !1 && t.isStaleByTime(y(e.staleTime, t));
|
|
290
290
|
}
|
|
291
291
|
function tt(t, e) {
|
|
292
|
-
return !
|
|
292
|
+
return !Q(t.getCurrentResult(), e);
|
|
293
293
|
}
|
|
294
294
|
function et() {
|
|
295
295
|
let t = !1;
|
|
@@ -303,11 +303,11 @@ function et() {
|
|
|
303
303
|
isReset: () => t
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
|
-
var st =
|
|
306
|
+
var st = v.createContext(et()), rt = () => v.useContext(st), it = (t, e, s) => {
|
|
307
307
|
const r = s?.state.error && typeof t.throwOnError == "function" ? z(t.throwOnError, [s.state.error, s]) : t.throwOnError;
|
|
308
308
|
(t.suspense || t.experimental_prefetchInRender || r) && (e.isReset() || (t.retryOnMount = !1));
|
|
309
309
|
}, nt = (t) => {
|
|
310
|
-
|
|
310
|
+
v.useEffect(() => {
|
|
311
311
|
t.clearReset();
|
|
312
312
|
}, [t]);
|
|
313
313
|
}, at = ({
|
|
@@ -315,11 +315,11 @@ var st = m.createContext(et()), rt = () => m.useContext(st), it = (t, e, s) => {
|
|
|
315
315
|
errorResetBoundary: e,
|
|
316
316
|
throwOnError: s,
|
|
317
317
|
query: r,
|
|
318
|
-
suspense:
|
|
319
|
-
}) => t.isError && !e.isReset() && !t.isFetching && r && (
|
|
318
|
+
suspense: n
|
|
319
|
+
}) => t.isError && !e.isReset() && !t.isFetching && r && (n && t.data === void 0 || z(s, [t.error, r])), ot = (t) => {
|
|
320
320
|
if (t.suspense) {
|
|
321
|
-
const s = (
|
|
322
|
-
t.staleTime = typeof r == "function" ? (...
|
|
321
|
+
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), r = t.staleTime;
|
|
322
|
+
t.staleTime = typeof r == "function" ? (...n) => s(r(...n)) : s(r), typeof t.gcTime == "number" && (t.gcTime = Math.max(
|
|
323
323
|
t.gcTime,
|
|
324
324
|
1e3
|
|
325
325
|
));
|
|
@@ -332,54 +332,56 @@ function ut(t, e, s) {
|
|
|
332
332
|
throw new Error(
|
|
333
333
|
'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'
|
|
334
334
|
);
|
|
335
|
-
const r = J(),
|
|
336
|
-
|
|
337
|
-
|
|
335
|
+
const r = J(), n = rt(), u = X(s), a = u.defaultQueryOptions(t);
|
|
336
|
+
u.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
337
|
+
a
|
|
338
338
|
);
|
|
339
|
-
const d =
|
|
340
|
-
process.env.NODE_ENV !== "production" && (
|
|
341
|
-
`[${
|
|
342
|
-
))
|
|
343
|
-
const
|
|
339
|
+
const d = u.getQueryCache().get(a.queryHash);
|
|
340
|
+
process.env.NODE_ENV !== "production" && (a.queryFn || console.error(
|
|
341
|
+
`[${a.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`
|
|
342
|
+
));
|
|
343
|
+
const b = t.subscribed !== !1;
|
|
344
|
+
a._optimisticResults = r ? "isRestoring" : b ? "optimistic" : void 0, ot(a), it(a, n, d), nt(n);
|
|
345
|
+
const R = !u.getQueryCache().get(a.queryHash), [i] = v.useState(
|
|
344
346
|
() => new e(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
+
u,
|
|
348
|
+
a
|
|
347
349
|
)
|
|
348
|
-
),
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
(
|
|
352
|
-
const
|
|
353
|
-
return
|
|
350
|
+
), l = i.getOptimisticResult(a), o = !r && b;
|
|
351
|
+
if (v.useSyncExternalStore(
|
|
352
|
+
v.useCallback(
|
|
353
|
+
(m) => {
|
|
354
|
+
const S = o ? i.subscribe(W.batchCalls(m)) : _;
|
|
355
|
+
return i.updateResult(), S;
|
|
354
356
|
},
|
|
355
|
-
[
|
|
357
|
+
[i, o]
|
|
356
358
|
),
|
|
357
|
-
() =>
|
|
358
|
-
() =>
|
|
359
|
-
),
|
|
360
|
-
|
|
361
|
-
}, [
|
|
362
|
-
throw V(
|
|
359
|
+
() => i.getCurrentResult(),
|
|
360
|
+
() => i.getCurrentResult()
|
|
361
|
+
), v.useEffect(() => {
|
|
362
|
+
i.setOptions(a);
|
|
363
|
+
}, [a, i]), ct(a, l))
|
|
364
|
+
throw V(a, i, n);
|
|
363
365
|
if (at({
|
|
364
|
-
result:
|
|
365
|
-
errorResetBoundary:
|
|
366
|
-
throwOnError:
|
|
366
|
+
result: l,
|
|
367
|
+
errorResetBoundary: n,
|
|
368
|
+
throwOnError: a.throwOnError,
|
|
367
369
|
query: d,
|
|
368
|
-
suspense:
|
|
370
|
+
suspense: a.suspense
|
|
369
371
|
}))
|
|
370
|
-
throw
|
|
371
|
-
return
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
),
|
|
372
|
+
throw l.error;
|
|
373
|
+
return u.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
374
|
+
a,
|
|
375
|
+
l
|
|
376
|
+
), a.experimental_prefetchInRender && !F.isServer() && ht(l, r) && (R ? (
|
|
375
377
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
376
|
-
V(
|
|
378
|
+
V(a, i, n)
|
|
377
379
|
) : (
|
|
378
380
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
379
381
|
d?.promise
|
|
380
|
-
))?.catch(
|
|
381
|
-
|
|
382
|
-
}),
|
|
382
|
+
))?.catch(_).finally(() => {
|
|
383
|
+
i.updateResult();
|
|
384
|
+
}), a.notifyOnChangeProps ? l : i.trackResult(l);
|
|
383
385
|
}
|
|
384
386
|
function pt(t, e) {
|
|
385
387
|
return ut(t, Y, e);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
function c(e) {
|
|
2
|
+
return new Promise((n, t) => {
|
|
3
|
+
e.oncomplete = e.onsuccess = () => n(e.result), e.onabort = e.onerror = () => t(e.error);
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
function l(e, n) {
|
|
7
|
+
let t;
|
|
8
|
+
const o = () => {
|
|
9
|
+
if (t)
|
|
10
|
+
return t;
|
|
11
|
+
const r = indexedDB.open(e);
|
|
12
|
+
return r.onupgradeneeded = () => r.result.createObjectStore(n), t = c(r), t.then((u) => {
|
|
13
|
+
u.onclose = () => t = void 0;
|
|
14
|
+
}, () => {
|
|
15
|
+
}), t;
|
|
16
|
+
};
|
|
17
|
+
return (r, u) => o().then((s) => u(s.transaction(n, r).objectStore(n)));
|
|
18
|
+
}
|
|
19
|
+
let a;
|
|
20
|
+
function i() {
|
|
21
|
+
return a || (a = l("keyval-store", "keyval")), a;
|
|
22
|
+
}
|
|
23
|
+
function f(e, n = i()) {
|
|
24
|
+
return n("readonly", (t) => c(t.get(e)));
|
|
25
|
+
}
|
|
26
|
+
function d(e, n, t = i()) {
|
|
27
|
+
return t("readwrite", (o) => (o.put(n, e), c(o.transaction)));
|
|
28
|
+
}
|
|
29
|
+
function p(e, n = i()) {
|
|
30
|
+
return n("readwrite", (t) => (t.delete(e), c(t.transaction)));
|
|
31
|
+
}
|
|
32
|
+
const w = (e = "reactQuery") => ({
|
|
33
|
+
persistClient: async (n) => {
|
|
34
|
+
await d(e, n);
|
|
35
|
+
},
|
|
36
|
+
removeClient: async () => {
|
|
37
|
+
await p(e);
|
|
38
|
+
},
|
|
39
|
+
restoreClient: async () => await f(e)
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
w as createIDBPersister
|
|
43
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useBasePropsStore as t } from "../stores/BasePropsStore.js";
|
|
2
|
-
import { a as u, f } from "../api-
|
|
2
|
+
import { a as u, f } from "../api-CikhPcJj.js";
|
|
3
3
|
const k = (a, s, e, i, g, o = !1) => {
|
|
4
4
|
const r = o ? void 0 : i ?? t.getState().modulePermissionToken, n = t.getState().organizationId, c = t.getState().currentLanguageId, l = t.getState().throwError;
|
|
5
5
|
if (!o && !r)
|
package/README.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# ModuleBase
|
|
2
|
-
|
|
3
|
-
The ModuleBase provides a set of components and functions, to get the modulefederation within HortiView to work.
|
|
4
|
-
To get a more detailed description about the modulefederation-process in HortiView, please [visit the documentation](https://docs.hortiview.com/)
|
|
5
|
-
|
|
6
|
-
It will handle the navigation/routing, breadcrumb translations, usage of Common- and ModuleAPI and my more.
|
|
7
|
-
|
|
8
|
-
> This package is is not the ModuleTemplate.<br />
|
|
9
|
-
> It only provides basic and necessary functions for the implementation of module federation within HortiView
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as h } from "react";
|
|
3
|
-
import { R as p, a as i, O as c, u as m } from "../chunk-EVOBXE3Y-B43QN6RE.js";
|
|
4
|
-
import { SignalRProvider as u } from "../provider/SignalR/SignalRProvider.js";
|
|
5
|
-
import { useBasePropsStore as o } from "../stores/BasePropsStore.js";
|
|
6
|
-
import { M as d, a as f } from "../ModuleCore-DRMqZO8r.js";
|
|
7
|
-
const s = (t) => t.map((e) => e.children ? /* @__PURE__ */ a(i, { path: e.path, element: e.element, children: s(e.children) }, e.path) : /* @__PURE__ */ a(i, { path: e.path, element: e.element }, e.path)), v = () => {
|
|
8
|
-
const t = o((r) => r.currentNavigationPath), e = o((r) => r.basePath), n = m();
|
|
9
|
-
h(() => {
|
|
10
|
-
t && e && t.startsWith(e) && n(t, { replace: !0 });
|
|
11
|
-
}, [t, e, n]);
|
|
12
|
-
}, g = () => (v(), /* @__PURE__ */ a(c, {})), B = ({
|
|
13
|
-
props: t,
|
|
14
|
-
routes: e,
|
|
15
|
-
env: n = void 0,
|
|
16
|
-
useSignalR: r = !1,
|
|
17
|
-
queryClient: l = f
|
|
18
|
-
}) => /* @__PURE__ */ a(d, { props: t, env: n, queryClient: l, children: /* @__PURE__ */ a(u, { enabled: r, children: /* @__PURE__ */ a(p, { children: /* @__PURE__ */ a(i, { path: t.basePath, element: /* @__PURE__ */ a(g, {}), children: s(e) }) }) }) });
|
|
19
|
-
export {
|
|
20
|
-
B as ModuleBase
|
|
21
|
-
};
|