/** * The public npm registry search endpoint. */ export declare const DEFAULT_REGISTRY = "https://registry.npmjs.org"; /** * The largest `size` the registry search endpoint accepts. Asking for more is rejected. */ export declare const MAX_PAGE_SIZE = 250; /** * Upper bound on how many results `searchByKeywords` will page through. * * The registry reports a `total` that can run into the thousands for a broad keyword. * Paging all of it would mean dozens of sequential requests, which defeats the point of * replacing the `npm search` shell-out. 1000 is 4 requests at {@link MAX_PAGE_SIZE} and * covers every realistic plugin-discovery search. * * When the registry has more matches than this, the extra results are dropped and * `truncated` is set on the result so the caller can tell. */ export declare const DEFAULT_MAX_RESULTS = 1000; export interface RegistryPackage { name: string; version?: string; description?: string; keywords?: string[]; date?: string; links?: Record; publisher?: { username?: string; email?: string; }; maintainers?: Array<{ username?: string; email?: string; }>; [key: string]: unknown; } export interface RegistrySearchResponse { objects: Array<{ package: RegistryPackage; }>; total: number; } export interface FetchPackagesOptions { /** * Registry base URL. Defaults to {@link DEFAULT_REGISTRY}. */ registry?: string; /** * Cap on results fetched across all pages. Defaults to {@link DEFAULT_MAX_RESULTS}. */ maxResults?: number; /** * Aborts the in-flight requests. */ signal?: AbortSignal; /** * `fetch` implementation to use. Defaults to the global `fetch`. */ fetch?: typeof globalThis.fetch; } export interface FetchPackagesResult { packages: RegistryPackage[]; /** * `true` when the registry reported more matches than `maxResults` allowed us to fetch. */ truncated: boolean; } export declare class RegistrySearchError extends Error { readonly status?: number | undefined; constructor(message: string, status?: number | undefined); } /** * Queries the npm registry search endpoint for packages carrying `keywords`, * paging until `total` is reached or `maxResults` is hit. * * The registry's `keywords:` qualifier is not a strict conjunction, so the returned * packages still need filtering by {@link hasAllKeywords} on the caller's side. */ export declare function fetchPackagesByKeywords(keywords: string[], options?: FetchPackagesOptions): Promise; //# sourceMappingURL=registry.d.ts.map