query-registry
Version:
Query the npm registry for packuments, manifests, packages and download counts
29 lines (26 loc) • 1.44 kB
TypeScript
import * as z from "zod";
import type { DownloadPeriod } from "./download-period.js";
export declare const BulkDailyPackageDownloads: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNull, 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>]>>;
/**
`BulkDailyPackageDownloads` describes the total number of downloads for each day
for some packages in a given time period.
@see {@link https://github.com/npm/registry/blob/master/docs/download-counts.md#bulk-queries}
*/
export type BulkDailyPackageDownloads = z.infer<typeof BulkDailyPackageDownloads>;
/**
`getBulkDailyPackageDownloads` returns the total number of downloads for each day
for some packages in the given time period.
@param names - list of package names; the npm registry does not support scoped packages and handles a maximum of 128 packages at a time
@param period - {@link DownloadPeriod | time period} in which downloads happened; the npm registry limits bulk data to the last 365 days
@param registry - URL of the registry downloads API (default: npm registry downloads API)
@see {@link BulkDailyPackageDownloads}
*/
export declare function getBulkDailyPackageDownloads(names: [string, string, ...string[]], period: DownloadPeriod, registry?: string): Promise<BulkDailyPackageDownloads>;