@dpuse/dpuse-tool-adaltas-csv-parser 1.0.110 → 1.0.113

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
@@ -61,7 +61,7 @@ License data is updated each time `npm run document` is run, using [license-chec
61
61
 
62
62
  | Dependency | Version | License(s) | Document |
63
63
  | :----------------------------------------------------------- | :-----: | :--------- | :-------------------------------------------------------------------- |
64
- | [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.130 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.130-LICENSE.txt) |
64
+ | [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.132 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.132-LICENSE.txt) |
65
65
  | [csv-parse](https://github.com/adaltas/node-csv) | 7.0.3 | MIT | [LICENSE](licenses/downloads/csv-parse@7.0.3-LICENSE.txt) |
66
66
  | [valibot](https://github.com/open-circle/valibot) | 1.5.0 | MIT | [LICENSE](licenses/downloads/valibot@1.5.0-LICENSE.txt) |
67
67
 
@@ -69,7 +69,7 @@ License data is updated each time `npm run document` is run, using [license-chec
69
69
 
70
70
  The dependency tree below shows how each package in the table above is reached — direct and transitive — along with its installed version, release date, and update status. A package that does not ship itself, such as one whose parts are bundled separately, is left out and what ships beneath it is shown in its place. Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.
71
71
 
72
- - **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.130 — this month: 2026-10-21
72
+ - **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.132 — this month: 2026-10-23
73
73
  - **[valibot](https://github.com/open-circle/valibot)** 1.5.0 — 1 mth ago: 2026-09-09
74
74
  - **[csv-parse](https://github.com/adaltas/node-csv)** 7.0.3 — this month: 2026-09-25
75
75
 
@@ -85,11 +85,11 @@ _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.2 kB · gzip 31.8 kB · 100.0% of the build |
89
- |     csv-parse → dist/esm/index.js | `████████████████░░░░` 78.6% · 99.2 kB |
90
- |     @dpuse/dpuse-shared → dist/dpuse-shared.es.js | `██░░░░░░░░░░░░░░░░░░` 12.4% · 15.7 kB |
91
- |     src → index.ts | `█░░░░░░░░░░░░░░░░░░░` 3.1% · 3.9 kB |
92
- |     (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 5.9% · 7.4 kB |
88
+ | **dist/dpuse-tool-adaltas-csv-parser.es.js** | 125.8 kB · gzip 31.6 kB · 100.0% of the build |
89
+ |     csv-parse → dist/esm/index.js | `████████████████░░░░` 78.9% · 99.2 kB |
90
+ |     @dpuse/dpuse-shared → dist/dpuse-shared.es.js | `██░░░░░░░░░░░░░░░░░░` 12.0% · 15.1 kB |
91
+ |     src → index.ts | `█░░░░░░░░░░░░░░░░░░░` 3.4% · 4.3 kB |
92
+ |     (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 5.7% · 7.2 kB |
93
93
 
94
94
  Bars show each row's share of its output file.
95
95
 
@@ -2900,7 +2900,7 @@ var Tr = {
2900
2900
  status: /* @__PURE__ */ Z(Cr),
2901
2901
  statusId: /* @__PURE__ */ Z(Sr)
2902
2902
  };
2903
- ({ ...Tr }), J({ en: "Data Positioning Events" }), J({ en: "Delimited Text" }), J({ en: "JSON" }), J({ en: "Markdown" }), J({ en: "SPSS" }), J({ en: "Plain Text" }), J({ en: "XLSX" }), J({ en: "XML" }), J({ en: "Newline" }), J({ en: "Carriage Return" }), J({ en: "Carriage Return/Newline" }), J({ en: "Colon" }), J({ en: "Comma" }), J({ en: "Exclamation Mark" }), J({ en: "Record Separator" }), J({ en: "Semicolon" }), J({ en: "Space" }), J({ en: "Tab" }), J({ en: "Underscore" }), J({ en: "Unit Separator" }), J({ en: "Vertical Bar" }), $([
2903
+ ({ ...Tr }), J({ en: "Data Positioning Events" }), J({ en: "Delimited Text" }), J({ en: "JSON" }), J({ en: "JSON Lines" }), J({ en: "Markdown" }), J({ en: "SPSS" }), J({ en: "Plain Text" }), J({ en: "XLSX" }), J({ en: "XML" }), J({ en: "Newline" }), J({ en: "Carriage Return" }), J({ en: "Carriage Return/Newline" }), J({ en: "Colon" }), J({ en: "Comma" }), J({ en: "Exclamation Mark" }), J({ en: "Record Separator" }), J({ en: "Semicolon" }), J({ en: "Space" }), J({ en: "Tab" }), J({ en: "Underscore" }), J({ en: "Unit Separator" }), J({ en: "Vertical Bar" }), $([
2904
2904
  "app",
2905
2905
  "engine",
2906
2906
  "connector",
@@ -3434,87 +3434,6 @@ function Fr(e) {
3434
3434
  function Ir(e) {
3435
3435
  return Fr(e) ? Pr[e].decoderId ?? e : e;
3436
3436
  }
3437
- new Set(Object.values({
3438
- archives: [
3439
- "7z",
3440
- "bz2",
3441
- "gz",
3442
- "rar",
3443
- "tar",
3444
- "tgz",
3445
- "xz",
3446
- "zip"
3447
- ],
3448
- audio: [
3449
- "aac",
3450
- "flac",
3451
- "m4a",
3452
- "mp3",
3453
- "ogg",
3454
- "wav"
3455
- ],
3456
- documents: [
3457
- "doc",
3458
- "docx",
3459
- "key",
3460
- "numbers",
3461
- "odp",
3462
- "odt",
3463
- "pages",
3464
- "pdf",
3465
- "ppt",
3466
- "pptx",
3467
- "rtf"
3468
- ],
3469
- images: [
3470
- "bmp",
3471
- "gif",
3472
- "heic",
3473
- "ico",
3474
- "jpeg",
3475
- "jpg",
3476
- "png",
3477
- "psd",
3478
- "svg",
3479
- "tif",
3480
- "tiff",
3481
- "webp"
3482
- ],
3483
- programs: [
3484
- "app",
3485
- "bin",
3486
- "dll",
3487
- "dmg",
3488
- "exe",
3489
- "iso",
3490
- "msi",
3491
- "so"
3492
- ],
3493
- unreadDataFormats: [
3494
- "arrow",
3495
- "avro",
3496
- "db",
3497
- "ods",
3498
- "parquet",
3499
- "por",
3500
- "sav",
3501
- "sqlite",
3502
- "xls",
3503
- "xlsm",
3504
- "xlsx",
3505
- "xltm",
3506
- "xltx"
3507
- ],
3508
- video: [
3509
- "avi",
3510
- "m4v",
3511
- "mkv",
3512
- "mov",
3513
- "mp4",
3514
- "webm",
3515
- "wmv"
3516
- ]
3517
- }).flat());
3518
3437
  // src/index.ts
3519
3438
  var Lr = {
3520
3439
  bom: !1,
@@ -3603,12 +3522,12 @@ var Lr = {
3603
3522
  });
3604
3523
  });
3605
3524
  }
3606
- async parseText(e, t) {
3607
- let n = Ur(e), { parsedRecords: r, valueDelimiterId: i } = await Wr(e, t);
3525
+ async parseText(e, t, n = !1) {
3526
+ let r = Ur(e), { parsedRecords: i, valueDelimiterId: a } = await Wr(e, t, n);
3608
3527
  return {
3609
- parsedRecords: r,
3610
- recordDelimiterId: n,
3611
- valueDelimiterId: i
3528
+ parsedRecords: i,
3529
+ recordDelimiterId: r,
3530
+ valueDelimiterId: a
3612
3531
  };
3613
3532
  }
3614
3533
  };
@@ -3645,49 +3564,56 @@ function Ur(e) {
3645
3564
  let t = (e.match(/\r\n/g) ?? []).length, n = (e.match(/(?<!\r)\n/g) ?? []).length, r = (e.match(/\r(?!\n)/g) ?? []).length;
3646
3565
  return t >= n && t >= r ? "\r\n" : n >= t && n >= r ? "\n" : r >= t && r >= n ? "\r" : "\n";
3647
3566
  }
3648
- async function Wr(e, t) {
3649
- let n, r, i, a = [];
3650
- for (let o of t) try {
3651
- let t = 0, s, c = 0, l = 0, u = ar({
3567
+ async function Wr(e, t, n) {
3568
+ let r, i, a, o = [], s, c = !1;
3569
+ for (let l of t) {
3570
+ let { error: t, records: u } = await Gr(e, l, n);
3571
+ if (t != null) {
3572
+ s ??= t;
3573
+ continue;
3574
+ }
3575
+ if (c = !0, u.length === 0) continue;
3576
+ let { averageValueCount: d, sumOfValueCountDiffs: f } = Kr(u);
3577
+ (!a || f <= a) && (!i || d > i) && (r = l, i = d, a = f, o = u);
3578
+ }
3579
+ if (!c && s != null) throw s;
3580
+ return {
3581
+ parsedRecords: o,
3582
+ valueDelimiterId: r != null && qr(o) ? r : void 0
3583
+ };
3584
+ }
3585
+ function Gr(e, t, n) {
3586
+ return new Promise((r) => {
3587
+ let i = [], a = ar({
3652
3588
  ...Lr,
3653
3589
  cast: (e, t) => ({
3654
3590
  value: e,
3655
3591
  wasValueQuoted: t.quoting
3656
3592
  }),
3657
- delimiter: o,
3593
+ delimiter: t,
3658
3594
  relax_column_count: !0
3659
3595
  });
3660
- await new Promise((d) => {
3661
- try {
3662
- let f = [];
3663
- u.on("readable", () => {
3664
- let e;
3665
- for (; (e = u.read()) != null;) {
3666
- c++;
3667
- let n = e.length;
3668
- s != null && (l += Math.abs(n - s)), s = n, t += n, f.push(e);
3669
- }
3670
- }), u.on("error", () => {
3671
- d();
3672
- }), u.on("end", () => {
3673
- if (c === 0) {
3674
- d();
3675
- return;
3676
- }
3677
- let e = t / c;
3678
- (!i || l <= i) && (!r || e > r) && (n = o, r = e, i = l, a = [...f]), d();
3679
- }), u.write(e), u.end();
3680
- } catch {
3681
- d();
3682
- }
3683
- });
3684
- } catch {}
3596
+ a.on("data", (e) => {
3597
+ i.push(e);
3598
+ }), a.on("error", (e) => {
3599
+ r(!n && e.code === "CSV_QUOTE_NOT_CLOSED" ? { records: i } : {
3600
+ error: e,
3601
+ records: i
3602
+ });
3603
+ }), a.on("end", () => {
3604
+ r({ records: i });
3605
+ }), a.write(e), a.end();
3606
+ });
3607
+ }
3608
+ function Kr(e) {
3609
+ let t = 0, n = 0, r;
3610
+ for (let i of e) r != null && (n += Math.abs(i.length - r)), r = i.length, t += i.length;
3685
3611
  return {
3686
- parsedRecords: a,
3687
- valueDelimiterId: n != null && Gr(a) ? n : void 0
3612
+ averageValueCount: t / e.length,
3613
+ sumOfValueCountDiffs: n
3688
3614
  };
3689
3615
  }
3690
- function Gr(e) {
3616
+ function qr(e) {
3691
3617
  let t = /* @__PURE__ */ new Map();
3692
3618
  for (let n of e) t.set(n.length, (t.get(n.length) ?? 0) + 1);
3693
3619
  let [n = 0, r = 0] = [...t].toSorted((e, t) => t[1] - e[1])[0] ?? [];