@datapos/datapos-tool-csv-parse 0.0.83 → 0.0.85
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.
|
@@ -31,8 +31,8 @@ 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, h = -7, c = r ? i - 1 : 0, p = r ? -1 : 1,
|
|
35
|
-
for (c += p, o =
|
|
34
|
+
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1, h = -7, c = r ? i - 1 : 0, p = r ? -1 : 1, m = t[e + c];
|
|
35
|
+
for (c += p, o = m & (1 << -h) - 1, m >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += p, 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 += p, h -= 8)
|
|
38
38
|
;
|
|
@@ -40,18 +40,18 @@ function ve(t, e, r, n, i) {
|
|
|
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, h = (1 << l) - 1, c = h >> 1, p = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 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 * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + c >= 1 ? e += p / a : e += p * Math.pow(2, 1 - c), e * a >= 2 && (s++, a /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * a - 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 +
|
|
49
|
+
var s, f, a, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 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 = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + c >= 1 ? e += p / a : e += p * Math.pow(2, 1 - c), e * a >= 2 && (s++, a /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * a - 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 + 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]";
|
|
@@ -348,8 +348,8 @@ 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) {
|
|
@@ -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;
|
|
@@ -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) {
|
|
@@ -1317,8 +1317,8 @@ function ye(t, e, r) {
|
|
|
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,
|
|
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
1322
|
}), t.seen.pop(), Jr(p, a, h);
|
|
1323
1323
|
}
|
|
1324
1324
|
function zr(t, 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;
|
|
@@ -1698,7 +1698,7 @@ C.prototype.pipe = function(t, e) {
|
|
|
1698
1698
|
t.on("drain", a);
|
|
1699
1699
|
var l = !1;
|
|
1700
1700
|
function h() {
|
|
1701
|
-
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", y), t.removeListener("drain", a), t.removeListener("error",
|
|
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", h), r.removeListener("data", p), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
|
|
1702
1702
|
}
|
|
1703
1703
|
var c = !1;
|
|
1704
1704
|
r.on("data", p);
|
|
@@ -1707,10 +1707,10 @@ C.prototype.pipe = function(t, e) {
|
|
|
1707
1707
|
var v = t.write(I);
|
|
1708
1708
|
v === !1 && !c && ((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++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
E("onerror", I), S(), t.removeListener("error",
|
|
1710
|
+
function m(I) {
|
|
1711
|
+
E("onerror", I), S(), t.removeListener("error", m), tn(t, "error") === 0 && t.emit("error", I);
|
|
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 B)) 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"));
|
|
@@ -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 = B;
|
|
@@ -2081,7 +2081,7 @@ 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;
|
|
@@ -2101,7 +2101,7 @@ V.prototype.pipe = function(t, e) {
|
|
|
2101
2101
|
o || (o = !0, typeof t.destroy == "function" && t.destroy());
|
|
2102
2102
|
}
|
|
2103
2103
|
function a(h) {
|
|
2104
|
-
if (l(),
|
|
2104
|
+
if (l(), g.listenerCount(this, "error") === 0)
|
|
2105
2105
|
throw h;
|
|
2106
2106
|
}
|
|
2107
2107
|
r.on("error", a), t.on("error", a);
|
|
@@ -2665,7 +2665,7 @@ 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: h, recordDelimiterMaxLength: c } = this.state, p = i - n - 1,
|
|
2668
|
+
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, p = i - n - 1, m = 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:
|
|
@@ -2680,7 +2680,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
2681
|
l ? a.length + c : 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) {
|
|
@@ -2691,7 +2691,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2691
2691
|
from_line: h,
|
|
2692
2692
|
ltrim: c,
|
|
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 (R !== null && this.state.quoting === !0 && this.__isEscape(b, d, O) && d + R.length < Ie)
|
|
@@ -2931,13 +2931,13 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2931
2931
|
relax_column_count_less: h,
|
|
2932
2932
|
relax_column_count_more: c,
|
|
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
|
}
|
|
@@ -2977,7 +2977,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
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
|
}
|
|
@@ -3390,7 +3390,7 @@ class ri {
|
|
|
3390
3390
|
*/
|
|
3391
3391
|
async determineSchemaConfig(e, r, n) {
|
|
3392
3392
|
const i = Xn(r), { records: o, valueDelimiterId: s } = await Kn(r, n);
|
|
3393
|
-
return { columnConfigs: [], recordDelimiterId: i, records: [], valueDelimiterId: s };
|
|
3393
|
+
return console.log("records", o), { columnConfigs: [], recordDelimiterId: i, records: [], valueDelimiterId: s };
|
|
3394
3394
|
}
|
|
3395
3395
|
/**
|
|
3396
3396
|
* Parse stream.
|
|
@@ -3398,7 +3398,7 @@ class ri {
|
|
|
3398
3398
|
async parseStream(e, r, n, i, o) {
|
|
3399
3399
|
return new Promise((s, f) => {
|
|
3400
3400
|
let a, l, h, c = !1, p = !1;
|
|
3401
|
-
const
|
|
3401
|
+
const m = () => {
|
|
3402
3402
|
if (p) return;
|
|
3403
3403
|
p = !0;
|
|
3404
3404
|
const S = a;
|
|
@@ -3406,9 +3406,9 @@ class ri {
|
|
|
3406
3406
|
l?.cancel();
|
|
3407
3407
|
}), l = void 0;
|
|
3408
3408
|
};
|
|
3409
|
-
i.signal.addEventListener("abort",
|
|
3409
|
+
i.signal.addEventListener("abort", m, { once: !0 });
|
|
3410
3410
|
const x = (S) => {
|
|
3411
|
-
c || (c = !0,
|
|
3411
|
+
c || (c = !0, m(), i.signal.aborted || i.abort(S), f(S));
|
|
3412
3412
|
};
|
|
3413
3413
|
(async () => {
|
|
3414
3414
|
a = je({
|
|
@@ -3460,22 +3460,23 @@ async function Kn(t, e) {
|
|
|
3460
3460
|
try {
|
|
3461
3461
|
let f = 0, a, l = 0, h = 0;
|
|
3462
3462
|
const c = je({
|
|
3463
|
+
cast: (p, m) => ({ value: p, isQuoted: m.quoting }),
|
|
3463
3464
|
delimiter: s,
|
|
3464
3465
|
relax_column_count: !0
|
|
3465
3466
|
});
|
|
3466
3467
|
await new Promise((p) => {
|
|
3467
3468
|
try {
|
|
3468
|
-
const
|
|
3469
|
+
const m = [];
|
|
3469
3470
|
c.on("readable", () => {
|
|
3470
3471
|
let x;
|
|
3471
3472
|
for (; (x = c.read()) != null; ) {
|
|
3472
3473
|
l++;
|
|
3473
3474
|
const y = x.length;
|
|
3474
|
-
a != null && (h += Math.abs(y - a)), a = y, f += y,
|
|
3475
|
+
a != null && (h += Math.abs(y - a)), a = y, f += y, m.push(x);
|
|
3475
3476
|
}
|
|
3476
3477
|
}), c.on("error", () => p()), c.on("end", () => {
|
|
3477
3478
|
const x = f / l;
|
|
3478
|
-
(!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...
|
|
3479
|
+
(!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...m]), p();
|
|
3479
3480
|
}), c.write(t), c.end();
|
|
3480
3481
|
} catch {
|
|
3481
3482
|
p();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
2
2
|
import { EngineUtilities } from '@datapos/datapos-shared/engine';
|
|
3
3
|
import { ConnectionColumnConfig, RetrieveRecordsOptions, RetrieveRecordsSummary } from '@datapos/datapos-shared/component/connector';
|
|
4
|
-
import {
|
|
4
|
+
import { ParseRecord, RecordDelimiterId, ValueDelimiterId } from '@datapos/datapos-shared/component/dataView';
|
|
5
5
|
/**
|
|
6
6
|
* Schema configuration.
|
|
7
7
|
*/
|
|
@@ -22,7 +22,7 @@ declare class Tool {
|
|
|
22
22
|
/**
|
|
23
23
|
* Parse stream.
|
|
24
24
|
*/
|
|
25
|
-
parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records:
|
|
25
|
+
parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records: ParseRecord[]) => void): Promise<RetrieveRecordsSummary>;
|
|
26
26
|
}
|
|
27
27
|
export type { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
28
28
|
export { type SchemaConfig, Tool };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-tool-csv-parse",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.85",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"prettier": "@datapos/datapos-development/prettierrc",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@datapos/datapos-shared": "^0.3.
|
|
29
|
+
"@datapos/datapos-shared": "^0.3.465",
|
|
30
30
|
"csv-parse": "^6.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|