@hortiview/modulebase 0.0.13100-beta → 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.
@@ -4,9 +4,9 @@ import L, { createContext as Q9, useContext as Km, useState as gt, useRef as re,
4
4
  import { useBasePropsStore as mc } from "./stores/BasePropsStore.js";
5
5
  import { useEnvironmentStore as yc } from "./stores/EnvironmentStore.js";
6
6
  import { getEnvironmentVariables as Jm, checkVersion as Ym, arePropsValid as Xm } from "./utils/helper.js";
7
- import { S as K9, m as G9, n as $e, o as vc, q as bc, a as Qe, e as e5, v as t5, w as n5, l as r5, x as Cc, g as xc, y as a5, h as $c, z as wc, d as o5, Q as i5 } from "./QueryClientProvider-Beog9TR7.js";
8
- import { Q as s5, I as l5 } from "./isRestoring-CLuxJVSA.js";
9
- import { M as u5 } from "./mutation-DSKlaYzY.js";
7
+ import { S as K9, m as G9, n as $e, o as vc, q as bc, a as Qe, e as e5, v as t5, w as n5, l as r5, x as Cc, g as xc, y as a5, h as $c, z as wc, d as o5, Q as i5 } from "./QueryClientProvider-BSM1ol7r.js";
8
+ import { Q as s5, I as l5 } from "./isRestoring-LSIsLTaI.js";
9
+ import { M as u5 } from "./mutation-EhVtpjb0.js";
10
10
  import './assets/ModuleCore.css';const J9 = Q9();
11
11
  let c5 = class {
12
12
  constructor() {
@@ -14489,6 +14489,13 @@ var sO = class {
14489
14489
  isMutating(t) {
14490
14490
  return this.#t.findAll({ ...t, status: "pending" }).length;
14491
14491
  }
14492
+ /**
14493
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
14494
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
14495
+ *
14496
+ * Hint: Do not use this function inside a component, because it won't receive updates.
14497
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
14498
+ */
14492
14499
  getQueryData(t) {
14493
14500
  const e = this.defaultQueryOptions({ queryKey: t });
14494
14501
  return this.#e.get(e.queryHash)?.state.data;
@@ -1,4 +1,4 @@
1
- import * as F from "react";
1
+ import * as g from "react";
2
2
  import { jsx as R } from "react/jsx-runtime";
3
3
  var L = class {
4
4
  constructor() {
@@ -17,24 +17,24 @@ var L = class {
17
17
  onUnsubscribe() {
18
18
  }
19
19
  }, y = typeof window > "u" || "Deno" in globalThis;
20
- function J() {
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,24 +133,24 @@ 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;
@@ -257,10 +257,10 @@ var C = class extends Error {
257
257
  super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
258
258
  }
259
259
  };
260
- function ie(e) {
260
+ function oe(e) {
261
261
  return e instanceof C;
262
262
  }
263
- function oe(e) {
263
+ function ue(e) {
264
264
  let t = !1, n = 0, r = !1, s;
265
265
  const o = U(), l = (a) => {
266
266
  r || (b(new C(a)), e.abort?.());
@@ -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();
@@ -389,49 +390,49 @@ var ue = V(), ce = class {
389
390
  clearGcTimeout() {
390
391
  this.#e && (clearTimeout(this.#e), this.#e = void 0);
391
392
  }
392
- }, q = F.createContext(
393
+ }, q = g.createContext(
393
394
  void 0
394
- ), ae = (e) => {
395
- const t = F.useContext(q);
395
+ ), le = (e) => {
396
+ const t = g.useContext(q);
396
397
  if (e)
397
398
  return e;
398
399
  if (!t)
399
400
  throw new Error("No QueryClient set, use QueryClientProvider to set one");
400
401
  return t;
401
- }, le = ({
402
+ }, fe = ({
402
403
  client: e,
403
404
  children: t
404
- }) => (F.useEffect(() => (e.mount(), () => {
405
+ }) => (g.useEffect(() => (e.mount(), () => {
405
406
  e.unmount();
406
407
  }), [e]), /* @__PURE__ */ R(q.Provider, { value: e, children: t }));
407
408
  export {
408
- le as Q,
409
- ce as R,
409
+ fe as Q,
410
+ ae as R,
410
411
  L as S,
411
- J as a,
412
- X as b,
413
- oe as c,
412
+ _ as a,
413
+ Y as b,
414
+ ue as c,
414
415
  P as d,
415
- se as e,
416
+ ie as e,
416
417
  H as f,
417
- W as g,
418
+ X as g,
418
419
  w as h,
419
- ie as i,
420
+ oe as i,
420
421
  y as j,
421
422
  Q as k,
422
423
  I as l,
423
424
  K as m,
424
- ue as n,
425
- Y as o,
425
+ ce as n,
426
+ Z as o,
426
427
  U as p,
427
- Z as q,
428
- te as r,
429
- ee as s,
430
- B as t,
431
- ae as u,
432
- re as v,
433
- ne as w,
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,
434
435
  k as x,
435
- _ as y,
436
- S as z
436
+ B as y,
437
+ F as z
437
438
  };
@@ -3,7 +3,7 @@ import { useEffect as s } from "react";
3
3
  import { Y as u, h as l, O as c, aU as d } from "../chunk-IR6S3I6Y-BmDdD3SP.js";
4
4
  import { SignalRProvider as m } from "../provider/SignalR/SignalRProvider.js";
5
5
  import { useBasePropsStore as f } from "../stores/BasePropsStore.js";
6
- import { M as p, a as h } from "../ModuleCore-YCIFN_02.js";
6
+ import { M as p, a as h } from "../ModuleCore-BWvRhZyP.js";
7
7
  const v = () => {
8
8
  const e = f((o) => o.currentNavigationPath), t = d();
9
9
  s(() => {
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { M as a, a as l } from "../ModuleCore-YCIFN_02.js";
2
+ import { M as a, a as l } from "../ModuleCore-BWvRhZyP.js";
3
3
  import "react";
4
4
  import "../stores/BasePropsStore.js";
5
5
  import "../stores/EnvironmentStore.js";
@@ -1,4 +1,4 @@
1
- import { u as f } from "../useQuery-Bj9k9zik.js";
1
+ import { u as f } from "../useQuery-Jx956wwH.js";
2
2
  import { fetchFromCustomApi as i } from "../utils/fetches.js";
3
3
  import { universalSelector as n } from "../utils/helper.js";
4
4
  const y = ({
@@ -1,9 +1,9 @@
1
- import { u as n } from "../useMutation-zu8uxBak.js";
1
+ import { u as n } from "../useMutation-BYO7aks8.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "../provider/SignalR/SignalRProvider.js";
5
5
  import "../stores/BasePropsStore.js";
6
- import "../ModuleCore-YCIFN_02.js";
6
+ import "../ModuleCore-BWvRhZyP.js";
7
7
  import { mutateOnCustomApi as s } from "../utils/fetches.js";
8
8
  import "../api-s6E2GJtu.js";
9
9
  import "../types/Entities.js";
@@ -1,4 +1,4 @@
1
- import { u as l } from "../useQuery-Bj9k9zik.js";
1
+ import { u as l } from "../useQuery-Jx956wwH.js";
2
2
  import { useMemo as M, useCallback as g } from "react";
3
3
  import { useBasePropsStore as p } from "../stores/BasePropsStore.js";
4
4
  import { getModuleDependedEntitiesRaw as Q, getModuleDependedEntities as A, getFarmOrgEntities as D } from "../utils/fetches.js";
@@ -1,4 +1,4 @@
1
- import { u as f } from "../QueryClientProvider-Beog9TR7.js";
1
+ import { u as f } from "../QueryClientProvider-BSM1ol7r.js";
2
2
  import { fetchFromCustomApi as i, getFarmOrgEntities as c, getModuleDependedEntities as m } from "../utils/fetches.js";
3
3
  import { getModuleQueryKey as o } from "../utils/helper.js";
4
4
  import { useBasePropsStore as p } from "../stores/BasePropsStore.js";
@@ -1,4 +1,4 @@
1
- import { u as m } from "../useQuery-Bj9k9zik.js";
1
+ import { u as m } from "../useQuery-Jx956wwH.js";
2
2
  import { g as u } from "../api-s6E2GJtu.js";
3
3
  import { useBasePropsStore as n } from "../stores/BasePropsStore.js";
4
4
  import { fetchFromModuleApi as c, fetchFromCommonApi as i } from "../utils/fetches.js";
@@ -1,4 +1,4 @@
1
- import { u as n } from "../useMutation-zu8uxBak.js";
1
+ import { u as n } from "../useMutation-BYO7aks8.js";
2
2
  import { useBasePropsStore as r } from "../stores/BasePropsStore.js";
3
3
  const a = ({
4
4
  authenticationKey: i,
@@ -1,4 +1,4 @@
1
- import { R as f, r as p, a as u, b as y, d as v, t as b, c as m, n as C, e as g, i as h, f as S } from "./QueryClientProvider-Beog9TR7.js";
1
+ import { R as f, r as p, a as u, b as y, d as v, t as b, c as m, n as C, e as g, i as h, f as S } from "./QueryClientProvider-BSM1ol7r.js";
2
2
  import * as c from "react";
3
3
  var D = class extends f {
4
4
  #a;
@@ -19,6 +19,7 @@ export declare const useBaseProps: () => Pick<import('../main').DeprecatedBasePr
19
19
  showSnackbar?: (message: string, icon?: string) => void;
20
20
  showMessage?: (message: import('../main').SystemMessage) => void;
21
21
  pendingActions?: import('../main').ActionItem[];
22
+ getPendingActions?: () => import('../main').ActionItem[];
22
23
  resolveAction?: (key: string, result?: string) => void;
23
24
  addAction?: (functionName: string, args: unknown[], key?: string) => void;
24
25
  getActions?: () => import('../main').ActionItem[];
@@ -29,7 +30,7 @@ export declare const useBaseProps: () => Pick<import('../main').DeprecatedBasePr
29
30
  environmentVariables?: import('../main').EnvironmentVariable[];
30
31
  } & {
31
32
  setBaseProps: (props: import('../main').BaseProps) => void;
32
- }, keyof import('../main').DeprecatedBaseProps | "isOnline" | "modulePermissionToken" | "moduleId" | "organizationId" | "basePath" | "currentNavigationPath" | "sourcePath" | "currentLanguage" | "currentLanguageId" | "alertRules" | "commonOptions" | "riseNotification" | "navigateInHortiview" | "addBreadcrumbTranslation" | "showSnackbar" | "showMessage" | "pendingActions" | "resolveAction" | "addAction" | "getActions" | "getActionByKey" | "logEvent" | "logError" | "throwError" | "environmentVariables">;
33
+ }, keyof import('../main').DeprecatedBaseProps | "isOnline" | "modulePermissionToken" | "moduleId" | "organizationId" | "basePath" | "currentNavigationPath" | "sourcePath" | "currentLanguage" | "currentLanguageId" | "alertRules" | "commonOptions" | "riseNotification" | "navigateInHortiview" | "addBreadcrumbTranslation" | "showSnackbar" | "showMessage" | "pendingActions" | "getPendingActions" | "resolveAction" | "addAction" | "getActions" | "getActionByKey" | "logEvent" | "logError" | "throwError" | "environmentVariables">;
33
34
  export declare const useConfig: () => Pick<{
34
35
  environment: import('../main').HortiViewEnvironments;
35
36
  setEnvironment: (environment: import('../main').HortiViewEnvironments) => void;
@@ -38,6 +38,7 @@ export type BaseProps = DeprecatedBaseProps & {
38
38
  showSnackbar?: (message: string, icon?: string) => void;
39
39
  showMessage?: (message: SystemMessage) => void;
40
40
  pendingActions?: ActionItem[];
41
+ getPendingActions?: () => ActionItem[];
41
42
  resolveAction?: (key: string, result?: string) => void;
42
43
  addAction?: (functionName: string, args: unknown[], key?: string) => void;
43
44
  getActions?: () => ActionItem[];
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ModuleBase as A } from "./components/ModuleBase.js";
2
- import { i as f, h as m, b as l } from "./ModuleCore-YCIFN_02.js";
3
- import { M as C, Q as U } from "./ModuleCore-YCIFN_02.js";
2
+ import { i as f, h as m, b as l } from "./ModuleCore-BWvRhZyP.js";
3
+ import { M as C, Q as U } from "./ModuleCore-BWvRhZyP.js";
4
4
  import { useBreadcrumbTranslation as M } from "./hooks/useBreadcrumbTranslation.js";
5
5
  import { useOffline as k } from "./hooks/useOffline.js";
6
6
  import { useSignalRMessages as L } from "./hooks/useSignalRMessages.js";
@@ -13,10 +13,10 @@ import { useOption as j } from "./hooks/useOption.js";
13
13
  import { useNotification as J, useServiceBus as X } from "./hooks/useServiceBus.js";
14
14
  import { mutateOnCustomApi as Z } from "./utils/fetches.js";
15
15
  import { arePropsValid as ee, checkConfig as ae, checkIfPropExists as se, checkVersion as te, getEnvironmentVariables as re, getModuleQueryKey as oe, universalSelector as ie } from "./utils/helper.js";
16
- import { Q as g, a as d } from "./useQuery-Bj9k9zik.js";
17
- import { u as ne } from "./useQuery-Bj9k9zik.js";
18
- import { u as he } from "./useMutation-zu8uxBak.js";
19
- import { u as Se } from "./QueryClientProvider-Beog9TR7.js";
16
+ import { Q as g, a as d } from "./useQuery-Jx956wwH.js";
17
+ import { u as ne } from "./useQuery-Jx956wwH.js";
18
+ import { u as he } from "./useMutation-BYO7aks8.js";
19
+ import { u as Se } from "./QueryClientProvider-BSM1ol7r.js";
20
20
  import { A as me, B as le, F as ge, H as de, I as Ee, a as Pe, b as pe, L as Ne, c as Fe, M as xe, d as ve, N as Ae, e as _e, f as Ce, O as Ue, P as ye, R as Me, g as be, h as ke, i as Oe, S as Le, j as we, k as Be, l as De, m as He, D as Qe, n as Ie, E as Te, o as Ve, p as Ke, q as ze, r as Ge, s as We, t as je, u as qe, v as Je, V as Xe, w as Ye, x as Ze, y as $e, z as ea, C as aa, G as sa, J as ta, K as ra, Q as oa, T as ia, U as ua, W as na, X as ca, Y as ha, Z as fa, _ as Sa, $ as Ra, a0 as ma, a1 as la, a2 as ga, a3 as da, a4 as Ea, a5 as Pa, a6 as pa, a7 as Na, a8 as Fa, a9 as xa, aa as va, ab as Aa, ac as _a, ad as Ca, ae as Ua, af as ya, ag as Ma, ah as ba, ai as ka, aj as Oa, ak as La, al as wa, am as Ba, an as Da, ao as Ha, ap as Qa, aq as Ia, ar as Ta, as as Va, at as Ka, au as za, av as Ga, aw as Wa, ax as ja, ay as qa, az as Ja, aA as Xa, aB as Ya, aC as Za, aD as $a, aE as es, aF as as, aG as ss, aH as ts, aI as rs, aJ as os, aK as is, aL as us, aM as ns, aN as cs, aO as hs, aP as fs, aQ as Ss, aR as Rs, aS as ms, aT as ls } from "./chunk-IR6S3I6Y-BmDdD3SP.js";
21
21
  var E = class extends g {
22
22
  constructor(e, a) {
@@ -25,14 +25,11 @@ var E = class extends g {
25
25
  bindMethods() {
26
26
  super.bindMethods(), this.fetchNextPage = this.fetchNextPage.bind(this), this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
27
27
  }
28
- setOptions(e, a) {
29
- super.setOptions(
30
- {
31
- ...e,
32
- behavior: f()
33
- },
34
- a
35
- );
28
+ setOptions(e) {
29
+ super.setOptions({
30
+ ...e,
31
+ behavior: f()
32
+ });
36
33
  }
37
34
  getOptimisticResult(e) {
38
35
  return e.behavior = f(), super.getOptimisticResult(e);
@@ -1,4 +1,4 @@
1
- import { R as o, c as a, n as r } from "./QueryClientProvider-Beog9TR7.js";
1
+ import { R as o, c as a, n as r } from "./QueryClientProvider-BSM1ol7r.js";
2
2
  var d = class extends o {
3
3
  #e;
4
4
  #t;
@@ -1,6 +1,6 @@
1
1
  import * as o from "react";
2
- import { g as l } from "./mutation-DSKlaYzY.js";
3
- import { S as d, s as p, h, n as a, u as b } from "./QueryClientProvider-Beog9TR7.js";
2
+ import { g as l } from "./mutation-EhVtpjb0.js";
3
+ import { S as d, s as p, h, n as a, u as b } from "./QueryClientProvider-BSM1ol7r.js";
4
4
  import { n as m, s as f } from "./utils-DxRR_XLb.js";
5
5
  var v = class extends d {
6
6
  #e;
@@ -1,5 +1,5 @@
1
- import { S as B, p as U, b as f, s as w, g as O, a as N, j as Q, k, t as H, l as V, r as M, n as A, u as z } from "./QueryClientProvider-Beog9TR7.js";
2
- import { f as W, u as $ } from "./isRestoring-CLuxJVSA.js";
1
+ import { S as B, p as U, b as f, s as w, g as O, a as H, j as Q, k, t as N, l as V, r as M, n as A, u as z } from "./QueryClientProvider-BSM1ol7r.js";
2
+ import { f as W, u as $ } from "./isRestoring-LSIsLTaI.js";
3
3
  import * as y from "react";
4
4
  import "react/jsx-runtime";
5
5
  import { s as K, n as _ } from "./utils-DxRR_XLb.js";
@@ -52,26 +52,26 @@ var G = class extends B {
52
52
  destroy() {
53
53
  this.listeners = /* @__PURE__ */ new Set(), this.#v(), this.#O(), this.#e.removeObserver(this);
54
54
  }
55
- setOptions(e, t) {
56
- const s = this.options, r = this.#e;
55
+ setOptions(e) {
56
+ const t = this.options, s = this.#e;
57
57
  if (this.options = this.#s.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof f(this.options.enabled, this.#e) != "boolean")
58
58
  throw new Error(
59
59
  "Expected enabled to be a boolean or a callback that returns a boolean"
60
60
  );
61
- this.#C(), this.#e.setOptions(this.options), s._defaulted && !w(this.options, s) && this.#s.getQueryCache().notify({
61
+ this.#C(), this.#e.setOptions(this.options), t._defaulted && !w(this.options, t) && this.#s.getQueryCache().notify({
62
62
  type: "observerOptionsUpdated",
63
63
  query: this.#e,
64
64
  observer: this
65
65
  });
66
- const a = this.hasListeners();
67
- a && L(
66
+ const r = this.hasListeners();
67
+ r && L(
68
68
  this.#e,
69
- r,
69
+ s,
70
70
  this.options,
71
- s
72
- ) && this.#u(), this.updateResult(t), a && (this.#e !== r || f(this.options.enabled, this.#e) !== f(s.enabled, this.#e) || O(this.options.staleTime, this.#e) !== O(s.staleTime, this.#e)) && this.#b();
73
- const u = this.#m();
74
- a && (this.#e !== r || f(this.options.enabled, this.#e) !== f(s.enabled, this.#e) || u !== this.#n) && this.#g(u);
71
+ t
72
+ ) && this.#u(), this.updateResult(), r && (this.#e !== s || f(this.options.enabled, this.#e) !== f(t.enabled, this.#e) || O(this.options.staleTime, this.#e) !== O(t.staleTime, this.#e)) && this.#b();
73
+ const a = this.#m();
74
+ r && (this.#e !== s || f(this.options.enabled, this.#e) !== f(t.enabled, this.#e) || a !== this.#n) && this.#g(a);
75
75
  }
76
76
  getOptimisticResult(e) {
77
77
  const t = this.#s.getQueryCache().build(this.#s, e), s = this.createResult(t, e);
@@ -117,7 +117,7 @@ var G = class extends B {
117
117
  this.options,
118
118
  e
119
119
  );
120
- return e?.throwOnError || (t = t.catch(N)), t;
120
+ return e?.throwOnError || (t = t.catch(H)), t;
121
121
  }
122
122
  #b() {
123
123
  this.#v();
@@ -127,7 +127,7 @@ var G = class extends B {
127
127
  );
128
128
  if (Q || this.#t.isStale || !k(e))
129
129
  return;
130
- const s = H(this.#t.dataUpdatedAt, e) + 1;
130
+ const s = N(this.#t.dataUpdatedAt, e) + 1;
131
131
  this.#o = setTimeout(() => {
132
132
  this.#t.isStale || this.updateResult();
133
133
  }, s);
@@ -150,28 +150,28 @@ var G = class extends B {
150
150
  this.#h && (clearInterval(this.#h), this.#h = void 0);
151
151
  }
152
152
  createResult(e, t) {
153
- const s = this.#e, r = this.options, a = this.#t, u = this.#a, i = this.#c, o = e !== s ? e.state : this.#p, { state: c } = e;
154
- let n = { ...c }, R = !1, l;
153
+ const s = this.#e, r = this.options, a = this.#t, c = this.#a, i = this.#c, o = e !== s ? e.state : this.#p, { state: l } = e;
154
+ let n = { ...l }, R = !1, u;
155
155
  if (t._optimisticResults) {
156
- const h = this.hasListeners(), b = !h && j(e, t), m = h && L(e, s, t, r);
157
- (b || m) && (n = {
156
+ const h = this.hasListeners(), m = !h && j(e, t), g = h && L(e, s, t, r);
157
+ (m || g) && (n = {
158
158
  ...n,
159
- ...W(c.data, e.options)
159
+ ...W(l.data, e.options)
160
160
  }), t._optimisticResults === "isRestoring" && (n.fetchStatus = "idle");
161
161
  }
162
162
  let { error: F, errorUpdatedAt: x, status: p } = n;
163
163
  if (t.select && n.data !== void 0)
164
- if (a && n.data === u?.data && t.select === this.#y)
165
- l = this.#l;
164
+ if (a && n.data === c?.data && t.select === this.#y)
165
+ u = this.#l;
166
166
  else
167
167
  try {
168
- this.#y = t.select, l = t.select(n.data), l = M(a?.data, l, t), this.#l = l, this.#r = null;
168
+ this.#y = t.select, u = t.select(n.data), u = M(a?.data, u, t), this.#l = u, this.#r = null;
169
169
  } catch (h) {
170
170
  this.#r = h;
171
171
  }
172
172
  else
173
- l = n.data;
174
- if (t.placeholderData !== void 0 && l === void 0 && p === "pending") {
173
+ u = n.data;
174
+ if (t.placeholderData !== void 0 && u === void 0 && p === "pending") {
175
175
  let h;
176
176
  if (a?.isPlaceholderData && t.placeholderData === i?.placeholderData)
177
177
  h = a.data;
@@ -181,17 +181,17 @@ var G = class extends B {
181
181
  ) : t.placeholderData, t.select && h !== void 0)
182
182
  try {
183
183
  h = t.select(h), this.#r = null;
184
- } catch (b) {
185
- this.#r = b;
184
+ } catch (m) {
185
+ this.#r = m;
186
186
  }
187
- h !== void 0 && (p = "success", l = M(
187
+ h !== void 0 && (p = "success", u = M(
188
188
  a?.data,
189
189
  h,
190
190
  t
191
191
  ), R = !0);
192
192
  }
193
- this.#r && (F = this.#r, l = this.#l, x = Date.now(), p = "error");
194
- const C = n.fetchStatus === "fetching", S = p === "pending", E = p === "error", D = S && C, P = l !== void 0, d = {
193
+ this.#r && (F = this.#r, u = this.#l, x = Date.now(), p = "error");
194
+ const C = n.fetchStatus === "fetching", S = p === "pending", E = p === "error", D = S && C, P = u !== void 0, d = {
195
195
  status: p,
196
196
  fetchStatus: n.fetchStatus,
197
197
  isPending: S,
@@ -199,7 +199,7 @@ var G = class extends B {
199
199
  isError: E,
200
200
  isInitialLoading: D,
201
201
  isLoading: D,
202
- data: l,
202
+ data: u,
203
203
  dataUpdatedAt: n.dataUpdatedAt,
204
204
  error: F,
205
205
  errorUpdatedAt: x,
@@ -221,44 +221,44 @@ var G = class extends B {
221
221
  if (this.options.experimental_prefetchInRender) {
222
222
  const h = (v) => {
223
223
  d.status === "error" ? v.reject(d.error) : d.data !== void 0 && v.resolve(d.data);
224
- }, b = () => {
224
+ }, m = () => {
225
225
  const v = this.#i = d.promise = U();
226
226
  h(v);
227
- }, m = this.#i;
228
- switch (m.status) {
227
+ }, g = this.#i;
228
+ switch (g.status) {
229
229
  case "pending":
230
- e.queryHash === s.queryHash && h(m);
230
+ e.queryHash === s.queryHash && h(g);
231
231
  break;
232
232
  case "fulfilled":
233
- (d.status === "error" || d.data !== m.value) && b();
233
+ (d.status === "error" || d.data !== g.value) && m();
234
234
  break;
235
235
  case "rejected":
236
- (d.status !== "error" || d.error !== m.reason) && b();
236
+ (d.status !== "error" || d.error !== g.reason) && m();
237
237
  break;
238
238
  }
239
239
  }
240
240
  return d;
241
241
  }
242
- updateResult(e) {
243
- const t = this.#t, s = this.createResult(this.#e, this.options);
244
- if (this.#a = this.#e.state, this.#c = this.options, this.#a.data !== void 0 && (this.#d = this.#e), w(s, t))
242
+ updateResult() {
243
+ const e = this.#t, t = this.createResult(this.#e, this.options);
244
+ if (this.#a = this.#e.state, this.#c = this.options, this.#a.data !== void 0 && (this.#d = this.#e), w(t, e))
245
245
  return;
246
- this.#t = s;
247
- const r = {}, a = () => {
248
- if (!t)
246
+ this.#t = t;
247
+ const s = () => {
248
+ if (!e)
249
249
  return !0;
250
- const { notifyOnChangeProps: u } = this.options, i = typeof u == "function" ? u() : u;
251
- if (i === "all" || !i && !this.#f.size)
250
+ const { notifyOnChangeProps: r } = this.options, a = typeof r == "function" ? r() : r;
251
+ if (a === "all" || !a && !this.#f.size)
252
252
  return !0;
253
- const g = new Set(
254
- i ?? this.#f
253
+ const c = new Set(
254
+ a ?? this.#f
255
255
  );
256
- return this.options.throwOnError && g.add("error"), Object.keys(this.#t).some((o) => {
257
- const c = o;
258
- return this.#t[c] !== t[c] && g.has(c);
256
+ return this.options.throwOnError && c.add("error"), Object.keys(this.#t).some((i) => {
257
+ const b = i;
258
+ return this.#t[b] !== e[b] && c.has(b);
259
259
  });
260
260
  };
261
- e?.listeners !== !1 && a() && (r.listeners = !0), this.#S({ ...r, ...e });
261
+ this.#S({ listeners: s() });
262
262
  }
263
263
  #C() {
264
264
  const e = this.#s.getQueryCache().build(this.#s, this.options);
@@ -338,52 +338,52 @@ function oe(e, t, s) {
338
338
  throw new Error(
339
339
  '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'
340
340
  );
341
- const r = z(s), a = $(), u = ee(), i = r.defaultQueryOptions(e);
341
+ const r = z(s), a = $(), c = ee(), i = r.defaultQueryOptions(e);
342
342
  r.getDefaultOptions().queries?._experimental_beforeQuery?.(
343
343
  i
344
344
  ), process.env.NODE_ENV !== "production" && (i.queryFn || console.error(
345
345
  `[${i.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`
346
- )), i._optimisticResults = a ? "isRestoring" : "optimistic", ie(i), te(i, u), se(u);
347
- const g = !r.getQueryCache().get(i.queryHash), [o] = y.useState(
346
+ )), i._optimisticResults = a ? "isRestoring" : "optimistic", ie(i), te(i, c), se(c);
347
+ const b = !r.getQueryCache().get(i.queryHash), [o] = y.useState(
348
348
  () => new t(
349
349
  r,
350
350
  i
351
351
  )
352
- ), c = o.getOptimisticResult(i), n = !a && e.subscribed !== !1;
352
+ ), l = o.getOptimisticResult(i), n = !a && e.subscribed !== !1;
353
353
  if (y.useSyncExternalStore(
354
354
  y.useCallback(
355
355
  (R) => {
356
- const l = n ? o.subscribe(A.batchCalls(R)) : _;
357
- return o.updateResult(), l;
356
+ const u = n ? o.subscribe(A.batchCalls(R)) : _;
357
+ return o.updateResult(), u;
358
358
  },
359
359
  [o, n]
360
360
  ),
361
361
  () => o.getCurrentResult(),
362
362
  () => o.getCurrentResult()
363
363
  ), y.useEffect(() => {
364
- o.setOptions(i, { listeners: !1 });
365
- }, [i, o]), ae(i, c))
366
- throw q(i, o, u);
364
+ o.setOptions(i);
365
+ }, [i, o]), ae(i, l))
366
+ throw q(i, o, c);
367
367
  if (re({
368
- result: c,
369
- errorResetBoundary: u,
368
+ result: l,
369
+ errorResetBoundary: c,
370
370
  throwOnError: i.throwOnError,
371
371
  query: r.getQueryCache().get(i.queryHash),
372
372
  suspense: i.suspense
373
373
  }))
374
- throw c.error;
374
+ throw l.error;
375
375
  return r.getDefaultOptions().queries?._experimental_afterQuery?.(
376
376
  i,
377
- c
378
- ), i.experimental_prefetchInRender && !Q && ne(c, a) && (g ? (
377
+ l
378
+ ), i.experimental_prefetchInRender && !Q && ne(l, a) && (b ? (
379
379
  // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
380
- q(i, o, u)
380
+ q(i, o, c)
381
381
  ) : (
382
382
  // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
383
383
  r.getQueryCache().get(i.queryHash)?.promise
384
384
  ))?.catch(_).finally(() => {
385
385
  o.updateResult();
386
- }), i.notifyOnChangeProps ? c : o.trackResult(c);
386
+ }), i.notifyOnChangeProps ? l : o.trackResult(l);
387
387
  }
388
388
  function fe(e, t) {
389
389
  return oe(e, G, t);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/modulebase",
3
3
  "description": "This is a base module for hortiview",
4
- "version": "0.0.13100-beta",
4
+ "version": "0.0.13101-beta",
5
5
  "type": "module",
6
6
  "author": "Falk Menge <falk.menge.ext@bayer.com>",
7
7
  "contributors": [