Types
Use x.row() to define the schema you pass to CSVImporter. Each field controls how uploaded values are parsed, validated, labeled, and typed before they reach your app.
Basic Usage
Each key becomes a column the user maps to. The field type determines how values are parsed and validated before your onData callback or webhook runs.
Field Types
- String -
x.string() - Number -
x.number() - Boolean -
x.boolean() - Date -
x.date() - Time -
x.time() - Datetime -
x.datetime() - Select -
x.select() - Multiselect -
x.multiselect()
Custom Validation
Use Refine for custom validators with .refine(), .refineBatch(), and suggested fixes.
Dynamic Schemas
You can build the schema conditionally before constructing CSVImporter:
If you use dynamic elements while assembling a schema, Infer<typeof schema> can widen because the exact keys are no longer guaranteed at compile time.
Use dynamic schema assembly intentionally when you need runtime-driven columns.
TypeScript Inference
Use Infer<typeof schema> to extract the validated row type from your schema:
When you use that schema with CSVImporter, chunk.records is inferred automatically inside onData, so you usually do not need manual type annotations.