Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.9 KiB
2.9 KiB
@suaveplan/currency-provider-ecb - Universal @suaveplan/currency provider for the European Central Bank (ECB) daily exchange-rates XML feed. Free, no API key. Implements the slim @suaveplan/currency-providers contract: typed CurrencyProviderError, injectable FetchLike from @suaveplan/types, shared httpRequest helper, mathematical conversion to any non-EUR base, AbortSignal propagation, target filtering, PARSE_ERROR / UNSUPPORTED_BASE / UNKNOWN_CURRENCY / HTTP_ERROR coverage.
Universal @suaveplan/currency rate provider for the European Central
Bank's daily exchange-rates XML feed. Free, no API key required. Built on the
slim @suaveplan/currency-providers plugin core: typed
CurrencyProviderError on every failure path, shared httpRequest() helper
for HTTP wrapping + abort-signal composition, injectable FetchLike from
@suaveplan/types, mathematical conversion to any non-EUR base, target
filtering with UNKNOWN_CURRENCY guarding, and PARSE_ERROR protection
against silently caching an empty rate map.
Documentation tree
- ecb —
EcbProvideris the@suaveplan/currencyrate-source implementation for the European Central Bank's daily reference-r…- ecb —
EcbProvideris the@suaveplan/currencyrate-source implementation for the European Central Bank's daily reference-r…
- ecb —
Install
bun add @suaveplan/currency-provider-ecb @suaveplan/currency @suaveplan/currency-providers
Quick start
import { CurrencyConverter } from "@suaveplan/currency";
import { EcbProvider } from "@suaveplan/currency-provider-ecb";
const converter = new CurrencyConverter({ provider: new EcbProvider() });
const rate = await converter.getRate("EUR", "USD");
Or via the slim core's registry, alongside other sibling provider packages:
import { CurrencyConverter } from "@suaveplan/currency";
import { CurrencyProviderRegistry } from "@suaveplan/currency-providers";
import { EcbProvider } from "@suaveplan/currency-provider-ecb";
const registry = new CurrencyProviderRegistry();
registry.register(new EcbProvider());
const converter = new CurrencyConverter({ provider: registry.get("ecb") });
Features
- Free, no API key.
- ~30 fiat currencies, EUR-quoted upstream; non-EUR bases derived arithmetically.
- Daily refresh (~16:00 CET); weekends / holidays return the last published snapshot.
RateFetchOptions.signalforwarded through the slim core's HTTP helper.- Typed
CurrencyProviderErrorcodes:HTTP_ERROR,PARSE_ERROR,UNSUPPORTED_BASE,UNKNOWN_CURRENCY. - Universal (browser / Web Worker / Node 18+ / Bun).
- Zero runtime deps beyond
@suaveplan/currency,@suaveplan/currency-providers,@suaveplan/types,tslib.
Modules
src/ecb/ecb.md—EcbProviderclass, configuration, error matrix, advanced examples.