import { configure } from '@superset-ui/translation'; configure(); const caches = {}; class Cache { cache: object; constructor(key: string) { caches[key] = caches[key] || {}; this.cache = caches[key]; } match(url: string): Promise { return new Promise((resolve, reject) => resolve(this.cache[url])); } delete(url: string): Promise { delete this.cache[url]; return new Promise((resolve, reject) => resolve(true)); } put(url: string, response: Response): Promise { this.cache[url] = response; return Promise.resolve(); } }; class CacheStorage { open(key: string): Promise { return new Promise((resolve, reject) => { resolve(new Cache(key)); }); } delete(key: string): Promise { const wasPresent = key in caches; if (wasPresent) { caches[key] = undefined; } return Promise.resolve(wasPresent); } }; global.caches = new CacheStorage();