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

@uppercase-m/colonyone-sdk

v0.1.5

Published

ColonyOne Platform SDK — framework-agnostic TypeScript client for commerce, content, auth, and loyalty APIs

Downloads

16

Readme

@uppercase-m/colonyone-sdk

npm version

Framework-agnostic TypeScript SDK for the ColonyOne Platform. Access commerce, content, authentication, and loyalty features from any frontend.

Installation

pnpm add @uppercase-m/colonyone-sdk

Or with npm:

npm install @uppercase-m/colonyone-sdk

Or with yarn:

yarn add @uppercase-m/colonyone-sdk

Quick Start

import { ColonyOne } from '@uppercase-m/colonyone-sdk'

const client = new ColonyOne({
  baseUrl: 'https://your-colonyone-instance.com',
  apiKey: 'pk_live_...',
})

// List products
const { data: products } = await client.commerce.products.list()
console.log(products)

Namespaces

Commerce

Access products, cart, checkout, orders, customers, and banners.

client.commerce.products.list()
client.commerce.products.get(id)
client.commerce.cart.create({ region_id })
client.commerce.cart.get(cartId)
client.commerce.cart.addItem(cartId, { variant_id, quantity })
client.commerce.checkout.createPaymentSessions(cartId)
client.commerce.checkout.complete(cartId)
client.commerce.orders.list()
client.commerce.customers.get()
client.commerce.banners.list()

Content

Manage pages, posts, media, categories, and global settings.

client.content.pages.getBySlug(slug)
client.content.posts.list()
client.content.media.get(id)
client.content.categories.list()
client.content.globals.get(slug)

Auth

Handle login, registration, logout, session management, and password reset.

client.auth.login({ email, password })
client.auth.register({ email, password, first_name, last_name })
client.auth.logout()
client.auth.session()
client.auth.forgotPassword({ email })
client.auth.resetPassword({ email, token, password })

Loyalty

Earn and redeem points, manage tiers, access rewards, and track referrals.

client.loyalty.points.balance()
client.loyalty.points.history()
client.loyalty.tiers.current()
client.loyalty.rewards.list()
client.loyalty.rewards.redeem({ reward_id })
client.loyalty.referrals.getLink()
client.loyalty.referrals.status()

Authentication

Login Flow

const { customer, accessToken } = await client.auth.login({
  email: '[email protected]',
  password: 'password',
})

// Token is automatically stored and included in subsequent requests
console.log(customer.email)
console.log(accessToken)

Session Management

// Get current customer profile (requires prior login or setAccessToken)
const customer = await client.auth.session()

// Listen for auth state changes via the onAuthStateChange config callback
const client = new ColonyOne({
  baseUrl: 'https://your-colonyone-instance.com',
  apiKey: 'pk_live_...',
  onAuthStateChange: (state) => {
    if (state.authenticated) {
      console.log('Logged in')
    } else {
      console.log('Logged out')
    }
  },
})

Error Handling

All errors thrown by the SDK are instances of ColonyOneError:

import { ColonyOneError } from '@uppercase-m/colonyone-sdk'

try {
  await client.commerce.products.get('invalid-id')
} catch (error) {
  if (error instanceof ColonyOneError) {
    console.log(error.code) // Machine-readable code
    console.log(error.statusCode) // HTTP status code
    console.log(error.message) // Human-readable message
    console.log(error.details) // Additional context
  }
}

Tree-Shaking

Import from sub-paths to enable tree-shaking:

import { CommerceClient } from '@uppercase-m/colonyone-sdk/commerce'
import { ContentClient } from '@uppercase-m/colonyone-sdk/content'
import { AuthClient } from '@uppercase-m/colonyone-sdk/auth'
import { LoyaltyClient } from '@uppercase-m/colonyone-sdk/loyalty'

Next.js App Router

Use React cache() for per-request SDK instances:

import { cache } from 'react'
import { ColonyOne } from '@uppercase-m/colonyone-sdk'

const getSDK = cache(() => {
  return new ColonyOne({
    baseUrl: process.env.NEXT_PUBLIC_COLONYONE_URL!,
    apiKey: process.env.COLONYONE_API_KEY!,
  })
})

export default async function Page() {
  const sdk = getSDK()
  const { data: products } = await sdk.commerce.products.list()

  return <div>{/* Render products */}</div>
}

Debug Mode

Enable debug logging to troubleshoot API calls:

const client = new ColonyOne({
  baseUrl: 'https://your-colonyone-instance.com',
  apiKey: 'pk_live_...',
  debug: true,
})

Health Check

Verify SDK connectivity:

// Basic health check
const health = await client.health()

// Deep health check (includes all service dependencies)
const deepHealth = await client.health({ deep: true })

API Reference

See TypeScript declarations for the full API reference. All types and method signatures are available in the package's type definitions.

Requirements

  • Node.js 18+
  • TypeScript 5.0+

License

UNLICENSED (Private/Proprietary)