@dpuse/dpuse-tool-adaltas-csv-parser 1.0.125 → 1.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,10 +85,10 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
85
85
 
86
86
  | Chunk/Module/File | Composition |
87
87
  | :-------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- |
88
- | **dist/dpuse-tool-adaltas-csv-parser.es.js** | 126.7 kB · gzip 31.8 kB · 100.0% of the build |
89
- |     csv-parse → dist/esm/index.js | `████████████████░░░░` 78.3% · 99.2 kB |
88
+ | **dist/dpuse-tool-adaltas-csv-parser.es.js** | 126.8 kB · gzip 31.8 kB · 100.0% of the build |
89
+ |     csv-parse → dist/esm/index.js | `████████████████░░░░` 78.2% · 99.2 kB |
90
90
  |     @dpuse/dpuse-shared → dist/dpuse-shared.es.js | `███░░░░░░░░░░░░░░░░░` 12.5% · 15.9 kB |
91
- |     src → index.ts | `█░░░░░░░░░░░░░░░░░░░` 3.3% · 4.2 kB |
91
+ |     src → index.ts | `█░░░░░░░░░░░░░░░░░░░` 3.5% · 4.4 kB |
92
92
  |     (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 5.8% · 7.4 kB |
93
93
 
94
94
  Bars show each row's share of its output file.
@@ -3507,7 +3507,7 @@ var Lr = {
3507
3507
  skip_records_with_error: !1,
3508
3508
  to_line: -1,
3509
3509
  trim: !1
3510
- }, Rr = 4, zr = 50, Br = 1e4, Vr = class {
3510
+ }, Rr = 4, zr = 1048576, Br = 50, Vr = 1e4, Hr = class {
3511
3511
  async parseStream(e, t, n) {
3512
3512
  return new Promise((r, i) => {
3513
3513
  let a, o, s, c = !1, l = !1, u = () => {
@@ -3530,9 +3530,9 @@ var Lr = {
3530
3530
  delimiter: t.valueDelimiterId,
3531
3531
  relax_column_count: !0
3532
3532
  });
3533
- let i = Ur({
3533
+ let i = Gr({
3534
3534
  chunk: n,
3535
- chunkSize: t.chunkSize ?? Br
3535
+ chunkSize: t.chunkSize ?? Vr
3536
3536
  });
3537
3537
  s = i, a.on("readable", () => {
3538
3538
  try {
@@ -3556,14 +3556,12 @@ var Lr = {
3556
3556
  }
3557
3557
  };
3558
3558
  a.on("end", () => {
3559
- c || (i.flush(), l(Wr(a)));
3559
+ c || (i.flush(), l(Kr(a)));
3560
3560
  }), o = e.getReader();
3561
3561
  let u = new TextDecoder(Ir(t.encodingId)), f = 0, p = !1, m = await o.read();
3562
3562
  for (; !m.done;) {
3563
3563
  if (c) return;
3564
- t.abortSignal.throwIfAborted(), f += m.value.length;
3565
- let e = u.decode(m.value, { stream: !0 });
3566
- e.length > 0 && (p = !0, a.write(e) || await Hr(a)), await i.drain(), m = await o.read();
3564
+ t.abortSignal.throwIfAborted(), f += m.value.length, await Ur(a, u, m.value, i) > 0 && (p = !0), m = await o.read();
3567
3565
  }
3568
3566
  if (c) return;
3569
3567
  let h = u.decode();
@@ -3581,17 +3579,25 @@ var Lr = {
3581
3579
  });
3582
3580
  }
3583
3581
  async parseText(e, t) {
3584
- return await Or(e, t, Gr);
3582
+ return await Or(e, t, qr);
3585
3583
  }
3586
3584
  };
3587
- function Hr(e) {
3585
+ async function Ur(e, t, n, r) {
3586
+ let i = 0;
3587
+ for (let a = 0; a < n.length; a += zr) {
3588
+ let o = t.decode(n.subarray(a, a + zr), { stream: !0 });
3589
+ o.length > 0 && (i += o.length, e.write(o) || await Wr(e)), await r.drain();
3590
+ }
3591
+ return i;
3592
+ }
3593
+ function Wr(e) {
3588
3594
  return new Promise((t) => {
3589
3595
  e.once("drain", () => {
3590
3596
  t();
3591
3597
  });
3592
3598
  });
3593
3599
  }
3594
- function Ur(e) {
3600
+ function Gr(e) {
3595
3601
  let t = Math.max(1, Math.floor(e.chunkSize)), n = [], r = [], i = s(), a = 0, o = () => {
3596
3602
  if (a === 0) return;
3597
3603
  let t = i;
@@ -3615,7 +3621,7 @@ function Ur(e) {
3615
3621
  return r.length = 0, r;
3616
3622
  }
3617
3623
  }
3618
- function Wr(e) {
3624
+ function Kr(e) {
3619
3625
  return {
3620
3626
  byteCount: e?.info.bytes ?? -1,
3621
3627
  commentLineCount: e?.info.comment_lines ?? -1,
@@ -3625,10 +3631,10 @@ function Wr(e) {
3625
3631
  recordCount: e?.info.records ?? -1
3626
3632
  };
3627
3633
  }
3628
- function Gr(e, t, n) {
3634
+ function qr(e, t, n) {
3629
3635
  return new Promise((r) => {
3630
3636
  let i = [], a = [], o = 0, s = (e) => {
3631
- e == null || !n && e.code === "CSV_QUOTE_NOT_CLOSED" || (i.push(Kr(e, o + 1)), e.lines != null && (o = e.lines));
3637
+ e == null || !n && e.code === "CSV_QUOTE_NOT_CLOSED" || (i.push(Jr(e, o + 1)), e.lines != null && (o = e.lines));
3632
3638
  }, c = ar({
3633
3639
  ...Lr,
3634
3640
  cast: (e, t) => ({
@@ -3658,7 +3664,7 @@ function Gr(e, t, n) {
3658
3664
  }), c.write(e), c.end();
3659
3665
  });
3660
3666
  }
3661
- function Kr(e, t) {
3667
+ function Jr(e, t) {
3662
3668
  let n = e.lines, r = e.code === "CSV_INVALID_CLOSING_QUOTE" ? /got "(.*?)" at line/u.exec(e.message)?.[1] : void 0, i = typeof e.field == "string" ? e.field : r;
3663
3669
  return {
3664
3670
  endLineNumber: n != null && n > t ? n : void 0,
@@ -3668,7 +3674,7 @@ function Kr(e, t) {
3668
3674
  message: e.message,
3669
3675
  recordNumber: e.records == null ? void 0 : e.records + 1,
3670
3676
  severityId: "error",
3671
- value: i != null && i.length > zr ? `${i.slice(0, zr)}…` : i
3677
+ value: i != null && i.length > Br ? `${i.slice(0, Br)}…` : i
3672
3678
  };
3673
3679
  }
3674
- export { Vr as Tool };
3680
+ export { Hr as Tool };