Repository navigation
Description
Summary
Many brands already keep a product feed for Google or Facebook, or can export a CSV. Parsing those formats into one catalog shape lets a brand bring its catalog in without a store connection. The framework's reference connector (#1263) and the Merchant Center connector use these parsers.
This is a pure library with fixtures and tests. No network calls and no database.
Scope
-
Module:
server/src/lib/feeds/(new), with:parseCsvFeed(text, mapping?): a CSV with a header row. Common header names map by default (id,title,description,link,image_link,price,gtin,brand), and an explicit column mapping is optional.parseGoogleFeedXml(text): Google product feed XML, both RSS 2.0 with theg:namespace and Atom.parseFacebookCatalogCsv(text): the Facebook / Meta catalog CSV columns.
-
Output: one item per product in the catalog model's shape:
- id,
item_group_id, title, description, link, image link and additional images; - brand, GTIN, MPN, price and sale price (amount plus ISO currency, from values like
15.00 USD), availability, condition; - color, size, material, product type.
Keep the field names in sync with feat(integrations): a connector framework for stores and marketplaces, with a catalog model #1263.
- id,
-
Errors:
- A row missing a required field (id, title, link, price, availability) is skipped with a clear error: the row or item number, the field, and what was found.
- A file that isn't the expected format fails with one error, not thousands.
-
Size: a 50 MB feed parses without holding more than one copy in memory. XML can use
cheerioin XML mode, which the server already depends on (package.json). A small RFC 4180 CSV parser is enough: quoted fields, embedded commas and newlines. If you add a dependency, say why in the PR.
Acceptance criteria
- Fixtures for each format pass in
npm test, including:- a variant group (one
item_group_id, three colors); - prices with and without a currency;
- a quoted CSV field with a comma and a newline;
- a row missing
price, which is skipped with its row number in the error.
- a variant group (one
- A Google feed and a Facebook CSV describing the same products parse into the same items.
- No network or database access in the module.
Activity
feat(feeds): parse store CSVs, Google product feed XML and Meta catal…
feat(catalog): add the product catalog and its batch sync (00278, #1263…