query-registry
Version:
Query the npm registry for packuments, manifests, packages and download counts
25 lines (22 loc) • 1.28 kB
TypeScript
import * as z from "zod";
import type { DownloadPeriod } from "./download-period.js";
export declare const BulkPackageDownloads: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
package: z.ZodString;
downloads: z.ZodNumber;
start: z.ZodString;
end: z.ZodString;
}, z.core.$strip>]>>;
/**
`BulkPackageDownloads` describes the total number of downloads 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 BulkPackageDownloads = z.infer<typeof BulkPackageDownloads>;
/**
`getBulkPackageDownloads` returns the total number of downloads for
the given 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 BulkPackageDownloads}
*/
export declare function getBulkPackageDownloads(names: [string, string, ...string[]], period: DownloadPeriod, registry?: string): Promise<BulkPackageDownloads>;