@hortiview/modulebase 0.0.20436 → 0.0.20524
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/README.md +3 -2
- package/dist/IsRestoringProvider-CBSZo7ur.js +312 -0
- package/dist/ModuleCore-DuJVrj6v.js +11828 -0
- package/dist/QueryClientProvider-DyiNrPkn.js +514 -0
- package/dist/_commonjsHelpers-ByX85dGu.js +33 -0
- package/dist/api-COabZnyn.js +147 -0
- package/dist/assets/ModuleCore.css +1 -1
- package/dist/chunk-LFPYN7LY-D1ls8FXf.js +8643 -0
- package/dist/components/ModuleBase.js +9 -9
- package/dist/components/ModuleCore.js +1 -1
- package/dist/constants.js +2 -3
- package/dist/hooks/useCustom.js +1 -1
- package/dist/hooks/useCustomMutation.js +5 -5
- package/dist/hooks/useEntity.js +30 -30
- package/dist/hooks/useOffline.js +1 -1
- package/dist/hooks/useOption.js +5 -5
- package/dist/hooks/useServiceBus.js +1 -1
- package/dist/hooks/useStores.js +1 -1
- package/dist/{_baseGet-C6jMXSsQ.js → isTypedArray-SkhznY1k.js} +494 -494
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/hooks/useCustom.d.ts +4 -2
- package/dist/lib/hooks/useCustomMutation.d.ts +8 -3
- package/dist/lib/hooks/useEntity.d.ts +6 -0
- package/dist/lib/types/Requests.d.ts +0 -17
- package/dist/lib/utils/api.d.ts +6 -13
- package/dist/lib/utils/baseFetches.d.ts +3 -2
- package/dist/main.js +188 -173
- package/dist/module-router.js +2322 -121
- package/dist/{mutation-DSKlaYzY.js → mutation-CmhiEgfA.js} +101 -56
- package/dist/{omit-C9Qe80rl.js → omit-Do6MFRwA.js} +240 -223
- package/dist/provider/SignalR/SignalRProvider.js +2389 -2824
- package/dist/react-c9FSfB30.js +27 -0
- package/dist/stores/BasePropsStore.js +1 -1
- package/dist/stores/EnvironmentStore.js +1 -1
- package/dist/useMutation-Aoachkw_.js +139 -0
- package/dist/useQuery-DEU_AUtf.js +392 -0
- package/dist/utils/api.js +3 -4
- package/dist/utils/baseFetches.js +18 -14
- package/dist/utils/fetches.js +3 -4
- package/dist/utils/helper.js +14 -14
- package/package.json +16 -13
- package/dist/ModuleCore-DpwHP0IU.js +0 -14973
- package/dist/QueryClientProvider-Beog9TR7.js +0 -437
- package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/api-CogBuK0n.js +0 -473
- package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +0 -8162
- package/dist/isRestoring-CLuxJVSA.js +0 -281
- package/dist/react-QiIgv49H.js +0 -27
- package/dist/useMutation-zu8uxBak.js +0 -97
- package/dist/useQuery-Bj9k9zik.js +0 -395
- package/dist/utils-DxRR_XLb.js +0 -9
package/dist/api-CogBuK0n.js
DELETED
|
@@ -1,473 +0,0 @@
|
|
|
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]", m = "[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 l = e(s);
|
|
16
|
-
if (l == h || l == m)
|
|
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"], $ = ["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 g = "";
|
|
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, m = e.transform, f = e.orderBy, d = e.key, a = e.count, s = e.expand, l = e.action, y = e.func, b = "", w = [], i = {};
|
|
75
|
-
if (d != null && (b += "(".concat(E(d, w), ")")), (h || typeof a == "object") && (i.$filter = q(typeof a == "object" ? a : h, w)), m && (i.$apply = X(m)), s && (i.$expand = k(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), l && (b += "/".concat(l)), y) {
|
|
76
|
-
if (typeof y == "string")
|
|
77
|
-
b += "/".concat(y);
|
|
78
|
-
else if (typeof y == "object") {
|
|
79
|
-
var O = Object.keys(y)[0], v = E(y[O], w);
|
|
80
|
-
b += "/".concat(O), v !== "" && (b += "(".concat(v, ")"));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return w.length > 0 && Object.assign(i, w.reduce(function(_, S) {
|
|
84
|
-
var j;
|
|
85
|
-
return Object.assign(_, (j = {}, j["@".concat(S.name)] = E(S.value), j));
|
|
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 q(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 m = 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 === g ? s = p : G.test(d) ? s = d.replace(G, function(i, O) {
|
|
111
|
-
return O.trim() === g ? "(".concat(p, ")") : "(".concat(p, "/").concat(O.trim(), ")");
|
|
112
|
-
}) : L.test(d) ? s = d.replace(L, function(i, O) {
|
|
113
|
-
return O.trim() === g ? "(".concat(p, ")") : "(".concat(p, "/").concat(O.trim(), ")");
|
|
114
|
-
}) : s = "".concat(p, "/").concat(d) : s = d, d === g && 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 l = d, y = a.map(function(i) {
|
|
122
|
-
return q(i, u, p);
|
|
123
|
-
}).filter(function(i) {
|
|
124
|
-
return i;
|
|
125
|
-
}).map(function(i) {
|
|
126
|
-
return $.indexOf(l) !== -1 ? "(".concat(i, ")") : i;
|
|
127
|
-
});
|
|
128
|
-
y.length && ($.indexOf(l) !== -1 ? y.length && (l === "not" ? f.push(z(y)) : f.push("(".concat(y.join(" ".concat(l, " ")), ")"))) : f.push(y.join(" ".concat(l, " "))));
|
|
129
|
-
} else if ($.indexOf(s) !== -1) {
|
|
130
|
-
var b = s, y = Object.keys(a).map(function(O) {
|
|
131
|
-
var v;
|
|
132
|
-
return n((v = {}, v[O] = a[O], 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 O;
|
|
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 ($.indexOf(i) !== -1)
|
|
146
|
-
Array.isArray(a[i]) ? f.push(a[i].map(function(j) {
|
|
147
|
-
return "(" + n(j, 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(j) {
|
|
156
|
-
return {
|
|
157
|
-
type: a[i].type,
|
|
158
|
-
value: j
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
f.push(s + " in (" + _.map(function(j) {
|
|
162
|
-
return E(j, 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((O = {}, O[i] = a[i], O), 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 = m.join(" and ");
|
|
177
|
-
}
|
|
178
|
-
return h;
|
|
179
|
-
}
|
|
180
|
-
function o(c, u, p, h) {
|
|
181
|
-
var m = "";
|
|
182
|
-
if (typeof u == "string" || u instanceof String)
|
|
183
|
-
m = ht(c, u, p, h);
|
|
184
|
-
else if (u) {
|
|
185
|
-
var f = Array.isArray(u) ? u.reduce(function(a, s) {
|
|
186
|
-
return s.hasOwnProperty(g) ? (a.hasOwnProperty(g) || (a[g] = []), a[g].push(s[g]), a) : T(T({}, a), s);
|
|
187
|
-
}, {}) : u, d = n(f, e, c);
|
|
188
|
-
m = "".concat(h, "/").concat(p, "(").concat(d ? "".concat(c, ":").concat(d) : "", ")");
|
|
189
|
-
}
|
|
190
|
-
return m;
|
|
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 mt(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(mt(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 k(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 k(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 = q(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 = k(t[r]);
|
|
271
|
-
}
|
|
272
|
-
return "$".concat(r.toLowerCase(), "=").concat(n);
|
|
273
|
-
}).join(";") : e.map(function(r) {
|
|
274
|
-
var n = k(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"]), m = Object.keys(h);
|
|
283
|
-
if (m.length)
|
|
284
|
-
throw new Error("Unsupported transform(s): ".concat(m));
|
|
285
|
-
if (c && n.push("aggregate(".concat(Ot(c), ")")), u) {
|
|
286
|
-
var f = q(u);
|
|
287
|
-
f && n.push("filter(".concat(q(f), ")"));
|
|
288
|
-
}
|
|
289
|
-
return p && n.push("groupby(".concat(lt(p), ")")), n;
|
|
290
|
-
}, []);
|
|
291
|
-
return r.join("/") || void 0;
|
|
292
|
-
}
|
|
293
|
-
function Ot(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 lt(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 && c.append("Authorization", `Bearer ${t}`), 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 - 1, 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) : jt(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
|
-
}, jt = 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
|
-
}, qt = (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: m,
|
|
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: m,
|
|
461
|
-
count: d
|
|
462
|
-
});
|
|
463
|
-
return H(s) ? `${n}${r}` : `${s}${o}${r}`;
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
export {
|
|
467
|
-
Tt as a,
|
|
468
|
-
qt as b,
|
|
469
|
-
F as f,
|
|
470
|
-
U as g,
|
|
471
|
-
jt as h,
|
|
472
|
-
H as i
|
|
473
|
-
};
|