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

@bck-inc/nsl-core

v1.0.37

Published

SDK officiel pour l'API NSL (Néon Spinellia LuckyScale) - 100 % fetch natif

Readme

@bck-inc/nsl-core

SDK TypeScript / Node.js pour l’API NSL (Néon Spinellia LuckyScale)

TL;DR : import { NSLCore } from '@bck-inc/nsl-core' → appelez votre premier endpoint en 10 lignes.


✨ Caractéristiques principales

|    |    | | :--------------------- | :------------------------------------------------------------------------------------------- | | Fetch natif | Aucun client HTTP externe — Node ≥ 18 requis (polyfill possible). | | ESM & CJS | Fonctionne avec import et require. | | Type safe | Déclarations .d.ts + type‑guards runtime. | | Cache TTL (1,5 s) | Réponses GET mises en cache pour amortir les floods. | | Rate‑limit intégré | Token‑bucket 200 ms entre requêtes. | | Errors typées | NSLError, NSLHTTPError pour des catch ciblés. | | Évènements | request, response, cacheHit, validationError, moduleStateChanged, ping, error. | | Zéro config | Instanciez, appelez : headers et baseURL gérés pour vous. |


🚀 Installation

npm i @bck-inc/nsl-core           # pnpm add @bck-inc/nsl-core / yarn add @bck-inc/nsl-core

Node ≥ 18 recommandé pour fetch et URL globaux. Sur Node 16 :

import fetch from 'node-fetch';
// @ts-ignore
globalThis.fetch = fetch;

⚡ Exemple rapide (TS / ESM)

import { NSLCore, NSLCodes, NSLState } from '@bck-inc/nsl-core';

const core = new NSLCore({
  token: process.env.NSL_TOKEN!,
  botId:  process.env.BOT_ID!,
  debug:  true,
});

core.on('cacheHit', ({ url })  => console.log('⚡ cache', url))
    .on('ping',     ({ rtt })  => console.log('ping', rtt, 'ms'))
    .on('error',    console.error);

// Active le module "welcome" sur un serveur
const res = await core.setModuleState({
  bot_id:     core['botId']!,
  server_id:  '987654321098765432',
  module_name:'welcome',
  newState:   NSLState.enabled,
});

if (res.code === NSLCodes.VALID) console.log('Module OK');

📚 API en bref

Constructeur

new NSLCore({ token, botId, baseURL?, debug? });

Méthodes

| Méthode | Effet | | ------------------------------------------- | ------------------------------------------------- | | fetchModules(query?) | GET /modules/get + cache TTL | | insertModule(body) / updateModule(body) | CRUD module | | setModuleState(params) | Insert ou update + événement moduleStateChanged | | enableModule() / disableModule() | Sucrage autour de setModuleState | | isStandardized(name) | Vérifie si « standard » côté API | | getPing() | Retourne la latence (ms) et émet ping |

Évènements (auto‑complétés dans VS Code)

| Event | Payload | | :------------------- | :--------------------------- | | request | { url, method } | | response | { url, status } | | cacheHit | { url, ttlLeft } | | validationError | { url, issues } | | moduleStateChanged | { module, type, newState } | | ping | { rtt } (‑1 si timeout) | | error | unknown |

Types & enums détaillés dans src/types.ts.


🧪 Tests

pnpm test        # Vitest en CI
pnpm test:watch  # watch mode

🤝 Contribuer

  1. Fork puis git checkout -b feat/ma-feature
  2. pnpm i && pnpm test
  3. PR + description claire.

Toute idée ou bug ? Ouvrez une Issue — on répond vite !


📜 Licence

MIT — © BCK Inc. 2025