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

@bizjournals/js-providers

v0.2.1

Published

ACBJ javascript state providers

Downloads

311

Readme

Providers

Providers engage Bizjournal's APIs to provide critical data to our applications. A provider has three parts: resolution, parsing, and caching/storing.

Resolution uses a resolver, defaulted to axios.get to obtain data from the API endpoint. When the method resolve is called the specific end point must be provided.

Parsing occurs when the response is received but before caching/storing takes place. The method parser is called after resolve hits an API end point and receives a successful response.

Caching/storing occurs after parsing, and if a cached response can be provided prior to hitting an API end point the promise will resolve immediately with those results. Caching is not required for a provider, but when used it must be an instance of the StorageAbstract found in the js-storage module.

Installing

Using npm:

npm install @bizjournals/js-providers

Using yarn:

yarn add @bizjournals/js-providers

Configuring your environment:

You will need to configure an NPM_TOKEN within your project to include these private modules. The best idea is to use an existing project as an example.

For simple setups the .gitlab-ci.yml file within this project as a guide to accessing project variables via the .npmrc file

Examples

The Providers are used within our Vue environments but do not need to be. They do use ES6 and must be compiled down to support our support matrix.

import { meta } from "@bizjournals/utilities";
import { UserProvider, MarketProvider } from "@bizjournals/js-providers";

let market = meta("market:json");

Promise.resolve([
    UserProvider.resolve(`/context/user-state?v=${new Date().getTime()}`),
    MarketProvider.resolve(`/api/market/${market.market_code}`)
]).then(([user, market]) => {
    console.log(user);
    console.log(market);

    window.analytics = window.analytics || {};
            
    window.analytics.source = user.analytics.source;
    window.analytics.accountType = user.analytics.accountType;
    window._satReady = true;
    
    // do something with the user and market variables
})

ProviderAbstract

This is the base class with the primary API methods. Each of the Providers are extensions of this class and may contain additional functionality. The resolve method follows the API argument pattern of whatever the resolver is set to, by default axios.get.

API

constructor(StorageReference) : ProviderAbstract
resolve(...args) : Promise
resolver() : Function
parser({ data }) : Mixed
withCache(StorageReference) : ProviderAbstract
hasCache() : Boolean
checkCache() : Object|null

MarketProvider

This hooks into local storage to store returns from the api underneath a namespaced prefix.

API

Some slight variations from the default API for this module.

constructor(marketCode : String)
resolve(endpoint : String, options : Object)

Local Storage

The reference used presently is bizj.m.market.${marketCode} which will only save when there is sufficient memory for the browser agent to store the results. Otherwise, it will proceed without conflict and retrieve and return the data from the API endpoint.

Returns

{
    analytics_code: String,
    circ_product_id: String,
    city: String,
    is_virtual: Boolean,
    local_sales_tax: String,
    market_abbrev: String,
    market_code: String,
    market_color: String,
    market_id: String,
    market_name: String,
    primary_zip_code: String,
    region: String,
    region_objective: String,
    state: String,
    timezone: String,
    utc_dst_offset: String,
    utc_std_offset: String,
    markets: Array,
    channels: Array,
    relationships: {
        navigation: Object,
        journal: Object,
        commerce: Object,
        social: Object
    }
}

UserProvider

This hooks into local storage to store returns from the API endpoint provided.

API

Some slight variations from the default API for this module. The tearDown method is used to destroy references which are needed to perform a sign out on our site.

constructor()
resolve(endpoint : String, options : Object)
tearDown()

Local Storage

The reference used presently is bizj.m.user which will only save when there is sufficient memory for the browser agent to store the results. Otherwise, it will proceed without conflict and retrieve and return the data from the API endpoint.

Returns

{
    analytics: {
        source: String,
        accountType: String
    },
    cookies: Array,
    email: String,
    emailProducts: Object,
    fromPortal: Boolean,
    hasCart: Boolean,
    noembargo: Array,
    noembargo_subs: Array,
    saved_article_ids: Array,
    type: String,
    welcome: String,
}