# Code Deb Product Feeds SDK

**Target release:** `@codedeb/product-feeds@0.1.0` passed isolated package and TypeScript consumer tests. This exact version is not yet independently verified on the public npm registry.

Google Merchant product feeds and API input — intended for developers building reliable storefronts, search infrastructure and production applications. Unlike a hosted platform, the SDK does not require a Code Deb account for its pure functions.

## Build, test and stage

```bash
npm ci
npm run test:nepal-sdks
npm run sdk:pack:verify
node scripts/sdk/stage-npm-package.mjs sdk-product-feeds
```

These commands prepare the candidate without publishing it. Review the generated `.sdk-artifacts/npm-stage/sdk-product-feeds` contents and all licenses. After a successful, independently verified npm release, the installation command will be `npm install @codedeb/product-feeds`. Do not advertise this command as publicly working before release verification.

## Quickstart using implemented exports

```ts
import {toMerchantProductInput} from '@codedeb/product-feeds';
const product=toMerchantProductInput({offerId:'TEA01',title:'Nepal tea',description:'Loose leaf tea',link:'https://example.com/tea',imageLink:'https://example.com/tea.webp',availability:'in_stock',priceMinor:15900,currency:'NPR'});
console.log(product.productAttributes.price);
```

## Public API contract

| Entry point or function | Responsibility |
| --- | --- |
| `validateFeedItem(item)` | Validate offer identity, HTTPS source URLs, price and stock availability |
| `toMerchantProductInput(item)` | Produce a Google Merchant API ProductInput structure |
| `toMerchantTsv(items)` | Export bounded tab-delimited product records safely |
| `planFeedSync(previous,current)` | Plan upserts, deleted offers and unchanged product records |

## Production integration

The Merchant API requires an account, authorized data-source configuration and independent approval. Published offers must match the live landing page price/availability. A 200 response to an insert does not mean a listing is approved.

The published SDK must have bounded resource use, correct authentication boundaries where applicable, and tests for malformed input. Caller-owned storage, OAuth, background jobs or hosted services must be configured explicitly rather than invented by the library.

## Compatibility and release history

- **0.1.0 candidate — 21 November 2026:** First implementation of the documented independent module, subject to the complete release gate.
- JavaScript ESM with generated TypeScript declarations; Node.js 20+ for Node execution.
- No npm publication, hosted API, SLA, vendor certification, ranking guarantee or customer data access is implied by this candidate.
- Code Deb-owned package code is intended for Apache-2.0 distribution. Third-party dependencies, data and trademarks retain their own terms.

## References and related SDKs

- [Developer SDK index](/docs/sdk)
- [Code Deb Developer resources](/docs/resources)
- [Reference standards and vendor documentation](https://developers.google.com/merchant/api/guides/products/overview)
- [Merchant structured data extension](/docs/sdk/seo)



## Production architecture and data flow

1. Normalize stable offer IDs, image URLs and real stock state before creating a feed.
2. Use explicit currencies and minor-unit prices, not display-formatted numbers.
3. Compare previous and next feed state before deleting outdated products.
4. Submit only through the merchant's authorized Google API account and inspect approval outcomes.

## Install only after npm verification

```bash
npm view @codedeb/product-feeds@0.1.0 version
# Install after the exact target version is publicly retrievable:
npm install @codedeb/product-feeds@0.1.0
```

A passing offline ESM consumer check confirms a good package boundary, not that npm accepted a public upload. Verify the registry version, latest dist-tag and downloadable tarball before marking the target version as publicly installable.

## Acceptance tests for production commerce

- Check malformed products, zero or extreme quantities, duplicate identities and cross-tenant requests.
- Use minor monetary units throughout totals and verify conservation of discounts, holds or prices.
- Simulate concurrent server workers and idempotent retries where the SDK relies on persistence.
- Review data provenance, access policy, and external merchant API authorization separately.

## Troubleshooting

**Missing npm version:** Check [the package listing](https://www.npmjs.com/package/@codedeb/product-feeds) before trying another version. **Mismatch between displayed and charged amount:** Verify the consumer's tax basis, currency minor units and rounding policy. **Oversell or duplicate campaign redemption:** Fix the application's transactional data adapter; an SDK calculation does not replace a unique database constraint.

## Related developer SDKs

[catalog engine](/docs/sdk/catalog-engine) · [seo](/docs/sdk/seo) · [All SDKs](/docs/sdk) · [Developer resources](/docs/resources)
