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

@royaltics/tracker-sails

v0.0.25

Published

Sails.js hook for Royaltics Error Tracker

Readme

@royaltics/tracker-sails

Sails.js hook for Royaltics Error Tracker

Features

  • Sails.js Integration: Native hook implementation
  • Automatic Request Tracking: Capture all HTTP requests
  • Error Middleware: Automatic error capture
  • Route Filtering: Ignore specific routes
  • Configurable: Full control over what gets tracked
  • TypeScript Support: Full type definitions

Installation

pnpm add @royaltics/tracker-sails
# or
npm install @royaltics/tracker-sails
# or
yarn add @royaltics/tracker-sails

Configuration

Create or update config/tracker.js:

module.exports.tracker = {
  webhookUrl: process.env.ERROR_TRACKER_WEBHOOK_URL,
  licenseId: process.env.ERROR_TRACKER_LICENSE_ID,
  licenseDevice: process.env.ERROR_TRACKER_DEVICE || 'sails-server',
  licenseName: 'My Company',
  app: 'my-sails-app',
  version: '1.0.0',
  
  // Optional: Capture settings
  captureRoutes: true,
  captureQueries: true,
  captureHeaders: false,
  
  // Optional: Filtering
  ignoredRoutes: [
    '/health',
    '/metrics',
    '^/api/internal/.*'
  ],
  
  ignoredErrors: [
    'ValidationError',
    'NotFoundError'
  ],
  
  // Optional: Advanced settings
  enabled: true,
  maxRetries: 3,
  timeout: 10000,
  flushInterval: 5000,
  maxQueueSize: 50
};

Usage

Automatic Error Tracking

The hook automatically captures:

  • Uncaught exceptions
  • Unhandled promise rejections
  • Route errors
  • Request errors

Manual Error Tracking

// In a controller or service
module.exports = {
  async someAction(req, res) {
    try {
      // Your code
    } catch (error) {
      sails.hooks.tracker.error(error, 'ERROR', {
        userId: req.session.userId,
        action: 'someAction'
      });
      
      return res.serverError(error);
    }
  }
};

Track Custom Events

sails.hooks.tracker.event('User registered', 'INFO', {
  userId: user.id,
  email: user.email
});

Configuration Options

Required

| Option | Type | Description | |--------|------|-------------| | webhookUrl | string | HTTP/HTTPS webhook URL | | licenseId | string | Your license ID | | licenseDevice | string | Device identifier |

Optional

| Option | Type | Default | Description | |--------|------|---------|-------------| | licenseName | string | undefined | License name | | app | string | undefined | Application name | | version | string | undefined | Application version | | captureRoutes | boolean | false | Capture all route requests | | captureQueries | boolean | false | Include query parameters | | captureHeaders | boolean | false | Include request headers | | ignoredRoutes | string[] | [] | Routes to ignore (regex patterns) | | ignoredErrors | string[] | [] | Errors to ignore (regex patterns) | | enabled | boolean | true | Enable/disable tracking | | maxRetries | number | 3 | Max retry attempts | | timeout | number | 10000 | Request timeout in ms | | flushInterval | number | 5000 | Batch flush interval in ms | | maxQueueSize | number | 50 | Max events before auto-flush |

Examples

Environment Variables

ERROR_TRACKER_WEBHOOK_URL=https://api.example.com/webhook
ERROR_TRACKER_LICENSE_ID=your-license-id
ERROR_TRACKER_DEVICE=production-server-01

Ignore Health Check Routes

module.exports.tracker = {
  // ... other config
  ignoredRoutes: [
    '/health',
    '/ping',
    '/metrics',
    '^/api/internal/.*'
  ]
};

Capture Only Errors

module.exports.tracker = {
  // ... other config
  captureRoutes: false,  // Don't track successful requests
  captureQueries: true,  // But include query params in errors
  captureHeaders: false  // Don't include headers
};

TypeScript

import { SailsErrorTrackerConfig } from '@royaltics/tracker-sails';

const config: SailsErrorTrackerConfig = {
  webhookUrl: 'https://api.example.com/webhook',
  licenseId: 'your-license-id',
  licenseDevice: 'server-01',
  captureRoutes: true
};

License

MIT