@ai-matrx/records 0.76.12 → 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records
|
|
2
2
|
|
|
3
|
+
## 0.76.13
|
|
4
|
+
|
|
5
|
+
- `exportCsv` writes through THE one writer, `@ai-matrx/kit/delimited` (AP-2): formula-looking text gets a leading `'` (OWASP CSV injection); it had no formula guard before. Same header row, quoting and order.
|
|
6
|
+
|
|
7
|
+
**Consumer action:** none.
|
|
8
|
+
|
|
3
9
|
## 0.76.11
|
|
4
10
|
|
|
5
11
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/core/index.cjs
CHANGED
|
@@ -9820,6 +9820,9 @@ function predictWriteRefusals(args) {
|
|
|
9820
9820
|
return found;
|
|
9821
9821
|
}
|
|
9822
9822
|
|
|
9823
|
+
// src/core/io.ts
|
|
9824
|
+
var import_delimited = require("@ai-matrx/kit/delimited");
|
|
9825
|
+
|
|
9823
9826
|
// src/core/wholeValue.ts
|
|
9824
9827
|
var import_format = require("@ai-matrx/kit/format");
|
|
9825
9828
|
var WHOLE_VALUE_SOURCE_KIND = "whole_value_in_file";
|
|
@@ -9872,7 +9875,6 @@ async function withWholeValues(rows2, read) {
|
|
|
9872
9875
|
}
|
|
9873
9876
|
|
|
9874
9877
|
// src/core/io.ts
|
|
9875
|
-
var escape = (value) => /[",\n\r]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
|
|
9876
9878
|
function cellText(value) {
|
|
9877
9879
|
if (!value) return "";
|
|
9878
9880
|
if (value.absent_reason) return `(${value.absent_reason})`;
|
|
@@ -9894,11 +9896,7 @@ function headerFor(field) {
|
|
|
9894
9896
|
return field.label && field.label.length > 0 ? field.label : field.key;
|
|
9895
9897
|
}
|
|
9896
9898
|
function exportCsv(fields, rows2) {
|
|
9897
|
-
|
|
9898
|
-
for (const row of rows2) {
|
|
9899
|
-
lines.push(fields.map((f) => escape(exportCellText2(f, row[f.key]))).join(","));
|
|
9900
|
-
}
|
|
9901
|
-
return lines.join("\n");
|
|
9899
|
+
return (0, import_delimited.toDelimited)(toAoa(fields, rows2));
|
|
9902
9900
|
}
|
|
9903
9901
|
function toAoa(fields, rows2) {
|
|
9904
9902
|
return [fields.map(headerFor), ...rows2.map((row) => fields.map((f) => exportCellText2(f, row[f.key])))];
|