query-registry
Version:
Query the npm registry for packuments, manifests, packages and download counts
29 lines (26 loc) • 1.19 kB
TypeScript
import * as z from "zod";
import type { DownloadPeriod } from "./download-period.js";
export declare const DailyPackageDownloads: z.ZodObject<{
package: z.ZodString;
start: z.ZodString;
end: z.ZodString;
downloads: z.ZodArray<z.ZodObject<{
downloads: z.ZodNumber;
day: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
/**
`DailyPackageDownloads` describes the total number of downloads for each day
for a package in a given time period.
@see {@link https://github.com/npm/registry/blob/master/docs/download-counts.md#ranges}
*/
export type DailyPackageDownloads = z.infer<typeof DailyPackageDownloads>;
/**
`getDailyPackageDownloads` returns the total number of downloads for each day
for a package in the given time period.
@param name - package name
@param period - {@link DownloadPeriod | time period} in which downloads happened; the npm registry limits data to the last 18 months
@param registry - URL of the registry downloads API (default: npm registry downloads API)
@see {@link DailyPackageDownloads}
*/
export declare function getDailyPackageDownloads(name: string, period: DownloadPeriod, registry?: string): Promise<DailyPackageDownloads>;