forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1export type ChartTimeGranularity = 'daily' | 'weekly' | 'monthly' | 'yearly'
2
3export type DateRangeFields = {
4 startDate?: string
5 endDate?: string
6}
7
8export type DailyDataPoint = { value: number; day: string; timestamp: number }
9export type WeeklyDataPoint = {
10 value: number
11 weekKey: string
12 weekStart: string
13 weekEnd: string
14 timestampStart: number
15 timestampEnd: number
16}
17export type MonthlyDataPoint = { value: number; month: string; timestamp: number }
18export type YearlyDataPoint = { value: number; year: string; timestamp: number }
19
20export type EvolutionData =
21 | DailyDataPoint[]
22 | WeeklyDataPoint[]
23 | MonthlyDataPoint[]
24 | YearlyDataPoint[]
25
26type EvolutionOptionsBase = {
27 startDate?: string
28 endDate?: string
29}
30
31export type EvolutionOptionsDay = EvolutionOptionsBase & {
32 granularity: 'day'
33}
34export type EvolutionOptionsWeek = EvolutionOptionsBase & {
35 granularity: 'week'
36 weeks?: number
37}
38export type EvolutionOptionsMonth = EvolutionOptionsBase & {
39 granularity: 'month'
40 months?: number
41}
42export type EvolutionOptionsYear = EvolutionOptionsBase & {
43 granularity: 'year'
44}
45
46export type EvolutionOptions =
47 | EvolutionOptionsDay
48 | EvolutionOptionsWeek
49 | EvolutionOptionsMonth
50 | EvolutionOptionsYear
51
52export type DailyRawPoint = { day: string; value: number }