@hortiview/modulebase 0.0.13075 → 0.0.13101-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.
Files changed (68) hide show
  1. package/dist/ModuleCore-BWvRhZyP.js +14980 -0
  2. package/dist/{QueryClientProvider-Q_mWQTzQ.js → QueryClientProvider-BSM1ol7r.js} +81 -78
  3. package/dist/{_baseGet-B7FwMMGI.js → _baseGet-C6jMXSsQ.js} +447 -447
  4. package/dist/{api-D9Lmqe6S.js → api-s6E2GJtu.js} +48 -48
  5. package/dist/assets/ModuleCore.css +1 -0
  6. package/dist/components/ModuleBase.js +17 -498
  7. package/dist/components/ModuleCore.js +10 -0
  8. package/dist/hooks/useCustom.js +15 -18
  9. package/dist/hooks/useCustomMutation.js +14 -12
  10. package/dist/hooks/useEntity.js +48 -58
  11. package/dist/hooks/useOffline.js +45 -0
  12. package/dist/hooks/useOption.js +16 -16
  13. package/dist/hooks/useServiceBus.js +19 -11
  14. package/dist/hooks/useStores.js +1 -1
  15. package/dist/{query-CRIVoEP7.js → isRestoring-LSIsLTaI.js} +21 -17
  16. package/dist/lib/components/ModuleBase.d.ts +36 -0
  17. package/dist/lib/components/ModuleCore.d.ts +32 -0
  18. package/dist/{constants.d.ts → lib/constants.d.ts} +1 -1
  19. package/dist/{hooks → lib/hooks}/useCustom.d.ts +2 -1
  20. package/dist/{hooks → lib/hooks}/useCustomMutation.d.ts +2 -1
  21. package/dist/{hooks → lib/hooks}/useEntity.d.ts +6 -24
  22. package/dist/lib/hooks/useOffline.d.ts +15 -0
  23. package/dist/{hooks → lib/hooks}/useServiceBus.d.ts +6 -2
  24. package/dist/lib/hooks/useStores.d.ts +38 -0
  25. package/dist/lib/main.d.ts +27 -0
  26. package/dist/lib/types/ActionStorage.d.ts +13 -0
  27. package/dist/{types → lib/types}/BaseProps.d.ts +11 -2
  28. package/dist/{types → lib/types}/Deprecated.d.ts +6 -0
  29. package/dist/lib/types/Entities.d.ts +22 -0
  30. package/dist/{types → lib/types}/Environment.d.ts +1 -1
  31. package/dist/lib/types/EnvironmentVariable.d.ts +6 -0
  32. package/dist/{types → lib/types}/Requests.d.ts +4 -10
  33. package/dist/{utils → lib/utils}/api.d.ts +1 -1
  34. package/dist/{utils → lib/utils}/baseFetches.d.ts +2 -2
  35. package/dist/{utils → lib/utils}/fetches.d.ts +14 -6
  36. package/dist/lib/utils/helper.d.ts +29 -0
  37. package/dist/main.js +212 -133
  38. package/dist/{mutation-X73nm7Df.js → mutation-EhVtpjb0.js} +1 -1
  39. package/dist/{omit-B7MWDtHq.js → omit-C9Qe80rl.js} +1 -1
  40. package/dist/stores/EnvironmentStore.js +3 -2
  41. package/dist/types/ActionStorage.js +4 -0
  42. package/dist/types/Entities.js +25 -0
  43. package/dist/types/Environment.js +1 -4
  44. package/dist/types/EnvironmentVariable.js +1 -0
  45. package/dist/types/Requests.js +1 -4
  46. package/dist/{useMutation-3rykrmeD.js → useMutation-BYO7aks8.js} +16 -16
  47. package/dist/{useQuery-CwwWze9O.js → useQuery-Jx956wwH.js} +94 -94
  48. package/dist/utils/api.js +1 -1
  49. package/dist/utils/baseFetches.js +15 -15
  50. package/dist/utils/fetches.js +14 -13
  51. package/dist/utils/helper.js +55 -0
  52. package/package.json +7 -2
  53. package/dist/components/ModuleBase.d.ts +0 -11
  54. package/dist/hooks/useStores.d.ts +0 -30
  55. package/dist/main.d.ts +0 -13
  56. /package/dist/{hooks → lib/hooks}/useBreadcrumbTranslation.d.ts +0 -0
  57. /package/dist/{hooks → lib/hooks}/useOption.d.ts +0 -0
  58. /package/dist/{hooks → lib/hooks}/useSignalRMessages.d.ts +0 -0
  59. /package/dist/{module-router.d.ts → lib/module-router.d.ts} +0 -0
  60. /package/dist/{provider → lib/provider}/SignalR/SignalRProvider.d.ts +0 -0
  61. /package/dist/{provider → lib/provider}/SignalR/signalR.d.ts +0 -0
  62. /package/dist/{stores → lib/stores}/BasePropsStore.d.ts +0 -0
  63. /package/dist/{stores → lib/stores}/EnvironmentStore.d.ts +0 -0
  64. /package/dist/{types → lib/types}/AppInsights.d.ts +0 -0
  65. /package/dist/{types → lib/types}/CommonOptions.d.ts +0 -0
  66. /package/dist/{types → lib/types}/ModuleApi.d.ts +0 -0
  67. /package/dist/{types → lib/types}/ServiceBus.d.ts +0 -0
  68. /package/dist/{types → lib/types}/SystemMessage.d.ts +0 -0
@@ -1,6 +1,6 @@
1
- import * as F from "react";
2
- import { jsx as N } from "react/jsx-runtime";
3
- var C = class {
1
+ import * as g from "react";
2
+ import { jsx as R } from "react/jsx-runtime";
3
+ var L = class {
4
4
  constructor() {
5
5
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
6
  }
@@ -16,25 +16,25 @@ var C = class {
16
16
  }
17
17
  onUnsubscribe() {
18
18
  }
19
- }, d = typeof window > "u" || "Deno" in globalThis;
20
- function J() {
19
+ }, y = typeof window > "u" || "Deno" in globalThis;
20
+ function _() {
21
21
  }
22
- function _(e, t) {
22
+ function B(e, t) {
23
23
  return typeof e == "function" ? e(t) : e;
24
24
  }
25
25
  function Q(e) {
26
26
  return typeof e == "number" && e >= 0 && e !== 1 / 0;
27
27
  }
28
- function B(e, t) {
29
- return Math.max(e + (t || 0) - Date.now(), 0);
30
- }
31
28
  function W(e, t) {
32
- return typeof e == "function" ? e(t) : e;
29
+ return Math.max(e + (t || 0) - Date.now(), 0);
33
30
  }
34
31
  function X(e, t) {
35
32
  return typeof e == "function" ? e(t) : e;
36
33
  }
37
34
  function Y(e, t) {
35
+ return typeof e == "function" ? e(t) : e;
36
+ }
37
+ function Z(e, t) {
38
38
  const {
39
39
  type: n = "all",
40
40
  exact: r,
@@ -47,7 +47,7 @@ function Y(e, t) {
47
47
  if (r) {
48
48
  if (t.queryHash !== K(l, t.options))
49
49
  return !1;
50
- } else if (!S(t.queryKey, l))
50
+ } else if (!F(t.queryKey, l))
51
51
  return !1;
52
52
  }
53
53
  if (n !== "all") {
@@ -57,7 +57,7 @@ function Y(e, t) {
57
57
  }
58
58
  return !(typeof i == "boolean" && t.isStale() !== i || s && s !== t.state.fetchStatus || o && !o(t));
59
59
  }
60
- function Z(e, t) {
60
+ function ee(e, t) {
61
61
  const { exact: n, status: r, predicate: s, mutationKey: o } = e;
62
62
  if (o) {
63
63
  if (!t.options.mutationKey)
@@ -65,7 +65,7 @@ function Z(e, t) {
65
65
  if (n) {
66
66
  if (w(t.options.mutationKey) !== w(o))
67
67
  return !1;
68
- } else if (!S(t.options.mutationKey, o))
68
+ } else if (!F(t.options.mutationKey, o))
69
69
  return !1;
70
70
  }
71
71
  return !(r && t.state.status !== r || s && !s(t));
@@ -76,17 +76,17 @@ function K(e, t) {
76
76
  function w(e) {
77
77
  return JSON.stringify(
78
78
  e,
79
- (t, n) => g(n) ? Object.keys(n).sort().reduce((r, s) => (r[s] = n[s], r), {}) : n
79
+ (t, n) => S(n) ? Object.keys(n).sort().reduce((r, s) => (r[s] = n[s], r), {}) : n
80
80
  );
81
81
  }
82
- function S(e, t) {
83
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((n) => !S(e[n], t[n])) : !1;
82
+ function F(e, t) {
83
+ return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((n) => !F(e[n], t[n])) : !1;
84
84
  }
85
85
  function E(e, t) {
86
86
  if (e === t)
87
87
  return e;
88
88
  const n = j(e) && j(t);
89
- if (n || g(e) && g(t)) {
89
+ if (n || S(e) && S(t)) {
90
90
  const r = n ? e : Object.keys(e), s = r.length, o = n ? t : Object.keys(t), l = o.length, i = n ? [] : {};
91
91
  let u = 0;
92
92
  for (let f = 0; f < l; f++) {
@@ -97,7 +97,7 @@ function E(e, t) {
97
97
  }
98
98
  return t;
99
99
  }
100
- function ee(e, t) {
100
+ function te(e, t) {
101
101
  if (!t || Object.keys(e).length !== Object.keys(t).length)
102
102
  return !1;
103
103
  for (const n in e)
@@ -108,7 +108,7 @@ function ee(e, t) {
108
108
  function j(e) {
109
109
  return Array.isArray(e) && e.length === Object.keys(e).length;
110
110
  }
111
- function g(e) {
111
+ function S(e) {
112
112
  if (!T(e))
113
113
  return !1;
114
114
  const t = e.constructor;
@@ -125,7 +125,7 @@ function z(e) {
125
125
  setTimeout(t, e);
126
126
  });
127
127
  }
128
- function te(e, t, n) {
128
+ function ne(e, t, n) {
129
129
  if (typeof n.structuralSharing == "function")
130
130
  return n.structuralSharing(e, t);
131
131
  if (n.structuralSharing !== !1) {
@@ -133,35 +133,35 @@ function te(e, t, n) {
133
133
  try {
134
134
  return E(e, t);
135
135
  } catch (r) {
136
- console.error(
136
+ throw console.error(
137
137
  `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`
138
- );
138
+ ), r;
139
139
  }
140
140
  return E(e, t);
141
141
  }
142
142
  return t;
143
143
  }
144
- function ne(e, t, n = 0) {
144
+ function re(e, t, n = 0) {
145
145
  const r = [...e, t];
146
146
  return n && r.length > n ? r.slice(1) : r;
147
147
  }
148
- function re(e, t, n = 0) {
148
+ function se(e, t, n = 0) {
149
149
  const r = [t, ...e];
150
150
  return n && r.length > n ? r.slice(0, -1) : r;
151
151
  }
152
152
  var P = Symbol();
153
- function se(e, t) {
153
+ function ie(e, t) {
154
154
  return process.env.NODE_ENV !== "production" && e.queryFn === P && console.error(
155
155
  `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
156
156
  ), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === P ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
157
157
  }
158
- var D = class extends C {
158
+ var D = class extends L {
159
159
  #e;
160
160
  #t;
161
161
  #n;
162
162
  constructor() {
163
163
  super(), this.#n = (e) => {
164
- if (!d && window.addEventListener) {
164
+ if (!y && window.addEventListener) {
165
165
  const t = () => e();
166
166
  return window.addEventListener("visibilitychange", t, !1), () => {
167
167
  window.removeEventListener("visibilitychange", t);
@@ -192,13 +192,13 @@ var D = class extends C {
192
192
  isFocused() {
193
193
  return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
194
194
  }
195
- }, I = new D(), A = class extends C {
195
+ }, I = new D(), A = class extends L {
196
196
  #e = !0;
197
197
  #t;
198
198
  #n;
199
199
  constructor() {
200
200
  super(), this.#n = (e) => {
201
- if (!d && window.addEventListener) {
201
+ if (!y && window.addEventListener) {
202
202
  const t = () => e(!0), n = () => e(!1);
203
203
  return window.addEventListener("online", t, !1), window.addEventListener("offline", n, !1), () => {
204
204
  window.removeEventListener("online", t), window.removeEventListener("offline", n);
@@ -223,7 +223,7 @@ var D = class extends C {
223
223
  isOnline() {
224
224
  return this.#e;
225
225
  }
226
- }, L = new A();
226
+ }, k = new A();
227
227
  function U() {
228
228
  let e, t;
229
229
  const n = new Promise((s, o) => {
@@ -250,25 +250,25 @@ function G(e) {
250
250
  return Math.min(1e3 * 2 ** e, 3e4);
251
251
  }
252
252
  function H(e) {
253
- return (e ?? "online") === "online" ? L.isOnline() : !0;
253
+ return (e ?? "online") === "online" ? k.isOnline() : !0;
254
254
  }
255
- var q = class extends Error {
255
+ var C = class extends Error {
256
256
  constructor(e) {
257
257
  super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
258
258
  }
259
259
  };
260
- function ie(e) {
261
- return e instanceof q;
262
- }
263
260
  function oe(e) {
261
+ return e instanceof C;
262
+ }
263
+ function ue(e) {
264
264
  let t = !1, n = 0, r = !1, s;
265
265
  const o = U(), l = (a) => {
266
- r || (b(new q(a)), e.abort?.());
266
+ r || (b(new C(a)), e.abort?.());
267
267
  }, i = () => {
268
268
  t = !0;
269
269
  }, u = () => {
270
270
  t = !1;
271
- }, f = () => I.isFocused() && (e.networkMode === "always" || L.isOnline()) && e.canRun(), c = () => H(e.networkMode) && e.canRun(), M = (a) => {
271
+ }, f = () => I.isFocused() && (e.networkMode === "always" || k.isOnline()) && e.canRun(), c = () => H(e.networkMode) && e.canRun(), M = (a) => {
272
272
  r || (r = !0, e.onSuccess?.(a), s?.(), o.resolve(a));
273
273
  }, b = (a) => {
274
274
  r || (r = !0, e.onError?.(a), s?.(), o.reject(a));
@@ -291,12 +291,12 @@ function oe(e) {
291
291
  Promise.resolve(a).then(M).catch((h) => {
292
292
  if (r)
293
293
  return;
294
- const y = e.retry ?? (d ? 0 : 3), v = e.retryDelay ?? G, R = typeof v == "function" ? v(n, h) : v, x = y === !0 || typeof y == "number" && n < y || typeof y == "function" && y(n, h);
295
- if (t || !x) {
294
+ const d = e.retry ?? (y ? 0 : 3), v = e.retryDelay ?? G, x = typeof v == "function" ? v(n, h) : v, N = d === !0 || typeof d == "number" && n < d || typeof d == "function" && d(n, h);
295
+ if (t || !N) {
296
296
  b(h);
297
297
  return;
298
298
  }
299
- n++, e.onFail?.(n, h), z(R).then(() => f() ? void 0 : O()).then(() => {
299
+ n++, e.onFail?.(n, h), z(x).then(() => f() ? void 0 : O()).then(() => {
300
300
  t ? b(h) : m();
301
301
  });
302
302
  });
@@ -311,12 +311,13 @@ function oe(e) {
311
311
  start: () => (c() ? m() : O().then(m), o)
312
312
  };
313
313
  }
314
- function V() {
314
+ var V = (e) => setTimeout(e, 0);
315
+ function $() {
315
316
  let e = [], t = 0, n = (i) => {
316
317
  i();
317
318
  }, r = (i) => {
318
319
  i();
319
- }, s = (i) => setTimeout(i, 0);
320
+ }, s = V;
320
321
  const o = (i) => {
321
322
  t ? e.push(i) : s(() => {
322
323
  n(i);
@@ -370,7 +371,7 @@ function V() {
370
371
  }
371
372
  };
372
373
  }
373
- var ue = V(), ce = class {
374
+ var ce = $(), ae = class {
374
375
  #e;
375
376
  destroy() {
376
377
  this.clearGcTimeout();
@@ -383,53 +384,55 @@ var ue = V(), ce = class {
383
384
  updateGcTime(e) {
384
385
  this.gcTime = Math.max(
385
386
  this.gcTime || 0,
386
- e ?? (d ? 1 / 0 : 5 * 60 * 1e3)
387
+ e ?? (y ? 1 / 0 : 5 * 60 * 1e3)
387
388
  );
388
389
  }
389
390
  clearGcTimeout() {
390
391
  this.#e && (clearTimeout(this.#e), this.#e = void 0);
391
392
  }
392
- }, k = F.createContext(
393
+ }, q = g.createContext(
393
394
  void 0
394
- ), ae = (e) => {
395
- const t = F.useContext(k);
395
+ ), le = (e) => {
396
+ const t = g.useContext(q);
397
+ if (e)
398
+ return e;
396
399
  if (!t)
397
400
  throw new Error("No QueryClient set, use QueryClientProvider to set one");
398
401
  return t;
399
- }, le = ({
402
+ }, fe = ({
400
403
  client: e,
401
404
  children: t
402
- }) => (F.useEffect(() => (e.mount(), () => {
405
+ }) => (g.useEffect(() => (e.mount(), () => {
403
406
  e.unmount();
404
- }), [e]), /* @__PURE__ */ N(k.Provider, { value: e, children: t }));
407
+ }), [e]), /* @__PURE__ */ R(q.Provider, { value: e, children: t }));
405
408
  export {
406
- le as Q,
407
- ce as R,
408
- C as S,
409
- J as a,
410
- X as b,
411
- oe as c,
412
- H as d,
413
- se as e,
414
- ee as f,
415
- K as g,
409
+ fe as Q,
410
+ ae as R,
411
+ L as S,
412
+ _ as a,
413
+ Y as b,
414
+ ue as c,
415
+ P as d,
416
+ ie as e,
417
+ H as f,
418
+ X as g,
416
419
  w as h,
417
- ie as i,
418
- Z as j,
419
- re as k,
420
- ne as l,
421
- Y as m,
422
- ue as n,
423
- I as o,
424
- L as p,
425
- W as q,
426
- te as r,
427
- P as s,
428
- B as t,
429
- ae as u,
430
- _ as v,
431
- S as w,
432
- U as x,
433
- d as y,
434
- Q as z
420
+ oe as i,
421
+ y as j,
422
+ Q as k,
423
+ I as l,
424
+ K as m,
425
+ ce as n,
426
+ Z as o,
427
+ U as p,
428
+ ee as q,
429
+ ne as r,
430
+ te as s,
431
+ W as t,
432
+ le as u,
433
+ se as v,
434
+ re as w,
435
+ k as x,
436
+ B as y,
437
+ F as z
435
438
  };