smrt
Open the smrt source on GitHub Switch to dark color scheme
← All packages
Content & media v0.62.10 New

@happyvertical/smrt-spreadsheets

Spreadsheet import for smrt: validated plans, workbook checks, batch loading through a target adapter, and a read-back proof.

Source ↗

What it gives you

Spreadsheet import for smrt: validated plans, workbook checks, batch loading through a target adapter, and a read-back proof.

  1. 01A plan maps sheet ranges to tables, columns to typed fields, and calculated fields
  2. 02checkPlan validates the plan against the workbook before anything is written
  3. 03runImport loads in batches through an ImportTarget and verifies the result with checkLoaded
  4. 04Export, saved mapping, and re-import are planned and not present

A person or a model proposes the plan

This package does not decide the plan. validatePlan checks its shape and limits. A plan that fails validation throws ImportPlanError. A workbook over the size limits is refused.

Nothing is guessed

coerceCell is the one typing rule. A cell that does not fit its field is refused, and its row never becomes a record. Money is an exact number of integer minor units. Integer sums are exact.

First import into an empty target

runImport refuses a target that already holds a planned table. If checkPlan reports errors, nothing is written. After a load, an unsuccessful verdict means the caller discards the draft target. The package never repairs.

Entries

The root entry exports types only. The import entry is pure and browser-safe. The testing entry holds createSqliteReferenceTarget, a Node-only SQLite target for tests.