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

@ph-itdev/inventory-alerts

v1.0.4

Published

Inventory stock level monitoring and alert system for warehouse management - track stock levels, get alerts for low/out-of-stock items, and manage inventory efficiently

Readme

@ph-itdev/inventory-alerts

Inventory stock level monitoring and alert system for warehouse management. Track stock levels, get alerts for low/out-of-stock items, and manage inventory efficiently.

Installation

npm install @ph-itdev/inventory-alerts

Quick Start

import { InventoryMonitor, InventoryItem, AlertSeverity } from '@ph-itdev/inventory-alerts';

// Create a monitor
const monitor = new InventoryMonitor({
  lowStockThreshold: 10,
  criticalStockThreshold: 5
});

// Add inventory items
monitor.addItem({
  id: 'item-001',
  name: 'Widget A',
  sku: 'WDG-A-001',
  quantity: 50,
  minQuantity: 10,
  maxQuantity: 100,
  unit: 'pcs',
  category: 'Widgets',
  lastUpdated: new Date()
});

// Register alert handler
monitor.onAlert((alert) => {
  console.log(`[${alert.severity}] ${alert.message}`);
});

// Check stock levels
const results = monitor.checkAllStock();
console.log(`Checked ${results.length} items`);

// Get alerts
const lowStockAlerts = monitor.getAlertsBySeverity(AlertSeverity.HIGH);

Features

Stock Level Monitoring

  • Track inventory items with quantities, min/max thresholds
  • Real-time stock level checking
  • Automatic alert generation

Alert System

  • Multiple severity levels (LOW, MEDIUM, HIGH, CRITICAL)
  • Alert types: LOW_STOCK, OUT_OF_STOCK, OVERSTOCK, REORDER
  • Callback system for custom alert handling
  • Alert acknowledgment

Utility Functions

  • calculateReorderQuantity() - Determine optimal reorder amounts
  • calculateTurnoverRate() - Measure inventory efficiency
  • calculateDaysOfStock() - Estimate stock duration
  • generateSku() - Create SKU codes automatically
  • validateItem() - Validate inventory item data
  • sortByStockLevel() - Sort items by urgency
  • groupByCategory() - Organize items by category

Configuration

const monitor = new InventoryMonitor({
  lowStockThreshold: 10,        // Default: 10
  criticalStockThreshold: 5,    // Default: 5
  overstockMultiplier: 2,       // Default: 2
  checkIntervalMs: 60000        // Default: 60000 (1 minute)
});

API Reference

InventoryMonitor

addItem(item: InventoryItem): void

Add or update an inventory item.

removeItem(id: string): boolean

Remove an item by ID.

getItem(id: string): InventoryItem | undefined

Retrieve an item by ID.

getAllItems(): InventoryItem[]

Get all inventory items.

updateQuantity(id: string, quantity: number): InventoryItem | undefined

Update item quantity.

onAlert(callback: AlertCallback): void

Register an alert callback function.

checkStock(item: InventoryItem): StockCheckResult

Check stock level for a single item.

checkAllStock(): StockCheckResult[]

Check all items and generate alerts.

getActiveAlerts(): InventoryAlert[]

Get all unacknowledged alerts.

getAlertsBySeverity(severity: AlertSeverity): InventoryAlert[]

Filter alerts by severity level.

acknowledgeAlert(alertId: string): boolean

Mark an alert as acknowledged.

getLowStockItems(): InventoryItem[]

Get items below minimum quantity.

getOutOfStockItems(): InventoryItem[]

Get items with zero quantity.

getItemsByCategory(category: string): InventoryItem[]

Filter items by category.

getInventorySummary()

Get summary statistics of inventory.

Use Cases

  • Warehouse Management: Track stock levels across warehouses
  • Retail Inventory: Monitor product availability
  • Supply Chain: Identify reorder needs
  • Manufacturing: Track raw materials and components
  • E-commerce: Prevent stockouts on popular items

License

MIT © nilskie06