szdl-utils-kit 0.2.28 → 0.2.29
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 +168 -162
- package/dist/index.js +122 -122
- package/dist/index.umd.cjs +2 -2
- package/dist/types/batch.d.ts +71 -71
- package/dist/types/bx-boot.d.ts +176 -176
- package/dist/types/bx-helper.d.ts +27 -27
- package/dist/types/bx-logger.d.ts +43 -43
- package/dist/types/index.d.ts +14 -14
- package/package.json +41 -41
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var C = (T, e, A) => (de(T, typeof e != "symbol" ? e + "" : e, A), A), Kt = (T,
|
|
|
4
4
|
if (!e.has(T))
|
|
5
5
|
throw TypeError("Cannot " + A);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var o = (T, e, A) => (Kt(T, e, "read from private field"), A ? A.call(T) : e.get(T)), O = (T, e, A) => {
|
|
8
8
|
if (e.has(T))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(T) : e.set(T, A);
|
|
@@ -28,7 +28,7 @@ var vt = { exports: {} };
|
|
|
28
28
|
for (var l = t.toString(); l.length < s; )
|
|
29
29
|
l = "0" + l;
|
|
30
30
|
return l;
|
|
31
|
-
},
|
|
31
|
+
}, h = function(t, s) {
|
|
32
32
|
return s !== A ? (t.year(s.year() || s.year), t.month(s.month() || s.month), t.day(s.day() || s.day), t.hours(s.hours() || s.hours), t.minutes(s.minutes() || s.minutes), t.seconds(s.seconds() || s.seconds), t.milliseconds(s.milliseconds() || s.milliseconds), t) : A;
|
|
33
33
|
}, a = function(t, s) {
|
|
34
34
|
var l, m = "";
|
|
@@ -522,7 +522,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
522
522
|
if (typeof t == "object" && (t instanceof Array ? (this.day(i.MIN_DAY), this.year(t[0]), this.month(t[1]), this.day(t[2]), this.hours(t[3]), this.minutes(t[4]), this.seconds(t[5]), this.milliseconds(t[6])) : (this.day(i.MIN_DAY), this.year(t.year), this.month(t.month), this.day(t.day), this.hours(t.hours), this.minutes(t.minutes), this.seconds(t.seconds), this.milliseconds(t.milliseconds))), typeof t == "string") {
|
|
523
523
|
var m, p = [], E, S, P = [], H = 0, w = 0, L, j, D = {}, I;
|
|
524
524
|
if (t === A)
|
|
525
|
-
return E =
|
|
525
|
+
return E = h(this, l), E === A && (this._i = {
|
|
526
526
|
year: -1,
|
|
527
527
|
month: -1,
|
|
528
528
|
day: -1,
|
|
@@ -549,7 +549,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
551
|
if (L < B[S].minLength)
|
|
552
|
-
return E =
|
|
552
|
+
return E = h(this, l), E === A && (this._i = {
|
|
553
553
|
year: -1,
|
|
554
554
|
month: -1,
|
|
555
555
|
day: -1,
|
|
@@ -561,7 +561,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
561
561
|
p.push(S), P.push(j), L -= 1, w += L, H += 1;
|
|
562
562
|
}
|
|
563
563
|
} else if (t.charAt(w) !== s.charAt(H))
|
|
564
|
-
return E =
|
|
564
|
+
return E = h(this, l), E === A && (this._i = {
|
|
565
565
|
year: -1,
|
|
566
566
|
month: -1,
|
|
567
567
|
day: -1,
|
|
@@ -856,10 +856,10 @@ class z {
|
|
|
856
856
|
g(this, v, e), g(this, dt, A);
|
|
857
857
|
}
|
|
858
858
|
get serial() {
|
|
859
|
-
return
|
|
859
|
+
return o(this, k);
|
|
860
860
|
}
|
|
861
861
|
get limitCommandSerial() {
|
|
862
|
-
return
|
|
862
|
+
return o(this, Z);
|
|
863
863
|
}
|
|
864
864
|
set limitCommandSerial(e) {
|
|
865
865
|
if (e < 10)
|
|
@@ -876,19 +876,19 @@ class z {
|
|
|
876
876
|
g(this, $, !1);
|
|
877
877
|
}
|
|
878
878
|
async batch(e, A) {
|
|
879
|
-
|
|
879
|
+
o(this, K) && _(this, mt, Bt).call(this), A && g(this, tt, A), o(this, et) === !1 && g(this, k, !1), Object.keys(e).length > o(this, Z) && g(this, k, !0), g(this, $, !0), g(this, q, []), g(this, U, {}), this.errors = {}, this.answerData = {};
|
|
880
880
|
const n = _(this, ut, Ut).call(this, e);
|
|
881
|
-
if (Object.keys(e).length <
|
|
882
|
-
const r = n.map((
|
|
883
|
-
return Promise.allSettled(r).then((
|
|
881
|
+
if (Object.keys(e).length < o(this, Z)) {
|
|
882
|
+
const r = n.map((h, a) => _(this, Et, $t).call(this, h, n[a]));
|
|
883
|
+
return Promise.allSettled(r).then((h) => {
|
|
884
884
|
let a = {};
|
|
885
|
-
for (let f of
|
|
885
|
+
for (let f of h)
|
|
886
886
|
f.status === "fulfilled" && (a = { ...a, ...f.value });
|
|
887
887
|
return a;
|
|
888
888
|
});
|
|
889
889
|
} else {
|
|
890
|
-
let r = {},
|
|
891
|
-
|
|
890
|
+
let r = {}, h = 0, a = 1, f = Object.keys(e).length || 1, c = (i) => {
|
|
891
|
+
h += Object.keys(i).length, a = Math.round(h / f * 100);
|
|
892
892
|
};
|
|
893
893
|
for (let [i, d] of Object.entries(n)) {
|
|
894
894
|
let y = await _(this, Et, $t).call(this, d, n[i], !0);
|
|
@@ -899,18 +899,18 @@ class z {
|
|
|
899
899
|
}
|
|
900
900
|
/* батч для обработки operating time и паузы, используя BX24.callMethod('batch', ...) - пока что для некоторых методов update */
|
|
901
901
|
async batchUpdateField(e, A) {
|
|
902
|
-
|
|
902
|
+
o(this, K) && _(this, mt, Bt).call(this), A && g(this, tt, A), o(this, et) === !1 && g(this, k, !1), Object.keys(e).length > o(this, Z) && g(this, k, !0), g(this, $, !0), g(this, q, []), g(this, U, {}), this.errors = {}, this.answerData = {};
|
|
903
903
|
const n = _(this, ut, Ut).call(this, e);
|
|
904
|
-
if (Object.keys(e).length <
|
|
904
|
+
if (Object.keys(e).length < o(this, Z)) {
|
|
905
905
|
let r = {};
|
|
906
|
-
for (let [
|
|
907
|
-
let f = await _(this, Tt, te).call(this, a, n[
|
|
906
|
+
for (let [h, a] of Object.entries(n)) {
|
|
907
|
+
let f = await _(this, Tt, te).call(this, a, n[h]);
|
|
908
908
|
r = { ...r, ...f };
|
|
909
909
|
}
|
|
910
910
|
return r;
|
|
911
911
|
} else {
|
|
912
|
-
let r = {},
|
|
913
|
-
|
|
912
|
+
let r = {}, h = 0, a = 1, f = Object.keys(e).length || 1, c = (i) => {
|
|
913
|
+
h += Object.keys(i).length, a = Math.round(h / f * 100);
|
|
914
914
|
};
|
|
915
915
|
for (let [i, d] of Object.entries(n)) {
|
|
916
916
|
let y = await _(this, Tt, te).call(this, d, n[i], !0);
|
|
@@ -921,12 +921,12 @@ class z {
|
|
|
921
921
|
}
|
|
922
922
|
async batchTotalCount(e, A) {
|
|
923
923
|
g(this, U, {}), this.errors = {};
|
|
924
|
-
let n = 1, r = 0,
|
|
925
|
-
r += Object.keys(c).length, n = Math.round(r /
|
|
924
|
+
let n = 1, r = 0, h = Object.keys(e).length || 1, a = (c) => {
|
|
925
|
+
r += Object.keys(c).length, n = Math.round(r / h * 100);
|
|
926
926
|
};
|
|
927
927
|
A && A({ percent: n });
|
|
928
928
|
const f = _(this, ut, Ut).call(this, e);
|
|
929
|
-
if (
|
|
929
|
+
if (o(this, at)) {
|
|
930
930
|
const c = f.map((i) => _(this, Rt, ee).call(this, i).then((d) => (a(i), A && A({ percent: n }), d)));
|
|
931
931
|
return Promise.allSettled(c).then((i) => {
|
|
932
932
|
let d = {};
|
|
@@ -946,39 +946,39 @@ class z {
|
|
|
946
946
|
}
|
|
947
947
|
v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), F = new WeakMap(), K = new WeakMap(), Ft = new WeakMap(), nt = new WeakMap(), k = new WeakMap(), et = new WeakMap(), at = new WeakMap(), ct = new WeakSet(), It = function() {
|
|
948
948
|
let e = 0;
|
|
949
|
-
if (!
|
|
949
|
+
if (!o(this, F))
|
|
950
950
|
return Math.round(e);
|
|
951
951
|
let A = 0, n = 0;
|
|
952
|
-
return Object.values(
|
|
953
|
-
const { total:
|
|
954
|
-
A +=
|
|
952
|
+
return Object.values(o(this, F)).forEach((r) => {
|
|
953
|
+
const { total: h, count: a } = r;
|
|
954
|
+
A += h ?? 0, n += a ?? 0;
|
|
955
955
|
}), A ? e = n / A * 100 : e = 100, { percent: Math.round(e), allCount: n, allTotal: A };
|
|
956
956
|
}, mt = new WeakSet(), Bt = function() {
|
|
957
|
-
clearInterval(
|
|
957
|
+
clearInterval(o(this, K)), g(this, K, ""), g(this, F, ""), g(this, tt, ""), g(this, nt, "no");
|
|
958
958
|
}, gt = new WeakSet(), qt = function({ key: e, value: A }) {
|
|
959
|
-
const n = _(this, ot, yt).call(this, A.data()), r = Array.isArray(n) ? n.length : 0,
|
|
959
|
+
const n = _(this, ot, yt).call(this, A.data()), r = Array.isArray(n) ? n.length : 0, h = _(this, Nt, Gt).call(this, A.total(), r);
|
|
960
960
|
let a = 1;
|
|
961
|
-
n && (a = r),
|
|
962
|
-
const { percent: f, allCount: c, allTotal: i } =
|
|
963
|
-
(
|
|
964
|
-
data:
|
|
961
|
+
n && (a = r), o(this, tt) && (o(this, F) || g(this, F, {}), o(this, F)[e] && o(this, F)[e].count && (a += o(this, F)[e].count), o(this, F)[e] = { total: h, count: a }, o(this, K) || g(this, K, setInterval(() => {
|
|
962
|
+
const { percent: f, allCount: c, allTotal: i } = o(this, ct, It);
|
|
963
|
+
(o(this, nt) === "no" || o(this, nt) < o(this, ct, It).percent) && (o(this, tt).call(this, {
|
|
964
|
+
data: o(this, F),
|
|
965
965
|
percent: f,
|
|
966
966
|
allCount: c,
|
|
967
967
|
allTotal: i
|
|
968
|
-
}), g(this, nt,
|
|
969
|
-
},
|
|
968
|
+
}), g(this, nt, o(this, ct, It).percent)), f === 100 && _(this, mt, Bt).call(this);
|
|
969
|
+
}, o(this, Ft))));
|
|
970
970
|
}, ut = new WeakSet(), Ut = function(e) {
|
|
971
971
|
const A = [], n = Object.entries(e);
|
|
972
|
-
for (let r = 0; r < n.length; r +=
|
|
973
|
-
const
|
|
974
|
-
A.push(Object.fromEntries(
|
|
972
|
+
for (let r = 0; r < n.length; r += o(this, Q)) {
|
|
973
|
+
const h = n.slice(r, r + o(this, Q));
|
|
974
|
+
A.push(Object.fromEntries(h));
|
|
975
975
|
}
|
|
976
976
|
return A;
|
|
977
977
|
}, Et = new WeakSet(), $t = function(e, A, n) {
|
|
978
978
|
return new Promise((r) => {
|
|
979
|
-
const
|
|
979
|
+
const h = _(this, Lt, re).call(this, A), a = [];
|
|
980
980
|
let f = 0, c = 0;
|
|
981
|
-
|
|
981
|
+
o(this, v).call(this, e, (i) => {
|
|
982
982
|
Object.entries(i).forEach(([d, y]) => {
|
|
983
983
|
let u = {};
|
|
984
984
|
const N = y.error();
|
|
@@ -992,18 +992,18 @@ v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q =
|
|
|
992
992
|
Object.keys(u).length && (this.answerData[d] = u);
|
|
993
993
|
}
|
|
994
994
|
const Y = _(this, ot, yt).call(this, y.data()), W = Array.isArray(Y) ? Y.length : 0, G = _(this, Nt, Gt).call(this, y.total(), W);
|
|
995
|
-
if (Array.isArray(Y) ?
|
|
996
|
-
const b = Math.ceil(G /
|
|
997
|
-
a.push([d,
|
|
995
|
+
if (Array.isArray(Y) ? o(this, U)[d] = Y : typeof Y == "object" && Y !== null && Object.keys(Y).length === 0 ? o(this, U)[d] = [] : o(this, U)[d] = Y, c += G, n || _(this, gt, qt).call(this, { key: d, value: y }), G > o(this, Q) && G > W) {
|
|
996
|
+
const b = Math.ceil(G / o(this, Q)) - 1, M = Array.from({ length: b });
|
|
997
|
+
a.push([d, h[d], M]);
|
|
998
998
|
}
|
|
999
|
-
}), c > 5e3 &&
|
|
999
|
+
}), c > 5e3 && o(this, et) === !1 && o(this, at) === !1 && g(this, k, !0), f > 0 && _(this, Ot, Ct).call(this), a.length ? (_(this, kt, ae).call(this, a), _(this, Pt, oe).call(this).then(() => r(_(this, ft, wt).call(this)))) : r(_(this, ft, wt).call(this));
|
|
1000
1000
|
});
|
|
1001
1001
|
});
|
|
1002
1002
|
}, Tt = new WeakSet(), te = function(e, A, n) {
|
|
1003
1003
|
let r = _(this, Jt, le).call(this, e);
|
|
1004
|
-
return new Promise((
|
|
1004
|
+
return new Promise((h) => {
|
|
1005
1005
|
let a = 0;
|
|
1006
|
-
|
|
1006
|
+
o(this, v).call(this, "batch", r, (f) => {
|
|
1007
1007
|
var y, u, N, Y, W, G;
|
|
1008
1008
|
let c = ((u = (y = f == null ? void 0 : f.answer) == null ? void 0 : y.result) == null ? void 0 : u.result) ?? null, i = ((Y = (N = f == null ? void 0 : f.answer) == null ? void 0 : N.result) == null ? void 0 : Y.result_error) ?? null, d = ((G = (W = f == null ? void 0 : f.answer) == null ? void 0 : W.result) == null ? void 0 : G.result_time) ?? null;
|
|
1009
1009
|
(c || Object.keys(c).length) && Object.entries(c).forEach(([b, M]) => {
|
|
@@ -1018,43 +1018,43 @@ v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q =
|
|
|
1018
1018
|
}, a += 1;
|
|
1019
1019
|
}), (d || Object.keys(d).length) && Object.entries(d).forEach(([b, M]) => {
|
|
1020
1020
|
((M == null ? void 0 : M.operating) ?? 0) >= 475 && (this.timeLimit = !0);
|
|
1021
|
-
}), a > 0 && _(this, Ot, Ct).call(this),
|
|
1021
|
+
}), a > 0 && _(this, Ot, Ct).call(this), h(this.answerData);
|
|
1022
1022
|
});
|
|
1023
1023
|
});
|
|
1024
1024
|
}, Rt = new WeakSet(), ee = function(e) {
|
|
1025
1025
|
return new Promise((A) => {
|
|
1026
1026
|
const n = _(this, Lt, re).call(this, e);
|
|
1027
1027
|
let r = 0;
|
|
1028
|
-
|
|
1029
|
-
Object.entries(
|
|
1028
|
+
o(this, v).call(this, n, (h) => {
|
|
1029
|
+
Object.entries(h).forEach(([a, f]) => {
|
|
1030
1030
|
const c = f.error();
|
|
1031
1031
|
c && (this.errors[a] = c, r += 1);
|
|
1032
1032
|
const i = _(this, ot, yt).call(this, f.data()), d = Array.isArray(i) ? i.length : 0, y = _(this, Nt, Gt).call(this, f.total(), d);
|
|
1033
|
-
|
|
1033
|
+
o(this, U)[a] = y;
|
|
1034
1034
|
}), r > 0 && _(this, Ot, Ct).call(this), A(_(this, ft, wt).call(this));
|
|
1035
1035
|
});
|
|
1036
1036
|
});
|
|
1037
1037
|
}, kt = new WeakSet(), ae = function(e) {
|
|
1038
1038
|
let A = [];
|
|
1039
|
-
e.forEach(([n, r,
|
|
1040
|
-
|
|
1041
|
-
const c = f + 1, i =
|
|
1042
|
-
A.length ===
|
|
1039
|
+
e.forEach(([n, r, h]) => {
|
|
1040
|
+
h.forEach((a, f) => {
|
|
1041
|
+
const c = f + 1, i = o(this, Q) * c, y = [[n, c].join("_"), _(this, Wt, he).call(this, r, i)];
|
|
1042
|
+
A.length === o(this, Q) ? (o(this, q).push(A), A = [y]) : A.push(y);
|
|
1043
1043
|
});
|
|
1044
|
-
}), A.length &&
|
|
1044
|
+
}), A.length && o(this, q).push(A);
|
|
1045
1045
|
}, Pt = new WeakSet(), oe = function() {
|
|
1046
1046
|
const e = [], A = [], n = (r) => {
|
|
1047
|
-
Object.entries(r).forEach(([
|
|
1048
|
-
const [f] =
|
|
1049
|
-
Array.isArray(c) &&
|
|
1047
|
+
Object.entries(r).forEach(([h, a]) => {
|
|
1048
|
+
const [f] = h.split("_"), c = _(this, ot, yt).call(this, a.data());
|
|
1049
|
+
Array.isArray(c) && o(this, U)[f].push(...c), _(this, gt, qt).call(this, { key: f, value: a });
|
|
1050
1050
|
});
|
|
1051
1051
|
};
|
|
1052
|
-
return
|
|
1053
|
-
const a = Object.fromEntries(r), f = () => new Promise((c) =>
|
|
1054
|
-
|
|
1052
|
+
return o(this, q).forEach((r, h) => {
|
|
1053
|
+
const a = Object.fromEntries(r), f = () => new Promise((c) => o(this, v).call(this, a, (i) => {
|
|
1054
|
+
o(this, k) ? n(i) : A[h] = i, c();
|
|
1055
1055
|
}));
|
|
1056
1056
|
e.push(f);
|
|
1057
|
-
}),
|
|
1057
|
+
}), o(this, k) ? _(this, pt, se).call(this, e) : _(this, Mt, ie).call(this, e).then(() => {
|
|
1058
1058
|
A.forEach(n);
|
|
1059
1059
|
});
|
|
1060
1060
|
}, St = new WeakSet(), Ae = function() {
|
|
@@ -1066,24 +1066,24 @@ v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q =
|
|
|
1066
1066
|
return Promise.allSettled([
|
|
1067
1067
|
A(),
|
|
1068
1068
|
_(this, St, Ae).call(this)
|
|
1069
|
-
]).then(() =>
|
|
1069
|
+
]).then(() => o(this, $) ? _(this, pt, se).call(this, e) : Promise.resolve());
|
|
1070
1070
|
}, Mt = new WeakSet(), ie = function(e) {
|
|
1071
1071
|
if (!e.length)
|
|
1072
1072
|
return Promise.resolve();
|
|
1073
1073
|
const A = e.shift();
|
|
1074
|
-
return _(this, St, Ae).call(this).then(() => A()).then(() =>
|
|
1074
|
+
return _(this, St, Ae).call(this).then(() => A()).then(() => o(this, $) ? _(this, Mt, ie).call(this, e) : Promise.resolve());
|
|
1075
1075
|
}, ft = new WeakSet(), wt = function() {
|
|
1076
|
-
return Object.entries(
|
|
1077
|
-
|
|
1078
|
-
}),
|
|
1076
|
+
return Object.entries(o(this, dt)).forEach(([e, A]) => {
|
|
1077
|
+
o(this, U)[e] && (o(this, U)[e] = A(o(this, U)[e]));
|
|
1078
|
+
}), o(this, U);
|
|
1079
1079
|
}, Lt = new WeakSet(), re = function(e) {
|
|
1080
1080
|
return Object.entries(e).reduce((A, [n, r]) => {
|
|
1081
1081
|
if (Array.isArray(r)) {
|
|
1082
|
-
const [
|
|
1083
|
-
A[n] = [
|
|
1082
|
+
const [h, a = {}] = r;
|
|
1083
|
+
A[n] = [h, a];
|
|
1084
1084
|
} else {
|
|
1085
|
-
const { method:
|
|
1086
|
-
A[n] = [
|
|
1085
|
+
const { method: h, params: a = {} } = r;
|
|
1086
|
+
A[n] = [h, a];
|
|
1087
1087
|
}
|
|
1088
1088
|
return A;
|
|
1089
1089
|
}, {});
|
|
@@ -1099,7 +1099,7 @@ v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q =
|
|
|
1099
1099
|
console.info(`[${e}]`, A);
|
|
1100
1100
|
}), console.groupEnd();
|
|
1101
1101
|
}, Jt = new WeakSet(), le = function(e) {
|
|
1102
|
-
var n, r,
|
|
1102
|
+
var n, r, h, a, f, c, i, d, y, u, N, Y, W, G, b, M, X, x, J, it, B, rt, R, t;
|
|
1103
1103
|
let A = {
|
|
1104
1104
|
halt: 0,
|
|
1105
1105
|
cmd: {}
|
|
@@ -1107,7 +1107,7 @@ v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q =
|
|
|
1107
1107
|
for (let s in e) {
|
|
1108
1108
|
const l = s;
|
|
1109
1109
|
let m = (n = e[s]) != null && n.method ? (r = e[s]) == null ? void 0 : r.method : "", p = "", E = "", S = "";
|
|
1110
|
-
const P = (a = (
|
|
1110
|
+
const P = (a = (h = e[s]) == null ? void 0 : h.params) == null ? void 0 : a.fields;
|
|
1111
1111
|
if ((c = (f = e[s]) == null ? void 0 : f.params) != null && c.entityTypeId ? (p = `?entityTypeId=${parseInt((d = (i = e[s]) == null ? void 0 : i.params) == null ? void 0 : d.entityTypeId)}`, (u = (y = e[s]) == null ? void 0 : y.params) != null && u.id && (E = `&id=${(Y = (N = e[s]) == null ? void 0 : N.params) == null ? void 0 : Y.id}`), (G = (W = e[s]) == null ? void 0 : W.params) != null && G.ID && (E = `&ID=${(M = (b = e[s]) == null ? void 0 : b.params) == null ? void 0 : M.ID}`)) : ((x = (X = e[s]) == null ? void 0 : X.params) != null && x.id && (E = `?id=${(it = (J = e[s]) == null ? void 0 : J.params) == null ? void 0 : it.id}`), (rt = (B = e[s]) == null ? void 0 : B.params) != null && rt.ID && (E = `?ID=${(t = (R = e[s]) == null ? void 0 : R.params) == null ? void 0 : t.ID}`)), Object.keys(P).length > 0)
|
|
1112
1112
|
for (let H in P)
|
|
1113
1113
|
S += `&fields[${H}]=${P[H]}`;
|
|
@@ -1133,7 +1133,7 @@ class ce {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
/** Фильтр часто запускаемых действий */
|
|
1135
1135
|
actionFilter({ keyTimer: e, duration: A = 10, action: n }) {
|
|
1136
|
-
|
|
1136
|
+
o(this, ht)[e] && (clearTimeout(o(this, ht)[e]), o(this, ht)[e] = null), n && (o(this, ht)[e] = setTimeout(() => {
|
|
1137
1137
|
n();
|
|
1138
1138
|
}, A));
|
|
1139
1139
|
}
|
|
@@ -1152,9 +1152,9 @@ class ce {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
/** Скачать данные в JSON-файл */
|
|
1154
1154
|
downloadFileJson(e, A) {
|
|
1155
|
-
let n = new Blob([JSON.stringify(e)], { type: "application/json" }), r = URL.createObjectURL(n),
|
|
1156
|
-
|
|
1157
|
-
document.body.removeChild(
|
|
1155
|
+
let n = new Blob([JSON.stringify(e)], { type: "application/json" }), r = URL.createObjectURL(n), h = document.createElement("a");
|
|
1156
|
+
h.style.display = "none", h.href = r, h.download = `${A}.json`, document.body.appendChild(h), h.click(), setTimeout(() => {
|
|
1157
|
+
document.body.removeChild(h), URL.revokeObjectURL(r);
|
|
1158
1158
|
}, 200);
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
@@ -1188,22 +1188,22 @@ class Re {
|
|
|
1188
1188
|
entityList: { method: "entity.get" }
|
|
1189
1189
|
});
|
|
1190
1190
|
if (A && Array.isArray(A))
|
|
1191
|
-
if (A.find((r) => r.ENTITY ==
|
|
1191
|
+
if (A.find((r) => r.ENTITY == o(this, V)))
|
|
1192
1192
|
g(this, At, !0);
|
|
1193
1193
|
else {
|
|
1194
1194
|
let { entityAdd: r } = await e.batch({
|
|
1195
1195
|
entityAdd: {
|
|
1196
1196
|
method: "entity.add",
|
|
1197
1197
|
params: {
|
|
1198
|
-
ENTITY:
|
|
1199
|
-
NAME:
|
|
1198
|
+
ENTITY: o(this, V),
|
|
1199
|
+
NAME: o(this, V),
|
|
1200
1200
|
ACCESS: { AU: "X" }
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
1203
|
});
|
|
1204
1204
|
r && g(this, At, !0);
|
|
1205
1205
|
}
|
|
1206
|
-
return _(this, Qt, fe).call(this),
|
|
1206
|
+
return _(this, Qt, fe).call(this), o(this, At);
|
|
1207
1207
|
}
|
|
1208
1208
|
/**
|
|
1209
1209
|
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
@@ -1215,15 +1215,15 @@ class Re {
|
|
|
1215
1215
|
* @returns {string}
|
|
1216
1216
|
*/
|
|
1217
1217
|
start({ type: e, data: A }) {
|
|
1218
|
-
if (!
|
|
1218
|
+
if (!o(this, At)) {
|
|
1219
1219
|
_(this, Dt, ne).call(this, "entity");
|
|
1220
1220
|
return;
|
|
1221
1221
|
}
|
|
1222
1222
|
const n = Ht.hash;
|
|
1223
|
-
return
|
|
1223
|
+
return o(this, lt).set(n, {
|
|
1224
1224
|
type: e,
|
|
1225
1225
|
data: A,
|
|
1226
|
-
userInfo:
|
|
1226
|
+
userInfo: o(this, bt),
|
|
1227
1227
|
errorList: [],
|
|
1228
1228
|
status: "",
|
|
1229
1229
|
answer: null,
|
|
@@ -1238,17 +1238,17 @@ class Re {
|
|
|
1238
1238
|
* answer: { [key]: unknown } }}
|
|
1239
1239
|
*/
|
|
1240
1240
|
stop({ key: e, errorList: A, status: n, answer: r }) {
|
|
1241
|
-
if (!
|
|
1241
|
+
if (!o(this, At)) {
|
|
1242
1242
|
_(this, Dt, ne).call(this, "entity");
|
|
1243
1243
|
return;
|
|
1244
1244
|
}
|
|
1245
|
-
let
|
|
1246
|
-
A && (
|
|
1245
|
+
let h = o(this, lt).get(e);
|
|
1246
|
+
A && (h.errorList = A), n && (h.status = n), r && (h.answer = r), Ht.actionFilter({
|
|
1247
1247
|
keyTimer: "add.entity.items",
|
|
1248
|
-
duration:
|
|
1248
|
+
duration: o(this, jt),
|
|
1249
1249
|
action: async () => {
|
|
1250
1250
|
var a;
|
|
1251
|
-
await _(this, xt, ue).call(this), (a =
|
|
1251
|
+
await _(this, xt, ue).call(this), (a = h == null ? void 0 : h.data) != null && a.updateList && g(this, _t, !0);
|
|
1252
1252
|
}
|
|
1253
1253
|
});
|
|
1254
1254
|
}
|
|
@@ -1257,19 +1257,19 @@ class Re {
|
|
|
1257
1257
|
*/
|
|
1258
1258
|
async getEntityList(e) {
|
|
1259
1259
|
var r;
|
|
1260
|
-
if ((r =
|
|
1261
|
-
return
|
|
1260
|
+
if ((r = o(this, st)) != null && r.length && !o(this, _t))
|
|
1261
|
+
return o(this, st);
|
|
1262
1262
|
let A = new z(BX24.callBatch), { entityList: n } = await A.batch({
|
|
1263
1263
|
entityList: {
|
|
1264
1264
|
method: "entity.item.get",
|
|
1265
1265
|
params: {
|
|
1266
|
-
ENTITY:
|
|
1266
|
+
ENTITY: o(this, V),
|
|
1267
1267
|
SORT: { ID: "DESC" }
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
}, e);
|
|
1271
|
-
return n = n.map((
|
|
1272
|
-
const { ID: a, DATE_CREATE: f, DETAIL_TEXT: c } =
|
|
1271
|
+
return n = n.map((h) => {
|
|
1272
|
+
const { ID: a, DATE_CREATE: f, DETAIL_TEXT: c } = h;
|
|
1273
1273
|
return {
|
|
1274
1274
|
...JSON.parse(c),
|
|
1275
1275
|
id: a,
|
|
@@ -1298,39 +1298,39 @@ V = new WeakMap(), At = new WeakMap(), jt = new WeakMap(), lt = new WeakMap(), b
|
|
|
1298
1298
|
});
|
|
1299
1299
|
}, xt = new WeakSet(), ue = async function() {
|
|
1300
1300
|
let e = {}, A = new z(BX24.callBatch);
|
|
1301
|
-
for (let [n, r] of
|
|
1301
|
+
for (let [n, r] of o(this, lt).entries())
|
|
1302
1302
|
r.status && (e[n] = {
|
|
1303
1303
|
method: "entity.item.add",
|
|
1304
1304
|
params: {
|
|
1305
|
-
ENTITY:
|
|
1306
|
-
NAME:
|
|
1305
|
+
ENTITY: o(this, V),
|
|
1306
|
+
NAME: o(this, V),
|
|
1307
1307
|
DETAIL_TEXT: JSON.stringify(r)
|
|
1308
1308
|
}
|
|
1309
1309
|
});
|
|
1310
1310
|
if (Object.keys(e).length) {
|
|
1311
1311
|
let n = await A.batch(e), { errors: r } = A;
|
|
1312
|
-
for (let [
|
|
1313
|
-
|
|
1312
|
+
for (let [h, a] of Object.entries({ ...n, ...r }))
|
|
1313
|
+
o(this, lt).delete(h);
|
|
1314
1314
|
return !0;
|
|
1315
1315
|
}
|
|
1316
1316
|
}, Qt = new WeakSet(), fe = async function() {
|
|
1317
1317
|
let e = new z(BX24.callBatch), { serverTime: A } = await e.batch({
|
|
1318
1318
|
serverTime: { method: "server.time" }
|
|
1319
1319
|
});
|
|
1320
|
-
|
|
1321
|
-
let n =
|
|
1322
|
-
let { dateCreate:
|
|
1323
|
-
return Yt(new Date(
|
|
1320
|
+
o(this, st) || g(this, st, await this.getEntityList());
|
|
1321
|
+
let n = o(this, st).filter((r) => {
|
|
1322
|
+
let { dateCreate: h } = r;
|
|
1323
|
+
return Yt(new Date(h)).between(Yt(new Date(A)), "month") >= this.periodClear;
|
|
1324
1324
|
});
|
|
1325
1325
|
_(this, Zt, Ne).call(this, n);
|
|
1326
1326
|
}, Zt = new WeakSet(), Ne = async function(e) {
|
|
1327
1327
|
let A = new z(BX24.callBatch), n = e.map((r) => {
|
|
1328
|
-
let { id:
|
|
1328
|
+
let { id: h } = r;
|
|
1329
1329
|
return {
|
|
1330
1330
|
method: "entity.item.delete",
|
|
1331
1331
|
params: {
|
|
1332
|
-
ENTITY:
|
|
1333
|
-
ID:
|
|
1332
|
+
ENTITY: o(this, V),
|
|
1333
|
+
ID: h
|
|
1334
1334
|
}
|
|
1335
1335
|
};
|
|
1336
1336
|
});
|
|
@@ -1393,7 +1393,7 @@ class pe {
|
|
|
1393
1393
|
type: "call",
|
|
1394
1394
|
data: { method: e, params: A, updateList: n }
|
|
1395
1395
|
});
|
|
1396
|
-
return new Promise((
|
|
1396
|
+
return new Promise((h) => {
|
|
1397
1397
|
A || (A = {}), BX24.callMethod(e, A, (a) => {
|
|
1398
1398
|
let f = {};
|
|
1399
1399
|
if (a != null && a.answer)
|
|
@@ -1406,14 +1406,14 @@ class pe {
|
|
|
1406
1406
|
key: r,
|
|
1407
1407
|
status: "fail",
|
|
1408
1408
|
errorList: [c.toString()]
|
|
1409
|
-
}),
|
|
1409
|
+
}), h(!1);
|
|
1410
1410
|
} else {
|
|
1411
1411
|
let c = a.data();
|
|
1412
1412
|
c != null && c.items && (c = c.items), this.logger.stop({
|
|
1413
1413
|
answer: f,
|
|
1414
1414
|
key: r,
|
|
1415
1415
|
status: "success"
|
|
1416
|
-
}),
|
|
1416
|
+
}), h(c);
|
|
1417
1417
|
}
|
|
1418
1418
|
});
|
|
1419
1419
|
});
|
|
@@ -1437,12 +1437,12 @@ class pe {
|
|
|
1437
1437
|
* }[]
|
|
1438
1438
|
* }}
|
|
1439
1439
|
*/
|
|
1440
|
-
async batch(e, A, { updateList: n, errorCall: r, limitCommandSerial:
|
|
1440
|
+
async batch(e, A, { updateList: n, errorCall: r, limitCommandSerial: h } = {}) {
|
|
1441
1441
|
let a = new z(BX24.callBatch), f = this.logger.start({
|
|
1442
1442
|
type: "batch",
|
|
1443
1443
|
data: { commandList: e, updateList: n }
|
|
1444
1444
|
});
|
|
1445
|
-
|
|
1445
|
+
h && (a.limitCommandSerial = h);
|
|
1446
1446
|
try {
|
|
1447
1447
|
let c = await a.batch(e, A);
|
|
1448
1448
|
if (Object.keys(a.errors).length) {
|
|
@@ -1477,12 +1477,12 @@ class pe {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
1479
|
/* батч для обработки operating time и паузы, используя BX24.callMethod('batch', ...) - пока что для некоторых методов update */
|
|
1480
|
-
async batchUpdateField(e, A, { updateList: n, errorCall: r, limitCommandSerial:
|
|
1480
|
+
async batchUpdateField(e, A, { updateList: n, errorCall: r, limitCommandSerial: h } = {}) {
|
|
1481
1481
|
let a = new z(BX24.callMethod), f = this.logger.start({
|
|
1482
1482
|
type: "callMethod-batch",
|
|
1483
1483
|
data: { commandList: e, updateList: n }
|
|
1484
1484
|
});
|
|
1485
|
-
|
|
1485
|
+
h && (a.limitCommandSerial = h);
|
|
1486
1486
|
try {
|
|
1487
1487
|
let c = await a.batchUpdateField(e, A);
|
|
1488
1488
|
if (Object.keys(a.errors).length) {
|
|
@@ -1526,7 +1526,7 @@ class pe {
|
|
|
1526
1526
|
data: { commandList: e }
|
|
1527
1527
|
});
|
|
1528
1528
|
try {
|
|
1529
|
-
let
|
|
1529
|
+
let h = await n.batchTotalCount(e, A);
|
|
1530
1530
|
if (Object.keys(n.errors).length) {
|
|
1531
1531
|
let a = Object.entries(n.errors).map(([f, c]) => ({
|
|
1532
1532
|
key: f,
|
|
@@ -1542,13 +1542,13 @@ class pe {
|
|
|
1542
1542
|
key: r,
|
|
1543
1543
|
status: "success"
|
|
1544
1544
|
});
|
|
1545
|
-
return
|
|
1546
|
-
} catch (
|
|
1545
|
+
return h;
|
|
1546
|
+
} catch (h) {
|
|
1547
1547
|
return this.logger.stop({
|
|
1548
1548
|
key: r,
|
|
1549
1549
|
status: "fail",
|
|
1550
|
-
errorList: [
|
|
1551
|
-
}), console.error(
|
|
1550
|
+
errorList: [h.toString()]
|
|
1551
|
+
}), console.error(h), !1;
|
|
1552
1552
|
}
|
|
1553
1553
|
}
|
|
1554
1554
|
/** Запрос данных о местах встройки приложения */
|
|
@@ -1559,8 +1559,8 @@ class pe {
|
|
|
1559
1559
|
async placementBind(e) {
|
|
1560
1560
|
this.placeData || (this.placeData = await this.getPlacement());
|
|
1561
1561
|
const { appName: A, pathApp: n } = this.appConst, r = this.placeData.map((a) => a.placement);
|
|
1562
|
-
let
|
|
1563
|
-
r.includes(e) ?
|
|
1562
|
+
let h = this.placeData.find((a) => a.placement == e);
|
|
1563
|
+
r.includes(e) ? h.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[e] || this.placementUnBind(e).then(() => {
|
|
1564
1564
|
window.placementUnBind[e] || (window.placementUnBind[e] = !0, this.placementBind(e));
|
|
1565
1565
|
})) : this.call({
|
|
1566
1566
|
method: "placement.bind",
|
|
@@ -1606,7 +1606,7 @@ class pe {
|
|
|
1606
1606
|
}
|
|
1607
1607
|
/* регистрация бота */
|
|
1608
1608
|
regBot({ code: e, type: A, name: n }) {
|
|
1609
|
-
const { appName: r, pathApp:
|
|
1609
|
+
const { appName: r, pathApp: h, chatBotLogo: a } = this.appConst, f = this.appInfo.ID;
|
|
1610
1610
|
return this.call({
|
|
1611
1611
|
method: "imbot.register",
|
|
1612
1612
|
params: {
|
|
@@ -1614,7 +1614,7 @@ class pe {
|
|
|
1614
1614
|
// Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
|
|
1615
1615
|
TYPE: A ?? "O",
|
|
1616
1616
|
// Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
|
|
1617
|
-
EVENT_HANDLER:
|
|
1617
|
+
EVENT_HANDLER: h,
|
|
1618
1618
|
// Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
|
|
1619
1619
|
OPENLINE: "Y",
|
|
1620
1620
|
// Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
|