/** * Retroactive duplicate scan across the whole library (#108). * * `detectDuplicate` answers "is this incoming record a duplicate of anything I already have?" — * one item against the library, which is right for `add`. Sweeping an existing library with it * would be O(n²): 6,000 references means 18 million normalized comparisons. This module reuses * the same normalization rules but groups by key instead, which is O(n). * * See spec/features/superseded.md. */ import type { CslItem } from "../../core/csl-json/types.js"; /** Identifier a scan can group by. */ export type DuplicateKeyType = "doi" | "pmid" | "isbn" | "arxiv" | "eric" | "scopus" | "title"; export declare const DUPLICATE_KEY_TYPES: readonly DuplicateKeyType[]; /** * Keys used when `--by` is not given. * * `title` is excluded: title + authors + year is the noisiest rule in `detector.ts`, and across a * whole library it produces false pairs (errata, translations, reprinted chapters) that the * identifier-based keys do not. It stays available opt-in. */ export declare const DEFAULT_DUPLICATE_KEY_TYPES: readonly DuplicateKeyType[]; /** A set of references that match each other. */ export interface DuplicateGroup { /** Every key type that contributed to this group, in DUPLICATE_KEY_TYPES order */ types: DuplicateKeyType[]; /** The matched value per contributing type */ keys: Partial>; /** Two or more references */ items: CslItem[]; /** True when the group is already fully linked by superseded pointers */ resolved: boolean; } export interface ScanOptions { /** Key types to group by (default: DEFAULT_DUPLICATE_KEY_TYPES) */ by?: readonly DuplicateKeyType[]; /** Report groups already linked by superseded pointers (default: false) */ includeResolved?: boolean; } export declare function scanDuplicates(items: CslItem[], options?: ScanOptions): DuplicateGroup[]; /** * Suggest which member of a group to keep. * * Completeness first, then the later publication year. That ordering is what separates an * online-first record from its version of record: the VoR is the one that gained volume, issue * and page numbers. This is a suggestion — `--fix` presents it as the pre-selected choice, never * applies it unattended. */ export declare function suggestKeeper(items: CslItem[]): CslItem; //# sourceMappingURL=scanner.d.ts.map