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

@synehq/lumen-js

v1.1.0

Published

Official TypeScript/JavaScript client SDK for Lumen event ingestion service

Downloads

632

Readme

@synehq/lumen-js

Official TypeScript/JavaScript client SDK for the Lumen event ingestion service.

Events are buffered client-side and flushed in batches over Connect RPC (JSON), so track()/identify() calls are fire-and-forget: non-blocking, never throw, and never hold up your app.

Install

npm install @synehq/lumen-js

Usage

import { Lumen } from '@synehq/lumen-js';

const lumen = new Lumen('lum_live_...'); // ingest key from your Lumen admin

lumen.track('Page View', { path: '/dashboard' });

lumen.identify('user_123', { email: '[email protected]', plan: 'pro' });

// On logout:
lumen.reset();

That's it for the common case — the SDK auto-flushes on an interval, on tab backgrounding, and on tab/window close, and manages anonymous ID, session ID, and session rotation for you.

API

new Lumen(ingestKey, options?)

| Option | Default | Description | |---|---|---| | endpoint | http://localhost:50051 | Base URL of your Lumen ingest server | | batchSize | 50 | Max events buffered before an automatic flush | | flushIntervalMs | 5000 | How often the queue auto-flushes |

Throws if ingestKey is falsy.

track(name, props?)

Queues an event. Non-blocking, swallows all errors internally.

lumen.track('Checkout Completed', { amount: 42.0, currency: 'USD' });

identify(userId, traits?)

Links the current anonymous visitor to an authenticated user ID and sends traits immediately (not queued — this is its own RPC, not a batched event).

lumen.identify('user_123', { email: '[email protected]' });

reset()

Call on logout. Ends the current session (session_end), generates a fresh anonymous ID and session ID, clears the identified user, and starts a new session (session_start).

flush()

Forces an immediate flush of any queued events. Rarely needed — the SDK flushes automatically on its interval, on visibilitychange (tab hidden), and on beforeunload (tab/window close).

What gets sent

Every event automatically carries:

  • Identity: anon_id (persisted in localStorage), user_id (once identified), session_id
  • Page context: url, referrer, user_agent
  • Device: screen_w/screen_h, viewport_w/viewport_h, locale, timezone

Browser/OS/device-type classification and GeoIP (country/region/city) are derived server-side from user_agent and the request IP — nothing extra to send for those.

Session lifecycle

The SDK emits explicit session_start / session_end events (in addition to the session boundaries Lumen derives from event timestamps), paired around:

  • SDK initialization (session_start) and tab/window close (session_end)
  • reset() — closes the outgoing session, opens a new one
  • Automatic session rotation after 30 minutes of inactivity or 24 hours since session start

Browser support

Built for browser environments (uses window, document, navigator, localStorage, fetch). Calls degrade gracefully to no-ops in non-browser contexts (e.g. SSR) rather than throwing.

License

Apache-2.0