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

@jetta/axle-load-calculator

v0.3.5

Published

Merged weight_by_axis physics and orchestration library

Readme

axle-load-calculator

TypeScript library that merges ms-faixas-porcentuais weight_on_axles_physics orchestration with the axleweight physics engine. v1 is in-process only (no HTTP).

Requirements

  • Node.js 20+
  • npm

How to install

npm install
npm run build

Usage

import {
    calculate_weight_on_axles_physics,
    UnsupportedVehicleTypeError,
    type WeightByAxisRequestInput,
    type WeightByAxisSuccessOutput
} from '@jetta/axle-load-calculator'
import { ZodError } from 'zod'

const request: WeightByAxisRequestInput = { envs: [...] }

try {
    const response: WeightByAxisSuccessOutput = calculate_weight_on_axles_physics(request)
    // response.envs with axle weights
} catch (error) {
    if (error instanceof ZodError) {
        // invalid request shape (null, array, missing containers, etc.)
    } else if (error instanceof UnsupportedVehicleTypeError) {
        // unsupported tipoVeiculo
    }
}

Contract:

  • Input: object { envs, config? } with required containers on each env (cloned before processing)
  • Success: { envs } with containers[].pesoEixos filled; items and faixas cleared on containers
  • Failure: throws (see Errors below)

Errors

Thrown by calculate_weight_on_axles_physics

| Class | When | |-------|------| | ZodError (from zod, not re-exported) | Invalid request shape (null, array, missing containers, etc.) | | UnsupportedVehicleTypeError | Unknown tipoVeiculo | | UnrecognizedSuspensionTypeError | Invalid vanderleia suspension type | | GrouperNotFoundError | Merged-container grouper not found | | ItemOverlapError | Two allocated items occupy the same volume |

Import ZodError directly from zod.

Exported for lower-level use

Also exported from @jetta/axle-load-calculator for instanceof checks when using internal physics modules (not thrown by calculate_weight_on_axles_physics):

| Class | When | |-------|------| | ContainerSequenceNotFoundError | Container sequence missing on transport | | MissingContainerError | Container lookup failed | | UnknownItemIdError | Unknown item template id | | DeflectionModelNotImplementedError | No deflection model for the vehicle |

Dependencies

  • zod — request validation at the public boundary
  • @jetta/number-compare — float-safe interval tests in cargo collision
  • publint (dev) — npm package manifest validation

Scripts

| Command | Description | |---------|-------------| | npm test | Mocha tests (physics + Java integration fixtures) | | npm run lint | ESLint (src, test/src) | | npm run lint:package | Validate npm publish manifest with publint (run after build) | | npm run build | tscbuild/ |

Layout

  • src/index.ts — public API
  • src/core/physics/ — axleweight port (models, deflection, tare, services)
  • src/core/orchestration/ — Java weight-by-axis glue (mass center, collision, output)
  • src/service/ — reserved for future HTTP layer
  • test/src/ — mirrors src/; fixtures under test/data/src/