js-bao-wss-client / CsvImportOptions
Interface: CsvImportOptions
Properties
batchSize?
optionalbatchSize:number
Batch size for writes (default: 5000).
columnMap?
optionalcolumnMap:Record<string,string>
Map CSV column headers to field names (e.g. { "Product Name": "name" }).
csv?
optionalcsv:string
CSV string to parse. Provide either csv or data.
data?
optionaldata:Record<string,string>[]
Pre-parsed rows (array of objects). Provide either csv or data.
delimiter?
optionaldelimiter:string
CSV delimiter (default: ",".)
idColumn?
optionalidColumn:string
CSV column to use as the record ID.
idGenerator()?
optionalidGenerator: (row,index) =>string
Function to generate IDs for each row.
Parameters
row
Record<string, any>
index
number
Returns
string
model?
optionalmodel:any
Model identifier — a BaseModel subclass or plain string name.
modelName?
optionalmodelName:string
Model name as a plain string (alternative to model).
onBatchError()?
optionalonBatchError: (error,batchIndex) =>boolean|void
Called when a batch fails. Return false to abort.
Parameters
error
Error
batchIndex
number
Returns
boolean | void
onProgress()?
optionalonProgress: (progress) =>void
Progress callback fired after each batch.
Parameters
progress
Returns
void
operationName?
optionaloperationName:string
Name of the registered save operation to use for import (default: "save"). The operation must accept params: { modelName, id, data }.
syncIndexes?
optionalsyncIndexes:boolean
Sync indexes from the model schema after all data is written. Only applies when model is a BaseModel class (not a string). Defaults to true — set to false to skip post-import indexing.
transform()?
optionaltransform: (row,index) =>Record<string,any> |null
Transform function called per row. Return null to skip a row.
Parameters
row
Record<string, any>
index
number
Returns
Record<string, any> | null
types?
optionaltypes:Record<string,"string"|"number"|"boolean">
Explicit type coercion map (field name → target type).