@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
@@ -1,11 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- import { RouteObject } from 'react-router';
3
- import { BaseProps } from '../types/BaseProps';
4
- import { EnvConfig } from '../types/Environment';
5
- export declare const ModuleBase: ({ props, routes, env, useSignalR, queryClient, }: {
6
- props: BaseProps;
7
- routes: RouteObject[];
8
- env?: EnvConfig;
9
- useSignalR?: boolean;
10
- queryClient?: QueryClient;
11
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,477 +0,0 @@
1
- import { g as z } from "./_commonjsHelpers-BkfeUUK-.js";
2
- import { r as W, a as Y, b as Z, c as K, d as tt, e as rt, f as et, g as nt, h as ot } from "./_baseGet-Bh5zJ_C8.js";
3
- import { RETRY_HTTP_STATUS_CODES as ct, RETRIES as at } from "./constants.js";
4
- import { useBasePropsStore as A } from "./stores/BasePropsStore.js";
5
- import { useEnvironmentStore as X } from "./stores/EnvironmentStore.js";
6
- var R, U;
7
- function it() {
8
- if (U) return R;
9
- U = 1;
10
- var t = W();
11
- function e(r, n, o) {
12
- var c = r == null ? void 0 : t(r, n);
13
- return c === void 0 ? o : c;
14
- }
15
- return R = e, R;
16
- }
17
- var st = it();
18
- const L = /* @__PURE__ */ z(st);
19
- var C, D;
20
- function ut() {
21
- if (D) return C;
22
- D = 1;
23
- var t = Y(), e = Z(), r = K(), n = nt(), o = tt(), c = rt(), u = ot(), p = et(), h = "[object Map]", m = "[object Set]", f = Object.prototype, d = f.hasOwnProperty;
24
- function a(s) {
25
- if (s == null)
26
- return !0;
27
- if (o(s) && (n(s) || typeof s == "string" || typeof s.splice == "function" || c(s) || p(s) || r(s)))
28
- return !s.length;
29
- var O = e(s);
30
- if (O == h || O == m)
31
- return !s.size;
32
- if (u(s))
33
- return !t(s).length;
34
- for (var y in s)
35
- if (d.call(s, y))
36
- return !1;
37
- return !0;
38
- }
39
- return C = a, C;
40
- }
41
- var ft = ut();
42
- const N = /* @__PURE__ */ z(ft);
43
- var $ = function() {
44
- return $ = Object.assign || function(e) {
45
- for (var r, n = 1, o = arguments.length; n < o; n++) {
46
- r = arguments[n];
47
- for (var c in r) Object.prototype.hasOwnProperty.call(r, c) && (e[c] = r[c]);
48
- }
49
- return e;
50
- }, $.apply(this, arguments);
51
- };
52
- function pt(t, e) {
53
- var r = {};
54
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
55
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
56
- for (var o = 0, n = Object.getOwnPropertySymbols(t); o < n.length; o++)
57
- e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[o]) && (r[n[o]] = t[n[o]]);
58
- return r;
59
- }
60
- var dt = ["eq", "ne", "gt", "ge", "lt", "le"], q = ["and", "or", "not"], yt = ["any", "all"], ht = ["startswith", "endswith", "contains", "matchespattern"], mt = [
61
- "expand",
62
- "levels",
63
- "select",
64
- "skip",
65
- "top",
66
- "count",
67
- "orderby",
68
- "filter"
69
- ], F = /\((.*)\)/, M = /(?!indexof)\((\w+)\)/, G;
70
- (function(t) {
71
- t.sum = "sum", t.min = "min", t.max = "max", t.average = "average", t.countdistinct = "countdistinct";
72
- })(G || (G = {}));
73
- var j = "";
74
- function gt(t) {
75
- var e = t === void 0 ? {} : t, r = e.select, n = e.search, o = e.skiptoken, c = e.format, u = e.top, p = e.skip, h = e.filter, m = e.transform, f = e.orderBy, d = e.key, a = e.count, s = e.expand, O = e.action, y = e.func, l = "", w = [], i = {};
76
- if (d != null && (l += "(".concat(E(d, w), ")")), (h || typeof a == "object") && (i.$filter = T(typeof a == "object" ? a : h, w)), m && (i.$apply = Q(m)), s && (i.$expand = I(s)), f && (i.$orderby = B(f)), a && (typeof a == "boolean" ? i.$count = !0 : l += "/$count"), typeof u == "number" && (i.$top = u), typeof p == "number" && (i.$skip = p), O && (l += "/".concat(O)), y) {
77
- if (typeof y == "string")
78
- l += "/".concat(y);
79
- else if (typeof y == "object") {
80
- var g = Object.keys(y)[0], v = E(y[g], w);
81
- l += "/".concat(g), v !== "" && (l += "(".concat(v, ")"));
82
- }
83
- }
84
- return w.length > 0 && Object.assign(i, w.reduce(function(_, S) {
85
- var b;
86
- return Object.assign(_, (b = {}, b["@".concat(S.name)] = E(S.value), b));
87
- }, {})), bt(l, $({ $select: r, $search: n, $skiptoken: o, $format: c }, i));
88
- }
89
- function P(t, e, r) {
90
- return r === void 0 && (r = []), "".concat(t, " eq ").concat(E(e, r));
91
- }
92
- function T(t, e, r) {
93
- return t === void 0 && (t = {}), e === void 0 && (e = []), r === void 0 && (r = ""), (Array.isArray(t) ? t : [t]).reduce(function(c, u) {
94
- if (u) {
95
- var p = n(u, e, r);
96
- p && c.push(p);
97
- }
98
- return c;
99
- }, []).join(" and ");
100
- function n(c, u, p) {
101
- c === void 0 && (c = {}), u === void 0 && (u = []), p === void 0 && (p = "");
102
- var h = "";
103
- if (typeof c == "string")
104
- h = c;
105
- else if (c && typeof c == "object") {
106
- var m = Object.keys(c).reduce(function(f, d) {
107
- var a = c[d];
108
- if (a === void 0)
109
- return f;
110
- var s = "";
111
- if (p ? d === j ? s = p : M.test(d) ? s = d.replace(M, function(i, g) {
112
- return g.trim() === j ? "(".concat(p, ")") : "(".concat(p, "/").concat(g.trim(), ")");
113
- }) : F.test(d) ? s = d.replace(F, function(i, g) {
114
- return g.trim() === j ? "(".concat(p, ")") : "(".concat(p, "/").concat(g.trim(), ")");
115
- }) : s = "".concat(p, "/").concat(d) : s = d, d === j && Array.isArray(a))
116
- return f.concat(a.map(function(i) {
117
- return P(s, i);
118
- }));
119
- if (["number", "string", "boolean"].indexOf(typeof a) !== -1 || a instanceof Date || a === null)
120
- f.push(P(s, a, u));
121
- else if (Array.isArray(a)) {
122
- var O = d, y = a.map(function(i) {
123
- return T(i, u, p);
124
- }).filter(function(i) {
125
- return i;
126
- }).map(function(i) {
127
- return q.indexOf(O) !== -1 ? "(".concat(i, ")") : i;
128
- });
129
- y.length && (q.indexOf(O) !== -1 ? y.length && (O === "not" ? f.push(H(y)) : f.push("(".concat(y.join(" ".concat(O, " ")), ")"))) : f.push(y.join(" ".concat(O, " "))));
130
- } else if (q.indexOf(s) !== -1) {
131
- var l = s, y = Object.keys(a).map(function(g) {
132
- var v;
133
- return n((v = {}, v[g] = a[g], v));
134
- });
135
- y.length && (l === "not" ? f.push(H(y)) : f.push("(".concat(y.join(" ".concat(l, " ")), ")")));
136
- } else if (typeof a == "object")
137
- if ("type" in a)
138
- f.push(P(s, a, u));
139
- else {
140
- var w = Object.keys(a);
141
- w.forEach(function(i) {
142
- var g;
143
- if (a[i] !== void 0)
144
- if (dt.indexOf(i) !== -1)
145
- f.push("".concat(s, " ").concat(i, " ").concat(E(a[i], u)));
146
- else if (q.indexOf(i) !== -1)
147
- Array.isArray(a[i]) ? f.push(a[i].map(function(b) {
148
- return "(" + n(b, u, s) + ")";
149
- }).join(" ".concat(i, " "))) : f.push("(" + n(a[i], u, s) + ")");
150
- else if (yt.indexOf(i) !== -1) {
151
- var v = o(d.toLowerCase(), a[i], i, s);
152
- v && f.push(v);
153
- } else if (i === "has")
154
- f.push("".concat(s, " ").concat(i, " ").concat(E(a[i], u)));
155
- else if (i === "in") {
156
- var _ = Array.isArray(a[i]) ? a[i] : a[i].value.map(function(b) {
157
- return {
158
- type: a[i].type,
159
- value: b
160
- };
161
- });
162
- f.push(s + " in (" + _.map(function(b) {
163
- return E(b, u);
164
- }).join(",") + ")");
165
- } else if (ht.indexOf(i) !== -1)
166
- f.push("".concat(i, "(").concat(s, ",").concat(E(a[i], u), ")"));
167
- else {
168
- var S = n((g = {}, g[i] = a[i], g), u, s);
169
- S && f.push(S);
170
- }
171
- });
172
- }
173
- else
174
- throw new Error("Unexpected value type: ".concat(a));
175
- return f;
176
- }, []);
177
- h = m.join(" and ");
178
- }
179
- return h;
180
- }
181
- function o(c, u, p, h) {
182
- var m = "";
183
- if (typeof u == "string" || u instanceof String)
184
- m = Ot(c, u, p, h);
185
- else if (u) {
186
- var f = Array.isArray(u) ? u.reduce(function(a, s) {
187
- return s.hasOwnProperty(j) ? (a.hasOwnProperty(j) || (a[j] = []), a[j].push(s[j]), a) : $($({}, a), s);
188
- }, {}) : u, d = n(f, e, c);
189
- m = "".concat(h, "/").concat(p, "(").concat(d ? "".concat(c, ":").concat(d) : "", ")");
190
- }
191
- return m;
192
- }
193
- }
194
- function Ot(t, e, r, n) {
195
- var o = "", c = r == "all" ? "ne" : "eq";
196
- return o = "".concat(n, "/").concat(r, "(").concat(t, ": ").concat(t, " ").concat(c, " '").concat(e, "')"), o;
197
- }
198
- function lt(t) {
199
- return t = t.replace(/%/g, "%25"), t = t.replace(/\+/g, "%2B"), t = t.replace(/\//g, "%2F"), t = t.replace(/\?/g, "%3F"), t = t.replace(/#/g, "%23"), t = t.replace(/&/g, "%26"), t = t.replace(/'/g, "''"), t;
200
- }
201
- function E(t, e) {
202
- if (typeof t == "string")
203
- return "'".concat(lt(t), "'");
204
- if (t instanceof Date)
205
- return t.toISOString();
206
- if (typeof t == "number")
207
- return t;
208
- if (Array.isArray(t))
209
- return "[".concat(t.map(function(r) {
210
- return E(r);
211
- }).join(","), "]");
212
- if (t === null)
213
- return t;
214
- if (typeof t == "object")
215
- switch (t.type) {
216
- case "raw":
217
- case "guid":
218
- return t.value;
219
- case "duration":
220
- return "duration'".concat(t.value, "'");
221
- case "binary":
222
- return "binary'".concat(t.value, "'");
223
- case "alias":
224
- return Array.isArray(e) && e.push(t), "@".concat(t.name);
225
- case "json":
226
- return escape(JSON.stringify(t.value));
227
- case "decimal":
228
- return "".concat(t.value, "M");
229
- default:
230
- return Object.entries(t).filter(function(r) {
231
- var n = r[1];
232
- return n !== void 0;
233
- }).map(function(r) {
234
- var n = r[0], o = r[1];
235
- return "".concat(n, "=").concat(E(o, e));
236
- }).join(",");
237
- }
238
- return t;
239
- }
240
- function I(t) {
241
- if (typeof t == "number")
242
- return t;
243
- if (typeof t == "string")
244
- return t.indexOf("/") === -1 ? t : t.split("/").reverse().reduce(function(r, n, o, c) {
245
- return o === 0 ? "$expand=".concat(n) : o === c.length - 1 ? "".concat(n, "(").concat(r, ")") : "$expand=".concat(n, "(").concat(r, ")");
246
- }, "");
247
- if (Array.isArray(t))
248
- return "".concat(t.map(function(r) {
249
- return I(r);
250
- }).join(","));
251
- if (typeof t == "object") {
252
- var e = Object.keys(t);
253
- return e.some(function(r) {
254
- return mt.indexOf(r.toLowerCase()) !== -1;
255
- }) ? e.map(function(r) {
256
- var n;
257
- switch (r) {
258
- case "filter":
259
- n = T(t[r]);
260
- break;
261
- case "orderBy":
262
- n = B(t[r]);
263
- break;
264
- case "levels":
265
- case "count":
266
- case "skip":
267
- case "top":
268
- n = "".concat(t[r]);
269
- break;
270
- default:
271
- n = I(t[r]);
272
- }
273
- return "$".concat(r.toLowerCase(), "=").concat(n);
274
- }).join(";") : e.map(function(r) {
275
- var n = I(t[r]);
276
- return n ? "".concat(r, "(").concat(n, ")") : r;
277
- }).join(",");
278
- }
279
- return "";
280
- }
281
- function Q(t) {
282
- var e = Array.isArray(t) ? t : [t], r = e.reduce(function(n, o) {
283
- var c = o.aggregate, u = o.filter, p = o.groupBy, h = pt(o, ["aggregate", "filter", "groupBy"]), m = Object.keys(h);
284
- if (m.length)
285
- throw new Error("Unsupported transform(s): ".concat(m));
286
- if (c && n.push("aggregate(".concat(Et(c), ")")), u) {
287
- var f = T(u);
288
- f && n.push("filter(".concat(T(f), ")"));
289
- }
290
- return p && n.push("groupby(".concat(vt(p), ")")), n;
291
- }, []);
292
- return r.join("/") || void 0;
293
- }
294
- function Et(t) {
295
- var e = Array.isArray(t) ? t : [t];
296
- return e.map(function(r) {
297
- return typeof r == "string" ? r : Object.keys(r).map(function(n) {
298
- var o = r[n];
299
- if (!o.with && o.as)
300
- return "".concat(n, " as ").concat(o.as);
301
- if (!o.with)
302
- throw new Error("'with' property required for '".concat(n, "'"));
303
- if (!o.as)
304
- throw new Error("'as' property required for '".concat(n, "'"));
305
- return "".concat(n, " with ").concat(o.with, " as ").concat(o.as);
306
- });
307
- }).join(",");
308
- }
309
- function vt(t) {
310
- if (!t.properties)
311
- throw new Error("'properties' property required for groupBy");
312
- var e = "(".concat(t.properties.join(","), ")");
313
- return t.transform && (e += ",".concat(Q(t.transform))), e;
314
- }
315
- function B(t, e) {
316
- return e === void 0 && (e = ""), Array.isArray(t) ? t.map(function(r) {
317
- return Array.isArray(r) && r.length === 2 && ["asc", "desc"].indexOf(r[1]) !== -1 ? r.join(" ") : r;
318
- }).map(function(r) {
319
- return "".concat(e).concat(String(r));
320
- }).join(",") : typeof t == "object" ? Object.entries(t).map(function(r) {
321
- var n = r[0], o = r[1];
322
- return B(o, "".concat(n, "/"));
323
- }).map(function(r) {
324
- return "".concat(e).concat(r);
325
- }).join(",") : "".concat(e).concat(String(t));
326
- }
327
- function bt(t, e) {
328
- var r = Object.getOwnPropertyNames(e).filter(function(n) {
329
- return e[n] !== void 0 && e[n] !== "";
330
- }).map(function(n) {
331
- return "".concat(n, "=").concat(e[n]);
332
- });
333
- return r.length ? "".concat(t, "?").concat(r.join("&")) : t;
334
- }
335
- function H(t) {
336
- return "not (".concat(t.join(" and "), ")");
337
- }
338
- const _t = (t, e) => J(`getAllFarmOrgEntities/${t}/${e}`), Rt = (t, e) => J(`ModuleDependedEntities/${t}/${e}`), Ct = (t, e) => x(`${t}`, {}, e), J = (t) => {
339
- const e = X.getState().environment, r = A.getState().organizationId;
340
- return x(
341
- `${e?.MODULE_AUTH_API}${e?.API_PREFIX}/${r}/${t}`,
342
- {}
343
- );
344
- }, Pt = (t) => {
345
- const e = X.getState().environment;
346
- return x(`${e?.COMMON_API}${e?.API_PREFIX}/${t}`, {});
347
- }, x = (t, e, r) => {
348
- const n = r ?? A.getState().modulePermissionToken, o = A.getState().organizationId, c = A.getState().currentLanguageId, u = A.getState().throwError;
349
- if (!n)
350
- return u?.("No token found", 404), Promise.reject();
351
- const p = jt(n, o, c), h = N(e) ? "" : St(e);
352
- return V(`${t}${h}`, p);
353
- }, jt = (t, e, r, n = "GET") => {
354
- const o = new Headers();
355
- return o.append("Content-Type", "application/json"), o.append("Api-Version", "1.0"), e && o.append("orgId", e), r && o.append("languageId", r), o.append("Authorization", `Bearer ${t}`), {
356
- redirect: "follow",
357
- credentials: "omit",
358
- method: n,
359
- headers: o
360
- };
361
- }, V = async (t, e, r = at, n = !0) => {
362
- const o = A.getState().throwError;
363
- let c = Promise.resolve();
364
- try {
365
- c = await fetch(t, e);
366
- } catch {
367
- o?.("Network error", 500);
368
- }
369
- if (At(c, t, e, r), c?.status === 401)
370
- return o?.("Unauthorized", 401), k(c);
371
- if (!n)
372
- return k(c);
373
- const u = Object.values(ct);
374
- return r > 0 && u.includes(c?.status) ? V(t, e, r - 1) : wt(c);
375
- }, k = async (t) => {
376
- const e = await t.text();
377
- let r;
378
- try {
379
- r = JSON.parse(e);
380
- } catch {
381
- r = {
382
- value: e
383
- };
384
- }
385
- return r;
386
- }, At = async (t, e, r, n) => {
387
- const o = t.clone(), c = A.getState().logEvent, u = A.getState().logError;
388
- try {
389
- t.ok && c ? c({
390
- name: `request: ${o?.status.toString()} - ${e}`,
391
- properties: {
392
- try: n,
393
- requestUrl: e,
394
- requestHeaders: { ...r.headers, Authorization: void 0 },
395
- requestMethod: r.method,
396
- requestBody: L(r, "body"),
397
- responseStatus: o?.status.toString(),
398
- responseStatusText: o?.statusText,
399
- responseBody: await k(o)
400
- }
401
- }) : u?.({
402
- exception: {
403
- name: `request: ${o?.status.toString()} - ${e}`,
404
- message: o?.statusText
405
- },
406
- properties: {
407
- requestUrl: e,
408
- requestHeaders: { ...r.headers, Authorization: void 0 },
409
- requestMethod: r.method,
410
- requestBody: L(r, "body"),
411
- responseStatus: o?.status.toString(),
412
- responseStatusText: o?.statusText,
413
- responseBody: await k(o)
414
- }
415
- });
416
- } catch {
417
- console.error("Error while tracking event or exception in AppInsights");
418
- }
419
- }, wt = async (t) => {
420
- const e = A.getState().throwError;
421
- if (t.ok)
422
- return k(t);
423
- const r = {
424
- detail: t.statusText,
425
- status: t.status,
426
- stack: void 0,
427
- title: "BaseError"
428
- };
429
- try {
430
- const n = await t.json();
431
- N(n) || (r.title = n.title ?? "UnexpectedError", r.stack = n.message ?? n.title ?? t.statusText, r.detail = n.detail);
432
- } catch {
433
- r.detail = t.statusText;
434
- }
435
- throw e?.(r.detail, r.status);
436
- }, St = (t, e = !0) => {
437
- const r = e ? "api-version=1.0" : "", n = e ? "?" : "", o = e ? "&" : "";
438
- if (!t) return `${n}${r}`;
439
- const {
440
- filter: c = [],
441
- orderBy: u = [],
442
- select: p,
443
- top: h,
444
- skip: m,
445
- expand: f = [],
446
- count: d = !0,
447
- overwrite: a = ""
448
- // last resort for uncommon query string
449
- } = t;
450
- if (a)
451
- return a;
452
- {
453
- const s = gt({
454
- expand: f,
455
- filter: c,
456
- orderBy: u,
457
- select: p,
458
- top: h,
459
- skip: m,
460
- count: d
461
- });
462
- return N(s) ? `${n}${r}` : `${s}${o}${r}`;
463
- }
464
- };
465
- export {
466
- _t as a,
467
- L as b,
468
- J as c,
469
- Ct as d,
470
- x as e,
471
- Pt as f,
472
- Rt as g,
473
- jt as h,
474
- V as i,
475
- wt as j,
476
- St as k
477
- };
@@ -1,6 +0,0 @@
1
- import { UseQueryResult } from '@tanstack/react-query';
2
- export declare const useCustom: <T>({ endpoint, queryKey, token, }: {
3
- endpoint: string;
4
- queryKey: (string | undefined)[];
5
- token?: string;
6
- }) => UseQueryResult<T[], Error>;
@@ -1,5 +0,0 @@
1
- /**
2
- *
3
- * @returns A function to navigate to a specific path
4
- */
5
- export declare const useNavigate: () => (path: string) => void;
@@ -1,27 +0,0 @@
1
- import { useEffect as o, useCallback as s } from "react";
2
- import { u as v } from "../chunk-IR6S3I6Y-BvQXS3A3.js";
3
- import { useBasePropsStore as r } from "../stores/BasePropsStore.js";
4
- const m = () => {
5
- const e = r(
6
- (t) => t.currentNavigationPath
7
- ), a = r(
8
- (t) => t.navigateTo
9
- ), i = r(
10
- (t) => t.navigateInHortiview
11
- ), n = v();
12
- return o(() => {
13
- e && n(e, { replace: !0 });
14
- }, [e, n]), s(
15
- (t) => {
16
- if (i) {
17
- i(t);
18
- return;
19
- }
20
- a && a(t);
21
- },
22
- [i, a]
23
- );
24
- };
25
- export {
26
- m as useNavigate
27
- };
@@ -1,29 +0,0 @@
1
- export declare const useBaseProps: () => Pick<import('../types/Deprecated').DeprecatedBaseProps & {
2
- modulePermissionToken?: string;
3
- moduleId?: string;
4
- organizationId?: string;
5
- basePath?: string;
6
- currentNavigationPath?: string;
7
- sourcePath?: string | null;
8
- currentLanguage?: string;
9
- currentLanguageId?: string;
10
- alertRules?: string;
11
- commonOptions?: import('../types/CommonOptions').AllDropdownsData<import('../types/CommonOptions').CommonOption>["items"];
12
- navigateInHortiview?: (path: string) => void;
13
- addBreadcrumbTranslation?: (translation: {
14
- key: string;
15
- value: string;
16
- }) => void;
17
- showSnackbar?: (message: string, icon?: string) => void;
18
- showMessage?: (message: import('../types/SystemMessage').SystemMessage) => void;
19
- logEvent?: (event: import('../types/AppInsights').AppInsightsEvent, customProperties?: import('../types/AppInsights').AppInsightsProperties) => void;
20
- logError?: (exception: import('../types/AppInsights').AppInsightsException) => void;
21
- throwError?: (message: string, code: number) => void;
22
- } & {
23
- setBaseProps: (props: import('../main').BaseProps) => void;
24
- }, keyof import('../types/Deprecated').DeprecatedBaseProps | "modulePermissionToken" | "moduleId" | "organizationId" | "basePath" | "currentNavigationPath" | "sourcePath" | "currentLanguage" | "currentLanguageId" | "alertRules" | "commonOptions" | "navigateInHortiview" | "addBreadcrumbTranslation" | "showSnackbar" | "showMessage" | "logEvent" | "logError" | "throwError">;
25
- export declare const useConfig: () => Pick<{
26
- environment?: import('../types/Environment').HortiViewEnvironments;
27
- setEnvironment: (environment: import('../types/Environment').HortiViewEnvironments) => void;
28
- addEnvironment: (customEnv: import('../types/Environment').CustomEnv) => void;
29
- }, "environment">;
package/dist/main.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export { ModuleBase } from './components/ModuleBase';
2
- export type { BaseProps } from './types/BaseProps';
3
- export { useBreadcrumbTranslation } from './hooks/useBreadcrumbTranslation';
4
- export { useNavigate } from './hooks/useNavigate';
5
- export { useSignalRMessages } from './hooks/useSignalRMessages';
6
- export { useBaseProps, useConfig } from './hooks/useStores';
7
- export { useCustom } from './hooks/useCustom';
8
- export { useEntity } from './hooks/useEntity';
9
- export { useOption } from './hooks/useOption';
@@ -1,80 +0,0 @@
1
- export type RegisterOption = {
2
- moduleId: string;
3
- registeredEntityName: string;
4
- id: string;
5
- };
6
- export interface ModuleEntity {
7
- season: Season | undefined;
8
- blockPlantLayout: BlockPlantLayout | undefined;
9
- }
10
- /**
11
- * the basic interface for the module apis farm organization entities
12
- */
13
- export interface FarmOrgEntity {
14
- block: Block | undefined;
15
- farm: Farm | undefined;
16
- field: Field | undefined;
17
- farmOrg: {
18
- id: string;
19
- } | undefined;
20
- irrigationStation: {
21
- id: string;
22
- } | undefined;
23
- farmAlertRule: {
24
- id: string;
25
- } | undefined;
26
- id: string;
27
- }
28
- export type Block = {
29
- id: string;
30
- fieldId: string;
31
- blockName?: string;
32
- shortName?: string;
33
- area?: number;
34
- fieldPercentage?: number;
35
- tagID?: string;
36
- description?: string;
37
- length?: number;
38
- width?: number;
39
- rows?: number;
40
- /** Stringyfied Position, only used in BE */
41
- location?: string;
42
- /**Position will be transformed from the Location string, only internally used*/
43
- position?: {
44
- row: number;
45
- column: number;
46
- };
47
- };
48
- /**
49
- * farm dto (only necessary fields - for now)
50
- */
51
- export interface Farm {
52
- id: string;
53
- farmName: string;
54
- description: string;
55
- fields: Field[];
56
- }
57
- export interface Field {
58
- id: string;
59
- name: string;
60
- description: string;
61
- farmId: string;
62
- fieldCoverageId: string;
63
- blocks: Block[];
64
- }
65
- export interface Season {
66
- id: string;
67
- cropSeasonName: string;
68
- startDate: Date;
69
- plantingDate: Date | null;
70
- cropId: string;
71
- cropTypeId: string;
72
- cropVarietyId: string;
73
- rootstockId: string;
74
- farmId: string;
75
- fieldId: string;
76
- seasonStateId?: string;
77
- }
78
- export interface BlockPlantLayout {
79
- id: string;
80
- }
File without changes
File without changes
File without changes
File without changes