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

@varve/bis-stats-api

v0.1.0

Published

An isomorphic, Zod-validated TypeScript client for the BIS Stats SDMX API.

Readme

@varve/bis-stats-api

An isomorphic, Zod-validated TypeScript client for the BIS Stats SDMX API.

The BIS API implements a subset of SDMX REST v1.4. @varve/bis-stats-api wraps the data, data availability, and structure endpoints with typed request parameters while returning SDMX CSV, XML, EDI, or parsed SDMX JSON.

Installation

npm install @varve/bis-stats-api zod

Quick Start

import { BisStatsClient } from '@varve/bis-stats-api';

const client = new BisStatsClient();

const csv = await client.getDataCsv('WS_EER', {
  key: 'M.N.B.CH',
  lastNObservations: 12,
  detail: 'dataonly',
});

console.log(csv);

Data Queries

BIS data queries follow the SDMX v1.4 path shape /data/{flow}/{key}/all.

const csv = await client.getDataCsv('WS_EER', {
  key: 'M.N.B.CH',
  startPeriod: '2020-01',
  endPeriod: '2020-12',
});

const json = await client.getDataJson('BIS,WS_EER,1.0', {
  key: 'M.N+R.B.CH',
  lastNObservations: 2,
});

const xml = await client.getData('WS_EER', {
  key: 'M.N.B.CH',
  format: 'genericXml',
  lastNObservations: 1,
});

Availability Queries

Use availability constraints to discover valid dimension values for a flow and partial key.

const availability = await client.getAvailabilityJson('WS_EER', {
  key: 'M.N.B.',
  componentId: 'all',
  mode: 'available',
});

Structure Metadata

const flows = await client.listDataflows({ detail: 'allstubs' });
const eer = await client.getDataflow('WS_EER', { references: 'children' });
const codelists = await client.getCodelists({ resourceId: 'all', version: 'latest' });

The generic structure helper can access any structure resource exposed in the BIS OpenAPI document:

const categories = await client.getStructureResourceJson('categoryscheme', {
  agencyId: 'all',
  resourceId: 'all',
  version: 'latest',
});

Configuration

const client = new BisStatsClient({
  baseUrl: 'https://stats.bis.org/api/v1',
  timeoutMs: 30_000,
  userAgent: '@your/app',
});

Error Handling

import { BisStatsApiError, BisStatsResponseError } from '@varve/bis-stats-api';

try {
  await client.getDataJson('missing');
} catch (err) {
  if (err instanceof BisStatsApiError) {
    console.error(err.status, err.body, err.retryAfterMs);
  }
  if (err instanceof BisStatsResponseError) {
    console.error('Unexpected JSON payload:', err.body);
  }
}

Development

npm run test:unit -w @varve/bis-stats-api
npm run typecheck -w @varve/bis-stats-api
npm run build -w @varve/bis-stats-api

References

  • BIS Stats API: https://stats.bis.org/api/v1
  • SDMX REST v1.4: https://github.com/sdmx-twg/sdmx-rest/tree/v1.4.0