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

@ircg/uss

v1.20.9

Published

URL Shortener Service SDK for IRCG

Downloads

9

Readme

@ircg/uss

URL Shortener Service (USS) SDK for IRCG.

Installation

pnpm add @ircg/uss

Usage

import { USSClient } from '@ircg/uss';

// Initialize the client
const uss = new USSClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://ircg.dev' // optional, defaults to https://ircg.dev
});

// Create a shortened URL
const result = await uss.create({
  url: 'https://example.com/very/long/url'
});

console.log(result.shortenedUrl.urlKey); // e.g., "abc123"
console.log(`Short URL: https://ircg.dev/l/${result.shortenedUrl.urlKey}`);

// Get all shortened URLs
const urls = await uss.getAll({
  page: 1,
  amount: 50,
  ascending: false,
  fields: ['urlKey', 'originalUrl', 'id', 'hits', 'active', 'createdAt']
});

console.log(urls.shortenedUrls);
console.log(`Total: ${urls.totalAmount}`);

// Get a specific shortened URL by key
const url = await uss.getByKey('abc123');
console.log(url.shortenedUrl.originalUrl);

// Delete a shortened URL
await uss.delete('abc123');

API Reference

USSClient

Constructor

new USSClient(config: IRCGClientConfig)
  • config.apiKey (required): Your IRCG API key
  • config.baseUrl (optional): Base URL for the API (default: 'https://ircg.dev')

Methods

create(data)

Create a shortened URL.

  • data.url (required): The URL to shorten
  • data.fields (required): Array of fields to include in the response
  • data.lang (optional): Language for error messages ('es' | 'en')

Returns: Promise<{ shortenedUrl?, error? }>

getAll(options)

Get all shortened URLs with pagination.

  • options.page (optional): Page number (default: 1)
  • options.amount (optional): Items per page (default: 50)
  • options.ascending (optional): Sort order (default: false)
  • options.fields (required): Array of fields to include in the response
  • options.lang (optional): Language for error messages ('es' | 'en')

Returns: Promise<{ shortenedUrls?, totalAmount?, error? }>

getByKey(urlKey, fields)

Get a shortened URL by its key.

  • urlKey (required): The URL key
  • fields (required): Array of fields to include in the response

Returns: Promise<{ shortenedUrl?, error? }>

delete(urlKey)

Delete a shortened URL.

  • urlKey (required): The URL key to delete

Returns: Promise<DeleteShortenedUrlResponse>

Error Handling

import { USSClient } from '@ircg/uss';
import { IRCGError, IRCGAuthenticationError, IRCGValidationError } from '@ircg/core';

const uss = new USSClient({ apiKey: 'your-api-key' });

try {
  await uss.create({ url: 'invalid-url' });
} catch (error) {
  if (error instanceof IRCGAuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof IRCGValidationError) {
    console.error('Validation error:', error.details);
  } else if (error instanceof IRCGError) {
    console.error('IRCG error:', error.message);
  }
}

License

MIT