@dpuse/dpuse-tool-adaltas-csv-parser 1.0.119 → 1.0.120
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.
|
|
64
|
+
| [@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared) | 1.0.152 | MIT | [LICENSE](licenses/downloads/@dpuse/dpuse-shared@1.0.152-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.
|
|
72
|
+
- **[@dpuse/dpuse-shared](https://github.com/dpuse/dpuse-shared)** 1.0.152 — this month: 2026-10-27
|
|
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 — 1 mth ago: 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** |
|
|
89
|
-
| csv-parse → dist/esm/index.js | `████████████████░░░░` 78.
|
|
90
|
-
| @dpuse/dpuse-shared → dist/dpuse-shared.es.js |
|
|
91
|
-
| src → index.ts | `█░░░░░░░░░░░░░░░░░░░`
|
|
92
|
-
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 5.
|
|
88
|
+
| **dist/dpuse-tool-adaltas-csv-parser.es.js** | 126.2 kB · gzip 31.6 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.5% · 15.8 kB |
|
|
91
|
+
| src → index.ts | `█░░░░░░░░░░░░░░░░░░░` 3.1% · 3.9 kB |
|
|
92
|
+
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 5.8% · 7.3 kB |
|
|
93
93
|
|
|
94
94
|
Bars show each row's share of its output file.
|
|
95
95
|
|
|
@@ -2950,48 +2950,87 @@ var Er = {
|
|
|
2950
2950
|
"disabled",
|
|
2951
2951
|
"oAuth2",
|
|
2952
2952
|
"none"
|
|
2953
|
-
]), { ...Er }
|
|
2954
|
-
|
|
2955
|
-
data;
|
|
2956
|
-
locator;
|
|
2957
|
-
constructor(e, t, n, r) {
|
|
2958
|
-
super(e, r), this.name = "DPUseError", this.data = n, this.locator = t;
|
|
2959
|
-
}
|
|
2960
|
-
}, kr = class extends Or {
|
|
2961
|
-
constructor(e, t, n, r) {
|
|
2962
|
-
super(e, t, n, r), this.name = "FetchError";
|
|
2963
|
-
}
|
|
2964
|
-
};
|
|
2965
|
-
async function Ar(e, t, n) {
|
|
2966
|
-
let r = ` - ${e.statusText}`, i = `${t} Response status '${String(e.status)}${e.statusText ? r : ""}' received.`, a;
|
|
2967
|
-
try {
|
|
2968
|
-
a = await e.text();
|
|
2969
|
-
} catch (e) {
|
|
2970
|
-
a = `<body unavailable: ${Mr(e).message}>`;
|
|
2971
|
-
}
|
|
2972
|
-
return new kr(i, n, { body: Nr(a) });
|
|
2973
|
-
}
|
|
2974
|
-
function jr(e) {
|
|
2953
|
+
]), { ...Er };
|
|
2954
|
+
function Dr(e) {
|
|
2975
2955
|
try {
|
|
2976
2956
|
e();
|
|
2977
2957
|
} catch {}
|
|
2978
2958
|
}
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2959
|
+
$([
|
|
2960
|
+
"arrow",
|
|
2961
|
+
"avro",
|
|
2962
|
+
"dtv",
|
|
2963
|
+
"json",
|
|
2964
|
+
"jsonl",
|
|
2965
|
+
"markdown",
|
|
2966
|
+
"ods",
|
|
2967
|
+
"parquet",
|
|
2968
|
+
"sav",
|
|
2969
|
+
"sqlite",
|
|
2970
|
+
"xlsx",
|
|
2971
|
+
"xml"
|
|
2972
|
+
]), { ...Er };
|
|
2973
|
+
async function Or(e, t, n) {
|
|
2974
|
+
let r = kr(e), { issues: i, parsedRecords: a, valueDelimiterId: o } = await Ar(e, t.valueDelimiterIds, t.isComplete, n);
|
|
2975
|
+
return {
|
|
2976
|
+
issues: i,
|
|
2977
|
+
parsedRecords: a,
|
|
2978
|
+
recordDelimiterId: r,
|
|
2979
|
+
valueDelimiterId: o
|
|
2980
|
+
};
|
|
2981
|
+
}
|
|
2982
|
+
function kr(e) {
|
|
2983
|
+
let t = (e.match(/\r\n/g) ?? []).length, n = (e.match(/(?<!\r)\n/g) ?? []).length, r = (e.match(/\r(?!\n)/g) ?? []).length;
|
|
2984
|
+
return t >= n && t >= r ? "\r\n" : n >= t && n >= r ? "\n" : r >= t && r >= n ? "\r" : "\n";
|
|
2985
|
+
}
|
|
2986
|
+
async function Ar(e, t, n, r) {
|
|
2987
|
+
let i, a, o, s = [], c, l = !1;
|
|
2988
|
+
for (let u of t) {
|
|
2989
|
+
let { issues: t, records: d } = await r(e, u, n);
|
|
2990
|
+
if (t.length > 0) {
|
|
2991
|
+
c = jr(c, {
|
|
2992
|
+
delimiter: u,
|
|
2993
|
+
issues: t,
|
|
2994
|
+
records: d
|
|
2995
|
+
});
|
|
2996
|
+
continue;
|
|
2997
|
+
}
|
|
2998
|
+
if (l = !0, d.length === 0) continue;
|
|
2999
|
+
let { averageValueCount: f, sumOfValueCountDiffs: p } = Mr(d);
|
|
3000
|
+
(!o || p <= o) && (!a || f > a) && (i = u, a = f, o = p, s = d);
|
|
3001
|
+
}
|
|
3002
|
+
if (!l && c != null) {
|
|
3003
|
+
let { delimiter: e, issues: t, records: n } = c;
|
|
3004
|
+
return {
|
|
3005
|
+
issues: t,
|
|
3006
|
+
parsedRecords: n,
|
|
3007
|
+
valueDelimiterId: Nr(n) ? e : void 0
|
|
3008
|
+
};
|
|
2988
3009
|
}
|
|
2989
|
-
return
|
|
3010
|
+
return {
|
|
3011
|
+
issues: [],
|
|
3012
|
+
parsedRecords: s,
|
|
3013
|
+
valueDelimiterId: i != null && Nr(s) ? i : void 0
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
3016
|
+
function jr(e, t) {
|
|
3017
|
+
return e == null || t.issues.length < e.issues.length ? t : e;
|
|
3018
|
+
}
|
|
3019
|
+
function Mr(e) {
|
|
3020
|
+
let t = 0, n = 0, r;
|
|
3021
|
+
for (let i of e) r != null && (n += Math.abs(i.length - r)), r = i.length, t += i.length;
|
|
3022
|
+
return {
|
|
3023
|
+
averageValueCount: t / e.length,
|
|
3024
|
+
sumOfValueCountDiffs: n
|
|
3025
|
+
};
|
|
2990
3026
|
}
|
|
2991
3027
|
function Nr(e) {
|
|
2992
|
-
|
|
3028
|
+
let t = /* @__PURE__ */ new Map();
|
|
3029
|
+
for (let n of e) t.set(n.length, (t.get(n.length) ?? 0) + 1);
|
|
3030
|
+
let [n = 0, r = 0] = [...t].toSorted((e, t) => t[1] - e[1])[0] ?? [];
|
|
3031
|
+
return n > 1 && r * 2 > e.length;
|
|
2993
3032
|
}
|
|
2994
|
-
$([
|
|
3033
|
+
$(["list"]), { ...Er }, $([
|
|
2995
3034
|
"list",
|
|
2996
3035
|
"render",
|
|
2997
3036
|
"setColorMode"
|
|
@@ -3465,71 +3504,70 @@ var Lr = {
|
|
|
3465
3504
|
to_line: -1,
|
|
3466
3505
|
trim: !1
|
|
3467
3506
|
}, Rr = 4, zr = 50, Br = 1e4, Vr = class {
|
|
3468
|
-
async parseStream(e, t, n
|
|
3469
|
-
return new Promise((
|
|
3470
|
-
let
|
|
3471
|
-
if (
|
|
3472
|
-
|
|
3473
|
-
let e =
|
|
3474
|
-
|
|
3507
|
+
async parseStream(e, t, n) {
|
|
3508
|
+
return new Promise((r, i) => {
|
|
3509
|
+
let a, o, s, c = !1, l = !1, u = () => {
|
|
3510
|
+
if (l) return;
|
|
3511
|
+
l = !0;
|
|
3512
|
+
let e = a;
|
|
3513
|
+
a = void 0, s = void 0, e != null && (Dr(() => e.removeAllListeners()), Dr(() => e.end())), Dr(() => void o?.cancel()), o = void 0;
|
|
3514
|
+
}, d = (e) => {
|
|
3515
|
+
c || (c = !0, u(), i(e instanceof Error ? e : Error(String(e))));
|
|
3475
3516
|
};
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
(async () => {
|
|
3481
|
-
s = ar({
|
|
3517
|
+
t.abortSignal.addEventListener("abort", () => {
|
|
3518
|
+
d(t.abortSignal.reason);
|
|
3519
|
+
}, { once: !0 }), (async () => {
|
|
3520
|
+
t.abortSignal.throwIfAborted(), a = ar({
|
|
3482
3521
|
...Lr,
|
|
3483
|
-
...t,
|
|
3484
3522
|
cast: (e, t) => ({
|
|
3485
3523
|
value: e,
|
|
3486
|
-
|
|
3487
|
-
})
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3524
|
+
valueWasQuoted: t.quoting
|
|
3525
|
+
}),
|
|
3526
|
+
delimiter: t.valueDelimiterId,
|
|
3527
|
+
relax_column_count: !0
|
|
3528
|
+
}), s = Hr({
|
|
3529
|
+
chunk: n,
|
|
3530
|
+
chunkSize: t.chunkSize ?? Br
|
|
3531
|
+
}), a.on("readable", () => {
|
|
3492
3532
|
try {
|
|
3493
|
-
if (
|
|
3533
|
+
if (a == null || s == null) return;
|
|
3494
3534
|
let e;
|
|
3495
|
-
for (; (e =
|
|
3496
|
-
if (
|
|
3497
|
-
|
|
3535
|
+
for (; (e = a.read()) != null;) {
|
|
3536
|
+
if (c) return;
|
|
3537
|
+
t.abortSignal.throwIfAborted(), s.push(e);
|
|
3498
3538
|
}
|
|
3499
3539
|
} catch (e) {
|
|
3500
|
-
|
|
3540
|
+
d(e);
|
|
3501
3541
|
}
|
|
3502
|
-
}),
|
|
3503
|
-
|
|
3504
|
-
}),
|
|
3505
|
-
|
|
3506
|
-
});
|
|
3507
|
-
let
|
|
3508
|
-
if (!o.ok || o.body == null) throw await Ar(o, `Failed to fetch '${n}' file.`, "dpuse-connector-file-store-emulator|Connector|retrieve");
|
|
3509
|
-
c = o.body.getReader();
|
|
3510
|
-
let d = new TextDecoder(Ir(e.encodingId)), f = await c.read();
|
|
3542
|
+
}), a.on("error", (e) => {
|
|
3543
|
+
d(e);
|
|
3544
|
+
}), a.on("end", () => {
|
|
3545
|
+
c || (s?.flush(), r(Ur(a)));
|
|
3546
|
+
}), o = e.getReader();
|
|
3547
|
+
let i = new TextDecoder(Ir(t.encodingId)), l = 0, u = !1, f = await o.read();
|
|
3511
3548
|
for (; !f.done;) {
|
|
3512
|
-
if (
|
|
3513
|
-
|
|
3514
|
-
let e =
|
|
3515
|
-
e.length > 0 &&
|
|
3549
|
+
if (c) return;
|
|
3550
|
+
t.abortSignal.throwIfAborted(), l += f.value.length;
|
|
3551
|
+
let e = i.decode(f.value, { stream: !0 });
|
|
3552
|
+
e.length > 0 && (a.write(e), u = !0), f = await o.read();
|
|
3516
3553
|
}
|
|
3517
|
-
if (
|
|
3518
|
-
let
|
|
3519
|
-
|
|
3554
|
+
if (c) return;
|
|
3555
|
+
let p = i.decode();
|
|
3556
|
+
p.length > 0 && (a.write(p), u = !0), u ? a.end() : (a.removeAllListeners(), a = void 0, r({
|
|
3557
|
+
byteCount: l,
|
|
3558
|
+
commentLineCount: 0,
|
|
3559
|
+
emptyLineCount: 0,
|
|
3560
|
+
lineCount: 0,
|
|
3561
|
+
nonUniformRecordCount: 0,
|
|
3562
|
+
recordCount: 0
|
|
3563
|
+
}));
|
|
3520
3564
|
})().catch((e) => {
|
|
3521
|
-
|
|
3565
|
+
d(e);
|
|
3522
3566
|
});
|
|
3523
3567
|
});
|
|
3524
3568
|
}
|
|
3525
|
-
async parseText(e, t
|
|
3526
|
-
|
|
3527
|
-
return {
|
|
3528
|
-
issues: i,
|
|
3529
|
-
parsedRecords: a,
|
|
3530
|
-
recordDelimiterId: r,
|
|
3531
|
-
valueDelimiterId: o
|
|
3532
|
-
};
|
|
3569
|
+
async parseText(e, t) {
|
|
3570
|
+
return await Or(e, t, Wr);
|
|
3533
3571
|
}
|
|
3534
3572
|
};
|
|
3535
3573
|
function Hr(e) {
|
|
@@ -3561,52 +3599,15 @@ function Ur(e) {
|
|
|
3561
3599
|
recordCount: e?.info.records ?? -1
|
|
3562
3600
|
};
|
|
3563
3601
|
}
|
|
3564
|
-
function Wr(e) {
|
|
3565
|
-
let t = (e.match(/\r\n/g) ?? []).length, n = (e.match(/(?<!\r)\n/g) ?? []).length, r = (e.match(/\r(?!\n)/g) ?? []).length;
|
|
3566
|
-
return t >= n && t >= r ? "\r\n" : n >= t && n >= r ? "\n" : r >= t && r >= n ? "\r" : "\n";
|
|
3567
|
-
}
|
|
3568
|
-
async function Gr(e, t, n) {
|
|
3569
|
-
let r, i, a, o = [], s, c = !1;
|
|
3570
|
-
for (let l of t) {
|
|
3571
|
-
let { issues: t, records: u } = await qr(e, l, n);
|
|
3572
|
-
if (t.length > 0) {
|
|
3573
|
-
s = Kr(s, {
|
|
3574
|
-
delimiter: l,
|
|
3575
|
-
issues: t,
|
|
3576
|
-
records: u
|
|
3577
|
-
});
|
|
3578
|
-
continue;
|
|
3579
|
-
}
|
|
3580
|
-
if (c = !0, u.length === 0) continue;
|
|
3581
|
-
let { averageValueCount: d, sumOfValueCountDiffs: f } = Yr(u);
|
|
3582
|
-
(!a || f <= a) && (!i || d > i) && (r = l, i = d, a = f, o = u);
|
|
3583
|
-
}
|
|
3584
|
-
if (!c && s != null) {
|
|
3585
|
-
let { delimiter: e, issues: t, records: n } = s;
|
|
3586
|
-
return {
|
|
3587
|
-
issues: t,
|
|
3588
|
-
parsedRecords: n,
|
|
3589
|
-
valueDelimiterId: Xr(n) ? e : void 0
|
|
3590
|
-
};
|
|
3591
|
-
}
|
|
3592
|
-
return {
|
|
3593
|
-
issues: [],
|
|
3594
|
-
parsedRecords: o,
|
|
3595
|
-
valueDelimiterId: r != null && Xr(o) ? r : void 0
|
|
3596
|
-
};
|
|
3597
|
-
}
|
|
3598
|
-
function Kr(e, t) {
|
|
3599
|
-
return e == null || t.issues.length < e.issues.length ? t : e;
|
|
3600
|
-
}
|
|
3601
|
-
function qr(e, t, n) {
|
|
3602
|
+
function Wr(e, t, n) {
|
|
3602
3603
|
return new Promise((r) => {
|
|
3603
3604
|
let i = [], a = [], o = 0, s = (e) => {
|
|
3604
|
-
e == null || !n && e.code === "CSV_QUOTE_NOT_CLOSED" || (i.push(
|
|
3605
|
+
e == null || !n && e.code === "CSV_QUOTE_NOT_CLOSED" || (i.push(Gr(e, o + 1)), e.lines != null && (o = e.lines));
|
|
3605
3606
|
}, c = ar({
|
|
3606
3607
|
...Lr,
|
|
3607
3608
|
cast: (e, t) => ({
|
|
3608
3609
|
value: e,
|
|
3609
|
-
|
|
3610
|
+
valueWasQuoted: t.quoting
|
|
3610
3611
|
}),
|
|
3611
3612
|
delimiter: t,
|
|
3612
3613
|
info: !0,
|
|
@@ -3631,7 +3632,7 @@ function qr(e, t, n) {
|
|
|
3631
3632
|
}), c.write(e), c.end();
|
|
3632
3633
|
});
|
|
3633
3634
|
}
|
|
3634
|
-
function
|
|
3635
|
+
function Gr(e, t) {
|
|
3635
3636
|
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;
|
|
3636
3637
|
return {
|
|
3637
3638
|
endLineNumber: n != null && n > t ? n : void 0,
|
|
@@ -3644,18 +3645,4 @@ function Jr(e, t) {
|
|
|
3644
3645
|
value: i != null && i.length > zr ? `${i.slice(0, zr)}…` : i
|
|
3645
3646
|
};
|
|
3646
3647
|
}
|
|
3647
|
-
function Yr(e) {
|
|
3648
|
-
let t = 0, n = 0, r;
|
|
3649
|
-
for (let i of e) r != null && (n += Math.abs(i.length - r)), r = i.length, t += i.length;
|
|
3650
|
-
return {
|
|
3651
|
-
averageValueCount: t / e.length,
|
|
3652
|
-
sumOfValueCountDiffs: n
|
|
3653
|
-
};
|
|
3654
|
-
}
|
|
3655
|
-
function Xr(e) {
|
|
3656
|
-
let t = /* @__PURE__ */ new Map();
|
|
3657
|
-
for (let n of e) t.set(n.length, (t.get(n.length) ?? 0) + 1);
|
|
3658
|
-
let [n = 0, r = 0] = [...t].toSorted((e, t) => t[1] - e[1])[0] ?? [];
|
|
3659
|
-
return n > 1 && r * 2 > e.length;
|
|
3660
|
-
}
|
|
3661
3648
|
export { Vr as Tool };
|