MIT Licensed

Varve Agency SDKs

Technical documentation for isomorphic, Zod-validated TypeScript clients interacting with Statistics Canada and the UK Office for National Statistics APIs.

Installation

npm install @varve/statcan-wds @varve/statcan-rdaas @varve/ons-api zod

Note: zod is a required peer dependency for runtime validation.

Architecture & Design

Runtime Validation

All external API responses are parsed through Zod schemas. Upstream contract violations or structural anomalies throw structured errors immediately rather than corrupting application state.

Isomorphic Implementation

Clients rely exclusively on the standard Fetch API without Node.js-specific dependencies. Supported across Node.js 18+, modern browsers, and edge runtimes (e.g., Cloudflare Workers).

Network Resilience

Built-in retry mechanisms with exponential backoff. Automatically handles transient 409/429/500 HTTP statuses, transparently respecting Retry-After headers.

Build Optimization

Distributed as dual ESM/CJS bundles. Explicitly marked as side-effect free (sideEffects: false) to ensure comprehensive tree-shaking in modern bundlers.