@datapos/datapos-tool-csv-parse 0.0.49 → 0.0.51
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 +202 -203
- package/dist/types/src/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -46,12 +46,12 @@ function ve(t, e, r, n, i) {
|
|
|
46
46
|
return (w ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f, u, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, m = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, w = n ? 0 : o - 1,
|
|
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 += m / u : e += m * 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 + w] = f & 255, w +=
|
|
49
|
+
var s, f, u, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, m = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, w = 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 += m / u : e += m * 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 + w] = f & 255, w += O, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f, l += i; l > 0; t[r + w] = s & 255, w +=
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + w] = s & 255, w += O, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r + w -
|
|
54
|
+
t[r + w - O] |= E * 128;
|
|
55
55
|
}
|
|
56
56
|
var Kt = {}.toString, ct = Array.isArray || function(t) {
|
|
57
57
|
return Kt.call(t) == "[object Array]";
|
|
@@ -348,8 +348,8 @@ 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 u(w,
|
|
352
|
-
return o === 1 ? w[
|
|
351
|
+
function u(w, O) {
|
|
352
|
+
return o === 1 ? w[O] : w.readUInt16BE(O * o);
|
|
353
353
|
}
|
|
354
354
|
var l;
|
|
355
355
|
if (i) {
|
|
@@ -532,79 +532,79 @@ a.prototype.slice = function(e, r) {
|
|
|
532
532
|
}
|
|
533
533
|
return i;
|
|
534
534
|
};
|
|
535
|
-
function
|
|
535
|
+
function A(t, e, r) {
|
|
536
536
|
if (t % 1 !== 0 || t < 0) throw new RangeError("offset is not uint");
|
|
537
537
|
if (t + e > r) throw new RangeError("Trying to access beyond buffer length");
|
|
538
538
|
}
|
|
539
539
|
a.prototype.readUIntLE = function(e, r, n) {
|
|
540
|
-
e = e | 0, r = r | 0, n ||
|
|
540
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
541
541
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
542
542
|
i += this[e + s] * o;
|
|
543
543
|
return i;
|
|
544
544
|
};
|
|
545
545
|
a.prototype.readUIntBE = function(e, r, n) {
|
|
546
|
-
e = e | 0, r = r | 0, n ||
|
|
546
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
547
547
|
for (var i = this[e + --r], o = 1; r > 0 && (o *= 256); )
|
|
548
548
|
i += this[e + --r] * o;
|
|
549
549
|
return i;
|
|
550
550
|
};
|
|
551
551
|
a.prototype.readUInt8 = function(e, r) {
|
|
552
|
-
return r ||
|
|
552
|
+
return r || A(e, 1, this.length), this[e];
|
|
553
553
|
};
|
|
554
554
|
a.prototype.readUInt16LE = function(e, r) {
|
|
555
|
-
return r ||
|
|
555
|
+
return r || A(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
556
556
|
};
|
|
557
557
|
a.prototype.readUInt16BE = function(e, r) {
|
|
558
|
-
return r ||
|
|
558
|
+
return r || A(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
559
559
|
};
|
|
560
560
|
a.prototype.readUInt32LE = function(e, r) {
|
|
561
|
-
return r ||
|
|
561
|
+
return r || A(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
562
562
|
};
|
|
563
563
|
a.prototype.readUInt32BE = function(e, r) {
|
|
564
|
-
return r ||
|
|
564
|
+
return r || A(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
565
565
|
};
|
|
566
566
|
a.prototype.readIntLE = function(e, r, n) {
|
|
567
|
-
e = e | 0, r = r | 0, n ||
|
|
567
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
568
568
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
569
569
|
i += this[e + s] * o;
|
|
570
570
|
return o *= 128, i >= o && (i -= Math.pow(2, 8 * r)), i;
|
|
571
571
|
};
|
|
572
572
|
a.prototype.readIntBE = function(e, r, n) {
|
|
573
|
-
e = e | 0, r = r | 0, n ||
|
|
573
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
574
574
|
for (var i = r, o = 1, s = this[e + --i]; i > 0 && (o *= 256); )
|
|
575
575
|
s += this[e + --i] * o;
|
|
576
576
|
return o *= 128, s >= o && (s -= Math.pow(2, 8 * r)), s;
|
|
577
577
|
};
|
|
578
578
|
a.prototype.readInt8 = function(e, r) {
|
|
579
|
-
return r ||
|
|
579
|
+
return r || A(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
580
580
|
};
|
|
581
581
|
a.prototype.readInt16LE = function(e, r) {
|
|
582
|
-
r ||
|
|
582
|
+
r || A(e, 2, this.length);
|
|
583
583
|
var n = this[e] | this[e + 1] << 8;
|
|
584
584
|
return n & 32768 ? n | 4294901760 : n;
|
|
585
585
|
};
|
|
586
586
|
a.prototype.readInt16BE = function(e, r) {
|
|
587
|
-
r ||
|
|
587
|
+
r || A(e, 2, this.length);
|
|
588
588
|
var n = this[e + 1] | this[e] << 8;
|
|
589
589
|
return n & 32768 ? n | 4294901760 : n;
|
|
590
590
|
};
|
|
591
591
|
a.prototype.readInt32LE = function(e, r) {
|
|
592
|
-
return r ||
|
|
592
|
+
return r || A(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
593
593
|
};
|
|
594
594
|
a.prototype.readInt32BE = function(e, r) {
|
|
595
|
-
return r ||
|
|
595
|
+
return r || A(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
596
596
|
};
|
|
597
597
|
a.prototype.readFloatLE = function(e, r) {
|
|
598
|
-
return r ||
|
|
598
|
+
return r || A(e, 4, this.length), ve(this, e, !0, 23, 4);
|
|
599
599
|
};
|
|
600
600
|
a.prototype.readFloatBE = function(e, r) {
|
|
601
|
-
return r ||
|
|
601
|
+
return r || A(e, 4, this.length), ve(this, e, !1, 23, 4);
|
|
602
602
|
};
|
|
603
603
|
a.prototype.readDoubleLE = function(e, r) {
|
|
604
|
-
return r ||
|
|
604
|
+
return r || A(e, 8, this.length), ve(this, e, !0, 52, 8);
|
|
605
605
|
};
|
|
606
606
|
a.prototype.readDoubleBE = function(e, r) {
|
|
607
|
-
return r ||
|
|
607
|
+
return r || A(e, 8, this.length), ve(this, e, !1, 52, 8);
|
|
608
608
|
};
|
|
609
609
|
function D(t, e, r, n, i, o) {
|
|
610
610
|
if (!$(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
@@ -859,27 +859,27 @@ var Oe;
|
|
|
859
859
|
function Q() {
|
|
860
860
|
}
|
|
861
861
|
Q.prototype = /* @__PURE__ */ Object.create(null);
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
this.domain = null,
|
|
873
|
-
};
|
|
874
|
-
|
|
862
|
+
function p() {
|
|
863
|
+
p.init.call(this);
|
|
864
|
+
}
|
|
865
|
+
p.EventEmitter = p;
|
|
866
|
+
p.usingDomains = !1;
|
|
867
|
+
p.prototype.domain = void 0;
|
|
868
|
+
p.prototype._events = void 0;
|
|
869
|
+
p.prototype._maxListeners = void 0;
|
|
870
|
+
p.defaultMaxListeners = 10;
|
|
871
|
+
p.init = function() {
|
|
872
|
+
this.domain = null, p.usingDomains && Oe.active && !(this instanceof Oe.Domain) && (this.domain = Oe.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new Q(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
873
|
+
};
|
|
874
|
+
p.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 St(t) {
|
|
880
|
-
return t._maxListeners === void 0 ?
|
|
880
|
+
return t._maxListeners === void 0 ? p.defaultMaxListeners : t._maxListeners;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
p.prototype.getMaxListeners = function() {
|
|
883
883
|
return St(this);
|
|
884
884
|
};
|
|
885
885
|
function Rr(t, e, r) {
|
|
@@ -917,7 +917,7 @@ function Ar(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
|
+
p.prototype.emit = function(e) {
|
|
921
921
|
var r, n, i, o, s, f, u, l = e === "error";
|
|
922
922
|
if (f = this._events, f)
|
|
923
923
|
l = l && f.error == null;
|
|
@@ -979,11 +979,11 @@ function Rt(t, e, r, n) {
|
|
|
979
979
|
function Tr(t) {
|
|
980
980
|
typeof console.warn == "function" ? console.warn(t) : console.log(t);
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
p.prototype.addListener = function(e, r) {
|
|
983
983
|
return Rt(this, e, r, !1);
|
|
984
984
|
};
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
p.prototype.on = p.prototype.addListener;
|
|
986
|
+
p.prototype.prependListener = function(e, r) {
|
|
987
987
|
return Rt(this, e, r, !0);
|
|
988
988
|
};
|
|
989
989
|
function It(t, e, r) {
|
|
@@ -993,17 +993,17 @@ function It(t, e, r) {
|
|
|
993
993
|
}
|
|
994
994
|
return i.listener = r, i;
|
|
995
995
|
}
|
|
996
|
-
|
|
996
|
+
p.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, It(this, e, r)), this;
|
|
1000
1000
|
};
|
|
1001
|
-
|
|
1001
|
+
p.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, It(this, e, r)), this;
|
|
1005
1005
|
};
|
|
1006
|
-
|
|
1006
|
+
p.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 @@ g.prototype.removeListener = function(e, r) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
return this;
|
|
1033
1033
|
};
|
|
1034
|
-
|
|
1034
|
+
p.prototype.removeAllListeners = function(e) {
|
|
1035
1035
|
var r, n;
|
|
1036
1036
|
if (n = this._events, !n)
|
|
1037
1037
|
return this;
|
|
@@ -1050,14 +1050,14 @@ g.prototype.removeAllListeners = function(e) {
|
|
|
1050
1050
|
while (r[0]);
|
|
1051
1051
|
return this;
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
p.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
|
+
p.listenerCount = function(t, e) {
|
|
1058
1058
|
return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ot.call(t, e);
|
|
1059
1059
|
};
|
|
1060
|
-
|
|
1060
|
+
p.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
|
+
p.prototype.eventNames = function() {
|
|
1073
1073
|
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
1074
1074
|
};
|
|
1075
1075
|
function Lr(t, e) {
|
|
@@ -1565,9 +1565,9 @@ function Zr(t) {
|
|
|
1565
1565
|
function Xr(t) {
|
|
1566
1566
|
this.charReceived = t.length % 3, this.charLength = this.charReceived ? 3 : 0;
|
|
1567
1567
|
}
|
|
1568
|
-
|
|
1568
|
+
R.ReadableState = Bt;
|
|
1569
1569
|
var b = kr("stream");
|
|
1570
|
-
oe(
|
|
1570
|
+
oe(R, p);
|
|
1571
1571
|
function Kr(t, e, r) {
|
|
1572
1572
|
if (typeof t.prependListener == "function")
|
|
1573
1573
|
return t.prependListener(e, r);
|
|
@@ -1581,19 +1581,19 @@ function Bt(t, e) {
|
|
|
1581
1581
|
var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
|
|
1582
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
|
-
function
|
|
1585
|
-
if (!(this instanceof
|
|
1586
|
-
this._readableState = new Bt(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read),
|
|
1584
|
+
function R(t) {
|
|
1585
|
+
if (!(this instanceof R)) return new R(t);
|
|
1586
|
+
this._readableState = new Bt(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), p.call(this);
|
|
1587
1587
|
}
|
|
1588
|
-
|
|
1588
|
+
R.prototype.push = function(t, e) {
|
|
1589
1589
|
var r = this._readableState;
|
|
1590
1590
|
return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t = a.from(t, e), e = "")), Ut(this, r, t, e, !1);
|
|
1591
1591
|
};
|
|
1592
|
-
|
|
1592
|
+
R.prototype.unshift = function(t) {
|
|
1593
1593
|
var e = this._readableState;
|
|
1594
1594
|
return Ut(this, e, t, "", !0);
|
|
1595
1595
|
};
|
|
1596
|
-
|
|
1596
|
+
R.prototype.isPaused = function() {
|
|
1597
1597
|
return this._readableState.flowing === !1;
|
|
1598
1598
|
};
|
|
1599
1599
|
function Ut(t, e, r, n, i) {
|
|
@@ -1619,7 +1619,7 @@ function Ut(t, e, r, n, i) {
|
|
|
1619
1619
|
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
1623
|
return this._readableState.decoder = new le(t), this._readableState.encoding = t, this;
|
|
1624
1624
|
};
|
|
1625
1625
|
var Ke = 8388608;
|
|
@@ -1629,7 +1629,7 @@ function rn(t) {
|
|
|
1629
1629
|
function et(t, e) {
|
|
1630
1630
|
return t <= 0 || e.length === 0 && e.ended ? 0 : e.objectMode ? 1 : t !== t ? e.flowing && e.length ? e.buffer.head.data.length : e.length : (t > e.highWaterMark && (e.highWaterMark = rn(t)), t <= e.length ? t : e.ended ? e.length : (e.needReadable = !0, 0));
|
|
1631
1631
|
}
|
|
1632
|
-
|
|
1632
|
+
R.prototype.read = function(t) {
|
|
1633
1633
|
b("read", t), t = parseInt(t, 10);
|
|
1634
1634
|
var e = this._readableState, r = t;
|
|
1635
1635
|
if (t !== 0 && (e.emittedReadable = !1), t === 0 && e.needReadable && (e.length >= e.highWaterMark || e.ended))
|
|
@@ -1669,10 +1669,10 @@ function fn(t, e) {
|
|
|
1669
1669
|
r = e.length;
|
|
1670
1670
|
e.readingMore = !1;
|
|
1671
1671
|
}
|
|
1672
|
-
|
|
1672
|
+
R.prototype._read = function(t) {
|
|
1673
1673
|
this.emit("error", new Error("not implemented"));
|
|
1674
1674
|
};
|
|
1675
|
-
|
|
1675
|
+
R.prototype.pipe = function(t, e) {
|
|
1676
1676
|
var r = this, n = this._readableState;
|
|
1677
1677
|
switch (n.pipesCount) {
|
|
1678
1678
|
case 0:
|
|
@@ -1688,8 +1688,8 @@ S.prototype.pipe = function(t, e) {
|
|
|
1688
1688
|
n.pipesCount += 1, b("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1689
1689
|
var i = !e || e.end !== !1, o = i ? f : h;
|
|
1690
1690
|
n.endEmitted ? B(o) : r.once("end", o), t.on("unpipe", s);
|
|
1691
|
-
function s(
|
|
1692
|
-
b("onunpipe"),
|
|
1691
|
+
function s(S) {
|
|
1692
|
+
b("onunpipe"), S === r && h();
|
|
1693
1693
|
}
|
|
1694
1694
|
function f() {
|
|
1695
1695
|
b("onend"), t.end();
|
|
@@ -1698,28 +1698,28 @@ S.prototype.pipe = function(t, e) {
|
|
|
1698
1698
|
t.on("drain", u);
|
|
1699
1699
|
var l = !1;
|
|
1700
1700
|
function h() {
|
|
1701
|
-
b("cleanup"), t.removeListener("close",
|
|
1701
|
+
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain", u), t.removeListener("error", w), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", m), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && u();
|
|
1702
1702
|
}
|
|
1703
1703
|
var c = !1;
|
|
1704
1704
|
r.on("data", m);
|
|
1705
|
-
function m(
|
|
1705
|
+
function m(S) {
|
|
1706
1706
|
b("ondata"), c = !1;
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1707
|
+
var g = t.write(S);
|
|
1708
|
+
g === !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
|
-
function w(
|
|
1711
|
-
b("onerror",
|
|
1710
|
+
function w(S) {
|
|
1711
|
+
b("onerror", S), x(), t.removeListener("error", w), en(t, "error") === 0 && t.emit("error", S);
|
|
1712
1712
|
}
|
|
1713
1713
|
Kr(t, "error", w);
|
|
1714
|
-
function
|
|
1715
|
-
t.removeListener("finish",
|
|
1714
|
+
function O() {
|
|
1715
|
+
t.removeListener("finish", E), x();
|
|
1716
1716
|
}
|
|
1717
|
-
t.once("close",
|
|
1718
|
-
function
|
|
1719
|
-
b("onfinish"), t.removeListener("close",
|
|
1717
|
+
t.once("close", O);
|
|
1718
|
+
function E() {
|
|
1719
|
+
b("onfinish"), t.removeListener("close", O), x();
|
|
1720
1720
|
}
|
|
1721
|
-
t.once("finish",
|
|
1722
|
-
function
|
|
1721
|
+
t.once("finish", E);
|
|
1722
|
+
function x() {
|
|
1723
1723
|
b("unpipe"), r.unpipe(t);
|
|
1724
1724
|
}
|
|
1725
1725
|
return t.emit("pipe", r), n.flowing || (b("pipe resume"), r.resume()), t;
|
|
@@ -1730,7 +1730,7 @@ function an(t) {
|
|
|
1730
1730
|
b("pipeOnDrain", e.awaitDrain), e.awaitDrain && e.awaitDrain--, e.awaitDrain === 0 && t.listeners("data").length && (e.flowing = !0, Ye(t));
|
|
1731
1731
|
};
|
|
1732
1732
|
}
|
|
1733
|
-
|
|
1733
|
+
R.prototype.unpipe = function(t) {
|
|
1734
1734
|
var e = this._readableState;
|
|
1735
1735
|
if (e.pipesCount === 0) return this;
|
|
1736
1736
|
if (e.pipesCount === 1)
|
|
@@ -1745,8 +1745,8 @@ S.prototype.unpipe = function(t) {
|
|
|
1745
1745
|
var o = Pt(e.pipes, 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
|
-
|
|
1749
|
-
var r =
|
|
1748
|
+
R.prototype.on = function(t, e) {
|
|
1749
|
+
var r = p.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") {
|
|
@@ -1755,11 +1755,11 @@ S.prototype.on = function(t, e) {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
return r;
|
|
1757
1757
|
};
|
|
1758
|
-
|
|
1758
|
+
R.prototype.addListener = R.prototype.on;
|
|
1759
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
1764
|
return t.flowing || (b("resume"), t.flowing = !0, ln(this, t)), this;
|
|
1765
1765
|
};
|
|
@@ -1769,7 +1769,7 @@ function ln(t, e) {
|
|
|
1769
1769
|
function hn(t, e) {
|
|
1770
1770
|
e.reading || (b("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), Ye(t), e.flowing && !e.reading && t.read(0);
|
|
1771
1771
|
}
|
|
1772
|
-
|
|
1772
|
+
R.prototype.pause = function() {
|
|
1773
1773
|
return b("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (b("pause"), this._readableState.flowing = !1, this.emit("pause")), this;
|
|
1774
1774
|
};
|
|
1775
1775
|
function Ye(t) {
|
|
@@ -1777,7 +1777,7 @@ function Ye(t) {
|
|
|
1777
1777
|
for (b("flow", e.flowing); e.flowing && t.read() !== null; )
|
|
1778
1778
|
;
|
|
1779
1779
|
}
|
|
1780
|
-
|
|
1780
|
+
R.prototype.wrap = function(t) {
|
|
1781
1781
|
var e = this._readableState, r = !1, n = this;
|
|
1782
1782
|
t.on("end", function() {
|
|
1783
1783
|
if (b("wrapped end"), e.decoder && !e.ended) {
|
|
@@ -1804,7 +1804,7 @@ S.prototype.wrap = function(t) {
|
|
|
1804
1804
|
b("wrapped _read", s), r && (r = !1, t.resume());
|
|
1805
1805
|
}, n;
|
|
1806
1806
|
};
|
|
1807
|
-
|
|
1807
|
+
R._fromList = kt;
|
|
1808
1808
|
function kt(t, e) {
|
|
1809
1809
|
if (e.length === 0) return null;
|
|
1810
1810
|
var r;
|
|
@@ -1856,7 +1856,7 @@ function Pt(t, e) {
|
|
|
1856
1856
|
return -1;
|
|
1857
1857
|
}
|
|
1858
1858
|
T.WritableState = We;
|
|
1859
|
-
oe(T,
|
|
1859
|
+
oe(T, p);
|
|
1860
1860
|
function _n() {
|
|
1861
1861
|
}
|
|
1862
1862
|
function wn(t, e, r) {
|
|
@@ -1882,7 +1882,7 @@ We.prototype.getBuffer = function() {
|
|
|
1882
1882
|
};
|
|
1883
1883
|
function T(t) {
|
|
1884
1884
|
if (!(this instanceof T) && !(this instanceof M)) return new T(t);
|
|
1885
|
-
this._writableState = new We(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 We(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)), p.call(this);
|
|
1886
1886
|
}
|
|
1887
1887
|
T.prototype.pipe = function() {
|
|
1888
1888
|
this.emit("error", new Error("Cannot pipe, not readable"));
|
|
@@ -2000,7 +2000,7 @@ function zt(t) {
|
|
|
2000
2000
|
t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e;
|
|
2001
2001
|
};
|
|
2002
2002
|
}
|
|
2003
|
-
oe(M,
|
|
2003
|
+
oe(M, R);
|
|
2004
2004
|
var it = Object.keys(T.prototype);
|
|
2005
2005
|
for (var Fe = 0; Fe < it.length; Fe++) {
|
|
2006
2006
|
var Me = it[Fe];
|
|
@@ -2008,7 +2008,7 @@ for (var Fe = 0; Fe < it.length; Fe++) {
|
|
|
2008
2008
|
}
|
|
2009
2009
|
function M(t) {
|
|
2010
2010
|
if (!(this instanceof M)) return new M(t);
|
|
2011
|
-
|
|
2011
|
+
R.call(this, t), T.call(this, t), t && t.readable === !1 && (this.readable = !1), t && t.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, t && t.allowHalfOpen === !1 && (this.allowHalfOpen = !1), this.once("end", Cn);
|
|
2012
2012
|
}
|
|
2013
2013
|
function Cn() {
|
|
2014
2014
|
this.allowHalfOpen || this._writableState.ended || B(An, this);
|
|
@@ -2073,15 +2073,15 @@ function fe(t) {
|
|
|
2073
2073
|
fe.prototype._transform = function(t, e, r) {
|
|
2074
2074
|
r(null, t);
|
|
2075
2075
|
};
|
|
2076
|
-
oe(V,
|
|
2077
|
-
V.Readable =
|
|
2076
|
+
oe(V, p);
|
|
2077
|
+
V.Readable = R;
|
|
2078
2078
|
V.Writable = T;
|
|
2079
2079
|
V.Duplex = M;
|
|
2080
2080
|
V.Transform = k;
|
|
2081
2081
|
V.PassThrough = fe;
|
|
2082
2082
|
V.Stream = V;
|
|
2083
2083
|
function V() {
|
|
2084
|
-
|
|
2084
|
+
p.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 u(h) {
|
|
2104
|
-
if (l(),
|
|
2104
|
+
if (l(), p.listenerCount(this, "error") === 0)
|
|
2105
2105
|
throw h;
|
|
2106
2106
|
}
|
|
2107
2107
|
r.on("error", u), t.on("error", u);
|
|
@@ -2692,11 +2692,11 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2692
2692
|
ltrim: c,
|
|
2693
2693
|
max_record_size: m,
|
|
2694
2694
|
raw: w,
|
|
2695
|
-
relax_quotes:
|
|
2696
|
-
rtrim:
|
|
2697
|
-
skip_empty_lines:
|
|
2698
|
-
to:
|
|
2699
|
-
to_line:
|
|
2695
|
+
relax_quotes: O,
|
|
2696
|
+
rtrim: E,
|
|
2697
|
+
skip_empty_lines: x,
|
|
2698
|
+
to: S,
|
|
2699
|
+
to_line: g
|
|
2700
2700
|
} = this.options;
|
|
2701
2701
|
let { comment: y, escape: L, quote: U, record_delimiter: Re } = this.options;
|
|
2702
2702
|
const { bomSkipped: Yt, previousBuf: he, rawBuffer: Wt, escapeIsQuote: Ht } = this.state;
|
|
@@ -2717,16 +2717,16 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2717
2717
|
return;
|
|
2718
2718
|
}
|
|
2719
2719
|
} else {
|
|
2720
|
-
for (const
|
|
2721
|
-
if (re[
|
|
2722
|
-
const J = re[
|
|
2720
|
+
for (const I in re)
|
|
2721
|
+
if (re[I].compare(v, 0, re[I].length) === 0) {
|
|
2722
|
+
const J = re[I].length;
|
|
2723
2723
|
this.state.bufBytesStart += J, v = v.slice(J);
|
|
2724
2724
|
const ce = ft({
|
|
2725
2725
|
...this.original_options,
|
|
2726
|
-
encoding:
|
|
2726
|
+
encoding: I
|
|
2727
2727
|
});
|
|
2728
|
-
for (const
|
|
2729
|
-
this.options[
|
|
2728
|
+
for (const C in ce)
|
|
2729
|
+
this.options[C] = ce[C];
|
|
2730
2730
|
({ comment: y, escape: L, quote: U } = this.options);
|
|
2731
2731
|
break;
|
|
2732
2732
|
}
|
|
@@ -2735,7 +2735,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2735
2735
|
const Ie = v.length;
|
|
2736
2736
|
let d;
|
|
2737
2737
|
for (d = 0; d < Ie && !this.__needMoreData(d, Ie, i); d++) {
|
|
2738
|
-
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1),
|
|
2738
|
+
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), g !== -1 && this.info.lines > g) {
|
|
2739
2739
|
this.state.stop = !0, s();
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
@@ -2743,11 +2743,11 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2743
2743
|
v,
|
|
2744
2744
|
d
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
|
-
const
|
|
2747
|
-
if (w === !0 && Wt.append(
|
|
2746
|
+
const I = v[d];
|
|
2747
|
+
if (w === !0 && Wt.append(I), (I === Pn || I === $n) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (L !== null && this.state.quoting === !0 && this.__isEscape(v, d,
|
|
2750
|
+
if (L !== null && this.state.quoting === !0 && this.__isEscape(v, d, I) && d + L.length < Ie)
|
|
2751
2751
|
if (Ht) {
|
|
2752
2752
|
if (this.__isQuote(v, d + L.length)) {
|
|
2753
2753
|
this.state.escaping = !0, d += L.length - 1;
|
|
@@ -2759,23 +2759,23 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
if (this.state.commenting === !1 && this.__isQuote(v, d))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const
|
|
2762
|
+
const C = v[d + U.length], Z = E && this.__isCharTrimable(v, d + U.length), j = y !== null && this.__compareBytes(y, v, d + U.length, C), X = this.__isDelimiter(
|
|
2763
2763
|
v,
|
|
2764
2764
|
d + U.length,
|
|
2765
|
-
|
|
2766
|
-
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(v, d + U.length) : this.__isRecordDelimiter(
|
|
2767
|
-
if (L !== null && this.__isEscape(v, d,
|
|
2765
|
+
C
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(v, d + U.length) : this.__isRecordDelimiter(C, v, d + U.length);
|
|
2767
|
+
if (L !== null && this.__isEscape(v, d, I) && this.__isQuote(v, d + L.length))
|
|
2768
2768
|
d += L.length - 1;
|
|
2769
|
-
else if (!
|
|
2769
|
+
else if (!C || X || de || j || Z) {
|
|
2770
2770
|
this.state.quoting = !1, this.state.wasQuoting = !0, d += U.length - 1;
|
|
2771
2771
|
continue;
|
|
2772
|
-
} else if (
|
|
2772
|
+
} else if (O === !1) {
|
|
2773
2773
|
const He = this.__error(
|
|
2774
2774
|
new _(
|
|
2775
2775
|
"CSV_INVALID_CLOSING_QUOTE",
|
|
2776
2776
|
[
|
|
2777
2777
|
"Invalid Closing Quote:",
|
|
2778
|
-
`got "${String.fromCharCode(
|
|
2778
|
+
`got "${String.fromCharCode(C)}"`,
|
|
2779
2779
|
`at line ${this.info.lines}`,
|
|
2780
2780
|
"instead of delimiter, record delimiter, trimable character",
|
|
2781
2781
|
"(if activated) or comment"
|
|
@@ -2788,19 +2788,19 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2788
2788
|
} else
|
|
2789
2789
|
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U), d += U.length - 1;
|
|
2790
2790
|
} else if (this.state.field.length !== 0) {
|
|
2791
|
-
if (
|
|
2792
|
-
const
|
|
2791
|
+
if (O === !1) {
|
|
2792
|
+
const C = this.__infoField(), Z = Object.keys(re).map(
|
|
2793
2793
|
(X) => re[X].equals(this.state.field.toString()) ? X : !1
|
|
2794
2794
|
).filter(Boolean)[0], j = this.__error(
|
|
2795
2795
|
new _(
|
|
2796
2796
|
"INVALID_OPENING_QUOTE",
|
|
2797
2797
|
[
|
|
2798
2798
|
"Invalid Opening Quote:",
|
|
2799
|
-
`a quote is found on field ${JSON.stringify(
|
|
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,
|
|
2803
|
-
|
|
2803
|
+
C,
|
|
2804
2804
|
{
|
|
2805
2805
|
field: this.state.field
|
|
2806
2806
|
}
|
|
@@ -2813,44 +2813,44 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2813
2813
|
continue;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
|
-
const
|
|
2817
|
-
|
|
2816
|
+
const C = this.__isRecordDelimiter(
|
|
2817
|
+
I,
|
|
2818
2818
|
v,
|
|
2819
2819
|
d
|
|
2820
2820
|
);
|
|
2821
|
-
if (
|
|
2821
|
+
if (C !== 0) {
|
|
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
2825
|
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= h) {
|
|
2826
|
-
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d +=
|
|
2826
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += C - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
2829
|
-
if (
|
|
2830
|
-
this.info.empty_lines++, d +=
|
|
2829
|
+
if (x === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2830
|
+
this.info.empty_lines++, d += C - 1;
|
|
2831
2831
|
continue;
|
|
2832
2832
|
}
|
|
2833
2833
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2834
2834
|
const X = this.__onField();
|
|
2835
2835
|
if (X !== void 0) return X;
|
|
2836
|
-
this.info.bytes = this.state.bufBytesStart + d +
|
|
2836
|
+
this.info.bytes = this.state.bufBytesStart + d + C;
|
|
2837
2837
|
const de = this.__onRecord(o);
|
|
2838
2838
|
if (de !== void 0) return de;
|
|
2839
|
-
if (
|
|
2839
|
+
if (S !== -1 && this.info.records >= S) {
|
|
2840
2840
|
this.state.stop = !0, s();
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
-
this.state.commenting = !1, d +=
|
|
2844
|
+
this.state.commenting = !1, d += C - 1;
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (y !== null && (u === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(y, v, d,
|
|
2849
|
+
if (y !== null && (u === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(y, v, d, I) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const Z = this.__isDelimiter(v, d,
|
|
2853
|
+
const Z = this.__isDelimiter(v, d, I);
|
|
2854
2854
|
if (Z !== 0) {
|
|
2855
2855
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2856
2856
|
const j = this.__onField();
|
|
@@ -2874,11 +2874,11 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(v, d), ce =
|
|
2877
|
+
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(v, d), ce = E === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && ce === !0)
|
|
2879
|
-
this.state.field.append(
|
|
2879
|
+
this.state.field.append(I);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (
|
|
2881
|
+
if (E === !0 && !this.__isCharTrimable(v, d))
|
|
2882
2882
|
return this.__error(
|
|
2883
2883
|
new _(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
@@ -2897,7 +2897,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2897
2897
|
}
|
|
2898
2898
|
if (i === !0)
|
|
2899
2899
|
if (this.state.quoting === !0) {
|
|
2900
|
-
const
|
|
2900
|
+
const I = this.__error(
|
|
2901
2901
|
new _(
|
|
2902
2902
|
"CSV_QUOTE_NOT_CLOSED",
|
|
2903
2903
|
[
|
|
@@ -2908,11 +2908,11 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2908
2908
|
this.__infoField()
|
|
2909
2909
|
)
|
|
2910
2910
|
);
|
|
2911
|
-
if (
|
|
2911
|
+
if (I !== void 0) return I;
|
|
2912
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2913
2913
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2914
|
-
const
|
|
2915
|
-
if (
|
|
2914
|
+
const I = this.__onField();
|
|
2915
|
+
if (I !== void 0) return I;
|
|
2916
2916
|
const J = this.__onRecord(o);
|
|
2917
2917
|
if (J !== void 0) return J;
|
|
2918
2918
|
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
@@ -2932,29 +2932,29 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2932
2932
|
relax_column_count_more: c,
|
|
2933
2933
|
raw: m,
|
|
2934
2934
|
skip_records_with_empty_values: w
|
|
2935
|
-
} = this.options, { enabled:
|
|
2936
|
-
if (
|
|
2935
|
+
} = this.options, { enabled: O, record: E } = this.state;
|
|
2936
|
+
if (O === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
|
-
const
|
|
2938
|
+
const x = E.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (w === !0 && at(
|
|
2940
|
+
if (w === !0 && at(E)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
|
-
return this.__firstLineToColumns(
|
|
2944
|
+
return this.__firstLineToColumns(E);
|
|
2945
2945
|
}
|
|
2946
|
-
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength =
|
|
2947
|
-
const
|
|
2946
|
+
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = x), x !== this.state.expectedRecordLength) {
|
|
2947
|
+
const S = i === !1 ? new _(
|
|
2948
2948
|
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
2949
2949
|
[
|
|
2950
2950
|
"Invalid Record Length:",
|
|
2951
2951
|
`expect ${this.state.expectedRecordLength},`,
|
|
2952
|
-
`got ${
|
|
2952
|
+
`got ${x} on line ${this.info.lines}`
|
|
2953
2953
|
],
|
|
2954
2954
|
this.options,
|
|
2955
2955
|
this.__infoField(),
|
|
2956
2956
|
{
|
|
2957
|
-
record:
|
|
2957
|
+
record: E
|
|
2958
2958
|
}
|
|
2959
2959
|
) : new _(
|
|
2960
2960
|
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
@@ -2962,22 +2962,22 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2962
2962
|
"Invalid Record Length:",
|
|
2963
2963
|
`columns length is ${i.length},`,
|
|
2964
2964
|
// rename columns
|
|
2965
|
-
`got ${
|
|
2965
|
+
`got ${x} on line ${this.info.lines}`
|
|
2966
2966
|
],
|
|
2967
2967
|
this.options,
|
|
2968
2968
|
this.__infoField(),
|
|
2969
2969
|
{
|
|
2970
|
-
record:
|
|
2970
|
+
record: E
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (l === !0 || h === !0 &&
|
|
2974
|
-
this.info.invalid_field_length++, this.state.error =
|
|
2973
|
+
if (l === !0 || h === !0 && x < this.state.expectedRecordLength || c === !0 && x > this.state.expectedRecordLength)
|
|
2974
|
+
this.info.invalid_field_length++, this.state.error = S;
|
|
2975
2975
|
else {
|
|
2976
|
-
const
|
|
2977
|
-
if (
|
|
2976
|
+
const g = this.__error(S);
|
|
2977
|
+
if (g) return g;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (w === !0 && at(
|
|
2980
|
+
if (w === !0 && at(E)) {
|
|
2981
2981
|
this.__resetRecord();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
@@ -2986,48 +2986,48 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2986
2986
|
return;
|
|
2987
2987
|
}
|
|
2988
2988
|
if (this.info.records++, u === 1 || this.info.records >= u) {
|
|
2989
|
-
const { objname:
|
|
2989
|
+
const { objname: S } = this.options;
|
|
2990
2990
|
if (i !== !1) {
|
|
2991
|
-
const
|
|
2992
|
-
for (let y = 0, L =
|
|
2993
|
-
i[y] === void 0 || i[y].disabled || (o === !0 &&
|
|
2991
|
+
const g = {};
|
|
2992
|
+
for (let y = 0, L = E.length; y < L; y++)
|
|
2993
|
+
i[y] === void 0 || i[y].disabled || (o === !0 && g[i[y].name] !== void 0 ? Array.isArray(g[i[y].name]) ? g[i[y].name] = g[i[y].name].concat(E[y]) : g[i[y].name] = [g[i[y].name], E[y]] : g[i[y].name] = E[y]);
|
|
2994
2994
|
if (m === !0 || f === !0) {
|
|
2995
2995
|
const y = Object.assign(
|
|
2996
|
-
{ record:
|
|
2996
|
+
{ record: g },
|
|
2997
2997
|
m === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), L = this.__push(
|
|
3000
|
-
|
|
3000
|
+
S === void 0 ? y : [g[S], y],
|
|
3001
3001
|
n
|
|
3002
3002
|
);
|
|
3003
3003
|
if (L)
|
|
3004
3004
|
return L;
|
|
3005
3005
|
} else {
|
|
3006
3006
|
const y = this.__push(
|
|
3007
|
-
|
|
3007
|
+
S === void 0 ? g : [g[S], g],
|
|
3008
3008
|
n
|
|
3009
3009
|
);
|
|
3010
3010
|
if (y)
|
|
3011
3011
|
return y;
|
|
3012
3012
|
}
|
|
3013
3013
|
} else if (m === !0 || f === !0) {
|
|
3014
|
-
const
|
|
3015
|
-
{ record:
|
|
3014
|
+
const g = Object.assign(
|
|
3015
|
+
{ record: E },
|
|
3016
3016
|
m === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
3018
|
), y = this.__push(
|
|
3019
|
-
|
|
3019
|
+
S === void 0 ? g : [E[S], g],
|
|
3020
3020
|
n
|
|
3021
3021
|
);
|
|
3022
3022
|
if (y)
|
|
3023
3023
|
return y;
|
|
3024
3024
|
} else {
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3025
|
+
const g = this.__push(
|
|
3026
|
+
S === void 0 ? E : [E[S], E],
|
|
3027
3027
|
n
|
|
3028
3028
|
);
|
|
3029
|
-
if (
|
|
3030
|
-
return
|
|
3029
|
+
if (g)
|
|
3030
|
+
return g;
|
|
3031
3031
|
}
|
|
3032
3032
|
}
|
|
3033
3033
|
this.__resetRecord();
|
|
@@ -3380,46 +3380,45 @@ class Gn {
|
|
|
3380
3380
|
return ut(e);
|
|
3381
3381
|
}
|
|
3382
3382
|
/** Parse stream. */
|
|
3383
|
-
async parseStream(e, r, n, i) {
|
|
3384
|
-
return new Promise((
|
|
3385
|
-
let
|
|
3386
|
-
const
|
|
3387
|
-
if (
|
|
3388
|
-
|
|
3389
|
-
const
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
}),
|
|
3393
|
-
},
|
|
3394
|
-
|
|
3383
|
+
async parseStream(e, r, n, i, o) {
|
|
3384
|
+
return new Promise((s, f) => {
|
|
3385
|
+
let u, l, h, c = !1, m = !1;
|
|
3386
|
+
const w = () => {
|
|
3387
|
+
if (m) return;
|
|
3388
|
+
m = !0;
|
|
3389
|
+
const x = u;
|
|
3390
|
+
u = void 0, h = void 0, x != null && (this.ignoreErrors(() => x.removeAllListeners()), this.ignoreErrors(() => x.end())), this.ignoreErrors(() => {
|
|
3391
|
+
l?.cancel();
|
|
3392
|
+
}), l = void 0;
|
|
3393
|
+
}, O = (x) => {
|
|
3394
|
+
c || (c = !0, w(), i.signal.aborted || i.abort(x), f(x));
|
|
3395
3395
|
};
|
|
3396
|
-
i.signal.addEventListener("abort",
|
|
3397
|
-
|
|
3398
|
-
}, chunkSize: r.chunkSize ?? Qn }), f.on("readable", () => {
|
|
3396
|
+
i.signal.addEventListener("abort", w, { once: !0 }), (async () => {
|
|
3397
|
+
u = ut(e), h = this.constructRowBuffer({ chunk: o, chunkSize: r.chunkSize ?? Qn }), u.on("readable", () => {
|
|
3399
3398
|
try {
|
|
3400
|
-
if (
|
|
3401
|
-
let
|
|
3402
|
-
for (; (
|
|
3403
|
-
if (
|
|
3404
|
-
i.signal.throwIfAborted(),
|
|
3399
|
+
if (u == null || h == null) return;
|
|
3400
|
+
let g;
|
|
3401
|
+
for (; (g = u.read()) != null; ) {
|
|
3402
|
+
if (c) return;
|
|
3403
|
+
i.signal.throwIfAborted(), h.push(g);
|
|
3405
3404
|
}
|
|
3406
|
-
} catch (
|
|
3407
|
-
|
|
3405
|
+
} catch (g) {
|
|
3406
|
+
O(g);
|
|
3408
3407
|
}
|
|
3409
|
-
}),
|
|
3410
|
-
|
|
3408
|
+
}), u.on("error", (g) => O(g)), u.on("end", () => {
|
|
3409
|
+
c || (h?.flush(), s(this.constructSummary(u)));
|
|
3411
3410
|
});
|
|
3412
|
-
const
|
|
3413
|
-
if (!
|
|
3414
|
-
throw await Yn(
|
|
3415
|
-
|
|
3416
|
-
let
|
|
3417
|
-
for (; !
|
|
3418
|
-
if (
|
|
3419
|
-
i.signal.throwIfAborted(),
|
|
3411
|
+
const x = await fetch(encodeURI(n), { signal: i.signal });
|
|
3412
|
+
if (!x.ok || x.body == null)
|
|
3413
|
+
throw await Yn(x, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
|
|
3414
|
+
l = x.body.pipeThrough(new TextDecoderStream(r.encodingId)).getReader();
|
|
3415
|
+
let S = await l.read();
|
|
3416
|
+
for (; !S.done; ) {
|
|
3417
|
+
if (c) return;
|
|
3418
|
+
i.signal.throwIfAborted(), u.write(S.value), S = await l.read();
|
|
3420
3419
|
}
|
|
3421
|
-
|
|
3422
|
-
})().catch((
|
|
3420
|
+
c || u.end();
|
|
3421
|
+
})().catch((x) => O(x));
|
|
3423
3422
|
});
|
|
3424
3423
|
}
|
|
3425
3424
|
/** Parse string. */
|
|
@@ -5,7 +5,7 @@ declare class Tool {
|
|
|
5
5
|
/** Build parser. */
|
|
6
6
|
buildParser(options: ParseOptions): Parser;
|
|
7
7
|
/** Parse stream. */
|
|
8
|
-
parseStream(parseOptions: ParseOptions, retrieveRecordsOptions: RetrieveRecordsOptions, url: string, abortController: AbortController): Promise<RetrieveRecordsSummary>;
|
|
8
|
+
parseStream(parseOptions: ParseOptions, retrieveRecordsOptions: RetrieveRecordsOptions, url: string, abortController: AbortController, chunk: (records: (string[] | Record<string, unknown>)[]) => void): Promise<RetrieveRecordsSummary>;
|
|
9
9
|
/** Parse string. */
|
|
10
10
|
parseString(): void;
|
|
11
11
|
/** Construct row buffer. */
|