@datapos/datapos-tool-csv-parse 0.0.40 → 0.0.41
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/datapos-tool-csv-parse.es.js +160 -160
- package/dist/types/src/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var ie = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, P = [], F = [], Qt = typeof Uint8Array < "u" ? Uint8Array : Array, $e = !1;
|
|
2
|
-
function
|
|
2
|
+
function lt() {
|
|
3
3
|
$e = !0;
|
|
4
4
|
for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = 0, r = t.length; e < r; ++e)
|
|
5
5
|
P[e] = t[e], F[t.charCodeAt(e)] = e;
|
|
6
6
|
F[45] = 62, F[95] = 63;
|
|
7
7
|
}
|
|
8
8
|
function Gt(t) {
|
|
9
|
-
$e ||
|
|
9
|
+
$e || lt();
|
|
10
10
|
var e, r, n, i, o, s, f = t.length;
|
|
11
11
|
if (f % 4 > 0)
|
|
12
12
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
13
13
|
o = t[f - 2] === "=" ? 2 : t[f - 1] === "=" ? 1 : 0, s = new Qt(f * 3 / 4 - o), n = o > 0 ? f - 4 : f;
|
|
14
|
-
var
|
|
14
|
+
var u = 0;
|
|
15
15
|
for (e = 0, r = 0; e < n; e += 4, r += 3)
|
|
16
|
-
i = F[t.charCodeAt(e)] << 18 | F[t.charCodeAt(e + 1)] << 12 | F[t.charCodeAt(e + 2)] << 6 | F[t.charCodeAt(e + 3)], s[
|
|
17
|
-
return o === 2 ? (i = F[t.charCodeAt(e)] << 2 | F[t.charCodeAt(e + 1)] >> 4, s[
|
|
16
|
+
i = F[t.charCodeAt(e)] << 18 | F[t.charCodeAt(e + 1)] << 12 | F[t.charCodeAt(e + 2)] << 6 | F[t.charCodeAt(e + 3)], s[u++] = i >> 16 & 255, s[u++] = i >> 8 & 255, s[u++] = i & 255;
|
|
17
|
+
return o === 2 ? (i = F[t.charCodeAt(e)] << 2 | F[t.charCodeAt(e + 1)] >> 4, s[u++] = i & 255) : o === 1 && (i = F[t.charCodeAt(e)] << 10 | F[t.charCodeAt(e + 1)] << 4 | F[t.charCodeAt(e + 2)] >> 2, s[u++] = i >> 8 & 255, s[u++] = i & 255), s;
|
|
18
18
|
}
|
|
19
19
|
function Zt(t) {
|
|
20
20
|
return P[t >> 18 & 63] + P[t >> 12 & 63] + P[t >> 6 & 63] + P[t & 63];
|
|
@@ -25,31 +25,31 @@ function Xt(t, e, r) {
|
|
|
25
25
|
return i.join("");
|
|
26
26
|
}
|
|
27
27
|
function Qe(t) {
|
|
28
|
-
$e ||
|
|
29
|
-
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, f = 0,
|
|
30
|
-
o.push(Xt(t, f, f + s >
|
|
28
|
+
$e || lt();
|
|
29
|
+
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, f = 0, u = r - n; f < u; f += s)
|
|
30
|
+
o.push(Xt(t, f, f + s > u ? u : f + s));
|
|
31
31
|
return n === 1 ? (e = t[r - 1], i += P[e >> 2], i += P[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += P[e >> 10], i += P[e >> 4 & 63], i += P[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
33
|
function ve(t, e, r, n, i) {
|
|
34
|
-
var o, s, f = i * 8 - n - 1,
|
|
34
|
+
var o, s, f = i * 8 - n - 1, u = (1 << f) - 1, l = u >> 1, h = -7, c = r ? i - 1 : 0, g = r ? -1 : 1, y = t[e + c];
|
|
35
35
|
for (c += g, o = y & (1 << -h) - 1, y >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += g, h -= 8)
|
|
36
36
|
;
|
|
37
37
|
for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c += g, h -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
|
-
o = 1 -
|
|
40
|
+
o = 1 - l;
|
|
41
41
|
else {
|
|
42
|
-
if (o ===
|
|
42
|
+
if (o === u)
|
|
43
43
|
return s ? NaN : (y ? -1 : 1) * (1 / 0);
|
|
44
|
-
s = s + Math.pow(2, n), o = o -
|
|
44
|
+
s = s + Math.pow(2, n), o = o - l;
|
|
45
45
|
}
|
|
46
46
|
return (y ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (
|
|
49
|
+
var s, f, u, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, g = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = n ? 0 : o - 1, O = n ? 1 : -1, E = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), s + c >= 1 ? e += g / u : e += g * Math.pow(2, 1 - c), e * u >= 2 && (s++, u /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * u - 1) * Math.pow(2, i), s = s + c) : (f = e * Math.pow(2, c - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + y] = f & 255, y += O, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f,
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + y] = s & 255, y += O, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
54
|
t[r + y - O] |= E * 128;
|
|
55
55
|
}
|
|
@@ -320,9 +320,9 @@ a.prototype.compare = function(e, r, n, i, o) {
|
|
|
320
320
|
if (r >= n)
|
|
321
321
|
return 1;
|
|
322
322
|
if (r >>>= 0, n >>>= 0, i >>>= 0, o >>>= 0, this === e) return 0;
|
|
323
|
-
for (var s = o - i, f = n - r,
|
|
324
|
-
if (
|
|
325
|
-
s =
|
|
323
|
+
for (var s = o - i, f = n - r, u = Math.min(s, f), l = this.slice(i, o), h = e.slice(r, n), c = 0; c < u; ++c)
|
|
324
|
+
if (l[c] !== h[c]) {
|
|
325
|
+
s = l[c], f = h[c];
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
return s < f ? -1 : f < s ? 1 : 0;
|
|
@@ -348,25 +348,25 @@ function Ge(t, e, r, n, i) {
|
|
|
348
348
|
return -1;
|
|
349
349
|
o = 2, s /= 2, f /= 2, r /= 2;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function u(y, O) {
|
|
352
352
|
return o === 1 ? y[O] : y.readUInt16BE(O * o);
|
|
353
353
|
}
|
|
354
|
-
var
|
|
354
|
+
var l;
|
|
355
355
|
if (i) {
|
|
356
356
|
var h = -1;
|
|
357
|
-
for (
|
|
358
|
-
if (
|
|
359
|
-
if (h === -1 && (h =
|
|
357
|
+
for (l = r; l < s; l++)
|
|
358
|
+
if (u(t, l) === u(e, h === -1 ? 0 : l - h)) {
|
|
359
|
+
if (h === -1 && (h = l), l - h + 1 === f) return h * o;
|
|
360
360
|
} else
|
|
361
|
-
h !== -1 && (
|
|
361
|
+
h !== -1 && (l -= l - h), h = -1;
|
|
362
362
|
} else
|
|
363
|
-
for (r + f > s && (r = s - f),
|
|
363
|
+
for (r + f > s && (r = s - f), l = r; l >= 0; l--) {
|
|
364
364
|
for (var c = !0, g = 0; g < f; g++)
|
|
365
|
-
if (
|
|
365
|
+
if (u(t, l + g) !== u(e, g)) {
|
|
366
366
|
c = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
|
-
if (c) return
|
|
369
|
+
if (c) return l;
|
|
370
370
|
}
|
|
371
371
|
return -1;
|
|
372
372
|
}
|
|
@@ -402,10 +402,10 @@ function _t(t, e, r, n) {
|
|
|
402
402
|
function ar(t, e, r, n) {
|
|
403
403
|
return _t(t, e, r, n);
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function ur(t, e, r, n) {
|
|
406
406
|
return xe(Et(e), t, r, n);
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function lr(t, e, r, n) {
|
|
409
409
|
return xe(Er(e, t.length - r), t, r, n);
|
|
410
410
|
}
|
|
411
411
|
a.prototype.write = function(e, r, n, i) {
|
|
@@ -436,12 +436,12 @@ a.prototype.write = function(e, r, n, i) {
|
|
|
436
436
|
case "binary":
|
|
437
437
|
return ar(this, e, r, n);
|
|
438
438
|
case "base64":
|
|
439
|
-
return
|
|
439
|
+
return ur(this, e, r, n);
|
|
440
440
|
case "ucs2":
|
|
441
441
|
case "ucs-2":
|
|
442
442
|
case "utf16le":
|
|
443
443
|
case "utf-16le":
|
|
444
|
-
return
|
|
444
|
+
return lr(this, e, r, n);
|
|
445
445
|
default:
|
|
446
446
|
if (s) throw new TypeError("Unknown encoding: " + i);
|
|
447
447
|
i = ("" + i).toLowerCase(), s = !0;
|
|
@@ -461,19 +461,19 @@ function wt(t, e, r) {
|
|
|
461
461
|
for (var n = [], i = e; i < r; ) {
|
|
462
462
|
var o = t[i], s = null, f = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
|
|
463
463
|
if (i + f <= r) {
|
|
464
|
-
var
|
|
464
|
+
var u, l, h, c;
|
|
465
465
|
switch (f) {
|
|
466
466
|
case 1:
|
|
467
467
|
o < 128 && (s = o);
|
|
468
468
|
break;
|
|
469
469
|
case 2:
|
|
470
|
-
|
|
470
|
+
u = t[i + 1], (u & 192) === 128 && (c = (o & 31) << 6 | u & 63, c > 127 && (s = c));
|
|
471
471
|
break;
|
|
472
472
|
case 3:
|
|
473
|
-
|
|
473
|
+
u = t[i + 1], l = t[i + 2], (u & 192) === 128 && (l & 192) === 128 && (c = (o & 15) << 12 | (u & 63) << 6 | l & 63, c > 2047 && (c < 55296 || c > 57343) && (s = c));
|
|
474
474
|
break;
|
|
475
475
|
case 4:
|
|
476
|
-
|
|
476
|
+
u = t[i + 1], l = t[i + 2], h = t[i + 3], (u & 192) === 128 && (l & 192) === 128 && (h & 192) === 128 && (c = (o & 15) << 18 | (u & 63) << 12 | (l & 63) << 6 | h & 63, c > 65535 && c < 1114112 && (s = c));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
s === null ? (s = 65533, f = 1) : s > 65535 && (s -= 65536, n.push(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n.push(s), i += f;
|
|
@@ -661,9 +661,9 @@ a.prototype.writeIntLE = function(e, r, n, i) {
|
|
|
661
661
|
var o = Math.pow(2, 8 * n - 1);
|
|
662
662
|
D(this, e, r, n, o - 1, -o);
|
|
663
663
|
}
|
|
664
|
-
var s = 0, f = 1,
|
|
664
|
+
var s = 0, f = 1, u = 0;
|
|
665
665
|
for (this[r] = e & 255; ++s < n && (f *= 256); )
|
|
666
|
-
e < 0 &&
|
|
666
|
+
e < 0 && u === 0 && this[r + s - 1] !== 0 && (u = 1), this[r + s] = (e / f >> 0) - u & 255;
|
|
667
667
|
return r + n;
|
|
668
668
|
};
|
|
669
669
|
a.prototype.writeIntBE = function(e, r, n, i) {
|
|
@@ -671,9 +671,9 @@ a.prototype.writeIntBE = function(e, r, n, i) {
|
|
|
671
671
|
var o = Math.pow(2, 8 * n - 1);
|
|
672
672
|
D(this, e, r, n, o - 1, -o);
|
|
673
673
|
}
|
|
674
|
-
var s = n - 1, f = 1,
|
|
674
|
+
var s = n - 1, f = 1, u = 0;
|
|
675
675
|
for (this[r + s] = e & 255; --s >= 0 && (f *= 256); )
|
|
676
|
-
e < 0 &&
|
|
676
|
+
e < 0 && u === 0 && this[r + s + 1] !== 0 && (u = 1), this[r + s] = (e / f >> 0) - u & 255;
|
|
677
677
|
return r + n;
|
|
678
678
|
};
|
|
679
679
|
a.prototype.writeInt8 = function(e, r, n) {
|
|
@@ -756,9 +756,9 @@ a.prototype.fill = function(e, r, n, i) {
|
|
|
756
756
|
for (s = r; s < n; ++s)
|
|
757
757
|
this[s] = e;
|
|
758
758
|
else {
|
|
759
|
-
var f = $(e) ? e : we(new a(e, i).toString()),
|
|
759
|
+
var f = $(e) ? e : we(new a(e, i).toString()), u = f.length;
|
|
760
760
|
for (s = 0; s < n - r; ++s)
|
|
761
|
-
this[s + r] = f[s %
|
|
761
|
+
this[s + r] = f[s % u];
|
|
762
762
|
}
|
|
763
763
|
return this;
|
|
764
764
|
};
|
|
@@ -907,8 +907,8 @@ function Cr(t, e, r, n, i, o) {
|
|
|
907
907
|
if (e)
|
|
908
908
|
t.call(r, n, i, o);
|
|
909
909
|
else
|
|
910
|
-
for (var s = t.length, f = ae(t, s),
|
|
911
|
-
f[
|
|
910
|
+
for (var s = t.length, f = ae(t, s), u = 0; u < s; ++u)
|
|
911
|
+
f[u].call(r, n, i, o);
|
|
912
912
|
}
|
|
913
913
|
function Ar(t, e, r, n) {
|
|
914
914
|
if (e)
|
|
@@ -918,14 +918,14 @@ function Ar(t, e, r, n) {
|
|
|
918
918
|
o[s].apply(r, n);
|
|
919
919
|
}
|
|
920
920
|
p.prototype.emit = function(e) {
|
|
921
|
-
var r, n, i, o, s, f,
|
|
921
|
+
var r, n, i, o, s, f, u, l = e === "error";
|
|
922
922
|
if (f = this._events, f)
|
|
923
|
-
|
|
924
|
-
else if (!
|
|
923
|
+
l = l && f.error == null;
|
|
924
|
+
else if (!l)
|
|
925
925
|
return !1;
|
|
926
|
-
if (
|
|
927
|
-
if (r = arguments[1],
|
|
928
|
-
r || (r = new Error('Uncaught, unspecified "error" event')), r.domainEmitter = this, r.domain =
|
|
926
|
+
if (u = this.domain, l) {
|
|
927
|
+
if (r = arguments[1], u)
|
|
928
|
+
r || (r = new Error('Uncaught, unspecified "error" event')), r.domainEmitter = this, r.domain = u, r.domainThrown = !1, u.emit("error", r);
|
|
929
929
|
else {
|
|
930
930
|
if (r instanceof Error)
|
|
931
931
|
throw r;
|
|
@@ -1200,7 +1200,7 @@ function Ur(t) {
|
|
|
1200
1200
|
return f;
|
|
1201
1201
|
}
|
|
1202
1202
|
}), s = n[r]; r < i; s = n[++r])
|
|
1203
|
-
ze(s) || !
|
|
1203
|
+
ze(s) || !ue(s) ? o += " " + s : o += " " + G(s);
|
|
1204
1204
|
return o;
|
|
1205
1205
|
}
|
|
1206
1206
|
function Dt(t, e) {
|
|
@@ -1306,20 +1306,20 @@ function ye(t, e, r) {
|
|
|
1306
1306
|
if (Le(e))
|
|
1307
1307
|
return Ae(e);
|
|
1308
1308
|
}
|
|
1309
|
-
var
|
|
1310
|
-
if (Jr(e) && (
|
|
1309
|
+
var u = "", l = !1, h = ["{", "}"];
|
|
1310
|
+
if (Jr(e) && (l = !0, h = ["[", "]"]), Ne(e)) {
|
|
1311
1311
|
var c = e.name ? ": " + e.name : "";
|
|
1312
|
-
|
|
1312
|
+
u = " [Function" + c + "]";
|
|
1313
1313
|
}
|
|
1314
|
-
if (Te(e) && (
|
|
1315
|
-
return h[0] +
|
|
1314
|
+
if (Te(e) && (u = " " + RegExp.prototype.toString.call(e)), Xe(e) && (u = " " + Date.prototype.toUTCString.call(e)), Le(e) && (u = " " + Ae(e)), o.length === 0 && (!l || e.length == 0))
|
|
1315
|
+
return h[0] + u + h[1];
|
|
1316
1316
|
if (r < 0)
|
|
1317
1317
|
return Te(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
1319
|
var g;
|
|
1320
|
-
return
|
|
1321
|
-
return ke(t, e, r, s, y,
|
|
1322
|
-
}), t.seen.pop(), Vr(g,
|
|
1320
|
+
return l ? g = zr(t, e, r, s, o) : g = o.map(function(y) {
|
|
1321
|
+
return ke(t, e, r, s, y, l);
|
|
1322
|
+
}), t.seen.pop(), Vr(g, u, h);
|
|
1323
1323
|
}
|
|
1324
1324
|
function qr(t, e) {
|
|
1325
1325
|
if (H(e))
|
|
@@ -1348,28 +1348,28 @@ function zr(t, e, r, n, i) {
|
|
|
1348
1348
|
String(s),
|
|
1349
1349
|
!0
|
|
1350
1350
|
)) : o.push("");
|
|
1351
|
-
return i.forEach(function(
|
|
1352
|
-
|
|
1351
|
+
return i.forEach(function(u) {
|
|
1352
|
+
u.match(/^\d+$/) || o.push(ke(
|
|
1353
1353
|
t,
|
|
1354
1354
|
e,
|
|
1355
1355
|
r,
|
|
1356
1356
|
n,
|
|
1357
|
-
|
|
1357
|
+
u,
|
|
1358
1358
|
!0
|
|
1359
1359
|
));
|
|
1360
1360
|
}), o;
|
|
1361
1361
|
}
|
|
1362
1362
|
function ke(t, e, r, n, i, o) {
|
|
1363
|
-
var s, f,
|
|
1364
|
-
if (
|
|
1363
|
+
var s, f, u;
|
|
1364
|
+
if (u = Object.getOwnPropertyDescriptor(e, i) || { value: e[i] }, u.get ? u.set ? f = t.stylize("[Getter/Setter]", "special") : f = t.stylize("[Getter]", "special") : u.set && (f = t.stylize("[Setter]", "special")), Mt(n, i) || (s = "[" + i + "]"), f || (t.seen.indexOf(u.value) < 0 ? (ze(r) ? f = ye(t, u.value, null) : f = ye(t, u.value, r - 1), f.indexOf(`
|
|
1365
1365
|
`) > -1 && (o ? f = f.split(`
|
|
1366
|
-
`).map(function(
|
|
1367
|
-
return " " +
|
|
1366
|
+
`).map(function(l) {
|
|
1367
|
+
return " " + l;
|
|
1368
1368
|
}).join(`
|
|
1369
1369
|
`).substr(2) : f = `
|
|
1370
1370
|
` + f.split(`
|
|
1371
|
-
`).map(function(
|
|
1372
|
-
return " " +
|
|
1371
|
+
`).map(function(l) {
|
|
1372
|
+
return " " + l;
|
|
1373
1373
|
}).join(`
|
|
1374
1374
|
`))) : f = t.stylize("[Circular]", "special")), H(s)) {
|
|
1375
1375
|
if (o && i.match(/^\d+$/))
|
|
@@ -1406,16 +1406,16 @@ function H(t) {
|
|
|
1406
1406
|
return t === void 0;
|
|
1407
1407
|
}
|
|
1408
1408
|
function Te(t) {
|
|
1409
|
-
return
|
|
1409
|
+
return ue(t) && Je(t) === "[object RegExp]";
|
|
1410
1410
|
}
|
|
1411
|
-
function
|
|
1411
|
+
function ue(t) {
|
|
1412
1412
|
return typeof t == "object" && t !== null;
|
|
1413
1413
|
}
|
|
1414
1414
|
function Xe(t) {
|
|
1415
|
-
return
|
|
1415
|
+
return ue(t) && Je(t) === "[object Date]";
|
|
1416
1416
|
}
|
|
1417
1417
|
function Le(t) {
|
|
1418
|
-
return
|
|
1418
|
+
return ue(t) && (Je(t) === "[object Error]" || t instanceof Error);
|
|
1419
1419
|
}
|
|
1420
1420
|
function Ne(t) {
|
|
1421
1421
|
return typeof t == "function";
|
|
@@ -1424,7 +1424,7 @@ function Je(t) {
|
|
|
1424
1424
|
return Object.prototype.toString.call(t);
|
|
1425
1425
|
}
|
|
1426
1426
|
function Wr(t, e) {
|
|
1427
|
-
if (!e || !
|
|
1427
|
+
if (!e || !ue(e)) return t;
|
|
1428
1428
|
for (var r = Object.keys(e), n = r.length; n--; )
|
|
1429
1429
|
t[r[n]] = e[r[n]];
|
|
1430
1430
|
return t;
|
|
@@ -1487,7 +1487,7 @@ function Qr(t) {
|
|
|
1487
1487
|
if (t && !Hr(t))
|
|
1488
1488
|
throw new Error("Unknown encoding: " + t);
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function le(t) {
|
|
1491
1491
|
switch (this.encoding = (t || "utf8").toLowerCase().replace(/[-_]/, ""), Qr(t), this.encoding) {
|
|
1492
1492
|
case "utf8":
|
|
1493
1493
|
this.surrogateSize = 3;
|
|
@@ -1505,7 +1505,7 @@ function ue(t) {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
this.charBuffer = new a(6), this.charReceived = 0, this.charLength = 0;
|
|
1507
1507
|
}
|
|
1508
|
-
|
|
1508
|
+
le.prototype.write = function(t) {
|
|
1509
1509
|
for (var e = ""; this.charLength; ) {
|
|
1510
1510
|
var r = t.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : t.length;
|
|
1511
1511
|
if (t.copy(this.charBuffer, this.charReceived, 0, r), this.charReceived += r, this.charReceived < this.charLength)
|
|
@@ -1530,7 +1530,7 @@ ue.prototype.write = function(t) {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
return e;
|
|
1532
1532
|
};
|
|
1533
|
-
|
|
1533
|
+
le.prototype.detectIncompleteChar = function(t) {
|
|
1534
1534
|
for (var e = t.length >= 3 ? 3 : t.length; e > 0; e--) {
|
|
1535
1535
|
var r = t[t.length - e];
|
|
1536
1536
|
if (e == 1 && r >> 5 == 6) {
|
|
@@ -1548,7 +1548,7 @@ ue.prototype.detectIncompleteChar = function(t) {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
this.charReceived = e;
|
|
1550
1550
|
};
|
|
1551
|
-
|
|
1551
|
+
le.prototype.end = function(t) {
|
|
1552
1552
|
var e = "";
|
|
1553
1553
|
if (t && t.length && (e = this.write(t)), this.charReceived) {
|
|
1554
1554
|
var r = this.charReceived, n = this.charBuffer, i = this.encoding;
|
|
@@ -1579,7 +1579,7 @@ function en(t, e) {
|
|
|
1579
1579
|
function Bt(t, e) {
|
|
1580
1580
|
t = t || {}, this.objectMode = !!t.objectMode, e instanceof M && (this.objectMode = this.objectMode || !!t.readableObjectMode);
|
|
1581
1581
|
var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
|
|
1582
|
-
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new
|
|
1582
|
+
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new le(t.encoding), this.encoding = t.encoding);
|
|
1583
1583
|
}
|
|
1584
1584
|
function R(t) {
|
|
1585
1585
|
if (!(this instanceof R)) return new R(t);
|
|
@@ -1610,8 +1610,8 @@ function Ut(t, e, r, n, i) {
|
|
|
1610
1610
|
var f = new Error("stream.unshift() after end event");
|
|
1611
1611
|
t.emit("error", f);
|
|
1612
1612
|
} else {
|
|
1613
|
-
var
|
|
1614
|
-
e.decoder && !i && !n && (r = e.decoder.write(r),
|
|
1613
|
+
var u;
|
|
1614
|
+
e.decoder && !i && !n && (r = e.decoder.write(r), u = !e.objectMode && r.length === 0), i || (e.reading = !1), u || (e.flowing && e.length === 0 && !e.sync ? (t.emit("data", r), t.read(0)) : (e.length += e.objectMode ? 1 : r.length, i ? e.buffer.unshift(r) : e.buffer.push(r), e.needReadable && Se(t))), sn(t, e);
|
|
1615
1615
|
}
|
|
1616
1616
|
else i || (e.reading = !1);
|
|
1617
1617
|
return tn(e);
|
|
@@ -1620,7 +1620,7 @@ function tn(t) {
|
|
|
1620
1620
|
return !t.ended && (t.needReadable || t.length < t.highWaterMark || t.length === 0);
|
|
1621
1621
|
}
|
|
1622
1622
|
R.prototype.setEncoding = function(t) {
|
|
1623
|
-
return this._readableState.decoder = new
|
|
1623
|
+
return this._readableState.decoder = new le(t), this._readableState.encoding = t, this;
|
|
1624
1624
|
};
|
|
1625
1625
|
var Ke = 8388608;
|
|
1626
1626
|
function rn(t) {
|
|
@@ -1694,18 +1694,18 @@ R.prototype.pipe = function(t, e) {
|
|
|
1694
1694
|
function f() {
|
|
1695
1695
|
b("onend"), t.end();
|
|
1696
1696
|
}
|
|
1697
|
-
var
|
|
1698
|
-
t.on("drain",
|
|
1699
|
-
var
|
|
1697
|
+
var u = an(r);
|
|
1698
|
+
t.on("drain", u);
|
|
1699
|
+
var l = !1;
|
|
1700
1700
|
function h() {
|
|
1701
|
-
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain",
|
|
1701
|
+
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain", u), t.removeListener("error", y), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", g), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && u();
|
|
1702
1702
|
}
|
|
1703
1703
|
var c = !1;
|
|
1704
1704
|
r.on("data", g);
|
|
1705
1705
|
function g(S) {
|
|
1706
1706
|
b("ondata"), c = !1;
|
|
1707
1707
|
var m = t.write(S);
|
|
1708
|
-
m === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && Pt(n.pipes, t) !== -1) && !
|
|
1708
|
+
m === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && Pt(n.pipes, t) !== -1) && !l && (b("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
1710
|
function y(S) {
|
|
1711
1711
|
b("onerror", S), x(), t.removeListener("error", y), en(t, "error") === 0 && t.emit("error", S);
|
|
@@ -1751,19 +1751,19 @@ R.prototype.on = function(t, e) {
|
|
|
1751
1751
|
this._readableState.flowing !== !1 && this.resume();
|
|
1752
1752
|
else if (t === "readable") {
|
|
1753
1753
|
var n = this._readableState;
|
|
1754
|
-
!n.endEmitted && !n.readableListening && (n.readableListening = n.needReadable = !0, n.emittedReadable = !1, n.reading ? n.length && Se(this) : B(
|
|
1754
|
+
!n.endEmitted && !n.readableListening && (n.readableListening = n.needReadable = !0, n.emittedReadable = !1, n.reading ? n.length && Se(this) : B(un, this));
|
|
1755
1755
|
}
|
|
1756
1756
|
return r;
|
|
1757
1757
|
};
|
|
1758
1758
|
R.prototype.addListener = R.prototype.on;
|
|
1759
|
-
function
|
|
1759
|
+
function un(t) {
|
|
1760
1760
|
b("readable nexttick read 0"), t.read(0);
|
|
1761
1761
|
}
|
|
1762
1762
|
R.prototype.resume = function() {
|
|
1763
1763
|
var t = this._readableState;
|
|
1764
|
-
return t.flowing || (b("resume"), t.flowing = !0,
|
|
1764
|
+
return t.flowing || (b("resume"), t.flowing = !0, ln(this, t)), this;
|
|
1765
1765
|
};
|
|
1766
|
-
function
|
|
1766
|
+
function ln(t, e) {
|
|
1767
1767
|
e.resumeScheduled || (e.resumeScheduled = !0, B(hn, t, e));
|
|
1768
1768
|
}
|
|
1769
1769
|
function hn(t, e) {
|
|
@@ -1960,8 +1960,8 @@ function $t(t, e) {
|
|
|
1960
1960
|
Pe(t, e, !0, e.length, i, "", o.finish), e.pendingcb++, e.lastBufferedRequest = null, o.next ? (e.corkedRequestsFree = o.next, o.next = null) : e.corkedRequestsFree = new zt(e);
|
|
1961
1961
|
} else {
|
|
1962
1962
|
for (; r; ) {
|
|
1963
|
-
var f = r.chunk,
|
|
1964
|
-
if (Pe(t, e, !1, h, f,
|
|
1963
|
+
var f = r.chunk, u = r.encoding, l = r.callback, h = e.objectMode ? 1 : f.length;
|
|
1964
|
+
if (Pe(t, e, !1, h, f, u, l), r = r.next, e.writing)
|
|
1965
1965
|
break;
|
|
1966
1966
|
}
|
|
1967
1967
|
r === null && (e.lastBufferedRequest = null);
|
|
@@ -2100,15 +2100,15 @@ V.prototype.pipe = function(t, e) {
|
|
|
2100
2100
|
function f() {
|
|
2101
2101
|
o || (o = !0, typeof t.destroy == "function" && t.destroy());
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2104
|
-
if (
|
|
2103
|
+
function u(h) {
|
|
2104
|
+
if (l(), p.listenerCount(this, "error") === 0)
|
|
2105
2105
|
throw h;
|
|
2106
2106
|
}
|
|
2107
|
-
r.on("error",
|
|
2108
|
-
function
|
|
2109
|
-
r.removeListener("data", n), t.removeListener("drain", i), r.removeListener("end", s), r.removeListener("close", f), r.removeListener("error",
|
|
2107
|
+
r.on("error", u), t.on("error", u);
|
|
2108
|
+
function l() {
|
|
2109
|
+
r.removeListener("data", n), t.removeListener("drain", i), r.removeListener("end", s), r.removeListener("close", f), r.removeListener("error", u), t.removeListener("error", u), r.removeListener("end", l), r.removeListener("close", l), t.removeListener("close", l);
|
|
2110
2110
|
}
|
|
2111
|
-
return r.on("end",
|
|
2111
|
+
return r.on("end", l), r.on("close", l), t.on("close", l), t.emit("pipe", r), t;
|
|
2112
2112
|
};
|
|
2113
2113
|
const Vt = function(t) {
|
|
2114
2114
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
@@ -2665,7 +2665,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2665
2665
|
state: Un(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote:
|
|
2668
|
+
const { encoding: s, escape: f, quote: u } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, g = i - n - 1, y = Math.max(
|
|
2669
2669
|
h,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
@@ -2676,9 +2676,9 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2676
2676
|
c === 0 ? a.from(`\r
|
|
2677
2677
|
`, s).length : c,
|
|
2678
2678
|
// Skip if remaining buffer can be an escaped quote
|
|
2679
|
-
|
|
2679
|
+
l ? (f === null ? 0 : f.length) + u.length : 0,
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
|
-
|
|
2681
|
+
l ? u.length + c : 0
|
|
2682
2682
|
);
|
|
2683
2683
|
return g < y;
|
|
2684
2684
|
},
|
|
@@ -2686,8 +2686,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
2687
2687
|
const {
|
|
2688
2688
|
bom: f,
|
|
2689
|
-
comment_no_infix:
|
|
2690
|
-
encoding:
|
|
2689
|
+
comment_no_infix: u,
|
|
2690
|
+
encoding: l,
|
|
2691
2691
|
from_line: h,
|
|
2692
2692
|
ltrim: c,
|
|
2693
2693
|
max_record_size: g,
|
|
@@ -2796,7 +2796,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2796
2796
|
"INVALID_OPENING_QUOTE",
|
|
2797
2797
|
[
|
|
2798
2798
|
"Invalid Opening Quote:",
|
|
2799
|
-
`a quote is found on field ${JSON.stringify(C.column)} at line ${C.lines}, value is ${JSON.stringify(this.state.field.toString(
|
|
2799
|
+
`a quote is found on field ${JSON.stringify(C.column)} at line ${C.lines}, value is ${JSON.stringify(this.state.field.toString(l))}`,
|
|
2800
2800
|
Z ? `(${Z} bom)` : void 0
|
|
2801
2801
|
],
|
|
2802
2802
|
this.options,
|
|
@@ -2846,7 +2846,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (_ !== null && (
|
|
2849
|
+
if (_ !== null && (u === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, v, d, I) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
@@ -2926,8 +2926,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2926
2926
|
group_columns_by_name: o,
|
|
2927
2927
|
encoding: s,
|
|
2928
2928
|
info: f,
|
|
2929
|
-
from:
|
|
2930
|
-
relax_column_count:
|
|
2929
|
+
from: u,
|
|
2930
|
+
relax_column_count: l,
|
|
2931
2931
|
relax_column_count_less: h,
|
|
2932
2932
|
relax_column_count_more: c,
|
|
2933
2933
|
raw: g,
|
|
@@ -2970,7 +2970,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2970
2970
|
record: E
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (
|
|
2973
|
+
if (l === !0 || h === !0 && x < this.state.expectedRecordLength || c === !0 && x > this.state.expectedRecordLength)
|
|
2974
2974
|
this.info.invalid_field_length++, this.state.error = S;
|
|
2975
2975
|
else {
|
|
2976
2976
|
const m = this.__error(S);
|
|
@@ -2985,7 +2985,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2985
2985
|
this.__resetRecord(), this.state.recordHasError = !1;
|
|
2986
2986
|
return;
|
|
2987
2987
|
}
|
|
2988
|
-
if (this.info.records++,
|
|
2988
|
+
if (this.info.records++, u === 1 || this.info.records >= u) {
|
|
2989
2989
|
const { objname: S } = this.options;
|
|
2990
2990
|
if (i !== !1) {
|
|
2991
2991
|
const m = {};
|
|
@@ -3063,16 +3063,16 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3063
3063
|
this.options.raw === !0 && this.state.rawBuffer.reset(), this.state.error = void 0, this.state.record = [], this.state.record_length = 0;
|
|
3064
3064
|
},
|
|
3065
3065
|
__onField: function() {
|
|
3066
|
-
const { cast: n, encoding: i, rtrim: o, max_record_size: s } = this.options, { enabled: f, wasQuoting:
|
|
3066
|
+
const { cast: n, encoding: i, rtrim: o, max_record_size: s } = this.options, { enabled: f, wasQuoting: u } = this.state;
|
|
3067
3067
|
if (f === !1)
|
|
3068
3068
|
return this.__resetField();
|
|
3069
|
-
let
|
|
3070
|
-
if (o === !0 &&
|
|
3071
|
-
const [h, c] = this.__cast(
|
|
3069
|
+
let l = this.state.field.toString(i);
|
|
3070
|
+
if (o === !0 && u === !1 && (l = l.trimRight()), n === !0) {
|
|
3071
|
+
const [h, c] = this.__cast(l);
|
|
3072
3072
|
if (h !== void 0) return h;
|
|
3073
|
-
|
|
3073
|
+
l = c;
|
|
3074
3074
|
}
|
|
3075
|
-
this.state.record.push(
|
|
3075
|
+
this.state.record.push(l), s !== 0 && typeof l == "string" && (this.state.record_length += l.length), this.__resetField();
|
|
3076
3076
|
},
|
|
3077
3077
|
__resetField: function() {
|
|
3078
3078
|
this.state.field.reset(), this.state.wasQuoting = !1;
|
|
@@ -3114,9 +3114,9 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3114
3114
|
// Helper to test if a character is a space or a line delimiter
|
|
3115
3115
|
__isCharTrimable: function(n, i) {
|
|
3116
3116
|
return ((s, f) => {
|
|
3117
|
-
const { timchars:
|
|
3118
|
-
e: for (let
|
|
3119
|
-
const h = l
|
|
3117
|
+
const { timchars: u } = this.state;
|
|
3118
|
+
e: for (let l = 0; l < u.length; l++) {
|
|
3119
|
+
const h = u[l];
|
|
3120
3120
|
for (let c = 0; c < h.length; c++)
|
|
3121
3121
|
if (h[c] !== s[f + c]) continue e;
|
|
3122
3122
|
return h.length;
|
|
@@ -3136,8 +3136,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3136
3136
|
__compareBytes: function(n, i, o, s) {
|
|
3137
3137
|
if (n[0] !== s) return 0;
|
|
3138
3138
|
const f = n.length;
|
|
3139
|
-
for (let
|
|
3140
|
-
if (n[
|
|
3139
|
+
for (let u = 1; u < f; u++)
|
|
3140
|
+
if (n[u] !== i[o + u]) return 0;
|
|
3141
3141
|
return f;
|
|
3142
3142
|
},
|
|
3143
3143
|
__isDelimiter: function(n, i, o) {
|
|
@@ -3146,25 +3146,25 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3146
3146
|
return 0;
|
|
3147
3147
|
if (f !== !1 && typeof f == "number" && this.state.record.length === f - 1)
|
|
3148
3148
|
return 0;
|
|
3149
|
-
e: for (let
|
|
3150
|
-
const
|
|
3151
|
-
if (
|
|
3152
|
-
for (let h = 1; h <
|
|
3153
|
-
if (
|
|
3154
|
-
return
|
|
3149
|
+
e: for (let u = 0; u < s.length; u++) {
|
|
3150
|
+
const l = s[u];
|
|
3151
|
+
if (l[0] === o) {
|
|
3152
|
+
for (let h = 1; h < l.length; h++)
|
|
3153
|
+
if (l[h] !== n[i + h]) continue e;
|
|
3154
|
+
return l.length;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
3157
3157
|
return 0;
|
|
3158
3158
|
},
|
|
3159
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3160
3160
|
const { record_delimiter: s } = this.options, f = s.length;
|
|
3161
|
-
e: for (let
|
|
3162
|
-
const
|
|
3163
|
-
if (
|
|
3161
|
+
e: for (let u = 0; u < f; u++) {
|
|
3162
|
+
const l = s[u], h = l.length;
|
|
3163
|
+
if (l[0] === n) {
|
|
3164
3164
|
for (let c = 1; c < h; c++)
|
|
3165
|
-
if (
|
|
3165
|
+
if (l[c] !== i[o + c])
|
|
3166
3166
|
continue e;
|
|
3167
|
-
return
|
|
3167
|
+
return l.length;
|
|
3168
3168
|
}
|
|
3169
3169
|
}
|
|
3170
3170
|
return 0;
|
|
@@ -3174,8 +3174,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3174
3174
|
if (s === null) return !1;
|
|
3175
3175
|
const f = s.length;
|
|
3176
3176
|
if (s[0] === o) {
|
|
3177
|
-
for (let
|
|
3178
|
-
if (s[
|
|
3177
|
+
for (let u = 0; u < f; u++)
|
|
3178
|
+
if (s[u] !== n[i + u])
|
|
3179
3179
|
return !1;
|
|
3180
3180
|
return !0;
|
|
3181
3181
|
}
|
|
@@ -3200,9 +3200,9 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3200
3200
|
a.from("\r", o)
|
|
3201
3201
|
];
|
|
3202
3202
|
e: for (let f = 0; f < s.length; f++) {
|
|
3203
|
-
const
|
|
3204
|
-
for (let
|
|
3205
|
-
if (s[f][
|
|
3203
|
+
const u = s[f].length;
|
|
3204
|
+
for (let l = 0; l < u; l++)
|
|
3205
|
+
if (s[f][l] !== n[i + l])
|
|
3206
3206
|
continue e;
|
|
3207
3207
|
return this.options.record_delimiter.push(s[f]), this.state.recordDelimiterMaxLength = s[f].length, s[f].length;
|
|
3208
3208
|
}
|
|
@@ -3217,8 +3217,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3217
3217
|
f,
|
|
3218
3218
|
o ? this.state.rawBuffer.toString(i) : void 0
|
|
3219
3219
|
);
|
|
3220
|
-
} catch (
|
|
3221
|
-
return
|
|
3220
|
+
} catch (u) {
|
|
3221
|
+
return u;
|
|
3222
3222
|
}
|
|
3223
3223
|
return;
|
|
3224
3224
|
} else
|
|
@@ -3292,7 +3292,7 @@ class qn extends k {
|
|
|
3292
3292
|
e(r);
|
|
3293
3293
|
}
|
|
3294
3294
|
}
|
|
3295
|
-
const
|
|
3295
|
+
const ut = function() {
|
|
3296
3296
|
let t, e, r;
|
|
3297
3297
|
for (const i in arguments) {
|
|
3298
3298
|
const o = arguments[i], s = typeof o;
|
|
@@ -3377,53 +3377,61 @@ const Qn = 40096;
|
|
|
3377
3377
|
class Gn {
|
|
3378
3378
|
/** Build parser. */
|
|
3379
3379
|
buildParser(e) {
|
|
3380
|
-
return
|
|
3380
|
+
return ut(e);
|
|
3381
3381
|
}
|
|
3382
3382
|
/** Parse stream. */
|
|
3383
3383
|
async parseStream(e, r, n, i) {
|
|
3384
3384
|
return new Promise((o, s) => {
|
|
3385
|
-
let f,
|
|
3385
|
+
let f, u, l, h = !1, c = 0, g = !1;
|
|
3386
3386
|
const y = () => {
|
|
3387
3387
|
if (g) return;
|
|
3388
3388
|
g = !0;
|
|
3389
3389
|
const x = f;
|
|
3390
|
-
f = void 0,
|
|
3391
|
-
|
|
3392
|
-
}),
|
|
3390
|
+
f = void 0, l = void 0, x != null && (this.ignoreErrors(() => x.removeAllListeners()), this.ignoreErrors(() => x.end())), this.ignoreErrors(() => {
|
|
3391
|
+
u?.cancel();
|
|
3392
|
+
}), u = void 0;
|
|
3393
3393
|
}, O = (x) => {
|
|
3394
|
-
h || (
|
|
3394
|
+
h || (h = !0, y(), i.signal.aborted || i.abort(x), s(x));
|
|
3395
3395
|
};
|
|
3396
3396
|
i.signal.addEventListener("abort", y, { once: !0 }), (async () => {
|
|
3397
|
-
f =
|
|
3397
|
+
f = ut(e), l = this.constructRowBuffer({ chunk: () => {
|
|
3398
3398
|
}, chunkSize: r.chunkSize ?? Qn }), f.on("readable", () => {
|
|
3399
3399
|
try {
|
|
3400
3400
|
const m = c;
|
|
3401
|
-
if (f == null ||
|
|
3401
|
+
if (f == null || l == null) return;
|
|
3402
3402
|
let _;
|
|
3403
3403
|
for (; (_ = f.read()) != null; ) {
|
|
3404
3404
|
if (c++, h) return;
|
|
3405
|
-
i.signal.throwIfAborted(),
|
|
3405
|
+
i.signal.throwIfAborted(), l.push(_);
|
|
3406
3406
|
}
|
|
3407
3407
|
console.log(3333, c - m);
|
|
3408
3408
|
} catch (m) {
|
|
3409
3409
|
O(m);
|
|
3410
3410
|
}
|
|
3411
3411
|
}), f.on("error", (m) => O(m)), f.on("end", () => {
|
|
3412
|
-
h || (
|
|
3412
|
+
h || (l?.flush(), o(this.constructSummary(f)));
|
|
3413
3413
|
});
|
|
3414
3414
|
const x = await fetch(encodeURI(n), { signal: i.signal });
|
|
3415
3415
|
if (!x.ok || x.body == null)
|
|
3416
3416
|
throw await Yn(x, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
|
|
3417
|
-
|
|
3418
|
-
let S = await
|
|
3417
|
+
u = x.body.pipeThrough(new TextDecoderStream(r.encodingId)).getReader();
|
|
3418
|
+
let S = await u.read();
|
|
3419
3419
|
for (; !S.done; ) {
|
|
3420
|
-
if (
|
|
3421
|
-
console.log(1111
|
|
3420
|
+
if (h) return;
|
|
3421
|
+
i.signal.throwIfAborted(), console.log(1111, S.value.length), await this.writeToParser(f, S.value), S = await u.read();
|
|
3422
3422
|
}
|
|
3423
3423
|
f.end();
|
|
3424
3424
|
})().catch((x) => O(x));
|
|
3425
3425
|
});
|
|
3426
3426
|
}
|
|
3427
|
+
/** Write to parser. */
|
|
3428
|
+
writeToParser(e, r) {
|
|
3429
|
+
return new Promise((n, i) => {
|
|
3430
|
+
e.write(r, (o) => {
|
|
3431
|
+
o ? i(o) : n();
|
|
3432
|
+
});
|
|
3433
|
+
});
|
|
3434
|
+
}
|
|
3427
3435
|
/** Parse string. */
|
|
3428
3436
|
parseString() {
|
|
3429
3437
|
}
|
|
@@ -3448,14 +3456,6 @@ class Gn {
|
|
|
3448
3456
|
recordCount: e?.info.records ?? -1
|
|
3449
3457
|
};
|
|
3450
3458
|
}
|
|
3451
|
-
/** Write to parser. */
|
|
3452
|
-
writeToParser(e, r) {
|
|
3453
|
-
return new Promise((n, i) => {
|
|
3454
|
-
e.write(r, (o) => {
|
|
3455
|
-
o ? i(o) : n();
|
|
3456
|
-
});
|
|
3457
|
-
});
|
|
3458
|
-
}
|
|
3459
3459
|
/** Ignore best-effort cleanup errors to keep teardown noise-free. */
|
|
3460
3460
|
ignoreErrors(e) {
|
|
3461
3461
|
try {
|
|
@@ -6,14 +6,14 @@ declare class Tool {
|
|
|
6
6
|
buildParser(options: ParseOptions): Parser;
|
|
7
7
|
/** Parse stream. */
|
|
8
8
|
parseStream(parseOptions: ParseOptions, retrieveRecordsOptions: RetrieveRecordsOptions, url: string, abortController: AbortController): Promise<RetrieveRecordsSummary>;
|
|
9
|
+
/** Write to parser. */
|
|
10
|
+
private writeToParser;
|
|
9
11
|
/** Parse string. */
|
|
10
12
|
parseString(): void;
|
|
11
13
|
/** Construct row buffer. */
|
|
12
14
|
private constructRowBuffer;
|
|
13
15
|
/** Construct summary. */
|
|
14
16
|
private constructSummary;
|
|
15
|
-
/** Write to parser. */
|
|
16
|
-
private writeToParser;
|
|
17
17
|
/** Ignore best-effort cleanup errors to keep teardown noise-free. */
|
|
18
18
|
private ignoreErrors;
|
|
19
19
|
}
|