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

super-matcher-sdk

v1.0.18

Published

A front client to perform super-matcher api calls

Readme

Getting started

You must init the library before to use any other function. Exemple with ES2015 syntax:

import { init } from 'super-matcher-sdk';

init({
    host: 'http://localhost:8000 // Don't add a "/" at the end of the host
});

If you already have a refresh token (e.g from a cookie or the localstorage), you can also pass this value to your init call. The refresh token will be exchange before the first API call to obtain a new access token. This new access token will be internally store and use for each call until it expires.

import { init } from 'super-matcher-sdk';

init({
    host: 'http://localhost:8000,
    refreshToken: localStorage.getItem('refreshToken')
});

Error handling

The library uses fetch web api to consume Rest API. Every library function return a promise. If the http status code is in range [200, 300`[, the promise will be resolve and you will obtain the response body as the promise parameter. Otherwise, the promise is rejected and you will be able to handle your error in your way with the Response object. Exemple :

    import { signIn } from 'super-matcher-sdk';

    signIn('username', 'password')
    .then(res => {
        // Handle your sucessfull response
        // Here res is a SignInResponse object
    })
    .catch(res => {
        // Handle your failed call
        // Here res is a Response object

        // res.json() will return a promise of ErrorResponse parameter
    })

Default Reponse and Error

Two default objets are used :

interface SuccessResponse {
    message: string;
}

interface ErrorResponse {
    code: string;
    error: string;
}

SuccessReponse represents a default success response. ErrorResponse reprensents the common way to format error.

Locales

Every sentences are translated. The default accepted locate is en_US. The current available locales are: en_US, fr_FR

There is two ways to set the locale:

  • globally
    import { setLocale } from 'super-matcher-sdk';

    setLocale('fr_FR');

    // Every function will now return sentences in French
  • locally You can pass the locale to your function when accepted:
    import { getAllRarity } from 'super-matcher-sdk';

    getAllRarity('fr_FR').then(rarities => {
        for (const rarity of rarities) {
            // here rarity.name is french
        }
    })

Get all locales

  • Role: user

function getAllLocales(): Promise<Locale[]>

export interface Locale {
    id: string;
    descriptions: string;
}

Token

Initialize the library

function init(config: InitConfig)

Retrive the access token

function getAccessToken(): string

Does the user have an admin role ?

function isAdmin(): boolean

Does the user have a user role ?

function isUser(): boolean

Users

Sign in

signIn(email: string, password: string): Promise<SignInResponse>

interface SignInResponse {
    expiredIn: number;
    tokenType: string;
    accessToken: string;
    refreshToken: string;
}

Create user

createUser(userData: { username: string, password: string, email: string }): Promise<void>

Logout user

disconnect(): Promise<SuccessResponse>

Cards

Get all cards

  • Role: user

getAllCards(): Promise<Card>

interface Card {
    id: number;
    attack: number;
    cost: number;
    hp: number;
    image: string;
    name: string;
    rarity: string;
}

Rarity

Get all rarities

  • Role: user

function getAllRarities(locale?: string): Promise<Rarity[]>

export interface Rarity {
    id: number;
    name: string;
}

Create rarity

  • Role: admin

function createRarity(uniqueName: string, name: {[localeId: string]: string})