fuse-importer 0.25.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/lib/main.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,8 +98,8 @@ If you don’t have an Importer yet, you can go over [Create Your First Importer
|
|
|
98
98
|
const importer = new FuseImporter(organizationApiKey, importerId);
|
|
99
99
|
|
|
100
100
|
importer.onValidateRecord = async (record) => {
|
|
101
|
-
// return no frontend validation errors
|
|
102
|
-
return {};
|
|
101
|
+
// return no frontend validation errors or warnings
|
|
102
|
+
return { errors: {}, warnings: {} };
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
importer.onSubmit = async (records) => {
|
|
@@ -184,9 +184,8 @@ The `onValidationRecord` hook is called for each row (record) that a customer up
|
|
|
184
184
|
|
|
185
185
|
Return values:
|
|
186
186
|
|
|
187
|
-
- If the record has no errors, we expect you to return an empty object: `return {}`.
|
|
188
|
-
- If the record has validation errors, you can specify them like below.
|
|
189
|
-
- If the record has validation warnings, you can specify them like so:
|
|
187
|
+
- If the record has no errors, we expect you to return an empty object: `return { errors : {}, warnings: {} }`.
|
|
188
|
+
- If the record has validation errors/warnings, you can specify them like below.
|
|
190
189
|
|
|
191
190
|
```typescript
|
|
192
191
|
importer.onValidateRecord = async (record) => {
|
|
@@ -207,7 +206,11 @@ importer.onValidateRecord = async (record) => {
|
|
|
207
206
|
};
|
|
208
207
|
```
|
|
209
208
|
|
|
210
|
-
|
|
209
|
+
The differences between errors and warnings are:
|
|
210
|
+
|
|
211
|
+
- `warnings` will still allow you to submit the spreadsheet, unlike `errors`.
|
|
212
|
+
- `errors` have a higher priority than warnings, which means if a record has both, you will not be able to see warnings until you fix errors first.
|
|
213
|
+
- Any `errors` must be fixed before the user submits an importer. The user will not be able to submit without fixing all errors.
|
|
211
214
|
|
|
212
215
|
#### `formatRecord`
|
|
213
216
|
|