npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@space48/sdm

v1.1.0

Published

Command line tools for piping data in and out of APIs

Readme

SDM

NPM Publish

Installation


Check the pre-requisites for installation and then install sdm using npm:

npm i @space48/sdm

Pre-requisites for installation

Install sdm

Install sdm from npm:

npm install @space48/sdm

Enable node 20

sdm uses node 20. Use nvm to enable node 20:

nvm use 20

Local Setup

SDM currently has four connectors, these are: Magento 1, Magento 2, Shopify and Big Commerce. To add a new connection to shop on any of these platforms to run locally run

npx sdm config

This will start the sdm-config interaction mode, which supports tab-completion. From here you can run help to get a full list of commands.

Using sdm-config

  1. List currently saved scopes

    connectors[*].scopes.list
  2. Setup a conection to a new store E.g A new Big Commerce store

    connectors[bigCommerce].scopes.add {"storeAlias":"demo-store","storeHash":"123abc456def","credentials":{"clientId":"longAlphaNumericString123","accessToken":"anotherLongAlphaNumericString456"}}

    Running the previous command without arguments will return a list of what is missing

    connectors[shopify].scopes.add
  3. Get the credentials of a previously saved connection

    connectors[bigCommerce].scopes[demo-store].get

Usage

SDM can be used in one of multiple ways, although they all follow the same format of entity.sub-entity.crud-command

Interactive mode (for use in terminals)


Note: supports tab-completion

Run npx sdm to display a list of currently saved scopes. To setup a new scope follow the local setup

Enter a scope such as big-commerce[demo-store]

From here all SDM endpoints in relation to the connector can be used with their response values being displayed on the terminal such as:

categories.tree.list

For commands that require an ID these are passed in using square brackets

products[123].custom-fields.list

Command inputs are done using a single object

brands.create {name: "Demo Brand", page_title: "Test Title"}

May also use the help to get a full list commands

Makefile


Once a local connection to a store has been created

Connect to a store create an instance of SDM at the top of the makefile

sdm = npx sdm
big-commerce= $(sdm) big-commerce[demo-store]

SDM can then be used as such:

$(big-commerce).blog.posts.list

To input data, whether as part of the path (such as an id), or as the body of the request these need to be "piped" into the SDM instance

echo "{id: 1, body: "Updated blog text", "url":"/your-first-blog-post/"}" \
| jq -c '{ path: ["blog", ["posts", .id]], endpoint: "update", input: del(.id) }' \
| $(big-commerce)

In a similar fashion input params can be passed into the input property

echo "[1,2,3,4,5]" \
| jq -c '.[] | {path: ["customers", "addresses"], endpoint: "delete", input: {"id:in": .}}' \
| $(big-commerce)

In TS mode


The following example shows how a SDM connection can be created and used directly in a TS script

import {ConnectorScope, shopify} from "@space48/sdm";
import {writeJsonLinesTo, pipe} from "@space48/json-pipe";


type ShopApiCredentials = {
    apiKey: string
    password: string
};

async function getConnectorScope(credentials: ShopApiCredentials) {
    return shopify({
        shopName: "shopify-demo-story",
        apiKey: credentials.apiKey,
        password: credentials.password        
    })
}

export async function listProducts() {
    const shop: ConnectorScope = await getConnectorScope(apiCredentials);

    pipe(
        shopify.product.list({fields: 'id,tags,variants', limit: 250}),
        command => shop.execute(command),
        writeJsonLinesTo(process.stdout)
    )
}