Socket
Book a DemoInstallSign in
Socket

experiment-catalog-ingestor

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

experiment-catalog-ingestor

Package to help ingesting catalog data into Constructor.io ☕️

unpublished
latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Constructor.io Catalog Ingestor

npm Minzipped Size

A Node.js library for easily ingesting product catalogs into Constructor.io, using a strict type system.

This client is intended for use in server side integrations. If you want a JavaScript client for client side (i.e. front end) integrations please use @constructor-io/constructorio-client-javascript

Description

This package is meant to help in the process of ingesting your catalog data into Constructor.io. Internally, it relies on our public API.

Installation

First, install the package:

npm i @constructor/ingestor

Usage

To ingest data, you simply need to call the ingest method:

import { CatalogIngestionPayload, CatalogIngestor } from "@constructor-io/ingestor";

async function fetchData(): Promise<ExternalData> {
  // TODO: Implement your logic to fetch data here.

  return {};
}

function transformData(data: ExternalData): CatalogIngestionPayload {
  // TODO: Implement your logic to transform data here.
  // Here, we're just using an example dataset.

  return {
    groups: [
      {
        parent_id: null,
        name: "Shoes",
        id: "shoes",
      },
    ],
    items: [
      {
        id: "nike-shoes-brown",
        item_name: "Nike Shoes Brown",
        image_url: "https://images.nike.com/shoes-brown.jpg",
        url: "https://www.nike.com/shoes-brown",
        description: "Best shoes",
        group_ids: ["shoes"],
        active: "TRUE",
        metadata: [],
        keywords: [],
        facets: [
          {
            key: "Color",
            value: "Brown",
          },
          {
            key: "Size",
            value: ["M", "L", "XL"],
          },
        ],
      },
    ],
    variations: [],
  };
}

const catalogIngestor = new CatalogIngestor({
  constructorApiToken: "my-constructor-api-token",
});

await catalogIngestor.ingest(async () => {
  const data = await fetchData();
  return transformData(data);
});

Keywords

nodejs

FAQs

Package last updated on 06 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts