| 1 | import { ParseConfig } from "papaparse"; |
| 2 | |
| 3 | export interface ImportConfig { |
| 4 | // Enable logging |
| 5 | logging?: boolean; |
| 6 | // Disable the attempt to use "createMany", will instead just use "create" calls |
| 7 | disableCreateMany?: boolean, |
| 8 | // Disable the attempt to use "updateMany", will instead just use "update" calls |
| 9 | disableUpdateMany?: boolean, |
| 10 | // Disable the attempt to use "getMany", will instead just use "getOne" calls |
| 11 | disableGetMany?: boolean, |
| 12 | // Disable "import new" button |
| 13 | disableImportNew?: boolean; |
| 14 | // Disable "import overwrite" button |
| 15 | disableImportOverwrite?: boolean; |
| 16 | // A function to translate the CSV rows on import |
| 17 | preCommitCallback?: PrecommitCallback; |
| 18 | // A function to handle row errors after import |
| 19 | postCommitCallback?: ErrorCallback; |
| 20 | // Transform rows before anything is sent to dataprovider |
| 21 | transformRows?: (csvRows: any[]) => Promise<any[]>; |
| 22 | // Async function to Validate a row, reject the promise if it's not valid |
| 23 | validateRow?: ValidateRowFunction; |
| 24 | // Any option from the "papaparse" library, for all options see: https://www.papaparse.com/docs#config |
| 25 | parseConfig?: ParseConfig, |
| 26 | }; |
| 27 | |
| 28 | export type PrecommitCallback = (action: "create" | "overwrite", values: any[]) => Promise<any[]>; |
| 29 | export type ValidateRowFunction = (csvRowItem: any, index?: any, allItems?: any[]) => Promise<void>; |
nothing calls this directly
no outgoing calls
no test coverage detected