
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@commercelayer/commercelayer-seeder
Advanced tools
> A Node JS library that lets you import predefines seed data into a Commerce Layer organization.
A Node JS library that lets you import predefines seed data into a Commerce Layer organization.
Commerce Layer is a headless platform that lets you easily build enterprise-grade ecommerce into any website, by using the language, CMS, and tools you already master and love.
This seeder is the easiest way to bulk import a set of products, the related prices, and inventory — based on one of the available business models — into your organization and start using Commerce Layer right away.
This seeder is built for Node.js and doesn't run in the browser.
To be ready to use the Commerce Layer Seeder, you need to install it and then get the credentials that will allow you to manage your organization in Commerce Layer.
Commerce Layer Seeder is available as an npm package:
// npm
npm install @commercelayer/commercelayer-seeder
// yarn
yarn add @commercelayer/commercelayer-seeder
You can use the ES6 default import as follows:
import seeder from '@commercelayer/commercelayer-seeder'
The seeder function returns a promise and you need to pass to it as a parameter an object containing:
clientId: string — your Commerce Layer application client ID (required)clientSecret: string — your Commerce Layer application client secret (required)endpoint: string — your Commerce Layer organization endpoint (required)businessModel: string — the kind of business model you want to import (required / choose among this list)maxItems: number — the maximum number of SKUs that will be imported (optional / default: all)resourcesUrl: string — the resources URL or local path (optional / default: our seeds directory)infoLog: boolean - view the information log during the process (optional / default: true)// default import — all the products, with related prices and inventory
seeder({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
endpoint: 'https://yourdomain.commercelayer.io',
businessModel: 'multi_market'
}).then((result) => {
console.log(result)
})
// custom import — 50 SKUs, local path, with related prices and inventory
seeder({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
endpoint: 'https://yourdomain.commercelayer.io',
businessModel: 'custom',
resourcesUrl: 'your-local-resources-directory'
maxItems: 50,
}).then((result) => {
console.log(result)
})



The promise returned by the seeder function is an array of objects, containing the full list the items imported, by ID:
[
{'address_1': 'byPVuGvQAW'},
// ...
{ merchant_1: 'eMBwVHdKmn' },
// ...
{ stock_location_1: 'gnWomumDNn' },
{ stock_location_2: 'vMQwjuwrbG' },
// ...
{ inventory_model_1: 'KaozeSXKdZ' },
{ inventory_model_2: 'kLpovSAjMW' },
// ...
{ inventory_stock_location_1: 'VWRmvInEve' },
{ inventory_stock_location_2: 'lkVMVIlXbW' },
// ...
{ price_list_1: 'zBMxECjbOL' },
{ price_list_2: 'AkebyCEWRl' },
// ...
{ market_1: 'wjvKBhQGag' },
{ market_2: 'YoPmehRpdj' },
{ market_3: 'EjDkXhMZao' },
// ...
{ shipping_category_1: 'ywpRoFraeK' },
// ...
{ shipping_zone_1: 'BOEwrtpzwv' },
// ...
{ shipping_method_1: 'XVzWbFkkrE' },
{ shipping_method_2: 'qOWbjFLnZE' },
// ...
{'SKUCODE0001XXXX': 'zBMxECjbOL'},
{'SKUCODE0002XXXX': 'cBKdCEgObJ'},
{'SKUCODE0003XXXX': 'rVDxESjeKG'},
// ...
{ price_1: 'BqkxSEzLDZ' },
{ price_2: 'WGDMSkgaAB' },
{ price_3: 'BwpOSbaKAn' },
// ...
{ stock_item_1: 'nOpOSvyGgZ' },
{ stock_item_2: 'nzPQSGebpW' },
{ stock_item_3: 'ZrxeSRlqbB' },
// ...
]
Commerce Layer provides a set of predefined business models so that you can choose and import your stater one based on your needs and business requirements. These are the business models available at the moment (more to come):
businessModel: 'multi_market'businessModel: 'custom'This repository is published under the MIT license.
FAQs
> A Node JS library that lets you import predefines seed data into a Commerce Layer organization.
We found that @commercelayer/commercelayer-seeder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.