@ai-matrx/records 0.76.11 → 0.76.13
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 +6 -0
- package/dist/core/index.cjs +4 -6
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +4 -6
- package/dist/core/index.js.map +1 -1
- package/package.json +4 -4
package/dist/core/index.d.cts
CHANGED
|
@@ -557,6 +557,7 @@ declare function cellText(value: ReadValue | undefined): string;
|
|
|
557
557
|
* name. Every other value is `cellText`'s.
|
|
558
558
|
*/
|
|
559
559
|
declare function exportCellText(field: Field, value: ReadValue | undefined): string;
|
|
560
|
+
/** CSV through THE one writer (kit `toDelimited`; spreadsheet-safe by default). */
|
|
560
561
|
declare function exportCsv(fields: Field[], rows: ExportRow[]): string;
|
|
561
562
|
/** The header row plus every cell, as the sheet writer takes it. */
|
|
562
563
|
declare function toAoa(fields: Field[], rows: ExportRow[]): string[][];
|
package/dist/core/index.d.ts
CHANGED
|
@@ -557,6 +557,7 @@ declare function cellText(value: ReadValue | undefined): string;
|
|
|
557
557
|
* name. Every other value is `cellText`'s.
|
|
558
558
|
*/
|
|
559
559
|
declare function exportCellText(field: Field, value: ReadValue | undefined): string;
|
|
560
|
+
/** CSV through THE one writer (kit `toDelimited`; spreadsheet-safe by default). */
|
|
560
561
|
declare function exportCsv(fields: Field[], rows: ExportRow[]): string;
|
|
561
562
|
/** The header row plus every cell, as the sheet writer takes it. */
|
|
562
563
|
declare function toAoa(fields: Field[], rows: ExportRow[]): string[][];
|
package/dist/core/index.js
CHANGED
|
@@ -9531,6 +9531,9 @@ function predictWriteRefusals(args) {
|
|
|
9531
9531
|
return found;
|
|
9532
9532
|
}
|
|
9533
9533
|
|
|
9534
|
+
// src/core/io.ts
|
|
9535
|
+
import { toDelimited } from "@ai-matrx/kit/delimited";
|
|
9536
|
+
|
|
9534
9537
|
// src/core/wholeValue.ts
|
|
9535
9538
|
import { formatFileSize } from "@ai-matrx/kit/format";
|
|
9536
9539
|
var WHOLE_VALUE_SOURCE_KIND = "whole_value_in_file";
|
|
@@ -9583,7 +9586,6 @@ async function withWholeValues(rows2, read) {
|
|
|
9583
9586
|
}
|
|
9584
9587
|
|
|
9585
9588
|
// src/core/io.ts
|
|
9586
|
-
var escape = (value) => /[",\n\r]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
|
|
9587
9589
|
function cellText(value) {
|
|
9588
9590
|
if (!value) return "";
|
|
9589
9591
|
if (value.absent_reason) return `(${value.absent_reason})`;
|
|
@@ -9605,11 +9607,7 @@ function headerFor(field) {
|
|
|
9605
9607
|
return field.label && field.label.length > 0 ? field.label : field.key;
|
|
9606
9608
|
}
|
|
9607
9609
|
function exportCsv(fields, rows2) {
|
|
9608
|
-
|
|
9609
|
-
for (const row of rows2) {
|
|
9610
|
-
lines.push(fields.map((f) => escape(exportCellText2(f, row[f.key]))).join(","));
|
|
9611
|
-
}
|
|
9612
|
-
return lines.join("\n");
|
|
9610
|
+
return toDelimited(toAoa(fields, rows2));
|
|
9613
9611
|
}
|
|
9614
9612
|
function toAoa(fields, rows2) {
|
|
9615
9613
|
return [fields.map(headerFor), ...rows2.map((row) => fields.map((f) => exportCellText2(f, row[f.key])))];
|