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

tcell-hooks

v1.1.0

Published

Hooks library for TCell node agent

Downloads

4

Readme

By TCell.

TCell Hooks is to be used in conjuction with the tcell_agent to allow for custom event notifications of login failures and login successes.

Getting started

You can manually add it to your package.json file or install and save it with the following command:

npm install tcell-hooks --save

There are several options for calling the hooks from your application code:

  • Providing an Express request object and having the TCell Agent extract the relevant details from it:

    var TCellHooks = require('tcell-hooks').v1;
    
    // successful login
    var username = 'some-user-id',
        sessionId = req.sessionID,
        password = 'some-password'
    TCellHooks.sendExpressLoginEventSuccess(req, username, sessionId, password);
    
    // failed login
    var username = 'some-user-id',
        sessionId = req.sessionID,
        userValid = false,
        password = 'some-password'
    TCellHooks.sendExpressLoginEventFailure(req, username, sessionId, userValid, password);
  • Providing a Hapi request object and having the TCell Agent extract the relevant details from it:

    var TCellHooks = require('tcell-hooks').v1;
    
    // successful login
    var username = 'some-user-id',
        sessionId = 'session-id'
        password = 'some-password'
    TCellHooks.sendHapiLoginEventSuccess(req, username, sessionId, password);
    
    // failed login
    var username = 'some-user-id',
        sessionId = 'session-id'
        userValid = false,
        password = 'some-password'
    TCellHooks.sendHapiLoginEventFailure(req, username, sessionId, userValid, password);
  • Providing each individual piece of information required for the TCell event:

    var TCellHooks = require('tcell-hooks').v1;
    
    // successful login
    // NOTE: this is how you would obtain this info from an ExpressJS request.
    //       Obtaining this info in a different framework will likely differ
    var username = 'some-user-id',
        sessionId = req.sessionID,
        userAgent = req.get('User-Agent'),
        referrer = req.get('Referrer'),
        remoteAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress,
        headerKeys = Object.keys(req.headers),
        documentUri = req.protocol + '://' + req.get('Host') + req.originalUrl,
        password = 'some-password'
    TCellHooks.sendLoginEventSuccess(
      username,
      sessionId,
      userAgent,
      referrer,
      remoteAddress,
      headerKeys,
      documentUri,
      password);
    
    // failed login
    // NOTE: this is how you would obtain this info from an ExpressJS request.
    //       Obtaining this info in a different framework will likely differ
    var username = 'some-user-id',
        sessionId = req.sessionID,
        userAgent = req.get('User-Agent'),
        referrer = req.get('Referrer'),
        remoteAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress,
        headerKeys = Object.keys(req.headers),
        documentUri = req.protocol + '://' + req.get('Host') + req.originalUrl,
        userValid = false,
        password = 'some-password'
    TCellHooks.sendLoginEventFailure(
      username,
      sessionId,
      userAgent,
      referrer,
      remoteAddress,
      headerKeys,
      documentUri,
      userValid,
      password);

 

Important Note

If the tcell_agent is not installed or if it's disabled, this code will do nothing and should have no performance effect on your app.  
 

API

function sendLoginEventSuccess (
  userId,
  sessionId,
  userAgent,
  referrer,
  remoteAddress,
  headerKeys,
  documentUri,
  password) {
}

String  userId - Identification used for the user (i.e. email, username)
String  sessionId - (Optional) Session ID for user logging in. This will be HMAC'ed by the Agent before being sent
String  userAgent - (Optional) User agent taken from header
String  referrer - (Optional) Referrer taken from header
String  remoteAddress - (Optional) IP of the Request
String  headerKeys - (Optional) An array of the header keys. The order is important (do not sort the array)
String  documentUri - (Optional) Document URI taken from request String  password - (Optional) Password for user logging in. This will be HMAC'ed by the Agent before being sent  

function sendLoginEventFailure (
  userId,
  sessionId,
  userAgent,
  referrer,
  remoteAddress,
  headerKeys,
  documentUri,
  userValid,
  password) {
}

String  userId - Identification used for the user (i.e. email, username)
String  sessionId - (Optional) Session ID for user logging in. This will be HMAC'ed by the Agent before being sent
String  userAgent - (Optional) User agent taken from header
String  referrer - (Optional) Referrer taken from header
String  remoteAddress - (Optional) IP of the Request
String  headerKeys - (Optional) An array of the header keys. The order is important (do not sort the array)
String  documentUri - (Optional) Document URI taken from request
Boolean userValid -  (Optional) Set as true if exists, other false. Defaults to null. String  password - (Optional) Password for user logging in. This will be HMAC'ed by the Agent before being sent  

function sendExpressLoginEventSuccess (
  request,
  userId,
  sessionId,
  password) {
}

Object  request - Request object provided by ExpressJS
String  userId - Identification used for the user (i.e. email, username)
String  sessionId - (Optional) Session ID for user logging in. This will be HMAC'ed by the Agent before being sent String  password - (Optional) Password for user logging in. This will be HMAC'ed by the Agent before being sent  

function sendExpressLoginEventFailure (
  request,
  userId,
  sessionId,
  userValid,
  password) {
}

Object  request - Request object provided by ExpressJS
String  userId - Identification used for the user (i.e. email, username)
String  sessionId - (Optional) Session ID for user logging in. This will be HMAC'ed by the Agent before being sent
Boolean userValid -  (Optional) Set as true if exists, other false. Defaults to null. String  password - (Optional) Password for user logging in. This will be HMAC'ed by the Agent before being sent  

function sendHapiLoginEventSuccess (
  request,
  userId,
  sessionId,
  password) {
}

Object  request - Request object provided by Hapi
String  userId - Identification used for the user (i.e. email, username)
String  sessionId - (Optional) Session ID for user logging in. This will be HMAC'ed by the Agent before being sent
String  password - (Optional) Password for user logging in. This will be HMAC'ed by the Agent before being sent  

function sendHapiLoginEventFailure (
  request,
  userId,
  sessionId,
  userValid,
  password) {
}

Object  request - Request object provided by Hapi
String  userId - Identification used for the user (i.e. email, username)
String  sessionId - (Optional) Session ID for user logging in. This will be HMAC'ed by the Agent before being sent
Boolean userValid -  (Optional) Set as true if exists, other false. Defaults to null. String  password - (Optional) Password for user logging in. This will be HMAC'ed by the Agent before being sent