/** * Research-corpus REF parser (#1490). * * TypeScript port of build.py's RefRecord parsing: scans * `documentation/references/REF-*.md` + `documentation/citations/REF-*-citations.md`, * parses frontmatter, and extracts/classifies the fields the markdown-view * renderers consume. Faithful to the Python source so output is byte-identical * (modulo the volatile `Generated:` timestamp). * * @source historical: corpus-index-build/build.py */ export interface RefRecord { refId: string; /** Canonical source type (#1509): paper/preprint/blog/repo/… (or meta/other). */ sourceType: string; /** Downstream consuming projects from the "## Referenced By" table (#1495). */ referencedByProjects: string[]; title: string; path: string; year: number | null; authors: string[]; affiliations: string[]; primaryAffiliation: string | null; venue: string | null; topics: string[]; methods: string[]; sizeTier: string | null; paramsM: number | null; incoming: Set; outgoing: Set; /** Radar/freshness sidecar (documentation/radar/REF-NNN-radar.md), or null. (#1497) */ radar: RadarMeta | null; /** Discovery/source-tracking block from the citation sidecar, or null. (#1497) */ discovery: DiscoveryMeta | null; /** Funder linkage from the citation sidecar `funders[]`. (#1497) */ funders: FunderRef[]; } /** Radar freshness-sidecar metadata (documentation/radar/REF-NNN-radar.md). */ export interface RadarMeta { gradeCurrent: string | null; gradeOriginal: string | null; gradeTrajectory: string | null; /** Enum word: monthly | quarterly | biannual | annual | on-demand. */ refreshCadence: string | null; /** ISO date (YYYY-MM-DD). */ lastRefreshed: string | null; cluster: string | null; sourcesSearched: string[]; } /** Discovery/source-tracking block (citation sidecar `discovery:`). */ export interface DiscoveryMeta { date: string | null; /** Vocab: x-search | x-account | rss | web | newsletter | referral | direct | … */ surface: string | null; via: string | null; /** PROF-S backlink, or null. */ curatorId: string | null; harvestBatch: string | null; harvestedBy: string | null; } /** Funder linkage entry (citation sidecar `funders[]`). */ export interface FunderRef { /** PROF-F slug or raw funder name. */ id: string; grantId: string | null; } export interface CorpusParse { records: RefRecord[]; corpusRoot: string; checksum: string; } /** Sort key for REF ids: [numeric, alpha-suffix]. Mirrors build.py ref_sort_key. */ export declare function refSortKey(refId: string): [number, string]; /** Compare two REF ids by (numeric, suffix). */ export declare function compareRefId(a: string, b: string): number; /** Title-case matching Python str.title(): cap first letter of each alpha run, lowercase the rest. */ export declare function slugToTitle(value: string): string; /** Normalize an author name to "Last, First" form. Mirrors build.py normalize_author. */ export declare function normalizeAuthor(name: string): string; export declare function parseFrontmatter(text: string): Record; /** Read + parse the radar sidecar for a REF (documentation/radar/REF-NNN-radar.md), or null when absent. (#1497) */ export declare function extractRadar(root: string, refId: string): RadarMeta | null; /** Extract the discovery/source-tracking block from parsed citation frontmatter. (#1497) */ export declare function extractDiscovery(citation: Record): DiscoveryMeta | null; /** Extract funder linkage from parsed citation frontmatter `funders[]`. (#1497) */ export declare function extractFunders(citation: Record): FunderRef[]; /** Scan a research corpus and parse all REF records. Mirrors build.py load_refs + checksum_sources. */ /** * Extract consuming-project names from a ref doc's "## Referenced By" table * (#1495). The Project column holds `[name](url)` links or plain text; we keep * the link text / plain value. Returns a de-duplicated list. */ export declare function extractReferencedByProjects(text: string): string[]; export declare function loadCorpus(root: string): CorpusParse; /** SHA-256 over sorted REF markdown (relative path bytes + file bytes). Mirrors build.py checksum_sources. */ export declare function checksumSources(root: string): string; /** List PROF-P-* people-profile slugs under the corpus. Used by enriched author renderers. */ export declare function loadProfileSlugs(corpusRoot: string): Set; /** A parsed entity profile (PROF-{P,O,G,F,S}). */ export interface ProfileRecord { profId: string; /** person | org | group | funder | source */ type: string | null; name: string | null; /** Normalized to REF-id strings regardless of list-of-strings vs list-of-dicts source shape. */ corpusRefs: string[]; frontmatter: Record; path: string; } /** * Load all entity profiles (PROF-{P,O,G,F,S}) from the corpus profiles dirs. (#1497) * * Tolerates both `corpus-refs` shapes the corpus uses — list-of-strings * (`['REF-1']`) and list-of-dicts (`[{ref: 'REF-1', role: 'primary-author'}]`) * — normalizing to REF-id strings (the schema-drift flagged in #1501/#1502). */ export declare function loadProfiles(corpusRoot: string): ProfileRecord[]; //# sourceMappingURL=ref-parser.d.ts.map