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

@neuronsearchlab/sdk

v1.18.1

Published

Official SDK for accessing NeuronSearchLab APIs

Readme

@neuronsearchlab/sdk

Tiny TypeScript client and structured logger for the NeuronSearchLab API. It exposes a single NeuronSDK class (track events, upsert items, request recommendations) plus configureLogger for opt-in diagnostic output.

Installation

npm install @neuronsearchlab/sdk

Quick start

import {NeuronSDK, configureLogger} from "@neuronsearchlab/sdk";

configureLogger({level: "INFO"});

const sdk = new NeuronSDK({
  baseUrl: "https://api.neuronsearchlab.com",
  accessToken: process.env.NEURON_API_TOKEN!,
  // Optional batching controls (defaults shown)
  collateWindowSeconds: 3,
  maxBatchSize: 200,
  maxBufferedEvents: 5000,
});

const contentId = 3187; // integer content identifier you already store

await sdk.trackEvent({
  eventId: 1,
  userId: "42",
  itemId: contentId, // pass your numeric contentId straight through
  metadata: {action: "view"},
});

await sdk.upsertItem({
  itemId: contentId,
  name: "Premier League Highlights",
  description: "Matchday recap",
  metadata: {league: "EPL"},
});

await sdk.deleteItems({itemId: contentId});

const recs = await sdk.getRecommendations({userId: "42", limit: 5});

Reference tables

Configuration

| Key | Default | Description | | --- | --- | --- | | collateWindowSeconds | 3 | Buffer events for this many seconds before flushing. | | maxBatchSize | 200 | Flush immediately once the buffer reaches this size. | | maxBufferedEvents | 5000 | Maximum number of buffered events; oldest are dropped (with a warning) beyond this limit. | | maxEventRetries | 5 | Event send retries (with exponential backoff) after network failures. | | disableArrayBatching | false | Force single-event sends (used automatically if the server rejects array payloads). |

Resources

| Resource | Link | | --- | --- | | Docs hub | https://docs.neuronsearchlab.com | | API reference | https://docs.neuronsearchlab.com/api | | Quick start | https://docs.neuronsearchlab.com/get-started |

Methods

| Method | Required fields | Notes | | --- | --- | --- | | trackEvent(data) | eventId (number), userId (string or number), itemId (number or string), metadata (object) | Buffers events in order and batches to the /events endpoint (single or array payloads). | | upsertItem(data) | itemId (number or UUID string), name, description, metadata | Adds or updates catalogue entries. | | deleteItems(items) | itemId (number or UUID string) | Accepts a single {itemId} object or an array for batch deletes. | | getRecommendations(options) | userId (string or number) | Optional: contextId (string), limit (number). |

Event batching behavior

  • Events are buffered in-memory with a client_ts timestamp when trackEvent is called.
  • Flush triggers: collate window elapses, buffer reaches maxBatchSize, or lifecycle events (beforeunload, pagehide, visibilitychange when hidden). You can also call sdk.flushEvents() to flush immediately.
  • On transient failures, buffered events are re-queued and retried with exponential backoff (bounded by maxEventRetries). If the buffer exceeds maxBufferedEvents, the oldest events are dropped with a warning.
  • If the server rejects array payloads, the SDK automatically falls back to single-event sends for subsequent flushes (or set disableArrayBatching: true to force this upfront).

Development

npm install
npm run build

License

MIT