( id: string, isVariable: boolean, env: Env, ctx: ExecutionContext, )
| 5 | import { updatePackageStatAll, updateVersion } from './update'; |
| 6 | |
| 7 | export const getVersion = async ( |
| 8 | id: string, |
| 9 | isVariable: boolean, |
| 10 | env: Env, |
| 11 | ctx: ExecutionContext, |
| 12 | ) => { |
| 13 | const value = await env.VERSIONS.get<VersionResponse>( |
| 14 | METADATA_KEYS.version(id), |
| 15 | { |
| 16 | type: 'json', |
| 17 | cacheTtl: KV_TTL, |
| 18 | }, |
| 19 | ); |
| 20 | |
| 21 | if (!value) { |
| 22 | return await updateVersion(id, isVariable, env, ctx); |
| 23 | } |
| 24 | |
| 25 | return value; |
| 26 | }; |
| 27 | |
| 28 | export const getPackageStatAll = async (env: Env, ctx: ExecutionContext) => { |
| 29 | const value = await env.METADATA.get<StatsResponseAllRecord>( |
no test coverage detected