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/boc-valet

v0.2.0

Published

An isomorphic, Zod-validated TypeScript client for the Bank of Canada Valet API.

Readme

@varve/boc-valet

An isomorphic, Zod-validated TypeScript client for the Bank of Canada Valet API.

The Valet API provides Bank of Canada financial data and metadata, including exchange rates, interest rates, economic statistics, series catalogues, and grouped time series.

Installation

npm install @varve/boc-valet zod

zod is a required peer dependency.

Quick start

import { BocValetClient } from '@varve/boc-valet';

const client = new BocValetClient();

const data = await client.getObservations(['FXUSDCAD', 'FXEURCAD'], {
  startDate: '2024-01-01',
  endDate: '2024-01-31',
});

console.log(data.observations);

Discovery

const series = await client.listSeries();
const groups = await client.listGroups();

const usdCad = await client.getSeries('FXUSDCAD');
const dailyFx = await client.getGroup('FX_RATES_DAILY');

Valet exposes catalogue responses as maps keyed by series or group identifier.

Observations

const latest = await client.getObservations('FXUSDCAD', {
  recent: 5,
  orderDir: 'desc',
});

const group = await client.getGroupObservations('FX_RATES_DAILY', {
  recent: 1,
});

Observation rows keep the native Valet shape:

{
  d: '2024-01-02',
  FXUSDCAD: { v: '1.3312' }
}

The client prevents incompatible date filters, matching Valet's documented rule: recent, recent_weeks, recent_months, and recent_years cannot be combined with start_date or end_date.

Graph metadata

For graph imports or charting, use the normalized helper:

const graph = await client.getObservationGraphMetadata(['FXUSDCAD', 'FXEURCAD'], {
  recent: 10,
});

console.log(graph.series);
console.log(graph.periods);
console.log(graph.observations);

The normalized observation values remain strings because Valet returns numeric values as strings and some series may use non-numeric values.

FX RSS

Valet also exposes a foreign exchange RSS/RDF XML feed. This package returns it as raw XML text:

const xml = await client.getFxRss('FXUSDCAD');

Configuration

const client = new BocValetClient({
  baseUrl: 'https://www.bankofcanada.ca/valet',
  maxRetries: 2, // accepted for compatibility; retries are handled by callers
  timeoutMs: 30_000,
});

The client performs one timeout-bound HTTP request per method call. Non-2xx responses expose status, and Retry-After is parsed as retryAfterMs when present.

API reference

  • listSeries()
  • listGroups()
  • getSeries(seriesName)
  • getGroup(groupName)
  • getObservations(seriesNames, params)
  • getGroupObservations(groupName, params)
  • getObservationGraphMetadata(seriesNames, params)
  • getGroupObservationGraphMetadata(groupName, params)
  • getFxRss(seriesNames?)

Official references