szdl-utils-kit 0.3.7 → 0.3.9
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/index.js +628 -531
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
if (!e.has(
|
|
1
|
+
var Ot = Object.defineProperty;
|
|
2
|
+
var _t = (_, e, r) => e in _ ? Ot(_, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : _[e] = r;
|
|
3
|
+
var M = (_, e, r) => (_t(_, typeof e != "symbol" ? e + "" : e, r), r), At = (_, e, r) => {
|
|
4
|
+
if (!e.has(_))
|
|
5
5
|
throw TypeError("Cannot " + r);
|
|
6
6
|
};
|
|
7
|
-
var E = (
|
|
8
|
-
if (e.has(
|
|
7
|
+
var E = (_, e, r) => (At(_, e, "read from private field"), r ? r.call(_) : e.get(_)), H = (_, e, r) => {
|
|
8
|
+
if (e.has(_))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
e instanceof WeakSet ? e.add(
|
|
11
|
-
},
|
|
12
|
-
var J = (
|
|
10
|
+
e instanceof WeakSet ? e.add(_) : e.set(_, r);
|
|
11
|
+
}, F = (_, e, r, i) => (At(_, e, "write to private field"), i ? i.call(_, r) : e.set(_, r), r);
|
|
12
|
+
var J = (_, e, r) => (At(_, e, "access private method"), r);
|
|
13
13
|
var yt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
|
-
function Et(
|
|
15
|
-
return
|
|
14
|
+
function Et(_) {
|
|
15
|
+
return _ && _.__esModule && Object.prototype.hasOwnProperty.call(_, "default") ? _.default : _;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
(function(
|
|
17
|
+
var ct = { exports: {} };
|
|
18
|
+
(function(_, e) {
|
|
19
19
|
(function(r) {
|
|
20
20
|
Array.prototype.indexOf || (Array.prototype.indexOf = function(t, n) {
|
|
21
|
-
var
|
|
22
|
-
for (
|
|
23
|
-
if (this[
|
|
24
|
-
return
|
|
21
|
+
var f, m;
|
|
22
|
+
for (f = n || 0, m = this.length; f < m; f += 1)
|
|
23
|
+
if (this[f] === t)
|
|
24
|
+
return f;
|
|
25
25
|
return -1;
|
|
26
26
|
});
|
|
27
|
-
var i = this,
|
|
28
|
-
for (var
|
|
29
|
-
|
|
30
|
-
return
|
|
27
|
+
var i = this, o = function(t, n) {
|
|
28
|
+
for (var f = t.toString(); f.length < n; )
|
|
29
|
+
f = "0" + f;
|
|
30
|
+
return f;
|
|
31
31
|
}, a = function(t, n) {
|
|
32
32
|
return n !== r ? (t.year(n.year() || n.year), t.month(n.month() || n.month), t.day(n.day() || n.day), t.hours(n.hours() || n.hours), t.minutes(n.minutes() || n.minutes), t.seconds(n.seconds() || n.seconds), t.milliseconds(n.milliseconds() || n.milliseconds), t) : r;
|
|
33
33
|
}, l = function(t, n) {
|
|
34
|
-
var
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
var
|
|
34
|
+
var f, m = "";
|
|
35
|
+
return f = t.slice(n, n + 1), f !== "" && !isNaN(Number(f)) && (m += "%H"), f = t.charAt(n + 2), f !== "" && f === ":" && (m += f), f = t.slice(n + 3, n + 4), f !== "" && !isNaN(Number(f)) && (m += "%M"), f = t.charAt(n + 5), f !== "" && f === ":" && (m += f), f = t.slice(n + 6, n + 7), f !== "" && !isNaN(Number(f)) && (m += "%S"), m;
|
|
36
|
+
}, u = function(t, n) {
|
|
37
|
+
var f, m = [
|
|
38
38
|
t.slice(n, n + 1),
|
|
39
39
|
t.charAt(n + 2),
|
|
40
40
|
t.slice(n + 3, n + 4),
|
|
41
41
|
t.charAt(n + 5),
|
|
42
42
|
t.slice(n + 6, n + 9)
|
|
43
|
-
],
|
|
44
|
-
return !isNaN(Number(
|
|
43
|
+
], I;
|
|
44
|
+
return !isNaN(Number(m[0])) && !isNaN(Number(m[2])) && !isNaN(Number(m[4])) ? (m[1] === "." && m[3] === "." ? f = "%d.%m.%Y" : m[1] === "-" && m[3] === "-" ? f = "%m-%d-%Y" : m[1] === "/" && m[3] === "/" && (f = "%m/%d/%Y"), f) : (I = [
|
|
45
45
|
t.slice(n, n + 3),
|
|
46
46
|
t.charAt(n + 4),
|
|
47
47
|
t.slice(n + 5, n + 6),
|
|
48
48
|
t.charAt(n + 7),
|
|
49
49
|
t.slice(n + 8, n + 9)
|
|
50
|
-
], !isNaN(Number(
|
|
51
|
-
},
|
|
50
|
+
], !isNaN(Number(I[0])) && !isNaN(Number(I[2])) && !isNaN(Number(I[4])) ? (I[1] === "-" && I[3] === "-" && (f = "%Y-%m-%d"), f) : "");
|
|
51
|
+
}, h = i.tempus, s, d, O = i.navigator || {}, c = "en", A = {
|
|
52
52
|
en: {
|
|
53
53
|
JANUARY_SHORT: "Jan",
|
|
54
54
|
FEBRUARY_SHORT: "Feb",
|
|
@@ -209,66 +209,66 @@ var lt = { exports: {} };
|
|
|
209
209
|
FRIDAY_LONG: "Freitag",
|
|
210
210
|
SATURDAY_LONG: "Samstag"
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, g = function() {
|
|
213
213
|
return [
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
214
|
+
A[c].JANUARY_LONG,
|
|
215
|
+
A[c].FEBRUARY_LONG,
|
|
216
|
+
A[c].MARCH_LONG,
|
|
217
|
+
A[c].APRIL_LONG,
|
|
218
|
+
A[c].MAY_LONG,
|
|
219
|
+
A[c].JUNE_LONG,
|
|
220
|
+
A[c].JULY_LONG,
|
|
221
|
+
A[c].AUGUST_LONG,
|
|
222
|
+
A[c].SEPTEMBER_LONG,
|
|
223
|
+
A[c].OCTOBER_LONG,
|
|
224
|
+
A[c].NOVEMBER_LONG,
|
|
225
|
+
A[c].DECEMBER_LONG
|
|
226
226
|
];
|
|
227
227
|
}, N = function() {
|
|
228
228
|
return [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
229
|
+
A[c].JANUARY_SHORT,
|
|
230
|
+
A[c].FEBRUARY_SHORT,
|
|
231
|
+
A[c].MARCH_SHORT,
|
|
232
|
+
A[c].APRIL_SHORT,
|
|
233
|
+
A[c].MAY_SHORT,
|
|
234
|
+
A[c].JUNE_SHORT,
|
|
235
|
+
A[c].JULY_SHORT,
|
|
236
|
+
A[c].AUGUST_SHORT,
|
|
237
|
+
A[c].SEPTEMBER_SHORT,
|
|
238
|
+
A[c].OCTOBER_SHORT,
|
|
239
|
+
A[c].NOVEMBER_SHORT,
|
|
240
|
+
A[c].DECEMBER_SHORT
|
|
241
241
|
];
|
|
242
|
-
},
|
|
242
|
+
}, p = function() {
|
|
243
243
|
return [
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
A[c].SUNDAY_LONG,
|
|
245
|
+
A[c].MONDAY_LONG,
|
|
246
|
+
A[c].TUESDAY_LONG,
|
|
247
|
+
A[c].WEDNESDAY_LONG,
|
|
248
|
+
A[c].THURSDAY_LONG,
|
|
249
|
+
A[c].FRIDAY_LONG,
|
|
250
|
+
A[c].SATURDAY_LONG
|
|
251
251
|
];
|
|
252
|
-
},
|
|
252
|
+
}, L = function() {
|
|
253
253
|
return [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
A[c].SUNDAY_SHORT,
|
|
255
|
+
A[c].MONDAY_SHORT,
|
|
256
|
+
A[c].TUESDAY_SHORT,
|
|
257
|
+
A[c].WEDNESDAY_SHORT,
|
|
258
|
+
A[c].THURSDAY_SHORT,
|
|
259
|
+
A[c].FRIDAY_SHORT,
|
|
260
|
+
A[c].SATURDAY_SHORT
|
|
261
261
|
];
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
i.XMLHttpRequest ?
|
|
265
|
-
|
|
266
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.parse(
|
|
267
|
-
},
|
|
268
|
-
},
|
|
262
|
+
}, U, P, W, b, k = function(t, n, f) {
|
|
263
|
+
var m;
|
|
264
|
+
i.XMLHttpRequest ? m = new XMLHttpRequest() : m = new ActiveXObject("Microsoft.XMLHTTP"), m.onreadystatechange = function() {
|
|
265
|
+
m.readyState === 4 && (m.status === 200 ? n && (i.JSON === r ? alert(`Please, include json2 into your project if you want use old browsers!
|
|
266
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.parse(m.responseText))) : f && f(m));
|
|
267
|
+
}, m.open("GET", t, !1), m.send();
|
|
268
|
+
}, S = {
|
|
269
269
|
"%d": {
|
|
270
270
|
format: function(t) {
|
|
271
|
-
return
|
|
271
|
+
return o(t.day() || s.MIN_DAY, 2);
|
|
272
272
|
},
|
|
273
273
|
parse: function(t) {
|
|
274
274
|
var n = Number(t);
|
|
@@ -280,7 +280,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
280
280
|
},
|
|
281
281
|
"%m": {
|
|
282
282
|
format: function(t) {
|
|
283
|
-
return
|
|
283
|
+
return o(t.month() || s.MIN_MONTH, 2);
|
|
284
284
|
},
|
|
285
285
|
parse: function(t) {
|
|
286
286
|
var n = Number(t);
|
|
@@ -292,7 +292,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
292
292
|
},
|
|
293
293
|
"%Y": {
|
|
294
294
|
format: function(t) {
|
|
295
|
-
return
|
|
295
|
+
return o(t.year() || s.MIN_YEAR, 4);
|
|
296
296
|
},
|
|
297
297
|
parse: function(t) {
|
|
298
298
|
var n = Number(t);
|
|
@@ -316,7 +316,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
316
316
|
"%a": {
|
|
317
317
|
format: function(t) {
|
|
318
318
|
var n = t.dayOfWeek();
|
|
319
|
-
return
|
|
319
|
+
return b[n !== r ? n : s.MIN_DAY_OF_WEEK];
|
|
320
320
|
},
|
|
321
321
|
parse: function() {
|
|
322
322
|
return {};
|
|
@@ -328,7 +328,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
328
328
|
"%A": {
|
|
329
329
|
format: function(t) {
|
|
330
330
|
var n = t.dayOfWeek();
|
|
331
|
-
return
|
|
331
|
+
return W[n !== r ? n : s.MIN_DAY_OF_WEEK];
|
|
332
332
|
},
|
|
333
333
|
parse: function() {
|
|
334
334
|
return {};
|
|
@@ -340,7 +340,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
340
340
|
"%b": {
|
|
341
341
|
format: function(t) {
|
|
342
342
|
var n = s.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
343
|
-
return
|
|
343
|
+
return P[n !== r ? n : s.MIN_MONTH];
|
|
344
344
|
},
|
|
345
345
|
parse: function(t) {
|
|
346
346
|
var n = s.monthNames().indexOf(t) + (s.options("monthFromZero") ? 0 : 1);
|
|
@@ -353,7 +353,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
353
353
|
"%B": {
|
|
354
354
|
format: function(t) {
|
|
355
355
|
var n = s.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
356
|
-
return
|
|
356
|
+
return U[n !== r ? n : s.MIN_MONTH];
|
|
357
357
|
},
|
|
358
358
|
parse: function(t) {
|
|
359
359
|
var n = s.monthNames(!0).indexOf(t) + (s.options("monthFromZero") ? 0 : 1);
|
|
@@ -365,7 +365,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
365
365
|
},
|
|
366
366
|
"%H": {
|
|
367
367
|
format: function(t) {
|
|
368
|
-
return
|
|
368
|
+
return o(t.hours() || s.MIN_HOURS, 2);
|
|
369
369
|
},
|
|
370
370
|
parse: function(t) {
|
|
371
371
|
var n = Number(t);
|
|
@@ -377,7 +377,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
377
377
|
},
|
|
378
378
|
"%M": {
|
|
379
379
|
format: function(t) {
|
|
380
|
-
return
|
|
380
|
+
return o(t.minutes() || s.MIN_MINUTES, 2);
|
|
381
381
|
},
|
|
382
382
|
parse: function(t) {
|
|
383
383
|
var n = Number(t);
|
|
@@ -389,7 +389,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
389
389
|
},
|
|
390
390
|
"%S": {
|
|
391
391
|
format: function(t) {
|
|
392
|
-
return
|
|
392
|
+
return o(t.seconds() || s.MIN_SECONDS, 2);
|
|
393
393
|
},
|
|
394
394
|
parse: function(t) {
|
|
395
395
|
var n = Number(t);
|
|
@@ -412,14 +412,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
412
412
|
},
|
|
413
413
|
"%F": {
|
|
414
414
|
format: function(t) {
|
|
415
|
-
return
|
|
415
|
+
return o(t.year() || s.MIN_YEAR, 4) + "-" + o(t.month() || s.MIN_MONTH, 2) + "-" + o(t.day() || s.MIN_DAY, 2);
|
|
416
416
|
},
|
|
417
417
|
parse: function(t) {
|
|
418
|
-
var n = Number(t.slice(0, 4)),
|
|
418
|
+
var n = Number(t.slice(0, 4)), f = Number(t.slice(5, 7)), m = Number(t.slice(8, 10));
|
|
419
419
|
return {
|
|
420
420
|
year: n,
|
|
421
|
-
month:
|
|
422
|
-
day:
|
|
421
|
+
month: f,
|
|
422
|
+
day: m
|
|
423
423
|
};
|
|
424
424
|
},
|
|
425
425
|
minLength: 10,
|
|
@@ -428,14 +428,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
428
428
|
},
|
|
429
429
|
"%D": {
|
|
430
430
|
format: function(t) {
|
|
431
|
-
return
|
|
431
|
+
return o(t.month() || s.MIN_MONTH, 2) + "/" + o(t.day() || s.MIN_DAY, 2) + "/" + o(t.year() || s.MIN_YEAR, 4);
|
|
432
432
|
},
|
|
433
433
|
parse: function(t) {
|
|
434
|
-
var n = Number(t.slice(0, 2)),
|
|
434
|
+
var n = Number(t.slice(0, 2)), f = Number(t.slice(3, 5)), m = Number(t.slice(6, 10));
|
|
435
435
|
return {
|
|
436
|
-
year:
|
|
436
|
+
year: m,
|
|
437
437
|
month: n,
|
|
438
|
-
day:
|
|
438
|
+
day: f
|
|
439
439
|
};
|
|
440
440
|
},
|
|
441
441
|
minLength: 10,
|
|
@@ -446,7 +446,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
446
446
|
useMilliseconds: !1,
|
|
447
447
|
monthFromZero: !1
|
|
448
448
|
}, T;
|
|
449
|
-
T = function(t, n,
|
|
449
|
+
T = function(t, n, f) {
|
|
450
450
|
return this._d = /* @__PURE__ */ new Date(), this._i = {
|
|
451
451
|
year: !1,
|
|
452
452
|
month: !1,
|
|
@@ -455,7 +455,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
455
455
|
minutes: !1,
|
|
456
456
|
seconds: !1,
|
|
457
457
|
milliseconds: !1
|
|
458
|
-
}, t !== r && this.set(t, n,
|
|
458
|
+
}, t !== r && this.set(t, n, f), this;
|
|
459
459
|
}, T.fn = T.prototype, T.fn.dayCount = function() {
|
|
460
460
|
var t = this.month(), n = s.MAX_DAY_IN_MONTHS[t - (s.options("monthFromZero") ? 0 : 1)];
|
|
461
461
|
return this.leapYear() && t === (s.options("monthFromZero") ? 1 : 2) && (n += 1), n;
|
|
@@ -504,7 +504,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
504
504
|
}, T.fn.week = function() {
|
|
505
505
|
var t = new Date(this.year(), 0, 1), n = s(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
|
|
506
506
|
return Math.ceil(((n - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
|
|
507
|
-
}, T.fn.set = function(t, n,
|
|
507
|
+
}, T.fn.set = function(t, n, f) {
|
|
508
508
|
if (this._i = {
|
|
509
509
|
year: !1,
|
|
510
510
|
month: !1,
|
|
@@ -520,9 +520,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
520
520
|
if (typeof t == "number")
|
|
521
521
|
return this._d = new Date(t * (s.options("useMilliseconds") ? 1 : 1e3)), this;
|
|
522
522
|
if (typeof t == "object" && (t instanceof Array ? (this.day(s.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(s.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
|
-
var
|
|
523
|
+
var m, I = [], y, R, j = [], C = 0, Y = 0, D, x, B = {}, w;
|
|
524
524
|
if (t === r)
|
|
525
|
-
return
|
|
525
|
+
return y = a(this, f), y === r && (this._i = {
|
|
526
526
|
year: -1,
|
|
527
527
|
month: -1,
|
|
528
528
|
day: -1,
|
|
@@ -530,26 +530,26 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
530
530
|
minutes: -1,
|
|
531
531
|
seconds: -1,
|
|
532
532
|
milliseconds: -1
|
|
533
|
-
}),
|
|
534
|
-
for (n === r && (n = s.detectFormat(t));
|
|
535
|
-
if (n.charAt(
|
|
536
|
-
if (R = n.charAt(
|
|
537
|
-
switch (
|
|
533
|
+
}), y;
|
|
534
|
+
for (n === r && (n = s.detectFormat(t)); C < n.length; ) {
|
|
535
|
+
if (n.charAt(C) === "%") {
|
|
536
|
+
if (R = n.charAt(C) + n.charAt(C + 1), S[R] !== r) {
|
|
537
|
+
switch (D = 0, x = "", S[R].type) {
|
|
538
538
|
case "number":
|
|
539
|
-
for (;
|
|
540
|
-
|
|
539
|
+
for (; D < S[R].maxLength && Y + D < t.length && !isNaN(Number(t.charAt(Y + D))); )
|
|
540
|
+
x += t.charAt(Y + D), D += 1;
|
|
541
541
|
break;
|
|
542
542
|
case "word":
|
|
543
|
-
for (;
|
|
544
|
-
|
|
543
|
+
for (; D < S[R].maxLength && Y + D < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(Y + D)); )
|
|
544
|
+
x += t.charAt(Y + D), D += 1;
|
|
545
545
|
break;
|
|
546
546
|
case "string":
|
|
547
|
-
for (;
|
|
548
|
-
|
|
547
|
+
for (; D < S[R].maxLength && Y + D < t.length; )
|
|
548
|
+
x += t.charAt(Y + D), D += 1;
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
|
-
if (
|
|
552
|
-
return
|
|
551
|
+
if (D < S[R].minLength)
|
|
552
|
+
return y = a(this, f), y === r && (this._i = {
|
|
553
553
|
year: -1,
|
|
554
554
|
month: -1,
|
|
555
555
|
day: -1,
|
|
@@ -557,11 +557,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
557
557
|
minutes: -1,
|
|
558
558
|
seconds: -1,
|
|
559
559
|
milliseconds: -1
|
|
560
|
-
}),
|
|
561
|
-
|
|
560
|
+
}), y;
|
|
561
|
+
I.push(R), j.push(x), D -= 1, Y += D, C += 1;
|
|
562
562
|
}
|
|
563
|
-
} else if (t.charAt(Y) !== n.charAt(
|
|
564
|
-
return
|
|
563
|
+
} else if (t.charAt(Y) !== n.charAt(C))
|
|
564
|
+
return y = a(this, f), y === r && (this._i = {
|
|
565
565
|
year: -1,
|
|
566
566
|
month: -1,
|
|
567
567
|
day: -1,
|
|
@@ -569,19 +569,19 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
569
569
|
minutes: -1,
|
|
570
570
|
seconds: -1,
|
|
571
571
|
milliseconds: -1
|
|
572
|
-
}),
|
|
573
|
-
|
|
572
|
+
}), y;
|
|
573
|
+
C += 1, Y += 1;
|
|
574
574
|
}
|
|
575
|
-
for (
|
|
576
|
-
|
|
577
|
-
year:
|
|
578
|
-
month:
|
|
579
|
-
day:
|
|
580
|
-
hours:
|
|
581
|
-
minutes:
|
|
582
|
-
seconds:
|
|
575
|
+
for (m in I)
|
|
576
|
+
I.hasOwnProperty(m) && S.hasOwnProperty(I[m]) && (w = S[I[m]].parse(j[m]), B = {
|
|
577
|
+
year: w.year !== r ? w.year : B.year,
|
|
578
|
+
month: w.month !== r ? w.month : B.month,
|
|
579
|
+
day: w.day !== r ? w.day : B.day,
|
|
580
|
+
hours: w.hours !== r ? w.hours : B.hours,
|
|
581
|
+
minutes: w.minutes !== r ? w.minutes : B.minutes,
|
|
582
|
+
seconds: w.seconds !== r ? w.seconds : B.seconds
|
|
583
583
|
});
|
|
584
|
-
this.day(s.MIN_DAY), this.year(
|
|
584
|
+
this.day(s.MIN_DAY), this.year(B.year), this.month(B.month), this.day(B.day), this.hours(B.hours), this.minutes(B.minutes), this.seconds(B.seconds), this.milliseconds(B.milliseconds);
|
|
585
585
|
}
|
|
586
586
|
return this;
|
|
587
587
|
}, T.fn.leapYear = function() {
|
|
@@ -593,9 +593,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
593
593
|
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (s.options("useMilliseconds") ? 1 : 1e3)), this) : s.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
|
|
594
594
|
}, T.fn.dayOfWeek = function(t) {
|
|
595
595
|
if (t === "long")
|
|
596
|
-
return
|
|
596
|
+
return W[this._d.getDay()];
|
|
597
597
|
if (t === "short")
|
|
598
|
-
return
|
|
598
|
+
return b[this._d.getDay()];
|
|
599
599
|
if (t === r)
|
|
600
600
|
return this._d.getDay();
|
|
601
601
|
if (t === 0 || t === "Sunday")
|
|
@@ -671,35 +671,35 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
673
|
}, T.fn.format = function(t) {
|
|
674
|
-
for (var n = 0,
|
|
675
|
-
t.charAt(n) === "%" ? (
|
|
676
|
-
return
|
|
674
|
+
for (var n = 0, f = "", m; n < t.length; )
|
|
675
|
+
t.charAt(n) === "%" ? (m = t.charAt(n) + t.charAt(n + 1), S[m] !== r ? (f += S[m].format(this), n += 1) : f += "%") : f += t.charAt(n), n += 1;
|
|
676
|
+
return f;
|
|
677
677
|
}, T.fn.valid = function() {
|
|
678
678
|
return this._i.year === !1 && this._i.month === !1 && this._i.day === !1 && this._i.hours === !1 && this._i.minutes === !1 && this._i.seconds === !1 && this._i.milliseconds === !1;
|
|
679
679
|
}, T.fn.errors = function() {
|
|
680
680
|
return this._i;
|
|
681
681
|
}, T.fn.between = function(t, n) {
|
|
682
|
-
var
|
|
682
|
+
var f = this.timestamp(), m = t.timestamp();
|
|
683
683
|
switch (n) {
|
|
684
684
|
case "year":
|
|
685
|
-
return Math.floor((
|
|
685
|
+
return Math.floor((m - f) / 31556952);
|
|
686
686
|
case "month":
|
|
687
|
-
return Math.floor((
|
|
687
|
+
return Math.floor((m - f) / 2629746);
|
|
688
688
|
case "day":
|
|
689
|
-
return Math.floor((
|
|
689
|
+
return Math.floor((m - f) / 86400);
|
|
690
690
|
case "hours":
|
|
691
|
-
return Math.floor((
|
|
691
|
+
return Math.floor((m - f) / 3600);
|
|
692
692
|
case "minutes":
|
|
693
|
-
return Math.floor((
|
|
693
|
+
return Math.floor((m - f) / 60);
|
|
694
694
|
case "seconds":
|
|
695
|
-
return
|
|
695
|
+
return m - f;
|
|
696
696
|
default:
|
|
697
697
|
return r;
|
|
698
698
|
}
|
|
699
699
|
}, T.fn.calc = function(t) {
|
|
700
700
|
return t.year !== r && this._d.setFullYear(this._d.getFullYear() + t.year), t.month !== r && this._d.setMonth(this._d.getMonth() + t.month), t.day !== r && this._d.setDate(this._d.getDate() + t.day), t.hours !== r && this._d.setHours(this._d.getHours() + t.hours), t.minutes !== r && this._d.setMinutes(this._d.getMinutes() + t.minutes), t.seconds !== r && this._d.setSeconds(this._d.getSeconds() + t.seconds), t.milliseconds !== r && this._d.setMilliseconds(this._d.getMilliseconds() + t.milliseconds), this;
|
|
701
|
-
}, s = function(t, n,
|
|
702
|
-
return new T(t, n,
|
|
701
|
+
}, s = function(t, n, f) {
|
|
702
|
+
return new T(t, n, f);
|
|
703
703
|
}, s.MIN_YEAR = 1e3, s.MAX_YEAR = 3e3, s.MIN_MONTH = 1, s.MAX_MONTH = 12, s.MIN_DAY = 1, s.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], s.MIN_DAY_OF_WEEK = 0, s.MAX_DAY_OF_WEEK = 6, s.MIN_HOURS = 0, s.MAX_HOURS = 23, s.MIN_MINUTES = 0, s.MAX_MINUTES = 59, s.MIN_SECONDS = 0, s.MAX_SECONDS = 59, s.MIN_MILLISECONDS = 0, s.MAX_MILLISECONDS = 999, s.VERSION = "0.2.18", s.options = function(t, n) {
|
|
704
704
|
if (t === r)
|
|
705
705
|
return tt;
|
|
@@ -710,106 +710,106 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : n(JSON.pars
|
|
|
710
710
|
}
|
|
711
711
|
return r;
|
|
712
712
|
}, s.noConflict = function() {
|
|
713
|
-
return i.tempus =
|
|
713
|
+
return i.tempus = h, s;
|
|
714
714
|
}, s.generate = function(t) {
|
|
715
|
-
var n,
|
|
716
|
-
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof T ? n = t.dateFrom.utc() : n = s(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof T ?
|
|
715
|
+
var n, f, m, I, y, R, j, C;
|
|
716
|
+
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof T ? n = t.dateFrom.utc() : n = s(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof T ? f = t.dateTo.utc() : f = s(t.dateTo, t.formatTo !== r ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? y = {
|
|
717
717
|
year: 0,
|
|
718
718
|
month: 0,
|
|
719
719
|
day: 0,
|
|
720
720
|
hours: 0,
|
|
721
721
|
minutes: 0,
|
|
722
722
|
seconds: t.period
|
|
723
|
-
} : typeof t.period == "string" ?
|
|
723
|
+
} : typeof t.period == "string" ? y = {
|
|
724
724
|
year: t.period === "year" ? 1 : 0,
|
|
725
725
|
month: t.period === "month" ? 1 : 0,
|
|
726
726
|
day: t.period === "day" ? 1 : 0,
|
|
727
727
|
hours: t.period === "hours" ? 1 : 0,
|
|
728
728
|
minutes: t.period === "minutes" ? 1 : 0,
|
|
729
729
|
seconds: t.period === "seconds" ? 1 : 0
|
|
730
|
-
} : typeof t.period == "object" && (
|
|
730
|
+
} : typeof t.period == "object" && (y = {
|
|
731
731
|
year: t.period.year !== r ? t.period.year : 0,
|
|
732
732
|
month: t.period.month !== r ? t.period.month : 0,
|
|
733
733
|
day: t.period.day !== r ? t.period.day : 0,
|
|
734
734
|
hours: t.period.hours !== r ? t.period.hours : 0,
|
|
735
735
|
minutes: t.period.minutes !== r ? t.period.minutes : 0,
|
|
736
736
|
seconds: t.period.seconds !== r ? t.period.seconds : 0
|
|
737
|
-
}), t.groupBy === r ? R = t.asObject === !0 ? {} : [] : (R = [], R.push([]), j = s(n).get()[t.groupBy]),
|
|
738
|
-
return t.asObject === !0 ? t.format !== r ?
|
|
737
|
+
}), t.groupBy === r ? R = t.asObject === !0 ? {} : [] : (R = [], R.push([]), j = s(n).get()[t.groupBy]), C = function(x, B, w) {
|
|
738
|
+
return t.asObject === !0 ? t.format !== r ? x[s(B).format(t.format)] = {} : x[s(B).format("%F %H:%M:%S")] = {} : t.format !== r ? x.push(w ? null : s(B).format(t.format)) : x.push(w ? null : s(B)), x;
|
|
739
739
|
}, t.groupBy !== r && t.fillNulls) {
|
|
740
740
|
var Y = {
|
|
741
|
-
year:
|
|
742
|
-
month:
|
|
743
|
-
day:
|
|
744
|
-
hours:
|
|
745
|
-
minutes:
|
|
746
|
-
seconds:
|
|
747
|
-
milliseconds:
|
|
741
|
+
year: y.year ? -y.year : r,
|
|
742
|
+
month: y.month ? -y.month : r,
|
|
743
|
+
day: y.day ? -y.day : r,
|
|
744
|
+
hours: y.hours ? -y.hours : r,
|
|
745
|
+
minutes: y.minutes ? -y.minutes : r,
|
|
746
|
+
seconds: y.seconds ? -y.seconds : r,
|
|
747
|
+
milliseconds: y.milliseconds ? -y.milliseconds : r
|
|
748
748
|
};
|
|
749
|
-
for (
|
|
750
|
-
|
|
749
|
+
for (m = s(n).calc(Y).utc(); s(m).get()[t.groupBy] === j; )
|
|
750
|
+
C(R[R.length - 1], m, !0), m = s(m).calc(Y).utc();
|
|
751
751
|
if (t.groupBy === "week") {
|
|
752
|
-
var
|
|
753
|
-
for (
|
|
754
|
-
|
|
752
|
+
var D = s(n).dayOfWeek();
|
|
753
|
+
for (m = s(n).dayOfWeek(0).utc(); R[0].length < D && m < n; )
|
|
754
|
+
C(R[R.length - 1], m, !0), m = s(m).calc(y).utc();
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
for (; n <=
|
|
758
|
-
t.groupBy === r ?
|
|
757
|
+
for (; n <= f; )
|
|
758
|
+
t.groupBy === r ? C(R, n) : s(n).get()[t.groupBy] === j ? C(R[R.length - 1], n) : (R.push([]), C(R[R.length - 1], n), j = s(n).get()[t.groupBy]), n = s(n).calc(y).utc();
|
|
759
759
|
if (t.groupBy !== r && t.fillNulls)
|
|
760
|
-
for (
|
|
761
|
-
|
|
760
|
+
for (I = s(f).calc(y).utc(); s(I).get()[t.groupBy] === j; )
|
|
761
|
+
C(R[R.length - 1], I, !0), I = s(I).calc(y).utc();
|
|
762
762
|
return R;
|
|
763
763
|
}, s.monthNames = function(t) {
|
|
764
764
|
switch (t) {
|
|
765
765
|
case "long":
|
|
766
|
-
return
|
|
766
|
+
return U;
|
|
767
767
|
default:
|
|
768
|
-
return
|
|
768
|
+
return P;
|
|
769
769
|
}
|
|
770
770
|
}, s.dayNames = function(t) {
|
|
771
771
|
switch (t) {
|
|
772
772
|
case "long":
|
|
773
|
-
return
|
|
773
|
+
return W;
|
|
774
774
|
default:
|
|
775
|
-
return
|
|
775
|
+
return b;
|
|
776
776
|
}
|
|
777
777
|
}, s.lang = function(t) {
|
|
778
778
|
if (t !== r)
|
|
779
|
-
|
|
779
|
+
c = t, A[c] === r && (c = "en"), U = g(), P = N(), W = p(), b = L();
|
|
780
780
|
else
|
|
781
|
-
return
|
|
781
|
+
return c;
|
|
782
782
|
return r;
|
|
783
783
|
}, s.availableLangs = function() {
|
|
784
|
-
return Object.keys(
|
|
785
|
-
}, s.registerFormat = function(t, n,
|
|
786
|
-
|
|
784
|
+
return Object.keys(A);
|
|
785
|
+
}, s.registerFormat = function(t, n, f, m, I, y) {
|
|
786
|
+
S[t] = {
|
|
787
787
|
format: n,
|
|
788
|
-
parse:
|
|
789
|
-
minLength:
|
|
790
|
-
maxLength:
|
|
791
|
-
type:
|
|
788
|
+
parse: f,
|
|
789
|
+
minLength: m,
|
|
790
|
+
maxLength: I,
|
|
791
|
+
type: y
|
|
792
792
|
};
|
|
793
793
|
}, s.unregisterFormat = function(t) {
|
|
794
|
-
delete
|
|
794
|
+
delete S[t];
|
|
795
795
|
}, s.detectFormat = function(t) {
|
|
796
|
-
var n,
|
|
797
|
-
return n =
|
|
798
|
-
},
|
|
796
|
+
var n, f, m;
|
|
797
|
+
return n = u(t, 0), n !== "" && (m = 10), f = t.charAt(m), (f === "T" || f === " ") && (n += f, m += 1), n += l(t, m), n;
|
|
798
|
+
}, d = {
|
|
799
799
|
TempusDate: T
|
|
800
800
|
}, s.classes = function(t, n) {
|
|
801
801
|
if (n === r)
|
|
802
|
-
return
|
|
803
|
-
|
|
802
|
+
return d[t];
|
|
803
|
+
d[t] = n;
|
|
804
804
|
}, s.loadTranslations = function(t) {
|
|
805
|
-
typeof t == "object" ?
|
|
806
|
-
|
|
805
|
+
typeof t == "object" ? A = t : typeof t == "string" && k(t, function(n) {
|
|
806
|
+
A = n;
|
|
807
807
|
}, function(n) {
|
|
808
808
|
});
|
|
809
|
-
},
|
|
809
|
+
}, c = (O.language || O.systemLanguage || O.userLanguage || "en").substr(0, 2).toLowerCase(), A[c] === r && (c = "en"), U = g(), P = N(), W = p(), b = L(), _.exports && (e = _.exports = s), e.tempus = s;
|
|
810
810
|
}).call(yt);
|
|
811
|
-
})(
|
|
812
|
-
var Tt =
|
|
811
|
+
})(ct, ct.exports);
|
|
812
|
+
var Tt = ct.exports;
|
|
813
813
|
const et = /* @__PURE__ */ Et(Tt);
|
|
814
814
|
class v {
|
|
815
815
|
constructor(e) {
|
|
@@ -832,8 +832,8 @@ class v {
|
|
|
832
832
|
if (!this.progressData)
|
|
833
833
|
return { percent: Math.round(e), allCount: 0, allTotal: 0 };
|
|
834
834
|
let r = 0, i = 0;
|
|
835
|
-
return Object.values(this.progressData).forEach((
|
|
836
|
-
const { total: a, count: l } =
|
|
835
|
+
return Object.values(this.progressData).forEach((o) => {
|
|
836
|
+
const { total: a, count: l } = o;
|
|
837
837
|
r += a ?? 0, i += l ?? 0;
|
|
838
838
|
}), r ? e = i / r * 100 * this.chunkRate + this.totalProgress : i === 0 && r === 0 ? e = 100 * this.chunkRate + this.totalProgress : e = 100, { percent: Math.round(e), allCount: i, allTotal: r };
|
|
839
839
|
}
|
|
@@ -845,18 +845,18 @@ class v {
|
|
|
845
845
|
* @param {string} params.type - Тип обработки ('count' или undefined)
|
|
846
846
|
*/
|
|
847
847
|
setProgressData({ key: e, value: r, type: i }) {
|
|
848
|
-
const
|
|
848
|
+
const o = this.getData(r.data()), a = Array.isArray(o) ? o.length : 0;
|
|
849
849
|
let l = r.total() || a;
|
|
850
850
|
i === "count" && (l = a);
|
|
851
|
-
let
|
|
852
|
-
|
|
853
|
-
const { percent:
|
|
851
|
+
let u = 1;
|
|
852
|
+
o && (u = a), this.progressCall && (this.progressData || (this.progressData = {}), this.progressData[e] && this.progressData[e].count && (u += this.progressData[e].count), this.progressData[e] ? this.progressData[e].count = u : this.progressData[e] = { total: l, count: u }, this.progressTimer || (this.progressTimer = setInterval(() => {
|
|
853
|
+
const { percent: h, allCount: s, allTotal: d } = this.progressPercent;
|
|
854
854
|
(this.oldPercent === "no" || this.oldPercent < this.progressPercent.percent) && (this.progressCall({
|
|
855
855
|
data: this.progressData,
|
|
856
|
-
percent:
|
|
856
|
+
percent: h,
|
|
857
857
|
allCount: s,
|
|
858
|
-
allTotal:
|
|
859
|
-
}), this.oldPercent = this.progressPercent.percent),
|
|
858
|
+
allTotal: d
|
|
859
|
+
}), this.oldPercent = this.progressPercent.percent), h >= 100 && this.clearProgressData();
|
|
860
860
|
}, this.progressDelay)));
|
|
861
861
|
}
|
|
862
862
|
/**
|
|
@@ -866,6 +866,70 @@ class v {
|
|
|
866
866
|
delay() {
|
|
867
867
|
return new Promise((e) => setTimeout(e, 500));
|
|
868
868
|
}
|
|
869
|
+
/**
|
|
870
|
+
* Обертка над callBatch с таймаутом для предотвращения зависаний
|
|
871
|
+
* При ошибках CORS или 503 Service Unavailable callBatch может зависнуть,
|
|
872
|
+
* поэтому добавляем таймаут в 30 секунд
|
|
873
|
+
* @param {Object} chunk - Объект с методами для выполнения
|
|
874
|
+
* @param {Function} callback - Callback функция для обработки результата
|
|
875
|
+
* @returns {Promise<void>}
|
|
876
|
+
*/
|
|
877
|
+
callBatchWithTimeout(e, r) {
|
|
878
|
+
return new Promise((i, o) => {
|
|
879
|
+
let a = !1;
|
|
880
|
+
const l = 3e4;
|
|
881
|
+
let u = !1, h = !1, s = !1, d = null, O = null;
|
|
882
|
+
const c = async (N, p) => {
|
|
883
|
+
if (!a) {
|
|
884
|
+
a = !0, d && clearTimeout(d), O && clearTimeout(O);
|
|
885
|
+
try {
|
|
886
|
+
await Promise.resolve(r(N)), i();
|
|
887
|
+
} catch (L) {
|
|
888
|
+
console.error(`Error in callBatch callback (attempt ${p}):`, L), o(L);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}, A = async () => {
|
|
892
|
+
if (!a) {
|
|
893
|
+
a = !0, d && clearTimeout(d), O && clearTimeout(O), console.warn(
|
|
894
|
+
`Batch request timeout after ${l}ms on both attempts. This may indicate a CORS or network error.`
|
|
895
|
+
);
|
|
896
|
+
const N = {};
|
|
897
|
+
Object.keys(e).forEach((p) => {
|
|
898
|
+
N[p] = {
|
|
899
|
+
error: () => ({
|
|
900
|
+
ex: {
|
|
901
|
+
error: "TIMEOUT",
|
|
902
|
+
error_description: "Request timeout after 30 seconds. Possible CORS or network error."
|
|
903
|
+
}
|
|
904
|
+
}),
|
|
905
|
+
data: () => [],
|
|
906
|
+
total: () => 0
|
|
907
|
+
};
|
|
908
|
+
});
|
|
909
|
+
try {
|
|
910
|
+
await Promise.resolve(r(N)), i();
|
|
911
|
+
} catch (p) {
|
|
912
|
+
console.error("Error in timeout callback:", p), i();
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}, g = (N) => {
|
|
916
|
+
try {
|
|
917
|
+
this.callBatch(e, async (p) => {
|
|
918
|
+
N === 1 && !u && !a ? (u = !0, await c(p, 1)) : N === 2 && !s && !a && (s = !0, await c(p, 2));
|
|
919
|
+
});
|
|
920
|
+
} catch (p) {
|
|
921
|
+
a || console.error(`Error calling callBatch (attempt ${N}):`, p);
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
g(1), d = setTimeout(async () => {
|
|
925
|
+
!u && !a && !h && (console.warn(
|
|
926
|
+
`First batch request attempt timeout after ${l}ms. Starting second attempt...`
|
|
927
|
+
), h = !0, g(2), O = setTimeout(async () => {
|
|
928
|
+
!u && !s && !a && await A();
|
|
929
|
+
}, l));
|
|
930
|
+
}, l);
|
|
931
|
+
});
|
|
932
|
+
}
|
|
869
933
|
/**
|
|
870
934
|
* Остановка выполнения batch запросов
|
|
871
935
|
*/
|
|
@@ -885,24 +949,24 @@ class v {
|
|
|
885
949
|
*/
|
|
886
950
|
async batch(e, r, i) {
|
|
887
951
|
this.progressTimer && this.clearProgressData(), r && (this.progressCall = r), i && (this.limitCall = i), this.canContinue = !0, this.result = {}, this.errors = {};
|
|
888
|
-
const
|
|
952
|
+
const o = {};
|
|
889
953
|
this.chunkRate = (1 / Math.ceil(Object.keys(e).length / this.limit)).toFixed(5);
|
|
890
954
|
let a = {}, l = 0;
|
|
891
|
-
for (const [
|
|
955
|
+
for (const [u, h] of Object.entries(e)) {
|
|
892
956
|
if (!this.canContinue)
|
|
893
957
|
break;
|
|
894
|
-
const s = this.arrayChunk(
|
|
958
|
+
const s = this.arrayChunk(h);
|
|
895
959
|
if (!s) {
|
|
896
960
|
l++;
|
|
897
961
|
continue;
|
|
898
962
|
}
|
|
899
|
-
a[
|
|
900
|
-
|
|
963
|
+
a[u] = s, (Object.keys(a).length >= 50 || l + 1 === Object.keys(e).length) && (await this.batchChunk(a), Object.entries(this.result).forEach(([d, O]) => {
|
|
964
|
+
o[d] = O;
|
|
901
965
|
}), this.totalProgress = Math.round(
|
|
902
966
|
l / Object.keys(e).length * 100
|
|
903
967
|
), a = {}), l++;
|
|
904
968
|
}
|
|
905
|
-
return Object.entries(this.errors).length && (
|
|
969
|
+
return Object.entries(this.errors).length && (o.errorsList = this.errors), r && r({ percent: 100 }), Promise.resolve(o);
|
|
906
970
|
}
|
|
907
971
|
/**
|
|
908
972
|
* Аналогично this.batch, но возвращает количество элементов
|
|
@@ -916,24 +980,24 @@ class v {
|
|
|
916
980
|
*/
|
|
917
981
|
async batchTotalCount(e, r, i) {
|
|
918
982
|
this.progressTimer && this.clearProgressData(), r && (this.progressCall = r), i && (this.limitCall = i), this.canContinue = !0, this.result = {}, this.errors = {};
|
|
919
|
-
const
|
|
983
|
+
const o = {};
|
|
920
984
|
this.chunkRate = (1 / Math.ceil(Object.keys(e).length / this.limit)).toFixed(5);
|
|
921
985
|
let a = {}, l = 0;
|
|
922
|
-
for (const [
|
|
986
|
+
for (const [u, h] of Object.entries(e)) {
|
|
923
987
|
if (!this.canContinue)
|
|
924
988
|
break;
|
|
925
|
-
const s = this.arrayChunk(
|
|
989
|
+
const s = this.arrayChunk(h);
|
|
926
990
|
if (!s) {
|
|
927
991
|
l++;
|
|
928
992
|
continue;
|
|
929
993
|
}
|
|
930
|
-
a[
|
|
931
|
-
|
|
994
|
+
a[u] = s, (Object.keys(a).length >= 50 || l + 1 === Object.keys(e).length) && (await this.batchChunk(a, "count"), Object.entries(this.result).forEach(([d, O]) => {
|
|
995
|
+
o[d] = O;
|
|
932
996
|
}), this.totalProgress = Math.round(
|
|
933
997
|
l / Object.keys(e).length * 100
|
|
934
998
|
), a = {}), l++;
|
|
935
999
|
}
|
|
936
|
-
return Object.entries(this.errors).length && (
|
|
1000
|
+
return Object.entries(this.errors).length && (o.errorsList = this.errors), r && r({ percent: 100 }), Promise.resolve(o);
|
|
937
1001
|
}
|
|
938
1002
|
/** Валидация запросов
|
|
939
1003
|
* Чтобы не перегружать Битрикс сервера запросами с start - добавляем нужные поля в параметры
|
|
@@ -951,8 +1015,8 @@ class v {
|
|
|
951
1015
|
};
|
|
952
1016
|
else {
|
|
953
1017
|
r === "tasks.task.list" ? (i.order || (i.order = {}), i.order.ID = "asc") : r === "user.get" ? (i.sort || (i.sort = "ID"), i.order || (i.order = "ASC")) : i.order = { ID: "ASC", id: "ASC" }, Array.isArray(i.select) && !i.select.includes("ID") && i.select.push("ID");
|
|
954
|
-
const
|
|
955
|
-
typeof
|
|
1018
|
+
const o = r === "user.get" ? i.FILTER : i.filter;
|
|
1019
|
+
typeof o == "object" && o !== null && !Array.isArray(o) && Object.entries(o).forEach(([a, l]) => {
|
|
956
1020
|
(i.start === void 0 || i.start !== -1) && ["id", "ID"].includes(a) && (typeof l == "string" || Array.isArray(l) && l.length <= 50) && (i.start = -1);
|
|
957
1021
|
});
|
|
958
1022
|
}
|
|
@@ -963,8 +1027,8 @@ class v {
|
|
|
963
1027
|
i = [{ ID: "ASC" }, [""], [""], ["ID"]];
|
|
964
1028
|
else {
|
|
965
1029
|
Array.isArray(i[0]) && (i[0] = {});
|
|
966
|
-
const [
|
|
967
|
-
|
|
1030
|
+
const [o, a, l, u] = i;
|
|
1031
|
+
o.ID = "ASC", u[0] !== "" && u.includes("ID") || u.push("ID");
|
|
968
1032
|
}
|
|
969
1033
|
return { method: r, params: i };
|
|
970
1034
|
}
|
|
@@ -976,41 +1040,42 @@ class v {
|
|
|
976
1040
|
*/
|
|
977
1041
|
async batchChunk(e, r) {
|
|
978
1042
|
return new Promise((i) => {
|
|
979
|
-
const
|
|
1043
|
+
const o = [];
|
|
980
1044
|
let a;
|
|
981
|
-
this.
|
|
982
|
-
var
|
|
983
|
-
for (const [
|
|
1045
|
+
this.callBatchWithTimeout(e, async (l) => {
|
|
1046
|
+
var u, h, s, d, O, c, A;
|
|
1047
|
+
for (const [g, N] of Object.entries(l)) {
|
|
984
1048
|
if (!this.canContinue)
|
|
985
1049
|
return;
|
|
986
1050
|
if (N.error())
|
|
987
|
-
switch (this.errors[
|
|
1051
|
+
switch (this.errors[g] = ((h = (u = N.error()) == null ? void 0 : u.ex) == null ? void 0 : h.error) ?? ((d = (s = N.error()) == null ? void 0 : s.ex) == null ? void 0 : d.error_description) ?? ((O = N.error()) == null ? void 0 : O.toString()) ?? "Неизвестная ошибка", a = !0, ((A = (c = N.error()) == null ? void 0 : c.ex) == null ? void 0 : A.error) ?? "") {
|
|
988
1052
|
case "OPERATION_TIME_LIMIT":
|
|
989
|
-
this.skipList.add(e[
|
|
990
|
-
break;
|
|
991
|
-
case "QUERY_LIMIT_EXCEEDED":
|
|
992
|
-
this.canContinue = !1;
|
|
1053
|
+
this.skipList.add(e[g].method), this.limitCall && this.limitCall(g);
|
|
993
1054
|
break;
|
|
994
1055
|
case "ACCESS_DENIED":
|
|
995
|
-
this.skipList.add(e[
|
|
1056
|
+
this.skipList.add(e[g].method);
|
|
1057
|
+
break;
|
|
1058
|
+
case "TIMEOUT":
|
|
1059
|
+
let k = e[g], S = "";
|
|
1060
|
+
Array.isArray(k) ? [S] = k : k != null && k.method && (S = k.method), S && this.skipList.add(S), this.limitCall && this.limitCall(g);
|
|
996
1061
|
break;
|
|
997
1062
|
}
|
|
998
|
-
const
|
|
999
|
-
r === "count" ? this.result[
|
|
1000
|
-
const
|
|
1001
|
-
if (!this.canContinue ||
|
|
1002
|
-
let
|
|
1003
|
-
if (Array.isArray(
|
|
1004
|
-
const [
|
|
1005
|
-
|
|
1063
|
+
const p = this.getData(N.data()), L = Array.isArray(p) ? p.length : 0, U = typeof N.total == "function" && N.total() !== void 0, P = U ? N.total() : L;
|
|
1064
|
+
r === "count" ? this.result[g] ? this.result[g] += L : this.result[g] = P : this.result[g] = p, this.setProgressData({ key: g, value: N, type: r });
|
|
1065
|
+
const W = r === "count" ? !U && L === this.limit : P > this.limit && P > L;
|
|
1066
|
+
if (!this.canContinue || W) {
|
|
1067
|
+
let b = e[g];
|
|
1068
|
+
if (Array.isArray(b)) {
|
|
1069
|
+
const [k, S = {}] = b;
|
|
1070
|
+
b = [k, S];
|
|
1006
1071
|
} else {
|
|
1007
|
-
const { method:
|
|
1008
|
-
|
|
1072
|
+
const { method: k, params: S = {} } = b;
|
|
1073
|
+
b = [k, S];
|
|
1009
1074
|
}
|
|
1010
|
-
|
|
1075
|
+
o.push([g, b, P]);
|
|
1011
1076
|
}
|
|
1012
1077
|
}
|
|
1013
|
-
a > 0 && this.errorLogger(),
|
|
1078
|
+
a > 0 && this.errorLogger(), o.length ? await this.batchPayload(o, r).then(
|
|
1014
1079
|
() => i(this.result)
|
|
1015
1080
|
) : i(this.result);
|
|
1016
1081
|
});
|
|
@@ -1021,83 +1086,81 @@ class v {
|
|
|
1021
1086
|
* @param {String} type - Тип обработки результатов ('count' или undefined)
|
|
1022
1087
|
*/
|
|
1023
1088
|
async batchPayload(e, r) {
|
|
1024
|
-
const i = /* @__PURE__ */ new Map(),
|
|
1025
|
-
let
|
|
1026
|
-
this.result[
|
|
1027
|
-
let
|
|
1028
|
-
if (JSON.stringify(
|
|
1089
|
+
const i = /* @__PURE__ */ new Map(), o = (h, s, d, O) => {
|
|
1090
|
+
let c = "ID";
|
|
1091
|
+
this.result[h][this.result[h].length - 1].ID || (c = "id");
|
|
1092
|
+
let A = `${c}`;
|
|
1093
|
+
if (JSON.stringify(O[1]).toLocaleLowerCase().includes('"id":"desc"') ? A = "<" + A : A = ">" + A, s === 1 || d.length === 0)
|
|
1029
1094
|
return {
|
|
1030
|
-
field:
|
|
1031
|
-
id: this.result[
|
|
1095
|
+
field: A,
|
|
1096
|
+
id: this.result[h][this.result[h].length - 1][c]
|
|
1032
1097
|
};
|
|
1033
1098
|
let N = "";
|
|
1034
|
-
const [
|
|
1035
|
-
return (
|
|
1036
|
-
field:
|
|
1037
|
-
id: `$result[${[
|
|
1099
|
+
const [p, L] = O;
|
|
1100
|
+
return (p === "tasks.task.list" || p === "task.item.list") && (N = "[tasks]"), ["crm.item.list", "crm.stagehistory.list"].includes(p) && (N = "[items]"), p === "crm.type.list" && (N = "[types]"), p === "socialnetwork.api.workgroup.list" && (N = "[workgroups]"), {
|
|
1101
|
+
field: A,
|
|
1102
|
+
id: `$result[${[h, s - 1].join("__")}]${N}[49][${c}]`
|
|
1038
1103
|
};
|
|
1039
|
-
}, a = (
|
|
1040
|
-
const [
|
|
1041
|
-
let
|
|
1042
|
-
if (
|
|
1043
|
-
|
|
1044
|
-
const [
|
|
1045
|
-
return N[s.field] = s.id, [
|
|
1104
|
+
}, a = (h, s) => {
|
|
1105
|
+
const [d, O] = h;
|
|
1106
|
+
let c = JSON.parse(JSON.stringify(O)), A;
|
|
1107
|
+
if (d === "task.item.list") {
|
|
1108
|
+
c = [...c];
|
|
1109
|
+
const [g, N, p, L] = c;
|
|
1110
|
+
return N[s.field] = s.id, [d, c];
|
|
1046
1111
|
}
|
|
1047
|
-
return ["user.get"].includes(
|
|
1112
|
+
return ["user.get"].includes(d) || c.FILTER ? (c.FILTER || (c.FILTER = {}), A = c.FILTER) : (c.filter || (c.filter = {}), A = c.filter), [
|
|
1048
1113
|
"socialnetwork.api.workgroup.list",
|
|
1049
1114
|
"tasks.task.list"
|
|
1050
|
-
].includes(
|
|
1051
|
-
}, l = (
|
|
1052
|
-
Object.entries(
|
|
1053
|
-
var
|
|
1054
|
-
const [
|
|
1055
|
-
if (Array.isArray(
|
|
1056
|
-
this.errors[
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1115
|
+
].includes(d) ? A[">ID"] = s.id : A[s.field] = s.id, [d, { ...c, start: -1 }];
|
|
1116
|
+
}, l = (h) => {
|
|
1117
|
+
Object.entries(h).forEach(([s, d]) => {
|
|
1118
|
+
var A, g, N, p, L, U, P;
|
|
1119
|
+
const [O] = s.split("__"), c = this.getData(d.data());
|
|
1120
|
+
if (Array.isArray(c) && (r === "count" ? this.result[O] += c.length : this.result[O].push(...c)), d.error()) {
|
|
1121
|
+
this.errors[O] = ((g = (A = d.error()) == null ? void 0 : A.ex) == null ? void 0 : g.error) ?? ((p = (N = d.error()) == null ? void 0 : N.ex) == null ? void 0 : p.error_description) ?? ((L = d.error()) == null ? void 0 : L.toString()) ?? "Неизвестная ошибка";
|
|
1122
|
+
const W = ((P = (U = d.error()) == null ? void 0 : U.ex) == null ? void 0 : P.error) ?? "", b = i.get(O);
|
|
1123
|
+
switch (W) {
|
|
1124
|
+
case "OPERATION_TIME_LIMIT":
|
|
1125
|
+
b && (this.skipList.add(b), this.limitCall && this.limitCall(O));
|
|
1126
|
+
break;
|
|
1127
|
+
case "QUERY_LIMIT_EXCEEDED":
|
|
1128
|
+
this.canContinue = !1;
|
|
1129
|
+
break;
|
|
1130
|
+
case "ACCESS_DENIED":
|
|
1131
|
+
b && this.skipList.add(b);
|
|
1132
|
+
break;
|
|
1133
|
+
case "TIMEOUT":
|
|
1134
|
+
b && (this.skipList.add(b), this.limitCall && this.limitCall(O));
|
|
1135
|
+
break;
|
|
1072
1136
|
}
|
|
1073
1137
|
}
|
|
1074
|
-
this.setProgressData({ key:
|
|
1138
|
+
this.setProgressData({ key: O, value: d, type: r });
|
|
1075
1139
|
});
|
|
1076
1140
|
};
|
|
1077
|
-
let
|
|
1078
|
-
for await (const [
|
|
1141
|
+
let u = [];
|
|
1142
|
+
for await (const [h, s, d] of e) {
|
|
1079
1143
|
if (!this.canContinue)
|
|
1080
1144
|
return;
|
|
1081
|
-
const [
|
|
1082
|
-
if (i.set(
|
|
1145
|
+
const [O] = s;
|
|
1146
|
+
if (i.set(h, O), this.skipList.has(O))
|
|
1083
1147
|
continue;
|
|
1084
|
-
let
|
|
1085
|
-
for (;
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1088
|
-
(
|
|
1089
|
-
|
|
1090
|
-
(
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
)
|
|
1094
|
-
), m = [], await this.delay()), h++;
|
|
1148
|
+
let c = 1;
|
|
1149
|
+
for (; d > c * 50 && !this.skipList.has(O); ) {
|
|
1150
|
+
const A = [h, c].join("__"), g = o(h, c, u, s);
|
|
1151
|
+
u.push([A, a(s, g)]), u.length % 50 === 0 && (await this.callBatchWithTimeout(
|
|
1152
|
+
Object.fromEntries(u),
|
|
1153
|
+
(N) => {
|
|
1154
|
+
l(N);
|
|
1155
|
+
}
|
|
1156
|
+
), u = [], await this.delay()), c++;
|
|
1095
1157
|
}
|
|
1096
1158
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1159
|
+
u.length && (await this.callBatchWithTimeout(
|
|
1160
|
+
Object.fromEntries(u),
|
|
1161
|
+
(h) => {
|
|
1162
|
+
l(h);
|
|
1163
|
+
}
|
|
1101
1164
|
), await this.delay());
|
|
1102
1165
|
}
|
|
1103
1166
|
/**
|
|
@@ -1109,10 +1172,10 @@ class v {
|
|
|
1109
1172
|
}), console.groupEnd();
|
|
1110
1173
|
}
|
|
1111
1174
|
}
|
|
1112
|
-
var
|
|
1175
|
+
var K;
|
|
1113
1176
|
class ut {
|
|
1114
1177
|
constructor() {
|
|
1115
|
-
H(this,
|
|
1178
|
+
H(this, K, {});
|
|
1116
1179
|
}
|
|
1117
1180
|
/**
|
|
1118
1181
|
* Получить случайный хеш-код длиной 8 символов
|
|
@@ -1129,7 +1192,7 @@ class ut {
|
|
|
1129
1192
|
createHash(e) {
|
|
1130
1193
|
let r = "abcdefghijklmnopqrstuvwxyz0123456789", i = "";
|
|
1131
1194
|
e = e || 6;
|
|
1132
|
-
for (let
|
|
1195
|
+
for (let o = 0; o < e; o++)
|
|
1133
1196
|
i += r.charAt(Math.floor(Math.random() * r.length));
|
|
1134
1197
|
return i;
|
|
1135
1198
|
}
|
|
@@ -1141,7 +1204,7 @@ class ut {
|
|
|
1141
1204
|
* @param {Function} params.action - Функция для выполнения
|
|
1142
1205
|
*/
|
|
1143
1206
|
actionFilter({ keyTimer: e, duration: r = 10, action: i }) {
|
|
1144
|
-
E(this,
|
|
1207
|
+
E(this, K)[e] && (clearTimeout(E(this, K)[e]), E(this, K)[e] = null), i && (E(this, K)[e] = setTimeout(() => {
|
|
1145
1208
|
i();
|
|
1146
1209
|
}, r));
|
|
1147
1210
|
}
|
|
@@ -1173,15 +1236,15 @@ class ut {
|
|
|
1173
1236
|
* @param {string} filename - Имя файла без расширения
|
|
1174
1237
|
*/
|
|
1175
1238
|
downloadFileJson(e, r) {
|
|
1176
|
-
let i = new Blob([JSON.stringify(e)], { type: "application/json" }),
|
|
1177
|
-
a.style.display = "none", a.href =
|
|
1178
|
-
document.body.removeChild(a), URL.revokeObjectURL(
|
|
1239
|
+
let i = new Blob([JSON.stringify(e)], { type: "application/json" }), o = URL.createObjectURL(i), a = document.createElement("a");
|
|
1240
|
+
a.style.display = "none", a.href = o, a.download = `${r}.json`, document.body.appendChild(a), a.click(), setTimeout(() => {
|
|
1241
|
+
document.body.removeChild(a), URL.revokeObjectURL(o);
|
|
1179
1242
|
}, 200);
|
|
1180
1243
|
}
|
|
1181
1244
|
}
|
|
1182
|
-
|
|
1183
|
-
const
|
|
1184
|
-
var X, Q,
|
|
1245
|
+
K = new WeakMap();
|
|
1246
|
+
const lt = new ut();
|
|
1247
|
+
var X, Q, Z, z, G, V, q, rt, ft, $, ht, st, mt, it, dt, nt, gt;
|
|
1185
1248
|
class Rt {
|
|
1186
1249
|
constructor() {
|
|
1187
1250
|
H(this, rt);
|
|
@@ -1194,13 +1257,13 @@ class Rt {
|
|
|
1194
1257
|
H(this, nt);
|
|
1195
1258
|
H(this, X, "logger");
|
|
1196
1259
|
H(this, Q, !1);
|
|
1197
|
-
H(this,
|
|
1260
|
+
H(this, Z, /* @__PURE__ */ new Map());
|
|
1198
1261
|
H(this, z, {});
|
|
1199
|
-
H(this,
|
|
1262
|
+
H(this, G, null);
|
|
1200
1263
|
H(this, V, !1);
|
|
1201
1264
|
H(this, q, !1);
|
|
1202
1265
|
/** Очистка хранилища элементов старше 'N' месяцев */
|
|
1203
|
-
|
|
1266
|
+
M(this, "periodClear", 3);
|
|
1204
1267
|
J(this, rt, ft).call(this);
|
|
1205
1268
|
}
|
|
1206
1269
|
/** Инициализация логера */
|
|
@@ -1211,11 +1274,11 @@ class Rt {
|
|
|
1211
1274
|
});
|
|
1212
1275
|
if (r && Array.isArray(r))
|
|
1213
1276
|
if (r.find(
|
|
1214
|
-
(
|
|
1277
|
+
(o) => o.ENTITY == E(this, X)
|
|
1215
1278
|
))
|
|
1216
|
-
|
|
1279
|
+
F(this, Q, !0);
|
|
1217
1280
|
else {
|
|
1218
|
-
let { entityAdd:
|
|
1281
|
+
let { entityAdd: o } = await e.batch({
|
|
1219
1282
|
entityAdd: {
|
|
1220
1283
|
method: "entity.add",
|
|
1221
1284
|
params: {
|
|
@@ -1225,7 +1288,7 @@ class Rt {
|
|
|
1225
1288
|
}
|
|
1226
1289
|
}
|
|
1227
1290
|
});
|
|
1228
|
-
|
|
1291
|
+
o && F(this, Q, !0);
|
|
1229
1292
|
}
|
|
1230
1293
|
return J(this, it, dt).call(this).catch((i) => {
|
|
1231
1294
|
console.error("Ошибка при проверке периода очистки:", i);
|
|
@@ -1245,10 +1308,10 @@ class Rt {
|
|
|
1245
1308
|
*/
|
|
1246
1309
|
start({ type: e, data: r }) {
|
|
1247
1310
|
if (!E(this, Q))
|
|
1248
|
-
return J(this, $,
|
|
1311
|
+
return J(this, $, ht).call(this, "entity"), null;
|
|
1249
1312
|
if (!e || !r)
|
|
1250
1313
|
return console.error("Невалидные данные для логирования:", { type: e, data: r }), null;
|
|
1251
|
-
const i =
|
|
1314
|
+
const i = lt.hash, o = {
|
|
1252
1315
|
type: e,
|
|
1253
1316
|
data: r,
|
|
1254
1317
|
userInfo: E(this, z),
|
|
@@ -1257,7 +1320,7 @@ class Rt {
|
|
|
1257
1320
|
answer: null,
|
|
1258
1321
|
date: (/* @__PURE__ */ new Date()).getTime()
|
|
1259
1322
|
};
|
|
1260
|
-
return E(this,
|
|
1323
|
+
return E(this, Z).set(i, o), F(this, q, !0), i;
|
|
1261
1324
|
}
|
|
1262
1325
|
/**
|
|
1263
1326
|
* @param {{
|
|
@@ -1266,20 +1329,20 @@ class Rt {
|
|
|
1266
1329
|
* status: 'success'|'fail'|'fail-runtime',
|
|
1267
1330
|
* answer: { [key]: unknown } }}
|
|
1268
1331
|
*/
|
|
1269
|
-
async stop({ key: e, errorList: r, status: i, answer:
|
|
1332
|
+
async stop({ key: e, errorList: r, status: i, answer: o }) {
|
|
1270
1333
|
var l;
|
|
1271
1334
|
if (!E(this, q))
|
|
1272
1335
|
return;
|
|
1273
1336
|
if (!E(this, Q)) {
|
|
1274
|
-
J(this, $,
|
|
1337
|
+
J(this, $, ht).call(this, "entity");
|
|
1275
1338
|
return;
|
|
1276
1339
|
}
|
|
1277
|
-
let a = E(this,
|
|
1340
|
+
let a = E(this, Z).get(e);
|
|
1278
1341
|
if (!a) {
|
|
1279
1342
|
console.error(`Не найдены данные логирования для ключа: ${e}`);
|
|
1280
1343
|
return;
|
|
1281
1344
|
}
|
|
1282
|
-
r && (a.errorList = r), i && (a.status = i),
|
|
1345
|
+
r && (a.errorList = r), i && (a.status = i), o && (a.answer = o), await J(this, st, mt).call(this), (l = a == null ? void 0 : a.data) != null && l.updateList && F(this, V, !0), F(this, q, !1);
|
|
1283
1346
|
}
|
|
1284
1347
|
/**
|
|
1285
1348
|
* @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
|
|
@@ -1287,9 +1350,9 @@ class Rt {
|
|
|
1287
1350
|
async getEntityList(e) {
|
|
1288
1351
|
var r;
|
|
1289
1352
|
try {
|
|
1290
|
-
if ((r = E(this,
|
|
1291
|
-
return E(this,
|
|
1292
|
-
let i = new v(BX24.callBatch), { entityList:
|
|
1353
|
+
if ((r = E(this, G)) != null && r.length && !E(this, V))
|
|
1354
|
+
return E(this, G);
|
|
1355
|
+
let i = new v(BX24.callBatch), { entityList: o } = await i.batch(
|
|
1293
1356
|
{
|
|
1294
1357
|
entityList: {
|
|
1295
1358
|
method: "entity.item.get",
|
|
@@ -1301,13 +1364,13 @@ class Rt {
|
|
|
1301
1364
|
},
|
|
1302
1365
|
e
|
|
1303
1366
|
);
|
|
1304
|
-
return !
|
|
1367
|
+
return !o || !Array.isArray(o) ? (console.warn("Получен невалидный список записей"), []) : (o = o.map((a) => {
|
|
1305
1368
|
try {
|
|
1306
|
-
const { ID: l, DATE_CREATE:
|
|
1369
|
+
const { ID: l, DATE_CREATE: u, DETAIL_TEXT: h } = a;
|
|
1307
1370
|
return {
|
|
1308
|
-
...JSON.parse(
|
|
1371
|
+
...JSON.parse(h),
|
|
1309
1372
|
id: l,
|
|
1310
|
-
dateCreate:
|
|
1373
|
+
dateCreate: u
|
|
1311
1374
|
};
|
|
1312
1375
|
} catch (l) {
|
|
1313
1376
|
return console.error(
|
|
@@ -1315,7 +1378,7 @@ class Rt {
|
|
|
1315
1378
|
l
|
|
1316
1379
|
), null;
|
|
1317
1380
|
}
|
|
1318
|
-
}).filter((a) => a !== null),
|
|
1381
|
+
}).filter((a) => a !== null), F(this, V, !1), F(this, G, o), o);
|
|
1319
1382
|
} catch (i) {
|
|
1320
1383
|
return console.error("Ошибка при получении списка записей:", i), [];
|
|
1321
1384
|
}
|
|
@@ -1323,11 +1386,11 @@ class Rt {
|
|
|
1323
1386
|
/** Выгрузка всех данных из хранилища в JSON-файл */
|
|
1324
1387
|
async downAllEntityJson() {
|
|
1325
1388
|
try {
|
|
1326
|
-
if (E(this,
|
|
1389
|
+
if (E(this, G) || await this.getEntityList(), !E(this, G) || E(this, G).length === 0)
|
|
1327
1390
|
return console.warn("Нет данных для выгрузки"), !1;
|
|
1328
1391
|
let e = et().format("%Y-%m-%d");
|
|
1329
|
-
return
|
|
1330
|
-
E(this,
|
|
1392
|
+
return lt.downloadFileJson(
|
|
1393
|
+
E(this, G),
|
|
1331
1394
|
`sdklogger-entity-data__${e}`
|
|
1332
1395
|
), !0;
|
|
1333
1396
|
} catch (e) {
|
|
@@ -1335,20 +1398,20 @@ class Rt {
|
|
|
1335
1398
|
}
|
|
1336
1399
|
}
|
|
1337
1400
|
}
|
|
1338
|
-
X = new WeakMap(), Q = new WeakMap(),
|
|
1401
|
+
X = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), z = new WeakMap(), G = new WeakMap(), V = new WeakMap(), q = new WeakMap(), rt = new WeakSet(), ft = async function() {
|
|
1339
1402
|
try {
|
|
1340
1403
|
const e = new v(BX24.callBatch), r = BX24.isAdmin(), { curUser: i } = await e.batch({
|
|
1341
1404
|
curUser: { method: "user.current" }
|
|
1342
1405
|
});
|
|
1343
|
-
|
|
1406
|
+
F(this, z, { isAdmin: r, curUser: i });
|
|
1344
1407
|
} catch (e) {
|
|
1345
1408
|
console.error(
|
|
1346
1409
|
"Ошибка при получении информации о пользователе:",
|
|
1347
1410
|
e
|
|
1348
|
-
),
|
|
1411
|
+
), F(this, z, { isAdmin: !1, curUser: null });
|
|
1349
1412
|
}
|
|
1350
|
-
}, $ = new WeakSet(),
|
|
1351
|
-
e == "entity" &&
|
|
1413
|
+
}, $ = new WeakSet(), ht = function(e) {
|
|
1414
|
+
e == "entity" && lt.actionFilter({
|
|
1352
1415
|
keyTimer: "error.logger.entity",
|
|
1353
1416
|
duration: 500,
|
|
1354
1417
|
action: () => {
|
|
@@ -1358,9 +1421,9 @@ X = new WeakMap(), Q = new WeakMap(), K = new WeakMap(), z = new WeakMap(), C =
|
|
|
1358
1421
|
}, st = new WeakSet(), mt = async function() {
|
|
1359
1422
|
try {
|
|
1360
1423
|
let e = {}, r = new v(BX24.callBatch);
|
|
1361
|
-
for (let [i,
|
|
1362
|
-
if (
|
|
1363
|
-
const a = JSON.stringify(
|
|
1424
|
+
for (let [i, o] of E(this, Z).entries())
|
|
1425
|
+
if (o.status) {
|
|
1426
|
+
const a = JSON.stringify(o);
|
|
1364
1427
|
e[i] = {
|
|
1365
1428
|
method: "entity.item.add",
|
|
1366
1429
|
params: {
|
|
@@ -1371,9 +1434,9 @@ X = new WeakMap(), Q = new WeakMap(), K = new WeakMap(), z = new WeakMap(), C =
|
|
|
1371
1434
|
};
|
|
1372
1435
|
}
|
|
1373
1436
|
if (Object.keys(e).length) {
|
|
1374
|
-
let i = await r.batch(e), { errors:
|
|
1375
|
-
for (let [a, l] of Object.entries({ ...i, ...
|
|
1376
|
-
E(this,
|
|
1437
|
+
let i = await r.batch(e), { errors: o } = r;
|
|
1438
|
+
for (let [a, l] of Object.entries({ ...i, ...o }))
|
|
1439
|
+
E(this, Z).delete(a);
|
|
1377
1440
|
return !0;
|
|
1378
1441
|
}
|
|
1379
1442
|
return !1;
|
|
@@ -1389,11 +1452,11 @@ X = new WeakMap(), Q = new WeakMap(), K = new WeakMap(), z = new WeakMap(), C =
|
|
|
1389
1452
|
console.error("Не удалось получить время сервера");
|
|
1390
1453
|
return;
|
|
1391
1454
|
}
|
|
1392
|
-
if (E(this,
|
|
1455
|
+
if (E(this, G) || await this.getEntityList(), !E(this, G) || E(this, G).length === 0)
|
|
1393
1456
|
return;
|
|
1394
|
-
let i = E(this,
|
|
1457
|
+
let i = E(this, G).filter((o) => {
|
|
1395
1458
|
try {
|
|
1396
|
-
let { dateCreate: a } =
|
|
1459
|
+
let { dateCreate: a } = o;
|
|
1397
1460
|
return a ? et(new Date(a)).between(
|
|
1398
1461
|
et(new Date(r)),
|
|
1399
1462
|
"month"
|
|
@@ -1424,14 +1487,14 @@ X = new WeakMap(), Q = new WeakMap(), K = new WeakMap(), z = new WeakMap(), C =
|
|
|
1424
1487
|
});
|
|
1425
1488
|
if (i.length === 0)
|
|
1426
1489
|
return !1;
|
|
1427
|
-
const
|
|
1428
|
-
return console.log(`Успешно удалено ${i.length} записей`),
|
|
1490
|
+
const o = await r.batch(i);
|
|
1491
|
+
return console.log(`Успешно удалено ${i.length} записей`), F(this, V, !0), o;
|
|
1429
1492
|
} catch (r) {
|
|
1430
1493
|
return console.error("Ошибка при очистке устаревших записей:", r), !1;
|
|
1431
1494
|
}
|
|
1432
1495
|
};
|
|
1433
|
-
var
|
|
1434
|
-
class
|
|
1496
|
+
var ot, Nt, at, pt;
|
|
1497
|
+
class Lt {
|
|
1435
1498
|
/**
|
|
1436
1499
|
* @param {Object} appConst - Константы приложения
|
|
1437
1500
|
* @param {string} appConst.appName - Название приложения
|
|
@@ -1439,17 +1502,17 @@ class bt {
|
|
|
1439
1502
|
*/
|
|
1440
1503
|
constructor(e) {
|
|
1441
1504
|
/** Запрос данных о приложении */
|
|
1442
|
-
H(this,
|
|
1505
|
+
H(this, ot);
|
|
1443
1506
|
/** Запрос данных о текущем пользователе */
|
|
1444
1507
|
H(this, at);
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1508
|
+
M(this, "domain", "");
|
|
1509
|
+
M(this, "isAdmin", !1);
|
|
1510
|
+
M(this, "appInfo", null);
|
|
1511
|
+
M(this, "appConst", null);
|
|
1512
|
+
M(this, "userInfo", null);
|
|
1513
|
+
M(this, "placeData", null);
|
|
1514
|
+
M(this, "placeInfo", null);
|
|
1515
|
+
M(this, "logger", !1);
|
|
1453
1516
|
this.appConst = e;
|
|
1454
1517
|
}
|
|
1455
1518
|
/**
|
|
@@ -1459,9 +1522,9 @@ class bt {
|
|
|
1459
1522
|
*/
|
|
1460
1523
|
init() {
|
|
1461
1524
|
return new Promise((e, r) => {
|
|
1462
|
-
let
|
|
1525
|
+
let o = setInterval(() => {
|
|
1463
1526
|
window.BX24 && BX24.init(async () => {
|
|
1464
|
-
console.info("init BX24"), clearInterval(
|
|
1527
|
+
console.info("init BX24"), clearInterval(o), clearTimeout(a), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), this.logger ? (this.logger = new Rt(), await this.logger.init()) : this.logger = {
|
|
1465
1528
|
start: () => {
|
|
1466
1529
|
},
|
|
1467
1530
|
stop: () => {
|
|
@@ -1469,14 +1532,14 @@ class bt {
|
|
|
1469
1532
|
getEntityList: () => {
|
|
1470
1533
|
}
|
|
1471
1534
|
};
|
|
1472
|
-
const [l,
|
|
1473
|
-
J(this,
|
|
1474
|
-
J(this, at,
|
|
1535
|
+
const [l, u] = await Promise.all([
|
|
1536
|
+
J(this, ot, Nt).call(this),
|
|
1537
|
+
J(this, at, pt).call(this)
|
|
1475
1538
|
]);
|
|
1476
|
-
this.appInfo = l, this.userInfo =
|
|
1477
|
-
let
|
|
1539
|
+
this.appInfo = l, this.userInfo = u;
|
|
1540
|
+
let h = new ut();
|
|
1478
1541
|
try {
|
|
1479
|
-
|
|
1542
|
+
h.noSleep();
|
|
1480
1543
|
} catch (s) {
|
|
1481
1544
|
console.warn(
|
|
1482
1545
|
"Failed to initialize noSleep:",
|
|
@@ -1487,7 +1550,7 @@ class bt {
|
|
|
1487
1550
|
});
|
|
1488
1551
|
}, 100);
|
|
1489
1552
|
const a = setTimeout(() => {
|
|
1490
|
-
clearInterval(
|
|
1553
|
+
clearInterval(o);
|
|
1491
1554
|
const l = new Error(
|
|
1492
1555
|
"BX24 initialization timeout: BX24 object not found within 30 seconds"
|
|
1493
1556
|
);
|
|
@@ -1538,8 +1601,8 @@ class bt {
|
|
|
1538
1601
|
* }[]
|
|
1539
1602
|
*/
|
|
1540
1603
|
async call({ method: e, params: r, updateList: i }) {
|
|
1541
|
-
let
|
|
1542
|
-
if (i && (
|
|
1604
|
+
let o;
|
|
1605
|
+
if (i && (o = this.logger.start({
|
|
1543
1606
|
type: "call",
|
|
1544
1607
|
data: { method: e, params: r, updateList: i }
|
|
1545
1608
|
})), r || (r = {}), typeof BX24 > "u" || !BX24.callMethod) {
|
|
@@ -1547,36 +1610,36 @@ class bt {
|
|
|
1547
1610
|
throw console.error(a), a;
|
|
1548
1611
|
}
|
|
1549
1612
|
return new Promise((a, l) => {
|
|
1550
|
-
BX24.callMethod(e, r, async (
|
|
1551
|
-
let
|
|
1552
|
-
if (
|
|
1553
|
-
for (let [s,
|
|
1554
|
-
s !== "result" &&
|
|
1555
|
-
if (
|
|
1556
|
-
let s =
|
|
1557
|
-
if (console.error(s),
|
|
1613
|
+
BX24.callMethod(e, r, async (u) => {
|
|
1614
|
+
let h = {};
|
|
1615
|
+
if (u != null && u.answer)
|
|
1616
|
+
for (let [s, d] of Object.entries(u.answer))
|
|
1617
|
+
s !== "result" && d && (h[s] = d);
|
|
1618
|
+
if (u.error()) {
|
|
1619
|
+
let s = u.error();
|
|
1620
|
+
if (console.error(s), o)
|
|
1558
1621
|
try {
|
|
1559
1622
|
await this.logger.stop({
|
|
1560
|
-
answer:
|
|
1561
|
-
key:
|
|
1623
|
+
answer: h,
|
|
1624
|
+
key: o,
|
|
1562
1625
|
status: "fail",
|
|
1563
1626
|
errorList: { 0: s.toString() }
|
|
1564
1627
|
});
|
|
1565
|
-
} catch (
|
|
1566
|
-
console.error("Logger error:",
|
|
1628
|
+
} catch (d) {
|
|
1629
|
+
console.error("Logger error:", d);
|
|
1567
1630
|
}
|
|
1568
1631
|
a(!1);
|
|
1569
1632
|
} else {
|
|
1570
|
-
let s =
|
|
1571
|
-
if (s != null && s.items && (s = s.items),
|
|
1633
|
+
let s = u.data();
|
|
1634
|
+
if (s != null && s.items && (s = s.items), o)
|
|
1572
1635
|
try {
|
|
1573
1636
|
await this.logger.stop({
|
|
1574
|
-
answer:
|
|
1575
|
-
key:
|
|
1637
|
+
answer: h,
|
|
1638
|
+
key: o,
|
|
1576
1639
|
status: "success"
|
|
1577
1640
|
});
|
|
1578
|
-
} catch (
|
|
1579
|
-
console.error("Logger error:",
|
|
1641
|
+
} catch (d) {
|
|
1642
|
+
console.error("Logger error:", d);
|
|
1580
1643
|
}
|
|
1581
1644
|
a(s);
|
|
1582
1645
|
}
|
|
@@ -1602,55 +1665,55 @@ class bt {
|
|
|
1602
1665
|
* }[]
|
|
1603
1666
|
* }}
|
|
1604
1667
|
*/
|
|
1605
|
-
async batch(e, r, { errorCall: i, limitCommandSerial:
|
|
1668
|
+
async batch(e, r, { errorCall: i, limitCommandSerial: o, updateList: a, limitCall: l } = {}) {
|
|
1606
1669
|
if (typeof BX24 > "u" || !BX24.callBatch) {
|
|
1607
1670
|
const s = new Error("BX24 is not initialized");
|
|
1608
1671
|
return console.error(s), !1;
|
|
1609
1672
|
}
|
|
1610
|
-
let
|
|
1611
|
-
a && (
|
|
1673
|
+
let u = new v(BX24.callBatch), h;
|
|
1674
|
+
a && (h = this.logger.start({
|
|
1612
1675
|
type: "batch",
|
|
1613
1676
|
data: { commandList: e, updateList: a }
|
|
1614
|
-
})),
|
|
1677
|
+
})), o && console.warn(
|
|
1615
1678
|
"limitCommandSerial is deprecated and not used in current Batch implementation"
|
|
1616
1679
|
);
|
|
1617
1680
|
try {
|
|
1618
|
-
let s = await
|
|
1681
|
+
let s = await u.batch(
|
|
1619
1682
|
e,
|
|
1620
1683
|
r,
|
|
1621
1684
|
l
|
|
1622
1685
|
);
|
|
1623
|
-
if (Object.keys(
|
|
1624
|
-
if (i && i(
|
|
1686
|
+
if (Object.keys(u.errors).length) {
|
|
1687
|
+
if (i && i(u.errors), h)
|
|
1625
1688
|
try {
|
|
1626
1689
|
await this.logger.stop({
|
|
1627
|
-
key:
|
|
1690
|
+
key: h,
|
|
1628
1691
|
status: "fail",
|
|
1629
|
-
errorList:
|
|
1692
|
+
errorList: u.errors
|
|
1630
1693
|
});
|
|
1631
|
-
} catch (
|
|
1632
|
-
console.error("Logger error:",
|
|
1694
|
+
} catch (d) {
|
|
1695
|
+
console.error("Logger error:", d);
|
|
1633
1696
|
}
|
|
1634
|
-
} else if (
|
|
1697
|
+
} else if (h)
|
|
1635
1698
|
try {
|
|
1636
1699
|
await this.logger.stop({
|
|
1637
|
-
key:
|
|
1700
|
+
key: h,
|
|
1638
1701
|
status: "success"
|
|
1639
1702
|
});
|
|
1640
|
-
} catch (
|
|
1641
|
-
console.error("Logger error:",
|
|
1703
|
+
} catch (d) {
|
|
1704
|
+
console.error("Logger error:", d);
|
|
1642
1705
|
}
|
|
1643
1706
|
return s;
|
|
1644
1707
|
} catch (s) {
|
|
1645
|
-
if (
|
|
1708
|
+
if (h)
|
|
1646
1709
|
try {
|
|
1647
1710
|
await this.logger.stop({
|
|
1648
|
-
key:
|
|
1711
|
+
key: h,
|
|
1649
1712
|
status: "fail-runtime",
|
|
1650
1713
|
errorList: { 0: s == null ? void 0 : s.toString() }
|
|
1651
1714
|
});
|
|
1652
|
-
} catch (
|
|
1653
|
-
console.error("Logger error:",
|
|
1715
|
+
} catch (d) {
|
|
1716
|
+
console.error("Logger error:", d);
|
|
1654
1717
|
}
|
|
1655
1718
|
return console.error(s), !1;
|
|
1656
1719
|
}
|
|
@@ -1678,55 +1741,55 @@ class bt {
|
|
|
1678
1741
|
* }}
|
|
1679
1742
|
* @returns {Promise<Object|false>}
|
|
1680
1743
|
*/
|
|
1681
|
-
async batchTotalCount(e, r, { errorCall: i, updateList:
|
|
1744
|
+
async batchTotalCount(e, r, { errorCall: i, updateList: o, limitCall: a } = {}) {
|
|
1682
1745
|
if (typeof BX24 > "u" || !BX24.callBatch) {
|
|
1683
|
-
const
|
|
1684
|
-
return console.error(
|
|
1746
|
+
const h = new Error("BX24 is not initialized");
|
|
1747
|
+
return console.error(h), !1;
|
|
1685
1748
|
}
|
|
1686
|
-
let l = new v(BX24.callBatch),
|
|
1687
|
-
|
|
1749
|
+
let l = new v(BX24.callBatch), u;
|
|
1750
|
+
o && (u = this.logger.start({
|
|
1688
1751
|
type: "batch-total-count",
|
|
1689
1752
|
data: { commandList: e }
|
|
1690
1753
|
}));
|
|
1691
1754
|
try {
|
|
1692
|
-
let
|
|
1755
|
+
let h = await l.batchTotalCount(
|
|
1693
1756
|
e,
|
|
1694
1757
|
r,
|
|
1695
1758
|
a
|
|
1696
1759
|
);
|
|
1697
1760
|
if (Object.keys(l.errors).length) {
|
|
1698
|
-
if (i && i(l.errors),
|
|
1761
|
+
if (i && i(l.errors), u)
|
|
1699
1762
|
try {
|
|
1700
1763
|
await this.logger.stop({
|
|
1701
|
-
key:
|
|
1764
|
+
key: u,
|
|
1702
1765
|
status: "fail",
|
|
1703
1766
|
errorList: l.errors
|
|
1704
1767
|
});
|
|
1705
1768
|
} catch (s) {
|
|
1706
1769
|
console.error("Logger error:", s);
|
|
1707
1770
|
}
|
|
1708
|
-
} else if (
|
|
1771
|
+
} else if (u)
|
|
1709
1772
|
try {
|
|
1710
1773
|
await this.logger.stop({
|
|
1711
|
-
key:
|
|
1774
|
+
key: u,
|
|
1712
1775
|
status: "success"
|
|
1713
1776
|
});
|
|
1714
1777
|
} catch (s) {
|
|
1715
1778
|
console.error("Logger error:", s);
|
|
1716
1779
|
}
|
|
1717
|
-
return
|
|
1718
|
-
} catch (
|
|
1719
|
-
if (
|
|
1780
|
+
return h;
|
|
1781
|
+
} catch (h) {
|
|
1782
|
+
if (u)
|
|
1720
1783
|
try {
|
|
1721
1784
|
await this.logger.stop({
|
|
1722
|
-
key:
|
|
1785
|
+
key: u,
|
|
1723
1786
|
status: "fail-runtime",
|
|
1724
|
-
errorList: { 0:
|
|
1787
|
+
errorList: { 0: h == null ? void 0 : h.toString() }
|
|
1725
1788
|
});
|
|
1726
1789
|
} catch (s) {
|
|
1727
1790
|
console.error("Logger error:", s);
|
|
1728
1791
|
}
|
|
1729
|
-
return console.error(
|
|
1792
|
+
return console.error(h), !1;
|
|
1730
1793
|
}
|
|
1731
1794
|
}
|
|
1732
1795
|
/** Запрос данных о местах встройки приложения */
|
|
@@ -1735,99 +1798,99 @@ class bt {
|
|
|
1735
1798
|
}
|
|
1736
1799
|
/** Встройка приложения в place */
|
|
1737
1800
|
async placementBind(e, r = !0) {
|
|
1738
|
-
var
|
|
1801
|
+
var O, c;
|
|
1739
1802
|
if (!this.isAdmin)
|
|
1740
1803
|
return;
|
|
1741
1804
|
r && await this.placementCheck();
|
|
1742
1805
|
let i = [];
|
|
1743
|
-
if (Array.isArray(e) ? i = e.map((
|
|
1806
|
+
if (Array.isArray(e) ? i = e.map((A) => typeof A == "string" ? { placement: A } : A) : typeof e == "string" ? i = [{ placement: e }] : i = [e], this.placeData = await this.getPlacement(), !this.placeData)
|
|
1744
1807
|
return;
|
|
1745
|
-
const { appName:
|
|
1746
|
-
let l =
|
|
1747
|
-
this.domain === "szdl.bitrix24.ru" && ((
|
|
1748
|
-
const
|
|
1749
|
-
let
|
|
1750
|
-
for (let
|
|
1751
|
-
i[
|
|
1752
|
-
if (
|
|
1753
|
-
const
|
|
1808
|
+
const { appName: o, pathApp: a } = this.appConst;
|
|
1809
|
+
let l = o;
|
|
1810
|
+
this.domain === "szdl.bitrix24.ru" && ((O = this.appInfo) != null && O.ID) && (l = `${o}: #${this.appInfo.ID}`);
|
|
1811
|
+
const u = l.replace(" CRM", ""), h = {}, s = [];
|
|
1812
|
+
let d = !1;
|
|
1813
|
+
for (let A = 0; A < i.length; A++)
|
|
1814
|
+
i[A].placement === "PAGE_BACKGROUND_WORKER_ALL" && (d = !0);
|
|
1815
|
+
if (d && ((c = this.userInfo) != null && c.ID)) {
|
|
1816
|
+
const A = this.userInfo.ID, g = `${a}?USER_ID=${A}/`;
|
|
1754
1817
|
if (!this.placeData.find(
|
|
1755
|
-
(
|
|
1818
|
+
(p) => p.placement === "PAGE_BACKGROUND_WORKER" && p.handler === g
|
|
1756
1819
|
)) {
|
|
1757
|
-
const
|
|
1820
|
+
const p = {
|
|
1758
1821
|
PLACEMENT: "PAGE_BACKGROUND_WORKER",
|
|
1759
|
-
HANDLER:
|
|
1822
|
+
HANDLER: g,
|
|
1760
1823
|
LANG_ALL: {
|
|
1761
1824
|
ru: {
|
|
1762
1825
|
TITLE: l
|
|
1763
1826
|
}
|
|
1764
1827
|
},
|
|
1765
1828
|
OPTIONS: {
|
|
1766
|
-
errorHandlerUrl:
|
|
1829
|
+
errorHandlerUrl: g
|
|
1767
1830
|
},
|
|
1768
|
-
USER_ID:
|
|
1831
|
+
USER_ID: A
|
|
1769
1832
|
};
|
|
1770
|
-
|
|
1833
|
+
h[`bind_user_${A}`] = {
|
|
1771
1834
|
method: "placement.bind",
|
|
1772
|
-
params:
|
|
1773
|
-
}, console.log(`placementBind: Добавлено индивидуальное размещение для пользователя ${
|
|
1835
|
+
params: p
|
|
1836
|
+
}, console.log(`placementBind: Добавлено индивидуальное размещение для пользователя ${A} перед общим`);
|
|
1774
1837
|
}
|
|
1775
1838
|
}
|
|
1776
|
-
for (let
|
|
1777
|
-
const
|
|
1778
|
-
let
|
|
1839
|
+
for (let A = 0; A < i.length; A++) {
|
|
1840
|
+
const g = i[A], N = g.placement, p = g.userId;
|
|
1841
|
+
let L = a, U = N;
|
|
1779
1842
|
if (N === "PAGE_BACKGROUND_WORKER") {
|
|
1780
|
-
if (!
|
|
1843
|
+
if (!p) {
|
|
1781
1844
|
console.warn(`placementBind: userId is required for PAGE_BACKGROUND_WORKER, skipping ${N}`);
|
|
1782
1845
|
continue;
|
|
1783
1846
|
}
|
|
1784
|
-
|
|
1847
|
+
L = `${a}?USER_ID=${p}/`;
|
|
1785
1848
|
}
|
|
1786
|
-
if (N === "PAGE_BACKGROUND_WORKER_ALL" && (
|
|
1787
|
-
(
|
|
1849
|
+
if (N === "PAGE_BACKGROUND_WORKER_ALL" && (U = "PAGE_BACKGROUND_WORKER"), this.placeData.find(
|
|
1850
|
+
(k) => k.placement === U && k.handler === L
|
|
1788
1851
|
))
|
|
1789
1852
|
continue;
|
|
1790
|
-
let
|
|
1791
|
-
(
|
|
1853
|
+
let W = this.placeData.find(
|
|
1854
|
+
(k) => k.placement === U && k.handler !== L
|
|
1792
1855
|
);
|
|
1793
|
-
|
|
1794
|
-
const
|
|
1795
|
-
PLACEMENT:
|
|
1796
|
-
HANDLER:
|
|
1856
|
+
W && s.push({ placement: U, handler: W.handler });
|
|
1857
|
+
const b = {
|
|
1858
|
+
PLACEMENT: U,
|
|
1859
|
+
HANDLER: L,
|
|
1797
1860
|
LANG_ALL: {
|
|
1798
1861
|
ru: {
|
|
1799
|
-
TITLE:
|
|
1862
|
+
TITLE: U === "USER_PROFILE_TOOLBAR" ? u : l
|
|
1800
1863
|
}
|
|
1801
1864
|
},
|
|
1802
1865
|
OPTIONS: {
|
|
1803
|
-
errorHandlerUrl:
|
|
1866
|
+
errorHandlerUrl: L
|
|
1804
1867
|
}
|
|
1805
1868
|
};
|
|
1806
|
-
N === "PAGE_BACKGROUND_WORKER" &&
|
|
1869
|
+
N === "PAGE_BACKGROUND_WORKER" && p && (b.USER_ID = p), h[`bind_${A}`] = {
|
|
1807
1870
|
method: "placement.bind",
|
|
1808
|
-
params:
|
|
1871
|
+
params: b
|
|
1809
1872
|
};
|
|
1810
1873
|
}
|
|
1811
|
-
s.length > 0 && await this.placementUnBind(s), Object.keys(
|
|
1812
|
-
console.log("Приложение успешно встроено в",
|
|
1874
|
+
s.length > 0 && await this.placementUnBind(s), Object.keys(h).length > 0 && await this.batch(h), Object.keys(h).length > 0 && (this.placeData = await this.getPlacement(), Object.values(h).forEach((A) => {
|
|
1875
|
+
console.log("Приложение успешно встроено в", A.params.PLACEMENT);
|
|
1813
1876
|
}));
|
|
1814
1877
|
}
|
|
1815
1878
|
/* Отвязка встройки из place */
|
|
1816
1879
|
async placementUnBind(e) {
|
|
1817
1880
|
let r = [];
|
|
1818
|
-
Array.isArray(e) ? r = e.map((
|
|
1881
|
+
Array.isArray(e) ? r = e.map((o) => typeof o == "string" ? { placement: o } : o) : typeof e == "string" ? r = [{ placement: e }] : r = [e];
|
|
1819
1882
|
const i = {};
|
|
1820
|
-
for (let
|
|
1821
|
-
const a = r[
|
|
1883
|
+
for (let o = 0; o < r.length; o++) {
|
|
1884
|
+
const a = r[o], l = a.placement, u = a.handler, h = {
|
|
1822
1885
|
PLACEMENT: l
|
|
1823
1886
|
};
|
|
1824
|
-
|
|
1887
|
+
u && (h.HANDLER = u), i[`unbind_${o}`] = {
|
|
1825
1888
|
method: "placement.unbind",
|
|
1826
|
-
params:
|
|
1889
|
+
params: h
|
|
1827
1890
|
};
|
|
1828
1891
|
}
|
|
1829
|
-
Object.keys(i).length > 0 && (await this.batch(i), r.forEach((
|
|
1830
|
-
console.log("Встройка отвязана",
|
|
1892
|
+
Object.keys(i).length > 0 && (await this.batch(i), r.forEach((o) => {
|
|
1893
|
+
console.log("Встройка отвязана", o.placement);
|
|
1831
1894
|
}));
|
|
1832
1895
|
}
|
|
1833
1896
|
/** Удаляем фоновые обработчики прошлых версий и создаем новые */
|
|
@@ -1835,11 +1898,11 @@ class bt {
|
|
|
1835
1898
|
if (this.placeData = await this.getPlacement(), !this.placeData)
|
|
1836
1899
|
return;
|
|
1837
1900
|
const { pathApp: e } = this.appConst, r = [], i = [];
|
|
1838
|
-
for (const
|
|
1839
|
-
if (!
|
|
1901
|
+
for (const o of this.placeData) {
|
|
1902
|
+
if (!o.handler || o.handler.includes(e))
|
|
1840
1903
|
continue;
|
|
1841
|
-
const { placement: a, handler: l, userId:
|
|
1842
|
-
r.push({ placement: a, handler: l }), i.push({ placement: a, userId:
|
|
1904
|
+
const { placement: a, handler: l, userId: u } = o;
|
|
1905
|
+
r.push({ placement: a, handler: l }), i.push({ placement: a, userId: u });
|
|
1843
1906
|
}
|
|
1844
1907
|
r.length > 0 && await this.placementUnBind(r), i.length > 0 && await this.placementBind(i, !1);
|
|
1845
1908
|
}
|
|
@@ -1856,7 +1919,7 @@ class bt {
|
|
|
1856
1919
|
}
|
|
1857
1920
|
/* регистрация бота */
|
|
1858
1921
|
regBot({ code: e, type: r, name: i }) {
|
|
1859
|
-
const { appName:
|
|
1922
|
+
const { appName: o, pathApp: a, chatBotLogo: l } = this.appConst, u = this.appInfo.ID;
|
|
1860
1923
|
return this.call({
|
|
1861
1924
|
method: "imbot.register",
|
|
1862
1925
|
params: {
|
|
@@ -1872,7 +1935,7 @@ class bt {
|
|
|
1872
1935
|
// строковый идентификатор чат-бота, используется только в режиме Вебхуков
|
|
1873
1936
|
PROPERTIES: {
|
|
1874
1937
|
// Личные данные чат-бота (обяз.)
|
|
1875
|
-
NAME: `${i ??
|
|
1938
|
+
NAME: `${i ?? o} - бот #${u}`,
|
|
1876
1939
|
// Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1877
1940
|
LAST_NAME: "",
|
|
1878
1941
|
// Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
@@ -1892,7 +1955,7 @@ class bt {
|
|
|
1892
1955
|
// Аватар чат-бота - base64
|
|
1893
1956
|
}
|
|
1894
1957
|
}
|
|
1895
|
-
}).then((
|
|
1958
|
+
}).then((h) => (console.log("Чат-бот добавлен", h), h));
|
|
1896
1959
|
}
|
|
1897
1960
|
/* Убрать регистрацию бота */
|
|
1898
1961
|
unRegBot(e) {
|
|
@@ -1908,29 +1971,29 @@ class bt {
|
|
|
1908
1971
|
return this.logger.getEntityList(e);
|
|
1909
1972
|
}
|
|
1910
1973
|
}
|
|
1911
|
-
|
|
1974
|
+
ot = new WeakSet(), Nt = function() {
|
|
1912
1975
|
return this.call({ method: "app.info" });
|
|
1913
|
-
}, at = new WeakSet(),
|
|
1976
|
+
}, at = new WeakSet(), pt = function() {
|
|
1914
1977
|
return this.call({ method: "user.current" });
|
|
1915
1978
|
};
|
|
1916
1979
|
class St {
|
|
1917
1980
|
constructor(e) {
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1981
|
+
M(this, "entityName", "tabs");
|
|
1982
|
+
M(this, "maxTabs", 5);
|
|
1983
|
+
M(this, "interval");
|
|
1984
|
+
M(this, "id", 0);
|
|
1985
|
+
M(this, "tabList", []);
|
|
1986
|
+
M(this, "random", this.getRandomNum());
|
|
1987
|
+
M(this, "continueCondition");
|
|
1988
|
+
M(this, "defaultContinueBackground", () => !0);
|
|
1989
|
+
M(this, "activeMaxPause", 60 * 1e3 * 5 + this.random);
|
|
1990
|
+
M(this, "activeMinPause", 60 * 1e3 * 3 + this.random);
|
|
1928
1991
|
if (!e) {
|
|
1929
1992
|
console.error("В бек-воркер не переданы настройки, отмена вызова"), console.log("BackgroundWorker: Отмена конструктора - отсутствуют опции");
|
|
1930
1993
|
return;
|
|
1931
1994
|
}
|
|
1932
|
-
const { appFunc: r, bx: i, users:
|
|
1933
|
-
this.bx = i, this.appPath = i.appConst.pathApp ?? "", this.appName = i.appConst.appName ?? "", this.appInit = r, this.users =
|
|
1995
|
+
const { appFunc: r, bx: i, users: o, continueBackground: a } = e;
|
|
1996
|
+
this.bx = i, this.appPath = i.appConst.pathApp ?? "", this.appName = i.appConst.appName ?? "", this.appInit = r, this.users = o, this.start = /* @__PURE__ */ new Date(), this.continueCondition = typeof a == "function" ? a : this.defaultContinueBackground;
|
|
1934
1997
|
}
|
|
1935
1998
|
async init() {
|
|
1936
1999
|
if (!this.appInit) {
|
|
@@ -1941,6 +2004,10 @@ class St {
|
|
|
1941
2004
|
console.error("Не передан экземпляр bxBoot"), console.log("BackgroundWorker: Отмена init - отсутствует bx");
|
|
1942
2005
|
return;
|
|
1943
2006
|
}
|
|
2007
|
+
if (!await this.checkPlacementType()) {
|
|
2008
|
+
console.log("BackgroundWorker: Отмена init - общая встройка обнаружена при наличии индивидуальной");
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
1944
2011
|
if (await this.bx.placementBind(["PAGE_BACKGROUND_WORKER"]), !await this.continueBackground()) {
|
|
1945
2012
|
console.log("BackgroundWorker: Отмена init - условие запуска не выполнено");
|
|
1946
2013
|
return;
|
|
@@ -1954,7 +2021,7 @@ class St {
|
|
|
1954
2021
|
async checkEntity() {
|
|
1955
2022
|
var i;
|
|
1956
2023
|
const e = await this.bx.call({ method: "entity.get" });
|
|
1957
|
-
((i = e == null ? void 0 : e.find) == null ? void 0 : i.call(e, (
|
|
2024
|
+
((i = e == null ? void 0 : e.find) == null ? void 0 : i.call(e, (o) => o.ENTITY === this.entityName)) || await this.bx.call({
|
|
1958
2025
|
method: "entity.add",
|
|
1959
2026
|
params: {
|
|
1960
2027
|
ENTITY: this.entityName,
|
|
@@ -1982,8 +2049,8 @@ class St {
|
|
|
1982
2049
|
return { id: void 0, data: void 0 };
|
|
1983
2050
|
try {
|
|
1984
2051
|
return { id: i.ID, data: { ...JSON.parse(i.DETAIL_TEXT) } };
|
|
1985
|
-
} catch (
|
|
1986
|
-
return console.log(
|
|
2052
|
+
} catch (o) {
|
|
2053
|
+
return console.log(o), { id: i.ID, data: void 0 };
|
|
1987
2054
|
}
|
|
1988
2055
|
}) : [];
|
|
1989
2056
|
}
|
|
@@ -2033,6 +2100,36 @@ class St {
|
|
|
2033
2100
|
const e = Math.round(Number(Math.random().toFixed(2)) * 30);
|
|
2034
2101
|
return Math.round(Math.random()) ? e : -e;
|
|
2035
2102
|
}
|
|
2103
|
+
async checkPlacementType() {
|
|
2104
|
+
var e;
|
|
2105
|
+
try {
|
|
2106
|
+
const r = await this.bx.getPlacement();
|
|
2107
|
+
if (!r || !Array.isArray(r))
|
|
2108
|
+
return console.log("BackgroundWorker: Не удалось получить список размещений, продолжаем выполнение"), !0;
|
|
2109
|
+
const i = +(((e = this.bx.userInfo) == null ? void 0 : e.ID) ?? 0);
|
|
2110
|
+
if (!i)
|
|
2111
|
+
return console.log("BackgroundWorker: Не удалось определить ID текущего пользователя, продолжаем выполнение"), !0;
|
|
2112
|
+
const a = !!(typeof window < "u" ? window.location.href : "").includes("USER_ID=");
|
|
2113
|
+
let l = !1;
|
|
2114
|
+
for (const u of r)
|
|
2115
|
+
if (u.placement === "PAGE_BACKGROUND_WORKER" && (u.userId || u.handler && u.handler.includes("USER_ID="))) {
|
|
2116
|
+
const s = u.userId || (u.handler ? this.extractUserIdFromHandler(u.handler) : null);
|
|
2117
|
+
if (s && +s === i) {
|
|
2118
|
+
l = !0;
|
|
2119
|
+
break;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
return a ? (console.log("BackgroundWorker: Обнаружена индивидуальная встройка, продолжаем выполнение"), !0) : !currentPlacementIsGeneral && l ? (console.log(`BackgroundWorker: Обнаружена общая встройка при наличии индивидуальной для текущего пользователя (ID: ${i}), прекращаем выполнение`), !1) : (console.log("BackgroundWorker: Проверка типа встройки пройдена, продолжаем выполнение"), !0);
|
|
2123
|
+
} catch (r) {
|
|
2124
|
+
return console.error("BackgroundWorker: Ошибка при проверке типа встройки", r), !0;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
extractUserIdFromHandler(e) {
|
|
2128
|
+
if (!e || typeof e != "string")
|
|
2129
|
+
return null;
|
|
2130
|
+
const r = e.match(/USER_ID=(\d+)/);
|
|
2131
|
+
return r ? r[1] : null;
|
|
2132
|
+
}
|
|
2036
2133
|
async continueBackground() {
|
|
2037
2134
|
try {
|
|
2038
2135
|
const r = !!await Promise.resolve(this.continueCondition(this));
|
|
@@ -2043,12 +2140,12 @@ class St {
|
|
|
2043
2140
|
}
|
|
2044
2141
|
async getFilteredTabList() {
|
|
2045
2142
|
const e = [], r = [], i = await this.getTabs();
|
|
2046
|
-
for (const
|
|
2047
|
-
if (!(
|
|
2048
|
-
e.push(
|
|
2143
|
+
for (const o of i) {
|
|
2144
|
+
if (!(o != null && o.data)) {
|
|
2145
|
+
e.push(o);
|
|
2049
2146
|
continue;
|
|
2050
2147
|
}
|
|
2051
|
-
(/* @__PURE__ */ new Date()).getTime() - new Date(
|
|
2148
|
+
(/* @__PURE__ */ new Date()).getTime() - new Date(o.data.lastActive).getTime() > this.activeMaxPause ? e.push(o) : r.push(o);
|
|
2052
2149
|
}
|
|
2053
2150
|
return await this.deleteTabs(e), r;
|
|
2054
2151
|
}
|
|
@@ -2065,10 +2162,10 @@ class St {
|
|
|
2065
2162
|
e && (await this.pause(Math.round(Number(Math.random().toFixed(2)) * 1e4)), this.tabList = await this.getFilteredTabList(), e = this.checkOtherTabs(), e && await this.startBackground());
|
|
2066
2163
|
}
|
|
2067
2164
|
checkOtherTabs() {
|
|
2068
|
-
var
|
|
2165
|
+
var o, a;
|
|
2069
2166
|
let e = !1, r = (/* @__PURE__ */ new Date()).getTime() - new Date(this.start).getTime();
|
|
2070
2167
|
for (const l of this.tabList)
|
|
2071
|
-
if (+l.id !== this.id && ((
|
|
2168
|
+
if (+l.id !== this.id && ((o = l.data) != null && o.start && (e = !0), ((a = l.data) == null ? void 0 : a.duration) > r)) {
|
|
2072
2169
|
r = !1;
|
|
2073
2170
|
break;
|
|
2074
2171
|
}
|
|
@@ -2085,60 +2182,60 @@ class St {
|
|
|
2085
2182
|
}, this.activeMinPause), await this.appInit(), this.interval && (clearInterval(this.interval), this.interval = void 0), this.id && (await this.deleteTabs([{ id: this.id }]), this.id = 0);
|
|
2086
2183
|
}
|
|
2087
2184
|
async setBackgroundWorkerAll() {
|
|
2088
|
-
var
|
|
2089
|
-
if (!((
|
|
2185
|
+
var c, A;
|
|
2186
|
+
if (!((c = this.bx) != null && c.isAdmin)) {
|
|
2090
2187
|
console.log("BackgroundWorker: Отмена setBackgroundWorkerAll - пользователь не админ");
|
|
2091
2188
|
return;
|
|
2092
2189
|
}
|
|
2093
|
-
(
|
|
2190
|
+
(A = this.users) != null && A.length || await this.getEntityData();
|
|
2094
2191
|
const e = await this.bx.getPlacement(), r = /* @__PURE__ */ new Map();
|
|
2095
2192
|
let i = null;
|
|
2096
|
-
e.forEach((
|
|
2097
|
-
|
|
2193
|
+
e.forEach((g) => {
|
|
2194
|
+
g.placement === "PAGE_BACKGROUND_WORKER" && (g.userId ? r.set(+g.userId, g) : i = g);
|
|
2098
2195
|
}), console.log(`setBackgroundWorkerAll: Найдено ${r.size} индивидуальных и ${i ? 1 : 0} общих привязок PAGE_BACKGROUND_WORKER`);
|
|
2099
|
-
const
|
|
2100
|
-
a.sort((
|
|
2101
|
-
const
|
|
2102
|
-
return (N.LAST_LOGIN ? new Date(N.LAST_LOGIN) : /* @__PURE__ */ new Date(0)) -
|
|
2196
|
+
const o = await this.updateAdminsList(), a = await this.getEligibleUsersForBackgroundWorker(o);
|
|
2197
|
+
a.sort((g, N) => {
|
|
2198
|
+
const p = g.LAST_LOGIN ? new Date(g.LAST_LOGIN) : /* @__PURE__ */ new Date(0);
|
|
2199
|
+
return (N.LAST_LOGIN ? new Date(N.LAST_LOGIN) : /* @__PURE__ */ new Date(0)) - p;
|
|
2103
2200
|
}), console.log(`setBackgroundWorkerAll: Найдено ${a.length} подходящих пользователей (админы и руководители)`);
|
|
2104
|
-
const l = [],
|
|
2105
|
-
(
|
|
2106
|
-
),
|
|
2107
|
-
for (const [
|
|
2108
|
-
a.find((
|
|
2109
|
-
for (const
|
|
2201
|
+
const l = [], u = 10, s = a.slice(0, u).filter(
|
|
2202
|
+
(g) => !r.has(+g.ID)
|
|
2203
|
+
), d = i && s.length > 0, O = [];
|
|
2204
|
+
for (const [g] of r)
|
|
2205
|
+
a.find((p) => +p.ID === g) || O.push(g);
|
|
2206
|
+
for (const g of O)
|
|
2110
2207
|
this.appPath && (l.push({
|
|
2111
2208
|
method: "placement.unbind",
|
|
2112
2209
|
params: {
|
|
2113
2210
|
PLACEMENT: "PAGE_BACKGROUND_WORKER",
|
|
2114
|
-
HANDLER: `${this.appPath}?USER_ID=${
|
|
2211
|
+
HANDLER: `${this.appPath}?USER_ID=${g}/`
|
|
2115
2212
|
}
|
|
2116
|
-
}), console.log(`setBackgroundWorkerAll: Добавлена в очередь отвязка бэк-воркера от пользователя ${
|
|
2117
|
-
|
|
2213
|
+
}), console.log(`setBackgroundWorkerAll: Добавлена в очередь отвязка бэк-воркера от пользователя ${g}`));
|
|
2214
|
+
d && this.appPath && (l.push({
|
|
2118
2215
|
method: "placement.unbind",
|
|
2119
2216
|
params: {
|
|
2120
2217
|
PLACEMENT: "PAGE_BACKGROUND_WORKER",
|
|
2121
2218
|
HANDLER: i.handler || `${this.appPath}/`
|
|
2122
2219
|
}
|
|
2123
2220
|
}), console.log("setBackgroundWorkerAll: Добавлена в очередь отвязка общего бэк-воркера (для создания индивидуальных)"));
|
|
2124
|
-
for (const
|
|
2221
|
+
for (const g of s)
|
|
2125
2222
|
this.appPath && l.push({
|
|
2126
2223
|
method: "placement.bind",
|
|
2127
2224
|
params: {
|
|
2128
2225
|
PLACEMENT: "PAGE_BACKGROUND_WORKER",
|
|
2129
|
-
HANDLER: `${this.appPath}?USER_ID=${
|
|
2226
|
+
HANDLER: `${this.appPath}?USER_ID=${g.ID}/`,
|
|
2130
2227
|
LANG_ALL: {
|
|
2131
2228
|
ru: {
|
|
2132
2229
|
TITLE: this.appName
|
|
2133
2230
|
}
|
|
2134
2231
|
},
|
|
2135
2232
|
OPTIONS: {
|
|
2136
|
-
errorHandlerUrl: `${this.appPath}?USER_ID=${
|
|
2233
|
+
errorHandlerUrl: `${this.appPath}?USER_ID=${g.ID}/`
|
|
2137
2234
|
},
|
|
2138
|
-
USER_ID:
|
|
2235
|
+
USER_ID: g.ID
|
|
2139
2236
|
}
|
|
2140
2237
|
});
|
|
2141
|
-
(!i ||
|
|
2238
|
+
(!i || d) && this.appPath && (l.push({
|
|
2142
2239
|
method: "placement.bind",
|
|
2143
2240
|
params: {
|
|
2144
2241
|
PLACEMENT: "PAGE_BACKGROUND_WORKER",
|
|
@@ -2156,22 +2253,22 @@ class St {
|
|
|
2156
2253
|
}
|
|
2157
2254
|
async getEligibleUsersForBackgroundWorker(e = []) {
|
|
2158
2255
|
return (this.users ?? []).filter((i) => i.ACTIVE === "Y" || i.ACTIVE === !0).filter((i) => {
|
|
2159
|
-
const
|
|
2160
|
-
return e.includes(
|
|
2256
|
+
const o = +i.ID;
|
|
2257
|
+
return e.includes(o);
|
|
2161
2258
|
});
|
|
2162
2259
|
}
|
|
2163
2260
|
async updateAdminsList() {
|
|
2164
2261
|
var e, r, i;
|
|
2165
2262
|
try {
|
|
2166
|
-
let
|
|
2263
|
+
let o = await this.getAdminsList();
|
|
2167
2264
|
const a = +(((e = this.bx.userInfo) == null ? void 0 : e.ID) ?? 0);
|
|
2168
|
-
(r = this.bx) != null && r.isAdmin && a && !
|
|
2265
|
+
(r = this.bx) != null && r.isAdmin && a && !o.includes(a) && (o.push(a), console.log(`updateAdminsList: Добавлен новый админ ${a}`)), !((i = this.bx) != null && i.isAdmin) && a && o.includes(a) && (o = o.filter((h) => h !== a), console.log(`updateAdminsList: Удален из списка админов пользователь ${a} (больше не админ)`));
|
|
2169
2266
|
const l = new Set(
|
|
2170
|
-
(this.users ?? []).filter((
|
|
2171
|
-
),
|
|
2172
|
-
return
|
|
2173
|
-
} catch (
|
|
2174
|
-
return console.error("BackgroundWorker: Ошибка при обновлении списка админов:",
|
|
2267
|
+
(this.users ?? []).filter((h) => h.ACTIVE === "Y" || h.ACTIVE === !0).map((h) => +h.ID)
|
|
2268
|
+
), u = o.filter((h) => l.has(h));
|
|
2269
|
+
return u.length !== o.length && (console.log(`updateAdminsList: Удалено ${o.length - u.length} неактивных админов`), o = u), BX24.appOption.set("adminsList", JSON.stringify(o)), console.log(`BackgroundWorker: Список админов обновлен: ${o.length} админов`), o;
|
|
2270
|
+
} catch (o) {
|
|
2271
|
+
return console.error("BackgroundWorker: Ошибка при обновлении списка админов:", o), [];
|
|
2175
2272
|
}
|
|
2176
2273
|
}
|
|
2177
2274
|
async getAdminsList() {
|
|
@@ -2199,7 +2296,7 @@ class St {
|
|
|
2199
2296
|
export {
|
|
2200
2297
|
St as BackgroundWorker,
|
|
2201
2298
|
v as Batch,
|
|
2202
|
-
|
|
2299
|
+
Lt as BxBoot,
|
|
2203
2300
|
ut as BxHelper,
|
|
2204
2301
|
Rt as BxLogger,
|
|
2205
2302
|
et as tempus
|