* fix(trade): expand tariff coverage from 15 to 130+ countries
MAJOR_REPORTERS (15 countries) replaced with ALL_REPORTERS (130+
WTO members). Tariffs, trade restrictions, and barriers now seeded
for every WTO member economy, not just the original 15.
WTO API calls batched in groups of 30 to avoid URL length limits
while keeping total request count under 5.
Added shared/un-to-iso2.json (239 entries) for UN M49 to ISO2
mapping used by the cache key builder.
Removed hardcoded WTO_MEMBER_CODES lookup; uses WTO API response
field ReportingEconomy for country names instead.
* fix(trade): ESM-compatible file loading + fix row scope in buildFlowRecords
1. Replace require()/CJS __dirname with ESM imports (readFileSync,
dirname, fileURLToPath). The .mjs module can't use require(),
so un-to-iso2.json was never loaded and REPORTER_ISO2 fell back
to the 20-country hardcoded subset.
2. Fix ReferenceError in buildFlowRecords: row.ReportingEconomy was
accessed outside the for-of loop scope. Extract reporter/partner
names during row iteration and use them in the map callback.
3. Add reporterName/partnerName to parseFlowRows output so
buildFlowRecords has access to WTO economy names.
* fix(trade): load ALL 239 reporters from un-to-iso2.json, remove caps
1. ALL_REPORTERS now derived from Object.keys(un-to-iso2.json) at
startup: 239 economies, no manual list to maintain. Covers NZ,
Jamaica, Dominican Republic, Panama, and every other country.
2. Removed .slice(0, 50) caps on trade barriers and restrictions
so all reporter data is published.
3. Cleaned up duplicate ESM imports; single __dirname derivation.
* fix(trade): batch WTO barriers/restrictions in groups of 30
The WTO API returns HTTP 400 when all 239 reporter codes are passed
in a single r= parameter. Barriers and restrictions now batch in
groups of 30 with 1s delay between batches, matching the tariff
trends pattern. Also removed stale duplicate variable declarations.
* fix: add un-to-iso2.json to scripts/shared (sync test)
* fix(trade): fetch WTO reporter list from API instead of UN codes
The WTO API has its own reporter code system (288 economies) that
doesn't match UN M49 1:1. Sending un-to-iso2.json codes caused
HTTP 400 on 7/8 batches.
Now fetches /v1/reporters at startup to get the exact set of codes
the API accepts. Falls back to un-to-iso2.json if the reporter
endpoint fails.
* fix(trade): compute REPORTER_ISO2 lazily after fetchWtoReporters()
REPORTER_ISO2 was computed at module load when ALL_REPORTERS was
still []. Changed to getReporterIso2() function that evaluates
after ALL_REPORTERS is populated by fetchWtoReporters().