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 zodNote: zod is a required peer dependency for runtime validation.
Available Packages
Statistics Canada
Time series vectors, table metadata, and release monitoring. Full coverage of all 16 WDS endpoints with automated 409/500 retry handling.
Statistics Canada
Industry and occupation classifications (NAICS/NOC), hierarchical code trees, plain-English index search, and version concordances.
UK Office for National Statistics
Economic and demographic timeseries by CDID, dataset topic navigation, observation querying, and filtered CSV/XLS data extracts.
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.