(
packageName: MaybeRefOrGetter<string>,
createdIso: MaybeRefOrGetter<string | null | undefined>,
evolutionOptions: MaybeRefOrGetter<EvolutionOptions>,
)
| 337 | } |
| 338 | |
| 339 | async function fetchPackageDownloadEvolution( |
| 340 | packageName: MaybeRefOrGetter<string>, |
| 341 | createdIso: MaybeRefOrGetter<string | null | undefined>, |
| 342 | evolutionOptions: MaybeRefOrGetter<EvolutionOptions>, |
| 343 | ): Promise<DailyDataPoint[] | WeeklyDataPoint[] | MonthlyDataPoint[] | YearlyDataPoint[]> { |
| 344 | const resolvedPackageName = toValue(packageName) |
| 345 | const resolvedCreatedIso = toValue(createdIso) ?? null |
| 346 | const resolvedOptions = toValue(evolutionOptions) |
| 347 | |
| 348 | const { start, end } = resolveDateRange(resolvedOptions, resolvedCreatedIso) |
| 349 | |
| 350 | const startIso = toIsoDate(start) |
| 351 | const endIso = toIsoDate(end) |
| 352 | |
| 353 | const sortedDaily = await fetchDailyRangeChunked(resolvedPackageName, startIso, endIso) |
| 354 | |
| 355 | if (resolvedOptions.granularity === 'day') return buildDailyEvolution(sortedDaily) |
| 356 | if (resolvedOptions.granularity === 'week') |
| 357 | return buildWeeklyEvolution(sortedDaily, startIso, endIso) |
| 358 | if (resolvedOptions.granularity === 'month') |
| 359 | return buildMonthlyEvolution(sortedDaily, startIso, endIso) |
| 360 | return buildYearlyEvolution(sortedDaily, startIso, endIso) |
| 361 | } |
| 362 | |
| 363 | async function fetchPackageLikesEvolution( |
| 364 | packageName: MaybeRefOrGetter<string>, |
nothing calls this directly
no test coverage detected