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

microcomps

v0.1.0-build.60

Published

A streamlined JavaScript client for the Institute for Disease Modeling's COMPS system.

Readme

MicroCOMPS1

The MicroCOMPS library is a streamlined, task-oriented, data-adapter library for COMPS that is specifically tailored towards getting data out of COMPS simulations for the purposes of visualization.

To make COMPS API calls, this library needs a valid COMPS token. If the page hosting MicroCOMPS is hosted within the iframe of the COMPS ContentControl, then the token can be obtained from the COMPS cookie. MicroCOMPS provides a set of static helper functions to make this easier.

Installation

Because MicroCOMPS is distributed as an NPM package, installation is handled by npm. Given a git bash prompt,

  1. Create a folder for the new visualization.
    mkdir myvis
    cd myvis
  2. Initialize NPM
    npm init
  3. Answer the NPM-init questions. This establishes a package.json file for the new project.
  4. Install MicroCOMPS as a dependency
    npm install --save microcomps
  5. Import the library in your visualization's index.js
    import {MicroCOMPS} from "microcomps";

Minimal usage

Following is the code for a simple application using the MicroCOMPS library. (This example, minimal/, is included in the repo's examples/ directory.)

import {MicroCOMPS} from "microcomps";
import axios from "axios";

// Authenticate on page load
document.addEventListener("DOMContentLoaded", () => {
  const params = new URLSearchParams(window.location.search);
  const authPostData = {
    "UserName": params.get("username"),
    "Password": btoa(params.get("password")),
    "ApplicationName": "COMPS",
    "ClientVersion": 11,
  };
  if (!authPostData.UserName || !authPostData.Password) {
    alert("?username=...&password=... required on URL");
    return;
  }
  const authUrl = `https://comps-dev.idmod.org/api/tokens?format=json`;
  axios.post(authUrl, authPostData)
    .then(resp => {
      app(resp.data.Token);   // Run app on authentication success
      return Promise.resolve(resp.data);
    })
    .catch(reason => {
      return Promise.reject(reason);
    });
});

// Simple application that obtains a sim, then gets its flat-file listing.
function app(token) {
  const simId = "154d0a7f-fd23-ed11-92ee-f0921c167860";
  const mc = new MicroCOMPS({
    baseUrl: "https://comps-dev.idmod.org",
    token: token,
  });
  mc.getSimulation(simId)
    .then(sim => {
      const pre = document.createElement("pre");
      pre.textContent = `File listing for simulation ${simId}\n`;
      pre.textContent += sim.getFileTree().getFileList().join("\n");
      document.body.append(pre);
    });
}

For more information on this example, see the README.md in the example's folder.

Documentation

MicroCOMPS API is fully documented with JSDoc comments. In modern IDEs such as VSCode and Webstorm, the JSDoc documentation is available by hovering over the name of any MicroCOMPS function call and most object data types used by the library.

Hover documentation

Philosophy

MicroCOMPS is a progressive JavaScript library that utilizes modern web technologies.

ES6

ES6-standard mechanisms such as fetch, Promise, and module import are utilized by this library. Modern browsers (i.e. recent versions of Chrome, Firefox, or Edge) will be required. In practice at IDM this is not a issue.

Asynchrony

Many operations in MicroCOMPS are asynchronous. For asynchronous I/O, MicroCOMPS uses the modern Promise mechanism. For information about using Promises, see here on MDN.

Object design

MicroCOMPS is composed of a small number of related classes that roughly model the way COMPS organizes its data. Classes shown here in red are planned but not yet implemented.

Build and deployment

NOTE: Since MicroCOMPS is distributed as an npm package and is cached at IDM's instance of Artifactory, normally it should not be necessary to build the MicroCOMPS library itself. These instructions are for the library maintainer.

Build only

MicroCOMPS is built and published as an NPM package. At IDM NPM packages are locally cached in Artifactory. The steps below assume you've cloned the repo and you've got a git bash prompt inside the cloned directory.

  1. ./build.sh
  2. The build script auto-increments the prerelease part of the semver by one on every build. (That's the "-4" in "0.1.0-4".) Here's what a successful build looks like in the console: Build

Build and deploy

To both build and deploy MicroCOMPS, again use the build.sh script:

  1. npm login # to publish to npm, log in to the maintainer npm account.
  2. ./build.sh --publish
  3. The build script will auto-increment the prerelease part of the semver, build, pack a .tgz with the microcomps npm package, then publish it to npm.

Questions?

Bryan Ressler ([email protected])

Footnotes

  1. MicroCOMPS was originally known as GuerrillaCOMPS.