@ai-matrx/records 0.76.12 → 0.76.14

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.
@@ -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[][];
@@ -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[][];
@@ -4399,7 +4399,7 @@ function scopeChip(scope) {
4399
4399
 
4400
4400
  // src/table-kind-mapping.json
4401
4401
  var table_kind_mapping_default = {
4402
- about: "THE ONE MAPPING from a store Field to a kind's three schemas (KINDS-GLUE wave 3 \xA72). Hand-written here; aidream copies it verbatim to packages/matrx-graph/matrx_graph/table_kind_mapping.json (scripts/generate_table_kind_mapping.py --check). Both languages derive from this file only: @ai-matrx/records src/table-kind.ts and matrx_graph.table_kinds. Keys of `kinds` are the store's field kinds (custom.field_kinds() plus the formula `system` kinds custom.field_kind_of answers). Stored mode only: `column_source_default` is custom.table_column_source's answer when the facts carry none (silence means the doctrine: Field rows are the columns); `platform_keys` mirrors custom.record_platform_keys() with each key's shape (parent_id: custom.containment_parent's uuid cast); `stored_patterns` mirror custom.validate_values' relation id regex and, for dates, refuse a string the timestamptz cast can never read (no digits, not a special word) while never refusing one it can.",
4402
+ about: "THE ONE MAPPING from a store Field to a kind's three schemas (KINDS-GLUE wave 3 \xA72). Hand-written here; aidream copies it verbatim to packages/matrx-graph/matrx_graph/table_kind_mapping.json (scripts/generate_table_kind_mapping.py --check). Both languages derive from this file only: @ai-matrx/records src/table-kind.ts and matrx_graph.table_kinds. Keys of `kinds` are the store's field kinds (custom.field_kinds() plus the formula `system` kinds custom.field_kind_of answers). Stored mode only: `column_source_default` is custom.table_column_source's answer when the facts carry none (silence means the doctrine: Field rows are the columns); `platform_keys` mirrors custom.record_platform_keys() with each key's shape (parent_id: custom.containment_parent's uuid cast; icon: the record's own @ai-matrx/icons name, a string or null); `stored_patterns` mirror custom.validate_values' relation id regex and, for dates, refuse a string the timestamptz cast can never read (no digits, not a special word) while never refusing one it can.",
4403
4403
  version: 2,
4404
4404
  kernels: {
4405
4405
  file: "11111111-0000-4000-8000-000000000006",
@@ -4420,7 +4420,8 @@ var table_kind_mapping_default = {
4420
4420
  address_part_max: 200,
4421
4421
  column_source_default: "fields",
4422
4422
  platform_keys: {
4423
- parent_id: { type: ["string", "null"], pattern: "^(?:\\{[0-9a-fA-F]{4}(?:-?[0-9a-fA-F]{4}){7}\\}|[0-9a-fA-F]{4}(?:-?[0-9a-fA-F]{4}){7})$" }
4423
+ parent_id: { type: ["string", "null"], pattern: "^(?:\\{[0-9a-fA-F]{4}(?:-?[0-9a-fA-F]{4}){7}\\}|[0-9a-fA-F]{4}(?:-?[0-9a-fA-F]{4}){7})$" },
4424
+ icon: { type: ["string", "null"] }
4424
4425
  },
4425
4426
  stored_patterns: {
4426
4427
  record_id: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
@@ -9531,6 +9532,9 @@ function predictWriteRefusals(args) {
9531
9532
  return found;
9532
9533
  }
9533
9534
 
9535
+ // src/core/io.ts
9536
+ import { toDelimited } from "@ai-matrx/kit/delimited";
9537
+
9534
9538
  // src/core/wholeValue.ts
9535
9539
  import { formatFileSize } from "@ai-matrx/kit/format";
9536
9540
  var WHOLE_VALUE_SOURCE_KIND = "whole_value_in_file";
@@ -9583,7 +9587,6 @@ async function withWholeValues(rows2, read) {
9583
9587
  }
9584
9588
 
9585
9589
  // src/core/io.ts
9586
- var escape = (value) => /[",\n\r]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
9587
9590
  function cellText(value) {
9588
9591
  if (!value) return "";
9589
9592
  if (value.absent_reason) return `(${value.absent_reason})`;
@@ -9605,11 +9608,7 @@ function headerFor(field) {
9605
9608
  return field.label && field.label.length > 0 ? field.label : field.key;
9606
9609
  }
9607
9610
  function exportCsv(fields, rows2) {
9608
- const lines = [fields.map((f) => escape(headerFor(f))).join(",")];
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");
9611
+ return toDelimited(toAoa(fields, rows2));
9613
9612
  }
9614
9613
  function toAoa(fields, rows2) {
9615
9614
  return [fields.map(headerFor), ...rows2.map((row) => fields.map((f) => exportCellText2(f, row[f.key])))];