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

@vigilry/node

v0.1.5

Published

Official Node.js SDK for the Vigilry risk ingestion API

Downloads

311

Readme

@vigilry/node

Official Node.js SDK for the Vigilry risk ingestion API.

Installation

npm install @vigilry/node
# or
pnpm add @vigilry/node
# or
yarn add @vigilry/node

Requires Node.js >= 18

Quick Start

import { Vigilry } from "@vigilry/node";

const vigilry = new Vigilry({ apiKey: "your-api-key" });

// Capture a custom event
await vigilry.capture({
  type: "payment_failed",
  severity: "error",
  message: "Stripe charge declined for order #1234",
});

// Capture a server error
try {
  await riskyOperation();
} catch (err) {
  await vigilry.captureError(err as Error, {
    status_code: 500,
    path: "/api/checkout",
    method: "POST",
  });
}

API Reference

new Vigilry(options)

| Option | Type | Required | Description | | --------- | -------- | -------- | -------------------------------------------------------- | | apiKey | string | Yes | Your project API key (from the Vigilry dashboard) | | baseUrl | string | No | Override the ingestion endpoint (default: https://ingest.vigilry.com) |


vigilry.capture(options)

Sends a custom event to the ingestion pipeline.

await vigilry.capture({
  type: "checkout_started",       // event type / source label
  severity: "info",               // "info" | "warn" | "error" | "critical"
  message: "User began checkout", // human-readable description
  correlation: {                  // optional — attach business identifiers
    user_id: "usr_abc",
    order_id: "ord_xyz",
    customer_id: "cus_123",
  },
});

Returns Promise<IngestResult | null>null on network failure (never throws).


vigilry.captureError(error, context?)

Sends a server error with stack trace and request context.

await vigilry.captureError(err, {
  status_code: 500,    // HTTP status code
  path: "/api/orders", // request path
  method: "POST",      // HTTP method
  correlation: {
    user_id: "usr_abc",
  },
});

Returns Promise<IngestResult | null>null on network failure (never throws).


IngestResult

interface IngestResult {
  jobId: string;
  status: "queued";
}

Correlation Fields

Correlation metadata links events to business entities for richer incident analysis.

| Field | Description | | ------------------ | ------------------------------------ | | user_id | Internal user identifier | | customer_id | Customer / tenant identifier | | order_id | Order or transaction identifier | | payment_provider | Payment provider (e.g. "stripe") | | plan | Subscription plan (e.g. "pro") | | deployment_id | Deployment or release identifier |


Express Middleware Example

import express from "express";
import { Vigilry } from "@vigilry/node";

const vigilry = new Vigilry({ apiKey: process.env.VIGILRY_API_KEY! });
const app = express();

app.use((err: Error, req: express.Request, res: express.Response, next: express.NextFunction) => {
  vigilry.captureError(err, {
    status_code: 500,
    path: req.path,
    method: req.method,
    correlation: {
      user_id: (req as any).user?.id,
    },
  });
  res.status(500).json({ error: "Internal Server Error" });
});

Error Handling

The SDK never throws. All methods return null on failure and log a warning to console.error. This ensures ingestion failures never crash your application.


License

MIT