@hortiview/modulebase 1.1.2-alpha.a0b1047e.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.
Files changed (41) hide show
  1. package/dist/IsRestoringProvider-Dc5Evyjr.js +6 -0
  2. package/dist/QueryClientProvider-DZI32rjZ.js +21 -0
  3. package/dist/api-CSxWxEZl.js +148 -0
  4. package/dist/{chunk-EVOBXE3Y-B43QN6RE.js → chunk-EVOBXE3Y-BRmUxtwH.js} +126 -127
  5. package/dist/components/ModuleBase.js +13 -17
  6. package/dist/components/ModuleCore.js +11398 -9
  7. package/dist/constants.js +1 -2
  8. package/dist/defaultQueryClient-Cfsorhtn.js +620 -0
  9. package/dist/hooks/useBreadcrumbTranslation.js +13 -16
  10. package/dist/hooks/useCustom.js +1 -1
  11. package/dist/hooks/useCustomMutation.js +5 -5
  12. package/dist/hooks/useEntity.js +1 -1
  13. package/dist/hooks/useOffline.js +1 -1
  14. package/dist/hooks/useOption.js +2 -2
  15. package/dist/hooks/useSignalRMessages.js +1 -1
  16. package/dist/lib/components/ModuleBase.d.ts +3 -22
  17. package/dist/lib/components/ModuleCore.d.ts +3 -17
  18. package/dist/lib/main.d.ts +0 -3
  19. package/dist/lib/module-router.d.ts +1 -1
  20. package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -4
  21. package/dist/lib/types/BaseProps.d.ts +38 -1
  22. package/dist/lib/utils/defaultQueryClient.d.ts +2 -0
  23. package/dist/lib/utils/defaultSignalRClient.d.ts +4 -0
  24. package/dist/lib/utils/helper.d.ts +1 -2
  25. package/dist/main.js +56 -187
  26. package/dist/module-router.js +2 -2
  27. package/dist/provider/SignalR/SignalRProvider.js +22 -5966
  28. package/dist/{IsRestoringProvider-SzKJZczp.js → query-DZDIN635.js} +211 -232
  29. package/dist/stores/BasePropsStore.js +1 -0
  30. package/dist/{useCustomMutation-9VUQ7NbQ.js → useCustomMutation-C1aVbjpt.js} +13 -12
  31. package/dist/{useQuery-DUDyh33-.js → useQuery-CUSHkb38.js} +33 -31
  32. package/dist/utils/api.js +1 -1
  33. package/dist/utils/baseFetches.js +1 -1
  34. package/dist/utils/defaultQueryClient.js +4 -0
  35. package/dist/utils/defaultSignalRClient.js +5949 -0
  36. package/dist/utils/helper.js +9 -10
  37. package/package.json +1 -1
  38. package/dist/ModuleCore-DRMqZO8r.js +0 -12017
  39. package/dist/api-COabZnyn.js +0 -147
  40. package/dist/lib/types/ServiceBus.d.ts +0 -17
  41. package/dist/types/ServiceBus.js +0 -1
@@ -1,5 +1,6 @@
1
1
  import { c as o } from "../react-c9FSfB30.js";
2
2
  const t = o((e) => ({
3
+ basePath: "",
3
4
  setBaseProps: (s) => e({ ...s })
4
5
  }));
5
6
  export {
@@ -1,14 +1,15 @@
1
1
  import * as n from "react";
2
- import { g as m } from "./ModuleCore-DRMqZO8r.js";
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";
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 { mutateOnCustomApi as f } from "./utils/fetches.js";
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-COabZnyn.js";
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 = d(s), [e] = n.useState(
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(b);
138
+ e.mutate(o, h).catch(d);
138
139
  },
139
140
  [e]
140
141
  );
141
- if (i.error && v(e.options.throwOnError, [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 P = ({
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 }) => f(h ?? t, o, s, r, e, i),
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
- P as u
159
+ U as u
159
160
  };
@@ -1,6 +1,8 @@
1
- import { S as q, p as L, r as u, s as M, e as y, c as Q, f as _, i as j, t as K, g as w, j as $, k as G, l as B, n as W, d as z, m as J, u as X } from "./IsRestoringProvider-SzKJZczp.js";
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.#y());
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) || y(this.options.staleTime, this.#t) !== y(e.staleTime, this.#t)) && this.#v();
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.#g(i);
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 = y(
121
+ const t = g(
120
122
  this.options.staleTime,
121
123
  this.#t
122
124
  );
123
- if (_.isServer() || this.#e.isStale || !j(t))
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
- #g(t) {
134
- this.#S(), this.#n = t, !(_.isServer() || u(this.options.enabled, this.#t) === !1 || !j(this.#n) || this.#n === 0) && (this.#h = w.setInterval(() => {
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
- #y() {
139
- this.#v(), this.#g(this.#b());
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(), g = !c && A(t, e), S = c && H(t, s, e, r);
152
- (g || S) && (a = {
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: x, status: p } = a;
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 = B(
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 = B(i?.data, o, e), this.#l = o, this.#i = null;
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, x = Date.now(), p = "error");
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: x,
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: P(t, e),
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, g = f.status === "error" && !c, S = (E) => {
211
- g ? E.reject(f.error) : c && E.resolve(f.data);
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
- (g || f.data !== O.value) && N();
223
+ (y || f.data !== O.value) && N();
222
224
  break;
223
225
  case "rejected":
224
- (!g || f.error !== O.reason) && N();
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.#y();
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 && y(e.staleTime, t) !== "static") {
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 && P(t, e);
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") && P(t, s);
288
+ return (t !== e || u(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && x(t, s);
287
289
  }
288
- function P(t, e) {
289
- return u(e.enabled, t) !== !1 && t.isStaleByTime(y(e.staleTime, t));
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 = J(), i = rt(), l = X(s), n = l.defaultQueryOptions(t);
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 pt(t, e) {
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
- pt as u
392
+ vt as u
391
393
  };
package/dist/utils/api.js CHANGED
@@ -1,4 +1,4 @@
1
- import { f as t, a as i, h as n } from "../api-COabZnyn.js";
1
+ import { f as t, a as i, h as n } from "../api-CSxWxEZl.js";
2
2
  import "../constants.js";
3
3
  import "../stores/BasePropsStore.js";
4
4
  export {
@@ -1,5 +1,5 @@
1
1
  import { useBasePropsStore as t } from "../stores/BasePropsStore.js";
2
- import { a as u, f } from "../api-COabZnyn.js";
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)
@@ -0,0 +1,4 @@
1
+ import { M as r } from "../defaultQueryClient-Cfsorhtn.js";
2
+ export {
3
+ r as ModuleQueryClient
4
+ };