(env: Env, ctx: ExecutionContext)
| 26 | }; |
| 27 | |
| 28 | export const getPackageStatAll = async (env: Env, ctx: ExecutionContext) => { |
| 29 | const value = await env.METADATA.get<StatsResponseAllRecord>( |
| 30 | METADATA_KEYS.downloads, |
| 31 | { |
| 32 | type: 'json', |
| 33 | cacheTtl: KV_TTL, |
| 34 | }, |
| 35 | ); |
| 36 | |
| 37 | if (!value) { |
| 38 | return await updatePackageStatAll(env, ctx); |
| 39 | } |
| 40 | |
| 41 | return value; |
| 42 | }; |
| 43 | |
| 44 | export const getPackageStat = async ( |
| 45 | id: string, |
no test coverage detected