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

@outlawdesigns/armorysdk

v1.0.6

Published

SDK for Armory Service

Readme

Armory SDK (Server-Side)

A lightweight Node.js SDK for interacting with the Armory data layer.
This package provides ORM-style access to firearms, ammunition, optics, and shooting data through a consistent, class-based interface built on @outlawdesigns/db-record.


🚀 Features

  • 🔫 Comprehensive armory models — Manage firearms, ammunition, optics, and related entities.

  • 🧩 Dynamic model factory — Fetch models or classes by name using a centralized interface.

  • 🗃️ Database abstraction — Built on @outlawdesigns/db-record for clean MySQL integration.

  • 📸 Media support — Includes models for firearm and target images.

  • 📊 Activity tracking — Record shooting sessions and ammo purchases.


📦 Installation

npm install @outlawdesigns/armorysdk

🧠 Basic Usage

Require the SDK

import ModelFactory from '@outlawdesigns/armorysdk';

Create a Model Instance

const firearm = await ModelFactory.get('firearm',2).init();
console.log(firearm.Serial_Number);

Access Model Classes Directly

const Firearm = Armory.getClass('firearm');
const myFirearm = new Firearm(2);
await myFirearm.init();
//particularly useful for calling static methods
const allArms = await ModelFactory.getClass('firearm').getAll()

🧩 Available Models

| Model | Description | Backing Table | | :--- | :---: | ---: | | firearm | Concrete instance of a firearm owned by a user. | Firearm | | firearmImage | Images associated with firearms. | FirearmImage | | firearmType | Abstract firearm definition. | FirearmType | | manufacturer | Firearm or component manufacturer. | Manufacturer | | ammunition | Concrete instance of ammunition owned by a user. | Ammunition | | ammunitionType | Abstract ammunition definition. | AmmunitionType | | caliber | Caliber definitions. | Caliber | | ammoPurchase | Records of ammunition purchases. | AmmoPurchase | | optic | Concrete instance of an optic owned by a user. | Optic | | opticType | Abstract optic definition. | OpticType | | shoot | Shooting session records. | Shoot | | targetImage | Images of shot targets. | TargetImage | | vendor | Vendors or retailers. | Vendor |

All models extend @outlawdesigns/db-record.Record and support standard CRUD operations.


🔧 Example: Recording a Shooting Session

import ModelFactory from '@outlawdesigns/armorysdk';

const firearmId = 1;
const ammoId = 2;
const rounds = 100;
const distanceFt = 300;
const opticId = null;
const userId = 'example';

const newShoot = model = await ModelFactory.getClass('shoot').new(firearmId,ammoId,rounds, distanceFt, opticId, userId);

🔧 Example: Logging an Ammo Purchase

import ModelFactory from '@outlawdesigns/armorysdk';

const ammoId = 2;
const vendorId = 12;
const rounds = 100;
const price = 55.90;
const datePurchased = new Date();
//pass undefined instead for pending receipt
const dateReceived = datePurchased;
const userId = 'example';

const purchase = await ModelFactory.getClass('ammoPurchase').new(ammoId, vendorId, rounds, price, datePurchased, dateReceived, userId);

⚙️ Environment Variables

| Variable | Description | Default | | :--- | :---: | ---: | | MYSQL_ARMORY_DB | Database name for Armory models. | Armory |


🧱 Project Structure

.
├── index.js               # SDK entry point
├── modelFactory.js        # Central model registry
├── models/
│   ├── ammunition.js
│   ├── ammunitionType.js
│   ├── ammoPurchase.js
│   ├── caliber.js
│   ├── firearm.js
│   ├── firearmImage.js
│   ├── firearmType.js
│   ├── manufacturer.js
│   ├── optic.js
│   ├── opticType.js
│   ├── shoot.js
│   ├── targetImage.js
│   └── vendor.js
└── package.json

🧩 Extending the SDK

To add a new model:

  1. Create a file in models/ extending @outlawdesigns/db-record.Record.

  2. Register it in modelFactory.js.

Example:

class Range extends Record {
  static table = 'range';
  static primaryKey = 'id';
  static get database() {
    return process.env.MYSQL_ARMORY_DB || 'armory';
  }
}

Register it:

const Range = require('./models/range');

models.range = (id) => new Range(id);
modelClasses.range = Range;

👤 Author

Maintained by Outlaw Designs
https://github.com/outlawdesigns-io