feat: define validators and use normalize-products step (#12473)

Fixes: FRMW-2965

In this PR we replace/remove the existing step to normalize a CSV file with the newly written CSV normalizer and also we validate the file contents further using a Zod schema.

I have duplicated the schema for now. But it is makes sense to re-use the schema for CSV validating and `/admin/products/batch`, then I can keep one source of truth under utils and re-export it. WDYT?

**Screenshots of some errors after validating the file strictly**

![CleanShot 2025-05-15 at 16 36 46@2x](https://github.com/user-attachments/assets/c7fa424f-b947-4898-9b94-47c48617c129)

![CleanShot 2025-05-15 at 16 36 34@2x](https://github.com/user-attachments/assets/0fefef79-148b-4eeb-8ef0-3077e8063ea8)
This commit is contained in:
Harminder Virk
2025-05-16 08:37:25 +00:00
committed by GitHub
parent 2affc0d7d9
commit e149a99886
23 changed files with 1124 additions and 862 deletions
+1
View File
@@ -41,6 +41,7 @@
"@swc/core": "^1.4.8",
"@swc/jest": "^0.2.36",
"jest": "^29.7.0",
"json-2-csv": "^5.5.9",
"typescript": "^5.6.2"
}
}