Files
worldmonitor/api/cache-purge.js
Elie Habib ee8ca345cb refactor: consolidate Upstash helpers and extract DeckGL color config (#2465)
* refactor: consolidate Upstash helpers and extract DeckGL color config

Part 1 — api/_upstash-json.js: add getRedisCredentials, redisPipeline,
setCachedData exports. Migrate _oauth-token.js, reverse-geocode.js,
health.js, bootstrap.js, seed-health.js, and cache-purge.js off their
inline credential/pipeline boilerplate.

Part 2 — DeckGLMap.ts: extract getBaseColor, mineralColor, windColor,
TC_WIND_COLORS, CII_LEVEL_COLORS into src/config/ files so panels and
tests can reuse them without importing DeckGLMap.

Surfaced by reviewing nichm/worldmonitor-private fork.

* fix(mcp): restore throw-on-Redis-error in fetchOAuthToken; fix health error message

_oauth-token.js: readJsonFromUpstash returns null for HTTP errors, but
mcp.ts:702 relies on a throw to return 503 (retryable) vs null→401
(re-authenticate). Restore the explicit fetch that throws on !resp.ok,
using getRedisCredentials() for credential extraction.

health.js: the single null guard produced "Redis not configured" for
both missing creds and HTTP failures. Split into two checks so the
503 body correctly distinguishes env config problems from service
outages.

* fix(upstash): remove dead try/catch in reverse-geocode; atomic SET EX in setCachedData
2026-03-29 10:38:43 +04:00

6.7 KiB