/**
 * Version/date resolution over a {@link PkgBlob}: parsing stored version strings into comparable
 * {@link RVersion}s, decoding the day-granularity release dates, and picking the effective version for a query.
 * Split out of `../sigdb` so the reader/writer there stays focused on the byte format.
 */
import { RVersion } from '../../util/r-version';
import type { PkgBlob } from './schema';
/** milliseconds since the Unix epoch for a stored day count (dates are stored at day granularity to save space) */
export declare function dayToMillis(day: number): number;
/** the inclusive millisecond window spanned by a `YYYY`, `YYYY.MM`, or `YYYY.MM.DD` date spec */
export interface DateWindow {
    readonly lower: number;
    readonly upper: number;
}
/**
 * Parse a `YYYY`, `YYYY.MM`, or `YYYY.MM.DD` spec into its inclusive `[lower, upper]` millisecond window (the whole
 * year / month / day named), or `undefined` when malformed or out of range (month `1..12`, day `1..31`).
 */
export declare function parseDateWindow(spec: string): DateWindow | undefined;
/** whether `spec` is a release-date bound like `<=2026` or `>=2021.05` (a comparator is required) */
export declare function isDateBound(spec: string): boolean;
/**
 * A release-date predicate for a bound like `<=2026`, `>=2021.05.03` (`YYYY.MM.DD`, comparator required), or
 * `undefined` when `spec` is not a date bound. An undated release (or an impossible date) never matches.
 */
export declare function releaseDateBound(spec: string): ((date: Date | undefined) => boolean) | undefined;
/** one release: a parsed version paired with its release date */
export interface VersionRelease {
    readonly version: RVersion;
    readonly date: Date;
}
/**
 * The known releases of a blob, ascending by R-version order (empty when no dates were stored). Versions that
 * differ in writing but not in order (`1.2` and `1.2.0`) compare equal, so their dates settle them.
 */
export declare function releasesOf(blob: Readonly<PkgBlob> | undefined): VersionRelease[];
/** the version with the newest release date (falling back to `latest`, then the highest by R-version order) */
export declare function newestVersion(blob: Readonly<PkgBlob>, latest: string): string | undefined;
/** pick the version tuple: requested, else the package's latest, else the highest present by R-version order */
export declare function resolveVersion(blob: Readonly<PkgBlob>, latest: string, version?: string): string | undefined;
