import type { DepID } from '@vltpkg/dep-id'; import type { NodeLike } from '@vltpkg/types'; /** * Parameter options for initializing a security archive. */ export type SecurityArchiveRefreshOptions = { /** * A @link{GraphLike} instance to find what packages the * security archive should have. */ nodes: NodeLike[]; }; /** * An interface for interacting with a security archive. */ export interface SecurityArchiveLike { get: (depId: DepID) => PackageReportData | undefined; set: (depId: DepID, data: PackageReportData) => void; delete: (depId: DepID) => void; has: (depId: DepID) => boolean; clear: () => void; ok?: boolean; } export declare const isSecurityArchiveLike: (o: unknown) => o is SecurityArchiveLike; export declare const asSecurityArchiveLike: (o: unknown) => SecurityArchiveLike; /** * Package alert extra information. */ export type PackageAlertProps = { lastPublish: string; cveId?: `CVE-${string}`; cwes?: { id: `CWE-${string}`; }[]; }; /** * A known alert for a given package. */ export type PackageAlert = { key: string; type: string; severity: 'low' | 'medium' | 'high' | 'critical'; category: string; props?: PackageAlertProps; }; /** * The scores for a given package */ export type PackageScore = { /** * The average of all score factors. (0-1) */ overall: number; /** * Score factors relating to package licensing (0-1) */ license: number; /** * Score factors relating to package maintenance (0-1) */ maintenance: number; /** * Score factors relating to code quality (0-1) */ quality: number; /** * Score factors relating to supply chain security (0-1) */ supplyChain: number; /** * Score factors relating to package vulnerabilities (0-1) */ vulnerability: number; }; /** * The report data for a given package. */ export type PackageReportData = { id: string; author: string[]; size: number; type: 'npm'; namespace?: `@${string}`; name: string; version: string; license: string; alerts: PackageAlert[]; score: PackageScore; }; export declare const isPackageReportData: (o: unknown) => o is PackageReportData; export declare const asPackageReportData: (o: unknown) => PackageReportData;