CSV and JSON Data Export
CSV and JSON data export reaches every result surface in the workbench — the
edit-db grid, the SQL console, and the
report runner — all backed by
one shared utility
(examples/edit-db/src/lib/export.ts). There is no second export implementation
in the repo.
What export guarantees
Section titled “What export guarantees”- Full result set, not the visible page. A grid export with an active column filter and sort pages through the fetcher and exports every matching row across all pages — the exported row count equals the server’s total count for that filter.
- RFC4180-correct CSV. A value containing a comma, a double quote, or a
newline is quoted exactly per the spec, and
NULLis emitted distinguishably from the empty string. - Excel BOM option. With the BOM option enabled, the UTF-8 byte-order mark is the first bytes of the file.
- Formula-injection guard (CWE-1236). A text value that starts with
=,+,-,@, tab, or carriage return gets a leading apostrophe so a spreadsheet opens it as text instead of running it as a formula. Numeric column values arrive typed and are left alone, so a negative number stays a number. That exemption is atypeof value === 'string'test, so it depends on the wire type:Int,BigIntandDecimalserialize as JSON numbers today (ExactNumericScalarsadds no customSerialize, and the client parses the response with plainJSON.parse), so a-5cell is a JS number. If a numeric scalar is ever serialized as a decimal string — the input direction already accepts one — every negative value in that column starts getting an apostrophe. Change the guard with the serializer, not after a bug report. - BigInt-safe JSON. A BigInt primary-key value round-trips without precision
loss (carried as a string, never a
Number-coerced value), and dates keep a documented, stable format. - Row cap with confirm. Exporting above the row cap prompts for confirmation first; cancelling mid-export stops paging and leaves no partial file.
Delivery
Section titled “Delivery”In the browser, export downloads a Blob via a transient anchor. On the desktop
shell, the editor’s exports (grid toolbar and the table list’s Download
actions) route through the native save-file bridge: the OS save dialog picks
the destination, a cancelled dialog writes nothing, and the shell reports the
saved path. Hosts embedding the editor elsewhere can supply their own saver via
<Editor saveFile={...}>.
Related
Section titled “Related”- Grid grouping — grouping composes with export; the filter applies to both.
- Tabular reports — report CSV rides this same utility.
- Composite-PK compliance — why BigInt and composite keys are carried as strings.
- Data workbench overview