UNPKG

query-registry

Version:

Query the npm registry for packuments, manifests, packages and download counts

77 lines (74 loc) 2.92 kB
import * as z from "zod"; export declare const SearchCriteria: z.ZodObject<{ text: z.ZodString; size: z.ZodOptional<z.ZodNumber>; from: z.ZodOptional<z.ZodNumber>; quality: z.ZodOptional<z.ZodNumber>; popularity: z.ZodOptional<z.ZodNumber>; maintenance: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>; /** `SearchCriteria` describes the available search criteria for searching packages. @see {@link https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search} */ export type SearchCriteria = z.infer<typeof SearchCriteria>; export declare const SearchResults: z.ZodObject<{ objects: z.ZodArray<z.ZodObject<{ package: z.ZodObject<{ date: z.ZodString; publisher: z.ZodOptional<z.ZodObject<{ username: z.ZodString; email: z.ZodString; }, z.core.$strip>>; maintainers: z.ZodArray<z.ZodObject<{ username: z.ZodString; email: z.ZodString; }, z.core.$strip>>; links: z.ZodObject<{ npm: z.ZodOptional<z.ZodString>; homepage: z.ZodOptional<z.ZodString>; repository: z.ZodOptional<z.ZodString>; bugs: z.ZodOptional<z.ZodString>; }, z.core.$strip>; name: z.ZodString; version: z.ZodString; description: z.ZodOptional<z.ZodString>; keywords: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>; score: z.ZodObject<{ final: z.ZodNumber; detail: z.ZodObject<{ quality: z.ZodNumber; popularity: z.ZodNumber; maintenance: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; searchScore: z.ZodNumber; downloads: z.ZodObject<{ monthly: z.ZodNumber; weekly: z.ZodNumber; }, z.core.$strip>; dependents: z.ZodCoercedNumber<unknown>; updated: z.ZodString; flags: z.ZodObject<{ insecure: z.ZodCoercedBoolean<unknown>; unstable: z.ZodOptional<z.ZodCoercedBoolean<unknown>>; }, z.core.$strip>; license: z.ZodOptional<z.ZodString>; }, z.core.$strip>>; total: z.ZodNumber; time: z.ZodString; }, z.core.$strip>; /** `SearchResults` describes the results returned by the registry for a search query. @see {@link https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search} */ export type SearchResults = z.infer<typeof SearchResults>; /** `searchPackages` returns the packages corresponding to a given query. @param criteria - one or more search criteria @param registry - URL of the registry (default: npm registry) @see {@link SearchCriteria} @see {@link SearchResults} */ export declare function searchPackages(criteria: SearchCriteria, registry?: string): Promise<SearchResults>;