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

calmlens

v0.47.2

Published

Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.

Downloads

7,989

Readme

CalmLens JavaScript SDK

The official JavaScript and TypeScript SDK for CalmLens: content moderation and classification for text, images, documents and websites, plus optional storage and CDN delivery.

Installation

npm install calmlens

The same package is also published as @calmlens/sdk, at the same version. Import from the name you installed: calmlens/server with calmlens, or @calmlens/sdk/server with @calmlens/sdk.

The package has two clients, each with its own import:

| Import | Client | Runs | Authenticates with | | ----------------- | ---------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------- | | calmlens/server | CalmLensServerClient | On your server: Node.js 22 or later, Bun, Deno, Cloudflare Workers | A project API key | | calmlens/app | CalmLensAppClient | In browsers and React Native apps | An upload preset, with an optional upload token from your server |

API keys are secret, so CalmLensServerClient refuses to start in a web page or app. Upload from browsers and apps with CalmLensAppClient, and serve private content to them with signed URLs. The package ships ES modules and CommonJS with type declarations. The main, /server and /app entry points load no other packages at runtime. The package depends only on zod, which its type declarations and testing helpers use. The browser UI also needs hls.js and pdfjs-dist (npm install calmlens hls.js pdfjs-dist), optional peer dependencies it loads only when it plays a stream or shows a document, so a server install leaves them out.

The type declarations need TypeScript 5.9 or later; each build checks them with TypeScript 5.9. Versions follow semantic versioning, types included: see Versioning and support and Requirements and type changes.

Quick start

Create an API key under Developer → API Keys in the CalmLens portal. The same page shows your Project ID. Keep both on your server.

import { CalmLensServerClient } from "calmlens/server";

const client = new CalmLensServerClient({
  apiKey: process.env.CALMLENS_API_KEY!,
  projectId: process.env.CALMLENS_PROJECT_ID!,
});

// Text (comments, captions, bios): waits for the decision
const comment = await client.text.classify({ text: "Great photo!", externalId: "comment-42" });

const { decision } = comment.classification.moderation;
if (decision === "allowed" || decision === "limited") {
  // publish it; keep "limited" out of recommendations, trending and notifications
} else {
  // "age-restricted": show it only behind your own age check; "blocked" or "purged": don't publish it
}

// Images and documents: queued, resolved by webhook or assets.retrieve()
const image = await client.assets.create({
  name: "photo.jpg",
  content: file,
  externalId: "post-7",
});
console.log(image.classification.status, image.classification.moderation.decision); // "processing" null

| classification.status | classification.moderation.decision | Meaning | | ------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------ | | completed | allowed | Safe to show. | | completed | limited | Delivered like allowed; reduce its reach, such as keeping it out of recommendations. | | completed | age-restricted | Delivered only with viewerClaims.ageConfirmed=true. Show it only to age-checked viewers. | | completed | blocked | Your policy blocked it; the CDN doesn't deliver it. Don't show it. | | completed | purged | Your policy blocked it and deleted its content. Don't show it. | | queued or processing | null | Still being received or classified. | | failed | null | Processing failed; see assets.retry. |

Jurisdiction rules can make the outcome stricter for viewers in some countries: serve the content through CalmLens URLs with the viewer's region (Viewer region), or apply classification.moderation.regions when you serve your own copies (Self-hosted content).

A reviewer's applied decision takes precedence over the automated one: classification.moderation.decidedBy says which is in force, review holds the latest reviewer decision and automated the automated one. Treat a decision you don't recognise as not allowed. See How CalmLens works.

What you can do

Every public SDK operation accepts one options object, so call sites stay stable as optional fields are added. The SDK reference lists every option and method.

Testing

calmlens/testing runs the real clients against an in-memory CalmLens API and CDN, with moderation outcomes, recorded requests, injected failures and signed webhook deliveries. See JavaScript testing.

calmlens/test-inputs makes signed test codes and images that the project they are signed for moderates as the scenario you choose. A code counts only as the whole text and an image only as the whole upload. See Generate test inputs.

Links