@hortiview/modulebase 1.1.2-alpha.870da389.1 → 2.0.0-alpha.e897c28d.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/IsRestoringProvider-Dc5Evyjr.js +6 -0
- package/dist/QueryClientProvider-DZI32rjZ.js +21 -0
- package/dist/api-CSxWxEZl.js +148 -0
- package/dist/{chunk-EVOBXE3Y-B43QN6RE.js → chunk-EVOBXE3Y-BRmUxtwH.js} +126 -127
- package/dist/components/ModuleBase.js +13 -17
- package/dist/components/ModuleCore.js +11398 -9
- package/dist/constants.js +1 -2
- package/dist/defaultQueryClient-Cfsorhtn.js +620 -0
- package/dist/hooks/useBreadcrumbTranslation.js +13 -16
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +5 -5
- package/dist/hooks/useEntity.js +1 -1
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +2 -2
- package/dist/hooks/useSignalRMessages.js +1 -1
- package/dist/lib/components/ModuleBase.d.ts +3 -22
- package/dist/lib/components/ModuleCore.d.ts +3 -17
- package/dist/lib/main.d.ts +0 -3
- package/dist/lib/module-router.d.ts +1 -1
- package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -4
- package/dist/lib/types/BaseProps.d.ts +38 -1
- package/dist/lib/utils/defaultQueryClient.d.ts +2 -0
- package/dist/lib/utils/defaultSignalRClient.d.ts +4 -0
- package/dist/lib/utils/helper.d.ts +1 -2
- package/dist/main.js +56 -187
- package/dist/module-router.js +2 -2
- package/dist/provider/SignalR/SignalRProvider.js +22 -5966
- package/dist/{IsRestoringProvider-SzKJZczp.js → query-DZDIN635.js} +211 -232
- package/dist/stores/BasePropsStore.js +1 -0
- package/dist/{useCustomMutation-9VUQ7NbQ.js → useCustomMutation-C1aVbjpt.js} +13 -12
- package/dist/{useQuery-DUDyh33-.js → useQuery-CUSHkb38.js} +33 -31
- package/dist/utils/api.js +1 -1
- package/dist/utils/baseFetches.js +1 -1
- package/dist/utils/defaultQueryClient.js +4 -0
- package/dist/utils/defaultSignalRClient.js +5949 -0
- package/dist/utils/helper.js +9 -10
- package/package.json +1 -1
- package/dist/ModuleCore-DRMqZO8r.js +0 -12017
- package/dist/api-COabZnyn.js +0 -147
- package/dist/lib/types/ServiceBus.d.ts +0 -17
- package/dist/types/ServiceBus.js +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as n from "react";
|
|
2
|
-
import { g as m } from "./
|
|
3
|
-
import { S as p, s as l, b as u, n as c,
|
|
2
|
+
import { g as m } from "./defaultQueryClient-Cfsorhtn.js";
|
|
3
|
+
import { S as p, s as l, b as u, n as c, c as d, d as b } from "./query-DZDIN635.js";
|
|
4
|
+
import { u as f } from "./QueryClientProvider-DZI32rjZ.js";
|
|
4
5
|
import "react/jsx-runtime";
|
|
5
|
-
import "./provider/SignalR/SignalRProvider.js";
|
|
6
6
|
import "./stores/BasePropsStore.js";
|
|
7
|
-
import
|
|
7
|
+
import "./stores/EnvironmentStore.js";
|
|
8
|
+
import "./utils/defaultSignalRClient.js";
|
|
9
|
+
import { mutateOnCustomApi as v } from "./utils/fetches.js";
|
|
8
10
|
import "./types/Entities.js";
|
|
9
|
-
import "./api-
|
|
11
|
+
import "./api-CSxWxEZl.js";
|
|
10
12
|
import "./omit-DYPaIq41.js";
|
|
11
|
-
import "./stores/EnvironmentStore.js";
|
|
12
13
|
var y = class extends p {
|
|
13
14
|
#s;
|
|
14
15
|
#i = void 0;
|
|
@@ -116,7 +117,7 @@ var y = class extends p {
|
|
|
116
117
|
}
|
|
117
118
|
};
|
|
118
119
|
function O(t, s) {
|
|
119
|
-
const r =
|
|
120
|
+
const r = f(s), [e] = n.useState(
|
|
120
121
|
() => new y(
|
|
121
122
|
r,
|
|
122
123
|
t
|
|
@@ -134,15 +135,15 @@ function O(t, s) {
|
|
|
134
135
|
() => e.getCurrentResult()
|
|
135
136
|
), a = n.useCallback(
|
|
136
137
|
(o, h) => {
|
|
137
|
-
e.mutate(o, h).catch(
|
|
138
|
+
e.mutate(o, h).catch(d);
|
|
138
139
|
},
|
|
139
140
|
[e]
|
|
140
141
|
);
|
|
141
|
-
if (i.error &&
|
|
142
|
+
if (i.error && b(e.options.throwOnError, [i.error]))
|
|
142
143
|
throw i.error;
|
|
143
144
|
return { ...i, mutate: a, mutateAsync: i.mutate };
|
|
144
145
|
}
|
|
145
|
-
const
|
|
146
|
+
const U = ({
|
|
146
147
|
endpoint: t,
|
|
147
148
|
method: s,
|
|
148
149
|
token: r,
|
|
@@ -150,10 +151,10 @@ const P = ({
|
|
|
150
151
|
noAuth: i,
|
|
151
152
|
...a
|
|
152
153
|
}) => O({
|
|
153
|
-
mutationFn: ({ input: o, replaceEndpointWith: h }) =>
|
|
154
|
+
mutationFn: ({ input: o, replaceEndpointWith: h }) => v(h ?? t, o, s, r, e, i),
|
|
154
155
|
...a
|
|
155
156
|
});
|
|
156
157
|
export {
|
|
157
158
|
O as a,
|
|
158
|
-
|
|
159
|
+
U as u
|
|
159
160
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { S as q,
|
|
1
|
+
import { S as q, l as L, q as u, s as M, r as g, c as Q, t as _, u as B, v as K, w, i as $, x as G, y as j, n as W, d as z } from "./query-DZDIN635.js";
|
|
2
2
|
import * as m from "react";
|
|
3
|
+
import { u as J } from "./QueryClientProvider-DZI32rjZ.js";
|
|
3
4
|
import "react/jsx-runtime";
|
|
5
|
+
import { u as X } from "./IsRestoringProvider-Dc5Evyjr.js";
|
|
4
6
|
var Y = class extends q {
|
|
5
7
|
constructor(t, e) {
|
|
6
8
|
super(), this.options = e, this.#s = t, this.#i = null, this.#r = L(), this.bindMethods(), this.setOptions(e);
|
|
@@ -26,7 +28,7 @@ var Y = class extends q {
|
|
|
26
28
|
this.refetch = this.refetch.bind(this);
|
|
27
29
|
}
|
|
28
30
|
onSubscribe() {
|
|
29
|
-
this.listeners.size === 1 && (this.#t.addObserver(this), A(this.#t, this.options) ? this.#c() : this.updateResult(), this.#
|
|
31
|
+
this.listeners.size === 1 && (this.#t.addObserver(this), A(this.#t, this.options) ? this.#c() : this.updateResult(), this.#g());
|
|
30
32
|
}
|
|
31
33
|
onUnsubscribe() {
|
|
32
34
|
this.hasListeners() || this.destroy();
|
|
@@ -65,9 +67,9 @@ var Y = class extends q {
|
|
|
65
67
|
s,
|
|
66
68
|
this.options,
|
|
67
69
|
e
|
|
68
|
-
) && this.#c(), this.updateResult(), r && (this.#t !== s || u(this.options.enabled, this.#t) !== u(e.enabled, this.#t) ||
|
|
70
|
+
) && this.#c(), this.updateResult(), r && (this.#t !== s || u(this.options.enabled, this.#t) !== u(e.enabled, this.#t) || g(this.options.staleTime, this.#t) !== g(e.staleTime, this.#t)) && this.#v();
|
|
69
71
|
const i = this.#b();
|
|
70
|
-
r && (this.#t !== s || u(this.options.enabled, this.#t) !== u(e.enabled, this.#t) || i !== this.#n) && this.#
|
|
72
|
+
r && (this.#t !== s || u(this.options.enabled, this.#t) !== u(e.enabled, this.#t) || i !== this.#n) && this.#y(i);
|
|
71
73
|
}
|
|
72
74
|
getOptimisticResult(t) {
|
|
73
75
|
const e = this.#s.getQueryCache().build(this.#s, t), s = this.createResult(e, t);
|
|
@@ -116,11 +118,11 @@ var Y = class extends q {
|
|
|
116
118
|
}
|
|
117
119
|
#v() {
|
|
118
120
|
this.#R();
|
|
119
|
-
const t =
|
|
121
|
+
const t = g(
|
|
120
122
|
this.options.staleTime,
|
|
121
123
|
this.#t
|
|
122
124
|
);
|
|
123
|
-
if (_.isServer() || this.#e.isStale || !
|
|
125
|
+
if (_.isServer() || this.#e.isStale || !B(t))
|
|
124
126
|
return;
|
|
125
127
|
const s = K(this.#e.dataUpdatedAt, t) + 1;
|
|
126
128
|
this.#o = w.setTimeout(() => {
|
|
@@ -130,13 +132,13 @@ var Y = class extends q {
|
|
|
130
132
|
#b() {
|
|
131
133
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
132
134
|
}
|
|
133
|
-
#
|
|
134
|
-
this.#S(), this.#n = t, !(_.isServer() || u(this.options.enabled, this.#t) === !1 || !
|
|
135
|
+
#y(t) {
|
|
136
|
+
this.#S(), this.#n = t, !(_.isServer() || u(this.options.enabled, this.#t) === !1 || !B(this.#n) || this.#n === 0) && (this.#h = w.setInterval(() => {
|
|
135
137
|
(this.options.refetchIntervalInBackground || $.isFocused()) && this.#c();
|
|
136
138
|
}, this.#n));
|
|
137
139
|
}
|
|
138
|
-
#
|
|
139
|
-
this.#v(), this.#
|
|
140
|
+
#g() {
|
|
141
|
+
this.#v(), this.#y(this.#b());
|
|
140
142
|
}
|
|
141
143
|
#R() {
|
|
142
144
|
this.#o !== void 0 && (w.clearTimeout(this.#o), this.#o = void 0);
|
|
@@ -148,13 +150,13 @@ var Y = class extends q {
|
|
|
148
150
|
const s = this.#t, r = this.options, i = this.#e, l = this.#a, n = this.#u, v = t !== s ? t.state : this.#p, { state: h } = t;
|
|
149
151
|
let a = { ...h }, b = !1, o;
|
|
150
152
|
if (e._optimisticResults) {
|
|
151
|
-
const c = this.hasListeners(),
|
|
152
|
-
(
|
|
153
|
+
const c = this.hasListeners(), y = !c && A(t, e), S = c && H(t, s, e, r);
|
|
154
|
+
(y || S) && (a = {
|
|
153
155
|
...a,
|
|
154
156
|
...G(h.data, t.options)
|
|
155
157
|
}), e._optimisticResults === "isRestoring" && (a.fetchStatus = "idle");
|
|
156
158
|
}
|
|
157
|
-
let { error: R, errorUpdatedAt:
|
|
159
|
+
let { error: R, errorUpdatedAt: P, status: p } = a;
|
|
158
160
|
o = a.data;
|
|
159
161
|
let D = !1;
|
|
160
162
|
if (e.placeholderData !== void 0 && o === void 0 && p === "pending") {
|
|
@@ -162,7 +164,7 @@ var Y = class extends q {
|
|
|
162
164
|
i?.isPlaceholderData && e.placeholderData === n?.placeholderData ? (c = i.data, D = !0) : c = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
163
165
|
this.#d?.state.data,
|
|
164
166
|
this.#d
|
|
165
|
-
) : e.placeholderData, c !== void 0 && (p = "success", o =
|
|
167
|
+
) : e.placeholderData, c !== void 0 && (p = "success", o = j(
|
|
166
168
|
i?.data,
|
|
167
169
|
c,
|
|
168
170
|
e
|
|
@@ -173,11 +175,11 @@ var Y = class extends q {
|
|
|
173
175
|
o = this.#l;
|
|
174
176
|
else
|
|
175
177
|
try {
|
|
176
|
-
this.#m = e.select, o = e.select(o), o =
|
|
178
|
+
this.#m = e.select, o = e.select(o), o = j(i?.data, o, e), this.#l = o, this.#i = null;
|
|
177
179
|
} catch (c) {
|
|
178
180
|
this.#i = c;
|
|
179
181
|
}
|
|
180
|
-
this.#i && (R = this.#i, o = this.#l,
|
|
182
|
+
this.#i && (R = this.#i, o = this.#l, P = Date.now(), p = "error");
|
|
181
183
|
const C = a.fetchStatus === "fetching", I = p === "pending", T = p === "error", U = I && C, k = o !== void 0, f = {
|
|
182
184
|
status: p,
|
|
183
185
|
fetchStatus: a.fetchStatus,
|
|
@@ -189,7 +191,7 @@ var Y = class extends q {
|
|
|
189
191
|
data: o,
|
|
190
192
|
dataUpdatedAt: a.dataUpdatedAt,
|
|
191
193
|
error: R,
|
|
192
|
-
errorUpdatedAt:
|
|
194
|
+
errorUpdatedAt: P,
|
|
193
195
|
failureCount: a.fetchFailureCount,
|
|
194
196
|
failureReason: a.fetchFailureReason,
|
|
195
197
|
errorUpdateCount: a.errorUpdateCount,
|
|
@@ -201,14 +203,14 @@ var Y = class extends q {
|
|
|
201
203
|
isPaused: a.fetchStatus === "paused",
|
|
202
204
|
isPlaceholderData: b,
|
|
203
205
|
isRefetchError: T && k,
|
|
204
|
-
isStale:
|
|
206
|
+
isStale: x(t, e),
|
|
205
207
|
refetch: this.refetch,
|
|
206
208
|
promise: this.#r,
|
|
207
209
|
isEnabled: u(e.enabled, t) !== !1
|
|
208
210
|
};
|
|
209
211
|
if (this.options.experimental_prefetchInRender) {
|
|
210
|
-
const c = f.data !== void 0,
|
|
211
|
-
|
|
212
|
+
const c = f.data !== void 0, y = f.status === "error" && !c, S = (E) => {
|
|
213
|
+
y ? E.reject(f.error) : c && E.resolve(f.data);
|
|
212
214
|
}, N = () => {
|
|
213
215
|
const E = this.#r = f.promise = L();
|
|
214
216
|
S(E);
|
|
@@ -218,10 +220,10 @@ var Y = class extends q {
|
|
|
218
220
|
t.queryHash === s.queryHash && S(O);
|
|
219
221
|
break;
|
|
220
222
|
case "fulfilled":
|
|
221
|
-
(
|
|
223
|
+
(y || f.data !== O.value) && N();
|
|
222
224
|
break;
|
|
223
225
|
case "rejected":
|
|
224
|
-
(!
|
|
226
|
+
(!y || f.error !== O.reason) && N();
|
|
225
227
|
break;
|
|
226
228
|
}
|
|
227
229
|
}
|
|
@@ -256,7 +258,7 @@ var Y = class extends q {
|
|
|
256
258
|
this.#t = t, this.#p = t.state, this.hasListeners() && (e?.removeObserver(this), t.addObserver(this));
|
|
257
259
|
}
|
|
258
260
|
onQueryUpdate() {
|
|
259
|
-
this.updateResult(), this.hasListeners() && this.#
|
|
261
|
+
this.updateResult(), this.hasListeners() && this.#g();
|
|
260
262
|
}
|
|
261
263
|
#E(t) {
|
|
262
264
|
W.batch(() => {
|
|
@@ -276,17 +278,17 @@ function A(t, e) {
|
|
|
276
278
|
return Z(t, e) || t.state.data !== void 0 && F(t, e, e.refetchOnMount);
|
|
277
279
|
}
|
|
278
280
|
function F(t, e, s) {
|
|
279
|
-
if (u(e.enabled, t) !== !1 &&
|
|
281
|
+
if (u(e.enabled, t) !== !1 && g(e.staleTime, t) !== "static") {
|
|
280
282
|
const r = typeof s == "function" ? s(t) : s;
|
|
281
|
-
return r === "always" || r !== !1 &&
|
|
283
|
+
return r === "always" || r !== !1 && x(t, e);
|
|
282
284
|
}
|
|
283
285
|
return !1;
|
|
284
286
|
}
|
|
285
287
|
function H(t, e, s, r) {
|
|
286
|
-
return (t !== e || u(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") &&
|
|
288
|
+
return (t !== e || u(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && x(t, s);
|
|
287
289
|
}
|
|
288
|
-
function
|
|
289
|
-
return u(e.enabled, t) !== !1 && t.isStaleByTime(
|
|
290
|
+
function x(t, e) {
|
|
291
|
+
return u(e.enabled, t) !== !1 && t.isStaleByTime(g(e.staleTime, t));
|
|
290
292
|
}
|
|
291
293
|
function tt(t, e) {
|
|
292
294
|
return !M(t.getCurrentResult(), e);
|
|
@@ -332,7 +334,7 @@ function ut(t, e, s) {
|
|
|
332
334
|
throw new Error(
|
|
333
335
|
'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
336
|
);
|
|
335
|
-
const r =
|
|
337
|
+
const r = X(), i = rt(), l = J(s), n = l.defaultQueryOptions(t);
|
|
336
338
|
l.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
337
339
|
n
|
|
338
340
|
);
|
|
@@ -381,11 +383,11 @@ function ut(t, e, s) {
|
|
|
381
383
|
h.updateResult();
|
|
382
384
|
}), n.notifyOnChangeProps ? a : h.trackResult(a);
|
|
383
385
|
}
|
|
384
|
-
function
|
|
386
|
+
function vt(t, e) {
|
|
385
387
|
return ut(t, Y, e);
|
|
386
388
|
}
|
|
387
389
|
export {
|
|
388
390
|
Y as Q,
|
|
389
391
|
ut as a,
|
|
390
|
-
|
|
392
|
+
vt as u
|
|
391
393
|
};
|
package/dist/utils/api.js
CHANGED
|
@@ -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-CSxWxEZl.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)
|