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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@isloth/common-lib

v0.2.123

Published

shared codes

Readme

common-lib

Shared code for all services

Build Library

npm run prepare

Installation

Install

npm install @isloth/common-lib

Install/Update by latest version

npm install @isloth/common-lib@latest

Enums

  • CurrencyCode: ISO 4217 currency codes enumeration. Each member of this enum represents a three-letter currency code as defined by the ISO 4217 standard
classDiagram
    class CurrencyCode {
        <<enumeration>>

        AED // United Arab Emirates Dirham
	    AFN // Afghanistan Afghani
	    ALL // Albania Lek
	    AMD // Armenia Dram
	    ANG // Netherlands Antillean Guilder
        ...
        ZMW // Zambia Kwacha
	    ZWL // Zimbabwe Dollar
    }

  • DetailLevel: Represents the level of detail for displaying or processing information.
classDiagram
    class DetailLevel {
        <<enumeration>>

	    OVERVIEW
	    DETAIL
    }

  • ErrorCode: Standardized error codes used throughout the application.
classDiagram
    class ErrorCode {
        <<enumeration>>

        // Client Errors - 4xx
        INVALID_INPUT
        VALIDATION
        REQUIRED_INPUT
        UNAUTHORIZED
        NOT_FOUND
        FORBIDDEN
        CONFLICT

        // Server Errors - 5xx
        INTERNAL_SERVER_ERROR
        NOT_IMPLEMENTED
        SERVICE_UNAVAILABLE
        GATEWAY_TIMEOUT
        DATABASE_ERROR
        EXTERNAL_SERVICE_ERROR
        LIBRARY_ERROR
        UNKNOWN_ERROR
    }

  • MediaType: Represents the different types of media supported by the application.
classDiagram
    class MediaType {
        <<enumeration>>

        SCREENSHOT
        PHOTO
        VIDEO
        AUDIO
        DOCUMENT
    }

  • NodeEnv: Represents the possible runtime environments for a Node.js application.
classDiagram
    class NodeEnv {
        <<enumeration>>

        DEVELOPMENT
        PRODUCTION
        TEST
    }

  • SortOrder: Specifies the sorting order for queries or collections.
classDiagram
    class SortOrder {
        <<enumeration>>

        ASC
        DESC
    }

  • StatusCode: Represents standard HTTP status codes used to indicate the result of an HTTP request.
classDiagram
    class StatusCode {
        <<enumeration>>

        // 2xx Success
        OK = 200
        CREATED = 201
        ACCEPTED = 202
        NON_AUTHORITATIVE_INFORMATION = 203
        NO_CONTENT = 204

        // 4xx Client Errors
        BAD_REQUEST = 400
        UNAUTHORIZED = 401
        PAYMENT_REQUIRED = 402
        FORBIDDEN = 403
        NOT_FOUND = 404
        METHOD_NOT_ALLOWED = 405
        NOT_ACCEPTABLE = 406
        REQUEST_TIMEOUT = 408
        CONFLICT = 409
        LENGTH_REQUIRED = 411
        PRECONDITION_FAILED = 412
        PAYLOAD_TOO_LARGE = 413
        URI_TOO_LONG = 414
        UNSUPPORTED_MEDIA_TYPE = 415
        UNPROCESSABLE_ENTITY = 422
        LOCKED = 423
        FAILED_DEPENDENCY = 424
        UPGRADE_REQUIRED = 426
        PRECONDITION_REQUIRED = 428
        TOO_MANY_REQUESTS = 429

        // 5xx Server Errors
        INTERNAL_SERVER_ERROR = 500
        NOT_IMPLEMENTED = 501
        BAD_GATEWAY = 502
        SERVICE_UNAVAILABLE = 503
        HTTP_VERSION_NOT_SUPPORTED = 505
        INSUFFICIENT_STORAGE = 507
        LOOP_DETECTED = 508
        NETWORK_AUTHENTICATION_REQUIRED = 511
    }

  • Role: Represents the different roles a user can have within the system.
classDiagram
    class Role {
        <<enumeration>>

        USER
        ADMIN
        MODERATOR
        SUPERADMIN
        GUEST
    }

Errors

classDiagram
    class AppError {
        + errors: ErrorMessage[];
	    + statusCode: StatusCode;
	    + details: any;

        + constructor(message: string, statusCode: StatusCode = StatusCode.INTERNAL_SERVER_ERROR, details?: any)
	    + addError(error: ErrorMessage): this
	    + setErrors(errors: ErrorMessage[]): this
	    + hasError(): boolean
	    + toJson(): Object
    }

    class BadRequestError {
        + constructor(details?: any)
        + addInvalidInputError(field: string, value: string): this
        + addRequiredInputError(field: string): this
        + addConflictError(field: string, value: string): this
        + addErrors(errors: ErrorMessage[]): this
        + addValidationErrors(errors: ZodError): this
    }

    class ConflictError {
        + constructor(message: string, details?: any)
    }

    class DatabaseError {
        + constructor(database: string, table: string, operation: string, details?: any)
    }

    class ExternalServiceError {
        + constructor(service: string, message: string, details?: any)
    }

    class ForbiddenError {
        + constructor(details?: any)
    }

    class InternalServerError {
        + constructor(details?: any)
    }

    class LibraryError {
        + constructor(libName: string, message: string, details?: any)
    }

    class NotFoundError {
        + constructor(resource: string, details?: any)
    }

    class NotImplementedError {
        + constructor(source: string, message: string, details?: any)
    }

    class ServiceUnavailableError {
        + constructor(service: string, details?: any)
    }

    class TimeoutError {
        + constructor(source: string, message: string, details?: any)
    }

    class UnauthorizedError {
        + constructor(message: string, details?: any)
    }

    class UnexpectedError {
        + constructor(details?: any)
    }

    AppError <|.. BadRequestError
    AppError <|.. ConflictError
    AppError <|.. DatabaseError
    AppError <|.. ExternalServiceError
    AppError <|.. ForbiddenError
    AppError <|.. InternalServerError
    AppError <|.. LibraryError
    AppError <|.. NotFoundError
    AppError <|.. NotImplementedError
    AppError <|.. ServiceUnavailableError
    AppError <|.. TimeoutError
    AppError <|.. UnauthorizedError
    AppError <|.. UnexpectedError