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 authored and GitHub committed 2025-05-16 08:37:25 +00:00
1 parent 2affc0d7d9
commit e149a99886
23 files changed
+1124 -862

No files matched your search

+11
View File
@@ -23530,6 +23530,7 @@ __metadata:
"@swc/jest": ^0.2.36
form-data: ^4.0.0
jest: ^29.7.0
json-2-csv: ^5.5.9
jsonwebtoken: ^9.0.2
pg: ^8.11.3
typescript: ^5.6.2
@@ -25062,6 +25063,16 @@ __metadata:
languageName: node
linkType: hard
"json-2-csv@npm:^5.5.9":
version: 5.5.9
resolution: "json-2-csv@npm:5.5.9"
dependencies:
deeks: 3.1.0
doc-path: 4.1.1
checksum: 109b7636ba3ef9b8c53580f89280568e1ecd106b6328f44636869a62eac1f9f2db7a52de0eee04832fa20d4bd9c592ad3fe1a4cf06af0eee3ee612b85f29ed75
languageName: node
linkType: hard
"json-buffer@npm:3.0.1":
version: 3.0.1
resolution: "json-buffer@npm:3.0.1"