(key: string, id: string, ttlMs: number)
| 19 | } |
| 20 | |
| 21 | export function getFreshLocalCacheValue<T>(key: string, id: string, ttlMs: number): T | null { |
| 22 | const cache = getLocalCache<T>(key); |
| 23 | const entry = cache[id]; |
| 24 | if (!entry) return null; |
| 25 | return Date.now() - entry.timestamp < ttlMs ? entry.data : null; |
| 26 | } |
| 27 | |
| 28 | export function isFallbackPayload(value: unknown): value is { fallback: true; error?: string; message?: string } { |
| 29 | return !!value && typeof value === "object" && (value as { fallback?: boolean }).fallback === true; |
no test coverage detected