import type { BugVersionPackages } from '../core/entity/BugVersion.ts'; import { Package as PackageEntity } from '../core/entity/Package.ts'; import { PackageTag as PackageTagEntity } from '../core/entity/PackageTag.ts'; import { PackageVersion as PackageVersionEntity } from '../core/entity/PackageVersion.ts'; import type { PackageVersionManifest as PackageVersionManifestEntity } from '../core/entity/PackageVersionManifest.ts'; import { User as UserEntity } from '../core/entity/User.ts'; import { AbstractRepository } from './AbstractRepository.ts'; import type { PackageVersionManifest as PackageVersionManifestModel } from './model/PackageVersionManifest.ts'; export type PackageManifestType = Pick & { _id: string; _rev: string; 'dist-tags': Record; versions: Record; maintainers: AuthorType[]; time: { created: Date; modified: Date; [key: string]: Date; }; } & CnpmcorePatchInfo; export type AbbreviatedPackageJSONType = Pick & CnpmcorePatchInfo; export type AbbreviatedPackageManifestType = Pick & { modified: Date; versions: Record; time?: PackageManifestType['time']; } & CnpmcorePatchInfo; export type PackageJSONType = CnpmcorePatchInfo & { name: string; version: string; deprecated?: string; readme?: string; description?: string; keywords?: string[]; homepage?: string; bugs?: { url?: string; email?: string; }; license?: LicenseType | string; author?: AuthorType | string; contributors?: ContributorType[] | string[]; maintainers?: ContributorType[] | string[]; files?: string[]; main?: string; bin?: string | { [key: string]: string; }; man?: string | string[]; directories?: DirectoriesType; repository?: RepositoryType | string; scripts?: Record; config?: { 'bug-versions'?: BugVersionPackages; }; dependencies?: DepInfo; acceptDependencies?: DepInfo; devDependencies?: DepInfo; peerDependencies?: DepInfo; peerDependenciesMeta?: { [key: string]: { optional?: boolean; required?: string; version?: string; [key: string]: unknown; }; }; bundleDependencies?: string[]; bundledDependencies?: string[]; optionalDependencies?: DepInfo; engines?: { node?: string; npm?: string; [key: string]: string | undefined; }; os?: string[]; cpu?: string[]; preferGlobal?: boolean; private?: boolean; publishConfig?: { access?: 'public' | 'restricted'; [key: string]: unknown; }; _hasShrinkwrap?: boolean; hasInstallScript?: boolean; dist?: DistType; workspace?: string[]; _npmUser?: { name: string; email: string; }; [key: string]: unknown; }; export type PackageJSONPickKey = 'name' | 'author' | 'bugs' | 'description' | 'homepage' | 'keywords' | 'license' | 'readme' | 'readmeFilename' | 'repository' | 'versions' | 'contributors'; export interface CnpmcorePatchInfo { _cnpmcore_publish_time?: Date; publish_time?: number; _source_registry_name?: string; block?: string; blockVersions?: Record; } export type AbbreviatedKey = 'name' | 'version' | 'deprecated' | 'dependencies' | 'optionalDependencies' | 'devDependencies' | 'bundleDependencies' | 'peerDependencies' | 'peerDependenciesMeta' | 'bin' | 'os' | 'cpu' | 'libc' | 'workspaces' | 'directories' | 'dist' | 'engines' | 'hasInstallScript' | 'publish_time' | 'block' | '_hasShrinkwrap' | 'acceptDependencies' | 'funding'; export interface DistType { tarball: string; size?: number; unpackedSize?: number; shasum: string; integrity: string; [key: string]: unknown; } export interface AuthorType { name: string; username?: string; email?: string; url?: string; } export interface LicenseType { type: string; url: string; } export interface ContributorType { name?: string; email?: string; url?: string; [key: string]: unknown; } export interface DirectoriesType { lib?: string; bin?: string; man?: string; test?: string; [key: string]: string | undefined; } export interface RepositoryType { type: string; url: string; [key: string]: unknown; } export type DepInfo = Record; export declare class PackageRepository extends AbstractRepository { #private; private readonly Package; private readonly Dist; private readonly PackageVersion; private readonly PackageVersionManifest; private readonly PackageTag; private readonly Maintainer; private readonly User; private readonly totalRepository; findPackage(scope: string, name: string): Promise; findPackageByPackageId(packageId: string): Promise; findPackagesByPackageIds(packageIds: string[]): Promise; findPackageId(scope: string, name: string): Promise; savePackage(pkgEntity: PackageEntity): Promise; savePackageDist(pkgEntity: PackageEntity, isFullManifests: boolean): Promise; removePackageDist(pkgEntity: PackageEntity, isFullManifests: boolean): Promise; savePackageMaintainer(packageId: string, userId: string): Promise; listPackageMaintainers(packageId: string): Promise; replacePackageMaintainers(packageId: string, userIds: string[]): Promise; removePackageMaintainer(packageId: string, userId: string): Promise; listPackagesByUserId(userId: string): Promise; createPackageVersion(pkgVersionEntity: PackageVersionEntity): Promise; savePackageVersion(pkgVersionEntity: PackageVersionEntity): Promise; findPackageVersion(packageId: string, version: string): Promise; listPackageVersions(packageId: string): Promise; listPackageVersionNames(packageId: string): Promise; removePackageVersions(packageId: string): Promise; removePackageVersion(pkgVersion: PackageVersionEntity): Promise; savePackageVersionManifest(manifestEntity: PackageVersionManifestEntity): Promise; findPackageVersionManifest(packageVersionId: string): Promise; queryTotal(): Promise<{ packageCount: number; packageVersionCount: number; lastPackage: string; lastPackageVersion: string; }>; private fillPackageVersionEntityData; findPackageTag(packageId: string, tag: string): Promise; savePackageTag(packageTagEntity: PackageTagEntity): Promise; removePackageTag(packageTagEntity: PackageTagEntity): Promise; listPackageTags(packageId: string): Promise; }