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

@ananthapadma.s/test-sdk-5

v1.0.0

Published

SDK for integrating with the Stylist POS system

Readme

Stylist SDK

A TypeScript SDK for interacting with the Stylist API. This SDK provides a simple and type-safe way to interact with the Stylist platform's API endpoints.

Features

  • Type-safe API calls
  • Authentication handling
  • Cart management
  • Error handling
  • Response interceptors and middleware
  • Swagger UI for testing and documentation
  • shadcn UI components for consistent and accessible UI elements

Project Structure

StylistSDK/
├── src/                          # SDK source code
│   ├── config/                   # API configurations
│   ├── errors/                   # Error definitions
│   ├── interfaces/               # Type definitions
│   ├── middleware/               # Request/response interceptors
│   │   └── logging-middleware.ts # Debug logging
│   ├── services/                 # Core functionality
│   ├── ui/                       # UI components
│   │   └── shadcn/               # shadcn UI components
│   │       ├── components/       # Reusable UI components
│   │       ├── lib/              # Utility functions
│   │       └── styles/           # Global styles and themes
│   ├── utils/                    # Utility functions
│   │   └── network-controller.ts # HTTP request handling
│   └── index.ts                  # Main SDK entry point
├── swagger-ui/                   # Swagger UI testing interface
│   ├── src/                      # React components
│   │   └── components/           # Swagger UI component
│   └── public/                   # Static files
├── assets/                       # Build output
└── package.json                  # SDK dependencies

Installation

npm install @stylist/sdk

Usage

Initialization

import { StylistSDK } from '@stylist/sdk';

const sdk = new StylistSDK({
  baseUrl: 'https://stylist-master.xyretail.com',
  apiKey: 'your-api-key'
});

Authentication

// Verify user credentials
const authResponse = await sdk.auth.verifyCredentials({
  username: '[email protected]',
  password: 'password123'
});

// Handle authentication errors
try {
  await sdk.auth.verifyCredentials(credentials);
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Authentication failed:', error.message);
  }
}

Cart Management

// Create a new cart
const cart = await sdk.cart.createCart();

// Add items to cart
const cartItems = await sdk.cart.addItems(cart.cartId, {
  items: [{
    productId: '123',
    quantity: 1
  }]
});

// Get cart details
const cartDetails = await sdk.cart.getCart(cart.cartId);

// Remove item from cart
await sdk.cart.removeItemFromCart(cart.cartId, 'item-id');

// Set customer in cart
await sdk.cart.setCustomerInCart(cart.cartId, {
  id: 'customer-id',
  name: 'John Doe',
  email: '[email protected]'
});

// Navigate to cart
sdk.cart.goToCart({ 
  cartUri: '/cart/123',
  inApp: true // Set to false to open in new window
});

Response Interceptors

import { LoggingMiddleware } from '@stylist/sdk/middleware';

// Add logging middleware
sdk.addMiddleware(new LoggingMiddleware());

// Custom middleware example
class CustomMiddleware implements ResponseInterceptor {
  async onSuccess(response: Response): Promise<Response> {
    // Handle successful responses
    return response;
  }

  async onError(error: Error): Promise<never> {
    // Handle errors
    throw error;
  }
}

Error Handling

try {
  await sdk.cart.addItems(cartId, items);
} catch (error) {
  if (error instanceof ValidationError) {
    console.error('Invalid input:', error.message);
  } else if (error instanceof NetworkError) {
    console.error('Network error:', error.message);
  } else {
    console.error('Unexpected error:', error);
  }
}

Development

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Setup

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build the SDK: npm run build

UI Components

The SDK includes a set of reusable UI components built with shadcn/ui. These components are:

  • Fully accessible
  • Customizable through Tailwind CSS
  • Dark mode compatible
  • Type-safe with TypeScript

Available components:

  • Button
  • Input
  • Card
  • Badge

To use these components:

import { Button } from '@/ui/shadcn/components/button';
import { Input } from '@/ui/shadcn/components/input';
import { Card } from '@/ui/shadcn/components/card';
import { Badge } from '@/ui/shadcn/components/badge';

Testing Interface

The SDK includes a Swagger UI interface for testing API endpoints. To access it:

  1. Navigate to the swagger-ui directory: cd swagger-ui
  2. Install dependencies: npm install
  3. Start the development server: npm run dev
  4. Open http://localhost:5174 in your browser

The Swagger UI provides:

  • Interactive API documentation
  • Endpoint testing interface
  • Request/response schemas
  • Authentication testing

API Endpoints

Authentication

  • /_a/actionSheet.xyidentity.VerifyCredentialsV2Action - Verify user credentials

Cart Management

  • /cart - Create a new cart
  • /cart/{cartId} - Get cart details
  • /cart/{cartId}/items - Add items to cart

Error Handling

The SDK includes comprehensive error handling for various API scenarios:

try {
  await sdk.auth.verifyCredentials(credentials);
} catch (error) {
  if (error instanceof AuthenticationError) {
    // Handle authentication errors
  } else if (error instanceof ValidationError) {
    // Handle validation errors
  } else {
    // Handle other errors
  }
}

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add: amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.