@ai-matrx/records 0.94.0 → 0.95.0

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.
@@ -638,6 +638,12 @@ declare function cellText(value: ReadValue | undefined): string;
638
638
  declare function exportCellText(field: Field, value: ReadValue | undefined): string;
639
639
  /** CSV through THE one writer (kit `toDelimited`; spreadsheet-safe by default). */
640
640
  declare function exportCsv(fields: Field[], rows: ExportRow[]): string;
641
+ /**
642
+ * MARKDOWN: the same header row and the same cells as CSV and XLSX (`toAoa`), written as a pipe table — pasteable into a
643
+ * note, an issue or a chat. A `|` in a cell is escaped, a line break becomes `<br>`, and an empty cell stays empty.
644
+ * No column, no table: a table with no columns is the empty string.
645
+ */
646
+ declare function exportMarkdown(fields: Field[], rows: ExportRow[]): string;
641
647
  /** The header row plus every cell, as the sheet writer takes it. */
642
648
  declare function toAoa(fields: Field[], rows: ExportRow[]): string[][];
643
649
  /**
@@ -750,4 +756,4 @@ declare function seededDataSource(index: Map<string, unknown>): {
750
756
  missed: () => boolean;
751
757
  };
752
758
 
753
- export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRIMED_DOOR_TTL_MS, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, archivedOrganizationId, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, dropPrimedDoorAnswers, exportCellText, exportCsv, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, isRecordRemoved, landingOutcomesFor, mapPgError, markRecordRemoved, markRecordRestored, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeDoorAnswer, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
759
+ export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRIMED_DOOR_TTL_MS, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, archivedOrganizationId, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, dropPrimedDoorAnswers, exportCellText, exportCsv, exportMarkdown, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, isRecordRemoved, landingOutcomesFor, mapPgError, markRecordRemoved, markRecordRestored, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeDoorAnswer, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
@@ -638,6 +638,12 @@ declare function cellText(value: ReadValue | undefined): string;
638
638
  declare function exportCellText(field: Field, value: ReadValue | undefined): string;
639
639
  /** CSV through THE one writer (kit `toDelimited`; spreadsheet-safe by default). */
640
640
  declare function exportCsv(fields: Field[], rows: ExportRow[]): string;
641
+ /**
642
+ * MARKDOWN: the same header row and the same cells as CSV and XLSX (`toAoa`), written as a pipe table — pasteable into a
643
+ * note, an issue or a chat. A `|` in a cell is escaped, a line break becomes `<br>`, and an empty cell stays empty.
644
+ * No column, no table: a table with no columns is the empty string.
645
+ */
646
+ declare function exportMarkdown(fields: Field[], rows: ExportRow[]): string;
641
647
  /** The header row plus every cell, as the sheet writer takes it. */
642
648
  declare function toAoa(fields: Field[], rows: ExportRow[]): string[][];
643
649
  /**
@@ -750,4 +756,4 @@ declare function seededDataSource(index: Map<string, unknown>): {
750
756
  missed: () => boolean;
751
757
  };
752
758
 
753
- export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRIMED_DOOR_TTL_MS, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, archivedOrganizationId, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, dropPrimedDoorAnswers, exportCellText, exportCsv, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, isRecordRemoved, landingOutcomesFor, mapPgError, markRecordRemoved, markRecordRestored, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeDoorAnswer, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
759
+ export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRIMED_DOOR_TTL_MS, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, archivedOrganizationId, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, dropPrimedDoorAnswers, exportCellText, exportCsv, exportMarkdown, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, isRecordRemoved, landingOutcomesFor, mapPgError, markRecordRemoved, markRecordRestored, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeDoorAnswer, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
@@ -10372,6 +10372,13 @@ function headerFor(field) {
10372
10372
  function exportCsv(fields, rows2) {
10373
10373
  return toDelimited(toAoa(fields, rows2));
10374
10374
  }
10375
+ function exportMarkdown(fields, rows2) {
10376
+ if (fields.length === 0) return "";
10377
+ const cell = (text2) => text2.replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").trim();
10378
+ const [head, ...body] = toAoa(fields, rows2);
10379
+ const line = (cells) => `| ${cells.map(cell).join(" | ")} |`;
10380
+ return [line(head ?? []), `| ${fields.map(() => "---").join(" | ")} |`, ...body.map(line)].join("\n") + "\n";
10381
+ }
10375
10382
  function toAoa(fields, rows2) {
10376
10383
  return [fields.map(headerFor), ...rows2.map((row) => fields.map((f) => exportCellText2(f, row[f.key])))];
10377
10384
  }
@@ -10618,6 +10625,7 @@ export {
10618
10625
  err,
10619
10626
  exportCellText2 as exportCellText,
10620
10627
  exportCsv,
10628
+ exportMarkdown,
10621
10629
  exportPageXlsx,
10622
10630
  exportXlsx,
10623
10631
  fieldDeclarationFor,