szdl-utils-kit 0.2.26 → 0.2.28
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 +161 -161
- package/dist/index.js +727 -622
- 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
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
if (!
|
|
5
|
-
throw TypeError("Cannot " +
|
|
1
|
+
var ye = Object.defineProperty;
|
|
2
|
+
var de = (T, e, A) => e in T ? ye(T, e, { enumerable: !0, configurable: !0, writable: !0, value: A }) : T[e] = A;
|
|
3
|
+
var C = (T, e, A) => (de(T, typeof e != "symbol" ? e + "" : e, A), A), Kt = (T, e, A) => {
|
|
4
|
+
if (!e.has(T))
|
|
5
|
+
throw TypeError("Cannot " + A);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
7
|
+
var h = (T, e, A) => (Kt(T, e, "read from private field"), A ? A.call(T) : e.get(T)), O = (T, e, A) => {
|
|
8
|
+
if (e.has(T))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
var _ = (
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
return
|
|
10
|
+
e instanceof WeakSet ? e.add(T) : e.set(T, A);
|
|
11
|
+
}, g = (T, e, A, n) => (Kt(T, e, "write to private field"), n ? n.call(T, A) : e.set(T, A), A);
|
|
12
|
+
var _ = (T, e, A) => (Kt(T, e, "access private method"), A);
|
|
13
|
+
var ge = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
|
+
function Ee(T) {
|
|
15
|
+
return T && T.__esModule && Object.prototype.hasOwnProperty.call(T, "default") ? T.default : T;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
(function(
|
|
19
|
-
(function(
|
|
17
|
+
var vt = { exports: {} };
|
|
18
|
+
(function(T, e) {
|
|
19
|
+
(function(A) {
|
|
20
20
|
Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
|
|
21
|
-
var
|
|
22
|
-
for (
|
|
23
|
-
if (this[
|
|
24
|
-
return
|
|
21
|
+
var l, m;
|
|
22
|
+
for (l = s || 0, m = this.length; l < m; l += 1)
|
|
23
|
+
if (this[l] === t)
|
|
24
|
+
return l;
|
|
25
25
|
return -1;
|
|
26
26
|
});
|
|
27
27
|
var n = this, r = function(t, s) {
|
|
28
|
-
for (var
|
|
29
|
-
|
|
30
|
-
return
|
|
28
|
+
for (var l = t.toString(); l.length < s; )
|
|
29
|
+
l = "0" + l;
|
|
30
|
+
return l;
|
|
31
|
+
}, o = function(t, s) {
|
|
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;
|
|
31
33
|
}, a = function(t, s) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, O = function(t, s) {
|
|
37
|
-
var h, l = [
|
|
34
|
+
var l, m = "";
|
|
35
|
+
return l = t.slice(s, s + 1), l !== "" && !isNaN(Number(l)) && (m += "%H"), l = t.charAt(s + 2), l !== "" && l === ":" && (m += l), l = t.slice(s + 3, s + 4), l !== "" && !isNaN(Number(l)) && (m += "%M"), l = t.charAt(s + 5), l !== "" && l === ":" && (m += l), l = t.slice(s + 6, s + 7), l !== "" && !isNaN(Number(l)) && (m += "%S"), m;
|
|
36
|
+
}, f = function(t, s) {
|
|
37
|
+
var l, m = [
|
|
38
38
|
t.slice(s, s + 1),
|
|
39
39
|
t.charAt(s + 2),
|
|
40
40
|
t.slice(s + 3, s + 4),
|
|
41
41
|
t.charAt(s + 5),
|
|
42
42
|
t.slice(s + 6, s + 9)
|
|
43
|
-
],
|
|
44
|
-
return !isNaN(Number(
|
|
43
|
+
], p;
|
|
44
|
+
return !isNaN(Number(m[0])) && !isNaN(Number(m[2])) && !isNaN(Number(m[4])) ? (m[1] === "." && m[3] === "." ? l = "%d.%m.%Y" : m[1] === "-" && m[3] === "-" ? l = "%m-%d-%Y" : m[1] === "/" && m[3] === "/" && (l = "%m/%d/%Y"), l) : (p = [
|
|
45
45
|
t.slice(s, s + 3),
|
|
46
46
|
t.charAt(s + 4),
|
|
47
47
|
t.slice(s + 5, s + 6),
|
|
48
48
|
t.charAt(s + 7),
|
|
49
49
|
t.slice(s + 8, s + 9)
|
|
50
|
-
], !isNaN(Number(
|
|
51
|
-
},
|
|
50
|
+
], !isNaN(Number(p[0])) && !isNaN(Number(p[2])) && !isNaN(Number(p[4])) ? (p[1] === "-" && p[3] === "-" && (l = "%Y-%m-%d"), l) : "");
|
|
51
|
+
}, c = n.tempus, i, d, y = n.navigator || {}, u = "en", N = {
|
|
52
52
|
en: {
|
|
53
53
|
JANUARY_SHORT: "Jan",
|
|
54
54
|
FEBRUARY_SHORT: "Feb",
|
|
@@ -209,70 +209,70 @@ var jt = { exports: {} };
|
|
|
209
209
|
FRIDAY_LONG: "Freitag",
|
|
210
210
|
SATURDAY_LONG: "Samstag"
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, Y = function() {
|
|
213
213
|
return [
|
|
214
|
-
N[
|
|
215
|
-
N[
|
|
216
|
-
N[
|
|
217
|
-
N[
|
|
218
|
-
N[
|
|
219
|
-
N[
|
|
220
|
-
N[
|
|
221
|
-
N[
|
|
222
|
-
N[
|
|
223
|
-
N[
|
|
224
|
-
N[
|
|
225
|
-
N[
|
|
214
|
+
N[u].JANUARY_LONG,
|
|
215
|
+
N[u].FEBRUARY_LONG,
|
|
216
|
+
N[u].MARCH_LONG,
|
|
217
|
+
N[u].APRIL_LONG,
|
|
218
|
+
N[u].MAY_LONG,
|
|
219
|
+
N[u].JUNE_LONG,
|
|
220
|
+
N[u].JULY_LONG,
|
|
221
|
+
N[u].AUGUST_LONG,
|
|
222
|
+
N[u].SEPTEMBER_LONG,
|
|
223
|
+
N[u].OCTOBER_LONG,
|
|
224
|
+
N[u].NOVEMBER_LONG,
|
|
225
|
+
N[u].DECEMBER_LONG
|
|
226
226
|
];
|
|
227
|
-
},
|
|
227
|
+
}, W = function() {
|
|
228
228
|
return [
|
|
229
|
-
N[
|
|
230
|
-
N[
|
|
231
|
-
N[
|
|
232
|
-
N[
|
|
233
|
-
N[
|
|
234
|
-
N[
|
|
235
|
-
N[
|
|
236
|
-
N[
|
|
237
|
-
N[
|
|
238
|
-
N[
|
|
239
|
-
N[
|
|
240
|
-
N[
|
|
229
|
+
N[u].JANUARY_SHORT,
|
|
230
|
+
N[u].FEBRUARY_SHORT,
|
|
231
|
+
N[u].MARCH_SHORT,
|
|
232
|
+
N[u].APRIL_SHORT,
|
|
233
|
+
N[u].MAY_SHORT,
|
|
234
|
+
N[u].JUNE_SHORT,
|
|
235
|
+
N[u].JULY_SHORT,
|
|
236
|
+
N[u].AUGUST_SHORT,
|
|
237
|
+
N[u].SEPTEMBER_SHORT,
|
|
238
|
+
N[u].OCTOBER_SHORT,
|
|
239
|
+
N[u].NOVEMBER_SHORT,
|
|
240
|
+
N[u].DECEMBER_SHORT
|
|
241
241
|
];
|
|
242
|
-
},
|
|
242
|
+
}, G = function() {
|
|
243
243
|
return [
|
|
244
|
-
N[
|
|
245
|
-
N[
|
|
246
|
-
N[
|
|
247
|
-
N[
|
|
248
|
-
N[
|
|
249
|
-
N[
|
|
250
|
-
N[
|
|
244
|
+
N[u].SUNDAY_LONG,
|
|
245
|
+
N[u].MONDAY_LONG,
|
|
246
|
+
N[u].TUESDAY_LONG,
|
|
247
|
+
N[u].WEDNESDAY_LONG,
|
|
248
|
+
N[u].THURSDAY_LONG,
|
|
249
|
+
N[u].FRIDAY_LONG,
|
|
250
|
+
N[u].SATURDAY_LONG
|
|
251
251
|
];
|
|
252
|
-
},
|
|
252
|
+
}, b = function() {
|
|
253
253
|
return [
|
|
254
|
-
N[
|
|
255
|
-
N[
|
|
256
|
-
N[
|
|
257
|
-
N[
|
|
258
|
-
N[
|
|
259
|
-
N[
|
|
260
|
-
N[
|
|
254
|
+
N[u].SUNDAY_SHORT,
|
|
255
|
+
N[u].MONDAY_SHORT,
|
|
256
|
+
N[u].TUESDAY_SHORT,
|
|
257
|
+
N[u].WEDNESDAY_SHORT,
|
|
258
|
+
N[u].THURSDAY_SHORT,
|
|
259
|
+
N[u].FRIDAY_SHORT,
|
|
260
|
+
N[u].SATURDAY_SHORT
|
|
261
261
|
];
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
n.XMLHttpRequest ?
|
|
265
|
-
|
|
266
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(
|
|
267
|
-
},
|
|
268
|
-
},
|
|
262
|
+
}, M, X, x, J, it = function(t, s, l) {
|
|
263
|
+
var m;
|
|
264
|
+
n.XMLHttpRequest ? m = new XMLHttpRequest() : m = new ActiveXObject("Microsoft.XMLHTTP"), m.onreadystatechange = function() {
|
|
265
|
+
m.readyState === 4 && (m.status === 200 ? s && (n.JSON === A ? alert(`Please, include json2 into your project if you want use old browsers!
|
|
266
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(m.responseText))) : l && l(m));
|
|
267
|
+
}, m.open("GET", t, !1), m.send();
|
|
268
|
+
}, B = {
|
|
269
269
|
"%d": {
|
|
270
270
|
format: function(t) {
|
|
271
271
|
return r(t.day() || i.MIN_DAY, 2);
|
|
272
272
|
},
|
|
273
273
|
parse: function(t) {
|
|
274
274
|
var s = Number(t);
|
|
275
|
-
return { day: isNaN(s) ?
|
|
275
|
+
return { day: isNaN(s) ? A : s };
|
|
276
276
|
},
|
|
277
277
|
minLength: 2,
|
|
278
278
|
maxLength: 2,
|
|
@@ -284,7 +284,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
284
284
|
},
|
|
285
285
|
parse: function(t) {
|
|
286
286
|
var s = Number(t);
|
|
287
|
-
return { month: isNaN(s) ?
|
|
287
|
+
return { month: isNaN(s) ? A : s };
|
|
288
288
|
},
|
|
289
289
|
minLength: 2,
|
|
290
290
|
maxLength: 2,
|
|
@@ -296,7 +296,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
296
296
|
},
|
|
297
297
|
parse: function(t) {
|
|
298
298
|
var s = Number(t);
|
|
299
|
-
return { year: isNaN(s) ?
|
|
299
|
+
return { year: isNaN(s) ? A : s };
|
|
300
300
|
},
|
|
301
301
|
minLength: 4,
|
|
302
302
|
maxLength: 4,
|
|
@@ -316,7 +316,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
316
316
|
"%a": {
|
|
317
317
|
format: function(t) {
|
|
318
318
|
var s = t.dayOfWeek();
|
|
319
|
-
return
|
|
319
|
+
return J[s !== A ? s : i.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`) : s(JSON.pars
|
|
|
328
328
|
"%A": {
|
|
329
329
|
format: function(t) {
|
|
330
330
|
var s = t.dayOfWeek();
|
|
331
|
-
return
|
|
331
|
+
return x[s !== A ? s : i.MIN_DAY_OF_WEEK];
|
|
332
332
|
},
|
|
333
333
|
parse: function() {
|
|
334
334
|
return {};
|
|
@@ -340,11 +340,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
340
340
|
"%b": {
|
|
341
341
|
format: function(t) {
|
|
342
342
|
var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
343
|
-
return
|
|
343
|
+
return X[s !== A ? s : i.MIN_MONTH];
|
|
344
344
|
},
|
|
345
345
|
parse: function(t) {
|
|
346
346
|
var s = i.monthNames().indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
|
|
347
|
-
return { month: s !== -1 ? s :
|
|
347
|
+
return { month: s !== -1 ? s : A };
|
|
348
348
|
},
|
|
349
349
|
minLength: 1,
|
|
350
350
|
maxLength: 999,
|
|
@@ -353,11 +353,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
353
353
|
"%B": {
|
|
354
354
|
format: function(t) {
|
|
355
355
|
var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
356
|
-
return
|
|
356
|
+
return M[s !== A ? s : i.MIN_MONTH];
|
|
357
357
|
},
|
|
358
358
|
parse: function(t) {
|
|
359
359
|
var s = i.monthNames(!0).indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
|
|
360
|
-
return { month: s !== -1 ? s :
|
|
360
|
+
return { month: s !== -1 ? s : A };
|
|
361
361
|
},
|
|
362
362
|
minLength: 1,
|
|
363
363
|
maxLength: 999,
|
|
@@ -369,7 +369,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
369
369
|
},
|
|
370
370
|
parse: function(t) {
|
|
371
371
|
var s = Number(t);
|
|
372
|
-
return { hours: isNaN(s) ?
|
|
372
|
+
return { hours: isNaN(s) ? A : s };
|
|
373
373
|
},
|
|
374
374
|
minLength: 2,
|
|
375
375
|
maxLength: 2,
|
|
@@ -381,7 +381,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
381
381
|
},
|
|
382
382
|
parse: function(t) {
|
|
383
383
|
var s = Number(t);
|
|
384
|
-
return { minutes: isNaN(s) ?
|
|
384
|
+
return { minutes: isNaN(s) ? A : s };
|
|
385
385
|
},
|
|
386
386
|
minLength: 2,
|
|
387
387
|
maxLength: 2,
|
|
@@ -393,7 +393,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
393
393
|
},
|
|
394
394
|
parse: function(t) {
|
|
395
395
|
var s = Number(t);
|
|
396
|
-
return { seconds: isNaN(s) ?
|
|
396
|
+
return { seconds: isNaN(s) ? A : s };
|
|
397
397
|
},
|
|
398
398
|
minLength: 2,
|
|
399
399
|
maxLength: 2,
|
|
@@ -415,11 +415,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
415
415
|
return r(t.year() || i.MIN_YEAR, 4) + "-" + r(t.month() || i.MIN_MONTH, 2) + "-" + r(t.day() || i.MIN_DAY, 2);
|
|
416
416
|
},
|
|
417
417
|
parse: function(t) {
|
|
418
|
-
var s = Number(t.slice(0, 4)),
|
|
418
|
+
var s = Number(t.slice(0, 4)), l = Number(t.slice(5, 7)), m = Number(t.slice(8, 10));
|
|
419
419
|
return {
|
|
420
420
|
year: s,
|
|
421
|
-
month:
|
|
422
|
-
day:
|
|
421
|
+
month: l,
|
|
422
|
+
day: m
|
|
423
423
|
};
|
|
424
424
|
},
|
|
425
425
|
minLength: 10,
|
|
@@ -431,22 +431,22 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
431
431
|
return r(t.month() || i.MIN_MONTH, 2) + "/" + r(t.day() || i.MIN_DAY, 2) + "/" + r(t.year() || i.MIN_YEAR, 4);
|
|
432
432
|
},
|
|
433
433
|
parse: function(t) {
|
|
434
|
-
var s = Number(t.slice(0, 2)),
|
|
434
|
+
var s = Number(t.slice(0, 2)), l = Number(t.slice(3, 5)), m = Number(t.slice(6, 10));
|
|
435
435
|
return {
|
|
436
|
-
year:
|
|
436
|
+
year: m,
|
|
437
437
|
month: s,
|
|
438
|
-
day:
|
|
438
|
+
day: l
|
|
439
439
|
};
|
|
440
440
|
},
|
|
441
441
|
minLength: 10,
|
|
442
442
|
maxLength: 10,
|
|
443
443
|
type: "string"
|
|
444
444
|
}
|
|
445
|
-
},
|
|
445
|
+
}, rt = {
|
|
446
446
|
useMilliseconds: !1,
|
|
447
447
|
monthFromZero: !1
|
|
448
448
|
}, R;
|
|
449
|
-
R = function(t, s,
|
|
449
|
+
R = function(t, s, l) {
|
|
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`) : s(JSON.pars
|
|
|
455
455
|
minutes: !1,
|
|
456
456
|
seconds: !1,
|
|
457
457
|
milliseconds: !1
|
|
458
|
-
}, t !==
|
|
458
|
+
}, t !== A && this.set(t, s, l), this;
|
|
459
459
|
}, R.fn = R.prototype, R.fn.dayCount = function() {
|
|
460
460
|
var t = this.month(), s = i.MAX_DAY_IN_MONTHS[t - (i.options("monthFromZero") ? 0 : 1)];
|
|
461
461
|
return this.leapYear() && t === (i.options("monthFromZero") ? 1 : 2) && (s += 1), s;
|
|
@@ -504,7 +504,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
504
504
|
}, R.fn.week = function() {
|
|
505
505
|
var t = new Date(this.year(), 0, 1), s = i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
|
|
506
506
|
return Math.ceil(((s - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
|
|
507
|
-
}, R.fn.set = function(t, s,
|
|
507
|
+
}, R.fn.set = function(t, s, l) {
|
|
508
508
|
if (this._i = {
|
|
509
509
|
year: !1,
|
|
510
510
|
month: !1,
|
|
@@ -513,16 +513,16 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
513
513
|
minutes: !1,
|
|
514
514
|
seconds: !1,
|
|
515
515
|
milliseconds: !1
|
|
516
|
-
}, t ===
|
|
516
|
+
}, t === A)
|
|
517
517
|
return this._d = /* @__PURE__ */ new Date(), this;
|
|
518
518
|
if (t instanceof Date)
|
|
519
519
|
return this._d = t, this;
|
|
520
520
|
if (typeof t == "number")
|
|
521
521
|
return this._d = new Date(t * (i.options("useMilliseconds") ? 1 : 1e3)), this;
|
|
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
|
-
var
|
|
524
|
-
if (t ===
|
|
525
|
-
return
|
|
523
|
+
var m, p = [], E, S, P = [], H = 0, w = 0, L, j, D = {}, I;
|
|
524
|
+
if (t === A)
|
|
525
|
+
return E = o(this, l), E === A && (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`) : s(JSON.pars
|
|
|
530
530
|
minutes: -1,
|
|
531
531
|
seconds: -1,
|
|
532
532
|
milliseconds: -1
|
|
533
|
-
}),
|
|
534
|
-
for (s ===
|
|
533
|
+
}), E;
|
|
534
|
+
for (s === A && (s = i.detectFormat(t)); H < s.length; ) {
|
|
535
535
|
if (s.charAt(H) === "%") {
|
|
536
|
-
if (S = s.charAt(H) + s.charAt(H + 1),
|
|
537
|
-
switch (
|
|
536
|
+
if (S = s.charAt(H) + s.charAt(H + 1), B[S] !== A) {
|
|
537
|
+
switch (L = 0, j = "", B[S].type) {
|
|
538
538
|
case "number":
|
|
539
|
-
for (;
|
|
540
|
-
|
|
539
|
+
for (; L < B[S].maxLength && w + L < t.length && !isNaN(Number(t.charAt(w + L))); )
|
|
540
|
+
j += t.charAt(w + L), L += 1;
|
|
541
541
|
break;
|
|
542
542
|
case "word":
|
|
543
|
-
for (;
|
|
544
|
-
|
|
543
|
+
for (; L < B[S].maxLength && w + L < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(w + L)); )
|
|
544
|
+
j += t.charAt(w + L), L += 1;
|
|
545
545
|
break;
|
|
546
546
|
case "string":
|
|
547
|
-
for (;
|
|
548
|
-
|
|
547
|
+
for (; L < B[S].maxLength && w + L < t.length; )
|
|
548
|
+
j += t.charAt(w + L), L += 1;
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
|
-
if (
|
|
552
|
-
return
|
|
551
|
+
if (L < B[S].minLength)
|
|
552
|
+
return E = o(this, l), E === A && (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`) : s(JSON.pars
|
|
|
557
557
|
minutes: -1,
|
|
558
558
|
seconds: -1,
|
|
559
559
|
milliseconds: -1
|
|
560
|
-
}),
|
|
561
|
-
|
|
560
|
+
}), E;
|
|
561
|
+
p.push(S), P.push(j), L -= 1, w += L, H += 1;
|
|
562
562
|
}
|
|
563
|
-
} else if (t.charAt(
|
|
564
|
-
return
|
|
563
|
+
} else if (t.charAt(w) !== s.charAt(H))
|
|
564
|
+
return E = o(this, l), E === A && (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`) : s(JSON.pars
|
|
|
569
569
|
minutes: -1,
|
|
570
570
|
seconds: -1,
|
|
571
571
|
milliseconds: -1
|
|
572
|
-
}),
|
|
573
|
-
H += 1,
|
|
572
|
+
}), E;
|
|
573
|
+
H += 1, w += 1;
|
|
574
574
|
}
|
|
575
|
-
for (
|
|
576
|
-
|
|
577
|
-
year:
|
|
578
|
-
month:
|
|
579
|
-
day:
|
|
580
|
-
hours:
|
|
581
|
-
minutes:
|
|
582
|
-
seconds:
|
|
575
|
+
for (m in p)
|
|
576
|
+
p.hasOwnProperty(m) && B.hasOwnProperty(p[m]) && (I = B[p[m]].parse(P[m]), D = {
|
|
577
|
+
year: I.year !== A ? I.year : D.year,
|
|
578
|
+
month: I.month !== A ? I.month : D.month,
|
|
579
|
+
day: I.day !== A ? I.day : D.day,
|
|
580
|
+
hours: I.hours !== A ? I.hours : D.hours,
|
|
581
|
+
minutes: I.minutes !== A ? I.minutes : D.minutes,
|
|
582
|
+
seconds: I.seconds !== A ? I.seconds : D.seconds
|
|
583
583
|
});
|
|
584
|
-
this.day(i.MIN_DAY), this.year(
|
|
584
|
+
this.day(i.MIN_DAY), this.year(D.year), this.month(D.month), this.day(D.day), this.hours(D.hours), this.minutes(D.minutes), this.seconds(D.seconds), this.milliseconds(D.milliseconds);
|
|
585
585
|
}
|
|
586
586
|
return this;
|
|
587
587
|
}, R.fn.leapYear = function() {
|
|
@@ -593,10 +593,10 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
593
593
|
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (i.options("useMilliseconds") ? 1 : 1e3)), this) : i.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
|
|
594
594
|
}, R.fn.dayOfWeek = function(t) {
|
|
595
595
|
if (t === "long")
|
|
596
|
-
return
|
|
596
|
+
return x[this._d.getDay()];
|
|
597
597
|
if (t === "short")
|
|
598
|
-
return
|
|
599
|
-
if (t ===
|
|
598
|
+
return J[this._d.getDay()];
|
|
599
|
+
if (t === A)
|
|
600
600
|
return this._d.getDay();
|
|
601
601
|
if (t === 0 || t === "Sunday")
|
|
602
602
|
return this.calc({ day: -this.dayOfWeek() });
|
|
@@ -671,474 +671,539 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
673
|
}, R.fn.format = function(t) {
|
|
674
|
-
for (var s = 0,
|
|
675
|
-
t.charAt(s) === "%" ? (
|
|
676
|
-
return
|
|
674
|
+
for (var s = 0, l = "", m; s < t.length; )
|
|
675
|
+
t.charAt(s) === "%" ? (m = t.charAt(s) + t.charAt(s + 1), B[m] !== A ? (l += B[m].format(this), s += 1) : l += "%") : l += t.charAt(s), s += 1;
|
|
676
|
+
return l;
|
|
677
677
|
}, R.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
|
}, R.fn.errors = function() {
|
|
680
680
|
return this._i;
|
|
681
681
|
}, R.fn.between = function(t, s) {
|
|
682
|
-
var
|
|
682
|
+
var l = this.timestamp(), m = t.timestamp();
|
|
683
683
|
switch (s) {
|
|
684
684
|
case "year":
|
|
685
|
-
return Math.floor((
|
|
685
|
+
return Math.floor((m - l) / 31556952);
|
|
686
686
|
case "month":
|
|
687
|
-
return Math.floor((
|
|
687
|
+
return Math.floor((m - l) / 2629746);
|
|
688
688
|
case "day":
|
|
689
|
-
return Math.floor((
|
|
689
|
+
return Math.floor((m - l) / 86400);
|
|
690
690
|
case "hours":
|
|
691
|
-
return Math.floor((
|
|
691
|
+
return Math.floor((m - l) / 3600);
|
|
692
692
|
case "minutes":
|
|
693
|
-
return Math.floor((
|
|
693
|
+
return Math.floor((m - l) / 60);
|
|
694
694
|
case "seconds":
|
|
695
|
-
return
|
|
695
|
+
return m - l;
|
|
696
696
|
default:
|
|
697
|
-
return
|
|
697
|
+
return A;
|
|
698
698
|
}
|
|
699
699
|
}, R.fn.calc = function(t) {
|
|
700
|
-
return t.year !==
|
|
701
|
-
}, i = function(t, s,
|
|
702
|
-
return new R(t, s,
|
|
700
|
+
return t.year !== A && this._d.setFullYear(this._d.getFullYear() + t.year), t.month !== A && this._d.setMonth(this._d.getMonth() + t.month), t.day !== A && this._d.setDate(this._d.getDate() + t.day), t.hours !== A && this._d.setHours(this._d.getHours() + t.hours), t.minutes !== A && this._d.setMinutes(this._d.getMinutes() + t.minutes), t.seconds !== A && this._d.setSeconds(this._d.getSeconds() + t.seconds), t.milliseconds !== A && this._d.setMilliseconds(this._d.getMilliseconds() + t.milliseconds), this;
|
|
701
|
+
}, i = function(t, s, l) {
|
|
702
|
+
return new R(t, s, l);
|
|
703
703
|
}, i.MIN_YEAR = 1e3, i.MAX_YEAR = 3e3, i.MIN_MONTH = 1, i.MAX_MONTH = 12, i.MIN_DAY = 1, i.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], i.MIN_DAY_OF_WEEK = 0, i.MAX_DAY_OF_WEEK = 6, i.MIN_HOURS = 0, i.MAX_HOURS = 23, i.MIN_MINUTES = 0, i.MAX_MINUTES = 59, i.MIN_SECONDS = 0, i.MAX_SECONDS = 59, i.MIN_MILLISECONDS = 0, i.MAX_MILLISECONDS = 999, i.VERSION = "0.2.18", i.options = function(t, s) {
|
|
704
|
-
if (t ===
|
|
705
|
-
return
|
|
706
|
-
if (
|
|
707
|
-
if (s ===
|
|
708
|
-
return
|
|
709
|
-
|
|
704
|
+
if (t === A)
|
|
705
|
+
return rt;
|
|
706
|
+
if (rt.hasOwnProperty(t)) {
|
|
707
|
+
if (s === A)
|
|
708
|
+
return rt[t];
|
|
709
|
+
rt[t] = s, t === "monthFromZero" && (i.MIN_MONTH = s ? 0 : 1, i.MAX_MONTH = s ? 11 : 12);
|
|
710
710
|
}
|
|
711
|
-
return
|
|
711
|
+
return A;
|
|
712
712
|
}, i.noConflict = function() {
|
|
713
|
-
return n.tempus =
|
|
713
|
+
return n.tempus = c, i;
|
|
714
714
|
}, i.generate = function(t) {
|
|
715
|
-
var s,
|
|
716
|
-
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof R ? s = t.dateFrom.utc() : s = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof R ?
|
|
715
|
+
var s, l, m, p, E, S, P, H;
|
|
716
|
+
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof R ? s = t.dateFrom.utc() : s = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof R ? l = t.dateTo.utc() : l = i(t.dateTo, t.formatTo !== A ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? E = {
|
|
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" ? E = {
|
|
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" && (
|
|
731
|
-
year: t.period.year !==
|
|
732
|
-
month: t.period.month !==
|
|
733
|
-
day: t.period.day !==
|
|
734
|
-
hours: t.period.hours !==
|
|
735
|
-
minutes: t.period.minutes !==
|
|
736
|
-
seconds: t.period.seconds !==
|
|
737
|
-
}), t.groupBy ===
|
|
738
|
-
return t.asObject === !0 ? t.format !==
|
|
739
|
-
}, t.groupBy !==
|
|
740
|
-
var
|
|
741
|
-
year:
|
|
742
|
-
month:
|
|
743
|
-
day:
|
|
744
|
-
hours:
|
|
745
|
-
minutes:
|
|
746
|
-
seconds:
|
|
747
|
-
milliseconds:
|
|
730
|
+
} : typeof t.period == "object" && (E = {
|
|
731
|
+
year: t.period.year !== A ? t.period.year : 0,
|
|
732
|
+
month: t.period.month !== A ? t.period.month : 0,
|
|
733
|
+
day: t.period.day !== A ? t.period.day : 0,
|
|
734
|
+
hours: t.period.hours !== A ? t.period.hours : 0,
|
|
735
|
+
minutes: t.period.minutes !== A ? t.period.minutes : 0,
|
|
736
|
+
seconds: t.period.seconds !== A ? t.period.seconds : 0
|
|
737
|
+
}), t.groupBy === A ? S = t.asObject === !0 ? {} : [] : (S = [], S.push([]), P = i(s).get()[t.groupBy]), H = function(j, D, I) {
|
|
738
|
+
return t.asObject === !0 ? t.format !== A ? j[i(D).format(t.format)] = {} : j[i(D).format("%F %H:%M:%S")] = {} : t.format !== A ? j.push(I ? null : i(D).format(t.format)) : j.push(I ? null : i(D)), j;
|
|
739
|
+
}, t.groupBy !== A && t.fillNulls) {
|
|
740
|
+
var w = {
|
|
741
|
+
year: E.year ? -E.year : A,
|
|
742
|
+
month: E.month ? -E.month : A,
|
|
743
|
+
day: E.day ? -E.day : A,
|
|
744
|
+
hours: E.hours ? -E.hours : A,
|
|
745
|
+
minutes: E.minutes ? -E.minutes : A,
|
|
746
|
+
seconds: E.seconds ? -E.seconds : A,
|
|
747
|
+
milliseconds: E.milliseconds ? -E.milliseconds : A
|
|
748
748
|
};
|
|
749
|
-
for (
|
|
750
|
-
H(S[S.length - 1],
|
|
749
|
+
for (m = i(s).calc(w).utc(); i(m).get()[t.groupBy] === P; )
|
|
750
|
+
H(S[S.length - 1], m, !0), m = i(m).calc(w).utc();
|
|
751
751
|
if (t.groupBy === "week") {
|
|
752
|
-
var
|
|
753
|
-
for (
|
|
754
|
-
H(S[S.length - 1],
|
|
752
|
+
var L = i(s).dayOfWeek();
|
|
753
|
+
for (m = i(s).dayOfWeek(0).utc(); S[0].length < L && m < s; )
|
|
754
|
+
H(S[S.length - 1], m, !0), m = i(m).calc(E).utc();
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
for (; s <=
|
|
758
|
-
t.groupBy ===
|
|
759
|
-
if (t.groupBy !==
|
|
760
|
-
for (
|
|
761
|
-
H(S[S.length - 1],
|
|
757
|
+
for (; s <= l; )
|
|
758
|
+
t.groupBy === A ? H(S, s) : i(s).get()[t.groupBy] === P ? H(S[S.length - 1], s) : (S.push([]), H(S[S.length - 1], s), P = i(s).get()[t.groupBy]), s = i(s).calc(E).utc();
|
|
759
|
+
if (t.groupBy !== A && t.fillNulls)
|
|
760
|
+
for (p = i(l).calc(E).utc(); i(p).get()[t.groupBy] === P; )
|
|
761
|
+
H(S[S.length - 1], p, !0), p = i(p).calc(E).utc();
|
|
762
762
|
return S;
|
|
763
763
|
}, i.monthNames = function(t) {
|
|
764
764
|
switch (t) {
|
|
765
765
|
case "long":
|
|
766
|
-
return
|
|
766
|
+
return M;
|
|
767
767
|
default:
|
|
768
|
-
return
|
|
768
|
+
return X;
|
|
769
769
|
}
|
|
770
770
|
}, i.dayNames = function(t) {
|
|
771
771
|
switch (t) {
|
|
772
772
|
case "long":
|
|
773
|
-
return
|
|
773
|
+
return x;
|
|
774
774
|
default:
|
|
775
|
-
return
|
|
775
|
+
return J;
|
|
776
776
|
}
|
|
777
777
|
}, i.lang = function(t) {
|
|
778
|
-
if (t !==
|
|
779
|
-
|
|
778
|
+
if (t !== A)
|
|
779
|
+
u = t, N[u] === A && (u = "en"), M = Y(), X = W(), x = G(), J = b();
|
|
780
780
|
else
|
|
781
|
-
return
|
|
782
|
-
return
|
|
781
|
+
return u;
|
|
782
|
+
return A;
|
|
783
783
|
}, i.availableLangs = function() {
|
|
784
784
|
return Object.keys(N);
|
|
785
|
-
}, i.registerFormat = function(t, s,
|
|
786
|
-
|
|
785
|
+
}, i.registerFormat = function(t, s, l, m, p, E) {
|
|
786
|
+
B[t] = {
|
|
787
787
|
format: s,
|
|
788
|
-
parse:
|
|
789
|
-
minLength:
|
|
790
|
-
maxLength:
|
|
791
|
-
type:
|
|
788
|
+
parse: l,
|
|
789
|
+
minLength: m,
|
|
790
|
+
maxLength: p,
|
|
791
|
+
type: E
|
|
792
792
|
};
|
|
793
793
|
}, i.unregisterFormat = function(t) {
|
|
794
|
-
delete
|
|
794
|
+
delete B[t];
|
|
795
795
|
}, i.detectFormat = function(t) {
|
|
796
|
-
var s,
|
|
797
|
-
return s =
|
|
798
|
-
},
|
|
796
|
+
var s, l, m;
|
|
797
|
+
return s = f(t, 0), s !== "" && (m = 10), l = t.charAt(m), (l === "T" || l === " ") && (s += l, m += 1), s += a(t, m), s;
|
|
798
|
+
}, d = {
|
|
799
799
|
TempusDate: R
|
|
800
800
|
}, i.classes = function(t, s) {
|
|
801
|
-
if (s ===
|
|
802
|
-
return
|
|
803
|
-
|
|
801
|
+
if (s === A)
|
|
802
|
+
return d[t];
|
|
803
|
+
d[t] = s;
|
|
804
804
|
}, i.loadTranslations = function(t) {
|
|
805
|
-
typeof t == "object" ? N = t : typeof t == "string" &&
|
|
805
|
+
typeof t == "object" ? N = t : typeof t == "string" && it(t, function(s) {
|
|
806
806
|
N = s;
|
|
807
807
|
}, function(s) {
|
|
808
808
|
});
|
|
809
|
-
},
|
|
810
|
-
}).call(
|
|
811
|
-
})(
|
|
812
|
-
var
|
|
813
|
-
const
|
|
814
|
-
var
|
|
815
|
-
class
|
|
816
|
-
constructor(
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
809
|
+
}, u = (y.language || y.systemLanguage || y.userLanguage || "en").substr(0, 2).toLowerCase(), N[u] === A && (u = "en"), M = Y(), X = W(), x = G(), J = b(), T.exports && (e = T.exports = i), e.tempus = i;
|
|
810
|
+
}).call(ge);
|
|
811
|
+
})(vt, vt.exports);
|
|
812
|
+
var Te = vt.exports;
|
|
813
|
+
const Yt = /* @__PURE__ */ Ee(Te);
|
|
814
|
+
var v, dt, q, U, Q, Z, $, tt, F, K, Ft, nt, k, et, at, ct, It, mt, Bt, gt, qt, ut, Ut, Et, $t, Tt, te, Rt, ee, kt, ae, Pt, oe, St, Ae, pt, se, Mt, ie, ft, wt, Lt, re, Wt, he, ot, yt, Nt, Gt, Ot, Ct, Jt, le;
|
|
815
|
+
class z {
|
|
816
|
+
constructor(e, A = {}) {
|
|
817
|
+
O(this, ct);
|
|
818
|
+
O(this, mt);
|
|
819
|
+
O(this, gt);
|
|
820
|
+
O(this, ut);
|
|
821
|
+
O(this, Et);
|
|
822
|
+
/* batchChunk для batchUpdateField */
|
|
823
|
+
O(this, Tt);
|
|
824
|
+
O(this, Rt);
|
|
825
|
+
O(this, kt);
|
|
826
|
+
O(this, Pt);
|
|
827
|
+
O(this, St);
|
|
828
|
+
O(this, pt);
|
|
829
|
+
O(this, Mt);
|
|
830
|
+
O(this, ft);
|
|
831
|
+
O(this, Lt);
|
|
832
|
+
O(this, Wt);
|
|
833
|
+
O(this, ot);
|
|
834
|
+
O(this, Nt);
|
|
835
|
+
O(this, Ot);
|
|
836
|
+
/* преобразование стандартного вида запроса для batch в вид запроса для batchUpdateField */
|
|
837
|
+
O(this, Jt);
|
|
838
|
+
O(this, v, null);
|
|
839
|
+
O(this, dt, null);
|
|
840
|
+
O(this, q, []);
|
|
841
|
+
O(this, U, {});
|
|
842
|
+
O(this, Q, 50);
|
|
843
|
+
O(this, Z, 50);
|
|
844
|
+
O(this, $, !0);
|
|
845
|
+
O(this, tt, null);
|
|
846
|
+
O(this, F, null);
|
|
847
|
+
O(this, K, null);
|
|
848
|
+
O(this, Ft, 100);
|
|
849
|
+
O(this, nt, "no");
|
|
850
|
+
O(this, k, !1);
|
|
851
|
+
O(this, et, !1);
|
|
852
|
+
O(this, at, !1);
|
|
853
|
+
C(this, "errors", {});
|
|
854
|
+
C(this, "answerData", {});
|
|
855
|
+
C(this, "timeLimit", !1);
|
|
856
|
+
g(this, v, e), g(this, dt, A);
|
|
852
857
|
}
|
|
853
858
|
get serial() {
|
|
854
|
-
return
|
|
859
|
+
return h(this, k);
|
|
855
860
|
}
|
|
856
861
|
get limitCommandSerial() {
|
|
857
|
-
return
|
|
862
|
+
return h(this, Z);
|
|
858
863
|
}
|
|
859
|
-
set limitCommandSerial(
|
|
860
|
-
if (
|
|
864
|
+
set limitCommandSerial(e) {
|
|
865
|
+
if (e < 10)
|
|
861
866
|
throw new Error("limitCommandSerial не может быть меньше 10");
|
|
862
|
-
|
|
867
|
+
e >= 10 && e < 50 && (g(this, Q, e), g(this, Z, e)), g(this, Z, e);
|
|
863
868
|
}
|
|
864
869
|
setSerial() {
|
|
865
|
-
|
|
870
|
+
g(this, k, !0), g(this, et, !0), g(this, at, !1);
|
|
866
871
|
}
|
|
867
872
|
setParallel() {
|
|
868
|
-
|
|
873
|
+
g(this, k, !1), g(this, et, !1), g(this, at, !0);
|
|
869
874
|
}
|
|
870
875
|
stop() {
|
|
871
|
-
|
|
876
|
+
g(this, $, !1);
|
|
872
877
|
}
|
|
873
|
-
async batch(
|
|
874
|
-
|
|
875
|
-
const n = _(this,
|
|
876
|
-
if (Object.keys(
|
|
877
|
-
const r = n.map((
|
|
878
|
-
return Promise.allSettled(r).then((
|
|
879
|
-
let
|
|
880
|
-
for (let
|
|
881
|
-
|
|
882
|
-
return
|
|
878
|
+
async batch(e, A) {
|
|
879
|
+
h(this, K) && _(this, mt, Bt).call(this), A && g(this, tt, A), h(this, et) === !1 && g(this, k, !1), Object.keys(e).length > h(this, Z) && g(this, k, !0), g(this, $, !0), g(this, q, []), g(this, U, {}), this.errors = {}, this.answerData = {};
|
|
880
|
+
const n = _(this, ut, Ut).call(this, e);
|
|
881
|
+
if (Object.keys(e).length < h(this, Z)) {
|
|
882
|
+
const r = n.map((o, a) => _(this, Et, $t).call(this, o, n[a]));
|
|
883
|
+
return Promise.allSettled(r).then((o) => {
|
|
884
|
+
let a = {};
|
|
885
|
+
for (let f of o)
|
|
886
|
+
f.status === "fulfilled" && (a = { ...a, ...f.value });
|
|
887
|
+
return a;
|
|
883
888
|
});
|
|
884
889
|
} else {
|
|
885
|
-
let r = {},
|
|
886
|
-
|
|
890
|
+
let r = {}, o = 0, a = 1, f = Object.keys(e).length || 1, c = (i) => {
|
|
891
|
+
o += Object.keys(i).length, a = Math.round(o / f * 100);
|
|
887
892
|
};
|
|
888
|
-
for (let [i,
|
|
889
|
-
let
|
|
890
|
-
|
|
893
|
+
for (let [i, d] of Object.entries(n)) {
|
|
894
|
+
let y = await _(this, Et, $t).call(this, d, n[i], !0);
|
|
895
|
+
c(d), A && A({ percent: a }), r = { ...r, ...y };
|
|
891
896
|
}
|
|
892
897
|
return r;
|
|
893
898
|
}
|
|
894
899
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
900
|
+
/* батч для обработки operating time и паузы, используя BX24.callMethod('batch', ...) - пока что для некоторых методов update */
|
|
901
|
+
async batchUpdateField(e, A) {
|
|
902
|
+
h(this, K) && _(this, mt, Bt).call(this), A && g(this, tt, A), h(this, et) === !1 && g(this, k, !1), Object.keys(e).length > h(this, Z) && g(this, k, !0), g(this, $, !0), g(this, q, []), g(this, U, {}), this.errors = {}, this.answerData = {};
|
|
903
|
+
const n = _(this, ut, Ut).call(this, e);
|
|
904
|
+
if (Object.keys(e).length < h(this, Z)) {
|
|
905
|
+
let r = {};
|
|
906
|
+
for (let [o, a] of Object.entries(n)) {
|
|
907
|
+
let f = await _(this, Tt, te).call(this, a, n[o]);
|
|
908
|
+
r = { ...r, ...f };
|
|
909
|
+
}
|
|
910
|
+
return r;
|
|
911
|
+
} else {
|
|
912
|
+
let r = {}, o = 0, a = 1, f = Object.keys(e).length || 1, c = (i) => {
|
|
913
|
+
o += Object.keys(i).length, a = Math.round(o / f * 100);
|
|
914
|
+
};
|
|
915
|
+
for (let [i, d] of Object.entries(n)) {
|
|
916
|
+
let y = await _(this, Tt, te).call(this, d, n[i], !0);
|
|
917
|
+
c(d), A && A({ percent: a }), r = { ...r, ...y }, this.timeLimit && (console.log("Был достигнут лимит operating time - сделана остановка на 2 минуты, timeLimit = ", this.timeLimit), await new Promise((u) => setTimeout(u, 12e4)), this.timeLimit = !1, console.log("Остановка в 2 минуты по лимиту operating time закончена, timeLimit = ", this.timeLimit));
|
|
918
|
+
}
|
|
919
|
+
return r;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
async batchTotalCount(e, A) {
|
|
923
|
+
g(this, U, {}), this.errors = {};
|
|
924
|
+
let n = 1, r = 0, o = Object.keys(e).length || 1, a = (c) => {
|
|
925
|
+
r += Object.keys(c).length, n = Math.round(r / o * 100);
|
|
899
926
|
};
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
if (
|
|
903
|
-
const
|
|
904
|
-
return Promise.allSettled(
|
|
905
|
-
let
|
|
906
|
-
for (let
|
|
907
|
-
|
|
908
|
-
return
|
|
927
|
+
A && A({ percent: n });
|
|
928
|
+
const f = _(this, ut, Ut).call(this, e);
|
|
929
|
+
if (h(this, at)) {
|
|
930
|
+
const c = f.map((i) => _(this, Rt, ee).call(this, i).then((d) => (a(i), A && A({ percent: n }), d)));
|
|
931
|
+
return Promise.allSettled(c).then((i) => {
|
|
932
|
+
let d = {};
|
|
933
|
+
for (let y of i)
|
|
934
|
+
y.status === "fulfilled" && (d = { ...d, ...y.value });
|
|
935
|
+
return d;
|
|
909
936
|
});
|
|
910
937
|
} else {
|
|
911
|
-
let
|
|
912
|
-
for (let i of
|
|
913
|
-
let
|
|
914
|
-
|
|
938
|
+
let c = {};
|
|
939
|
+
for (let i of f) {
|
|
940
|
+
let d = await _(this, Rt, ee).call(this, i);
|
|
941
|
+
a(i), A && A({ percent: n }), c = { ...c, ...d };
|
|
915
942
|
}
|
|
916
|
-
return
|
|
943
|
+
return c;
|
|
917
944
|
}
|
|
918
945
|
}
|
|
919
946
|
}
|
|
920
|
-
|
|
921
|
-
let
|
|
922
|
-
if (!
|
|
923
|
-
return Math.round(
|
|
924
|
-
let
|
|
925
|
-
return Object.values(
|
|
926
|
-
const { total:
|
|
927
|
-
|
|
928
|
-
}),
|
|
929
|
-
},
|
|
930
|
-
clearInterval(
|
|
931
|
-
},
|
|
932
|
-
const n = _(this,
|
|
933
|
-
let
|
|
934
|
-
n && (
|
|
935
|
-
const { percent:
|
|
936
|
-
(
|
|
937
|
-
data:
|
|
938
|
-
percent:
|
|
939
|
-
allCount:
|
|
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
|
+
let e = 0;
|
|
949
|
+
if (!h(this, F))
|
|
950
|
+
return Math.round(e);
|
|
951
|
+
let A = 0, n = 0;
|
|
952
|
+
return Object.values(h(this, F)).forEach((r) => {
|
|
953
|
+
const { total: o, count: a } = r;
|
|
954
|
+
A += o ?? 0, n += a ?? 0;
|
|
955
|
+
}), A ? e = n / A * 100 : e = 100, { percent: Math.round(e), allCount: n, allTotal: A };
|
|
956
|
+
}, mt = new WeakSet(), Bt = function() {
|
|
957
|
+
clearInterval(h(this, K)), g(this, K, ""), g(this, F, ""), g(this, tt, ""), g(this, nt, "no");
|
|
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, o = _(this, Nt, Gt).call(this, A.total(), r);
|
|
960
|
+
let a = 1;
|
|
961
|
+
n && (a = r), h(this, tt) && (h(this, F) || g(this, F, {}), h(this, F)[e] && h(this, F)[e].count && (a += h(this, F)[e].count), h(this, F)[e] = { total: o, count: a }, h(this, K) || g(this, K, setInterval(() => {
|
|
962
|
+
const { percent: f, allCount: c, allTotal: i } = h(this, ct, It);
|
|
963
|
+
(h(this, nt) === "no" || h(this, nt) < h(this, ct, It).percent) && (h(this, tt).call(this, {
|
|
964
|
+
data: h(this, F),
|
|
965
|
+
percent: f,
|
|
966
|
+
allCount: c,
|
|
940
967
|
allTotal: i
|
|
941
|
-
}),
|
|
942
|
-
},
|
|
943
|
-
},
|
|
944
|
-
const
|
|
945
|
-
for (let r = 0; r < n.length; r +=
|
|
946
|
-
const
|
|
947
|
-
|
|
968
|
+
}), g(this, nt, h(this, ct, It).percent)), f === 100 && _(this, mt, Bt).call(this);
|
|
969
|
+
}, h(this, Ft))));
|
|
970
|
+
}, ut = new WeakSet(), Ut = function(e) {
|
|
971
|
+
const A = [], n = Object.entries(e);
|
|
972
|
+
for (let r = 0; r < n.length; r += h(this, Q)) {
|
|
973
|
+
const o = n.slice(r, r + h(this, Q));
|
|
974
|
+
A.push(Object.fromEntries(o));
|
|
948
975
|
}
|
|
949
|
-
return
|
|
950
|
-
},
|
|
976
|
+
return A;
|
|
977
|
+
}, Et = new WeakSet(), $t = function(e, A, n) {
|
|
951
978
|
return new Promise((r) => {
|
|
952
|
-
const
|
|
953
|
-
let
|
|
954
|
-
|
|
955
|
-
Object.entries(i).forEach(([
|
|
956
|
-
let
|
|
957
|
-
const N =
|
|
979
|
+
const o = _(this, Lt, re).call(this, A), a = [];
|
|
980
|
+
let f = 0, c = 0;
|
|
981
|
+
h(this, v).call(this, e, (i) => {
|
|
982
|
+
Object.entries(i).forEach(([d, y]) => {
|
|
983
|
+
let u = {};
|
|
984
|
+
const N = y.error();
|
|
958
985
|
if (N) {
|
|
959
|
-
let { query: { method:
|
|
960
|
-
this.errors[
|
|
986
|
+
let { query: { method: b }, answer: M } = y;
|
|
987
|
+
this.errors[d] = { error: N, method: b }, f += 1;
|
|
961
988
|
}
|
|
962
|
-
if (
|
|
963
|
-
for (let [
|
|
964
|
-
|
|
965
|
-
Object.keys(
|
|
989
|
+
if (y != null && y.answer && Object.keys(y.answer).length) {
|
|
990
|
+
for (let [b, M] of Object.entries(y.answer))
|
|
991
|
+
b != "result" && M && (u[b] = M);
|
|
992
|
+
Object.keys(u).length && (this.answerData[d] = u);
|
|
966
993
|
}
|
|
967
|
-
const
|
|
968
|
-
if (Array.isArray(
|
|
969
|
-
const
|
|
970
|
-
|
|
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) ? h(this, U)[d] = Y : typeof Y == "object" && Y !== null && Object.keys(Y).length === 0 ? h(this, U)[d] = [] : h(this, U)[d] = Y, c += G, n || _(this, gt, qt).call(this, { key: d, value: y }), G > h(this, Q) && G > W) {
|
|
996
|
+
const b = Math.ceil(G / h(this, Q)) - 1, M = Array.from({ length: b });
|
|
997
|
+
a.push([d, o[d], M]);
|
|
971
998
|
}
|
|
972
|
-
}),
|
|
999
|
+
}), c > 5e3 && h(this, et) === !1 && h(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
|
+
});
|
|
1001
|
+
});
|
|
1002
|
+
}, Tt = new WeakSet(), te = function(e, A, n) {
|
|
1003
|
+
let r = _(this, Jt, le).call(this, e);
|
|
1004
|
+
return new Promise((o) => {
|
|
1005
|
+
let a = 0;
|
|
1006
|
+
h(this, v).call(this, "batch", r, (f) => {
|
|
1007
|
+
var y, u, N, Y, W, G;
|
|
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
|
+
(c || Object.keys(c).length) && Object.entries(c).forEach(([b, M]) => {
|
|
1010
|
+
this.answerData[b] = M;
|
|
1011
|
+
}), (i || Object.keys(i).length) && Object.entries(i).forEach(([b, M]) => {
|
|
1012
|
+
var J, it;
|
|
1013
|
+
let X = ((J = e[b]) == null ? void 0 : J.method) ?? null, x = ((it = e[b]) == null ? void 0 : it.params) ?? null;
|
|
1014
|
+
this.errors[b] = {
|
|
1015
|
+
error: M,
|
|
1016
|
+
method: X,
|
|
1017
|
+
params: x
|
|
1018
|
+
}, a += 1;
|
|
1019
|
+
}), (d || Object.keys(d).length) && Object.entries(d).forEach(([b, M]) => {
|
|
1020
|
+
((M == null ? void 0 : M.operating) ?? 0) >= 475 && (this.timeLimit = !0);
|
|
1021
|
+
}), a > 0 && _(this, Ot, Ct).call(this), o(this.answerData);
|
|
973
1022
|
});
|
|
974
1023
|
});
|
|
975
|
-
},
|
|
976
|
-
return new Promise((
|
|
977
|
-
const n = _(this,
|
|
1024
|
+
}, Rt = new WeakSet(), ee = function(e) {
|
|
1025
|
+
return new Promise((A) => {
|
|
1026
|
+
const n = _(this, Lt, re).call(this, e);
|
|
978
1027
|
let r = 0;
|
|
979
|
-
|
|
980
|
-
Object.entries(
|
|
981
|
-
const
|
|
982
|
-
|
|
983
|
-
const i = _(this,
|
|
984
|
-
|
|
985
|
-
}), r > 0 && _(this,
|
|
1028
|
+
h(this, v).call(this, n, (o) => {
|
|
1029
|
+
Object.entries(o).forEach(([a, f]) => {
|
|
1030
|
+
const c = f.error();
|
|
1031
|
+
c && (this.errors[a] = c, r += 1);
|
|
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
|
+
h(this, U)[a] = y;
|
|
1034
|
+
}), r > 0 && _(this, Ot, Ct).call(this), A(_(this, ft, wt).call(this));
|
|
986
1035
|
});
|
|
987
1036
|
});
|
|
988
|
-
},
|
|
989
|
-
let
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
const
|
|
993
|
-
|
|
1037
|
+
}, kt = new WeakSet(), ae = function(e) {
|
|
1038
|
+
let A = [];
|
|
1039
|
+
e.forEach(([n, r, o]) => {
|
|
1040
|
+
o.forEach((a, f) => {
|
|
1041
|
+
const c = f + 1, i = h(this, Q) * c, y = [[n, c].join("_"), _(this, Wt, he).call(this, r, i)];
|
|
1042
|
+
A.length === h(this, Q) ? (h(this, q).push(A), A = [y]) : A.push(y);
|
|
994
1043
|
});
|
|
995
|
-
}),
|
|
996
|
-
},
|
|
997
|
-
const
|
|
998
|
-
Object.entries(r).forEach(([
|
|
999
|
-
const [
|
|
1000
|
-
Array.isArray(
|
|
1044
|
+
}), A.length && h(this, q).push(A);
|
|
1045
|
+
}, Pt = new WeakSet(), oe = function() {
|
|
1046
|
+
const e = [], A = [], n = (r) => {
|
|
1047
|
+
Object.entries(r).forEach(([o, a]) => {
|
|
1048
|
+
const [f] = o.split("_"), c = _(this, ot, yt).call(this, a.data());
|
|
1049
|
+
Array.isArray(c) && h(this, U)[f].push(...c), _(this, gt, qt).call(this, { key: f, value: a });
|
|
1001
1050
|
});
|
|
1002
1051
|
};
|
|
1003
|
-
return
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1052
|
+
return h(this, q).forEach((r, o) => {
|
|
1053
|
+
const a = Object.fromEntries(r), f = () => new Promise((c) => h(this, v).call(this, a, (i) => {
|
|
1054
|
+
h(this, k) ? n(i) : A[o] = i, c();
|
|
1006
1055
|
}));
|
|
1007
|
-
|
|
1008
|
-
}),
|
|
1009
|
-
|
|
1056
|
+
e.push(f);
|
|
1057
|
+
}), h(this, k) ? _(this, pt, se).call(this, e) : _(this, Mt, ie).call(this, e).then(() => {
|
|
1058
|
+
A.forEach(n);
|
|
1010
1059
|
});
|
|
1011
|
-
},
|
|
1012
|
-
return new Promise((
|
|
1013
|
-
},
|
|
1014
|
-
if (!
|
|
1060
|
+
}, St = new WeakSet(), Ae = function() {
|
|
1061
|
+
return new Promise((e) => setTimeout(e, 500));
|
|
1062
|
+
}, pt = new WeakSet(), se = function(e) {
|
|
1063
|
+
if (!e.length)
|
|
1015
1064
|
return Promise.resolve();
|
|
1016
|
-
const
|
|
1065
|
+
const A = e.shift();
|
|
1017
1066
|
return Promise.allSettled([
|
|
1018
|
-
|
|
1019
|
-
_(this,
|
|
1020
|
-
]).then(() =>
|
|
1021
|
-
},
|
|
1022
|
-
if (!
|
|
1067
|
+
A(),
|
|
1068
|
+
_(this, St, Ae).call(this)
|
|
1069
|
+
]).then(() => h(this, $) ? _(this, pt, se).call(this, e) : Promise.resolve());
|
|
1070
|
+
}, Mt = new WeakSet(), ie = function(e) {
|
|
1071
|
+
if (!e.length)
|
|
1023
1072
|
return Promise.resolve();
|
|
1024
|
-
const
|
|
1025
|
-
return _(this,
|
|
1026
|
-
},
|
|
1027
|
-
return Object.entries(
|
|
1028
|
-
|
|
1029
|
-
}),
|
|
1030
|
-
},
|
|
1031
|
-
return Object.entries(
|
|
1073
|
+
const A = e.shift();
|
|
1074
|
+
return _(this, St, Ae).call(this).then(() => A()).then(() => h(this, $) ? _(this, Mt, ie).call(this, e) : Promise.resolve());
|
|
1075
|
+
}, ft = new WeakSet(), wt = function() {
|
|
1076
|
+
return Object.entries(h(this, dt)).forEach(([e, A]) => {
|
|
1077
|
+
h(this, U)[e] && (h(this, U)[e] = A(h(this, U)[e]));
|
|
1078
|
+
}), h(this, U);
|
|
1079
|
+
}, Lt = new WeakSet(), re = function(e) {
|
|
1080
|
+
return Object.entries(e).reduce((A, [n, r]) => {
|
|
1032
1081
|
if (Array.isArray(r)) {
|
|
1033
|
-
const [
|
|
1034
|
-
|
|
1082
|
+
const [o, a = {}] = r;
|
|
1083
|
+
A[n] = [o, a];
|
|
1035
1084
|
} else {
|
|
1036
|
-
const { method:
|
|
1037
|
-
|
|
1085
|
+
const { method: o, params: a = {} } = r;
|
|
1086
|
+
A[n] = [o, a];
|
|
1038
1087
|
}
|
|
1039
|
-
return
|
|
1088
|
+
return A;
|
|
1040
1089
|
}, {});
|
|
1041
|
-
},
|
|
1042
|
-
const [n, r] =
|
|
1043
|
-
return [n, { start:
|
|
1044
|
-
},
|
|
1045
|
-
return ((
|
|
1046
|
-
},
|
|
1047
|
-
return
|
|
1048
|
-
},
|
|
1049
|
-
console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([
|
|
1050
|
-
console.info(`[${
|
|
1090
|
+
}, Wt = new WeakSet(), he = function(e, A) {
|
|
1091
|
+
const [n, r] = e;
|
|
1092
|
+
return [n, { start: A, ...r }];
|
|
1093
|
+
}, ot = new WeakSet(), yt = function(e) {
|
|
1094
|
+
return ((e == null ? void 0 : e.items) || (e == null ? void 0 : e.documents) || (e == null ? void 0 : e.tasks)) ?? e;
|
|
1095
|
+
}, Nt = new WeakSet(), Gt = function(e, A) {
|
|
1096
|
+
return e !== e && (e = 0), e === 0 && A === 0 ? 0 : e || A;
|
|
1097
|
+
}, Ot = new WeakSet(), Ct = function() {
|
|
1098
|
+
console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([e, A]) => {
|
|
1099
|
+
console.info(`[${e}]`, A);
|
|
1051
1100
|
}), console.groupEnd();
|
|
1101
|
+
}, Jt = new WeakSet(), le = function(e) {
|
|
1102
|
+
var n, r, o, a, f, c, i, d, y, u, N, Y, W, G, b, M, X, x, J, it, B, rt, R, t;
|
|
1103
|
+
let A = {
|
|
1104
|
+
halt: 0,
|
|
1105
|
+
cmd: {}
|
|
1106
|
+
};
|
|
1107
|
+
for (let s in e) {
|
|
1108
|
+
const l = s;
|
|
1109
|
+
let m = (n = e[s]) != null && n.method ? (r = e[s]) == null ? void 0 : r.method : "", p = "", E = "", S = "";
|
|
1110
|
+
const P = (a = (o = e[s]) == null ? void 0 : o.params) == null ? void 0 : a.fields;
|
|
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
|
+
for (let H in P)
|
|
1113
|
+
S += `&fields[${H}]=${P[H]}`;
|
|
1114
|
+
A.cmd[l] = `${m}${p}${E}${S}`.trim();
|
|
1115
|
+
}
|
|
1116
|
+
return A;
|
|
1052
1117
|
};
|
|
1053
|
-
var
|
|
1054
|
-
class
|
|
1118
|
+
var ht;
|
|
1119
|
+
class ce {
|
|
1055
1120
|
constructor() {
|
|
1056
|
-
|
|
1121
|
+
O(this, ht, {});
|
|
1057
1122
|
}
|
|
1058
1123
|
get hash() {
|
|
1059
1124
|
return this.createHash(8);
|
|
1060
1125
|
}
|
|
1061
1126
|
/** Генератор хеш-кода */
|
|
1062
|
-
createHash(
|
|
1063
|
-
let
|
|
1064
|
-
|
|
1065
|
-
for (let r = 0; r <
|
|
1066
|
-
n +=
|
|
1127
|
+
createHash(e) {
|
|
1128
|
+
let A = "abcdefghijklmnopqrstuvwxyz0123456789", n = "";
|
|
1129
|
+
e = e || 6;
|
|
1130
|
+
for (let r = 0; r < e; r++)
|
|
1131
|
+
n += A.charAt(Math.floor(Math.random() * A.length));
|
|
1067
1132
|
return n;
|
|
1068
1133
|
}
|
|
1069
1134
|
/** Фильтр часто запускаемых действий */
|
|
1070
|
-
actionFilter({ keyTimer:
|
|
1071
|
-
|
|
1135
|
+
actionFilter({ keyTimer: e, duration: A = 10, action: n }) {
|
|
1136
|
+
h(this, ht)[e] && (clearTimeout(h(this, ht)[e]), h(this, ht)[e] = null), n && (h(this, ht)[e] = setTimeout(() => {
|
|
1072
1137
|
n();
|
|
1073
|
-
},
|
|
1138
|
+
}, A));
|
|
1074
1139
|
}
|
|
1075
1140
|
/** Включение режима NO-SLEEP */
|
|
1076
1141
|
async noSleep() {
|
|
1077
|
-
let
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
}),
|
|
1142
|
+
let e = document.createElement("video");
|
|
1143
|
+
e.classList.add("no-sleep"), e.addEventListener("loadeddata", () => {
|
|
1144
|
+
e.style.position = "fixed", e.style.left = "-9999px", document.querySelector("body").append(e), e.play();
|
|
1145
|
+
}), e.addEventListener("ended", () => {
|
|
1081
1146
|
this.actionFilter({
|
|
1082
1147
|
keyTimer: "no-sleep",
|
|
1083
1148
|
duration: 5e3,
|
|
1084
|
-
action: () =>
|
|
1149
|
+
action: () => e.play()
|
|
1085
1150
|
});
|
|
1086
|
-
}),
|
|
1151
|
+
}), e.src = "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAP5tZGF0AAAAAQYAAADlZYiEE28FmH9jNWDBjI+Z/1tIBZsjfhbmcNNUpBFej0U3p+zhaJ3eemJRL2LUMa5tkidy6bp+eatLE3jBIY864TvaAmqEFCgLMTCwVbem1n3myAw9yDXQdR5HfU/8iYf+eneVnRf7Qx9M70XDUuPx1MJX671XJwAE0VAMpnhbcUDx0pTldvUX9KQPhkZNH3eyZHmObkAeyEJ2tl+BEBJIGc90BiqKL60+5EA6fXB6iG5UU/M5KsW8BNAAUw5CbRJIqohNk10fwKbUXwya03rqGkE8+wuYGtEbrVYXb+iOl1mHHVPLYQbIAAcGyAAHAAAFNG1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAAAAvAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAIldHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAFAAAAA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAAAAAAAAAAAQAAAAABnW1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAUhtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEIc3RibAAAAKRzdHNkAAAAAAAAAAEAAACUYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAC5hdmNDAU1AC//hABZnTUAL2wUH7ARAAAADAEAAAAQDxQq4AQAFaOrAZXIAAAAQcGFzcAAAAAEAAAABAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAO4AAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAAIadHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAgAAAAAAAAAvAAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAALwAAAAAAAQAAAAABkm1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAArEQAAAgAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAT1taW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAQFzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAAC7gAAAAViBYCAgAISCAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAAACAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAgAAAAEAAAAUc3RzegAAAAAAAAAEAAAAAgAAABRzdGNvAAAAAAAAAAEAAAEeAAAAGnNncGQBAAAAcm9sbAAAAAIAAAAB//8AAAAcc2JncAAAAAByb2xsAAAAAQAAAAIAAAABAAAAgXVkdGEAAAB5bWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWR0YQAAAAAAAAAAAAAAAAAAAAAfa2V5cwAAAAAAAAABAAAAD21kdGFlbmNvZGVyAAAALWlsc3QAAAAlAAAAAQAAAB1kYXRhAAAAAQAAAABMYXZmNTguMTIuMTAw";
|
|
1087
1152
|
}
|
|
1088
1153
|
/** Скачать данные в JSON-файл */
|
|
1089
|
-
downloadFileJson(
|
|
1090
|
-
let n = new Blob([JSON.stringify(
|
|
1091
|
-
|
|
1092
|
-
document.body.removeChild(
|
|
1154
|
+
downloadFileJson(e, A) {
|
|
1155
|
+
let n = new Blob([JSON.stringify(e)], { type: "application/json" }), r = URL.createObjectURL(n), o = document.createElement("a");
|
|
1156
|
+
o.style.display = "none", o.href = r, o.download = `${A}.json`, document.body.appendChild(o), o.click(), setTimeout(() => {
|
|
1157
|
+
document.body.removeChild(o), URL.revokeObjectURL(r);
|
|
1093
1158
|
}, 200);
|
|
1094
1159
|
}
|
|
1095
1160
|
}
|
|
1096
|
-
|
|
1097
|
-
const
|
|
1098
|
-
var
|
|
1099
|
-
class
|
|
1161
|
+
ht = new WeakMap();
|
|
1162
|
+
const Ht = new ce();
|
|
1163
|
+
var V, At, jt, lt, bt, st, _t, Xt, me, Dt, ne, xt, ue, Qt, fe, Zt, Ne;
|
|
1164
|
+
class Re {
|
|
1100
1165
|
constructor() {
|
|
1101
|
-
|
|
1166
|
+
O(this, Xt);
|
|
1102
1167
|
/** Вывод ошибок логера
|
|
1103
1168
|
* @param {'entity'} type - тип ошибки
|
|
1104
1169
|
*/
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1170
|
+
O(this, Dt);
|
|
1171
|
+
O(this, xt);
|
|
1172
|
+
O(this, Qt);
|
|
1173
|
+
O(this, Zt);
|
|
1174
|
+
O(this, V, "logger");
|
|
1175
|
+
O(this, At, !1);
|
|
1176
|
+
O(this, jt, 2e3);
|
|
1177
|
+
O(this, lt, /* @__PURE__ */ new Map());
|
|
1178
|
+
O(this, bt, {});
|
|
1179
|
+
O(this, st, null);
|
|
1180
|
+
O(this, _t, !1);
|
|
1116
1181
|
/** Очистка хранилища элементов старше 'N' месяцев */
|
|
1117
|
-
|
|
1118
|
-
_(this,
|
|
1182
|
+
C(this, "periodClear", 3);
|
|
1183
|
+
_(this, Xt, me).call(this);
|
|
1119
1184
|
}
|
|
1120
1185
|
/** Инициализация логера */
|
|
1121
1186
|
async init() {
|
|
1122
|
-
let
|
|
1187
|
+
let e = new z(BX24.callBatch), { entityList: A } = await e.batch({
|
|
1123
1188
|
entityList: { method: "entity.get" }
|
|
1124
1189
|
});
|
|
1125
|
-
if (
|
|
1126
|
-
if (
|
|
1127
|
-
|
|
1190
|
+
if (A && Array.isArray(A))
|
|
1191
|
+
if (A.find((r) => r.ENTITY == h(this, V)))
|
|
1192
|
+
g(this, At, !0);
|
|
1128
1193
|
else {
|
|
1129
|
-
let { entityAdd: r } = await
|
|
1194
|
+
let { entityAdd: r } = await e.batch({
|
|
1130
1195
|
entityAdd: {
|
|
1131
1196
|
method: "entity.add",
|
|
1132
1197
|
params: {
|
|
1133
|
-
ENTITY:
|
|
1134
|
-
NAME:
|
|
1198
|
+
ENTITY: h(this, V),
|
|
1199
|
+
NAME: h(this, V),
|
|
1135
1200
|
ACCESS: { AU: "X" }
|
|
1136
1201
|
}
|
|
1137
1202
|
}
|
|
1138
1203
|
});
|
|
1139
|
-
r &&
|
|
1204
|
+
r && g(this, At, !0);
|
|
1140
1205
|
}
|
|
1141
|
-
return _(this,
|
|
1206
|
+
return _(this, Qt, fe).call(this), h(this, At);
|
|
1142
1207
|
}
|
|
1143
1208
|
/**
|
|
1144
1209
|
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
@@ -1149,16 +1214,16 @@ class de {
|
|
|
1149
1214
|
* }; }}
|
|
1150
1215
|
* @returns {string}
|
|
1151
1216
|
*/
|
|
1152
|
-
start({ type:
|
|
1153
|
-
if (!
|
|
1154
|
-
_(this,
|
|
1217
|
+
start({ type: e, data: A }) {
|
|
1218
|
+
if (!h(this, At)) {
|
|
1219
|
+
_(this, Dt, ne).call(this, "entity");
|
|
1155
1220
|
return;
|
|
1156
1221
|
}
|
|
1157
|
-
const n =
|
|
1158
|
-
return
|
|
1159
|
-
type:
|
|
1160
|
-
data:
|
|
1161
|
-
userInfo:
|
|
1222
|
+
const n = Ht.hash;
|
|
1223
|
+
return h(this, lt).set(n, {
|
|
1224
|
+
type: e,
|
|
1225
|
+
data: A,
|
|
1226
|
+
userInfo: h(this, bt),
|
|
1162
1227
|
errorList: [],
|
|
1163
1228
|
status: "",
|
|
1164
1229
|
answer: null,
|
|
@@ -1172,138 +1237,138 @@ class de {
|
|
|
1172
1237
|
* status: 'success'|'fail'|'fail-runtime',
|
|
1173
1238
|
* answer: { [key]: unknown } }}
|
|
1174
1239
|
*/
|
|
1175
|
-
stop({ key:
|
|
1176
|
-
if (!
|
|
1177
|
-
_(this,
|
|
1240
|
+
stop({ key: e, errorList: A, status: n, answer: r }) {
|
|
1241
|
+
if (!h(this, At)) {
|
|
1242
|
+
_(this, Dt, ne).call(this, "entity");
|
|
1178
1243
|
return;
|
|
1179
1244
|
}
|
|
1180
|
-
let
|
|
1181
|
-
|
|
1245
|
+
let o = h(this, lt).get(e);
|
|
1246
|
+
A && (o.errorList = A), n && (o.status = n), r && (o.answer = r), Ht.actionFilter({
|
|
1182
1247
|
keyTimer: "add.entity.items",
|
|
1183
|
-
duration:
|
|
1248
|
+
duration: h(this, jt),
|
|
1184
1249
|
action: async () => {
|
|
1185
|
-
var
|
|
1186
|
-
await _(this,
|
|
1250
|
+
var a;
|
|
1251
|
+
await _(this, xt, ue).call(this), (a = o == null ? void 0 : o.data) != null && a.updateList && g(this, _t, !0);
|
|
1187
1252
|
}
|
|
1188
1253
|
});
|
|
1189
1254
|
}
|
|
1190
1255
|
/**
|
|
1191
1256
|
* @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
|
|
1192
1257
|
*/
|
|
1193
|
-
async getEntityList(
|
|
1258
|
+
async getEntityList(e) {
|
|
1194
1259
|
var r;
|
|
1195
|
-
if ((r =
|
|
1196
|
-
return
|
|
1197
|
-
let
|
|
1260
|
+
if ((r = h(this, st)) != null && r.length && !h(this, _t))
|
|
1261
|
+
return h(this, st);
|
|
1262
|
+
let A = new z(BX24.callBatch), { entityList: n } = await A.batch({
|
|
1198
1263
|
entityList: {
|
|
1199
1264
|
method: "entity.item.get",
|
|
1200
1265
|
params: {
|
|
1201
|
-
ENTITY:
|
|
1266
|
+
ENTITY: h(this, V),
|
|
1202
1267
|
SORT: { ID: "DESC" }
|
|
1203
1268
|
}
|
|
1204
1269
|
}
|
|
1205
|
-
},
|
|
1206
|
-
return n = n.map((
|
|
1207
|
-
const { ID:
|
|
1270
|
+
}, e);
|
|
1271
|
+
return n = n.map((o) => {
|
|
1272
|
+
const { ID: a, DATE_CREATE: f, DETAIL_TEXT: c } = o;
|
|
1208
1273
|
return {
|
|
1209
|
-
...JSON.parse(
|
|
1210
|
-
id:
|
|
1211
|
-
dateCreate:
|
|
1274
|
+
...JSON.parse(c),
|
|
1275
|
+
id: a,
|
|
1276
|
+
dateCreate: f
|
|
1212
1277
|
};
|
|
1213
|
-
}),
|
|
1278
|
+
}), g(this, _t, !1), n;
|
|
1214
1279
|
}
|
|
1215
1280
|
/** Выгрузка всех данных из хранилища в JSON-файл */
|
|
1216
1281
|
async downAllEntityJson() {
|
|
1217
|
-
let
|
|
1218
|
-
|
|
1282
|
+
let e = await this.getEntityList(), A = Yt().format("%Y-%m-%d");
|
|
1283
|
+
Ht.downloadFileJson(e, `sdklogger-entity-data__${A}`);
|
|
1219
1284
|
}
|
|
1220
1285
|
}
|
|
1221
|
-
|
|
1222
|
-
const
|
|
1286
|
+
V = new WeakMap(), At = new WeakMap(), jt = new WeakMap(), lt = new WeakMap(), bt = new WeakMap(), st = new WeakMap(), _t = new WeakMap(), Xt = new WeakSet(), me = async function() {
|
|
1287
|
+
const e = new z(BX24.callBatch), A = BX24.isAdmin(), { curUser: n } = await e.batch({
|
|
1223
1288
|
curUser: { method: "user.current" }
|
|
1224
1289
|
});
|
|
1225
|
-
|
|
1226
|
-
},
|
|
1227
|
-
|
|
1290
|
+
g(this, bt, { isAdmin: A, curUser: n });
|
|
1291
|
+
}, Dt = new WeakSet(), ne = function(e) {
|
|
1292
|
+
e == "entity" && Ht.actionFilter({
|
|
1228
1293
|
keyTimer: "error.logger.entity",
|
|
1229
1294
|
duration: 500,
|
|
1230
1295
|
action: () => {
|
|
1231
1296
|
console.error("Хранилище для логгера не инициализировано");
|
|
1232
1297
|
}
|
|
1233
1298
|
});
|
|
1234
|
-
},
|
|
1235
|
-
let
|
|
1236
|
-
for (let [n, r] of
|
|
1237
|
-
r.status && (
|
|
1299
|
+
}, xt = new WeakSet(), ue = async function() {
|
|
1300
|
+
let e = {}, A = new z(BX24.callBatch);
|
|
1301
|
+
for (let [n, r] of h(this, lt).entries())
|
|
1302
|
+
r.status && (e[n] = {
|
|
1238
1303
|
method: "entity.item.add",
|
|
1239
1304
|
params: {
|
|
1240
|
-
ENTITY:
|
|
1241
|
-
NAME:
|
|
1305
|
+
ENTITY: h(this, V),
|
|
1306
|
+
NAME: h(this, V),
|
|
1242
1307
|
DETAIL_TEXT: JSON.stringify(r)
|
|
1243
1308
|
}
|
|
1244
1309
|
});
|
|
1245
|
-
if (Object.keys(
|
|
1246
|
-
let n = await
|
|
1247
|
-
for (let [
|
|
1248
|
-
|
|
1310
|
+
if (Object.keys(e).length) {
|
|
1311
|
+
let n = await A.batch(e), { errors: r } = A;
|
|
1312
|
+
for (let [o, a] of Object.entries({ ...n, ...r }))
|
|
1313
|
+
h(this, lt).delete(o);
|
|
1249
1314
|
return !0;
|
|
1250
1315
|
}
|
|
1251
|
-
},
|
|
1252
|
-
let
|
|
1316
|
+
}, Qt = new WeakSet(), fe = async function() {
|
|
1317
|
+
let e = new z(BX24.callBatch), { serverTime: A } = await e.batch({
|
|
1253
1318
|
serverTime: { method: "server.time" }
|
|
1254
1319
|
});
|
|
1255
|
-
|
|
1256
|
-
let n =
|
|
1257
|
-
let { dateCreate:
|
|
1258
|
-
return
|
|
1320
|
+
h(this, st) || g(this, st, await this.getEntityList());
|
|
1321
|
+
let n = h(this, st).filter((r) => {
|
|
1322
|
+
let { dateCreate: o } = r;
|
|
1323
|
+
return Yt(new Date(o)).between(Yt(new Date(A)), "month") >= this.periodClear;
|
|
1259
1324
|
});
|
|
1260
|
-
_(this,
|
|
1261
|
-
},
|
|
1262
|
-
let
|
|
1263
|
-
let { id:
|
|
1325
|
+
_(this, Zt, Ne).call(this, n);
|
|
1326
|
+
}, Zt = new WeakSet(), Ne = async function(e) {
|
|
1327
|
+
let A = new z(BX24.callBatch), n = e.map((r) => {
|
|
1328
|
+
let { id: o } = r;
|
|
1264
1329
|
return {
|
|
1265
1330
|
method: "entity.item.delete",
|
|
1266
1331
|
params: {
|
|
1267
|
-
ENTITY:
|
|
1268
|
-
ID:
|
|
1332
|
+
ENTITY: h(this, V),
|
|
1333
|
+
ID: o
|
|
1269
1334
|
}
|
|
1270
1335
|
};
|
|
1271
1336
|
});
|
|
1272
|
-
return await
|
|
1337
|
+
return await A.batch(n);
|
|
1273
1338
|
};
|
|
1274
|
-
var
|
|
1275
|
-
class
|
|
1276
|
-
constructor(
|
|
1339
|
+
var Vt, Oe, zt, _e;
|
|
1340
|
+
class pe {
|
|
1341
|
+
constructor(e) {
|
|
1277
1342
|
/** Запрос данных о приложении */
|
|
1278
|
-
|
|
1343
|
+
O(this, Vt);
|
|
1279
1344
|
/** Запрос данных о текущем пользователе */
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
this.appConst =
|
|
1345
|
+
O(this, zt);
|
|
1346
|
+
C(this, "domain", "");
|
|
1347
|
+
C(this, "isAdmin", !1);
|
|
1348
|
+
C(this, "appInfo", null);
|
|
1349
|
+
C(this, "appConst", null);
|
|
1350
|
+
C(this, "userInfo", null);
|
|
1351
|
+
C(this, "placeData", null);
|
|
1352
|
+
C(this, "placeInfo", null);
|
|
1353
|
+
C(this, "logger", new Re());
|
|
1354
|
+
this.appConst = e;
|
|
1290
1355
|
}
|
|
1291
1356
|
init() {
|
|
1292
|
-
return new Promise((
|
|
1293
|
-
let
|
|
1357
|
+
return new Promise((e) => {
|
|
1358
|
+
let A = setInterval(() => {
|
|
1294
1359
|
window.BX24 && BX24.init(async () => {
|
|
1295
|
-
console.info("init BX24"), clearInterval(
|
|
1360
|
+
console.info("init BX24"), clearInterval(A), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await this.logger.init();
|
|
1296
1361
|
const [n, r] = await Promise.all([
|
|
1297
|
-
_(this,
|
|
1298
|
-
_(this,
|
|
1362
|
+
_(this, Vt, Oe).call(this),
|
|
1363
|
+
_(this, zt, _e).call(this)
|
|
1299
1364
|
]);
|
|
1300
|
-
this.appInfo = n, this.userInfo = r, new
|
|
1365
|
+
this.appInfo = n, this.userInfo = r, new ce().noSleep(), e(!0);
|
|
1301
1366
|
});
|
|
1302
1367
|
}, 100);
|
|
1303
1368
|
});
|
|
1304
1369
|
}
|
|
1305
|
-
userOption(
|
|
1306
|
-
return
|
|
1370
|
+
userOption(e, A) {
|
|
1371
|
+
return A ? BX24.userOption.set(e, A) : BX24.userOption.get(e);
|
|
1307
1372
|
}
|
|
1308
1373
|
/**
|
|
1309
1374
|
* @param {{
|
|
@@ -1323,32 +1388,32 @@ class Ee {
|
|
|
1323
1388
|
* }[]
|
|
1324
1389
|
* }[]
|
|
1325
1390
|
*/
|
|
1326
|
-
call({ method:
|
|
1391
|
+
call({ method: e, params: A, updateList: n }) {
|
|
1327
1392
|
let r = this.logger.start({
|
|
1328
1393
|
type: "call",
|
|
1329
|
-
data: { method:
|
|
1394
|
+
data: { method: e, params: A, updateList: n }
|
|
1330
1395
|
});
|
|
1331
|
-
return new Promise((
|
|
1332
|
-
|
|
1333
|
-
let
|
|
1334
|
-
if (
|
|
1335
|
-
for (let [
|
|
1336
|
-
|
|
1337
|
-
if (
|
|
1338
|
-
let
|
|
1339
|
-
console.error(
|
|
1340
|
-
answer:
|
|
1396
|
+
return new Promise((o) => {
|
|
1397
|
+
A || (A = {}), BX24.callMethod(e, A, (a) => {
|
|
1398
|
+
let f = {};
|
|
1399
|
+
if (a != null && a.answer)
|
|
1400
|
+
for (let [c, i] of Object.entries(a.answer))
|
|
1401
|
+
c != "result" && i && (f[c] = i);
|
|
1402
|
+
if (a.error()) {
|
|
1403
|
+
let c = a.error();
|
|
1404
|
+
console.error(c), this.logger.stop({
|
|
1405
|
+
answer: f,
|
|
1341
1406
|
key: r,
|
|
1342
1407
|
status: "fail",
|
|
1343
|
-
errorList: [
|
|
1344
|
-
}),
|
|
1408
|
+
errorList: [c.toString()]
|
|
1409
|
+
}), o(!1);
|
|
1345
1410
|
} else {
|
|
1346
|
-
let
|
|
1347
|
-
|
|
1348
|
-
answer:
|
|
1411
|
+
let c = a.data();
|
|
1412
|
+
c != null && c.items && (c = c.items), this.logger.stop({
|
|
1413
|
+
answer: f,
|
|
1349
1414
|
key: r,
|
|
1350
1415
|
status: "success"
|
|
1351
|
-
}),
|
|
1416
|
+
}), o(c);
|
|
1352
1417
|
}
|
|
1353
1418
|
});
|
|
1354
1419
|
});
|
|
@@ -1372,121 +1437,161 @@ class Ee {
|
|
|
1372
1437
|
* }[]
|
|
1373
1438
|
* }}
|
|
1374
1439
|
*/
|
|
1375
|
-
async batch(
|
|
1376
|
-
let
|
|
1440
|
+
async batch(e, A, { updateList: n, errorCall: r, limitCommandSerial: o } = {}) {
|
|
1441
|
+
let a = new z(BX24.callBatch), f = this.logger.start({
|
|
1377
1442
|
type: "batch",
|
|
1378
|
-
data: { commandList:
|
|
1443
|
+
data: { commandList: e, updateList: n }
|
|
1444
|
+
});
|
|
1445
|
+
o && (a.limitCommandSerial = o);
|
|
1446
|
+
try {
|
|
1447
|
+
let c = await a.batch(e, A);
|
|
1448
|
+
if (Object.keys(a.errors).length) {
|
|
1449
|
+
let i = Object.entries(a.errors).map(([d, y]) => {
|
|
1450
|
+
var u;
|
|
1451
|
+
return {
|
|
1452
|
+
key: d,
|
|
1453
|
+
error: `${y == null ? void 0 : y.method} ${(u = y == null ? void 0 : y.error) == null ? void 0 : u.toString()}`.trim()
|
|
1454
|
+
};
|
|
1455
|
+
});
|
|
1456
|
+
r && r(a.errors), this.logger.stop({
|
|
1457
|
+
key: f,
|
|
1458
|
+
status: "fail",
|
|
1459
|
+
errorList: i,
|
|
1460
|
+
answer: a.answerData
|
|
1461
|
+
});
|
|
1462
|
+
} else
|
|
1463
|
+
this.logger.stop({
|
|
1464
|
+
key: f,
|
|
1465
|
+
status: "success",
|
|
1466
|
+
answer: a.answerData
|
|
1467
|
+
});
|
|
1468
|
+
return c;
|
|
1469
|
+
} catch (c) {
|
|
1470
|
+
let i = c == null ? void 0 : c.toString();
|
|
1471
|
+
return this.logger.stop({
|
|
1472
|
+
key: f,
|
|
1473
|
+
status: "fail-runtime",
|
|
1474
|
+
errorList: [i],
|
|
1475
|
+
answer: a.answerData
|
|
1476
|
+
}), console.error(c), !1;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
/* батч для обработки operating time и паузы, используя BX24.callMethod('batch', ...) - пока что для некоторых методов update */
|
|
1480
|
+
async batchUpdateField(e, A, { updateList: n, errorCall: r, limitCommandSerial: o } = {}) {
|
|
1481
|
+
let a = new z(BX24.callMethod), f = this.logger.start({
|
|
1482
|
+
type: "callMethod-batch",
|
|
1483
|
+
data: { commandList: e, updateList: n }
|
|
1379
1484
|
});
|
|
1380
|
-
|
|
1485
|
+
o && (a.limitCommandSerial = o);
|
|
1381
1486
|
try {
|
|
1382
|
-
let
|
|
1383
|
-
if (Object.keys(
|
|
1384
|
-
let i = Object.entries(
|
|
1385
|
-
var
|
|
1487
|
+
let c = await a.batchUpdateField(e, A);
|
|
1488
|
+
if (Object.keys(a.errors).length) {
|
|
1489
|
+
let i = Object.entries(a.errors).map(([d, y]) => {
|
|
1490
|
+
var u;
|
|
1386
1491
|
return {
|
|
1387
|
-
key:
|
|
1388
|
-
error: `${
|
|
1492
|
+
key: d,
|
|
1493
|
+
error: `${y == null ? void 0 : y.method} ${(u = y == null ? void 0 : y.error) == null ? void 0 : u.toString()}`.trim()
|
|
1389
1494
|
};
|
|
1390
1495
|
});
|
|
1391
|
-
r && r(
|
|
1392
|
-
key:
|
|
1496
|
+
r && r(a.errors), this.logger.stop({
|
|
1497
|
+
key: f,
|
|
1393
1498
|
status: "fail",
|
|
1394
1499
|
errorList: i,
|
|
1395
|
-
answer:
|
|
1500
|
+
answer: a.answerData
|
|
1396
1501
|
});
|
|
1397
1502
|
} else
|
|
1398
1503
|
this.logger.stop({
|
|
1399
|
-
key:
|
|
1504
|
+
key: f,
|
|
1400
1505
|
status: "success",
|
|
1401
|
-
answer:
|
|
1506
|
+
answer: a.answerData
|
|
1402
1507
|
});
|
|
1403
|
-
return
|
|
1404
|
-
} catch (
|
|
1405
|
-
let i =
|
|
1508
|
+
return c;
|
|
1509
|
+
} catch (c) {
|
|
1510
|
+
let i = c == null ? void 0 : c.toString();
|
|
1406
1511
|
return this.logger.stop({
|
|
1407
|
-
key:
|
|
1512
|
+
key: f,
|
|
1408
1513
|
status: "fail-runtime",
|
|
1409
1514
|
errorList: [i],
|
|
1410
|
-
answer:
|
|
1411
|
-
}), console.error(
|
|
1515
|
+
answer: a.answerData
|
|
1516
|
+
}), console.error(c), !1;
|
|
1412
1517
|
}
|
|
1413
1518
|
}
|
|
1414
1519
|
/**
|
|
1415
1520
|
* @param commandList - объект/массив команд
|
|
1416
1521
|
* @param progressCall - callback(data), в data приходят данные о загрузке данных
|
|
1417
1522
|
*/
|
|
1418
|
-
async batchTotalCount(
|
|
1419
|
-
let n = new
|
|
1523
|
+
async batchTotalCount(e, A) {
|
|
1524
|
+
let n = new z(BX24.callBatch), r = this.logger.start({
|
|
1420
1525
|
type: "batch",
|
|
1421
|
-
data: { commandList:
|
|
1526
|
+
data: { commandList: e }
|
|
1422
1527
|
});
|
|
1423
1528
|
try {
|
|
1424
|
-
let
|
|
1529
|
+
let o = await n.batchTotalCount(e, A);
|
|
1425
1530
|
if (Object.keys(n.errors).length) {
|
|
1426
|
-
let
|
|
1427
|
-
key:
|
|
1428
|
-
error:
|
|
1531
|
+
let a = Object.entries(n.errors).map(([f, c]) => ({
|
|
1532
|
+
key: f,
|
|
1533
|
+
error: c.toString()
|
|
1429
1534
|
}));
|
|
1430
1535
|
this.logger.stop({
|
|
1431
1536
|
key: r,
|
|
1432
1537
|
status: "fail",
|
|
1433
|
-
errorList:
|
|
1538
|
+
errorList: a
|
|
1434
1539
|
});
|
|
1435
1540
|
} else
|
|
1436
1541
|
this.logger.stop({
|
|
1437
1542
|
key: r,
|
|
1438
1543
|
status: "success"
|
|
1439
1544
|
});
|
|
1440
|
-
return
|
|
1441
|
-
} catch (
|
|
1545
|
+
return o;
|
|
1546
|
+
} catch (o) {
|
|
1442
1547
|
return this.logger.stop({
|
|
1443
1548
|
key: r,
|
|
1444
1549
|
status: "fail",
|
|
1445
|
-
errorList: [
|
|
1446
|
-
}), console.error(
|
|
1550
|
+
errorList: [o.toString()]
|
|
1551
|
+
}), console.error(o), !1;
|
|
1447
1552
|
}
|
|
1448
1553
|
}
|
|
1449
1554
|
/** Запрос данных о местах встройки приложения */
|
|
1450
1555
|
getPlacement() {
|
|
1451
|
-
return this.call({ method: "placement.get" }).then((
|
|
1556
|
+
return this.call({ method: "placement.get" }).then((e) => (this.placeData || (this.placeData = e), e));
|
|
1452
1557
|
}
|
|
1453
1558
|
/** Встройка приложения в place */
|
|
1454
|
-
async placementBind(
|
|
1559
|
+
async placementBind(e) {
|
|
1455
1560
|
this.placeData || (this.placeData = await this.getPlacement());
|
|
1456
|
-
const { appName:
|
|
1457
|
-
let
|
|
1458
|
-
r.includes(
|
|
1459
|
-
window.placementUnBind[
|
|
1561
|
+
const { appName: A, pathApp: n } = this.appConst, r = this.placeData.map((a) => a.placement);
|
|
1562
|
+
let o = this.placeData.find((a) => a.placement == e);
|
|
1563
|
+
r.includes(e) ? o.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[e] || this.placementUnBind(o).then(() => {
|
|
1564
|
+
window.placementUnBind[e] || (window.placementUnBind[e] = !0, this.placementBind(e));
|
|
1460
1565
|
})) : this.call({
|
|
1461
1566
|
method: "placement.bind",
|
|
1462
1567
|
params: {
|
|
1463
|
-
PLACEMENT:
|
|
1568
|
+
PLACEMENT: e,
|
|
1464
1569
|
HANDLER: n,
|
|
1465
1570
|
LANG_ALL: {
|
|
1466
1571
|
ru: {
|
|
1467
|
-
TITLE:
|
|
1572
|
+
TITLE: A
|
|
1468
1573
|
}
|
|
1469
1574
|
}
|
|
1470
1575
|
}
|
|
1471
|
-
}).then((
|
|
1472
|
-
|
|
1576
|
+
}).then((a) => {
|
|
1577
|
+
a ? console.info("Приложение успешно встроено в", e) : console.warn("Приложение не может быть встроено в", e);
|
|
1473
1578
|
});
|
|
1474
1579
|
}
|
|
1475
1580
|
/** Отвязка встройки из place */
|
|
1476
|
-
placementUnBind(
|
|
1477
|
-
const { pathApp:
|
|
1581
|
+
placementUnBind(e) {
|
|
1582
|
+
const { pathApp: A, appName: n } = this.appConst;
|
|
1478
1583
|
return this.call({
|
|
1479
1584
|
method: "placement.unbind",
|
|
1480
1585
|
params: {
|
|
1481
|
-
PLACEMENT:
|
|
1482
|
-
HANDLER:
|
|
1586
|
+
PLACEMENT: e,
|
|
1587
|
+
HANDLER: A,
|
|
1483
1588
|
LANG_ALL: {
|
|
1484
1589
|
ru: {
|
|
1485
1590
|
TITLE: n
|
|
1486
1591
|
}
|
|
1487
1592
|
}
|
|
1488
1593
|
}
|
|
1489
|
-
}).then((r) => (console.log("Встройка отвязана",
|
|
1594
|
+
}).then((r) => (console.log("Встройка отвязана", e), r));
|
|
1490
1595
|
}
|
|
1491
1596
|
/** Чат-бот */
|
|
1492
1597
|
/* получение списка ботов */
|
|
@@ -1494,22 +1599,22 @@ class Ee {
|
|
|
1494
1599
|
return this.call({
|
|
1495
1600
|
method: "imbot.bot.list",
|
|
1496
1601
|
params: {}
|
|
1497
|
-
}).then((
|
|
1498
|
-
let
|
|
1499
|
-
return console.log("chat-bot list:",
|
|
1602
|
+
}).then((e) => {
|
|
1603
|
+
let A = Object.values(e);
|
|
1604
|
+
return console.log("chat-bot list:", A), A;
|
|
1500
1605
|
});
|
|
1501
1606
|
}
|
|
1502
1607
|
/* регистрация бота */
|
|
1503
|
-
regBot({ code:
|
|
1504
|
-
const { appName: r, pathApp:
|
|
1608
|
+
regBot({ code: e, type: A, name: n }) {
|
|
1609
|
+
const { appName: r, pathApp: o, chatBotLogo: a } = this.appConst, f = this.appInfo.ID;
|
|
1505
1610
|
return this.call({
|
|
1506
1611
|
method: "imbot.register",
|
|
1507
1612
|
params: {
|
|
1508
|
-
CODE:
|
|
1613
|
+
CODE: e ?? this.appInfo.CODE,
|
|
1509
1614
|
// Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
|
|
1510
|
-
TYPE:
|
|
1615
|
+
TYPE: A ?? "O",
|
|
1511
1616
|
// Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
|
|
1512
|
-
EVENT_HANDLER:
|
|
1617
|
+
EVENT_HANDLER: o,
|
|
1513
1618
|
// Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
|
|
1514
1619
|
OPENLINE: "Y",
|
|
1515
1620
|
// Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
|
|
@@ -1517,7 +1622,7 @@ class Ee {
|
|
|
1517
1622
|
// строковый идентификатор чат-бота, используется только в режиме Вебхуков
|
|
1518
1623
|
PROPERTIES: {
|
|
1519
1624
|
// Личные данные чат-бота (обяз.)
|
|
1520
|
-
NAME: `${n ?? r} - бот #${
|
|
1625
|
+
NAME: `${n ?? r} - бот #${f}`,
|
|
1521
1626
|
// Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1522
1627
|
LAST_NAME: "",
|
|
1523
1628
|
// Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
@@ -1525,7 +1630,7 @@ class Ee {
|
|
|
1525
1630
|
// Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
|
|
1526
1631
|
EMAIL: "",
|
|
1527
1632
|
// E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
|
|
1528
|
-
PERSONAL_BIRTHDAY:
|
|
1633
|
+
PERSONAL_BIRTHDAY: Yt().format("%Y-%m-%d"),
|
|
1529
1634
|
// День рождения в формате YYYY-mm-dd
|
|
1530
1635
|
WORK_POSITION: "Почтальон",
|
|
1531
1636
|
// Занимаемая должность, используется как описание чат-бота
|
|
@@ -1533,35 +1638,35 @@ class Ee {
|
|
|
1533
1638
|
// Ссылка на сайт
|
|
1534
1639
|
PERSONAL_GENDER: "M",
|
|
1535
1640
|
// Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
|
|
1536
|
-
PERSONAL_PHOTO:
|
|
1641
|
+
PERSONAL_PHOTO: a ?? ""
|
|
1537
1642
|
// Аватар чат-бота - base64
|
|
1538
1643
|
}
|
|
1539
1644
|
}
|
|
1540
|
-
}).then((
|
|
1645
|
+
}).then((c) => (console.log("Чат-бот добавлен", c), c));
|
|
1541
1646
|
}
|
|
1542
1647
|
/* Убрать регистрацию бота */
|
|
1543
|
-
unRegBot(
|
|
1648
|
+
unRegBot(e) {
|
|
1544
1649
|
return this.call({
|
|
1545
1650
|
method: "imbot.unregister",
|
|
1546
1651
|
params: {
|
|
1547
|
-
BOT_ID:
|
|
1652
|
+
BOT_ID: e
|
|
1548
1653
|
}
|
|
1549
|
-
}).then((
|
|
1654
|
+
}).then((A) => (console.log("чат-бот удален", A), A));
|
|
1550
1655
|
}
|
|
1551
1656
|
/* Получение данных логера */
|
|
1552
|
-
getLoggerList(
|
|
1553
|
-
return this.logger.getEntityList(
|
|
1657
|
+
getLoggerList(e) {
|
|
1658
|
+
return this.logger.getEntityList(e);
|
|
1554
1659
|
}
|
|
1555
1660
|
}
|
|
1556
|
-
|
|
1661
|
+
Vt = new WeakSet(), Oe = function() {
|
|
1557
1662
|
return this.call({ method: "app.info" });
|
|
1558
|
-
},
|
|
1663
|
+
}, zt = new WeakSet(), _e = function() {
|
|
1559
1664
|
return this.call({ method: "user.current" });
|
|
1560
1665
|
};
|
|
1561
1666
|
export {
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1667
|
+
z as Batch,
|
|
1668
|
+
pe as BxBoot,
|
|
1669
|
+
ce as BxHelper,
|
|
1670
|
+
Re as BxLogger,
|
|
1671
|
+
Yt as tempus
|
|
1567
1672
|
};
|