UNPKG

1.4 kBTypeScriptView Raw
1/**
2 * `DownloadPeriod` represents a time period
3 * for which downloads should be counted.
4 *
5 * @remarks
6 * The following time periods are supported:
7 *
8 * - a {@link DefaultDownloadPeriod} (for example, `last-week`)
9 *
10 * - a date for a single day (for example, `new Date('2020-01-01')`)
11 *
12 * - a {@link DateRange}
13 *
14 * @see {@link DefaultDownloadPeriod}
15 * @see {@link DateRange}
16 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date}
17 */
18export declare type DownloadPeriod = DefaultDownloadPeriod | Date | DateRange;
19/**
20 * `DefaultDownloadPeriod` represents the default time periods
21 * supported by the npm registry.
22 */
23export declare type DefaultDownloadPeriod = 'last-day' | 'last-week' | 'last-month' | 'last-year';
24/**
25 * `DateRange` represents a time period between two days
26 * where the `start` and `end` dates are inclusive.
27 *
28 * @example
29 * ```typescript
30 * const dateRange = {
31 * start: new Date('2019-01-01'),
32 * end: new Date('2020-01-01'),
33 * };
34 * ```
35 *
36 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date}
37 */
38export interface DateRange {
39 /** Date of the first day (inclusive) */
40 readonly start: Date;
41 /** Date of the last day (inclusive) */
42 readonly end: Date;
43}
44//# sourceMappingURL=download-period.d.ts.map
\No newline at end of file