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