@hortiview/modulebase 0.0.1 → 0.0.17-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 (80) hide show
  1. package/README.md +8 -8
  2. package/dist/ModuleCore-YCIFN_02.js +14973 -0
  3. package/dist/QueryClientProvider-Beog9TR7.js +437 -0
  4. package/dist/{_baseGet-Bh5zJ_C8.js → _baseGet-C6jMXSsQ.js} +448 -448
  5. package/dist/api-s6E2GJtu.js +458 -0
  6. package/dist/assets/ModuleCore.css +1 -0
  7. package/dist/chunk-QMGIS6GS-C4bgXQXY.js +9203 -0
  8. package/dist/components/ModuleBase.js +20 -681
  9. package/dist/components/ModuleCore.js +10 -0
  10. package/dist/hooks/useBreadcrumbTranslation.js +16 -13
  11. package/dist/hooks/useCustom.js +15 -15
  12. package/dist/hooks/useCustomMutation.js +23 -0
  13. package/dist/hooks/useEntity.js +53 -54
  14. package/dist/hooks/useOffline.js +45 -0
  15. package/dist/hooks/useOption.js +19 -17
  16. package/dist/hooks/useServiceBus.js +25 -0
  17. package/dist/hooks/useStores.js +11 -841
  18. package/dist/isRestoring-CLuxJVSA.js +281 -0
  19. package/dist/lib/components/ModuleBase.d.ts +36 -0
  20. package/dist/lib/components/ModuleCore.d.ts +32 -0
  21. package/dist/{constants.d.ts → lib/constants.d.ts} +1 -1
  22. package/dist/{hooks → lib/hooks}/useBreadcrumbTranslation.d.ts +1 -1
  23. package/dist/lib/hooks/useCustom.d.ts +8 -0
  24. package/dist/lib/hooks/useCustomMutation.d.ts +9 -0
  25. package/dist/{hooks → lib/hooks}/useEntity.d.ts +6 -30
  26. package/dist/lib/hooks/useOffline.d.ts +15 -0
  27. package/dist/{hooks → lib/hooks}/useOption.d.ts +1 -1
  28. package/dist/lib/hooks/useServiceBus.d.ts +19 -0
  29. package/dist/lib/hooks/useStores.d.ts +38 -0
  30. package/dist/lib/main.d.ts +27 -0
  31. package/dist/lib/module-router.d.ts +7 -0
  32. package/dist/{stores → lib/stores}/EnvironmentStore.d.ts +1 -1
  33. package/dist/lib/types/ActionStorage.d.ts +16 -0
  34. package/dist/{types → lib/types}/BaseProps.d.ts +14 -2
  35. package/dist/{types → lib/types}/Deprecated.d.ts +7 -1
  36. package/dist/lib/types/Entities.d.ts +22 -0
  37. package/dist/{types → lib/types}/Environment.d.ts +3 -2
  38. package/dist/lib/types/EnvironmentVariable.d.ts +6 -0
  39. package/dist/lib/types/ModuleApi.d.ts +163 -0
  40. package/dist/{types → lib/types}/Requests.d.ts +6 -11
  41. package/dist/lib/types/ServiceBus.d.ts +17 -0
  42. package/dist/{utils/fetches.d.ts → lib/utils/api.d.ts} +2 -8
  43. package/dist/lib/utils/baseFetches.d.ts +19 -0
  44. package/dist/lib/utils/fetches.d.ts +43 -0
  45. package/dist/lib/utils/helper.d.ts +29 -0
  46. package/dist/main.js +224 -17
  47. package/dist/module-router.js +137 -0
  48. package/dist/mutation-DSKlaYzY.js +192 -0
  49. package/dist/omit-C9Qe80rl.js +835 -0
  50. package/dist/stores/EnvironmentStore.js +9 -3
  51. package/dist/types/ActionStorage.js +4 -0
  52. package/dist/types/Entities.js +25 -0
  53. package/dist/types/EnvironmentVariable.js +1 -0
  54. package/dist/types/Requests.js +1 -4
  55. package/dist/types/ServiceBus.js +1 -0
  56. package/dist/useMutation-zu8uxBak.js +97 -0
  57. package/dist/{useQuery-znAyMQW1.js → useQuery-Bj9k9zik.js} +106 -108
  58. package/dist/utils/api.js +9 -0
  59. package/dist/utils/baseFetches.js +19 -0
  60. package/dist/utils/fetches.js +20 -14
  61. package/dist/utils/helper.js +55 -0
  62. package/dist/utils-DxRR_XLb.js +9 -0
  63. package/package.json +8 -3
  64. package/dist/QueryClientProvider-DQv4Y3Qu.js +0 -707
  65. package/dist/chunk-IR6S3I6Y-BvQXS3A3.js +0 -3908
  66. package/dist/components/ModuleBase.d.ts +0 -11
  67. package/dist/fetches-DUCQo_6B.js +0 -477
  68. package/dist/hooks/useCustom.d.ts +0 -6
  69. package/dist/hooks/useNavigate.d.ts +0 -5
  70. package/dist/hooks/useNavigate.js +0 -27
  71. package/dist/hooks/useStores.d.ts +0 -29
  72. package/dist/main.d.ts +0 -9
  73. package/dist/types/ModuleApi.d.ts +0 -80
  74. /package/dist/{hooks → lib/hooks}/useSignalRMessages.d.ts +0 -0
  75. /package/dist/{provider → lib/provider}/SignalR/SignalRProvider.d.ts +0 -0
  76. /package/dist/{provider → lib/provider}/SignalR/signalR.d.ts +0 -0
  77. /package/dist/{stores → lib/stores}/BasePropsStore.d.ts +0 -0
  78. /package/dist/{types → lib/types}/AppInsights.d.ts +0 -0
  79. /package/dist/{types → lib/types}/CommonOptions.d.ts +0 -0
  80. /package/dist/{types → lib/types}/SystemMessage.d.ts +0 -0
@@ -0,0 +1,137 @@
1
+ import { useCallback as r } from "react";
2
+ import { useBasePropsStore as t } from "./stores/BasePropsStore.js";
3
+ import { A as R, B as F, F as E, H as N, I as _, a as l, b as A, L as d, c as U, M as v, d as h, N as m, e as g, f as C, O as p, P, R as y, g as H, h as x, i as k, S as L, j as w, k as D, l as b, m as I, D as B, n as M, E as O, o as T, p as f, q as V, r as W, s as q, t as z, u as G, v as K, V as j, w as J, x as Q, y as X, z as Y, C as Z, G as $, J as aa, K as ea, Q as sa, T as ta, U as ra, W as oa, X as ia, Y as ua, Z as na, _ as ca, $ as Sa, a0 as Ra, a1 as Fa, a2 as Ea, a3 as Na, a4 as _a, a5 as la, a6 as Aa, a7 as da, a8 as Ua, a9 as va, aa as ha, ab as ma, ac as ga, ad as Ca, ae as pa, af as Pa, ag as ya, ah as Ha, ai as xa, aj as ka, ak as La, al as wa, am as Da, an as ba, ao as Ia, ap as Ba, aq as Ma, ar as Oa, as as Ta, at as fa, au as Va, av as Wa, aw as qa, ax as za, ay as Ga, az as Ka, aA as ja, aB as Ja, aC as Qa, aD as Xa, aE as Ya, aF as Za, aG as $a, aH as ae, aI as ee, aJ as se, aK as te, aL as re, aM as oe, aN as ie, aO as ue, aP as ne, aQ as ce, aR as Se, aS as Re, aT as Fe, aU as Ee, aV as Ne, aW as _e, aX as le, aY as Ae, aZ as de, a_ as Ue, a$ as ve } from "./chunk-QMGIS6GS-C4bgXQXY.js";
4
+ const n = () => {
5
+ const s = t((a) => a.navigateTo), e = t((a) => a.navigateInHortiview);
6
+ return r(
7
+ (a) => {
8
+ if (e) {
9
+ e(a);
10
+ return;
11
+ }
12
+ s?.(a);
13
+ },
14
+ [e, s]
15
+ );
16
+ };
17
+ export {
18
+ R as Await,
19
+ F as BrowserRouter,
20
+ E as Form,
21
+ N as HashRouter,
22
+ _ as IDLE_BLOCKER,
23
+ l as IDLE_FETCHER,
24
+ A as IDLE_NAVIGATION,
25
+ d as Link,
26
+ U as Links,
27
+ v as MemoryRouter,
28
+ h as Meta,
29
+ m as NavLink,
30
+ g as Navigate,
31
+ C as NavigationType,
32
+ p as Outlet,
33
+ P as PrefetchPageLinks,
34
+ y as Route,
35
+ H as Router,
36
+ x as RouterProvider,
37
+ k as Routes,
38
+ L as Scripts,
39
+ w as ScrollRestoration,
40
+ D as ServerRouter,
41
+ b as StaticRouter,
42
+ I as StaticRouterProvider,
43
+ B as UNSAFE_DataRouterContext,
44
+ M as UNSAFE_DataRouterStateContext,
45
+ O as UNSAFE_ErrorResponseImpl,
46
+ T as UNSAFE_FetchersContext,
47
+ f as UNSAFE_FrameworkContext,
48
+ V as UNSAFE_LocationContext,
49
+ W as UNSAFE_NavigationContext,
50
+ q as UNSAFE_RemixErrorBoundary,
51
+ z as UNSAFE_RouteContext,
52
+ G as UNSAFE_ServerMode,
53
+ K as UNSAFE_SingleFetchRedirectSymbol,
54
+ j as UNSAFE_ViewTransitionContext,
55
+ J as UNSAFE_createBrowserHistory,
56
+ Q as UNSAFE_createClientRoutes,
57
+ X as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
58
+ Y as UNSAFE_createRouter,
59
+ Z as UNSAFE_decodeViaTurboStream,
60
+ $ as UNSAFE_deserializeErrors,
61
+ aa as UNSAFE_getHydrationData,
62
+ ea as UNSAFE_getPatchRoutesOnNavigationFunction,
63
+ sa as UNSAFE_getTurboStreamSingleFetchDataStrategy,
64
+ ta as UNSAFE_hydrationRouteProperties,
65
+ ra as UNSAFE_invariant,
66
+ oa as UNSAFE_mapRouteProperties,
67
+ ia as UNSAFE_shouldHydrateRouteLoader,
68
+ ua as UNSAFE_useFogOFWarDiscovery,
69
+ na as UNSAFE_useScrollRestoration,
70
+ ca as UNSAFE_withComponentProps,
71
+ Sa as UNSAFE_withErrorBoundaryProps,
72
+ Ra as UNSAFE_withHydrateFallbackProps,
73
+ Fa as createBrowserRouter,
74
+ Ea as createCookie,
75
+ Na as createCookieSessionStorage,
76
+ _a as createHashRouter,
77
+ la as createMemoryRouter,
78
+ Aa as createMemorySessionStorage,
79
+ da as createPath,
80
+ Ua as createRequestHandler,
81
+ va as createRoutesFromChildren,
82
+ ha as createRoutesFromElements,
83
+ ma as createRoutesStub,
84
+ ga as createSearchParams,
85
+ Ca as createSession,
86
+ pa as createSessionStorage,
87
+ Pa as createStaticHandler,
88
+ ya as createStaticRouter,
89
+ Ha as data,
90
+ xa as generatePath,
91
+ ka as href,
92
+ La as isCookie,
93
+ wa as isRouteErrorResponse,
94
+ Da as isSession,
95
+ ba as matchPath,
96
+ Ia as matchRoutes,
97
+ Ba as parsePath,
98
+ Ma as redirect,
99
+ Oa as redirectDocument,
100
+ Ta as renderMatches,
101
+ fa as replace,
102
+ Va as resolvePath,
103
+ Wa as unstable_HistoryRouter,
104
+ qa as unstable_RouterContextProvider,
105
+ za as unstable_createContext,
106
+ Ga as unstable_setDevServerHooks,
107
+ Ka as unstable_usePrompt,
108
+ ja as useActionData,
109
+ Ja as useAsyncError,
110
+ Qa as useAsyncValue,
111
+ Xa as useBeforeUnload,
112
+ Ya as useBlocker,
113
+ Za as useFetcher,
114
+ $a as useFetchers,
115
+ ae as useFormAction,
116
+ ee as useHref,
117
+ se as useInRouterContext,
118
+ te as useLinkClickHandler,
119
+ re as useLoaderData,
120
+ oe as useLocation,
121
+ ie as useMatch,
122
+ ue as useMatches,
123
+ n as useNavigate,
124
+ ne as useNavigation,
125
+ ce as useNavigationType,
126
+ Se as useOutlet,
127
+ Re as useOutletContext,
128
+ Fe as useParams,
129
+ Ee as useResolvedPath,
130
+ Ne as useRevalidator,
131
+ _e as useRouteError,
132
+ le as useRouteLoaderData,
133
+ Ae as useRoutes,
134
+ de as useSearchParams,
135
+ Ue as useSubmit,
136
+ ve as useViewTransitionState
137
+ };
@@ -0,0 +1,192 @@
1
+ import { R as o, c as a, n as r } from "./QueryClientProvider-Beog9TR7.js";
2
+ var d = class extends o {
3
+ #e;
4
+ #t;
5
+ #i;
6
+ constructor(t) {
7
+ super(), this.mutationId = t.mutationId, this.#t = t.mutationCache, this.#e = [], this.state = t.state || u(), this.setOptions(t.options), this.scheduleGc();
8
+ }
9
+ setOptions(t) {
10
+ this.options = t, this.updateGcTime(this.options.gcTime);
11
+ }
12
+ get meta() {
13
+ return this.options.meta;
14
+ }
15
+ addObserver(t) {
16
+ this.#e.includes(t) || (this.#e.push(t), this.clearGcTimeout(), this.#t.notify({
17
+ type: "observerAdded",
18
+ mutation: this,
19
+ observer: t
20
+ }));
21
+ }
22
+ removeObserver(t) {
23
+ this.#e = this.#e.filter((i) => i !== t), this.scheduleGc(), this.#t.notify({
24
+ type: "observerRemoved",
25
+ mutation: this,
26
+ observer: t
27
+ });
28
+ }
29
+ optionalRemove() {
30
+ this.#e.length || (this.state.status === "pending" ? this.scheduleGc() : this.#t.remove(this));
31
+ }
32
+ continue() {
33
+ return this.#i?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
34
+ this.execute(this.state.variables);
35
+ }
36
+ async execute(t) {
37
+ this.#i = a({
38
+ fn: () => this.options.mutationFn ? this.options.mutationFn(t) : Promise.reject(new Error("No mutationFn found")),
39
+ onFail: (e, n) => {
40
+ this.#s({ type: "failed", failureCount: e, error: n });
41
+ },
42
+ onPause: () => {
43
+ this.#s({ type: "pause" });
44
+ },
45
+ onContinue: () => {
46
+ this.#s({ type: "continue" });
47
+ },
48
+ retry: this.options.retry ?? 0,
49
+ retryDelay: this.options.retryDelay,
50
+ networkMode: this.options.networkMode,
51
+ canRun: () => this.#t.canRun(this)
52
+ });
53
+ const i = this.state.status === "pending", s = !this.#i.canStart();
54
+ try {
55
+ if (!i) {
56
+ this.#s({ type: "pending", variables: t, isPaused: s }), await this.#t.config.onMutate?.(
57
+ t,
58
+ this
59
+ );
60
+ const n = await this.options.onMutate?.(t);
61
+ n !== this.state.context && this.#s({
62
+ type: "pending",
63
+ context: n,
64
+ variables: t,
65
+ isPaused: s
66
+ });
67
+ }
68
+ const e = await this.#i.start();
69
+ return await this.#t.config.onSuccess?.(
70
+ e,
71
+ t,
72
+ this.state.context,
73
+ this
74
+ ), await this.options.onSuccess?.(e, t, this.state.context), await this.#t.config.onSettled?.(
75
+ e,
76
+ null,
77
+ this.state.variables,
78
+ this.state.context,
79
+ this
80
+ ), await this.options.onSettled?.(e, null, t, this.state.context), this.#s({ type: "success", data: e }), e;
81
+ } catch (e) {
82
+ try {
83
+ throw await this.#t.config.onError?.(
84
+ e,
85
+ t,
86
+ this.state.context,
87
+ this
88
+ ), await this.options.onError?.(
89
+ e,
90
+ t,
91
+ this.state.context
92
+ ), await this.#t.config.onSettled?.(
93
+ void 0,
94
+ e,
95
+ this.state.variables,
96
+ this.state.context,
97
+ this
98
+ ), await this.options.onSettled?.(
99
+ void 0,
100
+ e,
101
+ t,
102
+ this.state.context
103
+ ), e;
104
+ } finally {
105
+ this.#s({ type: "error", error: e });
106
+ }
107
+ } finally {
108
+ this.#t.runNext(this);
109
+ }
110
+ }
111
+ #s(t) {
112
+ const i = (s) => {
113
+ switch (t.type) {
114
+ case "failed":
115
+ return {
116
+ ...s,
117
+ failureCount: t.failureCount,
118
+ failureReason: t.error
119
+ };
120
+ case "pause":
121
+ return {
122
+ ...s,
123
+ isPaused: !0
124
+ };
125
+ case "continue":
126
+ return {
127
+ ...s,
128
+ isPaused: !1
129
+ };
130
+ case "pending":
131
+ return {
132
+ ...s,
133
+ context: t.context,
134
+ data: void 0,
135
+ failureCount: 0,
136
+ failureReason: null,
137
+ error: null,
138
+ isPaused: t.isPaused,
139
+ status: "pending",
140
+ variables: t.variables,
141
+ submittedAt: Date.now()
142
+ };
143
+ case "success":
144
+ return {
145
+ ...s,
146
+ data: t.data,
147
+ failureCount: 0,
148
+ failureReason: null,
149
+ error: null,
150
+ status: "success",
151
+ isPaused: !1
152
+ };
153
+ case "error":
154
+ return {
155
+ ...s,
156
+ data: void 0,
157
+ error: t.error,
158
+ failureCount: s.failureCount + 1,
159
+ failureReason: t.error,
160
+ isPaused: !1,
161
+ status: "error"
162
+ };
163
+ }
164
+ };
165
+ this.state = i(this.state), r.batch(() => {
166
+ this.#e.forEach((s) => {
167
+ s.onMutationUpdate(t);
168
+ }), this.#t.notify({
169
+ mutation: this,
170
+ type: "updated",
171
+ action: t
172
+ });
173
+ });
174
+ }
175
+ };
176
+ function u() {
177
+ return {
178
+ context: void 0,
179
+ data: void 0,
180
+ error: null,
181
+ failureCount: 0,
182
+ failureReason: null,
183
+ isPaused: !1,
184
+ status: "idle",
185
+ variables: void 0,
186
+ submittedAt: 0
187
+ };
188
+ }
189
+ export {
190
+ d as M,
191
+ u as g
192
+ };