import type { ExistsResult, ExistsOptions } from './npm.js'; interface PurlObject { name: string; namespace?: string | undefined; qualifiers?: Record | undefined; subpath?: string | undefined; type?: string | undefined; version?: string | undefined; } /** * Normalize PyPI package URL. * Lowercases namespace, name, and version, replaces underscores with dashes in name. * Spec: namespace, name, and version are all case-insensitive. */ export declare function normalize(purl: PurlObject): PurlObject; /** * Validate PyPI package URL. * Name must not contain injection characters. */ export declare function validate(purl: PurlObject, throws: boolean): boolean; /** * Check if a PyPI package exists in the registry. * * Queries PyPI at https://pypi.org/pypi to verify package existence and * optionally validate a specific version. Returns the latest version from * package metadata. * * **Caching:** Responses can be cached using a TTL cache to reduce registry * requests. Pass `{ cache }` option with a cache instance from `createTtlCache()`. * * @param name - Package name (e.g., 'requests', 'django') * @param version - Optional version to validate (e.g., '2.28.1') * @param options - Optional configuration including cache * @returns Promise resolving to existence result with latest version * * @example * ```typescript * // Check if package exists * const result = await pypiExists('requests') * // -> { exists: true, latestVersion: '2.31.0' } * * // Validate specific version * const result = await pypiExists('django', '4.2.0') * // -> { exists: true, latestVersion: '5.0.0' } * * // With caching * import { createTtlCache } from '@socketsecurity/lib/cache-with-ttl' * const cache = createTtlCache({ ttl: 5 * 60 * 1000, prefix: 'pypi' }) * const result = await pypiExists('requests', undefined, { cache }) * * // Non-existent package * const result = await pypiExists('this-package-does-not-exist') * // -> { exists: false, error: 'Package not found' } * ``` */ export declare function pypiExists(name: string, version?: string, options?: ExistsOptions): Promise; export {};