← back to Interiordesignershowroom

lib/adapters/index.js

23 lines

// Adapter registry. Each adapter module implements the SAME contract:
//
//   module.exports = {
//     network: 'cj',                       // one of normalize.VALID_NETWORKS
//     enabled(env) -> boolean,             // true only when required creds are present
//     async fetch(env, { limit }) -> rawProduct[]   // pre-normalize objects
//   }
//
// A rawProduct is whatever fields lib/normalize.normalizeProduct() reads:
//   { advertiser, external_id, title, description, brand, category,
//     price, sale_price, currency, image_url, affiliate_url, in_stock }
// The adapter's ONLY job is to talk to its network and map that network's
// response into this shape. normalize.js does taxonomy + validation downstream.
//
// Adapters must NEVER throw on missing creds — return [] (and enabled()=false).

module.exports = [
  require('./cj'),
  require('./amazon'),
  require('./rakuten'),
  require('./shareasale'),
];