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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@stackd-solutions/medusa-sdk

v0.1.2

Published

Extended Medusa SDK client

Downloads

270

Readme

An extended Medusa v2 SDK client with typed endpoints for StackD Solutions plugins. It extends @medusajs/js-sdk with a plugin system that adds fully typed methods for each plugin's API.

Installation

yarn add @stackd-solutions/medusa-sdk @medusajs/js-sdk

Usage

import {StackdMedusaSdk, emailVerificationPlugin, passwordManagerPlugin, wishlistPlugin} from '@stackd-solutions/medusa-sdk'

const sdk = new StackdMedusaSdk(
	{
		baseUrl: 'http://localhost:9000',
		auth: {type: 'session', jwtTokenStorageKey: 'medusa_auth_token'}
	},
	[emailVerificationPlugin, passwordManagerPlugin, wishlistPlugin] as const,
	{
		getAuthHeader: async () => ({
			Authorization: `Bearer ${localStorage.getItem('medusa_auth_token')}`
		})
	}
)

// All plugin endpoints are available under sdk.stackd
const status = await sdk.stackd.emailVerification.getVerificationStatus()

Available Plugins

| Plugin | Namespace | Description | | ------------------ | ------------------------------ | --------------------------------------------------- | | Email Verification | sdk.stackd.emailVerification | Send, verify, and check customer email verification | | Password Manager | sdk.stackd.passwordManager | Change customer passwords | | Wishlist | sdk.stackd.wishlist | Create, manage, and share product wishlists |

Email Verification

Companion SDK for the @stackd-solutions/medusa-email-verification plugin. Provides typed methods for the email verification store API.

import {emailVerificationPlugin} from '@stackd-solutions/medusa-sdk'

Functions:

| Function | Description | | ----------------------- | --------------------------------------------------------- | | sendVerificationEmail | Send a verification email to the authenticated customer | | verifyToken | Verify an email token | | getVerificationStatus | Get the verification status of the authenticated customer |

Example:

// Send verification email
await sdk.stackd.emailVerification.sendVerificationEmail({
	callback_url: 'https://mystore.com/email/verify'
})

// Verify token from email link
const result = await sdk.stackd.emailVerification.verifyToken({
	token: 'abc123'
})

// Check verification status
const {verified} = await sdk.stackd.emailVerification.getVerificationStatus()

Password Manager

Companion SDK for the @stackd-solutions/medusa-password-manager plugin. Provides a typed method for the password change store API.

import {passwordManagerPlugin} from '@stackd-solutions/medusa-sdk'

Functions:

| Function | Description | | ---------------- | -------------------------------------------- | | changePassword | Change the authenticated customer's password |

Example:

await sdk.stackd.passwordManager.changePassword({
	current_password: 'old-password',
	new_password: 'new-password'
})

Wishlist

Companion SDK for the @stackd-solutions/medusa-wishlist plugin. Provides typed methods for the wishlist store API.

import {wishlistPlugin} from '@stackd-solutions/medusa-sdk'

Functions:

| Function | Description | | ------------ | --------------------------------------- | | list | List wishlists for the current customer | | create | Create a new wishlist | | retrieve | Retrieve a wishlist by ID | | update | Update wishlist metadata | | delete | Delete a wishlist | | listItems | List items in a wishlist | | addItem | Add a product variant to a wishlist | | removeItem | Remove an item from a wishlist |

Examples:

// List wishlists
const {data} = await sdk.stackd.wishlist.list({limit: 10, offset: 0})

// Create a wishlist
const {data: wishlist} = await sdk.stackd.wishlist.create({
	name: 'My Favorites',
	sales_channel_id: 'sc_123'
})

// Retrieve a wishlist
const {data: wishlist} = await sdk.stackd.wishlist.retrieve('wl_123')

// Update a wishlist
const {data: wishlist} = await sdk.stackd.wishlist.update('wl_123', {
	name: 'Updated Name',
	visibility: 'public'
})

// Delete a wishlist
await sdk.stackd.wishlist.delete('wl_123')

// List items in a wishlist
const {data: items} = await sdk.stackd.wishlist.listItems('wl_123', {limit: 10, offset: 0})

// Add an item to a wishlist
const {data: item} = await sdk.stackd.wishlist.addItem('wl_123', {
	product_variant_id: 'variant_123'
})

// Remove an item from a wishlist
await sdk.stackd.wishlist.removeItem('wl_123', 'variant_123')

Plugin System

The SDK uses a generic plugin system. Each plugin registers a set of typed endpoints under a named key:

import {Plugin, StackdMedusaSdk} from '@stackd-solutions/medusa-sdk'

const myPlugin: Plugin<'myPlugin', MyEndpoints> = {
	name: 'myPlugin' as const,
	endpoints: (sdk, options, medusaConfig) => ({
		// your typed endpoint methods
	})
}

const sdk = new StackdMedusaSdk(medusaOptions, [myPlugin] as const)
sdk.stackd.myPlugin // fully typed

Types

The SDK exports the following types:

import type {StackdClientOptions, StackdMedusaConfig, Plugin, PluginsToStackd} from '@stackd-solutions/medusa-sdk'

| Type | Description | | --------------------- | ------------------------------------------------------------ | | StackdClientOptions | Options passed to plugins (e.g. getAuthHeader) | | StackdMedusaConfig | Constructor parameters for the underlying @medusajs/js-sdk | | Plugin | Plugin definition with a name and endpoint factory | | PluginsToStackd | Utility type that maps a plugin tuple to its endpoint types |

Build

yarn build

Development

yarn dev

License

Apache 2.0