//#region src/core/types.d.ts /** Normalized package metadata returned by any registry. */ interface Package { name: string; description: string; homepage: string; documentation: string; repository: string; licenses: string; keywords: string[]; namespace: string; latestVersion: string; metadata: Record; } /** A single version entry of a package. */ interface Version { number: string; publishedAt: Date | null; licenses: string; integrity: string; status: VersionStatus; metadata: Record; } /** Dependency of a package version. */ interface Dependency { name: string; requirements: string; scope: Scope; optional: boolean; } /** Maintainer / author of a package. */ interface Maintainer { uuid: string; login: string; name: string; email: string; url: string; role: string; } type VersionStatus = "" | "yanked" | "deprecated" | "retracted"; type Scope = "runtime" | "development" | "test" | "build" | "optional"; /** URL builder for a specific registry. */ interface URLBuilder { registry(name: string, version?: string): string; download(name: string, version: string): string; documentation(name: string, version?: string): string; readme(name: string, version?: string): string; purl(name: string, version?: string): string; } /** Options for the HTTP client. */ interface ClientOptions { maxRetries?: number; baseDelay?: number; timeout?: number; rateLimiter?: RateLimiter; userAgent?: string; } /** Rate limiter interface — bring your own implementation. */ interface RateLimiter { wait(signal?: AbortSignal): Promise; } /** Parsed PURL components. */ interface ParsedPURL { type: string; namespace: string; name: string; version: string; qualifiers: Record; subpath: string; } //#endregion //#region src/core/client.d.ts /** HTTP client with retry, backoff, rate limiting, and timeout. */ declare class Client { readonly maxRetries: number; readonly baseDelay: number; readonly timeout: number; readonly userAgent: string; private readonly rateLimiter; private readonly fetch; constructor(options?: ClientOptions); /** * Fetch JSON with retry and rate limiting. * * @param url - Request URL. * @param signal - Optional cancellation signal. * @param headers - Optional request headers. * @returns {Promise} The decoded response body. */ getJSON(url: string, signal?: AbortSignal, headers?: Readonly>): Promise; /** * ofetch drops its timeout once a signal is supplied, sleeps through backoff with a plain * timer and retries after an abort, so the request owns all three here. * * @param signal - Optional cancellation signal. * @returns {FetchOptions} The request hooks that own timeout, backoff and cancellation. */ private retryControl; private attemptSignal; } /** * Get or create the shared HTTP client. * * @returns {Client} The shared client. */ declare function defaultClient(): Client; //#endregion //#region src/core/registry.d.ts /** Common base for package registries and registry decorators. */ declare abstract class Registry { abstract ecosystem(): string; abstract fetchPackage(name: string, signal?: AbortSignal): Promise; abstract fetchVersions(name: string, signal?: AbortSignal): Promise; abstract fetchDependencies(name: string, version: string, signal?: AbortSignal): Promise; abstract fetchMaintainers(name: string, signal?: AbortSignal): Promise; abstract urls(): URLBuilder; } /** Constructor every adapter exposes, built-in or registered from outside the package. */ type RegistryConstructor = new (baseURL: string, client: Client) => Registry; /** One ecosystem the registry knows: static metadata plus a loader for the adapter class. */ interface RegistryEntry { /** PURL type the adapter serves. */ readonly ecosystem: string; /** Registry API URL used when `create()` gets none. */ readonly defaultURL: string; /** Resolves the adapter class; for a built-in that is a literal `import()` of its module. */ readonly load: () => Promise; } /** * Register an ecosystem adapter. * * Built-in adapters are already listed; this is the entry point for classes living outside the * package. Registering a key again replaces the previous adapter. * * @param ecosystem - Ecosystem key. * @param defaultURL - Default registry API URL. * @param RegistryClass - Adapter constructor. */ declare function register(ecosystem: string, defaultURL: string, RegistryClass: RegistryConstructor): void; /** * Create an adapter for a registered ecosystem. * * A built-in adapter's module is imported here, on the first call for its key; the module map * shares one import between parallel callers and answers later calls from cache. * * @param ecosystem - Ecosystem key. * @param baseURL - Optional registry API URL override. * @param client - Optional HTTP client. * @returns {Promise} The registry adapter. * @throws {UnknownEcosystemError} When nothing is registered under `ecosystem`. */ declare function create(ecosystem: string, baseURL?: string, client?: Client): Promise; /** * List registered ecosystems. * * @returns {string[]} The ecosystem keys, built-ins first in manifest order. */ declare function ecosystems(): string[]; /** * Check whether an ecosystem is registered. * * @param ecosystem - Ecosystem key. * @returns {boolean} Whether an adapter is registered. */ declare function has(ecosystem: string): boolean; //#endregion export { URLBuilder as _, ecosystems as a, Client as c, Dependency as d, Maintainer as f, Scope as g, RateLimiter as h, create as i, defaultClient as l, ParsedPURL as m, RegistryConstructor as n, has as o, Package as p, RegistryEntry as r, register as s, Registry as t, ClientOptions as u, Version as v, VersionStatus as y }; //# sourceMappingURL=registry.d.mts.map