@burojs/export
v0.2.0
Published
Buro: dependency-free export protocol implementation (CSV/JSON encoders, paginated/job exporters)
Downloads
154
Readme
@burojs/export
The reference implementation of buro's data-export protocol: CSV/JSON
encoders plus two Exporter factories — one that fetches and encodes rows
client-side, one that drives a server-side export job. The protocol itself
(Exporter, ExportHandle, ExportRequest, ExportFormat, …) lives in
@burojs/core; this package is an implementation of it, not a requirement —
an app or a data provider is free to implement Exporter directly instead.
For how to register and use these with a resource, see
docs/adopters/data-export.md.
No third-party dependencies
package.json's only dependencies entry is @burojs/core (this
framework's own protocol package) — no third-party runtime dependency of any
kind. CSV/JSON encoding, retry/backoff, and polling are all written against
nothing but the language and the DOM's Blob.
What's here
csvFormat(opts?)/jsonFormat()—ExporterFormatEntryfactories: anExportFormatdeclaration paired with anencode(rows, columns, options)function.csvFormatsupportssemicolon/comma/tabdelimiter presets (defaultsemicolon, with a UTF-8 BOM and\r\nline endings) and quotes any cell containing the delimiter, a quote, or a newline.createExportHandle(init?)— the sharedExportHandlestate machine (running → succeeded | failed | canceled, sticky terminal states, per-listener error isolation) both factories below build on.createPaginatedExporter(opts)— fetches rows through theExporterContext.datayour host hands it (page by page, or inidchunks for a bulk selection), encodes the whole result with one of yourformats, and produces ablobartifact. Handles retry with backoff, cancellation, and amaxRowsguardrail. Buffers all fetched rows in memory — not a streaming export.createJobExporter(opts)— drives astart/poll/cancel?job on your backend through the sameExportHandleshape, with polling backoff and aresume/attachseam for reattaching to an in-flight job. You provide the three HTTP calls; this package owns the state machine around them.
Both factories are exporters in the @burojs/core sense — register them in
AppExportConfig.exporters (via defineApp({ export: { exporters, default }
})) and the rest of the feature (resolution, the dialog, the toolbar/bulk
entry points) is @burojs/react and @burojs/ui-shadcn's job, not this
package's.
