@ai-matrx/records 0.76.14 → 0.76.16
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/CHANGELOG.md +10 -0
- package/dist/core/index.cjs +1 -32
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +2 -33
- package/dist/core/index.js.map +1 -1
- package/dist/memory/index.cjs.map +1 -1
- package/dist/memory/index.d.cts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/index.js.map +1 -1
- package/dist/templates/index.cjs +0 -1
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.d.cts +2 -2
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +0 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/{types-DvhixdUB.d.ts → types-C6gdqgsI.d.ts} +1 -1
- package/dist/{types-D9HN8YZS.d.cts → types-Mx-Wzm_d.d.cts} +1 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -592,7 +592,7 @@ interface ParsedImport {
|
|
|
592
592
|
/** Every row, keyed by heading. Every column is here; nothing is dropped. */
|
|
593
593
|
rows: Array<Record<string, string>>;
|
|
594
594
|
}
|
|
595
|
-
/**
|
|
595
|
+
/** Comma-separated text as rows — THE one reader (kit `parseDelimited`), quotes and embedded newlines included. */
|
|
596
596
|
declare function parseCsv(text: string): string[][];
|
|
597
597
|
declare function importCsv(text: string): ParsedImport;
|
|
598
598
|
declare function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -592,7 +592,7 @@ interface ParsedImport {
|
|
|
592
592
|
/** Every row, keyed by heading. Every column is here; nothing is dropped. */
|
|
593
593
|
rows: Array<Record<string, string>>;
|
|
594
594
|
}
|
|
595
|
-
/**
|
|
595
|
+
/** Comma-separated text as rows — THE one reader (kit `parseDelimited`), quotes and embedded newlines included. */
|
|
596
596
|
declare function parseCsv(text: string): string[][];
|
|
597
597
|
declare function importCsv(text: string): ParsedImport;
|
|
598
598
|
declare function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
|
package/dist/core/index.js
CHANGED
|
@@ -9533,7 +9533,7 @@ function predictWriteRefusals(args) {
|
|
|
9533
9533
|
}
|
|
9534
9534
|
|
|
9535
9535
|
// src/core/io.ts
|
|
9536
|
-
import { toDelimited } from "@ai-matrx/kit/delimited";
|
|
9536
|
+
import { parseDelimited, toDelimited } from "@ai-matrx/kit/delimited";
|
|
9537
9537
|
|
|
9538
9538
|
// src/core/wholeValue.ts
|
|
9539
9539
|
import { formatFileSize } from "@ai-matrx/kit/format";
|
|
@@ -9619,38 +9619,7 @@ async function exportXlsx(fields, rows2, sheetLabel = "Records") {
|
|
|
9619
9619
|
return writeWorkbookBytes({ sheets: [{ name, rows: toAoa(fields, rows2) }] });
|
|
9620
9620
|
}
|
|
9621
9621
|
function parseCsv(text2) {
|
|
9622
|
-
|
|
9623
|
-
let row = [];
|
|
9624
|
-
let cell = "";
|
|
9625
|
-
let quoted = false;
|
|
9626
|
-
for (let i = 0; i < text2.length; i += 1) {
|
|
9627
|
-
const ch = text2[i];
|
|
9628
|
-
if (quoted) {
|
|
9629
|
-
if (ch === '"') {
|
|
9630
|
-
if (text2[i + 1] === '"') {
|
|
9631
|
-
cell += '"';
|
|
9632
|
-
i += 1;
|
|
9633
|
-
} else quoted = false;
|
|
9634
|
-
} else cell += ch;
|
|
9635
|
-
continue;
|
|
9636
|
-
}
|
|
9637
|
-
if (ch === '"') quoted = true;
|
|
9638
|
-
else if (ch === ",") {
|
|
9639
|
-
row.push(cell);
|
|
9640
|
-
cell = "";
|
|
9641
|
-
} else if (ch === "\n" || ch === "\r") {
|
|
9642
|
-
if (ch === "\r" && text2[i + 1] === "\n") i += 1;
|
|
9643
|
-
row.push(cell);
|
|
9644
|
-
rows2.push(row);
|
|
9645
|
-
row = [];
|
|
9646
|
-
cell = "";
|
|
9647
|
-
} else cell += ch;
|
|
9648
|
-
}
|
|
9649
|
-
if (cell.length > 0 || row.length > 0) {
|
|
9650
|
-
row.push(cell);
|
|
9651
|
-
rows2.push(row);
|
|
9652
|
-
}
|
|
9653
|
-
return rows2;
|
|
9622
|
+
return parseDelimited(text2, { delimiter: ",", skipEmptyLines: true }).data;
|
|
9654
9623
|
}
|
|
9655
9624
|
function importCsv(text2) {
|
|
9656
9625
|
return fromMatrix(parseCsv(text2));
|