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

@atptalos/common

v1.0.26

Published

Common package to share between Talos Help services!

Readme

Commons Module

The purpose of this module is to share code between services

Middlewares

current-user

Requirement

cookie-session middleware must be used in your Express application

import cookieSession from "cookie-session";
import express from "express";
const app = express();
app.use(
  cookieSession({
    signed: false,
    secure: process.env.NODE_ENV !== "test", //set cookies when request commes from https
  })
);

This is required since current-user middleware will validate the request contains a session property, that was included by the cookieSession middleware.

Usage

current-user will validate the jwt inside session property. If the validation succeed, the request object will receive a currentUser property with the user data

interface UserPayload {
  id: string;
  name: string;
  email: string;
}

Then the request will continue its way until it hits your route.

Use it in your express application by applying it as middleware

import { currentUser } from "@atptalos/common";

app.use(noRequireAuth)
app.use(currentUser) // Routes applied below currentUser will require the user to be authenticated
app.use(routerRequireAuth)

validateAuthorization

Validate if user data exist in the request object. If it doesn't exist. We immediately return NotAuthorizedError

Requirement

current-user middleware in your app

Example

import { validateAuthorization } from "@atptalos/common";

const router = express.Router();
router.get("/api/your/endpoint", validateAuthorization, async (req, res) => { 
    // your route logic here
    // you can access safely req.currentUser
 })

validateRequest

Validate if express validator thrown any error while validating body parameters

Requirement

express-validator middleware must be implemented on your routes.

import { validateRequest } from "@atptalos/common";
import { body } from "express-validator";

const router = express.Router();
router.post(
    "/api/your/endpoint", 
    [
    body("name").not().isEmpty().withMessage("Name is required"),
    body("email").isEmail().withMessage("Email must be valid"),
    ],
    validateRequest, async (req, res) => { 
    // your route logic here

 })

you can access safely to req.body properties since express-validator applied some validations and validateRequest middleware ensures no error was found. If any error was found during the validation, validateRequest will throw RequestValidationError

🚀 Deployment

Automated deployments in @atptalos/common

Everytime your changes in this module get merged in master, deploy-common.yaml workflow will publish a new version in the public @atptalos organizacion