@datapos/datapos-tool-csv-parse 0.0.77 → 0.0.78
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 +159 -149
- package/dist/types/src/index.d.ts +6 -8
- package/package.json +1 -1
|
@@ -31,27 +31,27 @@ function Ze(t) {
|
|
|
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, a = (1 << f) - 1, l = a >> 1,
|
|
35
|
-
for (
|
|
34
|
+
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1, c = -7, h = r ? i - 1 : 0, p = r ? -1 : 1, m = t[e + h];
|
|
35
|
+
for (h += p, o = m & (1 << -c) - 1, m >>= -c, c += f; c > 0; o = o * 256 + t[e + h], h += p, c -= 8)
|
|
36
36
|
;
|
|
37
|
-
for (s = o & (1 << -
|
|
37
|
+
for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = s * 256 + t[e + h], h += p, c -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
40
|
o = 1 - l;
|
|
41
41
|
else {
|
|
42
42
|
if (o === a)
|
|
43
|
-
return s ? NaN : (
|
|
43
|
+
return s ? NaN : (m ? -1 : 1) * (1 / 0);
|
|
44
44
|
s = s + Math.pow(2, n), o = o - l;
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
46
|
+
return (m ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f, a, l = o * 8 - i - 1,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s =
|
|
49
|
+
var s, f, a, l = o * 8 - i - 1, c = (1 << l) - 1, h = c >> 1, p = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, m = n ? 0 : o - 1, x = n ? 1 : -1, y = 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 = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + h >= 1 ? e += p / a : e += p * Math.pow(2, 1 - h), e * a >= 2 && (s++, a /= 2), s + h >= c ? (f = 0, s = c) : s + h >= 1 ? (f = (e * a - 1) * Math.pow(2, i), s = s + h) : (f = e * Math.pow(2, h - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + m] = f & 255, m += x, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f, l += i; l > 0; t[r +
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + m] = s & 255, m += x, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r +
|
|
54
|
+
t[r + m - x] |= y * 128;
|
|
55
55
|
}
|
|
56
56
|
var er = {}.toString, dt = Array.isArray || function(t) {
|
|
57
57
|
return er.call(t) == "[object Array]";
|
|
@@ -320,9 +320,9 @@ u.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, a = Math.min(s, f), l = this.slice(i, o),
|
|
324
|
-
if (l[
|
|
325
|
-
s = l[
|
|
323
|
+
for (var s = o - i, f = n - r, a = Math.min(s, f), l = this.slice(i, o), c = e.slice(r, n), h = 0; h < a; ++h)
|
|
324
|
+
if (l[h] !== c[h]) {
|
|
325
|
+
s = l[h], f = c[h];
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
return s < f ? -1 : f < s ? 1 : 0;
|
|
@@ -348,25 +348,25 @@ function Xe(t, e, r, n, i) {
|
|
|
348
348
|
return -1;
|
|
349
349
|
o = 2, s /= 2, f /= 2, r /= 2;
|
|
350
350
|
}
|
|
351
|
-
function a(
|
|
352
|
-
return o === 1 ?
|
|
351
|
+
function a(m, x) {
|
|
352
|
+
return o === 1 ? m[x] : m.readUInt16BE(x * o);
|
|
353
353
|
}
|
|
354
354
|
var l;
|
|
355
355
|
if (i) {
|
|
356
|
-
var
|
|
356
|
+
var c = -1;
|
|
357
357
|
for (l = r; l < s; l++)
|
|
358
|
-
if (a(t, l) === a(e,
|
|
359
|
-
if (
|
|
358
|
+
if (a(t, l) === a(e, c === -1 ? 0 : l - c)) {
|
|
359
|
+
if (c === -1 && (c = l), l - c + 1 === f) return c * o;
|
|
360
360
|
} else
|
|
361
|
-
|
|
361
|
+
c !== -1 && (l -= l - c), c = -1;
|
|
362
362
|
} else
|
|
363
363
|
for (r + f > s && (r = s - f), l = r; l >= 0; l--) {
|
|
364
|
-
for (var
|
|
364
|
+
for (var h = !0, p = 0; p < f; p++)
|
|
365
365
|
if (a(t, l + p) !== a(e, p)) {
|
|
366
|
-
|
|
366
|
+
h = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
|
-
if (
|
|
369
|
+
if (h) return l;
|
|
370
370
|
}
|
|
371
371
|
return -1;
|
|
372
372
|
}
|
|
@@ -461,19 +461,19 @@ function yt(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 a, l,
|
|
464
|
+
var a, l, c, h;
|
|
465
465
|
switch (f) {
|
|
466
466
|
case 1:
|
|
467
467
|
o < 128 && (s = o);
|
|
468
468
|
break;
|
|
469
469
|
case 2:
|
|
470
|
-
a = t[i + 1], (a & 192) === 128 && (
|
|
470
|
+
a = t[i + 1], (a & 192) === 128 && (h = (o & 31) << 6 | a & 63, h > 127 && (s = h));
|
|
471
471
|
break;
|
|
472
472
|
case 3:
|
|
473
|
-
a = t[i + 1], l = t[i + 2], (a & 192) === 128 && (l & 192) === 128 && (
|
|
473
|
+
a = t[i + 1], l = t[i + 2], (a & 192) === 128 && (l & 192) === 128 && (h = (o & 15) << 12 | (a & 63) << 6 | l & 63, h > 2047 && (h < 55296 || h > 57343) && (s = h));
|
|
474
474
|
break;
|
|
475
475
|
case 4:
|
|
476
|
-
a = t[i + 1], l = t[i + 2],
|
|
476
|
+
a = t[i + 1], l = t[i + 2], c = t[i + 3], (a & 192) === 128 && (l & 192) === 128 && (c & 192) === 128 && (h = (o & 15) << 18 | (a & 63) << 12 | (l & 63) << 6 | c & 63, h > 65535 && h < 1114112 && (s = h));
|
|
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;
|
|
@@ -859,27 +859,27 @@ var Ce;
|
|
|
859
859
|
function H() {
|
|
860
860
|
}
|
|
861
861
|
H.prototype = /* @__PURE__ */ Object.create(null);
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
this.domain = null,
|
|
873
|
-
};
|
|
874
|
-
|
|
862
|
+
function g() {
|
|
863
|
+
g.init.call(this);
|
|
864
|
+
}
|
|
865
|
+
g.EventEmitter = g;
|
|
866
|
+
g.usingDomains = !1;
|
|
867
|
+
g.prototype.domain = void 0;
|
|
868
|
+
g.prototype._events = void 0;
|
|
869
|
+
g.prototype._maxListeners = void 0;
|
|
870
|
+
g.defaultMaxListeners = 10;
|
|
871
|
+
g.init = function() {
|
|
872
|
+
this.domain = null, g.usingDomains && Ce.active && !(this instanceof Ce.Domain) && (this.domain = Ce.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new H(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
873
|
+
};
|
|
874
|
+
g.prototype.setMaxListeners = function(e) {
|
|
875
875
|
if (typeof e != "number" || e < 0 || isNaN(e))
|
|
876
876
|
throw new TypeError('"n" argument must be a positive number');
|
|
877
877
|
return this._maxListeners = e, this;
|
|
878
878
|
};
|
|
879
879
|
function Rt(t) {
|
|
880
|
-
return t._maxListeners === void 0 ?
|
|
880
|
+
return t._maxListeners === void 0 ? g.defaultMaxListeners : t._maxListeners;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
g.prototype.getMaxListeners = function() {
|
|
883
883
|
return Rt(this);
|
|
884
884
|
};
|
|
885
885
|
function Ir(t, e, r) {
|
|
@@ -917,7 +917,7 @@ function Tr(t, e, r, n) {
|
|
|
917
917
|
for (var i = t.length, o = ae(t, i), s = 0; s < i; ++s)
|
|
918
918
|
o[s].apply(r, n);
|
|
919
919
|
}
|
|
920
|
-
|
|
920
|
+
g.prototype.emit = function(e) {
|
|
921
921
|
var r, n, i, o, s, f, a, l = e === "error";
|
|
922
922
|
if (f = this._events, f)
|
|
923
923
|
l = l && f.error == null;
|
|
@@ -929,33 +929,33 @@ m.prototype.emit = function(e) {
|
|
|
929
929
|
else {
|
|
930
930
|
if (r instanceof Error)
|
|
931
931
|
throw r;
|
|
932
|
-
var
|
|
933
|
-
throw
|
|
932
|
+
var c = new Error('Uncaught, unspecified "error" event. (' + r + ")");
|
|
933
|
+
throw c.context = r, c;
|
|
934
934
|
}
|
|
935
935
|
return !1;
|
|
936
936
|
}
|
|
937
937
|
if (n = f[e], !n)
|
|
938
938
|
return !1;
|
|
939
|
-
var
|
|
939
|
+
var h = typeof n == "function";
|
|
940
940
|
switch (i = arguments.length, i) {
|
|
941
941
|
// fast cases
|
|
942
942
|
case 1:
|
|
943
|
-
Ir(n,
|
|
943
|
+
Ir(n, h, this);
|
|
944
944
|
break;
|
|
945
945
|
case 2:
|
|
946
|
-
Cr(n,
|
|
946
|
+
Cr(n, h, this, arguments[1]);
|
|
947
947
|
break;
|
|
948
948
|
case 3:
|
|
949
|
-
Or(n,
|
|
949
|
+
Or(n, h, this, arguments[1], arguments[2]);
|
|
950
950
|
break;
|
|
951
951
|
case 4:
|
|
952
|
-
Ar(n,
|
|
952
|
+
Ar(n, h, this, arguments[1], arguments[2], arguments[3]);
|
|
953
953
|
break;
|
|
954
954
|
// slower
|
|
955
955
|
default:
|
|
956
956
|
for (o = new Array(i - 1), s = 1; s < i; s++)
|
|
957
957
|
o[s - 1] = arguments[s];
|
|
958
|
-
Tr(n,
|
|
958
|
+
Tr(n, h, this, o);
|
|
959
959
|
}
|
|
960
960
|
return !0;
|
|
961
961
|
};
|
|
@@ -979,11 +979,11 @@ function It(t, e, r, n) {
|
|
|
979
979
|
function Lr(t) {
|
|
980
980
|
typeof console.warn == "function" ? console.warn(t) : console.log(t);
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
g.prototype.addListener = function(e, r) {
|
|
983
983
|
return It(this, e, r, !1);
|
|
984
984
|
};
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
g.prototype.on = g.prototype.addListener;
|
|
986
|
+
g.prototype.prependListener = function(e, r) {
|
|
987
987
|
return It(this, e, r, !0);
|
|
988
988
|
};
|
|
989
989
|
function Ct(t, e, r) {
|
|
@@ -993,17 +993,17 @@ function Ct(t, e, r) {
|
|
|
993
993
|
}
|
|
994
994
|
return i.listener = r, i;
|
|
995
995
|
}
|
|
996
|
-
|
|
996
|
+
g.prototype.once = function(e, r) {
|
|
997
997
|
if (typeof r != "function")
|
|
998
998
|
throw new TypeError('"listener" argument must be a function');
|
|
999
999
|
return this.on(e, Ct(this, e, r)), this;
|
|
1000
1000
|
};
|
|
1001
|
-
|
|
1001
|
+
g.prototype.prependOnceListener = function(e, r) {
|
|
1002
1002
|
if (typeof r != "function")
|
|
1003
1003
|
throw new TypeError('"listener" argument must be a function');
|
|
1004
1004
|
return this.prependListener(e, Ct(this, e, r)), this;
|
|
1005
1005
|
};
|
|
1006
|
-
|
|
1006
|
+
g.prototype.removeListener = function(e, r) {
|
|
1007
1007
|
var n, i, o, s, f;
|
|
1008
1008
|
if (typeof r != "function")
|
|
1009
1009
|
throw new TypeError('"listener" argument must be a function');
|
|
@@ -1031,7 +1031,7 @@ m.prototype.removeListener = function(e, r) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
return this;
|
|
1033
1033
|
};
|
|
1034
|
-
|
|
1034
|
+
g.prototype.removeAllListeners = function(e) {
|
|
1035
1035
|
var r, n;
|
|
1036
1036
|
if (n = this._events, !n)
|
|
1037
1037
|
return this;
|
|
@@ -1050,14 +1050,14 @@ m.prototype.removeAllListeners = function(e) {
|
|
|
1050
1050
|
while (r[0]);
|
|
1051
1051
|
return this;
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
g.prototype.listeners = function(e) {
|
|
1054
1054
|
var r, n, i = this._events;
|
|
1055
1055
|
return i ? (r = i[e], r ? typeof r == "function" ? n = [r.listener || r] : n = Nr(r) : n = []) : n = [], n;
|
|
1056
1056
|
};
|
|
1057
|
-
|
|
1057
|
+
g.listenerCount = function(t, e) {
|
|
1058
1058
|
return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ot.call(t, e);
|
|
1059
1059
|
};
|
|
1060
|
-
|
|
1060
|
+
g.prototype.listenerCount = Ot;
|
|
1061
1061
|
function Ot(t) {
|
|
1062
1062
|
var e = this._events;
|
|
1063
1063
|
if (e) {
|
|
@@ -1069,7 +1069,7 @@ function Ot(t) {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
return 0;
|
|
1071
1071
|
}
|
|
1072
|
-
|
|
1072
|
+
g.prototype.eventNames = function() {
|
|
1073
1073
|
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
1074
1074
|
};
|
|
1075
1075
|
function Dr(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 a = "", l = !1,
|
|
1310
|
-
if (Yr(e) && (l = !0,
|
|
1311
|
-
var
|
|
1312
|
-
a = " [Function" +
|
|
1309
|
+
var a = "", l = !1, c = ["{", "}"];
|
|
1310
|
+
if (Yr(e) && (l = !0, c = ["[", "]"]), De(e)) {
|
|
1311
|
+
var h = e.name ? ": " + e.name : "";
|
|
1312
|
+
a = " [Function" + h + "]";
|
|
1313
1313
|
}
|
|
1314
1314
|
if (Te(e) && (a = " " + RegExp.prototype.toString.call(e)), et(e) && (a = " " + Date.prototype.toUTCString.call(e)), Le(e) && (a = " " + Ae(e)), o.length === 0 && (!l || e.length == 0))
|
|
1315
|
-
return
|
|
1315
|
+
return c[0] + a + c[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 p;
|
|
1320
|
-
return l ? p = Vr(t, e, r, s, o) : p = o.map(function(
|
|
1321
|
-
return Pe(t, e, r, s,
|
|
1322
|
-
}), t.seen.pop(), Jr(p, a,
|
|
1320
|
+
return l ? p = Vr(t, e, r, s, o) : p = o.map(function(m) {
|
|
1321
|
+
return Pe(t, e, r, s, m, l);
|
|
1322
|
+
}), t.seen.pop(), Jr(p, a, c);
|
|
1323
1323
|
}
|
|
1324
1324
|
function zr(t, e) {
|
|
1325
1325
|
if (Q(e))
|
|
@@ -1567,7 +1567,7 @@ function Kr(t) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
C.ReadableState = Ut;
|
|
1569
1569
|
var E = Pr("stream");
|
|
1570
|
-
oe(C,
|
|
1570
|
+
oe(C, g);
|
|
1571
1571
|
function en(t, e, r) {
|
|
1572
1572
|
if (typeof t.prependListener == "function")
|
|
1573
1573
|
return t.prependListener(e, r);
|
|
@@ -1583,7 +1583,7 @@ function Ut(t, e) {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
function C(t) {
|
|
1585
1585
|
if (!(this instanceof C)) return new C(t);
|
|
1586
|
-
this._readableState = new Ut(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read),
|
|
1586
|
+
this._readableState = new Ut(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), g.call(this);
|
|
1587
1587
|
}
|
|
1588
1588
|
C.prototype.push = function(t, e) {
|
|
1589
1589
|
var r = this._readableState;
|
|
@@ -1686,10 +1686,10 @@ C.prototype.pipe = function(t, e) {
|
|
|
1686
1686
|
break;
|
|
1687
1687
|
}
|
|
1688
1688
|
n.pipesCount += 1, E("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1689
|
-
var i = !e || e.end !== !1, o = i ? f :
|
|
1689
|
+
var i = !e || e.end !== !1, o = i ? f : c;
|
|
1690
1690
|
n.endEmitted ? B(o) : r.once("end", o), t.on("unpipe", s);
|
|
1691
1691
|
function s(R) {
|
|
1692
|
-
E("onunpipe"), R === r &&
|
|
1692
|
+
E("onunpipe"), R === r && c();
|
|
1693
1693
|
}
|
|
1694
1694
|
function f() {
|
|
1695
1695
|
E("onend"), t.end();
|
|
@@ -1697,20 +1697,20 @@ C.prototype.pipe = function(t, e) {
|
|
|
1697
1697
|
var a = un(r);
|
|
1698
1698
|
t.on("drain", a);
|
|
1699
1699
|
var l = !1;
|
|
1700
|
-
function
|
|
1701
|
-
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", y), t.removeListener("drain", a), t.removeListener("error",
|
|
1700
|
+
function c() {
|
|
1701
|
+
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", y), t.removeListener("drain", a), t.removeListener("error", m), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", c), r.removeListener("data", p), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
|
|
1702
1702
|
}
|
|
1703
|
-
var
|
|
1703
|
+
var h = !1;
|
|
1704
1704
|
r.on("data", p);
|
|
1705
1705
|
function p(R) {
|
|
1706
|
-
E("ondata"),
|
|
1706
|
+
E("ondata"), h = !1;
|
|
1707
1707
|
var v = t.write(R);
|
|
1708
|
-
v === !1 && !
|
|
1708
|
+
v === !1 && !h && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && $t(n.pipes, t) !== -1) && !l && (E("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, h = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
E("onerror", R), S(), t.removeListener("error",
|
|
1710
|
+
function m(R) {
|
|
1711
|
+
E("onerror", R), S(), t.removeListener("error", m), tn(t, "error") === 0 && t.emit("error", R);
|
|
1712
1712
|
}
|
|
1713
|
-
en(t, "error",
|
|
1713
|
+
en(t, "error", m);
|
|
1714
1714
|
function x() {
|
|
1715
1715
|
t.removeListener("finish", y), S();
|
|
1716
1716
|
}
|
|
@@ -1746,7 +1746,7 @@ C.prototype.unpipe = function(t) {
|
|
|
1746
1746
|
return o === -1 ? this : (e.pipes.splice(o, 1), e.pipesCount -= 1, e.pipesCount === 1 && (e.pipes = e.pipes[0]), t.emit("unpipe", this), this);
|
|
1747
1747
|
};
|
|
1748
1748
|
C.prototype.on = function(t, e) {
|
|
1749
|
-
var r =
|
|
1749
|
+
var r = g.prototype.on.call(this, t, e);
|
|
1750
1750
|
if (t === "data")
|
|
1751
1751
|
this._readableState.flowing !== !1 && this.resume();
|
|
1752
1752
|
else if (t === "readable") {
|
|
@@ -1856,7 +1856,7 @@ function $t(t, e) {
|
|
|
1856
1856
|
return -1;
|
|
1857
1857
|
}
|
|
1858
1858
|
L.WritableState = He;
|
|
1859
|
-
oe(L,
|
|
1859
|
+
oe(L, g);
|
|
1860
1860
|
function wn() {
|
|
1861
1861
|
}
|
|
1862
1862
|
function yn(t, e, r) {
|
|
@@ -1882,7 +1882,7 @@ He.prototype.getBuffer = function() {
|
|
|
1882
1882
|
};
|
|
1883
1883
|
function L(t) {
|
|
1884
1884
|
if (!(this instanceof L) && !(this instanceof M)) return new L(t);
|
|
1885
|
-
this._writableState = new He(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)),
|
|
1885
|
+
this._writableState = new He(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)), g.call(this);
|
|
1886
1886
|
}
|
|
1887
1887
|
L.prototype.pipe = function() {
|
|
1888
1888
|
this.emit("error", new Error("Cannot pipe, not readable"));
|
|
@@ -1960,8 +1960,8 @@ function jt(t, e) {
|
|
|
1960
1960
|
$e(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 Vt(e);
|
|
1961
1961
|
} else {
|
|
1962
1962
|
for (; r; ) {
|
|
1963
|
-
var f = r.chunk, a = r.encoding, l = r.callback,
|
|
1964
|
-
if ($e(t, e, !1,
|
|
1963
|
+
var f = r.chunk, a = r.encoding, l = r.callback, c = e.objectMode ? 1 : f.length;
|
|
1964
|
+
if ($e(t, e, !1, c, f, a, l), r = r.next, e.writing)
|
|
1965
1965
|
break;
|
|
1966
1966
|
}
|
|
1967
1967
|
r === null && (e.lastBufferedRequest = null);
|
|
@@ -2073,7 +2073,7 @@ function fe(t) {
|
|
|
2073
2073
|
fe.prototype._transform = function(t, e, r) {
|
|
2074
2074
|
r(null, t);
|
|
2075
2075
|
};
|
|
2076
|
-
oe(V,
|
|
2076
|
+
oe(V, g);
|
|
2077
2077
|
V.Readable = C;
|
|
2078
2078
|
V.Writable = L;
|
|
2079
2079
|
V.Duplex = M;
|
|
@@ -2081,12 +2081,12 @@ V.Transform = k;
|
|
|
2081
2081
|
V.PassThrough = fe;
|
|
2082
2082
|
V.Stream = V;
|
|
2083
2083
|
function V() {
|
|
2084
|
-
|
|
2084
|
+
g.call(this);
|
|
2085
2085
|
}
|
|
2086
2086
|
V.prototype.pipe = function(t, e) {
|
|
2087
2087
|
var r = this;
|
|
2088
|
-
function n(
|
|
2089
|
-
t.writable && t.write(
|
|
2088
|
+
function n(c) {
|
|
2089
|
+
t.writable && t.write(c) === !1 && r.pause && r.pause();
|
|
2090
2090
|
}
|
|
2091
2091
|
r.on("data", n);
|
|
2092
2092
|
function i() {
|
|
@@ -2100,9 +2100,9 @@ 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 a(
|
|
2104
|
-
if (l(),
|
|
2105
|
-
throw
|
|
2103
|
+
function a(c) {
|
|
2104
|
+
if (l(), g.listenerCount(this, "error") === 0)
|
|
2105
|
+
throw c;
|
|
2106
2106
|
}
|
|
2107
2107
|
r.on("error", a), t.on("error", a);
|
|
2108
2108
|
function l() {
|
|
@@ -2665,22 +2665,22 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2665
2665
|
state: kn(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize:
|
|
2669
|
-
|
|
2668
|
+
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: c, recordDelimiterMaxLength: h } = this.state, p = i - n - 1, m = Math.max(
|
|
2669
|
+
c,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
2672
2672
|
// 1. It is equals to `[]` and "recordDelimiterMaxLength" equals `0`
|
|
2673
2673
|
// 2. We set the length to windows line ending in the current encoding
|
|
2674
2674
|
// Note, that encoding is known from user or bom discovery at that point
|
|
2675
2675
|
// recordDelimiterMaxLength,
|
|
2676
|
-
|
|
2677
|
-
`, s).length :
|
|
2676
|
+
h === 0 ? u.from(`\r
|
|
2677
|
+
`, s).length : h,
|
|
2678
2678
|
// Skip if remaining buffer can be an escaped quote
|
|
2679
2679
|
l ? (f === null ? 0 : f.length) + a.length : 0,
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
|
-
l ? a.length +
|
|
2681
|
+
l ? a.length + h : 0
|
|
2682
2682
|
);
|
|
2683
|
-
return p <
|
|
2683
|
+
return p < m;
|
|
2684
2684
|
},
|
|
2685
2685
|
// Central parser implementation
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
@@ -2688,10 +2688,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2688
2688
|
bom: f,
|
|
2689
2689
|
comment_no_infix: a,
|
|
2690
2690
|
encoding: l,
|
|
2691
|
-
from_line:
|
|
2692
|
-
ltrim:
|
|
2691
|
+
from_line: c,
|
|
2692
|
+
ltrim: h,
|
|
2693
2693
|
max_record_size: p,
|
|
2694
|
-
raw:
|
|
2694
|
+
raw: m,
|
|
2695
2695
|
relax_quotes: x,
|
|
2696
2696
|
rtrim: y,
|
|
2697
2697
|
skip_empty_lines: S,
|
|
@@ -2744,7 +2744,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2744
2744
|
d
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
2746
|
const O = b[d];
|
|
2747
|
-
if (
|
|
2747
|
+
if (m === !0 && Qt.append(O), (O === $n || O === jn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
2750
|
if (I !== null && this.state.quoting === !0 && this.__isEscape(b, d, O) && d + I.length < Ie)
|
|
@@ -2822,7 +2822,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2822
2822
|
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0)
|
|
2823
2823
|
this.info.comment_lines++;
|
|
2824
2824
|
else {
|
|
2825
|
-
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >=
|
|
2825
|
+
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= c) {
|
|
2826
2826
|
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += A - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
@@ -2874,7 +2874,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J =
|
|
2877
|
+
const J = h === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(b, d), he = y === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && he === !0)
|
|
2879
2879
|
this.state.field.append(O);
|
|
2880
2880
|
else {
|
|
@@ -2928,16 +2928,16 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2928
2928
|
info: f,
|
|
2929
2929
|
from: a,
|
|
2930
2930
|
relax_column_count: l,
|
|
2931
|
-
relax_column_count_less:
|
|
2932
|
-
relax_column_count_more:
|
|
2931
|
+
relax_column_count_less: c,
|
|
2932
|
+
relax_column_count_more: h,
|
|
2933
2933
|
raw: p,
|
|
2934
|
-
skip_records_with_empty_values:
|
|
2934
|
+
skip_records_with_empty_values: m
|
|
2935
2935
|
} = this.options, { enabled: x, record: y } = this.state;
|
|
2936
2936
|
if (x === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
2938
|
const S = y.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (
|
|
2940
|
+
if (m === !0 && lt(y)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
@@ -2970,14 +2970,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2970
2970
|
record: y
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (l === !0 ||
|
|
2973
|
+
if (l === !0 || c === !0 && S < this.state.expectedRecordLength || h === !0 && S > this.state.expectedRecordLength)
|
|
2974
2974
|
this.info.invalid_field_length++, this.state.error = R;
|
|
2975
2975
|
else {
|
|
2976
2976
|
const v = this.__error(R);
|
|
2977
2977
|
if (v) return v;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2980
|
+
if (m === !0 && lt(y)) {
|
|
2981
2981
|
this.__resetRecord();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
@@ -3068,9 +3068,9 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3068
3068
|
return this.__resetField();
|
|
3069
3069
|
let l = this.state.field.toString(i);
|
|
3070
3070
|
if (o === !0 && a === !1 && (l = l.trimRight()), n === !0) {
|
|
3071
|
-
const [
|
|
3072
|
-
if (
|
|
3073
|
-
l =
|
|
3071
|
+
const [c, h] = this.__cast(l);
|
|
3072
|
+
if (c !== void 0) return c;
|
|
3073
|
+
l = h;
|
|
3074
3074
|
}
|
|
3075
3075
|
this.state.record.push(l), s !== 0 && typeof l == "string" && (this.state.record_length += l.length), this.__resetField();
|
|
3076
3076
|
},
|
|
@@ -3116,10 +3116,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3116
3116
|
return ((s, f) => {
|
|
3117
3117
|
const { timchars: a } = this.state;
|
|
3118
3118
|
e: for (let l = 0; l < a.length; l++) {
|
|
3119
|
-
const
|
|
3120
|
-
for (let
|
|
3121
|
-
if (h
|
|
3122
|
-
return
|
|
3119
|
+
const c = a[l];
|
|
3120
|
+
for (let h = 0; h < c.length; h++)
|
|
3121
|
+
if (c[h] !== s[f + h]) continue e;
|
|
3122
|
+
return c.length;
|
|
3123
3123
|
}
|
|
3124
3124
|
return 0;
|
|
3125
3125
|
})(n, i);
|
|
@@ -3149,8 +3149,8 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3149
3149
|
e: for (let a = 0; a < s.length; a++) {
|
|
3150
3150
|
const l = s[a];
|
|
3151
3151
|
if (l[0] === o) {
|
|
3152
|
-
for (let
|
|
3153
|
-
if (l[
|
|
3152
|
+
for (let c = 1; c < l.length; c++)
|
|
3153
|
+
if (l[c] !== n[i + c]) continue e;
|
|
3154
3154
|
return l.length;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
@@ -3159,10 +3159,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3159
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3160
3160
|
const { record_delimiter: s } = this.options, f = s.length;
|
|
3161
3161
|
e: for (let a = 0; a < f; a++) {
|
|
3162
|
-
const l = s[a],
|
|
3162
|
+
const l = s[a], c = l.length;
|
|
3163
3163
|
if (l[0] === n) {
|
|
3164
|
-
for (let
|
|
3165
|
-
if (l[
|
|
3164
|
+
for (let h = 1; h < c; h++)
|
|
3165
|
+
if (l[h] !== i[o + h])
|
|
3166
3166
|
continue e;
|
|
3167
3167
|
return l.length;
|
|
3168
3168
|
}
|
|
@@ -3388,12 +3388,18 @@ class ri {
|
|
|
3388
3388
|
/**
|
|
3389
3389
|
* Determine schema configuration.
|
|
3390
3390
|
*/
|
|
3391
|
-
async determineSchemaConfig(e, r) {
|
|
3392
|
-
const
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3391
|
+
async determineSchemaConfig(e, r, n) {
|
|
3392
|
+
const i = Xn(r), { records: o, valueDelimiterId: s } = await Kn(r, n);
|
|
3393
|
+
console.log(3333, o);
|
|
3394
|
+
const f = [], a = [];
|
|
3395
|
+
for (const l of o) {
|
|
3396
|
+
const c = e.parseRecord(a, l, !0);
|
|
3397
|
+
console.log(4444, c);
|
|
3398
|
+
}
|
|
3399
|
+
return {
|
|
3400
|
+
recordDelimiterId: i,
|
|
3401
|
+
records: f,
|
|
3402
|
+
valueDelimiterId: s
|
|
3397
3403
|
};
|
|
3398
3404
|
}
|
|
3399
3405
|
/**
|
|
@@ -3401,33 +3407,33 @@ class ri {
|
|
|
3401
3407
|
*/
|
|
3402
3408
|
async parseStream(e, r, n, i, o) {
|
|
3403
3409
|
return new Promise((s, f) => {
|
|
3404
|
-
let a, l,
|
|
3405
|
-
const
|
|
3410
|
+
let a, l, c, h = !1, p = !1;
|
|
3411
|
+
const m = () => {
|
|
3406
3412
|
if (p) return;
|
|
3407
3413
|
p = !0;
|
|
3408
3414
|
const S = a;
|
|
3409
|
-
a = void 0,
|
|
3415
|
+
a = void 0, c = void 0, S != null && (Be(() => S.removeAllListeners()), Be(() => S.end())), Be(() => {
|
|
3410
3416
|
l?.cancel();
|
|
3411
3417
|
}), l = void 0;
|
|
3412
3418
|
};
|
|
3413
|
-
i.signal.addEventListener("abort",
|
|
3419
|
+
i.signal.addEventListener("abort", m, { once: !0 });
|
|
3414
3420
|
const x = (S) => {
|
|
3415
|
-
|
|
3421
|
+
h || (h = !0, m(), i.signal.aborted || i.abort(S), f(S));
|
|
3416
3422
|
};
|
|
3417
3423
|
(async () => {
|
|
3418
|
-
a = je(r),
|
|
3424
|
+
a = je(r), c = ei({ chunk: o, chunkSize: e.chunkSize ?? Gn }), a.on("readable", () => {
|
|
3419
3425
|
try {
|
|
3420
|
-
if (a == null ||
|
|
3426
|
+
if (a == null || c == null) return;
|
|
3421
3427
|
let I;
|
|
3422
3428
|
for (; (I = a.read()) != null; ) {
|
|
3423
|
-
if (
|
|
3424
|
-
i.signal.throwIfAborted(),
|
|
3429
|
+
if (h) return;
|
|
3430
|
+
i.signal.throwIfAborted(), c.push(I);
|
|
3425
3431
|
}
|
|
3426
3432
|
} catch (I) {
|
|
3427
3433
|
x(I);
|
|
3428
3434
|
}
|
|
3429
3435
|
}), a.on("error", (I) => x(I)), a.on("end", () => {
|
|
3430
|
-
|
|
3436
|
+
h || (c?.flush(), s(ti(a)));
|
|
3431
3437
|
});
|
|
3432
3438
|
const S = await fetch(encodeURI(n), { signal: i.signal });
|
|
3433
3439
|
if (!S.ok || S.body == null)
|
|
@@ -3436,12 +3442,12 @@ class ri {
|
|
|
3436
3442
|
const R = new TextDecoder(e.encodingId);
|
|
3437
3443
|
let v = await l.read();
|
|
3438
3444
|
for (; !v.done; ) {
|
|
3439
|
-
if (
|
|
3445
|
+
if (h) return;
|
|
3440
3446
|
i.signal.throwIfAborted();
|
|
3441
3447
|
const I = R.decode(v.value, { stream: !0 });
|
|
3442
3448
|
I.length > 0 && a.write(I), v = await l.read();
|
|
3443
3449
|
}
|
|
3444
|
-
if (
|
|
3450
|
+
if (h) return;
|
|
3445
3451
|
const _ = R.decode();
|
|
3446
3452
|
_.length > 0 && a.write(_), a.end();
|
|
3447
3453
|
})().catch((S) => x(S));
|
|
@@ -3459,22 +3465,26 @@ async function Kn(t, e) {
|
|
|
3459
3465
|
let r, n, i, o = [];
|
|
3460
3466
|
for (const s of e)
|
|
3461
3467
|
try {
|
|
3462
|
-
let f = 0, a, l = 0,
|
|
3463
|
-
const
|
|
3468
|
+
let f = 0, a, l = 0, c = 0;
|
|
3469
|
+
const h = je({
|
|
3470
|
+
cast: (p, m) => ({ value: p, isQuoted: m.quoting }),
|
|
3471
|
+
delimiter: s,
|
|
3472
|
+
relax_column_count: !0
|
|
3473
|
+
});
|
|
3464
3474
|
await new Promise((p) => {
|
|
3465
3475
|
try {
|
|
3466
|
-
const
|
|
3467
|
-
|
|
3476
|
+
const m = [];
|
|
3477
|
+
h.on("readable", () => {
|
|
3468
3478
|
let x;
|
|
3469
|
-
for (; (x =
|
|
3479
|
+
for (; (x = h.read()) != null; ) {
|
|
3470
3480
|
l++;
|
|
3471
3481
|
const y = x.length;
|
|
3472
|
-
a != null && (
|
|
3482
|
+
a != null && (c += Math.abs(y - a)), a = y, f += y, m.push(x);
|
|
3473
3483
|
}
|
|
3474
|
-
}),
|
|
3484
|
+
}), h.on("error", () => p()), h.on("end", () => {
|
|
3475
3485
|
const x = f / l;
|
|
3476
|
-
console.log(1111, f, l, x), (!i ||
|
|
3477
|
-
}),
|
|
3486
|
+
console.log(1111, f, l, x), (!i || c <= i) && (!n || x > n) && (r = s, n = x, i = c, o = [...m]), p();
|
|
3487
|
+
}), h.write(t), h.end();
|
|
3478
3488
|
} catch {
|
|
3479
3489
|
p();
|
|
3480
3490
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
2
|
-
import {
|
|
2
|
+
import { EngineUtilities } from '@datapos/datapos-shared/engine';
|
|
3
3
|
import { RetrieveRecordsOptions, RetrieveRecordsSummary } from '@datapos/datapos-shared/component/connector';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
type ParsedRecord = string[];
|
|
4
|
+
import { RecordDelimiterId, ValueDelimiterId } from '@datapos/datapos-shared/component/dataView';
|
|
5
|
+
type StreamParsedRecord = string[];
|
|
8
6
|
/**
|
|
9
7
|
* Schema configuration.
|
|
10
8
|
*/
|
|
11
9
|
interface SchemaConfig {
|
|
12
10
|
recordDelimiterId: RecordDelimiterId;
|
|
13
|
-
records:
|
|
11
|
+
records: StreamParsedRecord[];
|
|
14
12
|
valueDelimiterId: ValueDelimiterId;
|
|
15
13
|
}
|
|
16
14
|
/** Tool. */
|
|
@@ -20,11 +18,11 @@ declare class Tool {
|
|
|
20
18
|
/**
|
|
21
19
|
* Determine schema configuration.
|
|
22
20
|
*/
|
|
23
|
-
determineSchemaConfig(text: string, delimiters: ValueDelimiterId[]): Promise<SchemaConfig>;
|
|
21
|
+
determineSchemaConfig(engineUtilities: EngineUtilities, text: string, delimiters: ValueDelimiterId[]): Promise<SchemaConfig>;
|
|
24
22
|
/**
|
|
25
23
|
* Parse stream.
|
|
26
24
|
*/
|
|
27
25
|
parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records: (string[] | Record<string, unknown>)[]) => void): Promise<RetrieveRecordsSummary>;
|
|
28
26
|
}
|
|
29
27
|
export type { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
30
|
-
export { type
|
|
28
|
+
export { type StreamParsedRecord, type SchemaConfig, Tool };
|